fooRequestElementBar() functions renamed, adding of request parameters added:
[mailer.git] / inc / modules / admin / what-config_doubler.php
index 8b21140..32f0624 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 02/12/2005 *
- * ================                             Last change: 02/12/2005 *
+ * Mailer v0.2.1-FINAL                                Start: 02/12/2005 *
+ * ===================                          Last change: 02/12/2005 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : what-config_doubler.php                          *
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Punkte verdoppeln                                *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $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 ((!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 (IS_FORM_SENT()) {
+if (isFormSent()) {
        // Replace commata with decimal dot
-       REQUEST_SET_POST('doubler_charge', REVERT_COMMA((REQUEST_POST('doubler_charge') / 100)));
-       REQUEST_SET_POST('doubler_ref'   , REVERT_COMMA((REQUEST_POST('doubler_ref') / 100)));
-       REQUEST_SET_POST('doubler_min'   , REVERT_COMMA(REQUEST_POST('doubler_min')));
-       REQUEST_SET_POST('doubler_max'   , REVERT_COMMA(REQUEST_POST('doubler_max')));
-       REQUEST_SET_POST('doubler_left'  , REVERT_COMMA(REQUEST_POST('doubler_left')));
+       setPostRequestParameter('doubler_charge', (convertCommaToDot(postRequestParameter('doubler_charge')) / 100));
+       setPostRequestParameter('doubler_ref'   , (convertCommaToDot(postRequestParameter('doubler_ref')) / 100));
+       setPostRequestParameter('doubler_min'   , convertCommaToDot(postRequestParameter('doubler_min')));
+       setPostRequestParameter('doubler_max'   , convertCommaToDot(postRequestParameter('doubler_max')));
+       setPostRequestParameter('doubler_left'  , convertCommaToDot(postRequestParameter('doubler_left')));
 
        // Save settings
-       ADMIN_SAVE_SETTINGS_POST();
+       adminSaveSettingsFromPostData();
 } else {
        // Prepare data for the template
        // - Charge rate
-       define('__DOUBLER_CHARGE', TRANSLATE_COMMA((getConfig('doubler_charge') * 100), false));
+       $content['charge']  = translateComma((getConfig('doubler_charge') * 100), false);
        // - Referal rate
-       define('__DOUBLER_REFERRAL', TRANSLATE_COMMA((getConfig('doubler_ref') * 100), false));
+       $content['referal'] = translateComma((getConfig('doubler_ref') * 100), false);
        // - Minimum points to double
-       define('__DOUBLER_MINIMUM', TRANSLATE_COMMA(getConfig('doubler_min'), false));
+       $content['minimum'] = translateComma(getConfig('doubler_min'), false);
        // - Maximum points to double
-       define('__DOUBLER_MAXIMUM', TRANSLATE_COMMA(getConfig('doubler_max'), false));
+       $content['maximum'] = translateComma(getConfig('doubler_max'), false);
        // - Points left on users account after doubling
-       define('__DOUBLER_LEFT', TRANSLATE_COMMA(getConfig('doubler_left'), false));
-       // - Max payouts to check per click/reset
-       define('__DOUBLER_MAX_SENT', getConfig('doubler_max_sent'));
-       // - Group sending
-       define('__DOUBLER_GROUP_SENT', getConfig('doubler_group_sent'));
-
-       // Take points from jackpot (Y/N)
-       switch (getConfig('doubler_jackpot'))
-       {
-       case "Y":
-               define('__DOUBLER_JACKPOT_Y', " checked=\"checked\"");
-               define('__DOUBLER_JACKPOT_N', "");
-               break;
-
-       case "N":
-               define('__DOUBLER_JACKPOT_Y', "");
-               define('__DOUBLER_JACKPOT_N', " checked=\"checked\"");
-               break;
-       }
+       $content['left']    = translateComma(getConfig('doubler_left'), false);
 
-       // Take points from own account (Y/N)
-       switch (getConfig('doubler_own'))
-       {
-       case "Y":
-               define('__DOUBLER_OWN_Y', " checked=\"checked\"");
-               define('__DOUBLER_OWN_N', "");
-               break;
+       // Init all Y/N selections
+       foreach (array('jackpot','own','sent_all') as $entry) {
+               $content[$entry . '_y'] = '';
+               $content[$entry . '_n'] = '';
+               $content[$entry . '_' . strtolower(getConfig('doubler_' . $entry))] = ' checked="checked"';
+       } // END - foreach
 
-       case "N":
-               define('__DOUBLER_OWN_Y', "");
-               define('__DOUBLER_OWN_N', " checked=\"checked\"");
-               break;
-       }
+       // Init other selections
+       foreach (array('send_mode_direct','send_mode_reset') as $entry) {
+               $content[$entry] = '';
+       } // END - foreach
 
-       // Mail send mode
-       switch (getConfig('doubler_send_mode'))
-       {
-       case "DIRECT":
-               define('__DOUBLER_SEND_DIRECT', " checked=\"checked\"");
-               define('__DOUBLER_SEND_RESET' , "");
-               break;
+       // Set current selections
+       foreach (array('send_mode') as $entry) {
+               $content[$entry . '_' . strtolower(getConfig('doubler_' . $entry))] = ' checked="checked"';
+       } // END - foreach
 
-       case "RESET":
-               define('__DOUBLER_SEND_DIRECT', "");
-               define('__DOUBLER_SEND_RESET' , " checked=\"checked\"");
-               break;
-       }
-
-       // Take points from own account (Y/N)
-       switch (getConfig('doubler_sent_all'))
-       {
-       case "Y":
-               define('__DOUBLER_SENT_ALL_Y', " checked=\"checked\"");
-               define('__DOUBLER_SENT_ALL_N', "");
-               break;
-
-       case "N":
-               define('__DOUBLER_SENT_ALL_Y', "");
-               define('__DOUBLER_SENT_ALL_N', " checked=\"checked\"");
-               break;
-       }
-
-       // Transfer options (!!!) to __MEMBER_SELECTION
-       define('__MEMBER_SELECTION', ADD_MEMBER_SELECTION_BOX(getConfig('doubler_uid'), false, true, true, "doubler_uid"));
+       // Transfer options
+       $content['member_selection'] = addMemberSelectionBox(getConfig('doubler_userid'), false, true, true, 'doubler_userid');
 
        // Number of rows to display (option lines!!!)
-       define('__DOUBLER_DISPLAY_NEW', ADD_OPTION_LINES("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_new')));
-       define('__DOUBLER_DISPLAY_PAY', ADD_OPTION_LINES("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_pay')));
-       define('__DOUBLER_DISPLAY_OLD', ADD_OPTION_LINES("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_old')));
+       foreach (array('new','pay','old') as $entry) {
+               $content['display_' . $entry] = generateOptionList('/ARRAY/', array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_' . $entry));
+       } // END - foreach
 
        // Timeout selection box or input box?
-       define('__DOUBLER_TIMEOUT', CREATE_TIME_SELECTIONS(getConfig('doubler_timeout')  , "doubler_timeout"  , "WDh"));
+       $content['timeout_selection'] = createTimeSelections(getConfig('doubler_timeout')  , 'doubler_timeout'  , 'WDh');
 
        // Load template
-       LOAD_TEMPLATE("admin_config_doubler");
+       loadTemplate('admin_config_doubler', false, $content);
 }
-//
+
+// [EOF]
 ?>