fooRequestElementBar() functions renamed, adding of request parameters added:
[mailer.git] / inc / modules / admin / what-config_other.php
index ad5dc9e..45aea71 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 10/11/2003 *
- * ===============                              Last change: 09/21/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 10/11/2003 *
+ * ===================                          Last change: 09/21/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : what-config_other.php                            *
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Grund Einstellungen                              *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $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 *
  ************************************************************************/
 
 // Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN())) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
-       require($INC);
-} elseif ((!EXT_IS_ACTIVE("other")) || (GET_EXT_VERSION("other") == "")) {
-       // Missing extension!
-       ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "other"));
-       return;
-}
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+       die();
+} // END - if
 
 // Add description as navigation point
-ADD_DESCR("admin", basename(__FILE__));
+addMenuDescription('admin', __FILE__);
+
+if (!isExtensionActive('other')) {
+       // Missing extension!
+       loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('other'));
+       return;
+} // END - if
 
 // Stop saving data if one input field is !isset
-if (isset($_POST['ok'])) {
-       if (function_exists('CREATE_TIME_SELECTIONS')) {
-               // Calculate stamps and set calculated stamps
-               $_POST['online_timeout']        = CREATE_TIMESTAMP_FROM_SELECTIONS("ip_timeout"           , $_POST);
-               $_POST['url_tlock']             = CREATE_TIMESTAMP_FROM_SELECTIONS("url_tlock"            , $_POST);
-               $_POST['profile_lock']          = CREATE_TIMESTAMP_FROM_SELECTIONS("profile_lock"         , $_POST);
-               $_POST['profile_update']        = CREATE_TIMESTAMP_FROM_SELECTIONS("profile_update"       , $_POST);
-               $_POST['resend_profile_update'] = CREATE_TIMESTAMP_FROM_SELECTIONS("resend_profile_update", $_POST);
-       }
+if (isFormSent()) {
+       // Calculate stamps and set calculated stamps
+       setPostRequestParameter('online_timeout'       , createTimestampFromSelections('ip_timeout'           , postRequestArray()));
+       setPostRequestParameter('url_tlock'            , createTimestampFromSelections('url_tlock'            , postRequestArray()));
+       setPostRequestParameter('profile_lock'         , createTimestampFromSelections('profile_lock'         , postRequestArray()));
+       setPostRequestParameter('profile_update'       , createTimestampFromSelections('profile_update'       , postRequestArray()));
+       setPostRequestParameter('resend_profile_update', createTimestampFromSelections('resend_profile_update', postRequestArray()));
 
        // Online-Timeout shall be > 0 or your database will crow and crow and crow...
-       if (!isset($_POST['online_timeout']))         { unset($_POST['ok']); }
+       if (!isPostRequestParameterSet('online_timeout'))        { unsetPostRequestParameter('ok'); }
 
        // Chedck other timestamps (which can be zero!)
-       if (!isset($_POST['profile_lock']))          { unset($_POST['ok']); }
-       if (!isset($_POST['url_tlock']))             { unset($_POST['ok']); }
-       if (!isset($_POST['profile_update']))        { unset($_POST['ok']); }
-       if (!isset($_POST['resend_profile_update'])) { unset($_POST['ok']); }
+       if (!isPostRequestParameterSet('profile_lock'))          { unsetPostRequestParameter('ok'); }
+       if (!isPostRequestParameterSet('url_tlock'))             { unsetPostRequestParameter('ok'); }
+       if (!isPostRequestParameterSet('profile_update'))        { unsetPostRequestParameter('ok'); }
+       if (!isPostRequestParameterSet('resend_profile_update')) { unsetPostRequestParameter('ok'); }
 
        // Check other settings
-       if (!isset($_POST['max_send']))              { unset($_POST['ok']); }
-       if (!isset($_POST['max_tlength']))           { unset($_POST['ok']); }
-       if (!isset($_POST['unconfirmed']))           { unset($_POST['ok']); }
-       if (!isset($_POST['code_length']))           { unset($_POST['ok']); }
-       if (!isset($_POST['reject_url']))            { unset($_POST['ok']); }
+       if (!isPostRequestParameterSet('max_send'))              { unsetPostRequestParameter('ok'); }
+       if (!isPostRequestParameterSet('code_length'))           { unsetPostRequestParameter('ok'); }
+       if (!isPostRequestParameterSet('reject_url'))            { unsetPostRequestParameter('ok'); }
 }
 
-if (isset($_POST['ok'])) {
+if (isFormSent()) {
        // Update stamps directly
-       ADMIN_SAVE_SETTINGS($_POST);
+       adminSaveSettingsFromPostData();
 } else {
-       // Transfer config data into constants for the template (DO NOT set $_CONFIG as global in LOAD_TEMPLATE!!!)
-       define('_CFG_CODE_LENGTH'   , $_CONFIG['code_length']);
-       define('_CFG_ACT_SYSTEM'    , $_CONFIG['activate_xchange']);
-       define('_CFG_MAX_SEND'      , $_CONFIG['max_send']);
-       define('_CFG_REJECT_URL'    , $_CONFIG['reject_url']);
-
-       // Is there the pro-version function avaiable to create selection boxes instead of input boxes?
-       if (function_exists('CREATE_TIME_SELECTIONS')) {
-               // Only pro versions: time selection boxes
-               define('_CFG_ONLINE_TIMEOUT', CREATE_TIME_SELECTIONS($_CONFIG['online_timeout'], "ip_timeout"           , "ms"));
-               define('_CFG_URL_TLOCK'     , CREATE_TIME_SELECTIONS($_CONFIG['url_tlock']     , "url_tlock"            , "WDh"));
-               define('_CFG_PROFILE_LOCK'  , CREATE_TIME_SELECTIONS($_CONFIG['profile_lock']  , "profile_lock"         , "WDh"));
-               define('_CFG_PROFILE_UPDATE', CREATE_TIME_SELECTIONS($_CONFIG['profile_update'], "profile_update"       , "YM"));
-               define('_CFG_PROF_REUPDATE' , CREATE_TIME_SELECTIONS($_CONFIG['resend_profile_update'] , "resend_profile_update", "MWD"));
-       } else {
-               // Normal input boxes
-               define('_CFG_ONLINE_TIMEOUT', "<INPUT type=\"text\" name=\"online_timeout\" class=\"admin_normal\" size=\"6\"  maxlength=\"255\" value=\"".$_CONFIG['online_timeout']."\"> <FONT class=\"tiny\">(".SECS.")</FONT>");
-               define('_CFG_URL_TLOCK'     , "<INPUT type=\"text\" name=\"url_tlock\" class=\"admin_normal\" size=\"6\"  maxlength=\"255\" value=\"".$_CONFIG['url_tlock']     ."\"> <FONT class=\"tiny\">(".SECS.")</FONT>");
-               define('_CFG_PROFILE_LOCK'  , "<INPUT type=\"text\" name=\"profile_lock\" class=\"admin_normal\" size=\"6\"  maxlength=\"255\" value=\"".$_CONFIG['profile_lock']  ."\"> <FONT class=\"tiny\">(".SECS.")</FONT>");
-               define('_CFG_PROFILE_UPDATE', "<INPUT type=\"text\" name=\"profile_update\" class=\"admin_normal\" size=\"10\" maxlength=\"255\" value=\"".$_CONFIG['profile_update']."\"> <FONT class=\"tiny\">(".SECS.")</FONT>");
-               define('_CFG_PROF_REUPDATE' , "<INPUT type=\"text\" name=\"resend_profile_update\" class=\"admin_normal\" size=\"6\"  maxlength=\"255\" value=\"".$_CONFIG['resend_profile_update'] ."\"> <FONT class=\"tiny\">(".SECS.")</FONT>");
-       }
-
-       if ($_CONFIG['order_multi_page'] == 'N') {
-               define('_CFG_ORDER_MULTI_N', ' checked');
-               define('_CFG_ORDER_MULTI_Y', "");
-       } else {
-               define('_CFG_ORDER_MULTI_N', "");
-               define('_CFG_ORDER_MULTI_Y', ' checked');
-       }
-
-       if ($_CONFIG['autosend_active'] == 'N') {
-               define('_CFG_AUTOSEND_ACTIVE_N', ' checked');
-               define('_CFG_AUTOSEND_ACTIVE_Y', "");
-       } else {
-               define('_CFG_AUTOSEND_ACTIVE_N', "");
-               define('_CFG_AUTOSEND_ACTIVE_Y', ' checked');
-       }
-
-       if ($_CONFIG['send_prof_update'] == 'N') {
-               define('_CFG_SEND_UPDATE_N', ' checked');
-               define('_CFG_SEND_UPDATE_Y', "");
-       } else {
-               define('_CFG_SEND_UPDATE_N', "");
-               define('_CFG_SEND_UPDATE_Y', ' checked');
-       }
-
-       if ($_CONFIG['admin_notify'] == 'N') {
-               define('_CFG_ADMIN_NOTIFY_N', ' checked');
-               define('_CFG_ADMIN_NOTIFY_Y', "");
-       } else {
-               define('_CFG_ADMIN_NOTIFY_N', "");
-               define('_CFG_ADMIN_NOTIFY_Y', ' checked');
-       }
-
-       if ($_CONFIG['css_php'] == "DIRECT") {
-               define('_CFG_CSS_PHP_DIRECT', ' checked');
-               define('_CFG_CSS_PHP_FILE', "");
-       } else {
-               define('_CFG_CSS_PHP_DIRECT', "");
-               define('_CFG_CSS_PHP_FILE', ' checked');
-       }
-
-       if ($_CONFIG['guest_menu'] == 'Y') {
-               define('_CFG_GUEST_MENU_ACTIVE', ' checked');
-               define('_CFG_GUEST_MENU_INACTIVE', "");
-       } else {
-               define('_CFG_GUEST_MENU_ACTIVE', "");
-               define('_CFG_GUEST_MENU_INACTIVE', ' checked');
-       }
-
-       if ($_CONFIG['member_menu'] == 'Y') {
-               define('_CFG_MEMBER_MENU_ACTIVE', ' checked');
-               define('_CFG_MEMBER_MENU_INACTIVE', "");
-       } else {
-               define('_CFG_MEMBER_MENU_ACTIVE', "");
-               define('_CFG_MEMBER_MENU_INACTIVE', ' checked');
-       }
-
-       if ($_CONFIG['youre_here'] == 'Y') {
-               define('_CFG_YOURE_HERE_ACTIVE', ' checked');
-               define('_CFG_YOURE_HERE_INACTIVE', "");
-       } else {
-               define('_CFG_YOURE_HERE_ACTIVE', "");
-               define('_CFG_YOURE_HERE_INACTIVE', ' checked');
-       }
-
-       if ($_CONFIG['show_timings'] == 'Y') {
-               define('_CFG_SHOW_TIMINGS_Y', ' checked');
-               define('_CFG_SHOW_TIMINGS_N', "");
-       } else {
-               define('_CFG_SHOW_TIMINGS_Y', "");
-               define('_CFG_SHOW_TIMINGS_N', ' checked');
-       }
-
-       if ($_CONFIG['mailid_error_redirect'] == 'index') {
-               define('_CFG_MAILID_REDIRECT_INDEX', ' checked');
-               define('_CFG_MAILID_REDIRECT_REJECT', "");
-       } else {
-               define('_CFG_MAILID_REDIRECT_INDEX', "");
-               define('_CFG_MAILID_REDIRECT_REJECT', ' checked');
-       }
-
-       for ($i = 0; $i <= 5; $i++) {
-               $eval = "define('_COMMA_DEF_".$i."', \"\");";
-               if ($_CONFIG['max_comma'] == $i) $eval = "define('_COMMA_DEF_".$i."', \" selected\");";
-               eval($eval);
-       }
+       // Time selection boxes
+       $content['online_timeout']   = createTimeSelections(getConfig('online_timeout'), 'ip_timeout'           , 'ms');
+       $content['url_tlock']        = createTimeSelections(getConfig('url_tlock')     , 'url_tlock'            , 'WDh');
+       $content['profile_lock']     = createTimeSelections(getConfig('profile_lock')  , 'profile_lock'         , 'WDh');
+       $content['profile_update']   = createTimeSelections(getConfig('profile_update'), 'profile_update'       , 'YM');
+       $content['profile_reupdate'] = createTimeSelections(getConfig('resend_profile_update') , 'resend_profile_update', 'MWD');
+
+       // Prepare more Y/N selections
+       foreach(array('show_points_unconfirmed','show_timings','youre_here','member_menu','guest_menu','order_multi_page','autosend_active','send_prof_update','admin_notify','display_debug_sqls') as $entry) {
+               $content[$entry . '_y'] = '';
+               $content[$entry . '_n'] = '';
+               $content[$entry . '_' . strtolower(getConfig($entry))] = ' checked="checked"';
+       } // END - foreach
+
+       // Prepare more
+       foreach (array('css_php_direct','css_php_file','css_php_inline','mailid_error_redirect_index','mailid_error_redirect_reject') as $entry) {
+               $content[$entry] = '';
+       } // END - foreach
+
+       // Set selections
+       foreach (array('css_php','mailid_error_redirect') as $entry) {
+               $content[$entry . '_' . strtolower(getConfig($entry))] = ' checked="checked"';
+       } // END - foreach
+
+       for ($i = '0'; $i <= 5; $i++) {
+               $content['comma_def_' . $i] = '';
+       } // END - for
+
+       // Set selection
+       $content['comma_def_' . getConfig('max_comma')] = ' selected="selected"';
 
        // Load template
-       LOAD_TEMPLATE("admin_config_other");
+       loadTemplate('admin_config_other', false, $content);
 }
 
-//
+// [EOF]
 ?>