Ejemplo n.º 1
0
 public function check_errors_before_edit($can_edit_subject, $errors)
 {
     $errors = $this->hook->fire('check_errors_before_edit_start', $errors);
     // If it's a topic it must contain a subject
     if ($can_edit_subject) {
         $subject = Utils::trim($this->request->post('req_subject'));
         if ($this->config['o_censoring'] == '1') {
             $censored_subject = Utils::trim(Utils::censor($subject));
         }
         if ($subject == '') {
             $errors[] = __('No subject');
         } elseif ($this->config['o_censoring'] == '1' && $censored_subject == '') {
             $errors[] = __('No subject after censoring');
         } elseif (Utils::strlen($subject) > 70) {
             $errors[] = __('Too long subject');
         } elseif ($this->config['p_subject_all_caps'] == '0' && Utils::is_all_uppercase($subject) && !$this->user->is_admmod) {
             $errors[] = __('All caps subject');
         }
     }
     // Clean up message from POST
     $message = Utils::linebreaks(Utils::trim($this->request->post('req_message')));
     // Here we use strlen() not Utils::strlen() as we want to limit the post to FEATHER_MAX_POSTSIZE bytes, not characters
     if (strlen($message) > $this->feather->forum_env['FEATHER_MAX_POSTSIZE']) {
         $errors[] = sprintf(__('Too long message'), Utils::forum_number_format($this->feather->forum_env['FEATHER_MAX_POSTSIZE']));
     } elseif ($this->config['p_message_all_caps'] == '0' && Utils::is_all_uppercase($message) && !$this->user->is_admmod) {
         $errors[] = __('All caps message');
     }
     // Validate BBCode syntax
     if ($this->config['p_message_bbcode'] == '1') {
         $message = $this->feather->parser->preparse_bbcode($message, $errors);
     }
     if (empty($errors)) {
         if ($message == '') {
             $errors[] = __('No message');
         } elseif ($this->config['o_censoring'] == '1') {
             // Censor message to see if that causes problems
             $censored_message = Utils::trim(Utils::censor($message));
             if ($censored_message == '') {
                 $errors[] = __('No message after censoring');
             }
         }
     }
     $errors = $this->hook->fire('check_errors_before_edit', $errors);
     return $errors;
 }
Ejemplo n.º 2
0
 public function edit_essentials($id, $user)
 {
     $user_disp = array();
     $user_disp = Container::get('hooks')->fire('model.profile.edit_essentials_start', $user_disp, $id, $user);
     if (User::get()->is_admmod) {
         if (User::get()->g_id == ForumEnv::get('FEATHER_ADMIN') || User::get()->g_mod_rename_users == '1') {
             $user_disp['username_field'] = '<label class="required"><strong>' . __('Username') . ' <span>' . __('Required') . '</span></strong><br /><input type="text" name="req_username" value="' . Utils::escape($user['username']) . '" size="25" maxlength="25" /><br /></label>' . "\n";
         } else {
             $user_disp['username_field'] = '<p>' . sprintf(__('Username info'), Utils::escape($user['username'])) . '</p>' . "\n";
         }
         $user_disp['email_field'] = '<label class="required"><strong>' . __('Email') . ' <span>' . __('Required') . '</span></strong><br /><input type="text" name="req_email" value="' . Utils::escape($user['email']) . '" size="40" maxlength="80" /><br /></label><p><span class="email"><a href="' . Router::pathFor('email', ['id' => $id]) . '">' . __('Send email') . '</a></span></p>' . "\n";
     } else {
         $user_disp['username_field'] = '<p>' . __('Username') . ': ' . Utils::escape($user['username']) . '</p>' . "\n";
         if (ForumSettings::get('o_regs_verify') == '1') {
             $user_disp['email_field'] = '<p>' . sprintf(__('Email info'), Utils::escape($user['email']) . ' - <a href="' . Router::pathFor('profileAction', ['id' => $id, 'action' => 'change_email']) . '">' . __('Change email') . '</a>') . '</p>' . "\n";
         } else {
             $user_disp['email_field'] = '<label class="required"><strong>' . __('Email') . ' <span>' . __('Required') . '</span></strong><br /><input type="text" name="req_email" value="' . $user['email'] . '" size="40" maxlength="80" /><br /></label>' . "\n";
         }
     }
     $user_disp['posts_field'] = '';
     $posts_actions = array();
     if (User::get()->g_id == ForumEnv::get('FEATHER_ADMIN')) {
         $user_disp['posts_field'] .= '<label>' . __('Posts') . '<br /><input type="text" name="num_posts" value="' . $user['num_posts'] . '" size="8" maxlength="8" /><br /></label>';
     } elseif (ForumSettings::get('o_show_post_count') == '1' || User::get()->is_admmod) {
         $posts_actions[] = sprintf(__('Posts info'), Utils::forum_number_format($user['num_posts']));
     }
     if (User::get()->g_search == '1' || User::get()->g_id == ForumEnv::get('FEATHER_ADMIN')) {
         $posts_actions[] = '<a href="' . Router::pathFor('search') . '?action=show_user_topics&amp;user_id=' . $id . '">' . __('Show topics') . '</a>';
         $posts_actions[] = '<a href="' . Router::pathFor('search') . '?action=show_user_posts&amp;user_id=' . $id . '">' . __('Show posts') . '</a>';
         if (ForumSettings::get('o_topic_subscriptions') == '1') {
             $posts_actions[] = '<a href="' . Router::pathFor('search') . '?action=show_subscriptions&amp;user_id=' . $id . '">' . __('Show subscriptions') . '</a>';
         }
     }
     $user_disp['posts_field'] .= (!empty($posts_actions) ? '<p class="actions">' . implode(' - ', $posts_actions) . '</p>' : '') . "\n";
     $user_disp = Container::get('hooks')->fire('model.profile.edit_essentials', $user_disp);
     return $user_disp;
 }
