예제 #1
0
 public function get_feed($rss_maximum_items = 20, $fullfeed = false)
 {
     $dbr = Database::$content->prepare("SELECT id, page, type, category, title, teaser, teaser_img, headline, content, time, last_modified FROM " . Database::$db_settings['pages_table'] . " WHERE include_page=:include_page AND time<=:time AND status!=0 ORDER BY time DESC LIMIT " . $rss_maximum_items);
     $dbr->bindParam(':include_page', $this->id, PDO::PARAM_INT);
     $dbr->bindParam(':time', $this->current_time, PDO::PARAM_INT);
     $dbr->execute();
     $i = 0;
     while ($rss_data = $dbr->fetch()) {
         $rss_items[$i]['category'] = htmlspecialchars($rss_data['category']);
         $rss_items[$i]['title'] = htmlspecialchars($rss_data['title']);
         if ($rss_data['headline'] && $fullfeed || empty($rss_data['teaser_headline'])) {
             $rss_items[$i]['title'] = htmlspecialchars($rss_data['headline']);
         } elseif ($rss_data['teaser_headline']) {
             $rss_items[$i]['title'] = htmlspecialchars($rss_data['teaser_headline']);
         } else {
             $rss_items[$i]['title'] = htmlspecialchars($rss_data['title']);
         }
         if ($fullfeed || $rss_data['teaser'] == '') {
             #if($rss_data['content_formatting']==1)
             # {
             #  $rss_items[$i]['content'] = auto_html($rss_data['content']);
             # }
             #else
             # {
             $rss_items[$i]['content'] = $rss_data['content'];
             # }
             $rss_items[$i]['content'] = parse_special_tags($rss_items[$i]['content'], $parent_page = $rss_data['page'], $rss = true);
         } else {
             #if($rss_data['teaser_formatting']==1)
             # {
             $rss_items[$i]['content'] = auto_html($rss_data['teaser']);
             # }
             #else
             # {
             $rss_items[$i]['content'] = $rss_data['teaser'];
             # }
         }
         if (!$fullfeed && $rss_data['teaser_img']) {
             $rss_items[$i]['teaser_img'] = $rss_data['teaser_img'];
             $teaser_img_info = getimagesize(BASE_PATH . MEDIA_DIR . $rss_data['teaser_img']);
             $rss_items[$i]['teaser_img_width'] = $teaser_img_info[0];
             $rss_items[$i]['teaser_img_height'] = $teaser_img_info[1];
         }
         $rss_items[$i]['link'] = BASE_URL . $rss_data['page'];
         $rss_items[$i]['pubdate'] = gmdate('r', $rss_data['time']);
         if ($rss_data['type'] == 'commentable_page') {
             $this->wfw = true;
             $rss_items[$i]['commentrss'] = BASE_URL . $rss_data['page'] . ',commentrss';
         }
         $i++;
     }
     if (isset($rss_items)) {
         return $rss_items;
     }
     return false;
 }
