Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 183 lines (161 sloc) 5.072 kB
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
1 <?php
2 /**
3 *
4 * @package Icy Phoenix
5 * @version $Id$
6 * @copyright (c) 2008 Icy Phoenix
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
8 *
9 */
10
11 /**
12 *
13 * @Extra credits for this file
14 * DaMysterious (http://damysterious.xs4all.nl/)
15 * OryNider
16 *
17 */
18
06ce0f8 @MightyGorgon Brand new version...
authored
19 define('IN_ICYPHOENIX', true);
20 if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
21 if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
22 include(IP_ROOT_PATH . 'common.' . PHP_EXT);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
23
24 // Start session management
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored
25 $user->session_begin();
d164727 @MightyGorgon First implementation of the new permissions system in CMS.
authored
26 $auth->acl($user->data);
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored
27 $user->setup();
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
28 // End session management
29
30 // Get general album information
06ce0f8 @MightyGorgon Brand new version...
authored
31 include(ALBUM_MOD_PATH . 'album_common.' . PHP_EXT);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
32
33 // XML and nocaching headers
34 // header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
35 header ('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
36 header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
37 header ('Content-Type: text/xml');
38
39 $time_start = getmicrotime();
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
40 $rss_time = gmdate('D, j M Y G:i:s T', $time_start);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
41
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored
42 // Create main site url
43 $fap_full_url = create_server_url();
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
44
06ce0f8 @MightyGorgon Brand new version...
authored
45 $index_site = $fap_full_url . 'album.' . PHP_EXT;
46 $index_url = $fap_full_url . 'album_showpage.' . PHP_EXT;
47 $thumb_url = $fap_full_url . 'album_thumbnail.' . PHP_EXT;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
48
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored
49 // If not set, set the output count to 25
50 $count = request_var('np', 25);
51 $count = ($count <= 0) ? 25 : $count;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
52
53 // BEGIN Recent Photos
54 // Start check permissions
55 $sql_allowed_cat = '';
56 $check_sel = ($admin_mode) ? 0 : 1;
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored
57 if($user->data['user_level'] != ADMIN)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
58 {
59 $album_user_access = personal_gallery_access(true, false);
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
60 $not_allowed_cat = ($album_user_access['view'] == 1) ? '' : '0';
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
61 $sql = "SELECT c.*
62 FROM ". ALBUM_CAT_TABLE ." AS c
63 WHERE cat_id <> 0";
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
64 $result = $db->sql_query($sql);
65 while($row = $db->sql_fetchrow($result))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
66 {
67 $album_user_access = album_user_access($row['cat_id'], $row, 1, 0, 0, 0, 0, 0); // VIEW
68 if($admin_mode)
69 {
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
70 if (($album_user_access['moderator'] != 1) || ($row['cat_approval'] != MOD))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
71 {
72 $not_allowed_cat .= ($not_allowed_cat == '') ? $row['cat_id'] : ',' . $row['cat_id'];
73 }
74 }
75 else
76 {
77 if ($album_user_access['view'] != 1)
78 {
79 $not_allowed_cat .= ($not_allowed_cat == '') ? $row['cat_id'] : ',' . $row['cat_id'];
80 }
81 }
82 }
83 $sql_not_allowed_cat = (empty($not_allowed_cat)) ? '' : "AND pic_cat_id NOT IN ($not_allowed_cat)";
84 }
85 // End check permissions
86 $NotErrorFlag = false;
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored
87 $sql_limit_time = '';
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
88 if (!$no_limit && isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
89 {
90 $NotErrorFlag = true;
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
91 $NotModifiedSince = @strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
92 if($NotModifiedSince > 0)
93 {
94 $sql_limit_time = "AND pic_time > " . $NotModifiedSince;
95 $sql_limit_comment_time = "AND comment_time > " . $NotModifiedSince;
96 }
97 }
98
99 $sql = "SELECT pic_id, pic_title, pic_time, pic_desc, pic_username, pic_cat_id, pic_approval, cat_title
100 FROM " . ALBUM_TABLE . " LEFT JOIN " . ALBUM_CAT_TABLE . " ON (cat_id = pic_cat_id)
101 WHERE pic_approval = $check_sel
102 $sql_not_allowed_cat $sql_cat_where $sql_limit_time
103 ORDER BY pic_time DESC
104 LIMIT $count";
105
106 $picrow = $db->sql_query($sql);
107
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
108 if (!$picrow)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
109 {
110 die("Failed obtaining list of active pictures");
111 }
112 else
113 {
114 $topics = $db->sql_fetchrowset($picrow);
115 }
116 $LastPostTime = 0;
117
118 $rss = '';
119
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
120 if (sizeof($topics) == 0)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
121 {
122 die('No pictures found');
123 }
124 else
125 {
126 // $topics contains all interesting data
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
127 for ($i = 0; $i < sizeof($topics); $i++)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
128 {
129 $title = $topics[$i]['pic_title'];
130 $title = str_replace('&', '&amp;', $title);
131 $url = $index_url . '?' . 'pic_id=' . $topics[$i]['pic_id'] . $picrow[$i]['pic_id'];
132 $thumb = $thumb_url . '?' . 'pic_id=' . $topics[$i]['pic_id'] . $picrow[$i]['pic_id'];
133 $description = '';
134 $description .= $lang['Pic_Desc'] . ': ' . nl2br($topics[$i]['pic_desc']);
135 $description .= htmlentities('<br /><a href="' . $url . '"><img src="' . $thumb . '" alt="" /></a><br /><br /><hr />');
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
136 $pic_time = gmdate('D, j M Y G:i:s T', $topics[$i]['pic_time']);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
137 $rss .= '<item>
138 <title>' . $title . '</title>
139 <description>' . $description . '</description>
140 <link>' . $url . '</link>
141 <pubDate>' . $pic_time . '</pubDate>
142 </item>';
143 }
144 }
145
146 // Create RSS header
147 $rss_header = '<?xml version="1.0" encoding="ISO-8859-2" ?>
148 <rss version="2.0">
149 <channel>
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
150 <title>' . $config['sitename'] . ' Album (XXX needs registering)</title>
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
151 <link>' . $index_url . '</link>
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
152 <description>' . $config['site_desc'] . '</description>
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
153 <language>en-us</language>
154 <generator>FAP</generator>
155 <pubDate>' . $rss_time . '</pubDate>
156 <image>
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
157 <title>' . $config['sitename'] . '</title>
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
158 <link>' . $index_site . '</link>
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
159 <description>' . $config['site_desc'] . '</description>
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
160 </image>';
161
162 // Create RSS footer
163 $rss_footer = '
164 </channel>
165 </rss>';
166
167 $rss = $rss_header . $rss . $rss_footer;
168
169 // Discritics Replace
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
170 $rss = str_replace("&auml;", "ä", $rss);
171 $rss = str_replace("&ouml;", "ö", $rss);
172 $rss = str_replace("&uuml;", "ü", $rss);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
173
174 // Output the RSS
175 echo $rss;
176
177 function getmicrotime()
178 {
179 list($usec, $sec) = explode(" ", microtime());
180 return ((float)$usec + (float)$sec);
181 }
182
183 ?>
Something went wrong with that request. Please try again.