echo lang('subject'); ?> :<br /> <input type="text" name="qsubject" class="border" style="width: 93%" value="<?php echo switchs(field_clean($_POST['qsubject'])); ?> " /> <input name="post" value="<?php echo lang('reply'); ?> " type="submit" /> </td> </tr> <tr> <td width="200px;" valign="top"> <?php echo lang('message'); ?> :<br /> <textarea name="qcontent" id="qcontent" class="border" style="width: 99.3%; height: 150px;"><?php echo switchs(field_clean($_POST['qcontent'])); ?> </textarea> </td> </tr> <?php load_hook('quickreply_inside_after'); ?> </table> </form> <?php load_hook('quickreply_after');
/** * Allows creation of topics, stuck or closed, and posts * @global array * @global array * @param string $topic post subject * @param string $content post content * @param integer $reply id of topic we are replying to * @param boolean $sticky are we sticking it to the top? * @param boolean $closed are we closing it? * @return string|int */ function post($topic, $content, $reply = false, $sticky = false, $closed = false) { global $config, $user_data; // The time. milliseconds / seconds may change. $time = time(); // Its new right now. $new = true; // Pre-Parse $topic = clean_input(strip_repeat($topic)); $content = htmlentities($content); $content = field_clean(stripslashes($content), true); if ($_SESSION['logged_in']) { if (!$reply) { if ($topic == "") { return lang_parse('error_no_given', array(lang('subject'))); } } else { if ($topic == "") { $topic = "re:"; } } if (!alpha($topic, 'alpha-extra')) { return lang_parse('error_invalid_chars', array(lang('subject'))); } if (is_string(length($content, $config['message_minimum_length'], $config['message_max_length']))) { return lang_parse('error_subject_length', array($config['subject_max_length'], $config['subject_minimum_length'])); } if ($content != "") { if (!is_string(length($content, $config['message_minimum_length'], $config['message_max_length']))) { // Are we replying or is it new? if ($reply) { if (is_numeric($reply)) { if (topic($reply, 'id')) { $new = false; // topic data $topic_data = topic($reply, '*'); // is it closed? if ($topic_data['closed'] && !$user_data['admin']) { return lang('error_topic_closed'); } } else { return lang('error_topic_missing'); } } else { return lang_parse('error_invalid_given', array(lang('topic') . " " . lang('id'))); } } // Sticky $sticky = $sticky ? '1' : '0'; // Closed $closed = $closed ? '1' : '0'; // Parsing $content = htmlentities($content); // Time Lapse if (!$user_data['admin']) { if (!$new) { $time_between = time() - $config['post_reply_time_limit']; } else { $time_between = time() - $config['post_topic_time_limit']; } // Last post by this user? $query = "SELECT `time` FROM `forum` WHERE `starter_id` = '{$user_data['id']}' AND `time` > {$time_between}"; // Fetch users last post $result = mysql_query($query); // is there a result? if (mysql_num_rows($result) > 0) { return lang('error_flood_detection'); } } // So we don't have leftovers. unset($query, $result); // Guess we can go ahead and add you~ $query = "INSERT INTO `forum` (`subject`,`message`,`reply`,`starter_id`,`host`,`time`,`updated`,`sticky`,`closed`) VALUES ('%s','%s',%d,%d,'%s','%s','%s','%s','%s')"; $query = sprintf($query, mysql_clean($topic), mysql_clean($content), $new ? 0 : $reply, $user_data['id'], mysql_clean(gethostname()), $time, $time, $sticky, $closed); // Insert into mysql and retrieve id. $result = mysql_query($query); echo mysql_error(); if ($result) { // the id from the previous query $id = mysql_insert_id(); // users new post count $new_post_count = $user_data['posts'] + 1; // update user post count update_user($user_data['id'], false, 'posts', $new_post_count); // Start sending back information if ($new) { return $id; } else { // How many replies? $replies = intval(get_replies($reply)); // Lets update it $replies = $replies + 1; // Woooo~ Last id for redirecting~ $page_numbers = $replies / 20 - 1; $n = ceil($page_numbers); if ($n == -1) { $n = 0; } else { $n = abs($n); } // Update $query = "UPDATE `forum` SET `updated`='{$time}', `replies`='{$replies}' WHERE id = '{$reply}'"; // Update $result = mysql_query($query); // Return last page number for redirect! return $n; } } else { return lang('error_unknown'); } } else { return lang_parse('error_message_length', array($config['message_max_length'], $config['message_minimum_length'])); } } else { return lang_parse('error_no_given', array(lang('message'))); } } else { return lang('error_not_logged'); } }
// New topic $title = lang('posting_new_topic'); } } else { $reply = 0; // New topic $title = lang('posting_new_topic'); } } else { $reply = 0; // New topic $title = lang('posting_new_topic'); } } if (isset($_POST['subject'])) { $subject = field_clean($_POST['subject']); } // Forum navigation include $config['template_path'] . "navigation.php"; ?> <?php if ($preview) { include $config['template_path'] . "forum/preview.php"; } ?> <?php include $config['template_path'] . "forum/message-form.php"; ?>
?> </td> </tr> </table> <?php } ?> <table border="0" cellspacing="2" cellpadding="5" class="post"> <tr> <td colspan="2" valign="top"> <?php echo lang('subject_c'); ?> :<br /> <input type="text" name="subject" class="border" style="width: 93%" value="<?php echo switchs(field_clean($_POST['subject']), $subject); ?> " /> <?php if ($reply) { ?> <input name="post" value="reply" type="submit" class="button rounded" /> <?php } else { if ($edit) { ?> <input name="edit" value="edit" type="submit" class="button rounded" /> <?php } else { ?> <input name="post" value="submit" type="submit" class="button rounded" />
$num = '0' . $i; } else { $num = $i; } if ($day_data == $num) { $insert = " selected"; } else { $insert = ""; } echo '<option value="' . $num . '"' . $insert . '>' . $num . '</option>'; $i++; } ?> </select> <input type="text" id="year" name="year" style="padding: 3px; width:10%;" class="border" value="<?php echo switchs(field_clean($_POST['year'])); ?> "> </td> </tr> <?php } ?> <?php load_hook('registration_form'); ?> <tr> <td class="post" colspan="2"> <div class="title">
} } load_hook('msg_subject_after'); ?> </div> <div class="content"> <?php echo lang('message'); ?> :<br /> <?php load_hook('msg_textarea_before'); ?> <textarea name="content" id="content" class="border" style="width: 98.3%; height: 200px;"><?php echo switchs(field_clean(stripslashes($_POST['content'])), $content); ?> </textarea> <?php load_hook('msg_textarea_after'); ?> </div> <?php if (($edit || !$reply) && !$post['reply']) { ?> <div class="content"> <label for="category"> <?php echo lang('category'); ?>