]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
remove php4-style object reference passing
authorChristian Weiske <cweiske@cweiske.de>
Sun, 17 Mar 2013 21:22:16 +0000 (22:22 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Sun, 17 Mar 2013 21:22:16 +0000 (22:22 +0100)
13 files changed:
src/SemanticScuttle/Service/Bookmark.php
src/SemanticScuttle/Service/Bookmark2Tag.php
src/SemanticScuttle/Service/CommonDescription.php
src/SemanticScuttle/Service/SearchHistory.php
src/SemanticScuttle/Service/Tag.php
src/SemanticScuttle/Service/Tag2Tag.php
src/SemanticScuttle/Service/TagCache.php
src/SemanticScuttle/Service/TagStat.php
src/SemanticScuttle/Service/User.php
src/SemanticScuttle/functions.php
tests/Api/ExportCsvTest.php
tests/Api/OpenSearchTest.php
tests/TestBase.php

index 17ab7badcbd1df8dc56d9c9e6274a1f64006c00d..faeecc2bf086a6a1a9a0b252454a4457f04beb5c 100644 (file)
@@ -90,7 +90,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
             . ' "' . $this->db->sql_escape($value) .'"'
             . $range;
 
-        if (!($dbresult = $this->db->sql_query_limit($query, 1, 0))) {
+        if (!($dbresult = $this->db->sql_query_limit($query, 1, 0))) {
             message_die(
                 GENERAL_ERROR,
                 'Could not get bookmark', '', __LINE__, __FILE__,
@@ -148,7 +148,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
             . $query_2
             .' WHERE B.bId = '. $this->db->sql_escape($bid);
 
-        if (!($dbresult = $this->db->sql_query($sql))) {
+        if (!($dbresult = $this->db->sql_query($sql))) {
             message_die(
                 GENERAL_ERROR, 'Could not get bookmark',
                 '', __LINE__, __FILE__, $sql, $this->db
@@ -630,7 +630,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
             . ' WHERE bId = ' . intval($bId);
         $this->db->sql_transaction('begin');
 
-        if (!($dbresult = $this->db->sql_query($sql))) {
+        if (!($dbresult = $this->db->sql_query($sql))) {
             $this->db->sql_transaction('rollback');
             message_die(
                 GENERAL_ERROR, 'Could not update bookmark',
index 3e5c533ec56dc0830faf6be280171545ffd556f8..6505a5aa7f3ced75382acff283d5d6f60b30f3fb 100644 (file)
@@ -200,7 +200,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
 
             $sql = 'INSERT INTO '. $this->getTableName()
                 . ' ' . $this->db->sql_build_array('INSERT', $values);
-            if (!($dbresult =& $this->db->sql_query($sql))) {
+            if (!($dbresult = $this->db->sql_query($sql))) {
                 $this->db->sql_transaction('rollback');
                 message_die(
                     GENERAL_ERROR, 'Could not attach tags',
@@ -222,7 +222,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
         $query.= ' AND '. $bs->getTableName() .'.uId = '. $uId;
         $query.= ' AND '. $this->getTableName() .'.tag = "'. $this->db->sql_escape($tag) .'"';
 
-        if (!($dbresult =& $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not delete tags', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -238,7 +238,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
 
         $query = 'DELETE FROM '. $this->getTableName() .' WHERE bId = '. intval($bookmarkid);
 
-        if (!($dbresult =& $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not delete tags', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -258,7 +258,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
         $GLOBALS['tableprefix'].'bookmarks',
         $uId);
 
-        if (!($dbresult =& $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not delete tags', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -370,7 +370,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
 
         $query .= ' WHERE '. $this->db->sql_build_array('SELECT', $conditions) .' AND LEFT(T.tag, 7) <> "system:" GROUP BY T.tag ORDER BY bCount DESC, tag';
 
-        if (!($dbresult =& $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not get tags', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -418,7 +418,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
         $query_5 = ' AND LEFT(T0.tag, 7) <> "system:" GROUP BY T0.tag ORDER BY bCount DESC, T0.tag';
         $query = $query_1 . $query_2 . $query_3 . $query_4 . $query_5;
 
-        if (! ($dbresult =& $this->db->sql_query_limit($query, $limit)) ){
+        if (! ($dbresult = $this->db->sql_query_limit($query, $limit)) ){
             message_die(GENERAL_ERROR, 'Could not get related tags', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -448,7 +448,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
 
         $query = 'SELECT T.tag, COUNT(T.tag) AS bCount FROM '.$GLOBALS['tableprefix'].'bookmarks AS B LEFT JOIN '.$GLOBALS['tableprefix'].'bookmarks2tags AS T ON B.bId = T.bId WHERE B.bHash = \''. $this->db->sql_escape($hash) .'\' '. $privacy .'AND LEFT(T.tag, 7) <> "system:" GROUP BY T.tag ORDER BY bCount DESC';
 
-        if (!($dbresult =& $this->db->sql_query_limit($query, $limit))) {
+        if (!($dbresult = $this->db->sql_query_limit($query, $limit))) {
             message_die(GENERAL_ERROR, 'Could not get related tags for this hash', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -622,12 +622,12 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
     function hasTag($bookmarkid, $tag) {
         $query = 'SELECT COUNT(*) AS tCount FROM '. $this->getTableName() .' WHERE bId = '. intval($bookmarkid) .' AND tag ="'. $this->db->sql_escape($tag) .'"';
 
-        if (! ($dbresult =& $this->db->sql_query($query)) ) {
+        if (! ($dbresult = $this->db->sql_query($query)) ) {
             message_die(GENERAL_ERROR, 'Could not find tag', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
 
-        if ($row =& $this->db->sql_fetchrow($dbresult)) {
+        if ($row = $this->db->sql_fetchrow($dbresult)) {
             if ($row['tCount'] > 0) {
                 $output = true;
             }
@@ -645,8 +645,8 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
         return false;
 
         // Find bookmarks with old tag
-        $bookmarksInfo =& $bookmarkservice->getBookmarks(0, NULL, $userid, $old);
-        $bookmarks =& $bookmarksInfo['bookmarks'];
+        $bookmarksInfo = $bookmarkservice->getBookmarks(0, NULL, $userid, $old);
+        $bookmarks = $bookmarksInfo['bookmarks'];
 
         // Delete old tag
         $this->deleteTag($userid, $old);
@@ -655,7 +655,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
         $new = $tagservice->normalize($new);
 
         foreach(array_keys($bookmarks) as $key) {
-            $row =& $bookmarks[$key];
+            $row = $bookmarks[$key];
             $this->attachTags($row['bId'], $new, $fromApi, NULL, false);
         }
 
index 0fffd32eee336d3dfe3b242bccbcd7d9089b1adc..d03b34a7147463fcc84f776d940c4566994fb20b 100644 (file)
@@ -62,7 +62,7 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
         $values = array('tag'=>$tag, 'cdDescription'=>$desc, 'uId'=>$uId, 'cdDatetime'=>$datetime);
         $sql = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
 
-        if (!($dbresult =& $this->db->sql_query($sql))) {
+        if (!($dbresult = $this->db->sql_query($sql))) {
             $this->db->sql_transaction('rollback');
             message_die(GENERAL_ERROR, 'Could not add tag description', '', __LINE__, __FILE__, $sql, $this->db);
             return false;
@@ -79,7 +79,7 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
         $query.= ' WHERE tag=\'' . $this->db->sql_escape($tag) . "'";
         $query.= " ORDER BY cdDatetime DESC";
 
-        if (!($dbresult = $this->db->sql_query_limit($query, 1, 0))) {
+        if (!($dbresult = $this->db->sql_query_limit($query, 1, 0))) {
             message_die(GENERAL_ERROR, 'Could not get tag description', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -99,7 +99,7 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
         $query.= ' WHERE tag=\'' . $this->db->sql_escape($tag) . "'";
         $query.= " ORDER BY cdDatetime DESC";
 
-        if (!($dbresult = $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not get tag descriptions', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -114,12 +114,12 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
         $query.= " FROM `". $this->getTableName() ."`";
         $query.= ' WHERE cdId=\'' . $this->db->sql_escape($cdId) . "'";
 
-        if (!($dbresult = $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not get tag descriptions', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
 
-        if ($row =& $this->db->sql_fetchrow($dbresult)) {
+        if ($row = $this->db->sql_fetchrow($dbresult)) {
             $this->db->sql_freeresult($dbresult);
             return $row;
         } else {
@@ -140,7 +140,7 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
         $values = array('bHash'=>$bHash, 'cdTitle'=>$title, 'cdDescription'=>$desc, 'uId'=>$uId, 'cdDatetime'=>$datetime);
         $sql = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
 
-        if (!($dbresult =& $this->db->sql_query($sql))) {
+        if (!($dbresult = $this->db->sql_query($sql))) {
             $this->db->sql_transaction('rollback');
             message_die(GENERAL_ERROR, 'Could not add bookmark description', '', __LINE__, __FILE__, $sql, $this->db);
             return false;
@@ -154,7 +154,7 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
         $query.= ' WHERE bHash=\'' . $this->db->sql_escape($bHash) . "'";
         $query.= " ORDER BY cdDatetime DESC";
 
-        if (!($dbresult = $this->db->sql_query_limit($query, 1, 0))) {
+        if (!($dbresult = $this->db->sql_query_limit($query, 1, 0))) {
             message_die(GENERAL_ERROR, 'Could not get bookmark description', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -174,7 +174,7 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
         $query.= ' WHERE bHash=\'' . $this->db->sql_escape($bHash) . "'";
         $query.= " ORDER BY cdDatetime DESC";
 
-        if (!($dbresult = $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not get bookmark descriptions', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -188,7 +188,7 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic
         $query = 'DELETE FROM '. $this->getTableName() . ' WHERE uId = '. intval($uId);
 
         $this->db->sql_transaction('begin');
-        if (!($dbresult = $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             $this->db->sql_transaction('rollback');
             message_die(GENERAL_ERROR, 'Could not delete user descriptions', '',
             __LINE__, __FILE__, $query, $this->db);
index a056ce2ff72f109f23ac80776f9ff9c709ac1428..ac0b1c785b238c892a9012c4e18f51084cef6b79 100644 (file)
@@ -198,7 +198,7 @@ class SemanticScuttle_Service_SearchHistory extends SemanticScuttle_DbService
     {
         $sql = 'SELECT COUNT(*) AS `total` FROM '. $this->getTableName();
         if (!($dbresult = $this->db->sql_query($sql))
-            || (!($row = & $this->db->sql_fetchrow($dbresult)))
+            || (!($row =  $this->db->sql_fetchrow($dbresult)))
         ) {
             message_die(
                 GENERAL_ERROR, 'Could not get total searches',
index 2476608c3ddca9ecefa13f1a85cf3569aaaefac5..39147b85dd1761bd2ae7efaaa250a816034282dd 100644 (file)
@@ -54,7 +54,7 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
         $query.= ' WHERE tag = \''. $this->db->sql_escape($tag) . "'";
         $query.= ' AND uId = ' . intval($uId);
 
-        if (!($dbresult = $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not get tag description', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -74,7 +74,7 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
         $query.= ' WHERE tag = \'' . $this->db->sql_escape($tag) . "'";
         $query.= ' AND uId = "' . intval($uId) . '"';
 
-        if (!($dbresult = $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not get tag description', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -93,7 +93,7 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
         $query.= ' FROM '.$this->getTableName();
         $query.= ' WHERE tag = \''. $this->db->sql_escape($tag) . "'";
 
-        if (!($dbresult = $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not get tag description', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -114,7 +114,7 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
         }
 
         $this->db->sql_transaction('begin');
-        if (!($dbresult = $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             $this->db->sql_transaction('rollback');
             message_die(GENERAL_ERROR, 'Could not delete bookmarks', '', __LINE__, __FILE__, $query, $this->db);
             return false;
index 33d211bd56621e8f816ff885252bd9429cdeee96..9dddc44aca78af3dfb22e4e9b2c68233ab4a8821 100644 (file)
@@ -43,9 +43,9 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
     }
 
 
-    function __construct(&$db)
+    function __construct($db)
     {
-        $this->db =$db;
+        $this->db =$db;
         $this->tablename = $GLOBALS['tableprefix'] .'tags2tags';
     }
 
@@ -173,7 +173,7 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
             $query.= " AND uId = '".intval($uId)."'";
         }
         //die($query);
-        if (! ($dbresult =& $this->db->sql_query($query)) ){
+        if (! ($dbresult = $this->db->sql_query($query)) ){
             message_die(GENERAL_ERROR, 'Could not get related tags', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -312,7 +312,7 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
             $query.= " LIMIT 0," . intval($limit);
         }
 
-        if (! ($dbresult =& $this->db->sql_query($query)) ){
+        if (! ($dbresult = $this->db->sql_query($query)) ){
             message_die(GENERAL_ERROR, 'Could not get linked tags', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -337,7 +337,7 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
             $query.= " ORDER BY count DESC";
             $query.= " LIMIT 0, " . intval($GLOBALS['maxSizeMenuBlock']);
 
-            if (! ($dbresult =& $this->db->sql_query($query)) ){
+            if (! ($dbresult = $this->db->sql_query($query)) ){
                 message_die(GENERAL_ERROR, 'Could not get linked tags', '', __LINE__, __FILE__, $query, $this->db);
                 return false;
             }
@@ -393,7 +393,7 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
         $query.= strlen($relationType)>0 ? ' AND relationType = \''. $this->db->sql_escape($relationType) . "'" : '';
         $query.= strlen($uId)>0 ? ' AND uId = '. intval($uId) : '';
 
-        if (!($dbresult =& $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not remove tag relation', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -410,7 +410,7 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService
         $query = 'DELETE FROM '. $this->getTableName();
         $query.= ' WHERE uId = '. intval($uId);
 
-        if (!($dbresult =& $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not remove tag relation', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
index b0ddfa6f31a9708d5979e20b7576f197966a939a..0fdb986a1f05829ef44ec5ee01dd4d45e0f7f367 100644 (file)
@@ -72,7 +72,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
         $query.= " AND uId = " . intval($uId);
 
         //die($query);
-        if (! ($dbresult =& $this->db->sql_query($query)) ){
+        if (! ($dbresult = $this->db->sql_query($query)) ){
             message_die(GENERAL_ERROR, 'Could not get related tags', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -101,7 +101,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
         $values = array('tag1' => $tag1, 'tag2' => $tag2, 'relationType'=> '>', 'uId'=> $uId);
         $query = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
         //die($query);
-        if (!($dbresult =& $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             $this->db->sql_transaction('rollback');
             message_die(GENERAL_ERROR, 'Could not add tag cache inference', '', __LINE__, __FILE__, $query, $this->db);
             return false;
@@ -122,7 +122,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
         $query.= ' AND relationType = ">"';
         $query.= strlen($uId)>0 ? ' AND uId = ' . intval($uId) : '';
 
-        if (!($dbresult =& $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not remove tag cache inference', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -215,7 +215,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
                 $values = array('tag1' => $tag1, 'tag2' => $tag2, 'relationType'=> '=', 'uId'=> $uId);
                 $query = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
                 //die($query);
-                if (!($dbresult =& $this->db->sql_query($query))) {
+                if (!($dbresult = $this->db->sql_query($query))) {
                     $this->db->sql_transaction('rollback');
                     message_die(GENERAL_ERROR, 'Could not add tag cache synonymy', '', __LINE__, __FILE__, $query, $this->db);
                     return false;
@@ -232,7 +232,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
         $query.= ' AND relationType = "="';
         $query.= ' AND uId = ' . intval($uId);
 
-        if (!($dbresult =& $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not remove tag cache inference', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -295,7 +295,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
         $query.= " AND uId = " . intval($uId);
 
         //die($query);
-        if (! ($dbresult =& $this->db->sql_query($query)) ){
+        if (! ($dbresult = $this->db->sql_query($query)) ){
             message_die(GENERAL_ERROR, 'Could not get related tags', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -323,7 +323,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
         $query.= " AND uId = " . intval($uId);
         $query.= $tagExcepted!=''?" AND tag2!='" . $this->db->sql_escape($tagExcepted) . "'" : '';
 
-        if (! ($dbresult =& $this->db->sql_query($query)) ){
+        if (! ($dbresult = $this->db->sql_query($query)) ){
             message_die(GENERAL_ERROR, 'Could not get related tags', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -371,7 +371,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService
     function deleteByUser($uId) {
         $query = 'DELETE FROM '. $this->getTableName() .' WHERE uId = '. intval($uId);
 
-        if (!($dbresult = & $this->db->sql_query($query))) {
+        if (!($dbresult =  $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not delete user tags cache', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
index 23ebbc990d13753b8c14c7629c0c182e1fb9de5e..af8d1107758c36e003d138c78dde63904f51ded5 100644 (file)
@@ -67,7 +67,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
         $query.= " AND relationType = '". $relationType ."'";
         $query.= " AND uId = '".$uId."'";
 
-        $dbresults =& $this->db->sql_query($query);
+        $dbresults = $this->db->sql_query($query);
         $row = $this->db->sql_fetchrow($dbresults);
         $this->db->sql_freeresult($dbresults);
         if($row['nb'] == null) {
@@ -83,7 +83,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
         $query.= " AND relationType = '". $relationType ."'";
         $query.= " AND uId = '".$uId."'";
 
-        $dbresults =& $this->db->sql_query($query);
+        $dbresults = $this->db->sql_query($query);
         $row = $this->db->sql_fetchrow($dbresults);
         $this->db->sql_freeresult($dbresults);
         if($row['depth'] == null) {
@@ -99,7 +99,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
         $query.= " AND relationType = '". $relationType ."'";
         $query.= " AND uId = '".$uId."'";
 
-        $dbresults =& $this->db->sql_query($query);
+        $dbresults = $this->db->sql_query($query);
         $row = $this->db->sql_fetchrow($dbresults);
         $this->db->sql_freeresult($dbresults);
         if($row['nbupdate'] == null) {
@@ -161,7 +161,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
 
         //die($query);
 
-        if (! ($dbresult =& $this->db->sql_query($query)) ){
+        if (! ($dbresult = $this->db->sql_query($query)) ){
             message_die(GENERAL_ERROR, 'Could not update stats', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -215,7 +215,7 @@ class SemanticScuttle_Service_TagStat extends SemanticScuttle_DbService
     function deleteTagStatForUser($uId) {
         $query = 'DELETE FROM '. $this->getTableName() .' WHERE uId = '.        intval($uId);
 
-        if (!($dbresult = $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not delete tag stats', '', __LINE__,
             __FILE__, $query, $this->db);
             return false;
index 7550ed22404c4c3636af1766966719ba2034a2e6..434e6b7c81dfaa5b868c645a2c2fe841763448ea 100644 (file)
@@ -120,12 +120,12 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
         if($nb>0) {
             $query .= ' LIMIT 0, '.$nb;
         }
-        if (! ($dbresult =& $this->db->sql_query($query)) ) {
+        if (! ($dbresult = $this->db->sql_query($query)) ) {
             message_die(GENERAL_ERROR, 'Could not get user', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
 
-        while ($row = $this->db->sql_fetchrow($dbresult)) {
+        while ($row = $this->db->sql_fetchrow($dbresult)) {
             $users[] = $row;
         }
         $this->db->sql_freeresult($dbresult);
@@ -149,7 +149,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
             $query .= ' LIMIT 0, ' . intval($nb);
         }
 
-        if (! ($dbresult =& $this->db->sql_query($query)) ) {
+        if (! ($dbresult = $this->db->sql_query($query)) ) {
             message_die(
                 GENERAL_ERROR, 'Could not get user',
                 '', __LINE__, __FILE__, $query, $this->db
@@ -158,7 +158,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
         }
 
         $users = array();
-        while ($row = $this->db->sql_fetchrow($dbresult)) {
+        while ($row = $this->db->sql_fetchrow($dbresult)) {
             $users[] = new SemanticScuttle_Model_User(
                 $row[$this->getFieldName('primary')],
                 $row[$this->getFieldName('username')]
@@ -434,7 +434,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
                      ')) = \''.$this->db->sql_escape($cook[1]).'\' AND '.
             $this->getFieldName('primary'). ' = '. $this->db->sql_escape($cook[0]);
 
-            if (! ($dbresult =& $this->db->sql_query($query)) ) {
+            if (! ($dbresult = $this->db->sql_query($query)) ) {
                 message_die(
                     GENERAL_ERROR, 'Could not get user',
                     '', __LINE__, __FILE__, $query, $this->db
@@ -596,7 +596,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
         // Gets the list of user IDs being watched by the given user.
         $query = 'SELECT watched FROM '. $GLOBALS['tableprefix'] .'watched WHERE uId = '. intval($uId);
 
-        if (! ($dbresult =& $this->db->sql_query($query)) ) {
+        if (! ($dbresult = $this->db->sql_query($query)) ) {
             message_die(GENERAL_ERROR, 'Could not get watchlist', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -606,7 +606,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
             $this->db->sql_freeresult($dbresult);
             return $arrWatch;
         }
-        while ($row =& $this->db->sql_fetchrow($dbresult)) {
+        while ($row = $this->db->sql_fetchrow($dbresult)) {
             $arrWatch[] = $row['watched'];
         }
         $this->db->sql_freeresult($dbresult);
@@ -668,7 +668,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
         // Returns true if the current user is watching the given user, and false otherwise.
         $query = 'SELECT watched FROM '. $GLOBALS['tableprefix'] .'watched AS W INNER JOIN '. $this->getTableName() .' AS U ON U.'. $this->getFieldName('primary') .' = W.watched WHERE U.'. $this->getFieldName('primary') .' = '. intval($watcheduser) .' AND W.uId = '. intval($currentuser);
 
-        if (! ($dbresult =& $this->db->sql_query($query)) ) {
+        if (! ($dbresult = $this->db->sql_query($query)) ) {
             message_die(GENERAL_ERROR, 'Could not get watchstatus', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -690,7 +690,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
 
         if ($watched) {
             $sql = 'DELETE FROM '. $GLOBALS['tableprefix'] .'watched WHERE uId = '. intval($currentUserID) .' AND watched = '. intval($subjectUserID);
-            if (!($dbresult =& $this->db->sql_query($sql))) {
+            if (!($dbresult = $this->db->sql_query($sql))) {
                 $this->db->sql_transaction('rollback');
                 message_die(GENERAL_ERROR, 'Could not add user to watch list', '', __LINE__, __FILE__, $sql, $this->db);
                 return false;
@@ -701,7 +701,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
                 'watched' => intval($subjectUserID)
             );
             $sql = 'INSERT INTO '. $GLOBALS['tableprefix'] .'watched '. $this->db->sql_build_array('INSERT', $values);
-            if (!($dbresult =& $this->db->sql_query($sql))) {
+            if (!($dbresult = $this->db->sql_query($sql))) {
                 $this->db->sql_transaction('rollback');
                 message_die(GENERAL_ERROR, 'Could not add user to watch list', '', __LINE__, __FILE__, $sql, $this->db);
                 return false;
@@ -743,7 +743,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
 
         // Execute the statement.
         $this->db->sql_transaction('begin');
-        if (!($dbresult = $this->db->sql_query($sql))) {
+        if (!($dbresult = $this->db->sql_query($sql))) {
             $this->db->sql_transaction('rollback');
             message_die(
                 GENERAL_ERROR, 'Could not insert user',
@@ -826,7 +826,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
 
         // Execute the statement.
         $this->db->sql_transaction('begin');
-        if (!($dbresult = $this->db->sql_query($sql))) {
+        if (!($dbresult = $this->db->sql_query($sql))) {
             $this->db->sql_transaction('rollback');
             message_die(
                 GENERAL_ERROR, 'Could not update user', '',
@@ -845,7 +845,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
     function getAllUsers ( ) {
         $query = 'SELECT * FROM '. $this->getTableName();
 
-        if (! ($dbresult =& $this->db->sql_query($query)) ) {
+        if (! ($dbresult = $this->db->sql_query($query)) ) {
             message_die(GENERAL_ERROR, 'Could not get users', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
@@ -872,7 +872,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
     function deleteUser($uId) {
         $query = 'DELETE FROM '. $this->getTableName() .' WHERE uId = '. intval($uId);
 
-        if (!($dbresult = $this->db->sql_query($query))) {
+        if (!($dbresult = $this->db->sql_query($query))) {
             message_die(GENERAL_ERROR, 'Could not delete user', '', __LINE__, __FILE__, $query, $this->db);
             return false;
         }
index 09f7cf32445e8eedbfbc92eff1f1717b4cb9c577..802a7f1ad67ff45cd5957f9f8e8fe865d2db7a44 100644 (file)
@@ -276,4 +276,17 @@ function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '',
        echo "<html>\n<body>\n". $msg_title ."\n<br /><br />\n". $msg_text ."</body>\n</html>";
        exit;
 }
+
+/**
+ * Calls reset() on the given arg, without the E_STRICT error
+ * "Only variables should be passed by reference"
+ *
+ * @param array $arg Array to return first element of
+ *
+ * @return mixed First element of the array
+ */
+function rreset($array)
+{
+    return reset($array);
+}
 ?>
index 681f0de6154923383895c3654c54632407daa791..a0a9eae9d1d92a1149f7875b4ff7bcf477d9645f 100644 (file)
@@ -64,7 +64,7 @@ class Api_ExportCsvTest extends TestBaseApi
      */
     public function testMimeTypeFilename()
     {
-        $res = reset($this->getAuthRequest())->send();
+        $res = rreset($this->getAuthRequest())->send();
 
         $this->assertEquals(200, $res->getStatus());
         //verify MIME content type
@@ -253,7 +253,7 @@ class Api_ExportCsvTest extends TestBaseApi
                 $ar[] = $arl;
             }
         }
-        if (count(end($ar)) == 1 && reset(end($ar)) == '') {
+        if (count(end($ar)) == 1 && rreset(end($ar)) == '') {
             unset($ar[key($ar)]);
         }
         return $ar;
index f438b468ed4493483d6b4bb0adcc8723424c4f44..09166da7de98ad5cb36515ccb6b81c63213a516b 100644 (file)
@@ -12,7 +12,7 @@ class Api_OpenSearchTest extends TestBaseApi
         $xhtml = $req->send()->getBody();
 
         $xml = simplexml_load_string($xhtml);
-        $xml->registerXPathNamespace('h', reset($xml->getDocNamespaces()));
+        $xml->registerXPathNamespace('h', rreset($xml->getDocNamespaces()));
 
         $this->assertInstanceOf(
             'SimpleXMLElement', $xml,
@@ -58,7 +58,7 @@ class Api_OpenSearchTest extends TestBaseApi
     {
         $xml = $this->getRequest('api/opensearch.php')->send()->getBody();
         $x = simplexml_load_string($xml);
-        $x->registerXPathNamespace('os', reset($x->getDocNamespaces()));
+        $x->registerXPathNamespace('os', rreset($x->getDocNamespaces()));
 
         $arElements = $x->xpath('//os:Url[@type="text/html"]');
         $this->assertEquals(
index 2914749a6357a38c24750e2694b69651ba378f6f..4bffd1b17d39f2db78dcca4ec0de7bd10b0cc9a4 100644 (file)
@@ -87,7 +87,7 @@ class TestBase extends PHPUnit_Framework_TestCase
     protected function addUser(
         $username = null, $password = null, $privateKey = null
     ) {
-        return reset($this->addUserData($username, $password, $privateKey));
+        return rreset($this->addUserData($username, $password, $privateKey));
     }