From: Roland Häder Date: Sat, 24 Jul 2010 22:16:13 +0000 (+0000) Subject: Naming convention applied, ext-network menu resorted: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6bb119cb426a2ab3998a5c3dfe250d748f786a1c;p=mailer.git Naming convention applied, ext-network menu resorted: - Naming convention applied on ext-network templates and PHP scripts - From same extension, the menu has been resorted - SQL_NUMROWS() is now cached - Many code cleanups related to SQL_NUMROWS() - TODOs.txt updated --- diff --git a/.gitattributes b/.gitattributes index abe684db01..a2a8673cf4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -457,6 +457,7 @@ inc/modules/admin/what-list_country.php -text svneol=unset#text/plain inc/modules/admin/what-list_doubler.php -text svneol=unset#text/plain inc/modules/admin/what-list_holiday.php -text svneol=unset#text/plain inc/modules/admin/what-list_links.php -text svneol=unset#text/plain +inc/modules/admin/what-list_network_api_translation.php svneol=native#text/plain inc/modules/admin/what-list_network_array_translation.php svneol=native#text/plain inc/modules/admin/what-list_network_params.php -text svneol=unset#text/plain inc/modules/admin/what-list_network_translations.php svneol=native#text/plain @@ -919,6 +920,7 @@ templates/de/html/admin/admin_add_guest_menu.tpl -text svneol=unset#text/plain templates/de/html/admin/admin_add_max.tpl -text svneol=unset#text/plain templates/de/html/admin/admin_add_member_menu.tpl -text svneol=unset#text/plain templates/de/html/admin/admin_add_network.tpl -text svneol=unset#text/plain +templates/de/html/admin/admin_add_network_api_translation.tpl svneol=native#text/plain templates/de/html/admin/admin_add_network_array_translation.tpl svneol=native#text/plain templates/de/html/admin/admin_add_network_params.tpl -text svneol=unset#text/plain templates/de/html/admin/admin_add_network_type.tpl -text svneol=unset#text/plain diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 4156cc1acf..1c2423eb9f 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -60,8 +60,8 @@ ./inc/language/sponsor_de.php:119:// @TODO Rewrite these four constants to one and use sprintf() ./inc/libs/admins_functions.php:432: // @TODO This can be, somehow, rewritten ./inc/libs/beg_functions.php:54: // @TODO Try to rewrite the following unset() -./inc/libs/bonus_functions.php:204: // @TODO Move this HTML to a template -./inc/libs/bonus_functions.php:288: // @TODO This query isn't right, it will only update if the user was for a longer time away! +./inc/libs/bonus_functions.php:201: // @TODO Move this HTML to a template +./inc/libs/bonus_functions.php:285: // @TODO This query isn't right, it will only update if the user was for a longer time away! ./inc/libs/doubler_functions.php:46:// @TODO Lame description ./inc/libs/doubler_functions.php:94: // @TODO Can't this be moved into EL? ./inc/libs/mailid_functions.php:49: // @TODO Rewrite this to a dynamic include or so @@ -117,7 +117,7 @@ ./inc/modules/admin/what-del_email.php:61: // @TODO Unused: cat_id, payment_id ./inc/modules/admin/what-edit_user.php:20: * @TODO Add support for ext-country * ./inc/modules/admin/what-email_stats.php:48:// @TODO Unused at the moment -./inc/modules/admin/what-extensions.php:369: // @TODO Rewrite this to a filter +./inc/modules/admin/what-extensions.php:365: // @TODO Rewrite this to a filter ./inc/modules/admin/what-guest_add.php:131: // @TODO This can be somehow rewritten to a function ./inc/modules/admin/what-guest_add.php:69: // @TODO Cant this be rewritten? ./inc/modules/admin/what-guest_add.php:82: // @TODO This can be somehow rewritten to a function @@ -127,8 +127,8 @@ ./inc/modules/admin/what-list_cats.php:56: // @TODO No longer needed? define('__CATEGORIES_BASE' , '' . $login . ''; ./inc/modules/guest/what-sponsor_reg.php:297: // @TODO Maybe a default referal id? -./inc/modules/guest/what-stats.php:116: // @TODO This can be somehow rewritten +./inc/modules/guest/what-stats.php:102: // @TODO This can be somehow rewritten ./inc/modules/guest/what-stats.php:76:// @TODO This can be rewritten in a dynamic include ./inc/modules/member/what-beg.php:56:// @TODO Can't this be moved into EL? ./inc/modules/member/what-beg.php:65:// @TODO No more needed? define('__BEG_UID_TIMEOUT', createFancyTime(getConfig('beg_userid_timeout'))); ./inc/modules/member/what-bonus.php:57: // @TODO Rewrite this to a filter -./inc/modules/member/what-categories.php:132: // @TODO Rewrite this to use $OUT .= ... +./inc/modules/member/what-categories.php:130: // @TODO Rewrite this to use $OUT .= ... ./inc/modules/member/what-order.php:428: // @TODO Rewrite this to a filter ./inc/modules/member/what-payout.php:196: // @TODO Rewrite this to a filter -./inc/modules/member/what-points.php:55:// @TODO Should we rewrite this to a filter? +./inc/modules/member/what-points.php:57:// @TODO Should we rewrite this to a filter? ./inc/modules/member/what-rallyes.php:91: // @TODO Reactivate this: $content['admin'] = '' . $content['login'] . ''; ./inc/modules/member/what-refback.php:126: // @TODO UNUSED: $refRow['status'] = translateUserStatus($refRow['status']); ./inc/modules/member/what-reflinks.php:54:// @TODO Move this into a filter @@ -181,13 +181,14 @@ ./inc/reset/reset_beg.php:51:// @TODO This should be converted in a daily beg rallye ./inc/reset/reset_birthday.php:91: // @TODO 4 is hard-coded here, should we move it out in config? ./inc/revision-functions.php:153:// @TODO Please describe this function -./inc/template-functions.php:1132: // @TODO This can be easily moved out after the merge from EL branch to this is complete -./inc/template-functions.php:1165: // @TODO Add a little more infos here -./inc/template-functions.php:1453:// @TODO Lame description for this function -./inc/template-functions.php:1472: // @TODO Move this in a filter -./inc/template-functions.php:261: // @TODO Remove this sanity-check if all is fine -./inc/template-functions.php:572:// @TODO $simple/$constants are deprecated -./inc/template-functions.php:599: // @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates +./inc/template-functions.php:1135: // @TODO This can be easily moved out after the merge from EL branch to this is complete +./inc/template-functions.php:1168: // @TODO Add a little more infos here +./inc/template-functions.php:1456:// @TODO Lame description for this function +./inc/template-functions.php:1475: // @TODO Move this in a filter +./inc/template-functions.php:189: * @TODO On some pages this is buggy +./inc/template-functions.php:264: // @TODO Remove this sanity-check if all is fine +./inc/template-functions.php:575:// @TODO $simple/$constants are deprecated +./inc/template-functions.php:602: // @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates ./inc/wrapper-functions.php:127:// @TODO Implement $compress ./inc/wrapper-functions.php:134:// @TODO Implement $decompress ./inc/wrapper-functions.php:455:// @TODO Do some more sanity check here @@ -226,7 +227,9 @@ ./templates/de/html/surfbar/surfbar_frame_textlinks.tpl:5: ### ### DEPRECATION FOLLOWS: ### ### ./inc/modules/admin/admin-inc.php:439:// @DEPRECATED +./inc/modules/admin/what-list_network_array_translation.php:2:// @DEPRECATED ./templates/de/html/admin/admin_add_banner.tpl:1: +./templates/de/html/admin/admin_add_network_array_translation.tpl:1: ./templates/de/html/admin/admin_admin_add.tpl:1: ./templates/de/html/admin/admin_admins_add_acl.tpl:1: ./templates/de/html/admin/admin_admins_add.tpl:1: diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 206c868f5a..00d52cf86c 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -137,9 +137,15 @@ function SQL_NUMROWS ($resource) { $lines = false; // Is the result a valid resource? - if (is_resource($resource)) { + if (isset($GLOBALS['sql_numrows'][$resource])) { + // Use cache + $lines = $GLOBALS['sql_numrows'][intval($resource)]; + } elseif (is_resource($resource)) { // Get the count of rows from database $lines = mysql_num_rows($resource); + + // Remember it in cache + $GLOBALS['sql_numrows'][intval($resource)] = $lines; } else { // No resource given, please fix this debug_report_bug(__FUNCTION__, __LINE__, 'No resource given! result[]=' . gettype($resource) . ',last_sql=' . $GLOBALS['last_sql']); diff --git a/inc/extensions/ext-network.php b/inc/extensions/ext-network.php index 82af41e464..109c4aa421 100644 --- a/inc/extensions/ext-network.php +++ b/inc/extensions/ext-network.php @@ -148,17 +148,17 @@ PRIMARY KEY (`network_translate_id`) ) TYPE={?_TABLE_TYPE?} COMMENT='Translations for array keys, generic data, DO NOT ALTER!'"); // Array-Element translation tables per type/provider - addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_array_translation`'); - addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_array_translation` ( -`network_array_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_api_translation`'); + addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_api_translation` ( +`network_api_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, -`network_array_index` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0, +`network_api_index` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0, `network_index_translation` VARCHAR(100) NOT NULL DEFAULT '', -UNIQUE `provider_type_key` (`network_id`,`network_type_id`,`network_array_index`), +UNIQUE `provider_type_key` (`network_id`,`network_type_id`,`network_api_index`), UNIQUE `provider_type_trans` (`network_id`,`network_type_id`,`network_index_translation`), -PRIMARY KEY (`network_array_id`) -) TYPE={?_TABLE_TYPE?} COMMENT='Translation of API responses'"); +PRIMARY KEY (`network_api_id`) +) TYPE={?_TABLE_TYPE?} COMMENT='Translation of API responses, generic data, DO NOT ALTER!'"); // Data from the webmaster (you!) addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config`'); @@ -2039,9 +2039,9 @@ PRIMARY KEY (`network_reload_id`) addAdminMenuSql('network','list_networks','Auflisten/Verwalten','Experten-Einstellungen! Hier ändern Sie die Einstellungen an den Grunddaten (Stammdaten) des jeweiligen Werbenetzwerks ab. Sie sollten hier generell nichts einstellen und im Forum um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten möchten.',6); addAdminMenuSql('network','list_network_types','Werbearten','Experten-Einstellungen! Hier ändern Sie die Einstellungen zu den Werbearten pro Werbenetzwerken. Sie sollten hier generell nichts einstellen und im Forum um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten möchten.',7); addAdminMenuSql('network','list_network_params','Abfrageparameter','Experten-Einstellungen! Hier stellen Sie die Abfrageparameter (wie sie genannt werden müssen, um das API-Script korrekt aufrufen zu können) ein, pro Werbenetzwerk. Sie sollten hier generell nichts einstellen und im Forum um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten möchten.',8); - addAdminMenuSql('network','list_network_array_translation','Antwort-Array','Experten-Einstellungen! Hier stellen Sie die Zuweisungen der aus der analysierten API-Antwort Array-Elementen zu den Datenspalten ein. Sie sollten hier generell nichts einstellen und im Forum um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten möchten.',9); - addAdminMenuSql('network','list_network_error_codes','Fehlercodes','Experten-Einstellungen! Hier stellen Sie die Fehlercodes ein, die im Falle eines Fehlers pro API-Script kommen können. Sie sollten hier generell nichts einstellen und im Forum um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten möchten.',10); - addAdminMenuSql('network','list_network_translations','Array-Übersetzungen','Experten-Einstellungen! Hier richten Sie Array-Index-Übersetzungen für nicht-fehler API-Antworten ein. Dies sind INTERNE Daten und sollten nur vom Entwicklerteam angepasst werden. Sie sollten hier generell nichts einstellen und im Forum um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten möchten.',11); + addAdminMenuSql('network','list_network_translations','Array-Übersetzungen','Experten-Einstellungen! Hier richten Sie Array-Index-Übersetzungen für nicht-fehler API-Antworten ein. Dies sind INTERNE Daten und sollten nur vom Entwicklerteam angepasst werden. Sie sollten hier generell nichts einstellen und im Forum um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten möchten.',9); + addAdminMenuSql('network','list_network_api_translation','Antwort-Array','Experten-Einstellungen! Hier stellen Sie die Zuweisungen der aus der analysierten API-Antwort Array-Elementen zu den Datenspalten ein. Sie sollten hier generell nichts einstellen und im Forum um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten möchten.',10); + addAdminMenuSql('network','list_network_error_codes','Fehlercodes','Experten-Einstellungen! Hier stellen Sie die Fehlercodes ein, die im Falle eines Fehlers pro API-Script kommen können. Sie sollten hier generell nichts einstellen und im Forum um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten möchten.',11); addAdminMenuSql('network','list_network_error_types','Fehlertypen','Experten-Einstellungen! Hier stellen Sie die Namen von Fehlercodes ein, die Scripte zurückliefern können. Dies sind INTERNE Daten und sollten nur vom Entwicklerteam angepasst werden. Stellen Sie an diesen Einstellungen bitte nichts um. Sie sollten hier generell nichts einstellen und im Forum um Hilfe fragen, wenn Sie selber ein Werbenetzwerk einrichten möchten.',12); // Configuration entries @@ -2056,7 +2056,7 @@ PRIMARY KEY (`network_reload_id`) addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_error_codes`'); addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_error_types`'); addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_translations`'); - addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_array_translation`'); + addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_api_translation`'); addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_config`'); addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types_config`'); addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_cache`'); diff --git a/inc/extensions/ext-surfbar.php b/inc/extensions/ext-surfbar.php index a10e786b29..3d4f3e648d 100644 --- a/inc/extensions/ext-surfbar.php +++ b/inc/extensions/ext-surfbar.php @@ -182,9 +182,9 @@ UNIQUE KEY `status_action` (`actions_status`,`actions_action`) // Member menus addMemberMenuSql('surfbar',NULL,'Surfbar','N','Y',4); addMemberMenuSql('surfbar','surfbar_start','Surfbar starten','N','Y',1); - addMemberMenuSql('surfbar','surfbar_book','URL buchen','N','Y',2); - addMemberMenuSql('surfbar','surfbar_list','URL-Verwaltung','N','Y',3); - addMemberMenuSql('surfbar','surfbar_stats','URL-Statistiken','N','Y',4); + addMemberMenuSql('surfbar','surfbar_book','Seite buchen','N','Y',2); + addMemberMenuSql('surfbar','surfbar_list','Seiten-Management','N','Y',3); + addMemberMenuSql('surfbar','surfbar_stats','Seiten-Statistik','N','Y',4); // Admin menus addAdminMenuSql('surfbar',NULL,'Surfbar','URLs in der Surfbar verwalten, Einstellungen ändern und vieles mehr.',7); diff --git a/inc/functions.php b/inc/functions.php index df6bbe1ab0..bccca8bca0 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2176,15 +2176,6 @@ function mapModuleToTable ($moduleName) { // Add SQL debug data to array for later output function addSqlToDebug ($result, $sqlString, $timing, $F, $L) { - // Already executed? - if (isset($GLOBALS['debug_sqls'][$F][$L][$sqlString])) { - // Then abort here, we don't need to profile a query twice - return; - } // END - if - - // Remeber this as profiled (or not, but we don't care here) - $GLOBALS['debug_sqls'][$F][$L][$sqlString] = true; - // Do we have cache? if (!isset($GLOBALS['debug_sql_available'])) { // Check it and cache it in $GLOBALS @@ -2196,6 +2187,15 @@ function addSqlToDebug ($result, $sqlString, $timing, $F, $L) { return; } // END - if + // Already executed? + if (isset($GLOBALS['debug_sqls'][$F][$L][$sqlString])) { + // Then abort here, we don't need to profile a query twice + return; + } // END - if + + // Remeber this as profiled (or not, but we don't care here) + $GLOBALS['debug_sqls'][$F][$L][$sqlString] = true; + // Generate record $record = array( 'num_rows' => SQL_NUMROWS($result), diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index 155196386b..5107f809cc 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -150,11 +150,8 @@ function addBonusRanks ($data, $type, $userid) { $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `%s`=%s ORDER BY `level` ASC LIMIT {?bonus_lines?}", array($type, $data), __FUNCTION__, __LINE__); if (!SQL_HASZERONUMS($result)) { - // Start generating the ranking list - $max = SQL_NUMROWS($result); - // Output all ranks (levels) - for ($rank = 1; $rank <= $max; $rank++) { + for ($rank = 1; $rank <= SQL_NUMROWS($result); $rank++) { // Load data $result_users = SQL_QUERY_ESC("SELECT `userid`, `points` diff --git a/inc/libs/network_functions.php b/inc/libs/network_functions.php index 535a9ec065..d7d9946c23 100644 --- a/inc/libs/network_functions.php +++ b/inc/libs/network_functions.php @@ -555,11 +555,11 @@ function generateNetworkRequestKeyOptions ($key) { } // Generator (somewhat getter) for (return) array translation -function generateNetworkArrayTranslationOptions ($default) { +function generateNetworkTranslationOptions ($default = '') { // Is it cached? - if (!isset($GLOBALS['network_array_translation'][$default])) { + if (!isset($GLOBALS['network_translation'][$default])) { // Generate and cache it - $GLOBALS['network_array_translation'][$default] = generateOptionList( + $GLOBALS['network_translation'][$default] = generateOptionList( 'network_translations', 'network_translation', 'network_translation', @@ -568,13 +568,13 @@ function generateNetworkArrayTranslationOptions ($default) { sprintf("WHERE `network_type_id`=%s", bigintval(getRequestParameter('network_type')) ), - $GLOBALS['network_array_translation_disabled'], + $GLOBALS['network_translation_disabled'], 'ADMIN_NETWORK_ARRAY_TRANSLATION_' ); } // END - if // Return content - return $GLOBALS['network_array_translation'][$default]; + return $GLOBALS['network_translation'][$default]; } //------------------------------------------------------------------------------ diff --git a/inc/libs/optimize_functions.php b/inc/libs/optimize_functions.php index 011484fd2f..f1c25821dc 100644 --- a/inc/libs/optimize_functions.php +++ b/inc/libs/optimize_functions.php @@ -45,15 +45,23 @@ if (!defined('__SECURITY')) { // Part taken from admin optimize module of PHPNuke (http://www.phpnuke.org) function repairOptimizeDatabase () { $ret = array(); - $tot_data = '0'; $tabs = '0'; $opts = '0'; - $tot_idx = '0'; $total_gain = '0'; + $tot_data = '0'; + $opts = '0'; + $tot_idx = '0'; + $total_gain = '0'; $tot_all = '0'; + + // Get table status $result = SQL_QUERY('SHOW TABLE STATUS FROM `{?__DB_NAME?}`', __FUNCTION__, __LINE__); - $tabs = SQL_NUMROWS($result); + + // Init array $ret['total_size'] = '0'; - $ret['total_tabs'] = $tabs; + $ret['total_tabs'] = SQL_NUMROWS($result); $ret['tables'] = array(); - if ($tabs > 0) { + + // Do we have entries? + if (SQL_NUMROWS($result) > 0) { + // Fetch all rows while ($row = SQL_FETCHARRAY($result)) { $tot_data = $row['Data_length']; $tot_idx = $row['Index_length']; diff --git a/inc/libs/task_functions.php b/inc/libs/task_functions.php index 5250de06ce..06f0f2b3fd 100644 --- a/inc/libs/task_functions.php +++ b/inc/libs/task_functions.php @@ -560,12 +560,6 @@ function createExtraTaskRows ($WHATs, $DESCRs, $TITLEs) { // Run SQL command, get line numbers and free memory $result = SQL_QUERY($sql, __FUNCTION__, __LINE__); - // Get rows - $value = SQL_NUMROWS($result); - - // Free result - SQL_FREERESULT($result); - // Prepare array for output $content = array( 'row_descr' => $DESCRs[$key], @@ -575,13 +569,18 @@ function createExtraTaskRows ($WHATs, $DESCRs, $TITLEs) { // Rewrite CSS class if not last entry is reached if ($key < (count($sqls) - 1)) $content['bottom'] = 'bottom'; - if (($value > 0) && (!empty($WHATs[$key]))) { - if (empty($TITLEs[$key])) $TITLEs[$key] = '{--ADMIN_TASK_UNKNOWN_LIST_TITLE--}'; - $content['row_link'] = '' . $value . ''; + if ((SQL_NUMROWS($result) > 0) && (!empty($WHATs[$key]))) { + if (empty($TITLEs[$key])) { + $TITLEs[$key] = '{--ADMIN_TASK_UNKNOWN_LIST_TITLE--}'; + } // END - if + $content['row_link'] = '' . SQL_NUMROWS($result) . ''; } else { $content['row_link'] = '0'; } + // Free result + SQL_FREERESULT($result); + // And insert the final string into extras template $OUT .= loadTemplate('admin_overview_task_rows', true, $content); } // END- foreach diff --git a/inc/modules/admin/what-adminedit.php b/inc/modules/admin/what-adminedit.php index 8746b7d4bb..874fa092f5 100644 --- a/inc/modules/admin/what-adminedit.php +++ b/inc/modules/admin/what-adminedit.php @@ -48,7 +48,7 @@ addMenuDescription('admin', __FILE__); // Do we edit/delete/change main menus or sub menus? $AND = "(`what` = '' OR `what` IS NULL)"; $SUB = ''; if (isGetRequestParameterSet('sub')) { - $AND = sprintf("`action`='%s' AND `what` IS NOT NULL", getRequestParameter('sub')); + $AND = sprintf("`action`='%s' AND `what` != '' AND `what` IS NOT NULL", getRequestParameter('sub')); $SUB = getRequestParameter('sub'); } // END - if @@ -147,18 +147,23 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive() $sel = bigintval($sel); // Update entry - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET -`title`='%s', -`action`='%s', -`what`='%s', -`descr`='%s' -WHERE ".$AND." AND `id`=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE + `{?_MYSQL_PREFIX?}_admin_menu` +SET + `title`='%s', + `action`='%s', + `what`='%s', + `descr`='%s' +WHERE + ".$AND." AND + `id`=%s +LIMIT 1", array( - $menu, - postRequestParameter('sel_action', $sel), - postRequestParameter('sel_what', $sel), - postRequestParameter('sel_desc', $sel), - $sel, + $menu, + postRequestParameter('sel_action', $sel), + postRequestParameter('sel_what', $sel), + postRequestParameter('sel_desc', $sel), + $sel, ), __FILE__, __LINE__); } @@ -186,47 +191,59 @@ WHERE ".$AND." AND `id`=%s LIMIT 1", // Get ids if (isGetRequestParameterSet('w')) { // Sub menus selected - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1", - array(getRequestParameter('act'), bigintval(getRequestParameter('tid'))), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." AND `what` != '%s' AND `sort`=%s LIMIT 1", + array( + getRequestParameter('w'), + bigintval(getRequestParameter('tid')) + ), __FILE__, __LINE__); list($tid) = SQL_FETCHROW($result); SQL_FREERESULT($result); - $result = SQL_QUERY("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1", - array(getRequestParameter('act'), bigintval(getRequestParameter('fid'))), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." AND `what`='%s' AND `sort`=%s LIMIT 1", + array( + getRequestParameter('w'), + bigintval(getRequestParameter('fid')) + ), __FILE__, __LINE__); list($fid) = SQL_FETCHROW($result); SQL_FREERESULT($result); } else { // Main menu selected - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1", - array(bigintval(getRequestParameter('tid'))), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action` != %s AND ".$AND." AND `sort`=%s LIMIT 1", + array( + getRequestParameter('act'), + bigintval(getRequestParameter('tid')) + ), __FILE__, __LINE__); list($tid) = SQL_FETCHROW($result); SQL_FREERESULT($result); - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1", - array(bigintval(getRequestParameter('fid'))), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`=%s AND ".$AND." AND `sort`=%s LIMIT 1", + array( + getRequestParameter('act'), + bigintval(getRequestParameter('fid')) + ), __FILE__, __LINE__); list($fid) = SQL_FETCHROW($result); SQL_FREERESULT($result); } + // Do we have entries found? if ((!empty($tid)) && (!empty($fid))) { // Sort menu - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `sort`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1", - array(bigintval(getRequestParameter('tid')), bigintval($fid)), __FILE__, __LINE__); - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `sort`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1", - array(bigintval(getRequestParameter('fid')), bigintval($tid)), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `sort`=%s WHERE ".$AND." AND `id`=%s LIMIT 1", + array( + bigintval(getRequestParameter('tid')), + bigintval($fid) + ), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `sort`=%s WHERE ".$AND." AND `id`=%s LIMIT 1", + array( + bigintval(getRequestParameter('fid')), + bigintval($tid) + ), __FILE__, __LINE__); } // END - if } // END - if - // By default list menus - if (!empty($SUB)) { - // Sub menus of a main menu - $result = SQL_QUERY_ESC("SELECT id, action, what, title, sort FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC", - array($SUB), __FILE__, __LINE__); - } else { - // Main menus - $result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__); - } + // Run SQL + $result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." ORDER BY `sort` ASC", __FILE__, __LINE__); - $numMenus = SQL_NUMROWS($result); - if ($numMenus > 0) { + // Do we have entries? + if (SQL_NUMROWS($result) > 0) { // Remember sub value $content['sub'] = $SUB; @@ -243,7 +260,7 @@ WHERE ".$AND." AND `id`=%s LIMIT 1", if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($SUB)))) { // Is highest position $data['navi'] = '{--LOWER--}'; - } elseif ($cnt == $numMenus) { + } elseif ($cnt == SQL_NUMROWS($result)) { // Is lowest position $data['navi'] = '{--HIGHER--}'; } elseif ($data['sort'] > 0) { diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php index 0e130785ef..5f5ce55935 100644 --- a/inc/modules/admin/what-extensions.php +++ b/inc/modules/admin/what-extensions.php @@ -326,15 +326,11 @@ ORDER BY break; case 'register': // Register new extension - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `assigned_admin`=%s AND `task_type`='EXTENSION' LIMIT 1", - array(getCurrentAdminId()), __FILE__, __LINE__); - $task_found = SQL_NUMROWS($result); - - // Free result - SQL_FREERESULT($result); + // Do we have some tasks? + $numTasks = countSumTotalData(getCurrentAdminId(), 'task_system', 'id', 'assigned_admin', true, "AND `task_type`='EXTENSION'"); // Is the id number valid and the task was found? - if (($taskId > 0) && ($task_found == 1)) { + if (($taskId > 0) && ($numTasks > 0)) { // id is valid so begin with registration, we first want to it's real name from task management (subject column) $result = SQL_QUERY_ESC("SELECT `subject` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `id`=%s LIMIT 1", array(bigintval($taskId)), __FILE__, __LINE__); @@ -389,7 +385,7 @@ ORDER BY // Extension was not found in task management loadTemplate('admin_settings_saved', false, '{--ADMIN_EXTENSION_REGISTRATION_FAILED_ID_404--}'); } - } elseif ($task_found == '0') { + } elseif ($numTasks == '0') { // No longer assigned or old task loadTemplate('admin_settings_saved', false, '{--ADMIN_EXTENSION_REGISTRATION_FAILED_ASSIGED--}'); } else { diff --git a/inc/modules/admin/what-guestedit.php b/inc/modules/admin/what-guestedit.php index 9c1e556d68..722b9eea4e 100644 --- a/inc/modules/admin/what-guestedit.php +++ b/inc/modules/admin/what-guestedit.php @@ -222,21 +222,21 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive() // Get ids if (isGetRequestParameterSet('w')) { // Sub menus selected - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='%s' AND `sort`=%s LIMIT 1", array(getRequestParameter('act'), bigintval(getRequestParameter('tid'))), __FILE__, __LINE__); list($tid) = SQL_FETCHROW($result); SQL_FREERESULT($result); - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='%s' AND `sort`=%s LIMIT 1", array(getRequestParameter('act'), bigintval(getRequestParameter('fid'))), __FILE__, __LINE__); list($fid) = SQL_FETCHROW($result); SQL_FREERESULT($result); } else { // Main menu selected - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`=%s LIMIT 1", array(bigintval(getRequestParameter('tid'))), __FILE__, __LINE__); list($tid) = SQL_FETCHROW($result); SQL_FREERESULT($result); - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`=%s LIMIT 1", array(bigintval(getRequestParameter('fid'))), __FILE__, __LINE__); list($fid) = SQL_FETCHROW($result); SQL_FREERESULT($result); @@ -244,9 +244,9 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive() if ((!empty($tid)) && (!empty($fid))) { // Sort menu - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `sort`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `sort`=%s WHERE ".$AND." AND `id`=%s LIMIT 1", array(bigintval(getRequestParameter('tid')), bigintval($fid)), __FILE__, __LINE__); - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `sort`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `sort`=%s WHERE ".$AND." AND `id`=%s LIMIT 1", array(bigintval(getRequestParameter('fid')), bigintval($tid)), __FILE__, __LINE__); } // END - if } // END - if @@ -261,9 +261,8 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive() array($SUB), __FILE__, __LINE__); } - // Get number of menu entries - $numMenus = SQL_NUMROWS($result); - if ($numMenus > 0) { + // Do we have entries? + if (SQL_NUMROWS($result) > 0) { // Set sub value $content['sub'] = $SUB; @@ -277,7 +276,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive() if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($SUB)))) { // Is highest position $NAVI = '{--LOWER--}'; - } elseif ($cnt == $numMenus) { + } elseif ($cnt == SQL_NUMROWS($result)) { // Is lowest position $NAVI = '{--HIGHER--}'; } elseif ($data['sort'] > 0) { diff --git a/inc/modules/admin/what-list_links.php b/inc/modules/admin/what-list_links.php index fbed1deafa..b48b2e0039 100644 --- a/inc/modules/admin/what-list_links.php +++ b/inc/modules/admin/what-list_links.php @@ -65,18 +65,16 @@ if (isGetRequestParameterSet('userid')) { array(bigintval(getRequestParameter('userid'))), __FILE__, __LINE__); } - // Get number of rows from the query - $nums = SQL_NUMROWS($result); - - if ($nums > 0) { + // Do we have some entries? + if (SQL_NUMROWS($result) > 0) { // Some unconfirmed mails left if (getRequestParameter('del') == "all") { // Delete all unconfirmed mails by this user SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `userid`=%s LIMIT %s", - array(bigintval(getRequestParameter('userid')), $nums), __FILE__, __LINE__); + array(bigintval(getRequestParameter('userid')), SQL_NUMROWS($result)), __FILE__, __LINE__); // Prepare mail and send it away - $message = loadEmailTemplate('admin-del_links', $nums, bigintval(getRequestParameter('userid'))); + $message = loadEmailTemplate('admin-del_links', SQL_NUMROWS($result), bigintval(getRequestParameter('userid'))); sendEmail(getUserData('email'), '{--ADMIN_DELETE_LINK_SUBJECT--}', $message); // Display message @@ -117,6 +115,7 @@ if (isGetRequestParameterSet('userid')) { break; } // END - switch + // Do we have an entry? if (SQL_NUMROWS($result_data) == 1) { // Mail was found! $content = SQL_FETCHARRAY($result_data); @@ -148,17 +147,17 @@ if (isGetRequestParameterSet('userid')) { SQL_FREERESULT($result_data); } // END - while - // Free memory - SQL_FREERESULT($result); - // Remember list in constant for the template $content['surname'] = getUserData('surname'); $content['family'] = getUserData('family'); $content['email'] = '' . getUserData('email') . ''; $content['rows'] = $OUT; - $content['nums'] = $nums; + $content['nums'] = SQL_NUMROWS($result); $content['userid'] = bigintval(getRequestParameter('userid')); + // Free memory + SQL_FREERESULT($result); + // Load final template loadTemplate('admin_list_links', false, $content); } diff --git a/inc/modules/admin/what-list_network_api_translation.php b/inc/modules/admin/what-list_network_api_translation.php new file mode 100644 index 0000000000..f6b8512f13 --- /dev/null +++ b/inc/modules/admin/what-list_network_api_translation.php @@ -0,0 +1,148 @@ + 0) { + // List all entries + $OUT = ''; + while ($row = SQL_FETCHARRAY($result)) { + // Add it to network if the type matches selected + if ($row['network_type_id'] == getRequestParameter('network_type_id')) { + // Matches, then add it for disabling this entry + $GLOBALS['network_api_translation_disabled'][$row['network_api_index']] = true; + } // END - if + + // Add row template and switch color + $OUT .= loadTemplate('admin_list_network_api_translation_row', true, $row); + } // END - while + + // Prepare data for template + $content = array( + 'rows' => $OUT, + 'network_id' => bigintval(getRequestParameter('network')), + 'network_title' => $networkData['network_title'], + 'network_reflink' => $networkData['network_reflink'], + ); + + // Load main template + loadTemplate('admin_list_network_api_translation', false, $content); + } else { + // No entries found + loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_NETWORK_ARRAY_TRANSLATION_404', $networkData['network_title'])); + } + + // Add options list for network type + $networkData['translation_index'] = (SQL_NUMROWS($result) + 1); + $networkData['type_options'] = generateNetworkTypeOptions(getRequestParameter('network_type_id')); + + // Free result + SQL_FREERESULT($result); + + // Add form for adding new array_translation pair + loadTemplate('admin_add_network_api_translation', false, $networkData); +} else { + // Generate network list for this script + outputHtml(generateAdminNetworkList()); +} + +// [EOF] +?> diff --git a/inc/modules/admin/what-list_network_array_translation.php b/inc/modules/admin/what-list_network_array_translation.php index b37aee5211..f551ef47b7 100644 --- a/inc/modules/admin/what-list_network_array_translation.php +++ b/inc/modules/admin/what-list_network_array_translation.php @@ -1,151 +1,3 @@ 0) { - // List all entries - $OUT = ''; - while ($row = SQL_FETCHARRAY($result)) { - // Add it to network if the type matches selected - if ($row['network_type_id'] == getRequestParameter('network_type_id')) { - // Matches, then add it for disabling this entry - $GLOBALS['network_array_translation_disabled'][$row['network_array_index']] = true; - } // END - if - - // Add row template and switch color - $OUT .= loadTemplate('admin_list_network_array_translation_row', true, $row); - } // END - while - - // Prepare data for template - $content = array( - 'rows' => $OUT, - 'network_id' => bigintval(getRequestParameter('network')), - 'network_title' => $networkData['network_title'], - 'network_reflink' => $networkData['network_reflink'], - ); - - // Load main template - loadTemplate('admin_list_network_array_translation', false, $content); - } else { - // No entries found - loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_NETWORK_ARRAY_TRANSLATION_404', $networkData['network_title'])); - } - - // Free result - SQL_FREERESULT($result); - - // Add options list for network type - $networkData['translation_index'] = ($rows + 1); - $networkData['type_options'] = generateNetworkTypeOptions(getRequestParameter('network_type_id')); - - // Add form for adding new array_translation pair - loadTemplate('admin_add_network_array_translation', false, $networkData); -} else { - // Generate network list for this script - outputHtml(generateAdminNetworkList()); -} - -// [EOF] +// @DEPRECATED ?> diff --git a/inc/modules/admin/what-list_network_translations.php b/inc/modules/admin/what-list_network_translations.php index d5a0dc7f08..c1d44d5f8e 100644 --- a/inc/modules/admin/what-list_network_translations.php +++ b/inc/modules/admin/what-list_network_translations.php @@ -79,18 +79,15 @@ FROM ORDER BY `network_translate_id` ASC", __FILE__, __LINE__); - // Remember the rows - $rows = SQL_NUMROWS($result); - // Do we have entries? - if ($rows > 0) { + if (SQL_NUMROWS($result) > 0) { // List all entries $OUT = ''; while ($row = SQL_FETCHARRAY($result)) { // Add it to network if the type matches selected if ($row['network_type_id'] == getRequestParameter('network_type_id')) { // Matches, then add it for disabling this entry - $GLOBALS['network_translations_disabled'][$row['network_array_index']] = true; + $GLOBALS['network_translations_disabled'][$row['network_translate_id']] = true; } // END - if // Add row template and switch color diff --git a/inc/modules/admin/what-list_unconfirmed.php b/inc/modules/admin/what-list_unconfirmed.php index 4a587650fe..2049183e5b 100644 --- a/inc/modules/admin/what-list_unconfirmed.php +++ b/inc/modules/admin/what-list_unconfirmed.php @@ -135,10 +135,8 @@ LIMIT %s", bigintval($poolData['max_rec']) ),__FILE__, __LINE__); - // Total number of unconfirmed mails - $unconfirmed = SQL_NUMROWS($result); - - if ($unconfirmed > 0) { + // Do we have entries? + if (SQL_NUMROWS($result) > 0) { // At least one link left to confirm $OUT = ''; while ($content = SQL_FETCHARRAY($result)) { @@ -163,19 +161,19 @@ LIMIT %s", // Render it in our new listing $OUT = loadTemplate('admin_list_unconfirmed_list', true, $OUT); - - // Free memory - SQL_FREERESULT($result); } else { // All links are confirmed... strange, you shall normally not get a link to this place in this scenario... hmmm. $OUT = loadTemplate('admin_settings_saved', true, '{--ADMIN_UNCONFIRMED_NO_LINK_LEFT--}'); } // Prepare content - $content['unconfirmed'] = $unconfirmed; + $content['unconfirmed'] = SQL_NUMROWS($result); $content['timestamp'] = generateDateTime($poolData['timestamp'], 2); $content['rows'] = $OUT; + // Free memory + SQL_FREERESULT($result); + // Load final template loadTemplate('admin_list_unconfirmed', false, $content); } elseif (getRequestParameter('mid') > 0) { diff --git a/inc/modules/admin/what-memedit.php b/inc/modules/admin/what-memedit.php index 49f8473f0f..658f45675c 100644 --- a/inc/modules/admin/what-memedit.php +++ b/inc/modules/admin/what-memedit.php @@ -216,29 +216,29 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive() // Get ids if (isGetRequestParameterSet('w')) { // Sub menus selected - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `sort`=%s LIMIT 1", array(bigintval(getRequestParameter('act')), bigintval(getRequestParameter('tid'))), __FILE__, __LINE__); list($tid) = SQL_FETCHROW($result); SQL_FREERESULT($result); - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `sort`=%s LIMIT 1", array(bigintval(getRequestParameter('act')), bigintval(getRequestParameter('fid'))), __FILE__, __LINE__); list($fid) = SQL_FETCHROW($result); SQL_FREERESULT($result); } else { // Main menu selected - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`=%s LIMIT 1", array(bigintval(getRequestParameter('tid'))), __FILE__, __LINE__); list($tid) = SQL_FETCHROW($result); - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`=%s LIMIT 1", array(bigintval(getRequestParameter('fid'))), __FILE__, __LINE__); list($fid) = SQL_FETCHROW($result); } if ((!empty($tid)) && (!empty($fid))) { // Sort menu - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`=%s WHERE ".$AND." AND `id`=%s LIMIT 1", array(bigintval(getRequestParameter('tid')), bigintval($fid)), __FILE__, __LINE__); - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`=%s WHERE ".$AND." AND `id`=%s LIMIT 1", array(bigintval(getRequestParameter('fid')), bigintval($tid)), __FILE__, __LINE__); } // END - -fi } // END - if @@ -251,11 +251,8 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive() $result = SQL_QUERY("SELECT `id`, `action`, `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__); } - // Get total menu entries - $numMenus = SQL_NUMROWS($result); - // Some are there? - if ($numMenus > 0) { + if (SQL_NUMROWS($result) > 0) { // Set sub value $content['sub'] = $SUB; @@ -267,7 +264,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive() if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($SUB)))) { // Is highest position $data['navi'] = '{--LOWER--}'; - } elseif ($cnt == $numMenus) { + } elseif ($cnt == SQL_NUMROWS($result)) { // Is lowest position $data['navi'] = '{--HIGHER--}'; } elseif ($data['sort'] > 0) { diff --git a/inc/modules/guest/what-stats.php b/inc/modules/guest/what-stats.php index 6e6c88e284..34ea36f1fd 100644 --- a/inc/modules/guest/what-stats.php +++ b/inc/modules/guest/what-stats.php @@ -76,24 +76,10 @@ $ltitle = '{--GUEST_STATS_' . strtoupper($lmode) . '--}'; // @TODO This can be rewritten in a dynamic include switch (getConfig('guest_stats')) { case 'MEMBERS': // Statistics about your members - // Members yesterday / today online - $ymem = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `last_online` >= {?START_YDAY?} AND `last_online` < {?START_TDAY?} AND `status`='CONFIRMED'", __FILE__, __LINE__)); - $tmem = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `last_online` >= {?START_TDAY?} AND `status`='CONFIRMED'", __FILE__, __LINE__)); - - // Yesterday / today registered - $yreg = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `joined` >= {?START_YDAY?} AND `joined` < {?START_TDAY?}", __FILE__, __LINE__)); - $treg = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `joined` >= {?START_TDAY?}", __FILE__, __LINE__)); - // Only males / females $male = countSumTotalData('M', 'user_data', 'userid', 'gender', true, " AND `status`='CONFIRMED'"); $female = countSumTotalData('F', 'user_data', 'userid', 'gender', true, " AND `status`='CONFIRMED'"); - // Unconfirmed accounts - $unconfirmed = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `status` != 'CONFIRMED'", __FILE__, __LINE__)); - - // Total members - $total = $male + $female; - // List every month $months = array(); for ($idx = 1; $idx < 13; $idx++) { @@ -126,14 +112,14 @@ switch (getConfig('guest_stats')) { } // END - foreach // Prepare data for the template - $content['total_users'] = $total; - $content['unconfirmed'] = $unconfirmed; + $content['total_users'] = ($male + $female); + $content['unconfirmed'] = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `status` != 'CONFIRMED'", __FILE__, __LINE__)); $content['total_males'] = $male; $content['total_females'] = $female; - $content['tmem_count'] = $tmem; - $content['ymem_count'] = $ymem; - $content['treg_count'] = $treg; - $content['yreg_count'] = $yreg; + $content['tmem_count'] = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `last_online` >= {?START_TDAY?} AND `status`='CONFIRMED'", __FILE__, __LINE__)); + $content['ymem_count'] = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `last_online` >= {?START_YDAY?} AND `last_online` < {?START_TDAY?} AND `status`='CONFIRMED'", __FILE__, __LINE__)); + $content['treg_count'] = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `joined` >= {?START_TDAY?}", __FILE__, __LINE__)); + $content['yreg_count'] = SQL_NUMROWS(SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `joined` >= {?START_YDAY?} AND `joined` < {?START_TDAY?}", __FILE__, __LINE__)); $content['lmode'] = $lmode; $content['ltitle'] = $ltitle; diff --git a/inc/modules/member/what-categories.php b/inc/modules/member/what-categories.php index 1117465b0d..e6a245b105 100644 --- a/inc/modules/member/what-categories.php +++ b/inc/modules/member/what-categories.php @@ -53,10 +53,8 @@ if (isAdmin()) $whereStatement = ''; // Get all categories $result = SQL_QUERY("SELECT `id`, `cat` FROM `{?_MYSQL_PREFIX?}_cats`".$whereStatement." ORDER BY `sort` ASC", __FILE__, __LINE__); -// Get num rows -$numCategories = SQL_NUMROWS($result); - -if ($numCategories > 0) { +// Do we have entries? +if (SQL_NUMROWS($result) > 0) { $LEAST = false; if (isFormSent()) { $cnt = '0'; @@ -64,7 +62,7 @@ if ($numCategories > 0) { if ($joined != 'Y') $cnt++; } // END - foreach - if (($numCategories - $cnt) < getConfig('least_cats')) { + if ((SQL_NUMROWS($result) - $cnt) < getConfig('least_cats')) { unsetPostRequestParameter('ok'); $LEAST = true; } // END - if @@ -123,7 +121,7 @@ if ($numCategories > 0) { } // END - if // Put some data into constants for the template - $content['rows'] = ($numCategories * 2 + 4); + $content['rows'] = (SQL_NUMROWS($result) * 2 + 4); // Load header template loadTemplate('member_cats_header', false, $content); diff --git a/inc/modules/member/what-points.php b/inc/modules/member/what-points.php index 1f4d5d0ad0..3c8f391d9e 100644 --- a/inc/modules/member/what-points.php +++ b/inc/modules/member/what-points.php @@ -49,6 +49,8 @@ addMenuDescription('member', __FILE__); // Query for referal levels and percents $result_depths = SQL_QUERY("SELECT `level`, `percents` FROM `{?_MYSQL_PREFIX?}_refdepths` ORDER BY `level` ASC", __FILE__, __LINE__); + +// Get total depths $numDepths = SQL_NUMROWS($result_depths); // Add many more rows for the login/turbo/ref/order bonus diff --git a/inc/template-functions.php b/inc/template-functions.php index daed3210c6..4086492753 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -185,9 +185,11 @@ function compileFinalOutput () { } // END - if // Compress it? + /** + * @TODO On some pages this is buggy if (!empty($_SERVER['HTTP_ACCEPT_ENCODING']) && (strpos('gzip', $_SERVER['HTTP_ACCEPT_ENCODING']) !== null)) { // Compress it for HTTP gzip - $GLOBALS['output'] = gzencode($GLOBALS['output'], 9, true); + $GLOBALS['output'] = gzencode($GLOBALS['output'], 9); // Add header sendHeader('Content-Encoding: gzip'); @@ -198,6 +200,7 @@ function compileFinalOutput () { // Add header sendHeader('Content-Encoding: deflate'); } + */ // Add final length sendHeader('Content-Length: ' . strlen($GLOBALS['output'])); diff --git a/templates/de/html/admin/admin_add_network_api_translation.tpl b/templates/de/html/admin/admin_add_network_api_translation.tpl new file mode 100644 index 0000000000..68ba19c91b --- /dev/null +++ b/templates/de/html/admin/admin_add_network_api_translation.tpl @@ -0,0 +1,47 @@ +
+
+ + + + + + + + + + + + + + + + + + + +
+ {--ADMIN_NETWORK_ARRAY_TRANSLATION_ADD_TITLE--} + +
{--ADMIN_NETWORK_TYPE_SELECT--}: + +
{--ADMIN_NETWORK_ARRAY_TRANSLATION_INDEX--}: + + $content[translation_index] +
{--ADMIN_NETWORK_ARRAY_TRANSLATION_INDEX_TRANSLATION--}: + +
+
+
+ +
+ {--ADMIN_NETWORK_ARRAY_TRANSLATION_ADD_NOTE--} +
diff --git a/templates/de/html/admin/admin_add_network_array_translation.tpl b/templates/de/html/admin/admin_add_network_array_translation.tpl index bb1431a7e9..11f5d85d80 100644 --- a/templates/de/html/admin/admin_add_network_array_translation.tpl +++ b/templates/de/html/admin/admin_add_network_array_translation.tpl @@ -1,47 +1 @@ -
-
- - - - - - - - - - - - - - - - - - - -
- {--ADMIN_NETWORK_ARRAY_TRANSLATION_ADD_TITLE--} - -
{--ADMIN_NETWORK_TYPE_SELECT--}: - -
{--ADMIN_NETWORK_ARRAY_TRANSLATION_INDEX--}: - - $content[translation_index] -
{--ADMIN_NETWORK_ARRAY_TRANSLATION_INDEX_TRANSLATION--}: - -
-
-
- -
- {--ADMIN_NETWORK_ARRAY_TRANSLATION_ADD_NOTE--} -
+