if (!defined('__SECURITY')) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
require($INC);
+} elseif ((!EXT_IS_ACTIVE("sponsor"))) {
+ addFatalMessage(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), "sponsor");
+ return;
}
// Add description as navigation point
-ADD_DESCR("guest", basename(__FILE__));
+ADD_DESCR("guest", __FILE__);
// Remove result_act
unset($result_act);
// Load all sponsor actions
$result_act = SQL_QUERY("SELECT DISTINCT m.title, c.conv_rate, c.conv_name
-FROM "._MYSQL_PREFIX."_sponsor_menu AS m
-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
+FROM `{!_MYSQL_PREFIX!}_sponsor_menu` AS m
+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 ($num_act > 0) {
// Load all actions
$OUT_ACT = ""; $SW = 2;
- while (list($title, $conv, $name) = SQL_FETCHROW($result_act))
- {
+ while (list($title, $conv, $name) = SQL_FETCHROW($result_act)) {
// Prepare data for the row template
$content = array(
'sw' => $SW,
// Load row template and switch color
$OUT_ACT .= LOAD_TEMPLATE("guest_sponsor_act_row", true, $content);
$SW = 3 - $SW;
- }
+ } // END - while
// Check for pay types
- $result_pay = SQL_QUERY("SELECT pay_name, pay_rate, pay_min_count, pay_currency FROM "._MYSQL_PREFIX."_sponsor_paytypes ORDER BY pay_name", __FILE__, __LINE__);
- if (SQL_NUMROWS($result_pay) > 0)
- {
+ $result_pay = SQL_QUERY("SELECT pay_name, pay_rate, pay_min_count, pay_currency FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` ORDER BY pay_name", __FILE__, __LINE__);
+ 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 (list($name, $rate, $min, $curr) = SQL_FETCHROW($result_pay)) {
// Prepare data for the row template
$content = array(
'sw' => $SW,
'rate' => TRANSLATE_COMMA($rate),
'min' => $min,
'curr' => $curr,
- 'price' => $min,
+ 'price' => TRANSLATE_COMMA($min),
);
- if (!ereg(",", $content['price']))
- {
- // Add missing zeros
- $content['price'] .= ",".str_repeat("0", $_CONFIG['max_comma']);
- }
-
// Load row template and switch color
$OUT_PAY .= LOAD_TEMPLATE("guest_sponsor_pay_row", true, $content);
$SW = 3 - $SW;
}
- }
- else
- {
+ } else {
// No pay types setuped so far!
- $OUT_PAY = "<TR><TD colspan=\"2\">
+ $OUT_PAY = "<tr><td colspan=\"2\">
".LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_ACTIONS_ACTIVATED)."
-</TD></TR>";
+</td></tr>";
}
-}
- else
-{
+} else {
// No actions activated so far!
- $OUT_ACT = "<TR><TD colspan=\"2\" class=\"bottom2\" style=\"padding-top: 10px; padding-bottom: 10px\">
+ $OUT_ACT = "<tr><td colspan=\"2\" class=\"bottom2\" style=\"padding-top: 10px; padding-bottom: 10px\">
".LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_ACTIONS_ACTIVATED)."
-</TD></TR>";
- $OUT_PAY = "<TR><TD colspan=\"2\" class=\"bottom2\" style=\"padding-top: 10px; padding-bottom: 10px\">
+</td></tr>";
+ $OUT_PAY = "<tr><td colspan=\"2\" class=\"bottom2\" style=\"padding-top: 10px; padding-bottom: 10px\">
".LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_ACTIONS_ACTIVATED)."
-</TD></TR>";
+</td></tr>";
}
// Transfer rows to constans