/
index.php
201 lines (147 loc) · 6.04 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?php
/********************************************************************
Yonas CMS
Copyright (C) 2008 Alvaro Garcia Cuesta
This file is part of Yonas CMS.
Yonas CMS is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
Yonas CMS is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
include_once("include/initindex.inc.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<?=htmlTitle($webTitle,"Index")?>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<?=htmlMetaStyle($cmsPath . $publicThemePath.'style.css')?>
<?=htmlMetaAuthor('Alvaro Garcia C - www.binarynonsense.com')?>
<?=htmlMetaDescription('Yonas CMS, a content management system based on php 5 and SQLite by Alvaro García')?>
<?=htmlMetaKeywords('Alvaro, García, Cuesta,Yonas,CMS, content, management, system, php, sqlite')?>
</head>
<body>
<div id="content">
<div id="header">
<?=$webTitle?>
</div>
<div id="menu">
<?=menu1($languageShort)?>
</div>
<div id="center">
<div id="verticalmenu">
<p>Categories:</p>
<ul><!--begin list-->
<?php
$length=count($categoriesTree);
for($i=0;$i<$length;$i++) {
if($categoriesTree[$i]['childID']==NULL){
// IS ROOT
echo "<li>\n";
echo "<a href='" . $cmsPath;
if($languageShort!=NULL){echo "$languageShort/";}
echo "category/".string2Url($categoriesTree[$i]['rootName'])."-".$categoriesTree[$i]['rootID']."/'>".$categoriesTree[$i]['rootName']."</a>\n";
echo "</li>\n";
}else{
if($lastRoot!=$categoriesTree[$i]['rootID']){
//first parent-child row -> i need to print the parent and the the child
$lastRoot=$categoriesTree[$i]['rootID'];
echo "<li>\n";
echo "<a href='" . $cmsPath;
if($languageShort!=NULL){echo "$languageShort/";}
echo "category/".string2Url($categoriesTree[$i]['rootName'])."-".$categoriesTree[$i]['rootID']."/'>".$categoriesTree[$i]['rootName']."</a>\n";
echo "</li>\n";
echo "<li>\n";
echo "<ul>\n";//it's root, begin children list
}
echo "<li>\n";
echo "<a href='" . $cmsPath;
if($languageShort!=NULL){echo "$languageShort/";}
echo "category/".string2Url($categoriesTree[$i]['childName'])."-".$categoriesTree[$i]['childID']."/'>".$categoriesTree[$i]['childName']."</a>\n";
echo "</li>\n";
if(($i+1)<$length){
if($categoriesTree[$i]['rootID']!=$categoriesTree[$i+1]['rootID']){
echo "</ul>\n";
echo "</li>\n";
}
}else{
echo "</ul>\n";
echo "</li>\n";
}
}
}
?>
</ul> <!--end list-->
<p>Languages:</p>
<div id="flags">
<p>
<a href="<?php
echo $cmsPath;
if($savedShowlanguages!=2){echo "en/";}
?>"><img src="<?=$publicThemePath?>englishflag.jpg" alt="englishflag" /></a>
<a href="<?php
echo $cmsPath;
if($savedShowlanguages!=3){echo "es/";}
?>"><img src="<?=$publicThemePath?>spanishflag.jpg" alt="spanishflag" /></a>
<a href="<?php
echo $cmsPath;
if($savedShowlanguages!=0){echo "all/";}
?>"><img src="<?=$publicThemePath?>allflag.jpg" alt="all languages flag" /></a>
</p>
</div> <!-- flags-->
<p>Feeds:</p>
<div id="rss">
<a href="<?=$cmsPath?>rss.php"><img src="<?=$publicThemePath?>rss091.gif" alt="new articles" /></a>
</div> <!-- rss-->
</div> <!-- verticalmenu-->
<div id="left">
<?php
//PRINT ARTICLES
for($i=0;$i<count($articlesData);$i++) {
list($year, $month, $day, $hour) = string2Date($articlesData[$i]['date']);
$userName=$usersList[$articlesData[$i]["authorID"]];
echo "<div class='posttitle'><a href='" . $cmsPath;
if($languageShort!=NULL){echo "$languageShort/";}
echo "$year/$month/$day/" . string2Url($articlesData[$i]['title']) . "-" . $articlesData[$i]["ID"] . "/'>" . $articlesData[$i]['title'] . "</a></div>\n";
echo "<div class='date'>published by ".$userName." on $month/$day/$year at $hour[0]:$hour[1]:$hour[2]</div>\n";//authorid
echo "<div class='text'>".addp($articlesData[$i]["text"])."</div>\n";
if($articlesData[$i]["more"]){
echo "<p><a href='" . $cmsPath . "$year/$month/$day/" . string2Url($articlesData[$i]['title']) . "-" . $articlesData[$i]["ID"] . "/#more' class='more'>Read More »</a></p>\n";
}
}
//Calculate offset for previous and next pages
$newOffset=$offset+$show;
$oldOffset=$offset-$show;
if ($oldOffset>=0){
if ($oldOffset==0){
echo "<a href='" .$cmsPath . "./";
if($languageShort!=NULL){echo "$languageShort/";}
echo "'>newer Posts</a> ";
}else{
echo "<a href='" .$cmsPath;
if($languageShort!=NULL){echo "$languageShort/";}
echo "offset/$oldOffset/'>newer Posts</a> ";
}
}
if ($numberArticles-$newOffset>0){
echo "<a href='" .$cmsPath;
if($languageShort!=NULL){echo "$languageShort/";}
echo "offset/$newOffset/'>older Posts</a>\n";
}
// all done
// close database file
sqlite_close($handle);
?>
<div id="footer">
<p>Powered by: <a href="http://yonas.binarynonsense.com">Yonas CMS</a> - Design: <a href="http://www.binarynonsense.com">AGC</a></p>
</div> <!-- footer -->
</div> <!-- left-->
</div> <!-- center -->
</div> <!-- content -->
</body>
</html>