Хранилища Subversion ant

Сравнить редакции

Не учитывать пробелы Редакция 246 → Редакция 247

/trunk/lib/theme.php
22,12 → 22,24
 
class Theme {
 
function getThemesList() {
$result = array();
$handler = opendir('./themes/styles/');
function getThemesList($mode) { // $mode=(style)(icon)
switch ($mode){
case 'style':
$dr='styles';
$ief='style.css';
break;
case 'icon':
$dr='icons';
$ief='edit.png';
break;
default:
die('variable $mode must be "style" or "icon" !');
}
$result = array();
$handler = opendir('./themes/'.$dr.'/');
while ($file = readdir($handler)) {
if ($file != '.' && $file != '..' && $file != '.svn') // && is_dir($file)
if (file_exists('./themes/styles/'.$file.'/style.css')) $result[] = $file;
if (file_exists('./themes/'.$dr.'/'.$file.'/'.$ief)) $result[] = $file;
}
closedir($handler);
return($result);
38,9 → 50,11
if (!file_exists('./themes/styles/'.$result.'/style.css')) $result='default';
return $result;
}
function setTheme($newtheme,$dblink){
$req =& $dblink->query("UPDATE settings SET optvalue='$newtheme' WHERE opt='theme'");
}
function setIcon($newtheme,$dblink){
$req =& $dblink->query("UPDATE settings SET optvalue='$newtheme' WHERE opt='icons'");
}
}
?>
/trunk/admin.php
836,19 → 836,29
// Управление темами
$display = "<div class='modulename'>".$menu_item[$mode]["title"]." :: <a href='admin.php?mode=".$mode."'>".$menu_item[$mode]["item"]."</a></div>";
if (isset($_GET['chtheme'])){
$chtheme = $secure->wrapStr($_GET["chtheme"]);
$theme->SetTheme($chtheme,$db);
$display.='<p style="color:red;">Тема измененна</p>';
$chtheme = $secure->wrapStr($_GET["chtheme"]);
$chicon = $secure->wrapStr($_GET["chicon"]);
$theme->SetTheme($chtheme,$db);
$theme->setIcon($chicon,$db);
$display.='<p style="color:red;">Тема измененна</p>';
}
$themename = $theme->getThemeName($core,$db); // TODO нарисавать интерфейс поюзабельнее
$themename = $theme->getThemeName($core,$db); // TODO нарисавать интерфейс поюзабельнее
$display.= '<b>Текущая тема: '.$themename.'</b><br>';
$display.= '<form action="admin.php" method="GET">';
$display.= '<input type="hidden" name="mode" value="23">';
$display.= '<select name="chtheme">';
$dis=$theme->getThemesList();
$display.= 'Тема:';
$display.= '<select id="cht" name="chtheme">';
$dis=$theme->getThemesList('style');
foreach ($dis as $thm){
$display.= '<option>'.$thm.'</option>';//TODO add 'selected' to theme
}
$display.= '</select><br>Набор иконок:';
$display.= '<select id="chi" name="chicon">';
$dis=$theme->getThemesList('icon');
foreach ($dis as $thm){
$display.= '<option>'.$thm.'</option>';//TODO add 'selected' to theme
}
$display.= '</select><br>';
$display.= '<button type="submit">Сменить тему</button>';
$display.= '</form>';