From ef88147d453bce7d5b86ec43daad2f54447513c8 Mon Sep 17 00:00:00 2001 From: bretticvs Date: Wed, 30 Mar 2011 22:30:43 -0700 Subject: Further updates for configurable-privacy2. --- data/config.php.dist | 283 ++++++------- data/templates/bookmarks.tpl.php | 878 +++++++++++++++++++-------------------- 2 files changed, 577 insertions(+), 584 deletions(-) (limited to 'data') diff --git a/data/config.php.dist b/data/config.php.dist index 0f849e2..a8d84a6 100644 --- a/data/config.php.dist +++ b/data/config.php.dist @@ -1,145 +1,138 @@ - - * $admin_users = array('adminnickname', 'user1nick', 'user2nick'); - * - * - * @var array - */ -$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. -*/ -?> + + * $admin_users = array('adminnickname', 'user1nick', 'user2nick'); + * + * + * @var array + */ +$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/data/templates/bookmarks.tpl.php b/data/templates/bookmarks.tpl.php index 44dfe90..b241a71 100644 --- a/data/templates/bookmarks.tpl.php +++ b/data/templates/bookmarks.tpl.php @@ -1,439 +1,439 @@ - - * @author Christian Weiske - * @author Eric Dane - * @license GPL http://www.gnu.org/licenses/gpl.html - * @link http://sourceforge.net/projects/semanticscuttle - */ - -/* Service creation: only useful services are created */ -$bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark'); -$tagservice = SemanticScuttle_Service_Factory::get('Tag'); -$cdservice = SemanticScuttle_Service_Factory::get('CommonDescription'); - - -$pageName = isset($pageName) ? $pageName : ''; -$user = isset($user) ? $user : ''; -$currenttag = isset($currenttag) ? $currenttag : ''; - - -$this->includeTemplate($GLOBALS['top_include']); - -include('search.menu.php'); -?> - - -

- - - -isAdmin($userid) && $pageName != PAGE_WATCHLIST) : ?> -
- -
- - - - - - -

