2007-12-12 17:29:16 +01:00
< ? php
2008-11-21 18:25:23 +01:00
/* Service creation: only useful services are created */
2007-12-12 17:29:16 +01:00
$bookmarkservice =& ServiceFactory :: getServiceInstance ( 'BookmarkService' );
2008-04-21 17:43:00 +02:00
$tagservice =& ServiceFactory :: getServiceInstance ( 'TagService' );
2008-02-13 18:34:18 +01:00
$cdservice =& ServiceFactory :: getServiceInstance ( 'CommonDescriptionService' );
2007-12-12 17:29:16 +01:00
2008-11-21 19:45:18 +01:00
2008-05-14 10:55:38 +02:00
$pageName = isset ( $pageName ) ? $pageName : " " ;
2008-11-27 08:27:36 +01:00
$user = isset ( $user ) ? $user : " " ;
2009-01-15 17:58:14 +01:00
$currenttag = isset ( $currenttag ) ? $currenttag : " " ;
2008-02-20 14:43:06 +01:00
2007-12-12 17:29:16 +01:00
$this -> includeTemplate ( $GLOBALS [ 'top_include' ]);
include ( 'search.inc.php' );
?>
2008-05-14 10:55:38 +02:00
< ? php if ( $pageName == PAGE_INDEX ) : ?>
< p id = " welcome " >< ? php echo $GLOBALS [ 'welcomeMessage' ]; ?> </p>
< ? php endif ?>
2009-01-07 16:13:16 +01:00
< ? php if ( $GLOBALS [ 'enableAdminColors' ] != false && isset ( $userid ) && $userservice -> isAdmin ( $userid )) : ?>
< div style = " width:70%;text-align:center; " >
< img src = " <?php echo ROOT ?>images/logo_24.png " width = " 12px " /> < ? php echo T_ ( 'Bookmarks on this page are managed by an admin user.' ); ?> <img src="<?php echo ROOT ?>images/logo_24.png" width="12px"/>
</ div >
< ? php endif ?>
2008-02-13 18:34:18 +01:00
< ? php
2008-11-25 16:57:29 +01:00
// common tag description
2009-01-15 17:58:14 +01:00
if (( $currenttag != '' && $GLOBALS [ 'enableCommonTagDescription' ])
2008-11-21 19:45:18 +01:00
|| ( isset ( $hash ) && $GLOBALS [ 'enableCommonBookmarkDescription' ])) : ?>
2008-11-25 16:57:29 +01:00
2008-11-21 19:45:18 +01:00
< p class = " commondescription " >< ? php
2009-01-15 17:58:14 +01:00
if ( $currenttag != '' && $cdservice -> getLastTagDescription ( $currenttag )) {
2008-11-21 19:45:18 +01:00
$description = $cdservice -> getLastTagDescription ( $currenttag );
echo nl2br ( filter ( $description [ 'cdDescription' ]));
2008-02-13 18:34:18 +01:00
} elseif ( isset ( $hash ) && $cdservice -> getLastBookmarkDescription ( $hash )) {
2008-11-21 19:45:18 +01:00
$description = $cdservice -> getLastBookmarkDescription ( $hash );
echo nl2br ( filter ( $description [ 'cdTitle' ])) . " <br/> " ;
echo nl2br ( filter ( $description [ 'cdDescription' ])) . " <br/> " ;
2008-02-13 18:34:18 +01:00
}
2008-11-25 16:57:29 +01:00
//common tag description edit
2008-11-21 19:45:18 +01:00
if ( $userservice -> isLoggedOn ()) {
2009-01-15 17:58:14 +01:00
if ( $currenttag != '' ) {
2009-01-15 15:15:41 +01:00
echo ' <a href="' . createURL ( 'tagcommondescriptionedit' , $currenttag ) . '">' ;
echo T_ ( 'common description' ) . ' <img src="' . ROOT . 'images/b_edit.png" /></a>' ;
2008-11-21 19:45:18 +01:00
} elseif ( isset ( $hash )) {
echo ' (<a href="' . createURL ( 'bookmarkcommondescriptionedit' , $hash ) . '">' ;
echo T_ ( 'edit common description' ) . '</a>)' ;
}
2008-02-13 18:34:18 +01:00
}
2008-11-21 19:45:18 +01:00
?> </p>
2008-02-13 18:34:18 +01:00
< ? php endif ?>
2008-04-21 17:43:00 +02:00
< ? php
2009-01-15 15:15:41 +01:00
/* personal tag description */
2009-01-15 17:58:14 +01:00
if ( $currenttag != '' && $user != '' ) {
2008-11-21 19:45:18 +01:00
$userObject = $userservice -> getUserByUsername ( $user );
if ( $tagservice -> getDescription ( $currenttag , $userObject [ 'uId' ])) { ?>
2008-05-10 10:59:41 +02:00
2008-11-21 19:45:18 +01:00
< p class = " commondescription " >< ? php
$description = $tagservice -> getDescription ( $currenttag , $userObject [ 'uId' ]);
echo nl2br ( filter ( $description [ 'tDescription' ]));
2009-01-15 15:15:41 +01:00
//personal tag description edit
if ( $userservice -> isLoggedOn ()) {
2009-01-15 17:58:14 +01:00
if ( $currenttag != '' ) {
2009-01-15 15:15:41 +01:00
echo ' <a href="' . createURL ( 'tagedit' , $currenttag ) . '">' ;
echo T_ ( 'personal description' ) . ' <img src="' . ROOT . 'images/b_edit.png" /></a>' ;
}
}
2008-11-21 19:45:18 +01:00
?> </p>
2008-05-10 10:59:41 +02:00
2008-11-21 19:45:18 +01:00
< ? php
}
2008-05-10 10:59:41 +02:00
}
?>
2008-04-21 17:43:00 +02:00
2008-02-13 18:34:18 +01:00
< ? php if ( count ( $bookmarks ) > 0 ) { ?>
2007-12-12 17:29:16 +01:00
< script type = " text/javascript " >
window . onload = playerLoad ;
</ script >
2008-11-21 19:45:18 +01:00
< p id = " sort " >< ? php echo $total . ' ' . T_ ( " bookmark(s) " ); ?> - <?php echo T_("Sort by:"); ?>
< ? php
$dateSort = ( getSortOrder () == 'date_desc' ) ? 'date_asc' : 'date_desc' ;
$titleSort = ( getSortOrder () == 'title_asc' ) ? 'title_desc' : 'title_asc' ;
$urlSort = ( getSortOrder () == 'url_asc' ) ? 'url_desc' : 'url_asc' ;
?> <a href="?sort=<?php echo $dateSort ?>"><?php echo T_("Date"); ?></a><span>
/ </ span > < a href = " ?sort=<?php echo $titleSort ?> " >< ? php echo T_ ( " Title " ); ?> </a><span>
/ </ span > < ? php
if ( ! isset ( $hash )) {
?> <a href="?sort=<?php echo $urlSort ?>"><?php echo T_("URL"); ?></a>
< ? php
}
?> <?php
2009-01-15 17:58:14 +01:00
if ( $currenttag != '' ) {
if ( $user != '' ) {
2008-11-21 19:45:18 +01:00
echo ' - ' ;
echo '<a href="' . createURL ( 'tags' , $currenttag ) . '">' ;
echo T_ ( 'Bookmarks from other users for this tag' ) . '</a>' ;
//echo T_(' for these tags');
} else if ( $userservice -> isLoggedOn ()){
echo ' - ' ;
2008-12-05 08:25:04 +01:00
echo '<a href="' . createURL ( 'bookmarks' , $currentUser -> getUsername () . '/' . $currenttag ) . '">' ;
2008-11-21 19:45:18 +01:00
echo T_ ( 'Only your bookmarks for this tag' ) . '</a>' ;
//echo T_(' for these tags');
}
}
?> </p>
< ol < ? php echo ( $start > 0 ? ' start="' . ++ $start . '"' : '' ); ?>
id = " bookmarks " >
< ? php
foreach ( array_keys ( $bookmarks ) as $key ) {
$row =& $bookmarks [ $key ];
switch ( $row [ 'bStatus' ]) {
case 0 :
$access = '' ;
break ;
case 1 :
$access = ' shared' ;
break ;
case 2 :
$access = ' private' ;
break ;
}
$cats = '' ;
$tagsForCopy = '' ;
$tags = $row [ 'tags' ];
foreach ( array_keys ( $tags ) as $key ) {
$tag =& $tags [ $key ];
$cats .= '<a href="' . sprintf ( $cat_url , filter ( $row [ 'username' ], 'url' ), filter ( $tag , 'url' )) . '" rel="tag">' . filter ( $tag ) . '</a>, ' ;
$tagsForCopy .= $tag . ',' ;
}
$cats = substr ( $cats , 0 , - 2 );
if ( $cats != '' ) {
$cats = ' ' . T_ ( 'in' ) . ' ' . $cats ;
}
// Edit and delete links
$edit = '' ;
if ( $bookmarkservice -> editAllowed ( $row [ 'bId' ])) {
$edit = ' - <a href="' . createURL ( 'edit' , $row [ 'bId' ]) . '">' . T_ ( 'Edit' ) . '</a><script type="text/javascript">document.write(" - <a href=\"#\" onclick=\"deleteBookmark(this, ' . $row [ 'bId' ] . '); return false;\">' . T_ ( 'Delete' ) . '<\/a>");</script>' ;
}
// User attribution
$copy = '' ;
2009-01-06 18:03:55 +01:00
if ( $user == '' || isset ( $watched )) {
2008-11-21 19:45:18 +01:00
$copy = ' ' . T_ ( 'by' ) . ' <a href="' . createURL ( 'bookmarks' , $row [ 'username' ]) . '">' . $row [ 'username' ] . '</a>' ;
}
// Udders!
if ( ! isset ( $hash )) {
$others = $bookmarkservice -> countOthers ( $row [ 'bAddress' ]);
$ostart = '<a href="' . createURL ( 'history' , $row [ 'bHash' ]) . '">' ;
$oend = '</a>' ;
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 ()
2008-12-05 08:25:04 +01:00
&& ( $currentUser -> getId () != $row [ 'uId' ])
&& ! $bookmarkservice -> bookmarkExists ( $row [ 'bAddress' ], $currentUser -> getId ())) {
$copy .= ' - <a href="' . createURL ( 'bookmarks' , $currentUser -> getUsername () . '?action=add&address=' . urlencode ( $row [ 'bAddress' ]) . '&title=' . urlencode ( $row [ 'bTitle' ])) . '&description=' . urlencode ( $row [ 'bDescription' ]) . '&tags=' . $tagsForCopy . '">' . T_ ( 'Copy' ) . '</a>' ;
2008-11-21 19:45:18 +01:00
}
// Nofollow option
$rel = '' ;
if ( $GLOBALS [ 'nofollow' ]) {
$rel = ' rel="nofollow"' ;
}
$address = filter ( $row [ 'bAddress' ]);
// Redirection option
if ( $GLOBALS [ 'useredir' ]) {
$address = $GLOBALS [ 'url_redir' ] . $address ;
}
// Output
echo '<li class="xfolkentry' . $access . '">' . " \n " ;
if ( $GLOBALS [ 'enableWebsiteThumbnails' ]) {
$thumbnailHash = md5 ( $address . $GLOBALS [ 'thumbnailsUserId' ] . $GLOBALS [ 'thumbnailsKey' ]);
echo '<a href="' . $address . '"' . $rel . ' ><img class="thumbnail" src="http://www.artviper.net/screenshots/screener.php?url=' . $address . '&w=120&sdx=1280&userID=' . $GLOBALS [ 'thumbnailsUserId' ] . '&hash=' . $thumbnailHash . '" /> ' ;
}
echo '<div>' ;
echo '<div class="link"><a href="' . $address . '"' . $rel . ' class="taggedlink">' . filter ( $row [ 'bTitle' ]) . " </a></div> \n " ;
if ( $row [ 'bDescription' ] == '' ) {
2008-12-18 17:25:17 +01:00
$bkDescription = '-' ;
} else {
$bkDescription = preg_replace ( '|\[\/.*?\]|' , '' , filter ( $row [ 'bDescription' ])); // remove final anchor
2009-01-15 16:04:59 +01:00
$bkDescription = preg_replace ( '|\[(.*?)\]|' , ' <b>$1 </b>' , $bkDescription ); // highlight starting anchor
2008-11-21 19:45:18 +01:00
}
2009-01-15 16:04:59 +01:00
echo '<div class="description">' . nl2br ( $bkDescription ) . " </div> \n " ;
2009-01-06 18:31:23 +01:00
//if(!isset($hash)) {
2008-11-21 19:45:18 +01:00
echo '<div class="address">' . shortenString ( $address ) . '</div>' ;
2009-01-06 18:31:23 +01:00
//}
2008-11-21 19:45:18 +01:00
2008-12-09 18:03:14 +01:00
echo '<div class="meta">' . date ( $GLOBALS [ 'shortdate' ], strtotime ( $row [ 'bModified' ])) . $cats . $copy . $edit . " </div> \n " ;
2008-11-21 19:45:18 +01:00
echo '</div>' ;
echo " </li> \n " ;
}
?>
</ ol >
< ? php
// PAGINATION
// Ordering
$sortOrder = '' ;
2008-11-25 16:57:29 +01:00
if ( GET_SORT != '' ) {
$sortOrder = 'sort=' . GET_SORT ;
2008-02-20 14:43:06 +01:00
}
2008-11-21 19:45:18 +01:00
$sortAmp = (( $sortOrder ) ? '&' . $sortOrder : '' );
$sortQue = (( $sortOrder ) ? '?' . $sortOrder : '' );
// Previous
$perpage = getPerPageCount ();
if ( ! $page || $page < 2 ) {
$page = 1 ;
$start = 0 ;
$bfirst = '<span class="disable">' . T_ ( 'First' ) . '</span>' ;
$bprev = '<span class="disable">' . T_ ( 'Previous' ) . '</span>' ;
} else {
$prev = $page - 1 ;
$prev = 'page=' . $prev ;
$start = ( $page - 1 ) * $perpage ;
$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>' ;
2008-03-11 13:36:23 +01:00
}
2008-11-21 19:45:18 +01:00
// Next
$next = $page + 1 ;
$totalpages = ceil ( $total / $perpage );
if ( count ( $bookmarks ) < $perpage || $perpage * $page == $total ) {
$bnext = '<span class="disable">' . T_ ( 'Next' ) . '</span>' ;
$blast = '<span class="disable">' . T_ ( 'Last' ) . " </span> \n " ;
} else {
$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 " ;
2008-02-13 18:41:47 +01:00
}
2008-03-11 13:36:23 +01:00
2008-11-21 19:45:18 +01:00
// RSS
$brss = '' ;
$size = count ( $rsschannels );
for ( $i = 0 ; $i < $size ; $i ++ ) {
$brss = '<a style="background:#FFFFFF" href="' . $rsschannels [ $i ][ 1 ] . '" title="' . $rsschannels [ $i ][ 0 ] . '"><img src="' . ROOT . 'images/rss.gif" width="16" height="16" alt="' . $rsschannels [ $i ][ 0 ] . '" /></a>' ;
}
2008-03-11 14:50:23 +01:00
2008-11-21 19:45:18 +01:00
echo '<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 " ;
2008-03-11 14:50:23 +01:00
2007-12-12 17:29:16 +01:00
2008-04-24 10:48:57 +02:00
2007-12-12 17:29:16 +01:00
} else {
2008-11-21 19:45:18 +01:00
echo '<p class="error">' . T_ ( 'No bookmarks available' ) . '</p>' ;
2007-12-12 17:29:16 +01:00
}
$this -> includeTemplate ( 'sidebar.tpl' );
$this -> includeTemplate ( $GLOBALS [ 'bottom_include' ]);
?>