A lot while() conditions rewritten to SQL_FETCHARRAY(), see bug #107, @TODO tags...
authorRoland Häder <roland@mxchange.org>
Fri, 6 Mar 2009 17:06:41 +0000 (17:06 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 6 Mar 2009 17:06:41 +0000 (17:06 +0000)
144 files changed:
.gitattributes
DOCS/TODOs.txt
DOCS/todo-builder.sh
css.php
doubler.php
inc/autopurge/purge-general.php
inc/autopurge/purge-inact.php
inc/autopurge/purge-mails.php
inc/autopurge/purge-tsks.php
inc/autopurge/purge-unconfirmed.php
inc/databases.php
inc/db/lib-mysql3.php
inc/doubler_send.php
inc/extensions.php
inc/extensions/ext-cache.php
inc/extensions/ext-rallye.php
inc/functions.php
inc/gen_refback.php
inc/language/de.php
inc/language/en.php
inc/language/holiday_de.php
inc/language/rallye_de.php
inc/language/sponsor_de.php
inc/libs/admins_functions.php
inc/libs/bonus_functions.php
inc/libs/doubler_functions.php
inc/libs/holiday_functions.php
inc/libs/payout_functions.php
inc/libs/rallye_functions.php
inc/libs/refback_functions.php
inc/libs/register_functions.php
inc/libs/sponsor_functions.php
inc/libs/surfbar_functions.php
inc/libs/task_functions.php
inc/libs/theme_functions.php
inc/libs/user_functions.php
inc/load_extensions.php
inc/loader/load_cache-admin.php
inc/mails/beg_mails.php
inc/mails/birthday_mails.php
inc/mails/bonus_mails.php
inc/modules/admin.php
inc/modules/admin/admin-inc.php
inc/modules/admin/overview-inc.php
inc/modules/admin/what-add_points.php
inc/modules/admin/what-add_rallye.php
inc/modules/admin/what-admin_add.php
inc/modules/admin/what-adminedit.php
inc/modules/admin/what-admins_edit.php
inc/modules/admin/what-admins_mails.php
inc/modules/admin/what-chk_regs.php
inc/modules/admin/what-config_admins.php
inc/modules/admin/what-config_cats.php
inc/modules/admin/what-config_email.php
inc/modules/admin/what-config_home.php
inc/modules/admin/what-config_mods.php
inc/modules/admin/what-config_payouts.php
inc/modules/admin/what-config_points.php
inc/modules/admin/what-config_primera.php
inc/modules/admin/what-config_rallye_prices.php
inc/modules/admin/what-config_register.php
inc/modules/admin/what-config_rewrite.php
inc/modules/admin/what-del_transfer.php
inc/modules/admin/what-del_user.php
inc/modules/admin/what-edit_emails.php
inc/modules/admin/what-email_archiv.php
inc/modules/admin/what-extensions.php
inc/modules/admin/what-guest_add.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_cats.php
inc/modules/admin/what-list_country.php
inc/modules/admin/what-list_holiday.php
inc/modules/admin/what-list_links.php
inc/modules/admin/what-list_payouts.php
inc/modules/admin/what-list_primera.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_task.php
inc/modules/admin/what-list_transfer.php
inc/modules/admin/what-list_unconfirmed.php
inc/modules/admin/what-list_user.php
inc/modules/admin/what-mem_add.php
inc/modules/admin/what-memedit.php
inc/modules/admin/what-overview.php
inc/modules/admin/what-payments.php
inc/modules/admin/what-refbanner.php
inc/modules/admin/what-repair_amenu.php
inc/modules/admin/what-repair_cats.php
inc/modules/admin/what-repair_gmenu.php
inc/modules/admin/what-repair_mmenu.php
inc/modules/admin/what-send_newsletter.php
inc/modules/admin/what-stats_mods.php
inc/modules/admin/what-sub_points.php
inc/modules/admin/what-theme_check.php
inc/modules/admin/what-theme_edit.php
inc/modules/admin/what-unlock_emails.php
inc/modules/admin/what-unlock_sponsor.php
inc/modules/admin/what-updates.php
inc/modules/admin/what-usage.php
inc/modules/admin/what-usr_online.php
inc/modules/guest/action-themes.php
inc/modules/guest/what-mediadata.php
inc/modules/guest/what-rallyes.php
inc/modules/guest/what-register.php
inc/modules/guest/what-sponsor_infos.php
inc/modules/guest/what-sponsor_reg.php
inc/modules/guest/what-stats.php
inc/modules/guest/what-top10.php
inc/modules/member/action-themes.php
inc/modules/member/what-beg2.php
inc/modules/member/what-categories.php
inc/modules/member/what-order.php
inc/modules/member/what-payout.php
inc/modules/member/what-points.php
inc/modules/member/what-rallyes.php
inc/modules/member/what-reflinks.php
inc/modules/member/what-stats.php
inc/modules/member/what-transfer.php
inc/modules/member/what-unconfirmed.php
inc/modules/sponsor/account.php
inc/modules/sponsor/settings.php
inc/monthly/monthly_newsletter.php
inc/mysql-manager.php
inc/patch-system.php
inc/pool/pool-user.php
inc/reset/reset_daily.php
inc/reset/reset_holiday.php
inc/security.php
inc/stats_bonus.php
templates/de/html/admin/admin_config_home_row.tpl [new file with mode: 0644]
templates/de/html/admin/admin_list_rallye_usr.tpl
templates/de/html/admin/admin_mods_stats2_row.tpl
templates/de/html/admin/admin_mods_stats_row.tpl
templates/de/html/guest/guest_sponsor_infos.tpl
templates/de/html/guest/guest_sponsor_infos_none_row.tpl [new file with mode: 0644]
templates/de/html/guest/guest_sponsor_payment_row.tpl [new file with mode: 0644]
templates/de/html/member/member_transfer_row.tpl [new file with mode: 0644]
templates/de/html/member/member_transfer_row2.tpl [new file with mode: 0644]
templates/de/html/theme_select_box.tpl
templates/de/html/theme_select_form.tpl

index 50977e6..c46d5c5 100644 (file)
@@ -890,6 +890,7 @@ templates/de/html/admin/admin_config_extensions.tpl -text
 templates/de/html/admin/admin_config_holiday.tpl -text
 templates/de/html/admin/admin_config_home.tpl -text
 templates/de/html/admin/admin_config_home_main.tpl -text
+templates/de/html/admin/admin_config_home_row.tpl -text
 templates/de/html/admin/admin_config_home_settings.tpl -text
 templates/de/html/admin/admin_config_home_settings_pro.tpl -text
 templates/de/html/admin/admin_config_mediadata.tpl -text
@@ -1319,9 +1320,11 @@ templates/de/html/guest/guest_register_refid_hide.tpl -text
 templates/de/html/guest/guest_sponsor_act_row.tpl -text
 templates/de/html/guest/guest_sponsor_activate.tpl -text
 templates/de/html/guest/guest_sponsor_infos.tpl -text
+templates/de/html/guest/guest_sponsor_infos_none_row.tpl -text
 templates/de/html/guest/guest_sponsor_login.tpl -text
 templates/de/html/guest/guest_sponsor_lost.tpl -text
 templates/de/html/guest/guest_sponsor_pay_row.tpl -text
+templates/de/html/guest/guest_sponsor_payment_row.tpl -text
 templates/de/html/guest/guest_sponsor_reg.tpl -text
 templates/de/html/guest/guest_stats_cats_row.tpl -text
 templates/de/html/guest/guest_stats_member.tpl -text
@@ -1471,6 +1474,8 @@ templates/de/html/member/member_themes.tpl -text
 templates/de/html/member/member_transfer_list.tpl -text
 templates/de/html/member/member_transfer_new.tpl -text
 templates/de/html/member/member_transfer_overview.tpl -text
+templates/de/html/member/member_transfer_row.tpl -text
+templates/de/html/member/member_transfer_row2.tpl -text
 templates/de/html/member/member_transfer_settings.tpl -text
 templates/de/html/member/member_unconfirmed_404.tpl -text
 templates/de/html/member/member_unconfirmed_404_nopoints.tpl -text
index 90043b3..57f39e1 100644 (file)
 ### WARNING: THIS FILE IS AUTO-GENERATED BY DOCS/todo-builder.sh ###
 ### DO NOT EDIT THIS FILE. ###
-./inc/extensions/ext-sql_patches.php:735:                      // @TODO Rewrite this to a filter!
-./inc/extensions/ext-sql_patches.php:773:              // @TODO Can we remove this? setConfigEntry('verbose_sql'        , "N");
-./inc/modules/guest/what-wernis_portal.php:80://  @TODO Can this be removed? $rdf->clear_cache();
-./inc/modules/guest/what-sponsor_reg.php:279:          // @TODO Swap this HTML code to templates
-./inc/modules/guest/what-register.php:196:     // @TODO Rewrite this to a single filter
-./inc/modules/member/what-bonus.php:50:        // @TODO Rewrite this to a filter
-./inc/modules/member/what-order.php:500:                                       // @TODO Rewrite this old lost code to a template
+./beg.php:191:                         // @TODO Opps, what is missing here???
+./inc/extensions/ext-sql_patches.php:744:                      // @TODO Rewrite this to a filter!
+./inc/extensions/ext-sql_patches.php:782:              // @TODO Can we remove this? setConfigEntry('verbose_sql'        , "N");
+./inc/extensions.php:270:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
+./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:2322:// @TODO Rewrite all language constants to this function.
+./inc/functions.php:255:                       // @TODO Fine all templates which are using these direct variables and rewrite them.
+./inc/functions.php:256:                       // @TODO After this step is done, this else-block is history
+./inc/functions.php:2624:              // @TODO Add a little more infos here
+./inc/functions.php:2730:// @TODO Implement $compress
+./inc/functions.php:2737:// @TODO Implement $decompress
+./inc/functions.php:2840:      // @TODO We may want to switch over to UTF-8 here!
+./inc/functions.php:2848:// @TODO Rewrite this function to use READ_FILE() and WRITE_FILE()
+./inc/functions.php:471:// @TODO Rewrite this to an extension 'smtp'
+./inc/language/rallye_de.php:105:// @TODO Rewrite following two lines to one
+./inc/language/sponsor_de.php:119:// @TODO These three constants should be moved into a template
+./inc/libs/cache_functions.php:371:    // @TODO Add support for more types which break in last else-block
+./inc/libs/doubler_functions.php:41:// @TODO Lame description
+./inc/libs/nickname_functions.php:54:          // @TODO Can we replace this with GET_TOTAL_DATA() ?
+./inc/libs/rallye_functions.php:630:   $EXPIRE = getConfig('one_day') * 3; // @TODO The hard-coded value...
+./inc/libs/rallye_functions.php:660:                   // @TODO Rewrite this to a function
+./inc/libs/rallye_functions.php:699:           // @TODO Rewrite this to our API function
+./inc/libs/register_functions.php:48:          // @TODO Rewrite these constants
+./inc/libs/surfbar_functions.php:1420:         // @TODO This can be somehow rewritten
+./inc/libs/surfbar_functions.php:912:  // @TODO Invalid salt should be refused
+./inc/libs/task_functions.php:256:             // @TODO These can be rewritten to filter
+./inc/libs/task_functions.php:48:// @TODO Move all extension-dependent queries into filters
+./inc/libs/user_functions.php:306:                     // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', array('login' => $login, 'online' => $online));
+./inc/libs/user_functions.php:330:                     // @TODO Make this filter working: $URL = runFilterChain('do_login', array('uid' => $uid, 'hash' => $hash, 'addon' => $ADDON));
+./inc/libs/user_functions.php:365:             // @TODO Can this query be merged with above query?
+./inc/libs/yoomedia_functions.php:60:  $response = YOOMEDIA_QUERY_API("out_textmail.php", true); // @TODO Ask Yoo!Media for test script
+./inc/loader/load_cache-config.php:45: // @TODO: Do we really need to cache the config???
+./inc/load_extensions.php:13: * @TODO Rewrite this whole file to load_cache-extensions.php           *
+./inc/mails/birthday_mails.php:80:                     // @TODO 4 is hard-coded here, should we move it out in config?
+./inc/modules/admin/admin-inc.php:338:         // @TODO Rewrite this to $content = SQL_FETCHARRAY()
+./inc/modules/admin/admin-inc.php:381:                                 // @TODO Rewrite this to $content = SQL_FETCHARRAY()
+./inc/modules/admin/admin-inc.php:446: // @TODO Is this eval longer needed?
+./inc/modules/admin/admin-inc.php:500:         // @TODO Rewrite these both constants
+./inc/modules/admin/admin-inc.php:526:         // @TODO Try to rewrite this to $content = SQL_FETCHARRAY(). Please look some lines above for the dynamic query
+./inc/modules/admin/overview-inc.php:225:                              // @TODO Rewrite this to something with include files
+./inc/modules/admin/overview-inc.php:264:                                      // @TODO This may also be rewritten to include files
+./inc/modules/admin/overview-inc.php:267:                                      default: // @TODO Unknown support mode
+./inc/modules/admin/overview-inc.php:385:              // @TODO Rewrite this to one template and use $OUT = ...
+./inc/modules/admin/overview-inc.php:415:                      // @TODO Rewritings: admin->assigned_admin,uid->userid,type->task_type_msg in template
+./inc/modules/admin/overview-inc.php:427:                              // @TODO Rewrite this to $OUT .= ..., true, ...
+./inc/modules/admin/overview-inc.php:431:                              // @TODO Rewrite this to $OUT .= ..., true, ...
+./inc/modules/admin.php:89:                            // @TODO Why is this set to 'done'?
+./inc/modules/admin/what-add_points.php:115:                   // @TODO Rewrite these both constants
+./inc/modules/admin/what-add_points.php:49:            // @TODO Rewrite this constant
+./inc/modules/admin/what-admin_add.php:114:                            // @TODO This can be somehow rewritten to a function
+./inc/modules/admin/what-admin_add.php:72:             // @TODO This can be somehow rewritten to a function
+./inc/modules/admin/what-adminedit.php:245:            // @TODO Rewrite this constant
+./inc/modules/admin/what-admins_add.php:63:    // @TODO Do we still need this ugly code here?
+./inc/modules/admin/what-admins_mails.php:168:         // @TODO Rewrite this constant
+./inc/modules/admin/what-admins_mails.php:56:                          // @TODO Can this be rewritten???
+./inc/modules/admin/what-admins_mails.php:95:          // @TODO Rewrite this constant
+./inc/modules/admin/what-chk_regs.php:57:              // @TODO Rewritings: sname->surname,fname->family,ip->REMOTE_ADDR,ref->refid,hash->user_hash in template
+./inc/modules/admin/what-chk_regs.php:76:      // @TODO Rewrite this constant
 ./inc/modules/admin/what-config_admins.php:155:                // @TODO This causes the whole (!) menu cache being rebuild
-./inc/modules/admin/what-logs.php:64:                  // @TODO Fix content-type here
-./inc/modules/admin/what-logs.php:67:                  // @TODO Fix content-type here
+./inc/modules/admin/what-config_cats.php:187:          // @TODO Rewrite this constant
+./inc/modules/admin/what-config_cats.php:194:  // @TODO Rewrite this constant
+./inc/modules/admin/what-config_mods.php:134:          // @TODO Rewritings: mod->module in template
+./inc/modules/admin/what-config_mods.php:156:  // @TODO Rewrite this constant
+./inc/modules/admin/what-config_payouts.php:139:               // @TODO Rewrite this constant
+./inc/modules/admin/what-config_payouts.php:225:       // @TODO Rewrite this constant
+./inc/modules/admin/what-config_points.php:257:                                // @TODO Rewritings: lvl->level, per->percents in template
+./inc/modules/admin/what-config_rallye_prices.php:198:                         // @TODO Rewritings: level->price_level, infos->info in template
+./inc/modules/admin/what-config_rallye_prices.php:215:                 // @TODO Rewrite these two constants
+./inc/modules/admin/what-config_rallye_prices.php:243:                 // @TODO Rewritings: aid->admin_id, alogin->login in template
+./inc/modules/admin/what-config_register.php:63:       // @TODO Move this HTML code into a template
+./inc/modules/admin/what-config_register.php:80:// @TODO Rewrite this constant
+./inc/modules/admin/what-config_rewrite.php:92:        // @TODO Rewrite this constant
+./inc/modules/admin/what-del_transfer.php:101:// @TODO Rewrite all these constants
+./inc/modules/admin/what-del_transfer.php:71:          // @TODO Rewritings: idx->trans_id in template
+./inc/modules/admin/what-edit_emails.php:108:          // @TODO Yet another constant to rewrite
+./inc/modules/admin/what-edit_emails.php:55:           // @TODO More constants to rewrite
+./inc/modules/admin/what-edit_emails.php:90:                   // @TODO Rewritings: subj->subject in template
+./inc/modules/admin/what-guest_add.php:117:                            // @TODO This can be somehow rewritten to a function
+./inc/modules/admin/what-guest_add.php:72:             // @TODO This can be somehow rewritten to a function
+./inc/modules/admin/what-guestedit.php:279:            // @TODO Rewrite this constant
+./inc/modules/admin/what-list_autopurge.php:50:// @TODO Rewrite those lines to filter
+./inc/modules/admin/what-list_autopurge.php:73:                // @TODO Rewritings: sname->surname,fname->family in templates
+./inc/modules/admin/what-list_autopurge.php:93:        // @TODO Rewrite this constant
+./inc/modules/admin/what-list_beg.php:80:                      // @TODO Rewrite templates so s/fname will be replaced by surname/family
+./inc/modules/admin/what-list_beg.php:81:                      // @TODO to shorten this block. Please also do so with uid->userid
+./inc/modules/admin/what-list_cats.php:87:                     // @TODO Rewrite this constant
+./inc/modules/admin/what-list_country.php:175:                 // @TODO Rewritings: name->descr,status->is_active in template
+./inc/modules/admin/what-list_holiday.php:77:  // @TODO Rewrite this constant
+./inc/modules/admin/what-list_links.php:91:                            // @TODO Find a way to rewrite this. See some lines above for different queries
 ./inc/modules/admin/what-list_newsletter.php:59:       // @TODO Currently under construction!
-./inc/modules/admin/what-usage.php:83: // @TODO This code is double, see LOAD_TEMPLATE and LOAD_EMAIL_TEMPLATE in functions.php
-./inc/modules/admin/what-admins_add.php:63:    // @TODO Do we still need this ugly code here?
+./inc/modules/admin/what-list_rallyes.php:226:         // @TODO Rewrite this constant
+./inc/modules/admin/what-list_rallyes.php:250:                 // @TODO Rewritings: uid->userid,opoints->curr_points,old->refs in template
+./inc/modules/admin/what-list_rallyes.php:304:                 // @TODO Rewritings: aid->admin_id in template
+./inc/modules/admin/what-list_sponsor.php:150:                 // @TODO Rewritings: sname->surname,fname->family,ip->remote_addr in template
+./inc/modules/admin/what-list_sponsor.php:173:         // @TODO Rewrite this constant
+./inc/modules/admin/what-list_sponsor.php:68:          // @TODO Rewrite this huge amount of constants
+./inc/modules/admin/what-list_task.php:124:            // @TODO Rewrite these templates to one and add $OUT
+./inc/modules/admin/what-list_task.php:159:                    // @TODO Rewritings: admin->assigned_admin,uid->userid,type->task_type_msg in template
+./inc/modules/admin/what-list_task.php:171:                            // @TODO Rewrite this to $OUT .= ..., true, ...
+./inc/modules/admin/what-list_task.php:175:                            // @TODO Rewrite this to $OUT .= ..., true, ...
+./inc/modules/admin/what-list_transfer.php:81:// @TODO Rewrite these constants
+./inc/modules/admin/what-list_unconfirmed.php:114:             // @TODO Rewrite this constant
+./inc/modules/admin/what-list_unconfirmed.php:123:                             // @TODO Rewritings: uid->userid
+./inc/modules/admin/what-list_unconfirmed.php:87:              // @TODO Rewrite this to $content = SQL_FETCHARRAY(), look some lines above for two differrent queries
+./inc/modules/admin/what-list_unconfirmed.php:95:              // @TODO Rewrite these constants
 ./inc/modules/admin/what-list_user.php:155:            // @TODO Rewrite these to filters
 ./inc/modules/admin/what-list_user.php:280:            // @TODO Rewrite this into a  filter
 ./inc/modules/admin/what-list_user.php:332:                    // @TODO Rewrite this into a filter
+./inc/modules/admin/what-logs.php:64:                  // @TODO Fix content-type here
+./inc/modules/admin/what-logs.php:67:                  // @TODO Fix content-type here
+./inc/modules/admin/what-mem_add.php:115:                              // @TODO This can be somehow rewritten to a function
+./inc/modules/admin/what-mem_add.php:73:               // @TODO This can be somehow rewritten to a function
+./inc/modules/admin/what-memedit.php:250:              // @TODO Rewrite this constant
+./inc/modules/admin/what-memedit.php:286:              // @TODO Rewrite this constant
+./inc/modules/admin/what-payments.php:149:                     // @TODO Rewritings: title->mail_title, pay->payment in template
+./inc/modules/admin/what-refbanner.php:122:    // @TODO Rewrite this constant
+./inc/modules/admin/what-refbanner.php:144:                    // @TODO Rewritings: alt->alternate,cnt->counter,clx->clicks in template
+./inc/modules/admin/what-refbanner.php:163:            // @TODO Rewrite this constant
+./inc/modules/admin/what-repair_amenu.php:80:// @TODO This causes the whole (!) menu cache being rebuilded
+./inc/modules/admin/what-send_newsletter.php:81:       // @TODO Rewrite this constant
+./inc/modules/admin/what-sub_points.php:100:                   // @TODO Rewrite these constants
+./inc/modules/admin/what-sub_points.php:48:    // @TODO Rewrite this constant
 ./inc/modules/admin/what-theme_check.php:121:                  // @TODO Move this HTML code to a template "admin_theme_row"
-./inc/modules/admin/what-admins_mails.php:58:                          // @TODO Can this be rewritten???
-./inc/modules/admin/overview-inc.php:225:                              // @TODO Rewrite this to something with include files
-./inc/modules/admin/overview-inc.php:264:                                      // @TODO This may also be rewritten to include files
-./inc/modules/admin/overview-inc.php:267:                                      default: // @TODO Unknown support mode
-./inc/modules/admin/admin-inc.php:452: // @TODO Is this eval longer needed?
-./inc/modules/admin/what-repair_amenu.php:79:// @TODO This causes the whole (!) menu cache being rebuilded
-./inc/modules/admin.php:89:                            // @TODO Why is this set to 'done'?
-./inc/libs/yoomedia_functions.php:60:  $response = YOOMEDIA_QUERY_API("out_textmail.php", true); // @TODO Ask Yoo!Media for test script
-./inc/libs/task_functions.php:48:// @TODO Move all extension-dependent queries into filters
-./inc/libs/rallye_functions.php:653:   $EXPIRE = getConfig('one_day') * 3; // @TODO The hard-coded value...
-./inc/libs/rallye_functions.php:717:           // @TODO Rewrite this to our API function
-./inc/libs/doubler_functions.php:41:// @TODO Lame description
-./inc/libs/surfbar_functions.php:912:  // @TODO Invalid salt should be refused
-./inc/libs/user_functions.php:306:                     // @TODO Make this filter working: $ADDON = RUN_FILTER('post_login_update', array('login' => $login, 'online' => $online));
-./inc/libs/user_functions.php:330:                     // @TODO Make this filter working: $URL = RUN_FILTER('do_login', array('uid' => $uid, 'hash' => $hash, 'addon' => $ADDON));
-./inc/libs/user_functions.php:365:             // @TODO Can this query be merged with above query?
-./inc/libs/nickname_functions.php:54:          // @TODO Can we replace this with GET_TOTAL_DATA() ?
-./inc/loader/load_cache-config.php:45: // @TODO: Do we really need to cache the config???
-./inc/extensions.php:272:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
-./inc/functions.php:263:                       // @TODO Fine all templates which are using these direct variables and rewrite them.
-./inc/functions.php:264:                       // @TODO After this step is done, this else-block is history
-./inc/functions.php:1306:      // @TODO Remove this if() block if all is working fine
-./inc/functions.php:2331:// @TODO Rewrite all language constants to this function.
-./inc/functions.php:2633:              // @TODO Add a little more infos here
-./inc/functions.php:2739:// @TODO Implement $compress
-./inc/functions.php:2746:// @TODO Implement $decompress
-./inc/functions.php:2849:      // @TODO We may want to switch over to UTF-8 here!
-./inc/functions.php:2857:// @TODO Rewrite this function to use READ_FILE() and WRITE_FILE()
-./inc/mysql-manager.php:162:                   // @TODO Nothing helped???
-./inc/mysql-manager.php:599:   // @TODO Why is this global??? #100
-./inc/mysql-manager.php:927:                   // @TODO Why does this lead into an endless loop but we still need it???
-./inc/mysql-manager.php:1730:                          // @TODO Find a way for updating $_CONFIG here
-./inc/mysql-manager.php:1754:          // @TODO Find a way for updating $_CONFIG here
-./beg.php:191:                         // @TODO Opps, what is missing here???
+./inc/modules/admin/what-unlock_sponsor.php:183:               // @TODO Rewritings: remote->remote_addr, created->sponsor_created in template
+./inc/modules/admin/what-usage.php:83: // @TODO This code is double, see LOAD_TEMPLATE and LOAD_EMAIL_TEMPLATE in functions.php
+./inc/modules/admin/what-usr_online.php:102:           // @TODO Rewrite this constant
+./inc/modules/admin/what-usr_online.php:46:    // @TODO Rewrite these constants
+./inc/modules/admin/what-usr_online.php:47:    // @TODO Add a filter for sponsor
+./inc/modules/guest/what-mediadata.php:183:// @TODO Rewrite these all if-blocks to filters
+./inc/modules/guest/what-register.php:196:     // @TODO Rewrite this to a single filter
+./inc/modules/guest/what-sponsor_infos.php:62:         // @TODO Rewritings: conv->conv_rate,name->conv_name in template
+./inc/modules/guest/what-sponsor_infos.php:82:                 // @TODO Rewritings: name->pay_name,min->pay_min_count,min->pay_min_count,curr->pay_currency
+./inc/modules/guest/what-sponsor_reg.php:279:          // @TODO Swap this HTML code to templates
+./inc/modules/guest/what-sponsor_reg.php:293:          // @TODO Rewrite this constant
+./inc/modules/guest/what-sponsor_reg.php:299:                  // @TODO Rewrite these constants
+./inc/modules/guest/what-stats.php:105:        // @TODO This can be somehow rewritten
+./inc/modules/guest/what-stats.php:118:        // @TODO Rewrite all these constants
+./inc/modules/guest/what-stats.php:187:                // @TODO Rewrite this to one template and $OUT .= ....
+./inc/modules/guest/what-top10.php:102:// @TODO Rewrite this constant
+./inc/modules/guest/what-top10.php:140:        // @TODO Rewritings: nick->nickname,uid->userid in template
+./inc/modules/guest/what-top10.php:172:// @TODO Rewrite this constant
+./inc/modules/guest/what-top10.php:210:        // @TODO Rewritings: nick->nickname,uid->userid in template
+./inc/modules/guest/what-top10.php:243:// @TODO Rewrite this constant
+./inc/modules/guest/what-top10.php:250:// @TODO Rewrite this constant
+./inc/modules/guest/what-top10.php:69: // @TODO Rewritings: uid->userid,nick->nickname,logins->total_logins in template
+./inc/modules/guest/what-wernis_portal.php:80://  @TODO Can this be removed? $rdf->clear_cache();
+./inc/modules/member/what-bonus.php:50:        // @TODO Rewrite this to a filter
+./inc/modules/member/what-categories.php:107:          // @TODO Rewrite this to use $OUT .= ...
+./inc/modules/member/what-order.php:500:                                       // @TODO Rewrite this old lost code to a template
+./inc/modules/member/what-payout.php:126:                              // @TODO Rewritings: acc->target_account,bank->target_bank in templates
+./inc/modules/member/what-payout.php:142:                      // @TODO Rewrite this constant
+./inc/modules/member/what-payout.php:176:              // @TODO Rewrite these constants
+./inc/modules/member/what-payout.php:184:                              // @TODO Rewrite this constant
+./inc/modules/member/what-points.php:49:// @TODO Should we rewrite this to a filter?
+./inc/modules/member/what-reflinks.php:100:            // @TODO Rewritings: alt->alternate,cnt->counter,cks->clicks,uid->userid in template
+./inc/modules/member/what-transfer.php:111:                    // @TODO Rewrite all these constants to array elements
+./inc/modules/member/what-transfer.php:242:                    // @TODO Try to rewrite his to $content = SQL_FETCHARRAY(), see some lines above for two different queries
+./inc/modules/member/what-transfer.php:304:            // @TODO Rewrite these constants
+./inc/modules/member/what-transfer.php:312:            // @TODO Rewrite these constants
+./inc/modules/member/what-transfer.php:324:            // @TODO This should be somehow rewritten to $content = SQL_FETCHARRAY(), see switch() block above for SQL queries
+./inc/modules/member/what-transfer.php:359:    // @TODO Rewrite these constants
+./inc/modules/member/what-transfer.php:446:    // @TODO Rewrite all these constants
+./inc/modules/member/what-unconfirmed.php:129: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
+./inc/mysql-manager.php:1504:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
+./inc/mysql-manager.php:168:                   // @TODO Nothing helped???
+./inc/mysql-manager.php:1713:                          // @TODO Find a way for updating $_CONFIG here
+./inc/mysql-manager.php:1737:          // @TODO Find a way for updating $_CONFIG here
+./inc/mysql-manager.php:1821:                  // @TODO Rewrite this to $content = SQL_FETCHARRAY()
+./inc/mysql-manager.php:2115:          // @TODO This can be somehow rewritten
+./inc/mysql-manager.php:612:   // @TODO Why is this global??? #100
+./inc/mysql-manager.php:940:                   // @TODO Why does this lead into an endless loop but we still need it???
 ./mailid_top.php:206:                                                                  // @TODO Rewrite these blocks to filter
 ./surfbar.php:60:              // @TODO Display quick login form here or redirect as configured
index 0765d1e..52c4164 100644 (file)
@@ -11,6 +11,6 @@ fi
 echo "$0: Generating TODOs.txt..."
 echo "### WARNING: THIS FILE IS AUTO-GENERATED BY $0 ###" > DOCS/TODOs.txt
 echo "### DO NOT EDIT THIS FILE. ###" >> DOCS/TODOs.txt
-find -type f -name "*.php" -exec grep -Hn "@TODO" {} \; >> DOCS/TODOs.txt
+find -type f -name "*.php" -exec grep -Hn "@TODO" {} \; | sort >> DOCS/TODOs.txt
 echo "$0: Done."
 exit 0
diff --git a/css.php b/css.php
index c722525..f246c83 100644 (file)
--- a/css.php
+++ b/css.php
@@ -31,9 +31,6 @@
  * MA  02110-1301  USA                                                  *
  ************************************************************************/
 
-// Deactivate caching system in CSS mode
-define('_OB_CACHING', "old");
-
 // Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
 require("inc/libs/security_functions.php");
 
index 983653d..0faafa9 100644 (file)
@@ -123,7 +123,7 @@ if (isInstalled()) {
                        // Check all together
                        if ((!empty($uid)) && ($password == generateHash(REQUEST_POST('pass'), substr($password, 0, -40))) && ($status == "CONFIRMED") && ($probe_points)) {
                                // Nickname resolved to a unique userid or direct userid entered by the member
-                               $DOUBLER_UID = $uid;
+                               $GLOBALS['doubler_uid'] = $uid;
 
                                // Calulcate points
                                $points = GET_TOTAL_DATA($uid, "user_points", "points") - GET_TOTAL_DATA($uid, "user_data", "used_points");
index 782b69d..c4e63c3 100644 (file)
@@ -45,6 +45,9 @@ if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) {
 }
 
 if ((getConfig('auto_purge_active') == "Y") && (getConfig('auto_purge') > 0)) {
+       // Init SQLs
+       INIT_SQLS();
+
        // First calculate the timestamp
        $PURGE = getConfig('auto_purge');
 
@@ -57,35 +60,35 @@ FROM `{!_MYSQL_PREFIX!}_user_stats` AS s
 LEFT JOIN `{!_MYSQL_PREFIX!}_payments` AS t
 ON s.payment_id=t.id
 WHERE s.timestamp_ordered <= (UNIX_TIMESTAMP() - %s) ORDER BY s.userid",
-        array(bigintval($PURGE)), __FILE__, __LINE__);
+               array(bigintval($PURGE)), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // Start deleting procedure
                $uid = 0; $points = 0;
-               while (list($mid, $sender, $pool, $price) = SQL_FETCHROW($result)) {
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Check if confirmation links are purged or not
                        $result_links = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s LIMIT 1",
-                        array(bigintval($mid)), __FILE__, __LINE__);
+                               array(bigintval($content['id'])), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result_links) == 1) {
                                // Free memory
                                SQL_FREERESULT($result_links);
 
                                // At least one link was found, enougth to pay back the points
-                               if (($uid != $sender) && ($uid > 0) && ($points > 0)) {
+                               if (($uid != $content['userid']) && ($uid > 0) && ($points > 0)) {
                                        // Directly add points back to senders account
                                        AUTOPURGE_ADD_POINTS($uid, $points);
                                        $points = 0;
                                } // END - if
 
                                // Add points
-                               $uid = $sender; $points += $price; $admin_points += $price;
+                               $uid = $content['userid']; $points += $content['price']; $admin_points += $content['price'];
 
                                // Remove confirmation links from queue
-                               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s",
-                                       array(bigintval($mid)), __FILE__, __LINE__);
+                               ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s",
+                                       array(bigintval($content['id'])), __FILE__, __LINE__, false));
 
                                // Update status of order
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='DELETED' WHERE id=%s LIMIT 1",
-                                       array(bigintval($pool)), __FILE__, __LINE__);
+                               ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='DELETED' WHERE id=%s LIMIT 1",
+                                       array(bigintval($content['pool_id'])), __FILE__, __LINE__, false));
                        } // END - if
                } // END - while
 
