Ref link fixed, nickname fixed, several rewrites, TODOs.txt updated:
authorRoland Häder <roland@mxchange.org>
Sat, 10 Oct 2009 23:21:15 +0000 (23:21 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 10 Oct 2009 23:21:15 +0000 (23:21 +0000)
- Reflink should now work again with nicknames, rewritten to use
  NICKNAME_GET_NICK()
- Above function fixed (may be now better)
- Several rewrites of SQL_FETCHROW() to SQL_FETCHARRAY() (internal TODO)
- Several constants rewritten to $content (internal TODO)
- TODOs.txt updated

33 files changed:
DOCS/TODOs.txt
inc/extensions/ext-nickname.php
inc/filters.php
inc/functions.php
inc/gen_sql_patches.php
inc/language/nickname_de.php
inc/libs/nickname_functions.php
inc/libs/rallye_functions.php
inc/libs/user_functions.php
inc/modules/guest/what-rallyes.php
inc/modules/guest/what-sponsor_reg.php
inc/modules/member/what-beg.php
inc/modules/member/what-holiday.php
inc/modules/member/what-html_mail.php
inc/modules/member/what-newsletter.php
inc/modules/member/what-nickname.php
inc/modules/member/what-order.php
inc/modules/member/what-points.php
inc/modules/member/what-primera.php
inc/modules/member/what-rallyes.php
inc/modules/member/what-reflinks.php
inc/modules/member/what-stats.php
inc/modules/member/what-wernis.php
inc/mysql-manager.php
ref.php
templates/de/emails/confirm-member.tpl
templates/de/html/admin/admin_add_sponsor.tpl
templates/de/html/admin/admin_config_nickname.tpl
templates/de/html/guest/guest_sponsor_reg.tpl
templates/de/html/member/member_html_mail_settings.tpl
templates/de/html/member/member_nickname_form.tpl
templates/de/html/member/member_reflinks_row.tpl
templates/de/html/sponsor/sponsor_settings_form.tpl

index 79e5a0bf68d90ba92976bddb096047987cb4613d..9ad658e28cc12bee34fcdcd5b34f969efd851877 100644 (file)
 ./inc/extensions.php:427:              // @TODO Extension is loaded, what next?
 ./inc/fix_filters.php:71:      // @TODO Why does this happen? In installation phase of sql_patches?
 ./inc/footer.php:50:   // @TODO Rewrite these all into filters
-./inc/functions.php:1238:      // @TODO Rewrite this unnice code
-./inc/functions.php:1299:      // @TODO Remove this if() block if all is working fine
-./inc/functions.php:1599:              // @TODO This can be, somehow, rewritten
+./inc/functions.php:1247:      // @TODO Rewrite this unnice code
+./inc/functions.php:1308:      // @TODO Remove this if() block if all is working fine
+./inc/functions.php:1608:              // @TODO This can be, somehow, rewritten
 ./inc/functions.php:214:       // @TODO Remove this sanity-check if all is fine
-./inc/functions.php:2405:      // @TODO The status should never be empty
-./inc/functions.php:2496:                      // @TODO shouldn't do the unset and the reloading $GLOBALS['cache_instance']->destroyCacheFile() Or a new methode like forceCacheReload('revision')?
-./inc/functions.php:253:                       // @TODO Find all templates which are using these direct variables and rewrite them.
-./inc/functions.php:254:                       // @TODO After this step is done, this else-block is history
-./inc/functions.php:2559:// @TODO Please describe this function
-./inc/functions.php:2577:      searchDirsRecursive($next_dir, $last_changed); // @TODO small change to API to $last_changed = searchDirsRecursive($next_dir, $time);
-./inc/functions.php:2660:              // @TODO Add a little more infos here
-./inc/functions.php:2671:      // @TODO This cannot be rewritten to app_die(), try to find a solution for this.
-./inc/functions.php:2829:                      // @TODO Are these convertions still required?
-./inc/functions.php:2847:// @TODO Rewrite this function to use readFromFile() and writeToFile()
-./inc/functions.php:398:               // @TODO Extension 'msg' does not exist
-./inc/functions.php:477:// @TODO Rewrite this to an extension 'smtp'
+./inc/functions.php:2414:      // @TODO The status should never be empty
+./inc/functions.php:2505:                      // @TODO shouldn't do the unset and the reloading $GLOBALS['cache_instance']->destroyCacheFile() Or a new methode like forceCacheReload('revision')?
+./inc/functions.php:250:                       // @TODO Find all templates which are using these direct variables and rewrite them.
+./inc/functions.php:251:                       // @TODO After this step is done, this else-block is history
+./inc/functions.php:2568:// @TODO Please describe this function
+./inc/functions.php:2586:      searchDirsRecursive($next_dir, $last_changed); // @TODO small change to API to $last_changed = searchDirsRecursive($next_dir, $time);
+./inc/functions.php:2669:              // @TODO Add a little more infos here
+./inc/functions.php:2680:      // @TODO This cannot be rewritten to app_die(), try to find a solution for this.
+./inc/functions.php:2838:                      // @TODO Are these convertions still required?
+./inc/functions.php:2856:// @TODO Rewrite this function to use readFromFile() and writeToFile()
+./inc/functions.php:395:               // @TODO Extension 'msg' does not exist
+./inc/functions.php:474:// @TODO Rewrite this to an extension 'smtp'
 ./inc/install-inc.php:20: * @TODO Rewrite all constants in this include file                     *
 ./inc/language/de.php:1160:// @TODO Rewrite these two constants
 ./inc/language/de.php:1176:// @TODO Rewrite these five constants
@@ -52,9 +52,9 @@
 ./inc/libs/surfbar_functions.php:955:  // @TODO Invalid salt should be refused
 ./inc/libs/task_functions.php:261:             // @TODO These can be rewritten to filter
 ./inc/libs/task_functions.php:53:// @TODO Move all extension-dependent queries into filters
-./inc/libs/user_functions.php:315:                             // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
-./inc/libs/user_functions.php:340:                             // @TODO Make this filter working: $URL = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
-./inc/libs/user_functions.php:381:                     // @TODO Can this query be merged with above query?
+./inc/libs/user_functions.php:315:                     // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
+./inc/libs/user_functions.php:340:                     // @TODO Make this filter working: $URL = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
+./inc/libs/user_functions.php:381:             // @TODO Can this query be merged with above query?
 ./inc/libs/yoomedia_functions.php:65:  $response = YOOMEDIA_QUERY_API('out_textmail.php', true); // @TODO Ask Yoo!Media for test script
 ./inc/load_config.php:77:      // @TODO Rewrite them to avoid this else block
 ./inc/load_extensions.php:13: * @TODO Rewrite this whole file to load_cache-extensions.php           *
 ./inc/modules/member/what-categories.php:112:          // @TODO Rewrite this to use $OUT .= ...
 ./inc/modules/member/what-doubler.php:54:// @TODO Rewrite these all constants
 ./inc/modules/member/what-mydata.php:53:// @TODO Try to rewrite this constant
-./inc/modules/member/what-nickname.php:87:     // @TODO Rewrite this constant
 ./inc/modules/member/what-order.php:444:                       // @TODO Rewrite this to a filter
 ./inc/modules/member/what-order.php:543:                                               // @TODO Rewrite this old lost code to a template
 ./inc/modules/member/what-payout.php:132:                              // @TODO Rewritings: acc->target_account,bank->target_bank in templates
 ./inc/modules/member/what-payout.php:190:                              // @TODO Rewrite this constant
 ./inc/modules/member/what-payout.php:235:                                      // @TODO Rewrite this to a filter
 ./inc/modules/member/what-points.php:54:// @TODO Should we rewrite this to a filter?
-./inc/modules/member/what-reflinks.php:105:            // @TODO Rewritings: alt->alternate,cnt->counter,cks->clicks,uid->userid in template
 ./inc/modules/member/what-transfer.php:115:                            // @TODO Rewrite all these constants to array elements
 ./inc/modules/member/what-transfer.php:246:                            // @TODO Try to rewrite his to $content = SQL_FETCHARRAY(), see some lines above for two different queries
 ./inc/modules/member/what-transfer.php:308:                            // @TODO Rewrite these constants
 ./inc/mysql-manager.php:1575:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
 ./inc/mysql-manager.php:1618:                  // @TODO Rewrite this to a filter
 ./inc/mysql-manager.php:1785:  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1813:                          // @TODO Find a way for updating $_CONFIG here
-./inc/mysql-manager.php:1837:          // @TODO Find a way for updating $_CONFIG here
+./inc/mysql-manager.php:1813:                          // @TODO Find a way for updating configuration here
+./inc/mysql-manager.php:1837:          // @TODO Find a way for updating configuration here
 ./inc/mysql-manager.php:1860:// @TODO Can this be rewritten to a filter?
 ./inc/mysql-manager.php:1925:                  // @TODO Rewrite this to $content = SQL_FETCHARRAY()
 ./inc/mysql-manager.php:212:                   // @TODO Nothing helped???
 ./show_bonus.php:108:                  // @TODO Rewrite this constant
 ./view.php:72:         // @TODO No banner found, output some default banner
 ### ### DEPRECATION FOLLOWS: ### ###
-./inc/functions.php:238:       // @DEPRECATED Try to rewrite the if() condition
-./inc/functions.php:252:                       // @DEPRECATED
+./inc/functions.php:235:       // @DEPRECATED Try to rewrite the if() condition
+./inc/functions.php:249:                       // @DEPRECATED
 ./inc/language-functions.php:55:               // @DEPRECATED Language array element found in BIG_LETTERS
 ./inc/language-functions.php:58:               // @DEPRECATED Deprecated constant found
index 54040ee1bde2bb57f1f32cf366271014fac4d47a..7b6c96c7b7b077ab9d950adf32e8283e7c763273 100644 (file)
@@ -103,9 +103,9 @@ switch ($EXT_LOAD_MODE)
                                break;
 
                        case '0.0.6': // SQL queries for v0.0.6
-                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD nickname_len TINYINT(3) UNSIGNED NOT NULL DEFAULT '5'");
-                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD nickname_pattern VARCHAR(255) NOT NULL DEFAULT 'a-zA-Z0-9_'");
-                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD nickname_chars VARCHAR(255) NOT NULL DEFAULT 'a-z, A-Z, 0-9, _'");
+                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `nickname_len` TINYINT(3) UNSIGNED NOT NULL DEFAULT '5'");
+                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `nickname_pattern` VARCHAR(255) NOT NULL DEFAULT 'a-zA-Z0-9_'");
+                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `nickname_chars` VARCHAR(255) NOT NULL DEFAULT 'a-z, A-Z, 0-9, _'");
                                ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_nickname','Nicknamen','Stellen Sie minimale Nicknamenl&auml;nge, sowie erlaubte Zeichen hier ein.', 12)");
 
                                // Update notes (these will be set as task text!)
index db886a0d651df3c432abe16812a198e50baef5c9..b1784834747acc3e5cd82a9be03b740917f589c8 100644 (file)
@@ -591,8 +591,10 @@ function FILTER_DETERMINE_USERNAME () {
                        array(getUserId()), __FILE__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Load surname and family's name and build the username
-                       list($s, $f) = SQL_FETCHROW($result);
-                       $username = $s . ' ' . $f;
+                       $content = SQL_FETCHARRAY($result);
+
+                       // Prepare username
+                       $username = $content['surname'] . ' ' . $content['family'];
 
                        // Additionally admin?
                        if (IS_ADMIN()) {
index fa2b69e6941be1c3ac5975b94196d264a19499eb..c2ea17cec299483068c72beac0c10ccf67dde048 100644 (file)
@@ -217,9 +217,6 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
        // Add more variables which you want to use in your template files
        global $DATA, $username;
 
-       // Get whole config array
-       $_CONFIG = getConfigArray();
-
        // Make all template names lowercase
        $template = strtolower($template);
 
@@ -1014,6 +1011,18 @@ function COMPILE_CODE ($code, $simple = false, $constants = true, $full = true)
        // But shall I keep simple quotes for later use?
        if ($simple) $code = str_replace("'", '{QUOT}', $code);
 
+       // Compile {?some_var?} to getConfig('some_var')
+       preg_match_all('/\{\?(([a-zA-Z0-9-_]+)*)\?\}/', $code, $matches);
+
+       // Some entries found?
+       if ((count($matches) > 0) && (count($matches[0]) > 0)) {
+               // Replace all matches
+               foreach ($matches[0] as $key => $match) {
+                       // Replace it
+                       $code = str_replace($matches[0], getConfig($matches[1][$key]), $code);
+               } // END - foreach
+       } // END - if
+
        // Find $content[bla][blub] entries
        preg_match_all('/\$(content|DATA)((\[([a-zA-Z0-9-_]+)\])*)/', $code, $matches);
 
index e2b45f2eab75893a31c0360bc290e53ec3ae87a9..8a8797dcafb1af8c5486e7d111a6eee747ce75b5 100644 (file)
@@ -63,11 +63,11 @@ if (getConfig('pass_scramble') == '') {
 if (getConfig('master_salt') == '') {
        // Generate the master salt which is the first chars minus 40 chars of this random hash
        // We do an extra scrambling here...
-       $masterSalt = scrambleString(substr(sha1(generatePassword(mt_rand(128, 256))), 0, -40));
+       $masterSalt = scrambleString(sha1(generatePassword(mt_rand(128, 256))));
 
        // ... and store it there for future usage
-       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_config` SET master_salt='%s' WHERE config=0 LIMIT 1",
-       array($masterSalt), __FILE__, __LINE__);
+       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_config` SET `master_salt`='%s' WHERE config=0 LIMIT 1",
+               array($masterSalt), __FILE__, __LINE__);
 
        // Also remember it in config
        setConfigEntry('master_salt', $masterSalt);
@@ -78,8 +78,8 @@ if (getConfig('file_hash') == '') {
        // Create filename from hashed random string
        $fileHash = sha1(generatePassword(mt_rand(128, 256)));
        $FQFN = sprintf("%sinc/.secret/.%s",
-       constant('PATH'),
-       $fileHash
+               constant('PATH'),
+               $fileHash
        );
 
        // Count of chars to be taken from back of the string
index 2fa12e465c1a42283770a4f921e8a11c4f38418c..e4ccc8424a8858700b900a545a70e954316d917e 100644 (file)
@@ -44,7 +44,7 @@ if (!defined('__SECURITY')) {
 
 // Language definitions
 define('NICKNAME_CHANGE_NICKNAME_TITLE', "Einstellen Ihres Nicknames");
-define('NICKNAME_CHANGE_NICKNAME_INTRO', "Stellen Sie hier einen Nicknamen ein, der anstelle Ihrer User-ID angezeigt wird! Dieser darf nur unten aufgef&uuml;hrte Zeichen enthalten und sollte nicht k&uuml;rzer als {!__NICKNAME_LENGTH!} Zeichen sein.");
+define('NICKNAME_CHANGE_NICKNAME_INTRO', "Stellen Sie hier einen Nicknamen ein, der anstelle Ihrer User-ID angezeigt wird! Dieser darf nur unten aufgef&uuml;hrte Zeichen enthalten und sollte nicht k&uuml;rzer als ".getConfig('nickname_len')." Zeichen sein.");
 define('NICKNAME_ENTER_NICKNAME', "Nickname eingeben");
 define('NICKNAME_SUBMIT', "Nickname &auml;ndern");
 define('NICKNAME_ALREADY_IN_USE', "Der von Ihnen eingegebene Nickname wird bereits verwendet!");
index 3304c010744a2679b7b347e1c845724a1162d027..766bd54cfec50ad79be427044013bf2eab9d2e72 100644 (file)
@@ -58,8 +58,11 @@ function NICKNAME_IS_ACTIVE ($uidNick) {
                // Nickname or userid used?
                $nick = NICKNAME_GET_NICK($uidNick);
 
+               // Check for nickname
+               $ret = ($nick != $uidNick);
+
                // Put it in cache
-               $GLOBALS['cache_array']['nick_active'][$uidNick] = (!empty($nick));
+               $GLOBALS['cache_array']['nick_active'][$uidNick] = $ret;
        }
 
        // Return nickname
@@ -85,25 +88,27 @@ function NICKNAME_GET_NICK ($userid) {
                // Nickname or userid used?
                if (''.round($userid).'' === ''.$userid.'') {
                        // Userid given
-                       $result = SQL_QUERY_ESC("SELECT `userid`  FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid` =%s LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT `nickname`  FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid` =%s LIMIT 1",
                                array(bigintval($userid)), __FUNCTION__, __LINE__);
-               } else {
-                       // Nickname given
-                       $result = SQL_QUERY_ESC("SELECT `userid`  FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nickname`='%s' LIMIT 1",
-                               array($userid), __FUNCTION__, __LINE__);
-               }
 
-               // Found?
-               if (SQL_NUMROWS($result) == 1) {
-                       // Load nickname from database
-                       list($ret) = SQL_FETCHROW($result);
+                       // Found?
+                       if (SQL_NUMROWS($result) == 1) {
+                               // Load nickname from database
+                               list($ret) = SQL_FETCHROW($result);
+
+                               // Put it in cche
+                               $GLOBALS['cache_array']['nicknames'][$userid] = $ret;
+                       } // END - if
+
+                       // Free result
+                       SQL_FREERESULT($result);
+               } else {
+                       // Direct nickname found!
+                       $ret = $userid;
 
                        // Put it in cche
                        $GLOBALS['cache_array']['nicknames'][$userid] = $ret;
-               } // END - if
-
-               // Free result
-               SQL_FREERESULT($result);
+               }
        }
 
        // Return nickname
index 9a7fac9ebe04a3a4c412ce10dffc2980cdf1888d..c1e37c5812e87b306a53df13640720eabea71802 100644 (file)
@@ -99,7 +99,7 @@ WHERE d.`status`='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND
                        list($cpoints) = SQL_FETCHROW($result_ref);
                        SQL_FREERESULT($result_ref);
 
-                       if (empty($cpoints)) $cpoints = "0.00000";
+                       if (empty($cpoints)) $cpoints = '0.00000';
 
                        // Add info line
                        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_rallye_users` (rallye_id, userid, refs, curr_points)
@@ -495,7 +495,7 @@ function RALLYE_LOAD_PRICES_ARRAY ($rallye) {
 //
 function RALLYE_LOAD_USERS_ARRAY ($rallye) {
        // Fix zero points to 0.00000
-       if (getConfig('ref_payout') == '0') setConfigEntry('ref_payout', "0.00000");
+       if (getConfig('ref_payout') == '0') setConfigEntry('ref_payout', '0.00000');
 
        // Init multi array
        $users = array(
index cfb52655e3b86af0cf88deed1d4f0d97c194aa3d..194314edb15a3a7bac699a6aa51bd67ae05a8f16 100644 (file)
@@ -275,134 +275,134 @@ function USER_DO_LOGIN ($uid, $passwd, $successUrl = '') {
                'last_online' => 0,
                'last_login'  => 0,
                'hash'        => ''
-               );
+       );
 
-               // Check login data
-               if ((EXT_IS_ACTIVE('nickname')) && (NICKNAME_IS_ACTIVE($uid))) {
-                       // Nickname entered
-                       $result = SQL_QUERY_ESC("SELECT `userid`, `password`, `last_online`" . $lastOnline . " FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nickname`='%s' AND `status`='CONFIRMED' LIMIT 1",
-                               array($uid), __FUNCTION__, __LINE__);
+       // Check login data
+       if ((EXT_IS_ACTIVE('nickname')) && (NICKNAME_IS_ACTIVE($uid))) {
+               // Nickname entered
+               $result = SQL_QUERY_ESC("SELECT `userid`, `password`, `last_online`" . $lastOnline . " FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nickname`='%s' AND `status`='CONFIRMED' LIMIT 1",
+                       array($uid), __FUNCTION__, __LINE__);
+       } else {
+               // Direct userid entered
+               $result = SQL_QUERY_ESC("SELECT `userid`, `password`, `last_online`" . $lastOnline . " FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
+                       array($uid, $content['hash']), __FUNCTION__, __LINE__);
+       }
+
+       // Load entry
+       $content = SQL_FETCHARRAY($result);
+       if (!empty($content['userid'])) $uid = bigintval($content['userid']);
+
+       // Is there an entry?
+       if ((SQL_NUMROWS($result) == 1) && ((isNicknameUsed($content['userid'] === true) && (!empty($content['userid']))) || ($content['userid'] == $uid))) {
+               // Free result
+               SQL_FREERESULT($result);
+
+               // Check for old MD5 passwords
+               if ((strlen($content['password']) == 32) && (md5($passwd) == $content['password'])) {
+                       // Just set the hash to the password from DB... :)
+                       $content['hash'] = $content['password'];
                } else {
-                       // Direct userid entered
-                       $result = SQL_QUERY_ESC("SELECT `userid`, `password`, `last_online`" . $lastOnline . " FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
-                               array($uid, $content['hash']), __FUNCTION__, __LINE__);
+                       // Hash password with improved way for comparsion
+                       $content['hash'] = generateHash($passwd, substr($content['password'], 0, -40));
                }
 
-               // Load entry
-               $content = SQL_FETCHARRAY($result);
-               if (!empty($content['userid'])) $uid = bigintval($content['userid']);
+               // Does the password match the hash?
+               if ($content['hash'] == $content['password']) {
+                       // New hashed password found so let's generate a new one
+                       $content['hash'] = generateHash($passwd);
+
+                       // ... and update database
+                       // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
+                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `password`='%s' WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
+                               array($content['hash'], $uid), __FUNCTION__, __LINE__);
+
+                       // No login bonus by default
+                       $GLOBALS['bonus_payed'] = false;
+
+                       // Probe for last online timemark
+                       $probe = time() -  $content['last_online'];
+                       if (!empty($content['last_login'])) $probe = time() - $content['last_login'];
+                       if ((GET_EXT_VERSION('bonus') >= '0.2.2') && ($probe >= getConfig('login_timeout'))) {
+                               // Add login bonus to user's account
+                               $add = sprintf(", `login_bonus`=`login_bonus`+%s",
+                                       (float)getConfig('login_bonus')
+                               );
+                               $GLOBALS['bonus_payed'] = true;
+
+                               // Subtract login bonus from userid's account or jackpot
+                               if ((GET_EXT_VERSION('bonus') >= '0.3.5') && (getConfig('bonus_mode') != 'ADD')) BONUS_POINTS_HANDLER('login_bonus');
+                       } // END - if
 
-               // Is there an entry?
-               if ((SQL_NUMROWS($result) == 1) && ((isNicknameUsed($content['userid'] === true) && (!empty($content['userid']))) || ($content['userid'] == $uid))) {
-                       // Free result
-                       SQL_FREERESULT($result);
+                       // Calculate new hash with the secret key and master salt together
+                       $content['hash'] = generatePassString($content['hash']);
 
-                       // Check for old MD5 passwords
-                       if ((strlen($content['password']) == 32) && (md5($passwd) == $content['password'])) {
-                               // Just set the hash to the password from DB... :)
-                               $content['hash'] = $content['password'];
-                       } else {
-                               // Hash password with improved way for comparsion
-                               $content['hash'] = generateHash($passwd, substr($content['password'], 0, -40));
-                       }
+                       // Update global array
+                       // @TODO Make this filter working: $URL = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
+                       setUserId($uid);
 
-                       // Does the password match the hash?
-                       if ($content['hash'] == $content['password']) {
-                               // New hashed password found so let's generate a new one
-                               $content['hash'] = generateHash($passwd);
-
-                               // ... and update database
-                               // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `password`='%s' WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
-                                       array($content['hash'], $uid), __FUNCTION__, __LINE__);
-
-                               // No login bonus by default
-                               $GLOBALS['bonus_payed'] = false;
-
-                               // Probe for last online timemark
-                               $probe = time() -  $content['last_online'];
-                               if (!empty($content['last_login'])) $probe = time() - $content['last_login'];
-                               if ((GET_EXT_VERSION('bonus') >= '0.2.2') && ($probe >= getConfig('login_timeout'))) {
-                                       // Add login bonus to user's account
-                                       $add = sprintf(", `login_bonus`=`login_bonus`+%s",
-                                               (float)getConfig('login_bonus')
-                                       );
-                                       $GLOBALS['bonus_payed'] = true;
-
-                                       // Subtract login bonus from userid's account or jackpot
-                                       if ((GET_EXT_VERSION('bonus') >= '0.3.5') && (getConfig('bonus_mode') != 'ADD')) BONUS_POINTS_HANDLER('login_bonus');
-                               } // END - if
-
-                               // Calculate new hash with the secret key and master salt together
-                               $content['hash'] = generatePassString($content['hash']);
-
-                               // Update global array
-                               // @TODO Make this filter working: $URL = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
-                               setUserId($uid);
-
-                               // Try to set session data (which shall normally always work!)
-                               if ((setSession('userid', $uid )) && (setSession('u_hash', $content['hash']))) {
-                                       // Update database records
-                                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `total_logins`=`total_logins`+1" . $add . " WHERE `userid`=%s LIMIT 1",
-                                               array($uid), __FUNCTION__, __LINE__);
-                                       if (SQL_AFFECTEDROWS() == 1) {
-                                               // Is a success URL set?
-                                               if (empty($successUrl)) {
-                                                       // Procedure to checking for login data
-                                                       if (($GLOBALS['bonus_payed']) && (EXT_IS_ACTIVE('bonus'))) {
-                                                               // Bonus added (just displaying!)
-                                                               $URL = 'modules.php?module=chk_login&amp;mode=bonus';
-                                                       } else {
-                                                               // Bonus not added
-                                                               $URL = 'modules.php?module=chk_login&amp;mode=login';
-                                                       }
+                       // Try to set session data (which shall normally always work!)
+                       if ((setSession('userid', $uid )) && (setSession('u_hash', $content['hash']))) {
+                               // Update database records
+                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `total_logins`=`total_logins`+1" . $add . " WHERE `userid`=%s LIMIT 1",
+                                       array($uid), __FUNCTION__, __LINE__);
+                               if (SQL_AFFECTEDROWS() == 1) {
+                                       // Is a success URL set?
+                                       if (empty($successUrl)) {
+                                               // Procedure to checking for login data
+                                               if (($GLOBALS['bonus_payed']) && (EXT_IS_ACTIVE('bonus'))) {
+                                                       // Bonus added (just displaying!)
+                                                       $URL = 'modules.php?module=chk_login&amp;mode=bonus';
                                                } else {
-                                                       // Use this URL
-                                                       $URL = $successUrl;
+                                                       // Bonus not added
+                                                       $URL = 'modules.php?module=chk_login&amp;mode=login';
                                                }
                                        } else {
-                                               // Cannot update counter!
-                                               $URL = 'modules.php?module=index&amp;what=login&amp;login='.getCode('CNTR_FAILED');
+                                               // Use this URL
+                                               $URL = $successUrl;
                                        }
                                } else {
-                                       // Cookies not setable!
-                                       $URL = 'modules.php?module=index&amp;what=login&amp;login='.getCode('NO_COOKIES');
+                                       // Cannot update counter!
+                                       $URL = 'modules.php?module=index&amp;what=login&amp;login='.getCode('CNTR_FAILED');
                                }
-                       } elseif (GET_EXT_VERSION('sql_patches') >= '0.6.1') {
-                               // Update failture counter
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `login_failures`=`login_failures`+1,`last_failure`=NOW() WHERE `userid`=%s LIMIT 1",
-                                       array($uid), __FUNCTION__, __LINE__);
-
-                               // Wrong password!
-                               $URL = 'modules.php?module=index&amp;what=login&amp;login='.getCode('WRONG_PASS');
-                       }
-               } elseif (((isNicknameUsed($content['userid'])) && (!empty($content['userid']))) || ($content['userid'] == $uid)) {
-                       // Other account status?
-                       // @TODO Can this query be merged with above query?
-                       $result = SQL_QUERY_ESC("SELECT status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
-                               array($uid), __FUNCTION__, __LINE__);
-
-                       // Entry found?
-                       if (SQL_NUMROWS($result) == 1) {
-                               // Load status
-                               list($status) = SQL_FETCHROW($result);
-
-                               // Create an error code from given status
-                               $errorCode = generateErrorCodeFromUserStatus($status);
                        } else {
-                               // ID not found!
-                               $errorCode = getCode('WRONG_ID');
+                               // Cookies not setable!
+                               $URL = 'modules.php?module=index&amp;what=login&amp;login='.getCode('NO_COOKIES');
                        }
+               } elseif (GET_EXT_VERSION('sql_patches') >= '0.6.1') {
+                       // Update failture counter
+                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `login_failures`=`login_failures`+1,`last_failure`=NOW() WHERE `userid`=%s LIMIT 1",
+                               array($uid), __FUNCTION__, __LINE__);
 
-                       // Construct URL
-                       $URL = 'modules.php?module=index&amp;what=login&amp;login='.$errorCode;
+                       // Wrong password!
+                       $URL = 'modules.php?module=index&amp;what=login&amp;login='.getCode('WRONG_PASS');
+               }
+       } elseif (((isNicknameUsed($content['userid'])) && (!empty($content['userid']))) || ($content['userid'] == $uid)) {
+               // Other account status?
+               // @TODO Can this query be merged with above query?
+               $result = SQL_QUERY_ESC("SELECT status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+                       array($uid), __FUNCTION__, __LINE__);
+
+               // Entry found?
+               if (SQL_NUMROWS($result) == 1) {
+                       // Load status
+                       list($status) = SQL_FETCHROW($result);
+
+                       // Create an error code from given status
+                       $errorCode = generateErrorCodeFromUserStatus($status);
                } else {
                        // ID not found!
-                       $URL = 'modules.php?module=index&amp;what=login&amp;login='.getCode('WRONG_ID');
+                       $errorCode = getCode('WRONG_ID');
                }
 
-               // Return URL
-               return $URL;
+               // Construct URL
+               $URL = 'modules.php?module=index&amp;what=login&amp;login='.$errorCode;
+       } else {
+               // ID not found!
+               $URL = 'modules.php?module=index&amp;what=login&amp;login='.getCode('WRONG_ID');
+       }
+
+       // Return URL
+       return $URL;
 }
 
 // Try to send a new password for the given user account
index fffb7ab63846a31d2e8485069fbd1e895148bd70..11489d0b7e33f896ad782f25b18ca81a042e3b9f 100644 (file)
@@ -93,7 +93,7 @@ if (SQL_NUMROWS($result) == 1) {
        // Handle description...
        if ((empty($descr)) && (!empty($templ))) {
                // Use description from template
-               define('__RALLYE_DESCR', LOAD_TEMPLATE("rallye_".$templ, true));
+               define('__RALLYE_DESCR', LOAD_TEMPLATE('rallye_' . $templ, true));
        } else {
                // Use description from database
                define('__RALLYE_DESCR', COMPILE_CODE($descr));
@@ -129,5 +129,5 @@ if (SQL_NUMROWS($result) == 1) {
 // Close the div tag
 OUTPUT_HTML('</div>');
 
-//
+// [EOF]
 ?>
index 153ae8d42705421aa372cac8abf6724b4fe7fac5..9e329bba5bec9ac89123dc73e50fcc7d681c9802 100644 (file)
@@ -215,7 +215,7 @@ WHERE `id`='%s' LIMIT 1",
 
        // Add points to array
        REQUEST_POST('points_amount', $points);
-       REQUEST_POST('points_used'  , "0.00000");
+       REQUEST_POST('points_used'  , '0.00000');
        REQUEST_POST('last_pay'     , $pay);
        REQUEST_POST('last_curr'    , $curr);
 
index e0fb928d31c23dd64f01f2da22031aaf32337bef..ede146da64455ac5aa4e213fa50dc533a1ca29ea 100644 (file)
@@ -51,23 +51,23 @@ if (!defined('__SECURITY')) {
 ADD_DESCR('member', __FILE__);
 
 $uid = getUserId();
-if (EXT_IS_ACTIVE('nickname'))
-{
+if (EXT_IS_ACTIVE('nickname')) {
        // Load nickname
        $data = 'nickname';
-}
-else
-{
+} else {
        // Load userid
        $data = 'userid';
 }
 
 // Run SQL command
-$result = SQL_QUERY_ESC("SELECT ".$data.", beg_clicks
+$result = SQL_QUERY_ESC("SELECT ".$data.", `beg_clicks`
 FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE userid=%s
+WHERE `userid`=%s
 LIMIT 1", array($uid), __FILE__, __LINE__);
+
 list($uid, $clicks) = SQL_FETCHROW($result);
+
+// Free result
 SQL_FREERESULT($result);
 
 // Set User-ID when no nickname was found
@@ -83,7 +83,7 @@ define('__BEG_TIMEOUT'    , createFancyTime(getConfig('beg_timeout')));
 define('__BEG_UID_TIMEOUT', createFancyTime(getConfig('beg_uid_timeout')));
 
 // Load template
-LOAD_TEMPLATE("member_".substr(basename(__FILE__), 5, -4));
+LOAD_TEMPLATE('member_' . substr(basename(__FILE__), 5, -4));
 
 //
 ?>
index 761577cad27e19b846b9882f137e4bb76933b73a..11f17185ff880fc79bb6666a71077a1ecc989b1b 100644 (file)
@@ -47,42 +47,61 @@ if (!defined('__SECURITY')) {
        return;
 }
 
+// Init content array
+$content = array();
+
 // Add description as navigation point
 ADD_DESCR('member', __FILE__);
 
 // Check for running mail orders in pool
-$result1 = SQL_QUERY_ESC("SELECT timestamp FROM `{!_MYSQL_PREFIX!}_pool`
-WHERE sender=%s ORDER BY timestamp DESC LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+$result1 = SQL_QUERY_ESC("SELECT
+       `timestamp`
+FROM
+       `{!_MYSQL_PREFIX!}_pool`
+WHERE
+       `sender`=%s
+ORDER BY
+       `timestamp` DESC
+LIMIT 1", array(getUserId()), __FILE__, __LINE__);
 
 // Check for sent mail orders in stats
-$result2 = SQL_QUERY_ESC("SELECT timestamp_ordered FROM `{!_MYSQL_PREFIX!}_user_stats`
-WHERE userid=%s ORDER BY timestamp_ordered DESC LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+$result2 = SQL_QUERY_ESC("SELECT
+       `timestamp_ordered`
+FROM
+       `{!_MYSQL_PREFIX!}_user_stats`
+WHERE
+       `userid`=%s
+ORDER BY
+       `timestamp_ordered` DESC
+LIMIT 1", array(getUserId()), __FILE__, __LINE__);
 
 if ((SQL_NUMROWS($result1) == 1) || (SQL_NUMROWS($result2) == 1)) {
        // Mail order found!
-       list($stamp1) = SQL_FETCHROW($result1);
-       list($stamp2) = SQL_FETCHROW($result2);
-       if (empty($stamp1)) $stamp1 = 0;
-       if (empty($stamp2)) $stamp2 = 0;
+       $content = merge_array($content, SQL_FETCHARRAY($result1));
+       $content = merge_array($content, SQL_FETCHARRAY($result2));
+
+       // Fix missing entries
+       if (empty($content['timestamp'])) $content['timestamp'] = 0;
+       if (empty($content['timestamp_ordered'])) $content['timestamp_ordered'] = 0;
 
-       if ((($stamp1 + getConfig('holiday_lock')) > time()) || (($stamp2 + getConfig('holiday_lock')) > time())) {
+       if ((($content['timestamp'] + getConfig('holiday_lock')) > time()) || (($content['timestamp_ordered'] + getConfig('holiday_lock')) > time())) {
                // Mail order is to close away!
                REQUEST_UNSET_POST('ok');
                REQUEST_UNSET_POST('stop');
 
-               if (($stamp1 + getConfig('holiday_lock')) > time()) {
+               if (($content['timestamp'] + getConfig('holiday_lock')) > time()) {
                        // Mail found in pool
-                       $stamp = $stamp1;
+                       $stamp = $content['timestamp'];
                } else {
                        // Mail found in stats
-                       $stamp = $stamp2;
+                       $stamp = $content['timestamp_ordered'];
                }
 
                // Display message and exit here
                LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('HOLIDAY_MEMBER_ORDER'), generateDateTime($stamp, '1')));
                return;
        }
-}
+} // END - if
 
 // Free memory
 SQL_FREERESULT($result1);
@@ -91,22 +110,26 @@ SQL_FREERESULT($result2);
 if (isFormSent()) {
        // Check holiday request...
        $START = mktime(0, 0, 0, REQUEST_POST('start_month'), REQUEST_POST('start_day'), REQUEST_POST('start_year'));
-       $END   = mktime(0, 0, 0, REQUEST_POST('end_month')  , REQUEST_POST('end_day')  , REQUEST_POST('end_year')  );
+       $content['holiday_end']   = mktime(0, 0, 0, REQUEST_POST('end_month')  , REQUEST_POST('end_day')  , REQUEST_POST('end_year')  );
 
        // Test both values
-       $TEST = $END - $START;
-       if (($TEST < 0) || ($TEST > (getConfig('one_day') * getConfig('holiday_max'))) || ($START < time()) || ($END < time())) {
+       $TEST = $content['holiday_end'] - $START;
+       if (($TEST < 0) || ($TEST > (getConfig('one_day') * getConfig('holiday_max'))) || ($START < time()) || ($content['holiday_end'] < time())) {
                // Time test failed
                REQUEST_UNSET_POST('ok');
        } else {
                // Everything went okay so let's store his request and send mails
-               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_holidays` (userid, holiday_start, holiday_end, comments) VALUES ('%s','%s','%s','%s')",
-               array(getUserId(), $START, $END, REQUEST_POST('comments')), __FILE__, __LINE__);
+               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_holidays` (`userid`, `holiday_start`, `holiday_end`, `comments`) VALUES ('%s','%s','%s','%s')",
+                       array(getUserId(), $START, $content['holiday_end'], REQUEST_POST('comments')), __FILE__, __LINE__);
 
                // Activate holiday system
-               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
-SET `holiday_active`='N', holiday_activated=UNIX_TIMESTAMP()
-WHERE userid=%s LIMIT 1",
+               SQL_QUERY_ESC("UPDATE
+       `{!_MYSQL_PREFIX!}_user_data`
+SET
+       `holiday_active`='N', `holiday_activated`=UNIX_TIMESTAMP()
+WHERE
+       `userid`=%s
+LIMIT 1",
                array(getUserId()), __FILE__, __LINE__);
 
                // Prepare constants
@@ -130,37 +153,54 @@ WHERE userid=%s LIMIT 1",
                // Display message
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('HOLIDAY_IS_ACTIVATED_NOW'));
        }
-}
+} // END - if
 
 // Holiday shall be ended now
 if (REQUEST_ISSET_POST('stop')) {
        // Okay, end the holiday here...
-       $result = SQL_QUERY_ESC("SELECT `holiday_active`, `holiday_activated` FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `userid`=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
-       list($active, $locked) = SQL_FETCHROW($result);
+       $result = SQL_QUERY_ESC("SELECT
+       `holiday_active`, `holiday_activated`
+FROM
+       `{!_MYSQL_PREFIX!}_user_data`
+WHERE
+       `userid`=%s
+LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+       $content = merge_array($content, SQL_FETCHARRAY($result));
        SQL_FREERESULT($result);
 
-       if (($active == 'Y') && (($locked + getConfig('holiday_lock')) < time())) {
+       if (($content['holiday_active'] == 'Y') && (($content['holiday_activated'] + getConfig('holiday_lock')) < time())) {
                // Load data
-               $result = SQL_QUERY_ESC("SELECT `holiday_start`, `holiday_end` FROM `{!_MYSQL_PREFIX!}_user_holidays`
-WHERE `userid`=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT
+       `holiday_start`, `holiday_end`
+FROM
+       `{!_MYSQL_PREFIX!}_user_holidays`
+WHERE
+       `userid`=%s
+LIMIT 1", array(getUserId()), __FILE__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Data was found
-                       list($start, $end) = SQL_FETCHROW($result);
+                       $content = merge_array($content, SQL_FETCHARRAY($result));
                        SQL_FREERESULT($result);
 
                        // Prepare it for the template
-                       define('__HOLIDAY_START', generateDateTime($start, '3'));
-                       define('__HOLIDAY_END'  , generateDateTime($end  , '3'));
+                       define('__HOLIDAY_START', generateDateTime($content['holiday_start'], '3'));
+                       define('__HOLIDAY_END'  , generateDateTime($content['holiday_end']  , '3'));
 
                        // Deactivate it now
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
-SET `holiday_active`='N', holiday_activated='0'
-WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+SET
+       `holiday_active`='N',
+       `holiday_activated`=0
+WHERE
+       `userid`=%s
+LIMIT 1", array(getUserId()), __FILE__, __LINE__);
 
                        // Remove entry
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_holidays`
-WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM
+       `{!_MYSQL_PREFIX!}_user_holidays`
+WHERE
+       `userid`=%s
+LIMIT 1", array(getUserId()), __FILE__, __LINE__);
 
                        // Send email to admin
                        sendAdminNotification(getMessage('HOLIDAY_ADMIN_DEAC_SUBJ'), 'admin_holiday_deactivated', array(), getUserId());
@@ -171,38 +211,48 @@ WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
                        // Display message to user
                        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('HOLIDAY_MEMBER_CANNOT_DEACTIVATE'));
                }
-       } elseif ($active == 'Y') {
+       } elseif ($content['holiday_active'] == 'Y') {
                // To fast!
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('HOLIDAY_MEMBER_LOCKED'));
        }
-}
+} // END - if
 
 // If something is wrong or link in menu is just clicked display form
 if ((!isFormSent()) && (!REQUEST_ISSET_POST('stop'))) {
        // Check if user is in holiday...
-       $result = SQL_QUERY_ESC("SELECT holiday_active, holiday_activated FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
-       list($active, $locked) = SQL_FETCHROW($result);
+       $result = SQL_QUERY_ESC("SELECT
+       `holiday_active`, `holiday_activated`
+FROM
+       `{!_MYSQL_PREFIX!}_user_data`
+WHERE
+       `userid`=%s
+LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+       $content = SQL_FETCHARRAY($result);
        SQL_FREERESULT($result);
 
        // Check for lock
-       if (($locked + getConfig('holiday_lock')) < time()) {
+       if (($content['holiday_activated'] + getConfig('holiday_lock')) < time()) {
                // User can deactivate his holiday request
-               switch ($active)
+               switch ($content['holiday_active'])
                {
                        case 'Y': // Display deactivation form
                                // Load starting and ending date
-                               $result = SQL_QUERY_ESC("SELECT holiday_start, holiday_end FROM `{!_MYSQL_PREFIX!}_user_holidays`
-WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+                               $result = SQL_QUERY_ESC("SELECT
+       `holiday_start`, `holiday_end`
+FROM
+       `{!_MYSQL_PREFIX!}_user_holidays`
+WHERE
+       `userid`=%s
+LIMIT 1", array(getUserId()), __FILE__, __LINE__);
                                if (SQL_NUMROWS($result) == 1) {
                                        // Data was found
-                                       list($start, $end) = SQL_FETCHROW($result);
+                                       $content = merge_array($content, SQL_FETCHARRAY($result));
                                        SQL_FREERESULT($result);
 
                                        // Prepare it for the template
-                                       define('__HOLIDAY_START', generateDateTime($start , '3'));
-                                       define('__HOLIDAY_END'  , generateDateTime($end   , '3'));
-                                       define('__HOLIDAY_LOCK' , generateDateTime($locked, '1'));
+                                       define('__HOLIDAY_START', generateDateTime($content['holiday_start'] , '3'));
+                                       define('__HOLIDAY_END'  , generateDateTime($content['holiday_end']   , '3'));
+                                       define('__HOLIDAY_LOCK' , generateDateTime($content['holiday_activated'], '1'));
 
                                        // Load template
                                        LOAD_TEMPLATE('member_holiday_deactivate');
@@ -211,9 +261,13 @@ WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
                                        SQL_FREERESULT($result);
 
                                        // Remove entry and reload URL
-                                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
-SET `holiday_active`='N'
-WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+                                       SQL_QUERY_ESC("UPDATE
+       `{!_MYSQL_PREFIX!}_user_data`
+SET
+       `holiday_active`='N'
+WHERE
+       `userid`=%s
+LIMIT 1", array(getUserId()), __FILE__, __LINE__);
                                        redirectToUrl('modules.php?module=login&amp;what=holiday');
                                        return;
                                }
@@ -246,6 +300,7 @@ WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
                // To fast!
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('HOLIDAY_MEMBER_LOCKED'));
        }
-}
-//
+} // END - if
+
+// [EOF]
 ?>
index f00ec341fdc301a639d490fa19b593fc616e6a64..07e592301c1f345e0dfb032aa14c8b2960a90dd7 100644 (file)
@@ -53,25 +53,32 @@ ADD_DESCR('member', __FILE__);
 // Class was found and loaded
 if (isFormSent()) {
        // Save settings
-       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `html`='%s' WHERE userid=%s LIMIT 1",
-       array(REQUEST_POST('html'), getUserId()), __FILE__, __LINE__);
+       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `html`='%s' WHERE `userid`=%s LIMIT 1",
+               array(REQUEST_POST('html'), getUserId()), __FILE__, __LINE__);
        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('MEMBER_SETTINGS_SAVED'));
 } else {
        // Load template for changing settings
-       $result = SQL_QUERY_ESC("SELECT html FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-       array(getUserId()), __FILE__, __LINE__);
-       list($mode) = SQL_FETCHROW($result);
+       $result = SQL_QUERY_ESC("SELECT `html` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+               array(getUserId()), __FILE__, __LINE__);
+
+       // Get the mode
+       $content = SQL_FETCHARRAY($result);
+
+       // Free result
        SQL_FREERESULT($result);
 
-       if ($mode == 'Y') {
-               define('HTML_Y', ' checked="checked"');
-               define('HTML_N', '');
+       // Prepare it
+       if ($content['html'] == 'Y') {
+               $content['html_y'] = ' checked="checked"';
+               $content['html_n'] = '');
        } else {
-               define('HTML_N', ' checked="checked"');
-               define('HTML_Y', '');
+               $content['html_n'] = ' checked="checked"';
+               $content['html_y'] = '';
        }
-       LOAD_TEMPLATE("member_html_mail_settings");
+
+       // Load main template
+       LOAD_TEMPLATE('member_html_mail_settings');
 }
 
-//
+// [EOF]
 ?>
index 2d83f42f3a5785e50cbcfe8c23a7526b528fee76..cfb079145b69bd84f5587688e9a43a6ec099db7e 100644 (file)
@@ -51,8 +51,8 @@ if (!defined('__SECURITY')) {
 ADD_DESCR('member', __FILE__);
 
 // Load status
-$result = SQL_QUERY_ESC("SELECT nl_receive, nl_until, nl_timespan FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-array(getUserId()), __FILE__, __LINE__);
+$result = SQL_QUERY_ESC("SELECT `nl_receive`, `nl_until`, `nl_timespan` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+       array(getUserId()), __FILE__, __LINE__);
 list($status, $until, $span) = SQL_FETCHROW($result);
 SQL_FREERESULT($result);
 
@@ -62,7 +62,7 @@ define('__CHARGE_VALUE', translateComma(getConfig('nl_charge')));
 if ((isFormSent()) && ($status == 'Y') && ($span == '0')) {
        // Save request
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET nl_timespan='".(getConfig('one_day') * 30)."' WHERE userid=%s LIMIT 1",
-       array(getUserId()), __FILE__, __LINE__);
+               array(getUserId()), __FILE__, __LINE__);
 
        // Load admin message
        $admin_msg = LOAD_EMAIL_TEMPLATE('admin_newsletter_request', array(), getUserId());
index ce052c1c1d133e2faee1f55f8620eeaeed01c1b9..a086dfd3fe9494c86cf50142d2da3c317528cd99 100644 (file)
@@ -55,16 +55,16 @@ if (isFormSent()) {
        // Nickname was submitted so let's check if it is not already in use
        if (REQUEST_ISSET_POST('nickname')) {
                // Check if nickname is valid
-               $PATTERN = '[' . getConfig('nickname_pattern') . ']{' . getConfig('nickname_length') . ',}';
+               $PATTERN = '[' . getConfig('nickname_pattern') . ']{' . getConfig('nickname_len') . ',}';
                if (ereg($PATTERN, REQUEST_POST('nickname'), $array)) {
                        // Entered nickname is valid?
-                       if ($array[0] == REQUEST_POST('nickname')) $isValid = true;
+                       $isValid = ($array[0] == REQUEST_POST('nickname'));
                } // END - if
        } // END - if
 } // END - if
 
 if ($isValid === true) {
-       // Look for nickname in database (we only need just one entry so don't worry about the "LIMIT 1" !
+       // Look for nickname in database (we only need just one entry so don't worry about the "LIMIT 1" !)
        $result = SQL_QUERY_ESC("SELECT `userid` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nickname`='%s' AND `userid` != '%s' LIMIT 1",
                array(REQUEST_POST('nickname'), getUserId()), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 0) {
@@ -83,17 +83,13 @@ if ($isValid === true) {
        // Load template
        LOAD_TEMPLATE('admin_settings_saved', false, $content);
 } else {
-       // Load current nickname
-       // @TODO Rewrite this constant
-       define('__NICKNAME', NICKNAME_GET_NICK(getUserId()));
-
        // Do we have already submit the form?
        if (REQUEST_ISSET_POST('nickname')) {
                LOAD_TEMPLATE('admin_settings_saved', false, "<div class=\"member_failed\">{--NICKNAME_IS_INVALID--}</div");
        } // END - if
 
        // Load Template
-       LOAD_TEMPLATE('member_nickname_form');
+       LOAD_TEMPLATE('member_nickname_form', false, NICKNAME_GET_NICK(getUserId()));
 }
 
 //
index 19013520e66e355e165841ca56b023d5b3e39d9b..bf76b4b286ed585da088d71a8f104f953e03c5e1 100644 (file)
@@ -520,7 +520,7 @@ LIMIT 1",
                                $message = '';
                                switch (REQUEST_GET('msg')) {
                                        case getCode('URL_TLOCK'):
-                                               $result = SQL_QUERY_ESC("SELECT timestamp FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
+                                               $result = SQL_QUERY_ESC("SELECT `timestamp` FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
                                                        array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
 
                                                // Load timestamp from last order
@@ -649,16 +649,16 @@ LIMIT 1",
 
                                if (SQL_NUMROWS($result) == 1) {
                                        // Old order found
-                                       list($subject, $text, $payment, $tstamp, $url, $target, $content['cat'], $zip) = SQL_FETCHROW($result);
+                                       $content = SQL_FETCHARRAY($result);
 
                                        // Fix max receivers when it is too much
-                                       if ((isset($CATS['uids'][$content['cat']])) && ($target > $CATS['uids'][$content['cat']])) $target = $CATS['uids'][$content['cat']];
+                                       if ((isset($CATS['uids'][$content['cat_id']])) && ($content['target_send'] > $CATS['uids'][$content['cat_id']])) $content['target_send'] = $CATS['uids'][$content['cat_id']];
 
                                        // Old order is grabbed
                                        $OLD_ORDER = true;
                                } else {
                                        // Default output for that your members don't forget it...
-                                       $url = 'http://';
+                                       $content['url'] = 'http://';
                                }
 
                                // Free result
@@ -669,7 +669,7 @@ LIMIT 1",
                                        $CAT = '';
                                        foreach ($CATS['id'] as $key => $value) {
                                                $CAT .= "      <option value=\"".$value."\"";
-                                               if (($OLD_ORDER) && ($content['cat'] == $value)) $CAT .= ' selected="selected"';
+                                               if (($OLD_ORDER) && ($content['cat_id'] == $value)) $CAT .= ' selected="selected"';
                                                $CAT .= ">".$CATS['name'][$key]." (".$CATS['uids'][$key]." {--USER_IN_CAT--})</option>\n";
                                        } // END - foreach
 
@@ -680,7 +680,7 @@ LIMIT 1",
                                                if (is_array($value)) {
                                                        // Output option line
                                                        $type .= "      <option value=\"".$typeS[$key][0]."\"";
-                                                       if (($OLD_ORDER) && ($payment == $typeS[$key][0])) $type .= ' selected="selected"';
+                                                       if (($OLD_ORDER) && ($content['payment_id'] == $typeS[$key][0])) $type .= ' selected="selected"';
                                                        $type .= ">".$P." {--PER_MAIL--} - ".$typeS[$key][3]." - ".round($typeS[$key][2])." {--PAYMENT--}</option>\n";
                                                } // END - if
                                        } // END - foreach
@@ -688,10 +688,10 @@ LIMIT 1",
                                        // Put all in constants for the template
                                        define('CATEGORY_SELECTION', $CAT);
                                        define('TYPE_SELECTION', $type);
-                                       define('TARGET', $target);
-                                       define('SUBJECT', $subject);
-                                       define('TEXT', COMPILE_CODE($text));
-                                       define('T_URL', $url);
+                                       define('TARGET', $content['target_send']);
+                                       define('SUBJECT', $content['subject']);
+                                       define('TEXT', COMPILE_CODE($content['text']));
+                                       define('T_URL', $content['url']);
 
                                        if (REQUEST_ISSET_POST('zip')) {
                                                // Output entered ZIP code
@@ -771,5 +771,5 @@ if (!empty($URL)) {
        redirectToUrl($URL);
 } // END - if
 
-//
+// [EOF]
 ?>
index 0624cd4f2fdb7da4b039e5a2d460daeac4ff6243..86f2fdd76208774249ab5d40356574dbafb959b6 100644 (file)
@@ -75,7 +75,7 @@ while ($content = SQL_FETCHARRAY($result_depths)) {
                // Also count locked points
                $TPTS += $points; $TLOCK += $locked;
        } else {
-               $points = "0.00000"; $locked = "0.00000";
+               $points = '0.00000'; $locked = '0.00000';
        }
 
        // Load referal counts
@@ -134,7 +134,7 @@ if (GET_EXT_VERSION('user') >= '0.1.2') {
 }
 
 // If TLOCK is 0 add 3 zeros for floating
-if ($TLOCK == '0') $TLOCK = "0.00000";
+if ($TLOCK == '0') $TLOCK = '0.00000';
 
 // Remember several values in constants
 define('__USED_VALUE' , translateComma($USED));
index 00181aafac5695d369dca4440c498f9a2baeee8e..a1770d8fd52fe3845598fffe03d29f93ae5c233c 100644 (file)
@@ -104,7 +104,7 @@ if (!REQUEST_ISSET_GET('mode')) {
                        );
 
                        // Load row template
-                       $content['rows'] .= LOAD_TEMPLATE("member_primera_mode_list_row", true, $rowContent);
+                       $content['rows'] .= LOAD_TEMPLATE('member_primera_mode_list_row', true, $rowContent);
                        $SW = 3 - $SW;
                }
 
index fce5430be71ff433d64fd821d861edcb6b18d44c..c4cfe8bb6b7766e3f5b6c84e4d2c883c800749a8 100644 (file)
@@ -55,22 +55,30 @@ OUTPUT_HTML("<div align=\"center\">");
 // Check for possible running rallyes
 $ADMIN = " AND d.is_active='Y'";
 if (IS_ADMIN()) $ADMIN = '';
-$result = SQL_QUERY("SELECT DISTINCT d.id, d.admin_id, a.login, d.title, d.descr, d.template, d.start_time, d.end_time, d.min_users, d.min_prices
- FROM `{!_MYSQL_PREFIX!}_rallye_data` AS d, `{!_MYSQL_PREFIX!}_admins` AS a
- WHERE d.admin_id=a.id".$ADMIN." AND d.notified='Y'
- ORDER BY d.end_time LIMIT 1", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT
+       d.id, d.admin_id, a.login, d.title, d.descr, d.template, d.start_time, d.end_time, d.min_users, d.min_prices
+FROM
+       `{!_MYSQL_PREFIX!}_rallye_data` AS d
+INNER JOIN
+       `{!_MYSQL_PREFIX!}_admins` AS a
+ON
+       d.admin_id=a.id
+WHERE
+       d.notified='Y'".$ADMIN."
+ORDER BY
+       d.end_time ASC
+LIMIT 1", __FILE__, __LINE__);
 
 if (SQL_NUMROWS($result) == 1) {
        // Found some (normally one...
-       list($id, $aid, $login, $title, $descr, $templ, $start, $end, $min_users, $min_prices) = SQL_FETCHROW($result);
-       SQL_FREERESULT($result);
+       $content = SQL_FETCHARRAY($result);
 
        $expired = false;
-       if ($end < time()) {
+       if ($content['end_time'] < time()) {
                // Rallye is expired
                define('__RALLYE_EXTRAS', getMessage('RALLYE_HAS_EXPIRED'));
                $expired = true;
-       } elseif (time() >= ($end - getConfig('one_day'))) {
+       } elseif (time() >= ($content['end_time'] - getConfig('one_day'))) {
                // Rallye will expire in less one day!
                define('__RALLYE_EXTRAS', getMessage('RALLYE_EXPIRE_ONE_DAY'));
        } else {
@@ -78,47 +86,50 @@ if (SQL_NUMROWS($result) == 1) {
        }
 
        // Set admin line (currently set to impressum, later to contact form)
-       define('__RALLYE_ADMIN', "<a href=\"{!URL!}/modules.php?module=index&amp;what=impressum&amp;admin=".$aid."\">".$login."</a>");
+       define('__RALLYE_ADMIN', "<a href=\"{!URL!}/modules.php?module=index&amp;what=impressum&amp;admin=".$content['admin_id']."\">".$content['login']."</a>");
 
        // Set title
-       define('__RALLYE_TITLE', COMPILE_CODE($title));
+       define('__RALLYE_TITLE', COMPILE_CODE($content['title']));
 
        // Handle description...
-       if ((empty($descr)) && (!empty($templ))) {
+       if ((empty($content['descr'])) && (!empty($content['template']))) {
                // Use description from template
-               define('__RALLYE_DESCR', LOAD_TEMPLATE("rallye_".$templ, true));
+               define('__RALLYE_DESCR', LOAD_TEMPLATE('rallye_' . $content['template'], true));
        } else {
                // Use description from database
-               define('__RALLYE_DESCR', COMPILE_CODE($descr));
+               define('__RALLYE_DESCR', COMPILE_CODE($content['descr']));
        }
 
        // Determine min_users/prices
-       define('__RALLYE_MAX_USERS' ,  RALLYE_DETERMINE_MIN_USERS($min_users));
-       define('__RALLYE_MAX_PRICES',  RALLYE_DETERMINE_MIN_PRICES($min_prices));
+       define('__RALLYE_MAX_USERS' ,  RALLYE_DETERMINE_MIN_USERS($content['min_users']));
+       define('__RALLYE_MAX_PRICES',  RALLYE_DETERMINE_MIN_PRICES($content['min_prices']));
 
        // Set start and end time
-       define('__RALLYE_START', generateDateTime($start, '1'));
-       define('__RALLYE_END'  , generateDateTime($end  , '1'));
+       define('__RALLYE_START', generateDateTime($content['start_time'], '1'));
+       define('__RALLYE_END'  , generateDateTime($content['end_time']  , '1'));
 
        if ($expired === true) {
-               define('__RALLYE_PRICES', RALLYE_LIST_WINNERS($id));
+               define('__RALLYE_PRICES', RALLYE_LIST_WINNERS($content['id']));
                define('__RALLYE_TOP_USERS', "<div align=\"center\" class=\"big\">{!__RALLYE_EXTRAS!}</div>");
                define('__RALLYE_CAN_WIN_THIS', getMessage('RALLYE_OUR_WINNERS_ARE'));
        } else {
-               define('__RALLYE_PRICES', RALLYE_ADD_PRICES($id, 'html'));
-               define('__RALLYE_TOP_USERS', RALLYE_ADD_TOPUSERS($id, getUserId()));
+               define('__RALLYE_PRICES', RALLYE_ADD_PRICES($content['id'], 'html'));
+               define('__RALLYE_TOP_USERS', RALLYE_ADD_TOPUSERS($content['id'], getUserId()));
                define('__RALLYE_CAN_WIN_THIS', getMessage('RALLYE_YOU_CAN_WIN'));
        }
 
        // And load final template
-       LOAD_TEMPLATE("guest_rallye_show");
+       LOAD_TEMPLATE('guest_rallye_show');
 } else {
        // No rallye found so far
-       LOAD_TEMPLATE("guest_no_rallyes");
+       LOAD_TEMPLATE('guest_no_rallyes');
 }
 
+// Free result
+SQL_FREERESULT($result);
+
 //
-OUTPUT_HTML("</div>");
+OUTPUT_HTML('</div>');
 
 //
 ?>
index 375e1f66a4938f2f0714b1f9ba28e261f4d32406..8688d2a476e98f3fc5a2a117ab32d707adc36b25 100644 (file)
@@ -48,9 +48,9 @@ if (!defined('__SECURITY')) {
 ADD_DESCR('member', __FILE__);
 
 // Load current referal clicks
-$result = SQL_QUERY_ESC("SELECT ref_clicks FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-array(getUserId()), __FILE__, __LINE__);
-list($c) = SQL_FETCHROW($result);
+$result = SQL_QUERY_ESC("SELECT `ref_clicks` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+       array(getUserId()), __FILE__, __LINE__);
+$content = SQL_FETCHARRAY($result);
 SQL_FREERESULT($result);
 
 OUTPUT_HTML("<div class=\"tiny\">{--YOUR_PERSONAL_REFLINK--}:<br />
@@ -74,10 +74,11 @@ if (EXT_IS_ACTIVE('nickname')) {
 }
 
 // Clicks on your reflink
-OUTPUT_HTML("{--YOUR_REFCLICKS--}: <strong>".$c."</strong> {--CLICKS--}</div><br /><br />");
+OUTPUT_HTML("{--YOUR_REFCLICKS--}: <strong>".$content['ref_clicks']."</strong> {--CLICKS--}</div><br /><br />");
+
 $whereStatement = " WHERE `visible`='Y'";
 if (IS_ADMIN()) $whereStatement = '';
-$result = SQL_QUERY("SELECT id, url, alternate, counter, clicks FROM `{!_MYSQL_PREFIX!}_refbanner`", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT `id`, `url`, `alternate`, `counter`, `clicks` FROM `{!_MYSQL_PREFIX!}_refbanner`", __FILE__, __LINE__);
 
 if (SQL_NUMROWS($result) > 0) {
        // List available ref banners
@@ -92,38 +93,30 @@ if (SQL_NUMROWS($result) > 0) {
                                // will cause an "Invalid argument supplied for foreach()" error
                                foreach ($fp as $f) {
                                        $bannerContent .= $f;
-                               }
-                       }
+                               } // END - foreach
+                       } // END - if
                        $size = strlen($bannerContent);
                } elseif (isFileReadable($test)) {
                        $size = filesize($test);
                }
 
-               if ($size > 0) $content['alternate'] .= " (".translateComma(round($size/102.4)/10)." {--KBYTES--})";
+               if ($size > 0) $content['alternate'] .= ' ('  .translateComma(round($size / 102.4) / 10) . ' {--KBYTES--})';
 
-               // Load banner data
-               // @TODO Rewritings: alt->alternate,cnt->counter,cks->clicks,uid->userid in template
-               $content = array(
-                       'sw'  => $SW,
-                       'url' => $content['url'],
-                       'alt' => $content['alternate'],
-                       'cnt' => $content['counter'],
-                       'cks' => $content['clicks'],
-                       'uid' => getUserId(),
-                       'id'  => $content['id'],
-               );
+               // Add some more data
+               $content['sw']     = $SW;
+               $content['userid'] = getUserId();
 
                // Add row
-               $OUT .= LOAD_TEMPLATE("member_reflinks_row", true, $content);
+               $OUT .= LOAD_TEMPLATE('member_reflinks_row', true, $content);
 
                // Switchcolors
                $SW = 3 - $SW;
-       }
+       } // END - while
 
        define('__REFLINKS_ROWS', $OUT);
 
        // Load final template
-       LOAD_TEMPLATE("member_reflinks_table", false, getUserId());
+       LOAD_TEMPLATE('member_reflinks_table', false, getUserId());
 } else {
        // No refbanner found!
        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('MEMBER_NO_REFBANNER_FOUND'));
@@ -132,5 +125,5 @@ if (SQL_NUMROWS($result) > 0) {
 // Free result
 SQL_FREERESULT($result);
 
-//
+// [EOF]
 ?>
index 739b83a55b0f262415df34f32587e20933921bc6..110701133dc3abbf37be41670019474f0fec20c2 100644 (file)
@@ -97,38 +97,41 @@ if (SQL_NUMROWS($result) > 0) {
 SQL_FREERESULT($result);
 
 // Load sent orders
-//                               0     1         2         3      4            5            6            7           8
-$result = SQL_QUERY_ESC("SELECT id, cat_id, payment_id, subject, url, timestamp_ordered, max_rec, timestamp_send, clicks
-FROM `{!_MYSQL_PREFIX!}_user_stats`
-WHERE userid=%s
-ORDER BY timestamp_ordered DESC",
-array(getUserId()), __FILE__, __LINE__);
+$result = SQL_QUERY_ESC("SELECT
+       `id`, `cat_id`, `payment_id`, `subject`, `url`, `timestamp_ordered`, `max_rec`, `timestamp_send`, `clicks`
+FROM
+       `{!_MYSQL_PREFIX!}_user_stats`
+WHERE
+       `userid`=%s
+ORDER BY
+       `timestamp_ordered` DESC",
+       array(getUserId()), __FILE__, __LINE__);
 
 if (SQL_NUMROWS($result) > 0) {
        // Mail orders are in pool so we can display them
        $OUT = ''; $SW = 2;
-       while ($data = SQL_FETCHROW($result)) {
+       while ($content = SQL_FETCHARRAY($result)) {
                // Prepare data for the template
                $content = array(
                        'sw'    => $SW,
-                       'cat'   => getCategory($data[1]),
-                       'pay'   => getPaymentTitlePrice($data[2]),
-                       'subj'  => COMPILE_CODE($data[3]),
-                       'url'   => DEREFERER($data[4]),
-                       'stamp' => generateDateTime($data[5], '2'),
-                       'recs'  => $data[6],
-                       'sent'  => generateDateTime($data[7], '2'),
-                       'clix'  => $data[8],
-                       'perc'  => COMPILE_CODE($data[8] / $data[6] * 100)."%",
+                       'cat'   => getCategory($content['cat_id']),
+                       'pay'   => getPaymentTitlePrice($content['payment_id']),
+                       'subj'  => COMPILE_CODE($content['subject']),
+                       'url'   => DEREFERER($content['url']),
+                       'stamp' => generateDateTime($content['timestamp_ordered'], '2'),
+                       'recs'  => $content['max_rec'],
+                       'sent'  => generateDateTime($content['timestamp_send'], '2'),
+                       'clix'  => $content['clicks'],
+                       'perc'  => COMPILE_CODE($content['clicks'] / $content['max_rec'] * 100)."%",
                );
 
                // Load row template and switch colors
-               $OUT .= LOAD_TEMPLATE("member_stats_row", true, $content);
+               $OUT .= LOAD_TEMPLATE('member_stats_row', true, $content);
                $SW = 3 - $SW;
        }
 
        // Load main template
-       $main_content['stats'] = LOAD_TEMPLATE("member_stats_table", true, $OUT);
+       $main_content['stats'] = LOAD_TEMPLATE('member_stats_table', true, $OUT);
 } else {
        // No mail orders fond
        $main_content['stats'] = LOAD_TEMPLATE('admin_settings_saved', true, getMessage('MEMBER_NO_MAILS_IN_STATS'));
@@ -138,7 +141,7 @@ if (SQL_NUMROWS($result) > 0) {
 SQL_FREERESULT($result);
 
 // Load main template
-LOAD_TEMPLATE("member_stats_pool", false, $main_content);
+LOAD_TEMPLATE('member_stats_pool', false, $main_content);
 
 //
 ?>
index ba5d83c97aeefbf316193744e89b1299daf0909a..4403462e86762024b09f8226b4dfedf22ae49fdc 100644 (file)
@@ -183,7 +183,7 @@ if ((!REQUEST_ISSET_GET('mode')) || (REQUEST_GET('mode') == 'choose')) {
        WERNIS_ADD_FEES_TO_ARRAY($content);
 
        // Get WDS66 id
-       $result = SQL_QUERY_ESC("SELECT wernis_userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT `wernis_userid` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
                array(getUserId()), __FILE__, __LINE__);
 
        // Are there some entries?
index 102a3de242ca0f87ac1ffe51ce5cd1d5a58922cf..d07f48dbe551559e9b76013969417f1d0e9f7de0 100644 (file)
@@ -1810,7 +1810,7 @@ function updateConfiguration ($entries, $values, $updateMode='') {
                        // Update mode set?
                        if (!empty($updateMode)) {
                                // Update entry
-                               // @TODO Find a way for updating $_CONFIG here
+                               // @TODO Find a way for updating configuration here
                                $all .= sprintf("`%s`=%s%s%s,", $entry, $entry, $updateMode, (float)$values[$idx]);
                        } else {
                                // Check if string or number
@@ -1834,7 +1834,7 @@ function updateConfiguration ($entries, $values, $updateMode='') {
                $entries = substr($all, 0, -1);
        } elseif (!empty($updateMode)) {
                // Update mode set
-               // @TODO Find a way for updating $_CONFIG here
+               // @TODO Find a way for updating configuration here
                $entries .= sprintf("=%s%s%s", $entries, $updateMode, (float)$values);
        } else {
                // Set it in config first
diff --git a/ref.php b/ref.php
index 730799b089100b6473261d2ae044cf01d839155f..08398c7efc55031c5db1a0cdd9769a4ac7c25f43 100644 (file)
--- a/ref.php
+++ b/ref.php
@@ -69,22 +69,20 @@ if (REQUEST_ISSET_GET('ref'))        $ref = REQUEST_GET('ref');
 
 if (!empty($ref)) {
        // Test if nickname or numeric id
-       if ($ref != ''.($ref + 0).'') {
-               if (EXT_IS_ACTIVE('nickname')) {
-                       // Nickname in URL, so load the ID
-                       $result = SQL_QUERY_ESC("SELECT `userid` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nickname`='%s' LIMIT 1",
-                               array($ref), __FILE__, __LINE__);
-
-                       // Load userid
-                       list($ref) = SQL_FETCHROW($result);
-
-                       // Free result
-                       SQL_FREERESULT($result);
-               } else {
-                       // Invalid request!
-                       $ref = 0;
-               }
-       } // END - if
+       if (EXT_IS_ACTIVE('nickname')) {
+               // Nickname in URL, so load the ID
+               $result = SQL_QUERY_ESC("SELECT `userid` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nickname`='%s' LIMIT 1",
+                       array($ref), __FILE__, __LINE__);
+
+               // Load userid
+               list($ref) = SQL_FETCHROW($result);
+
+               // Free result
+               SQL_FREERESULT($result);
+       } else {
+               // Invalid request!
+               $ref = 0;
+       }
 
        // Also edit this 0 !
        if (empty($ref)) $ref = 0;
index 889ff57ba28987dd6ddfab1834aee99eafc583a9..68e52ced1961d3a21c8d214e7291a98083462e3e 100644 (file)
@@ -7,7 +7,7 @@ Sie k&ouml;nnen sich nun hier einloggen:
 Ihre Login-ID lautet: $UID
 URL zum Login: {!URL!}/login.php
 
-f&uuml;r Ihre Anmeldung werden wir Ihnen als Willkommensgutschrift $content[points] {!POINTS!} gutschreiben, sobald Sie $_CONFIG[ref_payout] Mails best&auml;tigt haben. Erst dann k&ouml;nnen Sie Mails an die anderen Mitglieder verschicken!
+f&uuml;r Ihre Anmeldung werden wir Ihnen als Willkommensgutschrift $content[points] {!POINTS!} gutschreiben, sobald Sie {?ref_payout?} Mails best&auml;tigt haben. Erst dann k&ouml;nnen Sie Mails an die anderen Mitglieder verschicken!
 
 Wir w&uuml;nschen Ihnen viel Spass und Erfolg beim Mail-Versand!
 
index bd624006ce889b9901a0dba1cae257e2f105f663..9bbc0f1192c54d689603db0815222ceb253eef5a 100644 (file)
   <td>
     <select name="warning_interval" class="admin_select" size="1">
       <option value="0">{--SELECT_NONE--}</option>
-      <option value="{--($_CONFIG['one_day']*1)--}">1 {--DAYS--}</option>
-      <option value="{--($_CONFIG['one_day']*3)--}">3 {--DAYS--}</option>
-      <option value="{--($_CONFIG['one_day']*7)--}" selected="selected">1 {--LIFE_WEEKS--}</option>
-      <option value="{--($_CONFIG['one_day']*14)--}">2 {--LIFE_WEEKS--}</option>
-      <option value="{--($_CONFIG['one_day']*28)--}">4 {--LIFE_WEEKS--}</option>
-      <option value="{--($_CONFIG['one_day']*56)--}">8 {--LIFE_WEEKS--}</option>
+      <option value="{--({?one_day?}*1)--}">1 {--DAYS--}</option>
+      <option value="{--({?one_day?}*3)--}">3 {--DAYS--}</option>
+      <option value="{--({?one_day?}*7)--}" selected="selected">1 {--LIFE_WEEKS--}</option>
+      <option value="{--({?one_day?}*14)--}">2 {--LIFE_WEEKS--}</option>
+      <option value="{--({?one_day?}*28)--}">4 {--LIFE_WEEKS--}</option>
+      <option value="{--({?one_day?}*56)--}">8 {--LIFE_WEEKS--}</option>
     </select>
   </td>
   <td class="seperator" width="10">&nbsp;</td>
index ac474083281700b94837046139092282e5119f88..88f3eee594d04ead9d55cfc86662858607ae4233 100644 (file)
@@ -12,7 +12,7 @@
                <td width="400" align="right">{--ADMIN_NICKNAME_MIN_LENGTH--}:</td>
                <td class="seperator" width="10">&nbsp;</td>
                <td width="170">
-                       <input type="text" name="nickname_len" class="admin_normal" value="$_CONFIG[nickname_length]" size="3" maxlength="4" />
+                       <input type="text" name="nickname_len" class="admin_normal" value="{?nickname_len?}" size="3" maxlength="4" />
                </td>
        </tr>
        <tr>
@@ -22,7 +22,7 @@
                <td width="400" align="right">{--ADMIN_NICKNAME_PATTERN--}:</td>
                <td class="seperator" width="10">&nbsp;</td>
                <td width="170">
-                       <input type="text" name="nickname_pattern" class="admin_normal" value="$_CONFIG[nickname_pattern]" size="10" maxlength="255" />
+                       <input type="text" name="nickname_pattern" class="admin_normal" value="{?nickname_pattern?}" size="10" maxlength="255" />
                </td>
        </tr>
        <tr>
@@ -32,7 +32,7 @@
                <td width="400" align="right">{--ADMIN_NICKNAME_LANG_CHARS--}:</td>
                <td class="seperator" width="10">&nbsp;</td>
                <td width="170">
-                       <input type="text" name="nickname_chars" class="admin_normal" value="$_CONFIG[nickname_chars]" size="15" maxlength="255" />
+                       <input type="text" name="nickname_chars" class="admin_normal" value="{?nickname_chars?}" size="15" maxlength="255" />
                </td>
        </tr>
        <tr>
index 5a0f5263272a8ca2f69b51c90123fd67d7eb966a..dbaf1e8137ed6ba9539a60e5273b7be0ab1471d1 100644 (file)
   <td>
     <select name="warning_interval" class="guest_select" size="1">
       <option value="0">{--SELECT_NONE--}</option>
-      <option value="{--($_CONFIG['one_day']*1)--}">1 {--DAYS--}</option>
-      <option value="{--($_CONFIG['one_day']*3)--}">3 {--DAYS--}</option>
-      <option value="{--($_CONFIG['one_day']*7)--}" selected="selected">1 {--LIFE_WEEKS--}</option>
-      <option value="{--($_CONFIG['one_day']*14)--}">2 {--LIFE_WEEKS--}</option>
-      <option value="{--($_CONFIG['one_day']*28)--}">4 {--LIFE_WEEKS--}</option>
-      <option value="{--($_CONFIG['one_day']*56)--}">8 {--LIFE_WEEKS--}</option>
+      <option value="{--({?one_day?}*1)--}">1 {--DAYS--}</option>
+      <option value="{--({?one_day?}*3)--}">3 {--DAYS--}</option>
+      <option value="{--({?one_day?}*7)--}" selected="selected">1 {--LIFE_WEEKS--}</option>
+      <option value="{--({?one_day?}*14)--}">2 {--LIFE_WEEKS--}</option>
+      <option value="{--({?one_day?}*28)--}">4 {--LIFE_WEEKS--}</option>
+      <option value="{--({?one_day?}*56)--}">8 {--LIFE_WEEKS--}</option>
     </select>
   </td>
   <td class="seperator" width="10">&nbsp;</td>
index c41974fd725e7149bf62ef9bf9c862eebe38acb5..228f041fea13a5b27091e938915f1ec850177c3b 100644 (file)
@@ -15,9 +15,9 @@
        </tr>
        <tr>
                <td width="50%" align="right">{--YES--}:&nbsp;<input type="radio"
-                       name="html" class="member_normal" value="Y"{!HTML_Y!} />&nbsp;&nbsp;</td>
+                       name="html" class="member_normal" value="Y"$content[html_y] />&nbsp;&nbsp;</td>
                <td width="50%" align="left">&nbsp;&nbsp;{--NO--}:&nbsp;<input
-                       type="radio" name="html" class="member_normal" value="N"{!HTML_N!} /></td>
+                       type="radio" name="html" class="member_normal" value="N"$content[html_n] /></td>
        </tr>
        <tr>
                <td colspan="2" class="seperator bottom2" height="5">&nbsp;</td>
index efc646a0abe3afb06b242313a0cebbc8a2cf6cad..4825f9677052dd598fd7a8cdf32d0dede021c82c 100644 (file)
@@ -22,7 +22,7 @@
                <td align="right">{--NICKNAME_ENTER_NICKNAME--}:</td>
                <td width="5" class="seperator">&nbsp;</td>
                <td>
-                       <input type="text" name="nickname" class="member_normal" size="30" maxlength="30" value="{!__NICKNAME!}" />
+                       <input type="text" name="nickname" class="member_normal" size="30" maxlength="30" value="$content" />
                </td>
                <td width="5" class="seperator">&nbsp;</td>
        </tr>
@@ -31,7 +31,7 @@
        </tr>
        <tr>
                <td width="5" class="seperator">&nbsp;</td>
-               <td colspan="3" align="center">{--NICKNAME_ALLOWED_CHARS--} ($content[nickname_chars])</td>
+               <td colspan="3" align="center">{--NICKNAME_ALLOWED_CHARS--} ({?nickname_chars?})</td>
                <td width="5" class="seperator">&nbsp;</td>
        </tr>
        <tr>
index 110b811bb8d6d6e7107a34179aafce499fb1dbac..7ff93357de56232d66abc571bbb5c90d88e1cf1b 100644 (file)
@@ -3,8 +3,8 @@
        <td align="center" class="member_refbanner switch_sw$content[sw]">
                <img src="$content[url]" alt="$content[alt]" title="$content[alt]" border="0"><br />
                <div class="tiny">{--REFBANNER_TOTALS--}:
-                       <strong>$content[cnt]</strong>&nbsp;{--REF_VIEWS--} /
-                       <strong>$content[cks]</strong>&nbsp;{--REF_CLIX--}
+                       <strong>$content[counter]</strong>&nbsp;{--REF_VIEWS--} /
+                       <strong>$content[clicks]</strong>&nbsp;{--REF_CLIX--}
                </div>
        </td>
        <td width="10" class="member_refbanner switch_sw$content[sw]">&nbsp;</td>
@@ -16,9 +16,9 @@
 <tr>
        <td width="10" class="member_refbanner switch_sw$content[sw]">&nbsp;</td>
        <td align="center" class="member_refbanner switch_sw$content[sw]">
-       <pre>&lt;A href=&quot;{!URL!}/click.php?user=$content[uid]&amp;banner=$content[id]&quot;
- target=&quot;_blank&quot;&gt;&lt;IMG src=&quot;{!URL!}/view.php?user=$content[uid]&amp;banner=$content[id]&quot;
- alt=&quot;$content[alt]&quot; title=&quot;$content[alt]&quot; border=&quot;0&quot;&gt;&lt;/A&gt;</pre>
+       <pre>&lt;a href=&quot;{!URL!}/click.php?user=$content[userid]&amp;banner=$content[id]&quot;
+ target=&quot;_blank&quot;&gt;&lt;img src=&quot;{!URL!}/view.php?user=$content[userid]&amp;banner=$content[id]&quot;
+ alt=&quot;$content[alternate]&quot; title=&quot;$content[alternate]&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;</pre>
        </td>
        <td width="10" class="member_refbanner switch_sw$content[sw]">&nbsp;</td>
 </tr>
index 35df14aa7c6550168acd2d931c5446f5e4f92469..812fb1d502e7d1b603d624a532950c4ef1fc60b4 100644 (file)
   <td class="bottom2" width="275" align="center">
     <select name="warning_interval" class="guest_select" size="1">
       <option value="$content[warning_interval]">{!__CURRENT!}</option>
-      <option value="{--($_CONFIG['one_day']*1)--}">1 {--DAYS--}</option>
-      <option value="{--($_CONFIG['one_day']*3)--}">3 {--DAYS--}</option>
-      <option value="{--($_CONFIG['one_day']*7)--}">1 {--LIFE_WEEKS--}</option>
-      <option value="{--($_CONFIG['one_day']*14)--}">2 {--LIFE_WEEKS--}</option>
-      <option value="{--($_CONFIG['one_day']*28)--}">4 {--LIFE_WEEKS--}</option>
-      <option value="{--($_CONFIG['one_day']*56)--}">8 {--LIFE_WEEKS--}</option>
+      <option value="{--({?one_day?}*1)--}">1 {--DAYS--}</option>
+      <option value="{--({?one_day?}*3)--}">3 {--DAYS--}</option>
+      <option value="{--({?one_day?}*7)--}">1 {--LIFE_WEEKS--}</option>
+      <option value="{--({?one_day?}*14)--}">2 {--LIFE_WEEKS--}</option>
+      <option value="{--({?one_day?}*28)--}">4 {--LIFE_WEEKS--}</option>
+      <option value="{--({?one_day?}*56)--}">8 {--LIFE_WEEKS--}</option>
     </select>
   </td>
 </tr>