Revert "Further updates for configurable-privacy2."

This reverts commit ef88147d45.
This commit is contained in:
U-SYBASE\bdee 2011-03-31 13:25:37 -07:00
parent ef88147d45
commit 8cbfef8115
3 changed files with 1961 additions and 2029 deletions

View file

@ -1,138 +1,145 @@
<?php <?php
/** /**
* Configuration for SemanticScuttle. * Configuration for SemanticScuttle.
* *
* Copy this file to config.inc.php and adjust it. * Copy this file to config.inc.php and adjust it.
* *
* See config.default.inc.php for more options. * See config.default.inc.php for more options.
*/ */
/** /**
* The name of this site. * Array for defaults.
* *
* @var string * @var array
*/ */
$sitename = 'SemanticScuttle'; $defaults = array();
/** /**
* The welcome message on the homepage. * The name of this site.
* *
* @var string * @var string
*/ */
$welcomeMessage = 'Welcome to SemanticScuttle! Social bookmarking for small communities.'; $sitename = 'SemanticScuttle';
/** /**
* Translation from locales/ folder. * The welcome message on the homepage.
* *
* Examples: de_DE, en_GB, fr_FR * @var string
* */
* @var string $welcomeMessage = 'Welcome to SemanticScuttle! Social bookmarking for small communities.';
*/
$locale = 'en_GB'; /**
* Translation from locales/ folder.
/** *
* Use clean urls without .php filenames. * Examples: de_DE, en_GB, fr_FR
* Requires mod_rewrite (for Apache) to be active. *
* * @var string
* @var boolean */
*/ $locale = 'en_GB';
$cleanurls = false;
/**
/** * Use clean urls without .php filenames.
* Show debug messages. * Requires mod_rewrite (for Apache) to be active.
* This setting is recommended when setting up SemanticScuttle, *
* and when hacking on it. * @var boolean
* */
* @var boolean $cleanurls = false;
*/
$debugMode = true; /**
* Show debug messages.
* This setting is recommended when setting up SemanticScuttle,
/*************************************************** * and when hacking on it.
* Database configuration *
*/ * @var boolean
*/
/** $debugMode = true;
* Database driver
*
* available: /***************************************************
* mysql4, mysqli, mysql, oracle, postgres, sqlite, db2, firebird, * Database configuration
* mssql, mssq-odbc */
*
* @var string /**
*/ * Database driver
$dbtype = 'mysql4'; *
/** * available:
* Database username * mysql4, mysqli, mysql, oracle, postgres, sqlite, db2, firebird,
* * mssql, mssq-odbc
* @var string *
*/ * @var string
$dbuser = 'username'; */
$dbtype = 'mysql4';
/** /**
* Database password * Database username
* *
* @var string * @var string
*/ */
$dbpass = 'password'; $dbuser = 'username';
/** /**
* Name of database * Database password
* *
* @var string * @var string
*/ */
$dbname = 'scuttle'; $dbpass = 'password';
/** /**
* Database hostname/IP * Name of database
* *
* @var string * @var string
*/ */
$dbhost = '127.0.0.1'; $dbname = 'scuttle';
/**
/*************************************************** * Database hostname/IP
* Users *
*/ * @var string
*/
/** $dbhost = '127.0.0.1';
* Contact address for the site administrator.
* Used as the FROM address in password retrieval e-mails.
* /***************************************************
* @var string * Users
*/ */
$adminemail = 'admin@example.org';
/**
/** * Contact address for the site administrator.
* Array of user names who have admin rights * Used as the FROM address in password retrieval e-mails.
* *
* Example: * @var string
* <code> */
* $admin_users = array('adminnickname', 'user1nick', 'user2nick'); $adminemail = 'admin@example.org';
* </code>
* /**
* @var array * Array of user names who have admin rights
*/ *
$admin_users = array(); * Example:
* <code>
* $admin_users = array('adminnickname', 'user1nick', 'user2nick');
/*************************************************** * </code>
* Bookmarks *
*/ * @var array
*/
/** $admin_users = array();
* Default privacy setting for bookmarks.
* 0 - Public
* 1 - Shared with Watchlist /***************************************************
* 2 - Private * Bookmarks
* */
* @var integer
*/ /**
$defaults['privacy'] = 0; * Default privacy setting for bookmarks.
* 0 - Public
* 1 - Shared with Watchlist
/** * 2 - Private
* You have completed the basic configuration! *
* More options can be found in config.default.php. * @var integer
*/ */
?> $defaults['privacy'] = 0;
/**
* You have completed the basic configuration!
* More options can be found in config.default.php.
*/
?>