@@ -104,24 +107,24 @@ WHERE s.timestamp_ordered <= (UNIX_TIMESTAMP() - %s) ORDER BY s.userid",
                if (SQL_NUMROWS($result) > 0) {
                        // Start deleting procedure
                        $points = 0;
-                       while (list($bid, $price) = SQL_FETCHROW($result)) {
+                       while ($content = SQL_FETCHARRAY($result)) {
                                // Check if confirmation links are purged or not
                                $result_links = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s",
-                                       array(bigintval($bid)), __FILE__, __LINE__);
+                                       array(bigintval($content['id'])), __FILE__, __LINE__);
                                if (SQL_NUMROWS($result_links) > 0) {
                                        // At least one link was found, enougth to pay back the points
-                                       $points += $price * SQL_NUMROWS($result_links);
+                                       $points += $content['points'] * SQL_NUMROWS($result_links);
 
                                        // Free memory
                                        SQL_FREERESULT($result_links);
 
                                        // Remove confirmation links from queue
-                                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s",
-                                               array(bigintval($bid)), __FILE__, __LINE__);
+                                       ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s",
+                                               array(bigintval($content['id'])), __FILE__, __LINE__, false));
 
                                        // Update status of order
-                                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='DELETED' WHERE id=%s LIMIT 1",
-                                               array(bigintval($bid)), __FILE__, __LINE__);
+                                       ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='DELETED' WHERE id=%s LIMIT 1",
+                                               array(bigintval($content['id'])), __FILE__, __LINE__, false));
                                } // END - if
                        } // END - while
 
@@ -139,8 +142,11 @@ WHERE s.timestamp_ordered <= (UNIX_TIMESTAMP() - %s) ORDER BY s.userid",
        // Add points from deleted accounts to jackpot, but here just add to notify mail
        if ($admin_points > 0) {
                // Send mail to admin
-               SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_SUBJECT, "admin_autopurge_points", TRANSLATE_COMMA($points), "0");
+               SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_SUBJECT'), "admin_autopurge_points", TRANSLATE_COMMA($points), "0");
        } // END - if
+
+       // Run all SQLs here
+       runFilterChain('run_sqls');
 } // END - if
 
 //
index adb04be..56fabfb 100644 (file)
@@ -45,6 +45,9 @@ if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) {
 
 // Shall I look for inactive accounts and autopurge inactive accounts?
 if (getConfig('autopurge_inactive') == "Y") {
+       // Init SQLs
+       INIT_SQLS();
+
        // Ok, let's have a look...
        $since = getConfig(('ap_inactive_since'));
 
@@ -79,27 +82,27 @@ ORDER BY d.userid", array($since, $since, $since), __FILE__, __LINE__);
                define('__INACTIVE_TIME' , (getConfig('ap_in_time')  / 60 / 60));
 
                // Mark found accounts as inactive and send an email
-               while (list($uid, $email, $last) = SQL_FETCHROW($result_inactive)) {
+               while ($content = SQL_FETCHARRAY($result_inactive)) {
                        // Remember userids for the admin
-                       $UIDs .= $uid.", ";
+                       $UIDs .= $content['userid'].", ";
 
                        // Get date/time from timestamp
-                       $last = MAKE_DATETIME($last, "0");
+                       $content['last_online'] = MAKE_DATETIME($content['last_online'], "0");
 
                        // Load mail template
-                       $msg = LOAD_EMAIL_TEMPLATE("member_autopurge_inactive", $last, bigintval($uid));
-                       SEND_EMAIL($email, AUTOPURGE_MEMBER_INACTIVE_SUBJECT, $msg);
+                       $msg = LOAD_EMAIL_TEMPLATE("member_autopurge_inactive", $content['last_online'], bigintval($content['userid']));
+                       SEND_EMAIL($content['email'], getMessage('AUTOPURGE_MEMBER_INACTIVE_SUBJECT'), $msg);
 
                        // Update this account
-                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ap_notified=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1",
-                               array(bigintval($uid)), __FILE__, __LINE__);
+                       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
-               SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_INACTIVE_SUBJECT, "admin_autopurge_inactive", $UIDs, "");
+               SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_INACTIVE_SUBJECT'), "admin_autopurge_inactive", $UIDs, "");
        } // END - if
 
        // Free memory
@@ -113,21 +116,21 @@ 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)
 ".$EXCLUDE_LIST."
 ORDER BY userid",
-        array($since, $since, $time), __FILE__, __LINE__);
+               array($since, $since, $time), __FILE__, __LINE__);
        if (SQL_NUMROWS($result_inactive) > 0) {
                // Prepare variable...
                $UIDs = "";
 
                // Delete inactive accounts
-               while (list($uid, $email, $last) = SQL_FETCHROW($result_inactive)) {
+               while ($content = SQL_FETCHARRAY($result_inactive)) {
                        // Remember userids for the admin
-                       $UIDs .= $uid.", ";
+                       $UIDs .= $content['userid'].", ";
 
                        // Get date/time from timestamp
-                       $last = MAKE_DATETIME($last, "0");
+                       $content['last_online'] = MAKE_DATETIME($content['last_online'], "0");
 
                        // Finnaly delete this inactive account
-                       DELETE_USER_ACCOUNT(bigintval($uid), LOAD_EMAIL_TEMPLATE("member_autopurge_delete", $last, ""));
+                       DELETE_USER_ACCOUNT($content['userid'], LOAD_EMAIL_TEMPLATE("member_autopurge_delete", $content['last_online'], ""));
                } // END - while
 
                // Remove last comma
@@ -135,12 +138,15 @@ ORDER BY userid",
 
                // Send mail notification to admin
                if (getConfig('ap_in_notify') == "Y") {
-                       SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_DELETE_SUBJECT, "admin_autopurge_delete", $UIDs, "");
+                       SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_DELETE_SUBJECT'), "admin_autopurge_delete", $UIDs, "");
                } // END - if
        } // END - if
 
        // Free memory
        SQL_FREERESULT($result_inactive);
+
+       // Run all SQLs
+       runFilterChain('run_sqls');
 } // END - if
 
 //
index 3970e29..5597917 100644 (file)
@@ -47,7 +47,7 @@ if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) {
 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",
@@ -59,14 +59,14 @@ ORDER BY sender ASC",
        // Do we have "purged" mails?
        if (SQL_NUMROWS($result_mails) > 0) {
                // Okay, check for their sender's
-               while (list($sender) = SQL_FETCHROW($result_mails)) {
+               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",
-                               array(bigintval($sender)), __FILE__, __LINE__));
+                               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($sender)), __FILE__, __LINE__);
+                                       array(bigintval($content['sender'])), __FILE__, __LINE__);
                                $DELETED += SQL_AFFECTEDROWS();
 
                                // Reset query (to prevent possible errors) ...
@@ -94,12 +94,12 @@ ORDER BY sender ASC",
        // Do we have "purged" mails?
        if (SQL_NUMROWS($result_mails) > 0) {
                // Okay, check for their sender's
-               while (list($sender) = SQL_FETCHROW($result_mails)) {
+               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($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($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) ...
@@ -119,8 +119,8 @@ 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
-               SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT, "admin_autopurge_del_mails", $DELETED, "");
-       }
+               SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT'), "admin_autopurge_del_mails", $DELETED, "");
+       } // END - if
 }
 
 //
index 5cdc442..6b7726b 100644 (file)
@@ -53,11 +53,14 @@ if ((GET_EXT_VERSION("task") > "0.0") && (getConfig('ap_tasks') == "Y")) {
 FROM `{!_MYSQL_PREFIX!}_task_system`
 WHERE `status`='DELETED' AND task_created <= (UNIX_TIMESTAMP() - %s)",
                array($since), __FILE__, __LINE__);
+
+       // Get deleted rows
        $DELETED = SQL_AFFECTEDROWS();
 
+       // Do we need to send a notification?
        if (($DELETED > 0) && (getConfig('ap_tasks_notify') == "Y")) {
                // Send out email to admin
-               SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_TASKS_SUBJECT, "admin_autopurge_tsks", $DELETED, "");
+               SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_TASKS_SUBJECT'), "admin_autopurge_tsks", $DELETED, "");
        } // END - if
 } // END - if
 
index 8871ffd..4929f2d 100644 (file)
@@ -51,22 +51,22 @@ if (getConfig('autopurge_unconfirmed') == "Y") {
 FROM `{!_MYSQL_PREFIX!}_user_data`
 WHERE `status`='UNCONFIRMED' AND joined < (UNIX_TIMESTAMP() - %s)
 ORDER BY userid ASC",
-        array($time), __FILE__, __LINE__);
+               array($time), __FILE__, __LINE__);
        if (SQL_NUMROWS($result_uncon) > 0) {
                // Prepare variable...
                $UIDs = "";
                define('__UNCONFIRMED_TIME' , (getConfig('ap_un_time')  / 60 / 60));
 
                // Delete inactive accounts
-               while (list($uid, $email, $joined) = SQL_FETCHROW($result_uncon)) {
+               while ($content = SQL_FETCHARRAY($result_uncon)) {
                        // Remember userids for the admin
-                       $UIDs .= $uid.", ";
+                       $UIDs .= $content['userid'].", ";
 
                        // Get date/time from timestamp
-                       $joined = MAKE_DATETIME($joined, "0");
+                       $content['joined'] = MAKE_DATETIME($content['joined'], "0");
 
                        // Finnaly delete this inactive account
-                       DELETE_USER_ACCOUNT($uid, LOAD_EMAIL_TEMPLATE("member_autopurge_unconfirmed", $joined, ""));
+                       DELETE_USER_ACCOUNT($content['userid'], LOAD_EMAIL_TEMPLATE("member_autopurge_unconfirmed", $content['joined'], ""));
                } // END - while
 
                // Remove last comma
@@ -74,7 +74,7 @@ ORDER BY userid ASC",
 
                // Send mail notification to admin
                if (getConfig('ap_un_notify') == "Y") {
-                       SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT, "admin_autopurge_unconfirmed", $UIDs, "");
+                       SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT'), "admin_autopurge_unconfirmed", $UIDs, "");
                } // END - if
        } // END - if
 
index c6d3aab..7440f0e 100644 (file)
@@ -98,7 +98,7 @@ define('SERVER_URL', "http://www.mxchange.org");
 
 // Current SVN revision
 //define('CURR_SVN_REVISION', getActualVersion(0));
-define('CURR_SVN_REVISION', "827");
+define('CURR_SVN_REVISION', "828");
 define('CURR_SVN_DATE'    , getActualVersion(1));
 define('CURR_SVN_VERSION' , getActualVersion(2));
 
