]> git.mxchange.org Git - mailer.git/commitdiff
Huge rewrite:
authorRoland Häder <roland@mxchange.org>
Mon, 5 Oct 2009 19:18:17 +0000 (19:18 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 5 Oct 2009 19:18:17 +0000 (19:18 +0000)
- All opendir() calles are now rewritten to getArrayFromDirectory()
- ... which is now generic and moved to inc/functions.php
- A lot more database column names surrounded by back-ticks (`)
- More double quotes rewritten to single quotes
- TODOS.txt updated

74 files changed:
DOCS/TODOs.txt
beg.php
birthday_confirm.php
inc/autopurge/purge-general.php
inc/autopurge/purge-inact.php
inc/autopurge/purge-mails.php
inc/code-functions.php
inc/doubler_send.php
inc/extensions.php
inc/extensions/ext-bonus.php
inc/filters.php
inc/functions.php
inc/inc-functions.php
inc/libs/autopurge_functions.php
inc/libs/holiday_functions.php
inc/libs/online_functions.php
inc/libs/rallye_functions.php
inc/libs/refback_functions.php
inc/libs/sponsor_functions.php
inc/libs/surfbar_functions.php
inc/libs/task_functions.php
inc/libs/user_functions.php
inc/libs/wernis_functions.php
inc/libs/yoomedia_functions.php
inc/mails/birthday_mails.php
inc/modules/admin/what-add_points.php
inc/modules/admin/what-admins_contct.php
inc/modules/admin/what-config_payouts.php
inc/modules/admin/what-del_email.php
inc/modules/admin/what-del_holiday.php
inc/modules/admin/what-del_sponsor.php
inc/modules/admin/what-edit_sponsor.php
inc/modules/admin/what-email_archiv.php
inc/modules/admin/what-list_country.php
inc/modules/admin/what-list_links.php
inc/modules/admin/what-list_newsletter.php
inc/modules/admin/what-list_payouts.php
inc/modules/admin/what-lock_sponsor.php
inc/modules/admin/what-lock_user.php
inc/modules/admin/what-logs.php
inc/modules/admin/what-send_newsletter.php
inc/modules/admin/what-sub_points.php
inc/modules/admin/what-theme_import.php
inc/modules/admin/what-unlock_emails.php
inc/modules/admin/what-unlock_sponsor.php
inc/modules/admin/what-user_contct.php
inc/modules/guest/what-confirm.php
inc/modules/guest/what-sponsor_login.php
inc/modules/login.php
inc/modules/member/what-holiday.php
inc/modules/member/what-mydata.php
inc/modules/member/what-newsletter.php
inc/modules/member/what-payout.php
inc/modules/member/what-support.php
inc/modules/member/what-surfbar_book.php
inc/modules/member/what-themes.php
inc/modules/member/what-transfer.php
inc/modules/order.php
inc/monthly/monthly_beg.php
inc/monthly/monthly_bonus.php
inc/monthly/monthly_newsletter.php
inc/mysql-connect.php
inc/mysql-manager.php
inc/pool/pool-bonus.php
inc/pool/pool-user.php
inc/profile-updte.php
inc/reset/reset_holiday.php
inc/stats_bonus.php
inc/wrapper-functions.php
lead-confirm.php
mailid.php
mailid_top.php
ref.php
surfbar.php

index cecb0ab154267d288dc8612f504cf21683805f82..1e4129dca69a7ed43daa0528e1702166b86310c8 100644 (file)
 ./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:214:       // @TODO Remove this sanity-check if all is fine
-./inc/functions.php:2406:      // @TODO The status should never be empty
-./inc/functions.php:2497:                      // @TODO shouldn't do the unset and the reloading $GLOBALS['cache_instance']->destroyCacheFile() Or a new methode like forceCacheReload('revision')?
+./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 Fine 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:2560:// @TODO Please describe this function
-./inc/functions.php:2572:      searchDirsRecursive($next_dir, $last_changed); // @TODO small change to API to $last_changed = searchDirsRecursive($next_dir, $time);
-./inc/functions.php:2655:              // @TODO Add a little more infos here
-./inc/functions.php:2666:      // @TODO This cannot be rewritten to app_die(), try to find a solution for this.
-./inc/functions.php:2824:                      // @TODO Are these convertions still required?
-./inc/functions.php:2842:// @TODO Rewrite this function to use readFromFile() and writeToFile()
+./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/install-inc.php:20: * @TODO Rewrite all constants in this include file                     *
@@ -43,8 +43,7 @@
 ./inc/libs/cache_functions.php:412:    // @TODO Add support for more types which break in last else-block
 ./inc/libs/doubler_functions.php:46:// @TODO Lame description
 ./inc/libs/rallye_functions.php:631:   $EXPIRE = getConfig('one_day') * 3; // @TODO The hard-coded value...
-./inc/libs/rallye_functions.php:661:                   // @TODO Rewrite this to a function
-./inc/libs/rallye_functions.php:697:           // @TODO Rewrite this to our API function
+./inc/libs/rallye_functions.php:693:           // @TODO Rewrite this to our API function
 ./inc/libs/register_functions.php:53:          // @TODO Rewrite these constants
 ./inc/libs/register_functions.php:62:  // @TODO Rewrite these constants, too
 ./inc/libs/register_functions.php:97:// @TODO This function is no longer used???
@@ -75,7 +74,7 @@
 ./inc/modules/admin/overview-inc.php:447:                      // @TODO Rewritings: admin->assigned_admin,uid->userid,type->task_type_msg in template
 ./inc/modules/admin.php:257:   // @TODO Rewrite all these constants
 ./inc/modules/admin.php:95:                                    // @TODO Why is this set to 'done'?
-./inc/modules/admin/what-add_points.php:120:                   // @TODO Rewrite these both constants
+./inc/modules/admin/what-add_points.php:119:                   // @TODO Rewrite these both constants
 ./inc/modules/admin/what-add_points.php:54:            // @TODO Rewrite this constant
 ./inc/modules/admin/what-add_surfbar_url.php:57:       // @TODO Find all convertSelectionsToTimestamp() calls and rewrite REQUEST_POST() calls to $POST
 ./inc/modules/admin/what-admin_add.php:121:                            // @TODO This can be somehow rewritten to a function
@@ -96,7 +95,7 @@
 ./inc/modules/admin/what-config_mods.php:139:          // @TODO Rewritings: mod->module in template
 ./inc/modules/admin/what-config_mods.php:161:  // @TODO Rewrite this constant
 ./inc/modules/admin/what-config_payouts.php:146:               // @TODO Rewrite this constant
-./inc/modules/admin/what-config_payouts.php:232:       // @TODO Rewrite this constant
+./inc/modules/admin/what-config_payouts.php:237:       // @TODO Rewrite this constant
 ./inc/modules/admin/what-config_points.php:267:                                // @TODO Rewritings: lvl->level, per->percents in template
 ./inc/modules/admin/what-config_rallye_prices.php:203:                         // @TODO Rewritings: level->price_level, infos->info in template
 ./inc/modules/admin/what-config_rallye_prices.php:220:                 // @TODO Rewrite these two constants
 ./inc/modules/admin/what-config_register.php:68:       // @TODO Move this HTML code into a template
 ./inc/modules/admin/what-config_register.php:85:// @TODO Rewrite this constant
 ./inc/modules/admin/what-config_rewrite.php:97:        // @TODO Rewrite this constant
+./inc/modules/admin/what-del_sponsor.php:58:                   // @TODO Rewrite these constants
+./inc/modules/admin/what-del_sponsor.php:86:                   // @TODO Rewrite these constants
 ./inc/modules/admin/what-del_transfer.php:106:// @TODO Rewrite all these constants
 ./inc/modules/admin/what-del_transfer.php:76:          // @TODO Rewritings: idx->trans_id in template
 ./inc/modules/admin/what-edit_emails.php:113:          // @TODO Yet another constant to rewrite
 ./inc/modules/admin/what-list_user.php:160:            // @TODO Rewrite these to filters
 ./inc/modules/admin/what-list_user.php:285:            // @TODO Rewrite this into a  filter
 ./inc/modules/admin/what-list_user.php:337:                    // @TODO Rewrite this into a filter
-./inc/modules/admin/what-lock_user.php:133:                            // @TODO Rewrite these all constants
+./inc/modules/admin/what-lock_user.php:139:                            // @TODO Rewrite these all constants
 ./inc/modules/admin/what-logs.php:69:                  // @TODO Fix content-type here
 ./inc/modules/admin/what-logs.php:72:                  // @TODO Fix content-type here
 ./inc/modules/admin/what-mem_add.php:126:                              // @TODO This can be somehow rewritten to a function
 ./inc/modules/admin/what-refbanner.php:150:                    // @TODO Rewritings: alt->alternate,cnt->counter,clx->clicks in template
 ./inc/modules/admin/what-refbanner.php:169:            // @TODO Rewrite this constant
 ./inc/modules/admin/what-repair_amnu.php:85:// @TODO This causes the whole (!) menu cache being rebuilded
-./inc/modules/admin/what-send_newsletter.php:86:       // @TODO Rewrite this constant
+./inc/modules/admin/what-send_newsletter.php:90:       // @TODO Rewrite this constant
 ./inc/modules/admin/what-sub_points.php:105:                   // @TODO Rewrite these constants
 ./inc/modules/admin/what-sub_points.php:53:    // @TODO Rewrite this constant
 ./inc/modules/admin/what-theme_check.php:126:                  // @TODO Move this HTML code to a template "admin_theme_row"
 ./inc/modules/member/what-unconfirmed.php:134: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
 ./inc/modules/order.php:76:            // @TODO Unused: 2,4
 ./inc/monthly/monthly_bonus.php:71:    // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1574:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
-./inc/mysql-manager.php:1617:                  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1769:  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1797:                          // @TODO Find a way for updating $_CONFIG here
-./inc/mysql-manager.php:1821:          // @TODO Find a way for updating $_CONFIG here
-./inc/mysql-manager.php:1844:// @TODO Can this be rewritten to a filter?
-./inc/mysql-manager.php:1906:                  // @TODO Rewrite this to $content = SQL_FETCHARRAY()
-./inc/mysql-manager.php:209:                   // @TODO Nothing helped???
-./inc/mysql-manager.php:2200:          // @TODO This can be somehow rewritten
-./inc/mysql-manager.php:244:                   // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:535:   // @TODO Try to rewrite this to one or more functions
-./inc/mysql-manager.php:564:                           // @TODO Try to rewrite this to one or more functions
-./inc/mysql-manager.php:972:                   // @TODO Why does this lead into an endless loop but we still need it???
-./inc/mysql-manager.php:973:                   // @TODO Commented out redirectToUrl('admin.php');
+./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:1770:  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1798:                          // @TODO Find a way for updating $_CONFIG here
+./inc/mysql-manager.php:1822:          // @TODO Find a way for updating $_CONFIG here
+./inc/mysql-manager.php:1845:// @TODO Can this be rewritten to a filter?
+./inc/mysql-manager.php:1907:                  // @TODO Rewrite this to $content = SQL_FETCHARRAY()
+./inc/mysql-manager.php:212:                   // @TODO Nothing helped???
+./inc/mysql-manager.php:2205:          // @TODO This can be somehow rewritten
+./inc/mysql-manager.php:247:                   // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:538:   // @TODO Try to rewrite this to one or more functions
+./inc/mysql-manager.php:567:                           // @TODO Try to rewrite this to one or more functions
+./inc/mysql-manager.php:973:                   // @TODO Why does this lead into an endless loop but we still need it???
+./inc/mysql-manager.php:974:                   // @TODO Commented out redirectToUrl('admin.php');
 ./inc/wrapper-functions.php:152:// @TODO Implement $compress
 ./inc/wrapper-functions.php:159:// @TODO Implement $decompress
-./inc/wrapper-functions.php:391:// @TODO Do some more sanity check here
-./mailid.php:139:                                      // @TODO Rewrite this to a filter
-./mailid.php:184:                                                      // @TODO Rewrite these constants
-./mailid.php:220:      // @TODO Rewrite this to a filter
-./mailid.php:95:               // @TODO Rewrite this to a filter
+./inc/wrapper-functions.php:389:// @TODO Do some more sanity check here
+./mailid.php:140:                                      // @TODO Rewrite this to a filter
+./mailid.php:185:                                                      // @TODO Rewrite these constants
+./mailid.php:221:      // @TODO Rewrite this to a filter
+./mailid.php:96:               // @TODO Rewrite this to a filter
 ./mailid_top.php:136:                                  // @TODO Rewrite this to a filter
 ./mailid_top.php:183:                                                  // @TODO Rewrite this to a filter
 ./mailid_top.php:190:                                                                  // @TODO Rewrite this to a filter
 ./mailid_top.php:228:                                                                  // @TODO Rewrite these blocks to filter
 ./mailid_top.php:89:           // @TODO Rewrite this to a filter
 ./show_bonus.php:108:                  // @TODO Rewrite this constant
-./surfbar.php:73:      // @TODO Display quick login form here or redirect as configured
+./surfbar.php:72:      // @TODO Display quick login form here or redirect as configured
 ### ### DEPRECATION FOLLOWS: ### ###
 ./inc/functions.php:238:       // @DEPRECATED Try to rewrite the if() condition
 ./inc/functions.php:252:                       // @DEPRECATED
diff --git a/beg.php b/beg.php
index e92a8f11bd96189c45fb9fb8ae8648091511ad15..27bb97df84504d8646f695e3fd77282a31bc6029 100644 (file)
--- a/beg.php
+++ b/beg.php
@@ -46,7 +46,7 @@ $GLOBALS['startTime'] = microtime(true);
 $GLOBALS['module'] = 'beg';
 $GLOBALS['refid']  = 0;
 $GLOBALS['output_mode'] = -1;
-$msg = null;
+$errorCode = null;
 
 // Load the required file(s)
 require('inc/config-global.php');
@@ -78,7 +78,7 @@ if (REQUEST_ISSET_GET('uid')) {
                                array(REQUEST_GET('uid')), __FILE__, __LINE__);
                } else {
                        // Nickname entered but nickname is not active
-                       $msg = getCode('EXTENSION_PROBLEM');
+                       $errorCode = getCode('EXTENSION_PROBLEM');
                        $uid = -1;
                }
        } else {
@@ -137,8 +137,8 @@ if (REQUEST_ISSET_GET('uid')) {
                                // Remember remote address, userid and timestamp for next click
                                // but only when there is no admin begging.
                                // Admins shall be able to test it!
-                               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_beg_ips` (userid, remote_ip,sid, timeout) VALUES ('%s','%s','%s', UNIX_TIMESTAMP())",
-                               array($uid, detectRemoteAddr(), session_id()), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_beg_ips` (`userid`, `remote_ip`,`sid`, `timeout`) VALUES ('%s','%s','%s', UNIX_TIMESTAMP())",
+                                       array($uid, detectRemoteAddr(), session_id()), __FILE__, __LINE__);
 
                                // Was is successfull?
                                $pay (SQL_AFFECTEDROWS() == 1);
@@ -207,28 +207,28 @@ if (REQUEST_ISSET_GET('uid')) {
                loadIncludeOnce('inc/footer.php');
        } elseif (($status != 'CONFIRMED') && ($status != 'failed')) {
                // Maybe locked/unconfirmed account?
-               $msg = generateErrorCodeFromUserStatus($status);
+               $errorCode = generateErrorCodeFromUserStatus($status);
        } elseif (($uid == '0') || ($status == 'failed')) {
                // Inalid or locked account, so let's find out
                $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1",
-               array(REQUEST_GET('uid')), __FILE__, __LINE__);
+                       array(REQUEST_GET('uid')), __FILE__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Locked account
-                       $msg = getCode('ACCOUNT_LOCKED');
+                       $errorCode = getCode('ACCOUNT_LOCKED');
                } else {
                        // Invalid nickname! (404)
-                       $msg = getCode('USER_404');
+                       $errorCode = getCode('USER_404');
                }
 
                // Free memory
                SQL_FREERESULT($result);
        } elseif ($uid == getConfig('beg_uid')) {
                // Webmaster's ID cannot beg for points!
-               $msg = getCode('BEG_SAME_AS_OWN');
+               $errorCode = getCode('BEG_SAME_AS_OWN');
        }
 
        // Reload to index module
-       if ((!empty($msg)) && (!empty($msg))) redirectToUrl('modules.php?module=index&amp;msg='.$msg.'&amp;ext=beg');
+       if ((!empty($errorCode)) && (!empty($errorCode))) redirectToUrl('modules.php?module=index&amp;msg=' . $errorCode . '&amp;ext=beg');
 } else {
        // No userid entered
        redirectToUrl('modules.php?module=index');
index c018d591d5cfb607f1477f993855f53153e5dd18..70332e33f76b089126513652de93ad298407de55 100644 (file)
@@ -103,7 +103,7 @@ if (SQL_NUMROWS($result) == 1) {
                } // END - if
 
                // Remove entry from table
-               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_birthday` WHERE userid=%s AND chk_value='%s' LIMIT 1",
+               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_birthday` WHERE `userid`=%s AND `chk_value`='%s' LIMIT 1",
                        array($uid, $chk), __FILE__, __LINE__);
 
                // "Translate" some data
index b880ee8b531c6643001e50ddb72dc4a4d15bdb36..4cf845baf0f5b1883827cb1f0edb5525d1ebe536 100644 (file)
@@ -71,7 +71,7 @@ WHERE s.timestamp_ordered <= (UNIX_TIMESTAMP() - %s) ORDER BY s.userid",
                $uid = 0; $points = 0;
                while ($content = SQL_FETCHARRAY($result)) {
                        // Check if confirmation links are purged or not
-                       $result_links = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s LIMIT 1",
+                       $result_links = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `stats_id`=%s LIMIT 1",
                        array(bigintval($content['id'])), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result_links) == 1) {
                                // Free memory
@@ -88,11 +88,11 @@ WHERE s.timestamp_ordered <= (UNIX_TIMESTAMP() - %s) ORDER BY s.userid",
                                $uid = $content['userid']; $points += $content['price']; $admin_points += $content['price'];
 
                                // Remove confirmation links from queue
-                               ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s",
+                               ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `stats_id`=%s",
                                array(bigintval($content['id'])), __FILE__, __LINE__, false));
 
                                // Update status of order
-                               ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='DELETED' WHERE `id`=%s LIMIT 1",
+                               ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET `data_type`='DELETED' WHERE `id`=%s LIMIT 1",
                                array(bigintval($content['pool_id'])), __FILE__, __LINE__, false));
                        } // END - if
                } // END - while
@@ -107,14 +107,14 @@ WHERE s.timestamp_ordered <= (UNIX_TIMESTAMP() - %s) ORDER BY s.userid",
        // Is the 'bonus' extension installed and activated?
        if (EXT_IS_ACTIVE('bonus', true)) {
                // Check for bonus campaigns
-               $result = SQL_QUERY_ESC("SELECT id, points FROM `{!_MYSQL_PREFIX!}_bonus` WHERE data_type='SEND' AND timestamp <= %s ORDER BY `id`",
-               array(bigintval($PURGE)), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `id`, `points` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `data_type`='SEND' AND timestamp <= %s ORDER BY `id`",
+                       array(bigintval($PURGE)), __FILE__, __LINE__);
                if (SQL_NUMROWS($result) > 0) {
                        // Start deleting procedure
                        $points = 0;
                        while ($content = SQL_FETCHARRAY($result)) {
                                // Check if confirmation links are purged or not
-                               $result_links = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s",
+                               $result_links = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `bonus_id`=%s",
                                array(bigintval($content['id'])), __FILE__, __LINE__);
                                if (SQL_NUMROWS($result_links) > 0) {
                                        // At least one link was found, enougth to pay back the points
@@ -124,11 +124,11 @@ WHERE s.timestamp_ordered <= (UNIX_TIMESTAMP() - %s) ORDER BY s.userid",
                                        SQL_FREERESULT($result_links);
 
                                        // Remove confirmation links from queue
-                                       ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s",
+                                       ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `bonus_id`=%s",
                                        array(bigintval($content['id'])), __FILE__, __LINE__, false));
 
                                        // Update status of order
-                                       ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='DELETED' WHERE `id`=%s LIMIT 1",
+                                       ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET `data_type`='DELETED' WHERE `id`=%s LIMIT 1",
                                        array(bigintval($content['id'])), __FILE__, __LINE__, false));
                                } // END - if
                        } // END - while
index 17a64174edf02df29fc99761a64aa468285159bd..4145d9a3e65f46b62873e8831376b767f2e9515f 100644 (file)
@@ -97,8 +97,8 @@ ORDER BY d.userid",
                        $content['last_online'] = generateDateTime($content['last_online'], '0');
 
                        // Load mail template
-                       $msg = LOAD_EMAIL_TEMPLATE("member_autopurge_inactive", $content['last_online'], bigintval($content['userid']));
-                       sendEmail($content['email'], getMessage('AUTOPURGE_MEMBER_INACTIVE_SUBJECT'), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE("member_autopurge_inactive", $content['last_online'], bigintval($content['userid']));
+                       sendEmail($content['email'], getMessage('AUTOPURGE_MEMBER_INACTIVE_SUBJECT'), $message);
 
                        // Update this account
                        ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `ap_notified`=UNIX_TIMESTAMP() WHERE `userid`=%s LIMIT 1",
index 9cdfc62706162c13968225acfe1039cb94b8bc24..a6ab6e20e7b502939f51bddf4e0349c01943e2bd 100644 (file)
@@ -53,7 +53,7 @@ if (getConfig('ap_del_mails') == 'Y') {
        // Okay, let's check for them...
        $result_mails = SQL_QUERY_ESC("SELECT `sender`
 FROM `{!_MYSQL_PREFIX!}_pool`
-WHERE data_type='DELETED' AND `timestamp` <= (UNIX_TIMESTAMP() - %s)
+WHERE `data_type`='DELETED' AND `timestamp` <= (UNIX_TIMESTAMP() - %s)
 ORDER BY `sender` ASC",
                array(getConfig('ap_dm_timeout')), __FILE__, __LINE__);
 
@@ -76,7 +76,7 @@ ORDER BY `sender` ASC",
                                // Reset query (to prevent possible errors) ...;
                                $result_mails = SQL_QUERY_ESC("SELECT `sender`
 FROM `{!_MYSQL_PREFIX!}_pool`
-WHERE data_type='DELETED' AND timestamp <= (UNIX_TIMESTAMP() - %s)
+WHERE `data_type`='DELETED' AND timestamp <= (UNIX_TIMESTAMP() - %s)
 ORDER BY `sender` ASC",
                                        array(getConfig('ap_dm_timeout')), __FILE__, __LINE__);
                        }
@@ -109,7 +109,7 @@ ORDER BY `sender` ASC",
                                // Reset query (to prevent possible errors) ...
                                $result_mails = SQL_QUERY_ESC("SELECT `sender`
 FROM `{!_MYSQL_PREFIX!}_user_stats`
-WHERE data_type='DELETED' AND timestamp_send <= (UNIX_TIMESTAMP() - %s)
+WHERE `data_type`='DELETED' AND timestamp_send <= (UNIX_TIMESTAMP() - %s)
 ORDER BY `sender` ASC",
                                        array(getConfig('ap_dm_timeout')), __FILE__, __LINE__);
                        }
index fd952f382a43f68347a85f3f2c03e2d7506f755a..95f1ea7a87ca3618f5e5688c257d88d60f8f1af4 100644 (file)
@@ -53,9 +53,9 @@ function getCode ($key) {
        if (!isCodeSet($key)) {
                // Abort here
                trigger_error(sprintf("%s[%s:] Code %s is not set.",
-               __FUNCTION__,
-               __LINE__,
-               $key
+                       __FUNCTION__,
+                       __LINE__,
+                       $key
                ));
        } // END - if
 
index 7bb1b94381809013867cbcf0caac0a498b735c3e..d3ae495f163ee4df5d40fa52a063bff64c0b2c41 100644 (file)
@@ -163,8 +163,8 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == 'Y'))
                        );
 
                        // Load mail template and send mail away...
-                       $msg = LOAD_EMAIL_TEMPLATE('member_doubler', $content, $content['userid']);
-                       sendEmail($content['userid'], getMessage('DOUBLER_MEMBER_SUBJECT'), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE('member_doubler', $content, $content['userid']);
+                       sendEmail($content['userid'], getMessage('DOUBLER_MEMBER_SUBJECT'), $message);
                } // END - if
        } // END - while
 } // END - if
index 93f6fa192a254236a2f76f7a17f82019090b95b8..5fb56a2765bebf70eacbcc594e2ac620be0b460a 100644 (file)
@@ -281,7 +281,7 @@ function REGISTER_EXTENSION ($ext_name, $task_id, $dry_run = false, $logout = tr
                if ($test === true) {
                        // "Dry-run-mode" activated?
                        if ((!$dry_run) && (!EXT_IS_ON_REMOVAL_LIST())) {
-                               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " ext_name=".EXT_GET_CURR_NAME());
+                               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "ext_name=".EXT_GET_CURR_NAME());
                                // Init SQLs and transfer ext->generic
                                INIT_SQLS();
                                SET_SQLS(GET_EXT_SQLS());
@@ -785,8 +785,7 @@ function CREATE_EXTENSION_UPDATE_TASK ($admin_id, $ext_name, $ext_ver, $notes) {
                // Check if task is not there
                if (DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) {
                        // Task not created so it's a brand-new extension which we need to register and create a task for!
-                       SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (assigned_admin, userid, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','EXTENSION_UPDATE','%s','%s', UNIX_TIMESTAMP())",
-                       array($admin_id, $subject, $notes), __FUNCTION__, __LINE__);
+                       createNewTask($subject, $notes, 'EXTENSION_UPDATE', 0, $admin_id);
                } // END - if
        } // END - if
 }
@@ -795,34 +794,27 @@ function CREATE_EXTENSION_UPDATE_TASK ($admin_id, $ext_name, $ext_ver, $notes) {
 function CREATE_NEW_EXTENSION_TASK ($admin_id, $subject, $ext) {
        // Not installed and do we have created a task for the admin?
        if ((DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) && (GET_EXT_VERSION($ext) == '')) {
+               // Set default message if ext-foo is missing
+               $message = sprintf(getMessage('ADMIN_EXT_TEXT_FILE_MISSING'), $ext);
+
                // Template file
                $tpl = sprintf("%stemplates/%s/html/ext/ext_%s.tpl",
-               constant('PATH'),
-               getLanguage(),
-               $ext
+                       constant('PATH'),
+                       getLanguage(),
+                       $ext
                );
 
-               // Set default message if ext-foo is missing
-               $msg = sprintf(getMessage('ADMIN_EXT_TEXT_FILE_MISSING'), $ext);
-
                // Load text for task if found
                if (isFileReadable($tpl)) {
                        // Load extension's own text template (HTML!)
-                       $msg = LOAD_TEMPLATE('ext_' . $ext, true);
+                       $message = LOAD_TEMPLATE('ext_' . $ext, true);
                } else {
                        // Write this in debug.log as well
-                       DEBUG_LOG(__FUNCTION__, __LINE__, $msg);
+                       DEBUG_LOG(__FUNCTION__, __LINE__, $message);
                }
 
                // Task not created so it's a brand-new extension which we need to register and create a task for!
-               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (assigned_admin, userid, status, task_type, subject, text, task_created)
-VALUES (%s, 0, 'NEW', 'EXTENSION', '%s', '%s', UNIX_TIMESTAMP())",
-               array(
-               $admin_id,
-               $subject,
-               smartAddSlashes($msg),
-               ),  __FUNCTION__, __LINE__, true, false, false
-               );
+               createNewTask($subject, $message, 'EXTENSION_UPDATE', 0, $admin_id, false);
        } // END - if
 }
 
@@ -834,13 +826,7 @@ function CREATE_EXTENSION_DEACTIVATION_TASK ($ext) {
        // Not installed and do we have created a task for the admin?
        if ((DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) && (GET_EXT_VERSION($ext) != '')) {
                // Task not created so add it
-               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (assigned_admin, userid, status, task_type, subject, text, task_created)
-VALUES (0, 0, 'NEW', 'EXTENSION_DEACTIVATION', '%s', '%s', UNIX_TIMESTAMP())",
-               array(
-               $subject,
-               SQL_ESCAPE(LOAD_TEMPLATE('task_ext_deactivated', true, $ext)),
-               ),  __FUNCTION__, __LINE__, true, false
-               );
+               createNewTask($subject, SQL_ESCAPE(LOAD_TEMPLATE('task_ext_deactivated', true, $ext)), 'EXTENSION_DEACTIVATION');
        } // END - if
 }
 
@@ -866,8 +852,8 @@ function MODULE_HAS_MENU ($mod, $forceDb = false) {
                }
        } elseif ((GET_EXT_VERSION('sql_patches') >= '0.3.6') && ((!EXT_IS_ACTIVE('cache')) || ($forceDb === true))) {
                // Check database for entry
-               $result = SQL_QUERY_ESC("SELECT has_menu FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE `module`='%s' LIMIT 1",
-               array($mod), __FUNCTION__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `has_menu` FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE `module`='%s' LIMIT 1",
+                       array($mod), __FUNCTION__, __LINE__);
 
                // Entry found?
                if (SQL_NUMROWS($result) == 1) {
@@ -899,8 +885,8 @@ function DETERMINE_EXTENSION_TASK_ID ($ext_name) {
        $task_id = 0;
 
        // Search for extension task's id
-       $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_task_system` WHERE task_type='EXTENSION' AND subject='[%s:]' LIMIT 1",
-       array($ext_name), __FUNCTION__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_task_system` WHERE `task_type`='EXTENSION' AND `subject`='[%s:]' LIMIT 1",
+               array($ext_name), __FUNCTION__, __LINE__);
 
        // Entry found?
        if (SQL_NUMROWS($result) == 1) {
@@ -921,8 +907,8 @@ function DETERMINE_TASK_ID_BY_SUBJECT ($subject) {
        $task_id = 0;
 
        // Search for task id
-       $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_task_system` WHERE subject LIKE '%s%%' LIMIT 1",
-       array($subject), __FUNCTION__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_task_system` WHERE `subject` LIKE '%s%%' LIMIT 1",
+               array($subject), __FUNCTION__, __LINE__);
 
        // Entry found?
        if (SQL_NUMROWS($result) == 1) {
index 25c62db6e2abb9f38ad0d7338c1dbfd5e0e1e558..f33c822a041fa69720c76883501e15406b3b5e28 100644 (file)
@@ -424,7 +424,7 @@ WHERE `last_online` < ".$mark." ORDER BY `userid` ASC");
                                break;
 
                        case '0.6.8': // SQL queries for v0.6.8
-                               ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='SEND' WHERE data_type != 'SEND' AND data_type != 'DELETED' AND receivers='' AND target_send='0'");
+                               ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET `data_type`='SEND' WHERE `data_type` != 'SEND' AND `data_type` != 'DELETED' AND `receivers`='' AND `target_send`='0'");
 
                                // Update notes (these will be set as task text!)
                                EXT_SET_UPDATE_NOTES("Eingegebene Anzahl auszusendener Bonus-Mails wurde bei der Empf&auml;nderauswahl nicht ber&uuml;cksichtigt. Zudem wird jetzt das eingestellte Auswahlverfahren mitber&uuml;cksichtigt.");
index cf7d0dd08f60827da9cd6a93714444524fde4d9e..a0988c9539578bc6251ec4bf6600827225cf2dcc 100644 (file)
@@ -447,12 +447,12 @@ function FILTER_LOAD_INCLUDES () {
 // Filter for running SQL commands
 function FILTER_RUN_SQLS ($data) {
        // Debug message
-       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Entered!");
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "- Entered!");
 
        // Is the array there?
        if ((IS_SQLS_VALID()) && ((!isset($data['dry_run'])) || ($data['dry_run'] == false))) {
                // Run SQL commands
-               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Found ".COUNT_SQLS()." queries to run.");
+               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "- Found ".COUNT_SQLS()." queries to run.");
                foreach (GET_SQLS() as $sql) {
                        // Trim spaces away
                        $sql = trim($sql);
@@ -474,7 +474,7 @@ function FILTER_RUN_SQLS ($data) {
        } // END - if
 
        // Debug message
-       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Left!");
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "- Left!");
 }
 
 // Filter for updating/validating login data
@@ -489,20 +489,20 @@ function FILTER_UPDATE_LOGIN_DATA () {
        setUserId(getSession('userid'));
 
        // Load last module and last online time
-       $result = SQL_QUERY_ESC("SELECT last_module, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT `last_module`, `last_online` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
                array(getUserId()), __FUNCTION__, __LINE__);
 
        // Entry found?
        if (SQL_NUMROWS($result) == 1) {
                // Load last module and online time
-               list($mod, $onl) = SQL_FETCHROW($result);
+               $DATA = SQL_FETCHARRAY($result);
 
                // Maybe first login time?
-               if (empty($mod)) $mod = 'login';
+               if (empty($DATA['last_module'])) $DATA['last_module'] = 'login';
 
                // This will be displayed on welcome page! :-)
                if (empty($GLOBALS['last']['module'])) {
-                       $GLOBALS['last']['module'] = $mod; $GLOBALS['last']['online'] = $onl;
+                       $GLOBALS['last']['module'] = $DATA['last_module']; $GLOBALS['last']['online'] = $DATA['last_online'];
                } // END - if
 
                // 'what' not set?
@@ -513,8 +513,12 @@ function FILTER_UPDATE_LOGIN_DATA () {
                } // END - if
 
                // Update last module / online time
-               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `last_module`='%s', last_online=UNIX_TIMESTAMP(), REMOTE_ADDR='%s' WHERE userid=%s LIMIT 1",
-                       array(getWhat(), detectRemoteAddr(), getUserId()), __FUNCTION__, __LINE__);
+               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `last_module`='%s', `last_online`=UNIX_TIMESTAMP(), `REMOTE_ADDR`='%s' WHERE `userid`=%s LIMIT 1",
+                       array(
+                               getWhat(),
+                               detectRemoteAddr(),
+                               getUserId()
+                       ), __FUNCTION__, __LINE__);
        }  else {
                // Destroy session, we cannot update!
                destroyUserSession();
index 8d67bc491fbfa27d0820587296bf2ff977dcb7be..b0bc5e475a7ad9337709d7d356e3ee065630c318 100644 (file)
@@ -1954,7 +1954,6 @@ function isEmailValid ($email) {
        $regex = '@^' . $first . '\@' . $domain . '$@iU';
 
        // Return check result
-       // @NOTE altered the regex-pattern and added modificator i (match both upper and lower case letters) and U (PCRE_UNGREEDY) to work with preg_match the same way as eregi
        return preg_match($regex, $email);
 }
 
@@ -2434,14 +2433,14 @@ function searchDirsRecursive ($dir, &$last_changed) {
        //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):dir=" . $dir."<br />\n";
        // Does it match what we are looking for? (We skip a lot files already!)
        // RegexPattern to exclude  ., .., .revision,  .svn, debug.log or .cache in the filenames
-       $excludePattern = '@(\.|\.\.|\.revision|\.svn|debug\.log|\.cache|config\.php)$@';
-       $ds = getArrayFromDirectory($dir, '', true, false, $excludePattern);
+       $excludePattern = '@(\.revision|debug\.log|\.cache|config\.php)$@';
+       $ds = getArrayFromDirectory($dir, '', true, false, array(), '.php', $excludePattern);
        //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ds[]=".count($ds)."<br />\n";
 
        // Walk through all entries
        foreach ($ds as $d) {
                // Generate proper FQFN
-               $FQFN = str_replace("//", '/', constant('PATH') . $dir. '/'. $d);
+               $FQFN = str_replace('//', '/', constant('PATH') . $dir. '/'. $d);
 
                // Is it a file and readable?
                //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):FQFN={$FQFN}<br />\n";
@@ -2560,13 +2559,19 @@ function getSearchFor () {
 // @TODO Please describe this function
 function getArrayFromActualVersion () {
        // Init variables
-       $next_dir = ''; // Directory to start with search
+       $next_dir = '';
+
+       // Directory to start with search
        $last_changed = array(
                'path_name' => '',
                'time'      => 0
        );
-       $akt_vers = array(); // Init return array
-       $res = 0; // Init value for counting the founded keywords
+
+       // Init return array
+       $akt_vers = array();
+
+       // Init value for counting the founded keywords
+       $res = 0;
 
        // Searches all Files and there date of the last modifikation and puts the newest File in $last_changed.
        searchDirsRecursive($next_dir, $last_changed); // @TODO small change to API to $last_changed = searchDirsRecursive($next_dir, $time);
@@ -3135,7 +3140,7 @@ function cachePurgeAdminMenu ($id=0, $action = '', $what = '', $str = '') {
                return false;
        } elseif (!isCacheInstanceValid()) {
                // No cache instance!
-               DEBUG_LOG(__FUNCTION__, __LINE__, " No cache instance found.");
+               DEBUG_LOG(__FUNCTION__, __LINE__, 'No cache instance found.');
                return false;
        } elseif ((!isConfigEntrySet('cache_admin_menu')) || (getConfig('cache_admin_menu') != 'Y')) {
                // Caching disabled (currently experiemental!)
@@ -3201,7 +3206,7 @@ function addNewBonusMail ($data, $mode = '', $output=true) {
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_MORE_SELECTED'));
        } else {
                // Debug log
-               DEBUG_LOG(__FUNCTION__, __LINE__, " cat={$data['cat']},receiver={$data['receiver']},data=".base64_encode(serialize($data))." More selected, than available!");
+               DEBUG_LOG(__FUNCTION__, __LINE__, "cat={$data['cat']},receiver={$data['receiver']},data=".base64_encode(serialize($data))." More selected, than available!");
        }
 }
 
@@ -3403,6 +3408,113 @@ function generateExtensionInactiveNotInstalledMessage ($ext_name) {
        return $message;
 }
 
+// Reads a directory recursively by default and searches for files not matching
+// an exclusion pattern. You can now keep the exclusion pattern empty for reading
+// a whole directory.
+function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $addBaseDir = true, $excludeArray = array(), $extension = '.php', $excludePattern = '@(\.|\.\.)$@', $recursive = true) {
+       // Add default entries we should exclude
+       $excludeArray[] = '.';
+       $excludeArray[] = '..';
+       $excludeArray[] = '.svn';
+       $excludeArray[] = '.htaccess';
+
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "baseDir={$baseDir},prefix={$prefix} - Entered!");
+       // Init includes
+       $files = array();
+
+       // Open directory
+       $dirPointer = opendir(constant('PATH') . $baseDir) or app_die(__FUNCTION__, __LINE__, 'Cannot read directory ' . basename($baseDir) . '.');
+
+       // Read all entries
+       while ($baseFile = readdir($dirPointer)) {
+               // Exclude '.', '..' and entries in $excludeArray automatically
+               if (in_array($baseFile, $excludeArray, true))  {
+                       // Exclude them
+                       //* DEBUG: */ print 'excluded=' . $baseFile . '<br />';
+                       continue;
+               } // END - if
+
+               // Construct include filename and FQFN
+               $fileName = $baseDir . '/' . $baseFile;
+               $FQFN = constant('PATH') . $fileName;
+
+               // Remove double slashes
+               $FQFN = str_replace('//', '/', $FQFN);
+
+               // Check if the base filename matches an exclusion pattern and if the pattern is not empty
+               if ((!empty($excludePattern)) && (preg_match($excludePattern, $baseFile, $match))) {
+                       // These Lines are only for debugging!!
+                       //* DEBUG: */ print 'baseDir:' . $baseDir . '<br />';
+                       //* DEBUG: */ print 'baseFile:' . $baseFile . '<br />';
+                       //* DEBUG: */ print 'FQFN:' . $FQFN . '<br />';
+
+                       // Exclude this one
+                       continue;
+               } // END - if
+
+               // Skip also files with non-matching prefix genericly
+               if (($recursive === true) && (isDirectory($FQFN))) {
+                       // Is a redirectory so read it as well
+                       $files = merge_array($files, getArrayFromDirectory ($baseDir . $baseFile . '/', $prefix, $fileIncludeDirs, $addBaseDir, $excludeArray, $extension, $excludePattern, $recursive));
+
+                       // And skip further processing
+                       continue;
+               } elseif (substr($baseFile, 0, strlen($prefix)) != $prefix) {
+                       // Skip this file
+                       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Invalid prefix in file " . $baseFile . ", prefix=" . $prefix);
+                       continue;
+               } elseif (!isFileReadable($FQFN)) {
+                       // Not readable so skip it
+                       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "File " . $FQFN . " is not readable!");
+                       continue;
+               }
+
+               // Is the file a PHP script or other?
+               //* DEBUG: */ DEBUG_LOG(__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') {
+                               // Remove both for extension name
+                               $extName = substr($baseFile, strlen($prefix), -4);
+
+                               // Try to find it
+                               $extId = GET_EXT_ID($extName);
+
+                               // Is the extension valid and active?
+                               if (($extId > 0) && (EXT_IS_ACTIVE($extName))) {
+                                       // Then add this file
+                                       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, 'Extension entry ' . $baseFile . ' added.');
+                                       $files[] = $fileName;
+                               } elseif ($extId == 0) {
+                                       // Add non-extension files as well
+                                       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, 'Regular entry ' . $baseFile . ' added.');
+                                       if ($addBaseDir === true) {
+                                               $files[] = $fileName;
+                                       } else {
+                                               $files[] = $baseFile;
+                                       }
+                               }
+                       } else {
+                               // We found .php file but should not search for them, why?
+                               debug_report_bug('We should find files with extension=' . $extension . ', but we found a PHP script.');
+                       }
+               } else {
+                       // Other, generic file found
+                       $files[] = $fileName;
+               }
+       } // END - while
+
+       // Close directory
+       closedir($dirPointer);
+
+       // Sort array
+       asort($files);
+
+       // Return array with include files
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, '- Left!');
+       return $files;
+}
+
 //////////////////////////////////////////////////
 // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
 //////////////////////////////////////////////////
index 4ac90aaeb0b22b44eafb69e902ffc9580fbe4b83..ed3dba2a7cf42d9f57ebc3b658d60889be1a7c5f 100644 (file)
@@ -56,73 +56,6 @@ function isIncludeWriteable ($inc) {
        return is_writeable(dirname($FQFN));
 }
 
-// Reads a directory with PHP files in and gets only files back
-function getArrayFromDirectory ($baseDir, $prefix, $includeDirs = false, $addBaseDir = true, $excludePattern = '@(\.|\.\.)$@') {
-       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "baseDir={$baseDir},prefix={$prefix} - Entered!");
-       // Init includes
-       $INCs = array();
-
-       // Open directory
-       $dirPointer = opendir(constant('PATH') . $baseDir) or app_die(__FUNCTION__, __LINE__, 'Cannot read '.basename($baseDir).' path!');
-
-       // Read all entries
-       while ($baseFile = readdir($dirPointer)) {
-               // Steps over this returned $baseFile-Name, when it matches the $excludePattern
-               if (preg_match($excludePattern, $baseFile, $match)) {
-                       // These Lines are only for debugging!!
-                       //$INC = $baseDir . '/' . $baseFile;
-                       //$FQFN = constant('PATH') . $INC;
-                       //echo '<pre>$baseDir:'.print_r($baseDir, true).'</pre>';
-                       //echo '<pre>$baseDir:'.print_r(constant('PATH') . $baseDir, true).'</pre>';
-                       //echo '<pre>constant(\'PATH\'):'.print_r(constant('PATH'), true).'</pre>';
-                       //echo '<pre>$FQFN:'.print_r($FQFN, true).'</pre>';
-                       continue;
-               } // END - if
-
-               // Construct include filename and FQFN
-               $INC = $baseDir . '/' . $baseFile;
-               $FQFN = constant('PATH') . $INC;
-
-               // repalecment of // to / is needed, whenn $baseDir is an emty String
-               $FQFN = str_replace('//', '/', $FQFN);
-
-               // Is this a valid reset file?
-               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "baseDir={$baseDir},prefix={$prefix},baseFile={$baseFile}");
-               if (((isFileReadable($FQFN)) && (substr($baseFile, 0, strlen($prefix)) == $prefix) && (substr($baseFile, -4, 4) == '.php')) || (($includeDirs) && (isDirectory($FQFN)))) {
-                       // Remove both for extension name
-                       $extName = substr($baseFile, strlen($prefix), -4);
-
-                       // Try to find it
-                       $extId = GET_EXT_ID($extName);
-
-                       // Is the extension valid and active?
-                       if (($extId > 0) && (EXT_IS_ACTIVE($extName))) {
-                               // Then add this file
-                               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " Extension entry ".$baseFile." added.");
-                               $INCs[] = $INC;
-                       } elseif ($extId == 0) {
-                               // Add non-extension files as well
-                               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " Regular entry ".$baseFile." added.");
-                               if ($addBaseDir) {
-                                       $INCs[] = $INC;
-                               } else {
-                                       $INCs[] = $baseFile;
-                               }
-                       }
-               } // END - if
-       } // END - while
-
-       // Close directory
-       closedir($dirPointer);
-
-       // Sort array
-       asort($INCs);
-
-       // Return array with include files
-       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Left!");
-       return $INCs;
-}
-
 // Init INC_POOL
 function INIT_INC_POOL () {
        $GLOBALS['inc_pool'] = array();
index 70c63916c60daad8f45b140c3eb9aeefa845452c..a420f9ee13423a9945140c57d7e1f46e0eadc114 100644 (file)
@@ -75,8 +75,8 @@ function AUTOPURGE_ADD_POINTS($uid, $points) {
                } // END - if
 
                // Send out mail to user
-               $msg = LOAD_EMAIL_TEMPLATE('member_autopurge_points', translateComma($points), $uid);
-               sendEmail($uid, getMessage('AUTOPURGE_MEMBER_SUBJECT'), $msg);
+               $message = LOAD_EMAIL_TEMPLATE('member_autopurge_points', translateComma($points), $uid);
+               sendEmail($uid, getMessage('AUTOPURGE_MEMBER_SUBJECT'), $message);
        }
 }
 
index 4e82a02ce4535f24dbc9fafc87b7fc02e0d0d171..fb901880261242ff57ed676adf1c55c5f0ab7f59 100644 (file)
@@ -75,8 +75,8 @@ LIMIT 1", array(bigintval($content['userid'])), __FUNCTION__, __LINE__, false));
                        );
 
                        // Send mail to user
-                       $msg = LOAD_EMAIL_TEMPLATE("member_holiday_unlock", $content, $content['userid']);
-                       sendEmail($content['userid'], getMessage('HOLIDAY_MEMBER_UNLOCK_SUBJ'), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE("member_holiday_unlock", $content, $content['userid']);
+                       sendEmail($content['userid'], getMessage('HOLIDAY_MEMBER_UNLOCK_SUBJ'), $message);
 
                        // Remember userid for admin
                        $admin .= $content['userid']."\n";
index 51c0662aa176450570675b35441dce83da728d23..47ac57f03fe85680e70505840017a0db6d0889b5 100644 (file)
@@ -74,23 +74,27 @@ function FILTER_UPDATE_ONLINE_LIST () {
        } // END - if
 
        // Now search for the user
-       $result = SQL_QUERY_ESC("SELECT timestamp FROM `{!_MYSQL_PREFIX!}_online` WHERE sid='%s' LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT `timestamp` FROM `{!_MYSQL_PREFIX!}_online` WHERE sid='%s' LIMIT 1",
        array(session_id()), __FUNCTION__, __LINE__);
 
        // Entry found?
        if (SQL_NUMROWS($result) == 1) {
                // Then update it
-               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_online` SET
-`module`='%s',
-`action`='%s',
-`what`='%s',
-userid=%s,
-refid=%s,
-is_member='%s',
-is_admin='%s',
-timestamp=UNIX_TIMESTAMP(),
-ip='%s'
-WHERE sid='%s' LIMIT 1",
+               SQL_QUERY_ESC("UPDATE
+       `{!_MYSQL_PREFIX!}_online`
+SET
+       `module`='%s',
+       `action`='%s',
+       `what`='%s',
+       `userid`=%s,
+       `refid`=%s,
+       `is_member`='%s',
+       `is_admin`='%s',
+       `timestamp`=UNIX_TIMESTAMP(),
+       `ip`='%s'
+WHERE 
+       sid`='%s'
+LIMIT 1",
                array(
                        getModule(),
                        getAction(),
@@ -104,26 +108,26 @@ WHERE sid='%s' LIMIT 1",
                ), __FUNCTION__, __LINE__);
        } else {
                // No entry does exists so we simply add it!
-               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_online` (module, action, what, userid, refid, is_member, is_admin, timestamp, sid, ip) VALUES ('%s','%s','%s', %s, %s, '%s','%s', UNIX_TIMESTAMP(), '%s','%s')",
-               array(
-                       getModule(),
-                       getAction(),
-                       getWhat(),
-                       $uid,
-                       $rid,
-                       $MEM,
-                       $ADMIN,
-                       session_id(),
-                       detectRemoteAddr()
-               ), __FUNCTION__, __LINE__);
+               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_online` (`module`, `action`, `what`, `userid`, `refid`, `is_member`, `is_admin`, `timestamp`, `sid`, `ip`) VALUES ('%s','%s','%s', %s, %s, '%s','%s', UNIX_TIMESTAMP(), '%s','%s')",
+                       array(
+                               getModule(),
+                               getAction(),
+                               getWhat(),
+                               $uid,
+                               $rid,
+                               $MEM,
+                               $ADMIN,
+                               session_id(),
+                               detectRemoteAddr()
+                       ), __FUNCTION__, __LINE__);
        }
 
        // Free result
        SQL_FREERESULT($result);
 
        // Purge old entries
-       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_online` WHERE timestamp <= (UNIX_TIMESTAMP() - %s)",
-       array(getConfig('online_timeout')), __FUNCTION__, __LINE__);
+       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_online` WHERE `timestamp` <= (UNIX_TIMESTAMP() - %s)",
+               array(getConfig('online_timeout')), __FUNCTION__, __LINE__);
 }
 
 //
index 865e4363ffc5db9c15fdb413e6d2eeac33f880c8..3d3b2d3b12ea47659e26dd27508eecbbf280738e 100644 (file)
@@ -114,8 +114,8 @@ VALUES ('%s','%s','%s','%s')",
                // Shall I notify this member?
                if (($notify == 'Y') && ($un)) {
                        // Load email template and send it to the user
-                       $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $content['userid']);
-                       sendEmail($content['userid'], sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $content['userid']);
+                       sendEmail($content['userid'], sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $message);
                } // END - if
        } // END - while
 
@@ -309,8 +309,8 @@ VALUES ('%s','%s','0')",
                        $DATA['min_prices'] = RALLYE_DETERMINE_MIN_PRICES($min_prices);
 
                        // Send notification to member
-                       $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $uid);
-                       sendEmail($uid, sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $uid);
+                       sendEmail($uid, sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $message);
                } // END - if
        } // END - if
 }
@@ -340,10 +340,14 @@ function RALLYE_EXPIRE_RALLYES ($result) {
                // Check status
                //   active = 1: account is still confirmed
                //   active = 0: account is deleted or locked
-               $result = SQL_QUERY_ESC("SELECT COUNT(userid) AS active
-FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE userid=%s AND `status`='CONFIRMED'
-LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT
+       COUNT(`userid`) AS active
+FROM
+       `{!_MYSQL_PREFIX!}_user_data`
+WHERE
+       `userid`=%s AND `status`='CONFIRMED'
+LIMIT 1",
+                       array(bigintval($uid)), __FUNCTION__, __LINE__);
                list($active) = SQL_FETCHROW($result);
                SQL_FREERESULT($result);
 
@@ -362,7 +366,7 @@ LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__);
        } // END - if
 
        // Expire rallye
-       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET expired='Y' WHERE `id`=%s LIMIT 1",
+       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET `expired`='Y' WHERE `id`=%s LIMIT 1",
        array(bigintval($id)), __FUNCTION__, __LINE__);
 
        // Run array through (by uid is the most important 2nd-level-array)
@@ -381,13 +385,13 @@ LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__);
                        // Determine winner level
                        if ($DATA['level'] == 1) {
                                // The winner!
-                               $winnerLevel = "_gold";
+                               $winnerLevel = '_gold';
                        } elseif ($DATA['level'] == 2) {
                                // The vice winner!
-                               $winnerLevel = "_silver";
+                               $winnerLevel = '_silver';
                        } elseif ($DATA['level'] == 3) {
                                // The bronce winner
-                               $winnerLevel = "_bronce";
+                               $winnerLevel = '_bronce';
                        }
 
                        if ($DATA['points'] > 0) {
@@ -402,15 +406,15 @@ LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__);
                                        $DATA['infos'] = $DATA['info'];
                                } else {
                                        // Take points
-                                       $DATA['infos'] = $DATA['points']." {!POINTS!}";
+                                       $DATA['infos'] = $DATA['points'] . ' {!POINTS!}';
                                }
 
                                // Add suffix to template name
-                               $template = "member_rallye_expired".$winnerLevel;
+                               $template = 'member_rallye_expired' . $winnerLevel;
 
                                // Load template
-                               $msg = LOAD_EMAIL_TEMPLATE($template, $DATA, $uid);
-                               sendEmail($uid, sprintf(getMessage('RALLYE_MEMBER_EXPIRED_SUBJ'), $DATA['level']), $msg);
+                               $message = LOAD_EMAIL_TEMPLATE($template, $DATA, $uid);
+                               sendEmail($uid, sprintf(getMessage('RALLYE_MEMBER_EXPIRED_SUBJ'), $DATA['level']), $message);
                        } // END - if
 
                        // Count userid
@@ -432,11 +436,7 @@ LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__);
        sendAdminNotification(sprintf(getMessage('RALLYE_ADMIN_EXPIRED_SUBJ'), $title), $templ, $cnt, 0);
 
        // Add task
-       SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (status, task_type, subject, text, task_created)
-VALUES ('NEW','RALLYE_EXPIRED','{--RALLYE_ADMIN_EXPIRED--}: %s','{--RALLYE_ADMIN_EXPIRED_TEXT--}',UNIX_TIMESTAMP())",
-       array($title), __FUNCTION__, __LINE__);
-
-       // All work done here...
+       createNewTask('{--RALLYE_ADMIN_EXPIRED--}: ' . $title, '{--RALLYE_ADMIN_EXPIRED_TEXT--}', 'RALLYE_EXPIRED');
 }
 
 //
@@ -448,8 +448,8 @@ function RALLYE_LOAD_USER_DATA ($uids_array) {
        $ret = '';
 
        // Load users
-       $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid IN(%s) AND `status`='CONFIRMED' ORDER BY userid LIMIT %s",
-       array($uid_string, count($uids_array)), __FUNCTION__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `userid`, `gender`, `surname`, `family`, `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid` IN(%s) AND `status`='CONFIRMED' ORDER BY `userid` ASC LIMIT %s",
+               array($uid_string, count($uids_array)), __FUNCTION__, __LINE__);
        while ($content = SQL_FETCHARRAY($result)) {
                // Construct the message masked and add it
                $ret .= sprintf("%s %s %s (%s) - %s\n",
@@ -651,17 +651,14 @@ WHERE end_time <= (UNIX_TIMESTAMP() - %s) AND expired='Y'",
 
                        // Purge whole rallye
                        ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE `id`=%s LIMIT 1",
-                       array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
+                               array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
                        ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s LIMIT 1",
-                       array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
+                               array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
                        ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s LIMIT 1",
-                       array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
+                               array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
 
                        // Add task
-                       // @TODO Rewrite this to a function
-                       ADD_SQL(SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (status, task_type, subject, text, task_created)
-VALUES ('NEW','RALLYE_PURGED','{--RALLYE_ADMIN_PURGED--}: %s','{--RALLYE_ADMIN_PURGED_TEXT--}',UNIX_TIMESTAMP())",
-                       array($content['title']), __FUNCTION__, __LINE__, false));
+                       createNewTask('{--RALLYE_ADMIN_PURGED--}: ' . $content['title'], '{--RALLYE_ADMIN_PURGED_TEXT--}', 'RALLYE_PURGED');
                } // END - while
 
                // Run all SQLs
@@ -673,23 +670,25 @@ VALUES ('NEW','RALLYE_PURGED','{--RALLYE_ADMIN_PURGED--}: %s','{--RALLYE_ADMIN_P
 }
 
 //
-function RALLYE_TEMPLATE_SELECTION ($name="template", $default = '') {
+function RALLYE_TEMPLATE_SELECTION ($name = 'template', $default = '') {
+       // Init variables
+       $OUT = '';
+       $ral = array();
+
        // Check templates directory
-       $OUT = ''; $ral = array();
-       $basePath = sprintf("%stemplates/%s/html/rallye/", constant('PATH'), getLanguage());
-       $dir = opendir($basePath) or mxchange_die(sprintf("Cannot open dir %s.", $basePath));
-       while ($read = readdir($dir)) {
-               // If it is no dir (so a file)
-               if (!isDirectory($basePath.$read)) {
-                       // Accept only templates matching with rallye_????.tpl.xx
-                       if (eregi("^rallye_.*\.tpl", $read)) {
-                               $read = substr($read, 7, strpos($read, '.') - 7);
-                               // Accept only template names between 1 and 255 chars length
-                               if ((strlen($read) < 256) && (!empty($read))) $ral[] = $read;
-                       } // END - if
-               } // END - if
+       $basePath = sprintf("templates/%s/html/rallye/", getLanguage());
+
+       // Read the directory
+       $templates = getArrayFromDirectory($basePath, 'rallye_', false, true, array(), '.tpl');
+
+       // And walk through
+       foreach ($templates as $read) {
+               // Cut prefix and extension away
+               $read = substr($read, 7, strpos($read, '.') - 7);
+
+               // Accept only template names between 1 and 255 chars length
+               if ((strlen($read) < 256) && (!empty($read))) $ral[] = $read;
        } // END - while
-       closedir($dir);
 
        // Do we have found templates which we can link with the new rallye?
        if (!empty($ral[0])) {
@@ -713,7 +712,7 @@ function RALLYE_TEMPLATE_SELECTION ($name="template", $default = '') {
 }
 
 //
-function RALLYE_GET_REFCOUNT ($uid, $old=0) {
+function RALLYE_GET_REFCOUNT ($uid, $old = 0) {
        // Check current refs
        if (GET_EXT_VERSION('cache') >= '0.1.2') {
                // Get refs from cache
index 8da7941e98923c82468b942db8e24d74ad0be1c2..7106e7972c8cc9010fabe908129045f6c2d4f9a2 100644 (file)
@@ -128,7 +128,7 @@ function GET_REFBACK_PERCENTS ($uid, $ref) {
        } else {
                // Debug log
                //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): NO ENTRY FOUND! :-(<br />\n";
-               DEBUG_LOG(__FUNCTION__, __LINE__, " uid={$uid},ref={$ref} - No entry found! :-(");
+               DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$uid},ref={$ref} - No entry found! :-(");
        }
 
        // Free result
index 21bd10f847f14aca86ef8a808dbb0174bf7f7df9..06c389a9950c1486e9719f5c1e7c998d3f194a54 100644 (file)
@@ -234,14 +234,14 @@ function SPONSOR_FOUND_EMAIL_DB ($email) {
        return $ret;
 }
 //
-function SPONSOR_GET_MESSAGE ($msg, $pos, $array) {
+function SPONSOR_GET_MESSAGE ($message, $pos, $array) {
        // Check if the requested message was found in array
        if (isset($array[$pos])) {
                // ... if yes then use it!
                $ret = $array[$pos];
        } else {
                // ... else use default message
-               $ret = $msg;
+               $ret = $message;
        }
 
        // Return result
@@ -254,17 +254,25 @@ function IS_SPONSOR () {
        $ret = false;
        if ((isSessionVariableSet('sponsorid')) && (isSessionVariableSet('sponsorpass'))) {
                // Check cookies against database records...
-               $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE `id`='%s' AND password='%s' AND `status`='CONFIRMED' LIMIT 1",
-               array(bigintval(getSession('sponsorid')), getSession('sponsorpass')), __FUNCTION__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT
+       `id`
+FROM
+       `{!_MYSQL_PREFIX!}_sponsor_data`
+WHERE
+       `id`='%s' AND `password`='%s' AND `status`='CONFIRMED'
+LIMIT 1",
+                       array(
+                               bigintval(getSession('sponsorid')),
+                               getSession('sponsorpass')
+                       ), __FUNCTION__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // All is fine
                        $ret = true;
-               }
+               } // END - if
 
                // Free memory
                SQL_FREERESULT($result);
-       }
+       } // END - if
 
        // Return status
        return $ret;
index 8c511788d01a1084bd2d16a18affd2e9e2a864f2..35b8b1d199558fef113ce2c836885da85b983b21 100644 (file)
@@ -259,7 +259,7 @@ function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) {
                $performed = call_user_func_array($functionName, $urlData);
        } else {
                // Log invalid request
-               DEBUG_LOG(__FUNCTION__, __LINE__, " action={$formData['action']},id={$formData['id']},function={$functionName}");
+               DEBUG_LOG(__FUNCTION__, __LINE__, "action={$formData['action']},id={$formData['id']},function={$functionName}");
                addFatalMessage(__FUNCTION__, __LINE__, "Invalid member action! action=%s,id=%s,function=%s", array($formData['action'], $formData['id'], $functionName));
        }
 
index 78c842db866f7652e2e66b17c2614bce80a862bf..5968a53ddf44eceb011087a8c3ac1cd1ba3f4442 100644 (file)
@@ -321,7 +321,7 @@ ORDER BY d.userid");
 
        if (GET_EXT_VERSION('bonus') >= '0.8.7') {
                // List all notifications
-               ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE is_notify='Y' ORDER BY timestamp DESC");
+               ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `is_notify`='Y' ORDER BY `timestamp` DESC");
                $WHATs[]  = 'list_notifications';
                $DESCRs[] = getMessage('ADMIN_TASK_LIST_NOTIFICATIONS');
                $TITLEs[] = getMessage('ADMIN_TASK_LIST_NOTIFICATIONS_TITLE');
@@ -352,8 +352,8 @@ ORDER BY d.userid");
 
                ADD_SQL("SELECT ".$USE." AS points
 FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND ".$USE.">0".$lastOnline."
-ORDER BY points DESC, userid");
+WHERE `status`='CONFIRMED' AND ".$USE." > 0".$lastOnline."
+ORDER BY points DESC, `userid` ASC");
                $WHATs[]  = 'list_bonus';
                $DESCRs[] = getMessage('ADMIN_TASK_LIST_BONUS');
                $TITLEs[] = getMessage('ADMIN_TASK_LIST_BONUS_TITLE');
@@ -370,8 +370,8 @@ ORDER BY points DESC, userid");
                }
 
                ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND beg_points>0".$lastOnline."
-ORDER BY beg_points DESC, userid");
+WHERE `status`='CONFIRMED' AND `beg_points` > 0".$lastOnline."
+ORDER BY `beg_points` DESC, `userid` ASC");
                $WHATs[]  = 'list_beg';
                $DESCRs[] = getMessage('ADMIN_TASK_LIST_BEG');
                $TITLEs[] = getMessage('ADMIN_TASK_LIST_BEG_TITLE');
@@ -379,7 +379,7 @@ ORDER BY beg_points DESC, userid");
 
        if (EXT_IS_ACTIVE('doubler')) {
                // List waiting payouts
-               ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='N' ORDER BY `id`");
+               ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_doubler` WHERE `completed`='N' ORDER BY `id`");
                $WHATs[]  = 'list_doubler&amp;mode=waiting&amp;select=all';
                $DESCRs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_WAITING');
                $TITLEs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_WAITING_TITLE');
index 08c90e20bfa1c745e09636aa106e697813d6261e..748d68db59ac9a9ce06376e1f49098f460efdd02 100644 (file)
@@ -435,10 +435,10 @@ function USER_DO_NEW_PASSWORD ($email, $uid) {
                                array(generateHash($NEW_PASS), $uid), __FUNCTION__, __LINE__);
 
                        // Prepare data and message for email
-                       $msg = LOAD_EMAIL_TEMPLATE('new-pass', array('new_pass' => $NEW_PASS), $uid);
+                       $message = LOAD_EMAIL_TEMPLATE('new-pass', array('new_pass' => $NEW_PASS), $uid);
 
                        // ... and send it away
-                       sendEmail($uid, getMessage('GUEST_NEW_PASSWORD'), $msg);
+                       sendEmail($uid, getMessage('GUEST_NEW_PASSWORD'), $message);
 
                        // Output note to user
                        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('GUEST_NEW_PASSWORD_SEND'));
