Пример #1
0
     break;
     ############################################################################################
     ##                                   Просмотр статьи                                      ##
     ############################################################################################
 ############################################################################################
 ##                                   Просмотр статьи                                      ##
 ############################################################################################
 case 'view':
     $blogs = DB::run()->queryFetch("SELECT `blogs`.*, `catsblog`.`cats_id`, `catsblog`.`cats_name` FROM `blogs` LEFT JOIN `catsblog` ON `blogs`.`blogs_cats_id`=`catsblog`.`cats_id` WHERE `blogs_id`=? LIMIT 1;", array($id));
     if (!empty($blogs)) {
         $text = preg_split('|\\[nextpage\\](<br * /?>)*|', $blogs['blogs_text'], -1, PREG_SPLIT_NO_EMPTY);
         $total = count($text);
         if ($total > 0) {
             $config['newtitle'] = $blogs['blogs_title'];
             $config['keywords'] = $blogs['blogs_tags'];
             $config['description'] = strip_str($blogs['blogs_text']);
             // --------------
             if (empty($start)) {
                 $queryreads = DB::run()->querySingle("SELECT `read_ip` FROM `readblog` WHERE `read_blog`=? AND `read_ip`=? LIMIT 1;", array($id, $ip));
                 if (empty($queryreads)) {
                     $expiresread = SITETIME + 3600 * $config['blogexpread'];
                     DB::run()->query("DELETE FROM `readblog` WHERE `read_time`<?;", array(SITETIME));
                     DB::run()->query("INSERT INTO `readblog` (`read_blog`, `read_ip`, `read_time`) VALUES (?, ?, ?);", array($id, $ip, $expiresread));
                     DB::run()->query("UPDATE `blogs` SET `blogs_read`=`blogs_read`+1 WHERE `blogs_id`=? LIMIT 1;", array($id));
                 }
             }
             // --------------
             if ($start < 0 || $start >= $total) {
                 $start = 0;
             }
             $end = $total < $start + 1 ? $total : $start + 1;
Пример #2
0
     break;
     ############################################################################################
     ##                                     Чтение новости                                     ##
     ############################################################################################
 ############################################################################################
 ##                                     Чтение новости                                     ##
 ############################################################################################
 case 'read':
     $data = DB::run()->queryFetch("SELECT * FROM `news` WHERE `news_id`=? LIMIT 1;", array($id));
     if (!empty($data)) {
         if (is_admin()) {
             echo '<div class="form"><a href="/admin/news.php?act=edit&amp;id=' . $id . '">Редактировать</a> / ';
             echo '<a href="/admin/news.php?act=del&amp;del=' . $id . '&amp;uid=' . $_SESSION['token'] . '" onclick="return confirm(\'Вы действительно хотите удалить данную новость?\')">Удалить</a></div>';
         }
         $config['newtitle'] = $data['news_title'];
         $config['description'] = strip_str($data['news_text']);
         echo '<div class="b"><img src="/images/img/files.gif" alt="image" /> ';
         echo '<b>' . $data['news_title'] . '</b><small> (' . date_fixed($data['news_time']) . ')</small></div>';
         if (!empty($data['news_image'])) {
             echo '<div class="img"><a href="/upload/news/' . $data['news_image'] . '">' . resize_image('upload/news/', $data['news_image'], 75, array('alt' => $data['news_title'])) . '</a></div>';
         }
         $data['news_text'] = str_replace('[cut]', '', $data['news_text']);
         echo '<div>' . bb_code($data['news_text']) . '</div>';
         echo '<div style="clear:both;">Добавлено: ' . profile($data['news_author']) . '</div><br />';
         if ($data['news_comments'] > 0) {
             echo '<div class="act"><img src="/images/img/balloon.gif" alt="image" /> <b>Последние комментарии</b></div>';
             $querycomm = DB::run()->query("SELECT * FROM `commnews` WHERE `commnews_news_id`=? ORDER BY `commnews_time` DESC LIMIT 5;", array($id));
             $comments = $querycomm->fetchAll();
             $comments = array_reverse($comments);
             foreach ($comments as $comm) {
                 echo '<div class="b">';
Пример #3
0
     } else {
         redirect("index.php");
     }
     break;
     ############################################################################################
     ##                                    Просмотр файла                                      ##
     ############################################################################################
 ############################################################################################
 ##                                    Просмотр файла                                      ##
 ############################################################################################
 case 'view':
     $downs = DB::run()->queryFetch("SELECT * FROM `downs` LEFT JOIN `cats` ON `downs`.`downs_cats_id`=`cats`.`cats_id` WHERE `downs_id`=? LIMIT 1;", array($id));
     if (!empty($downs)) {
         if (!empty($downs['downs_active']) || $downs['downs_user'] == $log) {
             $config['newtitle'] = $downs['downs_title'];
             $config['description'] = strip_str($downs['downs_text']);
             $folder = $downs['folder'] ? $downs['folder'] . '/' : '';
             echo '<a href="#down"><img src="/images/img/downs.gif" alt="Вниз" /></a> <a href="index.php">Категории</a> / ';
             if (!empty($downs['cats_parent'])) {
                 $podcats = DB::run()->queryFetch("SELECT `cats_id`, `cats_name` FROM `cats` WHERE `cats_id`=? LIMIT 1;", array($downs['cats_parent']));
                 echo '<a href="down.php?cid=' . $podcats['cats_id'] . '">' . $podcats['cats_name'] . '</a> / ';
             }
             echo '<a href="down.php?cid=' . $downs['cats_id'] . '">' . $downs['cats_name'] . '</a> / <a href="rss.php?id=' . $id . '">RSS-лента</a><br /><br />';
             $filesize = !empty($downs['downs_link']) ? read_file(BASEDIR . '/load/files/' . $folder . $downs['downs_link']) : 0;
             echo '<img src="/images/img/zip.gif" alt="image" /> <b>' . $downs['downs_title'] . '</b> (' . $filesize . ')';
             if (is_admin(array(101, 102))) {
                 echo ' (<a href="/admin/load.php?act=editdown&amp;cid=' . $downs['cats_id'] . '&amp;id=' . $id . '">Редактировать</a> / ';
                 echo '<a href="/admin/load.php?act=movedown&amp;cid=' . $downs['cats_id'] . '&amp;id=' . $id . '">Переместить</a>)';
             }
             echo '<hr />';
             if (empty($downs['downs_active']) && $downs['downs_user'] == $log) {
Пример #4
0
     break;
     ############################################################################################
     ##                                     Чтение события                                     ##
     ############################################################################################
 ############################################################################################
 ##                                     Чтение события                                     ##
 ############################################################################################
 case 'read':
     $data = DB::run()->queryFetch("SELECT * FROM `events` WHERE `event_id`=? LIMIT 1;", array($id));
     if (!empty($data)) {
         if (is_admin()) {
             echo '<div class="form"><a href="/admin/events.php?act=edit&amp;id=' . $id . '">Редактировать</a> / ';
             echo '<a href="/admin/events.php?act=del&amp;del=' . $id . '&amp;uid=' . $_SESSION['token'] . '" onclick="return confirm(\'Вы действительно хотите удалить данное событие?\')">Удалить</a></div>';
         }
         $config['newtitle'] = $data['event_title'];
         $config['description'] = strip_str($data['event_text']);
         echo '<div class="b"><img src="/images/img/files.gif" alt="image" /> ';
         echo '<b>' . $data['event_title'] . '</b><small> (' . date_fixed($data['event_time']) . ')</small></div>';
         if (!empty($data['event_image'])) {
             echo '<div class="img"><a href="/upload/events/' . $data['event_image'] . '">' . resize_image('upload/events/', $data['event_image'], 75, array('alt' => $data['event_title'])) . '</a></div>';
         }
         $data['event_text'] = str_replace('[cut]', '', $data['event_text']);
         echo '<div>' . bb_code($data['event_text']) . '</div>';
         echo '<div style="clear:both;">Добавлено: ' . profile($data['event_author']) . '</div><br />';
         if ($data['event_comments'] > 0) {
             echo '<div class="act"><img src="/images/img/balloon.gif" alt="image" /> <b>Последние комментарии</b></div>';
             $querycomm = DB::run()->query("SELECT * FROM `commevents` WHERE `commevent_event_id`=? ORDER BY `commevent_time` DESC LIMIT 5;", array($id));
             $comments = $querycomm->fetchAll();
             $comments = array_reverse($comments);
             foreach ($comments as $comm) {
                 echo '<div class="b">';