index 67c37e0..2053425 100644 (file)
@@ -243,7 +243,7 @@ function SQL_QUERY_ESC ($qstring, $data, $F, $L, $run=true, $strip=true) {
        // Init variable
        $query = "failed";
 
-       if ($strip) {
+       if ($strip === true) {
                $strip = "true";
        } else {
                $strip = "false";
index d71492d..6e8ae9c 100644 (file)
@@ -51,7 +51,7 @@ if ($DOUBLER_POINTS == 0) {
 unset($_GET['DOUBLER_UID']);
 unset($_POST['DOUBLER_UID']);
 set_session('DOUBLER_UID', "");
-if (empty($DOUBLER_UID)) $DOUBLER_UID = 0;
+if (empty($GLOBALS['doubler_uid'])) $GLOBALS['doubler_uid'] = 0;
 
 // Check for doubles which we can pay out
 $min = getConfig(('doubler_min') * 2);
@@ -78,49 +78,49 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == "Y"))
        if ((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == "Y")) $result_load = $result_total;
 
        // At least one account was found
-       while (list($id, $uid, $points, $ip, $time) = SQL_FETCHROW($result_load)) {
+       while ($content = SQL_FETCHARRAY($result_load)) {
                // Only double when points are enougth!
-               if ($DOUBLER_POINTS >= $points) {
+               if ($DOUBLER_POINTS >= $content['points']) {
                        // Check for his ref points
-                       $ref = GET_TOTAL_DATA($uid, "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) && ($DOUBLER_UID == $uid) && (!empty($ref))) {
+                       if (($ref > 0) && ($GLOBALS['doubler_uid'] == $content['userid']) && (!empty($ref))) {
                                // Referal points found so add them and set line(s) to completed='Y'
-                               $points += $ref;
+                               $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($uid)), __FILE__, __LINE__);
+                                       array(bigintval($content['userid'])), __FILE__, __LINE__);
                        } else {
                                // No referal points found
                                $ref = 0;
                        }
 
                        // Exclude webmaster from doubling...
-                       if ($uid != getConfig('doubler_uid')) {
+                       if ($content['userid'] != getConfig('doubler_uid')) {
                                // Add points
-                               ADD_POINTS_REFSYSTEM(sprintf("doubler_%s", strtolower(getConfig('doubler_send_mode'))), $uid, $points, false, "0", false, "direct");
+                               ADD_POINTS_REFSYSTEM(sprintf("doubler_%s", strtolower(getConfig('doubler_send_mode'))), $content['userid'], $content['points'], false, "0", false, "direct");
                        } // END - if
 
                        // Set entry as "payed"
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_doubler` SET completed='Y' WHERE id=%s LIMIT 1",
-                               array(bigintval($id)), __FILE__, __LINE__);
+                               array(bigintval($content['id'])), __FILE__, __LINE__);
 
                        $okay = false;
                        // Check for jackpot inclusion in doubling process
-                       if (($jackpot > 0) && ($jackpot >= $points) && (getConfig('doubler_jackpot') == "Y")) {
+                       if (($jackpot > 0) && ($jackpot >= $content['points']) && (getConfig('doubler_jackpot') == "Y")) {
                                // Subtract points from jackpot
-                               SUB_JACKPOT($points);
-                               $jackpot -= $points;
+                               SUB_JACKPOT($content['points']);
+                               $jackpot -= $content['points'];
 
                                // Okay, done!
                                $okay = true;
                        } // END - if
 
                        // Exclude also webmaster's ID in taking points from webmaster's account
-                       if (($user > 0) && ($user >= $points) && (!$okay) && (getConfig('doubler_uid') > 0) && ($uid != getConfig('doubler_uid'))) {
+                       if (($user > 0) && ($user >= $content['points']) && (!$okay) && (getConfig('doubler_uid') > 0) && ($content['userid'] != getConfig('doubler_uid'))) {
                                // Add points to used points
-                               SUB_POINTS("doubler_payout", getConfig('doubler_uid'), $points);
+                               SUB_POINTS("doubler_payout", getConfig('doubler_uid'), $content['points']);
 
                                // Okay, done!
                                $okay = true;
@@ -129,28 +129,28 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == "Y"))
                        // Update doubler's account only when others are not updated
                        if (!$okay) {
                                // Add points to used doubler points
-                               UPDATE_CONFIG("doubler_used", $points, "+");
+                               UPDATE_CONFIG("doubler_used", $content['points'], "+");
                        } // END - if
 
                        // Update variables to prevent errors
-                       incrementConfigEntry('doubler_used', $points);
-                       $DOUBLER_POINTS -= $points;
+                       incrementConfigEntry('doubler_used', $content['points']);
+                       $DOUBLER_POINTS -= $content['points'];
 
                        // Prepare array
                        $content = array(
                                // Doubler transmission ID
-                               'id'     => $id,
+                               'id'     => $content['id'],
                                // Doubled points
-                               'points' => TRANSLATE_COMMA($points),
+                               'points' => TRANSLATE_COMMA($content['points']),
                                // Timemark
-                               'when'   => MAKE_DATETIME($time, "2"),
+                               'when'   => MAKE_DATETIME($content['timemark'], "2"),
                                // IP number when the member submitted the doubling form
-                               'ip'     => $ip,
+                               'ip'     => $content['remote_ip'],
                        );
 
                        // Load mail template and send mail away...
-                       $msg = LOAD_EMAIL_TEMPLATE("member_doubler", $content, $uid);
-                       SEND_EMAIL($uid, getMessage('DOUBLER_MEMBER_SUBJECT'), $msg);
+                       $msg = LOAD_EMAIL_TEMPLATE("member_doubler", $content, $content['userid']);
+                       SEND_EMAIL($content['userid'], getMessage('DOUBLER_MEMBER_SUBJECT'), $msg);
                } // END - if
        } // END - while
 } // END - if
index b2bca3e..ae8f152 100644 (file)
@@ -436,7 +436,7 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) {
                $start = array_search($ext_ver, $history);
 
                // And load SQL queries in order of version history
-               for ($idx = ($start + 1); $idx < sizeof($history); $idx++) {
+               for ($idx = ($start + 1); $idx < count($history); $idx++) {
                        // Set extension version
                        $GLOBALS['cache_array']['update_ver'][$ext_name] = $history[$idx];
 
index 16300c1..17a13d0 100644 (file)
@@ -243,7 +243,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha
 
 default: // Do stuff when extension is loaded
        // Create instance on class
-       if ($GLOBALS['cacheMode'] != "init") {
+       if ($GLOBALS['cache_mode'] != "init") {
                // Initialize cache system only when it's needed
                $GLOBALS['cache_instance'] = new CacheSystem(getConfig('cache_update'), "inc/".getConfig('cache_path'), getConfig('cache_tested'));
                if ($GLOBALS['cache_instance']->getStatus() != "done") {
index ab52b74..a1ff991 100644 (file)
@@ -324,7 +324,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha
 
 default: // Do stuff when extension is loaded
        // Do stuff only when not in CSS mode
-       if (($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1") && ($GLOBALS['cacheMode'] != "init")) {
+       if (($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1") && ($GLOBALS['cache_mode'] != "init")) {
                // Get total member count
                $TOTAL = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true);
 
index 1465d60..dcdfdc6 100644 (file)
@@ -38,25 +38,17 @@ if (!defined('__SECURITY')) {
 }
 
 // Check if our config file is writeable or not
-function IS_INC_WRITEABLE($inc) {
+function IS_INC_WRITEABLE ($inc) {
        // Generate FQFN
-       $fqfn = sprintf("%sinc/%s.php", constant('PATH'), $inc);
+       $FQFN = sprintf("%sinc/%s.php", constant('PATH'), $inc);
 
        // Abort by simple test
-       if ((FILE_READABLE($fqfn)) && (!is_writeable($fqfn))) {
+       if ((FILE_READABLE($FQFN)) && (!is_writeable($FQFN))) {
                return false;
        } // END - if
 
-       // Test if we can append data
-       $fp = fopen($fqfn, 'a');
-       if ($inc == "dummy") {
-               // Remove dummy file
-               fclose($fp);
-               return unlink($fqfn);
-       } else {
-               // Close all other files
-               return fclose($fp);
-       }
+       // Test write-access
+       return is_writeable($FQFN);
 }
 
 // Output HTML code directly or "render" it. You addionally switch the new-line character off
@@ -375,7 +367,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
        // Do we have some content to output or return?
        if (!empty($ret)) {
                // Not empty so let's put it out! ;)
-               if ($return) {
+               if ($return === true) {
                        // Return the HTML code
                        return $ret;
                } else {
@@ -540,7 +532,7 @@ function GEN_PASS ($LEN = 0) {
        // Start creating password
        $PASS = "";
        for ($i = 0; $i < $LEN; $i++) {
-               $PASS .= $ABC[mt_rand(0, sizeof($ABC) -1)];
+               $PASS .= $ABC[mt_rand(0, count($ABC) -1)];
        } // END - for
 
        // When the size is below 40 we can also add additional security by scrambling it
@@ -954,7 +946,7 @@ function LOAD_URL ($URL, $addUrlData=true) {
                LOAD_TEMPLATE("redirect_url", false, str_replace("&amp;", "&", $URL));
                LOAD_INC("inc/footer.php");
        }
-       exit();
+       exit;
 }
 
 // Wrapper for LOAD_URL but URL comes from a configuration entry
@@ -1595,11 +1587,6 @@ function SEND_ADMIN_EMAILS_PRO ($subj, $template, $content, $UID) {
        // Load email template
        $msg = LOAD_EMAIL_TEMPLATE($template, $content, $UID);
 
-       if (EXT_VERSION_IS_OLDER("admins", "0.4.0")) {
-               // Older version detected!
-               return SEND_ADMIN_EMAILS($subj, $msg);
-       } // END - if
-
        // Check which admin shall receive this mail
        $result = SQL_QUERY_ESC("SELECT DISTINCT admin_id FROM `{!_MYSQL_PREFIX!}_admins_mails` WHERE mail_template='%s' ORDER BY admin_id",
                array($template), __FUNCTION__, __LINE__);
@@ -1609,9 +1596,10 @@ function SEND_ADMIN_EMAILS_PRO ($subj, $template, $content, $UID) {
                        array($template), __FUNCTION__, __LINE__);
        } else {
                // Load admin IDs...
-               $aids = array();
-               while (list($aid) = SQL_FETCHROW($result)) {
-                       $aids[] = $aid;
+               // @TODO This can be, somehow, rewritten
+               $adminIds = array();
+               while ($content = SQL_FETCHARRAY($result)) {
+                       $adminIds[] = $content['admin_id'];
                } // END - while
 
                // Free memory
@@ -1621,7 +1609,7 @@ function SEND_ADMIN_EMAILS_PRO ($subj, $template, $content, $UID) {
                $result = false;
 
                // "implode" IDs and query string
-               $aid = implode(",", $aids);
+               $aid = implode(",", $adminIds);
                if ($aid == "-1") {
                        if (EXT_IS_ACTIVE("events")) {
                                // Add line to user events
@@ -1636,16 +1624,18 @@ function SEND_ADMIN_EMAILS_PRO ($subj, $template, $content, $UID) {
                        }
                } elseif ($aid == "0") {
                        // Select all email adresses
-                       $result = SQL_QUERY("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `id`", __FUNCTION__, __LINE__);
+                       $result = SQL_QUERY("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `id`",
+                               __FUNCTION__, __LINE__);
                } else {
                        // If Admin-ID is not "to-all" select
-                       $result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` WHERE id IN (%s) ORDER BY `id`", array($aid), __FUNCTION__, __LINE__);
+                       $result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` WHERE id IN (%s) ORDER BY `id`",
+                               array($aid), __FUNCTION__, __LINE__);
                }
        }
 
        // Load email addresses and send away
-       while (list($email) = SQL_FETCHROW($result)) {
-               SEND_EMAIL($email, $subj, $msg);
+       while ($content = SQL_FETCHARRAY($result)) {
+               SEND_EMAIL($content['email'], $subj, $msg);
        } // END - while
 
        // Free memory
@@ -1727,7 +1717,7 @@ function ADD_EMAIL_NAV ($PAGES, $offset, $show_form, $colspan, $return=false) {
        // Load navigation template
        $OUT = LOAD_TEMPLATE("admin_email_nav_row", true);
 
-       if ($return) {
+       if ($return === true) {
                // Return generated HTML-Code
                return $OUT;
        } else {
@@ -1898,7 +1888,7 @@ function SEND_RAW_REQUEST ($host, $request) {
        fputs($fp, $request);
 
        // Read response
-       while(!feof($fp)) {
+       while (!feof($fp)) {
                $response[] = trim(fgets($fp, 1024));
        } // END - while
 
@@ -1941,7 +1931,7 @@ function SEND_RAW_REQUEST ($host, $request) {
 }
 
 // Taken from www.php.net eregi() user comments
-function VALIDATE_EMAIL($email) {
+function VALIDATE_EMAIL ($email) {
        // Compile email
        $email = COMPILE_CODE($email);
 
@@ -2926,12 +2916,12 @@ function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) {
        return false;
 }
 // Send notification to admin
-function SEND_ADMIN_NOTIFICATION($subject, $templateName, $content=array(), $uid="0") {
+function SEND_ADMIN_NOTIFICATION ($subject, $templateName, $content=array(), $uid="0") {
        if (GET_EXT_VERSION("admins") >= "0.4.1") {
                // Send new way
                SEND_ADMIN_EMAILS_PRO($subject, $templateName, $content, $uid);
        } else {
-               // Send outdated way
+               // Send out out-dated way
                $msg = LOAD_EMAIL_TEMPLATE($templateName, $content, $uid);
                SEND_ADMIN_EMAILS($subject, $msg);
        }
@@ -3090,13 +3080,13 @@ function HANDLE_EXTRA_VALUES ($filterFunction, $value, $extraValue) {
 }
 
 // Check if given FQFN is a readable file
-function FILE_READABLE($fqfn) {
+function FILE_READABLE ($FQFN) {
        // Check all...
-       return ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn)));
+       return ((file_exists($FQFN)) && (is_file($FQFN)) && (is_readable($FQFN)));
 }
 
 // Converts timestamp selections into a timestamp
-function CONVERT_SELECTIONS_TO_TIMESTAMP(&$POST, &$DATA, &$id, &$skip) {
+function CONVERT_SELECTIONS_TO_TIMESTAMP (&$POST, &$DATA, &$id, &$skip) {
        // Init test variable
        $test2 = "";
 
index 50f833d..6bec404 100644 (file)
@@ -71,13 +71,13 @@ ORDER BY u.userid ASC", __FILE__, __LINE__);
 // Do we have entries?
 if (SQL_NUMROWS($result_direct) > 0) {
        // When "walk" through all users
-       while (list($uid) = SQL_FETCHROW($result_direct)) {
+       while ($content = SQL_FETCHARRAY($result_direct)) {
                // Init level
                $GLOBALS['cache_array']['back_level'] = 1;
 
                // Update refback table
-               //* DEBUG: */ echo "uid={$uid}<br />\n";
-               UPDATE_REFBACK_TABLE($uid);
+               //* DEBUG: */ echo "uid={$content['userid']}<br />\n";
+               UPDATE_REFBACK_TABLE($content['userid']);
        } // END - while
 } // END - if
 
index 463d470..5250598 100644 (file)
@@ -229,7 +229,7 @@ define('POINTS_REGISTER', "Willkommensgutschrift");
 define('POINTS_REF', "Einmalige Referal-Gutschrift");
 define('EDIT_REGFORM_SETTINGS', "Einstellungen am Anmeldeformular");
 define('LEAST_CATS', "Mindestens auszuw&auml;hlende Kategorieanzahl");
-define('CATS_LEAST', "Bitte w&auml;hlen Sie mehr Kategorien aus! Minimum ist");
+define('CATS_LEAST', "Bitte w&auml;hlen Sie mehr Kategorien aus! Minimum ist: %s");
 define('EMAIL_ALREADY_DB', "Sie haben sich bereits mit dieser Email-Adresse angemeldet, oder jemand anderes verwendet Ihre. Doppelte Anmeldungen sind bei uns verboten.");
 define('REJECT_DOUBLE_EMAIL', "Doppelt angemeldete Email-Adressen ablehnen?");
 define('REJECT_DOUBLE_PASS', "Gleiche Passw&ouml;rter bei der Anmeldung ablehnen? (Wird nicht angezeigt!)");
@@ -759,8 +759,7 @@ define('ADMIN_EXT_ALREADY_INSTALLED_1', "Alle <strong><u>");
 define('ADMIN_EXT_ALREADY_INSTALLED_2', "</u></strong> gefundenen Erweiterungen sind bereits installiert!");
 define('ADMIN_EXT_VERSION', "Version");
 define('ADMIN_EXT_AUTOPURGE_404', "autopurge nicht installiert!");
-define('ADMIN_EXT_BONUS_OUTDATED_1', "Ihre Bonus-Erweiterung ist veraltet! Version <u>");
-define('ADMIN_EXT_BONUS_OUTDATED_2', "</u> oder h&ouml;her wird ben&ouml;tigt!");
+define('ADMIN_EXT_BONUS_OUTDATED', "Ihre Bonus-Erweiterung ist veraltet! Version <u>%s</u> oder h&ouml;her wird ben&ouml;tigt!");
 define('ADMIN_EXT_BONUS_404', "bonus nicht installiert!");
 define('ADMIN_EXT_CSSFILE', "CSS?");
 define('ADMIN_EXT_CHANGED', "Erweiterungen ge&auml;ndert.");
index 370b414..2dd1146 100644 (file)
@@ -233,7 +233,7 @@ define('POINTS_REGISTER', "Wecome credit");
 define('POINTS_REF', "Single referal credit");
 define('EDIT_REGFORM_SETTINGS', "Settings for registration form");
 define('LEAST_CATS', "Minium to select categories");
-define('CATS_LEAST', "Please select more categories! Minimum is");
+define('CATS_LEAST', "Please select more categories! Minimum is: %s");
 define('EMAIL_ALREADY_DB', "You are already registered with your entered email address or someone else is using your email address. Registering twice is not allowed in our service.");
 define('REJECT_DOUBLE_EMAIL', "Prevent of registering with same email address?");
 define('REJECT_DOUBLE_PASS', "Prevent of registering with same password? (Will not be displayed!)");
index cad193a..05a58c6 100644 (file)
@@ -82,7 +82,7 @@ define('HOLIDAY_MEMBER_UNLOCK_SUBJ', "[HINWEIS:] Beendigung Ihres Urlaubes");
 define('HOLIDAY_ADMIN_UNLOCK_SUBJ', "Automatische Urlaubsbeendigung");
 define('HOLIDAY_ADMIN_DEAC_SUBJ', "Deaktivierung einer Urlaubsschaltung");
 define('HOLIDAY_ADMIN_REMOVED_SUBJ', "[HINWEIS:] Ihr Urlaub wurde beendet");
-define('HOLIDAY_MEMBER_ACTIVATED', "[HINWEIS:] Ihre Urlaubsschaltung ist aktiviert");
+define('HOLIDAY_MEMBER_ACTIVATED_SUBJ', "[HINWEIS:] Ihre Urlaubsschaltung ist aktiviert");
 
 //
 ?>
index 0d38bec..69b771b 100644 (file)
@@ -96,12 +96,13 @@ define('RALLYE_START_NOTIFY_NOW', "Mitglieder autom. benachrichtigen");
 define('RALLYE_EDIT_ONLY_INACTIVE_NOTE', "Es k&ouml;nnen nur deaktivierte Rallyes bearbeitet bzw. gel&ouml;scht werden. Beim L&ouml;schen werden alle dazu verkn&uuml;pften Daten ebenfalls ohne Vorwarnung gel&ouml;scht.");
 define('RALLYE_DELETE_NOTHING_SELECTED', "Keine Rallye(s) zum L&ouml;schen ausgew&auml;hlt!");
 define('RALLYE_DELETED', "Rallye(s) wurde(n) gel&ouml;scht.");
-define('RALLYE_MEMBER_NO_PRICES', "--> Keine Preise ausgesetzt! <--");
+define('RALLYE_MEMBER_NO_PRICES', "--> Keine Preise  f&uuml;r Modus %s ausgesetzt! <--");
 define('RALLYE_MEMBER_PRICES_ADDED', "Die Preise");
 define('RALLYE_PRICE', ". Platz");
-define('RALLYE_MEMBER_NOTIFY', "REF-RALLYE GESTARTET: ");
-define('RALLYE_ADMIN_NOTIFY', "Neue Ref-Rallye: ");
+define('RALLYE_MEMBER_NOTIFY', "REF-RALLYE GESTARTET: %s");
+define('RALLYE_ADMIN_NOTIFY', "Neue Ref-Rallye: %s");
 define('RALLYE_ADMIN_USERS_404', "Zur ausgew&auml;hlten Rallye sind noch keine Mitglieder hinzugef&uuml;gt worden!");
+// @TODO Rewrite following two lines to one
 define('RALLYE_LIST_USERS_1', "Teilnehmende Mitglieder an der Rallye <u>");
 define('RALLYE_LIST_USERS_2', "</u>");
 define('RALLYE_OLD_REFS', "Refs vor Rallye");
@@ -113,12 +114,13 @@ define('_RALLYE_PRICE', "Platz");
 define('RALLYE_EXPIRE_ONE_DAY', "Rallye endet in weniger als 24 Stunden!");
 define('RALLYE_HAS_EXPIRED', "Diese Rallye ist beendet.");
 define('RALLYE_ADMIN_EXPIRED', "Rallye beendet");
-define('RALLYE_MEMBER_EXPIRED', "REF-RALLYE BEENDET");
+define('RALLYE_ADMIN_EXPIRED_SUBJ', "Rallye beendet: %s");
+define('RALLYE_MEMBER_EXPIRED_SUBJ', "REF-RALLYE BEENDET: %s. Platz");
 define('RALLYE_YOU_CAN_WIN', "Was Sie gewinnen k&ouml;nnen");
 define('RALLYE_OUR_WINNERS_ARE', "Unsere Gewinner sind dieses Mal");
 define('RALLYE_PRICE_IS', "Hat gewonnen");
 define('RALLYE_HAPPY_WINNERS', "Wir gratulieren allen Gewinnern!");
-define('RALLYE_ADMIN_PURGED', "Rallye entfernt");
+define('RALLYE_ADMIN_PURGED_SUBJ', "[HINWEIS:] Rallye '%s' entfernt");
 define('RALLYE_ADMIN_EXPIRED_TEXT', "Eine Referal-Rallye ist beendet worden. Bitte kontrollieren Sie diese und f&uuml;hren Sie ggf. weitere Schritte durch!");
 define('RALLYE_ADMIN_PURGED_TEXT', "Eine oder mehr Referal-Rallye(s) ist/sind gel&ouml;scht worden.");
 define('RALLYE_EDIT_RALLYES', "Rallye-Grunddaten &auml;ndern");
@@ -129,7 +131,7 @@ define('RALLYE_REGISTER_NOW', "Jetzt kostenlos und unverbindlich anmelden!");
 define('RALLYE_GET_REFLINK', "Jetzt dran teilnehmen!");
 define('ADMIN_TASK_IS_RALLYE_EXPIRED', "Rallye wurde beendet");
 define('ADMIN_TASK_IS_RALLYE_PURGED', "Rallye wurde gel&ouml;scht");
-define('RALLYE_LIST_USERS', "Alle teilnehmenden Mitglieder auflisten.");
+define('RALLYE_LIST_USERS_TITLE', "Alle teilnehmenden Mitglieder auflisten.");
 define('RALLYE_REF_POINTS_NOTE', "Die {!POINTS!} in der Spalte <u>Verdienst durch Refs</u> geben den Verdienst in erster Ebene vor der Rallye an und wird sich bis Ende der Rallye nicht ver&auml;ndern.");
 define('RALLYE_MIN_USERS', "Gesamtzahl der Mitglieder, ab der Rallye automatisch endet.");
 define('RALLYE_MIN_PRICES', "Mindestens zu belegende Pl&auml;tze");
@@ -137,10 +139,8 @@ define('RALLYE_MIN_USERS_MINI', "Mitgliederanzahl erreicht");
 define('RALLYE_MIN_PRICES_MINI', "Minimum Pl&auml;tze");
 define('RALLYE_END_NO_USER_LIMITATION', "Die Rallye endet ohne Mitgliederbegrenzung.");
 define('RALLYE_END_NO_PRICE_LIMITATION', "Die Rallye endet ohne Platzbelegungsbegrenzung.");
-define('RALLYE_END_USERS_1', "Die Rallye endet, sobald wir");
-define('RALLYE_END_USERS_2', "Mitglieder in unserem {!MT_WORD!} haben!");
-define('RALLYE_END_PRICES_1', "Die Rallye endet, sobald mindestens");
-define('RALLYE_END_PRICES_2', "Plaetze belegt sind!");
+define('RALLYE_END_USERS', "Die Rallye endet, sobald wir <u>%s</u> Mitglieder in unserem {!MT_WORD!} haben!");
+define('RALLYE_END_PRICES', "Die Rallye endet, sobald mindestens <u>%s</u> Plaetze belegt sind!");
 define('RALLYE_LIMITATIONS', "Einschr&auml;nkungen an der Dauer der Rallye");
 define('RALLYE_REMOVE_PRICES', "Rallye-Preis(e) entfernen");
 define('RALLYE_NO_TEMPLATES_FOUND', "Keine Templates gefunden!");
index 0dac5d6..fd789e0 100644 (file)
@@ -116,6 +116,7 @@ define('ADMIN_TEXT_DEL_SPONSOR_1', "M&ouml;chten Sie den Sponsoren <strong>");
 define('ADMIN_TEXT_DEL_SPONSOR_2', "</strong> mit samt aller seiner Bestellungen unwiederruflich l&ouml;schen?");
 define('ADMIN_SPONSOR_DELETED', "Sponsorenaccount <u>%s</u> entfernt.");
 define('GUEST_SPONSOR_TITLE', "Anmeldung als Sponsor");
+// @TODO These three constants should be moved into a template
 define('GUEST_SPONSOR_TEASER_1', "Melden Sie sich als Sponsor von <strong>{!MAIN_TITLE!}</strong> an! Hier bekommen Sie f&uuml;r Ihr Geld die Zielgruppe, die Sie auch auf Ihren Produktseiten haben wollen!");
 define('GUEST_SPONSOR_TEASER_2', "Alles inklusiv: Ausf&uuml;hrliche Statistiken (auch per Mail im gew&uuml;nschten Zeitabstand) und einfache Verwaltung Ihrer {!POINTS!} mit nur wenigen Klicks!");
 define('GUEST_SPONSOR_TEASER_3', "Werden Sie Sponsor und melden Sie sich noch heute an!");
@@ -150,10 +151,8 @@ define('SPONSOR_PAYTYPE_NAME_NOTE', "Geben Sie eine passende Bezeichnung zum Buc
 define('SPONSOR_PAYTYPE_RATE_NOTE', "Wie viele {!POINTS!} soll der Sponsor f&uuml;r z.B. 1 &euro; bekommen?");
 define('SPONSOR_PAYTYPE_MIN_COUNT_NOTE', "Und wie oft soll dieses Buchungspaket <strong>mindestens</strong> eingekauft werden? (meistens einmal)");
 define('SPONSOR_PAYTYPE_CURRENCY_NOTE', "W&auml;hrung des Geldbetrages, die der Sponsor an Sie &uuml;berweisen soll.");
-define('ADMIN_SPONSOR_PAYTYPE_ALREADY_1', "Buchungspaket <u>");
-define('ADMIN_SPONSOR_PAYTYPE_ALREADY_2', "</u> bereits eingerichtet.");
-define('ADMIN_SPONSOR_PAYTYPE_ADDED_1', "Buchungspaket <u>");
-define('ADMIN_SPONSOR_PAYTYPE_ADDED_2', "</u> hinzugef&uuml;gt.");
+define('ADMIN_SPONSOR_PAYTYPE_ALREADY', "Buchungspaket <u>%s</u> bereits eingerichtet.");
+define('ADMIN_SPONSOR_PAYTYPE_ADDED', "Buchungspaket <u>%s</u> hinzugef&uuml;gt.");
 define('SPONSOR_LIST_PAYMENT_TYPES_TITLE', "Buchungspakete auflisten, bearbeiten und l&ouml;schen");
 define('SPONSOR_PAYTYPE_MIN_COUNT2', "Minium");
 define('ADMIN_SPONSOR_PAYTYPE_EDIT', "Bearbeiten");
@@ -283,8 +282,7 @@ define('SPONSOR_ACCOUNT_IS_CONFIRMED_AGAIN', "Ihr Sponsorenaccount ist wieder fr
 // Sponsor area
 define('SPONSOR_NO_MAIN_MENUS_ACTIVE', "Keine Hauptmen&uuml;s aktiviert!");
 define('SPONSOR_NO_SUB_MENUS_ACTIVE', "Keine Untermen&uuml;s aktiviert!");
-define('SPONSOR_CONTENT_404_1', "Konnte das Sponsor-Modul <u>");
-define('SPONSOR_CONTENT_404_2', "</u> auf dem Server nicht finden!");
+define('SPONSOR_CONTENT_404', "Konnte das Sponsor-Modul <u>%s</u> auf dem Server nicht finden!");
 define('SPONSOR_WELCOME_TO', "Willkommen zum Sponsorenbereich!");
 define('SPONSOR_PASSWORD_NOTE', "Wollen Sie nur Ihre Daten, aber nicht das Passwort &auml;ndern, geben Sie Ihr aktuelles Passwort unter &quot;{--SPONSOR_ENTER_OLD_PASSWORD--}&quot; ein. Wollen Sie Ihr Passwort &auml;ndern, geben Sie Ihr derzeiges und zweimal das neue Passwort ein.");
 define('SPONSOR_POINTS_OVERVIEW', "Ihre {!POINTS!}-&Uuml;bersicht");
index 6b6e035..291df01 100644 (file)
@@ -259,7 +259,7 @@ function ADMINS_EDIT_ADMIN_ACCOUNTS ($POST) {
        $currMode = GET_ADMIN_DEFAULT_ACL(GET_CURRENT_ADMIN_ID());
 
        // Begin the edit loop
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        foreach ($POST['sel'] as $id => $selected) {
                // Secure ID number
                $id = bigintval($id);
@@ -305,7 +305,7 @@ function ADMINS_DELETE_ADMIN_ACCOUNTS ($POST) {
        SQL_FREERESULT($result_main);
        if ($accounts > 1) {
                // Delete accounts
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
                foreach ($POST['sel'] as $id => $selected) {
                        // Secure ID number
                        $id = bigintval($id);
@@ -371,7 +371,7 @@ function ADMINS_REMOVE_ADMIN_ACCOUNTS ($POST) {
 function ADMINS_LIST_ADMIN_ACCOUNTS() {
        // 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__);
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        while ($content = SQL_FETCHARRAY($result)) {
                // Compile some variables
                $content['mode'] = constant('ADMINS_'.strtoupper($content['mode']).'_MODE');
index 6679aa5..8a17b66 100644 (file)
@@ -113,7 +113,7 @@ function BONUS_MAKE_RANK_ROWS ($data, $type, $uid) {
        $self = false; $OUT = "";
 
        // How many ranks do we have?
-       $ranks = sizeof(explode(";", getConfig('turbo_rates'))) + 1;
+       $ranks = count(explode(";", getConfig('turbo_rates'))) + 1;
 
        // Load current user's data
        $result = SQL_QUERY_ESC("SELECT level, points, timemark FROM `{!_MYSQL_PREFIX!}_bonus_turbo` WHERE %s=%s AND userid=%s LIMIT 1",
index 0172083..d61ef96 100644 (file)
@@ -74,19 +74,20 @@ LIMIT ".$limit, __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // List entries
                $OUT = ""; $SW = 2;
-               while (list($uid, $rid, $points, $time) = SQL_FETCHROW($result)) {
+               while ($content = SQL_FETCHARRAY($result)) {
+                       // Rewrite userid/refid only if admin is in
                        if (IS_ADMIN()) {
                                // Set links to admin area
-                               if ($uid > 0) { $uid = ADMIN_USER_PROFILE_LINK($uid); } else { $uid = "---"; }
-                               if ($rid > 0) { $rid = ADMIN_USER_PROFILE_LINK($rid); } else { $rid = "---"; }
-                       }
+                               if ($content['userid'] > 0) { $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']); } else { $content['userid'] = "---"; }
+                               if ($content['refid'] > 0)  { $content['refid']  = ADMIN_USER_PROFILE_LINK($content['refid']);  } else { $content['refid']  = "---"; }
+                       } // END - if
 
                        // Prepare data for the row template
                        $content = array(
-                               'uid'    => $uid,
-                               'rid'    => $rid,
-                               'points' => TRANSLATE_COMMA($points),
-                               'stamp'  => MAKE_DATETIME($time, $DT_MODE),
+                               'uid'    => $content['userid'],
+                               'rid'    => $content['refid'],
+                               'points' => TRANSLATE_COMMA($content['points']),
+                               'stamp'  => MAKE_DATETIME($content['timemark'], $DT_MODE),
                                'sw'     => $SW,
                        );
 
index 0f19fee..a706bc1 100644 (file)
@@ -47,34 +47,41 @@ ORDER BY userid", __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result_stop) > 0) {
                // We foud at least one
                $admin = "";
-               while (list($uid, $start, $end, $comments) = SQL_FETCHROW($result_stop)) {
+               // Init SQLs
+               INIT_SQLS();
+
+               // Process all found entries
+               while ($content = SQL_FETCHARRAY($result_stop)) {
                        // Stop holiday
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_holidays` WHERE userid=%s LIMIT 1",
-                               array(bigintval($uid)), __FUNCTION__, __LINE__);
+                       ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_holidays` WHERE userid=%s LIMIT 1",
+                               array(bigintval($content['userid'])), __FUNCTION__, __LINE__, false));
 
                        // Unlock account
-                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
+                       ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
 SET holiday_active='N', holiday_activated='0'
-WHERE userid=%s LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__);
+WHERE userid=%s LIMIT 1", array(bigintval($content['userid'])), __FUNCTION__, __LINE__, false));
 
                        // Prepare array
                        $content = array(
-                               'holiday_end'      => MAKE_DATETIME($end  , "3"),
-                               'holiday_start'    => MAKE_DATETIME($start, "3"),
-                               'holiday_comments' => $comments
+                               'holiday_end'      => MAKE_DATETIME($content['holiday_end']  , "3"),
+                               'holiday_start'    => MAKE_DATETIME($content['holiday_start'], "3"),
+                               'holiday_comments' => $content['comments']
                        );
 
                        // Send mail to user
-                       $msg = LOAD_EMAIL_TEMPLATE("member_holiday_unlock", $content, $uid);
-                       SEND_EMAIL($uid, HOLIDAY_MEMBER_UNLOCK_SUBJ, $msg);
+                       $msg = LOAD_EMAIL_TEMPLATE("member_holiday_unlock", $content, $content['userid']);
+                       SEND_EMAIL($content['userid'], getMessage('HOLIDAY_MEMBER_UNLOCK_SUBJ'), $msg);
 
                        // Remember userid for admin
-                       $admin .= $uid."\n";
-               }
+                       $admin .= $content['userid']."\n";
+               } // END - if
 
                // Send mail to admins
-               SEND_ADMIN_NOTIFICATION(HOLIDAY_ADMIN_UNLOCK_SUBJ, "admin_holiday_unlock", $admin, "0");
-       }
+               SEND_ADMIN_NOTIFICATION(getMessage('HOLIDAY_ADMIN_UNLOCK_SUBJ'), "admin_holiday_unlock", $admin, "0");
+
+               // Run all SQLs
+               runFilterChain('run_sqls');
+       } // END - if
 
        // Free memory
        SQL_FREERESULT($result_stop);
index 9ab7329..df8b39e 100644 (file)
@@ -40,7 +40,9 @@ if (!defined('__SECURITY')) {
 //
 function PAYOUT_OUTPUT_PAYOUT_LIST ($points) {
        // Replace german decimal comma with CPU's decimal dot
-       $points = strval(REVERT_COMMA($points));
+       $points = REVERT_COMMA($points);
+
+       // Enougth points?
        if ($points > 0) {
                // Pay this out!
                $result = SQL_QUERY_ESC("SELECT id, type, rate, min_points
@@ -52,14 +54,17 @@ ORDER BY type", array($points), __FUNCTION__, __LINE__);
 <div align=\"center\"><strong>{--PAYOUT_NOW--}:</strong></div><br />
 <ul>");
                        // Now let's check
-                       while (list($id, $type, $rate, $mpoi) = SQL_FETCHROW($result)) {
-                               $type = COMPILE_CODE($type);
-                               if ($points >= $mpoi) {
+                       while ($content = SQL_FETCHARRAY($result)) {
+                               // Compile the type
+                               $content['type'] = COMPILE_CODE($content['type']);
+
+                               // Are these points enougth?
+                               if ($points >= $content['min_points']) {
                                        // Ok we found one
-                                       $P = $points * $rate - 0.5;
-                                       OUTPUT_HTML("<li>{--PAYOUT_IN--}: <strong><a href=\"{!URL!}/modules.php?module=login&amp;what=payout&amp;payout=".$id."\">".$type." ({--PAYOUT_MAX--} ".round($P)." ".$type.")</a></strong></li>");
-                               }
-                       }
+                                       $P = $points * $content['rate'] - 0.5;
+                                       OUTPUT_HTML("<li>{--PAYOUT_IN--}: <strong><a href=\"{!URL!}/modules.php?module=login&amp;what=payout&amp;payout=".$content['id']."\">".$content['type']." ({--PAYOUT_MAX--} ".round($P)." ".$content['type'].")</a></strong></li>");
+                               } // END - if
+                       } // END - while
 
                        OUTPUT_HTML("</ul></div>");
                } else {
index 039f36d..eaf6323 100644 (file)
@@ -63,36 +63,24 @@ function RALLYE_AUTOSTART_RALLYES($result)
        $DATA['title']      = $title;
        $DATA['id']         = $id;  // ID for the rallye details link
 
-       if ($min_users == 0) {
-               // Rallye ends without user limitation
-               $DATA['min_users'] = getMessage('RALLYE_END_NO_USER_LIMITATION');
-       } else {
-               // Rallye ends when X members are totally in your exchange
-               $DATA['min_users'] = RALLYE_END_USERS_1." ".$min_users." ".RALLYE_END_USERS_2;
-       }
-
-       if ($min_prices == 0) {
-               // Rallye ends without user limitation
-               $DATA['min_prices'] = getMessage('RALLYE_END_NO_PRICE_LIMITATION');
-       } else {
-               // Rallye ends when X members are totally in your exchange
-               $DATA['min_prices'] = RALLYE_END_PRICES_1." ".$min_prices." ".RALLYE_END_PRICES_2;
-       }
+       // Determine min_users and min_prices
+       $DATA['min_users']  = RALLYE_DETERMINE_MIN_USERS($min_users);
+       $DATA['min_prices'] = RALLYE_DETERMINE_MIN_PRICES($min_prices);
 
        // Load prices
        $prices = RALLYE_ADD_PRICES($id);
 
        // Let's begin with the userids...
-       while (list($uid) = SQL_FETCHROW($result_user)) {
+       while ($content = SQL_FETCHARRAY($result_user)) {
                $un = false;
 
                // Get refs by userid
-               $cnt = RALLYE_GET_REFCOUNT($uid);
+               $cnt = RALLYE_GET_REFCOUNT($content['userid']);
                if (empty($cnt)) $cnt = 0; // Added prevent some unknown troubles... :-?
 
                // Check if line is already included...
                $result_ref = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s AND userid=%s LIMIT 1",
-                       array(bigintval($id), bigintval($uid)), __FUNCTION__, __LINE__);
+                       array(bigintval($id), bigintval($content['userid'])), __FUNCTION__, __LINE__);
                if (SQL_NUMROWS($result_ref) == 0) {
                        // Free memory
                        SQL_FREERESULT($result_ref);
@@ -103,7 +91,7 @@ FROM `{!_MYSQL_PREFIX!}_user_points` AS p
 LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
 ON p.userid=d.userid
 WHERE d.`status`='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth=1 AND p.points > 0 AND d.userid=%s",
array(getConfig('ref_payout'), bigintval($uid)), __FUNCTION__, __LINE__);
                              array(getConfig('ref_payout'), bigintval($content['userid'])), __FUNCTION__, __LINE__);
                        list($cpoints) = SQL_FETCHROW($result_ref);
                        SQL_FREERESULT($result_ref);
 
@@ -112,7 +100,7 @@ WHERE d.`status`='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND
                        // Add info line
                        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_rallye_users` (rallye_id, userid, refs, curr_points)
 VALUES ('%s','%s','%s','%s')",
-                               array(bigintval($id), bigintval($uid), bigintval($cnt), $cpoints), __FUNCTION__, __LINE__);
+                               array(bigintval($id), bigintval($content['userid']), bigintval($cnt), $cpoints), __FUNCTION__, __LINE__);
                        $un = true;
                } // END - if
 
@@ -122,8 +110,8 @@ VALUES ('%s','%s','%s','%s')",
                // Shall I notify this member?
                if (($notify == "Y") && ($un)) {
                        // Load email template and send it to the user
-                       $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $uid);
-                       SEND_EMAIL($uid, RALLYE_MEMBER_NOTIFY.$title, $msg);
+                       $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $content['userid']);
+                       SEND_EMAIL($content['userid'], sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $msg);
                } // END - if
        } // END - while
 
