-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.php
142 lines (127 loc) · 3.93 KB
/
main.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
<?php
require 'gallery.php';
require 'init.php';
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"';
echo ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
echo '<html>';
echo '<head>';
echo ' <title>Gallery</title>';
echo ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
echo ' <style type="text/css" media="screen">@import "', $WEB_ROOT, '/gallery.css.php?gallery=', $GALLERY, '";</style>';
echo ' <script type="text/javascript" src="', $WEB_ROOT, '/prototype.js"></script>';
echo ' <script type="text/javascript" src="', $WEB_ROOT, '/scriptaculous.js?load=effects"></script>';
echo ' <script type="text/javascript" src="', $WEB_ROOT, '/gallery.js.php?gallery=', $GALLERY, '"></script>';
echo '</head>';
echo '<body>';
if ($GALLERY === false) {
if ($_GET['list']) {
include 'list.php';
echo '<ol style="text-align:left;">';
foreach ($galleries as $value) {
echo '<li><a href="', $value, '">', $value, '</a></li>';
}
echo '</ol>';
} else {
echo '<p>Woops, gallery not found!</p>';
}
} else {
$gallery = new Gallery($GALLERY_ROOT, $_GET['vip']);
echo '<h1>';
if ($gallery->getCaption()) {
echo $gallery->getCaption();
} else {
echo 'Gallery';
}
echo '</h1>';
echo '<table class="images">';
for ($i=0, $toi=count($gallery->images); $i<$toi; $i++) {
$img = $gallery->images[$i];
if ($i % ROWS == 0) {
echo "<tr>\n";
}
$commentClass = '';
$cookieName = preg_replace('/[^\d\w]/', '_', $img->getName());
if (filemtime($GALLERY_ROOT . '/.data/' . $img->getName() . '.xml') > $_COOKIE[$cookieName]) {
$commentClass = ' class="newcomments"';
}
echo "\t<td", $commentClass, '><a href="', $WEB_GALLERY_ROOT, '/', $img->getName(), '" rel="lightbox[g]">';
if ($img->hasThumbnail(true)) {
echo '<img ',
'src="', $WEB_GALLERY_ROOT, '/t/', $img->getName(), '" ',
'alt="', $img->getName(), '" />';
} else {
echo '<img ',
'src="', $WEB_GALLERY_ROOT, '/', $img->getName(), '" ',
'alt="', $img->getName(), '" ',
'width="', MAX_WIDTH, '" ',
'height="', MAX_HEIGHT, '" />';
}
echo '</a>';
if ($img->getCaption()) {
echo '<div>', $img->getCaption(), '</div>';
}
echo "</td>\n";
if (($i+1) % ROWS == 0) {
echo "</tr>\n";
flush();// force flush
}
}
if ($i % ROWS != 0) {
for ($i=ROWS-($i%ROWS); $i>0; $i--) {
echo '<td> </td>';
}
echo '</tr>';
}
echo '</table>';
if (count($gallery->documents) > 0) {
echo '<div id="files">Citi faili</div><ul id="other">';
for ($i=0, $toi=count($gallery->documents); $i<$toi; $i++) {
$doc = $gallery->documents[$i];
echo '<li><a href="', $doc->getName(), '">', $doc->getCaption(), '</a></li>';
}
echo '</ul>';
}
if (count($gallery->galleries) > 0) {
echo '<div id="galleries">Citas galerijas</div><ul id="galls">';
for ($i=0, $toi=count($gallery->galleries); $i<$toi; $i++) {
$gal = $gallery->galleries[$i];
echo '<li><a href="', $gal->getName(), '">', $gal->getCaption(), '</a></li>';
}
echo '</ul>';
}
}
echo '<div id="footer">© ', spambot('japets', 'miga.lv'), ', ', spambot('papuass', 'enkurs.org'), '<br>Shmiga productions 2003 - '.date(Y).'</div>';
if (defined('UACCT')) {
echo '<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">';
echo '</script>';
echo '<script type="text/javascript">';
echo '_uacct = "', UACCT, '";';
echo 'urchinTracker();';
echo '</script>';
}
echo '</body>';
echo '</html>';
// {{{ spambot()
function spambot() {
if (func_num_args() == 1) {
$email = func_get_arg(0);
$temp = explode('@', $email);
if (count($temp) != 2) {
return $email;
}
$name = $temp[0];
$domain = $temp[1];
} elseif (func_num_args() == 2) {
$name = func_get_arg(0);
$domain = func_get_arg(1);
} else {
return;// eh, pietruukst exception :)
}
return '<a class="addr" href="#"><span class="addr_name">'
.$name
.'</span><span class="addr_suns"> et </span><span class="addr_domain">'
.$domain
.'</span></a>';
}
// }}}
?>