Heavy rewrite:
authorRoland Häder <roland@mxchange.org>
Tue, 22 Sep 2009 00:14:55 +0000 (00:14 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 22 Sep 2009 00:14:55 +0000 (00:14 +0000)
- A lot (not all!) double-quotes converted to single-quotes
- A lot (again not all) SQL queries improved with back-ticks (`) for column names
- The email order page (what-order.php) might be broken, please test
- Some obsolete code removed
- "SELECT COUNT(foo)" queries rewritten to function GET_TOTAL_DATA()
- A lot more mailto-links (especially in sponsor extension) rewritten to
  functions
- Misc fixes/rewrites
- TODOs.txt updated

85 files changed:
.gitattributes
DOCS/TODOs.txt
beg.php
birthday_confirm.php
debug.php
doubler.php
img.php
inc/autopurge/purge-inact.php
inc/autopurge/purge-mails.php
inc/autopurge/purge-tsks.php
inc/autopurge/purge-unconfirmed.php
inc/check-reset.php
inc/db/lib-mysql3.php
inc/doubler_send.php
inc/filters.php
inc/functions.php
inc/install-inc.php
inc/libs/admins_functions.php
inc/libs/autopurge_functions.php
inc/libs/html_mail_functions.php
inc/libs/newsletter_functions.php
inc/libs/rallye_functions.php
inc/libs/surfbar_functions.php
inc/libs/theme_functions.php
inc/libs/user_functions.php
inc/libs/yoomedia_functions.php
inc/modules/admin.php
inc/modules/admin/overview-inc.php
inc/modules/admin/what-add_points.php
inc/modules/admin/what-chk_regs.php
inc/modules/admin/what-config_mediadata.php
inc/modules/admin/what-config_points.php
inc/modules/admin/what-config_rallye_prices.php
inc/modules/admin/what-del_email.php
inc/modules/admin/what-del_user.php
inc/modules/admin/what-edit_sponsor.php
inc/modules/admin/what-guestedit.php
inc/modules/admin/what-list_autopurge.php
inc/modules/admin/what-list_beg.php
inc/modules/admin/what-list_bonus.php
inc/modules/admin/what-list_cats.php
inc/modules/admin/what-list_links.php
inc/modules/admin/what-list_payouts.php
inc/modules/admin/what-list_rallyes.php
inc/modules/admin/what-list_refs.php
inc/modules/admin/what-list_sponsor.php
inc/modules/admin/what-list_sponsor_pay.php
inc/modules/admin/what-list_unconfirmed.php
inc/modules/admin/what-list_user.php
inc/modules/admin/what-list_yoomedia_tm.php
inc/modules/admin/what-lock_sponsor.php
inc/modules/admin/what-lock_user.php
inc/modules/admin/what-mem_add.php
inc/modules/admin/what-memedit.php
inc/modules/admin/what-sub_points.php
inc/modules/admin/what-unlock_sponsor.php
inc/modules/admin/what-usage.php
inc/modules/frametester.php
inc/modules/guest/what-confirm.php
inc/modules/guest/what-login.php
inc/modules/guest/what-register.php
inc/modules/guest/what-sponsor_reg.php
inc/modules/guest/what-top10.php
inc/modules/member/what-beg2.php
inc/modules/member/what-bonus.php
inc/modules/member/what-nickname.php
inc/modules/member/what-order.php
inc/modules/member/what-primera.php
inc/modules/member/what-refback.php
inc/modules/member/what-themes.php
inc/modules/member/what-transfer.php
inc/modules/order.php
inc/modules/sponsor/account.php
inc/modules/sponsor/settings.php
inc/monthly/monthly_beg.php
inc/monthly/monthly_bonus.php
inc/mysql-manager.php
inc/wrapper-functions.php
mailid_top.php
modules.php
ref.php
show_bonus.php
sponsor_ref.php
surfbar.php
templates/de/html/install/install_page5.tpl [new file with mode: 0644]

index 113ad40..35f2646 100644 (file)
@@ -1361,6 +1361,7 @@ templates/de/html/install/install_header.tpl -text
 templates/de/html/install/install_page1.tpl -text
 templates/de/html/install/install_page2.tpl -text
 templates/de/html/install/install_page3.tpl -text
+templates/de/html/install/install_page5.tpl -text
 templates/de/html/install/install_welcome.tpl -text
 templates/de/html/js/.htaccess -text
 templates/de/html/js/js_uberwach.tpl -text
index 606111f..8b41510 100644 (file)
@@ -1,4 +1,4 @@
-### WARNING: THIS FILE IS AUTO-GENERATED BY ./DOCS/todo-builder.sh (1000/quix0r) ###
+### WARNING: THIS FILE IS AUTO-GENERATED BY DOCS/todo-builder.sh (1000/quix0r) ###
 ### DO NOT EDIT THIS FILE. ###
 ./beg.php:195:                 // @TODO Opps, what is missing here???
 ./doubler.php:269:// @TODO Rewrite all constants
 ./inc/extensions.php:358:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
 ./inc/extensions.php:440:              // @TODO Extension is loaded, what next?
 ./inc/footer.php:50:   // @TODO Rewrite these all into filters
-./inc/functions.php:1236:      // @TODO Rewrite this unnice code
-./inc/functions.php:1297:      // @TODO Remove this if() block if all is working fine
-./inc/functions.php:1597:              // @TODO This can be, somehow, rewritten
+./inc/functions.php:1238:      // @TODO Rewrite this unnice code
+./inc/functions.php:1299:      // @TODO Remove this if() block if all is working fine
+./inc/functions.php:1599:              // @TODO This can be, somehow, rewritten
 ./inc/functions.php:214:       // @TODO Remove this sanity-check if all is fine
-./inc/functions.php:2404:      // @TODO The status should never be empty
-./inc/functions.php:2495:                      // @TODO shouldn't do the unset and the reloading $GLOBALS['cache_instance']->destroyCacheFile() Or a new methode like forceCacheReload('revision')?
+./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: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:2558:// @TODO Please describe this function
-./inc/functions.php:2570:      searchDirsRecursive($next_dir, $last_changed); // @TODO small change to API to $last_changed = searchDirsRecursive($next_dir, $time);
-./inc/functions.php:2653:              // @TODO Add a little more infos here
-./inc/functions.php:2664:      // @TODO This cannot be rewritten to app_die(), try to find a solution for this.
-./inc/functions.php:2822:                      // @TODO Are these convertions still required?
-./inc/functions.php:2840:// @TODO Rewrite this function to use readFromFile() and writeToFile()
-./inc/functions.php:475:// @TODO Rewrite this to an extension 'smtp'
+./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: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                     *
 ./inc/language/de.php:1159:// @TODO Rewrite these two constants
 ./inc/language/de.php:1175:// @TODO Rewrite these five constants
 ./inc/libs/rallye_functions.php:697:           // @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/surfbar_functions.php:1481:         // @TODO This can be somehow rewritten
+./inc/libs/register_functions.php:97:// @TODO This function is no longer used???
+./inc/libs/surfbar_functions.php:1495:         // @TODO This can be somehow rewritten
 ./inc/libs/surfbar_functions.php:954:  // @TODO Invalid salt should be refused
 ./inc/libs/task_functions.php:261:             // @TODO These can be rewritten to filter
 ./inc/libs/task_functions.php:53:// @TODO Move all extension-dependent queries into filters
-./inc/libs/user_functions.php:317:                             // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
-./inc/libs/user_functions.php:342:                             // @TODO Make this filter working: $URL = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
-./inc/libs/user_functions.php:377:                     // @TODO Can this query be merged with above query?
+./inc/libs/user_functions.php:311:                             // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
+./inc/libs/user_functions.php:336:                             // @TODO Make this filter working: $URL = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
+./inc/libs/user_functions.php:371:                     // @TODO Can this query be merged with above query?
 ./inc/libs/yoomedia_functions.php:65:  $response = YOOMEDIA_QUERY_API('out_textmail.php', true); // @TODO Ask Yoo!Media for test script
 ./inc/load_config.php:77:      // @TODO Rewrite them to avoid this else block
 ./inc/load_extensions.php:13: * @TODO Rewrite this whole file to load_cache-extensions.php           *
@@ -84,8 +86,8 @@
 ./inc/modules/admin/what-admins_mails.php:100:         // @TODO Rewrite this constant
 ./inc/modules/admin/what-admins_mails.php:173:         // @TODO Rewrite this constant
 ./inc/modules/admin/what-admins_mails.php:61:                          // @TODO Can this be rewritten???
-./inc/modules/admin/what-chk_regs.php:62:              // @TODO Rewritings: sname->surname,fname->family,ip->REMOTE_ADDR,ref->refid,hash->user_hash in template
-./inc/modules/admin/what-chk_regs.php:81:      // @TODO Rewrite this constant
+./inc/modules/admin/what-chk_regs.php:66:              // @TODO Rewritings: sname->surname,fname->family,ip->REMOTE_ADDR,ref->refid,hash->user_hash in template
+./inc/modules/admin/what-chk_regs.php:85:      // @TODO Rewrite this constant
 ./inc/modules/admin/what-config_admins.php:154:        // @TODO Rewrite this to filter 'run_sqls'
 ./inc/modules/admin/what-config_admins.php:164:                // @TODO This causes the whole (!) menu cache being rebuild
 ./inc/modules/admin/what-config_cache.php:94:  // @TODO Rewrite all constants
 ./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_rallye_prices.php:248:                 // @TODO Rewritings: aid->admin_id, alogin->login in template
+./inc/modules/admin/what-config_rallye_prices.php:255:                 // @TODO Rewritings: aid->admin_id, alogin->login in template
 ./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-guest_add.php:123:                            // @TODO This can be somehow rewritten to a function
 ./inc/modules/admin/what-guest_add.php:62:             // @TODO Cant this be rewritten?
 ./inc/modules/admin/what-guest_add.php:78:             // @TODO This can be somehow rewritten to a function
-./inc/modules/admin/what-guestedit.php:284:            // @TODO Rewrite this constant
+./inc/modules/admin/what-guestedit.php:277:            // @TODO Rewrite this constant
+./inc/modules/admin/what-list_autopurge.php:105:       // @TODO Rewrite this constant
 ./inc/modules/admin/what-list_autopurge.php:55:// @TODO Rewrite those lines to filter
-./inc/modules/admin/what-list_autopurge.php:78:                // @TODO Rewritings: sname->surname,fname->family in templates
-./inc/modules/admin/what-list_autopurge.php:98:        // @TODO Rewrite this constant
+./inc/modules/admin/what-list_autopurge.php:85:                // @TODO Rewritings: sname->surname,fname->family in templates
 ./inc/modules/admin/what-list_beg.php:85:                      // @TODO Rewrite templates so s/fname will be replaced by surname/family
 ./inc/modules/admin/what-list_beg.php:86:                      // @TODO to shorten this block. Please also do so with uid->userid
 ./inc/modules/admin/what-list_cats.php:92:                     // @TODO Rewrite this constant
 ./inc/modules/admin/what-list_rallyes.php:231:         // @TODO Rewrite this constant
 ./inc/modules/admin/what-list_rallyes.php:255:                 // @TODO Rewritings: uid->userid,opoints->curr_points,old->refs in template
 ./inc/modules/admin/what-list_rallyes.php:309:                 // @TODO Rewritings: aid->admin_id in template
-./inc/modules/admin/what-list_sponsor.php:155:                 // @TODO Rewritings: sname->surname,fname->family,ip->remote_addr in template
-./inc/modules/admin/what-list_sponsor.php:178:         // @TODO Rewrite this constant
+./inc/modules/admin/what-list_sponsor.php:168:                 // @TODO Rewritings: sname->surname,fname->family,ip->remote_addr in template
+./inc/modules/admin/what-list_sponsor.php:191:         // @TODO Rewrite this constant
 ./inc/modules/admin/what-list_sponsor.php:73:          // @TODO Rewrite this huge amount of constants
 ./inc/modules/admin/what-list_task.php:129:            // @TODO Rewrite these templates to one and add $OUT
 ./inc/modules/admin/what-list_task.php:164:                    // @TODO Rewritings: admin->assigned_admin,uid->userid,type->task_type_msg in template
 ./inc/modules/admin/what-list_task.php:176:                            // @TODO Rewrite this to $OUT .= ..., true, ...
 ./inc/modules/admin/what-list_task.php:180:                            // @TODO Rewrite this to $OUT .= ..., true, ...
 ./inc/modules/admin/what-list_transfer.php:83:// @TODO Rewrite these constants
-./inc/modules/admin/what-list_unconfirmed.php:116:                             // @TODO Rewritings: uid->userid
-./inc/modules/admin/what-list_unconfirmed.php:68:      // @TODO This constant might be unused?
-./inc/modules/admin/what-list_unconfirmed.php:80:      // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus
-./inc/modules/admin/what-list_unconfirmed.php:90:              // @TODO Rewrite this to $content = SQL_FETCHARRAY(), look some lines above for two differrent queries
+./inc/modules/admin/what-list_unconfirmed.php:128:                             // @TODO Rewritings: uid->userid
+./inc/modules/admin/what-list_unconfirmed.php:75:      // @TODO This constant might be unused?
+./inc/modules/admin/what-list_unconfirmed.php:87:      // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus
+./inc/modules/admin/what-list_unconfirmed.php:97:              // @TODO Rewrite this to $content = SQL_FETCHARRAY(), look some lines above for two differrent queries
 ./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-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:121:                              // @TODO This can be somehow rewritten to a function
-./inc/modules/admin/what-mem_add.php:63:               // @TODO Cant this be rewritten?
-./inc/modules/admin/what-mem_add.php:79:               // @TODO This can be somehow rewritten to a function
-./inc/modules/admin/what-memedit.php:252:              // @TODO Rewrite this constant
-./inc/modules/admin/what-memedit.php:288:              // @TODO Rewrite this constant
+./inc/modules/admin/what-mem_add.php:126:                              // @TODO This can be somehow rewritten to a function
+./inc/modules/admin/what-mem_add.php:65:               // @TODO Cant this be rewritten?
+./inc/modules/admin/what-mem_add.php:81:               // @TODO This can be somehow rewritten to a function
+./inc/modules/admin/what-memedit.php:262:              // @TODO Rewrite this constant
+./inc/modules/admin/what-memedit.php:298:              // @TODO Rewrite this constant
 ./inc/modules/admin/what-payments.php:154:                     // @TODO Rewritings: title->mail_title, pay->payment in template
 ./inc/modules/admin/what-refbanner.php:127:    // @TODO Rewrite this constant
 ./inc/modules/admin/what-refbanner.php:150:                    // @TODO Rewritings: alt->alternate,cnt->counter,clx->clicks in template
 ./inc/modules/guest/what-mediadata.php:186:// @TODO Rewrite these all if-blocks to filters
 ./inc/modules/guest/what-mediadata.php:49:// @TODO Rewrite all constants
 ./inc/modules/guest/what-mediadata.php:69:     // @TODO Find a better formular than this one
-./inc/modules/guest/what-register.php:196:     // @TODO Rewrite these all to a single filter
-./inc/modules/guest/what-register.php:273:     // @TODO Rewrite this to a filter
+./inc/modules/guest/what-register.php:208:     // @TODO Rewrite these all to a single filter
+./inc/modules/guest/what-register.php:286:     // @TODO Rewrite this to a filter
+./inc/modules/guest/what-register.php:60: * @TODO Commented out, do we need this ugly code?
 ./inc/modules/guest/what-sponsor_infos.php:67:         // @TODO Rewritings: conv->conv_rate,name->conv_name in template
 ./inc/modules/guest/what-sponsor_infos.php:87:                 // @TODO Rewritings: name->pay_name,min->pay_min_count,min->pay_min_count,curr->pay_currency
 ./inc/modules/guest/what-sponsor_reg.php:284:          // @TODO Swap this HTML code to templates
 ./inc/modules/member/what-bonus.php:55:        // @TODO Rewrite this to a filter
 ./inc/modules/member/what-categories.php:112:          // @TODO Rewrite this to use $OUT .= ...
 ./inc/modules/member/what-mydata.php:53:// @TODO Try to rewrite this constant
-./inc/modules/member/what-order.php:411:                       // @TODO Rewrite this to a filter
-./inc/modules/member/what-order.php:506:                                        // @TODO Rewrite this old lost code to a template
+./inc/modules/member/what-nickname.php:87:     // @TODO Rewrite this constant
+./inc/modules/member/what-order.php:444:                       // @TODO Rewrite this to a filter
+./inc/modules/member/what-order.php:543:                                               // @TODO Rewrite this old lost code to a template
 ./inc/modules/member/what-payout.php:132:                              // @TODO Rewritings: acc->target_account,bank->target_bank in templates
 ./inc/modules/member/what-payout.php:148:                      // @TODO Rewrite this constant
 ./inc/modules/member/what-payout.php:182:              // @TODO Rewrite these constants
 ./inc/modules/member/what-payout.php:235:                                      // @TODO Rewrite this to a filter
 ./inc/modules/member/what-points.php:54:// @TODO Should we rewrite this to a filter?
 ./inc/modules/member/what-reflinks.php:105:            // @TODO Rewritings: alt->alternate,cnt->counter,cks->clicks,uid->userid in template
-./inc/modules/member/what-transfer.php:116:                            // @TODO Rewrite all these constants to array elements
-./inc/modules/member/what-transfer.php:247:                            // @TODO Try to rewrite his to $content = SQL_FETCHARRAY(), see some lines above for two different queries
-./inc/modules/member/what-transfer.php:309:                            // @TODO Rewrite these constants
-./inc/modules/member/what-transfer.php:317:                            // @TODO Rewrite these constants
-./inc/modules/member/what-transfer.php:329:                    // @TODO This should be somehow rewritten to $content = SQL_FETCHARRAY(), see switch() block above for SQL queries
-./inc/modules/member/what-transfer.php:364:            // @TODO Rewrite these constants
-./inc/modules/member/what-transfer.php:451:                            // @TODO Rewrite all these constants
+./inc/modules/member/what-transfer.php:115:                            // @TODO Rewrite all these constants to array elements
+./inc/modules/member/what-transfer.php:246:                            // @TODO Try to rewrite his to $content = SQL_FETCHARRAY(), see some lines above for two different queries
+./inc/modules/member/what-transfer.php:308:                            // @TODO Rewrite these constants
+./inc/modules/member/what-transfer.php:316:                            // @TODO Rewrite these constants
+./inc/modules/member/what-transfer.php:328:                    // @TODO This should be somehow rewritten to $content = SQL_FETCHARRAY(), see switch() block above for SQL queries
+./inc/modules/member/what-transfer.php:363:            // @TODO Rewrite these constants
+./inc/modules/member/what-transfer.php:450:            // @TODO Rewrite all these constants
 ./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
 ./mailid_top.php:223:                                                                  // @TODO Rewrite these constants
 ./mailid_top.php:228:                                                                  // @TODO Rewrite these blocks to filter
 ./mailid_top.php:89:           // @TODO Rewrite this to a filter
-./show_bonus.php:104:                  // @TODO Rewrite this constant
+./show_bonus.php:108:                  // @TODO Rewrite this constant
 ./surfbar.php:73:      // @TODO Display quick login form here or redirect as configured
 ### ### DEPRECATION FOLLOWS: ### ###
 ./inc/functions.php:238:       // @DEPRECATED Try to rewrite the if() condition
diff --git a/beg.php b/beg.php
index cdfbfc7..e92a8f1 100644 (file)
--- a/beg.php
+++ b/beg.php
@@ -74,8 +74,8 @@ if (REQUEST_ISSET_GET('uid')) {
        if (''.(REQUEST_GET('uid') + 0).'' !== ''.REQUEST_GET('uid').'') {
                if (EXT_IS_ACTIVE('nickname')) {
                        // Maybe we have found a nickname?
-                       $result = SQL_QUERY_ESC("SELECT userid, beg_clicks, ref_payout, status, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1",
-                       array(REQUEST_GET('uid')), __FILE__, __LINE__);
+                       $result = SQL_QUERY_ESC("SELECT `userid`, `beg_clicks`, `ref_payout`, `status`, `last_online` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nickname`='%s' LIMIT 1",
+                               array(REQUEST_GET('uid')), __FILE__, __LINE__);
                } else {
                        // Nickname entered but nickname is not active
                        $msg = getCode('EXTENSION_PROBLEM');
@@ -83,8 +83,8 @@ if (REQUEST_ISSET_GET('uid')) {
                }
        } else {
                // Direct userid
-               $result = SQL_QUERY_ESC("SELECT userid, beg_clicks, ref_payout, status, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-               array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `userid`, `beg_clicks`, `ref_payout`, `status`, `last_online` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+                       array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
        }
 
        // Check if locked in so don't pay points
@@ -122,8 +122,8 @@ if (REQUEST_ISSET_GET('uid')) {
        // User id valid and not webmaster's id?
        if (($uid > 0) && (getConfig('beg_uid') != $uid)) {
                // Update counter
-               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET beg_clicks=beg_clicks+1 WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
-               array($uid), __FILE__, __LINE__);
+               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `beg_clicks`=`beg_clicks`+1 WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
+                       array($uid), __FILE__, __LINE__);
 
                // Check for last entry for userid w/o IP number
                $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_beg_ips` WHERE (timeout > (UNIX_TIMESTAMP() - ".getConfig('beg_timeout').") OR (timeout > (UNIX_TIMESTAMP() - ".getConfig('beg_uid_timeout').") AND `userid`=%s)) AND (remote_ip='%s' OR sid='%s') LIMIT 1",
index d1284ae..c018d59 100644 (file)
@@ -66,11 +66,16 @@ $chk = bigintval(REQUEST_GET('check'), false);
 
 // Check if link is not clicked so far
 $result = SQL_QUERY_ESC("SELECT b.points, d.gender, d.surname, d.family, d.status, d.ref_payout
-FROM `{!_MYSQL_PREFIX!}_user_birthday` AS b
-INNER JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
-ON b.userid=d.userid
-WHERE b.userid=%s AND b.chk_value='%s' LIMIT 1",
-array($uid, $chk), __FILE__, __LINE__);
+FROM
+       `{!_MYSQL_PREFIX!}_user_birthday` AS b
+INNER JOIN
+       `{!_MYSQL_PREFIX!}_user_data` AS d
+ON
+       b.userid=d.userid
+WHERE
+       b.userid=%s AND b.chk_value='%s'
+LIMIT 1",
+       array($uid, $chk), __FILE__, __LINE__);
 //* DEBUG: */ echo "uid=".$uid.",chk=".$chk." (".strlen($chk).'/'.strlen(REQUEST_GET('check')).'/'.SQL_NUMROWS($result).")<br />\n";
 
 // Prepare content
index 8dfc9d4..f7e28dc 100644 (file)
--- a/debug.php
+++ b/debug.php
@@ -55,13 +55,13 @@ if ((isInstalled()) && (getTotalFatalErrors() == 0)) {
        } // END - if
 
        // Is the request parameter set?
-       if (REQUEST_ISSET_POST(('request'))) {
+       if (REQUEST_ISSET_POST('request')) {
                // Handle the request
                if (DEBUG_HANDLE_REQUEST(REQUEST_POST('request'))) {
                        // Construct FQFN for the module
                        $INC = sprintf("inc/debug/%s/request_%s",
-                       getConfig('debug_mode'),
-                       SQL_ESCAPE(REQUEST_POST('request'))
+                               getConfig('debug_mode'),
+                               SQL_ESCAPE(REQUEST_POST('request'))
                        );
 
                        // Is the module there? Else we log it!
index 3a3cb93..03a2e58 100644 (file)
@@ -60,19 +60,19 @@ if (!isInstalled()) {
 } // END - if
 
 // Probe for referal ID
-if (REQUEST_ISSET_GET(('refid'))) $GLOBALS['refid'] = REQUEST_GET(('refid'));
+if (REQUEST_ISSET_GET('refid')) $GLOBALS['refid'] = REQUEST_GET('refid');
 
 // Only check this if refid is provided!
 if ($GLOBALS['refid'] > 0) {
        // Do we have nickname or userid set?
        if (isNicknameUsed($GLOBALS['refid'])) {
                // Nickname in URL, so load the ID
-               $result = SQL_QUERY_ESC("SELECT userid, status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1",
-               array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `userid`, `status` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nickname`='%s' LIMIT 1",
+                       array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
        } else {
                // Direct userid entered
-               $result = SQL_QUERY_ESC("SELECT userid, status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-               array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT userid, status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+                       array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
        }
 
        // Load data
@@ -98,16 +98,16 @@ if (isFormSent()) {
        REQUEST_SET_POST('points', bigintval(REQUEST_POST('points')));
 
        // Begin with doubling process
-       if ((REQUEST_ISSET_POST(('userid'))) && (REQUEST_ISSET_POST(('pass'))) && (REQUEST_ISSET_POST(('points')))) {
+       if ((REQUEST_ISSET_POST('userid')) && (REQUEST_ISSET_POST('pass')) && (REQUEST_ISSET_POST('points'))) {
                // Probe for nickname extension and if a nickname was entered
                if (isNickNameUsed(REQUEST_POST('userid'))) {
                        // Nickname in URL, so load the ID
-                       $result = SQL_QUERY_ESC("SELECT userid, status, password FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1",
-                       array(REQUEST_POST('userid')), __FILE__, __LINE__);
+                       $result = SQL_QUERY_ESC("SELECT `userid`, `status`, `password` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nickname`='%s' LIMIT 1",
+                               array(REQUEST_POST('userid')), __FILE__, __LINE__);
                } else {
                        // Direct userid entered
-                       $result = SQL_QUERY_ESC("SELECT userid, status, password FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-                       array(bigintval(REQUEST_POST('userid'))), __FILE__, __LINE__);
+                       $result = SQL_QUERY_ESC("SELECT `userid`, `status, `password` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+                               array(bigintval(REQUEST_POST('userid'))), __FILE__, __LINE__);
                }
 
                // Load data
@@ -135,8 +135,8 @@ if (isFormSent()) {
                        if (($points - getConfig('doubler_left') - REQUEST_POST('points') * getConfig('doubler_charge')) >= 0)
                                // Enough points are left so let's continue with the doubling process
                                // Create doubling "account" width *DOUBLED* points
-                               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_doubler` (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s','%s','%s','".detectRemoteAddr()."', UNIX_TIMESTAMP(), 'N','N')",
-                               array($uid, bigintval($GLOBALS['refid']), bigintval(REQUEST_POST('points') * 2)), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES ('%s','%s','%s','".detectRemoteAddr()."', UNIX_TIMESTAMP(), 'N','N')",
+                                       array($uid, bigintval($GLOBALS['refid']), bigintval(REQUEST_POST('points') * 2)), __FILE__, __LINE__);
 
                                // Subtract entered points
                                SUB_POINTS('doubler', $uid, REQUEST_POST('points'));
@@ -149,11 +149,11 @@ if (isFormSent()) {
                                // Add second line for the referal but only when uid != refid
                                if (($GLOBALS['refid'] > 0) && ($GLOBALS['refid'] != $uid)) {
                                        // Okay add a refid line and apply refid percents
-                                       SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_doubler` (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s',0,'%s','".detectRemoteAddr()."',UNIX_TIMESTAMP(),'N','Y')",
-                                       array(
-                                               bigintval($GLOBALS['refid']),
-                                               bigintval(REQUEST_POST('points') * 2 * getConfig('doubler_ref'))
-                                       ), __FILE__, __LINE__);
+                                       SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES ('%s',0,'%s','".detectRemoteAddr()."',UNIX_TIMESTAMP(),'N','Y')",
+                                               array(
+                                                       bigintval($GLOBALS['refid']),
+                                                       bigintval(REQUEST_POST('points') * 2 * getConfig('doubler_ref'))
+                                               ), __FILE__, __LINE__);
 
                                        // And that's why we don't want to you more than one referal level of doubler-points. ^^^
                                } // END - if
@@ -189,13 +189,13 @@ if (isFormSent()) {
                        // Wrong password or account not found
                        define('__ERROR_MSG', getMessage('DOUBLER_FORM_404_MEMBER'));
                }
-       } elseif (!REQUEST_ISSET_POST(('userid'))) {
+       } elseif (!REQUEST_ISSET_POST('userid')) {
                // Login not entered
                define('__ERROR_MSG', getMessage('DOUBLER_FORM_404_LOGIN'));
-       } elseif (!REQUEST_ISSET_POST(('pass'))) {
+       } elseif (!REQUEST_ISSET_POST('pass')) {
                // Password not entered
                define('__ERROR_MSG', getMessage('DOUBLER_FORM_404_PASSWORD'));
-       } elseif (!REQUEST_ISSET_POST(('points'))) {
+       } elseif (!REQUEST_ISSET_POST('points')) {
                // points not entered
                define('__ERROR_MSG', getMessage('DOUBLER_FORM_404_POINTS'));
        }
diff --git a/img.php b/img.php
index adaa3e2..fb384e8 100644 (file)
--- a/img.php
+++ b/img.php
@@ -56,13 +56,13 @@ if (!isInstalled()) {
 loadIncludeOnce('inc/header.php');
 
 // Code set?
-if (REQUEST_ISSET_GET(('code'))) {
+if (REQUEST_ISSET_GET('code')) {
        // Generate image
        GENERATE_IMAGE(bigintval(REQUEST_GET('code')));
 } elseif (REQUEST_ISSET_GET('tag')) {
        // Tag set so create the IFN (Include-FileName)
        $INC = sprintf("inc/img/tag-%s.php",
-       REQUEST_GET('tag')
+               REQUEST_GET('tag')
        );
 
        // Include is readable?
index fc75e5f..17a6417 100644 (file)
@@ -53,9 +53,6 @@ if (getConfig('autopurge_inactive') == 'Y') {
        // Init SQLs
        INIT_SQLS();
 
-       // Ok, let's have a look...
-       $since = getConfig(('ap_inactive_since'));
-
        // Init exclusion list
        $EXCLUDE_LIST = '';
        if (getConfig('def_refid') > 0) {
@@ -78,7 +75,12 @@ if (getConfig('autopurge_inactive') == 'Y') {
 FROM `{!_MYSQL_PREFIX!}_user_data` AS d
 WHERE d.`status`='CONFIRMED' AND d.joined < (UNIX_TIMESTAMP() - %s) AND d.last_online < (UNIX_TIMESTAMP() - %s) AND d.ap_notified < (UNIX_TIMESTAMP() - %s)
 ".$EXCLUDE_LIST."
-ORDER BY d.userid", array($since, $since, $since), __FILE__, __LINE__);
+ORDER BY d.userid",
+               array(,
+                       getConfig('ap_inactive_since'),
+                       getConfig('ap_inactive_since'),
+                       getConfig('ap_inactive_since')
+               ), __FILE__, __LINE__);
 
        if (SQL_NUMROWS($result_inactive) > 0) {
                // Prepare variables and constants...
@@ -99,15 +101,15 @@ ORDER BY d.userid", array($since, $since, $since), __FILE__, __LINE__);
                        sendEmail($content['email'], getMessage('AUTOPURGE_MEMBER_INACTIVE_SUBJECT'), $msg);
 
                        // Update this account
-                       ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ap_notified=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1",
-                       array(bigintval($content['userid'])), __FILE__, __LINE__, false));
+                       ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `ap_notified`=UNIX_TIMESTAMP() WHERE `userid`=%s LIMIT 1",
+                               array(bigintval($content['userid'])), __FILE__, __LINE__, false));
                } // END - while
 
                // Remove last comma
                $UIDs = str_replace(", ", "\n", substr($UIDs, 0, -2));
 
                // Send mail notification to admin
-               sendAdminNotification(getMessage('AUTOPURGE_ADMIN_INACTIVE_SUBJECT'), "admin_autopurge_inactive", $UIDs, '');
+               sendAdminNotification(getMessage('AUTOPURGE_ADMIN_INACTIVE_SUBJECT'), 'admin_autopurge_inactive', $UIDs, '');
        } // END - if
 
        // Free memory
@@ -115,13 +117,17 @@ ORDER BY d.userid", array($since, $since, $since), __FILE__, __LINE__);
 
        // Now let's have a look for inactive accounts we want to delete we newly use the same exclude list
        // here for e.g. excluding holiday users
-       $time = getConfig(('ap_in_time'));
        $result_inactive = SQL_QUERY_ESC("SELECT d.userid, d.email, d.last_online
 FROM `{!_MYSQL_PREFIX!}_user_data` AS d
-WHERE `status`='CONFIRMED' AND joined < (UNIX_TIMESTAMP() - %s) AND `last_online` < (UNIX_TIMESTAMP() - %s) AND ap_notified < (UNIX_TIMESTAMP() - %s)
+WHERE `status`='CONFIRMED' AND `joined` < (UNIX_TIMESTAMP() - %s) AND `last_online` < (UNIX_TIMESTAMP() - %s) AND `ap_notified` < (UNIX_TIMESTAMP() - %s)
 ".$EXCLUDE_LIST."
 ORDER BY `userid` ASC",
-       array($since, $since, $time), __FILE__, __LINE__);
+               array(
+                       getConfig('ap_inactive_since'),
+                       getConfig('ap_inactive_since'),
+                       getConfig('ap_in_time')
+               ), __FILE__, __LINE__);
+
        if (SQL_NUMROWS($result_inactive) > 0) {
                // Prepare variable...
                $UIDs = '';
@@ -129,13 +135,13 @@ ORDER BY `userid` ASC",
                // Delete inactive accounts
                while ($content = SQL_FETCHARRAY($result_inactive)) {
                        // Remember userids for the admin
-                       $UIDs .= $content['userid'].", ";
+                       $UIDs .= $content['userid'] . ', ';
 
                        // Get date/time from timestamp
                        $content['last_online'] = generateDateTime($content['last_online'], '0');
 
                        // Finnaly delete this inactive account
-                       deleteUserAccount($content['userid'], LOAD_EMAIL_TEMPLATE("member_autopurge_delete", $content['last_online'], ''));
+                       deleteUserAccount($content['userid'], LOAD_EMAIL_TEMPLATE('member_autopurge_delete', $content['last_online'], ''));
                } // END - while
 
                // Remove last comma
@@ -143,7 +149,7 @@ ORDER BY `userid` ASC",
 
                // Send mail notification to admin
                if (getConfig('ap_in_notify') == 'Y') {
-                       sendAdminNotification(getMessage('AUTOPURGE_ADMIN_DELETE_SUBJECT'), "admin_autopurge_delete", $UIDs, '');
+                       sendAdminNotification(getMessage('AUTOPURGE_ADMIN_DELETE_SUBJECT'), 'admin_autopurge_delete', $UIDs, '');
                } // END - if
        } // END - if
 
index 49d13c9..9cdfc62 100644 (file)
@@ -51,12 +51,11 @@ if ((!EXT_IS_ACTIVE('autopurge')) || (getConfig('auto_purge_active') != 'Y')) {
 // Search for mails from deleted members?
 if (getConfig('ap_del_mails') == 'Y') {
        // Okay, let's check for them...
-       $since = getConfig(('ap_dm_timeout'));
-       $result_mails = SQL_QUERY_ESC("SELECT sender
+       $result_mails = SQL_QUERY_ESC("SELECT `sender`
 FROM `{!_MYSQL_PREFIX!}_pool`
-WHERE data_type='DELETED' AND timestamp <= (UNIX_TIMESTAMP() - %s)
-ORDER BY sender ASC",
-       array($since), __FILE__, __LINE__);
+WHERE data_type='DELETED' AND `timestamp` <= (UNIX_TIMESTAMP() - %s)
+ORDER BY `sender` ASC",
+               array(getConfig('ap_dm_timeout')), __FILE__, __LINE__);
 
        // Reset counter...
        $DELETED = 0;
@@ -66,21 +65,20 @@ ORDER BY sender ASC",
                // Okay, check for their sender's
                while ($content = SQL_FETCHARRAY($result_mails)) {
                        // Check now...
-                       $fount = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+                       $fount = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
                        array(bigintval($content['sender'])), __FILE__, __LINE__));
                        if ($found == 0) {
                                // Okay we found some mails!
-                               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_pool` WHERE sender=%s",
-                               array(bigintval($content['sender'])), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_pool` WHERE `sender`=%s",
+                                       array(bigintval($content['sender'])), __FILE__, __LINE__);
                                $DELETED += SQL_AFFECTEDROWS();
 
-                               // Reset query (to prevent possible errors) ...
-                               $since = getConfig(('ap_dm_timeout'));
-                               $result_mails = SQL_QUERY_ESC("SELECT sender
+                               // 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)
-ORDER BY sender ASC",
-                               array($since), __FILE__, __LINE__);
+ORDER BY `sender` ASC",
+                                       array(getConfig('ap_dm_timeout')), __FILE__, __LINE__);
                        }
                }
        }
