$tab = "admin"; $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);
*/ 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));
/** * Show page */ $title = _("Themes"); require_once "../layout/header.php"; /** * Breadcrumb */ $links = array(_("Admin") => "../admin/index.php", $title => ""); echo HTML::breadcrumb($links, "icon icon_theme"); unset($links); echo HTML::para(HTML::link(_("Add New Theme"), '../admin/theme_new_form.php')); /** * Search in database */ $themeQ = new Query_Theme(); if (!$themeQ->selectWithStats()) { $themeQ->close(); echo Msg::info(_("No results found.")); include_once "../layout/footer.php"; exit; } if ($themeQ->numRows() > 1) { $legend = _("Change Theme by default in application"); $content = Form::label("id_theme", _("Choose a New Theme:")); $content .= Form::selectTable("theme_tbl", "id_theme", OPEN_THEME_ID, "theme_name"); $body = array($content); $foot = array(Form::button("button1", _("Update"))); /** * Theme use form */
} $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);
* Validate data */ $errorLocation = "../admin/theme_edit_form.php?key=" . intval($_POST["id_theme"]); // controlling var require_once "../model/Query/Theme.php"; $theme = new Theme(); $theme->setId($_POST["id_theme"]); $_POST["id_theme"] = $theme->getId(); require_once "../admin/theme_validate_post.php"; /** * Destroy form values and errors */ Form::unsetSession(); /** * Update theme */ $themeQ = new Query_Theme(); if ($themeQ->existCssFile($theme->getCssFile(), $theme->getId())) { FlashMsg: add(sprintf(_("Filename of theme, %s, already exists. The changes have no effect."), $theme->getName())); } else { $themeQ->update($theme); FlashMsg::add(sprintf(_("Theme, %s, has been updated."), $theme->getName())); } $themeQ->close(); unset($themeQ); unset($theme); /** * Redirect to $returnLocation to avoid reload problem */ header("Location: " . $returnLocation);
* Checking permissions */ require_once "../auth/login_check.php"; loginCheck(OPEN_PROFILE_ADMINISTRATOR); /** * Validate data */ require_once "../model/Query/Theme.php"; $theme = new Theme(); require_once "../admin/theme_validate_post.php"; /** * Destroy form values and errors */ Form::unsetSession(); /** * Insert new theme */ $themeQ = new Query_Theme(); if ($themeQ->existCssFile($theme->getCssFile())) { FlashMsg::add(sprintf(_("Filename of theme, %s, already exists. The changes have no effect."), $theme->getName())); } else { $themeQ->insert($theme); FlashMsg::add(sprintf(_("Theme, %s, has been added."), $theme->getName())); } $themeQ->close(); unset($themeQ); unset($theme); /** * Redirect to $returnLocation to avoid reload problem */ header("Location: " . $returnLocation);
define("OPEN_VERSION", $set->getVersion()); 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);
/** * Checking permissions */ require_once "../auth/login_check.php"; loginCheck(OPEN_PROFILE_ADMINISTRATOR); require_once "../lib/Form.php"; Form::compareToken($returnLocation); /** * Retrieving post vars */ $idTheme = intval($_POST["id_theme"]); /** * Delete theme */ require_once "../model/Query/Theme.php"; $themeQ = new Query_Theme(); if (!$themeQ->select($idTheme)) { FlashMsg::add(_("That theme does not exist."), OPEN_MSG_ERROR); header("Location: " . $returnLocation); exit; } $theme = $themeQ->fetch(); $themeQ->delete($idTheme); $themeQ->close(); unset($themeQ); if (!$theme->isCssReserved($theme->getCssFile())) { @unlink(dirname(__FILE__) . '/../css/' . basename($theme->getCssFile())); } /** * Redirect to $returnLocation to avoid reload problem */