fluxbb-1.4-beta2 to fluxbb-1.4-rc1 Legend
Lines removed 
Lines changed
 Lines added

a/upload/admin_bans.php b/upload/admin_bans.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the admin template 11: // Tell header.php to use the admin template
 27: define('PUN_ADMIN_CONSOLE', 1); 12: define('PUN_ADMIN_CONSOLE', 1);
 39: { 24: {
 40:     if (isset($_GET['add_ban']) || isset($_POST['add_ban'])) 25:     if (isset($_GET['add_ban']) || isset($_POST['add_ban']))
 41:     { 26:     {
 42:         // If the id of the user to ban was provided through GET (a link from profile.php) 27:         // If the ID of the user to ban was provided through GET (a link from profile.php)
 43:         if (isset($_GET['add_ban'])) 28:         if (isset($_GET['add_ban']))
 44:         { 29:         {
 45:             $add_ban = intval($_GET['add_ban']); 30:             $add_ban = intval($_GET['add_ban']);
 54:             else 39:             else
 55:                 message('No user by that ID registered.'); 40:                 message('No user by that ID registered.');
 56:         } 41:         }
 57:         else    // Otherwise the username is in POST 42:         else // Otherwise the username is in POST
 58:         { 43:         {
 59:             $ban_user = trim($_POST['new_ban_user']); 44:             $ban_user = trim($_POST['new_ban_user']);
 60:  45: 
 81:  66: 
 82:         $mode = 'add'; 67:         $mode = 'add';
 83:     } 68:     }
 84:     else    // We are editing a ban 69:     else // We are editing a ban
 85:     { 70:     {
 86:         $ban_id = intval($_GET['edit_ban']); 71:         $ban_id = intval($_GET['edit_ban']);
 87:         if ($ban_id < 1) 72:         if ($ban_id < 1)
114:                 <input type="hidden" name="mode" value="<?php echo $mode ?>" /> 99:                 <input type="hidden" name="mode" value="<?php echo $mode ?>" />
115: <?php if ($mode == 'edit'): ?>                <input type="hidden" name="ban_id" value="<?php echo $ban_id ?>" />100: <?php if ($mode == 'edit'): ?>                <input type="hidden" name="ban_id" value="<?php echo $ban_id ?>" />
116: <?php endif; ?>                <fieldset>101: <?php endif; ?>                <fieldset>
117:                         <legend>Supplement ban with IP and e-mail</legend>102:                         <legend>Supplement ban with IP and email</legend>
118:                         <div class="infldset">103:                         <div class="infldset">
119:                             <table class="aligntop" cellspacing="0">104:                             <table class="aligntop" cellspacing="0">
120:                                 <tr>105:                                 <tr>
125:                                     </td>110:                                     </td>
126:                                 </tr>111:                                 </tr>
127:                                 <tr>112:                                 <tr>
128:                                     <th scope="row">IP-adresses</th>113:                                     <th scope="row">IP-addresses</th>
129:                                     <td>114:                                     <td>
130:                                         <input type="text" name="ban_ip" size="45" maxlength="255" value="<?php if (isset($ban_ip)) echo $ban_ip; ?>" tabindex="2" />115:                                         <input type="text" name="ban_ip" size="45" maxlength="255" value="<?php if (isset($ban_ip)) echo $ban_ip; ?>" tabindex="2" />
131:                                         <span>The IP or IP-ranges you wish to ban (e.g. 150.11.110.1 or 150.11.110). Separate addresses with spaces. If an IP is entered already it is the last known IP of this user in the database.<?php if ($ban_user != '' && isset($user_id)) echo ' Click <a href="admin_users.php?ip_stats='.$user_id.'">here</a> to see IP statistics for this user.' ?></span>116:                                         <span>The IP or IP-ranges you wish to ban (e.g. 150.11.110.1 or 150.11.110). Separate addresses with spaces. If an IP is entered already it is the last known IP of this user in the database.<?php if ($ban_user != '' && isset($user_id)) echo ' Click <a href="admin_users.php?ip_stats='.$user_id.'">here</a> to see IP statistics for this user.' ?></span>
132:                                     </td>117:                                     </td>
133:                                 </tr>118:                                 </tr>
134:                                 <tr>119:                                 <tr>
135:                                     <th scope="row">E-mail/domain</th>120:                                     <th scope="row">Email/domain</th>
136:                                     <td>121:                                     <td>
137:                                         <input type="text" name="ban_email" size="40" maxlength="50" value="<?php if (isset($ban_email)) echo strtolower($ban_email); ?>" tabindex="3" />122:                                         <input type="text" name="ban_email" size="40" maxlength="50" value="<?php if (isset($ban_email)) echo strtolower($ban_email); ?>" tabindex="3" />
138:                                         <span>The e-mail or e-mail domain you wish to ban (e.g. someone@somewhere.com or somewhere.com). See "Allow banned e-mail addresses" in Permissions for more info.</span>123:                                         <span>The email or email domain you wish to ban (e.g. someone@somewhere.com or somewhere.com). See "Allow banned email addresses" in Permissions for more info.</span>
139:                                     </td>124:                                     </td>
140:                                 </tr>125:                                 </tr>
141:                             </table>126:                             </table>
190:     $ban_expire = trim($_POST['ban_expire']);175:     $ban_expire = trim($_POST['ban_expire']);
191: 176: 
192:     if ($ban_user == '' && $ban_ip == '' && $ban_email == '')177:     if ($ban_user == '' && $ban_ip == '' && $ban_email == '')
193:         message('You must enter either a username, an IP address or an e-mail address (at least).');178:         message('You must enter either a username, an IP address or an email address (at least).');
194:     else if (strtolower($ban_user) == 'guest')179:     else if (strtolower($ban_user) == 'guest')
195:         message('The guest user cannot be banned.');180:         message('The guest user cannot be banned.');
196: 181: 
199:     {184:     {
200:         $ban_ip = preg_replace('/[\s]{2,}/', ' ', $ban_ip);185:         $ban_ip = preg_replace('/[\s]{2,}/', ' ', $ban_ip);
201:         $addresses = explode(' ', $ban_ip);186:         $addresses = explode(' ', $ban_ip);
202:         $addresses = array_map('trim', $addresses);187:         $addresses = array_map('pun_trim', $addresses);
203: 188: 
204:         for ($i = 0; $i < count($addresses); ++$i)189:         for ($i = 0; $i < count($addresses); ++$i)
205:         {190:         {
206:             if (strpos($addresses[$i], ':') !== false) 191:             if (strpos($addresses[$i], ':') !== false)
207:             {192:             {
208:                 $octets = explode(':', $addresses[$i]);193:                 $octets = explode(':', $addresses[$i]);
209: 194: 
242:     if ($ban_email != '' && !is_valid_email($ban_email))227:     if ($ban_email != '' && !is_valid_email($ban_email))
243:     {228:     {
244:         if (!preg_match('/^[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/', $ban_email))229:         if (!preg_match('/^[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/', $ban_email))
245:             message('The e-mail address (e.g. user@domain.com) or partial e-mail address domain (e.g. domain.com) you entered is invalid.');230:             message('The email address (e.g. user@domain.com) or partial email address domain (e.g. domain.com) you entered is invalid.');
246:     }231:     }
247: 232: 
248:     if ($ban_expire != '' && $ban_expire != 'Never')233:     if ($ban_expire != '' && $ban_expire != 'Never')
316:                                     <th scope="row">Username<div><input type="submit" name="add_ban" value=" Add " tabindex="2" /></div></th>301:                                     <th scope="row">Username<div><input type="submit" name="add_ban" value=" Add " tabindex="2" /></div></th>
317:                                     <td>302:                                     <td>
318:                                         <input type="text" name="new_ban_user" size="25" maxlength="25" tabindex="1" />303:                                         <input type="text" name="new_ban_user" size="25" maxlength="25" tabindex="1" />
319:                                         <span>The username to ban (case insensitive). The next page will let you enter a custom IP and e-mail. If you just want to ban a specific IP/IP-range or e-mail just leave it blank.</span>304:                                         <span>The username to ban (case-insensitive). The next page will let you enter a custom IP and email. If you just want to ban a specific IP/IP-range or email just leave it blank.</span>
320:                                     </td>305:                                     </td>
321:                                 </tr>306:                                 </tr>
322:                             </table>307:                             </table>
349:                                     <td><?php echo pun_htmlspecialchars($cur_ban['username']) ?></td>334:                                     <td><?php echo pun_htmlspecialchars($cur_ban['username']) ?></td>
350:                                 </tr>335:                                 </tr>
351: <?php endif; ?><?php if ($cur_ban['email'] != ''): ?>                                <tr>336: <?php endif; ?><?php if ($cur_ban['email'] != ''): ?>                                <tr>
352:                                     <th>E-mail</th>337:                                     <th>Email</th>
353:                                     <td><?php echo $cur_ban['email'] ?></td>338:                                     <td><?php echo $cur_ban['email'] ?></td>
354:                                 </tr>339:                                 </tr>
355: <?php endif; ?><?php if ($cur_ban['ip'] != ''): ?>                                <tr>340: <?php endif; ?><?php if ($cur_ban['ip'] != ''): ?>                                <tr>


a/upload/admin_categories.php b/upload/admin_categories.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the admin template 11: // Tell header.php to use the admin template
 27: define('PUN_ADMIN_CONSOLE', 1); 12: define('PUN_ADMIN_CONSOLE', 1);
 59:     if ($cat_to_delete < 1) 44:     if ($cat_to_delete < 1)
 60:         message($lang_common['Bad request']); 45:         message($lang_common['Bad request']);
 61:  46: 
 62:     if (isset($_POST['del_cat_comply']))    // Delete a category with all forums and posts 47:     if (isset($_POST['del_cat_comply'])) // Delete a category with all forums and posts
 63:     { 48:     {
 64:         @set_time_limit(0); 49:         @set_time_limit(0);
 65:  50: 
 92:         // Delete the category 77:         // Delete the category
 93:         $db->query('DELETE FROM '.$db->prefix.'categories WHERE id='.$cat_to_delete) or error('Unable to delete category', __FILE__, __LINE__, $db->error()); 78:         $db->query('DELETE FROM '.$db->prefix.'categories WHERE id='.$cat_to_delete) or error('Unable to delete category', __FILE__, __LINE__, $db->error());
 94:  79: 
 95:         // Regenerate the quickjump cache 80:         // Regenerate the quick jump cache
 96:         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 81:         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
 97:             require PUN_ROOT.'include/cache.php'; 82:             require PUN_ROOT.'include/cache.php';
 98:  83: 
100:  85: 
101:         redirect('admin_categories.php', 'Category deleted. Redirecting &hellip;'); 86:         redirect('admin_categories.php', 'Category deleted. Redirecting &hellip;');
102:     } 87:     }
103:     else    // If the user hasn't comfirmed the delete 88:     else // If the user hasn't comfirmed the delete
104:     { 89:     {
105:         $result = $db->query('SELECT cat_name FROM '.$db->prefix.'categories WHERE id='.$cat_to_delete) or error('Unable to fetch category info', __FILE__, __LINE__, $db->error()); 90:         $result = $db->query('SELECT cat_name FROM '.$db->prefix.'categories WHERE id='.$cat_to_delete) or error('Unable to fetch category info', __FILE__, __LINE__, $db->error());
106:         $cat_name = $db->result($result); 91:         $cat_name = $db->result($result);
138: }123: }
139: 124: 
140: 125: 
141: else if (isset($_POST['update']))    // Change position and name of the categories126: else if (isset($_POST['update'])) // Change position and name of the categories
142: {127: {
143:     confirm_referrer('admin_categories.php');128:     confirm_referrer('admin_categories.php');
144: 129: 
161:         $db->query('UPDATE '.$db->prefix.'categories SET cat_name=\''.$db->escape($cat_name[$i]).'\', disp_position='.$cat_order[$i].' WHERE id='.$cat_id) or error('Unable to update category', __FILE__, __LINE__, $db->error());146:         $db->query('UPDATE '.$db->prefix.'categories SET cat_name=\''.$db->escape($cat_name[$i]).'\', disp_position='.$cat_order[$i].' WHERE id='.$cat_id) or error('Unable to update category', __FILE__, __LINE__, $db->error());
162:     }147:     }
163: 148: 
164:     // Regenerate the quickjump cache149:     // Regenerate the quick jump cache
165:     if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))150:     if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
166:         require PUN_ROOT.'include/cache.php';151:         require PUN_ROOT.'include/cache.php';
167: 152: 
186: 171: 
187: ?>172: ?>
188:     <div class="blockform">173:     <div class="blockform">
189:         <h2><span>Add/remove/edit categories</span></h2>174:         <h2><span>Add categories</span></h2>
190:         <div class="box">175:         <div class="box">
191:         <form method="post" action="admin_categories.php?action=foo">176:         <form method="post" action="admin_categories.php?action=foo">
192:             <div class="inform">177:             <div class="inform">
193:                 <fieldset>178:                 <fieldset>
194:                     <legend>Add/delete categories</legend>179:                     <legend>Add categories</legend>
195:                     <div class="infldset">180:                     <div class="infldset">
196:                         <table class="aligntop" cellspacing="0">181:                         <table class="aligntop" cellspacing="0">
197:                             <tr>182:                             <tr>
201:                                     <span>The name of the new category you want to add. You can edit the name of the category later (see below). Go to <a href="admin_forums.php">Forums</a> to add forums to your new category.</span>186:                                     <span>The name of the new category you want to add. You can edit the name of the category later (see below). Go to <a href="admin_forums.php">Forums</a> to add forums to your new category.</span>
202:                                 </td>187:                                 </td>
203:                             </tr>188:                             </tr>
204: <?php if ($num_cats): ?>                            <tr>189:                         </table>
 190:                     </div>
 191:                 </fieldset>
 192:             </div>
 193:         </form>
 194:         </div>
 195: 
 196: <?php if ($num_cats): ?>        <h2 class="block2"><span>Remove categories</span></h2>
 197:         <div class="box">
 198:         <form method="post" action="admin_categories.php?action=foo">
 199:             <div class="inform">
 200:                 <fieldset>
 201:                     <legend>Delete categories</legend>
 202:                     <div class="infldset">
 203:                         <table class="aligntop" cellspacing="0">
 204:                             <tr>
205:                                 <th scope="row">Delete a category<div><input type="submit" name="del_cat" value="Delete" tabindex="4" /></div></th>205:                                 <th scope="row">Delete a category<div><input type="submit" name="del_cat" value="Delete" tabindex="4" /></div></th>
206:                                 <td>206:                                 <td>
207:                                     <select name="cat_to_delete" tabindex="3">207:                                     <select name="cat_to_delete" tabindex="3">
215:                                     <span>Select the name of the category you want to delete. You will be asked to confirm your choice of category for deletion before it is deleted.</span>215:                                     <span>Select the name of the category you want to delete. You will be asked to confirm your choice of category for deletion before it is deleted.</span>
216:                                 </td>216:                                 </td>
217:                             </tr>217:                             </tr>
218: <?php endif; ?>                        </table>218:                         </table>
219:                     </div>219:                     </div>
220:                 </fieldset>220:                 </fieldset>
221:             </div>221:             </div>
222: <?php if ($num_cats): ?>            <div class="inform">222:         </form>
 223:         </div>
 224: <?php endif; ?>
 225: 
 226: <?php if ($num_cats): ?>        <h2 class="block2"><span>Edit categories</span></h2>
 227:         <div class="box">
 228:         <form method="post" action="admin_categories.php?action=foo">
 229:             <div class="inform">
223:                 <fieldset>230:                 <fieldset>
224:                     <legend>Edit categories</legend>231:                     <legend>Edit categories</legend>
225:                     <div class="infldset">232:                     <div class="infldset">
252:                     </div>259:                     </div>
253:                 </fieldset>260:                 </fieldset>
254:             </div>261:             </div>
255: <?php endif; ?>        </form>262:         </form>
256:         </div>263:         </div>
257:     </div>264: <?php endif; ?>    </div>
258:     <div class="clearer"></div>265:     <div class="clearer"></div>
259: </div>266: </div>
260: <?php267: <?php


a/upload/admin_censoring.php b/upload/admin_censoring.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the admin template 11: // Tell header.php to use the admin template
 27: define('PUN_ADMIN_CONSOLE', 1); 12: define('PUN_ADMIN_CONSOLE', 1);
 99:                     <fieldset> 84:                     <fieldset>
100:                         <legend>Add word</legend> 85:                         <legend>Add word</legend>
101:                         <div class="infldset"> 86:                         <div class="infldset">
102:                             <p>Enter a word that you want to censor and the replacement text for this word. Wildcards are accepted (i.e. *some* would match somewhere and lonesome). Censor words also affect usernames. New users will not be able to register with usernames containing any censored words. The search is case insensitive. <strong>Censor words must be enabled in <a href="admin_options.php#censoring">Options</a> for this to have any effect.</strong></p> 87:                             <p>Enter a word that you want to censor and the replacement text for this word. Wildcards are accepted (i.e. *some* would match somewhere and lonesome). Censor words also affect usernames. New users will not be able to register with usernames containing any censored words. The search is case-insensitive. <strong>Censor words must be enabled in <a href="admin_options.php#censoring">Options</a> for this to have any effect.</strong></p>
103:                             <table  cellspacing="0"> 88:                             <table cellspacing="0">
104:                             <thead> 89:                             <thead>
105:                                 <tr> 90:                                 <tr>
106:                                     <th class="tcl" scope="col">Censored&nbsp;word</th> 91:                                     <th class="tcl" scope="col">Censored&nbsp;word</th>


a/upload/admin_forums.php b/upload/admin_forums.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the admin template 11: // Tell header.php to use the admin template
 27: define('PUN_ADMIN_CONSOLE', 1); 12: define('PUN_ADMIN_CONSOLE', 1);
 46:  31: 
 47:     $db->query('INSERT INTO '.$db->prefix.'forums (cat_id) VALUES('.$add_to_cat.')') or error('Unable to create forum', __FILE__, __LINE__, $db->error()); 32:     $db->query('INSERT INTO '.$db->prefix.'forums (cat_id) VALUES('.$add_to_cat.')') or error('Unable to create forum', __FILE__, __LINE__, $db->error());
 48:  33: 
 49:     // Regenerate the quickjump cache 34:     // Regenerate the quick jump cache
 50:     if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 35:     if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
 51:         require PUN_ROOT.'include/cache.php'; 36:         require PUN_ROOT.'include/cache.php';
 52:  37: 
 65:     if ($forum_id < 1) 50:     if ($forum_id < 1)
 66:         message($lang_common['Bad request']); 51:         message($lang_common['Bad request']);
 67:  52: 
 68:     if (isset($_POST['del_forum_comply']))    // Delete a forum with all posts 53:     if (isset($_POST['del_forum_comply'])) // Delete a forum with all posts
 69:     { 54:     {
 70:         @set_time_limit(0); 55:         @set_time_limit(0);
 71:  56: 
 88:         $db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to delete forum', __FILE__, __LINE__, $db->error()); 73:         $db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to delete forum', __FILE__, __LINE__, $db->error());
 89:         $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error()); 74:         $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());
 90:  75: 
 91:         // Regenerate the quickjump cache 76:         // Regenerate the quick jump cache
 92:         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 77:         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
 93:             require PUN_ROOT.'include/cache.php'; 78:             require PUN_ROOT.'include/cache.php';
 94:  79: 
147:         $db->query('UPDATE '.$db->prefix.'forums SET disp_position='.$disp_position.' WHERE id='.intval($forum_id)) or error('Unable to update forum', __FILE__, __LINE__, $db->error());132:         $db->query('UPDATE '.$db->prefix.'forums SET disp_position='.$disp_position.' WHERE id='.intval($forum_id)) or error('Unable to update forum', __FILE__, __LINE__, $db->error());
148:     }133:     }
149: 134: 
150:     // Regenerate the quickjump cache135:     // Regenerate the quick jump cache
151:     if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))136:     if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
152:         require PUN_ROOT.'include/cache.php';137:         require PUN_ROOT.'include/cache.php';
153: 138: 
213:             }198:             }
214:         }199:         }
215: 200: 
216:         // Regenerate the quickjump cache201:         // Regenerate the quick jump cache
217:         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))202:         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
218:             require PUN_ROOT.'include/cache.php';203:             require PUN_ROOT.'include/cache.php';
219: 204: 
227: 212: 
228:         $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());213:         $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());
229: 214: 
230:         // Regenerate the quickjump cache215:         // Regenerate the quick jump cache
231:         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))216:         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
232:             require PUN_ROOT.'include/cache.php';217:             require PUN_ROOT.'include/cache.php';
233: 218: 
328:         $post_replies = (($cur_perm['g_post_replies'] == '0' && $cur_perm['post_replies'] == '1') || ($cur_perm['g_post_replies'] == '1' && $cur_perm['post_replies'] != '0')) ? true : false;313:         $post_replies = (($cur_perm['g_post_replies'] == '0' && $cur_perm['post_replies'] == '1') || ($cur_perm['g_post_replies'] == '1' && $cur_perm['post_replies'] != '0')) ? true : false;
329:         $post_topics = (($cur_perm['g_post_topics'] == '0' && $cur_perm['post_topics'] == '1') || ($cur_perm['g_post_topics'] == '1' && $cur_perm['post_topics'] != '0')) ? true : false;314:         $post_topics = (($cur_perm['g_post_topics'] == '0' && $cur_perm['post_topics'] == '1') || ($cur_perm['g_post_topics'] == '1' && $cur_perm['post_topics'] != '0')) ? true : false;
330: 315: 
331:         // Determine if the current sittings differ from the default or not316:         // Determine if the current settings differ from the default or not
332:         $read_forum_def = ($cur_perm['read_forum'] == '0') ? false : true;317:         $read_forum_def = ($cur_perm['read_forum'] == '0') ? false : true;
333:         $post_replies_def = (($post_replies && $cur_perm['g_post_replies'] == '0') || (!$post_replies && ($cur_perm['g_post_replies'] == '' || $cur_perm['g_post_replies'] == '1'))) ? false : true;318:         $post_replies_def = (($post_replies && $cur_perm['g_post_replies'] == '0') || (!$post_replies && ($cur_perm['g_post_replies'] == '' || $cur_perm['g_post_replies'] == '1'))) ? false : true;
334:         $post_topics_def = (($post_topics && $cur_perm['g_post_topics'] == '0') || (!$post_topics && ($cur_perm['g_post_topics'] == '' || $cur_perm['g_post_topics'] == '1'))) ? false : true;319:         $post_topics_def = (($post_topics && $cur_perm['g_post_topics'] == '0') || (!$post_topics && ($cur_perm['g_post_topics'] == '' || $cur_perm['g_post_topics'] == '1'))) ? false : true;
434: $cur_category = 0;419: $cur_category = 0;
435: while ($cur_forum = $db->fetch_assoc($result))420: while ($cur_forum = $db->fetch_assoc($result))
436: {421: {
437:     if ($cur_forum['cid'] != $cur_category)    // A new category since last iteration?422:     if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
438:     {423:     {
439:         if ($cur_category != 0)424:         if ($cur_category != 0)
440:             echo "\t\t\t\t\t\t\t".'</table>'."\n\t\t\t\t\t\t".'</div>'."\n\t\t\t\t\t".'</fieldset>'."\n\t\t\t\t".'</div>'."\n";425:             echo "\t\t\t\t\t\t\t".'</table>'."\n\t\t\t\t\t\t".'</div>'."\n\t\t\t\t\t".'</fieldset>'."\n\t\t\t\t".'</div>'."\n";


a/upload/admin_groups.php b/upload/admin_groups.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the admin template 11: // Tell header.php to use the admin template
 27: define('PUN_ADMIN_CONSOLE', 1); 12: define('PUN_ADMIN_CONSOLE', 1);
 47:  32: 
 48:         $mode = 'add'; 33:         $mode = 'add';
 49:     } 34:     }
 50:     else    // We are editing a group 35:     else // We are editing a group
 51:     { 36:     {
 52:         $group_id = intval($_GET['edit_group']); 37:         $group_id = intval($_GET['edit_group']);
 53:         if ($group_id < 1) 38:         if ($group_id < 1)
228:                                     <th scope="row">Email flood interval</th>213:                                     <th scope="row">Email flood interval</th>
229:                                     <td>214:                                     <td>
230:                                         <input type="text" name="email_flood" size="5" maxlength="4" value="<?php echo $group['g_email_flood'] ?>" tabindex="26" />215:                                         <input type="text" name="email_flood" size="5" maxlength="4" value="<?php echo $group['g_email_flood'] ?>" tabindex="26" />
231:                                         <span>Number of seconds that users in this group have to wait between e-mails. Set to 0 to disable.</span>216:                                         <span>Number of seconds that users in this group have to wait between emails. Set to 0 to disable.</span>
232:                                     </td>217:                                     </td>
233:                                 </tr>218:                                 </tr>
234: <?php endif; endif; ?>                            </table>219: <?php endif; endif; ?>                            </table>
306:         $db->query('UPDATE '.$db->prefix.'groups SET g_title=\''.$db->escape($title).'\', g_user_title='.$user_title.', g_moderator='.$moderator.', g_mod_edit_users='.$mod_edit_users.', g_mod_rename_users='.$mod_rename_users.', g_mod_change_passwords='.$mod_change_passwords.', g_mod_ban_users='.$mod_ban_users.', g_read_board='.$read_board.', g_view_users='.$view_users.', g_post_replies='.$post_replies.', g_post_topics='.$post_topics.', g_edit_posts='.$edit_posts.', g_delete_posts='.$delete_posts.', g_delete_topics='.$delete_topics.', g_set_title='.$set_title.', g_search='.$search.', g_search_users='.$search_users.', g_send_email='.$send_email.', g_post_flood='.$post_flood.', g_search_flood='.$search_flood.', g_email_flood='.$email_flood.' WHERE g_id='.intval($_POST['group_id'])) or error('Unable to update group', __FILE__, __LINE__, $db->error());291:         $db->query('UPDATE '.$db->prefix.'groups SET g_title=\''.$db->escape($title).'\', g_user_title='.$user_title.', g_moderator='.$moderator.', g_mod_edit_users='.$mod_edit_users.', g_mod_rename_users='.$mod_rename_users.', g_mod_change_passwords='.$mod_change_passwords.', g_mod_ban_users='.$mod_ban_users.', g_read_board='.$read_board.', g_view_users='.$view_users.', g_post_replies='.$post_replies.', g_post_topics='.$post_topics.', g_edit_posts='.$edit_posts.', g_delete_posts='.$delete_posts.', g_delete_topics='.$delete_topics.', g_set_title='.$set_title.', g_search='.$search.', g_search_users='.$search_users.', g_send_email='.$send_email.', g_post_flood='.$post_flood.', g_search_flood='.$search_flood.', g_email_flood='.$email_flood.' WHERE g_id='.intval($_POST['group_id'])) or error('Unable to update group', __FILE__, __LINE__, $db->error());
307:     }292:     }
308: 293: 
309:     // Regenerate the quickjump cache294:     // Regenerate the quick jump cache
310:     if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))295:     if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
311:         require PUN_ROOT.'include/cache.php';296:         require PUN_ROOT.'include/cache.php';
312: 297: 
375:             $db->query('DELETE FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to delete group', __FILE__, __LINE__, $db->error());360:             $db->query('DELETE FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to delete group', __FILE__, __LINE__, $db->error());
376:             $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE group_id='.$group_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());361:             $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE group_id='.$group_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());
377: 362: 
378:             // Regenerate the quickjump cache363:             // Regenerate the quick jump cache
379:             if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))364:             if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
380:                 require PUN_ROOT.'include/cache.php';365:                 require PUN_ROOT.'include/cache.php';
381: 366: 
445: 430: 
446:     while ($cur_group = $db->fetch_assoc($result))431:     while ($cur_group = $db->fetch_assoc($result))
447:     {432:     {
448:         if ($cur_group['g_id'] == PUN_MEMBER)    // Pre-select the pre-defined Members group433:         if ($cur_group['g_id'] == PUN_MEMBER) // Pre-select the pre-defined Members group
449:             echo "\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";434:             echo "\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
450:         else435:         else
451:             echo "\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";436:             echo "\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";


a/upload/admin_index.php b/upload/admin_index.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the admin template 11: // Tell header.php to use the admin template
 27: define('PUN_ADMIN_CONSOLE', 1); 12: define('PUN_ADMIN_CONSOLE', 1);
 43:     if (!ini_get('allow_url_fopen')) 28:     if (!ini_get('allow_url_fopen'))
 44:         message('Unable to check for upgrade since \'allow_url_fopen\' is disabled on this system.'); 29:         message('Unable to check for upgrade since \'allow_url_fopen\' is disabled on this system.');
 45:  30: 
 46:     $fp = @fopen('http://fluxbb.org/latest_version', 'r'); 31:     $latest_version = trim(@file_get_contents('http://fluxbb.org/latest_version'));
 47:     $latest_version = trim(@fread($fp, 16)); 32:     if (empty($latest_version))
 48:     @fclose($fp); 
 49:  
 50:     if ($latest_version == '') 
 51:         message('Check for upgrade failed for unknown reasons.'); 33:         message('Check for upgrade failed for unknown reasons.');
 52:  34: 
 53:     $cur_version = str_replace(array('.', 'dev', 'beta', ' '), '', strtolower($pun_config['o_cur_version'])); 35:     if (version_compare($pun_config['o_cur_version'], $latest_version, '>='))
 54:     $cur_version = (strlen($cur_version) == 2) ? intval($cur_version) * 10 : intval($cur_version); 
 55:  
 56:     $latest_version = str_replace('.', '', strtolower($latest_version)); 
 57:     $latest_version = (strlen($latest_version) == 2) ? intval($latest_version) * 10 : intval($latest_version); 
 58:  
 59:     if ($cur_version >= $latest_version) 
 60:         message('You are running the latest version of FluxBB.'); 36:         message('You are running the latest version of FluxBB.');
 61:     else 37:     else
 62:         message('A new version of FluxBB has been released. You can download the latest version at <a href="http://fluxbb.org/">FluxBB.org</a>.'); 38:         message('A new version of FluxBB has been released. You can download the latest version at <a href="http://fluxbb.org/">FluxBB.org</a>.');
119: } 95: }
120:  96: 
121:  97: 
122: // Check for the existance of various PHP opcode caches/optimizers 98: // Check for the existence of various PHP opcode caches/optimizers
123: if (function_exists('mmcache')) 99: if (function_exists('mmcache'))
124:     $php_accelerator = '<a href="http://turck-mmcache.sourceforge.net/">Turck MMCache</a>';100:     $php_accelerator = '<a href="http://turck-mmcache.sourceforge.net/">Turck MMCache</a>';
125: else if (isset($_PHPA))101: else if (isset($_PHPA))
131: else if (ini_get('eaccelerator.enable'))107: else if (ini_get('eaccelerator.enable'))
132:     $php_accelerator = '<a href="http://eaccelerator.net/">eAccelerator</a>';108:     $php_accelerator = '<a href="http://eaccelerator.net/">eAccelerator</a>';
133: else if (ini_get('xcache.cacher'))109: else if (ini_get('xcache.cacher'))
134:     $php_accelerator = '<a href="http://trac.lighttpd.net/xcache/">XCache</a>';110:     $php_accelerator = '<a href="http://xcache.lighttpd.net/">XCache</a>';
135: else111: else
136:     $php_accelerator = 'N/A';112:     $php_accelerator = 'N/A';
137: 113: 


a/upload/admin_loader.php b/upload/admin_loader.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the admin template 11: // Tell header.php to use the admin template
 27: define('PUN_ADMIN_CONSOLE', 1); 12: define('PUN_ADMIN_CONSOLE', 1);
 53: if (!isset($_SERVER['REQUEST_URI'])) 38: if (!isset($_SERVER['REQUEST_URI']))
 54:     $_SERVER['REQUEST_URI'] = (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''); 39:     $_SERVER['REQUEST_URI'] = (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '');
 55:  40: 
 56: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / '.$plugin; 41: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / '.str_replace('_', ' ', substr($plugin, strpos($plugin, '_') + 1, -4));
 57: require PUN_ROOT.'header.php'; 42: require PUN_ROOT.'header.php';
 58:  43: 
 59: // Attempt to load the plugin. We don't use @ here to supress error messages, 44: // Attempt to load the plugin. We don't use @ here to supress error messages,
 60: // because if we did and a parse error occurred in the plugin, we would only 45: // because if we did and a parse error occurred in the plugin, we would only
 61: // get the "blank page of death". 46: // get the "blank page of death"
 62: include PUN_ROOT.'plugins/'.$plugin; 47: include PUN_ROOT.'plugins/'.$plugin;
 63: if (!defined('PUN_PLUGIN_LOADED')) 48: if (!defined('PUN_PLUGIN_LOADED'))
 64:     message('Loading of the plugin \''.$plugin.'\' failed.'); 49:     message('Loading of the plugin \''.$plugin.'\' failed.');


a/upload/admin_maintenance.php b/upload/admin_maintenance.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the admin template 11: // Tell header.php to use the admin template
 27: define('PUN_ADMIN_CONSOLE', 1); 12: define('PUN_ADMIN_CONSOLE', 1);
116: 101: 
117:         echo 'Processing post <strong>'.$cur_post[1].'</strong> in topic <strong>'.$cur_post[0].'</strong><br />'."\n";102:         echo 'Processing post <strong>'.$cur_post[1].'</strong> in topic <strong>'.$cur_post[0].'</strong><br />'."\n";
118: 103: 
119:         if ($cur_post[1] == $first_post)    // This is the "topic post" so we have to index the subject as well104:         if ($cur_post[1] == $first_post) // This is the "topic post" so we have to index the subject as well
120:             update_search_index('post', $cur_post[1], $cur_post[2], $subject);105:             update_search_index('post', $cur_post[1], $cur_post[2], $subject);
121:         else106:         else
122:             update_search_index('post', $cur_post[1], $cur_post[2]);107:             update_search_index('post', $cur_post[1], $cur_post[2]);
159:                                     <th scope="row">Topics per cycle</th>144:                                     <th scope="row">Topics per cycle</th>
160:                                     <td>145:                                     <td>
161:                                         <input type="text" name="i_per_page" size="7" maxlength="7" value="100" tabindex="1" />146:                                         <input type="text" name="i_per_page" size="7" maxlength="7" value="100" tabindex="1" />
162:                                         <span>The number of topics to process per pageview. E.g. if you were to enter 100, one hundred topics would be processed and then the page would refresh. This is to prevent the script from timing out during the rebuild process.</span>147:                                         <span>The number of topics to process per page view. E.g. if you were to enter 100, one hundred topics would be processed and then the page would refresh. This is to prevent the script from timing out during the rebuild process.</span>
163:                                     </td>148:                                     </td>
164:                                 </tr>149:                                 </tr>
165:                                 <tr>150:                                 <tr>
166:                                     <th scope="row">Starting Topic ID</th>151:                                     <th scope="row">Starting topic ID</th>
167:                                     <td>152:                                     <td>
168:                                         <input type="text" name="i_start_at" size="7" maxlength="7" value="<?php echo (isset($first_id)) ? $first_id : 0 ?>" tabindex="2" />153:                                         <input type="text" name="i_start_at" size="7" maxlength="7" value="<?php echo (isset($first_id)) ? $first_id : 0 ?>" tabindex="2" />
169:                                         <span>The topic ID to start rebuilding at. The default value is the first available ID in the database. Normally you wouldn't want to change this.</span>154:                                         <span>The topic ID to start rebuilding at. The default value is the first available ID in the database. Normally you wouldn't want to change this.</span>


a/upload/admin_options.php b/upload/admin_options.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the admin template 11: // Tell header.php to use the admin template
 27: define('PUN_ADMIN_CONSOLE', 1); 12: define('PUN_ADMIN_CONSOLE', 1);
 41:     if (!preg_match('#^'.preg_quote(str_replace('www.', '', $pun_config['o_base_url']).'/admin_options.php', '#').'#i', str_replace('www.', '', (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '')))) 26:     if (!preg_match('#^'.preg_quote(str_replace('www.', '', $pun_config['o_base_url']).'/admin_options.php', '#').'#i', str_replace('www.', '', (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''))))
 42:         message('Bad HTTP_REFERER. If you have moved these forums from one location to another or switched domains, you need to update the Base URL manually in the database (look for o_base_url in the config table) and then clear the cache by deleting all .php files in the /cache directory.'); 27:         message('Bad HTTP_REFERER. If you have moved these forums from one location to another or switched domains, you need to update the Base URL manually in the database (look for o_base_url in the config table) and then clear the cache by deleting all .php files in the /cache directory.');
 43:  28: 
 44:     $form = array_map('trim', $_POST['form']); 29:     $form = array_map('pun_trim', $_POST['form']);
 45:  30: 
 46:     if ($form['board_title'] == '') 31:     if ($form['board_title'] == '')
 47:         message('You must enter a board title.'); 32:         message('You must enter a board title.');
 53:  38: 
 54:     $form['admin_email'] = strtolower($form['admin_email']); 39:     $form['admin_email'] = strtolower($form['admin_email']);
 55:     if (!is_valid_email($form['admin_email'])) 40:     if (!is_valid_email($form['admin_email']))
 56:         message('The admin e-mail address you entered is invalid.'); 41:         message('The admin email address you entered is invalid.');
 57:  42: 
 58:     $form['webmaster_email'] = strtolower($form['webmaster_email']); 43:     $form['webmaster_email'] = strtolower($form['webmaster_email']);
 59:     if (!is_valid_email($form['webmaster_email'])) 44:     if (!is_valid_email($form['webmaster_email']))
 60:         message('The webmaster e-mail address you entered is invalid.'); 45:         message('The webmaster email address you entered is invalid.');
 61:  46: 
 62:     if ($form['mailing_list'] != '') 47:     if ($form['mailing_list'] != '')
 63:         $form['mailing_list'] = strtolower(preg_replace('/[\s]/', '', $form['mailing_list'])); 48:         $form['mailing_list'] = strtolower(preg_replace('/[\s]/', '', $form['mailing_list']));
185:                                     </td>170:                                     </td>
186:                                 </tr>171:                                 </tr>
187:                                 <tr>172:                                 <tr>
188:                                     <th scope="row">Default timezone</th>173:                                     <th scope="row">Default time zone</th>
189:                                     <td>174:                                     <td>
190:                                         <select name="form[default_timezone]">175:                                         <select name="form[default_timezone]">
191:                                             <option value="-12"<?php if ($pun_config['o_default_timezone'] == -12 ) echo ' selected="selected"' ?>>-12</option>176:                                             <option value="-12"<?php if ($pun_config['o_default_timezone'] == -12 ) echo ' selected="selected"' ?>>-12</option>
225:                                             <option value="12"<?php if ($pun_config['o_default_timezone'] == 12 ) echo ' selected="selected"' ?>>+12</option>210:                                             <option value="12"<?php if ($pun_config['o_default_timezone'] == 12 ) echo ' selected="selected"' ?>>+12</option>
226:                                             <option value="13"<?php if ($pun_config['o_default_timezone'] == 13 ) echo ' selected="selected"' ?>>+13</option>211:                                             <option value="13"<?php if ($pun_config['o_default_timezone'] == 13 ) echo ' selected="selected"' ?>>+13</option>
227:                                         </select>212:                                         </select>
228:                                         <span>The default timezone for guests and users attempting to register for the board.</span>213:                                         <span>The default time zone for guests and users attempting to register for the board.</span>
229:                                     </td>214:                                     </td>
230:                                 </tr>215:                                 </tr>
231:                                 <tr>216:                                 <tr>
358:                                     <th scope="row">User info in posts</th>343:                                     <th scope="row">User info in posts</th>
359:                                     <td>344:                                     <td>
360:                                         <input type="radio" name="form[show_user_info]" value="1"<?php if ($pun_config['o_show_user_info'] == '1') echo ' checked="checked"' ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="form[show_user_info]" value="0"<?php if ($pun_config['o_show_user_info'] == '0') echo ' checked="checked"' ?> />&nbsp;<strong>No</strong>345:                                         <input type="radio" name="form[show_user_info]" value="1"<?php if ($pun_config['o_show_user_info'] == '1') echo ' checked="checked"' ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="form[show_user_info]" value="0"<?php if ($pun_config['o_show_user_info'] == '0') echo ' checked="checked"' ?> />&nbsp;<strong>No</strong>
361:                                         <span>Show information about the poster under the username in topic view. The information affected is location, register date, post count and the contact links (e-mail and URL).</span>346:                                         <span>Show information about the poster under the username in topic view. The information affected is location, register date, post count and the contact links (email and URL).</span>
362:                                     </td>347:                                     </td>
363:                                 </tr>348:                                 </tr>
364:                                 <tr>349:                                 <tr>
522:                                 <tr>507:                                 <tr>
523:                                     <th scope="row">Report method</th>508:                                     <th scope="row">Report method</th>
524:                                     <td>509:                                     <td>
525:                                         <input type="radio" name="form[report_method]" value="0"<?php if ($pun_config['o_report_method'] == '0') echo ' checked="checked"' ?> />&nbsp;Internal&nbsp;&nbsp;&nbsp;<input type="radio" name="form[report_method]" value="1"<?php if ($pun_config['o_report_method'] == '1') echo ' checked="checked"' ?> />&nbsp;E-mail&nbsp;&nbsp;&nbsp;<input type="radio" name="form[report_method]" value="2"<?php if ($pun_config['o_report_method'] == '2') echo ' checked="checked"' ?> />&nbsp;Both510:                                         <input type="radio" name="form[report_method]" value="0"<?php if ($pun_config['o_report_method'] == '0') echo ' checked="checked"' ?> />&nbsp;Internal&nbsp;&nbsp;&nbsp;<input type="radio" name="form[report_method]" value="1"<?php if ($pun_config['o_report_method'] == '1') echo ' checked="checked"' ?> />&nbsp;Email&nbsp;&nbsp;&nbsp;<input type="radio" name="form[report_method]" value="2"<?php if ($pun_config['o_report_method'] == '2') echo ' checked="checked"' ?> />&nbsp;Both
526:                                         <span>Select the method for handling topic/post reports. You can choose whether topic/post reports should be handled by the internal report system,  e-mailed to the addresses on the mailing list (see below) or both.</span>511:                                         <span>Select the method for handling topic/post reports. You can choose whether topic/post reports should be handled by the internal report system, emailed to the addresses on the mailing list (see below) or both.</span>
527:                                     </td>512:                                     </td>
528:                                 </tr>513:                                 </tr>
529:                                 <tr>514:                                 <tr>
583:                 </div>568:                 </div>
584:                 <div class="inform">569:                 <div class="inform">
585:                     <fieldset>570:                     <fieldset>
586:                         <legend>E-mail</legend>571:                         <legend>Email</legend>
587:                         <div class="infldset">572:                         <div class="infldset">
588:                             <table class="aligntop" cellspacing="0">573:                             <table class="aligntop" cellspacing="0">
589:                                 <tr>574:                                 <tr>
590:                                     <th scope="row">Admin e-mail</th>575:                                     <th scope="row">Admin email</th>
591:                                     <td>576:                                     <td>
592:                                         <input type="text" name="form[admin_email]" size="50" maxlength="50" value="<?php echo $pun_config['o_admin_email'] ?>" />577:                                         <input type="text" name="form[admin_email]" size="50" maxlength="50" value="<?php echo $pun_config['o_admin_email'] ?>" />
593:                                         <span>The e-mail address of the forum administrator.</span>578:                                         <span>The email address of the forum administrator.</span>
594:                                     </td>579:                                     </td>
595:                                 </tr>580:                                 </tr>
596:                                 <tr>581:                                 <tr>
597:                                     <th scope="row">Webmaster e-mail</th>582:                                     <th scope="row">Webmaster email</th>
598:                                     <td>583:                                     <td>
599:                                         <input type="text" name="form[webmaster_email]" size="50" maxlength="50" value="<?php echo $pun_config['o_webmaster_email'] ?>" />584:                                         <input type="text" name="form[webmaster_email]" size="50" maxlength="50" value="<?php echo $pun_config['o_webmaster_email'] ?>" />
600:                                         <span>This is the address that all e-mails sent by the forum will be addressed from.</span>585:                                         <span>This is the address that all emails sent by the forum will be addressed from.</span>
601:                                     </td>586:                                     </td>
602:                                 </tr>587:                                 </tr>
603:                                 <tr>588:                                 <tr>
604:                                     <th scope="row">Subscriptions</th>589:                                     <th scope="row">Subscriptions</th>
605:                                     <td>590:                                     <td>
606:                                         <input type="radio" name="form[subscriptions]" value="1"<?php if ($pun_config['o_subscriptions'] == '1') echo ' checked="checked"' ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="form[subscriptions]" value="0"<?php if ($pun_config['o_subscriptions'] == '0') echo ' checked="checked"' ?> />&nbsp;<strong>No</strong>591:                                         <input type="radio" name="form[subscriptions]" value="1"<?php if ($pun_config['o_subscriptions'] == '1') echo ' checked="checked"' ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="form[subscriptions]" value="0"<?php if ($pun_config['o_subscriptions'] == '0') echo ' checked="checked"' ?> />&nbsp;<strong>No</strong>
607:                                         <span>Enable users to subscribe to topics (receive e-mail when someone replies).</span>592:                                         <span>Enable users to subscribe to topics (receive email when someone replies).</span>
608:                                     </td>593:                                     </td>
609:                                 </tr>594:                                 </tr>
610:                                 <tr>595:                                 <tr>
611:                                     <th scope="row">SMTP server address</th>596:                                     <th scope="row">SMTP server address</th>
612:                                     <td>597:                                     <td>
613:                                         <input type="text" name="form[smtp_host]" size="30" maxlength="100" value="<?php echo pun_htmlspecialchars($pun_config['o_smtp_host']) ?>" />598:                                         <input type="text" name="form[smtp_host]" size="30" maxlength="100" value="<?php echo pun_htmlspecialchars($pun_config['o_smtp_host']) ?>" />
614:                                         <span>The address of an external SMTP server to send e-mails with. You can specify a custom port number if the SMTP server doesn't run on the default port 25 (example: mail.myhost.com:3580). Leave blank to use the local mail program.</span>599:                                         <span>The address of an external SMTP server to send emails with. You can specify a custom port number if the SMTP server doesn't run on the default port 25 (example: mail.myhost.com:3580). Leave blank to use the local mail program.</span>
615:                                     </td>600:                                     </td>
616:                                 </tr>601:                                 </tr>
617:                                 <tr>602:                                 <tr>
655:                                     <th scope="row">Verify registrations</th>640:                                     <th scope="row">Verify registrations</th>
656:                                     <td>641:                                     <td>
657:                                         <input type="radio" name="form[regs_verify]" value="1"<?php if ($pun_config['o_regs_verify'] == '1') echo ' checked="checked"' ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="form[regs_verify]" value="0"<?php if ($pun_config['o_regs_verify'] == '0') echo ' checked="checked"' ?> />&nbsp;<strong>No</strong>642:                                         <input type="radio" name="form[regs_verify]" value="1"<?php if ($pun_config['o_regs_verify'] == '1') echo ' checked="checked"' ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="form[regs_verify]" value="0"<?php if ($pun_config['o_regs_verify'] == '0') echo ' checked="checked"' ?> />&nbsp;<strong>No</strong>
658:                                         <span>When enabled, users are e-mailed a random password when they register. They can then log in and change the password in their profile if they see fit. This feature also requires users to verify new e-mail addresses if they choose to change from the one they registered with. This is an effective way of avoiding registration abuse and making sure that all users have "correct" e-mail addresses in their profiles.</span>643:                                         <span>When enabled, users are emailed a random password when they register. They can then log in and change the password in their profile if they see fit. This feature also requires users to verify new email addresses if they choose to change from the one they registered with. This is an effective way of avoiding registration abuse and making sure that all users have "correct" email addresses in their profiles.</span>
659:                                     </td>644:                                     </td>
660:                                 </tr>645:                                 </tr>
661:                                 <tr>646:                                 <tr>
680:                                     </td>665:                                     </td>
681:                                 </tr>666:                                 </tr>
682:                                 <tr>667:                                 <tr>
683:                                     <th scope="row">Default e-mail setting</th>668:                                     <th scope="row">Default email setting</th>
684:                                     <td>669:                                     <td>
685:                                         <span>Choose the default privacy setting for new user registrations.</span>670:                                         <span>Choose the default privacy setting for new user registrations.</span>
686:                                         <input type="radio" name="form[default_email_setting]" value="0"<?php if ($pun_config['o_default_email_setting'] == '0') echo ' checked="checked"' ?> />&nbsp;Display e-mail address to other users.<br />671:                                         <input type="radio" name="form[default_email_setting]" value="0"<?php if ($pun_config['o_default_email_setting'] == '0') echo ' checked="checked"' ?> />&nbsp;Display email address to other users.<br />
687:                                         <input type="radio" name="form[default_email_setting]" value="1"<?php if ($pun_config['o_default_email_setting'] == '1') echo ' checked="checked"' ?> />&nbsp;Hide e-mail address but allow form e-mail.<br />672:                                         <input type="radio" name="form[default_email_setting]" value="1"<?php if ($pun_config['o_default_email_setting'] == '1') echo ' checked="checked"' ?> />&nbsp;Hide email address but allow form email.<br />
688:                                         <input type="radio" name="form[default_email_setting]" value="2"<?php if ($pun_config['o_default_email_setting'] == '2') echo ' checked="checked"' ?> />&nbsp;Hide e-mail address and disallow form e-mail.<br />673:                                         <input type="radio" name="form[default_email_setting]" value="2"<?php if ($pun_config['o_default_email_setting'] == '2') echo ' checked="checked"' ?> />&nbsp;Hide email address and disallow form email.<br />
689:                                     </td>674:                                     </td>
690:                                 </tr>675:                                 </tr>
691:                             </table>676:                             </table>


a/upload/admin_permissions.php b/upload/admin_permissions.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the admin template 11: // Tell header.php to use the admin template
 27: define('PUN_ADMIN_CONSOLE', 1); 12: define('PUN_ADMIN_CONSOLE', 1);
103:                                     </td> 88:                                     </td>
104:                                 </tr> 89:                                 </tr>
105:                                 <tr> 90:                                 <tr>
106:                                     <th scope="row">Require guest e-mail</th> 91:                                     <th scope="row">Require guest email</th>
107:                                     <td> 92:                                     <td>
108:                                         <input type="radio" name="form[force_guest_email]" value="1"<?php if ($pun_config['p_force_guest_email'] == '1') echo ' checked="checked"' ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="form[force_guest_email]" value="0"<?php if ($pun_config['p_force_guest_email'] == '0') echo ' checked="checked"' ?> />&nbsp;<strong>No</strong> 93:                                         <input type="radio" name="form[force_guest_email]" value="1"<?php if ($pun_config['p_force_guest_email'] == '1') echo ' checked="checked"' ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="form[force_guest_email]" value="0"<?php if ($pun_config['p_force_guest_email'] == '0') echo ' checked="checked"' ?> />&nbsp;<strong>No</strong>
109:                                         <span>Require guests to supply an e-mail address when posting.</span> 94:                                         <span>Require guests to supply an email address when posting.</span>
110:                                     </td> 95:                                     </td>
111:                                 </tr> 96:                                 </tr>
112:                             </table> 97:                             </table>
163:                         <div class="infldset">148:                         <div class="infldset">
164:                             <table class="aligntop" cellspacing="0">149:                             <table class="aligntop" cellspacing="0">
165:                                 <tr>150:                                 <tr>
166:                                     <th scope="row">Allow banned e-mail addresses</th>151:                                     <th scope="row">Allow banned email addresses</th>
167:                                     <td>152:                                     <td>
168:                                         <input type="radio" name="form[allow_banned_email]" value="1"<?php if ($pun_config['p_allow_banned_email'] == '1') echo ' checked="checked"' ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="form[allow_banned_email]" value="0"<?php if ($pun_config['p_allow_banned_email'] == '0') echo ' checked="checked"' ?> />&nbsp;<strong>No</strong>153:                                         <input type="radio" name="form[allow_banned_email]" value="1"<?php if ($pun_config['p_allow_banned_email'] == '1') echo ' checked="checked"' ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="form[allow_banned_email]" value="0"<?php if ($pun_config['p_allow_banned_email'] == '0') echo ' checked="checked"' ?> />&nbsp;<strong>No</strong>
169:                                         <span>Allow users to register with or change to a banned e-mail address/domain. If left at its default setting (yes) this action will be allowed, but an alert e-mail will be sent to the mailing list (an effective way of detecting multiple registrations).</span>154:                                         <span>Allow users to register with or change to a banned email address/domain. If left at its default setting (yes) this action will be allowed, but an alert email will be sent to the mailing list (an effective way of detecting multiple registrations).</span>
170:                                     </td>155:                                     </td>
171:                                 </tr>156:                                 </tr>
172:                                 <tr>157:                                 <tr>
173:                                     <th scope="row">Allow duplicate e-mail addresses</th>158:                                     <th scope="row">Allow duplicate email addresses</th>
174:                                     <td>159:                                     <td>
175:                                         <input type="radio" name="form[allow_dupe_email]" value="1"<?php if ($pun_config['p_allow_dupe_email'] == '1') echo ' checked="checked"' ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="form[allow_dupe_email]" value="0"<?php if ($pun_config['p_allow_dupe_email'] == '0') echo ' checked="checked"' ?> />&nbsp;<strong>No</strong>160:                                         <input type="radio" name="form[allow_dupe_email]" value="1"<?php if ($pun_config['p_allow_dupe_email'] == '1') echo ' checked="checked"' ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="form[allow_dupe_email]" value="0"<?php if ($pun_config['p_allow_dupe_email'] == '0') echo ' checked="checked"' ?> />&nbsp;<strong>No</strong>
176:                                         <span>Controls whether users should be allowed to register with an e-mail address that another user already has. If allowed, an alert e-mail will be sent to the mailing list if a duplicate is detected.</span>161:                                         <span>Controls whether users should be allowed to register with an email address that another user already has. If allowed, an alert email will be sent to the mailing list if a duplicate is detected.</span>
177:                                     </td>162:                                     </td>
178:                                 </tr>163:                                 </tr>
179:                             </table>164:                             </table>


a/upload/admin_prune.php b/upload/admin_prune.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the admin template 11: // Tell header.php to use the admin template
 27: define('PUN_ADMIN_CONSOLE', 1); 12: define('PUN_ADMIN_CONSOLE', 1);
 42:         confirm_referrer('admin_prune.php'); 27:         confirm_referrer('admin_prune.php');
 43:  28: 
 44:         $prune_from = $_POST['prune_from']; 29:         $prune_from = $_POST['prune_from'];
  30:         $prune_sticky = isset($_POST['prune_sticky']) ? '1' : '0';
 45:         $prune_days = intval($_POST['prune_days']); 31:         $prune_days = intval($_POST['prune_days']);
 46:         $prune_date = ($prune_days) ? time() - ($prune_days*86400) : -1; 32:         $prune_date = ($prune_days) ? time() - ($prune_days*86400) : -1;
 47:  33: 
 56:             { 42:             {
 57:                 $fid = $db->result($result, $i); 43:                 $fid = $db->result($result, $i);
 58:  44: 
 59:                 prune($fid, $_POST['prune_sticky'], $prune_date); 45:                 prune($fid, $prune_sticky, $prune_date);
 60:                 update_forum($fid); 46:                 update_forum($fid);
 61:             } 47:             }
 62:         } 48:         }
 63:         else 49:         else
 64:         { 50:         {
 65:             $prune_from = intval($prune_from); 51:             $prune_from = intval($prune_from);
 66:             prune($prune_from, $_POST['prune_sticky'], $prune_date); 52:             prune($prune_from, $prune_sticky, $prune_date);
 67:             update_forum($prune_from); 53:             update_forum($prune_from);
 68:         } 54:         }
 69:  55: 
 90:     $prune_date = time() - ($prune_days*86400); 76:     $prune_date = time() - ($prune_days*86400);
 91:     $prune_from = $_POST['prune_from']; 77:     $prune_from = $_POST['prune_from'];
 92:  78: 
 93:     // Concatenate together the query for counting number or topics to prune 79:     // Concatenate together the query for counting number of topics to prune
 94:     $sql = 'SELECT COUNT(id) FROM '.$db->prefix.'topics WHERE last_post<'.$prune_date.' AND moved_to IS NULL'; 80:     $sql = 'SELECT COUNT(id) FROM '.$db->prefix.'topics WHERE last_post<'.$prune_date.' AND moved_to IS NULL';
 95:  81: 
 96:     if ($_POST['prune_sticky'] == '0') 82:     if (!$prune_sticky)
 97:         $sql .= ' AND sticky=\'0\''; 83:         $sql .= ' AND sticky=\'0\'';
 98:  84: 
 99:     if ($prune_from != 'all') 85:     if ($prune_from != 'all')
127:             <form method="post" action="admin_prune.php?action=foo">113:             <form method="post" action="admin_prune.php?action=foo">
128:                 <div class="inform">114:                 <div class="inform">
129:                     <input type="hidden" name="prune_days" value="<?php echo $prune_days ?>" />115:                     <input type="hidden" name="prune_days" value="<?php echo $prune_days ?>" />
130:                     <input type="hidden" name="prune_sticky" value="<?php echo $_POST['prune_sticky'] ?>" />116:                     <input type="hidden" name="prune_sticky" value="<?php echo $prune_sticky ?>" />
131:                     <input type="hidden" name="prune_from" value="<?php echo $prune_from ?>" />117:                     <input type="hidden" name="prune_from" value="<?php echo $prune_from ?>" />
132:                     <fieldset>118:                     <fieldset>
133:                         <legend>Confirm prune posts</legend>119:                         <legend>Confirm prune posts</legend>
195:     $cur_category = 0;181:     $cur_category = 0;
196:     while ($forum = $db->fetch_assoc($result))182:     while ($forum = $db->fetch_assoc($result))
197:     {183:     {
198:         if ($forum['cid'] != $cur_category)    // Are we still in the same category?184:         if ($forum['cid'] != $cur_category) // Are we still in the same category?
199:         {185:         {
200:             if ($cur_category)186:             if ($cur_category)
201:                 echo "\t\t\t\t\t\t\t\t\t\t\t".'</optgroup>'."\n";187:                 echo "\t\t\t\t\t\t\t\t\t\t\t".'</optgroup>'."\n";


a/upload/admin_ranks.php b/upload/admin_ranks.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the admin template 11: // Tell header.php to use the admin template
 27: define('PUN_ADMIN_CONSOLE', 1); 12: define('PUN_ADMIN_CONSOLE', 1);
134:                         <legend>Add rank</legend>119:                         <legend>Add rank</legend>
135:                         <div class="infldset">120:                         <div class="infldset">
136:                             <p>Enter a rank and the minimum number of posts that a user has to have to aquire the rank. Different ranks cannot have the same value for minimum posts. If a title is set for a user, the title will be displayed instead of any rank. <strong>User ranks must be enabled in <a href="admin_options.php#ranks">Options</a> for this to have any effect.</strong></p>121:                             <p>Enter a rank and the minimum number of posts that a user has to have to aquire the rank. Different ranks cannot have the same value for minimum posts. If a title is set for a user, the title will be displayed instead of any rank. <strong>User ranks must be enabled in <a href="admin_options.php#ranks">Options</a> for this to have any effect.</strong></p>
137:                             <table  cellspacing="0">122:                             <table cellspacing="0">
138:                             <thead>123:                             <thead>
139:                                 <tr>124:                                 <tr>
140:                                     <th class="tcl" scope="col">Rank&nbsp;title</th>125:                                     <th class="tcl" scope="col">Rank&nbsp;title</th>
164: {149: {
165: 150: 
166: ?>151: ?>
167:                             <table  cellspacing="0">152:                             <table cellspacing="0">
168:                             <thead>153:                             <thead>
169:                                 <tr>154:                                 <tr>
170:                                     <th class="tcl" scope="col"><strong>Rank&nbsp;title</strong></th>155:                                     <th class="tcl" scope="col"><strong>Rank&nbsp;title</strong></th>


a/upload/admin_reports.php b/upload/admin_reports.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the admin template 11: // Tell header.php to use the admin template
 27: define('PUN_ADMIN_CONSOLE', 1); 12: define('PUN_ADMIN_CONSOLE', 1);


a/upload/admin_users.php b/upload/admin_users.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the admin template 11: // Tell header.php to use the admin template
 27: define('PUN_ADMIN_CONSOLE', 1); 12: define('PUN_ADMIN_CONSOLE', 1);
133:             <thead>118:             <thead>
134:                 <tr>119:                 <tr>
135:                     <th class="tcl" scope="col">Username</th>120:                     <th class="tcl" scope="col">Username</th>
136:                     <th class="tc2" scope="col">E-mail</th>121:                     <th class="tc2" scope="col">Email</th>
137:                     <th class="tc3" scope="col">Title/Status</th>122:                     <th class="tc3" scope="col">Title/Status</th>
138:                     <th class="tc4" scope="col">Posts</th>123:                     <th class="tc4" scope="col">Posts</th>
139:                     <th class="tc5" scope="col">Admin note</th>124:                     <th class="tc5" scope="col">Admin note</th>
216:     $form['username'] = $_POST['username'];201:     $form['username'] = $_POST['username'];
217: 202: 
218:     // trim() all elements in $form203:     // trim() all elements in $form
219:     $form = array_map('trim', $form);204:     $form = array_map('pun_trim', $form);
220:     $conditions = array();205:     $conditions = array();
221: 206: 
222:     $posts_greater = trim($_POST['posts_greater']);207:     $posts_greater = trim($_POST['posts_greater']);
291:             <thead>276:             <thead>
292:                 <tr>277:                 <tr>
293:                     <th class="tcl" scope="col">Username</th>278:                     <th class="tcl" scope="col">Username</th>
294:                     <th class="tc2" scope="col">E-mail</th>279:                     <th class="tc2" scope="col">Email</th>
295:                     <th class="tc3" scope="col">Title/Status</th>280:                     <th class="tc3" scope="col">Title/Status</th>
296:                     <th class="tc4" scope="col">Posts</th>281:                     <th class="tc4" scope="col">Posts</th>
297:                     <th class="tc5" scope="col">Admin note</th>282:                     <th class="tc5" scope="col">Admin note</th>
367:                         <legend>Enter search criteria</legend>352:                         <legend>Enter search criteria</legend>
368:                         <div class="infldset">353:                         <div class="infldset">
369:                             <p>Search for users in the database. You can enter one or more terms to search for. Wildcards in the form of asterisks (*) are accepted.</p>354:                             <p>Search for users in the database. You can enter one or more terms to search for. Wildcards in the form of asterisks (*) are accepted.</p>
370:                             <table  class="aligntop" cellspacing="0">355:                             <table class="aligntop" cellspacing="0">
371:                                 <tr>356:                                 <tr>
372:                                     <th scope="row">Username</th>357:                                     <th scope="row">Username</th>
373:                                     <td><input type="text" name="username" size="25" maxlength="25" tabindex="2" /></td>358:                                     <td><input type="text" name="username" size="25" maxlength="25" tabindex="2" /></td>
374:                                 </tr>359:                                 </tr>
375:                                 <tr>360:                                 <tr>
376:                                     <th scope="row">E-mail address</th>361:                                     <th scope="row">Email address</th>
377:                                     <td><input type="text" name="form[email]" size="30" maxlength="50" tabindex="3" /></td>362:                                     <td><input type="text" name="form[email]" size="30" maxlength="50" tabindex="3" /></td>
378:                                 </tr>363:                                 </tr>
379:                                 <tr>364:                                 <tr>
449:                                     <td>434:                                     <td>
450:                                         <select name="order_by" tabindex="20">435:                                         <select name="order_by" tabindex="20">
451:                                             <option value="username" selected="selected">username</option>436:                                             <option value="username" selected="selected">username</option>
452:                                             <option value="email">e-mail</option>437:                                             <option value="email">email</option>
453:                                             <option value="num_posts">posts</option>438:                                             <option value="num_posts">posts</option>
454:                                             <option value="last_post">last post</option>439:                                             <option value="last_post">last post</option>
455:                                             <option value="registered">registered</option>440:                                             <option value="registered">registered</option>


a/upload/db_update.php b/upload/db_update.php
  1: <?php  1: <?php
  2: /** 
  3:  * Database updating script 
  4:  * 
  5:  * Updates the database to the latest version. 
  6:  * 
  7:  * @copyright Copyright (C) 2008 FluxBB.org, based on code copyright (C) 2002-2008 PunBB.org 
  8:  * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher 
  9:  * @package FluxBB 
 10:  */ 
 11:   2: 
   3: /*---
 12:   4: 
 13: define('UPDATE_TO', '1.4');  5:     Copyright (C) 2008-2009 FluxBB.org
 14: define('UPDATE_TO_DB_REVISION', 1);  6:     based on code copyright (C) 2002-2008 PunBB.org
   7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 15:   8: 
 16: // The number of items to process per pageview (lower this if the update script times out during UTF-8 conversion)  9: ---*/
  10: 
  11: define('UPDATE_TO', '1.4-rc1');
  12: define('UPDATE_TO_DB_REVISION', 2);
  13: 
  14: // The number of items to process per page view (lower this if the update script times out during UTF-8 conversion)
 17: define('PER_PAGE', 300); 15: define('PER_PAGE', 300);
 18:  16: 
 19:  17: 
 28: if (file_exists(PUN_ROOT.'config.php')) 26: if (file_exists(PUN_ROOT.'config.php'))
 29:     include PUN_ROOT.'config.php'; 27:     include PUN_ROOT.'config.php';
 30:  28: 
  29: // If we have the 1.3-legacy constant defined, define the proper 1.4 constant so we don't get an incorrect "need to install" message
  30: if (defined('FORUM'))
  31:     define('PUN', FORUM);
  32: 
 31: // If PUN isn't defined, config.php is missing or corrupt or we are outside the root directory 33: // If PUN isn't defined, config.php is missing or corrupt or we are outside the root directory
 32: if (!defined('PUN')) 34: if (!defined('PUN'))
 33:     exit('This file must be run from the forum root directory.'); 35:     exit('This file must be run from the forum root directory.');
 39: error_reporting(E_ALL); 41: error_reporting(E_ALL);
 40:  42: 
 41: // Turn off magic_quotes_runtime 43: // Turn off magic_quotes_runtime
 42: set_magic_quotes_runtime(0); 44: if (get_magic_quotes_runtime())
  45:     set_magic_quotes_runtime(0);
 43:  46: 
 44: // Turn off PHP time limit 47: // Turn off PHP time limit
 45: @set_time_limit(0); 48: @set_time_limit(0);
 61: // Strip out "bad" UTF-8 characters 64: // Strip out "bad" UTF-8 characters
 62: forum_remove_bad_characters(); 65: forum_remove_bad_characters();
 63:  66: 
 64: // Instruct DB abstraction layer that we don't want it to "SET NAMES". If we need to, we'll do it ourselves below. 67: // Instruct DB abstraction layer that we don't want it to "SET NAMES". If we need to, we'll do it ourselves below
 65: define('FORUM_NO_SET_NAMES', 1); 68: define('FORUM_NO_SET_NAMES', 1);
 66:  69: 
 67: // Load DB abstraction layer and try to connect 70: // Load DB abstraction layer and try to connect
 75:     exit('Version mismatch. The database \''.$db_name.'\' doesn\'t seem to be running a FluxBB database schema supported by this update script.'); 78:     exit('Version mismatch. The database \''.$db_name.'\' doesn\'t seem to be running a FluxBB database schema supported by this update script.');
 76:  79: 
 77: // If we've already done charset conversion in a previous update, we have to do SET NAMES 80: // If we've already done charset conversion in a previous update, we have to do SET NAMES
 78: $db->set_names(strpos($cur_version, '1.3') === 0 ? 'utf8' : 'latin1'); 81: $db->set_names(strpos($cur_version, '1.2') === 0 ? 'latin1' : 'utf8');
 79:  82: 
 80: // Get the forum config 83: // Get the forum config
 81: $result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch config.', __FILE__, __LINE__, $db->error()); 84: $result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch config.', __FILE__, __LINE__, $db->error());
115: 118: 
116: 119: 
117: //120: //
118: // Translates the number from an HTML numeric entity into an UTF-8 character121: // Translates the number from a HTML numeric entity into an UTF-8 character
119: //122: //
120: function dcr2utf8($src)123: function dcr2utf8($src)
121: {124: {
162: 165: 
163: 166: 
164: //167: //
165: // Attemts to convert $str from $old_charset to UTF-8. Also converts HTML entities (including numeric entities) to UTF-8 characters.168: // Attempts to convert $str from $old_charset to UTF-8. Also converts HTML entities (including numeric entities) to UTF-8 characters
166: //169: //
167: function convert_to_utf8(&$str, $old_charset)170: function convert_to_utf8(&$str, $old_charset)
168: {171: {
230:         $id = ($i == 0) ? $min_id : (($i == 1) ? $max_id : rand($min_id, $max_id));233:         $id = ($i == 0) ? $min_id : (($i == 1) ? $max_id : rand($min_id, $max_id));
231: 234: 
232:         $result = $db->query('SELECT p.message, p.poster, t.subject, f.forum_name FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON (t.id = p.topic_id) INNER JOIN '.$db->prefix.'forums AS f ON (f.id = t.forum_id) WHERE p.id >= '.$id.' LIMIT 1') or error('Unable to fetch post information', __FILE__, __LINE__, $db->error());235:         $result = $db->query('SELECT p.message, p.poster, t.subject, f.forum_name FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON (t.id = p.topic_id) INNER JOIN '.$db->prefix.'forums AS f ON (f.id = t.forum_id) WHERE p.id >= '.$id.' LIMIT 1') or error('Unable to fetch post information', __FILE__, __LINE__, $db->error());
233:         $temp = $db->fetch_row($result);236:         $temp = implode('', $db->fetch_row($result));
234: 237: 
235:         if (!seems_utf8($temp[0].$temp[1].$temp[2].$temp[3]))238:         if (!seems_utf8($temp) || preg_match('/&(#[0-9]+|#x[a-z0-9]+|[a-z0-9]+);/i', $temp))
236:         {239:         {
237:             $seems_utf8 = false;240:             $seems_utf8 = false;
238:             break;241:             break;
363:                         <tr>366:                         <tr>
364:                             <th scope="row">Current character set:</th>367:                             <th scope="row">Current character set:</th>
365:                             <td>368:                             <td>
366:                                 <input type="text" name="req_old_charset" size="12" maxlength="20" value="ISO-8859-1" /><br />369:                                 <input type="text" name="req_old_charset" size="12" maxlength="20" value="<?php echo $old_charset ?>" /><br />
367:                                 <span>Accept default for English forums otherwise the character set of the primary langauge pack.</span>370:                                 <span>Accept default for English forums otherwise the character set of the primary langauge pack.</span>
368:                             </td>371:                             </td>
369:                         </tr>372:                         </tr>
393: 396: 
394:     // Start by updating the database structure397:     // Start by updating the database structure
395:     case 'start':398:     case 'start':
396:         // Make all e-mail fields VARCHAR(80)399:         // Make all email fields VARCHAR(80)
397:         $db->alter_field('bans', 'email', 'VARCHAR(80)', true);400:         $db->alter_field('bans', 'email', 'VARCHAR(80)', true);
398:         $db->alter_field('posts', 'poster_email', 'VARCHAR(80)', true);401:         $db->alter_field('posts', 'poster_email', 'VARCHAR(80)', true);
399:         $db->alter_field('users', 'email', 'VARCHAR(80)', false, '');402:         $db->alter_field('users', 'email', 'VARCHAR(80)', false, '');
426:         // Drop g_edit_subjects_interval column from groups table429:         // Drop g_edit_subjects_interval column from groups table
427:         $db->drop_field('groups', 'g_edit_subjects_interval');430:         $db->drop_field('groups', 'g_edit_subjects_interval');
428: 431: 
429:         $new_config = array(); 
430:  
431:         // Add database revision number432:         // Add database revision number
432:         if (!array_key_exists('o_database_revision', $pun_config))433:         if (!array_key_exists('o_database_revision', $pun_config))
433:             $new_config[] = '\'o_database_revision\', \'0\'';434:             $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_database_revision\', \'0\')') or error('Unable to insert config value \'o_database_revision\'', __FILE__, __LINE__, $db->error());
434: 435: 
435:         // Add default email setting option436:         // Add default email setting option
436:         if (!array_key_exists('o_default_email_setting', $pun_config))437:         if (!array_key_exists('o_default_email_setting', $pun_config))
437:             $new_config[] = '\'o_default_email_setting\', \'1\'';438:             $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_default_email_setting\', \'1\')') or error('Unable to insert config value \'o_default_email_setting\'', __FILE__, __LINE__, $db->error());
438: 439: 
439:         // Make sure we have o_additional_navlinks (was added in 1.2.1)440:         // Make sure we have o_additional_navlinks (was added in 1.2.1)
440:         if (!array_key_exists('o_additional_navlinks', $pun_config))441:         if (!array_key_exists('o_additional_navlinks', $pun_config))
441:             $new_config[] = '\'o_additional_navlinks\', \'\'';442:             $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_additional_navlinks\', \'\')') or error('Unable to insert config value \'o_additional_navlinks\'', __FILE__, __LINE__, $db->error());
442: 443: 
443:         // Insert new config option o_topic_views444:         // Insert new config option o_topic_views
444:         if (!array_key_exists('o_topic_views', $pun_config))445:         if (!array_key_exists('o_topic_views', $pun_config))
445:             $new_config[] = '\'o_topic_views\', \'1\'';446:             $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_topic_views\', \'1\')') or error('Unable to insert config value \'o_topic_views\'', __FILE__, __LINE__, $db->error());
446: 447: 
447:         // Insert new config option o_signatures448:         // Insert new config option o_signatures
448:         if (!array_key_exists('o_signatures', $pun_config))449:         if (!array_key_exists('o_signatures', $pun_config))
449:             $new_config[] = '\'o_signatures\', \'1\'';450:             $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_signatures\', \'1\')') or error('Unable to insert config value \'o_signatures\'', __FILE__, __LINE__, $db->error());
450: 451: 
451:         // Insert new config option o_smtp_ssl452:         // Insert new config option o_smtp_ssl
452:         if (!array_key_exists('o_smtp_ssl', $pun_config))453:         if (!array_key_exists('o_smtp_ssl', $pun_config))
453:             $new_config[] = '\'o_smtp_ssl\', \'0\'';454:             $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_smtp_ssl\', \'0\')') or error('Unable to insert config value \'o_smtp_ssl\'', __FILE__, __LINE__, $db->error());
454: 455: 
455:         // Insert new config option o_default_dst456:         // Insert new config option o_default_dst
456:         if (!array_key_exists('o_default_dst', $pun_config))457:         if (!array_key_exists('o_default_dst', $pun_config))
457:             $new_config[] = '\'o_default_dst\', \'0\'';458:             $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_default_dst\', \'0\')') or error('Unable to insert config value \'o_default_dst\'', __FILE__, __LINE__, $db->error());
458: 459: 
 460:         // Insert new config option o_quote_depth
459:         if (!array_key_exists('o_quote_depth', $pun_config))461:         if (!array_key_exists('o_quote_depth', $pun_config))
460:             $new_config[] = '\'o_quote_depth\', \'3\'';462:             $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_quote_depth\', \'3\')') or error('Unable to insert config value \'o_quote_depth\'', __FILE__, __LINE__, $db->error());
 463: 
 464:         // Insert config option o_base_url which was removed in 1.3
 465:         if (!array_key_exists('o_base_url', $pun_config))
 466:         {
 467:             // If it isn't in $pun_config['o_base_url'] it should be in $base_url, but just in-case it isn't we can make a guess at it
 468:             if (!isset($base_url))
 469:                 $base_url = 'http://'.$_SERVER['SERVER_NAME'].str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME']));
 470: 
 471:             $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'o_base_url\', \''.$db->escape($base_url).'\')') or error('Unable to insert config value \'o_quote_depth\'', __FILE__, __LINE__, $db->error());
 472:         }
 473: 
 474:         if (strpos($cur_version, '1.2') === 0)
 475:         {
 476:             // Groups are almost the same as 1.2:
 477:             // unverified:    32000 -> 0
461: 478: 
462:         if (!empty($new_config))479:             $db->query('UPDATE '.$db->prefix.'users SET group_id = 0 WHERE group_id = 32000') or error('Unable to update unverified users', __FILE__, __LINE__, $db->error());
463:             $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES ('.implode('), (', $new_config).')') or error('Unable to insert config values', __FILE__, __LINE__, $db->error());480:         }
 481:         else if (strpos($cur_version, '1.3') === 0)
 482:         {
 483:             // Groups have changed quite a lot from 1.3:
 484:             // unverified:    0 -> 0
 485:             // admin:        1 -> 1
 486:             // mod:            ? -> 2
 487:             // guest:        2 -> 3
 488:             // member:        ? -> 4
464: 489: 
465:         unset($new_config);490:             $result = $db->query('SELECT MAX(g_id) + 1 FROM '.$db->prefix.'groups') or error('Unable to select temp group ID', __FILE__, __LINE__, $db->error());
 491:             $temp_id = $db->result($result);
 492: 
 493:             $result = $db->query('SELECT g_id FROM '.$db->prefix.'groups WHERE g_moderator = 1 AND g_id > 1 LIMIT 1') or error('Unable to select moderator group', __FILE__, __LINE__, $db->error());
 494:             if ($db->num_rows($result))
 495:                 $mod_gid = $db->result($result);
 496:             else
 497:             {
 498:                 $db->query('INSERT INTO '.$db->prefix.'groups (g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood) VALUES('."'Moderators', 'Moderator', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0)") or error('Unable to add group', __FILE__, __LINE__, $db->error());
 499:                 $mod_gid = $db->insert_id();
 500:             }
 501:             
 502:             $member_gid = $pun_config['o_default_user_group'];
 503: 
 504:             // move the mod group to a temp place
 505:             $db->query('UPDATE '.$db->prefix.'groups SET g_id = '.$temp_id.' WHERE g_id = '.$mod_gid) or error('Unable to update group ID', __FILE__, __LINE__, $db->error());
 506:             $db->query('UPDATE '.$db->prefix.'users SET group_id = '.$temp_id.' WHERE group_id = '.$mod_gid) or error('Unable to update users group ID', __FILE__, __LINE__, $db->error());
 507:             $db->query('UPDATE '.$db->prefix.'forum_perms SET group_id = '.$temp_id.' WHERE group_id = '.$mod_gid) or error('Unable to forum_perms group ID', __FILE__, __LINE__, $db->error());
 508:             if ($member_gid == $mod_gid) $member_gid = $temp_id;
 509: 
 510:             // move whoever is in 3 to a spare slot
 511:             $db->query('UPDATE '.$db->prefix.'groups SET g_id = '.$mod_gid.' WHERE g_id = 3') or error('Unable to update group ID', __FILE__, __LINE__, $db->error());
 512:             $db->query('UPDATE '.$db->prefix.'users SET group_id = '.$mod_gid.' WHERE group_id = 3') or error('Unable to update users group ID', __FILE__, __LINE__, $db->error());
 513:             $db->query('UPDATE '.$db->prefix.'forum_perms SET group_id = '.$mod_gid.' WHERE group_id = 3') or error('Unable to forum_perms group ID', __FILE__, __LINE__, $db->error());
 514:             if ($member_gid == 3) $member_gid = $mod_gid;
 515: 
 516:             // move guest to 3
 517:             $db->query('UPDATE '.$db->prefix.'groups SET g_id = 3 WHERE g_id = 2') or error('Unable to update group ID', __FILE__, __LINE__, $db->error());
 518:             $db->query('UPDATE '.$db->prefix.'users SET group_id = 3 WHERE group_id = 2') or error('Unable to update users group ID', __FILE__, __LINE__, $db->error());
 519:             $db->query('UPDATE '.$db->prefix.'forum_perms SET group_id = 3 WHERE group_id = 2') or error('Unable to forum_perms group ID', __FILE__, __LINE__, $db->error());
 520:             if ($member_gid == 2) $member_gid = 3;
 521: 
 522:             // move mod group in temp place to 2
 523:             $db->query('UPDATE '.$db->prefix.'groups SET g_id = 2 WHERE g_id = '.$temp_id) or error('Unable to update group ID', __FILE__, __LINE__, $db->error());
 524:             $db->query('UPDATE '.$db->prefix.'users SET group_id = 2 WHERE group_id = '.$temp_id) or error('Unable to update users group ID', __FILE__, __LINE__, $db->error());
 525:             $db->query('UPDATE '.$db->prefix.'forum_perms SET group_id = 2 WHERE group_id = '.$temp_id) or error('Unable to forum_perms group ID', __FILE__, __LINE__, $db->error());
 526:             if ($member_gid == $temp_id) $member_gid = 2;
 527:             
 528:             // Only move stuff around if it isn't already in the right place
 529:             if ($member_gid != $mod_gid || $member_gid != 4)
 530:             {
 531:                 // move members to temp place
 532:                 $db->query('UPDATE '.$db->prefix.'groups SET g_id = '.$temp_id.' WHERE g_id = '.$member_gid) or error('Unable to update group ID', __FILE__, __LINE__, $db->error());
 533:                 $db->query('UPDATE '.$db->prefix.'users SET group_id = '.$temp_id.' WHERE group_id = '.$member_gid) or error('Unable to update users group ID', __FILE__, __LINE__, $db->error());
 534:                 $db->query('UPDATE '.$db->prefix.'forum_perms SET group_id = '.$temp_id.' WHERE group_id = '.$member_gid) or error('Unable to forum_perms group ID', __FILE__, __LINE__, $db->error());
 535: 
 536:                 // move whoever is in 4 to members place
 537:                 $db->query('UPDATE '.$db->prefix.'groups SET g_id = '.$member_gid.' WHERE g_id = 4') or error('Unable to update group ID', __FILE__, __LINE__, $db->error());
 538:                 $db->query('UPDATE '.$db->prefix.'users SET group_id = '.$member_gid.' WHERE group_id = 4') or error('Unable to update users group ID', __FILE__, __LINE__, $db->error());
 539:                 $db->query('UPDATE '.$db->prefix.'forum_perms SET group_id = '.$member_gid.' WHERE group_id = 4') or error('Unable to forum_perms group ID', __FILE__, __LINE__, $db->error());
 540: 
 541:                 // move members in temp place to 4
 542:                 $db->query('UPDATE '.$db->prefix.'groups SET g_id = 4 WHERE g_id = '.$temp_id) or error('Unable to update group ID', __FILE__, __LINE__, $db->error());
 543:                 $db->query('UPDATE '.$db->prefix.'users SET group_id = 4 WHERE group_id = '.$temp_id) or error('Unable to update users group ID', __FILE__, __LINE__, $db->error());
 544:                 $db->query('UPDATE '.$db->prefix.'forum_perms SET group_id = 4 WHERE group_id = '.$temp_id) or error('Unable to forum_perms group ID', __FILE__, __LINE__, $db->error());
 545:             }
 546:         }
466: 547: 
467:         // Server timezone is now simply the default timezone548:         // Server time zone is now simply the default time zone
468:         if (!array_key_exists('o_default_timezone', $pun_config))549:         if (!array_key_exists('o_default_timezone', $pun_config))
469:             $db->query('UPDATE '.$db->prefix.'config SET conf_name = \'o_default_timezone\' WHERE conf_name = \'o_server_timezone\'') or error('Unable to update timezone config', __FILE__, __LINE__, $db->error());550:             $db->query('UPDATE '.$db->prefix.'config SET conf_name = \'o_default_timezone\' WHERE conf_name = \'o_server_timezone\'') or error('Unable to update time zone config', __FILE__, __LINE__, $db->error());
470: 551: 
471:         // Increase visit timeout to 30 minutes (only if it hasn't been changed from the default)552:         // Increase visit timeout to 30 minutes (only if it hasn't been changed from the default)
472:         if (!array_key_exists('o_database_revision', $pun_config) && $pun_config['o_timeout_visit'] == '600')553:         if (!array_key_exists('o_database_revision', $pun_config) && $pun_config['o_timeout_visit'] == '600')
563:                 break;644:                 break;
564:         }645:         }
565: 646: 
566:         // Add an index to logged on the online table647:         // Add an index to logged in the online table
567:         $db->add_index('online', 'logged_idx', array('logged'));648:         $db->add_index('online', 'logged_idx', array('logged'));
568: 649: 
569:         // Add an index on last_post in the topics table650:         // Add an index to last_post in the topics table
570:         $db->add_index('topics', 'last_post_idx', array('last_post'));651:         $db->add_index('topics', 'last_post_idx', array('last_post'));
571: 652: 
572:         // Add g_view_users field to groups table653:         // Add g_view_users field to groups table
591:             $db->add_field('topics', 'first_post_id', 'INT(10) UNSIGNED', false, 0, 'posted');672:             $db->add_field('topics', 'first_post_id', 'INT(10) UNSIGNED', false, 0, 'posted');
592:             $db->add_index('topics', 'first_post_id_idx', array('first_post_id'));673:             $db->add_index('topics', 'first_post_id_idx', array('first_post_id'));
593: 674: 
594:             // Now that we've added the column and indexed it, we need to give it correct data\675:             // Now that we've added the column and indexed it, we need to give it correct data
595:             $result = $db->query('SELECT MIN(id) AS first_post, topic_id FROM '.$db->prefix.'posts GROUP BY topic_id') or error('Unable to fetch first_post_id', __FILE__, __LINE__, $db->error());676:             $result = $db->query('SELECT MIN(id) AS first_post, topic_id FROM '.$db->prefix.'posts GROUP BY topic_id') or error('Unable to fetch first_post_id', __FILE__, __LINE__, $db->error());
596: 677: 
597:             while ($cur_post = $db->fetch_assoc($result))678:             while ($cur_post = $db->fetch_assoc($result))
607:         $db->add_field('bans', 'ban_creator', 'INT(10) UNSIGNED', false, 0);688:         $db->add_field('bans', 'ban_creator', 'INT(10) UNSIGNED', false, 0);
608: 689: 
609:         // Add the time/date format settings to the user table690:         // Add the time/date format settings to the user table
610:         $db->add_field('users', 'time_format', 'INT(10) UNSIGNED', false, 0, 'dst');691:         $db->add_field('users', 'time_format', 'TINYINT(1)', false, 0, 'dst');
611:         $db->add_field('users', 'date_format', 'INT(10) UNSIGNED', false, 0, 'dst');692:         $db->add_field('users', 'date_format', 'TINYINT(1)', false, 0, 'dst');
612: 693: 
613:         // Should we do charset conversion or not?694:         // Should we do charset conversion or not?
614:         if (strpos($cur_version, '1.2') === 0 && isset($_GET['convert_charset']))695:         if (strpos($cur_version, '1.2') === 0 && isset($_GET['convert_charset']))
615:             $query_str = '?stage=conv_misc&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE;696:             $query_str = '?stage=conv_misc&req_old_charset='.$old_charset;
616:         else697:         else
617:             $query_str = '?stage=conv_tables';698:             $query_str = '?stage=conv_tables';
618:         break;699:         break;
709:             }790:             }
710:         }791:         }
711: 792: 
712:         $query_str = '?stage=conv_reports&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE;793:         $query_str = '?stage=conv_reports&req_old_charset='.$old_charset;
713:         break;794:         break;
714: 795: 
715: 796: 
747:         $result = $db->query('SELECT id FROM '.$db->prefix.'reports WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());828:         $result = $db->query('SELECT id FROM '.$db->prefix.'reports WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());
748: 829: 
749:         if ($db->num_rows($result))830:         if ($db->num_rows($result))
750:             $query_str = '?stage=conv_reports&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE.'&start_at='.$db->result($result);831:             $query_str = '?stage=conv_reports&req_old_charset='.$old_charset.'&start_at='.$db->result($result);
751:         else832:         else
752:             $query_str = '?stage=conv_search_words&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE;833:             $query_str = '?stage=conv_search_words&req_old_charset='.$old_charset;
753:         break;834:         break;
754: 835: 
755: 836: 
788:         $result = $db->query('SELECT id FROM '.$db->prefix.'search_words WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());869:         $result = $db->query('SELECT id FROM '.$db->prefix.'search_words WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());
789: 870: 
790:         if ($db->num_rows($result))871:         if ($db->num_rows($result))
791:             $query_str = '?stage=conv_search_words&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE.'&start_at='.$db->result($result);872:             $query_str = '?stage=conv_search_words&req_old_charset='.$old_charset.'&start_at='.$db->result($result);
792:         else873:         else
793:             $query_str = '?stage=conv_users&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE;874:             $query_str = '?stage=conv_users&req_old_charset='.$old_charset;
794:         break;875:         break;
795: 876: 
796: 877: 
830:         $result = $db->query('SELECT id FROM '.$db->prefix.'users WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());911:         $result = $db->query('SELECT id FROM '.$db->prefix.'users WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());
831: 912: 
832:         if ($db->num_rows($result))913:         if ($db->num_rows($result))
833:             $query_str = '?stage=conv_users&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE.'&start_at='.$db->result($result);914:             $query_str = '?stage=conv_users&req_old_charset='.$old_charset.'&start_at='.$db->result($result);
834:         else915:         else
835:             $query_str = '?stage=conv_topics&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE;916:             $query_str = '?stage=conv_topics&req_old_charset='.$old_charset;
836:         break;917:         break;
837: 918: 
838: 919: 
871:         $result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());952:         $result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());
872: 953: 
873:         if ($db->num_rows($result))954:         if ($db->num_rows($result))
874:             $query_str = '?stage=conv_topics&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE.'&start_at='.$db->result($result);955:             $query_str = '?stage=conv_topics&req_old_charset='.$old_charset.'&start_at='.$db->result($result);
875:         else956:         else
876:             $query_str = '?stage=conv_posts&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE;957:             $query_str = '?stage=conv_posts&req_old_charset='.$old_charset;
877:         break;958:         break;
878: 959: 
879: 960: 
914:         $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());995:         $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());
915: 996: 
916:         if ($db->num_rows($result))997:         if ($db->num_rows($result))
917:             $query_str = '?stage=conv_posts&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE.'&start_at='.$db->result($result);998:             $query_str = '?stage=conv_posts&req_old_charset='.$old_charset.'&start_at='.$db->result($result);
918:         else999:         else
919:             $query_str = '?stage=conv_tables';1000:             $query_str = '?stage=conv_tables';
920:         break;1001:         break;
922: 1003: 
923:     // Convert table columns to utf8 (MySQL only)1004:     // Convert table columns to utf8 (MySQL only)
924:     case 'conv_tables':1005:     case 'conv_tables':
925:         // Do the cumbersome charset conversion of MySQL tables/columns1006:         // Do the cumbersome charset conversion of MySQL tables/columns (if required - i.e. running 1.2)
926:         if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')1007:         if (strpos($cur_version, '1.2') === 0 && ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb'))
927:         {1008:         {
928:             echo 'Converting table '.$db->prefix.'bans …<br />'."\n"; flush();1009:             echo 'Converting table '.$db->prefix.'bans …<br />'."\n"; flush();
929:             convert_table_utf8($db->prefix.'bans');1010:             convert_table_utf8($db->prefix.'bans');
961:             convert_table_utf8($db->prefix.'users');1042:             convert_table_utf8($db->prefix.'users');
962:         }1043:         }
963: 1044: 
964:         $query_str = '?stage=finish';1045:         $query_str = '?stage=preparse_posts';
 1046:         break;
 1047: 
 1048: 
 1049:     // Preparse posts
 1050:     case 'preparse_posts':
 1051:         require PUN_ROOT.'include/parser.php';
 1052: 
 1053:         // Now we're definitely using UTF-8, so we convert the output properly
 1054:         $db->set_names('utf8');
 1055: 
 1056:         // Determine where to start
 1057:         if ($start_at == 0)
 1058:         {
 1059:             // Get the first post ID from the db
 1060:             $result = $db->query('SELECT id FROM '.$db->prefix.'posts ORDER BY id LIMIT 1') or error('Unable to fetch first post ID', __FILE__, __LINE__, $db->error());
 1061: 
 1062:             if ($db->num_rows($result))
 1063:                 $start_at = $db->result($result);
 1064:         }
 1065:         $end_at = $start_at + PER_PAGE;
 1066: 
 1067:         // Fetch posts to process this cycle
 1068:         $result = $db->query('SELECT id, message FROM '.$db->prefix.'posts WHERE id >= '.$start_at.' AND id < '.$end_at.' ORDER BY id') or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());
 1069: 
 1070:         $temp = array();
 1071:         while ($cur_item = $db->fetch_assoc($result))
 1072:         {
 1073:             echo 'Preparsing post '.$cur_item['id'].' …<br />'."\n";
 1074:             $db->query('UPDATE '.$db->prefix.'posts SET message = \''.$db->escape(preparse_bbcode($cur_item['message'], $temp)).'\' WHERE id = '.$cur_item['id']) or error('Unable to update post', __FILE__, __LINE__, $db->error());
 1075:         }
 1076: 
 1077:         // Check if there is more work to do
 1078:         $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());
 1079: 
 1080:         if ($db->num_rows($result))
 1081:             $query_str = '?stage=preparse_posts&start_at='.$db->result($result);
 1082:         else
 1083:             $query_str = '?stage=preparse_sigs';
 1084:         break;
 1085:     
 1086: 
 1087:     // Preparse signatures
 1088:     case 'preparse_sigs':
 1089:         require PUN_ROOT.'include/parser.php';
 1090: 
 1091:         // Now we're definitely using UTF-8, so we convert the output properly
 1092:         $db->set_names('utf8');
 1093: 
 1094:         // Determine where to start
 1095:         if ($start_at == 0)
 1096:             $start_at = 2;
 1097: 
 1098:         $end_at = $start_at + PER_PAGE;
 1099: 
 1100:         // Fetch users to process this cycle
 1101:         $result = $db->query('SELECT id, signature FROM '.$db->prefix.'users WHERE id >= '.$start_at.' AND id < '.$end_at.' ORDER BY id') or error('Unable to fetch users', __FILE__, __LINE__, $db->error());
 1102: 
 1103:         $temp = array();
 1104:         while ($cur_item = $db->fetch_assoc($result))
 1105:         {
 1106:             echo 'Preparsing signature '.$cur_item['id'].' …<br />'."\n";
 1107:             $db->query('UPDATE '.$db->prefix.'users SET signature = \''.$db->escape(preparse_bbcode($cur_item['signature'], $temp, true)).'\' WHERE id = '.$cur_item['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
 1108:         }
 1109: 
 1110:         // Check if there is more work to do
 1111:         $result = $db->query('SELECT id FROM '.$db->prefix.'users WHERE id >= '.$end_at.' ORDER BY id LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());
 1112: 
 1113:         if ($db->num_rows($result))
 1114:             $query_str = '?stage=preparse_sigs&start_at='.$db->result($result);
 1115:         else
 1116:             $query_str = '?stage=finish';
965:         break;1117:         break;
 1118:     
966: 1119: 
967:     // Show results page1120:     // Show results page
968:     case 'finish':1121:     case 'finish':


a/upload/delete.php b/upload/delete.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: define('PUN_ROOT', './'); 11: define('PUN_ROOT', './');
 27: require PUN_ROOT.'include/common.php'; 12: require PUN_ROOT.'include/common.php';
 95: ?> 80: ?>
 96: <div class="linkst"> 81: <div class="linkst">
 97:     <div class="inbox"> 82:     <div class="inbox">
 98:         <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li>&nbsp;&raquo;&nbsp;<a href="viewforum.php?id=<?php echo $cur_post['fid'] ?>"><?php echo pun_htmlspecialchars($cur_post['forum_name']) ?></a></li><li>&nbsp;&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_post['subject']) ?></li></ul> 83:         <ul class="crumbs">
  84:             <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
  85:             <li>&raquo;&nbsp;<a href="viewforum.php?id=<?php echo $cur_post['fid'] ?>"><?php echo pun_htmlspecialchars($cur_post['forum_name']) ?></a></li>
  86:             <li>&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_post['subject']) ?></li>
  87:         </ul>
 99:     </div> 88:     </div>
100: </div> 89: </div>
101:  90: 
104:     <div class="box"> 93:     <div class="box">
105:         <form method="post" action="delete.php?id=<?php echo $id ?>"> 94:         <form method="post" action="delete.php?id=<?php echo $id ?>">
106:             <div class="inform"> 95:             <div class="inform">
107:                 <fieldset> 96:                 <p><strong><?php echo $lang_delete['Warning'] ?></strong></p>
108:                     <legend class="warntext"><?php echo $lang_delete['Warning'] ?></legend> 97:                 <p><strong><?php echo $lang_common['Author'] ?></strong>: <?php echo pun_htmlspecialchars($cur_post['poster']) ?></p>
109:                     <div class="infldset"> 98:                 <p><strong><?php echo $lang_common['Message'] ?></strong>:</p>
110:                         <div class="postmsg"> 99:                 <div class="deletemsg">
111:                             <p><?php echo $lang_common['Author'] ?>: <strong><?php echo pun_htmlspecialchars($cur_post['poster']) ?></strong></p>100:                     <div class="postmsg">
112:                             <?php echo $cur_post['message'] ?>101:                         <?php echo $cur_post['message']."\n" ?>
113:                         </div> 
114:                     </div>102:                     </div>
115:                 </fieldset>103:                 </div>
116:             </div>104:             </div>
117:             <p><input type="submit" name="delete" value="<?php echo $lang_delete['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>105:             <p class="buttons"><input type="submit" name="delete" value="<?php echo $lang_delete['Delete'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
118:         </form>106:         </form>
119:     </div>107:     </div>
120: </div>108: </div>


a/upload/edit.php b/upload/edit.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: define('PUN_ROOT', './'); 11: define('PUN_ROOT', './');
 27: require PUN_ROOT.'include/common.php'; 12: require PUN_ROOT.'include/common.php';
 67:     if ($is_admmod) 52:     if ($is_admmod)
 68:         confirm_referrer('edit.php'); 53:         confirm_referrer('edit.php');
 69:  54: 
 70:     // If it is a topic it must contain a subject 55:     // If it's a topic it must contain a subject
 71:     if ($can_edit_subject) 56:     if ($can_edit_subject)
 72:     { 57:     {
 73:         $subject = pun_trim($_POST['req_subject']); 58:         $subject = pun_trim($_POST['req_subject']);
 76:             $errors[] = $lang_post['No subject']; 61:             $errors[] = $lang_post['No subject'];
 77:         else if (pun_strlen($subject) > 70) 62:         else if (pun_strlen($subject) > 70)
 78:             $errors[] = $lang_post['Too long subject']; 63:             $errors[] = $lang_post['Too long subject'];
 79:         else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($subject) == $subject && !$pun_user['is_admmod']) 64:         else if ($pun_config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$pun_user['is_admmod'])
 80:             $subject = ucwords(strtolower($subject)); 65:             $errors[] = $lang_post['All caps subject'];
 81:     } 66:     }
 82:  67: 
 83:     // Clean up message from POST 68:     // Clean up message from POST
 87:         $errors[] = $lang_post['No message']; 72:         $errors[] = $lang_post['No message'];
 88:     else if (strlen($message) > 65535) 73:     else if (strlen($message) > 65535)
 89:         $errors[] = $lang_post['Too long message']; 74:         $errors[] = $lang_post['Too long message'];
 90:     else if ($pun_config['p_message_all_caps'] == '0' && strtoupper($message) == $message && !$pun_user['is_admmod']) 75:     else if ($pun_config['p_message_all_caps'] == '0' && is_all_uppercase($message) && !$pun_user['is_admmod'])
 91:         $message = ucwords(strtolower($message)); 76:         $errors[] = $lang_post['All caps message'];
 92:  77: 
 93:     // Validate BBCode syntax 78:     // Validate BBCode syntax
 94:     if ($pun_config['p_message_bbcode'] == '1' && strpos($message, '[') !== false && strpos($message, ']') !== false) 79:     if ($pun_config['p_message_bbcode'] == '1')
 95:     { 80:     {
 96:         require PUN_ROOT.'include/parser.php'; 81:         require PUN_ROOT.'include/parser.php';
 97:         $message = preparse_bbcode($message, $errors); 82:         $message = preparse_bbcode($message, $errors);
119:             update_search_index('edit', $id, $message);104:             update_search_index('edit', $id, $message);
120: 105: 
121:         // Update the post106:         // Update the post
122:         $db->query('UPDATE '.$db->prefix.'posts SET message=\''.$db->escape($message).'\', hide_smilies=\''.$hide_smilies.'\''.$edited_sql.' WHERE id='.$id) or error('Unable to update post', __FILE__, __LINE__, $db->error());107:         $db->query('UPDATE '.$db->prefix.'posts SET message=\''.$db->escape($message).'\', hide_smilies='.$hide_smilies.$edited_sql.' WHERE id='.$id) or error('Unable to update post', __FILE__, __LINE__, $db->error());
123: 108: 
124:         redirect('viewtopic.php?pid='.$id.'#p'.$id, $lang_post['Edit redirect']);109:         redirect('viewtopic.php?pid='.$id.'#p'.$id, $lang_post['Edit redirect']);
125:     }110:     }
137: ?>122: ?>
138: <div class="linkst">123: <div class="linkst">
139:     <div class="inbox">124:     <div class="inbox">
140:         <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li>&nbsp;&raquo;&nbsp;<a href="viewforum.php?id=<?php echo $cur_post['fid'] ?>"><?php echo pun_htmlspecialchars($cur_post['forum_name']) ?></a></li><li>&nbsp;&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_post['subject']) ?></li></ul>125:         <ul class="crumbs">
 126:             <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
 127:             <li>&raquo;&nbsp;<a href="viewforum.php?id=<?php echo $cur_post['fid'] ?>"><?php echo pun_htmlspecialchars($cur_post['forum_name']) ?></a></li>
 128:             <li>&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_post['subject']) ?></li>
 129:         </ul>
141:     </div>130:     </div>
142: </div>131: </div>
143: 132: 
177:     <h2><span><?php echo $lang_post['Post preview'] ?></span></h2>166:     <h2><span><?php echo $lang_post['Post preview'] ?></span></h2>
178:     <div class="box">167:     <div class="box">
179:         <div class="inbox">168:         <div class="inbox">
180:             <div class="postright">169:             <div class="postbody">
181:                 <div class="postmsg">170:                 <div class="postright">
182:                     <?php echo $preview_message."\n" ?>171:                     <div class="postmsg">
 172:                         <?php echo $preview_message."\n" ?>
 173:                     </div>
183:                 </div>174:                 </div>
184:             </div>175:             </div>
185:         </div>176:         </div>
250: 241: 
251: ?>242: ?>
252:             </div>243:             </div>
253:             <p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>244:             <p class="buttons"><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /> <input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
254:         </form>245:         </form>
255:     </div>246:     </div>
256: </div>247: </div>


a/upload/extern.php b/upload/extern.php
  1: <?php  1: <?php
  2: /**  2: 
  3:  * External syndication script  3: /*---
  4:  *  4: 
  5:  * Allows forum content to be syndicated outside of the site in various formats  5:     Copyright (C) 2008-2009 FluxBB.org
  6:  * (ie: RSS, Atom, XML, HTML).  6:     based on code copyright (C) 2002-2008 PunBB.org
  7:  *  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  8:  * @copyright Copyright (C) 2008 FluxBB.org, based on code copyright (C) 2002-2008 PunBB.org  8: 
  9:  * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher  9: ---*/
 10:  * @package FluxBB 10: 
 11:  */ 11: /*-----------------------------------------------------------------------------
 12:  
 13: /*********************************************************************** 
 14:  12: 
 15:   INSTRUCTIONS 13:   INSTRUCTIONS
 16:  14: 
 24:  22: 
 25:   The scripts behaviour is controlled via variables supplied in the 23:   The scripts behaviour is controlled via variables supplied in the
 26:   URL to the script. The different variables are: action (what to 24:   URL to the script. The different variables are: action (what to
 27:   do), show (how many items to display), fid (the ID or ID's of 25:   do), show (how many items to display), fid (the ID or IDs of
 28:   the forum(s) to poll for topics), nfid (the ID or ID's of forums 26:   the forum(s) to poll for topics), nfid (the ID or IDs of forums
 29:   that should be excluded), tid (the ID of the topic from which to 27:   that should be excluded), tid (the ID of the topic from which to
 30:   display posts) and type (output as HTML or RSS). The only 28:   display posts) and type (output as HTML or RSS). The only
 31:   mandatory variable is action. Possible/default values are: 29:   mandatory variable is action. Possible/default values are:
 40:             xml - output as XML 38:             xml - output as XML
 41:             html - output as HTML (<li>'s) 39:             html - output as HTML (<li>'s)
 42:  40: 
 43:     fid:    One or more forum ID's (comma-separated). If ignored, 41:     fid:    One or more forum IDs (comma-separated). If ignored,
 44:             topics from all readable forums will be pulled. 42:             topics from all readable forums will be pulled.
 45:  43: 
 46:     nfid:   One or more forum ID's (comma-separated) that are to be 44:     nfid:   One or more forum IDs (comma-separated) that are to be
 47:             excluded. E.g. the ID of a a test forum. 45:             excluded. E.g. the ID of a a test forum.
 48:  46: 
 49:     tid:    A topic ID from which to show posts. If a tid is supplied, 47:     tid:    A topic ID from which to show posts. If a tid is supplied,
 56:             posted - show topics ordered by when they were first 54:             posted - show topics ordered by when they were first
 57:                      posted, giving information about the original post. 55:                      posted, giving information about the original post.
 58:  56: 
 59:  57: -----------------------------------------------------------------------------*/
 60: /***********************************************************************/ 
 61:  58: 
 62: define('PUN_QUIET_VISIT', 1); 59: define('PUN_QUIET_VISIT', 1);
 63:  60: 
 67:  64: 
 68: // The length at which topic subjects will be truncated (for HTML output) 65: // The length at which topic subjects will be truncated (for HTML output)
 69: if (!defined('FORUM_EXTERN_MAX_SUBJECT_LENGTH')) 66: if (!defined('FORUM_EXTERN_MAX_SUBJECT_LENGTH'))
 70:     define('FORUM_EXTERN_MAX_SUBJECT_LENGTH', 30); 67:     define('FORUM_EXTERN_MAX_SUBJECT_LENGTH', 30);
 71:  68: 
 72: // If we're a guest and we've sent a username/pass, we can try to authenticate using those details 69: // If we're a guest and we've sent a username/pass, we can try to authenticate using those details
 73: if ($pun_user['is_guest'] && isset($_SERVER['PHP_AUTH_USER'])) 70: if ($pun_user['is_guest'] && isset($_SERVER['PHP_AUTH_USER']))
267: // Show recent discussions264: // Show recent discussions
268: if ($action == 'feed')265: if ($action == 'feed')
269: {266: {
 267:     require PUN_ROOT.'include/parser.php';
 268: 
270:     // Determine what type of feed to output269:     // Determine what type of feed to output
271:     $type = isset($_GET['type']) && in_array($_GET['type'], array('html', 'rss', 'atom', 'xml')) ? $_GET['type'] : 'html';270:     $type = isset($_GET['type']) && in_array($_GET['type'], array('html', 'rss', 'atom', 'xml')) ? $_GET['type'] : 'html';
272: 271: 
302:         );301:         );
303: 302: 
304:         // Fetch $show posts303:         // Fetch $show posts
305:         $result = $db->query('SELECT p.id, p.poster, p.message, p.posted, p.poster_id, u.email_setting, u.email, p.poster_email FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id WHERE p.topic_id='.$tid.' ORDER BY p.posted DESC LIMIT '.$show) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());304:         $result = $db->query('SELECT p.id, p.poster, p.message, p.hide_smilies, p.posted, p.poster_id, u.email_setting, u.email, p.poster_email FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id WHERE p.topic_id='.$tid.' ORDER BY p.posted DESC LIMIT '.$show) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
306:         while ($cur_post = $db->fetch_assoc($result))305:         while ($cur_post = $db->fetch_assoc($result))
307:         {306:         {
308:             if ($pun_config['o_censoring'] == '1')307:             $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
309:                 $cur_post['message'] = censor_words($cur_post['message']); 
310: 308: 
311:             $item = array(309:             $item = array(
312:                 'id'            =>    $cur_post['id'],310:                 'id'            =>    $cur_post['id'],
340:         $order_posted = isset($_GET['order']) && $_GET['order'] == 'posted';338:         $order_posted = isset($_GET['order']) && $_GET['order'] == 'posted';
341:         $forum_name = '';339:         $forum_name = '';
342:         $forum_sql = '';340:         $forum_sql = '';
343:         341: 
344:         // Were any forum ID's supplied?342:         // Were any forum IDs supplied?
345:         if (isset($_GET['fid']) && is_scalar($_GET['fid']) && $_GET['fid'] != '')343:         if (isset($_GET['fid']) && is_scalar($_GET['fid']) && $_GET['fid'] != '')
346:         {344:         {
347:             $fids = explode(',', pun_trim($_GET['fid']));345:             $fids = explode(',', pun_trim($_GET['fid']));
355:             // Fetch forum name353:             // Fetch forum name
356:             $result = $db->query('SELECT f.forum_name FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fids[0]) or error('Unable to fetch forum name', __FILE__, __LINE__, $db->error());354:             $result = $db->query('SELECT f.forum_name FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fids[0]) or error('Unable to fetch forum name', __FILE__, __LINE__, $db->error());
357:             if ($db->num_rows($result))355:             if ($db->num_rows($result))
358:                 $forum_name = $lang_common['Title separator'].$db->result($result);356:                 $forum_name = ' '.$db->result($result);
359:             }357:             }
360:         }358:         }
361: 359: 
362:         // Any forum ID's to exclude?360:         // Any forum IDs to exclude?
363:         if (isset($_GET['nfid']) && is_scalar($_GET['nfid']) && $_GET['nfid'] != '')361:         if (isset($_GET['nfid']) && is_scalar($_GET['nfid']) && $_GET['nfid'] != '')
364:         {362:         {
365:             $nfids = explode(',', pun_trim($_GET['nfid']));363:             $nfids = explode(',', pun_trim($_GET['nfid']));
373:         $feed = array(371:         $feed = array(
374:             'title'         =>    $pun_config['o_board_title'].$forum_name,372:             'title'         =>    $pun_config['o_board_title'].$forum_name,
375:             'link'            =>    $pun_config['o_base_url'].'/index.php',373:             'link'            =>    $pun_config['o_base_url'].'/index.php',
376:             'description'        =>    sprintf($lang_common['RSS description'], $pun_config['o_board_title']),374:             'description'    =>    sprintf($lang_common['RSS description'], $pun_config['o_board_title']),
377:             'items'            =>    array(),375:             'items'            =>    array(),
378:             'type'            =>    'topics'376:             'type'            =>    'topics'
379:         );377:         );
380: 378: 
381:         // Fetch $show topics379:         // Fetch $show topics
382:         $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_poster, p.message, u.email_setting, u.email, p.poster_id, p.poster_email FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.id='.($order_posted ? 't.first_post_id' : 't.last_post_id').' INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.($order_posted ? 't.posted' : 't.last_post').' DESC LIMIT '.$show) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());380:         $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_poster, p.message, p.hide_smilies, u.email_setting, u.email, p.poster_id, p.poster_email FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.id='.($order_posted ? 't.first_post_id' : 't.last_post_id').' INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.($order_posted ? 't.posted' : 't.last_post').' DESC LIMIT '.$show) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
383:         while ($cur_topic = $db->fetch_assoc($result))381:         while ($cur_topic = $db->fetch_assoc($result))
384:         {382:         {
 383:             $cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']);
 384: 
385:             if ($pun_config['o_censoring'] == '1')385:             if ($pun_config['o_censoring'] == '1')
386:             { 
387:                 $cur_topic['subject'] = censor_words($cur_topic['subject']);386:                 $cur_topic['subject'] = censor_words($cur_topic['subject']);
388:                 $cur_topic['message'] = censor_words($cur_topic['message']); 
389:             } 
390: 387: 
391:             $item = array(388:             $item = array(
392:                 'id'            =>    $cur_topic['id'],389:                 'id'            =>    $cur_topic['id'],
393:                 'title'            =>    $cur_topic['subject'],390:                 'title'            =>    $cur_topic['subject'],
394:                 'link'            =>    $pun_config['o_base_url'].($order_posted ? '/viewtopic.php?id='.$cur_topic['id'] : '/viewtopic.php?id='.$cur_topic['id'].'&amp;action=new'),391:                 'link'            =>    $pun_config['o_base_url'].($order_posted ? '/viewtopic.php?id='.$cur_topic['id'] : '/viewtopic.php?id='.$cur_topic['id'].'&amp;action=new'),
395:                 'description'        =>    $cur_topic['message'],392:                 'description'    =>    $cur_topic['message'],
396:                 'author'        =>    array(393:                 'author'        =>    array(
397:                     'name'    => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster']394:                     'name'    => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster']
398:                 ),395:                 ),
430:     $users = array();427:     $users = array();
431: 428: 
432:     $result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());429:     $result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
433:     430: 
434:     while ($pun_user_online = $db->fetch_assoc($result))431:     while ($pun_user_online = $db->fetch_assoc($result))
435:     {432:     {
436:         if ($pun_user_online['user_id'] > 1)433:         if ($pun_user_online['user_id'] > 1)
447:     header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');444:     header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
448:     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');445:     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
449:     header('Pragma: public');446:     header('Pragma: public');
450:     447: 
451:     echo $lang_index['Guests online'].': '.forum_number_format($num_guests).'<br />'."\n";448:     echo $lang_index['Guests online'].': '.forum_number_format($num_guests).'<br />'."\n";
452: 449: 
453:     if ($action == 'online_full' && !empty($users))450:     if ($action == 'online_full' && !empty($users))
473: 470: 
474:     $result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error());471:     $result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error());
475:     list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result);472:     list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result);
476:     473: 
477:     // Send the Content-type header in case the web server is setup to send something else474:     // Send the Content-type header in case the web server is setup to send something else
478:     header('Content-type: text/html; charset=utf-8');475:     header('Content-type: text/html; charset=utf-8');
479:     header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');476:     header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
484:     echo $lang_index['Newest user'].': '.(($pun_user['g_view_users'] == '1') ? '<a href="'.$pun_config['o_base_url'].'/profile.php?id='.$stats['last_user']['id'].'">'.pun_htmlspecialchars($stats['last_user']['username']).'</a>' : pun_htmlspecialchars($stats['last_user']['username'])).'<br />'."\n";481:     echo $lang_index['Newest user'].': '.(($pun_user['g_view_users'] == '1') ? '<a href="'.$pun_config['o_base_url'].'/profile.php?id='.$stats['last_user']['id'].'">'.pun_htmlspecialchars($stats['last_user']['username']).'</a>' : pun_htmlspecialchars($stats['last_user']['username'])).'<br />'."\n";
485:     echo $lang_index['No of topics'].': '.forum_number_format($stats['total_topics']).'<br />'."\n";482:     echo $lang_index['No of topics'].': '.forum_number_format($stats['total_topics']).'<br />'."\n";
486:     echo $lang_index['No of posts'].': '.forum_number_format($stats['total_posts']).'<br />'."\n";483:     echo $lang_index['No of posts'].': '.forum_number_format($stats['total_posts']).'<br />'."\n";
487:     484: 
488:     exit;485:     exit;
489: }486: }
490: 487: 


a/upload/footer.php b/upload/footer.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Make sure no one attempts to run this script "directly" 11: // Make sure no one attempts to run this script "directly"
 27: if (!defined('PUN')) 12: if (!defined('PUN'))
 50: { 35: {
 51:     if (!$pun_user['is_guest'] && $pun_user['g_search'] == '1') 36:     if (!$pun_user['is_guest'] && $pun_user['g_search'] == '1')
 52:     { 37:     {
 53:         echo "\n\t\t\t".'<dl id="searchlinks" class="conl">'."\n\t\t\t\t".'<dt><strong>'.$lang_common['Search links'].'</strong></dt>'."\n\t\t\t\t".'<dd><a href="search.php?action=show_24h">'.$lang_common['Show recent posts'].'</a></dd>'."\n"; 38:         echo "\t\t\t".'<dl id="searchlinks" class="conl">'."\n\t\t\t\t".'<dt><strong>'.$lang_common['Search links'].'</strong></dt>'."\n\t\t\t\t".'<dd><a href="search.php?action=show_24h">'.$lang_common['Show recent posts'].'</a></dd>'."\n";
 54:         echo "\t\t\t\t".'<dd><a href="search.php?action=show_unanswered">'.$lang_common['Show unanswered posts'].'</a></dd>'."\n"; 39:         echo "\t\t\t\t".'<dd><a href="search.php?action=show_unanswered">'.$lang_common['Show unanswered posts'].'</a></dd>'."\n";
 55:  40: 
 56:         if ($pun_config['o_subscriptions'] == '1') 41:         if ($pun_config['o_subscriptions'] == '1')
 62:     { 47:     {
 63:         if ($pun_user['g_search'] == '1') 48:         if ($pun_user['g_search'] == '1')
 64:         { 49:         {
 65:             echo "\n\t\t\t".'<dl id="searchlinks" class="conl">'."\n\t\t\t\t".'<dt><strong>'.$lang_common['Search links'].'</strong></dt><dd><a href="search.php?action=show_24h">'.$lang_common['Show recent posts'].'</a></dd>'."\n"; 50:             echo "\t\t\t".'<dl id="searchlinks" class="conl">'."\n\t\t\t\t".'<dt><strong>'.$lang_common['Search links'].'</strong></dt><dd><a href="search.php?action=show_24h">'.$lang_common['Show recent posts'].'</a></dd>'."\n";
 66:             echo "\t\t\t\t".'<dd><a href="search.php?action=show_unanswered">'.$lang_common['Show unanswered posts'].'</a></dd>'."\n\t\t\t".'</dl>'."\n"; 51:             echo "\t\t\t\t".'<dd><a href="search.php?action=show_unanswered">'.$lang_common['Show unanswered posts'].'</a></dd>'."\n\t\t\t".'</dl>'."\n";
 67:         } 52:         }
 68:     } 53:     }
 69: } 54: }
 70: else if ($footer_style == 'viewforum' || $footer_style == 'viewtopic') 55: else if ($footer_style == 'viewforum' || $footer_style == 'viewtopic')
 71: { 56: {
 72:     echo "\n\t\t\t".'<div class="conl">'."\n"; 57:     echo "\t\t\t".'<div class="conl">'."\n";
 73:  58: 
 74:     // Display the "Jump to" drop list 59:     // Display the "Jump to" drop list
 75:     if ($pun_config['o_quickjump'] == '1') 60:     if ($pun_config['o_quickjump'] == '1')
 76:     { 61:     {
 77:         // Load cached quickjump 62:         // Load cached quick jump
 78:         if (file_exists(FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php')) 63:         if (file_exists(FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php'))
 79:             include FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php'; 64:             include FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php';
 80:  65: 
110: } 95: }
111:  96: 
112: ?> 97: ?>
113:             <p class="conr"><?php printf($lang_common['Powered by'], '<a href="http://fluxbb.org/">FluxBB</a>'.(($pun_config['o_show_version'] == '1') ? ' '.$pun_config['o_cur_version'] : '')) ?></p> 98:             <ul class="conr">
  99:                 <li><?php printf($lang_common['Powered by'], '<a href="http://fluxbb.org/">FluxBB</a>'.(($pun_config['o_show_version'] == '1') ? ' '.$pun_config['o_cur_version'] : '')) ?></li>
114: <?php100: <?php
115: 101: 
116: // Display debug info (if enabled/defined)102: // Display debug info (if enabled/defined)
117: if (defined('PUN_DEBUG'))103: if (defined('PUN_DEBUG'))
118: {104: {
119:     // Calculate script generation time105:     // Calculate script generation time
120:     list($usec, $sec) = explode(' ', microtime());106:     $time_diff = sprintf('%.3f', get_microtime() - $pun_start);
121:     $time_diff = sprintf('%.3f', ((float)$usec + (float)$sec) - $pun_start);107:     echo "\t\t\t\t".'<li>[ '.sprintf($lang_common['Querytime'], $time_diff, $db->get_num_queries()).' ]</li>'."\n";
122:     echo "\t\t\t".'<p class="conr">[ '.sprintf($lang_common['Querytime'], $time_diff, $db->get_num_queries()).' ]</p>'."\n"; 
123: }108: }
124: 109: 
125: ?>110: ?>
 111:             </ul>
126:             <div class="clearer"></div>112:             <div class="clearer"></div>
127:         </div>113:         </div>
128:     </div>114:     </div>


a/upload/header.php b/upload/header.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Make sure no one attempts to run this script "directly" 11: // Make sure no one attempts to run this script "directly"
 27: if (!defined('PUN')) 12: if (!defined('PUN'))
 28:     exit; 13:     exit;
 29:  14: 
 30: // Send no-cache headers 15: // Send no-cache headers
 31: header('Expires: Thu, 21 Jul 1977 07:30:00 GMT');    // When yours truly first set eyes on this world! :) 16: header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :)
 32: header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); 17: header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
 33: header('Cache-Control: post-check=0, pre-check=0', false); 18: header('Cache-Control: post-check=0, pre-check=0', false);
 34: header('Pragma: no-cache');        // For HTTP/1.0 compability 19: header('Pragma: no-cache'); // For HTTP/1.0 compatibility
 35:  20: 
  21: // Send the Content-type header in case the web server is setup to send something else
  22: header('Content-type: text/html; charset=utf-8');
 36:  23: 
 37: // Load the template 24: // Load the template
 38: if (defined('PUN_ADMIN_CONSOLE')) 25: if (defined('PUN_ADMIN_CONSOLE'))
 39:     $tpl_main = file_get_contents(PUN_ROOT.'include/template/admin.tpl'); 26: {
  27:     if (file_exists(PUN_ROOT.'style/'.$pun_user['style'].'/admin.tpl'))
  28:         $tpl_file = PUN_ROOT.'style/'.$pun_user['style'].'/admin.tpl';
  29:     else
  30:         $tpl_file = PUN_ROOT.'include/template/admin.tpl';
  31: }
 40: else if (defined('PUN_HELP')) 32: else if (defined('PUN_HELP'))
 41:     $tpl_main = file_get_contents(PUN_ROOT.'include/template/help.tpl'); 33: {
  34:     if (file_exists(PUN_ROOT.'style/'.$pun_user['style'].'/help.tpl'))
  35:         $tpl_file = PUN_ROOT.'style/'.$pun_user['style'].'/help.tpl';
  36:     else
  37:         $tpl_file = PUN_ROOT.'include/template/help.tpl';
  38: }
 42: else 39: else
 43:     $tpl_main = file_get_contents(PUN_ROOT.'include/template/main.tpl'); 40: {
  41:     if (file_exists(PUN_ROOT.'style/'.$pun_user['style'].'/main.tpl'))
  42:         $tpl_file = PUN_ROOT.'style/'.$pun_user['style'].'/main.tpl';
  43:     else
  44:         $tpl_file = PUN_ROOT.'include/template/main.tpl';
  45: }
 44:  46: 
  47: $tpl_main = file_get_contents($tpl_file);
 45:  48: 
 46: // START SUBST - <pun_include "*"> 49: // START SUBST - <pun_include "*">
 47: while (preg_match('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_main, $cur_include)) 50: while (preg_match('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_main, $cur_include))
 53:     include PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2]; 56:     include PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2];
 54:     $tpl_temp = ob_get_contents(); 57:     $tpl_temp = ob_get_contents();
 55:     $tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main); 58:     $tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main);
 56:     ob_end_clean(); 59:     ob_end_clean();
 57: } 60: }
 58: // END SUBST - <pun_include "*"> 61: // END SUBST - <pun_include "*">
 59:  62: 
 60:  63: 
  64: // START SUBST - <pun_language>
  65: $tpl_main = str_replace('<pun_language>', $lang_common['lang_identifier'], $tpl_main);
  66: // END SUBST - <pun_language>
  67: 
  68: 
 61: // START SUBST - <pun_content_direction> 69: // START SUBST - <pun_content_direction>
 62: $tpl_main = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_main); 70: $tpl_main = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_main);
 63: // END SUBST - <pun_content_direction> 71: // END SUBST - <pun_content_direction>
 71:     echo '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />'."\n"; 79:     echo '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />'."\n";
 72:  80: 
 73: ?> 81: ?>
 74: <title><?php echo $page_title ?></title> 82: <title><?php echo $page_title.(isset($p) ? ' ('.sprintf($lang_common['Page'], forum_number_format($p)).')' : '') ?></title>
 75: <link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'].'.css' ?>" /> 83: <link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'].'.css' ?>" />
 76: <?php 84: <?php
 77:  85: 
 84:  92: 
 85: ?> 93: ?>
 86: <script type="text/javascript"> 94: <script type="text/javascript">
 87: <!-- 
 88: function process_form(the_form) 95: function process_form(the_form)
 89: { 96: {
 90:     var element_names = new Object() 97:     var element_names = new Object()
115: 122: 
116:     return true123:     return true
117: }124: }
118: // --> 
119: </script>125: </script>
120: <?php126: <?php
121: 127: 
150: 156: 
151: 157: 
152: // START SUBST - <pun_desc>158: // START SUBST - <pun_desc>
153: $tpl_main = str_replace('<pun_desc>', '<p><span>'.$pun_config['o_board_desc'].'</span></p>', $tpl_main);159: $tpl_main = str_replace('<pun_desc>', $pun_config['o_board_desc'], $tpl_main);
154: // END SUBST - <pun_desc>160: // END SUBST - <pun_desc>
155: 161: 
156: 162: 
198: <div id="announce" class="block">204: <div id="announce" class="block">
199:     <h2><span><?php echo $lang_common['Announcement'] ?></span></h2>205:     <h2><span><?php echo $lang_common['Announcement'] ?></span></h2>
200:     <div class="box">206:     <div class="box">
201:         <div class="inbox">207:         <div id="announce-block" class="inbox">
202:             <div><?php echo $pun_config['o_announcement_message'] ?></div>208:             <div class="usercontent"><?php echo $pun_config['o_announcement_message'] ?></div>
203:         </div>209:         </div>
204:     </div>210:     </div>
205: </div>211: </div>


a/upload/help.php b/upload/help.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Tell header.php to use the help template 11: // Tell header.php to use the help template
 27: define('PUN_HELP', 1); 12: define('PUN_HELP', 1);
 45: <h2><?php echo $lang_common['BBCode'] ?></h2> 30: <h2><?php echo $lang_common['BBCode'] ?></h2>
 46: <div class="box"> 31: <div class="box">
 47:     <div class="inbox"> 32:     <div class="inbox">
 48:         <a name="bbcode"></a><?php echo $lang_help['BBCode info 1'] ?><br /><br /> 33:         <p><a name="bbcode"></a><?php echo $lang_help['BBCode info 1'] ?></p>
 49:         <?php echo $lang_help['BBCode info 2'] ?> 34:         <p><?php echo $lang_help['BBCode info 2'] ?></p>
 50:     </div> 35:     </div>
 51: </div> 36: </div>
 52: <h2><?php echo $lang_help['Text style'] ?></h2> 37: <h2><?php echo $lang_help['Text style'] ?></h2>
 53: <div class="box"> 38: <div class="box">
 54:     <div class="inbox"> 39:     <div class="inbox">
 55:         <?php echo $lang_help['Text style info'] ?><br /><br /> 40:         <p><?php echo $lang_help['Text style info'] ?></p>
 56:         &nbsp;&nbsp;&nbsp;&nbsp;[b]<?php echo $lang_help['Bold text'] ?>[/b] <?php echo $lang_help['produces'] ?> <strong><?php echo $lang_help['Bold text'] ?></strong><br /> 41:         <p><code>[b]<?php echo $lang_help['Bold text'] ?>[/b]</code> <?php echo $lang_help['produces'] ?> <strong><?php echo $lang_help['Bold text'] ?></strong></p>
 57:         &nbsp;&nbsp;&nbsp;&nbsp;[u]<?php echo $lang_help['Underlined text'] ?>[/u] <?php echo $lang_help['produces'] ?> <span class="bbu"><?php echo $lang_help['Underlined text'] ?></span><br /> 42:         <p><code>[u]<?php echo $lang_help['Underlined text'] ?>[/u]</code> <?php echo $lang_help['produces'] ?> <span class="bbu"><?php echo $lang_help['Underlined text'] ?></span></p>
 58:         &nbsp;&nbsp;&nbsp;&nbsp;[i]<?php echo $lang_help['Italic text'] ?>[/i] <?php echo $lang_help['produces'] ?> <i><?php echo $lang_help['Italic text'] ?></i><br /> 43:         <p><code>[i]<?php echo $lang_help['Italic text'] ?>[/i]</code> <?php echo $lang_help['produces'] ?> <i><?php echo $lang_help['Italic text'] ?></i></p>
 59:         &nbsp;&nbsp;&nbsp;&nbsp;[color=#FF0000]<?php echo $lang_help['Red text'] ?>[/color] <?php echo $lang_help['produces'] ?> <span style="color: #ff0000"><?php echo $lang_help['Red text'] ?></span><br /> 44:         <p><code>[color=#FF0000]<?php echo $lang_help['Red text'] ?>[/color]</code> <?php echo $lang_help['produces'] ?> <span style="color: #ff0000"><?php echo $lang_help['Red text'] ?></span></p>
 60:         &nbsp;&nbsp;&nbsp;&nbsp;[color=blue]<?php echo $lang_help['Blue text'] ?>[/color] <?php echo $lang_help['produces'] ?> <span style="color: blue"><?php echo $lang_help['Blue text'] ?></span> 45:         <p><code>[color=blue]<?php echo $lang_help['Blue text'] ?>[/color]</code> <?php echo $lang_help['produces'] ?> <span style="color: blue"><?php echo $lang_help['Blue text'] ?></span></p>
  46:         <p><code>[h]<?php echo $lang_help['Heading text'] ?>[/h]</code> <?php echo $lang_help['produces'] ?></p><h5><?php echo $lang_help['Heading text'] ?></h5>
 61:     </div> 47:     </div>
 62: </div> 48: </div>
 63: <h2><?php echo $lang_help['Links and images'] ?></h2> 49: <h2><?php echo $lang_help['Links and images'] ?></h2>
 64: <div class="box"> 50: <div class="box">
 65:     <div class="inbox"> 51:     <div class="inbox">
 66:         <?php echo $lang_help['Links info'] ?><br /><br />         52:         <p><?php echo $lang_help['Links info'] ?></p>
 67:         &nbsp;&nbsp;&nbsp;&nbsp;[url=<?php echo $pun_config['o_base_url'].'/' ?>]<?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?>[/url] <?php echo $lang_help['produces'] ?> <a href="<?php echo $pun_config['o_base_url'].'/' ?>"><?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?></a><br /> 53:         <p><code>[url=<?php echo $pun_config['o_base_url'].'/' ?>]<?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?>[/url]</code> <?php echo $lang_help['produces'] ?> <a href="<?php echo $pun_config['o_base_url'].'/' ?>"><?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?></a></p>
 68:         &nbsp;&nbsp;&nbsp;&nbsp;[url]<?php echo $pun_config['o_base_url'].'/' ?>[/url] <?php echo $lang_help['produces'] ?> <a href="<?php echo $pun_config['o_base_url'] ?>"><?php echo $pun_config['o_base_url'].'/' ?></a><br /> 54:         <p><code>[url]<?php echo $pun_config['o_base_url'].'/' ?>[/url]</code> <?php echo $lang_help['produces'] ?> <a href="<?php echo $pun_config['o_base_url'] ?>"><?php echo $pun_config['o_base_url'].'/' ?></a></p>
 69:         &nbsp;&nbsp;&nbsp;&nbsp;[email]myname@mydomain.com[/email] <?php echo $lang_help['produces'] ?> <a href="mailto:myname@mydomain.com">myname@mydomain.com</a><br /> 55:         <p><code>[email]myname@mydomain.com[/email]</code> <?php echo $lang_help['produces'] ?> <a href="mailto:myname@mydomain.com">myname@mydomain.com</a></p>
 70:         &nbsp;&nbsp;&nbsp;&nbsp;[email=myname@mydomain.com]<?php echo $lang_help['My e-mail address'] ?>[/email] <?php echo $lang_help['produces'] ?> <a href="mailto:myname@mydomain.com"><?php echo $lang_help['My e-mail address'] ?></a> 56:         <p><code>[email=myname@mydomain.com]<?php echo $lang_help['My email address'] ?>[/email]</code> <?php echo $lang_help['produces'] ?> <a href="mailto:myname@mydomain.com"><?php echo $lang_help['My email address'] ?></a></p>
 71:     </div> 57:     </div>
 72:     <br /><br /> 
 73:     <div class="inbox"> 58:     <div class="inbox">
 74:         <a name="img"></a><?php echo $lang_help['Images info'] ?><br /><br /> 59:         <p><a name="img"></a><?php echo $lang_help['Images info'] ?></p>
 75:         &nbsp;&nbsp;&nbsp;&nbsp;[img=FluxBB bbcode test]<?php echo $pun_config['o_base_url'].'/' ?>img/test.png[/img] <?php echo $lang_help['produces'] ?> <img src="<?php echo $pun_config['o_base_url'].'/' ?>img/test.png" alt="FluxBB bbcode test" /> 60:         <p><code>[img=FluxBB bbcode test]<?php echo $pun_config['o_base_url'].'/' ?>img/test.png[/img]</code> <?php echo $lang_help['produces'] ?> <img src="<?php echo $pun_config['o_base_url'].'/' ?>img/test.png" alt="FluxBB bbcode test" /></p>
 76:     </div> 61:     </div>
 77: </div> 62: </div>
 78: <h2><?php echo $lang_help['Quotes'] ?></h2> 63: <h2><?php echo $lang_help['Quotes'] ?></h2>
 79: <div class="box"> 64: <div class="box">
 80:     <div class="inbox"> 65:     <div class="inbox">
 81:         <?php echo $lang_help['Quotes info'] ?><br /><br /> 66:         <p><?php echo $lang_help['Quotes info'] ?></p>
 82:         &nbsp;&nbsp;&nbsp;&nbsp;[quote=James]<?php echo $lang_help['Quote text'] ?>[/quote]<br /><br /> 67:         <p><code>[quote=James]<?php echo $lang_help['Quote text'] ?>[/quote]</code></p>
 83:         <?php echo $lang_help['produces quote box'] ?><br /><br /> 68:         <p><?php echo $lang_help['produces quote box'] ?></p>
 84:         <div class="postmsg"> 69:         <div class="postmsg">
 85:             <blockquote><div class="incqbox"><h4>James <?php echo $lang_common['wrote'] ?>:</h4><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote> 70:             <div class="quotebox"><cite>James <?php echo $lang_common['wrote'] ?>:</cite><blockquote><div><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote></div>
 86:         </div> 71:         </div>
 87:         <br /> 72:         <p><?php echo $lang_help['Quotes info 2'] ?></p>
 88:         <?php echo $lang_help['Quotes info 2'] ?><br /><br /> 73:         <p><code>[quote]<?php echo $lang_help['Quote text'] ?>[/quote]</code></p>
 89:         &nbsp;&nbsp;&nbsp;&nbsp;[quote]<?php echo $lang_help['Quote text'] ?>[/quote]<br /><br /> 74:         <p><?php echo $lang_help['produces quote box'] ?></p>
 90:         <?php echo $lang_help['produces quote box'] ?><br /><br /> 
 91:         <div class="postmsg"> 75:         <div class="postmsg">
 92:             <blockquote><div class="incqbox"><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote> 76:             <div class="quotebox"><blockquote><div><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote></div>
 93:         </div> 77:         </div>
  78:         <p><?php echo $lang_help['quote note'] ?></p>
 94:     </div> 79:     </div>
 95: </div> 80: </div>
 96: <h2><?php echo $lang_help['Code'] ?></h2> 81: <h2><?php echo $lang_help['Code'] ?></h2>
 97: <div class="box"> 82: <div class="box">
 98:     <div class="inbox"> 83:     <div class="inbox">
 99:         <?php echo $lang_help['Code info'] ?><br /><br /> 84:         <p><?php echo $lang_help['Code info'] ?></p>
100:         &nbsp;&nbsp;&nbsp;&nbsp;[code]<?php echo $lang_help['Code text'] ?>[/code]<br /><br /> 85:         <p><code>[code]<?php echo $lang_help['Code text'] ?>[/code]</code></p>
101:         <?php echo $lang_help['produces code box'] ?><br /><br /> 86:         <p><?php echo $lang_help['produces code box'] ?></p>
102:         <div class="postmsg"> 87:         <div class="postmsg">
103:             <div class="codebox"><div class="incqbox"><h4><?php echo $lang_common['Code'] ?>:</h4><div class="scrollbox" style="height: 4.5em"><pre><?php echo $lang_help['Code text'] ?></pre></div></div></div> 88:             <div class="codebox"><pre><code><?php echo $lang_help['Code text'] ?></code></pre></div>
104:         </div> 89:         </div>
105:     </div> 90:     </div>
106: </div> 91: </div>
107: <h2><?php echo $lang_help['Lists'] ?></h2> 92: <h2><?php echo $lang_help['Lists'] ?></h2>
108: <div class="box"> 93: <div class="box">
109:     <div class="inbox"> 94:     <div class="inbox">
110:         <a name="lists"></a><?php echo $lang_help['List info'] ?><br /><br /> 95:         <p><a name="lists"></a><?php echo $lang_help['List info'] ?></p>
111:  96: 
112:         <p><code>[list][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> <span><?php echo $lang_help['produces list'] ?></span></p> 97:         <p><code>[list][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> <span><?php echo $lang_help['produces list'] ?></span></p>
113:         <ul><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ul> 
114:  98: 
  99:         <div class="postmsg">
 100:             <ul><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ul>
 101:         </div>
115:         <p><code>[list=1][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> <span><?php echo $lang_help['produces decimal list'] ?></span></p>102:         <p><code>[list=1][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> <span><?php echo $lang_help['produces decimal list'] ?></span></p>
116:         <ol class="decimal"><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ol>103:         <div class="postmsg">
117: 104:             <ol class="decimal"><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ol>
 105:         </div>
118:         <p><code>[list=a][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> <span><?php echo $lang_help['produces alpha list'] ?></span></p>106:         <p><code>[list=a][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code> <span><?php echo $lang_help['produces alpha list'] ?></span></p>
119:         <ol class="alpha"><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ol>107:         <div class="postmsg">
 108:             <ol class="alpha"><li><?php echo $lang_help['List text 1'] ?></li><li><?php echo $lang_help['List text 2'] ?></li><li><?php echo $lang_help['List text 3'] ?></li></ol>
 109:         </div>
120:     </div>110:     </div>
121: </div>111: </div>
122: <h2><?php echo $lang_help['Nested tags'] ?></h2>112: <h2><?php echo $lang_help['Nested tags'] ?></h2>
123: <div class="box">113: <div class="box">
124:     <div class="inbox">114:     <div class="inbox">
125:         <?php echo $lang_help['Nested tags info'] ?><br /><br />115:         <p><?php echo $lang_help['Nested tags info'] ?></p>
126:         &nbsp;&nbsp;&nbsp;&nbsp;[b][u]<?php echo $lang_help['Bold, underlined text'] ?>[/u][/b] <?php echo $lang_help['produces'] ?> <strong><span class="bbu"><?php echo $lang_help['Bold, underlined text'] ?></span></strong>116:         <p><code>[b][u]<?php echo $lang_help['Bold, underlined text'] ?>[/u][/b]</code> <?php echo $lang_help['produces'] ?> <strong><span class="bbu"><?php echo $lang_help['Bold, underlined text'] ?></span></strong></p>
127:     </div>117:     </div>
128: </div>118: </div>
129: <h2><?php echo $lang_common['Smilies'] ?></h2>119: <h2><?php echo $lang_common['Smilies'] ?></h2>
130: <div class="box">120: <div class="box">
131:     <div class="inbox">121:     <div class="inbox">
132:         <a name="smilies"></a><?php echo $lang_help['Smilies info'] ?><br /><br />122:         <p><a name="smilies"></a><?php echo $lang_help['Smilies info'] ?></p>
133: 123:         <div class="postmsg">
134:         <ul> 
135: <?php124: <?php
136: 125: 
137: // Display the smiley set126: // Display the smiley set
143:     $smiley_groups[$smiley_img][] = $smiley_text;132:     $smiley_groups[$smiley_img][] = $smiley_text;
144: 133: 
145: foreach ($smiley_groups as $smiley_img => $smiley_texts)134: foreach ($smiley_groups as $smiley_img => $smiley_texts)
146:     echo "\t\t\t".'<li>'.implode(' '.$lang_common['and'].' ', $smiley_texts).' <span>'.$lang_help['produces'].'</span> <img src="img/smilies/'.$smiley_img.'" width="15" height="15" alt="'.$smiley_texts[0].'" /></li>'."\n";135:     echo "\t\t\t".'<p><code>'.implode('</code> '.$lang_common['and'].' <code>', $smiley_texts).'</code> <span>'.$lang_help['produces'].'</span> <img src="img/smilies/'.$smiley_img.'" width="15" height="15" alt="'.$smiley_texts[0].'" /></p>'."\n";
147: 136: 
148: ?>137: ?>
149:         </ul>138:         </div>
150:     </div>139:     </div>
151: </div>140: </div>
152: <?php141: <?php


a/upload/include/cache.php b/upload/include/cache.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Make sure no one attempts to run this script "directly" 11: // Make sure no one attempts to run this script "directly"
 27: if (!defined('PUN')) 12: if (!defined('PUN'))
 28:     exit; 13:     exit;
 29:  14: 
 30:  
 31: // 15: //
 32: // If we are running pre PHP 4.2.0, we add our own implementation of var_export 16: // If we are running pre PHP 4.2.0, we add our own implementation of var_export
 33: // 17: //
147: 131: 
148: 132: 
149: //133: //
150: // Generate quickjump cache PHP scripts134: // Generate quick jump cache PHP scripts
151: //135: //
152: function generate_quickjump_cache($group_id = false)136: function generate_quickjump_cache($group_id = false)
153: {137: {
154:     global $db, $lang_common, $pun_user;138:     global $db, $lang_common, $pun_user;
155: 139: 
156:     // If a group_id was supplied, we generate the quickjump cache for that group only140:     // If a group_id was supplied, we generate the quick jump cache for that group only
157:     if ($group_id !== false)141:     if ($group_id !== false)
158:         $groups[0] = $group_id;142:         $groups[0] = $group_id;
159:     else143:     else
160:     {144:     {
161:         // A group_id was now supplied, so we generate the quickjump cache for all groups145:         // A group_id was now supplied, so we generate the quick jump cache for all groups
162:         $result = $db->query('SELECT g_id FROM '.$db->prefix.'groups') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());146:         $result = $db->query('SELECT g_id FROM '.$db->prefix.'groups') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
163:         $num_groups = $db->num_rows($result);147:         $num_groups = $db->num_rows($result);
164: 148: 
169:     // Loop through the groups in $groups and output the cache for each of them153:     // Loop through the groups in $groups and output the cache for each of them
170:     while (list(, $group_id) = @each($groups))154:     while (list(, $group_id) = @each($groups))
171:     {155:     {
172:         // Output quickjump as PHP code156:         // Output quick jump as PHP code
173:         $fh = @fopen(FORUM_CACHE_DIR.'cache_quickjump_'.$group_id.'.php', 'wb');157:         $fh = @fopen(FORUM_CACHE_DIR.'cache_quickjump_'.$group_id.'.php', 'wb');
174:         if (!$fh)158:         if (!$fh)
175:             error('Unable to write quickjump cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__);159:             error('Unable to write quick jump cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__);
176: 160: 
177:         $output = '<?php'."\n\n".'if (!defined(\'PUN\')) exit;'."\n".'define(\'PUN_QJ_LOADED\', 1);'."\n\n".'?>';161:         $output = '<?php'."\n\n".'if (!defined(\'PUN\')) exit;'."\n".'define(\'PUN_QJ_LOADED\', 1);'."\n\n".'?>';
178:         $output .= "\t\t\t\t".'<form id="qjump" method="get" action="viewforum.php">'."\n\t\t\t\t\t".'<div><label><?php echo $lang_common[\'Jump to\'] ?>'."\n\n\t\t\t\t\t".'<br /><select name="id" onchange="window.location=(\'viewforum.php?id=\'+this.options[this.selectedIndex].value)">'."\n";162:         $output .= "\t\t\t\t".'<form id="qjump" method="get" action="viewforum.php">'."\n\t\t\t\t\t".'<div><label><?php echo $lang_common[\'Jump to\'] ?>'."\n\n\t\t\t\t\t".'<br /><select name="id" onchange="window.location=(\'viewforum.php?id=\'+this.options[this.selectedIndex].value)">'."\n";
196:             $output .= "\t\t\t\t\t\t\t".'<option value="'.$cur_forum['fid'].'"<?php echo ($forum_id == '.$cur_forum['fid'].') ? \' selected="selected"\' : \'\' ?>>'.pun_htmlspecialchars($cur_forum['forum_name']).$redirect_tag.'</option>'."\n";180:             $output .= "\t\t\t\t\t\t\t".'<option value="'.$cur_forum['fid'].'"<?php echo ($forum_id == '.$cur_forum['fid'].') ? \' selected="selected"\' : \'\' ?>>'.pun_htmlspecialchars($cur_forum['forum_name']).$redirect_tag.'</option>'."\n";
197:         }181:         }
198: 182: 
199:         $output .= "\t\t\t\t\t".'</optgroup>'."\n\t\t\t\t\t".'</select>'."\n\t\t\t\t\t".'<input type="submit" value="<?php echo $lang_common[\'Go\'] ?>" accesskey="g" />'."\n\t\t\t\t\t".'</label></div>'."\n\t\t\t\t".'</form>'."\n";183:         $output .= "\t\t\t\t\t\t".'</optgroup>'."\n\t\t\t\t\t".'</select>'."\n\t\t\t\t\t".'<input type="submit" value="<?php echo $lang_common[\'Go\'] ?>" accesskey="g" />'."\n\t\t\t\t\t".'</label></div>'."\n\t\t\t\t".'</form>'."\n";
200: 184: 
201:         fwrite($fh, $output);185:         fwrite($fh, $output);
202: 186: 


a/upload/include/common.php b/upload/include/common.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
   6:     based on code copyright (C) 2002-2005 Rickard Andersson
   7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  7:   8: 
  8:   PunBB is free software; you can redistribute it and/or modify it  9: ---*/
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:  10: 
 25: if (!defined('PUN_ROOT')) 11: if (!defined('PUN_ROOT'))
 26:     exit('The constant PUN_ROOT must be defined and point to a valid FluxBB installation root directory.'); 12:     exit('The constant PUN_ROOT must be defined and point to a valid FluxBB installation root directory.');
 27:  13: 
 28:  14: 
 29: // Define the version and database revision that this code was written for 15: // Define the version and database revision that this code was written for
 30: define('FORUM_VERSION', '1.4'); 16: define('FORUM_VERSION', '1.4-rc1');
 31: define('FORUM_DB_REVISION', 0); 17: define('FORUM_DB_REVISION', 2);
 32:  18: 
 33:  19: 
 34: // Attempt to load the configuration file config.php 20: // Attempt to load the configuration file config.php
 35: if (file_exists(PUN_ROOT.'config.php')) 21: if (file_exists(PUN_ROOT.'config.php'))
 36:     include PUN_ROOT.'config.php'; 22:     include PUN_ROOT.'config.php';
 37:  23: 
  24: // If we have the 1.3-legacy constant defined, define the proper 1.4 constant so we don't get an incorrect "need to install" message
  25: if (defined('FORUM'))
  26:     define('PUN', FORUM);
  27: 
 38: // If PUN isn't defined, config.php is missing or corrupt 28: // If PUN isn't defined, config.php is missing or corrupt
 39: if (!defined('PUN')) 29: if (!defined('PUN'))
 40:     exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run <a href="install.php">install.php</a> to install FluxBB first.'); 30:     exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run <a href="install.php">install.php</a> to install FluxBB first.');
 52:     header('HTTP/1.1 403 Prefetching Forbidden'); 42:     header('HTTP/1.1 403 Prefetching Forbidden');
 53:  43: 
 54:     // Send no-cache headers 44:     // Send no-cache headers
 55:     header('Expires: Thu, 21 Jul 1977 07:30:00 GMT');    // When yours truly first set eyes on this world! :) 45:     header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :)
 56:     header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); 46:     header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
 57:     header('Cache-Control: post-check=0, pre-check=0', false); 47:     header('Cache-Control: post-check=0, pre-check=0', false);
 58:     header('Pragma: no-cache');        // For HTTP/1.0 compability 48:     header('Pragma: no-cache');        // For HTTP/1.0 compatibility
 59:  49: 
 60:     exit; 50:     exit;
 61: } 51: }
 65:  55: 
 66:  56: 
 67: // Record the start time (will be used to calculate the generation time for the page) 57: // Record the start time (will be used to calculate the generation time for the page)
 68: list($usec, $sec) = explode(' ', microtime()); 58: $pun_start = get_microtime();
 69: $pun_start = ((float)$usec + (float)$sec); 
 70:  59: 
 71: // Make sure PHP reports all errors except E_NOTICE. FluxBB supports E_ALL, but a lot of scripts it may interact with, do not. 60: // Make sure PHP reports all errors except E_NOTICE. FluxBB supports E_ALL, but a lot of scripts it may interact with, do not
 72: error_reporting(E_ALL ^ E_NOTICE); 61: error_reporting(E_ALL ^ E_NOTICE);
 73:  62: 
 74: // Turn off magic_quotes_runtime 63: // Turn off magic_quotes_runtime


a/upload/include/common_admin.php b/upload/include/common_admin.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
   6:     based on code copyright (C) 2002-2005 Rickard Andersson
   7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  7:   8: 
  8:   PunBB is free software; you can redistribute it and/or modify it  9: ---*/
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:  10: 
 25: // Make sure no one attempts to run this script "directly" 11: // Make sure no one attempts to run this script "directly"
 26: if (!defined('PUN')) 12: if (!defined('PUN'))
 69:         $suffix = substr($entry, strlen($entry) - 4); 55:         $suffix = substr($entry, strlen($entry) - 4);
 70:  56: 
 71:         if ($suffix == '.php' && ((!$is_admin && $prefix == 'AMP') || ($is_admin && ($prefix == 'AP' || $prefix == 'AMP')))) 57:         if ($suffix == '.php' && ((!$is_admin && $prefix == 'AMP') || ($is_admin && ($prefix == 'AP' || $prefix == 'AMP'))))
 72:             $plugins[] = array(substr(substr($entry, strpos($entry, '_') + 1), 0, -4), $entry); 58:             $plugins[] = array(substr($entry, strpos($entry, '_') + 1, -4), $entry);
 73:     } 59:     }
 74:     $d->close(); 60:     $d->close();
 75:  61: 


a/upload/include/dblayer/common_db.php b/upload/include/dblayer/common_db.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Make sure no one attempts to run this script "directly" 11: // Make sure no one attempts to run this script "directly"
 27: if (!defined('PUN')) 12: if (!defined('PUN'))
 28:     exit; 13:     exit;
 29:  14: 
 30:  15: 
 31: // 
 32: // Return current timestamp (with microseconds) as a float (used in dblayer) 
 33: // 
 34: if (defined('PUN_SHOW_QUERIES')) 
 35: { 
 36:     function get_microtime() 
 37:     { 
 38:         list($usec, $sec) = explode(' ', microtime()); 
 39:         return ((float)$usec + (float)$sec); 
 40:     } 
 41: } 
 42:  
 43:  
 44: // Load the appropriate DB layer class 16: // Load the appropriate DB layer class
 45: switch ($db_type) 17: switch ($db_type)
 46: { 18: {
 47:     case 'mysql': 19:     case 'mysql':
 48:         require PUN_ROOT.'include/dblayer/mysql.php'; 20:         require PUN_ROOT.'include/dblayer/mysql.php';
 49:         break; 21:         break;
 50:      22: 
 51:     case 'mysql_innodb': 23:     case 'mysql_innodb':
 52:         require PUN_ROOT.'include/dblayer/mysql_innodb.php'; 24:         require PUN_ROOT.'include/dblayer/mysql_innodb.php';
 53:         break; 25:         break;
 55:     case 'mysqli': 27:     case 'mysqli':
 56:         require PUN_ROOT.'include/dblayer/mysqli.php'; 28:         require PUN_ROOT.'include/dblayer/mysqli.php';
 57:         break; 29:         break;
 58:      30: 
 59:     case 'mysqli_innodb': 31:     case 'mysqli_innodb':
 60:         require PUN_ROOT.'include/dblayer/mysqli_innodb.php'; 32:         require PUN_ROOT.'include/dblayer/mysqli_innodb.php';
 61:         break; 33:         break;


a/upload/include/dblayer/mysql.php b/upload/include/dblayer/mysql.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Make sure we have built in support for MySQL 11: // Make sure we have built in support for MySQL
 27: if (!function_exists('mysql_connect')) 12: if (!function_exists('mysql_connect'))


a/upload/include/dblayer/mysql_innodb.php b/upload/include/dblayer/mysql_innodb.php
  1: <?php  1: <?php
  2: /** 
  3:  * A database layer class supporting transactions that relies on the MySQL PHP extension. 
  4:  * 
  5:  * @copyright Copyright (C) 2009 FluxBB.org, based on code copyright (C) 2002-2008 PunBB.org 
  6:  * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher 
  7:  * @package FluxBB 
  8:  */ 
  9:   2: 
   3: /*---
   4: 
   5:     Copyright (C) 2008-2009 FluxBB.org
   6:     based on code copyright (C) 2002-2008 PunBB.org
   7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
   8: 
   9: ---*/
 10:  10: 
 11: // Make sure we have built in support for MySQL 11: // Make sure we have built in support for MySQL
 12: if (!function_exists('mysql_connect')) 12: if (!function_exists('mysql_connect'))


a/upload/include/dblayer/mysqli.php b/upload/include/dblayer/mysqli.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Make sure we have built in support for MySQL 11: // Make sure we have built in support for MySQL
 27: if (!function_exists('mysqli_connect')) 12: if (!function_exists('mysqli_connect'))
 42:     ); 27:     );
 43:  28: 
 44:  29: 
 45:     function DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $foo) 30:     function DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect)
 46:     { 31:     {
 47:         $this->prefix = $db_prefix; 32:         $this->prefix = $db_prefix;
 48:  33: 
 50:         if (strpos($db_host, ':') !== false) 35:         if (strpos($db_host, ':') !== false)
 51:             list($db_host, $db_port) = explode(':', $db_host); 36:             list($db_host, $db_port) = explode(':', $db_host);
 52:  37: 
  38:         // Persistent connection in MySQLi are only available in PHP 5.3 and later releases
  39:         $p_connect = $p_connect && version_compare(PHP_VERSION, '5.3.0') >= 0 ? 'p:' : '';
  40: 
 53:         if (isset($db_port)) 41:         if (isset($db_port))
 54:             $this->link_id = @mysqli_connect($db_host, $db_username, $db_password, $db_name, $db_port); 42:             $this->link_id = @mysqli_connect($p_connect.$db_host, $db_username, $db_password, $db_name, $db_port);
 55:         else 43:         else
 56:             $this->link_id = @mysqli_connect($db_host, $db_username, $db_password, $db_name); 44:             $this->link_id = @mysqli_connect($p_connect.$db_host, $db_username, $db_password, $db_name);
 57:  45: 
 58:         if (!$this->link_id) 46:         if (!$this->link_id)
 59:             error('Unable to connect to MySQL and select database. MySQL reported: '.mysqli_connect_error(), __FILE__, __LINE__); 47:             error('Unable to connect to MySQL and select database. MySQL reported: '.mysqli_connect_error(), __FILE__, __LINE__);


a/upload/include/dblayer/mysqli_innodb.php b/upload/include/dblayer/mysqli_innodb.php
  1: <?php  1: <?php
  2: /** 
  3:  * A database layer class supporting transactions that relies on the MySQLi PHP extension. 
  4:  * 
  5:  * @copyright Copyright (C) 2009 FluxBB.org, based on code copyright (C) 2002-2008 PunBB.org 
  6:  * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher 
  7:  * @package FluxBB 
  8:  */ 
  9:   2: 
   3: /*---
   4: 
   5:     Copyright (C) 2008-2009 FluxBB.org
   6:     based on code copyright (C) 2002-2008 PunBB.org
   7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
   8: 
   9: ---*/
 10:  10: 
 11: // Make sure we have built in support for MySQL 11: // Make sure we have built in support for MySQL
 12: if (!function_exists('mysqli_connect')) 12: if (!function_exists('mysqli_connect'))
 28:     ); 28:     );
 29:  29: 
 30:  30: 
 31:     function DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $foo) 31:     function DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect)
 32:     { 32:     {
 33:         $this->prefix = $db_prefix; 33:         $this->prefix = $db_prefix;
 34:  34: 
 36:         if (strpos($db_host, ':') !== false) 36:         if (strpos($db_host, ':') !== false)
 37:             list($db_host, $db_port) = explode(':', $db_host); 37:             list($db_host, $db_port) = explode(':', $db_host);
 38:  38: 
  39:         // Persistent connection in MySQLi are only available in PHP 5.3 and later releases
  40:         $p_connect = $p_connect && version_compare(PHP_VERSION, '5.3.0') >= 0 ? 'p:' : '';
  41: 
 39:         if (isset($db_port)) 42:         if (isset($db_port))
 40:             $this->link_id = @mysqli_connect($db_host, $db_username, $db_password, $db_name, $db_port); 43:             $this->link_id = @mysqli_connect($p_connect.$db_host, $db_username, $db_password, $db_name, $db_port);
 41:         else 44:         else
 42:             $this->link_id = @mysqli_connect($db_host, $db_username, $db_password, $db_name); 45:             $this->link_id = @mysqli_connect($p_connect.$db_host, $db_username, $db_password, $db_name);
 43:  46: 
 44:         if (!$this->link_id) 47:         if (!$this->link_id)
 45:             error('Unable to connect to MySQL and select database. MySQL reported: '.mysqli_connect_error(), __FILE__, __LINE__); 48:             error('Unable to connect to MySQL and select database. MySQL reported: '.mysqli_connect_error(), __FILE__, __LINE__);


a/upload/include/dblayer/pgsql.php b/upload/include/dblayer/pgsql.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Make sure we have built in support for PostgreSQL 11: // Make sure we have built in support for PostgreSQL
 27: if (!function_exists('pg_connect')) 12: if (!function_exists('pg_connect'))
114:     } 99:     }
115: 100: 
116: 101: 
117:     function query($sql, $unbuffered = false)    // $unbuffered is ignored since there is no pgsql_unbuffered_query()102:     function query($sql, $unbuffered = false) // $unbuffered is ignored since there is no pgsql_unbuffered_query()
118:     {103:     {
119:         if (strlen($sql) > 140000)104:         if (strlen($sql) > 140000)
120:             exit('Insane query. Aborting.');105:             exit('Insane query. Aborting.');
121:         106: 
122:         if (strrpos($sql, 'LIMIT') !== false)107:         if (strrpos($sql, 'LIMIT') !== false)
123:             $sql = preg_replace('#LIMIT ([0-9]+),([ 0-9]+)#', 'LIMIT \\2 OFFSET \\1', $sql);108:             $sql = preg_replace('#LIMIT ([0-9]+),([ 0-9]+)#', 'LIMIT \\2 OFFSET \\1', $sql);
124: 109: 


a/upload/include/dblayer/sqlite.php b/upload/include/dblayer/sqlite.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Make sure we have built in support for SQLite 11: // Make sure we have built in support for SQLite
 27: if (!function_exists('sqlite_open')) 12: if (!function_exists('sqlite_open'))
382:         foreach ($table_lines as $table_line)367:         foreach ($table_lines as $table_line)
383:         {368:         {
384:             $table_line = pun_trim($table_line);369:             $table_line = pun_trim($table_line);
385:             if (substr($table_line, 0, 12) == 'CREATE TABLE') 370:             if (substr($table_line, 0, 12) == 'CREATE TABLE')
386:                 continue;371:                 continue;
387:             else if (substr($table_line, 0, 11) == 'PRIMARY KEY')372:             else if (substr($table_line, 0, 11) == 'PRIMARY KEY')
388:                 $table['primary_key'] = $table_line;373:                 $table['primary_key'] = $table_line;
426: 411: 
427:         foreach ($table['columns'] as $cur_column => $column_details)412:         foreach ($table['columns'] as $cur_column => $column_details)
428:             $new_table .= "\n".$cur_column.' '.$column_details;413:             $new_table .= "\n".$cur_column.' '.$column_details;
429:             414: 
430:         if (isset($table['unique']))415:         if (isset($table['unique']))
431:             $new_table .= "\n".$table['unique'].',';416:             $new_table .= "\n".$table['unique'].',';
432:             417: 
433:         if (isset($table['primary_key']))418:         if (isset($table['primary_key']))
434:             $new_table .= "\n".$table['primary_key'];419:             $new_table .= "\n".$table['primary_key'];
435:             420: 
436:         $new_table = trim($new_table, ',')."\n".');';421:         $new_table = trim($new_table, ',')."\n".');';
437: 422: 
438:         // Drop old table423:         // Drop old table
483: 468: 
484:         foreach ($table['columns'] as $cur_column => $column_details)469:         foreach ($table['columns'] as $cur_column => $column_details)
485:             $new_table .= "\n".$cur_column.' '.$column_details;470:             $new_table .= "\n".$cur_column.' '.$column_details;
486:             471: 
487:         if (isset($table['unique']))472:         if (isset($table['unique']))
488:             $new_table .= "\n".$table['unique'].',';473:             $new_table .= "\n".$table['unique'].',';
489:             474: 
490:         if (isset($table['primary_key']))475:         if (isset($table['primary_key']))
491:             $new_table .= "\n".$table['primary_key'];476:             $new_table .= "\n".$table['primary_key'];
492:             477: 
493:         $new_table = trim($new_table, ',')."\n".');';478:         $new_table = trim($new_table, ',')."\n".');';
494: 479: 
495:         // Drop old table480:         // Drop old table


a/upload/include/email.php b/upload/include/email.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // Make sure no one attempts to run this script "directly" 11: // Make sure no one attempts to run this script "directly"
 27: if (!defined('PUN')) 12: if (!defined('PUN'))
 29:  14: 
 30:  15: 
 31: // 16: //
 32: // Validate an e-mail address 17: // Validate an email address
 33: // 18: //
 34: function is_valid_email($email) 19: function is_valid_email($email)
 35: { 20: {
 36:     if (strlen($email) > 80) 21:     if (strlen($email) > 80)
 37:         return false; 22:         return false;
 38:  23: 
 39:     return preg_match('/^(([^<>()[\]\\.,;:\s@"\']+(\.[^<>()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email); 24:     return preg_match('/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|("[^"]+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email);
 40: } 25: }
 41:  26: 
 42:  27: 
111:  96: 
112:  97: 
113: // 98: //
114: // This function was originally a part of the phpBB Group forum software phpBB2 (http://www.phpbb.com). 99: // This function was originally a part of the phpBB Group forum software phpBB2 (http://www.phpbb.com)
115: // They deserve all the credit for writing it. I made small modifications for it to suit PunBB and it's coding standards.100: // They deserve all the credit for writing it. I made small modifications for it to suit PunBB and it's coding standards
116: //101: //
117: function server_parse($socket, $expected_response)102: function server_parse($socket, $expected_response)
118: {103: {
124:     }109:     }
125: 110: 
126:     if (!(substr($server_response, 0, 3) == $expected_response))111:     if (!(substr($server_response, 0, 3) == $expected_response))
127:         error('Unable to send e-mail. Please contact the forum administrator with the following error message reported by the SMTP server: "'.$server_response.'"', __FILE__, __LINE__);112:         error('Unable to send email. Please contact the forum administrator with the following error message reported by the SMTP server: "'.$server_response.'"', __FILE__, __LINE__);
128: }113: }
129: 114: 
130: 115: 
131: //116: //
132: // This function was originally a part of the phpBB Group forum software phpBB2 (http://www.phpbb.com).117: // This function was originally a part of the phpBB Group forum software phpBB2 (http://www.phpbb.com)
133: // They deserve all the credit for writing it. I made small modifications for it to suit PunBB and it's coding standards.118: // They deserve all the credit for writing it. I made small modifications for it to suit PunBB and it's coding standards.
134: //119: //
135: function smtp_mail($to, $subject, $message, $headers = '')120: function smtp_mail($to, $subject, $message, $headers = '')


a/upload/include/functions.php b/upload/include/functions.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
   6:     based on code copyright (C) 2002-2005 Rickard Andersson
   7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  7:   8: 
  8:   PunBB is free software; you can redistribute it and/or modify it  9: ---*/
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  10: 
 13:   PunBB is distributed in the hope that it will be useful, but 11: //
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 12: // Return current timestamp (with microseconds) as a float
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 13: //
 16:   GNU General Public License for more details. 14: function get_microtime()
 17:  15: {
 18:   You should have received a copy of the GNU General Public License 16:     list($usec, $sec) = explode(' ', microtime());
 19:   along with this program; if not, write to the Free Software 17:     return ((float)$usec + (float)$sec);
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 18: }
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:  19: 
 25: // 20: //
 26: // Cookie stuff! 21: // Cookie stuff!
 30:     global $db, $db_type, $pun_config, $cookie_name, $cookie_seed; 25:     global $db, $db_type, $pun_config, $cookie_name, $cookie_seed;
 31:  26: 
 32:     $now = time(); 27:     $now = time();
 33:     $expire = $now + 31536000;    // The cookie expires after a year 28:     $expire = $now + 31536000; // The cookie expires after a year
 34:  29: 
 35:     // We assume it's a guest 30:     // We assume it's a guest
 36:     $cookie = array('user_id' => 1, 'password_hash' => 'Guest'); 31:     $cookie = array('user_id' => 1, 'password_hash' => 'Guest');
 75:             { 70:             {
 76:                 $pun_user['logged'] = $now; 71:                 $pun_user['logged'] = $now;
 77:  72: 
 78:                 // With MySQL/MySQLi, REPLACE INTO avoids a user having two rows in the online table 73:                 // With MySQL/MySQLi/SQLite, REPLACE INTO avoids a user having two rows in the online table
 79:                 switch ($db_type) 74:                 switch ($db_type)
 80:                 { 75:                 {
 81:                     case 'mysql': 76:                     case 'mysql':
 82:                     case 'mysqli': 77:                     case 'mysqli':
 83:                     case 'mysql_innodb': 78:                     case 'mysql_innodb':
 84:                     case 'mysqli_innodb': 79:                     case 'mysqli_innodb':
  80:                     case 'sqlite':
 85:                         $db->query('REPLACE INTO '.$db->prefix.'online (user_id, ident, logged) VALUES('.$pun_user['id'].', \''.$db->escape($pun_user['username']).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error()); 81:                         $db->query('REPLACE INTO '.$db->prefix.'online (user_id, ident, logged) VALUES('.$pun_user['id'].', \''.$db->escape($pun_user['username']).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error());
 86:                         break; 82:                         break;
 87:  83: 
 88:                     default: 84:                     default:
 89:                         $db->query('INSERT INTO '.$db->prefix.'online (user_id, ident, logged) VALUES('.$pun_user['id'].', \''.$db->escape($pun_user['username']).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error()); 85:                         $db->query('INSERT INTO '.$db->prefix.'online (user_id, ident, logged) SELECT '.$pun_user['id'].', \''.$db->escape($pun_user['username']).'\', '.$pun_user['logged'].' WHERE NOT EXISTS (SELECT 1 FROM '.$db->prefix.'online WHERE user_id='.$pun_user['id'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error());
 90:                         break; 86:                         break;
 91:                 } 87:                 }
 92:  88: 
156: //152: //
157: function get_current_url($max_length = 0)153: function get_current_url($max_length = 0)
158: {154: {
159:     global $base_url; 
160:  
161:     $protocol = (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off') ? 'http://' : 'https://';155:     $protocol = (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off') ? 'http://' : 'https://';
162:     $port = (isset($_SERVER['SERVER_PORT']) && (($_SERVER['SERVER_PORT'] != '80' && $protocol == 'http://') || ($_SERVER['SERVER_PORT'] != '443' && $protocol == 'https://')) && strpos($_SERVER['HTTP_HOST'], ':') === false) ? ':'.$_SERVER['SERVER_PORT'] : '';156:     $port = (isset($_SERVER['SERVER_PORT']) && (($_SERVER['SERVER_PORT'] != '80' && $protocol == 'http://') || ($_SERVER['SERVER_PORT'] != '443' && $protocol == 'https://')) && strpos($_SERVER['HTTP_HOST'], ':') === false) ? ':'.$_SERVER['SERVER_PORT'] : '';
163: 157: 
192:     {186:     {
193:         $pun_user['logged'] = time();187:         $pun_user['logged'] = time();
194: 188: 
195:         // With MySQL/MySQLi, REPLACE INTO avoids a user having two rows in the online table189:         // With MySQL/MySQLi/SQLite, REPLACE INTO avoids a user having two rows in the online table
196:         switch ($db_type)190:         switch ($db_type)
197:         {191:         {
198:             case 'mysql':192:             case 'mysql':
199:             case 'mysqli':193:             case 'mysqli':
200:             case 'mysql_innodb':194:             case 'mysql_innodb':
201:             case 'mysqli_innodb':195:             case 'mysqli_innodb':
 196:             case 'sqlite':
202:                 $db->query('REPLACE INTO '.$db->prefix.'online (user_id, ident, logged) VALUES(1, \''.$db->escape($remote_addr).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error());197:                 $db->query('REPLACE INTO '.$db->prefix.'online (user_id, ident, logged) VALUES(1, \''.$db->escape($remote_addr).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error());
203:                 break;198:                 break;
204: 199: 
205:             default:200:             default:
206:                 $db->query('INSERT INTO '.$db->prefix.'online (user_id, ident, logged) VALUES(1, \''.$db->escape($remote_addr).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error());201:                 $db->query('INSERT INTO '.$db->prefix.'online (user_id, ident, logged) SELECT 1, \''.$db->escape($remote_addr).'\', '.$pun_user['logged'].' WHERE NOT EXISTS (SELECT 1 FROM '.$db->prefix.'online WHERE ident=\''.$db->escape($remote_addr).'\')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error());
207:                 break;202:                 break;
208:         }203:         }
209:     }204:     }
409:         }404:         }
410:     }405:     }
411: 406: 
412:     return '<ul>'."\n\t\t\t\t".implode($lang_common['Link separator'].'</li>'."\n\t\t\t\t", $links).'</li>'."\n\t\t\t".'</ul>';407:     return '<ul>'."\n\t\t\t\t".implode($lang_common['Menu link separator'].'</li>'."\n\t\t\t\t", $links).'</li>'."\n\t\t\t".'</ul>';
413: }408: }
414: 409: 
415: 410: 
497:     }492:     }
498: 493: 
499:     forum_setcookie($cookie_name.'_track', $cookie_data, time() + $pun_config['o_timeout_visit']);494:     forum_setcookie($cookie_name.'_track', $cookie_data, time() + $pun_config['o_timeout_visit']);
500:     $_COOKIE[$cookie_name.'_track'] = $cookie_data;    // Set it directly in $_COOKIE as well495:     $_COOKIE[$cookie_name.'_track'] = $cookie_data; // Set it directly in $_COOKIE as well
501: }496: }
502: 497: 
503: 498: 
541:     $result = $db->query('SELECT COUNT(id), SUM(num_replies) FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id) or error('Unable to fetch forum topic count', __FILE__, __LINE__, $db->error());536:     $result = $db->query('SELECT COUNT(id), SUM(num_replies) FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id) or error('Unable to fetch forum topic count', __FILE__, __LINE__, $db->error());
542:     list($num_topics, $num_posts) = $db->fetch_row($result);537:     list($num_topics, $num_posts) = $db->fetch_row($result);
543: 538: 
544:     $num_posts = $num_posts + $num_topics;        // $num_posts is only the sum of all replies (we have to add the topic posts)539:     $num_posts = $num_posts + $num_topics; // $num_posts is only the sum of all replies (we have to add the topic posts)
545: 540: 
546:     $result = $db->query('SELECT last_post, last_post_id, last_poster FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.' AND moved_to IS NULL ORDER BY last_post DESC LIMIT 1') or error('Unable to fetch last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());541:     $result = $db->query('SELECT last_post, last_post_id, last_poster FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.' AND moved_to IS NULL ORDER BY last_post DESC LIMIT 1') or error('Unable to fetch last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());
547:     if ($db->num_rows($result))        // There are topics in the forum542:     if ($db->num_rows($result)) // There are topics in the forum
548:     {543:     {
549:         list($last_post, $last_post_id, $last_poster) = $db->fetch_row($result);544:         list($last_post, $last_post_id, $last_poster) = $db->fetch_row($result);
550: 545: 
551:         $db->query('UPDATE '.$db->prefix.'forums SET num_topics='.$num_topics.', num_posts='.$num_posts.', last_post='.$last_post.', last_post_id='.$last_post_id.', last_poster=\''.$db->escape($last_poster).'\' WHERE id='.$forum_id) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());546:         $db->query('UPDATE '.$db->prefix.'forums SET num_topics='.$num_topics.', num_posts='.$num_posts.', last_post='.$last_post.', last_post_id='.$last_post_id.', last_poster=\''.$db->escape($last_poster).'\' WHERE id='.$forum_id) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());
552:     }547:     }
553:     else    // There are no topics548:     else // There are no topics
554:         $db->query('UPDATE '.$db->prefix.'forums SET num_topics='.$num_topics.', num_posts='.$num_posts.', last_post=NULL, last_post_id=NULL, last_poster=NULL WHERE id='.$forum_id) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());549:         $db->query('UPDATE '.$db->prefix.'forums SET num_topics='.$num_topics.', num_posts='.$num_posts.', last_post=NULL, last_post_id=NULL, last_poster=NULL WHERE id='.$forum_id) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());
555: }550: }
556: 551: 
583:     // Delete the topic and any redirect topics578:     // Delete the topic and any redirect topics
584:     $db->query('DELETE FROM '.$db->prefix.'topics WHERE id='.$topic_id.' OR moved_to='.$topic_id) or error('Unable to delete topic', __FILE__, __LINE__, $db->error());579:     $db->query('DELETE FROM '.$db->prefix.'topics WHERE id='.$topic_id.' OR moved_to='.$topic_id) or error('Unable to delete topic', __FILE__, __LINE__, $db->error());
585: 580: 
586:     // Create a list of the post ID's in this topic581:     // Create a list of the post IDs in this topic
587:     $post_ids = '';582:     $post_ids = '';
588:     $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$topic_id) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());583:     $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$topic_id) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());
589:     while ($row = $db->fetch_row($result))584:     while ($row = $db->fetch_row($result))
590:         $post_ids .= ($post_ids != '') ? ','.$row[0] : $row[0];585:         $post_ids .= ($post_ids != '') ? ','.$row[0] : $row[0];
591: 586: 
592:     // Make sure we have a list of post ID's587:     // Make sure we have a list of post IDs
593:     if ($post_ids != '')588:     if ($post_ids != '')
594:     {589:     {
595:         strip_search_index($post_ids);590:         strip_search_index($post_ids);
833:     <h2><span><?php echo $lang_common['Info'] ?></span></h2>828:     <h2><span><?php echo $lang_common['Info'] ?></span></h2>
834:     <div class="box">829:     <div class="box">
835:         <div class="inbox">830:         <div class="inbox">
836:         <p><?php echo $message ?></p>831:             <p><?php echo $message ?></p>
837: <?php if (!$no_back_link): ?>        <p><a href="javascript: history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>832: <?php if (!$no_back_link): ?>            <p><a href="javascript: history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
838: <?php endif; ?>        </div>833: <?php endif; ?>        </div>
839:     </div>834:     </div>
840: </div>835: </div>
845: 840: 
846: 841: 
847: //842: //
848: // Format a time string according to $time_format and timezones843: // Format a time string according to $time_format and time zones
849: //844: //
850: function format_time($timestamp, $date_only = false, $date_format = null, $time_format = null, $time_only = false, $no_text = false)845: function format_time($timestamp, $date_only = false, $date_format = null, $time_format = null, $time_only = false, $no_text = false)
851: {846: {
966: 961: 
967: //962: //
968: // Compute a hash of $str963: // Compute a hash of $str
969: // Uses sha1() if available. If not, SHA1 through mhash() if available. If not, fall back on md5().964: // Uses sha1() if available. If not, SHA1 through mhash() if available. If not, fall back on md5()
970: //965: //
971: function pun_hash($str)966: function pun_hash($str)
972: {967: {
973:     if (function_exists('sha1'))    // Only in PHP 4.3.0+968:     if (function_exists('sha1')) // Only in PHP 4.3.0+
974:         return sha1($str);969:         return sha1($str);
975:     else if (function_exists('mhash'))    // Only if Mhash library is loaded970:     else if (function_exists('mhash')) // Only if Mhash library is loaded
976:         return bin2hex(mhash(MHASH_SHA1, $str));971:         return bin2hex(mhash(MHASH_SHA1, $str));
977:     else972:     else
978:         return md5($str);973:         return md5($str);
1023:     return utf8_trim($str);1018:     return utf8_trim($str);
1024: }1019: }
1025: 1020: 
 1021: //
 1022: // Checks if a string is in all uppercase
 1023: //
 1024: function is_all_uppercase($string)
 1025: {
 1026:     return utf8_strtoupper($string) == $string && utf8_strtolower($string) != $string;
 1027: }
 1028: 
 1029: 
 1030: //
 1031: // Inserts $element into $input at $offset
 1032: // $offset can be either a numerical offset to insert at (eg: 0 inserts at the beginning of the array)
 1033: // or a string, which is the key that the new element should be inserted before
 1034: // $key is optional: it's used when inserting a new key/value pair into an associative array
 1035: //
 1036: function array_insert(&$input, $offset, $element, $key = null)
 1037: {
 1038:     if ($key == null)
 1039:         $key = $offset;
 1040: 
 1041:     // Determine the proper offset if we're using a string
 1042:     if (!is_int($offset))
 1043:         $offset = array_search($offset, array_keys($input), true);
 1044: 
 1045:     // Out of bounds checks
 1046:     if ($offset > count($input))
 1047:         $offset = count($input);
 1048:     else if ($offset < 0)
 1049:         $offset = 0;
 1050: 
 1051:     $input = array_merge(array_slice($input, 0, $offset), array($key => $element), array_slice($input, $offset));
 1052: }
 1053: 
1026: 1054: 
1027: //1055: //
1028: // Display a message when board is in maintenance mode1056: // Display a message when board is in maintenance mode
1038: 1066: 
1039: 1067: 
1040:     // Load the maintenance template1068:     // Load the maintenance template
1041:     $tpl_maint = trim(file_get_contents(PUN_ROOT.'include/template/maintenance.tpl'));1069:     if (file_exists(PUN_ROOT.'style/'.$pun_user['style'].'/maintenance.tpl'))
 1070:         $tpl_maint = trim(file_get_contents(PUN_ROOT.'style/'.$pun_user['style'].'/maintenance.tpl'));
 1071:     else
 1072:         $tpl_maint = trim(file_get_contents(PUN_ROOT.'include/template/maintenance.tpl'));
1042: 1073: 
1043: 1074: 
1044:     // START SUBST - <pun_include "*">1075:     // START SUBST - <pun_include "*">
1056:     // END SUBST - <pun_include "*">1087:     // END SUBST - <pun_include "*">
1057: 1088: 
1058: 1089: 
 1090:     // START SUBST - <pun_language>
 1091:     $tpl_maint = str_replace('<pun_language>', $lang_common['lang_identifier'], $tpl_maint);
 1092:     // END SUBST - <pun_language>
 1093: 
 1094: 
1059:     // START SUBST - <pun_content_direction>1095:     // START SUBST - <pun_content_direction>
1060:     $tpl_maint = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_maint);1096:     $tpl_maint = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_maint);
1061:     // END SUBST - <pun_content_direction>1097:     // END SUBST - <pun_content_direction>
1116: 1152: 
1117: 1153: 
1118:     // Load the redirect template1154:     // Load the redirect template
1119:     $tpl_redir = trim(file_get_contents(PUN_ROOT.'include/template/redirect.tpl'));1155:     if (function_exists(PUN_ROOT.'style/'.$pun_user['style'].'/redirect.tpl'))
 1156:         $tpl_redir = trim(file_get_contents(PUN_ROOT.'style/'.$pun_user['style'].'/redirect.tpl'));
 1157:     else
 1158:         $tpl_redir = trim(file_get_contents(PUN_ROOT.'include/template/redirect.tpl'));
1120: 1159: 
1121: 1160: 
1122:     // START SUBST - <pun_include "*">1161:     // START SUBST - <pun_include "*">
1134:     // END SUBST - <pun_include "*">1173:     // END SUBST - <pun_include "*">
1135: 1174: 
1136: 1175: 
 1176:     // START SUBST - <pun_language>
 1177:     $tpl_redir = str_replace('<pun_language>', $lang_common['lang_identifier'], $tpl_redir);
 1178:     // END SUBST - <pun_language>
 1179: 
 1180: 
1137:     // START SUBST - <pun_content_direction>1181:     // START SUBST - <pun_content_direction>
1138:     $tpl_redir = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_redir);1182:     $tpl_redir = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_redir);
1139:     // END SUBST - <pun_content_direction>1183:     // END SUBST - <pun_content_direction>
1285:         if (!in_array($k, $no_unset) && isset($GLOBALS[$k]))1329:         if (!in_array($k, $no_unset) && isset($GLOBALS[$k]))
1286:         {1330:         {
1287:             unset($GLOBALS[$k]);1331:             unset($GLOBALS[$k]);
1288:             unset($GLOBALS[$k]);    // Double unset to circumvent the zend_hash_del_key_or_index hole in PHP <4.4.3 and <5.1.41332:             unset($GLOBALS[$k]); // Double unset to circumvent the zend_hash_del_key_or_index hole in PHP <4.4.3 and <5.1.4
1289:         }1333:         }
1290:     }1334:     }
1291: }1335: }
1342: <?php1386: <?php
1343: 1387: 
1344:     $query_time_total = 0.0;1388:     $query_time_total = 0.0;
1345:     while (list(, $cur_query) = @each($saved_queries))1389:     foreach ($saved_queries as $cur_query)
1346:     {1390:     {
1347:         $query_time_total += $cur_query[1];1391:         $query_time_total += $cur_query[1];
1348: 1392: 
1357: 1401: 
1358: ?>1402: ?>
1359:                 <tr>1403:                 <tr>
1360:                     <td class="tcl" colspan="2"><?php printf($lang_common['Total query time'], $query_time_totals.' s') ?></td>1404:                     <td class="tcl" colspan="2"><?php printf($lang_common['Total query time'], $query_time_total.' s') ?></td>
1361:                 </tr>1405:                 </tr>
1362:             </tbody>1406:             </tbody>
1363:             </table>1407:             </table>


a/upload/include/parser.php b/upload/include/parser.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
   6:     based on code copyright (C) 2002-2005 Rickard Andersson
   7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  7:   8: 
  8:   PunBB is free software; you can redistribute it and/or modify it  9: ---*/
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:  10: 
 25: // Make sure no one attempts to run this script "directly" 11: // Make sure no one attempts to run this script "directly"
 26: if (!defined('PUN')) 12: if (!defined('PUN'))
 27:     exit; 13:     exit;
 28:  14: 
 29:  15: 
 30: // Here you can add additional smilies if you like (please note that you must escape singlequote and backslash) 16: // Here you can add additional smilies if you like (please note that you must escape single quote and backslash)
 31: $smilies = array( 17: $smilies = array(
 32:     ':)' => 'smile.png', 18:     ':)' => 'smile.png',
 33:     '=)' => 'smile.png', 19:     '=)' => 'smile.png',
 59:     { 45:     {
 60:         global $lang_profile; 46:         global $lang_profile;
 61:  47: 
 62:         if (preg_match('%\[/?(?:quote|code|list)\b[^\]]*\]%i', $text)) 48:         if (preg_match('%\[/?(?:quote|code|list|h)\b[^\]]*\]%i', $text))
 63:             $errors[] = $lang_profile['Signature quote/code/list']; 49:             $errors[] = $lang_profile['Signature quote/code/list/h'];
 64:     } 50:     }
 65:  51: 
 66:     // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) 52:     // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched)
131:     $tags_opened = $tags;117:     $tags_opened = $tags;
132:     // and tags we need to check are closed (the same as above, added it just in case)118:     // and tags we need to check are closed (the same as above, added it just in case)
133:     $tags_closed = $tags;119:     $tags_closed = $tags;
134:     // Tags we can nest and the depth they can be nested to (only quotes )120:     // Tags we can nest and the depth they can be nested to (only quotes)
135:     $tags_nested = array('quote' => $pun_config['o_quote_depth'], 'list' => 5, '*' => 5);121:     $tags_nested = array('quote' => $pun_config['o_quote_depth'], 'list' => 5, '*' => 5);
136:     // Tags to ignore the contents of completely (just code)122:     // Tags to ignore the contents of completely (just code)
137:     $tags_ignore = array('code');123:     $tags_ignore = array('code');
173:         // Are we dealing with a tag?159:         // Are we dealing with a tag?
174:         if (substr($current, 0, 1) != '[' || substr($current, -1, 1) != ']')160:         if (substr($current, 0, 1) != '[' || substr($current, -1, 1) != ']')
175:         {161:         {
176:             // Its not a bbcode tag so we put it on the end and continue162:             // It's not a bbcode tag so we put it on the end and continue
177: 163: 
178:             // If we are nested too deeply don't add to the end164:             // If we are nested too deeply don't add to the end
179:             if ($current_nest)165:             if ($current_nest)
261:         // Is the tag defined?247:         // Is the tag defined?
262:         if (!in_array($current_tag, $tags))248:         if (!in_array($current_tag, $tags))
263:         {249:         {
264:             // Its not a bbcode tag so we put it on the end and continue250:             // It's not a bbcode tag so we put it on the end and continue
265:             if (!$current_nest)251:             if (!$current_nest)
266:                 $new_text .= $current;252:                 $new_text .= $current;
267: 253: 
268:             continue;254:             continue;
269:         }255:         }
270: 256: 
271:         // We definitely have a bbcode tag.257:         // We definitely have a bbcode tag
272: 258: 
273:         // Make the tag string lower case259:         // Make the tag string lower case
274:         if ($equalpos = strpos($current,'='))260:         if ($equalpos = strpos($current,'='))
277:             if (strlen(substr($current, $equalpos)) == 2)263:             if (strlen(substr($current, $equalpos)) == 2)
278:             {264:             {
279:                 // Empty tag argument265:                 // Empty tag argument
280:                 $errors[] = sprintf($lang_common['BBCode error 6'], $current_tag);266:                 $errors[] = sprintf($lang_common['BBCode error empty attribute'], $current_tag);
281:                 return false;267:                 return false;
282:             }268:             }
283:             $current = strtolower(substr($current, 0, $equalpos)).substr($current, $equalpos);269:             $current = strtolower(substr($current, 0, $equalpos)).substr($current, $equalpos);
285:         else271:         else
286:             $current = strtolower($current);272:             $current = strtolower($current);
287: 273: 
288:         //This is if we are currently in a tag which escapes other bbcode such as code274:         // This is if we are currently in a tag which escapes other bbcode such as code
289:         if ($current_ignore)275:         if ($current_ignore)
290:         {276:         {
291:             if ('[/'.$current_ignore.']' == $current)277:             if ('[/'.$current_ignore.']' == $current)
302: 288: 
303:         if ($current_nest)289:         if ($current_nest)
304:         {290:         {
305:             // We are currently too deeply nested so lets see if we are closing the tag or not.291:             // We are currently too deeply nested so lets see if we are closing the tag or not
306:             if ($current_tag != $current_nest)292:             if ($current_tag != $current_nest)
307:                 continue;293:                 continue;
308: 294: 
320:         // Check the current tag is allowed here306:         // Check the current tag is allowed here
321:         if (!in_array($current_tag, $limit_bbcode) && $current_tag != $open_tags[$opened_tag])307:         if (!in_array($current_tag, $limit_bbcode) && $current_tag != $open_tags[$opened_tag])
322:         {308:         {
323:             $errors[] = sprintf($lang_common['BBCode error 3'], $current_tag, $open_tags[$opened_tag]);309:             $errors[] = sprintf($lang_common['BBCode error invalid nesting'], $current_tag, $open_tags[$opened_tag]);
324:             return false;310:             return false;
325:         }311:         }
326: 312: 
327:         if (substr($current, 1, 1) == '/')313:         if (substr($current, 1, 1) == '/')
328:         {314:         {
329:             //This is if we are closing a tag315:             // This is if we are closing a tag
330: 316: 
331:             if ($opened_tag == 0 || !in_array($current_tag, $open_tags))317:             if ($opened_tag == 0 || !in_array($current_tag, $open_tags))
332:             {318:             {
333:                 //We tried to close a tag which is not open319:                 // We tried to close a tag which is not open
334:                 if (in_array($current_tag, $tags_opened))320:                 if (in_array($current_tag, $tags_opened))
335:                 {321:                 {
336:                     $errors[] = sprintf($lang_common['BBCode error 1'], $current_tag);322:                     $errors[] = sprintf($lang_common['BBCode error no opening tag'], $current_tag);
337:                     return false;323:                     return false;
338:                 }324:                 }
339:             }325:             }
367:                                 if (!in_array($temp_tag, $tags_fix))353:                                 if (!in_array($temp_tag, $tags_fix))
368:                                 {354:                                 {
369:                                     // We couldn't fix nesting355:                                     // We couldn't fix nesting
370:                                     $errors[] = sprintf($lang_common['BBCode error 5'], array_pop($temp_opened));356:                                     $errors[] = sprintf($lang_common['BBCode error no closing tag'], array_pop($temp_opened));
371:                                     return false;357:                                     return false;
372:                                 }358:                                 }
373:                                 array_push($temp_opened, $temp_tag);359:                                 array_push($temp_opened, $temp_tag);
401:                         else387:                         else
402:                         {388:                         {
403:                             // We couldn't fix nesting389:                             // We couldn't fix nesting
404:                             $errors[] = sprintf($lang_common['BBCode error 1'], $current_tag);390:                             $errors[] = sprintf($lang_common['BBCode error no opening tag'], $current_tag);
405:                             return false;391:                             return false;
406:                         }392:                         }
407:                     }393:                     }
442:             if (in_array($current_tag, $tags_block) && !in_array($open_tags[$opened_tag], $tags_block) && $opened_tag != 0)428:             if (in_array($current_tag, $tags_block) && !in_array($open_tags[$opened_tag], $tags_block) && $opened_tag != 0)
443:             {429:             {
444:                 // We tried to open a block tag within a non-block tag430:                 // We tried to open a block tag within a non-block tag
445:                 $errors[] = sprintf($lang_common['BBCode error 3'], $current_tag, $open_tags[$opened_tag]);431:                 $errors[] = sprintf($lang_common['BBCode error invalid nesting'], $current_tag, $open_tags[$opened_tag]);
446:                 return false;432:                 return false;
447:             }433:             }
448: 434: 
449:             if (in_array($current_tag, $tags_ignore))435:             if (in_array($current_tag, $tags_ignore))
450:             {436:             {
451:                 // Its an ignore tag so we don't need to worry about whats inside it,437:                 // It's an ignore tag so we don't need to worry about what's inside it
452:                 $current_ignore = $current_tag;438:                 $current_ignore = $current_tag;
453:                 $new_text .= $current;439:                 $new_text .= $current;
454:                 continue;440:                 continue;
458:             if (in_array($current_tag, $open_tags) && !in_array($current_tag, array_keys($tags_nested)))444:             if (in_array($current_tag, $open_tags) && !in_array($current_tag, array_keys($tags_nested)))
459:             {445:             {
460:                 // We nested a tag we shouldn't446:                 // We nested a tag we shouldn't
461:                 $errors[] = sprintf($lang_common['BBCode error 4'], $current_tag);447:                 $errors[] = sprintf($lang_common['BBCode error invalid self-nesting'], $current_tag);
462:                 return false;448:                 return false;
463:             }449:             }
464:             else if (in_array($current_tag, array_keys($tags_nested)))450:             else if (in_array($current_tag, array_keys($tags_nested)))
501:         if (in_array($check, $open_tags))487:         if (in_array($check, $open_tags))
502:         {488:         {
503:             // We left an important tag open489:             // We left an important tag open
504:             $errors[] = sprintf($lang_common['BBCode error 5'], $check);490:             $errors[] = sprintf($lang_common['BBCode error no closing tag'], $check);
505:             return false;491:             return false;
506:         }492:         }
507:     }493:     }
509:     if ($current_ignore)495:     if ($current_ignore)
510:     {496:     {
511:         // We left an ignore tag open497:         // We left an ignore tag open
512:         $errors[] = sprintf($lang_common['BBCode error 5'], $current_ignore);498:         $errors[] = sprintf($lang_common['BBCode error no closing tag'], $current_ignore);
513:         return false;499:         return false;
514:     }500:     }
515: 501: 
587: //573: //
588: function handle_url_tag($url, $link = '', $bbcode = false)574: function handle_url_tag($url, $link = '', $bbcode = false)
589: {575: {
 576:     $url = pun_trim($url);
590:     $full_url = str_replace(array(' ', '\'', '`', '"'), array('%20', '', '', ''), $url);577:     $full_url = str_replace(array(' ', '\'', '`', '"'), array('%20', '', '', ''), $url);
591:     if (strpos($url, 'www.') === 0)            // If it starts with www, we add http://578:     if (strpos($url, 'www.') === 0) // If it starts with www, we add http://
592:         $full_url = 'http://'.$full_url;579:         $full_url = 'http://'.$full_url;
593:     else if (strpos($url, 'ftp.') === 0)    // Else if it starts with ftp, we add ftp://580:     else if (strpos($url, 'ftp.') === 0) // Else if it starts with ftp, we add ftp://
594:         $full_url = 'ftp://'.$full_url;581:         $full_url = 'ftp://'.$full_url;
595:     else if (!preg_match('#^([a-z0-9]{3,6})://#', $url))     // Else if it doesn't start with abcdef://, we add http://582:     else if (!preg_match('#^([a-z0-9]{3,6})://#', $url)) // Else if it doesn't start with abcdef://, we add http://
596:         $full_url = 'http://'.$full_url;583:         $full_url = 'http://'.$full_url;
597: 584: 
598:     // Ok, not very pretty :-)585:     // Ok, not very pretty :-)
647:         $content = preg_replace($pattern, $replace, $content);634:         $content = preg_replace($pattern, $replace, $content);
648:     }635:     }
649: 636: 
650:     $content = preg_replace('#\s*\[\*\](.*?)\[/\*\]\s*#s', '<li>$1</li>', pun_trim($content));637:     $content = preg_replace('#\s*\[\*\](.*?)\[/\*\]\s*#s', '<li><p>$1</p></li>', pun_trim($content));
651: 638: 
652:     if ($type == '*')639:     if ($type == '*')
653:         $content = '<ul>'.$content.'</ul>';640:         $content = '<ul>'.$content.'</ul>';
745: //732: //
746: function do_smilies($text)733: function do_smilies($text)
747: {734: {
748:     global $pun_config, $base_url, $smilies;735:     global $pun_config, $smilies;
749: 736: 
750:     $text = ' '.$text.' ';737:     $text = ' '.$text.' ';
751: 738: 
752:     foreach ($smilies as $smiley_text => $smiley_img)739:     foreach ($smilies as $smiley_text => $smiley_img)
753:     {740:     {
754:         if (strpos($text, $smiley_text) !== false)741:         if (strpos($text, $smiley_text) !== false)
755:             $text = preg_replace("#(?<=[>\s])".preg_quote($smiley_text, '#')."(?=\W)#m", '<img src="'.$base_url.'img/smilies/'.$smiley_img.'" width="15" height="15" alt="'.substr($smiley_img, 0, strrpos($smiley_img, '.')).'" />', $text);742:             $text = preg_replace("#(?<=[>\s])".preg_quote($smiley_text, '#')."(?=\W)#m", '<img src="'.$pun_config['o_base_url'].'/img/smilies/'.$smiley_img.'" width="15" height="15" alt="'.substr($smiley_img, 0, strrpos($smiley_img, '.')).'" />', $text);
756:     }743:     }
757: 744: 
758:     return substr($text, 1, -1);745:     return substr($text, 1, -1);
802:         {789:         {
803:             $text .= $outside[$i];790:             $text .= $outside[$i];
804:             if (isset($inside[$i]))791:             if (isset($inside[$i]))
805:                 $text .= '</p><div class="codebox"><pre><code>'.pun_trim($inside[$i], "\n\r").'</code></pre></div><p>';792:             //    $text .= '</p><div class="codebox"><pre><code>'.pun_trim($inside[$i], "\n\r").'</code></pre></div><p>';
 793:             {
 794:                 $num_lines = (substr_count($inside[$i], "\n"));
 795:                 $text .= '</p><div class="codebox"><pre'.(($num_lines > 28) ? ' class="vscroll"' : '').'><code>'.pun_trim($inside[$i], "\n\r").'</code></pre></div><p>';
 796:             }
806:         }797:         }
807:     }798:     }
808: 799: 


a/upload/include/search_idx.php b/upload/include/search_idx.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // The contents of this file are very much inspired by the file functions_search.php 11: // The contents of this file are very much inspired by the file functions_search.php
 27: // from the phpBB Group forum software phpBB2 (http://www.phpbb.com).  12: // from the phpBB Group forum software phpBB2 (http://www.phpbb.com)
 28:  13: 
 29:  14: 
 30: // Make sure no one attempts to run this script "directly" 15: // Make sure no one attempts to run this script "directly"
 47:         $noise_replace =    array('',       '',      '',     '',     '',       '',       '',        '',       '',      '',     '',     '',       '',       '',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', '',  '',   ' ', ' ', ' ', ' ', '',  ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '' ,  ' ', ' ', ' ', ' ', ' ', ' '); 32:         $noise_replace =    array('',       '',      '',     '',     '',       '',       '',        '',       '',      '',     '',     '',       '',       '',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', '',  '',   ' ', ' ', ' ', ' ', '',  ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '' ,  ' ', ' ', ' ', ' ', ' ', ' ');
 48:  33: 
 49:         $stopwords = (array)@file(PUN_ROOT.'lang/'.$pun_user['language'].'/stopwords.txt'); 34:         $stopwords = (array)@file(PUN_ROOT.'lang/'.$pun_user['language'].'/stopwords.txt');
 50:         $stopwords = array_map('trim', $stopwords); 35:         $stopwords = array_map('pun_trim', $stopwords);
 51:     } 36:     }
 52:  37: 
 53:     // Clean up 38:     // Clean up


a/upload/include/template/help.tpl b/upload/include/template/help.tpl
  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2:   2: 
  3: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="<pun_content_direction>">  3: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<pun_language>" lang="<pun_language>" dir="<pun_content_direction>">
  4: <head>  4: <head>
  5: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  5: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6: <pun_head>  6: <pun_head>


a/upload/include/template/main.tpl b/upload/include/template/main.tpl
  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2:   2: 
  3: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="<pun_content_direction>">  3: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<pun_language>" lang="<pun_language>" dir="<pun_content_direction>">
  4: <head>  4: <head>
  5: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  5: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6: <pun_head>  6: <pun_head>


a/upload/include/template/maintenance.tpl b/upload/include/template/maintenance.tpl
  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2:   2: 
  3: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="<pun_content_direction>">  3: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<pun_language>" lang="<pun_language>" dir="<pun_content_direction>">
  4: <head>  4: <head>
  5: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  5: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6: <pun_head>  6: <pun_head>


a/upload/include/template/redirect.tpl b/upload/include/template/redirect.tpl
  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2:   2: 
  3: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="<pun_content_direction>">  3: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<pun_language>" lang="<pun_language>" dir="<pun_content_direction>">
  4: <head>  4: <head>
  5: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  5: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6: <pun_head>  6: <pun_head>


a/upload/include/utf8/mbstring/core.php b/upload/include/utf8/mbstring/core.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: core.php,v 1.5 2006/02/28 22:12:25 harryf Exp $  4: * @version $Id: core.php,v 1.5 2006/02/28 22:12:25 harryf Exp $
  4: * @package utf8  5: * @package utf8
  8: /**  9: /**
  9: * Define UTF8_CORE as required 10: * Define UTF8_CORE as required
 10: */ 11: */
 11: if ( !defined('UTF8_CORE') ) { 12: if (!defined('UTF8_CORE'))
 12:     define('UTF8_CORE',TRUE); 13:     define('UTF8_CORE', true);
 13: } 
 14:  14: 
 15: //-------------------------------------------------------------------- 
 16: /** 15: /**
 17: * Wrapper round mb_strlen 16: * Wrapper round mb_strlen
 18: * Assumes you have mb_internal_encoding to UTF-8 already 17: * Assumes you have mb_internal_encoding to UTF-8 already
 23: * @package utf8 22: * @package utf8
 24: * @subpackage strings 23: * @subpackage strings
 25: */ 24: */
 26: function utf8_strlen($str){ 25: function utf8_strlen($str)
 27:     return mb_strlen($str); 26: {
  27:     return mb_strlen($str);
 28: } 28: }
 29:  29: 
 30:  
 31: //-------------------------------------------------------------------- 
 32: /** 30: /**
 33: * Assumes mbstring internal encoding is set to UTF-8 31: * Assumes mbstring internal encoding is set to UTF-8
 34: * Wrapper around mb_strpos 32: * Wrapper around mb_strpos
 40: * @package utf8 38: * @package utf8
 41: * @subpackage strings 39: * @subpackage strings
 42: */ 40: */
 43: function utf8_strpos($str, $search, $offset = FALSE){ 41: function utf8_strpos($str, $search, $offset = false)
 44:     if ( $offset === FALSE ) { 42: {
 45:         return mb_strpos($str, $search); 43:     if ($offset === false)
 46:     } else { 44:         return mb_strpos($str, $search);
 47:         return mb_strpos($str, $search, $offset); 45:     else
 48:     } 46:         return mb_strpos($str, $search, $offset);
 49: } 47: }
 50:  48: 
 51: //-------------------------------------------------------------------- 
 52: /** 49: /**
 53: * Assumes mbstring internal encoding is set to UTF-8 50: * Assumes mbstring internal encoding is set to UTF-8
 54: * Wrapper around mb_strrpos 51: * Wrapper around mb_strrpos
 60: * @package utf8 57: * @package utf8
 61: * @subpackage strings 58: * @subpackage strings
 62: */ 59: */
 63: function utf8_strrpos($str, $search, $offset = FALSE){ 60: function utf8_strrpos($str, $search, $offset = false)
 64:     if ( $offset === FALSE ) { 61: {
 65:         # Emulate behaviour of strrpos rather than raising warning 62:     if ($offset === false)
 66:         if ( empty($str) ) { 63:     {
 67:             return FALSE; 64:         // Emulate behaviour of strrpos rather than raising warning
 68:         } 65:         if (empty($str))
 69:         return mb_strrpos($str, $search); 66:             return false;
 70:     } else { 67: 
 71:         if ( !is_int($offset) ) { 68:         return mb_strrpos($str, $search);
 72:             trigger_error('utf8_strrpos expects parameter 3 to be long',E_USER_WARNING); 69:     }
 73:             return FALSE; 70:     else
 74:         } 71:     {
 75:          72:         if (!is_int($offset))
 76:         $str = mb_substr($str, $offset); 73:         {
 77:          74:             trigger_error('utf8_strrpos expects parameter 3 to be long', E_USER_WARNING);
 78:         if ( FALSE !== ( $pos = mb_strrpos($str, $search) ) ) { 75:             return false;
 79:             return $pos + $offset; 76:         }
 80:         } 77: 
 81:          78:         $str = mb_substr($str, $offset);
 82:         return FALSE; 79: 
 83:     } 80:         if (false !== ($pos = mb_strrpos($str, $search)))
  81:             return $pos + $offset;
  82: 
  83:         return false;
  84:     }
 84: } 85: }
 85:  86: 
 86: //-------------------------------------------------------------------- 
 87: /** 87: /**
 88: * Assumes mbstring internal encoding is set to UTF-8 88: * Assumes mbstring internal encoding is set to UTF-8
 89: * Wrapper around mb_substr 89: * Wrapper around mb_substr
 95: * @package utf8 95: * @package utf8
 96: * @subpackage strings 96: * @subpackage strings
 97: */ 97: */
 98: function utf8_substr($str, $offset, $length = FALSE){ 98: function utf8_substr($str, $offset, $length = false)
 99:     if ( $length === FALSE ) { 99: {
100:         return mb_substr($str, $offset);100:     if ($length === false)
101:     } else {101:         return mb_substr($str, $offset);
102:         return mb_substr($str, $offset, $length);102:     else
103:     }103:         return mb_substr($str, $offset, $length);
104: }104: }
105: 105: 
106: //-------------------------------------------------------------------- 
107: /**106: /**
108: * Assumes mbstring internal encoding is set to UTF-8107: * Assumes mbstring internal encoding is set to UTF-8
109: * Wrapper around mb_strtolower108: * Wrapper around mb_strtolower
117: * @package utf8116: * @package utf8
118: * @subpackage strings117: * @subpackage strings
119: */118: */
120: function utf8_strtolower($str){119: function utf8_strtolower($str)
121:     return mb_strtolower($str);120: {
 121:     return mb_strtolower($str);
122: }122: }
123: 123: 
124: //-------------------------------------------------------------------- 
125: /**124: /**
126: * Assumes mbstring internal encoding is set to UTF-8125: * Assumes mbstring internal encoding is set to UTF-8
127: * Wrapper around mb_strtoupper126: * Wrapper around mb_strtoupper
135: * @package utf8134: * @package utf8
136: * @subpackage strings135: * @subpackage strings
137: */136: */
138: function utf8_strtoupper($str){137: function utf8_strtoupper($str)
139:     return mb_strtoupper($str);138: {
 139:     return mb_strtoupper($str);
140: }140: }


a/upload/include/utf8/native/core.php b/upload/include/utf8/native/core.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: core.php,v 1.9 2007/08/12 01:11:33 harryf Exp $  4: * @version $Id: core.php,v 1.9 2007/08/12 01:11:33 harryf Exp $
  4: * @package utf8  5: * @package utf8
  8: /**  9: /**
  9: * Define UTF8_CORE as required 10: * Define UTF8_CORE as required
 10: */ 11: */
 11: if ( !defined('UTF8_CORE') ) { 12: if (!defined('UTF8_CORE'))
 12:     define('UTF8_CORE',TRUE); 13:     define('UTF8_CORE', true);
 13: } 
 14:  14: 
 15: //-------------------------------------------------------------------- 
 16: /** 15: /**
 17: * Unicode aware replacement for strlen(). Returns the number 16: * Unicode aware replacement for strlen(). Returns the number
 18: * of characters in the string (not the number of bytes), replacing 17: * of characters in the string (not the number of bytes), replacing
 30: * @package utf8 29: * @package utf8
 31: * @subpackage strings 30: * @subpackage strings
 32: */ 31: */
 33: function utf8_strlen($str){ 32: function utf8_strlen($str)
 34:     return strlen(utf8_decode($str)); 33: {
  34:     return strlen(utf8_decode($str));
 35: } 35: }
 36:  36: 
 37:  
 38: //-------------------------------------------------------------------- 
 39: /** 37: /**
 40: * UTF-8 aware alternative to strpos 38: * UTF-8 aware alternative to strpos
 41: * Find position of first occurrence of a string 39: * Find position of first occurrence of a string
 51: * @package utf8 49: * @package utf8
 52: * @subpackage strings 50: * @subpackage strings
 53: */ 51: */
 54: function utf8_strpos($str, $needle, $offset = NULL) { 52: function utf8_strpos($str, $needle, $offset = null)
 55:      53: {
 56:     if ( is_null($offset) ) { 54:     if (is_null($offset))
 57:      55:     {
 58:         $ar = explode($needle, $str, 2); 56:         $ar = explode($needle, $str, 2);
 59:         if ( count($ar) > 1 ) { 57: 
 60:             return utf8_strlen($ar[0]); 58:         if (count($ar) > 1)
 61:         } 59:             return utf8_strlen($ar[0]);
 62:         return FALSE; 60: 
 63:          61:         return false;
 64:     } else { 62:     }
 65:          63:     else
 66:         if ( !is_int($offset) ) { 64:     {
 67:             trigger_error('utf8_strpos: Offset must be an integer',E_USER_ERROR); 65:         if (!is_int($offset))
 68:             return FALSE; 66:         {
 69:         } 67:             trigger_error('utf8_strpos: Offset must be an integer', E_USER_ERROR);
 70:          68:             return false;
 71:         $str = utf8_substr($str, $offset); 69:         }
 72:          70: 
 73:         if ( FALSE !== ( $pos = utf8_strpos($str, $needle) ) ) { 71:         $str = utf8_substr($str, $offset);
 74:             return $pos + $offset; 72: 
 75:         } 73:         if (false !== ($pos = utf8_strpos($str, $needle)))
 76:          74:             return $pos + $offset;
 77:         return FALSE; 75: 
 78:     } 76:         return false;
 79:      77:     }
 80: } 78: }
 81:  79: 
 82: //-------------------------------------------------------------------- 
 83: /** 80: /**
 84: * UTF-8 aware alternative to strrpos 81: * UTF-8 aware alternative to strrpos
 85: * Find position of last occurrence of a char in a string 82: * Find position of last occurrence of a char in a string
 95: * @package utf8 92: * @package utf8
 96: * @subpackage strings 93: * @subpackage strings
 97: */ 94: */
 98: function utf8_strrpos($str, $needle, $offset = NULL) { 95: function utf8_strrpos($str, $needle, $offset = null)
 99:      96: {
100:     if ( is_null($offset) ) { 97:     if (is_null($offset))
101:      98:     {
102:         $ar = explode($needle, $str); 99:         $ar = explode($needle, $str);
103:         100: 
104:         if ( count($ar) > 1 ) {101:         if (count($ar) > 1)
105:             // Pop off the end of the string where the last match was made102:         {
106:             array_pop($ar);103:             // Pop off the end of the string where the last match was made
107:             $str = join($needle,$ar);104:             array_pop($ar);
108:             return utf8_strlen($str);105:             $str = join($needle,$ar);
109:         }106:             return utf8_strlen($str);
110:         return FALSE;107:         }
111:         108: 
112:     } else {109:         return false;
113:         110:     }
114:         if ( !is_int($offset) ) {111:     else
115:             trigger_error('utf8_strrpos expects parameter 3 to be long',E_USER_WARNING);112:     {
116:             return FALSE;113:         if (!is_int($offset))
117:         }114:         {
118:         115:             trigger_error('utf8_strrpos expects parameter 3 to be long', E_USER_WARNING);
119:         $str = utf8_substr($str, $offset);116:             return false;
120:         117:         }
121:         if ( FALSE !== ( $pos = utf8_strrpos($str, $needle) ) ) {118: 
122:             return $pos + $offset;119:         $str = utf8_substr($str, $offset);
123:         }120: 
124:         121:         if (false !== ($pos = utf8_strrpos($str, $needle)))
125:         return FALSE;122:             return $pos + $offset;
126:     }123: 
127:     124:         return false;
 125:     }
128: }126: }
129: 127: 
130: //-------------------------------------------------------------------- 
131: /**128: /**
132: * UTF-8 aware alternative to substr129: * UTF-8 aware alternative to substr
133: * Return part of a string given character offset (and optionally length)130: * Return part of a string given character offset (and optionally length)
157: * @package utf8154: * @package utf8
158: * @subpackage strings155: * @subpackage strings
159: */156: */
160: function utf8_substr($str, $offset, $length = NULL) {157: function utf8_substr($str, $offset, $length = null)
161:     158: {
162:     // generates E_NOTICE159:     // Generates E_NOTICE for PHP4 objects, but not PHP5 objects
163:     // for PHP4 objects, but not PHP5 objects160:     $str = (string) $str;
164:     $str = (string)$str;161:     $offset = (int) $offset;
165:     $offset = (int)$offset;162:     if (!is_null($length)) $length = (int) $length;
166:     if (!is_null($length)) $length = (int)$length;163: 
167:     164:     // Handle trivial cases
168:     // handle trivial cases165:     if ($length === 0) return '';
169:     if ($length === 0) return '';166:     if ($offset < 0 && $length < 0 && $length < $offset)
170:     if ($offset < 0 && $length < 0 && $length < $offset)167:         return '';
171:         return '';168: 
172:     169:     // Normalise negative offsets (we could use a tail
173:     // normalise negative offsets (we could use a tail170:     // anchored pattern, but they are horribly slow!)
174:     // anchored pattern, but they are horribly slow!)171:     if ($offset < 0)
175:     if ($offset < 0) {172:     {
176:         173:         // See notes
177:         // see notes174:         $strlen = strlen(utf8_decode($str));
178:         $strlen = strlen(utf8_decode($str));175:         $offset = $strlen + $offset;
179:         $offset = $strlen + $offset;176:         if ($offset < 0) $offset = 0;
180:         if ($offset < 0) $offset = 0;177:     }
181:         178: 
182:     }179:     $Op = '';
183:     180:     $Lp = '';
184:     $Op = '';181: 
185:     $Lp = '';182:     // Establish a pattern for offset, a
186:     183:     // non-captured group equal in length to offset
187:     // establish a pattern for offset, a184:     if ($offset > 0)
188:     // non-captured group equal in length to offset185:     {
189:     if ($offset > 0) {186:         $Ox = (int) ($offset / 65535);
190:         187:         $Oy = $offset % 65535;
191:         $Ox = (int)($offset/65535);188: 
192:         $Oy = $offset%65535;189:         if ($Ox)
193:         190:             $Op = '(?:.{65535}){'.$Ox.'}';
194:         if ($Ox) {191: 
195:             $Op = '(?:.{65535}){'.$Ox.'}';192:         $Op = '^(?:'.$Op.'.{'.$Oy.'})';
196:         }193:     }
197:         194:     else
198:         $Op = '^(?:'.$Op.'.{'.$Oy.'})';195:         $Op = '^';
199:         196: 
200:     } else {197: 
201:         198:     // Establish a pattern for length
202:         // offset == 0; just anchor the pattern199:     if (is_null($length))
203:         $Op = '^';200:     {
204:         201:         // The rest of the string
205:     }202:         $Lp = '(.*)$';
206:     203:     }
207:     // establish a pattern for length204:     else
208:     if (is_null($length)) {205:     {
209:         206:         // See notes
210:         // the rest of the string207:         if (!isset($strlen))
211:         $Lp = '(.*)$';208:             $strlen = strlen(utf8_decode($str));
212:         209: 
213:     } else {210:         // Another trivial case
214:         211:         if ($offset > $strlen) return '';
215:         if (!isset($strlen)) {212: 
216:             // see notes213:         if ($length > 0)
217:             $strlen = strlen(utf8_decode($str));214:         {
218:         }215:             // Reduce any length that would go passed the end of the string
219:         216:             $length = min($strlen-$offset, $length);
220:         // another trivial case217: 
221:         if ($offset > $strlen) return '';218:             $Lx = (int)( $length / 65535 );
222:         219:             $Ly = $length % 65535;
223:         if ($length > 0) {220: 
224:             221:             // Negative length requires a captured group of length characters
225:             // reduce any length that would222:             if ($Lx) $Lp = '(?:.{65535}){'.$Lx.'}';
226:             // go passed the end of the string223:             $Lp = '('.$Lp.'.{'.$Ly.'})';
227:             $length = min($strlen-$offset, $length);224:         }
228:             225:         else if ($length < 0)
229:             $Lx = (int)( $length / 65535 );226:         {
230:             $Ly = $length % 65535;227: 
231:             228:             if ($length < ($offset - $strlen))
232:             // negative length requires a captured group229:                 return '';
233:             // of length characters230: 
234:             if ($Lx) $Lp = '(?:.{65535}){'.$Lx.'}';231:             $Lx = (int)((-$length)/65535);
235:             $Lp = '('.$Lp.'.{'.$Ly.'})';232:             $Ly = (-$length)%65535;
236:             233: 
237:         } else if ($length < 0) {234:             // Negative length requires ... capture everything except a group of
238:             235:             // -length characters anchored at the tail-end of the string
239:             if ( $length < ($offset - $strlen) ) {236:             if ($Lx) $Lp = '(?:.{65535}){'.$Lx.'}';
240:                 return '';237:             $Lp = '(.*)(?:'.$Lp.'.{'.$Ly.'})$';
241:             }238:         }
242:             239:     }
243:             $Lx = (int)((-$length)/65535);240: 
244:             $Ly = (-$length)%65535;241:     if (!preg_match( '#'.$Op.$Lp.'#us',$str, $match ))
245:             242:         return '';
246:             // negative length requires ... capture everything243: 
247:             // except a group of  -length characters244:     return $match[1];
248:             // anchored at the tail-end of the string 
249:             if ($Lx) $Lp = '(?:.{65535}){'.$Lx.'}'; 
250:             $Lp = '(.*)(?:'.$Lp.'.{'.$Ly.'})$'; 
251:              
252:         } 
253:          
254:     } 
255:      
256:     if (!preg_match( '#'.$Op.$Lp.'#us',$str, $match )) { 
257:         return ''; 
258:     } 
259:      
260:     return $match[1]; 
261:      
262: }245: }
263: 246: 
264: //--------------------------------------------------------------- 
265: /**247: /**
266: * UTF-8 aware alternative to strtolower248: * UTF-8 aware alternative to strtolower
267: * Make a string lowercase249: * Make a string lowercase
281: * @package utf8263: * @package utf8
282: * @subpackage strings264: * @subpackage strings
283: */265: */
284: function utf8_strtolower($string){266: function utf8_strtolower($string)
285:     267: {
286:     static $UTF8_UPPER_TO_LOWER = NULL;268:     static $UTF8_UPPER_TO_LOWER = null;
287:     269: 
288:     if ( is_null($UTF8_UPPER_TO_LOWER) ) {270:     if (is_null($UTF8_UPPER_TO_LOWER))
289:         $UTF8_UPPER_TO_LOWER = array(271:     {
290:     0x0041=>0x0061, 0x03A6=>0x03C6, 0x0162=>0x0163, 0x00C5=>0x00E5, 0x0042=>0x0062,272:         $UTF8_UPPER_TO_LOWER = array(
291:     0x0139=>0x013A, 0x00C1=>0x00E1, 0x0141=>0x0142, 0x038E=>0x03CD, 0x0100=>0x0101,273:             0x0041=>0x0061, 0x03A6=>0x03C6, 0x0162=>0x0163, 0x00C5=>0x00E5, 0x0042=>0x0062,
292:     0x0490=>0x0491, 0x0394=>0x03B4, 0x015A=>0x015B, 0x0044=>0x0064, 0x0393=>0x03B3,274:             0x0139=>0x013A, 0x00C1=>0x00E1, 0x0141=>0x0142, 0x038E=>0x03CD, 0x0100=>0x0101,
293:     0x00D4=>0x00F4, 0x042A=>0x044A, 0x0419=>0x0439, 0x0112=>0x0113, 0x041C=>0x043C,275:             0x0490=>0x0491, 0x0394=>0x03B4, 0x015A=>0x015B, 0x0044=>0x0064, 0x0393=>0x03B3,
294:     0x015E=>0x015F, 0x0143=>0x0144, 0x00CE=>0x00EE, 0x040E=>0x045E, 0x042F=>0x044F,276:             0x00D4=>0x00F4, 0x042A=>0x044A, 0x0419=>0x0439, 0x0112=>0x0113, 0x041C=>0x043C,
295:     0x039A=>0x03BA, 0x0154=>0x0155, 0x0049=>0x0069, 0x0053=>0x0073, 0x1E1E=>0x1E1F,277:             0x015E=>0x015F, 0x0143=>0x0144, 0x00CE=>0x00EE, 0x040E=>0x045E, 0x042F=>0x044F,
296:     0x0134=>0x0135, 0x0427=>0x0447, 0x03A0=>0x03C0, 0x0418=>0x0438, 0x00D3=>0x00F3,278:             0x039A=>0x03BA, 0x0154=>0x0155, 0x0049=>0x0069, 0x0053=>0x0073, 0x1E1E=>0x1E1F,
297:     0x0420=>0x0440, 0x0404=>0x0454, 0x0415=>0x0435, 0x0429=>0x0449, 0x014A=>0x014B,279:             0x0134=>0x0135, 0x0427=>0x0447, 0x03A0=>0x03C0, 0x0418=>0x0438, 0x00D3=>0x00F3,
298:     0x0411=>0x0431, 0x0409=>0x0459, 0x1E02=>0x1E03, 0x00D6=>0x00F6, 0x00D9=>0x00F9,280:             0x0420=>0x0440, 0x0404=>0x0454, 0x0415=>0x0435, 0x0429=>0x0449, 0x014A=>0x014B,
299:     0x004E=>0x006E, 0x0401=>0x0451, 0x03A4=>0x03C4, 0x0423=>0x0443, 0x015C=>0x015D,281:             0x0411=>0x0431, 0x0409=>0x0459, 0x1E02=>0x1E03, 0x00D6=>0x00F6, 0x00D9=>0x00F9,
300:     0x0403=>0x0453, 0x03A8=>0x03C8, 0x0158=>0x0159, 0x0047=>0x0067, 0x00C4=>0x00E4,282:             0x004E=>0x006E, 0x0401=>0x0451, 0x03A4=>0x03C4, 0x0423=>0x0443, 0x015C=>0x015D,
301:     0x0386=>0x03AC, 0x0389=>0x03AE, 0x0166=>0x0167, 0x039E=>0x03BE, 0x0164=>0x0165,283:             0x0403=>0x0453, 0x03A8=>0x03C8, 0x0158=>0x0159, 0x0047=>0x0067, 0x00C4=>0x00E4,
302:     0x0116=>0x0117, 0x0108=>0x0109, 0x0056=>0x0076, 0x00DE=>0x00FE, 0x0156=>0x0157,284:             0x0386=>0x03AC, 0x0389=>0x03AE, 0x0166=>0x0167, 0x039E=>0x03BE, 0x0164=>0x0165,
303:     0x00DA=>0x00FA, 0x1E60=>0x1E61, 0x1E82=>0x1E83, 0x00C2=>0x00E2, 0x0118=>0x0119,285:             0x0116=>0x0117, 0x0108=>0x0109, 0x0056=>0x0076, 0x00DE=>0x00FE, 0x0156=>0x0157,
304:     0x0145=>0x0146, 0x0050=>0x0070, 0x0150=>0x0151, 0x042E=>0x044E, 0x0128=>0x0129,286:             0x00DA=>0x00FA, 0x1E60=>0x1E61, 0x1E82=>0x1E83, 0x00C2=>0x00E2, 0x0118=>0x0119,
305:     0x03A7=>0x03C7, 0x013D=>0x013E, 0x0422=>0x0442, 0x005A=>0x007A, 0x0428=>0x0448,287:             0x0145=>0x0146, 0x0050=>0x0070, 0x0150=>0x0151, 0x042E=>0x044E, 0x0128=>0x0129,
306:     0x03A1=>0x03C1, 0x1E80=>0x1E81, 0x016C=>0x016D, 0x00D5=>0x00F5, 0x0055=>0x0075,288:             0x03A7=>0x03C7, 0x013D=>0x013E, 0x0422=>0x0442, 0x005A=>0x007A, 0x0428=>0x0448,
307:     0x0176=>0x0177, 0x00DC=>0x00FC, 0x1E56=>0x1E57, 0x03A3=>0x03C3, 0x041A=>0x043A,289:             0x03A1=>0x03C1, 0x1E80=>0x1E81, 0x016C=>0x016D, 0x00D5=>0x00F5, 0x0055=>0x0075,
308:     0x004D=>0x006D, 0x016A=>0x016B, 0x0170=>0x0171, 0x0424=>0x0444, 0x00CC=>0x00EC,290:             0x0176=>0x0177, 0x00DC=>0x00FC, 0x1E56=>0x1E57, 0x03A3=>0x03C3, 0x041A=>0x043A,
309:     0x0168=>0x0169, 0x039F=>0x03BF, 0x004B=>0x006B, 0x00D2=>0x00F2, 0x00C0=>0x00E0,291:             0x004D=>0x006D, 0x016A=>0x016B, 0x0170=>0x0171, 0x0424=>0x0444, 0x00CC=>0x00EC,
310:     0x0414=>0x0434, 0x03A9=>0x03C9, 0x1E6A=>0x1E6B, 0x00C3=>0x00E3, 0x042D=>0x044D,292:             0x0168=>0x0169, 0x039F=>0x03BF, 0x004B=>0x006B, 0x00D2=>0x00F2, 0x00C0=>0x00E0,
311:     0x0416=>0x0436, 0x01A0=>0x01A1, 0x010C=>0x010D, 0x011C=>0x011D, 0x00D0=>0x00F0,293:             0x0414=>0x0434, 0x03A9=>0x03C9, 0x1E6A=>0x1E6B, 0x00C3=>0x00E3, 0x042D=>0x044D,
312:     0x013B=>0x013C, 0x040F=>0x045F, 0x040A=>0x045A, 0x00C8=>0x00E8, 0x03A5=>0x03C5,294:             0x0416=>0x0436, 0x01A0=>0x01A1, 0x010C=>0x010D, 0x011C=>0x011D, 0x00D0=>0x00F0,
313:     0x0046=>0x0066, 0x00DD=>0x00FD, 0x0043=>0x0063, 0x021A=>0x021B, 0x00CA=>0x00EA,295:             0x013B=>0x013C, 0x040F=>0x045F, 0x040A=>0x045A, 0x00C8=>0x00E8, 0x03A5=>0x03C5,
314:     0x0399=>0x03B9, 0x0179=>0x017A, 0x00CF=>0x00EF, 0x01AF=>0x01B0, 0x0045=>0x0065,296:             0x0046=>0x0066, 0x00DD=>0x00FD, 0x0043=>0x0063, 0x021A=>0x021B, 0x00CA=>0x00EA,
315:     0x039B=>0x03BB, 0x0398=>0x03B8, 0x039C=>0x03BC, 0x040C=>0x045C, 0x041F=>0x043F,297:             0x0399=>0x03B9, 0x0179=>0x017A, 0x00CF=>0x00EF, 0x01AF=>0x01B0, 0x0045=>0x0065,
316:     0x042C=>0x044C, 0x00DE=>0x00FE, 0x00D0=>0x00F0, 0x1EF2=>0x1EF3, 0x0048=>0x0068,298:             0x039B=>0x03BB, 0x0398=>0x03B8, 0x039C=>0x03BC, 0x040C=>0x045C, 0x041F=>0x043F,
317:     0x00CB=>0x00EB, 0x0110=>0x0111, 0x0413=>0x0433, 0x012E=>0x012F, 0x00C6=>0x00E6,299:             0x042C=>0x044C, 0x00DE=>0x00FE, 0x00D0=>0x00F0, 0x1EF2=>0x1EF3, 0x0048=>0x0068,
318:     0x0058=>0x0078, 0x0160=>0x0161, 0x016E=>0x016F, 0x0391=>0x03B1, 0x0407=>0x0457,300:             0x00CB=>0x00EB, 0x0110=>0x0111, 0x0413=>0x0433, 0x012E=>0x012F, 0x00C6=>0x00E6,
319:     0x0172=>0x0173, 0x0178=>0x00FF, 0x004F=>0x006F, 0x041B=>0x043B, 0x0395=>0x03B5,301:             0x0058=>0x0078, 0x0160=>0x0161, 0x016E=>0x016F, 0x0391=>0x03B1, 0x0407=>0x0457,
320:     0x0425=>0x0445, 0x0120=>0x0121, 0x017D=>0x017E, 0x017B=>0x017C, 0x0396=>0x03B6,302:             0x0172=>0x0173, 0x0178=>0x00FF, 0x004F=>0x006F, 0x041B=>0x043B, 0x0395=>0x03B5,
321:     0x0392=>0x03B2, 0x0388=>0x03AD, 0x1E84=>0x1E85, 0x0174=>0x0175, 0x0051=>0x0071,303:             0x0425=>0x0445, 0x0120=>0x0121, 0x017D=>0x017E, 0x017B=>0x017C, 0x0396=>0x03B6,
322:     0x0417=>0x0437, 0x1E0A=>0x1E0B, 0x0147=>0x0148, 0x0104=>0x0105, 0x0408=>0x0458,304:             0x0392=>0x03B2, 0x0388=>0x03AD, 0x1E84=>0x1E85, 0x0174=>0x0175, 0x0051=>0x0071,
323:     0x014C=>0x014D, 0x00CD=>0x00ED, 0x0059=>0x0079, 0x010A=>0x010B, 0x038F=>0x03CE,305:             0x0417=>0x0437, 0x1E0A=>0x1E0B, 0x0147=>0x0148, 0x0104=>0x0105, 0x0408=>0x0458,
324:     0x0052=>0x0072, 0x0410=>0x0430, 0x0405=>0x0455, 0x0402=>0x0452, 0x0126=>0x0127,306:             0x014C=>0x014D, 0x00CD=>0x00ED, 0x0059=>0x0079, 0x010A=>0x010B, 0x038F=>0x03CE,
325:     0x0136=>0x0137, 0x012A=>0x012B, 0x038A=>0x03AF, 0x042B=>0x044B, 0x004C=>0x006C,307:             0x0052=>0x0072, 0x0410=>0x0430, 0x0405=>0x0455, 0x0402=>0x0452, 0x0126=>0x0127,
326:     0x0397=>0x03B7, 0x0124=>0x0125, 0x0218=>0x0219, 0x00DB=>0x00FB, 0x011E=>0x011F,308:             0x0136=>0x0137, 0x012A=>0x012B, 0x038A=>0x03AF, 0x042B=>0x044B, 0x004C=>0x006C,
327:     0x041E=>0x043E, 0x1E40=>0x1E41, 0x039D=>0x03BD, 0x0106=>0x0107, 0x03AB=>0x03CB,309:             0x0397=>0x03B7, 0x0124=>0x0125, 0x0218=>0x0219, 0x00DB=>0x00FB, 0x011E=>0x011F,
328:     0x0426=>0x0446, 0x00DE=>0x00FE, 0x00C7=>0x00E7, 0x03AA=>0x03CA, 0x0421=>0x0441,310:             0x041E=>0x043E, 0x1E40=>0x1E41, 0x039D=>0x03BD, 0x0106=>0x0107, 0x03AB=>0x03CB,
329:     0x0412=>0x0432, 0x010E=>0x010F, 0x00D8=>0x00F8, 0x0057=>0x0077, 0x011A=>0x011B,311:             0x0426=>0x0446, 0x00DE=>0x00FE, 0x00C7=>0x00E7, 0x03AA=>0x03CA, 0x0421=>0x0441,
330:     0x0054=>0x0074, 0x004A=>0x006A, 0x040B=>0x045B, 0x0406=>0x0456, 0x0102=>0x0103,312:             0x0412=>0x0432, 0x010E=>0x010F, 0x00D8=>0x00F8, 0x0057=>0x0077, 0x011A=>0x011B,
331:     0x039B=>0x03BB, 0x00D1=>0x00F1, 0x041D=>0x043D, 0x038C=>0x03CC, 0x00C9=>0x00E9,313:             0x0054=>0x0074, 0x004A=>0x006A, 0x040B=>0x045B, 0x0406=>0x0456, 0x0102=>0x0103,
332:     0x00D0=>0x00F0, 0x0407=>0x0457, 0x0122=>0x0123,314:             0x039B=>0x03BB, 0x00D1=>0x00F1, 0x041D=>0x043D, 0x038C=>0x03CC, 0x00C9=>0x00E9,
333:             );315:             0x00D0=>0x00F0, 0x0407=>0x0457, 0x0122=>0x0123);
334:     }316:     }
335:     317: 
336:     $uni = utf8_to_unicode($string);318:     $uni = utf8_to_unicode($string);
337:     319: 
338:     if ( !$uni ) {320:     if (!$uni)
339:         return FALSE;321:         return false;
340:     }322: 
341:     323:     $cnt = count($uni);
342:     $cnt = count($uni);324: 
343:     for ($i=0; $i < $cnt; $i++){325:     for ($i=0; $i < $cnt; $i++)
344:         if ( isset($UTF8_UPPER_TO_LOWER[$uni[$i]]) ) {326:         if (isset($UTF8_UPPER_TO_LOWER[$uni[$i]]))
345:             $uni[$i] = $UTF8_UPPER_TO_LOWER[$uni[$i]];327:             $uni[$i] = $UTF8_UPPER_TO_LOWER[$uni[$i]];
346:         }328: 
347:     }329:     return utf8_from_unicode($uni);
348:      
349:     return utf8_from_unicode($uni); 
350: }330: }
351: 331: 
352: //--------------------------------------------------------------- 
353: /**332: /**
354: * UTF-8 aware alternative to strtoupper333: * UTF-8 aware alternative to strtoupper
355: * Make a string uppercase334: * Make a string uppercase
369: * @package utf8348: * @package utf8
370: * @subpackage strings349: * @subpackage strings
371: */350: */
372: function utf8_strtoupper($string){351: function utf8_strtoupper($string)
373:     352: {
374:     static $UTF8_LOWER_TO_UPPER = NULL;353:     static $UTF8_LOWER_TO_UPPER = NULL;
375:     354: 
376:     if ( is_null($UTF8_LOWER_TO_UPPER) ) {355:     if (is_null($UTF8_LOWER_TO_UPPER))
377:         $UTF8_LOWER_TO_UPPER = array(356:     {
378:     0x0061=>0x0041, 0x03C6=>0x03A6, 0x0163=>0x0162, 0x00E5=>0x00C5, 0x0062=>0x0042,357:         $UTF8_LOWER_TO_UPPER = array(
379:     0x013A=>0x0139, 0x00E1=>0x00C1, 0x0142=>0x0141, 0x03CD=>0x038E, 0x0101=>0x0100,358:             0x0061=>0x0041, 0x03C6=>0x03A6, 0x0163=>0x0162, 0x00E5=>0x00C5, 0x0062=>0x0042,
380:     0x0491=>0x0490, 0x03B4=>0x0394, 0x015B=>0x015A, 0x0064=>0x0044, 0x03B3=>0x0393,359:             0x013A=>0x0139, 0x00E1=>0x00C1, 0x0142=>0x0141, 0x03CD=>0x038E, 0x0101=>0x0100,
381:     0x00F4=>0x00D4, 0x044A=>0x042A, 0x0439=>0x0419, 0x0113=>0x0112, 0x043C=>0x041C,360:             0x0491=>0x0490, 0x03B4=>0x0394, 0x015B=>0x015A, 0x0064=>0x0044, 0x03B3=>0x0393,
382:     0x015F=>0x015E, 0x0144=>0x0143, 0x00EE=>0x00CE, 0x045E=>0x040E, 0x044F=>0x042F,361:             0x00F4=>0x00D4, 0x044A=>0x042A, 0x0439=>0x0419, 0x0113=>0x0112, 0x043C=>0x041C,
383:     0x03BA=>0x039A, 0x0155=>0x0154, 0x0069=>0x0049, 0x0073=>0x0053, 0x1E1F=>0x1E1E,362:             0x015F=>0x015E, 0x0144=>0x0143, 0x00EE=>0x00CE, 0x045E=>0x040E, 0x044F=>0x042F,
384:     0x0135=>0x0134, 0x0447=>0x0427, 0x03C0=>0x03A0, 0x0438=>0x0418, 0x00F3=>0x00D3,363:             0x03BA=>0x039A, 0x0155=>0x0154, 0x0069=>0x0049, 0x0073=>0x0053, 0x1E1F=>0x1E1E,
385:     0x0440=>0x0420, 0x0454=>0x0404, 0x0435=>0x0415, 0x0449=>0x0429, 0x014B=>0x014A,364:             0x0135=>0x0134, 0x0447=>0x0427, 0x03C0=>0x03A0, 0x0438=>0x0418, 0x00F3=>0x00D3,
386:     0x0431=>0x0411, 0x0459=>0x0409, 0x1E03=>0x1E02, 0x00F6=>0x00D6, 0x00F9=>0x00D9,365:             0x0440=>0x0420, 0x0454=>0x0404, 0x0435=>0x0415, 0x0449=>0x0429, 0x014B=>0x014A,
387:     0x006E=>0x004E, 0x0451=>0x0401, 0x03C4=>0x03A4, 0x0443=>0x0423, 0x015D=>0x015C,366:             0x0431=>0x0411, 0x0459=>0x0409, 0x1E03=>0x1E02, 0x00F6=>0x00D6, 0x00F9=>0x00D9,
388:     0x0453=>0x0403, 0x03C8=>0x03A8, 0x0159=>0x0158, 0x0067=>0x0047, 0x00E4=>0x00C4,367:             0x006E=>0x004E, 0x0451=>0x0401, 0x03C4=>0x03A4, 0x0443=>0x0423, 0x015D=>0x015C,
389:     0x03AC=>0x0386, 0x03AE=>0x0389, 0x0167=>0x0166, 0x03BE=>0x039E, 0x0165=>0x0164,368:             0x0453=>0x0403, 0x03C8=>0x03A8, 0x0159=>0x0158, 0x0067=>0x0047, 0x00E4=>0x00C4,
390:     0x0117=>0x0116, 0x0109=>0x0108, 0x0076=>0x0056, 0x00FE=>0x00DE, 0x0157=>0x0156,369:             0x03AC=>0x0386, 0x03AE=>0x0389, 0x0167=>0x0166, 0x03BE=>0x039E, 0x0165=>0x0164,
391:     0x00FA=>0x00DA, 0x1E61=>0x1E60, 0x1E83=>0x1E82, 0x00E2=>0x00C2, 0x0119=>0x0118,370:             0x0117=>0x0116, 0x0109=>0x0108, 0x0076=>0x0056, 0x00FE=>0x00DE, 0x0157=>0x0156,
392:     0x0146=>0x0145, 0x0070=>0x0050, 0x0151=>0x0150, 0x044E=>0x042E, 0x0129=>0x0128,371:             0x00FA=>0x00DA, 0x1E61=>0x1E60, 0x1E83=>0x1E82, 0x00E2=>0x00C2, 0x0119=>0x0118,
393:     0x03C7=>0x03A7, 0x013E=>0x013D, 0x0442=>0x0422, 0x007A=>0x005A, 0x0448=>0x0428,372:             0x0146=>0x0145, 0x0070=>0x0050, 0x0151=>0x0150, 0x044E=>0x042E, 0x0129=>0x0128,
394:     0x03C1=>0x03A1, 0x1E81=>0x1E80, 0x016D=>0x016C, 0x00F5=>0x00D5, 0x0075=>0x0055,373:             0x03C7=>0x03A7, 0x013E=>0x013D, 0x0442=>0x0422, 0x007A=>0x005A, 0x0448=>0x0428,
395:     0x0177=>0x0176, 0x00FC=>0x00DC, 0x1E57=>0x1E56, 0x03C3=>0x03A3, 0x043A=>0x041A,374:             0x03C1=>0x03A1, 0x1E81=>0x1E80, 0x016D=>0x016C, 0x00F5=>0x00D5, 0x0075=>0x0055,
396:     0x006D=>0x004D, 0x016B=>0x016A, 0x0171=>0x0170, 0x0444=>0x0424, 0x00EC=>0x00CC,375:             0x0177=>0x0176, 0x00FC=>0x00DC, 0x1E57=>0x1E56, 0x03C3=>0x03A3, 0x043A=>0x041A,
397:     0x0169=>0x0168, 0x03BF=>0x039F, 0x006B=>0x004B, 0x00F2=>0x00D2, 0x00E0=>0x00C0,376:             0x006D=>0x004D, 0x016B=>0x016A, 0x0171=>0x0170, 0x0444=>0x0424, 0x00EC=>0x00CC,
398:     0x0434=>0x0414, 0x03C9=>0x03A9, 0x1E6B=>0x1E6A, 0x00E3=>0x00C3, 0x044D=>0x042D,377:             0x0169=>0x0168, 0x03BF=>0x039F, 0x006B=>0x004B, 0x00F2=>0x00D2, 0x00E0=>0x00C0,
399:     0x0436=>0x0416, 0x01A1=>0x01A0, 0x010D=>0x010C, 0x011D=>0x011C, 0x00F0=>0x00D0,378:             0x0434=>0x0414, 0x03C9=>0x03A9, 0x1E6B=>0x1E6A, 0x00E3=>0x00C3, 0x044D=>0x042D,
400:     0x013C=>0x013B, 0x045F=>0x040F, 0x045A=>0x040A, 0x00E8=>0x00C8, 0x03C5=>0x03A5,379:             0x0436=>0x0416, 0x01A1=>0x01A0, 0x010D=>0x010C, 0x011D=>0x011C, 0x00F0=>0x00D0,
401:     0x0066=>0x0046, 0x00FD=>0x00DD, 0x0063=>0x0043, 0x021B=>0x021A, 0x00EA=>0x00CA,380:             0x013C=>0x013B, 0x045F=>0x040F, 0x045A=>0x040A, 0x00E8=>0x00C8, 0x03C5=>0x03A5,
402:     0x03B9=>0x0399, 0x017A=>0x0179, 0x00EF=>0x00CF, 0x01B0=>0x01AF, 0x0065=>0x0045,381:             0x0066=>0x0046, 0x00FD=>0x00DD, 0x0063=>0x0043, 0x021B=>0x021A, 0x00EA=>0x00CA,
403:     0x03BB=>0x039B, 0x03B8=>0x0398, 0x03BC=>0x039C, 0x045C=>0x040C, 0x043F=>0x041F,382:             0x03B9=>0x0399, 0x017A=>0x0179, 0x00EF=>0x00CF, 0x01B0=>0x01AF, 0x0065=>0x0045,
404:     0x044C=>0x042C, 0x00FE=>0x00DE, 0x00F0=>0x00D0, 0x1EF3=>0x1EF2, 0x0068=>0x0048,383:             0x03BB=>0x039B, 0x03B8=>0x0398, 0x03BC=>0x039C, 0x045C=>0x040C, 0x043F=>0x041F,
405:     0x00EB=>0x00CB, 0x0111=>0x0110, 0x0433=>0x0413, 0x012F=>0x012E, 0x00E6=>0x00C6,384:             0x044C=>0x042C, 0x00FE=>0x00DE, 0x00F0=>0x00D0, 0x1EF3=>0x1EF2, 0x0068=>0x0048,
406:     0x0078=>0x0058, 0x0161=>0x0160, 0x016F=>0x016E, 0x03B1=>0x0391, 0x0457=>0x0407,385:             0x00EB=>0x00CB, 0x0111=>0x0110, 0x0433=>0x0413, 0x012F=>0x012E, 0x00E6=>0x00C6,
407:     0x0173=>0x0172, 0x00FF=>0x0178, 0x006F=>0x004F, 0x043B=>0x041B, 0x03B5=>0x0395,386:             0x0078=>0x0058, 0x0161=>0x0160, 0x016F=>0x016E, 0x03B1=>0x0391, 0x0457=>0x0407,
408:     0x0445=>0x0425, 0x0121=>0x0120, 0x017E=>0x017D, 0x017C=>0x017B, 0x03B6=>0x0396,387:             0x0173=>0x0172, 0x00FF=>0x0178, 0x006F=>0x004F, 0x043B=>0x041B, 0x03B5=>0x0395,
409:     0x03B2=>0x0392, 0x03AD=>0x0388, 0x1E85=>0x1E84, 0x0175=>0x0174, 0x0071=>0x0051,388:             0x0445=>0x0425, 0x0121=>0x0120, 0x017E=>0x017D, 0x017C=>0x017B, 0x03B6=>0x0396,
410:     0x0437=>0x0417, 0x1E0B=>0x1E0A, 0x0148=>0x0147, 0x0105=>0x0104, 0x0458=>0x0408,389:             0x03B2=>0x0392, 0x03AD=>0x0388, 0x1E85=>0x1E84, 0x0175=>0x0174, 0x0071=>0x0051,
411:     0x014D=>0x014C, 0x00ED=>0x00CD, 0x0079=>0x0059, 0x010B=>0x010A, 0x03CE=>0x038F,390:             0x0437=>0x0417, 0x1E0B=>0x1E0A, 0x0148=>0x0147, 0x0105=>0x0104, 0x0458=>0x0408,
412:     0x0072=>0x0052, 0x0430=>0x0410, 0x0455=>0x0405, 0x0452=>0x0402, 0x0127=>0x0126,391:             0x014D=>0x014C, 0x00ED=>0x00CD, 0x0079=>0x0059, 0x010B=>0x010A, 0x03CE=>0x038F,
413:     0x0137=>0x0136, 0x012B=>0x012A, 0x03AF=>0x038A, 0x044B=>0x042B, 0x006C=>0x004C,392:             0x0072=>0x0052, 0x0430=>0x0410, 0x0455=>0x0405, 0x0452=>0x0402, 0x0127=>0x0126,
414:     0x03B7=>0x0397, 0x0125=>0x0124, 0x0219=>0x0218, 0x00FB=>0x00DB, 0x011F=>0x011E,393:             0x0137=>0x0136, 0x012B=>0x012A, 0x03AF=>0x038A, 0x044B=>0x042B, 0x006C=>0x004C,
415:     0x043E=>0x041E, 0x1E41=>0x1E40, 0x03BD=>0x039D, 0x0107=>0x0106, 0x03CB=>0x03AB,394:             0x03B7=>0x0397, 0x0125=>0x0124, 0x0219=>0x0218, 0x00FB=>0x00DB, 0x011F=>0x011E,
416:     0x0446=>0x0426, 0x00FE=>0x00DE, 0x00E7=>0x00C7, 0x03CA=>0x03AA, 0x0441=>0x0421,395:             0x043E=>0x041E, 0x1E41=>0x1E40, 0x03BD=>0x039D, 0x0107=>0x0106, 0x03CB=>0x03AB,
417:     0x0432=>0x0412, 0x010F=>0x010E, 0x00F8=>0x00D8, 0x0077=>0x0057, 0x011B=>0x011A,396:             0x0446=>0x0426, 0x00FE=>0x00DE, 0x00E7=>0x00C7, 0x03CA=>0x03AA, 0x0441=>0x0421,
418:     0x0074=>0x0054, 0x006A=>0x004A, 0x045B=>0x040B, 0x0456=>0x0406, 0x0103=>0x0102,397:             0x0432=>0x0412, 0x010F=>0x010E, 0x00F8=>0x00D8, 0x0077=>0x0057, 0x011B=>0x011A,
419:     0x03BB=>0x039B, 0x00F1=>0x00D1, 0x043D=>0x041D, 0x03CC=>0x038C, 0x00E9=>0x00C9,398:             0x0074=>0x0054, 0x006A=>0x004A, 0x045B=>0x040B, 0x0456=>0x0406, 0x0103=>0x0102,
420:     0x00F0=>0x00D0, 0x0457=>0x0407, 0x0123=>0x0122,399:             0x03BB=>0x039B, 0x00F1=>0x00D1, 0x043D=>0x041D, 0x03CC=>0x038C, 0x00E9=>0x00C9,
421:             );400:             0x00F0=>0x00D0, 0x0457=>0x0407, 0x0123=>0x0122);
422:     }401:     }
423:     402: 
424:     $uni = utf8_to_unicode($string);403:     $uni = utf8_to_unicode($string);
425:     404: 
426:     if ( !$uni ) {405:     if (!$uni)
427:         return FALSE;406:         return false;
428:     }407: 
429:     408:     $cnt = count($uni);
430:     $cnt = count($uni);409: 
431:     for ($i=0; $i < $cnt; $i++){410:     for ($i=0; $i < $cnt; $i++)
432:         if( isset($UTF8_LOWER_TO_UPPER[$uni[$i]]) ) {411:         if(isset($UTF8_LOWER_TO_UPPER[$uni[$i]]))
433:             $uni[$i] = $UTF8_LOWER_TO_UPPER[$uni[$i]];412:             $uni[$i] = $UTF8_LOWER_TO_UPPER[$uni[$i]];
434:         }413: 
435:     }414:     return utf8_from_unicode($uni);
436:      
437:     return utf8_from_unicode($uni); 
438: }415: }


a/upload/include/utf8/ord.php b/upload/include/utf8/ord.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: ord.php,v 1.4 2006/09/11 15:22:54 harryf Exp $  4: * @version $Id: ord.php,v 1.4 2006/09/11 15:22:54 harryf Exp $
  4: * @package utf8  5: * @package utf8
  5: * @subpackage strings  6: * @subpackage strings
  6: */  7: */
  7:   8: 
  8: //--------------------------------------------------------------- 
  9: /**  9: /**
 10: * UTF-8 aware alternative to ord 10: * UTF-8 aware alternative to ord
 11: * Returns the unicode ordinal for a character 11: * Returns the unicode ordinal for a character
 14: * @see http://www.php.net/ord 14: * @see http://www.php.net/ord
 15: * @see http://www.php.net/manual/en/function.ord.php#46267 15: * @see http://www.php.net/manual/en/function.ord.php#46267
 16: */ 16: */
 17: function utf8_ord($chr) { 17: function utf8_ord($chr)
 18:      18: {
 19:     $ord0 = ord($chr); 19:     $ord0 = ord($chr);
 20:      20: 
 21:     if ( $ord0 >= 0 && $ord0 <= 127 ) { 21:     if ($ord0 >= 0 && $ord0 <= 127)
 22:         return $ord0; 22:         return $ord0;
 23:     } 23: 
 24:      24:     if (!isset($chr[1]))
 25:     if ( !isset($chr{1}) ) { 25:     {
 26:         trigger_error('Short sequence - at least 2 bytes expected, only 1 seen'); 26:         trigger_error('Short sequence - at least 2 bytes expected, only 1 seen');
 27:         return FALSE; 27:         return false;
 28:     } 28:     }
 29:      29: 
 30:     $ord1 = ord($chr{1}); 30:     $ord1 = ord($chr[1]);
 31:     if ( $ord0 >= 192 && $ord0 <= 223 ) { 31:     if ($ord0 >= 192 && $ord0 <= 223)
 32:         return ( $ord0 - 192 ) * 64  32:         return ($ord0 - 192) * 64 + ($ord1 - 128);
 33:             + ( $ord1 - 128 ); 33: 
 34:     } 34:     if (!isset($chr[2]))
 35:      35:     {
 36:     if ( !isset($chr{2}) ) { 36:         trigger_error('Short sequence - at least 3 bytes expected, only 2 seen');
 37:         trigger_error('Short sequence - at least 3 bytes expected, only 2 seen'); 37:         return false;
 38:         return FALSE; 38:     }
 39:     } 39: 
 40:     $ord2 = ord($chr{2}); 40:     $ord2 = ord($chr[2]);
 41:     if ( $ord0 >= 224 && $ord0 <= 239 ) { 41:     if ($ord0 >= 224 && $ord0 <= 239)
 42:         return ($ord0-224)*4096  42:         return ($ord0-224)*4096 + ($ord1-128)*64 + ($ord2-128);
 43:             + ($ord1-128)*64  
 44:                 + ($ord2-128); 
 45:     } 
 46:      
 47:     if ( !isset($chr{3}) ) { 
 48:         trigger_error('Short sequence - at least 4 bytes expected, only 3 seen'); 
 49:         return FALSE; 
 50:     } 
 51:     $ord3 = ord($chr{3}); 
 52:     if ($ord0>=240 && $ord0<=247) { 
 53:         return ($ord0-240)*262144  
 54:             + ($ord1-128)*4096  
 55:                 + ($ord2-128)*64  
 56:                     + ($ord3-128); 
 57:      
 58:     } 
 59:      
 60:     if ( !isset($chr{4}) ) { 
 61:         trigger_error('Short sequence - at least 5 bytes expected, only 4 seen'); 
 62:         return FALSE; 
 63:     } 
 64:     $ord4 = ord($chr{4}); 
 65:     if ($ord0>=248 && $ord0<=251) { 
 66:         return ($ord0-248)*16777216  
 67:             + ($ord1-128)*262144  
 68:                 + ($ord2-128)*4096  
 69:                     + ($ord3-128)*64  
 70:                         + ($ord4-128); 
 71:     } 
 72:      
 73:     if ( !isset($chr{5}) ) { 
 74:         trigger_error('Short sequence - at least 6 bytes expected, only 5 seen'); 
 75:         return FALSE; 
 76:     } 
 77:     if ($ord0>=252 && $ord0<=253) { 
 78:         return ($ord0-252) * 1073741824  
 79:             + ($ord1-128)*16777216  
 80:                 + ($ord2-128)*262144  
 81:                     + ($ord3-128)*4096  
 82:                         + ($ord4-128)*64  
 83:                             + (ord($c{5})-128); 
 84:     } 
 85:      
 86:     if ( $ord0 >= 254 && $ord0 <= 255 ) {  
 87:         trigger_error('Invalid UTF-8 with surrogate ordinal '.$ord0); 
 88:         return FALSE; 
 89:     } 
 90:      
 91: } 
 92:  43: 
  44:     if (!isset($chr[3]))
  45:     {
  46:         trigger_error('Short sequence - at least 4 bytes expected, only 3 seen');
  47:         return false;
  48:     }
  49: 
  50:     $ord3 = ord($chr[3]);
  51:     if ($ord0>=240 && $ord0<=247)
  52:         return ($ord0-240)*262144 + ($ord1-128)*4096 + ($ord2-128)*64 + ($ord3-128);
  53: 
  54:     if (!isset($chr[4]))
  55:     {
  56:         trigger_error('Short sequence - at least 5 bytes expected, only 4 seen');
  57:         return false;
  58:     }
  59: 
  60:     $ord4 = ord($chr[4]);
  61:     if ($ord0 >= 248 && $ord0 <= 251)
  62:         return ($ord0-248)*16777216 + ($ord1-128)*262144 + ($ord2-128)*4096 + ($ord3-128)*64 + ($ord4-128);
  63: 
  64:     if (!isset($chr[5]))
  65:     {
  66:         trigger_error('Short sequence - at least 6 bytes expected, only 5 seen');
  67:         return false;
  68:     }
  69: 
  70:     if ($ord0 >= 252 && $ord0 <= 253)
  71:         return ($ord0-252) * 1073741824 + ($ord1-128)*16777216 + ($ord2-128)*262144 + ($ord3-128)*4096  + ($ord4-128)*64 + (ord($c{5})-128);
  72: 
  73:     if ($ord0 >= 254 && $ord0 <= 255)
  74:     {
  75:         trigger_error('Invalid UTF-8 with surrogate ordinal '.$ord0);
  76:         return false;
  77:     }
  78: }


a/upload/include/utf8/str_ireplace.php b/upload/include/utf8/str_ireplace.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: str_ireplace.php,v 1.2 2007/08/12 01:20:46 harryf Exp $  4: * @version $Id: str_ireplace.php,v 1.2 2007/08/12 01:20:46 harryf Exp $
  4: * @package utf8  5: * @package utf8
  5: * @subpackage strings  6: * @subpackage strings
  6: */  7: */
  7:   8: 
  8: //--------------------------------------------------------------- 
  9: /**  9: /**
 10: * UTF-8 aware alternative to str_ireplace 10: * UTF-8 aware alternative to str_ireplace
 11: * Case-insensitive version of str_replace 11: * Case-insensitive version of str_replace
 21: * @package utf8 21: * @package utf8
 22: * @subpackage strings 22: * @subpackage strings
 23: */ 23: */
 24: function utf8_ireplace($search, $replace, $str, $count = NULL){ 24: function utf8_ireplace($search, $replace, $str, $count=null)
 25:      25: {
 26:     if ( !is_array($search) ) { 26:     if (!is_array($search))
 27:          27:     {
 28:         $slen = strlen($search); 28:         $slen = strlen($search);
 29:         if ( $slen == 0 ) { 
 30:             return $str; 
 31:         } 
 32:          
 33:         $lendif = strlen($replace) - strlen($search); 
 34:         $search = utf8_strtolower($search); 
 35:          
 36:         $search = preg_quote($search); 
 37:         $lstr = utf8_strtolower($str); 
 38:         $i = 0; 
 39:         $matched = 0; 
 40:         while ( preg_match('/(.*)'.$search.'/Us',$lstr, $matches) ) { 
 41:             if ( $i === $count ) { 
 42:                 break; 
 43:             } 
 44:             $mlen = strlen($matches[0]); 
 45:             $lstr = substr($lstr, $mlen); 
 46:             $str = substr_replace($str, $replace, $matched+strlen($matches[1]), $slen); 
 47:             $matched += $mlen + $lendif; 
 48:             $i++; 
 49:         } 
 50:         return $str; 
 51:          
 52:     } else { 
 53:          
 54:         foreach ( array_keys($search) as $k ) { 
 55:              
 56:             if ( is_array($replace) ) { 
 57:                  
 58:                 if ( array_key_exists($k,$replace) ) { 
 59:                      
 60:                     $str = utf8_ireplace($search[$k], $replace[$k], $str, $count); 
 61:                      
 62:                 } else { 
 63:                  
 64:                     $str = utf8_ireplace($search[$k], '', $str, $count); 
 65:                      
 66:                 } 
 67:                  
 68:             } else { 
 69:              
 70:                 $str = utf8_ireplace($search[$k], $replace, $str, $count); 
 71:                  
 72:             } 
 73:         } 
 74:         return $str; 
 75:          
 76:     } 
 77:  29: 
 78: } 30:         if ($slen == 0)
  31:             return $str;
  32: 
  33:         $lendif = strlen($replace) - strlen($search);
  34:         $search = utf8_strtolower($search);
  35: 
  36:         $search = preg_quote($search);
  37:         $lstr = utf8_strtolower($str);
  38:         $i = 0;
  39:         $matched = 0;
 79:  40: 
  41:         while (preg_match('/(.*)'.$search.'/Us', $lstr, $matches))
  42:         {
  43:             if ($i === $count)
  44:                 break;
 80:  45: 
  46:             $mlen = strlen($matches[0]);
  47:             $lstr = substr($lstr, $mlen);
  48:             $str = substr_replace($str, $replace, $matched+strlen($matches[1]), $slen);
  49:             $matched += $mlen + $lendif;
  50:             $i++;
  51:         }
  52: 
  53:         return $str;
  54:     }
  55:     else
  56:     {
  57:         foreach (array_keys($search) as $k)
  58:         {
  59:             if (is_array($replace))
  60:             {
  61:                 if (array_key_exists($k, $replace))
  62:                     $str = utf8_ireplace($search[$k], $replace[$k], $str, $count);
  63:                 else
  64:                     $str = utf8_ireplace($search[$k], '', $str, $count);
  65:             }
  66:             else
  67:                 $str = utf8_ireplace($search[$k], $replace, $str, $count);
  68:         }
  69: 
  70:         return $str;
  71:     }
  72: }


a/upload/include/utf8/str_pad.php b/upload/include/utf8/str_pad.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: str_pad.php,v 1.1 2006/09/03 09:25:13 harryf Exp $  4: * @version $Id: str_pad.php,v 1.1 2006/09/03 09:25:13 harryf Exp $
  4: * @package utf8  5: * @package utf8
  5: * @subpackage strings  6: * @subpackage strings
  6: */  7: */
  7:   8: 
  8: //--------------------------------------------------------------- 
  9: /**  9: /**
 10: * Replacement for str_pad. $padStr may contain multi-byte characters. 10: * Replacement for str_pad. $padStr may contain multi-byte characters.
 11: * 11: *
 20: * @package utf8 20: * @package utf8
 21: * @subpackage strings 21: * @subpackage strings
 22: */ 22: */
 23: function utf8_str_pad($input, $length, $padStr = ' ', $type = STR_PAD_RIGHT) { 23: function utf8_str_pad($input, $length, $padStr=' ', $type=STR_PAD_RIGHT)
 24:      24: {
 25:     $inputLen = utf8_strlen($input); 25:     $inputLen = utf8_strlen($input);
 26:     if ($length <= $inputLen) { 26:     if ($length <= $inputLen)
 27:         return $input; 27:         return $input;
 28:     } 28: 
 29:      29:     $padStrLen = utf8_strlen($padStr);
 30:     $padStrLen = utf8_strlen($padStr); 30:     $padLen = $length - $inputLen;
 31:     $padLen = $length - $inputLen; 31: 
 32:      32:     if ($type == STR_PAD_RIGHT)
 33:     if ($type == STR_PAD_RIGHT) { 33:     {
 34:         $repeatTimes = ceil($padLen / $padStrLen); 34:         $repeatTimes = ceil($padLen / $padStrLen);
 35:         return utf8_substr($input . str_repeat($padStr, $repeatTimes), 0, $length); 35:         return utf8_substr($input.str_repeat($padStr, $repeatTimes), 0, $length);
 36:     } 36:     }
 37:      37: 
 38:     if ($type == STR_PAD_LEFT) { 38:     if ($type == STR_PAD_LEFT)
 39:         $repeatTimes = ceil($padLen / $padStrLen); 39:     {
 40:         return utf8_substr(str_repeat($padStr, $repeatTimes), 0, floor($padLen)) . $input; 40:         $repeatTimes = ceil($padLen / $padStrLen);
 41:     } 41:         return utf8_substr(str_repeat($padStr, $repeatTimes), 0, floor($padLen)).$input;
 42:      42:     }
 43:     if ($type == STR_PAD_BOTH) { 43: 
 44:          44:     if ($type == STR_PAD_BOTH)
 45:         $padLen/= 2; 45:     {
 46:         $padAmountLeft = floor($padLen); 46:         $padLen /= 2;
 47:         $padAmountRight = ceil($padLen); 47:         $padAmountLeft = floor($padLen);
 48:         $repeatTimesLeft = ceil($padAmountLeft / $padStrLen); 48:         $padAmountRight = ceil($padLen);
 49:         $repeatTimesRight = ceil($padAmountRight / $padStrLen); 49:         $repeatTimesLeft = ceil($padAmountLeft / $padStrLen);
 50:          50:         $repeatTimesRight = ceil($padAmountRight / $padStrLen);
 51:         $paddingLeft = utf8_substr(str_repeat($padStr, $repeatTimesLeft), 0, $padAmountLeft); 51: 
 52:         $paddingRight = utf8_substr(str_repeat($padStr, $repeatTimesRight), 0, $padAmountLeft); 52:         $paddingLeft = utf8_substr(str_repeat($padStr, $repeatTimesLeft), 0, $padAmountLeft);
 53:         return $paddingLeft . $input . $paddingRight; 53:         $paddingRight = utf8_substr(str_repeat($padStr, $repeatTimesRight), 0, $padAmountLeft);
 54:     } 54: 
 55:      55:         return $paddingLeft.$input.$paddingRight;
 56:     trigger_error('utf8_str_pad: Unknown padding type (' . $type . ')',E_USER_ERROR); 56:     }
  57: 
  58:     trigger_error('utf8_str_pad: Unknown padding type ('.$type.')', E_USER_ERROR);
 57: } 59: }


a/upload/include/utf8/str_split.php b/upload/include/utf8/str_split.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: str_split.php,v 1.1 2006/02/25 13:50:17 harryf Exp $  4: * @version $Id: str_split.php,v 1.1 2006/02/25 13:50:17 harryf Exp $
  4: * @package utf8  5: * @package utf8
  5: * @subpackage strings  6: * @subpackage strings
  6: */  7: */
  7:   8: 
  8: //--------------------------------------------------------------- 
  9: /**  9: /**
 10: * UTF-8 aware alternative to str_split 10: * UTF-8 aware alternative to str_split
 11: * Convert a string to an array 11: * Convert a string to an array
 18: * @package utf8 18: * @package utf8
 19: * @subpackage strings 19: * @subpackage strings
 20: */ 20: */
 21: function utf8_str_split($str, $split_len = 1) { 21: function utf8_str_split($str, $split_len=1)
 22:      22: {
 23:     if ( !preg_match('/^[0-9]+$/',$split_len) || $split_len < 1 ) { 23:     if (!preg_match('/^[0-9]+$/',$split_len) || $split_len < 1)
 24:         return FALSE; 24:         return false;
 25:     } 25: 
 26:      26:     $len = utf8_strlen($str);
 27:     $len = utf8_strlen($str); 27:     if ($len <= $split_len)
 28:     if ( $len <= $split_len ) { 28:         return array($str);
 29:         return array($str); 29: 
 30:     } 30:     preg_match_all('/.{'.$split_len.'}|[^\x00]{1,'.$split_len.'}$/us', $str, $ar);
 31:      31: 
 32:     preg_match_all('/.{'.$split_len.'}|[^\x00]{1,'.$split_len.'}$/us', $str, $ar); 32:     return $ar[0];
 33:     return $ar[0]; 
 34:      
 35: } 33: }


a/upload/include/utf8/strcasecmp.php b/upload/include/utf8/strcasecmp.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: strcasecmp.php,v 1.1 2006/02/25 13:50:17 harryf Exp $  4: * @version $Id: strcasecmp.php,v 1.1 2006/02/25 13:50:17 harryf Exp $
  4: * @package utf8  5: * @package utf8
  5: * @subpackage strings  6: * @subpackage strings
  6: */  7: */
  7:   8: 
  8: //--------------------------------------------------------------- 
  9: /**  9: /**
 10: * UTF-8 aware alternative to strcasecmp 10: * UTF-8 aware alternative to strcasecmp
 11: * A case insensivite string comparison 11: * A case insensivite string comparison
 18: * @package utf8 18: * @package utf8
 19: * @subpackage strings 19: * @subpackage strings
 20: */ 20: */
 21: function utf8_strcasecmp($strX, $strY) { 21: function utf8_strcasecmp($strX, $strY)
 22:     $strX = utf8_strtolower($strX); 22: {
 23:     $strY = utf8_strtolower($strY); 23:     $strX = utf8_strtolower($strX);
 24:     return strcmp($strX, $strY); 24:     $strY = utf8_strtolower($strY);
  25: 
  26:     return strcmp($strX, $strY);
 25: } 27: }
 26:  28: 


a/upload/include/utf8/strcspn.php b/upload/include/utf8/strcspn.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: strcspn.php,v 1.1 2006/02/25 13:50:17 harryf Exp $  4: * @version $Id: strcspn.php,v 1.1 2006/02/25 13:50:17 harryf Exp $
  4: * @package utf8  5: * @package utf8
  5: * @subpackage strings  6: * @subpackage strings
  6: */  7: */
  7:   8: 
  8: //--------------------------------------------------------------- 
  9: /**  9: /**
 10: * UTF-8 aware alternative to strcspn 10: * UTF-8 aware alternative to strcspn
 11: * Find length of initial segment not matching mask 11: * Find length of initial segment not matching mask
 17: * @package utf8 17: * @package utf8
 18: * @subpackage strings 18: * @subpackage strings
 19: */ 19: */
 20: function utf8_strcspn($str, $mask, $start = NULL, $length = NULL) { 20: function utf8_strcspn($str, $mask, $start=null, $length=null)
 21:      21: {
 22:     if ( empty($mask) || strlen($mask) == 0 ) { 22:     if (empty($mask) || strlen($mask) == 0)
 23:         return NULL; 23:         return null;
 24:     } 24: 
 25:      25:     $mask = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}', $mask);
 26:     $mask = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$mask); 26: 
 27:      27:     if ($start !== null || $length !== null)
 28:     if ( $start !== NULL || $length !== NULL ) { 28:         $str = utf8_substr($str, $start, $length);
 29:         $str = utf8_substr($str, $start, $length); 
 30:     } 
 31:          
 32:     preg_match('/^[^'.$mask.']+/u',$str, $matches); 
 33:      
 34:     if ( isset($matches[0]) ) { 
 35:         return utf8_strlen($matches[0]); 
 36:     } 
 37:      
 38:     return 0; 
 39:      
 40: } 
 41:  29: 
  30:     preg_match('/^[^'.$mask.']+/u', $str, $matches);
  31: 
  32:     if (isset($matches[0]))
  33:         return utf8_strlen($matches[0]);
  34: 
  35:     return 0;
  36: }


a/upload/include/utf8/stristr.php b/upload/include/utf8/stristr.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: stristr.php,v 1.1 2006/02/25 13:50:17 harryf Exp $  4: * @version $Id: stristr.php,v 1.1 2006/02/25 13:50:17 harryf Exp $
  4: * @package utf8  5: * @package utf8
  5: * @subpackage strings  6: * @subpackage strings
  6: */  7: */
  7:   8: 
  8: //--------------------------------------------------------------- 
  9: /**  9: /**
 10: * UTF-8 aware alternative to stristr 10: * UTF-8 aware alternative to stristr
 11: * Find first occurrence of a string using case insensitive comparison 11: * Find first occurrence of a string using case insensitive comparison
 18: * @package utf8 18: * @package utf8
 19: * @subpackage strings 19: * @subpackage strings
 20: */ 20: */
 21: function utf8_stristr($str, $search) { 21: function utf8_stristr($str, $search)
 22:      22: {
 23:     if ( strlen($search) == 0 ) { 23:     if (strlen($search) == 0)
 24:         return $str; 24:         return $str;
 25:     } 25: 
 26:      26:     $lstr = utf8_strtolower($str);
 27:     $lstr = utf8_strtolower($str); 27:     $lsearch = utf8_strtolower($search);
 28:     $lsearch = utf8_strtolower($search); 28:     preg_match('/^(.*)'.preg_quote($lsearch).'/Us', $lstr, $matches);
 29:     preg_match('/^(.*)'.preg_quote($lsearch).'/Us',$lstr, $matches); 29: 
 30:      30:     if (count($matches) == 2)
 31:     if ( count($matches) == 2 ) { 31:         return substr($str, strlen($matches[1]));
 32:         return substr($str, strlen($matches[1])); 32: 
 33:     } 33:     return false;
 34:      
 35:     return FALSE; 
 36: } 34: }


a/upload/include/utf8/strrev.php b/upload/include/utf8/strrev.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: strrev.php,v 1.1 2006/02/25 13:50:17 harryf Exp $  4: * @version $Id: strrev.php,v 1.1 2006/02/25 13:50:17 harryf Exp $
  4: * @package utf8  5: * @package utf8
  5: * @subpackage strings  6: * @subpackage strings
  6: */  7: */
  7:   8: 
  8: //--------------------------------------------------------------- 
  9: /**  9: /**
 10: * UTF-8 aware alternative to strrev 10: * UTF-8 aware alternative to strrev
 11: * Reverse a string 11: * Reverse a string
 15: * @package utf8 15: * @package utf8
 16: * @subpackage strings 16: * @subpackage strings
 17: */ 17: */
 18: function utf8_strrev($str){ 18: function utf8_strrev($str)
 19:     preg_match_all('/./us', $str, $ar); 19: {
 20:     return join('',array_reverse($ar[0])); 20:     preg_match_all('/./us', $str, $ar);
  21:     return implode(array_reverse($ar[0]));
 21: } 22: }
 22:  23: 


a/upload/include/utf8/strspn.php b/upload/include/utf8/strspn.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: strspn.php,v 1.1 2006/02/25 13:50:17 harryf Exp $  4: * @version $Id: strspn.php,v 1.1 2006/02/25 13:50:17 harryf Exp $
  4: * @package utf8  5: * @package utf8
  5: * @subpackage strings  6: * @subpackage strings
  6: */  7: */
  7:   8: 
  8: //--------------------------------------------------------------- 
  9: /**  9: /**
 10: * UTF-8 aware alternative to strspn 10: * UTF-8 aware alternative to strspn
 11: * Find length of initial segment matching mask 11: * Find length of initial segment matching mask
 16: * @package utf8 16: * @package utf8
 17: * @subpackage strings 17: * @subpackage strings
 18: */ 18: */
 19: function utf8_strspn($str, $mask, $start = NULL, $length = NULL) { 19: function utf8_strspn($str, $mask, $start=null, $length=null)
 20:      20: {
 21:     $mask = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$mask); 21:     $mask = preg_replace('!([\\\\\\-\\]\\[/^])!', '\\\${1}', $mask);
 22:      
 23:     if ( $start !== NULL || $length !== NULL ) { 
 24:         $str = utf8_substr($str, $start, $length); 
 25:     } 
 26:          
 27:     preg_match('/^['.$mask.']+/u',$str, $matches); 
 28:      
 29:     if ( isset($matches[0]) ) { 
 30:         return utf8_strlen($matches[0]); 
 31:     } 
 32:      
 33:     return 0; 
 34:  22: 
 35: } 23:     if ($start !== null || $length !== null)
  24:         $str = utf8_substr($str, $start, $length);
  25: 
  26:     preg_match('/^['.$mask.']+/u', $str, $matches);
 36:  27: 
  28:     if (isset($matches[0]))
  29:         return utf8_strlen($matches[0]);
  30: 
  31:     return 0;
  32: }


a/upload/include/utf8/substr_replace.php b/upload/include/utf8/substr_replace.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: substr_replace.php,v 1.1 2006/02/25 13:50:17 harryf Exp $  4: * @version $Id: substr_replace.php,v 1.1 2006/02/25 13:50:17 harryf Exp $
  4: * @package utf8  5: * @package utf8
  5: * @subpackage strings  6: * @subpackage strings
  6: */  7: */
  7:   8: 
  8: //--------------------------------------------------------------- 
  9: /**  9: /**
 10: * UTF-8 aware substr_replace. 10: * UTF-8 aware substr_replace.
 11: * Note: requires utf8_substr to be loaded 11: * Note: requires utf8_substr to be loaded
 13: * @see utf8_strlen 13: * @see utf8_strlen
 14: * @see utf8_substr 14: * @see utf8_substr
 15: */ 15: */
 16: function utf8_substr_replace($str, $repl, $start , $length = NULL ) { 16: function utf8_substr_replace($str, $repl, $start , $length=null)
 17:     preg_match_all('/./us', $str, $ar); 17: {
 18:     preg_match_all('/./us', $repl, $rar); 18:     preg_match_all('/./us', $str, $ar);
 19:     if( $length === NULL ) { 19:     preg_match_all('/./us', $repl, $rar);
 20:         $length = utf8_strlen($str); 20: 
 21:     } 21:     if($length === null)
 22:     array_splice( $ar[0], $start, $length, $rar[0] ); 22:         $length = utf8_strlen($str);
 23:     return join('',$ar[0]); 23: 
  24:     array_splice($ar[0], $start, $length, $rar[0]);
  25: 
  26:     return implode($ar[0]);
 24: } 27: }


a/upload/include/utf8/trim.php b/upload/include/utf8/trim.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: trim.php,v 1.1 2006/02/25 13:50:17 harryf Exp $  4: * @version $Id: trim.php,v 1.1 2006/02/25 13:50:17 harryf Exp $
  4: * @package utf8  5: * @package utf8
  5: * @subpackage strings  6: * @subpackage strings
  6: */  7: */
  7:   8: 
  8: //--------------------------------------------------------------- 
  9: /**  9: /**
 10: * UTF-8 aware replacement for ltrim() 10: * UTF-8 aware replacement for ltrim()
 11: * Note: you only need to use this if you are supplying the charlist 11: * Note: you only need to use this if you are supplying the charlist
 18: * @package utf8 18: * @package utf8
 19: * @subpackage strings 19: * @subpackage strings
 20: */ 20: */
 21: function utf8_ltrim( $str, $charlist = FALSE ) { 21: function utf8_ltrim( $str, $charlist=false)
 22:     if($charlist === FALSE) return ltrim($str); 22: {
 23:      23:     if($charlist === false)
 24:     //quote charlist for use in a characterclass 24:         return ltrim($str);
 25:     $charlist = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$charlist); 25: 
 26:      26:     // Quote charlist for use in a characterclass
 27:     return preg_replace('/^['.$charlist.']+/u','',$str); 27:     $charlist = preg_replace('!([\\\\\\-\\]\\[/^])!', '\\\${1}', $charlist);
  28: 
  29:     return preg_replace('/^['.$charlist.']+/u', '', $str);
 28: } 30: }
 29:  31: 
 30: //--------------------------------------------------------------- 
 31: /** 32: /**
 32: * UTF-8 aware replacement for rtrim() 33: * UTF-8 aware replacement for rtrim()
 33: * Note: you only need to use this if you are supplying the charlist 34: * Note: you only need to use this if you are supplying the charlist
 40: * @package utf8 41: * @package utf8
 41: * @subpackage strings 42: * @subpackage strings
 42: */ 43: */
 43: function utf8_rtrim( $str, $charlist = FALSE ) { 44: function utf8_rtrim($str, $charlist=false)
 44:     if($charlist === FALSE) return rtrim($str); 45: {
 45:      46:     if($charlist === false)
 46:     //quote charlist for use in a characterclass 47:         return rtrim($str);
 47:     $charlist = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$charlist); 48: 
 48:    49:     // Quote charlist for use in a characterclass
 49:     return preg_replace('/['.$charlist.']+$/u','',$str); 50:     $charlist = preg_replace('!([\\\\\\-\\]\\[/^])!', '\\\${1}', $charlist);
  51: 
  52:     return preg_replace('/['.$charlist.']+$/u', '', $str);
 50: } 53: }
 51:  54: 
 52: //--------------------------------------------------------------- 
 53: /** 55: /**
 54: * UTF-8 aware replacement for trim() 56: * UTF-8 aware replacement for trim()
 55: * Note: you only need to use this if you are supplying the charlist 57: * Note: you only need to use this if you are supplying the charlist
 62: * @package utf8 64: * @package utf8
 63: * @subpackage strings 65: * @subpackage strings
 64: */ 66: */
 65: function utf8_trim( $str, $charlist = FALSE ) { 
 66:     if($charlist === FALSE) return trim($str); 
 67:     return utf8_ltrim(utf8_rtrim($str, $charlist), $charlist); 
 68: } 
 69:  67: 
  68: function utf8_trim( $str, $charlist=false)
  69: {
  70:     if($charlist === false)
  71:         return trim($str);
  72: 
  73:     return utf8_ltrim(utf8_rtrim($str, $charlist), $charlist);
  74: }


a/upload/include/utf8/ucfirst.php b/upload/include/utf8/ucfirst.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: ucfirst.php,v 1.1 2006/02/25 13:50:17 harryf Exp $  4: * @version $Id: ucfirst.php,v 1.1 2006/02/25 13:50:17 harryf Exp $
  4: * @package utf8  5: * @package utf8
  5: * @subpackage strings  6: * @subpackage strings
  6: */  7: */
  7:   8: 
  8: //--------------------------------------------------------------- 
  9: /**  9: /**
 10: * UTF-8 aware alternative to ucfirst 10: * UTF-8 aware alternative to ucfirst
 11: * Make a string's first character uppercase 11: * Make a string's first character uppercase
 17: * @package utf8 17: * @package utf8
 18: * @subpackage strings 18: * @subpackage strings
 19: */ 19: */
 20: function utf8_ucfirst($str){ 20: function utf8_ucfirst($str)
 21:     switch ( utf8_strlen($str) ) { 21: {
 22:         case 0: 22:     switch (utf8_strlen($str))
 23:             return ''; 23:     {
 24:         break; 24:         case 0:
 25:         case 1: 25:             return '';
 26:             return utf8_strtoupper($str); 26:             break;
 27:         break; 27:         case 1:
 28:         default: 28:             return utf8_strtoupper($str);
 29:             preg_match('/^(.{1})(.*)$/us', $str, $matches); 29:             break;
 30:             return utf8_strtoupper($matches[1]).$matches[2]; 30:         default:
 31:         break; 31:             preg_match('/^(.{1})(.*)$/us', $str, $matches);
 32:     } 32:             return utf8_strtoupper($matches[1]).$matches[2];
  33:             break;
  34:     }
 33: } 35: }


a/upload/include/utf8/ucwords.php b/upload/include/utf8/ucwords.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: ucwords.php,v 1.1 2006/02/25 13:50:17 harryf Exp $  4: * @version $Id: ucwords.php,v 1.1 2006/02/25 13:50:17 harryf Exp $
  4: * @package utf8  5: * @package utf8
  5: * @subpackage strings  6: * @subpackage strings
  6: */  7: */
  7:   8: 
  8: //--------------------------------------------------------------- 
  9: /**  9: /**
 10: * UTF-8 aware alternative to ucwords 10: * UTF-8 aware alternative to ucwords
 11: * Uppercase the first character of each word in a string 11: * Uppercase the first character of each word in a string
 16: * @package utf8 16: * @package utf8
 17: * @subpackage strings 17: * @subpackage strings
 18: */ 18: */
 19: function utf8_ucwords($str) { 19: function utf8_ucwords($str)
 20:     // Note: [\x0c\x09\x0b\x0a\x0d\x20] matches; 20: {
 21:     // form feeds, horizontal tabs, vertical tabs, linefeeds and carriage returns 21:     // Note: [\x0c\x09\x0b\x0a\x0d\x20] matches;
 22:     // This corresponds to the definition of a "word" defined at http://www.php.net/ucwords 22:     // Form feeds, horizontal tabs, vertical tabs, linefeeds and carriage returns
 23:     $pattern = '/(^|([\x0c\x09\x0b\x0a\x0d\x20]+))([^\x0c\x09\x0b\x0a\x0d\x20]{1})[^\x0c\x09\x0b\x0a\x0d\x20]*/u'; 23:     // This corresponds to the definition of a "word" defined at http://www.php.net/ucwords
 24:     return preg_replace_callback($pattern, 'utf8_ucwords_callback',$str); 24:     $pattern = '/(^|([\x0c\x09\x0b\x0a\x0d\x20]+))([^\x0c\x09\x0b\x0a\x0d\x20]{1})[^\x0c\x09\x0b\x0a\x0d\x20]*/u';
  25: 
  26:     return preg_replace_callback($pattern, 'utf8_ucwords_callback', $str);
 25: } 27: }
 26:  28: 
 27: //--------------------------------------------------------------- 
 28: /** 29: /**
 29: * Callback function for preg_replace_callback call in utf8_ucwords 30: * Callback function for preg_replace_callback call in utf8_ucwords
 30: * You don't need to call this yourself 31: * You don't need to call this yourself
 35: * @package utf8 36: * @package utf8
 36: * @subpackage strings 37: * @subpackage strings
 37: */ 38: */
 38: function utf8_ucwords_callback($matches) { 39: function utf8_ucwords_callback($matches)
 39:     $leadingws = $matches[2]; 40: {
 40:     $ucfirst = utf8_strtoupper($matches[3]); 41:     $leadingws = $matches[2];
 41:     $ucword = utf8_substr_replace(ltrim($matches[0]),$ucfirst,0,1); 42:     $ucfirst = utf8_strtoupper($matches[3]);
 42:     return $leadingws . $ucword; 43:     $ucword = utf8_substr_replace(ltrim($matches[0]), $ucfirst, 0, 1);
 43: } 
 44:  44: 
  45:     return $leadingws.$ucword;
  46: }


a/upload/include/utf8/utils/ascii.php b/upload/include/utf8/utils/ascii.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * Tools to help with ASCII in UTF-8  4: * Tools to help with ASCII in UTF-8
  4: * @version $Id: ascii.php,v 1.5 2006/10/16 20:38:12 harryf Exp $  5: * @version $Id: ascii.php,v 1.5 2006/10/16 20:38:12 harryf Exp $
  6: * @subpackage ascii  7: * @subpackage ascii
  7: */  8: */
  8:   9: 
  9: //-------------------------------------------------------------------- 
 10: /** 10: /**
 11: * Tests whether a string contains only 7bit ASCII bytes. 11: * Tests whether a string contains only 7bit ASCII bytes.
 12: * You might use this to conditionally check whether a string 12: * You might use this to conditionally check whether a string
 21: *     $someString = utf8_strtolower($someString); 21: *     $someString = utf8_strtolower($someString);
 22: * } 22: * }
 23: * </code> 23: * </code>
 24: *  24: *
 25: * @param string 25: * @param string
 26: * @return boolean TRUE if it's all ASCII 26: * @return boolean TRUE if it's all ASCII
 27: * @package utf8 27: * @package utf8
 28: * @subpackage ascii 28: * @subpackage ascii
 29: * @see utf8_is_ascii_ctrl 29: * @see utf8_is_ascii_ctrl
 30: */ 30: */
 31: function utf8_is_ascii($str) { 31: function utf8_is_ascii($str)
 32:     // Search for any bytes which are outside the ASCII range... 32: {
 33:     return (preg_match('/(?:[^\x00-\x7F])/',$str) !== 1); 33:     // Search for any bytes which are outside the ASCII range...
  34:     return (preg_match('/(?:[^\x00-\x7F])/', $str) !== 1);
 34: } 35: }
 35:  36: 
 36: //-------------------------------------------------------------------- 
 37: /** 37: /**
 38: * Tests whether a string contains only 7bit ASCII bytes with device 38: * Tests whether a string contains only 7bit ASCII bytes with device
 39: * control codes omitted. The device control codes can be found on the 39: * control codes omitted. The device control codes can be found on the
 40: * second table here: http://www.w3schools.com/tags/ref_ascii.asp 40: * second table here: http://www.w3schools.com/tags/ref_ascii.asp
 41: *  41: *
 42: * @param string 42: * @param string
 43: * @return boolean TRUE if it's all ASCII without device control codes 43: * @return boolean TRUE if it's all ASCII without device control codes
 44: * @package utf8 44: * @package utf8
 45: * @subpackage ascii 45: * @subpackage ascii
 46: * @see utf8_is_ascii 46: * @see utf8_is_ascii
 47: */ 47: */
 48: function utf8_is_ascii_ctrl($str) { 48: function utf8_is_ascii_ctrl($str)
 49:     if ( strlen($str) > 0 ) { 49: {
 50:         // Search for any bytes which are outside the ASCII range, 50:     // Search for any bytes which are outside the ASCII range, or are device control codes
 51:         // or are device control codes 51:     if (strlen($str) > 0)
 52:         return (preg_match('/[^\x09\x0A\x0D\x20-\x7E]/',$str) !== 1); 52:         return (preg_match('/[^\x09\x0A\x0D\x20-\x7E]/', $str) !== 1);
 53:     } 53: 
 54:     return FALSE; 54:     return false;
 55: } 55: }
 56:  56: 
 57: //-------------------------------------------------------------------- 
 58: /** 57: /**
 59: * Strip out all non-7bit ASCII bytes 58: * Strip out all non-7bit ASCII bytes
 60: * If you need to transmit a string to system which you know can only 59: * If you need to transmit a string to system which you know can only
 65: * @subpackage ascii 64: * @subpackage ascii
 66: * @see utf8_strip_non_ascii_ctrl 65: * @see utf8_strip_non_ascii_ctrl
 67: */ 66: */
 68: function utf8_strip_non_ascii($str) { 67: function utf8_strip_non_ascii($str)
 69:     ob_start(); 68: {
 70:     while ( preg_match( 69:     ob_start();
 71:         '/^([\x00-\x7F]+)|([^\x00-\x7F]+)/S', 70: 
 72:             $str, $matches) ) { 71:     while (preg_match('/^([\x00-\x7F]+)|([^\x00-\x7F]+)/S', $str, $matches))
 73:         if ( !isset($matches[2]) ) { 72:     {
 74:             echo $matches[0]; 73:         if (!isset($matches[2]))
 75:         } 74:             echo $matches[0];
 76:         $str = substr($str, strlen($matches[0])); 75: 
 77:     } 76:         $str = substr($str, strlen($matches[0]));
 78:     $result = ob_get_contents(); 77:     }
 79:     ob_end_clean(); 78: 
 80:     return $result; 79:     $result = ob_get_contents();
  80:     ob_end_clean();
  81: 
  82:     return $result;
 81: } 83: }
 82:  84: 
 83: //-------------------------------------------------------------------- 
 84: /** 85: /**
 85: * Strip out device control codes in the ASCII range 86: * Strip out device control codes in the ASCII range
 86: * which are not permitted in XML. Note that this leaves 87: * which are not permitted in XML. Note that this leaves
 90: * @param string 91: * @param string
 91: * @return string control codes removed 92: * @return string control codes removed
 92: */ 93: */
 93: function utf8_strip_ascii_ctrl($str) { 94: function utf8_strip_ascii_ctrl($str)
 94:     ob_start(); 95: {
 95:     while ( preg_match( 96:     ob_start();
 96:         '/^([^\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)|([\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)/S', 97: 
 97:             $str, $matches) ) { 98:     while (preg_match('/^([^\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)|([\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)/S', $str, $matches))
 98:         if ( !isset($matches[2]) ) { 99:     {
 99:             echo $matches[0];100:         if (!isset($matches[2]))
100:         }101:             echo $matches[0];
101:         $str = substr($str, strlen($matches[0]));102: 
102:     }103:         $str = substr($str, strlen($matches[0]));
103:     $result = ob_get_contents();104:     }
104:     ob_end_clean();105: 
105:     return $result;106:     $result = ob_get_contents();
 107:     ob_end_clean();
 108: 
 109:     return $result;
106: }110: }
107: 111: 
108: //-------------------------------------------------------------------- 
109: /**112: /**
110: * Strip out all non 7bit ASCII bytes and ASCII device control codes.113: * Strip out all non 7bit ASCII bytes and ASCII device control codes.
111: * For a list of ASCII device control codes see the 2nd table here:114: * For a list of ASCII device control codes see the 2nd table here:
112: * http://www.w3schools.com/tags/ref_ascii.asp115: * http://www.w3schools.com/tags/ref_ascii.asp
113: * 116: *
114: * @param string117: * @param string
115: * @return boolean TRUE if it's all ASCII118: * @return boolean TRUE if it's all ASCII
116: * @package utf8119: * @package utf8
117: * @subpackage ascii120: * @subpackage ascii
118: */121: */
119: function utf8_strip_non_ascii_ctrl($str) {122: function utf8_strip_non_ascii_ctrl($str)
120:     ob_start();123: {
121:     while ( preg_match(124:     ob_start();
122:         '/^([\x09\x0A\x0D\x20-\x7E]+)|([^\x09\x0A\x0D\x20-\x7E]+)/S',125: 
123:             $str, $matches) ) {126:     while (preg_match( '/^([\x09\x0A\x0D\x20-\x7E]+)|([^\x09\x0A\x0D\x20-\x7E]+)/S', $str, $matches))
124:         if ( !isset($matches[2]) ) {127:     {
125:             echo $matches[0];128:         if (!isset($matches[2]))
126:         }129:             echo $matches[0];
127:         $str = substr($str, strlen($matches[0]));130: 
128:     }131:         $str = substr($str, strlen($matches[0]));
129:     $result = ob_get_contents();132:     }
130:     ob_end_clean();133: 
131:     return $result;134:     $result = ob_get_contents();
 135:     ob_end_clean();
 136: 
 137:     return $result;
132: }138: }
133: 139: 
134: //--------------------------------------------------------------- 
135: /**140: /**
136: * Replace accented UTF-8 characters by unaccented ASCII-7 "equivalents".141: * Replace accented UTF-8 characters by unaccented ASCII-7 "equivalents".
137: * The purpose of this function is to replace characters commonly found in Latin142: * The purpose of this function is to replace characters commonly found in Latin
154: * @package utf8159: * @package utf8
155: * @subpackage ascii160: * @subpackage ascii
156: */161: */
157: function utf8_accents_to_ascii( $str, $case=0 ){162: function utf8_accents_to_ascii($str, $case=0)
158:     163: {
159:     static $UTF8_LOWER_ACCENTS = NULL;164:     static $UTF8_LOWER_ACCENTS = null;
160:     static $UTF8_UPPER_ACCENTS = NULL;165:     static $UTF8_UPPER_ACCENTS = null;
161:     166: 
162:     if($case <= 0){167:     if($case <= 0)
163:         168:     {
164:         if ( is_null($UTF8_LOWER_ACCENTS) ) {169: 
165:             $UTF8_LOWER_ACCENTS = array(170:         if (is_null($UTF8_LOWER_ACCENTS))
166:   'à' => 'a', 'ô' => 'o', 'ď' => 'd', 'ḟ' => 'f', 'ë' => 'e', 'š' => 's', 'ơ' => 'o',171:         {
167:   'ß' => 'ss', 'ă' => 'a', 'ř' => 'r', 'ț' => 't', 'ň' => 'n', 'ā' => 'a', 'ķ' => 'k',172:             $UTF8_LOWER_ACCENTS = array(
168:   'ŝ' => 's', 'ỳ' => 'y', 'ņ' => 'n', 'ĺ' => 'l', 'ħ' => 'h', 'ṗ' => 'p', 'ó' => 'o',173:                 'à' => 'a', 'ô' => 'o', 'ď' => 'd', 'ḟ' => 'f', 'ë' => 'e', 'š' => 's', 'ơ' => 'o',
169:   'ú' => 'u', 'ě' => 'e', 'é' => 'e', 'ç' => 'c', 'ẁ' => 'w', 'ċ' => 'c', 'õ' => 'o',174:                 'ß' => 'ss', 'ă' => 'a', 'ř' => 'r', 'ț' => 't', 'ň' => 'n', 'ā' => 'a', 'ķ' => 'k',
170:   'ṡ' => 's', 'ø' => 'o', 'ģ' => 'g', 'ŧ' => 't', 'ș' => 's', 'ė' => 'e', 'ĉ' => 'c',175:                 'ŝ' => 's', 'ỳ' => 'y', 'ņ' => 'n', 'ĺ' => 'l', 'ħ' => 'h', 'ṗ' => 'p', 'ó' => 'o',
171:   'ś' => 's', 'î' => 'i', 'ű' => 'u', 'ć' => 'c', 'ę' => 'e', 'ŵ' => 'w', 'ṫ' => 't',176:                 'ú' => 'u', 'ě' => 'e', 'é' => 'e', 'ç' => 'c', 'ẁ' => 'w', 'ċ' => 'c', 'õ' => 'o',
172:   'ū' => 'u', 'č' => 'c', 'ö' => 'oe', 'è' => 'e', 'ŷ' => 'y', 'ą' => 'a', 'ł' => 'l',177:                 'ṡ' => 's', 'ø' => 'o', 'ģ' => 'g', 'ŧ' => 't', 'ș' => 's', 'ė' => 'e', 'ĉ' => 'c',
173:   'ų' => 'u', 'ů' => 'u', 'ş' => 's', 'ğ' => 'g', 'ļ' => 'l', 'ƒ' => 'f', 'ž' => 'z',178:                 'ś' => 's', 'î' => 'i', 'ű' => 'u', 'ć' => 'c', 'ę' => 'e', 'ŵ' => 'w', 'ṫ' => 't',
174:   'ẃ' => 'w', 'ḃ' => 'b', 'å' => 'a', 'ì' => 'i', 'ï' => 'i', 'ḋ' => 'd', 'ť' => 't',179:                 'ū' => 'u', 'č' => 'c', 'ö' => 'oe', 'è' => 'e', 'ŷ' => 'y', 'ą' => 'a', 'ł' => 'l',
175:   'ŗ' => 'r', 'ä' => 'ae', 'í' => 'i', 'ŕ' => 'r', 'ê' => 'e', 'ü' => 'ue', 'ò' => 'o',180:                 'ų' => 'u', 'ů' => 'u', 'ş' => 's', 'ğ' => 'g', 'ļ' => 'l', 'ƒ' => 'f', 'ž' => 'z',
176:   'ē' => 'e', 'ñ' => 'n', 'ń' => 'n', 'ĥ' => 'h', 'ĝ' => 'g', 'đ' => 'd', 'ĵ' => 'j',181:                 'ẃ' => 'w', 'ḃ' => 'b', 'å' => 'a', 'ì' => 'i', 'ï' => 'i', 'ḋ' => 'd', 'ť' => 't',
177:   'ÿ' => 'y', 'ũ' => 'u', 'ŭ' => 'u', 'ư' => 'u', 'ţ' => 't', 'ý' => 'y', 'ő' => 'o',182:                 'ŗ' => 'r', 'ä' => 'ae', 'í' => 'i', 'ŕ' => 'r', 'ê' => 'e', 'ü' => 'ue', 'ò' => 'o',
178:   'â' => 'a', 'ľ' => 'l', 'ẅ' => 'w', 'ż' => 'z', 'ī' => 'i', 'ã' => 'a', 'ġ' => 'g',183:                 'ē' => 'e', 'ñ' => 'n', 'ń' => 'n', 'ĥ' => 'h', 'ĝ' => 'g', 'đ' => 'd', 'ĵ' => 'j',
179:   'ṁ' => 'm', 'ō' => 'o', 'ĩ' => 'i', 'ù' => 'u', 'į' => 'i', 'ź' => 'z', 'á' => 'a',184:                 'ÿ' => 'y', 'ũ' => 'u', 'ŭ' => 'u', 'ư' => 'u', 'ţ' => 't', 'ý' => 'y', 'ő' => 'o',
180:   'û' => 'u', 'þ' => 'th', 'ð' => 'dh', 'æ' => 'ae', 'µ' => 'u', 'ĕ' => 'e', 185:                 'â' => 'a', 'ľ' => 'l', 'ẅ' => 'w', 'ż' => 'z', 'ī' => 'i', 'ã' => 'a', 'ġ' => 'g',
181:             );186:                 'ṁ' => 'm', 'ō' => 'o', 'ĩ' => 'i', 'ù' => 'u', 'į' => 'i', 'ź' => 'z', 'á' => 'a',
182:         }187:                 'û' => 'u', 'þ' => 'th', 'ð' => 'dh', 'æ' => 'ae', 'µ' => 'u', 'ĕ' => 'e',
183:         188:                 );
184:         $str = str_replace(189:         }
185:                 array_keys($UTF8_LOWER_ACCENTS),190: 
186:                 array_values($UTF8_LOWER_ACCENTS),191:         $str = str_replace(array_keys($UTF8_LOWER_ACCENTS), array_values($UTF8_LOWER_ACCENTS), $str);
187:                 $str192:     }
188:             );193: 
189:     }194:     if($case >= 0)
190:     195:     {
191:     if($case >= 0){196:         if (is_null($UTF8_UPPER_ACCENTS))
192:         if ( is_null($UTF8_UPPER_ACCENTS) ) {197:         {
193:             $UTF8_UPPER_ACCENTS = array(198:             $UTF8_UPPER_ACCENTS = array(
194:   'À' => 'A', 'Ô' => 'O', 'Ď' => 'D', 'Ḟ' => 'F', 'Ë' => 'E', 'Š' => 'S', 'Ơ' => 'O',199:                 'À' => 'A', 'Ô' => 'O', 'Ď' => 'D', 'Ḟ' => 'F', 'Ë' => 'E', 'Š' => 'S', 'Ơ' => 'O',
195:   'Ă' => 'A', 'Ř' => 'R', 'Ț' => 'T', 'Ň' => 'N', 'Ā' => 'A', 'Ķ' => 'K',200:                 'Ă' => 'A', 'Ř' => 'R', 'Ț' => 'T', 'Ň' => 'N', 'Ā' => 'A', 'Ķ' => 'K',
196:   'Ŝ' => 'S', 'Ỳ' => 'Y', 'Ņ' => 'N', 'Ĺ' => 'L', 'Ħ' => 'H', 'Ṗ' => 'P', 'Ó' => 'O',201:                 'Ŝ' => 'S', 'Ỳ' => 'Y', 'Ņ' => 'N', 'Ĺ' => 'L', 'Ħ' => 'H', 'Ṗ' => 'P', 'Ó' => 'O',
197:   'Ú' => 'U', 'Ě' => 'E', 'É' => 'E', 'Ç' => 'C', 'Ẁ' => 'W', 'Ċ' => 'C', 'Õ' => 'O',202:                 'Ú' => 'U', 'Ě' => 'E', 'É' => 'E', 'Ç' => 'C', 'Ẁ' => 'W', 'Ċ' => 'C', 'Õ' => 'O',
198:   'Ṡ' => 'S', 'Ø' => 'O', 'Ģ' => 'G', 'Ŧ' => 'T', 'Ș' => 'S', 'Ė' => 'E', 'Ĉ' => 'C',203:                 'Ṡ' => 'S', 'Ø' => 'O', 'Ģ' => 'G', 'Ŧ' => 'T', 'Ș' => 'S', 'Ė' => 'E', 'Ĉ' => 'C',
199:   'Ś' => 'S', 'Î' => 'I', 'Ű' => 'U', 'Ć' => 'C', 'Ę' => 'E', 'Ŵ' => 'W', 'Ṫ' => 'T',204:                 'Ś' => 'S', 'Î' => 'I', 'Ű' => 'U', 'Ć' => 'C', 'Ę' => 'E', 'Ŵ' => 'W', 'Ṫ' => 'T',
200:   'Ū' => 'U', 'Č' => 'C', 'Ö' => 'Oe', 'È' => 'E', 'Ŷ' => 'Y', 'Ą' => 'A', 'Ł' => 'L',205:                 'Ū' => 'U', 'Č' => 'C', 'Ö' => 'Oe', 'È' => 'E', 'Ŷ' => 'Y', 'Ą' => 'A', 'Ł' => 'L',
201:   'Ų' => 'U', 'Ů' => 'U', 'Ş' => 'S', 'Ğ' => 'G', 'Ļ' => 'L', 'Ƒ' => 'F', 'Ž' => 'Z',206:                 'Ų' => 'U', 'Ů' => 'U', 'Ş' => 'S', 'Ğ' => 'G', 'Ļ' => 'L', 'Ƒ' => 'F', 'Ž' => 'Z',
202:   'Ẃ' => 'W', 'Ḃ' => 'B', 'Å' => 'A', 'Ì' => 'I', 'Ï' => 'I', 'Ḋ' => 'D', 'Ť' => 'T',207:                 'Ẃ' => 'W', 'Ḃ' => 'B', 'Å' => 'A', 'Ì' => 'I', 'Ï' => 'I', 'Ḋ' => 'D', 'Ť' => 'T',
203:   'Ŗ' => 'R', 'Ä' => 'Ae', 'Í' => 'I', 'Ŕ' => 'R', 'Ê' => 'E', 'Ü' => 'Ue', 'Ò' => 'O',208:                 'Ŗ' => 'R', 'Ä' => 'Ae', 'Í' => 'I', 'Ŕ' => 'R', 'Ê' => 'E', 'Ü' => 'Ue', 'Ò' => 'O',
204:   'Ē' => 'E', 'Ñ' => 'N', 'Ń' => 'N', 'Ĥ' => 'H', 'Ĝ' => 'G', 'Đ' => 'D', 'Ĵ' => 'J',209:                 'Ē' => 'E', 'Ñ' => 'N', 'Ń' => 'N', 'Ĥ' => 'H', 'Ĝ' => 'G', 'Đ' => 'D', 'Ĵ' => 'J',
205:   'Ÿ' => 'Y', 'Ũ' => 'U', 'Ŭ' => 'U', 'Ư' => 'U', 'Ţ' => 'T', 'Ý' => 'Y', 'Ő' => 'O',210:                 'Ÿ' => 'Y', 'Ũ' => 'U', 'Ŭ' => 'U', 'Ư' => 'U', 'Ţ' => 'T', 'Ý' => 'Y', 'Ő' => 'O',
206:   'Â' => 'A', 'Ľ' => 'L', 'Ẅ' => 'W', 'Ż' => 'Z', 'Ī' => 'I', 'Ã' => 'A', 'Ġ' => 'G',211:                 'Â' => 'A', 'Ľ' => 'L', 'Ẅ' => 'W', 'Ż' => 'Z', 'Ī' => 'I', 'Ã' => 'A', 'Ġ' => 'G',
207:   'Ṁ' => 'M', 'Ō' => 'O', 'Ĩ' => 'I', 'Ù' => 'U', 'Į' => 'I', 'Ź' => 'Z', 'Á' => 'A',212:                 'Ṁ' => 'M', 'Ō' => 'O', 'Ĩ' => 'I', 'Ù' => 'U', 'Į' => 'I', 'Ź' => 'Z', 'Á' => 'A',
208:   'Û' => 'U', 'Þ' => 'Th', 'Ð' => 'Dh', 'Æ' => 'Ae', 'Ĕ' => 'E',213:                 'Û' => 'U', 'Þ' => 'Th', 'Ð' => 'Dh', 'Æ' => 'Ae', 'Ĕ' => 'E',
209:             );214:                 );
210:         }215:         }
211:         $str = str_replace(216: 
212:                 array_keys($UTF8_UPPER_ACCENTS),217:         $str = str_replace(array_keys($UTF8_UPPER_ACCENTS), array_values($UTF8_UPPER_ACCENTS),  $str);
213:                 array_values($UTF8_UPPER_ACCENTS),218:     }
214:                 $str219: 
215:             );220:     return $str;
216:     } 
217:      
218:     return $str; 
219:      
220: }221: }


a/upload/include/utf8/utils/bad.php b/upload/include/utf8/utils/bad.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: bad.php,v 1.2 2006/02/26 13:20:44 harryf Exp $  4: * @version $Id: bad.php,v 1.2 2006/02/26 13:20:44 harryf Exp $
  4: * Tools for locating / replacing bad bytes in UTF-8 strings  5: * Tools for locating / replacing bad bytes in UTF-8 strings
 17: * @see utf8_is_valid 18: * @see utf8_is_valid
 18: */ 19: */
 19:  20: 
 20: //-------------------------------------------------------------------- 
 21: /** 21: /**
 22: * Locates the first bad byte in a UTF-8 string returning it's 22: * Locates the first bad byte in a UTF-8 string returning it's
 23: * byte index in the string 23: * byte index in the string
 30: * @package utf8 30: * @package utf8
 31: * @subpackage bad 31: * @subpackage bad
 32: */ 32: */
 33: function utf8_bad_find($str) { 33: function utf8_bad_find($str)
 34:     $UTF8_BAD = 34: {
 35:     '([\x00-\x7F]'.                          # ASCII (including control chars) 35:     $UTF8_BAD =
 36:     '|[\xC2-\xDF][\x80-\xBF]'.               # non-overlong 2-byte 36:         '([\x00-\x7F]'.                          # ASCII (including control chars)
 37:     '|\xE0[\xA0-\xBF][\x80-\xBF]'.           # excluding overlongs 37:         '|[\xC2-\xDF][\x80-\xBF]'.               # Non-overlong 2-byte
 38:     '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.    # straight 3-byte 38:         '|\xE0[\xA0-\xBF][\x80-\xBF]'.           # Excluding overlongs
 39:     '|\xED[\x80-\x9F][\x80-\xBF]'.           # excluding surrogates 39:         '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.    # Straight 3-byte
 40:     '|\xF0[\x90-\xBF][\x80-\xBF]{2}'.        # planes 1-3 40:         '|\xED[\x80-\x9F][\x80-\xBF]'.           # Excluding surrogates
 41:     '|[\xF1-\xF3][\x80-\xBF]{3}'.            # planes 4-15 41:         '|\xF0[\x90-\xBF][\x80-\xBF]{2}'.        # Planes 1-3
 42:     '|\xF4[\x80-\x8F][\x80-\xBF]{2}'.        # plane 16 42:         '|[\xF1-\xF3][\x80-\xBF]{3}'.            # Planes 4-15
 43:     '|(.{1}))';                              # invalid byte 43:         '|\xF4[\x80-\x8F][\x80-\xBF]{2}'.        # Plane 16
 44:     $pos = 0; 44:         '|(.{1}))';                              # Invalid byte
 45:     $badList = array(); 45:     $pos = 0;
 46:     while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) { 46:     $badList = array();
 47:         $bytes = strlen($matches[0]); 47: 
 48:         if ( isset($matches[2])) { 48:     while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches))
 49:             return $pos; 49:     {
 50:         } 50:         $bytes = strlen($matches[0]);
 51:         $pos += $bytes; 51: 
 52:         $str = substr($str,$bytes); 52:         if (isset($matches[2]))
 53:     } 53:             return $pos;
 54:     return FALSE; 54: 
  55:         $pos += $bytes;
  56:         $str = substr($str,$bytes);
  57:     }
  58: 
  59:     return false;
 55: } 60: }
 56:  61: 
 57: //-------------------------------------------------------------------- 
 58: /** 62: /**
 59: * Locates all bad bytes in a UTF-8 string and returns a list of their 63: * Locates all bad bytes in a UTF-8 string and returns a list of their
 60: * byte index in the string 64: * byte index in the string
 67: * @package utf8 71: * @package utf8
 68: * @subpackage bad 72: * @subpackage bad
 69: */ 73: */
 70: function utf8_bad_findall($str) { 74: function utf8_bad_findall($str)
 71:     $UTF8_BAD = 75: {
 72:     '([\x00-\x7F]'.                          # ASCII (including control chars) 76:     $UTF8_BAD =
 73:     '|[\xC2-\xDF][\x80-\xBF]'.               # non-overlong 2-byte 77:         '([\x00-\x7F]'.                          # ASCII (including control chars)
 74:     '|\xE0[\xA0-\xBF][\x80-\xBF]'.           # excluding overlongs 78:         '|[\xC2-\xDF][\x80-\xBF]'.               # Non-overlong 2-byte
 75:     '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.    # straight 3-byte 79:         '|\xE0[\xA0-\xBF][\x80-\xBF]'.           # Excluding overlongs
 76:     '|\xED[\x80-\x9F][\x80-\xBF]'.           # excluding surrogates 80:         '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.    # Straight 3-byte
 77:     '|\xF0[\x90-\xBF][\x80-\xBF]{2}'.        # planes 1-3 81:         '|\xED[\x80-\x9F][\x80-\xBF]'.           # Excluding surrogates
 78:     '|[\xF1-\xF3][\x80-\xBF]{3}'.            # planes 4-15 82:         '|\xF0[\x90-\xBF][\x80-\xBF]{2}'.        # Planes 1-3
 79:     '|\xF4[\x80-\x8F][\x80-\xBF]{2}'.        # plane 16 83:         '|[\xF1-\xF3][\x80-\xBF]{3}'.            # Planes 4-15
 80:     '|(.{1}))';                              # invalid byte 84:         '|\xF4[\x80-\x8F][\x80-\xBF]{2}'.        # Plane 16
 81:     $pos = 0; 85:         '|(.{1}))';                              # Invalid byte
 82:     $badList = array(); 86:     $pos = 0;
 83:     while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) { 87:     $badList = array();
 84:         $bytes = strlen($matches[0]); 88: 
 85:         if ( isset($matches[2])) { 89:     while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches))
 86:             $badList[] = $pos; 90:     {
 87:         } 91:         $bytes = strlen($matches[0]);
 88:         $pos += $bytes; 92: 
 89:         $str = substr($str,$bytes); 93:         if (isset($matches[2]))
 90:     } 94:             $badList[] = $pos;
 91:     if ( count($badList) > 0 ) { 95: 
 92:         return $badList; 96:         $pos += $bytes;
 93:     } 97:         $str = substr($str,$bytes);
 94:     return FALSE; 98:     }
  99: 
 100:     if (count($badList) > 0)
 101:         return $badList;
 102: 
 103:     return false;
 95: }104: }
 96: 105: 
 97: //-------------------------------------------------------------------- 
 98: /**106: /**
 99: * Strips out any bad bytes from a UTF-8 string and returns the rest107: * Strips out any bad bytes from a UTF-8 string and returns the rest
100: * PCRE Pattern to locate bad bytes in a UTF-8 string108: * PCRE Pattern to locate bad bytes in a UTF-8 string
106: * @package utf8114: * @package utf8
107: * @subpackage bad115: * @subpackage bad
108: */116: */
109: function utf8_bad_strip($str) {117: function utf8_bad_strip($str)
110:     $UTF8_BAD =118: {
111:     '([\x00-\x7F]'.                          # ASCII (including control chars)119:     $UTF8_BAD =
112:     '|[\xC2-\xDF][\x80-\xBF]'.               # non-overlong 2-byte120:         '([\x00-\x7F]'.                          # ASCII (including control chars)
113:     '|\xE0[\xA0-\xBF][\x80-\xBF]'.           # excluding overlongs121:         '|[\xC2-\xDF][\x80-\xBF]'.               # Non-overlong 2-byte
114:     '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.    # straight 3-byte122:         '|\xE0[\xA0-\xBF][\x80-\xBF]'.           # Excluding overlongs
115:     '|\xED[\x80-\x9F][\x80-\xBF]'.           # excluding surrogates123:         '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.    # Straight 3-byte
116:     '|\xF0[\x90-\xBF][\x80-\xBF]{2}'.        # planes 1-3124:         '|\xED[\x80-\x9F][\x80-\xBF]'.           # Excluding surrogates
117:     '|[\xF1-\xF3][\x80-\xBF]{3}'.            # planes 4-15125:         '|\xF0[\x90-\xBF][\x80-\xBF]{2}'.        # Planes 1-3
118:     '|\xF4[\x80-\x8F][\x80-\xBF]{2}'.        # plane 16126:         '|[\xF1-\xF3][\x80-\xBF]{3}'.            # Planes 4-15
119:     '|(.{1}))';                              # invalid byte127:         '|\xF4[\x80-\x8F][\x80-\xBF]{2}'.        # Plane 16
120:     ob_start();128:         '|(.{1}))';                              # Invalid byte
121:     while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) {129: 
122:         if ( !isset($matches[2])) {130:     ob_start();
123:             echo $matches[0];131: 
124:         }132:     while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches))
125:         $str = substr($str,strlen($matches[0]));133:     {
126:     }134:         if (!isset($matches[2]))
127:     $result = ob_get_contents();135:             echo $matches[0];
128:     ob_end_clean();136: 
129:     return $result;137:         $str = substr($str, strlen($matches[0]));
 138:     }
 139: 
 140:     $result = ob_get_contents();
 141:     ob_end_clean();
 142: 
 143:     return $result;
130: }144: }
131: 145: 
132: //-------------------------------------------------------------------- 
133: /**146: /**
134: * Replace bad bytes with an alternative character - ASCII character147: * Replace bad bytes with an alternative character - ASCII character
135: * recommended is replacement char148: * recommended is replacement char
143: * @package utf8156: * @package utf8
144: * @subpackage bad157: * @subpackage bad
145: */158: */
146: function utf8_bad_replace($str, $replace = '?') {159: function utf8_bad_replace($str, $replace='?')
147:     $UTF8_BAD =160: {
148:     '([\x00-\x7F]'.                          # ASCII (including control chars)161:     $UTF8_BAD =
149:     '|[\xC2-\xDF][\x80-\xBF]'.               # non-overlong 2-byte162:         '([\x00-\x7F]'.                          # ASCII (including control chars)
150:     '|\xE0[\xA0-\xBF][\x80-\xBF]'.           # excluding overlongs163:         '|[\xC2-\xDF][\x80-\xBF]'.               # Non-overlong 2-byte
151:     '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.    # straight 3-byte164:         '|\xE0[\xA0-\xBF][\x80-\xBF]'.           # Excluding overlongs
152:     '|\xED[\x80-\x9F][\x80-\xBF]'.           # excluding surrogates165:         '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.    # Straight 3-byte
153:     '|\xF0[\x90-\xBF][\x80-\xBF]{2}'.        # planes 1-3166:         '|\xED[\x80-\x9F][\x80-\xBF]'.           # Excluding surrogates
154:     '|[\xF1-\xF3][\x80-\xBF]{3}'.            # planes 4-15167:         '|\xF0[\x90-\xBF][\x80-\xBF]{2}'.        # Planes 1-3
155:     '|\xF4[\x80-\x8F][\x80-\xBF]{2}'.        # plane 16168:         '|[\xF1-\xF3][\x80-\xBF]{3}'.            # Planes 4-15
156:     '|(.{1}))';                              # invalid byte169:         '|\xF4[\x80-\x8F][\x80-\xBF]{2}'.        # Plane 16
157:     ob_start();170:         '|(.{1}))';                              # Invalid byte
158:     while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) {171: 
159:         if ( !isset($matches[2])) {172:     ob_start();
160:             echo $matches[0];173: 
161:         } else {174:     while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches))
162:             echo $replace;175:     {
163:         }176:         if (!isset($matches[2]))
164:         $str = substr($str,strlen($matches[0]));177:             echo $matches[0];
165:     }178:         else
166:     $result = ob_get_contents();179:             echo $replace;
167:     ob_end_clean();180: 
168:     return $result;181:         $str = substr($str, strlen($matches[0]));
 182:     }
 183: 
 184:     $result = ob_get_contents();
 185:     ob_end_clean();
 186: 
 187:     return $result;
169: }188: }
170: 189: 
171: //-------------------------------------------------------------------- 
172: /**190: /**
173: * Return code from utf8_bad_identify() when a five octet sequence is detected.191: * Return code from utf8_bad_identify() when a five octet sequence is detected.
174: * Note: 5 octets sequences are valid UTF-8 but are not supported by Unicode so192: * Note: 5 octets sequences are valid UTF-8 but are not supported by Unicode so
177: * @package utf8195: * @package utf8
178: * @subpackage bad196: * @subpackage bad
179: */197: */
180: define('UTF8_BAD_5OCTET',1);198: define('UTF8_BAD_5OCTET', 1);
181: 199: 
182: /**200: /**
183: * Return code from utf8_bad_identify() when a six octet sequence is detected.201: * Return code from utf8_bad_identify() when a six octet sequence is detected.
187: * @package utf8205: * @package utf8
188: * @subpackage bad206: * @subpackage bad
189: */207: */
190: define('UTF8_BAD_6OCTET',2);208: define('UTF8_BAD_6OCTET', 2);
191: 209: 
192: /**210: /**
193: * Return code from utf8_bad_identify().211: * Return code from utf8_bad_identify().
196: * @package utf8214: * @package utf8
197: * @subpackage bad215: * @subpackage bad
198: */216: */
199: define('UTF8_BAD_SEQID',3);217: define('UTF8_BAD_SEQID', 3);
200: 218: 
201: /**219: /**
202: * Return code from utf8_bad_identify().220: * Return code from utf8_bad_identify().
205: * @package utf8223: * @package utf8
206: * @subpackage bad224: * @subpackage bad
207: */225: */
208: define('UTF8_BAD_NONSHORT',4);226: define('UTF8_BAD_NONSHORT', 4);
209: 227: 
210: /**228: /**
211: * Return code from utf8_bad_identify().229: * Return code from utf8_bad_identify().
214: * @package utf8232: * @package utf8
215: * @subpackage bad233: * @subpackage bad
216: */234: */
217: define('UTF8_BAD_SURROGATE',5);235: define('UTF8_BAD_SURROGATE', 5);
218: 236: 
219: /**237: /**
220: * Return code from utf8_bad_identify().238: * Return code from utf8_bad_identify().
223: * @package utf8241: * @package utf8
224: * @subpackage bad242: * @subpackage bad
225: */243: */
226: define('UTF8_BAD_UNIOUTRANGE',6);244: define('UTF8_BAD_UNIOUTRANGE', 6);
227: 245: 
228: /**246: /**
229: * Return code from utf8_bad_identify().247: * Return code from utf8_bad_identify().
233: * @package utf8251: * @package utf8
234: * @subpackage bad252: * @subpackage bad
235: */253: */
236: define('UTF8_BAD_SEQINCOMPLETE',7);254: define('UTF8_BAD_SEQINCOMPLETE', 7);
237: 255: 
238: //-------------------------------------------------------------------- 
239: /**256: /**
240: * Reports on the type of bad byte found in a UTF-8 string. Returns a257: * Reports on the type of bad byte found in a UTF-8 string. Returns a
241: * status code on the first bad byte found258: * status code on the first bad byte found
247: * @package utf8264: * @package utf8
248: * @subpackage bad265: * @subpackage bad
249: */266: */
250: function utf8_bad_identify($str, &$i) {267: function utf8_bad_identify($str, &$i)
251:     268: {
252:     $mState = 0;     // cached expected number of octets after the current octet269:     $mState = 0;     // Cached expected number of octets after the current octet
253:                      // until the beginning of the next UTF8 character sequence270:                      // until the beginning of the next UTF8 character sequence
254:     $mUcs4  = 0;     // cached Unicode character271:     $mUcs4  = 0;     // Cached Unicode character
255:     $mBytes = 1;     // cached expected number of octets in the current sequence272:     $mBytes = 1;     // Cached expected number of octets in the current sequence
256:     273: 
257:     $len = strlen($str);274:     $len = strlen($str);
258:     275: 
259:     for($i = 0; $i < $len; $i++) {276:     for($i=0; $i < $len; $i++)
260:         277:     {
261:         $in = ord($str{$i});278:         $in = ord($str{$i});
262:         279: 
263:         if ( $mState == 0) {280:         if ( $mState == 0)
264:             281:         {
265:             // When mState is zero we expect either a US-ASCII character or a282:             // When mState is zero we expect either a US-ASCII character or a multi-octet sequence.
266:             // multi-octet sequence.283:             if (0 == (0x80 & ($in)))
267:             if (0 == (0x80 & ($in))) {284:             {
268:                 // US-ASCII, pass straight through.285:                 // US-ASCII, pass straight through.
269:                 $mBytes = 1;286:                 $mBytes = 1;
270:                 287:             }
271:             } else if (0xC0 == (0xE0 & ($in))) {288:             else if (0xC0 == (0xE0 & ($in)))
272:                 // First octet of 2 octet sequence289:             {
273:                 $mUcs4 = ($in);290:                 // First octet of 2 octet sequence
274:                 $mUcs4 = ($mUcs4 & 0x1F) << 6;291:                 $mUcs4 = ($in);
275:                 $mState = 1;292:                 $mUcs4 = ($mUcs4 & 0x1F) << 6;
276:                 $mBytes = 2;293:                 $mState = 1;
277:                 294:                 $mBytes = 2;
278:             } else if (0xE0 == (0xF0 & ($in))) {295:             }
279:                 // First octet of 3 octet sequence296:             else if (0xE0 == (0xF0 & ($in)))
280:                 $mUcs4 = ($in);297:             {
281:                 $mUcs4 = ($mUcs4 & 0x0F) << 12;298:                 // First octet of 3 octet sequence
282:                 $mState = 2;299:                 $mUcs4 = ($in);
283:                 $mBytes = 3;300:                 $mUcs4 = ($mUcs4 & 0x0F) << 12;
284:                 301:                 $mState = 2;
285:             } else if (0xF0 == (0xF8 & ($in))) {302:                 $mBytes = 3;
286:                 // First octet of 4 octet sequence303:             }
287:                 $mUcs4 = ($in);304:             else if (0xF0 == (0xF8 & ($in)))
288:                 $mUcs4 = ($mUcs4 & 0x07) << 18;305:             {
289:                 $mState = 3;306:                 // First octet of 4 octet sequence
290:                 $mBytes = 4;307:                 $mUcs4 = ($in);
291:                 308:                 $mUcs4 = ($mUcs4 & 0x07) << 18;
292:             } else if (0xF8 == (0xFC & ($in))) {309:                 $mState = 3;
293:                 310:                 $mBytes = 4;
294:                 /* First octet of 5 octet sequence.311:             }
295:                 *312:             else if (0xF8 == (0xFC & ($in)))
296:                 * This is illegal because the encoded codepoint must be either313:             {
297:                 * (a) not the shortest form or314:                 /* First octet of 5 octet sequence.
298:                 * (b) outside the Unicode range of 0-0x10FFFF.315:                 *
299:                 */316:                 * This is illegal because the encoded codepoint must be either
300:                 317:                 * (a) not the shortest form or
301:                 return UTF8_BAD_5OCTET;318:                 * (b) outside the Unicode range of 0-0x10FFFF.
302:                 319:                 */
303:             } else if (0xFC == (0xFE & ($in))) {320:                 return UTF8_BAD_5OCTET;
304:                 321:             }
305:                 // First octet of 6 octet sequence, see comments for 5 octet sequence.322:             else if (0xFC == (0xFE & ($in)))
306:                 return UTF8_BAD_6OCTET;323:             {
307:                 324:                 // First octet of 6 octet sequence, see comments for 5 octet sequence.
308:             } else {325:                 return UTF8_BAD_6OCTET;
309:                 // Current octet is neither in the US-ASCII range nor a legal first326:             }
310:                 // octet of a multi-octet sequence.327:             else
311:                 return UTF8_BAD_SEQID;328:             {
312:                 329:                 // Current octet is neither in the US-ASCII range nor a legal first
313:             }330:                 // octet of a multi-octet sequence.
314:         331:                 return UTF8_BAD_SEQID;
315:         } else {332:             }
316:             333:         }
317:             // When mState is non-zero, we expect a continuation of the multi-octet334:         else
318:             // sequence335:         {
319:             if (0x80 == (0xC0 & ($in))) {336:             // When mState is non-zero, we expect a continuation of the multi-octet sequence
320:                 337:             if (0x80 == (0xC0 & ($in)))
321:                 // Legal continuation.338:             {
322:                 $shift = ($mState - 1) * 6;339:                 // Legal continuation.
323:                 $tmp = $in;340:                 $shift = ($mState - 1) * 6;
324:                 $tmp = ($tmp & 0x0000003F) << $shift;341:                 $tmp = $in;
325:                 $mUcs4 |= $tmp;342:                 $tmp = ($tmp & 0x0000003F) << $shift;
326:             343:                 $mUcs4 |= $tmp;
327:                 /**344: 
328:                 * End of the multi-octet sequence. mUcs4 now contains the final345:                 /**
329:                 * Unicode codepoint to be output346:                 * End of the multi-octet sequence. mUcs4 now contains the final
330:                 */347:                 * Unicode codepoint to be output
331:                 if (0 == --$mState) {348:                 */
332:                     349:                 if (0 == --$mState)
333:                     // From Unicode 3.1, non-shortest form is illegal350:                 {
334:                     if (((2 == $mBytes) && ($mUcs4 < 0x0080)) ||351:                     // From Unicode 3.1, non-shortest form is illegal
335:                         ((3 == $mBytes) && ($mUcs4 < 0x0800)) ||352:                     if (((2 == $mBytes) && ($mUcs4 < 0x0080)) ||
336:                         ((4 == $mBytes) && ($mUcs4 < 0x10000)) ) {353:                     ((3 == $mBytes) && ($mUcs4 < 0x0800)) ||
337:                         return UTF8_BAD_NONSHORT;354:                     ((4 == $mBytes) && ($mUcs4 < 0x10000)) )
338:                         355:                         return UTF8_BAD_NONSHORT;
339:                     // From Unicode 3.2, surrogate characters are illegal356:                     else if (($mUcs4 & 0xFFFFF800) == 0xD800) // From Unicode 3.2, surrogate characters are illegal
340:                     } else if (($mUcs4 & 0xFFFFF800) == 0xD800) {357:                         return UTF8_BAD_SURROGATE;
341:                         return UTF8_BAD_SURROGATE;358:                     else if ($mUcs4 > 0x10FFFF) // Codepoints outside the Unicode range are illegal
342:                         359:                         return UTF8_BAD_UNIOUTRANGE;
343:                     // Codepoints outside the Unicode range are illegal360: 
344:                     } else if ($mUcs4 > 0x10FFFF) {361:                     // Initialize UTF8 cache
345:                         return UTF8_BAD_UNIOUTRANGE;362:                     $mState = 0;
346:                     }363:                     $mUcs4  = 0;
347:                     364:                     $mBytes = 1;
348:                     //initialize UTF8 cache365:                 }
349:                     $mState = 0;366: 
350:                     $mUcs4  = 0;367:             }
351:                     $mBytes = 1;368:             else
352:                 }369:             {
353:             370:                 // ((0xC0 & (*in) != 0x80) && (mState != 0))
354:             } else {371:                 // Incomplete multi-octet sequence.
355:                 // ((0xC0 & (*in) != 0x80) && (mState != 0))372:                 $i--;
356:                 // Incomplete multi-octet sequence.373:                 return UTF8_BAD_SEQINCOMPLETE;
357:                 $i--;374:             }
358:                 return UTF8_BAD_SEQINCOMPLETE;375:         }
359:             }376:     }
360:         }377: 
361:     }378:     // Incomplete multi-octet sequence
362:     379:     if ($mState != 0)
363:     if ( $mState != 0 ) {380:     {
364:         // Incomplete multi-octet sequence.381:         $i--;
365:         $i--;382:         return UTF8_BAD_SEQINCOMPLETE;
366:         return UTF8_BAD_SEQINCOMPLETE;383:     }
367:     }384: 
368:     385:     // No bad octets found
369:     // No bad octets found386:     $i = null;
370:     $i = NULL;387:     return false;
371:     return FALSE; 
372: }388: }
373: 389: 
374: //-------------------------------------------------------------------- 
375: /**390: /**
376: * Takes a return code from utf8_bad_identify() are returns a message391: * Takes a return code from utf8_bad_identify() are returns a message
377: * (in English) explaining what the problem is.392: * (in English) explaining what the problem is.
381: * @package utf8396: * @package utf8
382: * @subpackage bad397: * @subpackage bad
383: */398: */
384: function utf8_bad_explain($code) {399: function utf8_bad_explain($code)
385:     400: {
386:     switch ($code) {401:     switch ($code)
387:         402:     {
388:         case UTF8_BAD_5OCTET:403:         case UTF8_BAD_5OCTET:
389:             return 'Five octet sequences are valid UTF-8 but are not supported by Unicode';404:         return 'Five octet sequences are valid UTF-8 but are not supported by Unicode';
390:         break;405:         break;
391:         406: 
392:         case UTF8_BAD_6OCTET:407:         case UTF8_BAD_6OCTET:
393:             return 'Six octet sequences are valid UTF-8 but are not supported by Unicode';408:         return 'Six octet sequences are valid UTF-8 but are not supported by Unicode';
394:         break;409:         break;
395:         410: 
396:         case UTF8_BAD_SEQID:411:         case UTF8_BAD_SEQID:
397:             return 'Invalid octet for use as start of multi-byte UTF-8 sequence';412:         return 'Invalid octet for use as start of multi-byte UTF-8 sequence';
398:         break;413:         break;
399:         414: 
400:         case UTF8_BAD_NONSHORT:415:         case UTF8_BAD_NONSHORT:
401:             return 'From Unicode 3.1, non-shortest form is illegal';416:         return 'From Unicode 3.1, non-shortest form is illegal';
402:         break;417:         break;
403:         418: 
404:         case UTF8_BAD_SURROGATE:419:         case UTF8_BAD_SURROGATE:
405:             return 'From Unicode 3.2, surrogate characters are illegal';420:         return 'From Unicode 3.2, surrogate characters are illegal';
406:         break;421:         break;
407:         422: 
408:         case UTF8_BAD_UNIOUTRANGE:423:         case UTF8_BAD_UNIOUTRANGE:
409:             return 'Codepoints outside the Unicode range are illegal';424:         return 'Codepoints outside the Unicode range are illegal';
410:         break;425:         break;
411:         426: 
412:         case UTF8_BAD_SEQINCOMPLETE:427:         case UTF8_BAD_SEQINCOMPLETE:
413:             return 'Incomplete multi-octet sequence';428:         return 'Incomplete multi-octet sequence';
414:         break;429:         break;
415:         430:     }
416:     }431: 
417:     432:     trigger_error('Unknown error code: '.$code, E_USER_WARNING);
418:     trigger_error('Unknown error code: '.$code,E_USER_WARNING);433: 
419:     return FALSE;434:     return false;
420:      
421: }435: }


a/upload/include/utf8/utils/patterns.php b/upload/include/utf8/utils/patterns.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * PCRE Regular expressions for UTF-8. Note this file is not actually used by  4: * PCRE Regular expressions for UTF-8. Note this file is not actually used by
  4: * the rest of the library but these regular expressions can be useful to have  5: * the rest of the library but these regular expressions can be useful to have
  9: * @subpackage patterns 10: * @subpackage patterns
 10: */ 11: */
 11:  12: 
 12: //-------------------------------------------------------------------- 
 13: /** 13: /**
 14: * PCRE Pattern to check a UTF-8 string is valid 14: * PCRE Pattern to check a UTF-8 string is valid
 15: * Comes from W3 FAQ: Multilingual Forms 15: * Comes from W3 FAQ: Multilingual Forms
 19: * @subpackage patterns 19: * @subpackage patterns
 20: */ 20: */
 21: $UTF8_VALID = '^('. 21: $UTF8_VALID = '^('.
 22:     '[\x00-\x7F]'.                          # ASCII (including control chars) 22:     '[\x00-\x7F]'.                          # ASCII (including control chars)
 23:     '|[\xC2-\xDF][\x80-\xBF]'.              # non-overlong 2-byte 23:     '|[\xC2-\xDF][\x80-\xBF]'.              # Non-overlong 2-byte
 24:     '|\xE0[\xA0-\xBF][\x80-\xBF]'.          # excluding overlongs 24:     '|\xE0[\xA0-\xBF][\x80-\xBF]'.          # Excluding overlongs
 25:     '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.   # straight 3-byte 25:     '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.   # Straight 3-byte
 26:     '|\xED[\x80-\x9F][\x80-\xBF]'.          # excluding surrogates 26:     '|\xED[\x80-\x9F][\x80-\xBF]'.          # Excluding surrogates
 27:     '|\xF0[\x90-\xBF][\x80-\xBF]{2}'.       # planes 1-3 27:     '|\xF0[\x90-\xBF][\x80-\xBF]{2}'.       # Planes 1-3
 28:     '|[\xF1-\xF3][\x80-\xBF]{3}'.           # planes 4-15 28:     '|[\xF1-\xF3][\x80-\xBF]{3}'.           # Planes 4-15
 29:     '|\xF4[\x80-\x8F][\x80-\xBF]{2}'.       # plane 16 29:     '|\xF4[\x80-\x8F][\x80-\xBF]{2}'.       # Plane 16
 30:     ')*$'; 30:     ')*$';
 31:  31: 
 32: //-------------------------------------------------------------------- 
 33: /** 32: /**
 34: * PCRE Pattern to match single UTF-8 characters 33: * PCRE Pattern to match single UTF-8 characters
 35: * Comes from W3 FAQ: Multilingual Forms 34: * Comes from W3 FAQ: Multilingual Forms
 39: * @subpackage patterns 38: * @subpackage patterns
 40: */ 39: */
 41: $UTF8_MATCH = 40: $UTF8_MATCH =
 42:     '([\x00-\x7F])'.                          # ASCII (including control chars) 41:     '([\x00-\x7F])'.                          # ASCII (including control chars)
 43:     '|([\xC2-\xDF][\x80-\xBF])'.              # non-overlong 2-byte 42:     '|([\xC2-\xDF][\x80-\xBF])'.              # Non-overlong 2-byte
 44:     '|(\xE0[\xA0-\xBF][\x80-\xBF])'.          # excluding overlongs 43:     '|(\xE0[\xA0-\xBF][\x80-\xBF])'.          # Excluding overlongs
 45:     '|([\xE1-\xEC\xEE\xEF][\x80-\xBF]{2})'.   # straight 3-byte 44:     '|([\xE1-\xEC\xEE\xEF][\x80-\xBF]{2})'.   # Straight 3-byte
 46:     '|(\xED[\x80-\x9F][\x80-\xBF])'.          # excluding surrogates 45:     '|(\xED[\x80-\x9F][\x80-\xBF])'.          # Excluding surrogates
 47:     '|(\xF0[\x90-\xBF][\x80-\xBF]{2})'.       # planes 1-3 46:     '|(\xF0[\x90-\xBF][\x80-\xBF]{2})'.       # Planes 1-3
 48:     '|([\xF1-\xF3][\x80-\xBF]{3})'.           # planes 4-15 47:     '|([\xF1-\xF3][\x80-\xBF]{3})'.           # Planes 4-15
 49:     '|(\xF4[\x80-\x8F][\x80-\xBF]{2})';       # plane 16 48:     '|(\xF4[\x80-\x8F][\x80-\xBF]{2})';       # Plane 16
 50:  49: 
 51: //-------------------------------------------------------------------- 
 52: /** 50: /**
 53: * PCRE Pattern to locate bad bytes in a UTF-8 string 51: * PCRE Pattern to locate bad bytes in a UTF-8 string
 54: * Comes from W3 FAQ: Multilingual Forms 52: * Comes from W3 FAQ: Multilingual Forms
 58: * @subpackage patterns 56: * @subpackage patterns
 59: */ 57: */
 60: $UTF8_BAD = 58: $UTF8_BAD =


a/upload/include/utf8/utils/position.php b/upload/include/utf8/utils/position.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * Locate a byte index given a UTF-8 character index  4: * Locate a byte index given a UTF-8 character index
  4: * @version $Id: position.php,v 1.1 2006/10/01 00:01:31 harryf Exp $  5: * @version $Id: position.php,v 1.1 2006/10/01 00:01:31 harryf Exp $
  6: * @subpackage position  7: * @subpackage position
  7: */  8: */
  8:   9: 
  9: //-------------------------------------------------------------------- 
 10: /** 10: /**
 11: * Given a string and a character index in the string, in 11: * Given a string and a character index in the string, in
 12: * terms of the UTF-8 character position, returns the byte 12: * terms of the UTF-8 character position, returns the byte
 27: * @package utf8 27: * @package utf8
 28: * @subpackage position 28: * @subpackage position
 29: */ 29: */
 30: function utf8_byte_position() { 30: function utf8_byte_position()
 31:      31: {
 32:     $args = func_get_args(); 32:     $args = func_get_args();
 33:     $str =& array_shift($args); 33:     $str =& array_shift($args);
 34:     if (!is_string($str)) return false; 34: 
 35:      35:     if (!is_string($str))
 36:     $result = array(); 36:         return false;
 37:      37: 
 38:     // trivial byte index, character offset pair 38:     $result = array();
 39:     $prev = array(0,0); 39:     $prev = array(0, 0); // Trivial byte index, character offset pair
 40:      40:     $i = utf8_locate_next_chr($str, 300); // Use a short piece of str to estimate bytes per character. $i (& $j) -> byte indexes into $str
 41:     // use a short piece of str to estimate bytes per character 41:     $c = strlen(utf8_decode(substr($str, 0, $i))); // $c -> character offset into $str
 42:     // $i (& $j) -> byte indexes into $str 42: 
 43:     $i = utf8_locate_next_chr($str, 300); 43:     // Deal with arguments from lowest to highest
 44:      44:     sort($args);
 45:     // $c -> character offset into $str 45: 
 46:     $c = strlen(utf8_decode(substr($str,0,$i))); 46:     foreach ($args as $offset)
 47:      47:     {
 48:     // deal with arguments from lowest to highest 48:         // Sanity checks FIXME
 49:     sort($args); 49: 
 50:      50:         // 0 is an easy check
 51:     foreach ($args as $offset) { 51:         if ($offset == 0)
 52:         // sanity checks FIXME 52:         {
 53:          53:             $result[] = 0; continue;
 54:         // 0 is an easy check 54:         }
 55:         if ($offset == 0) { $result[] = 0; continue; } 55: 
 56:          56:         // Ensure no endless looping
 57:         // ensure no endless looping 57:         $safety_valve = 50;
 58:         $safety_valve = 50; 58: 
 59:          59:         do
 60:         do { 60:         {
 61:              61:             if (($c - $prev[1]) == 0)
 62:             if ( ($c - $prev[1]) == 0 ) { 62:             {
 63:                 // Hack: gone past end of string 63:                 // Hack: gone past end of string
 64:                 $error = 0; 64:                 $error = 0;
 65:                 $i = strlen($str); 65:                 $i = strlen($str);
 66:                 break; 66:                 break;
 67:             } 67:             }
 68:              68: 
 69:             $j = $i + (int)(($offset-$c) * ($i - $prev[0]) / ($c - $prev[1])); 69:             $j = $i + (int)(($offset-$c) * ($i - $prev[0]) / ($c - $prev[1]));
 70:              70:             $j = utf8_locate_next_chr($str, $j); // Correct to utf8 character boundary
 71:             // correct to utf8 character boundary 71:             $prev = array($i,$c); // Save the index, offset for use next iteration
 72:             $j = utf8_locate_next_chr($str, $j); 72: 
 73:              73:             if ($j > $i)
 74:             // save the index, offset for use next iteration 74:                 $c += strlen(utf8_decode(substr($str, $i, $j-$i))); // Determine new character offset
 75:             $prev = array($i,$c); 75:             else
 76:              76:                 $c -= strlen(utf8_decode(substr($str, $j, $i-$j))); // Ditto
 77:             if ($j > $i) { 77: 
 78:                 // determine new character offset 78:             $error = abs($c-$offset);
 79:                 $c += strlen(utf8_decode(substr($str,$i,$j-$i))); 79:             $i = $j; // Ready for next time around
 80:             } else { 80:         }
 81:                 // ditto 81:         while (($error > 7) && --$safety_valve); // From 7 it is faster to iterate over the string
 82:                 $c -= strlen(utf8_decode(substr($str,$j,$i-$j))); 82: 
 83:             } 83:         if ($error && $error <= 7)
 84:              84:         {
 85:             $error = abs($c-$offset); 85:             if ($c < $offset)
 86:              86:             {
 87:             // ready for next time around 87:                 // Move up
 88:             $i = $j; 88:                 while ($error--)
 89:          89:                     $i = utf8_locate_next_chr($str, ++$i);
 90:         // from 7 it is faster to iterate over the string 90:             }
 91:         } while ( ($error > 7) && --$safety_valve) ; 91:             else
 92:          92:             {
 93:         if ($error && $error <= 7) { 93:                 // Move down
 94:              94:                 while ($error--)
 95:             if ($c < $offset) { 95:                     $i = utf8_locate_current_chr($str, --$i);
 96:                 // move up 96:             }
 97:                 while ($error--) { $i = utf8_locate_next_chr($str,++$i); } 97: 
 98:             } else { 98:             // Ready for next arg
 99:                 // move down 99:             $c = $offset;
100:                 while ($error--) { $i = utf8_locate_current_chr($str,--$i); }100:         }
101:             }101: 
102:             102:         $result[] = $i;
103:             // ready for next arg103:     }
104:             $c = $offset;104: 
105:         }105:     if (count($result) == 1)
106:         $result[] = $i;106:         return $result[0];
107:     }107: 
108:     108:     return $result;
109:     if ( count($result) == 1 ) { 
110:         return $result[0]; 
111:     } 
112:      
113:     return $result; 
114: }109: }
115: 110: 
116: //-------------------------------------------------------------------- 
117: /**111: /**
118: * Given a string and any byte index, returns the byte index112: * Given a string and any byte index, returns the byte index
119: * of the start of the current UTF-8 character, relative to supplied113: * of the start of the current UTF-8 character, relative to supplied
128: * @package utf8122: * @package utf8
129: * @subpackage position123: * @subpackage position
130: */124: */
131: function utf8_locate_current_chr( &$str, $idx ) {125: function utf8_locate_current_chr( &$str, $idx )
132:     126: {
133:     if ($idx <= 0) return 0;127:     if ($idx <= 0)
134:     128:         return 0;
135:     $limit = strlen($str);129: 
136:     if ($idx >= $limit) return $limit;130:     $limit = strlen($str);
137:     131:     if ($idx >= $limit)
138:     // Binary value for any byte after the first in a multi-byte UTF-8 character132:         return $limit;
139:     // will be like 10xxxxxx so & 0xC0 can be used to detect this kind133: 
140:     // of byte - assuming well formed UTF-8134:     // Binary value for any byte after the first in a multi-byte UTF-8 character
141:     while ($idx && ((ord($str[$idx]) & 0xC0) == 0x80)) $idx--;135:     // will be like 10xxxxxx so & 0xC0 can be used to detect this kind
142:     136:     // of byte - assuming well formed UTF-8
143:     return $idx;137:     while ($idx && ((ord($str[$idx]) & 0xC0) == 0x80))
 138:         $idx--;
 139: 
 140:     return $idx;
144: }141: }
145: 142: 
146: //-------------------------------------------------------------------- 
147: /**143: /**
148: * Given a string and any byte index, returns the byte index144: * Given a string and any byte index, returns the byte index
149: * of the start of the next UTF-8 character, relative to supplied145: * of the start of the next UTF-8 character, relative to supplied
156: * @package utf8152: * @package utf8
157: * @subpackage position153: * @subpackage position
158: */154: */
159: function utf8_locate_next_chr( &$str, $idx ) {155: function utf8_locate_next_chr(&$str, $idx)
160:     156: {
161:     if ($idx <= 0) return 0;157:     if ($idx <= 0)
162:     158:         return 0;
163:     $limit = strlen($str);159: 
164:     if ($idx >= $limit) return $limit;160:     $limit = strlen($str);
165:     161:     if ($idx >= $limit)
166:     // Binary value for any byte after the first in a multi-byte UTF-8 character162:         return $limit;
167:     // will be like 10xxxxxx so & 0xC0 can be used to detect this kind 
168:     // of byte - assuming well formed UTF-8 
169:     while (($idx < $limit) && ((ord($str[$idx]) & 0xC0) == 0x80)) $idx++; 
170:      
171:     return $idx; 
172: } 
173: 163: 
 164:     // Binary value for any byte after the first in a multi-byte UTF-8 character
 165:     // will be like 10xxxxxx so & 0xC0 can be used to detect this kind
 166:     // of byte - assuming well formed UTF-8
 167:     while (($idx < $limit) && ((ord($str[$idx]) & 0xC0) == 0x80))
 168:         $idx++;
 169: 
 170:     return $idx;
 171: }


a/upload/include/utf8/utils/specials.php b/upload/include/utf8/utils/specials.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * Utilities for processing "special" characters in UTF-8. "Special" largely means anything which would  4: * Utilities for processing "special" characters in UTF-8. "Special" largely means anything which would
  4: * be regarded as a non-word character, like ASCII control characters and punctuation. This has a "Roman"  5: * be regarded as a non-word character, like ASCII control characters and punctuation. This has a "Roman"
 10: * @see utf8_is_valid 11: * @see utf8_is_valid
 11: */ 12: */
 12:  13: 
 13: //-------------------------------------------------------------------- 
 14: /** 14: /**
 15: * Used internally. Builds a PCRE pattern from the $UTF8_SPECIAL_CHARS  15: * Used internally. Builds a PCRE pattern from the $UTF8_SPECIAL_CHARS
 16: * array defined in this file 16: * array defined in this file
 17: * The $UTF8_SPECIAL_CHARS should contain all special characters (non-letter/non-digit) 17: * The $UTF8_SPECIAL_CHARS should contain all special characters (non-letter/non-digit)
 18: * defined in the various local charsets - it's not a complete list of 18: * defined in the various local charsets - it's not a complete list of
 27: * @see utf8_is_word_chars 27: * @see utf8_is_word_chars
 28: * @see utf8_strip_specials 28: * @see utf8_strip_specials
 29: */ 29: */
 30: function utf8_specials_pattern() { 30: function utf8_specials_pattern()
 31:     static $pattern = NULL; 31: {
 32:      32:     static $pattern = null;
 33:     if ( !$pattern ) { 33: 
 34:         $UTF8_SPECIAL_CHARS = array( 34:     if (!$pattern)
 35:     0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, 35:     {
 36:     0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 36:         $UTF8_SPECIAL_CHARS = array(
 37:     0x002f,         0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x005b, 37:             0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023,
 38:     0x005c, 0x005d, 0x005e,         0x0060, 0x007b, 0x007c, 0x007d, 0x007e, 38:             0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c,
 39:     0x007f, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 39:             0x002f,         0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x005b,
 40:     0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, 0x0090, 0x0091, 0x0092, 40:             0x005c, 0x005d, 0x005e,         0x0060, 0x007b, 0x007c, 0x007d, 0x007e,
 41:     0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 41:             0x007f, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088,
 42:     0x009d, 0x009e, 0x009f, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 42:             0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, 0x0090, 0x0091, 0x0092,
 43:     0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00b0, 43:             0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c,
 44:     0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 44:             0x009d, 0x009e, 0x009f, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6,
 45:     0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 0x00d7, 0x00f7, 0x02c7, 0x02d8, 0x02d9, 45:             0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00b0,
 46:     0x02da, 0x02db, 0x02dc, 0x02dd, 0x0300, 0x0301, 0x0303, 0x0309, 0x0323, 0x0384, 46:             0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba,
 47:     0x0385, 0x0387, 0x03b2, 0x03c6, 0x03d1, 0x03d2, 0x03d5, 0x03d6, 0x05b0, 0x05b1, 47:             0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 0x00d7, 0x00f7, 0x02c7, 0x02d8, 0x02d9,
 48:     0x05b2, 0x05b3, 0x05b4, 0x05b5, 0x05b6, 0x05b7, 0x05b8, 0x05b9, 0x05bb, 0x05bc, 48:             0x02da, 0x02db, 0x02dc, 0x02dd, 0x0300, 0x0301, 0x0303, 0x0309, 0x0323, 0x0384,
 49:     0x05bd, 0x05be, 0x05bf, 0x05c0, 0x05c1, 0x05c2, 0x05c3, 0x05f3, 0x05f4, 0x060c, 49:             0x0385, 0x0387, 0x03b2, 0x03c6, 0x03d1, 0x03d2, 0x03d5, 0x03d6, 0x05b0, 0x05b1,
 50:     0x061b, 0x061f, 0x0640, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, 0x0650, 0x0651, 50:             0x05b2, 0x05b3, 0x05b4, 0x05b5, 0x05b6, 0x05b7, 0x05b8, 0x05b9, 0x05bb, 0x05bc,
 51:     0x0652, 0x066a, 0x0e3f, 0x200c, 0x200d, 0x200e, 0x200f, 0x2013, 0x2014, 0x2015, 51:             0x05bd, 0x05be, 0x05bf, 0x05c0, 0x05c1, 0x05c2, 0x05c3, 0x05f3, 0x05f4, 0x060c,
 52:     0x2017, 0x2018, 0x2019, 0x201a, 0x201c, 0x201d, 0x201e, 0x2020, 0x2021, 0x2022, 52:             0x061b, 0x061f, 0x0640, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, 0x0650, 0x0651,
 53:     0x2026, 0x2030, 0x2032, 0x2033, 0x2039, 0x203a, 0x2044, 0x20a7, 0x20aa, 0x20ab, 53:             0x0652, 0x066a, 0x0e3f, 0x200c, 0x200d, 0x200e, 0x200f, 0x2013, 0x2014, 0x2015,
 54:     0x20ac, 0x2116, 0x2118, 0x2122, 0x2126, 0x2135, 0x2190, 0x2191, 0x2192, 0x2193, 54:             0x2017, 0x2018, 0x2019, 0x201a, 0x201c, 0x201d, 0x201e, 0x2020, 0x2021, 0x2022,
 55:     0x2194, 0x2195, 0x21b5, 0x21d0, 0x21d1, 0x21d2, 0x21d3, 0x21d4, 0x2200, 0x2202, 55:             0x2026, 0x2030, 0x2032, 0x2033, 0x2039, 0x203a, 0x2044, 0x20a7, 0x20aa, 0x20ab,
 56:     0x2203, 0x2205, 0x2206, 0x2207, 0x2208, 0x2209, 0x220b, 0x220f, 0x2211, 0x2212, 56:             0x20ac, 0x2116, 0x2118, 0x2122, 0x2126, 0x2135, 0x2190, 0x2191, 0x2192, 0x2193,
 57:     0x2215, 0x2217, 0x2219, 0x221a, 0x221d, 0x221e, 0x2220, 0x2227, 0x2228, 0x2229, 57:             0x2194, 0x2195, 0x21b5, 0x21d0, 0x21d1, 0x21d2, 0x21d3, 0x21d4, 0x2200, 0x2202,
 58:     0x222a, 0x222b, 0x2234, 0x223c, 0x2245, 0x2248, 0x2260, 0x2261, 0x2264, 0x2265, 58:             0x2203, 0x2205, 0x2206, 0x2207, 0x2208, 0x2209, 0x220b, 0x220f, 0x2211, 0x2212,
 59:     0x2282, 0x2283, 0x2284, 0x2286, 0x2287, 0x2295, 0x2297, 0x22a5, 0x22c5, 0x2310, 59:             0x2215, 0x2217, 0x2219, 0x221a, 0x221d, 0x221e, 0x2220, 0x2227, 0x2228, 0x2229,
 60:     0x2320, 0x2321, 0x2329, 0x232a, 0x2469, 0x2500, 0x2502, 0x250c, 0x2510, 0x2514, 60:             0x222a, 0x222b, 0x2234, 0x223c, 0x2245, 0x2248, 0x2260, 0x2261, 0x2264, 0x2265,
 61:     0x2518, 0x251c, 0x2524, 0x252c, 0x2534, 0x253c, 0x2550, 0x2551, 0x2552, 0x2553, 61:             0x2282, 0x2283, 0x2284, 0x2286, 0x2287, 0x2295, 0x2297, 0x22a5, 0x22c5, 0x2310,
 62:     0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, 62:             0x2320, 0x2321, 0x2329, 0x232a, 0x2469, 0x2500, 0x2502, 0x250c, 0x2510, 0x2514,
 63:     0x255e, 0x255f, 0x2560, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, 63:             0x2518, 0x251c, 0x2524, 0x252c, 0x2534, 0x253c, 0x2550, 0x2551, 0x2552, 0x2553,
 64:     0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590, 64:             0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d,
 65:     0x2591, 0x2592, 0x2593, 0x25a0, 0x25b2, 0x25bc, 0x25c6, 0x25ca, 0x25cf, 0x25d7, 65:             0x255e, 0x255f, 0x2560, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567,
 66:     0x2605, 0x260e, 0x261b, 0x261e, 0x2660, 0x2663, 0x2665, 0x2666, 0x2701, 0x2702, 66:             0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590,
 67:     0x2703, 0x2704, 0x2706, 0x2707, 0x2708, 0x2709, 0x270c, 0x270d, 0x270e, 0x270f, 67:             0x2591, 0x2592, 0x2593, 0x25a0, 0x25b2, 0x25bc, 0x25c6, 0x25ca, 0x25cf, 0x25d7,
 68:     0x2710, 0x2711, 0x2712, 0x2713, 0x2714, 0x2715, 0x2716, 0x2717, 0x2718, 0x2719, 68:             0x2605, 0x260e, 0x261b, 0x261e, 0x2660, 0x2663, 0x2665, 0x2666, 0x2701, 0x2702,
 69:     0x271a, 0x271b, 0x271c, 0x271d, 0x271e, 0x271f, 0x2720, 0x2721, 0x2722, 0x2723, 69:             0x2703, 0x2704, 0x2706, 0x2707, 0x2708, 0x2709, 0x270c, 0x270d, 0x270e, 0x270f,
 70:     0x2724, 0x2725, 0x2726, 0x2727, 0x2729, 0x272a, 0x272b, 0x272c, 0x272d, 0x272e, 70:             0x2710, 0x2711, 0x2712, 0x2713, 0x2714, 0x2715, 0x2716, 0x2717, 0x2718, 0x2719,
 71:     0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, 0x2738, 71:             0x271a, 0x271b, 0x271c, 0x271d, 0x271e, 0x271f, 0x2720, 0x2721, 0x2722, 0x2723,
 72:     0x2739, 0x273a, 0x273b, 0x273c, 0x273d, 0x273e, 0x273f, 0x2740, 0x2741, 0x2742, 72:             0x2724, 0x2725, 0x2726, 0x2727, 0x2729, 0x272a, 0x272b, 0x272c, 0x272d, 0x272e,
 73:     0x2743, 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x2749, 0x274a, 0x274b, 0x274d, 73:             0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, 0x2738,
 74:     0x274f, 0x2750, 0x2751, 0x2752, 0x2756, 0x2758, 0x2759, 0x275a, 0x275b, 0x275c, 74:             0x2739, 0x273a, 0x273b, 0x273c, 0x273d, 0x273e, 0x273f, 0x2740, 0x2741, 0x2742,
 75:     0x275d, 0x275e, 0x2761, 0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x277f, 75:             0x2743, 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x2749, 0x274a, 0x274b, 0x274d,
 76:     0x2789, 0x2793, 0x2794, 0x2798, 0x2799, 0x279a, 0x279b, 0x279c, 0x279d, 0x279e, 76:             0x274f, 0x2750, 0x2751, 0x2752, 0x2756, 0x2758, 0x2759, 0x275a, 0x275b, 0x275c,
 77:     0x279f, 0x27a0, 0x27a1, 0x27a2, 0x27a3, 0x27a4, 0x27a5, 0x27a6, 0x27a7, 0x27a8, 77:             0x275d, 0x275e, 0x2761, 0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x277f,
 78:     0x27a9, 0x27aa, 0x27ab, 0x27ac, 0x27ad, 0x27ae, 0x27af, 0x27b1, 0x27b2, 0x27b3, 78:             0x2789, 0x2793, 0x2794, 0x2798, 0x2799, 0x279a, 0x279b, 0x279c, 0x279d, 0x279e,
 79:     0x27b4, 0x27b5, 0x27b6, 0x27b7, 0x27b8, 0x27b9, 0x27ba, 0x27bb, 0x27bc, 0x27bd, 79:             0x279f, 0x27a0, 0x27a1, 0x27a2, 0x27a3, 0x27a4, 0x27a5, 0x27a6, 0x27a7, 0x27a8,
 80:     0x27be, 0xf6d9, 0xf6da, 0xf6db, 0xf8d7, 0xf8d8, 0xf8d9, 0xf8da, 0xf8db, 0xf8dc, 80:             0x27a9, 0x27aa, 0x27ab, 0x27ac, 0x27ad, 0x27ae, 0x27af, 0x27b1, 0x27b2, 0x27b3,
 81:     0xf8dd, 0xf8de, 0xf8df, 0xf8e0, 0xf8e1, 0xf8e2, 0xf8e3, 0xf8e4, 0xf8e5, 0xf8e6, 81:             0x27b4, 0x27b5, 0x27b6, 0x27b7, 0x27b8, 0x27b9, 0x27ba, 0x27bb, 0x27bc, 0x27bd,
 82:     0xf8e7, 0xf8e8, 0xf8e9, 0xf8ea, 0xf8eb, 0xf8ec, 0xf8ed, 0xf8ee, 0xf8ef, 0xf8f0, 82:             0x27be, 0xf6d9, 0xf6da, 0xf6db, 0xf8d7, 0xf8d8, 0xf8d9, 0xf8da, 0xf8db, 0xf8dc,
 83:     0xf8f1, 0xf8f2, 0xf8f3, 0xf8f4, 0xf8f5, 0xf8f6, 0xf8f7, 0xf8f8, 0xf8f9, 0xf8fa, 83:             0xf8dd, 0xf8de, 0xf8df, 0xf8e0, 0xf8e1, 0xf8e2, 0xf8e3, 0xf8e4, 0xf8e5, 0xf8e6,
 84:     0xf8fb, 0xf8fc, 0xf8fd, 0xf8fe, 0xfe7c, 0xfe7d, 84:             0xf8e7, 0xf8e8, 0xf8e9, 0xf8ea, 0xf8eb, 0xf8ec, 0xf8ed, 0xf8ee, 0xf8ef, 0xf8f0,
 85:             ); 85:             0xf8f1, 0xf8f2, 0xf8f3, 0xf8f4, 0xf8f5, 0xf8f6, 0xf8f7, 0xf8f8, 0xf8f9, 0xf8fa,
 86:         $pattern = preg_quote(utf8_from_unicode($UTF8_SPECIAL_CHARS), '/'); 86:             0xf8fb, 0xf8fc, 0xf8fd, 0xf8fe, 0xfe7c, 0xfe7d);
 87:         $pattern = '/[\x00-\x19'.$pattern.']/u'; 87: 
 88:     } 88:         $pattern = preg_quote(utf8_from_unicode($UTF8_SPECIAL_CHARS), '/');
 89:      89:         $pattern = '/[\x00-\x19'.$pattern.']/u';
 90:     return $pattern; 90:     }
  91: 
  92:     return $pattern;
 91: } 93: }
 92:  94: 
 93: //-------------------------------------------------------------------- 
 94: /** 95: /**
 95: * Checks a string for whether it contains only word characters. This 96: * Checks a string for whether it contains only word characters. This
 96: * is logically equivalent to the \w PCRE meta character. Note that 97: * is logically equivalent to the \w PCRE meta character. Note that
103: * @return boolean TRUE if the string only contains word characters104: * @return boolean TRUE if the string only contains word characters
104: * @see utf8_specials_pattern105: * @see utf8_specials_pattern
105: */106: */
106: function utf8_is_word_chars($str) {107: function utf8_is_word_chars($str)
107:     return !(bool)preg_match(utf8_specials_pattern(),$str);108: {
 109:     return !(bool) preg_match(utf8_specials_pattern(), $str);
108: }110: }
109: 111: 
110: //-------------------------------------------------------------------- 
111: /**112: /**
112: * Removes special characters (nonalphanumeric) from a UTF-8 string113: * Removes special characters (nonalphanumeric) from a UTF-8 string
113: * 114: *
114: * This can be useful as a helper for sanitizing a string for use as115: * This can be useful as a helper for sanitizing a string for use as
115: * something like a file name or a unique identifier. Be warned though116: * something like a file name or a unique identifier. Be warned though
116: * it does not handle all possible non-alphanumeric characters and is117: * it does not handle all possible non-alphanumeric characters and is
124: * @return string with common non-alphanumeric characters removed125: * @return string with common non-alphanumeric characters removed
125: * @see utf8_specials_pattern126: * @see utf8_specials_pattern
126: */127: */
127: function utf8_strip_specials($string, $repl=''){128: function utf8_strip_specials($string, $repl='')
128:     return preg_replace(utf8_specials_pattern(), $repl, $string);129: {
 130:     return preg_replace(utf8_specials_pattern(), $repl, $string);
129: }131: }


a/upload/include/utf8/utils/unicode.php b/upload/include/utf8/utils/unicode.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: unicode.php,v 1.2 2006/02/26 13:20:44 harryf Exp $  4: * @version $Id: unicode.php,v 1.2 2006/02/26 13:20:44 harryf Exp $
  4: * Tools for conversion between UTF-8 and unicode  5: * Tools for conversion between UTF-8 and unicode
 16: * @subpackage unicode 17: * @subpackage unicode
 17: */ 18: */
 18:  19: 
 19: //-------------------------------------------------------------------- 
 20: /** 20: /**
 21: * Takes an UTF-8 string and returns an array of ints representing the  21: * Takes an UTF-8 string and returns an array of ints representing the
 22: * Unicode characters. Astral planes are supported ie. the ints in the 22: * Unicode characters. Astral planes are supported ie. the ints in the
 23: * output can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates 23: * output can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates
 24: * are not allowed. 24: * are not allowed.
 34: * @package utf8 34: * @package utf8
 35: * @subpackage unicode 35: * @subpackage unicode
 36: */ 36: */
 37: function utf8_to_unicode($str) { 37: function utf8_to_unicode($str)
 38:     $mState = 0;     // cached expected number of octets after the current octet 38: {
 39:                      // until the beginning of the next UTF8 character sequence 39:     $mState = 0; // Cached expected number of octets after the current octet
 40:     $mUcs4  = 0;     // cached Unicode character 40:                  // until the beginning of the next UTF8 character sequence
 41:     $mBytes = 1;     // cached expected number of octets in the current sequence 41:     $mUcs4  = 0; // Cached Unicode character
 42:      42:     $mBytes = 1; // Cached expected number of octets in the current sequence
 43:     $out = array(); 43: 
 44:      44:     $out = array();
 45:     $len = strlen($str); 45:     $len = strlen($str);
 46:      46: 
 47:     for($i = 0; $i < $len; $i++) { 47:     for($i = 0; $i < $len; $i++)
 48:          48:     {
 49:         $in = ord($str{$i}); 49:         $in = ord($str{$i});
 50:          50: 
 51:         if ( $mState == 0) { 51:         if ($mState == 0)
 52:              52:         {
 53:             // When mState is zero we expect either a US-ASCII character or a 53:             // When mState is zero we expect either a US-ASCII character or a multi-octet sequence.
 54:             // multi-octet sequence. 54:             if (0 == (0x80 & ($in)))
 55:             if (0 == (0x80 & ($in))) { 55:             {
 56:                 // US-ASCII, pass straight through. 56:                 // US-ASCII, pass straight through.
 57:                 $out[] = $in; 57:                 $out[] = $in;
 58:                 $mBytes = 1; 58:                 $mBytes = 1;
 59:                  59:             }
 60:             } else if (0xC0 == (0xE0 & ($in))) { 60:             else if (0xC0 == (0xE0 & ($in)))
 61:                 // First octet of 2 octet sequence 61:             {
 62:                 $mUcs4 = ($in); 62:                 // First octet of 2 octet sequence
 63:                 $mUcs4 = ($mUcs4 & 0x1F) << 6; 63:                 $mUcs4 = ($in);
 64:                 $mState = 1; 64:                 $mUcs4 = ($mUcs4 & 0x1F) << 6;
 65:                 $mBytes = 2; 65:                 $mState = 1;
 66:                  66:                 $mBytes = 2;
 67:             } else if (0xE0 == (0xF0 & ($in))) { 67:             }
 68:                 // First octet of 3 octet sequence 68:             else if (0xE0 == (0xF0 & ($in)))
 69:                 $mUcs4 = ($in); 69:             {
 70:                 $mUcs4 = ($mUcs4 & 0x0F) << 12; 70:                 // First octet of 3 octet sequence
 71:                 $mState = 2; 71:                 $mUcs4 = ($in);
 72:                 $mBytes = 3; 72:                 $mUcs4 = ($mUcs4 & 0x0F) << 12;
 73:                  73:                 $mState = 2;
 74:             } else if (0xF0 == (0xF8 & ($in))) { 74:                 $mBytes = 3;
 75:                 // First octet of 4 octet sequence 75:             }
 76:                 $mUcs4 = ($in); 76:             else if (0xF0 == (0xF8 & ($in)))
 77:                 $mUcs4 = ($mUcs4 & 0x07) << 18; 77:             {
 78:                 $mState = 3; 78:                 // First octet of 4 octet sequence
 79:                 $mBytes = 4; 79:                 $mUcs4 = ($in);
 80:                  80:                 $mUcs4 = ($mUcs4 & 0x07) << 18;
 81:             } else if (0xF8 == (0xFC & ($in))) { 81:                 $mState = 3;
 82:                 /* First octet of 5 octet sequence. 82:                 $mBytes = 4;
 83:                 * 83:             }
 84:                 * This is illegal because the encoded codepoint must be either 84:             else if (0xF8 == (0xFC & ($in)))
 85:                 * (a) not the shortest form or 85:             {
 86:                 * (b) outside the Unicode range of 0-0x10FFFF. 86:                 /* First octet of 5 octet sequence.
 87:                 * Rather than trying to resynchronize, we will carry on until the end 87:                 *
 88:                 * of the sequence and let the later error handling code catch it. 88:                 * This is illegal because the encoded codepoint must be either
 89:                 */ 89:                 * (a) not the shortest form or
 90:                 $mUcs4 = ($in); 90:                 * (b) outside the Unicode range of 0-0x10FFFF.
 91:                 $mUcs4 = ($mUcs4 & 0x03) << 24; 91:                 * Rather than trying to resynchronize, we will carry on until the end
 92:                 $mState = 4; 92:                 * of the sequence and let the later error handling code catch it.
 93:                 $mBytes = 5; 93:                 */
 94:                  94:                 $mUcs4 = ($in);
 95:             } else if (0xFC == (0xFE & ($in))) { 95:                 $mUcs4 = ($mUcs4 & 0x03) << 24;
 96:                 // First octet of 6 octet sequence, see comments for 5 octet sequence. 96:                 $mState = 4;
 97:                 $mUcs4 = ($in); 97:                 $mBytes = 5;
 98:                 $mUcs4 = ($mUcs4 & 1) << 30; 98:             }
 99:                 $mState = 5; 99:             else if (0xFC == (0xFE & ($in)))
100:                 $mBytes = 6;100:             {
101:                 101:                 // First octet of 6 octet sequence, see comments for 5 octet sequence.
102:             } else {102:                 $mUcs4 = ($in);
103:                 /* Current octet is neither in the US-ASCII range nor a legal first103:                 $mUcs4 = ($mUcs4 & 1) << 30;
104:                  * octet of a multi-octet sequence.104:                 $mState = 5;
105:                  */105:                 $mBytes = 6;
106:                 trigger_error(106:             }
107:                         'utf8_to_unicode: Illegal sequence identifier '.107:             else
108:                             'in UTF-8 at byte '.$i,108:             {
109:                         E_USER_WARNING109:                 /* Current octet is neither in the US-ASCII range nor a legal first octet of a multi-octet sequence. */
110:                     );110:                 trigger_error('utf8_to_unicode: Illegal sequence identifier in UTF-8 at byte '.$i, E_USER_WARNING);
111:                 return FALSE;111:                 return false;
112:                 112:             }
113:             }113:         }
114:         114:         else
115:         } else {115:         {
116:             116:             // When mState is non-zero, we expect a continuation of the multi-octet sequence
117:             // When mState is non-zero, we expect a continuation of the multi-octet117:             if (0x80 == (0xC0 & ($in)))
118:             // sequence118:             {
119:             if (0x80 == (0xC0 & ($in))) {119:                 // Legal continuation.
120:                 120:                 $shift = ($mState - 1) * 6;
121:                 // Legal continuation.121:                 $tmp = $in;
122:                 $shift = ($mState - 1) * 6;122:                 $tmp = ($tmp & 0x0000003F) << $shift;
123:                 $tmp = $in;123:                 $mUcs4 |= $tmp;
124:                 $tmp = ($tmp & 0x0000003F) << $shift;124: 
125:                 $mUcs4 |= $tmp;125:                 /**
126:             126:                 * End of the multi-octet sequence. mUcs4 now contains the final
127:                 /**127:                 * Unicode codepoint to be output
128:                 * End of the multi-octet sequence. mUcs4 now contains the final128:                 */
129:                 * Unicode codepoint to be output129:                 if (0 == --$mState)
130:                 */130:                 {
131:                 if (0 == --$mState) {131:                     /*
132:                     132:                     * Check for illegal sequences and codepoints.
133:                     /*133:                     */
134:                     * Check for illegal sequences and codepoints.134:                     // From Unicode 3.1, non-shortest form is illegal
135:                     */135:                     if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || ((3 == $mBytes) && ($mUcs4 < 0x0800)) ||
136:                     // From Unicode 3.1, non-shortest form is illegal136:                     ((4 == $mBytes) && ($mUcs4 < 0x10000)) || (4 < $mBytes) ||
137:                     if (((2 == $mBytes) && ($mUcs4 < 0x0080)) ||137:                     // From Unicode 3.2, surrogate characters are illegal
138:                         ((3 == $mBytes) && ($mUcs4 < 0x0800)) ||138:                     (($mUcs4 & 0xFFFFF800) == 0xD800) ||
139:                         ((4 == $mBytes) && ($mUcs4 < 0x10000)) ||139:                     // Codepoints outside the Unicode range are illegal
140:                         (4 < $mBytes) ||140:                     ($mUcs4 > 0x10FFFF))
141:                         // From Unicode 3.2, surrogate characters are illegal141:                     {
142:                         (($mUcs4 & 0xFFFFF800) == 0xD800) ||142:                         trigger_error('utf8_to_unicode: Illegal sequence or codepoint in UTF-8 at byte '.$i, E_USER_WARNING);
143:                         // Codepoints outside the Unicode range are illegal143:                         return false;
144:                         ($mUcs4 > 0x10FFFF)) {144:                     }
145:                         145: 
146:                         trigger_error(146:                     // BOM is legal but we don't want to output it
147:                                 'utf8_to_unicode: Illegal sequence or codepoint '.147:                     if (0xFEFF != $mUcs4)
148:                                     'in UTF-8 at byte '.$i,148:                         $out[] = $mUcs4;
149:                                 E_USER_WARNING149: 
150:                             );150:                     // Initialize UTF8 cache
151:                         151:                     $mState = 0;
152:                         return FALSE;152:                     $mUcs4  = 0;
153:                         153:                     $mBytes = 1;
154:                     }154:                 }
155:                     155: 
156:                     if (0xFEFF != $mUcs4) {156:             }
157:                         // BOM is legal but we don't want to output it157:             else
158:                         $out[] = $mUcs4;158:             {
159:                     }159:                 /* ((0xC0 & (*in) != 0x80) && (mState != 0))
160:                     160:                 Incomplete multi-octet sequence. */
161:                     //initialize UTF8 cache161:                 trigger_error('utf8_to_unicode: Incomplete multi-octet sequence in UTF-8 at byte '.$i, E_USER_WARNING);
162:                     $mState = 0;162:                 return false;
163:                     $mUcs4  = 0;163:             }
164:                     $mBytes = 1;164:         }
165:                 }165:     }
166:             166: 
167:             } else {167:     return $out;
168:                 /** 
169:                 *((0xC0 & (*in) != 0x80) && (mState != 0)) 
170:                 * Incomplete multi-octet sequence. 
171:                 */ 
172:                 trigger_error( 
173:                         'utf8_to_unicode: Incomplete multi-octet '. 
174:                         '   sequence in UTF-8 at byte '.$i, 
175:                         E_USER_WARNING 
176:                     ); 
177:                  
178:                 return FALSE; 
179:             } 
180:         } 
181:     } 
182:     return $out; 
183: }168: }
184: 169: 
185: //-------------------------------------------------------------------- 
186: /**170: /**
187: * Takes an array of ints representing the Unicode characters and returns 171: * Takes an array of ints representing the Unicode characters and returns
188: * a UTF-8 string. Astral planes are supported ie. the ints in the172: * a UTF-8 string. Astral planes are supported ie. the ints in the
189: * input can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates173: * input can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates
190: * are not allowed.174: * are not allowed.
191: * Returns false if the input array contains ints that represent 175: * Returns false if the input array contains ints that represent
192: * surrogates or are outside the Unicode range176: * surrogates or are outside the Unicode range
193: * and raises a PHP error at level E_USER_WARNING177: * and raises a PHP error at level E_USER_WARNING
194: * Note: this function has been modified slightly in this library to use178: * Note: this function has been modified slightly in this library to use
202: * @package utf8186: * @package utf8
203: * @subpackage unicode187: * @subpackage unicode
204: */188: */
205: function utf8_from_unicode($arr) {189: function utf8_from_unicode($arr)
206:     ob_start();190: {
207:     191:     ob_start();
208:     foreach (array_keys($arr) as $k) {192: 
209:         193:     foreach (array_keys($arr) as $k)
210:         # ASCII range (including control chars)194:     {
211:         if ( ($arr[$k] >= 0) && ($arr[$k] <= 0x007f) ) {195:         if ( ($arr[$k] >= 0) && ($arr[$k] <= 0x007f) ) // ASCII range (including control chars)
212:             196:         {
213:             echo chr($arr[$k]);197:             echo chr($arr[$k]);
214:         198:         }
215:         # 2 byte sequence199:         else if ($arr[$k] <= 0x07ff) //2 byte sequence
216:         } else if ($arr[$k] <= 0x07ff) {200:         {
217:             201:             echo chr(0xc0 | ($arr[$k] >> 6));
218:             echo chr(0xc0 | ($arr[$k] >> 6));202:             echo chr(0x80 | ($arr[$k] & 0x003f));
219:             echo chr(0x80 | ($arr[$k] & 0x003f));203:         }
220:         204:         else if($arr[$k] == 0xFEFF) // Byte order mark (skip)
221:         # Byte order mark (skip)205:         {
222:         } else if($arr[$k] == 0xFEFF) {206:             // Nop -- zap the BOM
223:             207:         }
224:             // nop -- zap the BOM208:         else if ($arr[$k] >= 0xD800 && $arr[$k] <= 0xDFFF) // Test for illegal surrogates
225:         209:         {
226:         # Test for illegal surrogates210:             // Found a surrogate
227:         } else if ($arr[$k] >= 0xD800 && $arr[$k] <= 0xDFFF) {211:             trigger_error('utf8_from_unicode: Illegal surrogate at index: '.$k.', value: '.$arr[$k], E_USER_WARNING);
228:             212: 
229:             // found a surrogate213:             return false;
230:             trigger_error(214:         }
231:                 'utf8_from_unicode: Illegal surrogate '.215:         else if ($arr[$k] <= 0xffff) // 3 byte sequence
232:                     'at index: '.$k.', value: '.$arr[$k],216:         {
233:                 E_USER_WARNING217:             echo chr(0xe0 | ($arr[$k] >> 12));
234:                 );218:             echo chr(0x80 | (($arr[$k] >> 6) & 0x003f));
235:             219:             echo chr(0x80 | ($arr[$k] & 0x003f));
236:             return FALSE;220:         }
237:         221:         else if ($arr[$k] <= 0x10ffff) // 4 byte sequence
238:         # 3 byte sequence222:         {
239:         } else if ($arr[$k] <= 0xffff) {223:             echo chr(0xf0 | ($arr[$k] >> 18));
240:             224:             echo chr(0x80 | (($arr[$k] >> 12) & 0x3f));
241:             echo chr(0xe0 | ($arr[$k] >> 12));225:             echo chr(0x80 | (($arr[$k] >> 6) & 0x3f));
242:             echo chr(0x80 | (($arr[$k] >> 6) & 0x003f));226:             echo chr(0x80 | ($arr[$k] & 0x3f));
243:             echo chr(0x80 | ($arr[$k] & 0x003f));227:         }
244:         228:         else
245:         # 4 byte sequence229:         {
246:         } else if ($arr[$k] <= 0x10ffff) {230:             trigger_error('utf8_from_unicode: Codepoint out of Unicode range at index: '.$k.', value: '.$arr[$k], E_USER_WARNING);
247:             231: 
248:             echo chr(0xf0 | ($arr[$k] >> 18));232:             // Out of range
249:             echo chr(0x80 | (($arr[$k] >> 12) & 0x3f));233:             return false;
250:             echo chr(0x80 | (($arr[$k] >> 6) & 0x3f));234:         }
251:             echo chr(0x80 | ($arr[$k] & 0x3f));235:     }
252:             236: 
253:         } else {237:     $result = ob_get_contents();
254:             238:     ob_end_clean();
255:             trigger_error(239:     return $result;
256:                 'utf8_from_unicode: Codepoint out of Unicode range '. 
257:                     'at index: '.$k.', value: '.$arr[$k], 
258:                 E_USER_WARNING 
259:                 ); 
260:              
261:             // out of range 
262:             return FALSE; 
263:         } 
264:     } 
265:      
266:     $result = ob_get_contents(); 
267:     ob_end_clean(); 
268:     return $result; 
269: }240: }


a/upload/include/utf8/utils/validation.php b/upload/include/utf8/utils/validation.php
  1: <?php  1: <?php
   2: 
  2: /**  3: /**
  3: * @version $Id: validation.php,v 1.2 2006/02/26 13:20:44 harryf Exp $  4: * @version $Id: validation.php,v 1.2 2006/02/26 13:20:44 harryf Exp $
  4: * Tools for validing a UTF-8 string is well formed.  5: * Tools for validing a UTF-8 string is well formed.
 16: * @subpackage validation 17: * @subpackage validation
 17: */ 18: */
 18:  19: 
 19: //-------------------------------------------------------------------- 
 20: /** 20: /**
 21: * Tests a string as to whether it's valid UTF-8 and supported by the 21: * Tests a string as to whether it's valid UTF-8 and supported by the
 22: * Unicode standard 22: * Unicode standard
 29: * @package utf8 29: * @package utf8
 30: * @subpackage validation 30: * @subpackage validation
 31: */ 31: */
 32: function utf8_is_valid($str) { 32: function utf8_is_valid($str)
 33:      33: {
 34:     $mState = 0;     // cached expected number of octets after the current octet 34:     $mState = 0;     // Cached expected number of octets after the current octet
 35:                      // until the beginning of the next UTF8 character sequence 35:                      // until the beginning of the next UTF8 character sequence
 36:     $mUcs4  = 0;     // cached Unicode character 36:     $mUcs4  = 0;     // Cached Unicode character
 37:     $mBytes = 1;     // cached expected number of octets in the current sequence 37:     $mBytes = 1;     // Cached expected number of octets in the current sequence
 38:      38: 
 39:     $len = strlen($str); 39:     $len = strlen($str);
 40:      40: 
 41:     for($i = 0; $i < $len; $i++) { 41:     for($i = 0; $i < $len; $i++)
 42:          42:     {
 43:         $in = ord($str{$i}); 43:         $in = ord($str{$i});
 44:          44: 
 45:         if ( $mState == 0) { 45:         if ( $mState == 0)
 46:              46:         {
 47:             // When mState is zero we expect either a US-ASCII character or a 47:             // When mState is zero we expect either a US-ASCII character or a multi-octet sequence.
 48:             // multi-octet sequence. 48:             if (0 == (0x80 & ($in)))
 49:             if (0 == (0x80 & ($in))) { 49:             {
 50:                 // US-ASCII, pass straight through. 50:                 $mBytes = 1; // US-ASCII, pass straight through
 51:                 $mBytes = 1; 51:             }
 52:                  52:             else if (0xC0 == (0xE0 & ($in)))
 53:             } else if (0xC0 == (0xE0 & ($in))) { 53:             {
 54:                 // First octet of 2 octet sequence 54:                 // First octet of 2 octet sequence
 55:                 $mUcs4 = ($in); 55:                 $mUcs4 = ($in);
 56:                 $mUcs4 = ($mUcs4 & 0x1F) << 6; 56:                 $mUcs4 = ($mUcs4 & 0x1F) << 6;
 57:                 $mState = 1; 57:                 $mState = 1;
 58:                 $mBytes = 2; 58:                 $mBytes = 2;
 59:                  59:             }
 60:             } else if (0xE0 == (0xF0 & ($in))) { 60:             else if (0xE0 == (0xF0 & ($in)))
 61:                 // First octet of 3 octet sequence 61:             {
 62:                 $mUcs4 = ($in); 62:                 // First octet of 3 octet sequence
 63:                 $mUcs4 = ($mUcs4 & 0x0F) << 12; 63:                 $mUcs4 = ($in);
 64:                 $mState = 2; 64:                 $mUcs4 = ($mUcs4 & 0x0F) << 12;
 65:                 $mBytes = 3; 65:                 $mState = 2;
 66:                  66:                 $mBytes = 3;
 67:             } else if (0xF0 == (0xF8 & ($in))) { 67:             }
 68:                 // First octet of 4 octet sequence 68:             else if (0xF0 == (0xF8 & ($in)))
 69:                 $mUcs4 = ($in); 69:             {
 70:                 $mUcs4 = ($mUcs4 & 0x07) << 18; 70:                 // First octet of 4 octet sequence
 71:                 $mState = 3; 71:                 $mUcs4 = ($in);
 72:                 $mBytes = 4; 72:                 $mUcs4 = ($mUcs4 & 0x07) << 18;
 73:                  73:                 $mState = 3;
 74:             } else if (0xF8 == (0xFC & ($in))) { 74:                 $mBytes = 4;
 75:                 /* First octet of 5 octet sequence. 75:             }
 76:                 * 76:             else if (0xF8 == (0xFC & ($in)))
 77:                 * This is illegal because the encoded codepoint must be either 77:             {
 78:                 * (a) not the shortest form or 78:                 /* First octet of 5 octet sequence.
 79:                 * (b) outside the Unicode range of 0-0x10FFFF. 79:                 *
 80:                 * Rather than trying to resynchronize, we will carry on until the end 80:                 * This is illegal because the encoded codepoint must be either
 81:                 * of the sequence and let the later error handling code catch it. 81:                 * (a) not the shortest form or
 82:                 */ 82:                 * (b) outside the Unicode range of 0-0x10FFFF.
 83:                 $mUcs4 = ($in); 83:                 * Rather than trying to resynchronize, we will carry on until the end
 84:                 $mUcs4 = ($mUcs4 & 0x03) << 24; 84:                 * of the sequence and let the later error handling code catch it.
 85:                 $mState = 4; 85:                 */
 86:                 $mBytes = 5; 86:                 $mUcs4 = ($in);
 87:                  87:                 $mUcs4 = ($mUcs4 & 0x03) << 24;
 88:             } else if (0xFC == (0xFE & ($in))) { 88:                 $mState = 4;
 89:                 // First octet of 6 octet sequence, see comments for 5 octet sequence. 89:                 $mBytes = 5;
 90:                 $mUcs4 = ($in); 90:             }
 91:                 $mUcs4 = ($mUcs4 & 1) << 30; 91:             else if (0xFC == (0xFE & ($in)))
 92:                 $mState = 5; 92:             {
 93:                 $mBytes = 6; 93:                 // First octet of 6 octet sequence, see comments for 5 octet sequence.
 94:                  94:                 $mUcs4 = ($in);
 95:             } else { 95:                 $mUcs4 = ($mUcs4 & 1) << 30;
 96:                 /* Current octet is neither in the US-ASCII range nor a legal first 96:                 $mState = 5;
 97:                  * octet of a multi-octet sequence. 97:                 $mBytes = 6;
 98:                  */ 98:             }
 99:                 return FALSE; 99:             else
100:                 100:             {
101:             }101:                 // Current octet is neither in the US-ASCII range nor a legal first octet of a multi-octet sequence.
102:         102:                 return false;
103:         } else {103:             }
104:             104:         }
105:             // When mState is non-zero, we expect a continuation of the multi-octet105:         else
106:             // sequence106:         {
107:             if (0x80 == (0xC0 & ($in))) {107:             // When mState is non-zero, we expect a continuation of the multi-octet sequence
108:                 108:             if (0x80 == (0xC0 & ($in)))
109:                 // Legal continuation.109:             {
110:                 $shift = ($mState - 1) * 6;110:                 // Legal continuation.
111:                 $tmp = $in;111:                 $shift = ($mState - 1) * 6;
112:                 $tmp = ($tmp & 0x0000003F) << $shift;112:                 $tmp = $in;
113:                 $mUcs4 |= $tmp;113:                 $tmp = ($tmp & 0x0000003F) << $shift;
114:             114:                 $mUcs4 |= $tmp;
115:                 /**115: 
116:                 * End of the multi-octet sequence. mUcs4 now contains the final116:                 /**
117:                 * Unicode codepoint to be output117:                 * End of the multi-octet sequence. mUcs4 now contains the final
118:                 */118:                 * Unicode codepoint to be output
119:                 if (0 == --$mState) {119:                 */
120:                     120:                 if (0 == --$mState)
121:                     /*121:                 {
122:                     * Check for illegal sequences and codepoints.122:                     /*
123:                     */123:                     * Check for illegal sequences and codepoints.
124:                     // From Unicode 3.1, non-shortest form is illegal124:                     */
125:                     if (((2 == $mBytes) && ($mUcs4 < 0x0080)) ||125:                     // From Unicode 3.1, non-shortest form is illegal
126:                         ((3 == $mBytes) && ($mUcs4 < 0x0800)) ||126:                     if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || ((3 == $mBytes) && ($mUcs4 < 0x0800)) ||
127:                         ((4 == $mBytes) && ($mUcs4 < 0x10000)) ||127:                     ((4 == $mBytes) && ($mUcs4 < 0x10000)) || (4 < $mBytes) ||
128:                         (4 < $mBytes) ||128:                     // From Unicode 3.2, surrogate characters are illegal
129:                         // From Unicode 3.2, surrogate characters are illegal129:                     (($mUcs4 & 0xFFFFF800) == 0xD800) ||
130:                         (($mUcs4 & 0xFFFFF800) == 0xD800) ||130:                     // Codepoints outside the Unicode range are illegal
131:                         // Codepoints outside the Unicode range are illegal131:                     ($mUcs4 > 0x10FFFF))
132:                         ($mUcs4 > 0x10FFFF)) {132:                     {
133:                         133:                         return FALSE;
134:                         return FALSE;134:                     }
135:                         135: 
136:                     }136:                     // Initialize UTF8 cache
137:                     137:                     $mState = 0;
138:                     //initialize UTF8 cache138:                     $mUcs4  = 0;
139:                     $mState = 0;139:                     $mBytes = 1;
140:                     $mUcs4  = 0;140:                 }
141:                     $mBytes = 1;141:             }
142:                 }142:             else
143:             143:             {
144:             } else {144:                 /**
145:                 /**145:                 *((0xC0 & (*in) != 0x80) && (mState != 0))
146:                 *((0xC0 & (*in) != 0x80) && (mState != 0))146:                 * Incomplete multi-octet sequence.
147:                 * Incomplete multi-octet sequence.147:                 */
148:                 */148: 
149:                 149:                 return false;
150:                 return FALSE;150:             }
151:             }151:         }
152:         }152:     }
153:     }153: 
154:     return TRUE;154:     return true;
155: }155: }
156: 156: 
157: //-------------------------------------------------------------------- 
158: /**157: /**
159: * Tests whether a string complies as UTF-8. This will be much158: * Tests whether a string complies as UTF-8. This will be much
160: * faster than utf8_is_valid but will pass five and six octet159: * faster than utf8_is_valid but will pass five and six octet
172: * @package utf8171: * @package utf8
173: * @subpackage validation172: * @subpackage validation
174: */173: */
175: function utf8_compliant($str) {174: function utf8_compliant($str)
176:     if ( strlen($str) == 0 ) {175: {
177:         return TRUE;176:     if (strlen($str) == 0)
178:     }177:         return true;
179:     // If even just the first character can be matched, when the /u 
180:     // modifier is used, then it's valid UTF-8. If the UTF-8 is somehow 
181:     // invalid, nothing at all will match, even if the string contains 
182:     // some valid sequences 
183:     return (preg_match('/^.{1}/us',$str,$ar) == 1); 
184: } 
185: 178: 
 179:     // If even just the first character can be matched, when the /u
 180:     // modifier is used, then it's valid UTF-8. If the UTF-8 is somehow
 181:     // invalid, nothing at all will match, even if the string contains
 182:     // some valid sequences
 183:     return (preg_match('/^.{1}/us', $str, $ar) == 1);
 184: }


a/upload/index.php b/upload/index.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: define('PUN_ROOT', './'); 11: define('PUN_ROOT', './');
 27: require PUN_ROOT.'include/common.php'; 12: require PUN_ROOT.'include/common.php';
 59: { 44: {
 60:     $moderators = ''; 45:     $moderators = '';
 61:  46: 
 62:     if ($cur_forum['cid'] != $cur_category)    // A new category since last iteration? 47:     if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
 63:     { 48:     {
 64:         if ($cur_category != 0) 49:         if ($cur_category != 0)
 65:             echo "\t\t\t".'</tbody>'."\n\t\t\t".'</table>'."\n\t\t".'</div>'."\n\t".'</div>'."\n".'</div>'."\n\n"; 50:             echo "\t\t\t".'</tbody>'."\n\t\t\t".'</table>'."\n\t\t".'</div>'."\n\t".'</div>'."\n".'</div>'."\n\n";
127:         $forum_field .= "\n\t\t\t\t\t\t\t\t".$cur_forum['forum_desc'];112:         $forum_field .= "\n\t\t\t\t\t\t\t\t".$cur_forum['forum_desc'];
128: 113: 
129: 114: 
130:     // If there is a last_post/last_poster.115:     // If there is a last_post/last_poster
131:     if ($cur_forum['last_post'] != '')116:     if ($cur_forum['last_post'] != '')
132:         $last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.format_time($cur_forum['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>';117:         $last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.format_time($cur_forum['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>';
133:     else118:     else
146:                 $moderators[] = pun_htmlspecialchars($mod_username);131:                 $moderators[] = pun_htmlspecialchars($mod_username);
147:         }132:         }
148: 133: 
149:         $moderators = "\t\t\t\t\t\t\t\t".'<p><em>('.$lang_common['Moderated by'].'</em> '.implode(', ', $moderators).')</p>'."\n";134:         $moderators = "\t\t\t\t\t\t\t\t".'<p class="modlist"><em>('.$lang_common['Moderated by'].'</em> '.implode(', ', $moderators).')</p>'."\n";
150:     }135:     }
151: 136: 
152: ?>137: ?>
153:                  <tr<?php if ($item_status != '') echo ' class="'.$item_status.'"'; ?>>138:                 <tr<?php if ($item_status != '') echo ' class="'.$item_status.'"'; ?>>
154:                     <td class="tcl">139:                     <td class="tcl">
155:                         <div class="intd">140:                         <div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo $icon_text ?></div></div>
156:                             <div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo $icon_text ?></div></div>141:                         <div class="tclcon">
157:                             <div class="tclcon">142:                             <div>
158:                                 <?php echo $forum_field."\n".$moderators ?>143:                                 <?php echo $forum_field."\n".$moderators ?>
159:                             </div>144:                             </div>
160:                         </div>145:                         </div>
230: 215: 
231: 216: 
232:     if ($num_users > 0)217:     if ($num_users > 0)
233:         echo "\t\t\t".'<dl id="onlinelist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online'].':&nbsp;</strong></dt>'."\t\t\t\t".implode(',</dd> ', $users).'</dd>'."\n\t\t\t".'</dl>'."\n";218:         echo "\t\t\t".'<dl id="onlinelist" class="clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online'].':&nbsp;</strong></dt>'."\t\t\t\t".implode(',</dd> ', $users).'</dd>'."\n\t\t\t".'</dl>'."\n";
234:     else219:     else
235:         echo "\t\t\t".'<div class="clearer"></div>'."\n";220:         echo "\t\t\t".'<div class="clearer"></div>'."\n";
236: 221: 


a/upload/install.php b/upload/install.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: // The FluxBB version this script installs 11: // The FluxBB version this script installs
 27: define('FORUM_VERSION', '1.4'); 12: define('FORUM_VERSION', '1.4-rc1');
 28: define('FORUM_DB_REVISION', 0); 13: define('FORUM_DB_REVISION', 2);
 29:  14: 
 30:  15: 
 31: define('PUN_ROOT', './'); 16: define('PUN_ROOT', './');
  17: 
 32: if (file_exists(PUN_ROOT.'config.php')) 18: if (file_exists(PUN_ROOT.'config.php'))
 33:     exit('The file \'config.php\' already exists which would mean that FluxBB is already installed. You should go <a href="index.php">here</a> instead.'); 19: {
  20:     // Check to see whether FluxBB is already installed
  21:     include PUN_ROOT.'config.php';
  22: 
  23:     // If we have the 1.3-legacy constant defined, define the proper 1.4 constant so we don't get an incorrect "need to install" message
  24:     if (defined('FORUM'))
  25:         define('PUN', FORUM);
  26: 
  27:     // If PUN is defined, config.php is probably valid and thus the software is installed
  28:     if (defined('PUN'))
  29:         exit('It seems like FluxBB is already installed. You should go <a href="index.php">here</a> instead.');
  30: }
 34:  31: 
 35:  32: 
 36: // Make sure we are running at least PHP 4.1.0 33: // Make sure we are running at least PHP 4.1.0
 97:     if (function_exists('mysql_connect')) 94:     if (function_exists('mysql_connect'))
 98:     { 95:     {
 99:         $db_extensions[] = array('mysql', 'MySQL Standard'); 96:         $db_extensions[] = array('mysql', 'MySQL Standard');
100:         $db_extensions[] = array('mysql_innodb', 'MySQL (InnoDB)'); 97:         $db_extensions[] = array('mysql_innodb', 'MySQL Standard (InnoDB)');
101:         $mysql_innodb = true; 98:         $mysql_innodb = true;
102:  99: 
103:         if (count($db_extensions) > 2)100:         if (count($db_extensions) > 2)
120: <title>FluxBB Installation</title>117: <title>FluxBB Installation</title>
121: <link rel="stylesheet" type="text/css" href="style/Oxygen.css" />118: <link rel="stylesheet" type="text/css" href="style/Oxygen.css" />
122: <script type="text/javascript">119: <script type="text/javascript">
123: <!-- 
124: function process_form(the_form)120: function process_form(the_form)
125: {121: {
126:     var element_names = new Object()122:     var element_names = new Object()
131:     element_names["req_username"] = "Administrator username"127:     element_names["req_username"] = "Administrator username"
132:     element_names["req_password1"] = "Administrator password 1"128:     element_names["req_password1"] = "Administrator password 1"
133:     element_names["req_password2"] = "Administrator password 2"129:     element_names["req_password2"] = "Administrator password 2"
134:     element_names["req_email"] = "Administrator's e-mail"130:     element_names["req_email"] = "Administrator's email"
135:     element_names["req_base_url"] = "Base URL"131:     element_names["req_base_url"] = "Base URL"
136: 132: 
137:     if (document.all || document.getElementById)133:     if (document.all || document.getElementById)
153: 149: 
154:     return true150:     return true
155: }151: }
156: // --> 
157: </script>152: </script>
158: </head>153: </head>
159: <body onload="document.getElementById('install').req_db_type.focus()">154: <body onload="document.getElementById('install').req_db_type.focus()">
165:     <h2><span>FluxBB Installation</span></h2>160:     <h2><span>FluxBB Installation</span></h2>
166:     <div class="box">161:     <div class="box">
167:         <div class="inbox">162:         <div class="inbox">
168:             <p>Welcome to FluxBB installation! You are about to install FluxBB. In order to install FluxBB you must complete the form set out below. If you encounter any difficulties with the installation, please refer to the documentation.</p>163:             <p>Welcome to FluxBB installation! You are about to install FluxBB. In order to install FluxBB, you must complete the form set out below. If you encounter any difficulties with the installation, please refer to the documentation.</p>
169:         </div>164:         </div>
170:     </div>165:     </div>
171: </div>166: </div>
210:             </div>205:             </div>
211:             <div class="inform">206:             <div class="inform">
212:                 <fieldset>207:                 <fieldset>
213:                     <legend>Enter then name of your database</legend>208:                     <legend>Enter the name of your database</legend>
214:                     <div class="infldset">209:                     <div class="infldset">
215:                         <p>The name of the database that FluxBB will be installed into. The database must exist. For SQLite, this is the relative path to the database file. If the SQLite database file does not exist, FluxBB will attempt to create it.</p>210:                         <p>The name of the database that FluxBB will be installed into. The database must exist. For SQLite, this is the relative path to the database file. If the SQLite database file does not exist, FluxBB will attempt to create it.</p>
216:                         <label for="req_db_name"><strong>Database name</strong><br /><input id="req_db_name" type="text" name="req_db_name" size="30" maxlength="50" /><br /></label>211:                         <label for="req_db_name"><strong>Database name</strong><br /><input id="req_db_name" type="text" name="req_db_name" size="30" maxlength="50" /><br /></label>
232:                 <fieldset>227:                 <fieldset>
233:                     <legend>Enter database table prefix</legend>228:                     <legend>Enter database table prefix</legend>
234:                     <div class="infldset">229:                     <div class="infldset">
235:                         <p>If you like you can specify a table prefix. This way you can run multiple copies of FluxBB in the same database (example: foo_).</p>230:                         <p>If you like, you can specify a table prefix. This way you can run multiple copies of FluxBB in the same database (example: foo_).</p>
236:                         <label>Table prefix<br /><input id="db_prefix" type="text" name="db_prefix" size="20" maxlength="30" /><br /></label>231:                         <label>Table prefix<br /><input id="db_prefix" type="text" name="db_prefix" size="20" maxlength="30" /><br /></label>
237:                     </div>232:                     </div>
238:                 </fieldset>233:                 </fieldset>
243:                     <p>Please enter the requested information in order to setup an administrator for your FluxBB installation</p>238:                     <p>Please enter the requested information in order to setup an administrator for your FluxBB installation</p>
244:                 </div>239:                 </div>
245:                 <fieldset>240:                 <fieldset>
246:                     <legend>Enter Administrators username</legend>241:                     <legend>Enter Administrator's username</legend>
247:                     <div class="infldset">242:                     <div class="infldset">
248:                         <p>The username of the forum administrator. You can later create more administrators and moderators. Usernames can be between 2 and 25 characters long.</p>243:                         <p>The username of the forum administrator. You can later create more administrators and moderators. Usernames can be between 2 and 25 characters long.</p>
249:                         <label><strong>Administrator username</strong><br /><input type="text" name="req_username" size="25" maxlength="25" /><br /></label>244:                         <label><strong>Administrator's username</strong><br /><input type="text" name="req_username" size="25" maxlength="25" /><br /></label>
250:                     </div>245:                     </div>
251:                 </fieldset>246:                 </fieldset>
252:             </div>247:             </div>
253:             <div class="inform">248:             <div class="inform">
254:                 <fieldset>249:                 <fieldset>
255:                     <legend>Enter and confirm Administrator password</legend>250:                     <legend>Enter and confirm Administrator's password</legend>
256:                     <div class="infldset">251:                     <div class="infldset">
257:                     <p>Passwords can be between 4 and 16 characters long. Passwords are case sensitive.</p>252:                     <p>Passwords can be between 4 and 16 characters long. Passwords are case sensitive.</p>
258:                         <label class="conl"><strong>Password</strong><br /><input id="req_password1" type="password" name="req_password1" size="16" maxlength="16" /><br /></label>253:                         <label class="conl"><strong>Password</strong><br /><input id="req_password1" type="password" name="req_password1" size="16" maxlength="16" /><br /></label>
263:             </div>258:             </div>
264:             <div class="inform">259:             <div class="inform">
265:                 <fieldset>260:                 <fieldset>
266:                     <legend>Enter Administrator's e-mail</legend>261:                     <legend>Enter Administrator's email</legend>
267:                     <div class="infldset">262:                     <div class="infldset">
268:                         <p>The e-mail address of the forum administrator.</p>263:                         <p>The email address of the forum administrator.</p>
269:                         <label for="req_email"><strong>Administrator's e-mail</strong><br /><input id="req_email" type="text" name="req_email" size="50" maxlength="50" /><br /></label>264:                         <label for="req_email"><strong>Administrator's email</strong><br /><input id="req_email" type="text" name="req_email" size="50" maxlength="50" /><br /></label>
270:                     </div>265:                     </div>
271:                 </fieldset>266:                 </fieldset>
272:             </div>267:             </div>
274:                 <fieldset>269:                 <fieldset>
275:                     <legend>Enter the Base URL of your FluxBB installation</legend>270:                     <legend>Enter the Base URL of your FluxBB installation</legend>
276:                     <div class="infldset">271:                     <div class="infldset">
277:                         <p>The URL (without trailing slash) of your FluxBB forum (example: http://forum.myhost.com or http://myhost.com/~myuser). This <strong>must</strong> be correct or administrators and moderators will not be able to submit any forms. Please note that the preset value below is just an educated guess by FluxBB.</p>272:                         <p>The URL (without trailing slash) of your FluxBB forum (example: http://forum.myhost.com or http://myhost.com/~myuser). This <strong>must</strong> be correct, otherwise, administrators and moderators will not be able to submit any forms. Please note that the preset value below is just an educated guess by FluxBB.</p>
278:                         <label><strong>Base URL</strong><br /><input type="text" name="req_base_url" value="http://<?php echo $_SERVER['SERVER_NAME'].str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])) ?>" size="60" maxlength="100" /><br /></label>273:                         <label><strong>Base URL</strong><br /><input type="text" name="req_base_url" value="http://<?php echo $_SERVER['SERVER_NAME'].str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])) ?>" size="60" maxlength="100" /><br /></label>
279:                     </div>274:                     </div>
280:                 </fieldset>275:                 </fieldset>
281:             </div>276:             </div>
282:             <p><input type="submit" name="start" value="Start install" /></p>277:             <p class="buttons"><input type="submit" name="start" value="Start install" /></p>
283:         </form>278:         </form>
284:     </div>279:     </div>
285: </div>280: </div>
295: else290: else
296: {291: {
297:     //292:     //
298:     // Strip slashes only if magic_quotes_gpc is on.293:     // Strip slashes only if magic_quotes_gpc is on
299:     //294:     //
300:     function unescape($str)295:     function unescape($str)
301:     {296:     {
336:         error('Usernames may not contain any of the text formatting tags (BBCode) that the forum uses. Please go back and correct.');331:         error('Usernames may not contain any of the text formatting tags (BBCode) that the forum uses. Please go back and correct.');
337: 332: 
338:     if (strlen($email) > 80 || !preg_match('/^(([^<>()[\]\\.,;:\s@"\']+(\.[^<>()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email))333:     if (strlen($email) > 80 || !preg_match('/^(([^<>()[\]\\.,;:\s@"\']+(\.[^<>()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email))
339:         error('The administrator e-mail address you entered is invalid. Please go back and correct.');334:         error('The administrator email address you entered is invalid. Please go back and correct.');
340: 335: 
341: 336: 
342:     // Load the appropriate DB layer class337:     // Load the appropriate DB layer class
402:         error('A table called "'.$db_prefix.'users" is already present in the database "'.$db_name.'". This could mean that FluxBB is already installed or that another piece of software is installed and is occupying one or more of the table names FluxBB requires. If you want to install multiple copies of FluxBB in the same database, you must choose a different table prefix.');397:         error('A table called "'.$db_prefix.'users" is already present in the database "'.$db_name.'". This could mean that FluxBB is already installed or that another piece of software is installed and is occupying one or more of the table names FluxBB requires. If you want to install multiple copies of FluxBB in the same database, you must choose a different table prefix.');
403: 398: 
404:     // Check if InnoDB is available399:     // Check if InnoDB is available
405:      if ($db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')400:     if ($db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
406:      {401:     {
407:         $result = $db->query('SHOW VARIABLES LIKE \'have_innodb\'');402:         $result = $db->query('SHOW VARIABLES LIKE \'have_innodb\'');
408:         list (, $result) = $db->fetch_row($result);403:         list (, $result) = $db->fetch_row($result);
409:         if ((strtoupper($result) != 'YES'))404:         if ((strtoupper($result) != 'YES'))
410:             error('InnoDB does not seem to be enabled. Please choose a database layer that does not have InnoDB support, or enable InnoDB on your MySQL server.');405:             error('InnoDB does not seem to be enabled. Please choose a database layer that does not have InnoDB support, or enable InnoDB on your MySQL server.');
411:      }406:     }
412: 407: 
413: 408: 
414:     // Start a transaction409:     // Start a transaction
1237:                 'default'        => '0'1232:                 'default'        => '0'
1238:             ),1233:             ),
1239:             'time_format'        => array(1234:             'time_format'        => array(
1240:                 'datatype'        => 'INT(10) UNSIGNED',1235:                 'datatype'        => 'TINYINT(1)',
1241:                 'allow_null'    => false,1236:                 'allow_null'    => false,
1242:                 'default'        => '0'1237:                 'default'        => '0'
1243:             ),1238:             ),
1244:             'date_format'        => array(1239:             'date_format'        => array(
1245:                 'datatype'        => 'INT(10) UNSIGNED',1240:                 'datatype'        => 'TINYINT(1)',
1246:                 'allow_null'    => false,1241:                 'allow_null'    => false,
1247:                 'default'        => '0'1242:                 'default'        => '0'
1248:             ),1243:             ),
1340:         'o_cur_version'                => "'".FORUM_VERSION."'",1335:         'o_cur_version'                => "'".FORUM_VERSION."'",
1341:         'o_database_revision'        => "'".FORUM_DB_REVISION."'",1336:         'o_database_revision'        => "'".FORUM_DB_REVISION."'",
1342:         'o_board_title'                => "'My FluxBB forum'",1337:         'o_board_title'                => "'My FluxBB forum'",
1343:         'o_board_desc'                => "'Unfortunately no one can be told what FluxBB is - you have to see it for yourself.'",1338:         'o_board_desc'                => "'<p><span>Unfortunately no one can be told what FluxBB is - you have to see it for yourself.</span></p>'",
1344:         'o_default_timezone'        => "'0'",1339:         'o_default_timezone'        => "'0'",
1345:         'o_time_format'                => "'H:i:s'",1340:         'o_time_format'                => "'H:i:s'",
1346:         'o_date_format'                => "'Y-m-d'",1341:         'o_date_format'                => "'Y-m-d'",
1457:     // Add some random bytes at the end of the cookie name to prevent collisions1452:     // Add some random bytes at the end of the cookie name to prevent collisions
1458:     $cookie_name = 'pun_cookie_'.random_key(6, false, true);1453:     $cookie_name = 'pun_cookie_'.random_key(6, false, true);
1459: 1454: 
1460:     /// Generate the config.php file data1455:     // Generate the config.php file data
1461:     $config = generate_config_file();1456:     $config = generate_config_file();
1462: 1457: 
1463:     // Attempt to write config.php and serve it up for download if writing fails1458:     // Attempt to write config.php and serve it up for download if writing fails


a/upload/lang/English/common.php b/upload/lang/English/common.php
 28: $lang_common = array( 28: $lang_common = array(
 29:  29: 
 30: // Text orientation and encoding 30: // Text orientation and encoding
 31: 'lang_direction'                                  =>        'ltr', // ltr (Left-To-Right) or rtl (Right-To-Left) 31: 'lang_direction'                    =>    'ltr', // ltr (Left-To-Right) or rtl (Right-To-Left)
  32: 'lang_identifier'                    =>    'en',
 32:  33: 
 33: // Number formatting 34: // Number formatting
 34: 'lang_decimal_point'                              =>        '.', 35: 'lang_decimal_point'                =>    '.',
 35: 'lang_thousands_sep'                              =>        ',', 36: 'lang_thousands_sep'                =>    ',',
 36:  37: 
 37: // Notices 38: // Notices
 38: 'Bad request'                                     =>        'Bad request. The link you followed is incorrect or outdated.', 39: 'Bad request'                        =>    'Bad request. The link you followed is incorrect or outdated.',
 39: 'No view'                                         =>        'You do not have permission to view these forums.', 40: 'No view'                            =>    'You do not have permission to view these forums.',
 40: 'No permission'                                   =>        'You do not have permission to access this page.', 41: 'No permission'                        =>    'You do not have permission to access this page.',
 41: 'Bad referrer'                                    =>        'Bad HTTP_REFERER. You were referred to this page from an unauthorized source. If the problem persists please make sure that \'Base URL\' is correctly set in Admin/Options and that you are visiting the forum by navigating to that URL. More information regarding the referrer check can be found in the FluxBB documentation.', 42: 'Bad referrer'                        =>    'Bad HTTP_REFERER. You were referred to this page from an unauthorized source. If the problem persists please make sure that \'Base URL\' is correctly set in Admin/Options and that you are visiting the forum by navigating to that URL. More information regarding the referrer check can be found in the FluxBB documentation.',
  43: 'No cookie'                            =>    'You appear to have logged in successfully, however a cookie has not been set. Please check your settings and if applicable, enable cookies for this website.',
 42:  44: 
 43: // Topic/forum indicators 45: // Topic/forum indicators
 44: 'New icon'                                        =>        'There are new posts', 46: 'New icon'                            =>    'There are new posts',
 45: 'Normal icon'                                     =>        '<!-- -->', 47: 'Normal icon'                        =>    '<!-- -->',
 46: 'Closed icon'                                     =>        'This topic is closed', 48: 'Closed icon'                        =>    'This topic is closed',
 47: 'Redirect icon'                                   =>        'Redirected forum', 49: 'Redirect icon'                        =>    'Redirected forum',
 48:  50: 
 49: // Miscellaneous 51: // Miscellaneous
 50: 'Announcement'                                    =>        'Announcement', 52: 'Announcement'                        =>    'Announcement',
 51: 'Options'                                         =>        'Options', 53: 'Options'                            =>    'Options',
 52: 'Actions'                                         =>        'Actions', 54: 'Submit'                            =>    'Submit', // "Name" of submit buttons
 53: 'Submit'                                          =>        'Submit', // "Name" of submit buttons 55: 'Ban message'                        =>    'You are banned from this forum.',
 54: 'Ban message'                                     =>        'You are banned from this forum.', 56: 'Ban message 2'                        =>    'The ban expires at the end of',
 55: 'Ban message 2'                                   =>        'The ban expires at the end of', 57: 'Ban message 3'                        =>    'The administrator or moderator that banned you left the following message:',
 56: 'Ban message 3'                                   =>        'The administrator or moderator that banned you left the following message:', 58: 'Ban message 4'                        =>    'Please direct any inquiries to the forum administrator at',
 57: 'Ban message 4'                                   =>        'Please direct any inquiries to the forum administrator at', 59: 'Never'                                =>    'Never',
 58: 'Never'                                           =>        'Never', 60: 'Today'                                =>    'Today',
 59: 'Today'                                           =>        'Today', 61: 'Yesterday'                            =>    'Yesterday',
 60: 'Yesterday'                                       =>        'Yesterday', 62: 'Info'                                =>    'Info', // A common table header
 61: 'Info'                                            =>        'Info', // A common table header 63: 'Go back'                            =>    'Go back',
 62: 'Go back'                                         =>        'Go back', 64: 'Maintenance'                        =>    'Maintenance',
 63: 'Maintenance'                                     =>        'Maintenance', 65: 'Redirecting'                        =>    'Redirecting',
 64: 'Redirecting'                                     =>        'Redirecting', 66: 'Click redirect'                    =>    'Click here if you do not want to wait any longer (or if your browser does not automatically forward you)',
 65: 'Click redirect'                                  =>        'Click here if you do not want to wait any longer (or if your browser does not automatically forward you)', 67: 'on'                                =>    'on', // As in "BBCode is on"
 66: 'on'                                              =>        'on', // As in "BBCode is on" 68: 'off'                                =>    'off',
 67: 'off'                                             =>        'off', 69: 'Invalid email'                        =>    'The email address you entered is invalid.',
 68: 'Invalid e-mail'                                  =>        'The e-mail address you entered is invalid.', 70: 'required field'                    =>    'is a required field in this form.', // For javascript form validation
 69: 'required field'                                  =>        'is a required field in this form.', // For javascript form validation 71: 'Last post'                            =>    'Last post',
 70: 'Last post'                                       =>        'Last post', 72: 'by'                                =>    'by', // As in last post by someuser
 71: 'by'                                              =>        'by', // As in last post by someuser 73: 'New posts'                            =>    'New&nbsp;posts', // The link that leads to the first new post (use &nbsp; for spaces)
 72: 'New posts'                                       =>        'New&nbsp;posts', // The link that leads to the first new post (use &nbsp; for spaces) 74: 'New posts info'                    =>    'Go to the first new post in this topic.', // The popup text for new posts links
 73: 'New posts info'                                  =>        'Go to the first new post in this topic.', // The popup text for new posts links 75: 'Username'                            =>    'Username',
 74: 'Username'                                        =>        'Username', 76: 'Password'                            =>    'Password',
 75: 'Password'                                        =>        'Password', 77: 'Email'                                =>    'Email',
 76: 'E-mail'                                          =>        'E-mail', 78: 'Send email'                        =>    'Send email',
 77: 'Send e-mail'                                     =>        'Send e-mail', 79: 'Moderated by'                        =>    'Moderated by',
 78: 'Moderated by'                                    =>        'Moderated by', 80: 'Registered'                        =>    'Registered',
 79: 'Registered'                                      =>        'Registered', 81: 'Subject'                            =>    'Subject',
 80: 'Subject'                                         =>        'Subject', 82: 'Message'                            =>    'Message',
 81: 'Message'                                         =>        'Message', 83: 'Topic'                                =>    'Topic',
 82: 'Topic'                                           =>        'Topic', 84: 'Forum'                                =>    'Forum',
 83: 'Forum'                                           =>        'Forum', 85: 'Posts'                                =>    'Posts',
 84: 'Posts'                                           =>        'Posts', 86: 'Replies'                            =>    'Replies',
 85: 'Replies'                                         =>        'Replies', 87: 'Author'                            =>    'Author',
 86: 'Author'                                          =>        'Author', 88: 'Pages'                                =>    'Pages',
 87: 'Pages'                                           =>        'Pages', 89: 'Page'                                =>    'Page %s',
 88: 'BBCode'                                          =>        'BBCode', // You probably shouldn't change this 90: 'BBCode'                            =>    'BBCode', // You probably shouldn't change this
 89: 'img tag'                                         =>        '[img] tag', 91: 'img tag'                            =>    '[img] tag',
 90: 'Smilies'                                         =>        'Smilies', 92: 'Smilies'                            =>    'Smilies',
 91: 'and'                                             =>        'and', 93: 'and'                                =>    'and',
 92: 'Image link'                                      =>        'image', // This is displayed (i.e. <image>) instead of images when "Show images" is disabled in the profile 94: 'Image link'                        =>    'image', // This is displayed (i.e. <image>) instead of images when "Show images" is disabled in the profile
 93: 'wrote'                                           =>        'wrote', // For [quote]'s 95: 'wrote'                                =>    'wrote', // For [quote]'s
 94: 'Code'                                            =>        'Code', // For [code]'s 96: 'Code'                                =>    'Code', // For [code]'s
 95: 'Mailer'                                          =>        'Mailer', // As in "MyForums Mailer" in the signature of outgoing e-mails 97: 'Mailer'                            =>    'Mailer', // As in "MyForums Mailer" in the signature of outgoing emails
 96: 'Important information'                           =>        'Important information', 98: 'Important information'                =>    'Important information',
 97: 'Write message legend'                            =>        'Write your message and submit', 99: 'Write message legend'                =>    'Write your message and submit',
 98: 'Previous'                                        =>        'Previous',100: 'Previous'                            =>    'Previous',
 99: 'Next'                                            =>        'Next',101: 'Next'                                =>    'Next',
100: 'Spacer'                                          =>        '&hellip;', // Ellipsis for paginate102: 'Spacer'                            =>    '&hellip;', // Ellipsis for paginate
101: 103: 
102: // Title104: // Title
103: 'Title'                                           =>        'Title',105: 'Title'                                =>    'Title',
104: 'Member'                                          =>        'Member', // Default title106: 'Member'                            =>    'Member', // Default title
105: 'Moderator'                                       =>        'Moderator',107: 'Moderator'                            =>    'Moderator',
106: 'Administrator'                                   =>        'Administrator',108: 'Administrator'                        =>    'Administrator',
107: 'Banned'                                          =>        'Banned',109: 'Banned'                            =>    'Banned',
108: 'Guest'                                           =>        'Guest',110: 'Guest'                                =>    'Guest',
109: 111: 
110: // Stuff for include/parser.php112: // Stuff for include/parser.php
111: 'BBCode error 1'                                  =>    '[/%1$s] was found without a matching [%1$s]',113: 'BBCode error no opening tag'        =>    '[/%1$s] was found without a matching [%1$s]',
112: 'BBCode error 2'                                  =>    '[%s] tag is empty',114: 'BBCode error invalid nesting'        =>    '[%1$s] was opened within [%2$s], this is not allowed',
113: 'BBCode error 3'                                  =>    '[%1$s] was opened within [%2$s], this is not allowed',115: 'BBCode error invalid self-nesting'    =>    '[%s] was opened within itself, this is not allowed',
114: 'BBCode error 4'                                  =>    '[%s] was opened within itself, this is not allowed',116: 'BBCode error no closing tag'        =>    '[%1$s] was found without a matching [/%1$s]',
115: 'BBCode error 5'                                  =>    '[%1$s] was found without a matching [/%1$s]',117: 'BBCode error empty attribute'        =>    '[%s] tag had an empty attribute section',
116: 'BBCode error 6'                                  =>    '[%s] tag had an empty attribute section',118: 'BBCode code problem'                =>    'There is a problem with your [code] tags',
117: 'BBCode nested list'                              =>    '[list] tags cannot be nested', 
118: 'BBCode code problem'                             =>    'There is a problem with your [code] tags', 
119: 119: 
120: // Stuff for the navigator (top of every page)120: // Stuff for the navigator (top of every page)
121: 'Index'                                           =>        'Index',121: 'Index'                                =>    'Index',
122: 'User list'                                       =>        'User list',122: 'User list'                            =>    'User list',
123: 'Rules'                                           =>        'Rules',123: 'Rules'                                =>    'Rules',
124: 'Search'                                          =>        'Search',124: 'Search'                            =>    'Search',
125: 'Register'                                        =>        'Register',125: 'Register'                            =>    'Register',
126: 'Login'                                           =>        'Login',126: 'Login'                                =>    'Login',
127: 'Not logged in'                                   =>        'You are not logged in.',127: 'Not logged in'                        =>    'You are not logged in.',
128: 'Profile'                                         =>        'Profile',128: 'Profile'                            =>    'Profile',
129: 'Logout'                                          =>        'Logout',129: 'Logout'                            =>    'Logout',
130: 'Logged in as'                                    =>        'Logged in as',130: 'Logged in as'                        =>    'Logged in as',
131: 'Admin'                                           =>        'Administration',131: 'Admin'                                =>    'Administration',
132: 'Last visit'                                      =>        'Last visit',132: 'Last visit'                        =>    'Last visit',
133: 'Show new posts'                                  =>        'Show new posts since last visit',133: 'Show new posts'                    =>    'Show new posts since last visit',
134: 'Mark all as read'                                =>        'Mark all topics as read',134: 'Mark all as read'                    =>    'Mark all topics as read',
135: 'Mark forum read'                                 =>        'Mark this forum as read',135: 'Mark forum read'                    =>    'Mark this forum as read',
136: 'Link separator'                                  =>        '', // The text that separates links in the navigator136: 'Menu link separator'                =>    '', // The text that separates links in the navigator
 137: 'Link separator'                    =>    ' | ', // The text that separates links in posts
137: 138: 
138: // Stuff for the page footer139: // Stuff for the page footer
139: 'Board footer'                                    =>        'Board footer',140: 'Board footer'                        =>    'Board footer',
140: 'Search links'                                    =>        'Search links',141: 'Search links'                        =>    'Search links',
141: 'Show recent posts'                               =>        'Show recent posts',142: 'Show recent posts'                    =>    'Show recent posts',
142: 'Show unanswered posts'                           =>        'Show unanswered posts',143: 'Show unanswered posts'                =>    'Show unanswered posts',
143: 'Show your posts'                                 =>        'Show your posts',144: 'Show your posts'                    =>    'Show your posts',
144: 'Show subscriptions'                              =>        'Show your subscribed topics',145: 'Show subscriptions'                =>    'Show your subscribed topics',
145: 'Jump to'                                         =>        'Jump to',146: 'Jump to'                            =>    'Jump to',
146: 'Go'                                              =>        ' Go ', // Submit button in forum jump147: 'Go'                                =>    ' Go ', // Submit button in forum jump
147: 'Moderate topic'                                  =>        'Moderate topic',148: 'Moderate topic'                    =>    'Moderate topic',
148: 'Move topic'                                      =>        'Move topic',149: 'Move topic'                        =>    'Move topic',
149: 'Open topic'                                      =>        'Open topic',150: 'Open topic'                        =>    'Open topic',
150: 'Close topic'                                     =>        'Close topic',151: 'Close topic'                        =>    'Close topic',
151: 'Unstick topic'                                   =>        'Unstick topic',152: 'Unstick topic'                        =>    'Unstick topic',
152: 'Stick topic'                                     =>        'Stick topic',153: 'Stick topic'                        =>    'Stick topic',
153: 'Moderate forum'                                  =>        'Moderate forum',154: 'Moderate forum'                    =>    'Moderate forum',
154: 'Delete posts'                                    =>        'Delete multiple posts', // Deprecated155: 'Delete posts'                        =>    'Delete multiple posts', // Deprecated
155: 'Powered by'                                      =>        'Powered by %s',156: 'Powered by'                        =>    'Powered by %s',
156: 157: 
157: // Debug information158: // Debug information
158: 'Debug table'                                     =>        'Debug information',159: 'Debug table'                        =>    'Debug information',
159: 'Querytime'                                       =>        'Generated in %1$s seconds, %2$s queries executed',160: 'Querytime'                            =>    'Generated in %1$s seconds, %2$s queries executed',
160: 'Query times'                                     =>        'Time (s)',161: 'Query times'                        =>    'Time (s)',
161: 'Query'                                           =>        'Query',162: 'Query'                                =>    'Query',
162: 'Total query time'                                =>        'Total query time: %s',163: 'Total query time'                    =>    'Total query time: %s',
163: 164: 
164: // Email related notifications165: // Email related notifications
165: 'New user notification'                           =>        'Alert - New registration',166: 'New user notification'                =>    'Alert - New registration',
166: 'New user message'                                =>        'User \'%s\' registered in the forums at %s',167: 'New user message'                    =>    'User \'%s\' registered in the forums at %s',
167: 'Banned email notification'                       =>        'Alert - Banned e-mail detected',168: 'Banned email notification'            =>    'Alert - Banned email detected',
168: 'Banned email register message'                   =>        'User \'%s\' registered with banned e-mail address: %s',169: 'Banned email register message'        =>    'User \'%s\' registered with banned email address: %s',
169: 'Banned email change message'                     =>        'User \'%s\' changed to banned e-mail address: %s',170: 'Banned email change message'        =>    'User \'%s\' changed to banned email address: %s',
170: 'Duplicate email notification'                    =>        'Alert - Duplicate e-mail detected',171: 'Banned email post message'            =>    'User \'%s\' posted with banned email address: %s',
171: 'Duplicate email register message'                =>        'User \'%s\' registered with an e-mail address that also belongs to: %s',172: 'Duplicate email notification'        =>    'Alert - Duplicate email detected',
172: 'Duplicate email change message'                  =>        'User \'%s\' changed to an e-mail address that also belongs to: %s',173: 'Duplicate email register message'    =>    'User \'%s\' registered with an email address that also belongs to: %s',
173: 'Report notification'                             =>        'Report(%d) - \'%s\'',174: 'Duplicate email change message'    =>    'User \'%s\' changed to an email address that also belongs to: %s',
174: 'Report message 1'                                =>        'User \'%s\' has reported the following message: %s',175: 'Report notification'                =>    'Report(%d) - \'%s\'',
175: 'Report message 2'                                =>        'Reason: %s',176: 'Report message 1'                    =>    'User \'%s\' has reported the following message: %s',
176: 177: 'Report message 2'                    =>    'Reason: %s',
177: 'User profile'                                    =>        'User profile: %s',178: 
178: 'Email signature'                                 =>        'Forum Mailer'."\n".'(Do not reply to this message)',179: 'User profile'                        =>    'User profile: %s',
 180: 'Post URL'                            =>    'Post URL: %s',
 181: 'Email signature'                    =>    'Forum Mailer'."\n".'(Do not reply to this message)',
179: 182: 
180: // For extern.php RSS feed183: // For extern.php RSS feed
181: 'RSS description'                                 =>        'The most recent topics at %s.',184: 'RSS description'                    =>    'The most recent topics at %s.',
182: 'RSS description topic'                           =>        'The most recent posts in %s.',185: 'RSS description topic'                =>    'The most recent posts in %s.',
183: 'RSS reply'                                       =>        'Re: ' // The topic subject will be appended to this string (to signify a reply)186: 'RSS reply'                            =>    'Re: ' // The topic subject will be appended to this string (to signify a reply)
184: 187: 
185: );188: );


a/upload/lang/English/delete.php b/upload/lang/English/delete.php
  5:   5: 
  6: 'Delete post'            =>    'Delete post',  6: 'Delete post'            =>    'Delete post',
  7: 'Warning'                =>    'Warning! If this is the first post in the topic, the whole topic will be deleted.',  7: 'Warning'                =>    'Warning! If this is the first post in the topic, the whole topic will be deleted.',
  8: 'Delete'                =>    'Delete',    // The submit button  8: 'Delete'                =>    'Delete', // The submit button
  9: 'Post del redirect'        =>    'Post deleted. Redirecting &hellip;',  9: 'Post del redirect'        =>    'Post deleted. Redirecting &hellip;',
 10: 'Topic del redirect'    =>    'Topic deleted. Redirecting &hellip;' 10: 'Topic del redirect'    =>    'Topic deleted. Redirecting &hellip;'
 11:  11: 


a/upload/lang/English/help.php b/upload/lang/English/help.php
 16: 'Italic text'            =>    'Italic text', 16: 'Italic text'            =>    'Italic text',
 17: 'Red text'                =>    'Red text', 17: 'Red text'                =>    'Red text',
 18: 'Blue text'                =>    'Blue text', 18: 'Blue text'                =>    'Blue text',
  19: 'Heading text'            =>    'Heading text',
 19:  20: 
 20: 'Links and images'        =>    'Links and images', 21: 'Links and images'        =>    'Links and images',
 21: 'Links info'            =>    'You can create links to other documents or to e-mail addresses using the following tags:', 22: 'Links info'            =>    'You can create links to other documents or to email addresses using the following tags:',
 22: 'My e-mail address'        =>    'My e-mail address', 23: 'My email address'        =>    'My email address',
 23: 'Images info'            =>    'If you want to display an image you can use the img tag. The text appearing after the "=" sign in the opening tag is used for the alt attribute and should be included whenever possible.', 24: 'Images info'            =>    'If you want to display an image you can use the img tag. The text appearing after the "=" sign in the opening tag is used for the alt attribute and should be included whenever possible.',
 24:  25: 
 25: 'Quotes'                =>    'Quotes', 26: 'Quotes'                =>    'Quotes',
 27: 'Quotes info 2'            =>    'If you don\'t want to quote anyone in particular, you can use the quote tag without specifying a name.', 28: 'Quotes info 2'            =>    'If you don\'t want to quote anyone in particular, you can use the quote tag without specifying a name.',
 28: 'Quote text'            =>    'This is the text i want to quote.', 29: 'Quote text'            =>    'This is the text i want to quote.',
 29: 'produces quote box'    =>    'produces a quote box like this:', 30: 'produces quote box'    =>    'produces a quote box like this:',
  31: 'quote note'            =>    'Note: If a username contains the characters [ or ] you can enclose it in quote marks.',
 30:  32: 
 31: 'Code'                    =>    'Code', 33: 'Code'                    =>    'Code',
 32: 'Code info'                =>    'When displaying source code you should make sure that you use the code tag. Text displayed with the code tag will use a monospaced font and will not be affected by other tags.', 34: 'Code info'                =>    'When displaying source code you should make sure that you use the code tag. Text displayed with the code tag will use a monospaced font and will not be affected by other tags.',
 37: 'Nested tags info'        =>    'BBCode can be nested to create more advanced formatting. For example:', 39: 'Nested tags info'        =>    'BBCode can be nested to create more advanced formatting. For example:',
 38: 'Bold, underlined text'    =>    'Bold, underlined text', 40: 'Bold, underlined text'    =>    'Bold, underlined text',
 39:  41: 
 40: 'Lists'                    =>    'Lists', 42: 'Lists'                    =>    'Lists',
 41: 'List info'                =>    'To create a list you can use the list tag. You can create 3 types of lists using the list tag.', 43: 'List info'                =>    'To create a list you can use the list tag. You can create 3 types of lists using the list tag.',
 42: 'List text 1'              =>    'Example list item 1.', 44: 'List text 1'            =>    'Example list item 1.',
 43: 'List text 2'              =>    'Example list item 2.', 45: 'List text 2'            =>    'Example list item 2.',
 44: 'List text 3'              =>    'Example list item 3.', 46: 'List text 3'            =>    'Example list item 3.',
 45: 'produces list'            =>    'produces a bulleted list.', 47: 'produces list'            =>    'produces a bulleted list.',
 46: 'produces decimal list'    =>    'produces a numbered list.', 48: 'produces decimal list'    =>    'produces a numbered list.',
 47: 'produces alpha list'      =>    'produces an alphabetically labelled list.', 49: 'produces alpha list'    =>    'produces an alphabetically labelled list.',
 48:  50: 
 49: 'Smilies info'            =>    'If you like (and if it is enabled), the forum can convert a series of smilies to images representations of that smiley. This forum recognizes the following smilies and replaces them with images:' 51: 'Smilies info'            =>    'If you like (and if it is enabled), the forum can convert a series of smilies to images representations of that smiley. This forum recognizes the following smilies and replaces them with images:'
 50:  52: 


a/upload/lang/English/index.php b/upload/lang/English/index.php
  3: // Language definitions used in index.php  3: // Language definitions used in index.php
  4: $lang_index = array(  4: $lang_index = array(
  5:   5: 
  6: 'Topics'                =>  'Topics',  6: 'Topics'        =>    'Topics',
  7: 'Moderators'            =>  'Moderators',  7: 'Link to'        =>    'Link to', // As in "Link to http://fluxbb.org/"
  8: 'Link to'                =>    'Link to',    // As in "Link to http://fluxbb.org/"  8: 'Empty board'    =>    'Board is empty.',
  9: 'Empty board'            =>    'Board is empty.',  9: 'Newest user'    =>    'Newest registered user',
 10: 'Newest user'            =>    'Newest registered user', 10: 'Users online'    =>    'Registered users online',
 11: 'Users online'            =>    'Registered users online', 11: 'Guests online'    =>    'Guests online',
 12: 'Guests online'            =>    'Guests online', 12: 'No of users'    =>    'Total number of registered users',
 13: 'No of users'            =>    'Total number of registered users', 13: 'No of topics'    =>    'Total number of topics',
 14: 'No of topics'            =>    'Total number of topics', 14: 'No of posts'    =>    'Total number of posts',
 15: 'No of posts'            =>    'Total number of posts', 15: 'Online'        =>    'Online', // As in "Online: User A, User B etc."
 16: 'Online'                =>    'Online',    // As in "Online: User A, User B etc." 16: 'Board info'    =>    'Board information',
 17: 'Board info'            =>    'Board information', 17: 'Board stats'    =>    'Board statistics',
 18: 'Board stats'            =>    'Board statistics', 18: 'User info'        =>    'User information'
 19: 'User info'                =>    'User information' 
 20:  19: 
 21: ); 20: );


a/upload/lang/English/login.php b/upload/lang/English/login.php
  1: <?php  1: <?php
  2:   2: 
  3: // Language definitions used in delete.php  3: // Language definitions used in login.php
  4: $lang_login = array(  4: $lang_login = array(
  5:   5: 
  6: // Miscellaneous  6: // Miscellaneous
  8: 'Forgotten pass'        =>    'Forgotten your password?',  8: 'Forgotten pass'        =>    'Forgotten your password?',
  9: 'Login redirect'        =>    'Logged in successfully. Redirecting &hellip;',  9: 'Login redirect'        =>    'Logged in successfully. Redirecting &hellip;',
 10: 'Logout redirect'        =>    'Logged out. Redirecting &hellip;', 10: 'Logout redirect'        =>    'Logged out. Redirecting &hellip;',
 11: 'No e-mail match'        =>    'There is no user registered with the e-mail address', 11: 'No email match'        =>    'There is no user registered with the email address',
 12: 'Request pass'            =>    'Request password', 12: 'Request pass'            =>    'Request password',
 13: 'Request pass legend'    =>    'Enter the e-mail address with which you registered', 13: 'Request pass legend'    =>    'Enter the email address with which you registered',
 14: 'Request pass info'        =>    'A new password together with a link to activate the new password will be sent to that address.', 14: 'Request pass info'        =>    'A new password together with a link to activate the new password will be sent to that address.',
 15: 'Not registered'        =>    'Not registered yet?', 15: 'Not registered'        =>    'Not registered yet?',
 16: 'Login legend'            =>    'Enter your username and password below', 16: 'Login legend'            =>    'Enter your username and password below',
 18: 'Login info'            =>    'If you have not registered or have forgotten your password click on the appropriate link below.', 18: 'Login info'            =>    'If you have not registered or have forgotten your password click on the appropriate link below.',
 19:  19: 
 20: // Forget password mail stuff 20: // Forget password mail stuff
 21: 'Forget mail'            =>    'An e-mail has been sent to the specified address with instructions on how to change your password. If it does not arrive you can contact the forum administrator at', 21: 'Forget mail'            =>    'An email has been sent to the specified address with instructions on how to change your password. If it does not arrive you can contact the forum administrator at',
 22: 'Email flood'            =>    'This account has already requested a password reset in the past hour. Please wait a while before requesting a new password again.' 22: 'Email flood'            =>    'This account has already requested a password reset in the past hour. Please wait a while before requesting a new password again.'
 23:  23: 
 24: ); 24: );


a/upload/lang/English/mail_templates/activate_email.tpl b/upload/lang/English/mail_templates/activate_email.tpl
  1: Subject: Change e-mail address requested  1: Subject: Change email address requested
  2:   2: 
  3: Hello <username>,  3: Hello <username>,
  4:   4: 
  5: You have requested to have a new e-mail address assigned to your account in the discussion forum at <base_url>. If you didn't request this or if you don't want to change your e-mail address you should just ignore this message. Only if you visit the activation page below will your e-mail address be changed. In order for the activation page to work, you must be logged in to the forum.  5: You have requested to have a new email address assigned to your account in the discussion forum at <base_url>. If you didn't request this or if you don't want to change your email address you should just ignore this message. Only if you visit the activation page below will your email address be changed. In order for the activation page to work, you must be logged in to the forum.
  6:   6: 
  7: To change your e-mail address, please visit the following page:  7: To change your email address, please visit the following page:
  8: <activation_url>  8: <activation_url>
  9:   9: 
 10: --  10: --
 11: <board_mailer> 11: <board_mailer>
 12: (Do not reply to this message) 12: (Do not reply to this message)
 13:  13: 


a/upload/lang/English/mail_templates/activate_password.tpl b/upload/lang/English/mail_templates/activate_password.tpl
  9: To change your password, please visit the following page:  9: To change your password, please visit the following page:
 10: <activation_url> 10: <activation_url>
 11:  11: 
 12: --  12: --
 13: <board_mailer> 13: <board_mailer>
 14: (Do not reply to this message) 14: (Do not reply to this message)
 15:  15: 


a/upload/lang/English/mail_templates/form_email.tpl b/upload/lang/English/mail_templates/form_email.tpl
  1: Subject: <mail_subject>  1: Subject: <mail_subject>
  2:   2: 
  3: <sender> from <board_title> has sent you a message. You can reply to <sender> by replying to this e-mail.  3: <sender> from <board_title> has sent you a message. You can reply to <sender> by replying to this email.
  4:   4: 
  5: The message reads as follows:  5: The message reads as follows:
  6: -----------------------------------------------------------------------  6: -----------------------------------------------------------------------
  9:   9: 
 10: ----------------------------------------------------------------------- 10: -----------------------------------------------------------------------
 11:  11: 
 12: --  12: --
 13: <board_mailer> 13: <board_mailer>
 14:  14: 


a/upload/lang/English/mail_templates/new_reply.tpl b/upload/lang/English/mail_templates/new_reply.tpl
  6:   6: 
  7: You can unsubscribe by going to <unsubscribe_url>  7: You can unsubscribe by going to <unsubscribe_url>
  8:   8: 
  9: --   9: --
 10: <board_mailer> 10: <board_mailer>
 11: (Do not reply to this message) 11: (Do not reply to this message)
 12:  12: 


a/upload/lang/English/mail_templates/new_reply_full.tpl b/upload/lang/English/mail_templates/new_reply_full.tpl
 13:  13: 
 14: You can unsubscribe by going to <unsubscribe_url> 14: You can unsubscribe by going to <unsubscribe_url>
 15:  15: 
 16: --  16: --
 17: <board_mailer> 17: <board_mailer>
 18: (Do not reply to this message) 18: (Do not reply to this message)
 19:  19: 


a/upload/lang/English/misc.php b/upload/lang/English/misc.php
  3: // Language definitions used in various scripts  3: // Language definitions used in various scripts
  4: $lang_misc = array(  4: $lang_misc = array(
  5:   5: 
  6: 'Mark read redirect'        =>    'All topics and forums have been marked as read. Redirecting &hellip;',  6: 'Mark read redirect'            =>    'All topics and forums have been marked as read. Redirecting &hellip;',
  7: 'Mark forum read redirect'    =>    'All topics in the specified forum have been marked as read. Redirecting &hellip;',  7: 'Mark forum read redirect'        =>    'All topics in the specified forum have been marked as read. Redirecting &hellip;',
  8:   8: 
  9: // Send e-mail  9: // Send email
 10: 'Form e-mail disabled'        =>    'The user you are trying to send an e-mail to has disabled form e-mail.', 10: 'Form email disabled'            =>    'The user you are trying to send an email to has disabled form email.',
 11: 'No e-mail subject'            =>    'You must enter a subject.', 11: 'No email subject'                =>    'You must enter a subject.',
 12: 'No e-mail message'            =>    'You must enter a message.', 12: 'No email message'                =>    'You must enter a message.',
 13: 'Too long e-mail message'    =>    'Messages cannot be longer than 65535 characters (64 KB).', 13: 'Too long email message'        =>    'Messages cannot be longer than 65535 characters (64 KB).',
 14: 'Email flood'                =>    'At least %s seconds have to pass between sent emails. Please wait a while and try sending again.', 14: 'Email flood'                    =>    'At least %s seconds have to pass between sent emails. Please wait a while and try sending again.',
 15: 'E-mail sent redirect'        =>    'E-mail sent. Redirecting &hellip;', 15: 'Email sent redirect'            =>    'Email sent. Redirecting &hellip;',
 16: 'Send e-mail to'            =>    'Send e-mail to', 16: 'Send email to'                    =>    'Send email to',
 17: 'E-mail subject'            =>    'Subject', 17: 'Email subject'                    =>    'Subject',
 18: 'E-mail message'            =>    'Message', 18: 'Email message'                    =>    'Message',
 19: 'E-mail disclosure note'    =>    'Please note that by using this form, your e-mail address will be disclosed to the recipient.', 19: 'Email disclosure note'            =>    'Please note that by using this form, your email address will be disclosed to the recipient.',
 20: 'Write e-mail'                =>    'Write and submit your e-mail message', 20: 'Write email'                    =>    'Write and submit your email message',
 21:  21: 
 22: // Report 22: // Report
 23: 'No reason'                    =>    'You must enter a reason.', 23: 'No reason'                        =>    'You must enter a reason.',
 24: 'Report flood'                =>    'At least %s seconds have to pass between reports. Please wait a while and try sending again.', 24: 'Report flood'                    =>    'At least %s seconds have to pass between reports. Please wait a while and try sending again.',
 25: 'Report redirect'            =>    'Post reported. Redirecting &hellip;', 25: 'Report redirect'                =>    'Post reported. Redirecting &hellip;',
 26: 'Report post'                =>    'Report post', 26: 'Report post'                    =>    'Report post',
 27: 'Reason'                    =>    'Reason', 27: 'Reason'                        =>    'Reason',
 28: 'Reason desc'                =>    'Please enter a short reason why you are reporting this post', 28: 'Reason desc'                    =>    'Please enter a short reason why you are reporting this post',
 29:  29: 
 30: // Subscriptions 30: // Subscriptions
 31: 'Already subscribed'        =>    'You are already subscribed to this topic.', 31: 'Already subscribed'            =>    'You are already subscribed to this topic.',
 32: 'Subscribe redirect'        =>    'Your subscription has been added. Redirecting &hellip;', 32: 'Subscribe redirect'            =>    'Your subscription has been added. Redirecting &hellip;',
 33: 'Not subscribed'            =>    'You are not subscribed to this topic.', 33: 'Not subscribed'                =>    'You are not subscribed to this topic.',
 34: 'Unsubscribe redirect'        =>    'Your subscription has been removed. Redirecting &hellip;', 34: 'Unsubscribe redirect'            =>    'Your subscription has been removed. Redirecting &hellip;',
 35:  35: 
 36: // General forum and topic moderation 36: // General forum and topic moderation
 37: 'Moderate'                    =>    'Moderate', 37: 'Moderate'                        =>    'Moderate',
 38: 'Select'                    =>    'Select',    // the header of a column of checkboxes 38: 'Select'                        =>    'Select', // the header of a column of checkboxes
 39: 'Move'                        =>    'Move', 39: 'Move'                            =>    'Move',
 40: 'Split'                        =>    'Split', 40: 'Split'                            =>    'Split',
 41: 'Delete'                    =>    'Delete', 41: 'Delete'                        =>    'Delete',
 42: 'Merge'                        =>    'Merge', 42: 'Merge'                            =>    'Merge',
 43:  43: 
 44: // Moderate forum 44: // Moderate forum
 45: 'Open'                        =>    'Open', 45: 'Open'                            =>    'Open',
 46: 'Close'                        =>    'Close', 46: 'Close'                            =>    'Close',
 47: 'Move topic'                =>    'Move topic', 47: 'Move topic'                    =>    'Move topic',
 48: 'Move topics'                =>    'Move topics', 48: 'Move topics'                    =>    'Move topics',
 49: 'Move legend'                =>    'Select destination of move', 49: 'Move legend'                    =>    'Select destination of move',
 50: 'Move to'                    =>    'Move to', 50: 'Move to'                        =>    'Move to',
 51: 'Leave redirect'            =>    'Leave redirect topic(s)', 51: 'Nowhere to move'                =>    'There are no forums into which you can move topics.',
 52: 'Move topic redirect'        =>    'Topic moved. Redirecting &hellip;', 52: 'Leave redirect'                =>    'Leave redirect topic(s)',
 53: 'Move topics redirect'        =>    'Topics moved. Redirecting &hellip;', 53: 'Move topic redirect'            =>    'Topic moved. Redirecting &hellip;',
 54: 'Confirm delete legend'        =>    'Please confirm deletion', 54: 'Move topics redirect'            =>    'Topics moved. Redirecting &hellip;',
 55: 'Delete topics'            =>    'Delete topics', 55: 'Confirm delete legend'            =>    'Please confirm deletion',
 56: 'Delete topics comply'        =>    'Are you sure you want to delete the selected topics?', 56: 'Delete topics'                    =>    'Delete topics',
 57: 'Delete topics redirect'    =>    'Topics deleted. Redirecting &hellip;', 57: 'Delete topics comply'            =>    'Are you sure you want to delete the selected topics?',
 58: 'Open topic redirect'        =>    'Topic opened. Redirecting &hellip;', 58: 'Delete topics redirect'        =>    'Topics deleted. Redirecting &hellip;',
 59: 'Open topics redirect'        =>    'Topics opened. Redirecting &hellip;', 59: 'Open topic redirect'            =>    'Topic opened. Redirecting &hellip;',
 60: 'Close topic redirect'        =>    'Topic closed. Redirecting &hellip;', 60: 'Open topics redirect'            =>    'Topics opened. Redirecting &hellip;',
 61: 'Close topics redirect'        =>    'Topics closed. Redirecting &hellip;', 61: 'Close topic redirect'            =>    'Topic closed. Redirecting &hellip;',
 62: 'No topics selected'        =>    'You must select at least one topic for move/delete/open/close.', 62: 'Close topics redirect'            =>    'Topics closed. Redirecting &hellip;',
  63: 'No topics selected'            =>    'You must select at least one topic for move/delete/open/close.',
 63: 'Not enough topics selected'    =>    'You must select at least two topics for merge.', 64: 'Not enough topics selected'    =>    'You must select at least two topics for merge.',
 64: 'Stick topic redirect'        =>    'Topic sticked. Redirecting &hellip;', 65: 'Stick topic redirect'            =>    'Topic sticked. Redirecting &hellip;',
 65: 'Unstick topic redirect'    =>    'Topic unsticked. Redirecting &hellip;', 66: 'Unstick topic redirect'        =>    'Topic unsticked. Redirecting &hellip;',
 66: 'Merge topics'            =>    'Merge topics', 67: 'Merge topics'                    =>    'Merge topics',
 67: 'Merge topics redirect'        =>    'Topics merged. Redirecting &hellip;', 68: 'Merge topics redirect'            =>    'Topics merged. Redirecting &hellip;',
 68: 'Confirm merge legend'        =>    'Please confirm merge', 69: 'Confirm merge legend'            =>    'Please confirm merge',
 69: 'New subject'            =>    'New subject', 70: 'New subject'                    =>    'New subject',
 70:  71: 
 71: // Split multiple posts in topic 72: // Split multiple posts in topic
 72: 'Confirm split legend'        =>    'Please confirm split of selected posts.', 73: 'Confirm split legend'            =>    'Please confirm split of selected posts.',
 73: 'Split posts'            =>    'Split posts', 74: 'Split posts'                    =>    'Split posts',
 74: 'Split posts comply'        =>    'Are you sure you want to split the selected posts?', 75: 'Split posts comply'            =>    'Are you sure you want to split the selected posts?',
 75: 'Split posts redirect'        =>    'Posts have been split. Redirecting &hellip;', 76: 'Split posts redirect'            =>    'Posts have been split. Redirecting &hellip;',
 76:  77: 
 77: // Delete multiple posts in topic 78: // Delete multiple posts in topic
 78: 'Delete posts'                =>    'Delete posts', 79: 'Delete posts'                    =>    'Delete posts',
 79: 'Delete posts comply'        =>    'Are you sure you want to delete the selected posts?', 80: 'Cannot delete first'            =>    'First post cannot be selected for deletion.',
 80: 'Delete posts redirect'        =>    'Posts deleted. Redirecting &hellip;', 81: 'Delete posts comply'            =>    'Are you sure you want to delete the selected posts?',
 81: 'No posts selected'            =>    'You must select at least one post to be deleted.' 82: 'Delete posts redirect'            =>    'Posts deleted. Redirecting &hellip;',
  83: 'No posts selected'                =>    'You must select at least one post to be deleted.'
 82:  84: 
 83: ); 85: );


a/upload/lang/English/post.php b/upload/lang/English/post.php
  4: $lang_post = array(  4: $lang_post = array(
  5:   5: 
  6: // Post validation stuff (many are similiar to those in edit.php)  6: // Post validation stuff (many are similiar to those in edit.php)
  7: 'No subject'            =>    'Topics must contain a subject.',  7: 'No subject'        =>  'Topics must contain a subject.',
  8: 'Too long subject'        =>    'Subjects cannot be longer than 70 characters.',  8: 'Too long subject'  =>  'Subjects cannot be longer than 70 characters.',
  9: 'No message'            =>    'You must enter a message.',  9: 'No message'        =>  'You must enter a message.',
 10: 'Too long message'        =>    'Posts cannot be longer that 65535 characters (64 KB).', 10: 'Too long message'  =>  'Posts cannot be longer that 65535 characters (64 KB).',
  11: 'All caps subject'  =>  'Subjects cannot contain only capital letters.',
  12: 'All caps message'  =>  'Posts cannot contain only capital letters.',
 11:  13: 
 12: // Posting 14: // Posting
 13: 'Post errors'            =>    'Post errors', 15: 'Post errors'       =>  'Post errors',
 14: 'Post errors info'        =>    'The following errors need to be corrected before the message can be posted:', 16: 'Post errors info'  =>  'The following errors need to be corrected before the message can be posted:',
 15: 'Post preview'            =>    'Post preview', 17: 'Post preview'      =>  'Post preview',
 16: 'Guest name'            =>    'Name',    // For guests (instead of Username) 18: 'Guest name'        =>  'Name', // For guests (instead of Username)
 17: 'Post redirect'            =>    'Post entered. Redirecting &hellip;', 19: 'Post redirect'     =>  'Post entered. Redirecting &hellip;',
 18: 'Post a reply'            =>    'Post a reply', 20: 'Post a reply'      =>  'Post a reply',
 19: 'Post new topic'        =>    'Post new topic', 21: 'Post new topic'    =>  'Post new topic',
 20: 'Hide smilies'            =>    'Never show smilies as icons for this post', 22: 'Hide smilies'      =>  'Never show smilies as icons for this post',
 21: 'Subscribe'                =>    'Subscribe to this topic', 23: 'Subscribe'         =>  'Subscribe to this topic',
 22: 'Topic review'            =>    'Topic review (newest first)', 24: 'Stay subscribed'   =>  'Stay subscribed to this topic',
 23: 'Flood start'            =>    'At least', 25: 'Topic review'      =>  'Topic review (newest first)',
 24: 'flood end'                =>    'seconds have to pass between posts. Please wait a little while and try posting again.', 26: 'Flood start'       =>  'At least',
 25: 'Preview'                =>    'Preview',    // submit button to preview message 27: 'flood end'         =>  'seconds have to pass between posts. Please wait a little while and try posting again.',
  28: 'Preview'           =>  'Preview', // submit button to preview message
 26:  29: 
 27: // Edit post 30: // Edit post
 28: 'Edit post legend'        =>    'Edit the post and submit changes', 31: 'Edit post legend'  =>  'Edit the post and submit changes',
 29: 'Silent edit'            =>    'Silent edit (don\'t display "Edited by ..." in topic view)', 32: 'Silent edit'       =>  'Silent edit (don\'t display "Edited by ..." in topic view)',
 30: 'Edit post'                =>    'Edit post', 33: 'Edit post'         =>  'Edit post',
 31: 'Edit redirect'            =>    'Post updated. Redirecting &hellip;' 34: 'Edit redirect'     =>  'Post updated. Redirecting &hellip;'
 32:  35: 
 33: ); 36: );


a/upload/lang/English/prof_reg.php b/upload/lang/English/prof_reg.php
  3: // Language definitions used in both profile.php and register.php  3: // Language definitions used in both profile.php and register.php
  4: $lang_prof_reg = array(  4: $lang_prof_reg = array(
  5:   5: 
  6: 'E-mail legend'                =>    'Enter a valid e-mail address',  6: 'Email legend'                =>    'Enter a valid email address',
  7: 'E-mail legend 2'            =>    'Enter and confirm a valid e-mail address',  7: 'Email legend 2'            =>    'Enter and confirm a valid email address',
  8: 'Localisation legend'        =>    'Set your localisation options',  8: 'Localisation legend'        =>    'Set your localisation options',
  9: 'Timezone'                    =>    'Timezone',  9: 'Time zone'                    =>    'Time zone',
 10: 'Timezone info'                =>    'For the forum to display times correctly you must select your local timezone.', 10: 'Time zone info'            =>    'For the forum to display times correctly you must select your local time zone. If Daylight Savings Time is in effect you should also check the option provided which will advance times by 1 hour.',
 11: 'DST'                        =>    'Adjust for DST: This box should be checked properly so that the forum can display the correct time.', 11: 'DST'                        =>    'Daylight Savings Time is in effect (advance time by 1 hour).',
 12: 'DST info'                    =>    'Daylight savings is in effect (advance times by 1 hour).', 
 13: 'Time format'                =>    'Time format', 12: 'Time format'                =>    'Time format',
 14: 'Date format'                =>    'Date format', 13: 'Date format'                =>    'Date format',
 15: 'Default'                    =>    'Default', 14: 'Default'                    =>    'Default',
 16: 'Language'                    =>    'Language', 15: 'Language'                    =>    'Language',
 17: 'Language info'                =>    'You can choose which language you wish to use to view the forum.', 16: 'Language info'                =>    'You can choose which language you wish to use to view the forum.',
 18: 'E-mail setting info'        =>    'Select whether you want your e-mail address to be viewable to other users or not and if you want other users to be able to send you e-mail via the forum (form e-mail) or not.', 17: 'Email setting info'        =>    'Select whether you want your email address to be viewable to other users or not and if you want other users to be able to send you email via the forum (form email) or not.',
 19: 'E-mail setting 1'            =>    'Display your e-mail address.', 18: 'Email setting 1'            =>    'Display your email address.',
 20: 'E-mail setting 2'            =>    'Hide your e-mail address but allow form e-mail.', 19: 'Email setting 2'            =>    'Hide your email address but allow form email.',
 21: 'E-mail setting 3'            =>    'Hide your e-mail address and disallow form e-mail.', 20: 'Email setting 3'            =>    'Hide your email address and disallow form email.',
 22: 'Privacy options legend'    =>    'Set your privacy options', 21: 'Privacy options legend'    =>    'Set your privacy options',
 23: 'Confirm pass'                =>    'Confirm password', 22: 'Confirm pass'                =>    'Confirm password',
 24:  23: 
 32: 'Banned username'            =>    'The username you entered is banned in this forum. Please choose another username.', 31: 'Banned username'            =>    'The username you entered is banned in this forum. Please choose another username.',
 33: 'Pass too short'            =>    'Passwords must be at least 4 characters long. Please choose another (longer) password.', 32: 'Pass too short'            =>    'Passwords must be at least 4 characters long. Please choose another (longer) password.',
 34: 'Pass not match'            =>    'Passwords do not match.', 33: 'Pass not match'            =>    'Passwords do not match.',
 35: 'Banned e-mail'                =>    'The e-mail address you entered is banned in this forum. Please choose another e-mail address.', 34: 'Banned email'                =>    'The email address you entered is banned in this forum. Please choose another email address.',
 36: 'Dupe e-mail'                =>    'Someone else is already registered with that e-mail address. Please choose another e-mail address.', 35: 'Dupe email'                =>    'Someone else is already registered with that email address. Please choose another email address.',
 37: 'Sig too long'                =>    'Signatures cannot be longer than', 36: 'Sig too long'                =>    'Signatures cannot be longer than',
 38: 'characters'                =>    'characters', 37: 'characters'                =>    'characters',
 39: 'Sig too many lines'        =>    'Signatures cannot have more than', 38: 'Sig too many lines'        =>    'Signatures cannot have more than',
 40: 'lines'                        =>    'lines', 39: 'lines'                        =>    'lines',
 41: 'Signature quote/code'        =>    'The quote and code BBCodes are not allowed in signatures. Please go back and correct.', 
 42: 'Bad ICQ'                    =>    'You entered an invalid ICQ UIN. Please go back and correct.' 40: 'Bad ICQ'                    =>    'You entered an invalid ICQ UIN. Please go back and correct.'
 43:  41: 
 44: ); 42: );


a/upload/lang/English/profile.php b/upload/lang/English/profile.php
  4: $lang_profile = array(  4: $lang_profile = array(
  5:   5: 
  6: // Navigation and sections  6: // Navigation and sections
  7: 'Profile menu'                =>    'Profile menu',  7: 'Profile menu'                    =>    'Profile menu',
  8: 'Section essentials'        =>    'Essentials',  8: 'Section essentials'            =>    'Essentials',
  9: 'Section personal'            =>    'Personal',  9: 'Section personal'                =>    'Personal',
 10: 'Section messaging'            =>    'Messaging', 10: 'Section messaging'                =>    'Messaging',
 11: 'Section personality'        =>    'Personality', 11: 'Section personality'            =>    'Personality',
 12: 'Section display'            =>    'Display', 12: 'Section display'                =>    'Display',
 13: 'Section privacy'            =>    'Privacy', 13: 'Section privacy'                =>    'Privacy',
 14: 'Section admin'                =>    'Administration', 14: 'Section admin'                    =>    'Administration',
 15:  15: 
 16: // Miscellaneous 16: // Miscellaneous
 17: 'Username and pass legend'    =>    'Enter your username and password', 17: 'Username and pass legend'        =>    'Enter your username and password',
 18: 'Personal details legend'    =>    'Enter your personal details', 18: 'Personal details legend'        =>    'Enter your personal details',
 19: 'Contact details legend'    =>    'Enter your messaging details', 19: 'Contact details legend'        =>    'Enter your messaging details',
 20: 'Options display'            =>    'Set your display options', 20: 'User activity'                    =>    'User activity',
 21: 'Options post'                =>    'Set your post viewing options', 21: 'Paginate info'                    =>    'Enter the number of topics and posts you wish to view on each page.',
 22: 'User activity'                =>    'User activity', 
 23: 'Paginate info'                =>    'Enter the number of topics and posts you wish to view on each page.', 
 24:  22: 
 25: // Password stuff 23: // Password stuff
 26: 'Pass key bad'                =>    'The specified password activation key was incorrect or has expired. Please re-request a new password. If that fails, contact the forum administrator at', 24: 'Pass key bad'                    =>    'The specified password activation key was incorrect or has expired. Please re-request a new password. If that fails, contact the forum administrator at',
 27: 'Pass updated'                =>    'Your password has been updated. You can now login with your new password.', 25: 'Pass updated'                    =>    'Your password has been updated. You can now login with your new password.',
 28: 'Pass updated redirect'        =>    'Password updated. Redirecting &hellip;', 26: 'Pass updated redirect'            =>    'Password updated. Redirecting &hellip;',
 29: 'Wrong pass'                =>    'Wrong old password.', 27: 'Wrong pass'                    =>    'Wrong old password.',
 30: 'Change pass'                =>    'Change password', 28: 'Change pass'                    =>    'Change password',
 31: 'Change pass legend'        =>    'Enter and confirm your new password', 29: 'Change pass legend'            =>    'Enter and confirm your new password',
 32: 'Old pass'                    =>    'Old password', 30: 'Old pass'                        =>    'Old password',
 33: 'New pass'                    =>    'New password', 31: 'New pass'                        =>    'New password',
 34: 'Confirm new pass'            =>    'Confirm new password', 32: 'Confirm new pass'                =>    'Confirm new password',
 35:  33: 
 36: // E-mail stuff 34: // Email stuff
 37: 'E-mail key bad'            =>    'The specified e-mail activation key was incorrect or has expired. Please re-request change of e-mail address. If that fails, contact the forum administrator at', 35: 'Email key bad'                    =>    'The specified email activation key was incorrect or has expired. Please re-request change of email address. If that fails, contact the forum administrator at',
 38: 'E-mail updated'            =>    'Your e-mail address has been updated.', 36: 'Email updated'                    =>    'Your email address has been updated.',
 39: 'Activate e-mail sent'        =>    'An email has been sent to the specified address with instructions on how to activate the new e-mail address. If it doesn\'t arrive you can contact the forum administrator at', 37: 'Activate email sent'            =>    'An email has been sent to the specified address with instructions on how to activate the new email address. If it doesn\'t arrive you can contact the forum administrator at',
 40: 'E-mail legend'                =>    'Enter your new e-mail address', 38: 'Email legend'                    =>    'Enter your new email address',
 41: 'E-mail instructions'        =>    'An e-mail will be sent to your new address with an activation link. You must click the link in the e-mail you receive to activate the new address.', 39: 'Email instructions'            =>    'An email will be sent to your new address with an activation link. You must click the link in the email you receive to activate the new address.',
 42: 'Change e-mail'                =>    'Change e-mail address', 40: 'Change email'                    =>    'Change email address',
 43: 'New e-mail'                =>    'New e-mail', 41: 'New email'                        =>    'New email',
 44:  42: 
 45: // Avatar upload stuff 43: // Avatar upload stuff
 46: 'Avatars disabled'            =>    'The administrator has disabled avatar support.', 44: 'Avatars disabled'                =>    'The administrator has disabled avatar support.',
 47: 'Too large ini'                =>    'The selected file was too large to upload. The server didn\'t allow the upload.', 45: 'Too large ini'                    =>    'The selected file was too large to upload. The server didn\'t allow the upload.',
 48: 'Partial upload'            =>    'The selected file was only partially uploaded. Please try again.', 46: 'Partial upload'                =>    'The selected file was only partially uploaded. Please try again.',
 49: 'No tmp directory'            =>    'PHP was unable to save the uploaded file to a temporary location.', 47: 'No tmp directory'                =>    'PHP was unable to save the uploaded file to a temporary location.',
 50: 'No file'                    =>    'You did not select a file for upload.', 48: 'No file'                        =>    'You did not select a file for upload.',
 51: 'Bad type'                    =>    'The file you tried to upload is not of an allowed type. Allowed types are gif, jpeg and png.', 49: 'Bad type'                        =>    'The file you tried to upload is not of an allowed type. Allowed types are gif, jpeg and png.',
 52: 'Too wide or high'            =>    'The file you tried to upload is wider and/or higher than the maximum allowed', 50: 'Too wide or high'                =>    'The file you tried to upload is wider and/or higher than the maximum allowed',
 53: 'Too large'                    =>    'The file you tried to upload is larger than the maximum allowed', 51: 'Too large'                        =>    'The file you tried to upload is larger than the maximum allowed',
 54: 'pixels'                    =>    'pixels', 52: 'pixels'                        =>    'pixels',
 55: 'bytes'                        =>    'bytes', 53: 'bytes'                            =>    'bytes',
 56: 'Move failed'                =>    'The server was unable to save the uploaded file. Please contact the forum administrator at', 54: 'Move failed'                    =>    'The server was unable to save the uploaded file. Please contact the forum administrator at',
 57: 'Unknown failure'            =>    'An unknown error occurred. Please try again.', 55: 'Unknown failure'                =>    'An unknown error occurred. Please try again.',
 58: 'Avatar upload redirect'    =>    'Avatar uploaded. Redirecting &hellip;', 56: 'Avatar upload redirect'        =>    'Avatar uploaded. Redirecting &hellip;',
 59: 'Avatar deleted redirect'    =>    'Avatar deleted. Redirecting &hellip;', 57: 'Avatar deleted redirect'        =>    'Avatar deleted. Redirecting &hellip;',
 60: 'Avatar desc'                =>    'An avatar is a small image that will be displayed under your username in your posts. It must not be any bigger than', 58: 'Avatar desc'                    =>    'An avatar is a small image that will be displayed under your username in your posts. It must not be any bigger than',
 61: 'Upload avatar'                =>    'Upload avatar', 59: 'Upload avatar'                    =>    'Upload avatar',
 62: 'Upload avatar legend'        =>    'Enter an avatar file to upload', 60: 'Upload avatar legend'            =>    'Enter an avatar file to upload',
 63: 'Delete avatar'                =>    'Delete avatar',    // only for admins 61: 'Delete avatar'                    =>    'Delete avatar', // only for admins
 64: 'File'                        =>    'File', 62: 'File'                            =>    'File',
 65: 'Upload'                    =>    'Upload',    // submit button 63: 'Upload'                        =>    'Upload', // submit button
 66:  64: 
 67: // Form validation stuff 65: // Form validation stuff
 68: 'Dupe username'                =>    'Someone else has already registered with that username. Please go back and try a different username.', 66: 'Dupe username'                    =>    'Someone else has already registered with that username. Please go back and try a different username.',
 69: 'Forbidden title'            =>    'The title you entered contains a forbidden word. You must choose a different title.', 67: 'Forbidden title'                =>    'The title you entered contains a forbidden word. You must choose a different title.',
 70: 'Profile redirect'            =>    'Profile updated. Redirecting &hellip;', 68: 'Profile redirect'                =>    'Profile updated. Redirecting &hellip;',
 71:  69: 
 72: // Profile display stuff 70: // Profile display stuff
 73: 'Not activated'                =>    'This user hasn\'t activated his/her account yet. The account is activated when he/she logs in the first time.', 71: 'Users profile'                    =>    '%s\'s profile',
 74: 'Unknown'                    =>    '(Unknown)',    // This is displayed when a user hasn't filled out profile field (e.g. Location) 72: 'Unknown'                        =>    '(Unknown)', // This is displayed when a user hasn't filled out profile field (e.g. Location)
 75: 'Private'                    =>    '(Private)',    // This is displayed when a user does not want to receive e-mails 73: 'Private'                        =>    '(Private)', // This is displayed when a user does not want to receive emails
 76: 'No avatar'                    =>    '(No avatar)', 74: 'No avatar'                        =>    '(No avatar)',
 77: 'Show posts'                =>    'Show all posts', 75: 'Show posts'                    =>    'Show all posts',
 78: 'Realname'                    =>    'Real name', 76: 'Realname'                        =>    'Real name',
 79: 'Location'                    =>    'Location', 77: 'Location'                        =>    'Location',
 80: 'Website'                    =>    'Website', 78: 'Website'                        =>    'Website',
 81: 'Jabber'                    =>    'Jabber', 79: 'Jabber'                        =>    'Jabber',
 82: 'ICQ'                        =>    'ICQ', 80: 'ICQ'                            =>    'ICQ',
 83: 'MSN'                        =>    'MSN Messenger', 81: 'MSN'                            =>    'MSN Messenger',
 84: 'AOL IM'                    =>    'AOL IM', 82: 'AOL IM'                        =>    'AOL IM',
 85: 'Yahoo'                        =>    'Yahoo! Messenger', 83: 'Yahoo'                            =>    'Yahoo! Messenger',
 86: 'Avatar'                    =>    'Avatar', 84: 'Avatar'                        =>    'Avatar',
 87: 'Signature'                    =>    'Signature', 85: 'Signature'                        =>    'Signature',
 88: 'Sig max length'            =>    'Max length', 86: 'Sig max length'                =>    'Max length',
 89: 'Sig max lines'                =>    'Max lines', 87: 'Sig max lines'                    =>    'Max lines',
 90: 'Avatar legend'                =>    'Set your avatar display options', 88: 'Avatar legend'                    =>    'Set your avatar display options',
 91: 'Avatar info'                =>    'An avatar is a small image that will be displayed with all your posts. You can upload an avatar by clicking the link below.', 89: 'Avatar info'                    =>    'An avatar is a small image that will be displayed with all your posts. You can upload an avatar by clicking the link below.',
 92: 'Change avatar'                =>    'Change avatar', 90: 'Change avatar'                    =>    'Change avatar',
 93: 'Signature legend'            =>    'Compose your signature', 91: 'Signature legend'                =>    'Compose your signature',
 94: 'Signature info'            =>    'A signature is a small piece of text that is attached to your posts. In it, you can enter just about anything you like. Perhaps you would like to enter your favourite quote or your star sign. It\'s up to you! In your signature you can use BBCode if it is allowed in this particular forum. You can see the features that are allowed/enabled listed below whenever you edit your signature.', 92: 'Signature info'                =>    'A signature is a small piece of text that is attached to your posts. In it, you can enter just about anything you like. Perhaps you would like to enter your favourite quote or your star sign. It\'s up to you! In your signature you can use BBCode if it is allowed in this particular forum. You can see the features that are allowed/enabled listed below whenever you edit your signature.',
 95: 'Sig preview'                =>    'Current signature preview:', 93: 'Sig preview'                    =>    'Current signature preview:',
 96: 'No sig'                    =>    'No signature currently stored in profile.', 94: 'No sig'                        =>    'No signature currently stored in profile.',
 97: 'Signature quote/code/list'    =>    'The quote, code and list BBCodes are not allowed in signatures.', 95: 'Signature quote/code/list/h'    =>    'The quote, code, list, and heading BBCodes are not allowed in signatures.',
 98: 'Topics per page'            =>    'Topics', 96: 'Topics per page'                =>    'Topics',
 99: 'Topics per page info'        =>    'This setting controls how many topics are displayed per page when you view a forum. If you are uncertain about what to use, you can just leave it blank and the forum default will be used.', 97: 'Posts per page'                =>    'Posts',
100: 'Posts per page'            =>    'Posts', 98: 'Leave blank'                    =>    'Leave blank to use forum default.',
101: 'Posts per page info'        =>    'This setting controls how many posts are displayed per page when you view a topic. If you are uncertain about what to use, you can just leave it blank and the forum default will be used.', 99: 'Subscription legend'            =>    'Set your subscription options',
102: 'Leave blank'                =>    'Leave blank to use forum default.',100: 'Notify full'                    =>    'Include a plain text version of new posts in subscription notification emails.',
103: 'Subscription legend'                    =>    'Set your subscription options',101: 'Auto notify full'                =>    'Automatically subscribe to every topic you post in.',
104: 'Notify full'                =>    'Include post in subscription e-mails.',102: 'Show smilies'                    =>    'Show smilies as graphic icons',
105: 'Notify full info'            =>    'With this enabled, a plain text version of the new post will be included in subscription notification e-mails.',103: 'Show images'                    =>    'Show images in posts.',
106: 'Auto notify full'            =>    'Automatically subscribe to topics when posting.',104: 'Show images sigs'                =>    'Show images in user signatures.',
107: 'Auto notify full info'        =>    'With this enabled, you will automatically be subscribed to every topic you post in.',105: 'Show avatars'                    =>    'Show user avatars in posts.',
108: 'Show smilies'                =>    'Show smilies as graphic icons',106: 'Show sigs'                        =>    'Show user signatures.',
109: 'Show smilies info'            =>    'If you enable this option, small images will be displayed instead of text smilies.',107: 'Style legend'                    =>    'Select your preferred style',
110: 'Show images'                =>    'Show images in posts.',108: 'Style info'                    =>    'If you like you can use a different visual style for this forum.',
111: 'Show images info'            =>    'Disable this if you don\'t want to see images in posts (i.e. images displayed with the [img]-tag).',109: 'Admin note'                    =>    'Admin note',
112: 'Show images sigs'            =>    'Show images in user signatures.',110: 'Pagination legend'                =>    'Enter your pagination options',
113: 'Show images sigs info'        =>    'Disable this if you don\'t want to see images in signatures (i.e. images displayed with the [img]-tag).',111: 'Post display legend'            =>    'Set your options for viewing posts',
114: 'Show avatars'                =>    'Show user avatars in posts.',112: 'Post display info'                =>    'If you are on a slow connection, disabling these options, particularly showing images in posts and signatures, will make pages load faster.',
115: 'Show avatars info'            =>    'This option toggles whether user avatar images will be displayed in posts or not.',113: 'Instructions'                    =>    'When you update your profile, you will be redirected back to this page.',
116: 'Show sigs'                    =>    'Show user signatures.', 
117: 'Show sigs info'            =>    'Enable if you would like to see user signatures.', 
118: 'Style legend'                =>    'Select your preferred style', 
119: 'Style info'                =>    'If you like you can use a different visual style for this forum.', 
120: 'Admin note'                =>    'Admin note', 
121: 'Pagination legend'            =>    'Enter your pagination options', 
122: 'Post display legend'        =>    'Set your options for viewing posts', 
123: 'Post display info'            =>    'If you are on a slow connection, disabling these options, particularly showing images in posts and signatures, will make pages load faster.', 
124: 'Instructions'                =>    'When you update your profile, you will be redirected back to this page.', 
125: 114: 
126: // Administration stuff115: // Administration stuff
127: 'Group membership legend'    =>    'Choose user group',116: 'Group membership legend'        =>    'Choose user group',
128: 'Save'                        =>    'Save',117: 'Save'                            =>    'Save',
129: 'Set mods legend'            =>    'Set moderator access',118: 'Set mods legend'                =>    'Set moderator access',
130: 'Moderator in'                =>    'Moderator in',119: 'Moderator in info'                =>    'Choose what forums this user should be allowed to moderate. Note: This only applies to moderators. Administrators always have full permissions in all forums.',
131: 'Moderator in info'            =>    'Choose what forums this user should be allowed to moderate. Note: This only applies to moderators. Administrators always have full permissions in all forums.',120: 'Update forums'                    =>    'Update forums',
132: 'Update forums'                =>    'Update forums',121: 'Delete ban legend'                =>    'Delete (administrators only) or ban user',
133: 'Delete ban legend'            =>    'Delete (administrators only) or ban user',122: 'Delete user'                    =>    'Delete user',
134: 'Delete user'                =>    'Delete user',123: 'Ban user'                        =>    'Ban user',
135: 'Ban user'                    =>    'Ban user',124: 'Confirm delete legend'            =>    'Important: read before deleting user',
136: 'Confirm delete legend'        =>    'Important: read before deleting user',125: 'Confirm delete user'            =>    'Confirm delete user',
137: 'Confirm delete user'        =>    'Confirm delete user',126: 'Confirmation info'                =>    'Please confirm that you want to delete the user', // the username will be appended to this string
138: 'Confirmation info'            =>    'Please confirm that you want to delete the user',    // the username will be appended to this string127: 'Delete warning'                =>    'Warning! Deleted users and/or posts cannot be restored. If you choose not to delete the posts made by this user, the posts can only be deleted manually at a later time.',
139: 'Delete warning'            =>    'Warning! Deleted users and/or posts cannot be restored. If you choose not to delete the posts made by this user, the posts can only be deleted manually at a later time.',128: 'Delete posts'                    =>    'Delete any posts and topics this user has made.',
140: 'Delete posts'                =>    'Delete any posts and topics this user has made.',129: 'Delete'                        =>    'Delete', // submit button (confirm user delete)
141: 'Delete'                    =>    'Delete',        // submit button (confirm user delete)130: 'User delete redirect'            =>    'User deleted. Redirecting &hellip;',
142: 'User delete redirect'        =>    'User deleted. Redirecting &hellip;',131: 'Group membership redirect'        =>    'Group membership saved. Redirecting &hellip;',
143: 'Group membership redirect'    =>    'Group membership saved. Redirecting &hellip;',132: 'Update forums redirect'        =>    'Forum moderator rights updated. Redirecting &hellip;',
144: 'Update forums redirect'    =>    'Forum moderator rights updated. Redirecting &hellip;',133: 'Ban redirect'                    =>    'Redirecting &hellip;'
145: 'Ban redirect'                =>    'Redirecting &hellip;' 
146: 134: 
147: );135: );


a/upload/lang/English/register.php b/upload/lang/English/register.php
 14: 'Register'                    =>    'Register', 14: 'Register'                    =>    'Register',
 15:  15: 
 16: // Form validation stuff (some of these are also used in post.php) 16: // Form validation stuff (some of these are also used in post.php)
 17: 'Registration errors'            =>    'Registration errors', 17: 'Registration errors'        =>    'Registration errors',
 18: 'Registration errors info'        =>    'The following errors need to be corrected before you can register:', 18: 'Registration errors info'    =>    'The following errors need to be corrected before you can register:',
 19: 'Username censor'            =>    'The username you entered contains one or more censored words. Please choose a different username.', 19: 'Username censor'            =>    'The username you entered contains one or more censored words. Please choose a different username.',
 20: 'Username dupe 1'            =>    'Someone is already registered with the username', 20: 'Username dupe 1'            =>    'Someone is already registered with the username',
 21: 'Username dupe 2'            =>    'The username you entered is too similar. The username must differ from that by at least one alphanumerical character (a-z or 0-9). Please choose a different username.', 21: 'Username dupe 2'            =>    'The username you entered is too similar. The username must differ from that by at least one alphanumerical character (a-z or 0-9). Please choose a different username.',
 22: 'E-mail not match'            =>    'E-mail addresses do not match.', 22: 'Email not match'            =>    'Email addresses do not match.',
 23:  23: 
 24: // Registration e-mail stuff 24: // Registration email stuff
 25: 'Reg e-mail'                =>    'Thank you for registering. Your password has been sent to the specified address. If it doesn\'t arrive you can contact the forum administrator at', 25: 'Reg email'                    =>    'Thank you for registering. Your password has been sent to the specified address. If it doesn\'t arrive you can contact the forum administrator at',
 26: 'Reg complete'                =>    'Registration complete. Logging in and redirecting &hellip;', 26: 'Reg complete'                =>    'Registration complete. Logging in and redirecting &hellip;',
 27:  27: 
 28: // Register info 28: // Register info
 29: 'Desc 1'                    =>    'Registration will grant you access to a number of features and capabilities otherwise unavailable. These functions include the ability to edit and delete posts, design your own signature that accompanies your posts and much more. If you have any questions regarding this forum you should ask an administrator.', 29: 'Desc 1'                    =>    'Registration will grant you access to a number of features and capabilities otherwise unavailable. These functions include the ability to edit and delete posts, design your own signature that accompanies your posts and much more. If you have any questions regarding this forum you should ask an administrator.',
 30: 'Desc 2'                    =>    'Below is a form you must fill out in order to register. Once you are registered you should visit your profile and review the different settings you can change. The fields below only make up a small part of all the settings you can alter in your profile.', 30: 'Desc 2'                    =>    'Below is a form you must fill out in order to register. Once you are registered you should visit your profile and review the different settings you can change. The fields below only make up a small part of all the settings you can alter in your profile.',
 31: 'Username legend'            =>    'Please enter a username between 2 and 25 characters long', 31: 'Username legend'            =>    'Please enter a username between 2 and 25 characters long',
 32: 'Pass legend 1'                =>    'Please enter and confirm your chosen password', 32: 'Pass legend'                =>    'Please enter and confirm your chosen password',
 33: 'Pass legend 2'                =>    'Please read the instructions below', 
 34: 'Pass info'                    =>    'Passwords can be between 4 and 16 characters long. Passwords are case sensitive.', 33: 'Pass info'                    =>    'Passwords can be between 4 and 16 characters long. Passwords are case sensitive.',
 35: 'E-mail info'                =>    'You must enter a valid e-mail address as your randomly generated password will be sent to that address.', 34: 'Email info'                =>    'You must enter a valid email address as your randomly generated password will be sent to that address.',
 36: 'Confirm e-mail'            =>    'Confirm e-mail address', 35: 'Confirm email'                =>    'Confirm email address',
 37:  36: 
 38: ); 37: );


a/upload/lang/English/search.php b/upload/lang/English/search.php
 43: 'No new posts'                =>    'There are no topics with new posts since your last visit.', 43: 'No new posts'                =>    'There are no topics with new posts since your last visit.',
 44: 'No recent posts'            =>    'No new posts have been made within the last 24 hours.', 44: 'No recent posts'            =>    'No new posts have been made within the last 24 hours.',
 45: 'No unanswered'                =>    'There are no unanswered posts in this forum.', 45: 'No unanswered'                =>    'There are no unanswered posts in this forum.',
 46: 'Go to post'                =>    'Go to post' 46: 'Go to post'                =>    'Go to post',
  47: 'Go to topic'                =>    'Go to topic'
 47:  48: 
 48: ); 49: );


a/upload/lang/English/topic.php b/upload/lang/English/topic.php
  5:   5: 
  6: 'Post reply'        =>    'Post reply',  6: 'Post reply'        =>    'Post reply',
  7: 'Topic closed'        =>    'Topic closed',  7: 'Topic closed'        =>    'Topic closed',
  8: 'From'                =>    'From',                // User location  8: 'From'                =>    'From', // User location
  9: 'IP'                =>    'IP',                  9: 'IP'                =>    'IP',
 10: 'Note'                =>    'Note',                // Admin note 10: 'Note'                =>    'Note', // Admin note
 11: 'Website'            =>    'Website', 11: 'Website'            =>    'Website',
 12: 'Guest'                =>    'Guest', 12: 'Guest'                =>    'Guest',
 13: 'Online'            =>    'Online', 13: 'Online'            =>    'Online',
 21: 'Unsubscribe'        =>    'Unsubscribe', 21: 'Unsubscribe'        =>    'Unsubscribe',
 22: 'Subscribe'            =>    'Subscribe to this topic', 22: 'Subscribe'            =>    'Subscribe to this topic',
 23: 'Quick post'        =>    'Quick post', 23: 'Quick post'        =>    'Quick post',
 24:  
 25: 'Link separator'    =>    ' | ',    // The text that separates links in posts (website, e-mail, report, edit etc.) 
 26: 'Mod controls'        =>    'Moderator controls' 24: 'Mod controls'        =>    'Moderator controls'
 27:  25: 
 28: ); 26: );


a/upload/lang/English/userlist.php b/upload/lang/English/userlist.php
  3: // Language definitions used in userlist.php  3: // Language definitions used in userlist.php
  4: $lang_ul = array(  4: $lang_ul = array(
  5:   5: 
  6: 'User find legend'        =>    'Find and sort users',  6: 'User find legend'    =>    'Find and sort users',
  7: 'User search info'        =>    'Enter a username to search for and/or a user group to filter by. The username field can be left blank. Use the wildcard character * for partial matches. Sort users by name, date registered or number of posts and in ascending/descending order.',  7: 'User search info'    =>    'Enter a username to search for and/or a user group to filter by. The username field can be left blank. Use the wildcard character * for partial matches. Sort users by name, date registered or number of posts and in ascending/descending order.',
  8: 'User group'            =>    'User group',  8: 'User group'        =>    'User group',
  9: 'No of posts'            =>    'No. of posts',  9: 'No of posts'        =>    'No. of posts',
 10: 'All users'                =>    'All' 10: 'All users'            =>    'All'
 11:  11: 
 12: ); 12: );


a/upload/login.php b/upload/login.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: if (isset($_GET['action'])) 11: if (isset($_GET['action']))
 27:     define('PUN_QUIET_VISIT', 1); 12:     define('PUN_QUIET_VISIT', 1);
 43:  28: 
 44:     $username_sql = ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') ? 'username=\''.$db->escape($form_username).'\'' : 'LOWER(username)=LOWER(\''.$db->escape($form_username).'\')'; 29:     $username_sql = ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') ? 'username=\''.$db->escape($form_username).'\'' : 'LOWER(username)=LOWER(\''.$db->escape($form_username).'\')';
 45:  30: 
 46:     $result = $db->query('SELECT id, group_id, password FROM '.$db->prefix.'users WHERE '.$username_sql) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 31:     $result = $db->query('SELECT * FROM '.$db->prefix.'users WHERE '.$username_sql) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
 47:     list($user_id, $group_id, $db_password_hash) = $db->fetch_row($result); 32:     $cur_user = $db->fetch_assoc($result);
 48:  33: 
 49:     $authorized = false; 34:     $authorized = false;
 50:  35: 
 51:     if (!empty($db_password_hash)) 36:     if (!empty($cur_user['password']))
 52:     { 37:     {
 53:         $sha1_in_db = (strlen($db_password_hash) == 40) ? true : false; 38:         $sha1_in_db = (strlen($cur_user['password']) == 40) ? true : false;
 54:         $sha1_available = (function_exists('sha1') || function_exists('mhash')) ? true : false; 39:         $sha1_available = (function_exists('sha1') || function_exists('mhash')) ? true : false;
 55:  40: 
 56:         $form_password_hash = pun_hash($form_password);    // This could result in either an SHA-1 or an MD5 hash (depends on $sha1_available) 41:         $form_password_hash = pun_hash($form_password); // This could result in either an SHA-1 or an MD5 hash (depends on $sha1_available)
 57:  42: 
 58:         if ($sha1_in_db && $sha1_available && $db_password_hash == $form_password_hash) 43:         // If there is a salt in the database we have upgraded from 1.3-legacy though havent yet logged in
 59:             $authorized = true; 44:         if (!empty($cur_user['salt']))
 60:         else if (!$sha1_in_db && $db_password_hash == md5($form_password)) 
 61:         { 45:         {
 62:             $authorized = true; 46:             if (sha1($cur_user['salt'].sha1($form_password)) == $cur_user['password'])
  47:             {
  48:                 $authorized = true;
 63:  49: 
 64:             if ($sha1_available)    // There's an MD5 hash in the database, but SHA1 hashing is available, so we update the DB 50:                 $db->query('UPDATE '.$db->prefix.'users SET password=\''.$form_password_hash.'\', salt=NULL WHERE id='.$cur_user['id']) or error('Unable to update user password', __FILE__, __LINE__, $db->error());
 65:                 $db->query('UPDATE '.$db->prefix.'users SET password=\''.$form_password_hash.'\' WHERE id='.$user_id) or error('Unable to update user password', __FILE__, __LINE__, $db->error()); 51:             }
  52:         }
  53:         else
  54:         {
  55:             if ($sha1_in_db && $sha1_available && $cur_user['password'] == $form_password_hash)
  56:                 $authorized = true;
  57:             else if (!$sha1_in_db && $cur_user['password'] == md5($form_password))
  58:             {
  59:                 $authorized = true;
  60: 
  61:                 if ($sha1_available) // There's an MD5 hash in the database, but SHA1 hashing is available, so we update the DB
  62:                     $db->query('UPDATE '.$db->prefix.'users SET password=\''.$form_password_hash.'\' WHERE id='.$cur_user['id']) or error('Unable to update user password', __FILE__, __LINE__, $db->error());
  63:             }
 66:         } 64:         }
 67:     } 65:     }
 68:  66: 
 70:         message($lang_login['Wrong user/pass'].' <a href="login.php?action=forget">'.$lang_login['Forgotten pass'].'</a>'); 68:         message($lang_login['Wrong user/pass'].' <a href="login.php?action=forget">'.$lang_login['Forgotten pass'].'</a>');
 71:  69: 
 72:     // Update the status if this is the first time the user logged in 70:     // Update the status if this is the first time the user logged in
 73:     if ($group_id == PUN_UNVERIFIED) 71:     if ($cur_user['group_id'] == PUN_UNVERIFIED)
 74:         $db->query('UPDATE '.$db->prefix.'users SET group_id='.$pun_config['o_default_user_group'].' WHERE id='.$user_id) or error('Unable to update user status', __FILE__, __LINE__, $db->error()); 72:         $db->query('UPDATE '.$db->prefix.'users SET group_id='.$pun_config['o_default_user_group'].' WHERE id='.$cur_user['id']) or error('Unable to update user status', __FILE__, __LINE__, $db->error());
 75:  73: 
 76:     // Remove this users guest entry from the online list 74:     // Remove this users guest entry from the online list
 77:     $db->query('DELETE FROM '.$db->prefix.'online WHERE ident=\''.$db->escape(get_remote_address()).'\'') or error('Unable to delete from online list', __FILE__, __LINE__, $db->error()); 75:     $db->query('DELETE FROM '.$db->prefix.'online WHERE ident=\''.$db->escape(get_remote_address()).'\'') or error('Unable to delete from online list', __FILE__, __LINE__, $db->error());
 78:  76: 
 79:     $expire = ($save_pass == '1') ? time() + 1209600 : time() + $pun_config['o_timeout_visit']; 77:     $expire = ($save_pass == '1') ? time() + 1209600 : time() + $pun_config['o_timeout_visit'];
 80:     pun_setcookie($user_id, $form_password_hash, $expire); 78:     pun_setcookie($cur_user['id'], $form_password_hash, $expire);
 81:  79: 
 82:     // Reset tracked topics 80:     // Reset tracked topics
 83:     set_tracked_topics(null); 81:     set_tracked_topics(null);
 94:         exit; 92:         exit;
 95:     } 93:     }
 96:  94: 
 97:     // Remove user from "users online" list. 95:     // Remove user from "users online" list
 98:     $db->query('DELETE FROM '.$db->prefix.'online WHERE user_id='.$pun_user['id']) or error('Unable to delete from online list', __FILE__, __LINE__, $db->error()); 96:     $db->query('DELETE FROM '.$db->prefix.'online WHERE user_id='.$pun_user['id']) or error('Unable to delete from online list', __FILE__, __LINE__, $db->error());
 99:  97: 
100:     // Update last_visit (make sure there's something to update it with) 98:     // Update last_visit (make sure there's something to update it with)
116:     {114:     {
117:         require PUN_ROOT.'include/email.php';115:         require PUN_ROOT.'include/email.php';
118: 116: 
119:         // Validate the email-address117:         // Validate the email address
120:         $email = strtolower(trim($_POST['req_email']));118:         $email = strtolower(trim($_POST['req_email']));
121:         if (!is_valid_email($email))119:         if (!is_valid_email($email))
122:             message($lang_common['Invalid e-mail']);120:             message($lang_common['Invalid email']);
123: 121: 
124:         $result = $db->query('SELECT id, username, last_email_sent FROM '.$db->prefix.'users WHERE email=\''.$db->escape($email).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());122:         $result = $db->query('SELECT id, username, last_email_sent FROM '.$db->prefix.'users WHERE email=\''.$db->escape($email).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
125: 123: 
133:             $mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8));131:             $mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8));
134:             $mail_message = trim(substr($mail_tpl, $first_crlf));132:             $mail_message = trim(substr($mail_tpl, $first_crlf));
135: 133: 
136:             // Do the generic replacements first (they apply to all e-mails sent out here)134:             // Do the generic replacements first (they apply to all emails sent out here)
137:             $mail_message = str_replace('<base_url>', $pun_config['o_base_url'].'/', $mail_message);135:             $mail_message = str_replace('<base_url>', $pun_config['o_base_url'].'/', $mail_message);
138:             $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message);136:             $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message);
139: 137: 
160:             message($lang_login['Forget mail'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.');158:             message($lang_login['Forget mail'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.');
161:         }159:         }
162:         else160:         else
163:             message($lang_login['No e-mail match'].' '.htmlspecialchars($email).'.');161:             message($lang_login['No email match'].' '.htmlspecialchars($email).'.');
164:     }162:     }
165: 163: 
166: 164: 
167:     $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_login['Request pass'];165:     $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_login['Request pass'];
168:     $required_fields = array('req_email' => $lang_common['E-mail']);166:     $required_fields = array('req_email' => $lang_common['Email']);
169:     $focus_element = array('request_pass', 'req_email');167:     $focus_element = array('request_pass', 'req_email');
170:     require PUN_ROOT.'header.php';168:     require PUN_ROOT.'header.php';
171: 169: 
184:                     </div>182:                     </div>
185:                 </fieldset>183:                 </fieldset>
186:             </div>184:             </div>
187:             <p><input type="submit" name="request_pass" value="<?php echo $lang_common['Submit'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>185:             <p class="buttons"><input type="submit" name="request_pass" value="<?php echo $lang_common['Submit'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
188:         </form>186:         </form>
189:     </div>187:     </div>
190: </div>188: </div>
198:     header('Location: index.php');196:     header('Location: index.php');
199: 197: 
200: // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to index.php after login)198: // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to index.php after login)
201: $redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php';199: $redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : $pun_config['o_base_url'].'/index.php';
202: 200: 
203: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Login'];201: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Login'];
204: $required_fields = array('req_username' => $lang_common['Username'], 'req_password' => $lang_common['Password']);202: $required_fields = array('req_username' => $lang_common['Username'], 'req_password' => $lang_common['Password']);
213:             <div class="inform">211:             <div class="inform">
214:                 <fieldset>212:                 <fieldset>
215:                     <legend><?php echo $lang_login['Login legend'] ?></legend>213:                     <legend><?php echo $lang_login['Login legend'] ?></legend>
216:                         <div class="infldset">214:                     <div class="infldset">
217:                             <input type="hidden" name="form_sent" value="1" />215:                         <input type="hidden" name="form_sent" value="1" />
218:                             <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" />216:                         <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" />
219:                             <label class="conl"><strong><?php echo $lang_common['Username'] ?></strong><br /><input type="text" name="req_username" size="25" maxlength="25" tabindex="1" /><br /></label>217:                         <label class="conl"><strong><?php echo $lang_common['Username'] ?></strong><br /><input type="text" name="req_username" size="25" maxlength="25" tabindex="1" /><br /></label>
220:                             <label class="conl"><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password" size="16" maxlength="16" tabindex="2" /><br /></label>218:                         <label class="conl"><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password" size="25" tabindex="2" /><br /></label>
221: 219: 
222:                             <div class="rbox clearb">220:                         <div class="rbox clearb">
223:                                 <label><input type="checkbox" name="save_pass" value="1" tabindex="3" /><?php echo $lang_login['Remember me'] ?> <br /></label>221:                             <label><input type="checkbox" name="save_pass" value="1" tabindex="3" /><?php echo $lang_login['Remember me'] ?> <br /></label>
224:                             </div> 
225:  
226:                             <p class="clearb"><?php echo $lang_login['Login info'] ?></p> 
227:                             <p><a href="register.php" tabindex="4"><?php echo $lang_login['Not registered'] ?></a>&nbsp;&nbsp; 
228:                             <a href="login.php?action=forget" tabindex="5"><?php echo $lang_login['Forgotten pass'] ?></a></p> 
229:                         </div>222:                         </div>
 223: 
 224:                         <p class="clearb"><?php echo $lang_login['Login info'] ?></p>
 225:                         <p><a href="register.php" tabindex="4"><?php echo $lang_login['Not registered'] ?></a>&nbsp;&nbsp;
 226:                         <a href="login.php?action=forget" tabindex="5"><?php echo $lang_login['Forgotten pass'] ?></a></p>
 227:                     </div>
230:                 </fieldset>228:                 </fieldset>
231:             </div>229:             </div>
232:             <p><input type="submit" name="login" value="<?php echo $lang_common['Login'] ?>" tabindex="3" /></p>230:             <p class="buttons"><input type="submit" name="login" value="<?php echo $lang_common['Login'] ?>" tabindex="3" /></p>
233:         </form>231:         </form>
234:     </div>232:     </div>
235: </div>233: </div>


a/upload/misc.php b/upload/misc.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: if (isset($_GET['action'])) 11: if (isset($_GET['action']))
 27:     define('PUN_QUIET_VISIT', 1); 12:     define('PUN_QUIET_VISIT', 1);
 51: <div class="block"> 36: <div class="block">
 52:     <h2><span><?php echo $lang_register['Forum rules'] ?></span></h2> 37:     <h2><span><?php echo $lang_register['Forum rules'] ?></span></h2>
 53:     <div class="box"> 38:     <div class="box">
 54:         <div class="inbox"> 39:         <div id="rules-block" class="inbox">
 55:             <p><?php echo $pun_config['o_rules_message'] ?></p> 40:             <div class="usercontent"><?php echo $pun_config['o_rules_message'] ?></div>
 56:         </div> 41:         </div>
 57:     </div> 42:     </div>
 58: </div> 43: </div>
110:     list($recipient, $recipient_email, $email_setting) = $db->fetch_row($result); 95:     list($recipient, $recipient_email, $email_setting) = $db->fetch_row($result);
111:  96: 
112:     if ($email_setting == 2 && !$pun_user['is_admmod']) 97:     if ($email_setting == 2 && !$pun_user['is_admmod'])
113:         message($lang_misc['Form e-mail disabled']); 98:         message($lang_misc['Form email disabled']);
114:  99: 
115: 100: 
116:     if (isset($_POST['form_sent']))101:     if (isset($_POST['form_sent']))
120:         $message = pun_trim($_POST['req_message']);105:         $message = pun_trim($_POST['req_message']);
121: 106: 
122:         if ($subject == '')107:         if ($subject == '')
123:             message($lang_misc['No e-mail subject']);108:             message($lang_misc['No email subject']);
124:         else if ($message == '')109:         else if ($message == '')
125:             message($lang_misc['No e-mail message']);110:             message($lang_misc['No email message']);
126:         else if (strlen($message) > 65535)111:         else if (strlen($message) > 65535)
127:             message($lang_misc['Too long e-mail message']);112:             message($lang_misc['Too long email message']);
128: 113: 
129:         if ($pun_user['last_email_sent'] != '' && (time() - $pun_user['last_email_sent']) < $pun_user['g_email_flood'] && (time() - $pun_user['last_email_sent']) >= 0)114:         if ($pun_user['last_email_sent'] != '' && (time() - $pun_user['last_email_sent']) < $pun_user['g_email_flood'] && (time() - $pun_user['last_email_sent']) >= 0)
130:             message(sprintf($lang_misc['Email flood'], $pun_user['g_email_flood']));115:             message(sprintf($lang_misc['Email flood'], $pun_user['g_email_flood']));
131: 116: 
132:         // Load the "form e-mail" template117:         // Load the "form email" template
133:         $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/form_email.tpl'));118:         $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/form_email.tpl'));
134: 119: 
135:         // The first row contains the subject120:         // The first row contains the subject
149: 134: 
150:         $db->query('UPDATE '.$db->prefix.'users SET last_email_sent='.time().' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());135:         $db->query('UPDATE '.$db->prefix.'users SET last_email_sent='.time().' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
151: 136: 
152:         redirect(htmlspecialchars($_POST['redirect_url']), $lang_misc['E-mail sent redirect']);137:         redirect(htmlspecialchars($_POST['redirect_url']), $lang_misc['Email sent redirect']);
153:     }138:     }
154: 139: 
155: 140: 
156:     // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to the users profile after the e-mail is sent)141:     // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to the users profile after the email is sent)
157:     $redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php';142:     $redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php';
158: 143: 
159:     $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_misc['Send e-mail to'].' '.pun_htmlspecialchars($recipient);144:     $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_misc['Send email to'].' '.pun_htmlspecialchars($recipient);
160:     $required_fields = array('req_subject' => $lang_misc['E-mail subject'], 'req_message' => $lang_misc['E-mail message']);145:     $required_fields = array('req_subject' => $lang_misc['Email subject'], 'req_message' => $lang_misc['Email message']);
161:     $focus_element = array('email', 'req_subject');146:     $focus_element = array('email', 'req_subject');
162:     require PUN_ROOT.'header.php';147:     require PUN_ROOT.'header.php';
163: 148: 
164: ?>149: ?>
165: <div class="blockform">150: <div class="blockform">
166:     <h2><span><?php echo $lang_misc['Send e-mail to'] ?> <?php echo pun_htmlspecialchars($recipient) ?></span></h2>151:     <h2><span><?php echo $lang_misc['Send email to'] ?> <?php echo pun_htmlspecialchars($recipient) ?></span></h2>
167:     <div class="box">152:     <div class="box">
168:         <form id="email" method="post" action="misc.php?email=<?php echo $recipient_id ?>" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">153:         <form id="email" method="post" action="misc.php?email=<?php echo $recipient_id ?>" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">
169:             <div class="inform">154:             <div class="inform">
170:                 <fieldset>155:                 <fieldset>
171:                     <legend><?php echo $lang_misc['Write e-mail'] ?></legend>156:                     <legend><?php echo $lang_misc['Write email'] ?></legend>
172:                     <div class="infldset txtarea">157:                     <div class="infldset txtarea">
173:                         <input type="hidden" name="form_sent" value="1" />158:                         <input type="hidden" name="form_sent" value="1" />
174:                         <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" />159:                         <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" />
175:                         <label><strong><?php echo $lang_misc['E-mail subject'] ?></strong><br />160:                         <label><strong><?php echo $lang_misc['Email subject'] ?></strong><br />
176:                         <input class="longinput" type="text" name="req_subject" size="75" maxlength="70" tabindex="1" /><br /></label>161:                         <input class="longinput" type="text" name="req_subject" size="75" maxlength="70" tabindex="1" /><br /></label>
177:                         <label><strong><?php echo $lang_misc['E-mail message'] ?></strong><br />162:                         <label><strong><?php echo $lang_misc['Email message'] ?></strong><br />
178:                         <textarea name="req_message" rows="10" cols="75" tabindex="2"></textarea><br /></label>163:                         <textarea name="req_message" rows="10" cols="75" tabindex="2"></textarea><br /></label>
179:                         <p><?php echo $lang_misc['E-mail disclosure note'] ?></p>164:                         <p><?php echo $lang_misc['Email disclosure note'] ?></p>
180:                     </div>165:                     </div>
181:                 </fieldset>166:                 </fieldset>
182:             </div>167:             </div>
183:             <p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="3" accesskey="s" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>168:             <p class="buttons"><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="3" accesskey="s" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
184:         </form>169:         </form>
185:     </div>170:     </div>
186: </div>171: </div>
205:         $reason = pun_linebreaks(pun_trim($_POST['req_reason']));190:         $reason = pun_linebreaks(pun_trim($_POST['req_reason']));
206:         if ($reason == '')191:         if ($reason == '')
207:             message($lang_misc['No reason']);192:             message($lang_misc['No reason']);
208:             193: 
209:         if ($pun_user['last_email_sent'] != '' && (time() - $pun_user['last_email_sent']) < $pun_user['g_email_flood'] && (time() - $pun_user['last_email_sent']) >= 0)194:         if ($pun_user['last_email_sent'] != '' && (time() - $pun_user['last_email_sent']) < $pun_user['g_email_flood'] && (time() - $pun_user['last_email_sent']) >= 0)
210:             message(sprintf($lang_misc['Report flood'], $pun_user['g_email_flood']));195:             message(sprintf($lang_misc['Report flood'], $pun_user['g_email_flood']));
211: 196: 
227:         if ($pun_config['o_report_method'] == 0 || $pun_config['o_report_method'] == 2)212:         if ($pun_config['o_report_method'] == 0 || $pun_config['o_report_method'] == 2)
228:             $db->query('INSERT INTO '.$db->prefix.'reports (post_id, topic_id, forum_id, reported_by, created, message) VALUES('.$post_id.', '.$topic_id.', '.$forum_id.', '.$pun_user['id'].', '.time().', \''.$db->escape($reason).'\')' ) or error('Unable to create report', __FILE__, __LINE__, $db->error());213:             $db->query('INSERT INTO '.$db->prefix.'reports (post_id, topic_id, forum_id, reported_by, created, message) VALUES('.$post_id.', '.$topic_id.', '.$forum_id.', '.$pun_user['id'].', '.time().', \''.$db->escape($reason).'\')' ) or error('Unable to create report', __FILE__, __LINE__, $db->error());
229: 214: 
230:         // Should we e-mail the report?215:         // Should we email the report?
231:         if ($pun_config['o_report_method'] == 1 || $pun_config['o_report_method'] == 2)216:         if ($pun_config['o_report_method'] == 1 || $pun_config['o_report_method'] == 2)
232:         {217:         {
233:             // We send it to the complete mailing-list in one swoop218:             // We send it to the complete mailing-list in one swoop
234:             if ($pun_config['o_mailing_list'] != '')219:             if ($pun_config['o_mailing_list'] != '')
235:             {            220:             {
236:                 $mail_subject = sprintf($lang_common['Report notification'], $forum_id, $subject);221:                 $mail_subject = sprintf($lang_common['Report notification'], $forum_id, $subject);
237:                 $mail_message = sprintf($lang_common['Report message 1'], $pun_user['username'], $pun_config['o_base_url'].'/viewtopic.php?pid='.$post_id.'#p'.$post_id)."\n";222:                 $mail_message = sprintf($lang_common['Report message 1'], $pun_user['username'], $pun_config['o_base_url'].'/viewtopic.php?pid='.$post_id.'#p'.$post_id)."\n";
238:                 $mail_message .= sprintf($lang_common['Report message 2'], $reason)."\n";223:                 $mail_message .= sprintf($lang_common['Report message 2'], $reason)."\n";
243:                 pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message);228:                 pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message);
244:             }229:             }
245:         }230:         }
246:         231: 
247:         $db->query('UPDATE '.$db->prefix.'users SET last_email_sent='.time().' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());232:         $db->query('UPDATE '.$db->prefix.'users SET last_email_sent='.time().' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
248: 233: 
249:         redirect('viewtopic.php?pid='.$post_id.'#p'.$post_id, $lang_misc['Report redirect']);234:         redirect('viewtopic.php?pid='.$post_id.'#p'.$post_id, $lang_misc['Report redirect']);
269:                     </div>254:                     </div>
270:                 </fieldset>255:                 </fieldset>
271:             </div>256:             </div>
272:             <p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>257:             <p class="buttons"><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
273:         </form>258:         </form>
274:     </div>259:     </div>
275: </div>260: </div>


a/upload/moderate.php b/upload/moderate.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: define('PUN_ROOT', './'); 11: define('PUN_ROOT', './');
 27: require PUN_ROOT.'include/common.php'; 12: require PUN_ROOT.'include/common.php';
 28:  13: 
 29:  14: 
 30: // This particular function doesn't require forum-based moderator access. It can be used 15: // This particular function doesn't require forum-based moderator access. It can be used
 31: // by all moderators and admins. 16: // by all moderators and admins
 32: if (isset($_GET['get_host'])) 17: if (isset($_GET['get_host']))
 33: { 18: {
 34:     if (!$pun_user['is_admmod']) 19:     if (!$pun_user['is_admmod'])
 75: require PUN_ROOT.'lang/'.$pun_user['language'].'/misc.php'; 60: require PUN_ROOT.'lang/'.$pun_user['language'].'/misc.php';
 76:  61: 
 77:  62: 
 78: // All other topic moderation features require a topic id in GET 63: // All other topic moderation features require a topic ID in GET
 79: if (isset($_GET['tid'])) 64: if (isset($_GET['tid']))
 80: { 65: {
 81:     $tid = intval($_GET['tid']); 66:     $tid = intval($_GET['tid']);
148:                     </div>133:                     </div>
149:                 </fieldset>134:                 </fieldset>
150:             </div>135:             </div>
151:             <p><input type="submit" name="delete_posts_comply" value="<?php echo $lang_misc['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>136:             <p class="buttons"><input type="submit" name="delete_posts_comply" value="<?php echo $lang_misc['Delete'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
152:         </form>137:         </form>
153:     </div>138:     </div>
154: </div>139: </div>
234:                     </div>219:                     </div>
235:                 </fieldset>220:                 </fieldset>
236:             </div>221:             </div>
237:             <p><input type="submit" name="split_posts_comply" value="<?php echo $lang_misc['Split'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>222:             <p class="buttons"><input type="submit" name="split_posts_comply" value="<?php echo $lang_misc['Split'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
238:         </form>223:         </form>
239:     </div>224:     </div>
240: </div>225: </div>
273: ?>258: ?>
274: <div class="linkst">259: <div class="linkst">
275:     <div class="inbox">260:     <div class="inbox">
 261:         <ul class="crumbs">
 262:             <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
 263:             <li>&raquo;&nbsp;<a href="viewforum.php?id=<?php echo $fid ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li>
 264:             <li>&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_topic['subject']) ?></li>
 265:         </ul>
276:         <p class="pagelink conl"><?php echo $paging_links ?></p>266:         <p class="pagelink conl"><?php echo $paging_links ?></p>
277:         <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li>&nbsp;&raquo;&nbsp;<a href="viewforum.php?id=<?php echo $fid ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li><li>&nbsp;&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_topic['subject']) ?></li></ul> 
278:         <div class="clearer"></div>267:         <div class="clearer"></div>
279:     </div>268:     </div>
280: </div>269: </div>
284: 273: 
285:     require PUN_ROOT.'include/parser.php';274:     require PUN_ROOT.'include/parser.php';
286: 275: 
287:     $bg_switch = true;    // Used for switching background color in posts276:     $post_count = 0; // Keep track of post numbers
288:     $post_count = 0;    // Keep track of post numbers 
289: 277: 
290:     // Retrieve the posts (and their respective poster)278:     // Retrieve the posts (and their respective poster)
291:     $result = $db->query('SELECT u.title, u.num_posts, g.g_id, g.g_user_title, p.id, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE p.topic_id='.$tid.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());279:     $result = $db->query('SELECT u.title, u.num_posts, g.g_id, g.g_user_title, p.id, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE p.topic_id='.$tid.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
294:     {282:     {
295:         $post_count++;283:         $post_count++;
296: 284: 
297:         // If the poster is a registered user.285:         // If the poster is a registered user
298:         if ($cur_post['poster_id'] > 1)286:         if ($cur_post['poster_id'] > 1)
299:         {287:         {
300:             if ($pun_user['g_view_users'] == '1')288:             if ($pun_user['g_view_users'] == '1')
316:             $user_title = $lang_topic['Guest'];304:             $user_title = $lang_topic['Guest'];
317:         }305:         }
318: 306: 
319:         // Switch the background color for every message. 
320:         $bg_switch = ($bg_switch) ? $bg_switch = false : $bg_switch = true; 
321:         $vtbg = ($bg_switch) ? ' roweven' : ' rowodd'; 
322:  
323:         // Perform the main parsing of the message (BBCode, smilies, censor words etc)307:         // Perform the main parsing of the message (BBCode, smilies, censor words etc)
324:         $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);308:         $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
325: 309: 
326: ?>310: ?>
327: 311: 
328: <div class="blockpost<?php echo $vtbg ?>">312: <div id="p<?php echo $cur_post['id'] ?>" class="blockpost<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?>">
329:     <a name="<?php echo $cur_post['id'] ?>"></a>313:     <h2><span><span class="conr">#<?php echo ($start_from + $post_count) ?></span> <a href="viewtopic.php?pid=<?php echo $cur_post['id'].'#p'.$cur_post['id'] ?>"><?php echo format_time($cur_post['posted']) ?></a></span></h2>
330:     <h2><span><span class="conr">#<?php echo ($start_from + $post_count) ?>&nbsp;</span><a href="viewtopic.php?pid=<?php echo $cur_post['id'].'#p'.$cur_post['id'] ?>"><?php echo format_time($cur_post['posted']) ?></a></span></h2> 
331:     <div class="box">314:     <div class="box">
332:         <div class="inbox">315:         <div class="inbox">
333:             <div class="postleft">316:             <div class="postbody">
334:                 <dl>317:                 <div class="postleft">
335:                     <dt><strong><?php echo $poster ?></strong></dt>318:                     <dl>
336:                     <dd><strong><?php echo $user_title ?></strong></dd>319:                         <dt><strong><?php echo $poster ?></strong></dt>
337:                 </dl>320:                         <dd><strong><?php echo $user_title ?></strong></dd>
338:             </div>321:                     </dl>
339:             <div class="postright">322:                 </div>
340:                 <h3 class="nosize"><?php echo $lang_common['Message'] ?></h3>323:                 <div class="postright">
341:                 <div class="postmsg">324:                     <h3 class="nosize"><?php echo $lang_common['Message'] ?></h3>
342:                     <?php echo $cur_post['message']."\n" ?>325:                     <div class="postmsg">
343: <?php if ($cur_post['edited'] != '') echo "\t\t\t\t\t".'<p class="postedit"><em>'.$lang_topic['Last edit'].' '.pun_htmlspecialchars($cur_post['edited_by']).' ('.format_time($cur_post['edited']).')</em></p>'."\n"; ?>326:                         <?php echo $cur_post['message']."\n" ?>
 327: <?php if ($cur_post['edited'] != '') echo "\t\t\t\t\t\t".'<p class="postedit"><em>'.$lang_topic['Last edit'].' '.pun_htmlspecialchars($cur_post['edited_by']).' ('.format_time($cur_post['edited']).')</em></p>'."\n"; ?>
 328:                     </div>
344:                 </div>329:                 </div>
345:                 <?php if ($start_from + $post_count > 1) echo '<p class="multidelete"><label><strong>'.$lang_misc['Select'].'</strong>&nbsp;&nbsp;<input type="checkbox" name="posts['.$cur_post['id'].']" value="1" /></label></p>'."\n" ?> 
346:             </div>330:             </div>
347:             <div class="clearer"></div>331:         </div>
 332:         <div class="inbox">
 333:             <div class="postfoot clearb">
 334:                 <div class="postfootright"><?php echo ($start_from + $post_count > 1) ? '<p class="multidelete"><label><strong>'.$lang_misc['Select'].'</strong>&nbsp;&nbsp;<input type="checkbox" name="posts['.$cur_post['id'].']" value="1" /></label></p>' : '<p>'.$lang_misc['Cannot delete first'].'</p>' ?></div>
 335:             </div>
348:         </div>336:         </div>
349:     </div>337:     </div>
350: </div>338: </div>
357: <div class="postlinksb">345: <div class="postlinksb">
358:     <div class="inbox">346:     <div class="inbox">
359:         <p class="pagelink conl"><?php echo $paging_links ?></p>347:         <p class="pagelink conl"><?php echo $paging_links ?></p>
360:         <p class="conr">348:         <p class="conr modbuttons"><input type="submit" name="split_posts" value="<?php echo $lang_misc['Split'] ?>"<?php echo $button_status ?> /> <input type="submit" name="delete_posts" value="<?php echo $lang_misc['Delete'] ?>"<?php echo $button_status ?> /></p>
361:             <input type="submit" name="split_posts" value="<?php echo $lang_misc['Split'] ?>"<?php echo $button_status ?> /> 
362:             <input type="submit" name="delete_posts" value="<?php echo $lang_misc['Delete'] ?>"<?php echo $button_status ?> /> 
363:         </p> 
364:         <div class="clearer"></div>349:         <div class="clearer"></div>
365:     </div>350:     </div>
366: </div>351: </div>
392:         if ($db->num_rows($result) != count($topics))377:         if ($db->num_rows($result) != count($topics))
393:             message($lang_common['Bad request']);378:             message($lang_common['Bad request']);
394: 379: 
395:         // Delete any redirect topics if there are any (only if we moved/copied the topic back to where it where it was once moved from)380:         // Delete any redirect topics if there are any (only if we moved/copied the topic back to where it was once moved from)
396:         $db->query('DELETE FROM '.$db->prefix.'topics WHERE forum_id='.$move_to_forum.' AND moved_to IN('.implode(',',$topics).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error());381:         $db->query('DELETE FROM '.$db->prefix.'topics WHERE forum_id='.$move_to_forum.' AND moved_to IN('.implode(',',$topics).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error());
397: 382: 
398:         // Move the topic(s)383:         // Move the topic(s)
412:             }397:             }
413:         }398:         }
414: 399: 
415:         update_forum($fid);                // Update the forum FROM which the topic was moved400:         update_forum($fid); // Update the forum FROM which the topic was moved
416:         update_forum($move_to_forum);    // Update the forum TO which the topic was moved401:         update_forum($move_to_forum); // Update the forum TO which the topic was moved
417: 402: 
418:         $redirect_msg = (count($topics) > 1) ? $lang_misc['Move topics redirect'] : $lang_misc['Move topic redirect'];403:         $redirect_msg = (count($topics) > 1) ? $lang_misc['Move topics redirect'] : $lang_misc['Move topic redirect'];
419:         redirect('viewforum.php?id='.$move_to_forum, $redirect_msg);404:         redirect('viewforum.php?id='.$move_to_forum, $redirect_msg);
437:         $action = 'single';422:         $action = 'single';
438:     }423:     }
439: 424: 
 425:     $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
 426:     if ($db->num_rows($result) < 2)
 427:         message($lang_misc['Nowhere to move']);
 428: 
440:     $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Moderate';429:     $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Moderate';
441:     require PUN_ROOT.'header.php';430:     require PUN_ROOT.'header.php';
442: 431: 
454:                         <br /><select name="move_to_forum">443:                         <br /><select name="move_to_forum">
455: <?php444: <?php
456: 445: 
457:     $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); 
458:  
459:     $cur_category = 0;446:     $cur_category = 0;
460:     while ($cur_forum = $db->fetch_assoc($result))447:     while ($cur_forum = $db->fetch_assoc($result))
461:     {448:     {
462:         if ($cur_forum['cid'] != $cur_category)    // A new category since last iteration?449:         if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
463:         {450:         {
464:             if ($cur_category)451:             if ($cur_category)
465:                 echo "\t\t\t\t\t\t\t".'</optgroup>'."\n";452:                 echo "\t\t\t\t\t\t\t".'</optgroup>'."\n";
482:                     </div>469:                     </div>
483:                 </fieldset>470:                 </fieldset>
484:             </div>471:             </div>
485:             <p><input type="submit" name="move_topics_to" value="<?php echo $lang_misc['Move'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>472:             <p class="buttons"><input type="submit" name="move_topics_to" value="<?php echo $lang_misc['Move'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
486:         </form>473:         </form>
487:     </div>474:     </div>
488: </div>475: </div>
573:                     </div>560:                     </div>
574:                 </fieldset>561:                 </fieldset>
575:             </div>562:             </div>
576:             <p><input type="submit" name="merge_topics_comply" value="<?php echo $lang_misc['Merge'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>563:             <p class="buttons"><input type="submit" name="merge_topics_comply" value="<?php echo $lang_misc['Merge'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
577:         </form>564:         </form>
578:     </div>565:     </div>
579: </div>566: </div>
610:         // Delete any subscriptions597:         // Delete any subscriptions
611:         $db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE topic_id IN('.$topics.')') or error('Unable to delete subscriptions', __FILE__, __LINE__, $db->error());598:         $db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE topic_id IN('.$topics.')') or error('Unable to delete subscriptions', __FILE__, __LINE__, $db->error());
612: 599: 
613:         // Create a list of the post ID's in this topic and then strip the search index600:         // Create a list of the post IDs in this topic and then strip the search index
614:         $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id IN('.$topics.')') or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());601:         $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id IN('.$topics.')') or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());
615: 602: 
616:         $post_ids = '';603:         $post_ids = '';
617:         while ($row = $db->fetch_row($result))604:         while ($row = $db->fetch_row($result))
618:             $post_ids .= ($post_ids != '') ? ','.$row[0] : $row[0];605:             $post_ids .= ($post_ids != '') ? ','.$row[0] : $row[0];
619: 606: 
620:         // We have to check that we actually have a list of post ID's since we could be deleting just a redirect topic607:         // We have to check that we actually have a list of post IDs since we could be deleting just a redirect topic
621:         if ($post_ids != '')608:         if ($post_ids != '')
622:             strip_search_index($post_ids);609:             strip_search_index($post_ids);
623: 610: 
647:                     </div>634:                     </div>
648:                 </fieldset>635:                 </fieldset>
649:             </div>636:             </div>
650:             <p><input type="submit" name="delete_topics_comply" value="<?php echo $lang_misc['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>637:             <p class="buttons"><input type="submit" name="delete_topics_comply" value="<?php echo $lang_misc['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
651:         </form>638:         </form>
652:     </div>639:     </div>
653: </div>640: </div>
754: ?>741: ?>
755: <div class="linkst">742: <div class="linkst">
756:     <div class="inbox">743:     <div class="inbox">
 744:         <ul class="crumbs">
 745:             <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
 746:             <li>&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></li>
 747:         </ul>
757:         <p class="pagelink conl"><?php echo $paging_links ?></p>748:         <p class="pagelink conl"><?php echo $paging_links ?></p>
758:         <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a>&nbsp;</li><li>&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></li></ul> 
759:         <div class="clearer"></div>749:         <div class="clearer"></div>
760:     </div>750:     </div>
761: </div>751: </div>
781: // Select topics771: // Select topics
782: $result = $db->query('SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$fid.' ORDER BY sticky DESC, last_post DESC LIMIT '.$start_from.', '.$pun_user['disp_topics']) or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error());772: $result = $db->query('SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$fid.' ORDER BY sticky DESC, last_post DESC LIMIT '.$start_from.', '.$pun_user['disp_topics']) or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error());
783: 773: 
784: // If there are topics in this forum.774: // If there are topics in this forum
785: if ($db->num_rows($result))775: if ($db->num_rows($result))
786: {776: {
787:     $button_status = '';777:     $button_status = '';
824:             $item_status .= ' inew';814:             $item_status .= ' inew';
825:             $icon_type = 'icon inew';815:             $icon_type = 'icon inew';
826:             $subject = '<strong>'.$subject.'</strong>';816:             $subject = '<strong>'.$subject.'</strong>';
827:             $subject_new_posts = '<span class="newtext">[&nbsp;<a href="viewtopic.php?id='.$cur_topic['id'].'&amp;action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a>&nbsp;]</span>';817:             $subject_new_posts = '<span class="newtext">[ <a href="viewtopic.php?id='.$cur_topic['id'].'&amp;action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a> ]</span>';
828:         }818:         }
829:         else819:         else
830:             $subject_new_posts = null;820:             $subject_new_posts = null;
831: 821: 
832:         // We won't display "the dot", but we add the spaces anyway 
833:         if ($pun_config['o_show_dot'] == '1') 
834:             $subject = '&nbsp;&nbsp;'.$subject; 
835:  
836:         if ($cur_topic['sticky'] == '1')822:         if ($cur_topic['sticky'] == '1')
837:         {823:         {
838:             $subject = '<span class="stickytext">'.$lang_forum['Sticky'].': </span>'.$subject;824:             $subject = '<span class="stickytext">'.$lang_forum['Sticky'].': </span>'.$subject;
843:         $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);829:         $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);
844: 830: 
845:         if ($num_pages_topic > 1)831:         if ($num_pages_topic > 1)
846:             $subject_multipage = '[ '.paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_topic['id']).' ]';832:             $subject_multipage = '<span class="pagestext">[ '.paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_topic['id']).' ]</span>';
847:         else833:         else
848:             $subject_multipage = null;834:             $subject_multipage = null;
849: 835: 
850:         // Should we show the "New posts" and/or the multipage links?836:         // Should we show the "New posts" and/or the multipage links?
851:         if (!empty($subject_new_posts) || !empty($subject_multipage))837:         if (!empty($subject_new_posts) || !empty($subject_multipage))
852:         {838:         {
853:             $subject .= '&nbsp; '.(!empty($subject_new_posts) ? $subject_new_posts : '');839:             $subject .= !empty($subject_new_posts) ? ' '.$subject_new_posts : '';
854:             $subject .= !empty($subject_multipage) ? ' '.$subject_multipage : '';840:             $subject .= !empty($subject_multipage) ? ' '.$subject_multipage : '';
855:         }841:         }
856: 842: 
859:                     <td class="tcl">845:                     <td class="tcl">
860:                         <div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo trim($icon_text) ?></div></div>846:                         <div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo trim($icon_text) ?></div></div>
861:                         <div class="tclcon">847:                         <div class="tclcon">
862:                             <?php echo $subject."\n" ?>848:                             <div>
 849:                                 <?php echo $subject."\n" ?>
 850:                             </div>
863:                         </div>851:                         </div>
864:                     </td>852:                     </td>
865:                     <td class="tc2"><?php echo (!$ghost_topic) ? forum_number_format($cur_topic['num_replies']) : '&nbsp;' ?></td>853:                     <td class="tc2"><?php echo (!$ghost_topic) ? forum_number_format($cur_topic['num_replies']) : '&nbsp;' ?></td>
888: <div class="linksb">876: <div class="linksb">
889:     <div class="inbox">877:     <div class="inbox">
890:         <p class="pagelink conl"><?php echo $paging_links ?></p>878:         <p class="pagelink conl"><?php echo $paging_links ?></p>
891:         <p class="conr"><input type="submit" name="move_topics" value="<?php echo $lang_misc['Move'] ?>"<?php echo $button_status ?> />&nbsp;&nbsp;<input type="submit" name="delete_topics" value="<?php echo $lang_misc['Delete'] ?>"<?php echo $button_status ?> />&nbsp;&nbsp;<input type="submit" name="merge_topics" value="<?php echo $lang_misc['Merge'] ?>"<?php echo $button_status ?> />&nbsp;&nbsp;<input type="submit" name="open" value="<?php echo $lang_misc['Open'] ?>"<?php echo $button_status ?> />&nbsp;&nbsp;<input type="submit" name="close" value="<?php echo $lang_misc['Close'] ?>"<?php echo $button_status ?> /></p>879:         <p class="conr modbuttons"><input type="submit" name="move_topics" value="<?php echo $lang_misc['Move'] ?>"<?php echo $button_status ?> /> <input type="submit" name="delete_topics" value="<?php echo $lang_misc['Delete'] ?>"<?php echo $button_status ?> /> <input type="submit" name="merge_topics" value="<?php echo $lang_misc['Merge'] ?>"<?php echo $button_status ?> /> <input type="submit" name="open" value="<?php echo $lang_misc['Open'] ?>"<?php echo $button_status ?> /> <input type="submit" name="close" value="<?php echo $lang_misc['Close'] ?>"<?php echo $button_status ?> /></p>
892:         <div class="clearer"></div>880:         <div class="clearer"></div>
893:     </div>881:     </div>
894: </div>882: </div>


a/upload/plugins/AMP_Example.php b/upload/plugins/AMP_Example.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
   6:     based on code copyright (C) 2002-2005 Rickard Andersson
   7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  7:   8: 
  8:   PunBB is free software; you can redistribute it and/or modify it  9: ---*/
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:  10: 
 25: ## 11: ##
 26: ## 12: ##
 81: // If the "Show text" button was clicked 67: // If the "Show text" button was clicked
 82: if (isset($_POST['show_text'])) 68: if (isset($_POST['show_text']))
 83: { 69: {
 84:     // Make sure something something was entered 70:     // Make sure something was entered
 85:     if (trim($_POST['text_to_show']) == '') 71:     if (trim($_POST['text_to_show']) == '')
 86:         message('You didn\'t enter anything!'); 72:         message('You didn\'t enter anything!');
 87:  73: 
101: <?php 87: <?php
102:  88: 
103: } 89: }
104: else    // If not, we show the "Show text" form 90: else // If not, we show the "Show text" form
105: { 91: {
106:     // Display the admin navigation menu 92:     // Display the admin navigation menu
107:     generate_admin_menu($plugin); 93:     generate_admin_menu($plugin);
142: 128: 
143: }129: }
144: 130: 


a/upload/post.php b/upload/post.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: define('PUN_ROOT', './'); 11: define('PUN_ROOT', './');
 27: require PUN_ROOT.'include/common.php'; 12: require PUN_ROOT.'include/common.php';
 38:  23: 
 39: // Fetch some info about the topic and/or the forum 24: // Fetch some info about the topic and/or the forum
 40: if ($tid) 25: if ($tid)
 41:     $result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.subject, t.closed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$tid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error()); 26:     $result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.subject, t.closed, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') LEFT JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$tid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
 42: else 27: else
 43:     $result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error()); 28:     $result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
 44:  29: 
 46:     message($lang_common['Bad request']); 31:     message($lang_common['Bad request']);
 47:  32: 
 48: $cur_posting = $db->fetch_assoc($result); 33: $cur_posting = $db->fetch_assoc($result);
  34: $is_subscribed = $tid && $cur_posting['is_subscribed'];
 49:  35: 
 50: // Is someone trying to post into a redirect forum? 36: // Is someone trying to post into a redirect forum?
 51: if ($cur_posting['redirect_url'] != '') 37: if ($cur_posting['redirect_url'] != '')
 89:             $errors[] = $lang_post['No subject']; 75:             $errors[] = $lang_post['No subject'];
 90:         else if (pun_strlen($subject) > 70) 76:         else if (pun_strlen($subject) > 70)
 91:             $errors[] = $lang_post['Too long subject']; 77:             $errors[] = $lang_post['Too long subject'];
 92:         else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($subject) == $subject && !$pun_user['is_admmod']) 78:         else if ($pun_config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$pun_user['is_admmod'])
 93:             $subject = ucwords(strtolower($subject)); 79:             $errors[] = $lang_post['All caps subject'];
 94:     } 80:     }
 95:  81: 
 96:     // If the user is logged in we get the username and e-mail from $pun_user 82:     // If the user is logged in we get the username and email from $pun_user
 97:     if (!$pun_user['is_guest']) 83:     if (!$pun_user['is_guest'])
 98:     { 84:     {
 99:         $username = $pun_user['username']; 85:         $username = $pun_user['username'];
112:         // It's a guest, so we have to validate the username 98:         // It's a guest, so we have to validate the username
113:         if (strlen($username) < 2) 99:         if (strlen($username) < 2)
114:             $errors[] = $lang_prof_reg['Username too short'];100:             $errors[] = $lang_prof_reg['Username too short'];
115:         else if (pun_strlen($username) > 25)    // This usually doesn't happen since the form element only accepts 25 characters101:         else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters
116:             $errors[] = $lang_prof_reg['Username too long'];            102:             $errors[] = $lang_prof_reg['Username too long'];
117:         else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest']))103:         else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest']))
118:             $errors[] = $lang_prof_reg['Username guest'];104:             $errors[] = $lang_prof_reg['Username guest'];
119:         else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username) || preg_match('/((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))/', $username))105:         else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username) || preg_match('/((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))/', $username))
120:             $errors[] = $lang_prof_reg['Username IP'];106:             $errors[] = $lang_prof_reg['Username IP'];
121:         else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false)107:         else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false)
122:             $errors[] = $lang_prof_reg['Username reserved chars'];108:             $errors[] = $lang_prof_reg['Username reserved chars'];
123:         else if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))109:         else if (preg_match('/(?:\[\/?(?:b|u|i|h|colou?r|quote|code|img|url|email|list)\]|\[(?:code|quote|list)=)/i', $username))
124:             $errors[] = $lang_prof_reg['Username BBCode'];110:             $errors[] = $lang_prof_reg['Username BBCode'];
125: 111: 
126:         // Check username for any censored words112:         // Check username for any censored words
140:         {126:         {
141:             require PUN_ROOT.'include/email.php';127:             require PUN_ROOT.'include/email.php';
142:             if (!is_valid_email($email))128:             if (!is_valid_email($email))
143:                 $errors[] = $lang_common['Invalid e-mail'];129:                 $errors[] = $lang_common['Invalid email'];
 130: 
 131:             // Check if it's a banned email address
 132:             // we should only check guests because members addresses are already verified
 133:             if ($pun_user['is_guest'] && is_banned_email($email))
 134:             {
 135:                 if ($pun_config['p_allow_banned_email'] == '0')
 136:                     $errors[] = $lang_prof_reg['Banned email'];
 137: 
 138:                 $banned_email = true; // Used later when we send an alert email
 139:             }
 140:             else
 141:                 $banned_email = false;
144:         }142:         }
145:     }143:     }
146: 144: 
151:         $errors[] = $lang_post['No message'];149:         $errors[] = $lang_post['No message'];
152:     else if (strlen($message) > 65535)150:     else if (strlen($message) > 65535)
153:         $errors[] = $lang_post['Too long message'];151:         $errors[] = $lang_post['Too long message'];
154:     else if ($pun_config['p_message_all_caps'] == '0' && strtoupper($message) == $message && !$pun_user['is_admmod'])152:     else if ($pun_config['p_message_all_caps'] == '0' && is_all_uppercase($message) && !$pun_user['is_admmod'])
155:         $message = ucwords(strtolower($message));153:         $errors[] = $lang_post['All caps message'];
156: 154: 
157:     // Validate BBCode syntax155:     // Validate BBCode syntax
158:     if ($pun_config['p_message_bbcode'] == '1' && strpos($message, '[') !== false && strpos($message, ']') !== false)156:     if ($pun_config['p_message_bbcode'] == '1')
159:     {157:     {
160:         require PUN_ROOT.'include/parser.php';158:         require PUN_ROOT.'include/parser.php';
161:         $message = preparse_bbcode($message, $errors);159:         $message = preparse_bbcode($message, $errors);
178:             if (!$pun_user['is_guest'])176:             if (!$pun_user['is_guest'])
179:             {177:             {
180:                 $new_tid = $tid;178:                 $new_tid = $tid;
181:                 179: 
182:                 // Insert the new post180:                 // Insert the new post
183:                 $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());181:                 $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
184:                 $new_pid = $db->insert_id();182:                 $new_pid = $db->insert_id();
185: 183: 
186:                 // To subscribe or not to subscribe, that ...184:                 // To subscribe or not to subscribe, that ...
187:                 if ($pun_config['o_subscriptions'] == '1' && $subscribe)185:                 if ($pun_config['o_subscriptions'] == '1')
188:                 {186:                 {
189:                     $result = $db->query('SELECT 1 FROM '.$db->prefix.'subscriptions WHERE user_id='.$pun_user['id'].' AND topic_id='.$tid) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());187:                     if ($subscribe && !$is_subscribed)
190:                     if (!$db->num_rows($result)) 
191:                         $db->query('INSERT INTO '.$db->prefix.'subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());188:                         $db->query('INSERT INTO '.$db->prefix.'subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());
 189:                     else if (!$subscribe && $is_subscribed)
 190:                         $db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE user_id='.$pun_user['id'].' AND topic_id='.$tid) or error('Unable to remove subscription', __FILE__, __LINE__, $db->error());
192:                 }191:                 }
193:             }192:             }
194:             else193:             else
195:             {194:             {
196:                 // It's a guest. Insert the new post195:                 // It's a guest. Insert the new post
197:                 $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';196:                 $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';
198:                 $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());197:                 $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
199:                 $new_pid = $db->insert_id();198:                 $new_pid = $db->insert_id();
200:             }199:             }
201: 200: 
225: 224: 
226:                     $notification_emails = array();225:                     $notification_emails = array();
227: 226: 
228:                     // Loop through subscribed users and send e-mails227:                     // Loop through subscribed users and send emails
229:                     while ($cur_subscriber = $db->fetch_assoc($result))228:                     while ($cur_subscriber = $db->fetch_assoc($result))
230:                     {229:                     {
231:                         // Is the subscription e-mail for $cur_subscriber['language'] cached or not?230:                         // Is the subscription email for $cur_subscriber['language'] cached or not?
232:                         if (!isset($notification_emails[$cur_subscriber['language']]))231:                         if (!isset($notification_emails[$cur_subscriber['language']]))
233:                         {232:                         {
234:                             if (file_exists(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply.tpl'))233:                             if (file_exists(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply.tpl'))
294:             if (!$pun_user['is_guest'])293:             if (!$pun_user['is_guest'])
295:             {294:             {
296:                 // To subscribe or not to subscribe, that ...295:                 // To subscribe or not to subscribe, that ...
297:                 if ($pun_config['o_subscriptions'] == '1' && (isset($_POST['subscribe']) && $_POST['subscribe'] == '1'))296:                 if ($pun_config['o_subscriptions'] == '1' && $subscribe)
298:                     $db->query('INSERT INTO '.$db->prefix.'subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$new_tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());297:                     $db->query('INSERT INTO '.$db->prefix.'subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$new_tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());
299: 298: 
300:                 // Create the post ("topic post")299:                 // Create the post ("topic post")
301:                 $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());300:                 $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
302:             }301:             }
303:             else302:             else
304:             {303:             {
305:                 // Create the post ("topic post")304:                 // Create the post ("topic post")
306:                 $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';305:                 $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';
307:                 $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());306:                 $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', '.$hide_smilies.', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
308:             }307:             }
309:             $new_pid = $db->insert_id();308:             $new_pid = $db->insert_id();
310: 309: 
316:             update_forum($fid);315:             update_forum($fid);
317:         }316:         }
318: 317: 
 318:         // If we previously found out that the email was banned
 319:         if ($pun_user['is_guest'] && $banned_email && $pun_config['o_mailing_list'] != '')
 320:         {
 321:             $mail_subject = $lang_common['Banned email notification'];
 322:             $mail_message = sprintf($lang_common['Banned email post message'], $username, $email)."\n";
 323:             $mail_message .= sprintf($lang_common['Post URL'], $pun_config['o_base_url'].'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid)."\n";
 324:             $mail_message .= "\n".'--'."\n".$lang_common['Email signature'];
 325: 
 326:             pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message);
 327:         }
 328: 
319:         // If the posting user is logged in, increment his/her post count329:         // If the posting user is logged in, increment his/her post count
320:         if (!$pun_user['is_guest'])330:         if (!$pun_user['is_guest'])
321:         {331:         {
322:             $db->query('UPDATE '.$db->prefix.'users SET num_posts=num_posts+1, last_post='.$now.' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());332:             $db->query('UPDATE '.$db->prefix.'users SET num_posts=num_posts+1, last_post='.$now.' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
323: 333: 
324:               $tracked_topics = get_tracked_topics();334:             $tracked_topics = get_tracked_topics();
325:               $tracked_topics['topics'][$new_tid] = time();335:             $tracked_topics['topics'][$new_tid] = time();
326:               set_tracked_topics($tracked_topics);336:             set_tracked_topics($tracked_topics);
327:         }337:         }
328:         else338:         else
329:         {339:         {
335: }345: }
336: 346: 
337: 347: 
338: // If a topic id was specified in the url (it's a reply).348: // If a topic ID was specified in the url (it's a reply)
339: if ($tid)349: if ($tid)
340: {350: {
341:     $action = $lang_post['Post a reply'];351:     $action = $lang_post['Post a reply'];
342:     $form = '<form id="post" method="post" action="post.php?action=post&amp;tid='.$tid.'" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';352:     $form = '<form id="post" method="post" action="post.php?action=post&amp;tid='.$tid.'" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';
343: 353: 
344:     // If a quote-id was specified in the url.354:     // If a quote ID was specified in the url
345:     if (isset($_GET['qid']))355:     if (isset($_GET['qid']))
346:     {356:     {
347:         $qid = intval($_GET['qid']);357:         $qid = intval($_GET['qid']);
388: 398: 
389:     $forum_name = '<a href="viewforum.php?id='.$cur_posting['id'].'">'.pun_htmlspecialchars($cur_posting['forum_name']).'</a>';399:     $forum_name = '<a href="viewforum.php?id='.$cur_posting['id'].'">'.pun_htmlspecialchars($cur_posting['forum_name']).'</a>';
390: }400: }
391: // If a forum_id was specified in the url (new topic).401: // If a forum ID was specified in the url (new topic)
392: else if ($fid)402: else if ($fid)
393: {403: {
394:     $action = $lang_post['Post new topic'];404:     $action = $lang_post['Post new topic'];
401: 411: 
402: 412: 
403: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$action;413: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$action;
404: $required_fields = array('req_email' => $lang_common['E-mail'], 'req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']);414: $required_fields = array('req_email' => $lang_common['Email'], 'req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']);
405: $focus_element = array('post');415: $focus_element = array('post');
406: 416: 
407: if (!$pun_user['is_guest'])417: if (!$pun_user['is_guest'])
417: ?>427: ?>
418: <div class="linkst">428: <div class="linkst">
419:     <div class="inbox">429:     <div class="inbox">
420:         <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li>&nbsp;&raquo;&nbsp;<?php echo $forum_name ?><?php if (isset($cur_posting['subject'])) echo '</li><li>&nbsp;&raquo;&nbsp;'.pun_htmlspecialchars($cur_posting['subject']) ?></li></ul>430:         <ul class="crumbs">
 431:             <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
 432:             <li>&raquo;&nbsp;<?php echo $forum_name ?></li>
 433: <?php if (isset($cur_posting['subject'])): ?>            <li>&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_posting['subject']) ?></li>
 434: <?php endif; ?>        </ul>
421:     </div>435:     </div>
422: </div>436: </div>
423: 437: 
457:     <h2><span><?php echo $lang_post['Post preview'] ?></span></h2>471:     <h2><span><?php echo $lang_post['Post preview'] ?></span></h2>
458:     <div class="box">472:     <div class="box">
459:         <div class="inbox">473:         <div class="inbox">
460:             <div class="postright">474:             <div class="postbody">
461:                 <div class="postmsg">475:                 <div class="postright">
462:                     <?php echo $preview_message."\n" ?>476:                     <div class="postmsg">
 477:                         <?php echo $preview_message."\n" ?>
 478:                     </div>
463:                 </div>479:                 </div>
464:             </div>480:             </div>
465:         </div>481:         </div>
488: 504: 
489: if ($pun_user['is_guest'])505: if ($pun_user['is_guest'])
490: {506: {
491:     $email_label = ($pun_config['p_force_guest_email'] == '1') ? '<strong>'.$lang_common['E-mail'].'</strong>' : $lang_common['E-mail'];507:     $email_label = ($pun_config['p_force_guest_email'] == '1') ? '<strong>'.$lang_common['Email'].'</strong>' : $lang_common['Email'];
492:     $email_form_name = ($pun_config['p_force_guest_email'] == '1') ? 'req_email' : 'email';508:     $email_form_name = ($pun_config['p_force_guest_email'] == '1') ? 'req_email' : 'email';
493: 509: 
494: ?>                        <label class="conl"><strong><?php echo $lang_post['Guest name'] ?></strong><br /><input type="text" name="req_username" value="<?php if (isset($_POST['req_username'])) echo pun_htmlspecialchars($username); ?>" size="25" maxlength="25" tabindex="<?php echo $cur_index++ ?>" /><br /></label>510: ?>                        <label class="conl"><strong><?php echo $lang_post['Guest name'] ?></strong><br /><input type="text" name="req_username" value="<?php if (isset($_POST['req_username'])) echo pun_htmlspecialchars($username); ?>" size="25" maxlength="25" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
518:         $checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies'];534:         $checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies'];
519: 535: 
520:     if ($pun_config['o_subscriptions'] == '1')536:     if ($pun_config['o_subscriptions'] == '1')
521:         $checkboxes[] = '<label><input type="checkbox" name="subscribe" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['subscribe']) || $pun_user['auto_notify'] == '1' ? ' checked="checked"' : '').' />'.$lang_post['Subscribe'];537:     {
 538:         $subscr_checked = false;
 539: 
 540:         // If it's a preview
 541:         if (isset($_POST['preview']))
 542:             $subscr_checked = isset($_POST['subscribe']) ? true : false;
 543:         // If auto subscribed
 544:         else if ($pun_user['auto_notify'])
 545:             $subscr_checked = true;
 546:         // If already subscribed to the topic
 547:         else if ($is_subscribed)
 548:             $subscr_checked = true;
 549: 
 550:         $checkboxes[] = '<label><input type="checkbox" name="subscribe" value="1" tabindex="'.($cur_index++).'"'.($subscr_checked ? ' checked="checked"' : '').' />'.($is_subscribed ? $lang_post['Stay subscribed'] : $lang_post['Subscribe']);
 551:     }
522: }552: }
523: else if ($pun_config['o_smilies'] == '1')553: else if ($pun_config['o_smilies'] == '1')
524:     $checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies'];554:     $checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies'];
533:                     <legend><?php echo $lang_common['Options'] ?></legend>563:                     <legend><?php echo $lang_common['Options'] ?></legend>
534:                     <div class="infldset">564:                     <div class="infldset">
535:                         <div class="rbox">565:                         <div class="rbox">
536:                             <?php echo implode('<br /></label>'."\n\t\t\t\t", $checkboxes).'<br /></label>'."\n" ?>566:                             <?php echo implode('<br /></label>'."\n\t\t\t\t\t\t\t", $checkboxes).'<br /></label>'."\n" ?>
537:                         </div>567:                         </div>
538:                     </div>568:                     </div>
539:                 </fieldset>569:                 </fieldset>
543: 573: 
544: ?>574: ?>
545:             </div>575:             </div>
546:             <p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>576:             <p class="buttons"><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /> <input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
547:         </form>577:         </form>
548:     </div>578:     </div>
549: </div>579: </div>
550: 580: 
551: <?php581: <?php
552: 582: 
553: // Check to see if the topic review is to be displayed.583: // Check to see if the topic review is to be displayed
554: if ($tid && $pun_config['o_topic_review'] != '0')584: if ($tid && $pun_config['o_topic_review'] != '0')
555: {585: {
556:     require_once PUN_ROOT.'include/parser.php';586:     require_once PUN_ROOT.'include/parser.php';
564: <?php594: <?php
565: 595: 
566:     //Set background switching on596:     //Set background switching on
567:     $bg_switch = true; 
568:     $post_count = 0;597:     $post_count = 0;
569: 598: 
570:     while ($cur_post = $db->fetch_assoc($result))599:     while ($cur_post = $db->fetch_assoc($result))
571:     {600:     {
572:         // Switch the background color for every message. 
573:         $bg_switch = ($bg_switch) ? $bg_switch = false : $bg_switch = true; 
574:         $vtbg = ($bg_switch) ? ' roweven' : ' rowodd'; 
575:         $post_count++;601:         $post_count++;
576: 602: 
577:         $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);603:         $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
578: 604: 
579: ?>605: ?>
580:     <div class="box<?php echo $vtbg ?>">606:     <div class="box<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?>">
581:         <div class="inbox">607:         <div class="inbox">
582:             <div class="postleft">608:             <div class="postbody">
583:                 <dl>609:                 <div class="postleft">
584:                     <dt><strong><?php echo pun_htmlspecialchars($cur_post['poster']) ?></strong></dt>610:                     <dl>
585:                     <dd><?php echo format_time($cur_post['posted']) ?></dd>611:                         <dt><strong><?php echo pun_htmlspecialchars($cur_post['poster']) ?></strong></dt>
586:                 </dl>612:                         <dd><?php echo format_time($cur_post['posted']) ?></dd>
587:             </div>613:                     </dl>
588:             <div class="postright">614:                 </div>
589:                 <div class="postmsg">615:                 <div class="postright">
590:                     <?php echo $cur_post['message'] ?>616:                     <div class="postmsg">
 617:                         <?php echo $cur_post['message']."\n" ?>
 618:                     </div>
591:                 </div>619:                 </div>
592:             </div>620:             </div>
593:             <div class="clearer"></div>621:             <div class="clearer"></div>


a/upload/profile.php b/upload/profile.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: define('PUN_ROOT', './'); 11: define('PUN_ROOT', './');
 27: require PUN_ROOT.'include/common.php'; 12: require PUN_ROOT.'include/common.php';
 77:     // Make sure we are allowed to change this users password 62:     // Make sure we are allowed to change this users password
 78:     if ($pun_user['id'] != $id) 63:     if ($pun_user['id'] != $id)
 79:     { 64:     {
 80:         if (!$pun_user['is_admmod'])    // A regular user trying to change another users password? 65:         if (!$pun_user['is_admmod']) // A regular user trying to change another users password?
 81:             message($lang_common['No permission']); 66:             message($lang_common['No permission']);
 82:         else if ($pun_user['g_moderator'] == '1')    // A moderator trying to change a users password? 67:         else if ($pun_user['g_moderator'] == '1') // A moderator trying to change a users password?
 83:         { 68:         {
 84:             $result = $db->query('SELECT u.group_id, g.g_moderator FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON (g.g_id=u.group_id) WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 69:             $result = $db->query('SELECT u.group_id, g.g_moderator FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON (g.g_id=u.group_id) WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
 85:             if (!$db->num_rows($result)) 70:             if (!$db->num_rows($result))
116:             $sha1_in_db = (strlen($db_password_hash) == 40) ? true : false;101:             $sha1_in_db = (strlen($db_password_hash) == 40) ? true : false;
117:             $sha1_available = (function_exists('sha1') || function_exists('mhash')) ? true : false;102:             $sha1_available = (function_exists('sha1') || function_exists('mhash')) ? true : false;
118: 103: 
119:             $old_password_hash = pun_hash($old_password);    // This could result in either an SHA-1 or an MD5 hash104:             $old_password_hash = pun_hash($old_password); // This could result in either an SHA-1 or an MD5 hash
120: 105: 
121:             if (($sha1_in_db && $sha1_available && $db_password_hash == $old_password_hash) ||106:             if (($sha1_in_db && $sha1_available && $db_password_hash == $old_password_hash) ||
122:                 (!$sha1_in_db && $db_password_hash == md5($old_password)) ||107:                 (!$sha1_in_db && $db_password_hash == md5($old_password)) ||
164:                     </div>149:                     </div>
165:                 </fieldset>150:                 </fieldset>
166:             </div>151:             </div>
167:             <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>152:             <p class="buttons"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
168:         </form>153:         </form>
169:     </div>154:     </div>
170: </div>155: </div>
176: 161: 
177: else if ($action == 'change_email')162: else if ($action == 'change_email')
178: {163: {
179:     // Make sure we are allowed to change this users e-mail164:     // Make sure we are allowed to change this users email
180:     if ($pun_user['id'] != $id)165:     if ($pun_user['id'] != $id)
181:     {166:     {
182:         if (!$pun_user['is_admmod'])    // A regular user trying to change another users e-mail?167:         if (!$pun_user['is_admmod']) // A regular user trying to change another users email?
183:             message($lang_common['No permission']);168:             message($lang_common['No permission']);
184:         else if ($pun_user['g_moderator'] == '1')    // A moderator trying to change a users e-mail?169:         else if ($pun_user['g_moderator'] == '1') // A moderator trying to change a users email?
185:         {170:         {
186:             $result = $db->query('SELECT u.group_id, g.g_moderator FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON (g.g_id=u.group_id) WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());171:             $result = $db->query('SELECT u.group_id, g.g_moderator FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON (g.g_id=u.group_id) WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
187:             if (!$db->num_rows($result))172:             if (!$db->num_rows($result))
202:         list($new_email, $new_email_key) = $db->fetch_row($result);187:         list($new_email, $new_email_key) = $db->fetch_row($result);
203: 188: 
204:         if ($key == '' || $key != $new_email_key)189:         if ($key == '' || $key != $new_email_key)
205:             message($lang_profile['E-mail key bad'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.');190:             message($lang_profile['Email key bad'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.');
206:         else191:         else
207:         {192:         {
208:             $db->query('UPDATE '.$db->prefix.'users SET email=activate_string, activate_string=NULL, activate_key=NULL WHERE id='.$id) or error('Unable to update e-mail address', __FILE__, __LINE__, $db->error());193:             $db->query('UPDATE '.$db->prefix.'users SET email=activate_string, activate_string=NULL, activate_key=NULL WHERE id='.$id) or error('Unable to update email address', __FILE__, __LINE__, $db->error());
209: 194: 
210:             message($lang_profile['E-mail updated'], true);195:             message($lang_profile['Email updated'], true);
211:         }196:         }
212:     }197:     }
213:     else if (isset($_POST['form_sent']))198:     else if (isset($_POST['form_sent']))
217: 202: 
218:         require PUN_ROOT.'include/email.php';203:         require PUN_ROOT.'include/email.php';
219: 204: 
220:         // Validate the email-address205:         // Validate the email address
221:         $new_email = strtolower(trim($_POST['req_new_email']));206:         $new_email = strtolower(trim($_POST['req_new_email']));
222:         if (!is_valid_email($new_email))207:         if (!is_valid_email($new_email))
223:             message($lang_common['Invalid e-mail']);208:             message($lang_common['Invalid email']);
224: 209: 
225:         // Check if it's a banned e-mail address210:         // Check if it's a banned email address
226:         if (is_banned_email($new_email))211:         if (is_banned_email($new_email))
227:         {212:         {
228:             if ($pun_config['p_allow_banned_email'] == '0')213:             if ($pun_config['p_allow_banned_email'] == '0')
229:                 message($lang_prof_reg['Banned e-mail']);214:                 message($lang_prof_reg['Banned email']);
230:             else if ($pun_config['o_mailing_list'] != '')215:             else if ($pun_config['o_mailing_list'] != '')
231:             {                216:             {
232:                 $mail_subject = $lang_common['Banned email notification'];217:                 $mail_subject = $lang_common['Banned email notification'];
233:                 $mail_message = sprintf($lang_common['Banned email change message'], $pun_user['username'], $new_email)."\n";218:                 $mail_message = sprintf($lang_common['Banned email change message'], $pun_user['username'], $new_email)."\n";
234:                 $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$id)."\n";219:                 $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$id)."\n";
238:             }223:             }
239:         }224:         }
240: 225: 
241:         // Check if someone else already has registered with that e-mail address226:         // Check if someone else already has registered with that email address
242:         $result = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE email=\''.$db->escape($new_email).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());227:         $result = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE email=\''.$db->escape($new_email).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
243:         if ($db->num_rows($result))228:         if ($db->num_rows($result))
244:         {229:         {
245:             if ($pun_config['p_allow_dupe_email'] == '0')230:             if ($pun_config['p_allow_dupe_email'] == '0')
246:                 message($lang_prof_reg['Dupe e-mail']);231:                 message($lang_prof_reg['Dupe email']);
247:             else if ($pun_config['o_mailing_list'] != '')232:             else if ($pun_config['o_mailing_list'] != '')
248:             {233:             {
249:                 while ($cur_dupe = $db->fetch_assoc($result))234:                 while ($cur_dupe = $db->fetch_assoc($result))
250:                     $dupe_list[] = $cur_dupe['username'];235:                     $dupe_list[] = $cur_dupe['username'];
251:                 236: 
252:                 $mail_subject = $lang_common['Duplicate email notification'];237:                 $mail_subject = $lang_common['Duplicate email notification'];
253:                 $mail_message = sprintf($lang_common['Duplicate email change message'], $pun_user['username'], implode(', ', $dupe_list))."\n";238:                 $mail_message = sprintf($lang_common['Duplicate email change message'], $pun_user['username'], implode(', ', $dupe_list))."\n";
254:                 $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$id)."\n";239:                 $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$id)."\n";
263: 248: 
264:         $db->query('UPDATE '.$db->prefix.'users SET activate_string=\''.$db->escape($new_email).'\', activate_key=\''.$new_email_key.'\' WHERE id='.$id) or error('Unable to update activation data', __FILE__, __LINE__, $db->error());249:         $db->query('UPDATE '.$db->prefix.'users SET activate_string=\''.$db->escape($new_email).'\', activate_key=\''.$new_email_key.'\' WHERE id='.$id) or error('Unable to update activation data', __FILE__, __LINE__, $db->error());
265: 250: 
266:         // Load the "activate e-mail" template251:         // Load the "activate email" template
267:         $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/activate_email.tpl'));252:         $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/activate_email.tpl'));
268: 253: 
269:         // The first row contains the subject254:         // The first row contains the subject
278: 263: 
279:         pun_mail($new_email, $mail_subject, $mail_message);264:         pun_mail($new_email, $mail_subject, $mail_message);
280: 265: 
281:         message($lang_profile['Activate e-mail sent'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.', true);266:         message($lang_profile['Activate email sent'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.', true);
282:     }267:     }
283: 268: 
284:     $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];269:     $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];
285:     $required_fields = array('req_new_email' => $lang_profile['New e-mail'], 'req_password' => $lang_common['Password']);270:     $required_fields = array('req_new_email' => $lang_profile['New email'], 'req_password' => $lang_common['Password']);
286:     $focus_element = array('change_email', 'req_new_email');271:     $focus_element = array('change_email', 'req_new_email');
287:     require PUN_ROOT.'header.php';272:     require PUN_ROOT.'header.php';
288: 273: 
289: ?>274: ?>
290: <div class="blockform">275: <div class="blockform">
291:     <h2><span><?php echo $lang_profile['Change e-mail'] ?></span></h2>276:     <h2><span><?php echo $lang_profile['Change email'] ?></span></h2>
292:     <div class="box">277:     <div class="box">
293:         <form id="change_email" method="post" action="profile.php?action=change_email&amp;id=<?php echo $id ?>" id="change_email" onsubmit="return process_form(this)">278:         <form id="change_email" method="post" action="profile.php?action=change_email&amp;id=<?php echo $id ?>" id="change_email" onsubmit="return process_form(this)">
294:             <div class="inform">279:             <div class="inform">
295:                 <fieldset>280:                 <fieldset>
296:                     <legend><?php echo $lang_profile['E-mail legend'] ?></legend>281:                     <legend><?php echo $lang_profile['Email legend'] ?></legend>
297:                     <div class="infldset">282:                     <div class="infldset">
298:                         <input type="hidden" name="form_sent" value="1" />283:                         <input type="hidden" name="form_sent" value="1" />
299:                         <label><strong><?php echo $lang_profile['New e-mail'] ?></strong><br /><input type="text" name="req_new_email" size="50" maxlength="50" /><br /></label>284:                         <label><strong><?php echo $lang_profile['New email'] ?></strong><br /><input type="text" name="req_new_email" size="50" maxlength="50" /><br /></label>
300:                         <label><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password" size="16" maxlength="16" /><br /></label>285:                         <label><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password" size="16" maxlength="16" /><br /></label>
301:                         <p><?php echo $lang_profile['E-mail instructions'] ?></p>286:                         <p><?php echo $lang_profile['Email instructions'] ?></p>
302:                     </div>287:                     </div>
303:                 </fieldset>288:                 </fieldset>
304:             </div>289:             </div>
305:             <p><input type="submit" name="new_email" value="<?php echo $lang_common['Submit'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>290:             <p class="buttons"><input type="submit" name="new_email" value="<?php echo $lang_common['Submit'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
306:         </form>291:         </form>
307:     </div>292:     </div>
308: </div>293: </div>
324:     {309:     {
325:         if (!isset($_FILES['req_file']))310:         if (!isset($_FILES['req_file']))
326:             message($lang_profile['No file']);311:             message($lang_profile['No file']);
327:             312: 
328:         $uploaded_file = $_FILES['req_file'];313:         $uploaded_file = $_FILES['req_file'];
329: 314: 
330:         // Make sure the upload went smooth315:         // Make sure the upload went smooth
332:         {317:         {
333:             switch ($uploaded_file['error'])318:             switch ($uploaded_file['error'])
334:             {319:             {
335:                 case 1:    // UPLOAD_ERR_INI_SIZE320:                 case 1: // UPLOAD_ERR_INI_SIZE
336:                 case 2:    // UPLOAD_ERR_FORM_SIZE321:                 case 2: // UPLOAD_ERR_FORM_SIZE
337:                     message($lang_profile['Too large ini']);322:                     message($lang_profile['Too large ini']);
338:                     break;323:                     break;
339: 324: 
340:                 case 3:    // UPLOAD_ERR_PARTIAL325:                 case 3: // UPLOAD_ERR_PARTIAL
341:                     message($lang_profile['Partial upload']);326:                     message($lang_profile['Partial upload']);
342:                     break;327:                     break;
343: 328: 
344:                 case 4:    // UPLOAD_ERR_NO_FILE329:                 case 4: // UPLOAD_ERR_NO_FILE
345:                     message($lang_profile['No file']);330:                     message($lang_profile['No file']);
346:                     break;331:                     break;
347: 332: 
348:                 case 6:    // UPLOAD_ERR_NO_TMP_DIR333:                 case 6: // UPLOAD_ERR_NO_TMP_DIR
349:                     message($lang_profile['No tmp directory']);334:                     message($lang_profile['No tmp directory']);
350:                     break;335:                     break;
351: 336: 
368:             if ($uploaded_file['size'] > $pun_config['o_avatars_size'])353:             if ($uploaded_file['size'] > $pun_config['o_avatars_size'])
369:                 message($lang_profile['Too large'].' '.forum_number_format($pun_config['o_avatars_size']).' '.$lang_profile['bytes'].'.');354:                 message($lang_profile['Too large'].' '.forum_number_format($pun_config['o_avatars_size']).' '.$lang_profile['bytes'].'.');
370: 355: 
371:             // Move the file to the avatar directory. We do this before checking the width/height to circumvent open_basedir restrictions.356:             // Move the file to the avatar directory. We do this before checking the width/height to circumvent open_basedir restrictions
372:             if (!@move_uploaded_file($uploaded_file['tmp_name'], $pun_config['o_avatars_dir'].'/'.$id.'.tmp'))357:             if (!@move_uploaded_file($uploaded_file['tmp_name'], $pun_config['o_avatars_dir'].'/'.$id.'.tmp'))
373:                 message($lang_profile['Move failed'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.');358:                 message($lang_profile['Move failed'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.');
374: 359: 
428:                     </div>413:                     </div>
429:                 </fieldset>414:                 </fieldset>
430:             </div>415:             </div>
431:             <p><input type="submit" name="upload" value="<?php echo $lang_profile['Upload'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>416:             <p class="buttons"><input type="submit" name="upload" value="<?php echo $lang_profile['Upload'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
432:         </form>417:         </form>
433:     </div>418:     </div>
434: </div>419: </div>
640:                     </div>625:                     </div>
641:                 </fieldset>626:                 </fieldset>
642:             </div>627:             </div>
643:             <p><input type="submit" name="delete_user_comply" value="<?php echo $lang_profile['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>628:             <p class="buttons"><input type="submit" name="delete_user_comply" value="<?php echo $lang_profile['Delete'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
644:         </form>629:         </form>
645:     </div>630:     </div>
646: </div>631: </div>
675: 660: 
676:         while (list($key, $value) = @each($_POST['form']))661:         while (list($key, $value) = @each($_POST['form']))
677:         {662:         {
678:             if (in_array($key, $allowed_elements))663:             if (in_array($key, $allowed_elements))
679:                 $form[$key] = $value;664:                 $form[$key] = $value;
680:         }665:         }
681: 666: 
682:         return $form;667:         return $form;
703: 688: 
704:                     if (strlen($form['username']) < 2)689:                     if (strlen($form['username']) < 2)
705:                         message($lang_prof_reg['Username too short']);690:                         message($lang_prof_reg['Username too short']);
706:                     else if (pun_strlen($form['username']) > 25)    // This usually doesn't happen since the form element only accepts 25 characters691:                     else if (pun_strlen($form['username']) > 25) // This usually doesn't happen since the form element only accepts 25 characters
707:                         message($lang_common['Bad request']);692:                         message($lang_common['Bad request']);
708:                     else if (!strcasecmp($form['username'], 'Guest') || !strcasecmp($form['username'], $lang_common['Guest']))693:                     else if (!strcasecmp($form['username'], 'Guest') || !strcasecmp($form['username'], $lang_common['Guest']))
709:                         message($lang_prof_reg['Username guest']);694:                         message($lang_prof_reg['Username guest']);
710:                     else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $form['username']) || preg_match('/((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))/', $form['username']))695:                     else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $form['username']) || preg_match('/((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))/', $form['username']))
711:                         message($lang_prof_reg['Username IP']);696:                         message($lang_prof_reg['Username IP']);
712:                     else if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $form['username']))697:                     else if (preg_match('/(?:\[\/?(?:b|u|i|h|colou?r|quote|code|img|url|email|list)\]|\[(?:code|quote|list)=)/i', $form['username']))
713:                         message($lang_prof_reg['Username BBCode']);698:                         message($lang_prof_reg['Username BBCode']);
714: 699: 
715:                     // Check that the username is not already registered700:                     // Check that the username is not already registered
730:             {715:             {
731:                 require PUN_ROOT.'include/email.php';716:                 require PUN_ROOT.'include/email.php';
732: 717: 
733:                 // Validate the email-address718:                 // Validate the email address
734:                 $form['email'] = strtolower(trim($_POST['req_email']));719:                 $form['email'] = strtolower(trim($_POST['req_email']));
735:                 if (!is_valid_email($form['email']))720:                 if (!is_valid_email($form['email']))
736:                     message($lang_common['Invalid e-mail']);721:                     message($lang_common['Invalid email']);
737:             }722:             }
738: 723: 
739:             // Make sure we got a valid language string724:             // Make sure we got a valid language string
805:                     message($lang_prof_reg['Sig too long'].' '.$pun_config['p_sig_length'].' '.$lang_prof_reg['characters'].'.');790:                     message($lang_prof_reg['Sig too long'].' '.$pun_config['p_sig_length'].' '.$lang_prof_reg['characters'].'.');
806:                 else if (substr_count($form['signature'], "\n") > ($pun_config['p_sig_lines']-1))791:                 else if (substr_count($form['signature'], "\n") > ($pun_config['p_sig_lines']-1))
807:                     message($lang_prof_reg['Sig too many lines'].' '.$pun_config['p_sig_lines'].' '.$lang_prof_reg['lines'].'.');792:                     message($lang_prof_reg['Sig too many lines'].' '.$pun_config['p_sig_lines'].' '.$lang_prof_reg['lines'].'.');
808:                 else if ($form['signature'] && $pun_config['p_sig_all_caps'] == '0' && strtoupper($form['signature']) == $form['signature'] && !$pun_user['is_admmod'])793:                 else if ($form['signature'] && $pun_config['p_sig_all_caps'] == '0' && is_all_uppercase($form['signature']) && !$pun_user['is_admmod'])
809:                     $form['signature'] = ucwords(strtolower($form['signature']));794:                     $form['signature'] = utf8_ucwords(utf8_strtolower($form['signature']));
810: 795: 
811:                 // Validate BBCode syntax796:                 // Validate BBCode syntax
812:                 if ($pun_config['p_sig_bbcode'] == '1' && strpos($form['signature'], '[') !== false && strpos($form['signature'], ']') !== false)797:                 if ($pun_config['p_sig_bbcode'] == '1')
813:                 {798:                 {
814:                     require PUN_ROOT.'include/parser.php';799:                     require PUN_ROOT.'include/parser.php';
815: 800: 
861:     }846:     }
862: 847: 
863: 848: 
864:     // Singlequotes around non-empty values and NULL for empty values849:     // Single quotes around non-empty values and NULL for empty values
865:     $temp = array();850:     $temp = array();
866:     while (list($key, $input) = @each($form))851:     while (list($key, $input) = @each($form))
867:     {852:     {
880:     if ($username_updated)865:     if ($username_updated)
881:     {866:     {
882:         $db->query('UPDATE '.$db->prefix.'posts SET poster=\''.$db->escape($form['username']).'\' WHERE poster_id='.$id) or error('Unable to update posts', __FILE__, __LINE__, $db->error());867:         $db->query('UPDATE '.$db->prefix.'posts SET poster=\''.$db->escape($form['username']).'\' WHERE poster_id='.$id) or error('Unable to update posts', __FILE__, __LINE__, $db->error());
 868:         $db->query('UPDATE '.$db->prefix.'posts SET edited_by=\''.$db->escape($form['username']).'\' WHERE edited_by=\''.$db->escape($old_username).'\'') or error('Unable to update posts', __FILE__, __LINE__, $db->error());
883:         $db->query('UPDATE '.$db->prefix.'topics SET poster=\''.$db->escape($form['username']).'\' WHERE poster=\''.$db->escape($old_username).'\'') or error('Unable to update topics', __FILE__, __LINE__, $db->error());869:         $db->query('UPDATE '.$db->prefix.'topics SET poster=\''.$db->escape($form['username']).'\' WHERE poster=\''.$db->escape($old_username).'\'') or error('Unable to update topics', __FILE__, __LINE__, $db->error());
884:         $db->query('UPDATE '.$db->prefix.'topics SET last_poster=\''.$db->escape($form['username']).'\' WHERE last_poster=\''.$db->escape($old_username).'\'') or error('Unable to update topics', __FILE__, __LINE__, $db->error());870:         $db->query('UPDATE '.$db->prefix.'topics SET last_poster=\''.$db->escape($form['username']).'\' WHERE last_poster=\''.$db->escape($old_username).'\'') or error('Unable to update topics', __FILE__, __LINE__, $db->error());
885:         $db->query('UPDATE '.$db->prefix.'forums SET last_poster=\''.$db->escape($form['username']).'\' WHERE last_poster=\''.$db->escape($old_username).'\'') or error('Unable to update forums', __FILE__, __LINE__, $db->error());871:         $db->query('UPDATE '.$db->prefix.'forums SET last_poster=\''.$db->escape($form['username']).'\' WHERE last_poster=\''.$db->escape($old_username).'\'') or error('Unable to update forums', __FILE__, __LINE__, $db->error());
940:     if ($user['email_setting'] == '0' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1')926:     if ($user['email_setting'] == '0' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1')
941:         $email_field = '<a href="mailto:'.$user['email'].'">'.$user['email'].'</a>';927:         $email_field = '<a href="mailto:'.$user['email'].'">'.$user['email'].'</a>';
942:     else if ($user['email_setting'] == '1' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1')928:     else if ($user['email_setting'] == '1' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1')
943:         $email_field = '<a href="misc.php?email='.$id.'">'.$lang_common['Send e-mail'].'</a>';929:         $email_field = '<a href="misc.php?email='.$id.'">'.$lang_common['Send email'].'</a>';
944:     else930:     else
945:         $email_field = $lang_profile['Private'];931:         $email_field = $lang_profile['Private'];
946: 932: 
971:     if ($pun_user['g_search'] == '1')957:     if ($pun_user['g_search'] == '1')
972:         $posts_field .= (($posts_field != '') ? ' - ' : '').'<a href="search.php?action=show_user&amp;user_id='.$id.'">'.$lang_profile['Show posts'].'</a>';958:         $posts_field .= (($posts_field != '') ? ' - ' : '').'<a href="search.php?action=show_user&amp;user_id='.$id.'">'.$lang_profile['Show posts'].'</a>';
973: 959: 
974:     $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];960:     $page_title = pun_htmlspecialchars($pun_config['o_board_title'].' / '.sprintf($lang_profile['Users profile'], $user['username']));
975:     define('PUN_ALLOW_INDEX', 1);961:     define('PUN_ALLOW_INDEX', 1);
976:     require PUN_ROOT.'header.php';962:     require PUN_ROOT.'header.php';
977: 963: 
994:                             <dt><?php echo $lang_profile['Location'] ?>: </dt>980:                             <dt><?php echo $lang_profile['Location'] ?>: </dt>
995:                             <dd><?php echo ($user['location'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['location']) : $user['location']) : $lang_profile['Unknown']; ?></dd>981:                             <dd><?php echo ($user['location'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['location']) : $user['location']) : $lang_profile['Unknown']; ?></dd>
996:                             <dt><?php echo $lang_profile['Website'] ?>: </dt>982:                             <dt><?php echo $lang_profile['Website'] ?>: </dt>
997:                             <dd><?php echo $url ?>&nbsp;</dd>983:                             <dd><?php echo $url ?></dd>
998:                             <dt><?php echo $lang_common['E-mail'] ?>: </dt>984:                             <dt><?php echo $lang_common['Email'] ?>: </dt>
999:                             <dd><?php echo $email_field ?></dd>985:                             <dd><?php echo $email_field ?></dd>
1000:                         </dl>986:                         </dl>
1001:                         <div class="clearer"></div>987:                         <div class="clearer"></div>
1030: <?php if ($pun_config['o_avatars'] == '1'): ?>                            <dt><?php echo $lang_profile['Avatar'] ?>: </dt>1016: <?php if ($pun_config['o_avatars'] == '1'): ?>                            <dt><?php echo $lang_profile['Avatar'] ?>: </dt>
1031:                             <dd><?php echo $avatar_field ?></dd>1017:                             <dd><?php echo $avatar_field ?></dd>
1032: <?php endif; if ($pun_config['o_signatures'] == '1'): ?>                            <dt><?php echo $lang_profile['Signature'] ?>: </dt>1018: <?php endif; if ($pun_config['o_signatures'] == '1'): ?>                            <dt><?php echo $lang_profile['Signature'] ?>: </dt>
1033:                             <dd><div><?php echo isset($parsed_signature) ? $parsed_signature : $lang_profile['No sig']; ?></div></dd>1019:                             <dd><?php echo isset($parsed_signature) ? '<div class="postsignature postmsg">'.$parsed_signature.'</div>' : $lang_profile['No sig']; ?></dd>
1034: <?php endif; ?>                        </dl>1020: <?php endif; ?>                        </dl>
1035:                         <div class="clearer"></div>1021:                         <div class="clearer"></div>
1036:                     </div>1022:                     </div>
1071:             else1057:             else
1072:                 $username_field = '<p>'.$lang_common['Username'].': '.pun_htmlspecialchars($user['username']).'</p>'."\n";1058:                 $username_field = '<p>'.$lang_common['Username'].': '.pun_htmlspecialchars($user['username']).'</p>'."\n";
1073: 1059: 
1074:             $email_field = '<label><strong>'.$lang_common['E-mail'].'</strong><br /><input type="text" name="req_email" value="'.$user['email'].'" size="40" maxlength="50" /><br /></label><p><a href="misc.php?email='.$id.'">'.$lang_common['Send e-mail'].'</a></p>'."\n";1060:             $email_field = '<label><strong>'.$lang_common['Email'].'</strong><br /><input type="text" name="req_email" value="'.$user['email'].'" size="40" maxlength="50" /><br /></label><p><a href="misc.php?email='.$id.'">'.$lang_common['Send email'].'</a></p>'."\n";
1075:         }1061:         }
1076:         else1062:         else
1077:         {1063:         {
1078:             $username_field = '<p>'.$lang_common['Username'].': '.pun_htmlspecialchars($user['username']).'</p>'."\n";1064:             $username_field = '<p>'.$lang_common['Username'].': '.pun_htmlspecialchars($user['username']).'</p>'."\n";
1079: 1065: 
1080:             if ($pun_config['o_regs_verify'] == '1')1066:             if ($pun_config['o_regs_verify'] == '1')
1081:                 $email_field = '<p>'.$lang_common['E-mail'].': '.$user['email'].'&nbsp;-&nbsp;<a href="profile.php?action=change_email&amp;id='.$id.'">'.$lang_profile['Change e-mail'].'</a></p>'."\n";1067:                 $email_field = '<p>'.$lang_common['Email'].': '.$user['email'].'&nbsp;-&nbsp;<a href="profile.php?action=change_email&amp;id='.$id.'">'.$lang_profile['Change email'].'</a></p>'."\n";
1082:             else1068:             else
1083:                 $email_field = '<label><strong>'.$lang_common['E-mail'].'</strong><br /><input type="text" name="req_email" value="'.$user['email'].'" size="40" maxlength="50" /><br /></label>'."\n";1069:                 $email_field = '<label><strong>'.$lang_common['Email'].'</strong><br /><input type="text" name="req_email" value="'.$user['email'].'" size="40" maxlength="50" /><br /></label>'."\n";
1084:         }1070:         }
1085: 1071: 
1086:         $posts_field = '';1072:         $posts_field = '';
1090:             $posts_field = '<p>'.$lang_common['Posts'].': '.forum_number_format($user['num_posts']).($pun_user['g_search'] == '1' ? ' - <a href="search.php?action=show_user&amp;user_id='.$id.'">'.$lang_profile['Show posts'].'</a>' : '').'</p>'."\n";1076:             $posts_field = '<p>'.$lang_common['Posts'].': '.forum_number_format($user['num_posts']).($pun_user['g_search'] == '1' ? ' - <a href="search.php?action=show_user&amp;user_id='.$id.'">'.$lang_profile['Show posts'].'</a>' : '').'</p>'."\n";
1091:         else if ($pun_user['g_search'] == '1')1077:         else if ($pun_user['g_search'] == '1')
1092:             $posts_field = '<p><a href="search.php?action=show_user&amp;user_id='.$id.'">'.$lang_profile['Show posts'].'</a></p>'."\n";1078:             $posts_field = '<p><a href="search.php?action=show_user&amp;user_id='.$id.'">'.$lang_profile['Show posts'].'</a></p>'."\n";
1093:         1079: 
1094: 1080: 
1095:         $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];1081:         $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];
1096:         $required_fields = array('req_username' => $lang_common['Username'], 'req_email' => $lang_common['E-mail']);1082:         $required_fields = array('req_username' => $lang_common['Username'], 'req_email' => $lang_common['Email']);
1097:         require PUN_ROOT.'header.php';1083:         require PUN_ROOT.'header.php';
1098: 1084: 
1099:         generate_profile_menu('essentials');1085:         generate_profile_menu('essentials');
1115:                 </div>1101:                 </div>
1116:                 <div class="inform">1102:                 <div class="inform">
1117:                     <fieldset>1103:                     <fieldset>
1118:                         <legend><?php echo $lang_prof_reg['E-mail legend'] ?></legend>1104:                         <legend><?php echo $lang_prof_reg['Email legend'] ?></legend>
1119:                         <div class="infldset">1105:                         <div class="infldset">
1120:                             <?php echo $email_field ?>1106:                             <?php echo $email_field ?>
1121:                         </div>1107:                         </div>
1125:                     <fieldset>1111:                     <fieldset>
1126:                         <legend><?php echo $lang_prof_reg['Localisation legend'] ?></legend>1112:                         <legend><?php echo $lang_prof_reg['Localisation legend'] ?></legend>
1127:                         <div class="infldset">1113:                         <div class="infldset">
1128:                             <label><?php echo $lang_prof_reg['Timezone'] ?>: <?php echo $lang_prof_reg['Timezone info'] ?>1114:                             <p><?php echo $lang_prof_reg['Time zone info'] ?></p>
1129: 1115:                             <label><?php echo $lang_prof_reg['Time zone'] ?>
1130:                                 <br /><select name="form[timezone]">1116:                                 <br /><select name="form[timezone]">
1131:                                 <option value="-12"<?php if ($user['timezone'] == -12) echo ' selected="selected"' ?>>-12</option>1117:                                 <option value="-12"<?php if ($user['timezone'] == -12) echo ' selected="selected"' ?>>-12</option>
1132:                                 <option value="-11"<?php if ($user['timezone'] == -11) echo ' selected="selected"' ?>>-11</option>1118:                                 <option value="-11"<?php if ($user['timezone'] == -11) echo ' selected="selected"' ?>>-11</option>
1167:                                 <option value="14"<?php if ($user['timezone'] == 14) echo ' selected="selected"' ?>>+14</option>1153:                                 <option value="14"<?php if ($user['timezone'] == 14) echo ' selected="selected"' ?>>+14</option>
1168:                             </select>1154:                             </select>
1169:                             <br /></label>1155:                             <br /></label>
1170:                             <p><?php echo $lang_prof_reg['DST'] ?></p> 
1171:                             <div class="rbox">1156:                             <div class="rbox">
1172:                                 <label><input type="checkbox" name="form[dst]" value="1"<?php if ($user['dst'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['DST info'] ?><br /></label>1157:                                 <label><input type="checkbox" name="form[dst]" value="1"<?php if ($user['dst'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['DST'] ?><br /></label>
1173:                             </div>1158:                             </div>
1174:                             <label><?php echo $lang_prof_reg['Time format'] ?>1159:                             <label><?php echo $lang_prof_reg['Time format'] ?>
1175: 1160: 
1205:                                 ?>1190:                                 ?>
1206:                             </select>1191:                             </select>
1207:                             <br /></label>1192:                             <br /></label>
1208:                             1193: 
1209: <?php1194: <?php
1210: 1195: 
1211:         $languages = array();1196:         $languages = array();
1254:                             <p><?php echo $lang_common['Last post'] ?>: <?php echo $last_post ?></p>1239:                             <p><?php echo $lang_common['Last post'] ?>: <?php echo $last_post ?></p>
1255:                             <?php echo $posts_field ?>1240:                             <?php echo $posts_field ?>
1256: <?php if ($pun_user['is_admmod']): ?>                            <label><?php echo $lang_profile['Admin note'] ?><br />1241: <?php if ($pun_user['is_admmod']): ?>                            <label><?php echo $lang_profile['Admin note'] ?><br />
1257:                             <input id="admin_note" type="text" name="admin_note" value="<?php echo pun_htmlspecialchars($user['admin_note']) ?>" size="30" maxlength="30" /><br /></label>    1242:                             <input id="admin_note" type="text" name="admin_note" value="<?php echo pun_htmlspecialchars($user['admin_note']) ?>" size="30" maxlength="30" /><br /></label>
1258: <?php endif; ?>                        </div>1243: <?php endif; ?>                        </div>
1259:                     </fieldset>1244:                     </fieldset>
1260:                 </div>1245:                 </div>
1261:                 <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p>1246:                 <p class="buttons"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p>
1262:             </form>1247:             </form>
1263:         </div>1248:         </div>
1264:     </div>1249:     </div>
1286:                         <div class="infldset">1271:                         <div class="infldset">
1287:                             <input type="hidden" name="form_sent" value="1" />1272:                             <input type="hidden" name="form_sent" value="1" />
1288:                             <label><?php echo $lang_profile['Realname'] ?><br /><input type="text" name="form[realname]" value="<?php echo pun_htmlspecialchars($user['realname']) ?>" size="40" maxlength="40" /><br /></label>1273:                             <label><?php echo $lang_profile['Realname'] ?><br /><input type="text" name="form[realname]" value="<?php echo pun_htmlspecialchars($user['realname']) ?>" size="40" maxlength="40" /><br /></label>
1289: <?php if (isset($title_field)): ?>                    <?php echo $title_field ?>1274: <?php if (isset($title_field)): ?>                            <?php echo $title_field ?>
1290: <?php endif; ?>                            <label><?php echo $lang_profile['Location'] ?><br /><input type="text" name="form[location]" value="<?php echo pun_htmlspecialchars($user['location']) ?>" size="30" maxlength="30" /><br /></label>1275: <?php endif; ?>                            <label><?php echo $lang_profile['Location'] ?><br /><input type="text" name="form[location]" value="<?php echo pun_htmlspecialchars($user['location']) ?>" size="30" maxlength="30" /><br /></label>
1291:                             <label><?php echo $lang_profile['Website'] ?><br /><input type="text" name="form[url]" value="<?php echo pun_htmlspecialchars($user['url']) ?>" size="50" maxlength="80" /><br /></label>1276:                             <label><?php echo $lang_profile['Website'] ?><br /><input type="text" name="form[url]" value="<?php echo pun_htmlspecialchars($user['url']) ?>" size="50" maxlength="80" /><br /></label>
1292:                         </div>1277:                         </div>
1293:                     </fieldset>1278:                     </fieldset>
1294:                 </div>1279:                 </div>
1295:                 <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p>1280:                 <p class="buttons"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p>
1296:             </form>1281:             </form>
1297:         </div>1282:         </div>
1298:     </div>1283:     </div>
1325:                         </div>1310:                         </div>
1326:                     </fieldset>1311:                     </fieldset>
1327:                 </div>1312:                 </div>
1328:                 <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p>1313:                 <p class="buttons"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p>
1329:             </form>1314:             </form>
1330:         </div>1315:         </div>
1331:     </div>1316:     </div>
1338:             message($lang_common['Bad request']);1323:             message($lang_common['Bad request']);
1339: 1324: 
1340:         $avatar_field = '<a href="profile.php?action=upload_avatar&amp;id='.$id.'">'.$lang_profile['Change avatar'].'</a>';1325:         $avatar_field = '<a href="profile.php?action=upload_avatar&amp;id='.$id.'">'.$lang_profile['Change avatar'].'</a>';
1341:         1326: 
1342:         $user_avatar = generate_avatar_markup($id);1327:         $user_avatar = generate_avatar_markup($id);
1343:         if ($user_avatar)1328:         if ($user_avatar)
1344:             $avatar_field .= '&nbsp;&nbsp;&nbsp;<a href="profile.php?action=delete_avatar&amp;id='.$id.'">'.$lang_profile['Delete avatar'].'</a>';1329:             $avatar_field .= '&nbsp;&nbsp;&nbsp;<a href="profile.php?action=delete_avatar&amp;id='.$id.'">'.$lang_profile['Delete avatar'].'</a>';
1346:             $avatar_field = '<a href="profile.php?action=upload_avatar&amp;id='.$id.'">'.$lang_profile['Upload avatar'].'</a>';1331:             $avatar_field = '<a href="profile.php?action=upload_avatar&amp;id='.$id.'">'.$lang_profile['Upload avatar'].'</a>';
1347: 1332: 
1348:         if ($user['signature'] != '')1333:         if ($user['signature'] != '')
1349:             $signature_preview = '<p>'.$lang_profile['Sig preview'].'</p>'."\n\t\t\t\t\t".'<div class="postsignature">'."\n\t\t\t\t\t\t".'<hr />'."\n\t\t\t\t\t\t".$parsed_signature."\n\t\t\t\t\t".'</div>'."\n";1334:             $signature_preview = '<p>'.$lang_profile['Sig preview'].'</p>'."\n\t\t\t\t\t\t\t".'<div class="postsignature postmsg">'."\n\t\t\t\t\t\t\t\t".'<hr />'."\n\t\t\t\t\t\t\t\t".$parsed_signature."\n\t\t\t\t\t\t\t".'</div>'."\n";
1350:         else1335:         else
1351:             $signature_preview = '<p>'.$lang_profile['No sig'].'</p>'."\n";1336:             $signature_preview = '<p>'.$lang_profile['No sig'].'</p>'."\n";
1352: 1337: 
1366:                     <fieldset id="profileavatar">1351:                     <fieldset id="profileavatar">
1367:                         <legend><?php echo $lang_profile['Avatar legend'] ?></legend>1352:                         <legend><?php echo $lang_profile['Avatar legend'] ?></legend>
1368:                         <div class="infldset">1353:                         <div class="infldset">
1369:                             <?php if ($user_avatar) echo $user_avatar ?>                    1354:                             <?php if ($user_avatar) echo $user_avatar ?>
1370:                             <p><?php echo $lang_profile['Avatar info'] ?></p>1355:                             <p><?php echo $lang_profile['Avatar info'] ?></p>
1371:                             <p class="clearb"><?php echo $avatar_field ?></p>1356:                             <p class="clearb"><?php echo $avatar_field ?></p>
1372:                         </div>1357:                         </div>
1390:                         </div>1375:                         </div>
1391:                     </fieldset>1376:                     </fieldset>
1392:                 </div>1377:                 </div>
1393: <?php endif; ?>                <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p>1378: <?php endif; ?>                <p class="buttons"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p>
1394:             </form>1379:             </form>
1395:         </div>1380:         </div>
1396:     </div>1381:     </div>
1434:                         <legend><?php echo $lang_profile['Style legend'] ?></legend>1419:                         <legend><?php echo $lang_profile['Style legend'] ?></legend>
1435:                         <div class="infldset">1420:                         <div class="infldset">
1436:                             <label><?php echo $lang_profile['Style info'] ?><br />1421:                             <label><?php echo $lang_profile['Style info'] ?><br />
1437:  
1438:                             <select name="form[style]">1422:                             <select name="form[style]">
1439: <?php1423: <?php
1440: 1424: 
1485:                         </div>1469:                         </div>
1486:                     </fieldset>1470:                     </fieldset>
1487:                 </div>1471:                 </div>
1488:                 <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" />  <?php echo $lang_profile['Instructions'] ?></p>1472:                 <p class="buttons"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p>
1489:             </form>1473:             </form>
1490:         </div>1474:         </div>
1491:     </div>1475:     </div>
1509:                         <legend><?php echo $lang_prof_reg['Privacy options legend'] ?></legend>1493:                         <legend><?php echo $lang_prof_reg['Privacy options legend'] ?></legend>
1510:                         <div class="infldset">1494:                         <div class="infldset">
1511:                             <input type="hidden" name="form_sent" value="1" />1495:                             <input type="hidden" name="form_sent" value="1" />
1512:                             <p><?php echo $lang_prof_reg['E-mail setting info'] ?></p>1496:                             <p><?php echo $lang_prof_reg['Email setting info'] ?></p>
1513:                             <div class="rbox">1497:                             <div class="rbox">
1514:                                 <label><input type="radio" name="form[email_setting]" value="0"<?php if ($user['email_setting'] == '0') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['E-mail setting 1'] ?><br /></label>1498:                                 <label><input type="radio" name="form[email_setting]" value="0"<?php if ($user['email_setting'] == '0') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['Email setting 1'] ?><br /></label>
1515:                                 <label><input type="radio" name="form[email_setting]" value="1"<?php if ($user['email_setting'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['E-mail setting 2'] ?><br /></label>1499:                                 <label><input type="radio" name="form[email_setting]" value="1"<?php if ($user['email_setting'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['Email setting 2'] ?><br /></label>
1516:                                 <label><input type="radio" name="form[email_setting]" value="2"<?php if ($user['email_setting'] == '2') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['E-mail setting 3'] ?><br /></label>1500:                                 <label><input type="radio" name="form[email_setting]" value="2"<?php if ($user['email_setting'] == '2') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['Email setting 3'] ?><br /></label>
1517:                             </div>1501:                             </div>
1518:                         </div>1502:                         </div>
1519:                     </fieldset>1503:                     </fieldset>
1522:                     <fieldset>1506:                     <fieldset>
1523:                         <legend><?php echo $lang_profile['Subscription legend'] ?></legend>1507:                         <legend><?php echo $lang_profile['Subscription legend'] ?></legend>
1524:                         <div class="infldset">1508:                         <div class="infldset">
1525:                             <p><?php echo $lang_profile['Notify full info'] ?></p> 
1526:                             <div class="rbox">1509:                             <div class="rbox">
1527:                                 <label><input type="checkbox" name="form[notify_with_post]" value="1"<?php if ($user['notify_with_post'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Notify full'] ?><br /></label>1510:                                 <label><input type="checkbox" name="form[notify_with_post]" value="1"<?php if ($user['notify_with_post'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Notify full'] ?><br /></label>
1528:                             </div> 
1529:                             <p><?php echo $lang_profile['Auto notify full info'] ?></p> 
1530:                             <div class="rbox"> 
1531:                                 <label><input type="checkbox" name="form[auto_notify]" value="1"<?php if ($user['auto_notify'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Auto notify full'] ?><br /></label>1511:                                 <label><input type="checkbox" name="form[auto_notify]" value="1"<?php if ($user['auto_notify'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Auto notify full'] ?><br /></label>
1532:                             </div>1512:                             </div>
1533:                         </div>1513:                         </div>
1534:                     </fieldset>1514:                     </fieldset>
1535:                 </div>1515:                 </div>
1536: <?php endif; ?>                <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p>1516: <?php endif; ?>                <p class="buttons"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p>
1537:             </form>1517:             </form>
1538:         </div>1518:         </div>
1539:     </div>1519:     </div>
1631:                 $cur_category = 0;1611:                 $cur_category = 0;
1632:                 while ($cur_forum = $db->fetch_assoc($result))1612:                 while ($cur_forum = $db->fetch_assoc($result))
1633:                 {1613:                 {
1634:                     if ($cur_forum['cid'] != $cur_category)    // A new category since last iteration?1614:                     if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
1635:                     {1615:                     {
1636:                         if ($cur_category)1616:                         if ($cur_category)
1637:                             echo "\n\t\t\t\t\t\t\t\t".'</div>';1617:                             echo "\n\t\t\t\t\t\t\t\t".'</div>';
1667: <?php1647: <?php
1668: 1648: 
1669:     }1649:     }
 1650:     else
 1651:         message($lang_common['Bad request']);
1670: 1652: 
1671: ?>1653: ?>
1672:     <div class="clearer"></div>1654:     <div class="clearer"></div>


a/upload/register.php b/upload/register.php
  1: <?php  1: <?php
  2: /*********************************************************************** 
  3:   2: 
  4:   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)  3: /*---
  5:   4: 
  6:   This file is part of PunBB.  5:     Copyright (C) 2008-2009 FluxBB.org
  7:   6:     based on code copyright (C) 2002-2005 Rickard Andersson
  8:   PunBB is free software; you can redistribute it and/or modify it  7:     License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  9:   under the terms of the GNU General Public License as published 
 10:   by the Free Software Foundation; either version 2 of the License, 
 11:   or (at your option) any later version. 
 12:  
 13:   PunBB is distributed in the hope that it will be useful, but 
 14:   WITHOUT ANY WARRANTY; without even the implied warranty of 
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16:   GNU General Public License for more details. 
 17:  
 18:   You should have received a copy of the GNU General Public License 
 19:   along with this program; if not, write to the Free Software 
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 21:   MA  02111-1307  USA 
 22:  
 23: ************************************************************************/ 
 24:   8: 
   9: ---*/
 25:  10: 
 26: define('PUN_ROOT', './'); 11: define('PUN_ROOT', './');
 27: require PUN_ROOT.'include/common.php'; 12: require PUN_ROOT.'include/common.php';
 63:                 <fieldset> 48:                 <fieldset>
 64:                     <legend><?php echo $lang_register['Rules legend'] ?></legend> 49:                     <legend><?php echo $lang_register['Rules legend'] ?></legend>
 65:                     <div class="infldset"> 50:                     <div class="infldset">
 66:                         <p><?php echo $pun_config['o_rules_message'] ?></p> 51:                         <div class="usercontent"><?php echo $pun_config['o_rules_message'] ?></div>
 67:                     </div> 52:                     </div>
 68:                 </fieldset> 53:                 </fieldset>
 69:             </div> 54:             </div>
 70:             <p><input type="submit" name="agree" value="<?php echo $lang_register['Agree'] ?>" /><input type="submit" name="cancel" value="<?php echo $lang_register['Cancel'] ?>" /></p> 55:             <p class="buttons"><input type="submit" name="agree" value="<?php echo $lang_register['Agree'] ?>" /> <input type="submit" name="cancel" value="<?php echo $lang_register['Cancel'] ?>" /></p>
 71:         </form> 56:         </form>
 72:     </div> 57:     </div>
 73: </div> 58: </div>
 80: $errors = array(); 65: $errors = array();
 81:  66: 
 82: if (isset($_POST['form_sent'])) 67: if (isset($_POST['form_sent']))
 83: {     68: {
 84:     // Check that someone from this IP didn't register a user within the last hour (DoS prevention) 69:     // Check that someone from this IP didn't register a user within the last hour (DoS prevention)
 85:     $result = $db->query('SELECT 1 FROM '.$db->prefix.'users WHERE registration_ip=\''.get_remote_address().'\' AND registered>'.(time() - 3600)) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 70:     $result = $db->query('SELECT 1 FROM '.$db->prefix.'users WHERE registration_ip=\''.get_remote_address().'\' AND registered>'.(time() - 3600)) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
 86:  71: 
110:     // Validate username and passwords 95:     // Validate username and passwords
111:     if (strlen($username) < 2) 96:     if (strlen($username) < 2)
112:         $errors[] = $lang_prof_reg['Username too short']; 97:         $errors[] = $lang_prof_reg['Username too short'];
113:     else if (pun_strlen($username) > 25)    // This usually doesn't happen since the form element only accepts 25 characters 98:     else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters
114:         $errors[] = $lang_prof_reg['Username too long']; 99:         $errors[] = $lang_prof_reg['Username too long'];
115:     else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest']))100:     else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest']))
116:         $errors[] = $lang_prof_reg['Username guest'];101:         $errors[] = $lang_prof_reg['Username guest'];
118:         $errors[] = $lang_prof_reg['Username IP'];103:         $errors[] = $lang_prof_reg['Username IP'];
119:     else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false)104:     else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false)
120:         $errors[] = $lang_prof_reg['Username reserved chars'];105:         $errors[] = $lang_prof_reg['Username reserved chars'];
121:     else if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))106:     else if (preg_match('/(?:\[\/?(?:b|u|i|h|colou?r|quote|code|img|url|email|list)\]|\[(?:code|quote|list)=)/i', $username))
122:         $errors[] = $lang_prof_reg['Username BBCode'];107:         $errors[] = $lang_prof_reg['Username BBCode'];
123:         108: 
124:     // Check username for any censored words109:     // Check username for any censored words
125:     if ($pun_config['o_censoring'] == '1')110:     if ($pun_config['o_censoring'] == '1')
126:     {111:     {
146:             break;131:             break;
147:         }132:         }
148:     }133:     }
149:     134: 
150:     if (strlen($password1) < 4)135:     if (strlen($password1) < 4)
151:         $errors[] = $lang_prof_reg['Pass too short'];136:         $errors[] = $lang_prof_reg['Pass too short'];
152:     else if ($password1 != $password2)137:     else if ($password1 != $password2)
153:         $errors[] = $lang_prof_reg['Pass not match'];    138:         $errors[] = $lang_prof_reg['Pass not match'];
154: 139: 
155:     // Validate e-mail140:     // Validate email
156:     require PUN_ROOT.'include/email.php';141:     require PUN_ROOT.'include/email.php';
157: 142: 
158:     if (!is_valid_email($email1))143:     if (!is_valid_email($email1))
159:         $errors[] = $lang_common['Invalid e-mail'];144:         $errors[] = $lang_common['Invalid email'];
160:     else if ($pun_config['o_regs_verify'] == '1' && $email1 != $email2)145:     else if ($pun_config['o_regs_verify'] == '1' && $email1 != $email2)
161:         $errors[] = $lang_register['E-mail not match'];146:         $errors[] = $lang_register['Email not match'];
162: 147: 
163:     // Check it it's a banned e-mail address148:     // Check if it's a banned email address
164:     if (is_banned_email($email1))149:     if (is_banned_email($email1))
165:     {150:     {
166:         if ($pun_config['p_allow_banned_email'] == '0')151:         if ($pun_config['p_allow_banned_email'] == '0')
167:             $errors[] = $lang_prof_reg['Banned e-mail'];152:             $errors[] = $lang_prof_reg['Banned email'];
168: 153: 
169:         $banned_email = true;    // Used later when we send an alert e-mail154:         $banned_email = true; // Used later when we send an alert email
170:     }155:     }
171:     else156:     else
172:         $banned_email = false;157:         $banned_email = false;
173: 158: 
174:     // Check if someone else already has registered with that e-mail address159:     // Check if someone else already has registered with that email address
175:     $dupe_list = array();160:     $dupe_list = array();
176: 161: 
177:     $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE email=\''.$email1.'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());162:     $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE email=\''.$db->escape($email1).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
178:     if ($db->num_rows($result))163:     if ($db->num_rows($result))
179:     {164:     {
180:         if ($pun_config['p_allow_dupe_email'] == '0')165:         if ($pun_config['p_allow_dupe_email'] == '0')
181:             $errors[] = $lang_prof_reg['Dupe e-mail'];166:             $errors[] = $lang_prof_reg['Dupe email'];
182: 167: 
183:         while ($cur_dupe = $db->fetch_assoc($result))168:         while ($cur_dupe = $db->fetch_assoc($result))
184:             $dupe_list[] = $cur_dupe['username'];169:             $dupe_list[] = $cur_dupe['username'];
204:     // Did everything go according to plan?189:     // Did everything go according to plan?
205:     if (empty($errors))190:     if (empty($errors))
206:     {191:     {
207:         // Insert the new user into the database. We do this now to get the last inserted id for later use.192:         // Insert the new user into the database. We do this now to get the last inserted ID for later use
208:         $now = time();193:         $now = time();
209: 194: 
210:         $intial_group_id = ($pun_config['o_regs_verify'] == '0') ? $pun_config['o_default_user_group'] : PUN_UNVERIFIED;195:         $intial_group_id = ($pun_config['o_regs_verify'] == '0') ? $pun_config['o_default_user_group'] : PUN_UNVERIFIED;
211:         $password_hash = pun_hash($password1);196:         $password_hash = pun_hash($password1);
212: 197: 
213:         // Add the user198:         // Add the user
214:         $db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, timezone, dst, language, style, registered, registration_ip, last_visit) VALUES(\''.$db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$email1.'\', '.$email_setting.', '.$timezone.' , '.$dst.', \''.$db->escape($language).'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.')') or error('Unable to create user', __FILE__, __LINE__, $db->error());199:         $db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, timezone, dst, language, style, registered, registration_ip, last_visit) VALUES(\''.$db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$db->escape($email1).'\', '.$email_setting.', '.$timezone.' , '.$dst.', \''.$db->escape($language).'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.')') or error('Unable to create user', __FILE__, __LINE__, $db->error());
215:         $new_uid = $db->insert_id();200:         $new_uid = $db->insert_id();
216: 201: 
217: 202: 
218:         // If we previously found out that the e-mail was banned203:         // If we previously found out that the email was banned
219:         if ($banned_email && $pun_config['o_mailing_list'] != '')204:         if ($banned_email && $pun_config['o_mailing_list'] != '')
220:         {        205:         {
221:             $mail_subject = $lang_common['Banned email notification'];206:             $mail_subject = $lang_common['Banned email notification'];
222:             $mail_message = sprintf($lang_common['Banned email register message'], $username, $email1)."\n";207:             $mail_message = sprintf($lang_common['Banned email register message'], $username, $email1)."\n";
223:             $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$new_uid)."\n";208:             $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$new_uid)."\n";
226:             pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message);211:             pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message);
227:         }212:         }
228: 213: 
229:         // If we previously found out that the e-mail was a dupe214:         // If we previously found out that the email was a dupe
230:         if (!empty($dupe_list) && $pun_config['o_mailing_list'] != '')215:         if (!empty($dupe_list) && $pun_config['o_mailing_list'] != '')
231:         {        216:         {
232:             $mail_subject = $lang_common['Duplicate email notification'];217:             $mail_subject = $lang_common['Duplicate email notification'];
233:             $mail_message = sprintf($lang_common['Duplicate email register message'], $username, implode(', ', $dupe_list))."\n";218:             $mail_message = sprintf($lang_common['Duplicate email register message'], $username, implode(', ', $dupe_list))."\n";
234:             $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$new_uid)."\n";219:             $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$new_uid)."\n";
239: 224: 
240:         // Should we alert people on the admin mailing list that a new user has registered?225:         // Should we alert people on the admin mailing list that a new user has registered?
241:         if ($pun_config['o_regs_report'] == '1')226:         if ($pun_config['o_regs_report'] == '1')
242:         {    227:         {
243:             $mail_subject = $lang_common['New user notification'];228:             $mail_subject = $lang_common['New user notification'];
244:             $mail_message = sprintf($lang_common['New user message'], $username, $pun_config['o_base_url'].'/')."\n";229:             $mail_message = sprintf($lang_common['New user message'], $username, $pun_config['o_base_url'].'/')."\n";
245:             $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$new_uid)."\n";230:             $mail_message .= sprintf($lang_common['User profile'], $pun_config['o_base_url'].'/profile.php?id='.$new_uid)."\n";
268: 253: 
269:             pun_mail($email1, $mail_subject, $mail_message);254:             pun_mail($email1, $mail_subject, $mail_message);
270: 255: 
271:             message($lang_register['Reg e-mail'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.', true);256:             message($lang_register['Reg email'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.', true);
272:         }257:         }
273: 258: 
274:         pun_setcookie($new_uid, $password_hash, time() + $pun_config['o_timeout_visit']);259:         pun_setcookie($new_uid, $password_hash, time() + $pun_config['o_timeout_visit']);
279: 264: 
280: 265: 
281: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_register['Register'];266: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_register['Register'];
282: $required_fields = array('req_username' => $lang_common['Username'], 'req_password1' => $lang_common['Password'], 'req_password2' => $lang_prof_reg['Confirm pass'], 'req_email1' => $lang_common['E-mail'], 'req_email2' => $lang_common['E-mail'].' 2');267: $required_fields = array('req_username' => $lang_common['Username'], 'req_password1' => $lang_common['Password'], 'req_password2' => $lang_prof_reg['Confirm pass'], 'req_email1' => $lang_common['Email'], 'req_email2' => $lang_common['Email'].' 2');
283: $focus_element = array('register', 'req_username');268: $focus_element = array('register', 'req_username');
284: require PUN_ROOT.'header.php';269: require PUN_ROOT.'header.php';
285: 270: 
335:             </div>320:             </div>
336: <?php if ($pun_config['o_regs_verify'] == '0'): ?>            <div class="inform">321: <?php if ($pun_config['o_regs_verify'] == '0'): ?>            <div class="inform">
337:                 <fieldset>322:                 <fieldset>
338:                     <legend><?php echo $lang_register['Pass legend 1'] ?></legend>323:                     <legend><?php echo $lang_register['Pass legend'] ?></legend>
339:                     <div class="infldset">324:                     <div class="infldset">
340:                         <label class="conl"><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password1" value="<?php if (isset($_POST['req_password1'])) echo pun_htmlspecialchars($_POST['req_password1']); ?>" size="16" maxlength="16" /><br /></label>325:                         <label class="conl"><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password1" value="<?php if (isset($_POST['req_password1'])) echo pun_htmlspecialchars($_POST['req_password1']); ?>" size="16" maxlength="16" /><br /></label>
341:                         <label class="conl"><strong><?php echo $lang_prof_reg['Confirm pass'] ?></strong><br /><input type="password" name="req_password2" value="<?php if (isset($_POST['req_password2'])) echo pun_htmlspecialchars($_POST['req_password2']); ?>" size="16" maxlength="16" /><br /></label>326:                         <label class="conl"><strong><?php echo $lang_prof_reg['Confirm pass'] ?></strong><br /><input type="password" name="req_password2" value="<?php if (isset($_POST['req_password2'])) echo pun_htmlspecialchars($_POST['req_password2']); ?>" size="16" maxlength="16" /><br /></label>
345:             </div>330:             </div>
346: <?php endif; ?>            <div class="inform">331: <?php endif; ?>            <div class="inform">
347:                 <fieldset>332:                 <fieldset>
348:                     <legend><?php echo ($pun_config['o_regs_verify'] == '1') ? $lang_prof_reg['E-mail legend 2'] : $lang_prof_reg['E-mail legend'] ?></legend>333:                     <legend><?php echo ($pun_config['o_regs_verify'] == '1') ? $lang_prof_reg['Email legend 2'] : $lang_prof_reg['Email legend'] ?></legend>
349:                     <div class="infldset">334:                     <div class="infldset">
350: <?php if ($pun_config['o_regs_verify'] == '1'): ?>            <p><?php echo $lang_register['E-mail info'] ?></p>335: <?php if ($pun_config['o_regs_verify'] == '1'): ?>                        <p><?php echo $lang_register['Email info'] ?></p>
351: <?php endif; ?>                    <label><strong><?php echo $lang_common['E-mail'] ?></strong><br />336: <?php endif; ?>