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
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
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
### 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
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
* 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");
// 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");
}
if ((getConfig('auto_purge_active') == "Y") && (getConfig('auto_purge') > 0)) {
+ // Init SQLs
+ INIT_SQLS();
+
// First calculate the timestamp
$PURGE = getConfig('auto_purge');
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
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
// 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
//
// 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'));
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
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
// 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
//
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",
// 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) ...
// 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) ...
// 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
}
//
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
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
// 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
// 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));
// Init variable
$query = "failed";
- if ($strip) {
+ if ($strip === true) {
$strip = "true";
} else {
$strip = "false";
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);
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;
// 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
$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];
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") {
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);
}
// 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
// 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 {
// 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
LOAD_TEMPLATE("redirect_url", false, str_replace("&", "&", $URL));
LOAD_INC("inc/footer.php");
}
- exit();
+ exit;
}
// Wrapper for LOAD_URL but URL comes from a configuration entry
// 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__);
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
$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
}
} 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
// Load navigation template
$OUT = LOAD_TEMPLATE("admin_email_nav_row", true);
- if ($return) {
+ if ($return === true) {
// Return generated HTML-Code
return $OUT;
} else {
fputs($fp, $request);
// Read response
- while(!feof($fp)) {
+ while (!feof($fp)) {
$response[] = trim(fgets($fp, 1024));
} // END - while
}
// Taken from www.php.net eregi() user comments
-function VALIDATE_EMAIL($email) {
+function VALIDATE_EMAIL ($email) {
// Compile email
$email = COMPILE_CODE($email);
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);
}
}
// 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 = "";
// 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
define('POINTS_REF', "Einmalige Referal-Gutschrift");
define('EDIT_REGFORM_SETTINGS', "Einstellungen am Anmeldeformular");
define('LEAST_CATS', "Mindestens auszuwählende Kategorieanzahl");
-define('CATS_LEAST', "Bitte wählen Sie mehr Kategorien aus! Minimum ist");
+define('CATS_LEAST', "Bitte wä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örter bei der Anmeldung ablehnen? (Wird nicht angezeigt!)");
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öher wird benötigt!");
+define('ADMIN_EXT_BONUS_OUTDATED', "Ihre Bonus-Erweiterung ist veraltet! Version <u>%s</u> oder höher wird benötigt!");
define('ADMIN_EXT_BONUS_404', "bonus nicht installiert!");
define('ADMIN_EXT_CSSFILE', "CSS?");
define('ADMIN_EXT_CHANGED', "Erweiterungen geändert.");
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!)");
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");
//
?>
define('RALLYE_EDIT_ONLY_INACTIVE_NOTE', "Es können nur deaktivierte Rallyes bearbeitet bzw. gelöscht werden. Beim Löschen werden alle dazu verknüpften Daten ebenfalls ohne Vorwarnung gelöscht.");
define('RALLYE_DELETE_NOTHING_SELECTED', "Keine Rallye(s) zum Löschen ausgewählt!");
define('RALLYE_DELETED', "Rallye(s) wurde(n) gelöscht.");
-define('RALLYE_MEMBER_NO_PRICES', "--> Keine Preise ausgesetzt! <--");
+define('RALLYE_MEMBER_NO_PRICES', "--> Keine Preise fü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ählten Rallye sind noch keine Mitglieder hinzugefü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");
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ö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ühren Sie ggf. weitere Schritte durch!");
define('RALLYE_ADMIN_PURGED_TEXT', "Eine oder mehr Referal-Rallye(s) ist/sind gelöscht worden.");
define('RALLYE_EDIT_RALLYES', "Rallye-Grunddaten ändern");
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ö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ändern.");
define('RALLYE_MIN_USERS', "Gesamtzahl der Mitglieder, ab der Rallye automatisch endet.");
define('RALLYE_MIN_PRICES', "Mindestens zu belegende Plätze");
define('RALLYE_MIN_PRICES_MINI', "Minimum Plä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änkungen an der Dauer der Rallye");
define('RALLYE_REMOVE_PRICES', "Rallye-Preis(e) entfernen");
define('RALLYE_NO_TEMPLATES_FOUND', "Keine Templates gefunden!");
define('ADMIN_TEXT_DEL_SPONSOR_2', "</strong> mit samt aller seiner Bestellungen unwiederruflich lö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ür Ihr Geld die Zielgruppe, die Sie auch auf Ihren Produktseiten haben wollen!");
define('GUEST_SPONSOR_TEASER_2', "Alles inklusiv: Ausführliche Statistiken (auch per Mail im gewü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!");
define('SPONSOR_PAYTYPE_RATE_NOTE', "Wie viele {!POINTS!} soll der Sponsor für z.B. 1 € 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ährung des Geldbetrages, die der Sponsor an Sie ü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ügt.");
+define('ADMIN_SPONSOR_PAYTYPE_ALREADY', "Buchungspaket <u>%s</u> bereits eingerichtet.");
+define('ADMIN_SPONSOR_PAYTYPE_ADDED', "Buchungspaket <u>%s</u> hinzugefügt.");
define('SPONSOR_LIST_PAYMENT_TYPES_TITLE', "Buchungspakete auflisten, bearbeiten und löschen");
define('SPONSOR_PAYTYPE_MIN_COUNT2', "Minium");
define('ADMIN_SPONSOR_PAYTYPE_EDIT', "Bearbeiten");
// Sponsor area
define('SPONSOR_NO_MAIN_MENUS_ACTIVE', "Keine Hauptmenüs aktiviert!");
define('SPONSOR_NO_SUB_MENUS_ACTIVE', "Keine Untermenü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 ändern, geben Sie Ihr aktuelles Passwort unter "{--SPONSOR_ENTER_OLD_PASSWORD--}" ein. Wollen Sie Ihr Passwort ändern, geben Sie Ihr derzeiges und zweimal das neue Passwort ein.");
define('SPONSOR_POINTS_OVERVIEW', "Ihre {!POINTS!}-Übersicht");
$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);
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);
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');
$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",
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,
);
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);
//
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
<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&what=payout&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&what=payout&payout=".$content['id']."\">".$content['type']." ({--PAYOUT_MAX--} ".round($P)." ".$content['type'].")</a></strong></li>");
+ } // END - if
+ } // END - while
OUTPUT_HTML("</ul></div>");
} else {
$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);
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);
// 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
// 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
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;
// 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);
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(
'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);
// 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
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 = "";
// 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
}
$DATA['infos'] = $DATA['info'];
} else {
// Take points
- $DATA['infos'] = $DATA['points']." ".POINTS;
+ $DATA['infos'] = $DATA['points']." {!POINTS!}";
}
// Add suffix to template name
// 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
}
// 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(),
// 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);
// 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)
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
else
{
// Take ppints
- $DATA['infos'][$idx] = $DATA['points'][$idx]." ".POINTS;
+ $DATA['infos'][$idx] = $DATA['points'][$idx]." {!POINTS!}";
}
// Add row
// And finnally return the output
return $OUT;
}
+
//
-function RALLYE_DELETE_EXPIRED_RALLYES()
-{
+function RALLYE_DELETE_EXPIRED_RALLYES () {
global $DATA;
// Check for expired rallyes
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);
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
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!)
$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;
// 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",
// 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
//* 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
}
// 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;
}
//
-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\\\"> (*)</div>";
- $eval = "define('MUST_".strtoupper($name)."', \"".$value."\");";
+ if ($content['field_required'] == "Y") $value = "<div class=\\\"guest_failed\\\"> (*)</div>";
+ // @TODO Rewrite these constants
+ $eval = "define('MUST_".strtoupper($content['field_name'])."', \"".$value."\");";
eval($eval);
} // END - while
define('MUST_BIRTH' , "<div class=\"guest_failed\"> (*)</div>");
define('MUST_MARKER', "<div class=\"guest_failed\"> (*)</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
$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 = "";
// 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\"";
$OUT .= LOAD_TEMPLATE("admin_settings_saved", true, getMessage('NO_CATEGORIES_VISIBLE'));
}
- if ($return) {
+ if ($return === true) {
// Return generated HTML code
return $OUT;
} else {
if (IS_ADMIN()) $WHERE = "";
// Load main menu entries
- $result_main = SQL_QUERY("SELECT action, title 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 what, title 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
// 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
// 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)) {
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
'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']))) {
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
// 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']))) {
// 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);
SEND_EMAIL($content['email'], getMessage('SPONSOR_SETTINGS_SUBJ'), $email_msg);
break;
}
- }
- }
- }
+ } // END - if
+ } // END - if
+ } // END - if
// Return final message
return $MSG;
}
// 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
__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
// 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
// Init variables/arrays
$EXTRAS = "";
$OUT = "";
- INIT_SQLS();
$WHATs = array();
$DESCRs = array();
$TITLEs = array();
// 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'");
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>");
}
//
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'));
}
} // 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')."";
//
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) {
// 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&what=".$WHATs[$key]."\" title=\"".$TITLEs[$key]."\">".$value."</a>";
$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);
}
+
//
?>
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 .= "&action=".$act;
- if (!empty($wht)) $FORM .= "&what=".$wht;
- define('__FORM_VALUE', $FORM);
+ $formAction = "{!URL!}/modules.php?module=".$mod;
+ if (!empty($act)) $formAction .= "&action=".$act;
+ if (!empty($wht)) $formAction .= "&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
if (REQUEST_ISSET_GET(('mode'))) $ADD .= "&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)) {
// Load template
$OUT = LOAD_TEMPLATE("admin_list_user_alpha", true);
- if ($return) {
+ if ($return === true) {
// Return generated code
return $OUT;
} else {
}
// 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);
elseif (REQUEST_ISSET_GET(('mode'))) $ADD .= "&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) {
// Load template
$OUT = LOAD_TEMPLATE("admin_list_user_sort", true);
- if ($return) {
+ if ($return === true) {
// Return code
return $OUT;
} else {
}
// 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\"> </td></tr>");
if (!$show_form) {
// Add line with bottom border
- define('__FORM_FOOTER', "<tr><td colspan=\"".__COLSPAN2."\" class=\"seperator bottom2\"> </td></tr>");
+ define('__FORM_FOOTER', "<tr><td colspan=\"{!__COLSPAN2!}\" class=\"seperator bottom2\"> </td></tr>");
} else {
// Add line without bottom border
- define('__FORM_FOOTER', "<tr><td colspan=\"".__COLSPAN2."\" class=\"seperator bottom2\"> </td></tr>");
+ define('__FORM_FOOTER', "<tr><td colspan=\"{!__COLSPAN2!}\" class=\"seperator bottom2\"> </td></tr>");
}
$OUT = "";
// Load template
$OUT = LOAD_TEMPLATE("admin_list_user_pagenav", true);
- if ($return) {
+ if ($return === true) {
// Return code
return $OUT;
} else {
$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")) {
// 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();
// 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
$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
} // 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();
}
// Init filter system
INIT_FILTER_SYSTEM();
- if ($GLOBALS['cacheMode'] == "init") {
+ if ($GLOBALS['cache_mode'] == "init") {
// Close cache file
$GLOBALS['cache_instance']->finalize();
$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
$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');
$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);
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);
$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');
$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);
destroyAdminSession(false);
// Do registration
- $ret = REGISTER_ADMIN(REQUEST_POST('login'), $hashedPass);
+ $ret = REGISTER_ADMIN(REQUEST_POST('login'), $hashedPass, constant('WEBMASTER'));
switch ($ret)
{
case "done":
}
// 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__);
// Return result
return $ret;
}
+
// Only be executed on login procedure!
function CHECK_ADMIN_LOGIN ($admin_login, $password) {
// By default no admin is found
// 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 = "";
$GLOBALS['menu']['description'] = unserialize(base64_decode($data['descr'][0]));
// Return or output content?
- if ($return) {
+ if ($return === true) {
return $OUT;
} else {
OUTPUT_HTML($OUT);
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\"> </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, "");
<td width=\"10\" class=\"seperator\"> </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);
} // 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
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\"";
// 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)) {
} // 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)) {
// 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
// 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);
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
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");
if (!empty($id)) {
// Reload to prices...
- LOAD_URL("modules.php?module=admin&what=config_rallye_prices&rallye=".$id);
+ LOAD_URL("modules.php?module=admin&what=config_rallye_prices&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'));
}
}
// 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)
{
}
$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;
}
}
}
$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&what=adminedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort+1)."&fid=".$sort."\">{--LOWER--}</a>";
+ $content['navi'] = "<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub={!__SUB_VALUE!}&act=".$content['action']."&w=".$content['what']."&tid=".($content['sort']+1)."&fid=".$content['sort']."\">{--LOWER--}</a>";
} elseif ($cnt == $max) {
// Is lowest position
- $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort-1)."&fid=".$sort."\">{--HIGHER--}</a>";
- } elseif ($sort > 0) {
+ $content['navi'] = "<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub={!__SUB_VALUE!}&act=".$content['action']."&w=".$content['what']."&tid=".($content['sort']-1)."&fid=".$content['sort']."\">{--HIGHER--}</a>";
+ } elseif ($content['sort'] > 0) {
// Anything else between highest and lowest
- $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort-1)."&fid=".$sort."\">{--HIGHER--}</a>/<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort+1)."&fid=".$sort."\">{--LOWER--}</a>";
+ $content['navi'] = "<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub={!__SUB_VALUE!}&act=".$content['action']."&w=".$content['what']."&tid=".($content['sort']-1)."&fid=".$content['sort']."\">{--HIGHER--}</a>/<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub={!__SUB_VALUE!}&act=".$content['action']."&w=".$content['what']."&tid=".($content['sort']+1)."&fid=".$content['sort']."\">{--LOWER--}</a>";
}
- if (empty($act)) $act = " ";
- if (empty($wht)) $wht = " ";
- if (empty($title)) $title = " ";
+ // Fix empty elements for constant (fixes display bugs in Firefox)
+ if (empty($content['action'])) $content['action'] = " ";
+ if (empty($content['what'])) $content['what'] = " ";
+ if (empty($content['title'])) $content['title'] = " ";
- $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
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)) {
// 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
'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;
$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
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(
// Free result
SQL_FREERESULT($result);
+
+ // @TODO Rewrite this constant
define('__MAILS_ROWS', $OUT);
// Load template
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
}
// Remember rows
+ // @TODO Rewrite this constant
define('__REG_ROWS', $OUT);
// Load main template
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",
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",
} 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
}
} 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",
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
// 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);
// 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
}
} 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
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",
// 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);
// Load main template
LOAD_TEMPLATE("admin_config_email");
- }
+ } // END - if
// Display form
LOAD_TEMPLATE("admin_add_max");
// 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&what=config_home&sub=settings\">".ADMIN_CONTINUE_TO_CONFIG."</a>");
+ OUTPUT_HTML("<a href=\"{!URL!}/modules.php?module=admin&what=config_home&sub=settings\">{--ADMIN_CONTINUE_TO_CONFIG--}</a>");
} else {
// Prepare data for the template
$content = array_fill(-1, 60, "");
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&what=config_home&sub=target&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&what=config_home&sub=target&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\"> ".$id."</td>
- <td class=\"switch_sw".$SW." bottom right\"> ".$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);
// Load template
LOAD_TEMPLATE("admin_config_home");
break;
+
+default: // Output selection table
+ LOAD_TEMPLATE("admin_config_home_main");
+ break;
+
}
//
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),
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'));
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&what=stats_mods&mod=".$mod."\">".$mod."</a></strong>";
+ $content['module'] = "<strong><a href=\"{!URL!}/modules.php?module=admin&what=stats_mods&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
// Free memory
SQL_FREERESULT($result);
+
+ // @TODO Rewrite this constant
define('__MODS_ROWS', $OUT);
// Load main template
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
// 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,
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);
$OUT .= LOAD_TEMPLATE("admin_config_payouts_edit_row", true, $content);
$SW = 3 - $SW;
}
+
+ // @TODO Rewrite this constant
define('__PAYOUT_ROWS', $OUT);
// Load main template
} 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);
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
// Free memory
SQL_FREERESULT($result_type);
+
+ // @TODO Rewrite this constant
define('__PAYOUT_ROWS', $OUT);
// Load main template
// 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__);
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__);
$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
} 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')
);
// 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')",
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'))) {
}
// 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
}
// 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')) {
$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",
// 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&what=config_rallye_prices&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&what=config_rallye_prices&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);
// 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&what=config_rallye_prices&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
$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
// 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'));
}
}
//
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\"> ".$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\"> ".$content['field_name']."</td>
+ <td align=\"center\" class=\"switch_sw".$content['sw']." bottom2 right2\">
+ ".$content['selection']."
</td>
</tr>\n";
+
+ // Switch color
$SW = 3 - $SW;
}
SQL_FREERESULT($result);
// Remember rows in constant
+// @TODO Rewrite this constant
define('__REGISTER_ROWS', $OUT);
// Load template
// 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 = "";
}
// 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);
// Free memory
SQL_FREERESULT($result);
+
+ // @TODO Rewrite this constant
define('__MODULE_ROWS', $OUT);
// Load main template
LOAD_TEMPLATE("admin_config_rewrite");
}
+
//
?>
************************************************************************/
// 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);
}
// 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."\" /> * <input type=\"submit\" name=\"del\" class=\"admin_delete\" value=\"".TRANSFER_DELETE."\" />");
+define('__TRANSFER_DELETE', "<input type=\"reset\" class=\"admin_reset\" value=\"{--UNDO_SELECTIONS--}\" /> * <input type=\"submit\" name=\"del\" class=\"admin_delete\" value=\"{--TRANSFER_DELETE--}\" />");
// Load final template
LOAD_TEMPLATE("admin_list_transfer");
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>");
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);
), __FILE__, __LINE__);
if (SQL_AFFECTEDROWS() == 1) {
- $content = SETTINGS_SAVED;
+ $content = getMessage('SETTINGS_SAVED');
} else {
$content = "<span class=\"admin_failed\">{--SETTINGS_NOT_SAVED--}</span>";
}
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
// Free memory
SQL_FREERESULT($result);
+
+ // @TODO Yet another constant to rewrite
define('__EMAIL_SELECT_ROWS', $OUT);
// Load email template
}
} 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>");
}
//
define('__BOTTOM_EMAIL_NAV', "");
}
- $SW = 2; $OUT = "";
+ $OUT = ""; $SW = 2;
while ($pool = SQL_FETCHROW($result))
{
// Check sent mails and clicks
}
} 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();
// 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 = "---";
}
// 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();
$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) {
$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;
}
}
}
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)
} 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
$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&what=guestedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort+1)."&fid=".$sort."\">{--LOWER--}</a>";
+ $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=guestedit&sub={!__SUB_VALUE!}&act=".$content['action']."&w=".$content['what']."&tid=".($content['sort']+1)."&fid=".$content['sort']."\">{--LOWER--}</a>";
} elseif ($cnt == $max) {
// Is lowest position
- $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=guestedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort-1)."&fid=".$sort."\">{--HIGHER--}</a>";
- } elseif ($sort > 0) {
+ $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=guestedit&sub={!__SUB_VALUE!}&act=".$content['action']."&w=".$content['what']."&tid=".($content['sort']-1)."&fid=".$content['sort']."\">{--HIGHER--}</a>";
+ } elseif ($content['sort'] > 0) {
// Anything else between highest and lowest
- $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=guestedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort-1)."&fid=".$sort."\">{--HIGHER--}</a>/<a href=\"{!URL!}/modules.php?module=admin&what=guestedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort+1)."&fid=".$sort."\">{--LOWER--}</a>";
+ $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=guestedit&sub={!__SUB_VALUE!}&act=".$content['action']."&w=".$content['what']."&tid=".($content['sort']-1)."&fid=".$content['sort']."\">{--HIGHER--}</a>/<a href=\"{!URL!}/modules.php?module=admin&what=guestedit&sub={!__SUB_VALUE!}&act=".$content['action']."&w=".$content['what']."&tid=".($content['sort']+1)."&fid=".$content['sort']."\">{--LOWER--}</a>";
}
- if (empty($act)) $act = " ";
- if (empty($wht)) $wht = " ";
- if (empty($title)) $title = " ";
+ if (empty($content['action'])) $content['action'] = " ";
+ if (empty($content['what'])) $content['what'] = " ";
+ if (empty($content['title'])) $content['title'] = " ";
+
$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"
);
} // 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')."";
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
// 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'));
}
+
//
?>
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')) {
} // 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,
// 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));
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);
// Prepare constants
define('__CATS_BASE' , "<a href=\"{!URL!}/modules.php?module=admin&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
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
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
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
// 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'));
}
+
//
?>
// 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...
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');
// 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
}
} 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
$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);
}
} 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
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&what=list_payouts&do=accept&pid=".$pid."\">".PAYOUT_ACCEPT_PAYOUT."</a> | <a href=\"{!URL!}/modules.php?module=admin&what=list_payouts&do=reject&pid=".$pid."\">".PAYOUT_REJECT_PAYOUT."</a>";
+ $content['status'] = "<a href=\"{!URL!}/modules.php?module=admin&what=list_payouts&do=accept&pid=".$content['id']."\">".PAYOUT_ACCEPT_PAYOUT."</a> | <a href=\"{!URL!}/modules.php?module=admin&what=list_payouts&do=reject&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
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'));
}
}
//
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
// 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');
// 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
$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',
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');
}
$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);
$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);
$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&what=list_rallyes&sub=users&rallye=".$id."\" title=\"".RALLYE_LIST_USERS."\">".$joined."</a>";
- }
+ $joined = "<a href=\"{!URL!}/modules.php?module=admin&what=list_rallyes&sub=users&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;
}
// Notification to members?
- switch ($notify)
+ switch ($content['send_notify'])
{
case "Y":
$content['notify_title'] = getMessage('RALLYE_STOP_NOTIFY_NOW');
}
// 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');
// 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) {
// 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);
$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
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
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
// Free memory
SQL_FREERESULT($result_main);
+
+ // @TODO Rewrite this constant
define('__SPONSOR_ROWS', $OUT);
// Load final template
), __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
// Switch colors
$SW = 3 - $SW;
- }
+ } // END - foreach
// Remember content in constant
define('__SPONSOR_ROWS', $OUT);
// 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
// Switch colors
$SW = 3 - $SW;
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);
}
// 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);
}
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");
}
{
// 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
// 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', " ");
$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));
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
}
// 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']);
// 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) {
} else {
$prev = $value;
}
- }
+ } // END - foreach
// Prepare variables
$menus = $dmy; $titles = $dmy2; $below = $dmy3;
$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) {
} 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) {
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 {
$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&what=memedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort+1)."&fid=".$sort."\">{--LOWER--}</a>";
+ $content['navi'] = "<a href=\"{!URL!}/modules.php?module=admin&what=memedit&sub={!__SUB_VALUE!}&act=".$content['action']."&w=".$content['what']."&tid=".($content['sort']+1)."&fid=".$content['sort']."\">{--LOWER--}</a>";
} elseif ($cnt == $max) {
// Is lowest position
- $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=memedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort-1)."&fid=".$sort."\">{--HIGHER--}</a>";
- } elseif ($sort > 0) {
+ $content['navi'] = "<a href=\"{!URL!}/modules.php?module=admin&what=memedit&sub={!__SUB_VALUE!}&act=".$content['action']."&w=".$content['what']."&tid=".($content['sort']-1)."&fid=".$content['sort']."\">{--HIGHER--}</a>";
+ } elseif ($content['sort'] > 0) {
// Anything else between highest and lowest
- $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=memedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort-1)."&fid=".$sort."\">{--HIGHER--}</a>/<a href=\"{!URL!}/modules.php?module=admin&what=memedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort+1)."&fid=".$sort."\">{--LOWER--}</a>";
+ $content['navi'] = "<a href=\"{!URL!}/modules.php?module=admin&what=memedit&sub={!__SUB_VALUE!}&act=".$content['action']."&w=".$content['what']."&tid=".($content['sort']-1)."&fid=".$content['sort']."\">{--HIGHER--}</a>/<a href=\"{!URL!}/modules.php?module=admin&what=memedit&sub={!__SUB_VALUE!}&act=".$content['action']."&w=".$content['what']."&tid=".($content['sort']+1)."&fid=".$content['sort']."\">{--LOWER--}</a>";
}
- if (empty($act)) $act = " ";
- if (empty($wht)) $wht = " ";
- if (empty($title)) $title = " ";
+ // Fix empty values for Firefox
+ if (empty($content['action'])) $content['action'] = " ";
+ if (empty($content['what'])) $content['what'] = " ";
+ if (empty($content['title'])) $content['title'] = " ";
- $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... (???)
// 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)
{
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__);
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__);
$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
}
if (SQL_AFFECTEDROWS() == 1) {
- $content = SETTINGS_SAVED;
+ $content = getMessage('SETTINGS_SAVED');
} else {
$content = "<span class=\"admin_failed\">{--SETTINGS_NOT_SAVED--}</span>";
}
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);
$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",
}
// 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
// Free memory
SQL_FREERESULT($result);
+
+ // @TODO Rewrite this constant
define('__BANNER_ROWS', $OUT);
// Load main template
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
$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
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);
// 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
$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
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__);
$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
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";
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
}
} 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
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")) {
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);
} 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&what=stats_mods&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&what=stats_mods&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);
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);
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);
$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
);
// 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 = "";
} // 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";
}
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");
$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&what=theme_edit&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&what=theme_edit&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
} 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);
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(
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,
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
// 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) {
(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?
// 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);
}
// 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
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
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++) {
imagepng($image);
imagedestroy($image);
}
- exit();
+ exit;
} elseif (!REQUEST_ISSET_GET(('usage'))) {
$FQFN = sprintf("%s%s/index.html",
constant('PATH'),
// 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'));
}
+
//
?>
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'";
$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);
//
?>
$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__);
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);
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);
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);
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));
}
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);
} // 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
// 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
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
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
}
} 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);
//
?>
// @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)."\" /> ".$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')));
{
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__));
// 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
// 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);
// 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
// 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";
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,
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>
<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." </td>
- <td class=\"switch_sw".$SW." bottom2\" width=\"50\"> ".$clicks."</td>
+ <td class=\"switch_sw".$SW." bottom2 right2\" align=\"right\" width=\"250\">".$content['title']." </td>
+ <td class=\"switch_sw".$SW." bottom2\" width=\"50\"> ".$content['counter']."</td>
</tr>");
$SW = 3 - $SW;
}
<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." </td>
- <td class=\"switch_sw".$SW." bottom2\" width=\"50\"> ".$clicks."</td>
+ <td class=\"switch_sw".$SW." bottom2 right2\" align=\"right\" width=\"250\">".$content['title']." </td>
+ <td class=\"switch_sw".$SW." bottom2\" width=\"50\"> ".$content['counter']."</td>
</tr>");
$SW = 3 - $SW;
}
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&what=stats&mode=".$lmode."\">".$ltitle."</a></td>
+ <td align=\"center\" class=\"guest_stats_footer\" colspan=\"2\">
+ <a href=\"{!URL!}/modules.php?module=index&what=stats&mode=".$lmode."\">".$ltitle."</a>
+ </td>
</tr>
</table>");
}
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
// Switch colors and count one up
$SW = 3 - $SW; $cnt++;
-}
+} // END - while
if ($cnt < getConfig('top10_max')) {
// Add more "blank" rows
// 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
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
// Switch colors and count one up
$SW = 3 - $SW; $cnt++;
-}
+} // END - while
if ($cnt < getConfig('top10_max')) {
// Add more "blank" rows
// 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
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
// Switch colors and count one up
$SW = 3 - $SW; $cnt++;
-}
+} // END - while
if ($cnt < getConfig('top10_max')) {
// Add more "blank" rows
// 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
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'";
$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);
//
?>
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" ! :-(
$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);
}
$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));
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);
// 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);
//
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
//
// 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
} // 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)) {
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;
$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
$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) {
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
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
}
} 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')",
// 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 {
$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;
$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);
// 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);
// 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),
);
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&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&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&what=impressum&admin=".$aid."\">".$login."</a>");
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>");
+
//
?>
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 />");
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&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&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
} 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
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(
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))) {
{
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'));
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'));
$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;
}
}
// ... and add them to a constant for the template
+ // @TODO Rewrite these constants
define('__TRANSFER_ROWS', $OUT);
// Remeber total amount
$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;
}
}
// ... and add them to a constant for the template
+ // @TODO Rewrite all these constants
define('__TRANSFER_ROWS', $OUT);
// Remeber total amount
// 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;
} 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!
$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
} 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!
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);
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"))) {
// 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`",
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']."&what=".$sub_what.ADD_URL_DATA("")."\" target=\"_self\">";
+ $OUT .= "<a name=\"menu\" class=\"menu_blur\" href=\"{!URL!}/modules.php?module=".$GLOBALS['module']."&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?
} 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>");
}
}
// 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 {
// Prepare content
$content = array(
- 'text' => REASON_DIRECT_PAYMENT,
+ 'text' => getMessage('REASON_DIRECT_PAYMENT'),
'points' => TRANSLATE_COMMA($ref_points)
);
$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'));
}
} // 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
$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."\"";
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."\"";
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");
$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
// Add counter
$CATS['uids'][] = $uid_cnt;
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);
$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";
$CAT_TABS = "%s";
$CAT_WHERE = "";
$receiverList = "";
+ $result = false;
// Secure data
$cat = bigintval($cat);
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
// 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;
}
// 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
}
// 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
$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);
//* 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
</div>
</body>
</html>\n";
-exit();
+exit;
//
?>
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'));
--- /dev/null
+<tr>
+ <td class="switch_sw$content[sw] bottom right"> $content[id]</td>
+ <td class="switch_sw$content[sw] bottom right"> $content[title]</td>
+ <td class="switch_sw$content[sw] bottom" align="center">
+ $content[link]
+ </td>
+</tr>
<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>
<tr>
<td class="switch_sw$content[sw] bottom2 right2">
- $content[title] ($content[action])</td>
+ $content[title] ($content[action])
+ </td>
<td class="switch_sw$content[sw] bottom2" align="center">
- $content[clicks]</td>
+ $content[counter]
+ </td>
</tr>
<tr>
<td class="switch_sw$content[sw] bottom2 right2">
- $content[title] ($content[mod])</td>
+ $content[title] ($content[module])
+ </td>
<td class="switch_sw$content[sw] bottom2" align="center">
- $content[clicks]</td>
+ $content[clicks]
+ </td>
</tr>
<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"> </td></tr>
</table>
</td>
<strong>{--GUEST_SPONSOR_ACTIONS_HEADER--}</strong>
</td>
</tr>
-{!__SPONSOR_ACTIONS!}
+$content[actions]
<tr><td colspan="2" class="guest_title2 seperator" height="29"> </td></tr>
</table>
</td>
--- /dev/null
+<tr>
+ <td colspan="2>
+ $content
+ </td>
+</tr>
--- /dev/null
+<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]" /> $content[pay_name]<br />
+ <div align="right">($content[pay_min_count] $content[pay_currency] = $content[res] {!POINTS!})</div>
+ </td>
+</tr>
--- /dev/null
+<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>
--- /dev/null
+<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>
<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>
-<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>