X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fadmin-inc.php;h=c3eaf82143d1eeee9b2e8debd444d25e234ca9fe;hb=a5966b77de4635f56787c2606292ac436d8c7039;hp=3ddc50cb8adbd94489cb32cc9cda189894884397;hpb=f5e2b428b0b5206b5758190d379d5c9d6bdce9e1;p=mailer.git diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 3ddc50cb8a..c3eaf82143 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -16,7 +16,7 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * + * Copyright (c) 2009 - 2011 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -218,11 +218,11 @@ LIMIT 1", // Access denied loadTemplate('admin_menu_failed', false, getMaskedMessage('ADMIN_ACCESS_DENIED', $what)); } else { - // Include file not found! :-( + // Include file not found :-( loadTemplate('admin_menu_failed', false, getMaskedMessage('ADMIN_ACTION_404', $action)); } } else { - // Invalid action/what pair found! + // Invalid action/what pair found loadTemplate('admin_menu_failed', false, getMaskedMessage('ADMIN_ACTION_INVALID', $action . '/' . $what)); } @@ -296,7 +296,7 @@ ORDER BY $OUT .= '['; } } else { - $OUT .= ''; + $OUT .= ''; } $OUT .= $title; @@ -358,7 +358,7 @@ ORDER BY $OUT .= '['; } } else { - $OUT .= ''; + $OUT .= ''; } $OUT .= $title_what; @@ -489,7 +489,7 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement // Process only formular field but not submit buttons ;) if ($id != 'ok') { // Do not save the ok value - convertSelectionsToTimestamp($postData, $tableData, $id, $skip); + convertSelectionsToEpocheTime($postData, $tableData, $id, $skip); // Shall we process this id? It muss not be empty, of course if (($skip === false) && (!empty($id)) && ((!isset($GLOBALS['skip_config'][$id]))) || ($tableName != '_config')) { @@ -576,7 +576,7 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement rebuildCache('config', 'config'); // Settings saved, so display message? - if ($displayMessage === true) loadTemplate('admin_settings_saved', false, '{--SETTINGS_SAVED--}'); + if ($displayMessage === true) displayMessage('{--SETTINGS_SAVED--}'); // Return affected rows return $affected; @@ -638,7 +638,9 @@ function generateUserProfileLink ($userid, $title = '', $what = 'list_user') { $nick = getNickname($userid); // Is it not empty, use it as title else the userid - if (!empty($nick)) $title = $nick . '(' . $userid . ')'; else $title = $userid; + if (!empty($nick)) { + $title = $nick . '(' . $userid . ')'; else $title = $userid; + } // END - if } // Return link @@ -648,7 +650,14 @@ function generateUserProfileLink ($userid, $title = '', $what = 'list_user') { // Check "logical-area-mode" function adminGetMenuMode () { // Set the default menu mode as the mode for all admins - $mode = getAdminMenu(); + $mode = 'global'; + + // If sql_patches is up-to-date enough, use the configuration + if (isExtensionInstalledAndNewer('sql_patches', '0.3.2')) { + $mode = getAdminMenu(); + } // END - if + + // Backup it $adminMode = $mode; // Get admin id @@ -720,10 +729,10 @@ function adminChangeActivationStatus ($IDs, $table, $row, $idRow = 'id') { } // END - foreach // Output status - loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_STATUS_CHANGED'), $count, count($IDs))); + displayMessage(sprintf(getMessage('ADMIN_STATUS_CHANGED'), $count, count($IDs))); } else { // Nothing selected! - loadTemplate('admin_settings_saved', false, '{--ADMIN_NOTHING_SELECTED_CHANGE--}'); + displayMessage('{--ADMIN_NOTHING_SELECTED_CHANGE--}'); } } @@ -954,10 +963,10 @@ function adminDeleteEntriesConfirm ($IDs, $table, $columns = array(), $filterFun // Was this fine? if (SQL_AFFECTEDROWS() == count($IDs)) { // All deleted - loadTemplate('admin_settings_saved', false, '{--ADMIN_ALL_ENTRIES_REMOVED--}'); + displayMessage('{--ADMIN_ALL_ENTRIES_REMOVED--}'); } else { // Some are still there :( - loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_DELETED'), SQL_AFFECTEDROWS(), count($IDs))); + displayMessage(sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_DELETED'), SQL_AFFECTEDROWS(), count($IDs))); } } else { // List for deletion confirmation @@ -1043,10 +1052,10 @@ function adminEditEntriesConfirm ($IDs, $table, $columns = array(), $filterFunct // Was this fine? if ($affected == count($IDs)) { // All deleted - loadTemplate('admin_settings_saved', false, '{--ADMIN_ALL_ENTRIES_EDITED--}'); + displayMessage('{--ADMIN_ALL_ENTRIES_EDITED--}'); } else { // Some are still there :( - loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_EDITED'), $affected, count($IDs))); + displayMessage(sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_EDITED'), $affected, count($IDs))); } } else { // List for editing @@ -1111,7 +1120,7 @@ function sendAdminPasswordResetLink ($email) { // Is there an account? if (SQL_HASZERONUMS($result)) { - // No account found! + // No account found return '{--ADMIN_NO_LOGIN_WITH_EMAIL--}'; } // END - if @@ -1122,20 +1131,20 @@ function sendAdminPasswordResetLink ($email) { SQL_FREERESULT($result); // Generate hash for reset link - $content['hash'] = generateHash(getUrl() . ':' . $content['id'] . ':' . $content['login'] . ':' . $content['password'], substr($content['password'], 10)); + $content['hash'] = generateHash(getUrl() . getEncryptSeperator() . $content['id'] . getEncryptSeperator() . $content['login'] . getEncryptSeperator() . $content['password'], substr($content['password'], getSaltLength())); // Remove some data unset($content['id']); unset($content['password']); // Prepare email - $mailText = loadEmailTemplate('form_reset_password', $content); + $mailText = loadEmailTemplate('admin_reset_password', $content); // Send it out - sendEmail($email, '{--ADMIN_RESET_PASS_LINK_SUBJECT--}', $mailText); + sendEmail($email, '{--ADMIN_RESET_PASSWORD_LINK_SUBJECT--}', $mailText); // Prepare output - return '{--ADMIN_RESET_LINK_SENT--}'; + return '{--ADMIN_RESET_PASSWORD_LINK_SENT--}'; } // Validate hash and login for password reset @@ -1153,7 +1162,7 @@ function adminResetValidateHashLogin ($hash, $login) { $content = SQL_FETCHARRAY($result); // Generate hash again - $hashFromData = generateHash(getUrl() . ':' . $content['id'] . ':' . $login . ':' . $content['password'], substr($content['password'], 10)); + $hashFromData = generateHash(getUrl() . getEncryptSeperator() . $content['id'] . getEncryptSeperator() . $login . getEncryptSeperator() . $content['password'], substr($content['password'], getSaltLength())); // Does both match? $valid = ($hash == $hashFromData); @@ -1304,7 +1313,7 @@ function doVerifyExpertSettings () { // Is he allowed? if ($expertSettings == 'Y') { // Okay, does he want to see them? - if (getAminsExpertWarning() == 'Y') { + if (isAdminsExpertWarningEnabled()) { // Ask for them if (isFormSent()) { // Is the element set, then we need to change the admin @@ -1345,7 +1354,7 @@ function doVerifyExpertSettings () { // Output message for other status than ask/agreed if (($return != 'ask') && ($return != 'agreed')) { // Output message - loadTemplate('admin_settings_saved', false, '{--ADMIN_EXPERT_SETTINGS_STATUS_' . strtoupper($return) . '--}'); + displayMessage('{--ADMIN_EXPERT_SETTINGS_STATUS_' . strtoupper($return) . '--}'); } // END - if // Return status @@ -1477,17 +1486,17 @@ function adminProcessMenuEditForm ($type, $subMenu) { default: // Unexpected action logDebugMessage(__FILE__, __LINE__, sprintf("Unsupported action %s detected.", postRequestParameter('ok'))); - loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_UNKNOWN_OKAY', postRequestParameter('ok'))); + displayMessage(getMaskedMessage('ADMIN_UNKNOWN_OKAY', postRequestParameter('ok'))); break; } // END - switch } // END - foreach // Load template - loadTemplate('admin_settings_saved', false, '{--SETTINGS_SAVED--}'); + displayMessage('{--SETTINGS_SAVED--}'); } // Handle weightning -function doAdminProcessMenuWeightning ($type) { +function doAdminProcessMenuWeightning ($type, $AND) { // Are there all required (generalized) GET parameter? if ((isGetRequestParameterSet('act')) && (isGetRequestParameterSet('tid')) && (isGetRequestParameterSet('fid'))) { // Init variables