root / branches / 1.1 / post.php
View | Annotate | Download (8.7 KB)
| 1 | 24 | eofredj | <?php
|
|---|---|---|---|
| 2 | 322 | eofredj | /**
|
| 3 | 559 | eofredj | * Project: Oxygen Bulletin Board |
| 4 | 559 | eofredj | * File : $HeadURL$ |
| 5 | 559 | eofredj | * Revision : $Revision$ |
| 6 | 559 | eofredj | * Author : $Author$ |
| 7 | 559 | eofredj | * Date : $Date$ |
| 8 | 559 | eofredj | * Id : $Id$ |
| 9 | 559 | eofredj | * |
| 10 | 559 | eofredj | * Oxygen is free software; you can redistribute it and/or modify it |
| 11 | 559 | eofredj | * under the terms of the GNU General Public License as published |
| 12 | 559 | eofredj | * by the Free Software Foundation; either version 2 of the License, |
| 13 | 559 | eofredj | * or (at your option) any later version. |
| 14 | 559 | eofredj | * |
| 15 | 559 | eofredj | * Oxygen is distributed in the hope that it will be useful, but |
| 16 | 559 | eofredj | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | 559 | eofredj | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | 559 | eofredj | * GNU General Public License for more details. |
| 19 | 559 | eofredj | * |
| 20 | 559 | eofredj | * You should have received a copy of the GNU General Public License |
| 21 | 559 | eofredj | * along with this program; if not, write to the Free Software |
| 22 | 559 | eofredj | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 23 | 559 | eofredj | * MA 02111-1307 USA |
| 24 | 559 | eofredj | * |
| 25 | 559 | eofredj | * @link http://www.o2php.com/ |
| 26 | 559 | eofredj | * @copyright 2002-2006 Oxygen Team. |
| 27 | 559 | eofredj | * @author Eric Fredj <heltem at o2php dot com> |
| 28 | 559 | eofredj | * @package o2php |
| 29 | 559 | eofredj | * @version [VERSION] |
| 30 | 323 | eofredj | */ |
| 31 | 69 | eofredj | $TPL_LOAD = 'header, footer, post_notloggedin, post_loggedin, post_preview, post_attachmentbox, post_newthread, post_edit, post_newpoll, post_emailnotify, post_edit_attachment, functions_smilieinsert, functions_smilieinsert_smilie, functions_bbcodeinsert, functions_piconinsert_smilie, functions_piconinsert, post_reply_review_toolong, post_reply_review_post, post_reply, post_edit_reason, post_reply_review_subject';
|
| 32 | 338 | eofredj | require('./header.php'); |
| 33 | 2 | eofredj | |
| 34 | 639 | eofredj | if(0 == $huser['id'] && 'yes' == $settings['AnonNoRead']) { |
| 35 | 565 | eofredj | message($lang['reggedonly'] . ' <a href="member.php?action=reg">' . $lang['textregister'] . '</a> ' . $lang['textor'] . ' <a href="misc.php?action=login">' . $lang['textlogin'] . '</a>'); |
| 36 | 10 | eofredj | exit;
|
| 37 | 2 | eofredj | } |
| 38 | 18 | eofredj | |
| 39 | 565 | eofredj | if(empty($action)) { |
| 40 | 565 | eofredj | redirect('index.php');
|
| 41 | 565 | eofredj | message($lang['textnoforum']);
|
| 42 | 565 | eofredj | exit;
|
| 43 | 2 | eofredj | } |
| 44 | 2 | eofredj | |
| 45 | 565 | eofredj | $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : 1; |
| 46 | 565 | eofredj | |
| 47 | 27 | eofredj | if(isset($tid)) { |
| 48 | 534 | eofredj | $query = $db->queryLimit(sprintf("SELECT * FROM $table[threads] WHERE tid=%d", $tid), 1); |
| 49 | 14 | eofredj | $thread = $db->fetch_assoc($query); |
| 50 | 14 | eofredj | $fid = $thread['fid'];
|
| 51 | 18 | eofredj | $tid = $thread['tid'];
|
| 52 | 18 | eofredj | |
| 53 | 642 | eofredj | if($huser['id'] && $huser['readtopics']['ts'] < $thread['lastpost'] && $huser['readtopics']['topics'][$tid] != $thread['lastpid']) { |
| 54 | 642 | eofredj | $huser['readtopics']['topics'][$tid] = $thread['lastpid']; |
| 55 | 642 | eofredj | $db->query(sprintf('UPDATE %s SET readtopics=%s WHERE id=%d',
|
| 56 | 642 | eofredj | $table['members'],
|
| 57 | 642 | eofredj | $db->textFormat(serialize($huser['readtopics'])),
|
| 58 | 642 | eofredj | $huser['id']));
|
| 59 | 18 | eofredj | } |
| 60 | 346 | eofredj | $threadname = $bbTinline->processHtml($thread['subject']);
|
| 61 | 565 | eofredj | $threadname = $bbTinline->processTags($threadname); |
| 62 | 346 | eofredj | $threadaction = '» <a href="viewthread.php?tid=' . $thread['tid'] . '">' . $threadname . '</a>'; |
| 63 | 2 | eofredj | } |
| 64 | 2 | eofredj | |
| 65 | 600 | eofredj | $query = $db->query("SELECT t.name AS themename, t.*, f.* FROM $table[forums] f LEFT JOIN $table[themes] t ON t.id=f.theme_id WHERE fid='$fid'");
|
| 66 | 27 | eofredj | $forum = $db->fetch_assoc($query); |
| 67 | 76 | eofredj | $fid = $forum['fid'];
|
| 68 | 2 | eofredj | |
| 69 | 92 | eofredj | if($thread['closed'] && !modcheck($o2user, $forum, $status)) { |
| 70 | 92 | eofredj | message($lang['closedmsg']);
|
| 71 | 92 | eofredj | exit;
|
| 72 | 92 | eofredj | } |
| 73 | 92 | eofredj | |
| 74 | 565 | eofredj | if(empty($huser['themename']) && !empty($forum['themename'])) { |
| 75 | 585 | eofredj | $themefield = array('themename', 'name', 'boardimg', 'imgdir', 'smdir', 'icondir', 'version', 'author', 'email', 'url'); |
| 76 | 76 | eofredj | $themedata = array();
|
| 77 | 76 | eofredj | foreach($themefield as $item) { |
| 78 | 76 | eofredj | $themedata[$item] = $forum[$item]; |
| 79 | 76 | eofredj | } |
| 80 | 76 | eofredj | |
| 81 | 76 | eofredj | $themedata = setthemevalue($themedata); |
| 82 | 76 | eofredj | } |
| 83 | 76 | eofredj | |
| 84 | 18 | eofredj | // Start Authorization Checks
|
| 85 | 24 | eofredj | $reply = 0;
|
| 86 | 282 | eofredj | if(in_array($action, array('reply', 'edit'))) { |
| 87 | 24 | eofredj | $reply = 1;
|
| 88 | 24 | eofredj | } |
| 89 | 24 | eofredj | forumident($forum, true, $reply);
|
| 90 | 18 | eofredj | |
| 91 | 230 | eofredj | $fids = array();
|
| 92 | 230 | eofredj | $group = '';
|
| 93 | 230 | eofredj | $fids[] = $forum['fid'];
|
| 94 | 2 | eofredj | |
| 95 | 230 | eofredj | if('forum' == $forum['type']) { |
| 96 | 230 | eofredj | if(false !== ($fup = getforum($forum['fup']))) { |
| 97 | 359 | eofredj | $group = "<a href=\"index.php?gid=$fup[fid]\">$fup[name]</a> »";
|
| 98 | 230 | eofredj | $fids[] = $fup['fid'];
|
| 99 | 2 | eofredj | } |
| 100 | 359 | eofredj | $navigation .= "$group <a href=\"forumdisplay.php?fid=$fid\"> $forum[name]</a> ";
|
| 101 | 230 | eofredj | } else {
|
| 102 | 230 | eofredj | $fup = getforum($forum['fup']);
|
| 103 | 230 | eofredj | $fids[] = $fup['fid'];
|
| 104 | 230 | eofredj | if(false !== ($gup = getforum($fup['fup']))) { |
| 105 | 359 | eofredj | $group = "<a href=\"index.php?gid=$gup[fid]\">$gup[name]</a> »";
|
| 106 | 230 | eofredj | $fids[] = $gup['fid'];
|
| 107 | 24 | eofredj | } |
| 108 | 359 | eofredj | $navigation .= "$group <a href=\"forumdisplay.php?fid=$fup[fid]\">$fup[name]</a> » <a href=\"forumdisplay.php?fid=$fid\"> $forum[name]</a> ";
|
| 109 | 2 | eofredj | } |
| 110 | 2 | eofredj | |
| 111 | 76 | eofredj | if($action == "reply") { |
| 112 | 14 | eofredj | $postaction = "$threadaction » $lang[textpostreply]";
|
| 113 | 76 | eofredj | } else if($action == "edit") { |
| 114 | 14 | eofredj | $postaction = "$threadaction » $lang[texteditpost]";
|
| 115 | 76 | eofredj | } else if($action == "newthread" && $poll == "yes") { |
| 116 | 14 | eofredj | $postaction = "» $lang[textnewpoll]";
|
| 117 | 76 | eofredj | } else {
|
| 118 | 14 | eofredj | $postaction = "» $lang[textnewtopic]";
|
| 119 | 2 | eofredj | } |
| 120 | 2 | eofredj | |
| 121 | 230 | eofredj | $navigation = "» $navigation $postaction";
|
| 122 | 2 | eofredj | |
| 123 | 14 | eofredj | $navtitle = strip_tags($navigation); |
| 124 | 2 | eofredj | |
| 125 | 76 | eofredj | if(!isset($submit)) { |
| 126 | 230 | eofredj | if($forum['attachstatus'] != "no" && $settings['attach_status'] != "no") { |
| 127 | 14 | eofredj | eval("\$attachfile = \"".template("post_attachmentbox")."\";"); |
| 128 | 14 | eofredj | } |
| 129 | 2 | eofredj | |
| 130 | 100 | eofredj | if(!$o2user) {
|
| 131 | 230 | eofredj | if($settings['coppa'] == "on") { |
| 132 | 14 | eofredj | $reglink = "<a href=\"member.php?action=coppa\">$lang[regques]</a>";
|
| 133 | 76 | eofredj | } else {
|
| 134 | 14 | eofredj | $reglink = "<a href=\"member.php?action=reg\">$lang[regques]</a>";
|
| 135 | 14 | eofredj | } |
| 136 | 14 | eofredj | eval("\$loggedin = \"".template("post_notloggedin")."\";"); |
| 137 | 76 | eofredj | } else {
|
| 138 | 14 | eofredj | eval("\$loggedin = \"".template("post_loggedin")."\";"); |
| 139 | 14 | eofredj | } |
| 140 | 2 | eofredj | |
| 141 | 639 | eofredj | if(0 !== $huser['id']) { |
| 142 | 85 | eofredj | if('' != $huser['sig']) { |
| 143 | 85 | eofredj | $usesigcheck = 'checked="checked"';
|
| 144 | 14 | eofredj | } |
| 145 | 2 | eofredj | |
| 146 | 642 | eofredj | if($huser['emailnotify']) { |
| 147 | 85 | eofredj | $notifychecked = 'checked="checked"';
|
| 148 | 14 | eofredj | } |
| 149 | 14 | eofredj | |
| 150 | 76 | eofredj | if($forum['guestposting'] == "yes") { |
| 151 | 14 | eofredj | $guestpostingmsg = $lang['guestpostingonmsg'];
|
| 152 | 14 | eofredj | } |
| 153 | 14 | eofredj | } |
| 154 | 14 | eofredj | |
| 155 | 230 | eofredj | if($settings['allownotify'] == "yes") { |
| 156 | 14 | eofredj | eval("\$post_emailnotify = \"".template("post_emailnotify")."\";"); |
| 157 | 2 | eofredj | } |
| 158 | 2 | eofredj | |
| 159 | 76 | eofredj | if($forum['allowimgcode'] == "yes") { |
| 160 | 24 | eofredj | $allowimgcode = $lang['textyes'];
|
| 161 | 76 | eofredj | } else {
|
| 162 | 24 | eofredj | $allowimgcode = $lang['textno'];
|
| 163 | 2 | eofredj | } |
| 164 | 2 | eofredj | |
| 165 | 76 | eofredj | if($forum['allowhtml'] == "yes") { |
| 166 | 24 | eofredj | $allowhtml = $lang['textyes'];
|
| 167 | 76 | eofredj | } else {
|
| 168 | 24 | eofredj | $allowhtml = $lang['textno'];
|
| 169 | 14 | eofredj | } |
| 170 | 2 | eofredj | |
| 171 | 76 | eofredj | if($forum['allowsmilies'] == "yes") { |
| 172 | 24 | eofredj | $allowsmilies = $lang['textyes'];
|
| 173 | 76 | eofredj | } else {
|
| 174 | 24 | eofredj | $allowsmilies = $lang['textno'];
|
| 175 | 14 | eofredj | } |
| 176 | 2 | eofredj | |
| 177 | 76 | eofredj | if($forum['allowbbcode'] == "yes") { |
| 178 | 24 | eofredj | $allowbbcode = $lang['textyes'];
|
| 179 | 76 | eofredj | } else {
|
| 180 | 24 | eofredj | $allowbbcode = $lang['textno'];
|
| 181 | 14 | eofredj | } |
| 182 | 2 | eofredj | |
| 183 | 14 | eofredj | $pperm = explode("|", $forum['postperm']); |
| 184 | 2 | eofredj | |
| 185 | 76 | eofredj | if($pperm[0] == 1) { |
| 186 | 14 | eofredj | $whopost1 = $lang['whocanpost11'];
|
| 187 | 76 | eofredj | } elseif($pperm[0] == 2) { |
| 188 | 14 | eofredj | $whopost1 = $lang['whocanpost12'];
|
| 189 | 76 | eofredj | } elseif($pperm[0] == 3) { |
| 190 | 14 | eofredj | $whopost1 = $lang['whocanpost13'];
|
| 191 | 76 | eofredj | } elseif($pperm[0] == 4) { |
| 192 | 14 | eofredj | $whopost1 = $lang['whocanpost14'];
|
| 193 | 14 | eofredj | } |
| 194 | 2 | eofredj | |
| 195 | 76 | eofredj | if($pperm[1] == 1) { |
| 196 | 14 | eofredj | $whopost2 = $lang['whocanpost21'];
|
| 197 | 76 | eofredj | } elseif($pperm[1] == 2) { |
| 198 | 14 | eofredj | $whopost2 = $lang['whocanpost22'];
|
| 199 | 76 | eofredj | } elseif($pperm[1] == 3) { |
| 200 | 14 | eofredj | $whopost2 = $lang['whocanpost23'];
|
| 201 | 76 | eofredj | } elseif($pperm[1] == 4) { |
| 202 | 14 | eofredj | $whopost2 = $lang['whocanpost24'];
|
| 203 | 14 | eofredj | } |
| 204 | 2 | eofredj | |
| 205 | 76 | eofredj | if($pperm[0] == 4 && $pperm[1] == 4) { |
| 206 | 14 | eofredj | $whopost3 = $lang['whocanpost32'];
|
| 207 | 2 | eofredj | } |
| 208 | 14 | eofredj | |
| 209 | 27 | eofredj | if($previewpost) {
|
| 210 | 565 | eofredj | $poston = $lang['textposton'] . ' ' . datecvt($now + $time3600); |
| 211 | 27 | eofredj | if($settings['max_post_length']) { |
| 212 | 18 | eofredj | $message = substr($message, 0, $settings['max_post_length']); |
| 213 | 14 | eofredj | } |
| 214 | 27 | eofredj | |
| 215 | 314 | eofredj | $bbT->init(); |
| 216 | 27 | eofredj | if($bbcodeoff != "yes" && $forum['allowbbcode'] == "yes") { |
| 217 | 27 | eofredj | $tags = array(
|
| 218 | 27 | eofredj | 'quote',
|
| 219 | 27 | eofredj | 'color',
|
| 220 | 27 | eofredj | 'align',
|
| 221 | 27 | eofredj | 'center',
|
| 222 | 27 | eofredj | 'url',
|
| 223 | 27 | eofredj | 'bg',
|
| 224 | 27 | eofredj | 'sql',
|
| 225 | 27 | eofredj | 'blink',
|
| 226 | 27 | eofredj | 'php',
|
| 227 | 27 | eofredj | 'email',
|
| 228 | 27 | eofredj | 'font',
|
| 229 | 27 | eofredj | 'flash',
|
| 230 | 27 | eofredj | 'marquee',
|
| 231 | 27 | eofredj | 'img',
|
| 232 | 27 | eofredj | 'member',
|
| 233 | 27 | eofredj | 'code',
|
| 234 | 27 | eofredj | 'list',
|
| 235 | 27 | eofredj | 'li',
|
| 236 | 27 | eofredj | 'table',
|
| 237 | 27 | eofredj | 'row',
|
| 238 | 27 | eofredj | 'col',
|
| 239 | 27 | eofredj | 'strike',
|
| 240 | 27 | eofredj | 'size',
|
| 241 | 27 | eofredj | 'b',
|
| 242 | 27 | eofredj | 'i',
|
| 243 | 27 | eofredj | 'u',
|
| 244 | 27 | eofredj | 'sup',
|
| 245 | 27 | eofredj | 'sub');
|
| 246 | 27 | eofredj | } |
| 247 | 27 | eofredj | $bbT->handleTags($tags); |
| 248 | 27 | eofredj | |
| 249 | 27 | eofredj | if($smileyoff != "yes" && $forum['allowsmilies'] == "yes") { |
| 250 | 27 | eofredj | // Cache Smilies
|
| 251 | 27 | eofredj | smcwcache(true, false); |
| 252 | 27 | eofredj | $smilies = $o2cache['smilies'];
|
| 253 | 27 | eofredj | if($smilies[0] > 0) { |
| 254 | 27 | eofredj | $bbT->addSmilies($smilies[1]);
|
| 255 | 27 | eofredj | } |
| 256 | 27 | eofredj | } |
| 257 | 565 | eofredj | $message = $bbT->processHtml($message); |
| 258 | 565 | eofredj | $message1 = $bbT->processWrap($message); |
| 259 | 27 | eofredj | $message1 = $bbT->processTags($message1, true);
|
| 260 | 27 | eofredj | |
| 261 | 565 | eofredj | $subject1 = postify($subject); |
| 262 | 565 | eofredj | $thread['subject'] = $subject;
|
| 263 | 27 | eofredj | |
| 264 | 346 | eofredj | if(!empty($posticon)) { |
| 265 | 565 | eofredj | $posticon = urlencode($posticon); |
| 266 | 565 | eofredj | $posticon = '<img src="' . $themedata['smdir'] . '/' . $posticon . '" alt="' . $posticon . '"/>'; |
| 267 | 14 | eofredj | } |
| 268 | 2 | eofredj | |
| 269 | 27 | eofredj | if($smileyoff == "yes") { |
| 270 | 85 | eofredj | $smileoffcheck = 'checked="checked"';
|
| 271 | 14 | eofredj | } |
| 272 | 8 | eofredj | |
| 273 | 27 | eofredj | if($usesig == "yes") { |
| 274 | 85 | eofredj | $usesigcheck = 'checked="checked"';
|
| 275 | 14 | eofredj | } |
| 276 | 2 | eofredj | |
| 277 | 27 | eofredj | if($bbcodeoff == "yes") { |
| 278 | 85 | eofredj | $codeoffcheck = 'checked="checked"';
|
| 279 | 14 | eofredj | } |
| 280 | 14 | eofredj | eval("\$preview = \"".template("post_preview")."\";"); |
| 281 | 14 | eofredj | } |
| 282 | 27 | eofredj | } else {
|
| 283 | 27 | eofredj | if(isset($attach) && $attach['size'] != 0 && $forum['attachstatus'] != "no") { |
| 284 | 27 | eofredj | if(!is_uploaded_file($attach['tmp_name'])) { |
| 285 | 24 | eofredj | message($lang['uploadfailed'] . " : [$attach[name]]"); |
| 286 | 14 | eofredj | exit;
|
| 287 | 14 | eofredj | } |
| 288 | 14 | eofredj | } |
| 289 | 2 | eofredj | } |
| 290 | 2 | eofredj | |
| 291 | 565 | eofredj | $action = preg_replace('`[^[:alnum:]]`', '', $_REQUEST['action']); |
| 292 | 565 | eofredj | if(file_exists('./modules/post_' . $action . '.inc.php')) { |
| 293 | 24 | eofredj | // Get bb code and smilie inserters ready
|
| 294 | 24 | eofredj | $bbcodeinsert = bbcodeinsert(); |
| 295 | 250 | eofredj | if('edit' != $action) { |
| 296 | 24 | eofredj | $smiliesarray = smilieinsert($status); |
| 297 | 24 | eofredj | $smilieinsert = $smiliesarray[0];
|
| 298 | 24 | eofredj | $smilieicons = $smiliesarray[1];
|
| 299 | 24 | eofredj | } |
| 300 | 565 | eofredj | include('./modules/post_' . $action . '.inc.php'); |
| 301 | 565 | eofredj | } else {
|
| 302 | 565 | eofredj | header('Location: ' . O2_URL);
|
| 303 | 565 | eofredj | exit;
|
| 304 | 2 | eofredj | } |
| 305 | 2 | eofredj | |
| 306 | 24 | eofredj | $timing->chrono($now); |
| 307 | 24 | eofredj | $endtime = $timing->getchrono($now); |
| 308 | 2 | eofredj | $totaltime = $endtime[2];
|
| 309 | 2 | eofredj | |
| 310 | 2 | eofredj | eval("\$footer = \"".template("footer")."\";"); |
| 311 | 2 | eofredj | echo $footer; |