Bug fixes: correct minor bugs appearing with 'notice' level in PHP

git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@122 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
mensonge 2008-05-10 08:59:41 +00:00
parent e273c0d367
commit 2756e3f858
21 changed files with 73 additions and 30 deletions

View file

@ -13,7 +13,6 @@ function authenticate() {
}
if(!$userservice->isLoggedOn()) {
/* Maybe we have caught authentication data in $_SERVER['REMOTE_USER']
( Inspired by http://www.yetanothercommunitysystem.com/article-321-regle-comment-utiliser-l-authentification-http-en-php-chez-ovh ) */
if((!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']))

View file

@ -209,12 +209,12 @@ if ($templatename == 'editbookmark.tpl') {
$tplVars['start'] = $start;
$tplVars['bookmarkCount'] = $start + 1;
$bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $userid, $cat, $terms, getSortOrder());
$bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $userid, $cat, null, getSortOrder());
$tplVars['total'] = $bookmarks['total'];
$tplVars['bookmarks'] =& $bookmarks['bookmarks'];
$tplVars['cat_url'] = createURL('bookmarks', '%s/%s');
$tplVars['nav_url'] = createURL('bookmarks', '%s/%s%s');
if ($user == $currentUsername) {
if ($userservice->isLoggedOn() && $user == $currentUsername) {
$title = T_('My Bookmarks') . filter($catTitle);
} else {
$title = filter($pagetitle);

View file

@ -3,6 +3,7 @@ ini_set('display_errors', '1');
ini_set('mysql.trace_mode', '0');
error_reporting(E_ALL ^ E_NOTICE);
//error_reporting(E_ALL);
define('DEBUG', true);
session_start();
@ -30,4 +31,5 @@ if (!isset($root)) {
}
$root = 'http://'. $_SERVER['HTTP_HOST'] . $root;
}
?>

View file

@ -108,6 +108,7 @@ class FileReader {
// PHP 5.1.1 does not read more than 8192 bytes in one fread()
// the discussions at PHP Bugs suggest it's the intended behaviour
$data = '';
while ($bytes > 0) {
$chunk = fread($this->_fd, $bytes);
$data .= $chunk;
@ -163,4 +164,4 @@ class CachedFileReader extends StringReader {
}
?>
?>

View file

@ -25,10 +25,12 @@ $templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$tplVars = array();
$keeppass = isset($_POST['keeppass'])&&($_POST['keeppass']=='yes')?true:false;
$login = false;
if (isset($_POST['submitted']) && isset($_POST['username']) && isset($_POST['password'])) {
$posteduser = trim(utf8_strtolower($_POST['username']));
$login = $userservice->login($posteduser, $_POST['password'], ($_POST['keeppass'] == "yes"));
$login = $userservice->login($posteduser, $_POST['password'], $keeppass);
if ($login) {
if ($_POST['query'])
header('Location: '. createURL('bookmarks', $posteduser .'?'. $_POST['query']));

View file

@ -24,7 +24,7 @@ $templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$tplVars = array();
// IF SUBMITTED
if ($_POST['submitted']) {
if (isset($_POST['submitted'])) {
// NO USERNAME
if (!$_POST['username']) {

View file

@ -66,7 +66,7 @@ if (isset($user) && $user != '') {
$userid = NULL;
}
$tags = $b2tservice->getPopularTags($userid, 150, $logged_on_userid);
$tags = $b2tservice->getPopularTags($userid, 150);
$tplVars['tags'] =& $b2tservice->tagCloud($tags, 5, 90, 225, getSortOrder('alphabet_asc'));
$tplVars['user'] = $user;

View file

@ -25,7 +25,7 @@ $templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$tplVars = array();
if ($_POST['submitted']) {
if (isset($_POST['submitted'])) {
$posteduser = trim(utf8_strtolower($_POST['username']));
// Check if form is incomplete

View file

@ -1,3 +1,10 @@
<?php
/* Manage input */
$select_watchlist = isset($select_watchlist)?$select_watchlist:'';
$select_all = isset($select_all)?$select_all:'';
?>
<form id="search" action="<?php echo createURL('search'); ?>" method="post">
<table>
<tr>
@ -16,12 +23,12 @@
<?php
if (!in_array($range, array($currentUsername, 'all', 'watchlist'))) {
?>
<option value="<?php echo $user ?>"<?php echo $selectUser; ?>><?php echo T_("this user's bookmarks"); ?></option>
<option value="<?php echo $user ?>"<?php //echo $selectUser; ?>><?php echo T_("this user's bookmarks"); ?></option>
<?php
}
if ($logged_on) {
?>
<option value="<?php echo $currentUsername; ?>"<?php echo $selectMy; ?>><?php echo T_('my bookmarks'); ?></option>
<option value="<?php echo $currentUsername; ?>"<?php //echo $selectMy; ?>><?php echo T_('my bookmarks'); ?></option>
<option value="watchlist"<?php echo $select_watchlist; ?>><?php echo T_('my watchlist'); ?></option>
<?php
}
@ -37,7 +44,7 @@
<?php
}
?>
<td><input type="text" name="terms" size="30" value="<?php echo filter($terms); ?>" /></td>
<td><input type="text" name="terms" size="30" value="<?php $terms=!isset($terms)?'':$terms; echo filter($terms); ?>" /></td>
<td><input type="submit" value="<?php echo T_('Search' /* Submit button */); ?>" /></td>
</tr>
</table>

View file

@ -266,7 +266,8 @@ class Bookmark2TagService {
message_die(GENERAL_ERROR, 'Could not get related tags', '', __LINE__, __FILE__, $query, $this->db);
return false;
}
return $this->db->sql_fetchrowset($dbresult);
$output = $this->db->sql_fetchrowset($dbresult);
return $output;
}
// Returns the most popular tags used for a particular bookmark hash
@ -322,7 +323,8 @@ class Bookmark2TagService {
return false;
}
return $this->db->sql_fetchrowset($dbresult);
$output = $this->db->sql_fetchrowset($dbresult);
return $output;
}
function hasTag($bookmarkid, $tag) {
@ -366,7 +368,8 @@ class Bookmark2TagService {
function &tagCloud($tags = NULL, $steps = 5, $sizemin = 90, $sizemax = 225, $sortOrder = NULL) {
if (is_null($tags) || count($tags) < 1) {
return false;
$output = false;
return $output;
}
$min = $tags[count($tags) - 1]['bCount'];

View file

@ -280,6 +280,7 @@ class BookmarkService {
$query_3 .= ' AND ('. $query_3_1 .') AND B.bStatus IN (0, 1)';
}
$query_5 = '';
if($hash == null) {
$query_5.= ' GROUP BY B.bHash';
}
@ -389,7 +390,9 @@ class BookmarkService {
$row['tags'] = $b2tservice->getTagsForBookmark(intval($row['bId']));
$bookmarks[] = $row;
}
return array ('bookmarks' => $bookmarks, 'total' => $total);
$output = array ('bookmarks' => $bookmarks, 'total' => $total);
return $output;
}
function deleteBookmark($bookmarkid) {

View file

@ -62,7 +62,7 @@ class Tag2TagService {
$query.= " AND uId = '".$uId."'";
}
//die($query);
if (! ($dbresult =& $this->db->sql_query_limit($query, $limit)) ){
if (! ($dbresult =& $this->db->sql_query($query)) ){
message_die(GENERAL_ERROR, 'Could not get related tags', '', __LINE__, __FILE__, $query, $this->db);
return false;
}

View file

@ -127,7 +127,7 @@ class UserService {
if ($id = $this->getCurrentUserId())
$currentuser = $this->getUser($id);
else
return;
return null;
}
return $currentuser;
}

View file

@ -24,10 +24,12 @@ $tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService');
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
$userservice = & ServiceFactory :: getServiceInstance('UserService');
$logged_on_user = $userservice->getCurrentUser();
//permissions
if($logged_on_user == null) {
if($logged_on_user == null) {
$tplVars['error'] = T_('Permission denied.');
$templateservice->loadTemplate('error.500.tpl', $tplVars);
exit();

View file

@ -43,17 +43,22 @@ if($logged_on_userid>0) {
<?php
$userObject = $userservice->getUserByUsername($user);
/* Private tag description */
if(isset($currenttag) && strlen($user)>0 && $tagservice->getDescription($currenttag, $userObject['uId'])):?>
if(isset($currenttag) && isset($user)) {
$userObject = $userservice->getUserByUsername($user);
if($tagservice->getDescription($currenttag, $userObject['uId'])) { ?>
<p class="commondescription">
<?php
$description = $tagservice->getDescription($currenttag, $userObject['uId']);
echo nl2br(filter($description['tDescription']));
?>
</p>
<?php endif ?>
<?php
}
}
?>
<?php if (count($bookmarks) > 0) { ?>
<script type="text/javascript">

View file

@ -4,13 +4,20 @@ $userservice =& ServiceFactory::getServiceInstance('UserService');
require_once('sidebar.linkedtags.inc.php');
/* Manage input */
$user = isset($user)?$user:'';
$userid = isset($userid)?$userid:0;
$currenttag = isset($currenttag)?$currenttag:'';
$summarizeLinkedTags = isset($summarizeLinkedTags)?$summarizeLinkedTags:false;
$logged_on_userid = $userservice->getCurrentUserId();
if ($logged_on_userid === false) {
$logged_on_userid = NULL;
}
$explodedTags = array();
if ($currenttag) {
if (strlen($currenttag)>0) {
$explodedTags = explode('+', $currenttag);
} else {
if($summarizeLinkedTags == true) {

View file

@ -4,6 +4,11 @@ $userservice =& ServiceFactory::getServiceInstance('UserService');
require_once('sidebar.linkedtags.inc.php');
/* Manage input */
$userid = isset($userid)?$userid:0;
$user = isset($user)?$user:null;
$logged_on_userid = $userservice->getCurrentUserId();
if ($logged_on_userid === false) {
$logged_on_userid = NULL;
@ -16,7 +21,7 @@ if(($logged_on_userid != null) && ($userid === $logged_on_userid)) {
$editingMode = false;
}
if(strlen($user)==0) {
if(!isset($user)) {
$cat_url = createURL('tags', '%2$s');
}

View file

@ -2,6 +2,9 @@
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
/* Manage input */
$userid = isset($userid)?$userid:0;
$logged_on_userid = $userservice->getCurrentUserId();
if ($logged_on_userid === false) {
$logged_on_userid = NULL;

View file

@ -19,6 +19,8 @@ function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode
} else {
$link = '> ';
}
} else {
$link = '';
}
$output = '';
@ -69,7 +71,7 @@ function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode
$displayLinkedTags = displayLinkedTags($linkedTag, $linkType, $uId, $cat_url, $user, $editingMode, $precedentTag, $level + 1, $stopList);
$output.= $displayLinkedTags['output'];
}
if(is_array($displayLinkedTags['stopList'])) {
if(isset($displayLinkedTags) && is_array($displayLinkedTags['stopList'])) {
$stopList = array_merge($stopList, $displayLinkedTags['stopList']);
$stopList = array_unique($stopList);
}

View file

@ -21,7 +21,7 @@ if ($userservice->isLoggedOn()) {
?>
<ul id="navigation">
<li><a href="<?php echo createURL('populartags', $cUsername); ?>"><?php echo T_('Popular Tags'); ?></a></li>
<li><a href="<?php echo createURL('populartags'); ?>"><?php echo T_('Popular Tags'); ?></a></li>
<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>

View file

@ -7,11 +7,13 @@
<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(isset($rsschannels)) {
$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) {
if (isset($loadjs)) {
echo '<script type="text/javascript" src="'. $GLOBALS['root'] .'jsScuttle.php"></script>';
}
?>