| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | /** |
|---|
| 4 | * Jlog |
|---|
| 5 | * |
|---|
| 6 | * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | * (at your option) any later version. |
|---|
| 10 | * |
|---|
| 11 | * This program is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with this program; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | * |
|---|
| 20 | * $HeadURL$ |
|---|
| 21 | * $Rev$ |
|---|
| 22 | * $Author$ |
|---|
| 23 | * $Date$ |
|---|
| 24 | */ |
|---|
| 25 | |
|---|
| 26 | if(!file_exists(dirname( __FILE__ ).DIRECTORY_SEPARATOR.'personal'.DIRECTORY_SEPARATOR.'settings.inc.php')) { |
|---|
| 27 | if(dirname($_SERVER['PHP_SELF']) !== "/") $dir = dirname($_SERVER['PHP_SELF']); |
|---|
| 28 | header("Location: http://".$_SERVER['HTTP_HOST'].$dir."/setup.php"); |
|---|
| 29 | } |
|---|
| 30 | require_once('.'.DIRECTORY_SEPARATOR.'scripts'.DIRECTORY_SEPARATOR.'prepend.inc.php'); |
|---|
| 31 | |
|---|
| 32 | $c['meta']['robots'] = "noindex, follow"; |
|---|
| 33 | $c['meta']['description'] = htmlspecialchars(strip_tags(str_replace("\n", '', JLOG_DESCRIPTION)), ENT_QUOTES); |
|---|
| 34 | $c['meta']['title'] = $l['index_topic']; |
|---|
| 35 | |
|---|
| 36 | $c['main'] = ""; |
|---|
| 37 | $cc = array(); |
|---|
| 38 | $cc = count_comments(); |
|---|
| 39 | |
|---|
| 40 | $max_blog = JLOG_MAX_BLOG_ORGINAL + JLOG_MAX_BLOG_BIG + JLOG_MAX_BLOG_SMALL; |
|---|
| 41 | |
|---|
| 42 | // -- Inhalte holen |
|---|
| 43 | |
|---|
| 44 | $sql = "SELECT |
|---|
| 45 | *, |
|---|
| 46 | date as mysql_date, |
|---|
| 47 | UNIX_TIMESTAMP(date) AS date, |
|---|
| 48 | DATE_FORMAT(date, '%Y-%m-%dT%T".substr(date("O"), 0, 3) . ":" . substr(date("O"), 3)."') AS metadate |
|---|
| 49 | FROM ".JLOG_DB_CONTENT." WHERE section = 'weblog' ORDER BY mysql_date DESC LIMIT ".$max_blog.";"; |
|---|
| 50 | $blog = new Query($sql); |
|---|
| 51 | if($blog->error()) { |
|---|
| 52 | echo "<pre>\n"; |
|---|
| 53 | echo $blog->getError(); |
|---|
| 54 | echo "</pre>\n"; |
|---|
| 55 | die(); |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | $number_of = $blog->numRows(); |
|---|
| 59 | |
|---|
| 60 | // -- ganze Posts ausgeben |
|---|
| 61 | $i_orginal = 0; |
|---|
| 62 | while (++$i_orginal <= JLOG_MAX_BLOG_ORGINAL) { |
|---|
| 63 | $cd = array(); |
|---|
| 64 | $cd = $blog->fetch(); |
|---|
| 65 | $c['meta']['date'] = $cd['metadate']; |
|---|
| 66 | if(empty($cd)) break 1; |
|---|
| 67 | $c['main'] .= do_entry($cd, $cc); |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | // -- Teaser ausgeben |
|---|
| 71 | $i = 0; |
|---|
| 72 | while (++$i <= JLOG_MAX_BLOG_BIG) { |
|---|
| 73 | $cd = $blog->fetch(); |
|---|
| 74 | if(empty($c['meta']['date'])) $c['meta']['date'] = $cd['metadate']; |
|---|
| 75 | if(empty($cd)) break 1; |
|---|
| 76 | $c['main'] .= do_teaser($cd, $cc); |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | if((JLOG_MAX_BLOG_BIG > 0) AND ($number_of > (JLOG_MAX_BLOG_BIG + JLOG_MAX_BLOG_ORGINAL))) $c['main'] .= "\n <hr />"; |
|---|
| 80 | |
|---|
| 81 | if($number_of > JLOG_MAX_BLOG_BIG + JLOG_MAX_BLOG_ORGINAL) $c['main'] .= "\n <ul class='entries'>"; |
|---|
| 82 | |
|---|
| 83 | // -- Liste mit alten Beitrᅵgen ausgeben |
|---|
| 84 | $linklist = false; |
|---|
| 85 | while ($cd = $blog->fetch()) { |
|---|
| 86 | if(empty($c['meta']['date'])) $c['meta']['date'] = $cd['metadate']; |
|---|
| 87 | ++$i; |
|---|
| 88 | $linklist = true; |
|---|
| 89 | |
|---|
| 90 | $tmp_comments = ""; |
|---|
| 91 | if(isset($cc[$cd['id']]) AND $cc[$cd['id']] != 0) $tmp_comments = " <a title='".$l['content_comments_title']."' href='".blog($cd['date'], $cd['url'])."#comments'>(".$cc[$cd['id']].")</a>"; |
|---|
| 92 | |
|---|
| 93 | $c['main'] .= " |
|---|
| 94 | <li>".strftime(JLOG_DATE_SUBCURRENT, $cd['date'])." <a href='".blog($cd['date'], $cd['url'])."'>".htmlspecialchars($cd['topic'], ENT_QUOTES)."</a>".$tmp_comments."</li>"; |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | if($linklist) $c['main'] .= "\n </ul>\n <hr />"; |
|---|
| 98 | |
|---|
| 99 | // -- Link zum Archiv |
|---|
| 100 | $c['main'] .= " |
|---|
| 101 | <p class='archivelink'>".$l['content_archive']." <a href='".archive()."'>".$l['content_archivelink']."</a>.</p>"; |
|---|
| 102 | |
|---|
| 103 | // -- Daten in Template einfᅵgen und ausgeben -- |
|---|
| 104 | require(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'do_template.php'); |
|---|
| 105 | echo $body; |
|---|
| 106 | ?> |
|---|