!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: nginx/1.23.4. PHP/5.6.40-65+ubuntu20.04.1+deb.sury.org+1 

uname -a: Linux foro-restaurado-2 5.15.0-1040-oracle #46-Ubuntu SMP Fri Jul 14 21:47:21 UTC 2023
aarch64
 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/share/nginx/html/phpbb3/forumrunner/include/   drwxrwxr-x
Free 83.35 GB of 96.73 GB (86.17%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     get_thread.php (42.09 KB)      -rw-rw-r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/**
*
* @author Robert Johnston
*
* @package Forum Runner
* @version CVS/SVN: $Id: $
* @copyright (c) 2010 End of Time Studios, LLC
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

chdir(MCWD);
chdir('../');

$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH './';
$phpEx substr(strrchr(__FILE__'.'), 1);
include(
$phpbb_root_path 'common.' $phpEx);
include(
$phpbb_root_path 'includes/functions_display.' $phpEx);
include(
$phpbb_root_path 'includes/bbcode.' $phpEx);
include(
$phpbb_root_path 'includes/message_parser.' $phpEx);

fr_set_debug();

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

$user->page['root_script_path'] = str_replace('/forumrunner'''$user->page['root_script_path']);
fr_set_cookie('skip_fr_detect''false'time() + 86400);

function
do_get_thread ()
{
    global 
$user$db$auth$config$template$phpEx;

    
$usesmilies false;
    
$posts_out = array();

    
// Initial var setup
    
$forum_id    request_var('forumid'0);
    
$topic_id    request_var('threadid'0);
    
$post_id    request_var('postid'0);
    
$show_signature request_var('signature'false);

    
// We send page & num, figure out start
    
$page request_var('page'1);
    
$perpage request_var('perpage'15);
    
$config['posts_per_page'] = $perpage;
    
$view '';
    if (
$page == FR_LAST_POST) {
    
$view 'unread';
    } else {
    
$start = (($page 1) * $perpage);
    }

    
$default_sort_days    = (!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0;
    
$default_sort_key    = (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't';
    
$default_sort_dir    = (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a';

    
$sort_days    request_var('st'$default_sort_days);
    
$sort_key    request_var('sk'$default_sort_key);
    
$sort_dir    request_var('sd'$default_sort_dir);

    
$update        request_var('update'false);

    
$s_can_vote false;

    
/**
     * @todo normalize?
     */
    
$hilit_words    request_var('hilit'''true);

    
// Do we have a topic or post id?
    
if (!$topic_id && !$post_id)
    {
    
trigger_error('NO_TOPIC');
    }

    if (!
$post_id && !$forum_id)
    {
    
$sql 'SELECT forum_id
        FROM ' 
TOPICS_TABLE "
        WHERE topic_id = 
$topic_id";
    
$result $db->sql_query($sql);
    
$forum_id = (int) $db->sql_fetchfield('forum_id');
    
$db->sql_freeresult($result);

    if (!
$forum_id) {
        
// Global announcement
        
$sql 'SELECT forum_id
        FROM ' 
FORUMS_TABLE '
        WHERE forum_type = ' 
FORUM_POST;
        
$result $db->sql_query($sql);
        
$forum_id = (int) $db->sql_fetchfield('forum_id');
        
$db->sql_freeresult($result);
    }

    if (!
$forum_id) {
        
trigger_error('NO_TOPIC');
    }
    }

    if (
$view == 'unread')
    {
    
// Get topic tracking info
    
$topic_tracking_info get_complete_topic_tracking($forum_id$topic_id);

    
$topic_last_read = (isset($topic_tracking_info[$topic_id])) ? $topic_tracking_info[$topic_id] : 0;

    
$sql 'SELECT post_id, topic_id, forum_id
        FROM ' 
POSTS_TABLE "
        WHERE topic_id = 
$topic_id
        " 
. (($auth->acl_get('m_approve'$forum_id)) ? '' 'AND post_approved = 1') . "
        AND post_time > 
$topic_last_read
        AND forum_id = 
$forum_id
        ORDER BY post_time ASC"
;
    
$result $db->sql_query_limit($sql1);
    
$row $db->sql_fetchrow($result);
    
$db->sql_freeresult($result);

    if (!
$row)
    {
        
$sql 'SELECT topic_last_post_id as post_id, topic_id, forum_id
        FROM ' 
TOPICS_TABLE '
        WHERE topic_id = ' 
$topic_id;
        
$result $db->sql_query($sql);
        
$row $db->sql_fetchrow($result);
        
$db->sql_freeresult($result);
    }

    if (!
$row)
    {
        
// Setup user environment so we can process lang string
        
$user->setup('viewtopic');

        
trigger_error('NO_TOPIC');
    }

    
$post_id $row['post_id'];
    
$topic_id $row['topic_id'];
    }

    
// This rather complex gaggle of code handles querying for topics but
    // also allows for direct linking to a post (and the calculation of which
    // page the post is on and the correct display of viewtopic)
    
$sql_array = array(
    
'SELECT'    => 't.*, f.*',

    
'FROM'        => array(FORUMS_TABLE => 'f'),
    );

    
// Firebird handles two columns of the same name a little differently, this
    // addresses that by forcing the forum_id to come from the forums table.
    
if ($db->sql_layer === 'firebird')
    {
    
$sql_array['SELECT'] = 'f.forum_id AS forum_id, ' $sql_array['SELECT'];
    }

    
// The FROM-Order is quite important here, else t.* columns can not be correctly bound.
    
if ($post_id)
    {
    
$sql_array['SELECT'] .= ', p.post_approved';
    
$sql_array['FROM'][POSTS_TABLE] = 'p';
    }

    
// Topics table need to be the last in the chain
    
$sql_array['FROM'][TOPICS_TABLE] = 't';

    if (
$user->data['is_registered'])
    {
    
$sql_array['SELECT'] .= ', tw.notify_status';
    
$sql_array['LEFT_JOIN'] = array();

    
$sql_array['LEFT_JOIN'][] = array(
        
'FROM'    => array(TOPICS_WATCH_TABLE => 'tw'),
        
'ON'    => 'tw.user_id = ' $user->data['user_id'] . ' AND t.topic_id = tw.topic_id'
    
);

    if (
$config['allow_bookmarks'])
    {
        
$sql_array['SELECT'] .= ', bm.topic_id as bookmarked';
        
$sql_array['LEFT_JOIN'][] = array(
        
'FROM'    => array(BOOKMARKS_TABLE => 'bm'),
        
'ON'    => 'bm.user_id = ' $user->data['user_id'] . ' AND t.topic_id = bm.topic_id'
        
);
    }

    if (
$config['load_db_lastread'])
    {
        
$sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time as forum_mark_time';

        
$sql_array['LEFT_JOIN'][] = array(
        
'FROM'    => array(TOPICS_TRACK_TABLE => 'tt'),
        
'ON'    => 'tt.user_id = ' $user->data['user_id'] . ' AND t.topic_id = tt.topic_id'
        
);

        
$sql_array['LEFT_JOIN'][] = array(
        
'FROM'    => array(FORUMS_TRACK_TABLE => 'ft'),
        
'ON'    => 'ft.user_id = ' $user->data['user_id'] . ' AND t.forum_id = ft.forum_id'
        
);
    }
    }

    if (!
$post_id)
    {
    
$sql_array['WHERE'] = "t.topic_id = $topic_id";
    }
    else
    {
    
$sql_array['WHERE'] = "p.post_id = $post_id AND t.topic_id = p.topic_id";
    }

    
$sql_array['WHERE'] .= ' AND (f.forum_id = t.forum_id';

    if (!
$forum_id)
    {
    
// If it is a global announcement make sure to set the forum id to a postable forum
    
$sql_array['WHERE'] .= ' OR (t.topic_type = ' POST_GLOBAL '
        AND f.forum_type = ' 
FORUM_POST ')';
    }
    else
    {
    
$sql_array['WHERE'] .= ' OR (t.topic_type = ' POST_GLOBAL "
        AND f.forum_id = 
$forum_id)";
    }

    