@@ -88,32 +86,32 @@ ORDER BY sender ASC",
        // Free memory
        SQL_FREERESULT($result_mails);
 
-       // Now let's check for stats entries as well
-       $since = getConfig(('ap_dm_timeout'));
-       $result_mails = SQL_QUERY_ESC("SELECT sender
+       // Now let's check for stats entries as well;
+       $result_mails = SQL_QUERY_ESC("SELECT `sender`
 FROM `{!_MYSQL_PREFIX!}_user_stats`
-WHERE data_type='DELETED' AND timestamp_send <= (UNIX_TIMESTAMP() - %s)
-ORDER BY sender ASC",
-       array($since), __FILE__, __LINE__);
+WHERE `data_type`='DELETED' AND `timestamp_send` <= (UNIX_TIMESTAMP() - %s)
+ORDER BY `sender` ASC",
+               array(getConfig('ap_dm_timeout')), __FILE__, __LINE__);
 
        // Do we have "purged" mails?
        if (SQL_NUMROWS($result_mails) > 0) {
                // Okay, check for their sender's
                while ($content = SQL_FETCHARRAY($result_mails)) {
                        // Check now...
-                       $found = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", array(bigintval($content['sender'])), __FILE__, __LINE__));
+                       $found = SQL_NUMROWS(SQL_QUERY_ESC("SELECT `userid` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+                               array(bigintval($content['sender'])), __FILE__, __LINE__));
                        if ($found == 0) {
                                // Okay we found some mails!
-                               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE sender=%s", array(bigintval($content['sender'])), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `sender`=%s",
+                                       array(bigintval($content['sender'])), __FILE__, __LINE__);
                                $DELETED += SQL_AFFECTEDROWS();
 
                                // Reset query (to prevent possible errors) ...
-                               $since = getConfig(('ap_dm_timeout'));
-                               $result_mails = SQL_QUERY_ESC("SELECT sender
+                               $result_mails = SQL_QUERY_ESC("SELECT `sender`
 FROM `{!_MYSQL_PREFIX!}_user_stats`
 WHERE data_type='DELETED' AND timestamp_send <= (UNIX_TIMESTAMP() - %s)
-ORDER BY sender ASC",
-                               array($since), __FILE__, __LINE__);
+ORDER BY `sender` ASC",
+                                       array(getConfig('ap_dm_timeout')), __FILE__, __LINE__);
                        }
                }
        }
@@ -124,7 +122,7 @@ ORDER BY sender ASC",
        // Do we have deleted mails and the admin want's to receive a notification
        if (($DELETED > 0) && (getConfig('ap_dm_notify') == 'Y')) {
                // Send out email to admin
-               sendAdminNotification(getMessage('AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT'), "admin_autopurge_del_mails", $DELETED, '');
+               sendAdminNotification(getMessage('AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT'), 'admin_autopurge_del_mails', $DELETED, '');
        } // END - if
 }
 
index f596a86..51d7c36 100644 (file)
@@ -50,14 +50,11 @@ if ((!EXT_IS_ACTIVE('autopurge')) || (getConfig('auto_purge_active') != 'Y')) {
 
 // Check version (must be > 0.0)
 if ((GET_EXT_VERSION('task') > '0.0') && (getConfig('ap_tasks') == 'Y')) {
-       // Since when shall we purge?
-       $since = getConfig(('ap_tasks_time'));
-
        // Purge deleted tasks (no notification to admin)
        SQL_QUERY_ESC("DELETE LOW_PRIORITY
 FROM `{!_MYSQL_PREFIX!}_task_system`
-WHERE `status`='DELETED' AND task_created <= (UNIX_TIMESTAMP() - %s)",
-       array($since), __FILE__, __LINE__);
+WHERE `status`='DELETED' AND `task_created` <= (UNIX_TIMESTAMP() - %s)",
+               array(getConfig('ap_tasks_time')), __FILE__, __LINE__);
 
        // Get deleted rows
        $DELETED = SQL_AFFECTEDROWS();
index a31d7b6..617a590 100644 (file)
@@ -50,13 +50,12 @@ if ((!EXT_IS_ACTIVE('autopurge')) || (getConfig('auto_purge_active') != 'Y')) {
 
 // Shall I auto-purge unconfirmed accounts?
 if (getConfig('autopurge_unconfirmed') == 'Y') {
-       // Init variables and find unconfirmed accounts which I shall auto-purge
-       $time = getConfig(('ap_un_time'));
-       $result_uncon = SQL_QUERY_ESC("SELECT userid, email, joined
+       // Init variables and find unconfirmed accounts which I shall auto-purge;
+       $result_uncon = SQL_QUERY_ESC("SELECT `userid`, `email`, `joined`
 FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='UNCONFIRMED' AND joined < (UNIX_TIMESTAMP() - %s)
-ORDER BY userid ASC",
-       array($time), __FILE__, __LINE__);
+WHERE `status`='UNCONFIRMED' AND `joined` < (UNIX_TIMESTAMP() - %s)
+ORDER BY `userid` ASC",
+               array(getConfig('ap_un_time')), __FILE__, __LINE__);
        if (SQL_NUMROWS($result_uncon) > 0) {
                // Prepare variable...
                $UIDs = '';
@@ -65,13 +64,13 @@ ORDER BY userid ASC",
                // Delete inactive accounts
                while ($content = SQL_FETCHARRAY($result_uncon)) {
                        // Remember userids for the admin
-                       $UIDs .= $content['userid'].", ";
+                       $UIDs .= $content['userid'] . ', ';
 
                        // Get date/time from timestamp
                        $content['joined'] = generateDateTime($content['joined'], '0');
 
                        // Finnaly delete this inactive account
-                       deleteUserAccount($content['userid'], LOAD_EMAIL_TEMPLATE("member_autopurge_unconfirmed", $content['joined'], ''));
+                       deleteUserAccount($content['userid'], LOAD_EMAIL_TEMPLATE('member_autopurge_unconfirmed', $content['joined'], ''));
                } // END - while
 
                // Remove last comma
@@ -79,7 +78,7 @@ ORDER BY userid ASC",
 
                // Send mail notification to admin
                if (getConfig('ap_un_notify') == 'Y') {
-                       sendAdminNotification(getMessage('AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT'), "admin_autopurge_unconfirmed", $UIDs, '');
+                       sendAdminNotification(getMessage('AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT'), 'admin_autopurge_unconfirmed', $UIDs, '');
                } // END - if
        } // END - if
 
index b6d315c..909332b 100644 (file)
@@ -43,8 +43,8 @@ if (!defined('__SECURITY')) {
 }
 
 // Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
-// 01    2              3             32        2         3321    1             221    1           221    1                 221    1                  23          321    1                            10
-if ((date('d', getConfig('last_update')) != date('d', time())) && (!isInstalling()) && (isInstalled()) && (isAdminRegistered()) && (!REQUEST_ISSET_GET(('register'))) && (getOutputMode() != 1)) {
+// 01    2              3             32        2         3321    1             221    1           221    1                 221    1                  2          21    1             22     10
+if ((date('d', getConfig('last_update')) != date('d', time())) && (!isInstalling()) && (isInstalled()) && (isAdminRegistered()) && (!REQUEST_ISSET_GET('register')) && (getOutputMode() != 1)) {
        // Tell every module we are in reset-mode!
        enableResetMode();
 
index 2adf9c0..e07cd40 100644 (file)
@@ -227,11 +227,12 @@ function SQL_CLOSE ($F, $L) {
                incrementConfigEntry('db_hits', getConfig('db_hits_run'));
 
                // Update counter for db/cache
-               updateConfiguration(array('db_hits', 'cache_hits'), array(getConfig(('db_hits')), getConfig(('cache_hits'))));
+               updateConfiguration(array('db_hits', 'cache_hits'), array(getConfig('db_hits'), getConfig('cache_hits')));
        } // END - if
 
        // Close database link and forget the link
-       $close = mysql_close(SQL_GET_LINK()) or addFatalMessage(__FUNCTION__, __LINE__, $F." (".$L."):".mysql_error());
+       $close = mysql_close(SQL_GET_LINK())
+               or addFatalMessage(__FUNCTION__, __LINE__, $F . ' (' . $L . '):'.mysql_error());
 
        // Close link
        SQL_SET_LINK(null);
@@ -260,15 +261,15 @@ function SQL_QUERY_ESC ($qstring, $data, $F, $L, $run=true, $strip=true, $secure
        $query = 'failed';
 
        if ($strip === true) {
-               $strip = "true";
+               $strip = 'true';
        } else {
-               $strip = "false";
+               $strip = 'false';
        }
 
        if ($secure === true) {
-               $secure = "true";
+               $secure = 'true';
        } else {
-               $secure = "false";
+               $secure = 'false';
        }
 
        $eval = "\$query = sprintf(\"".$qstring."\"";
@@ -280,7 +281,7 @@ function SQL_QUERY_ESC ($qstring, $data, $F, $L, $run=true, $strip=true, $secure
                }
        } // END - foreach
        $eval .= ");";
-       //
+
        // Debugging
        //
        //* DEBUG: */ $fp = fopen(constant('PATH')."inc/cache/escape_debug.log", 'a') or app_die(__FILE__, __LINE__, "Cannot write debug.log!");
@@ -293,7 +294,7 @@ function SQL_QUERY_ESC ($qstring, $data, $F, $L, $run=true, $strip=true, $secure
        // Was the eval() command fine?
        if ($query == 'failed') {
                // Something went wrong?
-               debug_report_bug("eval={$eval}");
+               debug_report_bug('eval=' . $eval);
        } // END - if
 
        if ($run === true) {
@@ -364,11 +365,11 @@ function SQL_ALTER_TABLE ($sql, $F, $L) {
        // Determine index/fulltext/unique word
        $noIndex = (
        (
-       strpos($sql, 'INDEX') === false
+               strpos($sql, 'INDEX') === false
        ) && (
-       strpos($sql, 'FULLTEXT') === false
+               strpos($sql, 'FULLTEXT') === false
        ) && (
-       strpos($sql, 'UNIQUE') === false
+               strpos($sql, 'UNIQUE') === false
        )
        );
 
@@ -382,8 +383,8 @@ function SQL_ALTER_TABLE ($sql, $F, $L) {
                $columnName = str_replace('`', '', $tableArray[4]);
 
                // Get column information
-               $result = SQL_QUERY_ESC("SHOW COLUMNS FROM %s LIKE '%s'",
-               array($tableName, $columnName), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SHOW COLUMNS FROM `%s` LIKE '%s'",
+                       array($tableName, $columnName), __FILE__, __LINE__);
 
                // Do we have no entry on ADD or an entry on DROP?
                // 123           4       4     3    3      4           4          32    23           4       4     3    3      4            4          321
@@ -419,7 +420,7 @@ function SQL_ALTER_TABLE ($sql, $F, $L) {
 
                // Show indexes
                $result = SQL_QUERY_ESC("SHOW INDEX FROM `%s`",
-               array($tableName), __FILE__, __LINE__);
+                       array($tableName), __FILE__, __LINE__);
 
                // Walk through all
                $skip = false;
index 6e21b9d..7bb1b94 100644 (file)
@@ -59,13 +59,16 @@ setSession('DOUBLER_UID', '');
 if (empty($GLOBALS['doubler_uid'])) $GLOBALS['doubler_uid'] = 0;
 
 // Check for doubles which we can pay out
-$min = getConfig(('doubler_min') * 2);
 $result_total = SQL_QUERY_ESC("SELECT DISTINCT d.id, d.userid, d.points, d.remote_ip, d.timemark
 FROM `{!_MYSQL_PREFIX!}_doubler` AS d
 LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS u
 ON d.userid=u.userid
 WHERE u.`status`='CONFIRMED' AND d.points <= %s AND d.points >= %s AND d.completed='N' AND d.is_ref='N'
-ORDER BY d.timemark", array($DOUBLER_POINTS, $min), __FILE__, __LINE__);
+ORDER BY d.timemark",
+       array(
+               $DOUBLER_POINTS,
+               getConfig(('doubler_min') * 2)
+       ), __FILE__, __LINE__);
 
 // Check for accounts with limitation
 $result_main = SQL_QUERY_ESC("SELECT DISTINCT d.id, d.userid, d.points, d.remote_ip, d.timemark
@@ -74,7 +77,12 @@ LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS u
 ON d.userid=u.userid
 WHERE u.`status`='CONFIRMED' AND d.points <= %s AND d.points >= %s AND d.completed='N' AND d.is_ref='N'
 ORDER BY d.timemark
-LIMIT %d", array($DOUBLER_POINTS, $min, getConfig('doubler_max_sent')), __FILE__, __LINE__);
+LIMIT %d",
+       array(
+               $DOUBLER_POINTS,
+               getConfig(('doubler_min') * 2),
+               getConfig('doubler_max_sent')
+       ), __FILE__, __LINE__);
 
 // Do we have entries found?
 if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == 'Y')) || ((SQL_NUMROWS($result_main) == getConfig('doubler_group_sent')) && (getConfig('doubler_sent_all') != 'Y'))) {
@@ -87,15 +95,15 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == 'Y'))
                // Only double when points are enougth!
                if ($DOUBLER_POINTS >= $content['points']) {
                        // Check for his ref points
-                       $ref = GET_TOTAL_DATA($content['userid'], 'doubler', 'points', 'refid', false, " AND completed='N' AND is_ref='Y'");
+                       $ref = GET_TOTAL_DATA($content['userid'], 'doubler', 'points', 'refid', false, " AND `completed`='N' AND `is_ref`='Y'");
 
                        // Zero refid when empty (might be helpful!)
                        if (empty($ref)) $ref = 0;
                        if (($ref > 0) && ($GLOBALS['doubler_uid'] == $content['userid']) && (!empty($ref))) {
                                // Referal points found so add them and set line(s) to completed='Y'
                                $content['points'] += $ref;
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_doubler` SET completed='Y' WHERE refid=%s AND completed='N' AND is_ref='Y'",
-                               array(bigintval($content['userid'])), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_doubler` SET `completed`='Y' WHERE `refid`=%s AND `completed`='N' AND `is_ref`='Y'",
+                                       array(bigintval($content['userid'])), __FILE__, __LINE__);
                        } else {
                                // No referal points found
                                $ref = 0;
@@ -108,10 +116,11 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == 'Y'))
                        } // END - if
 
                        // Set entry as "payed"
-                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_doubler` SET completed='Y' WHERE `id`=%s LIMIT 1",
-                       array(bigintval($content['id'])), __FILE__, __LINE__);
+                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_doubler` SET `completed`='Y' WHERE `id`=%s LIMIT 1",
+                               array(bigintval($content['id'])), __FILE__, __LINE__);
 
                        $okay = false;
+
                        // Check for jackpot inclusion in doubling process
                        if (($jackpot > 0) && ($jackpot >= $content['points']) && (getConfig('doubler_jackpot') == 'Y')) {
                                // Subtract points from jackpot
@@ -123,16 +132,16 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == 'Y'))
                        } // END - if
 
                        // Exclude also webmaster's ID in taking points from webmaster's account
-                       if (($user > 0) && ($user >= $content['points']) && (!$okay) && (getConfig('doubler_uid') > 0) && ($content['userid'] != getConfig('doubler_uid'))) {
+                       if (($user > 0) && ($user >= $content['points']) && ($okay === false) && (getConfig('doubler_uid') > 0) && ($content['userid'] != getConfig('doubler_uid'))) {
                                // Add points to used points
-                               SUB_POINTS("doubler_payout", getConfig('doubler_uid'), $content['points']);
+                               SUB_POINTS('doubler_payout', getConfig('doubler_uid'), $content['points']);
 
                                // Okay, done!
                                $okay = true;
                        } // END - if
 
                        // Update doubler's account only when others are not updated
-                       if (!$okay) {
+                       if ($okay === false) {
                                // Add points to used doubler points
                                updateConfiguration('doubler_used', $content['points'], '+');
                        } // END - if
@@ -143,18 +152,18 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == 'Y'))
 
                        // Prepare array
                        $content = array(
-                       // Doubler transmission ID
+                               // Doubler transmission ID
                                'id'     => $content['id'],
-                       // Doubled points
+                               // Doubled points
                                'points' => translateComma($content['points']),
-                       // Timemark
+                               // Timemark
                                'when'   => generateDateTime($content['timemark'], '2'),
-                       // IP number when the member submitted the doubling form
+                               // IP number when the member submitted the doubling form
                                'ip'     => $content['remote_ip'],
                        );
 
                        // Load mail template and send mail away...
-                       $msg = LOAD_EMAIL_TEMPLATE("member_doubler", $content, $content['userid']);
+                       $msg = LOAD_EMAIL_TEMPLATE('member_doubler', $content, $content['userid']);
                        sendEmail($content['userid'], getMessage('DOUBLER_MEMBER_SUBJECT'), $msg);
                } // END - if
        } // END - while
index d532c23..5f9fa66 100644 (file)
@@ -205,7 +205,7 @@ function unregisterFilter ($filterName, $filterFunction, $force = false, $dry_ru
 }
 
 // "Runs" the given filters, data is optional and can be any type of data
