From 0e66cfbc7b29edeb2e8e1315408e3e3573f1fc2b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 10 Oct 2009 22:03:54 +0000 Subject: [PATCH] A lot constants rewritten to array elements --- DOCS/TODOs.txt | 4 +- mailid.php | 16 +++---- mailid_top.php | 47 +++++++++---------- .../de/html/mailid/mailid_confirm_buttom.tpl | 6 +-- .../de/html/mailid/mailid_enter_code.tpl | 4 +- templates/de/html/mailid/mailid_frames.tpl | 4 +- .../de/html/mailid/mailid_points_done.tpl | 6 +-- .../de/html/mailid/mailid_points_done2.tpl | 8 ++-- .../de/html/mailid/mailid_points_failed.tpl | 4 +- .../de/html/mailid/mailid_points_locked.tpl | 4 +- .../de/html/mailid/mailid_points_locked2.tpl | 6 +-- templates/de/html/mailid/mailid_timer.tpl | 8 ++-- 12 files changed, 57 insertions(+), 60 deletions(-) diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 0d09469c8b..79e5a0bf68 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -233,14 +233,12 @@ ./inc/wrapper-functions.php:159:// @TODO Implement $decompress ./inc/wrapper-functions.php:389:// @TODO Do some more sanity check here ./mailid.php:140: // @TODO Rewrite this to a filter -./mailid.php:185: // @TODO Rewrite these constants ./mailid.php:221: // @TODO Rewrite this to a filter ./mailid.php:96: // @TODO Rewrite this to a filter ./mailid_top.php:136: // @TODO Rewrite this to a filter ./mailid_top.php:183: // @TODO Rewrite this to a filter ./mailid_top.php:190: // @TODO Rewrite this to a filter -./mailid_top.php:223: // @TODO Rewrite these constants -./mailid_top.php:228: // @TODO Rewrite these blocks to filter +./mailid_top.php:227: // @TODO Rewrite these blocks to filter ./mailid_top.php:89: // @TODO Rewrite this to a filter ./show_bonus.php:108: // @TODO Rewrite this constant ./view.php:72: // @TODO No banner found, output some default banner diff --git a/mailid.php b/mailid.php index 34de985628..c0caa5ad91 100644 --- a/mailid.php +++ b/mailid.php @@ -148,7 +148,7 @@ if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors $time = getPaymentPoints($pay, 'time'); $payment = getPaymentPoints($pay, 'payment'); $isValid = true; - } + } // END - if // Free memory SQL_FREERESULT($result); @@ -156,7 +156,7 @@ if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors case 'BONUS': $result = SQL_QUERY_ESC("SELECT points, time FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1", - array($url_bid), __FILE__, __LINE__); + array($url_bid), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { list($points, $time) = SQL_FETCHROW($result); $payment = '0.00000'; @@ -180,13 +180,13 @@ if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors // If time is zero seconds we have a sponsor mail. 1 Second shall be set to avoid problems if (($time == '0') && ($payment > 0)) { $URL = constant('URL'); $time = '1'; } if (($time > 0) && (($payment > 0) || ($points > 0))) { - // He can confirm this mail! // Export data into constants for the template - // @TODO Rewrite these constants - define('_UID_VALUE' , $url_uid); - define('_TYPE_VALUE', $type); - define('_DATA_VALUE', $urlId); - define('_URL_VALUE' , DEREFERER($URL)); + $content = array( + 'uid' => $url_uid, + 'type' => $type, + 'data' => $urlId, + 'url' => DEREFERER($URL) + ); // Load template LOAD_TEMPLATE('mailid_frames'); diff --git a/mailid_top.php b/mailid_top.php index 3457613e5a..f670abbd9c 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -220,9 +220,8 @@ if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors } // Export data into constants for the template - // @TODO Rewrite these constants - define('_POINTS_VALUE' , translateComma($payment)); - define('_TEMPLATE_BANNER', LOAD_TEMPLATE('mailid_banner', true)); + $content['points'] = translateComma($payment); + $content['banner'] = LOAD_TEMPLATE('mailid_banner', true); // Only when user extension = v0.1.2: Update mails-confirmed counter // @TODO Rewrite these blocks to filter @@ -270,22 +269,22 @@ if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors // Shall I exclude the webmaster's own userid from the active-rallye? if ((((getConfig('bonus_uid') == $url_uid) && (getConfig('bonus_include_own') == 'Y')) || (getConfig('bonus_uid') != $url_uid)) && (getConfig('def_refid') != $url_uid)) { // Add points and remember ranking are done in this function.... - BONUS_ADD_TURBO_POINTS($urlId, $url_uid, $type); + BONUS_ADD_TURBO_POINTS($payment, $url_uid, $type); // Set template to mailid_points_done2 which contains a link to the ranking list $template = 'mailid_points_done2'; if ($locked) $template = 'mailid_points_locked2'; - define('_UID_VALUE' , $url_uid); - define('_TYPE_VALUE', $type); - define('_DATA_VALUE', translateComma($urlId)); + $content['uid'] = $url_uid; + $content['type'] = $type; + $content['data'] = translateComma($payment); } // END - if } // END - if } // END - if // Load total points - define('__TOTAL_POINTS', translateComma( - GET_TOTAL_DATA($url_uid, 'user_points', 'points') - - GET_TOTAL_DATA($url_uid, 'user_data', 'used_points')) + $content['total'] = translateComma( + GET_TOTAL_DATA($url_uid, 'user_points', 'points') - + GET_TOTAL_DATA($url_uid, 'user_data', 'used_points') ); // Load template @@ -301,7 +300,7 @@ if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors // Remove link from table SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `id`=%s LIMIT 1", - array(bigintval($lid)), __FILE__, __LINE__); + array(bigintval($lid)), __FILE__, __LINE__); break; case 'img': @@ -311,18 +310,18 @@ if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors case 'confirm': if ($code > 0) { // Export data into constants for the template - define('_CODE_VALUE', $code); - define('_UID_VALUE' , $url_uid ); - define('_TYPE_VALUE', $type); - define('_DATA_VALUE', $urlId); - define('_TEMPLATE_BANNER', LOAD_TEMPLATE('mailid_banner', true)); + $content['code'] = $code; + $content['uid'] = $url_uid; + $content['type'] = $type; + $content['data'] = $urlId; + $content['banner'] = LOAD_TEMPLATE('mailid_banner', true); if (getConfig('code_length') > 0) { // Generate Code define('_IMAGE_CODE', generateCaptchaCode($code, $type, $urlId, $url_uid)); $templ = 'mailid_enter_code'; } else { // Disabled code - define('__GFX_CODE', $img_code); + $content['gfx'] = $img_code; $templ = 'mailid_confirm_buttom'; } @@ -334,13 +333,13 @@ if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors case '': // Ok, all data is valid and loaded. Finally let's output the timer... :-) // Export data into constants for the template - define('_TIME_VALUE', $time); - define('_TIM2_VALUE', strlen($time)); - define('_UID_VALUE' , $url_uid ); - define('_TYPE_VALUE', $type); - define('_DATA_VALUE', $urlId); - define('_RAND_VALUE', mt_rand(0, 99999)); - define('_TEMPLATE_BANNER', LOAD_TEMPLATE('mailid_banner', true)); + $content['time'] = $time; + $content['tim2'] = strlen($time); + $content['uid'] = $url_uid; + $content['type'] = $type; + $content['data'] = $urlId; + $content['rand'] = mt_rand(0, 99999); + $content['banner'] = LOAD_TEMPLATE('mailid_banner', true); // Load template LOAD_TEMPLATE('mailid_timer'); diff --git a/templates/de/html/mailid/mailid_confirm_buttom.tpl b/templates/de/html/mailid/mailid_confirm_buttom.tpl index 8fda6ef28c..9fda0beba1 100644 --- a/templates/de/html/mailid/mailid_confirm_buttom.tpl +++ b/templates/de/html/mailid/mailid_confirm_buttom.tpl @@ -2,9 +2,9 @@   -
+ {--MAILID_CLICK_BUTTON--}:
- +
@@ -15,7 +15,7 @@   - {--_TEMPLATE_BANNER--} + $content[banner]   diff --git a/templates/de/html/mailid/mailid_enter_code.tpl b/templates/de/html/mailid/mailid_enter_code.tpl index f080e90d79..8f0cf6c349 100644 --- a/templates/de/html/mailid/mailid_enter_code.tpl +++ b/templates/de/html/mailid/mailid_enter_code.tpl @@ -4,7 +4,7 @@  
{--ENTER_CODE--}: {--_IMAGE_CODE--}
  - {--_TEMPLATE_BANNER--} + $content[banner]   diff --git a/templates/de/html/mailid/mailid_frames.tpl b/templates/de/html/mailid/mailid_frames.tpl index fe9471ebc1..76ad74293d 100644 --- a/templates/de/html/mailid/mailid_frames.tpl +++ b/templates/de/html/mailid/mailid_frames.tpl @@ -1,6 +1,6 @@ - - + + Ihr Browser unterst&uuml;tzt keine frames! diff --git a/templates/de/html/mailid/mailid_points_done.tpl b/templates/de/html/mailid/mailid_points_done.tpl index a9e7bbb1dd..35b04ffe30 100644 --- a/templates/de/html/mailid/mailid_points_done.tpl +++ b/templates/de/html/mailid/mailid_points_done.tpl @@ -3,8 +3,8 @@ <tr> <td width="10" class="seperator">&nbsp;</td> <td width="220" align="center">{--THANX_POINTS_ADDED_1--}<strong - class="member_done">{--_POINTS_VALUE!}</strong>&nbsp;{--THANX_POINTS_ADDED_2--}<br /> - {--MAILID_TOTAL_POINTS1--} <div class="member_done">{!__TOTAL_POINTS!} + class="member_done">$content[points]</strong>&nbsp;{--THANX_POINTS_ADDED_2--}<br /> + {--MAILID_TOTAL_POINTS1--} <div class="member_done">$content[total] {!POINTS!}</div> {--MAILID_TOTAL_POINTS2--}</td> <td width="10" class="seperator">&nbsp;</td> <td align="center"> @@ -14,7 +14,7 @@ class="member_banner dashed"> <td height="3" class="seperator">&nbsp;</td> </tr> <tr> - <td align="center">{--_TEMPLATE_BANNER--}</td> + <td align="center">$content[banner]</td> </tr> <tr> <td height="4" class="seperator">&nbsp;</td> diff --git a/templates/de/html/mailid/mailid_points_done2.tpl b/templates/de/html/mailid/mailid_points_done2.tpl index 3e7b41364c..83bfc9fc30 100644 --- a/templates/de/html/mailid/mailid_points_done2.tpl +++ b/templates/de/html/mailid/mailid_points_done2.tpl @@ -4,12 +4,12 @@ <tr> <td width="10" class="seperator">&nbsp;</td> <td width="220" align="center"><div class="tiny"> - {--THANX_POINTS_ADDED_1--}<span class="member_done">{--_POINTS_VALUE!}</span>&nbsp;{--THANX_POINTS_ADDED_2--}<br /> - {--MAILID_TOTAL_POINTS1--} <span class="member_done">{!__TOTAL_POINTS!} + {--THANX_POINTS_ADDED_1--}<span class="member_done">$content[points]</span>&nbsp;{--THANX_POINTS_ADDED_2--}<br /> + {--MAILID_TOTAL_POINTS1--} <span class="member_done">$content[total] {!POINTS!}</span> {--MAILID_TOTAL_POINTS2--}<br /> <br /> <a - href="{!URL!}/show_bonus.php?uid={!_UID_VALUE!}&amp;t={!_TYPE_VALUE!}&amp;d={!_DATA_VALUE!}" + href="{!URL!}/show_bonus.php?uid=$content[uid]&amp;t=$content[type]&amp;d=$content[data]" target="_blank">{--BONUS_SHOW_TURBO_BONUS--} </span></td> <td width="10" class="seperator">&nbsp;</td> <td align="center"> @@ -19,7 +19,7 @@ <td height="3" class="seperator">&nbsp;</td> </tr> <tr> - <td align="center">{--_TEMPLATE_BANNER--}</td> + <td align="center">$content[banner]</td> </tr> <tr> <td height="4" class="seperator">&nbsp;</td> diff --git a/templates/de/html/mailid/mailid_points_failed.tpl b/templates/de/html/mailid/mailid_points_failed.tpl index 41e15d9002..4f795ee8e3 100644 --- a/templates/de/html/mailid/mailid_points_failed.tpl +++ b/templates/de/html/mailid/mailid_points_failed.tpl @@ -3,7 +3,7 @@ <tr> <td width="10" class="seperator">&nbsp;</td> <td width="220" align="center">{--POINTS_NOT_ADDED_1--}<strong - class="member_failed">{--_POINTS_VALUE!}</strong>&nbsp;{--POINTS_NOT_ADDED_2--} + class="member_failed">$content[points]</strong>&nbsp;{--POINTS_NOT_ADDED_2--} </td> <td width="10" class="seperator">&nbsp;</td> <td align="center"> @@ -13,7 +13,7 @@ <td height="3" class="seperator">&nbsp;</td> </tr> <tr> - <td align="center">{--_TEMPLATE_BANNER--}</td> + <td align="center">$content[banner]</td> </tr> <tr> <td height="4" class="seperator">&nbsp;</td> diff --git a/templates/de/html/mailid/mailid_points_locked.tpl b/templates/de/html/mailid/mailid_points_locked.tpl index 325ab9f9b3..5a6e61307c 100644 --- a/templates/de/html/mailid/mailid_points_locked.tpl +++ b/templates/de/html/mailid/mailid_points_locked.tpl @@ -3,7 +3,7 @@ <tr> <td width="10" class="seperator">&nbsp;</td> <td width="220" align="center">{--THANX_POINTS_LOCKED_1--}<strong - class="member_done">{--_POINTS_VALUE!}</strong>&nbsp;{--THANX_POINTS_LOCKED_2--}<br /> + class="member_done">$content[points]</strong>&nbsp;{--THANX_POINTS_LOCKED_2--}<br /> </td> <td width="10" class="seperator">&nbsp;</td> <td align="center"> @@ -13,7 +13,7 @@ <td height="3" class="seperator">&nbsp;</td> </tr> <tr> - <td align="center">{--_TEMPLATE_BANNER--}</td> + <td align="center">$content[banner]</td> </tr> <tr> <td height="4" class="seperator">&nbsp;</td> diff --git a/templates/de/html/mailid/mailid_points_locked2.tpl b/templates/de/html/mailid/mailid_points_locked2.tpl index 9f03f78035..1bb6a53f9f 100644 --- a/templates/de/html/mailid/mailid_points_locked2.tpl +++ b/templates/de/html/mailid/mailid_points_locked2.tpl @@ -4,10 +4,10 @@ <tr> <td width="10" class="seperator">&nbsp;</td> <td width="220" align="center"><div class="tiny"> - {--THANX_POINTS_LOCKED_1--}<span class="member_done">{--_POINTS_VALUE!}</span>&nbsp;{--THANX_POINTS_LOCKED_2--}<br /> + {--THANX_POINTS_LOCKED_1--}<span class="member_done">$content[points]</span>&nbsp;{--THANX_POINTS_LOCKED_2--}<br /> <br /> <a - href="{!URL!}/show_bonus.php?uid={!_UID_VALUE!}&amp;t={!_TYPE_VALUE!}&amp;d={!_DATA_VALUE!}" + href="{!URL!}/show_bonus.php?uid=$content[uid]&amp;t=$content[type]&amp;d=$content[data]" target="_blank">{--BONUS_SHOW_TURBO_BONUS--} </span></td> <td width="10" class="seperator">&nbsp;</td> <td align="center"> @@ -17,7 +17,7 @@ <td height="3" class="seperator">&nbsp;</td> </tr> <tr> - <td align="center">{--_TEMPLATE_BANNER--}</td> + <td align="center">$content[banner]</td> </tr> <tr> <td height="4" class="seperator">&nbsp;</td> diff --git a/templates/de/html/mailid/mailid_timer.tpl b/templates/de/html/mailid/mailid_timer.tpl index a95f42e73d..30c594fb80 100644 --- a/templates/de/html/mailid/mailid_timer.tpl +++ b/templates/de/html/mailid/mailid_timer.tpl @@ -14,7 +14,7 @@ function StartCounter() { Timer--; document.confirm.counter.value = Timer; if (Timer == 0) { - document.location.href="{!URL!}/mailid_top.php?uid={!_UID_VALUE!}&{!_TYPE_VALUE!}={!_DATA_VALUE!}&mode=confirm&code={--_RAND_VALUE!}"; + document.location.href="{!URL!}/mailid_top.php?uid=$content[uid]&$content[type]=$content[data]&mode=confirm&code=$content[rand]"; clearInterval(Counter); } } @@ -34,8 +34,8 @@ function StartCounter() { <td align="center"> <form name="confirm" style="margin-top: 0px; margin-bottom: 0px"> {--MEMBER_TIME_COUNTER_1--} <input type="text" name="counter" - size="{--_TIM2_VALUE!}" readonly class="member_normal" - value="{--_TIME_VALUE!}">&nbsp;{--_SECONDS--} + size="$content[tim2]" readonly class="member_normal" + value="$content[time]">&nbsp;{--_SECONDS--} {--MEMBER_TIME_COUNTER_2--}</form> </td> </tr> @@ -52,7 +52,7 @@ function StartCounter() { <td height="3" class="seperator">&nbsp;</td> </tr> <tr> - <td align="center">{--_TEMPLATE_BANNER--}</td> + <td align="center">$content[banner]</td> </tr> <tr> <td height="4" class="seperator">&nbsp;</td> -- 2.30.2