function editKTemplate($option) { jimport('joomla.filesystem.path'); $kunena_db =& JFactory::getDBO(); $cid = JRequest::getVar('cid', array(), 'method', 'array'); $cid = array(JFilterInput::clean(@$cid[0], 'cmd')); $template = $cid[0]; $option = JRequest::getCmd('option'); if (!$cid[0]) { return JError::raiseWarning(500, JText::_('COM_KUNENA_A_TEMPLATE_MANAGER_TEMPLATE_NOT_SPECIFIED')); } $tBaseDir = JPath::clean(KUNENA_PATH_TEMPLATE); if (!is_dir("{$tBaseDir}/{$template}")) { return JError::raiseWarning(500, JText::_('COM_KUNENA_A_TEMPLATE_MANAGER_TEMPLATE_NOT_FOUND')); } $lang = JFactory::getLanguage(); // Start by loading strings for default template and override with current template if (!$lang->load('com_kunena.tpl_default', JPATH_SITE)) { $lang->load('com_kunena.tpl_default', KUNENA_PATH_TEMPLATE . '/default'); } if ($template != 'default') { if (!$lang->load('com_kunena.tpl_' . $template, JPATH_SITE)) { $lang->load('com_kunena.tpl_' . $template, KUNENA_PATH_TEMPLATE . '/' . $template); } } $ini = KUNENA_PATH_TEMPLATE . '/' . $template . '/params.ini'; $xml = KUNENA_PATH_TEMPLATE . '/' . $template . '/template.xml'; $row = parseXMLTemplateFile($tBaseDir, $template); jimport('joomla.filesystem.file'); // Read the ini file if (JFile::exists($ini)) { $content = JFile::read($ini); } else { $content = null; } $params = new JParameter($content, $xml, 'template'); $default = isTemplateDefault($row->directory); if ($default) { $row->pages = 'all'; } else { $row->pages = null; } // Set FTP credentials, if given jimport('joomla.client.helper'); $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); html_Kunena::editKTemplate($row, $params, $option, $ftp, $template); }