From a5966b77de4635f56787c2606292ac436d8c7039 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 28 Jun 2011 07:16:31 +0000 Subject: [PATCH] Some more code-cleanups: - More usage of EL - Deprecated code removed - Some text improved - TODO.txt updated --- DOCS/TODOs.txt | 2 +- inc/language/de.php | 2 +- inc/modules/admin/admin-inc.php | 4 ++- inc/modules/admin/what-extensions.php | 5 ++-- inc/modules/admin/what-guestedit.php | 4 --- inc/modules/admin/what-memedit.php | 5 ---- inc/modules/guest/what-active.php | 25 +++++++++---------- inc/modules/guest/what-top10.php | 5 ++-- .../admin/admin_extensions_delete_row.tpl | 2 +- templates/de/html/guest/guest_active_row.tpl | 4 +-- .../de/html/guest/guest_top10_row_refs.tpl | 2 +- 11 files changed, 27 insertions(+), 33 deletions(-) diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index f80182d46a..ffcbdd43c3 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -129,7 +129,7 @@ ./inc/modules/admin/what-del_email.php:61: // @TODO Unused: cat_id, payment_id ./inc/modules/admin/what-edit_user.php:18: * @TODO Add support for ext-country * ./inc/modules/admin/what-email_stats.php:46:// @TODO Unused at the moment -./inc/modules/admin/what-extensions.php:363: // @TODO Rewrite this to a filter +./inc/modules/admin/what-extensions.php:364: // @TODO Rewrite this to a filter ./inc/modules/admin/what-guest_add.php:129: // @TODO This can be somehow rewritten to a function ./inc/modules/admin/what-guest_add.php:67: // @TODO Cant this be rewritten? ./inc/modules/admin/what-guest_add.php:80: // @TODO This can be somehow rewritten to a function diff --git a/inc/language/de.php b/inc/language/de.php index 929ab164f0..a0a0c3fe77 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -1037,7 +1037,7 @@ addMessages(array( 'ADMIN_CONFIG_SESSION_SAVE_PATH' => "Speicherpfad f. Sitzungsdateien", 'ADMIN_BASE_PATH' => "Absoluter Server-Pfad", 'ADMIN_SESSION_SAVE_PATH_NOTE' => "Sie sollten für Sitzungsdateien einen Pfad wählen der ausserhalb des Server-Pfades liegt, da sonst eventuell die Sitzungsdateien vom Web erreichbar sind, was ein hohes Sicherheitsrisiko darstellt.", - 'MEMBER_NO_MAILS_IN_STATS' => "Keine versandten Buchungen gefunden.", + 'MEMBER_NO_MAILS_IN_STATS' => "Sie haben noch keine Mailbuchungen aufgegeben. Es kann Ihnen somit auch keine Statistik angezeigt werden.", 'ADMIN_RESET_PASSWORD' => "Passwort vergessen?", 'EMAIL_DETAILS' => "Email-Details", 'EMAIL_DETAILS_LINK' => "Details anzeigen", diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 96aaca29d9..c3eaf82143 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -638,7 +638,9 @@ function generateUserProfileLink ($userid, $title = '', $what = 'list_user') { $nick = getNickname($userid); // Is it not empty, use it as title else the userid - if (!empty($nick)) $title = $nick . '(' . $userid . ')'; else $title = $userid; + if (!empty($nick)) { + $title = $nick . '(' . $userid . ')'; else $title = $userid; + } // END - if } // Return link diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php index 5c6be90d02..45cd7d59ca 100644 --- a/inc/modules/admin/what-extensions.php +++ b/inc/modules/admin/what-extensions.php @@ -198,7 +198,6 @@ if (isGetRequestParameterSet('reg_ext')) { $content = array( 'id' => $ext_id, 'ext_name' => $ext_name, - 'ext_ver' => getExtensionVersion($ext_name), 'verbose' => $VERBOSE_OUT ); @@ -303,7 +302,9 @@ ORDER BY while ($content = SQL_FETCHARRAY($result)) { // Prepare CSS selection output $cssSelection = '---'; - if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) $cssSelection = translateYesNo($content['ext_css']); + if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) { + $cssSelection = translateYesNo($content['ext_css']); + } // END - if // Prepare data for the row template $content['ext_css'] = $cssSelection; diff --git a/inc/modules/admin/what-guestedit.php b/inc/modules/admin/what-guestedit.php index 6f44c2aa58..d7543eaa8a 100644 --- a/inc/modules/admin/what-guestedit.php +++ b/inc/modules/admin/what-guestedit.php @@ -214,10 +214,6 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive() $NAVI = '{--HIGHER--}|{--LOWER--}'; } - if (empty($data['action'])) $data['action'] = '---'; - if (empty($data['what'])) $data['what'] = '---'; - if (empty($data['title'])) $data['title'] = '---'; - // Prepapre content $row = array( 'id' => $data['id'], diff --git a/inc/modules/admin/what-memedit.php b/inc/modules/admin/what-memedit.php index 68867ee6a6..d0d08009fa 100644 --- a/inc/modules/admin/what-memedit.php +++ b/inc/modules/admin/what-memedit.php @@ -208,11 +208,6 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive() $data['navi'] = '{--HIGHER--}|{--LOWER--}'; } - // Fix empty values for Firefox - if (empty($data['action'])) $data['action'] = '---'; - if (empty($data['what'])) $data['what'] = '---'; - if (empty($data['title'])) $data['title'] = '---'; - // Add more entries $data['mode'] = 'mem'; diff --git a/inc/modules/guest/what-active.php b/inc/modules/guest/what-active.php index 945f6ef8a1..36dd9e4443 100644 --- a/inc/modules/guest/what-active.php +++ b/inc/modules/guest/what-active.php @@ -49,14 +49,16 @@ if ((!isExtensionActive('active')) && (!isAdmin())) { } // END - if // Extra field to include is by default userid -$add = 'userid'; +$add = ''; // If nickname is installed the extra field is the nickname of the user -if (isExtensionActive('nickname')) $add = 'nickname'; +if (isExtensionActive('nickname')) { + $add = ', `nickname`'; +} // END - if // Check for members who were active only this day $result = SQL_QUERY("SELECT - `userid`, `".$add."`, `last_online` + `userid``, `last_online`".$add." FROM `{?_MYSQL_PREFIX?}_user_data` WHERE @@ -70,17 +72,14 @@ LIMIT {?active_limit?}", __FILE__, __LINE__); if (!SQL_HASZERONUMS($result)) { // At least one member was online so let's load them all $OUT = ''; - while (list($userid, $nick, $last) = SQL_FETCHROW($result)) { - $nick2 = '---'; - if (($nick != $userid) && (!empty($nick))) $nick2 = $nick; + while ($content = SQL_FETCHARRAY($result)) { + // If ext-nickname is not installed, set 'nickname' to empty + if (!isExtensionActive('nickname')) { + $content['nickname'] = ''; + } // END - if - // Transfer data to array - $content = array( - 'userid' => $userid, - 'nickname' => $nick2, - 'points' => getTotalPoints($userid), - 'last_online' => generateDateTime($last, 2), - ); + // Translate comma + $content['last_online'] = generateDateTime($last, 2); // Load template $OUT .= loadTemplate('guest_active_row', true, $content); diff --git a/inc/modules/guest/what-top10.php b/inc/modules/guest/what-top10.php index a5ad5e61fa..a4dc1f524a 100644 --- a/inc/modules/guest/what-top10.php +++ b/inc/modules/guest/what-top10.php @@ -198,7 +198,9 @@ while ($content = SQL_FETCHARRAY($result)) { $content['nickname'] = ''; // Get nickname - if (isExtensionActive('nickname')) $content['nickname'] = getNickname($content['userid']); + if (isExtensionActive('nickname')) { + $content['nickname'] = getNickname($content['userid']); + } // END - if // Prepare data for template $content = array( @@ -206,7 +208,6 @@ while ($content = SQL_FETCHARRAY($result)) { 'userid' => $content['userid'], 'refs' => $content['refs'], 'nickname' => $content['nickname'], - 'points' => getTotalPoints($content['userid']), 'last_online' => generateDateTime($content['last_online'], 3) ); diff --git a/templates/de/html/admin/admin_extensions_delete_row.tpl b/templates/de/html/admin/admin_extensions_delete_row.tpl index b14a076c6e..a2ba0af380 100644 --- a/templates/de/html/admin/admin_extensions_delete_row.tpl +++ b/templates/de/html/admin/admin_extensions_delete_row.tpl @@ -7,7 +7,7 @@ $content[ext_name] - v$content[ext_ver] + v{%pipe,getExtensionVersion=$content[ext_name]%} diff --git a/templates/de/html/guest/guest_active_row.tpl b/templates/de/html/guest/guest_active_row.tpl index bf7602f4ec..0616c12211 100644 --- a/templates/de/html/guest/guest_active_row.tpl +++ b/templates/de/html/guest/guest_active_row.tpl @@ -1,5 +1,5 @@ - $content[userid] ($content[nickname]) - {%pipe,translateComma=$content[points]%} + $content[userid] ({%pipe,fixEmptyContentToDashes=$content[nickname]%}) + {%pipe,getTotalPoints,translateComma=$content[userid]%} $content[last_online] diff --git a/templates/de/html/guest/guest_top10_row_refs.tpl b/templates/de/html/guest/guest_top10_row_refs.tpl index 1cb2e7f810..22c3a7784c 100644 --- a/templates/de/html/guest/guest_top10_row_refs.tpl +++ b/templates/de/html/guest/guest_top10_row_refs.tpl @@ -2,6 +2,6 @@ $content[cnt] $content[userid] ({%pipe,fixEmptyContentToDashes=$content[nickname]%}) {%pipe,translateComma=$content[refs]%} - {%pipe,translateComma=$content[points]%} + {%pipe,getTotalPoints,translateComma=$content[userid]%} $content[last_online] -- 2.39.5