]> git.mxchange.org Git - mailer.git/commitdiff
Some more cleanups/improvements:
authorRoland Häder <roland@mxchange.org>
Sun, 18 Jul 2010 03:28:55 +0000 (03:28 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 18 Jul 2010 03:28:55 +0000 (03:28 +0000)
- New wrapper function isUrlBlacklistEnabled() introduced
- More usage of EL in templates
- Renames of array elements to make them the same as database column names
- Some SQLs improved
- TODOs.txt updated

21 files changed:
DOCS/TODOs.txt
inc/extensions/ext-bank.php
inc/functions.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-add_rallye.php
inc/modules/admin/what-config_admins.php
inc/modules/admin/what-config_cats.php
inc/modules/admin/what-del_holiday.php
inc/modules/admin/what-list_country.php
inc/modules/admin/what-list_payouts.php
inc/modules/admin/what-list_unconfirmed.php
inc/modules/admin/what-payments.php
inc/modules/admin/what-unlock_emails.php
inc/modules/member/what-order.php
inc/wrapper-functions.php
templates/de/emails/member/member_holiday_removed.tpl
templates/de/html/admin/admin_config_cats_row.tpl
templates/de/html/admin/admin_del_cats_row.tpl
templates/de/html/admin/admin_del_payments_row.tpl
templates/de/html/admin/admin_edit_cats_row.tpl
templates/de/html/admin/admin_edit_payments_row.tpl

index d414a4a53092ef81699031ae68130009de5dcd1e..41661cfa2af451063c55b2fbf8a3d279a7728a33 100644 (file)
 ./inc/modules/admin/what-adminedit.php:58:     // @TODO Kill all constants in this file
 ./inc/modules/admin/what-admins_mails.php:61:                          // @TODO Can this be rewritten to an API function?
 ./inc/modules/admin/what-bonus.php:48:// @TODO Unused at the moment
-./inc/modules/admin/what-config_admins.php:126:        // @TODO Rewrite this to filter 'run_sqls'
+./inc/modules/admin/what-config_admins.php:128:        // @TODO Rewrite this to filter 'run_sqls'
 ./inc/modules/admin/what-config_mods.php:57:                   // @TODO This can be moved into mysql-function.php, see checkModulePermissions() function
 ./inc/modules/admin/what-config_points.php:113:                        // @TODO Rewrite this to a filter
 ./inc/modules/admin/what-config_rallye_prices.php:197:                 // @TODO Rewrite these two constants
 ./inc/modules/admin/what-mem_add.php:126:                              // @TODO This can be somehow rewritten to a function
 ./inc/modules/admin/what-mem_add.php:65:               // @TODO Cant this be rewritten?
 ./inc/modules/admin/what-mem_add.php:81:               // @TODO This can be somehow rewritten to a function
-./inc/modules/admin/what-unlock_emails.php:89:                                 // @TODO Rewrite these if-blocks to a filter
+./inc/modules/admin/what-unlock_emails.php:86:                                 // @TODO Rewrite these if-blocks to a filter
 ./inc/modules/admin/what-usage.php:88: // @TODO This code is double, see loadTemplate() and loadEmailTemplate() in functions.php
 ./inc/modules/admin/what-usr_online.php:51:    // @TODO Add a filter for sponsor
 ./inc/modules/guest/what-beg.php:53:// @TODO No more needed? define('__BEG_UID_TIMEOUT', createFancyTime(getConfig('beg_userid_timeout')));
index 0d3677a0a7dbf007264b7d3f1367063b57aa2799..9560222266bf46a67b086463d0726e0b93a65557 100644 (file)
@@ -96,23 +96,23 @@ INDEX (day_bookkeeping, day_available)
 ) TYPE={?_TABLE_TYPE?}");
                addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bank_packages`');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_bank_packages` (
-id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-title VARCHAR(255) NOT NULL DEFAULT '',
-description TINYTEXT,
-account_fee FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
-free_transfers INT(7) UNSIGNED NOT NULL DEFAULT 0,
-transfer_fee FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
-available TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-output_system_mode ENUM('LOGIN','EMAIL','DISABLED'),
-package_active ENUM('Y','N') NOT NULL DEFAULT 'N',
-free_months_no_fee TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
-interest_plus FLOAT(7,5) UNSIGNED NOT NULL DEFAULT 0.00000,
-interest_minus FLOAT(7,5) UNSIGNED NOT NULL DEFAULT 0.00000,
-first_payment FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
-free_account_income FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
-free_account_stuff TINYTEXT null,
-tan_lock TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
-PRIMARY KEY (id)
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`title` VARCHAR(255) NOT NULL DEFAULT '',
+`description` TINYTEXT,
+`account_fee` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
+`free_transfers` INT(7) UNSIGNED NOT NULL DEFAULT 0,
+`transfer_fee` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
+`available` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+`output_system_mode` ENUM('LOGIN','EMAIL','DISABLED'),
+`package_active` ENUM('Y','N') NOT NULL DEFAULT 'N',
+`free_months_no_fee` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
+`interest_plus` FLOAT(7,5) UNSIGNED NOT NULL DEFAULT 0.00000,
+`interest_minus` FLOAT(7,5) UNSIGNED NOT NULL DEFAULT 0.00000,
+`first_payment` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
+`free_account_income` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
+`free_account_stuff` TINYTEXT null,
+`tan_lock` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
+PRIMARY KEY (`id`)
 ) TYPE={?_TABLE_TYPE?}");
                // free_account_stuff will be a list of columns of the table _bank_packages
                // what the member shall get for the specified income. output_system_mode
