Determination of the current themes are as follows:
• if the user is in the administrative part or the page builder in the current issue is determined by the constant u_theme ;
• if the user is a user of the first checks the value of the cookie alutheme , if the value of the cookie is empty, the value of the constant u_theme ;
• after obtaining the values of the current theme to verify the existence the folder of theme. If the folder of theme does not exist, the current theme is set to default.
Пример:
< ? php
//blocking direct call file
if (!isset($is_internal) or !$is_internal) die('< br / >Access denied');
//validate incoming parameters
if (isset($_REQUEST['theme_select']) and $_REQUEST['theme_select']) {
$cur_theme = alite_strip_slashes($_REQUEST['theme_select']);
//checking the existence of themes
if (is_dir(alite_get_document_root('/_themes/'.$cur_theme))) {
//write a cookie on user computer
alite_set_cookie('alutheme', $cur_theme, 60 * 60 * 24 * 30);
//page reloads
header('Location: '.$_SERVER['REQUEST_URI']);
exit;
}
}
//this defines the current theme
$cur_theme = get_user_theme();
? >
< form name="form1" action="" method="post" enctype="multipart/form-data" >
< select name="theme_select" < ? php if (stristr($_SERVER['REQUEST_URI'], '_page_builder') === false) echo 'onchange="javascript: this.form.submit();"'; ? > >
< option < ? php if ($cur_theme == 'theme_1') echo 'selected="selected"'; ? > value="theme_1" >Theme 1< /option >
< option < ? php if ($cur_theme == 'theme_2') echo 'selected="selected"'; ? > value="theme_2" >Theme 2< /option >
< option < ? php if ($cur_theme == 'theme_3') echo 'selected="selected"'; ? > value="theme_3" >Theme 3< /option >
< /select >
< /form >