@@ -132,14 +120,13 @@ VALUES ('%s','%s','%s','%s')",
        if ($notify == "Y") $templ = "admin_rallye_notify";
 
        // Send email to admin
-       SEND_ADMIN_NOTIFICATION(RALLYE_ADMIN_NOTIFY.$title, $templ, $prices, "0");
+       SEND_ADMIN_NOTIFICATION(sprintf(getMessage('RALLYE_ADMIN_NOTIFY'), $title), $templ, $prices, "0");
 
        // Free memory
        SQL_FREERESULT($result_user);
 }
 //
-function RALLYE_ADD_PRICES($rallye,$mode="email")
-{
+function RALLYE_ADD_PRICES ($rallye, $mode="email") {
        // Output mode
        switch($mode) {
                case "email": $mode = "\n";     break;
@@ -148,45 +135,39 @@ function RALLYE_ADD_PRICES($rallye,$mode="email")
 
        // Load prices
        $result_prices = SQL_QUERY("SELECT price_level, points, info FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id='".$rallye."' ORDER BY price_level", __FUNCTION__, __LINE__);
-       if (SQL_NUMROWS($result_prices) > 0)
-       {
+       if (SQL_NUMROWS($result_prices) > 0) {
                // Load prices
-               if ($mode == "\n") $prices = RALLYE_MEMBER_PRICES_ADDED.":".$mode."------------------------------".$mode;
+               if ($mode == "\n") $prices = "{--RALLYE_MEMBER_PRICES_ADDED--}:".$mode."------------------------------".$mode;
                $prices = "";
-               while (list($level, $points, $info) = SQL_FETCHROW($result_prices))
-               {
-                       $prices .= $level.RALLYE_PRICE.": ";
-                       if (!empty($info))
-                       {
-                               $prices .= $info;
-                       }
-                        else
-                       {
-                               $prices .= $points." ".POINTS;
+               while ($content = SQL_FETCHARRAY($result_prices)) {
+                       $prices .= $content['price_level'].getMessage('RALLYE_PRICE').": ";
+                       if (!empty($content['info'])) {
+                               $prices .= $content['info'];
+                       } else {
+                               $prices .= $content['points']." {!POINTS!}";
                        }
                        $prices .= "".$mode;
-               }
+               } // END - if
 
                // Free memory
                SQL_FREERESULT($result_prices);
-       }
-        else
-       {
+       } else {
                // No prices???
-               $prices = RALLYE_MEMBER_NO_PRICES.$mode;
+               $prices = sprintf(getMessage('RALLYE_MEMBER_NO_PRICES'), $mode);
        }
+
        // Add last line for email mode
        if ($mode == "\n") $prices .= "------------------------------";
 
        // Return price list
        return $prices;
 }
+
 //
-function RALLYE_ADD_TOPUSERS($rallye,$default=0)
-{
+function RALLYE_ADD_TOPUSERS ($rallye, $default=0) {
        // First check how many prices are set
        $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s ORDER BY price_level",
-        array(bigintval($rallye)), __FUNCTION__, __LINE__);
+               array(bigintval($rallye)), __FUNCTION__, __LINE__);
        $prices = SQL_NUMROWS($result);
        SQL_FREERESULT($result);
 
@@ -195,7 +176,7 @@ function RALLYE_ADD_TOPUSERS($rallye,$default=0)
 LEFT JOIN `{!_MYSQL_PREFIX!}_refsystem` AS r
 ON u.userid=r.userid
 WHERE u.rallye_id=%s AND r.counter > 0 ORDER BY u.refs DESC",
- array(bigintval($rallye)), __FUNCTION__, __LINE__);
              array(bigintval($rallye)), __FUNCTION__, __LINE__);
 
        // Load users
        $DATA = array(
@@ -204,17 +185,16 @@ WHERE u.rallye_id=%s AND r.counter > 0 ORDER BY u.refs DESC",
                'cpoints'  => array()
        );
 
-       while (list($uid, $refs, $cpoints) = SQL_FETCHROW($result))
-       {
+       while ($content = SQL_FETCHARRAY($result)) {
                // Get current refs
-               $cnt = RALLYE_GET_REFCOUNT($uid, $refs);
+               $cnt = RALLYE_GET_REFCOUNT($content['userid'], $content['refs']);
 
                // Points of ref's
                $result_ref = SQL_QUERY_ESC("SELECT DISTINCT p.points FROM `{!_MYSQL_PREFIX!}_user_points` AS p
 LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
 ON p.userid=d.userid
 WHERE d.userid=%s AND d.`status`='CONFIRMED' AND p.ref_depth=1 AND d.max_mails > 0 AND d.mails_confirmed >= %s
-LIMIT 1", array(bigintval($uid), getConfig('ref_payout')), __FUNCTION__, __LINE__);
+LIMIT 1", array(bigintval($content['userid']), getConfig('ref_payout')), __FUNCTION__, __LINE__);
                list($refpoints) = SQL_FETCHROW($result_ref);
                SQL_FREERESULT($result_ref);
 
@@ -223,13 +203,13 @@ LIMIT 1", array(bigintval($uid), getConfig('ref_payout')), __FUNCTION__, __LINE_
                // Init userid for list
                $_uid = "---";
                // List only users with at least one ref!
-               //* DEBUG: */ echo "*".$cnt."/".$uid."/".$cpoints."/".$refpoints."*<br />\n";
-               if (($cnt > 0) && ($refpoints > $cpoints)) { $_uid = $uid; } else { $cnt = ""; }
+               //* DEBUG: */ echo "*".$cnt."/".$content['userid']."/".$content['curr_points']."/".$refpoints."*<br />\n";
+               if (($cnt > 0) && ($refpoints > $content['curr_points'])) { $_uid = $content['userid']; } else { $cnt = ""; }
 
                // Save values to array
                $DATA['uid'][]     = $_uid;
                $DATA['ref'][]     = $cnt;
-               $DATA['cpoints'][] = $cpoints;
+               $DATA['cpoints'][] = $content['curr_points'];
        }
 
        // Free memory
@@ -268,8 +248,7 @@ LIMIT 1", array(bigintval($uid), getConfig('ref_payout')), __FUNCTION__, __LINE_
        return $OUT;
 }
 // Run this function only when a new member has confirmed his email address!
-function RALLYE_AUTOADD_USER($uid)
-{
+function RALLYE_AUTOADD_USER ($uid) {
        global $DATA;
        $ADD = "";
 
@@ -321,25 +300,13 @@ VALUES ('%s','%s','0')",
                        // Load prices
                        $prices = RALLYE_ADD_PRICES($id);
 
-                       if ($min_users == 0) {
-                               // Rallye ends without user limitation
-                               $DATA['min_users'] = RALLYE_END_NO_USER_LIMITATION;
-                       } else {
-                               // Rallye ends when X members are totally in your exchange
-                               $DATA['min_users'] = RALLYE_END_USERS_1." ".$min_users." ".RALLYE_END_USERS_2;
-                       }
-
-                       if ($min_prices == 0) {
-                               // Rallye ends without user limitation
-                               $DATA['min_prices'] = RALLYE_END_NO_PRICE_LIMITATION;
-                       } else {
-                               // Rallye ends when X members are totally in your exchange
-                               $DATA['min_prices'] = RALLYE_END_PRICES_1." ".$min_prices." ".RALLYE_END_PRICES_2;
-                       }
+                       // Determine min_users/prices tring
+                       $DATA['min_users']  = RALLYE_DETERMINE_MIN_USERS($min_users);
+                       $DATA['min_prices'] = RALLYE_DETERMINE_MIN_PRICES($min_prices);
 
                        // Send notification to member
                        $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $uid);
-                       SEND_EMAIL($uid, RALLYE_MEMBER_NOTIFY.$title, $msg);
+                       SEND_EMAIL($uid, sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $msg);
                } // END - if
        } // END - if
 }
@@ -431,7 +398,7 @@ LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__);
                                        $DATA['infos'] = $DATA['info'];
                                } else {
                                        // Take points
-                                       $DATA['infos'] = $DATA['points']." ".POINTS;
+                                       $DATA['infos'] = $DATA['points']." {!POINTS!}";
                                }
 
                                // Add suffix to template name
@@ -439,7 +406,7 @@ LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__);
 
                                // Load template
                                $msg = LOAD_EMAIL_TEMPLATE($template, $DATA, $uid);
-                               SEND_EMAIL($uid, RALLYE_MEMBER_EXPIRED.": ".$DATA['level']." "._RALLYE_PRICE, $msg);
+                               SEND_EMAIL($uid, sprintf(getMessage('RALLYE_MEMBER_EXPIRED_SUBJ'), $DATA['level']), $msg);
                        } // END - if
 
                        // Count userid
@@ -458,36 +425,44 @@ LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__);
        }
 
        // Send mail to admin
-       SEND_ADMIN_NOTIFICATION(RALLYE_ADMIN_EXPIRED.": ".$title, $templ, $cnt, 0);
+       SEND_ADMIN_NOTIFICATION(sprintf(getMessage('RALLYE_ADMIN_EXPIRED_SUBJ'), $title), $templ, $cnt, 0);
 
        // Add task
        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (status, task_type, subject, text, task_created)
-VALUES ('NEW','RALLYE_EXPIRED','".RALLYE_ADMIN_EXPIRED.": %s','".RALLYE_ADMIN_EXPIRED_TEXT."',UNIX_TIMESTAMP())",
- array($title), __FUNCTION__, __LINE__);
+VALUES ('NEW','RALLYE_EXPIRED','{--RALLYE_ADMIN_EXPIRED--}: %s','{--RALLYE_ADMIN_EXPIRED_TEXT--}',UNIX_TIMESTAMP())",
              array($title), __FUNCTION__, __LINE__);
 
        // All work done here...
 }
+
 //
-function RALLYE_LOAD_USER_DATA($uids_array)
-{
+function RALLYE_LOAD_USER_DATA ($uids_array) {
        // Implode user ids
        $uid_string = implode(",", $uids_array['uid']);
 
+       // Init result string
+       $ret = "";
+
        // Load users
        $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid IN(%s) AND `status`='CONFIRMED' ORDER BY userid LIMIT %s",
-        array($uid_string, count($uids_array)), __FUNCTION__, __LINE__);
-       $ret = "";
-       while (list($u, $gender, $surname, $family, $email) = SQL_FETCHROW($result))
-       {
-               $ret .= TRANSLATE_GENDER($gender)." ".$surname." ".$family." (".$email.") - ".$uids_array['poi'][$u]."\n";
-       }
+               array($uid_string, count($uids_array)), __FUNCTION__, __LINE__);
+       while ($content = SQL_FETCHARRAY($result)) {
+               // Construct the message masked and add it
+               $ret .= sprintf("%s %s %s (%s) - %s\n",
+                       TRANSLATE_GENDER($content['gender']),
+                       $content['surname'],
+                       $content['family'],
+                       $content['email'],
+                       $uids_array['poi'][$content['userid']]
+               );
+       } // END - while
 
        // Return result
        return substr($ret, 0, -1);
 }
+
 //
-function RALLYE_LOAD_PRICES_ARRAY($rallye)
-{
+function RALLYE_LOAD_PRICES_ARRAY ($rallye) {
        // Init multi array
        $prices = array(
                'level'  => array(),
@@ -497,13 +472,14 @@ function RALLYE_LOAD_PRICES_ARRAY($rallye)
 
        // Load prices
        $result = SQL_QUERY_ESC("SELECT price_level, points, info FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s ORDER BY price_level",
-        array(bigintval($rallye)), __FUNCTION__, __LINE__);
-       while (list($level, $points, $info) = SQL_FETCHROW($result))
-       {
-               $prices['level'][]  = $level;
-               $prices['points'][] = $points;
-               $prices['info'][]   = $info;
-       }
+               array(bigintval($rallye)), __FUNCTION__, __LINE__);
+
+       // Transfer elements
+       while ($content = SQL_FETCHARRAY($result)) {
+               $prices['level'][]  = $content['price_level'];
+               $prices['points'][] = $content['points'];
+               $prices['info'][]   = $content['info'];
+       } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
@@ -527,9 +503,9 @@ function RALLYE_LOAD_USERS_ARRAY ($rallye) {
        // Load users                          uid    old  points earned
        $result_user = SQL_QUERY_ESC("SELECT userid, refs, curr_points FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s ORDER BY userid",
                array(bigintval($rallye)), __FUNCTION__, __LINE__);
-       while (list($uid, $refs, $cpoints) = SQL_FETCHROW($result_user)) {
+       while ($content = SQL_FETCHARRAY($result_user)) {
                // Load current ref count
-               $cnt = RALLYE_GET_REFCOUNT($uid, $refs);
+               $cnt = RALLYE_GET_REFCOUNT($content['userid'], $content['refs']);
 
                // Points of ref's
                $result_ref = SQL_QUERY_ESC("SELECT DISTINCT SUM(p.points)
@@ -537,16 +513,17 @@ FROM `{!_MYSQL_PREFIX!}_user_points` AS p
 LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
 ON p.userid=d.userid
 WHERE d.`status`='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth=1 AND p.points > 0 AND d.userid=%s",
-                       array(getConfig('ref_payout'), bigintval($uid)), __FUNCTION__, __LINE__);
+                       array(getConfig('ref_payout'), bigintval($content['userid'])), __FUNCTION__, __LINE__);
                list($refpoints) = SQL_FETCHROW($result_ref);
                SQL_FREERESULT($result_ref);
 
+               // Fix empty refpoints
                if (empty($refpoints)) $refpoints = 0;
 
                // Store calculated new refs to array
-               $users['uid'][]     = $uid;
-               $users['ref'][]     = abs($cnt - $refs);
-               $users['cpoints'][] = $refpoints - $cpoints;
+               $users['uid'][]     = $content['userid'];
+               $users['ref'][]     = abs($cnt - $content['refs']);
+               $users['cpoints'][] = $refpoints - $content['curr_points'];
        }
 
        // Free memory
@@ -613,7 +590,7 @@ function RALLYE_LIST_WINNERS ($rallye, $default=0) {
                 else
                {
                        // Take ppints
-                       $DATA['infos'][$idx] = $DATA['points'][$idx]." ".POINTS;
+                       $DATA['infos'][$idx] = $DATA['points'][$idx]." {!POINTS!}";
                }
 
                // Add row
@@ -644,9 +621,9 @@ function RALLYE_LIST_WINNERS ($rallye, $default=0) {
        // And finnally return the output
        return $OUT;
 }
+
 //
-function RALLYE_DELETE_EXPIRED_RALLYES()
-{
+function RALLYE_DELETE_EXPIRED_RALLYES () {
        global $DATA;
 
        // Check for expired rallyes
@@ -656,34 +633,39 @@ FROM `{!_MYSQL_PREFIX!}_rallye_data`
 WHERE end_time <= (UNIX_TIMESTAMP() - %s) AND expired='Y'",
                array($EXPIRE), __FUNCTION__, __LINE__);
 
-       if (SQL_NUMROWS($result_rallye) > 0)
-       {
+       if (SQL_NUMROWS($result_rallye) > 0) {
+               // Init SQLs
+               INIT_SQLS();
+
                // Expire found rallyes and notify admin
-               while (list($id, $title, $start, $end) = SQL_FETCHROW($result_rallye))
-               {
+               while ($content = SQL_FETCHARRAY($result_rallye)) {
                        // Prepare data for mail template
-                       $DATA['title']  = $title;
-                       $DATA['start']  = MAKE_DATETIME($start, "1");
-                       $DATA['end']    = MAKE_DATETIME($end  , "1");
+                       $DATA['title']  = $content['title'];
+                       $DATA['start']  = MAKE_DATETIME($content['start_time'], "1");
+                       $DATA['end']    = MAKE_DATETIME($content['end_time']  , "1");
                        $DATA['now_t']  = MAKE_DATETIME(time(), "1");
 
                        // Send mail to admin
-                       SEND_ADMIN_NOTIFICATION(RALLYE_ADMIN_PURGED.": ".$title, "admin_rallye_purged", "", 0);
+                       SEND_ADMIN_NOTIFICATION(sprintf(getMessage('RALLYE_ADMIN_PURGED_SUBJ'), $content['title']), "admin_rallye_purged", "", 0);
 
                        // Purge whole rallye
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE id=%s LIMIT 1",
-                               array(bigintval($id)), __FUNCTION__, __LINE__);
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s LIMIT 1",
-                               array(bigintval($id)), __FUNCTION__, __LINE__);
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s LIMIT 1",
-                               array(bigintval($id)), __FUNCTION__, __LINE__);
-               }
-
-               // Add task
-               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (status, task_type, subject, text, task_created)
+                       ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE id=%s LIMIT 1",
+                               array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
+                       ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s LIMIT 1",
+                               array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
+                       ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s LIMIT 1",
+                               array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
+
+                       // Add task
+                       // @TODO Rewrite this to a function
+                       ADD_SQL(SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (status, task_type, subject, text, task_created)
 VALUES ('NEW','RALLYE_PURGED','{--RALLYE_ADMIN_PURGED--}: %s','{--RALLYE_ADMIN_PURGED_TEXT--}',UNIX_TIMESTAMP())",
-                       array($title), __FUNCTION__, __LINE__);
-       }
+                               array($content['title']), __FUNCTION__, __LINE__, false));
+               } // END - while
+
+               // Run all SQLs
+               runFilterChain('run_sqls');
+       } // END - if
 
        // Free memory
        SQL_FREERESULT($result_rallye);
@@ -732,7 +714,7 @@ function RALLYE_TEMPLATE_SELECTION($name="template", $default="")
        return $OUT;
 }
 //