View file

@ -1,439 +1,439 @@
<?php <?php
/** /**
* Show a list of bookmarks. * Show a list of bookmarks.
* *
* SemanticScuttle - your social bookmark manager. * SemanticScuttle - your social bookmark manager.
* *
* PHP version 5. * PHP version 5.
* *
* @category Bookmarking * @category Bookmarking
* @package SemanticScuttle * @package SemanticScuttle
* @subcategory Templates * @subcategory Templates
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net> * @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
* @author Christian Weiske <cweiske@cweiske.de> * @author Christian Weiske <cweiske@cweiske.de>
* @author Eric Dane <ericdane@users.sourceforge.net> * @author Eric Dane <ericdane@users.sourceforge.net>
* @license GPL http://www.gnu.org/licenses/gpl.html * @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle * @link http://sourceforge.net/projects/semanticscuttle
*/ */
/* Service creation: only useful services are created */ /* Service creation: only useful services are created */
$bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark'); $bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark');
$tagservice = SemanticScuttle_Service_Factory::get('Tag'); $tagservice = SemanticScuttle_Service_Factory::get('Tag');
$cdservice = SemanticScuttle_Service_Factory::get('CommonDescription'); $cdservice = SemanticScuttle_Service_Factory::get('CommonDescription');
$pageName = isset($pageName) ? $pageName : ''; $pageName = isset($pageName) ? $pageName : '';
$user = isset($user) ? $user : ''; $user = isset($user) ? $user : '';
$currenttag = isset($currenttag) ? $currenttag : ''; $currenttag = isset($currenttag) ? $currenttag : '';
$this->includeTemplate($GLOBALS['top_include']); $this->includeTemplate($GLOBALS['top_include']);
include('search.menu.php'); include('search.menu.php');
?> ?>
<?php if($pageName == PAGE_INDEX && $GLOBALS['welcomeMessage']):?> <?php if($pageName == PAGE_INDEX && $GLOBALS['welcomeMessage']):?>
<p id="welcome"><?php echo $GLOBALS['welcomeMessage'];?></p> <p id="welcome"><?php echo $GLOBALS['welcomeMessage'];?></p>
<?php endif?> <?php endif?>
<?php if($GLOBALS['enableAdminColors']!=false && isset($userid) && $userservice->isAdmin($userid) && $pageName != PAGE_WATCHLIST) : ?> <?php if($GLOBALS['enableAdminColors']!=false && isset($userid) && $userservice->isAdmin($userid) && $pageName != PAGE_WATCHLIST) : ?>
<div style="width:70%;text-align:center;"> <div style="width:70%;text-align:center;">
<img src="<?php echo ROOT ?>images/logo_24.gif" width="12px"/> <?php echo T_('Bookmarks on this page are managed by an admin user.'); ?><img src="<?php echo ROOT ?>images/logo_24.gif" width="12px"/> <img src="<?php echo ROOT ?>images/logo_24.gif" width="12px"/> <?php echo T_('Bookmarks on this page are managed by an admin user.'); ?><img src="<?php echo ROOT ?>images/logo_24.gif" width="12px"/>
</div> </div>
<?php endif?> <?php endif?>
<?php <?php
// common tag description // common tag description
if(($currenttag!= '' && $GLOBALS['enableCommonTagDescription']) if(($currenttag!= '' && $GLOBALS['enableCommonTagDescription'])
|| (isset($hash) && $GLOBALS['enableCommonBookmarkDescription'])):?> || (isset($hash) && $GLOBALS['enableCommonBookmarkDescription'])):?>
<p class="commondescription"><?php <p class="commondescription"><?php
$cDescription = ''; $cDescription = '';
if($currenttag!= '' && $cdservice->getLastTagDescription($currenttag)) { if($currenttag!= '' && $cdservice->getLastTagDescription($currenttag)) {
$cDescription = $cdservice->getLastTagDescription($currenttag); $cDescription = $cdservice->getLastTagDescription($currenttag);
echo nl2br(filter($cDescription['cdDescription'])); echo nl2br(filter($cDescription['cdDescription']));
} elseif(isset($hash) && $cdservice->getLastBookmarkDescription($hash)) { } elseif(isset($hash) && $cdservice->getLastBookmarkDescription($hash)) {
$cDescription = $cdservice->getLastBookmarkDescription($hash); $cDescription = $cdservice->getLastBookmarkDescription($hash);
echo nl2br(filter($cDescription['cdTitle'])). "<br/>"; echo nl2br(filter($cDescription['cdTitle'])). "<br/>";
echo nl2br(filter($cDescription['cdDescription'])). "<br/>"; echo nl2br(filter($cDescription['cdDescription'])). "<br/>";
} }
//common tag description edit //common tag description edit
if($userservice->isLoggedOn()) { if($userservice->isLoggedOn()) {
if($currenttag!= '' && ($GLOBALS['enableCommonTagDescriptionEditedByAll'] || $currentUser->isAdmin())) { if($currenttag!= '' && ($GLOBALS['enableCommonTagDescriptionEditedByAll'] || $currentUser->isAdmin())) {
echo ' <a href="'. createURL('tagcommondescriptionedit', $currenttag).'" title="'.T_('Edit the common description of this tag').'">'; echo ' <a href="'. createURL('tagcommondescriptionedit', $currenttag).'" title="'.T_('Edit the common description of this tag').'">';
echo !is_array($cDescription) || strlen($cDescription['cdDescription'])==0?T_('Edit the common description of this tag'):''; echo !is_array($cDescription) || strlen($cDescription['cdDescription'])==0?T_('Edit the common description of this tag'):'';
echo ' <img src="'.ROOT.'images/b_edit.png" /></a>'; echo ' <img src="'.ROOT.'images/b_edit.png" /></a>';
} elseif(isset($hash)) { } elseif(isset($hash)) {
echo ' (<a href="'.createURL('bookmarkcommondescriptionedit', $hash).'" title="'.T_('Edit the common description of this bookmark').'">'; echo ' (<a href="'.createURL('bookmarkcommondescriptionedit', $hash).'" title="'.T_('Edit the common description of this bookmark').'">';
echo T_('Edit the common description of this bookmark').'</a>)'; echo T_('Edit the common description of this bookmark').'</a>)';
} }
} }
?></p> ?></p>
<?php endif ?> <?php endif ?>
<?php <?php
/* personal tag description */ /* personal tag description */
if($currenttag!= '' && $user!='') { if($currenttag!= '' && $user!='') {
$userObject = $userservice->getUserByUsername($user); $userObject = $userservice->getUserByUsername($user);
if($tagservice->getDescription($currenttag, $userObject['uId'])) { ?> if($tagservice->getDescription($currenttag, $userObject['uId'])) { ?>
<p class="commondescription"><?php <p class="commondescription"><?php
$pDescription = $tagservice->getDescription($currenttag, $userObject['uId']); $pDescription = $tagservice->getDescription($currenttag, $userObject['uId']);
echo nl2br(filter($pDescription['tDescription'])); echo nl2br(filter($pDescription['tDescription']));
//personal tag description edit //personal tag description edit
if($userservice->isLoggedOn()) { if($userservice->isLoggedOn()) {
if($currenttag!= '') { if($currenttag!= '') {
echo ' <a href="'. createURL('tagedit', $currenttag).'" title="'.T_('Edit your personal description of this tag').'" >'; echo ' <a href="'. createURL('tagedit', $currenttag).'" title="'.T_('Edit your personal description of this tag').'" >';
echo strlen($pDescription['tDescription'])==0?T_('Edit your personal description of this tag'):''; echo strlen($pDescription['tDescription'])==0?T_('Edit your personal description of this tag'):'';
echo ' <img src="'.ROOT.'images/b_edit.png" /></a>'; echo ' <img src="'.ROOT.'images/b_edit.png" /></a>';
} }
} }
?></p> ?></p>
<?php <?php
} }
} }
?> ?>
<?php if (count($bookmarks) > 0) { ?> <?php if (count($bookmarks) > 0) { ?>
<script type="text/javascript"> <script type="text/javascript">
window.onload = playerLoad; window.onload = playerLoad;
</script> </script>
<p id="sort"><?php echo $total.' '.T_("bookmark(s)"); ?> - <?php echo T_("Sort by:"); ?> <p id="sort"><?php echo $total.' '.T_("bookmark(s)"); ?> - <?php echo T_("Sort by:"); ?>
<?php <?php
$titleArrow = ''; $titleArrow = '';
$dateArrow = ''; $dateArrow = '';
$votingArrow = ''; $votingArrow = '';
$dateSort = 'date_desc'; $dateSort = 'date_desc';
$titleSort = 'title_asc'; $titleSort = 'title_asc';
$votingSort = 'voting_desc'; $votingSort = 'voting_desc';
switch(getSortOrder()) { switch(getSortOrder()) {
case 'date_asc': case 'date_asc':
$dateArrow = ' &uarr;'; $dateArrow = ' &uarr;';
$dateSort = 'date_desc'; $dateSort = 'date_desc';
break; break;
case 'title_asc': case 'title_asc':
$titleArrow = ' &uarr;'; $titleArrow = ' &uarr;';
$titleSort = 'title_desc'; $titleSort = 'title_desc';
break; break;
case 'title_desc': case 'title_desc':
$titleArrow = ' &darr;'; $titleArrow = ' &darr;';
$titleSort = 'title_asc'; $titleSort = 'title_asc';
break; break;
case 'voting_asc': case 'voting_asc':
$votingArrow = ' &uarr;'; $votingArrow = ' &uarr;';
$votingSort = 'voting_desc'; $votingSort = 'voting_desc';
break; break;
case 'voting_desc': case 'voting_desc':
$votingArrow = ' &darr;'; $votingArrow = ' &darr;';
$votingSort = 'voting_asc'; $votingSort = 'voting_asc';
break; break;
case 'date_desc': case 'date_desc':
default: default:
$dateArrow = ' &darr;'; $dateArrow = ' &darr;';
$dateSort = 'date_asc'; $dateSort = 'date_asc';
break; break;
} }
?> ?>
<a href="?sort=<?php echo $dateSort ?>"><?php echo T_("Date").$dateArrow; ?></a> <a href="?sort=<?php echo $dateSort ?>"><?php echo T_("Date").$dateArrow; ?></a>
<span>/</span> <span>/</span>
<a href="?sort=<?php echo $titleSort ?>"><?php echo T_("Title").$titleArrow; ?></a> <a href="?sort=<?php echo $titleSort ?>"><?php echo T_("Title").$titleArrow; ?></a>
<span>/</span> <span>/</span>
<?php if ($GLOBALS['enableVoting']) { ?> <?php if ($GLOBALS['enableVoting']) { ?>
<a href="?sort=<?php echo $votingSort ?>"><?php echo T_("Voting").$votingArrow; ?></a> <a href="?sort=<?php echo $votingSort ?>"><?php echo T_("Voting").$votingArrow; ?></a>
<span>/</span> <span>/</span>
<?php } ?> <?php } ?>
<?php <?php
if ($currenttag!= '') { if ($currenttag!= '') {
if ($user!= '') { if ($user!= '') {
echo ' - '; echo ' - ';
echo '<a href="'. createURL('tags', $currenttag) .'">'; echo '<a href="'. createURL('tags', $currenttag) .'">';
echo T_('Bookmarks from other users for this tag').'</a>'; echo T_('Bookmarks from other users for this tag').'</a>';
//echo T_(' for these tags'); //echo T_(' for these tags');
} else if ($userservice->isLoggedOn()){ } else if ($userservice->isLoggedOn()){
echo ' - '; echo ' - ';
echo '<a href="'. createURL('bookmarks', $currentUser->getUsername().'/'.$currenttag) .'">'; echo '<a href="'. createURL('bookmarks', $currentUser->getUsername().'/'.$currenttag) .'">';
echo T_('Only your bookmarks for this tag').'</a>'; echo T_('Only your bookmarks for this tag').'</a>';
//echo T_(' for these tags'); //echo T_(' for these tags');
} }
} }
?></p> ?></p>
<?php <?php
// PAGINATION // PAGINATION
// Ordering // Ordering
$sortOrder = ''; $sortOrder = '';
if (GET_SORT != '') { if (GET_SORT != '') {
$sortOrder = 'sort=' . getSortOrder(); $sortOrder = 'sort=' . getSortOrder();
} }
$sortAmp = (($sortOrder) ? '&amp;'. $sortOrder : ''); $sortAmp = (($sortOrder) ? '&amp;'. $sortOrder : '');
$sortQue = (($sortOrder) ? '?'. $sortOrder : ''); $sortQue = (($sortOrder) ? '?'. $sortOrder : '');
// Previous // Previous
$perpage = getPerPageCount($currentUser); $perpage = getPerPageCount($currentUser);
if (!$page || $page < 2) { if (!$page || $page < 2) {
$page = 1; $page = 1;
$start = 0; $start = 0;
$bfirst = '<span class="disable">'. T_('First') .'</span>'; $bfirst = '<span class="disable">'. T_('First') .'</span>';
$bprev = '<span class="disable">'. T_('Previous') .'</span>'; $bprev = '<span class="disable">'. T_('Previous') .'</span>';
} else { } else {
$prev = $page - 1; $prev = $page - 1;
$prev = 'page='. $prev; $prev = 'page='. $prev;
$start = ($page - 1) * $perpage; $start = ($page - 1) * $perpage;
$bfirst= '<a href="'. sprintf($nav_url, $user, $currenttag, '') . $sortQue .'">'. T_('First') .'</a>'; $bfirst= '<a href="'. sprintf($nav_url, $user, $currenttag, '') . $sortQue .'">'. T_('First') .'</a>';
$bprev = '<a href="'. sprintf($nav_url, $user, $currenttag, '?') . $prev . $sortAmp .'">'. T_('Previous') .'</a>'; $bprev = '<a href="'. sprintf($nav_url, $user, $currenttag, '?') . $prev . $sortAmp .'">'. T_('Previous') .'</a>';
} }
// Next // Next
$next = $page + 1; $next = $page + 1;
$totalpages = ceil($total / $perpage); $totalpages = ceil($total / $perpage);
if (count($bookmarks) < $perpage || $perpage * $page == $total) { if (count($bookmarks) < $perpage || $perpage * $page == $total) {
$bnext = '<span class="disable">'. T_('Next') .'</span>'; $bnext = '<span class="disable">'. T_('Next') .'</span>';
$blast = '<span class="disable">'. T_('Last') ."</span>\n"; $blast = '<span class="disable">'. T_('Last') ."</span>\n";
} else { } else {
$bnext = '<a href="'. sprintf($nav_url, $user, $currenttag, '?page=') . $next . $sortAmp .'">'. T_('Next') .'</a>'; $bnext = '<a href="'. sprintf($nav_url, $user, $currenttag, '?page=') . $next . $sortAmp .'">'. T_('Next') .'</a>';
$blast = '<a href="'. sprintf($nav_url, $user, $currenttag, '?page=') . $totalpages . $sortAmp .'">'. T_('Last') ."</a>\n"; $blast = '<a href="'. sprintf($nav_url, $user, $currenttag, '?page=') . $totalpages . $sortAmp .'">'. T_('Last') ."</a>\n";
} }
// RSS // RSS
$brss = ''; $brss = '';
$size = count($rsschannels); $size = count($rsschannels);
for ($i = 0; $i < $size; $i++) { for ($i = 0; $i < $size; $i++) {
$brss = '<a style="background:#FFFFFF" href="'. htmlspecialchars($rsschannels[$i][1]) . '"' $brss = '<a style="background:#FFFFFF" href="'. htmlspecialchars($rsschannels[$i][1]) . '"'
. ' title="' . htmlspecialchars($rsschannels[$i][0]) . '">' . ' title="' . htmlspecialchars($rsschannels[$i][0]) . '">'
. '<img src="' . ROOT . 'images/rss.gif" width="16" height="16" alt="' . htmlspecialchars($rsschannels[$i][0]) .'"/>' . '<img src="' . ROOT . 'images/rss.gif" width="16" height="16" alt="' . htmlspecialchars($rsschannels[$i][0]) .'"/>'
. '</a>'; . '</a>';
} }
$pagesBanner = '<p class="paging">'. $bfirst .'<span> / </span>'. $bprev .'<span> / </span>'. $bnext .'<span> / </span>'. $blast .'<span> / </span>'. sprintf(T_('Page %d of %d'), $page, $totalpages) ." ". $brss ." </p>\n"; $pagesBanner = '<p class="paging">'. $bfirst .'<span> / </span>'. $bprev .'<span> / </span>'. $bnext .'<span> / </span>'. $blast .'<span> / </span>'. sprintf(T_('Page %d of %d'), $page, $totalpages) ." ". $brss ." </p>\n";
if (getPerPageCount($currentUser) > 10) { if (getPerPageCount($currentUser) > 10) {
echo $pagesBanner; // display a page banner if too many bookmarks to manage echo $pagesBanner; // display a page banner if too many bookmarks to manage
} }
?> ?>
<ol<?php echo ($start > 0 ? ' start="'. ++$start .'"' : ''); ?> id="bookmarks"> <ol<?php echo ($start > 0 ? ' start="'. ++$start .'"' : ''); ?> id="bookmarks">
<?php <?php
$addresses = array(); $addresses = array();
foreach ($bookmarks as $key => &$row) { foreach ($bookmarks as $key => &$row) {
$addresses[$row['bId']] = $row['bAddress']; $addresses[$row['bId']] = $row['bAddress'];
} }
$otherCounts = $bookmarkservice->countOthers($addresses); $otherCounts = $bookmarkservice->countOthers($addresses);
if ($userservice->isLoggedOn()) { if ($userservice->isLoggedOn()) {
$existence = $bookmarkservice->bookmarksExist( $existence = $bookmarkservice->bookmarksExist(
$addresses, $currentUser->getId() $addresses, $currentUser->getId()
); );
} }
if ($userservice->isLoggedOn()) { if ($userservice->isLoggedOn()) {
$watchedNames = $userservice->getWatchNames( $watchedNames = $userservice->getWatchNames(
$currentUser->getId(), true $currentUser->getId(), true
); );
} else { } else {
$watchedNames = null; $watchedNames = null;
} }
foreach ($bookmarks as $key => &$row) { foreach ($bookmarks as $key => &$row) {
switch ($row['bStatus']) { switch ($row['bStatus']) {
case 0: case 0:
$access = ''; $access = ' public';
break; break;
case 1: case 1:
$access = ' shared'; $access = ' shared';
break; break;
case 2: case 2:
$access = ' private'; $access = ' private';
break; break;
} }
$cats = ''; $cats = '';
$tagsForCopy = ''; $tagsForCopy = '';
$tags = $row['tags']; $tags = $row['tags'];
foreach ($tags as $tkey => &$tag) { foreach ($tags as $tkey => &$tag) {
$tagcaturl = sprintf( $tagcaturl = sprintf(
$cat_url, $cat_url,
filter($row['username'], 'url'), filter($row['username'], 'url'),
filter($tag, 'url') filter($tag, 'url')
); );
$cats .= sprintf( $cats .= sprintf(
'<a href="%s" rel="tag">%s</a>, ', '<a href="%s" rel="tag">%s</a>, ',
$tagcaturl, filter($tag) $tagcaturl, filter($tag)
); );
$tagsForCopy .= $tag . ','; $tagsForCopy .= $tag . ',';
} }
$cats = substr($cats, 0, -2); $cats = substr($cats, 0, -2);
if ($cats != '') { if ($cats != '') {
$cats = T_('Tags:') . ' ' . $cats; $cats = T_('Tags:') . ' ' . $cats;
} }
// Edit and delete links // Edit and delete links
$edit = ''; $edit = '';
if ($bookmarkservice->editAllowed($row)) { if ($bookmarkservice->editAllowed($row)) {
$edit = ' - <a href="' . createURL('edit', $row['bId']) . '">' $edit = ' - <a href="' . createURL('edit', $row['bId']) . '">'
. T_('Edit') . T_('Edit')
. '</a>' . '</a>'
. '<script type="text/javascript">' . '<script type="text/javascript">'
. 'document.write(" - <a href=\"#\" onclick=\"deleteBookmark(this, '. $row['bId'] .'); return false;\">' . 'document.write(" - <a href=\"#\" onclick=\"deleteBookmark(this, '. $row['bId'] .'); return false;\">'
. T_('Delete') . T_('Delete')
.'<\/a>");</script>'; .'<\/a>");</script>';
} }
// Last update // Last update
$update = ' <small title="'. T_('Last update') .'">('. date($GLOBALS['shortdate'], strtotime($row['bModified'])). ') </small>'; $update = ' <small title="'. T_('Last update') .'">('. date($GLOBALS['shortdate'], strtotime($row['bModified'])). ') </small>';
// User attribution // User attribution
$copy = ' ' . T_('by') . ' '; $copy = ' ' . T_('by') . ' ';
if ($userservice->isLoggedOn() if ($userservice->isLoggedOn()
&& $currentUser->getUsername() == $row['username'] && $currentUser->getUsername() == $row['username']
) { ) {
$copy .= T_('you'); $copy .= T_('you');
} else { } else {
$copy .= '<a href="' . createURL('bookmarks', $row['username']) . '">' $copy .= '<a href="' . createURL('bookmarks', $row['username']) . '">'
. $row['username'] . '</a>'; . $row['username'] . '</a>';
} }
// Udders! // Udders!
if (!isset($hash)) { if (!isset($hash)) {
$others = $otherCounts[$row['bAddress']]; $others = $otherCounts[$row['bAddress']];
$ostart = '<a href="' . createURL('history', $row['bHash']) . '">'; $ostart = '<a href="' . createURL('history', $row['bHash']) . '">';
$oend = '</a>'; $oend = '</a>';
switch ($others) { switch ($others) {
case 0: case 0:
break; break;
case 1: case 1:
$copy .= sprintf(T_(' and %s1 other%s'), $ostart, $oend); $copy .= sprintf(T_(' and %s1 other%s'), $ostart, $oend);
break; break;
default: default:
$copy .= sprintf(T_(' and %2$s%1$s others%3$s'), $others, $ostart, $oend); $copy .= sprintf(T_(' and %2$s%1$s others%3$s'), $others, $ostart, $oend);
} }
} }
// Copy link // Copy link
if ($userservice->isLoggedOn() if ($userservice->isLoggedOn()
&& ($currentUser->getId() != $row['uId']) && ($currentUser->getId() != $row['uId'])
&& !$existence[$row['bAddress']] && !$existence[$row['bAddress']]
) { ) {
$copy .= ' - <a href="' $copy .= ' - <a href="'
. createURL( . createURL(
'bookmarks', 'bookmarks',
$currentUser->getUsername() $currentUser->getUsername()
. '?action=add&amp;copyOf=' . $row['bId']) . '?action=add&amp;copyOf=' . $row['bId'])
. '" title="'.T_('Copy this bookmark to YOUR bookmarks.').'">' . '" title="'.T_('Copy this bookmark to YOUR bookmarks.').'">'
. T_('Copy') . T_('Copy')
. '</a>'; . '</a>';
} }
// Nofollow option // Nofollow option
$rel = ''; $rel = '';
if ($GLOBALS['nofollow']) { if ($GLOBALS['nofollow']) {
$rel = ' rel="nofollow"'; $rel = ' rel="nofollow"';
} }
$address = filter($row['bAddress']); $address = filter($row['bAddress']);
$oaddress = $address; $oaddress = $address;
// Redirection option // Redirection option
if ($GLOBALS['useredir']) { if ($GLOBALS['useredir']) {
$address = $GLOBALS['url_redir'] . $address; $address = $GLOBALS['url_redir'] . $address;
} }
// Admin specific design // Admin specific design
if ($userservice->isAdmin($row['username']) && $GLOBALS['enableAdminColors']) { if ($userservice->isAdmin($row['username']) && $GLOBALS['enableAdminColors']) {
$adminBgClass = ' class="adminBackground"'; $adminBgClass = ' class="adminBackground"';
$adminStar = ' <img src="'. ROOT .'images/logo_24.gif" width="12px" title="'. T_('This bookmark is certified by an admin user.') .'" />'; $adminStar = ' <img src="'. ROOT .'images/logo_24.gif" width="12px" title="'. T_('This bookmark is certified by an admin user.') .'" />';
} else { } else {
$adminBgClass = ''; $adminBgClass = '';
$adminStar = ''; $adminStar = '';
} }
// Private Note (just visible by the owner and his/her contacts) // Private Note (just visible by the owner and his/her contacts)
if ($watchedNames !== null if ($watchedNames !== null
&& ($currentUser->getId() == $row['uId'] && ($currentUser->getId() == $row['uId']
|| in_array($row['username'], $watchedNames) || in_array($row['username'], $watchedNames)
) )
) { ) {
$privateNoteField = $row['bPrivateNote']; $privateNoteField = $row['bPrivateNote'];
} else { } else {
$privateNoteField = ''; $privateNoteField = '';
} }
if ($GLOBALS['enableVoting'] && $GLOBALS['hideBelowVoting'] !== null if ($GLOBALS['enableVoting'] && $GLOBALS['hideBelowVoting'] !== null
&& $row['bVoting'] < $GLOBALS['hideBelowVoting'] && $row['bVoting'] < $GLOBALS['hideBelowVoting']
) { ) {
$access .= ' below-threshold'; $access .= ' below-threshold';
} }
// Output // Output
echo ' <li class="xfolkentry'. $access .'">'."\n"; echo ' <li class="xfolkentry'. $access .'">'."\n";
include 'bookmarks-thumbnail.inc.tpl.php'; include 'bookmarks-thumbnail.inc.tpl.php';
include 'bookmarks-vote.inc.tpl.php'; include 'bookmarks-vote.inc.tpl.php';
echo ' <div' . $adminBgClass . '>' . "\n"; echo ' <div' . $adminBgClass . '>' . "\n";
echo ' <div class="link">' echo ' <div class="link">'
. '<a href="'. $address .'"'. $rel .' class="taggedlink" target="_blank">' . '<a href="'. $address .'"'. $rel .' class="taggedlink" target="_blank">'
. filter($row['bTitle']) . filter($row['bTitle'])
. '</a>' . $adminStar . "</div>\n"; . '</a>' . $adminStar . "</div>\n";
if ($row['bDescription'] == '') { if ($row['bDescription'] == '') {
$bkDescription = $GLOBALS['blankDescription']; $bkDescription = $GLOBALS['blankDescription'];
} else { } else {
// Improve description display (anchors, links, ...) // Improve description display (anchors, links, ...)
$bkDescription = preg_replace('|\[\/.*?\]|', '', filter($row['bDescription'])); // remove final anchor $bkDescription = preg_replace('|\[\/.*?\]|', '', filter($row['bDescription'])); // remove final anchor
$bkDescription = preg_replace('|\[(.*?)\]|', ' <span class="anchorBookmark">$1</span> » ', $bkDescription); // highlight starting anchor $bkDescription = preg_replace('|\[(.*?)\]|', ' <span class="anchorBookmark">$1</span> » ', $bkDescription); // highlight starting anchor
$bkDescription = preg_replace('@((http|https|ftp)://.*?)( |\r|$)@', '<a href="$1" rel="nofollow">$1</a>$3', $bkDescription); // make url clickable $bkDescription = preg_replace('@((http|https|ftp)://.*?)( |\r|$)@', '<a href="$1" rel="nofollow">$1</a>$3', $bkDescription); // make url clickable
} }
echo ' <div class="description">'. nl2br($bkDescription) ."</div>\n"; echo ' <div class="description">'. nl2br($bkDescription) ."</div>\n";
echo ' <div class="address">' . shortenString($oaddress) . "</div>\n"; echo ' <div class="address">' . shortenString($oaddress) . "</div>\n";
echo ' <div class="meta">' echo ' <div class="meta">'
. $cats . "\n" . $cats . "\n"
. $copy . "\n" . $copy . "\n"
. $edit . "\n" . $edit . "\n"
. $update . "\n" . $update . "\n"
. " </div>\n"; . " </div>\n";
echo $privateNoteField != '' echo $privateNoteField != ''
? ' <div class="privateNote" title="'. T_('Private Note on this bookmark') .'">'.$privateNoteField."</div>\n" ? ' <div class="privateNote" title="'. T_('Private Note on this bookmark') .'">'.$privateNoteField."</div>\n"
: ''; : '';
echo ' '; echo ' ';
include 'bookmarks-vote-horizontal.inc.tpl.php'; include 'bookmarks-vote-horizontal.inc.tpl.php';
echo " </div>\n"; echo " </div>\n";
echo " </li>\n"; echo " </li>\n";
} }
?> ?>
</ol> </ol>
<?php <?php
if(getPerPageCount($currentUser)>7) { if(getPerPageCount($currentUser)>7) {
echo '<p class="backToTop"><a href="#header" title="'.T_('Come back to the top of this page.').'">'.T_('Top of the page').'</a></p>'; echo '<p class="backToTop"><a href="#header" title="'.T_('Come back to the top of this page.').'">'.T_('Top of the page').'</a></p>';
} }
echo $pagesBanner; // display previous and next links pages + RSS link echo $pagesBanner; // display previous and next links pages + RSS link
} else { } else {
echo '<p class="error">'.T_('No bookmarks available').'</p>'; echo '<p class="error">'.T_('No bookmarks available').'</p>';
} }
$this->includeTemplate('sidebar.tpl'); $this->includeTemplate('sidebar.tpl');
$this->includeTemplate($GLOBALS['bottom_include']); $this->includeTemplate($GLOBALS['bottom_include']);
?> ?>

File diff suppressed because it is too large Load diff