Ejemplo n.º 3
0
				<input type="hidden" name="<?php 
echo $csrf_key;
?>
" value="<?php 
echo $csrf_token;
?>
">
				<div class="inform">
					<fieldset>
						<legend><?php 
_e('Move users subhead');
?>
</legend>
						<div class="infldset">
							<p><?php 
printf(__('Move users info'), Utils::escape($group_info['title']), Utils::forum_number_format($group_info['members']));
?>
</p>
							<label><?php 
_e('Move users label');
?>
							<select name="move_to_group">
								<?php 
echo $group_list_delete;
?>
							</select>
							<br /></label>
						</div>
					</fieldset>
				</div>
				<p class="buttons"><input type="submit" name="del_group" value="<?php 
Ejemplo n.º 4
0
                            <div>
                                <?php 
    echo $topic['subject_disp'] . "\n";
    ?>
                            </div>
                        </div>
                    </td>
                    <td class="tc2"><?php 
    echo !$topic['ghost_topic'] ? Utils::forum_number_format($topic['num_replies']) : '-';
    ?>
</td>
<?php 
    if (ForumSettings::get('o_topic_views') == '1') {
        ?>
                    <td class="tc3"><?php 
        echo !$topic['ghost_topic'] ? Utils::forum_number_format($topic['num_views']) : '-';
        ?>
</td>
<?php 
    }
    ?>
                    <td class="tcr"><?php 
    echo $topic['last_post_disp'];
    ?>
</td>
                    <td class="tcmod"><input type="checkbox" name="topics[<?php 
    echo $topic['id'];
    ?>
]" value="1" /></td>
                </tr>
            <?php 
Ejemplo n.º 5
0
                                <div>
                                    <?php 
    echo $topic['subject_formatted'] . "\n";
    ?>
                                </div>
                            </div>
                        </td>
                        <td class="tc2"><?php 
    echo is_null($topic['moved_to']) ? Utils::forum_number_format($topic['num_replies']) : '-';
    ?>
</td>
    <?php 
    if (ForumSettings::get('o_topic_views') == '1') {
        ?>
                    <td class="tc3"><?php 
        echo is_null($topic['moved_to']) ? Utils::forum_number_format($topic['num_views']) : '-';
        ?>
</td>
    <?php 
    }
    ?>
                    <td class="tcr"><?php 
    echo $topic['last_post_formatted'];
    ?>
