- LOAD_TEMPLATE("admin_config_point_settings");
-} elseif (REQUEST_GET('sub') == "ref") {
- // 12 3 32 2 3 32 2 3 4 43 21
- if ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST('sel')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
- // Delete entries
- $OUT = ""; $SW = 2;
- foreach (REQUEST_POST('sel') as $id => $value) {
- $result = SQL_QUERY_ESC("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE id=%s 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' => TRANSLATE_COMMA($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 ((REQUEST_ISSET_POST('edit')) && (REQUEST_ISSET_POST('sel')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
- // Edit entries
- $OUT = ""; $SW = 2;
- foreach (REQUEST_POST('sel') as $id => $value) {
- $result = SQL_QUERY_ESC("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE id=%s 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' => TRANSLATE_COMMA($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 {
- // Referal levels
- $result = SQL_QUERY("SELECT id, level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` ORDER BY level", __FILE__, __LINE__);
- if (SQL_NUMROWS($result) > 0) {
- // Make referal levels editable and deletable
- $OUT = ""; $SW = 2;
-
- // List already existing categories for editing
- while ($content = SQL_FETCHARRAY($result)) {
- // Prepare data for the row template
- // @TODO Rewritings: lvl->level, per->percents in template
- $content = array(
- 'sw' => $SW,
- 'id' => $content['id'],
- 'lvl' => $content['level'],
- 'per' => TRANSLATE_COMMA($content['percents']),
- );
-
- // 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 referal levels
- LOAD_TEMPLATE("admin_add_reflvl");
- }
-} elseif (REQUEST_GET('sub') == "points") {
- // First points for registration and other fixed points including new add-mode for one-time referal bonus...
- define('P_REG_VALUE', getConfig('points_register'));
- define('P_REF_VALUE', getConfig('points_ref'));
-
- // Load templates
- LOAD_TEMPLATE("admin_config_sub_points");