function MessagesRender($msg)
{
    global $userAccess;
    $disableMsg = '';
    $total = TotalTime(time(), $msg['date'] + Day2Sec * $msg['expire']);
    if ($total === false) {
        if ($msg['expire'] != 0) {
            $disableMsg .= "and `id`='" . $msg['id'] . "'";
            return;
        }
    }
    if (VisibilityConditionsCheck($msg['showin'], $msg['showin_uri'])) {
        $adin = '';
        if ($userAccess == '1') {
            if ($msg['expire'] != '0') {
                $vt = 'Срок истекает через ' . $total['sdays'] . ($total['hours'] != 0 ? ' и ' . $total['shours'] : '');
            } else {
                $vt = 'Неограниченно';
            }
            $adin = '(Просматривают: ' . ViewLevelToStr($msg['view'], 'Только администраторы', 'Только пользователи', 'Только анонимные пользователи', 'Все посетители') . ' - ' . $vt . ' - <a href="' . ADMIN_FILE . '?exe=messages&a=msgeditor&id=' . $msg['id'] . '">Редактировать</a>)';
        }
        if ($msg['view_title'] == 1) {
            // Показывать заголовок
            $title = $msg['title'];
        } else {
            $title = '';
        }
        System::site()->AddMessage($title, $msg['text'], $adin);
    }
}
 /**
  * Выводит все блоки, зарегистрированные в базе данных
  */
 public function ViewBlocks()
 {
     global $site, $db, $user, $config, $userAccess, $userAuth;
     // для совместимости, НЕ УДАЛЯТЬ
     $blocks = System::database()->Select('blocks', GetWhereByAccess('view', "`enabled`='1'"), null, 'place');
     foreach ($blocks as $block) {
         $block_config = $block['config'];
         $area = SafeDB($block['position'], 1, str);
         $title = SafeDB($block['title'], 255, str);
         $enabled = SafeDB($block['enabled'], 1, int);
         $modified = SafeDB($block['modified'], 11, int);
         $cache = SafeDB($block['cache'], 0, str, false, false);
         $vars = array();
         $tempvars = array();
         $childs = array();
         if ($enabled && VisibilityConditionsCheck($block['showin'], $block['showin_uri'])) {
             include RealPath2(System::config('blocks_dir') . $block['type']) . '/index.php';
             // => $vars
             $this->AddUserBlock($area, $vars, $tempvars, $childs, SafeDB(RealPath2($block['template']), 255, str));
         }
     }
 }