Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 406 lines (350 sloc) 17.87 kb
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
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 // Added to optimize memory for attachments
12 define('ATTACH_DISPLAY', true);
06ce0f8 @MightyGorgon Brand new version...
authored
13 define('IN_ICYPHOENIX', true);
14 if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
15 if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
16 include(IP_ROOT_PATH . 'common.' . PHP_EXT);
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
17
18 @include_once(IP_ROOT_PATH . 'includes/class_topics.' . PHP_EXT);
19 $class_topics = new class_topics();
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
20
21 // Start session management
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
22 $user->session_begin();
d164727 @MightyGorgon First implementation of the new permissions system in CMS.
authored
23 $auth->acl($user->data);
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
24 $user->setup();
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
25 // End session management
26
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edited...
authored
27 $start = request_var('start', 0);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
28 $start = ($start < 0) ? 0 : $start;
29
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edited...
authored
30 $page_number = request_var('page_number', 0);
31 $page_number = ($page_number < 1) ? 0 : $page_number;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
32
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edited...
authored
33 $start = (empty($page_number) ? $start : (($page_number * $config['topics_per_page']) - $config['topics_per_page']));
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
34
35 // ############ Edit below ########################################
9dea0d4 @MightyGorgon New Icy Phoenix structure.
authored
36 $topic_length = '60'; // length of topic title
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
37 $topic_limit = $config['topics_per_page'];
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
38 $special_forums = '0'; // specify forums ('0' = no; '1' = yes)
39 $forum_ids = ''; // IDs of forums; separate them with a comma
9dea0d4 @MightyGorgon New Icy Phoenix structure.
authored
40 $set_mode = 'last24'; // set default mode ('today', 'yesterday', 'last24', 'lastweek', 'lastXdays')
41 $set_days = '7'; // set default days (used for lastXdays mode)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
42 // ############ Edit above ########################################
43
44 //<!-- BEGIN Unread Post Information to Database Mod -->
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
45 if($user->data['upi2db_access'])
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
46 {
346e7ca @MightyGorgon Other bugs fixed... still some open due to the new sessions and user cla...
authored
47 if (!defined('UPI2DB_UNREAD'))
1cf9c9a @MightyGorgon Some bugs fixed:
authored
48 {
346e7ca @MightyGorgon Other bugs fixed... still some open due to the new sessions and user cla...
authored
49 $user->data['upi2db_unread'] = upi2db_unread();
1cf9c9a @MightyGorgon Some bugs fixed:
authored
50 }
346e7ca @MightyGorgon Other bugs fixed... still some open due to the new sessions and user cla...
authored
51 $count_new_posts = sizeof($user->data['upi2db_unread']['new_posts']);
52 $count_edit_posts = sizeof($user->data['upi2db_unread']['edit_posts']);
53 $count_always_read = sizeof($user->data['upi2db_unread']['always_read']['topics']);
54 $count_mark_unread = sizeof($user->data['upi2db_unread']['mark_posts']);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
55 }
56 //<!-- END Unread Post Information to Database Mod -->
57
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
58 $cms_page['page_id'] = 'recent';
59 $cms_page['page_nav'] = (!empty($cms_config_layouts[$cms_page['page_id']]['page_nav']) ? true : false);
60 $cms_page['global_blocks'] = (!empty($cms_config_layouts[$cms_page['page_id']]['global_blocks']) ? true : false);
61 $cms_auth_level = (isset($cms_config_layouts[$cms_page['page_id']]['view']) ? $cms_config_layouts[$cms_page['page_id']]['view'] : AUTH_ALL);
62 check_page_auth($cms_page['page_id'], $cms_auth_level);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
63
1c23423 @MightyGorgon Latest updates for IP 1.3 RC2
authored
64 $mode_types = array('today', 'yesterday', 'last24', 'lastweek', 'lastXdays', 'utopics', 'uposts');
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
65 if ($user->data['user_level'] == ADMIN)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
66 {
1c23423 @MightyGorgon Latest updates for IP 1.3 RC2
authored
67 $mode_types = array_merge($mode_types, array('utview'));
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
68 }
69
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edited...
authored
70 $mode = request_var('mode', $set_mode);
71 $mode = check_var_value($mode, $mode_types, $set_mode);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
72
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edited...
authored
73 $amount_days = request_var('amount_days', 0);
74 $amount_days = ($amount_days <= 0) ? $set_days : $amount_days;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
75
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edited...
authored
76 $user_id = request_var(POST_USERS_URL, 0);
77 if(!empty($user_id))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
78 {
79 $user_id = ($user_id < 2) ? false : $user_id;
80
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edited...
authored
81 if (!empty($user_id))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
82 {
b73eec6 @MightyGorgon New CMS version, still unstable.
authored
83 $target_userdata = get_userdata($user_id);
84 if (empty($target_userdata))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
85 {
86 $mode = $set_mode;
87 }
b73eec6 @MightyGorgon New CMS version, still unstable.
authored
88 else
89 {
90 $username = htmlspecialchars($target_userdata['username']);
91 }
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
92 }
93 else
94 {
95 $mode = $set_mode;
96 }
97 }
98
99 $psort_types = array('time', 'cat');
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edited...
authored
100 $psort = request_var('psort', $psort_types[0]);
101 $psort = check_var_value($psort, $psort_types);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
102
2c2bc4a @MightyGorgon Many updates to the core code.
authored
103 $nav_server_url = create_server_url();
6a9e3e3 @MightyGorgon Some fixes for Icy Phoenix 2.0 Beta 1
authored
104 $breadcrumbs['address'] = $lang['Nav_Separator'] . '<a href="' . $nav_server_url . append_sid('recent.' . PHP_EXT) . '" class="nav-current">' . $lang['Recent_topics'] . '</a>';
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
105
106 $except_forums = build_exclusion_forums_list();
107
108 $where_forums = ($special_forums == '0') ? 't.forum_id NOT IN (' . $except_forums . ')' : 't.forum_id NOT IN (' . $except_forums . ') AND t.forum_id IN (' . $forum_ids . ')';
109 $sql_sort = ' ORDER BY t.topic_last_post_id DESC ';
110 if ($psort == 'cat')
111 {
112 $sql_sort = ' ORDER BY f.forum_id ASC, t.topic_last_post_id DESC ';
113 }
114
115 $extra_tables = '';
116 $extra_fields = '';
117 if ($mode == 'utview')
118 {
119 $extra_fields = ", tv.view_time, tv.view_count";
120 $extra_tables = ", " . TOPIC_VIEW_TABLE . " tv";
121 }
122
4908adc @MightyGorgon Added some fields in profile and started to edit profile layout
authored
123 $sql_start = "SELECT DISTINCT(t.topic_id), t.*, p.poster_id, p.post_username AS last_poster_name, p.post_id, p.post_time, f.forum_name, f.forum_id, u.username AS last_poster, u.user_id AS last_poster_id, u.user_active AS last_poster_active, u.user_mask AS last_poster_mask, u.user_color AS last_poster_color, u2.username AS first_poster, u2.user_id AS first_poster_id, u2.user_active AS first_poster_active, u2.user_mask AS first_poster_mask, u2.user_color AS first_poster_color, p2.post_username AS first_poster_name" . $extra_fields . "
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
124 FROM (" . TOPICS_TABLE . " t, " . POSTS_TABLE . " p" . $extra_tables . ")
125 LEFT OUTER JOIN " . POSTS_TABLE . " p2 ON (p2.post_id = t.topic_first_post_id)
126 LEFT OUTER JOIN " . FORUMS_TABLE . " f ON (f.forum_id = p.forum_id)
127 LEFT OUTER JOIN " . USERS_TABLE . " u ON (u.user_id = p.poster_id)
128 LEFT OUTER JOIN " . USERS_TABLE . " u2 ON (u2.user_id = t.topic_poster)
f407213 @MightyGorgon Some small bugs fixes and added memberlist search for admins.
authored
129 WHERE ";
130 $sql_where = $where_forums . " AND p.post_id = t.topic_last_post_id AND t.topic_status <> " . TOPIC_MOVED;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
131 $sql_end = "LIMIT $start, $topic_limit";
132
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
133 if (!$user->data['session_logged_in'])
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
134 {
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
135 $user->data['user_time_mode'] = $config['default_time_mode'];
136 $user->data['user_timezone'] = $config['board_timezone'];
137 $user->data['user_dst_time_lag'] = $config['default_dst_time_lag'];
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
138 }
139
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
140 $dst_sec = get_dst(time(), $user->data['user_timezone']);
141 $adj_time = (3600 * $user->data['user_timezone']) + $dst_sec;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
142 $int_day_sec = intval((time() + $adj_time) / 86400) * 86400;
143
144 $mode_pagination = '&amp;amount_days=' . $amount_days;
145 $total_topics = 0;
146
147 switch($mode)
148 {
149 case 'today':
4094590 @MightyGorgon Update to RC version
authored
150 $sql_tmp = " AND (p.post_time + " . $adj_time . ") > " . $int_day_sec;
f407213 @MightyGorgon Some small bugs fixes and added memberlist search for admins.
authored
151 $sql = $sql_start . $sql_where . $sql_tmp . $sql_sort . $sql_end;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
152 $template->assign_vars(array('STATUS' => $lang['Recent_today']));
4094590 @MightyGorgon Update to RC version
authored
153 $where_count = $where_forums . $sql_tmp;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
154 $l_mode = $lang['Recent_title_today'];
155 break;
156
157 case 'yesterday':
4094590 @MightyGorgon Update to RC version
authored
158 $sql_tmp = " AND (p.post_time + 86400 + " . $adj_time . ") > " . $int_day_sec . " AND (p.post_time + " . $adj_time . ") < " . $int_day_sec;
f407213 @MightyGorgon Some small bugs fixes and added memberlist search for admins.
authored
159 $sql = $sql_start . $sql_where . $sql_tmp . $sql_sort . $sql_end;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
160 $template->assign_vars(array('STATUS' => $lang['Recent_yesterday']));
4094590 @MightyGorgon Update to RC version
authored
161 $where_count = $where_forums . $sql_tmp;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
162 $l_mode = $lang['Recent_title_yesterday'];
163 break;
164
165 case 'last24':
f407213 @MightyGorgon Some small bugs fixes and added memberlist search for admins.
authored
166 $sql = $sql_start . $sql_where . " AND UNIX_TIMESTAMP(NOW()) - p.post_time < 86400" . $sql_sort . $sql_end;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
167 $template->assign_vars(array('STATUS' => $lang['Recent_last24']));
168 $where_count = $where_forums . " AND UNIX_TIMESTAMP(NOW()) - p.post_time < 86400";
169 $l_mode = $lang['Recent_title_last24'];
170 break;
171
172 case 'lastweek':
f407213 @MightyGorgon Some small bugs fixes and added memberlist search for admins.
authored
173 $sql = $sql_start . $sql_where . " AND UNIX_TIMESTAMP(NOW()) - p.post_time < 691200" . $sql_sort . $sql_end;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
174 $template->assign_vars(array('STATUS' => $lang['Recent_lastweek']));
175 $where_count = $where_forums . " AND UNIX_TIMESTAMP(NOW()) - p.post_time < 691200";
176 $l_mode = $lang['Recent_title_lastweek'];
177 break;
178
179 case 'lastXdays':
f407213 @MightyGorgon Some small bugs fixes and added memberlist search for admins.
authored
180 $sql = $sql_start . $sql_where . " AND UNIX_TIMESTAMP(NOW()) - p.post_time < 86400 * " . $amount_days . $sql_sort . $sql_end;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
181 $template->assign_vars(array('STATUS' => sprintf($lang['Recent_lastXdays'], $amount_days)));
182 $where_count = $where_forums . " AND UNIX_TIMESTAMP(NOW()) - p.post_time < 86400 * $amount_days";
183 $l_mode = sprintf($lang['Recent_title_lastXdays'], $amount_days);
184 break;
185
186 case 'utopics':
f407213 @MightyGorgon Some small bugs fixes and added memberlist search for admins.
authored
187 $sql = $sql_start . $sql_where . " AND t.topic_poster = " . $user_id . $sql_sort . $sql_end;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
188 $template->assign_vars(array('STATUS' => sprintf($lang['RECENT_USER_STARTED_NAV'], $username)));
189 $where_count = $where_forums . " AND t.topic_poster = '" . $user_id . "'";
190 $l_mode = sprintf($lang['RECENT_USER_STARTED_TITLE'], $username);
191 $mode_pagination = '&amp;' . POST_USERS_URL . '=' . $user_id;
192 break;
193
194 case 'uposts':
f407213 @MightyGorgon Some small bugs fixes and added memberlist search for admins.
authored
195 $sql = "SELECT topic_id, MAX(post_time) as ptime
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
196 FROM " . POSTS_TABLE . "
f407213 @MightyGorgon Some small bugs fixes and added memberlist search for admins.
authored
197 WHERE poster_id = '" . $user_id . "'
198 GROUP BY topic_id
199 ORDER BY ptime DESC";
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
200 $result = $db->sql_query($sql);
201
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
202 $search_ids = array();
203 while($row = $db->sql_fetchrow($result))
204 {
205 $search_ids[] = $row['topic_id'];
206 }
207 $db->sql_freeresult($result);
208 $sql_add = '';
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
209 $total_topics = sizeof($search_ids);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
210 if ($total_topics > 0)
211 {
f407213 @MightyGorgon Some small bugs fixes and added memberlist search for admins.
authored
212 $sql_where = " t.topic_id IN (" . implode(',', $search_ids) . ") AND " . $sql_where;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
213 }
f407213 @MightyGorgon Some small bugs fixes and added memberlist search for admins.
authored
214 $sql = $sql_start . $sql_where . $sql_sort . $sql_end;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
215 $template->assign_vars(array('STATUS' => sprintf($lang['RECENT_USER_POSTS_NAV'], $username)));
216 $where_count = $where_forums . " AND p.poster_id = '" . $user_id . "'";
217 $l_mode = sprintf($lang['RECENT_USER_POSTS_TITLE'], $username);
218 $mode_pagination = '&amp;' . POST_USERS_URL . '=' . $user_id;
219 break;
220
221 case 'utview':
222 $sql_sort = ' ORDER BY tv.view_time DESC ';
223 if ($psort == 'cat')
224 {
225 $sql_sort = ' ORDER BY f.forum_id ASC, tv.view_time DESC ';
226 }
f407213 @MightyGorgon Some small bugs fixes and added memberlist search for admins.
authored
227 $sql_where = $sql_where . " AND tv.topic_id = t.topic_id AND tv.user_id = '" . $user_id . "' ";
228 $sql = $sql_start . $sql_where . $sql_sort . $sql_end;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
229 $template->assign_vars(array('STATUS' => sprintf($lang['RECENT_USER_VIEWS_NAV'], $username)));
230 $where_count = $where_forums . " AND tv.topic_id = t.topic_id AND tv.user_id = '" . $user_id . "'";
231 $l_mode = sprintf($lang['RECENT_USER_VIEWS_TITLE'], $username);
232 $mode_pagination = '&amp;' . POST_USERS_URL . '=' . $user_id;
233 break;
234
235 default:
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
236 $message = $lang['Recent_wrong_mode'] . '<br /><br />' . sprintf($lang['Recent_click_return'], '<a href="' . append_sid('recent.' . PHP_EXT) . '">', '</a>') . '<br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(CMS_PAGE_FORUM) . '">', '</a>');
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
237 message_die(GENERAL_MESSAGE, $message);
238 break;
239 }
240
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
241 $result = $db->sql_query($sql);
242
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
243 $line = array();
244 while($row = $db->sql_fetchrow($result))
245 {
246 $line[] = $row;
247 }
248 $db->sql_freeresult($result);
249
7e92605 @MightyGorgon Preparing Icy Phoenix 2.0 Beta 2
authored
250 $tracking_forums = (isset($_COOKIE[$config['cookie_name'] . '_f'])) ? unserialize($_COOKIE[$config['cookie_name'] . '_f']) : array();
251 $tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_t'])) ? unserialize($_COOKIE[$config['cookie_name'] . '_t']) : array();
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
252
253 // MG User Replied - BEGIN
68f273a @MightyGorgon Some features update:
authored
254 // check if user replied to the topic
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
255 define('USER_REPLIED_ICON', true);
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
256 $user_topics = $class_topics->user_replied_array($line);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
257 // MG User Replied - END
258
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
259 for($i = 0; $i < sizeof($line); $i++)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
260 {
261 $forum_id = $line[$i]['forum_id'];
262 $topic_id = $line[$i]['topic_id'];
263 $forum_id_append = (!empty($forum_id) ? (POST_FORUM_URL . '=' . $forum_id) : '');
264 $topic_id_append = (!empty($topic_id) ? (POST_TOPIC_URL . '=' . $topic_id) : '');
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
265 $forum_url = append_sid(CMS_PAGE_VIEWFORUM . '?' . $forum_id_append);
266 $topic_url = append_sid(CMS_PAGE_VIEWTOPIC . '?' . $forum_id_append . '&amp;' . $topic_id_append);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
267 $user_replied = (!empty($user_topics) && isset($user_topics[$topic_id]));
268
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
269 $word_censor = censor_text($line[$i]['topic_title']);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
270 $topic_title = (strlen($line[$i]['topic_title']) < $topic_length) ? $word_censor : substr(stripslashes($word_censor), 0, $topic_length) . '...';
271 $topic_title_prefix = (empty($line[$i]['title_compl_infos'])) ? '' : $line[$i]['title_compl_infos'] . ' ';
272 $topic_title = $topic_title_prefix . $topic_title;
273
274 //$news_label = ($line[$i]['news_id'] > 0) ? $lang['News_Cmx'] . '' : '';
275 $news_label = '';
276
277 $views = $line[$i]['topic_views'];
278 $replies = $line[$i]['topic_replies'];
279
346e7ca @MightyGorgon Other bugs fixed... still some open due to the new sessions and user cla...
authored
280 $topic_link = $class_topics->build_topic_icon_link($forum_id, $line[$i]['topic_id'], $line[$i]['topic_type'], $line[$i]['topic_reg'], $line[$i]['topic_replies'], $line[$i]['news_id'], $line[$i]['poll_start'], $line[$i]['topic_status'], $line[$i]['topic_moved_id'], $line[$i]['post_time'], $user_replied, $replies);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
281
282 $topic_id = $topic_link['topic_id'];
283 $topic_id_append = $topic_link['topic_id_append'];
284
dbcd6a4 @MightyGorgon Added a function to generate topics pagination and integrated where need...
authored
285 $topic_pagination = generate_topic_pagination($forum_id, $topic_id, $replies);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
286
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
287 $first_time = create_date_ip($lang['DATE_FORMAT_VF'], $line[$i]['topic_time'], $config['board_timezone'], true);
9dea0d4 @MightyGorgon New Icy Phoenix structure.
authored
288 // Old format
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
289 //$first_time = create_date_ip($config['default_dateformat'], $line[$i]['topic_time'], $config['board_timezone']);
841b23a @MightyGorgon New beta candidate... with many many changes and new features respect to...
authored
290 $first_author = ($line[$i]['first_poster_id'] != ANONYMOUS) ? colorize_username($line[$i]['first_poster_id'], $line[$i]['first_poster'], $line[$i]['first_poster_color'], $line[$i]['first_poster_active']) : (($line[$i]['first_poster_name'] != '') ? $line[$i]['first_poster_name'] : $lang['Guest']);
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
291 if (($user->data['user_level'] != ADMIN) && !empty($line[$i]['first_poster_mask']) && empty($line[$i]['first_poster_active']))
4908adc @MightyGorgon Added some fields in profile and started to edit profile layout
authored
292 {
293 $first_author = $lang['INACTIVE_USER'];
294 }
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
295 $last_time = create_date_ip($config['default_dateformat'], $line[$i]['post_time'], $config['board_timezone']);
68f273a @MightyGorgon Some features update:
authored
296 $last_author = ($line[$i]['last_poster_id'] != ANONYMOUS) ? colorize_username($line[$i]['last_poster_id'], $line[$i]['last_poster'], $line[$i]['last_poster_color'], $line[$i]['last_poster_active']) : (($line[$i]['last_poster_name'] != '') ? $line[$i]['last_poster_name'] : $lang['Guest']);
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
297 if (($user->data['user_level'] != ADMIN) && !empty($line[$i]['last_poster_mask']) && empty($line[$i]['last_poster_active']))
4908adc @MightyGorgon Added some fields in profile and started to edit profile layout
authored
298 {
299 $last_author = $lang['INACTIVE_USER'];
300 }
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
301 $last_url = '<a href="' . append_sid(CMS_PAGE_VIEWTOPIC . '?' . $forum_id_append . '&amp;' . $topic_id_append . '&amp;' . POST_POST_URL . '=' . $line[$i]['topic_last_post_id']) . '#p' . $line[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
302
303 // SELF AUTH - BEGIN
304 // Comment the lines below if you wish to show RESERVED topics for AUTH_SELF.
305 /*
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
306 if ((($user->data['user_level'] != ADMIN) && ($user->data['user_level'] != MOD)) && (intval($is_auth_ary[$line[$i]['forum_id']]['auth_read']) == AUTH_SELF) && ($line[$i]['first_poster_id'] != $user->data['user_id']))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
307 {
308 $first_author = $lang['Reserved_Author'];
309 $last_author = $lang['Reserved_Author'];
310 $topic_title = $lang['Reserved_Topic'];
311 }
312 */
313 // SELF AUTH - END
841b23a @MightyGorgon New beta candidate... with many many changes and new features respect to...
authored
314
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
315 if($mode == 'utview')
316 {
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
317 $last_time = $last_time = create_date_ip($config['default_dateformat'], $line[$i]['view_time'], $config['board_timezone']);;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
318 $last_author = '';
319 $last_url = '';
320 }
321
2c94306 @MightyGorgon Some XSS vulnerabilities fixes
authored
322 // Convert and clean special chars!
323 $topic_title = htmlspecialchars_clean($topic_title);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
324 $template->assign_block_vars('recent', array(
325 'ROW_CLASS' => (!($i % 2)) ? $theme['td_class1'] : $theme['td_class2'],
326
327 'TOPIC_ID' => $topic_id,
328 'TOPIC_FOLDER_IMG' => $topic_link['image'],
329 'L_TOPIC_FOLDER_ALT' => $topic_link['image_alt'],
330 'TOPIC_TITLE' => $topic_title,
331 'TOPIC_TYPE' => $topic_link['type'],
332 'TOPIC_TYPE_ICON' => $topic_link['icon'],
333 'TOPIC_CLASS' => (!empty($topic_link['class_new']) ? ('topiclink' . $topic_link['class_new']) : $topic_link['class']),
334 'CLASS_NEW' => $topic_link['class_new'],
335 'NEWEST_POST_IMG' => $topic_link['newest_post_img'],
336 'L_NEWS' => $news_label,
337 'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($line[$i]['topic_attachment']),
dbcd6a4 @MightyGorgon Added a function to generate topics pagination and integrated where need...
authored
338 'GOTO_PAGE' => $topic_pagination['base'],
339 'GOTO_PAGE_FULL' => $topic_pagination['full'],
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
340 'L_VIEWS' => $lang['Views'],
341 'VIEWS' => $views,
342
343 'L_REPLIES' => $lang['Replies'],
344 'REPLIES' => $replies,
6a9e3e3 @MightyGorgon Some fixes for Icy Phoenix 2.0 Beta 1
authored
345 //'FIRST_POST_TIME' => sprintf($lang['Recent_first'], $first_time),
346 'FIRST_POST_TIME' => $first_time,
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
347 'FIRST_AUTHOR' => $first_author,
6a9e3e3 @MightyGorgon Some fixes for Icy Phoenix 2.0 Beta 1
authored
348 'LAST_POST_TIME' => $last_time,
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
349 'LAST_AUTHOR' => $last_author,
350 'LAST_URL' => $last_url,
351 'FORUM_NAME' => $line[$i]['forum_name'],
352 'U_VIEW_FORUM' => $forum_url,
353 'U_VIEW_TOPIC' => $topic_url,
354 )
355 );
356 }
357
358 if ($total_topics == 0)
359 {
360 $sql = "SELECT count(DISTINCT(t.topic_id)) AS total_topics
361 FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p" . $extra_tables . "
362 WHERE $where_count
363 AND p.post_id = t.topic_last_post_id";
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
364 $result = $db->sql_query($sql);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
365 if($total = $db->sql_fetchrow($result))
366 {
367 $total_topics = $total['total_topics'];
368 }
369 }
370
06ce0f8 @MightyGorgon Brand new version...
authored
371 $base_url = 'recent.' . PHP_EXT . '?mode=' . $mode . $mode_pagination;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
372 if ($psort != $psort_types[0])
373 {
374 $base_url .= '&amp;psort=' . $psort;
375 }
376 $pagination = generate_pagination($base_url, $total_topics, $topic_limit, $start) . '&nbsp;';
377
378 if($total_topics == '0')
379 {
380 $template->assign_block_vars('switch_no_topics', array());
381 }
382
383 $template->assign_vars(array(
384 'L_RECENT_TITLE' => ($total_topics == '1') ? sprintf($lang['Recent_title_one'], $total_topics, $l_mode) : sprintf($lang['Recent_title_more'], $total_topics, $l_mode),
385 'L_TODAY' => $lang['Recent_today'],
386 'L_YESTERDAY' => $lang['Recent_yesterday'],
387 'L_LAST24' => $lang['Recent_last24'],
388 'L_LASTWEEK' => $lang['Recent_lastweek'],
389 'L_LAST' => $lang['Recent_last'],
390 'L_DAYS' => $lang['Recent_days'],
391 'L_SELECT_MODE' => $lang['Recent_select_mode'],
392 'L_SHOWING_POSTS' => $lang['Recent_showing_posts'],
841b23a @MightyGorgon New beta candidate... with many many changes and new features respect to...
authored
393 'L_LASTPOST' => ($mode == 'utview') ? $lang['Topic_time'] : $lang['Last_Post'],
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
394 'L_NO_TOPICS' => $lang['Recent_no_topics'],
9381fee @MightyGorgon Other bugs fix for RC version
authored
395 'U_SORT_CAT' => append_sid('recent.' . PHP_EXT . '?amount_days=' . $amount_days . '&amp;mode=' . $mode . '&amp;psort=cat&amp;start=' . $start . (!empty($user_id) ? ('&amp;' . POST_USERS_URL . '=' . $user_id) : '')),
396 'U_SORT_TIME' => append_sid('recent.' . PHP_EXT . '?amount_days=' . $amount_days . '&amp;mode=' . $mode . '&amp;psort=time&amp;start=' . $start . (!empty($user_id) ? ('&amp;' . POST_USERS_URL . '=' . $user_id) : '')),
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
397 'AMOUNT_DAYS' => $amount_days,
06ce0f8 @MightyGorgon Brand new version...
authored
398 'FORM_ACTION' => append_sid('recent.' . PHP_EXT),
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
399 'PAGINATION' => ($total_topics != '0') ? $pagination : '&nbsp;',
400 'PAGE_NUMBER' => ($total_topics != '0') ? sprintf($lang['Page_of'], (floor($start / $topic_limit) + 1), ceil($total_topics / $topic_limit)) : '&nbsp;',
401 )
402 );
403
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
404 full_page_generation('recent_body.tpl', $lang['Recent_topics'], '', '');
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
405
406 ?>
Something went wrong with that request. Please try again.