Parse error: syntax error, unexpected ';', expecting T_OLD_FUNCTION or T_FUNCTION or
09-10-06, 08:40 PM
Newbie Coder
Join Date: Jul 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Parse error: syntax error, unexpected ';', expecting T_OLD_FUNCTION or T_FUNCTION or
Can somebody please help? Whenever I try to view a topic on my forum I get this error:
Quote:
Parse error: syntax error, unexpected ';', expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/drforens/public_html/forums/sources/action_public/topics.php on line 2703
This is what I got as line 2703 of topics.php...
Thanks in advance!
Kyle R.
09-10-06, 08:41 PM
Newbie Coder
Join Date: Jul 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
...and this is the entire content of topics.php:
PHP Code:
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| Invision Power Board v.2.1.7
| =============================================
|
|
|
|
+---------------------------------------------------------------------------
| > $Date: 2006-01-05 11:02:13 +0000 (Thu, 05 Jan 2006) $
| > $Revision: 114 $
| > $Author: matt $
+---------------------------------------------------------------------------
|
| > Topic display module
| > Module written by Matt Mecham
| > Date started: 18th February 2002
|
| > Module Version Number: 1.1.0
| > DBA Checked: Thu 20 May 2004
| > Quality Checked: Wed 15 Sept. 2004
+--------------------------------------------------------------------------
*/
if ( ! defined ( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files." ;
exit();
}
class topics
{
# Global
var $ipsclass ;
var $output = "" ;
var $base_url = "" ;
var $html = "" ;
var $moderator = array();
var $forum = array();
var $topic = array();
var $mem_titles = array();
var $mod_action = array();
var $poll_html = "" ;
var $parser = "" ;
var $mimetypes = "" ;
var $nav_extra = "" ;
var $read_array = array();
var $mod_panel_html = "" ;
var $warn_range = 0 ;
var $warn_done = 0 ;
var $md5_check = "" ;
var $post_count = 0 ;
var $cached_members = array();
var $first_printed = 0 ;
var $pids = array();
var $attach_pids = array();
var $first = "" ;
var $qpids = "" ;
var $custom_fields = "" ;
var $last_read_tid = "" ;
# Permissions
var $can_vote = 0 ;
var $can_rate = 0 ;
/*-------------------------------------------------------------------------*/
//
// Our constructor, load words, load skin, print the topic listing
//
/*-------------------------------------------------------------------------*/
function auto_run ()
{
//-----------------------------------------
// Build all permissions
//-----------------------------------------
$this -> build_permissions ();
//-----------------------------------------
// Are we just adding a poll vote?
//-----------------------------------------
if ( $this -> ipsclass -> input [ 'addpoll' ] )
{
$this -> topic_add_vote_to_poll ();
}
//-----------------------------------------
// INIT module
//-----------------------------------------
$this -> init ();
//-----------------------------------------
// Are we just adding a rating vote?
//-----------------------------------------
if ( $this -> ipsclass -> input [ 'addrating' ] )
{
$this -> topic_add_vote_to_rating ();
}
//-----------------------------------------
// Process the topic
//-----------------------------------------
$this -> topic_set_up ();
//-----------------------------------------
// Which view are we using?
//-----------------------------------------
if ( $this -> ipsclass -> input [ 'mode' ] )
{
$this -> topic_view_mode = $this -> ipsclass -> input [ 'mode' ];
$this -> ipsclass -> my_setcookie ( 'topicmode' , $this -> ipsclass -> input [ 'mode' ], 1 );
}
else
{
$this -> topic_view_mode = $this -> ipsclass -> my_getcookie ( 'topicmode' );
}
if ( ! $this -> topic_view_mode )
{
//-----------------------------------------
// No cookie and no URL
//-----------------------------------------
$this -> topic_view_mode = $this -> ipsclass -> vars [ 'topicmode_default' ] ? $this -> ipsclass -> vars [ 'topicmode_default' ] : 'linear' ;
}
//-----------------------------------------
// VIEWS
//-----------------------------------------
if ( isset( $this -> ipsclass -> input [ 'view' ]) )
{
if ( $this -> ipsclass -> input [ 'view' ] == 'new' )
{
//-----------------------------------------
// Newer
//-----------------------------------------
$this -> ipsclass -> DB -> simple_construct ( array( 'select' => 'tid' ,
'from' => 'topics' ,
'where' => "forum_id=" . $this -> forum [ 'id' ]. " AND approved=1 AND state <> 'link' AND last_post > " . $this -> topic [ 'last_post' ],
'order' => 'last_post' ,
'limit' => array( 0 , 1 )
) );
$this -> ipsclass -> DB -> simple_exec ();
if ( $this -> ipsclass -> DB -> get_num_rows () )
{
$this -> topic = $this -> ipsclass -> DB -> fetch_row ();
$this -> ipsclass -> boink_it ( $this -> ipsclass -> base_url . "showtopic=" . $this -> topic [ 'tid' ]);
}
else
{
$this -> ipsclass -> Error ( array( LEVEL => 1 , MSG => 'no_newer' ) );
}
}
else if ( $this -> ipsclass -> input [ 'view' ] == 'old' )
{
//-----------------------------------------
// Older
//-----------------------------------------
$this -> ipsclass -> DB -> simple_construct ( array( 'select' => 'tid' ,
'from' => 'topics' ,
'where' => "forum_id=" . $this -> forum [ 'id' ]. " AND approved=1 AND state <> 'link' AND last_post < " . $this -> topic [ 'last_post' ],
'order' => 'last_post DESC' ,
'limit' => array( 0 , 1 )
) );
$this -> ipsclass -> DB -> simple_exec ();
if ( $this -> ipsclass -> DB -> get_num_rows () )
{
$this -> topic = $this -> ipsclass -> DB -> fetch_row ();
$this -> ipsclass -> boink_it ( $this -> ipsclass -> base_url . "showtopic=" . $this -> topic [ 'tid' ]);
}
else
{
$this -> ipsclass -> Error ( array( LEVEL => 1 , MSG => 'no_older' ) );
}
}
else if ( $this -> ipsclass -> input [ 'view' ] == 'getlastpost' )
{
//-----------------------------------------
// Last post
//-----------------------------------------
$this -> return_last_post ();
}
else if ( $this -> ipsclass -> input [ 'view' ] == 'getnewpost' )
{
//-----------------------------------------
// Newest post
//-----------------------------------------
$st = 0 ;
$pid = "" ;
if ( $this -> ipsclass -> vars [ 'db_topic_read_cutoff' ] and $this -> ipsclass -> member [ 'id' ] )
{
$last_time = intval ( $this -> my_topics_read [ $this -> topic [ 'tid' ] ] ) ? intval ( $this -> my_topics_read [ $this -> topic [ 'tid' ] ] ) : intval ( $this -> db_row [ 'marker_last_cleared' ] );
}
$last_time = $last_time ? $last_time : $this -> ipsclass -> input [ 'last_visit' ];
$this -> ipsclass -> DB -> simple_construct ( array( 'select' => 'MIN(pid) as pid' ,
'from' => 'posts' ,
'where' => "queued=0 AND topic_id=" . $this -> topic [ 'tid' ]. " AND post_date > " . intval ( $last_time ),
'limit' => array( 0 , 1 )
) );
$this -> ipsclass -> DB -> simple_exec ();
$post = $this -> ipsclass -> DB -> fetch_row ();
if ( $post [ 'pid' ] )
{
$pid = "&#entry" . $post [ 'pid' ];
$this -> ipsclass -> DB -> simple_construct ( array( 'select' => 'COUNT(*) as posts' ,
'from' => 'posts' ,
'where' => "topic_id=" . $this -> topic [ 'tid' ]. " AND pid <= " . $post [ 'pid' ],
) );
$this -> ipsclass -> DB -> simple_exec ();
$cposts = $this -> ipsclass -> DB -> fetch_row ();
if ( (( $cposts [ 'posts' ]) % $this -> ipsclass -> vars [ 'display_max_posts' ]) == 0 )
{
$pages = ( $cposts [ 'posts' ]) / $this -> ipsclass -> vars [ 'display_max_posts' ];
}
else
{
$number = ( ( $cposts [ 'posts' ]) / $this -> ipsclass -> vars [ 'display_max_posts' ] );
$pages = ceil ( $number );
}
$st = ( $pages - 1 ) * $this -> ipsclass -> vars [ 'display_max_posts' ];
$this -> ipsclass -> boink_it ( $this -> ipsclass -> base_url . "showtopic=" . $this -> topic [ 'tid' ]. "&st= $st " . $pid );
}
else
{
$this -> return_last_post ();
}
}
else if ( $this -> ipsclass -> input [ 'view' ] == 'findpost' )
{
//-----------------------------------------
// Find a post
//-----------------------------------------
$pid = intval ( $this -> ipsclass -> input [ 'p' ]);
if ( $pid > 0 )
{
$this -> ipsclass -> DB -> simple_construct ( array( 'select' => 'COUNT(*) as posts' ,
'from' => 'posts' ,
'where' => "topic_id=" . $this -> topic [ 'tid' ]. " AND pid <= " . $pid ,
) );
$this -> ipsclass -> DB -> simple_exec ();
$cposts = $this -> ipsclass -> DB -> fetch_row ();
if ( (( $cposts [ 'posts' ]) % $this -> ipsclass -> vars [ 'display_max_posts' ]) == 0 )
{
$pages = ( $cposts [ 'posts' ]) / $this -> ipsclass -> vars [ 'display_max_posts' ];
}
else
{
$number = ( ( $cposts [ 'posts' ]) / $this -> ipsclass -> vars [ 'display_max_posts' ] );
$pages = ceil ( $number );
}
$st = ( $pages - 1 ) * $this -> ipsclass -> vars [ 'display_max_posts' ];
$this -> ipsclass -> boink_it ( $this -> ipsclass -> base_url . "showtopic=" . $this -> topic [ 'tid' ]. "&st= $st &p= $pid " . "&#entry" . $pid );
}
else
{
$this -> return_last_post ();
}
}
}
//-----------------------------------------
// UPDATE TOPIC?
//-----------------------------------------
if ( ! $this -> ipsclass -> input [ 'b' ] )
{
if ( $this -> topic [ 'topic_firstpost' ] < 1 )
{
//--------------------------------------
// No first topic set - old topic, update
//--------------------------------------
$this -> ipsclass -> DB -> simple_construct ( array (
'select' => 'pid' ,
'from' => 'posts' ,
'where' => 'topic_id=' . $this -> topic [ 'tid' ]. ' AND new_topic=1'
) );
$this -> ipsclass -> DB -> simple_exec ();
$post = $this -> ipsclass -> DB -> fetch_row ();
if ( ! $post [ 'pid' ] )
{
//-----------------------------------------
// Get first post info
//-----------------------------------------
$this -> ipsclass -> DB -> simple_construct ( array( 'select' => 'pid' ,
'from' => 'posts' ,
'where' => "topic_id= { $this -> topic [ 'tid' ]} " ,
'order' => 'pid ASC' ,
'limit' => array( 0 , 1 ) ) );
$this -> ipsclass -> DB -> simple_exec ();
$first_post = $this -> ipsclass -> DB -> fetch_row ();
$post [ 'pid' ] = $first_post [ 'pid' ];
}
if ( $post [ 'pid' ] )
{
$this -> ipsclass -> DB -> simple_construct ( array (
'update' => 'topics' ,
'set' => 'topic_firstpost=' . $post [ 'pid' ],
'where' => 'tid=' . $this -> topic [ 'tid' ]
) );
$this -> ipsclass -> DB -> simple_exec ();
}
//--------------------------------------
// Reload "fixed" topic
//--------------------------------------
$this -> ipsclass -> boink_it ( $this -> ipsclass -> base_url . "showtopic=" . $this -> topic [ 'tid' ]. "&b=1&st= { $this -> ipsclass -> input [ 'st' ]} &p= { $this -> ipsclass -> input [ 'p' ]} " . "&#entry" . $this -> ipsclass -> input [ 'p' ]);
}
}
$find_pid = $this -> ipsclass -> input [ 'pid' ] == "" ? $this -> ipsclass -> input [ 'p' ] : $this -> ipsclass -> input [ 'pid' ];
if ( $find_pid )
{
$threaded_pid = '&pid=' . $find_pid ;
$linear_pid = '&view=findpost&p=' . $find_pid ;
}
if ( $this -> topic_view_mode == 'threaded' )
{
$require = 'topic_threaded.php' ;
$this -> topic [ 'to_button_threaded' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> toutline_mode_choice_on ( " { $this -> ipsclass -> base_url } showtopic= { $this -> topic [ 'tid' ]} &mode=threaded" . $threaded_pid , $this -> ipsclass -> lang [ 'tom_outline' ] );
$this -> topic [ 'to_button_standard' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> toutline_mode_choice_off ( " { $this -> ipsclass -> base_url } showtopic= { $this -> topic [ 'tid' ]} &mode=linear" . $linear_pid , $this -> ipsclass -> lang [ 'tom_standard' ] );
$this -> topic [ 'to_button_linearpl' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> toutline_mode_choice_off ( " { $this -> ipsclass -> base_url } showtopic= { $this -> topic [ 'tid' ]} &mode=linearplus" . $linear_pid , $this -> ipsclass -> lang [ 'tom_linear' ] );
}
else
{
$require = 'topic_linear.php' ;
$this -> topic [ 'to_button_threaded' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> toutline_mode_choice_off ( " { $this -> ipsclass -> base_url } showtopic= { $this -> topic [ 'tid' ]} &mode=threaded" . $threaded_pid , $this -> ipsclass -> lang [ 'tom_outline' ] );
if ( $this -> topic_view_mode == 'linearplus' )
{
$this -> topic [ 'to_button_standard' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> toutline_mode_choice_off ( " { $this -> ipsclass -> base_url } showtopic= { $this -> topic [ 'tid' ]} &mode=linear" . $linear_pid , $this -> ipsclass -> lang [ 'tom_standard' ] );
$this -> topic [ 'to_button_linearpl' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> toutline_mode_choice_on ( " { $this -> ipsclass -> base_url } showtopic= { $this -> topic [ 'tid' ]} &mode=linearplus" . $linear_pid , $this -> ipsclass -> lang [ 'tom_linear' ] );
}
else
{
$this -> topic [ 'to_button_standard' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> toutline_mode_choice_on ( " { $this -> ipsclass -> base_url } showtopic= { $this -> topic [ 'tid' ]} &mode=linear" . $linear_pid , $this -> ipsclass -> lang [ 'tom_standard' ] );
$this -> topic [ 'to_button_linearpl' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> toutline_mode_choice_off ( " { $this -> ipsclass -> base_url } showtopic= { $this -> topic [ 'tid' ]} &mode=linearplus" . $linear_pid , $this -> ipsclass -> lang [ 'tom_linear' ] );
}
}
//-----------------------------------------
// Remove potential [attachmentid= tag in title
//-----------------------------------------
$this -> topic [ 'title' ] = str_replace ( '[attachmentid=' , '[attachmentid=' , $this -> topic [ 'title' ] );
//-----------------------------------------
// Load and run lib
//-----------------------------------------
$this -> func = $this -> ipsclass -> load_class ( ROOT_PATH . 'sources/lib/func_' . $require , 'topic_display' );
$this -> func -> register_class ( $this );
$this -> func -> display_topic ();
$this -> output .= $this -> func -> output ;
//-----------------------------------------
// Do we have a poll?
//-----------------------------------------
if ( $this -> topic [ 'poll_state' ] )
{
$this -> output = str_replace ( "<!--{IBF.POLL}-->" , $this -> parse_poll (), $this -> output );
}
else
{
// Can we start a poll? Is this our topic and is it still open?
if ( $this -> topic [ 'state' ] != "closed" AND $this -> ipsclass -> member [ 'id' ] AND $this -> ipsclass -> member [ 'g_post_polls' ] AND $this -> forum [ 'allow_poll' ] )
{
if (
( ( $this -> topic [ 'starter_id' ] == $this -> ipsclass -> member [ 'id' ]) AND ( $this -> ipsclass -> vars [ 'startpoll_cutoff' ] > 0 ) AND ( $this -> topic [ 'start_date' ] + ( $this -> ipsclass -> vars [ 'startpoll_cutoff' ] * 3600 ) > time () ) )
OR ( $this -> ipsclass -> member [ 'g_is_supmod' ] == 1 )
)
{
$this -> output = str_replace ( "<!--{IBF.START_NEW_POLL}-->" , $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> start_poll_link ( $this -> forum [ 'id' ], $this -> topic [ 'tid' ]), $this -> output );
}
}
}
//-----------------------------------------
// ATTACHMENTS!!!
//-----------------------------------------
if ( $this -> topic [ 'topic_hasattach' ] )
{
$this -> output = $this -> parse_attachments ( $this -> output , $this -> attach_pids );
}
// Still seeing attachment tags?
if ( stristr ( $this -> output , "[attachmentid=" ) )
{
$this -> output = preg_replace ( "#\[attachmentid=(\d+)\]#is" , "" , $this -> output );
}
//-----------------------------------------
// Process users active in this forum
//-----------------------------------------
if ( $this -> ipsclass -> vars [ 'no_au_topic' ] != 1 )
{
//-----------------------------------------
// Get the users
//-----------------------------------------
$cut_off = ( $this -> ipsclass -> vars [ 'au_cutoff' ] != "" ) ? $this -> ipsclass -> vars [ 'au_cutoff' ] * 60 : 900 ;
if ( ! $this -> ipsclass -> vars [ 'group_display_active' ] )
{
$this -> ipsclass -> DB -> cache_add_query ( 'topics_get_active_users' ,
array( 'tid' => $this -> topic [ 'tid' ],
'time' => time () - $cut_off ,
) );
$this -> ipsclass -> DB -> simple_exec ();
}
//-----------------------------------------
// ACTIVE USERS
//-----------------------------------------
$ar_time = time ();
$cached = array();
$active = array( 'guests' => 0 , 'anon' => 0 , 'members' => 0 , 'names' => "" );
$rows = array( $ar_time => array( 'login_type' => substr ( $this -> ipsclass -> member [ 'login_anonymous' ], 0 , 1 ),
'running_time' => $ar_time ,
'member_id' => $this -> ipsclass -> member [ 'id' ],
'member_name' => $this -> ipsclass -> member [ 'members_display_name' ],
'member_group' => $this -> ipsclass -> member [ 'mgroup' ] ) );
if ( $this -> ipsclass -> vars [ 'group_display_active' ] )
{
$time = time ();
$this -> ipsclass -> DB -> build_query ( array( 'select' => 's.member_id, s.member_name, s.member_group, s.id, s.login_type, s.location, s.running_time' ,
'from' => array( 'sessions' => 's' ),
'where' => "s.location_1_type = 'topic' AND s.location_1_id = { $this -> topic [ 'tid' ]} AND s.running_time > { $time } - { $cut_off } AND s.in_error=0" ,
'add_join' => array( 1 => array( 'from' => array( 'groups' => 'g' ),
'where' => 'g.g_id=s.member_group' ,
'type' => 'left' ) ),
'order' => 'g.g_display ASC, s.running_time DESC' ) );
$this -> ipsclass -> DB -> exec_query ();
while ( $r = $this -> ipsclass -> DB -> fetch_row () )
{
$rows [] = $r ;
}
}
else
{
//-----------------------------------------
// FETCH...
//-----------------------------------------
while ( $r = $this -> ipsclass -> DB -> fetch_row () )
{
$rows [ $r [ 'running_time' ]. '.' . $r [ 'id' ] ] = $r ;
}
krsort ( $rows );
}
//-----------------------------------------
// PRINT...
//-----------------------------------------
foreach( $rows as $i => $result )
{
$result [ 'suffix' ] = $this -> ipsclass -> cache [ 'group_cache' ][ $result [ 'member_group' ] ][ 'suffix' ];
$result [ 'prefix' ] = $this -> ipsclass -> cache [ 'group_cache' ][ $result [ 'member_group' ] ][ 'prefix' ];
$last_date = $this -> ipsclass -> get_time ( $result [ 'running_time' ] );
if ( $result [ 'member_id' ] == 0 )
{
$active [ 'guests' ]++;
}
else
{
if (empty( $cached [ $result [ 'member_id' ] ] ) )
{
$cached [ $result [ 'member_id' ] ] = 1 ;
$p_start = "" ;
$p_end = "" ;
$p_title = " title='" . sprintf ( $this -> ipsclass -> lang [ 'au_reading' ], $last_date ). "' " ;
if ( strstr ( $result [ 'location' ], 'post' ) and $result [ 'member_id' ] != $this -> ipsclass -> member [ 'id' ] )
{
$p_start = "<span class='activeuserposting'>" ;
$p_end = "</span>" ;
$p_title = " title='" . sprintf ( $this -> ipsclass -> lang [ 'au_posting' ], $last_date ). "' " ;
}
if ( $result [ 'login_type' ] == 1 )
{
if ( ( $this -> ipsclass -> member [ 'mgroup' ] == $this -> ipsclass -> vars [ 'admin_group' ]) and ( $this -> ipsclass -> vars [ 'disable_admin_anon' ] != 1 ) )
{
$active [ 'names' ] .= " $p_start <a href=' { $this -> ipsclass -> base_url } showuser= { $result [ 'member_id' ]} ' $p_title > { $result [ 'prefix' ]}{ $result [ 'member_name' ]}{ $result [ 'suffix' ]} </a>* $p_end , " ;
$active [ 'anon' ]++;
}
else
{
$active [ 'anon' ]++;
}
}
else
{
$active [ 'members' ]++;
$active [ 'names' ] .= " $p_start <a href=' { $this -> ipsclass -> base_url } showuser= { $result [ 'member_id' ]} ' $p_title > { $result [ 'prefix' ]}{ $result [ 'member_name' ]}{ $result [ 'suffix' ]} </a> $p_end , " ;
}
}
}
}
$active [ 'names' ] = preg_replace ( "/,\s+$/" , "" , $active [ 'names' ] );
$this -> ipsclass -> lang [ 'active_users_title' ] = sprintf ( $this -> ipsclass -> lang [ 'active_users_title' ] , ( $active [ 'members' ] + $active [ 'guests' ] + $active [ 'anon' ] ) );
$this -> ipsclass -> lang [ 'active_users_detail' ] = sprintf ( $this -> ipsclass -> lang [ 'active_users_detail' ] , $active [ 'guests' ], $active [ 'anon' ] );
$this -> ipsclass -> lang [ 'active_users_members' ] = sprintf ( $this -> ipsclass -> lang [ 'active_users_members' ], $active [ 'members' ] );
$this -> output = str_replace ( "<!--IBF.TOPIC_ACTIVE-->" , $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> topic_active_users ( $active ), $this -> output );
}
//-----------------------------------------
// Print it
//-----------------------------------------
if ( $this -> ipsclass -> member [ 'is_mod' ] )
{
$this -> output = str_replace ( "<!--IBF.MOD_PANEL-->" , $this -> moderation_panel (), $this -> output );
}
else
{
$this -> output = str_replace ( "<!--IBF.MOD_PANEL_NO_MOD-->" , $this -> moderation_panel (), $this -> output );
}
//-----------------------------------------
// Enable quick reply box?
//-----------------------------------------
if ( ( $this -> forum [ 'quick_reply' ] == 1 )
and ( $this -> ipsclass -> check_perms ( $this -> forum [ 'reply_perms' ]) == TRUE )
and ( $this -> topic [ 'state' ] != 'closed' ) )
{
$show = "none" ;
$sqr = $this -> ipsclass -> my_getcookie ( "open_qr" );
if ( $sqr == 1 )
{
$show = "show" ;
}
$this -> output = str_replace ( "<!--IBF.QUICK_REPLY_CLOSED-->" , $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> quick_reply_box_closed (), $this -> output );
$this -> output = str_replace ( "<!--IBF.QUICK_REPLY_OPEN-->" , $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> quick_reply_box_open ( $this -> topic [ 'forum_id' ], $this -> topic [ 'tid' ], $show , $this -> md5_check ), $this -> output );
}
$this -> topic [ 'id' ] = $this -> topic [ 'forum_id' ];
$this -> output = str_replace ( "<!--IBF.FORUM_RULES-->" , $this -> ipsclass -> print_forum_rules ( $this -> forum ), $this -> output );
//-----------------------------------------
// Topic multi-moderation - yay!
//-----------------------------------------
$this -> output = str_replace ( "<!--IBF.MULTIMOD-->" , $this -> multi_moderation (), $this -> output );
// Pass it to our print routine
$this -> ipsclass -> print -> add_output ( " $this -> output " );
$this -> ipsclass -> print -> do_output ( array( 'TITLE' => $this -> topic [ 'title' ] . ' - ' . $this -> ipsclass -> vars [ 'board_name' ],
'JS' => 1 ,
'NAV' => $this -> nav ,
) );
}
/*-------------------------------------------------------------------------*/
// ATTACHMENTS
/*-------------------------------------------------------------------------*/
function parse_attachments ( $html , $attach_pids , $type = 'attach_pid' , $from = 'pid' , $method = 'post' )
{
$final_attachments = array();
if ( count ( $attach_pids ) )
{
$this -> ipsclass -> DB -> simple_construct ( array( 'select' => '*' ,
'from' => 'attachments' ,
'where' => " $type IN (" . implode ( "," , $attach_pids ). ")"
) );
$this -> ipsclass -> DB -> simple_exec ();
while ( $a = $this -> ipsclass -> DB -> fetch_row () )
{
$final_attachments [ $a [ $type ] ][ $a [ 'attach_id' ] ] = $a ;
}
foreach ( $final_attachments as $pid => $data )
{
$temp_out = "" ;
$temp_hold = array();
foreach( $final_attachments [ $pid ] as $aid => $row )
{
//-----------------------------------------
// Is it an image, and are we viewing the image in the post?
//-----------------------------------------
if ( $this -> ipsclass -> vars [ 'show_img_upload' ] and $row [ 'attach_is_image' ] )
{
if ( $this -> ipsclass -> vars [ 'siu_thumb' ] AND $row [ 'attach_thumb_location' ] AND $row [ 'attach_thumb_width' ] )
{
$tmp = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> Show_attachments_img_thumb ( $row [ 'attach_thumb_location' ],
$row [ 'attach_thumb_width' ],
$row [ 'attach_thumb_height' ],
$row [ 'attach_id' ],
$this -> ipsclass -> size_format ( $row [ 'attach_filesize' ] ),
$row [ 'attach_hits' ],
$row [ 'attach_file' ],
$method
);
if ( strstr ( $html , '[attachmentid=' . $row [ 'attach_id' ]. ']' ) )
{
$html = str_replace ( '[attachmentid=' . $row [ 'attach_id' ]. ']' , $tmp , $html );
}
else
{
$temp_hold [ 'thumb' ] .= $tmp . ' ' ;
}
}
else
{
//-----------------------------------------
// Standard size..
//-----------------------------------------
$tmp = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> Show_attachments_img ( $row [ 'attach_location' ] );
if ( strstr ( $html , '[attachmentid=' . $row [ 'attach_id' ]. ']' ) )
{
$html = str_replace ( '[attachmentid=' . $row [ 'attach_id' ]. ']' , $tmp , $html );
}
else
{
$temp_hold [ 'image' ] .= $tmp . ' ' ;
}
}
}
else
{
//-----------------------------------------
// Full attachment thingy
//-----------------------------------------
$tmp = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> Show_attachments ( array (
'hits' => $row [ 'attach_hits' ],
'image' => $this -> ipsclass -> cache [ 'attachtypes' ][ $row [ 'attach_ext' ] ][ 'atype_img' ],
'name' => $row [ 'attach_file' ],
$from => $row [ $type ],
'id' => $row [ 'attach_id' ],
'method' => $method ,
'size' => $this -> ipsclass -> size_format ( $row [ 'attach_filesize' ] ),
) );
if ( strstr ( $html , '[attachmentid=' . $row [ 'attach_id' ]. ']' ) )
{
$html = str_replace ( '[attachmentid=' . $row [ 'attach_id' ]. ']' , $tmp , $html );
}
else
{
$temp_hold [ 'attach' ] .= $tmp ;
}
}
}
//-----------------------------------------
// Anyfink to show?
//-----------------------------------------
if ( $temp_hold [ 'thumb' ] )
{
$temp_out = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> show_attachment_title ( $this -> ipsclass -> lang [ 'attach_thumbs' ]) . $temp_hold [ 'thumb' ];
}
if ( $temp_hold [ 'image' ] )
{
$temp_out .= $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> show_attachment_title ( $this -> ipsclass -> lang [ 'attach_images' ]) . $temp_hold [ 'image' ];
}
if ( $temp_hold [ 'attach' ] )
{
$temp_out .= $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> show_attachment_title ( $this -> ipsclass -> lang [ 'attach_normal' ]) . $temp_hold [ 'attach' ];
}
if ( $temp_out )
{
$html = str_replace ( "<!--IBF.ATTACHMENT_ { $row [ $type ]} -->" , $temp_out , $html );
}
}
}
return $html ;
}
/*-------------------------------------------------------------------------*/
// Parse post
/*-------------------------------------------------------------------------*/
function parse_row ( $row = array() )
{
$poster = array();
//-----------------------------------------
// Cache member
//-----------------------------------------
if ( $row [ 'author_id' ] != 0 )
{
//-----------------------------------------
// Is it in the hash?
//-----------------------------------------
if ( isset( $this -> cached_members [ $row [ 'author_id' ] ]) )
{
//-----------------------------------------
// Ok, it's already cached, read from it
//-----------------------------------------
$poster = $this -> cached_members [ $row [ 'author_id' ] ];
$row [ 'name_css' ] = 'normalname' ;
}
else
{
$row [ 'name_css' ] = 'normalname' ;
$poster = $this -> parse_member ( $row );
//-----------------------------------------
// Add it to the cached list
//-----------------------------------------
$this -> cached_members [ $row [ 'author_id' ] ] = $poster ;
}
}
else
{
//-----------------------------------------
// It's definitely a guest...
//-----------------------------------------
$poster = $this -> ipsclass -> set_up_guest ( $row [ 'author_name' ] );
$poster [ 'members_display_name' ] = $row [ 'author_name' ];
$row [ 'name_css' ] = 'unreg' ;
}
//-----------------------------------------
if ( $row [ 'queued' ] or ( $this -> topic [ 'topic_firstpost' ] == $row [ 'pid' ] and $this -> topic [ 'approved' ] != 1 ) )
{
$row [ 'post_css' ] = $this -> post_count % 2 ? 'post1shaded' : 'post2shaded' ;
$row [ 'altrow' ] = 'row4shaded' ;
}
else
{
$row [ 'post_css' ] = $this -> post_count % 2 ? 'post1' : 'post2' ;
$row [ 'altrow' ] = 'row4' ;
}
//-----------------------------------------
if ( ( $row [ 'append_edit' ] == 1 ) and ( $row [ 'edit_time' ] != "" ) and ( $row [ 'edit_name' ] != "" ) )
{
$e_time = $this -> ipsclass -> get_date ( $row [ 'edit_time' ] , 'LONG' );
$row [ 'post' ] .= "<br /><br /><span class='edit'>" . sprintf ( $this -> ipsclass -> lang [ 'edited_by' ], $row [ 'edit_name' ], $e_time ). "</span>" ;
}
//-----------------------------------------
if (! $this -> ipsclass -> member [ 'view_img' ])
{
//-----------------------------------------
// unconvert smilies first, or it looks a bit crap.
//-----------------------------------------
$row [ 'post' ] = preg_replace ( "#<!--emo&(.+?)-->.+?<!--endemo-->#" , "\\1" , $row [ 'post' ] );
$row [ 'post' ] = preg_replace ( "/<img src=[\"'](.+?)[\"'].+?" . ">/" , "(IMG:<a href='\\1' target='_blank'>\\1</a>)" , $row [ 'post' ] );
}
//-----------------------------------------
// Highlight...
//-----------------------------------------
if ( $this -> ipsclass -> input [ 'hl' ])
{
$this -> ipsclass -> input [ 'hl' ] = $this -> ipsclass -> parse_clean_value ( urldecode ( $this -> ipsclass -> input [ 'hl' ]));
$loosematch = strstr ( $this -> ipsclass -> input [ 'hl' ], '*' ) ? 1 : 0 ;
$keywords = str_replace ( '*' , '' , str_replace ( "+" , " " , str_replace ( '-' , '' , trim ( $this -> ipsclass -> input [ 'hl' ]) ) ) );
$word_array = array();
$endmatch1 = "" ;
# Added '?' to mean 'or not'. Another bug spotted by TheWalrus. :D
$endmatch2 = "(.)?" ;
if ( preg_match ( "/,(and|or),/i" , $keywords ) )
{
while ( preg_match ( "/,(and|or),/i" , $keywords , $match ) )
{
$word_array = explode ( "," . $match [ 1 ]. "," , $keywords );
$keywords = str_replace ( $match [ 0 ], '' , $keywords );
}
}
else if ( strstr ( $keywords , ' ' ) )
{
$word_array = explode ( ' ' , str_replace ( ' ' , ' ' , $keywords ) );
}
else
{
$word_array [] = $keywords ;
}
if ( ! $loosematch )
{
$endmatch1 = "(\s|,|\.|!|<br|&|$)" ;
$endmatch2 = "(\<|\s|,|\.|!|<br|&|$)" ;
}
if ( is_array ( $word_array ))
{
foreach ( $word_array as $keywords )
{
while( preg_match ( "/(^|\s|;)(" . preg_quote ( $keywords , '/' ). ") { $endmatch1 } /i" , $row [ 'post' ] ) )
{
$row [ 'post' ] = preg_replace ( "/(^|\s|;|\>)(" . preg_quote ( $keywords , '/' ). ") { $endmatch2 } /is" , "\\1<span class='searchlite'>\\2</span>\\3" , $row [ 'post' ] );
}
}
}
}
//-----------------------------------------
// Online, offline?
//-----------------------------------------
if ( $row [ 'author_id' ] )
{
$time_limit = time () - $this -> ipsclass -> vars [ 'au_cutoff' ] * 60 ;
$poster [ 'online_status_indicator' ] = '<{PB_USER_OFFLINE}>' ;
list( $be_anon , $loggedin ) = explode ( '&' , $row [ 'login_anonymous' ] );
if ( ( $row [ 'last_visit' ] > $time_limit or $row [ 'last_activity' ] > $time_limit ) AND $be_anon != 1 AND $loggedin == 1 )
{
$poster [ 'online_status_indicator' ] = '<{PB_USER_ONLINE}>' ;
}
}
else
{
$poster [ 'online_status_indicator' ] = '' ;
}
//-----------------------------------------
// Multi Quoting?
//-----------------------------------------
$row [ 'mq_start_image' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> mq_image_add ( $row [ 'pid' ]);
if ( $this -> qpids )
{
if ( strstr ( ',' . $this -> qpids . ',' , ',' . $row [ 'pid' ]. ',' ) )
{
$row [ 'mq_start_image' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> mq_image_remove ( $row [ 'pid' ]);
}
}
//-----------------------------------------
// Multi PIDS?
//-----------------------------------------
if ( $this -> ipsclass -> member [ 'is_mod' ] )
{
$row [ 'pid_start_image' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> pid_image_unselected ( $row [ 'pid' ]);
if ( $this -> ipsclass -> input [ 'selectedpids' ] )
{
if ( strstr ( ',' . $this -> ipsclass -> input [ 'selectedpids' ]. ',' , ',' . $row [ 'pid' ]. ',' ) )
{
$row [ 'pid_start_image' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> pid_image_selected ( $row [ 'pid' ]);
}
$this -> ipsclass -> input [ 'selectedpidcount' ] = count ( explode ( "," , $this -> ipsclass -> input [ 'selectedpids' ] ) );
}
}
//-----------------------------------------
// Delete button..
//-----------------------------------------
if ( $row [ 'pid' ] != $this -> topic [ 'topic_firstpost' ] )
{
$row [ 'delete_button' ] = $this -> delete_button ( $row [ 'pid' ], $poster );
}
$row [ 'edit_button' ] = $this -> edit_button ( $row [ 'pid' ], $poster , $row [ 'post_date' ]);
$row [ 'post_date' ] = $this -> ipsclass -> get_date ( $row [ 'post_date' ], 'LONG' );
$row [ 'post_icon' ] = $row [ 'icon_id' ]
? $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> post_icon ( $row [ 'icon_id' ] )
: "" ;
$row [ 'ip_address' ] = $this -> view_ip ( $row , $poster );
$row [ 'report_link' ] = (( $this -> ipsclass -> vars [ 'disable_reportpost' ] != 1 ) and ( $this -> ipsclass -> member [ 'id' ] ))
? $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> report_link ( $row )
: "" ;
//-----------------------------------------
// Siggie stuff
//-----------------------------------------
$row [ 'signature' ] = "" ;
if ( $poster [ 'signature' ] and $this -> ipsclass -> member [ 'view_sigs' ])
{
if ( $row [ 'use_sig' ] == 1 )
{
$this -> parser -> parse_html = intval ( $this -> ipsclass -> vars [ 'sig_allow_html' ]);
$this -> parser -> parse_nl2br = 1 ;
$row [ 'signature' ] = $this -> ipsclass -> compiled_templates [ 'skin_global' ]-> signature_separator ( $this -> parser -> pre_display_parse ( $poster [ 'signature' ]) );
}
}
//-----------------------------------------
// Fix up the membername so it links to the members profile
//-----------------------------------------
if ( $poster [ 'id' ] )
{
$poster [ 'members_display_name' ] = "<a href=' { $this -> base_url } showuser= { $poster [ 'id' ]} '> { $poster [ 'members_display_name' ]} </a>" ;
}
//-----------------------------------------
// Parse HTML tag on the fly
//-----------------------------------------
$this -> parser -> parse_html = ( $this -> forum [ 'use_html' ] and $this -> ipsclass -> cache [ 'group_cache' ][ $poster [ 'mgroup' ] ][ 'g_dohtml' ] and $row [ 'post_htmlstate' ] ) ? 1 : 0 ;
$this -> parser -> parse_nl2br = $row [ 'post_htmlstate' ] == 2 ? 1 : 0 ;
$row [ 'post' ] = $this -> parser -> pre_display_parse ( $row [ 'post' ] );
//-----------------------------------------
// A bit hackish - but there are lots of <br> => <br /> changes to make
//-----------------------------------------
//$row['post'] = str_replace( "<br>", "<br />", $row['post'] );
//$row['signature'] = str_replace( "<br>", "<br />", $row['signature'] );
//-----------------------------------------
// Post number
//-----------------------------------------
if ( $this -> topic_view_mode == 'linearplus' and $this -> topic [ 'topic_firstpost' ] == $row [ 'pid' ])
{
$row [ 'post_count' ] = 1 ;
if ( ! $this -> first )
{
$this -> post_count ++;
}
}
else
{
$this -> post_count ++;
$row [ 'post_count' ] = intval ( $this -> ipsclass -> input [ 'st' ]) + $this -> post_count ;
}
$row [ 'forum_id' ] = $this -> topic [ 'forum_id' ];
return array( 'row' => $row , 'poster' => $poster );
}
/*-------------------------------------------------------------------------*/
// Parse the member info
/*-------------------------------------------------------------------------*/
function parse_member ( $member =array() )
{
$member [ 'avatar' ] = $this -> ipsclass -> get_avatar ( $member [ 'avatar_location' ], $this -> ipsclass -> member [ 'view_avs' ], $member [ 'avatar_size' ], $member [ 'avatar_type' ] );
$pips = 0 ;
foreach( $this -> mem_titles as $k => $v )
{
if ( $member [ 'posts' ] >= $v [ 'POSTS' ])
{
if (! $member [ 'title' ])
{
$member [ 'title' ] = $this -> mem_titles [ $k ][ 'TITLE' ];
}
$pips = $v [ 'PIPS' ];
break;
}
}
if ( $this -> ipsclass -> cache [ 'group_cache' ][ $member [ 'mgroup' ] ][ 'g_icon' ] )
{
$member [ 'member_rank_img' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> member_rank_img ( $this -> ipsclass -> cache [ 'group_cache' ][ $member [ 'mgroup' ] ][ 'g_icon' ]);
}
else if ( $pips )
{
if ( is_numeric ( $pips ) )
{
for ( $i = 1 ; $i <= $pips ; ++ $i )
{
$member [ 'member_rank_img' ] .= "<{A_STAR}>" ;
}
}
else
{
$member [ 'member_rank_img' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> member_rank_img ( 'style_images/<#IMG_DIR#>/folder_team_icons/' . $pips );
}
}
$member [ 'member_joined' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> member_joined ( $this -> ipsclass -> get_date ( $member [ 'joined' ], 'JOINED' ) );
$member [ 'member_group' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> member_group ( $this -> ipsclass -> cache [ 'group_cache' ][ $member [ 'mgroup' ] ][ 'g_title' ] );
$member [ 'member_posts' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> member_posts ( $this -> ipsclass -> do_number_format ( $member [ 'posts' ]) );
$member [ 'member_number' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> member_number ( $this -> ipsclass -> do_number_format ( $member [ 'id' ]) );
$member [ 'profile_icon' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> member_icon_profile ( $member [ 'id' ] );
$member [ 'message_icon' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> member_icon_msg ( $member [ 'id' ] );
if ( $member [ 'location' ])
{
$member [ 'member_location' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> member_location ( $member [ 'location' ] );
}
if (! $member [ 'hide_email' ])
{
$member [ 'email_icon' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> member_icon_email ( $member [ 'id' ] );
}
if ( $member [ 'id' ] )
{
$member [ 'addresscard' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> member_icon_vcard ( $member [ 'id' ] );
}
//-----------------------------------------
// D21-Downloads System
//-----------------------------------------
if ( $this -> ipsclass -> vars [ 'd_topic' ] == 1 )
{
if ( $member [ 'files' ] != 0 )
{
$member [ 'files' ] = $this -> ipsclass -> lang [ 'd_upload' ]. " <a href=' { $this -> ipsclass -> base_url } act=downloads&do=search&type=do_search&author= { $member [ 'name' ]} '> { $member [ 'files' ]} </a><br />" ;
}
else
{
$member [ 'files' ] = $this -> ipsclass -> lang [ 'd_upload' ]. " <i> { $this -> ipsclass -> lang [ 'd_no_upload' ]} </i><br />" ;
}
}
else
{
$member [ 'files' ] = "" ;
}
if ( $this -> ipsclass -> vars [ 'd_downloads' ] == 1 )
{
if ( $member [ 'downloads' ] != 0 )
{
$member [ 'downloads' ] = $this -> ipsclass -> lang [ 'd_download' ]. " <a href=' { $this -> ipsclass -> base_url } act=downloads&do=filecp&code=downs&mid= { $member [ 'id' ]} '> { $member [ 'downloads' ]} </a><br />" ;
}
else
{
$member [ 'downloads' ] = $this -> ipsclass -> lang [ 'd_download' ]. " <i> { $this -> ipsclass -> lang [ 'd_no_download' ]} </i><br />" ;
}
}
else
{
$member [ 'downloads' ] = "" ;
}
//-----------------------------------------
// Warny porny?
//-----------------------------------------
if ( $this -> ipsclass -> vars [ 'warn_on' ] and ( ! strstr ( ',' . $this -> ipsclass -> vars [ 'warn_protected' ]. ',' , ',' . $member [ 'mgroup' ]. ',' ) ) )
{
if ( $this -> ipsclass -> member [ '_moderator' ][ $this -> topic [ 'forum_id' ] ][ 'allow_warn' ]
or ( $this -> ipsclass -> member [ 'g_is_supmod' ] == 1 )
or ( $this -> ipsclass -> vars [ 'warn_show_own' ] and ( $this -> ipsclass -> member [ 'id' ] == $member [ 'id' ] ) )
)
{
// Work out which image to show.
if ( ! $this -> ipsclass -> vars [ 'warn_show_rating' ] )
{
if ( $member [ 'warn_level' ] <= $this -> ipsclass -> vars [ 'warn_min' ] )
{
$member [ 'warn_img' ] = '<{WARN_0}>' ;
$member [ 'warn_percent' ] = 0 ;
}
else if ( $member [ 'warn_level' ] >= $this -> ipsclass -> vars [ 'warn_max' ] )
{
$member [ 'warn_img' ] = '<{WARN_5}>' ;
$member [ 'warn_percent' ] = 100 ;
}
else
{
$member [ 'warn_percent' ] = $member [ 'warn_level' ] ? sprintf ( "%.0f" , ( ( $member [ 'warn_level' ] / $this -> ipsclass -> vars [ 'warn_max' ]) * 100 ) ) : 0 ;
if ( $member [ 'warn_percent' ] > 100 )
{
$member [ 'warn_percent' ] = 100 ;
}
if ( $member [ 'warn_percent' ] >= 81 )
{
$member [ 'warn_img' ] = '<{WARN_5}>' ;
}
else if ( $member [ 'warn_percent' ] >= 61 )
{
$member [ 'warn_img' ] = '<{WARN_4}>' ;
}
else if ( $member [ 'warn_percent' ] >= 41 )
{
$member [ 'warn_img' ] = '<{WARN_3}>' ;
}
else if ( $member [ 'warn_percent' ] >= 21 )
{
$member [ 'warn_img' ] = '<{WARN_2}>' ;
}
else if ( $member [ 'warn_percent' ] >= 1 )
{
$member [ 'warn_img' ] = '<{WARN_1}>' ;
}
else
{
$member [ 'warn_img' ] = '<{WARN_0}>' ;
}
}
if ( $member [ 'warn_percent' ] < 1 )
{
$member [ 'warn_percent' ] = 0 ;
}
$member [ 'warn_text' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> warn_level_warn ( $member [ 'id' ], $member [ 'warn_percent' ] );
}
else
{
// Ratings mode..
$member [ 'warn_text' ] = $this -> ipsclass -> lang [ 'tt_rating' ];
$member [ 'warn_img' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> warn_level_rating ( $member [ 'id' ], $member [ 'warn_level' ], $this -> ipsclass -> vars [ 'warn_min' ], $this -> ipsclass -> vars [ 'warn_max' ]);
}
if ( $this -> ipsclass -> member [ '_moderator' ][ $this -> topic [ 'forum_id' ] ][ 'allow_warn' ] or $this -> ipsclass -> member [ 'g_is_supmod' ] == 1 )
{
$member [ 'warn_add' ] = "<a href=' { $this -> ipsclass -> base_url } act=warn&type=add&mid= { $member [ 'id' ]} &t= { $this -> topic [ 'tid' ]} &st=" . intval ( $this -> ipsclass -> input [ 'st' ]). "' title=' { $this -> ipsclass -> lang [ 'tt_warn_add' ]} '><{WARN_ADD}></a>" ;
$member [ 'warn_minus' ] = "<a href=' { $this -> ipsclass -> base_url } act=warn&type=minus&mid= { $member [ 'id' ]} &t= { $this -> topic [ 'tid' ]} &st=" . intval ( $this -> ipsclass -> input [ 'st' ]). "' title=' { $this -> ipsclass -> lang [ 'tt_warn_minus' ]} '><{WARN_MINUS}></a>" ;
}
}
}
//-----------------------------------------
// Profile fields stuff
//-----------------------------------------
if ( $this -> ipsclass -> vars [ 'custom_profile_topic' ] == 1 )
{
if ( $this -> custom_fields )
{
$this -> custom_fields -> member_data = $member ;
$this -> custom_fields -> init_data ();
$this -> custom_fields -> parse_to_view ( 1 );
if ( count ( $this -> custom_fields -> out_fields ) )
{
foreach( $this -> custom_fields -> out_fields as $i => $data )
{
if ( $data )
{
$member [ 'custom_fields' ] .= "\n" . $this -> custom_fields -> method_format_field_for_topic_view ( $i );
}
}
}
}
}
return $member ;
}
/*-------------------------------------------------------------------------*/
// Render the delete button
/*-------------------------------------------------------------------------*/
function delete_button ( $post_id , $poster )
{
if ( $this -> ipsclass -> member [ 'id' ] == "" or $this -> ipsclass -> member [ 'id' ] == 0 )
{
return "" ;
}
$button = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> button_delete ( $this -> forum [ 'id' ], $this -> topic [ 'tid' ], $post_id , $this -> md5_check );
if ( $this -> ipsclass -> member [ 'g_is_supmod' ]) return $button ;
if ( $this -> moderator [ 'delete_post' ]) return $button ;
if ( $poster [ 'id' ] == $this -> ipsclass -> member [ 'id' ] and ( $this -> ipsclass -> member [ 'g_delete_own_posts' ])) return $button ;
return "" ;
}
/*-------------------------------------------------------------------------*/
// Render the edit button
/*-------------------------------------------------------------------------*/
function edit_button ( $post_id , $poster , $post_date )
{
if ( $this -> ipsclass -> member [ 'id' ] == "" or $this -> ipsclass -> member [ 'id' ] == 0 )
{
return "" ;
}
$button = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> button_edit ( $this -> forum [ 'id' ], $this -> topic [ 'tid' ], $post_id );
if ( $this -> ipsclass -> member [ 'g_is_supmod' ]) return $button ;
if ( $this -> moderator [ 'edit_post' ]) return $button ;
if ( $poster [ 'id' ] == $this -> ipsclass -> member [ 'id' ] and ( $this -> ipsclass -> member [ 'g_edit_posts' ]))
{
// Have we set a time limit?
if ( $this -> ipsclass -> member [ 'g_edit_cutoff' ] > 0 )
{
if ( $post_date > ( time () - ( intval ( $this -> ipsclass -> member [ 'g_edit_cutoff' ]) * 60 ) ) )
{
return $button ;
}
else
{
return "" ;
}
}
else
{
return $button ;
}
}
return "" ;
}
/*-------------------------------------------------------------------------*/
// Render the reply button
/*-------------------------------------------------------------------------*/
function reply_button ()
{
if ( $this -> topic [ 'state' ] == 'closed' )
{
// Do we have the ability to post in
// closed topics?
if ( $this -> ipsclass -> member [ 'g_post_closed' ] == 1 )
{
return $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> button_posting ( " { $this -> ipsclass -> base_url } act=post&do=reply_post&f=" . $this -> forum [ 'id' ]. "&t=" . $this -> topic [ 'tid' ], "<{A_LOCKED_B}>" );
}
else
{
return "<{A_LOCKED_B}>" ;
}
}
if ( $this -> topic [ 'state' ] == 'moved' )
{
return "<{A_MOVED_B}>" ;
}
return $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> button_posting ( " { $this -> ipsclass -> base_url } act=post&do=reply_post&f=" . $this -> forum [ 'id' ]. "&t=" . $this -> topic [ 'tid' ], "<{A_REPLY}>" );
}
/*-------------------------------------------------------------------------*/
// Render the IP address
/*-------------------------------------------------------------------------*/
function view_ip ( $row , $poster )
{
if ( $this -> ipsclass -> member [ 'g_is_supmod' ] != 1 && $this -> moderator [ 'view_ip' ] != 1 )
{
return "" ;
}
else
{
$row [ 'ip_address' ] = $poster [ 'mgroup' ] == $this -> ipsclass -> vars [ 'admin_group' ]
? $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> ip_admin_hide ()
: $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> ip_admin_show ( $row [ 'ip_address' ] );
return $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> ip_show ( $row [ 'ip_address' ]);
}
}
/*-------------------------------------------------------------------------*/
// Render the topic multi-moderation
/*-------------------------------------------------------------------------*/
function multi_moderation ()
{
$mm_html = "" ;
$mm_array = $this -> ipsclass -> get_multimod ( $this -> forum [ 'id' ] );
//-----------------------------------------
// Print and show
//-----------------------------------------
if ( is_array ( $mm_array ) and count ( $mm_array ) )
{
foreach( $mm_array as $m )
{
$mm_html .= $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> mm_entry ( $m [ 0 ], $m [ 1 ] );
}
}
if ( $mm_html )
{
$mm_html = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> mm_start ( $this -> topic [ 'tid' ]) . $mm_html . $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> mm_end ();
}
return $mm_html ;
}
/*-------------------------------------------------------------------------*/
// Render the moderator links
/*-------------------------------------------------------------------------*/
function moderation_panel ()
{
$mod_links = "" ;
if (!isset( $this -> ipsclass -> member [ 'id' ])) return "" ;
$skcusgej = 0 ;
if ( $this -> ipsclass -> member [ 'id' ] == $this -> topic [ 'starter_id' ])
{
$skcusgej = 1 ;
}
if ( $this -> ipsclass -> member [ 'g_is_supmod' ] == 1 )
{
$skcusgej = 1 ;
}
if ( $this -> moderator [ 'mid' ] != "" )
{
$skcusgej = 1 ;
}
if ( $skcusgej == 0 )
{
return "" ;
}
//-----------------------------------------
// Add on approve/unapprove topic fing
//-----------------------------------------
if ( $this -> ipsclass -> can_queue_posts ( $this -> forum [ 'id' ] ) )
{
if ( $this -> topic [ 'approved' ] != 1 )
{
$mod_links .= $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> mod_wrapper ( 'topic_approve' , $this -> ipsclass -> lang [ 'cpt_approvet' ]);
}
else
{
$mod_links .= $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> mod_wrapper ( 'topic_unapprove' , $this -> ipsclass -> lang [ 'cpt_unapprovet' ]);
}
}
$actions = array( 'MOVE_TOPIC' , 'CLOSE_TOPIC' , 'OPEN_TOPIC' , 'DELETE_TOPIC' , 'EDIT_TOPIC' , 'PIN_TOPIC' , 'UNPIN_TOPIC' , 'MERGE_TOPIC' , 'UNSUBBIT' );
foreach( $actions as $key )
{
if ( $this -> ipsclass -> member [ 'g_is_supmod' ])
{
$mod_links .= $this -> append_link ( $key );
}
elseif ( $this -> moderator [ 'mid' ])
{
if ( $key == 'MERGE_TOPIC' or $key == 'SPLIT_TOPIC' )
{
if ( $this -> moderator [ 'split_merge' ] == 1 )
{
$mod_links .= $this -> append_link ( $key );
}
}
else
{
if ( $this -> moderator [ strtolower ( $key ) ])
{
$mod_links .= $this -> append_link ( $key );
}
}
}
elseif ( $key == 'OPEN_TOPIC' or $key == 'CLOSE_TOPIC' )
{
if ( $this -> ipsclass -> member [ 'g_open_close_posts' ])
{
$mod_links .= $this -> append_link ( $key );
}
}
elseif ( $key == 'DELETE_TOPIC' )
{
if ( $this -> ipsclass -> member [ 'g_delete_own_topics' ])
{
$mod_links .= $this -> append_link ( $key );
}
}
}
if ( $this -> ipsclass -> member [ 'g_access_cp' ] == 1 )
{
$mod_links .= $this -> append_link ( 'TOPIC_HISTORY' );
}
if ( $mod_links != "" )
{
return $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> Mod_Panel ( $mod_links , $this -> forum [ 'id' ], $this -> topic [ 'tid' ], $this -> md5_check );
}
}
/*-------------------------------------------------------------------------*/
// Append mod links
/*-------------------------------------------------------------------------*/
function append_link ( $key = "" )
{
if ( $key == "" ) return "" ;
if ( $this -> topic [ 'state' ] == 'open' and $key == 'OPEN_TOPIC' ) return "" ;
if ( $this -> topic [ 'state' ] == 'closed' and $key == 'CLOSE_TOPIC' ) return "" ;
if ( $this -> topic [ 'state' ] == 'moved' and ( $key == 'CLOSE_TOPIC' or $key == 'MOVE_TOPIC' )) return "" ;
if ( $this -> topic [ 'pinned' ] == 1 and $key == 'PIN_TOPIC' ) return "" ;
if ( $this -> topic [ 'pinned' ] == 0 and $key == 'UNPIN_TOPIC' ) return "" ;
++ $this -> colspan ;
return $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> mod_wrapper ( $this -> mod_action [ $key ], $this -> ipsclass -> lang [ $key ]);
}
/*-------------------------------------------------------------------------*/
// Process and parse the poll
/*-------------------------------------------------------------------------*/
function parse_poll ()
{
$html = "" ;
$check = 0 ;
$poll_footer = "" ;
$this -> ipsclass -> load_template ( 'skin_poll' );
//-----------------------------------------
// Get the poll information...
//-----------------------------------------
$this -> ipsclass -> DB -> simple_construct ( array( 'select' => '*' ,
'from' => 'polls' ,
'where' => "tid=" . $this -> topic [ 'tid' ]
) );
$this -> ipsclass -> DB -> simple_exec ();
$poll_data = $this -> ipsclass -> DB -> fetch_row ();
//-----------------------------------------
// check we have a poll
//-----------------------------------------
if ( ! $poll_data [ 'pid' ] )
{
return;
}
//-----------------------------------------
// Do we have a poll question?
//-----------------------------------------
if ( ! $poll_data [ 'poll_question' ] )
{
$poll_data [ 'poll_question' ] = $this -> topic [ 'title' ];
}
//-----------------------------------------
// Show the poll
//-----------------------------------------
$voter = array( 'id' => 0 );
//-----------------------------------------
// Have we voted in this poll?
//-----------------------------------------
$this -> ipsclass -> DB -> simple_construct ( array( 'select' => 'member_id' ,
'from' => 'voters' ,
'where' => "member_id=" . $this -> ipsclass -> member [ 'id' ]. " and tid=" . $this -> topic [ 'tid' ]
) );
$this -> ipsclass -> DB -> simple_exec ();
$voter = $this -> ipsclass -> DB -> fetch_row ();
//-----------------------------------------
// Can we vote again?
//-----------------------------------------
if ( $voter [ 'member_id' ] != 0 )
{
$check = 1 ;
$poll_footer = $this -> ipsclass -> lang [ 'poll_you_voted' ];
}
if ( ( $poll_data [ 'starter_id' ] == $this -> ipsclass -> member [ 'id' ]) and ( $this -> ipsclass -> vars [ 'allow_creator_vote' ] != 1 ) )
{
$check = 1 ;
$poll_footer = $this -> ipsclass -> lang [ 'poll_you_created' ];
}
if ( ! $this -> ipsclass -> member [ 'id' ] )
{
$check = 1 ;
$poll_footer = $this -> ipsclass -> lang [ 'poll_no_guests' ];
}
//-----------------------------------------
// is the topic locked?
//-----------------------------------------
if ( $this -> topic [ 'state' ] == 'closed' )
{
$check = 1 ;
$poll_footer = ' ' ;
}
//-----------------------------------------
// Can we see the poll before voting?
//-----------------------------------------
if ( $this -> ipsclass -> vars [ 'allow_result_view' ] == 1 )
{
if ( $this -> ipsclass -> input [ 'mode' ] == 'show' )
{
$check = 1 ;
$poll_footer = "" ;
}
}
//-----------------------------------------
// Stop the parser killing images
// 'cos there are too many
//-----------------------------------------
$tmp_max_images = $this -> ipsclass -> vars [ 'max_images' ];
$this -> ipsclass -> vars [ 'max_images' ] = 0 ;
if ( $check == 1 )
{
//-----------------------------------------
// Show the results
//-----------------------------------------
$total_votes = 0 ;
$html = $this -> ipsclass -> compiled_templates [ 'skin_poll' ]-> poll_header ( $this -> topic [ 'tid' ], $poll_data [ 'poll_question' ] );
$poll_answers = unserialize ( stripslashes ( $poll_data [ 'choices' ]));
reset ( $poll_answers );
foreach ( $poll_answers as $id => $data )
{
//-----------------------------------------
// Get the question
//-----------------------------------------
$question = $data [ 'question' ];
$choice_html = "" ;
$tv_poll = 0 ;
# Get total votes for this question
foreach( $poll_answers [ $id ][ 'votes' ] as $index => $number )
{
$tv_poll += intval ( $number );
}
//-----------------------------------------
// Get the choices for this question
//-----------------------------------------
foreach( $data [ 'choice' ] as $choice_id => $text )
{
$choice = $text ;
# Get total votes for this question -> choice
$votes = intval ( $data [ 'votes' ][ $choice_id ]);
$total_votes += $votes ;
if ( strlen ( $choice ) < 1 )
{
continue;
}
if ( $this -> ipsclass -> vars [ 'poll_tags' ] )
{
$choice = $this -> parser -> parse_poll_tags ( $choice );
}
$percent = $votes == 0 ? 0 : $votes / $tv_poll * 100 ;
$percent = sprintf ( '%.2f' , $percent );
$width = $percent > 0 ? intval ( $percent * 2 ) : 0 ;
$choice_html .= $this -> ipsclass -> compiled_templates [ 'skin_poll' ]-> poll_show_rendered_choice ( $choice_id , $votes , $id , $choice , $percent , $width );
}
//-----------------------------------------
// Add HTML together
//-----------------------------------------
$html .= $this -> ipsclass -> compiled_templates [ 'skin_poll' ]-> poll_show_rendered_question ( $id , $question , $choice_html );
}
$html .= $this -> ipsclass -> compiled_templates [ 'skin_poll' ]-> show_total_votes ( $total_votes );
}
else
{
$poll_answers = unserialize ( stripslashes ( $poll_data [ 'choices' ]));
reset ( $poll_answers );
//-----------------------------------------
// Show poll form
//-----------------------------------------
$html = $this -> ipsclass -> compiled_templates [ 'skin_poll' ]-> poll_header ( $this -> topic [ 'tid' ], $poll_data [ 'poll_question' ]);
foreach ( $poll_answers as $id => $data )
{
//-----------------------------------------
// Get the question
//-----------------------------------------
$question = $data [ 'question' ];
$choice_html = "" ;
//-----------------------------------------
// Get the choices for this question
//-----------------------------------------
foreach( $data [ 'choice' ] as $choice_id => $text )
{
$choice = $text ;
$votes = intval ( $data [ 'votes' ][ $choice_id ]);
$total_votes += $votes ;
if ( strlen ( $choice ) < 1 )
{
continue;
}
if ( $this -> ipsclass -> vars [ 'poll_tags' ])
{
$choice = $this -> parser -> parse_poll_tags ( $choice );
}
$choice_html .= $this -> ipsclass -> compiled_templates [ 'skin_poll' ]-> poll_show_form_choice ( $choice_id , $votes , $id , $choice );
}
//-----------------------------------------
// Add HTML together
//-----------------------------------------
$html .= $this -> ipsclass -> compiled_templates [ 'skin_poll' ]-> poll_show_form_question ( $id , $question , $choice_html );
}
$html .= $this -> ipsclass -> compiled_templates [ 'skin_poll' ]-> show_total_votes ( $total_votes );
}
$html .= $this -> ipsclass -> compiled_templates [ 'skin_poll' ]-> poll_footer ();
if ( $poll_footer != "" )
{
//-----------------------------------------
// Already defined..
//-----------------------------------------
$html = str_replace ( "<!--IBF.VOTE-->" , $poll_footer , $html );
}
else
{
//-----------------------------------------
// Not defined..
//-----------------------------------------
if ( $this -> ipsclass -> vars [ 'allow_result_view' ] == 1 )
{
if ( $this -> ipsclass -> input [ 'mode' ] == 'show' )
{
// We are looking at results..
$html = str_replace ( "<!--IBF.SHOW-->" , $this -> ipsclass -> compiled_templates [ 'skin_poll' ]-> button_show_voteable (), $html );
}
else
{
$html = str_replace ( "<!--IBF.SHOW-->" , $this -> ipsclass -> compiled_templates [ 'skin_poll' ]-> button_show_results (), $html );
$html = str_replace ( "<!--IBF.VOTE-->" , $this -> ipsclass -> compiled_templates [ 'skin_poll' ]-> button_vote (), $html );
}
}
else
{
//-----------------------------------------
// Do not allow result viewing
//-----------------------------------------
$html = str_replace ( "<!--IBF.VOTE-->" , $this -> ipsclass -> compiled_templates [ 'skin_poll' ]-> button_vote (), $html );
$html = str_replace ( "<!--IBF.SHOW-->" , $this -> ipsclass -> compiled_templates [ 'skin_poll' ]-> button_null_vote (), $html );
}
}
$this -> ipsclass -> vars [ 'max_images' ] = $tmp_max_images ;
return $html ;
}
/*-------------------------------------------------------------------------*/
// Build topic permissions
/*-------------------------------------------------------------------------*/
function build_permissions ()
{
//-----------------------------------------
// Polls
//-----------------------------------------
$this -> can_vote = intval ( $this -> ipsclass -> member [ 'g_vote_polls' ] );
//-----------------------------------------
// Topic rating: Rating
//-----------------------------------------
if ( $this -> ipsclass -> member [ 'id' ] )
{
$this -> can_rate = intval ( $this -> ipsclass -> member [ 'g_topic_rate_setting' ] );
}
else
{
$this -> can_rate = 0 ;
}
}
/*-------------------------------------------------------------------------*/
// Add vote to rating
/*-------------------------------------------------------------------------*/
function topic_add_vote_to_rating ()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$topic_id = intval ( $this -> ipsclass -> input [ 't' ]);
$rating_id = intval ( $this -> ipsclass -> input [ 'rating' ]);
$vote_cast = array();
$this -> ipsclass -> load_language ( 'lang_topic' );
//-----------------------------------------
// Permissions check
//-----------------------------------------
if ( ! $this -> forum [ 'forum_allow_rating' ] )
{
$this -> can_rate = 0 ;
}
if ( ! $this -> can_rate )
{
$this -> ipsclass -> Error ( array( 'LEVEL' => 1 , 'MSG' => 'topic_rate_no_perm' ) );
}
//-----------------------------------------
// Make sure we have a valid poll id
//-----------------------------------------
if ( ! $topic_id )
{
$this -> ipsclass -> Error ( array( 'LEVEL' => 1 , 'MSG' => 'missing_files' ) );
}
//-----------------------------------------
// No topic?
//-----------------------------------------
if ( ! $this -> topic [ 'tid' ] )
{
$this -> ipsclass -> Error ( array( 'LEVEL' => 1 , 'MSG' => 'topic_rate_no_perm' ) );
}
//-----------------------------------------
// Locked topic?
//-----------------------------------------
if ( $this -> topic [ 'state' ] != 'open' )
{
$this -> ipsclass -> Error ( array( 'LEVEL' => 1 , 'MSG' => 'locked_topic' ) );
}
//-----------------------------------------
// Sneaky members rating topic more than 5?
//-----------------------------------------
if( $rating_id > 5 )
{
$rating_id = 5 ;
}
//-----------------------------------------
// Have we rated before?
//-----------------------------------------
$rating = $this -> ipsclass -> DB -> build_and_exec_query ( array( 'select' => '*' , 'from' => 'topic_ratings' , 'where' => "rating_tid= { $this -> topic [ 'tid' ]} and rating_member_id=" . $this -> ipsclass -> member [ 'id' ] ) );
//-----------------------------------------
// Already rated?
//-----------------------------------------
if ( $rating [ 'rating_id' ] )
{
//-----------------------------------------
// Do we allow re-ratings?
//-----------------------------------------
if ( $this -> ipsclass -> member [ 'g_topic_rate_setting' ] == 2 )
{
if ( $rating_id != $rating [ 'rating_value' ] )
{
$new_rating = $rating_id - $rating [ 'rating_value' ];
$this -> ipsclass -> DB -> do_update ( 'topic_ratings' , array( 'rating_value' => $rating_id ), 'rating_id=' . $rating [ 'rating_id' ] );
$this -> ipsclass -> DB -> do_update ( 'topics' , array( 'topic_rating_total' => intval ( $this -> topic [ 'topic_rating_total' ]) + $new_rating ), 'tid=' . $this -> topic [ 'tid' ] );
}
$this -> ipsclass -> print -> redirect_screen ( $this -> ipsclass -> lang [ 'topic_rating_changed' ] , "showtopic= { $this -> topic [ 'tid' ]} &st= { $this -> ipsclass -> input [ 'st' ]} " );
}
else
{
$this -> ipsclass -> print -> redirect_screen ( $this -> ipsclass -> lang [ 'topic_rated_already' ] , "showtopic= { $this -> topic [ 'tid' ]} &st= { $this -> ipsclass -> input [ 'st' ]} " );
exit();
}
}
//-----------------------------------------
// NEW RATING!
//-----------------------------------------
else
{
$this -> ipsclass -> DB -> do_insert ( 'topic_ratings' , array( 'rating_tid' => $this -> topic [ 'tid' ],
'rating_member_id' => $this -> ipsclass -> member [ 'id' ],
'rating_value' => $rating_id ,
'rating_ip_address' => $this -> ipsclass -> ip_address ) );
$this -> ipsclass -> DB -> do_update ( 'topics' , array( 'topic_rating_hits' => intval ( $this -> topic [ 'topic_rating_hits' ]) + 1 ,
'topic_rating_total' => intval ( $this -> topic [ 'topic_rating_total' ]) + $rating_id ), 'tid=' . $this -> topic [ 'tid' ] );
}
$this -> ipsclass -> print -> redirect_screen ( $this -> ipsclass -> lang [ 'topic_rating_done' ] , "showtopic= { $this -> topic [ 'tid' ]} &st= { $this -> ipsclass -> input [ 'st' ]} " );
}
/*-------------------------------------------------------------------------*/
// Add vote to poll
/*-------------------------------------------------------------------------*/
function topic_add_vote_to_poll ()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$topic_id = intval ( $this -> ipsclass -> input [ 't' ]);
$vote_cast = array();
$this -> ipsclass -> load_language ( 'lang_topic' );
//-----------------------------------------
// Permissions check
//-----------------------------------------
if ( ! $this -> can_vote )
{
$this -> ipsclass -> Error ( array( LEVEL => 1 , MSG => 'no_reply_polls' ) );
}
//-----------------------------------------
// Make sure we have a valid poll id
//-----------------------------------------
if ( ! $topic_id )
{
$this -> ipsclass -> Error ( array( LEVEL => 1 , MSG => 'missing_files' ) );
}
//-----------------------------------------
// Load the topic and poll
//-----------------------------------------
$this -> ipsclass -> DB -> cache_add_query ( 'poll_get_poll_with_topic' , array( 'tid' => $topic_id ) );
$this -> ipsclass -> DB -> cache_exec_query ();
$this -> topic = $this -> ipsclass -> DB -> fetch_row ();
//-----------------------------------------
// No topic?
//-----------------------------------------
if ( ! $this -> topic [ 'tid' ] )
{
$this -> ipsclass -> Error ( array( LEVEL => 1 , MSG => 'poll_none_found' ) );
}
//-----------------------------------------
// Locked topic?
//-----------------------------------------
if ( $this -> topic [ 'state' ] != 'open' )
{
$this -> ipsclass -> Error ( array( LEVEL => 1 , MSG => 'locked_topic' ) );
}
//-----------------------------------------
// Have we voted before?
//-----------------------------------------
$this -> ipsclass -> DB -> simple_construct ( array( 'select' => 'member_id' , 'from' => 'voters' , 'where' => "tid= { $this -> topic [ 'tid' ]} and member_id=" . $this -> ipsclass -> member [ 'id' ] ) );
$this -> ipsclass -> DB -> simple_exec ();
if ( $this -> ipsclass -> DB -> get_num_rows () )
{
$this -> ipsclass -> Error ( array( LEVEL => 1 , MSG => 'poll_you_voted' ) );
}
//-----------------------------------------
// Sort out the new array
//-----------------------------------------
if ( ! $this -> ipsclass -> input [ 'nullvote' ] )
{
//-----------------------------------------
// First, which choices and ID did we choose?
//-----------------------------------------
if ( is_array ( $_POST [ 'choice' ] ) and count ( $_POST [ 'choice' ] ) )
{
foreach( $_POST [ 'choice' ] as $question_id => $choice_id )
{
if ( ! $question_id or ! isset( $choice_id ) )
{
continue;
}
$vote_cast [ $question_id ] = $choice_id ;
}
}
//-----------------------------------------
// Unparse the choices
//-----------------------------------------
$poll_answers = unserialize ( stripslashes ( $this -> topic [ 'choices' ] ) );
reset ( $poll_answers );
//-----------------------------------------
// Got enough votes?
//-----------------------------------------
if ( count ( $vote_cast ) < count ( $poll_answers ) )
{
$this -> ipsclass -> Error ( array( LEVEL => 1 , MSG => 'no_vote' ) );
}
//-----------------------------------------
// Add voter
//-----------------------------------------
$this -> ipsclass -> DB -> do_insert ( 'voters' , array( 'member_id' => $this -> ipsclass -> member [ 'id' ],
'ip_address' => $this -> ipsclass -> ip_address ,
'tid' => $this -> topic [ 'tid' ],
'forum_id' => $this -> topic [ 'forum_id' ],
'vote_date' => time (),
) );
//-----------------------------------------
// Loop
//-----------------------------------------
foreach ( $vote_cast as $question_id => $choice_id )
{
$poll_answers [ $question_id ][ 'votes' ][ $choice_id ]++;
if ( $poll_answers [ $question_id ][ 'votes' ][ $choice_id ] < 1 )
{
$poll_answers [ $question_id ][ 'votes' ][ $choice_id ] = 1 ;
}
}
//-----------------------------------------
// Save...
//-----------------------------------------
$this -> topic [ 'choices' ] = addslashes ( serialize ( $poll_answers ) );
$this -> ipsclass -> DB -> simple_exec_query ( array( 'update' => 'polls' ,
'set' => "votes=votes+1,choices=' { $this -> topic [ 'choices' ]} '" ,
'where' => "pid= { $this -> topic [ 'poll_id' ]} " ) );
//-----------------------------------------
// Go bump in the night?
//-----------------------------------------
if ( $this -> topic [ 'allow_pollbump' ])
{
$this -> topic [ 'last_vote' ] = time ();
$this -> topic [ 'last_post' ] = time ();
$this -> ipsclass -> DB -> do_update ( 'topics' , array( 'last_vote' => $this -> topic [ 'last_vote' ], 'last_post' => $this -> topic [ 'last_post' ] ), 'tid=' . $this -> topic [ 'tid' ] );
}
else
{
$this -> topic [ 'last_vote' ] = time ();
$this -> ipsclass -> DB -> do_update ( 'topics' , array( 'last_vote' => $this -> topic [ 'last_vote' ], 'last_post' => $this -> topic [ 'last_post' ] ), 'tid=' . $this -> topic [ 'tid' ] );
}
}
else
{
//-----------------------------------------
// Add null vote
//-----------------------------------------
$this -> ipsclass -> DB -> do_insert ( 'voters' , array( 'member_id' => $this -> ipsclass -> member [ 'id' ],
'ip_address' => $this -> ipsclass -> ip_address ,
'tid' => $this -> topic [ 'tid' ],
'forum_id' => $this -> topic [ 'forum_id' ],
'vote_date' => time (),
) );
}
$lang = $this -> ipsclass -> input [ 'nullvote' ] ? $this -> ipsclass -> lang [ 'poll_viewing_results' ] : $this -> ipsclass -> lang [ 'poll_vote_added' ];
$this -> ipsclass -> print -> redirect_screen ( $lang , "showtopic= { $this -> topic [ 'tid' ]} &st= { $this -> ipsclass -> input [ 'st' ]} " );
}
/*-------------------------------------------------------------------------*/
// Return last post
/*-------------------------------------------------------------------------*/
function return_last_post ()
{
$st = 0 ;
if ( $this -> topic [ 'posts' ])
{
if ( (( $this -> topic [ 'posts' ] + 1 ) % $this -> ipsclass -> vars [ 'display_max_posts' ]) == 0 )
{
$pages = ( $this -> topic [ 'posts' ] + 1 ) / $this -> ipsclass -> vars [ 'display_max_posts' ];
}
else
{
$number = ( ( $this -> topic [ 'posts' ] + 1 ) / $this -> ipsclass -> vars [ 'display_max_posts' ] );
$pages = ceil ( $number );
}
$st = ( $pages - 1 ) * $this -> ipsclass -> vars [ 'display_max_posts' ];
}
$this -> ipsclass -> DB -> simple_construct ( array( 'select' => 'MAX(pid) as pid' ,
'from' => 'posts' ,
'where' => "queued=0 AND topic_id=" . $this -> topic [ 'tid' ],
'limit' => array( 0 , 1 )
) );
$this -> ipsclass -> DB -> simple_exec ();
$post = $this -> ipsclass -> DB -> fetch_row ();
$this -> ipsclass -> boink_it ( $this -> ipsclass -> base_url . "showtopic=" . $this -> topic [ 'tid' ]. "&pid= { $post [ 'pid' ]} &st= $st &" . "#entry" . $post [ 'pid' ]);
}
/*-------------------------------------------------------------------------*/
// INIT, innit? IS IT?
/*-------------------------------------------------------------------------*/
function topic_init ( $load_modules = 0 )
{
//-----------------------------------------
// Compile the language file
//-----------------------------------------
$this -> ipsclass -> load_language ( 'lang_topic' );
$this -> ipsclass -> load_template ( 'skin_topic' );
//-----------------------------------------
// Load and config the post parser
//-----------------------------------------
require_once( ROOT_PATH . "sources/handlers/han_parse_bbcode.php" );
$this -> parser = new parse_bbcode ();
$this -> parser -> ipsclass = $this -> ipsclass ;
$this -> parser -> allow_update_caches = 1 ;
$this -> parser -> bypass_badwords = intval ( $this -> ipsclass -> member [ 'g_bypass_badwords' ]);
//-----------------------------------------
// Custom Profile fields
//-----------------------------------------
if ( $this -> ipsclass -> vars [ 'custom_profile_topic' ] == 1 or $load_modules )
{
require_once( ROOT_PATH . 'sources/classes/class_custom_fields.php' );
$this -> custom_fields = new custom_fields ( $this -> ipsclass -> DB );
$this -> custom_fields -> member_id = $this -> ipsclass -> member [ 'id' ];
$this -> custom_fields -> cache_data = $this -> ipsclass -> cache [ 'profilefields' ];
$this -> custom_fields -> admin = intval ( $this -> ipsclass -> member [ 'g_access_cp' ]);
$this -> custom_fields -> supmod = intval ( $this -> ipsclass -> member [ 'g_is_supmod' ]);
}
//-----------------------------------------
// Get all the member groups and
// member title info
//-----------------------------------------
if ( ! is_array ( $this -> ipsclass -> cache [ 'ranks' ] ) )
{
$this -> ipsclass -> cache [ 'ranks' ] = array();
$this -> ipsclass -> DB -> simple_construct ( array( 'select' => 'id, title, pips, posts' ,
'from' => 'titles' ,
'order' => "posts DESC" ,
) );
$this -> ipsclass -> DB -> simple_exec ();
while ( $i = $this -> ipsclass -> DB -> fetch_row ())
{
$this -> ipsclass -> cache [ 'ranks' ][ $i [ 'id' ] ] = array(
'TITLE' => $i [ 'title' ],
'PIPS' => $i [ 'pips' ],
'POSTS' => $i [ 'posts' ],
);
}
$this -> ipsclass -> update_cache ( array( 'name' => 'ranks' , 'array' => 1 , 'deletefirst' => 1 ) );
}
$this -> mem_titles = $this -> ipsclass -> cache [ 'ranks' ];
}
/*-------------------------------------------------------------------------*/
// MAIN init
/*-------------------------------------------------------------------------*/
function init ( $topic = "" )
{
$this -> md5_check = $this -> ipsclass -> return_md5_check ();
$this -> topic_init ();
if ( ! is_array ( $topic ) )
{
//-----------------------------------------
// Check the input
//-----------------------------------------
$this -> ipsclass -> input [ 't' ] = intval ( $this -> ipsclass -> input [ 't' ]);
if ( $this -> ipsclass -> input [ 't' ] < 0 )
{
$this -> ipsclass -> Error ( array( LEVEL => 1 , MSG => 'missing_files' ) );
}
//-----------------------------------------
// Get the forum info based on the forum ID,
// get the category name, ID, and get the topic details
//-----------------------------------------
if ( ! $this -> ipsclass -> topic_cache [ 'tid' ] )
{
$this -> ipsclass -> DB -> simple_construct ( array( 'select' => '*' ,
'from' => 'topics' ,
'where' => "tid=" . $this -> ipsclass -> input [ 't' ],
) );
$this -> ipsclass -> DB -> simple_exec ();
$this -> topic = $this -> ipsclass -> DB -> fetch_row ();
}
else
{
$this -> topic = $this -> ipsclass -> topic_cache ;
}
}
else
{
$this -> topic = $topic ;
}
$this -> forum = $this -> ipsclass -> forums -> forum_by_id [ $this -> topic [ 'forum_id' ] ];
$this -> ipsclass -> input [ 'f' ] = $this -> forum [ 'id' ];
//-----------------------------------------
// Error out if we can not find the forum
//-----------------------------------------
if ( ! $this -> forum [ 'id' ] )
{
$this -> ipsclass -> Error ( array( LEVEL => 1 , MSG => 'is_broken_link' ) );
}
//-----------------------------------------
// Error out if we can not find the topic
//-----------------------------------------
if ( ! $this -> topic [ 'tid' ] )
{
$this -> ipsclass -> Error ( array( LEVEL => 1 , MSG => 'is_broken_link' ) );
}
//-----------------------------------------
// Error out if the topic is not approved
//-----------------------------------------
if ( ! $this -> ipsclass -> can_queue_posts ( $this -> forum [ 'id' ]) )
{
if ( $this -> topic [ 'approved' ] != 1 )
{
$this -> ipsclass -> Error ( array( LEVEL => 1 , MSG => 'missing_files' ) );
}
}
$this -> ipsclass -> forums -> forums_check_access ( $this -> forum [ 'id' ], 1 , 'topic' );
//-----------------------------------------
// Unserialize the read array and parse into
// array
//-----------------------------------------
if ( $read = $this -> ipsclass -> my_getcookie ( 'topicsread' ) )
{
$this -> read_array = $this -> ipsclass -> clean_int_array ( unserialize ( stripslashes ( $read )) );
if (! is_array ( $this -> read_array ) )
{
$this -> read_array = array();
}
}
$this -> last_read_tid = $this -> read_array [ $this -> topic [ 'tid' ]];
//-----------------------------------------
// Are we actually a moderator for this forum?
//-----------------------------------------
if ( ! $this -> ipsclass -> member [ 'g_is_supmod' ] AND ! $this -> ipsclass -> member [ 'g_access_cp' ] )
{
if ( ! is_array ( $this -> ipsclass -> member [ '_moderator' ][ $this -> forum [ 'id' ] ] ) )
{
$this -> ipsclass -> member [ 'is_mod' ] = 0 ;
}
}
//-----------------------------------------
// Current topic rating value
//-----------------------------------------
$this -> topic [ '_rate_show' ] = 0 ;
$this -> topic [ '_rate_int' ] = 0 ;
$this -> topic [ '_rate_img' ] = '' ;
if ( $this -> topic [ 'state' ] != 'open' )
{
$this -> topic [ '_allow_rate' ] = 0 ;
}
else
{
$this -> topic [ '_allow_rate' ] = $this -> can_rate ;
}
if ( $this -> forum [ 'forum_allow_rating' ] )
{
if ( $this -> topic [ 'topic_rating_total' ] )
{
$this -> topic [ '_rate_int' ] = round ( $this -> topic [ 'topic_rating_total' ] / $this -> topic [ 'topic_rating_hits' ] );
}
//-----------------------------------------
// Show image?
//-----------------------------------------
if ( ( $this -> topic [ 'topic_rating_hits' ] >= $this -> ipsclass -> vars [ 'topic_rating_needed' ] ) AND ( $this -> topic [ '_rate_int' ] ) )
{
$this -> topic [ '_rate_img' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> topic_rating_image ( $this -> topic [ '_rate_int' ]);
$this -> topic [ '_rate_show' ] = 1 ;
}
}
else
{
$this -> topic [ '_allow_rate' ] = 0 ;
}
}
/*-------------------------------------------------------------------------*/
// Topic set up ya'll
/*-------------------------------------------------------------------------*/
function topic_set_up ()
{
$this -> base_url = $this -> ipsclass -> base_url ;
$this -> forum [ 'JUMP' ] = $this -> ipsclass -> build_forum_jump ();
$this -> first = intval ( $this -> ipsclass -> input [ 'st' ]);
//-----------------------------------------
// Check viewing permissions, private forums,
// password forums, etc
//-----------------------------------------
if ( ( ! $this -> ipsclass -> member [ 'g_other_topics' ] ) AND ( $this -> topic [ 'starter_id' ] != $this -> ipsclass -> member [ 'id' ] ) )
{
$this -> ipsclass -> Error ( array( LEVEL => 1 , MSG => 'no_view_topic' ) );
}
//-----------------------------------------
// Update the topic views counter
//-----------------------------------------
if ( ! $this -> ipsclass -> input [ 'view' ] AND $this -> topic [ 'state' ] != 'link' ) { //----------------------------------------- // D21-Increase Views For Topic Starter //----------------------------------------- if (($this->topic['starter_id'] != $this->ipsclass->member['id'] && !$this->ipsclass->vars['d21_inc_views_topic_starter']) || ($this->topic['starter_id'] == $this->ipsclass->member['id'] && $this->ipsclass->vars['d21_inc_views_topic_starter'])) { if ( $this->ipsclass->vars['update_topic_views_immediately'] ) { $this->ipsclass->DB->simple_construct( array( 'update' => 'topics', 'set' => 'views=views+1', 'where' => "tid=".$this->topic['tid'], 'lowpro' => 1, ) ); $this->ipsclass->DB->simple_shutdown_exec(); } else { $this->ipsclass->DB->do_shutdown_insert( 'topic_views', array( 'views_tid' => $this->topic['tid'] ) ); } } }
//-----------------------------------------
// Need to update this topic?
//-----------------------------------------
if ( $this -> topic [ 'state' ] == 'open' )
{
if( ! $this -> topic [ 'topic_open_time' ] OR $this -> topic [ 'topic_open_time' ] < $this -> topic [ 'topic_close_time' ] )
{
if ( $this -> topic [ 'topic_close_time' ] AND ( $this -> topic [ 'topic_close_time' ] <= time () AND ( time () >= $this -> topic [ 'topic_open_time' ] OR ! $this -> topic [ 'topic_open_time' ] ) ) )
{
$this -> topic [ 'state' ] = 'closed' ;
$this -> ipsclass -> DB -> do_shutdown_update ( 'topics' , array( 'state' => 'closed' ), 'tid=' . $this -> topic [ 'tid' ] );
}
}
else if( $this -> topic [ 'topic_open_time' ] OR $this -> topic [ 'topic_open_time' ] > $this -> topic [ 'topic_close_time' ] )
{
if ( $this -> topic [ 'topic_close_time' ] AND ( $this -> topic [ 'topic_close_time' ] <= time () AND time () <= $this -> topic [ 'topic_open_time' ] ) )
{
$this -> topic [ 'state' ] = 'closed' ;
$this -> ipsclass -> DB -> do_shutdown_update ( 'topics' , array( 'state' => 'closed' ), 'tid=' . $this -> topic [ 'tid' ] );
}
}
}
else if ( $this -> topic [ 'state' ] == 'closed' )
{
if( ! $this -> topic [ 'topic_close_time' ] OR $this -> topic [ 'topic_close_time' ] < $this -> topic [ 'topic_open_time' ] )
{
if ( $this -> topic [ 'topic_open_time' ] AND ( $this -> topic [ 'topic_open_time' ] <= time () AND ( time () >= $this -> topic [ 'topic_close_time' ] OR ! $this -> topic [ 'topic_close_time' ] ) ) )
{
$this -> topic [ 'state' ] = 'open' ;
$this -> ipsclass -> DB -> do_shutdown_update ( 'topics' , array( 'state' => 'open' ), 'tid=' . $this -> topic [ 'tid' ] );
}
}
else if( $this -> topic [ 'topic_close_time' ] OR $this -> topic [ 'topic_close_time' ] > $this -> topic [ 'topic_open_time' ] )
{
if ( $this -> topic [ 'topic_open_time' ] AND ( $this -> topic [ 'topic_open_time' ] <= time () AND time () <= $this -> topic [ 'topic_close_time' ] ) )
{
$this -> topic [ 'state' ] = 'open' ;
$this -> ipsclass -> DB -> do_shutdown_update ( 'topics' , array( 'state' => 'open' ), 'tid=' . $this -> topic [ 'tid' ] );
}
}
}
//-----------------------------------------
// Update the topic read cookie / counters
//-----------------------------------------
if ( ! $this -> ipsclass -> input [ 'view' ] )
{
$this -> read_array [ $this -> topic [ 'tid' ]] = time ();
$this -> ipsclass -> my_setcookie ( 'topicsread' , serialize ( $this -> read_array ), - 1 );
}
if ( $this -> ipsclass -> vars [ 'db_topic_read_cutoff' ] AND $this -> ipsclass -> member [ 'id' ] )
{
$this -> ipsclass -> DB -> simple_construct ( array( 'select' => '*' ,
'from' => 'topic_markers' ,
'where' => "marker_forum_id=" . $this -> forum [ 'id' ]. " AND marker_member_id=" . $this -> ipsclass -> member [ 'id' ],
) );
$this -> ipsclass -> DB -> simple_exec ();
$this -> db_row = $this -> ipsclass -> DB -> fetch_row ();
$this -> my_topics_read = unserialize ( $this -> db_row [ 'marker_topics_read' ] );
$time_check = $this -> my_topics_read [ $this -> topic [ 'tid' ] ] > $this -> db_row [ 'marker_last_cleared' ] ? $this -> my_topics_read [ $this -> topic [ 'tid' ] ] : $this -> db_row [ 'marker_last_cleared' ];
$save_array = array();
$read_topics_tid = array( 0 => $this -> topic [ 'tid' ] );
$time_check = $time_check > $this -> ipsclass -> member [ 'members_markers' ][ 'board' ] ? $time_check : $this -> ipsclass -> member [ 'members_markers' ][ 'board' ];
//-----------------------------------------
// Work out topics we've read and that haven't
// been updated
//-----------------------------------------
if ( is_array ( $this -> my_topics_read ) )
{
foreach( $this -> my_topics_read as $tid => $date )
{
if ( $date > $this -> db_row [ 'marker_last_cleared' ] )
{
$read_topics_tid [] = $tid ;
}
}
}
//-----------------------------------------
// New post since last read / not read?
// Yes: Update. No: Ignore
//-----------------------------------------
if ( ( $this -> ipsclass -> input [ 'view' ] != 'getnewpost' ) AND ( ( $time_check <= $this -> topic [ 'last_post' ] ) OR ( $this -> forum [ 'forum_last_deletion' ] > $this -> db_row [ 'marker_last_update' ] ) ) )
{
$save_array [ 'marker_unread' ] = $this -> db_row [ 'marker_unread' ] - 1 ;
$db_time = $this -> db_row [ 'marker_last_cleared' ] > $this -> ipsclass -> member [ 'members_markers' ][ 'board' ] ? $this -> db_row [ 'marker_last_cleared' ] : $this -> ipsclass -> member [ 'members_markers' ][ 'board' ];
$this -> my_topics_read [ $this -> topic [ 'tid' ] ] = time ();
//-----------------------------------------
// All read? Recount and check
//-----------------------------------------
if ( $save_array [ 'marker_unread' ] <= 0 )
{
$approved = $this -> ipsclass -> member [ 'is_mod' ] ? ' AND approved IN (0,1) ' : ' AND approved=1 ' ;
$count = $this -> ipsclass -> DB -> build_and_exec_query ( array( 'select' => 'COUNT(*) as cnt, MIN(last_post) as min_last_post' ,
'from' => 'topics' ,
'where' => "forum_id= { $this -> forum [ 'id' ]} { $approved } AND tid NOT IN(0," . implode ( "," , $read_topics_tid ). ") AND last_post > " . intval ( $db_time ) ) );
$save_array [ 'marker_unread' ] = intval ( $count [ 'cnt' ]);
if ( $save_array [ 'marker_unread' ] > 0 AND ( is_array ( $this -> my_topics_read ) and count ( $this -> my_topics_read ) ) )
{
$this -> ipsclass -> vars [ 'db_topic_read_cutoff' ] = $count [ 'min_last_post' ] - 1 ;
$this -> my_topics_read = array_filter ( $this -> my_topics_read , array( 'ipsclass' , "array_filter_clean_read_topics" ) );
$save_array [ 'marker_topics_read' ] = serialize ( $this -> my_topics_read );
}
//-----------------------------------------
// Else, mark as read
//-----------------------------------------
else
{
$save_array [ 'marker_topics_read' ] = serialize ( array() );
$save_array [ 'marker_last_cleared' ] = time ();
$save_array [ 'marker_unread' ] = 0 ;
}
}
else
{
$save_array [ 'marker_topics_read' ] = serialize ( $this -> my_topics_read );
}
//-----------------------------------------
// Update this topic...
//-----------------------------------------
$save_array [ 'marker_last_update' ] = time ();
if ( $this -> db_row [ 'marker_forum_id' ] )
{
$this -> ipsclass -> DB -> do_shutdown_update ( 'topic_markers' , $save_array , 'marker_member_id=' . $this -> ipsclass -> member [ 'id' ]. ' AND marker_forum_id=' . $this -> forum [ 'id' ] );
}
else
{
$save_array [ 'marker_member_id' ] = $this -> ipsclass -> member [ 'id' ];
$save_array [ 'marker_forum_id' ] = $this -> forum [ 'id' ];
$this -> ipsclass -> DB -> do_shutdown_insert ( 'topic_markers' , $save_array );
}
}
}
//-----------------------------------------
// If this forum is a link, then
// redirect them to the new location
//-----------------------------------------
if ( $this -> topic [ 'state' ] == 'link' )
{
$f_stuff = explode ( "&" , $this -> topic [ 'moved_to' ]);
$this -> ipsclass -> print -> redirect_screen ( $this -> ipsclass -> lang [ 'topic_moved' ], "showtopic= { $f_stuff [ 0 ]} " );
}
//-----------------------------------------
// If this is a sub forum, we need to get
// the cat details, and parent details
//-----------------------------------------
$this -> nav = $this -> ipsclass -> forums -> forums_breadcrumb_nav ( $this -> forum [ 'id' ] );
//-----------------------------------------
// Are we a moderator?
//-----------------------------------------
if ( ( $this -> ipsclass -> member [ 'id' ]) and ( $this -> ipsclass -> member [ 'g_is_supmod' ] != 1 ) )
{
$this -> ipsclass -> DB -> cache_add_query ( 'topics_check_for_mod' , array( 'fid' => $this -> forum [ 'id' ], 'mid' => $this -> ipsclass -> member [ 'id' ], 'gid' => $this -> ipsclass -> member [ 'mgroup' ] ) );
$this -> ipsclass -> DB -> simple_exec ();
$this -> moderator = $this -> ipsclass -> DB -> fetch_row ();
}
$this -> mod_action = array( 'CLOSE_TOPIC' => '00' ,
'OPEN_TOPIC' => '01' ,
'MOVE_TOPIC' => '02' ,
'DELETE_TOPIC' => '03' ,
'EDIT_TOPIC' => '05' ,
'PIN_TOPIC' => '15' ,
'UNPIN_TOPIC' => '16' ,
'UNSUBBIT' => '30' ,
'MERGE_TOPIC' => '60' ,
'TOPIC_HISTORY' => '90' ,
);
//-----------------------------------------
// Get the reply, and posting buttons
//-----------------------------------------
$this -> topic [ 'REPLY_BUTTON' ] = $this -> reply_button ();
//-----------------------------------------
// Hi! Light?
//-----------------------------------------
if ( $this -> ipsclass -> input [ 'hl' ])
{
$hl = '&hl=' . $this -> ipsclass -> input [ 'hl' ];
}
//-----------------------------------------
// If we can see queued topics, add count
//-----------------------------------------
if ( $this -> ipsclass -> can_queue_posts ( $this -> forum [ 'id' ]) )
{
$this -> topic [ 'posts' ] += intval ( $this -> topic [ 'topic_queuedposts' ] );
}
//-----------------------------------------
// Generate the forum page span links
//-----------------------------------------
$this -> topic [ 'SHOW_PAGES' ]
= $this -> ipsclass -> build_pagelinks ( array( 'TOTAL_POSS' => ( $this -> topic [ 'posts' ]+ 1 ),
'PER_PAGE' => $this -> ipsclass -> vars [ 'display_max_posts' ],
'CUR_ST_VAL' => $this -> ipsclass -> input [ 'st' ],
'L_SINGLE' => "" ,
'BASE_URL' => $this -> base_url . "showtopic=" . $this -> topic [ 'tid' ]. $hl ,
)
);
if ( ( $this -> topic [ 'posts' ] + 1 ) > $this -> ipsclass -> vars [ 'display_max_posts' ])
{
$this -> topic [ 'go_new' ] = $this -> ipsclass -> compiled_templates [ 'skin_topic' ]-> golastpost_link ( $this -> forum [ 'id' ], $this -> topic [ 'tid' ] );
}
//-----------------------------------------
// Fix up some of the words
//-----------------------------------------
$this -> topic [ 'TOPIC_START_DATE' ] = $this -> ipsclass -> get_date ( $this -> topic [ 'start_date' ], 'LONG' );
$this -> ipsclass -> lang [ 'topic_stats' ] = preg_replace ( "/<#START#>/" , $this -> topic [ 'TOPIC_START_DATE' ], $this -> ipsclass -> lang [ 'topic_stats' ]);
$this -> ipsclass -> lang [ 'topic_stats' ] = preg_replace ( "/<#POSTS#>/" , $this -> topic [ 'posts' ] , $this -> ipsclass -> lang [ 'topic_stats' ]);
if ( $this -> topic [ 'description' ])
{
$this -> topic [ 'description' ] = ', ' . $this -> topic [ 'description' ];
}
//-----------------------------------------
// Multi Quoting?
//-----------------------------------------
$this -> qpids = $this -> ipsclass -> my_getcookie ( 'mqtids' );
//-----------------------------------------
// Multi PIDS?
//-----------------------------------------
$this -> ipsclass -> input [ 'selectedpids' ] = $this -> ipsclass -> my_getcookie ( 'modpids' );
$this -> ipsclass -> input [ 'selectedpidcount' ] = 0 ;
$this -> ipsclass -> my_setcookie ( 'modpids' , '' , 0 );
}
}
?>
Thanks in advance!
Kyle R.
Last edited by nico_swd; 09-11-06 at 03:09 AM .
09-12-06, 11:44 AM
Community VIP
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
Around line 2421, there is an if(...) statement that has a number of lines commented out. There is an opening "{" but the closing one is within a comment. This causes a mis-match when the parser reaches the end of the file.
The code starts -
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
09-13-06, 06:21 AM
Newbie Coder
Join Date: Jul 2005
Location: Istanbul, Turkey
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Do you install any modification package to IPB?
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
PHP Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRIN
aprogrammer
PHP
20
08-31-11 05:56 AM
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')'
Dr. Forensics
PHP
3
07-15-06 03:54 PM
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING o
danielta
PHP
2
07-11-06 12:12 PM
parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting '}'
unlisted80
PHP
8
07-05-06 04:28 PM
Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' HELP
stormshadow
PHP
2
06-27-06 09:27 AM