mailer project continued:
[mailer.git] / inc / modules / admin / what-config_surfbar.php
index 13ab3ce6b77336d78e7c0b63964f602eec50cec6..def280a4f84283a3cd3ef9a93d06ea0b0f47af54 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 08/31/2008 *
- * ================                             Last change: 08/31/2008 *
+ * Mailer v0.2.1-FINAL                                Start: 08/31/2008 *
+ * ===================                          Last change: 08/31/2008 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : what-config_surfbar.php                          *
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Konfiguration fuer Surfbar                       *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $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 - 2012 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__);
 
 // Was the form submitted?
-if (isset($_POST['ok'])) {
+if (isFormSent()) {
        // Replace german decimal comma with computer decimal dot
-       if (isset($_POST['surfbar_static_reward']))   $_POST['surfbar_static_reward']   = REVERT_COMMA($_POST['surfbar_static_reward']);
-       if (isset($_POST['surfbar_static_costs']))    $_POST['surfbar_static_costs']    = REVERT_COMMA($_POST['surfbar_static_costs']);
-       if (isset($_POST['surfbar_dynamic_percent'])) $_POST['surfbar_dynamic_percent'] = REVERT_COMMA($_POST['surfbar_dynamic_percent']);
+       convertCommaToDotInPostDataArray(array('surfbar_static_reward', 'surfbar_static_costs', 'surfbar_dynamic_percent'));
 
        // Save settings
-       ADMIN_SAVE_SETTINGS($_POST);
+       adminSaveSettingsFromPostData();
 } else {
        // Prepare content
        $content = array(
-               'surfbar_static_reward'   => TRANSLATE_COMMA($_CONFIG['surfbar_static_reward']),
-               'surfbar_static_costs'    => TRANSLATE_COMMA($_CONFIG['surfbar_static_costs']),
-               // @TODO Rewrite this to tiny selection boxes
-               'surfbar_static_time'     => $_CONFIG['surfbar_static_time'],
-               // @TODO Rewrite this to tiny selection boxes
-               'surfbar_restart_time'    => $_CONFIG['surfbar_restart_time'],
-               'surfbar_static_lock'     => $_CONFIG['surfbar_static_lock'],
-               'surfbar_dynamic_percent' => TRANSLATE_COMMA($_CONFIG['surfbar_dynamic_percent']),
-               'surfbar_max_order'       => $_CONFIG['surfbar_max_order'],
-               // @TODO Rewrite this to tiny selection boxes
-               'surfbar_stats_reload'    => $_CONFIG['surfbar_stats_reload'],
-               // @TODO Rewrite this to tiny selection boxes
-               'surfbar_purge_deleted'   => $_CONFIG['surfbar_purge_deleted'],
-               // @TODO Rewrite this to tiny selection boxes
-               'surfbar_purge_migrated'  => $_CONFIG['surfbar_purge_migrated'],
-               'surfbar_pause_url'       => $_CONFIG['surfbar_pause_url'],
-               'surfbar_warn_low_points' => $_CONFIG['surfbar_warn_low_points'],
-               // @TODO Rewrite this to tiny selection boxes
-               'surfbar_low_interval'    => $_CONFIG['surfbar_low_interval'],
+               'surfbar_static_time'     => createConfigurationTimeSelections('surfbar_static_time'   , 'ms' , 'left'),
+               'surfbar_static_lock'     => createConfigurationTimeSelections('surfbar_static_lock'   , 'hm' , 'left'),
+               'surfbar_restart_time'    => createConfigurationTimeSelections('surfbar_restart_time'  , 'ms' , 'left'),
+               'surfbar_stats_reload'    => createConfigurationTimeSelections('surfbar_stats_reload'  , 'ms' , 'left'),
+               'surfbar_purge_deleted'   => createConfigurationTimeSelections('surfbar_purge_deleted' , 'WDh', 'left'),
+               'surfbar_purge_migrated'  => createConfigurationTimeSelections('surfbar_purge_migrated', 'WDh', 'left'),
+               'surfbar_low_interval'    => createConfigurationTimeSelections('surfbar_low_interval'  , 'WDh', 'left'),
        );
 
-       // Prepare payment model for template
-       if ($_CONFIG['surfbar_pay_model'] == "STATIC") {
-               // Static model
-               define('__CONFIG_SURFBAR_PAY_MODEL_STATIC' , " checked=\"checked\"");
-               define('__CONFIG_SURFBAR_PAY_MODEL_DYNAMIC', "");
-       } else {
-               // Dynamic model
-               define('__CONFIG_SURFBAR_PAY_MODEL_STATIC' , "");
-               define('__CONFIG_SURFBAR_PAY_MODEL_DYNAMIC', " checked=\"checked\"");
-       }
-
-       // Prepare auto-sart
-       if ($_CONFIG['surfbar_autostart'] == "Y") {
-               // Yes selected
-               define('__CONFIG_SURFBAR_AUTOSTART_Y', " checked=\"checked\"");
-               define('__CONFIG_SURFBAR_AUTOSTART_N', "");
-       } else {
-               // No selected
-               define('__CONFIG_SURFBAR_AUTOSTART_Y', "");
-               define('__CONFIG_SURFBAR_AUTOSTART_N', " checked=\"checked\"");
-       }
-
-       // Prepare notify limits
-       if ($_CONFIG['surfbar_notify_limits'] == "Y") {
-               // Yes selected
-               define('__CONFIG_SURFBAR_NOTIFY_LIMITS_Y', " checked=\"checked\"");
-               define('__CONFIG_SURFBAR_NOTIFY_LIMITS_N', "");
-       } else {
-               // No selected
-               define('__CONFIG_SURFBAR_NOTIFY_LIMITS_Y', "");
-               define('__CONFIG_SURFBAR_NOTIFY_LIMITS_N', " checked=\"checked\"");
-       }
-
-       // Prepare order migration
-       if ($_CONFIG['surfbar_migrate_order'] == "Y") {
-               // Yes selected
-               define('__CONFIG_SURFBAR_MIGRATE_ORDER_Y', " checked=\"checked\"");
-               define('__CONFIG_SURFBAR_MIGRATE_ORDER_N', "");
-       } else {
-               // No selected
-               define('__CONFIG_SURFBAR_MIGRATE_ORDER_Y', "");
-               define('__CONFIG_SURFBAR_MIGRATE_ORDER_N', " checked=\"checked\"");
-       }
-
-       // Pause URL mode
-       if ($_CONFIG['surfbar_pause_mode'] == "INTERNAL") {
-               // Internal pause page
-               define('__CONFIG_SURFBAR_PAUSE_MODE_INTERNAL', " checked=\"checked\"");
-               define('__CONFIG_SURFBAR_PAUSE_MODE_EXTERNAL', "");
-       } else {
-               // External pause page (if not empty)
-               define('__CONFIG_SURFBAR_PAUSE_MODE_INTERNAL', "");
-               define('__CONFIG_SURFBAR_PAUSE_MODE_EXTERNAL', " checked=\"checked\"");
-       }
+       // Even some more...
+       foreach (array('surfbar_payment_model_static','surfbar_payment_model_dynamic','surfbar_pause_mode_internal','surfbar_pause_mode_external','surfbar_notification_mode_instant','surfbar_notification_mode_reset') as $entry) {
+               $content[$entry] = '';
+       } // END - foreach
 
-       // Notification mode
-       if ($_CONFIG['surfbar_notification_mode'] == "INSTANT") {
-               // Instant notification
-               define('__CONFIG_SURFBAR_NOTIFICATION_MODE_INSTANT', " selected=\"selected\"");
-               define('__CONFIG_SURFBAR_NOTIFICATION_MODE_RESET'  , "");
-       } else {
-               // Only daily reset
-               define('__CONFIG_SURFBAR_NOTIFICATION_MODE_INSTANT', "");
-               define('__CONFIG_SURFBAR_NOTIFICATION_MODE_RESET'  , " selected=\"selected\"");
-       }
+       // Prepare selections
+       foreach (array('surfbar_payment_model','surfbar_pause_mode','surfbar_notification_mode') as $entry) {
+               $content[$entry . '_' . strtolower(getConfig($entry))] = ' checked="checked"';
+       } // END - foreach
 
        // Load template
-       LOAD_TEMPLATE("admin_config_surfbar", false, $content);
+       loadTemplate('admin_config_surfbar', false, $content);
 }
 
-//
+// [EOF]
 ?>