Version 1.3.0
This commit is contained in:
1 parent
7ef3d1712a
commit
f87d29ba65
290 files changed
+50206
-17930
No files matched your search
@@ -2,15 +2,17 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Board v1.1
|
||||
| Invision Power Board v1.3 Final
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001,2002 Invision Power Services
|
||||
| http://www.ibforums.com
|
||||
| (c) 2001 - 2003 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
| Web: http://www.invisionboard.com
|
||||
| Time: Sun, 04 Jan 2004 00:30:16 GMT
|
||||
| Release: 28e7bfb25f08ac72a789cb1b172fa185
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > New Post module
|
||||
@@ -35,11 +37,22 @@ class post_functions extends Post {
|
||||
|
||||
var $m_group = "";
|
||||
|
||||
function post_functions($class) {
|
||||
function post_functions($class)
|
||||
{
|
||||
|
||||
global $ibforums, $std, $DB;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Sort out maximum number of poll choices allowed
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
$ibforums->vars['max_poll_choices'] = $ibforums->vars['max_poll_choices'] ? $ibforums->vars['max_poll_choices'] : 10;
|
||||
|
||||
$ibforums->lang['poll_choices'] = sprintf( $ibforums->lang['poll_choices'], $ibforums->vars['max_poll_choices'] );
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Lets do some tests to make sure that we are allowed to start a new topic
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
if (! $ibforums->member['g_post_polls'])
|
||||
{
|
||||
@@ -51,14 +64,11 @@ class post_functions extends Post {
|
||||
$std->Error( array( LEVEL => 1, MSG => 'no_start_polls') );
|
||||
}
|
||||
|
||||
$this->m_group = $ibforums->member['mgroup'];
|
||||
$this->m_group = $ibforums->perm_id;
|
||||
|
||||
if ($class->forum['start_perms'] != '*')
|
||||
if ( $std->check_perms($class->forum['start_perms']) != TRUE )
|
||||
{
|
||||
if (! preg_match( "/(^|,)$this->m_group(,|$)/", $class->forum['start_perms'] ) )
|
||||
{
|
||||
$std->Error( array( LEVEL => 1, MSG => 'no_start_polls') );
|
||||
}
|
||||
$std->Error( array( LEVEL => 1, MSG => 'no_start_polls') );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -81,7 +91,16 @@ class post_functions extends Post {
|
||||
$class->obj['post_errors'] = 'no_topic_title';
|
||||
}
|
||||
|
||||
if ( strlen($ibforums->input['TopicTitle']) > 64 ) {
|
||||
//-------------------------------------------------
|
||||
// More unicode..
|
||||
//-------------------------------------------------
|
||||
|
||||
$temp = $std->txt_stripslashes($HTTP_POST_VARS['TopicTitle']);
|
||||
|
||||
$temp = preg_replace("/&#([0-9]+);/", "-", $temp );
|
||||
|
||||
if ( strlen($temp) > 64 )
|
||||
{
|
||||
$class->obj['post_errors'] = 'topic_title_long';
|
||||
}
|
||||
|
||||
@@ -95,11 +114,13 @@ class post_functions extends Post {
|
||||
|
||||
$this->poll_choices = preg_replace( "/<br>/e" , "\$this->regex_count_choices()" , $this->poll_choices );
|
||||
|
||||
if ($this->poll_count > 10) {
|
||||
if ($this->poll_count > $ibforums->vars['max_poll_choices'])
|
||||
{
|
||||
$class->obj['post_errors'] = 'poll_to_many';
|
||||
}
|
||||
|
||||
if ($this->poll_count < 1) {
|
||||
if ($this->poll_count < 1)
|
||||
{
|
||||
$class->obj['post_errors'] = 'poll_not_enough';
|
||||
}
|
||||
|
||||
@@ -146,7 +167,7 @@ class post_functions extends Post {
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$poll_array[] = array( $count , $polling, 0 );
|
||||
$poll_array[] = array( $count , $class->parser->bad_words($polling), 0 );
|
||||
$count++;
|
||||
}
|
||||
|
||||
@@ -168,6 +189,15 @@ class post_functions extends Post {
|
||||
$ibforums->input['TopicTitle'] = $class->parser->bad_words( $ibforums->input['TopicTitle'] );
|
||||
$ibforums->input['TopicDesc'] = $class->parser->bad_words( $ibforums->input['TopicDesc'] );
|
||||
|
||||
if ( $ibforums->vars['poll_disable_noreply'] != 1 )
|
||||
{
|
||||
$poll_state = $ibforums->input['allow_disc'] == 0 ? 'open' : 'closed';
|
||||
}
|
||||
else
|
||||
{
|
||||
$poll_state = 'open';
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Build the master array
|
||||
//-------------------------------------------------
|
||||
@@ -185,7 +215,7 @@ class post_functions extends Post {
|
||||
'last_post' => time(),
|
||||
'icon_id' => $ibforums->input['iconid'],
|
||||
'author_mode' => $ibforums->member['id'] ? 1 : 0,
|
||||
'poll_state' => $ibforums->input['allow_disc'] == 0 ? 'open' : 'closed',
|
||||
'poll_state' => $poll_state,
|
||||
'last_vote' => 0,
|
||||
'views' => 0,
|
||||
'forum_id' => $class->forum['id'],
|
||||
@@ -214,6 +244,15 @@ class post_functions extends Post {
|
||||
$this->post['attach_hits'] = $this->upload['attach_hits'];
|
||||
$this->post['new_topic'] = 1;
|
||||
|
||||
//-------------------------------------------------
|
||||
// Unqueue the post if we're starting a new topic
|
||||
//-------------------------------------------------
|
||||
|
||||
if ( $class->obj['moderate'] == 3 )
|
||||
{
|
||||
$this->post['queued'] = 0;
|
||||
}
|
||||
|
||||
$db_string = $DB->compile_db_insert_string( $this->post );
|
||||
|
||||
$DB->query("INSERT INTO ibf_posts (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
|
||||
@@ -241,10 +280,14 @@ class post_functions extends Post {
|
||||
|
||||
|
||||
|
||||
if ($class->obj['moderate'])
|
||||
if ( $class->obj['moderate'] == 1 OR $class->obj['moderate'] == 2 )
|
||||
{
|
||||
|
||||
// Redirect them with a message telling them the post has to be previewed first
|
||||
|
||||
$DB->query("UPDATE ibf_forums SET has_mod_posts=1 WHERE id=".$class->forum['id']);
|
||||
|
||||
$class->notify_new_topic_approval( $this->topic['tid'], $this->topic['title'], $this->topic['starter_name'] );
|
||||
|
||||
$print->redirect_screen( $ibforums->lang['moderate_topic'], "act=SF&f={$class->forum['id']}" );
|
||||
}
|
||||
|
||||
@@ -307,6 +350,12 @@ class post_functions extends Post {
|
||||
if ( $ibforums->member['posts'] + 1 >= $gposts )
|
||||
{
|
||||
$mgroup = "mgroup='$gid', ";
|
||||
|
||||
if ( USE_MODULES == 1 )
|
||||
{
|
||||
$class->modules->register_class(&$class);
|
||||
$class->modules->on_group_change($ibforums->member['id'], $gid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,7 +377,7 @@ class post_functions extends Post {
|
||||
// Redirect them back to the topic
|
||||
//-------------------------------------------------
|
||||
|
||||
$std->boink_it($class->base_url."&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}");
|
||||
$std->boink_it($class->base_url."act=ST&f={$class->forum['id']}&t={$this->topic['tid']}");
|
||||
|
||||
}
|
||||
|
||||
@@ -344,26 +393,36 @@ class post_functions extends Post {
|
||||
// Sort out the "raw" textarea input and make it safe incase
|
||||
// we have a <textarea> tag in the raw post var.
|
||||
|
||||
$raw_post = isset($HTTP_POST_VARS['Post']) ? $HTTP_POST_VARS['Post'] : "";
|
||||
$topic_title = isset($HTTP_POST_VARS['TopicTitle']) ? $HTTP_POST_VARS['TopicTitle'] : "";
|
||||
$topic_desc = isset($HTTP_POST_VARS['TopicDesc']) ? $HTTP_POST_VARS['TopicDesc'] : "";
|
||||
$poll = isset($HTTP_POST_VARS['PollAnswers']) ? stripslashes($HTTP_POST_VARS['PollAnswers']) : "";
|
||||
$raw_post = isset($HTTP_POST_VARS['Post']) ? $std->txt_htmlspecialchars($HTTP_POST_VARS['Post']) : "";
|
||||
$topic_title = isset($HTTP_POST_VARS['TopicTitle']) ? str_replace("'", "'", stripslashes($HTTP_POST_VARS['TopicTitle']) ) : "";
|
||||
$topic_desc = isset($HTTP_POST_VARS['TopicDesc']) ? str_replace("'", "'", stripslashes($HTTP_POST_VARS['TopicDesc']) ) : "";
|
||||
$poll = isset($HTTP_POST_VARS['PollAnswers']) ? $std->txt_htmlspecialchars($std->txt_stripslashes($HTTP_POST_VARS['PollAnswers'])) : "";
|
||||
|
||||
if (isset($raw_post)) {
|
||||
$raw_post = preg_replace( "/<textarea>/", "<textarea>", $raw_post );
|
||||
$raw_post = str_replace( '$', "$", $raw_post );
|
||||
if (isset($raw_post))
|
||||
{
|
||||
$raw_post = $std->txt_raw2form($raw_post);
|
||||
$raw_post = str_replace( '<%', "<%" , $raw_post );
|
||||
$raw_post = stripslashes($raw_post);
|
||||
|
||||
}
|
||||
|
||||
// Do we have any posting errors?
|
||||
|
||||
if ($class->obj['post_errors']) {
|
||||
if ($class->obj['post_errors'])
|
||||
{
|
||||
$class->output .= $class->html->errors( $ibforums->lang[ $class->obj['post_errors'] ]);
|
||||
}
|
||||
|
||||
if ($class->obj['preview_post']) {
|
||||
$class->output .= $class->html->preview( $class->parser->convert( array( 'TEXT' => $this->post['post'], 'CODE' => $class->forum['use_ibc'], 'SMILIES' => $ibforums->input['enableemo'], 'HTML' => $class->forum['use_html']) ) );
|
||||
if ($class->obj['preview_post'])
|
||||
{
|
||||
$this->post['post'] = $class->parser->post_db_parse(
|
||||
$class->parser->convert( array(
|
||||
'TEXT' => $this->post['post'],
|
||||
'CODE' => $class->forum['use_ibc'],
|
||||
'SMILIES' => $ibforums->input['enableemo'],
|
||||
'HTML' => $class->forum['use_html']
|
||||
) ) ,
|
||||
$class->forum['use_html']);
|
||||
$class->output .= $class->html->preview( $this->post['post'] );
|
||||
}
|
||||
|
||||
$extra = "";
|
||||
@@ -385,7 +444,7 @@ class post_functions extends Post {
|
||||
|
||||
$topic_title = $class->html->topictitle_fields( array( TITLE => $topic_title, DESC => $topic_desc ) );
|
||||
|
||||
$start_table = $class->html->table_top( "{$ibforums->lang['top_txt_poll']} {$class->forum['name']}");
|
||||
$start_table = $class->html->table_top( "{$ibforums->lang['top_txt_poll']}: {$class->forum['name']}");
|
||||
|
||||
$name_fields = $class->html_name_field();
|
||||
|
||||
@@ -393,7 +452,7 @@ class post_functions extends Post {
|
||||
|
||||
$mod_options = $class->mod_options();
|
||||
|
||||
$poll_box = $class->html->poll_box($poll, $extra);
|
||||
$poll_box = $class->html->poll_box( $poll, $extra);
|
||||
|
||||
$end_form = $class->html->EndForm( $ibforums->lang['submit_poll'] );
|
||||
|
||||
@@ -415,14 +474,24 @@ class post_functions extends Post {
|
||||
$class->output = preg_replace( "/<!--END TABLE-->/" , "$end_form" , $class->output );
|
||||
$class->output = preg_replace( "/<!--TOPIC TITLE-->/" , "$topic_title" , $class->output );
|
||||
$class->output = preg_replace( "/<!--POLL BOX-->/" , "$poll_box" , $class->output );
|
||||
$class->output = str_replace("<!--FORUM RULES-->", $std->print_forum_rules($class->forum), $class->output );
|
||||
|
||||
if ( $ibforums->vars['poll_disable_noreply'] != 1 )
|
||||
{
|
||||
$class->output = str_replace("<!--IBF.POLL_OPTIONS-->", $class->html->poll_options(), $class->output );
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
// Add in siggy buttons and such
|
||||
//---------------------------------------
|
||||
|
||||
$class->html_checkboxes();
|
||||
|
||||
|
||||
$class->html_add_smilie_box();
|
||||
|
||||
$this->nav = array( "<a href='{$class->base_url}&act=SC&c={$class->forum['cat_id']}'>{$class->forum['cat_name']}</a>",
|
||||
"<a href='{$class->base_url}&act=SF&f={$class->forum['id']}'>{$class->forum['name']}</a>",
|
||||
$this->nav = array( "<a href='{$class->base_url}act=SC&c={$class->forum['cat_id']}'>{$class->forum['cat_name']}</a>",
|
||||
"<a href='{$class->base_url}act=SF&f={$class->forum['id']}'>{$class->forum['name']}</a>",
|
||||
);
|
||||
$this->title = $ibforums->lang['posting_new_topic'];
|
||||
|
||||
|
||||
Reference in new issue
Block a user