%name:Persistent Bookmarks-$24% %version:v13.3.0.0% %wikipage:Persistent_Bookmarks% %description:This mod will store the bookmarks in the database making them available on any computer and in any browser.
As storing these bookmarks happens per user this mod will only work for logged in users.
The current way of storing bookmarks in cookies remains untouched and fully functional.

Mod developer is Bart Degryse
Modified for TNG V10 and 10.1 by Ken Roy.

If this is a first time install

  1. Install the Persistent Bookmarks mod

Completely removing the mod

During upgrades you should not delete your Persistent Bookmarks table as that will also delete your data links.

However, should you wish to completely delete this mod and its table, you may use the following steps:
  1. Then click the Uninstall button for this mod
  2. and then click the Delete button.

See the TNG Wiki article Persistent Bookmarks Mod for more information./>% /$24 =====Mod merged with Your Bookmark Links mod=====
/$24 To put an add & your bookmarks visible to registered users link in the upper right. Adapted from Your Bookmark Links Mod by Jeff Robison
/$24 but bookmarks are no longer a popup; instead present full page like the Persistent Bookmarks Mod.
/$24 Lastly, removed 'bookmark' link from 'Find' dropdown.
/$24 As before, bookmark links can be removed by 'Yes/No' option in Admin:Setup:General Settings:Site Definition.
/$24 ---many changes in this merger of mods, most at end of mod.
/$24 'Your Bookmark Link' mod idea added into this mod
/$24=========================================================$$
% ========================================================= == The following changes are for the table maintenance == ========================================================= %target:customconfig.php% %location:% ?> %end:% %insert:before% //Persistent Bookmarks Mod $bookmarks_table = 'tng_bookmarks'; %end:% %target:languages/English/cust_text.php% %location:% ?> %end:% %insert:before% // Persistent Bookmarks default localization for table maintenace $admtext['bookmarks'] = 'Bookmarks'; %end:% %target:languages/English-UTF8/cust_text.php% %location:% ?> %end:% %insert:before% // Persistent Bookmarks default localization for table maintenace $admtext['bookmarks'] = 'Bookmarks'; %end:% %target:admin_backup.php% %location:% $ajaxmsg = $msg = ""; %end:% %insert:before% $tablelist = array_merge($tablelist, (array)$bookmarks_table); %end:% %target:admin_genconfig.php% %location:% : %end:% %insert:after% : %end:% %target:admin_optimize.php% %location:% $tablename = $admtext['alltables']; %end:% %insert:before% $tablelist = array_merge($tablelist, (array)$bookmarks_table); %end:% %target:admin_restore.php% %location:% $tablename = $admtext['alltables']; %end:% %insert:before% $tablelist = array_merge($tablelist, (array)$bookmarks_table); %end:% %target:admin_utilities.php% %location:% doRow( $users_table, $admtext['users'] ); %end:% %insert:after% doRow( $bookmarks_table, $admtext['bookmarks'] ); %end:% %newfile:admin_maketable_permbkmk.php% %fileversion:v11.0.0.0% "; echo "Query was $query
"; $badtables .= $badtables ? ",$table" : $table; echo "Bad table = $badtables and Table is $table
"; } return $result; } //switch ($tabletype) { // case 'bookmarks': echo "Persistent Bookmarks table is $bookmarks_table
"; echo "Attempting to create the Persistent Bookmarks table as $bookmarks_table
"; $query = "CREATE TABLE IF NOT EXISTS $newtable ( id int(11) NOT NULL AUTO_INCREMENT, username varchar(100) NOT NULL, bookmark tinytext NOT NULL, bookmark_hash varchar(40) NOT NULL, PRIMARY KEY (id), UNIQUE KEY tng_bookmarks_unq1 (username,bookmark_hash) )"; //Create table if necessary $result = performQuery($query, $bookmarks_table); echo "Persistent Bookmarks table created
"; //Return successful echo $admtext['success']; exit; //} ?> %fileend:% %newfile:admin_removetable_permbkmk.php% %fileversion:v11.0.0.0% %fileend:% ======================================================== == The following changes are the default localization == ======================================================== %target:languages/English/cust_text.php% %location:% ?> %end:% %insert:before% // Persistent Bookmarks default localization $text['permbkmk'] = 'Note: These bookmarks are visible on any computer and in any browser, but only if you log in.'; %end:% %target:languages/English-UTF8/cust_text.php% %location:% ?> %end:% %insert:before% // Persistent Bookmarks mod text $text['permbkmk'] = 'Note: These bookmarks are visible on any computer and in any browser, but only if you log in.'; %end:% ================================================== == The following changes are the business logic == ================================================== %target:ajx_addbookmark.php% %location:% $bookmarks_url = getURL("bookmarks", 0); %end:% %insert:after% while ($currentuser) { //User is logged in so we can store the bookmark in the database $bookmark = str_replace("'", "''", $_SESSION['tnglastpage']); $query = "INSERT IGNORE INTO $bookmarks_table (username, bookmark, bookmark_hash) VALUES ('$currentuser', '$bookmark', SHA1(bookmark))"; tng_query($query) or die ($text['cannotexecutequery'] . ": $query - " . tng_error()); break; } %end:% %target:ajx_delete.php% %location:% $logmsg = $admtext['deleted'] . ": {$admtext['user']} {$urow['username']}"; %end:% %trimreplace:% $query = "DELETE FROM $bookmarks_table WHERE username = '{$urow['username']}'"; tng_query($query); $logmsg = $admtext['deleted'] . ": {$admtext['user']} {$urow['username']}"; %end:% %target:ajx_deletebookmark.php% %location:% include($cms['tngpath'] . "checklogin.php"); %end:% %insert:after% if ($currentuser && isset($iddb)) { //User is logged in and iddb is set so we have to remove a bookmark from the database $query = "DELETE FROM $bookmarks_table WHERE id = $iddb"; tng_query($query); } else { %end:% %location:% //setcookie($ref, "", time()+31536000, "/"); %end:% %replace:% //setcookie($ref, "", time()+31536000, "/"); } %end:% %target:bookmarks.php% %parameter:$pbm_literal:false% %desc:
If you set this parameter to true the value of the next parameter will be used on the bookmarks page.
If you set it to false the value of $text['permbkmk'] will be used. This way you can have a language dependent string. Of course you will have to define $text['permbkmk'] in the cust_text.php of each of your installed languages. If you don't the next parameter's value will be used instead.
Defaults to (true)
% %parameter:$pbm_bkmkvis:Note: These bookmarks are visible on any computer and in any browser, but only if you log in.% %desc:
The text right above the list of permanent bookmarks.
Defaults to (Note: These bookmarks are visible on any computer and in any browser, but only if you log in.)
% %location:% echo "

