File size: 3.75Kb
<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/adm_check.php';
include_once '../sys/inc/user.php';
user_access('lic_themes',null,'index.php?'.SID);
adm_check();
if (!$license){header("Location: index.php?".SID);exit;}
$set['title']='Темы оформления с DCMS.su';
include_once '../sys/inc/thead.php';
title();
if (isset($_GET['install']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `license_themes` WHERE `id` = '".intval($_GET['install'])."'"),0)==1)
{
$them=mysql_fetch_assoc(mysql_query("SELECT * FROM `license_themes` WHERE `id` = '".intval($_GET['install'])."'"));
if (copy("http://dcms.su/dcms/downloads/themes/$them[id]/$them[tr_name].zip",H."sys/tmp/$them[tr_name].zip"))
{
$th_err=dcms_theme_is_invalid(H."sys/tmp/$them[tr_name].zip");
if ($th_err)$err[]=$th_err;
elseif (dcms_theme_install(H."sys/tmp/$them[tr_name].zip"))msg('Тема успешно установлена');
@unlink(H."sys/tmp/$them[tr_name].zip");
}
else $err[]='Невозможно загрузить тему';
}
if (isset($_GET['reload']))
{
$send['add']='themes';
$themes=lic_dcms($send);
if ($themes==false)
{
$err[]='Ошибка при загрузке';
}
else
{
mysql_query('TRUNCATE TABLE `license_themes`');
for ($i=0;$i<count($themes);$i++)
{
$them=$themes[$i];
mysql_query("INSERT INTO `license_themes` (`id`, `name`, `tr_name`, `autor`, `opis`)
VALUES (
'$them[id]',
'".my_esc($them['name'])."',
'".my_esc($them['tr_name'])."',
'".my_esc($them['autor'])."',
'".my_esc($them['opis'])."'
)");
}
msg('Список тем успешно загружен');
}
}
err();
aut();
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `license_themes`"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$listing = new Smarty_conf();
$posts=array();
$q=mysql_query("SELECT * FROM `license_themes` ORDER BY id DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q))
{
$posts[]=array('icon'=> array('size'=>'big','src'=> "http://dcms.su/dcms/screen/$post[id]/48/"),
'title'=> $post['name'].' ('.$post['autor'].')',
'post' => output_text($post['opis']));
/*
echo " <tr>\n";
if ($set['set_show_icon']==2){
echo " <td class='icon48' rowspan='2'>\n";
echo "<img src='http://dcms.su/dcms/screen/$post[id]/48/' alt='' />";
echo " </td>\n";
}
elseif ($set['set_show_icon']==1)
{
echo " <td class='icon14'>\n";
echo "<img src='/style/icons/egg.png' alt='' />";
echo " </td>\n";
}
echo " <td class='p_t'>\n";
echo "$post[name]\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
if ($set['set_show_icon']==1)echo " <td class='p_m' colspan='2'>\n"; else echo " <td class='p_m'>\n";
echo "Выложил: $post[autor]<br />\n";
echo output_text($post['opis'])."<br />\n";
if (is_dir(H.'style/themes/'.@$post['tr_name']))
echo "Тема уже установлена<br />\n";
else
echo "<a href='?install=$post[id]&page=$page'>Установить</a><br />\n";
echo " </td>\n";
echo " </tr>\n";
*/
}
if (!$posts)$posts[]=array('title' => 'Список тем пуст');
$listing->assign('post',$posts);
$listing->display('body.conlentlist.tpl');
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
echo "»<a href='?reload=$passgen'>Обновить список тем</a><br />\n";
$smarty = new Smarty_conf();
$smarty->assign('menu_title','Навигация');
$menu=array();
$menu[]=array('.','Админка');
$smarty->assign('menu',$menu);
$smarty->display('links.path.tpl');
include_once '../sys/inc/tfoot.php';
?>