-function runFilterChain ($filterName, $data = null, $silentAbort = true) {
+function runFilterChain ($filterName, $data = null) {
        // Is that filter chain there?
        if (!isset($GLOBALS['filters']['chains'][$filterName])) {
                // We should find all these non-existing filter chains
index f55f513..fb13419 100644 (file)
@@ -393,14 +393,16 @@ function sendEmail ($toEmail, $subject, $message, $HTML = 'N', $mailHeader = '')
        eval($eval);
 
        // Set from header
-       if ((!eregi("@", $toEmail)) && ($toEmail > 0)) {
+       if ((!eregi('@', $toEmail)) && ($toEmail > 0)) {
                // Value detected, is the message extension installed?
-               if (EXT_IS_ACTIVE("msg")) {
+               // @TODO Extension 'msg' does not exist
+               if (EXT_IS_ACTIVE('msg')) {
                        ADD_MESSAGE_TO_BOX($toEmail, $subject, $message, $HTML);
                        return;
                } else {
                        // Load email address
-                       $result_email = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", array(bigintval($toEmail)), __FUNCTION__, __LINE__);
+                       $result_email = SQL_QUERY_ESC("SELECT `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+                               array(bigintval($toEmail)), __FUNCTION__, __LINE__);
                        //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):numRows=".SQL_NUMROWS($result_email)."<br />\n";
 
                        // Does the user exist?
@@ -1243,7 +1245,7 @@ function generateRandomCode ($length, $code, $uid, $DATA = '') {
        $keys = getConfig('SITE_KEY').getConfig('ENCRYPT_SEPERATOR').getConfig('DATE_KEY');
        if (isConfigEntrySet('secret_key'))  $keys .= getConfig('ENCRYPT_SEPERATOR').getConfig('secret_key');
        if (isConfigEntrySet('file_hash'))   $keys .= getConfig('ENCRYPT_SEPERATOR').getConfig('file_hash');
-       $keys .= getConfig('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", getConfig(('patch_ctime')));
+       $keys .= getConfig('ENCRYPT_SEPERATOR') . date("d-m-Y (l-F-T)", getConfig('patch_ctime'));
        if (isConfigEntrySet('master_salt')) $keys .= getConfig('ENCRYPT_SEPERATOR').getConfig('master_salt');
 
        // Build string from misc data
@@ -2015,20 +2017,20 @@ function generateMemberAdminActionLinks ($uid, $status = '') {
 }
 
 // Generate an email link
-function generateMemberEmailLink ($email, $table = 'admins') {
+function generateEmailLink ($email, $table = 'admins') {
        // Default email link (INSECURE! Spammer can read this by harvester programs)
        $EMAIL = 'mailto:' . $email;
 
        // Check for several extensions
        if ((EXT_IS_ACTIVE('admins')) && ($table == 'admins')) {
                // Create email link for contacting admin in guest area
-               $EMAIL = adminsCreateEmailLink($email);
+               $EMAIL = generateAdminEmailLink($email);
        } elseif ((EXT_IS_ACTIVE('user')) && (GET_EXT_VERSION('user') >= '0.3.3') && ($table == 'user_data')) {
                // Create email link for contacting a member within admin area (or later in other areas, too?)
-               $EMAIL = USER_generateMemberEmailLink($email);
+               $EMAIL = generateEmailLink($email, 'user_data');
        } elseif ((EXT_IS_ACTIVE('sponsor')) && ($table == 'sponsor_data')) {
                // Create email link to contact sponsor within admin area (or like the link above?)
-               $EMAIL = SPONSOR_generateMemberEmailLink($email);
+               $EMAIL = generateEmailLink($email, 'sponsor_data');
        }
 
        // Shall I close the link when there is no admin?
@@ -2058,7 +2060,7 @@ function generateHash ($plainText, $salt = '') {
                $server = $_SERVER['PHP_SELF'].getConfig('ENCRYPT_SEPERATOR').detectUserAgent().getConfig('ENCRYPT_SEPERATOR').getenv('SERVER_SOFTWARE').getConfig('ENCRYPT_SEPERATOR').detectRemoteAddr();
 
                // Build key string
-               $keys   = getConfig('SITE_KEY').getConfig('ENCRYPT_SEPERATOR').getConfig('DATE_KEY').getConfig('ENCRYPT_SEPERATOR').getConfig('secret_key').getConfig('ENCRYPT_SEPERATOR').getConfig('file_hash').getConfig('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", getConfig(('patch_ctime'))).getConfig('ENCRYPT_SEPERATOR').getConfig('master_salt');
+               $keys   = getConfig('SITE_KEY').getConfig('ENCRYPT_SEPERATOR').getConfig('DATE_KEY').getConfig('ENCRYPT_SEPERATOR').getConfig('secret_key').getConfig('ENCRYPT_SEPERATOR').getConfig('file_hash').getConfig('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", getConfig('patch_ctime')).getConfig('ENCRYPT_SEPERATOR').getConfig('master_salt');
 
                // Additional data
                $data = $plainText.getConfig('ENCRYPT_SEPERATOR').uniqid(mt_rand(), true).getConfig('ENCRYPT_SEPERATOR').time();
@@ -2734,7 +2736,7 @@ function generateAdminLink ($aid) {
                        // Is the extension there?
                        if (EXT_IS_ACTIVE('admins')) {
                                // Admin found
-                               $admin = "<a href=\"".adminsCreateEmailLink(getAdminEmail($aid))."\">" . $login."</a>";
+                               $admin = "<a href=\"".generateEmailLink(getAdminEmail($aid), 'admins')."\">" . $login."</a>";
                        } else {
                                // Extension not found
                                $admin = sprintf(getMessage('EXTENSION_PROBLEM_NOT_INSTALLED'), 'admins');
@@ -2851,12 +2853,12 @@ function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) {
                $tmp = $FQFN . '.tmp';
 
                // Open the source file
-               $fp = fopen($FQFN, 'r') or OUTPUT_HTML('<strong>READ:</strong> ' . $FQFN . "<br />\n");
+               $fp = fopen($FQFN, 'r') or OUTPUT_HTML('<strong>READ:</strong> ' . $FQFN . '<br />');
 
                // Is the resource valid?
                if (is_resource($fp)) {
                        // Open temporary file
-                       $fp_tmp = fopen($tmp, 'w') or OUTPUT_HTML('<strong>WRITE:</strong> ' . $tmp . "<br />\n");
+                       $fp_tmp = fopen($tmp, 'w') or OUTPUT_HTML('<strong>WRITE:</strong> ' . $tmp . '<br />');
 
                        // Is the resource again valid?
                        if (is_resource($fp_tmp)) {
@@ -2873,7 +2875,7 @@ function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) {
                                                } else {
                                                        $next++;
                                                }
-                                       }
+                                       } // END - if
 
                                        // Write to temp file
                                        fputs($fp_tmp, $line);
@@ -2926,9 +2928,9 @@ function DEBUG_LOG ($funcFile, $line, $message, $force=true) {
                // Remove CRLF
                $message = str_replace("\r", '', str_replace("\n", '', $message));
 
-               // Log this message away
-               $fp = fopen(constant('PATH')."inc/cache/debug.log", 'a') or app_die(__FUNCTION__, __LINE__, "Cannot write logfile debug.log!");
-               fwrite($fp, date("d.m.Y|H:i:s", time())."|" . getModule()."|".basename($funcFile)."|" . $line."|".strip_tags($message)."\n");
+               // Log this message away, we better don't call app_die() here to prevent an endless loop
+               $fp = fopen(constant('PATH') . 'inc/cache/debug.log', 'a') or die(__FUNCTION__, __LINE__, 'Cannot write logfile debug.log!');
+               fwrite($fp, date('d.m.Y|H:i:s', time()) . '|' . getModule() . '|' . basename($funcFile) . '|' . $line . '|' . strip_tags($message)."\n");
                fclose($fp);
        } // END - if
 }
@@ -2938,7 +2940,7 @@ function runResetIncludes () {
        // Is the reset set or old sql_patches?
        if ((!isResetModeEnabled()) || (EXT_VERSION_IS_OLDER('sql_patches', '0.4.5'))) {
                // Then abort here
-               DEBUG_LOG(__FUNCTION__, __LINE__, "Cannot run reset! Please report this bug. Thanks");
+               DEBUG_LOG(__FUNCTION__, __LINE__, 'Cannot run reset! Please report this bug. Thanks');
        } // END - if
 
        // Get more daily reset scripts
@@ -3223,7 +3225,7 @@ function DETERMINE_REFID () {
                $GLOBALS['refid'] = bigintval(getSession('refid'));
        } elseif ((GET_EXT_VERSION('sql_patches') != '') && (getConfig('def_refid') > 0)) {
                // Set default refid as refid in URL
-               $GLOBALS['refid'] = getConfig(('def_refid'));
+               $GLOBALS['refid'] = getConfig('def_refid');
        } elseif ((GET_EXT_VERSION('user') >= '0.3.4') && (getConfig('select_user_zero_refid')) == 'Y') {
                // Select a random user which has confirmed enougth mails
                $GLOBALS['refid'] = determineRandomReferalId();
index 55cb320..561967b 100644 (file)
@@ -50,32 +50,32 @@ if (!defined('__SECURITY')) {
 
 // Init variables
 $mysql = array();
-if ((REQUEST_ISSET_POST(('mysql'))) && (is_array(REQUEST_POST('mysql')))) $mysql = REQUEST_POST('mysql');
+if ((REQUEST_ISSET_POST('mysql')) && (is_array(REQUEST_POST('mysql')))) $mysql = REQUEST_POST('mysql');
 
 // Check if both passwords from SMTP are matching
 if ((REQUEST_ISSET_GET('page') && (REQUEST_GET('page') == 5))) {
        // Okay, we have to check it
-       if (REQUEST_ISSET_POST(('smtp_user')) && (!REQUEST_ISSET_POST(('smtp_host')))) {
+       if (REQUEST_ISSET_POST('smtp_user') && (!REQUEST_ISSET_POST('smtp_host'))) {
                // Hostname not set
-               OUTPUT_HTML(getMessage('INSTALL_SMTP_HOSTNAME_EMPTY')."<br />");
+               OUTPUT_HTML(getMessage('INSTALL_SMTP_HOSTNAME_EMPTY') . '<br />');
                REQUEST_SET_GET('page', 3);
        } // END - if
 
-       if ((!REQUEST_ISSET_POST(('smtp_pass1'))) && (REQUEST_ISSET_POST(('smtp_pass2')))) {
+       if ((!REQUEST_ISSET_POST('smtp_pass1')) && (REQUEST_ISSET_POST('smtp_pass2'))) {
                // Password is empty
-               OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS1_EMPTY')."<br />");
+               OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS1_EMPTY') . '<br />');
                REQUEST_SET_GET('page', 3);
        } // END - if
 
-       if ((REQUEST_ISSET_POST(('smtp_pass1'))) && (!REQUEST_ISSET_POST(('smtp_pass2')))) {
+       if ((REQUEST_ISSET_POST('smtp_pass1')) && (!REQUEST_ISSET_POST('smtp_pass2'))) {
                // Password repeat is empty
-               OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS2_EMPTY')."<br />");
+               OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS2_EMPTY') . '<br />');
                REQUEST_SET_GET('page', 3);
        } // END - if
 
        if (REQUEST_POST('smtp_pass1') != REQUEST_POST('smtp_pass1')) {
                // Passwords are not matching
-               OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS_MISMATCH')."<br />");
+               OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS_MISMATCH') . '<br />');
                REQUEST_SET_GET('page', 3);
        } // END - if
 } // END - if
@@ -103,11 +103,11 @@ if ((!isInstalled()) || (!isAdminRegistered())) {
                        if (empty($mysql['prefix'])) $mysql['prefix'] = 'mxchange';
                        if (empty($mysql['type']))   $mysql['type']   = 'MyISAM';
                        if (getTotalFatalErrors() > 0) {
-                               OUTPUT_HTML("<span class=\"install_fatal\">");
+                               OUTPUT_HTML('<span class="install_fatal">');
                                foreach (getFatalArray() as $key => $err) {
-                                       OUTPUT_HTML("  <strong>&middot;</strong>&nbsp;{--FATAL_NO--}".($key + 1).":&nbsp;".$err."<br />");
+                                       OUTPUT_HTML('<strong>&middot;</strong>&nbsp;{--FATAL_NO--}' . ($key + 1) . ':&nbsp;' . $err . '<br />');
                                }
-                               OUTPUT_HTML("</span><br />");
+                               OUTPUT_HTML('</span><br />');
                        }
                        define('__MYSQL_HOST'  , $mysql['host']);
                        define('__MYSQL_DBASE' , $mysql['dbase']);
@@ -139,9 +139,9 @@ if ((!isInstalled()) || (!isAdminRegistered())) {
                        $smtpPass2 = getConfig('SMTP_PASSWORD');
 
                        // Overwrite it with the data from sent (failed) form
-                       if (REQUEST_ISSET_POST(('smtp_host'))) $smtpHost = REQUEST_POST('smtp_host');
-                       if (REQUEST_ISSET_POST(('smtp_user'))) $smtpUser = REQUEST_POST('smtp_user');
-                       if (REQUEST_ISSET_POST(('smtp_pass'))) {
+                       if (REQUEST_ISSET_POST('smtp_host')) $smtpHost = REQUEST_POST('smtp_host');
+                       if (REQUEST_ISSET_POST('smtp_user')) $smtpUser = REQUEST_POST('smtp_user');
+                       if (REQUEST_ISSET_POST('smtp_pass')) {
                                $smtpPass1 = REQUEST_POST('smtp_pass');
                                $smtpPass2 = REQUEST_POST('smtp_pass');
                        } // END - if
@@ -184,79 +184,16 @@ if ((!isInstalled()) || (!isAdminRegistered())) {
                        define('__SMTP_HOST', REQUEST_POST('smtp_host'));
                        define('__SMTP_USER', REQUEST_POST('smtp_user'));
                        define('__SMTP_PASS', REQUEST_POST('smtp_pass1'));
-                       OUTPUT_HTML("<form action=\"{!__BURL_ACTION!}/install.php?page=finalize\" method=\"POST\" target=\"_self\">
-<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"install_main\">
-<tr>
-  <td colspan=\"2\" align=\"center\">
-    <div class=\"install\">{--HEADER_TEXT_PAGE5--}</strong>
-  </td>
-</tr>
-<tr><td colspan=\"2\" height=\"21\" class=\"seperator\">&nbsp;</td></tr>
-<tr>
-  <td colspan=\"2\"><span class=\"install_text\">
-    {--TEXT_PAGE_5--}
-  </span></td>
-</tr>
-<tr><td colspan=\"2\" height=\"21\" class=\"seperator\">&nbsp;</td></tr>
-<tr>
-  <td class=\"install\" align=\"right\">{--LANG_OUTPUT_MODE--}:&nbsp;&nbsp;</td>
-  <td>
-    <select name=\"omode\" size=\"1\" class=\"install_select\">
-      <option value=\"render\">{--MODE_RENDER--}</option>
-      <option value=\"direct\">{--MODE_DIRECT--}</option>
-    </select>
-  </td>
-</tr>
-<tr><td colspan=\"2\" height=\"10\" class=\"seperator\">&nbsp;</td></tr>
-<tr>
-  <td class=\"install\" align=\"right\">{--WARN_NO_PASSWORD--}:&nbsp;&nbsp;</td>
-  <td>
-    <select name=\"warn_no_pass\" size=\"1\" class=\"install_select\">
-      <option value=\"Y\">{--YES--}</option>
-      <option value=\"N\">{--NO--}</option>
-    </select>
-  </td>
-</tr>
-<tr><td colspan=\"2\" height=\"10\" class=\"seperator\">&nbsp;</td></tr>
-<tr>
-  <td class=\"install\" align=\"right\">{--LANG_WRITE_FOOTER--}:&nbsp;&nbsp;</td>
-  <td>
-    <select name=\"wfooter\" size=\"1\" class=\"install_select\">
-      <option value=\"Y\">{--YES--}</option>
-      <option value=\"N\">{--NO--}</option>
-    </select>
-  </td>
-</tr>
-<tr><td colspan=\"2\" height=\"10\" class=\"seperator\">&nbsp;</td></tr>
-<tr>
-  <td class=\"install\" align=\"right\">{--INSTALL_ENABLE_BACKLINK--}:&nbsp;&nbsp;</td>
-  <td>
-    <select name=\"blink\" size=\"1\" class=\"install_select\">
-      <option value=\"Y\">{--YES--}</option>
-      <option value=\"N\">{--NO--}</option>
-    </select>
-  </td>
-</tr>
-<tr><td colspan=\"2\" height=\"21\" class=\"seperator\">&nbsp;</td></tr>
-<tr>
-  <td colspan=\"2\" align=\"center\">");
+
+                       // MySQL data
+                       $content = '';
                        foreach ($mysql as $key => $value) {
-                               OUTPUT_HTML("    <input type=\"hidden\" name=\"mysql[".$key."]\" value=\"".$value."\" />");
+                               $content .= "    <input type=\"hidden\" name=\"mysql[" . $key . "]\" value=\"" . $value . "\" />\n";
                        }
-                       OUTPUT_HTML("    <input type=\"hidden\" name=\"spath\" value=\"{!__SPATH_VALUE!}\" />
-    <input type=\"hidden\" name=\"burl\" value=\"{!__BURL_VALUE!}\" />
-    <input type=\"hidden\" name=\"title\" value=\"{!__TITLE_VALUE!}\" />
-    <input type=\"hidden\" name=\"slogan\" value=\"{!__SLOGAN_VALUE!}\" />
-    <input type=\"hidden\" name=\"email\" value=\"{!__EMAIL_VALUE!}\" />
-    <input type=\"hidden\" name=\"smtp_host\" value=\"{!__SMTP_HOST!}\" />
-    <input type=\"hidden\" name=\"smtp_user\" value=\"{!__SMTP_USER!}\" />
-    <input type=\"hidden\" name=\"smtp_pass\" value=\"{!__SMTP_PASS!}\" />
-    <input type=\"submit\" class=\"admin_submit submit\" name=\"finalize\" value=\"{--NEXT_PAGE--}\" class=\"install_submit\" />
-  </td>
-</tr>
-<tr><td colspan=\"2\" height=\"21\" class=\"seperator\">&nbsp;</td></tr>
-</table>
-</form>");
+                       define('__MYSQL_DATA', $content);
+
+                       // Load template
+                       LOAD_TEMPLATE('install_page5');
                        break;
 
                case 'finalize': // Write captured data to files
index 2d143e4..77835db 100644 (file)
@@ -120,13 +120,16 @@ function adminsCheckAdminAcl ($act, $wht) {
 }
 
 // Create email link to admins's account
-function adminsCreateEmailLink ($email, $mod='admin') {
+function generateAdminEmailLink ($email, $mod = 'admin') {
        // Is it an email?
-       if (strpos($email, "@") !== false) {
+       if (strpos($email, '@') !== false) {
                // Create email link
                $result = SQL_QUERY_ESC("SELECT `id`
-FROM `{!_MYSQL_PREFIX!}_admins`
-WHERE `email`='%s' LIMIT 1",
+FROM
+       `{!_MYSQL_PREFIX!}_admins`
+WHERE
+       `email`='%s'
+LIMIT 1",
                array($email), __FUNCTION__, __LINE__);
 
                // Is there an entry?
@@ -360,7 +363,7 @@ function adminsRemoveAdminAccount ($POST) {
 // List all admin accounts
 function adminsListAdminAccounts() {
        // Select all admin accounts
-       $result = SQL_QUERY("SELECT id, login, email, default_acl AS mode, la_mode FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY login ASC", __FUNCTION__, __LINE__);
+       $result = SQL_QUERY("SELECT `id`, `login`, `email`, `default_acl` AS mode, `la_mode` FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `login` ASC", __FUNCTION__, __LINE__);
        $OUT = ''; $SW = 2;
        while ($content = SQL_FETCHARRAY($result)) {
                // Compile some variables
@@ -369,7 +372,7 @@ function adminsListAdminAccounts() {
 
                // Prepare some more data
                $content['sw']         = $SW;
-               $content['email_link'] = generateMemberEmailLink($content['id']);
+               $content['email_link'] = generateEmailLink($content['id'], 'admins');
 
                // Load row template and switch color
                $OUT .= LOAD_TEMPLATE('admin_list_admins_row', true, $content);
@@ -387,9 +390,9 @@ function adminsListAdminAccounts() {
 // Filter for adding extra data to the query
 function FILTER_ADD_EXTRA_SQL_DATA ($add = '') {
        // Is the admins extension updated? (should be!)
-       if (GET_EXT_VERSION('admins') >= '0.3.0')   $add .= ", default_acl AS def_acl";
-       if (GET_EXT_VERSION('admins') >= '0.6.7') $add .= ", la_mode";
-       if (GET_EXT_VERSION('admins') >= '0.7.2') $add .= ", login_failures, UNIX_TIMESTAMP(last_failure) AS last_failure";
+       if (GET_EXT_VERSION('admins') >= '0.3.0') $add .= ', `default_acl` AS def_acl';
+       if (GET_EXT_VERSION('admins') >= '0.6.7') $add .= ', `la_mode`';
+       if (GET_EXT_VERSION('admins') >= '0.7.2') $add .= ', `login_failures`, UNIX_TIMESTAMP(`last_failure`) AS last_failure';
 
        // Return it
        return $add;
index e9b9fdf..70c6391 100644 (file)
@@ -44,17 +44,17 @@ if (!defined('__SECURITY')) {
 
 function AUTOPURGE_ADD_POINTS($uid, $points) {
        // Check if he has locked points or not
-       $result = SQL_QUERY_ESC("SELECT ref_payout FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-       array(bigintval($uid)), __FUNCTION__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `ref_payout` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+               array(bigintval($uid)), __FUNCTION__, __LINE__);
        list($payout) = SQL_FETCHROW($result);
        SQL_FREERESULT($result);
 
        if (($payout > 0) && (!empty($payout))) {
                // Yes, he has.
-               $target = "locked_points";
+               $target = 'locked_points';
        } elseif ($payout == '0') {
                // No, he has not
-               $target = "points";
+               $target = 'points';
        }
 
        // Add points...
@@ -65,17 +65,17 @@ function AUTOPURGE_ADD_POINTS($uid, $points) {
                $jackpot += $points;
        } else {
                // .. to user's account
-               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_points` SET %s=%s+%s WHERE userid=%s AND ref_depth=0 LIMIT 1",
-               array($target, $target, $points, bigintval($uid)), __FUNCTION__, __LINE__);
+               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_points` SET `%s`=`%s`+%s WHERE `userid`=%s AND `ref_depth`=0 LIMIT 1",
+                       array($target, $target, $points, bigintval($uid)), __FUNCTION__, __LINE__);
 
                // Update mediadata as well
-               if ((GET_EXT_VERSION('mediadata') >= '0.0.4') && ($target == "points")) {
+               if ((GET_EXT_VERSION('mediadata') >= '0.0.4') && ($target == 'points')) {
                        // Update database
                        MEDIA_UPDATE_ENTRY(array('total_points'), 'add', $points);
-               }
+               } // END - if
 
                // Send out mail to user
-               $msg = LOAD_EMAIL_TEMPLATE("member_autopurge_points", translateComma($points), $uid);
+               $msg = LOAD_EMAIL_TEMPLATE('member_autopurge_points', translateComma($points), $uid);
                sendEmail($uid, getMessage('AUTOPURGE_MEMBER_SUBJECT'), $msg);
        }
 }
index 3c4e377..ee0f7bd 100644 (file)
@@ -95,8 +95,8 @@ function HTML_INSERT_URLS ($text) {
 
        // ... what will the email address be out the @... ;-)
        $PARTS = array();
-       while (ereg("@", $test)) {
-               $pos = strpos($test, "@");
+       while (ereg('@', $test)) {
+               $pos = strpos($test, '@');
                $test2 = substr($test, 0, $pos);
 
                // First check backwards
@@ -106,34 +106,34 @@ function HTML_INSERT_URLS ($text) {
                        if (!in_array($check, $GLOBALS['valid_email_chars'])) {
                                // Char found so we end here
                                break;
-                       }
+                       } // END - if
                        $idx--;
-               }
+               } // END - while
 
                if ($idx > 0) {
                        // Starting mark is found
                        $check2 = substr($test, 0, ($idx + 1));
                        $test = substr($test, ($idx + 1));
-               }
+               } // END - if
 
                // And now go forward...
                $idx = 0;
                while ($idx < strlen($test)) {
                        $check = substr($test, $idx, 1);
-                       if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != "@")) {
+                       if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != '@')) {
                                // Char found so end here again
                                break;
-                       }
+                       } // END - if
                        $idx++;
-               }
+               } // END - while
 
                if ($idx > 0) {
                        // Maybe this is the email address?
                        $check = substr($test, 0, $idx);
-               }
+               } // END - if
 
                // Now replace the email against anchor with mailto and pray...
-               $PARTS[] = $check2."<a href=\"mailto:".$check."\">".$check."</a>";
+               $PARTS[] = $check2 . "<a href=\"" . generateEmailLink($check, 'user_data') . "\">" . $check . "</a>";
 
                // Remove email from testing string (see above why...)
                $test = substr($test, strlen($check));
index f6b0dfd..2c77e3a 100644 (file)
@@ -97,8 +97,8 @@ function NL_INSERT_URLS ($text) {
 
        // ... what will the email address be out the @... ;-)
        $PARTS = array();
-       while (ereg("@", $test)) {
-               $pos = strpos($test, "@");
+       while (ereg('@', $test)) {
+               $pos = strpos($test, '@');
                $test2 = substr($test, 0, $pos);
 
                // First check backwards
@@ -123,7 +123,7 @@ function NL_INSERT_URLS ($text) {
                $idx = 0;
                while ($idx < strlen($test)) {
                        $check = substr($test, $idx, 1);
-                       if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != "@")) {
+                       if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != '@')) {
                                // Char found so end here again
                                break;
                        }
@@ -136,7 +136,7 @@ function NL_INSERT_URLS ($text) {
                }
 
                // Now replace the email against anchor with mailto and pray...
-               $PARTS[] = $check2.$check;
+               $PARTS[] = $check2 . $check;
 
                // Remove email from testing string (see above why...)
                $test = substr($test, strlen($check));
index 607f4a1..865e436 100644 (file)
@@ -299,7 +299,7 @@ VALUES ('%s','%s','0')",
                        $DATA['title'] = $title;
                        $DATA['id']    = $id;  // ID for the rallye details link
                        $DATA['ref']   = 0;
-                       $DATA['refs']  = GET_TOTAL_DATA($uid, "user_data", 'userid', "refid", true);
+                       $DATA['refs']  = GET_TOTAL_DATA($uid, 'user_data', 'userid', "refid", true);
 
                        // Load prices
                        $prices = RALLYE_ADD_PRICES($id);
index 20f5402..8c51178 100644 (file)
@@ -999,8 +999,8 @@ function SURFBAR_CHECK_VALIDATION_CODE ($urlId, $check, $salt) {
        $code = SURFBAR_GENERATE_VALIDATION_CODE($urlId, $salt);
 
        // Return result of checking hashes and salts
-       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, '---'.$code."|".$check.'---', false);
-       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "+++".$salt."|".SURFBAR_GET_DATA('last_salt')."+++", false);
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, '---'.$code.'|'.$check.'---', false);
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "+++".$salt.'|'.SURFBAR_GET_DATA('last_salt')."+++", false);
        return (($code == $check) && ($salt == SURFBAR_GET_DATA('last_salt')));
 }
 
@@ -1131,33 +1131,47 @@ function SURFBAR_DETERMINE_DEPLETED_USERIDS ($limit=0) {
        if ((IS_MEMBER()) && ($limit == 0)) {
                // Then add this as well
                $UIDs['uid'][getUserId()]      = getUserId();
-               $UIDs['points'][getUserId()]   = GET_TOTAL_DATA(getUserId(), "user_points", "points") - GET_TOTAL_DATA(getUserId(), "user_data", "used_points");
+               $UIDs['points'][getUserId()]   = GET_TOTAL_DATA(getUserId(), 'user_points', 'points') - GET_TOTAL_DATA(getUserId(), 'user_data', 'used_points');
                $UIDs['notified'][getUserId()] = 0;
 
                // Get all userid except logged in one
-               $result = SQL_QUERY_ESC("SELECT u.userid, UNIX_TIMESTAMP(d.surfbar_low_notified) AS notified
-FROM `{!_MYSQL_PREFIX!}_surfbar_urls` AS u
-INNER JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
-ON u.userid=d.userid
-WHERE u.userid NOT IN (%s,0) AND u.`status`='ACTIVE'
-GROUP BY u.userid
-ORDER BY u.userid ASC",
-               array(getUserId()), __FUNCTION__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT
+       u.userid, UNIX_TIMESTAMP(d.surfbar_low_notified) AS notified
+FROM
+       `{!_MYSQL_PREFIX!}_surfbar_urls` AS u
+INNER JOIN
+       `{!_MYSQL_PREFIX!}_user_data` AS d
+ON
+       u.userid=d.userid
+WHERE
+       u.userid NOT IN (%s,0) AND u.`status`='ACTIVE'
+GROUP BY
+       u.userid
+ORDER BY
+       u.userid ASC",
+                       array(getUserId()), __FUNCTION__, __LINE__);
        } else {
                // Get all userid
-               $result = SQL_QUERY("SELECT u.userid, UNIX_TIMESTAMP(d.surfbar_low_notified) AS notified
-FROM `{!_MYSQL_PREFIX!}_surfbar_urls` AS u
-INNER JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
-ON u.userid=d.userid
-WHERE u.`status`='ACTIVE'
-GROUP BY u.userid
-ORDER BY u.userid ASC", __FUNCTION__, __LINE__);
+               $result = SQL_QUERY("SELECT
+       u.userid, UNIX_TIMESTAMP(d.surfbar_low_notified) AS notified
+FROM
+       `{!_MYSQL_PREFIX!}_surfbar_urls` AS u
+INNER JOIN
+       `{!_MYSQL_PREFIX!}_user_data` AS d
+ON
+       u.userid=d.userid
+WHERE
+       u.`status`='ACTIVE'
+GROUP BY
+       u.userid
+ORDER BY
+       u.userid ASC", __FUNCTION__, __LINE__);
        }
 
        // Load all userid
        while ($content = SQL_FETCHARRAY($result)) {
                // Get total points
-               $points = GET_TOTAL_DATA($content['userid'], "user_points", "points") - GET_TOTAL_DATA($content['userid'], "user_data", "used_points");
+               $points = GET_TOTAL_DATA($content['userid'], 'user_points', 'points') - GET_TOTAL_DATA($content['userid'], 'user_data', 'used_points');
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$content['userid']},points={$points}", false);
 
                // Shall we add this to ignore?
index ff9e5e3..44363a8 100644 (file)
@@ -68,7 +68,7 @@ function generateThemeSelectionBox ($mod, $act, $wht, $result) {
        } // END - while
 
        // Sort whole array by title
-       array_pk_sort($themesArray, array("theme_name"));
+       array_pk_sort($themesArray, array('theme_name'));
 
        // Construct selection form for the box template
        $OUT = '';
@@ -85,7 +85,7 @@ function generateThemeSelectionBox ($mod, $act, $wht, $result) {
        );
 
        // Return generated selection
-       return LOAD_TEMPLATE("theme_select_form", true, $content);
+       return LOAD_TEMPLATE('theme_select_form', true, $content);
 }
 
 // Get version from name
@@ -93,11 +93,11 @@ function THEME_GET_VERSION ($name) {
        // Is the extension 'theme' installed?
        if (!EXT_IS_ACTIVE('theme')) {
                // Then abort here
-               return "!.!";
+               return '!.!';
        } // END - if
 
-       // Default version "number"
-       $cver = "?.?";
+       // Default version 'number'
+       $cver = '?.?';
 
        // Is the cache entry there?
        if (isset($GLOBALS['cache_array']['themes']['theme_ver'][$name])) {
@@ -108,8 +108,8 @@ function THEME_GET_VERSION ($name) {
                incrementConfigEntry('cache_hits');
        } elseif (GET_EXT_VERSION('cache') != '0.1.8') {
                // Load version from database
-               $result = SQL_QUERY_ESC("SELECT theme_ver FROM `{!_MYSQL_PREFIX!}_themes` WHERE theme_path='%s' LIMIT 1",
-               array($name), __FUNCTION__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `theme_ver` FROM `{!_MYSQL_PREFIX!}_themes` WHERE `theme_path`='%s' LIMIT 1",
+                       array($name), __FUNCTION__, __LINE__);
 
                // Entry found?
                if (SQL_NUMROWS($result) == 1) {
@@ -151,8 +151,8 @@ function isThemeActive ($name) {
                incrementConfigEntry('cache_hits');
        } elseif (GET_EXT_VERSION('cache') != '0.1.8') {
                // Check if current theme is already imported or not
-               $result = SQL_QUERY_ESC("SELECT theme_active FROM `{!_MYSQL_PREFIX!}_themes` WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
-               array($name), __FUNCTION__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `theme_active` FROM `{!_MYSQL_PREFIX!}_themes` WHERE `theme_path`='%s' AND `theme_active`='Y' LIMIT 1",
+                       array($name), __FUNCTION__, __LINE__);
 
                // Is the theme active and installed?
                $active = (SQL_NUMROWS($result) == 1);
@@ -170,7 +170,7 @@ function getCurrentThemeName () {
        // Is the extension 'theme' installed?
        if (!EXT_IS_ACTIVE('theme')) {
                // Then abort here
-               return "default";
+               return 'default';
        } // END - if
 
        // Get the Uni* name
@@ -185,8 +185,8 @@ function getCurrentThemeName () {
                incrementConfigEntry('cache_hits');
        } elseif (GET_EXT_VERSION('cache') != '0.1.8') {
                // Check if current theme is already imported or not
-               $result = SQL_QUERY_ESC("SELECT theme_name FROM `{!_MYSQL_PREFIX!}_themes` WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
-               array($name), __FUNCTION__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `theme_name` FROM `{!_MYSQL_PREFIX!}_themes` WHERE `theme_path`='%s' AND `theme_active`='Y' LIMIT 1",
+                       array($name), __FUNCTION__, __LINE__);
 
                // Load theme name
                list($name) = SQL_FETCHROW($result);
@@ -203,7 +203,7 @@ function getCurrentThemeName () {
 $GLOBALS['curr_theme'] = getCurrentTheme();
 
 // Check if new theme is selcted
-if ((REQUEST_ISSET_POST(('new_theme'))) && (REQUEST_POST('new_theme') != $GLOBALS['curr_theme'])) {
+if ((REQUEST_ISSET_POST('new_theme')) && (REQUEST_POST('new_theme') != $GLOBALS['curr_theme'])) {
        // Set new theme for guests
        $newTheme = REQUEST_POST('new_theme');
 
@@ -216,5 +216,5 @@ if ((REQUEST_ISSET_POST(('new_theme'))) && (REQUEST_POST('new_theme') != $GLOBAL
        ADD_INC_TO_POOL(sprintf("%stheme/%s/theme.php", constant('PATH'), $newTheme));
 } // END - if
 
-//
+// [EOF]
 ?>
index 5fc33f7..08c90e2 100644 (file)
@@ -93,18 +93,18 @@ function SortLinks ($letter, $sortby, $colspan, $return=false) {
        $add = "&amp;page=".REQUEST_GET('page')."&amp;offset=".REQUEST_GET('offset');
 
        // Add status or mode
-       if (REQUEST_ISSET_GET(('status'))) $add .= "&amp;mode=".REQUEST_GET(('status'));
-       elseif (REQUEST_ISSET_GET('mode')) $add .= "&amp;mode=".REQUEST_GET('mode');
+       if (REQUEST_ISSET_GET('status'))   $add .= '&amp;mode=' . REQUEST_GET('status');
+       elseif (REQUEST_ISSET_GET('mode')) $add .= '&amp;mode=' . REQUEST_GET('mode');
 
        // Makes order by links..
        if ($letter == "front") $letter = getMessage('_ALL2');
 
        // Prepare array with all possible sorters
        $list = array(
-               'userid'                => getMessage('_UID'),
-               'family'                => getMessage('FAMILY_NAME'),
-               'email'                 => getMessage('ADDY'),
-               'REMOTE_ADDR'   => getMessage('REMOTE_IP')
+               'userid'      => getMessage('_UID'),
+               'family'      => getMessage('FAMILY_NAME'),
+               'email'       => getMessage('ADDY'),
+               'REMOTE_ADDR' => getMessage('REMOTE_IP')
        );
 
        // Add nickname if extension is installed
@@ -114,16 +114,16 @@ function SortLinks ($letter, $sortby, $colspan, $return=false) {
 
        foreach ($list as $sort => $title) {
                if ($sortby == $sort) {
-                       $OUT .= "<strong>".$title."</strong>&nbsp;|&nbsp;";
+                       $OUT .= "<strong>" . $title . "</strong>&nbsp;|&nbsp;";
                } else {
-                       $OUT .= "<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_user&amp;letter=".$letter."&amp;sortby=".$sort.$add."\">".$title."</a>&nbsp;|&nbsp;";
+                       $OUT .= "<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_user&amp;letter=" . $letter . "&amp;sortby=" . $sort.$add . "\">" . $title . "</a>&nbsp;|&nbsp;";
                }
        } // END - foreach
 
        define('__SORT_LIST', substr($OUT, 0, -13));
 
        // Load template
-       $OUT = LOAD_TEMPLATE("admin_list_user_sort", true);
+       $OUT = LOAD_TEMPLATE('admin_list_user_sort', true);
        if ($return === true) {
                // Return code
                return $OUT;
@@ -135,56 +135,50 @@ function SortLinks ($letter, $sortby, $colspan, $return=false) {
 
 // Add page navigation
 function ADD_PAGENAV ($PAGES, $offset, $show_form, $colspan,$return=false) {
-       if (!$show_form) {
-               // Empty row
-               define('__FORM_HEADER', "<tr><td colspan=\"".$colspan."\" class=\"seperator\">&nbsp;</td></tr>");
-       } else {
+       if ($show_form) {
                // Load form for changing number of lines
-               define('__FORM_HEADER', LOAD_TEMPLATE("admin_list_user_sort_form", true));
-       }
-
-       if (!$show_form) {
-               // Add line with bottom border
-               define('__FORM_FOOTER', "<tr><td colspan=\"{!__COLSPAN2!}\" class=\"seperator bottom2\">&nbsp;</td></tr>");
+               define('__FORM_HEADER', LOAD_TEMPLATE('admin_list_user_sort_form', true));
+               define('__FORM_FOOTER', '<tr><td colspan="{!__COLSPAN2!}" class="seperator bottom2">&nbsp;</td></tr>');
        } else {
-               // Add line without bottom border
-               define('__FORM_FOOTER', "<tr><td colspan=\"{!__COLSPAN2!}\" class=\"seperator bottom2\">&nbsp;</td></tr>");
+               // Empty row
+               define('__FORM_HEADER', '<tr><td colspan="' . $colspan . '" class="seperator">&nbsp;</td></tr>');
+               define('__FORM_FOOTER', '<tr><td colspan="{!__COLSPAN2!}" class="seperator bottom2">&nbsp;</td></tr>');
        }
 
        $OUT = '';
        for ($page = 1; $page <= $PAGES; $page++) {
                if (($page == REQUEST_GET('page')) || ((!REQUEST_ISSET_GET('page')) && ($page == '1'))) {
-                       $OUT .= "<strong>-";
+                       $OUT .= '<strong>-';
                } else {
                        if (!REQUEST_ISSET_GET('letter')) REQUEST_SET_GET('letter', getMessage('_ALL2'));
                        if (!REQUEST_ISSET_GET('sortby')) REQUEST_SET_GET('sortby', 'userid');
 
                        // Base link
-                       $OUT .= "<a href=\"{!URL!}/modules.php?module=admin&amp;what=".getWhat();
+                       $OUT .= '<a href="{!URL!}/modules.php?module=admin&amp;what=' . getWhat();
 
                        // Add status or mode
-                       if (REQUEST_ISSET_GET(('status'))) $OUT .= "&amp;mode=".REQUEST_GET(('status'));
-                       elseif (REQUEST_ISSET_GET('mode')) $OUT .= "&amp;mode=".REQUEST_GET('mode');
+                       if (REQUEST_ISSET_GET('status'))    $OUT .= '&amp;mode=' . REQUEST_GET('status');
+                        elseif (REQUEST_ISSET_GET('mode')) $OUT .= '&amp;mode=' . REQUEST_GET('mode');
 
                        // Letter and so on
-                       $OUT .= "&amp;letter=".REQUEST_GET('letter')."&amp;sortby=".REQUEST_GET('sortby')."&amp;page=".$page."&amp;offset=".$offset."\">";
+                       $OUT .= '&amp;letter=' . REQUEST_GET('letter') . '&amp;sortby=' . REQUEST_GET('sortby') . '&amp;page=' . $page . '&amp;offset=' . $offset . '">';
                }
 
                $OUT .= $page;
 
                if (($page == REQUEST_GET('page')) || ((!REQUEST_ISSET_GET('page')) && ($page == '1'))) {
-                       $OUT .= "-</strong>";
+                       $OUT .= '-</strong>';
                } else  {
-                       $OUT .= "</a>";
+                       $OUT .= '</a>';
                }
 
-               if ($page < $PAGES) $OUT .= "&nbsp;|&nbsp;";
+               if ($page < $PAGES) $OUT .= '&nbsp;|&nbsp;';
        } // END - for
 
        define('__PAGENAV_LIST', $OUT);
 
        // Load template
-       $OUT = LOAD_TEMPLATE("admin_list_user_pagenav", true);
+       $OUT = LOAD_TEMPLATE('admin_list_user_pagenav', true);
        if ($return === true) {
                // Return code
                return $OUT;
@@ -195,17 +189,17 @@ function ADD_PAGENAV ($PAGES, $offset, $show_form, $colspan,$return=false) {
 }
 
 // Create email link to user's account
-function USER_generateMemberEmailLink($email, $mod='admin') {
+function generateUserEmailLink($email, $mod='admin') {
        // Show contact link only if user is confirmed by default
        $locked = " AND `status`='CONFIRMED'";
 
        // But admins shall always see it
        if (IS_ADMIN()) $locked = '';
 
-       $result = SQL_QUERY_ESC("SELECT userid
+       $result = SQL_QUERY_ESC("SELECT `userid`
 FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `email`='%s'".$locked." LIMIT 1",
-       array($email), __FUNCTION__, __LINE__);
+WHERE `email`='%s'" . $locked." LIMIT 1",
+               array($email), __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Load userid
                list($uid) = SQL_FETCHROW($result);
@@ -238,7 +232,7 @@ function determineRandomReferalId () {
 
                        // Look for random user
                        $result = SQL_QUERY_ESC("SELECT `userid` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' AND `rand_confirmed` >= %s ORDER BY `rand_confirmed` DESC LIMIT %s, 1",
-                       array(getConfig('user_min_confirmed'), $randNum), __FUNCTION__, __LINE__);
+                               array(getConfig('user_min_confirmed'), $randNum), __FUNCTION__, __LINE__);
 
                        // Do we have one entry there?
                        if (SQL_NUMROWS($result) == 1) {
@@ -246,8 +240,8 @@ function determineRandomReferalId () {
                                list($refid) = SQL_FETCHROW($result);
 
                                // Reset this user's counter
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `rand_confirmed`=0 WHERE userid=%s LIMIT 1",
-                               array($refid), __FUNCTION__, __LINE__);
+                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `rand_confirmed`=0 WHERE `userid`=%s LIMIT 1",
+                                       array($refid), __FUNCTION__, __LINE__);
                        } // END - if
 
                        // Free result
@@ -282,11 +276,11 @@ function USER_DO_LOGIN ($uid, $passwd) {
                // Check login data
                if ((EXT_IS_ACTIVE('nickname')) && (NICKNAME_IS_ACTIVE($uid))) {
                        // Nickname entered
-                       $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$lastOnline." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' AND `status`='CONFIRMED' LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT `userid`, `password`, `last_online`" . $lastOnline . " FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nickname`='%s' AND `status`='CONFIRMED' LIMIT 1",
                                array($uid), __FUNCTION__, __LINE__);
                } else {
                        // Direct userid entered
-                       $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$lastOnline." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT `userid`, `password`, `last_online`" . $lastOnline . " FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
                                array($uid, $content['hash']), __FUNCTION__, __LINE__);
                }
 
@@ -315,8 +309,8 @@ function USER_DO_LOGIN ($uid, $passwd) {
 
                                // ... and update database
                                // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET password='%s' WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
-                               array($content['hash'], $uid), __FUNCTION__, __LINE__);
+                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `password`='%s' WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
+                                       array($content['hash'], $uid), __FUNCTION__, __LINE__);
 
                                // No login bonus by default
                                $GLOBALS['bonus_payed'] = false;
@@ -326,13 +320,13 @@ function USER_DO_LOGIN ($uid, $passwd) {
                                if (!empty($content['last_login'])) $probe = time() - $content['last_login'];
                                if ((GET_EXT_VERSION('bonus') >= '0.2.2') && ($probe >= getConfig('login_timeout'))) {
                                        // Add login bonus to user's account
-                                       $add = sprintf(", login_bonus=login_bonus+%s",
+                                       $add = sprintf(", `login_bonus`=`login_bonus`+%s",
                                        (float)getConfig('login_bonus')
                                        );
                                        $GLOBALS['bonus_payed'] = true;
 
                                        // Subtract login bonus from userid's account or jackpot
-                                       if ((GET_EXT_VERSION('bonus') >= '0.3.5') && (getConfig('bonus_mode') != "ADD")) BONUS_POINTS_HANDLER('login_bonus');
+                                       if ((GET_EXT_VERSION('bonus') >= '0.3.5') && (getConfig('bonus_mode') != 'ADD')) BONUS_POINTS_HANDLER('login_bonus');
                                } // END - if
 
                                // Calculate new hash with the secret key and master salt together
@@ -345,8 +339,8 @@ function USER_DO_LOGIN ($uid, $passwd) {
                                // Try to set session data (which shall normally always work!)
                                if ((setSession('userid', $uid )) && (setSession('u_hash', $content['hash']))) {
                                        // Update database records
-                                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET total_logins=total_logins+1".$add." WHERE userid=%s LIMIT 1",
-                                       array($uid), __FUNCTION__, __LINE__);
+                                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `total_logins`=`total_logins +1" . $add . " WHERE `userid`=%s LIMIT 1",
+                                               array($uid), __FUNCTION__, __LINE__);
                                        if (SQL_AFFECTEDROWS() == 1) {
                                                // Procedure to checking for login data
                                                if (($GLOBALS['bonus_payed']) && (EXT_IS_ACTIVE('bonus'))) {
@@ -366,8 +360,8 @@ function USER_DO_LOGIN ($uid, $passwd) {
                                }
                        } elseif (GET_EXT_VERSION('sql_patches') >= '0.6.1') {
                                // Update failture counter
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET login_failures=login_failures+1,last_failure=NOW() WHERE userid=%s LIMIT 1",
-                               array($uid), __FUNCTION__, __LINE__);
+                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `login_failures`=`login_failures`+1,`last_failure`=NOW() WHERE `userid`=%s LIMIT 1",
+                                       array($uid), __FUNCTION__, __LINE__);
 
                                // Wrong password!
                                $URL = 'modules.php?module=index&amp;what=login&amp;login='.getCode('WRONG_PASS');
@@ -375,8 +369,8 @@ function USER_DO_LOGIN ($uid, $passwd) {
                } elseif (((isNicknameUsed($content['userid'])) && (!empty($content['userid']))) || ($content['userid'] == $uid)) {
                        // Other account status?
                        // @TODO Can this query be merged with above query?
-                       $result = SQL_QUERY_ESC("SELECT status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-                       array($uid), __FUNCTION__, __LINE__);
+                       $result = SQL_QUERY_ESC("SELECT status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+                               array($uid), __FUNCTION__, __LINE__);
 
                        // Entry found?
                        if (SQL_NUMROWS($result) == 1) {
@@ -413,16 +407,16 @@ function USER_DO_NEW_PASSWORD ($email, $uid) {
        // Probe userid/nickname
        if ((EXT_IS_ACTIVE('nickname')) && (NICKNAME_IS_ACTIVE($uid))) {
                // Nickname entered
-               $result = SQL_QUERY_ESC("SELECT userid, status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' OR email='%s' LIMIT 1",
-               array($uid, $email), __FUNCTION__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `userid`, `status` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nickname`='%s' OR `email`='%s' LIMIT 1",
+                       array($uid, $email), __FUNCTION__, __LINE__);
        } elseif (($uid > 0) && (empty($email))) {
                // Direct userid entered
-               $result = SQL_QUERY_ESC("SELECT userid, status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-               array(bigintval($uid)), __FUNCTION__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `userid`, `status` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+                       array(bigintval($uid)), __FUNCTION__, __LINE__);
        } elseif (!empty($email)) {
                // Email entered
-               $result = SQL_QUERY_ESC("SELECT userid, status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE email='%s' LIMIT 1",
-               array($email), __FUNCTION__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `userid`, `status` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `email`='%s' LIMIT 1",
+                       array($email), __FUNCTION__, __LINE__);
        } else {
                // Userid not set!
                DEBUG_LOG(__FUNCTION__, __LINE__, 'Userid is not set! BUG!');
@@ -437,8 +431,8 @@ function USER_DO_NEW_PASSWORD ($email, $uid) {
                if ($status == 'CONFIRMED') {
                        // Ooppps, this was missing! ;-) We should update the database...
                        $NEW_PASS = generatePassword();
-                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET password='%s' WHERE userid=%s LIMIT 1",
-                       array(generateHash($NEW_PASS), $uid), __FUNCTION__, __LINE__);
+                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `password`='%s' WHERE `userid`=%s LIMIT 1",
+                               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);
index 441a008..6cad27f 100644 (file)
@@ -101,15 +101,15 @@ function YOOMEDIA_QUERY_API ($script, $countQuery = true) {
        if ((getConfig('yoomedia_requests_remain') > 0) || (!$countQuery)) {
                // Prepare the low-level request
                $requestString = sprintf("http://www.yoomedia.de/interface_2.0/%s?id=%s&sid=%s&pw=%s&reload=%s&ma=%s&uebrig=%s&verguetung=%s&erotik=%s",
-               $script,
-               getConfig(('yoomedia_id')),
-               getConfig(('yoomedia_sid')),
-               getConfig('yoomedia_passwd'),
-               getConfig(('yoomedia_tm_max_reload')),
-               getConfig(('yoomedia_tm_min_wait')),
-               getConfig(('yoomedia_tm_clicks_remain')),
-               getConfig(('yoomedia_tm_min_pay')),
-               getConfig(('yoomedia_erotic_allowed'))
+                       $script,
+                       getConfig('yoomedia_id'),
+                       getConfig('yoomedia_sid'),
+                       getConfig('yoomedia_passwd'),
+                       getConfig('yoomedia_tm_max_reload'),
+                       getConfig('yoomedia_tm_min_wait'),
+                       getConfig('yoomedia_tm_clicks_remain'),
+                       getConfig('yoomedia_tm_min_pay'),
+                       getConfig('yoomedia_erotic_allowed')
                );
 
                // Run the query
@@ -161,10 +161,10 @@ function YOOMEDIA_PARSE_RESPONSE ($response, $type) {
        $responseLine = trim(implode("\n", $dummy));
 
        // Last line should never be a pipe!
-       if (substr($responseLine, -1, 1) == "|") $responseLine = substr($responseLine, 0, -1);
+       if (substr($responseLine, -1, 1) == '|') $responseLine = substr($responseLine, 0, -1);
 
        // Now, explode all in one array
-       $dataArray = explode("|", $responseLine);
+       $dataArray = explode('|', $responseLine);
 
        // Now make the result array with two dimensions
        $cnt = 0; $entry = 0;
index fde00d3..3b196b4 100644 (file)
@@ -54,7 +54,7 @@ $ret = 'init';
 // Is no admin registered?
 if (!isAdminRegistered()) {
        // Admin is not registered so we have to inform the user
-       if ((isFormSent()) && ((!REQUEST_ISSET_POST('login')) || (!REQUEST_ISSET_POST(('pass'))) || (strlen(REQUEST_POST('pass')) < 4))) {
+       if ((isFormSent()) && ((!REQUEST_ISSET_POST('login')) || (!REQUEST_ISSET_POST('pass')) || (strlen(REQUEST_POST('pass')) < 4))) {
                REQUEST_SET_POST('ok', '***');
        } // END - if
 
@@ -126,7 +126,7 @@ if (!isAdminRegistered()) {
                        if (!empty($ret)) $loginMessage = $ret;
 
                        // No password entered?
-                       if (!REQUEST_ISSET_POST(('pass'))) $passwdMessage = getMessage('ADMIN_NO_PASS');
+                       if (!REQUEST_ISSET_POST('pass')) $passwdMessage = getMessage('ADMIN_NO_PASS');
 
                        // Or password too short?
                        if (strlen(REQUEST_POST('pass')) < 4) $passwdMessage = getMessage('ADMIN_SHORT_PASS');
@@ -201,13 +201,13 @@ if (!isAdminRegistered()) {
                redirectToUrl('modules.php?module=admin&amp;logout=1');
        } // END - if
 
-       if (REQUEST_ISSET_GET(('register'))) {
+       if (REQUEST_ISSET_GET('register')) {
                // Registration of first admin is done
                if (REQUEST_GET('register') == 'done') LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_REGISTER_DONE'));
        } // END - if
 
        // Check if the admin has submitted data or not
-       if ((isFormSent()) && ((!REQUEST_ISSET_POST('login')) || (!REQUEST_ISSET_POST(('pass'))) || (strlen(REQUEST_POST('pass')) < 4))) {
+       if ((isFormSent()) && ((!REQUEST_ISSET_POST('login')) || (!REQUEST_ISSET_POST('pass')) || (strlen(REQUEST_POST('pass')) < 4))) {
                REQUEST_SET_POST('ok', '***');
        } // END - if
 
@@ -273,7 +273,7 @@ if (!isAdminRegistered()) {
                        if ((!empty($ret)) && (REQUEST_POST('ok') == '404')) $loginMessage = $ret;
 
                        // No password entered?
-                       if (!REQUEST_ISSET_POST(('pass'))) $passwdMessage = getMessage('ADMIN_NO_PASS');
+                       if (!REQUEST_ISSET_POST('pass')) $passwdMessage = getMessage('ADMIN_NO_PASS');
 
                        // Or password too short?
                        if (strlen(REQUEST_POST('pass')) < 4) $passwdMessage = getMessage('ADMIN_SHORT_PASS');
@@ -317,13 +317,13 @@ if (!isAdminRegistered()) {
                // Load login form template
                LOAD_TEMPLATE('admin_login_form', false, $content);
        } // END - if
-} elseif (REQUEST_ISSET_GET(('logout'))) {
+} elseif (REQUEST_ISSET_GET('logout')) {
        // Only try to remove cookies
        if (destroyAdminSession()) {
                // Load logout template
-               if (REQUEST_ISSET_GET(('register'))) {
+               if (REQUEST_ISSET_GET('register')) {
                        // Secure input
-                       $register = REQUEST_GET(('register'));
+                       $register = REQUEST_GET('register');
 
                        // Special logout redirect for installation of given extension
                        LOAD_TEMPLATE(sprintf("admin_logout_%s_install", $register));
index e553173..2eb6628 100644 (file)
@@ -161,7 +161,7 @@ LIMIT 1",
                                        // Entry found?
                                        if (SQL_NUMROWS($result_user) == 1) {
                                                list($gender, $sname, $fname, $email) = SQL_FETCHROW($result_user);
-                                               $add = "<li>{--ADMIN_MEMBER_UID--}: <strong>".generateUserProfileLink($uid)." (<a href=\"".generateMemberEmailLink($email, "user_data")."\">".translateGender($gender)." ".$sname." ".$fname."</a>)</strong></li>";
+                                               $add = "<li>{--ADMIN_MEMBER_UID--}: <strong>".generateUserProfileLink($uid, 'user_data')." (<a href=\"".generateEmailLink($email, 'user_data')."\">".translateGender($gender)." ".$sname." ".$fname."</a>)</strong></li>";
                                        } else {
                                                // Invalid userid, so log and zero it
                                                DEBUG_LOG(__FUNCTION__, __LINE__, 'Invalid userid=' . $uid . '-> Not found!');
index 1329e0e..82442de 100644 (file)
@@ -88,8 +88,8 @@ if (REQUEST_GET('uid') == "all") {
        }
 } elseif (REQUEST_ISSET_GET('uid')) {
        // User ID found in URL so we use this give him some credits
-       $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
-       array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `surname`, `family`, `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
+               array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Selected user does exist
                list($sname, $fname, $email) = SQL_FETCHROW($result);
@@ -118,9 +118,9 @@ if (REQUEST_GET('uid') == "all") {
                } else {
                        // Opps, missing form here
                        // @TODO Rewrite these both constants
-                       define('__USER_VALUE', "<a href=\"".generateMemberEmailLink($email, "user_data")."\">".$sname." ".$fname."</a>");
+                       define('__USER_VALUE', "<a href=\"".generateEmailLink($email, 'user_data')."\">".$sname." ".$fname."</a>");
                        define('__UID'       , bigintval(REQUEST_GET('uid')));
-                       LOAD_TEMPLATE("admin_add_points");
+                       LOAD_TEMPLATE('admin_add_points');
                }
        } else {
                // User not found!
index ec1cb4a..b563cfe 100644 (file)
@@ -46,10 +46,14 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 ADD_DESCR ('admin', basename(__FILE__));
 
 // Check for accounts
-$result = SQL_QUERY("SELECT userid, gender, surname, family, email, REMOTE_ADDR, refid, user_hash
-FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='UNCONFIRMED'
-ORDER BY userid ASC", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT
+       `userid`, `gender`, `surname`, `family`, `email`, `REMOTE_ADDR`, `refid`, `user_hash`
+FROM
+       `{!_MYSQL_PREFIX!}_user_data`
+WHERE
+       `status`='UNCONFIRMED'
+ORDER BY
+       `userid` ASC", __FILE__, __LINE__);
 
 if (SQL_NUMROWS($result) > 0) {
        // We have some (new?) registrations!
@@ -65,7 +69,7 @@ if (SQL_NUMROWS($result) > 0) {
                        'gender' => translateGender($content['gender']),
                        'sname'  => $content['surname'],
                        'fname'  => $content['family'],
-                       'email'  => "<a href=\"".generateMemberEmailLink($content['email'], "user_data")."\">".$content['email']."</a>",
+                       'email'  => "<a href=\"".generateEmailLink($content['email'], 'user_data')."\">".$content['email']."</a>",
                        'ip'     => $content['REMOTE_ADDR'],
                        'ref'    => $content['refid'],
                        'hash'   => $content['user_hash'],
index 7b1ce5e..45ff327 100644 (file)
@@ -53,9 +53,9 @@ if (isFormSent()) {
                REQUEST_UNSET_POST('ok');
        } else {
                // Remove entries
-               REQUEST_UNSET_POST(('day'));
-               REQUEST_UNSET_POST(('month'));
-               REQUEST_UNSET_POST(('year'));
+               REQUEST_UNSET_POST('day');
+               REQUEST_UNSET_POST('month');
+               REQUEST_UNSET_POST('year');
 
                // Remember timestamp
                REQUEST_SET_POST('mt_start', $STAMP);
@@ -76,13 +76,13 @@ if (isFormSent()) {
        // Start of this exchange
        if (getConfig('mt_start') > 0) {
                // Only show start
-               define('__MT_START', "<strong>".generateDateTime(getConfig('mt_start'), '3')."</strong>");
+               define('__MT_START', '<strong>' . generateDateTime(getConfig('mt_start'), '3') . '</strong>');
        } else {
                // Make start editable
                define('__MT_START',
-               ADD_SELECTION("day"  , date('d', time())).
-               ADD_SELECTION("month", date('m', time())).
-               ADD_SELECTION("year",  -1)
+                       ADD_SELECTION('day'  , date('d', time())).
+                       ADD_SELECTION('month', date('m', time())).
+                       ADD_SELECTION('year',  -1)
                );
        }
 
@@ -90,7 +90,7 @@ if (isFormSent()) {
        define('__MT_STAGE', getConfig('mt_stage'));
 
        // Load template
-       LOAD_TEMPLATE("admin_config_mediadata");
+       LOAD_TEMPLATE('admin_config_mediadata');
 }
 
 //
index 4c10daf..a37e741 100644 (file)
@@ -256,7 +256,7 @@ WHERE mails_confirmed < %s", $REF, $REF));
                LOAD_TEMPLATE("admin_points_edit");
        } else {
                // Referal levels
-               $result = SQL_QUERY("SELECT id, level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` ORDER BY level", __FILE__, __LINE__);
+               $result = SQL_QUERY("SELECT `id`, `level`, `percents` FROM `{!_MYSQL_PREFIX!}_refdepths` ORDER BY `level` ASC", __FILE__, __LINE__);
                if (SQL_NUMROWS($result) > 0) {
                        // Make referal levels editable and deletable
                        $OUT = ''; $SW = 2;
@@ -273,7 +273,7 @@ WHERE mails_confirmed < %s", $REF, $REF));
                                );
 
                                // Load row template and switch color
-                               $OUT .= LOAD_TEMPLATE("admin_points_row", true, $content);
+                               $OUT .= LOAD_TEMPLATE('admin_points_row', true, $content);
                                $SW = 3 - $SW;
                        }
 
@@ -282,22 +282,22 @@ WHERE mails_confirmed < %s", $REF, $REF));
                        define('__LEVEL_ROWS', $OUT);
 
                        // Load main template
-                       LOAD_TEMPLATE("admin_points");
+                       LOAD_TEMPLATE('admin_points');
                }
 
                // Form for adding new referal levels
-               LOAD_TEMPLATE("admin_add_reflvl");
+               LOAD_TEMPLATE('admin_add_reflvl');
        }
-} elseif (REQUEST_GET('sub') == "points") {
+} elseif (REQUEST_GET('sub') == 'points') {
        // First points for registration and other fixed points including new add-mode for one-time referal bonus...
        define('P_REG_VALUE', getConfig('points_register'));
        define('P_REF_VALUE', getConfig('points_ref'));
 
        // Load templates
-       LOAD_TEMPLATE("admin_config_sub_points");
+       LOAD_TEMPLATE('admin_config_sub_points');
 } else {
        // Display selection box
-       LOAD_TEMPLATE("admin_config_points");
+       LOAD_TEMPLATE('admin_config_points');
 }
 
 //
index a3d8ede..90494cc 100644 (file)
@@ -210,7 +210,7 @@ VALUES ('%s','%s','%s','%s')",
                                );
 
                                // Load row template and switch color
-                               $OUT .= LOAD_TEMPLATE("admin_config_rallye_prices_row", true, $content);
+                               $OUT .= LOAD_TEMPLATE('admin_config_rallye_prices_row', true, $content);
                                $SW = 3 - $SW;
                        } // END - while
 
@@ -224,19 +224,26 @@ VALUES ('%s','%s','%s','%s')",
                        define('__RALLYE_ID', REQUEST_GET('rallye'));
 
                        // Load main template
-                       LOAD_TEMPLATE("admin_config_rallye_prices");
+                       LOAD_TEMPLATE('admin_config_rallye_prices');
                }
        }
 
        // Add form for adding new price level
        if (!REQUEST_ISSET_POST('edit')) {
-               LOAD_TEMPLATE("admin_add_rallye_prices", false, REQUEST_GET('rallye'));
+               LOAD_TEMPLATE('admin_add_rallye_prices', false, REQUEST_GET('rallye'));
        }
 } else {
        // No rallye selected so display all available without prices
-       $result = SQL_QUERY("SELECT d.id, d.admin_id, d.start_time, d.end_time, d.title, a.login, d.is_active
-FROM `{!_MYSQL_PREFIX!}_rallye_data` AS d, `{!_MYSQL_PREFIX!}_admins` AS a
-WHERE d.admin_id=a.id ORDER BY start_time DESC", __FILE__, __LINE__);
+       $result = SQL_QUERY("SELECT
+       d.id, d.admin_id, d.start_time, d.end_time, d.title, a.login, d.is_active
+FROM
+       `{!_MYSQL_PREFIX!}_rallye_data` AS d,
+LEFT JOIN
+       `{!_MYSQL_PREFIX!}_admins` AS a
+ON
+       d.admin_id=a.id
+ORDER BY
+       `d.start_time` DESC", __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // List found rallyes
                $OUT = ''; $SW = 2;
@@ -252,14 +259,14 @@ WHERE d.admin_id=a.id ORDER BY start_time DESC", __FILE__, __LINE__);
                                'select'     => $select,
                                'title'      => $content['title'],
                                'aid'        => $content['admin_id'],
-                               'email_link' => generateMemberEmailLink($content['admin_id']),
+                               'email_link' => generateEmailLink($content['admin_id']),
                                'alogin'     => $content['login'],
                                'start'      => generateDateTime($content['start_time'], '3'),
                                'end'        => generateDateTime($content['end_time'], '3'),
                        );
 
                        // Load row template and switch color
-                       $OUT .= LOAD_TEMPLATE("admin_list_rallye_prices_row", true, $content);
+                       $OUT .= LOAD_TEMPLATE('admin_list_rallye_prices_row', true, $content);
                        $SW = 3 - $SW;
                }
 
@@ -268,7 +275,7 @@ WHERE d.admin_id=a.id ORDER BY start_time DESC", __FILE__, __LINE__);
                define('__RALLYE_ROWS', $OUT);
 
                // Load main template
-               LOAD_TEMPLATE("admin_list_rallye_prices");
+               LOAD_TEMPLATE('admin_list_rallye_prices');
        } else {
                // No rallyes setup so far
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('RALLYE_NO_RALLYES_SETUP'));
index 1019bd1..aca046e 100644 (file)
@@ -46,10 +46,10 @@ ADD_DESCR('admin', __FILE__);
 // Init counter for deleted mails
 $cnt = 0;
 
-if (REQUEST_ISSET_GET(('mid'))) {
+if (REQUEST_ISSET_GET('mid')) {
        // Load email data
-       $result = SQL_QUERY_ESC("SELECT id, sender, subject, url, timestamp, payment_id FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
-       array(bigintval(REQUEST_GET('mid'))), __FILE__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `id`, `sender`, `subject`, `url`, `timestamp`, `payment_id` FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
+               array(bigintval(REQUEST_GET('mid'))), __FILE__, __LINE__);
 
        // Delete mail only once
        if (SQL_NUMROWS($result) == 1) {
@@ -78,20 +78,27 @@ if (REQUEST_ISSET_GET(('mid'))) {
                sendEmail($sender, getMessage('MEMBER_ORDER_DELETED'), $msg_user);
 
                // Fetch right stats_id from pool
-               $result_pool = SQL_QUERY_ESC("SELECT s.id FROM `{!_MYSQL_PREFIX!}_user_stats` AS s
-LEFT JOIN `{!_MYSQL_PREFIX!}_pool` AS p
-ON s.pool_id=p.id
-WHERE s.pool_id=%s LIMIT 1",
-               array(bigintval(REQUEST_GET('mid'))), __FILE__, __LINE__);
+               $result_pool = SQL_QUERY_ESC("SELECT
+       s.id
+FROM
+       `{!_MYSQL_PREFIX!}_user_stats` AS s
+LEFT JOIN
+       `{!_MYSQL_PREFIX!}_pool` AS p
+ON
+       s.pool_id=p.id
+WHERE
+       s.pool_id=%s
+LIMIT 1",
+                       array(bigintval(REQUEST_GET('mid'))), __FILE__, __LINE__);
                if (SQL_NUMROWS($result_pool) == 1) {
                        // Fetch stats id
                        list($stats_id) = SQL_FETCHROW($result_pool);
 
                        // Get all user links
-                       $links = GET_TOTAL_DATA($stats_id, "user_links", 'userid', "stats_id", true);
+                       $links = GET_TOTAL_DATA($stats_id, 'user_links', 'userid', 'stats_id', true);
 
                        // Reset sent mails for recipient(s)
-                       reduceRecipientReceivedMails("stats_id", REQUEST_GET('mid'), $links);
+                       reduceRecipientReceivedMails('stats_id', REQUEST_GET('mid'), $links);
 
                        // Calc total points and pay them back
                        $totalPoints = $links * $price;
@@ -145,7 +152,7 @@ WHERE s.pool_id=%s LIMIT 1",
 
                // Delete mail from queue
                SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
-               array(bigintval(REQUEST_GET('mid'))), __FILE__, __LINE__);
+                       array(bigintval(REQUEST_GET('mid'))), __FILE__, __LINE__);
                $cnt += SQL_AFFECTEDROWS();
 
                // Output link for manually removing stats entry
@@ -154,22 +161,22 @@ WHERE s.pool_id=%s LIMIT 1",
                // Mail already deleted!
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NORMAL_MAIL_ALREADY_DELETED'));
        }
-} elseif (REQUEST_ISSET_GET(('pid'))) {
+} elseif (REQUEST_ISSET_GET('pid')) {
        // Remove stats entries
-       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s LIMIT 1",
+       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `pool_id`=%s LIMIT 1",
        array(bigintval(REQUEST_GET('pid'))), __FILE__, __LINE__);
 
        // Output message
        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_USER_STATS_REMOVED'));
-} elseif ((REQUEST_ISSET_GET(('bid'))) && (EXT_IS_ACTIVE('bonus'))) {
+} elseif ((REQUEST_ISSET_GET('bid')) && (EXT_IS_ACTIVE('bonus'))) {
        // Load data from bonus mail
-       $result = SQL_QUERY_ESC("SELECT id, subject, url, timestamp, mails_sent FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s",
-       array(bigintval(REQUEST_GET('bid'))), __FILE__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `id`, `subject`, `url`, `timestamp`, `mails_sent` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s",
+               array(bigintval(REQUEST_GET('bid'))), __FILE__, __LINE__);
 
        // Delete mail only once
        if (SQL_NUMROWS($result) == 1) {
                // Load data
-               list ($id, $subject, $url, $timestamp, $sent) = SQL_FETCHROW($result);
+               list($id, $subject, $url, $timestamp, $sent) = SQL_FETCHROW($result);
 
                // Reset sent mails for recipient(s)
                reduceRecipientReceivedMails('bonus_id', REQUEST_GET('bid'), $sent);
@@ -179,10 +186,10 @@ WHERE s.pool_id=%s LIMIT 1",
 
                // Delete bonus mail entirely from database
                SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
-               array(bigintval(REQUEST_GET('bid'))), __FILE__, __LINE__);
+                       array(bigintval(REQUEST_GET('bid'))), __FILE__, __LINE__);
                $cnt += SQL_AFFECTEDROWS();
-               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s",
-               array(bigintval(REQUEST_GET('bid'))), __FILE__, __LINE__);
+               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `bonus_id`=%s",
+                       array(bigintval(REQUEST_GET('bid'))), __FILE__, __LINE__);
                $cnt += SQL_AFFECTEDROWS();
 
                // Prepare data for the template
@@ -193,7 +200,7 @@ WHERE s.pool_id=%s LIMIT 1",
                define('__CNT'    , $cnt);
 
                // Load template
-               LOAD_TEMPLATE("admin_del_email_bonus");
+               LOAD_TEMPLATE('admin_del_email_bonus');
        } else {
                // Mail already deleted!
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_BONUS_MAIL_ALREADY_DELETED'));
@@ -201,10 +208,10 @@ WHERE s.pool_id=%s LIMIT 1",
 
        // Free result
        SQL_FREERESULT($result);
-} elseif ((REQUEST_ISSET_GET(('nid'))) && (GET_EXT_VERSION('bonus') >= '0.8.7')) {
+} elseif ((REQUEST_ISSET_GET('nid')) && (GET_EXT_VERSION('bonus') >= '0.8.7')) {
        // Load data from bonus mail
-       $result = SQL_QUERY_ESC("SELECT id, subject, url, timestamp FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s",
-       array(bigintval(REQUEST_GET('nid'))), __FILE__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `id`, `subject`, `url`, `timestamp` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s",
+               array(bigintval(REQUEST_GET('nid'))), __FILE__, __LINE__);
 
        // Delete mail only once
        if (SQL_NUMROWS($result) == 1) {
@@ -217,10 +224,10 @@ WHERE s.pool_id=%s LIMIT 1",
 
                // Delete bonus mail entirely from database
                SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
-               array(bigintval(REQUEST_GET('nid'))), __FILE__, __LINE__);
+                       array(bigintval(REQUEST_GET('nid'))), __FILE__, __LINE__);
                $cnt += SQL_AFFECTEDROWS();
-               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s",
-               array(bigintval(REQUEST_GET('nid'))), __FILE__, __LINE__);
+               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `bonus_id`=%s",
+                       array(bigintval(REQUEST_GET('nid'))), __FILE__, __LINE__);
                $cnt += SQL_AFFECTEDROWS();
 
                // Prepare data for the template
@@ -231,7 +238,7 @@ WHERE s.pool_id=%s LIMIT 1",
                define('__CNT'    , $cnt);
 
                // Load template
-               LOAD_TEMPLATE("admin_del_email_notify");
+               LOAD_TEMPLATE('admin_del_email_notify');
        } else {
                // Mail already deleted!
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NOTIFY_MAIL_ALREADY_DELETED'));
index 926d513..b463096 100644 (file)
@@ -71,18 +71,17 @@ if ((isFormSent()) || ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST(('reas
        ADD_MEMBER_SELECTION_BOX();
 } else {
        // Realy want to delete?
-       $result = SQL_QUERY_ESC("SELECT email, surname, family FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+       $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__);
 
        // Found a row?
        if (SQL_NUMROWS($result) == 1) {
                // Load data
                list ($email, $sname, $fname) = SQL_FETCHROW($result);
-               SQL_FREERESULT($result);
 
                // Prepare content
                $content = array(
-                       'email'   => generateMemberEmailLink($email, "user_data"),
+                       'email'   => generateEmailLink($email, 'user_data'),
                        'surname' => $sname,
                        'family'  => $fname,
                        'header'  => sprintf(getMessage('ADMIN_HEADER_DEL_ACCOUNT'), REQUEST_GET('uid')),
@@ -91,7 +90,7 @@ if ((isFormSent()) || ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST(('reas
                );
 
                // Display form
-               LOAD_TEMPLATE("admin_del_user", false, $content);
+               LOAD_TEMPLATE('admin_del_user', false, $content);
        } else {
                // Account does not exists!
                LOAD_TEMPLATE('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");
index d2b000d..3c3cf91 100644 (file)
@@ -47,23 +47,32 @@ ADD_DESCR('admin', __FILE__);
 
 if ((REQUEST_ISSET_GET('id')) && (REQUEST_ISSET_GET('mode'))) {
        // Check for selected sponsor
-       $result = SQL_QUERY_ESC("SELECT company, position, gender, surname, family, street_nr1, street_nr2, zip, city, country, phone, fax, cell, email, url, tax_ident, receive_warnings, warning_interval FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
-       array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) == 1) {
+       $result_main = SQL_QUERY_ESC("SELECT
+       `company`, `position`, `gender`, `surname`, `family`,
+       `street_nr1`, `street_nr2`, `zip`, `city`, `country`,
+       `phone`, `fax`, `cell`, `email`, `url`, `tax_ident`,
+       `receive_warnings`, `warning_interval`
+FROM
+       `{!_MYSQL_PREFIX!}_sponsor_data`
+WHERE
+       `id`='%s'
+LIMIT 1",
+               array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+       if (SQL_NUMROWS($result_main) == 1) {
                // Load sponsor details
-               $DATA = SQL_FETCHARRAY($result);
-               SQL_FREERESULT($result);
+               $DATA = SQL_FETCHARRAY($result_main);
 
                // Prepare all data for the template
                //  Sponsor's ID
                define('__SPONSOR_ID' , bigintval(REQUEST_GET('id')));
+
                //  Company's data
                define('__COMPANY'    , $DATA['company']);
                define('__POSITION'   , $DATA['position']);
                define('__TAX_IDENT'  , $DATA['tax_ident']);
+
                //  Personal data
-               switch ($DATA['gender'])
-               {
+               switch ($DATA['gender']) {
                        case 'M':
                                define('__GENDER_M', ' selected="selected"');
                                define('__GENDER_F', '');
@@ -107,23 +116,22 @@ if ((REQUEST_ISSET_GET('id')) && (REQUEST_ISSET_GET('mode'))) {
                // Sponsor was found
                if ((isFormSent()) || (REQUEST_ISSET_POST('edit'))) {
                        // Perform action on mode
-                       switch (REQUEST_GET('mode'))
-                       {
-                               case "add_points": // Add points
+                       switch (REQUEST_GET('mode')) {
+                               case 'add_points': // Add points
                                        if (strval(REQUEST_POST('points')) > 0) {
                                                // Replace german decimal comma with computer's decimal dot
                                                $POINTS = strval(convertCommaToDot(REQUEST_POST('points')));
 
                                                // Add points to account
-                                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET points_amount=points_amount+%s WHERE `id`='%s' LIMIT 1",
-                                               array($POINTS, bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+                                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `points_amount`=`points_amount`+%s WHERE `id`='%s' LIMIT 1",
+                                                       array($POINTS, bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
 
                                                // Remember points /reason for the template
                                                define('__POINTS' , translateComma($POINTS));
                                                define('__REASON' , REQUEST_POST('reason'));
 
                                                // Send email
-                                               $msg = LOAD_EMAIL_TEMPLATE("sponsor_add_points", REQUEST_POST('reason'), true);
+                                               $msg = LOAD_EMAIL_TEMPLATE('sponsor_add_points', REQUEST_POST('reason'), true);
                                                sendEmail(__EMAIL, ADMIN_SPONSOR_ADD_POINTS_SUBJ, $msg);
                                                $message = ADMIN_SPONSOR_POINTS_ADDED;
                                        } else {
@@ -132,21 +140,21 @@ if ((REQUEST_ISSET_GET('id')) && (REQUEST_ISSET_GET('mode'))) {
                                        }
                                        break;
 
-                               case "sub_points": // Subtract points
+                               case 'sub_points': // Subtract points
                                        if (strval(REQUEST_POST('points')) > 0) {
                                                // Replace german decimal comma with computer's decimal dot
                                                $POINTS = strval(convertCommaToDot(REQUEST_POST('points')));
 
                                                // Add points to account
-                                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET points_used=points_used+%s WHERE `id`='%s' LIMIT 1",
-                                               array($POINTS, bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+                                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `points_used`=`points_used`+%s WHERE `id`='%s' LIMIT 1",
+                                                       array($POINTS, bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
 
                                                // Remember points /reason for the template
                                                define('__POINTS' , translateComma($POINTS));
                                                define('__REASON' , REQUEST_POST('reason'));
 
                                                // Send email
-                                               $msg = LOAD_EMAIL_TEMPLATE("sponsor_sub_points", REQUEST_POST('reason'), true);
+                                               $msg = LOAD_EMAIL_TEMPLATE('sponsor_sub_points', REQUEST_POST('reason'), true);
                                                sendEmail(__EMAIL, ADMIN_SPONSOR_SUB_POINTS_SUBJ, $msg);
                                                $message = ADMIN_SPONSOR_POINTS_SUBTRACTED;
                                        } else {
@@ -165,7 +173,7 @@ if ((REQUEST_ISSET_GET('id')) && (REQUEST_ISSET_GET('mode'))) {
                                        }
 
                                        // Convert time selection
-                                       $DATA = array(); $id = "warning_interval_ye"; $skip = false;
+                                       $DATA = array(); $id = 'warning_interval_ye'; $skip = false;
                                        convertSelectionsToTimestamp(REQUEST_POST_ARRAY(), $DATA, $id, $skip);
 
                                        // Save the sponsor
@@ -175,10 +183,10 @@ if ((REQUEST_ISSET_GET('id')) && (REQUEST_ISSET_GET('mode'))) {
                                        REQUEST_POST('gender'          , translateGender(REQUEST_POST('gender')));
                                        REQUEST_POST('warning_interval', createFancyTime(REQUEST_POST('warning_interval')));
 
-                                       if (!$PASS) REQUEST_SET_POST('pass1', getMessage('SPONSOR_PASS_UNCHANGED'));
+                                       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);
+                                       $msg = LOAD_EMAIL_TEMPLATE('admin_sponsor_edit', REQUEST_POST_ARRAY(), false);
                                        sendEmail(REQUEST_POST('email'), getMessage('ADMIN_SPONSOR_EDIT_SUBJECT'), $msg);
                                        break;
 
@@ -194,7 +202,7 @@ if ((REQUEST_ISSET_GET('id')) && (REQUEST_ISSET_GET('mode'))) {
                        } // END - if
                } elseif (isFileReadable(sprintf("%stemplates/%s/html/admin/%s.tpl", constant('PATH'), getLanguage(), $TPL))) {
                        // Create mailto link
-                       define('__SPONSOR_VALUE', "<a href=\"mailto:{!__EMAIL!}\">{!__SURNAME!} {!__FAMILY!}</a>");
+                       define('__SPONSOR_VALUE', "<a href=\"" . generateEmailLink(constant('__EMAIL'), 'sponsor_data') . "\">{!__SURNAME!} {!__FAMILY!}</a>");
 
                        // Load mode template
                        LOAD_TEMPLATE($TPL);
@@ -206,6 +214,9 @@ if ((REQUEST_ISSET_GET('id')) && (REQUEST_ISSET_GET('mode'))) {
                // Sponsor not found!
                LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_SPONSOR_404'), bigintval(REQUEST_GET('id'))));
        }
+
+       // Free result
+       SQL_FREERESULT($result_main);
 } else {
        // Not called by what-list_sponsor.php
        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_CALL_NOT_DIRECTLY'));
index 8552a23..baed73f 100644 (file)
@@ -58,25 +58,20 @@ $chk = 0;
 if (REQUEST_ISSET_POST('sel')) $chk = countPostSelection();
 
 // List all menu points and make them editable
-if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
-{
+if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) {
        // Edit menu entries
        define('__SUB_VALUE', $SUB);
        define('__CHK_VALUE', $chk);
 
        $cnt = 0; $OUT = ''; $SW = 2;
-       foreach (REQUEST_POST('sel') as $sel => $confirm)
-       {
-               if ($confirm == 1)
-               {
+       foreach (REQUEST_POST('sel') as $sel => $confirm) {
+               if ($confirm == 1) {
                        $cnt++;
-                       $result = SQL_QUERY_ESC("SELECT title, action, what FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE ".$AND." AND id=%s LIMIT 1",
-                       array(bigintval($sel)), __FILE__, __LINE__);
-                       if (SQL_NUMROWS($result) == 1)
-                       {
+                       $result = SQL_QUERY_ESC("SELECT `title`, `action`, `what` FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
+                               array(bigintval($sel)), __FILE__, __LINE__);
+                       if (SQL_NUMROWS($result) == 1) {
                                // Entry found so we load the stuff...
                                list($menu, $act, $wht) = SQL_FETCHROW($result);
-                               SQL_FREERESULT($result);
                                $DATA = array(
                                        'cnt'    => $cnt,
                                        'sel'    => $sel,
@@ -85,55 +80,58 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
                                        'menu'   => $menu,
                                        'sw'     => $SW,
                                );
-                               $OUT .= LOAD_TEMPLATE("admin_gmenu_edit_row", true, $DATA);
-                       }
-                       else
-                       {
+                               $OUT .= LOAD_TEMPLATE('admin_gmenu_edit_row', true, $DATA);
+                       } else {
                                // Entry not found?
                                $content = array(
                                        'sw'  => $SW,
                                        'sel' => $sel
                                );
-                               $OUT .= LOAD_TEMPLATE("admin_menu_404_row", true, $content);
+                               $OUT .= LOAD_TEMPLATE('admin_menu_404_row', true, $content);
                        }
+                       SQL_FREERESULT($result);
                        $SW = 3 - $SW;
-               }
-       }
+               } // END - if
+       } // END - foreach
+
        define('__MENU_ROWS', $OUT);
        define('__CNT_VALUE', $cnt);
 
        // Load template
-       LOAD_TEMPLATE("admin_gmenu_edit_form");
+       LOAD_TEMPLATE('admin_gmenu_edit_form');
 } elseif ((REQUEST_ISSET_POST('del')) && (!IS_DEMO())) {
        // Del menu entries with or without confirmation
        define('__SUB_VALUE', $SUB);
        define('__CHK_VALUE', $chk);
 
-       $cnt = 0; $OUT = ''; $SW = 2;
+       $cnt = 0;
+       $OUT = '';
+       $SW  = 2;
+
        foreach (REQUEST_POST('sel') as $sel => $confirm) {
                if ($confirm == 1) {
                        $cnt++;
-                       $result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE ".$AND." AND id=%s LIMIT 1",
-                       array(bigintval($sel)), __FILE__, __LINE__);
+                       $result = SQL_QUERY_ESC("SELECT `title` FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
+                               array(bigintval($sel)), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result) == 1) {
                                // Entry found so we load the stuff...
                                list($menu) = SQL_FETCHROW($result);
-                               SQL_FREERESULT($result);
                                $DATA = array(
                                        'cnt'  => $cnt,
                                        'menu' => $menu,
                                        'sel'  => $sel,
                                        'sw'   => $SW,
                                );
-                               $OUT .= LOAD_TEMPLATE("admin_gmenu_delete_row", true, $DATA);
+                               $OUT .= LOAD_TEMPLATE('admin_gmenu_delete_row', true, $DATA);
                        } else {
                                // Entry not found?
                                $content = array(
                                        'sw'  => $SW,
                                        'sel' => $sel
                                );
-                               $OUT .= LOAD_TEMPLATE("admin_menu_404_row", true, $content);
+                               $OUT .= LOAD_TEMPLATE('admin_menu_404_row', true, $content);
                        }
+                       SQL_FREERESULT($result);
                        $SW = 3 - $SW;
                }
        }
@@ -141,11 +139,10 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
        define('__CNT_VALUE', $cnt);
 
        // Load template
-       LOAD_TEMPLATE("admin_gmenu_delete");
+       LOAD_TEMPLATE('admin_gmenu_delete');
 } elseif ((isFormSent()) && (!IS_DEMO())) {
        // An action is done...
-       switch (REQUEST_POST('ok'))
-       {
+       switch (REQUEST_POST('ok')) {
                case 'edit': // Edit menu
                        foreach (REQUEST_POST('sel') as $sel => $menu) {
                                // Secure selector
@@ -153,8 +150,8 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
 
                                // Update entry
                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `title`='%s', `action`='%s', `what`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
-                               array($menu, REQUEST_POST('sel_action', $sel), REQUEST_POST('sel_what', $sel), $sel),__FILE__, __LINE__);
-                       }
+                                       array($menu, REQUEST_POST('sel_action', $sel), REQUEST_POST('sel_what', $sel), $sel),__FILE__, __LINE__);
+                       } // END - foreach
                        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
                        break;
 
@@ -162,8 +159,8 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
                        foreach (REQUEST_POST('sel') as $sel => $menu) {
                                // Delete enty
                                SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE ".$AND." AND id=%s LIMIT 1",
-                               array(bigintval($sel)), __FILE__, __LINE__);
-                       }
+                                       array(bigintval($sel)), __FILE__, __LINE__);
+                       } // END - foreach
                        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
                        break;
 
@@ -174,36 +171,32 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
 
                                // Update entry
                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `visible`='%s', `locked`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
-                               array(REQUEST_POST('visible', $sel), REQUEST_POST('locked', $sel), $sel), __FILE__, __LINE__);
-                       }
+                                       array(REQUEST_POST('visible', $sel), REQUEST_POST('locked', $sel), $sel), __FILE__, __LINE__);
+                       } // END - foreach
                        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
                        break;
 
                default: // Unexpected action
                        define('__OK_VALUE', REQUEST_POST('ok'));
                        DEBUG_LOG(__FILE__, __LINE__, sprintf("Unsupported action %s detected.", REQUEST_POST('ok')));
-                       LOAD_TEMPLATE("admin_menu_unknown_okay");
+                       LOAD_TEMPLATE('admin_menu_unknown_okay');
                        break;
-       }
-} elseif ((REQUEST_ISSET_POST(('status'))) && ($chk > 0) && (!IS_DEMO())) {
+       } // END - switch
+} elseif ((REQUEST_ISSET_POST('status')) && ($chk > 0) && (!IS_DEMO())) {
        // Change status (visible / locked)
        define('__SUB_VALUE', $SUB);
        define('__CHK_VALUE', $chk);
 
        // Load template
        $SW = 2; $cnt = 0; $OUT = '';
-       foreach (REQUEST_POST('sel') as $sel => $confirm)
-       {
-               if ($confirm == 1)
-               {
+       foreach (REQUEST_POST('sel') as $sel => $confirm) {
+               if ($confirm == 1) {
                        $cnt++;
                        $result = SQL_QUERY_ESC("SELECT title, visible, locked FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE ".$AND." AND id=%s LIMIT 1",
-                       array(bigintval($sel)), __FILE__, __LINE__);
-                       if (SQL_NUMROWS($result) == 1)
-                       {
+                               array(bigintval($sel)), __FILE__, __LINE__);
+                       if (SQL_NUMROWS($result) == 1) {
                                // Entry found so we load the stuff...
                                list($menu, $vis, $locked) = SQL_FETCHROW($result);
-                               SQL_FREERESULT($result);
                                $content = array(
                                        'cnt'     => $cnt,
                                        'menu'    => $menu,
@@ -215,9 +208,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
 
                                // Load template
                                $OUT .= LOAD_TEMPLATE('admin_menu_status_row', true, $content);
-                       }
-                       else
-                       {
+                       } else {
                                // Entry not found?
                                $content = array(
                                        'sw'  => $SW,
@@ -225,45 +216,47 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
                                );
                                $OUT .= LOAD_TEMPLATE('admin_menu_404_row', true, $content);
                        }
+
+                       SQL_FREERESULT($result);
                        $SW = 3 - $SW;
-               }
-       }
+               } // END - if
+       } // END - foreach
        define('__CNT_VALUE', $cnt);
        define('__MENU_ROWS', $OUT);
 
        // Load template
        LOAD_TEMPLATE('admin_gmenu_status');
 } else {
-       if ((REQUEST_ISSET_GET(('act'))) && (REQUEST_ISSET_GET(('tid'))) && (REQUEST_ISSET_GET(('fid')))) {
+       if ((REQUEST_ISSET_GET('act')) && (REQUEST_ISSET_GET('tid')) && (REQUEST_ISSET_GET('fid'))) {
                // Get IDs
-               if (REQUEST_ISSET_GET(('w'))) {
+               if (REQUEST_ISSET_GET('w')) {
                        // Sub menus selected
                        $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
-                       array(REQUEST_GET('act'), bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
+                               array(REQUEST_GET('act'), bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
                        list($tid) = SQL_FETCHROW($result);
                        SQL_FREERESULT($result);
                        $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
-                       array(REQUEST_GET('act'), bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
+                               array(REQUEST_GET('act'), bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
                        list($fid) = SQL_FETCHROW($result);
                        SQL_FREERESULT($result);
                } else {
                        // Main menu selected
                        $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
-                       array(bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
+                               array(bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
                        list($tid) = SQL_FETCHROW($result);
                        SQL_FREERESULT($result);
                        $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
-                       array(bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
+                               array(bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
                        list($fid) = SQL_FETCHROW($result);
                        SQL_FREERESULT($result);
                }
 
                if ((!empty($tid)) && (!empty($fid))) {
                        // Sort menu
-                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `sort`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
-                       array(bigintval(REQUEST_GET('tid')), bigintval($fid)), __FILE__, __LINE__);
-                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `sort`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
-                       array(bigintval(REQUEST_GET('fid')), bigintval($tid)), __FILE__, __LINE__);
+                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `sort`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
+                               array(bigintval(REQUEST_GET('tid')), bigintval($fid)), __FILE__, __LINE__);
+                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `sort`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
+                               array(bigintval(REQUEST_GET('fid')), bigintval($tid)), __FILE__, __LINE__);
                } // END - if
        } // END - if
 
@@ -274,7 +267,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
        } else {
                // List sub menus
                $result = SQL_QUERY_ESC("SELECT `id`,`action`,`what`,`title`,`sort` FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC",
-               array($SUB), __FILE__, __LINE__);
+                       array($SUB), __FILE__, __LINE__);
        }
 
        // Get number of menu entries
@@ -307,6 +300,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
                        if (empty($content['what']))   $content['what']   = '&nbsp;';
                        if (empty($content['title']))  $content['title']  = '&nbsp;';
 
+                       // Prepapre content
                        $content = array(
                                'sw'     => $SW,
                                'id'     => $content['id'],
@@ -315,10 +309,12 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
                                'title'  => $content['title'],
                                'navi'   => $NAVI,
                                'mode'   => 'guest'
-                               );
-                               $OUT .= LOAD_TEMPLATE('admin_menu_overview_row', true, $content);
-                               $SW = 3 - $SW;
-               }
+                       );
+
+                       // Load row template
+                       $OUT .= LOAD_TEMPLATE('admin_menu_overview_row', true, $content);
+                       $SW = 3 - $SW;
+               } // END - while
 
                // Free memory
                SQL_FREERESULT($result);
index 9dbd590..57b6a3f 100644 (file)
@@ -56,19 +56,26 @@ if (getConfig('def_refid') > 0) {
 if (EXT_IS_ACTIVE('beg'))                  $EXCLUDE_LIST .= " AND d.userid != ".getConfig('beg_uid')."";
 if (EXT_IS_ACTIVE('bonus'))                $EXCLUDE_LIST .= " AND d.userid != ".getConfig('bonus_uid')."";
 if (EXT_IS_ACTIVE('doubler'))              $EXCLUDE_LIST .= " AND d.userid != ".getConfig('doubler_uid')."";
-if (GET_EXT_VERSION('holiday') >= '0.1.3') $EXCLUDE_LIST .= " AND d.`holiday_active`='N'";
+if (GET_EXT_VERSION('holiday') >= '0.1.3') $EXCLUDE_LIST .= " AND d.holiday_active='N'";
 
 // Check for all accounts
-$result = SQL_QUERY_ESC("SELECT DISTINCT d.userid, d.gender, d.surname, d.family, d.email, d.joined, d.last_online, d.ap_notified
-FROM `{!_MYSQL_PREFIX!}_user_data` AS d
-WHERE d.`status`='CONFIRMED' AND d.joined < (UNIX_TIMESTAMP() - %s) AND d.last_online < (UNIX_TIMESTAMP() - %s) AND d.ap_notified < (UNIX_TIMESTAMP() - %s)
-".$EXCLUDE_LIST."
-ORDER BY d.userid",
-array(
-getConfig('ap_inactive_since'),
-getConfig('ap_inactive_since'),
-getConfig('ap_inactive_since')
-), __FILE__, __LINE__);
+$result = SQL_QUERY_ESC("SELECT DISTINCT
+       d.userid, d.gender, d.surname, d.family, d.email, d.joined, d.last_online, d.ap_notified
+FROM
+       `{!_MYSQL_PREFIX!}_user_data` AS d
+WHERE
+       d.`status`='CONFIRMED' AND
+       d.joined < (UNIX_TIMESTAMP() - %s) AND
+       d.last_online < (UNIX_TIMESTAMP() - %s) AND
+       d.ap_notified < (UNIX_TIMESTAMP() - %s)
+       ".$EXCLUDE_LIST."
+ORDER BY
+       d.userid ASC",
+       array(
+               getConfig('ap_inactive_since'),
+               getConfig('ap_inactive_since'),
+               getConfig('ap_inactive_since')
+       ), __FILE__, __LINE__);
 
 if (SQL_NUMROWS($result) > 0) {
        // Ok, we have found some inactive accounts
@@ -82,14 +89,14 @@ if (SQL_NUMROWS($result) > 0) {
                        'gender'   => translateGender($content['gender']),
                        'sname'    => $content['surname'],
                        'fname'    => $content['family'],
-                       'email'    => "<a href=\"".generateMemberEmailLink($content['email'], "user_data")."\">".$content['email']."</a>",
+                       'email'    => "<a href=\"".generateEmailLink($content['email'], 'user_data')."\">".$content['email']."</a>",
                        'joined'   => generateDateTime($content['joined'], '2'),
                        'last'     => generateDateTime($content['last_online'], '2'),
                        'notified' => generateDateTime($content['ap_notified'], '2'),
                );
 
                // Load row template
-               $OUT .= LOAD_TEMPLATE("admin_list_autopurge_row", true, $content);
+               $OUT .= LOAD_TEMPLATE('admin_list_autopurge_row', true, $content);
                $SW = 3 - $SW;
        }
 
@@ -99,7 +106,7 @@ if (SQL_NUMROWS($result) > 0) {
        define('__AUTOPURGE_ROWS', $OUT);
 
        // Load main template
-       LOAD_TEMPLATE("admin_list_autopurge");
+       LOAD_TEMPLATE('admin_list_autopurge');
 } else {
        // All members are active or you don't have any registered
        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_AUTOPURGE_ALL_ACTIVE'));
index aa52994..0ffdfb9 100644 (file)
@@ -86,7 +86,7 @@ ORDER BY beg_points DESC, last_online DESC, userid",
                        // @TODO to shorten this block. Please also do so with uid->userid
                        $content = array(
                                'uid'    => $content['userid'],
-                               'email'  => generateMemberEmailLink($content['email'], "user_data"),
+                               'email'  => generateEmailLink($content['email'], 'user_data'),
                                'gender' => translateGender($content['gender']),
                                'sname'  => $content['surname'],
                                'fname'  => $content['family'],
index 1052ebf..8978037 100644 (file)
@@ -101,7 +101,7 @@ ORDER BY points DESC, last_online DESC, userid",
 
                        // Prepare content
                        $content['uid']    = generateUserProfileLink($content['uid']);
-                       $content['email']  = generateMemberEmailLink($content['email'], "user_data");
+                       $content['email']  = generateEmailLink($content['email'], 'user_data');
                        $content['gender'] = translateGender($content['gender']);
                        $content['points'] = translateComma($content['points']);
                        $content['last']   = generateDateTime($content['last'], '2');
index 4483c96..05e1c85 100644 (file)
@@ -48,8 +48,8 @@ ADD_DESCR('admin', __FILE__);
 
 if (REQUEST_ISSET_GET('uid')) {
        // Check if the user already exists
-       $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__);
+       $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__);
        if (SQL_NUMROWS($result) == 1) {
                // Loads surname, family's name and the email address
                list($sname, $fname, $email) = SQL_FETCHROW($result);
@@ -59,17 +59,17 @@ if (REQUEST_ISSET_GET('uid')) {
                define('__CATS_BASE'   , "<a href=\"{!URL!}/modules.php?module=admin&amp;uid=");
                define('__UID'         , bigintval(REQUEST_GET('uid')));
                define('__MEMBER_LINKS', generateMemberAdminActionLinks(constant('__UID')));
-               define('__EMAIL'       , "<a href=\"".generateMemberEmailLink($email, "user_data")."\">".$sname." ".$fname."</a>");
+               define('__EMAIL'       , "<a href=\"".generateEmailLink($email, 'user_data')."\">".$sname." ".$fname."</a>");
 
                // Ok, list categories of this user
-               $result_cats = SQL_QUERY("SELECT id, cat FROM `{!_MYSQL_PREFIX!}_cats` ORDER BY `sort`", __FILE__, __LINE__);
+               $result_cats = SQL_QUERY("SELECT `id`, `cat` FROM `{!_MYSQL_PREFIX!}_cats` ORDER BY `sort` ASC", __FILE__, __LINE__);
 
                if (SQL_NUMROWS($result_cats) > 0) {
                        // List categories
                        $cnt = 1; $OUT = ''; $SW = 2;
                        while ($content = SQL_FETCHARRAY($result_cats)) {
                                // Check user's selection
-                               $result_user = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE userid=%s AND cat_id=%s LIMIT 1",
+                               $result_user = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE `userid`=%s AND `cat_id`=%s LIMIT 1",
                                array(bigintval(REQUEST_GET('uid')), bigintval($content['id'])), __FILE__, __LINE__);
 
                                // Set selection
@@ -82,7 +82,7 @@ if (REQUEST_ISSET_GET('uid')) {
                                $content['sel'] = $selection;
 
                                // Load row template and switch colors + count up
-                               $OUT .= LOAD_TEMPLATE("admin_list_cats_row", true, $content);
+                               $OUT .= LOAD_TEMPLATE('admin_list_cats_row', true, $content);
                                $SW = 3 - $SW; $cnt++;
                        } // END - while
 
@@ -93,10 +93,10 @@ if (REQUEST_ISSET_GET('uid')) {
                        define('__CATS_ROWS', $OUT);
 
                        // Load main template
-                       LOAD_TEMPLATE("admin_list_cats");
+                       LOAD_TEMPLATE('admin_list_cats');
                } else {
                        // No categories selected! :-(
-                       LOAD_TEMPLATE("admin_list_cats_404");
+                       LOAD_TEMPLATE('admin_list_cats_404');
                }
        } else {
                // User not found
index 12058cc..aa10df7 100644 (file)
@@ -140,10 +140,10 @@ if (REQUEST_ISSET_GET('uid')) {
                                                );
 
                                                // Load row template
-                                               $OUT .= LOAD_TEMPLATE("admin_list_links_row", true, $content);
+                                               $OUT .= LOAD_TEMPLATE('admin_list_links_row', true, $content);
                                        } else {
                                                // Load template for error
-                                               $OUT .= LOAD_TEMPLATE("admin_list_links_problem",
+                                               $OUT .= LOAD_TEMPLATE('admin_list_links_problem',
                                                array(
                                                                'sw'            => $SW,
                                                                'problem'       => $PROBLEM,
@@ -160,13 +160,13 @@ if (REQUEST_ISSET_GET('uid')) {
                                // Remember list in constant for the template
                                define('__SNAME_VALUE', $sname);
                                define('__FNAME_VALUE', $fname);
-                               define('__EMAIL_VALUE', "<a href=\"".generateMemberEmailLink($email, "user_data")."\">".$email."</a>");
+                               define('__EMAIL_VALUE', "<a href=\"" . generateEmailLink($email, 'user_data') . "\">".$email."</a>");
                                define('__EMAIL_LIST' , $OUT);
                                define('__NUMS_VALUE' , $nums);
                                define('__UID'        , bigintval(REQUEST_GET('uid')));
 
                                // Load final template
-                               LOAD_TEMPLATE("admin_list_links");
+                               LOAD_TEMPLATE('admin_list_links');
                        }
                } else {
                        // No mails left to confirm
index 13e6812..b8e0c5c 100644 (file)
@@ -76,35 +76,39 @@ if (REQUEST_ISSET_GET(('pid'))) {
                SQL_FREERESULT($result);
 
                // Konstante bauen
-               define('PAYOUT_USERDATA_VALUE', "<a href=\"".generateMemberEmailLink($email, "user_data")."\">".translateGender($gender)." ".$surname." ".$family."</a>");
+               define('PAYOUT_USERDATA_VALUE', "<a href=\"".generateEmailLink($email, 'user_data')."\">".translateGender($gender)." ".$surname." ".$family."</a>");
 
-               if ((REQUEST_GET('do') == "accept") && (!empty($email))) {
+               if ((REQUEST_GET('do') == 'accept') && (!empty($email))) {
                        // Ok, now we can output the form or execute accepting
                        if (isFormSent()) {
                                // Obtain payout type and other data
-                               $result = SQL_QUERY_ESC("SELECT payout_id FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE `id`=%s LIMIT 1",
+                               $result = SQL_QUERY_ESC("SELECT `payout_id` FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE `id`=%s LIMIT 1",
                                array(bigintval(REQUEST_GET('pid'))), __FILE__, __LINE__);
                                list($ptype) = SQL_FETCHROW($result);
                                SQL_FREERESULT($result);
 
                                if (!empty($ptype)) {
                                        // Obtain data from payout type
-                                       $result = SQL_QUERY_ESC("SELECT from_account, from_pass, engine_url, engine_ret_ok, engine_ret_failed, pass_enc, allow_url FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE `id`=%s LIMIT 1",
-                                       array(bigintval($ptype)), __FILE__, __LINE__);
+                                       $result = SQL_QUERY_ESC("SELECT `from_account`, `from_pass`, `engine_url`, `engine_ret_ok`, `engine_ret_failed`, `pass_enc`, `allow_url`
+FROM
+       `{!_MYSQL_PREFIX!}_payout_types`
+WHERE
+       `id`=%s
+LIMIT 1",
+                                               array(bigintval($ptype)), __FILE__, __LINE__);
                                        list($fuid, $fpass, $eurl, $eok, $failed, $eenc, $allow) = SQL_FETCHROW($result);
                                        SQL_FREERESULT($result);
 
                                        if (!empty($eurl)) {
                                                // Ok, run URL...
                                                $eurl = COMPILE_CODE($eurl);
-                                               switch ($eenc)
-                                               {
-                                                       case "md5":
+                                               switch ($eenc) {
+                                                       case 'md5':
                                                                $fpass = md5($fpass);
                                                                $tpass = md5($tpass);
                                                                break;
 
-                                                       case "base64":
+                                                       case 'base64':
                                                                $fpass = base64_encode($fpass);
                                                                $tpass = base64_encode($tpass);
                                                                break;
@@ -135,7 +139,7 @@ if (REQUEST_ISSET_GET(('pid'))) {
                                                array(bigintval(REQUEST_GET('pid'))), __FILE__, __LINE__);
 
                                                // Send out mail
-                                               $msg = LOAD_EMAIL_TEMPLATE("member_payout_accepted", REQUEST_POST('text'), $uid);
+                                               $msg = LOAD_EMAIL_TEMPLATE('member_payout_accepted', REQUEST_POST('text'), $uid);
 
                                                // Output message
                                                if ($allow == 'Y') {
@@ -165,22 +169,22 @@ if (REQUEST_ISSET_GET(('pid'))) {
                                );
 
                                // Load template
-                               LOAD_TEMPLATE("admin_payout_accept_form", false, $content);
+                               LOAD_TEMPLATE('admin_payout_accept_form', false, $content);
                        }
-               } elseif ((REQUEST_GET('do') == "reject") && (!empty($email))) {
+               } elseif ((REQUEST_GET('do') == 'reject') && (!empty($email))) {
                        // Ok, now we can output the form or execute rejecting
                        if (isFormSent()) {
                                if ($task > 0) {
                                        // Clear task
                                        runFilterChain('solve_task', $task);
-                               }
+                               } // END - if
 
                                // Clear payout request
                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_payouts` SET `status`='REJECTED' 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_rejected", REQUEST_POST('text'), $uid);
+                               $msg = LOAD_EMAIL_TEMPLATE('member_payout_rejected', REQUEST_POST('text'), $uid);
 
                                // Output message
                                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('PAYOUT_REJECTED_NOTIFIED'));
@@ -195,7 +199,7 @@ if (REQUEST_ISSET_GET(('pid'))) {
                                );
 
                                // Load template
-                               LOAD_TEMPLATE("admin_payout_reject_form", false, $content);
+                               LOAD_TEMPLATE('admin_payout_reject_form', false, $content);
                        }
                } else {
                        // Cannot load user data
@@ -208,22 +212,31 @@ if (REQUEST_ISSET_GET(('pid'))) {
 } else {
        if (!REQUEST_ISSET_GET('do')) REQUEST_SET_GET('do', '');
 
-       if (REQUEST_GET('do') == "delete") {
+       if (REQUEST_GET('do') == 'delete') {
                // Delete all requests
-               $result = SQL_QUERY("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_payouts`", __FILE__, __LINE__);
-       }
+               $result = SQL_QUERY("TRUNCATE `{!_MYSQL_PREFIX!}_user_payouts`", __FILE__, __LINE__);
+       } // END - if
 
        // Search for payouts
-       $result = SQL_QUERY("SELECT p.id, p.userid AS uid, p.payout_total, p.target_account, p.target_bank, t.type, p.payout_timestamp, p.status, t.allow_url AS allow, p.target_url AS url, p.link_text AS alt, p.banner_url AS banner
-FROM `{!_MYSQL_PREFIX!}_user_payouts` AS p, `{!_MYSQL_PREFIX!}_payout_types` AS t
-WHERE p.payout_id=t.id
-ORDER BY p.payout_timestamp DESC", __FILE__, __LINE__);
+       $result = SQL_QUERY("SELECT
+       p.id, p.userid AS uid, p.payout_total, p.target_account,
+       p.target_bank, t.type, p.payout_timestamp, p.status,
+       t.allow_url AS allow, p.target_url AS url, p.link_text AS alt,
+       p.banner_url AS banner
+FROM
+       `{!_MYSQL_PREFIX!}_user_payouts` AS p
+LEFT JOIN
+       `{!_MYSQL_PREFIX!}_payout_types` AS t
+ON
+       p.payout_id=t.id
+ORDER BY
+       p.payout_timestamp DESC", __FILE__, __LINE__);
 
        if (SQL_NUMROWS($result) > 0) {
                // List found payouts
                $OUT = ''; $SW = 2;
                while ($content = SQL_FETCHARRAY($result)) {
-                       if ($content['status'] == "NEW") {
+                       if ($content['status'] == 'NEW') {
                                // Generate links for direct accepting and rejecting
                                $content['status'] = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_payouts&amp;do=accept&amp;pid=".$content['id']."\">".PAYOUT_ACCEPT_PAYOUT."</a>&nbsp;|&nbsp;<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_payouts&amp;do=reject&amp;pid=".$content['id']."\">".PAYOUT_REJECT_PAYOUT."</a>";
                        } else {
@@ -237,10 +250,10 @@ ORDER BY p.payout_timestamp DESC", __FILE__, __LINE__);
                                // Banner/Textlink views/clicks request
                                if (!empty($content['banner'])) {
                                        // Load template for the banner
-                                       $content['target_account'] = LOAD_TEMPLATE("admin_list_payouts_banner", true, $content);
+                                       $content['target_account'] = LOAD_TEMPLATE('admin_list_payouts_banner', true, $content);
                                } else {
                                        // Textlink
-                                       $content['target_account'] = LOAD_TEMPLATE("admin_list_payouts_txt", true, $content);
+                                       $content['target_account'] = LOAD_TEMPLATE('admin_list_payouts_txt', true, $content);
                                }
 
                                // Admins can addionally test the URL for framekillers
@@ -263,7 +276,7 @@ ORDER BY p.payout_timestamp DESC", __FILE__, __LINE__);
                        );
 
                        // Add row and switch color
-                       $OUT .= LOAD_TEMPLATE("admin_list_payouts_row", true, $content);
+                       $OUT .= LOAD_TEMPLATE('admin_list_payouts_row', true, $content);
                        $SW = 3 - $SW;
                }
 
@@ -272,11 +285,12 @@ ORDER BY p.payout_timestamp DESC", __FILE__, __LINE__);
                define('__PAYOUT_ROWS', $OUT);
 
                // Load final template
-               LOAD_TEMPLATE("admin_list_payouts");
+               LOAD_TEMPLATE('admin_list_payouts');
        } else {
                // No payout requests are sent so far
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('PAYOUT_ADMIN_NO_REQUESTS_FOUND'));
        }
 }
-//
+
+// [EOF]
 ?>
index 44d0d72..c2ed620 100644 (file)
@@ -243,12 +243,12 @@ LIMIT 1",
                        if (($content['refs'] > 0) || ($cnt > 0)) {
                                // Insert link to referal list
                                //* DEBUG: */ echo '-'.$content['userid'].'/'.$cnt.'/'.$content['refs']."-<br />";
-                               $cnt = generateUserProfileLink($content['userid'], $cnt, "list_refs");
-                               $content['refs'] = generateUserProfileLink($content['userid'], $content['refs'], "list_refs");
+                               $cnt = generateUserProfileLink($content['userid'], $cnt, 'list_refs');
+                               $content['refs'] = generateUserProfileLink($content['userid'], $content['refs'], 'list_refs');
                        } // END - if
 
                        // Get user points
-                       $points = GET_TOTAL_DATA($content['userid'], "user_points", "points", 'userid', false, " AND ref_depth=1 LIMIT 1");
+                       $points = GET_TOTAL_DATA($content['userid'], 'user_points', 'points', 'userid', false, " AND `ref_depth`=1 LIMIT 1");
                        //* DEBUG: */ echo basename(__FILE__).":uid={$content['userid']},points={$points},opoints={$content['curr_points']}<br />\n";
 
                        // Prepare content
@@ -310,7 +310,7 @@ ORDER BY start_time DESC",
                        $content = array(
                                'select'     => "<input type=\"checkbox\" name=\"sel[".$content['id']."]\" class=\"admin_normal\" value=\"1\" />",
                                'aid'        => $content['admin_id'],
-                               'email_link' => generateMemberEmailLink($content['admin_id']),
+                               'email_link' => generateEmailLink($content['admin_id']),
                                'alogin'     => $content['alogin'],
                                'id'         => $content['id'],
                                'sw'         => $SW,
index e6c5b31..6f4155d 100644 (file)
@@ -148,7 +148,7 @@ ORDER BY level ASC", __FILE__, __LINE__);
                                                                        'refs_link'  => '0',
                                                                        'surname'    => $data['surname'],
                                                                        'family'     => $data['family'],
-                                                                       'email'      => "[<a href=\"".generateMemberEmailLink($data['email'], "user_data")."\">".$data['email']."</a>]",
+                                                                       'email'      => "[<a href=\"".generateEmailLink($data['email'], 'user_data')."\">".$data['email']."</a>]",
                                                                        'status'     => translateUserStatus($data['status']),
                                                                        'registered' => generateDateTime($data['joined'], '3'),
                                                                );
@@ -200,16 +200,16 @@ ORDER BY level ASC", __FILE__, __LINE__);
                                                'refs_link'  => '0',
                                                'surname'    => $levels['surname'],
                                                'family'     => $levels['family'],
-                                               'email'      => "[<a href=\"".generateMemberEmailLink($levels['email'], "user_data")."\">".$levels['email']."</a>]",
+                                               'email'      => "[<a href=\"".generateEmailLink($levels['email'], 'user_data')."\">".$levels['email']."</a>]",
                                                'status'     => translateUserStatus($levels['status']),
                                                'registered' => generateDateTime($levels['joined'], '3'),
                                        );
 
                                        // Check if referal count is larger 0 and update link
-                                       if ($refs_cnt > 0) $content['refs_link'] = generateUserProfileLink($levels['userid'], $refs_cnt, "list_refs");
+                                       if ($refs_cnt > 0) $content['refs_link'] = generateUserProfileLink($levels['userid'], $refs_cnt, 'list_refs');
 
                                        // Load template for level one
-                                       $OUT .= LOAD_TEMPLATE("admin_list_refs_row", true, $content);
+                                       $OUT .= LOAD_TEMPLATE('admin_list_refs_row', true, $content);
 
                                        // Switch colors
                                        $SW = 3 - $SW;
@@ -224,9 +224,9 @@ ORDER BY level ASC", __FILE__, __LINE__);
 
                        // Load main template
                        if (EXT_IS_ACTIVE('refback')) {
-                               LOAD_TEMPLATE("admin_list_refs2", false, $content);
+                               LOAD_TEMPLATE('admin_list_refs2', false, $content);
                        } else {
-                               LOAD_TEMPLATE("admin_list_refs", false, $content);
+                               LOAD_TEMPLATE('admin_list_refs', false, $content);
                        }
                } elseif (EXT_IS_ACTIVE('refback')) {
                        // No levels found, very bad!
index f665e9e..861d41c 100644 (file)
@@ -90,7 +90,7 @@ WHERE `id`='%s' LIMIT 1",
                define('__SPONSOR_PHONE'      , $DATA['phone']);
                define('__SPONSOR_FAX'        , $DATA['fax']);
                define('__SPONSOR_CELL'       , $DATA['cell']);
-               define('__SPONSOR_EMAIL'      , "mailto:".$DATA['email']);
+               define('__SPONSOR_EMAIL'      , generateEmailLink($DATA['email'], 'sponsor_data'));
                define('__SPONSOR_EMAIL_VALUE', $DATA['email']);
                define('__SPONSOR_URL'        , DEREFERER($DATA['url']));
                //  Timestamps
@@ -117,18 +117,25 @@ WHERE `id`='%s' LIMIT 1",
                // Sponsor not found
                LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_SPONSOR_404'), REQUEST_GET('id')));
        }
-} elseif (REQUEST_ISSET_GET(('rid'))) {
+} elseif (REQUEST_ISSET_GET('rid')) {
        // Search for sponsor
        $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
-       array(bigintval(REQUEST_GET('rid'))), __FILE__, __LINE__);
+               array(bigintval(REQUEST_GET('rid'))), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Free memory
                SQL_FREERESULT($result);
 
                // Sponsor found so let's list all his referals
-               $result = SQL_QUERY_ESC("SELECT id, gender, surname, family, email, status, sponsor_created, last_online, points_amount, points_used, remote_addr, ref_count
-FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE refid='%s' ORDER BY `id`",
+               $result = SQL_QUERY_ESC("SELECT
+       `id`, `gender`, `surname`, `family`, `email`, `status`,
+       `sponsor_created`, `last_online`, `points_amount`, `points_used`,
+       `remote_addr`, `ref_count`
+FROM
+       `{!_MYSQL_PREFIX!}_sponsor_data`
+WHERE
+       `refid`='%s'
+ORDER BY
+       `id` ASC",
                array(bigintval(REQUEST_GET('rid'))), __FILE__, __LINE__);
 
                if (SQL_NUMROWS($result) > 0) {
@@ -145,8 +152,14 @@ WHERE refid='%s' ORDER BY `id`",
        }
 } else {
        // List all sponsors
-       $result_main = SQL_QUERY("SELECT id, gender, surname, family, email, status, sponsor_created, last_online, points_amount, points_used, remote_addr
-FROM `{!_MYSQL_PREFIX!}_sponsor_data` ORDER BY `id`", __FILE__, __LINE__);
+       $result_main = SQL_QUERY("SELECT
+       `id`, `gender`, `surname`, `family`, `email`, `status`,
+       `sponsor_created`, `last_online`, `points_amount`, `points_used`, `remote_addr`
+FROM
+       `{!_MYSQL_PREFIX!}_sponsor_data`
+ORDER BY
+       `id` ASC", __FILE__, __LINE__);
+
        if (SQL_NUMROWS($result_main) > 0) {
                // At least one sponsor found!
                $OUT = ''; $SW = 2;
@@ -159,7 +172,7 @@ FROM `{!_MYSQL_PREFIX!}_sponsor_data` ORDER BY `id`", __FILE__, __LINE__);
                                'gender'  => translateGender($content['gender']),
                                'sname'   => $content['surname'],
                                'fname'   => $content['family'],
-                               'email'   => "mailto:".$content['email'],
+                               'email'   => generateEmailLink($content['email'], 'sponsor_data'),
                                'status'  => sponsorTranslateUserStatus($content['status']),
                                'created' => generateDateTime($content['sponsor_created'], '2'),
                                'last'    => generateDateTime($content['last_online'], '2'),
@@ -168,7 +181,7 @@ FROM `{!_MYSQL_PREFIX!}_sponsor_data` ORDER BY `id`", __FILE__, __LINE__);
                        );
 
                        // Load row template
-                       $OUT .= LOAD_TEMPLATE("admin_list_sponsor_row", true, $content);
+                       $OUT .= LOAD_TEMPLATE('admin_list_sponsor_row', true, $content);
                        $SW = 3 - $SW;
                }
 
@@ -179,7 +192,7 @@ FROM `{!_MYSQL_PREFIX!}_sponsor_data` ORDER BY `id`", __FILE__, __LINE__);
                define('__SPONSOR_ROWS', $OUT);
 
                // Load final template
-               LOAD_TEMPLATE("admin_list_sponsor");
+               LOAD_TEMPLATE('admin_list_sponsor');
        } else {
                // No sponsors registered so far
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_SPONSOR_NONE_REGISTERED'));
index dbf1afe..476b218 100644 (file)
@@ -40,7 +40,7 @@
 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
        require($INC);
-}
+} // END - if
 
 // Add description as navigation point
 ADD_DESCR('admin', __FILE__);
@@ -49,13 +49,13 @@ $message = '';
 
 if (REQUEST_ISSET_POST('add')) {
        // Check input variables
-       if (!REQUEST_ISSET_POST(('pay_name'))) REQUEST_UNSET_POST('add');
-       if ((round(REQUEST_POST('pay_rate')) == 0) || (!REQUEST_ISSET_POST(('pay_rate')))) REQUEST_UNSET_POST('add');
+       if (!REQUEST_ISSET_POST('pay_name')) REQUEST_UNSET_POST('add');
+       if ((round(REQUEST_POST('pay_rate')) == 0) || (!REQUEST_ISSET_POST('pay_rate'))) REQUEST_UNSET_POST('add');
 
        REQUEST_SET_POST('pay_min_count', bigintval(REQUEST_POST('pay_min_count')));
 
-       if ((REQUEST_POST('pay_min_count') == 0) || (!REQUEST_ISSET_POST(('pay_min_count')))) REQUEST_UNSET_POST('add');
-       if (!REQUEST_ISSET_POST(('pay_currency'))) REQUEST_UNSET_POST('add');
+       if ((REQUEST_POST('pay_min_count') == 0) || (!REQUEST_ISSET_POST('pay_min_count'))) REQUEST_UNSET_POST('add');
+       if (!REQUEST_ISSET_POST('pay_currency')) REQUEST_UNSET_POST('add');
 
 } elseif ((REQUEST_ISSET_POST('edit')) || (REQUEST_ISSET_POST('del')) || (REQUEST_ISSET_POST('change')) || (REQUEST_ISSET_POST('remove'))) {
        // Check if at least one entry was selected
@@ -72,14 +72,22 @@ if (REQUEST_ISSET_POST('add')) {
                        $id = bigintval($id);
 
                        // Save entry
-                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_paytypes`
-SET pay_name='%s', pay_rate='%s', pay_min_count='%s', pay_currency='%s' WHERE `id`='%s' LIMIT 1",
+                       SQL_QUERY_ESC("UPDATE
+       `{!_MYSQL_PREFIX!}_sponsor_paytypes`
+SET
+       `pay_name`='%s',
+       `pay_rate`='%s',
+       `pay_min_count`='%s',
+       `pay_currency`='%s'
+WHERE
+       `id`='%s'
+LIMIT 1",
                        array(
-                       REQUEST_POST('name', $id),
-                       REQUEST_POST('rate', $id),
-                       bigintval(REQUEST_POST('min', $id)),
-                       REQUEST_POST('curr', $id),
-                       $id
+                               REQUEST_POST('name', $id),
+                               REQUEST_POST('rate', $id),
+                               bigintval(REQUEST_POST('min', $id)),
+                               REQUEST_POST('curr', $id),
+                               $id
                        ), __FILE__, __LINE__);
                }
 
@@ -90,7 +98,7 @@ SET pay_name='%s', pay_rate='%s', pay_min_count='%s', pay_currency='%s' WHERE `i
                foreach (REQUEST_POST('id') as $id => $sel) {
                        // Remove entry
                        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE `id`='%s' LIMIT 1",
-                       array(bigintval($id)), __FILE__, __LINE__);
+                               array(bigintval($id)), __FILE__, __LINE__);
                }
 
                // Generate message
@@ -100,22 +108,22 @@ SET pay_name='%s', pay_rate='%s', pay_min_count='%s', pay_currency='%s' WHERE `i
        if (!empty($message)) {
                // Output message
                LOAD_TEMPLATE('admin_settings_saved', false, $message);
-       }
+       } // END - if
 }
 
 if (REQUEST_ISSET_POST('add')) {
        // Check if entry with same name does exists
-       $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE pay_name='%s' LIMIT 1",
-       array(REQUEST_POST('pay_name')), __FILE__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE `pay_name`='%s' LIMIT 1",
+               array(REQUEST_POST('pay_name')), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 0) {
                // No entry found so add this line
-               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_paytypes` (pay_name, pay_rate, pay_min_count, pay_currency) VALUES ('%s','%s','%s','%s')",
-               array(
-               htmlspecialchars(REQUEST_POST('pay_name')),
-               convertCommaToDot(REQUEST_POST('pay_rate')),
-               bigintval(REQUEST_POST('pay_min_count')),
-               htmlspecialchars(REQUEST_POST('pay_currency'))
-               ), __FILE__, __LINE__);
+               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_paytypes` (`pay_name`, `pay_rate`, `pay_min_count`, `pay_currency`) VALUES ('%s','%s','%s','%s')",
+                       array(
+                               REQUEST_POST('pay_name'),
+                               convertCommaToDot(REQUEST_POST('pay_rate')),
+                               bigintval(REQUEST_POST('pay_min_count')),
+                               REQUEST_POST('pay_currency')
+                       ), __FILE__, __LINE__);
 
                // Payment type added!
                $message = sprintf(getMessage('ADMIN_SPONSOR_PAYTYPE_ADDED'), REQUEST_POST('pay_name'));
@@ -134,8 +142,8 @@ if (REQUEST_ISSET_POST('add')) {
        $OUT = ''; $SW = 2;
        foreach (REQUEST_POST('id') as $id => $sel) {
                // Load entry
-               $result = SQL_QUERY_ESC("SELECT pay_name, pay_rate, pay_min_count, pay_currency FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE `id`='%s' LIMIT 1",
-               array(bigintval($id)), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `pay_name`, `pay_rate`, `pay_min_count`, `pay_currency` FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE `id`='%s' LIMIT 1",
+                       array(bigintval($id)), __FILE__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Load data
                        list($name, $rate, $min, $curr) = SQL_FETCHROW($result);
@@ -153,14 +161,14 @@ if (REQUEST_ISSET_POST('add')) {
 
                        if (REQUEST_ISSET_POST('edit')) {
                                // Edit entry
-                               $OUT .= LOAD_TEMPLATE("admin_list_sponsor_pay_edit_row", true, $content);
+                               $OUT .= LOAD_TEMPLATE('admin_list_sponsor_pay_edit_row', true, $content);
                        } else {
                                // Delete entry
-                               $OUT .= LOAD_TEMPLATE("admin_list_sponsor_pay_del_row", true, $content);
+                               $OUT .= LOAD_TEMPLATE('admin_list_sponsor_pay_del_row', true, $content);
                        }
                } else {
                        // Entry invalid
-                       $OUT .= LOAD_TEMPLATE("admin_list_sponsor_pay_404", true, $id);
+                       $OUT .= LOAD_TEMPLATE('admin_list_sponsor_pay_404', true, $id);
                }
 
                // Switch colors
@@ -173,14 +181,14 @@ if (REQUEST_ISSET_POST('add')) {
        // Load main template depending on mode (edit/delete)
        if (REQUEST_ISSET_POST('edit')) {
                // Load main edit template
-               LOAD_TEMPLATE("admin_list_sponsor_pay_edit");
+               LOAD_TEMPLATE('admin_list_sponsor_pay_edit');
        } else {
                // Load main delete template
-               LOAD_TEMPLATE("admin_list_sponsor_pay_del");
+               LOAD_TEMPLATE('admin_list_sponsor_pay_del');
        }
 } else {
        // Load all payment types
-       $result = SQL_QUERY("SELECT id, pay_name, pay_rate, pay_min_count, pay_currency FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` ORDER BY pay_name",
+       $result = SQL_QUERY("SELECT `id`, `pay_name`, `pay_rate`, `pay_min_count`, `pay_currency` FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` ORDER BY `pay_name` ASC",
        __FILE__, __LINE__);
 
        // Do we have some paytypes setup?
@@ -201,7 +209,7 @@ if (REQUEST_ISSET_POST('add')) {
                        );
 
                        // Add row
-                       $OUT .= LOAD_TEMPLATE("admin_list_sponsor_pay_row", true, $content);
+                       $OUT .= LOAD_TEMPLATE('admin_list_sponsor_pay_row', true, $content);
 
                        // Switch colors
                        $SW = 3 - $SW;
@@ -214,17 +222,17 @@ if (REQUEST_ISSET_POST('add')) {
                define('__LIST_ROWS', $OUT);
 
                // Load list template
-               define('__LIST_CONTENT', LOAD_TEMPLATE("admin_list_sponsor_pay", true));
+               define('__LIST_CONTENT', LOAD_TEMPLATE('admin_list_sponsor_pay', true));
        } else {
                // Noting setup so far!
                define('__LIST_CONTENT', LOAD_TEMPLATE('admin_settings_saved', true, getMessage('ADMIN_SPONSOR_NO_PAYTYPES')));
        }
 
        // Add new payment types here
-       define('__ADD_CONTENT', LOAD_TEMPLATE("admin_add_sponsor_paytype", true));
+       define('__ADD_CONTENT', LOAD_TEMPLATE('admin_add_sponsor_paytype', true));
 
        // Load final template
-       LOAD_TEMPLATE("admin_sponsor_paytypes");
+       LOAD_TEMPLATE('admin_sponsor_paytypes');
 }
 
 //
index 521cc90..083b193 100644 (file)
@@ -52,27 +52,34 @@ ADD_DESCR('admin', __FILE__);
 $listed = false;
 
 // List confirmation links from normal or bonus mails
-if (REQUEST_ISSET_GET(('mid'))) {
+if (REQUEST_ISSET_GET('mid')) {
        // SQL query for mail data
-       $sql = "SELECT DISTINCT s.id, p.sender, p.subject, p.text, p.url, p.timestamp, s.max_rec  FROM `{!_MYSQL_PREFIX!}_pool` AS p
-LEFT JOIN `{!_MYSQL_PREFIX!}_user_stats` AS s
-ON p.id=s.pool_id
-WHERE p.id='".REQUEST_GET('mid')."' LIMIT 1";
+       $sql = "SELECT
+       s.id, p.sender, p.subject, p.text, p.url, p.timestamp, s.max_rec
+FROM
+       `{!_MYSQL_PREFIX!}_pool` AS p
+LEFT JOIN
+       `{!_MYSQL_PREFIX!}_user_stats` AS s
+ON
+       p.id=s.pool_id
+WHERE
+       p.id='".REQUEST_GET('mid')."'
+LIMIT 1";
 
        // Column, type and ID for member's mail
-       $col = "stats_id"; $type = "NORMAL"; $ID = '-1';
+       $col = 'stats_id'; $type = 'NORMAL'; $ID = '-1';
 
        // Load admin_list_unconfirmed template
        $listed = true; $DATA = REQUEST_GET('mid'); $LINK = 'mailid';
-} elseif ((REQUEST_ISSET_GET(('bid'))) && (EXT_IS_ACTIVE('bonus'))) {
+} elseif ((REQUEST_ISSET_GET('bid')) && (EXT_IS_ACTIVE('bonus'))) {
        // @TODO This constant might be unused?
        define('__LIST_UNCON_TITLE', getMessage('LIST_UNCONFIRMED_BONUS_LINKS'));
 
        // SQL query for mail data (both ids are required for compatiblity to above normal mail
-       $sql = "SELECT id, id, subject, text, url, timestamp, mails_sent FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`='".REQUEST_GET('bid')."' LIMIT 1";
+       $sql = "SELECT `id`, `id`, `subject`, `text`, `url`, `timestamp`, `mails_sent` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`='".REQUEST_GET('bid')."' LIMIT 1";
 
        // Column, type and ID for member's mail
-       $col = 'bonus_id'; $type = "BONUS"; $ID = REQUEST_GET('bid');
+       $col = 'bonus_id'; $type = 'BONUS'; $ID = REQUEST_GET('bid');
 
        // Load admin_list_unconfirmed template
        $listed = true; $DATA = $ID; $LINK = 'bonusid';
@@ -98,18 +105,23 @@ if ($listed === true) {
                // Load unconfirmed mail links. Hmmm, this select query is pretty cool
                // but it does only show unconfirmed mail links from existing user
                // accounts. So if you have delete one you did not see those links
-               //
-               $result = SQL_QUERY_ESC("SELECT DISTINCT l.userid, u.status, u.surname, u.family, u.gender, u.email
-FROM `{!_MYSQL_PREFIX!}_user_links` AS l
-LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS u
-ON l.userid=u.userid
-WHERE l.%s='%s' ORDER BY l.userid LIMIT %s",
-               array($col, $ID, bigintval($max)),__FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT
+       l.userid, u.status, u.surname, u.family, u.gender, u.email
+FROM
+       `{!_MYSQL_PREFIX!}_user_links` AS l
+LEFT JOIN
+       `{!_MYSQL_PREFIX!}_user_data` AS u
+ON
+       l.userid=u.userid
+WHERE
+       l.%s='%s' ORDER BY l.userid LIMIT %s",
+                       array($col, $ID, bigintval($max)),__FILE__, __LINE__);
+
+               // Total number of unconfirmed mails
                $unconfirmed = SQL_NUMROWS($result);
 
                if ($unconfirmed > 0) {
                        // At least one link left to confirm
-
                        $OUT = ''; $SW = 2;
                        while ($content = SQL_FETCHARRAY($result)) {
                                // Prepare data for the row template
@@ -120,17 +132,17 @@ WHERE l.%s='%s' ORDER BY l.userid LIMIT %s",
                                        'uid'    => $content['userid'],
                                        'link'   => $LINK,
                                        'id'     => $ID,
-                                       'email'  => "<a href=\"".generateMemberEmailLink($content['email'], "user_data")."\">".translateGender($content['gender'])." ".$content['surname']." ".$content['family']."</a>",
+                                       'email'  => "<a href=\"".generateEmailLink($content['email'], 'user_data')."\">".translateGender($content['gender'])." ".$content['surname']." ".$content['family']."</a>",
                                        'status' => translateUserStatus($content['status']),
                                );
 
                                // Load row template and switch colors
-                               $OUT .= LOAD_TEMPLATE("admin_list_unconfirmed_row", true, $content);
+                               $OUT .= LOAD_TEMPLATE('admin_list_unconfirmed_row', true, $content);
                                $SW = 3 - $SW;
                        }
 
                        // Render it in our new listing
-                       $OUT = LOAD_TEMPLATE("admin_list_unconfirmed_list", true, $OUT);
+                       $OUT = LOAD_TEMPLATE('admin_list_unconfirmed_list', true, $OUT);
 
                        // Free memory
                        SQL_FREERESULT($result);
@@ -152,13 +164,14 @@ WHERE l.%s='%s' ORDER BY l.userid LIMIT %s",
                );
 
                // Load final template
-               LOAD_TEMPLATE("admin_list_unconfirmed", false, $content);
+               LOAD_TEMPLATE('admin_list_unconfirmed', false, $content);
        } elseif (REQUEST_GET('mid') > 0) {
                // Data in pool or in user_stats not found, so let's find out where data is missing
                $result1 = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
-               array(bigintval($ID)), __FILE__, __LINE__);
-               $result2 = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s LIMIT 1",
-               array(bigintval($ID)), __FILE__, __LINE__);
+                       array(bigintval($ID)), __FILE__, __LINE__);
+               $result2 = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `pool_id`=%s LIMIT 1",
+                       array(bigintval($ID)), __FILE__, __LINE__);
+
                if (SQL_NUMROWS($result1) == 1) {
                        // pool table
                        LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_UNCONFIRMED_POOL_MISSING'), $ID));
@@ -173,7 +186,7 @@ WHERE l.%s='%s' ORDER BY l.userid LIMIT %s",
                // Free memory
                SQL_FREERESULT($result1);
                SQL_FREERESULT($result2);
-       } elseif (REQUEST_ISSET_GET(('bid'))) {
+       } elseif (REQUEST_ISSET_GET('bid')) {
                // Data in bonus table not found
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_UNCONFIRMED_INVALID_LINK'));
        }
index 52d2998..57630ce 100644 (file)
@@ -141,7 +141,7 @@ LIMIT 1",
                define('_LINKS', $LINKS);
                define('_ADMIN_LINKS', generateMemberAdminActionLinks($uid, $DATA['status']));
                $DATA['gender']            = translateGender($DATA['gender']);
-               $DATA['email_link']        = generateMemberEmailLink($DATA['email'], "user_data");
+               $DATA['email_link']        = generateEmailLink($DATA['email'], 'user_data');
                $DATA['status']            = translateUserStatus($DATA['status']);
                $DATA['last_online']       = generateDateTime($DATA['last_online'], '0');
                $DATA['used_points']       = translateComma($DATA['used_points']);
@@ -149,8 +149,8 @@ LIMIT 1",
                $DATA['joined']            = generateDateTime($DATA['joined'], '0');
                $DATA['last_update']       = generateDateTime($DATA['last_update'], '0');
                $DATA['last_profile_sent'] = generateDateTime($DATA['last_profile_sent'], '0');
-               $DATA['total']             = translateComma(GET_TOTAL_DATA($uid, "user_points", "points"));
-               $DATA['locked']            = translateComma(GET_TOTAL_DATA($uid, "user_points", "locked_points"));
+               $DATA['total']             = translateComma(GET_TOTAL_DATA($uid, 'user_points', 'points'));
+               $DATA['locked']            = translateComma(GET_TOTAL_DATA($uid, 'user_points', 'locked_points'));
                $DATA['lock_timestamp']    = generateDateTime($DATA['lock_timestamp'], '2');
 
                // Is the lock reason not set?
@@ -298,7 +298,7 @@ LIMIT 1",
                        if ($content['refid'] > 0) $content['refid'] = generateUserProfileLink($content['refid']);
 
                        // Get number of unconfirmed mails
-                       $LINKS = GET_TOTAL_DATA($content['userid'], "user_links", 'id', 'userid', true);
+                       $LINKS = GET_TOTAL_DATA($content['userid'], 'user_links', 'id', 'userid', true);
                        if ($LINKS > 0) $LINKS = $base."&amp;what=list_links&amp;uid=".$content['userid']."\">".translateComma($LINKS)."</a>]";
 
                        // Set link to sent mails if present
@@ -308,7 +308,7 @@ LIMIT 1",
                        if (empty($content['nickname']) || $content['nickname'] == $content['userid']) $content['nickname'] = '---';
 
                        // Calculate total points
-                       $pointsTotal = GET_TOTAL_DATA($content['userid'], "user_points", "points")  - GET_TOTAL_DATA($content['userid'], "user_data", "used_points");
+                       $pointsTotal = GET_TOTAL_DATA($content['userid'], 'user_points', 'points')  - GET_TOTAL_DATA($content['userid'], 'user_data', 'used_points');
 
                        // Clickrate
                        $clickRate = 0;
@@ -320,13 +320,13 @@ LIMIT 1",
                        $content['sw']     = $SW;
                        $content['uid']    = generateUserProfileLink($content['userid']);
                        $content['gender'] = translateGender($content['gender']);
-                       $content['email']  = "[<a href=\"".generateMemberEmailLink($content['email'], "user_data")."\">".$content['email']."</a>]";
+                       $content['email']  = "[<a href=\"".generateEmailLink($content['email'], 'user_data')."\">".$content['email']."</a>]";
                        $content['addr']   = $content['REMOTE_ADDR'];
                        $content['links']  = $LINKS;
                        $content['alinks'] = generateMemberAdminActionLinks($content['userid'], $content['status']);
                        $content['points'] = translateComma($pointsTotal);
                        $content['rate']   = translateComma($clickRate);
-                       $content['locked'] = translateComma(GET_TOTAL_DATA($content['userid'], "user_points", "locked_points"));
+                       $content['locked'] = translateComma(GET_TOTAL_DATA($content['userid'], 'user_points', 'locked_points'));
                        $content['lock_timestamp'] = generateDateTime($content['lock_timestamp'], '2');
                        $content['status'] = translateUserStatus($content['status']);
 
index 26589b9..c5b3a4d 100644 (file)
@@ -55,13 +55,13 @@ if (isFormSent()) {
        // Prepare mail for delivery
        YOOMEDIA_PREPARE_MAIL_DELIVERY(REQUEST_POST_ARRAY());
        return;
-} elseif (REQUEST_ISSET_POST(('sent'))) {
+} elseif (REQUEST_ISSET_POST('sent')) {
        // Sent mail
        YOOMEDIA_SEND_BONUS_MAIL(REQUEST_POST_ARRAY(), 'normal');
 } elseif (REQUEST_ISSET_POST('remove')) {
        // Add mail to exclude list
        YOOMEDIA_EXCLUDE_MAIL(REQUEST_POST_ARRAY(), 'normal');
-} elseif (REQUEST_ISSET_POST(('unlist'))) {
+} elseif (REQUEST_ISSET_POST('unlist')) {
        // Remove mail from exclude list
        YOOMEDIA_UNLIST_MAIL(REQUEST_POST_ARRAY(), 'normal');
 }
index 384fd18..281fd88 100644 (file)
@@ -101,7 +101,7 @@ if (REQUEST_ISSET_GET('id')) {
                                }
 
                                // Create email link
-                               define('__EMAIL_LINK', '<a href="mailto:' . $email . '">{!__GENDER!} {!__SURNAME!} {!__FAMILY!}</a>');
+                               define('__EMAIL_LINK', '<a href="' . generateEmailLink($email, 'sponsor_data') . '">{!__GENDER!} {!__SURNAME!} {!__FAMILY!}</a>');
 
                                // Display form
                                LOAD_TEMPLATE('admin_lock_sponsor');
index 7a05b88..435e1e1 100644 (file)
@@ -119,7 +119,7 @@ if (REQUEST_ISSET_GET('uid')) {
                        $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",
-                       array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+                               array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
 
                        // Entry found?
                        if (SQL_NUMROWS($result) == 1) {
@@ -131,7 +131,7 @@ if (REQUEST_ISSET_GET('uid')) {
 
                                // Transfer data to constants for the template
                                // @TODO Rewrite these all constants
-                               define('__EMAIL', generateMemberEmailLink($email, 'user_data'));
+                               define('__EMAIL', generateEmailLink($email, 'user_data'));
                                define('__SNAME', $sname);
                                define('__FNAME', $fname);
                                define('__UID'  , bigintval(REQUEST_GET('uid')));
index da8684a..4be4117 100644 (file)
@@ -53,11 +53,13 @@ if ((!REQUEST_ISSET_POST('title')) && (isFormSent())) {
 
 if (!isFormSent()) {
        // Create arrays
-       $menus = array(); $titles = array(); $below = array();
+       $menus  = array();
+       $titles = array();
+       $below  = array();
 
        // Get all available main menus
-       $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort`",
-       __FILE__, __LINE__);
+       $result = SQL_QUERY("SELECT `action`, `title`, `sort` FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC",
+               __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // Read menu structure
                // @TODO Cant this be rewritten?
@@ -77,7 +79,10 @@ if (!isFormSent()) {
 
                // Remove double eintries
                // @TODO This can be somehow rewritten to a function
-               $prev = ''; $dmy = $menus; $dmy2 = $titles; $dmy3 = $below;
+               $prev = '';
+               $dmy  = $menus;
+               $dmy2 = $titles;
+               $dmy3 = $below;
                foreach ($menus as $key => $value) {
                        if ($value == $prev) {
                                // Remove entries
@@ -143,47 +148,47 @@ if (!isFormSent()) {
        foreach ($below as $key => $m) {
                if (is_array($m)) {
                        foreach ($m as $key2 => $m2) {
-                               $OUT .= "      <option value=\"".$m2."\">".$titles[$key][$key2];
+                               $OUT .= "      <option value=\"" . $m2 . "\">" . $titles[$key][$key2];
                                foreach ($menus as $k => $v) {
                                        if (($v == $key) && (!is_array($v))) {
                                                $OUT .= " (" . $titles[$k] . ')';
-                                       }
-                               }
+                                       } // END - if
+                               } // END - foreach
                                $OUT .= "</option>\n";
-                       }
+                       } // END - foreach
                } else {
-                       $OUT .= "      <option value=\"".$m."\">".$titles[$key]."</option>\n";
+                       $OUT .= "      <option value=\"" . $m . "\">" . $titles[$key] . "</option>\n";
                }
        }
        $OUT .= "</select>";
 
        define('__BELOW_SELECTION' , $OUT);
-       define('__WHAT_SELECTION'  , ADMIN_MAKE_MENU_SELECTION('member', 'what', "name"));
-       define('__ACTION_SELECTION', ADMIN_MAKE_MENU_SELECTION('member', 'action', "menu"));
+       define('__WHAT_SELECTION'  , ADMIN_MAKE_MENU_SELECTION('member', 'what'  , 'name'));
+       define('__ACTION_SELECTION', ADMIN_MAKE_MENU_SELECTION('member', 'action', 'menu'));
 
        // Display form
-       LOAD_TEMPLATE("admin_member_add");
+       LOAD_TEMPLATE('admin_member_add');
 } elseif (!IS_DEMO()) {
        // Insert new menu entry
-       if (REQUEST_ISSET_POST(('menu'))) {
+       if (REQUEST_ISSET_POST('menu')) {
                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('%s','%s','%s','%s','%s','%s')",
-               array(
-               REQUEST_POST('menu'),
-               REQUEST_POST('name'),
-               REQUEST_POST('title'),
-               REQUEST_POST('visible'),
-               REQUEST_POST('active'),
-               bigintval(REQUEST_POST('sort')),
-               ), __FILE__, __LINE__);
+                       array(
+                               REQUEST_POST('menu'),
+                               REQUEST_POST('name'),
+                               REQUEST_POST('title'),
+                               REQUEST_POST('visible'),
+                               REQUEST_POST('active'),
+                               bigintval(REQUEST_POST('sort')),
+                       ), __FILE__, __LINE__);
        } else {
                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`title`,`visible`,`locked`,`sort`) VALUES ('%s','%s','%s','%s','%s')",
-               array(
-               REQUEST_POST('name'),
-               REQUEST_POST('title'),
-               REQUEST_POST('visible'),
-               REQUEST_POST('active'),
-               bigintval(REQUEST_POST('sort')),
-               ), __FILE__, __LINE__);
+                       array(
+                               REQUEST_POST('name'),
+                               REQUEST_POST('title'),
+                               REQUEST_POST('visible'),
+                               REQUEST_POST('active'),
+                               bigintval(REQUEST_POST('sort')),
+                       ), __FILE__, __LINE__);
        }
        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
 } else {
index e629c93..bca3aa1 100644 (file)
@@ -40,7 +40,7 @@
 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
        require($INC);
-}
+} // END - if
 
 // Add description as navigation point
 ADD_DESCR('admin', __FILE__);
@@ -51,7 +51,7 @@ $AND = "(`what` = '' OR `what` IS NULL)"; $SUB = '';
 if (REQUEST_ISSET_GET('sub')) {
        $AND = sprintf("`action`='%s' AND `what` IS NOT NULL", REQUEST_GET('sub'));
        $SUB = REQUEST_GET('sub');
-}
+} // END - if
 
 // Get count of (maybe) selected menu points
 $chk = 0;
@@ -66,30 +66,33 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) {
        foreach (REQUEST_POST('sel') as $sel => $confirm) {
                if ($confirm == 1) {
                        $cnt++;
-                       $result = SQL_QUERY_ESC("SELECT title, action, what FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE ".$AND." AND id=%s LIMIT 1",
-                       array(bigintval($sel)), __FILE__, __LINE__);
+                       $result = SQL_QUERY_ESC("SELECT `title`, `action`, `what` FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
+                               array(bigintval($sel)), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result) == 1) {
                                // Entry found so we load the stuff...
                                list($menu, $act, $wht, $descr) = SQL_FETCHROW($result);
-                               SQL_FREERESULT($result);
                                $content = array(
                                        'cnt'    => $cnt,
                                        'sel'    => $sel,
                                        'menu'   => $menu,
                                        'sw'     => $SW,
-                                       'act'    => ADMIN_MAKE_MENU_SELECTION('member', "act", "sel_act[".$sel."]", $act),
+                                       'act'    => ADMIN_MAKE_MENU_SELECTION('member', 'act' , 'sel_act[' . $sel . ']', $act),
                                        'what'   => ADMIN_MAKE_MENU_SELECTION('member', 'what', 'sel_what[' . $sel . ']', $wht),
                                );
+
                                // Load template
-                               $OUT .= LOAD_TEMPLATE("admin_mmenu_edit_row", true, $content);
+                               $OUT .= LOAD_TEMPLATE('admin_mmenu_edit_row', true, $content);
                        } else {
                                // Entry not found?
                                $content = array(
                                        'sw'  => $SW,
                                        'sel' => $sel
                                );
-                               $OUT .= LOAD_TEMPLATE("admin_menu_404_row", true, $content);
+
+                               // Load template
+                               $OUT .= LOAD_TEMPLATE('admin_menu_404_row', true, $content);
                        }
+                       SQL_FREERESULT($result);
                        $SW = 3 - $SW;
                }
        }
@@ -97,7 +100,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) {
        define('__CNT_VALUE', $cnt);
 
        // Load template
-       LOAD_TEMPLATE("admin_mmenu_edit");
+       LOAD_TEMPLATE('admin_mmenu_edit');
 } elseif ((REQUEST_ISSET_POST('del')) && ($chk > 0) && (!IS_DEMO())) {
        // Del menu entries with or without confirmation
        define('__SUB_VALUE', $SUB);
@@ -106,34 +109,38 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) {
        foreach (REQUEST_POST('sel') as $sel => $confirm) {
                if ($confirm == 1) {
                        $cnt++;
-                       $result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE ".$AND." AND id=%s LIMIT 1",
-                       array(bigintval($sel)), __FILE__, __LINE__);
+                       $result = SQL_QUERY_ESC("SELECT `title` FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
+                               array(bigintval($sel)), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result) == 1) {
                                // Entry found so we load the stuff...
                                list($title) = SQL_FETCHROW($result);
-                               SQL_FREERESULT($result);
                                $content = array(
                                        'cnt'   => $cnt,
                                        'sel'   => $sel,
                                        'title' => $title
                                );
-                               $OUT .= LOAD_TEMPLATE("admin_mmenu_delete_row", true, $content);
+
+                               // Load template
+                               $OUT .= LOAD_TEMPLATE('admin_mmenu_delete_row', true, $content);
                        } else {
                                // Entry not found?
                                $content = array(
                                        'sw'  => $SW,
                                        'sel' => $sel
                                );
-                               $OUT .= LOAD_TEMPLATE("admin_menu_404_row", true, $content);
+
+                               // Load template
+                               $OUT .= LOAD_TEMPLATE('admin_menu_404_row', true, $content);
                        }
-               }
-       }
+                       SQL_FREERESULT($result);
+               } // END - if
+       } // END - foreach
        define('__MENU_ROWS', $OUT);
        define('__CNT_VALUE', $cnt);
 
        // Load template
-       LOAD_TEMPLATE("admin_mmenu_delete");
-} elseif ((REQUEST_ISSET_POST(('status'))) && ($chk > 0) && (!IS_DEMO())) {
+       LOAD_TEMPLATE('admin_mmenu_delete');
+} elseif ((REQUEST_ISSET_POST('status')) && ($chk > 0) && (!IS_DEMO())) {
        // Change status (visible / locked)
        define('__SUB_VALUE', $SUB);
        define('__CHK_VALUE', $chk);
@@ -142,7 +149,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) {
                if ($confirm == 1) {
                        $cnt++;
                        $result = SQL_QUERY_ESC("SELECT title, visible, locked FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE ".$AND." AND id=%s LIMIT 1",
-                       array(bigintval($sel)), __FILE__, __LINE__);
+                               array(bigintval($sel)), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result) == 1) {
                                // Entry found so we load the stuff...
                                list($menu, $vis, $locked) = SQL_FETCHROW($result);
@@ -158,22 +165,23 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) {
 
                                // Load template
                                $OUT .= LOAD_TEMPLATE('admin_menu_status_row', true, $content);
-                       }
-                       else
-                       {
+                       } else {
                                // Entry not found?
                                $content = array(
                                        'sw'  => $SW,
                                        'sel' => $sel
                                );
+
+                               // Load template
                                $OUT .= LOAD_TEMPLATE('admin_menu_404_row', true, $content);
                        }
                        $SW = 3 - $SW;
-               }
-       }
+               } // END - if
+       } // END - foreach
        define('__MENU_ROWS', $OUT);
        define('__CNT_VALUE', $cnt);
-       //
+
+       // Load template
        LOAD_TEMPLATE('admin_mmenu_status');
 } elseif ((isFormSent()) && (!IS_DEMO())) {
        // An act is done...
@@ -181,72 +189,74 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) {
                $AND = "(`what` = '' OR `what` IS NULL)";
                $sel = bigintval($sel);
                if (!empty($SUB)) $AND = "`action`='".$SUB."'";
-               switch (REQUEST_POST('ok'))
-               {
+               switch (REQUEST_POST('ok')) {
                        case 'edit': // Edit menu
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `title`='%s', `action`='%s', `what`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
-                               array($menu, REQUEST_POST('sel_act', $sel), REQUEST_POST('sel_what', $sel), $sel), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `title`='%s', `action`='%s', `what`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
+                                       array($menu, REQUEST_POST('sel_act', $sel), REQUEST_POST('sel_what', $sel), $sel), __FILE__, __LINE__);
                                break;
 
                        case 'del': // Delete menu
-                               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE ".$AND." AND id=%s LIMIT 1",
-                               array($sel), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
+                                       array($sel), __FILE__, __LINE__);
                                break;
 
                        case 'status': // Change status of menus
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='%s', `locked`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
-                               array(REQUEST_POST('visible', $sel), REQUEST_POST('locked', $sel), $sel), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='%s', `locked`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
+                                       array(REQUEST_POST('visible', $sel), REQUEST_POST('locked', $sel), $sel), __FILE__, __LINE__);
                                break;
-               }
+               } // END - switch
                break;
-       }
+       } // END - foreach
 
        // Load template
        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
 } else {
-       if ((REQUEST_ISSET_GET(('act'))) && (REQUEST_ISSET_GET(('tid'))) && (REQUEST_ISSET_GET(('fid')))) {
+       if ((REQUEST_ISSET_GET('act')) && (REQUEST_ISSET_GET('tid')) && (REQUEST_ISSET_GET('fid'))) {
                // Init
                $tid = ''; $fid = '';
 
                // Get IDs
-               if (REQUEST_ISSET_GET(('w'))) {
+               if (REQUEST_ISSET_GET('w')) {
                        // Sub menus selected
                        $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
-                       array(bigintval(REQUEST_GET('act')), bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
+                               array(bigintval(REQUEST_GET('act')), bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
                        list($tid) = SQL_FETCHROW($result);
                        SQL_FREERESULT($result);
                        $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
-                       array(bigintval(REQUEST_GET('act')), bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
+                               array(bigintval(REQUEST_GET('act')), bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
                        list($fid) = SQL_FETCHROW($result);
                        SQL_FREERESULT($result);
                } else {
                        // Main menu selected
                        $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
-                       array(bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
+                               array(bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
                        list($tid) = SQL_FETCHROW($result);
                        $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
-                       array(bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
+                               array(bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
                        list($fid) = SQL_FETCHROW($result);
                }
 
                if ((!empty($tid)) && (!empty($fid))) {
                        // Sort menu
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `sort`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
-                       array(bigintval(REQUEST_GET('tid')), bigintval($fid)), __FILE__, __LINE__);
+                               array(bigintval(REQUEST_GET('tid')), bigintval($fid)), __FILE__, __LINE__);
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `sort`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
-                       array(bigintval(REQUEST_GET('fid')), bigintval($tid)), __FILE__, __LINE__);
+                               array(bigintval(REQUEST_GET('fid')), bigintval($tid)), __FILE__, __LINE__);
                } // END - -fi
        }
 
        if (!empty($SUB)) {
                // Edit sub menus
-               $result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE ".$AND." AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC", __FILE__, __LINE__);
+               $result = SQL_QUERY("SELECT `id`, `action`, `what`, `title`, `sort` FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE ".$AND." AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC", __FILE__, __LINE__);
        } else {
                // Edit main menus
-               $result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
+               $result = SQL_QUERY("SELECT `id`, `action`, `what`, `title`, `sort` FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
        }
 
+       // Get total menu entries
        $max = SQL_NUMROWS($result);
+
+       // Some are there?
        if ($max > 0) {
                // Set sub value
                // @TODO Rewrite this constant
index 94f4f9d..d386f59 100644 (file)
@@ -77,37 +77,37 @@ if (REQUEST_GET('uid') == "all") {
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_ALL_POINTS_SUBTRACTED'));
        } else {
                // Display form add points
-               LOAD_TEMPLATE("admin_sub_points_all");
+               LOAD_TEMPLATE('admin_sub_points_all');
        }
 } elseif (REQUEST_ISSET_GET('uid')) {
        // User ID found in URL so we use this give him some credits
-       $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
-       array(bigintval(REQUEST_GET('uid'))),__FILE__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `surname`, `family`, `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
+               array(bigintval(REQUEST_GET('uid'))),__FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Selected user does exist
                $content = SQL_FETCHARRAY($result);
 
                if ((isFormSent()) && (REQUEST_ISSET_POST(('points')))) {
                        // Ok, add to used points and send an email to him...
-                       SUB_POINTS("admin_single", bigintval(REQUEST_GET('uid')), REQUEST_POST('points'));
+                       SUB_POINTS('admin_single', bigintval(REQUEST_GET('uid')), REQUEST_POST('points'));
 
                        // Add more content
                        $content['text']   = SQL_ESCAPE(REQUEST_POST('reason'));
                        $content['points'] = bigintval(REQUEST_POST('points'));
 
                        // Load email and send it away
-                       $msg = LOAD_EMAIL_TEMPLATE("sub-points", $content, bigintval(REQUEST_GET('uid')));
+                       $msg = LOAD_EMAIL_TEMPLATE('sub-points', $content, bigintval(REQUEST_GET('uid')));
                        sendEmail($content['email'], getMessage('ADMIN_SUB_SUBJ'), $msg);
 
                        // Output message
                        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_POINTS_SUBTRACTED'));
                } else {
                        // @TODO Rewrite these constants
-                       define('__USER_VALUE', "<a href=\"".generateMemberEmailLink($content['email'], "user_data")."\">".$content['surname']." ".$content['family']."</a>");
+                       define('__USER_VALUE', "<a href=\"".generateEmailLink($content['email'], 'user_data')."\">".$content['surname']." ".$content['family']."</a>");
                        define('__UID', bigintval(REQUEST_GET('uid')));
 
                        // Load form
-                       LOAD_TEMPLATE("admin_sub_points");
+                       LOAD_TEMPLATE('admin_sub_points');
                }
        } else {
                // User not found!
index 4571d74..e558872 100644 (file)
@@ -167,12 +167,12 @@ WHERE `id`='%s' LIMIT 1",
        }
 
        // Add seperator
-       OUTPUT_HTML("<br />");
+       OUTPUT_HTML('<br />');
 }
 
 // Begin listing of all pending sponsor accounts
 $result = SQL_QUERY("SELECT
-       id, gender, surname, family, email, remote_addr, sponsor_created
+       `id`, `gender`, `surname`, `family`, `email`, `remote_addr`, `sponsor_created`
 FROM
        `{!_MYSQL_PREFIX!}_sponsor_data`
 WHERE
@@ -192,19 +192,19 @@ if (SQL_NUMROWS($result) > 0) {
                        'gender'   => translateGender($content['gender']),
                        'surname' => $content['surname'],
                        'family'  => $content['family'],
-                       'email'   => "mailto:".$content['email'],
+                       'email'   => generateEmailLink($content['email'], 'sponsor_data'),
                        'remote'  => $content['remote_addr'],
                        'created' => generateDateTime($content['sponsor_created'], '2'),
                );
 
                // Load row template and switch colors
-               $OUT .= LOAD_TEMPLATE("admin_unlock_sponsor_row", true, $content);
+               $OUT .= LOAD_TEMPLATE('admin_unlock_sponsor_row', true, $content);
                $SW = 3 - $SW;
        }
        define('__SPONSOR_ROWS', $OUT);
 
        // Load template
-       LOAD_TEMPLATE("admin_unlock_sponsor");
+       LOAD_TEMPLATE('admin_unlock_sponsor');
 } else {
        // No pending accounts found
        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_SPONSOR_NONE_PENDING'));
index a90fc64..7d85855 100644 (file)
@@ -48,19 +48,19 @@ ADD_DESCR('admin', __FILE__);
 // Base directory (should be moved to database)
 $usage = getConfig('usage_base') . '/';
 
-if (REQUEST_ISSET_GET(('image'))) {
+if (REQUEST_ISSET_GET('image')) {
        if (REQUEST_GET('type') == 'usage') {
                $FQFN = sprintf("%s%s/usage.png",
-               constant('PATH'),
-               getConfig('usage_base')
+                       constant('PATH'),
+                       getConfig('usage_base')
                );
        } else {
                if (strpos(REQUEST_GET('image'), "\\") > 0) REQUEST_SET_GET('image', substr(REQUEST_GET('image'), 0, strpos(REQUEST_GET('image'), "\\")));
                $FQFN = sprintf("%s%s/%s_usage_%s.png",
-               constant('PATH'),
-               getConfig('usage_base'),
-               REQUEST_GET(('type')),
-               REQUEST_GET(('image'))
+                       constant('PATH'),
+                       getConfig('usage_base'),
+                       REQUEST_GET('type'),
+                       REQUEST_GET('image')
                );
        }
 
@@ -71,16 +71,16 @@ if (REQUEST_ISSET_GET(('image'))) {
                imagedestroy($image);
        }
        shutdown();
-} elseif (!REQUEST_ISSET_GET(('usage'))) {
+} elseif (!REQUEST_ISSET_GET('usage')) {
        $FQFN = sprintf("%s%s/index.html",
-       constant('PATH'),
-       getConfig('usage_base')
+               constant('PATH'),
+               getConfig('usage_base')
        );
 } else {
        $FQFN = sprintf("%s%s/usage_%s.html",
-       constant('PATH'),
-       getConfig('usage_base'),
-       REQUEST_GET(('usage'))
+               constant('PATH'),
+               getConfig('usage_base'),
+               REQUEST_GET('usage')
        );
 }
 
@@ -93,14 +93,14 @@ if ((!empty($FQFN)) && (isFileReadable($FQFN))) {
        // Until here...
 
        // Replace URLs
-       $content = str_replace("usage.png", "{!URL!}/modules.php?module=admin&amp;what=".getWhat()."&type=usage&image=usage", $content);
-       $content = str_replace("daily_usage_", "{!URL!}/modules.php?module=admin&amp;what=".getWhat()."&type=daily&image=", $content);
-       $content = str_replace("hourly_usage_", "{!URL!}/modules.php?module=admin&amp;what=".getWhat()."&type=hourly&image=", $content);
-       $content = str_replace("ctry_usage_", "{!URL!}/modules.php?module=admin&amp;what=".getWhat()."&type=ctry&image=", $content);
-       $content = str_replace("usage_", "{!URL!}/modules.php?module=admin&amp;what=".getWhat()."&usage=", str_replace(".html", '', $content));
+       $content = str_replace('usage.png'    , '{!URL!}/modules.php?module=admin&amp;what='.getWhat().'&type=usage&image=usage', $content);
+       $content = str_replace('daily_usage_' , '{!URL!}/modules.php?module=admin&amp;what='.getWhat().'&type=daily&image='     , $content);
+       $content = str_replace('hourly_usage_', '{!URL!}/modules.php?module=admin&amp;what='.getWhat().'&type=hourly&image='    , $content);
+       $content = str_replace('ctry_usage_'  , '{!URL!}/modules.php?module=admin&amp;what='.getWhat().'&type=ctry&image='      , $content);
+       $content = str_replace('usage_'       , '{!URL!}/modules.php?module=admin&amp;what='.getWhat().'&usage='                , str_replace('.html', '', $content));
 
        // Disabled due to too much trouble
-       //$content = str_replace("HREF=\'http://', "href=\"{!URL!}/modules.php?module=loader&amp;url=http://", $content);
+       //$content = str_replace("HREF=\"http://", "href=\"{!URL!}/modules.php?module=loader&amp;url=http://", $content);
        $test = strtolower($content);
 
        // Do we need to strip out above and including <body> plus trailing </html> tag?
@@ -111,9 +111,7 @@ if ((!empty($FQFN)) && (isFileReadable($FQFN))) {
        } // END - if
 
        // Output code
-       OUTPUT_HTML("<div align=\"left\">
-  ".$content."
-</div>");
+       OUTPUT_HTML($content);
 } else {
        // Nothing to load, then we have no directory 'usage'
        LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_USAGE_DIRECTORY_404'), getConfig('usage_base')));
index bbe2c5a..4006066 100644 (file)
 if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
        require($INC);
-}
+} // END - if
 
 $mode = 'guest';
 
-if (REQUEST_ISSET_GET(('order'))) {
+if (REQUEST_ISSET_GET('order')) {
        // Order number placed, is he also logged in?
        if (IS_MEMBER()) {
                // Ok, test passed... :)
-               $result = SQL_QUERY_ESC("SELECT subject, url FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s AND sender=%s AND data_type='TEMP' LIMIT 1",
-               array(bigintval(REQUEST_GET('order')), getUserId()), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `subject`, `url` FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s AND `sender`=%s AND `data_type`='TEMP' LIMIT 1",
+                       array(bigintval(REQUEST_GET('order')), getUserId()), __FILE__, __LINE__);
 
                // Finally is the entry valid?
                if (SQL_NUMROWS($result) == 1) {
@@ -72,7 +72,7 @@ if (REQUEST_ISSET_GET(('order'))) {
                // He is no longer logged in
                redirectToUrl('modules.php?module=index&amp;what=login');
        }
-}
+} // END - if
 
 if ((REQUEST_ISSET_POST('url')) || (REQUEST_ISSET_GET('url')) || (REQUEST_ISSET_GET('frame'))) {
        // Default URL is ours
index c59a6a5..d790166 100644 (file)
@@ -77,12 +77,12 @@ if (REQUEST_ISSET_GET('hash')) {
                                        // Ok, write the ref-points to this user and his parent-ref
                                        unset($GLOBALS['ref_level']);
 
-                                       // Shall I "pay" the referal points imidiately?
+                                       // Shall I 'pay' the referal points imidiately?
                                        if (getConfig('ref_payout') == '0') {
-                                               // Yes, "pay" it now
+                                               // Yes, 'pay' it now
                                                $locked = false;
                                        } else {
-                                               // No, "pay" it later
+                                               // No, 'pay' it later
                                                $locked = true;
                                        }
 
index 6c10396..5608511 100644 (file)
@@ -62,7 +62,7 @@ $add = '';
 if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
        // Maybe, then continue with it
        $uid = getUserId();
-} elseif ((REQUEST_ISSET_POST('id')) && (REQUEST_ISSET_POST(('password'))) && (isFormSent())) {
+} elseif ((REQUEST_ISSET_POST('id')) && (REQUEST_ISSET_POST('password')) && (isFormSent())) {
        // Set userid and crypt password when login data was submitted
        if ((EXT_IS_ACTIVE('nickname')) && (NICKNAME_IS_ACTIVE(REQUEST_POST('id')))) {
                // Nickname entered
@@ -71,7 +71,7 @@ if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
                // Direct userid entered
                $uid  = bigintval(REQUEST_POST('id'));
        }
-} elseif (REQUEST_ISSET_POST(('new_pass'))) {
+} elseif (REQUEST_ISSET_POST('new_pass')) {
        // New password requested
        $uid = 0;
        if (REQUEST_ISSET_POST('id')) $uid = REQUEST_POST('id');
@@ -81,7 +81,7 @@ if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
 }
 
 // Set unset variables
-if (!REQUEST_ISSET_POST(('new_pass'))) REQUEST_SET_POST('new_pass', '');
+if (!REQUEST_ISSET_POST('new_pass')) REQUEST_SET_POST('new_pass', '');
 if (!REQUEST_ISSET_GET('login'))     REQUEST_SET_GET('login'    , '');
 
 if (IS_MEMBER()) {
@@ -93,7 +93,7 @@ if (IS_MEMBER()) {
 } elseif (isFormSent()) {
        // Try the login (see inc/libs/user_functions.php)
        $URL = USER_DO_LOGIN(REQUEST_POST('id'), REQUEST_POST('password'));
-} elseif ((REQUEST_ISSET_POST(('new_pass'))) && (isset($uid))) {
+} elseif ((REQUEST_ISSET_POST('new_pass')) && (isset($uid))) {
        // Try the userid/email lookup (see inc/libs/user_functions.php)
        $errorCode = USER_DO_NEW_PASSWORD(REQUEST_POST('email'), $uid);
 }
index 44790f1..51470e2 100644 (file)
@@ -56,30 +56,33 @@ $shortPass = false;
 $cats       = 0;
 $ipTimedOut = false;
 
+/**
+ * @TODO Commented out, do we need this ugly code?
 if (!isFormSent()) REQUEST_UNSET_POST('ok');
 
-if (!REQUEST_ISSET_POST(('agree')))        REQUEST_SET_POST('agree'       , '');
-if (!REQUEST_ISSET_POST(('addy')))         REQUEST_SET_POST('addy'        , '');
-if (!REQUEST_ISSET_POST(('surname')))      REQUEST_SET_POST('surname'     , '');
-if (!REQUEST_ISSET_POST(('family')))       REQUEST_SET_POST('family'      , '');
+if (!REQUEST_ISSET_POST('agree'))        REQUEST_SET_POST('agree'       , '');
+if (!REQUEST_ISSET_POST('addy'))         REQUEST_SET_POST('addy'        , '');
+if (!REQUEST_ISSET_POST('surname'))      REQUEST_SET_POST('surname'     , '');
+if (!REQUEST_ISSET_POST('family'))       REQUEST_SET_POST('family'      , '');
 if (!REQUEST_ISSET_POST('pass1'))        REQUEST_SET_POST('pass1'       , '');
 if (!REQUEST_ISSET_POST('pass2'))        REQUEST_SET_POST('pass2'       , '');
-if (!REQUEST_ISSET_POST(('day')))          REQUEST_SET_POST('day'         , '');
-if (!REQUEST_ISSET_POST(('month')))        REQUEST_SET_POST('month'       , '');
-if (!REQUEST_ISSET_POST(('year')))         REQUEST_SET_POST('year'        , '');
-if (!REQUEST_ISSET_POST(('max_mails')))    REQUEST_SET_POST('max_mails'   , '');
-if (!REQUEST_ISSET_POST(('street_nr')))    REQUEST_SET_POST('street_nr'   , '');
+if (!REQUEST_ISSET_POST('day'))          REQUEST_SET_POST('day'         , '');
+if (!REQUEST_ISSET_POST('month'))        REQUEST_SET_POST('month'       , '');
+if (!REQUEST_ISSET_POST('year'))         REQUEST_SET_POST('year'        , '');
+if (!REQUEST_ISSET_POST('max_mails'))    REQUEST_SET_POST('max_mails'   , '');
+if (!REQUEST_ISSET_POST('street_nr'))    REQUEST_SET_POST('street_nr'   , '');
 if (!REQUEST_ISSET_POST('zip'))          REQUEST_SET_POST('zip'         , '');
-if (!REQUEST_ISSET_POST(('city')))         REQUEST_SET_POST('city'        , '');
-if (!REQUEST_ISSET_POST(('cntry')))        REQUEST_SET_POST('cntry'       , '');
-if (!REQUEST_ISSET_POST(('country_code'))) REQUEST_SET_POST('country_code', '1');
+if (!REQUEST_ISSET_POST('city'))         REQUEST_SET_POST('city'        , '');
+if (!REQUEST_ISSET_POST('cntry'))        REQUEST_SET_POST('cntry'       , '');
+if (!REQUEST_ISSET_POST('country_code')) REQUEST_SET_POST('country_code', '1');
+*/
 
 // Default refid is zero
 REQUEST_SET_POST('refid', 0);
 if ($GLOBALS['refid'] > 0) {
        // Test if the refid is valid
-       $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-       array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `userid` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+               array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
 
        // Userid found?
        //* DEBUG: */ die("refid={$GLOBALS['refid']}/numRows=".SQL_NUMROWS($result)."");
@@ -104,17 +107,17 @@ if (isFormSent()) {
 
        // Did he enter a valid email address? (we really don't care about
        // that, he has to click on a confirmation link :P )
-       if ((!REQUEST_ISSET_POST(('addy'))) || (!isEmailValid(REQUEST_POST('addy')))) {
+       if ((!REQUEST_ISSET_POST('addy')) || (!isEmailValid(REQUEST_POST('addy')))) {
                REQUEST_SET_POST('addy', '!');
                $isFailed = true;
        } // END - if
 
        // And what about surname and family's name?
-       if (!REQUEST_ISSET_POST(('surname'))) {
+       if (!REQUEST_ISSET_POST('surname')) {
                REQUEST_SET_POST('surname', '!');
                $isFailed = true;
        } // END - if
-       if (!REQUEST_ISSET_POST(('family'))) {
+       if (!REQUEST_ISSET_POST('family')) {
                REQUEST_SET_POST('family', '!');
                $isFailed = true;
        } // END - if
@@ -288,16 +291,16 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF
 
        // Write his welcome-points
        $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_points` WHERE userid=%s AND ref_depth=0 LIMIT 1",
-       array(bigintval($userid)), __FILE__, __LINE__);
+               array(bigintval($userid)), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 0) {
                // Add only when the line was not found (maybe some more secure?)
-               $locked = "points";
+               $locked = 'points';
                if (getConfig('ref_payout') > 0) $locked = "locked_points"; // Pay him later. First he has to confirm some mails!
                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_points` (userid, ref_depth, ".$locked.") VALUES (%s,0,'%s')",
-               array(bigintval($userid), getConfig('points_register')), __FILE__, __LINE__);
+                       array(bigintval($userid), getConfig('points_register')), __FILE__, __LINE__);
 
                // Update mediadata as well
-               if ((GET_EXT_VERSION('mediadata') >= '0.0.4') && ($locked == "points")) {
+               if ((GET_EXT_VERSION('mediadata') >= '0.0.4') && ($locked == 'points')) {
                        // Update database
                        MEDIA_UPDATE_ENTRY(array('total_points'), 'add', getConfig('points_register'));
                } // END - if
index ce88fd8..153ae8d 100644 (file)
@@ -55,49 +55,49 @@ if (isFormSent()) {
        // Check submitted form data
        //
        // 1. Salutation / Surname / family name
-       if (!REQUEST_ISSET_POST(('gender'))) {
+       if (!REQUEST_ISSET_POST('gender')) {
                // Surname is empty
                $FORM_ERRORS[] = getMessage('SPONSOR_NO_GENDER_SELECTED');
-       }
+       } // END - if
 
-       if (!REQUEST_ISSET_POST(('surname'))) {
+       if (!REQUEST_ISSET_POST('surname')) {
                // Surname is empty
                $FORM_ERRORS[] = getMessage('SPONSOR_SURNAME_IS_EMPTY');
-       }
+       } // END - if
 
-       if (!REQUEST_ISSET_POST(('family'))) {
+       if (!REQUEST_ISSET_POST('family')) {
                // Surname is empty
                $FORM_ERRORS[] = getMessage('SPONSOR_FAMILY_IS_EMPTY');
-       }
+       } // END - if
 
        // 2. Company name
-       // 012     3                 32    23      4                   43    3      4                  4321    12      3                 32    2     3                   3210
-       if (((!REQUEST_ISSET_POST(('company'))) && ((REQUEST_ISSET_POST(('tax_ident'))) || (REQUEST_ISSET_POST(('position'))))) || ((REQUEST_ISSET_POST(('company'))) && (!REQUEST_ISSET_POST(('tax_ident'))))) {
-               if (!REQUEST_ISSET_POST(('company'))) {
+       // 012                   3         32    23                  4           43    3                  4          4321    12                  3         32    2                   3           3210
+       if (((!REQUEST_ISSET_POST('company')) && ((REQUEST_ISSET_POST('tax_ident')) || (REQUEST_ISSET_POST('position')))) || ((REQUEST_ISSET_POST('company')) && (!REQUEST_ISSET_POST('tax_ident')))) {
+               if (!REQUEST_ISSET_POST('company')) {
                        // Company name is empty
                        $FORM_ERRORS[] = getMessage('SPONSOR_COMPANY_IS_EMPTY');
-               } elseif (!REQUEST_ISSET_POST(('tax_ident'))) {
+               } elseif (!REQUEST_ISSET_POST('tax_ident')) {
                        // Tax ident number name is empty
                        $FORM_ERRORS[] = getMessage('SPONSOR_TAX_IDENT_IS_EMPTY');
                }
 
-               if (!REQUEST_ISSET_POST(('position'))) {
+               if (!REQUEST_ISSET_POST('position')) {