/** * Displays HTML-form to configure module settings * * @return HTML-code */ function admin_configure() { $arp = JRequest::getVar('arp', array(), '', 'array'); $jo_db =& JFactory::getDBO(); $jo_document =& JFactory::getDocument(); /* Add CSS */ $jo_document->addStyleSheet(JRoute::_('index.php?option=com_glossword&&format=css&arg[files]=admin&arg[sef_output]=css')); /* */ $str = ''; if (empty($arp)) { /* Load component configuration */ $query = 'SELECT * FROM #__gw_config ORDER BY `setting_key`'; $jo_db->setQuery($query); $ar_sql = $jo_db->loadAssocList(); $ar_cfg = array(); foreach ($ar_sql as $k => $v) { $ar_cfg[$v['setting_key']] = $v['setting_value']; } /* Display HTML-form */ $str .= HTML_glossword::showform($ar_cfg); /* Register tasks */ JToolBarHelper::save('configure'); } else { /* */ GlosswordController::user_sync($arp, GW_ID_GROUP_ADMINS); GlosswordController::user_sync($arp, GW_ID_GROUP_USERS); foreach ($arp as $k => $v) { /* Checking trailing slash */ if ($k == 'path_temp_abs' || $k == 'path_core_abs' || $k == 'server_dir' || $k == 'server_dir_admin') { $v = str_replace("\\", "/", $v); $v = preg_replace("/(\\x2f)\$/", '', $v); } $query = 'UPDATE #__gw_config' . ' SET setting_value = \'' . mysql_escape_string($v) . '\'' . ' WHERE setting_key = \'' . mysql_escape_string($k) . '\''; $jo_db->setQuery($query); $jo_db->query(); } $href_index = JRoute::_('index.php?option=com_glossword'); $str .= JText::_('Settings saved'); $str .= '. <a href="' . $href_index . '">' . JText::_('Continue to Control Panel') . '</a>.'; } print $str; }