From: Roland Häder Date: Tue, 21 Dec 2010 23:32:04 +0000 (+0000) Subject: New functions introduced: X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=f1be6fe9139d0036115366c4a4dfc41f8bec115b New functions introduced: - sql_patches must now be 0.7.4 in what-email_details.php - New (?) template function 'generateExtensionOutdatedMessage() introduced - Wrapper getMailsPage() introduced - TODOs.txt updated --- diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index b99f1752a8..046d0145c2 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -49,8 +49,8 @@ ./inc/functions.php:2272: // @TODO This is still very static, rewrite it somehow ./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter ./inc/install-functions.php:57: // @TODO DEACTIVATED: changeDataInInclude(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0); -./inc/language/de.php:1085:// @TODO Rewrite these two constants -./inc/language/de.php:1100:// @TODO Rewrite these three constants +./inc/language/de.php:1087:// @TODO Rewrite these two constants +./inc/language/de.php:1102:// @TODO Rewrite these three constants ./inc/language/de.php:280: // @TODO Following two are unused? ./inc/language/de.php:784:// @TODO Are these constants longer used? ./inc/language-functions.php:243: // @TODO These are all valid languages, again hard-coded @@ -188,8 +188,8 @@ ./inc/template-functions.php:1054: // @TODO Deprecate this thing ./inc/template-functions.php:1141: // @TODO This can be easily moved out after the merge from EL branch to this is complete ./inc/template-functions.php:1174: // @TODO Add a little more infos here -./inc/template-functions.php:1462:// @TODO Lame description for this function -./inc/template-functions.php:1484: // @TODO Move this in a filter +./inc/template-functions.php:1483:// @TODO Lame description for this function +./inc/template-functions.php:1505: // @TODO Move this in a filter ./inc/template-functions.php:189: * @TODO On some pages this is buggy ./inc/template-functions.php:265: // @TODO Remove this sanity-check if all is fine ./inc/template-functions.php:578:// @TODO $simple/$constants are deprecated diff --git a/inc/language/de.php b/inc/language/de.php index 95be0696ab..490be12ee2 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -963,11 +963,13 @@ addMessages(array( 'ADMIN_NO_POINTS_REPAYED' => "Die Mailbuchung hatte keine {?POINTS?} zum zurückbuchen.", 'ADMIN_POINTS_SHREDDED' => "Es wurden %s {?POINTS?} geschrettert.", 'ADMIN_EXTENSION_PROBLEM_EXTENSION_INACTIVE' => "Die Erweiterung %s ist derzeit deaktiviert. Hier können Sie diese aktivieren.", + 'ADMIN_EXTENSION_PROBLEM_EXTENSION_OUTDATED' => "Die Erweiterung %s ist veraltet. Ihre Version: {%%ext,version=%s%%}, erwartete Version: %s.", 'ADMIN_EXTENSION_PROBLEM_EXTENSION_NOT_INSTALLED' => "Die Erweiterung %s ist derzeit nicht installiert. Hier können Sie diese aktivieren.", 'ADMIN_TASK_ROW_EXTENSION_NOT_INSTALLED' => "Erweiterung %s nicht installiert..", 'EXTENSION_PROBLEM_EXTENSION_INACTIVE' => "Kann nicht fortfahren! Fehler: Erweiterung %s deaktiviert.", 'EXTENSION_PROBLEM_EXTENSION_NOT_INSTALLED' => "Kann nicht fortfahren! Fehler: Erweiterung %s nicht installiert.", 'EXTENSION_PROBLEM_UNSET_EXT' => "Skriptfehler: Parameter ext nicht gesetzt.", + 'EXTENSION_PROBLEM_EXTENSION_OUTDATED' => "Kann nicht fortfahren! Fehler Eine Erweiterung ist veraltet. Bitte benachrichten Sie den Support.", 'EXTENSION_WARNING_EXTENSION_INACTIVE' => "Die Erweiterung %s ist nicht aktiv. Dies kann zu Störungen führen.
\nBitte aktivieren Sie diese unter Verschiedenes->Erweiterungen.", 'EXTENSION_WARNING_USER_LIMIT' => "Die Erweiterung user ist nicht aktiv. Die Anzahl Mitglieder pro Seite wurde auf 100 gesetzt. Bitte aktivieren Sie diese unter Verschiedenes->Erweiterungen.", 'ADMIN_PROXY_SETTINGS_INVALID' => "Ihre Proxy-Einstellungen scheinen ungültig zu sein.", diff --git a/inc/modules/admin/what-add_rallye.php b/inc/modules/admin/what-add_rallye.php index aa8bc4371b..ac12eb6b8e 100644 --- a/inc/modules/admin/what-add_rallye.php +++ b/inc/modules/admin/what-add_rallye.php @@ -85,7 +85,7 @@ VALUES (%s,'%s','%s','%s',%s,%s,'%s','%s','%s')", // Overlapping detected loadTemplate('admin_settings_saved', false, '{--RALLYE_OVERLAP_TIMES--}'); } -} +} // END - if // Prepare some constants for the template $content['auto_add_options'] = generateOptionList('/ARRAY/', array('Y','N'), array('{--YES--}', '{--NO--}' )); diff --git a/inc/modules/admin/what-email_archiv.php b/inc/modules/admin/what-email_archiv.php index c132c629a5..b577121608 100644 --- a/inc/modules/admin/what-email_archiv.php +++ b/inc/modules/admin/what-email_archiv.php @@ -61,7 +61,7 @@ $result_maximum = SQL_QUERY($sql, __FILE__, __LINE__); // Set offset an current page to default values if (!isGetRequestParameterSet('page')) setGetRequestParameter('page' , 1); -if (!isGetRequestParameterSet('offset')) setGetRequestParameter('offset', getConfig('mails_page')); +if (!isGetRequestParameterSet('offset')) setGetRequestParameter('offset', getMailsPage()); // Add limitation to SQL string $sql .= ' LIMIT ' . (getRequestParameter('offset') * getRequestParameter('page') - getRequestParameter('offset')) . ', ' . getRequestParameter('offset'); @@ -70,7 +70,7 @@ $sql .= ' LIMIT ' . (getRequestParameter('offset') * getRequestParameter('page') $result = SQL_QUERY($sql, __FILE__, __LINE__); // Calculate pages -$numPages = round(SQL_NUMROWS($result_maximum) / getConfig('mails_page') + 0.5); +$numPages = round(SQL_NUMROWS($result_maximum) / getMailsPage() + 0.5); // Free the result which we don't need SQL_FREERESULT($result_maximum); @@ -79,8 +79,8 @@ if (!SQL_HASZERONUMS($result)) { // Mail orders are in pool so we can display them // Add navigation table rows - $content['top_email_nav'] = addEmailNavigation($numPages, getConfig('mails_page'), true , 3, true); - $content['bottom_email_nav'] = addEmailNavigation($numPages, getConfig('mails_page'), false, 3, true); + $content['top_email_nav'] = addEmailNavigation($numPages, getMailsPage(), true , 3, true); + $content['bottom_email_nav'] = addEmailNavigation($numPages, getMailsPage(), false, 3, true); // List all entries $OUT = ''; diff --git a/inc/modules/admin/what-email_details.php b/inc/modules/admin/what-email_details.php index 52775b3073..09e6922b4d 100644 --- a/inc/modules/admin/what-email_details.php +++ b/inc/modules/admin/what-email_details.php @@ -43,6 +43,13 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { // Add description as navigation point addYouAreHereLink('admin', __FILE__); +// Is 'sql_patches' updated? +if (!isExtensionInstalledAndNewer('sql_patches', '0.7.4')) { + // No, abort here + loadTemplate('admin_settings_saved', false, generateExtensionOutdatedMessage('sql_patches', '0.7.4')); + return false; +} // END - if + // Normal mails ordered by your members $sql = "SELECT `id`, `sender`, `subject`, `text`, `receivers`, `payment_id`, `data_type`, `timestamp`, `url`, `target_send`, `mails_sent`, `cat_id` @@ -97,7 +104,7 @@ WHERE `is_notify`='N' ORDER BY `timestamp` DESC", __FILE__, __LINE__); -} +} // END - if // Check for maximum pages $result_normal = SQL_QUERY($sql, __FILE__, __LINE__); @@ -108,7 +115,7 @@ if (!isGetRequestParameterSet('page')) setGetRequestParameter('page', 1); if (!isGetRequestParameterSet('offset')) { if (isConfigEntrySet('mails_page')) { // Set config entry - setGetRequestParameter('offset', getConfig('mails_page')); + setGetRequestParameter('offset', getMailsPage()); } else { // Set default one setGetRequestParameter('offset', 10); @@ -134,7 +141,7 @@ if ((!empty($SQL2)) && (empty($WHO))) $result_bonus = SQL_QUERY($SQL2, __FILE__, // Calculate pages $numPages = '0'; if (isConfigEntrySet('mails_page')) { - $numPages = round(SQL_NUMROWS($result_normal) / getConfig('mails_page') + 0.3); + $numPages = round(SQL_NUMROWS($result_normal) / getMailsPage() + 0.3); } // END - if // Free result @@ -171,7 +178,7 @@ if (!SQL_HASZERONUMS($result_list)) { SQL_FREERESULT($result_list); // Add navigation (with change box and colspan=3) - $content['nav'] = addEmailNavigation($numPages, getConfig('mails_page'), false, 3, true); + $content['nav'] = addEmailNavigation($numPages, getMailsPage(), false, 3, true); // Prepare content $content['rows'] = $OUT; @@ -191,7 +198,7 @@ if ((isExtensionActive('bonus')) && (empty($WHO))) { // Load bonus mails only when extension is active if (!SQL_HASZERONUMS($result_bonus)) { // Calculate pages - $numPages = round(SQL_NUMROWS($result_bonus) / getConfig('mails_page') + 0.5); + $numPages = round(SQL_NUMROWS($result_bonus) / getMailsPage() + 0.5); // List emails $OUT = ''; @@ -207,7 +214,7 @@ if ((isExtensionActive('bonus')) && (empty($WHO))) { } // END - while // Add navigation (without change box but with colspan=3) - $content['nav'] = addEmailNavigation($numPages, getConfig('mails_page'), false, 3, true); + $content['nav'] = addEmailNavigation($numPages, getMailsPage(), false, 3, true); // Prepare content $content['rows'] = $OUT; diff --git a/inc/modules/admin/what-list_notifications.php b/inc/modules/admin/what-list_notifications.php index f1f3bb9657..1323a6014e 100644 --- a/inc/modules/admin/what-list_notifications.php +++ b/inc/modules/admin/what-list_notifications.php @@ -49,7 +49,7 @@ $result_max = false; // Set offset an current page to default values if (!isGetRequestParameterSet('page')) setGetRequestParameter('page' , 1); -if (!isGetRequestParameterSet('offset')) setGetRequestParameter('offset', getConfig('mails_page')); +if (!isGetRequestParameterSet('offset')) setGetRequestParameter('offset', getMailsPage()); if (isExtensionActive('bonus')) { // Bonus mails sent by you @@ -83,7 +83,7 @@ if ((isExtensionActive('bonus')) && (!SQL_HASZERONUMS($result_max)) && (!empty($ // Load bonus mails only when extension is active if (!SQL_HASZERONUMS($result_bonus)) { // Calculate pages - $numPages = round(SQL_NUMROWS($result_bonus) / getConfig('mails_page') + 0.5); + $numPages = round(SQL_NUMROWS($result_bonus) / getMailsPage() + 0.5); // List emails $OUT = ''; $content = array(); @@ -99,7 +99,7 @@ if ((isExtensionActive('bonus')) && (!SQL_HASZERONUMS($result_max)) && (!empty($ } // END - if // Add navigation (without change box but with colspan=3) - $content['nav'] = addEmailNavigation($numPages, getConfig('mails_page'), false, 3, true); + $content['nav'] = addEmailNavigation($numPages, getMailsPage(), false, 3, true); // Prepare content $content['rows'] = $OUT; diff --git a/inc/template-functions.php b/inc/template-functions.php index f5f1c25965..1b9dacc836 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -1237,6 +1237,27 @@ function handleCodeMessage () { } // END - if } +// Generates a 'extension foo out-dated' message +function generateExtensionOutdatedMessage ($ext_name, $ext_ver) { + // Is the extension empty? + if (empty($ext_name)) { + // This should not happen + debug_report_bug(__FUNCTION__, __LINE__, 'Parameter ext is empty. This should not happen.'); + } // END - if + + // Default message + $message = getMaskedMessage('EXTENSION_PROBLEM_EXTENSION_OUTDATED', $ext_name); + + // Is an admin logged in? + if (isAdmin()) { + // Then output admin message + $message = sprintf(getMessage('ADMIN_EXTENSION_PROBLEM_EXTENSION_INACTIVE'), $ext_name, $ext_name, $ext_ver); + } // END - if + + // Return prepared message + return $message; +} + // Generates a 'extension foo inactive' message function generateExtensionInactiveMessage ($ext_name) { // Is the extension empty? diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 80a4236061..5941dd4967 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -2021,6 +2021,18 @@ function getMaxSend () { return $GLOBALS[__FUNCTION__]; } +// "Getter" for mails_page +function getMailsPage () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('mails_page'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + // "Getter" for __DB_NAME function getDbName () { // Do we have cache?