$nav = "themes"; $returnLocation = "../admin/theme_list.php"; /** * Checking permissions */ require_once "../auth/login_check.php"; loginCheck(OPEN_PROFILE_ADMINISTRATOR); /** * Checking for query string flag to read data from database. * This is only used when copying an existing theme. */ if (isset($_GET["id_theme"])) { $idTheme = intval($_GET["id_theme"]); include_once "../model/Query/Theme.php"; $themeQ = new Query_Theme(); $themeQ->select($idTheme); $theme = $themeQ->fetch(); if ($theme) { $formVar["css_file"] = $theme->getCssFile(); $filename = "../css/" . $theme->getCssFile(); $fp = fopen($filename, 'r'); $formVar["css_rules"] = fread($fp, filesize($filename)); fclose($fp); } else { Error::fetch($themeQ, false); } $themeQ->freeResult(); $themeQ->close(); unset($themeQ); unset($theme); } elseif (!isset($formError)) {
$setQ->freeResult(); $setQ->close(); unset($setQ); define("OPEN_LANGUAGE", $set->getLanguage()); unset($set); /** * i18n l10n (after OPEN_LANGUAGE is defined) */ require_once "../config/i18n.php"; if (isset($_GET["id_theme"]) && intval($_GET["id_theme"]) > 0) { include_once "../model/Query/Theme.php"; /** * Reading theme settings */ $themeQ = new Query_Theme(); $themeQ->select(intval($_GET["id_theme"])); $theme = $themeQ->fetch(); if (!$theme) { $themeQ->close(); Error::fetch($themeQ); } $themeQ->freeResult(); $themeQ->close(); unset($themeQ); $_POST["theme_name"] = $theme->getName(); $filename = '../css/' . $theme->getCssFile(); $size = filesize($filename); $fp = fopen($filename, 'r'); $_POST["css_rules"] = fread($fp, $size); fclose($fp); unset($theme);
require_once "../auth/login_check.php"; loginCheck(OPEN_PROFILE_ADMINISTRATOR); /** * Retrieving get vars */ $idTheme = intval($_GET["id_theme"]); /** * Checking for $formError to read data from database */ if (!isset($formError)) { include_once "../model/Query/Theme.php"; /** * Search database */ $themeQ = new Query_Theme(); if (!$themeQ->select($idTheme)) { $themeQ->close(); FlashMsg::add(_("That theme does not exist."), OPEN_MSG_ERROR); header("Location: " . $returnLocation); exit; } $theme = $themeQ->fetch(); if ($theme) { $formVar["id_theme"] = $idTheme; $formVar["theme_name"] = $theme->getName(); $formVar["css_file"] = $theme->getCssFile(); $filename = "../css/" . $theme->getCssFile(); $fp = fopen($filename, 'r'); if ($fp) { $formVar["css_rules"] = fread($fp, filesize($filename)); fclose($fp);
define("OPEN_THEME_ID", $set->getIdTheme()); define("OPEN_LANGUAGE", $set->getLanguage()); unset($set); if (OPEN_VERSION != OPEN_DB_SCHEMA_VERSION) { header("Location: ../install/upgrade.php"); // try upgrade database } /** * i18n l10n (after OPEN_LANGUAGE is defined) */ require_once "../config/i18n.php"; /** * Reading theme settings */ $themeQ = new Query_Theme(); $themeQ->select(isset($_SESSION['auth']['user_theme']) ? $_SESSION['auth']['user_theme'] : OPEN_THEME_ID); $theme = $themeQ->fetch(); if (!$theme) { $themeQ->close(); Error::fetch($themeQ); } /** * Theme related constants */ define("OPEN_THEME_NAME", $theme->getName()); define("OPEN_THEME_CSS_FILE", $theme->getCssFile()); $themeQ->freeResult(); $themeQ->close(); unset($themeQ); unset($theme); /**