Author: Threat009 » Wed Apr 19, 2006 10:20 pm
Okay I did it, and once again thankyou for the update. Judging by the amount of time it took me to manually update this thing, I can tell alot of work was put into this update, so thanks again, I'm grateful.
At first glance everything looks fine, however I did run across one major problem. No one can post! I think it's an easy fix, but I can't figure it out.
Error]
Parse error: parse error, unexpected $ in /home/Threat/public_html/Portal/posting.php on line 1339
[color=green]posting.php
[php]<php> 'post','news_category' => 'news_category', 'preview' => 'preview', 'delete' => 'delete', 'poll_delete' => 'poll_delete', 'poll_add' => 'add_poll_option', 'poll_edit' => 'edit_poll_option', 'mode' => 'mode');while( list($var, $param) = @each($params) ){ if ( !empty($HTTP_POST_VARS[$param]) || !empty($HTTP_GET_VARS[$param]) ) { $$var = ( !empty($HTTP_POST_VARS[$param]) ) ? htmlspecialchars($HTTP_POST_VARS[$param]) : htmlspecialchars($HTTP_GET_VARS[$param]); } else { $$var = ''; }} $confirm = isset($HTTP_POST_VARS['confirm']) ? true : false; $params = array('forum_id' => POST_FORUM_URL, 'topic_id' => POST_TOPIC_URL, 'post_id' => POST_POST_URL, 'lock_subject' => 'lock_subject');while( list($var, $param) = @each($params) ){ if ( !empty($HTTP_POST_VARS[$param]) || !empty($HTTP_GET_VARS[$param]) ) { $$var = ( !empty($HTTP_POST_VARS[$param]) ) ? intval($HTTP_POST_VARS[$param]) : intval($HTTP_GET_VARS[$param]); } else { $$var = ''; }} $refresh = $preview || $poll_add || $poll_edit || $poll_delete;$orig_word = $replacement_word = array();//-- mod : post icon -------------------------------------------------------------------------------//-- add$post_icon = isset($HTTP_POST_VARS['post_icon']) ? intval($HTTP_POST_VARS['post_icon']) : 0;//-- fin mod : post icon --------------------------------------------------------------------------- //// Set topic type//$topic_type = ( !empty($HTTP_POST_VARS['topictype']) ) ? intval($HTTP_POST_VARS['topictype']) : POST_NORMAL;$topic_type = ( in_array($topic_type, array(POST_NORMAL, POST_STICKY, POST_ANNOUNCE, POST_GLOBAL_ANNOUNCE )) ) ? $topic_type : POST_NORMAL;//-- mod : calendar --------------------------------------------------------------------------------//-- add/*$year = ( !empty($HTTP_POST_VARS['topic_calendar_year']) ) ? intval($HTTP_POST_VARS['topic_calendar_year']) : '';$month = ( !empty($HTTP_POST_VARS['topic_calendar_month']) ) ? intval($HTTP_POST_VARS['topic_calendar_month']) : '';$day = ( !empty($HTTP_POST_VARS['topic_calendar_day']) ) ? intval($HTTP_POST_VARS['topic_calendar_day']) : '';$hour = ( !empty($HTTP_POST_VARS['topic_calendar_hour']) ) ? intval($HTTP_POST_VARS['topic_calendar_hour']) : '';$min = ( !empty($HTTP_POST_VARS['topic_calendar_min']) ) ? intval($HTTP_POST_VARS['topic_calendar_min']) : '';*/$calendar_event = ( !empty($HTTP_POST_VARS['calendar_event']) ) ? trim($HTTP_POST_VARS['calendar_event']) : '';$calendar_duration = ( !empty($HTTP_POST_VARS['calendar_duration']) ) ? trim($HTTP_POST_VARS['calendar_duration']) : '';/*$d_day = ( !empty($HTTP_POST_VARS['topic_calendar_duration_day']) ) ? intval($HTTP_POST_VARS['topic_calendar_duration_day']) : '';$d_hour = ( !empty($HTTP_POST_VARS['topic_calendar_duration_hour']) ) ? intval($HTTP_POST_VARS['topic_calendar_duration_hour']) : '';$d_min = ( !empty($HTTP_POST_VARS['topic_calendar_duration_min']) ) ? intval($HTTP_POST_VARS['topic_calendar_duration_min']) : '';if ( empty($year) || empty($month) || empty($day) ){ $year = ''; $month = ''; $day = ''; $hour = ''; $min = ''; $d_day = ''; $d_hour = ''; $d_min = '';}if (empty($hour) && empty($min)){ $hour = ''; $min = ''; $d_hour = ''; $d_min = '';}*/ // start event$topic_calendar_time = 0;if (!empty($calendar_event)){ $topic_calendar_time = strtotime($calendar_event);} // duration$topic_calendar_duration = 0;if ( !empty($topic_calendar_time) && !empty($calendar_duration) ){ $topic_calendar_duration = strtotime($calendar_duration) - $topic_calendar_time; if ($topic_calendar_duration <0>sql_query($sql) ) { $info = $db->sql_fetchrow($result); $auth_forum = $info['forum_id']; $db->sql_freeresult($result); } else { message_die(GENERAL_ERROR, 'Could not query table', '', __LINE__, __FILE__, $sql); } } else { message_die(GENERAL_ERROR, 'Could not fetch forum id for setting up security', '', __LINE__, __FILE__, $sql); } $is_auth = $tree['auth'][POST_FORUM_URL . $auth_forum]; //-- mod : calendar --------------------------------------------------------------------------------//-- add$is_auth_type = '';$is_auth_type_cal = '';//-- fin mod : calendar ----------------------------------------------------------------------------switch( $mode ){ case 'newtopic': if ( $topic_type == POST_ANNOUNCE ) { $is_auth_type = 'auth_announce'; }//-- mod : announces -------------------------------------------------------------------------------//-- add else if ( $topic_type == POST_GLOBAL_ANNOUNCE ) { $is_auth_type = 'auth_global_announce'; }//-- fin mod : announces --------------------------------------------------------------------------- else if ( $topic_type == POST_STICKY ) { $is_auth_type = 'auth_sticky'; } else { $is_auth_type = 'auth_post'; }//-- mod : calendar --------------------------------------------------------------------------------//-- add if (!empty($topic_calendar_time)) { $is_auth_type_cal = 'auth_cal'; }//-- fin mod : calendar ---------------------------------------------------------------------------- break; case 'reply': case 'quote': $is_auth_type = 'auth_reply'; break; case 'editpost': $is_auth_type = 'auth_edit'; break; case 'delete': case 'poll_delete': $is_auth_type = 'auth_delete'; break; case 'vote': $is_auth_type = 'auth_vote'; break; case 'topicreview': $is_auth_type = 'auth_read'; break; default: message_die(GENERAL_MESSAGE, $lang['No_post_mode']); break;} //// Here we do various lookups to find topic_id, forum_id, post_id etc.// Doing it here prevents spoofing (eg. faking forum_id, topic_id or post_id//$error_msg = '';$post_data = array();switch ( $mode ){ case 'newtopic': if ( empty($forum_id) ) { message_die(GENERAL_MESSAGE, $lang['Forum_not_exist']); } $sql = "SELECT * FROM " . FORUMS_TABLE . " WHERE forum_id = $forum_id"; break; case 'reply': case 'vote': if ( empty( $topic_id) ) { message_die(GENERAL_MESSAGE, $lang['No_topic_id']); } $sql = "SELECT f.*, t.topic_status, t.topic_title, t.topic_type FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t WHERE t.topic_id = $topic_id AND f.forum_id = t.forum_id"; break; case 'quote': case 'editpost': case 'delete': case 'poll_delete': if ( empty($post_id) ) { message_die(GENERAL_MESSAGE, $lang['No_post_id']); } //-- mod : announces -------------------------------------------------------------------------------// here we added// , t.topic_announce_duration//-- modify//-- mod : calendar --------------------------------------------------------------------------------// here we added// , t.topic_calendar_time, t.topic_calendar_duration//-- modify//-- mod : post icon -------------------------------------------------------------------------------// here we added// , t.topic_icon// , p.post_icon//-- modify $select_sql = (!$submit) ? ', t.topic_title, t.topic_desc, t.topic_icon, t.topic_calendar_time, t.topic_calendar_duration, t.topic_calendar_repeat, t.topic_announce_duration, t.news_id, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, p.post_icon, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid' : ''; $from_sql = ( !$submit ) ? ", " . POSTS_TEXT_TABLE . " pt, " . USERS_TABLE . " u" : ''; $where_sql = ( !$submit ) ? "AND pt.post_id = p.post_id AND u.user_id = p.poster_id" : '';//-- fin mod : post icon ---------------------------------------------------------------------------//-- fin mod : calendar ----------------------------------------------------------------------------//-- fin mod : announces --------------------------------------------------------------------------- $sql = "SELECT f.*, t.topic_id, t.topic_status, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, t.topic_vote, t.topic_time, p.post_id, p.poster_id" . $select_sql . " FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . " WHERE p.post_id = $post_id AND t.topic_id = p.topic_id AND f.forum_id = p.forum_id $where_sql"; break; default: message_die(GENERAL_MESSAGE, $lang['No_valid_mode']);} if ( $result = $db->sql_query($sql) ){ $post_info = $db->sql_fetchrow($result); $db->sql_freeresult($result); $forum_id = $post_info['forum_id'];//-- mod : categories hierarchy --------------------------------------------------------------------//-- delete// $forum_name = $post_info['forum_name'];//-- add $forum_name = get_object_lang(POST_FORUM_URL . $post_info['forum_id'], 'name');//-- fin mod : categories hierarchy ----------------------------------------------------------------//-- mod : calendar --------------------------------------------------------------------------------//-- add if (!empty($post_info['topic_calendar_duration'])) { $post_info['topic_calendar_duration']++; }//-- fin mod : calendar ---------------------------------------------------------------------------- // // Topic Lock/Unlock // $lock = ( isset($HTTP_POST_VARS['lock']) ) ? TRUE : FALSE; $unlock = ( isset($HTTP_POST_VARS['unlock']) ) ? TRUE : FALSE; if ( ($submit || $confirm) && ($lock || $unlock) && ($is_auth['auth_mod']) && ($mode != 'newtopic') && (!$refresh) ) { $t_id = ( !isset($post_info['topic_id']) ) ? $topic_id : $post_info['topic_id']; if ( $unlock ) { $sql = "UPDATE " . TOPICS_TABLE . " SET topic_status = " . TOPIC_UNLOCKED . " WHERE topic_id = " . $t_id . " AND topic_moved_id = 0"; } else if ($lock) { $sql = "UPDATE " . TOPICS_TABLE . " SET topic_status = " . TOPIC_LOCKED . " WHERE topic_id = " . $t_id . " AND topic_moved_id = 0"; } if ($lock || $unlock) { if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql); } } } if ( $post_info['forum_status'] == FORUM_LOCKED && !$is_auth['auth_mod']) { message_die(GENERAL_MESSAGE, $lang['Forum_locked']); } else if ( $mode != 'newtopic' && $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod']) { message_die(GENERAL_MESSAGE, $lang['Topic_locked']); } if ( $mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete' ) { $topic_id = $post_info['topic_id']; $post_data['poster_post'] = ( $post_info['poster_id'] == $userdata['user_id'] ) ? true : false; $post_data['first_post'] = ( $post_info['topic_first_post_id'] == $post_id ) ? true : false; $post_data['last_post'] = ( $post_info['topic_last_post_id'] == $post_id ) ? true : false; $post_data['last_topic'] = ( $post_info['forum_last_post_id'] == $post_id ) ? true : false; $post_data['has_poll'] = ( $post_info['topic_vote'] ) ? true : false; $post_data['topic_type'] = $post_info['topic_type']; $post_data['topic_time'] = $post_info['topic_time'];//-- mod : post icon -------------------------------------------------------------------------------//-- add $post_data['post_icon'] = $post_info['post_icon'];//-- fin mod : post icon ---------------------------------------------------------------------------//-- mod : calendar --------------------------------------------------------------------------------//-- add $post_data['topic_calendar_time'] = $post_info['topic_calendar_time']; $post_data['topic_calendar_duration'] = $post_info['topic_calendar_duration'];// repeat $post_data['topic_calendar_repeat'] = $post_info['topic_calendar_repeat']; $repeat_mode = $post_info['topic_calendar_repeat']; if($repeat_mode) { $repeat_type = substr($repeat_mode,0,2); $repeat_type_value = substr($repeat_mode,2,2); }//-- fin mod : calendar ----------------------------------------------------------------------------//-- mod : announces -------------------------------------------------------------------------------//-- add $post_data['topic_announce_duration'] = $post_info['topic_announce_duration'];//-- fin mod : announces --------------------------------------------------------------------------- $post_data['poster_id'] = $post_info['poster_id']; if ( $post_data['first_post'] && $post_data['has_poll'] ) { $sql = "SELECT * FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr WHERE vd.topic_id = $topic_id AND vr.vote_id = vd.vote_id ORDER BY vr.vote_option_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql); } $poll_options = array(); $poll_results_sum = 0; if ( $row = $db->sql_fetchrow($result) ) { $poll_title = $row['vote_text']; $poll_id = $row['vote_id']; $poll_length = intval($row['vote_length'] / 86400); $poll_length_h = intval( ( $row['vote_length'] - ( $poll_length *86400) ) /3600 ) ; $max_vote = $row['vote_max']; $hide_vote = $row['vote_hide']; $tothide_vote = $row['vote_tothide']; do { $poll_options[$row['vote_option_id']] = $row['vote_option_text']; $poll_results_sum += $row['vote_result']; } while ( $row = $db->sql_fetchrow($result) ); } $db->sql_freeresult($result); $post_data['edit_poll'] = ( ( !$poll_results_sum || $is_auth['auth_mod'] ) && $post_data['first_post'] ) ? true : 0; } else { $post_data['edit_poll'] = ($post_data['first_post'] && $is_auth['auth_pollcreate']) ? true : false; } // // Can this user edit/delete the post/poll? // if ( $post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod'] ) { $message = ( $delete || $mode == 'delete' ) ? $lang['Delete_own_posts'] : $lang['Edit_own_posts']; $message .= '<br><br>' . sprintf($lang['Click_return_topic'], '<a>', '</a>'); message_die(GENERAL_MESSAGE, $message); } else if ( !$post_data['last_post'] && !$is_auth['auth_mod'] && ( $mode == 'delete' || $delete ) ) { message_die(GENERAL_MESSAGE, $lang['Cannot_delete_replied']); } else if ( !$post_data['edit_poll'] && !$is_auth['auth_mod'] && ( $mode == 'poll_delete' || $poll_delete ) ) { message_die(GENERAL_MESSAGE, $lang['Cannot_delete_poll']); } } else { if ( $mode == 'quote' ) { $topic_id = $post_info['topic_id']; } if ( $mode == 'newtopic' ) { $post_data['topic_type'] = POST_NORMAL; } $post_data['first_post'] = ( $mode == 'newtopic' ) ? true : 0; $post_data['last_post'] = false; $post_data['has_poll'] = false; $post_data['edit_poll'] = false; } if ( $mode == 'poll_delete' && !isset($poll_id) ) { message_die(GENERAL_MESSAGE, $lang['No_such_post']); } // BEGIN cmx_slash_news_mod if( $board_config['allow_news'] && $post_data['first_post'] && $is_auth['auth_post'] && ($is_auth['auth_news'] || ( $is_auth['auth_mod'] && $mode == 'editpost') ) ) { if( $mode == 'editpost' ) { $post_data['news_id'] = $post_info['news_id']; } else { $post_data['news_id'] = 0; } $post_data['disp_news'] = true; } else { $post_data['disp_news'] = false; }// END cmx_slash_news_mod}else{ message_die(GENERAL_MESSAGE, $lang['No_such_post']);} //// The user is not authed, if they're not logged in then redirect// them, else show them an error message////-- mod : calendar --------------------------------------------------------------------------------// here we added// || (!empty($is_auth_type_cal) && !$is_auth[$is_auth_type_cal])//-- modifyif ( !$is_auth[$is_auth_type] || (!empty($is_auth_type_cal) && !$is_auth[$is_auth_type_cal]) )//-- fin mod : calendar ----------------------------------------------------------------------------{ if ( $userdata['session_logged_in'] ) {//-- mod : calendar --------------------------------------------------------------------------------//-- add if (!empty($is_auth_type_cal) && !$is_auth[$is_auth_type_cal]) { message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_' . $is_auth_type_cal], $is_auth[$is_auth_type_cal . "_type"])); }//-- fin mod : calendar ---------------------------------------------------------------------------- message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_' . $is_auth_type], $is_auth[$is_auth_type . "_type"])); } switch( $mode ) { case 'newtopic': $redirect = "mode=newtopic&" . POST_FORUM_URL . "=" . $forum_id; break; case 'reply': case 'topicreview': $redirect = "mode=reply&" . POST_TOPIC_URL . "=" . $topic_id; break; case 'quote': case 'editpost': $redirect = "mode=quote&" . POST_POST_URL ."=" . $post_id; break; } $redirect .= ($post_reportid) ? '&post_reportid=$post_reportid' : ''; redirect(append_sid("login.$phpEx?redirect=posting.$phpEx&" . $redirect, true));} //// Set toggles for various options//if ( !$board_config['allow_html'] ){ $html_on = 0;}else{ $html_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );} if ( !$board_config['allow_bbcode'] ){ $bbcode_on = 0;}else{ $bbcode_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_bbcode']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_bbcode'] : $userdata['user_allowbbcode'] );} if ( !$board_config['allow_smilies'] ){ $smilies_on = 0;}else{ $smilies_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_smilies']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_smilies'] : $userdata['user_allowsmile'] );} if ( ($submit || $refresh) && $is_auth['auth_read']){ $notify_user = ( !empty($HTTP_POST_VARS['notify']) ) ? TRUE : 0;}else{ if ( $mode != 'newtopic' && $userdata['session_logged_in'] && $is_auth['auth_read'] ) { $sql = "SELECT topic_id FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = $topic_id AND user_id = " . $userdata['user_id']; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain topic watch information', '', __LINE__, __FILE__, $sql); } $notify_user = ( $db->sql_fetchrow($result) ) ? TRUE : $userdata['user_notify']; $db->sql_freeresult($result); } else { $notify_user = ( $userdata['session_logged_in'] && $is_auth['auth_read'] ) ? $userdata['user_notify'] : 0; }} $attach_sig = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['attach_sig']) ) ? TRUE : 0 ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? 0 : $userdata['user_attachsig'] );$setbm = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['setbm']) ) ? TRUE : 0 ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? 0 : $userdata['user_setbm'] ); execute_posting_attachment_handling(); //// Begin Approve_mod Block : 2//if ( $mode == 'newtopic' || $mode == 'reply' || $mode == 'editpost' || $mode == 'quote' ){ $approve_mod = array(); $approve_mod['notify'] = false; $approve_sql = "SELECT * FROM " . APPROVE_FORUMS_TABLE . " WHERE forum_id = " . intval($forum_id); if ( !($approve_result = $db->sql_query($approve_sql)) ) { message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); } if ( $approve_row = $db->sql_fetchrow($approve_result) ) { if ( intval($approve_row['enabled']) == 1 ) { $approve_mod = $approve_row; $approve_mod['enabled'] = true; } } $approve_mod['moderators'] = array(); $approve_mod['moderators'] = explode('|', $approve_mod['approve_moderators']); if ( in_array($userdata['user_id'], $approve_mod['moderators']) || $is_auth['auth_mod'] ) { //moderator, don't screen their post $approve_mod['enabled'] = false; } if ( $approve_mod['enabled'] ) { if ( $approve_mod['forum_hide_unapproved_posts'] ) { $lang['Stored'] = $lang['approve_admin_Stored_replacement']; } // // Check if quoted post is approved // if ( $mode == 'quote' ) { // patch purpose proposed by Markus Rietzler <markus> // check if the quoted post has been approved, if so, empty the quote text $approve_sql = "SELECT * FROM " . APPROVE_POSTS_TABLE . " WHERE post_id = " . intval($post_id) . " AND is_post = 1"; if ( !($approve_result = $db->sql_query($approve_sql)) ) { message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); } if ( $approve_row = $db->sql_fetchrow($approve_result) ) { //quoted post is not approved $approve_mod['quoted_post_not_approved'] = true; } } // // Check user and topic moderation // if ( $approve_mod['approve_users'] ) { //all users & topics, let's check them to see if we should disable moderation if ( $approve_mod['approve_posts'] && $mode != 'newtopic' ) { $approve_sql = "SELECT approve_moderate FROM " . APPROVE_TOPICS_TABLE . " WHERE topic_id = " . intval($topic_id) . " AND approve_moderate = -1 LIMIT 0,1"; if ( !($approve_result = $db->sql_query($approve_sql)) ) { message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); } if ( $approve_row = $db->sql_fetchrow($approve_result) ) { if ( intval($approve_row['approve_moderate']) == -1 ) { //topic auto-approved $approve_mod['enabled'] = false; } } } if ( $approve_mod['enabled'] ) { $approve_sql = "SELECT approve_moderate FROM " . APPROVE_USERS_TABLE . " WHERE user_id = " . intval($userdata['user_id']) . " AND approve_moderate = -1 LIMIT 0,1"; if ( !($approve_result = $db->sql_query($approve_sql)) ) { message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); } if ( $approve_row = $db->sql_fetchrow($approve_result) ) { if ( intval($approve_row['approve_moderate']) == -1 ) { //user auto-approved $approve_mod['enabled'] = false; } } } } else { //only selected topics, let's check them to see if we should turn on moderation $approve_mod['enabled'] = false; $approve_sql = "SELECT * FROM " . APPROVE_TOPICS_TABLE . " WHERE topic_id = " . intval($topic_id) . " LIMIT 0,1"; if ( !($approve_result = $db->sql_query($approve_sql)) ) { message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); } if ( $approve_row = $db->sql_fetchrow($approve_result) ) { if ( intval($approve_row['approve_moderate']) == 1 ) { //topic is moderated $approve_mod['enabled'] = true; } } } //check the user to see if we should still moderate them, regardless of topic settings if ( !$approve_mod['enabled'] ) { $approve_sql = "SELECT * FROM " . APPROVE_USERS_TABLE . " WHERE user_id = " . intval($userdata['user_id']) . " LIMIT 0,1"; if ( !($approve_result = $db->sql_query($approve_sql)) ) { message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); } if ( $approve_row = $db->sql_fetchrow($approve_result) ) { if ( intval($approve_row['approve_moderate']) == 1 ) { //user is moderated $approve_mod['enabled'] = true; } } } if ( $approve_mod['enabled'] ) { //check admin settings for what to allow & what to moderate switch ($mode) { case 'newtopic': if ( intval($approve_mod['approve_topics']) != 1 ) { //new topics are not moderated $approve_mod['enabled'] = false; } break; case 'reply': case 'quote': if ( intval($approve_mod['approve_posts']) != 1 ) { //new replies are not moderated $approve_mod['enabled'] = false; } break; case 'editpost': if ( intval($approve_mod['approve_poste']) != 1 ) { //post edits are not moderated $approve_mod['enabled'] = false; } $approve_mod_post_id = ($HTTP_GET_VARS[POST_POST_URL]) ? $HTTP_GET_VARS[POST_POST_URL] : $HTTP_POST_VARS[POST_POST_URL]; if ( !$approve_mod['enabled'] && ( intval($approve_mod['approve_topice']) == 1 ) && !empty($approve_mod_post_id) ) { //let's see if it's a topic and if so, turn moderation back on $approve_sql = "SELECT t.topic_first_post_id FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p WHERE p.post_id = " . intval($approve_mod_post_id) . " AND t.topic_id = p.topic_id LIMIT 0,1"; if ( !($approve_result = $db->sql_query($approve_sql)) ) { message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); } if ( $approve_row = $db->sql_fetchrow($approve_result) ) { if ( intval($approve_row['topic_first_post_id']) == intval($approve_mod_post_id) ) { //topic edits are moderated $approve_mod['enabled'] = true; } } } break; } } }}//// End Approve_mod Block : 2// // BEGIN cmx_slash_news_mod//// Get News Categories.//if( $userdata['session_logged_in'] && $post_data['disp_news'] ){ if ( $mode == 'edit' && empty($post_id) ) { message_die(GENERAL_MESSAGE, $lang['No_post_id']); } $sql = 'SELECT n.* FROM ' . NEWS_TABLE . ' n WHERE 1 ORDER BY n.news_category'; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain news data', '', __LINE__, __FILE__, $sql); } $news_sel = array(); $news_cat = array(); while ( $row = $db->sql_fetchrow($result) ) { if( ($news_category > 0 && $news_category == $row['news_id']) || ($post_data['news_id'] > 0 && $post_data['news_id'] == $row['news_id']) ) { $news_sel = $row; } if( $post_data['news_id'] != 0 && $post_data['news_id'] == $row['news_id'] ) { $news_sel = $row; } $news_cat[] = $row; } if( $post_data['news_id'] == 0 && $news_category == 0) { $boxstring = '<option>' . $lang['Regular_Post'] . '</option>'; } else { $boxstring = '<option>' . $news_sel['news_category'] . ' (' . $lang['Current_Selection'] . ')</option>'; $boxstring .= '<option>' . $lang['Regular_Post'] . '</option>'; } if( count( $news_cat ) > 0 ) { for( $i = 0; $i </option>assign_block_vars('switch_news_cat', array( 'L_NEWS_CATEGORY' => $lang['Select_News_Category'], 'S_NAME' => 'news_category', 'S_CATEGORY_BOX' => $boxstring )); }}// END cmx_slash_news_mod // --------------------// What shall we do?//if ( ( $delete || $poll_delete || $mode == 'delete' ) && !$confirm ){ // // Confirm deletion // $s_hidden_fields = '<input>'; $s_hidden_fields .= ( $delete || $mode == "delete" ) ? '<input>' : '<input>'; $l_confirm = ( $delete || $mode == 'delete' ) ? $lang['Confirm_delete'] : $lang['Confirm_delete_poll']; // // Output confirmation page // include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( 'confirm_body' => 'confirm_body.tpl') ); $template->assign_vars(array( 'MESSAGE_TITLE' => $lang['Information'], 'MESSAGE_TEXT' => $l_confirm, 'L_YES' => $lang['Yes'], 'L_NO' => $lang['No'], 'S_CONFIRM_ACTION' => append_sid("posting.$phpEx"), 'S_HIDDEN_FIELDS' => $s_hidden_fields) ); $template->pparse('confirm_body'); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);}else if ( $mode == 'vote' ){ // // Vote in a poll // if ( (!empty($HTTP_POST_VARS['vote_id'])) and (is_array($HTTP_POST_VARS['vote_id'])) and (isset($HTTP_POST_VARS['vote_id'])) ) { $vote_option_id = intval($HTTP_POST_VARS['vote_id']); $vote_id = $HTTP_POST_VARS['vote_id']; $sql = "SELECT vd.vote_id, vd.vote_max FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr WHERE vd.topic_id = $topic_id AND vr.vote_id = vd.vote_id AND vr.vote_option_id = $vote_option_id GROUP BY vd.vote_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql); } if ( $vote_info = $db->sql_fetchrow($result) ) { $max_vote = $vote_info['vote_max']; } $max_voting=count($vote_id); if ($max_voting>$max_vote) { $max_voting=$max_vote; } for($i = 0; $i <max_voting>sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql); } if ( $vote_info = $db->sql_fetchrow($result) ) { $vote_id = $vote_info['vote_id']; $sql = "SELECT * FROM " . VOTE_USERS_TABLE . " WHERE vote_id = $vote_id AND vote_user_id = " . $userdata['user_id']; if ( !($result2 = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain user vote data for this topic', '', __LINE__, __FILE__, $sql); } if ( !($row = $db->sql_fetchrow($result2)) ) { for($i = 0; $i <max_voting>sql_query($sql, BEGIN_TRANSACTION) ) { message_die(GENERAL_ERROR, 'Could not update poll result', '', __LINE__, __FILE__, $sql); } } $sql = "UPDATE " . VOTE_DESC_TABLE . " SET vote_voted = vote_voted + 1 WHERE vote_id = $vote_id AND topic_id = $topic_id"; if ( !$db->sql_query($sql, BEGIN_TRANSACTION) ) { message_die(GENERAL_ERROR, 'Could not update poll voted', '', __LINE__, __FILE__, $sql); } $sql = "INSERT INTO " . VOTE_USERS_TABLE . " (vote_id, vote_user_id, vote_user_ip) VALUES ($vote_id, " . $userdata['user_id'] . ", '$user_ip')"; if ( !$db->sql_query($sql, END_TRANSACTION) ) { message_die(GENERAL_ERROR, "Could not insert user_id for poll", "", __LINE__, __FILE__, $sql); } $message = $lang['Vote_cast']; } else { $message = $lang['Already_voted']; } $db->sql_freeresult($result2); } else { $message = $lang['No_vote_option']; } $db->sql_freeresult($result); $template->assign_vars(array( 'META' => '<meta>') ); $message .= '<br><br>' . sprintf($lang['Click_view_message'], '<a>', '</a>'); message_die(GENERAL_MESSAGE, $message); } else { redirect(append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true)); }}else if ( $submit || $confirm ){ // // Submit post/vote (newtopic, edit, reply, etc.) // $return_message = ''; $return_meta = ''; switch ( $mode ) { case 'editpost': case 'newtopic': case 'reply': $username = ( !empty($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : ''; $subject = ( !empty($HTTP_POST_VARS['subject']) ) ? trim($HTTP_POST_VARS['subject']) : ''; $topic_desc = ( !empty($HTTP_POST_VARS['topic_desc']) ) ? trim($HTTP_POST_VARS['topic_desc']) : ''; $message = ( !empty($HTTP_POST_VARS['message']) ) ? $HTTP_POST_VARS['message'] : '';//-- mod : calendar --------------------------------------------------------------------------------//-- add $topic_calendar_time = ( $topic_calendar_time != $post_data['topic_calendar_time'] && !$is_auth['auth_cal']) ? $post_data['topic_calendar_time'] : $topic_calendar_time; if (empty($topic_calendar_time)) $topic_calendar_time = 0;// repeat $repeat_mode = $post_info['topic_calendar_repeat']; if($repeat_mode) { $repeat_type = substr($repeat_mode,0,2); $repeat_type_value = substr($repeat_mode,2,2); } $topic_calendar_repeats = ( !empty($HTTP_POST_VARS['topic_calendar_repeats']) ) ? trim($HTTP_POST_VARS['topic_calendar_repeats']) : ''; $topic_calendar_repeats_value = ( !empty($HTTP_POST_VARS['topic_calendar_repeats_value']) ) ? trim($HTTP_POST_VARS['topic_calendar_repeats_value']) : ''; if(intval($topic_calendar_repeats_value)==0 || !($topic_calendar_repeats=='DD' || $topic_calendar_repeats=='MT' || $topic_calendar_repeats=='MY' || $topic_calendar_repeats=='WW' || $topic_calendar_repeats=='YY') ) { $topic_calendar_repeat = ''; }else { $topic_calendar_repeat = $topic_calendar_repeats . $topic_calendar_repeats_value; } $topic_calendar_duration = ( $topic_calendar_duration != $post_data['topic_calendar_duration'] && !$is_auth['auth_cal']) ? $post_data['topic_calendar_duration'] : $topic_calendar_duration; if ( !empty($topic_calendar_duration) ) { $topic_calendar_duration--; } if (empty($topic_calendar_time) || empty($topic_calendar_duration)) $topic_calendar_duration = 0;//-- fin mod : calendar ---------------------------------------------------------------------------- $poll_title = ( isset($HTTP_POST_VARS['poll_title']) && $is_auth['auth_pollcreate'] ) ? $HTTP_POST_VARS['poll_title'] : ''; $poll_options = ( isset($HTTP_POST_VARS['poll_option_text']) && $is_auth['auth_pollcreate'] ) ? $HTTP_POST_VARS['poll_option_text'] : ''; $poll_length = ( isset($HTTP_POST_VARS['poll_length']) && $is_auth['auth_pollcreate'] ) ? intval($HTTP_POST_VARS['poll_length']) : '0'; $poll_length_h = ( isset($HTTP_POST_VARS['poll_length_h']) && $is_auth['auth_pollcreate'] ) ? intval($HTTP_POST_VARS['poll_length_h']) : '0'; $poll_length = $poll_length*24; $poll_length = $poll_length_h+$poll_length; $poll_length = ($poll_length) ? max(0, ($poll_length/24)) : 0; $max_vote = ( isset($HTTP_POST_VARS['max_vote']) && $is_auth['auth_pollcreate'] ) ? ( ( $HTTP_POST_VARS['max_vote'] == 0 ) ? 1 : $HTTP_POST_VARS['max_vote'] ) : ''; $hide_vote = ( isset($HTTP_POST_VARS['hide_vote']) && $is_auth['auth_pollcreate'] && ($poll_length>0) ) ? 1 : ''; $tothide_vote = ( isset($HTTP_POST_VARS['tothide_vote']) && isset($HTTP_POST_VARS['hide_vote']) && $is_auth['auth_pollcreate'] && ($poll_length>0) ) ? 1 : ''; $bbcode_uid = ''; //----------------------------------------------------------------------------- // MOD: Delayed Topics // If we're trying to delay (force time), check for rights... $forcetime = ''; if (isset($HTTP_POST_VARS['forcetime']) && trim($HTTP_POST_VARS['forcetime']) != '') { if (!$is_auth['auth_delayedpost']) { message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_' . $is_auth_type], $is_auth[$is_auth_type . "_type"])); } else { $forcetime = strtotime($HTTP_POST_VARS['forcetime']); user2boardtime($forcetime); if (($forcetime == -1) || ($forcetime < time())) { $forcetime = ''; } } } // MOD: Delayed Topics {end} //----------------------------------------------------------------------------- //-- mod : calendar --------------------------------------------------------------------------------// here we have added// , $topic_calendar_time, $topic_calendar_duration//-- modify prepare_post only prepare_post($mode, $post_data, $bbcode_on, $html_on, $smilies_on, $error_msg, $username, $bbcode_uid, $subject, $message, $poll_title, $poll_options, $poll_length, $max_vote, $hide_vote, $tothide_vote, $topic_desc, $topic_calendar_time, $topic_calendar_duration, $topic_calendar_repeat );//-- fin mod : calendar ---------------------------------------------------------------------------- if ( $error_msg == '' ) { $topic_type = ( $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type;//-- mod : announces -------------------------------------------------------------------------------//-- add if ($topic_announce_duration </a>sql_query($approve_sql)) ) { message_die(GENERAL_ERROR, $lang['approve_posts_error_insert'], '', __LINE__, __FILE__, $approve_sql); } if ( $approve_mod['approve_notify_topics'] ) { $approve_mod['notify'] = true; } } elseif ( $mode == 'reply' && $approve_mod['approve_posts'] ) { $approve_sql = "INSERT INTO " . APPROVE_POSTS_TABLE . " (post_id, topic_id, is_post, poster_id) VALUES (" . intval($post_id) . ", " . intval($topic_id) . ", 1, " . intval($userdata['user_id']) . ")"; if ( !($approve_result = $db->sql_query($approve_sql)) ) { message_die(GENERAL_ERROR, $lang['approve_posts_error_insert'], '', __LINE__, __FILE__, $approve_sql); } if ( $approve_mod['approve_notify_posts'] ) { $approve_mod['notify'] = true; } } elseif ( $mode == 'editpost' ) { $approve_mod['topic_or_post'] = 'is_post';
Last edited by Threat009 on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
[url=http][img=left]http://i63.photobucket.com/albums/h129/Threat009/donate.gif[/img][/url]