</td>
                    </tr>
            <?php 
}
if (empty($forum_data)) {
    ?>
                    <tr class="rowodd inone">
Ejemplo n.º 6
0
if ($feather->forum_settings['o_signatures'] == '1') {
    ?>
				<div class="inform">
				<fieldset>
					<legend><?php 
    _e('Signature legend');
    ?>
</legend>
					<div class="infldset">
						<p><?php 
    _e('Signature info');
    ?>
</p>
						<div class="txtarea">
							<label><?php 
    printf(__('Sig max size'), Utils::forum_number_format($feather->forum_settings['p_sig_length']), $feather->forum_settings['p_sig_lines']);
    ?>
<br />
							<textarea name="signature" rows="4" cols="65"><?php 
    echo Utils::escape($user['signature']);
    ?>
</textarea><br /></label>
						</div>
						<ul class="bblinks">
							<li><span><a href="<?php 
    echo $feather->urlFor('help') . '#bbcode';
    ?>
" onclick="window.open(this.href); return false;"><?php 
    _e('BBCode');
    ?>
</a> <?php 
Ejemplo n.º 7
0
    header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    echo sprintf(__('Guests online'), Utils::forum_number_format($num_guests)) . '<br />' . "\n";
    if ($action == 'online_full' && !empty($users)) {
        echo sprintf(__('Users online'), implode(', ', $users)) . '<br />' . "\n";
    } else {
        echo sprintf(__('Users online'), Utils::forum_number_format($num_users)) . '<br />' . "\n";
    }
    exit;
} elseif ($action == 'stats') {
    if (!Container::get('cache')->isCached('users_info')) {
        Container::get('cache')->store('users_info', Cache::get_users_info());
    }
    $stats = Container::get('cache')->retrieve('users_info');
    $stats_query = \DB::for_table('forums')->select_expr('SUM(num_topics)', 'total_topics')->select_expr('SUM(num_posts)', 'total_posts')->find_one();
    $stats['total_topics'] = intval($stats_query['total_topics']);
    $stats['total_posts'] = intval($stats_query['total_posts']);
    // Send the Content-type header in case the web server is setup to send something else
    header('Content-type: text/html; charset=utf-8');
    header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    echo sprintf(__('No of users'), Utils::forum_number_format($stats['total_users'])) . '<br />' . "\n";
    echo sprintf(__('Newest user'), User::get()->g_view_users == '1' ? '<a href="' . Url::get('user/' . $stats['last_user']['id'] . '/') . '">' . Utils::escape($stats['last_user']['username']) . '</a>' : Utils::escape($stats['last_user']['username'])) . '<br />' . "\n";
    echo sprintf(__('No of topics'), Utils::forum_number_format($stats['total_topics'])) . '<br />' . "\n";
    echo sprintf(__('No of posts'), Utils::forum_number_format($stats['total_posts'])) . '<br />' . "\n";
    exit;
}
// If we end up here, the script was called with some wacky parameters
exit(__('Bad request'));
Ejemplo n.º 8
0
_e('User info');
?>
</strong></dt>
				<dd><span><?php 
printf(__('Newest user'), $stats['newest_user']);
?>
</span></dd>
				<?php 
if ($feather->forum_settings['o_users_online'] == 1) {
    ?>
				<dd><span><?php 
    printf(__('Users online'), '<strong>' . Utils::forum_number_format($online['num_users']) . '</strong>');
    ?>
</span></dd>
				<dd><span><?php 
    printf(__('Guests online'), '<strong>' . Utils::forum_number_format($online['num_guests']) . '</strong>');
    ?>
</span></dd>
				<?php 
}
?>
			</dl>
			<?php 
if ($feather->forum_settings['o_users_online'] == 1) {
    if ($online['num_users'] > 0) {
        echo "\t\t\t" . '<dl id="onlinelist" class="clearb">' . "\n\t\t\t\t" . '<dt><strong>' . __('Online') . ' </strong></dt>' . "\t\t\t\t" . implode(',</dd> ', $online['users']) . '</dd>' . "\n\t\t\t" . '</dl>' . "\n";
    } else {
        echo "\t\t\t" . '<div class="clearer"></div>' . "\n";
    }
}
?>
Ejemplo n.º 9
0
?>
</a></span></span></h2>
<div class="box">
	<div class="inbox">
		<div class="postbody">
			<div class="postleft">
				<dl>
					<dt><?php 
echo $cur_search['pposter_disp'];
?>
</dt>
<?php 
if ($cur_search['pid'] == $cur_search['first_post_id']) {
    ?>
						<dd><span><?php 
    _e('Replies') . ' ' . Utils::forum_number_format($cur_search['num_replies']);
    ?>
</span></dd>
<?php 
}
?>
					<dd><div class="<?php 
echo $cur_search['icon_type'];
?>
"><div class="nosize"><?php 
echo $cur_search['icon_text'];
?>
</div></div></dd>
				</dl>
			</div>
			<div class="postright">
Ejemplo n.º 10
0
">
                <div class="nosize"><?php 
    echo Utils::forum_number_format($search['topic_count'] + $search['start_from']);
    ?>
</div>
            </div>
            <div class="tclcon">
                <div>
                    <?php 
    echo $search['subject'] . "\n";
    ?>
                </div>
            </div>
        </td>
        <td class="tc2"><?php 
    echo $search['forum'];
    ?>
</td>
        <td class="tc3"><?php 
    echo Utils::forum_number_format($search['num_replies']);
    ?>
</td>
        <td class="tcr"><?php 
    echo '<a href="' . Router::pathFor('viewPost', ['pid' => $search['last_post_id']]) . '#p' . $search['last_post_id'] . '">' . Utils::format_time($search['last_post']) . '</a> <span class="byuser">' . __('by') . ' ' . Utils::escape($search['last_poster']);
    ?>
</span></td>
    </tr>

    <?php 
}
Container::get('hooks')->fire('view.search.topics.end');
Ejemplo n.º 11
0
    ?>
