Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove & reference declaration from db_query to avoid warning #870

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/db/mysqli.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function serendipity_db_in_sql($col, &$search_ids, $type = ' OR ') {
* @param boolean If true, the executed SQL error is known to fail, and should be disregarded (errors can be ignored on DUPLICATE INDEX queries and the likes)
* @return mixed Returns the result of the SQL query, depending on the input parameters
*/
function &serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = false, $assocKey = false, $assocVal = false, $expectError = false) {
function serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = false, $assocKey = false, $assocVal = false, $expectError = false) {
global $serendipity;
$type_map = array('assoc' => MYSQLI_ASSOC, 'num' => MYSQLI_NUM, 'both' => MYSQLI_BOTH, 'true' => true, 'false' => false);

Expand Down
2 changes: 1 addition & 1 deletion include/db/pdo-postgres.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function serendipity_db_insert_id($table = '', $id = '') {
* @param boolean If true, the executed SQL error is known to fail, and should be disregarded (errors can be ignroed on DUPLICATE INDEX queries and the likes)
* @return mixed Returns the result of the SQL query, depending on the input parameters
*/
function &serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = false, $assocKey = false, $assocVal = false, $expectError = false) {
function serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = false, $assocKey = false, $assocVal = false, $expectError = false) {
global $serendipity;
$type_map = array(
'assoc' => PDO::FETCH_ASSOC,
Expand Down
2 changes: 1 addition & 1 deletion include/db/pdo-sqlite.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ function serendipity_db_insert_id($table = '', $id = '') {
* @param boolean If true, the executed SQL error is known to fail, and should be disregarded (errors can be ignroed on DUPLICATE INDEX queries and the likes)
* @return mixed Returns the result of the SQL query, depending on the input parameters
*/
function &serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = false, $assocKey = false, $assocVal = false, $expectError = false) {
function serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = false, $assocKey = false, $assocVal = false, $expectError = false) {
global $serendipity;
$type_map = array(
'assoc' => PDO::FETCH_ASSOC,
Expand Down
2 changes: 1 addition & 1 deletion include/db/postgres.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function serendipity_db_insert_id($table = '', $id = '') {
* @param boolean If true, the executed SQL error is known to fail, and should be disregarded (errors can be ignroed on DUPLICATE INDEX queries and the likes)
* @return mixed Returns the result of the SQL query, depending on the input parameters
*/
function &serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = false, $assocKey = false, $assocVal = false, $expectError = false) {
function serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = false, $assocKey = false, $assocVal = false, $expectError = false) {
global $serendipity;
$type_map = array(
'assoc' => PGSQL_ASSOC,
Expand Down
2 changes: 1 addition & 1 deletion include/db/sqlite.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function serendipity_db_in_sql($col, &$search_ids, $type = ' OR ') {
* @param boolean If true, the executed SQL error is known to fail, and should be disregarded (errors can be ignored on DUPLICATE INDEX queries and the likes)
* @return mixed Returns the result of the SQL query, depending on the input parameters
*/
function &serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = true, $assocKey = false, $assocVal = false, $expectError = false)
function serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = true, $assocKey = false, $assocVal = false, $expectError = false)
{
global $serendipity;
$type_map = array(
Expand Down
2 changes: 1 addition & 1 deletion include/db/sqlite3.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function serendipity_db_in_sql($col, &$search_ids, $type = ' OR ') {
* @param boolean If true, the executed SQL error is known to fail, and should be disregarded (errors can be ignroed on DUPLICATE INDEX queries and the likes)
* @return mixed Returns the result of the SQL query, depending on the input parameters
*/
function &serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = true, $assocKey = false, $assocVal = false, $expectError = false)
function serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = true, $assocKey = false, $assocVal = false, $expectError = false)
{
global $serendipity;
$type_map = array(
Expand Down
2 changes: 1 addition & 1 deletion include/db/sqlite3oo.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function serendipity_db_in_sql($col, &$search_ids, $type = ' OR ') {
* @param boolean If true, the executed SQL error is known to fail, and should be disregarded (errors can be ignroed on DUPLICATE INDEX queries and the likes)
* @return mixed Returns the result of the SQL query, depending on the input parameters
*/
function &serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = true, $assocKey = false, $assocVal = false, $expectError = false)
function serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = true, $assocKey = false, $assocVal = false, $expectError = false)
{
global $serendipity;
$type_map = array(
Expand Down
2 changes: 1 addition & 1 deletion include/db/sqlrelay.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function generate_resultset($cursor, $result_type = 'sqlr_BOTH') {
return $return_row;
}

function &serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = false, $assocKey = false, $assocVal = false, $expectError = false) {
function serendipity_db_query($sql, $single = false, $result_type = "both", $reportErr = false, $assocKey = false, $assocVal = false, $expectError = false) {
global $serendipity;
$type_map = array(
'assoc' => sqlr_ASSOC,
Expand Down
26 changes: 13 additions & 13 deletions include/functions_config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,12 @@ function serendipity_load_configuration($author = null) {

if (!empty($author)) {
// Replace default configuration directives with user-relevant data
$rows =& serendipity_db_query("SELECT name,value
$rows = serendipity_db_query("SELECT name,value
FROM {$serendipity['dbPrefix']}config
WHERE authorid = '". (int)$author ."'");
} else {
// Only get default variables, user-independent (frontend)
$rows =& serendipity_db_query("SELECT name, value
$rows = serendipity_db_query("SELECT name, value
FROM {$serendipity['dbPrefix']}config
WHERE authorid = 0");
}
Expand Down Expand Up @@ -550,7 +550,7 @@ function serendipity_authenticate_author($username = '', $password = '', $is_has
username = '" . serendipity_db_escape_string($username) . "'";
if ($debug) fwrite($fp, date('Y-m-d H:i') . ' - Login check (' . serialize($is_hashed) . ', ' . $_SESSION['serendipityPassword'] . '):' . $query . "\n");

$rows =& serendipity_db_query($query, false, 'assoc');
$rows = serendipity_db_query($query, false, 'assoc');
if (is_array($rows)) {
$is_valid_user = false;
foreach($rows AS $row) {
Expand Down Expand Up @@ -1117,7 +1117,7 @@ function &serendipity_getPermissions($authorid) {
global $serendipity;

// Get group information
$groups =& serendipity_db_query("SELECT ag.groupid, g.name, gc.property, gc.value
$groups = serendipity_db_query("SELECT ag.groupid, g.name, gc.property, gc.value
FROM {$serendipity['dbPrefix']}authorgroups AS ag
LEFT OUTER JOIN {$serendipity['dbPrefix']}groups AS g
ON ag.groupid = g.id
Expand Down Expand Up @@ -1340,7 +1340,7 @@ function &serendipity_getAllGroups($apply_ACL_user = false) {
global $serendipity;

if ($apply_ACL_user) {
$groups =& serendipity_db_query("SELECT g.id AS confkey,
$groups = serendipity_db_query("SELECT g.id AS confkey,
g.name AS confvalue,
g.id AS id,
g.name AS name
Expand All @@ -1350,7 +1350,7 @@ function &serendipity_getAllGroups($apply_ACL_user = false) {
WHERE ag.authorid = " . (int)$apply_ACL_user . "
ORDER BY g.name", false, 'assoc');
} else {
$groups =& serendipity_db_query("SELECT g.id AS confkey,
$groups = serendipity_db_query("SELECT g.id AS confkey,
g.name AS confvalue,
g.id AS id,
g.name AS name
Expand Down Expand Up @@ -1378,7 +1378,7 @@ function &serendipity_fetchGroup($groupid) {
global $serendipity;

$conf = array();
$groups =& serendipity_db_query("SELECT g.id AS confkey,
$groups = serendipity_db_query("SELECT g.id AS confkey,
g.name AS confvalue,
g.id AS id,
g.name AS name,
Expand Down Expand Up @@ -1416,7 +1416,7 @@ function &serendipity_fetchGroup($groupid) {
function &serendipity_getGroups($authorid, $sequence = false) {
global $serendipity;

$_groups =& serendipity_db_query("SELECT g.id AS confkey,
$_groups = serendipity_db_query("SELECT g.id AS confkey,
g.name AS confvalue,
g.id AS id,
g.name AS name
Expand Down Expand Up @@ -1452,7 +1452,7 @@ function &serendipity_getGroups($authorid, $sequence = false) {
function &serendipity_getGroupUsers($groupid) {
global $serendipity;

$groups =& serendipity_db_query("SELECT g.name AS name,
$groups = serendipity_db_query("SELECT g.name AS name,
a.realname AS author,
a.authorid AS id
FROM {$serendipity['dbPrefix']}authorgroups AS ag
Expand Down Expand Up @@ -1523,7 +1523,7 @@ function serendipity_addGroup($name) {
function &serendipity_getDBPermissionNames() {
global $serendipity;

$config =& serendipity_db_query("SELECT property FROM {$serendipity['dbPrefix']}groupconfig GROUP BY property ORDER BY property", false, 'assoc');
$config = serendipity_db_query("SELECT property FROM {$serendipity['dbPrefix']}groupconfig GROUP BY property ORDER BY property", false, 'assoc');

return $config;
}
Expand Down Expand Up @@ -1809,7 +1809,7 @@ function serendipity_ACLGet($artifact_id, $artifact_type, $artifact_mode, $artif
AND artifact_id = '" . (int)$artifact_id . "'
AND artifact_mode = '" . serendipity_db_escape_string($artifact_mode) . "'
AND artifact_index = '" . serendipity_db_escape_string($artifact_index) . "'";
$rows =& serendipity_db_query($sql, false, 'assoc');
$rows = serendipity_db_query($sql, false, 'assoc');

if (!is_array($rows)) {
return false;
Expand Down Expand Up @@ -1870,7 +1870,7 @@ function serendipity_ACLCheck($authorid, $artifact_id, $artifact_type, $artifact
AND ( {$artifact_sql['where']} )
GROUP BY result";

$res =& serendipity_db_query($sql, true, 'assoc');
$res = serendipity_db_query($sql, true, 'assoc');
if (is_array($res) && !empty($res['result'])) {
return true;
}
Expand Down Expand Up @@ -2132,7 +2132,7 @@ function &serendipity_loadThemeOptions(&$template_config, $okey = '', $bc_bool =
$okey = $serendipity['template'];
}

$_template_vars =& serendipity_db_query("SELECT name, value FROM {$serendipity['dbPrefix']}options
$_template_vars = serendipity_db_query("SELECT name, value FROM {$serendipity['dbPrefix']}options
WHERE okey = 't_" . serendipity_db_escape_string($okey) . "'
OR okey = 't_global'", false, 'assoc', false, 'name', 'value');
if (!is_array($_template_vars)) {
Expand Down
24 changes: 12 additions & 12 deletions include/functions_entries.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function serendipity_deleteCategory($category_range, $admin_category) {
function serendipity_fetchCategoryRange($categoryid) {
global $serendipity;

$res =& serendipity_db_query("SELECT category_left, category_right, hide_sub FROM {$serendipity['dbPrefix']}category WHERE categoryid='". (int)$categoryid ."'");
$res = serendipity_db_query("SELECT category_left, category_right, hide_sub FROM {$serendipity['dbPrefix']}category WHERE categoryid='". (int)$categoryid ."'");
if (!is_array($res) || !isset($res[0]['category_left']) || !isset($res[0]['category_right'])) {
$res = array(array('category_left' => 0, 'category_right' => 0));
}
Expand Down Expand Up @@ -103,7 +103,7 @@ function serendipity_fetchCategoryInfo($categoryid, $categoryname = '') {
FROM {$serendipity['dbPrefix']}category AS c
WHERE category_name = '" . serendipity_db_escape_string($categoryname) . "'";

$ret =& serendipity_db_query($query);
$ret = serendipity_db_query($query);
return $ret[0];
} else {
$query = "SELECT
Expand All @@ -117,7 +117,7 @@ function serendipity_fetchCategoryInfo($categoryid, $categoryname = '') {
FROM {$serendipity['dbPrefix']}category AS c
WHERE categoryid = " . (int)$categoryid;

$ret =& serendipity_db_query($query);
$ret = serendipity_db_query($query);
return $ret[0];
}
}
Expand Down Expand Up @@ -145,7 +145,7 @@ function &serendipity_fetchEntryCategories($entryid) {
WHERE ec.entryid = {$entryid}
ORDER BY c.category_name ASC";

$cat =& serendipity_db_query($query,false,'assoc');
$cat = serendipity_db_query($query,false,'assoc');

if (!is_array($cat)) {
$arr = array();
Expand Down Expand Up @@ -487,7 +487,7 @@ function &serendipity_fetchEntries($range = null, $full = true, $limit = '', $fe
return $query;
}

$ret =& serendipity_db_query($query, $fetch_single, 'assoc');
$ret = serendipity_db_query($query, $fetch_single, 'assoc');

if (is_string($ret)) {
die("Query failed: $ret");
Expand Down Expand Up @@ -550,7 +550,7 @@ function serendipity_fetchEntryData(&$ret) {
WHERE " . serendipity_db_in_sql('ec.entryid', $search_ids) . "
ORDER BY c.category_name ASC";

$search_ret =& serendipity_db_query($query, false, 'assoc');
$search_ret = serendipity_db_query($query, false, 'assoc');

if (is_array($search_ret)) {
serendipity_plugin_api::hook_event('multilingual_strip_langs', $search_ret, array('category_name','category_description'));
Expand Down Expand Up @@ -630,7 +630,7 @@ function &serendipity_fetchEntry($key, $val, $full = true, $fetchDrafts = 'false
{$cond['single_orderby']}
LIMIT 1";

$ret =& serendipity_db_query($querystring, true, 'assoc');
$ret = serendipity_db_query($querystring, true, 'assoc');

if (is_array($ret)) {
$ret['categories'] =& serendipity_fetchEntryCategories($ret['id']);
Expand All @@ -657,7 +657,7 @@ function &serendipity_fetchEntryProperties($id) {
$parts = array();
serendipity_plugin_api::hook_event('frontend_entryproperties_query', $parts);

$_properties =& serendipity_db_query("SELECT property, value FROM {$serendipity['dbPrefix']}entryproperties WHERE entryid = " . (int)$id . " " . $parts['and']);
$_properties = serendipity_db_query("SELECT property, value FROM {$serendipity['dbPrefix']}entryproperties WHERE entryid = " . (int)$id . " " . $parts['and']);
if (!is_array($_properties)) {
$properties = array();
} else {
Expand Down Expand Up @@ -767,7 +767,7 @@ function &serendipity_fetchCategories($authorid = null, $name = null, $order = n
$querystring .= "\n ORDER BY $order";
}

$ret =& serendipity_db_query($querystring);
$ret = serendipity_db_query($querystring);
if (is_string($ret)) {
echo "Query failed: $ret";
} else {
Expand Down Expand Up @@ -950,7 +950,7 @@ function &serendipity_searchEntries($term, $limit = '', $searchresults = '') {
ORDER BY {$cond['searchorderby']}
$limit";

$search =& serendipity_db_query($querystring);
$search = serendipity_db_query($querystring);

//Add param searchresults at the top and remove duplicates.
if (is_array($searchresults)) {
Expand Down Expand Up @@ -1059,7 +1059,7 @@ function serendipity_getTotalEntries() {
if ($serendipity['fullCountQuery'] == '') {
return 0;
}
$query =& serendipity_db_query($querystring);
$query = serendipity_db_query($querystring);

if (is_array($query) && isset($query[0])) {
if ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3' || $serendipity['dbType'] == 'pdo-sqlite' || $serendipity['dbType'] == 'sqlite3oo') {
Expand Down Expand Up @@ -1758,7 +1758,7 @@ function serendipity_printArchives() {
. (!empty($serendipity['GET']['viewAuthor']) ? ' AND e.authorid = ' . (int)$serendipity['GET']['viewAuthor'] : '')
. (!empty($cat_sql) ? " GROUP BY e.id, e.timestamp" : '');

$entries =& serendipity_db_query($q, false, 'assoc');
$entries = serendipity_db_query($q, false, 'assoc');

$group = array();
if (is_array($entries)) {
Expand Down