<?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 *
array($user), __FUNCTION__, __LINE__);
// Is the entry there?
- if (SQL_NUMROWS($result) == 0) {
+ if (SQL_NUMROWS($result) == '0') {
// Ok, let's create the admin login
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`) VALUES ('%s', '%s', '%s')",
array(
$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
$OUT = "<select name=\"".$mode."_menu";
- if ((!empty($defid)) || ($defid == 0)) $OUT .= "[".$defid."]";
+ if ((!empty($defid)) || ($defid == '0')) $OUT .= "[".$defid."]";
$OUT .= "\" size=\"1\" class=\"admin_select\">
<option value=\"\">{--SELECT_NONE--}</option>\n";
// @TODO Try to rewrite this to $content = SQL_FETCHARRAY(). Please look some lines above for the dynamic query
$title = $userid;
} // END - if
- if (($title == 0) && ($what == 'list_refs')) {
+ if (($title == '0') && ($what == 'list_refs')) {
// Return title again
return $title;
} elseif (isExtensionActive('nickname')) {
// Change activation status
function adminChangeActivationStatus ($IDs, $table, $row, $idRow = 'id') {
- $cnt = 0; $newStatus = 'Y';
+ $cnt = '0'; $newStatus = 'Y';
if ((is_array($IDs)) && (count($IDs) > 0)) {
// "Walk" all through and count them
foreach ($IDs as $id => $selected) {
// Shall we change here or list for editing?
if ($editNow === true) {
// Change them all
- $affected = 0;
+ $affected = '0';
foreach ($IDs as $id => $sel) {
// Prepare content array (new values)
$content = array();
array($email), __FUNCTION__, __LINE__);
// Is there an account?
- if (SQL_NUMROWS($result) == 0) {
+ if (SQL_NUMROWS($result) == '0') {
// No account found!
return getMessage('ADMIN_NO_LOGIN_WITH_EMAIL');
} // END - if