$sql_array['WHERE'] .= ')';

    
// Join to forum table on topic forum_id unless topic forum_id is zero
    // whereupon we join on the forum_id passed as a parameter ... this
    // is done so navigation, forum name, etc. remain consistent with where
    // user clicked to view a global topic
    
$sql $db->sql_build_query('SELECT'$sql_array);
    
$result $db->sql_query($sql);
    
$topic_data $db->sql_fetchrow($result);
    
$db->sql_freeresult($result);

    
// link to unapproved post or incorrect link
    
if (!$topic_data)
    {
    
// If post_id was submitted, we try at least to display the topic as a last resort...
    
if ($post_id && $topic_id)
    {
        
redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx""t=$topic_id. (($forum_id) ? "&amp;f=$forum_id'')));
    }

    
trigger_error('NO_TOPIC');
    }

    
$forum_id = (int) $topic_data['forum_id'];
    
// This is for determining where we are (page)
    
if ($post_id)
    {
    
// are we where we are supposed to be?
    
if (!$topic_data['post_approved'] && !$auth->acl_get('m_approve'$topic_data['forum_id']))
    {
        
// If post_id was submitted, we try at least to display the topic as a last resort...
        
if ($topic_id)
        {
        
redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx""t=$topic_id. (($forum_id) ? "&amp;f=$forum_id'')));
        }

        
trigger_error('NO_TOPIC');
    }
    if (
$post_id == $topic_data['topic_first_post_id'] || $post_id == $topic_data['topic_last_post_id'])
    {
        
$check_sort = ($post_id == $topic_data['topic_first_post_id']) ? 'd' 'a';

        if (
$sort_dir == $check_sort)
        {
        
$topic_data['prev_posts'] = ($auth->acl_get('m_approve'$forum_id)) ? $topic_data['topic_replies_real'] : $topic_data['topic_replies'];
        }
        else
        {
        
$topic_data['prev_posts'] = 0;
        }
    }
    else
    {
        
$sql 'SELECT COUNT(p1.post_id) AS prev_posts
        FROM ' 
POSTS_TABLE ' p1, ' POSTS_TABLE " p2
        WHERE p1.topic_id = 
{$topic_data['topic_id']}
        AND p2.post_id = 
{$post_id}
        " 
. ((!$auth->acl_get('m_approve'$forum_id)) ? 'AND p1.post_approved = 1' '') . '
        AND ' 
. (($sort_dir == 'd') ? 'p1.post_time >= p2.post_time' 'p1.post_time <= p2.post_time');

        
$result $db->sql_query($sql);
        
$row $db->sql_fetchrow($result);
        
$db->sql_freeresult($result);

        
$topic_data['prev_posts'] = $row['prev_posts'] - 1;
    }
    }

    
$topic_id = (int) $topic_data['topic_id'];
    
//
    
$topic_replies = ($auth->acl_get('m_approve'$forum_id)) ? $topic_data['topic_replies_real'] : $topic_data['topic_replies'];

    
// Check sticky/announcement time limit
    
if (($topic_data['topic_type'] == POST_STICKY || $topic_data['topic_type'] == POST_ANNOUNCE) && $topic_data['topic_time_limit'] && ($topic_data['topic_time'] + $topic_data['topic_time_limit']) < time())
    {
    
$sql 'UPDATE ' TOPICS_TABLE '
        SET topic_type = ' 
POST_NORMAL ', topic_time_limit = 0
        WHERE topic_id = ' 
$topic_id;
    
$db->sql_query($sql);

    
$topic_data['topic_type'] = POST_NORMAL;
    
$topic_data['topic_time_limit'] = 0;
    }

    
// Setup look and feel
    
$user->setup('viewtopic'$topic_data['forum_style']);

    if (!
$topic_data['topic_approved'] && !$auth->acl_get('m_approve'$forum_id))
    {
    
trigger_error('NO_TOPIC');
    }

    
// Start auth check
    
if (!$auth->acl_get('f_read'$forum_id))
    {
    if (
$user->data['user_id'] != ANONYMOUS)
    {
        
trigger_error('SORRY_AUTH_READ');
    }
    
trigger_error('SORRY_AUTH_READ');
    }

    
// Forum is passworded ... check whether access has been granted to this
    // user this session, if not show login box
    
if ($topic_data['forum_password'])
    {
    if (!
fr_login_forum_box($topic_data)) {
        
trigger_error('SORRY_AUTH_READ');
    }
    }

    
// What is start equal to?
    
if ($post_id)
    {
    
$start floor(($topic_data['prev_posts']) / $config['posts_per_page']) * $config['posts_per_page'];
    }

    
// Get topic tracking info
    
if (!isset($topic_tracking_info))
    {
    
$topic_tracking_info = array();

    
// Get topic tracking info
    
if ($config['load_db_lastread'] && $user->data['is_registered'])
    {
        
$tmp_topic_data = array($topic_id => $topic_data);
        
$topic_tracking_info get_topic_tracking($forum_id$topic_id$tmp_topic_data, array($forum_id => $topic_data['forum_mark_time']));
        unset(
$tmp_topic_data);
    }
    else if (
$config['load_anon_lastread'] || $user->data['is_registered'])
    {
        
$topic_tracking_info get_complete_topic_tracking($forum_id$topic_id);
    }
    }

    
// Post ordering options
    
$limit_days = array(=> $user->lang['ALL_POSTS'], => $user->lang['1_DAY'], => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);

    
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
    
$sort_by_sql = array('a' => array('u.username_clean''p.post_id'), 't' => 'p.post_time''s' => array('p.post_subject''p.post_id'));
    
$join_user_sql = array('a' => true't' => false's' => false);

    
$s_limit_days $s_sort_key $s_sort_dir $u_sort_param '';

    
gen_sort_selects($limit_days$sort_by_text$sort_days$sort_key$sort_dir$s_limit_days$s_sort_key$s_sort_dir$u_sort_param$default_sort_days$default_sort_key$default_sort_dir);

    
// Obtain correct post count and ordering SQL if user has
    // requested anything different
    
if ($sort_days)
    {
    
$min_post_time time() - ($sort_days 86400);

    
$sql 'SELECT COUNT(post_id) AS num_posts
        FROM ' 
POSTS_TABLE "
        WHERE topic_id = 
$topic_id
        AND post_time >= 
$min_post_time
        " 
. (($auth->acl_get('m_approve'$forum_id)) ? '' 'AND post_approved = 1');
    
$result $db->sql_query($sql);
    
$total_posts = (int) $db->sql_fetchfield('num_posts');
    
$db->sql_freeresult($result);

    
$limit_posts_time "AND p.post_time >= $min_post_time ";

    if (isset(
$_POST['sort']))
    {
        
$start 0;
    }
    }
    else
    {
    
$total_posts $topic_replies 1;
    
$limit_posts_time '';
    }

    
// Was a highlight request part of the URI?
    
$highlight_match $highlight '';
    if (
$hilit_words)
    {
    foreach (
explode(' 'trim($hilit_words)) as $word)
    {
        if (
trim($word))
        {
        
$word str_replace('\*''\w+?'preg_quote($word'#'));
        
$word preg_replace('#(^|\s)\\\\w\*\?(\s|$)#''$1\w+?$2'$word);
        
$highlight_match .= (($highlight_match != '') ? '|' '') . $word;
        }
    }

    
$highlight urlencode($hilit_words);
    }

    
// Make sure $start is set to the last page if it exceeds the amount
    
if ($start || $start >= $total_posts)
    {
    
$start = ($start 0) ? floor(($total_posts 1) / $config['posts_per_page']) * $config['posts_per_page'];
    }

    
// Are we watching this topic?
    
$s_watching_topic = array(
    
'link'            => '',
    
'title'            => '',
    
'is_watching'    => false,
    );

    if ((
$config['email_enable'] || $config['jab_enable']) && $config['allow_topic_notify'] && $user->data['is_registered'])
    {
    
watch_topic_forum('topic'$s_watching_topic$user->data['user_id'], $forum_id$topic_id$topic_data['notify_status'], $start);

    
// Reset forum notification if forum notify is set
    
if ($config['allow_forum_notify'] && $auth->acl_get('f_subscribe'$forum_id))
    {
        
$s_watching_forum $s_watching_topic;
        
watch_topic_forum('forum'$s_watching_forum$user->data['user_id'], $forum_id0);
    }
    }

    
// If the user is trying to reach the second half of the topic, fetch it starting from the end
    
$store_reverse false;
    
$sql_limit $config['posts_per_page'];
    
$sql_sort_order $direction '';

    if (
$start $total_posts 2)
    {
    
$store_reverse true;

    if (
$start $config['posts_per_page'] > $total_posts)
    {
        
$sql_limit min($config['posts_per_page'], max(1$total_posts $start));
    }

    
// Select the sort order
    
$direction = (($sort_dir == 'd') ? 'ASC' 'DESC');
    
$sql_start max(0$total_posts $sql_limit $start);
    }
    else
    {
    
// Select the sort order
    
$direction = (($sort_dir == 'd') ? 'DESC' 'ASC');
    
$sql_start $start;
    }

    if (
is_array($sort_by_sql[$sort_key]))
    {
    
$sql_sort_order implode(' ' $direction ', '$sort_by_sql[$sort_key]) . ' ' $direction;
    }
    else
    {
    
$sql_sort_order $sort_by_sql[$sort_key] . ' ' $direction;
    }

    
// Container for user details, only process once
    
$post_list $user_cache $id_cache $attachments $attach_list $rowset $update_count $post_edit_list = array();
    
$has_attachments $display_notice false;
    
$bbcode_bitfield '';
    
$i $i_total 0;

    
// Go ahead and pull all data for this topic
    
$sql 'SELECT p.post_id
    FROM ' 
POSTS_TABLE ' p' . (($join_user_sql[$sort_key]) ? ', ' USERS_TABLE ' u''') . "
    WHERE p.topic_id = 
$topic_id
    " 
. ((!$auth->acl_get('m_approve'$forum_id)) ? 'AND p.post_approved = 1' '') . "
    " 
. (($join_user_sql[$sort_key]) ? 'AND u.user_id = p.poster_id''') . "
    
$limit_posts_time
    ORDER BY 
$sql_sort_order";
    
$result $db->sql_query_limit($sql$sql_limit$sql_start);

    
$i = ($store_reverse) ? $sql_limit 0;
    while (
$row $db->sql_fetchrow($result))
    {
    
$post_list[$i] = (int) $row['post_id'];
    (
$store_reverse) ? $i-- : $i++;
    }
    
$db->sql_freeresult($result);

    if (!
sizeof($post_list))
    {
    if (
$sort_days)
    {
        
trigger_error('NO_POSTS_TIME_FRAME');
    }
    else
    {
        
trigger_error('NO_TOPIC');
    }
    }

    
// Holding maximum post time for marking topic read
    // We need to grab it because we do reverse ordering sometimes
    
$max_post_time 0;

    
$sql $db->sql_build_query('SELECT', array(
    
'SELECT'    => 'u.*, z.friend, z.foe, p.*, f.forum_name',

    
'FROM'        => array(
        
USERS_TABLE        => 'u',
        
POSTS_TABLE        => 'p',
    ),

    
'LEFT_JOIN'    => array(
        array(
        
'FROM'    => array(ZEBRA_TABLE => 'z'),
        
'ON'    => 'z.user_id = ' $user->data['user_id'] . ' AND z.zebra_id = p.poster_id'
        
),
        array(
        
'FROM'    => array(FORUMS_TABLE => 'f'),
        
'ON'    => 'f.forum_id = p.forum_id'
        
),
    ),

    
'WHERE'        => $db->sql_in_set('p.post_id'$post_list) . '
    AND u.user_id = p.poster_id'
    
));

    
$result $db->sql_query($sql);
    
$rows = array();
    while (
$row $db->sql_fetchrow($result)) {
    
$rows[] = $row;
    }

    
$online_userids = array();
    foreach (
$rows as $row) {
    
$online_userids[] = $row['poster_id'];
    }
    
    
// Generate online information for user
    
if (sizeof($online_userids)) {
    
$sql 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
        FROM ' 
SESSIONS_TABLE '
        WHERE ' 
$db->sql_in_set('session_user_id'$online_userids) . '
        GROUP BY session_user_id'
;
    
$result $db->sql_query($sql);

    
$update_time $config['load_online_time'] * 60;
    while (
$row $db->sql_fetchrow($result))
    {
        
$user_cache[$row['session_user_id']]['online'] = (time() - $update_time $row['online_time'] && (($row['viewonline']) || $auth->acl_get('u_viewonline'))) ? true false;
    }
    
$db->sql_freeresult($result);
    }
    unset(
$online_userids);

    
$now getdate(time() + $user->timezone $user->dst date('Z'));

    
// Posts are stored in the $rowset array while $attach_list, $user_cache
    // and the global bbcode_bitfield are built
    
foreach ($rows as $row) {
    
// Set max_post_time
    
if ($row['post_time'] > $max_post_time)
    {
        
$max_post_time $row['post_time'];
    }

    
$poster_id = (int) $row['poster_id'];

    
$attachments = array();
    if (
$row['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download'$forum_id))
    {
        
$sql 'SELECT *
        FROM ' 
ATTACHMENTS_TABLE '
        WHERE ' 
$db->sql_in_set('post_msg_id', array($row['post_id'])) . '
        AND in_message = 0
        ORDER BY filetime DESC, post_msg_id ASC'
;
        
$attach_result $db->sql_query($sql);

        while (
$attach_row $db->sql_fetchrow($attach_result))
        {
        
$attachments[] = $attach_row;
        }
        
$db->sql_freeresult($attach_result);
    }

    
// Attachments (images).
    
$attacharray = array();
    if (
count($attachments) > 0) {
        foreach (
$attachments as $attachment) {
        
$lfilename strtolower($attachment['real_filename']);
        if (
strpos($lfilename'.jpe') !== false ||
            
strpos($lfilename'.png') !== false ||
            
strpos($lfilename'.gif') !== false ||
            
strpos($lfilename'.jpg') !== false ||
            
strpos($lfilename'.jpeg') !== false) {
            
$attacharray[] = fr_get_phpbb_bburl() . "/forumrunner/file.$phpEx?id=" $attachment['attach_id'];
        }
        }
    }

    
// Parse the post for quotes and inline images
    
$stripped_text remove_bbcode_uids_and_smilies($row['post_text'], $row['bbcode_uid']);
    list (
$text$nuked_quotes$images) = parse_post($stripped_text$row['enable_smilies'] && $usesmilies$attacharray);

    
$images array_merge($images$attacharray);

    
// Avatar work
    
$avatarurl process_avatarurl(fr_get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']));

    if (
$row['forum_id'] == 0) {
        
$row['forum_id'] = $forum_id;
    }

    
$tmp = array(
        
'post_id' => $row['post_id'],
        
'thread_id' => $row['topic_id'],
        
'forum_id' => $row['forum_id'],
        
'forum_title' => prepare_utf8_string($row['forum_name']),
        
'username' => prepare_utf8_string($row['username']),
        
'joindate' => date('M j, Y'$row['user_regdate']),
        
'numposts' => $row['user_posts'],
        
'userid' => $row['user_id'],
        
'title' => prepare_utf8_string($row['post_subject']),
        
'online' => isset($user_cache[$row['post_id']]) ? ($user_cache[$row['poster_id']]['online'] ? 0) : 0,
        
'post_timestamp' => prepare_utf8_string(date_trunc($user->format_date($row['post_time']))),
        
'images' => $images,
        
'text' => $text,
        
'quotable' => $nuked_quotes,
    );

    if (
$show_signature) {
        
$sig censor_text($row['user_sig']);
        
$bbcode_bitfield base64_decode($row['user_sig_bbcode_bitfield']);
        
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
        
$bbcode->bbcode_second_pass($sig$row['user_sig_bbcode_uid'], $row['user_sig_bbcode_bitfield']);
        
$tmp['sig'] = prepare_utf8_string(strip_tags($sig'<a>'));
    }

    
$edit_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_edit'$forum_id) || (
        
$user->data['user_id'] == $poster_id &&
        
$auth->acl_get('f_edit'$forum_id) &&
        !
$row['post_edit_locked'] &&
        (
$row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])
        )));

    
