/**
  * Initialize Article Settings Form.
  * Retrieve and return the general portal settings.
  */
 private function _initArticleSettingsForm()
 {
     // instantiate the article form
     $this->_articleSettingsForm = new Settings_Form();
     $config_vars = array(array('check', 'sp_articles_index'), array('int', 'sp_articles_index_per_page'), array('int', 'sp_articles_index_total'), array('int', 'sp_articles_length'), '', array('int', 'sp_articles_per_page'), array('int', 'sp_articles_comments_per_page'));
     return $this->_articleSettingsForm->settings($config_vars);
 }
예제 #2
0
 /**
  * Initialize postSettings form with admin configuration settings for posts.
  */
 private function _initPostSettingsForm()
 {
     // Instantiate the form
     $this->_postSettings = new Settings_Form();
     // Initialize it with our settings
     $config_vars = $this->_settings();
     return $this->_postSettings->settings($config_vars);
 }
예제 #3
0
 /**
  * This method retrieves and returns avatar settings.
  *
  * - It also returns avatar-related permissions profile_server_avatar,
  * profile_upload_avatar, profile_remote_avatar, profile_gvatar.
  * - Initializes the avatarSettings form.
  */
 private function _initAvatarSettingsForm()
 {
     // Instantiate the form
     $this->_avatarSettings = new Settings_Form();
     // Initialize settings
     $config_vars = $this->_settings();
     return $this->_avatarSettings->settings($config_vars);
 }
예제 #4
0
 /**
  * Initialize balancingSettings form.
  */
 private function _initBalancingSettingsForm()
 {
     // Forms, we need them
     $this->_balancingSettingsForm = new Settings_Form();
     // Initialize it with our settings
     $config_vars = $this->_balancingSettings();
     // Set them vars for our settings form
     return $this->_balancingSettingsForm->settings($config_vars);
 }
 /**
  * Initialize settings form with the configuration settings for new members registration.
  */
 private function _init_pwentropySettingsForm()
 {
     // This is really quite wanting.
     require_once SUBSDIR . '/SettingsForm.class.php';
     // Instantiate the form
     $this->_pweSettings = new Settings_Form();
     // Initialize it with our settings
     $config_vars = $this->_settings();
     return $this->_pweSettings->settings($config_vars);
 }
예제 #6
0
 /**
  * Initialize the news settings screen in admin area for the forum.
  */
 private function _initNewsSettingsForm()
 {
     // We're working with them settings here.
     require_once SUBSDIR . '/SettingsForm.class.php';
     // Instantiate the form
     $this->_newsSettings = new Settings_Form();
     // Initialize it with our settings
     $config_vars = $this->_settings();
     return $this->_newsSettings->settings($config_vars);
 }
예제 #7
0
 /**
  * Initialize Mailist settings form.
  */
 private function _initMaillistSettingsForm()
 {
     // We need some settings! ..ok, some work with our settings :P
     require_once SUBSDIR . '/SettingsForm.class.php';
     // Instantiate the form
     $this->_maillistSettings = new Settings_Form();
     // Initialize it with our settings
     $config_vars = $this->_settings();
     return $this->_maillistSettings->settings($config_vars);
 }
 /**
  * Administration settings for languages area:
  *
  * - the method will initialize the form config array with all settings.
  *
  * Format of the array:
  *  - either, variable name, description, type (constant), size/possible values, helptext.
  *  - or, an empty string for a horizontal rule.
  *  - or, a string for a titled section.
  *
  * Initialize _languageSettings form.
  */
 private function _initLanguageSettingsForm()
 {
     // We'll want to use them someday. That is, right now.
     require_once SUBSDIR . '/SettingsForm.class.php';
     // Make it happen!
     $this->_languageSettings = new Settings_Form();
     // Initialize it with our settings
     $config_vars = $this->_settings();
     // Initialize the little form
     return $this->_languageSettings->settings($config_vars);
 }
예제 #9
0
 /**
  * Initializes the personal messages settings admin page.
  */
 private function _initPMSettingsForm()
 {
     global $context;
     // We're working with them settings.
     require_once SUBSDIR . '/SettingsForm.class.php';
     $context['permissions_excluded'] = array(-1);
     // Instantiate the form
     $this->_PMSettings = new Settings_Form();
     // Initialize it with our settings
     $config_vars = $this->_pmSettings();
     return $this->_PMSettings->settings($config_vars);
 }
