Huge script change, see http://forum.mxchange.org/topic-458.html for details:
[mailer.git] / inc / modules / admin / what-config_removeip.php
index 3ae85a89cd6598ecdf1cec24d610d519d918d976..330b6bc9e4fa483ccc43b5850800c1989e400aaf 100644 (file)
@@ -17,7 +17,7 @@
  * 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 *
  ************************************************************************/
 
 // 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__);
 
 if (isFormSent()) {
        // Save configuration
-       ADMIN_SAVE_SETTINGS_POST();
+       adminSaveSettingsFromPostData();
 } else {
        // Prepare data
-       switch (getConfig('removeip_anon_ip')) {
-               case 'Y':
-                       define('__CFG_REMOVEIP_ANON_IP_Y', ' checked="checked"');
-                       define('__CFG_REMOVEIP_ANON_IP_N', '');
-                       break;
-
-               case 'N':
-                       define('__CFG_REMOVEIP_ANON_IP_Y', '');
-                       define('__CFG_REMOVEIP_ANON_IP_N', ' checked="checked"');
-                       break;
-       } // END - switch
-
-       switch (getConfig('removeip_anon_host')) {
-               case 'Y':
-                       define('__CFG_REMOVEIP_ANON_HOST_Y', ' checked="checked"');
-                       define('__CFG_REMOVEIP_ANON_HOST_N', '');
-                       break;
-
-               case 'N':
-                       define('__CFG_REMOVEIP_ANON_HOST_Y', '');
-                       define('__CFG_REMOVEIP_ANON_HOST_N', ' checked="checked"');
-                       break;
-       } // END - switch
-
-       switch (getConfig('removeip_anon_ua')) {
-               case 'Y':
-                       define('__CFG_REMOVEIP_ANON_UA_Y', ' checked="checked"');
-                       define('__CFG_REMOVEIP_ANON_UA_N', '');
-                       break;
-
-               case 'N':
-                       define('__CFG_REMOVEIP_ANON_UA_Y', '');
-                       define('__CFG_REMOVEIP_ANON_UA_N', ' checked="checked"');
-                       break;
-       } // END - switch
-
-       switch (getConfig('removeip_anon_ref')) {
-               case 'Y':
-                       define('__CFG_REMOVEIP_ANON_REF_Y', ' checked="checked"');
-                       define('__CFG_REMOVEIP_ANON_REF_N', '');
-                       break;
-
-               case 'N':
-                       define('__CFG_REMOVEIP_ANON_REF_Y', '');
-                       define('__CFG_REMOVEIP_ANON_REF_N', ' checked="checked"');
-                       break;
-       } // END - switch
-
-       switch (getConfig('removeip_admin_show')) {
-               case 'Y':
-                       define('__CFG_REMOVEIP_ADMIN_SHOW_Y', ' checked="checked"');
-                       define('__CFG_REMOVEIP_ADMIN_SHOW_N', '');
-                       break;
-
-               case 'N':
-                       define('__CFG_REMOVEIP_ADMIN_SHOW_Y', '');
-                       define('__CFG_REMOVEIP_ADMIN_SHOW_N', ' checked="checked"');
-                       break;
-       } // END - switch
-
-       switch (getConfig('removeip_guest_show')) {
-               case 'Y':
-                       define('__CFG_REMOVEIP_GUEST_SHOW_Y', ' checked="checked"');
-                       define('__CFG_REMOVEIP_GUEST_SHOW_N', '');
-                       break;
-
-               case 'N':
-                       define('__CFG_REMOVEIP_GUEST_SHOW_Y', '');
-                       define('__CFG_REMOVEIP_GUEST_SHOW_N', ' checked="checked"');
-                       break;
-       } // END - switch
-
-       switch (getConfig('removeip_member_show')) {
-               case 'Y':
-                       define('__CFG_REMOVEIP_MEMBER_SHOW_Y', ' checked="checked"');
-                       define('__CFG_REMOVEIP_MEMBER_SHOW_N', '');
-                       break;
-
-               case 'N':
-                       define('__CFG_REMOVEIP_MEMBER_SHOW_Y', '');
-                       define('__CFG_REMOVEIP_MEMBER_SHOW_N', ' checked="checked"');
-                       break;
-       } // END - switch
-
-       switch (getConfig('removeip_sponsor_show')) {
-               case 'Y':
-                       define('__CFG_REMOVEIP_SPONSOR_SHOW_Y', ' checked="checked"');
-                       define('__CFG_REMOVEIP_SPONSOR_SHOW_N', '');
-                       break;
-
-               case 'N':
-                       define('__CFG_REMOVEIP_SPONSOR_SHOW_Y', '');
-                       define('__CFG_REMOVEIP_SPONSOR_SHOW_N', ' checked="checked"');
-                       break;
-       } // END - switch
-
-       switch (getConfig('anonymous_ip')) {
-               case "127.0.0.1":
-                       define('__CFG_ANONYMOUS_IP_LOCAL' , ' selected="selected"');
-                       define('__CFG_ANONYMOUS_IP_ZERO'  , '');
-                       define('__CFG_ANONYMOUS_IP_RANDOM', '');
-                       break;
-
-               case "0.0.0.0":
-                       define('__CFG_ANONYMOUS_IP_LOCAL' , '');
-                       define('__CFG_ANONYMOUS_IP_ZERO'  , ' selected="selected"');
-                       define('__CFG_ANONYMOUS_IP_RANDOM', '');
-                       break;
-
-               case "RANDOM":
-                       define('__CFG_ANONYMOUS_IP_LOCAL' , '');
-                       define('__CFG_ANONYMOUS_IP_ZERO'  , '');
-                       define('__CFG_ANONYMOUS_IP_RANDOM', ' selected="selected"');
-                       break;
-       } // END - switch
+       foreach (array('removeip_anon_ip','removeip_anon_host','removeip_anon_ua','removeip_anon_ref','removeip_admin_show','removeip_guest_show','removeip_member_show','removeip_sponsor_show') as $entry) {
+               $content[$entry . '_y'] = '';
+               $content[$entry . '_n'] = '';
+               $content[$entry . '_' . strtolower(getConfig($entry))] = ' selected="selected"';
+       } // END - if
+
+       // Prepare more entries
+       foreach (array('anonymous_ip_local','anonymous_ip_zero','anonymous_ip_random') as $entry) {
+               $content[$entry] =  '';
+       } // END - foreach
+
+       // Set default selections
+       foreach (array('anonymous_ip') as $entry) {
+               $content[$entry . '_' . strtolower(getConfig($entry))] = ' selected="selected"';
+       } // END - foreach
 
        // Load template
-       LOAD_TEMPLATE("admin_config_removeip");
+       loadTemplate('admin_config_removeip', false, $content);
 }
-//
+
+// [EOF]
 ?>