Просмотр файла system/view/header.php

Размер файла: 4.69Kb
  1. <?
  2. /**********************************
  3. * @package: PerfCMS *
  4. * @year: 2012 *
  5. * @author: Artas *
  6. * @link: http://perfcms.org.ua *
  7. **********************************/
  8. if(isset($user))
  9. {
  10. if(!isset($locate))
  11. {
  12. $locate = 'in_site';
  13. }
  14. $db->query("UPDATE `users` SET `locate` = '". $locate ."' WHERE `id` = '". $user['id'] ."'");
  15. }
  16. if(!file_get_contents(TPL.'/themes/'.$tpl->type.'/'. $stylen .'/header'. $tpl->format)) {
  17. ?>
  18. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  19. <html xmlns="http://www.w3.org/1999/xhtml" lang="uk" xml:lang="uk">
  20. <head>
  21. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  22. <title><?=''.(!empty($title) ? ''.$title.'' : 'Page of PerfCMS').''; ?> | <?=$system['title'];?></title>
  23. <link rel="stylesheet" href="/template/themes/<?=$ttype; ?>/<?=$stylen; ?>/style.css" type="text/css"/>
  24. <?php echo (!empty($system['description']) ? '<meta name="description" content="'.$system['description'].'" />' : NULL); ?>
  25. <?php if(!empty($system['keywords'])) { ?>
  26. <meta name="keywords" content="<?=$system['keywords']; ?>" /> <? } ?>
  27. </head>
  28. <body>
  29. <div class="main">
  30. <div align="center" class="panel">
  31. <? if(isset($user)) { echo '<a href="/user/panel/">'. $lang->word('user_panel') .'</a> | <a href="/exit/">'. $lang->word('sign_out') .'</a>'; if($user['level'] >= 6) { echo' | <a href="/padmin/">'. $lang->word('admin_panel').'</a>'; }} else { echo '<a href="/sign_in/">'. $lang->word('sign_in') .'</a> | <a href="/sign_up/">'. $lang->word('sign_up') .'</a>'; } ?>
  32. </div>
  33. <?
  34. }
  35. elseif(file_exists(TPL.'/themes/'.$tpl->type.'/'. $stylen .'/header'. $tpl->format)) {
  36. $tpl->set_value('title', title(). ' | '.$system['title']);
  37. $tpl->set_value('keywords', $system['keywords']);
  38. $tpl->set_value('description', $system['description']);
  39. $tpl->set_value('user-panel', user_panel());
  40. $tpl->set_value('type', $tpl->type);
  41. $tpl->set_value('theme', $stylen);
  42. $tpl->set_value('user-id', $user['id']);
  43. $tpl->set_value('nick', tnick($user['id']));
  44. $tpl->parse('header');
  45. $tpl->view();
  46. }
  47. $new_mess = $db->query("SELECT * FROM `mail` WHERE `who_id` = '". $user['id'] ."' AND `read` = '0'")->rowCount();
  48. if($new_mess>0) {
  49. $tpl->div('top', '<a href="/mail/">'. $lang->word('new_message') .'</a> (+'.$new_mess.')');
  50. }
  51. $new_friends = $db->query("SELECT * FROM `friends` WHERE `friend_id` = '". $user['id'] ."' AND `active` = '0'")->rowCount();
  52. if($new_friends > 0)
  53. {
  54. $tpl->div('top', '<a href="/friends/requests">'. $lang->word('friends') .'</a> (+'.$db->query("SELECT * FROM `friends` WHERE `friend_id` = '". $user['id'] ."' AND `active` = '0'")->rowCount().')');
  55. }
  56. $new_notify = $db->query("SELECT * FROM `notify` WHERE `user_id` = '". $user['id'] ."' AND `read` = '0'")->rowCount();
  57. if($new_notify > 0)
  58. {
  59. $tpl->div('top', '<a href="/user/notify">'. $lang->word('notify') .'</a> (+'.$new_notify.')');
  60. }
  61. echo $stat->adsHeader();
  62. ###Уведомления о состоянии сайта
  63. if($system['open_site'] == 'no' && $page != 'auth' && $user['level'] < 6) {
  64. $tpl->div('menu', $lang->word('site_closed'));
  65. require_once(SYS.'/view/footer.php');
  66. exit;
  67. }elseif(time()<$user['ban_time']) {
  68. $tpl->div('title', $lang->word('u_r_banned'));
  69. $tpl->div('menu', $lang->word('ban_text').': '.$user['ban_text'].'<br/>
  70. '.$lang->word('end_ban').': '.rtime($user['ban_time']).'');
  71. require_once(SYS.'/view/footer.php');
  72. exit;
  73. }elseif($system['open_chat'] == 'no' && $user['level'] < 6 && $locate=='in_chat') {
  74. $tpl->div('menu', $lang->word('chat_closed'));
  75. require_once(SYS.'/view/footer.php');
  76. exit;
  77. }elseif($system['open_forum'] == 'no' && $user['level'] < 6 && $locate=='in_forum') {
  78. $tpl->div('menu', $lang->word('forum_closed'));
  79. require_once(SYS.'/view/footer.php');
  80. exit;
  81. }elseif($system['open_share'] == 'no' && $user['level'] < 6 && $locate=='in_share') {
  82. $tpl->div('menu', $lang->word('share_closed'));
  83. require_once(SYS.'/view/footer.php');
  84. exit;
  85. }elseif($system['open_news'] == 'no' && $user['level'] < 6 && $locate=='in_news') {
  86. $tpl->div('menu', $lang->word('news_closed'));
  87. require_once(SYS.'/view/footer.php');
  88. exit;
  89. }elseif($system['public_site'] == 'no' && !isset($user) && $page != 'reg') {
  90. $tpl->div('title', $lang->word('sign_in'));
  91. echo '<div class="menu">
  92. <form action="/sign_in/?" method="post">
  93. '. $lang->word('nick') .':<br/>
  94. <input type="text" name="nick" /><br/>
  95. '. $lang->word('password') .':<br/>
  96. <input type="password" name="password" /><br/>
  97. <input type="submit" value="'. $lang->word('sign_in') .'" />
  98. </form>
  99. </div>';
  100. $tpl->div('block', NAV .'<a href="/sign_up/">'. $lang->word('sign_up') .'</a>');
  101. require_once(SYS.'/view/footer.php');
  102. exit;
  103. }