]> git.mxchange.org Git - mailer.git/commitdiff
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 50977e6cb7eeab471dcaa878d86ef1d9906732ea..c46d5c5f5cc18cb18e9126125b19dac46e47246e 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 90043b3f144fdb3498f60297a5331bc2475495b0..57f39e1de7c81fb2dd613cf0bfb9fafb50c90e0d 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 0765d1e73706a4ffdd366dc1f502b5ae2e4d0302..52c4164ab986beab0388e092b31346c700ef53b2 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 c722525cb3516e7b60c492af0cc2cf944a999a05..f246c8390b237caaf9fa7351deaaf172a6d4c41d 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 983653ddaa6a4a829de321fdca69bcf708aaa6f2..0faafa9c69a3a8c8ef3ea98b9a8380f5fd6de97e 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 782b69d6f0e8a9b26f6e56611ab50d5df20c641b..c4e63c3e0ec3d72ecda49d79613f65ef8e567003 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 adb04be8cbf74b102b892ff2ab242b8a2a48bd84..56fabfb73aa300ac361caa612eb8c780402c49e0 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 3970e29008f94b49dac5902c8ae61eb85c04ee82..55979178ec69f50dbda64dd62b5132436a8e312e 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 5cdc442315db6cb95759ff3b23fb9cd505eb92c8..6b7726b59791b0f17326546a450ee5cef616e6b4 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 8871ffdbda85ffe9d4a2334fc3ef61533f23aab3..4929f2d97403ea1c9b596d9b6329f18fb39fa5b8 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 c6d3aab5c3193b7214132100fddf2446b90d7569..7440f0e3f7636dae162357fc125929a8edf0ef73 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 67c37e02ef7d37985664e3d2258d2eed35316b03..205342517638c65414b1bd5e4f7b90bcae069eb0 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 d71492ded8cc6a9d363473d7f42b08466ff30734..6e8ae9c3b464ba1532456c6ee28ffda64a6cce28 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 b2bca3ea6e981370752cac884f830f5af679966f..ae8f15210e4af841e0453f55e1259f67ec995e0f 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 16300c142e8a3454f61b244bae29dfc464c68846..17a13d08f378a84d14a192ab66d643bec97e8133 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 ab52b74ae9f27095fdcac262e05008c34bef10e4..a1ff9913bb2367a4acd4f9a56159676edeb754d2 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 1465d609d15928ee16cb75884b8cba289ad061ec..dcdfdc6ea03845940ec3fa110573bb0b6d0564b3 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 50f833ddef43dc2bfec3a12fd323fd803d43e54c..6bec404ac9355924cd840efa798bed02b8dd0fc8 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 463d4701298c8974d328b4bd0fe72fc97979fab0..5250598e670b3450388a6a16bb09bfb366a29290 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 370b41463da8b3d179c32c0d867f38a0fcd698c0..2dd11464ac194b72b6af9f19a97c1241181ef4b9 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 cad193a2944d4b1db9e5a45152880c34a392000b..05a58c6ad2380fbe5293ac04dece917d5d274960 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 0d38bec46c6af6f12de92cb5464508a09ee4ea3f..69b771b94805ce44a4cc6c739bdd134bbe3634a3 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 0dac5d6dde2690f958abc974cb4cc1783bc0fa66..fd789e0901b5aca6b6a1e9f69ee88ce8a819b36e 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 6b6e03595cfb7fcd983ec59caf08855cdfe2ef79..291df0192379c3469342e5661b0e6b45b84a4f04 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 6679aa5f2f064599b1d22c78719a2494b144002c..8a17b66694bdba4a1764f002799d54bfff68e31d 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 01720837be8084dde3ebc6e6afd307d71b730fb3..d61ef9634048cf624a784d6c6bef86fc6c6c777b 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 0f19fee5f3b04d84ae966a61a952c8fc52c10fe0..a706bc1b31ee0e78f67e03eea2b68d9c12a651c2 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 9ab7329ec72f39bdf6b3bcce7ca92983758f03dd..df8b39e84078580fd3e799dca4370db51e518a49 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 039f36d788934d285cff8e25ccc484bb1810a9ce..eaf632379bf942e7e34328ec88439511aa1cc0a2 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 6f45e9307e30ab8ed00e912a907af81d85c5dfc9..d08c83bc4b85c9f92d52ffd979c8fa0d96655d3e 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 f3af140f191ebcc2fe2716560f745df065fb66cd..69fc4a82ddc504fcdc4c19fd89301abc62bac59d 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 4f2fd8fa348a89e073e73ef414dbc2d7a20035e9..31d010bf5697b1ab9aaabdf2f3685175c605e4cd 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 7c467d94b6f2a25ea03ca5e2e7d55c0e054a13db..c122b79cf538b9658b6c6d8371ee59cb3266b85f 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 22090f5bb12a5677b4159f82177cd9238a0a0fac..21b9bb05588b3e78ead0c1584ba0b192dd113b87 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 e97d76721ca2f9bea56e84ff8791296f7cd38a78..f8fd66dbd5a1fc2a764fd40bc186fd5963f128fe 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 eceebabec684b88ebb36703456fcca15a09d45a1..37bd1941e3f44958a0e29d0f88b537be124c709a 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 dd8c722038b1ea7c5a1294a041e6114c6d9ba3c3..f056fafa59eac5213661710e91e0698080059ce2 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 7ffffb8c6e1f690152b613e7831658889161612c..0d714ee5abb2d6323db38f03714b0a382893f068 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 b6e6ef3b4e041e0a31d58d7f3ad299a428f720e6..8dd17a2392bd8a98b15c984cf6d8208de2ddef27 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 80a1f06a9e269f535b50544c370cfd4fbac99a3a..408dec534c89af3122e9ab18311293320da00a99 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 6c90799735d03d60dbf20ccbba98c869aeb95f97..82a7d25e5cfdc8e78ad50b14c0e3616789d75df0 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 d3980ba8d75bd9a8a7764ddc459421c213def790..9208c9f1346a3c7b442db9c81dd8181a8caa9e71 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 104f4e6bbd00feac914289a2d69db37da9eefb56..8944acf39beed156254e481af0e53123615d6e1f 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 ed718d441a6107c7209ac124291fd8ee239f6df8..ea55318c742f50953db9136389231c95b3bf189c 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 08019d932c4d8cf670308cfff4afb3da7041be54..250fbda8b08b756a1a7251d0e816e3424c4f43a9 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 ccb2d887cbbed7acbb321fc1d534ea347be0a12d..9be586c2cc686d5c83997f63114f8b09f70e2545 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 5d123199cbfcabe68af288f554c836a00b48d57b..fe314901936ed66a2e4a11b1f069094dcb9fd4d5 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 1abebd0849796287bc3758fb22226e1b074cbb3e..bda8f3adac3164845cbdf5f985cb11fa579fc493 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 57190ffde1c1c6e65a3ec14d14bea424cf6d2545..bd6a36dc29a4450322aca58900ad00043a2fe27c 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 fe95d6e4055efca1a503eaaa135198601ee39209..542a26443dd41cc627b8f22d1d4687f8069b5b76 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 8001828b0e7e653b61651bdb46068858ff7e1222..78ab8bca61fafbcd7be2ae2662e7545a44bb29b3 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 89a973b41a448e40402111cc62a12ff8a6bf5968..830c6f778db0882742f7573226df15def8d64249 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 b8ebcf8b04bb5483580e8993139443db767ad2b4..4b84498ec36ae0b3c8b343f6058262ae747b6bcd 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 8b94f531202370ec89873612baab54e2bcb673c5..83d061b736cb1770ecbe81573a3e68654831f813 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 3f3f8ec1f55f1d806e3a9a4e5aad08dee07b4593..3a1af21e8508d5ced8929f330a9a4b29f717aefd 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 4b3163537561517dc54dfea9b7119266afcc7dcd..ae0dff0080c34fdcb8257f89d15d699ec2df9d7b 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 3156f0d7ec761b25da9069edc91be4cf90758eac..e8cd26d4d05d750771a6315d0ff7e3fce81b4fe4 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 69b400320f750f1e8f46b6bc9c5f39193b4bba08..5302566f1c7fecd4f2e832c5e1877affbe6a433b 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 b1d8d571300a1a8b1eeddf65b7a79b0f5f081c8b..41f9c03001ff4e37b71d20f66e366c525bc4a779 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 91fe4c618a77fdd2552b2cc8670d4ad93fd6827f..761b0beeebd702e78184798ed618c50304d6a0e4 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 be5aab4947c102c4ebddd9c8a6b92440368637da..efed69b86924c11dcc1253aa5a8d8ef90282ae8c 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 00bfce4a4e4a09f714f4bad238ac58db4efaaff8..3da28b7a3c6e18e1aebc082c4f57d96d9b89e6c4 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 5df9d0123ddae436cae973a2f691685dba0c8c4a..2f3d8e8f060a4a294a8510217be3bae0208c1f9c 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 ed7682ebadd17a2a5d91a2cfaa041a45438d32e1..31f0ba36093d58579892969fa10643c1e61148ec 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 c7e5c74de3f4844da816363a7c7a5e23174c08e8..350831451201e757e32367c7e1e641115941a654 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_LINK($content['sender']),
+                               'pay'  => GET_PAYMENT($content['payment_id']),
+                               'cat'  => GET_CATEGORY($content['cat_id']),
                        );
 
                        // Load row template and switch colors
@@ -102,6 +104,8 @@ WHERE id=%s LIMIT 1",
 
                // Free memory
                SQL_FREERESULT($result);
+
+               // @TODO Yet another constant to rewrite
                define('__EMAIL_SELECT_ROWS', $OUT);
 
                // Load email template
@@ -109,7 +113,7 @@ WHERE id=%s LIMIT 1",
        }
 } else {
        // No mail orders left in pool
-       OUTPUT_HTML("<span class=\"admin_failed\">".ADMIN_NO_MAILS_IN_POOL."</span>");
+       LOAD_TEMPLATE("admin_settings_saved", false, "<span class=\"admin_failed\">{--ADMIN_NO_MAILS_IN_POOL--}</span>");
 }
 
 //
