require_once 'userresponse.php'; require_once 'userreply.php'; require_once 'userresponse.php'; require_once 'userreply.php'; $GLOBALS['mysqli'] = MySQLConnection::Open(); //we're changed this around //first get the blog that we should be publishing right now - readyforpublish $blogsToPublish = array(); if ($categoryid == -1) { $blogsToPublish = PostFactory::GetAllPublishableBlogs(); } else { $blogs = null; if (is_numeric($categoryid)) { $blogs = PostFactory::GetBlogsByCategory($categoryid); } else { $blogs = PostFactory::GetBlogsByState($categoryid); } foreach ($blogs as $post) { if ($post->CanPublish && $post->ReadyForPublish) { array_push($blogsToPublish, $post); } } } $numberofblogspublished = 0; //go ahead only if at least there is at least one blog to publish - else NOTHING has changed if (sizeof($blogsToPublish) > 0) { //we're going to create an array of categories that we want to publish //these are categories of blogs that we are publishing right now $categoriesToPublish = array(); foreach ($blogsToPublish as $blogToPublish) { foreach ($blogToPublish->Categories as $category) {