Размер файла: 2.4Kb
- <?php
- /**
- * @name SHCMS Engine
- * @copyright Shamsik © 2012
- * Данный код защищен авторскими правами
- * http://shcms.ru
- */
- class Templater
- {
- private $title;
- private $path;
- private $tpl;
-
- public function tpl_($title,$path=NULL)
- {
- global $resting;
-
- $this->title = $title;
- $this->path = $path;
- $this->tpl = file_get_contents($this->path);
- $this->tpl = str_replace('{TITLE}',$this->title,$this->tpl);
- $this->tpl = str_replace('{panel}',menu_users(),$this->tpl);
- $this->tpl = str_replace('{keywords}',$resting['keywords'],$this->tpl);
- $this->tpl = str_replace('{description}',$resting['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}',server_pere(),$this->tpl);
- $this->tpl = str_replace('{home}',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 Templater();
-
- function load_file($path,$files)
- {
- include_once($path."/".$files);
- }
-
- function menu_users()
- {
- global $user_id;
- global $new_mail;
- global $login;
- return (isset($user_id) ? '<a href="'.DIR_SHCMS.'private_menu.php">Меню: '.$login.'</a>
- <a href="' . DIR_SHCMS . 'mails.php?act=mail"> Почта ('.mysql_result(mysql_query("SELECT COUNT(*) FROM `mails` WHERE `user_id` = '" .$user_id."' AND `read` = 'no'"), 0).')</a> <a href="'.DIR_SHCMS.'outcome.php">Выйти</a>' : '
- <a href="' . DIR_SHCMS . 'registration.php">Регистрация</a>
- <a href="' . DIR_SHCMS . 'authorization.php">Авторизация</a>
- ');
- }
-
- function server_pere()
- {
- if ($_SERVER['PHP_SELF']!=='/index.php')
- {
- return '
- <div class="posts"><img src="../template/icon/undo.png"/> <a href="/"><strong>На главную</strong></a></div>';
- }
- }
-
- function server_perehod()
- {
- if ($_SERVER['PHP_SELF']!=='/index.php')
- {
- return '<a href="/">На главную</a>';
- }
- }
-
- ?>