" . $text['bkmkvis'] . "

"; %end:% %insert:before% $pbm_bkmkvis = 'Note: These bookmarks are visible on any computer and in any browser, but only if you log in.'; $pbm_literal = false; $pbm_label = ($pbm_literal || !isset($text['permbkmk'])) ? $pbm_bkmkvis : $text['permbkmk']; while ($currentuser) { //User is logged in so we can retrieve the bookmark from the database $query = "SELECT id, bookmark FROM $bookmarks_table WHERE username = '$currentuser' ORDER BY id DESC"; $result = tng_query($query); echo "

" . $pbm_label . '

'; echo "
\n"; break; } %end:% /$$ ========================================================= /$$ All Mod changes from here to end of this file /$$ To put an add & your bookmarks visible to registered users link in the upper right. Adapted from Your Bookmark Links Mod by Jeff Robison /$$ but bookmarks are no longer a popup; instead present full page like the Persistent Bookmarks Mod. /$$ Lastly, removed 'bookmark' link from 'Find' dropdown. /$$ As before, bookmark links can be removed by 'Yes/No' option in Admin:Setup:General Settings:Site Definition. /$$ ========================================================= /$24 ---many changes in this merger of mods, most at end of mod. The following copied for use by _toprow.php %target:files% %copyfile:_private_mods/_ajx_addbookmark.php% %target:languages/English/cust_text.php% %location:% ?> %end:% %insert:before% //Adapted from Your Bookmarks Link Mod /*$24*/ $text['allbookmarks'] = "Your Bookmarks"; /*$24*/ $text['bookmark'] = "Add Bookmark"; %end:% %target:languages/English-UTF8/cust_text.php% %location:% ?> %end:% %insert:before% //Adapted from Your Bookmarks Link Mod /*$24*/ $text['allbookmarks'] = "Your Bookmarks"; /*$24*/ $text['bookmark'] = "Add Bookmark"; %end:% /$$ added $sitever !="standard" %target:genlib.php% %location:% return $left_icons; %end:% %insert:before% /*$24 block added */ /*$24*/ if ($sitever != "standard" && $sitever != "tablet") { /*$24*/ global $text, $tngconfig, $cms, $gotlastpage, $sitever; /*$24*/ $addbookmark_url = getURL( "ajx_addbookmark", 1 ); /*$24*/ } %end:% %location:% global $text, $tngconfig, $cms, $gotlastpage, $sitever, $isConnected; $addbookmark_url = getURL( "ajx_addbookmark", 1 ); %end:% %insert:after% /*$24*/ $bookmarks_url = getURL( "bookmarks", 1 ); /*$24*/ global $currentuser; %end:% %location:% if( empty($tngconfig['showbmarks']) && $gotlastpage ) { $right_icons .= tng_smallIcon(array('label'=>$text['bookmark'], 'id'=>"bmk", 'onclick'=>"tnglitbox = new LITBox('{$addbookmark_url}p=" . urlencode($cms['tngpath']) . "',{width:350,height:100}); return false;")); $tngconfig['menucount']++; %end:% %replace:% /*$24*/ if( empty($tngconfig['showbmarks']) && $currentuser ) { /*$24*/ $right_icons .= tng_smallIcon(array('url'=> $bookmarks_url, 'label'=>$text['kzk-bkmks'], 'id'=>"home")); /*$24*/ $tngconfig['menucount']++; } /*$24*/ if( empty($tngconfig['showbmarks']) && $gotlastpage && $currentuser ) { /*$24*/ $right_icons .= tng_smallIcon(array('label'=>$text['bookmark'], 'id'=>"bmk", 'onclick'=>"tnglitbox = new LITBox('{$addbookmark_url}p=" . urlencode($cms['tngpath']) . "',{width:350,height:100}); return false;")); /*$24*/ $tngconfig['menucount']++; %end:% %location:% $menu[] = tngddrow(getURL( "bookmarks", 0 ), "bookmarks-icon", "", "bookmarks"); %end:% %replace:% /*$24 remove add bookmark from right side */ /*$24 $menu[] = tngddrow(getURL( "bookmarks", 0 ), "bookmarks-icon", "", "bookmarks"); */ %end:%