<br />
                        <?php 
    printf(__('Environment data acc') . "\n", $php_accelerator);
    ?>
                    </dd>
                    <dt><?php 
    _e('Database label');
    ?>
</dt>
                    <dd>
<?php 
    if (isset($total_records) && isset($total_size)) {
        ?>
                        <?php 
        printf(__('Database data rows') . "\n", Utils::forum_number_format($total_records));
        ?>
                        <br /><?php 
        printf(__('Database data size') . "\n", $total_size);
    }
    ?>
                    </dd>
<?php 
}
?>
                </dl>
            </div>
        </div>
    </div>
    <div class="clearer"></div>
</div>
Ejemplo n.º 12
0
                    <div class="infldset">
                        <input type="hidden" name="form_sent" value="1" />
                        <input type="hidden" name="MAX_FILE_SIZE" value="<?php 
echo ForumSettings::get('o_avatars_size');
?>
" />
                        <label class="required"><strong><?php 
_e('File');
?>
 <span><?php 
_e('Required');
?>
</span></strong><br /><input name="req_file" type="file" size="40" /><br /></label>
                        <p><?php 
_e('Avatar desc');
echo ' ' . ForumSettings::get('o_avatars_width') . ' x ' . ForumSettings::get('o_avatars_height') . ' ' . __('pixels') . ' ' . __('and') . ' ' . Utils::forum_number_format(ForumSettings::get('o_avatars_size')) . ' ' . __('bytes') . ' (' . Utils::file_size(ForumSettings::get('o_avatars_size')) . ').';
?>
</p>
                    </div>
                </fieldset>
            </div>
            <p class="buttons"><input type="submit" name="upload" value="<?php 
_e('Upload');
?>
" /> <a href="javascript:history.go(-1)"><?php 
_e('Go back');
?>
</a></p>
        </form>
    </div>
