scuttle 0.7.4: scuttle 0.7.4-watchlist.php

Filename: scuttle 0.7.4/watchlist.php
File size: 4kB


<?php
/***************************************************************************
Copyright (C) 2004 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
***************************************************************************/
require_once(‘header.inc.php’);

$bookmarkservice =& ServiceFactory::getServiceInstance(‘BookmarkService’);
$templateservice =& ServiceFactory::getServiceInstance(‘TemplateService’);
$userservice =& ServiceFactory::getServiceInstance(‘UserService’);
$cacheservice =& ServiceFactory::getServiceInstance(‘CacheService’);

$tplVars = array();

@list($url$user$page) = isset($_SERVER['PATH_INFO']) ? explode(‘/’$_SERVER['PATH_INFO']) : NULL;

$loggedon false;
if (
$userservice->isLoggedOn()) {
    
$loggedon true;
    
$currentUser $userservice->getCurrentUser();
    
$currentUsername $currentUser[$userservice->getFieldName('username')];
}

if ($usecache) {
    
// Generate hash for caching on
    
if ($loggedon) {
        if (
$currentUsername != $user) {
            
$cachehash md5($_SERVER['REQUEST_URI'] . $currentUsername);

            // Cache for 5 minutes
            
$cacheservice->Start($cachehash);
        }
    } else {
        
// Cache for 30 minutes
        
$cachehash md5($_SERVER['REQUEST_URI']);
        
$cacheservice->Start($cachehash1800);
    }
}

if ($user) {
    if (
is_int($user)) {
        
$userid intval($user);
    } else {
        if (!(
$userinfo $userservice->getUserByUsername($user) ) ) {
            
// Throw a 404 error
            
$tplVars['error'] = sprintf(T_(‘User with username %s was not found’), $user);
            
$templateservice->loadTemplate(‘error.404.tpl’$tplVars);
            exit();
        } else {
            
$userid =& $userinfo['uId'];
        }
    }
}

// Header variables
$tplVars['loadjs'] = true;

if ($user) {
    
$tplVars['user'] = $user;
    
$tplVars['userid'] = $userid;
    
$tplVars['userinfo'] =& $userinfo;

    // Pagination
    
$perpage getPerPageCount();
    if (isset(
$_GET['page']) && intval($_GET['page']) > 1) {
        
$page $_GET['page'];
        
$start = ($page 1) * $perpage;
    } else {
        
$page 0;
        
$start 0;
    }

    // Set template vars
    
$tplVars['page'] = $page;
    
$tplVars['start'] = $start;
    
$tplVars['bookmarkCount'] = $start   1;
    
    
$bookmarks =& $bookmarkservice->getBookmarks($start$perpage$useridNULLNULLgetSortOrder(), true);

    $tplVars['sidebar_blocks'] = array(‘watchlist’);
    
$tplVars['watched'] = true;
    
$tplVars['total'] = $bookmarks['total'];
    
$tplVars['bookmarks'] =& $bookmarks['bookmarks'];
    
$tplVars['cat_url'] = createURL(‘tags’‘%2$s’);
    
$tplVars['nav_url'] = createURL(‘watchlist’‘%s/%s%s’);

    if ($user == $currentUsername) {
        
$title T_(‘My Watchlist’);
    } else {
        
$title T_(‘Watchlist’) .‘: ’$user;
    }
    
$tplVars['pagetitle'] = $title;
    
$tplVars['subtitle'] = $title;

    $tplVars['rsschannels'] = array(
        array(
filter($sitename .‘: ’$title), createURL(‘rss’‘watchlist/’filter($user‘url’)))
    );

    $templateservice->loadTemplate(‘bookmarks.tpl’$tplVars);
} else {
    
$tplVars['error'] = T_(‘Username was not specified’);
    
$templateservice->loadTemplate(‘error.404.tpl’$tplVars);
    exit();
}

