File size: 3.37Kb
<?php
/**
* @name SHCMS Engine
* @copyright Shamsik © 2012
* Данный код защищен авторскими правами
* http://shcms.ru
*/
class template {
protected $title;
protected $keywords;
protected $description;
protected $path;
protected $tpl;
public function menu_users() {
global $user_id;
global $login;
$count_poch = mysql_result(mysql_query("SELECT COUNT(*) FROM `mails` WHERE `user_id` = '" .$user_id ."' AND `read` = 'no'"), 0);
if($user_id == true) {
$frends = @mysql_fetch_assoc(mysql_query("SELECT * FROM `frend` WHERE `user_id` = '$user_id' and `read` = '0'"));
$frends_count = @mysql_result(mysql_query("SELECT COUNT(*) FROM `frend` WHERE `user_id` = '$user_id' and `read` = '0'"),0);
$new = '<a href="'.DIR_SHCMS.'private_menu.php">'.Lang::get('Меню:').' '.$login.'</a>';
if($frends['read'] == 0 and $frends['user_id'] == $user_id) {
$new .= ' <a href="'.DIR_SHCMS.'notice.php"><b>'.Lang::get('Уведомление:').' +'.$frends_count.'</b></a>';
}
$new .= '<a href="' . DIR_SHCMS . 'mails.php?act=mail"> '.Lang::get('Почта').' + '.$count_poch.'</a>
<a href="'.DIR_SHCMS.'outcome.php">'.Lang::get('Выйти').'</a>';
}else{
$new = '<a href="' . DIR_SHCMS . 'registration.php">'.Lang::get('Регистрация').'</a>
<a href="' . DIR_SHCMS . 'authorization.php">'.Lang::get('Авторизация').'</a>';
}
return $new;
}
public function server_pere(){
if ($_SERVER['PHP_SELF']!=='/index.php'){
return '<div class="posts"><img src="../template/icon/undo.png"/> <a href="/index.php"><strong>'.Lang::get('На главную').'</strong></a></div>';
}
}
public function server_perehod(){
if ($_SERVER['PHP_SELF']!=='/index.php') {
return '<a href="/">'.Lang::get('На главную').'</a>';
}
}
public function tpl_($title, $path = '',$keywords = '',$description = '') {
global $resting;
$this->title = $title;
if($keywords == NULL) {
$this->keywords = $resting['keywords'];
}else {
$this->keywords = $keywords;}
if($description == NULL) {
$this->description = $resting['description'];
}else {
$this->description = $description;}
$this->path = $path;
$this->tpl = file_get_contents($this->path);
$this->tpl = str_replace('{TITLE}',$this->title,$this->tpl);
$this->tpl = str_replace('{panel}',template::menu_users(),$this->tpl);
$this->tpl = str_replace('{keywords}',$this->keywords,$this->tpl);
$this->tpl = str_replace('{description}',$this->description,$this->tpl);
$this->tpl = str_replace('{copyright}',$resting['copyright'],$this->tpl);
$this->tpl = str_replace('{reklam_razd}',reklama_razd(),$this->tpl);
$this->tpl = str_replace('{server_perehod}',template::server_pere(),$this->tpl);
$this->tpl = str_replace('{home}',template::server_perehod(),$this->tpl);
$this->tpl = str_replace('{copyright_shcms}',copyrightweb(),$this->tpl);
$this->tpl = str_replace('{copyright_wap}',copyright(),$this->tpl);
$this->tpl = str_replace('{SERVERHOST}',$_SERVER['HTTP_HOST'],$this->tpl);
echo eval(' ?'.'>'.$this->tpl.'<'.'?php ');
}
}
$templater = new template();
?>