if (($menu == $action) && (empty($what))) {
$OUT .= '<strong>';
} else {
- $OUT .= '[<a href="{?URL?}/modules.php?module=admin&action=' . $menu . '">';
+ $OUT .= '[<a href="{%url=modules.php?module=admin&action=' . $menu . '%}">';
}
} else {
$OUT .= '<em style="cursor:help" class="admin_note" title="{--MENU_ACTION_404--}">';
if ($what == $what_sub) {
$OUT .= '<strong>';
} else {
- $OUT .= '[<a href="{?URL?}/modules.php?module=admin&what=' . $what_sub . '">';
+ $OUT .= '[<a href="{%url=modules.php?module=admin&what=' . $what_sub . '%}">';
}
} else {
$OUT .= '<em style="cursor:help" class="admin_note" title="{--MENU_WHAT_404--}">';
}
// Wrapper for $_POST and adminSaveSettings
-function adminSaveSettingsFromPostData ($tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false) {
+function adminSaveSettingsFromPostData ($tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false, $displayMessage = true) {
// Get the array
$postData = postRequestArray();
// Call the lower function
- adminSaveSettings($postData, $tableName, $whereStatement, $translateComma, $alwaysAdd);
+ adminSaveSettings($postData, $tableName, $whereStatement, $translateComma, $alwaysAdd, $displayMessage);
}
// Save settings to the database
-function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false) {
+function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false, $displayMessage = true) {
// Prepare all arrays, variables
$DATA = array();
$skip = false;
// Simply run generated SQL string
SQL_QUERY($sql, __FUNCTION__, __LINE__);
+ // Remember affected rows
+ $affected = SQL_AFFECTEDROWS();
+
// Rebuild cache
rebuildCacheFile('config', 'config');
- // Settings saved
- loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
+ // Settings saved, so display message?
+ if ($displayMessage === true) loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
+
+ // Return affected rows
+ return $affected;
}
// Generate a selection box
if (($title == '') && ($userid > 0)) {
// Set userid as title
$title = $userid;
- } // END - if
+ } elseif ($userid == 0) {
+ // User id zero is invalid
+ return '<strong>' . $userid . '</strong>';
+ }
if (($title == '0') && ($what == 'list_refs')) {
// Return title again
}
// Return link
- return '[<a href="{?URL?}/modules.php?module=admin&what=' . $what . '&userid=' . $userid . '" title="{--ADMIN_USER_PROFILE_TITLE--}">' . $title . '</a>]';
+ return '[<a href="{%url=modules.php?module=admin&what=' . $what . '&userid=' . $userid . '%}" title="{--ADMIN_USER_PROFILE_TITLE--}">' . $title . '</a>]';
}
// Check "logical-area-mode"
function adminGetMenuMode () {
// Set the global mode as the mode for all admins
$mode = getConfig('admin_menu');
- $ADMIN = $mode;
+ $adminMode = $mode;
// Get admin id
$adminId = getCurrentAdminId();
// Check individual settings of current admin
if (isset($GLOBALS['cache_array']['admin']['la_mode'][$adminId])) {
// Load from cache
- $ADMIN = $GLOBALS['cache_array']['admin']['la_mode'][$adminId];
+ $adminMode = $GLOBALS['cache_array']['admin']['la_mode'][$adminId];
incrementStatsEntry('cache_hits');
} elseif (isExtensionInstalledAndNewer('admins', '0.6.7')) {
// Load from database when version of 'admins' is enough
array($adminId), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load data
- list($ADMIN) = SQL_FETCHROW($result);
+ list($adminMode) = SQL_FETCHROW($result);
}
// Free memory
}
// Check what the admin wants and set it when it's not the global mode
- if ($ADMIN != 'global') $mode = $ADMIN;
+ if ($adminMode != 'global') $mode = $adminMode;
// Return admin-menu's mode
return $mode;
// Is the userid set correctly?
if ($userid > 0) {
// Create a link to that profile
- return '{?URL?}/modules.php?module=admin&what=list_user&userid='.bigintval($userid);
+ return '{%url=modules.php?module=admin&what=list_user&userid='.bigintval($userid) . '%}';
} // END - if
// Return a link to the user list
- return '{?URL?}/modules.php?module=admin&what=list_user';
+ return '{%url=modules.php?module=admin&what=list_user%}';
}
// Generate a "link" for the given admin id (admin_id)