if ($usecache) {
    
// Cache output if existing copy has expired
    
$cacheservice->End($hash);
}
?>


scuttle 0.7.4: scuttle 0.7.4-watch.php

Filename: scuttle 0.7.4/watch.php
File size: 2kB


<?php
/***************************************************************************
Copyright (C) 2004 - 2006 Scuttle project
http://sourceforge.net/projects/scuttle/
http://scuttle.org/

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
***************************************************************************/

require_once(‘header.inc.php’);
$userservice =& ServiceFactory::getServiceInstance(‘UserService’);

@list($url$user) = isset($_SERVER['PATH_INFO']) ? explode(‘/’$_SERVER['PATH_INFO']) : NULL;
if (
$userservice->isLoggedOn() && $user) {
    
$tplVars = array();
    
$pagetitle ;

    if (is_int($user)) {
        
$userid intval($user);
    } else {
        if (!(
$userinfo $userservice->getUserByUsername($user))) {
            
$tplVars['error'] = sprintf(T_(‘User with username %s was not found’), $user);
            
$templateservice->loadTemplate(‘error.404.tpl’$tplVars);
            exit();
        } else {
            
$userid =& $userinfo['uId'];
        }
    }

    $watched $userservice->getWatchStatus($userid$userservice->getCurrentUserId());
    
$changed $userservice->setWatchStatus($userid);

    if ($watched) {
        
$tplVars['msg'] = T_(‘User removed from your watchlist’);
    } else {
        
$tplVars['msg'] = T_(‘User added to your watchlist’);
    }

    $currentUser $userservice->getCurrentUser();
    
$currentUsername $currentUser[$userservice->getFieldName('username')];

    header(‘Location: ’createURL(‘watchlist’$currentUsername));
}
?>


scuttle 0.7.4: scuttle 0.7.4-templates-top.inc.php

Filename: scuttle 0.7.4/templates/top.inc.php
File size: 1kB


<?php header(‘Content-Type: text/html; charset=utf-8′); ?>
<!DOCTYPE html PUBLIC ”-//W3C//DTD XHTML 1.1//EN” ”http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en”>
<head>
    <title><?php echo filter($GLOBALS['sitename'] . (isset($pagetitle) ? ‘: ’ $pagetitle )); ?></title>
    <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
    <link rel=”icon” type=”image/png” href=”<?php echo $GLOBALS['root']; ?>icon.png” />
    <link rel=”stylesheet” type=”text/css” href=”<?php echo $GLOBALS['root']; ?>scuttle.css” />
    <?php
    $size 
count($rsschannels);
    for (
$i 0$i $size$i ) {
        echo 
‘<link rel=”alternate” type=”application/rss xml” title=”‘$rsschannels[$i][0] .‘” href=”‘$rsschannels[$i][1] .‘” />’;
    }
    if (
$loadjs) {
        echo 
‘<script type=”text/javascript” src=”‘$GLOBALS['root'] .‘jsScuttle.php”></script>’;
    }
    
?>
</head>
<body>

<?php
$headerstyle 
;
if(isset(
$_GET['popup'])) {
    
$headerstyle ‘ class=”popup”‘;
}
?>

<div id=”header”<?php echo $headerstyle?>>
    <h1><a href=”<?php echo $GLOBALS['root']; ?>“><?php echo $GLOBALS['sitename']; ?></a></h1>
    <?php
    
if(!isset($_GET['popup'])) {
        
$this->includeTemplate(‘toolbar.inc’);
    }
    
?>
</div>

<?php
if (isset($subtitle)) {
    echo 
‘<h2>’$subtitle .“</h2>\n”;
}
if (isset(
$error)) {
    echo 
‘<p class=”error”>’$error .“</p>\n”;
}
if (isset(
$msg)) {
    echo 
‘<p class=”success”>’$msg .“</p>\n”;
}
?>


scuttle 0.7.4: scuttle 0.7.4-templates-toolbar.inc.php

