示例#1
0
function bb_timer_stop($display = 0, $precision = 3)
{
    //if called like bb_timer_stop(1), will echo $timetotal
    global $bb_timestart, $timeend;
    $mtime = explode(' ', microtime());
    $timeend = $mtime[1] + $mtime[0];
    $timetotal = $timeend - $bb_timestart;
    if ($display) {
        echo bb_number_format_i18n($timetotal, $precision);
    }
    return bb_number_format_i18n($timetotal, $precision);
}
 function do_paging()
 {
     global $bb_current_submenu;
     $displaying_num = sprintf(__('%1$s to %2$s of %3$s'), bb_number_format_i18n(($this->page - 1) * $this->users_per_page + 1), $this->page * $this->users_per_page < $this->total_users_for_query ? bb_number_format_i18n($this->page * $this->users_per_page) : '<span class="total-type-count">' . bb_number_format_i18n($this->total_users_for_query) . '</span>', '<span class="total-type-count">' . bb_number_format_i18n($this->total_users_for_query) . '</span>');
     $page_number_links = $this->total_users_for_query > $this->users_per_page ? get_page_number_links($this->page, $this->total_users_for_query, $this->users_per_page, false) : '';
     $this->paging_text = "<div class='tablenav-pages'><span class='displaying-num'>{$displaying_num}</span><span class=\"displaying-pages\">{$page_number_links}</span><div class=\"clear\"></div></div>\n";
     $this->paging_text_bottom = "<div class='tablenav-pages'><span class=\"displaying-pages\">{$page_number_links}</span><div class=\"clear\"></div></div>\n";
 }
function bb_topic_tags_per_day()
{
    echo apply_filters('bb_topic_tags_per_day', bb_number_format_i18n(bb_get_topic_tags_per_day(), 3));
}
示例#4
0
</h2>
<?php 
do_action('bb_admin_notices');
?>

<?php 
$post_query->form(array('poster_ip' => $ip_available, 'tag' => true, 'post_author' => true, 'post_status' => true, 'submit' => __('Filter')));
?>

