// controller: make $filter_condition string switch ($_GET['type']) { case 'recent': $filter_condition = 'blog_datestamp DESC'; break; case 'comment': $filter_condition = 'count_comment DESC'; break; case 'rating': $filter_condition = 'sum_rating DESC'; break; default: $filter_condition = 'blog_datestamp DESC'; } if (isset($_GET['readmore']) && isnum($_GET['readmore'])) { if (validate_blog($_GET['readmore'])) { $result = dbquery("SELECT tn.*, tu.*,\n\t\t\t\t\tSUM(tr.rating_vote) AS sum_rating,\n\t\t\t\t\tCOUNT(tr.rating_item_id) AS count_votes,\n\t\t\t\t\tCOUNT(td.comment_item_id) AS count_comment,\n\t\t\t\t\ttn.blog_datestamp as last_updated\n\t\t\t\t\tFROM " . DB_BLOG . " tn\n\t\t\t\t\tLEFT JOIN " . DB_USERS . " tu ON tn.blog_name=tu.user_id\n\t\t\t\t\tLEFT JOIN " . DB_RATINGS . " tr ON tr.rating_item_id = tn.blog_id AND tr.rating_type='B'\n\t\t\t\t\tLEFT JOIN " . DB_COMMENTS . " td ON td.comment_item_id = tn.blog_id AND td.comment_type='B' AND td.comment_hidden='0'\n\t\t\t\t\t" . (multilang_table("BL") ? "WHERE blog_language='" . LANGUAGE . "' AND" : "WHERE") . " " . groupaccess('blog_visibility') . " AND\n\t\t\t\t\tblog_id='" . $_GET['readmore'] . "' AND blog_draft='0'\n\t\t\t\t\tGROUP BY blog_id\n\t\t\t\t\t"); $info['blog_rows'] = dbrows($result); if ($info['blog_rows'] > 0) { include INCLUDES . "comments_include.php"; include INCLUDES . "ratings_include.php"; $item = dbarray($result); unset($item['user_password']); unset($item['user_algo']); unset($item['user_salt']); unset($item['user_admin_password']); unset($item['user_admin_algo']); unset($item['user_admin_salt']); $blog_blog = parse_textarea($item['blog_blog']); $blog_extended = parse_textarea($item['blog_extended']); $item += array("blog_subject" => "<a class='blog_subject text-dark' href='" . INFUSIONS . "blog/blog.php?readmore=" . $item['blog_id'] . "'>" . $item['blog_subject'] . "</a>", "blog_blog" => preg_replace("/<!?--\\s*pagebreak\\s*-->/i", "", $item['blog_breaks'] == "y" ? nl2br($blog_blog) : $blog_blog), "blog_extended" => preg_split("/<!?--\\s*pagebreak\\s*-->/i", $item['blog_breaks'] == "y" ? nl2br($blog_extended) : $blog_extended), "blog_pagecount" => 1, "print_link" => BASEDIR . "print.php?type=B&item_id=" . $item['blog_id'], "blog_post_author" => display_avatar($item, '25px', '', TRUE, 'img-rounded') . profile_link($item['user_id'], $item['user_name'], $item['user_status']), "blog_category_link" => "", "blog_post_time" => $locale['global_049'] . " " . timer($item['blog_datestamp']));
/** * Controller for validation of zones * * @param string $zone (blog, vm or group) * @return boolean */ function validate_zone($zone) { switch ($zone) { case 'blog': return validate_blog(); break; case 'group': return validate_group(); break; case 'vm': return validate_vm(); break; } return false; }