예제 #10
0
    /**
     * Retrieve and return all admin settings for the calendar.
     */
    private function _initCalendarSettingsForm()
    {
        global $txt, $context;
        // Instantiate the form
        $this->_calendarSettings = new Settings_Form();
        // Initialize it with our settings
        $config_vars = $this->_settings();
        // Some important context stuff
        $context['page_title'] = $txt['calendar_settings'];
        $context['sub_template'] = 'show_settings';
        // Lets start off with the premission blocks collapsed
        addInlineJavascript('var legend = $(\'legend\');
			legend.siblings().slideToggle("fast");
			legend.parent().toggleClass("collapsed")', true);
        return $this->_calendarSettings->settings($config_vars);
    }
예제 #11
0
 /**
  * Initialize the customSettings form with any custom admin settings for or from addons.
  */
 public function _initAddonSettingsForm()
 {
     global $context, $txt, $scripturl;
     // We're working with them settings.
     require_once SUBSDIR . '/SettingsForm.class.php';
     // instantiate the form
     $this->_addonSettings = new Settings_Form();
     // initialize it with our existing settings. If any.
     $config_vars = $this->_settings();
     if (empty($config_vars)) {
         $context['settings_save_dont_show'] = true;
         $context['settings_message'] = '<div class="centertext">' . $txt['modification_no_misc_settings'] . '</div>';
     }
     $context['post_url'] = $scripturl . '?action=admin;area=addonsettings;save;sa=general';
     $context['settings_title'] = $txt['mods_cat_modifications_misc'];
     return $this->_addonSettings->settings($config_vars);
 }
예제 #12
0
 /**
  * This method saves the settings.
  *
  * It will put them in Settings.php or in the settings table.
  *
  * What it does:
  * - Used to save those settings set from ?action=admin;area=serversettings.
  * - Requires the admin_forum permission.
  * - Contains arrays of the types of data to save into Settings.php.
  */
 public function save()
 {
     validateToken('admin-ssc');
     // Fix the darn stupid cookiename! (more may not be allowed, but these for sure!)
     if (isset($_POST['cookiename'])) {
         $_POST['cookiename'] = preg_replace('~[,;\\s\\.$]+~u', '', $_POST['cookiename']);
     }
     // Fix the forum's URL if necessary.
     if (isset($_POST['boardurl'])) {
         if (substr($_POST['boardurl'], -10) == '/index.php') {
             $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10);
         } elseif (substr($_POST['boardurl'], -1) == '/') {
             $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1);
         }
         if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') {
             $_POST['boardurl'] = 'http://' . $_POST['boardurl'];
         }
     }
     // Any passwords?
     $config_passwords = array('db_passwd', 'ssi_db_passwd', 'cache_password');
     // All the strings to write.
     $config_strs = array('mtitle', 'mmessage', 'language', 'mbname', 'boardurl', 'cookiename', 'webmaster_email', 'db_name', 'db_user', 'db_server', 'db_prefix', 'ssi_db_user', 'cache_accelerator', 'cache_memcached', 'cache_uid');
     $safe_strings = array('mtitle', 'mmessage', 'mbname');
     // All the numeric variables.
     $config_ints = array('cache_enable');
     // All the checkboxes.
     $config_bools = array('db_persist', 'db_error_send', 'maintenance');
     // Now sort everything into a big array, and figure out arrays and etc.
     $new_settings = array();
     foreach ($config_passwords as $config_var) {
         if (isset($_POST[$config_var][1]) && $_POST[$config_var][0] == $_POST[$config_var][1]) {
             $new_settings[$config_var] = '\'' . addcslashes($_POST[$config_var][0], '\'\\') . '\'';
         }
     }
     foreach ($config_strs as $config_var) {
         if (isset($_POST[$config_var])) {
             if (in_array($config_var, $safe_strings)) {
                 $new_settings[$config_var] = '\'' . addcslashes(Util::htmlspecialchars($_POST[$config_var], ENT_QUOTES), '\'\\') . '\'';
             } else {
                 $new_settings[$config_var] = '\'' . addcslashes($_POST[$config_var], '\'\\') . '\'';
             }
         }
     }
     foreach ($config_ints as $config_var) {
         if (isset($_POST[$config_var])) {
             $new_settings[$config_var] = (int) $_POST[$config_var];
         }
     }
     foreach ($config_bools as $key) {
         // Check boxes need to be part of this settings form
         if ($this->_array_value_exists__recursive($key, $this->settings())) {
             if (!empty($_POST[$key])) {
                 $new_settings[$key] = '1';
             } else {
                 $new_settings[$key] = '0';
             }
         }
     }
     // Save the relevant settings in the Settings.php file.
     require_once SUBSDIR . '/Admin.subs.php';
     Settings_Form::save_file($new_settings);
     // Now loop through the remaining (database-based) settings.
     $new_settings = array();
     foreach ($this->_config_vars as $config_var) {
         // We just saved the file-based settings, so skip their definitions.
         if (!is_array($config_var) || $config_var[2] == 'file') {
             continue;
         }
         // Rewrite the definition a bit.
         $new_settings[] = array($config_var[3], $config_var[0]);
     }
     // Save the new database-based settings, if any.
     if (!empty($new_settings)) {
         Settings_Form::save_db($new_settings);
     }
 }