-function RALLYE_GET_REFCOUNT($uid, $old=0) {
+function RALLYE_GET_REFCOUNT ($uid, $old=0) {
        // Check current refs
        if (GET_EXT_VERSION("cache") >= "0.1.2") {
                // Get refs from cache
@@ -792,6 +774,34 @@ WHERE s.userid=%s AND s.level=1", array(bigintval($uid)), __FUNCTION__, __LINE__
        return $cnt;
 }
 
+// Determines the right language string for min_users
+function RALLYE_DETERMINE_MIN_USERS ($min_users) {
+       // Rallye ends without user limitation is the default
+       $return = getMessage('RALLYE_END_NO_USER_LIMITATION');
+
+       if ($min_users > 0) {
+               // Rallye ends when X members are totally in your exchange
+               $return = sprintf(getMessage('RALLYE_END_USERS'), $min_users);
+       } // END - if
+
+       // Return
+       return $return;
+}
+
+// Determines the right language string for min_prices
+function RALLYE_DETERMINE_MIN_PRICES ($min_prices) {
+       // Rallye ends without user limitation is the default
+       $return = getMessage('RALLYE_END_NO_PRICE_LIMITATION');
+
+       if ($min_prices > 0) {
+               // Rallye ends when X members are totally in your exchange
+               $return = sprintf(getMessage('RALLYE_END_PRICES'), $min_prices);
+       } // END - if
+
+       // Return
+       return $return;
+}
+
 // Filter for extra-autpurge
 function FILTER_RALLYE_EXTRA_AUTOPURGE () {
        // Check expired rallyes (hard-coded 3 days limit for displaying expired rallyes!)
index 6f45e93..d08c83b 100644 (file)
@@ -47,16 +47,17 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
        $return = $points;
 
        // Get all ref levels
-       $result_refs = SQL_QUERY("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE level > 0 ORDER BY level ASC", __FUNCTION__, __LINE__);
+       $result_refs = SQL_QUERY("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE level > 0 ORDER BY level ASC",
+               __FUNCTION__, __LINE__);
 
        // "Walk" through all level
-       while (list($level, $perc) = SQL_FETCHROW($result_refs)) {
+       while ($content = SQL_FETCHARRAY($result_refs)) {
                // Reset ref depths
                unset($GLOBALS['ref_level']);
 
                // "Walk" through all refids
-               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},level={$level},points={$points}<br />\n";
-               foreach (GET_REFBACK_USERID_ARRAY($uid, $level) as $refid) {
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},level={$content['level']},points={$points}<br />\n";
+               foreach (GET_REFBACK_USERID_ARRAY($uid, $content['level']) as $refid) {
                        // Skip level zero or if both are the same
                        if ($uid == $refid) continue;
 
@@ -66,9 +67,9 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
 
                        // Some percents given?
                        if ($percents > 0) {
-                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):points={$points},perc={$perc},percents={$percents},level={$level}<br />\n";
+                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):points={$points},perc={$content['percents']},percents={$percents},level={$content['level']}<br />\n";
                                // Calculate points for refback
-                               $refback = $points * ($perc / 100) * ($percents / 100);
+                               $refback = $points * ($content['percents'] / 100) * ($percents / 100);
 
                                // Update refback table ("refid" and "uid" must be exchanged!)
                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_refs` SET points=points+%s WHERE userid=%s AND refid=%s LIMIT 1",
@@ -82,7 +83,7 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
                                // Reduce points if refid is found
                                if ($refid == $ref) {
                                        // Reduce points here!
-                                       $return = $points * ($perc / 100) - $refback;
+                                       $return = $points * ($content['percents'] / 100) - $refback;
                                        //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):points={$return} - REDUCED<br />\n";
                                } // END - if
                        } // END - if
@@ -151,9 +152,9 @@ ORDER BY userid ASC",
        //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):numRows=".SQL_NUMROWS($result)."<br />\n";
        if (SQL_NUMROWS($result) > 0) {
                // Add all
-               while (list($userid) = SQL_FETCHROW($result)) {
-                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):rid={$rid},level={$level},userid={$userid}<br />\n";
-                       $userIds[] = $userid;
+               while ($content = SQL_FETCHARRAY($result)) {
+                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):rid={$rid},level={$level},userid={$content['userid']}<br />\n";
+                       $userIds[] = $content['userid'];
                } // END - while
        } // END - if
 
@@ -167,7 +168,7 @@ ORDER BY userid ASC",
 }
 
 // Update "refback table"
-function UPDATE_REFBACK_TABLE($uid) {
+function UPDATE_REFBACK_TABLE ($uid) {
        //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
        // Make it sure referal level zero (member him-/herself) is at least selected
        if (empty($GLOBALS['cache_array']['back_level'])) $GLOBALS['cache_array']['back_level'] = 1;
index f3af140..69fc4a8 100644 (file)
@@ -38,13 +38,15 @@ if (!defined('__SECURITY')) {
 }
 
 //
-function REGISTER_FILL_MUST_CONSTANTS()
-{
-       $result = SQL_QUERY("SELECT field_name, field_required FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id`", __FUNCTION__, __LINE__);
-       while (list($name, $required) = SQL_FETCHROW($result)) {
+function REGISTER_FILL_MUST_CONSTANTS () {
+       $result = SQL_QUERY("SELECT field_name, field_required FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id`",
+               __FUNCTION__, __LINE__);
+
+       while ($content = SQL_FETCHARRAY($result)) {
                $value = "";
-               if ($required == "Y") $value = "<div class=\\\"guest_failed\\\">&nbsp;(*)</div>";
-               $eval = "define('MUST_".strtoupper($name)."', \"".$value."\");";
+               if ($content['field_required'] == "Y") $value = "<div class=\\\"guest_failed\\\">&nbsp;(*)</div>";
+               // @TODO Rewrite these constants
+               $eval = "define('MUST_".strtoupper($content['field_name'])."', \"".$value."\");";
                eval($eval);
        } // END - while
 
@@ -57,18 +59,16 @@ function REGISTER_FILL_MUST_CONSTANTS()
        define('MUST_BIRTH' , "<div class=\"guest_failed\">&nbsp;(*)</div>");
        define('MUST_MARKER', "<div class=\"guest_failed\">&nbsp;(*)</div>");
 }
+
 //
-function REGISTER_CHECK_REQUIRED_FIELDS(&$array)
-{
+function REGISTER_CHECK_REQUIRED_FIELDS (&$array) {
        $ret = false;
-       foreach ($array as $key => $value)
-       {
-               $result = SQL_QUERY("SELECT field_required FROM `{!_MYSQL_PREFIX!}_must_register` WHERE field_name='".$key."' LIMIT 1", __FUNCTION__, __LINE__);
-               if (SQL_NUMROWS($result) == 1)
-               {
+       foreach ($array as $key => $value) {
+               $result = SQL_QUERY("SELECT field_required FROM `{!_MYSQL_PREFIX!}_must_register` WHERE field_name='".$key."' LIMIT 1",
+                       __FUNCTION__, __LINE__);
+               if (SQL_NUMROWS($result) == 1) {
                        // "Must-line" found
                        list($chk) = SQL_FETCHROW($result);
-                       SQL_FREERESULT($result);
 
                        // Check if extension country is not found (you have to enter the 2-chars long country code) or
                        // if extensions is present check if country code was selected
@@ -81,26 +81,29 @@ function REGISTER_CHECK_REQUIRED_FIELDS(&$array)
                                $ret = true;
                        }
                }
+
+               // Free result
+               SQL_FREERESULT($result);
        }
        return $ret;
 }
+
 //
-function REGISTER_OUTPUT_REQUIRE_CHECK(&$array)
-{
+function REGISTER_OUTPUT_REQUIRE_CHECK (&$array) {
        $result = SQL_QUERY("SELECT field_name, field_required FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id`", __FUNCTION__, __LINE__);
-       while (list($name, $required) = SQL_FETCHROW($result))
-       {
-               if (($array[$name] == "!") && ($required == "Y")) {
+       while ($content = SQL_FETCHARRAY($result)) {
+               if (($array[$content['field_name']] == "!") && ($content['field_required'] == "Y")) {
                        // Empty entry found
-                       $array[$name] = "";
-                       $OUT = constant('REGISTER_'.strtoupper($name).'_REQUIRED');
+                       $array[$content['field_name']] = "";
+                       $OUT = constant('REGISTER_'.strtoupper($content['field_name']).'_REQUIRED');
                        OUTPUT_HTML("<div class=\"register_failed\">".$OUT."</div>");
-               }
-       }
+               } // END - if
+       } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
 }
+
 //
 function REGISTER_ADD_CATEGORY_TABLE ($MODE, $return=false) {
        $OUT = "";
@@ -111,28 +114,32 @@ function REGISTER_ADD_CATEGORY_TABLE ($MODE, $return=false) {
 
        // Admins are allowed to see every category...
        if (IS_ADMIN()) $AND = "";
-       $result = SQL_QUERY("SELECT id, cat, visible FROM `{!_MYSQL_PREFIX!}_cats` ".$AND." ORDER BY `sort`", __FUNCTION__, __LINE__);
+
+       // Look for categories
+       $result = SQL_QUERY("SELECT id, cat, visible FROM `{!_MYSQL_PREFIX!}_cats` ".$AND." ORDER BY `sort`",
+               __FUNCTION__, __LINE__);
+
        if (SQL_NUMROWS($result) > 0) {
                // List alle visible modules (or all to the admin)
                $SW = 2;
                $OUT .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n";
-               while (list($id, $cat, $visible) = SQL_FETCHROW($result)) {
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Is the array element not set?
-                       if (!REQUEST_ISSET_POST('cat', $id)) {
+                       if (!REQUEST_ISSET_POST('cat', $content['id'])) {
                                // Then set it
-                               REQUEST_SET_POST(array('cat', $id), "");
+                               REQUEST_SET_POST(array('cat', $content['id']), "");
                        } // END - if
 
                        // Prepare array for the template
                        $content = array(
                                'sw'    => $SW,
-                               'cat'   => $cat,
+                               'cat'   => $content['cat'],
                                'def_y' => "",
                                'def_n' => "",
-                               'id'    => $id,
+                               'id'    => $content['id'],
                        );
 
-                       if ((REQUEST_POST('cat', $id) == "Y") || ((getConfig('register_default') == "Y") && (!REQUEST_ISSET_POST('cat', $id)))) {
+                       if ((REQUEST_POST('cat', $content['id']) == "Y") || ((getConfig('register_default') == "Y") && (!REQUEST_ISSET_POST('cat', $content['id'])))) {
                                $content['def_y'] = " checked=\"checked\"";
                        } else {
                                $content['def_n'] = " checked=\"checked\"";
@@ -151,7 +158,7 @@ function REGISTER_ADD_CATEGORY_TABLE ($MODE, $return=false) {
                $OUT .= LOAD_TEMPLATE("admin_settings_saved", true, getMessage('NO_CATEGORIES_VISIBLE'));
        }
 
-       if ($return) {
+       if ($return === true) {
                // Return generated HTML code
                return $OUT;
        } else {
index 4f2fd8f..31d010b 100644 (file)
@@ -272,31 +272,31 @@ function GENERATE_SPONSOR_MENU($current)
        if (IS_ADMIN()) $WHERE = "";
 
        // Load main menu entries
-       $result_main = SQL_QUERY("SELECT actiontitle FROM `{!_MYSQL_PREFIX!}_sponsor_menu`
+       $result_main = SQL_QUERY("SELECT action AS main_action, title AS main_title FROM `{!_MYSQL_PREFIX!}_sponsor_menu`
 WHERE (what='' OR `what` IS NULL) ".$WHERE."
 ORDER BY `sort`", __FUNCTION__, __LINE__);
-       if (SQL_NUMROWS($result_main) > 0)
-       {
+       if (SQL_NUMROWS($result_main) > 0) {
                // Load every menu and it's sub menus
-               while (list($action, $title_main) = SQL_FETCHROW($result_main))
-               {
+               while ($content = SQL_FETCHARRAY($result_main)) {
                        // Load sub menus
-                       $result_sub = SQL_QUERY_ESC("SELECT whattitle FROM `{!_MYSQL_PREFIX!}_sponsor_menu`
+                       $result_sub = SQL_QUERY_ESC("SELECT what AS sub_what, title AS sub_title FROM `{!_MYSQL_PREFIX!}_sponsor_menu`
 WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ".$WHERE."
-ORDER BY `sort`", array($action), __FUNCTION__, __LINE__);
-                       if (SQL_NUMROWS($result_sub) > 0)
-                       {
+ORDER BY `sort`",
+                               array($content['main_action']), __FUNCTION__, __LINE__);
+                       if (SQL_NUMROWS($result_sub) > 0) {
                                // Load sub menus
                                $SUB = "";
-                               while (list($what, $title_sub) = SQL_FETCHROW($result_sub))
-                               {
+                               while ($content2 = SQL_FETCHARRAY($result_sub)) {
+                                       // Merge both arrays
+                                       $content = merge_array($content, $content2);
+
                                        // Check if current selected menu is matching the loaded one
-                                       if ($current == $what) $title_sub = "<strong>".$title_sub."</strong>";
+                                       if ($current == $content['sub_what']) $content['sub_title'] = "<strong>".$content['sub_title']."</strong>";
 
                                        // Prepare data for the sub template
                                        $content = array(
-                                               'what'  => $what,
-                                               'title' => $title_sub
+                                               'what'  => $content['sub_what'],
+                                               'title' => $content['sub_title']
                                        );
 
                                        // Load row template
@@ -305,27 +305,23 @@ ORDER BY `sort`", array($action), __FUNCTION__, __LINE__);
 
                                // Prepare data for the main template
                                $content = array(
-                                       'title' => $title_main,
+                                       'title' => $content['main_title'],
                                        'menu'  => $SUB
                                );
 
                                // Load menu template
                                $OUT .= LOAD_TEMPLATE("sponsor_action", true, $content);
-                       }
-                        else
-                       {
+                       } else {
                                // No sub menus active
-                               $OUT .= LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_SUB_MENUS_ACTIVE);
+                               $OUT .= LOAD_TEMPLATE("admin_settings_saved", true, getMessage('SPONSOR_NO_SUB_MENUS_ACTIVE'));
                        }
 
                        // Free memory
                        SQL_FREERESULT($result_sub);
                }
-       }
-        else
-       {
+       } else {
                // No main menus active
-               $OUT .= LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_MAIN_MENUS_ACTIVE);
+               $OUT .= LOAD_TEMPLATE("admin_settings_saved", true, getMessage('SPONSOR_NO_MAIN_MENUS_ACTIVE'));
        }
 
        // Free memory
@@ -334,9 +330,9 @@ ORDER BY `sort`", array($action), __FUNCTION__, __LINE__);
        // Return content
        return $OUT;
 }
+
 //
-function GENERATE_SPONSOR_CONTENT($what)
-{
+function GENERATE_SPONSOR_CONTENT ($what) {
        $OUT = "";
        $INC = sprintf("inc/modules/sponsor/%s.php", $what);
        if (INCLUDE_READABLE($INC)) {
@@ -344,12 +340,13 @@ function GENERATE_SPONSOR_CONTENT($what)
                LOAD_INC_ONCE($INC);
        } else {
                // File not found!
-               $OUT .= LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_CONTENT_404_1.$what.SPONSOR_CONTENT_404_2);
+               $OUT .= LOAD_TEMPLATE("admin_settings_saved", true, sprintf(getMessage('SPONSOR_CONTENT_404'), $what));
        }
 
        // Return content
        return $OUT;
 }
+
 //
 function UPDATE_SPONSOR_LOGIN () {
        // Failed by default
@@ -380,7 +377,7 @@ function SPONSOR_SAVE_DATA ($POST, $content) {
                        'ok', 'pass1', 'pass2');
 
        // Set default message ("not saved")
-       $MSG = SPONSOR_ACCOUNT_DATA_NOT_SAVED;
+       $MSG = getMessage('SPONSOR_ACCOUNT_DATA_NOT_SAVED');
 
        // Check for submitted passwords
        if ((!empty($POST['pass1'])) && (!empty($POST['pass2']))) {
@@ -388,13 +385,13 @@ function SPONSOR_SAVE_DATA ($POST, $content) {
                if ($POST['pass1'] == $POST['pass2']) {
                        // Okay, then set password and remove pass1 and pass2
                        $POST['password'] = md5($POST['pass1']);
-               }
-       }
+               } // END - if
+       } // END - if
 
        // Remove all (maybe spoofed) unsafe data from array
        foreach ($UNSAFE as $remove) {
                unset($POST[$remove]);
-       }
+       } // END - foreach
 
        // This array is for the submitted data which we will use with the SQL_QUERY_ESC() function to
        // secure the data
@@ -411,7 +408,7 @@ function SPONSOR_SAVE_DATA ($POST, $content) {
 
                // Compile {SLASH} and so on for the email templates
                $POST[$key] = COMPILE_CODE($value);
-       }
+       } // END - foreach
 
        // Check if email has changed
        if ((!empty($content['email'])) && (!empty($POST['email']))) {
@@ -425,8 +422,8 @@ function SPONSOR_SAVE_DATA ($POST, $content) {
                        // Generate hash code
                        $HASH = md5(session_id().":".$POST['email'].":".GET_REMOTE_ADDR().":".GET_USER_AGENT().":".time());
                        $DATA[] = $HASH;
-               }
-       }
+               } // END - if
+       } // END - if
 
        // Remove last commata
        $sql = substr($sql, 0, -1);
@@ -515,9 +512,9 @@ function SPONSOR_SAVE_DATA ($POST, $content) {
                                        SEND_EMAIL($content['email'], getMessage('SPONSOR_SETTINGS_SUBJ'), $email_msg);
                                        break;
                                }
-                       }
-               }
-       }
+                       } // END - if
+               } // END - if
+       } // END - if
 
        // Return final message
        return $MSG;
index 7c467d9..c122b79 100644 (file)
@@ -1106,18 +1106,18 @@ ORDER BY u.userid ASC", __FUNCTION__, __LINE__);
        }
 
        // Load all userid
-       while (list($uid, $notified) = SQL_FETCHROW($result)) {
+       while ($content = SQL_FETCHARRAY($result)) {
                // Get total points
-               $points = GET_TOTAL_DATA($uid, "user_points", "points") - GET_TOTAL_DATA($uid, "user_data", "used_points");
-               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$uid},points={$points}", false);
+               $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?
                if ($points <= $limit) {
                        // Ignore this one!
-                       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$uid} has depleted points amount!", false);
-                       $UIDs['uid'][$uid] = $uid;
-                       $UIDs['points'][$uid] = $points;
-                       $UIDs['notified'][$uid] = $notified;
+                       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$content['userid']} has depleted points amount!", false);
+                       $UIDs['uid'][$content['userid']]      = $content['userid'];
+                       $UIDs['points'][$content['userid']]   = $points;
+                       $UIDs['notified'][$content['userid']] = $content['notified'];
                } // END - if
        } // END - while
 
@@ -1319,32 +1319,32 @@ ORDER BY
                __FUNCTION__, __LINE__);
 
        // Load all entries
-       while (list($lid, $url, $last) = SQL_FETCHROW($result)) {
+       while ($content = SQL_FETCHARRAY($result)) {
                // Debug message
-               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "next - lid={$lid},url={$url},rest=".(time() - $last)."/".SURFBAR_GET_SURF_LOCK()."", false);
+               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "next - lid={$content['id']},url={$content['url_id']},rest=".(time() - $last)."/".SURFBAR_GET_SURF_LOCK()."", false);
 
                // Skip entries that are too old
-               if (($last > (time() - SURFBAR_GET_SURF_LOCK())) && (!in_array($url, $ignored))) {
+               if (($last > (time() - SURFBAR_GET_SURF_LOCK())) && (!in_array($content['url_id'], $ignored))) {
                        // Debug message
-                       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "okay - lid={$lid},url={$url},last={$last}", false);
+                       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "okay - lid={$content['id']},url={$content['url_id']},last={$last}", false);
 
                        // Add only if missing or bigger
-                       if ((!isset($IDs[$url])) || ($IDs[$url] > $last)) {
+                       if ((!isset($IDs[$content['url_id']])) || ($IDs[$content['url_id']] > $last)) {
                                // Debug message
-                               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "ADD - lid={$lid},url={$url},last={$last}", false);
+                               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "ADD - lid={$content['id']},url={$content['url_id']},last={$last}", false);
 
                                // Add this ID
-                               $IDs[$url] = $last;
-                               $USE[$url] = $lid;
+                               $IDs[$content['url_id']] = $last;
+                               $USE[$content['url_id']] = $content['id'];
                        } // END - if
                } else {
                        // Debug message
-                       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "ignore - lid={$lid},url={$url},last={$last}", false);
+                       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "ignore - lid={$content['id']},url={$content['url_id']},last={$last}", false);
 
                        // Ignore these old entries!
-                       $ignored[] = $url;
-                       unset($IDs[$url]);
-                       unset($USE[$url]);
+                       $ignored[] = $content['url_id'];
+                       unset($IDs[$content['url_id']]);
+                       unset($USE[$content['url_id']]);
                }
        } // END - while
 
@@ -1417,8 +1417,9 @@ function SURFBAR_GET_ACTION_ARRAY ($status) {
        // Some entries there?
        if (SQL_NUMROWS($result) > 0) {
                // Load all actions
-               while (list($action) = SQL_FETCHROW($result)) {
-                       $returnArray[] = $action;
+               // @TODO This can be somehow rewritten
+               while ($content = SQL_FETCHARRAY($result)) {
+                       $returnArray[] = $content['action'];
                } // END - if
        } // END - if
 
index 22090f5..21b9bb0 100644 (file)
@@ -50,7 +50,6 @@ function OUTPUT_ADVANCED_OVERVIEW (&$result_main) {
        // Init variables/arrays
        $EXTRAS = "";
        $OUT = "";
-       INIT_SQLS();
        $WHATs = array();
        $DESCRs = array();
        $TITLEs = array();
@@ -58,6 +57,9 @@ function OUTPUT_ADVANCED_OVERVIEW (&$result_main) {
        // Chheck for new extensions and updates
        $JOBS_DONE = OUTPUT_STANDARD_OVERVIEW($result_main);
 
+       // Init SQLs
+       INIT_SQLS();
+
        if (!$JOBS_DONE) {
                // New extensions or updates found
                $value = GET_TOTAL_DATA(GET_CURRENT_ADMIN_ID(), "task_system", "id", "assigned_admin", true, " AND `status`='NEW' AND task_type='EXTENSION_UPDATE'");
@@ -215,13 +217,13 @@ function OUTPUT_ADVANCED_OVERVIEW (&$result_main) {
                                define('__MAIL_BONUS_AP_VALUE', "0");
                        }
                } elseif (EXT_IS_ACTIVE("bonus")) {
-                       define('__MAIL_BONUS_AP_VALUE', ADMIN_EXT_BONUS_OUTDATED_1."0.1.8".ADMIN_EXT_BONUS_OUTDATED_2);
+                       define('__MAIL_BONUS_AP_VALUE', sprintf(getMessage('ADMIN_EXT_BONUS_OUTDATED', "0.1.8")));
                } else {
-                       define('__MAIL_BONUS_AP_VALUE', "<div class=\"admin_note\">{--ADMIN_EXT_BONUS_404--}</div>");
+                       define('__MAIL_BONUS_AP_VALUE', "<span class=\"admin_note\">{--ADMIN_EXT_BONUS_404--}</span>");
                }
        } else {
-               define('__MAIL_BONUS_AP_VALUE', "<div class=\"admin_note\">{--ADMIN_EXT_AUTOPURGE_404--}</div>");
-               define('__MAIL_DELETED_VALUE', "<div class=\"admin_note\">{--ADMIN_EXT_AUTOPURGE_404--}</div>");
+               define('__MAIL_BONUS_AP_VALUE', "<span class=\"admin_note\">{--ADMIN_EXT_AUTOPURGE_404--}</span>");
+               define('__MAIL_DELETED_VALUE', "<span class=\"admin_note\">{--ADMIN_EXT_AUTOPURGE_404--}</span>");
        }
 
        //
@@ -237,7 +239,7 @@ function OUTPUT_ADVANCED_OVERVIEW (&$result_main) {
                        define('__MAIL_BONUS_SEND_VALUE', "0");
                }
        } elseif (EXT_IS_ACTIVE("bonus")) {
-               define('__MAIL_BONUS_SEND_VALUE', ADMIN_EXT_BONUS_OUTDATED_1."0.1.8".ADMIN_EXT_BONUS_OUTDATED_2);
+               define('__MAIL_BONUS_SEND_VALUE', sprintf(getMessage('ADMIN_EXT_BONUS_OUTDATED', "0.1.8")));
        } else {
                define('__MAIL_BONUS_SEND_VALUE', getMessage('ADMIN_EXT_BONUS_404'));
        }
@@ -251,6 +253,7 @@ function OUTPUT_ADVANCED_OVERVIEW (&$result_main) {
                } // END - if
 
                // Check for more extensions
+               // @TODO These can be rewritten to filter
                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')."";
@@ -537,7 +540,7 @@ ORDER BY beg_points DESC, userid");
 //
 function TASK_CREATE_EXTRA_ROWS ($WHATs, $DESCRs, $TITLEs) {
        // Init variables
-       $OUT = ""; $SW = 2; $MAX = COUNT_SQLS() - 1;
+       $OUT = ""; $SW = 2;
 
        // Sadly this cannot be rewritten to a filter... :(
        foreach (GET_SQLS() as $key => $sql) {
@@ -550,13 +553,16 @@ function TASK_CREATE_EXTRA_ROWS ($WHATs, $DESCRs, $TITLEs) {
                // Free result
                SQL_FREERESULT($result);
 
+               // Prepare array for output
                $content = array(
                        'row_descr' => $DESCRs[$key],
                        'row_sw'    => $SW,
                        'bottom'    => "",
                );
 
-               if ($key < $MAX) $content['bottom'] = "bottom2";
+               // Rewrite CSS class if not last entry is reached
+               if ($key < (COUNT_SQLS() - 1)) $content['bottom'] = "bottom2";
+
                if (($value > 0) && (!empty($WHATs[$key]))) {
                        if (empty($TITLEs[$key])) $TITLEs[$key] = getMessage('ADMIN_TASK_UNKNOWN_LIST_TITLE');
                        $content['row_link'] = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=".$WHATs[$key]."\" title=\"".$TITLEs[$key]."\">".$value."</a>";
@@ -564,15 +570,16 @@ function TASK_CREATE_EXTRA_ROWS ($WHATs, $DESCRs, $TITLEs) {
                        $content['row_link'] = 0;
                }
 
-               // Switch color
-               $SW = 3 - $SW;
-
                // And insert the final string into extras template
                $OUT .= LOAD_TEMPLATE("admin_overview_task_rows", true, $content);
+
+               // Switch color
+               $SW = 3 - $SW;
        } // END - if
 
-       // Return output
+       // Return output in the template
        return LOAD_TEMPLATE("admin_overview_task_extras", true, $OUT);
 }
+
 //
 ?>
index e97d767..f8fd66d 100644 (file)
@@ -37,46 +37,50 @@ if (!defined('__SECURITY')) {
        require($INC);
 }
 
-function THEME_SELECTION_BOX($mod, $act, $wht, $result) {
+// Create a selection box with installed and activated themes
+function THEME_SELECTION_BOX ($mod, $act, $wht, $result) {
        // Construction URL
-       $FORM = "{!URL!}/modules.php?module=".$mod;
-       if (!empty($act)) $FORM .= "&amp;action=".$act;
-       if (!empty($wht))   $FORM .= "&amp;what=".$wht;
-       define('__FORM_VALUE', $FORM);
+       $formAction = "{!URL!}/modules.php?module=".$mod;
+       if (!empty($act)) $formAction .= "&amp;action=".$act;
+       if (!empty($wht)) $formAction .= "&amp;what=".$wht;
 
        // Initialize array
-       $THEMES = array(
+       $themesArray = array(
                'theme_unix'   => array(), // Unix name from filesystem
                'theme_name'   => array()  // Title
        );
 
        // Load all themes
-       while (list($theme) = SQL_FETCHROW($result)) {
+       while ($content = SQL_FETCHARRAY($result)) {
                // Load it's theme.php file
-               $INC = sprintf("theme/%s/theme.php", SQL_ESCAPE($theme));
+               $INC = sprintf("theme/%s/theme.php", SQL_ESCAPE($content['theme_path']));
                if (INCLUDE_READABLE($INC)) {
                        // And save all data in array
                        LOAD_INC($INC);
-                       $THEMES['theme_unix'][] = $theme;
-                       $THEMES['theme_name'][] = $THEME_NAME;
+                       $themesArray['theme_unix'][] = $content['theme_path'];
+                       $themesArray['theme_name'][] = $THEME_NAME;
                } // END - if
        } // END - while
 
        // Sort whole array by title
-       array_pk_sort($THEMES, array("theme_name"));
+       array_pk_sort($themesArray, array("theme_name"));
 
        // Construct selection form for the box template
        $OUT = "";
-       foreach ($THEMES['theme_unix'] as $key => $theme) {
+       foreach ($themesArray['theme_unix'] as $key => $theme) {
                $OUT .= "  <option value=\"".$theme."\"";
                if ($theme == GET_CURR_THEME()) $OUT .= " selected=\"selected\"";
-               $OUT .= ">".$THEMES['theme_name'][$key]."</option>\n";
+               $OUT .= ">".$themesArray['theme_name'][$key]."</option>\n";
        } // END - foreach
 
+       // Remember content
+       $content = array(
+               'form_action' => $formAction,
+               'selection'   => $OUT
+       );
+
        // Return generated selection
-       define('__THEME_SELECTION_OPTIONS', $OUT);
-       $OUT = LOAD_TEMPLATE("theme_select_form", true);
-       return $OUT;
+       return LOAD_TEMPLATE("theme_select_form", true, $content);
 }
 
 // Get version from name
index eceebab..37bd194 100644 (file)
@@ -44,7 +44,7 @@ function alpha ($sortby, $colspan, $return=false) {
        if (REQUEST_ISSET_GET(('mode'))) $ADD .= "&amp;mode=".REQUEST_GET(('mode'));
 
        /* Creates the list of letters and makes them a link. */
-       $alphabet = array(_ALL2,"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",_OTHERS);
+       $alphabet = array(getMessage('_ALL2'),"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",getMessage('_OTHERS'));
        $num = count($alphabet) - 1;
        $OUT = "";
        while (list($counter, $ltr) = each($alphabet)) {
@@ -69,7 +69,7 @@ function alpha ($sortby, $colspan, $return=false) {
 
        // Load template
        $OUT = LOAD_TEMPLATE("admin_list_user_alpha", true);
-       if ($return) {
+       if ($return === true) {
                // Return generated code
                return $OUT;
        } else {
@@ -79,7 +79,7 @@ function alpha ($sortby, $colspan, $return=false) {
 }
 
 // Add links for sorting
-function SortLinks($letter, $sortby, $colspan, $return=false) {
+function SortLinks ($letter, $sortby, $colspan, $return=false) {
        $OUT = "";
        if (!REQUEST_ISSET_GET(('offset'))) REQUEST_SET_GET('offset', 0);
        if (!REQUEST_ISSET_GET(('page')))   REQUEST_SET_GET('page'  , 0);
@@ -92,20 +92,20 @@ function SortLinks($letter, $sortby, $colspan, $return=false) {
         elseif (REQUEST_ISSET_GET(('mode'))) $ADD .= "&amp;mode=".REQUEST_GET(('mode'));
 
        // Makes order by links..
-       if ($letter == "front") $letter = _ALL2;
+       if ($letter == "front") $letter = getMessage('_ALL2');
 
        // Prepare array with all possible sorters
        $list = array(
-               'userid'                => _UID,
-               'family'                => FAMILY_NAME,
-               'email'         => ADDY,
-               'REMOTE_ADDR'   => REMOTE_IP
+               'userid'                => getMessage('_UID'),
+               'family'                => getMessage('FAMILY_NAME'),
+               'email'         => getMessage('ADDY'),
+               'REMOTE_ADDR'   => getMessage('REMOTE_IP')
        );
 
        // Add nickname if extension is installed
        if (EXT_IS_ACTIVE("nickname")) {
-               $list['nickname'] = NICKNAME;
-       }
+               $list['nickname'] = getMessage('NICKNAME');
+       } // END - if
 
        foreach ($list as $sort => $title) {
                if ($sortby == $sort) {
@@ -119,7 +119,7 @@ function SortLinks($letter, $sortby, $colspan, $return=false) {
 
        // Load template
        $OUT = LOAD_TEMPLATE("admin_list_user_sort", true);
-       if ($return) {
+       if ($return === true) {
                // Return code
                return $OUT;
        } else {
@@ -129,7 +129,7 @@ function SortLinks($letter, $sortby, $colspan, $return=false) {
 }
 
 // Add page navigation
-function ADD_PAGENAV($PAGES, $offset, $show_form, $colspan,$return=false) {
+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>");
@@ -140,10 +140,10 @@ function ADD_PAGENAV($PAGES, $offset, $show_form, $colspan,$return=false) {
 
        if (!$show_form) {
                // Add line with bottom border
-               define('__FORM_FOOTER', "<tr><td colspan=\"".__COLSPAN2."\" class=\"seperator bottom2\">&nbsp;</td></tr>");
+               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>");
+               define('__FORM_FOOTER', "<tr><td colspan=\"{!__COLSPAN2!}\" class=\"seperator bottom2\">&nbsp;</td></tr>");
        }
 
        $OUT = "";
@@ -180,7 +180,7 @@ function ADD_PAGENAV($PAGES, $offset, $show_form, $colspan,$return=false) {
 
        // Load template
        $OUT = LOAD_TEMPLATE("admin_list_user_pagenav", true);
-       if ($return) {
+       if ($return === true) {
                // Return code
                return $OUT;
        } else {
index dd8c722..f056faf 100644 (file)
@@ -60,7 +60,7 @@ if ((!isInstalled()) || (isInstalling())) {
 $GLOBALS['cache_array']['active_extensions'] = array();
 
 // By default no cache is set
-$GLOBALS['cacheMode'] = "no";
+$GLOBALS['cache_mode'] = "no";
 
 // Load sql_patchrs extension alone
 if (!LOAD_EXTENSION("sql_patches")) {
@@ -83,23 +83,23 @@ if (EXT_IS_ACTIVE("cache")) {
 
        // Check extension cache
        switch (($GLOBALS['cache_instance']->loadCacheFile("extensions", true)) && ($GLOBALS['cache_instance']->extensionVersionMatches("sql_patches"))) {
-               case true : $GLOBALS['cacheMode'] = "load"; break;
-               case false: $GLOBALS['cacheMode'] = "init"; break;
+               case true : $GLOBALS['cache_mode'] = "load"; break;
+               case false: $GLOBALS['cache_mode'] = "init"; break;
        }
 
        // Do we need to init the cache?
-       if (($GLOBALS['cacheMode'] == "init") && (getConfig('cache_exts') == "Y")) {
+       if (($GLOBALS['cache_mode'] == "init") && (getConfig('cache_exts') == "Y")) {
                // Init cache file
                $GLOBALS['cache_instance']->init("EXTENSIONS");
                $GLOBALS['cache_instance']->storeExtensionVersion("sql_patches");
        } elseif (getConfig('cache_exts') != "Y") {
                // Cache will not be created for extensions
-               $GLOBALS['cacheMode'] = "skip";
+               $GLOBALS['cache_mode'] = "skip";
        }
 } // END - if
 
 // Load cache?
-if ($GLOBALS['cacheMode'] == "load") {
+if ($GLOBALS['cache_mode'] == "load") {
        // Init include array
        $EXT_POOL = array();
 
@@ -191,7 +191,7 @@ if ($GLOBALS['cacheMode'] == "load") {
        // If current user is not admin load only activated extensions. But load
        // them all if we are going to init the cache files. The admin shall use
        // every available extension for testing purposes.
-       if ((!IS_ADMIN()) && ($GLOBALS['cacheMode'] != "init")) $ADD = " WHERE ext_active='Y'";
+       if ((!IS_ADMIN()) && ($GLOBALS['cache_mode'] != "init")) $ADD = " WHERE ext_active='Y'";
 
        if (GET_EXT_VERSION("sql_patches") >= "0.0.6") {
                // Query with CSS file from DB
@@ -210,7 +210,7 @@ ORDER BY ext_name", __FILE__, __LINE__);
 $DEL = array();
 
 // At least one found?
-if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($GLOBALS['cacheMode'] == "init") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) || ($GLOBALS['cacheMode'] == "no"))) {
+if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($GLOBALS['cache_mode'] == "init") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) || ($GLOBALS['cache_mode'] == "no"))) {
        // Extensions are registered so we load them
        while ($content = SQL_FETCHARRAY($res_ext_crt)) {
                // Get menu entry
@@ -256,10 +256,10 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($GLOBALS['cacheMode'] == "init") && ($
                        } // END - if
 
                        // Shall we cache?
-                       if ($GLOBALS['cacheMode'] == "init") {
+                       if ($GLOBALS['cache_mode'] == "init") {
                                // Add cache row
                                $GLOBALS['cache_instance']->addRow($content);
-                       } elseif ($GLOBALS['cacheMode'] == "no") {
+                       } elseif ($GLOBALS['cache_mode'] == "no") {
                                // Remember this value for later usage
                                $GLOBALS['cache_array']['active_extensions'][$content['ext_name']] = EXT_GET_ALWAYS_ACTIVE();
                        }
@@ -272,7 +272,7 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($GLOBALS['cacheMode'] == "init") && ($
        // Init filter system
        INIT_FILTER_SYSTEM();
 
-       if ($GLOBALS['cacheMode'] == "init") {
+       if ($GLOBALS['cache_mode'] == "init") {
                // Close cache file
                $GLOBALS['cache_instance']->finalize();
 
index 7ffffb8..0d714ee 100644 (file)
@@ -91,7 +91,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile("admins")) && ($GLOBALS['cache_in
        $result_admins = SQL_QUERY("SELECT id AS aid, login, password, email".$ADD."
 FROM `{!_MYSQL_PREFIX!}_admins`
 ORDER BY login", __FILE__, __LINE__);
-       while($dummy = SQL_FETCHARRAY($result_admins)) {
+       while ($dummy = SQL_FETCHARRAY($result_admins)) {
                // Save row
                $GLOBALS['cache_instance']->addRow($dummy);
        } // END - while
index b6e6ef3..8dd17a2 100644 (file)
@@ -102,7 +102,7 @@ if (!empty($sql)) {
        $result_main = SQL_QUERY($sql, __FILE__, __LINE__);
        if (SQL_NUMROWS($result_main) > 0) {
                // Normal notification mails or bonus mails?
-               $MAIL_MODE = ((getConfig('beg_notify_bonus') > 0) && ($MODE == "en") && (EXT_IS_ACTIVE("bonus")));
+               $sentBonusMails = ((getConfig('beg_notify_bonus') > 0) && ($MODE == "en") && (EXT_IS_ACTIVE("bonus")));
 
                // Generate subject line
                $SUBJECT = constant('BEG_RALLYE_'.strtoupper($MODE).'_NOTIFY');
@@ -112,27 +112,27 @@ if (!empty($sql)) {
                $RECEIVER = ""; $UIDs = array();
 
                // Okay lets notify all users!
-               while (list($uid, $email) = SQL_FETCHROW($result_main)) {
+               while ($content = SQL_FETCHARRAY($result_main)) {
                        // Update account
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
 SET beg_ral_notify='%s', beg_ral_%s_notify='%s'
 WHERE userid=%s
 LIMIT 1",
-                               array(time(), $MODE, time(), $uid), __FILE__, __LINE__);
+                               array(time(), $MODE, time(), $content['userid']), __FILE__, __LINE__);
 
                        // Load email template and send it to the user!
-                       if ($MAIL_MODE) {
+                       if ($sentBonusMails === true) {
                                // Add userid to queue
-                               $UIDs[] = $uid;
+                               $UIDs[] = $content['userid'];
                        } else {
                                // Send normal notification mail to the members
-                               $MSG = LOAD_EMAIL_TEMPLATE("beg_".$MODE."_notify", array(), $uid);
-                               SEND_EMAIL($uid, $SUBJECT, $MSG);
+                               $MSG = LOAD_EMAIL_TEMPLATE("beg_".$MODE."_notify", array(), $content['userid']);
+                               SEND_EMAIL($content['email'], $SUBJECT, $MSG);
                        }
                } // END - while
 
                // Shall I send out bonus mails?
-               if ($MAIL_MODE) {
+               if ($sentBonusMails === true) {
                        // Okay, make array to string
                        $RECEIVER = implode(";", $UIDs);
 
index 80a1f06..408dec5 100644 (file)
@@ -63,44 +63,43 @@ ORDER BY userid",
 
 if (SQL_NUMROWS($result_birthday) > 0) {
        // Start sending out birthday mails
-       while (list($uid, $email, $byear) = SQL_FETCHROW($result_birthday)) {
+       while ($content = SQL_FETCHARRAY($result_birthday)) {
                // Calculate own timestamp for birthday and today
-               $BD  = $byear + 12 * $MONTH + 365 * $DAY;
+               $BD  = $content['birth_year'] + 12 * $MONTH + 365 * $DAY;
                $NOW = $YEAR  + 12 * $MONTH + 365 * $DAY;
 
                // Simply subtract both values and you got the age... :)
                $AGE = $NOW - $BD;
 
                if (getConfig('birthday_points') > 0) {
-                       // Prepare array for loading template
-                       $content = array(
-                               'age'    => $AGE,
-                               'points' => TRANSLATE_COMMA(getConfig('birthday_points')),
-                               'check'  => "",
-                       );
+                       // Add more entries to the array
+                       $content['age']    = $AGE;
+                       $content['points'] = TRANSLATE_COMMA(getConfig('birthday_points'));
+                       $content['check']  = "";
 
+                       // @TODO 4 is hard-coded here, should we move it out in config?
                        for ($idx = 0; $idx < 4; $idx++) {
-                               $content['check'] .= generateRandomCodde("8", mt_rand(0, "$MONTH$DAY"), $uid, ($AGE*($idx+1)));
+                               $content['check'] .= generateRandomCodde("8", mt_rand(0, "$MONTH$DAY"), $content['userid'], ($AGE*($idx+1)));
                        }
 
                        // Insert row into database
                        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_birthday` (userid, points, chk_value) VALUES ('%s','%s','%s' )",
-                               array(bigintval($uid), getConfig('birthday_points'), $content['check']), __FILE__, __LINE__);
+                               array(bigintval($content['userid']), getConfig('birthday_points'), $content['check']), __FILE__, __LINE__);
 
                        // Load email template with confirmation link
-                       $msg = LOAD_EMAIL_TEMPLATE("member_birthday_confirm", $content, bigintval($uid));
+                       $msg = LOAD_EMAIL_TEMPLATE("member_birthday_confirm", $content, bigintval($content['userid']));
                } else {
                        // Load default email template and fill in the age
-                       $msg = LOAD_EMAIL_TEMPLATE("member_birthday", $AGE, $uid);
+                       $msg = LOAD_EMAIL_TEMPLATE("member_birthday", $AGE, $content['userid']);
                }
 
                // Send email
-               SEND_EMAIL($uid, HAPPY_BIRTHDAY, $msg);
+               SEND_EMAIL($content['email'], getMessage('HAPPY_BIRTHDAY'), $msg);
 
                // Remember him that he has received a birthday mail
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET birthday_sent=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1",
-                       array(bigintval($uid)), __FILE__, __LINE__);
-       }
+                       array(bigintval($content['userid'])), __FILE__, __LINE__);
+       } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
index 6c90799..82a7d25 100644 (file)
@@ -78,7 +78,7 @@ if (!empty($sql)) {
        $sql .= ") AND `status`='CONFIRMED' ORDER BY last_online ASC";
 
        // Normal notification mails or bonus mails?
-       $MAIL_MODE = ((getConfig('bonus_notify_points') > 0) && ($MODE == "en") && (EXT_IS_ACTIVE("bonus")));
+       $sentBonusMails = ((getConfig('bonus_notify_points') > 0) && ($MODE == "en") && (EXT_IS_ACTIVE("bonus")));
 
        // Generate subject line
        $SUBJECT = constant('BONUS_RALLYE_'.strtoupper($MODE).'_NOTIFY');
@@ -91,27 +91,27 @@ if (!empty($sql)) {
        $result_main = SQL_QUERY($sql, __FILE__, __LINE__);
        if (SQL_NUMROWS($result_main) > 0) {
                // Okay lets notify all users!
-               while (list($uid, $email) = SQL_FETCHROW($result_main)) {
+               while ($content = SQL_FETCHARRAY($result_main)) {
                        // Update account
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
 SET bonus_ral_notify='%s', bonus_ral_%s_notify='%s'
 WHERE userid=%s
 LIMIT 1",
-                               array(time(), $MODE, time(), $uid), __FILE__, __LINE__);
+                               array(time(), $MODE, time(), $content['userid']), __FILE__, __LINE__);
 
                        // Load email template and send it to the user!
-                       if ($MAIL_MODE) {
+                       if ($sentBonusMails === true) {
                                // Add userid to queue
-                               $UIDs[] = $uid;
+                               $UIDs[] = $content['userid'];
                        } else {
                                // Send normal notification mail to the members
-                               $MSG = LOAD_EMAIL_TEMPLATE("bonus_".$MODE."_notify", array(), $uid);
-                               SEND_EMAIL($uid, $SUBJECT, $MSG);
+                               $MSG = LOAD_EMAIL_TEMPLATE("bonus_".$MODE."_notify", array(), $content['userid']);
+                               SEND_EMAIL($content['email'], $SUBJECT, $MSG);
                        }
                } // END - while
 
                // Shall I send out bonus mails?
-               if ($MAIL_MODE) {
+               if ($sentBonusMails === true) {
                        // Okay, make array to string
                        $RECEIVER = implode(";", $UIDs);
 
index d3980ba..9208c9f 100644 (file)
@@ -61,7 +61,7 @@ if (!isAdminRegistered()) {
                destroyAdminSession(false);
 
                // Do registration
-               $ret = REGISTER_ADMIN(REQUEST_POST('login'), $hashedPass);
+               $ret = REGISTER_ADMIN(REQUEST_POST('login'), $hashedPass, constant('WEBMASTER'));
                switch ($ret)
                {
                case "done":
index 104f4e6..8944acf 100644 (file)
@@ -38,11 +38,11 @@ if (!defined('__SECURITY')) {
 }
 
 // Register an administrator account
-function REGISTER_ADMIN ($user, $md5, $email=WEBMASTER) {
+function REGISTER_ADMIN ($user, $md5, $email) {
        // Login does already exist
        $ret = "already";
 
-       // Lookup the user
+       // Lookup the admin
        $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1",
                array($user), __FUNCTION__, __LINE__);
 
@@ -60,6 +60,7 @@ function REGISTER_ADMIN ($user, $md5, $email=WEBMASTER) {
        // Return result
        return $ret;
 }
+
 // Only be executed on login procedure!
 function CHECK_ADMIN_LOGIN ($admin_login, $password) {
        // By default no admin is found
@@ -294,8 +295,9 @@ LIMIT 1", array($act, $wht, $wht), __FUNCTION__, __LINE__);
        // Tableset footer
        LOAD_TEMPLATE("admin_main_footer");
 }
+
 //
-function ADD_ADMIN_MENU($act, $wht, $return=false) {
+function ADD_ADMIN_MENU ($act, $wht, $return=false) {
        // Init variables
        $SUB = false;
        $OUT = "";
@@ -320,7 +322,7 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) {
                        $GLOBALS['menu']['description'] = unserialize(base64_decode($data['descr'][0]));
 
                        // Return or output content?
-                       if ($return) {
+                       if ($return === true) {
                                return $OUT;
                        } else {
                                OUTPUT_HTML($OUT);
@@ -333,6 +335,7 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) {
        if (SQL_NUMROWS($result_main) > 0) {
                $OUT = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"admin_menu_main\">
 <tr><td colspan=\"2\" height=\"7\" class=\"seperator\">&nbsp;</td></tr>\n";
+               // @TODO Rewrite this to $content = SQL_FETCHARRAY()
                while (list($menu, $title, $descr) = SQL_FETCHROW($result_main)) {
                        if ((EXT_IS_ACTIVE("admins")) && (GET_EXT_VERSION("admins") > "0.2")) {
                                $ACL = ADMINS_CHECK_ACL($menu, "");
@@ -375,6 +378,7 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) {
        <td width=\"10\" class=\"seperator\">&nbsp;</td>
        <td class=\"admin_menu\">
                <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"admin_menu_sub\">\n";
+                                       // @TODO Rewrite this to $content = SQL_FETCHARRAY()
                                        while (list($wht_sub, $title_what, $desc_what) = SQL_FETCHROW($result_what)) {
                                                // Filename
                                                $INC = sprintf("inc/modules/admin/what-%s.php", $wht_sub);
@@ -463,34 +467,37 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) {
        } // END - if
 
        // Return or output content?
-       if ($return) {
+       if ($return === true) {
                return $OUT;
        } else {
                OUTPUT_HTML($OUT);
        }
 }
-//
-function ADD_MEMBER_SELECTION_BOX ($def="0", $add_all=false, $return=false, $none=false, $field="userid")
-{
+
+// Create member selection box
+function ADD_MEMBER_SELECTION_BOX ($def="0", $add_all=false, $return=false, $none=false, $field="userid") {
        // Output selection form with all confirmed user accounts listed
        $result = SQL_QUERY("SELECT userid, surname, family FROM `{!_MYSQL_PREFIX!}_user_data` ORDER BY userid", __FUNCTION__, __LINE__);
+
+       // Default output
        $OUT = "";
 
        // USe this only for adding points (e.g. adding refs really makes no sence ;-) )
-       if ($add_all) $OUT = "      <option value=\"all\">".ALL_MEMBERS."</option>\n";
-        elseif ($none) $OUT = "      <option value=\"0\">".SELECT_NONE."</option>\n";
-       while (list($id, $sname, $fname) = SQL_FETCHROW($result))
-       {
-               $OUT .= "      <option value=\"".bigintval($id)."\"";
-               if ($def == $id) $OUT .= " selected=\"selected\"";
-               $OUT .= ">".$sname." ".$fname." (".bigintval($id).")</option>\n";
-       }
+       if ($add_all === true)   $OUT = "      <option value=\"all\">{--ALL_MEMBERS--}</option>\n";
+        elseif ($none === true) $OUT = "      <option value=\"0\">{--SELECT_NONE--}</option>\n";
+
+       while ($content = SQL_FETCHARRAY($result)) {
+               $OUT .= "      <option value=\"".bigintval($content['userid'])."\"";
+               if ($def == $content['userid']) $OUT .= " selected=\"selected\"";
+               $OUT .= ">".$content['surname']." ".$content['family']." (".bigintval($content['userid']).")</option>\n";
+       } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
 
        if (!$return) {
                // Remeber options in constant
+               // @TODO Rewrite these both constants
                define('_MEMBER_SELECTION', $OUT);
 
                // Display selection box
@@ -503,18 +510,20 @@ function ADD_MEMBER_SELECTION_BOX ($def="0", $add_all=false, $return=false, $non
                return "<select class=\"admin_select\" name=\"".$field."\" size=\"1\">\n".$OUT."</select>\n";
        }
 }
-//
-function ADMIN_MENU_SELECTION($MODE, $default="", $defid="") {
+
+// Create a menu selection box for given menu system
+function ADMIN_MENU_SELECTION ($MODE, $default="", $defid="") {
        $wht = "`what` != ''";
        if ($MODE == "action") $wht = "(what='' OR `what` IS NULL) AND action !='login'";
        $result = SQL_QUERY_ESC("SELECT %s, title FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE ".$wht." ORDER BY `sort`",
-        array($MODE), __FUNCTION__, __LINE__);
+               array($MODE), __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // Load menu as selection
                $OUT = "<select name=\"".$MODE."_menu";
                if ((!empty($defid)) || ($defid == "0")) $OUT .= "[".$defid."]";
                $OUT .= "\" size=\"1\" class=\"admin_select\">
-       <option value=\"\">".SELECT_NONE."</option>\n";
+       <option value=\"\">{--SELECT_NONE--}</option>\n";
+               // @TODO Try to rewrite this to $content = SQL_FETCHARRAY(). Please look some lines above for the dynamic query
                while (list($menu, $title) = SQL_FETCHROW($result)) {
                        $OUT .= "  <option value=\"".$menu."\"";
                        if ((!empty($default)) && ($default == $menu)) $OUT .= " selected=\"selected\"";
@@ -784,7 +793,7 @@ function ADMIN_SEND_BUILD_MAILS ($mode, $table, $content, $id, $subjectPart="")
        // Is the raw userid set?
        if (REQUEST_POST('uid_raw', $id) > 0) {
                // Generate subject
-               $subjectLine = constant('MEMBER_'.strtoupper($subject).'_'.strtoupper($table).'_SUBJECT');
+               $subjectLine = getMessage('MEMBER_'.strtoupper($subject).'_'.strtoupper($table).'_SUBJECT');
 
                // Load email template
                if (!empty($subjectPart)) {
@@ -798,7 +807,7 @@ function ADMIN_SEND_BUILD_MAILS ($mode, $table, $content, $id, $subjectPart="")
        } // END - if
 
        // Generate subject
-       $subjectLine = constant('ADMIN_'.strtoupper($subject).'_'.strtoupper($table).'_SUBJECT');
+       $subjectLine = getMessage('ADMIN_'.strtoupper($subject).'_'.strtoupper($table).'_SUBJECT');
 
        // Send admin notification out
        if (!empty($subjectPart)) {
index ed718d4..ea55318 100644 (file)
@@ -360,7 +360,7 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
                // Load final template
                LOAD_TEMPLATE("admin_overview_list");
        } else {
-               if ((isset($POST['task'])) && ((sizeof($POST['task']) > 0) || ($POST['task'][0] == "1"))) {
+               if ((isset($POST['task'])) && ((count($POST['task']) > 0) || ($POST['task'][0] == "1"))) {
                        // Only unassign / delete tasks when there are selected tasks posted
                        if (!empty($POST['unassign'])) {
                                // Unassign from tasks
@@ -378,62 +378,64 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
 
                        // Update query
                        $result_tasks = SQL_QUERY_ESC("SELECT id, assigned_admin, userid, task_type, subject, text, task_created FROM `{!_MYSQL_PREFIX!}_task_system` WHERE assigned_admin=%s OR (assigned_admin=0 AND `status`='NEW') ORDER BY task_created DESC",
-                        array(GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
+                               array(GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
                } // END - if
 
                // There are uncompleted jobs!
+               // @TODO Rewrite this to one template and use $OUT = ...
                LOAD_TEMPLATE("admin_overview_header");
-               $SW = 2;
-               while (list($id, $admin, $uid, $type, $subj, $text, $created) = SQL_FETCHROW($result_tasks)) {
+               $OUT = ""; $SW = 2;
+               while ($content = SQL_FETCHARRAY($result_tasks)) {
                        // Init infos
-                       $infos = "---";
+                       $content['infos'] = "---";
 
                        // Generate assign link
-                       $admin = GENERATE_AID_LINK($admin);
-
-                       // Get task type
-                       $type_out = constant('ADMIN_TASK_IS_'.strtoupper($type).'');
+                       $content['assigned_admin'] = GENERATE_AID_LINK($content['assigned_admin']);
 
-                       $type2 = substr($text, 0, strpos($text, ":"));
                        // Generate infos
-                       switch ($type)
+                       switch ($content['task_type'])
                        {
                        case "EXTENSION":
                        case "EXTENSION_UPDATE":
-                               $infos = substr($subj, 1, strpos($subj, ":") - 1);
+                               $content['infos'] = substr($content['subject'], 1, strpos($content['subject'], ":") - 1);
                                break;
                        }
 
-                       if ($uid > 0) {
+                       // Get task type
+                       $content['task_type_msg'] = getMessage('ADMIN_TASK_IS_'.strtoupper($content['task_type']).'');
+
+                       if ($content['userid'] > 0) {
                                // Member found otherwise it's a system task
-                               $uid = ADMIN_USER_PROFILE_LINK($uid);
+                               $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']);
                        } else {
-                               $uid = "<em>{--ADMIN_IS_SYSTEM_TASK--}</em>";
+                               $content['userid'] = "<em>{--ADMIN_IS_SYSTEM_TASK--}</em>";
                        }
 
                        // Prepare content
-                       $content = array(
+                       // @TODO Rewritings: admin->assigned_admin,uid->userid,type->task_type_msg in template
+                       $content = merge_array($content, array(
                                'sw'      => $SW,
-                               'id'      => $id,
-                               'admin'   => $admin,
-                               'infos'   => $infos,
-                               'uid'     => $uid,
-                               'type'    => $type_out,
-                               'created' => MAKE_DATETIME($created, "2")
-                       );
+                               'admin'   => $content['assigned_admin'],
+                               'uid'     => $content['userid'],
+                               'type'    => $content['task_type_msg'],
+                               'created' => MAKE_DATETIME($content['task_created'], "2")
+                       ));
 
                        // Do we have extension task?
-                       if (($type == "EXTENSION") && (GET_EXT_VERSION($infos) == "")) {
+                       if (($content['task_type'] == "EXTENSION") && (GET_EXT_VERSION($content['infos']) == "")) {
                                // Load extension row template
+                               // @TODO Rewrite this to $OUT .= ..., true, ...
                                LOAD_TEMPLATE("admin_overview_list_ext_rows", false, $content);
                        } else {
                                // Load default row template
+                               // @TODO Rewrite this to $OUT .= ..., true, ...
                                LOAD_TEMPLATE("admin_overview_list_rows", false, $content);
                        }
 
                        // Switch color
                        $SW = 3 - $SW;
                }
+
                // Free memory
                SQL_FREERESULT($result_tasks);
 
index 08019d9..250fbda 100644 (file)
@@ -46,26 +46,30 @@ if (!REQUEST_ISSET_GET(('uid'))) REQUEST_SET_GET('uid', "");
 if (REQUEST_GET('uid') == "all") {
        // Add points to all accounts
        if ((IS_FORM_SENT()) && (REQUEST_POST('points') > 0)) {
+               // @TODO Rewrite this constant
                define('__POINTS_VALUE', REQUEST_POST('points'));
-               $result_main = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' ORDER BY userid", __FILE__, __LINE__);
-               while (list($uid) = SQL_FETCHROW($result_main)) {
+
+               // Select all users
+               $result_main = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' ORDER BY userid",
+                       __FILE__, __LINE__);
+
+               // Process all entries
+               while ($content = SQL_FETCHROW($result_main)) {
                        // Remove depth to prevent booking errors. This is a bad coding
                        // practice, thats also why we need to write this project from
                        // scratch...
                        $GLOBALS['ref_level'] = -1;
 
                        // Ok, add points and send an email to him...
-                       ADD_POINTS_REFSYSTEM("admin_all", $uid, bigintval(REQUEST_POST('points')), false, "0", false, "direct");
+                       ADD_POINTS_REFSYSTEM("admin_all", $content['userid'], bigintval(REQUEST_POST('points')), false, "0", false, "direct");
 
                        // Prepare content
-                       $content = array(
-                               'text'   => SQL_ESCAPE(REQUEST_POST('reason')),
-                               'points' => bigintval(REQUEST_POST('points'))
-                       );
+                       $content['text']   = SQL_ESCAPE(REQUEST_POST('reason'));
+                       $content['points'] = bigintval(REQUEST_POST('points'));
 
                        // Load email template and send email away
-                       $msg = LOAD_EMAIL_TEMPLATE("add-points", $content, bigintval($uid));
-                       SEND_EMAIL(bigintval($uid), getMessage('ADMIN_ADD_SUBJ'), $msg);
+                       $msg = LOAD_EMAIL_TEMPLATE("add-points", $content, bigintval($content['userid']));
+                       SEND_EMAIL(bigintval($content['userid']), getMessage('ADMIN_ADD_SUBJ'), $msg);
                } // END - while
 
                // Free memory
@@ -108,6 +112,7 @@ if (REQUEST_GET('uid') == "all") {
                        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_POINTS_ADDED'));
                } else {
                        // Opps, missing form here
+                       // @TODO Rewrite these both constants
                        define('__USER_VALUE', "<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$sname." ".$fname."</a>");
                        define('__UID'       , bigintval(REQUEST_GET('uid')));
                        LOAD_TEMPLATE("admin_add_points");
index ccb2d88..9be586c 100644 (file)
@@ -73,17 +73,17 @@ VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s')",
 
                if (!empty($id)) {
                        // Reload to prices...
-                       LOAD_URL("modules.php?module=admin&amp;what=config_rallye_prices&rallye=".$id);
+                       LOAD_URL("modules.php?module=admin&amp;what=config_rallye_prices&amp;rallye=".$id);
                } else {
                        // Problem detected...
-                       LOAD_TEMPLATE("admin_settings_saved", false, RALLYE_PROBLEM_CREATE);
+                       LOAD_TEMPLATE("admin_settings_saved", false, getMessage('RALLYE_PROBLEM_CREATE'));
                }
        } else {
                // Free memory
                SQL_FREERESULT($result);
 
                // Overlapping detected
-               LOAD_TEMPLATE("admin_settings_saved", false, RALLYE_OVERLAP_TIMES);
+               LOAD_TEMPLATE("admin_settings_saved", false, getMessage('RALLYE_OVERLAP_TIMES'));
        }
 }
 
index 5d12319..fe31490 100644 (file)
@@ -52,25 +52,24 @@ if (!IS_FORM_SENT())
 
        // Get all available main menus
        $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (what='' OR `what` IS NULL) ORDER BY `sort`", __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) > 0)
-       {
+       if (SQL_NUMROWS($result) > 0) {
                // Read menu structure
-               while (list($act, $title, $sort) = SQL_FETCHROW($result))
-               {
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Menu actions
-                       $menus[] = $act;
+                       $menus[] = $content['action'];
 
                        // Menu titles
-                       $titles[] = $title;
+                       $titles[] = $content['title'];
 
                        // Below this menu point should the new be added so we simply increase the sort value by 1 :-)
-                       $below[] = $sort + 1;
-               }
+                       $below[] = $content['sort'] + 1;
+               } // END - while
 
                // Free memory
                SQL_FREERESULT($result);
 
                // Remove double eintries
+               // @TODO This can be somehow rewritten to a function
                $prev = ""; $dmy = $menus; $dmy2 = $titles; $dmy3 = $below;
                foreach ($menus as $key => $value)
                {
@@ -87,47 +86,45 @@ if (!IS_FORM_SENT())
                }
                $menus = $dmy; $titles = $dmy2; $below = $dmy3;
                // Load sub menus :)
-               foreach ($menus as $key_main => $value_main)
-               {
+               foreach ($menus as $key_main => $value_main) {
                        $result = SQL_QUERY_ESC("SELECT what, title, sort FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
-                        array($value_main), __FILE__, __LINE__);
-                       if (SQL_NUMROWS($result) > 0)
-                       {
+                               array($value_main), __FILE__, __LINE__);
+                       if (SQL_NUMROWS($result) > 0) {
+                               // Init arrays
                                $menus[$value_main] = array();
                                $titles[$value_main] = array();
                                $below[$value_main] = array();
+
                                // Read menu structure
-                               while (list($act, $title, $sort) = SQL_FETCHROW($result))
-                               {
+                               while ($content = SQL_FETCHROW($result)) {
                                        // Menu actions
-                                       $menus[$value_main][] = $act;
+                                       $menus[$value_main][] = $content['action'];
 
                                        // Menu titles
-                                       $titles[$value_main][] = $title;
+                                       $titles[$value_main][] = $content['title'];
 
                                        // Below this menu point should the new be added so we simply increase the sort value by 1 :-)
-                                       $below[$value_main][] = $sort + 1;
-                               }
+                                       $below[$value_main][] = $content['sort'] + 1;
+                               } // END - while
 
                                // Free memory
                                SQL_FREERESULT($result);
 
                                // Remove double eintries
+                               // @TODO This can be somehow rewritten to a function
                                $prev = ""; $dmy = $menus[$value_main]; $dmy2 = $titles[$value_main]; $dmy3 = $below[$value_main];
-                               foreach ($menus[$value_main] as $key => $value)
-                               {
-                                       if ($value == $prev)
-                                       {
+                               foreach ($menus[$value_main] as $key => $value) {
+                                       if ($value == $prev) {
                                                unset($dmy[$key]);
                                                unset($dmy2[$key]);
                                                unset($dmy3[$key]);
-                                       }
-                                        else
-                                       {
+                                       } else {
                                                $prev = $value;
                                        }
                                }
-                               $menus[$value_main] = $dmy; $titles[$value_main] = $dmy2; $below[$value_main] = $dmy3;
+                               $menus[$value_main] = $dmy;
+                               $titles[$value_main] = $dmy2;
+                               $below[$value_main] = $dmy3;
                        }
                }
        }
index 1abebd0..bda8f3a 100644 (file)
@@ -242,43 +242,48 @@ WHERE ".$AND." AND id=%s LIMIT 1",
 
        $max = SQL_NUMROWS($result);
        if ($max > 0) {
+               // @TODO Rewrite this constant
                define('__SUB_VALUE', $SUB);
-               $SW  = 2;
-               $cnt = 0;
-               $OUT = "";
-               while (list($id, $act, $wht, $title, $sort) = SQL_FETCHROW($result)) {
+
+               // Init variables
+               $OUT = ""; $SW  = 2; $cnt = 0;
+
+               // Process all entries
+               while ($content = SQL_FETCHARRAY($result)) {
+                       // Count this entry
                        $cnt++;
-                       if (($sort == 0) || (($sort == 1) && (!empty($SUB)))) {
+
+                       // Init navigation variable
+                       $content['navi'] = "";
+                       if (($content['sort'] == 0) || (($content['sort'] == 1) && (!empty($SUB)))) {
                                // Is highest position
-                               $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$act."&amp;w=".$wht."&amp;tid=".($sort+1)."&amp;fid=".$sort."\">{--LOWER--}</a>";
+                               $content['navi'] = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$content['action']."&amp;w=".$content['what']."&amp;tid=".($content['sort']+1)."&amp;fid=".$content['sort']."\">{--LOWER--}</a>";
                        } elseif ($cnt == $max) {
                                // Is lowest position
-                               $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$act."&amp;w=".$wht."&amp;tid=".($sort-1)."&amp;fid=".$sort."\">{--HIGHER--}</a>";
-                       } elseif ($sort > 0) {
+                               $content['navi'] = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$content['action']."&amp;w=".$content['what']."&amp;tid=".($content['sort']-1)."&amp;fid=".$content['sort']."\">{--HIGHER--}</a>";
+                       } elseif ($content['sort'] > 0) {
                                // Anything else between highest and lowest
-                               $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$act."&amp;w=".$wht."&amp;tid=".($sort-1)."&amp;fid=".$sort."\">{--HIGHER--}</a>/<a href=\"{!URL!}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$act."&amp;w=".$wht."&amp;tid=".($sort+1)."&amp;fid=".$sort."\">{--LOWER--}</a>";
+                               $content['navi'] = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$content['action']."&amp;w=".$content['what']."&amp;tid=".($content['sort']-1)."&amp;fid=".$content['sort']."\">{--HIGHER--}</a>/<a href=\"{!URL!}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$content['action']."&amp;w=".$content['what']."&amp;tid=".($content['sort']+1)."&amp;fid=".$content['sort']."\">{--LOWER--}</a>";
                        }
 
-                       if (empty($act))   $act   = "&nbsp;";
-                       if (empty($wht))   $wht   = "&nbsp;";
-                       if (empty($title)) $title = "&nbsp;";
+                       // Fix empty elements for constant (fixes display bugs in Firefox)
+                       if (empty($content['action'])) $content['action'] = "&nbsp;";
+                       if (empty($content['what']))   $content['what']   = "&nbsp;";
+                       if (empty($content['title']))  $content['title']  = "&nbsp;";
 
-                       $content = array(
-                               'sw'     => $SW,
-                               'id'     => $id,
-                               'action' => $act,
-                               'what'   => $wht,
-                               'title'  => $title,
-                               'navi'   => $NAVI,
-                               'mode'   => "admin",
-                       );
+                       // Add more data to $content
+                       $content['sw']   = $SW;
+                       $content['mode'] = "admin";
 
+                       // Load row template and switch colors
                        $OUT .= LOAD_TEMPLATE("admin_menu_overview_row", true, $content);
                        $SW = 3 - $SW;
-               }
+               } // END - switch
 
                // Free memory
                SQL_FREERESULT($result);
+
+               // Rewrite this constant
                define('__MENU_ROWS', $OUT);
 
                // Load template
index 57190ff..bd6a36d 100644 (file)
@@ -56,7 +56,7 @@ if (REQUEST_ISSET_GET('admin')) {
 if ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
        // Edit account(s)
        ADMINS_EDIT_ADMIN_ACCOUNTS(REQUEST_POST_ARRAY());
-} elseif ((REQUEST_ISSET_POST(('change'))) && (sizeof(REQUEST_POST('login')) > 0)) {
+} elseif ((REQUEST_ISSET_POST(('change'))) && (count(REQUEST_POST('login')) > 0)) {
        // Change admin accounts
        ADMINS_CHANGE_ADMIN_ACCOUNT(REQUEST_POST_ARRAY());
 } elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
index fe95d6e..542a264 100644 (file)
@@ -40,34 +40,32 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 // Add description as navigation point
 ADD_DESCR("admin", __FILE__);
 
-if (REQUEST_ISSET_POST('edit'))
-{
+if (REQUEST_ISSET_POST('edit')) {
        // Check if entires are checked
        $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
-       if ($SEL > 0)
-       {
+       if ($SEL > 0) {
                // Add option for events
                $GLOBALS['cache_array']['admins'] = ADD_OPTION_LINES("admins", "id", "login", "", "email");
                $SW = 2; $rowNameS = "";
                foreach (REQUEST_POST('sel') as $template => $sel) {
                        // First of all load data from DB
                        $result = SQL_QUERY_ESC("SELECT admin_id, id FROM `{!_MYSQL_PREFIX!}_admins_mails` WHERE mail_template='%s' ORDER BY `id`",
-                        array($template), __FILE__, __LINE__);
-                       $OUT = ""; $aid = 0; $aid2 = 0;
-                       while (list($aid, $id) = SQL_FETCHROW($result)) {
+                               array($template), __FILE__, __LINE__);
+                       $OUT = ""; $aid2 = 0;
+                       while ($content = SQL_FETCHARRAY($result)) {
                                // @TODO Can this be rewritten???
-                               $OUT .= "<select name=\"admin_id[".$id."]\" size=\"1\" class=\"admin_select\">
+                               $OUT .= "<select name=\"admin_id[".$content['id']."]\" size=\"1\" class=\"admin_select\">
 <option value=\"0\"";
-                               if ($aid == "0") $OUT .= " selected=\"selected\"";
+                               if ($content['admin_id'] == "0") $OUT .= " selected=\"selected\"";
                                $OUT .=">{--ADMINS_ALL_ADMINS--}</option>\n";
                                if (EXT_IS_ACTIVE("events")) {
                                        $OUT .= "<option value=\"-1\"";
-                                       if ($aid == "-1") $OUT .= " selected=\"selected\"";
+                                       if ($content['admin_id'] == "-1") $OUT .= " selected=\"selected\"";
                                        $OUT .= ">{--ADMINS_TO_USER_EVENTS--}</option>\n";
                                }
-                               $OUT .= ADD_OPTION_LINES("admins", "id", "login", $aid, "email");
-                               $OUT .= "</select><br />\n";
-                               $aid2 = $aid; $id2 = $id;
+                               $OUT .= ADD_OPTION_LINES("admins", "id", "login", $content['admin_id'], "email");
+                               $OUT .= "</select>\n<br />\n";
+                               $aid2 = $content['admin_id']; $id2 = $content['id'];
                        }
 
                        // Free memory
@@ -81,11 +79,11 @@ if (REQUEST_ISSET_POST('edit'))
                                'admins'  => $GLOBALS['cache_array']['admins']
                        );
 
-                       if ($aid2 > 0)
-                       {
+                       if ($aid2 > 0) {
                                // Add form for an additional admin
                                $OUT .= LOAD_TEMPLATE("admin_admins_mails_edit_form", true, $content);
                        }
+
                        // Save full rendered content
                        $content['content'] = $OUT;
 
@@ -93,19 +91,17 @@ if (REQUEST_ISSET_POST('edit'))
                        $rowNameS .= LOAD_TEMPLATE("admin_admins_mails_edit_row", true, $content);
                        $SW = 3 - $SW;
                }
+
+               // @TODO Rewrite this constant
                define('__ADMINS_ROWS', $rowNameS);
 
                // Edit checked entries
                LOAD_TEMPLATE("admin_admins_mails_edit");
-       }
-        else
-       {
+       } else {
                // Nothing selected
                LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMINS_NO_MAIL_CHECKED'));
        }
-}
- else
-{
+} else {
        // Load all assigned mails
        $result = SQL_QUERY("SELECT DISTINCT m.id, m.admin_id, a.login, m.mail_template
 FROM `{!_MYSQL_PREFIX!}_admins_mails` AS m
@@ -114,41 +110,44 @@ ON m.admin_id=a.id
 WHERE (m.admin_id=a.id OR m.admin_id < 1) AND m.mail_template != ''
 ORDER BY m.admin_id, m.mail_template", __FILE__, __LINE__);
 
-       if (SQL_NUMROWS($result) > 0)
-       {
+       if (SQL_NUMROWS($result) > 0) {
                // Shall I change entries?
-               if (REQUEST_ISSET_POST(('change')))
-               {
+               if (REQUEST_ISSET_POST(('change'))) {
+                       // Init SQLs
+                       INIT_SQLS();
+
                        // Ok, update database
-                       foreach (REQUEST_POST('admin_id') as $id => $aid) {
+                       foreach (REQUEST_POST('admin_id') as $id => $content['admin_id']) {
                                // Secure IDs
                                $id  = bigintval($id);
-                               $aid = bigintval($aid);
+                               $content['admin_id'] = bigintval($content['admin_id']);
 
                                // Update entry
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins_mails` SET admin_id=%s WHERE id=%s ORDER BY `id` LIMIT 1",
-                                       array($aid, $id), __FILE__, __LINE__);
+                               ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins_mails` SET admin_id=%s WHERE id=%s ORDER BY `id` LIMIT 1",
+                                       array($content['admin_id'], $id), __FILE__, __LINE__, false));
 
-                               if (($aid < 1) && (REQUEST_ISSET_POST(('template', $id))))
-                               {
+                               if (($content['admin_id'] < 1) && (REQUEST_ISSET_POST(('template', $id)))) {
                                        // Remove any other admin entries
-                                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admins_mails` WHERE mail_template='%s' AND id != '%s'",
-                                               array(REQUEST_POST('template', $id), $id), __FILE__, __LINE__);
+                                       ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admins_mails` WHERE mail_template='%s' AND id != '%s'",
+                                               array(REQUEST_POST('template', $id), $id), __FILE__, __LINE__, false));
                                }
-                               if (REQUEST_POST('admin_new', REQUEST_POST('template', $id)) > 0)
-                               {
+
+                               if (REQUEST_POST('admin_new', REQUEST_POST('template', $id)) > 0) {
                                        // Add new admin
-                                       SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_admins_mails` (admin_id, mail_template) VALUES ('%s','%s')",
-                                               array($aid, REQUEST_POST('template', $id)), __FILE__, __LINE__);
+                                       ADD_SQL(SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_admins_mails` (admin_id, mail_template) VALUES ('%s','%s')",
+                                               array($content['admin_id'], REQUEST_POST('template', $id)), __FILE__, __LINE__, false));
                                }
                        }
 
+                       // Run all queries
+                       runFilterChain('run_sqls');
+
                        // Query again...
                        $result = SQL_QUERY("SELECT DISTINCT m.id, m.admin_id, a.login, m.mail_template FROM `{!_MYSQL_PREFIX!}_admins_mails` AS m, `{!_MYSQL_PREFIX!}_admins` AS a WHERE m.admin_id=a.id OR m.admin_id < 1 ORDER BY m.admin_id", __FILE__, __LINE__);
                }
 
                // List found entries
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
                while ($data = SQL_FETCHARRAY($result)) {
                        // Prepare content
                        $content = array(
@@ -165,6 +164,8 @@ ORDER BY m.admin_id, m.mail_template", __FILE__, __LINE__);
 
                // Free result
                SQL_FREERESULT($result);
+
+               // @TODO Rewrite this constant
                define('__MAILS_ROWS', $OUT);
 
                // Load template
index 8001828..78ab8bc 100644 (file)
@@ -48,20 +48,23 @@ ORDER BY userid ASC", __FILE__, __LINE__);
 
 if (SQL_NUMROWS($result) > 0) {
        // We have some (new?) registrations!
-       $SW = 2; $OUT = "";
-       while (list($uid, $gender, $sname, $fname, $email, $IP, $ref, $hash) = SQL_FETCHROW($result)) {
-               if ($ref > 0) $ref = ADMIN_USER_PROFILE_LINK($ref);
+       $OUT = ""; $SW = 2;
+       while ($content = SQL_FETCHARRAY($result)) {
+               // Add link to refid
+               if ($content['refid'] > 0) $content['refid'] = ADMIN_USER_PROFILE_LINK($content['refid']);
+
                // Prepare array for the row template
+               // @TODO Rewritings: sname->surname,fname->family,ip->REMOTE_ADDR,ref->refid,hash->user_hash in template
                $content = array(
                        'sw'     => $SW,
-                       'gender' => TRANSLATE_GENDER($gender),
-                       'sname'  => $sname,
-                       'fname'  => $fname,
-                       'email'  => "<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$email."</a>",
-                       'ip'     => $IP,
-                       'ref'    => $ref,
-                       'hash'   => $hash,
-                       'link'   => ADMIN_USER_PROFILE_LINK($uid),
+                       'gender' => TRANSLATE_GENDER($content['gender']),
+                       'sname'  => $content['surname'],
+                       'fname'  => $content['family'],
+                       'email'  => "<a href=\"".CREATE_EMAIL_LINK($content['email'], "user_data")."\">".$content['email']."</a>",
+                       'ip'     => $content['REMOTE_ADDR'],
+                       'ref'    => $content['refid'],
+                       'hash'   => $content['user_hash'],
+                       'link'   => ADMIN_USER_PROFILE_LINK($content['userid']),
                );
 
                // Load row template and switch color
@@ -70,6 +73,7 @@ if (SQL_NUMROWS($result) > 0) {
        }
 
        // Remember rows
+       // @TODO Rewrite this constant
        define('__REG_ROWS', $OUT);
 
        // Load main template
index 89a973b..830c6f7 100644 (file)
@@ -45,7 +45,7 @@ if (REQUEST_ISSET_POST('sel')) $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
 
 if ((REQUEST_ISSET_POST('edit')) && ($SEL > 0)) {
        // Edit ACLs
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        foreach (REQUEST_POST('sel') as $id => $selected) {
                // Load data for the ID
                $result = SQL_QUERY_ESC("SELECT admin_id, action_menu, what_menu, access_mode FROM `{!_MYSQL_PREFIX!}_admins_acls` WHERE id=%s LIMIT 1",
@@ -105,7 +105,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($SEL > 0)) {
        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_ADMINS_ENTRIES_CHANGED'));
 } elseif ((REQUEST_ISSET_POST('del')) && ($SEL > 0)) {
        // Delete ACLs
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        foreach (REQUEST_POST('sel') as $id => $selected) {
                // Load data for the ID
                $result = SQL_QUERY_ESC("SELECT admin_id, action_menu, what_menu, access_mode FROM `{!_MYSQL_PREFIX!}_admins_acls` WHERE id=%s LIMIT 1",
@@ -216,27 +216,25 @@ VALUES ('%s','%s','%s','%s')",
 } else {
        // List all ACLs
        $result_acls = SQL_QUERY("SELECT id, admin_id, action_menu, what_menu, access_mode FROM `{!_MYSQL_PREFIX!}_admins_acls` ORDER BY admin_id, id", __FILE__, __LINE__);
-       if (SQL_NUMROWS($result_acls) > 0)
-       {
+       if (SQL_NUMROWS($result_acls) > 0) {
                // List ACLs
-               $SW = 2; $OUT = "";
-               while (list($id, $admin, $act, $wht, $mode) = SQL_FETCHROW($result_acls))
-               {
+               $OUT = ""; $SW = 2;
+               while ($content = SQL_FETCHARRAY($result_acls)) {
                        // Prepare variables
-                       if (empty($act)) $act = "---";
-                       if (empty($wht))   $wht   = "---";
+                       if (empty($content['action_menu'])) $content['action_menu'] = "---";
+                       if (empty($content['what_menu']))   $content['what_menu']   = "---";
 
                        // Get mode
-                       $mode = constant('ADMINS_'.strtoupper($mode).'_MODE');
+                       $content['access_mode'] = constant('ADMINS_'.strtoupper($content['access_mode']).'_MODE');
 
                        // Prepare data for the row template
                        $content = array(
                                'sw'     => $SW,
-                               'id'     => $id,
-                               'admin'  => GENERATE_AID_LINK($admin),
-                               'action' => $act,
-                               'what'   => $wht,
-                               'mode'   => $mode,
+                               'id'     => $content['id'],
+                               'admin'  => GENERATE_AID_LINK($content['admin_id']),
+                               'action' => $content['action_menu'],
+                               'what'   => $content['what_menu'],
+                               'mode'   => $content['access_mode'],
                        );
 
                        // Load row template and switch colors
index b8ebcf8..4b84498 100644 (file)
@@ -105,7 +105,7 @@ if (REQUEST_ISSET_POST(('add'))) {
        }
 } elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
        // Delete categories
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        foreach (REQUEST_POST('sel') as $id => $value) {
                // Load data of category
                $result = SQL_QUERY_ESC("SELECT cat FROM `{!_MYSQL_PREFIX!}_cats` WHERE id=%s LIMIT 1",
@@ -130,7 +130,7 @@ if (REQUEST_ISSET_POST(('add'))) {
        LOAD_TEMPLATE("admin_del_cats");
 } elseif ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
        // Edit categories
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        foreach (REQUEST_POST('sel') as $id => $value)
        {
                // Load data from the category
@@ -156,29 +156,25 @@ if (REQUEST_ISSET_POST(('add'))) {
 
        // Load main template
        LOAD_TEMPLATE("admin_edit_cats");
-}
- else
-{
+} else {
+       // Init variable here
+       $CATS = "";
+
        // Load all categories
        $result = SQL_QUERY("SELECT id, cat, visible, sort FROM `{!_MYSQL_PREFIX!}_cats` ORDER BY `sort`", __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) > 0)
-       {
+       if (SQL_NUMROWS($result) > 0) {
+               // Init variables
+               $OUT = ""; $SW = 2;
+
                // List already existing categories for editing
-               $SW = 2; $OUT = ""; $CATS = "";
-               while (list($id, $cat, $visible, $sort) = SQL_FETCHROW($result))
-               {
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Prepare data for the row template
-                       $content = array(
-                               'sw'   => $SW,
-                               'id'   => $id,
-                               'cat'  => $cat,
-                               'vis'  => TRANSLATE_YESNO($visible),
-                               'sort' => $sort,
-                       );
+                       $content['sw']  = $SW;
+                       $content['vis'] = TRANSLATE_YESNO($content['visible']);
 
                        // Put cat descriptions into variable for the selection box
-                       if (strlen($cat) > 20) $cat = substr($cat, 0, 17)."...";
-                       $CATS .= "      <option value=\"".$sort."\">".$cat."</option>\n";
+                       if (strlen($content['cat']) > 20) $content['cat'] = substr($content['cat'], 0, 17)."...";
+                       $CATS .= "      <option value=\"".$content['sort']."\">".$content['cat']."</option>\n";
 
                        // Load row template and switch color
                        $OUT .= LOAD_TEMPLATE("admin_config_cats_row", true, $content);
@@ -187,12 +183,15 @@ if (REQUEST_ISSET_POST(('add'))) {
 
                // Free memory
                SQL_FREERESULT($result);
+
+               // @TODO Rewrite this constant
                define('__CAT_ROWS', $OUT);
 
                // Load main template
                LOAD_TEMPLATE("admin_config_cats");
        }
 
+       // @TODO Rewrite this constant
        define('CATS', $CATS);
 
        // Form to add a new category
index 8b94f53..83d061b 100644 (file)
@@ -95,7 +95,7 @@ if (REQUEST_ISSET_POST(('add_max'))) {
        }
 } elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
        // Delete entries
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        foreach (REQUEST_POST('sel') as $id => $value)
        {
                // Load data
@@ -122,7 +122,7 @@ if (REQUEST_ISSET_POST(('add_max'))) {
        LOAD_TEMPLATE("admin_config_email_del");
 } elseif ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
        // Edit entries
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        foreach (REQUEST_POST('sel') as $id => $value) {
                // Load data
                $result = SQL_QUERY_ESC("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE id=%s LIMIT 1",
@@ -147,23 +147,19 @@ if (REQUEST_ISSET_POST(('add_max'))) {
        // Load main template
        LOAD_TEMPLATE("admin_config_email_edit");
 } else {
-       $result = SQL_QUERY("SELECT id, value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` ORDER BY value", __FILE__, __LINE__);
+       $result = SQL_QUERY("SELECT id, value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` ORDER BY value",
+               __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // List already existing entries for editing
-               $SW = 2; $OUT = "";
-               while (list($id, $value, $comment) = SQL_FETCHROW($result)) {
+               $OUT = ""; $SW = 2;
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Prepare data for the row template
-                       $content = array(
-                               'sw'      => $SW,
-                               'id'      => $id,
-                               'value'   => $value,
-                               'comment' => $comment,
-                       );
+                       $content['sw'] = $SW;
 
                        // Load row template and switch color
                        $OUT .= LOAD_TEMPLATE("admin_config_email_row", true, $content);
                        $SW = 3 - $SW;
-               }
+               } // END - while
 
                // Free memory
                SQL_FREERESULT($result);
@@ -171,7 +167,7 @@ if (REQUEST_ISSET_POST(('add_max'))) {
 
                // Load main template
                LOAD_TEMPLATE("admin_config_email");
-       }
+       } // END - if
 
        // Display form
        LOAD_TEMPLATE("admin_add_max");
index 3f3f8ec..3a1af21 100644 (file)
@@ -40,20 +40,17 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 // Add description as navigation point
 ADD_DESCR("admin", __FILE__);
 
+// Init "sub" value
 $sub = "";
 if (REQUEST_ISSET_GET(('sub'))) $sub = REQUEST_GET('sub');
 
 switch ($sub)
 {
-case "": // Output selection table
-       LOAD_TEMPLATE("admin_config_home_main");
-       break;
-
 case "settings": // Settings related to the index page
        if (IS_FORM_SENT()) {
                // Save settings
                ADMIN_SAVE_SETTINGS_POST();
-               OUTPUT_HTML("<a href=\"{!URL!}/modules.php?module=admin&amp;what=config_home&amp;sub=settings\">".ADMIN_CONTINUE_TO_CONFIG."</a>");
+               OUTPUT_HTML("<a href=\"{!URL!}/modules.php?module=admin&amp;what=config_home&amp;sub=settings\">{--ADMIN_CONTINUE_TO_CONFIG--}</a>");
        } else {
                // Prepare data for the template
                $content = array_fill(-1, 60, "");
@@ -76,28 +73,32 @@ FROM `{!_MYSQL_PREFIX!}_guest_menu`
 WHERE `action`='main' AND `what` != '' AND `what` IS NOT NULL AND `locked`='N'
 ORDER BY `sort` ASC", __FILE__, __LINE__);
 
-       $SW = 2; $OUT = ""; $atitle = "";
-       while (list($id, $wht, $wtitle) = SQL_FETCHROW($result)) {
-               $LINK = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=config_home&amp;sub=target&amp;home=".$wht."\">"._IS_NEW_HOME."</a>";
-               if ($wht == getConfig('index_home')) {
+       // Init variables
+       $SW = 2;
+       $OUT = "";
+
+       // Process all entries
+       while ($content = SQL_FETCHARRAY($result)) {
+               // Link for setting 'what' as new "home"
+               $LINK = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=config_home&amp;sub=target&amp;home=".$content['what']."\">{--_IS_NEW_HOME--}</a>";
+
+               // Is this current home?
+               if ($content['what'] == getConfig('index_home')) {
                        // Is current home
-                       $LINK   = "<div class=\"admin_note\">{!_IS_CURRENT_HOME!}</div>";
-                       $atitle = "<div class=\"admin_note\">".$atitle."</div>";
-                       $wtitle = "<div class=\"admin_note\">".$wtitle."</div>";
-               }
-
-               // Add row...
-               $OUT .= "<tr>
-         <td class=\"switch_sw".$SW." bottom right\">&nbsp;".$id."</td>
-         <td class=\"switch_sw".$SW." bottom right\">&nbsp;".$wtitle."</td>
-         <td class=\"switch_sw".$SW." bottom\" align=\"center\">
-           ".$LINK."
-         </td>
-       </tr>\n";
+                       $LINK = "<div class=\"admin_note\">{!_IS_CURRENT_HOME!}</div>";
+                       $content['title'] = "<div class=\"admin_note\">".$content['title']."</div>";
+               } // END - if
+
+               // Prepare content
+               $content['sw'] = $SW;
+               $content['link'] = $LINK;
+
+               // Load row template
+               $OUT .= LOAD_TEMPLATE("admin_config_home_row", true, $content);
 
                // Switch color
                $SW = 3 - $SW;
-       }
+       } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
@@ -106,6 +107,11 @@ ORDER BY `sort` ASC", __FILE__, __LINE__);
        // Load template
        LOAD_TEMPLATE("admin_config_home");
        break;
+
+default: // Output selection table
+       LOAD_TEMPLATE("admin_config_home_main");
+       break;
+
 }
 
 //
index 4b31635..ae0dff0 100644 (file)
@@ -84,13 +84,16 @@ if (REQUEST_ISSET_POST('edit')) {
                REQUEST_UNSET_POST(('change'));
        }
 } elseif (REQUEST_ISSET_POST(('change'))) {
+       // Init SQLs
+       INIT_SQLS();
+
        // Change modules
        foreach (REQUEST_POST('sel') as $id => $sel) {
                // Secure ID number
                $id = bigintval($id);
 
                // Update module
-               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `title`='%s', `locked`='%s', hidden='%s', admin_only='%s', mem_only='%s' WHERE id=%s LIMIT 1",
+               ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `title`='%s', `locked`='%s', hidden='%s', admin_only='%s', mem_only='%s' WHERE id=%s LIMIT 1",
                        array(
                                REQUEST_POST('title', $id),
                                REQUEST_POST('locked', $id),
@@ -98,13 +101,16 @@ if (REQUEST_ISSET_POST('edit')) {
                                REQUEST_POST('admin', $id),
                                REQUEST_POST('member', $id),
                                $id
-                       ),  __FILE__, __LINE__);
+                       ),  __FILE__, __LINE__, false));
        }
 
+       // Run all sqls
+       runFilterChain('run_sqls');
+
        // Remove cache file if version matches
        if (GET_EXT_VERSION("cache") >= "0.1.2") {
                if ($GLOBALS['cache_instance']->loadCacheFile("modreg")) $GLOBALS['cache_instance']->destroyCacheFile();
-       }
+       } // END - if
 
        // Entries updated
        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('MODS_CHANGED'));
@@ -112,28 +118,29 @@ if (REQUEST_ISSET_POST('edit')) {
 
 if ($SEL == 0) {
        // Load module data (We do not need to check if there's at least one...)
-       $result = SQL_QUERY("SELECT id, module, locked, hidden, admin_only, title, mem_only, clicks
+       $result = SQL_QUERY("SELECT id, module, locked, hidden, admin_only, title, mem_only
 FROM `{!_MYSQL_PREFIX!}_mod_reg`
 ORDER BY module", __FILE__, __LINE__);
        $OUT = ""; $SW = 2;
-       while (list($id, $mod, $locked, $hidden, $admin, $title, $mem) = SQL_FETCHROW($result)) {
+       while ($content = SQL_FETCHARRAY($result)) {
                // Reset title to --- if it is NULL
-               if (empty($title)) $title = "---";
-               if (($mod == "index") || ($mod == "login")) {
+               if (empty($content['title'])) $content['title'] = "---";
+               if (($content['module'] == "index") || ($content['module'] == "login")) {
                        // Add link to detail statistics
-                       $mod = "<strong><a href=\"{!URL!}/modules.php?module=admin&amp;what=stats_mods&amp;mod=".$mod."\">".$mod."</a></strong>";
+                       $content['module'] = "<strong><a href=\"{!URL!}/modules.php?module=admin&amp;what=stats_mods&amp;mod=".$content['module']."\">".$content['module']."</a></strong>";
                }
 
                // Prepare array for the template
+               // @TODO Rewritings: mod->module in template
                $content = array(
                        'sw'     => $SW,
-                       'id'     => $id,
-                       'mod'    => $mod,
-                       'title'  => $title,
-                       'locked' => TRANSLATE_YESNO($locked),
-                       'hidden' => TRANSLATE_YESNO($hidden),
-                       'admin'  => TRANSLATE_YESNO($admin),
-                       'mem'    => TRANSLATE_YESNO($mem),
+                       'id'     => $content['id'],
+                       'mod'    => $content['module'],
+                       'title'  => $content['title'],
+                       'locked' => TRANSLATE_YESNO($content['locked']),
+                       'hidden' => TRANSLATE_YESNO($content['hidden']),
+                       'admin'  => TRANSLATE_YESNO($content['admin_only']),
+                       'mem'    => TRANSLATE_YESNO($content['mem_only']),
                );
 
                // Load row template
@@ -145,6 +152,8 @@ ORDER BY module", __FILE__, __LINE__);
 
        // Free memory
        SQL_FREERESULT($result);
+
+       // @TODO Rewrite this constant
        define('__MODS_ROWS', $OUT);
 
        // Load main template
index 3156f0d..e8cd26d 100644 (file)
@@ -80,6 +80,9 @@ $display = true;
 if ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
        // Edit payout types
        if ((REQUEST_ISSET_GET('ok')) && (REQUEST_GET('ok') == "ok")) {
+               // Init SQLs
+               INIT_SQLS();
+
                // Edit entries
                foreach (REQUEST_POST('sel') as $id => $sel) {
                        // Secure ID
@@ -88,7 +91,7 @@ if ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0))
                        // Edit only if something is entered
                        if ((REQUEST_ISSET_POST(('title', $id))) && (REQUEST_POST('rate', $id) > 0)) {
                                // Update entry
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_payout_types` SET
+                               ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_payout_types` SET
 type='%s',
 rate=%s,
 min_points=%s,
@@ -96,20 +99,25 @@ allow_url='%s'
 WHERE id='".$id."' LIMIT 1",
  array(
        REQUEST_POST('title', $id),
-       bigintval(REVERT_COMMA(REQUEST_POST('rate', $id))),
-       bigintval(REVERT_COMMA(REQUEST_POST('mpoi' , $id))),
+       REVERT_COMMA(REQUEST_POST('rate', $id)),
+       REVERT_COMMA(REQUEST_POST('mpoi' , $id)),
        REQUEST_POST('allow', $id),
-),__FILE__, __LINE__);
+),__FILE__, __LINE__, false));
                        }
                }
+
+               // Run all SQLs
+               runFilterChain('run_sqls');
+
+               // Get message
                $msg = getMessage('ADMIN_PAYOUT_ENTRIES_CHANGED');
        } else {
                $display = false; //Suppress any other outputs
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
                foreach (REQUEST_POST('sel') as $id => $sel) {
                        // Load data
                        $result = SQL_QUERY_ESC("SELECT type, rate, min_points, allow_url FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE id=%s LIMIT 1",
-                        array(bigintval($id)), __FILE__, __LINE__);
+                               array(bigintval($id)), __FILE__, __LINE__);
                        list($title, $rate, $mpoi, $allow) = SQL_FETCHROW($result);
                        SQL_FREERESULT($result);
 
@@ -127,6 +135,8 @@ WHERE id='".$id."' LIMIT 1",
                        $OUT .= LOAD_TEMPLATE("admin_config_payouts_edit_row", true, $content);
                        $SW = 3 - $SW;
                }
+
+               // @TODO Rewrite this constant
                define('__PAYOUT_ROWS', $OUT);
 
                // Load main template
@@ -135,22 +145,30 @@ WHERE id='".$id."' LIMIT 1",
 } elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
        // Delete payout types
        if ((REQUEST_ISSET_GET('ok')) && (REQUEST_GET('ok') == "ok")) {
+               // Init SQLs
+               INIT_SQLS();
+
                // Delete entries
                foreach (REQUEST_POST('sel') as $id => $sel) {
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE id=%s LIMIT 1",
-                               array(bigintval($id)), __FILE__, __LINE__);
-               }
+                       ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE id=%s LIMIT 1",
+                               array(bigintval($id)), __FILE__, __LINE__, false));
+               } // END - foreach
+
+               // Run all SQLs
+               runFilterChain('run_sqls');
+
+               // Get message
                $msg = getMessage('ADMIN_PAYOUT_ENTRIES_DELETED');
        } else {
                $display = false; //Suppress any other outputs
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
                foreach (REQUEST_POST('sel') as $id => $sel) {
                        // Secure ID number
                        $id = bigintval($id);
 
                        // Load data
                        $result = SQL_QUERY_ESC("SELECT type, rate, min_points FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE id=%s LIMIT 1",
-                        array($id), __FILE__, __LINE__);
+                               array($id), __FILE__, __LINE__);
                        list($title, $rate, $mpoi) = SQL_FETCHROW($result);
                        SQL_FREERESULT($result);
 
@@ -184,16 +202,16 @@ $result_type = SQL_QUERY("SELECT id, type, rate, min_points, from_account FROM `
 
 if ((SQL_NUMROWS($result_type) > 0) && ($display)) {
        // List all payout types
-       $SW = 2; $OUT = "";
-       while (list($id, $type, $rate, $mpoi, $from) = SQL_FETCHROW($result_type)) {
+       $OUT = ""; $SW = 2;
+       while ($content = SQL_FETCHARRAY($result_type)) {
                // Prepare data for the row template
                $content = array(
                        'sw'    => $SW,
-                       'id'    => $id,
-                       'from'  => COMPILE_CODE($from),
-                       'type'  => COMPILE_CODE($type),
-                       'rate'  => TRANSLATE_COMMA($rate),
-                       'mpoi'  => TRANSLATE_COMMA($mpoi),
+                       'id'    => $content['id'],
+                       'from'  => COMPILE_CODE($content['from_account']),
+                       'type'  => COMPILE_CODE($content['type']),
+                       'rate'  => TRANSLATE_COMMA($content['rate']),
+                       'mpoi'  => TRANSLATE_COMMA($content['min_points']),
                );
 
                // Load row template and switch color
@@ -203,6 +221,8 @@ if ((SQL_NUMROWS($result_type) > 0) && ($display)) {
 
        // Free memory
        SQL_FREERESULT($result_type);
+
+       // @TODO Rewrite this constant
        define('__PAYOUT_ROWS', $OUT);
 
        // Load main template
index 69b4003..5302566 100644 (file)
@@ -196,7 +196,7 @@ WHERE mails_confirmed < %s", $REF, $REF));
        // 12                  3     32    2                  3     32    2               3            4     43    21
        if ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST('sel')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
                // Delete entries
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
                foreach (REQUEST_POST('sel') as $id => $value) {
                        $result = SQL_QUERY_ESC("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE id=%s LIMIT 1",
                                array(bigintval($id)), __FILE__, __LINE__);
@@ -221,7 +221,7 @@ WHERE mails_confirmed < %s", $REF, $REF));
                LOAD_TEMPLATE("admin_points_del");
        } elseif ((REQUEST_ISSET_POST('edit')) && (REQUEST_ISSET_POST('sel')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
                // Edit entries
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
                foreach (REQUEST_POST('sel') as $id => $value) {
                        $result = SQL_QUERY_ESC("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE id=%s LIMIT 1",
                         array(bigintval($id)), __FILE__, __LINE__);
@@ -249,16 +249,17 @@ WHERE mails_confirmed < %s", $REF, $REF));
                $result = SQL_QUERY("SELECT id, level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` ORDER BY level", __FILE__, __LINE__);
                if (SQL_NUMROWS($result) > 0) {
                        // Make referal levels editable and deletable
-                       $SW = 2; $OUT = "";
+                       $OUT = ""; $SW = 2;
 
                        // List already existing categories for editing
-                       while (list($id, $lvl, $perc) = SQL_FETCHROW($result)) {
+                       while ($content = SQL_FETCHARRAY($result)) {
                                // Prepare data for the row template
+                               // @TODO Rewritings: lvl->level, per->percents in template
                                $content = array(
                                        'sw'  => $SW,
-                                       'id'  => $id,
-                                       'lvl' => $lvl,
-                                       'per' => TRANSLATE_COMMA($perc),
+                                       'id'  => $content['id'],
+                                       'lvl' => $content['level'],
+                                       'per' => TRANSLATE_COMMA($content['percents']),
                                );
 
                                // Load row template and switch color
index b1d8d57..41f9c03 100644 (file)
@@ -62,10 +62,10 @@ if (IS_FORM_SENT()) {
 }  else {
        // Prepare data for template output
        $content = array(
-               'min_payout'    => getConfig(('primera_min_payout')),
-               'min_withdraw'  => getConfig(('primera_min_withdraw')),
+               'min_payout'            => getConfig(('primera_min_payout')),
+               'min_withdraw'          => getConfig(('primera_min_withdraw')),
                'api_name'              => getConfig('primera_api_name'),
-               'api_md5'               => getConfig('primera_api_md5'),
+               'api_md5'                       => getConfig('primera_api_md5'),
                'refid'                 => getConfig('primera_refid')
        );
 
index 91fe4c6..761b0be 100644 (file)
@@ -40,19 +40,15 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 // Add description as navigation point
 ADD_DESCR("admin", __FILE__);
 
-if (REQUEST_ISSET_GET(('rallye')))
-{
+if (REQUEST_ISSET_GET(('rallye'))) {
        // Price submitted?
-       if (REQUEST_ISSET_POST(('add')))
-       {
-               if ((REQUEST_ISSET_POST(('level'))) && ((REQUEST_ISSET_POST(('points'))) || (REQUEST_ISSET_POST(('info')))))
-               {
+       if (REQUEST_ISSET_POST(('add'))) {
+               if ((REQUEST_ISSET_POST(('level'))) && ((REQUEST_ISSET_POST(('points'))) || (REQUEST_ISSET_POST(('info'))))) {
                        // Submitted data is valid, but maybe we already have this price level?
                        $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s AND price_level='%s' LIMIT 1",
-                        array(bigintval(REQUEST_GET('rallye')), bigintval(REQUEST_POST('level'))), __FILE__, __LINE__);
+                               array(bigintval(REQUEST_GET('rallye')), bigintval(REQUEST_POST('level'))), __FILE__, __LINE__);
 
-                       if (SQL_NUMROWS($result) == 0)
-                       {
+                       if (SQL_NUMROWS($result) == 0) {
                                // Ok, new price level entered!
                                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_rallye_prices` (rallye_id, price_level, points, info)
 VALUES ('%s','%s','%s','%s')",
@@ -62,15 +58,13 @@ VALUES ('%s','%s','%s','%s')",
        REQUEST_POST('points'),
        REQUEST_POST('info')
 ), __FILE__, __LINE__);
-                               LOAD_TEMPLATE("admin_settings_saved", false, RALLYE_PRICE_LEVEL_SAVED);
-                       }
-                        else
-                       {
+                               LOAD_TEMPLATE("admin_settings_saved", false, getMessage('RALLYE_PRICE_LEVEL_SAVED'));
+                       } else {
                                // Free memory
                                SQL_FREERESULT($result);
 
                                // Price level found!
-                               LOAD_TEMPLATE("admin_settings_saved", false, RALLYE_PRICE_ALREADY_FOUND);
+                               LOAD_TEMPLATE("admin_settings_saved", false, getMessage('RALLYE_PRICE_ALREADY_FOUND'));
                        }
                }
        } elseif (REQUEST_ISSET_POST(('remove'))) {
@@ -84,9 +78,9 @@ VALUES ('%s','%s','%s','%s')",
                        }
 
                        // Output message
-                       LOAD_TEMPLATE("admin_settings_saved", false, RALLYE_ENTRIES_DELETED);
+                       LOAD_TEMPLATE("admin_settings_saved", false, getMessage('RALLYE_ENTRIES_DELETED'));
                } else {
-                       LOAD_TEMPLATE("admin_settings_saved", false, RALLYE_ENTRIES_NOT_DELETED);
+                       LOAD_TEMPLATE("admin_settings_saved", false, getMessage('RALLYE_ENTRIES_NOT_DELETED'));
                }
        } elseif (REQUEST_ISSET_POST(('change'))) {
                // Change entries
@@ -106,7 +100,7 @@ VALUES ('%s','%s','%s','%s')",
                }
 
                // Output message
-               LOAD_TEMPLATE("admin_settings_saved", false, RALLYE_ENTRIES_CHANGED);
+               LOAD_TEMPLATE("admin_settings_saved", false, getMessage('RALLYE_ENTRIES_CHANGED'));
        }
 
        if (REQUEST_ISSET_POST('edit')) {
@@ -114,7 +108,7 @@ VALUES ('%s','%s','%s','%s')",
                $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
                if ($SEL > 0) {
                        // Make selected editable
-                       $SW = 2; $OUT = "";
+                       $OUT = ""; $SW = 2;
                        foreach (REQUEST_POST('sel') as $id => $sel) {
                                // Load data to selected rallye
                                $result = SQL_QUERY_ESC("SELECT rallye_id, price_level, points, info FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE id=%s LIMIT 1",
@@ -143,27 +137,21 @@ VALUES ('%s','%s','%s','%s')",
 
                        // Load main template
                        LOAD_TEMPLATE("admin_config_rallye_edit");
-               }
-                else
-               {
+               } else {
                        // Nothing selected
-                       $content = RALLYE_NO_PRICES_SELECTED_1."<a href=\"{!URL!}/modules.php?module=admin&amp;what=config_rallye_prices&amp;rallye=".REQUEST_GET('rallye')."\">".RALLYE_NO_PRICES_SELECTED_2."</a>".RALLYE_NO_PRICES_SELECTED_3;
+                       $content = sprintf(getMessage('RALLYE_NO_PRICES_SELECTED'), "<a href=\"{!URL!}/modules.php?module=admin&amp;what=config_rallye_prices&amp;rallye=".REQUEST_GET('rallye')."\">", "</a>");
                        LOAD_TEMPLATE("admin_settings_saved", false, $content);
                }
-       }
-        elseif (REQUEST_ISSET_POST('del'))
-       {
+       } elseif (REQUEST_ISSET_POST('del')) {
                // Check if at last one line is selected
                $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
-               if ($SEL > 0)
-               {
+               if ($SEL > 0) {
                        // List all prices
-                       $SW = 2; $OUT = "";
-                       foreach (REQUEST_POST('sel') as $id => $sel)
-                       {
+                       $OUT = ""; $SW = 2;
+                       foreach (REQUEST_POST('sel') as $id => $sel) {
                                // Load data to selected rallye
                                $result = SQL_QUERY_ESC("SELECT rallye_id, price_level, points, info FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE id=%s LIMIT 1",
-                                array(bigintval($id)), __FILE__, __LINE__);
+                                       array(bigintval($id)), __FILE__, __LINE__);
                                list($rallye, $level, $points, $infos) = SQL_FETCHROW($result);
                                SQL_FREERESULT($result);
 
@@ -189,44 +177,42 @@ VALUES ('%s','%s','%s','%s')",
 
                        // Load main template
                        LOAD_TEMPLATE("admin_config_rallye_del");
-               }
-                else
-               {
+               } else {
                        // Nothing selected
                        $content = RALLYE_NO_PRICES_SELECTED_1."<a href=\"{!URL!}/modules.php?module=admin&amp;what=config_rallye_prices&amp;rallye=".REQUEST_GET('rallye')."\">".RALLYE_NO_PRICES_SELECTED_2."</a>".RALLYE_NO_PRICES_SELECTED_3;
                        LOAD_TEMPLATE("admin_settings_saved", false, $content);
                }
-       }
-        else
-       {
+       } else {
                // a rallye was selected, so check if there are already prices assigned...
                $result = SQL_QUERY_ESC("SELECT id, price_level, points, info FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s ORDER BY price_level",
-                array(bigintval(REQUEST_GET('rallye'))), __FILE__, __LINE__);
+                       array(bigintval(REQUEST_GET('rallye'))), __FILE__, __LINE__);
 
-               if (SQL_NUMROWS($result) > 0)
-               {
+               if (SQL_NUMROWS($result) > 0) {
                        // Load all prices for the selected rallye
-                       $SW = 2; $OUT = "";
-                       while (list($id, $level, $points, $infos) = SQL_FETCHROW($result))
-                       {
-                               if (empty($infos)) $infos = "---";
+                       $OUT = ""; $SW = 2;
+                       while ($content = SQL_FETCHARRAY($result)) {
+                               // Fix empty info
+                               if (empty($content['info'])) $content['info'] = "---";
 
                                // Prepare data for the row template
+                               // @TODO Rewritings: level->price_level, infos->info in template
                                $content = array(
                                        'sw'      => $SW,
-                                       'id'      => $id,
-                                       'level'   => $level,
-                                       'points'  => $points,
-                                       'infos'   => $infos,
+                                       'id'      => $content['id'],
+                                       'level'   => $content['price_level'],
+                                       'points'  => $content['points'],
+                                       'infos'   => $content['info'],
                                );
 
                                // Load row template and switch color
                                $OUT .= LOAD_TEMPLATE("admin_config_rallye_prices_row", true, $content);
                                $SW = 3 - $SW;
-                       }
+                       } // END - while
 
                        // Free memory
                        SQL_FREERESULT($result);
+
+                       // @TODO Rewrite these two constants
                        define('__PRICE_ROWS', $OUT);
 
                        // Prepare data for the main template
@@ -246,26 +232,25 @@ VALUES ('%s','%s','%s','%s')",
        $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__);
-       if (SQL_NUMROWS($result) > 0)
-       {
+       if (SQL_NUMROWS($result) > 0) {
                // List found rallyes
-               $SW = 2; $OUT = "";
-               while (list($id, $aid, $start, $end, $title, $alogin, $active) = SQL_FETCHROW($result))
-               {
-                       $select = "<input type=\"checkbox\" name=\"sel[".$id."]\" class=\"admin_normal\" value=\"1\">";
-                       if ($active == "Y") $select = "<div class=\"big\">".$id."</div>";
+               $OUT = ""; $SW = 2;
+               while ($content = SQL_FETCHARRAY($result)) {
+                       $select = "<input type=\"checkbox\" name=\"sel[".$content['id']."]\" class=\"admin_normal\" value=\"1\">";
+                       if ($content['is_active'] == "Y") $select = "<div class=\"big\">".$content['id']."</div>";
 
                        // Prepare data for the row template
+                       // @TODO Rewritings: aid->admin_id, alogin->login in template
                        $content = array(
                                'sw'         => $SW,
-                               'id'         => $id,
+                               'id'         => $content['id'],
                                'select'     => $select,
-                               'title'      => $title,
-                               'aid'        => $aid,
-                               'email_link' => CREATE_EMAIL_LINK($aid),
-                               'alogin'     => $alogin,
-                               'start'      => MAKE_DATETIME($start, "3"),
-                               'end'        => MAKE_DATETIME($end, "3"),
+                               'title'      => $content['title'],
+                               'aid'        => $content['admin_id'],
+                               'email_link' => CREATE_EMAIL_LINK($content['admin_id']),
+                               'alogin'     => $content['login'],
+                               'start'      => MAKE_DATETIME($content['start_time'], "3"),
+                               'end'        => MAKE_DATETIME($content['end_time'], "3"),
                        );
 
                        // Load row template and switch color
@@ -279,11 +264,9 @@ WHERE d.admin_id=a.id ORDER BY start_time DESC", __FILE__, __LINE__);
 
                // Load main template
                LOAD_TEMPLATE("admin_list_rallye_prices");
-       }
-        else
-       {
+       } else {
                // No rallyes setup so far
-               LOAD_TEMPLATE("admin_settings_saved", false, RALLYE_NO_RALLYES_SETUP);
+               LOAD_TEMPLATE("admin_settings_saved", false, getMessage('RALLYE_NO_RALLYES_SETUP'));
        }
 }
 //
index be5aab4..efed69b 100644 (file)
@@ -46,23 +46,30 @@ if (IS_FORM_SENT()) {
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_must_register` SET field_required='%s' WHERE id=%s AND field_required != '%s' LIMIT 1",
                        array($value, bigintval($id), $value),__FILE__, __LINE__);
        }
-       LOAD_TEMPLATE("admin_settings_saved", false, REGISTER_ADMIN_CHANGES_SAVED);
+       LOAD_TEMPLATE("admin_settings_saved", false, getMessage('REGISTER_ADMIN_CHANGES_SAVED'));
 }
 
 // List all register values
 $result = SQL_QUERY("SELECT id, field_name, field_required FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id`", __FILE__, __LINE__);
-$SW = 2; $OUT = "";
-while (list($id, $name, $required) = SQL_FETCHROW($result)) {
-       // Get constant value
-       $name =  constant(strtoupper($name));
+$OUT = ""; $SW = 2;
+while ($content = SQL_FETCHARRAY($result)) {
+       // Get language string
+       $content['field_name'] =  getMessage(strtoupper($content['field_name']));
 
+       // Add more data
+       $content['sw']        = $SW;
+       $content['seleciton'] = ADD_SELECTION("yn", $content['field_required'], "sel[".$content['id']."]");
+
+       // @TODO Move this HTML code into a template
        $OUT .= "<tr>
-  <td align=\"center\" class=\"switch_sw".$SW." bottom2 right2\">".$id."</td>
-  <td class=\"switch_sw".$SW." bottom2 right2\">&nbsp;&nbsp;".$name."</td>
-  <td align=\"center\" class=\"switch_sw".$SW." bottom2 right2\">
-    ".ADD_SELECTION("yn", $required, "sel[".$id."]")."
+  <td align=\"center\" class=\"switch_sw".$content['sw']." bottom2 right2\">".$content['id']."</td>
+  <td class=\"switch_sw".$content['sw']." bottom2 right2\">&nbsp;&nbsp;".$content['field_name']."</td>
+  <td align=\"center\" class=\"switch_sw".$content['sw']." bottom2 right2\">
+    ".$content['selection']."
   </td>
 </tr>\n";
+
+       // Switch color
        $SW = 3 - $SW;
 }
 
@@ -70,6 +77,7 @@ while (list($id, $name, $required) = SQL_FETCHROW($result)) {
 SQL_FREERESULT($result);
 
 // Remember rows in constant
+// @TODO Rewrite this constant
 define('__REGISTER_ROWS', $OUT);
 
 // Load template
index 00bfce4..3da28b7 100644 (file)
@@ -53,20 +53,20 @@ if (IS_FORM_SENT()) {
 
        // Implode array to string and remove posted mod array
        REQUEST_SET_POST('rewrite_skip', implode(":", $MODs));
-       REQUEST_UNSET_POST(('mod'));
+       REQUEST_UNSET_POST('mod');
 
        // Save settings
        ADMIN_SAVE_SETTINGS_POST();
 } else {
        // Load existing modules and generate TR rows for the template
        $result = SQL_QUERY("SELECT module, title FROM `{!_MYSQL_PREFIX!}_mod_reg` ORDER BY module", __FILE__, __LINE__);
-       $SW = 2; $OUT = "";
-       while (list($mod, $title) = SQL_FETCHROW($result)) {
+       $OUT = ""; $SW = 2;
+       while ($content = SQL_FETCHARRAY($result)) {
                // Set title to three dashes when no title is supplied
-               if (empty($title)) $title = "---";
+               if (empty($content['title'])) $content['title'] = "---";
 
                // Already registered module?
-               if (ereg($mod, getConfig('rewrite_skip'))) {
+               if (ereg($content['module'], getConfig('rewrite_skip'))) {
                        // Found
                        $y = " checked=\"checked\"";
                        $n = "";
@@ -77,13 +77,9 @@ if (IS_FORM_SENT()) {
                }
 
                // Remember data in array for the dynamic row template
-               $content = array(
-                       'module'    => $mod,
-                       'title'     => $title,
-                       'y_default' => $y,
-                       'n_default' => $n,
-                       'sw'        => $SW,
-               );
+               $content['y_default'] = $y;
+               $content['n_default'] = $n;
+               $content['sw']        = $SW;
 
                // Load template and switch colors
                $OUT .= LOAD_TEMPLATE("admin_config_rewrite_rows", true, $content);
@@ -92,10 +88,13 @@ if (IS_FORM_SENT()) {
 
        // Free memory
        SQL_FREERESULT($result);
+
+       // @TODO Rewrite this constant
        define('__MODULE_ROWS', $OUT);
 
        // Load main template
        LOAD_TEMPLATE("admin_config_rewrite");
 }
+
 //
 ?>
index 5df9d01..2f3d8e8 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']) || (!IS_ADMIN()))
-{
+if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']) || (!IS_ADMIN())) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
@@ -41,74 +40,75 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']) || (!IS_ADMIN()))
 // Add description as navigation point
 ADD_DESCR("admin", __FILE__);
 
-if (REQUEST_ISSET_POST('del'))
-{
+if (REQUEST_ISSET_POST('del')) {
        // Delete entries from tables
        $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
-       if ($SEL > 0)
-       {
+       if ($SEL > 0) {
+               // Init SQLs
+               INIT_SQLS();
+
                // Delete entries...
-               foreach (REQUEST_POST('sel') as $id => $sel)
-               {
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_transfers_in` WHERE trans_id=%s LIMIT 1",
-                               array(bigintval($id)), __FILE__, __LINE__);
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_transfers_out` WHERE trans_id=%s LIMIT 1",
-                               array(bigintval($id)), __FILE__, __LINE__);
-               }
+               foreach (REQUEST_POST('sel') as $id => $sel) {
+                       ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_transfers_in` WHERE trans_id=%s LIMIT 1",
+                               array(bigintval($id)), __FILE__, __LINE__, false));
+                       ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_transfers_out` WHERE trans_id=%s LIMIT 1",
+                               array(bigintval($id)), __FILE__, __LINE__, false));
+               } // END - foreach
+
+               // Run all SQLs
+               runFilterChain('run_sqls');
        }
 }
 
 // We only need outgoing transfers
 $result = SQL_QUERY("SELECT userid, to_uid, trans_id, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_out` ORDER BY trans_id", __FILE__, __LINE__);
 $total = 0;
-if (SQL_NUMROWS($result) > 0)
-{
+if (SQL_NUMROWS($result) > 0) {
        // Output rows
        $OUT = ""; $SW = 2;
-       while (list($uid1, $uid2, $idx, $points, $reason, $stamp) = SQL_FETCHROW($result))
-       {
+       while ($content = SQL_FETCHARRAY($result)) {
                // Prepare data for the row template
+               // @TODO Rewritings: idx->trans_id in template
                $content = array(
                        'sw'       => $SW,
-                       'idx'      => $idx,
-                       'stamp'    => MAKE_DATETIME($stamp, "3"),
-                       'uid_from' => ADMIN_USER_PROFILE_LINK($uid1),
-                       'uid_to'   => ADMIN_USER_PROFILE_LINK($uid1),
-                       'reason'   => $reason,
-                       'points'   => TRANSLATE_COMMA($points),
+                       'idx'      => $content['trans_id'],
+                       'stamp'    => MAKE_DATETIME($content['time_trans'], "3"),
+                       'uid_from' => ADMIN_USER_PROFILE_LINK($content['userid']),
+                       'uid_to'   => ADMIN_USER_PROFILE_LINK($content['to_uid']),
+                       'reason'   => $content['reason'],
+                       'points'   => TRANSLATE_COMMA($content['points']),
                );
 
                // Load row template
                $OUT .= LOAD_TEMPLATE("admin_del_transfer_row", true, $content);
 
                // Sum points and switch colors
-               $total += $points; $SW = 3 - $SW;
+               $total += $content['points']; $SW = 3 - $SW;
        }
 
        // Free memory
        SQL_FREERESULT($result);
-}
- else
-{
+} else {
        // Nothing for in and out
        $OUT = "<tr>
   <td colspan=\"6\" align=\"center\" class=\"bottom2\" height=\"70\">
-    ".LOAD_TEMPLATE("admin_settings_saved", true, TRANSFER_NO_INOUT_TRANSFERS)."
+    ".LOAD_TEMPLATE("admin_settings_saved", true, getMessage('TRANSFER_NO_INOUT_TRANSFERS'))."
   </td>
 </tr>";
 }
 
 // ... and add them to a constant for the template
+// @TODO Rewrite all these constants
 define('__TRANSFER_ROWS', $OUT);
 
 // Remeber total amount
 define('__TRANSFER_TOTAL_VALUE', $total);
 
 // Set title
-define('__TRANSFER_TITLE', TRANSFER_LIST_ALL);
+define('__TRANSFER_TITLE', getMessage('TRANSFER_LIST_ALL'));
 
 // Show delete button here
-define('__TRANSFER_DELETE', "<input type=\"reset\" class=\"admin_reset\" value=\"".UNDO_SELECTIONS."\" />&nbsp;*&nbsp;<input type=\"submit\" name=\"del\" class=\"admin_delete\" value=\"".TRANSFER_DELETE."\" />");
+define('__TRANSFER_DELETE', "<input type=\"reset\" class=\"admin_reset\" value=\"{--UNDO_SELECTIONS--}\" />&nbsp;*&nbsp;<input type=\"submit\" name=\"del\" class=\"admin_delete\" value=\"{--TRANSFER_DELETE--}\" />");
 
 // Load final template
 LOAD_TEMPLATE("admin_list_transfer");
index ed7682e..31f0ba3 100644 (file)
@@ -50,8 +50,10 @@ if ((IS_FORM_SENT()) || ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST(('re
                SQL_FREERESULT($result_user);
 
                // Delete user account
-               DELETE_USER_ACCOUNT(bigintval(REQUEST_GET('uid')), REQUEST_POST('reason'));
-               LOAD_TEMPLATE("admin_settings_saved", false, "<div class=\"admin_green\">".ADMIN_DEL_COMPLETED."</div>");
+               DELETE_USER_ACCOUNT(REQUEST_GET('uid'), REQUEST_POST('reason'));
+
+               // Output message
+               LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_DEL_COMPLETED'));
        } 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 c7e5c74..3508314 100644 (file)
@@ -52,6 +52,7 @@ if (SQL_NUMROWS($result) > 0) {
                 array(bigintval(REQUEST_POST('id'))), __FILE__, __LINE__);
                list($subj, $text, $url) = SQL_FETCHROW($result);
                SQL_FREERESULT($result);
+               // @TODO More constants to rewrite
                define('__ID_VALUE'  , REQUEST_POST('id'));
                define('__URL_VALUE' , $url);
                define('__SUBJ_VALUE', $subj);
@@ -74,7 +75,7 @@ WHERE id=%s LIMIT 1",
 ), __FILE__, __LINE__);
 
                if (SQL_AFFECTEDROWS() == 1) {
-                       $content = SETTINGS_SAVED;
+                       $content = getMessage('SETTINGS_SAVED');
                } else {
                        $content = "<span class=\"admin_failed\">{--SETTINGS_NOT_SAVED--}</span>";
                }
@@ -83,16 +84,17 @@ WHERE id=%s LIMIT 1",
                LOAD_TEMPLATE("admin_settings_saved", false, $content);
        } else {
                // There are mail orders available
-               $SW = 2; $OUT = "";
-               while (list($id, $sender, $subj, $pay, $cat) = SQL_FETCHROW($result)) {
+               $OUT = ""; $SW = 2;
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Prepare data for the row template
+                       // @TODO Rewritings: subj->subject in template
                        $content = array(
                                'sw'   => $SW,
-                               'id'   => $id,
-                               'subj' => $subj,
-                               'uid'  => ADMIN_USER_PROFILE_LINK($sender),
-                               'pay'  => GET_PAYMENT($pay),
-                               'cat'  => GET_CATEGORY($cat),
+                               'id'   => $content['id'],
+                               'subj' => $content['subject'],
+                               'uid'  => ADMIN_USER_PROFILE_LI