Updates for feature request 3164348: Make default privacy configurable.
This commit is contained in:
parent
4cc46f2686
commit
65bd4bfab8
@ -14,6 +14,13 @@
|
||||
* @link http://sourceforge.net/projects/semanticscuttle/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Array for defaults.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
$defaults = array();
|
||||
|
||||
|
||||
/***************************************************
|
||||
* HTML output configuration
|
||||
@ -493,6 +500,16 @@ $votingMode = 2;
|
||||
*/
|
||||
$hideBelowVoting = null;
|
||||
|
||||
/**
|
||||
* Default privacy setting for bookmarks:
|
||||
* 0 - Public
|
||||
* 1 - Shared with Watchlist
|
||||
* 2 - Private
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
$defaults['privacy'] = 0;
|
||||
|
||||
|
||||
/****************************
|
||||
* Website Thumbnails
|
||||
|
@ -7,6 +7,13 @@
|
||||
* See config.default.inc.php for more options.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Array for defaults.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
$defaults = array();
|
||||
|
||||
/**
|
||||
* The name of this site.
|
||||
*
|
||||
@ -116,6 +123,21 @@ $adminemail = 'admin@example.org';
|
||||
$admin_users = array();
|
||||
|
||||
|
||||
/***************************************************
|
||||
* Bookmarks
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default privacy setting for bookmarks.
|
||||
* 0 - Public
|
||||
* 1 - Shared with Watchlist
|
||||
* 2 - Private
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
$defaults['privacy'] = 0;
|
||||
|
||||
|
||||
/**
|
||||
* You have completed the basic configuration!
|
||||
* More options can be found in config.default.php.
|
||||
|
@ -256,7 +256,7 @@ if ($currenttag!= '') {
|
||||
foreach ($bookmarks as $key => &$row) {
|
||||
switch ($row['bStatus']) {
|
||||
case 0:
|
||||
$access = '';
|
||||
$access = ' public';
|
||||
break;
|
||||
case 1:
|
||||
$access = ' shared';
|
||||
|
@ -1343,6 +1343,30 @@ class BookmarkTest extends TestBase
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test that the default privacy setting in
|
||||
* $GLOBALS['defaults']['privacy'] is used
|
||||
* as expected.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDefaultPrivacy()
|
||||
{
|
||||
$GLOBALS['defaults']['privacy'] = 1;
|
||||
$uid = $this->addUser();
|
||||
$this->us->setCurrentUserId($uid);
|
||||
$bid = $this->bs->addBookmark('http://www.somedomain.com', 'mybookmark1', 'descr1', 'privatenote1', $GLOBALS['defaults']['privacy'], array());
|
||||
$bm = $this->bs->getBookmark($bid);
|
||||
$this->assertEquals('1', $bm['bStatus']);
|
||||
$GLOBALS['defaults']['privacy'] = 2;
|
||||
$uid = $this->addUser();
|
||||
$this->us->setCurrentUserId($uid);
|
||||
$bid = $this->bs->addBookmark('http://www.anotherdomain.com', 'mybookmark2', 'descr2', 'privatenote2', $GLOBALS['defaults']['privacy'], array());
|
||||
$bm = $this->bs->getBookmark($bid);
|
||||
$this->assertEquals('2', $bm['bStatus']);
|
||||
}//end function testDefaultPrivacy
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ if (isset($_REQUEST['dt']) && (trim($_REQUEST['dt']) != '')) {
|
||||
|
||||
$replace = isset($_REQUEST['replace']) && ($_REQUEST['replace'] == 'yes');
|
||||
|
||||
$status = 0;
|
||||
$status = $GLOBALS['defaults']['privacy'];
|
||||
if (isset($_REQUEST['status'])) {
|
||||
$status_str = trim($_REQUEST['status']);
|
||||
if (is_numeric($status_str)) {
|
||||
|
@ -185,7 +185,7 @@ if ($templatename == 'editbookmark.tpl') {
|
||||
'bDescription' => stripslashes(POST_DESCRIPTION),
|
||||
'bPrivateNote' => stripslashes(POST_PRIVATENOTE),
|
||||
'tags' => (POST_TAGS ? explode(',', stripslashes(POST_TAGS)) : array()),
|
||||
'bStatus' => 0,
|
||||
'bStatus' => $GLOBALS['defaults']['privacy'],
|
||||
);
|
||||
$tplVars['tags'] = POST_TAGS;
|
||||
} else {
|
||||
@ -201,7 +201,7 @@ if ($templatename == 'editbookmark.tpl') {
|
||||
'bDescription' => stripslashes(GET_DESCRIPTION),
|
||||
'bPrivateNote' => stripslashes(GET_PRIVATENOTE),
|
||||
'tags' => (GET_TAGS ? explode(',', stripslashes(GET_TAGS)) : array()),
|
||||
'bStatus' => 0
|
||||
'bStatus' => $GLOBALS['defaults']['privacy']
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TIT
|
||||
isset($_POST['address']) ? define('POST_ADDRESS', $_POST['address']): define('POST_ADDRESS', '');
|
||||
isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
|
||||
isset($_POST['privateNote']) ? define('POST_PRIVATENOTE', $_POST['privateNote']): define('POST_PRIVATENOTE', '');
|
||||
isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
|
||||
isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', $GLOBALS['defaults']['privacy']);
|
||||
isset($_POST['tags']) ? define('POST_TAGS', $_POST['tags']): define('POST_TAGS', '');
|
||||
|
||||
isset($_GET['popup']) ? define('GET_POPUP', $_GET['popup']): define('GET_POPUP', '');
|
||||
|
@ -27,7 +27,7 @@ require_once 'www-header.php';
|
||||
/* Managing all possible inputs */
|
||||
// First input is $_FILES
|
||||
// Other inputs
|
||||
isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
|
||||
isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', $GLOBALS['defaults']['privacy']);
|
||||
|
||||
|
||||
if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['size'] > 0) {
|
||||
@ -36,7 +36,7 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
|
||||
if (is_numeric(POST_STATUS)) {
|
||||
$status = intval(POST_STATUS);
|
||||
} else {
|
||||
$status = 2;
|
||||
$status = $GLOBALS['defaults']['privacy'];
|
||||
}
|
||||
|
||||
$depth = array();
|
||||
|
@ -28,7 +28,7 @@ $bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
|
||||
/* Managing all possible inputs */
|
||||
// First input is $_FILES
|
||||
// Other inputs
|
||||
isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
|
||||
isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', $GLOBALS['defaults']['privacy']);
|
||||
|
||||
$countImportedBookmarks = 0;
|
||||
$tplVars['msg'] = '';
|
||||
@ -39,7 +39,7 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
|
||||
if (is_numeric(POST_STATUS)) {
|
||||
$status = intval(POST_STATUS);
|
||||
} else {
|
||||
$status = 2;
|
||||
$status = $GLOBALS['defaults']['privacy'];
|
||||
}
|
||||
|
||||
// File handle
|
||||
|
Loading…
Reference in New Issue
Block a user