$MSG = "";
// Quick actions on a rallye
-if (REQUEST_ISSET_GET(('rallye')))
-{
- // Activate / deactivate
- $sql = "";
- if (REQUEST_ISSET_GET(('activate')))
- {
+if (REQUEST_ISSET_GET(('rallye'))) {
+ // Init SQL queries
+ INIT_SQLS();
+
+ if (REQUEST_ISSET_GET(('activate'))) {
+ // Activate / deactivate
switch (REQUEST_GET('activate'))
{
case "1": // Activate
- $sql = "UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='Y' WHERE id=%s AND is_active='N' LIMIT 1";
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='Y' WHERE id=%s AND is_active='N' LIMIT 1");
break;
case "0": // Deactivate
- $sql = "UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='N' WHERE id=%s AND is_active='Y' LIMIT 1";
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='N' WHERE id=%s AND is_active='Y' LIMIT 1");
break;
}
- }
-
- // Automatic notification
- if (REQUEST_ISSET_GET(('notify')))
- {
+ } elseif (REQUEST_ISSET_GET(('notify'))) {
+ // Automatic notification
switch (REQUEST_GET('notify'))
{
case "1": // Activate
- $sql = "UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='Y' WHERE id=%s AND send_notify='N' LIMIT 1";
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='Y' WHERE id=%s AND send_notify='N' LIMIT 1");
break;
case "0": // Deactivate
- $sql = "UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='N' WHERE id=%s AND send_notify='Y' LIMIT 1";
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='N' WHERE id=%s AND send_notify='Y' LIMIT 1");
break;
}
- }
-
- // Automatic adding of new members
- if (REQUEST_ISSET_GET(('auto')))
- {
+ } elseif (REQUEST_ISSET_GET(('auto'))) {
+ // Automatic adding of new members
switch (REQUEST_GET('auto'))
{
case "1": // Activate
- $sql = "UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='Y' WHERE id=%s AND auto_add_new_user='N' LIMIT 1";
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='Y' WHERE id=%s AND auto_add_new_user='N' LIMIT 1");
break;
case "0": // Deactivate
- $sql = "UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='N' WHERE id=%s AND auto_add_new_user='Y' LIMIT 1";
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='N' WHERE id=%s AND auto_add_new_user='Y' LIMIT 1");
break;
}
}
// Run SQL command
- if (!empty($sql))
- {
- $result = SQL_QUERY_ESC($sql, array(bigintval(REQUEST_GET('rallye'))), __FILE__, __LINE__);
- }
-}
- elseif (REQUEST_ISSET_POST(('remove')))
-{
+ runFilterChain('run_sqls');
+} elseif (REQUEST_ISSET_POST(('remove'))) {
// Delete rallyes
$SEL = SELECTION_COUNT(REQUEST_POST('sel'));
- if ($SEL > 0)
- {
+ if ($SEL > 0) {
// Delete selected rallyes and all it's data
- foreach (REQUEST_POST('sel') as $id => $sel)
- {
+ foreach (REQUEST_POST('sel') as $id => $selected) {
// Remove selected rallye entirely...
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE id=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
}
// Output message
- $MSG = RALLYE_DELETED;
- }
- else
- {
+ $MSG = getMessage('RALLYE_DELETED');
+ } else {
// No rallye selected to delete!
- $MSG = RALLYE_DELETE_NOTHING_SELECTED;
+ $MSG = getMessage('RALLYE_DELETE_NOTHING_SELECTED');
}
-}
- elseif (REQUEST_ISSET_POST(('change')))
-{
+} elseif (REQUEST_ISSET_POST(('change'))) {
// Change rallye
$SEL = SELECTION_COUNT(REQUEST_POST('title'));
- if ($SEL > 0)
- {
+ if ($SEL > 0) {
// Change selected rallyes and all it's data
- foreach (REQUEST_POST('title') as $id => $title)
- {
+ foreach (REQUEST_POST('title') as $id => $title) {
// Secure ID number
$id = bigintval($id);
}
// Output message
- $MSG = RALLYE_CHANGED;
+ $MSG = getMessage('RALLYE_CHANGED');
}
}
if ($SEL > 0) {
// Make all selected and deactivated rallyes editable
$SW = 2; $OUT = "";
- foreach (REQUEST_POST('sel') as $id => $sel) {
+ foreach (REQUEST_POST('sel') as $id => $selected) {
// Load rallye basic data
$result = SQL_QUERY_ESC("SELECT title, descr, template, start_time, end_time, min_users, min_prices FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE id=%s LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__);
+ array(bigintval($id)), __FILE__, __LINE__);
list($title, $descr, $templ, $start, $end, $min_users, $min_prices) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
} elseif ((REQUEST_GET('sub') == "users") && (REQUEST_GET('rallye') > 0)) {
// List users and their refs before start and current
$result = SQL_QUERY_ESC("SELECT userid, refs, curr_points FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s ORDER BY userid",
- array(bigintval(REQUEST_GET('rallye'))), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) > 0)
- {
+ array(bigintval(REQUEST_GET('rallye'))), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) > 0) {
$SW = 2; $OUT = "";
define('__RALLYE_VALUE', REQUEST_GET('rallye'));
- while (list($uid, $old, $opoints) = SQL_FETCHROW($result))
- {
+ while (list($uid, $old, $opoints) = SQL_FETCHROW($result)) {
// Check for referal count
$cnt = RALLYE_GET_REFCOUNT($uid, $old);
LOAD_TEMPLATE("admin_list_rallye_usr");
} else {
// No entries found?
- LOAD_TEMPLATE("admin_settings_saved", false, RALLYE_ADMIN_USERS_404);
+ LOAD_TEMPLATE("admin_settings_saved", false, getMessage('RALLYE_ADMIN_USERS_404'));
}
} else {
// Start listing rallyes
// Count assigned prices
$result_prices = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s",
- array(bigintval($id)), __FILE__, __LINE__);
+ array(bigintval($id)), __FILE__, __LINE__);
// Count joined userids
$result_user = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s",
- array($id), __FILE__, __LINE__);
+ array($id), __FILE__, __LINE__);
$joined = SQL_NUMROWS($result_user);
// Did some users joined this rallye?
case "Y":
// Rallye is active so do not edit it!
$content['select'] = "<div class=\"big\">".$id."</strong>";
- $content['active_title'] = RALLYE_DEACTIVATE_NOW;
+ $content['active_title'] = getMessage('RALLYE_DEACTIVATE_NOW');
$content['active'] = 0;
break;
case "N":
- $content['active_title'] = RALLYE_ACTIVATE_NOW;
+ $content['active_title'] = getMessage('RALLYE_ACTIVATE_NOW');
$content['active'] = "1";
break;
}
switch ($notify)
{
case "Y":
- $content['notify_title'] = RALLYE_STOP_NOTIFY_NOW;
+ $content['notify_title'] = getMessage('RALLYE_STOP_NOTIFY_NOW');
$content['notify'] = 0;
break;
case "N":
- $content['notify_title'] = RALLYE_START_NOTIFY_NOW;
+ $content['notify_title'] = getMessage('RALLYE_START_NOTIFY_NOW');
$content['notify'] = "1";
break;
}
switch ($auto_add)
{
case "Y":
- $content['auto_title'] = RALLYE_STOP_AUTO_ADD_NOW;
+ $content['auto_title'] = getMessage('RALLYE_STOP_AUTO_ADD_NOW');
$content['auto'] = 0;
break;
case "N":
- $content['auto_title'] = RALLYE_START_AUTO_ADD_NOW;
+ $content['auto_title'] = getMessage('RALLYE_START_AUTO_ADD_NOW');
$content['auto'] = "1";
break;
}
LOAD_TEMPLATE("admin_list_rallyes");
} else {
// No rallyes setup so far
- LOAD_TEMPLATE("admin_settings_saved", false, RALLYE_NO_RALLYES_SETUP);
+ LOAD_TEMPLATE("admin_settings_saved", false, getMessage('RALLYE_NO_RALLYES_SETUP'));
}
}