$delete_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_delete'$forum_id) || (
        
$user->data['user_id'] == $poster_id &&
        
$auth->acl_get('f_delete'$forum_id) &&
        
$topic_data['topic_last_post_id'] == $row['post_id'] &&
        (
$row['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']) &&
        
// we do not want to allow removal of the last post if a moderator locked it!
        
!$row['post_edit_locked']
        )));

    if (
$edit_allowed) {
        
$tmp['canedit'] = true;
        
$tmp['edittext'] = prepare_utf8_string($stripped_text);
    }
    if (
$avatarurl != '') {
        
$tmp['avatarurl'] = $avatarurl;
    }

    
$posts_out[] = $tmp;
    }
    
$db->sql_freeresult($result);

    
// Only mark topic if it's currently unread. Also make sure we do not set topic tracking back if earlier pages are viewed.
    
if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id] && $max_post_time $topic_tracking_info[$topic_id])
    {
    
markread('topic', (($topic_data['topic_type'] == POST_GLOBAL) ? $forum_id), $topic_id$max_post_time);

    
// Update forum info
    
$all_marked_read update_forum_tracking_info((($topic_data['topic_type'] == POST_GLOBAL) ? $forum_id), $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : falsefalse);
    }
    else
    {
    
$all_marked_read true;
    }
    
    
