]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-admins_add.php
Updated copyright year.
[mailer.git] / inc / modules / admin / what-admins_add.php
index c1054846cbb493b4d4bdd2b3e0db36e3b8b0fbcf..20aeb6199b25c4f491ee5850e9bf16a9c24b792f 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 04/12/2004 *
- * ================                             Last change: 04/18/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 04/12/2004 *
+ * ===================                          Last change: 04/18/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : what-admins_add.php                              *
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Neues Administrator-Account anlegen              *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
  ************************************************************************/
 
 // 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__);
+addYouAreHereLink('admin', __FILE__);
 
 // Display form is default
-$FORM = true;
+$FORM = TRUE;
 
-if ((isset($_POST['add'])) && (!empty($_POST['login'])) && (!empty($_POST['email'])) && (!empty($_POST['pass1'])) && (!empty($_POST['pass2'])) && ($_POST['pass1'] == $_POST['pass2'])) {
-       // Add admin when not added already
-       if (REGISTER_ADMIN($_POST['login'], generateHash($_POST['pass1']), $_POST['email']) == "done") {
-               // Do not ouput any form!
-               $FORM = false;
+// Is the form sent?
+if (isFormSent('add')) {
+       // Check all
+       if ((isPostRequestElementSet('login')) && (isPostRequestElementSet('email')) && (isPostRequestElementSet('password1')) && (isPostRequestElementSet('password2')) && (postRequestElement('password1') == postRequestElement('password2'))) {
+               // Add admin when not added already
+               if (addAdminAccount(postRequestElement('login'), generateHash(postRequestElement('password1')), postRequestElement('email')) == 'done') {
+                       // Do not ouput any form!
+                       $FORM = FALSE;
 
-               // Admin login saved
-               LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_ADMINS_ADD_DONE'));
+                       // Admin login saved
+                       displayMessage('{--ADMIN_ADMINS_ADD_DONE--}');
 
-               // Run filter chain
-               RUN_FILTER('post_admin_added', $_POST);
+                       // Run filter chain
+                       runFilterChain('post_admin_added', postRequestArray());
+               } // END - if
        } // END - if
 } // END - if
 
 // Shall we display the form?
-if ($FORM === true) {
-       // Set missing elements
-       // @TODO Do we need this ugly code here?
-       if (!isset($_POST['login'])) $_POST['login'] = "";
-       if (!isset($_POST['email'])) $_POST['email'] = "";
+if ($FORM === TRUE) {
+       // Prepare content
+       $content = merge_array(
+               array('login' => '', 'email' => ''),
+               postRequestArray()
+       );
 
        // Load form from template
-       LOAD_TEMPLATE("admin_admins_add");
+       loadTemplate('admin_add_admins', FALSE, $content);
 } // END - if
 
-//
+// [EOF]
 ?>