aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-05-13 06:57:54 +0200
committerChristian Weiske <cweiske@cweiske.de>2011-05-13 06:57:54 +0200
commit803b83fb7d051593066b5224a59fbf3ec6efc824 (patch)
tree173c97393f9e211b05f8c73793c180a1b88799b0
parentfbfbd8d5cae579058b5d31b97c062cefd9bb36b6 (diff)
parent88d7b9631b444cef28115fb8e0bae736b45e557e (diff)
downloadsemanticscuttle-803b83fb7d051593066b5224a59fbf3ec6efc824.tar.gz
semanticscuttle-803b83fb7d051593066b5224a59fbf3ec6efc824.tar.bz2
Merge branch 'master' into ssl-client-certs
-rw-r--r--.gitignore1
-rw-r--r--data/config.default.php17
-rw-r--r--data/config.php.dist16
-rw-r--r--src/SemanticScuttle/header.php2
-rw-r--r--tests/Api/PostsAddTest.php48
-rw-r--r--tests/TestBaseApi.php24
-rwxr-xr-xtests/data/BookmarkTest_deliciousbookmarks.xml7
-rwxr-xr-xtests/data/BookmarkTest_netscapebookmarks.html27
-rw-r--r--tests/prepare.php2
-rwxr-xr-xtests/www/bookmarksTest.php80
-rwxr-xr-xtests/www/editTest.php48
-rwxr-xr-xtests/www/importNetscapeTest.php33
-rwxr-xr-xtests/www/importTest.php33
-rw-r--r--www/api/posts_add.php2
-rw-r--r--www/bookmarks.php4
-rw-r--r--www/edit.php2
-rw-r--r--www/import.php4
-rw-r--r--www/importNetscape.php4
18 files changed, 329 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore
index c8531b7..e512e0c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ dist/
build.properties
package.xml
semanticscuttle-dump.sql
+data/config.unittest.php
diff --git a/data/config.default.php b/data/config.default.php
index b2c7307..8c47e0b 100644
--- a/data/config.default.php
+++ b/data/config.default.php
@@ -14,6 +14,13 @@
* @link http://sourceforge.net/projects/semanticscuttle/
*/
+/**
+ * Array for defaults.
+ *
+ * @var array
+ */
+$defaults = array();
+
/***************************************************
* HTML output configuration
@@ -508,6 +515,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
diff --git a/data/config.php.dist b/data/config.php.dist
index c135e8e..302d55f 100644
--- a/data/config.php.dist
+++ b/data/config.php.dist
@@ -7,6 +7,7 @@
* See config.default.inc.php for more options.
*/
+
/**
* The name of this site.
*
@@ -116,6 +117,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.
diff --git a/src/SemanticScuttle/header.php b/src/SemanticScuttle/header.php
index c1c0fcd..b0705b0 100644
--- a/src/SemanticScuttle/header.php
+++ b/src/SemanticScuttle/header.php
@@ -107,7 +107,7 @@ T_bind_textdomain_codeset($domain, 'UTF-8');
T_textdomain($domain);
// 4 // Session
-if (!defined('UNIT_TEST_MODE')) {
+if (!defined('UNIT_TEST_MODE') || defined('HTTP_UNIT_TEST_MODE')) {
session_start();
if ($GLOBALS['enableVoting']) {
if (isset($_SESSION['lastUrl'])) {
diff --git a/tests/Api/PostsAddTest.php b/tests/Api/PostsAddTest.php
index 53aa8e7..02e2b38 100644
--- a/tests/Api/PostsAddTest.php
+++ b/tests/Api/PostsAddTest.php
@@ -406,5 +406,51 @@ TXT;
$this->assertEquals(1, $data['total']);
$this->assertEquals($title2, $data['bookmarks'][0]['bTitle']);
}
+
+
+ /**
+ * Test that a default privacy setting of 2 (Private) is used in adding
+ * a bookmark.
+ */
+ public function testDefaultPrivacyPrivate()
+ {
+ $this->setUnittestConfig(
+ array('defaults' => array('privacy' => 2))
+ );
+ list($req, $uId) = $this->getAuthRequest('?unittestMode=1');
+ $req->setMethod(HTTP_Request2::METHOD_POST);
+ $req->addPostParameter('url', 'http://www.example.org/testdefaultprivacyposts_addprivate');
+ $req->addPostParameter('description', 'Test bookmark 1 for default privacy.');
+ $req->send();
+ $this->us->setCurrentUserId($uId);
+ $bms = $this->bs->getBookmarks(0, null, $uId);
+ $this->assertEquals(1, count($bms['bookmarks']));
+ $bm = reset($bms['bookmarks']);
+ $this->assertEquals('2', $bm['bStatus']);
+ }//end testDefaultPrivacyPrivate
+
+
+ /**
+ * Test that a default privacy setting of 0 (Public) is used in adding
+ * a bookmark.
+ */
+ public function testDefaultPrivacyPublic()
+ {
+ $this->setUnittestConfig(
+ array('defaults' => array('privacy' => 0))
+ );
+ list($req, $uId) = $this->getAuthRequest('?unittestMode=1');
+ $req->setMethod(HTTP_Request2::METHOD_POST);
+ $req->addPostParameter('url', 'http://www.example.org/testdefaultprivacyposts_addpublic');
+ $req->addPostParameter('description', 'Test bookmark 1 for default privacy.');
+ $req->send();
+ $this->us->setCurrentUserId($uId);
+ $bms = $this->bs->getBookmarks(0, null, $uId);
+ $this->assertEquals(1, count($bms['bookmarks']));
+ $bm = reset($bms['bookmarks']);
+ $this->assertEquals('0', $bm['bStatus']);
+ }//end testDefaultPrivacyPublic
+
+
}
-?> \ No newline at end of file
+?>
diff --git a/tests/TestBaseApi.php b/tests/TestBaseApi.php
index 036ab6b..2caa701 100644
--- a/tests/TestBaseApi.php
+++ b/tests/TestBaseApi.php
@@ -49,6 +49,11 @@ class TestBaseApi extends TestBase
}
$this->url = $GLOBALS['unittestUrl'] . $this->urlPart;
+ //clean up before test
+ if (file_exists($GLOBALS['datadir'] . '/config.unittest.php')) {
+ unlink($GLOBALS['datadir'] . '/config.unittest.php');
+ }
+
$this->us = SemanticScuttle_Service_Factory::get('User');
$this->us->deleteAll();
$this->bs = SemanticScuttle_Service_Factory::get('Bookmark');
@@ -60,19 +65,7 @@ class TestBaseApi extends TestBase
/**
- * Clean up after test
- */
- public function tearDown()
- {
- if (file_exists($GLOBALS['datadir'] . '/config.unittest.php')) {
- unlink($GLOBALS['datadir'] . '/config.unittest.php');
- }
- }
-
-
-
- /**
- * Gets a HTTP request object.
+ * Creates and returns a HTTP GET request object.
* Uses $this->url plus $urlSuffix as request URL.
*
* @param string $urlSuffix Suffix for the URL
@@ -111,7 +104,7 @@ class TestBaseApi extends TestBase
/**
- * Creates a user and a HTTP request object and prepares
+ * Creates a user and a HTTP GET request object and prepares
* the request object with authentication details, so that
* the user is logged in.
*
@@ -125,6 +118,7 @@ class TestBaseApi extends TestBase
* @return array(HTTP_Request2, integer) HTTP request object and user id
*
* @uses getRequest()
+ * @see getLoggedInRequest()
*/
protected function getAuthRequest($urlSuffix = null, $auth = true)
{
@@ -147,7 +141,7 @@ class TestBaseApi extends TestBase
/**
* Creates a user and a HTTP_Request2 object, does a normal login
- * and prepares the cookies for the HTTP request object so that
+ * and prepares the cookies for the HTTP GET request object so that
* the user is seen as logged in when requesting any HTML page.
*
* Useful for testing HTML pages or ajax URLs.
diff --git a/tests/data/BookmarkTest_deliciousbookmarks.xml b/tests/data/BookmarkTest_deliciousbookmarks.xml
new file mode 100755
index 0000000..87c67dc
--- /dev/null
+++ b/tests/data/BookmarkTest_deliciousbookmarks.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<posts user="dpuser" update="2011-03-24T21:09:22Z" tag="" total="3">
+ <post href="http://www.example.org/testdefaultprivacyposts_import1/" hash="4f8533885bb5740b98b6415140a0c8c6" description="Test bookmark 1 for default privacy." tag="tag1, tag2" time="2011-03-24T21:09:11Z" extended="" meta="5c80704730a1bf1b9eb615d4ba7a59bd" />
+ <post href="http://www.example.org/testdefaultprivacyposts_import2/" hash="21eee08d7945ac23c4cc2b6d08d02212" description="Test bookmark 2 for default privacy." tag="tag2, tag3" time="2011-03-24T21:08:33Z" extended="" meta="7514ab84f61ba1dd0413572f7c12348d" />
+ <post href="http://www.example.org/testdefaultprivacyposts_import3/" hash="cd64042205a083f1cf1e009344daef84" description="Test bookmark 3 for default privacy." tag="tag1, tag2, tag3" time="2011-03-24T21:07:44Z" extended="" meta="9cb24fddbc011e9634595d2f5e1a6537" />
+</posts>
+<!-- fe09.api.del.ac4.yahoo.net uncompressed/chunked Thur Mar 24 21:09:33 UTC 2011 -->
diff --git a/tests/data/BookmarkTest_netscapebookmarks.html b/tests/data/BookmarkTest_netscapebookmarks.html
new file mode 100755
index 0000000..305662c
--- /dev/null
+++ b/tests/data/BookmarkTest_netscapebookmarks.html
@@ -0,0 +1,27 @@
+<!DOCTYPE NETSCAPE-Bookmark-file-1>
+
+<!-- This is an automatically generated file.
+
+It will be read and overwritten.
+
+Do Not Edit! -->
+
+<TITLE>Bookmarks for testuser</TITLE>
+
+<H1>Bookmarks for testuser</H1>
+
+
+<DL><p>
+
+ <DT><A HREF="http://www.example.org/testdefaultprivacyposts_importNetscape1" ADD_DATE="1301178264" LAST_VISIT="1301178075" LAST_MODIFIED="1301178075">Test bookmark 1 for default privacy.</A>
+ <DT><A HREF="http://www.example.org/testdefaultprivacyposts_importNetscape2" ADD_DATE="1301178264" LAST_VISIT="1301178075" LAST_MODIFIED="1301178075">Test bookmark 2 for default privacy.</A>
+ <DT><A HREF="http://www.example.org/testdefaultprivacyposts_importNetscape3" ADD_DATE="1301178264" LAST_VISIT="1301178075" LAST_MODIFIED="1301178075">Test bookmark 3 for default privacy.</A>
+ <DT><A HREF="http://www.thisbookmarkwillnotbeadded.com" ADD_DATE="1301178264" LAST_VISIT="1301178075" LAST_MODIFIED="1301178075">This bookmark will be ignored by importNetscape.php.</A>
+
+</DL><p>
+
+<DL><p>
+
+
+
+</DL><p>
diff --git a/tests/prepare.php b/tests/prepare.php
index 6afc284..c80306e 100644
--- a/tests/prepare.php
+++ b/tests/prepare.php
@@ -16,7 +16,9 @@
/**
* Prepare the application for unit testing
*/
+//that's needed in constants.php
$_SERVER['HTTP_HOST'] = 'http://localhost/';
+
define('UNIT_TEST_MODE', true);
if ('@data_dir@' == '@' . 'data_dir@') {
diff --git a/tests/www/bookmarksTest.php b/tests/www/bookmarksTest.php
new file mode 100755
index 0000000..df360cc
--- /dev/null
+++ b/tests/www/bookmarksTest.php
@@ -0,0 +1,80 @@
+<?php
+require_once dirname(__FILE__) . '/../prepare.php';
+require_once 'HTTP/Request2.php';
+
+class www_bookmarksTest extends TestBaseApi
+{
+ protected $urlPart = 'api/posts/add';
+
+ /**
+ * Test that the default privacy setting is selected in the Privacy
+ * drop-down list when adding a new bookmark, sending the form and
+ * missing the title and the privacy setting.
+ */
+ public function testDefaultPrivacyBookmarksAddMissingTitleMissingPrivacy()
+ {
+ $this->setUnittestConfig(
+ array('defaults' => array('privacy' => 2))
+ );
+ list($req, $uId) = $this->getLoggedInRequest();
+ $cookies = $req->getCookieJar();
+ $req->setMethod(HTTP_Request2::METHOD_POST);
+ $req->addPostParameter('url', 'http://www.example.org/testdefaultprivacyposts_bookmarksget');
+ $req->addPostParameter('description', 'Test bookmark 1 for default privacy.');
+ $req->addPostParameter('status', '0');
+ $req->send();
+
+ $bms = $this->bs->getBookmarks(0, null, $uId);
+ $this->assertEquals(1, count($bms['bookmarks']));
+ $user = $this->us->getUser($uId);
+ $reqUrl = $GLOBALS['unittestUrl'] . 'bookmarks.php/' . $user['username'] . '?action=get' . '&unittestMode=1';
+
+ list($req, $uId) = $this->getAuthRequest('?unittestMode=1');
+ $req->setMethod(HTTP_Request2::METHOD_POST);
+ $req->setUrl($reqUrl);
+ $req->setCookieJar($cookies);
+ $req->addPostParameter('submitted', '1');
+ $response = $req->send();
+ $response_body = $response->getBody();
+
+ $x = simplexml_load_string($response_body);
+ $ns = $x->getDocNamespaces();
+ $x->registerXPathNamespace('ns', reset($ns));
+
+ $elements = $x->xpath('//ns:select[@name="status"]/ns:option[@selected="selected"]');
+ $this->assertEquals(1, count($elements), 'No selected status option found');
+ $this->assertEquals(2, (string)$elements[0]['value']);
+ }//end testDefaultPrivacyBookmarksAddMissingTitleMissingPrivacy
+
+
+ /**
+ * Test that the default privacy setting is selected in the Privacy
+ * drop-down list when a new bookmark is being created.
+ */
+ public function testDefaultPrivacyBookmarksAdd()
+ {
+ $this->setUnittestConfig(
+ array('defaults' => array('privacy' => 1))
+ );
+ list($req, $uId) = $this->getLoggedInRequest('?unittestMode=1');
+
+ $user = $this->us->getUser($uId);
+ $reqUrl = $GLOBALS['unittestUrl'] . 'bookmarks.php/'
+ . $user['username'] . '?action=add' . '&unittestMode=1';
+ $req->setUrl($reqUrl);
+ $req->setMethod(HTTP_Request2::METHOD_GET);
+ $response = $req->send();
+ $response_body = $response->getBody();
+ $this->assertNotEquals('', $response_body, 'Response is empty');
+
+ $x = simplexml_load_string($response_body);
+ $ns = $x->getDocNamespaces();
+ $x->registerXPathNamespace('ns', reset($ns));
+
+ $elements = $x->xpath('//ns:select[@name="status"]/ns:option[@selected="selected"]');
+ $this->assertEquals(1, count($elements), 'No selected status option found');
+ $this->assertEquals(1, (string)$elements[0]['value']);
+ }//end testDefaultPrivacyBookmarksAdd
+
+}//end class www_bookmarksTest
+?>
diff --git a/tests/www/editTest.php b/tests/www/editTest.php
new file mode 100755
index 0000000..1e0fbd5
--- /dev/null
+++ b/tests/www/editTest.php
@@ -0,0 +1,48 @@
+<?php
+require_once dirname(__FILE__) . '/../prepare.php';
+require_once 'HTTP/Request2.php';
+
+class www_editTest extends TestBaseApi
+{
+ protected $urlPart = 'api/posts/add';
+
+ /**
+ * Test that the default privacy setting is used when an existing
+ * bookmark is updated with edit.php.
+ */
+ public function testDefaultPrivacyEdit()
+ {
+ $this->setUnittestConfig(
+ array('defaults' => array('privacy' => 2))
+ );
+
+ list($req, $uId) = $this->getLoggedInRequest('?unittestMode=1');
+ $cookies = $req->getCookieJar();
+ $req->setMethod(HTTP_Request2::METHOD_POST);
+ $req->addPostParameter('url', 'http://www.example.org/testdefaultprivacyposts_edit');
+ $req->addPostParameter('description', 'Test bookmark 2 for default privacy.');
+ $req->addPostParameter('status', '0');
+ $res = $req->send();
+ $this->assertEquals(
+ 200, $res->getStatus(),
+ 'Adding bookmark failed: ' . $res->getBody());
+ $bms = $this->bs->getBookmarks(0, null, $uId);
+ $bm = reset($bms['bookmarks']);
+ $bmId = $bm['bId'];
+
+ $reqUrl = $GLOBALS['unittestUrl'] . 'edit.php/' . $bmId . '?unittestMode=1';
+ $req2 = new HTTP_Request2($reqUrl, HTTP_Request2::METHOD_POST);
+ $req2->setCookieJar($cookies);
+ $req2->addPostParameter('address', 'http://www.example.org/testdefaultprivacyposts_edit');
+ $req2->addPostParameter('title', 'Test bookmark 2 for default privacy.');
+ $req2->addPostParameter('submitted', '1');
+ $res = $req2->send();
+
+ $this->assertEquals(302, $res->getStatus(), 'Editing bookmark failed');
+
+ $bm = $this->bs->getBookmark($bmId);
+ $this->assertEquals('2', $bm['bStatus']);
+ }//end testDefaultPrivacyEdit
+
+}//end class www_editTest
+?>
diff --git a/tests/www/importNetscapeTest.php b/tests/www/importNetscapeTest.php
new file mode 100755
index 0000000..9d4cacd
--- /dev/null
+++ b/tests/www/importNetscapeTest.php
@@ -0,0 +1,33 @@
+<?php
+require_once dirname(__FILE__) . '/../prepare.php';
+require_once 'HTTP/Request2.php';
+
+class www_importNetscapeTest extends TestBaseApi
+{
+ protected $urlPart = 'importNetscape.php';
+
+ /**
+ * Test that the default privacy setting is used when bookmarks
+ * are imported from an HTML bookmarks file using importNetscape.php.
+ */
+ public function testDefaultPrivacyImportNetscape()
+ {
+ $this->setUnittestConfig(
+ array('defaults' => array('privacy' => 1))
+ );
+ list($req, $uId) = $this->getLoggedInRequest();
+ $req->setMethod(HTTP_Request2::METHOD_POST);
+ $req->setUrl($GLOBALS['unittestUrl'] . 'importNetscape.php' . '?unittestMode=1');
+ $req->addUpload('userfile', dirname(__FILE__) . '/../data/BookmarkTest_netscapebookmarks.html');
+ $res = $req->send();
+ $this->assertEquals(200, $res->getStatus(), 'Bookmark import failed');
+
+ $this->us->setCurrentUserId($uId);
+ $bms = $this->bs->getBookmarks(0, null, $uId);
+ $this->assertEquals(3, count($bms['bookmarks']));
+ $bm = reset($bms['bookmarks']);
+ $this->assertEquals('1', $bm['bStatus']);
+ }//end testDefaultPrivacyImportNetscape
+
+}//end class www_importNetscapeTest
+?>
diff --git a/tests/www/importTest.php b/tests/www/importTest.php
new file mode 100755
index 0000000..895a320
--- /dev/null
+++ b/tests/www/importTest.php
@@ -0,0 +1,33 @@
+<?php
+require_once dirname(__FILE__) . '/../prepare.php';
+require_once 'HTTP/Request2.php';
+
+class www_importTest extends TestBaseApi
+{
+ protected $urlPart = 'import.php';
+
+ /**
+ * Test that the default privacy setting is used when bookmarks
+ * are imported from an XML bookmarks file using import.php.
+ */
+ public function testDefaultPrivacyImport()
+ {
+ $this->setUnittestConfig(
+ array('defaults' => array('privacy' => 2))
+ );
+ list($req, $uId) = $this->getLoggedInRequest();
+ $req->setMethod(HTTP_Request2::METHOD_POST);
+ $req->setUrl($GLOBALS['unittestUrl'] . 'import.php' . '?unittestMode=1');
+ $req->addUpload('userfile', dirname(__FILE__) . '/../data/BookmarkTest_deliciousbookmarks.xml');
+ $res = $req->send();
+ $this->assertEquals(302, $res->getStatus(), 'Bookmark import failed');
+
+ $this->us->setCurrentUserId($uId);
+ $bms = $this->bs->getBookmarks(0, null, $uId);
+ $this->assertEquals(3, count($bms['bookmarks']));
+ $bm = reset($bms['bookmarks']);
+ $this->assertEquals('2', $bm['bStatus']);
+ }//end testDefaultPrivacyImport
+
+}//end class www_importTest
+?>
diff --git a/www/api/posts_add.php b/www/api/posts_add.php
index 7f9dc59..80d6515 100644
--- a/www/api/posts_add.php
+++ b/www/api/posts_add.php
@@ -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)) {
diff --git a/www/bookmarks.php b/www/bookmarks.php
index ee0612e..efc1680 100644
--- a/www/bookmarks.php
+++ b/www/bookmarks.php
@@ -191,7 +191,7 @@ if ($templatename == 'editbookmark.tpl') {
'bDescription' => stripslashes(POST_DESCRIPTION),
'bPrivateNote' => stripslashes(POST_PRIVATENOTE),
'tags' => ($_POST['tags'] ? $_POST['tags'] : array()),
- 'bStatus' => 0,
+ 'bStatus' => $GLOBALS['defaults']['privacy'],
);
$tplVars['tags'] = $_POST['tags'];
} else {
@@ -207,7 +207,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']
);
}
diff --git a/www/edit.php b/www/edit.php
index fbea163..cbfa30b 100644
--- a/www/edit.php
+++ b/www/edit.php
@@ -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', '');
diff --git a/www/import.php b/www/import.php
index 5263aba..3aa2714 100644
--- a/www/import.php
+++ b/www/import.php
@@ -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();
diff --git a/www/importNetscape.php b/www/importNetscape.php
index e23c156..b476c40 100644
--- a/www/importNetscape.php
+++ b/www/importNetscape.php
@@ -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