Huge rewrite of default parameters, ext-network continued:
[mailer.git] / inc / modules / admin / what-config_yoomedia.php
index 1fb95978c48e8af3d6a09a1b2e8df3d058adc04a..cc02c640da831c547006471e97d1036fc04b9424 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Standart Modus der Statistiken einstellen        *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $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);
-} elseif ((!EXT_IS_ACTIVE("yoomedia")) && (!IS_ADMIN())) {
-       ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "yoomedia");
-       return;
-}
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+       die();
+} // END - if
 
 // Add description as navigation point
-ADD_DESCR("admin", __FILE__);
+addMenuDescription('admin', __FILE__);
+
+if (!isExtensionActive('yoomedia')) {
+       loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('yoomedia'));
+       return;
+} // END - if
 
 // Was the form submitted?
-if (isset($_POST['ok'])) {
+if (isFormSent()) {
        // Test Yoo!Media config
-       if (YOOMEDIDA_TEST_CONFIG($_POST)) {
+       if (YOOMEDIA_TEST_CONFIG(postRequestArray())) {
                // Save settings
-               ADMIN_SAVE_SETTINGS($_POST);
+               adminSaveSettingsFromPostData();
        } else {
                // Config not saved
-               LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_CONFIG_YOOMEDIA_TEST_FAILED);
+               loadTemplate('admin_settings_saved', false, getMessage('ADMIN_CONFIG_YOOMEDIA_TEST_FAILED'));
        }
 } else {
-       // Prepare content
-       $content = array(
-               'yoomedia_id'               => bigintval($_CONFIG['yoomedia_id']),
-               'yoomedia_sid'              => bigintval($_CONFIG['yoomedia_sid']),
-               'yoomedia_passwd'           => $_CONFIG['yoomedia_passwd'],
-               'yoomedia_tm_max_reload'    => bigintval($_CONFIG['yoomedia_tm_max_reload']),
-               'yoomedia_tm_min_wait'      => bigintval($_CONFIG['yoomedia_tm_min_wait']),
-               'yoomedia_tm_clicks_remain' => bigintval($_CONFIG['yoomedia_tm_clicks_remain']),
-               'yoomedia_tm_min_pay'       => bigintval($_CONFIG['yoomedia_tm_min_pay'])
-       );
-
-       // Erotic?
-       switch ($_CONFIG['yoomedia_erotic_allowed']) {
-               case 0: // No erotic at all
-                       define('__CFG_YOOMEDIA_EROTIC_NONE'   , " selected=\"selected\"");
-                       define('__CFG_YOOMEDIA_EROTIC_INCLUDE', "");
-                       define('__CFG_YOOMEDIA_EROTIC_ONLY'   , "");
-                       break;
+       // Erotic selection
+       for ($idx = '0'; $idx <= 2; $idx++) {
+               $content['yoomedia_erotic_allowed_' . $idx] = '';
+       } // END - for
 
-               case 1: // Include erotic
-                       define('__CFG_YOOMEDIA_EROTIC_NONE'   , "");
-                       define('__CFG_YOOMEDIA_EROTIC_INCLUDE', " selected=\"selected\"");
-                       define('__CFG_YOOMEDIA_EROTIC_ONLY'   , "");
-                       break;
-
-               case 2: // Erotic only
-                       define('__CFG_YOOMEDIA_EROTIC_NONE'   , "");
-                       define('__CFG_YOOMEDIA_EROTIC_INCLUDE', "");
-                       define('__CFG_YOOMEDIA_EROTIC_ONLY'   , " selected=\"selected\"");
-                       break;
-       }
+       // Set default selection
+       foreach (array('yoomedia_erotic_allowed') as $entry) {
+               $content[$entry . '_' . strtolower(getConfig($entry))] = ' selected="selected"';
+       } // END - foreach
 
        // Load template
-       LOAD_TEMPLATE("admin_config_yoomedia", false, $content);
+       loadTemplate('admin_config_yoomedia', false, $content);
 }
 
-//
+// [EOF]
 ?>