@@ -120,13 +120,13 @@ PRIMARY KEY (id)
                // should be fine. More than one entry and not DISABLED ;) are not supported.
                addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_bank_tanlist`');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_bank_tanlist` (
-id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-idx TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
-account_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-tan VARCHAR(50) NOT NULL DEFAULT '',
-used ENUM('Y','N') NOT NULL DEFAULT 'N',
-PRIMARY KEY (id),
-UNIQUE (account_id, tan)
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`idx` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
+`account_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`tan` VARCHAR(50) NOT NULL DEFAULT '',
+`used` ENUM('Y','N') NOT NULL DEFAULT 'N',
+PRIMARY KEY (`id`),
+UNIQUE (`account_id`, `tan`)
 ) TYPE={?_TABLE_TYPE?}");
 
                // Admin menu queries
@@ -184,7 +184,7 @@ UNIQUE (account_id, tan)
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes('');
                                break;
-               }
+               } // END - switch
                break;
 
        case 'modify': // When the extension got modified
@@ -199,7 +199,7 @@ UNIQUE (account_id, tan)
        default: // Unknown extension mode
                logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
                break;
-}
+} // END - switch
 
 // [EOF]
 ?>
index 4faea4e7f50a1a1b847f6f6b20ed0302746a1680..944d0281ee1c328c72142c28e21758554711eb7c 100644 (file)
@@ -1198,7 +1198,7 @@ function generateHash ($plainText, $salt = '', $hash = true) {
 }
 
 // Scramble a string
-function scrambleString($str) {
+function scrambleString ($str) {
        // Init
        $scrambled = '';
 
@@ -1233,7 +1233,7 @@ function scrambleString($str) {
 }
 
 // De-scramble a string scrambled by scrambleString()
-function descrambleString($str) {
+function descrambleString ($str) {
        // Scramble only 40 chars long strings
        if (strlen($str) != 40) return $str;
 
@@ -1361,7 +1361,7 @@ function getCurrentTheme () {
 }
 
 // Generates an error code from given account status
-function generateErrorCodeFromUserStatus ($status='') {
+function generateErrorCodeFromUserStatus ($status = '') {
        // If no status is provided, use the default, cached
        if ((empty($status)) && (isMember())) {
                // Get user status
@@ -1507,9 +1507,9 @@ function getMessageFromErrorCode ($code) {
 
                        // Finally contruct the message
                        // @TODO Rewrite this old lost code to a template
-                       $message = "{--MEMBER_URL_TIME_LOCK--}<br />{--CONFIG_URL_TLOCK--} ".$STD."
-                       {--_HOURS--}, ".$MIN." {--_MINUTES--} {--_AND--} ".$SEC." {--_SECONDS--}<br />
-                       {--MEMBER_LAST_TLOCK--}: ".$timestamp;
+                       $message = '{--MEMBER_URL_TIME_LOCK--}<br />{--CONFIG_URL_TLOCK--} ' . $STD . '
+                       {--_HOURS--}, ' . $MIN . ' {--_MINUTES--} {--_AND--} ' . $SEC . ' {--_SECONDS--}<br />
+                       {--MEMBER_LAST_TLOCK--}: ' . $timestamp;
                        break;
 
                default:
@@ -1575,9 +1575,9 @@ function isUrlValidSimple ($url) {
                // Debug regex?
                if (isDebugRegularExpressionEnabled()) {
                        // @TODO Are these convertions still required?
-                       $pat = str_replace('.', "&#92;&#46;", $pat);
-                       $pat = str_replace('@', "&#92;&#64;", $pat);
-                       //* DEBUG: */ debugOutput($key."=&nbsp;" . $pat);
+                       $pat = str_replace('.', '&#92;&#46;', $pat);
+                       $pat = str_replace('@', '&#92;&#64;', $pat);
+                       //* DEBUG: */ debugOutput($key . '=&nbsp;' . $pat);
                } // END - if
 
                // Check if expression matches
@@ -1792,7 +1792,7 @@ function handleLoginFailures ($accessLevel) {
                // Ignore zero values
                if (getSession('mailer_' . $accessLevel . '_failures') > 0) {
                        // Non-guest has login failures found, get both data and prepare it for template
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "accessLevel={$accessLevel}<br />");
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'accessLevel=' . $accessLevel . '<br />');
                        $content = array(
                                'login_failures' => 'mailer_' . $accessLevel . '_failures',
                                'last_failure'   => generateDateTime(getSession('mailer_' . $accessLevel . '_last_failure'), 2)
@@ -2058,7 +2058,7 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad
        $excludeArray[] = '.svn';
        $excludeArray[] = '.htaccess';
 
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "baseDir={$baseDir},prefix={$prefix} - Entered!");
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'baseDir=' . $baseDir . ',prefix=' . $prefix . ' - Entered!');
        // Init includes
        $files = array();
 
@@ -2101,20 +2101,20 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad
                        continue;
                } elseif (substr($baseFile, 0, strlen($prefix)) != $prefix) {
                        // Skip this file
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "Invalid prefix in file " . $baseFile . ", prefix=" . $prefix);
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Invalid prefix in file ' . $baseFile . ', prefix=' . $prefix);
                        continue;
                } elseif ((!empty($suffix)) && (substr($baseFile, -(strlen($suffix . $extension)), (strlen($suffix . $extension))) != $suffix . $extension)) {
                        // Skip wrong suffix as well
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "Invalid suffix in file " . $baseFile . ", suffix=" . $suffix);
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Invalid suffix in file ' . $baseFile . ', suffix=' . $suffix);
                        continue;
                } elseif (!isFileReadable($FQFN)) {
                        // Not readable so skip it
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "File " . $FQFN . " is not readable!");
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'File ' . $FQFN . ' is not readable!');
                        continue;
                }
 
                // Is the file a PHP script or other?
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "baseDir={$baseDir},prefix={$prefix},baseFile={$baseFile}");
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'baseDir=' . $baseDir . ',prefix=' . $prefix . ',baseFile=' . $baseFile);
                if ((substr($baseFile, -4, 4) == '.php') || (($fileIncludeDirs === true) && (isDirectory($FQFN)))) {
                        // Is this a valid include file?
                        if ($extension == '.php') {
index 12d20dcf4abdd854c4a16fe3898d5bc0daa4da70..b95b6a2523e4e2f4c43634bb6a038a82de585f32 100644 (file)
@@ -662,7 +662,7 @@ function adminGetMenuMode () {
                incrementStatsEntry('cache_hits');
        } elseif (isExtensionInstalledAndNewer('admins', '0.6.7')) {
                // Load from database when version of 'admins' is enough
-               $result = SQL_QUERY_ESC("SELECT la_mode FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1",
+               $result = SQL_QUERY_ESC("SELECT `la_mode` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1",
                        array($adminId), __FUNCTION__, __LINE__);
 
                // Do we have an entry?
index d276330b9e383cf26eb3cf8501e04cb8cafe3fdb..608b557b07fe161756834e3813f8bd746ff8cacb 100644 (file)
@@ -56,8 +56,8 @@ if (isFormSent()) {
 
        if (SQL_HASZERONUMS($result)) {
                // Ok, start and end time did not overlap
-               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_rallye_data` (admin_id, title, descr, template, start_time, end_time, auto_add_new_user, is_active, send_notify)
-VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s')",
+               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_rallye_data` (`admin_id`, `title`, `descr`, template, `start_time`, `end_time`, `auto_add_new_user`, `is_active`, `send_notify`)
+VALUES (%s,'%s','%s','%s',%s,%s,'%s','%s','%s')",
                        array(
                                getCurrentAdminId(),
                                postRequestParameter('title'),
@@ -71,10 +71,7 @@ VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s')",
                        ), __FILE__, __LINE__);
 
                // Load id
-               $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE start_time='%s' AND end_time='%s' AND `title`='%s' LIMIT 1",
-               array($START, $END, postRequestParameter('title')), __FILE__, __LINE__);
-               list($id) = SQL_FETCHROW($result);
-               SQL_FREERESULT($result);
+               $id = SQL_INSERTID();
 
                if (!empty($id)) {
                        // Reload to prices...
index 0536e327e099bf4e2a92997e3ddfbcc47f209bf3..5c73970d35253dc59983d5a79a07fd275b9d3527 100644 (file)
@@ -50,17 +50,19 @@ if ((isFormSent('edit')) && (ifPostContainsSelections())) {
        $OUT = '';
        foreach (postRequestParameter('sel') as $id => $selected) {
                // Load data for the id
-               $result = SQL_QUERY_ESC("SELECT admin_id, action_menu, what_menu, access_mode FROM `{?_MYSQL_PREFIX?}_admins_acls` WHERE `id`=%s LIMIT 1",
+               $result = SQL_QUERY_ESC("SELECT `id`, `admin_id`, `action_menu, `what_menu`, `access_mode` FROM `{?_MYSQL_PREFIX?}_admins_acls` WHERE `id`=%s LIMIT 1",
                        array(bigintval($id)), __FILE__, __LINE__);