index 9aec9da8e97b6a7e599d3a65c5d68a4fb3a8d3b3..7c89782e871897aa927df8c0a76b2e2b19457299 100644 (file)
@@ -43,9 +43,9 @@ if (!defined('__SECURITY')) {
 }
 
 // Sets a status message and code
-function WERNIS_STATUS_MESSAGE ($msg, $status) {
-       $GLOBALS['wernis_data']['message'] = $msg;
-       $GLOBALS['wernis_data']['status'] = $status;
+function WERNIS_STATUS_MESSAGE ($message, $status) {
+       $GLOBALS['wernis_data']['message'] = $message;
+       $GLOBALS['wernis_data']['status']  = $status;
 }
 
 // Get the status message
@@ -389,7 +389,7 @@ function WERNIS_ADD_FEES_TO_ARRAY (&$array) {
        // Is the array an array? ;-)
        if (!is_array($array)) {
                // Log error and return
-               DEBUG_LOG(__FUNCTION__, __LINE__, ' Type '.gettype($array).'!=array.');
+               DEBUG_LOG(__FUNCTION__, __LINE__, 'Type ' . gettype($array) . ' != array.');
                return;
        } // END - if
 
index 6cad27f3066d48df641b02e00d4242b5ec65f310..1e218be4c858e6a188280b62f87353adc73d3475 100644 (file)
@@ -286,7 +286,7 @@ function yoomediaTranslateIndex ($type, $index) {
                $return = $GLOBALS['translation_tables']['yoomedia'][$type][$index];
        } else {
                // Not found!
-               DEBUG_LOG(__FUNCTION__, __LINE__, " type={$type},index={$index} not found.");
+               DEBUG_LOG(__FUNCTION__, __LINE__, "type={$type},index={$index} not found.");
        }
 
        // Return value
@@ -307,7 +307,7 @@ function yoomediaTranslateError ($errorCode) {
                print '<pre>';
                debug_print_backtrace();
                die('</pre>');
-               DEBUG_LOG(__FUNCTION__, __LINE__, " errorCode={$errorCode}");
+               DEBUG_LOG(__FUNCTION__, __LINE__, "errorCode={$errorCode}");
        }
 
        // Return value
index a1e81587ab33713651ce1d8092c4e8fcc87f253f..04e0499a75953c208ebffa31dc970c022ea74a5c 100644 (file)
@@ -85,25 +85,25 @@ if (SQL_NUMROWS($result_birthday) > 0) {
                        // @TODO 4 is hard-coded here, should we move it out in config?
                        for ($idx = 0; $idx < 4; $idx++) {
                                $content['check'] .= generateRandomCode("8", mt_rand(0, $month.$day), $content['userid'], ($age * ($idx + 1)));
-                       }
+                       } // END - for
 
                        // Insert row into database
                        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_birthday` (userid, points, chk_value) VALUES ('%s','%s','%s' )",
-                       array(bigintval($content['userid']), getConfig('birthday_points'), $content['check']), __FILE__, __LINE__);
+                               array(bigintval($content['userid']), getConfig('birthday_points'), $content['check']), __FILE__, __LINE__);
 
                        // Load email template with confirmation link
-                       $msg = LOAD_EMAIL_TEMPLATE("member_birthday_confirm", $content, bigintval($content['userid']));
+                       $message = LOAD_EMAIL_TEMPLATE('member_birthday_confirm', $content, bigintval($content['userid']));
                } else {
                        // Load default email template and fill in the age
-                       $msg = LOAD_EMAIL_TEMPLATE("member_birthday", $age, $content['userid']);
+                       $message = LOAD_EMAIL_TEMPLATE('member_birthday', $age, $content['userid']);
                }
 
                // Send email
-               sendEmail($content['email'], getMessage('HAPPY_BIRTHDAY'), $msg);
+               sendEmail($content['email'], getMessage('HAPPY_BIRTHDAY'), $message);
 
                // Remember him that he has received a birthday mail
-               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET birthday_sent=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1",
-               array(bigintval($content['userid'])), __FILE__, __LINE__);
+               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `birthday_sent`=UNIX_TIMESTAMP() WHERE `userid`=%s LIMIT 1",
+                       array(bigintval($content['userid'])), __FILE__, __LINE__);
        } // END - while
 
        // Free memory
index 82442de572a78905318ffdec2aa3800f06de4ca2..e446473121dac1d22424fcd599f91992401cc865 100644 (file)
@@ -73,8 +73,8 @@ if (REQUEST_GET('uid') == "all") {
                        $content['points'] = bigintval(REQUEST_POST('points'));
 
                        // Load email template and send email away
-                       $msg = LOAD_EMAIL_TEMPLATE("add-points", $content, bigintval($content['userid']));
-                       sendEmail(bigintval($content['userid']), getMessage('ADMIN_ADD_SUBJ'), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE('add-points', $content, bigintval($content['userid']));
+                       sendEmail(bigintval($content['userid']), getMessage('ADMIN_ADD_SUBJ'), $message);
                } // END - while
 
                // Free memory
@@ -84,7 +84,7 @@ if (REQUEST_GET('uid') == "all") {
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_ALL_POINTS_ADDED'));
        } else {
                // Display form add points
-               LOAD_TEMPLATE("admin_add_points_all");
+               LOAD_TEMPLATE('admin_add_points_all');
        }
 } elseif (REQUEST_ISSET_GET('uid')) {
        // User ID found in URL so we use this give him some credits
@@ -93,7 +93,6 @@ if (REQUEST_GET('uid') == "all") {
        if (SQL_NUMROWS($result) == 1) {
                // Selected user does exist
                list($sname, $fname, $email) = SQL_FETCHROW($result);
-               SQL_FREERESULT($result);
 
                if ((isFormSent()) && (REQUEST_ISSET_POST(('points')))) {
                        // Remove depth to prevent booking errors. This is a bad coding
@@ -111,9 +110,9 @@ if (REQUEST_GET('uid') == "all") {
                        );
 
                        // Message laden
-                       $msg = LOAD_EMAIL_TEMPLATE("add-points", $content, bigintval(REQUEST_GET('uid')));
+                       $message = LOAD_EMAIL_TEMPLATE("add-points", $content, bigintval(REQUEST_GET('uid')));
 
-                       sendEmail(bigintval(REQUEST_GET('uid')), getMessage('ADMIN_ADD_SUBJ'), $msg);
+                       sendEmail(bigintval(REQUEST_GET('uid')), getMessage('ADMIN_ADD_SUBJ'), $message);
                        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_POINTS_ADDED'));
                } else {
                        // Opps, missing form here
@@ -126,6 +125,9 @@ if (REQUEST_GET('uid') == "all") {
                // User not found!
                LOAD_TEMPLATE('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");
        }
+
+       // Free result
+       SQL_FREERESULT($result);
 } else {
        // Output selection form with all confirmed user accounts listed
        ADD_MEMBER_SELECTION_BOX('0', true);
index 654481c992d083153c42b2e967da520b3ef5e37b..a52a0359d9585c37d48f719bb539bfbf8e6addbf 100644 (file)
@@ -49,15 +49,15 @@ if ((isFormSent()) && (REQUEST_ISSET_GET('admin'))) {
        // Send mail or message
        if ((EXT_IS_ACTIVE("msg")) && (REQUEST_POST('type') == "msg")) {
                // Add message
-               $msg = LOAD_EMAIL_TEMPLATE("admins_msg_contct_admin", REQUEST_POST('text'), '0');
-               SEND_ADMIN_MESSAGE(REQUEST_GET('admin'), ADMINS_MSG_FROM_ADMIN, $msg);
+               $message = LOAD_EMAIL_TEMPLATE('admins_msg_contct_admin', REQUEST_POST('text'), '0');
+               SEND_ADMIN_MESSAGE(REQUEST_GET('admin'), ADMINS_MSG_FROM_ADMIN, $message);
        } else {
                // Load admin's email address
                $email = getAdminEmail(bigintval(REQUEST_GET('admin')));
 
                // Load email template and send the mail to the admin
-               $msg = LOAD_EMAIL_TEMPLATE("admins_mail_contct_admin", REQUEST_POST('text'), '0');
-               sendEmail($email, getMessage('ADMINS_MSG_FROM_ADMIN'), $msg);
+               $message = LOAD_EMAIL_TEMPLATE('admins_mail_contct_admin', REQUEST_POST('text'), '0');
+               sendEmail($email, getMessage('ADMINS_MSG_FROM_ADMIN'), $message);
        }
 
        // Mail / message dropped
@@ -65,14 +65,16 @@ if ((isFormSent()) && (REQUEST_ISSET_GET('admin'))) {
 } elseif (REQUEST_ISSET_GET('admin')) {
        // Load contact form template
        define('__ADMIN', REQUEST_GET('admin'));
-       if (EXT_IS_ACTIVE("msg")) {
+       if (EXT_IS_ACTIVE('msg')) {
                // Add option to select between mail and message
-               define('ADMINS_MESSAGING_SELECTION', LOAD_TEMPLATE("admin_admins_contct_select", true));
+               define('ADMINS_MESSAGING_SELECTION', LOAD_TEMPLATE('admin_admins_contct_select', true));
        } else {
                // Outout hidden input
-               define('ADMINS_MESSAGING_SELECTION', LOAD_TEMPLATE("admin_admins_contct_default", true));
+               define('ADMINS_MESSAGING_SELECTION', LOAD_TEMPLATE('admin_admins_contct_default', true));
        }
-       LOAD_TEMPLATE("admin_admins_contct_form");
+
+       // Load main form
+       LOAD_TEMPLATE('admin_admins_contct_form');
 } else {
        // Please select an admin!
        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMINS_SELECT_ADMIN'));
index ef1973fbe404d45fc4730c5a1e52329d350f084c..0143150c274ddfdc780c2a2cd1833f79174c6273 100644 (file)
@@ -70,13 +70,13 @@ VALUES ('%s', %d, %d,'%s','%s','%s','%s','%s','%s','%s')",
                ), __FILE__, __LINE__);
 
                // Get message
-               $msg = getMessage('ADMIN_PAYOUT_TYPE_ADDED');
+               $message = getMessage('ADMIN_PAYOUT_TYPE_ADDED');
        } else {
                // Free memory
                SQL_FREERESULT($result);
 
                // Does already exist
-               $msg = "<div class=\"admin_failed\">{--ADMIN_PAYOUT_TYPE_ALREADY--}</div>";
+               $message = "<div class=\"admin_failed\">{--ADMIN_PAYOUT_TYPE_ALREADY--}</div>";
        }
 }
 
@@ -117,7 +117,7 @@ WHERE `id`='".$id."' LIMIT 1",
                runFilterChain('run_sqls');
 
                // Get message
-               $msg = getMessage('ADMIN_PAYOUT_ENTRIES_CHANGED');
+               $message = getMessage('ADMIN_PAYOUT_ENTRIES_CHANGED');
        } else {
                $display = false; //Suppress any other outputs
                $OUT = ''; $SW = 2;
@@ -165,7 +165,7 @@ WHERE `id`='".$id."' LIMIT 1",
                runFilterChain('run_sqls');
 
                // Get message
-               $msg = getMessage('ADMIN_PAYOUT_ENTRIES_DELETED');
+               $message = getMessage('ADMIN_PAYOUT_ENTRIES_DELETED');
        } else {
                $display = false; //Suppress any other outputs
                $OUT = ''; $SW = 2;
@@ -199,13 +199,18 @@ WHERE `id`='".$id."' LIMIT 1",
        }
 }
 
-if (!empty($msg)) {
+if (!empty($message)) {
        // Output message
-       LOAD_TEMPLATE('admin_settings_saved', false, $msg);
-}
+       LOAD_TEMPLATE('admin_settings_saved', false, $message);
+} // END - if
 
 // Payout types
-$result_type = SQL_QUERY("SELECT id, type, rate, min_points, from_account FROM `{!_MYSQL_PREFIX!}_payout_types` ORDER BY type", __FILE__, __LINE__);
+$result_type = SQL_QUERY("SELECT
+       `id`, `type`, `rate`, `min_points`, `from_account`
+FROM
+       `{!_MYSQL_PREFIX!}_payout_types`
+ORDER BY
+       `type` ASC", __FILE__, __LINE__);
 
 if ((SQL_NUMROWS($result_type) > 0) && ($display)) {
        // List all payout types
index aca046e8e81999a250ce9e75d875b274c6080d52..0307be89ea1bd30c7ac321a3a772616aefa90a9d 100644 (file)
@@ -74,8 +74,8 @@ if (REQUEST_ISSET_GET('mid')) {
                $DATA = array('url' => $url, 'subject' => $subject);
 
                // Load email template and send the email away
-               $msg_user = LOAD_EMAIL_TEMPLATE("order-deleted", array(), $sender);
-               sendEmail($sender, getMessage('MEMBER_ORDER_DELETED'), $msg_user);
+               $message_user = LOAD_EMAIL_TEMPLATE('order-deleted', array(), $sender);
+               sendEmail($sender, getMessage('MEMBER_ORDER_DELETED'), $message_user);
 
                // Fetch right stats_id from pool
                $result_pool = SQL_QUERY_ESC("SELECT
@@ -139,7 +139,7 @@ LIMIT 1",
                        }
 
                        // Remove links from DB
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s",
+                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `stats_id`=%s",
                        array(bigintval($stats_id)), __FILE__, __LINE__);
                        $cnt += SQL_AFFECTEDROWS();
 
index 74cfcf05061e743d5e78eda7d76f14482449c4f3..0a3d89802f465cc6fa209395b00e1d058f182845 100644 (file)
@@ -82,8 +82,8 @@ WHERE `id`=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__);
                        );
 
                        // Send email to user
-                       $msg = LOAD_EMAIL_TEMPLATE("member_holiday_removed", $content, $uid);
-                       sendEmail($uid, getMessage('HOLIDAY_ADMIN_REMOVED_SUBJ'), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE("member_holiday_removed", $content, $uid);
+                       sendEmail($uid, getMessage('HOLIDAY_ADMIN_REMOVED_SUBJ'), $message);
                        $cnt++;
                }
        }
@@ -93,20 +93,28 @@ WHERE `id`=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__);
        $message = getMessage('HOLIDAY_ADMIN_SINGLE_404');
 
        // Fetch data
-       $result_load = SQL_QUERY_ESC("SELECT holiday_start AS start, holiday_end AS end
-FROM `{!_MYSQL_PREFIX!}_user_holidays`
-WHERE userid=%s LIMIT 1", array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+       $result_load = SQL_QUERY_ESC("SELECT
+       `holiday_start` AS start, `holiday_end` AS end
+FROM
+       `{!_MYSQL_PREFIX!}_user_holidays`
+WHERE
+       `userid`=%s
+LIMIT 1",
+               array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
        if (SQL_NUMROWS($result_load) == 1) {
                // Load data
                $content = SQL_FETCHARRAY($result_load);
 
                // Delete one holiday request (for task)
-               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_holidays`
-WHERE userid=%s LIMIT 1", array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM
+       `{!_MYSQL_PREFIX!}_user_holidays`
+WHERE
+       `userid`=%s
+LIMIT 1", array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
 
                // Send email to user
-               $msg = LOAD_EMAIL_TEMPLATE("member_holiday_removed", $content, REQUEST_GET('uid'));
-               sendEmail(REQUEST_GET('uid'), getMessage('HOLIDAY_ADMIN_REMOVED_SUBJ'), $msg);
+               $message = LOAD_EMAIL_TEMPLATE('member_holiday_removed', $content, REQUEST_GET('uid'));
+               sendEmail(REQUEST_GET('uid'), getMessage('HOLIDAY_ADMIN_REMOVED_SUBJ'), $message);
 
                // Set message
                $message = getMessage('HOLIDAY_ADMIN_SINGLE_DELETED');
index 71579574af81875a0984c7ac21f88ea53e442108..a1dee18c04c3abf83e7411fe97bcbde79abedf4b 100644 (file)
@@ -48,32 +48,30 @@ ADD_DESCR('admin', __FILE__);
 if (REQUEST_ISSET_GET('id')) {
        // Check for selected sponsor
        $result = SQL_QUERY_ESC("SELECT email, gender, surname, family FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
-       array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+               array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Remove sponsor
                if (isFormSent()) {
                        // Load data and remember it in constants
-                       list($email, $gender, $surname, $family) = SQL_FETCHROW($result);
+                       $DATA = SQL_FETCHARRAY($result);
 
-                       // Free result
-                       SQL_FREERESULT($result);
-
-                       define('__EMAIL'  , $email);
-                       define('__GENDER'  , translateGender($gender));
-                       define('__SURNAME', $surname);
-                       define('__FAMILY' , $family);
+                       // @TODO Rewrite these constants
+                       define('__EMAIL'  , $DATA['email']);
+                       define('__GENDER'  , translateGender($DATA['gender']));
+                       define('__SURNAME', $DATA['surname']);
+                       define('__FAMILY' , $DATA['family']);
 
                        // Prepare message and send it away
-                       $msg = LOAD_EMAIL_TEMPLATE("del_sponsor", REQUEST_POST('reason'), bigintval(REQUEST_GET('id')));
-                       sendEmail($email, getMessage('ADMIN_SPONSOR_DEL_SUBJECT'), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE('del_sponsor', REQUEST_POST('reason'), bigintval(REQUEST_GET('id')));
+                       sendEmail($DATA['email'], getMessage('ADMIN_SPONSOR_DEL_SUBJECT'), $message);
 
                        // Remove account
                        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
-                       array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+                               array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
 
                        // Remove orders
                        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_sponsor_orders` WHERE sponsorid='%s' LIMIT 1",
-                       array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+                               array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
 
                        // Output message
                        LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_SPONSOR_DELETED'), bigintval(REQUEST_GET('id'))));
@@ -82,13 +80,14 @@ if (REQUEST_ISSET_GET('id')) {
                        redirectToUrl('modules.php?module=admin&amp;what=list_sponsor&amp;id='.bigintval(REQUEST_GET('id')));
                } else {
                        // Load data
-                       list ($email, $gender, $sname, $fname) = SQL_FETCHROW($result);
+                       $DATA = SQL_FETCHARRAY($result);
 
                        // Transfer data to constants for the template
-                       define('__EMAIL' , $email);
-                       define('__SNAME' , $sname);
+                       // @TODO Rewrite these constants
+                       define('__EMAIL' , $DATA['email']);
+                       define('__SNAME' , $DATA['surname']);
                        define('__FNAME' , $fname);
-                       define('__GENDER', translateGender($gender));
+                       define('__GENDER', translateGender($DATA['gender']));
                        define('__UID'   , bigintval(REQUEST_GET('id')));
 
                        // Display form
@@ -98,6 +97,9 @@ if (REQUEST_ISSET_GET('id')) {
                // Sponsor not found!
                LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_SPONSOR_404'), bigintval(REQUEST_GET('id'))));
        }
+
+       // Free result
+       SQL_FREERESULT($result);
 } else {
        // Not called by what-list_sponsor.php
        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_CALL_NOT_DIRECTLY'));
index 3c3cf9120b7c394e269e3672f955523164cc2a28..9362e793ffbd304659ab10c47cc9adf413d7bffb 100644 (file)
@@ -131,12 +131,12 @@ LIMIT 1",
                                                define('__REASON' , REQUEST_POST('reason'));
 
                                                // Send email
-                                               $msg = LOAD_EMAIL_TEMPLATE('sponsor_add_points', REQUEST_POST('reason'), true);
-                                               sendEmail(__EMAIL, ADMIN_SPONSOR_ADD_POINTS_SUBJ, $msg);
-                                               $message = ADMIN_SPONSOR_POINTS_ADDED;
+                                               $message = LOAD_EMAIL_TEMPLATE('sponsor_add_points', REQUEST_POST('reason'), true);
+                                               sendEmail(constant('__EMAIL'), getMessage('ADMIN_SPONSOR_ADD_POINTS_SUBJ'), $message);
+                                               $message = getMessage('ADMIN_SPONSOR_POINTS_ADDED');
                                        } else {
                                                // No points entered to add!
-                                               $message = ADMIN_SPONSPOR_NO_POINTS_TO_ADD;
+                                               $message = getMessage('ADMIN_SPONSPOR_NO_POINTS_TO_ADD');
                                        }
                                        break;
 
@@ -154,12 +154,12 @@ LIMIT 1",
                                                define('__REASON' , REQUEST_POST('reason'));
 
                                                // Send email
-                                               $msg = LOAD_EMAIL_TEMPLATE('sponsor_sub_points', REQUEST_POST('reason'), true);
-                                               sendEmail(__EMAIL, ADMIN_SPONSOR_SUB_POINTS_SUBJ, $msg);
-                                               $message = ADMIN_SPONSOR_POINTS_SUBTRACTED;
+                                               $message = LOAD_EMAIL_TEMPLATE('sponsor_sub_points', REQUEST_POST('reason'), true);
+                                               sendEmail(constant('__EMAIL'), getMessage('ADMIN_SPONSOR_SUB_POINTS_SUBJ'), $message);
+                                               $message = getMessage('ADMIN_SPONSOR_POINTS_SUBTRACTED');
                                        } else {
                                                // No points entered to add!
-                                               $message = ADMIN_SPONSPOR_NO_POINTS_TO_SUBTRACT;
+                                               $message = getMessage('ADMIN_SPONSPOR_NO_POINTS_TO_SUBTRACT');
                                        }
                                        break;
 
@@ -170,7 +170,7 @@ LIMIT 1",
                                                REQUEST_UNSET_POST('pass1');
                                                REQUEST_UNSET_POST('pass2');
                                                $PASS = false;
-                                       }
+                                       } // END - if
 
                                        // Convert time selection
                                        $DATA = array(); $id = 'warning_interval_ye'; $skip = false;
@@ -186,8 +186,8 @@ LIMIT 1",
                                        if ($PASS === false) REQUEST_SET_POST('pass1', getMessage('SPONSOR_PASS_UNCHANGED'));
 
                                        // Load email template and send the mail away
-                                       $msg = LOAD_EMAIL_TEMPLATE('admin_sponsor_edit', REQUEST_POST_ARRAY(), false);
-                                       sendEmail(REQUEST_POST('email'), getMessage('ADMIN_SPONSOR_EDIT_SUBJECT'), $msg);
+                                       $message = LOAD_EMAIL_TEMPLATE('admin_sponsor_edit', REQUEST_POST_ARRAY(), false);
+                                       sendEmail(REQUEST_POST('email'), getMessage('ADMIN_SPONSOR_EDIT_SUBJECT'), $message);
                                        break;
 
                                default: // Unknown mode
index cc64a19bff1cafa304bed4d8f9b1b873e3d18ecc..083402062f66e90aa288f87f3380cbda3fd0c0b4 100644 (file)
@@ -51,7 +51,7 @@ ADD_DESCR('admin', __FILE__);
 //             0     1        2      3        4          5           6          7      8         9        10
 $sql = "SELECT id, sender, subject, text, receivers, payment_id, data_type, timestamp, url, target_send, cat_id
  FROM `{!_MYSQL_PREFIX!}_pool`
- WHERE data_type='SEND' OR data_type='DELETED'
+ WHERE `data_type`='SEND' OR `data_type`='DELETED'
  ORDER BY timestamp DESC";
 
 // Check for maximum pages
index 5ccf1187570ba4943583e1fd91fbad096a0541f0..d560b9faa9bf96b1101355e7c3d58aad2fe5c404 100644 (file)
@@ -73,7 +73,7 @@ if ((REQUEST_ISSET_POST('add')) && (REQUEST_ISSET_POST(('code'))) && (REQUEST_IS
        LOAD_TEMPLATE('admin_settings_saved', false, $message);
 } elseif ((REQUEST_ISSET_POST('change')) && (REQUEST_ISSET_POST('id'))) {
        // Change all status
-       ADMIN_CHANGE_ACTIVATION_STATUS(REQUEST_POST('id'), "countries", "is_active");
+       ADMIN_CHANGE_ACTIVATION_STATUS(REQUEST_POST('id'), 'countries', 'is_active');
 
        // Show next link
        LOAD_TEMPLATE('admin_next_link', false, array(
index aa10df751a7c18ab0ec1d80597fa449c074cef1e..7db6c8f734f3b1a0eade4c48e324878dfb4508c1 100644 (file)
@@ -68,8 +68,8 @@ if (REQUEST_ISSET_GET('uid')) {
                        array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
                } else {
                        // Load stats ID (2nd will be ignored later! But it is needed for the same fetchrow command)
-                       $result = SQL_QUERY_ESC("SELECT stats_id, stats_id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE userid=%s ORDER BY `id`",
-                       array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+                       $result = SQL_QUERY_ESC("SELECT stats_id, stats_id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `userid`=%s ORDER BY `id` ASC",
+                               array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
                }
 
                // Get number of rows from the query
@@ -79,12 +79,12 @@ if (REQUEST_ISSET_GET('uid')) {
                        // Some unconfirmed mails left
                        if (REQUEST_GET('del') == "all") {
                                // Delete all unconfirmed mails by this user
-                               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE userid=%s LIMIT %s",
-                               array(bigintval(REQUEST_GET('uid')), $nums), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `userid`=%s LIMIT %s",
+                                       array(bigintval(REQUEST_GET('uid')), $nums), __FILE__, __LINE__);
 
                                // Prepare mail and send it away
-                               $msg = LOAD_EMAIL_TEMPLATE("admin-del_links", $nums, bigintval(REQUEST_GET('uid')));
-                               sendEmail($email, getMessage('ADMIN_DEL_LINK_SUBJ'), $msg);
+                               $message = LOAD_EMAIL_TEMPLATE('admin-del_links', $nums, bigintval(REQUEST_GET('uid')));
+                               sendEmail($email, getMessage('ADMIN_DEL_LINK_SUBJ'), $message);
 
                                // Display message
                                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_LINKS_DELETED'));
@@ -105,15 +105,15 @@ if (REQUEST_ISSET_GET('uid')) {
                                        // @TODO Rewrite this to includes/filter
                                        switch ($type) {
                                                case 'NORMAL':
-                                                       $result_data = SQL_QUERY_ESC("SELECT subject, timestamp_ordered, cat_id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1",
-                                                       array(bigintval($id)), __FILE__, __LINE__);
+                                                       $result_data = SQL_QUERY_ESC("SELECT `subject`, `timestamp_ordered`, `cat_id` FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1",
+                                                               array(bigintval($id)), __FILE__, __LINE__);
                                                        $type = 'mailid'; $DATA = $id; $PROBLEM = getMessage('NORMAL_MAIL_PROBLEM');
                                                        $LINK = "<a href=\"{!URL!}/mailid.php?uid=".REQUEST_GET('uid')."&amp;mailid=".$id."\" target=\"_blank\">".$id."</a>";
                                                        break;
 
                                                case 'BONUS':
-                                                       $result_data = SQL_QUERY_ESC("SELECT subject, timestamp, cat_id FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
-                                                       array(bigintval($id2)), __FILE__, __LINE__);
+                                                       $result_data = SQL_QUERY_ESC("SELECT `subject`, `timestamp`, `cat_id` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
+                                                               array(bigintval($id2)), __FILE__, __LINE__);
                                                        $type = 'bonusid'; $DATA = $id2; $PROBLEM = getMessage('BONUS_MAIL_PROBLEM');
                                                        $LINK = "<a href=\"{!URL!}/mailid.php?uid=".REQUEST_GET('uid')."&amp;bonusid=".$id2."\" target=\"_blank\">".$id2."</a>";
                                                        break;
index 0a28997115e3d95090b89e7285c39f3124ca1286..762ea9db954036abef312f2ceca973db465dfaf7 100644 (file)
@@ -49,14 +49,14 @@ if ((REQUEST_ISSET_POST('uid')) && (REQUEST_ISSET_POST('id'))) {
        // Update database...
        // First user's account
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET nl_until=(UNIX_TIMESTAMP() + nl_timespan), nl_receive='N', nl_timespan=0 WHERE userid=%s LIMIT 1",
-       array(bigintval(REQUEST_POST('uid'))), __FILE__, __LINE__);
+               array(bigintval(REQUEST_POST('uid'))), __FILE__, __LINE__);
 
        // Next the task system...
        runFilterChain('solve_task', bigintval(REQUEST_POST('id')));
 
        // Send mail to user
-       $msg = LOAD_EMAIL_TEMPLATE("member_newsletter_done", true, bigintval(REQUEST_POST('uid')));
-       sendEmail(bigintval(REQUEST_POST('uid')), getMessage('NL_MEMBER_DONE_SUBJECT'), $msg);
+       $message = LOAD_EMAIL_TEMPLATE('member_newsletter_done', true, bigintval(REQUEST_POST('uid')));
+       sendEmail(bigintval(REQUEST_POST('uid')), getMessage('NL_MEMBER_DONE_SUBJECT'), $message);
 
        // Output message to admin
        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NL_MEMBER_DONE'));
index b8e0c5c9232694f222c5db6c4717cc45e6d10f76..3d82071491e5568affc2aa9c745ab9756747a912 100644 (file)
@@ -136,10 +136,10 @@ LIMIT 1",
 
                                                // Clear payout request
                                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_payouts` SET `status`='ACCEPTED' WHERE `id`=%s LIMIT 1",
-                                               array(bigintval(REQUEST_GET('pid'))), __FILE__, __LINE__);
+                                                       array(bigintval(REQUEST_GET('pid'))), __FILE__, __LINE__);
 
                                                // Send out mail
-                                               $msg = LOAD_EMAIL_TEMPLATE('member_payout_accepted', REQUEST_POST('text'), $uid);
+                                               $message = LOAD_EMAIL_TEMPLATE('member_payout_accepted', REQUEST_POST('text'), $uid);
 
                                                // Output message
                                                if ($allow == 'Y') {
@@ -151,11 +151,11 @@ LIMIT 1",
                                                }
 
                                                // Finally send mail
-                                               sendEmail($email, getMessage('PAYOUT_ACCEPTED_SUBJECT'), $msg);
+                                               sendEmail($email, getMessage('PAYOUT_ACCEPTED_SUBJECT'), $message);
                                        } else {
                                                // Something goes wrong... :-(
                                                $content = implode("<br />", $ret);
-                                               LOAD_TEMPLATE("admin_payout_failed_transfer", false, $content);
+                                               LOAD_TEMPLATE('admin_payout_failed_transfer', false, $content);
                                        }
                                } else {
                                        // Cannot load payout id
@@ -184,13 +184,13 @@ LIMIT 1",
                                        array(bigintval(REQUEST_GET('pid'))), __FILE__, __LINE__);
 
                                // Send out mail
-                               $msg = LOAD_EMAIL_TEMPLATE('member_payout_rejected', REQUEST_POST('text'), $uid);
+                               $message = LOAD_EMAIL_TEMPLATE('member_payout_rejected', REQUEST_POST('text'), $uid);
 
                                // Output message
                                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('PAYOUT_REJECTED_NOTIFIED'));
 
                                // Finally send mail
-                               sendEmail($email, getMessage('PAYOUT_REJECTED_SUBJECT'), $msg);
+                               sendEmail($email, getMessage('PAYOUT_REJECTED_SUBJECT'), $message);
                        } else {
                                // Prepare content
                                $content = array(
index 281fd8800ecce8b26ddcafd59f8ca5e527df71c2..fcda54a4f562458d60e748dc41565af4707ee5ca 100644 (file)
@@ -48,49 +48,48 @@ $message = '';
 
 if (REQUEST_ISSET_GET('id')) {
        // Check for selected sponsor
-       $result = SQL_QUERY_ESC("SELECT gender, surname, family, email, status FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
-       array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) == 1) {
+       $result_sponsor = SQL_QUERY_ESC("SELECT `gender`, `surname`, `family`, `email`, `status` FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
+               array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+       if (SQL_NUMROWS($result_sponsor) == 1) {
                // Get sponsor's current status and let only confirmed and locked status pass
-               list($gender, $sname, $fname, $email, $status) = SQL_FETCHROW($result);
-               SQL_FREERESULT($result);
+               $DATA = SQL_FETCHARRAY($result_sponsor);
 
-               if (($status == 'CONFIRMED') || ($status == 'LOCKED')) {
+               if (($DATA['status'] == 'CONFIRMED') || ($DATA['status'] == 'LOCKED')) {
                        // Transfer data to constants
-                       define('__GENDER'  , translateGender($gender));
-                       define('__SURNAME', $sname);
-                       define('__FAMILY' , $fname);
+                       define('__GENDER'  , translateGender($DATA['gender']));
+                       define('__SURNAME', $DATA['surname']);
+                       define('__FAMILY' , $DATA['family']);
                        define('__ID'     , bigintval(REQUEST_GET('id')));
 
                        if (isFormSent()) {
                                // Create messages
-                               if ($status == 'CONFIRMED') {
+                               if ($DATA['status'] == 'CONFIRMED') {
                                        // Message when sponsor's account got lock
                                        define('__EMAIL_MSG', getMessage('SPONSOR_ACCOUNT_LOCKED'));
                                        $subject = getMessage('SPONSOR_SUBJECT_LOCKED');
-                                       $status = 'LOCKED';
+                                       $DATA['status'] = 'LOCKED';
                                } else {
                                        // Message when sponsor's account got unlock
                                        define('__EMAIL_MSG', getMessage('SPONSOR_ACCOUNT_UNLOCKED'));
                                        $subject = getMessage('SPONSOR_SUBJECT_UNLOCKED');
-                                       $status = 'CONFIRMED';
+                                       $DATA['status'] = 'CONFIRMED';
                                }
 
                                // Load email message
-                               $msg = LOAD_EMAIL_TEMPLATE("lock_sponsor", REQUEST_POST('reason'), bigintval(REQUEST_GET('id')));
+                               $message = LOAD_EMAIL_TEMPLATE('lock_sponsor', REQUEST_POST('reason'), bigintval(REQUEST_GET('id')));
 
                                // And send it away
-                               sendEmail($email, $subject, $msg);
+                               sendEmail($DATA['email'], $subject, $message);
 
                                // Update sponsor's account
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='".$status."' WHERE `id`='%s' LIMIT 1",
-                               array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='".$DATA['status']."' WHERE `id`='%s' LIMIT 1",
+                                       array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
                        } elseif (REQUEST_ISSET_POST('no')) {
                                // No don't lock / unlock now!
                                redirectToUrl('modules.php?module=admin&amp;what=list_sponsor&amp;id='.bigintval(REQUEST_GET('id')));
                        } else {
                                // Create header and text messages
-                               if ($status == 'CONFIRMED') {
+                               if ($DATA['status'] == 'CONFIRMED') {
                                        // Messages when sponsor's account is confirmed
                                        define('__HEADER_MESSAGE', getMessage('SPONSOR_LOCK_SPONSOR_HEADER'));
                                        define('__TEXT_MESSAGE'  , getMessage('SPONSOR_LOCK_SPONSOR_TEXT'));
@@ -101,7 +100,7 @@ if (REQUEST_ISSET_GET('id')) {
                                }
 
                                // Create email link
-                               define('__EMAIL_LINK', '<a href="' . generateEmailLink($email, 'sponsor_data') . '">{!__GENDER!} {!__SURNAME!} {!__FAMILY!}</a>');
+                               define('__EMAIL_LINK', '<a href="' . generateEmailLink($DATA['email'], 'sponsor_data') . '">{!__GENDER!} {!__SURNAME!} {!__FAMILY!}</a>');
 
                                // Display form
                                LOAD_TEMPLATE('admin_lock_sponsor');
@@ -114,6 +113,9 @@ if (REQUEST_ISSET_GET('id')) {
                // Sponsor not found!
                $message = sprintf(getMessage('ADMIN_SPONSOR_404'), bigintval(REQUEST_GET('id')));
        }
+
+       // Free result
+       SQL_FREERESULT($result_sponsor);
 } else {
        // Not called by what-list_sponsor.php
        $message = getMessage('ADMIN_CALL_NOT_DIRECTLY');
@@ -122,7 +124,7 @@ if (REQUEST_ISSET_GET('id')) {
 if (!empty($message)) {
        // Output message
        LOAD_TEMPLATE('admin_settings_saved', false, $message);
-}
+} // END - if
 
 //
 ?>
index 435e1e1835b072e8fcaafbd26e2a0282f9de1433..06bdeca12023ee2952b7eb0ff06081930c24ca95 100644 (file)
@@ -74,10 +74,10 @@ if (REQUEST_ISSET_GET('uid')) {
                        // Entry updated?
                        if (SQL_AFFECTEDROWS() == 1) {
                                // Send an email to the user! In later version you can optionally switch this feature off
-                               $msg = LOAD_EMAIL_TEMPLATE("lock-user", array('text' => REQUEST_POST('reason')), bigintval(REQUEST_GET('uid')));
+                               $message = LOAD_EMAIL_TEMPLATE('lock-user', array('text' => REQUEST_POST('reason')), bigintval(REQUEST_GET('uid')));
 
                                // Send away...
-                               sendEmail(bigintval(REQUEST_GET('uid')), ADMIN_LOCKED_SUBJ, $msg);
+                               sendEmail(bigintval(REQUEST_GET('uid')), ADMIN_LOCKED_SUBJ, $message);
                        } // END - if
 
                        // Prepare message
@@ -87,21 +87,29 @@ if (REQUEST_ISSET_GET('uid')) {
                        // Ok, unlock the account!
                        if (GET_EXT_VERSION('user') >= '0.3.5') {
                                // Reset lock reason as well
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='CONFIRMED',lock_reason='',lock_timestamp='0000-00-00 00:00' WHERE userid=%s LIMIT 1",
-                               array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("UPDATE
+       `{!_MYSQL_PREFIX!}_user_data`
+SET
+       `status`='CONFIRMED',
+       `lock_reason`='',
+       `lock_timestamp`='0000-00-00 00:00'
+WHERE
+       `userid`=%s
+LIMIT 1",
+                                       array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
                        } else {
                                // No lock reason to reset
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='CONFIRMED' WHERE userid=%s LIMIT 1",
-                               array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='CONFIRMED' WHERE `userid`=%s LIMIT 1",
+                                       array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
                        }
 
                        // Entry updated?
                        if (SQL_AFFECTEDROWS() == 1) {
                                // Send an email to the user! In later version you can optionally switch this feature off
-                               $msg = LOAD_EMAIL_TEMPLATE("unlock-user", array('text' => REQUEST_POST('reason')), bigintval(REQUEST_GET('uid')));
+                               $message = LOAD_EMAIL_TEMPLATE('unlock-user', array('text' => REQUEST_POST('reason')), bigintval(REQUEST_GET('uid')));
 
                                // Send away...
-                               sendEmail(bigintval(REQUEST_GET('uid')), getMessage('ADMIN_UNLOCKED_SUBJ'), $msg);
+                               sendEmail(bigintval(REQUEST_GET('uid')), getMessage('ADMIN_UNLOCKED_SUBJ'), $message);
                                if (EXT_IS_ACTIVE('rallye')) {
                                        RALLYE_AUTOADD_USER(REQUEST_GET('uid'));
                                } // END - if
@@ -113,27 +121,25 @@ if (REQUEST_ISSET_GET('uid')) {
                } elseif (REQUEST_ISSET_POST('del')) {
                        // Delete the account
                        $ACT = true;
-                       loadIncludeOnce("inc/modules/admin/what-del_user.php");
+                       loadIncludeOnce('inc/modules/admin/what-del_user.php');
                } elseif (REQUEST_ISSET_POST('no')) {
                        // Do not lock him...
                        $URL = ADMIN_CREATE_USERID_LINK(REQUEST_GET('uid'));
                } else {
-                       $result = SQL_QUERY_ESC("SELECT email, surname, family FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+                       // Load user data we need
+                       $result = SQL_QUERY_ESC("SELECT `email`, `surname`, `family` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
                                array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
 
                        // Entry found?
                        if (SQL_NUMROWS($result) == 1) {
                                // Load data
-                               list ($email, $sname, $fname) = SQL_FETCHROW($result);
-
-                               // Free result
-                               SQL_FREERESULT($result);
+                               $DATA = SQL_FETCHARRAY($result);
 
                                // Transfer data to constants for the template
                                // @TODO Rewrite these all constants
-                               define('__EMAIL', generateEmailLink($email, 'user_data'));
-                               define('__SNAME', $sname);
-                               define('__FNAME', $fname);
+                               define('__EMAIL', generateEmailLink($DATA['email'], 'user_data'));
+                               define('__SNAME', $DATA['surname']);
+                               define('__FNAME', $DATA['family']);
                                define('__UID'  , bigintval(REQUEST_GET('uid')));
 
                                // Realy want to lock?
@@ -164,6 +170,9 @@ if (REQUEST_ISSET_GET('uid')) {
                                // Account does not exists!
                                LOAD_TEMPLATE('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");
                        }
+
+                       // Free result
+                       SQL_FREERESULT($result);
                }
 
                // Is an URL set?
index f2fded492112afa250a83e2ac3eeb04623e83c30..49b9553395e5463bd783678d69ff69f6f34ad743 100644 (file)
@@ -88,28 +88,30 @@ if (REQUEST_ISSET_GET('access')) {
                LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('LOGFILE_NOT_READABLE'), $access));
        }
 } else {
-       // List access logfiles
-       $dir = constant('PATH') . getConfig('logs_base') . '/';
-
        // Is the directory there?
-       if (isDirectory($dir)) {
-               // logs directory does exist
-               OUTPUT_HTML("<ol>");
-               $handle = opendir($dir) or app_die(__FILE__, __LINE__, 'Cannot open directory '.getConfig('logs_base') . '!');
-               while ($file = readdir($handle)) {
-                       // We currenly only like files with "access" as prefix, should be more flexible!
-                       if (substr($file, 0, 6) == 'access') {
-                               // Okay, let us print it out
-                               OUTPUT_HTML("<li><a href=\"{!URL!}/modules.php?module=admin&amp;what=".getWhat()."&amp;access=".urlencode($file)."\">".$file."</a></li>");
-                       }
-               }
-               closedir($handle);
-               OUTPUT_HTML("</ol>");
+       if (isDirectory(constant('PATH') . getConfig('logs_base'))) {
+               // Logs directory does exist so begin the list
+               OUTPUT_HTML('<ol>');
+
+               // Read all files
+               $files = getArrayFromDirectory(getConfig('logs_base'), 'access');
+
+               // And walk through them
+               foreach ($files as $file) {
+                       // Cut dirname away
+                       $file = basename($file);
+
+                       // Okay, let us print it out
+                       OUTPUT_HTML("<li><a href=\"{!URL!}/modules.php?module=admin&amp;what=".getWhat()."&amp;access=".urlencode($file)."\">".$file."</a></li>");
+               } // END - foreach
+
+               // Finish list
+               OUTPUT_HTML('</ol>');
        } else {
                // logs directory does not exist
                LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_LOGS_DIR_404'), getConfig('logs_base')));
        }
 }
 
-//
+// [EOF]
 ?>
index 9cdac1d2a6aa64e1e4a722dff3662ba7e47bee51..cf3f96306623e929835a2c1d4507b65810decb8e 100644 (file)
@@ -46,10 +46,14 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 ADD_DESCR('admin', __FILE__);
 
 if (isFormSent()) {
-       $result = SQL_QUERY("SELECT userid, email
-FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND nl_receive='Y'
-ORDER BY userid ASC", __FILE__, __LINE__);
+       $result = SQL_QUERY("SELECT
+       `userid`, `email`
+FROM
+       `{!_MYSQL_PREFIX!}_user_data`
+WHERE
+       `status`='CONFIRMED' AND `nl_receive`='Y'
+ORDER BY
+       `userid` ASC", __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // Members are available so we can send out the newsletter!
                while ($content = SQL_FETCHARRAY($result)) {
@@ -59,20 +63,20 @@ ORDER BY userid ASC", __FILE__, __LINE__);
                        // Check for extension and sending-mode
                        if (!EXT_IS_ACTIVE('html_mail', true) && (REQUEST_POST('mode') == 'html')) {
                                // Set mode to text mode
-                               REQUEST_POST('mode') == "text";
+                               REQUEST_POST('mode') == 'text';
                        } elseif (REQUEST_POST('mode') == 'html') {
                                // Set HTML templates
-                               $template = "newsletter_html";
+                               $template = 'newsletter_html';
                        }
 
                        // Compile message
                        REQUEST_SET_POST('text', COMPILE_CODE(REQUEST_POST('text')));
 
                        // Load template
-                       $msg = LOAD_EMAIL_TEMPLATE($template, array('text' => REQUEST_POST('text')), $content['userid']);
+                       $message = LOAD_EMAIL_TEMPLATE($template, array('text' => REQUEST_POST('text')), $content['userid']);
 
                        // ... and send it away!
-                       SEND_NEWSLETTER($content['email'], REQUEST_POST('subject'), $msg, REQUEST_POST('mode'));
+                       SEND_NEWSLETTER($content['email'], REQUEST_POST('subject'), $message, REQUEST_POST('mode'));
                }
 
                // Free memory
@@ -87,10 +91,10 @@ ORDER BY userid ASC", __FILE__, __LINE__);
        define('_DATESTAMP', generateDateTime(time(), '3'));
        if (EXT_IS_ACTIVE('html_mail')) {
                // Load template with HTML mode
-               LOAD_TEMPLATE("admin_newsletter");
+               LOAD_TEMPLATE('admin_newsletter');
        } else {
                // Load template with only text mode
-               LOAD_TEMPLATE("admin_newsletter_nohtml");
+               LOAD_TEMPLATE('admin_newsletter_nohtml');
        }
 }
 
index d386f59b12e09d41663c4458f6233deffb0c5905..2aa5efa15429e47b96863f797c3a88397e79419b 100644 (file)
@@ -66,8 +66,8 @@ if (REQUEST_GET('uid') == "all") {
                        $content['points'] = bigintval(REQUEST_POST('points'));
 
                        // Load message and send it away
-                       $msg = LOAD_EMAIL_TEMPLATE("sub-points", $content, bigintval($content['userid']));
-                       sendEmail($content['email'], getMessage('ADMIN_SUB_SUBJ'), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE('sub-points', $content, bigintval($content['userid']));
+                       sendEmail($content['email'], getMessage('ADMIN_SUB_SUBJ'), $message);
                } // END - while
 
                // Free memory
@@ -96,8 +96,8 @@ if (REQUEST_GET('uid') == "all") {
                        $content['points'] = bigintval(REQUEST_POST('points'));
 
                        // Load email and send it away
-                       $msg = LOAD_EMAIL_TEMPLATE('sub-points', $content, bigintval(REQUEST_GET('uid')));
-                       sendEmail($content['email'], getMessage('ADMIN_SUB_SUBJ'), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE('sub-points', $content, bigintval(REQUEST_GET('uid')));
+                       sendEmail($content['email'], getMessage('ADMIN_SUB_SUBJ'), $message);
 
                        // Output message
                        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_POINTS_SUBTRACTED'));
index b5a13b47db55ef8498ac815690cdd63b11b64856..11061669b6bbf64584bb274e0e996ea3acfb5c0b 100644 (file)
@@ -101,29 +101,25 @@ $THEMES = array(
 );
 
 // Read directory "themes"
-$handle = opendir(constant('PATH') . 'theme/') or app_die(__FILE__, __LINE__, 'Cannot read themes dir!');
-while ($dir = readdir($handle)) {
-       // Construct absolute theme.php file name
-       $INC = sprintf("theme/%s/theme.php", $dir);
-
-       // Test it...
-       if ((!isDirectory($dir)) && (isIncludeReadable($INC))) {
-               // Found a valid directory so let's load it's theme.php file
-               loadInclude($INC);
-
-               // Add found theme to array
-               $THEMES['theme_unix'][]   = $dir;
-               $THEMES['theme_name'][]   = $GLOBALS['theme_data']['name'];
-               $THEMES['theme_author'][] = $GLOBALS['theme_data']['author'];
-               $THEMES['theme_email'][]  = $GLOBALS['theme_data']['email'];
-               $THEMES['theme_url'][]    = $GLOBALS['theme_data']['url'];
-               $THEMES['theme_ver'][]    = $GLOBALS['theme_data']['version'];
-       } // END - if
+$includes = getArrayFromDirectory('theme/', '', false, true, array('css', 'images'));
+
+// Walk through all entries and add it
+foreach ($includes as $INC) {
+       // Get directory from it
+       $dir = basename(dirname($INC));
+
+       // Load include file
+       loadInclude($INC);
+
+       // Add found theme to array
+       $THEMES['theme_unix'][]   = $dir;
+       $THEMES['theme_name'][]   = $GLOBALS['theme_data']['name'];
+       $THEMES['theme_author'][] = $GLOBALS['theme_data']['author'];
+       $THEMES['theme_email'][]  = $GLOBALS['theme_data']['email'];
+       $THEMES['theme_url'][]    = $GLOBALS['theme_data']['url'];
+       $THEMES['theme_ver'][]    = $GLOBALS['theme_data']['version'];
 } // END - while
 
-// Close directory
-closedir($handle);
-
 // Sort array by Uni* name
 array_pk_sort($THEMES, array('theme_name'));
 
index 18d6561cf1246ce25d39a608dce01611e7a42faf..676cc7c3c022c4472bbfdc2d2055cbd3fa4470e6 100644 (file)
@@ -65,7 +65,7 @@ if ((SQL_NUMROWS($result_main) > 0) || (REQUEST_ISSET_POST('lock'))) {
                } // END - if
        } // END - if
 
-       if (REQUEST_ISSET_POST(('accept'))) {
+       if (REQUEST_ISSET_POST('accept')) {
                if ($SEL > 0) {
                        // Accept mail orders
                        foreach (REQUEST_POST('sel') as $id => $value) {
@@ -73,11 +73,16 @@ if ((SQL_NUMROWS($result_main) > 0) || (REQUEST_ISSET_POST('lock'))) {
                                $id = bigintval($id);
 
                                // Order placed in queue...
-                               $result = SQL_QUERY_ESC("SELECT po.url, po.subject, po.sender, pay.payment, po.payment_id
-FROM `{!_MYSQL_PREFIX!}_pool` AS po
-INNER JOIN `{!_MYSQL_PREFIX!}_payments` AS pay
-ON po.payment_id=pay.id
-WHERE po.id=%s
+                               $result = SQL_QUERY_ESC("SELECT
+       po.url, po.subject, po.sender, pay.payment, po.payment_id
+FROM
+       `{!_MYSQL_PREFIX!}_pool` AS po
+INNER JOIN
+       `{!_MYSQL_PREFIX!}_payments` AS pay
+ON
+       po.payment_id=pay.id
+WHERE
+       po.id=%s
 LIMIT 1",
                                        array($id), __FILE__, __LINE__);
 
@@ -98,7 +103,7 @@ LIMIT 1",
                                        // Check for bonus extension version >= 0.4.4 for the order bonus
                                        if ((GET_EXT_VERSION('bonus') >= '0.4.4') && (getConfig('bonus_active') == 'Y')) {
                                                // Add points directly
-                                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET bonus_order=bonus_order+".getConfig('bonus_order')." WHERE userid=%s LIMIT 1",
+                                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `bonus_order`=`bonus_order`+".getConfig('bonus_order')." WHERE `userid`=%s LIMIT 1",
                                                        array(bigintval($DATA['sender'])), __FILE__, __LINE__);
 
                                                // Subtract bonus points from system
@@ -106,13 +111,13 @@ LIMIT 1",
                                        } // END - if
 
                                        // Load email template
-                                       $msg_user = LOAD_EMAIL_TEMPLATE('order-accept', array(), $DATA['sender']);
+                                       $message_user = LOAD_EMAIL_TEMPLATE('order-accept', array(), $DATA['sender']);
 
                                        // Send email
-                                       sendEmail($DATA['sender'], MEMBER_ORDER_ACCEPTED, $msg_user);
+                                       sendEmail($DATA['sender'], MEMBER_ORDER_ACCEPTED, $message_user);
 
                                        // Unlock selected email
-                                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='NEW' WHERE `id`=%s AND data_type='ADMIN' 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
                        } // END - foreach
@@ -135,7 +140,7 @@ LIMIT 1",
                                $id = bigintval($id);
 
                                // Load URL and subject from pool
-                               $result = SQL_QUERY_ESC("SELECT url, subject, sender FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
+                               $result = SQL_QUERY_ESC("SELECT `url`, `subject`, `sender` FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
                                        array($id), __FILE__, __LINE__);
 
                                // Load data
@@ -145,14 +150,14 @@ LIMIT 1",
                                SQL_FREERESULT($result);
 
                                // Load email template and send it away
-                               $msg_user = LOAD_EMAIL_TEMPLATE("order-reject", array(), $DATA['sender']);
-                               sendEmail($DATA['sender'], getMessage('MEMBER_ORDER_REJECTED'), $msg_user);
+                               $message_user = LOAD_EMAIL_TEMPLATE('order-reject', array(), $DATA['sender']);
+                               sendEmail($DATA['sender'], getMessage('MEMBER_ORDER_REJECTED'), $message_user);
 
                                // If you do not enter an URL to redirect to, your URL will be set!
                                if ((!REQUEST_ISSET_POST(('redirect'))) || (REQUEST_POST('redirect') == 'http://')) REQUEST_SET_POST('redirect', constant('URL'));
 
                                // Redirect URL
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET url='%s', data_type='NEW' WHERE `id`=%s LIMIT 1",
+                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET url='%s', `data_type`='NEW' WHERE `id`=%s LIMIT 1",
                                        array(REQUEST_POST('redirect'), $id),__FILE__, __LINE__);
 
                                // Prepare data for the row template
@@ -195,7 +200,7 @@ LIMIT 1",
 
                // Output message
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_URLS_BLOCKED'));
-       } elseif ((!REQUEST_ISSET_POST('lock')) && (!REQUEST_ISSET_POST(('accept'))) && (!REQUEST_ISSET_POST(('reject'))) && (getConfig('url_blacklist') == 'Y')) {
+       } elseif ((!REQUEST_ISSET_POST('lock')) && (!REQUEST_ISSET_POST('accept')) && (!REQUEST_ISSET_POST(('reject'))) && (getConfig('url_blacklist') == 'Y')) {
                // Mail orders are in pool so we can display them
                $OUT = ''; $SW = 2;
                while ($content = SQL_FETCHARRAY($result_main)) {
index e5588721f4513ca04bd16fc8820554f26a027546..16eecaa2bb8df1bb1136df794f2444a3566b133a 100644 (file)
@@ -158,8 +158,8 @@ WHERE `id`='%s' LIMIT 1",
                        $content['points']   = translateComma($content['points_amount']);
 
                        // So let's send the email away
-                       $msg = LOAD_EMAIL_TEMPLATE("sponsor_unlocked", $content);
-                       sendEmail($content['email'], getMessage('SPONSOR_UNLOCKED_SUBJ'), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE('sponsor_unlocked', $content);
+                       sendEmail($content['email'], getMessage('SPONSOR_UNLOCKED_SUBJ'), $message);
                }
        } else {
                // Nothing selected
index 7e8a56f70d0dde64014f9cbde2d1d62c20404342..01248348619f32fb40ee927b0ba5c24843ba79a8 100644 (file)
@@ -48,7 +48,7 @@ ADD_DESCR('admin', __FILE__);
 // Is a user id given?
 if ((REQUEST_ISSET_GET('uid')) && (bigintval(REQUEST_GET('uid')) > 0)) {
        // Load user data and display it
-       $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT `surname`, `family`, `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
                array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
 
        // Is a user account found?
@@ -65,12 +65,12 @@ if ((REQUEST_ISSET_GET('uid')) && (bigintval(REQUEST_GET('uid')) > 0)) {
                        $content['text'] = trim(strip_tags(REQUEST_POST('text')));
 
                        // Send contact form out
-                       $msg = LOAD_EMAIL_TEMPLATE("member_contct", $content);
-                       sendEmail($content['email'], getMessage('ADMIN_CONTACT_USER_SUBJECT'), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE('member_contct', $content);
+                       sendEmail($content['email'], getMessage('ADMIN_CONTACT_USER_SUBJECT'), $message);
                        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_USER_CONTACTED'));
                } else {
                        // Load contact form template
-                       LOAD_TEMPLATE("admin_contct_user_form", false, $content);
+                       LOAD_TEMPLATE('admin_contct_user_form', false, $content);
                }
        } else {
                // Not found?
index d790166aff675bbac38d62e49852a1c7e2ae57c1..5ba170c609cfbeae6af808404bda51b03797c228 100644 (file)
@@ -60,10 +60,10 @@ if (REQUEST_ISSET_GET('hash')) {
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='CONFIRMED', ref_payout=%s, user_hash=NULL WHERE user_hash='%s' AND `status`='UNCONFIRMED' LIMIT 1",
                array(getConfig('ref_payout'), REQUEST_GET('hash')), __FILE__, __LINE__);
                if (SQL_AFFECTEDROWS() == 1) {
-                       $msg = LOAD_EMAIL_TEMPLATE("confirm-member", array('points' => getConfig('points_register')), bigintval($uid));
+                       $message = LOAD_EMAIL_TEMPLATE("confirm-member", array('points' => getConfig('points_register')), bigintval($uid));
 
                        // And send him right away the confirmation mail
-                       sendEmail($email, getMessage('GUEST_THANX_CONFIRM'), $msg);
+                       sendEmail($email, getMessage('GUEST_THANX_CONFIRM'), $message);
 
                        // Maybe he got "referaled"?
                        if (($rid > 0) && ($rid != $uid)) {
@@ -113,18 +113,18 @@ if (REQUEST_ISSET_GET('hash')) {
                                setSession('lead_uid', bigintval($uid));
 
                                // Lead-Code mode enabled
-                               redirectToUrl("lead-confirm.php");
+                               redirectToUrl('lead-confirm.php');
                        } else {
                                define('__CONFIRM_MSG', getMessage('GUEST_CONFIRMED_DONE'));
                                define('__UID', bigintval($uid));
-                               LOAD_TEMPLATE("guest_confirm_table");
+                               LOAD_TEMPLATE('guest_confirm_table');
                        }
                } elseif (EXT_IS_ACTIVE('lead')) {
                        // Set special lead cookie
                        setSession('lead_uid', bigintval($uid));
 
                        // Lead-Code mode enabled
-                       redirectToUrl("lead-confirm.php");
+                       redirectToUrl('lead-confirm.php');
                } else {
                        // Nobody was found unter this hash key... or our new member want's to confirm twice?
                        define('__CONFIRM_MSG', getMessage('GUEST_CONFIRMED_TWICE'));
@@ -138,17 +138,16 @@ if (REQUEST_ISSET_GET('hash')) {
                LOAD_TEMPLATE('guest_confirm_table');
        }
 } elseif ((isFormSent()) && (REQUEST_ISSET_POST('email'))) {
-       // Confirmation link requested      0     1         2
-       $result = SQL_QUERY_ESC("SELECT userid, status, user_hash FROM `{!_MYSQL_PREFIX!}_user_data` WHERE email='%s' LIMIT 1",
+       // Confirmation link requested      0         1          2
+       $result = SQL_QUERY_ESC("SELECT `userid`, `status`, `user_hash` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `email`='%s' LIMIT 1",
                array(REQUEST_POST('email')), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Email address found
                $DATA = SQL_FETCHROW($result);
-               switch ($DATA[1])
-               {
+               switch ($DATA[1]) {
                        case 'UNCONFIRMED': // Account not confirmed
-                               $msg = LOAD_EMAIL_TEMPLATE("guest_request_confirm", array('hash' => $DATA[2]), $DATA[0]);
-                               sendEmail(REQUEST_POST('email'), getMessage('REQUEST_CONFIRM_LINK_SUBJ'), $msg);
+                               $message = LOAD_EMAIL_TEMPLATE('guest_request_confirm', array('hash' => $DATA[2]), $DATA[0]);
+                               sendEmail(REQUEST_POST('email'), getMessage('REQUEST_CONFIRM_LINK_SUBJ'), $message);
                                $content = getMessage('CONFIRM_LINK_SENT');
                                break;
 
@@ -159,17 +158,17 @@ if (REQUEST_ISSET_GET('hash')) {
                        case 'LOCKED': // Account is locked
                                $content = getMessage('LOGIN_ID_LOCKED');
                                break;
-               }
+               } // END - switch
        } else {
                // Email address not registered
                $content = getMessage('EMAIL_ADDY_404');
        }
 
        define('__CONFIRM_MSG', $content);
-       LOAD_TEMPLATE("guest_confirm_table");
+       LOAD_TEMPLATE('guest_confirm_table');
 } else {
        // No hash found, the guest may want to enter his email address to re-get his confirmation link?
-       LOAD_TEMPLATE("guest_confirm_link");
+       LOAD_TEMPLATE('guest_confirm_link');
 }
 
 //
index efdeb0878256c2196456c5fb05e33ef97033bd46..ab53bbc8ec63c6b735916bb08c97f28992430bab 100644 (file)
@@ -149,12 +149,12 @@ WHERE email='%s' AND (`status`='UNCONFIRMED' OR `status`='EMAIL') LIMIT 1",
                        // Prepare email and send it to the sponsor
                        if ($SPONSOR['status'] == 'UNCONFIRMED') {
                                // Unconfirmed accounts
-                               $msg_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_activate', $SPONSOR);
+                               $message_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_activate', $SPONSOR);
                        } else {
                                // Confirmed email address
-                               $msg_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_email', $SPONSOR);
+                               $message_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_email', $SPONSOR);
                        }
-                       sendEmail(REQUEST_POST('email'), getMessage('SPONSOR_ACTIVATION_LINK_SUBJ'), $msg_sponsor);
+                       sendEmail(REQUEST_POST('email'), getMessage('SPONSOR_ACTIVATION_LINK_SUBJ'), $message_sponsor);
 
                        // Output message
                        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SPONSOR_ACTIVATION_LINK_SENT'));
@@ -178,31 +178,31 @@ WHERE email='%s' AND (`status`='UNCONFIRMED' OR `status`='EMAIL') LIMIT 1",
 
        if (isFormSent()) {
                // Check email
-               $result = SQL_QUERY_ESC("SELECT id, hash, remote_addr, gender, surname, family, sponsor_created
+               $result = SQL_QUERY_ESC("SELECT `id`, `hash`, `remote_addr`, `gender`, `surname`, `family`, `sponsor_created`
 FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE email='%s' AND id='%s' AND `status`='CONFIRMED' LIMIT 1",
+WHERE `email`='%s' AND `id`='%s' AND `status`='CONFIRMED' LIMIT 1",
                array(REQUEST_POST('email'), bigintval(REQUEST_POST('id'))), __FILE__, __LINE__);
 
                // Entry found?
                if (SQL_NUMROWS($result) == 1) {
                        // Unconfirmed sponsor account found so let's load the requested data
-                       $SPONSOR = SQL_FETCHARRAY($result);
+                       $DATA = SQL_FETCHARRAY($result);
 
                        // Translate some data
-                       $SPONSOR['gender']           = translateGender($SPONSOR['gender']);
-                       $SPONSOR['sponsor_created'] = generateDateTime($SPONSOR['sponsor_created']);
+                       $DATA['gender']           = translateGender($DATA['gender']);
+                       $DATA['sponsor_created'] = generateDateTime($DATA['sponsor_created']);
 
                        // Generate password
-                       $SPONSOR['password']        = generatePassword();
+                       $DATA['password']        = generatePassword();
 
                        // Prepare email and send it to the sponsor
-                       $msg_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_lost', $SPONSOR);
-                       sendEmail(REQUEST_POST('email'), getMessage('SPONSOR_LOST_PASSWORD_SUBJ'), $msg_sponsor);
+                       $message_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_lost', $DATA);
+                       sendEmail(REQUEST_POST('email'), getMessage('SPONSOR_LOST_PASSWORD_SUBJ'), $message_sponsor);
 
                        // Update password
-                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET password='%s'
+                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `password`='%s'
 WHERE `id`='%s' LIMIT 1",
-                       array(md5($SPONSOR['password']), bigintval($SPONSOR['id'])), __FILE__, __LINE__);
+                               array(md5($DATA['password']), bigintval($DATA['id'])), __FILE__, __LINE__);
 
                        // Output message
                        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SPONSOR_LOST_PASSWORD_SENT'));
index 06c4ffb97b7eef26451804c53eada28a86c7020b..e703758342811ceb64eba13e204561b11302b16f 100644 (file)
@@ -42,7 +42,7 @@ if (!defined('__SECURITY')) {
        require($INC);
 } elseif (!IS_MEMBER()) {
        $URL = 'modules.php?module=index';
-       if (checkModulePermissions('login') == 'mem_only') $URL .= '&amp;msg='.getCode('MODULE_MEM_ONLY') . '&amp;mod='.getModule();
+       if (checkModulePermissions('login') == 'mem_only') $URL .= '&amp;msg=' . getCode('MODULE_MEM_ONLY') . '&amp;mod=' . getModule();
        redirectToUrl($URL);
 }
 
index d7f8b2bb7cafb28924482b1ef33a63383c42adb8..761577cad27e19b846b9882f137e4bb76933b73a 100644 (file)
@@ -118,15 +118,14 @@ WHERE userid=%s LIMIT 1",
                define('_END_YEAR'   , REQUEST_POST('end_year'));
 
                // Send mail to member
-               $msg = LOAD_EMAIL_TEMPLATE('member_holiday_request', REQUEST_POST('comments'), getUserId());
-               sendEmail(getUserId(), getMessage('HOLIDAY_MEMBER_SUBJECT'), $msg);
+               $message = LOAD_EMAIL_TEMPLATE('member_holiday_request', REQUEST_POST('comments'), getUserId());
+               sendEmail(getUserId(), getMessage('HOLIDAY_MEMBER_SUBJECT'), $message);
 
                // Send mail to all admins
                sendAdminNotification(getMessage('HOLIDAY_ADMIN_SUBJECT'), 'admin_holiday_request', REQUEST_POST('comments'), getUserId());
 
                // Create task
-               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (userid, assigned_admin, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','HOLIDAY_REQUEST','{--HOLIDAY_ADMIN_SUBJECT--}','%s', UNIX_TIMESTAMP())",
-               array(getUserId(), $msg), __FILE__, __LINE__);
+               createNewTask('{--HOLIDAY_ADMIN_SUBJECT--}', $message, 'HOLIDAY_REQUEST', getUserId());
 
                // Display message
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('HOLIDAY_IS_ACTIVATED_NOW'));
@@ -136,15 +135,15 @@ WHERE userid=%s LIMIT 1",
 // 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__);
+       $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);
        SQL_FREERESULT($result);
 
        if (($active == 'Y') && (($locked + 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);
index 7323139365042c0f846b426cd5a45c97eab6402e..2a90cfa4bdf7d68d53a4fc1e6124c011799b7596 100644 (file)
@@ -175,7 +175,7 @@ FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
                                $OUT  = "<select name=\"country_code\" class=\"member_select\" size=\"1\">\n";
                                $whereStatement = "WHERE `is_active`='Y'";
                                if (IS_ADMIN()) $whereStatement = '';
-                               $OUT .= generateOptionList("countries", 'id', "descr", $DATA[3], "code", $whereStatement);
+                               $OUT .= generateOptionList('countries', 'id', 'descr', $DATA[3], 'code', $whereStatement);
                                $OUT .= "</select>";
                                define('__COUNTRY_CONTENT', $OUT);
                        } else {
@@ -257,17 +257,21 @@ WHERE `userid`=%s AND `password`='%s' LIMIT 1",
                                                ), __FILE__, __LINE__);
                                } else {
                                        // Old way
-                                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET
-`gender`='%s', `surname`='%s', `family`='%s',
-`street_nr`='%s',
-`country`='%s', `zip`=%s, `city`='%s',
-`email`='%s',
-`birth_day`=%s, `birth_month`=%s, `birth_year`=%s,
-`max_mails`='%s',
-`last_update`=UNIX_TIMESTAMP()".$AND.",
-`notified`='N',
-`last_profile_sent`=UNIX_TIMESTAMP()
-WHERE `userid`=%s AND `password`='%s' LIMIT 1",
+                                       SQL_QUERY_ESC("UPDATE
+       `{!_MYSQL_PREFIX!}_user_data`
+SET
+       `gender`='%s', `surname`='%s', `family`='%s',
+       `street_nr`='%s',
+       `country`='%s', `zip`=%s, `city`='%s',
+       `email`='%s',
+       `birth_day`=%s, `birth_month`=%s, `birth_year`=%s,
+       `max_mails`='%s',
+       `last_update`=UNIX_TIMESTAMP()".$AND.",
+       `notified`='N',
+       `last_profile_sent`=UNIX_TIMESTAMP()
+WHERE
+       `userid`=%s AND `password`='%s'
+LIMIT 1",
                                                array(
                                                        REQUEST_POST('gender'),
                                                        REQUEST_POST('surname'),
index 1e815de44523942417d3a495bdd3029dc5dda0c0..2d83f42f3a5785e50cbcfe8c23a7526b528fee76 100644 (file)
@@ -65,18 +65,17 @@ if ((isFormSent()) && ($status == 'Y') && ($span == '0')) {
        array(getUserId()), __FILE__, __LINE__);
 
        // Load admin message
-       $admin_msg = LOAD_EMAIL_TEMPLATE("admin_newsletter_request", array(), getUserId());
+       $admin_msg = LOAD_EMAIL_TEMPLATE('admin_newsletter_request', array(), getUserId());
 
        // Add task
-       SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (assigned_admin, status, task_type, subject, text, task_created, userid)
-VALUES ('0','NEW','NL_UNSUBSCRIBE','{--ADMIN_NL_SUBJECT--}','".$admin_msg."', UNIX_TIMESTAMP(),'%s')", array(getUserId()), __FILE__, __LINE__);
+       createNewTask('{--ADMIN_NL_SUBJECT--}', $admin_msg, 'NL_UNSUBSCRIBE', getUserId());
 
        // Send mail to member
-       $msg = LOAD_EMAIL_TEMPLATE("member_newsletter_request", array(), getUserId());
-       sendEmail(getUserId(), getMessage('NL_MEMBER_SUBJECT'), $msg);
+       $message = LOAD_EMAIL_TEMPLATE('member_newsletter_request', array(), getUserId());
+       sendEmail(getUserId(), getMessage('NL_MEMBER_SUBJECT'), $message);
 
        // Send mail to all admins
-       sendAdminNotification(getMessage('NL_ADMIN_SUBJECT'), "admin_newsletter_request", array(), getUserId());
+       sendAdminNotification(getMessage('NL_ADMIN_SUBJECT'), 'admin_newsletter_request', array(), getUserId());
 
        // Display message
        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('NL_MEMBER_REQUEST_DONE'));
@@ -85,11 +84,10 @@ VALUES ('0','NEW','NL_UNSUBSCRIBE','{--ADMIN_NL_SUBJECT--}','".$admin_msg."', UN
        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('NL_MEMBER_REQUEST_ALREADY'));
 } else {
        // Load template for the note
-       define('NL_MEMBER_NOTE', LOAD_TEMPLATE("member_newsletter_note", true));
+       define('NL_MEMBER_NOTE', LOAD_TEMPLATE('member_newsletter_note', true));
 
        // Set status message and submit button
-       switch ($status)
-       {
+       switch ($status) {
                case 'Y': // Receives the newsletter
                        define('__STATUS_VALUE', getMessage('NL_MEMBER_ON'));
                        define('__UNTIL_VALUE' , '');
@@ -101,12 +99,12 @@ VALUES ('0','NEW','NL_UNSUBSCRIBE','{--ADMIN_NL_SUBJECT--}','".$admin_msg."', UN
                        define('__UNTIL_VALUE' , generateDateTime($until, '2'));
                        define('NL_SUBMIT'     , getMessage('NL_MEMBER_SUBMIT_ON'));
                        break;
-       }
+       } // END - switch
 
        // Load template and member settings
-       LOAD_TEMPLATE("member_newsletter");
+       LOAD_TEMPLATE('member_newsletter');
 }
 
-//
+// [EOF]
 ?>
 
index e9bf25cbf547d416e1d2493b472b1663915c16b4..18a3b449e9c2308b99027d6edbbfc080b8d573d6 100644 (file)
@@ -208,11 +208,11 @@ VALUES (%s,%s,%s, UNIX_TIMESTAMP(), 'NEW','%s','%s','%s')",
                                        ), __FILE__, __LINE__);
 
                                        // Load templates
-                                       $msg_mem = LOAD_EMAIL_TEMPLATE('member_payout_request_banner', REQUEST_POST_ARRAY(), getUserId());
+                                       $message_mem = LOAD_EMAIL_TEMPLATE('member_payout_request_banner', REQUEST_POST_ARRAY(), getUserId());
                                        if (GET_EXT_VERSION('admins') >= '0.4.1') {
                                                $adm_tpl = 'admin_payout_request_banner';
                                        } else {
-                                               $msg_adm = LOAD_EMAIL_TEMPLATE('admin_payout_request_banner', REQUEST_POST_ARRAY(), getUserId());
+                                               $message_adm = LOAD_EMAIL_TEMPLATE('admin_payout_request_banner', REQUEST_POST_ARRAY(), getUserId());
                                        }
                                } else {
                                        // e-currency payout requested
@@ -228,8 +228,8 @@ VALUES (%s,%s,%s,'%s',%s, UNIX_TIMESTAMP(), 'NEW','%s')",
                                        ), __FILE__, __LINE__);
 
                                        // Load templates
-                                       $msg_mem = LOAD_EMAIL_TEMPLATE('member_payout_request', REQUEST_POST_ARRAY(), getUserId());
-                                       $msg_adm = LOAD_EMAIL_TEMPLATE('admin_payout_request', REQUEST_POST_ARRAY(), getUserId());
+                                       $message_mem = LOAD_EMAIL_TEMPLATE('member_payout_request', REQUEST_POST_ARRAY(), getUserId());
+                                       $message_adm = LOAD_EMAIL_TEMPLATE('admin_payout_request', REQUEST_POST_ARRAY(), getUserId());
                                        $admin_tpl = '';
 
                                        // @TODO Rewrite this to a filter
@@ -239,15 +239,10 @@ VALUES (%s,%s,%s,'%s',%s, UNIX_TIMESTAMP(), 'NEW','%s')",
                                }
 
                                // Generate task
-                               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (assigned_admin, status, task_type, subject, text, task_created, userid)
-VALUES (0, 'NEW','PAYOUT_REQUEST','[payout:] {--PAYOUT_REQUEST_ADMIN--}','%s', UNIX_TIMESTAMP(), %s)",
-                               array(
-                                       $msg_adm,
-                                       getUserId()
-                               ), __FILE__, __LINE__);
+                               createNewTask('[payout:] {--PAYOUT_REQUEST_ADMIN--}', $message_adm, 'PAYOUT_REQUEST', getUserId());
 
                                // Send out mails
-                               sendEmail(getUserId(), getMessage('PAYOUT_REQUEST_MEMBER'), $msg_mem);
+                               sendEmail(getUserId(), getMessage('PAYOUT_REQUEST_MEMBER'), $message_mem);
 
                                // To admin(s)
                                sendAdminNotification(getMessage('PAYOUT_REQUEST_ADMIN'), $admin_tpl, REQUEST_POST_ARRAY(), getUserId());
index 592fb1b3c0b712042d319319408810dbeb98c7b0..1d2a0c4507a9492948af4ad86f056d9d9ceb30bc 100644 (file)
@@ -52,29 +52,29 @@ ADD_DESCR('member', __FILE__);
 
 if ((!isFormSent()) || (!REQUEST_ISSET_POST(('qsummary')))) {
        // Output form
-       LOAD_TEMPLATE("member_support_form");
+       LOAD_TEMPLATE('member_support_form');
 } else {
        // Load mail template based on your member's decision
        if (GET_EXT_VERSION('admins') >= '0.4.1') {
-               $a_tpl = "admin_support-".REQUEST_POST('qsummary');
+               $a_tpl = 'admin_support-' . REQUEST_POST('qsummary');
        } else {
-               $msg_a = LOAD_EMAIL_TEMPLATE("admin_support-".REQUEST_POST('qsummary'), array('text' => REQUEST_POST('qdetails')), getUserId());
+               $message_a = LOAD_EMAIL_TEMPLATE('admin_support-' . REQUEST_POST('qsummary'), array('text' => REQUEST_POST('qdetails')), getUserId());
        }
-       $msg_m = LOAD_EMAIL_TEMPLATE("member_support-".REQUEST_POST('qsummary'), array('text' => REQUEST_POST('qdetails')), getUserId());
+       $message_m = LOAD_EMAIL_TEMPLATE('member_support-' . REQUEST_POST('qsummary'), array('text' => REQUEST_POST('qdetails')), getUserId());
 
        // Select right subject
        switch (REQUEST_POST('qsummary')) {
-               case "ordr":
+               case 'ordr':
                        $subj_a = getMessage('SUPPORT_SUBJ_ADMIN_ORDER');
                        $subj_m = getMessage('SUPPORT_SUBJ_MEMBER_ORDER');
                        break;
 
-               case "reflink":
+               case 'reflink':
                        $subj_a = getMessage('SUPPORT_SUBJ_ADMIN_REFLINK');
                        $subj_m = getMessage('SUPPORT_SUBJ_MEMBER_REFLINK');
                        break;
 
-               case "unconfirmed":
+               case 'unconfirmed':
                        $subj_a = getMessage('SUPPORT_SUBJ_ADMIN_UNCONFIRMED');
                        $subj_m = getMessage('SUPPORT_SUBJ_MEMBER_UNCONFIRMED');
                        break;
@@ -84,14 +84,14 @@ if ((!isFormSent()) || (!REQUEST_ISSET_POST(('qsummary')))) {
        sendAdminNotification($subj_a, $a_tpl, array('text' => REQUEST_POST('qdetails')), getUserId());
 
        // Send mail to user
-       sendEmail(getUserId(), $subj_m, $msg_m);
+       sendEmail(getUserId(), $subj_m, $message_m);
 
        // Drop a message in the admin's area
-       SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (userid, assigned_admin, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','SUPPORT_MEMBER','%s','%s', UNIX_TIMESTAMP())",
-       array(getUserId(), $subj_a, REQUEST_POST('qsummary') . ':'.array('text' => REQUEST_POST('qdetails'))), __FILE__, __LINE__);
+       createNewTask($subj_a, REQUEST_POST('qsummary') . ' : ' . REQUEST_POST('qdetails'), 'SUPPORT_MEMBER', getUserId());
 
        // Form sent
-       LOAD_TEMPLATE("member_support_contcted");
+       LOAD_TEMPLATE('member_support_contcted');
 }
-//
+
+// [EOF]
 ?>
index f98b2844e1930a4d29c58ac420072a0238d5ba1c..3b11b1a449c389ba85e0fd8d46b4fd6235c57643 100644 (file)
@@ -66,16 +66,16 @@ if (!SURFBAR_IF_USER_BOOK_MORE_URLS()) {
        $insertId = SURFBAR_MEMBER_ADD_URL(REQUEST_POST('url'), REQUEST_POST('limit'));
 
        // By default something went wrong
-       $msg = getMessage('MEMBER_SURFBAR_URL_NOT_ADDED');
+       $message = getMessage('MEMBER_SURFBAR_URL_NOT_ADDED');
 
        // Was this fine?
        if ($insertId > 0) {
                // URL added and waiting for unlock
-               $msg = getMessage('MEMBER_SURFBAR_URL_ADDED');
+               $message = getMessage('MEMBER_SURFBAR_URL_ADDED');
        } // END - if
 
        // Load message template
-       LOAD_TEMPLATE('admin_settings_saved', false, $msg);
+       LOAD_TEMPLATE('admin_settings_saved', false, $message);
 } else {
        // Prepare some content
        $content = array(
index 1c52abe930cdc2f4ac5c313e7148baaaca7baa35..e485499aa361b7f0bb374b7b695fdeb7976d8938 100644 (file)
@@ -76,17 +76,20 @@ $THEMES = array(
 );
 
 // Read directory "themes"
-$handle = opendir(constant('PATH')."theme/") or app_die(__FILE__, __LINE__, "Cannot read themes dir!");
-while ($entry = readdir($handle)) {
-       // Construct absolute theme.php file name
-       $INC = sprintf("theme/%s/theme.php", $entry);
+$includes = getArrayFromDirectory('theme/', '', false, true, array('css', 'images'));
 
-       if ((!isDirectory($entry)) && (isIncludeReadable($INC)) && (isThemeActive($entry))) {
+// Walk through all entries and add it
+foreach ($includes as $INC) {
+       // Get directory from it
+       $dir = basename(dirname($INC));
+
+       // Is the theme active, then include it
+       if (isThemeActive($dir)) {
                // Found a valid directory so let's load it's theme.php file
                loadInclude($INC);
 
                // Add found theme to array
-               $THEMES['theme_unix'][]   = $entry;
+               $THEMES['theme_unix'][]   = $dir;
                $THEMES['theme_name'][]   = $GLOBALS['theme_data']['name'];
                $THEMES['theme_author'][] = $GLOBALS['theme_data']['author'];
                $THEMES['theme_email'][]  = $GLOBALS['theme_data']['email'];
@@ -98,11 +101,8 @@ while ($entry = readdir($handle)) {
 // Remove last theme data
 unset($GLOBALS['theme_data']);
 
-// Close directory
-closedir($handle);
-
 // Sort array by Uni* name
-array_pk_sort($THEMES, array("theme_name"));
+array_pk_sort($THEMES, array('theme_name'));
 
 // Generate output lines for the template
 $OUT = ''; $SW = 2;
index 0b41f308022bb17f116825c2c83ea1f128c08285..4ca56fe99664c6ef8488d810d0c9729ddedf9a1a 100644 (file)
@@ -187,12 +187,12 @@ switch ($mode) {
                                SUB_POINTS('transfer', getUserId(), REQUEST_POST('points'));
 
                                // First send email to recipient
-                               $msg = LOAD_EMAIL_TEMPLATE('member_transfer_recipient', '', constant('__RECIPIENT_UID'));
-                               sendEmail(constant('__RECIPIENT_EMAIL'), getMessage('TRANSFER_MEMBER_RECIPIENT_SUBJ') . ': ' . $SENDER, $msg);
+                               $message = LOAD_EMAIL_TEMPLATE('member_transfer_recipient', '', constant('__RECIPIENT_UID'));
+                               sendEmail(constant('__RECIPIENT_EMAIL'), getMessage('TRANSFER_MEMBER_RECIPIENT_SUBJ') . ': ' . $SENDER, $message);
 
                                // Second send email to sender
-                               $msg = LOAD_EMAIL_TEMPLATE('member_transfer_sender', '', constant('__SENDER_UID'));
-                               sendEmail(constant('__SENDER_EMAIL'), getMessage('TRANSFER_MEMBER_SENDER_SUBJ') . ': ' . $RECIPIENT, $msg);
+                               $message = LOAD_EMAIL_TEMPLATE('member_transfer_sender', '', constant('__SENDER_UID'));
+                               sendEmail(constant('__SENDER_EMAIL'), getMessage('TRANSFER_MEMBER_SENDER_SUBJ') . ': ' . $RECIPIENT, $message);
 
                                // At last send admin mail(s)
                                $ADMIN_SUBJ = sprintf("%s (%s->%s)", getMessage('TRANSFER_ADMIN_SUBJECT'), $SENDER, $RECIPIENT);
@@ -377,13 +377,13 @@ switch ($mode) {
                //
                // First of all create the temporary table
                $result = SQL_QUERY("CREATE TEMPORARY TABLE `{!_MYSQL_PREFIX!}_transfers_tmp` (
-trans_id VARCHAR(12) NOT NULL DEFAULT '',
-party_uid BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
-points BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
-reason VARCHAR(255) NOT NULL DEFAULT '',
-time_trans VARCHAR(10) NOT NULL DEFAULT '0',
-trans_type ENUM('IN','OUT') NOT NULL DEFAULT 'IN',
-KEY(party_uid)
+`trans_id` VARCHAR(12) NOT NULL DEFAULT '',
+`party_uid` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
+`points` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
+`reason` VARCHAR(255) NOT NULL DEFAULT '',
+`time_trans` VARCHAR(10) NOT NULL DEFAULT '0',
+`trans_type` ENUM('IN','OUT') NOT NULL DEFAULT 'IN',
+KEY(`party_uid`)
 ) TYPE=HEAP", __FILE__, __LINE__);
 
                // Let's begin with the incoming list
@@ -393,7 +393,7 @@ KEY(party_uid)
                        $DATA[] = 'IN';
                        $DATA = implode("','", $DATA);
                        $res_temp = SQL_QUERY("INSERT INTO `{!_MYSQL_PREFIX!}_transfers_tmp` (`trans_id`, `party_uid`, `points`, `reason`, `time_trans`, `trans_type`) VALUES ('".$DATA."')", __FILE__, __LINE__);
-               }
+               } // END - while
 
                // Free memory
                SQL_FREERESULT($result);
index 2f5219392d82069e1f9a175289b65285d3a71d15..5dcc041bdedd028d3198b42a855a52d542630e1f 100644 (file)
@@ -95,8 +95,8 @@ if (empty($URL)) {
                $content['category'] = getCategory($content['cat_id']);
 
                // Send an email to the user
-               $msg_mem = LOAD_EMAIL_TEMPLATE('order-member', $content, getUserId());
-               sendEmail(getUserId(), getMessage('MEMBER_NEW_QUEUE'), $msg_mem);
+               $message_mem = LOAD_EMAIL_TEMPLATE('order-member', $content, getUserId());
+               sendEmail(getUserId(), getMessage('MEMBER_NEW_QUEUE'), $message_mem);
 
                // Notify admins about this
                sendAdminNotification(getMessage('ADMIN_NEW_QUEUE'), 'order-admin', $content, getUserId());
index 2dd0f14d075d4da06c94c06be8db32fdae7b16e3..3d5396e36c804b6ca6cd993f3edee6d1af911ad3 100644 (file)
@@ -93,8 +93,8 @@ LIMIT %s",
                        $content['points'] = translateComma($content['points']);
 
                        // Load email template and email it away
-                       $msg = LOAD_EMAIL_TEMPLATE('member_beg', $content, bigintval($content['userid']));
-                       sendEmail($content['email'], getMessage('BEG_MONTHLY_RALLYE'), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE('member_beg', $content, bigintval($content['userid']));
+                       sendEmail($content['email'], getMessage('BEG_MONTHLY_RALLYE'), $message);
                } // END - while
 
                // Reset accounts
index 06ea9acb00de05ef4664f3b0253364ee0b7e4eba..d18b95c6cd7502f437945d6d7bc4b663d7809dd7 100644 (file)
@@ -105,8 +105,8 @@ LIMIT %s",
                                $content['points'] = translateComma($content['points']);
 
                                // Load email template and email it away
-                               $msg = LOAD_EMAIL_TEMPLATE("member_bonus", $content['points'], bigintval($content['uid']));
-                               sendEmail($content['email'], getMessage('BONUS_MONTHLY_ONLINE_BONUS'), $msg);
+                               $message = LOAD_EMAIL_TEMPLATE('member_bonus', $content['points'], bigintval($content['uid']));
+                               sendEmail($content['email'], getMessage('BONUS_MONTHLY_ONLINE_BONUS'), $message);
                        } // END - if
                } // END - while
 
index 6f734eb2d9412e09c1e3ea1d5773975a4c7deacb..c1108be6af88c35bc6a840ec905268e03e5a090c 100644 (file)
@@ -59,11 +59,11 @@ if (getConfig('last_month') != $curr) {
                while ($content = SQL_FETCHARRAY($result)) {
                        // Update account
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `nl_receive`='Y', `nl_until`=0 WHERE `userid`=%s LIMIT 1",
-                       array(bigintval($content['userid'])), __FILE__, __LINE__);
+                               array(bigintval($content['userid'])), __FILE__, __LINE__);
 
                        // Send email to him
-                       $msg = LOAD_EMAIL_TEMPLATE("member_newsletter_reset", true, bigintval($content['userid']));
-                       sendEmail($content['email'], getMessage('NL_MEMBER_RESET_SUBJECT'), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE("member_newsletter_reset", true, bigintval($content['userid']));
+                       sendEmail($content['email'], getMessage('NL_MEMBER_RESET_SUBJECT'), $message);
 
                        // Send email to admin
                        sendAdminNotification(getMessage('NL_ADMIN_SUBJECT'), "admin_newsletter_reset", array(), getUserId());
index 9e26bddaad8750409e35be027a61977e2533c613..a31a7879a771721428e0be637e964fa6a8854d27 100644 (file)
@@ -160,9 +160,15 @@ if ((!isInstalling()) && (isInstalled())) {
                                // Update sending pool
                                if ((getOutputMode() != '1') && (getOutputMode() != '-1')) loadIncludeOnce('inc/pool-update.php'); // Sends out mails in configureable steps
 
-                               // Load all active extension including language files when not upgrading.
-                               // Check module for testing and count one click
-                               if (checkModulePermissions(getModule()) == 'done') countModuleHit(getModule());
+                               // Check module for permissions
+                               $checkModule = checkModulePermissions(getModule());
+                               if ($checkModule != 'done') {
+                                       // Not fine!
+                                       DEBUG_LOG(__FILE__, __LINE__, sprintf("Check of module %s results in unpexted value: %s",
+                                               getModule(),
+                                               $checkModule
+                                       ));
+                               } // END - if
 
                                // Shall we activate the exchange?
                                if (getConfig('activate_xchange') > 0) activateExchange();
index 39238bf8d5c97eef289f92c28345e7b8565494dd..76f6957921e860d40daed4920ea22c33a96a99ea 100644 (file)
@@ -112,7 +112,7 @@ function getModuleDescription ($mode, $wht, $column = 'what') {
 // Check validity of a given module name (no file extension)
 function checkModulePermissions ($mod) {
        // Filter module name (names with low chars and underlines are fine!)
-       $mod = preg_replace("/[^a-z_]/", '', $mod);
+       $mod = preg_replace('/[^a-z_]/', '', $mod);
 
        // Check for prefix is a extension...
        $modSplit = explode("_", $mod);
@@ -194,6 +194,9 @@ function checkModulePermissions ($mod) {
                //
                //  Admin access            ----- Guest access -----           --- Guest   or   member? ---
                if ((IS_ADMIN()) || (($locked == 'N') && ($admin == 'N') && (($mem == 'N') || (IS_MEMBER())))) {
+                       // Count module
+                       countModuleHit($mod_chk);
+
                        // If you are admin you are welcome for everything!
                        $ret = 'done';
                } elseif ($locked == 'Y') {
@@ -413,7 +416,7 @@ function ADD_MENU ($mode, $act, $wht) {
        } // END - if
 
        // Load SQL data and add the menu to the output stream...
-       $result_main = SQL_QUERY_ESC("SELECT `title`, `action` FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE (`what`='' OR `what` IS NULL)".$AND." ORDER BY `sort`",
+       $result_main = SQL_QUERY_ESC("SELECT `title`, `action` FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE (`what`='' OR `what` IS NULL)".$AND." ORDER BY `sort` ASC",
                array($mode), __FUNCTION__, __LINE__);
        //* DEBUG: */ echo __LINE__.'/'.$main_cnt.'/'.$main_action.'/'.$sub_what.':'.getWhat()."*<br />\n";
        if (SQL_NUMROWS($result_main) > 0) {
@@ -486,9 +489,9 @@ function ADD_MENU ($mode, $act, $wht) {
 
                                        // Add regular menu row or bottom row?
                                        if ($cnt < $ctl) {
-                                               LOAD_TEMPLATE($mode."_menu_row", false, $content);
+                                               LOAD_TEMPLATE($mode . '_menu_row', false, $content);
                                        } else {
-                                               LOAD_TEMPLATE($mode."_menu_bottom", false, $content);
+                                               LOAD_TEMPLATE($mode . '_menu_bottom', false, $content);
                                        }
                                }
                        } else {
@@ -523,7 +526,7 @@ function ADD_MENU ($mode, $act, $wht) {
                // Close table
                //* DEBUG: */ echo __LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*<br />\n";
                OUTPUT_HTML("</table>");
-       }
+       } // END - if
 }
 
 // Checks wether the current user is a member
@@ -550,7 +553,7 @@ function IS_MEMBER () {
        // Are cookies set?
        if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
                // Cookies are set with values, but are they valid?
-               $result = SQL_QUERY_ESC("SELECT password, status, last_module, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+               $result = SQL_QUERY_ESC("SELECT `password`, `status`, `last_module`, `last_online` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
                        array(getUserId()), __FUNCTION__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Load data from cookies
@@ -748,15 +751,15 @@ function isMenuActionValid ($mode, $act, $wht, $UPDATE=false) {
        if (($mode != 'admin') && ($UPDATE === true)) {
                // Update guest or member menu
                $sql = SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_%s_menu` SET counter=counter+1 WHERE `action`='%s' AND `what`='%s'".$add." LIMIT 1",
-               array($mode, $act, $wht), __FUNCTION__, __LINE__, false);
+                       array($mode, $act, $wht), __FUNCTION__, __LINE__, false);
        } elseif (($wht != 'overview') && (!empty($wht))) {
                // Other actions
-               $sql = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND `what`='%s'".$add." ORDER BY action DESC LIMIT 1",
-               array($mode, $act, $wht), __FUNCTION__, __LINE__, false);
+               $sql = SQL_QUERY_ESC("SELECT `id`, `what` FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND `what`='%s'".$add." ORDER BY `action` DESC LIMIT 1",
+                       array($mode, $act, $wht), __FUNCTION__, __LINE__, false);
        } else {
                // Admin login overview
-               $sql = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND (`what`='' OR `what` IS NULL)".$add." ORDER BY action DESC LIMIT 1",
-               array($mode, $act), __FUNCTION__, __LINE__, false);
+               $sql = SQL_QUERY_ESC("SELECT `id`, `what` FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND (`what`='' OR `what` IS NULL)".$add." ORDER BY `action` DESC LIMIT 1",
+                       array($mode, $act), __FUNCTION__, __LINE__, false);
        }
 
        // Run SQL command
@@ -784,8 +787,8 @@ function sendModeMails ($mod, $modes) {
        global $DATA;
 
        // Load hash
-       $result_main = SQL_QUERY_ESC("SELECT password FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
-       array(getUserId()), __FUNCTION__, __LINE__);
+       $result_main = SQL_QUERY_ESC("SELECT `password` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
+               array(getUserId()), __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result_main) == 1) {
                // Load hash from database
                list($hashDB) = SQL_FETCHROW($result_main);
@@ -845,15 +848,15 @@ function sendModeMails ($mod, $modes) {
                                                $content = merge_array($content, REQUEST_POST_ARRAY());
 
                                                // Load template
-                                               $msg = LOAD_EMAIL_TEMPLATE('member_mydata_notify', $content, getUserId());
+                                               $message = LOAD_EMAIL_TEMPLATE('member_mydata_notify', $content, getUserId());
 
                                                if (getConfig('admin_notify') == 'Y') {
                                                        // The admin needs to be notified about a profile change
-                                                       $msg_admin = 'admin_mydata_notify';
+                                                       $message_admin = 'admin_mydata_notify';
                                                        $sub_adm   = getMessage('ADMIN_CHANGED_DATA');
                                                } else {
                                                        // No mail to admin
-                                                       $msg_admin = '';
+                                                       $message_admin = '';
                                                        $sub_adm   = '';
                                                }
 
@@ -883,16 +886,16 @@ function sendModeMails ($mod, $modes) {
        }
 
        // Send email to user if required
-       if ((!empty($sub_mem)) && (!empty($msg))) {
+       if ((!empty($sub_mem)) && (!empty($message))) {
                // Send member mail
-               sendEmail($DATA[7], $sub_mem, $msg);
+               sendEmail($DATA[7], $sub_mem, $message);
        } // END - if
 
        // Send only if no other error has occured
        if (empty($content)) {
-               if ((!empty($sub_adm)) && (!empty($msg_admin))) {
+               if ((!empty($sub_adm)) && (!empty($message_admin))) {
                        // Send admin mail
-                       sendAdminNotification($sub_adm, $msg_admin, $content, getUserId());
+                       sendAdminNotification($sub_adm, $message_admin, $content, getUserId());
                } elseif (getConfig('admin_notify') == 'Y') {
                        // Cannot send mails to admin!
                        $content = getMessage('CANNOT_SEND_ADMIN_MAILS');
@@ -908,11 +911,9 @@ function sendModeMails ($mod, $modes) {
 
 // Update module counter
 function countModuleHit($mod) {
-       if ($mod != "css") {
-               // Do count all other modules but not accesses on CSS file css.php!
-               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET clicks=clicks+1 WHERE `module`='%s' LIMIT 1",
+       // Do count all other modules but not accesses on CSS file css.php!
+       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `clicks`=`clicks`+1 WHERE `module`='%s' LIMIT 1",
                array($mod), __FUNCTION__, __LINE__);
-       } // END - if
 }
 
 // Get action value from mode (admin/guest/member) and what-value
@@ -1054,7 +1055,7 @@ function getPaymentPoints ($pid, $lookFor = 'price') {
 }
 
 // Remove a receiver's ID from $receivers and add a link for him to confirm
-function removeReceiver (&$receivers, $key, $uid, $pool_id, $stats_id='', $bonus=false) {
+function removeReceiver (&$receivers, $key, $uid, $pool_id, $stats_id = '', $bonus = false) {
        // Default is not removed
        $ret = 'failed';
 
@@ -1076,7 +1077,7 @@ function removeReceiver (&$receivers, $key, $uid, $pool_id, $stats_id='', $bonus
                        // Was it *not* found?
                        if (SQL_NUMROWS($result) == 0) {
                                // So we add one!
-                               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_links` (%s, userid, link_type) VALUES ('%s','%s','%s')",
+                               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_links` (`%s`, `userid`, `link_type`) VALUES ('%s','%s','%s')",
                                        array($rowName, $stats_id, bigintval($uid), $type), __FUNCTION__, __LINE__);
                                $ret = 'done';
                        } else {
@@ -1280,9 +1281,9 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify = false, $r
                                );
 
                                // Load email template
-                               $msg = LOAD_EMAIL_TEMPLATE('confirm-referal', $content, bigintval($uid));
+                               $message = LOAD_EMAIL_TEMPLATE('confirm-referal', $content, bigintval($uid));
 
-                               sendEmail($email, THANX_REFERRAL_ONE, $msg);
+                               sendEmail($email, THANX_REFERRAL_ONE, $message);
                        } elseif (($send_notify) && ($ref == 0) && (!$locked) && ($add_mode == 'direct') && (!defined('__POINTS_VALUE'))) {
                                // Direct payment shall be notified about
                                define('__POINTS_VALUE', $ref_points);
@@ -1294,10 +1295,10 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify = false, $r
                                );
 
                                // Load message
-                               $msg = LOAD_EMAIL_TEMPLATE('add-points', $content, $uid);
+                               $message = LOAD_EMAIL_TEMPLATE('add-points', $content, $uid);
 
                                // And sent it away
-                               sendEmail($email, getMessage('SUBJECT_DIRECT_PAYMENT'), $msg);
+                               sendEmail($email, getMessage('SUBJECT_DIRECT_PAYMENT'), $message);
                                if (!REQUEST_ISSET_GET('mid')) LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_POINTS_ADDED'));
                        }
 
@@ -1372,12 +1373,12 @@ function updateReferalCounter ($uid) {
 
 // Sends out mail to all administrators. This function is no longer obsolete
 // because we need it when there is no ext-admins installed
-function SEND_ADMIN_EMAILS ($subj, $msg) {
+function SEND_ADMIN_EMAILS ($subj, $message) {
        // Load all admin email addresses
        $result = SQL_QUERY("SELECT `email` FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `id` ASC", __FUNCTION__, __LINE__);
        while ($content = SQL_FETCHARRAY($result)) {
                // Send the email out
-               sendEmail($content['email'], $subj, $msg);
+               sendEmail($content['email'], $subj, $message);
        } // END - if
 
        // Free result
@@ -1659,8 +1660,8 @@ WHERE p.userid=%s", array(bigintval($uid)), __FUNCTION__, __LINE__);
        } // END - if
 
        // Now a mail to the user and that's all...
-       $msg = LOAD_EMAIL_TEMPLATE('del-user', array('text' => $reason), $uid);
-       sendEmail($uid, getMessage('ADMIN_DEL_ACCOUNT'), $msg);
+       $message = LOAD_EMAIL_TEMPLATE('del-user', array('text' => $reason), $uid);
+       sendEmail($uid, getMessage('ADMIN_DEL_ACCOUNT'), $message);
 
        // Ok, delete the account!
        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__);
@@ -2083,9 +2084,13 @@ function getTimestampFromUserStats ($type, $data, $uid = 0) {
        // Try to find the entry
        $result = SQL_QUERY_ESC("SELECT UNIX_TIMESTAMP(`inserted`) AS `stamp`
 FROM `{!_MYSQL_PREFIX!}_user_stats_data`
-WHERE userid=%s AND stats_type='%s' AND stats_data='%s'
+WHERE `userid`=%s AND `stats_type`='%s' AND `stats_data`='%s'
 LIMIT 1",
-       array(bigintval($uid), $type, $data), __FUNCTION__, __LINE__);
+               array(
+                       bigintval($uid),
+                       $type,
+                       $data
+               ), __FUNCTION__, __LINE__);
 
        // Is the entry there?
        if (SQL_NUMROWS($result) == 1) {
@@ -2115,7 +2120,7 @@ function insertUserStatsRecord ($uid, $type, $data) {
                array(bigintval($uid), $type, $data), __FUNCTION__, __LINE__);
        } elseif (is_array($data)) {
                // Invalid data!
-               DEBUG_LOG(__FUNCTION__, __LINE__, " uid={$uid},type={$type},data={".gettype($data).": Invalid statistics data type!");
+               DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$uid},type={$type},data={".gettype($data).": Invalid statistics data type!");
        }
 }
 
@@ -2205,7 +2210,7 @@ function reduceRecipientReceivedMails ($column, $id, $count) {
 
                // Now update all user accounts
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `emails_received`=`emails_received`-1 WHERE `userid` IN (%s) LIMIT %s",
-               array(implode(',', $UIDs), count($UIDs)), __FUNCTION__, __LINE__);
+                       array(implode(',', $UIDs), count($UIDs)), __FUNCTION__, __LINE__);
        } // END - if
 
        // Free result
@@ -2272,10 +2277,18 @@ function COUNT_SQLS () {
 // Checks wether the SQLs array is filled
 function IS_SQLS_VALID () {
        return (
-       (IS_SQLS_INITIALIZED()) &&
-       (COUNT_SQLS() > 0)
+               (IS_SQLS_INITIALIZED())
+               &&
+               (COUNT_SQLS() > 0)
        );
 }
 
+// Creates a new task
+function createNewTask($subject, $notes, $taskType, $userid = 0, $admin_id = 0, $strip = true) {
+       // Insert the task data into the database
+       SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (`assigned_admin`, `userid`, `status`, `task_type`, `subject`, `text`, `task_created`) VALUES (%s,%s,'NEW','%s','%s','%s', UNIX_TIMESTAMP())",
+               array($admin_id, $userid, $taskType, $subject, $notes), __FUNCTION__, __LINE__, true, $strip);
+}
+
 // [EOF]
 ?>
index 2471f46ef021cba6096eba7b329e5b9cf6ea9e8e..1bc67ec2aa436caad11d90dc837e6f54ca88cfdd 100644 (file)
@@ -56,11 +56,11 @@ if (isResetModeEnabled()) {
 if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
        // Do we need to send out bonus mails?
        if (EXT_IS_ACTIVE('html_mail')) {
-               //                                 0     1       2        3        4      5       6          7       8      9         10         11
-               $result_bonus = SQL_QUERY("SELECT id, subject, text, receivers, points, time, data_type, timestamp, url, cat_id, target_send, html_msg FROM `{!_MYSQL_PREFIX!}_bonus` WHERE data_type='NEW' ORDER BY timestamp DESC", __FILE__, __LINE__);
+               //                                 0        1        2          3          4        5          6            7         8        9            10           11
+               $result_bonus = SQL_QUERY("SELECT `id`, `subject`, `text`, `receivers`, `points`, `time`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send`, `html_msg` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `data_type`='NEW' ORDER BY `timestamp` DESC", __FILE__, __LINE__);
        } else {
-               //                                 0     1       2        3        4      5       6          7       8      9         10
-               $result_bonus = SQL_QUERY("SELECT id, subject, text, receivers, points, time, data_type, timestamp, url, cat_id, target_send FROM `{!_MYSQL_PREFIX!}_bonus` WHERE data_type='NEW' ORDER BY timestamp DESC", __FILE__, __LINE__);
+               //                                 0        1        2          3          4        5          6            7         8        9            10
+               $result_bonus = SQL_QUERY("SELECT `id`, `subject`, `text`, `receivers`, `points`, `time`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `data_type`='NEW' ORDER BY `timestamp` DESC", __FILE__, __LINE__);
        }
 
        if (SQL_NUMROWS($result_bonus) > 0) {
@@ -71,8 +71,8 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
                        $DATA['url'] = COMPILE_CODE($DATA['url']);
 
                        // Message is active in queue
-                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='QUEUE' WHERE `id`=%s LIMIT 1",
-                       array(bigintval($DATA['id'])), __FILE__, __LINE__);
+                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET `data_type`='QUEUE' WHERE `id`=%s LIMIT 1",
+                               array(bigintval($DATA['id'])), __FILE__, __LINE__);
 
                        // "Explode" all receivers into an array
                        if (ereg(';', $DATA['receivers'])) {
@@ -92,8 +92,8 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
                        foreach ($RECEIVERS as $key => $uid) {
                                // Load personal data
                                //* DEBUG: */ echo "*L:".__LINE__.'/'.$uid."*<br />";
-                               $result_user = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-                               array(bigintval($uid)), __FILE__, __LINE__);
+                               $result_user = SQL_QUERY_ESC("SELECT `surname`, `family`, `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+                                       array(bigintval($uid)), __FILE__, __LINE__);
 
                                // Is his data available?
                                if (SQL_NUMROWS($result_user) == 1) {
@@ -119,7 +119,7 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
                                                );
 
                                                // Prepare the mail
-                                               $mailText = LOAD_EMAIL_TEMPLATE("bonus-mail", $content, $uid);
+                                               $mailText = LOAD_EMAIL_TEMPLATE('bonus-mail', $content, $uid);
 
                                                // Send mail away
                                                if (isset($DATA['html_msg'])) {
index a0b400076eaf25df527ae808ccf639ea824df2b0..83bd61e43536951338dddcf3c6256da307b9e64d 100644 (file)
@@ -55,10 +55,10 @@ if (isResetModeEnabled()) {
 // Check for freed mail orders to send out
 if (EXT_IS_ACTIVE('html_mail')) {
        //                                0     1        2      3       4          5            6      7        8          9       10
-       $result_main = SQL_QUERY("SELECT id, sender, subject, text, receivers, payment_id, timestamp, url, target_send, cat_id, html_msg FROM `{!_MYSQL_PREFIX!}_pool` WHERE data_type='NEW' ORDER BY timestamp DESC", __FILE__, __LINE__);
+       $result_main = SQL_QUERY("SELECT id, sender, subject, text, receivers, payment_id, timestamp, url, target_send, cat_id, html_msg FROM `{!_MYSQL_PREFIX!}_pool` WHERE `data_type`='NEW' ORDER BY timestamp DESC", __FILE__, __LINE__);
 } else {
        //                                0     1        2      3       4          5            6      7        8          9    10
-       $result_main = SQL_QUERY("SELECT id, sender, subject, text, receivers, payment_id, timestamp, url, target_send, cat_id, id FROM `{!_MYSQL_PREFIX!}_pool` WHERE data_type='NEW' ORDER BY timestamp DESC", __FILE__, __LINE__);
+       $result_main = SQL_QUERY("SELECT id, sender, subject, text, receivers, payment_id, timestamp, url, target_send, cat_id, id FROM `{!_MYSQL_PREFIX!}_pool` WHERE `data_type`='NEW' ORDER BY timestamp DESC", __FILE__, __LINE__);
 }
 
 // Reset variables
@@ -67,8 +67,8 @@ if (SQL_NUMROWS($result_main) > 0) {
        // Parse all mails
        while ($DATA = SQL_FETCHROW($result_main)) {
                // Set mail order as 'active'. That means it will be sent out
-               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='ACTIVE' WHERE `id`=%s AND data_type='NEW' LIMIT 1",
-               array($DATA[0]), __FILE__, __LINE__);
+               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET `data_type`='ACTIVE' WHERE `id`=%s AND `data_type`='NEW' LIMIT 1",
+                       array($DATA[0]), __FILE__, __LINE__);
 
                // Check fetched data for HTML
                $HTML = $DATA[10]; if ($HTML == $DATA[0]) $HTML = 'N';
@@ -96,7 +96,7 @@ if (SQL_NUMROWS($result_main) > 0) {
                        foreach ($RECEIVERS as $key => $uid) {
                                // Lookup user ID
                                $result_user = SQL_QUERY_ESC("SELECT gender, surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-                               array(bigintval($uid)), __FILE__, __LINE__);
+                                       array(bigintval($uid)), __FILE__, __LINE__);
 
                                // Is his data available?
                                //* DEBUG: */ echo "*L:".__LINE__.'/'.SQL_NUMROWS($result_user)."*<br />";
@@ -109,18 +109,18 @@ if (SQL_NUMROWS($result_main) > 0) {
 
                                        // Do we have a stats entry?
                                        $result_stats = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s AND `userid`=%s AND timestamp_ordered='%s' LIMIT 1",
-                                       array($DATA[0], $DATA[1], $DATA[6]), __FILE__, __LINE__);
+                                               array($DATA[0], $DATA[1], $DATA[6]), __FILE__, __LINE__);
 
                                        // If there's no stats entry add it!
                                        //* DEBUG: */ echo "!L:".__LINE__.'/'.SQL_NUMROWS($result_stats)."!<br />";
                                        if (SQL_NUMROWS($result_stats) == 0) {
                                                // No entry was found, so we add him!
                                                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_stats` (pool_id , userid, cat_id, payment_id, subject, url , max_rec , timestamp_ordered, timestamp_sstart) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s' , UNIX_TIMESTAMP())",
-                                               array(bigintval($DATA[0]), bigintval($DATA[1]), bigintval($DATA[9]), bigintval($DATA[5]), $DATA[2], $DATA[7], $DATA[8], bigintval($DATA[6])), __FILE__, __LINE__);
+                                                       array(bigintval($DATA[0]), bigintval($DATA[1]), bigintval($DATA[9]), bigintval($DATA[5]), $DATA[2], $DATA[7], $DATA[8], bigintval($DATA[6])), __FILE__, __LINE__);
 
                                                // Receive it's ID for the links table
                                                $result_stats = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s AND `userid`=%s AND timestamp_ordered='%s' LIMIT 1",
-                                               array(bigintval($DATA[0]), bigintval($DATA[1]), bigintval($DATA[6])), __FILE__, __LINE__);
+                                                       array(bigintval($DATA[0]), bigintval($DATA[1]), bigintval($DATA[6])), __FILE__, __LINE__);
                                        } // END - if
 
                                        //* DEBUG: */ echo "!L:".__LINE__.'/'.SQL_NUMROWS($result_stats)."!<br />";
@@ -163,12 +163,12 @@ if (SQL_NUMROWS($result_main) > 0) {
 
                                                                // Count sent mails...
                                                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET emails_sent=emails_sent+1 WHERE userid=%s LIMIT 1",
-                                                               array(bigintval($DATA[1])), __FILE__, __LINE__);
+                                                                       array(bigintval($DATA[1])), __FILE__, __LINE__);
 
                                                                if (GET_EXT_VERSION('user') >= '0.1.4') {
                                                                        // Update mails received for receiver
                                                                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET emails_received=emails_received+1 WHERE userid=%s LIMIT 1",
-                                                                       array(bigintval($uid)), __FILE__, __LINE__);
+                                                                               array(bigintval($uid)), __FILE__, __LINE__);
                                                                } // END - if
 
                                                                // Update mediadata if version is 0.0.4 or higher
@@ -208,7 +208,7 @@ if (SQL_NUMROWS($result_main) > 0) {
 
                                                // Get sender's data
                                                $result_sender = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-                                               array(bigintval($DATA[1])), __FILE__, __LINE__);
+                                                       array(bigintval($DATA[1])), __FILE__, __LINE__);
 
                                                // Is the sender found?
                                                if (SQL_NUMROWS($result_sender) == 1) {
@@ -227,11 +227,11 @@ if (SQL_NUMROWS($result_main) > 0) {
 
                                                // Set status to SEND because we completely send it away
                                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET `data_type`='SEND', `target_send`=0, `receivers`='' WHERE `id`=%s LIMIT 1",
-                                               array(bigintval($DATA[0])), __FILE__, __LINE__);
+                                                       array(bigintval($DATA[0])), __FILE__, __LINE__);
 
                                                // Update send-completed-time
                                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET `timestamp_send`=UNIX_TIMESTAMP() WHERE `pool_id`=%s LIMIT 1",
-                                               array(bigintval($DATA[0])), __FILE__, __LINE__);
+                                                       array(bigintval($DATA[0])), __FILE__, __LINE__);
 
                                                $lastSentId = $DATA[0]; $GLOBALS['pool_cnt'] = 0;
                                                $cnt2 += $GLOBALS['pool_cnt'];
@@ -251,8 +251,8 @@ if (SQL_NUMROWS($result_main) > 0) {
                                                // There are some mails left to send for next round, so we reset the status back to NEW (=still not fully delivered)
                                                $add = '';
                                                if ($GLOBALS['pool_cnt'] <= $DATA[8]) $add = ", target_send=target_send-".$GLOBALS['pool_cnt'];
-                                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='NEW', receivers='%s'".$add." WHERE `id`=%s LIMIT 1",
-                                               array(implode(';', $dummy), bigintval($DATA[0])), __FILE__, __LINE__);
+                                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET `data_type`='NEW', receivers='%s'".$add." WHERE `id`=%s LIMIT 1",
+                                                       array(implode(';', $dummy), bigintval($DATA[0])), __FILE__, __LINE__);
 
                                                //* DEBUG: */ echo"*EXIT/L:".__LINE__."*<br />";
                                                break;
@@ -264,8 +264,8 @@ if (SQL_NUMROWS($result_main) > 0) {
                                        // User does not exists so we have add the sender's points back to sender's account
                                        if (($RECEIVERS[0] == '0') || (empty($RECEIVERS[0]))) {
                                                // List was empty
-                                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='SEND' WHERE `id`=%s LIMIT 1",
-                                               array(bigintval($DATA[0])), __FILE__, __LINE__);
+                                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET `data_type`='SEND' WHERE `id`=%s LIMIT 1",
+                                                       array(bigintval($DATA[0])), __FILE__, __LINE__);
                                        } else {
                                                // Is the userid set?
                                                if ($uid > 0) {
@@ -286,7 +286,7 @@ if (SQL_NUMROWS($result_main) > 0) {
 
                                        // Update receivers
                                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET receivers='%s' WHERE `id`=%s LIMIT 1",
-                                       array(implode(';', $dummy), bigintval($DATA[0])), __FILE__, __LINE__);
+                                               array(implode(';', $dummy), bigintval($DATA[0])), __FILE__, __LINE__);
                                }
                        }
                }
index ca85ac4d330235dbe37dbe2434ab6932020adbb6..6920842fd552f81f9be8598e7142ca1c7d2c4092 100644 (file)
@@ -44,15 +44,21 @@ if (!defined('__SECURITY')) {
 }
 
 if ((getConfig('send_prof_update') == 'Y') && (getConfig('profile_update') > 0) && (getConfig('resend_profile_update'))) {
-       // Load personal data              0      1        2          3
-       $result = SQL_QUERY_ESC("SELECT userid, email, last_update, joined
+       // Load personal data
+       $result = SQL_QUERY_ESC("SELECT `userid`, `email`, `last_update`, `joined`
 FROM
-       {!_MYSQL_PREFIX!}_user_data
+       `{!_MYSQL_PREFIX!}_user_data`
 WHERE
-       (last_update < (UNIX_TIMESTAMP() - %s) AND last_update != 0 AND last_profile_sent < (UNIX_TIMESTAMP() - %s))
+       (`last_update` < (UNIX_TIMESTAMP() - %s) AND `last_update` != 0 AND `last_profile_sent` < (UNIX_TIMESTAMP() - %s))
 OR
-       (last_update=0 AND last_profile_sent=0 AND joined < (UNIX_TIMESTAMP() - %s))
-ORDER BY `userid` ASC", array(getConfig('profile_update'), getConfig('resend_profile_update'), getConfig('profile_update')), __FILE__, __LINE__);
+       (`last_update` = 0 AND `last_profile_sent` = 0 AND `joined` < (UNIX_TIMESTAMP() - %s))
+ORDER BY
+       `userid` ASC",
+               array(
+                       getConfig('profile_update'),
+                       getConfig('resend_profile_update'),
+                       getConfig('profile_update')
+               ), __FILE__, __LINE__);
 
        // Do we have some notifications to sent?
        if (SQL_NUMROWS($result) > 0) {
@@ -70,12 +76,12 @@ ORDER BY `userid` ASC", array(getConfig('profile_update'), getConfig('resend_pro
                        }
 
                        // Load email template and send mail away
-                       $msg = LOAD_EMAIL_TEMPLATE("profile-updte", '', bigintval($content['userid']));
-                       sendEmail($content['email'], getMessage('PROFILE_OUTDATED'), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE('profile-updte', '', bigintval($content['userid']));
+                       sendEmail($content['email'], getMessage('PROFILE_OUTDATED'), $message);
 
                        // Update profile data
-                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET last_profile_sent=UNIX_TIMESTAMP(), notified='Y' WHERE userid=%s LIMIT 1",
-                       array(bigintval($content['userid'])), __FILE__, __LINE__);
+                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `last_profile_sent`=UNIX_TIMESTAMP(), `notified`='Y' WHERE `userid`=%s LIMIT 1",
+                               array(bigintval($content['userid'])), __FILE__, __LINE__);
                } // END - while
        } // END - if
 
index d61b400649120891095ea72f72d9bcba4cb91981..ce3762b754d96883e0209ceb0df2487999c98587 100644 (file)
@@ -80,15 +80,15 @@ LIMIT 1",
                        );
 
                        // Send email to user
-                       $msg = LOAD_EMAIL_TEMPLATE("member_holiday_activated", $content, $content['userid']);
-                       sendEmail($content['userid'], getMessage('HOLIDAY_MEMBER_ACTIVATED_SUBJ'), $msg);
+                       $message = LOAD_EMAIL_TEMPLATE('member_holiday_activated', $content, $content['userid']);
+                       sendEmail($content['userid'], getMessage('HOLIDAY_MEMBER_ACTIVATED_SUBJ'), $message);
 
                        // Update account
                        ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
 SET `holiday_active`='Y'
-WHERE userid=%s
+WHERE `userid`=%s
 LIMIT 1",
-                       array(bigintval($content['userid'])), __FILE__, __LINE__, false));
+                               array(bigintval($content['userid'])), __FILE__, __LINE__, false));
                } // END - if
 
                // Free memory
index ae18934d68ea6a0aa00a03f89888d94f3ea77231..b184358c7d266078da04a128c1843c6c9a8c0f5c 100644 (file)
@@ -43,10 +43,14 @@ if (!defined('__SECURITY')) {
 }
 
 // Check for 100% klickrate mails
-$result_bonus = SQL_QUERY("SELECT id, userid, subject, timestamp_ordered, clicks, url
-FROM `{!_MYSQL_PREFIX!}_user_stats`
-WHERE max_rec=clicks AND clicks>0 AND bonus_stats_active='N'
-ORDER BY `userid` ASC", __FILE__, __LINE__);
+$result_bonus = SQL_QUERY("SELECT
+       `id`, `userid`, `subject`, `timestamp_ordered`, `clicks`, `url`
+FROM
+       `{!_MYSQL_PREFIX!}_user_stats`
+WHERE
+       `max_rec`=`clicks` AND `clicks` > 0 AND `bonus_stats_active`='N'
+ORDER BY
+       `userid` ASC", __FILE__, __LINE__);
 
 if (SQL_NUMROWS($result_bonus) > 0) {
        // Remember stats bonus in constant
@@ -55,19 +59,19 @@ if (SQL_NUMROWS($result_bonus) > 0) {
        // We found some mail orders...
        while ($content = SQL_FETCHARRAY($result_bonus)) {
                // Add points
-               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET bonus_stats=bonus_stats+%s WHERE userid=%s LIMIT 1",
-               array(getConfig('bonus_stats'), bigintval($content['userid'])), __FILE__, __LINE__);
+               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `bonus_stats`=`bonus_stats`+%s WHERE `userid`=%s LIMIT 1",
+                       array(getConfig('bonus_stats'), bigintval($content['userid'])), __FILE__, __LINE__);
 
                // Translate some data
                $content['timestamp'] = generateDateTime($content['timestamp_ordered'], '2');
 
                // Load email template and send email
-               $msg = LOAD_EMAIL_TEMPLATE("member_stats_bonus", $content, bigintval($content['userid']));
-               sendEmail($content['userid'], getMessage('BONUS_MEMBER_STATS_SUBJECT'), $msg);
+               $message = LOAD_EMAIL_TEMPLATE('member_stats_bonus', $content, bigintval($content['userid']));
+               sendEmail($content['userid'], getMessage('BONUS_MEMBER_STATS_SUBJECT'), $message);
 
                // Update database
-               $result_update = SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET bonus_stats_active='Y' WHERE `id`=%s LIMIT 1",
-               array(bigintval($content['id'])), __FILE__, __LINE__);
+               $result_update = SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET `bonus_stats_active`='Y' WHERE `id`=%s LIMIT 1",
+                       array(bigintval($content['id'])), __FILE__, __LINE__);
        } // END - while
 
        // Handle bonus points
@@ -77,5 +81,5 @@ if (SQL_NUMROWS($result_bonus) > 0) {
 // Free memory
 SQL_FREERESULT($result_bonus);
 
-//
+// [EOF]
 ?>
index 6ccafda6272d4affcb881b1f4ba9a7a9bc94ce23..738b5b6e3d9be42f16008593b602f50c0e65d2eb 100644 (file)
@@ -132,7 +132,7 @@ function loadIncludeOnce ($INC) {
        // Is it not loaded?
        if (!isset($GLOBALS['load_once'][$INC])) {
                // Mark it as loaded
-               $GLOBALS['load_once'][$INC] = "loaded";
+               $GLOBALS['load_once'][$INC] = 'loaded';
 
                // Then try to load it
                loadInclude($INC);
@@ -180,21 +180,19 @@ function decodeEntities ($str) {
 // Merges an array together but only if both are arrays
 function merge_array ($array1, $array2) {
        // Are both an array?
-       if ((is_array($array1)) && (is_array($array2))) {
-               // Merge all together
-               return array_merge($array1, $array2);
-       } elseif (is_array($array1)) {
-               // Return left array
-               DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("array2 is not an array. array != %s", gettype($array2)));
-               return $array1;
-       } elseif (is_array($array2)) {
-               // Return right array
-               DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("array1 is not an array. array != %s", gettype($array1)));
-               return $array2;
+       if ((!is_array($array1)) && (!is_array($array2))) {
+               // Both are not arrays
+               debug_report_bug(__FUNCTION__ . ': No arrays provided!');
+       } elseif (!is_array($array1)) {
+               // Left one is not an array
+               debug_report_bug(__FUNCTION__, sprintf("array1 is not an array. array != %s", gettype($array1)));
+       } elseif (!is_array($array2)) {
+               // Right one is not an array
+               debug_report_bug(__FUNCTION__, sprintf("array2 is not an array. array != %s", gettype($array2)));
        }
 
-       // Both are not arrays
-       debug_report_bug(__FUNCTION__.": No arrays provided!");
+       // Merge all together
+       return array_merge($array1, $array2);
 }
 
 // Check if given FQFN is a readable file
index fc693eea44b6b9ae96ddb0b5561657439874d5c4..9e4d790b94fdc5dd372663dd8b9a99c0d705be6c 100644 (file)
@@ -72,7 +72,7 @@ $content = array(
 // Is the cookie set?
 if (isSessionVariableSet('lead_uid')) {
        // Is the user-account unlocked and valid?
-       $result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
                array(bigintval(getSession('lead_uid'))), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Secure the ID number
index 58b41d6b753ae75a14c756354e94259b67a4bc34..34de98562876460a958ae3dd910dc3101bda1557 100644 (file)
@@ -45,6 +45,7 @@ $GLOBALS['startTime'] = microtime(true);
 // Tell everyone we are in this module
 $GLOBALS['module'] = 'mailid';
 $GLOBALS['output_mode'] = -1;
+$errorCode = '';
 
 // Load the required file(s)
 require('inc/config-global.php');
@@ -72,13 +73,13 @@ if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors
        // Maybe he wants to confirm an email?
        if ($url_mid > 0) {
                // Normal-Mails
-               $result = SQL_QUERY_ESC("SELECT link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s AND `userid`=%s LIMIT 1",
-               array($url_mid, $url_uid), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `link_type` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `stats_id`=%s AND `userid`=%s LIMIT 1",
+                       array($url_mid, $url_uid), __FILE__, __LINE__);
                $type = 'mailid'; $urlId = $url_mid;
        } elseif ($url_bid > 0) {
                // Bonus-Mail
-               $result = SQL_QUERY_ESC("SELECT link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s AND `userid`=%s LIMIT 1",
-               array($url_bid, $url_uid), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `link_type` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `bonus_id`=%s AND `userid`=%s LIMIT 1",
+                       array($url_bid, $url_uid), __FILE__, __LINE__);
                $type = 'bonusid'; $urlId = $url_bid;
        } else {
                // Problem: No ID entered
@@ -129,8 +130,8 @@ if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors
                        setExtraTitle($title);
 
                        // Is the user's ID unlocked?
-                       $result = SQL_QUERY_ESC("SELECT status, gender, surname, family FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-                       array($url_uid), __FILE__, __LINE__);
+                       $result = SQL_QUERY_ESC("SELECT `status`, `gender`, `surname`,` family` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+                               array($url_uid), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result) == 1) {
                                list($status, $gender, $sname, $fname) = SQL_FETCHROW($result);
                                SQL_FREERESULT($result);
@@ -190,37 +191,37 @@ if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors
                                                        // Load template
                                                        LOAD_TEMPLATE('mailid_frames');
                                                } else {
-                                                       $msg = getCode('DATA_INVALID');
+                                                       $errorCode = getCode('DATA_INVALID');
                                                }
                                        } else {
-                                               $msg = getCode('POSSIBLE_INVALID');
+                                               $errorCode = getCode('POSSIBLE_INVALID');
                                        }
                                } else {
-                                       $msg = getCode('ACCOUNT_LOCKED');
+                                       $errorCode = getCode('ACCOUNT_LOCKED');
                                }
                        } else {
                                SQL_FREERESULT($result);
-                               $msg = getCode('USER_404');
+                               $errorCode = getCode('USER_404');
                        }
                } else {
                        SQL_FREERESULT($result);
-                       $msg = getCode('STATS_404');
+                       $errorCode = getCode('STATS_404');
                }
        } else {
                SQL_FREERESULT($result);
-               $msg = getCode('ALREADY_CONFIRMED');
+               $errorCode = getCode('ALREADY_CONFIRMED');
        }
 } else {
        // Nothing entered
-       $msg = getCode('ERROR_MAILID');
+       $errorCode = getCode('ERROR_MAILID');
 }
 
 // Error code is set?
-if (!empty($msg)) {
+if (!empty($errorCode)) {
        // @TODO Rewrite this to a filter
        switch (getConfig('mailid_error_redirect')) {
                case 'INDEX': // Redirect to index page
-                       redirectToUrl('modules.php?module=index&amp;msg='.$msg.'&amp;ext=mailid');
+                       redirectToUrl('modules.php?module=index&amp;msg=' . $errorCode . '&amp;ext=mailid');
                        break;
 
                case 'REJECT': // Redirect to rejection page
index 951e60d49141ce77bca3588d34d86916bcc7b7c2..3457613e5a37e2b6888e7e75e3a08c702c5ee3cf 100644 (file)
@@ -72,12 +72,12 @@ if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors
 
        // Maybe he wants to confirm an email?
        if ($url_mid > 0) {
-               $result = SQL_QUERY_ESC("SELECT id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s AND `userid`=%s LIMIT 1",
+               $result = SQL_QUERY_ESC("SELECT `id`, `link_type` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `stats_id`=%s AND `userid`=%s LIMIT 1",
                array($url_mid, $url_uid), __FILE__, __LINE__);
                $type = 'mailid'; $urlId = $url_mid;
        } elseif ($url_bid > 0) {
-               $result = SQL_QUERY_ESC("SELECT id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s AND `userid`=%s LIMIT 1",
-               array($url_bid, $url_uid), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `id`, link_type` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `bonus_id`=%s AND `userid`=%s LIMIT 1",
+                       array($url_bid, $url_uid), __FILE__, __LINE__);
                $type = 'bonusid'; $urlId = $url_bid;
        }
 
@@ -89,12 +89,12 @@ if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors
                // @TODO Rewrite this to a filter
                switch ($ltype) {
                        case 'NORMAL':
-                               $result_mailid = SQL_QUERY_ESC("SELECT pool_id, userid, id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1",
+                               $result_mailid = SQL_QUERY_ESC("SELECT `pool_id`, `userid`, `id` FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1",
                                array($url_mid), __FILE__, __LINE__);
                                break;
 
                        case 'BONUS':
-                               $result_mailid = SQL_QUERY_ESC("SELECT id, id, is_notify FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
+                               $result_mailid = SQL_QUERY_ESC("SELECT `id, `id`, `is_notify` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
                                array($url_bid), __FILE__, __LINE__);
                                break;
 
diff --git a/ref.php b/ref.php
index 8e5e88b0a15821bb689dc5baf0176fbd7e450b1e..730799b089100b6473261d2ae044cf01d839155f 100644 (file)
--- a/ref.php
+++ b/ref.php
@@ -72,8 +72,8 @@ if (!empty($ref)) {
        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__);
+                       $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);
@@ -98,8 +98,8 @@ if (!empty($ref)) {
        // Is the refid valid?
        if ($ref > 0) {
                // Update ref counter
-               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_clicks=ref_clicks+1 WHERE userid=%s LIMIT 1",
-               array(bigintval($ref)), __FILE__, __LINE__);
+               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `ref_clicks`=`ref_clicks`+1 WHERE `userid`=%s LIMIT 1",
+                       array(bigintval($ref)), __FILE__, __LINE__);
        } // END - if
 } else {
        // No refid and we add our refid (don't forget to set $def_refid!)
index 380de444c1a9be2113e27541ff97bbf0c018ebd3..4318b54590197f28601e3495f540b27c9057aa3c 100644 (file)
@@ -47,7 +47,6 @@ $GLOBALS['module'] = 'surfbar';
 $GLOBALS['refid']  = 0;
 $GLOBALS['output_mode'] = 0;
 $GLOBALS['header_sent'] = 3;
-$msg = null;
 
 // Load the required file(s)
 require('inc/config-global.php');