Filename: scuttle 0.7.4/templates/toolbar.inc.php
File size: 1kB


<?php
$userservice 
=& ServiceFactory::getServiceInstance(‘UserService’);
if (
$userservice->isLoggedOn()) {
    
$cUser $userservice->getCurrentUser();
    
$cUsername $cUser[$userservice->getFieldName('username')];
?>

    <ul id=”navigation”>
        <li><a href=”<?php echo createURL(‘bookmarks’$cUsername); ?>“><?php echo T_(‘Bookmarks’); ?></a></li>
        <li><a href=”<?php echo createURL(‘watchlist’$cUsername); ?>“><?php echo T_(‘Watchlist’); ?></a></li>
        <li><a href=”<?php echo createURL(‘bookmarks’$cUsername ‘?action=add’); ?>“><?php echo T_(‘Add a Bookmark’); ?></a></li>
        <li class=”access”><a href=”<?php echo $GLOBALS['root']; ?>?action=logout”><?php echo T_(‘Log Out’); ?></a></li>
    </ul>

<?php
} else {
?>

    <ul id=”navigation”>
        <li><a href=”<?php echo createURL(‘about’); ?>“><?php echo T_(‘About’); ?></a></li>
        <li class=”access”><a href=”<?php echo createURL(‘login’); ?>“><?php echo T_(‘Log In’); ?></a></li>
        <li class=”access”><a href=”<?php echo createURL(‘register’); ?>“><?php echo T_(‘Register’); ?></a></li>
    </ul>

<?php
}
?>


scuttle 0.7.4: scuttle 0.7.4-templates-tags.tpl.php

Filename: scuttle 0.7.4/templates/tags.tpl.php
File size: 0kB


<?php
$this
->includeTemplate($GLOBALS['top_include']);
if (
$tags && count($tags) > 0) {
?>

<p id=”sort”>
    <?php echo T_(“Sort by:”); ?>
    <a href=”?sort=alphabet_asc”><?php echo T_(“Alphabet”); ?></a><span> / </span>
    <a href=”?sort=popularity_asc”><?php echo T_(“Popularity”); ?></a>
</p>
<p class=”tags”>

<?php
$contents 
;
foreach (
$tags as $row) {
    
$entries T_ngettext(‘bookmark’‘bookmarks’$row['bCount']);
    
$contents .= ‘<a href=”‘sprintf($cat_url$userfilter($row['tag'], ‘url’)) .‘” title=”‘$row['bCount'] .‘ ’$entries .‘” rel=”tag” style=”font-size:’$row['size'] .‘”>’filter($row['tag']) .‘</a> ’;
}
echo 
$contents .“\n”;
?>

</p>

<?php
}
$this->includeTemplate($GLOBALS['bottom_include']);
?>

scuttle 0.7.4: scuttle 0.7.4-templates-tagrename.tpl.php

Filename: scuttle 0.7.4/templates/tagrename.tpl.php
File size: 1kB


<?php
$this
->includeTemplate($GLOBALS['top_include']);
?>
<script type=”text/javascript”>
window.onload = function() {
    document.getElementById(”new”).focus();
}
</script>
<form action=”<?= $formaction ?>” method=”post”>
<table>
<tr>
    <th align=”left”><?php echo T_(‘Old’); ?></th>
    <td><input type=”text” name=”old” id=”old” value=”<?= $old ?>” /></td>
    <td>&larr; <?php echo T_(‘Required’); ?></td>
</tr>
<tr>
    <th align=”left”><?php echo T_(‘New’); ?></th>
    <td><input type=”text” name=”new” id=”new” value=”" /></td>
    <td>&larr; <?php echo T_(‘Required’); ?></td>
</tr>
<tr>
    <td></td>
    <td>
    <input type=”submit” name=”confirm” value=”<?php echo T_(‘Rename’); ?>“ />
    <input type=”submit” name=”cancel” value=”<?php echo T_(‘Cancel’); ?>“ />
    </td>
    <td></td>
