X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=0.2.1%2Finc%2Fmodules%2Fadmin%2Fwhat-config_points.php;h=a1e35996d6f3bad91e09dc34c61850c6e59e5e8c;hp=018fee1af798fdf1ec3908f80f43a8b1ab0b309d;hb=f29e62abafcf57b076a02b9fe30e14f93baf12f1;hpb=2408c1599f73859fe4a2938e87bc080b9dcb9cca
diff --git a/0.2.1/inc/modules/admin/what-config_points.php b/0.2.1/inc/modules/admin/what-config_points.php
index 018fee1af7..a1e35996d6 100644
--- a/0.2.1/inc/modules/admin/what-config_points.php
+++ b/0.2.1/inc/modules/admin/what-config_points.php
@@ -1,326 +1,326 @@
-$value)
- {
- // Secure ID
- $id = bigintval($id);
-
- // Update entry
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_refdepths SET level='%s', percents='%s' WHERE id=%d LIMIT 1",
- array(bigintval($value), $_POST['perc'][$id], $id), __FILE__, __LINE__);
- }
- $TEXT = REF_DEPTHS_SAVED;
- break;
-
- case "del":
- foreach ($_POST['id'] as $id=>$value)
- {
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_refdepths WHERE id=%d LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__);
- }
- $TEXT = REF_DEPTHS_DELETED;
- break;
- }
-
- // Update cache file
- if (GET_EXT_VERSION("cache") >= "0.1.2")
- {
- if ($CACHE->cache_file("refdepths", true)) $CACHE->cache_destroy();
- }
- break;
-
- case "settings":
- $REF = bigintval($_POST['ref_payout']);
- $SQL[] = sprintf("UPDATE "._MYSQL_PREFIX."_config SET
-allow_direct_pay='%s',
-reg_points_mode='%s',
-ref_payout='%d'
-WHERE config='0' LIMIT 1",
- $_POST['direct_pay'],
- $_POST['refmode'],
- $REF
- );
- if (($CONFIG['ref_payout'] == 0) && ($_POST['ref_payout'] > 0))
- {
- // Update account's ref_payout for "must-confirm"
- $SQL[] = sprintf("UPDATE "._MYSQL_PREFIX."_user_data SET ref_payout=(%d - mails_confirmed)
-WHERE mails_confirmed < %d", $REF, $REF);
- }
- elseif (($CONFIG['ref_payout'] > 0) && ($_POST['ref_payout'] == 0))
- {
- // Update account's ref_payout for "not-must-confirm"
- $SQL[] = "UPDATE "._MYSQL_PREFIX."_user_data SET ref_payout=0 WHERE ref_payout > 0";
- $SQL[] = "UPDATE "._MYSQL_PREFIX."_user_points SET points=points+locked_points WHERE locked_points>0";
- $SQL[] = "UPDATE "._MYSQL_PREFIX."_user_points SET locked_points=0 WHERE locked_points>0";
- }
- break;
- }
- if (isset($SQL))
- {
- if (strpos($SQL[0], "INSERT") > -1)
- {
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_refdepths WHERE level='%s' LIMIT 1",
- array(bigintval($_POST['lvl'])), __FILE__, __LINE__);
- SQL_FREERESULT($result);
- }
- if (count($SQL) > 0)
- {
- // Run all SQL commands
- foreach ($SQL as $s)
- {
- $result = SQL_QUERY($s, __FILE__, __LINE__);
- }
-
- $content = "".SETTINGS_SAVED."";
-
- // Destroy config cache file here...
- if (GET_EXT_VERSION("cache") >= "0.1.2")
- {
- if ($CACHE->cache_file("config", true)) $CACHE->cache_destroy();
- unset($CFG_CACHE);
- }
- }
- else
- {
- $content = "".SETTINGS_NOT_SAVED."";
- }
- unset($SQL);
- LOAD_TEMPLATE("admin_settings_saved", false, $content);
- }
- elseif (isset($TEXT))
- {
- LOAD_TEMPLATE("admin_settings_saved", false, $TEXT);
- }
-}
- elseif ($_GET['sub'] == "settings")
-{
- // Setup some settings like direct pay and so on
- // Including new add-mode for one-time referral bonus
- switch ($CONFIG['direct_pay'])
- {
- case "Y":
- define('__DIRECT_Y', " checked");
- define('__DIRECT_N', "");
- break;
-
- case "N":
- define('__DIRECT_Y', "");
- define('__DIRECT_N', " checked");
- break;
- }
-
- // One-time referral bonus add-mode
- switch ($CONFIG['reg_points_mode'])
- {
- case "ref" : define('__MODE_REF', " checked"); define('__MODE_DIRECT', ""); break;
- case "direct": define('__MODE_REF', ""); define('__MODE_DIRECT', " checked"); break;
- }
-
- // Referral payout value
- define('__REF_PAYOUT', round($CONFIG['ref_payout']));
-
- // Load template
- LOAD_TEMPLATE("admin_config_point_settings");
-}
- elseif ($_GET['sub'] == "ref")
-{
- if ((isset($_POST['del'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0]))))
- {
- // Delete entries
- $SW = 2; $OUT = "";
- foreach ($_POST['sel'] as $id=>$value)
- {
- $result = SQL_QUERY_ESC("SELECT level, percents FROM "._MYSQL_PREFIX."_refdepths WHERE id=%d LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__);
- list($lvl, $perc) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
-
- // Prepare data for the row template
- $content = array(
- 'sw' => $SW,
- 'id' => $id,
- 'lvl' => $lvl,
- 'per' => $perc,
- );
-
- // Load row template and switch color
- $OUT .= LOAD_TEMPLATE("admin_points_del_row", true, $content);
- $SW = 3 - $SW;
- }
- define('__LEVEL_ROWS', $OUT);
-
- // Load main template
- LOAD_TEMPLATE("admin_points_del");
- }
- elseif ((isset($_POST['edit'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0]))))
- {
- // Edit entries
- $SW = 2; $OUT = "";
- foreach ($_POST['sel'] as $id=>$value)
- {
- $result = SQL_QUERY_ESC("SELECT level, percents FROM "._MYSQL_PREFIX."_refdepths WHERE id=%d LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__);
- list($lvl, $perc) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
-
- // Prepare data for the row template
- $content = array(
- 'sw' => $SW,
- 'id' => $id,
- 'lvl' => $lvl,
- 'per' => $perc,
- );
-
- // Load row template and switch color
- $OUT .= LOAD_TEMPLATE("admin_points_edit_row", true, $content);
- $SW = 3 - $SW;
- }
- define('__LEVEL_ROWS', $OUT);
-
- // Load main template
- LOAD_TEMPLATE("admin_points_edit");
- }
- else
- {
- // Referral levels
- $result = SQL_QUERY("SELECT id, level, percents FROM "._MYSQL_PREFIX."_refdepths ORDER BY level", __FILE__, __LINE__);
- if (SQL_NUMROWS($result) > 0)
- {
- // Make referral levels editable and deletable
- $SW = 2; $OUT = "";
-
- // List already existing categories for editing
- while (list($id, $lvl, $perc) = SQL_FETCHROW($result))
- {
- // Prepare data for the row template
- $content = array(
- 'sw' => $SW,
- 'id' => $id,
- 'lvl' => $lvl,
- 'per' => $perc,
- );
-
- // Load row template and switch color
- $OUT .= LOAD_TEMPLATE("admin_points_row", true, $content);
- $SW = 3 - $SW;
- }
-
- // Free memory
- SQL_FREERESULT($result);
- define('__LEVEL_ROWS', $OUT);
-
- // Load main template
- LOAD_TEMPLATE("admin_points");
- }
-
- // Form for adding new referral levels
- LOAD_TEMPLATE("admin_add_reflvl");
- }
-}
- elseif ($_GET['sub'] == "points")
-{
- // First points for registration and other fixed points including new add-mode for one-time referral bonus...
- define('P_REG_VALUE', $CONFIG['points_register']);
- define('P_REF_VALUE', $CONFIG['points_ref']);
-
- // Load templates
- LOAD_TEMPLATE("admin_config_sub_points");
-}
- else
-{
- // Display selection box
- LOAD_TEMPLATE("admin_config_points");
-}
-
-CLOSE_TABLE();
-//
-?>
+$value)
+ {
+ // Secure ID
+ $id = bigintval($id);
+
+ // Update entry
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_refdepths SET level='%s', percents='%s' WHERE id=%d LIMIT 1",
+ array(bigintval($value), $_POST['perc'][$id], $id), __FILE__, __LINE__);
+ }
+ $TEXT = REF_DEPTHS_SAVED;
+ break;
+
+ case "del":
+ foreach ($_POST['id'] as $id=>$value)
+ {
+ $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_refdepths WHERE id=%d LIMIT 1",
+ array(bigintval($id)), __FILE__, __LINE__);
+ }
+ $TEXT = REF_DEPTHS_DELETED;
+ break;
+ }
+
+ // Update cache file
+ if (GET_EXT_VERSION("cache") >= "0.1.2")
+ {
+ if ($CACHE->cache_file("refdepths", true)) $CACHE->cache_destroy();
+ }
+ break;
+
+ case "settings":
+ $REF = bigintval($_POST['ref_payout']);
+ $SQL[] = sprintf("UPDATE "._MYSQL_PREFIX."_config SET
+allow_direct_pay='%s',
+reg_points_mode='%s',
+ref_payout='%d'
+WHERE config='0' LIMIT 1",
+ $_POST['allow_direct_pay'],
+ $_POST['refmode'],
+ $REF
+ );
+ if (($CONFIG['ref_payout'] == 0) && ($_POST['ref_payout'] > 0))
+ {
+ // Update account's ref_payout for "must-confirm"
+ $SQL[] = sprintf("UPDATE "._MYSQL_PREFIX."_user_data SET ref_payout=(%d - mails_confirmed)
+WHERE mails_confirmed < %d", $REF, $REF);
+ }
+ elseif (($CONFIG['ref_payout'] > 0) && ($_POST['ref_payout'] == 0))
+ {
+ // Update account's ref_payout for "not-must-confirm"
+ $SQL[] = "UPDATE "._MYSQL_PREFIX."_user_data SET ref_payout=0 WHERE ref_payout > 0";
+ $SQL[] = "UPDATE "._MYSQL_PREFIX."_user_points SET points=points+locked_points WHERE locked_points>0";
+ $SQL[] = "UPDATE "._MYSQL_PREFIX."_user_points SET locked_points=0 WHERE locked_points>0";
+ }
+ break;
+ }
+ if ((isset($SQL)) && (is_array($SQL)) && (!empty($SQL[0])))
+ {
+ if (strpos($SQL[0], "INSERT") > -1)
+ {
+ $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_refdepths WHERE level='%s' LIMIT 1",
+ array(bigintval($_POST['lvl'])), __FILE__, __LINE__);
+ SQL_FREERESULT($result);
+ }
+ if (count($SQL) > 0)
+ {
+ // Run all SQL commands
+ foreach ($SQL as $s)
+ {
+ $result = SQL_QUERY($s, __FILE__, __LINE__);
+ }
+
+ $content = "".SETTINGS_SAVED."";
+
+ // Destroy config cache file here...
+ if (GET_EXT_VERSION("cache") >= "0.1.2")
+ {
+ if ($CACHE->cache_file("config", true)) $CACHE->cache_destroy();
+ unset($CFG_CACHE);
+ }
+ }
+ else
+ {
+ $content = "".SETTINGS_NOT_SAVED."";
+ }
+ unset($SQL);
+ LOAD_TEMPLATE("admin_settings_saved", false, $content);
+ }
+ elseif (isset($TEXT))
+ {
+ LOAD_TEMPLATE("admin_settings_saved", false, $TEXT);
+ }
+}
+ elseif ($_GET['sub'] == "settings")
+{
+ // Setup some settings like direct pay and so on
+ // Including new add-mode for one-time referral bonus
+ switch ($CONFIG['allow_direct_pay'])
+ {
+ case "Y":
+ define('__DIRECT_Y', " checked");
+ define('__DIRECT_N', "");
+ break;
+
+ case "N":
+ define('__DIRECT_Y', "");
+ define('__DIRECT_N', " checked");
+ break;
+ }
+
+ // One-time referral bonus add-mode
+ switch ($CONFIG['reg_points_mode'])
+ {
+ case "ref" : define('__MODE_REF', " checked"); define('__MODE_DIRECT', ""); break;
+ case "direct": define('__MODE_REF', ""); define('__MODE_DIRECT', " checked"); break;
+ }
+
+ // Referral payout value
+ define('__REF_PAYOUT', round($CONFIG['ref_payout']));
+
+ // Load template
+ LOAD_TEMPLATE("admin_config_point_settings");
+}
+ elseif ($_GET['sub'] == "ref")
+{
+ if ((isset($_POST['del'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0]))))
+ {
+ // Delete entries
+ $SW = 2; $OUT = "";
+ foreach ($_POST['sel'] as $id=>$value)
+ {
+ $result = SQL_QUERY_ESC("SELECT level, percents FROM "._MYSQL_PREFIX."_refdepths WHERE id=%d LIMIT 1",
+ array(bigintval($id)), __FILE__, __LINE__);
+ list($lvl, $perc) = SQL_FETCHROW($result);
+ SQL_FREERESULT($result);
+
+ // Prepare data for the row template
+ $content = array(
+ 'sw' => $SW,
+ 'id' => $id,
+ 'lvl' => $lvl,
+ 'per' => $perc,
+ );
+
+ // Load row template and switch color
+ $OUT .= LOAD_TEMPLATE("admin_points_del_row", true, $content);
+ $SW = 3 - $SW;
+ }
+ define('__LEVEL_ROWS', $OUT);
+
+ // Load main template
+ LOAD_TEMPLATE("admin_points_del");
+ }
+ elseif ((isset($_POST['edit'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0]))))
+ {
+ // Edit entries
+ $SW = 2; $OUT = "";
+ foreach ($_POST['sel'] as $id=>$value)
+ {
+ $result = SQL_QUERY_ESC("SELECT level, percents FROM "._MYSQL_PREFIX."_refdepths WHERE id=%d LIMIT 1",
+ array(bigintval($id)), __FILE__, __LINE__);
+ list($lvl, $perc) = SQL_FETCHROW($result);
+ SQL_FREERESULT($result);
+
+ // Prepare data for the row template
+ $content = array(
+ 'sw' => $SW,
+ 'id' => $id,
+ 'lvl' => $lvl,
+ 'per' => $perc,
+ );
+
+ // Load row template and switch color
+ $OUT .= LOAD_TEMPLATE("admin_points_edit_row", true, $content);
+ $SW = 3 - $SW;
+ }
+ define('__LEVEL_ROWS', $OUT);
+
+ // Load main template
+ LOAD_TEMPLATE("admin_points_edit");
+ }
+ else
+ {
+ // Referral levels
+ $result = SQL_QUERY("SELECT id, level, percents FROM "._MYSQL_PREFIX."_refdepths ORDER BY level", __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) > 0)
+ {
+ // Make referral levels editable and deletable
+ $SW = 2; $OUT = "";
+
+ // List already existing categories for editing
+ while (list($id, $lvl, $perc) = SQL_FETCHROW($result))
+ {
+ // Prepare data for the row template
+ $content = array(
+ 'sw' => $SW,
+ 'id' => $id,
+ 'lvl' => $lvl,
+ 'per' => $perc,
+ );
+
+ // Load row template and switch color
+ $OUT .= LOAD_TEMPLATE("admin_points_row", true, $content);
+ $SW = 3 - $SW;
+ }
+
+ // Free memory
+ SQL_FREERESULT($result);
+ define('__LEVEL_ROWS', $OUT);
+
+ // Load main template
+ LOAD_TEMPLATE("admin_points");
+ }
+
+ // Form for adding new referral levels
+ LOAD_TEMPLATE("admin_add_reflvl");
+ }
+}
+ elseif ($_GET['sub'] == "points")
+{
+ // First points for registration and other fixed points including new add-mode for one-time referral bonus...
+ define('P_REG_VALUE', $CONFIG['points_register']);
+ define('P_REF_VALUE', $CONFIG['points_ref']);
+
+ // Load templates
+ LOAD_TEMPLATE("admin_config_sub_points");
+}
+ else
+{
+ // Display selection box
+ LOAD_TEMPLATE("admin_config_points");
+}
+
+CLOSE_TABLE();
+//
+?>