예제 #2
0
파일: rss.php 프로젝트: adartk/phpsqlitecms
     $rss_items[$i]['title'] = htmlspecialchars($rss_data['title']);
 }
 if ($fullfeed || $rss_data['teaser'] == '') {
     if ($rss_data['content_formatting'] == 1) {
         $rss_items[$i]['content'] = auto_html($rss_data['content']);
     } else {
         $rss_items[$i]['content'] = $rss_data['content'];
     }
     $rss_items[$i]['content'] = parse_special_tags($rss_items[$i]['content'], $parent_page = $rss_data['page'], $rss = true);
     #$rss_items[$i]['content'] = preg_replace_callback("#\[image:(.+?)\]#is", "create_image", $rss_items[$i]['content']);
     #$rss_items[$i]['content'] = preg_replace_callback("#\[thumbnail:(.+?)\]#is", "create_thumbnail_rss", $rss_items[$i]['content']);
     #$rss_items[$i]['content'] = preg_replace_callback("#\[gallery:(.+?)\]#is", "create_gallery_rss", $rss_items[$i]['content']);
     #$rss_items[$i]['content'] = preg_replace('/\[\[([^|\]]+?)(?:\|([^\]]+))?\]\]/e', "'<a href=\"\$1\">'.(('\$2')?'\$2':'\$1').'</a>'", $rss_items[$i]['content']);
 } else {
     if ($rss_data['teaser_formatting'] == 1) {
         $rss_items[$i]['content'] = auto_html($rss_data['teaser']);
     } else {
         $rss_items[$i]['content'] = $rss_data['teaser'];
     }
 }
 if (!$fullfeed && $rss_data['teaser_img']) {
     $rss_items[$i]['teaser_img'] = $rss_data['teaser_img'];
     $teaser_img_info = getimagesize(BASE_PATH . MEDIA_DIR . $rss_data['teaser_img']);
     $rss_items[$i]['teaser_img_width'] = $teaser_img_info[0];
     $rss_items[$i]['teaser_img_height'] = $teaser_img_info[1];
 }
 $rss_items[$i]['link'] = BASE_URL . $rss_data['page'];
 $rss_items[$i]['pubdate'] = gmdate('r', $rss_data['time']);
 $wfw = false;
 if ($rss_data['type'] == 'commentable_page') {
     $wfw = true;
예제 #3
0
 function ShowPhoto($photo_id)
 {
     #global $settings, $db_settings, $pdo;
     #if(empty($qsp[2])) $qsp[2]=0;
     if (isset($_GET['get_3']) && $_GET['get_3'] != 0) {
         $photo_size = 1;
     } else {
         $photo_size = 0;
     }
     if (isset($_GET['get_4'])) {
         $this->show_comments = 1;
     } else {
         $this->show_comments = 0;
     }
     $photo_id = intval($photo_id);
     $photo_result = Database::$content->prepare('SELECT id, gallery, sequence, photo_thumbnail, photo_normal, photo_large, width, height, large_height, large_width, title, subtitle, description, description_formatting, template FROM ' . Database::$db_settings['photo_table'] . ' WHERE id=:id LIMIT 1');
     $photo_result->bindValue(':id', $photo_id, PDO::PARAM_INT);
     $photo_result->execute();
     $photo_data = $photo_result->fetch();
     if (isset($photo_data['id'])) {
         // get ids of photos of current gallery:
         $gallery_result = Database::$content->prepare('SELECT id FROM ' . Database::$db_settings['photo_table'] . ' WHERE gallery=:gallery ORDER BY sequence ASC');
         $gallery_result->bindValue(':gallery', $photo_data['gallery'], PDO::PARAM_STR);
         $gallery_result->execute();
         while ($gallery_data = $gallery_result->fetch()) {
             $gallery_items[] = $gallery_data['id'];
         }
         $total_photos = count($gallery_items);
         $current_photo_key = array_search($photo_data['id'], $gallery_items);
         // get id of first, last, next and previous photo:
         $first_photo = $gallery_items[0];
         $last_photo = $gallery_items[$total_photos - 1];
         if (isset($gallery_items[$current_photo_key + 1])) {
             $next_photo = $gallery_items[$current_photo_key + 1];
         } else {
             $next_photo = $first_photo;
         }
         if (isset($gallery_items[$current_photo_key - 1])) {
             $previous_photo = $gallery_items[$current_photo_key - 1];
         } else {
             $previous_photo = $last_photo;
         }
         if ($previous_photo == $photo_id) {
             $previous_photo = 0;
             $next_photo = 0;
         }
         $this->photo_data['id'] = $photo_id;
         $this->photo_data['gallery'] = $photo_data['gallery'];
         $this->photo_data['gallery_items'] = $gallery_items;
         $this->photo_data['previous_photo'] = $previous_photo;
         $this->photo_data['next_photo'] = $next_photo;
         $this->photo_data['total_photos'] = $total_photos;
         $this->photo_data['photo_number'] = $current_photo_key + 1;
         $this->photo_data['photo_size'] = $photo_size;
         if ($photo_data['photo_large'] != '') {
             $this->photo_data['photo_large_available'] = 1;
         }
         if ($photo_size == 1 && $photo_data['photo_large'] != '') {
             $this->photo_data['photo'] = $photo_data['photo_large'];
         } else {
             $this->photo_data['photo'] = $photo_data['photo_normal'];
         }
         $this->photo_data['photo_large'] = $photo_data['photo_large'];
         $this->photo_data['thumbnail'] = $photo_data['photo_thumbnail'];
         $this->photo_data['title'] = $photo_data['title'];
         $this->photo_data['subtitle'] = $photo_data['subtitle'];
         if ($photo_data['description_formatting'] == 1) {
             $this->photo_data['description'] = auto_html($photo_data['description']);
         } else {
             $this->photo_data['description'] = $photo_data['description'];
         }
         if (substr(strtolower($this->photo_data['photo']), -4) == '.swf') {
             $this->photo_data['type'] = 'flash';
             if ($this->photo_data['photo_size'] == 1) {
                 $this->photo_data['width'] = intval($photo_data['large_width']);
                 $this->photo_data['height'] = intval($photo_data['large_height']);
             } else {
                 $this->photo_data['width'] = intval($photo_data['width']);
                 $this->photo_data['height'] = intval($photo_data['height']);
             }
         } elseif (substr(strtolower($this->photo_data['photo']), -4) == '.flv') {
             $this->photo_data['type'] = 'flv';
             if ($this->photo_data['photo_size'] == 1) {
                 $this->photo_data['width'] = intval($photo_data['large_width']);
                 $this->photo_data['height'] = intval($photo_data['large_height']);
             } else {
                 $this->photo_data['width'] = intval($photo_data['width']);
                 $this->photo_data['height'] = intval($photo_data['height']);
             }
         } else {
             $this->photo_data['type'] = 'image';
             $photo_info = getimagesize(BASE_PATH . MEDIA_DIR . $this->photo_data['photo']);
             $this->photo_data['width'] = $photo_info[0];
             $this->photo_data['height'] = $photo_info[1];
         }
         $this->photo_data['template'] = $photo_data['template'];
         #$this -> photo_data['language_file'] = $photo_data['language_file'];
         #$this -> photo_data['language_file'] = $language_file;
     }
     #return $this->photo_data;
 }
예제 #4
0
     $dbr->execute();
     $i = 0;
     while ($data = $dbr->fetch()) {
         $items[$i]['id'] = $data['id'];
         $items[$i]['gallery'] = $data['gallery'];
         $items[$i]['sequence'] = $data['sequence'];
         $items[$i]['photo_normal'] = $data['photo_normal'];
         $items[$i]['photo_thumbnail'] = $data['photo_thumbnail'];
         #$items[$i]['photo_large'] = $data['photo_large'];
         $items[$i]['title'] = $data['title'];
         $items[$i]['subtitle'] = $data['subtitle'];
         $items[$i]['description'] = $data['description'];
         #$items[$i]['description_formatting'] = $data['description_formatting'];
         #if(mb_strlen($item['description'],CHARSET) > 300) $description = mb_substr($item['description'],0,297,CHARSET)."..."; else $description = $item['description'];
         if ($data['description_formatting'] == 1) {
             $items[$i]['description'] = auto_html($data['description']);
         } else {
             $items[$i]['description'] = $data['description'];
         }
         ++$i;
     }
     if (isset($items)) {
         $template->assign('items', $items);
     }
     $template->assign('gallery', htmlspecialchars($_GET['edit']));
     $action = 'edit';
 }
 if (isset($_GET['new_photo'])) {
     $photo_data['gallery'] = htmlspecialchars($_GET['new_photo']);
     $photo_data['description_formatting'] = 1;
     $template->assign('photo_data', $photo_data);
예제 #5
0
if (!defined('IN_INDEX')) {
    exit;
}
if (isset($_SESSION[$settings['session_prefix'] . 'user_id'])) {
    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'main';
    if (isset($_GET['edit'])) {
        $dbr = Database::$content->prepare("SELECT id, title, text, text_formatting, link, linkname FROM " . Database::$db_settings['notes_table'] . " WHERE note_section=:note_section ORDER BY sequence ASC");
        $dbr->bindParam(':note_section', $_GET['edit'], PDO::PARAM_STR);
        $dbr->execute();
        $i = 0;
        while ($data = $dbr->fetch()) {
            $notes[$i]['id'] = $data['id'];
            $notes[$i]['title'] = $data['title'];
            #$notes[$i]['teaser'] = $data['teaser'];
            if ($data['text_formatting'] == 1) {
                $notes[$i]['text'] = auto_html($data['text']);
            } else {
                $notes[$i]['text'] = $data['text'];
            }
            if (substr($data['link'], 0, 7) != 'http://' && substr($data['link'], 0, 8) != 'https://') {
                $notes[$i]['link'] = '../' . $data['link'];
            } else {
                $notes[$i]['link'] = $data['link'];
            }
            #$notes[$i]['link'] = htmlspecialchars(stripslashes($data['link']));
            $notes[$i]['linkname'] = $data['linkname'];
            ++$i;
        }
        if (isset($notes)) {
            $template->assign('notes', $notes);
        }
예제 #6
0
                if ($include_news_data['teaser_headline'] != '') {
                    $include_news[$i]['title'] = $include_news_data['teaser_headline'];
                } elseif ($include_news_data['headline'] != '') {
                    $include_news[$i]['title'] = $include_news_data['headline'];
                } else {
                    $include_news[$i]['title'] = $include_news_data['title'];
                }
                if ($include_news_data['teaser'] != '') {
                    if ($include_news_data['teaser_formatting'] == 1) {
                        $include_news[$i]['teaser'] = auto_html($include_news_data['teaser']);
                    } else {
                        $include_news[$i]['teaser'] = $include_news_data['teaser'];
                    }
                } else {
                    if ($include_news_data['content_formatting'] == 1) {
                        $include_news[$i]['teaser'] = auto_html($include_news_data['content']);
                    } else {
                        $include_news[$i]['teaser'] = $include_news_data['content'];
                    }
                }
                $include_news[$i]['link'] = BASE_URL . $include_news_data['page'];
            }
            $i++;
        }
        if (isset($include_news)) {
            $template->assign('include_news', $include_news);
        }
    }
}
$template->assign('id', $data['id']);
$template->assign('page', $page);