source: trunk/index.php @ 1798

Revision 1798, 3.3 KB checked in by driehle, 3 years ago (diff)

Moved Jlog 1.5 branch into trunk/ as we will focus on Jlog 1.5 development in the future

  • Property svn:keywords set to Date Rev Author HeadURL
Line 
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
26require_once('./config.inc.php');
27require_once(JLOG_LIBPATH . '/bootstrap.php');
28
29
30 $c['meta']['robots']       = "noindex, follow";
31 $c['meta']['description']  = htmlspecialchars(strip_tags(str_replace("\n", '', JLOG_DESCRIPTION)), ENT_QUOTES);
32 $c['meta']['title']        = $l['index_topic'];
33
34 $c['main'] = "";
35 $cc = array();
36 $cc = count_comments();
37
38 $max_blog = JLOG_MAX_BLOG_ORGINAL + JLOG_MAX_BLOG_BIG + JLOG_MAX_BLOG_SMALL;
39
40// -- Inhalte holen
41
42    $sql = "SELECT
43            *,
44            date as mysql_date,
45            UNIX_TIMESTAMP(date) AS date,
46            DATE_FORMAT(date, '%Y-%m-%dT%T".substr(date("O"), 0, 3) . ":" . substr(date("O"), 3)."') AS metadate
47              FROM ".JLOG_DB_CONTENT." WHERE section = 'weblog' ORDER BY mysql_date DESC LIMIT ".$max_blog.";";
48    $blog = new Query($sql);
49     if($blog->error()) {
50        echo "<pre>\n";
51        echo $blog->getError();
52        echo "</pre>\n";
53        die();
54     }
55
56$number_of = $blog->numRows();
57
58// -- ganze Posts ausgeben
59$i_orginal = 0;
60while (++$i_orginal <= JLOG_MAX_BLOG_ORGINAL) {
61 $cd = array();
62 $cd = $blog->fetch();
63 $c['meta']['date'] = $cd['metadate'];
64 if(empty($cd)) break 1;
65 $c['main'] .= do_entry($cd, $cc);
66}
67
68// -- Teaser ausgeben
69$i = 0;
70while (++$i <= JLOG_MAX_BLOG_BIG) {
71 $cd = $blog->fetch();
72 if(empty($c['meta']['date'])) $c['meta']['date'] = $cd['metadate'];
73 if(empty($cd)) break 1;
74 $c['main'] .= do_teaser($cd, $cc);
75}
76
77if((JLOG_MAX_BLOG_BIG > 0) AND ($number_of > (JLOG_MAX_BLOG_BIG + JLOG_MAX_BLOG_ORGINAL))) $c['main'] .= "\n  <hr />";
78
79if($number_of > JLOG_MAX_BLOG_BIG + JLOG_MAX_BLOG_ORGINAL) $c['main'] .= "\n  <ul class='entries'>";
80
81// -- Liste mit alten BeitrÀgen ausgeben
82$linklist = false;
83while ($cd = $blog->fetch()) {
84 if(empty($c['meta']['date'])) $c['meta']['date'] = $cd['metadate'];
85 ++$i;
86 $linklist = true;
87
88 $tmp_comments = "";
89 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>";
90
91 $c['main'] .= "
92   <li>".strftime(JLOG_DATE_SUBCURRENT, $cd['date'])." <a href='".blog($cd['date'], $cd['url'])."'>".htmlspecialchars($cd['topic'], ENT_QUOTES)."</a>".$tmp_comments."</li>";
93 }
94
95if($linklist) $c['main'] .= "\n  </ul>\n  <hr />";
96
97// -- Link zum Archiv
98 $c['main'] .= "
99  <p class='archivelink'>".$l['content_archive']." <a href='".archive()."'>".$l['content_archivelink']."</a>.</p>";
100
101// -- Daten in Template einfÃŒgen und ausgeben --
102require(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'do_template.php');
103echo $body;
104
105// eof
Note: See TracBrowser for help on using the repository browser.