protected function _content() { global $dbtable_prefix; global $page_last_modified_time; $query = "SELECT a.`post_id`,UNIX_TIMESTAMP(a.`last_changed`) as `last_changed` FROM `{$dbtable_prefix}blog_posts` a WHERE a.`is_public`=1 AND a.`status`=" . STAT_APPROVED; switch ($this->config['mode']) { case 'new': $query .= " ORDER BY a.`date_posted` DESC"; break; case 'views': $query .= " AND a.`stat_views`>0 ORDER BY a.`stat_views` DESC"; break; case 'comm': $query .= " AND a.`stat_comments`>0 ORDER BY a.`stat_comments` DESC"; break; } $query .= " LIMIT " . $this->config['total']; if (!($res = @mysql_query($query))) { trigger_error(mysql_error(), E_USER_ERROR); } $post_ids = array(); while ($rsrow = mysql_fetch_assoc($res)) { $post_ids[] = $rsrow['post_id']; if ($page_last_modified_time < $rsrow['last_changed']) { $page_last_modified_time = $rsrow['last_changed']; } } if (!empty($post_ids)) { require_once _BASEPATH_ . '/includes/classes/blog_posts_cache.class.php'; $blog_posts_cache = new blog_posts_cache(); $loop = $blog_posts_cache->get_tpl_array($post_ids); unset($blog_posts_cache); for ($i = 0; isset($loop[$i]); ++$i) { $loop[$i]['date_posted'] = strftime($_SESSION[_LICENSE_KEY_]['user']['prefs']['datetime_format'], $loop[$i]['date_posted'] + $_SESSION[_LICENSE_KEY_]['user']['prefs']['time_offset']); if (isset($GLOBALS['_list_of_online_members'][$loop[$i]['fk_user_id']])) { $loop[$i]['is_online'] = 'is_online'; $loop[$i]['user_online_status'] = $GLOBALS['_lang'][102]; } else { $loop[$i]['user_online_status'] = $GLOBALS['_lang'][103]; } } if (!empty($loop)) { $loop[0]['class'] = 'first'; $loop[count($loop) - 1]['class'] = 'last'; $this->tpl->set_file('widget.content', 'widgets/blogs/display.html'); $this->tpl->set_loop('loop', $loop); $this->tpl->process('widget.content', 'widget.content', TPL_LOOP | TPL_OPTLOOP); $this->tpl->drop_loop('loop'); unset($loop); } } }
if (!($res = @mysql_query($query))) { trigger_error(mysql_error(), E_USER_ERROR); } } } $output['totalrows'] = count($post_ids); // get the results from user cache for the found post_ids $loop = array(); if (!empty($output['totalrows'])) { if ($o >= $output['totalrows']) { $o = $output['totalrows'] - $r; } $post_ids = array_slice($post_ids, $o, $r); require _BASEPATH_ . '/includes/classes/blog_posts_cache.class.php'; $blog_posts_cache = new blog_posts_cache(); $loop = $blog_posts_cache->get_tpl_array($post_ids); unset($blog_posts_cache); if (isset($input['tags'])) { $search_words = explode(' ', $input['tags']); $replace_words = array(); for ($i = 0; isset($search_words[$i]); ++$i) { $replace_words[$i] = '<span class="matched_word">' . $search_words[$i] . '</span>'; } } for ($i = 0; isset($loop[$i]); ++$i) { $loop[$i]['date_posted'] = strftime($_SESSION[_LICENSE_KEY_]['user']['prefs']['datetime_format'], $loop[$i]['date_posted'] + $_SESSION[_LICENSE_KEY_]['user']['prefs']['time_offset']); if (isset($_list_of_online_members[$loop[$i]['fk_user_id']])) { $loop[$i]['is_online'] = 'is_online'; $loop[$i]['user_online_status'] = $GLOBALS['_lang'][102]; } else { $loop[$i]['user_online_status'] = $GLOBALS['_lang'][103];