X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-admins_add.php;h=eb3ec7336682ec831abdf7d1b406460ea04fca7c;hb=854fcac4ae5fe26e28e9d4d7b8361f2ab455aeb1;hp=45fd36eaafae9afcad275bda6af21420463ed7e9;hpb=f13b0c89b6dce2dc31ef3c58f0e2ad4821d7bee8;p=mailer.git diff --git a/inc/modules/admin/what-admins_add.php b/inc/modules/admin/what-admins_add.php index 45fd36eaaf..eb3ec73366 100644 --- a/inc/modules/admin/what-admins_add.php +++ b/inc/modules/admin/what-admins_add.php @@ -10,9 +10,14 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Neues Administrator-Account anlegen * * -------------------------------------------------------------------- * - * * + * $Revision:: $ * + * $Date:: $ * + * $Tag:: 0.2.1-FINAL $ * + * $Author:: $ * + * Needs to be in all Files and every File needs "svn propset * + * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * - * Copyright (c) 2003 - 2008 by Roland Haeder * + * Copyright (c) 2003 - 2009 by Roland Haeder * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -32,49 +37,41 @@ ************************************************************************/ // Some security stuff... -if ((!defined('__SECURITY')) || (!IS_ADMIN())) { - $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; - require($INC); -} +if ((!defined('__SECURITY')) || (!isAdmin())) { + die(); +} // END - if // Add description as navigation point -ADD_DESCR("admin", __FILE__); - -global $cacheInstance; +addMenuDescription('admin', __FILE__); // Display form is default $FORM = true; -if ((isset($_POST['add'])) && (!empty($_POST['login'])) && (!empty($_POST['email'])) && (!empty($_POST['pass1'])) && (!empty($_POST['pass2'])) && ($_POST['pass1'] == $_POST['pass2'])) { +if ((isPostRequestElementSet('add')) && (isPostRequestElementSet('login')) && (isPostRequestElementSet('email')) && (isPostRequestElementSet('pass1')) && (isPostRequestElementSet('pass2')) && (postRequestElement('pass1') == postRequestElement('pass2'))) { // Add admin when not added already - $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1", - array($_POST['login']), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 0) { - // Login does not exist so we can create it. + if (addAdminAccount(postRequestElement('login'), generateHash(postRequestElement('pass1')), postRequestElement('email')) == 'done') { + // Do not ouput any form! $FORM = false; - $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_admins (login, password, email) VALUES ('%s','%s','%s')", - array($_POST['login'], generateHash($_POST['pass1']), $_POST['email']), __FILE__, __LINE__); // Admin login saved - LOAD_TEMPLATE("admin_settings_saved", false, "".ADMIN_ADMINS_ADD_DONE.""); + loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ADMINS_ADD_DONE')); - // Remove cache file - if (EXT_IS_ACTIVE("cache")) { - if ($cacheInstance->cache_file("admins")) $cacheInstance->cache_destroy(); - } - } else { - // Free memory - SQL_FREERESULT($result); - } -} + // Run filter chain + runFilterChain('post_admin_added', postRequestArray()); + } // END - if +} // END - if -if ($FORM) { - // Clear unset variables - if (empty($_POST['login'])) $_POST['login'] = ""; - if (empty($_POST['email'])) $_POST['email'] = ""; +// Shall we display the form? +if ($FORM === true) { + // Prepare content + $content = merge_array( + array('login' => '', 'email' => ''), + postRequestArray() + ); // Load form from template - LOAD_TEMPLATE("admin_admins_add"); -} -// + loadTemplate('admin_admins_add', false, $content); +} // END - if + +// [EOF] ?>