Skip to content
Newer
Older
100644 532 lines (478 sloc) 16.2 KB
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
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 * Javier B (kinfule@lycos.es)
15 */
16
06ce0f8 @MightyGorgon Brand new version...
authored Sep 14, 2008
17 if (!defined('IN_ICYPHOENIX'))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
18 {
19 die('Hacking attempt');
20 }
21
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
22 if (!defined('CTRACKER_DISABLE_OUTPUT'))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
23 {
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
24 define('CTRACKER_DISABLE_OUTPUT', true);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
25 }
26
06ce0f8 @MightyGorgon Brand new version...
authored Sep 14, 2008
27 include_once(IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT);
28 include_once(IP_ROOT_PATH . 'includes/functions_post.' . PHP_EXT);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
29
30 // Lets see what we do, if nothing define show the shoutbox
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored Mar 20, 2010
31 $action = request_var('act', '');
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
32
9d4fc0e @GabrielAnca Features added:
GabrielAnca authored Jan 16, 2010
33 $private_chat = false;
ac3e610 @MightyGorgon Added AJAX Private Chat
authored Nov 28, 2009
34 if (!defined('AJAX_CHAT_ROOM'))
35 {
36 $chat_room = request_var('chat_room', '');
45c7717 @MightyGorgon Fixed some wrong regular expressions
authored Dec 6, 2009
37 $chat_room = preg_replace('/[^0-9|]+/', '', trim($chat_room));
ac3e610 @MightyGorgon Added AJAX Private Chat
authored Nov 28, 2009
38 $chat_room_users = array();
39 $chat_room_users = explode('|', $chat_room);
9d4fc0e @GabrielAnca Features added:
GabrielAnca authored Jan 16, 2010
40 $chat_room_users_count = sizeof($chat_room_users);
ac3e610 @MightyGorgon Added AJAX Private Chat
authored Nov 28, 2009
41 $chat_room_sql = " s.shout_room = '" . $chat_room . "' ";
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
42 if(($user->data['user_level'] != ADMIN) && !empty($chat_room) && !in_array($user->data['user_id'], $chat_room_users))
ac3e610 @MightyGorgon Added AJAX Private Chat
authored Nov 28, 2009
43 {
44 message_die(GENERAL_ERROR, $lang['Not_Auth_View']);
45 }
46 define('AJAX_CHAT_ROOM', true);
9d4fc0e @GabrielAnca Features added:
GabrielAnca authored Jan 16, 2010
47 $private_chat = true;
ac3e610 @MightyGorgon Added AJAX Private Chat
authored Nov 28, 2009
48 }
49
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored Mar 20, 2010
50 if(!empty($action))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
51 {
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
52 define('AJAX_HEADERS', true);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
53 // Headers are sent to prevent browsers from caching... IE is still resistent sometimes
54 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
55 header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT');
56 header('Cache-Control: no-cache, must-revalidate');
57 header('Pragma: no-cache');
8fc4521 @MightyGorgon Bugs fixed:
authored Dec 12, 2009
58 header('Content-type: text/xml; charset=UTF-8');
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
59
60 // Define the XML Template
61 $template->set_filenames(array('xml' => 'ajax_shoutbox_xml.tpl'));
62
63 $error = AJAX_SHOUTBOX_NO_ERROR;
64 $error_msg = '';
65
9d4fc0e @GabrielAnca Features added:
GabrielAnca authored Jan 16, 2010
66 // Delete alert for poster if present
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
67 if ($private_chat && !empty($user->data['user_private_chat_alert']))
9d4fc0e @GabrielAnca Features added:
GabrielAnca authored Jan 16, 2010
68 {
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
69 $sql = "UPDATE " . USERS_TABLE . " SET user_private_chat_alert = '0' WHERE user_id = " . $user->data['user_id'];
9d4fc0e @GabrielAnca Features added:
GabrielAnca authored Jan 16, 2010
70 $db->sql_query($sql);
71 }
72
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
73 // Code for getting data
74 if($action == 'read')
75 {
76 // Stop guest from reading the shoutbox if they aren't allowed
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
77 if (($config['shout_allow_guest'] == 0) && !$user->data['session_logged_in'])
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
78 {
79 pseudo_die(SHOUTBOX_NO_ERROR, $lang['Shoutbox_no_auth']);
80 }
81
82 // Update session data and online list
83 if(isset($_POST['su']))
84 {
85 update_session($error_msg);
33fd3fa @MightyGorgon Features added:
authored Nov 29, 2009
86
87 // Only get session data if the user was online SESSION_REFRESH seconds ago
88 $time_ago = time() - SESSION_REFRESH;
89
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
90 // Read session data for update
841b23a @MightyGorgon New beta candidate... with many many changes and new features respect…
authored Jan 31, 2009
91 $sql = "SELECT u.user_id, u.username, u.user_active, u.user_color, u.user_level
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
92 FROM " . AJAX_SHOUTBOX_SESSIONS_TABLE . " s, " . USERS_TABLE . " u
33fd3fa @MightyGorgon Features added:
authored Nov 29, 2009
93 WHERE s.session_time >= " . $time_ago . "
841b23a @MightyGorgon New beta candidate... with many many changes and new features respect…
authored Jan 31, 2009
94 AND s.session_user_id = u.user_id
95 ORDER BY case u.user_level when 0 then 10 else u.user_level end";
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
96 $result = $db->sql_query($sql);
97
98 // Set all counters to 0
99 $reg_online_counter = $guest_online_counter = $online_counter = 0;
100 while($online = $db->sql_fetchrow($result))
101 {
102 if($online['user_id'] != ANONYMOUS)
103 {
841b23a @MightyGorgon New beta candidate... with many many changes and new features respect…
authored Jan 31, 2009
104 $style_color = colorize_username($online['user_id'], $online['username'], $online['user_color'], $online['user_active'], false, true);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
105 $template->assign_block_vars('online_list', array(
106 'USER' => $online['username'],
107 'USER_ID' => $online['user_id'],
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
108 'LINK' => append_sid(CMS_PAGE_PROFILE . '?mode=viewprofile&amp;' . POST_USERS_URL . '=' . $online['user_id']),
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
109 'LINK_STYLE' => $style_color,
110 )
111 );
112 $reg_online_counter++;
113 }
114 else
115 {
116 $guest_online_counter++;
117 }
118 $online_counter++;
119 }
120
121 $template->assign_block_vars('online_stats', array(
122 'TOTAL' => $online_counter,
123 'GUESTS' => $guest_online_counter++,
124 'REG' => $reg_online_counter
125 )
126 );
127 }
128
129 // If the request does not provide the id of the last know message the id is set to 0
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored Mar 20, 2010
130 $lastID = request_var('lastID', 0);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
131
841b23a @MightyGorgon New beta candidate... with many many changes and new features respect…
authored Jan 31, 2009
132 $limit_sql = '';
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
133 // Check if there is a limit else, show all shouts
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
134 if($config['display_shouts'] > 0)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
135 {
136 // Gets a limited number of entries
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
137 $limit_sql = " LIMIT " . $config['display_shouts'];
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
138 }
841b23a @MightyGorgon New beta candidate... with many many changes and new features respect…
authored Jan 31, 2009
139
ac3e610 @MightyGorgon Added AJAX Private Chat
authored Nov 28, 2009
140 $sql = "SELECT s.*, u.username, u.user_active, u.user_color
141 FROM " . AJAX_SHOUTBOX_TABLE . " s, " . USERS_TABLE . " u
142 WHERE s.shout_id > " . $lastID . "
143 AND s.user_id = u.user_id
144 AND " . $chat_room_sql . "
145 ORDER BY s.shout_id DESC" . $limit_sql;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
146 $results = $db->sql_query($sql);
147 $row = $db->sql_fetchrowset($results);
148
149 if(!(empty($row)))
150 {
151 $row = array_reverse($row);
152 }
153 else
154 {
155 // This is just to know that there are no shouts in the database but it's not an error
156 pseudo_die(SHOUTBOX_NO_ERROR, $lang['Shoutbox_empty']);
157 }
158
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
159 for($x = 0; $x < sizeof($row); $x++)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
160 {
161 $id = $row[$x]['shout_id'];
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
162 //$time = utf8_encode(create_date($config['default_dateformat'], $row[$x]['shout_time'], $config['board_timezone']));
163 $time = utf8_encode(create_date('Y/m/d - H.i.s', $row[$x]['shout_time'], $config['board_timezone']));
164 //$time = utf8_encode(gmdate('Y/m/d - H.i.s', $row[$x]['shout_time']));
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
165
166 if ($row[$x]['user_id'] == ANONYMOUS)
167 {
168 $shouter = utf8_encode($row[$x]['shouter_name']);
169 $shouter_link = -1;
170 }
171 else
172 {
173 $shouter = utf8_encode($row[$x]['username']);
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
174 $shouter_link = append_sid(CMS_PAGE_PROFILE . '?mode=viewprofile&amp;u=' . $row[$x]['user_id']);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
175 }
176
841b23a @MightyGorgon New beta candidate... with many many changes and new features respect…
authored Jan 31, 2009
177 $shouter_color = colorize_username($row[$x]['user_id'], $row[$x]['username'], $row[$x]['user_color'], $row[$x]['user_active'], false, true);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
178 /*
841b23a @MightyGorgon New beta candidate... with many many changes and new features respect…
authored Jan 31, 2009
179 $shouter = colorize_username($row[$x]['user_id'], $row[$x]['username'], $row[$x]['user_color'], $row[$x]['user_active']);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
180 $shouter = preg_replace(array('<', '>'), array('mg_tag_open', 'mg_tag_close'), $shouter);
181 $shouter_link = '-1';
182 */
183
184 //$message = stripslashes($row[$x]['shout_text']);
185 //$message = utf8_encode($row[$x]['shout_text']);
186 $message = $row[$x]['shout_text'];
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
187 $message = censor_text($message);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
188
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
189 //$bbcode->allow_html = ($user->data['user_allowhtml'] && $config['allow_html']) ? true : false;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
190 // Forced HTML to false to avoid problems
191 $bbcode->allow_html = false;
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
192 $bbcode->allow_bbcode = ($user->data['user_allowbbcode'] && $config['allow_bbcode']) ? true : false;
193 $bbcode->allow_smilies = ($user->data['user_allowsmile'] && $config['allow_smilies']) ? true : false;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
194 /*
195 $bbcode->allow_html = true;
196 $bbcode->allow_bbcode = true;
197 $bbcode->allow_smilies = true;
198 */
f0d7f4b @MightyGorgon Big commit with many changes.
authored Sep 28, 2008
199 $message = $bbcode->parse($message);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
200
201 //$message = preg_replace(array('<', '>'), array('mg_tag_open', 'mg_tag_close'), $message);
202
203 $template->assign_block_vars('shouts', array(
204 'ID' => $id,
205 'SHOUTER' => $shouter,
33fd3fa @MightyGorgon Features added:
authored Nov 29, 2009
206 'SHOUTER_ID' => $row[$x]['user_id'],
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
207 'SHOUTER_COLOR' => $shouter_color,
208 'SHOUTER_LINK' => $shouter_link,
209 'MESSAGE' => $message,
210 'DATE' => $time
211 )
212 );
213 }
214 }
215 // Code for sending data
216 elseif ($action == 'add')
217 {
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored Mar 20, 2010
218 $shouter = request_var('nm', '', true);
219 $shouter = htmlspecialchars_decode($shouter, ENT_COMPAT);
220 $message = request_var('co', '', true);
221 $message = htmlspecialchars_decode($message, ENT_COMPAT);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
222 $shout_time = time();
223
224 // Flood Control
ac3e610 @MightyGorgon Added AJAX Private Chat
authored Nov 28, 2009
225 $sql = "SELECT MAX(s.shout_time) AS last_shout
226 FROM " . AJAX_SHOUTBOX_TABLE . " s
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
227 WHERE s.shouter_ip = '" . $db->sql_escape($user_ip) . "'";
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
228 $db->sql_return_on_error(true);
229 $result = $db->sql_query($sql);
230 $db->sql_return_on_error(false);
231 if ($result)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
232 {
233 if ($row = $db->sql_fetchrow($result))
234 {
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
235 if (($shout_time - intval($row['last_shout'])) < $config['shoutbox_floodinterval'])
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
236 {
237 // Display error
238 $error = AJAX_SHOUTBOX_ERROR;
239 pseudo_die(SHOUTBOX_ERROR, $lang['Shoutbox_flooderror']);
240 }
241 }
242 }
243
9d4fc0e @GabrielAnca Features added:
GabrielAnca authored Jan 16, 2010
244 // Alert other users that somebody is willing to chat with them
245 if ($private_chat)
246 {
247 // It omits users that have been active for the last 5 minutes (300 seconds)
248 $sql = "SELECT session_user_id
249 FROM " . AJAX_SHOUTBOX_SESSIONS_TABLE . "
250 WHERE " . $db->sql_in_set('session_user_id', $chat_room_users) . "
251 AND session_time < " . (time() - 300) . "
252 ORDER BY session_user_id ASC";
253 $result = $db->sql_query($sql);
254 $row = $db->sql_fetchrowset($result);
255 $db->sql_freeresult($result);
256
257 $alert_users_array = array();
258 foreach ($chat_room_users as $chat_room_user)
259 {
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
260 if (($chat_room_user != $user->data['user_id']) && !in_array($chat_room_user, $row))
9d4fc0e @GabrielAnca Features added:
GabrielAnca authored Jan 16, 2010
261 {
262 $alert_users_array[] = $chat_room_user;
263 }
264 }
265
5565b14 @GabrielAnca Some fixes:
GabrielAnca authored Jan 17, 2010
266 if (sizeof($alert_users_array) > 0)
267 {
268 $sql = "UPDATE " . USERS_TABLE . " SET user_private_chat_alert = '" . $chat_room . "' WHERE " . $db->sql_in_set('user_id', $alert_users_array);
269 $db->sql_query($sql);
270 }
9d4fc0e @GabrielAnca Features added:
GabrielAnca authored Jan 16, 2010
271 }
272
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
273 // Some weird conversion of the data inputed
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
274 if($user->data['session_logged_in'])
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
275 {
276 $shouter = '';
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
277 //$shouter = colorize_username($user->data['user_id'], $user->data['username'], $user->data['user_color'], $user->data['user_active']);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
278 }
279 else
280 {
281 // Stop guest shouts if they are not allowed
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
282 if ($config['shout_allow_guest'] != 1)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
283 {
284 pseudo_die(SHOUTBOX_ERROR, $lang['Shoutbox_no_auth']);
285 }
286
287 if ($shouter == '')
288 {
289 $shouter = $lang['Guest'];
290 }
291 else
292 {
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored Mar 20, 2010
293 $shouter = strip_tags($shouter);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
294
295 // The name is shortened to 30 letters
296 $shouter = substr($shouter, 0, 30);
297
298 // Check the username
06ce0f8 @MightyGorgon Brand new version...
authored Sep 14, 2008
299 include_once(IP_ROOT_PATH . 'includes/functions_validate.' . PHP_EXT);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
300 $check_name = validate_username($shouter);
301 // Username is invalid so tell the user and die
302 if ($check_name['error'])
303 {
304 $error = AJAX_SHOUTBOX_ERROR;
305 pseudo_die(SHOUTBOX_ERROR, $check_name['error_msg']);
306 }
307 }
308 }
309
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored Mar 20, 2010
310 $message = strip_tags($message);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
311
312 // we don't want users shouting images so we take them out before parsing the bbcodes
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
313 //$message = @ereg_replace("\\[img\\]([^\[]*)\\[/img\\]", '', $message);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
314
315 /*
316 // The message is cut of after 500 letters
317 if (strlen($message) > 500)
318 {
319 $message = substr($message, 0, 500);
320 }
321 */
322
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
323 //$bbcode->allow_html = ($user->data['user_allowhtml'] && $config['allow_html']) ? true : false;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
324 // Forced HTML to false to avoid problems
325 $bbcode->allow_html = false;
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
326 $bbcode->allow_bbcode = ($user->data['user_allowbbcode'] && $config['allow_bbcode']) ? true : false;
327 $bbcode->allow_smilies = ($user->data['user_allowsmile'] && $config['allow_smilies']) ? true : false;
f0d7f4b @MightyGorgon Big commit with many changes.
authored Sep 28, 2008
328 //$message = addslashes($bbcode->parse($message));
329 $message = $bbcode->parse($message);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
330 $message = str_replace('http://', 'http:_/_/', $message);
331 $message = str_replace('www.', 'http:_/_/www.', $message);
332 $message = str_replace('http:_/_/http:_/_/', 'http:_/_/', $message);
333
334 // Only if a name and a message have been provides the information is added to the db
335 if ($message != '')
336 {
337 // Add new data
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
338 $sql = "INSERT INTO " . AJAX_SHOUTBOX_TABLE . " (user_id, shouter_name, shout_text, shouter_ip, shout_time, shout_room) VALUES (" . $user->data['user_id'] . ", '" . $db->sql_escape($shouter) . "', '" . $db->sql_escape($message) . "', '" . $db->sql_escape($user_ip) . "', " . $shout_time . ", '" . $chat_room . "')";
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
339
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
340 $db->sql_return_on_error(true);
341 $result = $db->sql_query($sql);
342 $db->sql_return_on_error(false);
343 if (!$result)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
344 {
345 /*
346 $error = AJAX_SHOUTBOX_ERROR;
347 $error_msg = $lang['Shoutbox_unable'];
348 $template->pparse('xml');
349 */
350 pseudo_die(SHOUTBOX_ERROR, $lang['Shoutbox_unable']);
351 }
352
353 // Only do this if there is a limit.
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
354 if($config['stored_shouts'] > 1)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
355 {
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
356 $limit = $config['stored_shouts'] - 1;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
357 // Keep the database with the selected number of entrys.
ac3e610 @MightyGorgon Added AJAX Private Chat
authored Nov 28, 2009
358 $sql = "SELECT s.shout_id
359 FROM " . AJAX_SHOUTBOX_TABLE . " s
360 AND " . $chat_room_sql . "
361 ORDER BY s.shout_id DESC
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
362 LIMIT " . $limit . ", 1";
363 $results = $db->sql_query($sql);
364 $row = $db->sql_fetchrowset($results);
365 $id = $row[0]['shout_id'];
366
367 if ($id)
368 {
369 // Delete all message prior to a certain id
ac3e610 @MightyGorgon Added AJAX Private Chat
authored Nov 28, 2009
370 $sql = "DELETE FROM " . AJAX_SHOUTBOX_TABLE . " WHERE shout_id < " . $id;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
371 $results = $db->sql_query($sql);
372 }
373 }
374 }
375 else
376 {
377 $error = AJAX_SHOUTBOX_ERROR;
378 $error_msg = $lang['Empty_message'];
379 }
380 }
381 // Code for Deleting Data
382 elseif ($action == 'del')
383 {
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
384 if(($user->data['user_level'] == ADMIN) && ($user->data['session_logged_in']))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
385 {
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored Mar 20, 2010
386 $shout_id = request_var('sh', 0);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
387
ac3e610 @MightyGorgon Added AJAX Private Chat
authored Nov 28, 2009
388 $sql = 'DELETE FROM ' . AJAX_SHOUTBOX_TABLE . ' WHERE shout_id =' . $shout_id;
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
389 $db->sql_return_on_error(true);
390 $result = $db->sql_query($sql);
391 $db->sql_return_on_error(false);
392 if (!$result)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
393 {
394 $error = AJAX_SHOUTBOX_ERROR;
395 $error_msg = $lang['Shoutbox_unable'];
396 }
397 }
398 }
399 pseudo_die($error, $error_msg);
400 }
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
401 if (!$shoutbox_template_parse)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
402 {
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
403 // Load templates
404 $template->set_filenames(array('shoutbox' => 'ajax_shoutbox_body.tpl'));
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
405 }
406
407 // Use special dimensions to the else use default.
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored Mar 20, 2010
408 $shoutbox_width = request_var('width', 710);
409 $shoutbox_height = request_var('height', 350);
410 if(($shoutbox_width <= 0) || ($shoutbox_height <= 0))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
411 {
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored Mar 20, 2010
412 $shoutbox_width = 710;
413 $shoutbox_height = 350;
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
414 }
415
416 /* Results need a fixed width a height for the overflow. */
417 $shoutbox_div_width = (95 / 100) * $shoutbox_width;
418 $shoutbox_div_height = (85 / 100) * $shoutbox_height;
419
420 $shoutbox_table_width = $shoutbox_div_width - 30;
421 $shoutbox_table_height = $shoutbox_div_height - 25;
422
423 $template->assign_vars(array(
424 'L_SHOUTBOX' => $lang['Ajax_Shoutbox'],
425 'L_USERNAME' => $lang['Username'],
426 'L_MESSAGE' => $lang['Message'],
427 'L_DELETE' => $lang['Delete'],
428 'L_CONFIRM' => $lang['Confirm_delete_pm'],
429 'L_SUMBIT' => $lang['Submit'],
430 'L_ARCHIVE' => $lang['Ajax_Archive'],
431 'L_UNABLE' => $lang['Shoutbox_unable'],
9dea0d4 @MightyGorgon New Icy Phoenix structure.
authored Oct 30, 2008
432 'L_WIO' => $lang['Who_is_Chatting'],
433 'L_GUESTS' => $lang['Online_guests'],
434 'L_TOTAL' => $lang['Online_total'],
435 'L_USERS' => $lang['Online_registered'],
436 'L_TOP_SHOUTERS' => $lang['Top_Ten_Shouters'],
437 'L_SHOUTBOX_ONLINE_EXPLAIN' => $lang['Shoutbox_online_explain'],
66e9f8e @MightyGorgon Some fixes on the whole package, plus new features and fixes by Infor…
authored Apr 17, 2011
438 'U_ARCHIVE' => append_sid(CMS_PAGE_AJAX_CHAT . '?mode=archive')
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
439 )
440 );
441
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
442 if($config['shout_allow_guest'] > 0)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
443 {
444 // Guest and Users may see the shoutbox
445 $template->assign_block_vars('view_shoutbox', array(
446 'BOX_WIDTH' => $shoutbox_width,
447 'BOX_HEIGHT' => $shoutbox_height,
448 'DIV_WIDTH' => $shoutbox_div_width,
449 'DIV_HEIGHT' => $shoutbox_div_height,
450 'TABLE_WIDTH' => $shoutbox_table_width,
451 'TABLE_HEIGHT' => $shoutbox_table_height,
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
452 'REFRESH_TIME' => $config['shoutbox_refreshtime'],
ac3e610 @MightyGorgon Added AJAX Private Chat
authored Nov 28, 2009
453 'CHAT_ROOM' => $chat_room,
06ce0f8 @MightyGorgon Brand new version...
authored Sep 14, 2008
454 'U_ACTION' => append_sid(IP_ROOT_PATH . 'ajax_shoutbox.' . PHP_EXT)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
455 )
456 );
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
457 if($config['shout_allow_guest'] == 1)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
458 {
459 // Guest and users may shout.
460 $template->assign_block_vars('view_shoutbox.shout_allowed', array());
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
461 if(!($user->data['session_logged_in']))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
462 {
463 // Only guests need to enter a username
464 $template->assign_block_vars('view_shoutbox.shout_allowed.guest_shouter', array());
465 }
466 }
467 else
468 {
469 // Only registered users may shout.
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
470 if($user->data['session_logged_in'])
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
471 {
472 $template->assign_block_vars('view_shoutbox.shout_allowed', array());
473 }
474 }
475 }
476 else
477 {
478 // Only registered users may see/shout
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
479 if($user->data['session_logged_in'])
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
480 {
481 $template->assign_block_vars('view_shoutbox', array(
482 'BOX_WIDTH' => $shoutbox_width,
483 'BOX_HEIGHT' => $shoutbox_height,
484 'DIV_WIDTH' => $shoutbox_div_width,
485 'DIV_HEIGHT' => $shoutbox_div_height,
486 'TABLE_WIDTH' => $shoutbox_table_width,
487 'TABLE_HEIGHT' => $shoutbox_table_height,
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
488 'REFRESH_TIME' => $config['shoutbox_refreshtime'],
ac3e610 @MightyGorgon Added AJAX Private Chat
authored Nov 28, 2009
489 'CHAT_ROOM' => $chat_room,
06ce0f8 @MightyGorgon Brand new version...
authored Sep 14, 2008
490 'U_ACTION' => append_sid(IP_ROOT_PATH . 'ajax_shoutbox.' . PHP_EXT)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
491 )
492 );
493 $template->assign_block_vars('view_shoutbox.shout_allowed', array());
494 }
495 else
496 {
497 //message_die(GENERAL_MESSAGE, $lang['Shoutbox_no_auth']);
498 pseudo_die(GENERAL_MESSAGE, $lang['Shoutbox_no_auth']);
499 }
500 }
501
502 $template->assign_block_vars('view_shoutbox.onload', array());
503
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored Mar 31, 2011
504 if($user->data['user_level'] == ADMIN)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
505 {
506 $template->assign_block_vars('view_shoutbox.user_is_admin', array());
507 }
508
509 // BBCBMG - BEGIN
9381fee @MightyGorgon Other bugs fix for RC version
authored Apr 1, 2009
510 define('BBCB_MG_SMALL', true);
511 include_once(IP_ROOT_PATH . 'includes/bbcb_mg.' . PHP_EXT);
512 $template->assign_vars(array(
513 'BBCB_FORM_NAME' => 'chatForm',
514 'BBCB_TEXT_NAME' => 'chatbarText',
515 )
516 );
517 $template->assign_var_from_handle('BBCB_MG_SMALL', 'bbcb_mg');
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
518 // BBCBMG - END
519
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
520 if ($shoutbox_template_parse)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
521 {
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
522 // We're Out of PhpBB so call the Simple header and parser
523 $gen_simple_header = true;
2405be5 @MightyGorgon Recoded some parts of the new Plugins section
authored Dec 1, 2009
524 $template->assign_var('S_POPUP', true);
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored Oct 26, 2009
525 full_page_generation('ajax_shoutbox_body.tpl', $lang['Ajax_Chat'], '', '');
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored Aug 26, 2008
526 }
527 else
528 {
529 $template->assign_var_from_handle('SHOUTBOX_BODY', 'shoutbox');
530 }
531
532 ?>
Something went wrong with that request. Please try again.