</div>
Ejemplo n.º 13
0
if (ForumSettings::get('o_signatures') == '1') {
    ?>
                <div class="inform">
                <fieldset>
                    <legend><?php 
    _e('Signature legend');
    ?>
</legend>
                    <div class="infldset">
                        <p><?php 
    _e('Signature info');
    ?>
</p>
                        <div class="txtarea">
                            <label><?php 
    printf(__('Sig max size'), Utils::forum_number_format(ForumSettings::get('p_sig_length')), ForumSettings::get('p_sig_lines'));
    ?>
<br />
                            <textarea name="signature" rows="4" cols="65"><?php 
    echo Utils::escape($user['signature']);
    ?>
</textarea><br /></label>
                        </div>
                        <ul class="bblinks">
                            <li><span><a href="<?php 
    echo Router::pathFor('help') . '#bbcode';
    ?>
" onclick="window.open(this.href); return false;"><?php 
    _e('BBCode');
    ?>
</a> <?php 
Ejemplo n.º 14
0
 public function print_posts($topic_id, $start_from, $cur_topic, $is_admmod)
 {
     $post_data = array();
     $post_data = Container::get('hooks')->fire('model.topic.print_posts_start', $post_data, $topic_id, $start_from, $cur_topic, $is_admmod);
     $post_count = 0;
     // Keep track of post numbers
     // Retrieve a list of post IDs, LIMIT is (really) expensive so we only fetch the IDs here then later fetch the remaining data
     $result = DB::for_table('posts')->select('id')->where('topic_id', $topic_id)->order_by('id')->limit(User::get()->disp_topics)->offset($start_from);
     $result = Container::get('hooks')->fireDB('model.topic.print_posts_ids_query', $result);
     $result = $result->find_many();
     $post_ids = array();
     foreach ($result as $cur_post_id) {
         $post_ids[] = $cur_post_id['id'];
     }
     if (empty($post_ids)) {
         throw new Error('The post table and topic table seem to be out of sync!', 500);
     }
     // Retrieve the posts (and their respective poster/online status)
     $result['select'] = array('u.email', 'u.title', 'u.url', 'u.location', 'u.signature', 'u.email_setting', 'u.num_posts', 'u.registered', 'u.admin_note', 'p.id', 'username' => 'p.poster', 'p.poster_id', 'p.poster_ip', 'p.poster_email', 'p.message', 'p.hide_smilies', 'p.posted', 'p.edited', 'p.edited_by', 'g.g_id', 'g.g_user_title', 'g.g_promote_next_group', 'is_online' => 'o.user_id');
     $result = DB::for_table('posts')->table_alias('p')->select_many($result['select'])->inner_join('users', array('u.id', '=', 'p.poster_id'), 'u')->inner_join('groups', array('g.g_id', '=', 'u.group_id'), 'g')->raw_join('LEFT OUTER JOIN ' . ForumSettings::get('db_prefix') . 'online', "o.user_id!=1 AND o.idle=0 AND o.user_id=u.id", 'o')->where_in('p.id', $post_ids)->order_by('p.id');
     $result = Container::get('hooks')->fireDB('model.topic.print_posts_query', $result);
     $result = $result->find_array();
     foreach ($result as $cur_post) {
         $post_count++;
         $cur_post['user_avatar'] = '';
         $cur_post['user_info'] = array();
         $cur_post['user_contacts'] = array();
         $cur_post['post_actions'] = array();
         $cur_post['is_online_formatted'] = '';
         $cur_post['signature_formatted'] = '';
         // If the poster is a registered user
         if ($cur_post['poster_id'] > 1) {
             if (User::get()->g_view_users == '1') {
                 $cur_post['username_formatted'] = '<a href="' . Url::base() . '/user/' . $cur_post['poster_id'] . '/">' . Utils::escape($cur_post['username']) . '</a>';
             } else {
                 $cur_post['username_formatted'] = Utils::escape($cur_post['username']);
             }
             $cur_post['user_title_formatted'] = Utils::get_title($cur_post);
             if (ForumSettings::get('o_censoring') == '1') {
                 $cur_post['user_title_formatted'] = Utils::censor($cur_post['user_title_formatted']);
             }
             // Format the online indicator
             $cur_post['is_online_formatted'] = $cur_post['is_online'] == $cur_post['poster_id'] ? '<strong>' . __('Online') . '</strong>' : '<span>' . __('Offline') . '</span>';
             if (ForumSettings::get('o_avatars') == '1' && User::get()->show_avatars != '0') {
                 if (isset($avatar_cache[$cur_post['poster_id']])) {
                     $cur_post['user_avatar'] = $avatar_cache[$cur_post['poster_id']];
                 } else {
                     $cur_post['user_avatar'] = $avatar_cache[$cur_post['poster_id']] = Utils::generate_avatar_markup($cur_post['poster_id']);
                 }
             }
             // We only show location, register date, post count and the contact links if "Show user info" is enabled
             if (ForumSettings::get('o_show_user_info') == '1') {
                 if ($cur_post['location'] != '') {
                     if (ForumSettings::get('o_censoring') == '1') {
                         $cur_post['location'] = Utils::censor($cur_post['location']);
                     }
                     $cur_post['user_info'][] = '<dd><span>' . __('From') . ' ' . Utils::escape($cur_post['location']) . '</span></dd>';
                 }
                 $cur_post['user_info'][] = '<dd><span>' . __('Registered topic') . ' ' . Utils::format_time($cur_post['registered'], true) . '</span></dd>';
                 if (ForumSettings::get('o_show_post_count') == '1' || User::get()->is_admmod) {
                     $cur_post['user_info'][] = '<dd><span>' . __('Posts topic') . ' ' . Utils::forum_number_format($cur_post['num_posts']) . '</span></dd>';
                 }
                 // Now let's deal with the contact links (Email and URL)
                 if (($cur_post['email_setting'] == '0' && !User::get()->is_guest || User::get()->is_admmod) && User::get()->g_send_email == '1') {
                     $cur_post['user_contacts'][] = '<span class="email"><a href="mailto:' . Utils::escape($cur_post['email']) . '">' . __('Email') . '</a></span>';
                 } elseif ($cur_post['email_setting'] == '1' && !User::get()->is_guest && User::get()->g_send_email == '1') {
                     $cur_post['user_contacts'][] = '<span class="email"><a href="' . Router::pathFor('email', ['id' => $cur_post['poster_id']]) . '">' . __('Email') . '</a></span>';
                 }
                 if ($cur_post['url'] != '') {
                     if (ForumSettings::get('o_censoring') == '1') {
                         $cur_post['url'] = Utils::censor($cur_post['url']);
                     }
                     $cur_post['user_contacts'][] = '<span class="website"><a href="' . Utils::escape($cur_post['url']) . '" rel="nofollow">' . __('Website') . '</a></span>';
                 }
             }
             if (User::get()->g_id == ForumEnv::get('FEATHER_ADMIN') || User::get()->g_moderator == '1' && User::get()->g_mod_promote_users == '1') {
                 if ($cur_post['g_promote_next_group']) {
                     $cur_post['user_info'][] = '<dd><span><a href="' . Url::base() . '/user/' . $cur_post['poster_id'] . '/action/promote/pid/' . $cur_post['id'] . '">' . __('Promote user') . '</a></span></dd>';
                 }
             }
             if (User::get()->is_admmod) {
                 $cur_post['user_info'][] = '<dd><span><a href="' . Router::pathFor('getPostHost', ['pid' => $cur_post['id']]) . '" title="' . Utils::escape($cur_post['poster_ip']) . '">' . __('IP address logged') . '</a></span></dd>';
                 if ($cur_post['admin_note'] != '') {
                     $cur_post['user_info'][] = '<dd><span>' . __('Note') . ' <strong>' . Utils::escape($cur_post['admin_note']) . '</strong></span></dd>';
                 }
             }
         } else {
             $cur_post['username_formatted'] = Utils::escape($cur_post['username']);
             $cur_post['user_title_formatted'] = Utils::get_title($cur_post);
             if (User::get()->is_admmod) {
                 $cur_post['user_info'][] = '<dd><span><a href="' . Router::pathFor('getPostHost', ['pid' => $cur_post['id']]) . '" title="' . Utils::escape($cur_post['poster_ip']) . '">' . __('IP address logged') . '</a></span></dd>';
             }
             if (ForumSettings::get('o_show_user_info') == '1' && $cur_post['poster_email'] != '' && !User::get()->is_guest && User::get()->g_send_email == '1') {
                 $cur_post['user_contacts'][] = '<span class="email"><a href="mailto:' . Utils::escape($cur_post['poster_email']) . '">' . __('Email') . '</a></span>';
             }
         }
         // Generation post action array (quote, edit, delete etc.)
         if (!$is_admmod) {
             if (!User::get()->is_guest) {
                 $cur_post['post_actions'][] = '<li class="postreport"><span><a href="' . Router::pathFor('report', ['id' => $cur_post['id']]) . '">' . __('Report') . '</a></span></li>';
             }
             if ($cur_topic['closed'] == '0') {
                 if ($cur_post['poster_id'] == User::get()->id) {
                     if ($start_from + $post_count == 1 && User::get()->g_delete_topics == '1' || $start_from + $post_count > 1 && User::get()->g_delete_posts == '1') {
                         $cur_post['post_actions'][] = '<li class="postdelete"><span><a href="' . Router::pathFor('deletePost', ['id' => $cur_post['id']]) . '">' . __('Delete') . '</a></span></li>';
                     }
                     if (User::get()->g_edit_posts == '1') {
                         $cur_post['post_actions'][] = '<li class="postedit"><span><a href="' . Router::pathFor('editPost', ['id' => $cur_post['id']]) . '">' . __('Edit') . '</a></span></li>';
                     }
                 }
                 if ($cur_topic['post_replies'] == '' && User::get()->g_post_replies == '1' || $cur_topic['post_replies'] == '1') {
                     $cur_post['post_actions'][] = '<li class="postquote"><span><a href="' . Router::pathFor('newQuoteReply', ['tid' => $topic_id, 'qid' => $cur_post['id']]) . '">' . __('Quote') . '</a></span></li>';
                 }
             }
         } else {
             $cur_post['post_actions'][] = '<li class="postreport"><span><a href="' . Router::pathFor('report', ['id' => $cur_post['id']]) . '">' . __('Report') . '</a></span></li>';
             if (User::get()->g_id == ForumEnv::get('FEATHER_ADMIN') || !in_array($cur_post['poster_id'], $admin_ids)) {
                 $cur_post['post_actions'][] = '<li class="postdelete"><span><a href="' . Router::pathFor('deletePost', ['id' => $cur_post['id']]) . '">' . __('Delete') . '</a></span></li>';
                 $cur_post['post_actions'][] = '<li class="postedit"><span><a href="' . Router::pathFor('editPost', ['id' => $cur_post['id']]) . '">' . __('Edit') . '</a></span></li>';
             }
             $cur_post['post_actions'][] = '<li class="postquote"><span><a href="' . Router::pathFor('newQuoteReply', ['tid' => $topic_id, 'qid' => $cur_post['id']]) . '">' . __('Quote') . '</a></span></li>';
         }
         // Perform the main parsing of the message (BBCode, smilies, censor words etc)
         $cur_post['message'] = Container::get('parser')->parse_message($cur_post['message'], $cur_post['hide_smilies']);
         // Do signature parsing/caching
         if (ForumSettings::get('o_signatures') == '1' && $cur_post['signature'] != '' && User::get()->show_sig != '0') {
             // if (isset($avatar_cache[$cur_post['poster_id']])) {
             //     $cur_post['signature_formatted'] = $avatar_cache[$cur_post['poster_id']];
             // } else {
             $cur_post['signature_formatted'] = Container::get('parser')->parse_signature($cur_post['signature']);
             //     $avatar_cache[$cur_post['poster_id']] = $cur_post['signature_formatted'];
             // }
         }
         $cur_post = Container::get('hooks')->fire('model.print_posts.one', $cur_post);
         $post_data[] = $cur_post;
     }
     $post_data = Container::get('hooks')->fire('model.topic.print_posts', $post_data);
     return $post_data;
 }
Ejemplo n.º 15
0
            echo '<a href="' . Router::pathFor('userProfile', ['id' => $info['user_data'][$cur_poster['poster_id']]['id']]) . '">' . Utils::escape($info['user_data'][$cur_poster['poster_id']]['username']) . '</a>';
            ?>
</td>
                    <td class="tc2"><a href="mailto:<?php 
            echo Utils::escape($info['user_data'][$cur_poster['poster_id']]['email']);
            ?>
"><?php 
            echo Utils::escape($info['user_data'][$cur_poster['poster_id']]['email']);
            ?>
</a></td>
                    <td class="tc3"><?php 
            echo Utils::get_title($info['user_data'][$cur_poster['poster_id']]);
            ?>
</td>
                    <td class="tc4"><?php 
            echo Utils::forum_number_format($info['user_data'][$cur_poster['poster_id']]['num_posts']);
            ?>
</td>
                    <td class="tc5"><?php 
            echo $info['user_data'][$cur_poster['poster_id']]['admin_note'] != '' ? Utils::escape($info['user_data'][$cur_poster['poster_id']]['admin_note']) : '&#160;';
            ?>
</td>
                    <td class="tcr"><?php 
            echo '<a href="' . Router::pathFor('usersIpStats', ['id' => $info['user_data'][$cur_poster['poster_id']]['id']]) . '">' . __('Results view IP link') . '</a> | <a href="' . Router::pathFor('search') . '?action=show_user_posts&amp;user_id=' . $info['user_data'][$cur_poster['poster_id']]['id'] . '">' . __('Results show posts link') . '</a>';
            ?>
</td>
                </tr>
<?php 
        } else {
            ?>
                <tr>
Ejemplo n.º 16
0
					<input type="hidden" name="prune_sticky" value="<?php 
echo $prune_sticky;
?>
" />
					<input type="hidden" name="prune_from" value="<?php 
echo $prune_from;
?>
" />
					<fieldset>
						<legend><?php 
_e('Confirm prune subhead');
?>
</legend>
						<div class="infldset">
							<p><?php 
printf(__('Confirm prune info'), $prune['days'], $prune['forum'], Utils::forum_number_format($prune['num_topics']));
?>
</p>
							<p class="warntext"><?php 
_e('Confirm prune warn');
?>
</p>
						</div>
					</fieldset>
				</div>
				<p class="buttons"><input type="submit" name="prune_comply" value="<?php 
_e('Prune');
?>
" /><a href="javascript:history.go(-1)"><?php 
_e('Go back');
?>
Ejemplo n.º 17
0
					<div class="infldset">
						<input type="hidden" name="form_sent" value="1" />
						<input type="hidden" name="MAX_FILE_SIZE" value="<?php 
echo $feather->forum_settings['o_avatars_size'];
?>
" />
						<label class="required"><strong><?php 
_e('File');
?>
 <span><?php 
_e('Required');
?>
</span></strong><br /><input name="req_file" type="file" size="40" /><br /></label>
						<p><?php 
_e('Avatar desc');
echo ' ' . $feather->forum_settings['o_avatars_width'] . ' x ' . $feather->forum_settings['o_avatars_height'] . ' ' . __('pixels') . ' ' . __('and') . ' ' . Utils::forum_number_format($feather->forum_settings['o_avatars_size']) . ' ' . __('bytes') . ' (' . $feather->utils->file_size($feather->forum_settings['o_avatars_size']) . ').';
?>
</p>
					</div>
				</fieldset>
			</div>
			<p class="buttons"><input type="submit" name="upload" value="<?php 
_e('Upload');
?>
" /> <a href="javascript:history.go(-1)"><?php 
_e('Go back');
?>
</a></p>
		</form>
	</div>
</div>
Ejemplo n.º 18
0
foreach ($userlist_data as $user) {
    ?>
					<tr>
						<td class="tcl"><?php 
    echo '<a href="' . $feather->urlFor('userProfile', ['id' => $user['id']]) . '">' . Utils::escape($user['username']) . '</a>';
    ?>
</td>
						<td class="tc2"><?php 
    echo Utils::get_title($user);
    ?>
</td>
	<?php 
    if ($show_post_count) {
        ?>
					<td class="tc3"><?php 
        echo Utils::forum_number_format($user['num_posts']);
        ?>
</td>
	<?php 
    }
    ?>
						<td class="tcr"><?php 
    echo $feather->utils->format_time($user['registered'], true);
    ?>
</td>
					</tr>
			<?php 
}
if (empty($userlist_data)) {
    echo "\t\t\t" . '<tr>' . "\n\t\t\t\t\t" . '<td class="tcl" colspan="' . ($show_post_count ? 4 : 3) . '">' . __('No hits') . '</td></tr>' . "\n";
}
Ejemplo n.º 19
0
 public function check_errors_before_post($fid, $tid, $qid, $pid, $page, $errors)
 {
     global $lang_antispam, $lang_antispam_questions;
     $fid = $this->hook->fire('check_errors_before_post_start', $fid);
     // Antispam feature
     if ($this->user->is_guest) {
         // It's a guest, so we have to validate the username
         $profile = new \FeatherBB\Model\Profile();
         $errors = $profile->check_username(Utils::trim($this->request->post('req_username')), $errors);
         $errors = $this->hook->fire('check_errors_before_post_antispam', $errors);
         $question = $this->request->post('captcha_q') ? trim($this->request->post('captcha_q')) : '';
         $answer = $this->request->post('captcha') ? strtoupper(trim($this->request->post('captcha'))) : '';
         $lang_antispam_questions_array = array();
         foreach ($lang_antispam_questions as $k => $v) {
             $lang_antispam_questions_array[md5($k)] = strtoupper($v);
         }
         if (empty($lang_antispam_questions_array[$question]) || $lang_antispam_questions_array[$question] != $answer) {
             $errors[] = __('Robot test fail');
         }
     }
     // Flood protection
     if ($this->request->post('preview') != '' && $this->user->last_post != '' && time() - $this->user->last_post < $this->user->g_post_flood) {
         $errors[] = sprintf(__('Flood start'), $this->user->g_post_flood, $this->user->g_post_flood - (time() - $this->user->last_post));
     }
     // If it's a new topic
     if ($fid) {
         $subject = Utils::trim($this->request->post('req_subject'));
         $subject = $this->hook->fire('check_errors_before_new_topic_subject', $subject);
         if ($this->config['o_censoring'] == '1') {
             $censored_subject = Utils::trim(Utils::censor($subject));
             $censored_subject = $this->hook->fire('check_errors_before_censored', $censored_subject);
         }
         if ($subject == '') {
             $errors[] = __('No subject');
         } elseif ($this->config['o_censoring'] == '1' && $censored_subject == '') {
             $errors[] = __('No subject after censoring');
         } elseif (Utils::strlen($subject) > 70) {
             $errors[] = __('Too long subject');
         } elseif ($this->config['p_subject_all_caps'] == '0' && Utils::is_all_uppercase($subject) && !$this->user->is_admmod) {
             $errors[] = __('All caps subject');
         }
         $errors = $this->hook->fire('check_errors_before_new_topic_errors', $errors);
     }
     if ($this->user->is_guest) {
         $email = strtolower(Utils::trim($this->config['p_force_guest_email'] == '1' ? $this->request->post('req_email') : $this->request->post('email')));
         if ($this->config['p_force_guest_email'] == '1' || $email != '') {
             $errors = $this->hook->fire('check_errors_before_post_email', $errors, $email);
             if (!$this->email->is_valid_email($email)) {
                 $errors[] = __('Invalid email');
             }
             // Check if it's a banned email address
             // we should only check guests because members' addresses are already verified
             if ($this->user->is_guest && $this->email->is_banned_email($email)) {
                 if ($this->config['p_allow_banned_email'] == '0') {
                     $errors[] = __('Banned email');
                 }
                 $errors['banned_email'] = 1;
                 // Used later when we send an alert email
             }
         }
     }
     // Clean up message from POST
     $message = Utils::linebreaks(Utils::trim($this->request->post('req_message')));
     $message = $this->hook->fire('check_errors_before_post_message', $message);
     // Here we use strlen() not Utils::strlen() as we want to limit the post to FEATHER_MAX_POSTSIZE bytes, not characters
     if (strlen($message) > $this->feather->forum_env['FEATHER_MAX_POSTSIZE']) {
         $errors[] = sprintf(__('Too long message'), Utils::forum_number_format($this->feather->forum_env['FEATHER_MAX_POSTSIZE']));
     } elseif ($this->config['p_message_all_caps'] == '0' && Utils::is_all_uppercase($message) && !$this->user->is_admmod) {
         $errors[] = __('All caps message');
     }
     // Validate BBCode syntax
     if ($this->config['p_message_bbcode'] == '1') {
         $message = $this->feather->parser->preparse_bbcode($message, $errors);
         $message = $this->hook->fire('check_errors_before_post_bbcode', $message);
     }
     if (empty($errors)) {
         $errors = $this->hook->fire('check_errors_before_post_no_error', $errors);
         if ($message == '') {
             $errors[] = __('No message');
         } elseif ($this->config['o_censoring'] == '1') {
             // Censor message to see if that causes problems
             $censored_message = Utils::trim(Utils::censor($message));
             if ($censored_message == '') {
                 $errors[] = __('No message after censoring');
             }
         }
     }
     $errors = $this->hook->fire('check_errors_before_post', $errors);
     return $errors;
 }