if (empty($cnt)) $cnt = '0'; // Added prevent some unknown troubles... :-?
// Check if line is already included...
- $result_ref = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE rallye_id=%s AND `userid`=%s LIMIT 1",
+ $result_ref = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s AND `userid`=%s LIMIT 1",
array(bigintval($id), bigintval($content['userid'])), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result_ref) == '0') {
// Free memory
//
function addReferalRallyeTopUsers ($rallye, $default=0) {
// First check how many prices are set
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE rallye_id=%s ORDER BY price_level",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s ORDER BY price_level",
array(bigintval($rallye)), __FUNCTION__, __LINE__);
$prices = SQL_NUMROWS($result);
SQL_FREERESULT($result);
ON
u.rallye_id=rd.id
WHERE
- u.rallye_id=%s AND r.counter > 0
+ u.`rallye_id`=%s AND r.counter > 0
ORDER BY
u.refs DESC",
array(bigintval($rallye)), __FUNCTION__, __LINE__);
);
// Load prices
- $result = SQL_QUERY_ESC("SELECT price_level, points, info FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE rallye_id=%s ORDER BY price_level",
+ $result = SQL_QUERY_ESC("SELECT price_level, points, info FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s ORDER BY price_level",
array(bigintval($rallye)), __FUNCTION__, __LINE__);
// Transfer elements
// Purge whole rallye
addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE `id`=%s LIMIT 1",
array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
- addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE rallye_id=%s LIMIT 1",
+ addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s LIMIT 1",
array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
- addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE rallye_id=%s LIMIT 1",
+ addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s LIMIT 1",
array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
// Add task
if (isPostRequestElementSet('edit')) {
// Check if entires are checked
- $SEL = countPostSelection();
- if ($SEL > 0) {
+ if (countPostSelection() > 0) {
// Add option for events
$adminsList = generateOptionList('admins', 'id', 'login', '', 'email');
$SW = 2; $rowNameS = '';
// Add description as navigation point
addMenuDescription('admin', __FILE__);
-$SEL = '0';
-if (isPostRequestElementSet('sel')) $SEL = countPostSelection();
-
-if ((isPostRequestElementSet('edit')) && ($SEL > 0)) {
+if ((isPostRequestElementSet('edit')) && (countPostSelection() > 0)) {
// Edit ACLs
$OUT = ''; $SW = 2;
foreach (postRequestElement('sel') as $id => $selected) {
// Load main template
loadTemplate('admin_config_admins_edit', false, $OUT);
-} elseif ((isPostRequestElementSet('change')) && ($SEL > 0)) {
+} elseif ((isPostRequestElementSet('change')) && (countPostSelection() > 0)) {
// Change entries
foreach (postRequestElement('sel') as $id => $selected) {
// Secure id
// Entries changed
loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ADMINS_ENTRIES_CHANGED'));
-} elseif ((isPostRequestElementSet('del')) && ($SEL > 0)) {
+} elseif ((isPostRequestElementSet('del')) && (countPostSelection() > 0)) {
// Delete ACLs
$OUT = ''; $SW = 2;
foreach (postRequestElement('sel') as $id => $selected) {
// Load main template
loadTemplate('admin_config_admins_del', false, $OUT);
-} elseif ((isPostRequestElementSet('remove')) && ($SEL > 0)) {
+} elseif ((isPostRequestElementSet('remove')) && (countPostSelection() > 0)) {
// Remove entries
// @TODO Rewrite this to filter 'run_sqls'
foreach (postRequestElement('sel') as $id => $selected) {
// Add description as navigation point
addMenuDescription('admin', __FILE__);
-$SEL = '0';
if (isPostRequestElementSet('edit')) {
// Check if at least one module is selected
- $SEL = countPostSelection();
- if ($SEL > 0) {
+ if (countPostSelection() > 0) {
// Output header
$OUT = ''; $SW = 2;
loadTemplate('admin_settings_saved', false, getMessage('MODS_CHANGED'));
}
-if ($SEL == '0') {
+if (countPostSelection() == '0') {
// Load module data (We do not need to check if there's at least one...)
$result = SQL_QUERY('SELECT id, module, locked, hidden, admin_only, title, mem_only
FROM `{?_MYSQL_PREFIX?}_mod_reg`
}
} elseif (isPostRequestElementSet('remove')) {
// Check if at last one line is selected
- $SEL = countPostSelection();
- if ($SEL > 0) {
+ if (countPostSelection() > 0) {
// Delete selected entries
foreach (postRequestElement('sel') as $id => $sel) {
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `id`=%s LIMIT 1",
if (isPostRequestElementSet('edit')) {
// Check if at last one line is selected
- $SEL = countPostSelection();
- if ($SEL > 0) {
+ if (countPostSelection() > 0) {
// Make selected editable
$OUT = ''; $SW = 2;
foreach (postRequestElement('sel') as $id => $sel) {
}
} elseif (isPostRequestElementSet('del')) {
// Check if at last one line is selected
- $SEL = countPostSelection();
- if ($SEL > 0) {
+ if (countPostSelection() > 0) {
// List all prices
$OUT = ''; $SW = 2;
foreach (postRequestElement('sel') as $id => $sel) {
if (isPostRequestElementSet('del')) {
// Delete entries from tables
- $SEL = countPostSelection();
- if ($SEL > 0) {
+ if (countPostSelection() > 0) {
// Init SQLs
initSqls();
// Delete entries...
foreach (postRequestElement('sel') as $id => $sel) {
- addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE trans_id=%s LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__, false));
- addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE trans_id=%s LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__, false));
+ addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE `trans_id`=%s LIMIT 1",
+ array(bigintval($id)), __FILE__, __LINE__, false));
+ addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE `trans_id`=%s LIMIT 1",
+ array(bigintval($id)), __FILE__, __LINE__, false));
} // END - foreach
// Run all SQLs
runFilterChain('run_sqls');
- }
-}
+ } // END - if
+} // END - if
// We only need outgoing transfers
-$result = SQL_QUERY("SELECT userid, to_userid, trans_id, points, reason, time_trans FROM `{?_MYSQL_PREFIX?}_user_transfers_out` ORDER BY trans_id", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT `userid`, `to_userid`, `trans_id`, `points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_out` ORDER BY `trans_id` ASC", __FILE__, __LINE__);
$total = '0';
if (SQL_NUMROWS($result) > 0) {
// Output rows
// Sum points and switch colors
$total += $content['points']; $SW = 3 - $SW;
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);
// Normally we want the overview of all registered extensions
$do = 'overview';
-$SEL = '0';
-
-// Are some extensions submitted?
-if (isPostRequestElementSet('sel')) {
- // Then count all
- $SEL = countPostSelection();
-} // END - if
if (isGetRequestElementSet('reg_ext')) {
// We are about to register a new extension
$do = 'register'; $ext_id = bigintval(getRequestElement('reg_ext'));
// The id comes from task management and it is - of course - *not* the extension's name!
-} elseif ((isPostRequestElementSet('change')) && ($SEL > 0) && (!isDemoModeActive())) {
+} elseif ((isPostRequestElementSet('change')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
// De-/activate extensions
foreach (postRequestElement('sel') as $ext_id => $active) {
// Shall we keep the extension always active?
doExtensionSqls($ext_id, getExtensionMode());
}
}
-} elseif (((isPostRequestElementSet('edit')) || (isPostRequestElementSet(('modify')))) && ($SEL > 0) && (!isDemoModeActive())) {
+} elseif (((isPostRequestElementSet('edit')) || (isPostRequestElementSet(('modify')))) && (countPostSelection() > 0) && (!isDemoModeActive())) {
// Change settings like CSS file load
if (isPostRequestElementSet(('modify'))) {
// Change entries
loadTemplate('admin_extensions_edit', false, $OUT);
$do = 'edit';
}
-} elseif ((isPostRequestElementSet('delete')) && ($SEL > 0) && (!isDemoModeActive())) {
+} elseif ((isPostRequestElementSet('delete')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
// List extensions and when verbose is enabled SQL statements which will be executed
$OUT = ''; $SW = 2;
foreach (postRequestElement('sel') as $ext_id => $sel) {
// Load template
loadTemplate('admin_extensions_delete', false, $OUT);
$do = 'delete';
-} elseif ((isPostRequestElementSet('remove')) && ($SEL > 0) && (!isDemoModeActive())) {
+} elseif ((isPostRequestElementSet('remove')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
// Remove extensions from DB (you have to delete all files manually!)
$cache_update = '0';
foreach (postRequestElement('sel') as $ext_id => $active) {
} // END - foreach
// Extensions removed
- loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_EXTENSIONS_REMOVED'), $SEL));
+ loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_EXTENSIONS_REMOVED'), countPostSelection()));
} elseif ((isGetRequestElementSet('do')) && (!isDemoModeActive())) {
// Other things to do
$do = SQL_ESCAPE(secureString(getRequestElement('do')));
// Some security stuff...
if ((!defined('__SECURITY')) || (!isAdmin())) {
die();
-}
+} // END - if
// Add description as navigation point
addMenuDescription('admin', __FILE__);
-if (!isGetRequestElementSet('sub')) setRequestGetElement('sub', '');
+// Init message
$message = '';
// Quick actions on a rallye
array(bigintval(getRequestElement('rallye'))), __FILE__, __LINE__, false)
);
break;
- }
+ } // END - switch
} elseif (isGetRequestElementSet('notify')) {
// Automatic notification
switch (getRequestElement('notify')) {
array(bigintval(getRequestElement('rallye'))), __FILE__, __LINE__, false)
);
break;
- }
+ } // END - switch
} elseif (isGetRequestElementSet('auto')) {
// Automatic adding of new members
switch (getRequestElement('auto')) {
array(bigintval(getRequestElement('rallye'))), __FILE__, __LINE__, false)
);
break;
- }
+ } // END - switch
}
// Run SQL command
runFilterChain('run_sqls');
} elseif (isPostRequestElementSet('remove')) {
// Delete rallyes
- $SEL = countPostSelection();
- if ($SEL > 0) {
+ if (countPostSelection() > 0) {
// Init SQLs
initSqls();
// Remove selected rallye entirely...
addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__, false));
- addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE rallye_id=%s",
+ addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s",
array(bigintval($id)), __FILE__, __LINE__, false));
- addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE rallye_id=%s",
+ addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s",
array(bigintval($id)), __FILE__, __LINE__, false));
} // END - foreach
}
} elseif (isPostRequestElementSet('change')) {
// Change rallye
- $SEL = countSelection(postRequestElement('title'));
- if ($SEL > 0) {
+ if (countSelection(postRequestElement('title')) > 0) {
// Init SQLs
initSqls();
if (isPostRequestElementSet('edit')) {
// Check for selections
- $SEL = countPostSelection();
- if ($SEL > 0) {
+ if (countPostSelection() > 0) {
// Make all selected and deactivated rallyes editable
$OUT = ''; $SW = 2;
foreach (postRequestElement('sel') as $id => $selected) {
}
if (!empty($whereStatement)) {
- $SEL = '0';
- if (isPostRequestElementSet(('task'))) $SEL = countSelection(postRequestElement('task'));
-
- if ((isPostRequestElementSet(('assign'))) && ($SEL > 0)) {
+ if ((isPostRequestElementSet(('assign'))) && (countPostSelection() > 0)) {
// Assign / do tasks
loadIncludeOnce("inc/modules/admin/overview-inc.php");
if (empty($dmy)) $dmy = '';
`subject` ASC,
`task_created` DESC',
__FILE__, __LINE__);
- if (($SEL > 0) && (!isDemoModeActive())) {
+ if ((countPostSelection() > 0) && (!isDemoModeActive())) {
// Only unassign / delete tasks when there are selected tasks posted
if (isPostRequestElementSet('unassign')) {
// Unassign from tasks
// Add description as navigation point
addMenuDescription('admin', __FILE__);
-// Init variable
-$SEL = '0';
-
// Some sanity-check
if ((!isPostRequestElementSet('url')) || (!isPostRequestElementSet(('alternate')))) {
unsetPostRequestElement('ok');
}
-// Check selection count
-if (isPostRequestElementSet('sel')) $SEL = countPostSelection();
-
if (isFormSent()) {
// Fix older calls from add-new-banner-form
if (!isGetRequestElementSet('mode')) setRequestGetElement('mode', 'add');
$content = "<span class=\"admin_failed\">{--SETTINGS_NOT_SAVED--}</span>";
}
loadTemplate('admin_settings_saved', false, $content);
-} elseif (($SEL > 0) && (isPostRequestElementSet('edit'))) {
+} elseif ((countPostSelection() > 0) && (isPostRequestElementSet('edit'))) {
// Edit banner
$SW = 2; $OUT = '';
foreach (postRequestElement('sel') as $id => $sel) {
// Load main template
loadTemplate('admin_refbanner_edit', false, $OUT);
} else {
- if (($SEL > 0) && (isPostRequestElementSet('del'))) {
+ if ((countPostSelection() > 0) && (isPostRequestElementSet('del'))) {
// Delete banner
foreach (postRequestElement('sel') as $id => $sel) {
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_refbanner` WHERE `id`=%s LIMIT 1",
// Normally we want the overview of all registered theme_check
$mode = 'overview';
-$SEL = '0';
// Get response from our server
$response = sendGetRequest('check-themes.php');
// Are theme_check found?
-if (($response[count($response) - 1] == "[EOF]") && ($response[0] != "[EOF]")) {
+if (($response[count($response) - 1] == '[EOF]') && ($response[0] != '[EOF]')) {
// Ok, mark found and create the array
$themes = array(
'fname' => array(), // File names
$value = str_replace("\n", '', $value); $ver = '';
// Leave loop when data is invalid or EOF?
- if ((substr($value, 0, 6) == "theme-") && (substr($value, -4) == ".zip")) {
+ if ((substr($value, 0, 6) == 'theme-') && (substr($value, -4) == '.zip')) {
// Extract name and version
$name = substr($value, 6, -4);
$ver = trim(substr($response[$idx + 3], 4));
} // END - if
// Check for selected themes
-$SEL = '0';
-if (isPostRequestElementSet('sel')) $SEL = countPostSelection();
-if ($SEL > 0) {
+if (countPostSelection() > 0) {
$OUT = '';
foreach (postRequestElement('sel') as $id => $sel) {
$sql = '';
// Rebuild cache
rebuildCacheFile('themes', 'them');
} // END - if
- }
+ } // END - foreach
// Output generated?
if (empty($OUT)) $OUT = getMessage('ADMIN_THEME_NO_OUTPUT');
adminSaveSettings($postData);
}
+// Init rows
+$OUT = '';
+
// Switch to testing mode
$GLOBALS['theme_mode'] = 'test';
-// Generate output lines for the template
-$OUT = ''; $SW = 2;
-$result = SQL_QUERY("SELECT `id`, `theme_path`, `theme_active`, `theme_ver`, `theme_name` FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY theme_path", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT
+ `id`,
+ `theme_path`,
+ `theme_active`,
+ `theme_ver`,
+ `theme_name`
+FROM
+ `{?_MYSQL_PREFIX?}_themes`
+ORDER BY
+ `theme_path` ASC", __FILE__, __LINE__);
+
if (SQL_NUMROWS($result) > 0) {
+ // Init color
+ $SW = 2;
while ($content = SQL_FETCHARRAY($result)) {
// Construct IFN
$inc = sprintf("theme/%s/theme.php", $content['theme_path']);
// Load row template and switch color
$OUT .= loadTemplate('admin_theme_edit_row', true, $content);
$SW = 3 - $SW;
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);
`timestamp` ASC", __FILE__, __LINE__);
if ((SQL_NUMROWS($result_main) > 0) || (isPostRequestElementSet('lock'))) {
- // Count checked checkboxes
- $SEL = '0';
- if (isPostRequestElementSet('sel')) {
- // Are there checked boxes?
- if (count(postRequestElement('sel')) > 0) {
- // Count now... We use an own function for now
- $SEL = countPostSelection();
- } // END - if
- } // END - if
-
if (isPostRequestElementSet('accept')) {
- if ($SEL > 0) {
+ if (countPostSelection() > 0) {
// Accept mail orders
foreach (postRequestElement('sel') as $id => $value) {
// Secure id number
// Mails unlocked for mail delivery
loadTemplate('admin_settings_saved', false, $message);
} elseif (isPostRequestElementSet(('reject'))) {
- if ($SEL > 0) {
+ if (countPostSelection() > 0) {
// Reject mail orders
$OUT = ''; $SW = 2;
foreach (postRequestElement('sel') as $id => $value) {
// Nothing selected
loadTemplate('admin_settings_saved', false, getMessage('ADMIN_MAILS_NOTHING_CHECKED'));
}
- } elseif ((isPostRequestElementSet('lock')) && ($SEL > 0) && (getConfig('url_blacklist') == 'Y')) {
+ } elseif ((isPostRequestElementSet('lock')) && (countPostSelection() > 0) && (getConfig('url_blacklist') == 'Y')) {
// Lock URLs
foreach (postRequestElement('sel') as $id => $url) {
// Secure id number