]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-admins_add.php
Naming convention further applied, TODOs.txt updated
[mailer.git] / inc / modules / admin / what-admins_add.php
index 2e04c48598732b0ae2c98565970c885548a9f93e..3edfbca24fc7b7ee3ece589e9567dfeca9c9026c 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                              *
@@ -17,7 +17,8 @@
  * 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                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  ************************************************************************/
 
 // 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__);
+addMenuDescription('admin', __FILE__);
 
 // Display form is default
 $FORM = true;
 
-if ((REQUEST_ISSET_POST(('add'))) && (REQUEST_ISSET_POST('login')) && (REQUEST_ISSET_POST('email')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))) && (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
-       // Add admin when not added already
-       if (REGISTER_ADMIN(REQUEST_POST('login'), generateHash(REQUEST_POST('pass1')), REQUEST_POST('email')) == 'done') {
-               // Do not ouput any form!
-               $FORM = false;
+// Is the form sent?
+if (isFormSent('add')) {
+       // Check all
+       if ((isPostRequestParameterSet('login')) && (isPostRequestParameterSet('email')) && (isPostRequestParameterSet('pass1')) && (isPostRequestParameterSet('pass2')) && (postRequestParameter('pass1') == postRequestParameter('pass2'))) {
+               // Add admin when not added already
+               if (addAdminAccount(postRequestParameter('login'), generateHash(postRequestParameter('pass1')), postRequestParameter('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
+                       loadTemplate('admin_settings_saved', false, '{--ADMIN_ADMINS_ADD_DONE--}');
 
-               // Run filter chain
-               runFilterChain('post_admin_added', REQUEST_POST_ARRAY());
+                       // 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 still need this ugly code here?
-       if (!REQUEST_ISSET_POST('login')) REQUEST_SET_POST('login', '');
-       if (!REQUEST_ISSET_POST('email')) REQUEST_SET_POST('email', '');
+       // 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]
 ?>