public function eventCoreHeaderStart() { global $xoopsConfig; include_once XOOPS_ROOT_PATH . '/modules/xthemes/include/functions.php'; include XOOPS_ROOT_PATH . '/modules/xthemes/class/theme.php'; include XOOPS_ROOT_PATH . '/modules/xthemes/controller.php'; if (FALSE == ($object = xt_is_valid($xoopsConfig['theme_set']))) { return; } load_theme_locale($xoopsConfig['theme_set']); }
public function eventCoreHeaderStart() { global $xoopsConfig; include XOOPS_ROOT_PATH . '/modules/xthemes/include/functions.php'; include XOOPS_ROOT_PATH . '/modules/xthemes/class/theme.php'; include XOOPS_ROOT_PATH . '/modules/xthemes/controller.php'; if (FALSE == ($object = xt_is_valid($xoopsConfig['theme_set']))) { return; } load_theme_locale($xoopsConfig['theme_set']); if ($object->get_info("jquery")) { RMTemplate::get()->add_jquery(); } }
/** * Run method from theme */ public function run_method(&$smarty, $params) { global $xoopsConfig; $theme = $xoopsConfig['theme_set']; $theme = preg_replace('/\\s+/', '', $theme); $theme = str_replace('-', '', $theme); $method = $params['method']; if (!isset($this->objects[$theme])) { if (false === ($this->objects[$theme] = xt_is_valid($xoopsConfig['theme_set']))) { return; } } if (!method_exists($this->objects[$theme], $method)) { return; } return $this->objects[$theme]->{$method}($smarty, $params); }
/** * Check the settings and save data */ function xt_save_settings() { global $xoopsConfig; $myts = MyTextSanitizer::getInstance(); if (false === ($theme = xt_is_valid($xoopsConfig['theme_set']))) { redirect_header('index.php', 1, __('This is a not valid theme', 'xthemes')); } $xt_to_save = array(); $element = $_POST['element']; foreach ($_POST as $id => $v) { if (substr($id, 0, 7) != 'xtconf_') { continue; } if (method_exists($theme, 'verify_settings')) { $xt_to_save[substr($id, 7)] = $theme->verify_settings($v); } else { $xt_to_save[substr($id, 7)] = $v; } } $db = Database::getInstance(); // Delete current config $db->queryF("DELETE FROM " . $db->prefix("xtheme_config") . " WHERE `element`='{$element}'"); // Save data $sql = "INSERT INTO " . $db->prefix("xtheme_config") . " (`name`,`value`,`type`,`element`) VALUES ('%s','%s','%s','{$element}')"; $errors = array(); array_walk_recursive($xt_to_save, 'clean_values'); foreach ($xt_to_save as $id => $value) { if (is_array($value)) { $value = serialize($value); $type = 'array'; } else { $value = $myts->addSlashes($value); $type = ''; } if (!$db->queryF(sprintf($sql, $id, $value, $type))) { $errors[] = $db->error(); } } file_put_contents(XOOPS_CACHE_PATH . '/' . $element . '-config.php', json_encode($xt_to_save)); if (!empty($errors)) { redirect_header('index.php?op=config', 1, __('There was errors during this operation:', 'xthemes') . '<br />' . implode('<br />', $errors)); } else { redirect_header('index.php?op=config', 1, __('Settings updated!', 'xthemes')); } }