<div class="tablenav">
<?php 
if ($total) {
    ?>
	<div class="tablenav-pages">
		<span class="displaying-num"><?php 
    echo $displaying_num = sprintf(__('%1$s to %2$s of %3$s'), bb_number_format_i18n(($page - 1) * $post_query->get('per_page') + 1), $page * $post_query->get('per_page') < $total ? bb_number_format_i18n($page * $post_query->get('per_page')) : '<span class="total-type-count">' . bb_number_format_i18n($total) . '</span>', '<span class="total-type-count">' . bb_number_format_i18n($total) . '</span>');
    ?>
</span><span class="displaying-pages">
<?php 
    $_page_link_args = array('page' => $page, 'total' => $total, 'per_page' => $post_query->get('per_page'), 'mod_rewrite' => false, 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'));
    echo $page_number_links = get_page_number_links($_page_link_args);
    ?>
</span>
		<div class="clear"></div>
	</div>
<?php 
}
?>
</div>
<div class="clear"></div>
示例#5
0
		</div>
	</div>
	<div id="footer" role="contentinfo">
		<p><?php 
printf(__('%1$s is proudly powered by <a href="%2$s">bbPress</a>.'), bb_option('name'), "http://bbpress.org");
?>
. <a href="http://www.simplescripts.com" title="install bbpress">Install bbPress</a></p>

		<!-- If you like showing off the fact that your server rocks -->
		<!-- <p class="showoff">
<?php 
global $bbdb;
printf(__('This page generated in %s seconds, using %d queries.'), bb_number_format_i18n(bb_timer_stop(), 2), bb_number_format_i18n($bbdb->num_queries));
?>
		</p> -->
	</div>

<?php 
do_action('bb_foot');
?>

</body>
</html>
示例#6
0
function bb_attachments_post_attachments($post_id = 0)
{
    global $bbdb, $bb_attachments, $bb_attachments_cache, $bb_current_user;
    $output = "";
    if ($post_id && ($bb_attachments['role']['see'] == "read" || bb_current_user_can($bb_attachments['role']['see']))) {
        $time = time() - 60;
        $can_delete = false;
        $self = false;
        $admin = false;
        $filter = true;
        // " AND status = 0 "; 	// speedup checks with flag
        if ($bb_current_user->ID == get_post_author_id($post_id)) {
            $self = true;
        }
        if ((!is_topic() || isset($_GET['bb_attachments'])) && bb_current_user_can('moderate')) {
            $filter = "";
            $admin = bb_current_user_can('administrate');
        }
        if (bb_current_user_can($bb_attachments['role']['delete']) && bb_current_user_can('edit_post', $post_id)) {
            $can_delete = true;
        }
        $location = bb_attachments_location();
        $can_inline = true;
        if (!($bb_attachments['role']['inline'] == "read" || bb_current_user_can($bb_attachments['role']['inline']))) {
            $can_inline = false;
        }
        if (!isset($bb_attachments_cache[$post_id])) {
            $bb_attachments_cache[$post_id] = $bbdb->get_results("SELECT * FROM " . $bb_attachments['db'] . " WHERE post_id = {$post_id} ORDER BY time DESC LIMIT 999");
        }
        if (count($bb_attachments_cache[$post_id])) {
            foreach ($bb_attachments_cache[$post_id] as $attachment) {
                $showerror = $self && $attachment->time > $time ? true : false;
                if ($attachment->status == 0 || empty($filter) || $showerror) {
                    $attachment->filename = stripslashes($attachment->filename);
                    $output .= "<li>";
                    $output .= "<span" . ($attachment->status > 0 ? " class='deleted' " : "") . "> ";
                    if ($attachment->status > 0) {
                        $icon = "missing.gif";
                    } else {
                        if (isset($bb_attachments['icons'][$attachment->ext])) {
                            $icon = $bb_attachments['icons'][$attachment->ext];
                        } else {
                            $icon = $bb_attachments['icons']['default'];
                        }
                    }
                    $output .= " <img align='absmiddle' title='" . $attachment->ext . "' src='" . $bb_attachments['icons']['url'] . $icon . "' /> ";
                    if ($attachment->status > 0 && (empty($filter) || $showerror)) {
                        $output .= " [" . __($bb_attachments['status'][$attachment->status]) . "] {$attachment->filename} ";
                    }
                    if ($attachment->status == 0) {
                        $output .= " " . "<a href='" . attribute_escape(add_query_arg('bbat', $attachment->id, add_query_arg('bb_attachments', $attachment->post_id, remove_query_arg(array('bb_attachments', 'bbat', 'bbat_delete'))))) . "'>" . $attachment->filename . "</a> " . " ";
                    }
                    $output .= " <span class='num'>(" . round($attachment->size / 1024, 1) . " KB";
                    if ($attachment->status < 2) {
                        $output .= ", " . bb_number_format_i18n($attachment->downloads) . " " . __('downloads');
                    }
                    $output .= ")</span> ";
                    if ($attachment->time < $time) {
                        $output .= " <small>" . bb_since($attachment->time) . " " . __('old') . "</small> ";
                    }
                    if ($admin) {
                        $output .= ' [<a href="' . attribute_escape(bb_get_option('uri') . 'bb-admin/view-ip.php?ip=' . long2ip($attachment->user_ip)) . '">' . long2ip($attachment->user_ip) . '</a>] ';
                    }
                    if ($attachment->status == 0 && $can_delete) {
                        $output .= ' [<a onClick="return confirm(' . "'" . __('Delete') . " {$attachment->filename} ?" . "'" . ')" href="' . add_query_arg('bbat_delete', $attachment->id) . '">x</a>] ';
                    }
                    if ($attachment->status == 0 && $location == "edit.php" && $can_inline) {
                        $fullpath = $bb_attachments['path'] . floor($attachment->id / 1000) . "/" . $attachment->id . "." . $attachment->filename;
                        if (list($width, $height, $type) = getimagesize($fullpath)) {
                            $output .= " [<strong><a href='#' onclick='bbat_inline_insert({$attachment->post_id},{$attachment->id}); return false;'>" . __("INSERT") . "</a></strong>] ";
                        }
                    }
                    $output .= " </span></li>";
                }
            }
        }
        if ($output) {
            $output = "<h3>" . __("Attachments") . "</h3><ol>" . $output . "</ol>";
        }
        if ($location == "edit.php") {
            $output .= '<scr' . 'ipt type="text/javascript" defer="defer">
	function bbat_inline_insert(post_id,id) {
	bbat_field = document.getElementsByTagName("textarea")[0];
	bbat_value="[attachment="+post_id+","+id+"]";
	if (document.selection) {bbat_field.focus(); sel = document.selection.createRange();sel.text = bbat_value;}
	else if (bbat_field.selectionStart || bbat_field.selectionStart == "0") {var startPos = bbat_field.selectionStart; var endPos = bbat_field.selectionEnd;
		bbat_field.value = bbat_field.value.substring(0, startPos)+ bbat_value+ bbat_field.value.substring(endPos, bbat_field.value.length);
	} else {bbat_field.value += bbat_value;}
return false;} </script>';
        }
    }
    if (is_bb_feed()) {
        $output = wp_specialchars($output);
    }
    return $output;
}
示例#7
0
</h3>
	<ol>
<?php 
    foreach ($popular as $topic) {
        ?>
		<li><?php 
        bb_topic_labels();
        ?>
 <a href="<?php 
        topic_link();
        ?>
"><?php 
        topic_title();
        ?>
</a> &#8212; <?php 
        printf(_n('%s post', '%s posts', get_topic_posts()), bb_number_format_i18n(get_topic_posts()));
        ?>
</li>
<?php 
    }
    ?>
	</ol>
<?php 
}
?>

