/** * Import Settings * * @access public * @return void **/ public function settings() { /* INIT */ $vars = $this->getVars(); $output = array(); $errors = array(); $knownSettings = array(); $this->registry->class_localization->loadLanguageFile(array('admin_tools')); if (file_exists($this->app_full_path . 'xml/' . $vars['app_directory'] . '_settings.xml')) { /* Get the settings class */ require_once IPS_ROOT_PATH . 'applications/core/modules_admin/tools/settings.php'; $settings = new admin_core_tools_settings($this->registry); $settings->makeRegistryShortcuts($this->registry); $this->request['app_dir'] = $vars['app_directory']; //----------------------------------------- // Known settings //----------------------------------------- if (substr($this->settings['_original_base_url'], -1) == '/') { IPSSetUp::setSavedData('install_url', substr($this->settings['_original_base_url'], 0, -1)); } if (substr($this->settings['base_dir'], -1) == '/') { IPSSetUp::setSavedData('install_dir', substr($this->settings['base_dir'], 0, -1)); } /* Fetch known settings */ if (file_exists(IPSLib::getAppDir($vars['app_directory']) . '/setup/versions/install/knownSettings.php')) { require IPSLib::getAppDir($vars['app_directory']) . '/setup/versions/install/knownSettings.php'; } $settings->importAllSettings(1, 1, $knownSettings); $settings->settingsRebuildCache(); } else { $this->registry->output->global_message = $this->lang->words['settings_nofile']; } $output[] = $this->registry->output->global_message; /* Clear main messaage */ $this->registry->output->global_message = ''; /* Show redirect... */ $this->showRedirectScreen($vars['app_directory'], $output, $errors, $this->getNextURL('hooks', $vars)); }
/** * Show the configuration page * * @access private * @return void [Outputs to screen] */ private function _chatConfig() { //----------------------------------------- // Load libby-do-dah //----------------------------------------- require_once IPSLib::getAppDir('core') . '/modules_admin/tools/settings.php'; $settings = new admin_core_tools_settings(); $settings->makeRegistryShortcuts($this->registry); $settings->html = $this->registry->output->loadTemplate('cp_skin_tools', 'core'); ipsRegistry::getClass('class_localization')->loadLanguageFile(array('admin_tools'), 'core'); $settings->form_code = $settings->html->form_code = 'module=tools&section=settings'; $settings->form_code_js = $settings->html->form_code_js = 'module=tools§ion=settings'; //----------------------------------------- // Did we reset the component? //----------------------------------------- if (!$this->settings['chat04_account_no']) { $this->_chatSplash(); } else { //----------------------------------------- // Update version 6 or 7 //----------------------------------------- if (preg_match("#^\\d#", $this->settings['chat04_account_no'])) { $this->DB->update('core_sys_conf_settings', array('conf_value' => 7), "conf_key='parachat_version'"); } else { $this->DB->update('core_sys_conf_settings', array('conf_value' => 6), "conf_key='parachat_version'"); } $settings->settingsRebuildCache(); } $this->request['conf_title_keyword'] = 'chat04'; $settings->return_after_save = $this->settings['base_url'] . $this->form_code . '&do=chatsettings'; $settings->_viewSettings(); }
/** * Show the configuration page * * @access private * @return void [Outputs to screen] */ private function _chatConfig() { //----------------------------------------- // Load libby-do-dah //----------------------------------------- require_once IPSLib::getAppDir('core') . '/modules_admin/tools/settings.php'; $settings = new admin_core_tools_settings(); $settings->makeRegistryShortcuts($this->registry); $settings->html = $this->registry->output->loadTemplate('cp_skin_tools', 'core'); ipsRegistry::getClass('class_localization')->loadLanguageFile(array('admin_tools'), 'core'); $settings->form_code = $settings->html->form_code = 'module=tools&section=settings'; $settings->form_code_js = $settings->html->form_code_js = 'module=tools§ion=settings'; //----------------------------------------- // Did we reset the component? //----------------------------------------- if (!$this->settings['chat_account_no']) { $this->_chatSplash(); } $this->request['conf_title_keyword'] = 'chat'; $settings->return_after_save = $this->settings['base_url'] . $this->form_code . '&do=chatsettings'; $settings->_viewSettings(); }
/** * Show settings for the portal * * @access private * @return void [Outputs to screen] */ private function _portalSettings() { //------------------------------- // INIT //------------------------------- $pc_key = IPSText::alphanumericalClean($this->request['pc_key']); foreach ($this->portal_objects as $key => $data) { if ($key == $pc_key) { $file = $data['_cfg_location']; } } //------------------------------- // Check //------------------------------- if (!$pc_key or !file_exists($file)) { $this->registry->output->global_message = $this->lang->words['error_no_key']; $this->_portalList(); return; } //------------------------------- // Grab config file //------------------------------- require $file; if (!$PORTAL_CONFIG['pc_settings_keyword']) { $this->registry->output->global_message = $this->lang->words['error_no_settings']; $this->_portalList(); return; } //------------------------------- // Grab, init and load settings //------------------------------- require_once IPSLib::getAppDir('core') . '/modules_admin/tools/settings.php'; $settings = new admin_core_tools_settings(); $settings->makeRegistryShortcuts($this->registry); ipsRegistry::getClass('class_localization')->loadLanguageFile(array('admin_tools'), 'core'); $settings->html = $this->registry->output->loadTemplate('cp_skin_tools', 'core'); $settings->form_code = $settings->html->form_code = 'module=tools&section=settings'; $settings->form_code_js = $settings->html->form_code_js = 'module=tools§ion=settings'; $this->request['conf_title_keyword'] = $PORTAL_CONFIG['pc_settings_keyword']; $settings->return_after_save = $this->settings['base_url'] . $this->form_code . '&do=portal_settings&pc_key=' . $pc_key; $settings->_viewSettings(); }
/** * Add Settings * * @access public * @param int */ public function addSettings() { /* INIT */ $known = array(); $apps = array(); /* Grab all known settings */ $this->DB->build(array('select' => '*', 'from' => 'conf_settings')); $this->DB->execute(); while ($row = $this->DB->fetch()) { if ($row['conf_value'] != '') { $known[$row['conf_key']] = $row['conf_value']; } } /* Brandon's bug report thingy #12516*/ if (!$known['gb_char_set']) { /* No charset, set - so we need to now ensure that iso-8859-1 is set */ $known['gb_char_set'] = 'iso-8859-1'; } /* Wipe out custom time/date settings */ foreach (array('clock_short', 'clock_long', 'clock_tiny', 'clock_date', 'clock_joined', 'time_use_relative_format') as $setting) { unset($known[$setting]); } /* Now we need to fix moderator groups who have permission to RC */ $groups = array(); $this->DB->build(array('select' => 'g_id', 'from' => 'groups', 'where' => 'g_access_cp=1 OR g_is_supmod=1')); $this->DB->execute(); while ($r = $this->DB->fetch()) { $groups[] = $r['g_id']; } $known['report_mod_group_access'] = implode(',', $groups); /* Load apps */ $this->DB->build(array('select' => '*', 'from' => 'core_applications')); $this->DB->execute(); while ($row = $this->DB->fetch()) { $apps[$row['app_directory']] = $row; } /* Add 'em */ foreach ($apps as $dir => $data) { if (file_exists(IPSLib::getAppDir($dir) . '/xml/' . $dir . '_settings.xml')) { require_once IPS_ROOT_PATH . 'applications/core/modules_admin/tools/settings.php'; $settings = new admin_core_tools_settings(); $settings->makeRegistryShortcuts($this->registry); $this->request['app_dir'] = $dir; $settings->importAllSettings(1, 1, $known); $this->registry->output->addMessage("Added settings for {$data['app_title']}...."); } } /* Next Page */ $this->request['workact'] = 'profile'; }
/** * Installs Settings schematic * * @return void */ public function install_settings() { //----------------------------------------- // INIT //----------------------------------------- $previous = $_REQUEST['previous']; //----------------------------------------- // Fetch next 'un //----------------------------------------- $next = IPSSetUp::fetchNextApplication($previous, '{app}_settings.xml'); /* Set up DB driver */ $extra_install = $this->_setUpDBDriver(FALSE); //----------------------------------------- // Install settings //----------------------------------------- if ($next['key']) { $output[] = $next['title'] . ": Inserting settings..."; $_PATH = IPSLib::getAppDir($next['key']) . '/xml/'; $knownSettings = array(); if (file_exists($_PATH . $next['key'] . '_settings.xml')) { //----------------------------------------- // Adjust the table? //----------------------------------------- if ($extra_install and method_exists($extra_install, 'before_inserts_run')) { $q = $extra_install->before_inserts_run('settings'); } //----------------------------------------- // Continue //----------------------------------------- require_once IPS_ROOT_PATH . 'applications/core/modules_admin/tools/settings.php'; $settings = new admin_core_tools_settings(); $settings->makeRegistryShortcuts($this->registry); $this->request['app_dir'] = $next['key']; //----------------------------------------- // Known settings //----------------------------------------- if (substr(IPSSetUp::getSavedData('install_url'), -1) == '/') { IPSSetUp::setSavedData('install_url', substr(IPSSetUp::getSavedData('install_url'), 0, -1)); } if (substr(IPSSetUp::getSavedData('install_dir'), -1) == '/') { IPSSetUp::setSavedData('install_dir', substr(IPSSetUp::getSavedData('install_dir'), 0, -1)); } /* Fetch known settings */ if (file_exists(IPSLib::getAppDir($next['key']) . '/setup/versions/install/knownSettings.php')) { require IPSLib::getAppDir($next['key']) . '/setup/versions/install/knownSettings.php'; } $this->request['app_dir'] = $next['key']; $settings->importAllSettings(1, 1, $knownSettings); //----------------------------------------- // Adjust the table? //----------------------------------------- if ($extra_install and method_exists($extra_install, 'after_inserts_run')) { $q = $extra_install->after_inserts_run('settings'); } } //----------------------------------------- // Done.. so get some more! //----------------------------------------- $this->_finishStep($output, "Install: Settings", 'install&do=settings&previous=' . $next['key']); } else { //----------------------------------------- // Next... //----------------------------------------- $output[] = "All settings installed"; $this->_finishStep($output, "Install: Settings", 'install&do=templates'); } }
/** * Installs Settings schematic * * @return void */ public function install_settings() { //----------------------------------------- // INIT //----------------------------------------- $previous = $_REQUEST['previous']; //----------------------------------------- // Fetch next 'un //----------------------------------------- $next = IPSSetUp::fetchNextApplication($previous, '{app}_settings.xml'); //----------------------------------------- // Install settings //----------------------------------------- if ($next['key']) { $output[] = $next['title'] . ": Upgrading settings..."; $_PATH = IPSLib::getAppDir($next['key']) . '/xml/'; if (file_exists($_PATH . $next['key'] . '_settings.xml')) { //----------------------------------------- // Continue //----------------------------------------- require_once IPS_ROOT_PATH . 'applications/core/modules_admin/tools/settings.php'; $settings = new admin_core_tools_settings(); $settings->makeRegistryShortcuts($this->registry); $this->request['app_dir'] = $next['key']; //----------------------------------------- // Known settings //----------------------------------------- if (substr(IPSSetUp::getSavedData('install_url'), -1) == '/') { IPSSetUp::setSavedData('install_url', substr(IPSSetUp::getSavedData('install_url'), 0, -1)); } if (substr(IPSSetUp::getSavedData('install_dir'), -1) == '/') { IPSSetUp::setSavedData('install_dir', substr(IPSSetUp::getSavedData('install_dir'), 0, -1)); } /* Fetch known settings */ if (file_exists(IPSLib::getAppDir($next['key']) . '/setup/versions/install/knownSettings.php')) { require IPSLib::getAppDir($next['key']) . '/setup/versions/install/knownSettings.php'; } $settings->importAllSettings(1, 1, $knownSettings); } //----------------------------------------- // Done.. so get some more! //----------------------------------------- $this->_finishStep($output, "Upgrade: " . $next['title'] . " Settings", 'upgrade&do=settings&previous=' . $next['key']); } else { //----------------------------------------- // Next... //----------------------------------------- $output[] = "All settings upgraded"; $this->_finishStep($output, "Upgrade: Settings", 'upgrade&do=templates'); } }