From: Roland Häder Date: Fri, 6 Mar 2009 17:06:41 +0000 (+0000) Subject: A lot while() conditions rewritten to SQL_FETCHARRAY(), see bug #107, @TODO tags... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4001187f22197f55e5a1f211fc8defcc180f7c32;p=mailer.git A lot while() conditions rewritten to SQL_FETCHARRAY(), see bug #107, @TODO tags created for remaining, svn:keyword added --- diff --git a/.gitattributes b/.gitattributes index 50977e6cb7..c46d5c5f5c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -890,6 +890,7 @@ templates/de/html/admin/admin_config_extensions.tpl -text templates/de/html/admin/admin_config_holiday.tpl -text templates/de/html/admin/admin_config_home.tpl -text templates/de/html/admin/admin_config_home_main.tpl -text +templates/de/html/admin/admin_config_home_row.tpl -text templates/de/html/admin/admin_config_home_settings.tpl -text templates/de/html/admin/admin_config_home_settings_pro.tpl -text templates/de/html/admin/admin_config_mediadata.tpl -text @@ -1319,9 +1320,11 @@ templates/de/html/guest/guest_register_refid_hide.tpl -text templates/de/html/guest/guest_sponsor_act_row.tpl -text templates/de/html/guest/guest_sponsor_activate.tpl -text templates/de/html/guest/guest_sponsor_infos.tpl -text +templates/de/html/guest/guest_sponsor_infos_none_row.tpl -text templates/de/html/guest/guest_sponsor_login.tpl -text templates/de/html/guest/guest_sponsor_lost.tpl -text templates/de/html/guest/guest_sponsor_pay_row.tpl -text +templates/de/html/guest/guest_sponsor_payment_row.tpl -text templates/de/html/guest/guest_sponsor_reg.tpl -text templates/de/html/guest/guest_stats_cats_row.tpl -text templates/de/html/guest/guest_stats_member.tpl -text @@ -1471,6 +1474,8 @@ templates/de/html/member/member_themes.tpl -text templates/de/html/member/member_transfer_list.tpl -text templates/de/html/member/member_transfer_new.tpl -text templates/de/html/member/member_transfer_overview.tpl -text +templates/de/html/member/member_transfer_row.tpl -text +templates/de/html/member/member_transfer_row2.tpl -text templates/de/html/member/member_transfer_settings.tpl -text templates/de/html/member/member_unconfirmed_404.tpl -text templates/de/html/member/member_unconfirmed_404_nopoints.tpl -text diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 90043b3f14..57f39e1de7 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -1,55 +1,177 @@ ### 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 diff --git a/DOCS/todo-builder.sh b/DOCS/todo-builder.sh index 0765d1e737..52c4164ab9 100644 --- a/DOCS/todo-builder.sh +++ b/DOCS/todo-builder.sh @@ -11,6 +11,6 @@ fi echo "$0: Generating TODOs.txt..." echo "### WARNING: THIS FILE IS AUTO-GENERATED BY $0 ###" > DOCS/TODOs.txt echo "### DO NOT EDIT THIS FILE. ###" >> DOCS/TODOs.txt -find -type f -name "*.php" -exec grep -Hn "@TODO" {} \; >> DOCS/TODOs.txt +find -type f -name "*.php" -exec grep -Hn "@TODO" {} \; | sort >> DOCS/TODOs.txt echo "$0: Done." exit 0 diff --git a/css.php b/css.php index c722525cb3..f246c8390b 100644 --- a/css.php +++ b/css.php @@ -31,9 +31,6 @@ * MA 02110-1301 USA * ************************************************************************/ -// Deactivate caching system in CSS mode -define('_OB_CACHING', "old"); - // Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) ) require("inc/libs/security_functions.php"); diff --git a/doubler.php b/doubler.php index 983653ddaa..0faafa9c69 100644 --- a/doubler.php +++ b/doubler.php @@ -123,7 +123,7 @@ if (isInstalled()) { // Check all together if ((!empty($uid)) && ($password == generateHash(REQUEST_POST('pass'), substr($password, 0, -40))) && ($status == "CONFIRMED") && ($probe_points)) { // Nickname resolved to a unique userid or direct userid entered by the member - $DOUBLER_UID = $uid; + $GLOBALS['doubler_uid'] = $uid; // Calulcate points $points = GET_TOTAL_DATA($uid, "user_points", "points") - GET_TOTAL_DATA($uid, "user_data", "used_points"); diff --git a/inc/autopurge/purge-general.php b/inc/autopurge/purge-general.php index 782b69d6f0..c4e63c3e0e 100644 --- a/inc/autopurge/purge-general.php +++ b/inc/autopurge/purge-general.php @@ -45,6 +45,9 @@ if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) { } if ((getConfig('auto_purge_active') == "Y") && (getConfig('auto_purge') > 0)) { + // Init SQLs + INIT_SQLS(); + // First calculate the timestamp $PURGE = getConfig('auto_purge'); @@ -57,35 +60,35 @@ FROM `{!_MYSQL_PREFIX!}_user_stats` AS s LEFT JOIN `{!_MYSQL_PREFIX!}_payments` AS t ON s.payment_id=t.id WHERE s.timestamp_ordered <= (UNIX_TIMESTAMP() - %s) ORDER BY s.userid", - array(bigintval($PURGE)), __FILE__, __LINE__); + array(bigintval($PURGE)), __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { // Start deleting procedure $uid = 0; $points = 0; - while (list($mid, $sender, $pool, $price) = SQL_FETCHROW($result)) { + while ($content = SQL_FETCHARRAY($result)) { // Check if confirmation links are purged or not $result_links = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s LIMIT 1", - array(bigintval($mid)), __FILE__, __LINE__); + array(bigintval($content['id'])), __FILE__, __LINE__); if (SQL_NUMROWS($result_links) == 1) { // Free memory SQL_FREERESULT($result_links); // At least one link was found, enougth to pay back the points - if (($uid != $sender) && ($uid > 0) && ($points > 0)) { + if (($uid != $content['userid']) && ($uid > 0) && ($points > 0)) { // Directly add points back to senders account AUTOPURGE_ADD_POINTS($uid, $points); $points = 0; } // END - if // Add points - $uid = $sender; $points += $price; $admin_points += $price; + $uid = $content['userid']; $points += $content['price']; $admin_points += $content['price']; // Remove confirmation links from queue - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s", - array(bigintval($mid)), __FILE__, __LINE__); + ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s", + array(bigintval($content['id'])), __FILE__, __LINE__, false)); // Update status of order - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='DELETED' WHERE id=%s LIMIT 1", - array(bigintval($pool)), __FILE__, __LINE__); + ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='DELETED' WHERE id=%s LIMIT 1", + array(bigintval($content['pool_id'])), __FILE__, __LINE__, false)); } // END - if } // END - while @@ -104,24 +107,24 @@ WHERE s.timestamp_ordered <= (UNIX_TIMESTAMP() - %s) ORDER BY s.userid", if (SQL_NUMROWS($result) > 0) { // Start deleting procedure $points = 0; - while (list($bid, $price) = SQL_FETCHROW($result)) { + while ($content = SQL_FETCHARRAY($result)) { // Check if confirmation links are purged or not $result_links = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s", - array(bigintval($bid)), __FILE__, __LINE__); + array(bigintval($content['id'])), __FILE__, __LINE__); if (SQL_NUMROWS($result_links) > 0) { // At least one link was found, enougth to pay back the points - $points += $price * SQL_NUMROWS($result_links); + $points += $content['points'] * SQL_NUMROWS($result_links); // Free memory SQL_FREERESULT($result_links); // Remove confirmation links from queue - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s", - array(bigintval($bid)), __FILE__, __LINE__); + ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s", + array(bigintval($content['id'])), __FILE__, __LINE__, false)); // Update status of order - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='DELETED' WHERE id=%s LIMIT 1", - array(bigintval($bid)), __FILE__, __LINE__); + ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='DELETED' WHERE id=%s LIMIT 1", + array(bigintval($content['id'])), __FILE__, __LINE__, false)); } // END - if } // END - while @@ -139,8 +142,11 @@ WHERE s.timestamp_ordered <= (UNIX_TIMESTAMP() - %s) ORDER BY s.userid", // Add points from deleted accounts to jackpot, but here just add to notify mail if ($admin_points > 0) { // Send mail to admin - SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_SUBJECT, "admin_autopurge_points", TRANSLATE_COMMA($points), "0"); + SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_SUBJECT'), "admin_autopurge_points", TRANSLATE_COMMA($points), "0"); } // END - if + + // Run all SQLs here + runFilterChain('run_sqls'); } // END - if // diff --git a/inc/autopurge/purge-inact.php b/inc/autopurge/purge-inact.php index adb04be8cb..56fabfb73a 100644 --- a/inc/autopurge/purge-inact.php +++ b/inc/autopurge/purge-inact.php @@ -45,6 +45,9 @@ if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) { // Shall I look for inactive accounts and autopurge inactive accounts? if (getConfig('autopurge_inactive') == "Y") { + // Init SQLs + INIT_SQLS(); + // Ok, let's have a look... $since = getConfig(('ap_inactive_since')); @@ -79,27 +82,27 @@ ORDER BY d.userid", array($since, $since, $since), __FILE__, __LINE__); define('__INACTIVE_TIME' , (getConfig('ap_in_time') / 60 / 60)); // Mark found accounts as inactive and send an email - while (list($uid, $email, $last) = SQL_FETCHROW($result_inactive)) { + while ($content = SQL_FETCHARRAY($result_inactive)) { // Remember userids for the admin - $UIDs .= $uid.", "; + $UIDs .= $content['userid'].", "; // Get date/time from timestamp - $last = MAKE_DATETIME($last, "0"); + $content['last_online'] = MAKE_DATETIME($content['last_online'], "0"); // Load mail template - $msg = LOAD_EMAIL_TEMPLATE("member_autopurge_inactive", $last, bigintval($uid)); - SEND_EMAIL($email, AUTOPURGE_MEMBER_INACTIVE_SUBJECT, $msg); + $msg = LOAD_EMAIL_TEMPLATE("member_autopurge_inactive", $content['last_online'], bigintval($content['userid'])); + SEND_EMAIL($content['email'], getMessage('AUTOPURGE_MEMBER_INACTIVE_SUBJECT'), $msg); // Update this account - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ap_notified=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1", - array(bigintval($uid)), __FILE__, __LINE__); + ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ap_notified=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1", + array(bigintval($content['userid'])), __FILE__, __LINE__, false)); } // END - while // Remove last comma $UIDs = str_replace(", ", "\n", substr($UIDs, 0, -2)); // Send mail notification to admin - SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_INACTIVE_SUBJECT, "admin_autopurge_inactive", $UIDs, ""); + SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_INACTIVE_SUBJECT'), "admin_autopurge_inactive", $UIDs, ""); } // END - if // Free memory @@ -113,21 +116,21 @@ FROM `{!_MYSQL_PREFIX!}_user_data` AS d WHERE `status`='CONFIRMED' AND joined < (UNIX_TIMESTAMP() - %s) AND last_online < (UNIX_TIMESTAMP() - %s) AND ap_notified < (UNIX_TIMESTAMP() - %s) ".$EXCLUDE_LIST." ORDER BY userid", - array($since, $since, $time), __FILE__, __LINE__); + array($since, $since, $time), __FILE__, __LINE__); if (SQL_NUMROWS($result_inactive) > 0) { // Prepare variable... $UIDs = ""; // Delete inactive accounts - while (list($uid, $email, $last) = SQL_FETCHROW($result_inactive)) { + while ($content = SQL_FETCHARRAY($result_inactive)) { // Remember userids for the admin - $UIDs .= $uid.", "; + $UIDs .= $content['userid'].", "; // Get date/time from timestamp - $last = MAKE_DATETIME($last, "0"); + $content['last_online'] = MAKE_DATETIME($content['last_online'], "0"); // Finnaly delete this inactive account - DELETE_USER_ACCOUNT(bigintval($uid), LOAD_EMAIL_TEMPLATE("member_autopurge_delete", $last, "")); + DELETE_USER_ACCOUNT($content['userid'], LOAD_EMAIL_TEMPLATE("member_autopurge_delete", $content['last_online'], "")); } // END - while // Remove last comma @@ -135,12 +138,15 @@ ORDER BY userid", // Send mail notification to admin if (getConfig('ap_in_notify') == "Y") { - SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_DELETE_SUBJECT, "admin_autopurge_delete", $UIDs, ""); + SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_DELETE_SUBJECT'), "admin_autopurge_delete", $UIDs, ""); } // END - if } // END - if // Free memory SQL_FREERESULT($result_inactive); + + // Run all SQLs + runFilterChain('run_sqls'); } // END - if // diff --git a/inc/autopurge/purge-mails.php b/inc/autopurge/purge-mails.php index 3970e29008..55979178ec 100644 --- a/inc/autopurge/purge-mails.php +++ b/inc/autopurge/purge-mails.php @@ -47,7 +47,7 @@ if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) { if (getConfig('ap_del_mails') == "Y") { // Okay, let's check for them... $since = getConfig(('ap_dm_timeout')); - $result_mails = SQL_QUERY_ESC("SELECT sender\ + $result_mails = SQL_QUERY_ESC("SELECT sender FROM `{!_MYSQL_PREFIX!}_pool` WHERE data_type='DELETED' AND timestamp <= (UNIX_TIMESTAMP() - %s) ORDER BY sender ASC", @@ -59,14 +59,14 @@ ORDER BY sender ASC", // Do we have "purged" mails? if (SQL_NUMROWS($result_mails) > 0) { // Okay, check for their sender's - while (list($sender) = SQL_FETCHROW($result_mails)) { + while ($content = SQL_FETCHARRAY($result_mails)) { // Check now... $fount = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", - array(bigintval($sender)), __FILE__, __LINE__)); + array(bigintval($content['sender'])), __FILE__, __LINE__)); if ($found == 0) { // Okay we found some mails! SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_pool` WHERE sender=%s", - array(bigintval($sender)), __FILE__, __LINE__); + array(bigintval($content['sender'])), __FILE__, __LINE__); $DELETED += SQL_AFFECTEDROWS(); // Reset query (to prevent possible errors) ... @@ -94,12 +94,12 @@ ORDER BY sender ASC", // Do we have "purged" mails? if (SQL_NUMROWS($result_mails) > 0) { // Okay, check for their sender's - while (list($sender) = SQL_FETCHROW($result_mails)) { + while ($content = SQL_FETCHARRAY($result_mails)) { // Check now... - $found = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", array(bigintval($sender)), __FILE__, __LINE__)); + $found = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", array(bigintval($content['sender'])), __FILE__, __LINE__)); if ($found == 0) { // Okay we found some mails! - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE sender=%s", array(bigintval($sender)), __FILE__, __LINE__); + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE sender=%s", array(bigintval($content['sender'])), __FILE__, __LINE__); $DELETED += SQL_AFFECTEDROWS(); // Reset query (to prevent possible errors) ... @@ -119,8 +119,8 @@ ORDER BY sender ASC", // Do we have deleted mails and the admin want's to receive a notification if (($DELETED > 0) && (getConfig('ap_dm_notify') == "Y")) { // Send out email to admin - SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT, "admin_autopurge_del_mails", $DELETED, ""); - } + SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT'), "admin_autopurge_del_mails", $DELETED, ""); + } // END - if } // diff --git a/inc/autopurge/purge-tsks.php b/inc/autopurge/purge-tsks.php index 5cdc442315..6b7726b597 100644 --- a/inc/autopurge/purge-tsks.php +++ b/inc/autopurge/purge-tsks.php @@ -53,11 +53,14 @@ if ((GET_EXT_VERSION("task") > "0.0") && (getConfig('ap_tasks') == "Y")) { FROM `{!_MYSQL_PREFIX!}_task_system` WHERE `status`='DELETED' AND task_created <= (UNIX_TIMESTAMP() - %s)", array($since), __FILE__, __LINE__); + + // Get deleted rows $DELETED = SQL_AFFECTEDROWS(); + // Do we need to send a notification? if (($DELETED > 0) && (getConfig('ap_tasks_notify') == "Y")) { // Send out email to admin - SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_TASKS_SUBJECT, "admin_autopurge_tsks", $DELETED, ""); + SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_TASKS_SUBJECT'), "admin_autopurge_tsks", $DELETED, ""); } // END - if } // END - if diff --git a/inc/autopurge/purge-unconfirmed.php b/inc/autopurge/purge-unconfirmed.php index 8871ffdbda..4929f2d974 100644 --- a/inc/autopurge/purge-unconfirmed.php +++ b/inc/autopurge/purge-unconfirmed.php @@ -51,22 +51,22 @@ if (getConfig('autopurge_unconfirmed') == "Y") { FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='UNCONFIRMED' AND joined < (UNIX_TIMESTAMP() - %s) ORDER BY userid ASC", - array($time), __FILE__, __LINE__); + array($time), __FILE__, __LINE__); if (SQL_NUMROWS($result_uncon) > 0) { // Prepare variable... $UIDs = ""; define('__UNCONFIRMED_TIME' , (getConfig('ap_un_time') / 60 / 60)); // Delete inactive accounts - while (list($uid, $email, $joined) = SQL_FETCHROW($result_uncon)) { + while ($content = SQL_FETCHARRAY($result_uncon)) { // Remember userids for the admin - $UIDs .= $uid.", "; + $UIDs .= $content['userid'].", "; // Get date/time from timestamp - $joined = MAKE_DATETIME($joined, "0"); + $content['joined'] = MAKE_DATETIME($content['joined'], "0"); // Finnaly delete this inactive account - DELETE_USER_ACCOUNT($uid, LOAD_EMAIL_TEMPLATE("member_autopurge_unconfirmed", $joined, "")); + DELETE_USER_ACCOUNT($content['userid'], LOAD_EMAIL_TEMPLATE("member_autopurge_unconfirmed", $content['joined'], "")); } // END - while // Remove last comma @@ -74,7 +74,7 @@ ORDER BY userid ASC", // Send mail notification to admin if (getConfig('ap_un_notify') == "Y") { - SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT, "admin_autopurge_unconfirmed", $UIDs, ""); + SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT'), "admin_autopurge_unconfirmed", $UIDs, ""); } // END - if } // END - if diff --git a/inc/databases.php b/inc/databases.php index c6d3aab5c3..7440f0e3f7 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -98,7 +98,7 @@ define('SERVER_URL', "http://www.mxchange.org"); // Current SVN revision //define('CURR_SVN_REVISION', getActualVersion(0)); -define('CURR_SVN_REVISION', "827"); +define('CURR_SVN_REVISION', "828"); define('CURR_SVN_DATE' , getActualVersion(1)); define('CURR_SVN_VERSION' , getActualVersion(2)); diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 67c37e02ef..2053425176 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -243,7 +243,7 @@ function SQL_QUERY_ESC ($qstring, $data, $F, $L, $run=true, $strip=true) { // Init variable $query = "failed"; - if ($strip) { + if ($strip === true) { $strip = "true"; } else { $strip = "false"; diff --git a/inc/doubler_send.php b/inc/doubler_send.php index d71492ded8..6e8ae9c3b4 100644 --- a/inc/doubler_send.php +++ b/inc/doubler_send.php @@ -51,7 +51,7 @@ if ($DOUBLER_POINTS == 0) { unset($_GET['DOUBLER_UID']); unset($_POST['DOUBLER_UID']); set_session('DOUBLER_UID', ""); -if (empty($DOUBLER_UID)) $DOUBLER_UID = 0; +if (empty($GLOBALS['doubler_uid'])) $GLOBALS['doubler_uid'] = 0; // Check for doubles which we can pay out $min = getConfig(('doubler_min') * 2); @@ -78,49 +78,49 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == "Y")) if ((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == "Y")) $result_load = $result_total; // At least one account was found - while (list($id, $uid, $points, $ip, $time) = SQL_FETCHROW($result_load)) { + while ($content = SQL_FETCHARRAY($result_load)) { // Only double when points are enougth! - if ($DOUBLER_POINTS >= $points) { + if ($DOUBLER_POINTS >= $content['points']) { // Check for his ref points - $ref = GET_TOTAL_DATA($uid, "doubler", "points", "refid", false, " AND completed='N' AND is_ref='Y'"); + $ref = GET_TOTAL_DATA($content['userid'], "doubler", "points", "refid", false, " AND completed='N' AND is_ref='Y'"); // Zero refid when empty (might be helpful!) if (empty($ref)) $ref = 0; - if (($ref > 0) && ($DOUBLER_UID == $uid) && (!empty($ref))) { + if (($ref > 0) && ($GLOBALS['doubler_uid'] == $content['userid']) && (!empty($ref))) { // Referal points found so add them and set line(s) to completed='Y' - $points += $ref; + $content['points'] += $ref; SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_doubler` SET completed='Y' WHERE refid=%s AND completed='N' AND is_ref='Y'", - array(bigintval($uid)), __FILE__, __LINE__); + array(bigintval($content['userid'])), __FILE__, __LINE__); } else { // No referal points found $ref = 0; } // Exclude webmaster from doubling... - if ($uid != getConfig('doubler_uid')) { + if ($content['userid'] != getConfig('doubler_uid')) { // Add points - ADD_POINTS_REFSYSTEM(sprintf("doubler_%s", strtolower(getConfig('doubler_send_mode'))), $uid, $points, false, "0", false, "direct"); + ADD_POINTS_REFSYSTEM(sprintf("doubler_%s", strtolower(getConfig('doubler_send_mode'))), $content['userid'], $content['points'], false, "0", false, "direct"); } // END - if // Set entry as "payed" SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_doubler` SET completed='Y' WHERE id=%s LIMIT 1", - array(bigintval($id)), __FILE__, __LINE__); + array(bigintval($content['id'])), __FILE__, __LINE__); $okay = false; // Check for jackpot inclusion in doubling process - if (($jackpot > 0) && ($jackpot >= $points) && (getConfig('doubler_jackpot') == "Y")) { + if (($jackpot > 0) && ($jackpot >= $content['points']) && (getConfig('doubler_jackpot') == "Y")) { // Subtract points from jackpot - SUB_JACKPOT($points); - $jackpot -= $points; + SUB_JACKPOT($content['points']); + $jackpot -= $content['points']; // Okay, done! $okay = true; } // END - if // Exclude also webmaster's ID in taking points from webmaster's account - if (($user > 0) && ($user >= $points) && (!$okay) && (getConfig('doubler_uid') > 0) && ($uid != getConfig('doubler_uid'))) { + if (($user > 0) && ($user >= $content['points']) && (!$okay) && (getConfig('doubler_uid') > 0) && ($content['userid'] != getConfig('doubler_uid'))) { // Add points to used points - SUB_POINTS("doubler_payout", getConfig('doubler_uid'), $points); + SUB_POINTS("doubler_payout", getConfig('doubler_uid'), $content['points']); // Okay, done! $okay = true; @@ -129,28 +129,28 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == "Y")) // Update doubler's account only when others are not updated if (!$okay) { // Add points to used doubler points - UPDATE_CONFIG("doubler_used", $points, "+"); + UPDATE_CONFIG("doubler_used", $content['points'], "+"); } // END - if // Update variables to prevent errors - incrementConfigEntry('doubler_used', $points); - $DOUBLER_POINTS -= $points; + incrementConfigEntry('doubler_used', $content['points']); + $DOUBLER_POINTS -= $content['points']; // Prepare array $content = array( // Doubler transmission ID - 'id' => $id, + 'id' => $content['id'], // Doubled points - 'points' => TRANSLATE_COMMA($points), + 'points' => TRANSLATE_COMMA($content['points']), // Timemark - 'when' => MAKE_DATETIME($time, "2"), + 'when' => MAKE_DATETIME($content['timemark'], "2"), // IP number when the member submitted the doubling form - 'ip' => $ip, + 'ip' => $content['remote_ip'], ); // Load mail template and send mail away... - $msg = LOAD_EMAIL_TEMPLATE("member_doubler", $content, $uid); - SEND_EMAIL($uid, getMessage('DOUBLER_MEMBER_SUBJECT'), $msg); + $msg = LOAD_EMAIL_TEMPLATE("member_doubler", $content, $content['userid']); + SEND_EMAIL($content['userid'], getMessage('DOUBLER_MEMBER_SUBJECT'), $msg); } // END - if } // END - while } // END - if diff --git a/inc/extensions.php b/inc/extensions.php index b2bca3ea6e..ae8f15210e 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -436,7 +436,7 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) { $start = array_search($ext_ver, $history); // And load SQL queries in order of version history - for ($idx = ($start + 1); $idx < sizeof($history); $idx++) { + for ($idx = ($start + 1); $idx < count($history); $idx++) { // Set extension version $GLOBALS['cache_array']['update_ver'][$ext_name] = $history[$idx]; diff --git a/inc/extensions/ext-cache.php b/inc/extensions/ext-cache.php index 16300c142e..17a13d08f3 100644 --- a/inc/extensions/ext-cache.php +++ b/inc/extensions/ext-cache.php @@ -243,7 +243,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha default: // Do stuff when extension is loaded // Create instance on class - if ($GLOBALS['cacheMode'] != "init") { + if ($GLOBALS['cache_mode'] != "init") { // Initialize cache system only when it's needed $GLOBALS['cache_instance'] = new CacheSystem(getConfig('cache_update'), "inc/".getConfig('cache_path'), getConfig('cache_tested')); if ($GLOBALS['cache_instance']->getStatus() != "done") { diff --git a/inc/extensions/ext-rallye.php b/inc/extensions/ext-rallye.php index ab52b74ae9..a1ff9913bb 100644 --- a/inc/extensions/ext-rallye.php +++ b/inc/extensions/ext-rallye.php @@ -324,7 +324,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha default: // Do stuff when extension is loaded // Do stuff only when not in CSS mode - if (($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1") && ($GLOBALS['cacheMode'] != "init")) { + if (($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1") && ($GLOBALS['cache_mode'] != "init")) { // Get total member count $TOTAL = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true); diff --git a/inc/functions.php b/inc/functions.php index 1465d609d1..dcdfdc6ea0 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -38,25 +38,17 @@ if (!defined('__SECURITY')) { } // Check if our config file is writeable or not -function IS_INC_WRITEABLE($inc) { +function IS_INC_WRITEABLE ($inc) { // Generate FQFN - $fqfn = sprintf("%sinc/%s.php", constant('PATH'), $inc); + $FQFN = sprintf("%sinc/%s.php", constant('PATH'), $inc); // Abort by simple test - if ((FILE_READABLE($fqfn)) && (!is_writeable($fqfn))) { + if ((FILE_READABLE($FQFN)) && (!is_writeable($FQFN))) { return false; } // END - if - // Test if we can append data - $fp = fopen($fqfn, 'a'); - if ($inc == "dummy") { - // Remove dummy file - fclose($fp); - return unlink($fqfn); - } else { - // Close all other files - return fclose($fp); - } + // Test write-access + return is_writeable($FQFN); } // Output HTML code directly or "render" it. You addionally switch the new-line character off @@ -375,7 +367,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) { // Do we have some content to output or return? if (!empty($ret)) { // Not empty so let's put it out! ;) - if ($return) { + if ($return === true) { // Return the HTML code return $ret; } else { @@ -540,7 +532,7 @@ function GEN_PASS ($LEN = 0) { // Start creating password $PASS = ""; for ($i = 0; $i < $LEN; $i++) { - $PASS .= $ABC[mt_rand(0, sizeof($ABC) -1)]; + $PASS .= $ABC[mt_rand(0, count($ABC) -1)]; } // END - for // When the size is below 40 we can also add additional security by scrambling it @@ -954,7 +946,7 @@ function LOAD_URL ($URL, $addUrlData=true) { LOAD_TEMPLATE("redirect_url", false, str_replace("&", "&", $URL)); LOAD_INC("inc/footer.php"); } - exit(); + exit; } // Wrapper for LOAD_URL but URL comes from a configuration entry @@ -1595,11 +1587,6 @@ function SEND_ADMIN_EMAILS_PRO ($subj, $template, $content, $UID) { // Load email template $msg = LOAD_EMAIL_TEMPLATE($template, $content, $UID); - if (EXT_VERSION_IS_OLDER("admins", "0.4.0")) { - // Older version detected! - return SEND_ADMIN_EMAILS($subj, $msg); - } // END - if - // Check which admin shall receive this mail $result = SQL_QUERY_ESC("SELECT DISTINCT admin_id FROM `{!_MYSQL_PREFIX!}_admins_mails` WHERE mail_template='%s' ORDER BY admin_id", array($template), __FUNCTION__, __LINE__); @@ -1609,9 +1596,10 @@ function SEND_ADMIN_EMAILS_PRO ($subj, $template, $content, $UID) { array($template), __FUNCTION__, __LINE__); } else { // Load admin IDs... - $aids = array(); - while (list($aid) = SQL_FETCHROW($result)) { - $aids[] = $aid; + // @TODO This can be, somehow, rewritten + $adminIds = array(); + while ($content = SQL_FETCHARRAY($result)) { + $adminIds[] = $content['admin_id']; } // END - while // Free memory @@ -1621,7 +1609,7 @@ function SEND_ADMIN_EMAILS_PRO ($subj, $template, $content, $UID) { $result = false; // "implode" IDs and query string - $aid = implode(",", $aids); + $aid = implode(",", $adminIds); if ($aid == "-1") { if (EXT_IS_ACTIVE("events")) { // Add line to user events @@ -1636,16 +1624,18 @@ function SEND_ADMIN_EMAILS_PRO ($subj, $template, $content, $UID) { } } elseif ($aid == "0") { // Select all email adresses - $result = SQL_QUERY("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `id`", __FUNCTION__, __LINE__); + $result = SQL_QUERY("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `id`", + __FUNCTION__, __LINE__); } else { // If Admin-ID is not "to-all" select - $result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` WHERE id IN (%s) ORDER BY `id`", array($aid), __FUNCTION__, __LINE__); + $result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` WHERE id IN (%s) ORDER BY `id`", + array($aid), __FUNCTION__, __LINE__); } } // Load email addresses and send away - while (list($email) = SQL_FETCHROW($result)) { - SEND_EMAIL($email, $subj, $msg); + while ($content = SQL_FETCHARRAY($result)) { + SEND_EMAIL($content['email'], $subj, $msg); } // END - while // Free memory @@ -1727,7 +1717,7 @@ function ADD_EMAIL_NAV ($PAGES, $offset, $show_form, $colspan, $return=false) { // Load navigation template $OUT = LOAD_TEMPLATE("admin_email_nav_row", true); - if ($return) { + if ($return === true) { // Return generated HTML-Code return $OUT; } else { @@ -1898,7 +1888,7 @@ function SEND_RAW_REQUEST ($host, $request) { fputs($fp, $request); // Read response - while(!feof($fp)) { + while (!feof($fp)) { $response[] = trim(fgets($fp, 1024)); } // END - while @@ -1941,7 +1931,7 @@ function SEND_RAW_REQUEST ($host, $request) { } // Taken from www.php.net eregi() user comments -function VALIDATE_EMAIL($email) { +function VALIDATE_EMAIL ($email) { // Compile email $email = COMPILE_CODE($email); @@ -2926,12 +2916,12 @@ function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) { return false; } // Send notification to admin -function SEND_ADMIN_NOTIFICATION($subject, $templateName, $content=array(), $uid="0") { +function SEND_ADMIN_NOTIFICATION ($subject, $templateName, $content=array(), $uid="0") { if (GET_EXT_VERSION("admins") >= "0.4.1") { // Send new way SEND_ADMIN_EMAILS_PRO($subject, $templateName, $content, $uid); } else { - // Send outdated way + // Send out out-dated way $msg = LOAD_EMAIL_TEMPLATE($templateName, $content, $uid); SEND_ADMIN_EMAILS($subject, $msg); } @@ -3090,13 +3080,13 @@ function HANDLE_EXTRA_VALUES ($filterFunction, $value, $extraValue) { } // Check if given FQFN is a readable file -function FILE_READABLE($fqfn) { +function FILE_READABLE ($FQFN) { // Check all... - return ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn))); + return ((file_exists($FQFN)) && (is_file($FQFN)) && (is_readable($FQFN))); } // Converts timestamp selections into a timestamp -function CONVERT_SELECTIONS_TO_TIMESTAMP(&$POST, &$DATA, &$id, &$skip) { +function CONVERT_SELECTIONS_TO_TIMESTAMP (&$POST, &$DATA, &$id, &$skip) { // Init test variable $test2 = ""; diff --git a/inc/gen_refback.php b/inc/gen_refback.php index 50f833ddef..6bec404ac9 100644 --- a/inc/gen_refback.php +++ b/inc/gen_refback.php @@ -71,13 +71,13 @@ ORDER BY u.userid ASC", __FILE__, __LINE__); // Do we have entries? if (SQL_NUMROWS($result_direct) > 0) { // When "walk" through all users - while (list($uid) = SQL_FETCHROW($result_direct)) { + while ($content = SQL_FETCHARRAY($result_direct)) { // Init level $GLOBALS['cache_array']['back_level'] = 1; // Update refback table - //* DEBUG: */ echo "uid={$uid}
\n"; - UPDATE_REFBACK_TABLE($uid); + //* DEBUG: */ echo "uid={$content['userid']}
\n"; + UPDATE_REFBACK_TABLE($content['userid']); } // END - while } // END - if diff --git a/inc/language/de.php b/inc/language/de.php index 463d470129..5250598e67 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -229,7 +229,7 @@ define('POINTS_REGISTER', "Willkommensgutschrift"); define('POINTS_REF', "Einmalige Referal-Gutschrift"); define('EDIT_REGFORM_SETTINGS', "Einstellungen am Anmeldeformular"); define('LEAST_CATS', "Mindestens auszuwä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!)"); @@ -759,8 +759,7 @@ define('ADMIN_EXT_ALREADY_INSTALLED_1', "Alle "); define('ADMIN_EXT_ALREADY_INSTALLED_2', " 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 "); -define('ADMIN_EXT_BONUS_OUTDATED_2', " oder höher wird benötigt!"); +define('ADMIN_EXT_BONUS_OUTDATED', "Ihre Bonus-Erweiterung ist veraltet! Version %s 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."); diff --git a/inc/language/en.php b/inc/language/en.php index 370b41463d..2dd11464ac 100644 --- a/inc/language/en.php +++ b/inc/language/en.php @@ -233,7 +233,7 @@ define('POINTS_REGISTER', "Wecome credit"); define('POINTS_REF', "Single referal credit"); define('EDIT_REGFORM_SETTINGS', "Settings for registration form"); define('LEAST_CATS', "Minium to select categories"); -define('CATS_LEAST', "Please select more categories! Minimum is"); +define('CATS_LEAST', "Please select more categories! Minimum is: %s"); define('EMAIL_ALREADY_DB', "You are already registered with your entered email address or someone else is using your email address. Registering twice is not allowed in our service."); define('REJECT_DOUBLE_EMAIL', "Prevent of registering with same email address?"); define('REJECT_DOUBLE_PASS', "Prevent of registering with same password? (Will not be displayed!)"); diff --git a/inc/language/holiday_de.php b/inc/language/holiday_de.php index cad193a294..05a58c6ad2 100644 --- a/inc/language/holiday_de.php +++ b/inc/language/holiday_de.php @@ -82,7 +82,7 @@ define('HOLIDAY_MEMBER_UNLOCK_SUBJ', "[HINWEIS:] Beendigung Ihres Urlaubes"); define('HOLIDAY_ADMIN_UNLOCK_SUBJ', "Automatische Urlaubsbeendigung"); define('HOLIDAY_ADMIN_DEAC_SUBJ', "Deaktivierung einer Urlaubsschaltung"); define('HOLIDAY_ADMIN_REMOVED_SUBJ', "[HINWEIS:] Ihr Urlaub wurde beendet"); -define('HOLIDAY_MEMBER_ACTIVATED', "[HINWEIS:] Ihre Urlaubsschaltung ist aktiviert"); +define('HOLIDAY_MEMBER_ACTIVATED_SUBJ', "[HINWEIS:] Ihre Urlaubsschaltung ist aktiviert"); // ?> diff --git a/inc/language/rallye_de.php b/inc/language/rallye_de.php index 0d38bec46c..69b771b948 100644 --- a/inc/language/rallye_de.php +++ b/inc/language/rallye_de.php @@ -96,12 +96,13 @@ define('RALLYE_START_NOTIFY_NOW', "Mitglieder autom. benachrichtigen"); 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 "); define('RALLYE_LIST_USERS_2', ""); define('RALLYE_OLD_REFS', "Refs vor Rallye"); @@ -113,12 +114,13 @@ define('_RALLYE_PRICE', "Platz"); define('RALLYE_EXPIRE_ONE_DAY', "Rallye endet in weniger als 24 Stunden!"); define('RALLYE_HAS_EXPIRED', "Diese Rallye ist beendet."); define('RALLYE_ADMIN_EXPIRED', "Rallye beendet"); -define('RALLYE_MEMBER_EXPIRED', "REF-RALLYE BEENDET"); +define('RALLYE_ADMIN_EXPIRED_SUBJ', "Rallye beendet: %s"); +define('RALLYE_MEMBER_EXPIRED_SUBJ', "REF-RALLYE BEENDET: %s. Platz"); define('RALLYE_YOU_CAN_WIN', "Was Sie gewinnen kö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"); @@ -129,7 +131,7 @@ define('RALLYE_REGISTER_NOW', "Jetzt kostenlos und unverbindlich anmelden!"); define('RALLYE_GET_REFLINK', "Jetzt dran teilnehmen!"); define('ADMIN_TASK_IS_RALLYE_EXPIRED', "Rallye wurde beendet"); define('ADMIN_TASK_IS_RALLYE_PURGED', "Rallye wurde gelö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 Verdienst durch Refs 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"); @@ -137,10 +139,8 @@ define('RALLYE_MIN_USERS_MINI', "Mitgliederanzahl erreicht"); 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 %s Mitglieder in unserem {!MT_WORD!} haben!"); +define('RALLYE_END_PRICES', "Die Rallye endet, sobald mindestens %s 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!"); diff --git a/inc/language/sponsor_de.php b/inc/language/sponsor_de.php index 0dac5d6dde..fd789e0901 100644 --- a/inc/language/sponsor_de.php +++ b/inc/language/sponsor_de.php @@ -116,6 +116,7 @@ define('ADMIN_TEXT_DEL_SPONSOR_1', "Möchten Sie den Sponsoren "); define('ADMIN_TEXT_DEL_SPONSOR_2', " mit samt aller seiner Bestellungen unwiederruflich löschen?"); define('ADMIN_SPONSOR_DELETED', "Sponsorenaccount %s 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 {!MAIN_TITLE!} 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!"); @@ -150,10 +151,8 @@ define('SPONSOR_PAYTYPE_NAME_NOTE', "Geben Sie eine passende Bezeichnung zum Buc define('SPONSOR_PAYTYPE_RATE_NOTE', "Wie viele {!POINTS!} soll der Sponsor für z.B. 1 € bekommen?"); define('SPONSOR_PAYTYPE_MIN_COUNT_NOTE', "Und wie oft soll dieses Buchungspaket mindestens 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 "); -define('ADMIN_SPONSOR_PAYTYPE_ALREADY_2', " bereits eingerichtet."); -define('ADMIN_SPONSOR_PAYTYPE_ADDED_1', "Buchungspaket "); -define('ADMIN_SPONSOR_PAYTYPE_ADDED_2', " hinzugefügt."); +define('ADMIN_SPONSOR_PAYTYPE_ALREADY', "Buchungspaket %s bereits eingerichtet."); +define('ADMIN_SPONSOR_PAYTYPE_ADDED', "Buchungspaket %s 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"); @@ -283,8 +282,7 @@ define('SPONSOR_ACCOUNT_IS_CONFIRMED_AGAIN', "Ihr Sponsorenaccount ist wieder fr // Sponsor area define('SPONSOR_NO_MAIN_MENUS_ACTIVE', "Keine Hauptmenüs aktiviert!"); define('SPONSOR_NO_SUB_MENUS_ACTIVE', "Keine Untermenüs aktiviert!"); -define('SPONSOR_CONTENT_404_1', "Konnte das Sponsor-Modul "); -define('SPONSOR_CONTENT_404_2', " auf dem Server nicht finden!"); +define('SPONSOR_CONTENT_404', "Konnte das Sponsor-Modul %s 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"); diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 6b6e03595c..291df01923 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -259,7 +259,7 @@ function ADMINS_EDIT_ADMIN_ACCOUNTS ($POST) { $currMode = GET_ADMIN_DEFAULT_ACL(GET_CURRENT_ADMIN_ID()); // Begin the edit loop - $SW = 2; $OUT = ""; + $OUT = ""; $SW = 2; foreach ($POST['sel'] as $id => $selected) { // Secure ID number $id = bigintval($id); @@ -305,7 +305,7 @@ function ADMINS_DELETE_ADMIN_ACCOUNTS ($POST) { SQL_FREERESULT($result_main); if ($accounts > 1) { // Delete accounts - $SW = 2; $OUT = ""; + $OUT = ""; $SW = 2; foreach ($POST['sel'] as $id => $selected) { // Secure ID number $id = bigintval($id); @@ -371,7 +371,7 @@ function ADMINS_REMOVE_ADMIN_ACCOUNTS ($POST) { function ADMINS_LIST_ADMIN_ACCOUNTS() { // Select all admin accounts $result = SQL_QUERY("SELECT id, login, email, default_acl AS mode, la_mode FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY login ASC", __FUNCTION__, __LINE__); - $SW = 2; $OUT = ""; + $OUT = ""; $SW = 2; while ($content = SQL_FETCHARRAY($result)) { // Compile some variables $content['mode'] = constant('ADMINS_'.strtoupper($content['mode']).'_MODE'); diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index 6679aa5f2f..8a17b66694 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -113,7 +113,7 @@ function BONUS_MAKE_RANK_ROWS ($data, $type, $uid) { $self = false; $OUT = ""; // How many ranks do we have? - $ranks = sizeof(explode(";", getConfig('turbo_rates'))) + 1; + $ranks = count(explode(";", getConfig('turbo_rates'))) + 1; // Load current user's data $result = SQL_QUERY_ESC("SELECT level, points, timemark FROM `{!_MYSQL_PREFIX!}_bonus_turbo` WHERE %s=%s AND userid=%s LIMIT 1", diff --git a/inc/libs/doubler_functions.php b/inc/libs/doubler_functions.php index 01720837be..d61ef96340 100644 --- a/inc/libs/doubler_functions.php +++ b/inc/libs/doubler_functions.php @@ -74,19 +74,20 @@ LIMIT ".$limit, __FUNCTION__, __LINE__); if (SQL_NUMROWS($result) > 0) { // List entries $OUT = ""; $SW = 2; - while (list($uid, $rid, $points, $time) = SQL_FETCHROW($result)) { + while ($content = SQL_FETCHARRAY($result)) { + // Rewrite userid/refid only if admin is in if (IS_ADMIN()) { // Set links to admin area - if ($uid > 0) { $uid = ADMIN_USER_PROFILE_LINK($uid); } else { $uid = "---"; } - if ($rid > 0) { $rid = ADMIN_USER_PROFILE_LINK($rid); } else { $rid = "---"; } - } + if ($content['userid'] > 0) { $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']); } else { $content['userid'] = "---"; } + if ($content['refid'] > 0) { $content['refid'] = ADMIN_USER_PROFILE_LINK($content['refid']); } else { $content['refid'] = "---"; } + } // END - if // Prepare data for the row template $content = array( - 'uid' => $uid, - 'rid' => $rid, - 'points' => TRANSLATE_COMMA($points), - 'stamp' => MAKE_DATETIME($time, $DT_MODE), + 'uid' => $content['userid'], + 'rid' => $content['refid'], + 'points' => TRANSLATE_COMMA($content['points']), + 'stamp' => MAKE_DATETIME($content['timemark'], $DT_MODE), 'sw' => $SW, ); diff --git a/inc/libs/holiday_functions.php b/inc/libs/holiday_functions.php index 0f19fee5f3..a706bc1b31 100644 --- a/inc/libs/holiday_functions.php +++ b/inc/libs/holiday_functions.php @@ -47,34 +47,41 @@ ORDER BY userid", __FUNCTION__, __LINE__); if (SQL_NUMROWS($result_stop) > 0) { // We foud at least one $admin = ""; - while (list($uid, $start, $end, $comments) = SQL_FETCHROW($result_stop)) { + // Init SQLs + INIT_SQLS(); + + // Process all found entries + while ($content = SQL_FETCHARRAY($result_stop)) { // Stop holiday - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_holidays` WHERE userid=%s LIMIT 1", - array(bigintval($uid)), __FUNCTION__, __LINE__); + ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_holidays` WHERE userid=%s LIMIT 1", + array(bigintval($content['userid'])), __FUNCTION__, __LINE__, false)); // Unlock account - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` + ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET holiday_active='N', holiday_activated='0' -WHERE userid=%s LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__); +WHERE userid=%s LIMIT 1", array(bigintval($content['userid'])), __FUNCTION__, __LINE__, false)); // Prepare array $content = array( - 'holiday_end' => MAKE_DATETIME($end , "3"), - 'holiday_start' => MAKE_DATETIME($start, "3"), - 'holiday_comments' => $comments + 'holiday_end' => MAKE_DATETIME($content['holiday_end'] , "3"), + 'holiday_start' => MAKE_DATETIME($content['holiday_start'], "3"), + 'holiday_comments' => $content['comments'] ); // Send mail to user - $msg = LOAD_EMAIL_TEMPLATE("member_holiday_unlock", $content, $uid); - SEND_EMAIL($uid, HOLIDAY_MEMBER_UNLOCK_SUBJ, $msg); + $msg = LOAD_EMAIL_TEMPLATE("member_holiday_unlock", $content, $content['userid']); + SEND_EMAIL($content['userid'], getMessage('HOLIDAY_MEMBER_UNLOCK_SUBJ'), $msg); // Remember userid for admin - $admin .= $uid."\n"; - } + $admin .= $content['userid']."\n"; + } // END - if // Send mail to admins - SEND_ADMIN_NOTIFICATION(HOLIDAY_ADMIN_UNLOCK_SUBJ, "admin_holiday_unlock", $admin, "0"); - } + SEND_ADMIN_NOTIFICATION(getMessage('HOLIDAY_ADMIN_UNLOCK_SUBJ'), "admin_holiday_unlock", $admin, "0"); + + // Run all SQLs + runFilterChain('run_sqls'); + } // END - if // Free memory SQL_FREERESULT($result_stop); diff --git a/inc/libs/payout_functions.php b/inc/libs/payout_functions.php index 9ab7329ec7..df8b39e840 100644 --- a/inc/libs/payout_functions.php +++ b/inc/libs/payout_functions.php @@ -40,7 +40,9 @@ if (!defined('__SECURITY')) { // function PAYOUT_OUTPUT_PAYOUT_LIST ($points) { // Replace german decimal comma with CPU's decimal dot - $points = strval(REVERT_COMMA($points)); + $points = REVERT_COMMA($points); + + // Enougth points? if ($points > 0) { // Pay this out! $result = SQL_QUERY_ESC("SELECT id, type, rate, min_points @@ -52,14 +54,17 @@ ORDER BY type", array($points), __FUNCTION__, __LINE__);
{--PAYOUT_NOW--}:

"); } else { diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index 039f36d788..eaf632379b 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -63,36 +63,24 @@ function RALLYE_AUTOSTART_RALLYES($result) $DATA['title'] = $title; $DATA['id'] = $id; // ID for the rallye details link - if ($min_users == 0) { - // Rallye ends without user limitation - $DATA['min_users'] = getMessage('RALLYE_END_NO_USER_LIMITATION'); - } else { - // Rallye ends when X members are totally in your exchange - $DATA['min_users'] = RALLYE_END_USERS_1." ".$min_users." ".RALLYE_END_USERS_2; - } - - if ($min_prices == 0) { - // Rallye ends without user limitation - $DATA['min_prices'] = getMessage('RALLYE_END_NO_PRICE_LIMITATION'); - } else { - // Rallye ends when X members are totally in your exchange - $DATA['min_prices'] = RALLYE_END_PRICES_1." ".$min_prices." ".RALLYE_END_PRICES_2; - } + // Determine min_users and min_prices + $DATA['min_users'] = RALLYE_DETERMINE_MIN_USERS($min_users); + $DATA['min_prices'] = RALLYE_DETERMINE_MIN_PRICES($min_prices); // Load prices $prices = RALLYE_ADD_PRICES($id); // Let's begin with the userids... - while (list($uid) = SQL_FETCHROW($result_user)) { + while ($content = SQL_FETCHARRAY($result_user)) { $un = false; // Get refs by userid - $cnt = RALLYE_GET_REFCOUNT($uid); + $cnt = RALLYE_GET_REFCOUNT($content['userid']); if (empty($cnt)) $cnt = 0; // Added prevent some unknown troubles... :-? // Check if line is already included... $result_ref = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s AND userid=%s LIMIT 1", - array(bigintval($id), bigintval($uid)), __FUNCTION__, __LINE__); + array(bigintval($id), bigintval($content['userid'])), __FUNCTION__, __LINE__); if (SQL_NUMROWS($result_ref) == 0) { // Free memory SQL_FREERESULT($result_ref); @@ -103,7 +91,7 @@ FROM `{!_MYSQL_PREFIX!}_user_points` AS p LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d ON p.userid=d.userid WHERE d.`status`='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth=1 AND p.points > 0 AND d.userid=%s", - array(getConfig('ref_payout'), bigintval($uid)), __FUNCTION__, __LINE__); + array(getConfig('ref_payout'), bigintval($content['userid'])), __FUNCTION__, __LINE__); list($cpoints) = SQL_FETCHROW($result_ref); SQL_FREERESULT($result_ref); @@ -112,7 +100,7 @@ WHERE d.`status`='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND // Add info line SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_rallye_users` (rallye_id, userid, refs, curr_points) VALUES ('%s','%s','%s','%s')", - array(bigintval($id), bigintval($uid), bigintval($cnt), $cpoints), __FUNCTION__, __LINE__); + array(bigintval($id), bigintval($content['userid']), bigintval($cnt), $cpoints), __FUNCTION__, __LINE__); $un = true; } // END - if @@ -122,8 +110,8 @@ VALUES ('%s','%s','%s','%s')", // Shall I notify this member? if (($notify == "Y") && ($un)) { // Load email template and send it to the user - $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $uid); - SEND_EMAIL($uid, RALLYE_MEMBER_NOTIFY.$title, $msg); + $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $content['userid']); + SEND_EMAIL($content['userid'], sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $msg); } // END - if } // END - while @@ -132,14 +120,13 @@ VALUES ('%s','%s','%s','%s')", if ($notify == "Y") $templ = "admin_rallye_notify"; // Send email to admin - SEND_ADMIN_NOTIFICATION(RALLYE_ADMIN_NOTIFY.$title, $templ, $prices, "0"); + SEND_ADMIN_NOTIFICATION(sprintf(getMessage('RALLYE_ADMIN_NOTIFY'), $title), $templ, $prices, "0"); // Free memory SQL_FREERESULT($result_user); } // -function RALLYE_ADD_PRICES($rallye,$mode="email") -{ +function RALLYE_ADD_PRICES ($rallye, $mode="email") { // Output mode switch($mode) { case "email": $mode = "\n"; break; @@ -148,45 +135,39 @@ function RALLYE_ADD_PRICES($rallye,$mode="email") // Load prices $result_prices = SQL_QUERY("SELECT price_level, points, info FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id='".$rallye."' ORDER BY price_level", __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result_prices) > 0) - { + if (SQL_NUMROWS($result_prices) > 0) { // Load prices - if ($mode == "\n") $prices = RALLYE_MEMBER_PRICES_ADDED.":".$mode."------------------------------".$mode; + if ($mode == "\n") $prices = "{--RALLYE_MEMBER_PRICES_ADDED--}:".$mode."------------------------------".$mode; $prices = ""; - while (list($level, $points, $info) = SQL_FETCHROW($result_prices)) - { - $prices .= $level.RALLYE_PRICE.": "; - if (!empty($info)) - { - $prices .= $info; - } - else - { - $prices .= $points." ".POINTS; + while ($content = SQL_FETCHARRAY($result_prices)) { + $prices .= $content['price_level'].getMessage('RALLYE_PRICE').": "; + if (!empty($content['info'])) { + $prices .= $content['info']; + } else { + $prices .= $content['points']." {!POINTS!}"; } $prices .= "".$mode; - } + } // END - if // Free memory SQL_FREERESULT($result_prices); - } - else - { + } else { // No prices??? - $prices = RALLYE_MEMBER_NO_PRICES.$mode; + $prices = sprintf(getMessage('RALLYE_MEMBER_NO_PRICES'), $mode); } + // Add last line for email mode if ($mode == "\n") $prices .= "------------------------------"; // Return price list return $prices; } + // -function RALLYE_ADD_TOPUSERS($rallye,$default=0) -{ +function RALLYE_ADD_TOPUSERS ($rallye, $default=0) { // First check how many prices are set $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s ORDER BY price_level", - array(bigintval($rallye)), __FUNCTION__, __LINE__); + array(bigintval($rallye)), __FUNCTION__, __LINE__); $prices = SQL_NUMROWS($result); SQL_FREERESULT($result); @@ -195,7 +176,7 @@ function RALLYE_ADD_TOPUSERS($rallye,$default=0) LEFT JOIN `{!_MYSQL_PREFIX!}_refsystem` AS r ON u.userid=r.userid WHERE u.rallye_id=%s AND r.counter > 0 ORDER BY u.refs DESC", - array(bigintval($rallye)), __FUNCTION__, __LINE__); + array(bigintval($rallye)), __FUNCTION__, __LINE__); // Load users $DATA = array( @@ -204,17 +185,16 @@ WHERE u.rallye_id=%s AND r.counter > 0 ORDER BY u.refs DESC", 'cpoints' => array() ); - while (list($uid, $refs, $cpoints) = SQL_FETCHROW($result)) - { + while ($content = SQL_FETCHARRAY($result)) { // Get current refs - $cnt = RALLYE_GET_REFCOUNT($uid, $refs); + $cnt = RALLYE_GET_REFCOUNT($content['userid'], $content['refs']); // Points of ref's $result_ref = SQL_QUERY_ESC("SELECT DISTINCT p.points FROM `{!_MYSQL_PREFIX!}_user_points` AS p LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d ON p.userid=d.userid WHERE d.userid=%s AND d.`status`='CONFIRMED' AND p.ref_depth=1 AND d.max_mails > 0 AND d.mails_confirmed >= %s -LIMIT 1", array(bigintval($uid), getConfig('ref_payout')), __FUNCTION__, __LINE__); +LIMIT 1", array(bigintval($content['userid']), getConfig('ref_payout')), __FUNCTION__, __LINE__); list($refpoints) = SQL_FETCHROW($result_ref); SQL_FREERESULT($result_ref); @@ -223,13 +203,13 @@ LIMIT 1", array(bigintval($uid), getConfig('ref_payout')), __FUNCTION__, __LINE_ // Init userid for list $_uid = "---"; // List only users with at least one ref! - //* DEBUG: */ echo "*".$cnt."/".$uid."/".$cpoints."/".$refpoints."*
\n"; - if (($cnt > 0) && ($refpoints > $cpoints)) { $_uid = $uid; } else { $cnt = ""; } + //* DEBUG: */ echo "*".$cnt."/".$content['userid']."/".$content['curr_points']."/".$refpoints."*
\n"; + if (($cnt > 0) && ($refpoints > $content['curr_points'])) { $_uid = $content['userid']; } else { $cnt = ""; } // Save values to array $DATA['uid'][] = $_uid; $DATA['ref'][] = $cnt; - $DATA['cpoints'][] = $cpoints; + $DATA['cpoints'][] = $content['curr_points']; } // Free memory @@ -268,8 +248,7 @@ LIMIT 1", array(bigintval($uid), getConfig('ref_payout')), __FUNCTION__, __LINE_ return $OUT; } // Run this function only when a new member has confirmed his email address! -function RALLYE_AUTOADD_USER($uid) -{ +function RALLYE_AUTOADD_USER ($uid) { global $DATA; $ADD = ""; @@ -321,25 +300,13 @@ VALUES ('%s','%s','0')", // Load prices $prices = RALLYE_ADD_PRICES($id); - if ($min_users == 0) { - // Rallye ends without user limitation - $DATA['min_users'] = RALLYE_END_NO_USER_LIMITATION; - } else { - // Rallye ends when X members are totally in your exchange - $DATA['min_users'] = RALLYE_END_USERS_1." ".$min_users." ".RALLYE_END_USERS_2; - } - - if ($min_prices == 0) { - // Rallye ends without user limitation - $DATA['min_prices'] = RALLYE_END_NO_PRICE_LIMITATION; - } else { - // Rallye ends when X members are totally in your exchange - $DATA['min_prices'] = RALLYE_END_PRICES_1." ".$min_prices." ".RALLYE_END_PRICES_2; - } + // Determine min_users/prices tring + $DATA['min_users'] = RALLYE_DETERMINE_MIN_USERS($min_users); + $DATA['min_prices'] = RALLYE_DETERMINE_MIN_PRICES($min_prices); // Send notification to member $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $uid); - SEND_EMAIL($uid, RALLYE_MEMBER_NOTIFY.$title, $msg); + SEND_EMAIL($uid, sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $msg); } // END - if } // END - if } @@ -431,7 +398,7 @@ LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__); $DATA['infos'] = $DATA['info']; } else { // Take points - $DATA['infos'] = $DATA['points']." ".POINTS; + $DATA['infos'] = $DATA['points']." {!POINTS!}"; } // Add suffix to template name @@ -439,7 +406,7 @@ LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__); // Load template $msg = LOAD_EMAIL_TEMPLATE($template, $DATA, $uid); - SEND_EMAIL($uid, RALLYE_MEMBER_EXPIRED.": ".$DATA['level']." "._RALLYE_PRICE, $msg); + SEND_EMAIL($uid, sprintf(getMessage('RALLYE_MEMBER_EXPIRED_SUBJ'), $DATA['level']), $msg); } // END - if // Count userid @@ -458,36 +425,44 @@ LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__); } // Send mail to admin - SEND_ADMIN_NOTIFICATION(RALLYE_ADMIN_EXPIRED.": ".$title, $templ, $cnt, 0); + SEND_ADMIN_NOTIFICATION(sprintf(getMessage('RALLYE_ADMIN_EXPIRED_SUBJ'), $title), $templ, $cnt, 0); // Add task SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (status, task_type, subject, text, task_created) -VALUES ('NEW','RALLYE_EXPIRED','".RALLYE_ADMIN_EXPIRED.": %s','".RALLYE_ADMIN_EXPIRED_TEXT."',UNIX_TIMESTAMP())", - array($title), __FUNCTION__, __LINE__); +VALUES ('NEW','RALLYE_EXPIRED','{--RALLYE_ADMIN_EXPIRED--}: %s','{--RALLYE_ADMIN_EXPIRED_TEXT--}',UNIX_TIMESTAMP())", + array($title), __FUNCTION__, __LINE__); // All work done here... } + // -function RALLYE_LOAD_USER_DATA($uids_array) -{ +function RALLYE_LOAD_USER_DATA ($uids_array) { // Implode user ids $uid_string = implode(",", $uids_array['uid']); + // Init result string + $ret = ""; + // Load users $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid IN(%s) AND `status`='CONFIRMED' ORDER BY userid LIMIT %s", - array($uid_string, count($uids_array)), __FUNCTION__, __LINE__); - $ret = ""; - while (list($u, $gender, $surname, $family, $email) = SQL_FETCHROW($result)) - { - $ret .= TRANSLATE_GENDER($gender)." ".$surname." ".$family." (".$email.") - ".$uids_array['poi'][$u]."\n"; - } + array($uid_string, count($uids_array)), __FUNCTION__, __LINE__); + while ($content = SQL_FETCHARRAY($result)) { + // Construct the message masked and add it + $ret .= sprintf("%s %s %s (%s) - %s\n", + TRANSLATE_GENDER($content['gender']), + $content['surname'], + $content['family'], + $content['email'], + $uids_array['poi'][$content['userid']] + ); + } // END - while // Return result return substr($ret, 0, -1); } + // -function RALLYE_LOAD_PRICES_ARRAY($rallye) -{ +function RALLYE_LOAD_PRICES_ARRAY ($rallye) { // Init multi array $prices = array( 'level' => array(), @@ -497,13 +472,14 @@ function RALLYE_LOAD_PRICES_ARRAY($rallye) // Load prices $result = SQL_QUERY_ESC("SELECT price_level, points, info FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s ORDER BY price_level", - array(bigintval($rallye)), __FUNCTION__, __LINE__); - while (list($level, $points, $info) = SQL_FETCHROW($result)) - { - $prices['level'][] = $level; - $prices['points'][] = $points; - $prices['info'][] = $info; - } + array(bigintval($rallye)), __FUNCTION__, __LINE__); + + // Transfer elements + while ($content = SQL_FETCHARRAY($result)) { + $prices['level'][] = $content['price_level']; + $prices['points'][] = $content['points']; + $prices['info'][] = $content['info']; + } // END - while // Free memory SQL_FREERESULT($result); @@ -527,9 +503,9 @@ function RALLYE_LOAD_USERS_ARRAY ($rallye) { // Load users uid old points earned $result_user = SQL_QUERY_ESC("SELECT userid, refs, curr_points FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s ORDER BY userid", array(bigintval($rallye)), __FUNCTION__, __LINE__); - while (list($uid, $refs, $cpoints) = SQL_FETCHROW($result_user)) { + while ($content = SQL_FETCHARRAY($result_user)) { // Load current ref count - $cnt = RALLYE_GET_REFCOUNT($uid, $refs); + $cnt = RALLYE_GET_REFCOUNT($content['userid'], $content['refs']); // Points of ref's $result_ref = SQL_QUERY_ESC("SELECT DISTINCT SUM(p.points) @@ -537,16 +513,17 @@ FROM `{!_MYSQL_PREFIX!}_user_points` AS p LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d ON p.userid=d.userid WHERE d.`status`='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth=1 AND p.points > 0 AND d.userid=%s", - array(getConfig('ref_payout'), bigintval($uid)), __FUNCTION__, __LINE__); + array(getConfig('ref_payout'), bigintval($content['userid'])), __FUNCTION__, __LINE__); list($refpoints) = SQL_FETCHROW($result_ref); SQL_FREERESULT($result_ref); + // Fix empty refpoints if (empty($refpoints)) $refpoints = 0; // Store calculated new refs to array - $users['uid'][] = $uid; - $users['ref'][] = abs($cnt - $refs); - $users['cpoints'][] = $refpoints - $cpoints; + $users['uid'][] = $content['userid']; + $users['ref'][] = abs($cnt - $content['refs']); + $users['cpoints'][] = $refpoints - $content['curr_points']; } // Free memory @@ -613,7 +590,7 @@ function RALLYE_LIST_WINNERS ($rallye, $default=0) { else { // Take ppints - $DATA['infos'][$idx] = $DATA['points'][$idx]." ".POINTS; + $DATA['infos'][$idx] = $DATA['points'][$idx]." {!POINTS!}"; } // Add row @@ -644,9 +621,9 @@ function RALLYE_LIST_WINNERS ($rallye, $default=0) { // And finnally return the output return $OUT; } + // -function RALLYE_DELETE_EXPIRED_RALLYES() -{ +function RALLYE_DELETE_EXPIRED_RALLYES () { global $DATA; // Check for expired rallyes @@ -656,34 +633,39 @@ FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE end_time <= (UNIX_TIMESTAMP() - %s) AND expired='Y'", array($EXPIRE), __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result_rallye) > 0) - { + if (SQL_NUMROWS($result_rallye) > 0) { + // Init SQLs + INIT_SQLS(); + // Expire found rallyes and notify admin - while (list($id, $title, $start, $end) = SQL_FETCHROW($result_rallye)) - { + while ($content = SQL_FETCHARRAY($result_rallye)) { // Prepare data for mail template - $DATA['title'] = $title; - $DATA['start'] = MAKE_DATETIME($start, "1"); - $DATA['end'] = MAKE_DATETIME($end , "1"); + $DATA['title'] = $content['title']; + $DATA['start'] = MAKE_DATETIME($content['start_time'], "1"); + $DATA['end'] = MAKE_DATETIME($content['end_time'] , "1"); $DATA['now_t'] = MAKE_DATETIME(time(), "1"); // Send mail to admin - SEND_ADMIN_NOTIFICATION(RALLYE_ADMIN_PURGED.": ".$title, "admin_rallye_purged", "", 0); + SEND_ADMIN_NOTIFICATION(sprintf(getMessage('RALLYE_ADMIN_PURGED_SUBJ'), $content['title']), "admin_rallye_purged", "", 0); // Purge whole rallye - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE id=%s LIMIT 1", - array(bigintval($id)), __FUNCTION__, __LINE__); - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s LIMIT 1", - array(bigintval($id)), __FUNCTION__, __LINE__); - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s LIMIT 1", - array(bigintval($id)), __FUNCTION__, __LINE__); - } - - // Add task - SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (status, task_type, subject, text, task_created) + ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE id=%s LIMIT 1", + array(bigintval($content['id'])), __FUNCTION__, __LINE__, false)); + ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s LIMIT 1", + array(bigintval($content['id'])), __FUNCTION__, __LINE__, false)); + ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s LIMIT 1", + array(bigintval($content['id'])), __FUNCTION__, __LINE__, false)); + + // Add task + // @TODO Rewrite this to a function + ADD_SQL(SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (status, task_type, subject, text, task_created) VALUES ('NEW','RALLYE_PURGED','{--RALLYE_ADMIN_PURGED--}: %s','{--RALLYE_ADMIN_PURGED_TEXT--}',UNIX_TIMESTAMP())", - array($title), __FUNCTION__, __LINE__); - } + array($content['title']), __FUNCTION__, __LINE__, false)); + } // END - while + + // Run all SQLs + runFilterChain('run_sqls'); + } // END - if // Free memory SQL_FREERESULT($result_rallye); @@ -732,7 +714,7 @@ function RALLYE_TEMPLATE_SELECTION($name="template", $default="") return $OUT; } // -function RALLYE_GET_REFCOUNT($uid, $old=0) { +function RALLYE_GET_REFCOUNT ($uid, $old=0) { // Check current refs if (GET_EXT_VERSION("cache") >= "0.1.2") { // Get refs from cache @@ -792,6 +774,34 @@ WHERE s.userid=%s AND s.level=1", array(bigintval($uid)), __FUNCTION__, __LINE__ return $cnt; } +// Determines the right language string for min_users +function RALLYE_DETERMINE_MIN_USERS ($min_users) { + // Rallye ends without user limitation is the default + $return = getMessage('RALLYE_END_NO_USER_LIMITATION'); + + if ($min_users > 0) { + // Rallye ends when X members are totally in your exchange + $return = sprintf(getMessage('RALLYE_END_USERS'), $min_users); + } // END - if + + // Return + return $return; +} + +// Determines the right language string for min_prices +function RALLYE_DETERMINE_MIN_PRICES ($min_prices) { + // Rallye ends without user limitation is the default + $return = getMessage('RALLYE_END_NO_PRICE_LIMITATION'); + + if ($min_prices > 0) { + // Rallye ends when X members are totally in your exchange + $return = sprintf(getMessage('RALLYE_END_PRICES'), $min_prices); + } // END - if + + // Return + return $return; +} + // Filter for extra-autpurge function FILTER_RALLYE_EXTRA_AUTOPURGE () { // Check expired rallyes (hard-coded 3 days limit for displaying expired rallyes!) diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php index 6f45e9307e..d08c83bc4b 100644 --- a/inc/libs/refback_functions.php +++ b/inc/libs/refback_functions.php @@ -47,16 +47,17 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) { $return = $points; // Get all ref levels - $result_refs = SQL_QUERY("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE level > 0 ORDER BY level ASC", __FUNCTION__, __LINE__); + $result_refs = SQL_QUERY("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE level > 0 ORDER BY level ASC", + __FUNCTION__, __LINE__); // "Walk" through all level - while (list($level, $perc) = SQL_FETCHROW($result_refs)) { + while ($content = SQL_FETCHARRAY($result_refs)) { // Reset ref depths unset($GLOBALS['ref_level']); // "Walk" through all refids - //* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},ref={$ref},level={$level},points={$points}
\n"; - foreach (GET_REFBACK_USERID_ARRAY($uid, $level) as $refid) { + //* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},ref={$ref},level={$content['level']},points={$points}
\n"; + foreach (GET_REFBACK_USERID_ARRAY($uid, $content['level']) as $refid) { // Skip level zero or if both are the same if ($uid == $refid) continue; @@ -66,9 +67,9 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) { // Some percents given? if ($percents > 0) { - //* DEBUG: */ print __FUNCTION__."(".__LINE__."):points={$points},perc={$perc},percents={$percents},level={$level}
\n"; + //* DEBUG: */ print __FUNCTION__."(".__LINE__."):points={$points},perc={$content['percents']},percents={$percents},level={$content['level']}
\n"; // Calculate points for refback - $refback = $points * ($perc / 100) * ($percents / 100); + $refback = $points * ($content['percents'] / 100) * ($percents / 100); // Update refback table ("refid" and "uid" must be exchanged!) SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_refs` SET points=points+%s WHERE userid=%s AND refid=%s LIMIT 1", @@ -82,7 +83,7 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) { // Reduce points if refid is found if ($refid == $ref) { // Reduce points here! - $return = $points * ($perc / 100) - $refback; + $return = $points * ($content['percents'] / 100) - $refback; //* DEBUG: */ print __FUNCTION__."(".__LINE__."):points={$return} - REDUCED
\n"; } // END - if } // END - if @@ -151,9 +152,9 @@ ORDER BY userid ASC", //* DEBUG: */ print __FUNCTION__."(".__LINE__."):numRows=".SQL_NUMROWS($result)."
\n"; if (SQL_NUMROWS($result) > 0) { // Add all - while (list($userid) = SQL_FETCHROW($result)) { - //* DEBUG: */ print __FUNCTION__."(".__LINE__."):rid={$rid},level={$level},userid={$userid}
\n"; - $userIds[] = $userid; + while ($content = SQL_FETCHARRAY($result)) { + //* DEBUG: */ print __FUNCTION__."(".__LINE__."):rid={$rid},level={$level},userid={$content['userid']}
\n"; + $userIds[] = $content['userid']; } // END - while } // END - if @@ -167,7 +168,7 @@ ORDER BY userid ASC", } // Update "refback table" -function UPDATE_REFBACK_TABLE($uid) { +function UPDATE_REFBACK_TABLE ($uid) { //* DEBUG: */ print "----------------------- ".__FUNCTION__." - ENTRY ------------------------