diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 6bfd44c1..beefd79d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -22,6 +22,7 @@ Changelog [S] = Security fix (issues that are related to security) ********************************************* +2016-09-06 [O] Replaced hard-coded number "10000" with constant "FIRST_USER_CAT" (thread ID 78848) {eenemeenemuu} 2016-07-19 [A] Added new options to "sort order of albums" (thread ID 78795) {eenemeenemuu} 2016-05-24 [B] Correct possible failure to get update when curl must be used {ron4mac} 2016-05-24 [C] Set table width to 100% on update.php {eenemeenemuu} diff --git a/bridge/udb_base.inc.php b/bridge/udb_base.inc.php index fd684c6c..3ff1b977 100644 --- a/bridge/udb_base.inc.php +++ b/bridge/udb_base.inc.php @@ -530,7 +530,7 @@ function list_users_query (&$user_count) // This is the way we collect the data without a direct join to the forum's user table // This query determines which users we need to collect usernames of - ie just those which have albums with pics // and are on the page we are looking at - $sql = "SELECT category - 10000 AS user_id " + $sql = "SELECT category - ".FIRST_USER_CAT." AS user_id " . "FROM {$CONFIG['TABLE_ALBUMS']} AS a " . "INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.aid = a.aid " . "WHERE ((ISNULL(approved) OR approved='YES') " diff --git a/catmgr.php b/catmgr.php index c9b1981c..6ee9fa0b 100644 --- a/catmgr.php +++ b/catmgr.php @@ -609,7 +609,7 @@ function verify_children($parent, $cid) $description = $superCage->post->getEscaped('description'); - cpg_db_query("INSERT INTO {$CONFIG['TABLE_CATEGORIES']} (pos, parent, name, description) VALUES (10000, $parent, '$name', '$description')"); + cpg_db_query("INSERT INTO {$CONFIG['TABLE_CATEGORIES']} (pos, parent, name, description) VALUES (".FIRST_USER_CAT.", $parent, '$name', '$description')"); //insert in categorymap $cid = cpg_db_last_insert_id(); diff --git a/include/functions.inc.php b/include/functions.inc.php index 949b637e..b238d545 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -3202,17 +3202,17 @@ function cpg_get_system_thumb_list($search_folder = 'images/') * @return array **/ -function& cpg_get_system_thumb($filename, $user = 10001) +function& cpg_get_system_thumb($filename, $user = FIRST_USER_CAT) { global $CONFIG; // Correct user_id - if ($user < 10000) { - $user += 10000; + if ($user < FIRST_USER_CAT) { + $user += FIRST_USER_CAT; } - if ($user == 10000) { - $user = 10001; + if ($user == FIRST_USER_CAT) { + $user = FIRST_USER_CAT + 1; } // Get image data for thumb diff --git a/index.php b/index.php index 82237626..278e439d 100644 --- a/index.php +++ b/index.php @@ -939,7 +939,7 @@ function list_cat_albums($cat, $catdata) return ''; } - $cat_owner_id = ($cat > 10000)?(10000 - $cat):(10001); + $cat_owner_id = ($cat > FIRST_USER_CAT)?(FIRST_USER_CAT - $cat):(FIRST_USER_CAT + 1); $cpg_nopic_data = cpg_get_system_thumb('nopic.jpg', $cat_owner_id); $cpg_privatepic_data = cpg_get_system_thumb('private.jpg', $cat_owner_id); diff --git a/sidebar.php b/sidebar.php index 14d73edd..4a62af36 100644 --- a/sidebar.php +++ b/sidebar.php @@ -315,7 +315,7 @@ function get_tree_album_data($category,$dtree_parent) { $pic_filter = ' '.str_replace('p.',$CONFIG['TABLE_PICTURES'].'.',$FORBIDDEN_SET); } if ($category == USER_GAL_CAT) { - $sql = "SELECT DISTINCT user_id, user_name FROM {$CONFIG['TABLE_USERS']}, {$CONFIG['TABLE_ALBUMS']} WHERE 10000 + {$CONFIG['TABLE_USERS']}.user_id = {$CONFIG['TABLE_ALBUMS']}.category ORDER BY user_name ASC"; + $sql = "SELECT DISTINCT user_id, user_name FROM {$CONFIG['TABLE_USERS']}, {$CONFIG['TABLE_ALBUMS']} WHERE ".FIRST_USER_CAT." + {$CONFIG['TABLE_USERS']}.user_id = {$CONFIG['TABLE_ALBUMS']}.category ORDER BY user_name ASC"; $result = cpg_db_query($sql); if (($cat_count = $result->numRows()) > 0) { $rowset = cpg_db_fetch_rowset($result); diff --git a/update.php b/update.php index 137adec0..30364ce4 100644 --- a/update.php +++ b/update.php @@ -484,6 +484,7 @@ function update_tables() $sql_query = fread(fopen($db_update, 'r'), filesize($db_update)); // Update table prefix $sql_query = preg_replace('/CPG_/', $CONFIG['TABLE_PREFIX'], $sql_query); + //$sql_query = str_replace('{FIRST_USER_CAT}', FIRST_USER_CAT, $sql_query); $sql_query = remove_remarks($sql_query); $sql_query = split_sql_file($sql_query, ';');