diff --git a/api/posts_add.php b/api/posts_add.php index e27fc99..ba3e02c 100644 --- a/api/posts_add.php +++ b/api/posts_add.php @@ -73,7 +73,7 @@ if (is_null($url) || is_null($description)) { if ($bookmarkservice->bookmarkExists($url, $userservice->getCurrentUserId())) $added = false; else - $added = $bookmarkservice->addBookmark($url, $description, $extended, $status, $tags, $dt, true); + $added = $bookmarkservice->addBookmark($url, $description, $extended, '', $status, $tags, $dt, true); } // Set up the XML file and output the result. diff --git a/bookmarks.php b/bookmarks.php index b7a5077..f0ce07d 100644 --- a/bookmarks.php +++ b/bookmarks.php @@ -32,11 +32,13 @@ isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): defi isset($_GET['title']) ? define('GET_TITLE', $_GET['title']): define('GET_TITLE', ''); isset($_GET['address']) ? define('GET_ADDRESS', $_GET['address']): define('GET_ADDRESS', ''); isset($_GET['description']) ? define('GET_DESCRIPTION', $_GET['description']): define('GET_DESCRIPTION', ''); +isset($_GET['privateNote']) ? define('GET_PRIVATENOTE', $_GET['privateNote']): define('GET_PRIVATENOTE', ''); isset($_GET['tags']) ? define('GET_TAGS', $_GET['tags']): define('GET_TAGS', ''); isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', ''); 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['tags']) ? define('POST_TAGS', $_POST['tags']): define('POST_TAGS', ''); @@ -133,10 +135,11 @@ if ($userservice->isLoggedOn() && POST_SUBMITTED != '') { } else { $title = trim(POST_TITLE); $description = trim(POST_DESCRIPTION); + $privateNote = trim(POST_PRIVATENOTE); $status = intval(POST_STATUS); $categories = trim(POST_TAGS); $saved = true; - if ($bookmarkservice->addBookmark($address, $title, $description, $status, $categories)) { + if ($bookmarkservice->addBookmark($address, $title, $description, $privateNote, $status, $categories)) { if (POST_POPUP != '') { $tplVars['msg'] = ''; } else { @@ -175,6 +178,7 @@ if ($templatename == 'editbookmark.tpl') { 'bTitle' => stripslashes(POST_TITLE), 'bAddress' => stripslashes(POST_ADDRESS), 'bDescription' => stripslashes(POST_DESCRIPTION), + 'bPrivateNote' => stripslashes(POST_PRIVATENOTE), 'tags' => (POST_TAGS ? explode(',', stripslashes(POST_TAGS)) : array()), 'bStatus' => 0, ); @@ -184,6 +188,7 @@ if ($templatename == 'editbookmark.tpl') { 'bTitle' => stripslashes(GET_TITLE), 'bAddress' => stripslashes(GET_ADDRESS), 'bDescription' => stripslashes(GET_DESCRIPTION), + 'bPrivateNote' => stripslashes(GET_PRIVATENOTE), 'tags' => (GET_TAGS ? explode(',', stripslashes(GET_TAGS)) : array()), 'bStatus' => 0 ); diff --git a/edit.php b/edit.php index 7a5b0ab..1ecb9d0 100644 --- a/edit.php +++ b/edit.php @@ -31,6 +31,7 @@ isset($_POST['delete']) ? define('POST_DELETE', $_POST['delete']): define('POST_ isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', ''); 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['tags']) ? define('POST_TAGS', $_POST['tags']): define('POST_TAGS', ''); @@ -62,10 +63,11 @@ if (!($row = $bookmarkservice->getBookmark(intval($bookmark), true))) { $address = trim(POST_ADDRESS); $title = trim(POST_TITLE); $description = trim(POST_DESCRIPTION); + $privateNote = trim(POST_PRIVATENOTE); $status = intval(POST_STATUS); $tags = trim(POST_TAGS); - if (!$bookmarkservice->updateBookmark($bId, $address, $title, $description, $status, $tags)) { + if (!$bookmarkservice->updateBookmark($bId, $address, $title, $description, $privateNote, $status, $tags)) { $tplvars['error'] = T_('Error while saving your bookmark'); } else { if (POST_POPUP != '') { diff --git a/import.php b/import.php index adf89ad..29a119b 100644 --- a/import.php +++ b/import.php @@ -100,7 +100,7 @@ function startElement($parser, $name, $attrs) { $bDatetime = gmdate('Y-m-d H:i:s'); } - if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $status, $tags, $bDatetime, true, true)) + if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, '', $status, $tags, $bDatetime, true, true)) $tplVars['msg'] = T_('Bookmark imported.'); else $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.'); diff --git a/importNetscape.php b/importNetscape.php index b720001..e7fe31f 100644 --- a/importNetscape.php +++ b/importNetscape.php @@ -84,6 +84,8 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si case "TAGS": $bCategories = $attrVal; break; + case "NOTE": + $bPrivateNote = $attrVal; } } $bTitle = trim($titles[$i]); @@ -100,7 +102,7 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si $bDatetime = gmdate('Y-m-d H:i:s'); } - if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $status, $bCategories, $bDatetime, false, true)) { + if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $bPrivateNote, $status, $bCategories, $bDatetime, false, true)) { $countImportedBookmarks++; } else { $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.'); diff --git a/services/bookmarkservice.php b/services/bookmarkservice.php index ecd93f2..4b000b4 100644 --- a/services/bookmarkservice.php +++ b/services/bookmarkservice.php @@ -108,7 +108,7 @@ class BookmarkService { // Adds a bookmark to the database. // Note that date is expected to be a string that's interpretable by strtotime(). - function addBookmark($address, $title, $description, $status, $categories, $date = NULL, $fromApi = false, $fromImport = false, $sId = -1) { + function addBookmark($address, $title, $description, $privateNote, $status, $categories, $date = NULL, $fromApi = false, $fromImport = false, $sId = -1) { if($sId == -1) { $userservice = & ServiceFactory :: getServiceInstance('UserService'); $sId = $userservice->getCurrentUserId(); @@ -134,7 +134,7 @@ class BookmarkService { $datetime = gmdate('Y-m-d H:i:s', $time); // Set up the SQL insert statement and execute it. - $values = array('uId' => intval($sId), 'bIp' => $ip, 'bDatetime' => $datetime, 'bModified' => $datetime, 'bTitle' => $title, 'bAddress' => $address, 'bDescription' => $description, 'bStatus' => intval($status), 'bHash' => md5($address)); + $values = array('uId' => intval($sId), 'bIp' => $ip, 'bDatetime' => $datetime, 'bModified' => $datetime, 'bTitle' => $title, 'bAddress' => $address, 'bDescription' => $description, 'bPrivateNote' => $privateNote, 'bStatus' => intval($status), 'bHash' => md5($address)); $sql = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values); $this->db->sql_transaction('begin'); if (!($dbresult = & $this->db->sql_query($sql))) { @@ -153,8 +153,6 @@ class BookmarkService { $uriparts = explode('.', $address); $extension = end($uriparts); unset($uriparts); - - trigger_error($GLOBALS['filetypes'].'aaaaaaaaaaaaaaaaaaaaa'); $b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService'); if (!$b2tservice->attachTags($bId, $categories, $fromApi, $extension, false, $fromImport)) { @@ -167,7 +165,7 @@ class BookmarkService { return $bId; } - function updateBookmark($bId, $address, $title, $description, $status, $categories, $date = NULL, $fromApi = false) { + function updateBookmark($bId, $address, $title, $description, $privateNote, $status, $categories, $date = NULL, $fromApi = false) { if (!is_numeric($bId)) return false; @@ -183,7 +181,7 @@ class BookmarkService { $moddatetime = gmdate('Y-m-d H:i:s', time()); // Set up the SQL update statement and execute it. - $updates = array('bModified' => $moddatetime, 'bTitle' => $title, 'bAddress' => $address, 'bDescription' => $description, 'bStatus' => $status, 'bHash' => md5($address)); + $updates = array('bModified' => $moddatetime, 'bTitle' => $title, 'bAddress' => $address, 'bDescription' => $description, 'bPrivateNote' => $privateNote, 'bStatus' => $status, 'bHash' => md5($address)); if (!is_null($date)) { $datetime = gmdate('Y-m-d H:i:s', strtotime($date)); diff --git a/tables.sql b/tables.sql index 9e5f5c4..f8a5f11 100644 --- a/tables.sql +++ b/tables.sql @@ -15,6 +15,7 @@ CREATE TABLE `sc_bookmarks` ( `bTitle` varchar(255) NOT NULL default '', `bAddress` text NOT NULL, `bDescription` varchar(1500) default NULL, + `bPrivateNote` varchar(1500) default NULL, `bHash` varchar(32) NOT NULL default '', PRIMARY KEY (`bId`), KEY `sc_bookmarks_usd` (`uId`,`bStatus`,`bDatetime`), diff --git a/templates/editbookmark.tpl.php b/templates/editbookmark.tpl.php index ab0e861..b3514f3 100644 --- a/templates/editbookmark.tpl.php +++ b/templates/editbookmark.tpl.php @@ -40,7 +40,10 @@ $this->includeTemplate("dojo.inc"); ← - + + + + 0): ?> @@ -56,6 +59,12 @@ $this->includeTemplate("dojo.inc"); +style="display:none"> + + + ← + + diff --git a/upgrade.txt b/upgrade.txt index 093d171..f525a2a 100644 --- a/upgrade.txt +++ b/upgrade.txt @@ -4,7 +4,8 @@ - Backup you database - Make a copy from your SemanticScuttle Web directory - Upgrade your database by following instructions ONE after ONE (order is important) : -* NO CHANGE +* ALTER TABLE `sc_bookmarks` ADD `bPrivateNote` VARCHAR( 1500 ) NOT NULL AFTER `bDescription` ; + - Upgrade your current configuration file (config.inc.php) with respect to config.inc.php.example * Add variable : $descriptionAnchors = array("author", "isbn", "address"=>"[address][street][/street][city][/city][/address]"); #add a possible anchor (structured content) for bookmarks' description field