fr_update_subsent($topic_id$max_post_time);

    
$canpost = ($topic_data['forum_type'] == FORUM_POST && $auth->acl_get('f_reply'$forum_id) && $topic_data['topic_status'] == ITEM_UNLOCKED);

    
$mod 0;
    
$allow_change_type = ($auth->acl_get('m_'$forum_id) || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true false;
    if (
$auth->acl_get('m_delete'$forum_id)) {
    
$mod |= MOD_DELETEPOST;
    }
    if (
$allow_change_type && $auth->acl_gets('f_sticky''f_announce'$forum_id) && $topic_data['topic_type'] != POST_NORMAL) {
    
$mod |= MOD_UNSTICK;
    }
    if (
$allow_change_type && $auth->acl_get('f_sticky'$forum_id) && $topic_data['topic_type'] != POST_STICKY) {
    
$mod |= MOD_STICK;
    }
    if (
$auth->acl_get('m_delete'$forum_id)) {
    
$mod |= MOD_DELETETHREAD;
    }
    if (
$auth->acl_get('m_lock'$forum_id) || ($auth->acl_get('f_user_lock'$forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) {
    if (
$topic_data['topic_status'] == ITEM_UNLOCKED) {
        
$mod |= MOD_CLOSE;
    } else {
        
$mod |= MOD_OPEN;
    }
    }
    if (
$auth->acl_get('m_move'$forum_id) && $topic_data['topic_status'] != ITEM_MOVED) {
    
$mod |= MOD_MOVETHREAD;
    }

    
$out = array(
    
'posts' => $posts_out,
    
'total_posts' => $total_posts,
    
'page' => (int)($start $perpage) + 1,
    
'canpost' => $canpost 0,
    
'mod' => $mod,
    
'pollid' => (!empty($topic_data['poll_start']) ? 0),
    
'subscribed' => $s_watching_topic['is_watching'],
    );
    if (
$post_id) {
    
$out['gotopostid'] = $post_id;
    }

    return 
$out;
}

function
do_get_poll ($update false)
{
    global 
$user$db$auth$config$template$phpEx;
    
    
$topic_id    request_var('threadid'0);
    if (
$update) {
    
$voted_id    split(','request_var('options'''));
    }
    
    
// Do we have a topic?
    
if (!$topic_id) {
    
trigger_error('NO_TOPIC');
    }
    
    
$user->setup('viewtopic');

    
$sql 'SELECT *
    FROM ' 
TOPICS_TABLE "
    WHERE topic_id = 
$topic_id";
    
$result $db->sql_query($sql);
    
$topic_data $db->sql_fetchrow($result);
    
$forum_id = (int)$topic_data['forum_id'];
    
$db->sql_freeresult($result);

    
$sql 'SELECT o.*, p.bbcode_bitfield, p.bbcode_uid
        FROM ' 
POLL_OPTIONS_TABLE ' o, ' POSTS_TABLE " p
        WHERE o.topic_id = 
$topic_id
            AND p.post_id = 
{$topic_data['topic_first_post_id']}
            AND p.topic_id = o.topic_id
        ORDER BY o.poll_option_id"
;
    
$result $db->sql_query($sql);

    
$poll_info = array();
    while (
$row $db->sql_fetchrow($result))
    {
        
$poll_info[] = $row;
    }
    
$db->sql_freeresult($result);

    
$cur_voted_id = array();
    if (
$user->data['is_registered'])
    {
        
$sql 'SELECT poll_option_id
            FROM ' 
POLL_VOTES_TABLE '
            WHERE topic_id = ' 
$topic_id '
                AND vote_user_id = ' 
$user->data['user_id'];
        
$result $db->sql_query($sql);

        while (
$row $db->sql_fetchrow($result))
        {
            
$cur_voted_id[] = $row['poll_option_id'];
        }
        
$db->sql_freeresult($result);
    }
    else
    {
        
// Cookie based guest tracking ... I don't like this but hum ho
        // it's oft requested. This relies on "nice" users who don't feel
        // the need to delete cookies to mess with results.
        
if (isset($_COOKIE[$config['cookie_name'] . '_poll_' $topic_id]))
        {
            
$cur_voted_id explode(','$_COOKIE[$config['cookie_name'] . '_poll_' $topic_id]);
            
$cur_voted_id array_map('intval'$cur_voted_id);
        }
    }

    
// Can not vote at all if no vote permission
    
$s_can_vote = ($auth->acl_get('f_vote'$forum_id) &&
        ((
$topic_data['poll_length'] != && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) &&
        
$topic_data['topic_status'] != ITEM_LOCKED &&
        
$topic_data['forum_status'] != ITEM_LOCKED &&
        (!
sizeof($cur_voted_id) ||
        (
$auth->acl_get('f_votechg'$forum_id) && $topic_data['poll_vote_change']))) ? true false;
    
$s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($cur_voted_id)) || $view == 'viewpoll') ? true false;
    
    if (
$update && $s_can_vote)
    {

        if (!
sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED$cur_voted_id))
        {
            if (!
sizeof($voted_id))
            {
                
$message 'NO_VOTE_OPTION';
            }
            else if (
sizeof($voted_id) > $topic_data['poll_max_options'])
            {
                
$message 'TOO_MANY_VOTE_OPTIONS';
            }
            else if (
in_array(VOTE_CONVERTED$cur_voted_id))
            {
                
$message 'VOTE_CONVERTED';
            }
            else
            {
                
$message 'FORM_INVALID';
            }

            
trigger_error(strip_tags($user->lang[$message]));
        }

        foreach (
$voted_id as $option)
        {
            if (
in_array($option$cur_voted_id))
            {
                continue;
            }

            
$sql 'UPDATE ' POLL_OPTIONS_TABLE '
                SET poll_option_total = poll_option_total + 1
                WHERE poll_option_id = ' 
. (int) $option '
                    AND topic_id = ' 
. (int) $topic_id;
            
$db->sql_query($sql);

            if (
$user->data['is_registered'])
            {
                
$sql_ary = array(
                    
'topic_id'            => (int) $topic_id,
                    
'poll_option_id'    => (int) $option,
                    
'vote_user_id'        => (int) $user->data['user_id'],
                    
'vote_user_ip'        => (string) $user->ip,
                );

                
$sql 'INSERT INTO ' POLL_VOTES_TABLE ' ' $db->sql_build_array('INSERT'$sql_ary);
                
$db->sql_query($sql);
            }
        }

        foreach (
$cur_voted_id as $option)
        {
            if (!
in_array($option$voted_id))
            {
                
$sql 'UPDATE ' POLL_OPTIONS_TABLE '
                    SET poll_option_total = poll_option_total - 1
                    WHERE poll_option_id = ' 
. (int) $option '
                        AND topic_id = ' 
. (int) $topic_id;
                
$db->sql_query($sql);

                if (
$user->data['is_registered'])
                {
                    
$sql 'DELETE FROM ' POLL_VOTES_TABLE '
                        WHERE topic_id = ' 
. (int) $topic_id '
                            AND poll_option_id = ' 
. (int) $option '
                            AND vote_user_id = ' 
. (int) $user->data['user_id'];
                    
$db->sql_query($sql);
                }
            }
        }

        if (
$user->data['user_id'] == ANONYMOUS && !$user->data['is_bot'])
        {
            
$user->set_cookie('poll_' $topic_idimplode(','$voted_id), time() + 31536000);
        }

        
$sql 'UPDATE ' TOPICS_TABLE '
            SET poll_last_vote = ' 
time() . "
            WHERE topic_id = 
$topic_id";
        
//, topic_last_post_time = ' . time() . " -- for bumping topics with new votes, ignore for now
        
$db->sql_query($sql);

        return array(
'success' => true);
    }

    
$poll_total 0;
    foreach (
$poll_info as $poll_option)
    {
        
$poll_total += $poll_option['poll_option_total'];
    }

    if (
$poll_info[0]['bbcode_bitfield'])
    {
        
$poll_bbcode = new bbcode();
    }
    else
    {
        
$poll_bbcode false;
    }

    for (
$i 0$size sizeof($poll_info); $i $size$i++)
    {
        
$poll_info[$i]['poll_option_text'] = censor_text($poll_info[$i]['poll_option_text']);
        
$poll_info[$i]['poll_option_text'] = remove_bbcode_uids_and_smilies($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid']);
    }

    
$topic_data['poll_title'] = censor_text($topic_data['poll_title']);
    
$topic_data['poll_title'] = remove_bbcode_uids_and_smilies($topic_data['poll_title'], $poll_info[0]['bbcode_uid']);

    unset(
$poll_bbcode);

    
$options = array();

    foreach (
$poll_info as $poll_option)
    {
        
$option_pct = ($poll_total 0) ? $poll_option['poll_option_total'] / $poll_total 0;
        
$option_pct_txt sprintf("%.1d"round($option_pct 100));

        
$options[] = array(
        
'voted' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true false,
        
'percent' => $option_pct_txt,
        
'title' => prepare_utf8_string($poll_option['poll_option_text']),
        
'votes' => $poll_option['poll_option_total'],
        );
    }

    
$poll_end $topic_data['poll_length'] + $topic_data['poll_start'];

    
$status '';
    if (
$s_can_vote) {
        
$status = ($topic_data['poll_max_options'] == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $topic_data['poll_max_options']);
    }

    if (
$topic_data['poll_length']) {
        if (
$status != '') {
        
$status .= '.  ';
        }
        
$status .= sprintf($user->lang[($poll_end time()) ? 'POLL_RUN_TILL' 'POLL_ENDED_AT'], $user->format_date($poll_end));
    }

    
$out = array(
        
'title' => prepare_utf8_string($topic_data['poll_title']),
        
'pollstatus' => prepare_utf8_string(strip_tags($status)),
        
'options' => $options,
        
'total' => $poll_total,
        
'canvote' => $s_can_vote,
    );
    if (
$topic_data['poll_max_options'] > 1) {
        
$out['multiple'] = true;
    }

    return 
$out;
}

function
do_vote_poll ()
{
    return 
do_get_poll(true);
}

function
do_get_post ()
{
    global 
$user$db$auth$config$template$phpEx;

    
$usesmilies false;
    
$posts_out = array();

    
// Initial var setup
    
$forum_id    request_var('forumid'0);
    
$topic_id    request_var('threadid'0);
    
$post_id    request_var('postid'0);
    
$show_signature request_var('signature'false);

    
$s_can_vote false;

    
// Do we have a topic or post id?
    
if (!$post_id)
    {
    
trigger_error('NO_TOPIC');
    }

    if (!
$post_id && !$forum_id)
    {
    
$sql 'SELECT forum_id
        FROM ' 
TOPICS_TABLE "
        WHERE topic_id = 
$topic_id";
    
$result $db->sql_query($sql);
    
$forum_id = (int) $db->sql_fetchfield('forum_id');
    
$db->sql_freeresult($result);

    if (!
$forum_id) {
        
// Global announcement
        
$sql 'SELECT forum_id
        FROM ' 
FORUMS_TABLE '
        WHERE forum_type = ' 
FORUM_POST;
        
$result $db->sql_query($sql);
        
$forum_id = (int) $db->sql_fetchfield('forum_id');
        
$db->sql_freeresult($result);
    }

    if (!
$forum_id) {
        
trigger_error('NO_TOPIC');
    }
    }

    
// This rather complex gaggle of code handles querying for topics but
    // also allows for direct linking to a post (and the calculation of which
    // page the post is on and the correct display of viewtopic)
    
$sql_array = array(
    
'SELECT'    => 't.*, f.*',

    
'FROM'        => array(FORUMS_TABLE => 'f'),
    );

    
// Firebird handles two columns of the same name a little differently, this
    // addresses that by forcing the forum_id to come from the forums table.
    
if ($db->sql_layer === 'firebird')
    {
    
$sql_array['SELECT'] = 'f.forum_id AS forum_id, ' $sql_array['SELECT'];
    }

    
// The FROM-Order is quite important here, else t.* columns can not be correctly bound.
    
if ($post_id)
    {
    
$sql_array['SELECT'] .= ', p.post_approved';
    
$sql_array['FROM'][POSTS_TABLE] = 'p';
    }

    
// Topics table need to be the last in the chain
    
$sql_array['FROM'][TOPICS_TABLE] = 't';

    if (
$user->data['is_registered'])
    {
    
$sql_array['SELECT'] .= ', tw.notify_status';
    
$sql_array['LEFT_JOIN'] = array();

    
$sql_array['LEFT_JOIN'][] = array(
        
'FROM'    => array(TOPICS_WATCH_TABLE => 'tw'),
        
'ON'    => 'tw.user_id = ' $user->data['user_id'] . ' AND t.topic_id = tw.topic_id'
    
);

    if (
$config['allow_bookmarks'])
    {
        
$sql_array['SELECT'] .= ', bm.topic_id as bookmarked';
        
$sql_array['LEFT_JOIN'][] = array(
        
'FROM'    => array(BOOKMARKS_TABLE => 'bm'),
        
'ON'    => 'bm.user_id = ' $user->data['user_id'] . ' AND t.topic_id = bm.topic_id'
        
);
    }

    if (
$config['load_db_lastread'])
    {
        
$sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time as forum_mark_time';

        
$sql_array['LEFT_JOIN'][] = array(
        
'FROM'    => array(TOPICS_TRACK_TABLE => 'tt'),
        
'ON'    => 'tt.user_id = ' $user->data['user_id'] . ' AND t.topic_id = tt.topic_id'
        
);

        
$sql_array['LEFT_JOIN'][] = array(
        
'FROM'    => array(FORUMS_TRACK_TABLE => 'ft'),
        
'ON'    => 'ft.user_id = ' $user->data['user_id'] . ' AND t.forum_id = ft.forum_id'
        
);
    }
    }

    
$sql_array['WHERE'] = "p.post_id = $post_id AND t.topic_id = p.topic_id";

    
$sql_array['WHERE'] .= ' AND (f.forum_id = t.forum_id';

    if (!
$forum_id)
    {
    
// If it is a global announcement make sure to set the forum id to a postable forum
    
$sql_array['WHERE'] .= ' OR (t.topic_type = ' POST_GLOBAL '
        AND f.forum_type = ' 
FORUM_POST ')';
    }
    else
    {
    
$sql_array['WHERE'] .= ' OR (t.topic_type = ' POST_GLOBAL "
        AND f.forum_id = 
$forum_id)";
    }

    
$sql_array['WHERE'] .= ')';

    
// Join to forum table on topic forum_id unless topic forum_id is zero
    // whereupon we join on the forum_id passed as a parameter ... this
    // is done so navigation, forum name, etc. remain consistent with where
    // user clicked to view a global topic
    
$sql $db->sql_build_query('SELECT'$sql_array);
    
$result $db->sql_query($sql);
    
$topic_data $db->sql_fetchrow($result);
    
$db->sql_freeresult($result);

    
// link to unapproved post or incorrect link
    
if (!$topic_data)
    {
    
// If post_id was submitted, we try at least to display the topic as a last resort...
    
if ($post_id && $topic_id)
    {
        
redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx""t=$topic_id. (($forum_id) ? "&amp;f=$forum_id'')));
    }

    
trigger_error('NO_TOPIC');
    }

    
$forum_id = (int) $topic_data['forum_id'];
    
$topic_id = (int) $topic_data['topic_id'];
    
$topic_replies = ($auth->acl_get('m_approve'$forum_id)) ? $topic_data['topic_replies_real'] : $topic_data['topic_replies'];

    
// Check sticky/announcement time limit
    
if (($topic_data['topic_type'] == POST_STICKY || $topic_data['topic_type'] == POST_ANNOUNCE) && $topic_data['topic_time_limit'] && ($topic_data['topic_time'] + $topic_data['topic_time_limit']) < time())
    {
    
$sql 'UPDATE ' TOPICS_TABLE '
        SET topic_type = ' 
POST_NORMAL ', topic_time_limit = 0
        WHERE topic_id = ' 
$topic_id;
    
$db->sql_query($sql);

    
$topic_data['topic_type'] = POST_NORMAL;
    
$topic_data['topic_time_limit'] = 0;
    }

    
// Setup look and feel
    
$user->setup('viewtopic'$topic_data['forum_style']);

    if (!
$topic_data['topic_approved'] && !$auth->acl_get('m_approve'$forum_id))
    {
    
trigger_error('NO_TOPIC');
    }

    
// Start auth check
    
if (!$auth->acl_get('f_read'$forum_id))
    {
    if (
$user->data['user_id'] != ANONYMOUS)
    {
        
trigger_error('SORRY_AUTH_READ');
    }
    
trigger_error('SORRY_AUTH_READ');
    }

    
// Forum is passworded ... check whether access has been granted to this
    // user this session, if not show login box
    
if ($topic_data['forum_password'])
    {
    if (!
fr_login_forum_box($topic_data)) {
        
trigger_error('SORRY_AUTH_READ');
    }
    }

    
$sql $db->sql_build_query('SELECT', array(
    
'SELECT'    => 'u.*, z.friend, z.foe, p.*, f.forum_name',

    
'FROM'        => array(
        
USERS_TABLE        => 'u',
        
POSTS_TABLE        => 'p',
    ),

    
'LEFT_JOIN'    => array(
        array(
        
'FROM'    => array(ZEBRA_TABLE => 'z'),
        
'ON'    => 'z.user_id = ' $user->data['user_id'] . ' AND z.zebra_id = p.poster_id'
        
),
        array(
        
'FROM'    => array(FORUMS_TABLE => 'f'),
        
'ON'    => 'f.forum_id = p.forum_id'
        
),
    ),

    
'WHERE'        => $db->sql_in_set('p.post_id'$post_id) . '
    AND u.user_id = p.poster_id'
    
));

    
$result $db->sql_query($sql);

    
$row $db->sql_fetchrow($result);
    
    
$poster_id = (int) $row['poster_id'];

    
// Parse the post for quotes and inline images
    
$stripped_text remove_bbcode_uids_and_smilies($row['post_text'], $row['bbcode_uid']);
    list (
$text$nuked_quotes$images) = parse_post($stripped_text$row['enable_smilies'] && $usesmilies$attacharray);

    
// Parse the message and subject
    
$message censor_text($row['post_text']);
    
$decoded_message false;

    
// Define the global bbcode bitfield, will be used to load bbcodes
    
$bbcode_bitfield '';
    
$bbcode_bitfield $bbcode_bitfield base64_decode($row['bbcode_bitfield']);
    if (
$show_signature) {
    
$bbcode_bitfield $bbcode_bitfield base64_decode($row['user_sig_bbcode_bitfield']);
    }

    
$bbcode = new bbcode(base64_encode($bbcode_bitfield));

    
// Second parse bbcode here
    
if ($row['bbcode_bitfield'])
    {
    
$bbcode->bbcode_second_pass($message$row['bbcode_uid'], $row['bbcode_bitfield']);
    }

    
$message bbcode_nl2br($message);
    
$message fr_smiley_text($message);

$css = <<<EOF
<style type="text/css">
body {
  margin: 0;
  padding: 3;
  font: 13px Arial, Helvetica, sans-serif;
}
blockquote {
  background-color: #e6edf5;
  font: 13px Arial, Helvetica, sans-serif;
  border: 1px solid #777777;
  overflow: hidden;
  margin: 0;
  padding: 5px;
}
blockquote cite {
  font-style: normal;
  font-weight: bold;
  margin-left: 0px;
  display: block;
  font-size: 0.9em;
}
html {
    -webkit-text-size-adjust: none;
}
</style>
EOF;


    
// Avatar work
    
$avatarurl process_avatarurl(fr_get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']));

    if (
$row['forum_id'] == 0) {
    
$row['forum_id'] = $forum_id;
    }

    
$tmp = array(
    
'post_id' => $row['post_id'],
    
'thread_id' => $row['topic_id'],
    
'forum_id' => $row['forum_id'],
    
'forum_title' => prepare_utf8_string($row['forum_name']),
    
'username' => prepare_utf8_string($row['username']),
    
'joindate' => date('M j, Y'$row['user_regdate']),
    
'numposts' => $row['user_posts'],
    
'userid' => $row['user_id'],
    
'title' => prepare_utf8_string($row['post_subject']),
    
'post_timestamp' => prepare_utf8_string(date_trunc($user->format_date($row['post_time']))),
    
'html' => prepare_utf8_string($css $message),
    
'quotable' => $nuked_quotes,
    );

    if (
$show_signature) {
    
$sig censor_text($row['user_sig']);
    
$bbcode_bitfield base64_decode($row['user_sig_bbcode_bitfield']);
    
$bbcode->bbcode_second_pass($sig$row['user_sig_bbcode_uid'], $row['user_sig_bbcode_bitfield']);
    
$tmp['sig'] = prepare_utf8_string(strip_tags($sig'<a>'));
    }

    
$delete_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_delete'$forum_id) || (
    
$user->data['user_id'] == $poster_id &&
    
$auth->acl_get('f_delete'$forum_id) &&
    
$topic_data['topic_last_post_id'] == $row['post_id'] &&
    (
$row['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']) &&
    
// we do not want to allow removal of the last post if a moderator locked it!
    
!$row['post_edit_locked']
    )));

    if (
$avatarurl != '') {
    
$tmp['avatarurl'] = $avatarurl;
    }

    
