function fill_query_vars($array)
 {
     // Should use 0, '' for empty values
     // Function should return false iff not set
     // parameters commented out are handled farther down
     $ints = array('tag_id', 'favorites', 'offset', 'number');
     $parse_ints = array('post_id', 'topic_id', 'forum_id', 'topic_author_id', 'post_count', 'tag_count', 'post_author_id', 'position');
     $dates = array('started', 'updated', 'posted');
     $others = array('topic', 'forum', 'tag', 'topic_author', 'topic_status', 'open', 'sticky', 'meta_key', 'meta_value', 'topic_title', 'search', 'post_author', 'post_status', 'post_text', 'poster_ip', 'index_hint', 'order_by', 'order', 'count', '_join_type', 'cache_posts');
     foreach ($ints as $key) {
         if (false === ($array[$key] = isset($array[$key]) ? (int) $array[$key] : false) && isset($this)) {
             $this->not_set[] = $key;
         }
     }
     foreach ($parse_ints as $key) {
         if (false === ($array[$key] = isset($array[$key]) ? preg_replace('/[^<=>0-9,-]/', '', $array[$key]) : false) && isset($this)) {
             $this->not_set[] = $key;
         }
     }
     foreach ($dates as $key) {
         if (false === ($array[$key] = isset($array[$key]) ? preg_replace('/[^<>0-9-]/', '', $array[$key]) : false) && isset($this)) {
             $this->not_set[] = $key;
         }
     }
     foreach ($others as $key) {
         if (!isset($array[$key])) {
             $array[$key] = false;
         }
         if (isset($this) && false === $array[$key]) {
             $this->not_set[] = $key;
         }
     }
     // Both
     if (isset($array['page'])) {
         $array['page'] = (int) $array['page'];
     } elseif (isset($GLOBALS['page'])) {
         $array['page'] = (int) $GLOBALS['page'];
     } else {
         $array['page'] = bb_get_uri_page();
     }
     if ($array['page'] < 1) {
         $array['page'] = 1;
     }
     $array['per_page'] = isset($array['per_page']) ? (int) $array['per_page'] : 0;
     if ($array['per_page'] < -1) {
         $array['per_page'] = 1;
     }
     // Posts
     if (!($array['poster_ip'] = isset($array['poster_ip']) ? preg_replace("@[^0-9a-f:.]@i", '', $array['poster_ip']) : false) && isset($this)) {
         $this->not_set[] = 'poster_ip';
         $array['poster_ip'] = false;
     }
     // Utility
     $array['append_meta'] = isset($array['append_meta']) ? (int) (bool) $array['append_meta'] : 1;
     $array['cache_users'] = isset($array['cache_users']) ? (int) (bool) $array['cache_users'] : 1;
     $array['cache_topics'] = isset($array['cache_topics']) ? (int) (bool) $array['cache_topics'] : 1;
     $array['post_id_only'] = isset($array['post_id_only']) ? (int) (bool) $array['post_id_only'] : 1;
     // Only one FULLTEXT search per query please
     if ($array['search']) {
         $array['post_text'] = false;
     }
     return $array;
 }
Example #2
0
/**
 * Get details of the current user
 */
bb_current_user();
/**
 * Initialise CRON
 */
if (!function_exists('nxt_schedule_single_event')) {
    require_once BACKPRESS_PATH . 'functions.nxt-cron.php';
}
if (!defined('DOING_CRON') || !DOING_CRON) {
    nxt_cron();
}
/**
 * The currently viewed page number
 */
$page = bb_get_uri_page();
/**
 * Initialisation complete API hook
 */
do_action('bb_init');
/**
 * Block user if they deserve it
 */
if (bb_is_user_logged_in() && bb_has_broken_pass()) {
    bb_block_current_user();
}
/**
 * Send HTTP headers
 */
bb_send_headers();