function render() { // load the list of blogs $blogs = new Blogs(); $siteBlogs = $blogs->getAllBlogs(); $this->setValue('siteblogs', $siteBlogs); $this->setValue('userStatusList', UserStatus::getStatusList()); parent::render(); }
function render() { // we need to get all the blogs // get the data itself $this->_status = $this->getStatusFromRequest(); $blogs = new Blogs(); $siteBlogs = $blogs->getAllBlogs($this->_status, $this->_page, DEFAULT_ITEMS_PER_PAGE); $numBlogs = $blogs->getNumBlogs($this->_status); if (!$siteBlogs) { $siteBlogs = array(); } // throw the right event $this->notifyEvent(EVENT_BLOGS_LOADED, array("blogs" => &$siteBlogs)); // calculate the links to the different pages $pager = new Pager("?op=editSiteBlogs&status=" . $this->_status . "&page=", $this->_page, $numBlogs, DEFAULT_ITEMS_PER_PAGE); $this->setValue("siteblogs", $siteBlogs); $this->setValue("pager", $pager); $this->setValue("currentstatus", $this->_status); $this->setValue("blogstatus", BlogStatus::getStatusList(true)); // let the parent view do its job parent::render(); }
function render() { // do nothing if the contents of our view are cached if ($this->isCached()) { parent::render(); return true; } // get the data itself $blogs = new Blogs(); $siteBlogs = $blogs->getAllBlogs(BLOG_STATUS_ACTIVE, $this->_page, $this->_numBlogsPerPage); $numBlogs = $blogs->getNumBlogs(BLOG_STATUS_ACTIVE); if (!$siteBlogs) { // if there was an error, show the error view $siteBlogs = array(); } // calculate the links to the different pages $pager = new Pager("?op=BlogList&page=", $this->_page, $numBlogs, $this->_numBlogsPerPage); $this->setValue("blogs", $siteBlogs); $this->setValue("pager", $pager); // let the parent view do its job parent::render(); }
/** * Loads the posts and shows them. */ function perform() { $this->_view = new SummaryCachedView("index", array("summary" => "default", "locale" => $this->_locale->getLocaleCode())); if ($this->_view->isCached()) { // if the view is already cached... move along! nothing to see here return true; } $blogs = new Blogs(); $stats = new SummaryStats(); // load the posts, filtering out all those registration messages... $registerTopic = $this->_locale->tr("register_default_article_topic"); $registerText = $this->_locale->tr("register_default_article_text"); $recentPosts = $stats->getRecentArticles($this->_numPosts, $registerTopic, $registerText); // get all the blogs $siteBlogs = $blogs->getAllBlogs(true); $recentBlogs = $stats->getRecentBlogs($this->_numPosts); $activeBlogs = $stats->getMostActiveBlogs($this->_numPosts); $commentedPosts = $stats->getMostCommentedArticles($this->_numPosts, $registerTopic, $registerText); $readestBlogs = $stats->getMostReadArticles($this->_numPosts, $registerTopic, $registerText); // export all these things to the view $this->_view->setValue("posts", $recentPosts); $this->_view->setValue("recentBlogs", $recentBlogs); $this->_view->setValue("activeBlogs", $activeBlogs); $this->_view->setValue("commentedPosts", $commentedPosts); $this->_view->setValue("readestBlogs", $readestBlogs); $this->_view->setValue("blogs", $siteBlogs); // // :KLUDGE: // we just need a random blog so... we'll get one :) // $randomBlog = array_pop($siteBlogs); $url = $randomBlog->getBlogRequestGenerator(); $this->_view->setValue("url", $url); $this->setCommonData(); return true; }
$userInfo = $users->getUserInfo($request->getUser(), $request->getPassword()); if (!$userInfo) { $response = new MoblogResponse($request->getReplyTo(), "pLog Moblog: Error", "User or password are not correct."); MoblogLogger::log("User " . $request->getUser() . " did not authenticate correctly."); $response->send(); return false; } // // if user was authenticated, then proceed... and the first thing we should do // is see if the blog id is correct and if the user has permissions in that // blog // $blogs = new Blogs(); if ($request->getBlogId() == "") { // user gave a blog name instead of a blog id $allBlogs = $blogs->getAllBlogs(); if ($allBlogs) { $found = false; $blogName = stripslashes($request->getBlogName()); while (!$found && !empty($allBlogs)) { $blogInfo = array_pop($allBlogs); if (strcasecmp($blogInfo->getBlog(), $blogName) == 0) { $found = true; MoblogLogger::log("Blog '" . $blogInfo->getBlog() . "' found with id = '" . $blogInfo->getId() . "'"); } } if (!$found) { $response = new MoblogResponse($request->getReplyTo(), "pLog Moblog: Error", "Incorrect blog."); MoblogLogger::log("Blog " . $request->getBlogId() . " does not exist."); $response->send(); return false;