-               list($adminId, $action, $what, $mode) = SQL_FETCHROW($result);
+               $content = SQL_FETCHARRAY($result);
+
+               // Free result
                SQL_FREERESULT($result);
 
                // Prepare data for the row template
                $content = array(
-                       'id'               => $id,
-                       'admins_selection' => generateOptionList('admins', 'id', 'login', $adminId, 'default_acl'),
-                       'action_selection' => adminMenuSelectionBox_DEPRECATED('action', $action, $id),
-                       'what_selection'   => adminMenuSelectionBox_DEPRECATED('what', $what, $id),
+                       'id'               => $content['id'],
+                       'admins_selection' => generateOptionList('admins', 'id', 'login', $content['admin_id'], 'default_acl'),
+                       'action_selection' => adminMenuSelectionBox_DEPRECATED('action', $content['action_menu'], $content['id']),
+                       'what_selection'   => adminMenuSelectionBox_DEPRECATED('what', $content['what_menu'], $content['id']),
                        'mode_options'     => generateOptionList(
                                '/ARRAY/',
                                array('allow', 'deny'),
@@ -68,7 +70,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections())) {
                                        '{--ADMINS_ALLOW_MODE--}',
                                        '{--ADMINS_DENY_MODE--}'
                                ),
-                               $mode
+                               $content['access_mode']
                        ),
                );
 
@@ -219,8 +221,8 @@ VALUES ('%s','%s','%s','%s')",
                '/ARRAY/',
                array('allow', 'deny'),
                array(
-                       'ADMINS_ALLOW_MODE--}',
-                       'ADMINS_DENY_MODE--}'
+                       '{--ADMINS_ALLOW_MODE--}',
+                       '{--ADMINS_DENY_MODE--}'
                )
        );
 