index 730289b0f7ee4a2dbfc7b52b9771bf3b2e8ff76e..a7f26f043b431cd928bea2a2d0c14d5883a3c869 100644 (file)
@@ -82,7 +82,7 @@ if (SQL_NUMROWS($result) > 0)
                define('__BOTTOM_EMAIL_NAV', "");
        }
 
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        while ($pool = SQL_FETCHROW($result))
        {
                // Check sent mails and clicks
index b57379a82938e34c0ae1f88b049cf928826dd8c1..2a86e83052176a845636d7aa0a17a4998f0bc1c9 100644 (file)
@@ -151,7 +151,7 @@ if (REQUEST_ISSET_GET(('reg_ext'))) {
        }
 } elseif ((REQUEST_ISSET_POST(('delete'))) && ($SEL > 0) && (!IS_DEMO())) {
        // List extensions and when verbose is enabled SQL statements which will be executed
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        foreach (REQUEST_POST('sel') as $ext_id => $sel) {
                // Init variables
                $VERBOSE_OUT = ""; INIT_SQLS();
@@ -238,7 +238,7 @@ ORDER BY ext_name", __FILE__, __LINE__);
        // Are there some entries?
        if (SQL_NUMROWS($result) > 0) {
                // Extensions are registered
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
                while ($content = SQL_FETCHARRAY($result)) {
                        // Prepare CSS selection output
                        $cssSelection = "---";
@@ -320,7 +320,7 @@ case "register": // Register new extension
                                        }
 
                                        // Do we need to update cache file?
-                                       if ((EXT_IS_ACTIVE("cache")) && ($GLOBALS['cacheMode'] != "no")) {
+                                       if ((EXT_IS_ACTIVE("cache")) && ($GLOBALS['cache_mode'] != "no")) {
                                                // Remove cache file (will be auto-created again!)
                                                if ($GLOBALS['cache_instance']->loadCacheFile("config")) $GLOBALS['cache_instance']->destroyCacheFile();
                                                if ($GLOBALS['cache_instance']->loadCacheFile("extensions", true)) $GLOBALS['cache_instance']->destroyCacheFile();
index 52e768a92ae45cc97318d96b8dd8136e4de77de6..d92f15d10c8028b261a22a3b7927e811e4dfc329 100644 (file)
@@ -54,21 +54,22 @@ if (!IS_FORM_SENT()) {
        $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (what='' OR `what` IS NULL) ORDER BY `sort`", __FILE__, __LINE__);
        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;
                }
 
                // 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) {
                        if ($value == $prev) {
@@ -90,46 +91,45 @@ if (!IS_FORM_SENT()) {
                        $result = SQL_QUERY_ESC("SELECT what, title, sort
 FROM `{!_MYSQL_PREFIX!}_guest_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) {
                                // Initialize 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_FETCHARRAY($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;
                                }
 
                                // 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;
+
+                               // Transfer dummy array
+                               $menus[$value_main] = $dmy;
+                               $titles[$value_main] = $dmy2;
+                               $below[$value_main] = $dmy3;
                        }
                }
        }
index df50fcd50582533110ebf5fc81235f0d34087316..2e5d3b415d2c8f19025e9b1287d87af44be7cea6 100644 (file)
@@ -59,7 +59,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
        define('__SUB_VALUE', $SUB);
        define('__CHK_VALUE', $chk);
 
-       $cnt = 0; $SW = 2; $OUT = "";
+       $cnt = 0; $OUT = ""; $SW = 2;
        foreach (REQUEST_POST('sel') as $sel => $confirm)
        {
                if ($confirm == 1)
@@ -269,13 +269,14 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
        } else {
                // List sub menus
                $result = SQL_QUERY_ESC("SELECT `id`, `action`, `what`, `title`, `sort` FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC",
-                array($SUB), __FILE__, __LINE__);
+                       array($SUB), __FILE__, __LINE__);
        }
 
        // Get number of menu entries
        $max = SQL_NUMROWS($result);
        if ($max > 0) {
                // Set sub value
+               // @TODO Rewrite this constant
                define('__SUB_VALUE', $SUB);
 
                // Init variables
@@ -283,28 +284,30 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
                $cnt = 0;
                $OUT = "";
 
-               while (list($id, $act, $wht, $title, $sort) = SQL_FETCHROW($result)) {
+               // Process all menu entries
+               while ($content = SQL_FETCHARRAY($result)) {
                        $cnt++;
-                       if (($sort == 0) || (($sort == 1) && (!empty($SUB)))) {
+                       if (($content['sort'] == 0) || (($content['sort'] == 1) && (!empty($SUB)))) {
                                // Is highest position
-                               $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=guestedit&amp;sub={!__SUB_VALUE!}&amp;act=".$act."&amp;w=".$wht."&amp;tid=".($sort+1)."&amp;fid=".$sort."\">{--LOWER--}</a>";
+                               $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=guestedit&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=guestedit&amp;sub={!__SUB_VALUE!}&amp;act=".$act."&amp;w=".$wht."&amp;tid=".($sort-1)."&amp;fid=".$sort."\">{--HIGHER--}</a>";
-                       } elseif ($sort > 0) {
+                               $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=guestedit&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=guestedit&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=guestedit&amp;sub={!__SUB_VALUE!}&amp;act=".$act."&amp;w=".$wht."&amp;tid=".($sort+1)."&amp;fid=".$sort."\">{--LOWER--}</a>";
+                               $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=guestedit&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=guestedit&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;";
+                       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,
+                               'id'     => $content['id'],
+                               'action' => $content['action'],
+                               'what'   => $content['what'],
+                               'title'  => $content['title'],
                                'navi'   => $NAVI,
                                'mode'   => "guest"
                        );
index fffc66ef86f0883aba2f94f88e375a8ae7cb13a9..83de762679c8b0da0c296dc6a541071fe75ce744 100644 (file)
@@ -47,6 +47,7 @@ if (getConfig('def_refid') > 0) {
 } // END - if
 
 // Check for more extensions
+// @TODO Rewrite those lines 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')."";
@@ -57,25 +58,29 @@ $result = SQL_QUERY_ESC("SELECT DISTINCT d.userid, d.gender, d.surname, d.family
 FROM `{!_MYSQL_PREFIX!}_user_data` AS d
 WHERE d.`status`='CONFIRMED' AND d.joined < (UNIX_TIMESTAMP() - %s) AND d.last_online < (UNIX_TIMESTAMP() - %s) AND d.ap_notified < (UNIX_TIMESTAMP() - %s)
 ".$EXCLUDE_LIST."
-ORDER BY d.userid", array(getConfig('ap_inactive_since'), getConfig('ap_inactive_since'), getConfig('ap_inactive_since')), __FILE__, __LINE__);
+ORDER BY d.userid",
+       array(
+               getConfig('ap_inactive_since'),
+               getConfig('ap_inactive_since'),
+               getConfig('ap_inactive_since')
+       ), __FILE__, __LINE__);
 
-if (SQL_NUMROWS($result) > 0)
-{
+if (SQL_NUMROWS($result) > 0) {
        // Ok, we have found some inactive accounts
-       $SW = 2; $OUT = "";
-       while (list($uid, $gender, $sname, $fname, $email, $joined, $last, $notified) = SQL_FETCHROW($result))
-       {
+       $OUT = ""; $SW = 2;
+       while ($content = SQL_FETCHARRAY($result)) {
                // Prepare data for the row template
+               // @TODO Rewritings: sname->surname,fname->family in templates
                $content = array(
                        'sw'       => $SW,
-                       'uid'      => ADMIN_USER_PROFILE_LINK($uid),
-                       'gender'   => TRANSLATE_GENDER($gender),
-                       'sname'    => $sname,
-                       'fname'    => $fname,
-                       'email'    => "<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$email."</a>",
-                       'joined'   => MAKE_DATETIME($joined, "2"),
-                       'last'     => MAKE_DATETIME($last, "2"),
-                       'notified' => MAKE_DATETIME($notified, "2"),
+                       'uid'      => ADMIN_USER_PROFILE_LINK($content['userid']),
+                       'gender'   => TRANSLATE_GENDER($content['gender']),
+                       'sname'    => $content['surname'],
+                       'fname'    => $content['family'],
+                       'email'    => "<a href=\"".CREATE_EMAIL_LINK($content['email'], "user_data")."\">".$content['email']."</a>",
+                       'joined'   => MAKE_DATETIME($content['joined'], "2"),
+                       'last'     => MAKE_DATETIME($content['last_online'], "2"),
+                       'notified' => MAKE_DATETIME($content['ap_notified'], "2"),
                );
 
                // Load row template
@@ -85,15 +90,15 @@ if (SQL_NUMROWS($result) > 0)
 
        // Free memory
        SQL_FREERESULT($result);
+       // @TODO Rewrite this constant
        define('__AUTOPURGE_ROWS', $OUT);
 
        // Load main template
        LOAD_TEMPLATE("admin_list_autopurge");
-}
- else
-{
+} else {
        // All members are active or you don't have any registered
        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_AUTOPURGE_ALL_ACTIVE'));
 }
+
 //
 ?>
index ab4b87de3588b014c08845248f24cdd5ad3bf500..1dbaf06ffbeadc03ed0af6346c555ec4446e0920 100644 (file)
@@ -67,7 +67,7 @@ ORDER BY beg_points DESC, last_online DESC, userid",
        if (SQL_NUMROWS($result) > 0) {
                // List users
                $OUT = "";$SW = 2; $cnt = 1; $total = 0;
-               while (list($uid, $email, $gender, $sname, $fname, $turbo, $last) = SQL_FETCHROW($result)) {
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Init variables
                        $WIN1 = ""; $WIN2 = "";
                        if ($cnt <= getConfig('beg_ranks')) {
@@ -77,14 +77,16 @@ ORDER BY beg_points DESC, last_online DESC, userid",
                        } // END - if
 
                        // Prepare content
+                       // @TODO Rewrite templates so s/fname will be replaced by surname/family
+                       // @TODO to shorten this block. Please also do so with uid->userid
                        $content = array(
-                               'uid'    => $uid,
-                               'email'  => CREATE_EMAIL_LINK($email, "user_data"),
-                               'gender' => TRANSLATE_GENDER($gender),
-                               'sname'  => $sname,
-                               'fname'  => $fname,
-                               'turbo'  => TRANSLATE_COMMA($turbo),
-                               'last'   => MAKE_DATETIME($last, "2"),
+                               'uid'    => $content['userid'],
+                               'email'  => CREATE_EMAIL_LINK($content['email'], "user_data"),
+                               'gender' => TRANSLATE_GENDER($content['gender']),
+                               'sname'  => $content['surname'],
+                               'fname'  => $content['family'],
+                               'turbo'  => TRANSLATE_COMMA($content['beg_points']),
+                               'last'   => MAKE_DATETIME($content['last_online'], "2"),
                                'sw'     => $SW,
                                'win1'   => $WIN1,
                                'win2'   => $WIN2,
@@ -93,7 +95,7 @@ ORDER BY beg_points DESC, last_online DESC, userid",
 
                        // Load template and add it
                        $OUT .= LOAD_TEMPLATE("admin_list_beg_rows", true, $content);
-                       $SW = 3 - $SW; $cnt++; $total += $turbo;
+                       $SW = 3 - $SW; $cnt++; $total += $content['beg_points'];
                }
                define('__BEG_ROWS', $OUT);
                define('__TOTAL', TRANSLATE_COMMA($total));
index 4b1eac18edae23289c95d83209307e290968fffa..50e83a57a3d06f26e4a673d5f8ec4b93647583af 100644 (file)
@@ -44,7 +44,7 @@ ADD_DESCR("admin", __FILE__);
 if (REQUEST_ISSET_GET(('uid'))) {
        // Check if the user already exists
        $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-        array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+               array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Loads surname, family's name and the email address
                list($sname, $fname, $email) = SQL_FETCHROW($result);
@@ -53,7 +53,7 @@ if (REQUEST_ISSET_GET(('uid'))) {
                // Prepare constants
                define('__CATS_BASE'   , "<a href=\"{!URL!}/modules.php?module=admin&amp;uid=");
                define('__UID'         , bigintval(REQUEST_GET('uid')));
-               define('__MEMBER_LINKS', MEMBER_ACTION_LINKS(__UID));
+               define('__MEMBER_LINKS', MEMBER_ACTION_LINKS(constant('__UID')));
                define('__EMAIL'       , "<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$sname." ".$fname."</a>");
 
                // Ok, list categories of this user
@@ -61,31 +61,30 @@ if (REQUEST_ISSET_GET(('uid'))) {
 
                if (SQL_NUMROWS($result_cats) > 0) {
                        // List categories
-                       $cnt = "1"; $SW = 2; $OUT = "";
-                       while (list($cid, $cat) = SQL_FETCHROW($result_cats)) {
+                       $cnt = 1; $OUT = ""; $SW = 2;
+                       while ($content = SQL_FETCHARRAY($result_cats)) {
                                // Check user's selection
                                $result_user = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE userid=%s AND cat_id=%s LIMIT 1",
-                                array(bigintval(REQUEST_GET('uid')), bigintval($cid)), __FILE__, __LINE__);
+                                       array(bigintval(REQUEST_GET('uid')), bigintval($content['id'])), __FILE__, __LINE__);
 
                                // Set selection
-                               $SELECTED = "<font color=\"red\">{--NO--}</div>";
-                               if (SQL_NUMROWS($result_user) == 1) $SELECTED = "<font color=\"green\">{--YES--}</div>";
+                               $selection = "<font color=\"#ee0000\">{--NO--}</div>";
+                               if (SQL_NUMROWS($result_user) == 1) $selection = "<font color=\"#00ee00\">{--YES--}</div>";
 
-                               // Prepare array for the row template
-                               $content = array(
-                                       'sw'  => $SW,
-                                       'cnt' => $cnt,
-                                       'cat' => $cat,
-                                       'sel' => $SELECTED,
-                               );
+                               // Add more elements
+                               $content['sw']  = $SW;
+                               $content['cnt'] = $cnt;
+                               $content['sel'] = $selection;
 
                                // Load row template and switch colors + count up
                                $OUT .= LOAD_TEMPLATE("admin_list_cats_row", true, $content);
                                $SW = 3 - $SW; $cnt++;
-                       }
+                       } // END - while
 
                        // Free memory
                        SQL_FREERESULT($result);
+
+                       // @TODO Rewrite this constant
                        define('__CATS_ROWS', $OUT);
 
                        // Load main template
index 3d3c3806c968aa525e918cdbf4580d01cbcf6e55..54e16ff370efa90a091655355901ba3c30f6a087 100644 (file)
@@ -170,15 +170,16 @@ if ((REQUEST_ISSET_POST(('add'))) && (REQUEST_ISSET_POST(('code'))) && (REQUEST_
        if (SQL_NUMROWS($result) > 0) {
                // List all countries
                $OUT = ""; $SW = 2;
-               while (list($id, $code, $descr, $active) = SQL_FETCHROW($result)) {
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Prepare array for the template
+                       // @TODO Rewritings: name->descr,status->is_active in template
                        $content = array(
-                               'id'     => $id,
-                               'code'   => $code,
-                               'name'   => $descr,
-                               'active' => TRANSLATE_YESNO($active),
+                               'id'     => $content['id'],
+                               'code'   => $content['code'],
+                               'name'   => $content['descr'],
+                               'active' => TRANSLATE_YESNO($content['is_active']),
                                'sw'     => $SW,
-                               'status' => $active,
+                               'status' => $content['is_active'],
                        );
 
                        // Load row template and switch colors
index 4db1e7553ffcba80d4bed4c31deb4a854a0e78b9..5b1fe9686ed95cfeba433b52533bde0158efb340 100644 (file)
@@ -47,25 +47,23 @@ LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
 ON h.userid=d.userid
 ORDER BY h.userid", __FILE__, __LINE__);
 
-if (SQL_NUMROWS($result) > 0)
-{
+if (SQL_NUMROWS($result) > 0) {
        // List all holiday requests
-       $SW = 2; $OUT = "";
-       while (list($id, $uid, $start, $end, $comments, $status, $last) = SQL_FETCHROW($result))
-       {
+       $OUT = ""; $SW = 2;
+       while ($content = SQL_FETCHARRAY($result)) {
                // Add three dashes to comment when it is empty
-               if (empty($comments)) $comments = "---";
+               if (empty($content['comments'])) $content['comments'] = "---";
 
                // Prepare data for the row template
                $content = array(
                        'sw'       => $SW,
-                       'id'       => $id,
-                       'uid'      => ADMIN_USER_PROFILE_LINK($uid),
-                       'start'    => MAKE_DATETIME($start, "3"),
-                       'end'      => MAKE_DATETIME($end, "3"),
-                       'comments' => wordwrap($comments, 15),
-                       'status'   => TRANSLATE_STATUS($status),
-                       'last'     => MAKE_DATETIME($last, "3"),
+                       'id'       => $content['id'],
+                       'uid'      => ADMIN_USER_PROFILE_LINK($content['userid']),
+                       'start'    => MAKE_DATETIME($content['holiday_start'], "3"),
+                       'end'      => MAKE_DATETIME($content['holiday_end'], "3"),
+                       'comments' => wordwrap($content['comments'], 15),
+                       'status'   => TRANSLATE_STATUS($content['status']),
+                       'last'     => MAKE_DATETIME($content['last_online'], "3"),
                );
 
                // Load row template and switch color
@@ -75,15 +73,16 @@ if (SQL_NUMROWS($result) > 0)
 
        // Free memory
        SQL_FREERESULT($result);
+
+       // @TODO Rewrite this constant
        define('__HOLIDAY_ROWS', $OUT);
 
        // Load main template
        LOAD_TEMPLATE("admin_list_holiday");
-}
- else
-{
+} else {
        // No holiday requests found
-       LOAD_TEMPLATE("admin_settings_saved", false, HOLIDAY_ADMIN_NOTHING_FOUND);
+       LOAD_TEMPLATE("admin_settings_saved", false, getMessage('HOLIDAY_ADMIN_NOTHING_FOUND'));
 }
+
 //
 ?>
index 242a00c02b322e049b907159befcfdfe3ccd6291..330c1246e5c430069c63430e19680804040f8eba 100644 (file)
@@ -84,13 +84,16 @@ if (REQUEST_ISSET_GET(('uid'))) {
                                // Display message
                                LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_LINKS_DELETED'));
                        } else {
+                               // Init variables
+                               $OUT = ""; $SW = 2;
+
                                // List all unconfirmed mails
-                               $SW = 2; $OUT = "";
+                               // @TODO Find a way to rewrite this. See some lines above for different queries
                                while (list($id, $id2, $type) = SQL_FETCHROW($result)) {
                                        // Initializes some variables
                                        $cat = "";
                                        $DATA = "";
-                                       $PROBLEM = GENERAL_MAIL_PROBLEM;
+                                       $PROBLEM = getMessage('GENERAL_MAIL_PROBLEM');
                                        $result_data = false; // Closes Bug #58
 
                                        // Load data from stats table...
index 4a1c9db2c7794cd9afdf8af8e7693725f43f5099..ff2bfde0674b319fe0a4abe6381c4c025063d149 100644 (file)
@@ -57,7 +57,7 @@ if (REQUEST_ISSET_GET(('pid'))) {
                if (empty($task)) $task = 0;
        } elseif ((empty($uid)) || ($uid == "0")) {
                // Cannot obtain member ID!
-               LOAD_TEMPLATE("admin_settings_saved", false, PAYOUT_FAILED_OBTAIN_USERID);
+               LOAD_TEMPLATE("admin_settings_saved", false, getMessage('PAYOUT_FAILED_OBTAIN_USERID'));
        } else {
                // Get task ID from URL
                $task = REQUEST_GET('task');
@@ -135,10 +135,10 @@ if (REQUEST_ISSET_GET(('pid'))) {
                                                // Output message
                                                if ($allow == "Y") {
                                                        // Banner / Textlink request
-                                                       LOAD_TEMPLATE("admin_settings_saved", false, PAYOUT_BANNER_ACCEPTED_NOTIFIED);
+                                                       LOAD_TEMPLATE("admin_settings_saved", false, getMessage('PAYOUT_BANNER_ACCEPTED_NOTIFIED'));
                                                } else {
                                                        // Normal request
-                                                       LOAD_TEMPLATE("admin_settings_saved", false, PAYOUT_ACCEPTED_NOTIFIED);
+                                                       LOAD_TEMPLATE("admin_settings_saved", false, getMessage('PAYOUT_ACCEPTED_NOTIFIED'));
                                                }
 
                                                // Finally send mail
@@ -150,7 +150,7 @@ if (REQUEST_ISSET_GET(('pid'))) {
                                        }
                                } else {
                                        // Cannot load payout id
-                                       LOAD_TEMPLATE("admin_settings_saved", false, "<div class=\"admin_failed\">".PAYOUT_FAILED_OBTAIN_PAYOUT_ID."</div>");
+                                       LOAD_TEMPLATE("admin_settings_saved", false, "<div class=\"admin_failed\">{--PAYOUT_FAILED_OBTAIN_PAYOUT_ID--}</div>");
                                }
                        } else {
                                // Load template
@@ -172,7 +172,7 @@ if (REQUEST_ISSET_GET(('pid'))) {
                                $msg = LOAD_EMAIL_TEMPLATE("member_payout_rejected", REQUEST_POST('text'), $uid);
 
                                // Output message
-                               LOAD_TEMPLATE("admin_settings_saved", false, PAYOUT_REJECTED_NOTIFIED);
+                               LOAD_TEMPLATE("admin_settings_saved", false, getMessage('PAYOUT_REJECTED_NOTIFIED'));
 
                                // Finally send mail
                                SEND_EMAIL($email, PAYOUT_REJECTED_SUBJECT, $msg);
@@ -182,7 +182,7 @@ if (REQUEST_ISSET_GET(('pid'))) {
                        }
                } else {
                        // Cannot load user data
-                       LOAD_TEMPLATE("admin_settings_saved", false, PAYOUT_FAILED_OBTAIN_USERDATA);
+                       LOAD_TEMPLATE("admin_settings_saved", false, getMessage('PAYOUT_FAILED_OBTAIN_USERDATA'));
                }
        } elseif ((empty($task)) || ($task == "0")) {
                // Failed loading task ID
@@ -205,55 +205,44 @@ ORDER BY p.payout_timestamp DESC", __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // List found payouts
                $OUT = ""; $SW = 2;
-               while (list($pid, $uid, $total, $account, $bank, $type, $tstamp, $status, $allow, $url, $alt, $banner) = SQL_FETCHROW($result)) {
-                       if ($status == "NEW") {
+               while ($content = SQL_FETCHROW($result)) {
+                       if ($content['status'] == "NEW") {
                                // Generate links for direct accepting and rejecting
-                               $status = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_payouts&amp;do=accept&amp;pid=".$pid."\">".PAYOUT_ACCEPT_PAYOUT."</a>&nbsp;|&nbsp;<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_payouts&amp;do=reject&amp;pid=".$pid."\">".PAYOUT_REJECT_PAYOUT."</a>";
+                               $content['status'] = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_payouts&amp;do=accept&amp;pid=".$content['id']."\">".PAYOUT_ACCEPT_PAYOUT."</a>&nbsp;|&nbsp;<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_payouts&amp;do=reject&amp;pid=".$content['id']."\">".PAYOUT_REJECT_PAYOUT."</a>";
                        } else {
                                // Translate status
-                               $status = constant('PAYOUT_STATUS_'.strtoupper($status).'');
-                               $status = "<div class=\"admin_failed\">".$status."</div>";
+                               $content['status'] = constant('PAYOUT_STATUS_'.strtoupper($content['status']).'');
+                               $content['status'] = "<div class=\"admin_failed\">".$content['status']."</div>";
                        }
 
                        // Nothing entered must be secured in member/what-payputs.php !
-                       if ($allow == "Y") {
+                       if ($content['allow'] == "Y") {
                                // Banner/Textlink views/clicks request
-                               if (!empty($banner)) {
-                                       // Prepare array for the banner
-                                       $content = array(
-                                               'banner' => $banner,
-                                               'alt'    => $alt,
-                                               'url'    => $url,
-                                       );
-
+                               if (!empty($content['banner'])) {
                                        // Load template for the banner
-                                       $account = LOAD_TEMPLATE("admin_list_payouts_banner", true, $content);
+                                       $content['target_account'] = LOAD_TEMPLATE("admin_list_payouts_banner", true, $content);
                                } else {
                                        // Textlink
-                                       $content = array(
-                                               'txt_link' => $alt,
-                                               'txt_url'  => $url,
-                                       );
-                                       $account = LOAD_TEMPLATE("admin_list_payouts_txt", true, $content);
+                                       $content['target_account'] = LOAD_TEMPLATE("admin_list_payouts_txt", true, $content);
                                }
 
                                // Admins can addionally test the URL for framekillers
-                               $bank = "<a href=\"".FRAMETESTER($url)."\" target=\"_blank\">".CLICK_HERE."</a>";
+                               $content['target_bank'] = "<a href=\"".FRAMETESTER($content['url'])."\" target=\"_blank\">{--CLICK_HERE--}</a>";
                        } else {
                                // e-currency payout request
-                               if (empty($account)) $account = "---";
-                               if (empty($bank))    $bank    = "---";
+                               if (empty($content['target_account'])) $content['target_account'] = "---";
+                               if (empty($content['target_bank']))    $content['target_bank']    = "---";
                        }
 
                        // Remember data in array for the template
                        $content = array(
                                'sw'      => $SW,
-                               'ulink'   => ADMIN_USER_PROFILE_LINK($uid),
-                               'ptype'   => TRANSLATE_COMMA($total)." ".COMPILE_CODE($type),
-                               'account' => $account,
-                               'bank'    => $bank,
-                               'tstamp'  => MAKE_DATETIME($tstamp, "2"),
-                               'status'  => $status,
+                               'ulink'   => ADMIN_USER_PROFILE_LINK($content['userid']),
+                               'ptype'   => TRANSLATE_COMMA($content['payout_total'])." ".COMPILE_CODE($content['type']),
+                               'account' => $content['target_account'],
+                               'bank'    => $content['target_bank'],
+                               'tstamp'  => MAKE_DATETIME($content['payout_timestamp'], "2"),
+                               'status'  => $content['status'],
                        );
 
                        // Add row and switch color
@@ -269,7 +258,7 @@ ORDER BY p.payout_timestamp DESC", __FILE__, __LINE__);
                LOAD_TEMPLATE("admin_list_payouts");
        } else {
                // No payout requests are sent so far
-               LOAD_TEMPLATE("admin_settings_saved", false, PAYOUT_ADMIN_NO_REQUESTS_FOUND);
+               LOAD_TEMPLATE("admin_settings_saved", false, getMessage('PAYOUT_ADMIN_NO_REQUESTS_FOUND'));
        }
 }
 //
index 93dd36b03ca5c46a1d3c302d59be46525210b8c0..3d9621c7e9be69f0e5cff20c6427fbf9e897245a 100644 (file)
@@ -70,7 +70,7 @@ if (SQL_NUMROWS($result) > 0) {
        LOAD_TEMPLATE("admin_list_primera_main", false, $OUT);
 } else {
        // Nothing to display!
-       LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_ADMIN_NO_TRANSFERS);
+       LOAD_TEMPLATE("admin_settings_saved", false, getMessage('PRIMERA_ADMIN_NO_TRANSFERS'));
 }
 
 // Free the result
index 37d54c8fcaa23675d059ef57f7b265afb452ed66..9794b452293657ede6bf51c00277df100b708aba 100644 (file)
@@ -92,16 +92,22 @@ if (REQUEST_ISSET_GET(('rallye'))) {
        // Delete rallyes
        $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
        if ($SEL > 0) {
+               // Init SQLs
+               INIT_SQLS();
+
                // Delete selected rallyes and all it's data
                foreach (REQUEST_POST('sel') as $id => $selected) {
                        // Remove selected rallye entirely...
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE id=%s LIMIT 1",
-                               array(bigintval($id)), __FILE__, __LINE__);
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s",
-                               array(bigintval($id)), __FILE__, __LINE__);
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s",
-                               array(bigintval($id)), __FILE__, __LINE__);
-               }
+                       ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE id=%s LIMIT 1",
+                               array(bigintval($id)), __FILE__, __LINE__, false));
+                       ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s",
+                               array(bigintval($id)), __FILE__, __LINE__, false));
+                       ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s",
+                               array(bigintval($id)), __FILE__, __LINE__, false));
+               } // END - foreach
+
+               // Run SQLS
+               runFilterChain('run_sqls');
 
                // Output message
                $MSG = getMessage('RALLYE_DELETED');
@@ -113,6 +119,9 @@ if (REQUEST_ISSET_GET(('rallye'))) {
        // Change rallye
        $SEL = SELECTION_COUNT(REQUEST_POST('title'));
        if ($SEL > 0) {
+               // Init SQLs
+               INIT_SQLS();
+
                // Change selected rallyes and all it's data
                foreach (REQUEST_POST('title') as $id => $title) {
                        // Secure ID number
@@ -123,7 +132,7 @@ if (REQUEST_ISSET_GET(('rallye'))) {
                        $END   = mktime(REQUEST_POST('end_hour', $id)  , REQUEST_POST('end_min', $id)  , REQUEST_POST('end_sec', $id)  , REQUEST_POST('end_month', $id)  , REQUEST_POST('end_day', $id)  , REQUEST_POST('end_year', $id)  );
 
                        // Update entry
-                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET
+                       ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET
 title='%s',
 descr='%s',
 template='%s',
@@ -141,9 +150,12 @@ WHERE id='".$id."' LIMIT 1",
                                        bigintval(REQUEST_POST('min_users', $id)),
                                        bigintval(REQUEST_POST('min_prices', $id)),
                                        $id
-                               ), __FILE__, __LINE__);
+                               ), __FILE__, __LINE__, false));
                }
 
+               // Run SQLS
+               runFilterChain('run_sqls');
+
                // Output message
                $MSG = getMessage('RALLYE_CHANGED');
        }
@@ -154,38 +166,40 @@ if (REQUEST_ISSET_POST('edit')) {
        $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
        if ($SEL > 0) {
                // Make all selected and deactivated rallyes editable
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
                foreach (REQUEST_POST('sel') as $id => $selected) {
                        // Load rallye basic data
-                       $result = SQL_QUERY_ESC("SELECT title, descr, template, start_time, end_time, min_users, min_prices FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE id=%s LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT title, descr, template, start_time, end_time, min_users, min_prices
+FROM `{!_MYSQL_PREFIX!}_rallye_data`
+WHERE `id`=%s
+LIMIT 1",
                                array(bigintval($id)), __FILE__, __LINE__);
-                       list($title, $descr, $templ, $start, $end, $min_users, $min_prices) = SQL_FETCHROW($result);
+                       // Fetch an array
+                       $content = SQL_FETCHARRAY($result);
+
+                       // Free result
                        SQL_FREERESULT($result);
 
                        // Starting day
-                       $content['s_sec']   = ADD_SELECTION("sec"  , date("s", $start), "start", $id);
-                       $content['s_min']   = ADD_SELECTION("min"  , date("i", $start), "start", $id);
-                       $content['s_hour']  = ADD_SELECTION("hour" , date("G", $start), "start", $id);
-                       $content['s_day']   = ADD_SELECTION("day"  , date("d", $start), "start", $id);
-                       $content['s_month'] = ADD_SELECTION("month", date("m", $start), "start", $id);
-                       $content['s_year']  = ADD_SELECTION("year" , date('Y', $start), "start", $id);
+                       $content['s_sec']   = ADD_SELECTION("sec"  , date("s", $content['start_time']), "start", $id);
+                       $content['s_min']   = ADD_SELECTION("min"  , date("i", $content['start_time']), "start", $id);
+                       $content['s_hour']  = ADD_SELECTION("hour" , date("G", $content['start_time']), "start", $id);
+                       $content['s_day']   = ADD_SELECTION("day"  , date("d", $content['start_time']), "start", $id);
+                       $content['s_month'] = ADD_SELECTION("month", date("m", $content['start_time']), "start", $id);
+                       $content['s_year']  = ADD_SELECTION("year" , date('Y', $content['start_time']), "start", $id);
 
                        // Ending day
-                       $content['e_sec']   = ADD_SELECTION("sec"  , date("s", $end)  , "end"  , $id);
-                       $content['e_min']   = ADD_SELECTION("min"  , date("i", $end)  , "end"  , $id);
-                       $content['e_hour']  = ADD_SELECTION("hour" , date("G", $end)  , "end"  , $id);
-                       $content['e_day']   = ADD_SELECTION("day"  , date("d", $end)  , "end"  , $id);
-                       $content['e_month'] = ADD_SELECTION("month", date("m", $end)  , "end"  , $id);
-                       $content['e_year']  = ADD_SELECTION("year" , date('Y', $end)  , "end"  , $id);
-
-                       // Remember over values
-                       $content['templ']      = RALLYE_TEMPLATE_SELECTION("templ[".$id."]", $templ);
+                       $content['e_sec']   = ADD_SELECTION("sec"  , date("s", $content['end_time'])  , "end"  , $id);
+                       $content['e_min']   = ADD_SELECTION("min"  , date("i", $content['end_time'])  , "end"  , $id);
+                       $content['e_hour']  = ADD_SELECTION("hour" , date("G", $content['end_time'])  , "end"  , $id);
+                       $content['e_day']   = ADD_SELECTION("day"  , date("d", $content['end_time'])  , "end"  , $id);
+                       $content['e_month'] = ADD_SELECTION("month", date("m", $content['end_time'])  , "end"  , $id);
+                       $content['e_year']  = ADD_SELECTION("year" , date('Y', $content['end_time'])  , "end"  , $id);
+
+                       // Remember other values
+                       $content['templ']      = RALLYE_TEMPLATE_SELECTION("templ[".$id."]", $content['template']);
                        $content['sw']         = $SW;
                        $content['id']         = $id;
-                       $content['title']      = $title;
-                       $content['descr']      = $descr;
-                       $content['min_users']  = $min_users;
-                       $content['min_prices'] = $min_prices;
 
                        // Output row
                        $OUT .= LOAD_TEMPLATE("admin_edit_rallyes_row", true, $content);
@@ -208,37 +222,46 @@ if (REQUEST_ISSET_POST('edit')) {
        $result = SQL_QUERY_ESC("SELECT userid, refs, curr_points FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s ORDER BY userid",
                array(bigintval(REQUEST_GET('rallye'))), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
+               // @TODO Rewrite this constant
                define('__RALLYE_VALUE', REQUEST_GET('rallye'));
-               while (list($uid, $old, $opoints) = SQL_FETCHROW($result)) {
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Check for referal count
-                       $cnt = RALLYE_GET_REFCOUNT($uid, $old);
+                       $cnt = RALLYE_GET_REFCOUNT($content['userid'], $content['refs']);
+
+                       // Init variables
+                       $bl = "";
+                       $br = "";
 
                        // Output row
-                       $Bl = ""; $Br = "";
-                       if (($opoints > 0) && ($cnt > 0)) { $Bl = "<strong>"; $Br = "</strong>"; }
-                       if (($old > 0) || ($cnt > 0)) {
+                       if (($content['curr_points'] > 0) && ($cnt > 0)) { $bl = "<strong>"; $br = "</strong>"; }
+                       if (($content['refs'] > 0) || ($cnt > 0)) {
                                // Insert link to referal list
-                               //* DEBUG: */ echo "-".$uid."/".$cnt."/".$old."-<br />";
-                               $cnt = ADMIN_USER_PROFILE_LINK($uid, $cnt, "list_refs");
-                               $old = ADMIN_USER_PROFILE_LINK($uid, $old, "list_refs");
-                       }
+                               //* DEBUG: */ echo "-".$content['userid']."/".$cnt."/".$content['refs']."-<br />";
+                               $cnt = ADMIN_USER_PROFILE_LINK($content['userid'], $cnt, "list_refs");
+                               $content['refs'] = ADMIN_USER_PROFILE_LINK($content['userid'], $content['refs'], "list_refs");
+                       } // END - if
 
                        // Get user points
-                       $points = GET_TOTAL_DATA($uid, "user_points", "points", "userid", false, " AND ref_depth=1 LIMIT 1");
-                       //* DEBUG: */ echo basename(__FILE__).":uid={$uid},points={$points},opoints={$opoints}<br />\n";
+                       $points = GET_TOTAL_DATA($content['userid'], "user_points", "points", "userid", false, " AND ref_depth=1 LIMIT 1");
+                       //* DEBUG: */ echo basename(__FILE__).":uid={$content['userid']},points={$points},opoints={$content['curr_points']}<br />\n";
+
+                       // Prepare content
+                       // @TODO Rewritings: uid->userid,opoints->curr_points,old->refs in template
                        $content = array(
                                'sw'      => $SW ,
-                               'uid'     => $uid,
-                               'bold_l'  => $Bl ,
-                               'bold_r'  => $Br ,
-                               'old'     => $old,
+                               'uid'     => $content['userid'],
+                               'bold_l'  => $bl ,
+                               'bold_r'  => $br ,
+                               'old'     => $content['refs'],
                                'cnt'     => $cnt,
-                               'opoints' => TRANSLATE_COMMA($points - $opoints),
+                               'opoints' => TRANSLATE_COMMA($points - $content['curr_points']),
                        );
+
+                       // Load row template and switch color
                        $OUT .= LOAD_TEMPLATE("admin_list_rallye_usr_row", true, $content);
                        $SW = 3 - $SW;
-               }
+               } // END - while
 
                // Free memory
                SQL_FREERESULT($result);
@@ -255,67 +278,58 @@ if (REQUEST_ISSET_POST('edit')) {
        $result = SQL_QUERY("SELECT id, admin_id, title, descr, template, start_time, end_time, auto_add_new_user, is_active, send_notify, notified, min_users, min_prices
 FROM `{!_MYSQL_PREFIX!}_rallye_data`
 ORDER BY start_time DESC",
- __FILE__, __LINE__);
              __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // List found rallyes
-               $SW = 2; $OUT = "";
-               while (list($id, $aid, $title, $descr, $templ, $start, $end, $auto_add, $active, $notify, $notified, $min_users, $min_prices) = SQL_FETCHROW($result)) {
+               $OUT = ""; $SW = 2;
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Load admin login
-                       $alogin = GET_ADMIN_LOGIN($aid);
-
-                       // Count assigned prices
-                       $result_prices = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s",
-                               array(bigintval($id)), __FILE__, __LINE__);
+                       $content['alogin'] = GET_ADMIN_LOGIN($content['admin_id']);
 
                        // Count joined userids
-                       $result_user = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s",
-                               array($id), __FILE__, __LINE__);
-                       $joined = SQL_NUMROWS($result_user);
+                       $joined = GET_TOTAL_DATA($content['id'], "rallye_users", "id", "rallye_id", true);
 
                        // Did some users joined this rallye?
                        if ($joined > 0) {
                                // List joined users
-                               $joined = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_rallyes&amp;sub=users&amp;rallye=".$id."\" title=\"".RALLYE_LIST_USERS."\">".$joined."</a>";
-                       }
+                               $joined = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_rallyes&amp;sub=users&amp;rallye=".$content['id']."\" title=\"{--RALLYE_LIST_USERS_TITLE--}\">".$joined."</a>";
+                       } // END - if
 
                        // Alter some variables
-                       if (empty($alogin)) $alogin = "???";
-                       if (empty($templ))  $templ  = "---";
-                       if (empty($descr))  $descr  = "---";
+                       if (empty($content['alogin']))   $content['alogin']    = "???";
+                       if (empty($content['template'])) $content['template']  = "---";
+                       if (empty($content['descr']))    $content['descr']     = "---";
 
                        // Transfer data into array for the template
+                       // @TODO Rewritings: aid->admin_id in template
                        $content = array(
-                               'select'     => "<input type=\"checkbox\" name=\"sel[".$id."]\" class=\"admin_normal\" value=\"1\" />",
-                               'aid'        => $aid,
-                               'email_link' => CREATE_EMAIL_LINK($aid),
-                               'alogin'     => $alogin,
-                               'id'         => $id,
+                               'select'     => "<input type=\"checkbox\" name=\"sel[".$content['id']."]\" class=\"admin_normal\" value=\"1\" />",
+                               'aid'        => $content['admin_id'],
+                               'email_link' => CREATE_EMAIL_LINK($content['admin_id']),
+                               'alogin'     => $content['alogin'],
+                               'id'         => $content['id'],
                                'sw'         => $SW,
-                               'title'      => $title,
-                               'template'   => $templ,
+                               'title'      => $content['title'],
+                               'template'   => $content['template'],
                                'joined'     => $joined,
-                               'start_date' => MAKE_DATETIME($start, "2"),
-                               'end_date'   => MAKE_DATETIME($end  , "2"),
-                               'active_lnk' => TRANSLATE_YESNO($active),
-                               'notify_lnk' => TRANSLATE_YESNO($notify),
-                               'auto_lnk'   => TRANSLATE_YESNO($auto_add),
-                               'notified'   => TRANSLATE_YESNO($notified),
-                               'prices_cnt' => SQL_NUMROWS($result_prices),
-                               'descr'      => COMPILE_CODE($descr),
-                               'min_users'  => $min_users,
-                               'min_prices' => $min_prices,
+                               'start_date' => MAKE_DATETIME($content['start_time'], "2"),
+                               'end_date'   => MAKE_DATETIME($content['end_time']  , "2"),
+                               'active_lnk' => TRANSLATE_YESNO($content['is_active']),
+                               'notify_lnk' => TRANSLATE_YESNO($content['send_notify']),
+                               'auto_lnk'   => TRANSLATE_YESNO($content['auto_add_new_user']),
+                               'notified'   => TRANSLATE_YESNO($content['notified']),
+                               'prices_cnt' => GET_TOTAL_DATA($content['id'], "rallye_prices", "id", "rallye_id", true),
+                               'descr'      => COMPILE_CODE($content['descr']),
+                               'min_users'  => $content['min_users'],
+                               'min_prices' => $content['min_prices'],
                        );
 
-                       // Free memory
-                       SQL_FREERESULT($result_prices);
-                       SQL_FREERESULT($result_user);
-
                        // Is the rallye active or not?
-                       switch ($active)
+                       switch ($content['is_active'])
                        {
                        case "Y":
                                // Rallye is active so do not edit it!
-                               $content['select'] = "<div class=\"big\">".$id."</strong>";
+                               $content['select'] = "<div class=\"big\">".$content['id']."</div>";
                                $content['active_title'] = getMessage('RALLYE_DEACTIVATE_NOW');
                                $content['active'] = 0;
                                break;
@@ -327,7 +341,7 @@ ORDER BY start_time DESC",
                        }
 
                        // Notification to members?
-                       switch ($notify)
+                       switch ($content['send_notify'])
                        {
                        case "Y":
                                $content['notify_title'] = getMessage('RALLYE_STOP_NOTIFY_NOW');
@@ -341,7 +355,7 @@ ORDER BY start_time DESC",
                        }
 
                        // Auto-add of new joined members?
-                       switch ($auto_add)
+                       switch ($content['auto_add_new_user'])
                        {
                        case "Y":
                                $content['auto_title'] = getMessage('RALLYE_STOP_AUTO_ADD_NOW');
index 8881b2f9fba60b92b6f7f3158009c5c6caf7a794..ad5d80972773a0a6fa8999385ff804b5a0c51129 100644 (file)
@@ -116,12 +116,14 @@ ORDER BY level ASC", __FILE__, __LINE__);
                                                // Output info message
                                                $levels['info'] = sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), ADMIN_USER_PROFILE_LINK($uid), $menge, $menge_lck);
 
-                                               // Load all refs
+                                               // Init variables
                                                $OUT_REFS = ""; $SW = 2;
-                                               while (list($refid) = SQL_FETCHROW($result_refs)) {
+
+                                               // Load all refs
+                                               while ($content = SQL_FETCHARRAY($result_refs)) {
                                                        // Query for data
                                                        $result_user = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email, status, joined FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-                                                               array($refid), __FILE__, __LINE__);
+                                                               array($content['refid']), __FILE__, __LINE__);
 
                                                        // Is the data there?
                                                        if (SQL_NUMROWS($result_user) == 1) {
@@ -130,7 +132,7 @@ ORDER BY level ASC", __FILE__, __LINE__);
 
                                                                // Check for referals
                                                                $result_cnt = SQL_QUERY_ESC("SELECT COUNT(userid) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE refid=%s",
-                                                                       array($refid), __FILE__, __LINE__);
+                                                                       array($content['refid']), __FILE__, __LINE__);
 
                                                                // Load refs
                                                                $refs_cnt = SQL_RESULT($result_cnt, 0, 0);
@@ -158,7 +160,7 @@ ORDER BY level ASC", __FILE__, __LINE__);
                                                                $OUT_REFS .= LOAD_TEMPLATE("admin_list_refs_row", true, $content);
                                                        } else {
                                                                // No refs found
-                                                               $OUT_REFS = LOAD_TEMPLATE("admin_list_refs_nodata", true, $refid);
+                                                               $OUT_REFS = LOAD_TEMPLATE("admin_list_refs_nodata", true, $content['refid']);
                                                        }
 
                                                        // Free result
index 569ff0e1d08e54935f3e82dae9802a36110c440d..f7c4601ce9830e45a4af6c2722cd5e2536bff177 100644 (file)
@@ -65,6 +65,7 @@ WHERE id='%s' LIMIT 1",
                if (empty($orders)) $orders = 0;
 
                // Prepare all data for the template
+               // @TODO Rewrite this huge amount of constants
                //  Sponsor's ID
                define('__SPONSOR_ID'         , REQUEST_GET('id'));
                //  Company's data
@@ -144,20 +145,21 @@ FROM `{!_MYSQL_PREFIX!}_sponsor_data` ORDER BY `id`", __FILE__, __LINE__);
        if (SQL_NUMROWS($result_main) > 0) {
                // At least one sponsor found!
                $OUT = ""; $SW = 2;
-               while (list($id, $gender, $sname, $fname, $email, $status, $created, $last, $amount, $used, $ip) = SQL_FETCHROW($result_main)) {
+               while ($content = SQL_FETCHARRAY($result_main)) {
                        // Transfer data to array
+                       // @TODO Rewritings: sname->surname,fname->family,ip->remote_addr in template
                        $content = array(
-                               'id'      => $id,
+                               'id'      => $content['id'],
                                'sw'      => $SW,
-                               'gender'   => TRANSLATE_GENDER($gender),
-                               'sname'   => $sname,
-                               'fname'   => $fname,
-                               'email'   => "mailto:".$email,
-                               'status'  => SPONSOR_TRANSLATE_STATUS($status),
-                               'created' => MAKE_DATETIME($created, "2"),
-                               'last'    => MAKE_DATETIME($last, "2"),
-                               'points'  => TRANSLATE_COMMA($amount - $used),
-                               'ip'      => $ip,
+                               'gender'  => TRANSLATE_GENDER($content['gender']),
+                               'sname'   => $content['surname'],
+                               'fname'   => $content['family'],
+                               'email'   => "mailto:".$content['email'],
+                               'status'  => SPONSOR_TRANSLATE_STATUS($content['status']),
+                               'created' => MAKE_DATETIME($content['sponsor_created'], "2"),
+                               'last'    => MAKE_DATETIME($content['last_online'], "2"),
+                               'points'  => TRANSLATE_COMMA($content['points_amount'] - $content['points_used']),
+                               'ip'      => $content['remote_addr'],
                        );
 
                        // Load row template
@@ -167,6 +169,8 @@ FROM `{!_MYSQL_PREFIX!}_sponsor_data` ORDER BY `id`", __FILE__, __LINE__);
 
                // Free memory
                SQL_FREERESULT($result_main);
+
+               // @TODO Rewrite this constant
                define('__SPONSOR_ROWS', $OUT);
 
                // Load final template
index e9cb3ea77757620f6ac6d5d4f85142f37719c0eb..12098ede2f5f57a6fdc8fe15deef15af763709a4 100644 (file)
@@ -113,13 +113,13 @@ if (REQUEST_ISSET_POST(('add'))) {
                        ), __FILE__, __LINE__);
 
                // Payment type added!
-               $MSG = ADMIN_SPONSOR_PAYTYPE_ADDED_1.REQUEST_POST('pay_name').ADMIN_SPONSOR_PAYTYPE_ADDED_2;
+               $MSG = sprintf(getMessage('ADMIN_SPONSOR_PAYTYPE_ADDED'), REQUEST_POST('pay_name'));
        } else {
                // Free memory
                SQL_FREERESULT($result);
 
                // Entry does already exists
-               $MSG = ADMIN_SPONSOR_PAYTYPE_ALREADY_1.REQUEST_POST('pay_name').ADMIN_SPONSOR_PAYTYPE_ALREADY_2;
+               $MSG = sprintf(getMessage('ADMIN_SPONSOR_PAYTYPE_ALREADY'), REQUEST_POST('pay_name'));
        }
 
        // Output message
@@ -160,7 +160,7 @@ if (REQUEST_ISSET_POST(('add'))) {
 
                // Switch colors
                $SW = 3 - $SW;
-       }
+       } // END - foreach
 
        // Remember content in constant
        define('__SPONSOR_ROWS', $OUT);
@@ -181,18 +181,18 @@ if (REQUEST_ISSET_POST(('add'))) {
        // Do we have some paytypes setup?
        if (SQL_NUMROWS($result) > 0) {
                // Prepare variables for listing
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
 
                // List alle found payment types
-               while (list($id, $name, $rate, $min, $currency) = SQL_FETCHROW($result)) {
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Remember data in array
                        $content = array(
                                'sw'       => $SW,
-                               'id'       => $id,
-                               'name'     => $name,
-                               'rate'     => TRANSLATE_COMMA($rate),
-                               'min'      => $min,
-                               'currency' => $currency
+                               'id'       => $content['id'],
+                               'name'     => $content['pay_name'],
+                               'rate'     => TRANSLATE_COMMA($content['pay_rate']),
+                               'min'      => $content['pay_min_count'],
+                               'currency' => $content['pay_currency']
                        );
 
                        // Add row
@@ -200,7 +200,7 @@ if (REQUEST_ISSET_POST(('add'))) {
 
                        // Switch colors
                        $SW = 3 - $SW;
-               }
+               } // END - while
 
                // Free memory
                SQL_FREERESULT($result);
index 7ff74e062a92857e3c569d3de732591a21fe1541..13c5d17a14f494b9860f62b8d79c13253a2d7182 100644 (file)
@@ -120,58 +120,59 @@ ORDER BY userid DESC, task_type DESC, subject, task_created DESC", __FILE__, __L
                }
 
                // There are uncompleted jobs!
-               $type = constant('ADMIN_OVERVIEW_TASK_'.strtoupper(REQUEST_GET('type')).'_TYPE');
+               $type = getMessage('ADMIN_OVERVIEW_TASK_'.strtoupper(REQUEST_GET('type')).'_TYPE');
+               // @TODO Rewrite these templates to one and add $OUT
                LOAD_TEMPLATE("admin_overview_header_task", false, array(
                        'message' => $type,
                        'type'    => REQUEST_GET('type')
                ));
-               $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 link
-                       $admin = GENERATE_AID_LINK($admin);
+                       $content['assigned_admin'] = GENERATE_AID_LINK($content['assigned_admin']);
 
                        // Get admin task
-                       $type_out = constant('ADMIN_TASK_IS_'.strtoupper($type).'');
+                       $content['task_type_msg'] = getMessage('ADMIN_TASK_IS_'.strtoupper($content['task_type']).'');
 
-                       $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;
                        }
 
                        // Member assigned with task?
-                       if ($uid > 0) {
+                       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 {
                                // Is a system task!
-                               $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 an 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_list_task_ext_rows", false, $content);
                        } else {
                                // Load default row template
+                               // @TODO Rewrite this to $OUT .= ..., true, ...
                                LOAD_TEMPLATE("admin_list_task_rows", false, $content);
                        }
 
@@ -183,13 +184,10 @@ ORDER BY userid DESC, task_type DESC, subject, task_created DESC", __FILE__, __L
                SQL_FREERESULT($result_tasks);
 
                // Load footer template
-               if (REQUEST_GET('type') == "deleted")
-               {
+               if (REQUEST_GET('type') == "deleted") {
                        // Delete now button
                        LOAD_TEMPLATE("admin_overview_footer_task");
-               }
-                else
-               {
+               } else {
                        // Normal footer
                        LOAD_TEMPLATE("admin_overview_footer");
                }
index c2a1d56268ed9af912082ecbccfc7828e2dbf698..960970328922f119a0c98a09e98acd3a08278382 100644 (file)
@@ -47,22 +47,21 @@ 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
                $content = array(
                        'sw'        => $SW,
-                       'idx'       => $idx,
-                       'stamp'     => MAKE_DATETIME($stamp, "3"),
-                       'from_link' => ADMIN_USER_PROFILE_LINK($uid1),
-                       'to_link'   => ADMIN_USER_PROFILE_LINK($uid2),
-                       'reason'    => wordwrap($reason, 15),
-                       'points'    => TRANSLATE_COMMA($points),
+                       'idx'       => $content['trans_id'],
+                       'stamp'     => MAKE_DATETIME($content['time_trans'], "3"),
+                       'from_link' => ADMIN_USER_PROFILE_LINK($content['userid']),
+                       'to_link'   => ADMIN_USER_PROFILE_LINK($content['to_uid']),
+                       'reason'    => wordwrap($content['reason'], 15),
+                       'points'    => TRANSLATE_COMMA($content['points']),
                );
 
                // Load row template add points and switch color
                $OUT .= LOAD_TEMPLATE("admin_list_transfer_row", true, $content);
-               $total += $points; $SW = 3 - $SW;
+               $total += $content['points']; $SW = 3 - $SW;
        }
 
        // Free memory
@@ -73,22 +72,23 @@ if (SQL_NUMROWS($result) > 0)
        // 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 these constants
 define('__TRANSFER_ROWS', $OUT);
 
 // Remeber total amount
 define('__TRANSFER_TOTAL_VALUE', TRANSLATE_COMMA($total));
 
 // Set title
-define('__TRANSFER_TITLE', TRANSFER_LIST_ALL);
+define('__TRANSFER_TITLE', getMessage('TRANSFER_LIST_ALL'));
 
 // Set "balance" word
-define('__TRANSFER_SUM', TRANSFER_TOTAL_BALANCE);
+define('__TRANSFER_SUM', getMessage('TRANSFER_TOTAL_BALANCE'));
 
 // Don't show a delete button
 define('__TRANSFER_DELETE', "&nbsp;");
index 0c009ba6b8a8435825f9071a1ea0bb61e87319a0..4ec7a6470e1a705a6afd27f918141b6c5ebd7f8e 100644 (file)
@@ -84,12 +84,15 @@ if ($listed === true) {
        $result = SQL_QUERY($sql, __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Mail order / bonus mail found!
+               // @TODO Rewrite this to $content = SQL_FETCHARRAY(), look some lines above for two differrent queries
                list($stats_id, $sender, $subj, $text, $url, $stamp, $max) = SQL_FETCHROW($result);
                SQL_FREERESULT($result);
 
                // Transfer data to constants for the template
                if (($stats_id > 0) && ($ID == "-1")) $ID = $stats_id;
                if ($col == "bonus_id") $sender = 0;
+
+               // @TODO Rewrite these constants
                define('__LIST_UNCON_SENDER' , $sender);
                define('__LIST_UNCON_SUBJECT', COMPILE_CODE($subj));
                define('__LIST_UNCON_TEXT'   , COMPILE_CODE($text));
@@ -107,22 +110,25 @@ ON l.userid=u.userid
 WHERE l.%s='%s' ORDER BY l.userid LIMIT %s",
                        array($col, $ID, bigintval($max)),__FILE__, __LINE__);
                $unconfirmed = SQL_NUMROWS($result);
+
+               // @TODO Rewrite this constant
                define('__LIST_UNCO_UNCONFIRMED', $unconfirmed);
 
                if ($unconfirmed > 0) {
                        // At least one link left to confirm
                        $OUT = LOAD_TEMPLATE("admin_list_unconfirmed_header", true);
                        $SW = 2;
-                       while (list($uid, $status, $sname, $fname, $gender, $email) = SQL_FETCHROW($result)) {
+                       while ($content = SQL_FETCHARRAY($result)) {
                                // Prepare data for the row template
+                               // @TODO Rewritings: uid->userid
                                $content = array(
                                        'sw'     => $SW,
-                                       'u_link' => ADMIN_USER_PROFILE_LINK($uid),
-                                       'uid'    => $uid,
+                                       'u_link' => ADMIN_USER_PROFILE_LINK($content['userid']),
+                                       'uid'    => $content['userid'],
                                        'link'   => $LINK,
                                        'id'     => $ID,
-                                       'email'  => "<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".TRANSLATE_GENDER($gender)." ".$sname." ".$fname."</a>",
-                                       'status' => TRANSLATE_STATUS($status),
+                                       'email'  => "<a href=\"".CREATE_EMAIL_LINK($content['email'], "user_data")."\">".TRANSLATE_GENDER($content['gender'])." ".$content['surname']." ".$content['family']."</a>",
+                                       'status' => TRANSLATE_STATUS($content['status']),
                                );
 
                                // Load row template and switch colors
index 8605c8c587246c2866c27bf355a59a7a9b84f9cf..da272fda88862c89476832a9d4f8a72c26493233 100644 (file)
@@ -287,7 +287,7 @@ LIMIT 1",
                }
 
                // Load all users
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
                while ($content = SQL_FETCHARRAY($result)) {
                        // Set refid link
                        if ($content['refid'] > 0) $content['refid'] = ADMIN_USER_PROFILE_LINK($content['refid']);
index 72b54fb70e4c44bc256f9f37af7b1160078e139c..e612e1d1096be876096679ca8a980afa68744826 100644 (file)
@@ -44,31 +44,33 @@ ADD_DESCR("admin", __FILE__);
 // Check if the admin has entered title and what-php file name...
 if ((!REQUEST_ISSET_POST(('title'))) && (IS_FORM_SENT())) {
        REQUEST_UNSET_POST('ok');
-}
+} // END - if
 
 if (!IS_FORM_SENT()) {
        // Create arrays
        $menus = array(); $titles = array(); $below = array();
 
        // Get all available main menus
-       $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (what='' OR `what` IS NULL) ORDER BY `sort`", __FILE__, __LINE__);
+       $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (what='' OR `what` IS NULL) ORDER BY `sort`",
+               __FILE__, __LINE__);
        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;
                }
 
                // 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) {
                        if ($value == $prev) {
@@ -79,7 +81,7 @@ if (!IS_FORM_SENT()) {
                        } else {
                                $prev = $value;
                        }
-               }
+               } // END - foreach
 
                // Prepare variables
                $menus = $dmy; $titles = $dmy2; $below = $dmy3;
@@ -95,21 +97,22 @@ if (!IS_FORM_SENT()) {
                                $below[$value_main] = array();
 
                                // Read menu structure
-                               while (list($act, $title, $sort) = SQL_FETCHROW($result)) {
+                               while ($content = SQL_FETCHARRAY($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) {
@@ -119,14 +122,18 @@ if (!IS_FORM_SENT()) {
                                        } else {
                                                $prev = $value;
                                        }
-                               }
-                               $menus[$value_main] = $dmy; $titles[$value_main] = $dmy2; $below[$value_main] = $dmy3;
-                       }
-               }
-       }
+                               } // END - foreach
+
+                               // Transfer variables into array
+                               $menus[$value_main]  = $dmy;
+                               $titles[$value_main] = $dmy2;
+                               $below[$value_main]  = $dmy3;
+                       } // END - if
+               } // END - foreach
+       } // END - if
 
        $OUT = "<select class=\"admin_select\" name=\"sort\" size=\"1\">
-      <option value=\"\">".IS_FIRST_MENU."</option>";
+      <option value=\"\">{--IS_FIRST_MENU--}</option>\n";
        foreach ($below as $key => $m) {
                if (is_array($m)) {
                        foreach ($m as $key2 => $m2) {
@@ -152,26 +159,25 @@ if (!IS_FORM_SENT()) {
        LOAD_TEMPLATE("admin_member_add");
 } elseif (!IS_DEMO()) {
        // Insert new menu entry
-       if (REQUEST_ISSET_POST(('menu')))
-       {
+       if (REQUEST_ISSET_POST(('menu'))) {
                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('%s','%s','%s','%s','%s','%s')",
- array(
-       REQUEST_POST('menu'),
-       REQUEST_POST('name'),
-       REQUEST_POST('title'),
-       REQUEST_POST('visible'),
-       REQUEST_POST('active'),
-       bigintval(REQUEST_POST('sort')),
-), __FILE__, __LINE__);
                      array(
+                               REQUEST_POST('menu'),
+                               REQUEST_POST('name'),
+                               REQUEST_POST('title'),
+                               REQUEST_POST('visible'),
+                               REQUEST_POST('active'),
+                               bigintval(REQUEST_POST('sort')),
+                       ), __FILE__, __LINE__);
        } else {
                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`title`,`visible`,`locked`,`sort`) VALUES ('%s','%s','%s','%s','%s')",
- array(
-       REQUEST_POST('name'),
-       REQUEST_POST('title'),
-       REQUEST_POST('visible'),
-       REQUEST_POST('active'),
-       bigintval(REQUEST_POST('sort')),
-), __FILE__, __LINE__);
                      array(
+                               REQUEST_POST('name'),
+                               REQUEST_POST('title'),
+                               REQUEST_POST('visible'),
+                               REQUEST_POST('active'),
+                               bigintval(REQUEST_POST('sort')),
+                       ), __FILE__, __LINE__);
        }
        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('SETTINGS_SAVED'));
 } else {
index 4d86acd021bd2ddc05e9a93d5e1d93d1752126d4..b65af84b28864f9cf42a982e438f5de9cdf9687e 100644 (file)
@@ -247,42 +247,46 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) {
        $max = SQL_NUMROWS($result);
        if ($max > 0) {
                // Set sub value
+               // @TODO Rewrite this constant
                define('__SUB_VALUE', $SUB);
 
                $SW = 2; $cnt = 0; $OUT = "";
-               while (list($id, $act, $wht, $title, $sort) = SQL_FETCHROW($result)) {
+               while ($content = SQL_FETCHARRAY($result)) {
+                       // Init navigation
+                       $content['navi'] = "";
                        $cnt++;
-                       if (($sort == 0) || (($sort == 1) && (!empty($SUB)))) {
+                       if (($content['sort'] == 0) || (($content['sort'] == 1) && (!empty($SUB)))) {
                                // Is highest position
-                               $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=memedit&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=memedit&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=memedit&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=memedit&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=memedit&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=memedit&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=memedit&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=memedit&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 values for 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'   => "mem",
-                       );
+                       // Add more entries
+                       $content['sw']   = $SW;
+                       $content['mode'] = "mem";
+
+                       // Load row template and switch color
                        $OUT .= LOAD_TEMPLATE("admin_menu_overview_row", true, $content);
                        $SW = 3 - $SW;
                }
 
                // Free memory
                SQL_FREERESULT($result);
+
+               // @TODO Rewrite this constant
                define('__MENU_ROWS', $OUT);
+
+               // Load main template
                LOAD_TEMPLATE("admin_mmenu_overview");
        } else {
                // Menu entries are missing... (???)
index 4f1a7073b46714444169be33505e8ed10cdb05e8..4dd390c8a287df2aa5e93b8424a4f39ee6432c0d 100644 (file)
@@ -61,7 +61,7 @@ if ($GLOBALS['action'] == "login") {
 // Are there jobs to be done?
 if ($JOBS_DONE) {
        // Generate overview of all main menus
-       if ((is_array($GLOBALS['menu']['description'])) && (sizeof($GLOBALS['menu']['description']) > 0)) {
+       if ((is_array($GLOBALS['menu']['description'])) && (count($GLOBALS['menu']['description']) > 0)) {
                $OUT = "";
                foreach ($GLOBALS['menu']['description'] as $key => $value)
                {
index 0b2c08ff71482498812ecb34444dbfb04392aae5..94c42935270953c74195586f779f4639d26a8203 100644 (file)
@@ -86,7 +86,7 @@ if (IS_FORM_SENT()) {
        LOAD_TEMPLATE("admin_settings_saved", false, $content);
 } elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
        // Delete entries here
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        foreach (REQUEST_POST('sel') as $id => $value) {
                $result = SQL_QUERY_ESC("SELECT time, mail_title FROM `{!_MYSQL_PREFIX!}_payments` WHERE id=%s LIMIT 1",
                        array(bigintval($id)), __FILE__, __LINE__);
@@ -111,7 +111,7 @@ if (IS_FORM_SENT()) {
        LOAD_TEMPLATE("admin_del_payments");
 } 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) {
                $result = SQL_QUERY_ESC("SELECT time, payment, mail_title, price FROM `{!_MYSQL_PREFIX!}_payments` WHERE id=%s LIMIT 1",
                 array(bigintval($id)), __FILE__, __LINE__);
@@ -141,21 +141,19 @@ if (IS_FORM_SENT()) {
        $result = SQL_QUERY("SELECT id, time, payment, mail_title, price FROM `{!_MYSQL_PREFIX!}_payments` ORDER BY time", __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, $time, $pay, $title, $price) = SQL_FETCHROW($result)) {
-                       $pay   = TRANSLATE_COMMA($pay);
-                       $price = TRANSLATE_COMMA($price);
-
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Prepare array for the row template
+                       // @TODO Rewritings: title->mail_title, pay->payment in template
                        $content = array(
                                'sw'    => $SW,
-                               'id'    => $id,
-                               'time'  => $time,
-                               'title' => $title,
-                               'pay'   => $pay,
-                               'price' => $price,
+                               'id'    => $content['id'],
+                               'time'  => $content['time'],
+                               'title' => $content['mail_title'],
+                               'pay'   => TRANSLATE_COMMA($content['payment']),
+                               'price' => TRANSLATE_COMMA($content['price'])
                        );
 
                        // Load row template and switch colors
index ba4d56c81cab3206abf9c22e4d9dbce9d51fdbd6..c60def4c5b81c47ff7b483b7aeee0bc23bc9a474 100644 (file)
@@ -90,7 +90,7 @@ VALUES ('%s','%s','%s')",
        }
 
        if (SQL_AFFECTEDROWS() == 1) {
-               $content = SETTINGS_SAVED;
+               $content = getMessage('SETTINGS_SAVED');
        } else {
                $content = "<span class=\"admin_failed\">{--SETTINGS_NOT_SAVED--}</span>";
        }
@@ -101,7 +101,7 @@ VALUES ('%s','%s','%s')",
        foreach (REQUEST_POST('sel') as $id => $sel) {
                // Load data
                $result = SQL_QUERY_ESC("SELECT url, alternate, visible FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE id=%s LIMIT 1",
-                array(bigintval($id)), __FILE__, __LINE__);
+                       array(bigintval($id)), __FILE__, __LINE__);
                list($url, $alt, $vis) = SQL_FETCHROW($result);
                SQL_FREERESULT($result);
 
@@ -118,13 +118,14 @@ VALUES ('%s','%s','%s')",
                $OUT .= LOAD_TEMPLATE("admin_refbanner_edit_row", true, $content);
                $SW = 3 - $SW;
        }
+
+       // @TODO Rewrite this constant
        define('__BANNER_ROWS', $OUT);
 
        // Load main template
        LOAD_TEMPLATE("admin_refbanner_edit");
 } else {
-       if (($SEL > 0) && (REQUEST_ISSET_POST('del')))
-       {
+       if (($SEL > 0) && (REQUEST_ISSET_POST('del'))) {
                // Delete banner
                foreach (REQUEST_POST('sel') as $id => $sel) {
                        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE id=%s LIMIT 1",
@@ -133,22 +134,22 @@ VALUES ('%s','%s','%s')",
        }
 
        // Referal levels
-       $result = SQL_QUERY("SELECT id, url, alternate, visible, counter, clicks FROM `{!_MYSQL_PREFIX!}_refbanner` ORDER BY url", __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) > 0)
-       {
+       $result = SQL_QUERY("SELECT id, url, alternate, visible, counter, clicks FROM `{!_MYSQL_PREFIX!}_refbanner` ORDER BY url",
+               __FILE__, __LINE__);
+       if (SQL_NUMROWS($result) > 0) {
                // Make referal banner editable and deletable
-               $SW = 2; $OUT = "";
-               while (list($id, $url, $alt, $vis, $cntr, $clks) = SQL_FETCHROW($result))
-               {
+               $OUT = ""; $SW = 2;
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Preapre data for the row
+                       // @TODO Rewritings: alt->alternate,cnt->counter,clx->clicks in template
                        $content = array(
                                'sw'  => $SW,
-                               'id'  => $id,
-                               'url' => $url,
-                               'alt' => $alt,
-                               'vis' => TRANSLATE_YESNO($vis),
-                               'cnt' => $cntr,
-                               'clx' => $clks
+                               'id'  => $content['id'],
+                               'url' => $content['url'],
+                               'alt' => $content['alternate'],
+                               'vis' => TRANSLATE_YESNO($content['visible']),
+                               'cnt' => $content['counter'],
+                               'clx' => $content['clicks']
                        );
 
                        // Load row template and switch color
@@ -158,6 +159,8 @@ VALUES ('%s','%s','%s')",
 
                // Free memory
                SQL_FREERESULT($result);
+
+               // @TODO Rewrite this constant
                define('__BANNER_ROWS', $OUT);
 
                // Load main template
index 721aea9c1f0d5ae9d24eb320a0db14f7464cc0d6..c634d685c5c279ae7fbbe9921583dcdf7505351d 100644 (file)
@@ -41,16 +41,17 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 ADD_DESCR("admin", __FILE__);
 
 $ACTIONS = array();
+
 // First fix all main menus (what="")...
 $result_fix = SQL_QUERY("SELECT id, action FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (what='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
 $cnt = 0; $REP = 0;
-while (list($id, $act) = SQL_FETCHROW($result_fix)) {
+while ($content = SQL_FETCHARRAY($result_fix)) {
        // Store act value for later usage in sorting sub menus
-       $ACTIONS[] = $act;
+       $ACTIONS[] = $content['action'];
 
        // Fix weight
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET sort=%s WHERE id=%s LIMIT 1",
-               array($cnt, $id), __FILE__, __LINE__);
+               array($cnt, $content['id']), __FILE__, __LINE__);
        $REP += SQL_AFFECTEDROWS();
 
        // Count one up
@@ -65,10 +66,10 @@ foreach ($ACTIONS as $act) {
        $result_fix = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
                array($act), __FILE__, __LINE__);
        $cnt = 1;
-       while (list($id) = SQL_FETCHROW($result_fix)) {
+       while ($content = SQL_FETCHARRAY($result_fix)) {
                // Fix weight
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET sort=%s WHERE id=%s LIMIT 1",
-                       array($cnt, $id), __FILE__, __LINE__);
+                       array($cnt, $content['id']), __FILE__, __LINE__);
                $REP += SQL_AFFECTEDROWS();
 
                // Count one up
index 038b4a27031e714e73da20bf7e8c50d72ecee23e..91af1e28cbd7d6486d45f717ff59bb8fca178ccd 100644 (file)
@@ -44,19 +44,19 @@ $result = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_cats` ORDER BY u
 if (SQL_NUMROWS($result) > 0) {
        // Check if found userid is also found in user_data table
        $REMOVED = 0; // Nothing is removed for now... ;-)
-       while (list($uid) = SQL_FETCHROW($result)) {
+       while ($content = SQL_FETCHARRAY($result)) {
                $result_user = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-                       array(bigintval($uid)), __FILE__, __LINE__);
+                       array(bigintval($content['userid'])), __FILE__, __LINE__);
                if (SQL_NUMROWS($result_user) == 0) {
                        // Ok, we found something to remove
                        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE userid=%s",
-                               array(bigintval($uid)), __FILE__, __LINE__);
+                               array(bigintval($content['userid'])), __FILE__, __LINE__);
                        $REMOVED += SQL_AFFECTEDROWS();
                } else {
                        // Free memory
                        SQL_FREERESULT($result_user);
                }
-       }
+       } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
index 7475df7fec6b6861020630fec6eaf6a2872c0dfb..e2d5363a5b82bb4dde26712c3341d48e48e1f3bc 100644 (file)
@@ -44,12 +44,12 @@ $ACTIONS = array();
 // First fix all main menus (what="")...
 $result_fix = SQL_QUERY("SELECT id, action FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (what='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
 $cnt = 0; $REP = 0;
-while (list($id, $act) = SQL_FETCHROW($result_fix)) {
+while ($content = SQL_FETCHARRAY($result_fix)) {
        // Store act value for later usage in sorting sub menus
-       $ACTIONS[] = $act;
+       $ACTIONS[] = $content['action'];
 
        // Fix weight
-       $result_sort = SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET sort='".$cnt."' WHERE id='".$id."' LIMIT 1", __FILE__, __LINE__);
+       $result_sort = SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET sort='".$cnt."' WHERE id='".$content['id']."' LIMIT 1", __FILE__, __LINE__);
        $REP += SQL_AFFECTEDROWS();
 
        // Count one up
@@ -63,10 +63,10 @@ foreach ($ACTIONS as $act) {
        $result_fix = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
                array($act), __FILE__, __LINE__);
        $cnt = 1;
-       while (list($id) = SQL_FETCHROW($result_fix)) {
+       while ($content = SQL_FETCHARRAY($result_fix)) {
                // Fix weight
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET sort=%s WHERE id=%s LIMIT 1",
-                       array($cnt, $id), __FILE__, __LINE__);
+                       array($cnt, $content['id']), __FILE__, __LINE__);
                $REP += SQL_AFFECTEDROWS();
 
                // Count one up
index 566b219bee366c90e45cb3bb58f57cef3f34719f..c4681a0b2accca05fab722ca33886316b157adc1 100644 (file)
@@ -41,21 +41,23 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 ADD_DESCR("admin", __FILE__);
 
 $ACTIONS = array();
+
 // First fix all main menus (what="")...
 $result_fix = SQL_QUERY("SELECT id, action FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (what='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
 $cnt = 0; $REP = 0;
-while (list($id, $act) = SQL_FETCHROW($result_fix)) {
+while ($content = SQL_FETCHARRAY($result_fix)) {
        // Store action value for later usage in sorting sub menus
-       $ACTIONS[] = $act;
+       $ACTIONS[] = $content['action'];
 
        // Fix weight
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET sort=%s WHERE id=%s LIMIT 1",
-               array($cnt, $id), __FILE__, __LINE__);
+               array($cnt, $content['id']), __FILE__, __LINE__);
        $REP += SQL_AFFECTEDROWS();
 
        // Count one up
        $cnt++;
 }
+
 // Set logout weight to 999
 SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET sort='999' WHERE `action`='logout' AND (what='' OR `what` IS NULL) LIMIT 1", __FILE__, __LINE__);
 
@@ -64,10 +66,10 @@ foreach ($ACTIONS as $act) {
        $result_fix = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
                array($act), __FILE__, __LINE__);
        $cnt = 1;
-       while (list($id) = SQL_FETCHROW($result_fix)) {
+       while ($content = SQL_FETCHARRAY($result_fix)) {
                // Fix weight
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET sort=%s WHERE id=%s LIMIT 1",
-                       array($cnt, $id), __FILE__, __LINE__);
+                       array($cnt, $content['id']), __FILE__, __LINE__);
                $REP += SQL_AFFECTEDROWS();
 
                // Count one up
index 98f17236698cf97f61604f1310d12c7f52789287..2113d74fa86d552d80e62fe39570da8cd1b18274 100644 (file)
@@ -47,7 +47,7 @@ WHERE `status`='CONFIRMED' AND nl_receive='Y'
 ORDER BY userid ASC", __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // Members are available so we can send out the newsletter!
-               while (list($id, $email) = SQL_FETCHROW($result)) {
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Construct mail...
                        $template = "newsletter";
 
@@ -64,10 +64,10 @@ ORDER BY userid ASC", __FILE__, __LINE__);
                        REQUEST_SET_POST('text', COMPILE_CODE(REQUEST_POST('text')));
 
                        // Load template
-                       $msg = LOAD_EMAIL_TEMPLATE($template, array('text' => REQUEST_POST('text')), $id);
+                       $msg = LOAD_EMAIL_TEMPLATE($template, array('text' => REQUEST_POST('text')), $content['userid']);
 
                        // ... and send it away!
-                       SEND_NEWSLETTER($email, REQUEST_POST('subject'), $msg, REQUEST_POST('mode'));
+                       SEND_NEWSLETTER($content['email'], REQUEST_POST('subject'), $msg, REQUEST_POST('mode'));
                }
 
                // Free memory
@@ -78,6 +78,7 @@ ORDER BY userid ASC", __FILE__, __LINE__);
        }
 } else {
        // Copy data into constants for the template and load it
+       // @TODO Rewrite this constant
        define('_DATESTAMP', MAKE_DATETIME(time(), "3"));
        if (EXT_IS_ACTIVE("html_mail")) {
                // Load template with HTML mode
index 33e9536e1207b8ebff2518d2132bd8185b5e9e19..7180f1811c43efe4e7e1118255dd1ba3a62f7e49 100644 (file)
@@ -41,7 +41,7 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 ADD_DESCR("admin", __FILE__);
 
 // If var is empty set it to empty
-if (!REQUEST_ISSET_GET(('mod'))) REQUEST_SET_GET('mod', "");
+if (!REQUEST_ISSET_GET('mod')) REQUEST_SET_GET('mod', "");
 
 // Check if module was selected
 if ((REQUEST_GET('mod') == "index") || (REQUEST_GET('mod') == "login")) {
@@ -50,27 +50,25 @@ if ((REQUEST_GET('mod') == "index") || (REQUEST_GET('mod') == "login")) {
        switch (REQUEST_GET('mod')) {
                case "index": $mod = "guest" ; break;
                case "login": $mod = "member"; break;
-       }
+               default: // Unknown
+                       DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown mod %s detected.", REQUEST_GET('mod')));
+                       break;
+       } // END - switch
 
        // Load module's detail statistic
        $result = SQL_QUERY_ESC("SELECT action, title, counter FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `what` != '' AND `what` IS NOT NULL ORDER BY counter DESC",
                array($mod), __FILE__, __LINE__);
-       $SW = 2; $OUT = "";
-       while (list($act, $title, $clicks) = SQL_FETCHROW($result)) {
-               // Prepare array for the template
-               $content = array(
-                       'sw'     => $SW,
-                       'title'  => $title,
-                       'action' => $act,
-                       'clicks' => $clicks,
-               );
+       $OUT = ""; $SW = 2;
+       while ($content = SQL_FETCHARRAY($result)) {
+               // Add color switch
+               $content['sw'] = $SW;
 
                // Load row template
                $OUT .= LOAD_TEMPLATE("admin_mods_stats2_row", true, $content);
 
                // Switch colors
                $SW = 3 - $SW;
-       }
+       } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
@@ -81,25 +79,21 @@ if ((REQUEST_GET('mod') == "index") || (REQUEST_GET('mod') == "login")) {
 } else {
        // Load module statics
        $result = SQL_QUERY("SELECT module, title, clicks FROM `{!_MYSQL_PREFIX!}_mod_reg` ORDER BY clicks DESC, module", __FILE__, __LINE__);
-       $SW = 2; $OUT = "";
-       while (list($mod, $title, $clicks) = SQL_FETCHROW($result)) {
-               if (empty($title)) $title = "---";
-               if (($mod == "index") || ($mod == "login"))
-               {
+       $OUT = ""; $SW = 2;
+       while ($content = SQL_FETCHARRAY($result)) {
+               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>";
-               }
-               // Prepare array for the template
-               $content = array(
-                       'sw'     => $SW,
-                       'title'  => $title,
-                       'mod'    => $mod,
-                       'clicks' => $clicks,
-               );
+                       $content['module'] = "<strong><a href=\"{!URL!}/modules.php?module=admin&amp;what=stats_mods&amp;mod=".$content['module']."\">".$content['module']."</a></strong>";
+               } // END - if
+
+               // Add color switch
+               $content['sw'] = $SW;
 
                // Load row template
                $OUT .= LOAD_TEMPLATE("admin_mods_stats_row", true, $content);
-       }
+       } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
index 775fdaeac3f10b58553f1f8218e17394ce742014..8c0d30b044fdd5ee821340242e51f57224f7ea63 100644 (file)
@@ -45,38 +45,26 @@ if (!REQUEST_ISSET_GET(('uid'))) REQUEST_SET_GET('uid', "");
 
 if (REQUEST_GET('uid') == "all") {
        // Add points to all accounts
+       // @TODO Rewrite this constant
        define('__POINTS_VALUE', REQUEST_POST('points'));
+
+       // Is the form sent?
        if ((IS_FORM_SENT()) && (REQUEST_POST('points') > 0)) {
-               $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)) {
-                       // User ID found in URL so we use this give him some credits
-                       $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
-                               array(bigintval($uid)), __FILE__, __LINE__);
-
-                       // Entry found?
-                       if (SQL_NUMROWS($result) == 1) {
-                               // Selected user does exist
-                               list($sname, $fname, $email) = SQL_FETCHROW($result);
-
-                               // Free result
-                               SQL_FREERESULT($result);
-
-                               if ((IS_FORM_SENT()) && (REQUEST_ISSET_POST(('points')))) {
-                                       // Ok, add points to used points and send an email to him...
-                                       SUB_POINTS("admin_all", $uid, REQUEST_POST('points'));
-
-                                       // Prepare content
-                                       $content = array(
-                                               'text'   => SQL_ESCAPE(REQUEST_POST('reason')),
-                                               'points' => bigintval(REQUEST_POST('points'))
-                                       );
-
-                                       // Load message and send it away
-                                       $msg = LOAD_EMAIL_TEMPLATE("sub-points", $content, bigintval($uid));
-                                       SEND_EMAIL(bigintval($uid), getMessage('ADMIN_SUB_SUBJ'), $msg);
-                               }
-                       }
-               }
+               $result_main = SQL_QUERY("SELECT userid, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' ORDER BY userid",
+                       __FILE__, __LINE__);
+               while ($content = SQL_FETCHARRAY($result_main)) {
+                       // Ok, add points to used points and send an email to him...
+                       SUB_POINTS("admin_all", $content['userid'], REQUEST_POST('points'));
+
+                       // Add more content
+                       $content['text']   = SQL_ESCAPE(REQUEST_POST('reason'));
+                       $content['points'] = bigintval(REQUEST_POST('points'));
+
+                       // Load message and send it away
+                       $msg = LOAD_EMAIL_TEMPLATE("sub-points", $content, bigintval($content['userid']));
+                       SEND_EMAIL($content['email'], getMessage('ADMIN_SUB_SUBJ'), $msg);
+               } // END - while
+
                // Free memory
                SQL_FREERESULT($result_main);
 
@@ -92,35 +80,37 @@ if (REQUEST_GET('uid') == "all") {
                array(bigintval(REQUEST_GET('uid'))),__FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Selected user does exist
-               list($sname, $fname, $email) = SQL_FETCHROW($result);
-               SQL_FREERESULT($result);
+               $content = SQL_FETCHARRAY($result);
 
                if ((IS_FORM_SENT()) && (REQUEST_ISSET_POST(('points')))) {
                        // Ok, add to used points and send an email to him...
                        SUB_POINTS("admin_single", bigintval(REQUEST_GET('uid')), REQUEST_POST('points'));
 
-                       // Prepare content
-                       $content = array(
-                               'text'   => SQL_ESCAPE(REQUEST_POST('reason')),
-                               'points' => bigintval(REQUEST_POST('points'))
-                       );
+                       // Add more content
+                       $content['text']   = SQL_ESCAPE(REQUEST_POST('reason'));
+                       $content['points'] = bigintval(REQUEST_POST('points'));
 
                        // Load email and send it away
                        $msg = LOAD_EMAIL_TEMPLATE("sub-points", $content, bigintval(REQUEST_GET('uid')));
-                       SEND_EMAIL(bigintval(REQUEST_GET('uid')), getMessage('ADMIN_SUB_SUBJ'), $msg);
+                       SEND_EMAIL($content['email'], getMessage('ADMIN_SUB_SUBJ'), $msg);
 
                        // Output message
                        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_POINTS_SUBTRACTED'));
                } else {
-                       // Opps, missing form here
-                       define('__USER_VALUE', "<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$sname." ".$fname."</a>");
+                       // @TODO Rewrite these constants
+                       define('__USER_VALUE', "<a href=\"".CREATE_EMAIL_LINK($content['email'], "user_data")."\">".$content['surname']." ".$content['family']."</a>");
                        define('__UID', bigintval(REQUEST_GET('uid')));
+
+                       // Load form
                        LOAD_TEMPLATE("admin_sub_points");
                }
        } else {
                // User not found!
                LOAD_TEMPLATE("admin_settings_saved", false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");
        }
+
+       // Free result
+       SQL_FREERESULT($result);
 } else {
        // Output selection form with all confirmed user accounts listed
        ADD_MEMBER_SELECTION_BOX("0", true);
index 83cf01f67b35c6e5ddb4546b5c305792b35183a1..c538c9fbd0291e96a800db681e95d8942b5abe67 100644 (file)
@@ -48,7 +48,7 @@ $SEL = 0;
 $response = GET_URL("check-themes.php");
 
 // Are theme_check found?
-if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]")) {
+if (($response[count($response) - 1] == "[EOF]") && ($response[0] != "[EOF]")) {
        // Ok, mark found and create the array
        $THEMES = array(
                'fname'  => array(), // File names
@@ -60,7 +60,7 @@ if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]"))
        );
 
        // Get count of theme_check for validation
-       $count = trim($response[sizeof($response) - 2]);
+       $count = trim($response[count($response) - 2]);
        foreach ($response as $idx => $value) {
                $value = str_replace("\n", "", $value); $ver = "";
 
@@ -108,12 +108,12 @@ if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]"))
        } // END - foreach
 
        // Ok, themes are on our server but maybe you have already installed them?
-       if (sizeof($THEMES['fname']) > 0) {
+       if (count($THEMES['fname']) > 0) {
                // Sort array (I missed ver and cver here)
                array_pk_sort($THEMES, array("cver", "fname"), 0, 1);
 
                // Extensions where found which are not downloaded and installed
-               $SW = 2; $OUT = ""; $TSIZE = 0;
+               $OUT = ""; $SW = 2; $TSIZE = 0;
                foreach ($THEMES['fname'] as $idx => $name) {
                        // Generate download link
                        $LINK = SERVER_URL."/themes/theme-".$name.".zip";
@@ -137,7 +137,7 @@ if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]"))
                }
                define('__THEMES_ROWS', $OUT);
                define('__TKBYTES_VALUE', TRANSLATE_COMMA(round($TSIZE / 1.024) / 1000));
-               define('__TTHEME_VALUE', sizeof($THEMES['fname']));
+               define('__TTHEME_VALUE', count($THEMES['fname']));
 
                // Load template
                LOAD_TEMPLATE("admin_theme_list");
index 28bf8512e9e7e048f29e109bcedd856b5bbacd17..e211ca41e4a221f6fd03cffcca2ce25c8583641c 100644 (file)
@@ -99,31 +99,29 @@ $THEME_MODE = "test";
 $OUT = ""; $SW = 2;
 $result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver, theme_name FROM `{!_MYSQL_PREFIX!}_themes` ORDER BY theme_path", __FILE__, __LINE__);
 if (SQL_NUMROWS($result) > 0) {
-       while (list($id, $unix, $active, $ver, $name) = SQL_FETCHROW($result)) {
+       while ($content = SQL_FETCHARRAY($result)) {
                // Construct IFN
-               $INC = sprintf("theme/%s/theme.php",
-                       $unix
-               );
+               $INC = sprintf("theme/%s/theme.php", $content['theme_path']);
 
                // Load theme in test mode
                LOAD_INC($INC);
 
                // Is the loaded theme name != current theme name?
-               $LINK = $unix;
-               if ($unix != GET_CURR_THEME()) $LINK = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=theme_edit&amp;default_theme=".$unix."\" title=\"{--ADMIN_SET_AS_NEW_THEME--}\">".$unix."</a>";
+               $LINK = $content['theme_path'];
+               if ($content['theme_path'] != GET_CURR_THEME()) $LINK = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=theme_edit&amp;default_theme=".$content['theme_path']."\" title=\"{--ADMIN_SET_AS_NEW_THEME--}\">".$content['theme_path']."</a>";
 
                // Prepare data for the row template
                $content = array(
                        'sw'        => $SW,
-                       'id'        => $id,
-                       'active'    => $active,
+                       'id'        => $content['id'],
+                       'active'    => $content['theme_active'],
                        'link'      => $LINK,
-                       'name'      => $name,
-                       'is_act'    => TRANSLATE_YESNO($active),
-                       'email'     => "<a href=\"mailto:".$THEME_EMAIL."?Subject=[Theme:] ".$THEME_NAME." (".$unix.")"."\">".$THEME_AUTHOR."</a>",
+                       'name'      => $content['theme_name'],
+                       'is_act'    => TRANSLATE_YESNO($content['theme_active']),
+                       'email'     => "<a href=\"mailto:".$THEME_EMAIL."?Subject=[Theme:] ".$THEME_NAME." (".$content['theme_path'].")"."\">".$THEME_AUTHOR."</a>",
                        'url_link'  => DEREFERER($THEME_URL),
                        'url_title' => $THEME_URL,
-                       'ver'       => $ver,
+                       'ver'       => $content['theme_ver'],
                );
 
                // Load row template and switch color
index 00e3bb80b4bb4618defda91d375551855ca68bae..00db3aaf66d0dddf8096805073a9d845c2499fa3 100644 (file)
@@ -124,7 +124,7 @@ LIMIT 1",
        } elseif (REQUEST_ISSET_POST(('reject'))) {
                if ($SEL > 0) {
                        // Reject mail orders
-                       $SW = 2; $OUT = "";
+                       $OUT = ""; $SW = 2;
                        foreach (REQUEST_POST('sel') as $id => $value) {
                                // Secure ID number
                                $id = bigintval($id);
@@ -192,7 +192,7 @@ LIMIT 1",
                LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_URLS_BLOCKED'));
        } elseif ((!REQUEST_ISSET_POST(('lock'))) && (!REQUEST_ISSET_POST(('accept'))) && (!REQUEST_ISSET_POST(('reject'))) && (getConfig('url_blacklist') == "Y")) {
                // Mail orders are in pool so we can display them
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
                while ($content = SQL_FETCHARRAY($result_main)) {
                        // Prepare data for the template
                        $content = array(
index 801be23db9141cab645536ebd6c3684f623f2f15..d5e8b0fc6506f4789e728b8dd2f179904c11d197 100644 (file)
@@ -46,18 +46,21 @@ if (IS_FORM_SENT()) {
        if (SELECTION_COUNT(REQUEST_POST('id')) > 0) {
                // At least one entry selected
                foreach (REQUEST_POST('id') as $id => $selected) {
-                       // Secure ID number
-                       $id = bigintval($id);
+                       // Secure ID number and init $content
+                       $content = array(
+                               'id'    => bigintval($id),
+                               'refid' => 0
+                       );
 
                        // Load his personal data
                        $result_main = SQL_QUERY_ESC("SELECT gender, surname, family, email, remote_addr, sponsor_created, points_amount, refid
 FROM `{!_MYSQL_PREFIX!}_sponsor_data`
 WHERE `status`='PENDING' AND id='%s' LIMIT 1",
-                               array($id), __FILE__, __LINE__);
-                       $refid = 0;
+                               array($content['id']), __FILE__, __LINE__);
+
                        if (SQL_NUMROWS($result_main) == 1) {
-                               // Load data and free memory
-                               list($gender, $sname, $fname, $email, $ip, $created, $points, $refid) = SQL_FETCHROW($result_main);
+                               // Load data
+                               $content = SQL_FETCHROW($result_main);
 
                                // Check for open payments and close them
                                $result = SQL_QUERY_ESC("SELECT DISTINCT so.aid, so.pay_count, so.pay_ordered, so.pay_status,
@@ -67,32 +70,34 @@ LEFT JOIN `{!_MYSQL_PREFIX!}_sponsor_paytypes` AS sp
 ON sp.id=so.payid
 WHERE so.sponsorid='%s'
 ORDER BY sp.pay_name",
-                                       array($id), __FILE__, __LINE__);
+                                       array($content['id']), __FILE__, __LINE__);
                                if (SQL_NUMROWS($result) > 0) {
                                        // Payment does exist
-                                       while (list($aid, $count, $ordered, $status, $pname, $prate, $pcurr) = SQL_FETCHROW($result))
-                                       {
+                                       while ($content2 = SQL_FETCHARRAY($result)) {
+                                               // Merge both arrays
+                                               $content = merge_array($content, $content2);
+
                                                // Set default email
-                                               $email = SPONSOR_NO_ADMIN;
-                                               if ($aid > "0") {
+                                               $content['email'] = getMessage('SPONSOR_NO_ADMIN');
+                                               if ($content['aid'] > "0") {
                                                        // Load admin's email address for contact
-                                                       $email = GET_ADMIN_EMAIL($aid);
-                                               }
+                                                       $content['email'] = GET_ADMIN_EMAIL($content['aid']);
+                                               } // END - if
 
                                                // Transfer data to array
-                                               $content = array(
-                                                       'aid'   => $email,
-                                                       'order' => ($count * $prate)." ".$pcurr,
-                                                       'stamp' => MAKE_DATETIME($ordered, "2"),
-                                                       'pname' => $pname,
+                                               $data = array(
+                                                       'aid'   => $content['email'],
+                                                       'order' => ($content['pay_count'] * $content['pay_rate'])." ".$content['pay_currency'],
+                                                       'stamp' => MAKE_DATETIME($content['pay_ordered'], "2"),
+                                                       'pname' => $content['pay_name'],
                                                );
        
                                                // Load email template
-                                               $content['msg'] = LOAD_EMAIL_TEMPLATE("sponsor_unlock_sponsor_pay", $content, $id);
+                                               $content['msg'] = LOAD_EMAIL_TEMPLATE("sponsor_unlock_sponsor_pay", $data, $content['id']);
                                        }
                                } else {
                                        // No payments found
-                                       $content['msg'] = SPONSOR_NO_PAYMENTS_FOUND;
+                                       $content['msg'] = getMessage('SPONSOR_NO_PAYMENTS_FOUND');
                                }
 
                                // Free memory
@@ -105,15 +110,15 @@ ORDER BY sp.pay_name",
                        // Unlock sponsor account
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='CONFIRMED'
 WHERE id='%s' AND `status`='PENDING' LIMIT 1",
-                               array($id), __FILE__, __LINE__);
+                               array($content['id']), __FILE__, __LINE__);
 
                        // Update, if applyable, referal count and points
-                       if (($refid > 0) && ($refid != $id)) {
+                       if (($content['refid'] > 0) && ($content['refid'] != $content['id'])) {
                                // Update referal account
                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data`
 SET points_amount=points_amount+%s, ref_count=ref_count+1
 WHERE id='%s' LIMIT 1",
-                                       array(getConfig('sponsor_ref_points'), bigintval($refid)), __FILE__, __LINE__);
+                                       array(getConfig('sponsor_ref_points'), bigintval($content['refid'])), __FILE__, __LINE__);
 
                                // Whas that update fine?
                                if (SQL_AFFECTEDROWS() == 1) {
@@ -122,7 +127,7 @@ WHERE id='%s' LIMIT 1",
 (points_amount - points_used) AS points, receive_warnings, ref_count AS refs
 FROM `{!_MYSQL_PREFIX!}_sponsor_data`
 WHERE id='%s' LIMIT 1",
-                                               array(bigintval($refid)), __FILE__, __LINE__);
+                                               array(bigintval($content['refid'])), __FILE__, __LINE__);
                                        $REFERRAL = SQL_FETCHARRAY($result);
 
                                        // Send warnings out?
@@ -130,7 +135,7 @@ WHERE id='%s' LIMIT 1",
                                                // Translate some data
                                                $REFERRAL['points']     = TRANSLATE_COMMA($REFERRAL['points']);
                                                $REFERRAL['ref_points'] = TRANSLATE_COMMA(getConfig('sponsor_ref_points'));
-                                               $REFERRAL['gender']      = TRANSLATE_GENDER($REFERRAL['gender']);
+                                               $REFERRAL['gender']     = TRANSLATE_GENDER($REFERRAL['gender']);
 
                                                // Send notification to referal
                                                $REF_MSG = LOAD_EMAIL_TEMPLATE("sponsor_ref_notify", $REFERRAL);
@@ -143,15 +148,13 @@ WHERE id='%s' LIMIT 1",
                        }
 
                        // Transfer data to array
-                       $content['gender']   = TRANSLATE_GENDER($gender);
-                       $content['surname'] = $sname;
-                       $content['family']  = $fname;
-                       $content['sponsor'] = $id;
-                       $content['points']  = TRANSLATE_COMMA($points);
+                       $content['gender']   = TRANSLATE_GENDER($content['gender']);
+                       $content['sponsor']  = $content['id'];
+                       $content['points']   = TRANSLATE_COMMA($content['points_amount']);
 
                        // So let's send the email away
                        $msg = LOAD_EMAIL_TEMPLATE("sponsor_unlocked", $content);
-                       SEND_EMAIL($email, getMessage('SPONSOR_UNLOCKED_SUBJ'), $msg);
+                       SEND_EMAIL($content['email'], getMessage('SPONSOR_UNLOCKED_SUBJ'), $msg);
                }
        } else {
                // Nothing selected
@@ -175,17 +178,18 @@ ORDER BY
 if (SQL_NUMROWS($result) > 0) {
        // Entries found so let's list them!
        $OUT = ""; $SW = 2;
-       while (list($id, $gender, $sname, $fname, $email, $ip, $created) = SQL_FETCHROW($result)) {
+       while ($content = SQL_FETCHARRAY($result)) {
                // Transfer data to array
+               // @TODO Rewritings: remote->remote_addr, created->sponsor_created in template
                $content = array(
                        'sw'      => $SW,
-                       'id'      => $id,
-                       'gender'   => TRANSLATE_GENDER($gender),
-                       'surname' => $sname,
-                       'family'  => $fname,
-                       'email'   => "mailto:".$email,
-                       'remote'  => $ip,
-                       'created' => MAKE_DATETIME($created, "2"),
+                       'id'      => $content['id'],
+                       'gender'   => TRANSLATE_GENDER($content['gender']),
+                       'surname' => $content['surname'],
+                       'family'  => $content['family'],
+                       'email'   => "mailto:".$content['email'],
+                       'remote'  => $content['remote_addr'],
+                       'created' => MAKE_DATETIME($content['sponsor_created'], "2"),
                );
 
                // Load row template and switch colors
index 5b5bddfacc25b1678bd3dbf34c3afa9612da6bd6..b6aaad2ee60f4bc030c26b16b0e62a537ed371f4 100644 (file)
@@ -85,7 +85,7 @@ if (empty($response[0]) && empty($response[1]) && empty($response[2]) && empty($
 
                if (($response[3] != "[EOF]") && ($ONLINE['version'] == constant('FULL_VERSION'))) {
                        // We have found new patches (newer than FULL_VERSION)
-                       $max = str_replace("\n", "", $response[sizeof($response) - 2]); $TOTAL_SIZE = 0;
+                       $max = str_replace("\n", "", $response[count($response) - 2]); $TOTAL_SIZE = 0;
 
                        // Maximum of available pacthes extracted (above). Now we can get all informations
                        for ($idx = 0; $idx < $max; $idx++) {
index c61606a27ebffdfc1e49e75e4b0ebacc3e5e334b..b30a2f3e6f3f8bfca3baae5533b1d74f40dcefc7 100644 (file)
@@ -65,7 +65,7 @@ if (REQUEST_ISSET_GET(('image'))) {
                imagepng($image);
                imagedestroy($image);
        }
-       exit();
+       exit;
 } elseif (!REQUEST_ISSET_GET(('usage'))) {
        $FQFN = sprintf("%s%s/index.html",
                constant('PATH'),
index d1a676b52ece97d80573d0864c9554b0eef007f9..17fbc97f49c1b976a4f9f61076a5cfef583b611a 100644 (file)
@@ -40,88 +40,75 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 // Add description as navigation point
 ADD_DESCR("admin", __FILE__);
 
-if (EXT_IS_ACTIVE("online", true))
-{
+// Online stats are only working if extension ext-online is installed
+if (EXT_IS_ACTIVE("online")) {
        // Count guests, members and admins
-       $result_guests  = SQL_QUERY("SELECT id FROM `{!_MYSQL_PREFIX!}_online` WHERE is_admin='N' AND is_member='N'", __FILE__, __LINE__);
-       $result_members = SQL_QUERY("SELECT id FROM `{!_MYSQL_PREFIX!}_online` WHERE is_admin='N' AND is_member='Y'", __FILE__, __LINE__);
-       $result_admins  = SQL_QUERY("SELECT id FROM `{!_MYSQL_PREFIX!}_online` WHERE is_admin='Y'", __FILE__, __LINE__);
-
-       // Remember values for the template
-       define('_GUESTS_ONLINE' , SQL_NUMROWS($result_guests));
-       define('_ADMINS_ONLINE' , SQL_NUMROWS($result_admins));
-       define('_MEMBERS_ONLINE', SQL_NUMROWS($result_members));
-
-       // Free memory
-       SQL_FREERESULT($result_guests);
-       SQL_FREERESULT($result_admins);
-       SQL_FREERESULT($result_members);
+       // @TODO Rewrite these constants
+       // @TODO Add a filter for sponsor
+       define('_GUESTS_ONLINE' , GET_TOTAL_DATA("N", "online", "id", "is_admin", true, " AND is_member='N'"));
+       define('_ADMINS_ONLINE' , GET_TOTAL_DATA("N", "online", "id", "is_admin", true, " AND is_member='Y'"));
+       define('_MEMBERS_ONLINE', GET_TOTAL_DATA("N", "online", "id", "is_admin", true));
 
        // Load template
        LOAD_TEMPLATE("admin_mini_online");
 
        // Check for online users
-       $result = SQL_QUERY("SELECT id, ip, userid, refid, module, action, what, is_member, is_admin, timestamp FROM `{!_MYSQL_PREFIX!}_online` ORDER by timestamp DESC", __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) > 0)
-       {
+       $result = SQL_QUERY("SELECT id, ip, userid, refid, module, action, what, is_member, is_admin, timestamp FROM `{!_MYSQL_PREFIX!}_online` ORDER by timestamp DESC",
+               __FILE__, __LINE__);
+       if (SQL_NUMROWS($result) > 0) {
                // Load header template
                LOAD_TEMPLATE("admin_online_header");
 
                // List all online users
                $SW = 2;
-               while (list($id, $ip, $uid, $ref, $mod, $act, $wht, $mem, $admin, $time) = SQL_FETCHROW($result))
-               {
-                       if (empty($act)) $act = "---";
-                       if (empty($wht))   $wht = "---";
+               while ($content = SQL_FETCHARRAY($result)) {
+                       // Fix empty action/what
+                       if (empty($content['action'])) $content['action'] = "---";
+                       if (empty($content['what']))   $content['what']   = "---";
 
-                       if ($admin == "Y")
-                       {
+                       if ($content['is_admin'] == "Y") {
                                // Is an administrator
-                               $uid = _IS_ADMIN;
-                       }
-                        elseif (($mem == "N") && ($admin == "N"))
-                       {
+                               $content['userid'] = getMessage('_IS_ADMIN');
+                       } elseif (($content['is_member'] == "N") && ($content['is_admin'] == "N")) {
                                // Is a guest
-                               $uid = _IS_GUEST;
-                       }
+                               $content['userid'] = getMessage('_IS_GUEST');
+                       } elseif ($content['userid'] > 0) {
+                               // Add profile link to userid
+                               $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']);
+                       } // END - if
+
+                       // Is the refid set?
+                       if ($content['refid'] > 0) {
+                               // Add profile link to referer id
+                               $content['refid'] = ADMIN_USER_PROFILE_LINK($content['refid']);
+                       } // END - if
+
                        OUTPUT_HTML("<tr>
-  <td align=\"center\" width=\"5%\" class=\"switch_sw".$SW." bottom right\">".$id."</td>
-  <td align=\"center\" width=\"15%\" class=\"switch_sw".$SW." bottom right\">");
-                       if ($uid > 0)
-                       {
-                               OUTPUT_HTML(ADMIN_USER_PROFILE_LINK($uid));
-                       }
-                        else
-                       {
-                               OUTPUT_HTML($uid);
-                       }
-                       if ($ref > 0)
-                       {
-                               $ref = ADMIN_USER_PROFILE_LINK($ref);
-                       }
-                       OUTPUT_HTML("</td>
-  <td align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom right\">".$ip."</td>
-  <td align=\"center\" width=\"5%\" class=\"switch_sw".$SW." bottom right\">".$ref."</td>
-  <td align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom right\">".$mod."</td>
-  <td align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom right\">".$act."</td>
-  <td align=\"center\" width=\"5%\" class=\"switch_sw".$SW." bottom right\">".$wht."</td>
-  <td align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom\">".MAKE_DATETIME($time, "2")."</td>
+  <td align=\"center\" width=\"5%\" class=\"switch_sw".$SW." bottom right\">".$content['id']."</td>
+  <td align=\"center\" width=\"15%\" class=\"switch_sw".$SW." bottom right\">".$content['userid']."</td>
+  <td align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom right\">".$content['ip']."</td>
+  <td align=\"center\" width=\"5%\" class=\"switch_sw".$SW." bottom right\">".$content['refid']."</td>
+  <td align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom right\">".$content['module']."</td>
+  <td align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom right\">".$content['action']."</td>
+  <td align=\"center\" width=\"5%\" class=\"switch_sw".$SW." bottom right\">".$content['what']."</td>
+  <td align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom\">".MAKE_DATETIME($content['timestamp'], "2")."</td>
 </tr>");
                        $SW = 3 - $SW;
-               }
+               } // END - while
 
                // Free memory
                SQL_FREERESULT($result);
 
-               // Load footer template
+               // @TODO Rewrite this constant
                define('__FANCY_ONLINE_TIMEOUT', CREATE_FANCY_TIME(getConfig('online_timeout')));
+
+               // Load footer template
                LOAD_TEMPLATE("admin_online_footer");
-       }
-}
- else
-{
+       } // END - if
+} else {
        // Online statistics deactivated!
-       LOAD_TEMPLATE("admin_settings_saved", false, ONLINE_STATISTICS_DEACTIVATED);
+       LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ONLINE_STATISTICS_DEACTIVATED'));
 }
+
 //
 ?>
index 0ee46493f5907ad81de1b53c92873766dddfe494..543fe3f1671862cd77cd2b6a21efbe87cdacf9c2 100644 (file)
@@ -40,9 +40,6 @@ if (!defined('__SECURITY')) {
        return;
 }
 
-// Already loaded?
-if (defined('__THEME_SELECTION_CONTENT')) return false;
-
 // Load all active designs (or all if admin)
 $whereStatement = ""; $OUT = "";
 if (!IS_ADMIN()) $whereStatement = " WHERE theme_active='Y'";
@@ -63,14 +60,11 @@ if ($num_themes > 1) {
        $OUT = LOAD_TEMPLATE("admin_settings_saved", true, "<div class=\"admin_note\">{--ADMIN_NO_THEME_INSTALLED_WARNING--}</div>");
 }
 
-// Remember
-define('__THEME_SELECTION_CONTENT', $OUT);
-
 // Free memory
 SQL_FREERESULT($result_themes);
 
 // Load final box template
-LOAD_TEMPLATE("theme_select_box");
+LOAD_TEMPLATE("theme_select_box", false, $OUT);
 
 //
 ?>
index 58d7e5a33626522725b5e69a82003460a653d331..586451a0cc9fff84ee4b5b3cc0a140d6ecdcae99 100644 (file)
@@ -180,6 +180,7 @@ $OUT_POINTS  = ""; $ROWS_POINTS  = 2;
 $OUT_USER    = ""; $ROWS_USER    = 6;
 $OUT_SPECIAL = ""; // We don't need row count here
 
+// @TODO Rewrite these all if-blocks to filters
 if (EXT_IS_ACTIVE("beg")) {
        // Clicks on beg links
        $result = SQL_QUERY("SELECT SUM(beg_clicks) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE beg_clicks>0", __FILE__, __LINE__);
@@ -209,28 +210,28 @@ if (EXT_IS_ACTIVE("doubler")) {
        if (empty($points2)) $points2 = 0;
 
        // Add header
-       $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_hrow", true, MEDIA_DOUBLER_HEADER);
+       $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_hrow", true, getMessage('MEDIA_DOUBLER_HEADER'));
 
        // Add first line (count)
        $content = array(
-               'lang'  => MEDIA_DOUBLER_COUNT,
+               'lang'  => getMessage('MEDIA_DOUBLER_COUNT'),
                'value' => $count1,
                'rows'  => "4"
        );
        // Add points
        $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row2", true, $content);
        $content = array(
-               'lang'  => MEDIA_DOUBLER_CPOINTS,
+               'lang'  => getMessage('MEDIA_DOUBLER_CPOINTS'),
                'value' => TRANSLATE_COMMA($points1)
        );
        $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
        $content = array(
-               'lang'  => MEDIA_DOUBLER_WAITING,
+               'lang'  => getMessage('MEDIA_DOUBLER_WAITING'),
                'value' => TRANSLATE_COMMA($count2)
        );
        $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
        $content = array(
-               'lang'  => MEDIA_DOUBLER_WPOINTS,
+               'lang'  => getMessage('MEDIA_DOUBLER_WPOINTS'),
                'value' => TRANSLATE_COMMA($points2)
        );
        $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
@@ -247,7 +248,7 @@ WHERE d.holiday_active='Y'",
        list($holiday) = SQL_FETCHROW($result);
        if (empty($holiday)) $holiday = 0;
        $content = array(
-               'lang'  => MEDIA_HOLIDAY_COUNT,
+               'lang'  => getMessage('MEDIA_HOLIDAY_COUNT'),
                'value' => $holiday
        );
        $OUT_USER .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
@@ -275,25 +276,25 @@ ON t.userid=d.userid",
        if (empty($points_out)) $points_out = 0;
 
        // Add header
-       $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_hrow", true, MEDIA_TRANSFER_HEADER);
+       $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_hrow", true, getMessage('MEDIA_TRANSFER_HEADER'));
        $content = array(
-               'lang'  => MEDIA_TRANSFER_IN_COUNT,
+               'lang'  => getMessage('MEDIA_TRANSFER_IN_COUNT'),
                'value' => $count_in,
                'rows'  => "4"
        );
        $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row2", true, $content);
        $content = array(
-               'lang'  => MEDIA_TRANSFER_IN_POINTS,
+               'lang'  => getMessage('MEDIA_TRANSFER_IN_POINTS'),
                'value' => TRANSLATE_COMMA($points_in)
        );
        $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
        $content = array(
-               'lang'  => MEDIA_TRANSFER_OUT_COUNT,
+               'lang'  => getMessage('MEDIA_TRANSFER_OUT_COUNT'),
                'value' => $count_out
        );
        $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
        $content = array(
-               'lang'  => MEDIA_TRANSFER_OUT_POINTS,
+               'lang'  => getMessage('MEDIA_TRANSFER_OUT_POINTS'),
                'value' => TRANSLATE_COMMA($points_out)
        );
        $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
index 93dc5fdebf3902eb2f19301d5ec94b34681a38de..6d1dd45e9cfb2dad0e98ea9531aae9b5a3a90ece 100644 (file)
@@ -82,13 +82,10 @@ if (SQL_NUMROWS($result) == 1)
        define('__RALLYE_TITLE', COMPILE_CODE($title));
 
        // Handle description...
-       if ((empty($descr)) && (!empty($templ)))
-       {
+       if ((empty($descr)) && (!empty($templ))) {
                // Use description from template
                define('__RALLYE_DESCR', LOAD_TEMPLATE("rallye_".$templ, true));
-       }
-        else
-       {
+       } else {
                // Use description from database
                define('__RALLYE_DESCR', COMPILE_CODE($descr));
        }
@@ -97,35 +94,22 @@ if (SQL_NUMROWS($result) == 1)
        define('__RALLYE_START', MAKE_DATETIME($start, "1"));
        define('__RALLYE_END'  , MAKE_DATETIME($end  , "1"));
 
-       if ($min_users == 0)
-       {
-               // Rallye ends without user limitation
-               define('__RALLYE_MAX_USERS', RALLYE_END_NO_USER_LIMITATION);
-       }
-        else
-       {
-               // Rallye ends when X members are totally in your exchange
-               define('__RALLYE_MAX_USERS', RALLYE_END_USERS_1." ".$min_users." ".RALLYE_END_USERS_2);
-       }
-       if ($min_prices == 0)
-       {
+       // Determine min_users
+       define('__RALLYE_MAX_USERS', RALLYE_DETERMINE_MIN_USERS($min_users));
+
+       if ($min_prices == 0) {
                // Rallye ends without user limitation
                define('__RALLYE_MIN_PRICES', RALLYE_END_NO_PRICE_LIMITATION);
-       }
-        else
-       {
+       } else {
                // Rallye ends when X members are totally in your exchange
                define('__RALLYE_MIN_PRICES', RALLYE_END_PRICES_1." ".$min_prices." ".RALLYE_END_PRICES_2);
        }
 
-       if ($expired)
-       {
+       if ($expired === true) {
                define('__RALLYE_PRICES', RALLYE_LIST_WINNERS($id));
                define('__RALLYE_TOP_USERS', "<div align=\"center\" class=\"big\">".__RALLYE_EXTRAS."</div>");
                define('__RALLYE_CAN_WIN_THIS', RALLYE_OUR_WINNERS_ARE);
-       }
-        else
-       {
+       } else {
                define('__RALLYE_PRICES', RALLYE_ADD_PRICES($id, "html"));
                define('__RALLYE_TOP_USERS', RALLYE_ADD_TOPUSERS($id, $GLOBALS['userid']));
                define('__RALLYE_CAN_WIN_THIS', RALLYE_YOU_CAN_WIN);
index 7420336c3fd7fc79efe9f076c2ba1f8d98eceeb6..a92c16ea662607791e6b79008d44043821f7c860 100644 (file)
@@ -402,7 +402,7 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF
        } // END - if
 
        if ((!empty($cats)) && ($cats < getConfig('least_cats'))) {
-               OUTPUT_HTML("<div class=\"register_failed\">{--CATS_LEAST--}: ".getConfig('least_cats')."</div>");
+               OUTPUT_HTML("<div class=\"register_failed\">".sprintf(getMessage('CATS_LEAST'), getConfig('least_cats'))."</div>");
        } // END - if
 
        // Generate birthday selection
index a4723fdf58ff0be5abf49dec7f6873ed762a5e48..2539e16300381cc65e277c1f90a87f51b06e4418 100644 (file)
@@ -42,8 +42,9 @@ if (!defined('__SECURITY')) {
 // Add description as navigation point
 ADD_DESCR("guest", __FILE__);
 
-// Remove result_act
-unset($result_act);
+// Init both results (see footer of this file)
+$result_act = false;
+$result_pay = false;
 
 // Load all sponsor actions
 $result_act = SQL_QUERY("SELECT DISTINCT m.title, c.conv_rate, c.conv_name
@@ -52,18 +53,18 @@ LEFT JOIN `{!_MYSQL_PREFIX!}_sponsor_action_convert` AS c ON m.what=c.ext_name
 LEFT JOIN `{!_MYSQL_PREFIX!}_sponsor_registry` AS r ON m.what=r.ext_name
 WHERE m.action='actions' AND r.is_active='Y'
 ORDER BY m.sort ASC", __FILE__, __LINE__);
-$num_act = SQL_NUMROWS($result_act);
 
-if ($num_act > 0) {
+if (SQL_NUMROWS($result_act) > 0) {
        // Load all actions
        $OUT_ACT = ""; $SW = 2;
-       while (list($title, $conv, $name) = SQL_FETCHROW($result_act)) {
+       while ($content = SQL_FETCHARRAY($result_act)) {
                // Prepare data for the row template
+               // @TODO Rewritings: conv->conv_rate,name->conv_name in template
                $content = array(
                        'sw'    => $SW,
-                       'title' => $title,
-                       'conv'  => round($conv),
-                       'name'  => $name,
+                       'title' => $content['title'],
+                       'conv'  => round($content['conv_rate']),
+                       'name'  => $content['conv_name'],
                );
 
                // Load row template and switch color
@@ -76,15 +77,16 @@ if ($num_act > 0) {
        if (SQL_NUMROWS($result_pay) > 0) {
                // Load all pay types
                $OUT_PAY = ""; $SW = 2;
-               while (list($name, $rate, $min, $curr) = SQL_FETCHROW($result_pay)) {
+               while ($content = SQL_FETCHARRAY($result_pay)) {
                        // Prepare data for the row template
+                       // @TODO Rewritings: name->pay_name,min->pay_min_count,min->pay_min_count,curr->pay_currency
                        $content = array(
                                'sw'    => $SW,
-                               'name'  => $name,
-                               'rate'  => TRANSLATE_COMMA($rate),
-                               'min'   => $min,
-                               'curr'  => $curr,
-                               'price' => TRANSLATE_COMMA($min),
+                               'name'  => $content['pay_name'],
+                               'rate'  => TRANSLATE_COMMA($content['pay_rate']),
+                               'min'   => $content['pay_min_count'],
+                               'curr'  => $content['pay_currency'],
+                               'price' => TRANSLATE_COMMA($content['pay_min_count']),
                        );
 
                        // Load row template and switch color
@@ -93,30 +95,26 @@ if ($num_act > 0) {
                }
        } else {
                // No pay types setuped so far!
-               $OUT_PAY = "<tr><td colspan=\"2\">
-  ".LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_ACTIONS_ACTIVATED)."
-</td></tr>";
+               $OUT_PAY = LOAD_TEMPLATE("guest_sponsor_infos_none_row", LOAD_TEMPLATE("admin_settings_saved", true, getMessage('SPONSOR_NO_ACTIONS_ACTIVATED')));
        }
 } else {
        // No actions activated so far!
-       $OUT_ACT = "<tr><td colspan=\"2\" class=\"bottom2\" style=\"padding-top: 10px; padding-bottom: 10px\">
-  ".LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_ACTIONS_ACTIVATED)."
-</td></tr>";
-       $OUT_PAY = "<tr><td colspan=\"2\" class=\"bottom2\" style=\"padding-top: 10px; padding-bottom: 10px\">
-  ".LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_ACTIONS_ACTIVATED)."
-</td></tr>";
+       $OUT_ACT = LOAD_TEMPLATE("guest_sponsor_infos_none_row", LOAD_TEMPLATE("admin_settings_saved", true, getMessage('SPONSOR_NO_ACTIONS_ACTIVATED')));
+       $OUT_PAY = LOAD_TEMPLATE("guest_sponsor_infos_none_row", LOAD_TEMPLATE("admin_settings_saved", true, getMessage('SPONSOR_NO_ACTIONS_ACTIVATED')));
 }
 
-// Transfer rows to constans
-define('__SPONSOR_ACTIONS' , $OUT_ACT);
-define('__SPONSOR_PAYTYPES', $OUT_PAY);
-
 // Free memory
-if (isset($result_act)) SQL_FREERESULT($result_act);
-if (isset($result_pay)) SQL_FREERESULT($result_pay);
+SQL_FREERESULT($result_act);
+SQL_FREERESULT($result_pay);
+
+// Transfer rows to an array
+$content = array(
+       'actions'  => $OUT_ACT,
+       'paytypes' => $OUT_PAY
+);
 
 // Load main template
-LOAD_TEMPLATE("guest_sponsor_infos");
+LOAD_TEMPLATE("guest_sponsor_infos", false, $content);
 
 //
 ?>
index 1b0aefd2746a3c22000e8c2cf024ebb48fb2941b..5d12728fdf77e79491e8e05c06cd60611329e47f 100644 (file)
@@ -279,23 +279,24 @@ ORDER BY pay_name", __FILE__, __LINE__);
                // @TODO Swap this HTML code to templates
                $OUT = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"300\" class=\"left2 right2 top2\">\n";
                $SW = 2;
-               while (list($id, $name, $rate, $curr, $min) = SQL_FETCHROW($result)) {
-                       $OUT .= "<tr>
-  <td class=\"bottom2 switch_sw".$SW."\" height=\"50\" style=\"padding-left: 2px; padding-right: 2px\">
-    <input type=\"radio\" name=\"pay_type\" class=\"guest_normal\" value=\"".bigintval($id)."\" />&nbsp;".$name."<br />
-    <div align=\"right\">(".$min." ".$curr." = ".TRANSLATE_COMMA($rate * $min)." {!POINTS!})</div>
-  </td>
-</tr>\n";
+               while ($content = SQL_FETCHARRAY($result)) {
+                       // Prepare content for output
+                       $content['sw']  = $SW;
+                       $content['res'] = TRANSLATE_COMMA($content['pay_rate'] * $content['pay_min_count']);
+
+                       // Load row template and switch color
+                       $OUT .= LOAD_TEMPLATE("guest_sponsor_payment_row", false, $content);
                        $SW = 3 - $SW;
                }
                $OUT .= "</table>\n";
+
+               // @TODO Rewrite this constant
                define('__PAYMENT_LIST', $OUT);
-               SQL_FREERESULT($result);
 
                // Check for invalid entries
-               if (count($FORM_ERRORS) > 0)
-               {
+               if (count($FORM_ERRORS) > 0) {
                        // Some found... :-(
+                       // @TODO Rewrite these constants
                        define('__COMPANY'  , COMPILE_CODE(REQUEST_POST('company')));
                        define('__POSITION' , COMPILE_CODE(REQUEST_POST('position')));
                        define('__TAX_IDENT', COMPILE_CODE(REQUEST_POST('tax_ident')));
index 1be2f8e639d7ba4c9d80394136c4c5b9645ffe46..a26da2a721c6ef80f0e5b9c099fbcccb1a9e363f 100644 (file)
@@ -67,16 +67,16 @@ switch (getConfig('guest_stats'))
 {
 case "MEMBERS": // Statistics about your members
        // Members yesterday / today online
-       $ymem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".START_YDAY." AND last_online < ".START_TDAY." AND `status`='CONFIRMED'", __FILE__, __LINE__));
-       $tmem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".START_TDAY." AND `status`='CONFIRMED'", __FILE__, __LINE__));
+       $ymem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".constant('START_YDAY')." AND last_online < ".constant('START_TDAY')." AND `status`='CONFIRMED'", __FILE__, __LINE__));
+       $tmem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".constant('START_TDAY')." AND `status`='CONFIRMED'", __FILE__, __LINE__));
 
        // Yesterday / today registered
-       $yreg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE joined >= ".START_YDAY." AND joined < ".START_TDAY, __FILE__, __LINE__));
-       $treg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE joined >= ".START_TDAY, __FILE__, __LINE__));
+       $yreg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE joined >= ".constant('START_YDAY')." AND joined < ".constant('START_TDAY'), __FILE__, __LINE__));
+       $treg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE joined >= ".constant('START_TDAY'), __FILE__, __LINE__));
 
        // Only males / females
-       $male   = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE gender='M' AND `status`='CONFIRMED'", __FILE__, __LINE__));
-       $female = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE gender='F' AND `status`='CONFIRMED'", __FILE__, __LINE__));
+       $male   = GET_TOTAL_DATA("M", "user_data", "userid", "gender", true, " AND `status`='CONFIRMED'");
+       $female = GET_TOTAL_DATA("F", "user_data", "userid", "gender", true, " AND `status`='CONFIRMED'");
 
        // Unconfirmed accounts
        $unconfirmed = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE status != 'CONFIRMED'", __FILE__, __LINE__));
@@ -86,11 +86,15 @@ case "MEMBERS": // Statistics about your members
 
        // List every month
        $months = array();
-       for ($idx = 1; $idx < 13; $idx++)
-       {
-               $month = $idx; if ($idx < 10) $month = "0".$idx;
-               $months[$month] = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE birth_month=%s AND `status`='CONFIRMED'",
-                array(bigintval($month)), __FILE__, __LINE__));
+       for ($idx = 1; $idx < 13; $idx++) {
+               // Copy it so we don't touch the for() loop index
+               $month = $idx;
+
+               // Append leading zero
+               if ($idx < 10) $month = "0".$idx;
+
+               // Count months
+               $months[$month] = GET_TOTAL_DATA(bigintval($month), "user_data", "userid", "birth_month", true, " AND `status`='CONFIRMED'");
        }
 
        // Members in categories
@@ -98,19 +102,20 @@ case "MEMBERS": // Statistics about your members
 
        // Load categories first
        $cats = array(); $cat_cnt = array();
-       while (list($id, $cat) = SQL_FETCHROW($result)) {
+       // @TODO This can be somehow rewritten
+       while ($content = SQL_FETCHARRAY($result)) {
                // Simple...
-               $cats[$id] = $cat;
+               $cats[$content['id']] = $content['cat'];
        }
 
        // Now we have all categories loaded, count members
        foreach ($cats as $id => $dummy) {
                // We only need id and nothing more to count...
-               $cat_cnt[$id] = SQL_NUMROWS(SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE cat_id=%s",
-                       array(bigintval($id)), __FILE__, __LINE__));
+               $cat_cnt[$id] = GET_TOTAL_DATA(bigintval($id), "user_cats", "id", "cat_id", true);
        }
 
        // Prepare data for the template
+       // @TODO Rewrite all these constants
        define('__TOTAL_USERS' , $total);
        define('__UNCONFIRMED' , $unconfirmed);
        define('__MALE_COUNT'  , $male);
@@ -124,8 +129,7 @@ case "MEMBERS": // Statistics about your members
 
        // Generate monthly stats
        $SW = 2; $r2 = " right2"; $l = "ll"; $r = "lr"; $OUT = "";
-       foreach ($months as $month => $cnt)
-       {
+       foreach ($months as $month => $cnt) {
                if ($SW == 2) $OUT .= "<tr>\n";
 
                // Prepare data for template
@@ -140,13 +144,10 @@ case "MEMBERS": // Statistics about your members
                // Load row template
                $OUT .= LOAD_TEMPLATE("guest_stats_month_row", true, $content);
 
-               if ($SW == 2)
-               {
+               if ($SW == 2) {
                        $r2 = "";
                        $l = "rl"; $r = "rr";
-               }
-                else
-               {
+               } else {
                        $OUT .= "</tr>\n";
                        $r2 = " right2";
                        $l = "ll"; $r = "lr";
@@ -156,9 +157,8 @@ case "MEMBERS": // Statistics about your members
        define('__MONTH_STATS_ROWS', $OUT);
 
        // Generate category stats
-       $SW = 2; $OUT = "";
-       foreach ($cat_cnt as $id => $cnt)
-       {
+       $OUT = ""; $SW = 2;
+       foreach ($cat_cnt as $id => $cnt) {
                // Prepare data for the template
                $content = array(
                        'sw'  => $SW,
@@ -181,8 +181,10 @@ case "MODULES": // TOP10 module clicks
        if (!IS_ADMIN()) $AND = " AND `locked`='N' AND `visible`='Y'";
        $guest_t10 = SQL_QUERY("SELECT counter, title FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE counter > 0".$AND." ORDER BY counter DESC LIMIT 0,10", __FILE__, __LINE__);
        $mem_t10   = SQL_QUERY("SELECT counter, title FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE counter > 0".$AND." ORDER BY counter DESC LIMIT 0,10", __FILE__, __LINE__);
+       $OUT = "";
        if ((SQL_NUMROWS($guest_t10) > 0) || (SQL_NUMROWS($mem_t10) > 0)) {
                // Output header
+               // @TODO Rewrite this to one template and $OUT .= ....
                OUTPUT_HTML("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"guest_table dashed\" width=\"310\">
 <tr>
   <td align=\"center\" class=\"guest_stats_title bottom2\" colspan=\"2\"><strong>{--GUEST_TOPTEN_STATS--}</strong></td>
@@ -195,10 +197,10 @@ case "MODULES": // TOP10 module clicks
   <td align=\"center\" class=\"guest_title2 bottom2\" colspan=\"2\">{--GUEST_TOP_GUEST_STATS--}</td>
 </tr>");
                $SW = 2;
-               while (list($clicks, $title) = SQL_FETCHROW($guest_t10)) {
+               while ($content = SQL_FETCHARRAY($guest_t10)) {
                        OUTPUT_HTML("<tr>
-  <td class=\"switch_sw".$SW." bottom2 right2\" align=\"right\" width=\"250\">".$title."&nbsp;</td>
-  <td class=\"switch_sw".$SW." bottom2\" width=\"50\">&nbsp;".$clicks."</td>
+  <td class=\"switch_sw".$SW." bottom2 right2\" align=\"right\" width=\"250\">".$content['title']."&nbsp;</td>
+  <td class=\"switch_sw".$SW." bottom2\" width=\"50\">&nbsp;".$content['counter']."</td>
 </tr>");
                        $SW = 3 - $SW;
                }
@@ -210,10 +212,10 @@ case "MODULES": // TOP10 module clicks
   <td align=\"center\" class=\"guest_title2 bottom2\" colspan=\"2\">{--GUEST_TOP_MEMBER_STATS--}</td>
 </tr>");
                $SW = 2;
-               while (list($clicks, $title) = SQL_FETCHROW($mem_t10)) {
+               while ($content = SQL_FETCHARRAY($mem_t10)) {
                        OUTPUT_HTML("<tr>
-  <td class=\"switch_sw".$SW." bottom2 right2\" align=\"right\" width=\"250\">".$title."&nbsp;</td>
-  <td class=\"switch_sw".$SW." bottom2\" width=\"50\">&nbsp;".$clicks."</td>
+  <td class=\"switch_sw".$SW." bottom2 right2\" align=\"right\" width=\"250\">".$content['title']."&nbsp;</td>
+  <td class=\"switch_sw".$SW." bottom2\" width=\"50\">&nbsp;".$content['counter']."</td>
 </tr>");
                        $SW = 3 - $SW;
                }
@@ -222,7 +224,9 @@ case "MODULES": // TOP10 module clicks
        if ((SQL_NUMROWS($guest_t10) > 0) || (SQL_NUMROWS($mem_t10) > 0)) {
                // Output footer
                OUTPUT_HTML("<tr>
-  <td align=\"center\" class=\"guest_stats_footer\" colspan=\"2\"><a href=\"{!URL!}/modules.php?module=index&amp;what=stats&amp;mode=".$lmode."\">".$ltitle."</a></td>
+  <td align=\"center\" class=\"guest_stats_footer\" colspan=\"2\">
+    <a href=\"{!URL!}/modules.php?module=index&amp;what=stats&amp;mode=".$lmode."\">".$ltitle."</a>
+  </td>
 </tr>
 </table>");
        }
index 04d240b152c84d0e3bb35f4f2de452d6bbb5c7d5..8cec95dbe0ae46df7dba126675562bbddef687f7 100644 (file)
@@ -58,21 +58,23 @@ LIMIT %s",
        array(getConfig('top10_max')), __FILE__, __LINE__);
 
 $OUT = ""; $SW = 2; $cnt = 1;
-while (list($uid, $logins, $last) = SQL_FETCHROW($result)) {
-       $nick2 = "---";
+while ($content = SQL_FETCHARRAY($result)) {
+       // Init nickname
+       $content['nickname'] = "---";
 
        // Get nickname
-       if (EXT_IS_ACTIVE("nickname")) $nick2 = NICKNAME_GET_NICK($uid);
+       if (EXT_IS_ACTIVE("nickname")) $content['nickname'] = NICKNAME_GET_NICK($content['userid']);
 
        // Prepare data for template
+       // @TODO Rewritings: uid->userid,nick->nickname,logins->total_logins in template
        $content = array(
                'sw'     => $SW,
                'cnt'    => $cnt,
-               'uid'    => $uid,
-               'nick'   => $nick2,
-               'logins' => $logins,
-               'points' => TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "points")),
-               'last'   => MAKE_DATETIME($last, "3"),
+               'uid'    => $content['userid'],
+               'nick'   => $content['nickname'],
+               'logins' => $content['total_logins'],
+               'points' => TRANSLATE_COMMA(GET_TOTAL_DATA($content['userid'], "user_points", "points")),
+               'last'   => MAKE_DATETIME($content['last_online'], "3"),
        );
 
        // Load row template
@@ -80,7 +82,7 @@ while (list($uid, $logins, $last) = SQL_FETCHROW($result)) {
 
        // Switch colors and count one up
        $SW = 3 - $SW; $cnt++;
-}
+} // END - while
 
 if ($cnt < getConfig('top10_max')) {
        // Add more "blank" rows
@@ -94,8 +96,10 @@ if ($cnt < getConfig('top10_max')) {
                // Load row template
                $OUT .= LOAD_TEMPLATE("guest_top10_empty5", true, $content);
                $SW = 3 - $SW;
-       }
-}
+       } // END - for
+} // END - if
+
+// @TODO Rewrite this constant
 define('__TOP_LOGINS_ROWS', $OUT);
 
 // Free result
@@ -125,20 +129,22 @@ LIMIT %s",
        array(getConfig('top10_max')), __FILE__, __LINE__);
 
 $OUT = ""; $SW = 2; $cnt = 1;
-while (list($uid, $points, $last) = SQL_FETCHROW($result)) {
-       $nick2 = "---";
+while ($content = SQL_FETCHARRAY($result)) {
+       // Init nickname
+       $content['nickname'] = "---";
 
        // Get nickname
-       if (EXT_IS_ACTIVE("nickname")) $nick2 = NICKNAME_GET_NICK($uid);
+       if (EXT_IS_ACTIVE("nickname")) $content['nickname'] = NICKNAME_GET_NICK($content['userid']);
 
        // Prepare data for template
+       // @TODO Rewritings: nick->nickname,uid->userid in template
        $content = array(
                'sw'     => $SW,
                'cnt'    => $cnt,
-               'uid'    => bigintval($uid),
-               'nick'   => $nick2,
-               'points' => TRANSLATE_COMMA($points),
-               'last'   => MAKE_DATETIME($last, "3")
+               'uid'    => $content['userid'],
+               'nick'   => $content['nickname'],
+               'points' => TRANSLATE_COMMA($content['points']),
+               'last'   => MAKE_DATETIME($content['last_online'], "3")
        );
 
        // Load row template
@@ -146,7 +152,7 @@ while (list($uid, $points, $last) = SQL_FETCHROW($result)) {
 
        // Switch colors and count one up
        $SW = 3 - $SW; $cnt++;
-}
+} // END - while
 
 if ($cnt < getConfig('top10_max')) {
        // Add more "blank" rows
@@ -160,8 +166,10 @@ if ($cnt < getConfig('top10_max')) {
                // Load row template
                $OUT .= LOAD_TEMPLATE("guest_top10_empty4", true, $content);
                $SW = 3 - $SW;
-       }
-}
+       } // END - for
+} // END - if
+
+// @TODO Rewrite this constant
 define('__TOP_POINTS_ROWS', $OUT);
 
 // Free result
@@ -191,21 +199,23 @@ LIMIT %s",
        array(getConfig('top10_max')), __FILE__, __LINE__);
 
 $OUT = ""; $SW = 2; $cnt = 1;
-while (list($uid, $refs, $last) = SQL_FETCHROW($result)) {
-       $nick2 = "---";
+while ($content = SQL_FETCHARRAY($result)) {
+       // Init nickname
+       $content['nickname'] = "---";
 
        // Get nickname
-       if (EXT_IS_ACTIVE("nickname")) $nick2 = NICKNAME_GET_NICK($uid);
+       if (EXT_IS_ACTIVE("nickname")) $content['nickname'] = NICKNAME_GET_NICK($content['userid']);
 
        // Prepare data for template
+       // @TODO Rewritings: nick->nickname,uid->userid in template
        $content = array(
                'sw'     => $SW,
                'cnt'    => $cnt,
-               'uid'    => bigintval($uid),
-               'refs'   => $refs,
-               'nick'   => $nick2,
-               'points' => TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "points")),
-               'last'   => MAKE_DATETIME($last, "3")
+               'uid'    => $content['userid'],
+               'refs'   => $content['refs'],
+               'nick'   => $content['nickname'],
+               'points' => TRANSLATE_COMMA(GET_TOTAL_DATA($content['userid'], "user_points", "points")),
+               'last'   => MAKE_DATETIME($content['last_online'], "3")
        );
 
        // Load row template
@@ -213,7 +223,7 @@ while (list($uid, $refs, $last) = SQL_FETCHROW($result)) {
 
        // Switch colors and count one up
        $SW = 3 - $SW; $cnt++;
-}
+} // END - while
 
 if ($cnt < getConfig('top10_max')) {
        // Add more "blank" rows
@@ -227,14 +237,17 @@ if ($cnt < getConfig('top10_max')) {
                // Load row template
                $OUT .= LOAD_TEMPLATE("guest_top10_empty5", true, $content);
                $SW = 3 - $SW;
-       }
-}
+       } // END - for
+} // END - if
+
+// @TODO Rewrite this constant
 define('__TOP_REFERRAL_ROWS', $OUT);
 
 // Free result
 SQL_FREERESULT($result);
 
 // Remember other values in constants
+// @TODO Rewrite this constant
 define('__TOP10_MAX', getConfig('top10_max'));
 
 // Load final template
index 8cb3c43166bdda9caadafcc22b45be9ec423022e..83ff754c7ffee7a84636c8eb15dac2d8100f83b3 100644 (file)
@@ -42,9 +42,6 @@ if (!defined('__SECURITY')) {
        return;
 }
 
-// Already defined?
-if (defined('__THEME_SELECTION_CONTENT')) return false;
-
 // Load all active designs (or all if admin)
 $whereStatement = ""; $OUT = "";
 if (!IS_ADMIN()) $whereStatement = " WHERE theme_active='Y'";
@@ -66,14 +63,11 @@ if ($num_themes > 1) {
        $OUT = LOAD_TEMPLATE("admin_settings_saved", true, "<div class=\"admin_note\">{--ADMIN_NO_THEME_INSTALLED_WARNING--}</div>");
 }
 
-// Remember
-define('__THEME_SELECTION_CONTENT', $OUT);
-
 // Free memory
 SQL_FREERESULT($result_themes);
 
 // Load final box template
-LOAD_TEMPLATE("theme_select_box");
+LOAD_TEMPLATE("theme_select_box", false, $OUT);
 
 //
 ?>
index 593f7b08d63dc3e92393621c20116ba2fbe4b812..78573eef5cecaebbd8f61a1aa1828446019d30c2 100644 (file)
@@ -64,21 +64,21 @@ $OUT = "";
 if (SQL_NUMROWS($result) > 0) {
        // Load our winners...
        $SW = 2; $cnt = 1;
-       while (list($uid, $turbo, $last) = SQL_FETCHROW($result)) {
+       while ($content = SQL_FETCHARRAY($result)) {
                // Prepare data for the template
                $content = array(
                        'sw'     => $SW,
                        'cnt'    => $cnt,
-                       'uid'    => bigintval($uid),
-                       'points' => TRANSLATE_COMMA($turbo),
-                       'last'   => MAKE_DATETIME($last, "2"),
+                       'uid'    => bigintval($content['userid']),
+                       'points' => TRANSLATE_COMMA($content['beg']),
+                       'last'   => MAKE_DATETIME($content['last_online'], "2"),
                );
 
                // Load row template
                $OUT .= LOAD_TEMPLATE("member_list_beg_row", true, $content);
 
                // Count one up and switch colors
-               $cnt++;$SW = 3 - $SW;
+               $cnt++; $SW = 3 - $SW;
        }
 } else {
        // No one is interested in our "active rallye" ! :-(
index 61da7b93edfb8423df38708142b763b79825752f..f88fec53294bc6831ab6a53fe1a98ac092d32d62 100644 (file)
@@ -49,39 +49,31 @@ if (IS_ADMIN()) $whereStatement = "";
 $result = SQL_QUERY("SELECT id, cat FROM `{!_MYSQL_PREFIX!}_cats`".$whereStatement." ORDER BY `sort`", __FILE__, __LINE__);
 $cats = SQL_NUMROWS($result);
 
-if ($cats > 0)
-{
+if ($cats > 0) {
        $LEAST = false;
-       if (IS_FORM_SENT())
-       {
+       if (IS_FORM_SENT()) {
                $cnt = 0;
-               foreach (REQUEST_POST('cat') as $cat => $joined)
-               {
+               foreach (REQUEST_POST('cat') as $cat => $joined) {
                        if ($joined == "N") $cnt++;
                }
-               if (($cats - $cnt) < getConfig('least_cats'))
-               {
+
+               if (($cats - $cnt) < getConfig('least_cats')) {
                        REQUEST_UNSET_POST('ok');
                        $LEAST = true;
                }
        }
-       if (IS_FORM_SENT())
-       {
-               foreach (REQUEST_POST('cat') as $cat => $joined)
-               {
-                       switch ($joined)
-                       {
+
+       if (IS_FORM_SENT()) {
+               foreach (REQUEST_POST('cat') as $cat => $joined) {
+                       switch ($joined) {
                                case "Y":
                                        $sql = "";
                                        $result_user = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE userid=%s AND cat_id=%s LIMIT 1",
                                         array($UID, bigintval($cat)), __FILE__, __LINE__);
 
-                                       if (SQL_NUMROWS($result_user) == 0)
-                                       {
+                                       if (SQL_NUMROWS($result_user) == 0) {
                                                $sql = "INSERT INTO `{!_MYSQL_PREFIX!}_user_cats` (userid, cat_id) VALUES ('%s','%s')";
-                                       }
-                                        else
-                                       {
+                                       } else {
                                                // Free memory
                                                SQL_FREERESULT($result_user);
                                        }
@@ -91,21 +83,19 @@ if ($cats > 0)
                                        $sql = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE userid=%s AND cat_id=%s LIMIT 1";
                                        break;
                        }
-                       if (!empty($sql))
-                       {
+
+                       if (!empty($sql)) {
                                // Run SQL command
                                $result = SQL_QUERY_ESC(trim($sql), array($UID, bigintval($cat)), __FILE__, __LINE__);
                        }
                }
+
                // Categories saved...
                LOAD_TEMPLATE("admin_settings_saved", true, getMessage('MEMBER_CATS_SAVED'));
-       }
-        else
-       {
-               if ($LEAST)
-               {
+       } else {
+               if ($LEAST) {
                        // Also here we have to secure it... :(
-                       LOAD_TEMPLATE("admin_settings_saved", true, CATS_LEAST.": ".getConfig('least_cats'));
+                       LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('CATS_LEAST'), getConfig('least_cats')));
                }
                // Put some data into constants for the template
                define('__ROWS', ($cats*2+4));
@@ -114,40 +104,30 @@ if ($cats > 0)
                LOAD_TEMPLATE("member_cats_header");
 
                // Start switching colors and load all visible categories
-               $SW = 2;
-               while (list($id, $cat) = SQL_FETCHROW($result))
-               {
+               // @TODO Rewrite this to use $OUT .= ...
+               $OUT = ""; $SW = 2;
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Default he has not joined
-                       $JOINED_N = " checked=\"checked\""; $JOINED_Y = "";
-
-                       // Check category selection
-                       $result_user = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE userid=%s AND cat_id=%s LIMIT 1",
-                        array($UID, bigintval($id)), __FILE__, __LINE__);
-
-                       // When we found an entry don't read it, just change the JOINED_x variables
-                       if (REQUEST_ISSET_POST(('cat')))
-                       {
-                               if (REQUEST_POST('cat', $id) =='Y') { $JOINED_Y = " checked=\"checked\""; $JOINED_N = ""; }
-                       }
-                        else
-                       {
-                               if (SQL_NUMROWS($result_user) == 1)
-                               {
-                                       $JOINED_Y = " checked=\"checked\""; $JOINED_N = "";
+                       $content['jn'] = " checked=\"checked\"";
+                       $content['jy'] = "";
+
+                       // When we found an entry don't read it, just change the jx elements
+                       if (REQUEST_ISSET_POST(('cat'))) {
+                               // Form sent?
+                               if (REQUEST_POST('cat', $content['id']) =='Y') {
+                                       $content['jy'] = " checked=\"checked\"";
+                                       $content['jn'] = "";
+                               }
+                       } else {
+                               // Check if he has an entry
+                               if (GET_TOTAL_DATA($UID, "user_cats", "id", "userid", true, sprintf(" AND cat_id=%s", bigintval($content['id']))) == 1) {
+                                       $content['jn'] = "";
+                                       $content['jy'] = " checked=\"checked\"";
                                }
-
-                               // Free memory
-                               SQL_FREERESULT($result_user);
                        }
 
-                       // Prepare data for the template
-                       $content = array(
-                               'sw'  => $SW,
-                               'id'  => $id,
-                               'cat' => $cat,
-                               'jy'  => $JOINED_Y,
-                               'jn'  => $JOINED_N,
-                       );
+                       // Add some more
+                       $content['sw'] = $SW;
 
                        // Load row template and switch colors
                        LOAD_TEMPLATE("member_cat_row", false, $content);
@@ -157,13 +137,12 @@ if ($cats > 0)
                // Load footer template
                LOAD_TEMPLATE("member_cats_footer");
        }
-}
- else
-{
+} else {
        // No cateogries are defined yet
        LOAD_TEMPLATE("admin_settings_saved", true, getMessage('MEMBER_NO_CATS'));
 }
 
+// Free result
 SQL_FREERESULT($result);
 
 //
index 8dcd6731e71f97bbffbef748330f781eb04dabc4..6cf97e29943c9c8f07cc4826610bde9625b9334f 100644 (file)
@@ -86,7 +86,7 @@ $TOTAL = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL
 
 if (($HOLIDAY == "Y") && (GET_EXT_VERSION("holiday") >= "0.1.3")) {
        // Holiday is active!
-       LOAD_TEMPLATE("admin_settings_saved", false, HOLIDAY_ORDER_NOT_POSSIBLE);
+       LOAD_TEMPLATE("admin_settings_saved", false, getMessage('HOLIDAY_ORDER_NOT_POSSIBLE'));
 } elseif ((REQUEST_ISSET_POST(('frametester'))) && ($ALLOWED > 0) && (REQUEST_POST('receiver') > 0)) {
        // Continue with the frametester, we first need to store the data temporary in the pool
        //
@@ -218,21 +218,21 @@ ORDER BY d.%s %s",
 
                        // Load receivers from database
                        $TEST = array(); $cnt = 0;
-                       while (list($REC) = SQL_FETCHROW($result)) {
+                       while ($content = SQL_FETCHARRAY($result)) {
                                if ($HOLIDAY) {
                                        // Check for his holiday status
                                        $result_holiday = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_holidays`
 WHERE userid=%s AND holiday_start < UNIX_TIMESTAMP() AND holiday_end > UNIX_TIMESTAMP() LIMIT 1",
- array(bigintval($REC)), __FILE__, __LINE__);
-                                       if (SQL_NUMROWS($result_holiday) == 1) $REC = 0; // Exclude user who are in holiday
+ array(bigintval($content['userid'])), __FILE__, __LINE__);
+                                       if (SQL_NUMROWS($result_holiday) == 1) $content['userid'] = 0; // Exclude user who are in holiday
 
                                        // Free memory
                                        SQL_FREERESULT($result_holiday);
                                } // END - if
 
-                               if ($REC > 0) {
+                               if ($content['userid'] > 0) {
                                        // Add receiver
-                                       $TEST[] = $REC;
+                                       $TEST[] = $content['userid'];
                                        $cnt++;
                                } // END - if
                        } // END - while
@@ -411,13 +411,13 @@ array(
                        } // END - if
 
                        // ... and begin loading stuff
-                       while (list($id, $cat) = SQL_FETCHROW($result_cats)) {
-                               $CATS['id'][]   = bigintval($id);
-                               $CATS['name'][] = $cat;
+                       while ($content = SQL_FETCHARRAY($result_cats)) {
+                               $CATS['id'][]   = bigintval($content['id']);
+                               $CATS['name'][] = $content['cat'];
 
                                // Select users in current category
                                $result_uids = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE cat_id=%s AND userid != '%s' ORDER BY userid",
-                                       array(bigintval($id), $GLOBALS['userid']), __FILE__, __LINE__);
+                                       array(bigintval($content['id']), $GLOBALS['userid']), __FILE__, __LINE__);
 
                                $uid_cnt = 0;
                                while (list($ucat) = SQL_FETCHROW($result_uids)) {
@@ -601,10 +601,10 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
 
                                if (SQL_NUMROWS($result) == 1) {
                                        // Old order found
-                                       list($subject, $text, $payment, $tstamp, $url, $target, $cat, $zip) = SQL_FETCHROW($result);
+                                       list($subject, $text, $payment, $tstamp, $url, $target, $content['cat'], $zip) = SQL_FETCHROW($result);
 
                                        // Fix max receivers when it is too much
-                                       if ((isset($CATS['uids'][$cat])) && ($target > $CATS['uids'][$cat])) $target = $CATS['uids'][$cat];
+                                       if ((isset($CATS['uids'][$content['cat']])) && ($target > $CATS['uids'][$content['cat']])) $target = $CATS['uids'][$content['cat']];
 
                                        // Old order is grabbed
                                        $OLD_ORDER = true;
@@ -622,7 +622,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                        $CAT = "";
                                        foreach ($CATS['id'] as $key => $value) {
                                                $CAT .= "      <option value=\"".$value."\"";
-                                               if (($OLD_ORDER) && ($cat == $value)) $CAT .= " selected=\"selected\"";
+                                               if (($OLD_ORDER) && ($content['cat'] == $value)) $CAT .= " selected=\"selected\"";
                                                $CAT .= ">".$CATS['name'][$key]." (".$CATS['uids'][$key]." {--USER_IN_CAT--})</option>\n";
                                        } // END - foreach
 
index ad4ef86afc75992b5b0f290c25fd112eb8f3fc10..edbcaf2ca979cb27c43b32547032b1d37dd61743 100644 (file)
@@ -49,10 +49,10 @@ ADD_DESCR("member", __FILE__);
 
 $result_depths = SQL_QUERY("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` ORDER BY level", __FILE__, __LINE__);
 $TPTS = 0;
-while (list($lvl, $per) = SQL_FETCHROW($result_depths)) {
+while ($content = SQL_FETCHARRAY($result_depths)) {
        // Load referal points
        $result_points = SQL_QUERY_ESC("SELECT points FROM `{!_MYSQL_PREFIX_user_points!}` WHERE userid=%s AND ref_depth=%d LIMIT 1",
-               array($GLOBALS['userid'], bigintval($lvl)), __FILE__, __LINE__);
+               array($GLOBALS['userid'], bigintval($content['level'])), __FILE__, __LINE__);
 
        // Entry found?
        if (SQL_NUMROWS($result_points) == 1) {
@@ -90,7 +90,7 @@ ORDER BY type", array(REVERT_COMMA($TPTS)), __FILE__, __LINE__);
                SQL_FREERESULT($result);
 
                // Check for his payouts
-               $result_payouts = SQL_QUERY_ESC("SELECT DISTINCT p.id, p.payout_total, p.target_account, p.target_bank, t.type, p.payout_timestamp, p.status, t.allow_url AS allow, p.target_url AS url, p.link_text AS alt, p.banner_url AS bannerm
+               $result_payouts = SQL_QUERY_ESC("SELECT DISTINCT p.id, p.payout_total, p.target_account, p.target_bank, t.type, p.payout_timestamp, p.status, t.allow_url AS allow, p.target_url AS url, p.link_text AS alt, p.banner_url AS banner
 FROM `{!_MYSQL_PREFIX!}_user_payouts` AS p
 LEFT JOIN `{!_MYSQL_PREFIX!}_payout_types` AS t
 ON p.payout_id = t.id
@@ -99,44 +99,47 @@ ORDER BY p.payout_timestamp DESC",
                 array($GLOBALS['userid']), __FILE__, __LINE__);
                if (SQL_NUMROWS($result_payouts) > 0) {
                        // List all his requests
-                       $SW = 2; $OUT = "";
-                       while (list($pid, $total, $account, $bank, $type, $tstamp, $status, $allow, $url, $alt, $banner) = SQL_FETCHROW($result_payouts)) {
+                       $OUT = ""; $SW = 2;
+                       while ($content = SQL_FETCHARRAY($result_payouts)) {
                                // Translate status
-                               $status = constant('PAYOUT_MEMBER_STATUS_'.strtoupper($status).'');
-                               $status = "<div class=\"member_failed\">".$status."</div>";
+                               $content['status'] = getMessage('PAYOUT_MEMBER_STATUS_'.strtoupper($content['status']).'');
+                               $content['status'] = "<div class=\"member_failed\">".$content['status']."</div>";
 
                                // Nothing entered must be secured in member/what-payputs.php !
-                               if ($allow == "Y") {
+                               if ($content['allow'] == "Y") {
                                        // Banner/Textlink views/clicks request
-                                       if (!empty($banner)) {
+                                       if (!empty($content['banner'])) {
                                                // Banner
-                                               $account = "<img src=\"".$banner."\" alt=\"".$alt."\" title=\"".$alt."\" border=\"0\" />";
+                                               $content['target_account'] = "<img src=\"".$content['banner']."\" alt=\"".$content['alt']."\" title=\"".$content['alt']."\" border=\"0\" />";
                                        } else {
                                                // Textlink
-                                               $account = $alt;
+                                               $content['target_account'] = $content['alt'];
                                        }
-                                       $bank = "<a href=\"".DEREFERER($url)."\" target=\"_blank\">{--CLICK_HERE--}</a>";
+                                       $content['target_bank'] = "<a href=\"".DEREFERER($content['url'])."\" target=\"_blank\">{--CLICK_HERE--}</a>";
                                } else {
                                        // e-currency payout request
-                                       if (empty($account)) $account = "---";
-                                       if (empty($bank))    $bank    = "---";
+                                       if (empty($content['target_account'])) $content['target_account'] = "---";
+                                       if (empty($content['target_bank']))    $content['target_bank']    = "---";
                                }
 
                                // Prepare data for the template
+                               // @TODO Rewritings: acc->target_account,bank->target_bank in templates
                                $content = array(
                                        'sw'     => $SW,
-                                       'acc'    => $account,
-                                       'points' => TRANSLATE_COMMA($total)." ".COMPILE_CODE($type),
-                                       'bank'   => $bank,
-                                       'stamp'  => MAKE_DATETIME($tstamp, "2"),
-                                       'status' => $status
+                                       'acc'    => $content['target_account'],
+                                       'points' => TRANSLATE_COMMA($content['payout_total'])." ".COMPILE_CODE($content['type']),
+                                       'bank'   => $content['target_bank'],
+                                       'stamp'  => MAKE_DATETIME($content['payout_timestamp'], "2"),
+                                       'status' => $content['status']
                                );
+
                                // Load row template and switch colors
                                $OUT .= LOAD_TEMPLATE("member_payout_row", true, $content);
                                $SW = 3 - $SW;
                        }
 
                        // Remember rows in constant
+                       // @TODO Rewrite this constant
                        define('__PAYOUT_ROWS', $OUT);
 
                        // Load template
@@ -151,39 +154,41 @@ ORDER BY p.payout_timestamp DESC",
        }
 } else {
        // Chedk if he can get paid by selected type
-       $result = SQL_QUERY_ESC("SELECT type, rate, min_points, allow_url FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE id=%s LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT type, rate, min_points, allow_url AS allow FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE id=%s LIMIT 1",
                array(bigintval(REQUEST_GET('payout'))), __FILE__, __LINE__);
 
        if (SQL_NUMROWS($result) == 1) {
-               // ID is valid
-               list($type, $rate, $min, $allow) = SQL_FETCHROW($result);
+               // ID is valid so load the data
+               $content = SQL_FETCHARRAY($result);
                SQL_FREERESULT($result);
 
                // Calculate maximum value
-               $max = round($TPTS * $rate - 0.5);
+               $max = round($TPTS * $content['rate'] - 0.5);
 
                // Calulcate points from submitted amount
                $PAYOUT = 0;
                if (REQUEST_ISSET_POST(('payout'))) {
-                       $PAYOUT  = bigintval(REQUEST_POST('payout')) / $rate;
-                       $PAY_MAX = $max / $rate;
+                       $PAYOUT  = bigintval(REQUEST_POST('payout')) / $content['rate'];
+                       $PAY_MAX = $max / $content['rate'];
                }
 
                // Move variables into constants for templates
+               // @TODO Rewrite these constants
                define('PAYOUT_MAX_VALUE' , $max);
-               define('PAYOUT_TYPE_VALUE', COMPILE_CODE($type));
+               define('PAYOUT_TYPE_VALUE', COMPILE_CODE($content['type']));
 
-               if (REVERT_COMMA($TPTS) >= $min) {
+               if (REVERT_COMMA($TPTS) >= $content['min_points']) {
                        // Ok, he can get be paid
-                       if ((IS_FORM_SENT()) && ($PAYOUT <= $PAY_MAX) && ($PAYOUT >= $min)) {
+                       if ((IS_FORM_SENT()) && ($PAYOUT <= $PAY_MAX) && ($PAYOUT >= $content['min_points'])) {
                                // Calculate exact value
+                               // @TODO Rewrite this constant
                                define('PAYOUT_POINTS_VALUE', $PAYOUT);
 
                                // Subtract points from member's account
                                SUB_POINTS("payout", $GLOBALS['userid'], $PAYOUT);
 
                                // Add entry to his tranfer history
-                               if ($allow == "Y") {
+                               if ($content['allow'] == "Y") {
                                        // Banner/textlink ordered
                                        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_payouts` (userid, payout_total, payout_id, payout_timestamp, status, target_url, link_text, banner_url)
 VALUES (%s,%s,%s, UNIX_TIMESTAMP(), 'NEW','%s','%s','%s')",
@@ -242,7 +247,7 @@ VALUES (0, 'NEW','PAYOUT_REQUEST','[payout:] {--PAYOUT_REQUEST_ADMIN--}','%s', U
 
                                // Load template and output it
                                LOAD_TEMPLATE("admin_settings_saved", false, getMessage('PAYOUT_REQUEST_SENT'));
-                       } elseif ($allow == "Y") {
+                       } elseif ($content['allow'] == "Y") {
                                // Generate banner order form
                                LOAD_TEMPLATE("member_payout_form_banner");
                        } else {
index 2f3a853add8871ef51022e261003b46cd4f5498d..19514c45178d4d78a94315db9bc2e7b5772181ca 100644 (file)
@@ -46,6 +46,7 @@ $result_depths = SQL_QUERY("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refde
 $depths = SQL_NUMROWS($result_depths);
 
 // Add many more rows for the login/turbo/ref/order bonus
+// @TODO Should we rewrite this to a filter?
 if (!EXT_IS_ACTIVE("bonus")) $depths += 1;
 if (GET_EXT_VERSION("bonus") >= "0.2.2") $depths += 6;
 if (GET_EXT_VERSION("bonus") >= "0.4.4") $depths += 4;
@@ -57,12 +58,12 @@ define('__ROWS_VALUE', ($depths*2+15));
 $TPTS = 0; $TREF = 0; $TLOCK = 0; $OUT = "";
 
 // Load ref levels
-while (list($lvl, $per) = SQL_FETCHROW($result_depths)) {
+while ($content = SQL_FETCHARRAY($result_depths)) {
        // Initialize ref-count
        $REFS = 0;
 
        // Load referal points
-       $result_points = SQL_QUERY_ESC("SELECT points, locked_points FROM `{!_MYSQL_PREFIX!}_user_points` WHERE userid=%s AND ref_depth=%d LIMIT 1", array($GLOBALS['userid'], bigintval($lvl)), __FILE__, __LINE__);
+       $result_points = SQL_QUERY_ESC("SELECT points, locked_points FROM `{!_MYSQL_PREFIX!}_user_points` WHERE userid=%s AND ref_depth=%d LIMIT 1", array($GLOBALS['userid'], bigintval($content['level'])), __FILE__, __LINE__);
        if (SQL_NUMROWS($result_points) == 1) {
                list($points, $locked) = SQL_FETCHROW($result_points);
                SQL_FREERESULT($result_points);
@@ -74,7 +75,7 @@ while (list($lvl, $per) = SQL_FETCHROW($result_depths)) {
 
        // Load referal counts
        $result_refs = SQL_QUERY_ESC("SELECT counter FROM `{!_MYSQL_PREFIX!}_refsystem` WHERE userid=%s AND level='%s' LIMIT 1",
-               array($GLOBALS['userid'], bigintval($lvl)), __FILE__, __LINE__);
+               array($GLOBALS['userid'], bigintval($content['level'])), __FILE__, __LINE__);
        if (SQL_NUMROWS($result_refs) == 1) {
                list($REFS) = SQL_FETCHROW($result_refs);
                SQL_FREERESULT($result_refs);
@@ -85,8 +86,8 @@ while (list($lvl, $per) = SQL_FETCHROW($result_depths)) {
 
        // Transfer data to array for template
        $content = array(
-               'lvl'    => $lvl,
-               'per'    => TRANSLATE_COMMA($per),
+               'lvl'    => $content['level'],
+               'per'    => TRANSLATE_COMMA($content['percents']),
                'points' => TRANSLATE_COMMA($points),
                'refs'   => TRANSLATE_COMMA($REFS),
        );
index 3cb7911f3efe5333331c08052d57d743aa8064e3..3a63616d0485285715c0ea247beaceb50ac7288f 100644 (file)
@@ -55,28 +55,23 @@ $result = SQL_QUERY("SELECT DISTINCT d.id, d.admin_id, a.login, d.title, d.descr
  WHERE d.admin_id=a.id".$ADMIN." AND d.notified='Y'
  ORDER BY d.end_time LIMIT 1", __FILE__, __LINE__);
 
-if (SQL_NUMROWS($result) == 1)
-{
+if (SQL_NUMROWS($result) == 1) {
        // Found some (normally one...
        list($id, $aid, $login, $title, $descr, $templ, $start, $end, $min_users, $min_prices) = SQL_FETCHROW($result);
        SQL_FREERESULT($result);
 
        $expired = false;
-       if ($end < time())
-       {
+       if ($end < time()) {
                // Rallye is expired
-               define('__RALLYE_EXTRAS', RALLYE_HAS_EXPIRED);
+               define('__RALLYE_EXTRAS', getMessage('RALLYE_HAS_EXPIRED'));
                $expired = true;
-       }
-        elseif (time() >= ($end - getConfig('one_day')))
-       {
+       } elseif (time() >= ($end - getConfig('one_day'))) {
                // Rallye will expire in less one day!
-               define('__RALLYE_EXTRAS', RALLYE_EXPIRE_ONE_DAY);
-       }
-        else
-       {
-               define('__RALLYE_EXTRAS', "<a href=\"{!URL!}/modules.php?module=login&amp;what=reflinks\">".RALLYE_GET_REFLINK."</a>");
+               define('__RALLYE_EXTRAS', getMessage('RALLYE_EXPIRE_ONE_DAY'));
+       } else {
+               define('__RALLYE_EXTRAS', "<a href=\"{!URL!}/modules.php?module=login&amp;what=reflinks\">{--RALLYE_GET_REFLINK--}</a>");
        }
+
        // Set admin line (currently set to impressum, later to contact form)
        define('__RALLYE_ADMIN', "<a href=\"{!URL!}/modules.php?module=index&amp;what=impressum&amp;admin=".$aid."\">".$login."</a>");
 
@@ -84,64 +79,41 @@ if (SQL_NUMROWS($result) == 1)
        define('__RALLYE_TITLE', COMPILE_CODE($title));
 
        // Handle description...
-       if ((empty($descr)) && (!empty($templ)))
-       {
+       if ((empty($descr)) && (!empty($templ))) {
                // Use description from template
                define('__RALLYE_DESCR', LOAD_TEMPLATE("rallye_".$templ, true));
-       }
-        else
-       {
+       } else {
                // Use description from database
                define('__RALLYE_DESCR', COMPILE_CODE($descr));
        }
 
-       if ($min_users == 0)
-       {
-               // Rallye ends without user limitation
-               define('__RALLYE_MAX_USERS', RALLYE_END_NO_USER_LIMITATION);
-       }
-        else
-       {
-               // Rallye ends when X members are totally in your exchange
-               define('__RALLYE_MAX_USERS', RALLYE_END_USERS_1." ".$min_users." ".RALLYE_END_USERS_2);
-       }
-       if ($min_prices == 0)
-       {
-               // Rallye ends without user limitation
-               define('__RALLYE_MIN_PRICES', RALLYE_END_NO_PRICE_LIMITATION);
-       }
-        else
-       {
-               // Rallye ends when X members are totally in your exchange
-               define('__RALLYE_MIN_PRICES', RALLYE_END_PRICES_1." ".$min_prices." ".RALLYE_END_PRICES_2);
-       }
+       // Determine min_users/prices
+       define('__RALLYE_MAX_USERS' ,  RALLYE_DETERMINE_MIN_USERS($min_users));
+       define('__RALLYE_MAX_PRICES',  RALLYE_DETERMINE_MIN_PRICES($min_prices));
 
        // Set start and end time
        define('__RALLYE_START', MAKE_DATETIME($start, "1"));
        define('__RALLYE_END'  , MAKE_DATETIME($end  , "1"));
 
-       if ($expired)
-       {
+       if ($expired === true) {
                define('__RALLYE_PRICES', RALLYE_LIST_WINNERS($id));
-               define('__RALLYE_TOP_USERS', "<div align=\"center\" class=\"big\">".__RALLYE_EXTRAS."</div>");
-               define('__RALLYE_CAN_WIN_THIS', RALLYE_OUR_WINNERS_ARE);
-       }
-        else
-       {
+               define('__RALLYE_TOP_USERS', "<div align=\"center\" class=\"big\">{!__RALLYE_EXTRAS!}</div>");
+               define('__RALLYE_CAN_WIN_THIS', getMessage('RALLYE_OUR_WINNERS_ARE'));
+       } else {
                define('__RALLYE_PRICES', RALLYE_ADD_PRICES($id, "html"));
                define('__RALLYE_TOP_USERS', RALLYE_ADD_TOPUSERS($id, $GLOBALS['userid']));
-               define('__RALLYE_CAN_WIN_THIS', RALLYE_YOU_CAN_WIN);
+               define('__RALLYE_CAN_WIN_THIS', getMessage('RALLYE_YOU_CAN_WIN'));
        }
 
        // And load final template
        LOAD_TEMPLATE("guest_rallye_show");
-}
- else
-{
+} else {
        // No rallye found so far
        LOAD_TEMPLATE("guest_no_rallyes");
 }
+
 //
 OUTPUT_HTML("</div>");
+
 //
 ?>
index fbb1b0d59b4dc2c6b7bc6d8a859f333d4020a406..93f37a2ba6a47e0decda0d42cdb944b9ffa949cf 100644 (file)
@@ -48,7 +48,7 @@ $result = SQL_QUERY_ESC("SELECT ref_clicks FROM `{!_MYSQL_PREFIX!}_user_data` WH
 list($c) = SQL_FETCHROW($result);
 SQL_FREERESULT($result);
 
-OUTPUT_HTML("<div class=\"tiny\">".YOUR_PERSONAL_REFLINK.":<br />
+OUTPUT_HTML("<div class=\"tiny\">{--YOUR_PERSONAL_REFLINK--}:<br />
 <strong><a href=\"{!URL!}/ref.php?refid=".$GLOBALS['userid']."\" target=\"_blank\">{!URL!}/ref.php?ref=".$GLOBALS['userid']."</a></strong><br />
 <br />");
 
@@ -58,30 +58,30 @@ if (EXT_IS_ACTIVE("nickname")) {
 
        if (!empty($nick)) {
                // Display nickname link
-               OUTPUT_HTML(NICKNAME_YOUR_REFLINK.":<br />
+               OUTPUT_HTML("{--NICKNAME_YOUR_REFLINK--}:<br />
 <strong><a href=\"{!URL!}/ref.php?ref=".$nick."\" target=\"_blank\">{!URL!}/ref.php?ref=".$nick."</a></strong><br />
 <br />");
        } else {
                // Display link to nickname form
-               OUTPUT_HTML("<div class=\"guest_note\">".NO_NICKNAME_SET."</strong><br />
-<a class=\"tiny\" href=\"{!URL!}/modules.php?module=login&amp;what=nickname\">".PLEASE_CLICK_NICKNAME_FORM."</a>");
+               OUTPUT_HTML("<div class=\"guest_note\">{--NO_NICKNAME_SET--}</strong><br />
+<a class=\"tiny\" href=\"{!URL!}/modules.php?module=login&amp;what=nickname\">{--PLEASE_CLICK_NICKNAME_FORM--}</a>");
        }
 }
 
 // Clicks on your reflink
-OUTPUT_HTML(YOUR_REFCLICKS.": <strong>".$c."</strong> ".CLICKS."</div><br /><br />");
+OUTPUT_HTML("{--YOUR_REFCLICKS--}: <strong>".$c."</strong> {--CLICKS--}</div><br /><br />");
 $whereStatement = " WHERE `visible`='Y'";
 if (IS_ADMIN()) $whereStatement = "";
 $result = SQL_QUERY("SELECT id, url, alternate, counter, clicks FROM `{!_MYSQL_PREFIX!}_refbanner`", __FILE__, __LINE__);
 
 if (SQL_NUMROWS($result) > 0) {
        // List available ref banners
-       $SW = 2; $OUT = "";
-       while (list($id, $url, $alt, $count, $clks) = SQL_FETCHROW($result)) {
-               $test = str_replace(URL, constant('PATH'), $url); $size = 0;
-               if ($test == $url) {
+       $OUT = ""; $SW = 2;
+       while ($content = SQL_FETCHARRAY($result)) {
+               $test = str_replace(constant('URL'), constant('PATH'), $content['url']); $size = 0;
+               if ($test == $content['url']) {
                        // Download banner (I hope you keep the banner on same server???)
-                       $fp = GET_URL($url); $bannerContent = "";
+                       $fp = GET_URL($content['url']); $bannerContent = "";
                        if ((!empty($fp)) && (is_array($fp)) && (count($fp) > 0) {
                                // Loads only found banner, when there is a 404 error this foreach() command
                                // will cause an "Invalid argument supplied for foreach()" error
@@ -93,17 +93,19 @@ if (SQL_NUMROWS($result) > 0) {
                } elseif (FILE_READABLE($test)) {
                        $size = filesize($test);
                }
-               if ($size > 0) $alt .= " (".TRANSLATE_COMMA(round($size/102.4)/10)." ".KBYTES.")";
+
+               if ($size > 0) $content['alternate'] .= " (".TRANSLATE_COMMA(round($size/102.4)/10)." {--KBYTES--})";
 
                // Load banner data
+               // @TODO Rewritings: alt->alternate,cnt->counter,cks->clicks,uid->userid in template
                $content = array(
                        'sw'  => $SW,
-                       'url' => $url,
-                       'alt' => $alt,
-                       'cnt' => $count,
-                       'cks' => $clks,
+                       'url' => $content['url'],
+                       'alt' => $content['alternate'],
+                       'cnt' => $content['counter'],
+                       'cks' => $content['clicks'],
                        'uid' => $GLOBALS['userid'],
-                       'id'  => $id,
+                       'id'  => $content['id'],
                );
 
                // Add row
index 2c000bc97910e0b5ccbead4381d725a21c8f2518..a5e520a23cbdd4d730e8aeb53174ce063056ef80 100644 (file)
@@ -101,7 +101,7 @@ ORDER BY timestamp_ordered DESC",
 
 if (SQL_NUMROWS($result) > 0) {
        // Mail orders are in pool so we can display them
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        while ($data = SQL_FETCHROW($result)) {
                // Prepare data for the template
                $content = array(
index 738ca29ba8fa0486ee7df1e45c708015f2d8d310..4e9d6e4d5ebb95a32f26bc927aff02d89d78c3b6 100644 (file)
@@ -238,9 +238,10 @@ case "new": // Start new transfer
                if (SQL_NUMROWS($result) > 0) {
                        // Load list
                        $OUT  = "<select name=\"to_uid\" size=\"1\" class=\"member_select\">
-  <option value=\"0\">".SELECT_NONE."</option>\n";
+       <option value=\"0\">{--SELECT_NONE--}</option>\n";
+                       // @TODO Try to rewrite his to $content = SQL_FETCHARRAY(), see some lines above for two different queries
                        while (list($uid, $nick) = SQL_FETCHROW($result)) {
-                               $OUT .= "<option value=\"".$uid."\"";
+                               $OUT .= "       <option value=\"".$uid."\"";
                                if ((REQUEST_ISSET_POST(('to_uid'))) && (REQUEST_POST('to_uid') == $uid)) $OUT .= " selected=\"selected\"";
                                $OUT .= ">";
                                if (($nick != $uid) && (!empty($nick))) {
@@ -300,6 +301,7 @@ case "list_out": // List only outgoing transactions
        {
        case "list_in":
                $sql = "SELECT trans_id, from_uid, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_in` WHERE userid=%s ORDER BY time_trans DESC LIMIT ".getConfig('transfer_max');
+               // @TODO Rewrite these constants
                $NOTHING = getMessage('TRANSFER_NO_INCOMING_TRANSFERS');
                define('__TRANSFER_SUM', getMessage('TRANSFER_TOTAL_INCOMING'));
                define('__TRANSFER_TITLE', getMessage('TRANSFER_LIST_INCOMING'));
@@ -307,6 +309,7 @@ case "list_out": // List only outgoing transactions
 
        case "list_out":
                $sql = "SELECT trans_id, to_uid, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_out` WHERE userid=%s ORDER BY time_trans DESC LIMIT ".getConfig('transfer_max');
+               // @TODO Rewrite these constants
                $NOTHING = getMessage('TRANSFER_NO_OUTGOING_TRANSFERS');
                define('__TRANSFER_SUM', getMessage('TRANSFER_TOTAL_OUTGOING'));
                define('__TRANSFER_TITLE', getMessage('TRANSFER_LIST_OUTGOING'));
@@ -318,25 +321,25 @@ case "list_out": // List only outgoing transactions
        $result = SQL_QUERY_ESC($sql, array($GLOBALS['userid']), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                $OUT = ""; $SW = 2;
+               // @TODO This should be somehow rewritten to $content = SQL_FETCHARRAY(), see switch() block above for SQL queries
                while (list($tid, $uid, $points, $reason, $stamp) = SQL_FETCHROW($result)) {
-                       if ($type == "OUT") $points = "$points-";
-                       $OUT .= "<tr>
-  <td class=\"transfer_row1 switch_sw".$SW." bottom2 right2\">
-    <div class=\"transfer_row1\">".$tid."</div>
-  </td>
-  <td class=\"transfer_row2 switch_sw".$SW." bottom2 right2\">
-    <div class=\"transfer_row2\">".MAKE_DATETIME($stamp, "3")."</div>
-  </td>
-  <td class=\"transfer_row3 switch_sw".$SW." bottom2 right2\">
-    <div class=\"transfer_row3\">".$uid."</div>
-  </td>
-  <td class=\"transfer_row4 switch_sw".$SW." bottom2 right2\">
-    <div class=\"transfer_row4\">".$reason."</div>
-  </td>
-  <td class=\"transfer_row5 switch_sw".$SW." bottom2\">
-    <div class=\"transfer_row5\">".$points."</div>
-  </td>
-</tr>\n";
+                       // Rewrite points
+                       if ($type == "OUT") $points = $points."-";
+
+                       // Prepare content for template
+                       $content = array(
+                               'sw'     => $SW,
+                               'tid'    => $id,
+                               'stamp'  => MAKE_DATETIME($stamp, "3"),
+                               'uid'    => $uid,
+                               'reason' => $reason,
+                               'points' => TRANSLATE_COMMA($points)
+                       );
+
+                       // Load row template
+                       $OUT .= LOAD_TEMPLATE("member_transfer_row2", true, $content);
+
+                       // Add points and switch color
                        $total += $points;
                        $SW = 3 - $SW;
                }
@@ -353,6 +356,7 @@ case "list_out": // List only outgoing transactions
        }
 
        // ... and add them to a constant for the template
+       // @TODO Rewrite these constants
        define('__TRANSFER_ROWS', $OUT);
 
        // Remeber total amount
@@ -404,29 +408,26 @@ array($GLOBALS['userid'], getConfig('transfer_max')), __FILE__, __LINE__);
 
        $total = 0;
        if (SQL_NUMROWS($result) > 0) {
+               // Search for entries
+               $result = SQL_QUERY("SELECT party_uid, trans_id, points, reason, time_trans, trans_type FROM `{!_MYSQL_PREFIX!}_transfers_tmp` ORDER BY time_trans DESC",
+                       __FILE__, __LINE__);
+
                // Output rows
                $OUT = ""; $SW = 2;
-               $result = SQL_QUERY("SELECT party_uid, trans_id, points, reason, time_trans, trans_type FROM `{!_MYSQL_PREFIX!}_transfers_tmp` ORDER BY time_trans DESC", __FILE__, __LINE__);
-               while (list($uid, $idx, $points, $reason, $stamp, $type) = SQL_FETCHROW($result)) {
-                       if ($type == "OUT") $points = "-$points";
-                       $OUT .= "<tr>
-  <td class=\"transfer_row1 switch_sw".$SW." bottom2 right2\">
-    <div class=\"transfer_row1\">".$idx."</div>
-  </td>
-  <td class=\"transfer_row2 switch_sw".$SW." bottom2 right2\">
-    <div class=\"transfer_row2\">".MAKE_DATETIME($stamp, "3")."</div>
-  </td>
-  <td class=\"transfer_row3 switch_sw".$SW." bottom2 right2\">
-    <div class=\"transfer_row3\">".$uid."</div>
-  </td>
-  <td class=\"transfer_row4 switch_sw".$SW." bottom2 right2\">
-    <div class=\"transfer_row4\">".$reason."</div>
-  </td>
-  <td class=\"transfer_row5 switch_sw".$SW." bottom2\">
-    <div class=\"transfer_row5\">".$points."</div>
-  </td>
-</tr>\n";
-                       $total += $points;
+               while ($content = SQL_FETCHARRAY($result)) {
+                       // Rewrite points
+                       if ($content['trans_type'] == "OUT") $content['points'] = "-".$content['points']."";
+
+                       // Prepare content for template
+                       $content['sw']     = $SW;
+                       $content['time']   = MAKE_DATETIME($content['time_trans'], "3");
+                       $content['points'] = TRANSLATE_COMMA($content['points']);
+
+                       // Load row template
+                       $OUT .= LOAD_TEMPLATE("member_transfer_row", true, $content);
+
+                       // Add points and switch color
+                       $total += $content['points'];
                        $SW = 3 - $SW;
                }
 
@@ -442,6 +443,7 @@ array($GLOBALS['userid'], getConfig('transfer_max')), __FILE__, __LINE__);
        }
 
        // ... and add them to a constant for the template
+       // @TODO Rewrite all these constants
        define('__TRANSFER_ROWS', $OUT);
 
        // Remeber total amount
index 5b2ebb2aec13b5e6cc5ad7cbeeb6bcde3c9a3e71..b431d9a52220cc6c551cc555d54a5604a859bfb5 100644 (file)
@@ -124,7 +124,9 @@ if (EXT_IS_ACTIVE("bonus")) {
 // Mails left for confirmation?
 if (SQL_NUMROWS($result) > 0) {
        // Please confirm these mails!
-       $sum = 0; $SW = 2; $OUT = "";
+       $sum = 0; $OUT = ""; $SW = 2;
+
+       // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
        while (list($id, $id2, $type) = SQL_FETCHROW($result)) {
                // Load data from stats table...
                $cat = ""; $result_data = false;
index 463c9743bdba7b27a3dc3a135e908527e403574a..064659a1627bc657330004b35517ab3d721c65cc 100644 (file)
@@ -140,7 +140,7 @@ if (SQL_NUMROWS($result) == 1) {
        } else {
                // Locked or so?
                $STATUS = SPONSOR_TRANSLATE_STATUS($content['status']);
-               $OUT = LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_ACCOUNT_FAILED_1.$STATUS.SPONSOR_ACCOUNT_FAILED_2);
+               $OUT = LOAD_TEMPLATE("admin_settings_saved", true, sprintf(getMessage('SPONSOR_ACCOUNT_FAILED'), $STATUS));
        }
 } else {
        // Sponsor account not found!
index 3d07349d68b21d63d775585dffcc8cfef7bae5d2..a85fa205ea5f7d0195d6f12ec3e3e8e8d37d0fca 100644 (file)
@@ -84,7 +84,7 @@ if (SQL_NUMROWS($result) == 1) {
                                $OUT = LOAD_TEMPLATE("admin_settings_saved", true, $MSG);
                        } else {
                                // No message generated
-                               $OUT = LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_MESSAGE_GENERATED);
+                               $OUT = LOAD_TEMPLATE("admin_settings_saved", true, getMessage('SPONSOR_NO_MESSAGE_GENERATED'));
                        }
                } else {
                        // Make yes/no selection
@@ -109,7 +109,7 @@ if (SQL_NUMROWS($result) == 1) {
        } else {
                // Locked or so?
                $STATUS = SPONSOR_TRANSLATE_STATUS($content['status']);
-               $OUT = LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_ACCOUNT_FAILED_1.$STATUS.SPONSOR_ACCOUNT_FAILED_2);
+               $OUT = LOAD_TEMPLATE("admin_settings_saved", true, sprintf(getMessage('SPONSOR_ACCOUNT_FAILED'), $STATUS));
        }
 } else {
        // Sponsor account not found!
index 235bbdf8a0f1196c811953795a1455279682e7bc..9e7dbfe7effa58c39db9a78093ce4bdf94330ad7 100644 (file)
@@ -48,21 +48,21 @@ $curr = date("m", time());
 
 if (getConfig('last_month') != $curr) {
        // Check for unsubscribed members
-       $result = SQL_QUERY("SELECT userid, nl_until FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nl_receive='N' ORDER BY userid", __FILE__, __LINE__);
+       $result = SQL_QUERY("SELECT userid, email, nl_until FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nl_receive='N' ORDER BY userid", __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // Some unsubscriptions are found so we reset them to receive newsletters
-               while (list($uid, $until) = SQL_FETCHROW($result)) {
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Update account
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET nl_receive='Y', nl_until='0' WHERE userid=%s LIMIT 1",
-                               array(bigintval($uid)), __FILE__, __LINE__);
+                               array(bigintval($content['userid'])), __FILE__, __LINE__);
 
                        // Send email to him
-                       $msg = LOAD_EMAIL_TEMPLATE("member_newsletter_reset", true, bigintval($uid));
-                       SEND_EMAIL($uid, NL_MEMBER_RESET_SUBJECT, $msg);
+                       $msg = LOAD_EMAIL_TEMPLATE("member_newsletter_reset", true, bigintval($content['userid']));
+                       SEND_EMAIL($content['email'], getMessage('NL_MEMBER_RESET_SUBJECT'), $msg);
 
                        // Send email to admin
-                       SEND_ADMIN_NOTIFICATION(NL_ADMIN_SUBJECT, "admin_newsletter_reset", array(), $GLOBALS['userid']);
-               }
+                       SEND_ADMIN_NOTIFICATION(getMessage('NL_ADMIN_SUBJECT'), "admin_newsletter_reset", array(), $GLOBALS['userid']);
+               } // END - if
 
                // Free memory
                SQL_FREERESULT($result);
index d25ae4c41425990ee99c1889570b07c66e4ecb8c..c019248ea03d23b3979f8d096028ef7fb5d29803 100644 (file)
@@ -312,7 +312,7 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) {
                list($ret) = SQL_FETCHROW($result);
 
                // Shall we return it?
-               if ($return) {
+               if ($return === true) {
                        // Return title
                        return $ret;
                } elseif (((GET_EXT_VERSION("sql_patches") >= "0.2.3") && (getConfig('youre_here') == "Y")) || ((IS_ADMIN()) && ($modCheck == "admin"))) {
@@ -363,7 +363,7 @@ function ADD_MENU ($MODE, $act, $wht) {
        // Non-admin shall not see all menus
        if (!IS_ADMIN()) {
                $AND = " AND `visible`='Y' AND `locked`='N'";
-       }
+       } // END - if
 
        // Load SQL data and add the menu to the output stream...
        $result_main = SQL_QUERY_ESC("SELECT title, action FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE (what='' OR `what` IS NULL)".$AND." ORDER BY `sort`",
@@ -372,60 +372,69 @@ function ADD_MENU ($MODE, $act, $wht) {
        if (SQL_NUMROWS($result_main) > 0) {
                OUTPUT_HTML("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"".$MODE."_menu\">");
                // There are menus available, so we simply display them... :)
-               while (list($main_title, $main_action) = SQL_FETCHROW($result_main)) {
-                       //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
+               while ($content = SQL_FETCHARRAY($result_main)) {
+                       //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
                        // Init variables
-                       $GLOBALS['block_mode'] = false; $act = $main_action;
-
-                       // Prepare content
-                       $content = array(
-                               'action' => $main_action,
-                               'title'  => $main_title
-                       );
+                       $GLOBALS['block_mode'] = false;
+                       $act = $content['action'];
 
                        // Load menu header template
                        LOAD_TEMPLATE($MODE."_menu_title", false, $content);
 
-                       $result_sub = SQL_QUERY_ESC("SELECT title, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ".$AND." ORDER BY `sort`",
-                        array($MODE, $main_action), __FUNCTION__, __LINE__);
+                       // Sub menu
+                       $result_sub = SQL_QUERY_ESC("SELECT title AS sub_title, what AS sub_what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ".$AND." ORDER BY `sort`",
+                               array($MODE, $content['action']), __FUNCTION__, __LINE__);
+
+                       // Get number of rows
                        $ctl = SQL_NUMROWS($result_sub);
+
+                       // Do we have some entries?
                        if ($ctl > 0) {
-                               $cnt=0;
-                               while (list($sub_title, $sub_what) = SQL_FETCHROW($result_sub)) {
+                               // Init counter
+                               $cnt = 0;
+
+                               // Load all sub menus
+                               while ($content2 = SQL_FETCHARRAY($result_sub)) {
+                                       // Merge both arrays in one
+                                       $content = merge_array($content, $content2);
+
                                        // Init content
-                                       $content = "";
+                                       $OUT = "";
 
                                        // Full file name for checking menu
-                                       //* DEBUG: */ echo __LINE__.":!!!!".$sub_what."!!!<br />\n";
-                                       $FQFN = sprintf("%sinc/modules/%s/what-%s.php", constant('PATH'), $MODE, $sub_what);
-                                       if (FILE_READABLE($FQFN)) {
-                                               if ((!empty($wht)) && (($wht == $sub_what))) {
-                                                       $content = "<strong>";
+                                       //* DEBUG: */ echo __LINE__.":!!!!".$content['sub_what']."!!!<br />\n";
+                                       $INC = sprintf("inc/modules/%s/what-%s.php", $MODE, $content['sub_what']);
+                                       if (INCLUDE_READABLE($INC)) {
+                                               if ((!empty($wht)) && (($wht == $content['sub_what']))) {
+                                                       $OUT = "<strong>";
                                                }
 
                                                // Navigation link
-                                               $content .= "<a name=\"menu\" class=\"menu_blur\" href=\"{!URL!}/modules.php?module=".$GLOBALS['module']."&amp;what=".$sub_what.ADD_URL_DATA("")."\" target=\"_self\">";
+                                               $OUT .= "<a name=\"menu\" class=\"menu_blur\" href=\"{!URL!}/modules.php?module=".$GLOBALS['module']."&amp;what=".$content['sub_what'].ADD_URL_DATA("")."\" target=\"_self\">";
                                        } else {
-                                               $content .= "<em>";
+                                               $OUT .= "<em>";
                                        }
 
                                        // Menu title
-                                       $content .= getConfig('menu_blur_spacer') . $sub_title;
+                                       $OUT .= getConfig('menu_blur_spacer') . $content['sub_title'];
 
-                                       if (FILE_READABLE($FQFN)) {
-                                               $content .= "</a>";
+                                       if (INCLUDE_READABLE($INC)) {
+                                               $OUT .= "</a>";
                                        } else {
-                                               $content .= "</em>";
+                                               $OUT .= "</em>";
                                        }
 
-                                       if ((!empty($wht)) && (($wht == $sub_what))) {
-                                               $content .= "</strong>";
-                                       }
-                                       $wht = $sub_what; $cnt++;
-                                       // Prepare array
+                                       if ((!empty($wht)) && (($wht == $content['sub_what']))) {
+                                               $OUT .= "</strong>";
+                                       } // END - if
+
+                                       // Remember 'what' for next round and count it up
+                                       $wht = $content['sub_what']; $cnt++;
+
+                                       // Rewrite array
                                        $content =  array(
-                                               'menu' => $content,
-                                               'what' => $sub_what
+                                               'menu' => $OUT,
+                                               'what' => $content['sub_what']
                                        );
 
                                        // Add regular menu row or bottom row?
@@ -438,30 +447,32 @@ function ADD_MENU ($MODE, $act, $wht) {
                        } else {
                                // This is a menu block... ;-)
                                $GLOBALS['block_mode'] = true;
-                               $INC_BLOCK = sprintf("inc/modules/%s/action-%s.php", $MODE, $main_action);
+                               $INC_BLOCK = sprintf("inc/modules/%s/action-%s.php", $MODE, $content['action']);
                                if (FILE_READABLE($INC_BLOCK)) {
                                        // Load include file
-                                       if ((!EXT_IS_ACTIVE($main_action)) || ($main_action == "online")) OUTPUT_HTML("<tr>
+                                       if ((!EXT_IS_ACTIVE($content['action'])) || ($content['action'] == "online")) OUTPUT_HTML("<tr>
 
   <td class=\"".$MODE."_menu_whats\">");
-                                       //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
+                                       //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
                                        LOAD_INC($INC_BLOCK);
-                                       //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
-                                       if ((!EXT_IS_ACTIVE($main_action)) || ($main_action == "online")) OUTPUT_HTML("  </td>
+                                       //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
+                                       if ((!EXT_IS_ACTIVE($content['action'])) || ($content['action'] == "online")) OUTPUT_HTML("  </td>
 </tr>");
                                }
-                               //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
+                               //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
                        }
                        $main_cnt++;
-                       //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
-                       if (SQL_NUMROWS($result_main) > $main_cnt)      OUTPUT_HTML("<tr><td class=\"".$MODE."_menu_seperator\"></td></tr>");
+                       //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
+                       if (SQL_NUMROWS($result_main) > $main_cnt) {
+                               OUTPUT_HTML("<tr><td class=\"".$MODE."_menu_seperator\"></td></tr>");
+                       } // END - if
                }
 
                // Free memory
                SQL_FREERESULT($result_main);
 
                // Close table
-               //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
+               //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
                OUTPUT_HTML("</table>");
        }
 }
@@ -529,53 +540,49 @@ function IS_ADMIN ($admin="") {
 // Generates a list of "max receiveable emails per day"
 function ADD_MAX_RECEIVE_LIST ($MODE, $default = "", $return = false) {
        $OUT = "";
+       $result = false;
+
        switch ($MODE) {
-       case "guest":
-               // Guests (in the registration form) are not allowed to select 0 mails per day.
-               $result = SQL_QUERY("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value > 0 ORDER BY value", __FUNCTION__, __LINE__);
-               if (SQL_NUMROWS($result) > 0) {
-                       $OUT = "";
-                       while (list($value, $comment) = SQL_FETCHROW($result)) {
-                               $OUT .= "      <option value=\"".$value."\"";
-                               if (REQUEST_POST('max_mails') == $value) $OUT .= " selected=\"selected\"";
-                               $OUT .= ">".$value." {--PER_DAY--}";
-                               if (!empty($comment)) $OUT .= " (".$comment.")";
-                               $OUT .= "</option>\n";
-                       }
-                       define('__MAX_RECEIVE_OPTIONS', $OUT);
+               case "guest":
+                       // Guests (in the registration form) are not allowed to select 0 mails per day.
+                       $result = SQL_QUERY("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value > 0 ORDER BY value",
+                               __FUNCTION__, __LINE__);
+                       break;
 
-                       // Free memory
-                       SQL_FREERESULT($result);
-                       $OUT = LOAD_TEMPLATE("guest_receive_table", true);
-               } else {
-                       // Maybe the admin has to setup some maximum values?
-                       debug_report_bug("Nothing is being done here?");
-               }
-               break;
+               case "member":
+                       // Members are allowed to set to zero mails per day (we will change this soon!)
+                       $result = SQL_QUERY("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` ORDER BY value",
+                               __FUNCTION__, __LINE__);
+                       break;
 
-       case "member":
-               // Members are allowed to set to zero mails per day (we will change this soon!)
-               $result = SQL_QUERY("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` ORDER BY value", __FUNCTION__, __LINE__);
-               if (SQL_NUMROWS($result) > 0) {
-                       $OUT = "";
-                       while (list($value, $comment) = SQL_FETCHROW($result)) {
-                               $OUT .= "      <option value=\"".$value."\"";
-                               if ($default == $value) $OUT .= " selected=\"selected\"";
-                               $OUT .= ">".$value." {--PER_DAY--}";
-                               if (!empty($comment)) $OUT .= " (".$comment.")";
-                               $OUT .= "</option>\n";
-                       }
-                       define('__MAX_RECEIVE_OPTIONS', $OUT);
-                       SQL_FREERESULT($result);
-                       $OUT = LOAD_TEMPLATE("member_receive_table", true);
-               } else {
-                       // Maybe the admin has to setup some maximum values?
-                       $OUT = LOAD_TEMPLATE("admin_settings_saved", true, getMessage('NO_MAX_VALUES'));
+               default: // Invalid!
+                       DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid mode %s detected.", $MODE));
+                       break;
+       }
+
+       // Some entries are found?
+       if (SQL_NUMROWS($result) > 0) {
+               $OUT = "";
+               while ($content = SQL_FETCHARRAY($result)) {
+                       $OUT .= "      <option value=\"".$content['value']."\"";
+                       if (REQUEST_POST('max_mails') == $content['value']) $OUT .= " selected=\"selected\"";
+                       $OUT .= ">".$content['value']." {--PER_DAY--}";
+                       if (!empty($content['comment'])) $OUT .= " (".$content['comment'].")";
+                       $OUT .= "</option>\n";
                }
-               break;
+               define('__MAX_RECEIVE_OPTIONS', $OUT);
+
+               // Load template
+               $OUT = LOAD_TEMPLATE($MODE."_receive_table", true);
+       } else {
+               // Maybe the admin has to setup some maximum values?
+               debug_report_bug("Nothing is being done here?");
        }
 
-       if ($return) {
+       // Free result
+       SQL_FREERESULT($result);
+
+       if ($return === true) {
                // Return generated HTML code
                return $OUT;
        } else {
@@ -1226,7 +1233,7 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid
 
                                // Prepare content
                                $content = array(
-                                       'text'   => REASON_DIRECT_PAYMENT,
+                                       'text'   => getMessage('REASON_DIRECT_PAYMENT'),
                                        'points' => TRANSLATE_COMMA($ref_points)
                                );
 
@@ -1234,7 +1241,7 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid
                                $msg = LOAD_EMAIL_TEMPLATE("add-points", $content, $uid);
 
                                // And sent it away
-                               SEND_EMAIL($email, SUBJECT_DIRECT_PAYMENT, $msg);
+                               SEND_EMAIL($email, getMessage('SUBJECT_DIRECT_PAYMENT'), $msg);
                                if (!REQUEST_ISSET_GET(('mid'))) LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_POINTS_ADDED'));
                        }
 
@@ -1301,13 +1308,14 @@ function UPDATE_REF_COUNTER ($uid) {
        } // END - if
 }
 
-// OBSOLETE: Sends out mail to all administrators
+// Sends out mail to all administrators. This function is no longer obsolete
+// because we need it when there is no ext-admins installed
 function SEND_ADMIN_EMAILS ($subj, $msg) {
        // Load all admin email addresses
        $result = SQL_QUERY("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `id` ASC", __FUNCTION__, __LINE__);
-       while (list($email) = SQL_FETCHROW($result)) {
+       while ($content = SQL_FETCHARRAY($result)) {
                // Send the email out
-               SEND_EMAIL($email, $subj, $msg);
+               SEND_EMAIL($content['email'], $subj, $msg);
        } // END - if
 
        // Free result
@@ -1475,7 +1483,7 @@ function ADD_OPTION_LINES ($table, $id, $name, $default="", $special="", $where=
        $ret = "";
        if ($table == "/ARRAY/") {
                // Selection from array
-               if (is_array($id) && is_array($name) && sizeof($id) == sizeof($name)) {
+               if (is_array($id) && is_array($name) && count($id) == count($name)) {
                        // Both are arrays
                        foreach ($id as $idx => $value) {
                                $ret .= "<option value=\"".$value."\"";
@@ -1493,6 +1501,7 @@ function ADD_OPTION_LINES ($table, $id, $name, $default="", $special="", $where=
                        array($id, $ORDER, $table, $name), __FUNCTION__, __LINE__);
                if (SQL_NUMROWS($result) > 0) {
                        // Found data so add them as OPTION lines: $id is the value and $name is the "name" of the option
+                       // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
                        while (list($value, $title, $add) = SQL_FETCHROW($result)) {
                                if (empty($special)) $add = "";
                                $ret .= "<option value=\"".$value."\"";
@@ -1505,15 +1514,15 @@ function ADD_OPTION_LINES ($table, $id, $name, $default="", $special="", $where=
                        SQL_FREERESULT($result);
                } else {
                        // No data found
-                       $ret = "<option value=\"x\">".SELECT_NONE."</option>\n";
+                       $ret = "<option value=\"x\">{--SELECT_NONE--}</option>\n";
                }
        }
 
        // Return - hopefully - the requested data
        return $ret;
 }
-// Activate exchange (DEPERECATED???)
-function activateExchange() {
+// Activate exchange
+function activateExchange () {
        // Check total amount of users
        $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true, " AND max_mails > 0");
 
@@ -1798,21 +1807,24 @@ function ADD_CATEGORY_OPTIONS ($mode) {
        $result = SQL_QUERY("SELECT id, cat FROM `{!_MYSQL_PREFIX!}_cats`".$whereStatement." ORDER BY `sort`", __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // ... and begin loading stuff
-               while (list($id, $cat) = SQL_FETCHROW($result)) {
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Transfer some data
-                       $CATS['id'][]   = $id;
-                       $CATS['name'][] = $cat;
+                       $CATS['id'][]   = $content['id'];
+                       $CATS['name'][] = $content['cat'];
 
                        // Check which users are in this category
                        $result_uids = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE cat_id=%s",
-                        array(bigintval($id)), __FUNCTION__, __LINE__);
+                               array(bigintval($content['id'])), __FUNCTION__, __LINE__);
 
                        // Start adding all
                        $uid_cnt = 0;
+                       // @TODO Rewrite this to $content = SQL_FETCHARRAY()
                        while (list($ucat) = SQL_FETCHROW($result_uids)) {
                                $result_ver = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data`
 WHERE userid=%s AND `status`='CONFIRMED' AND receive_mails > 0".PREPARE_SQL_HTML_HOLIDAY($mode)." LIMIT 1",
- array(bigintval($ucat)), __FUNCTION__, __LINE__);
+                                       array(bigintval($ucat)), __FUNCTION__, __LINE__);
+
+                               // Add user count
                                $uid_cnt += SQL_NUMROWS($result_ver);
 
                                // Free memory
@@ -1824,7 +1836,7 @@ WHERE userid=%s AND `status`='CONFIRMED' AND receive_mails > 0".PREPARE_SQL_HTML
 
                        // Add counter
                        $CATS['uids'][] = $uid_cnt;
-               }
+               } // END - while
 
                // Free memory
                SQL_FREERESULT($result);
@@ -1833,8 +1845,8 @@ WHERE userid=%s AND `status`='CONFIRMED' AND receive_mails > 0".PREPARE_SQL_HTML
                $OUT = "";
                foreach ($CATS['id'] as $key => $value) {
                        if (strlen($CATS['name'][$key]) > 20) $CATS['name'][$key] = substr($CATS['name'][$key], 0, 17)."...";
-                       $OUT .= "      <option value=\"".$value."\">".$CATS['name'][$key]." (".$CATS['uids'][$key]." ".USER_IN_CAT.")</option>\n";
-               }
+                       $OUT .= "      <option value=\"".$value."\">".$CATS['name'][$key]." (".$CATS['uids'][$key]." {--USER_IN_CAT--})</option>\n";
+               } // END - foreach
        } else {
                // No cateogries are defined yet
                $OUT = "<option class=\"member_failed\">{!MEMBER_NO_CATS!}</option>\n";
@@ -1913,6 +1925,7 @@ function GENERATE_RECEIVER_LIST ($cat, $receiver, $mode="") {
        $CAT_TABS     = "%s";
        $CAT_WHERE    = "";
        $receiverList = "";
+       $result       = false;
 
        // Secure data
        $cat      = bigintval($cat);
@@ -1940,19 +1953,19 @@ function GENERATE_RECEIVER_LIST ($cat, $receiver, $mode="") {
        if ((EXT_IS_ACTIVE("html_mail")) && ($mode == "html")) {
                // Only include HTML receivers
                $result = SQL_QUERY_ESC("SELECT d.userid FROM `{!_MYSQL_PREFIX!}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED' AND d.html='Y'".$CAT_WHERE." ORDER BY d.%s %s LIMIT %s",
-                array($cat, getConfig('order_select'), getConfig('order_mode'), $receiver), __FUNCTION__, __LINE__);
+                       array($cat, getConfig('order_select'), getConfig('order_mode'), $receiver), __FUNCTION__, __LINE__);
        } else {
                // Include all
                $result = SQL_QUERY_ESC("SELECT d.userid FROM `{!_MYSQL_PREFIX!}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED'".$CAT_WHERE." ORDER BY d.%s %s LIMIT %s",
-                array($cat, getConfig('order_select'), getConfig('order_mode'), $receiver), __FUNCTION__, __LINE__);
+                       array($cat, getConfig('order_select'), getConfig('order_mode'), $receiver), __FUNCTION__, __LINE__);
        }
 
        // Entries found?
        if ((SQL_NUMROWS($result) >= $receiver) && ($receiver > 0)) {
                // Load all entries
-               while (list($REC) = SQL_FETCHROW($result)) {
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Add receiver when not empty
-                       if (!empty($REC)) $receiverList .= $REC.";";
+                       if (!empty($content['userid'])) $receiverList .= $content['userid'].";";
                } // END - while
 
                // Free memory
@@ -2099,6 +2112,7 @@ function REDUCED_RECIPIENT_RECEIVED_MAILS ($column, $id, $count) {
        // Are there entries?
        if (SQL_NUMROWS($result) > 0) {
                // Now load all userids for one big query!
+               // @TODO This can be somehow rewritten
                $UIDs = array();
                while (list($uid) = SQL_FETCHROW($result)) {
                        $UIDs[$uid] = $uid;
index 939f15ee621cef422f45e09537a31078e9909d41..e36a18adb1723e4058d4c2886e5c2941947bf9dc 100644 (file)
@@ -38,10 +38,10 @@ if (!defined('__SECURITY')) {
 }
 
 // Check for patch level differences between databases and current hard-coded
-if ((CURR_SVN_REVISION > getConfig('patch_level')) || (getConfig('patch_level') == "CURR_SVN_REVISION") || (getConfig('patch_ctime') == "UNIX_TIMES")) {
+if ((constant('CURR_SVN_REVISION') > getConfig('patch_level')) || (getConfig('patch_level') == "CURR_SVN_REVISION") || (getConfig('patch_ctime') == "UNIX_TIMES")) {
        // Update database and CONFIG array
-       UPDATE_CONFIG(array("patch_level", "patch_ctime"), array(CURR_SVN_REVISION, "UNIX_TIMESTAMP()"));
-       setConfigEntry('patch_level', CURR_SVN_REVISION);
+       UPDATE_CONFIG(array("patch_level", "patch_ctime"), array(constant('CURR_SVN_REVISION'), "UNIX_TIMESTAMP()"));
+       setConfigEntry('patch_level', constant('CURR_SVN_REVISION'));
        setConfigEntry('patch_ctime', time());
 } // END - if
 
index 8c8e53fd4e94c4b3f24679073b60288a9b39adfd..848f0f96f6eefbeeadba7b9e50d3cc837a65a439 100644 (file)
@@ -288,7 +288,7 @@ if (SQL_NUMROWS($result_main) > 0) {
        }
 
        // Do we have points to "pay back"?
-       if ((sizeof($pointsBack) > 0) && (!empty($pointsBack[0]))) {
+       if ((count($pointsBack) > 0) && (!empty($pointsBack[0]))) {
                // Walk through all points
                foreach ($pointsBack as $uid => $PB) {
                        // Add points only when we have points left to add and a valid user ID
index 293a6bf05b4a8c1b61c95745e2d5e0ac767a6f4a..461fc4e19ae128709b42ee75b03197eac4aea027 100644 (file)
@@ -56,40 +56,45 @@ if (GET_EXT_VERSION("order") >= "0.1.1") {
 $result_daily = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE ref_payout=0 AND `status`='CONFIRMED' ORDER BY userid", __FILE__, __LINE__);
 
 //* DEBUG: */ echo basename(__FILE__).":payout=0;daily|numRows=".SQL_NUMROWS($result_daily)."<br />\n";
-if (SQL_NUMROWS($result_daily) > 0)
-{
+if (SQL_NUMROWS($result_daily) > 0) {
+       // Init SQLs
+       INIT_SQLS();
+
        // Start checking accounts which are on 0 confirmed-to-go mails
-       while (list($uid) = SQL_FETCHROW($result_daily))
-       {
-               //* DEBUG: */ echo basename(__FILE__).":uid={$uid}<br />\n";
+       while ($content = SQL_FETCHARRAY($result_daily)) {
+               //* DEBUG: */ echo basename(__FILE__).":uid={$content['userid']}<br />\n";
                $result_points = SQL_QUERY_ESC("SELECT ref_depth, locked_points FROM `{!_MYSQL_PREFIX!}_user_points`
 WHERE userid=%s AND locked_points != 0.00000 ORDER BY ref_depth",
-                array(bigintval($uid)), __FILE__, __LINE__);
+                       array(bigintval($content['userid'])), __FILE__, __LINE__);
+
                //* DEBUG: */ echo basename(__FILE__).":payout=0;points|numRows=".SQL_NUMROWS($result_points)."<br />\n";
-               if (SQL_NUMROWS($result_points) > 0)
-               {
+               if (SQL_NUMROWS($result_points) > 0) {
                        // Ok transfer points
-                       while (list($dep, $locked) = SQL_FETCHROW($result_points))
-                       {
-                               //* DEBUG: */ echo basename(__FILE__).":uid={$uid},depth={$dep},locked={$locked}<br />\n";
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_points` SET points=points+%s, locked_points=0.00000
+                       while ($content2 = SQL_FETCHARRAY($result_points)) {
+                               // Merge both arrays
+                               $content = merge_array($content, $content2);
+
+                               //* DEBUG: */ echo basename(__FILE__).":uid={$content['userid']},depth={$content['ref_depth']},locked={$content['locked_points']}<br />\n";
+                               ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_points` SET points=points+%s, locked_points=0.00000
 WHERE userid=%s AND ref_depth=%d
 LIMIT 1",
-                                array($locked, bigintval($uid), $dep), __FILE__, __LINE__);
+                                       array($content['locked_points'], bigintval($content['userid']), $content['ref_depth']), __FILE__, __LINE__, false));
 
                                // Update mediadata as well
-                               if (GET_EXT_VERSION("mediadata") >= "0.0.4")
-                               {
+                               if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
                                        // Update database
-                                       MEDIA_UPDATE_ENTRY(array("total_points"), "add", $locked);
-                               }
-                       }
-               }
+                                       MEDIA_UPDATE_ENTRY(array("total_points"), "add", $content['locked_points']);
+                               } // END - if
+                       } // END - while
+               } // END - if
 
                // Free memory
                SQL_FREERESULT($result_points);
-       }
-}
+       } // END - while
+
+       // Run all SQLs
+       runFilterChain('run_sqls');
+} // END - if
 
 // Free memory
 SQL_FREERESULT($result_daily);
index 741ebe3110a3d0d92f7ca7ba2f2e0ece6440db35..86e97220ad337179227bb551a5598d63b33629be 100644 (file)
@@ -44,41 +44,54 @@ if (($GLOBALS['output_mode'] == 1) || ((!isResetModeEnabled()) && (getConfig('ho
 //* DEBUG: */ echo basename(__FILE__)."<br />\n";
 
 // Check for holidays we need to enable and send email to user
-$result_main = SQL_QUERY("SELECT userid, holiday_activated FROM `{!_MYSQL_PREFIX!}_user_data`
+$result_main = SQL_QUERY("SELECT userid, holiday_activated
+FROM `{!_MYSQL_PREFIX!}_user_data`
 WHERE holiday_activated > 0 AND holiday_activated < UNIX_TIMESTAMP() AND holiday_active='N'
-ORDER BY holiday_activated", __FILE__, __LINE__);
+ORDER BY holiday_activated",
+       __FILE__, __LINE__);
+
+// Entries found?
 if (SQL_NUMROWS($result_main) > 0) {
+       // Init SQLs
+       INIT_SQLS();
+
        // We have found at least one useraccount so let's check it...
-       while (list($uid, $activated) = SQL_FETCHROW($result_main)) {
+       while ($content = SQL_FETCHARRAY($result_main)) {
                // Check if his holiday can be activated
-               $result_holiday = SQL_QUERY_ESC("SELECT holiday_start, holiday_end FROM `{!_MYSQL_PREFIX!}_user_holidays`
-WHERE userid=%s AND holiday_start <= UNIX_TIMESTAMP() AND holiday_end > UNIX_TIMESTAMP() LIMIT 1",
- array(bigintval($uid)), __FILE__, __LINE__);
-               if (SQL_NUMROWS($result_holiday) == 1)
-               {
+               $result_holiday = SQL_QUERY_ESC("SELECT holiday_start, holiday_end
+FROM `{!_MYSQL_PREFIX!}_user_holidays`
+WHERE userid=%s AND holiday_start <= UNIX_TIMESTAMP() AND holiday_end > UNIX_TIMESTAMP()
+LIMIT 1",
+                       array(bigintval($content['userid'])), __FILE__, __LINE__);
+               if (SQL_NUMROWS($result_holiday) == 1) {
                        // Okay, this user can be send away to holiday...
-                       list($start, $end) = SQL_FETCHROW($result_holiday);
+                       $content = merge_array($content, SQL_FETCHARRAY($result_holiday));
 
                        // Prepare all data for the template
                        $content = array(
-                               'activated' => MAKE_DATETIME($activated, "1"),
-                               'start'     => MAKE_DATETIME($start    , "1"),
-                               'end'       => MAKE_DATETIME($end      , "1")
+                               'activated' => MAKE_DATETIME($content['holiday_activated'], "1"),
+                               'start'     => MAKE_DATETIME($content['holiday_start']    , "1"),
+                               'end'       => MAKE_DATETIME($content['holiday_end']      , "1")
                        );
 
                        // Send email to user
-                       $msg = LOAD_EMAIL_TEMPLATE("member_holiday_activated", $content, $uid);
-                       SEND_EMAIL($uid, HOLIDAY_MEMBER_ACTIVATED, $msg);
+                       $msg = LOAD_EMAIL_TEMPLATE("member_holiday_activated", $content, $content['userid']);
+                       SEND_EMAIL($content['userid'], getMessage('HOLIDAY_MEMBER_ACTIVATED_SUBJ'), $msg);
 
                        // Update account
-                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET holiday_active='Y'
+                       ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
+SET holiday_active='Y'
 WHERE userid=%s
-LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__);
-               }
+LIMIT 1",
+                               array(bigintval($content['userid'])), __FILE__, __LINE__, false));
+               } // END - if
 
                // Free memory
                SQL_FREERESULT($result_holiday);
-       }
+       } // END - while
+
+       // Run all SQLs
+       runFilterChain('run_sqls');
 }
 
 // Free memory
index 4ac542e47c092ea045ad550f564b02ffae31dc5e..7fbd2b7b9bf4367e90f346e82640bd862b8c07d3 100644 (file)
@@ -61,6 +61,6 @@ echo "<html>
 </div>
 </body>
 </html>\n";
-exit();
+exit;
 //
 ?>
index fd9e7a3e403a9cea18351bb360162379d7d18b72..db3f241983b8ad3053cd5d1ec64e5bb64a02a685 100644 (file)
@@ -48,27 +48,22 @@ if (SQL_NUMROWS($result_bonus) > 0) {
        define('__STATS_BONUS', TRANSLATE_COMMA(getConfig('bonus_stats')));
 
        // We found some mail orders...
-       while (list($id, $uid, $subj, $stamp, $clicks, $url) = SQL_FETCHROW($result_bonus)) {
+       while ($content = SQL_FETCHARRAY($result_bonus)) {
                // Add points
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET bonus_stats=bonus_stats+%s WHERE userid=%s LIMIT 1",
-                       array(getConfig('bonus_stats'), bigintval($uid)), __FILE__, __LINE__);
+                       array(getConfig('bonus_stats'), bigintval($content['userid'])), __FILE__, __LINE__);
 
-               // Prepare array
-               $content = array(
-                       'subject'   => $subj,
-                       'timestamp' => MAKE_DATETIME($stamp, "2"),
-                       'clicks'    => $clicks,
-                       'url'       => $url
-               );
+               // Translate some data
+               $content['timestamp'] MAKE_DATETIME($content['timestamp_ordered'], "2");
 
                // Load email template and send email
-               $msg = LOAD_EMAIL_TEMPLATE("member_stats_bonus", $content, bigintval($uid));
-               SEND_EMAIL($uid, BONUS_MEMBER_STATS_SUBJECT, $msg);
+               $msg = LOAD_EMAIL_TEMPLATE("member_stats_bonus", $content, bigintval($content['userid']));
+               SEND_EMAIL($content['userid'], getMessage('BONUS_MEMBER_STATS_SUBJECT'), $msg);
 
                // Update database
-               $result_update =  SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET bonus_stats_active='Y' WHERE id=%s LIMIT 1",
-                       array(bigintval($id)), __FILE__, __LINE__);
-       }
+               $result_update = SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET bonus_stats_active='Y' WHERE id=%s LIMIT 1",
+                       array(bigintval($content['id'])), __FILE__, __LINE__);
+       } // END - while
 
        // Handle bonus points
        BONUS_POINTS_HANDLER(getConfig('bonus_stats'));
diff --git a/templates/de/html/admin/admin_config_home_row.tpl b/templates/de/html/admin/admin_config_home_row.tpl
new file mode 100644 (file)
index 0000000..a48ef35
--- /dev/null
@@ -0,0 +1,7 @@
+<tr>
+  <td class="switch_sw$content[sw] bottom right">&nbsp;$content[id]</td>
+  <td class="switch_sw$content[sw] bottom right">&nbsp;$content[title]</td>
+  <td class="switch_sw$content[sw] bottom" align="center">
+    $content[link]
+  </td>
+</tr>
index f19f41ad5067e61ee3bd7f0adc74bdfa63a739a5..9d9347ebfa3e0da69ec3605a56bfe63ff85541d3 100644 (file)
@@ -1,6 +1,7 @@
 <table border="0" cellspacing="0" cellpadding="0" class="admin_table dashed">
 <tr>
-       <td colspan="4" align="center" class="admin_title" height="30"><strong>{--RALLYE_LIST_USERS_1--}{!__RALLYE_VALUE!}{--RALLYE_LIST_USERS_2--}:</strong>
+       <td colspan="4" align="center" class="admin_title" height="30">
+               <strong>{--RALLYE_LIST_USERS_1--}{!__RALLYE_VALUE!}{--RALLYE_LIST_USERS_2--}:</strong>
        </td>
 </tr>
 <tr>
index 7aaf8b25a74cc57d018c0d4b6d9dfc7d9c3f7b75..7e7a4f6eaaac2d515beb0c99e5fa956709e8c237 100644 (file)
@@ -1,6 +1,8 @@
 <tr>
        <td class="switch_sw$content[sw] bottom2 right2">
-       &nbsp;$content[title] ($content[action])</td>
+               &nbsp;$content[title] ($content[action])
+       </td>
        <td class="switch_sw$content[sw] bottom2" align="center">
-       $content[clicks]</td>
+               $content[counter]
+       </td>
 </tr>
index f2ef10603a2cab5e2a8f31638dc1bfa3a6f5700b..20c135656bae26a3cde1fddc5c10f4ae209369ea 100644 (file)
@@ -1,6 +1,8 @@
 <tr>
        <td class="switch_sw$content[sw] bottom2 right2">
-       &nbsp;$content[title] ($content[mod])</td>
+               &nbsp;$content[title] ($content[module])
+       </td>
        <td class="switch_sw$content[sw] bottom2" align="center">
-       $content[clicks]</td>
+               $content[clicks]
+       </td>
 </tr>
index 9613bbf96147862dad555627063981fb9f920afc..86288a758cadc2d6e6374f0300a75fa22a60a6ff 100644 (file)
@@ -13,7 +13,7 @@
   <td align="center" class="bottom2" style="padding-top:15px; padding-bottom: 15px">
     {--GUEST_SPONSOR_PRICING_HEADER--}<br />
     <table border="0" cellspacing="0" cellpadding="0" class="guest_table dashed" width="450">
-{!__SPONSOR_PAYTYPES!}
+$content[paytypes]
     <tr><td colspan="2" class="guest_title2 seperator" height="29">&nbsp;</td></tr>
     </table>
   </td>
@@ -26,7 +26,7 @@
         <strong>{--GUEST_SPONSOR_ACTIONS_HEADER--}</strong>
       </td>
     </tr>
-{!__SPONSOR_ACTIONS!}
+$content[actions]
     <tr><td colspan="2" class="guest_title2 seperator" height="29">&nbsp;</td></tr>
     </table>
   </td>
diff --git a/templates/de/html/guest/guest_sponsor_infos_none_row.tpl b/templates/de/html/guest/guest_sponsor_infos_none_row.tpl
new file mode 100644 (file)
index 0000000..ee518ff
--- /dev/null
@@ -0,0 +1,5 @@
+<tr>
+  <td colspan="2>
+    $content
+  </td>
+</tr>
diff --git a/templates/de/html/guest/guest_sponsor_payment_row.tpl b/templates/de/html/guest/guest_sponsor_payment_row.tpl
new file mode 100644 (file)
index 0000000..a33af55
--- /dev/null
@@ -0,0 +1,6 @@
+<tr>
+  <td class="bottom2 switch_sw$content[sw]" height="50" style="padding-left: 2px; padding-right: 2px">
+    <input type="radio" name="pay_type" class="guest_normal" value="$content[id]" />&nbsp;$content[pay_name]<br />
+    <div align="right">($content[pay_min_count] $content[pay_currency] = $content[res] {!POINTS!})</div>
+  </td>
+</tr>
diff --git a/templates/de/html/member/member_transfer_row.tpl b/templates/de/html/member/member_transfer_row.tpl
new file mode 100644 (file)
index 0000000..c71fe39
--- /dev/null
@@ -0,0 +1,17 @@
+<tr>
+  <td class="transfer_row1 switch_sw$content[sw] bottom2 right2">
+    <div class="transfer_row1">$content[trans_id]</div>
+  </td>
+  <td class="transfer_row2 switch_sw$content[sw] bottom2 right2">
+    <div class="transfer_row2">$content[time]</div>
+  </td>
+  <td class="transfer_row3 switch_sw$content[sw] bottom2 right2">
+    <div class="transfer_row3">$content[party_uid]</div>
+  </td>
+  <td class="transfer_row4 switch_sw$content[sw] bottom2 right2">
+    <div class="transfer_row4">$content[reason]</div>
+  </td>
+  <td class="transfer_row5 switch_sw$content[sw] bottom2">
+    <div class="transfer_row5">$content[points]</div>
+  </td>
+</tr>
diff --git a/templates/de/html/member/member_transfer_row2.tpl b/templates/de/html/member/member_transfer_row2.tpl
new file mode 100644 (file)
index 0000000..4b7087a
--- /dev/null
@@ -0,0 +1,17 @@
+<tr>
+  <td class="transfer_row1 switch_sw".$content[sw] bottom2 right2">
+    <div class="transfer_row1">$content[tid]</div>
+  </td>
+  <td class="transfer_row2 switch_sw".$content[sw] bottom2 right2">
+    <div class="transfer_row2">$content[stamp]</div>
+  </td>
+  <td class="transfer_row3 switch_sw".$content[sw] bottom2 right2">
+    <div class="transfer_row3">$content[uid]</div>
+  </td>
+  <td class="transfer_row4 switch_sw".$content[sw] bottom2 right2">
+    <div class="transfer_row4">$content[reason]</div>
+  </td>
+  <td class="transfer_row5 switch_sw".$content[sw] bottom2">
+    <div class="transfer_row5">$content[points]</div>
+  </td>
+</tr>
index 07729d82fac488f3366554d2420810e07361aad7..704d93be6d90c053d2099ae3f6e30a249e619935 100644 (file)
@@ -1,6 +1,7 @@
 <table border="0" cellspacing="0" cellpadding="0" class="theme_box">
        <tr>
                <td align="center" class="theme_content">
-               {!__THEME_SELECTION_CONTENT!}</td>
+                       $content
+               </td>
        </tr>
 </table>
index bf57dcf32f45a1898eda792e7183538354f6947e..25b7c4619e104ac2665fc9a9191966e64bd0b8e3 100644 (file)
@@ -1,6 +1,7 @@
-<form action="{!__FORM_VALUE!}" method="POST" style="margin-bottom: 0px">
-<select name="new_theme" class="guest_select">
-       {!__THEME_SELECTION_OPTIONS!}
-</select> <br />
-<input type="submit" name="ok" class="guest_submit"
-       value="{--CHANGE_THEME--}" /></form>
+<form action="$content[form_action]" method="POST" style="margin-bottom: 0px">
+       <select name="new_theme" class="guest_select">
+               $content[selection]
+       </select>
+       <br />
+       <input type="submit" name="ok" class="guest_submit" value="{--CHANGE_THEME--}" />
+</form>