aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-05-10 08:59:41 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-05-10 08:59:41 +0000
commit2756e3f85818346a478725b6dd94a966e0d92c07 (patch)
treeefad4c6566773670dc5f9a8b733f2a3ed3fe4a57
parente273c0d367da161651324eca1b7e4177c670c91f (diff)
downloadsemanticscuttle-2756e3f85818346a478725b6dd94a966e0d92c07.tar.gz
semanticscuttle-2756e3f85818346a478725b6dd94a966e0d92c07.tar.bz2
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
-rw-r--r--api/httpauth.inc.php1
-rw-r--r--bookmarks.php4
-rw-r--r--header.inc.php2
-rw-r--r--includes/php-gettext/streams.php3
-rw-r--r--login.php4
-rw-r--r--password.php2
-rw-r--r--populartags.php2
-rw-r--r--register.php2
-rw-r--r--search.inc.php13
-rw-r--r--services/bookmark2tagservice.php9
-rw-r--r--services/bookmarkservice.php5
-rw-r--r--services/tag2tagservice.php2
-rw-r--r--services/userservice.php2
-rw-r--r--tag2tagadd.php4
-rw-r--r--templates/bookmarks.tpl.php13
-rw-r--r--templates/sidebar.block.linked.php9
-rw-r--r--templates/sidebar.block.menu.php7
-rw-r--r--templates/sidebar.block.recent.php3
-rw-r--r--templates/sidebar.linkedtags.inc.php4
-rw-r--r--templates/toolbar.inc.php2
-rw-r--r--templates/top.inc.php10
21 files changed, 73 insertions, 30 deletions
diff --git a/api/httpauth.inc.php b/api/httpauth.inc.php
index f693d35..d0198fd 100644
--- a/api/httpauth.inc.php
+++ b/api/httpauth.inc.php
@@ -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']))
diff --git a/bookmarks.php b/bookmarks.php
index a97fb05..eca291d 100644
--- a/bookmarks.php
+++ b/bookmarks.php
@@ -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);
diff --git a/header.inc.php b/header.inc.php
index 9d147b0..820b5f9 100644
--- a/header.inc.php
+++ b/header.inc.php
@@ -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;
}
+
?>
diff --git a/includes/php-gettext/streams.php b/includes/php-gettext/streams.php
index d57aac6..4237de1 100644
--- a/includes/php-gettext/streams.php
+++ b/includes/php-gettext/streams.php
@@ -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 {
}
-?> \ No newline at end of file
+?>
diff --git a/login.php b/login.php
index 4d212a9..f09996e 100644
--- a/login.php
+++ b/login.php
@@ -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']));
diff --git a/password.php b/password.php
index b7daa70..1763fd2 100644
--- a/password.php
+++ b/password.php
@@ -24,7 +24,7 @@ $templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$tplVars = array();
// IF SUBMITTED
-if ($_POST['submitted']) {
+if (isset($_POST['submitted'])) {
// NO USERNAME
if (!$_POST['username']) {
diff --git a/populartags.php b/populartags.php
index a51ff68..1b99ca2 100644
--- a/populartags.php
+++ b/populartags.php
@@ -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;
diff --git a/register.php b/register.php
index 9cd6f39..e60a686 100644
--- a/register.php
+++ b/register.php
@@ -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
diff --git a/search.inc.php b/search.inc.php
index 3900535..832a70c 100644
--- a/search.inc.php
+++ b/search.inc.php
@@ -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>
diff --git a/services/bookmark2tagservice.php b/services/bookmark2tagservice.php
index 148ad3a..121ba8d 100644
--- a/services/bookmark2tagservice.php
+++ b/services/bookmark2tagservice.php
@@ -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'];
diff --git a/services/bookmarkservice.php b/services/bookmarkservice.php
index 5339004..2cd42e2 100644
--- a/services/bookmarkservice.php
+++ b/services/bookmarkservice.php
@@ -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) {
diff --git a/services/tag2tagservice.php b/services/tag2tagservice.php
index 8b2b731..bf4f866 100644
--- a/services/tag2tagservice.php
+++ b/services/tag2tagservice.php
@@ -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;
}
diff --git a/services/userservice.php b/services/userservice.php
index 9e3adca..3d2058f 100644
--- a/services/userservice.php
+++ b/services/userservice.php
@@ -127,7 +127,7 @@ class UserService {
if ($id = $this->getCurrentUserId())
$currentuser = $this->getUser($id);
else
- return;
+ return null;
}
return $currentuser;
}
diff --git a/tag2tagadd.php b/tag2tagadd.php
index bc13b16..935cf88 100644
--- a/tag2tagadd.php
+++ b/tag2tagadd.php
@@ -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();
diff --git a/templates/bookmarks.tpl.php b/templates/bookmarks.tpl.php
index 6a778bb..f7cc45b 100644
--- a/templates/bookmarks.tpl.php
+++ b/templates/bookmarks.tpl.php
@@ -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">
diff --git a/templates/sidebar.block.linked.php b/templates/sidebar.block.linked.php
index a39f590..efe75a8 100644
--- a/templates/sidebar.block.linked.php
+++ b/templates/sidebar.block.linked.php
@@ -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) {
diff --git a/templates/sidebar.block.menu.php b/templates/sidebar.block.menu.php
index 0c7087a..578db59 100644
--- a/templates/sidebar.block.menu.php
+++ b/templates/sidebar.block.menu.php
@@ -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');
}
diff --git a/templates/sidebar.block.recent.php b/templates/sidebar.block.recent.php
index e720533..cc04b97 100644
--- a/templates/sidebar.block.recent.php
+++ b/templates/sidebar.block.recent.php
@@ -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;
diff --git a/templates/sidebar.linkedtags.inc.php b/templates/sidebar.linkedtags.inc.php
index 95b420a..555eafc 100644
--- a/templates/sidebar.linkedtags.inc.php
+++ b/templates/sidebar.linkedtags.inc.php
@@ -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);
}
diff --git a/templates/toolbar.inc.php b/templates/toolbar.inc.php
index ab17bc5..593ee0f 100644
--- a/templates/toolbar.inc.php
+++ b/templates/toolbar.inc.php
@@ -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>
diff --git a/templates/top.inc.php b/templates/top.inc.php
index 58eacb5..707af8b 100644
--- a/templates/top.inc.php
+++ b/templates/top.inc.php
@@ -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>';
}
?>