index 4b5430a248dfcb60e70927393b5a03022fec4901..feffa1cfb374d03037e8ce0f7677cbf2c6ae69ac 100644 (file)
@@ -86,7 +86,7 @@ if (isFormSent('add')) {
                                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_cats` SET `cat`='%s', `visible`='%s', `sort`=%s WHERE `id`=%s LIMIT 1",
                                                array(
                                                        $cat,
-                                                       postRequestParameter('vis', $id),
+                                                       postRequestParameter('visible', $id),
                                                        postRequestParameter('sort', $id),
                                                        $id
                                                ), __FILE__, __LINE__);
@@ -115,22 +115,8 @@ if (isFormSent('add')) {
        // Delete categories
        $OUT = '';
        foreach (postRequestParameter('sel') as $id => $value) {
-               // Load data of category
-               $result = SQL_QUERY_ESC("SELECT `cat` FROM `{?_MYSQL_PREFIX?}_cats` WHERE `id`=%s LIMIT 1",
-                       array(bigintval($id)), __FILE__, __LINE__);
-               list($cat) = SQL_FETCHROW($result);
-
-               // Free result
-               SQL_FREERESULT($result);
-
-               // Prepare data for the row template
-               $content = array(
-                       'id'  => $id,
-                       'cat' => $cat,
-               );
-
                // Load row template and switch colors
-               $OUT .= loadTemplate('admin_del_cats_row', true, $content);
+               $OUT .= loadTemplate('admin_del_cats_row', true, $id);
        } // END - foreach
 
        // Load main template
@@ -140,18 +126,15 @@ if (isFormSent('add')) {
        $OUT = '';
        foreach (postRequestParameter('sel') as $id => $value) {
                // Load data from the category
-               $result = SQL_QUERY_ESC("SELECT cat, visible, sort FROM `{?_MYSQL_PREFIX?}_cats` WHERE `id`=%s LIMIT 1",
-               array(bigintval($id)), __FILE__, __LINE__);
-               list($cat, $vis, $sort) = SQL_FETCHROW($result);
+               $result = SQL_QUERY_ESC("SELECT `id`, `visible`, `sort` FROM `{?_MYSQL_PREFIX?}_cats` WHERE `id`=%s LIMIT 1",
+                       array(bigintval($id)), __FILE__, __LINE__);
+               $content = SQL_FETCHARRAY($result);
+
+               // Free result
                SQL_FREERESULT($result);
 
                // Prepare data for the row template
-               $content = array(
-                       'id'   => $id,
-                       'cat'  => $cat,
-                       'vis'  => addSelectionBox('yn', $vis, 'vis', $id),
-                       'sort' => $sort,
-               );
+               $content['visible_selection'] = addSelectionBox('yn', $content['visible'], 'visible', $content['id'])
 
                // Load row template and switch colors
                $OUT .= loadTemplate('admin_edit_cats_row', true, $content);
@@ -171,9 +154,6 @@ if (isFormSent('add')) {
 
                // List already existing categories for editing
                while ($content = SQL_FETCHARRAY($result)) {
-                       // Prepare data for the row template
-                       $content['vis'] = translateYesNo($content['visible']);
-
                        // Put cat descriptions into variable for the selection box
                        $cat = $content['cat'];
                        if (strlen($cat) > 40) $cat = substr($cat, 0, 37) . '...';
index 55b4d6159e3644b69de2a0735e1db9badf3c2112..3e808092d3f85352d062894f71bf855be4394390 100644 (file)
@@ -60,8 +60,7 @@ WHERE
 LIMIT 1", array(bigintval($id)), __FILE__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Load data and free memory
-                       list($userid, $start, $end) = SQL_FETCHROW($result);
-                       SQL_FREERESULT($result);
+                       $content = SQL_FETCHARRAY($result);
 
                        // Update user's account
                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data`
@@ -70,7 +69,7 @@ SET
        `holiday_activated`=0
 WHERE
        `userid`=%s
-LIMIT 1", array(bigintval($userid)), __FILE__, __LINE__);
+LIMIT 1", array(bigintval($content['userid'])), __FILE__, __LINE__);
 
                        // Remove holiday
                        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM
@@ -80,17 +79,18 @@ WHERE
 LIMIT 1", array(bigintval($id)), __FILE__, __LINE__);
 
                        // Prepare loaded data for the
-                       $content = array(
-                               'start' => generateDateTime($start, 3),
-                               'end'   => generateDateTime($end  , 3)
-                       );
+                       $content['holiday_start'] = generateDateTime($content['holiday_start'], 3);
+                       $content['holiday_end']   = generateDateTime($content['holiday_end']  , 3);
 
                        // Send email to user
-                       $message = loadEmailTemplate('member_holiday_removed', $content, $userid);
-                       sendEmail($userid, '{--ADMIN_HOLIDAY_REMOVED_SUBJECT--}', $message);
+                       $message = loadEmailTemplate('member_holiday_removed', $content, $content['userid']);
+                       sendEmail($content['userid'], '{--ADMIN_HOLIDAY_REMOVED_SUBJECT--}', $message);
                        $cnt++;
-               }
-       }
+               } // END - if
+
+               // Free result
+               SQL_FREERESULT($result);
+       } // END - foreach
        loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_HOLIDAY_MULTI_DEL', $cnt));
 } elseif (isGetRequestParameterSet('userid')) {
        // Set default message
@@ -98,7 +98,7 @@ LIMIT 1", array(bigintval($id)), __FILE__, __LINE__);
 
        // Fetch data
        $result_load = SQL_QUERY_ESC("SELECT
-       `holiday_start` AS start, `holiday_end` AS end
+       `holiday_start` AS start, `holiday_end` AS `end`
 FROM
        `{?_MYSQL_PREFIX?}_user_holidays`
 WHERE
index a419063cf565151840ed95cae7bac53adc81e3e1..1525b03830f3bf709bc5788144f1e25aee63d437 100644 (file)
@@ -104,19 +104,11 @@ if ((isFormSent('add')) && (isPostRequestParameterSet('code')) && (isPostRequest
                $OUT = '';
                foreach (postRequestParameter('id') as $id => $status) {
                        // Load data from DB
-                       $result = SQL_QUERY_ESC("SELECT code, descr FROM `{?_MYSQL_PREFIX?}_countries` WHERE `id`=%s LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT `id`, `code`, `descr` FROM `{?_MYSQL_PREFIX?}_countries` WHERE `id`=%s LIMIT 1",
                                array(bigintval($id)), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result) == 1) {
                                // Load data
-                               list($code, $descr) = SQL_FETCHROW($result);
-                               SQL_FREERESULT($result);
-
-                               // Prepare data, load row template and switch colors
-                               $content = array(
-                                       'id'    => $id,
-                                       'code'  => $code,
-                                       'descr' => $descr,
-                               );
+                               $content = SQL_FETCHARRAY($result);
 
                                if ($post == 'modify') {
                                        // Generate default selection in edit-mode
@@ -129,6 +121,9 @@ if ((isFormSent('add')) && (isPostRequestParameterSet('code')) && (isPostRequest
                                // Insert row template and switch color
                                $OUT .= loadTemplate($row, true, $content);
                        } // END - if
+
+                       // Free result
+                       SQL_FREERESULT($result);
                } // END - foreach
 
                // Prepare content for template
index 0d9ad579c4414b1708263f4c31124f70d912edd1..9a95ae69504833b3ac550d2075d9c7af904d4ff3 100644 (file)
@@ -57,18 +57,18 @@ if (isGetRequestParameterSet('pid')) {
                // Get task id from database
                $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `userid`=%s AND `task_type`='PAYOUT_REQUEST' AND `task_created`=%s LIMIT 1",
                        array(bigintval($userid), bigintval($tstamp)), __FILE__, __LINE__);
-               list($task) = SQL_FETCHROW($result);
+               list($taskId) = SQL_FETCHROW($result);
                SQL_FREERESULT($result);
-               if (empty($task)) $task = '0';
+               if (empty($taskId)) $taskId = '0';
        } elseif ((empty($userid)) || ($userid == '0')) {
                // Cannot obtain member id!
                loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_FAILED_OBTAIN_USERID--}');
        } else {
                // Get task id from URL
-               $task = getRequestParameter('task');
+               $taskId = getRequestParameter('task');
        }
 
-       if ((!empty($task)) && (!empty($userid)) && ($userid > 0)) {
+       if ((!empty($taskId)) && (!empty($userid)) && ($userid > 0)) {
                // Load user's data
                if (!fetchUserData($userid)) {
                        // Abort here because it is not valid!
@@ -117,7 +117,7 @@ LIMIT 1",
                                                                $data['from_pass'] = base64_encode($data['from_pass']);
                                                                $tpass = base64_encode($tpass);
                                                                break;
-                                               }
+                                               } // END - switch
 
                                                // Transfer variables...
                                                $reason = encodeString(getMessage('ADMIN_PAYOUT_REASON'), false);
@@ -131,8 +131,8 @@ LIMIT 1",
 
                                        if ($ret[0] == $data['engine_ret_ok']) {
                                                // Clear task
-                                               if ($task > 0) {
-                                                       runFilterChain('solve_task', $task);
+                                               if ($taskId > 0) {
+                                                       runFilterChain('solve_task', $taskId);
                                                }
 
                                                // Clear payout request
@@ -165,7 +165,7 @@ LIMIT 1",
                        } else {
                                // Prepare content
                                $content = array(
-                                       'task' => $task,
+                                       'task' => $taskId,
                                        'pid'  => bigintval(getRequestParameter('pid')),
                                        'user' => '<a href="' . generateEmailLink(getUserData('email'), 'user_data') . '">' . translateGender(getUserData('gender')) . ' ' . getUserData('surname') . ' ' . getUserData('family') . '</a>',
                                );
@@ -176,9 +176,9 @@ LIMIT 1",
                } elseif ((getRequestParameter('do') == 'reject') && (getUserData('email') != '')) {
                        // Ok, now we can output the form or execute rejecting
                        if (isFormSent()) {
-                               if ($task > 0) {
+                               if ($taskId > 0) {
                                        // Clear task
-                                       runFilterChain('solve_task', $task);
+                                       runFilterChain('solve_task', $taskId);
                                } // END - if
 
                                // Clear payout request
@@ -196,7 +196,7 @@ LIMIT 1",
                        } else {
                                // Prepare content
                                $content = array(
-                                       'task' => $task,
+                                       'task' => $taskId,
                                        'pid'  => bigintval(getRequestParameter('pid')),
                                        'user' => '<a href="' . generateEmailLink(getUserData('email'), 'user_data') . '">' . translateGender(getUserData('gender')) . ' ' . getUserData('surname') . ' ' . getUserData('family') . '</a>',
                                );
@@ -208,7 +208,7 @@ LIMIT 1",
                        // Cannot load user data
                        loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_FAILED_OBTAIN_USERDATA--}');
                }
-       } elseif ((empty($task)) || ($task == '0')) {
+       } elseif ((empty($taskId)) || ($taskId == '0')) {
                // Failed loading task id
                loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_FAILED_OBTAIN_TASK_ID--}');
        }
index 9ef88e563553176ffc2be97e1b7978411ed88b5b..4fbcbbecaf90d9bdca90678d7f856b75cd24f130 100644 (file)
@@ -177,25 +177,16 @@ LIMIT %s",
                loadTemplate('admin_list_unconfirmed', false, $content);
        } elseif (getRequestParameter('mid') > 0) {
                // Data in pool or in user_stats not found, so let's find out where data is missing
-               $result1 = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1",
-                       array(bigintval($ID)), __FILE__, __LINE__);
-               $result2 = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
-                       array(bigintval($ID)), __FILE__, __LINE__);
-
-               if (SQL_NUMROWS($result1) == 1) {
+               if (countSumTotalData(bigintval($ID), 'pool', 'id', 'id', true) == 1) {
                        // pool table
                        loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_UNCONFIRMED_POOL_MISSING', $ID));
-               } elseif (SQL_NUMROWS($result2) == 1) {
+               } elseif (countSumTotalData(bigintval($ID), 'user_stats', 'id', 'pool_id', true) == 1) {
                        // user_stats table
                        loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_UNCONFIRMED_STATS_MISSING', $ID));
                } else {
                        // both or link is invalid
                        loadTemplate('admin_settings_saved', false, '{--ADMIN_UNCONFIRMED_INVALID_LINK--}');
                }
-
-               // Free memory
-               SQL_FREERESULT($result1);
-               SQL_FREERESULT($result2);
        } elseif (isGetRequestParameterSet('bid')) {
                // Data in bonus table not found
                loadTemplate('admin_settings_saved', false, '{--ADMIN_UNCONFIRMED_INVALID_LINK--}');
index 2860ab6933860b50a393895b9144f64318519700..71dad294d453508ec150b0d1cc3615d5c0a34720 100644 (file)
@@ -53,27 +53,22 @@ if (isFormSent()) {
        switch (getRequestParameter('do')) {
                case 'add':
                        addSql("INSERT INTO `{?_MYSQL_PREFIX?}_payments` (`time`, `payment`, `mail_title`, `price`) VALUES ('".postRequestParameter('t_wait')."','".postRequestParameter('payment')."','".postRequestParameter('title')."','".postRequestParameter('price')."')");
-                       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_payments` WHERE `time`='%s' LIMIT 1",
-                               array(postRequestParameter('t_wait')), __FILE__, __LINE__);
-                       if (SQL_NUMROWS($result) == 1) {
+                       if (countSumTotalData(postRequestParameter('t_wait'), 'payments', 'id', 'time', true) == 1) {
                                // Re-init the array here
                                initSqls();
-
-                               // Free memory
-                               SQL_FREERESULT($result);
-                       }
+                       } // END - if
                        break;
 
                case 'edit':
                        foreach (postRequestParameter('time') as $id => $value) {
-                               addSql("UPDATE `{?_MYSQL_PREFIX?}_payments` SET `time`='" . $value . "', `payment`='".postRequestParameter('pay', $id)."', price='".postRequestParameter('price', $id)."', mail_title='".postRequestParameter('title', $id)."' WHERE `id`='".$id."' LIMIT 1");
-                       }
+                               addSql("UPDATE `{?_MYSQL_PREFIX?}_payments` SET `time`='" . $value . "', `payment`='".postRequestParameter('payment', $id)."', price='".postRequestParameter('price', $id)."', mail_title='".postRequestParameter('mail_title', $id)."' WHERE `id`='".$id."' LIMIT 1");
+                       } // END - foreach
                        break;
 
                case 'del':
                        foreach (postRequestParameter('id') as $id => $value) {
                                addSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=" . bigintval($id) . " LIMIT 1");
-                       }
+                       } // END - foreach
                        break;
        } // END - switch
 
@@ -93,17 +88,12 @@ if (isFormSent()) {
        // Delete entries here
        $OUT = '';
        foreach (postRequestParameter('sel') as $id => $value) {
-               $result = SQL_QUERY_ESC("SELECT time, mail_title FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1",
-               array(bigintval($id)), __FILE__, __LINE__);
-               list($time, $title) = SQL_FETCHROW($result);
-               SQL_FREERESULT($result);
+               $result = SQL_QUERY_ESC("SELECT `id`, `time`, `mail_title` FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1",
+                       array(bigintval($id)), __FILE__, __LINE__);
+               $content = SQL_FETCHARRAY($result);
 
-               // Prepare array for the row template
-               $content = array(
-                       'id'    => $id,
-                       'time'  => $time,
-                       'title' => $title,
-               );
+               // Free result
+               SQL_FREERESULT($result);
 
                // Load row template and switch colors
                $OUT .= loadTemplate('admin_del_payments_row', true, $content);
@@ -115,19 +105,12 @@ if (isFormSent()) {
        // Edit entries
        $OUT = '';
        foreach (postRequestParameter('sel') as $id => $value) {
-               $result = SQL_QUERY_ESC("SELECT time, payment, mail_title, price FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1",
-               array(bigintval($id)), __FILE__, __LINE__);
-               list($time, $pay, $title, $price) = SQL_FETCHROW($result);
-               SQL_FREERESULT($result);
+               $result = SQL_QUERY_ESC("SELECT `id`, `time`, `payment`, `mail_title`, `price` FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1",
+                       array(bigintval($id)), __FILE__, __LINE__);
+               $content = SQL_FETCHARRAY($result);
 
-               // Prepare array for the row template
-               $content = array(
-                       'id'    => $id,
-                       'time'  => $time,
-                       'title' => $title,
-                       'pay'   => $pay,
-                       'price' => $price,
-               );
+               // Free result
+               SQL_FREERESULT($result);
 
                // Load row template and switch colors
                $OUT .= loadTemplate('admin_edit_payments_row', true, $content);
index 52faf0d8a9498ad94bb1af7966f2f570c9aea5c6..63affb3672e111feae1b9b1e394dd161559f489a 100644 (file)
@@ -82,9 +82,6 @@ LIMIT 1",
                                        // Load data
                                        $content = SQL_FETCHARRAY($result);
 
-                                       // Free result
-                                       SQL_FREERESULT($result);
-
                                        // Is the surfbar installed?
                                        // @TODO Rewrite these if-blocks to a filter
                                        if ((isExtensionActive('surfbar')) && (getConfig('surfbar_migrate_order') == 'Y')) {
@@ -112,6 +109,9 @@ LIMIT 1",
                                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='NEW' WHERE `id`=%s AND `data_type`='ADMIN' LIMIT 1",
                                                array($id), __FILE__, __LINE__);
                                } // END - if
+
+                               // Free result
+                               SQL_FREERESULT($result);
                        } // END - foreach
 
                        // Set message
@@ -168,7 +168,7 @@ LIMIT 1",
                        // Nothing selected
                        loadTemplate('admin_settings_saved', false, '{--ADMIN_MAILS_NOTHING_CHECKED--}');
                }
-       } elseif ((isFormSent('lock')) && (ifPostContainsSelections()) && (getConfig('url_blacklist') == 'Y')) {
+       } elseif ((isFormSent('lock')) && (ifPostContainsSelections()) && (isUrlBlaskEnabled())) {
                // Lock URLs
                foreach (postRequestParameter('sel') as $id => $url) {
                        // Secure id number
@@ -208,7 +208,7 @@ LIMIT 1",
 
                // Load main template
                loadTemplate('admin_unlock_emails', false, $content);
-       } elseif ((isFormSent('lock')) && (getConfig('url_blacklist') != 'Y')) {
+       } elseif ((isFormSent('lock')) && (!isUrlBlaskEnabled())) {
                // URL blacklist not activated
                loadTemplate('admin_settings_saved', false, '{--ADMIN_URL_BLACKLIST_DISABLED--}');
        } else {
index 1b1dd1984c29df084f31ad63e4dd97a93faa967c..95b162d533ddbcfcfe56eae920f98d4d8de46c9f 100644 (file)
@@ -122,7 +122,7 @@ LIMIT 1",
                } // END - if
 
                // And shall I check that his URL is not in the black list?
-               if (getConfig('url_blacklist') == 'Y') {
+               if (isUrlBlaskEnabled()) {
                        // Ok, I do that for you know...
                        $result = SQL_QUERY_ESC("SELECT UNIX_TIMESTAMP(`timestamp`) AS tstamp FROM `{?_MYSQL_PREFIX?}_url_blacklist` WHERE `url`='%s' LIMIT 1",
                                array(postRequestParameter('url')), __FILE__, __LINE__);
index 934e42f5f7cb5f989a7a0e6494a9bb4320d82c17..9dc7ea639874adf953ac0924e69335735cd33131 100644 (file)
@@ -1850,5 +1850,17 @@ function getTotalPoints ($userid) {
        return $GLOBALS['total_points'][$userid];
 }
 
+// Wrapper to check if url_blacklist is enabled
+function isUrlBlacklistEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['is_url_blacklist_enabled'])) {
+               // Determine it
+               $GLOBALS['is_url_blacklist_enabled'] = (getConfig('url_blacklist') == 'Y');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['is_url_blacklist_enabled'];
+}
+
 // [EOF]
 ?>
index ffe3a8baf56fd8fbfa6d4dedddf5e352bee0db1e..c27d32b8eb6280622aa9085666434f3b9a6777f0 100644 (file)
@@ -9,9 +9,9 @@ E-Mail Adresse: {%user,email=$userid%}
 ------------------------------
 Vor-, Nachname: {%user,gender,translateGender=$userid%} {%user,surname=$userid%} {%user,family=$userid%}
 ------------------------------
-Anfang Ihres Urlaubes: $content[start]
+Anfang Ihres Urlaubes: $content[holiday_start]
 ------------------------------
-Ende Ihres Urlaubes: $content[end]
+Ende Ihres Urlaubes: $content[holiday_end]
 ------------------------------
 
 Ihre Urlaubsschaltung ist hiermit wieder aufgehoben. Sie k&ouml;nnen wieder Mails buchen.
index 7a6b5ae668eb2ab78790ffa3e93a4c43c803d9a3..fff42fc1a0f6e8b5e695f9be81eb1953e885020c 100644 (file)
@@ -3,10 +3,10 @@
                <input type="checkbox" class="admin_normal" title="{--ID_SELECT--} $content[id]" name="sel[$content[id]]" value="1" />
        </td>
        <td class="bottom right {%template,ColorSwitch%}">
-               $content[cat]
+               {%pipe,getCategory=$content[id]%}
        </td>
        <td align="center" class="bottom right {%template,ColorSwitch%}">
-               $content[vis]
+               {%pipe,translateComma=$content[visible]%}
        </td>
        <td align="center" class="bottom {%template,ColorSwitch%}">
                $content[sort]
index 1707006f80849744f1ec0779b3b604403cc6ad85..8578fb27776f9ae0570c661c7230ed38670af118 100644 (file)
@@ -1,10 +1,11 @@
 <tr>
        <td align="center" class="{%template,ColorSwitch%}">
-               <strong>{--ADMIN_CATEGORY_ID--} $content[id]:</strong>
+               <strong>{--ADMIN_CATEGORY_ID--} $content:</strong>
        </td>
 </tr>
 <tr>
        <td align="center" class="{%template,ColorSwitch%} bottom">
-               $content[cat] <input type="hidden" name="id[$content[id]]" value="1" />
+               {%pipe,getCategory=$content[id]%}
+               <input type="hidden" name="id[$content]" value="1" />
        </td>
 </tr>
index 70f2ef6628f6095db7531605bcc9a75071ab5e3d..6335924efeb1ede4fd974c76fc3a0b6f57dc4fa3 100644 (file)
@@ -1,11 +1,11 @@
 <tr>
        <td class="admin_title bottom" height="20" align="center">
-               <strong>{--PAYMENT_ID--} $content[id]:</strong>
+               <strong>{--ADMIN_PAYMENT_ID--} $content[id]:</strong>
        </td>
 </tr>
 <tr>
        <td align="center" class="{%template,ColorSwitch%} bottom">
-               $content[time] {--_SECONDS--} ($content[title])
+               $content[time] {--_SECONDS--} ($content[mail_title])
                <input type="hidden" name="id[$content[id]]" value="1" />
        </td>
 </tr>
index 4e9587dd67edd4c43a2f6fa67d702619f2cf54a3..86693f8507024a435ca18fdbb19883ecb34ce962 100644 (file)
@@ -6,12 +6,12 @@
 <tr>
        <td align="right" class="{%template,ColorSwitch%}">{--ADMIN_CATEGORY_DESCRIPTION--}:&nbsp;</td>
        <td class="{%template,ColorSwitch%}">
-               <input type="text" name="id[$content[id]]" class="admin_normal" value="$content[cat]" size="32" maxlength="255" />
+               <input type="text" name="id[$content[id]]" class="admin_normal" value="{%pipe,getCategory=$content[id]%}" size="32" maxlength="255" />
        </td>
 </tr>
 <tr>
        <td class="{%template,ColorSwitch%}" align="right">{--CAT_IS_VISIBLE--}&nbsp;</td>
-       <td class="{%template,ColorSwitch%}">$content[vis]</td>
+       <td class="{%template,ColorSwitch%}">$content[visible_selection]</td>
 </tr>
 <tr>
        <td class="{%template,ColorSwitch%} bottom" align="right">{--SORT_KEY--}:&nbsp;</td>
index 9f55cbdc762b45f46563067ba5b58a9989cda178..27687c9cb070aadaf5198297685da739e9baa042 100644 (file)
@@ -1,30 +1,30 @@
 <tr>
        <td class="admin_title bottom" colspan="2" align="center">
-               <strong>{--PAYMENT_ID--} $content[id]:</strong>
+               <strong>{--ADMIN_PAYMENT_ID--} $content[id]:</strong>
        </td>
 </tr>
 <tr>
-       <td class="{%template,ColorSwitch%}" align="right">{--PAY_TIME--}:</td>
+       <td class="{%template,ColorSwitch%}" align="right">{--ADMIN_PAYMENT_TIME--}:</td>
        <td class="{%template,ColorSwitch%}">
                <input type="text" name="time[$content[id]]" class="admin_normal" value="$content[time]" size="3" maxlength="5" />{--_SECONDS--}
        </td>
 </tr>
 <tr>
-       <td class="{%template,ColorSwitch%}" align="right">{--PAY_PAYMENT--}:</td>
+       <td class="{%template,ColorSwitch%}" align="right">{--ADMIN_PAYMENT_PAYMENT--}:</td>
        <td class="{%template,ColorSwitch%}">
-               <input type="text" name="pay[$content[id]]" class="admin_normal" value="$content[pay]" size="5" maxlength="8" />{?POINTS?}
+               <input type="text" name="payment[$content[id]]" class="admin_normal" value="$content[payment]" size="5" maxlength="8" />{?POINTS?}
        </td>
 </tr>
 <tr>
-       <td class="{%template,ColorSwitch%}" align="right">{--PAY_PRICE--}:</td>
+       <td class="{%template,ColorSwitch%}" align="right">{--ADMIN_PAYMENT_PRICE--}:</td>
        <td class="{%template,ColorSwitch%}">
                <input type="text" name="price[$content[id]]" class="admin_normal" value="$content[price]" size="5" maxlength="8" />
                <span class="tiny">({?POINTS?})</span>
        </td>
 </tr>
 <tr>
-       <td class="{%template,ColorSwitch%} bottom" align="right">{--PAY_TITLE--}:</td>
+       <td class="{%template,ColorSwitch%} bottom" align="right">{--ADMIN_PAYMENT_TITLE--}:</td>
        <td class="{%template,ColorSwitch%} bottom">
-               <input type="text" name="title[$content[id]]" class="admin_normal" value="$content[title]" size="25" maxlength="255" />
+               <input type="text" name="mail_title[$content[id]]" class="admin_normal" value="$content[mail_title]" size="25" maxlength="255" />
        </td>
 </tr>