X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fguest%2Fwhat-sponsor_infos.php;h=2539e16300381cc65e277c1f90a87f51b06e4418;hp=a4723fdf58ff0be5abf49dec7f6873ed762a5e48;hb=4001187f22197f55e5a1f211fc8defcc180f7c32;hpb=a47a9c49a7813304ac78deb3741bdd85e6d50912 diff --git a/inc/modules/guest/what-sponsor_infos.php b/inc/modules/guest/what-sponsor_infos.php index a4723fdf58..2539e16300 100644 --- a/inc/modules/guest/what-sponsor_infos.php +++ b/inc/modules/guest/what-sponsor_infos.php @@ -42,8 +42,9 @@ if (!defined('__SECURITY')) { // Add description as navigation point ADD_DESCR("guest", __FILE__); -// Remove result_act -unset($result_act); +// Init both results (see footer of this file) +$result_act = false; +$result_pay = false; // Load all sponsor actions $result_act = SQL_QUERY("SELECT DISTINCT m.title, c.conv_rate, c.conv_name @@ -52,18 +53,18 @@ LEFT JOIN `{!_MYSQL_PREFIX!}_sponsor_action_convert` AS c ON m.what=c.ext_name LEFT JOIN `{!_MYSQL_PREFIX!}_sponsor_registry` AS r ON m.what=r.ext_name WHERE m.action='actions' AND r.is_active='Y' ORDER BY m.sort ASC", __FILE__, __LINE__); -$num_act = SQL_NUMROWS($result_act); -if ($num_act > 0) { +if (SQL_NUMROWS($result_act) > 0) { // Load all actions $OUT_ACT = ""; $SW = 2; - while (list($title, $conv, $name) = SQL_FETCHROW($result_act)) { + while ($content = SQL_FETCHARRAY($result_act)) { // Prepare data for the row template + // @TODO Rewritings: conv->conv_rate,name->conv_name in template $content = array( 'sw' => $SW, - 'title' => $title, - 'conv' => round($conv), - 'name' => $name, + 'title' => $content['title'], + 'conv' => round($content['conv_rate']), + 'name' => $content['conv_name'], ); // Load row template and switch color @@ -76,15 +77,16 @@ if ($num_act > 0) { if (SQL_NUMROWS($result_pay) > 0) { // Load all pay types $OUT_PAY = ""; $SW = 2; - while (list($name, $rate, $min, $curr) = SQL_FETCHROW($result_pay)) { + while ($content = SQL_FETCHARRAY($result_pay)) { // Prepare data for the row template + // @TODO Rewritings: name->pay_name,min->pay_min_count,min->pay_min_count,curr->pay_currency $content = array( 'sw' => $SW, - 'name' => $name, - 'rate' => TRANSLATE_COMMA($rate), - 'min' => $min, - 'curr' => $curr, - 'price' => TRANSLATE_COMMA($min), + 'name' => $content['pay_name'], + 'rate' => TRANSLATE_COMMA($content['pay_rate']), + 'min' => $content['pay_min_count'], + 'curr' => $content['pay_currency'], + 'price' => TRANSLATE_COMMA($content['pay_min_count']), ); // Load row template and switch color @@ -93,30 +95,26 @@ if ($num_act > 0) { } } else { // No pay types setuped so far! - $OUT_PAY = " - ".LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_ACTIONS_ACTIVATED)." -"; + $OUT_PAY = LOAD_TEMPLATE("guest_sponsor_infos_none_row", LOAD_TEMPLATE("admin_settings_saved", true, getMessage('SPONSOR_NO_ACTIONS_ACTIVATED'))); } } else { // No actions activated so far! - $OUT_ACT = " - ".LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_ACTIONS_ACTIVATED)." -"; - $OUT_PAY = " - ".LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_ACTIONS_ACTIVATED)." -"; + $OUT_ACT = LOAD_TEMPLATE("guest_sponsor_infos_none_row", LOAD_TEMPLATE("admin_settings_saved", true, getMessage('SPONSOR_NO_ACTIONS_ACTIVATED'))); + $OUT_PAY = LOAD_TEMPLATE("guest_sponsor_infos_none_row", LOAD_TEMPLATE("admin_settings_saved", true, getMessage('SPONSOR_NO_ACTIONS_ACTIVATED'))); } -// Transfer rows to constans -define('__SPONSOR_ACTIONS' , $OUT_ACT); -define('__SPONSOR_PAYTYPES', $OUT_PAY); - // Free memory -if (isset($result_act)) SQL_FREERESULT($result_act); -if (isset($result_pay)) SQL_FREERESULT($result_pay); +SQL_FREERESULT($result_act); +SQL_FREERESULT($result_pay); + +// Transfer rows to an array +$content = array( + 'actions' => $OUT_ACT, + 'paytypes' => $OUT_PAY +); // Load main template -LOAD_TEMPLATE("guest_sponsor_infos"); +LOAD_TEMPLATE("guest_sponsor_infos", false, $content); // ?>