Beehive PHP Cross Reference Discussion Forums

Source: /lpost.php - 639 lines - 21046 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /*======================================================================
   4  
   5  Copyright Project Beehive Forum 2002
   6  
   7  This file is part of Beehive Forum.
   8  
   9  Beehive Forum is free software; you can redistribute it and/or modify
  10  it under the terms of the GNU General Public License as published by
  11  the Free Software Foundation; either version 3 of the License, or
  12  (at your option) any later version.
  13  
  14  Beehive Forum is distributed in the hope that it will be useful,
  15  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17  GNU General Public License for more details.
  18  
  19  You should have received a copy of the GNU General Public License
  20  along with Beehive; if not, write to the Free Software
  21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  22  USA
  23  
  24  ======================================================================*/
  25  
  26  // Bootstrap
  27  require_once  'lboot.php';
  28  
  29  // Required includes
  30  require_once  BH_INCLUDE_PATH . 'admin.inc.php';
  31  require_once  BH_INCLUDE_PATH . 'attachments.inc.php';
  32  require_once  BH_INCLUDE_PATH . 'constants.inc.php';
  33  require_once  BH_INCLUDE_PATH . 'email.inc.php';
  34  require_once  BH_INCLUDE_PATH . 'emoticons.inc.php';
  35  require_once  BH_INCLUDE_PATH . 'fixhtml.inc.php';
  36  require_once  BH_INCLUDE_PATH . 'folder.inc.php';
  37  require_once  BH_INCLUDE_PATH . 'form.inc.php';
  38  require_once  BH_INCLUDE_PATH . 'format.inc.php';
  39  require_once  BH_INCLUDE_PATH . 'forum.inc.php';
  40  require_once  BH_INCLUDE_PATH . 'header.inc.php';
  41  require_once  BH_INCLUDE_PATH . 'html.inc.php';
  42  require_once  BH_INCLUDE_PATH . 'light.inc.php';
  43  require_once  BH_INCLUDE_PATH . 'messages.inc.php';
  44  require_once  BH_INCLUDE_PATH . 'perm.inc.php';
  45  require_once  BH_INCLUDE_PATH . 'poll.inc.php';
  46  require_once  BH_INCLUDE_PATH . 'post.inc.php';
  47  require_once  BH_INCLUDE_PATH . 'session.inc.php';
  48  require_once  BH_INCLUDE_PATH . 'thread.inc.php';
  49  require_once  BH_INCLUDE_PATH . 'user.inc.php';
  50  require_once  BH_INCLUDE_PATH . 'word_filter.inc.php';
  51  // End Required includes
  52  
  53  // Check we're logged in correctly
  54  if (!session::logged_in()) {
  55      light_html_guest_error();
  56  }
  57  
  58  if (!folder_get_by_type_allowed(FOLDER_ALLOW_NORMAL_THREAD)) {
  59      light_html_message_type_error();
  60  }
  61  
  62  $show_sigs = session::show_sigs();
  63  
  64  $page_prefs = session::get_post_page_prefs();
  65  
  66  $high_interest = (isset($_SESSION['MARK_AS_OF_INT']) && $_SESSION['MARK_AS_OF_INT'] == 'Y') ? 'Y' : 'N';
  67  
  68  $valid = true;
  69  
  70  $new_thread = false;
  71  
  72  $to_logon_array = array();
  73  
  74  $reply_to_pid = null;
  75  
  76  $reply_message = null;
  77  
  78  $fid = null;
  79  
  80  $threadtitle = null;
  81  
  82  if (($sig = user_get_sig($_SESSION['UID'])) !== false) {
  83      $sig = fix_html($sig);
  84  }
  85  
  86  if (isset($_POST['newthread']) && (isset($_POST['post']) || isset($_POST['preview']))) {
  87  
  88      $new_thread = true;
  89  
  90      if (isset($_POST['threadtitle']) && strlen(trim($_POST['threadtitle'])) > 0) {
  91  
  92          $threadtitle = trim($_POST['threadtitle']);
  93  
  94      } else {
  95  
  96          $error_msg_array[] = gettext("You must enter a title for the thread!");
  97          $valid = false;
  98      }
  99  
 100      if (isset($_POST['fid']) && is_numeric($_POST['fid'])) {
 101  
 102          if (folder_thread_type_allowed($_POST['fid'], FOLDER_ALLOW_NORMAL_THREAD)) {
 103  
 104              $fid = $_POST['fid'];
 105  
 106          } else {
 107  
 108              $error_msg_array[] = gettext("You cannot post this thread type in that folder!");
 109              $valid = false;
 110          }
 111  
 112      } else if ($valid) {
 113  
 114          $error_msg_array[] = gettext("Please select a folder");
 115          $valid = false;
 116      }
 117  
 118  } else if (!isset($_POST['reply_to'])) {
 119  
 120      $valid = false;
 121  }
 122  
 123  if (isset($_POST['attachment']) && is_array($_POST['attachment'])) {
 124      $attachments = array_filter($_POST['attachment'], 'is_md5');
 125  } else {
 126      $attachments = array();
 127  }
 128  if (isset($_POST['dedupe']) && is_numeric($_POST['dedupe'])) {
 129      $dedupe = $_POST['dedupe'];
 130  } else {
 131      $dedupe = time();
 132  }
 133  
 134  if (isset($_POST['post']) || isset($_POST['preview'])) {
 135  
 136      if (isset($_POST['content']) && strlen(trim($_POST['content'])) > 0) {
 137  
 138          $content = nl2br(fix_html(emoticons_strip($_POST['content'])));
 139  
 140          if (attachments_embed_check($content)) {
 141  
 142              $error_msg_array[] = gettext("You are not allowed to embed attachments in your posts.");
 143              $valid = false;
 144          }
 145  
 146      } else {
 147  
 148          $error_msg_array[] = gettext("You must enter some content for the post!");
 149          $valid = false;
 150      }
 151  }
 152  
 153  if (isset($_POST['more'])) {
 154  
 155      if (isset($_POST['content']) && strlen(trim($_POST['content'])) > 0) {
 156          $content = nl2br(fix_html(emoticons_strip($_POST['content'])));
 157      }
 158  }
 159  
 160  if (isset($_POST['emots_toggle']) || isset($_POST['sig_toggle'])) {
 161  
 162      if (isset($_POST['newthread'])) {
 163  
 164          if (isset($_POST['threadtitle']) && strlen(trim($_POST['threadtitle'])) > 0) {
 165              $threadtitle = trim($_POST['threadtitle']);
 166          }
 167  
 168          if (isset($_POST['fid']) && is_numeric($_POST['fid'])) {
 169  
 170              if (folder_thread_type_allowed($_POST['fid'], FOLDER_ALLOW_NORMAL_THREAD)) {
 171  
 172                  $fid = $_POST['fid'];
 173  
 174              } else {
 175  
 176                  $error_msg_array[] = gettext("You cannot post this thread type in that folder!");
 177                  $valid = false;
 178              }
 179          }
 180      }
 181  
 182      if (isset($_POST['content']) && strlen(trim($_POST['content'])) > 0) {
 183          $content = nl2br(fix_html(emoticons_strip($_POST['content'])));
 184      }
 185  
 186      if (isset($_POST['emots_toggle'])) {
 187  
 188          $page_prefs = (double)$page_prefs ^ POST_EMOTICONS_DISPLAY;
 189  
 190      } else if (isset($_POST['sig_toggle'])) {
 191  
 192          $page_prefs = (double)$page_prefs ^ POST_SIGNATURE_DISPLAY;
 193      }
 194  
 195      $user_prefs = array(
 196          'POST_PAGE' => $page_prefs
 197      );
 198  
 199      if (!user_update_prefs($_SESSION['UID'], $user_prefs)) {
 200  
 201          $error_msg_array[] = gettext("Some or all of your user account details could not be updated. Please try again later.");
 202          $valid = false;
 203      }
 204  }
 205  
 206  if (!isset($content)) $content = "";
 207  
 208  if (isset($_GET['reply_to']) && validate_msg($_GET['reply_to'])) {
 209  
 210      list($tid, $reply_to_pid) = explode(".", $_GET['reply_to']);
 211  
 212      if (isset($_GET['return_msg']) && validate_msg($_GET['return_msg'])) {
 213          $return_msg = $_GET['return_msg'];
 214      } else {
 215          $return_msg = $_GET['reply_to'];
 216      }
 217  
 218      if (!($fid = thread_get_folder_fid($tid))) {
 219          light_html_draw_error(gettext("The requested thread could not be found or access was denied."));
 220      }
 221  
 222      if (session::check_perm(USER_PERM_EMAIL_CONFIRM, 0)) {
 223  
 224          light_html_email_confirmation_error();
 225          exit;
 226      }
 227  
 228      if (!session::check_perm(USER_PERM_POST_CREATE, $fid)) {
 229          light_html_draw_error(gettext("You cannot reply to posts in this folder"));
 230      }
 231  
 232      $new_thread = false;
 233  
 234  } else if (isset($_POST['reply_to']) && validate_msg($_POST['reply_to'])) {
 235  
 236      list($tid, $reply_to_pid) = explode(".", $_POST['reply_to']);
 237  
 238      if (isset($_POST['return_msg']) && validate_msg($_POST['return_msg'])) {
 239          $return_msg = $_POST['return_msg'];
 240      } else {
 241          $return_msg = $_POST['reply_to'];
 242      }
 243  
 244      if (!($fid = thread_get_folder_fid($tid))) {
 245          light_html_draw_error(gettext("The requested thread could not be found or access was denied."));
 246      }
 247  
 248      if (session::check_perm(USER_PERM_EMAIL_CONFIRM, 0)) {
 249  
 250          light_html_email_confirmation_error();
 251          exit;
 252      }
 253  
 254      if (!session::check_perm(USER_PERM_POST_CREATE, $fid)) {
 255          light_html_draw_error(gettext("You cannot reply to posts in this folder"));
 256      }
 257  
 258      if (sizeof($attachments) > 0 && !session::check_perm(USER_PERM_POST_ATTACHMENTS | USER_PERM_POST_READ, $fid)) {
 259  
 260          $error_msg_array[] = gettext("You cannot post attachments in this folder. Remove attachments to continue.");
 261          $valid = false;
 262      }
 263  
 264      if (sizeof($attachments) > 0 && !attachments_check_post_space($_SESSION['UID'], $attachments)) {
 265  
 266          $max_post_attachment_space = forum_get_setting('attachments_max_post_space', 'is_numeric', 1048576);
 267          $error_msg_array[] = gettext(sprintf("You have too many files attached to this post. Maximum attachment space per post is %s", format_file_size($max_post_attachment_space)));
 268          $valid = false;
 269      }
 270  
 271      $new_thread = false;
 272  
 273  } else {
 274  
 275      $new_thread = true;
 276  
 277      if (isset($_GET['fid']) && is_numeric($_GET['fid'])) {
 278          $fid = $_GET['fid'];
 279      } else if (isset($_POST['fid']) && is_numeric($_POST['fid'])) {
 280          $fid = $_POST['fid'];
 281      }
 282  
 283      if (isset($fid) && !folder_is_valid($fid)) {
 284  
 285          $error_msg_array[] = gettext("Invalid Folder ID. Check that a folder with this ID exists!");
 286          $valid = false;
 287      }
 288  
 289      if (session::check_perm(USER_PERM_EMAIL_CONFIRM, 0)) {
 290  
 291          light_html_email_confirmation_error();
 292          exit;
 293      }
 294  
 295      if (isset($fid) && !session::check_perm(USER_PERM_THREAD_CREATE | USER_PERM_POST_READ, $fid)) {
 296  
 297          $error_msg_array[] = gettext("You cannot create new threads in this folder");
 298          $valid = false;
 299      }
 300  
 301      if (isset($fid) && sizeof($attachments) > 0 && !session::check_perm(USER_PERM_POST_ATTACHMENTS | USER_PERM_POST_READ, $fid)) {
 302  
 303          $error_msg_array[] = gettext("You cannot post attachments in this folder. Remove attachments to continue.");
 304          $valid = false;
 305      }
 306  
 307      if (sizeof($attachments) > 0 && !attachments_check_post_space($_SESSION['UID'], $attachments)) {
 308  
 309          $error_msg_array[] = gettext(sprintf("You have too many files attached to this post. Maximum attachment space per post is %s", format_file_size($max_post_attachment_space)));
 310          $valid = false;
 311      }
 312  }
 313  
 314  if (!$new_thread) {
 315  
 316      if (!($reply_message = messages_get($tid, $reply_to_pid))) {
 317          light_html_draw_error(gettext("That post does not exist in this thread!"));
 318      }
 319  
 320      if (!($thread_data = thread_get($tid))) {
 321          light_html_draw_error(gettext("The requested thread could not be found or access was denied."));
 322      }
 323  
 324      $reply_message['CONTENT'] = message_get_content($tid, $reply_to_pid);
 325  
 326      if (((perm_get_user_permissions($reply_message['FROM_UID']) & USER_PERM_WORMED) && !session::check_perm(USER_PERM_FOLDER_MODERATE, $fid)) || ((!isset($reply_message['CONTENT']) || $reply_message['CONTENT'] == "") && $thread_data['POLL_FLAG'] != 'Y' && $reply_to_pid != 0)) {
 327          light_html_draw_error(gettext("Message not found. Check that it hasn't been deleted."));
 328      }
 329  }
 330  
 331  if (isset($_POST['to_logon'])) {
 332  
 333      if (strlen(trim($_POST['to_logon'])) > 0) {
 334  
 335          $to_logon_array = preg_split('/,\s*/u', trim($_POST['to_logon'], ', '));
 336  
 337          $to_logon_array = array_filter(array_map('trim', $to_logon_array), 'strlen');
 338  
 339          foreach ($to_logon_array as $key => $recipient) {
 340  
 341              $to_logon = trim($recipient);
 342  
 343              unset($to_logon_array[$key]);
 344  
 345              if (($to_user = user_get_by_logon($to_logon)) !== false) {
 346  
 347                  $to_logon_array[$to_user['UID']] = array(
 348                      'UID' => $to_user['UID'],
 349                      'LOGON' => $to_user['LOGON'],
 350                      'NICKNAME' => $to_user['NICKNAME']
 351                  );
 352  
 353              } else {
 354  
 355                  $error_msg_array[] = sprintf(gettext("User %s not found"), $to_logon);
 356                  $valid = false;
 357              }
 358          }
 359  
 360          $to_logon = implode(', ', array_map('user_get_logon_callback', $to_logon_array));
 361  
 362          if ($valid && sizeof($to_logon_array) > 10) {
 363  
 364              $error_msg_array[] = gettext("There is a limit of 10 recipients per message. Please amend your recipient list.");
 365              $valid = false;
 366          }
 367      }
 368  
 369  } else if (isset($tid) && isset($reply_to_pid) && ($reply_to_pid > 0)) {
 370  
 371      $to_logon = $reply_message['FROM_LOGON'];
 372  }
 373  
 374  $allow_html = true;
 375  
 376  $allow_sig = true;
 377  
 378  if (isset($fid) && !session::check_perm(USER_PERM_HTML_POSTING, $fid)) {
 379      $allow_html = false;
 380  }
 381  
 382  if (isset($fid) && !session::check_perm(USER_PERM_SIGNATURE, $fid)) {
 383      $allow_sig = false;
 384  }
 385  
 386  if ($allow_html == false) {
 387  
 388      $content = htmlentities_array($content);
 389      $sig = htmlentities_array($sig);
 390  }
 391  
 392  if ((mb_strlen($content) + mb_strlen($sig)) >= 65535) {
 393  
 394      $error_msg_array[] = sprintf(
 395          gettext("Combined Message and signature length must be less than 65,535 characters (currently: %s)"),
 396          number_format(mb_strlen($content) + mb_strlen($sig))
 397      );
 398  
 399      $valid = false;
 400  }
 401  
 402  if ($valid && isset($_POST['post'])) {
 403  
 404      if (post_check_frequency()) {
 405  
 406          if (post_check_ddkey($dedupe)) {
 407  
 408              if ($new_thread) {
 409  
 410                  $tid = post_create_thread($fid, $_SESSION['UID'], $threadtitle, 'N', 'N', false);
 411                  $reply_to_pid = 0;
 412  
 413              } else {
 414  
 415                  if (isset($thread_data['CLOSED']) && $thread_data['CLOSED'] > 0 && (!session::check_perm(USER_PERM_FOLDER_MODERATE, $fid))) {
 416                      light_html_draw_error(gettext("This thread is closed, you cannot post in it!"));
 417                  }
 418              }
 419  
 420              if (isset($tid) && is_numeric($tid)) {
 421  
 422                  if ($allow_sig == true && strlen(trim($sig)) > 0) {
 423                      $content .= "<div class=\"sig\">$sig</div>";
 424                  }
 425  
 426                  if (($new_pid = post_create($fid, $tid, $reply_to_pid, $_SESSION['UID'], $to_logon_array, $content)) !== false) {
 427  
 428                      if ($high_interest == "Y") {
 429                          thread_set_high_interest($tid);
 430                      }
 431  
 432                      email_send_notification($tid, $new_pid);
 433  
 434                      email_send_thread_subscription($tid, $new_pid);
 435  
 436                      email_send_folder_subscription($fid, $tid, $new_pid);
 437  
 438                      if (perm_check_folder_permissions($fid, USER_PERM_POST_APPROVAL, $_SESSION['UID']) && !perm_is_moderator($_SESSION['UID'], $fid)) {
 439                          admin_send_post_approval_notification($fid);
 440                      }
 441  
 442                      if (sizeof($attachments) > 0 && ($attachments_array = attachments_get($_SESSION['UID'], $attachments)) !== false) {
 443  
 444                          foreach ($attachments_array as $attachment) {
 445  
 446                              post_add_attachment($tid, $new_pid, $attachment['aid']);
 447                          }
 448                      }
 449                  }
 450              }
 451          }
 452  
 453          if ($new_thread && isset($tid) && is_numeric($tid)) {
 454  
 455              $uri = "lmessages.php?webtag=$webtag&msg=$tid.1";
 456  
 457          } else {
 458  
 459              if (isset($return_msg)) {
 460  
 461                  $uri = "lmessages.php?webtag=$webtag&msg=$return_msg";
 462  
 463              } else if (isset($tid) && is_numeric($tid) && isset($reply_to_pid) && is_numeric($reply_to_pid)) {
 464  
 465                  $uri = "lmessages.php?webtag=$webtag&msg=$tid.$reply_to_pid";
 466  
 467              } else {
 468  
 469                  $uri = "lmessages.php?webtag=$webtag";
 470              }
 471  
 472              if (isset($tid) && is_numeric($tid) && isset($new_pid) && is_numeric($new_pid)) {
 473                  $uri .= "&post_success=$tid.$new_pid";
 474              }
 475          }
 476  
 477          header_redirect($uri);
 478          exit;
 479  
 480      } else {
 481  
 482          $error_msg_array[] = sprintf(gettext("You can only post once every %s seconds. Please try again later."), forum_get_setting('minimum_post_frequency', 'is_numeric', 0));
 483      }
 484  }
 485  
 486  if (!isset($fid)) {
 487      $fid = 1;
 488  }
 489  
 490  if (($new_thread && !($folder_dropdown = folder_draw_dropdown($fid, "fid", "", FOLDER_ALLOW_NORMAL_THREAD, USER_PERM_THREAD_CREATE, "", "post_folder_dropdown")))) {
 491      light_html_draw_error(gettext("You cannot create new threads."));
 492  }
 493  
 494  if (isset($thread_data['CLOSED']) && $thread_data['CLOSED'] > 0 && !session::check_perm(USER_PERM_FOLDER_MODERATE, $fid)) {
 495      light_html_draw_error(gettext("This thread is closed, you cannot post in it!"));
 496  }
 497  
 498  light_html_draw_top(sprintf("title=%s", gettext("Post message")), 'js/fineuploader.min.js', 'js/attachments.js');
 499  
 500  if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
 501      light_html_display_error_array($error_msg_array);
 502  }
 503  
 504  if (!$new_thread && isset($thread_data['CLOSED']) && $thread_data['CLOSED'] > 0 && session::check_perm(USER_PERM_FOLDER_MODERATE, $fid)) {
 505      light_html_display_warning_msg(gettext("Warning: this thread is closed for posting to normal users."));
 506  }
 507  
 508  if ($valid && isset($_POST['preview'])) {
 509  
 510      echo "<h3>", gettext("Message Preview"), "</h3>";
 511  
 512      $preview_message['RECIPIENTS'] = $to_logon_array;
 513  
 514      $preview_fuser = user_get($_SESSION['UID']);
 515  
 516      $preview_message['FROM_LOGON'] = $preview_fuser['LOGON'];
 517      $preview_message['FROM_NICKNAME'] = $preview_fuser['NICKNAME'];
 518      $preview_message['FROM_UID'] = $preview_fuser['UID'];
 519  
 520      $preview_message['CONTENT'] = $content;
 521  
 522      if ($allow_sig == true && strlen(trim($sig)) > 0) {
 523          $preview_message['CONTENT'] = $preview_message['CONTENT'] . "<div class=\"sig\">" . $sig . "</div>";
 524      }
 525  
 526      $preview_message['CREATED'] = time();
 527      $preview_message['ATTACHMENTS'] = $attachments;
 528  
 529      light_message_display(0, $preview_message, 0, 0, 0, false, false, false, false, true);
 530  }
 531  
 532  if (!$new_thread) {
 533  
 534      if (isset($thread_data['CLOSED']) && $thread_data['CLOSED'] > 0) {
 535  
 536          if (session::check_perm(USER_PERM_FOLDER_MODERATE, $fid)) {
 537  
 538              echo "<h3>", gettext("Warning: this thread is closed for posting to normal users."), "</h3>\n";
 539  
 540          } else {
 541  
 542              echo "<h3>", gettext("This thread is closed, you cannot post in it!"), "</h3>\n";
 543              light_html_draw_bottom();
 544              exit;
 545          }
 546      }
 547  }
 548  
 549  echo "<form accept-charset=\"utf-8\" name=\"f_post\" action=\"lpost.php\" method=\"post\">\n";
 550  echo form_input_hidden('webtag', htmlentities_array($webtag));
 551  echo form_input_hidden('dedupe', htmlentities_array($dedupe));
 552  
 553  echo "<div class=\"post\">\n";
 554  
 555  if (!isset($threadtitle)) {
 556      $threadtitle = "";
 557  }
 558  
 559  if (!isset($fid)) {
 560      $fid = 1;
 561  }
 562  
 563  if ($new_thread) {
 564  
 565      echo form_input_hidden("newthread", "Y");
 566  
 567      echo "<h3>", gettext("Create new thread"), "</h3>\n";
 568      echo "<div class=\"post_inner\">\n";
 569      echo "<div class=\"post_folder\">", gettext("Select folder"), ":", light_folder_draw_dropdown($fid, "fid"), "</div>";
 570      echo "<div class=\"post_thread_title\">", gettext("Thread title"), ":", light_form_input_text("threadtitle", htmlentities_array($threadtitle), 30, 64), "</div>";
 571  
 572  } else {
 573  
 574      if (!($reply_message = messages_get($tid, $reply_to_pid))) {
 575  
 576          light_html_display_error_msg(gettext("That post does not exist in this thread!"));
 577          light_html_draw_bottom();
 578          exit;
 579      }
 580  
 581      $reply_message['CONTENT'] = message_get_content($tid, $reply_to_pid);
 582  
 583      if ((!isset($reply_message['CONTENT']) || $reply_message['CONTENT'] == "") && $thread_data['POLL_FLAG'] != 'Y' && $reply_to_pid != 0) {
 584  
 585          light_html_display_error_msg(gettext("Message not found. Check that it hasn't been deleted."));
 586          light_html_draw_bottom();
 587          exit;
 588  
 589      } else {
 590  
 591          echo "<h3>", gettext("Post Reply"), ": ", word_filter_add_ob_tags(thread_get_title($tid), true), "</h3>\n";
 592          echo "<div class=\"post_inner\">\n";
 593          echo form_input_hidden("reply_to", htmlentities_array("$tid.$reply_to_pid"));
 594          echo form_input_hidden('return_msg', htmlentities_array($return_msg)), "\n";
 595      }
 596  }
 597  
 598  echo "<div class=\"post_to\">", gettext("To"), ":", light_form_input_text("to_logon", isset($to_logon) ? htmlentities_array($to_logon) : "", 30, null, null, gettext("Leave blank for all")), "</div>";
 599  echo "<div class=\"post_content\">", gettext("Content"), ":", light_form_textarea("content", htmlentities_array(strip_paragraphs($content)), 10, 50, null, 'textarea'), "</div>";
 600  echo "<div class=\"post_buttons\">";
 601  echo light_form_submit("post", gettext("Post"));
 602  echo light_form_submit("preview", gettext("Preview"));
 603  
 604  if (isset($return_msg)) {
 605      echo "<a href=\"lmessages.php?webtag=$webtag&amp;msg=$return_msg\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
 606  } else if (isset($tid) && is_numeric($tid) && isset($reply_to_pid) && is_numeric($reply_to_pid)) {
 607      echo "<a href=\"lmessages.php?webtag=$webtag&amp;msg=$tid.$reply_to_pid\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
 608  } else {
 609      echo "<a href=\"lmessages.php?webtag=$webtag\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
 610  }
 611  
 612  echo "</div>";
 613  
 614  if (attachments_check_dir() && (session::check_perm(USER_PERM_POST_ATTACHMENTS | USER_PERM_POST_READ, $fid) || $new_thread)) {
 615  
 616      echo "<div class=\"attachments post_attachments\">", gettext('Attachments'), ":\n";
 617      echo "  ", attachments_form($_SESSION['UID'], $attachments), "\n";
 618      echo "</div>\n";
 619  }
 620  
 621  echo "</div>";
 622  echo "</div>";
 623  echo "</form>\n";
 624  
 625  if (!$new_thread && $reply_to_pid > 0) {
 626  
 627      echo "<h3>", gettext("In reply to"), ":</h3>\n";
 628  
 629      if (($thread_data['POLL_FLAG'] == 'Y') && ($reply_message['PID'] == 1)) {
 630  
 631          light_poll_display($tid, $thread_data['LENGTH'], $thread_data['FID'], $thread_data['CLOSED'], false, true);
 632  
 633      } else {
 634  
 635          light_message_display($tid, $reply_message, $thread_data['LENGTH'], $reply_to_pid, $thread_data['FID'], false, false, false, false, true);
 636      }
 637  }
 638  
 639  light_html_draw_bottom();

title

Description

title

Description

title

Description

title

title

Body