<?php 
do_action('bb_stats_right');
?>
</div>
示例#8
0
function nospamuser_stats_display()
{
    if (bb_is_statistics() && ($settings = bb_get_option('nospamuser-settings')) && $settings['stats-public'] & 1 && ($blocks = (int) bb_get_option('nospamuser-blocks'))) {
        echo '<dt>' . sprintf(__('Spammers blocked by <a href="%s" rel="nofollow">bb-NoSpamUser</a>', 'nospamuser'), 'http://bbpress.org/plugins/topic/nospamuser/') . '</dt><dd><strong>' . bb_number_format_i18n($blocks) . '</strong></dd>';
    }
}
            ?>
					Or you may straight away go to <a href="w2bc.php?mode=users">converting posts to topics</a> (their categories to forums, tags, and comments to replies) or to <a href="w2bc.php?mode=replies">syncing comments to replies</a>.
                <?php 
        }
        ?>
            </li>

		</ul>

        <?php 
        break;
}
?>
			<p class="small">
                <?php 
printf('This page generated in %s seconds, using %d - %d (WP - bb) queries. Memory - %s MB used out of allocated %s MB.', timer_stop(), bb_number_format_i18n($wpdb->num_queries), bb_number_format_i18n($bbdb->num_queries), round(memory_get_peak_usage(true) / (1024 * 1024), 2), absint(@ini_get('memory_limit')));
?>
				WP to bb Converter (W2bC) made by <a href="http://gaut.am/">Gautam</a> (<a href="http://twitter.com/_GautamGupta_">twitter</a>) - ver. <?php 
echo W2BC_VER;
?>
.
			</p>
		</div>
		<?php 
if (defined('SAVEQUERIES') && SAVEQUERIES == true) {
    echo "\n\n\n<!--\n\n\nQueries:\n\n\n";
    print_r($wpdb->queries);
    print_r($bbdb->queries);
    echo "\n\n\n-->\n\n\n";
}
?>