getLastTagDescription($currenttag)) { - $cDescription = $cdservice->getLastTagDescription($currenttag); - echo nl2br(filter($cDescription['cdDescription'])); -} elseif(isset($hash) && $cdservice->getLastBookmarkDescription($hash)) { - $cDescription = $cdservice->getLastBookmarkDescription($hash); - echo nl2br(filter($cDescription['cdTitle'])). "
"; - echo nl2br(filter($cDescription['cdDescription'])). "
"; -} - -//common tag description edit -if($userservice->isLoggedOn()) { - if($currenttag!= '' && ($GLOBALS['enableCommonTagDescriptionEditedByAll'] || $currentUser->isAdmin())) { - echo ' '; - echo !is_array($cDescription) || strlen($cDescription['cdDescription'])==0?T_('Edit the common description of this tag'):''; - echo ' '; - } elseif(isset($hash)) { - echo ' ('; - echo T_('Edit the common description of this bookmark').')'; - } -} -?>

- - - -getUserByUsername($user); - if($tagservice->getDescription($currenttag, $userObject['uId'])) { ?> - -

getDescription($currenttag, $userObject['uId']); -echo nl2br(filter($pDescription['tDescription'])); - -//personal tag description edit -if($userservice->isLoggedOn()) { - if($currenttag!= '') { - echo ' '; - echo strlen($pDescription['tDescription'])==0?T_('Edit your personal description of this tag'):''; - echo ' '; - } -} -?>

- - - - 0) { ?> - - -

- - - - / - - / - - - / - - -'; - echo T_('Bookmarks from other users for this tag').''; - //echo T_(' for these tags'); - } else if ($userservice->isLoggedOn()){ - echo ' - '; - echo ''; - echo T_('Only your bookmarks for this tag').''; - //echo T_(' for these tags'); - } -} -?>

- -'. T_('First') .''; - $bprev = ''. T_('Previous') .''; - } else { - $prev = $page - 1; - $prev = 'page='. $prev; - $start = ($page - 1) * $perpage; - $bfirst= ''. T_('First') .''; - $bprev = ''. T_('Previous') .''; - } - - // Next - $next = $page + 1; - $totalpages = ceil($total / $perpage); - if (count($bookmarks) < $perpage || $perpage * $page == $total) { - $bnext = ''. T_('Next') .''; - $blast = ''. T_('Last') ."\n"; - } else { - $bnext = ''. T_('Next') .''; - $blast = ''. T_('Last') ."\n"; - } - - // RSS - $brss = ''; - $size = count($rsschannels); - for ($i = 0; $i < $size; $i++) { - $brss = '' - . '' . htmlspecialchars($rsschannels[$i][0]) .'' - . ''; - } - - $pagesBanner = '

'. $bfirst .' / '. $bprev .' / '. $bnext .' / '. $blast .' / '. sprintf(T_('Page %d of %d'), $page, $totalpages) ." ". $brss ."

\n"; - - if (getPerPageCount($currentUser) > 10) { - echo $pagesBanner; // display a page banner if too many bookmarks to manage - } - - -?> - - - - 0 ? ' start="'. ++$start .'"' : ''); ?> id="bookmarks"> - &$row) { - $addresses[$row['bId']] = $row['bAddress']; - } - $otherCounts = $bookmarkservice->countOthers($addresses); - if ($userservice->isLoggedOn()) { - $existence = $bookmarkservice->bookmarksExist( - $addresses, $currentUser->getId() - ); - } - - if ($userservice->isLoggedOn()) { - $watchedNames = $userservice->getWatchNames( - $currentUser->getId(), true - ); - } else { - $watchedNames = null; - } - - foreach ($bookmarks as $key => &$row) { - switch ($row['bStatus']) { - case 0: - $access = ' public'; - break; - case 1: - $access = ' shared'; - break; - case 2: - $access = ' private'; - break; - } - - $cats = ''; - $tagsForCopy = ''; - $tags = $row['tags']; - foreach ($tags as $tkey => &$tag) { - $tagcaturl = sprintf( - $cat_url, - filter($row['username'], 'url'), - filter($tag, 'url') - ); - $cats .= sprintf( - ', ', - $tagcaturl, filter($tag) - ); - $tagsForCopy .= $tag . ','; - } - $cats = substr($cats, 0, -2); - if ($cats != '') { - $cats = T_('Tags:') . ' ' . $cats; - } - - // Edit and delete links - $edit = ''; - if ($bookmarkservice->editAllowed($row)) { - $edit = ' - ' - . T_('Edit') - . '' - . ''; - } - - // Last update - $update = ' ('. date($GLOBALS['shortdate'], strtotime($row['bModified'])). ') '; - - // User attribution - $copy = ' ' . T_('by') . ' '; - if ($userservice->isLoggedOn() - && $currentUser->getUsername() == $row['username'] - ) { - $copy .= T_('you'); - } else { - $copy .= '' - . $row['username'] . ''; - } - - // Udders! - if (!isset($hash)) { - $others = $otherCounts[$row['bAddress']]; - $ostart = ''; - $oend = ''; - switch ($others) { - case 0: - break; - case 1: - $copy .= sprintf(T_(' and %s1 other%s'), $ostart, $oend); - break; - default: - $copy .= sprintf(T_(' and %2$s%1$s others%3$s'), $others, $ostart, $oend); - } - } - - // Copy link - if ($userservice->isLoggedOn() - && ($currentUser->getId() != $row['uId']) - && !$existence[$row['bAddress']] - ) { - $copy .= ' - ' - . T_('Copy') - . ''; - } - - // Nofollow option - $rel = ''; - if ($GLOBALS['nofollow']) { - $rel = ' rel="nofollow"'; - } - - $address = filter($row['bAddress']); - $oaddress = $address; - // Redirection option - if ($GLOBALS['useredir']) { - $address = $GLOBALS['url_redir'] . $address; - } - - // Admin specific design - if ($userservice->isAdmin($row['username']) && $GLOBALS['enableAdminColors']) { - $adminBgClass = ' class="adminBackground"'; - $adminStar = ' '; - } else { - $adminBgClass = ''; - $adminStar = ''; - } - - // Private Note (just visible by the owner and his/her contacts) - if ($watchedNames !== null - && ($currentUser->getId() == $row['uId'] - || in_array($row['username'], $watchedNames) - ) - ) { - $privateNoteField = $row['bPrivateNote']; - } else { - $privateNoteField = ''; - } - - if ($GLOBALS['enableVoting'] && $GLOBALS['hideBelowVoting'] !== null - && $row['bVoting'] < $GLOBALS['hideBelowVoting'] - ) { - $access .= ' below-threshold'; - } - - // Output - echo '
  • '."\n"; - include 'bookmarks-thumbnail.inc.tpl.php'; - include 'bookmarks-vote.inc.tpl.php'; - - echo ' ' . "\n"; - - echo ' \n"; - if ($row['bDescription'] == '') { - $bkDescription = $GLOBALS['blankDescription']; - } else { - // Improve description display (anchors, links, ...) - $bkDescription = preg_replace('|\[\/.*?\]|', '', filter($row['bDescription'])); // remove final anchor - $bkDescription = preg_replace('|\[(.*?)\]|', ' $1 » ', $bkDescription); // highlight starting anchor - $bkDescription = preg_replace('@((http|https|ftp)://.*?)( |\r|$)@', '$1$3', $bkDescription); // make url clickable - - } - echo '
    '. nl2br($bkDescription) ."
    \n"; - echo '
    ' . shortenString($oaddress) . "
    \n"; - - echo '
    ' - . $cats . "\n" - . $copy . "\n" - . $edit . "\n" - . $update . "\n" - . "
    \n"; - echo $privateNoteField != '' - ? '
    '.$privateNoteField."
    \n" - : ''; - echo ' '; - include 'bookmarks-vote-horizontal.inc.tpl.php'; - echo " \n"; - - echo "
  • \n"; - } - ?> - - - - 7) { - echo '

    '.T_('Top of the page').'

    '; - } - echo $pagesBanner; // display previous and next links pages + RSS link - - -} else { - echo '

    '.T_('No bookmarks available').'

    '; -} -$this->includeTemplate('sidebar.tpl'); -$this->includeTemplate($GLOBALS['bottom_include']); -?> + + * @author Christian Weiske + * @author Eric Dane + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ + +/* Service creation: only useful services are created */ +$bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark'); +$tagservice = SemanticScuttle_Service_Factory::get('Tag'); +$cdservice = SemanticScuttle_Service_Factory::get('CommonDescription'); + + +$pageName = isset($pageName) ? $pageName : ''; +$user = isset($user) ? $user : ''; +$currenttag = isset($currenttag) ? $currenttag : ''; + + +$this->includeTemplate($GLOBALS['top_include']); + +include('search.menu.php'); +?> + + +

    + + + +isAdmin($userid) && $pageName != PAGE_WATCHLIST) : ?> +
    + +
    + + + + + + +

    getLastTagDescription($currenttag)) { + $cDescription = $cdservice->getLastTagDescription($currenttag); + echo nl2br(filter($cDescription['cdDescription'])); +} elseif(isset($hash) && $cdservice->getLastBookmarkDescription($hash)) { + $cDescription = $cdservice->getLastBookmarkDescription($hash); + echo nl2br(filter($cDescription['cdTitle'])). "
    "; + echo nl2br(filter($cDescription['cdDescription'])). "
    "; +} + +//common tag description edit +if($userservice->isLoggedOn()) { + if($currenttag!= '' && ($GLOBALS['enableCommonTagDescriptionEditedByAll'] || $currentUser->isAdmin())) { + echo ' '; + echo !is_array($cDescription) || strlen($cDescription['cdDescription'])==0?T_('Edit the common description of this tag'):''; + echo ' '; + } elseif(isset($hash)) { + echo ' ('; + echo T_('Edit the common description of this bookmark').')'; + } +} +?>

    + + + +getUserByUsername($user); + if($tagservice->getDescription($currenttag, $userObject['uId'])) { ?> + +

    getDescription($currenttag, $userObject['uId']); +echo nl2br(filter($pDescription['tDescription'])); + +//personal tag description edit +if($userservice->isLoggedOn()) { + if($currenttag!= '') { + echo ' '; + echo strlen($pDescription['tDescription'])==0?T_('Edit your personal description of this tag'):''; + echo ' '; + } +} +?>

    + + + + 0) { ?> + + +

    - + + + / + + / + + + / + + +'; + echo T_('Bookmarks from other users for this tag').''; + //echo T_(' for these tags'); + } else if ($userservice->isLoggedOn()){ + echo ' - '; + echo ''; + echo T_('Only your bookmarks for this tag').''; + //echo T_(' for these tags'); + } +} +?>

    + +'. T_('First') .''; + $bprev = ''. T_('Previous') .''; + } else { + $prev = $page - 1; + $prev = 'page='. $prev; + $start = ($page - 1) * $perpage; + $bfirst= ''. T_('First') .''; + $bprev = ''. T_('Previous') .''; + } + + // Next + $next = $page + 1; + $totalpages = ceil($total / $perpage); + if (count($bookmarks) < $perpage || $perpage * $page == $total) { + $bnext = ''. T_('Next') .''; + $blast = ''. T_('Last') ."\n"; + } else { + $bnext = ''. T_('Next') .''; + $blast = ''. T_('Last') ."\n"; + } + + // RSS + $brss = ''; + $size = count($rsschannels); + for ($i = 0; $i < $size; $i++) { + $brss = '' + . '' . htmlspecialchars($rsschannels[$i][0]) .'' + . ''; + } + + $pagesBanner = '

    '. $bfirst .' / '. $bprev .' / '. $bnext .' / '. $blast .' / '. sprintf(T_('Page %d of %d'), $page, $totalpages) ." ". $brss ."

    \n"; + + if (getPerPageCount($currentUser) > 10) { + echo $pagesBanner; // display a page banner if too many bookmarks to manage + } + + +?> + + + + 0 ? ' start="'. ++$start .'"' : ''); ?> id="bookmarks"> + &$row) { + $addresses[$row['bId']] = $row['bAddress']; + } + $otherCounts = $bookmarkservice->countOthers($addresses); + if ($userservice->isLoggedOn()) { + $existence = $bookmarkservice->bookmarksExist( + $addresses, $currentUser->getId() + ); + } + + if ($userservice->isLoggedOn()) { + $watchedNames = $userservice->getWatchNames( + $currentUser->getId(), true + ); + } else { + $watchedNames = null; + } + + foreach ($bookmarks as $key => &$row) { + switch ($row['bStatus']) { + case 0: + $access = ''; + break; + case 1: + $access = ' shared'; + break; + case 2: + $access = ' private'; + break; + } + + $cats = ''; + $tagsForCopy = ''; + $tags = $row['tags']; + foreach ($tags as $tkey => &$tag) { + $tagcaturl = sprintf( + $cat_url, + filter($row['username'], 'url'), + filter($tag, 'url') + ); + $cats .= sprintf( + ', ', + $tagcaturl, filter($tag) + ); + $tagsForCopy .= $tag . ','; + } + $cats = substr($cats, 0, -2); + if ($cats != '') { + $cats = T_('Tags:') . ' ' . $cats; + } + + // Edit and delete links + $edit = ''; + if ($bookmarkservice->editAllowed($row)) { + $edit = ' - ' + . T_('Edit') + . '' + . ''; + } + + // Last update + $update = ' ('. date($GLOBALS['shortdate'], strtotime($row['bModified'])). ') '; + + // User attribution + $copy = ' ' . T_('by') . ' '; + if ($userservice->isLoggedOn() + && $currentUser->getUsername() == $row['username'] + ) { + $copy .= T_('you'); + } else { + $copy .= '' + . $row['username'] . ''; + } + + // Udders! + if (!isset($hash)) { + $others = $otherCounts[$row['bAddress']]; + $ostart = ''; + $oend = ''; + switch ($others) { + case 0: + break; + case 1: + $copy .= sprintf(T_(' and %s1 other%s'), $ostart, $oend); + break; + default: + $copy .= sprintf(T_(' and %2$s%1$s others%3$s'), $others, $ostart, $oend); + } + } + + // Copy link + if ($userservice->isLoggedOn() + && ($currentUser->getId() != $row['uId']) + && !$existence[$row['bAddress']] + ) { + $copy .= ' - ' + . T_('Copy') + . ''; + } + + // Nofollow option + $rel = ''; + if ($GLOBALS['nofollow']) { + $rel = ' rel="nofollow"'; + } + + $address = filter($row['bAddress']); + $oaddress = $address; + // Redirection option + if ($GLOBALS['useredir']) { + $address = $GLOBALS['url_redir'] . $address; + } + + // Admin specific design + if ($userservice->isAdmin($row['username']) && $GLOBALS['enableAdminColors']) { + $adminBgClass = ' class="adminBackground"'; + $adminStar = ' '; + } else { + $adminBgClass = ''; + $adminStar = ''; + } + + // Private Note (just visible by the owner and his/her contacts) + if ($watchedNames !== null + && ($currentUser->getId() == $row['uId'] + || in_array($row['username'], $watchedNames) + ) + ) { + $privateNoteField = $row['bPrivateNote']; + } else { + $privateNoteField = ''; + } + + if ($GLOBALS['enableVoting'] && $GLOBALS['hideBelowVoting'] !== null + && $row['bVoting'] < $GLOBALS['hideBelowVoting'] + ) { + $access .= ' below-threshold'; + } + + // Output + echo '
  • '."\n"; + include 'bookmarks-thumbnail.inc.tpl.php'; + include 'bookmarks-vote.inc.tpl.php'; + + echo ' ' . "\n"; + + echo ' \n"; + if ($row['bDescription'] == '') { + $bkDescription = $GLOBALS['blankDescription']; + } else { + // Improve description display (anchors, links, ...) + $bkDescription = preg_replace('|\[\/.*?\]|', '', filter($row['bDescription'])); // remove final anchor + $bkDescription = preg_replace('|\[(.*?)\]|', ' $1 » ', $bkDescription); // highlight starting anchor + $bkDescription = preg_replace('@((http|https|ftp)://.*?)( |\r|$)@', '$1$3', $bkDescription); // make url clickable + + } + echo '
    '. nl2br($bkDescription) ."
    \n"; + echo '
    ' . shortenString($oaddress) . "
    \n"; + + echo '
    ' + . $cats . "\n" + . $copy . "\n" + . $edit . "\n" + . $update . "\n" + . "
    \n"; + echo $privateNoteField != '' + ? '
    '.$privateNoteField."
    \n" + : ''; + echo ' '; + include 'bookmarks-vote-horizontal.inc.tpl.php'; + echo " \n"; + + echo "
  • \n"; + } + ?> + + + + 7) { + echo '

    '.T_('Top of the page').'

    '; + } + echo $pagesBanner; // display previous and next links pages + RSS link + + +} else { + echo '

    '.T_('No bookmarks available').'

    '; +} +$this->includeTemplate('sidebar.tpl'); +$this->includeTemplate($GLOBALS['bottom_include']); +?> -- cgit v1.2.3