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);
// 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>';
}
}
}
// 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