</tr>

</table>
</p>

<?php if (isset($referrer)): ?>
<div><input type=”hidden” name=”referrer” value=”<?php echo $referrer?>“ /></div>
<?php endif; ?>

</form>

<?php
$this
->includeTemplate($GLOBALS['bottom_include']); 
?>
            

scuttle 0.7.4: scuttle 0.7.4-templates-tagdelete.tpl.php

Filename: scuttle 0.7.4/templates/tagdelete.tpl.php
File size: 0kB


<?php
$this
->includeTemplate($GLOBALS['top_include']);
?>

<form action=”<?= $formaction ?>” method=”post”>
<p><?php echo T_(‘Are you sure?’); ?></p>
<p>
    <input type=”submit” name=”confirm” value=”<?php echo T_(‘Yes’); ?>“ />
    <input type=”submit” name=”cancel” value=”<?php echo T_(‘No’); ?>“ />
</p>

<?php if (isset($referrer)): ?>
<div><input type=”hidden” name=”referrer” value=”<?php echo $referrer?>“ /></div>
<?php endif; ?>

</form>

<?php
$this
->includeTemplate($GLOBALS['bottom_include']); 
?>

scuttle 0.7.4: scuttle 0.7.4-templates-sidebar.tpl.php

Filename: scuttle 0.7.4/templates/sidebar.tpl.php
File size: 0kB


<div id=”sidebar”>
    <?php
    $size 
count($sidebar_blocks);
    for (
$i 0$i $size$i ) {
        
$this->includeTemplate(’sidebar.block.’$sidebar_blocks[$i]);
    }

    $size count($rsschannels);
    for (
$i 0$i $size$i ) {
        echo 
‘<p><a href=”‘$rsschannels[$i][1] .‘” title=”‘$rsschannels[$i][0] .‘”><img src=”‘$GLOBALS['root'] .‘rss.gif” width=”16″ height=”16″ alt=”‘$rsschannels[$i][0] .‘” /></a></p>’
    }
    
?>
</div>

scuttle 0.7.4: scuttle 0.7.4-templates-sidebar.block.watchstatus.php

Filename: scuttle 0.7.4/templates/sidebar.block.watchstatus.php
File size: 0kB


<?php
$userservice 
=& ServiceFactory::getServiceInstance(‘UserService’);
if (
$userservice->isLoggedOn()) {
    
$currentUser $userservice->getCurrentUser();
    
$currentUsername $currentUser[$userservice->getFieldName('username')];

    if ($currentUsername != $user) {
        
$result $userservice->getWatchStatus($userid$userservice->getCurrentUserId());
        if (
$result) {
            
$linkText T_(‘Remove from Watchlist’);
        } else {
            
$linkText T_(‘Add to Watchlist’);
        }
        
$linkAddress createURL(‘watch’$user);
?>

<h2><?php echo T_(‘Actions’); ?></h2>
<div id=”watchlist”>
    <ul>
        <li><a href=”<?php echo $linkAddress ?>“><?php echo $linkText ?></a></li>
    </ul>
</div>

<?php
    
}
}
?>

scuttle 0.7.4: scuttle 0.7.4-templates-sidebar.block.watchlist.php

Filename: scuttle 0.7.4/templates/sidebar.block.watchlist.php
File size: 0kB


<?php
$userservice 
=& ServiceFactory::getServiceInstance(‘UserService’);

$watching $userservice->getWatchNames($userid);
if (
$watching) {
?>

<h2><?php echo T_(‘Watching’); ?></h2>
<div id=”watching”>
    <ul>
    <?php foreach($watching as $watchuser): ?>
        <li><a href=”<?php echo createURL(‘bookmarks’$watchuser); ?>“><?php echo $watchuser?></a> &rarr;</li>
    <?php endforeach; ?>
    </ul>
</div>

<?php
}
?>