$db->sql_freeresult($result);

    
$canpost = ($topic_data['forum_type'] == FORUM_POST && $auth->acl_get('f_reply'$forum_id) && $topic_data['topic_status'] == ITEM_UNLOCKED);

    
$mod 0;
    
$allow_change_type = ($auth->acl_get('m_'$forum_id) || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true false;
    if (
$auth->acl_get('m_delete'$forum_id)) {
    
$mod |= MOD_DELETEPOST;
    }
    if (
$allow_change_type && $auth->acl_gets('f_sticky''f_announce'$forum_id) && $topic_data['topic_type'] != POST_NORMAL) {
    
$mod |= MOD_UNSTICK;
    }
    if (
$allow_change_type && $auth->acl_get('f_sticky'$forum_id) && $topic_data['topic_type'] != POST_STICKY) {
    
$mod |= MOD_STICK;
    }
    if (
$auth->acl_get('m_delete'$forum_id)) {
    
$mod |= MOD_DELETETHREAD;
    }
    if (
$auth->acl_get('m_lock'$forum_id) || ($auth->acl_get('f_user_lock'$forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) {
    if (
$topic_data['topic_status'] == ITEM_UNLOCKED) {
        
$mod |= MOD_CLOSE;
    } else {
        
$mod |= MOD_OPEN;
    }
    }
    if (
$auth->acl_get('m_move'$forum_id) && $topic_data['topic_status'] != ITEM_MOVED) {
    
$mod |= MOD_MOVETHREAD;
    }

    
$tmp['canpost'] = $canpost 0;

    return 
$tmp;
}

?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by HackingTool | HackingTool | Generation time: 0.0055 ]--