/** * This function is responsible for creating the configuration GUI * * @param string sg This is the subgroup name to load the gui for. * If nothing is passed, it will display the first * (alpha) subgroup * * @param array(string=>boolean) change_result * This is an array of what changes were made to the * configuration - if it is passed, it will display * the "Changes" message box. */ function get_ui($grp, $sg = '0', $activeTab = '', $change_result = null) { global $_CONF, $LANG_CONFIG, $LANG_configsubgroups, $LANG_configsections; if (!array_key_exists($grp, $LANG_configsubgroups)) { $LANG_configsubgroups[$grp] = array(); } if (!SEC_inGroup('Root')) { return config::_UI_perm_denied(); } if (!isset($sg) or empty($sg)) { $sg = '0'; } $t = new Template($_CONF['path_layout'] . 'admin/config'); $t->set_file(array('main' => 'configuration.thtml', 'menugroup' => 'menu_element.thtml')); $token = SEC_createToken(); $t->set_var('sec_token_name', CSRF_TOKEN); $t->set_var('sec_token', $token); $t->set_var('lang_save_changes', $LANG_CONFIG['save_changes']); $t->set_var('lang_reset_form', $LANG_CONFIG['reset_form']); $t->set_var('lang_changes_made', $LANG_CONFIG['changes_made']); $t->set_var('lang_search', $LANG_CONFIG['search']); if (isset($_POST['fieldname']) && $_POST['fieldname'] != '') { $fieldname = COM_applyFilter($_POST['fieldname']); $t->set_var('highlight', $fieldname); } else { $t->set_var('highlight', ''); } // depreciated $t->set_var('gltoken_name', CSRF_TOKEN); $t->set_var('gltoken', $token); // end decpreciated $t->set_var('open_group', $grp); $groups = $this->_get_groups(); $outerloopcntr = 1; if (count($groups) > 0) { $t->set_block('menugroup', 'subgroup-selector', 'subgroups'); if (is_array($groups)) { foreach ($groups as $group) { $t->set_var("select_id", $group === $grp ? 'id="current"' : ''); $t->set_var("group_select_value", $group); $t->set_var("group_display", ucwords($group)); $subgroups = $this->_get_sgroups($group); $innerloopcntr = 1; foreach ($subgroups as $sgname => $sgroup) { if ($grp == $group and $sg == $sgroup) { $t->set_var('group_active_name', ucwords($group)); $t->set_var('group_name', $LANG_configsections[$group]['label']); if (isset($LANG_configsubgroups[$group][$sgname])) { $t->set_var('subgroup_active_name', $LANG_configsubgroups[$group][$sgname]); } else { if (isset($LANG_configsubgroups[$group][$sgroup])) { $t->set_var('subgroup_active_name', $LANG_configsubgroups[$group][$sgroup]); } else { $t->set_var('subgroup_active_name', $sgname); } } $t->set_var('select_id', 'id="current"'); } else { $t->set_var('select_id', ''); } $t->set_var('subgroup_name', $sgroup); if (isset($LANG_configsubgroups[$group][$sgname])) { $t->set_var('subgroup_display_name', $LANG_configsubgroups[$group][$sgname]); } else { $t->set_var('subgroup_display_name', $sgname); } if ($innerloopcntr == 1) { $t->parse('subgroups', "subgroup-selector"); } else { $t->parse('subgroups', "subgroup-selector", true); } $innerloopcntr++; } $t->set_var('cntr', $outerloopcntr); $t->parse("menu_elements", "menugroup", true); $outerloopcntr++; } } } else { $t->set_var('hide_groupselection', 'none'); } $t->set_var('open_sg', $sg); $t->set_block('main', 'fieldset', 'sg_contents'); $t->set_block('fieldset', 'notes', 'fs_notes'); $t->set_block('main', 'tabs', 'sg_tabs'); $ext_info = $this->_get_extended($sg, $grp); $docUrl = $this->_getConfigHelpDocument($grp, ''); if ($docUrl != '') { $t->set_var('confighelpurl', $docUrl); } else { $t->unset_var('confighelpurl'); } $tabCounter = 0; if (is_array($ext_info)) { foreach ($ext_info as $fset => $params) { $fs_contents = ''; foreach ($params as $name => $e) { if (defined('DEMO_MODE')) { if (in_array($name, array('facebook_login', 'facebook_consumer_key', 'facebook_consumer_secret', 'linkedin_login', 'linkedin_consumer_key', 'linkedin_consumer_secret', 'twitter_login', 'twitter_consumer_key', 'twitter_consumer_secret', 'google_login', 'google_consumer_key', 'google_consumer_secret', 'microsoft_login', 'microsoft_consumer_key', 'microsoft_consumer_secret', 'github_consumer_secret', 'github_consumer_key', 'path_html', 'path_log', 'path_language', 'backup_path', 'path_data', 'path_pear', 'path_themes', 'path_images', 'uploadpath', 'rdf_file', 'site_url', 'site_admin_url', 'FileStore', 'SnapStore', 'SnapCat', 'FileStoreURL', 'SnapCatURL', 'FileSnapURL', 'bb2_enabled', 'bb2_httpbl_key', '1203495882994835', 'comment_disqus_shortname', 'fb_appid'))) { continue; } } $fs_contents .= $this->_UI_get_conf_element($grp, $name, $e['display_name'], $e['type'], $e['value'], $e['selectionArray'], false, $e['reset']); } $rc = $this->_UI_get_fs($grp, $sg, $activeTab, $fs_contents, $fset, $t); if ($rc) { $t->set_var('active_tab_index', $tabCounter); } $tabCounter++; } } $display = COM_siteHeader('none', $LANG_CONFIG['title']); $t->set_var('config_menu', $this->_UI_configmanager_menu($grp, $sg)); if ($change_result != null and $change_result !== array()) { $t->set_var('change_block', $this->_UI_get_change_block($change_result)); } else { $t->set_var('show_changeblock', 'none'); } $t->set_var('autocomplete_data', $this->_get_autocompletedata()); $display .= $t->finish($t->parse("OUTPUT", "main")); $display .= COM_siteFooter(false); return $display; }
/** * This function is responsible for creating the configuration GUI * * @oaram string $grp This is the group name to load the gui for. * @param string sg This is the subgroup name to load the gui for. * If nothing is passed, it will display the first * (alpha) subgroup. * @param mixed $change_result * This is an array of what changes were made to the * configuration - if it is passed, it will display * the "Changes" message box. */ function get_ui($grp, $sg = '0', $change_result = null) { global $_CONF, $LANG_CONFIG, $LANG_configsubgroups, $LANG_tab, $LANG_fs, $_SCRIPTS, $LANG01; if (!array_key_exists($grp, $LANG_configsubgroups)) { $LANG_configsubgroups[$grp] = array(); } // denied users that don't have access to configuration $groups = $this->_get_groups(); if (empty($groups)) { return config::_UI_perm_denied(); } if (!isset($sg) or empty($sg)) { $sg = '0'; // get default subgroup for non Root user if (!SEC_inGroup('Root')) { $default_sg = $this->_get_sgroups($grp); if (!empty($default_sg)) { $default_sg = array_values($default_sg); $sg = $default_sg[0]; } else { return config::_UI_perm_denied(); } } } $t = COM_newTemplate($_CONF['path_layout'] . 'admin/config'); $t->set_file(array('main' => 'configuration.thtml', 'menugroup' => 'menu_element.thtml')); $link_message = $LANG01[139]; $t->set_var('noscript', COM_getNoScript(false, '', $link_message)); // Hide the Configuration as Javascript is currently required. If JS is enabled then the JS below will un-hide it $js = 'document.getElementById("geeklog_config_editor").style.display="";'; $_SCRIPTS->setJavaScript($js, true); $t->set_var('gltoken_name', CSRF_TOKEN); $t->set_var('gltoken', SEC_createToken()); // set javascript variable for autocomplete $js = $this->_UI_autocomplete_data(); // set javascript variable for image spinner $js .= $this->_UI_js_image_spinner(); $js .= "var frmGroupAction = '" . $_CONF['site_admin_url'] . "/configuration.php';"; $_SCRIPTS->setJavaScript($js, true); $_SCRIPTS->setJavaScriptFile('admin.configuration', '/javascript/admin.configuration.js'); $t->set_var('search_configuration_label', $LANG_CONFIG['search_configuration_label']); if (isset($_POST['search-configuration-cached'])) { $t->set_var('search_configuration_value', $_POST['search-configuration-cached']); } else { $t->set_var('search_configuration_value', ''); } if (isset($_POST['tab-id-cached'])) { $t->set_var('tab_id_value', $_POST['tab-id-cached']); } else { $t->set_var('tab_id_value', ''); } $t->set_var('lang_save_changes', $LANG_CONFIG['save_changes']); $t->set_var('lang_reset_form', $LANG_CONFIG['reset_form']); $t->set_var('open_group', $grp); $outerloopcntr = 1; if (count($groups) > 0) { $t->set_block('menugroup', 'subgroup-selector', 'subgroups'); foreach ($groups as $group) { $t->set_var("select_id", $group === $grp ? 'id="current"' : ''); $t->set_var("group_select_value", $group); $t->set_var("group_display", ucwords($group)); $subgroups = $this->_get_sgroups($group); $innerloopcntr = 1; foreach ($subgroups as $sgname => $sgroup) { if ($grp == $group and $sg == $sgroup) { $t->set_var('group_active_name', ucwords($group)); if (isset($LANG_configsubgroups[$group][$sgname])) { $t->set_var('subgroup_active_name', $LANG_configsubgroups[$group][$sgname]); } else { if (isset($LANG_configsubgroups[$group][$sgroup])) { $t->set_var('subgroup_active_name', $LANG_configsubgroups[$group][$sgroup]); } else { $t->set_var('subgroup_active_name', $sgname); } } $t->set_var('select_id', 'id="current"'); } else { $t->set_var('select_id', ''); } $t->set_var('subgroup_name', $sgroup); if (isset($LANG_configsubgroups[$group][$sgname])) { $t->set_var('subgroup_display_name', $LANG_configsubgroups[$group][$sgname]); } else { $t->set_var('subgroup_display_name', $sgname); } if ($innerloopcntr == 1) { $t->parse('subgroups', "subgroup-selector"); } else { $t->parse('subgroups', "subgroup-selector", true); } $innerloopcntr++; } $t->set_var('cntr', $outerloopcntr); $t->parse("menu_elements", "menugroup", true); $outerloopcntr++; } } else { $t->set_var('hide_groupselection', 'none'); } $t->set_var('open_sg', $sg); $t->set_block('main', 'tab', 'sg_contents'); $t->set_block('tab', 'notes', 'tab_notes'); $ext_info = $this->_get_extended($sg, $grp); $tab_li = '<ul>'; foreach ($ext_info as $tab => $params) { $tab_contents = ''; $current_fs = ''; $fs_flag = false; $table_flag = false; foreach ($params as $name => $e) { if ($e['type'] == 'fieldset' and $e['fieldset'] != $current_fs) { $fs_flag = true; if ($current_fs != '') { $tab_contents .= '</table></fieldset><!-- END fieldset -->'; $table_flag = false; } // $tab_contents .= '<!-- BEGIN fieldset --><fieldset style="margin-top:10px;"><legend>{fs_display}</legend>'; $tab_contents .= '<!-- BEGIN fieldset --><fieldset style="margin-top:10px;"><legend>' . $LANG_fs[$grp][$e['display_name']] . '</legend>'; $current_fs = $e['fieldset']; } if (!$table_flag) { $tab_contents .= '<table class="inputTable">'; $table_flag = true; } $tab_contents .= $this->_UI_get_conf_element($grp, $name, $e['display_name'], $e['type'], $e['value'], $e['selectionArray'], false, $e['reset']); } if ($table_flag) { $tab_contents .= '</table>'; } if ($fs_flag) { $tab_contents .= '</fieldset><!-- END fieldset -->'; } // check if current user has access to current tab $tab_name = "config.{$grp}." . $this->_get_tab_name($grp, $tab); if (!SEC_inGroup('Root') && !SEC_hasRights($tab_name)) { continue; } // tab content $tab_display = $this->_UI_get_tab($grp, $tab_contents, $tab, $t); // tab list $tab_li .= '<li><a href="#tab-' . $tab . '">' . $tab_display . '</a></li>'; } $tab_li .= '</ul>'; $t->set_var('tab_li', $tab_li); $_SCRIPTS->setJavaScriptLibrary('jquery.ui.autocomplete'); $_SCRIPTS->setJavaScriptLibrary('jquery.ui.tabs'); $display = COM_siteHeader('none', $LANG_CONFIG['title']); $t->set_var('config_menu', $this->_UI_configmanager_menu($grp, $sg)); // message box if ($change_result != null and $change_result !== array()) { $t->set_var('lang_changes_made', $LANG_CONFIG['changes_made'] . ':'); $t->set_var('change_block', $this->_UI_get_change_block($change_result, $grp, $sg)); } else { $t->set_var('show_changeblock', 'none'); } if (!empty($this->validationErrors)) { $t->set_var('lang_changes_made', ''); $t->set_var('show_changeblock', ''); $t->set_var('change_block', $this->_UI_get_change_block(NULL, $grp, $sg)); $t->set_var('lang_error_validation_occurs', $LANG_CONFIG['error_validation_occurs'] . ' :'); $t->set_var('error_validation_class', ' error_validation'); } $display .= $t->finish($t->parse("OUTPUT", "main")); $display .= COM_siteFooter(false); return $display; }
/** * This function is responsible for creating the configuration GUI * * @param string sg This is the subgroup name to load the gui for. * If nothing is passed, it will display the first * (alpha) subgroup * * @param array(string=>boolean) change_result * This is an array of what changes were made to the * configuration - if it is passed, it will display * the "Changes" message box. */ function get_ui($grp, $sg = '0', $change_result = null) { global $_CONF, $LANG_CONFIG, $LANG_configsubgroups; if (!array_key_exists($grp, $LANG_configsubgroups)) { $LANG_configsubgroups[$grp] = array(); } if (!SEC_inGroup('Root')) { return config::_UI_perm_denied(); } if (!isset($sg) or empty($sg)) { $sg = '0'; } $t = new Template($_CONF['path_layout'] . 'admin/config'); $t->set_file(array('main' => 'configuration.thtml', 'menugroup' => 'menu_element.thtml')); $t->set_var('site_url', $_CONF['site_url']); $t->set_var('site_admin_url', $_CONF['site_admin_url']); $t->set_var('layout_url', $_CONF['layout_url']); $t->set_var('xhtml', XHTML); $t->set_var('gltoken_name', CSRF_TOKEN); $t->set_var('gltoken', SEC_createToken()); $t->set_var('lang_save_changes', $LANG_CONFIG['save_changes']); $t->set_var('lang_reset_form', $LANG_CONFIG['reset_form']); $t->set_var('lang_changes_made', $LANG_CONFIG['changes_made']); $t->set_var('open_group', $grp); $groups = $this->_get_groups(); $outerloopcntr = 1; if (count($groups) > 0) { $t->set_block('menugroup', 'subgroup-selector', 'subgroups'); foreach ($groups as $group) { $t->set_var("select_id", $group === $grp ? 'id="current"' : ''); $t->set_var("group_select_value", $group); $t->set_var("group_display", ucwords($group)); $subgroups = $this->_get_sgroups($group); $innerloopcntr = 1; foreach ($subgroups as $sgname => $sgroup) { if ($grp == $group and $sg == $sgroup) { $t->set_var('group_active_name', ucwords($group)); if (isset($LANG_configsubgroups[$group][$sgname])) { $t->set_var('subgroup_active_name', $LANG_configsubgroups[$group][$sgname]); } else { if (isset($LANG_configsubgroups[$group][$sgroup])) { $t->set_var('subgroup_active_name', $LANG_configsubgroups[$group][$sgroup]); } else { $t->set_var('subgroup_active_name', $sgname); } } $t->set_var('select_id', 'id="current"'); } else { $t->set_var('select_id', ''); } $t->set_var('subgroup_name', $sgroup); if (isset($LANG_configsubgroups[$group][$sgname])) { $t->set_var('subgroup_display_name', $LANG_configsubgroups[$group][$sgname]); } else { $t->set_var('subgroup_display_name', $sgname); } if ($innerloopcntr == 1) { $t->parse('subgroups', "subgroup-selector"); } else { $t->parse('subgroups', "subgroup-selector", true); } $innerloopcntr++; } $t->set_var('cntr', $outerloopcntr); $t->parse("menu_elements", "menugroup", true); $outerloopcntr++; } } else { $t->set_var('hide_groupselection', 'none'); } $t->set_var('open_sg', $sg); $t->set_block('main', 'fieldset', 'sg_contents'); $t->set_block('fieldset', 'notes', 'fs_notes'); $ext_info = $this->_get_extended($sg, $grp); foreach ($ext_info as $fset => $params) { $fs_contents = ''; foreach ($params as $name => $e) { $fs_contents .= $this->_UI_get_conf_element($grp, $name, $e['display_name'], $e['type'], $e['value'], $e['selectionArray'], false, $e['reset']); } $this->_UI_get_fs($grp, $fs_contents, $fset, $t); } $display = COM_siteHeader('none', $LANG_CONFIG['title']); $t->set_var('config_menu', $this->_UI_configmanager_menu($grp, $sg)); if ($change_result != null and $change_result !== array()) { $t->set_var('change_block', $this->_UI_get_change_block($change_result)); } else { $t->set_var('show_changeblock', 'none'); } $display .= $t->finish($t->parse("OUTPUT", "main")); $display .= COM_siteFooter(false); return $display; }