<?php
/************************************************************************
- * MXChange v0.2.1 Start: 08/31/2003 *
- * =============== Last change: 11/23/2004 *
+ * Mailer v0.2.1-FINAL Start: 08/31/2003 *
+ * =================== Last change: 11/23/2004 *
* *
* -------------------------------------------------------------------- *
* File : admin-inc.php *
$md5,
$email
), __FUNCTION__, __LINE__);
+
+ // All done
$ret = 'done';
} // END - if
SQL_FREERESULT($result);
}
- //* DEBUG: */ outputHtml("*".$data['password'].'/'.md5($password).'/'.$ret."<br />");
+ //* DEBUG: */ outputHtml('*' . $data['password'] . '/' . md5($password) .'/' . $ret . '*<br />');
if ((isset($data['password'])) && (strlen($data['password']) == 32) && ($data['password'] == md5($password))) {
// Generate new hash
$data['password'] = generateHash($password);
// Is the sql_patches not installed, than we cannot have a valid hashed password here!
+ //* DEBUG: */ outputHtml($ret . ',' . intval(isExtensionInstalledAndOlder('sql_patches', '0.3.6')) . '/' . intval(!isExtensionInstalled('sql_patches')).'<br />');
if (($ret == 'pass') && ((isExtensionInstalledAndOlder('sql_patches', '0.3.6')) || (!isExtensionInstalled('sql_patches')))) $ret = 'done';
} elseif ((isExtensionInstalledAndOlder('sql_patches', '0.3.6')) || (!isExtensionInstalled('sql_patches'))) {
// Old hashing way
$salt = substr($data['password'], 0, -40);
// Check if password is same
- //* DEBUG: */ outputHtml("*".$ret.','.$data['password'].','.$password.','.$salt."*<br />");
- if (($ret == 'pass') && ($data['password'] == generateHash($password, $salt)) && ((!empty($salt))) || ($data['password'] == $password)) {
+ //* DEBUG: */ outputHtml('*' . $ret . ',' . $data['password'] . ',' . $password . ',' . $salt . '*<br />');
+ if (($ret == 'pass') && ($data['password'] == generateHash($password, $salt)) && ((!empty($salt))) || ($data['password'] == md5($password))) {
// Re-hash the plain passord with new random salt
$data['password'] = generateHash($password);
setSession('admin_login', $adminLogin)
) && (
setSession('admin_last', time())
- ) && (
- setSession('admin_to', bigintval(postRequestElement('timeout')))
));
}
// Tableset header
loadTemplate('admin_main_header', false, $content);
- // Is sql_patches not yet installed?
- if (!isExtensionInstalled('sql_patches')) {
- // Output warning
- loadTemplate('admin_settings_saved', false, getMessage('ADMIN_WARNING_SQL_PATCHES_MISSING'));
- } // END - if
-
// Check if action/what pair is valid
$result_action = SQL_QUERY_ESC("SELECT
`id`
)
)
LIMIT 1",
- array($action, $what, $what), __FUNCTION__, __LINE__);
+ array(
+ $action,
+ $what,
+ $what
+ ), __FUNCTION__, __LINE__);
+
+ // Do we have an entry?
if (SQL_NUMROWS($result_action) == 1) {
// Is valid but does the inlcude file exists?
$inc = sprintf("inc/modules/admin/action-%s.php", $action);
}
} else {
// Invalid action/what pair found!
- loadTemplate('admin_menu_failed', false, sprintf(getMessage('ADMIN_ACTION_INVALID'), $action.'/'.$what));
+ loadTemplate('admin_menu_failed', false, sprintf(getMessage('ADMIN_ACTION_INVALID'), $action . '/' . $what));
}
// Free memory
// Do we have entries?
if (SQL_NUMROWS($result_main) > 0) {
- $OUT = "<div style=\"height:7px\" class=\"seperator\"> </div>\n";
- $OUT .= "<ul class=\"admin_menu_main\">\n";
+ $OUT = '<div style="height:7px" class="seperator"> </div>';
+ $OUT .= '<ul class="admin_menu_main">';
// @TODO Rewrite this to $content = SQL_FETCHARRAY()
while (list($menu, $title, $descr) = SQL_FETCHROW($result_main)) {
if ((isExtensionActive('admins')) && (getExtensionVersion('admins') > '0.2.0')) {
$GLOBALS['menu']['title'][$menu] = $title;
$GLOBALS['menu']['description'][$menu] = $descr;
}
- $OUT .= "<li class=\"admin_menu\">
-<div class=\"nobr\"><strong>·</strong> ";
+ $OUT .= '<li class="admin_menu">
+<div class="nobr"><strong>·</strong> ';
if ($readable === true) {
if (($menu == $action) && (empty($what))) {
- $OUT .= "<strong>";
+ $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--}\">";
+ $OUT .= '<em style="cursor:help" class="admin_note" title="{--MENU_ACTION_404--}">';
}
$OUT .= $title;
if ($readable === true) {
if (($menu == $action) && (empty($what))) {
- $OUT .= "</strong>";
+ $OUT .= '</strong>';
} else {
- $OUT .= "</a>]";
+ $OUT .= '</a>]';
}
} else {
- $OUT .= "</em>";
+ $OUT .= '</em>';
}
- $OUT .= "</div>
-</li>\n";
+ $OUT .= '</div>
+</li>';
// Check for menu entries
$result_what = SQL_QUERY_ESC("SELECT
if ((ifAdminMenuHasEntries($menu)) && (SQL_NUMROWS($result_what) > 0)) {
$GLOBALS['menu']['description'] = array();
$GLOBALS['menu']['title'] = array(); $SUB = true;
- $OUT .= "<li class=\"admin_menu_sub\"><ul class=\"admin_menu_sub\">\n";
+ $OUT .= '<li class="admin_menu_sub"><ul class="admin_menu_sub">';
// @TODO Rewrite this to $content = SQL_FETCHARRAY()
while (list($what_sub, $title_what, $desc_what) = SQL_FETCHROW($result_what)) {
// Check for access level
// Insert compiled title and description
$GLOBALS['menu']['title'][$what_sub] = $title_what;
$GLOBALS['menu']['description'][$what_sub] = $desc_what;
- $OUT .= "<li class=\"admin_menu\">
- <div class=\"nobr\"><strong>--></strong> ";
+ $OUT .= '<li class="admin_menu">
+<div class="nobr"><strong>--></strong> ';
if ($readable === true) {
if ($what == $what_sub) {
- $OUT .= "<strong>";
+ $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--}\">";
+ $OUT .= '<em style="cursor:help" class="admin_note" title="{--MENU_WHAT_404--}">';
}
$OUT .= $title_what;
if ($readable === true) {
if ($what == $what_sub) {
- $OUT .= "</strong>";
+ $OUT .= '</strong>';
} else {
- $OUT .= "</a>]";
+ $OUT .= '</a>]';
}
} else {
- $OUT .= "</em>";
+ $OUT .= '</em>';
}
- $OUT .= "</div>
-</li>\n";
+ $OUT .= '</div>
+</li>';
} // END - if
} // END - while
// Free memory
SQL_FREERESULT($result_what);
- $OUT .= "</ul>
-</li>\n";
+ $OUT .= '</ul>
+</li>';
} // END - if
- $OUT .= "<li style=\"height:7px\" class=\"seperator\"> </li>\n";
+ $OUT .= '<li style="height:7px" class="seperator"> </li>';
} // END - if
} // END - while
// Free memory
SQL_FREERESULT($result_main);
- $OUT .= "</ul>\n";
+ $OUT .= '</ul>';
}
// Is there a cache instance again?
$OUT = '';
// USe this only for adding points (e.g. adding refs really makes no sence ;-) )
- if ($add_all === true) $OUT = " <option value=\"all\">{--ALL_MEMBERS--}</option>\n";
- elseif ($none === true) $OUT = " <option value=\"0\">{--SELECT_NONE--}</option>\n";
+ if ($add_all === true) $OUT = ' <option value="all">{--ALL_MEMBERS--}</option>';
+ elseif ($none === true) $OUT = ' <option value="0">{--SELECT_NONE--}</option>';
while ($content = SQL_FETCHARRAY($result)) {
- $OUT .= " <option value=\"".bigintval($content['userid'])."\"";
+ $OUT .= ' <option value="' . bigintval($content['userid']) . '"';
if ($def == $content['userid']) $OUT .= ' selected="selected"';
- $OUT .= ">".$content['surname']." ".$content['family']." (".bigintval($content['userid']).")</option>\n";
+ $OUT .= '>' . $content['surname'] . ' ' . $content['family'] . ' (' . bigintval($content['userid']) . ')</option>';
} // END - while
// Free memory
loadTemplate('admin_member_selection_box', false, $content);
} else {
// Return content in selection frame
- return "<select class=\"admin_select\" name=\"".$field."\" size=\"1\">\n".$OUT."</select>\n";
+ return '<select class="admin_select" name="' . $field . '" size="1">' . $OUT . '</select>';
}
}
function adminMenuSelectionBox_DEPRECATED ($mode, $default = '', $defid = '') {
$what = "`what` != ''";
if ($mode == 'action') $what = "(`what`='' OR `what` IS NULL) AND action !='login'";
- $result = SQL_QUERY_ESC("SELECT %s, title FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$what." ORDER BY `sort`",
+ $result = SQL_QUERY_ESC("SELECT %s, `title` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$what." ORDER BY `sort` ASC",
array($mode), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Load menu as selection
}
// 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)