/**
  * Constructor. If nothing else, it also has to call the constructor of the parent
  * class, BlogAction with the same parameters
  */
 function AdminUpdateLinkCategoryAction($actionInfo, $request)
 {
     $this->AdminAction($actionInfo, $request);
     // data validation
     $this->registerFieldValidator("linkCategoryName", new StringValidator());
     $this->registerFieldValidator("linkCategoryId", new IntegerValidator());
     $errorView = new AdminTemplatedView($this->_blogInfo, "editlinkcategory");
     $errorView->setErrorMessage($this->_locale->tr("error_updating_link_category"));
     $this->setValidationErrorView($view);
 }
 /**
  * Constructor. If nothing else, it also has to call the constructor of the parent
  * class, BlogAction with the same parameters
  */
 function AdminAddArticleCategoryAction($actionInfo, $request)
 {
     $this->AdminAction($actionInfo, $request);
     // register two validators
     $this->registerFieldValidator("categoryName", new StringValidator());
     $this->registerFieldValidator("categoryDescription", new StringValidator());
     $this->registerFieldValidator("categoryInMainPage", new EmptyValidator());
     // and the view we should show in case there is a validation error
     $errorView = new AdminTemplatedView($this->_blogInfo, "newpostcategory");
     $errorView->setErrorMessage($this->_locale->tr("error_adding_article_category"));
     $this->setValidationErrorView($errorView);
 }
 /**
  * Constructor. If nothing else, it also has to call the constructor of the parent
  * class, BlogAction with the same parameters
  */
 function AdminUpdateArticleCategoryAction($actionInfo, $request)
 {
     $this->AdminAction($actionInfo, $request);
     // data validation settings
     $this->registerFieldValidator("categoryName", new StringValidator());
     $this->registerFieldValidator("categoryId", new IntegerValidator());
     $this->registerFieldValidator("categoryDescription", new StringValidator());
     $this->registerFieldValidator("categoryInMainPage", new EmptyValidator());
     $errorView = new AdminTemplatedView($this->_blogInfo, "editarticlecategory");
     $errorView->setErrorMessage($this->_locale->tr("error_updating_article_category"));
     $this->setValidationErrorView($errorView);
 }
 function AdminAddBlogUserAction($actionInfo, $request)
 {
     $this->BlogOwnerAdminAction($actionInfo, $request);
     // data validation
     $this->registerFieldValidator("newBlogUserName", new StringValidator());
     $this->_sendNotification = $this->_request->getValue("sendNotification") != "";
     if ($this->_sendNotification) {
         $this->registerFieldValidator("newBlogUserText", new StringValidator());
     } else {
         $this->registerField("newBlogUserText");
     }
     $this->registerField("sendNotification");
     $view = new AdminTemplatedView($this->_blogInfo, "addbloguser");
     $view->setErrorMessage($this->_locale->tr("error_adding_user"));
     $this->setValidationErrorView($view);
 }
 /**
  * show the contents of the view
  */
 function render()
 {
     // load the comments and throw the correct event
     $comments = new ArticleComments();
     $postComments = $comments->getPostComments($this->_article->getId(), COMMENT_ORDER_NEWEST_FIRST, $this->_commentStatus, $this->_page, DEFAULT_ITEMS_PER_PAGE);
     $this->notifyEvent(EVENT_COMMENTS_LOADED, array("comments", &$postComments));
     // number of comments
     $numPostComments = $comments->getNumPostComments($this->_article->getId(), $this->_commentStatus);
     if ($this->_commentStatus > -1) {
         $pagerUrl = "?op=editComments&articleId=" . $this->_article->getId() . "&showStatus=" . $this->_commentStatus . "&page=";
     } else {
         $pagerUrl = "?op=editComments&articleId=" . $this->_article->getId() . "&page=";
     }
     // calculate the pager url
     $pager = new Pager($pagerUrl, $this->_page, $numPostComments, DEFAULT_ITEMS_PER_PAGE);
     // get a list with all the different comment status
     $statusList = ArticleCommentStatus::getStatusList(true);
     // and pass all the information to the templates
     $this->setValue("comments", $postComments);
     $this->setValue("commentstatus", $statusList);
     $this->setValue("currentstatus", $this->_commentStatus);
     // pass the pager to the view
     $this->setValue("pager", $pager);
     +$this->setValue("post", $this->_article);
     parent::render();
 }
 function render()
 {
     // load all the locale files
     $locales = new Locales();
     $siteLocales = $locales->getLocales();
     $this->setValue("locales", $siteLocales);
     parent::render();
 }
 function render()
 {
     $ts = new TemplateSets();
     // get all the template sets, without including the global ones
     $blogTemplateSets = $ts->getBlogTemplateSets($this->_blogInfo->getId(), false);
     $this->setValue("templates", $blogTemplateSets);
     parent::render();
 }
 function render()
 {
     // get all the users in the site
     $users = new Users();
     $siteUsers = $users->getAllUsers();
     $this->notifyEvent(EVENT_USERS_LOADED, array("users" => &$siteUsers));
     $this->setValue("siteusers", $siteUsers);
     parent::render();
 }
 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()
 {
     // get the users of the blog
     $users = new Users();
     $blogUsers = $users->getBlogUsers($this->_blogInfo->getId(), false);
     $this->setValue("blogusers", $blogUsers);
     // no need to do anything else, so... transfer control to the parent view!
     parent::render();
 }
 function render()
 {
     // load the nested list of albums
     $albums = new GalleryAlbums();
     $userAlbums = $albums->getNestedAlbumList($this->_blogInfo->getId());
     $this->notifyEvent(EVENT_ALBUMS_LOADED, array("albums" => &$userAlbums));
     $this->setValue("albums", $userAlbums);
     // let the parent view do its work
     parent::render();
 }
 function render()
 {
     // load the nested list of albums
     // fetch the albums for this blog
     $albums = new GalleryAlbums();
     $blogAlbums = $albums->getNestedAlbumList($this->_blogInfo->getId());
     $this->notifyEvent(EVENT_ALBUMS_LOADED, array("albums" => &$blogAlbums));
     $this->setValue("albums", $blogAlbums);
     parent::render();
 }
 function render()
 {
     // get all the albums
     $albums = new GalleryAlbums();
     $userAlbums = $albums->getNestedAlbumList($this->_blogInfo->getId());
     $this->notifyEvent(EVENT_ALBUMS_LOADED, array("albums" => &$userAlbums));
     $this->setValue("albums", $userAlbums);
     // transfer control to the parent class
     parent::render();
 }
 function render()
 {
     // get a list with all the global template sets
     $ts = new TemplateSets();
     $globalTemplates = $ts->getGlobalTemplateSets();
     $this->setValue("templates", $globalTemplates);
     $defaultTs = $ts->getDefaultTemplateSet();
     $this->setValue("defaultTemplate", $defaultTs->getName());
     parent::render();
 }
 /**
  * Carries out the specified action
  */
 function render()
 {
     // get all the link categories but we have to respect the order that the user asked
     $order = $this->getValue("showOrder");
     $linkCategories = new MyLinksCategories();
     $blogLinkCategories = $linkCategories->getMyLinksCategories($this->_blogInfo->getId(), $order);
     $this->notifyEvent(EVENT_LINK_CATEGORIES_LOADED, array("linkcategories" => &$blogLinkCategories));
     // put the data in the view
     $this->setValue("linkcategories", $blogLinkCategories);
     parent::render();
 }
 function render()
 {
     $this->setValue("blogsettings", $this->_blogInfo->getSettings());
     $ts = new TemplateSets();
     $templates = $ts->getBlogTemplateSets($this->_blogInfo->getId(), true);
     $this->setValue("templates", $templates);
     // loading all the locales from disk is a pretty heavy task but doing so, we'll get
     // nice Locale object with things like the encoding, the description, etc... which looks
     // waaaay nicer than just showing the locale code
     $this->setValue("locales", Locales::getLocales());
     parent::render();
 }
 function render()
 {
     // fetch the blogs to which this user belongs
     $users = new Users();
     $userBlogs = $users->getUsersBlogs($this->_user->getId());
     $this->notifyEvent(EVENT_BLOGS_LOADED, array('blogs' => &$userBlogs));
     // otherwise, transfer it to the template context and let the
     // template do the rest
     $this->setValue('edituser', $this->_user);
     $this->setValue('edituserblogs', $userBlogs);
     // list of available status
     $this->setValue('userStatusList', UserStatus::getStatusList());
     parent::render();
 }
 function render()
 {
     $referers = new Referers();
     $totalReferers = $referers->getBlogTotalReferers($this->_blogInfo->getId(), $this->_article->getId());
     $postReferers = $referers->getArticleReferers($this->_article->getId(), $this->_blogInfo->getId(), $this->_page, DEFAULT_ITEMS_PER_PAGE);
     if (!$blogReferers) {
         $blogReferers = array();
     }
     // calculate the links to the different pages
     $pager = new Pager("?op=postStats&postId=" . $this->_article->getId() . "&page=", $this->_page, $totalReferers, DEFAULT_ITEMS_PER_PAGE);
     $this->setValue("referrers", $postReferers);
     $this->setValue("pager", $pager);
     $this->setValue("post", $this->_article);
     parent::render();
 }
 /**
  * load the fields and pass them to the view
  */
 function render()
 {
     // load the custom fields that have been defined so far
     $customFields = new CustomFields();
     $blogFields = $customFields->getBlogCustomFields($this->_blogInfo->getId(), true, $this->_page, DEFAULT_ITEMS_PER_PAGE);
     $this->notifyEvent(EVENT_CUSTOM_FIELDS_LOADED, array("fields" => &$blogFields));
     // and the total number of them too
     $numBlogFields = $customFields->getNumBlogCustomFields($this->_blogInfo->getId());
     // create the pager
     $pager = new Pager("?op=blogCustomFields&page=", $this->_page, $numBlogFields, DEFAULT_ITEMS_PER_PAGE);
     // and show them
     $this->setValue("fields", $blogFields);
     $this->setValue("pager", $pager);
     return parent::render();
 }
 function render()
 {
     // get the page from the request
     $this->_page = $this->getCurrentPageFromRequest();
     // and the current album
     $galleryAlbums = new GalleryAlbums();
     $galleryResources = new GalleryResources();
     if ($this->_albumId > ROOT_ALBUM_ID && $this->_page > 0) {
         $album = $galleryAlbums->getAlbum($this->_albumId, $this->_blogInfo->getId());
         if (!$album || $album == "") {
             $this->_albumId = ROOT_ALBUM_ID;
         } else {
             //$resources = $album->getResources();
             $resources = $galleryResources->getUserResources($this->_blogInfo->getId(), $this->_albumId, $this->_resourceType, $this->_page, DEFAULT_ITEMS_PER_PAGE);
             $numResources = $galleryResources->getNumUserResources($this->_blogInfo->getId(), $this->_albumId, $this->_resourceType);
         }
     } else {
         $albums = $galleryAlbums->getChildAlbums($this->_albumId, $this->_blogInfo->getId());
         $resources = array();
     }
     // get a list with the nested albums
     $userAlbums = $galleryAlbums->getNestedAlbumList($this->_blogInfo->getId());
     // event about the albums we just loaded
     $this->notifyEvent(EVENT_ALBUMS_LOADED, array("albums" => &$userAlbums));
     $this->setValue("albumsList", $userAlbums);
     // fetch some statistics and continue
     $quotaUsage = GalleryResourceQuotas::getBlogResourceQuotaUsage($this->_blogInfo->getId());
     $totalResources = $galleryResources->getNumResources($this->_blogInfo->getId());
     $currentQuota = GalleryResourceQuotas::getBlogResourceQuota($this->_blogInfo->getId());
     $this->setValue("quotausage", $quotaUsage);
     $this->setValue("totalresources", $totalResources);
     $this->setValue("quota", $currentQuota);
     // and now export info about the albums and so on but only
     // if we're browsing the first page only (albums do not appear anymore after the first page)
     $this->setValue("album", $album);
     if ($this->_albumId > ROOT_ALBUM_ID && $this->_page < 2) {
         $this->setValue("albums", $album->getChildren());
     } else {
         $this->setValue("albums", $albums);
     }
     // event about the resources
     $this->notifyEvent(EVENT_RESOURCES_LOADED, array("resources" => &$resources));
     $this->setValue("resources", $resources);
     // finally, create and export the pager
     $pager = new Pager($this->_pagerUrl, $this->_page, $numResources, DEFAULT_ITEMS_PER_PAGE);
     $this->setValue("pager", $pager);
     parent::render();
 }
 function render()
 {
     $referers = new Referers();
     $totalReferers = $referers->getBlogTotalReferers($this->_blogInfo->getId());
     // get the current page
     $this->_page = $this->getCurrentPageFromRequest();
     $blogReferers = $referers->getBlogReferers($this->_blogInfo->getId(), $this->_page, DEFAULT_ITEMS_PER_PAGE);
     if (!$blogReferers) {
         $blogReferers = array();
     }
     // calculate the links to the different pages
     $pager = new Pager("?op=Stats&amp;page=", $this->_page, $totalReferers, DEFAULT_ITEMS_PER_PAGE);
     $this->setValue("referrers", $blogReferers);
     $this->setValue("pager", $pager);
     parent::render();
 }
 /**
  * show the contents of the view
  */
 function render()
 {
     $trackbacks = new Trackbacks();
     // get the trackbacks
     $postTrackbacks = $trackbacks->getArticleTrackbacks($this->_article->getId(), $this->_page, DEFAULT_ITEMS_PER_PAGE);
     $this->notifyEvent(EVENT_TRACKBACKS_LOADED, array("trackbacks" => &$postTrackbacks));
     $this->setValue("trackbacks", $postTrackbacks);
     // and the total number of trackbacks
     $numTrackbacks = $trackbacks->getNumTrackbacksArticle($this->_article->getId());
     // create and export the pager to the view
     $pager = new Pager("?op=editTrackbacks&amp;articleId=" . $this->_article->getId() . "&amp;page=", $this->_page, $numTrackbacks, DEFAULT_ITEMS_PER_PAGE);
     $this->setValue("pager", $pager);
     // pass the common data to the templates
     $this->setValue("post", $this->_article);
     parent::render();
 }
 function render()
 {
     // fetch the child albums of the current top level album
     $galleryAlbums = new GalleryAlbums();
     $albums = $galleryAlbums->getChildAlbums($this->_albumId, $this->_blogInfo->getId());
     // get some info about the parent album if it's different from the
     // top level album
     if ($this->_albumId > 0) {
         $album = $galleryAlbums->getAlbum($this->_albumId, $this->_blogInfo->getId());
     }
     // fetch the albums for this blog
     $this->setValue("albums", $albums);
     $this->setValue("albumid", $this->_albumId);
     $this->setValue("album", $album);
     parent::render();
 }
 function render()
 {
     // if the section is not correct, then use the default "general"
     if (!in_array($this->_section, $this->_sections)) {
         $this->_section = "general";
     }
     // export all the config parameters
     $config =& Config::getConfig();
     $settings = $config->getAsArray();
     $this->setValue("settings", $settings);
     foreach ($settings as $key => $value) {
         $this->setValue($key, $value);
     }
     // set the section too
     $this->setValue("section", $this->_section);
     parent::render();
 }
 function render()
 {
     // fetch the categories
     $categories = new ArticleCategories();
     $blogSettings = $this->_blogInfo->getSettings();
     $categoriesOrder = $blogSettings->getValue("categories_order");
     $blogCategories = $categories->getBlogCategories($this->_blogInfo->getId(), false, $categoriesOrder);
     // get some stuff for the time stamp of the post, which is changeable now
     //$t = new Timestamp();
     $t = Timestamp::getBlogDate($this->_blogInfo);
     //$t->toUTC();
     //
     // changes to make plog store its dates with the time difference already
     // applied, instead of applying it dynamically
     //
     $config =& Config::getConfig();
     /*if( $config->getValue( "time_difference_calculation" == TIME_DIFFERENCE_CALCULATION_STATIC ) {
     		$blogSettings = $this->_blogInfo->getSettings();
     		$difference = $blogSettings->getValue( "time_offset" );
               	$t->setDate( Timestamp::getDateWithOffset( $t->getDate(), $difference ), DATE_FORMAT_TIMESTAMP );
           	}*/
     // fetch the custom fields, if any, but not including the ones that have been set to "hidden"...
     $customFields = new CustomFields();
     $blogFields = $customFields->getBlogCustomFields($this->_blogInfo->getId(), false);
     // and put everything in the template
     $locale = $this->_blogInfo->getLocale();
     $this->setValue("commentsEnabled", $blogSettings->getValue("comments_enabled"));
     $this->setValue("categories", $blogCategories);
     $this->setValue("today", $t);
     $this->setValue("months", $locale->getMonthNames());
     $this->setValue("days", $locale->getDayNamesShort());
     $this->setValue("years", Timestamp::getYears());
     $this->setValue("hours", Timestamp::getAllHours());
     $this->setValue("minutes", Timestamp::getAllMinutes());
     $this->setValue("customfields", $blogFields);
     $this->setValue("poststatus", ArticleStatus::getStatusList());
     $this->setValue("sendPings", $config->getValue("send_xmlrpc_pings_enabled_by_default", true));
     $this->setValue("xmlRpcPingEnabled", $config->getValue("xmlrpc_ping_enabled", false));
     $this->setValue("autoSaveNewDraftsTimeMillis", $config->getValue("autosave_new_drafts_time_millis"));
     $this->setValue("xmlHttpRequestSupportEnabled", $config->getValue("save_drafts_via_xmlhttprequest_enabled"));
     $this->setValue("postDateTime", $t->getDay() . "/" . $t->getMonth() . "/" . $t->getYear() . " " . $t->getHour() . ":" . $t->getMinutes());
     parent::render();
 }
 function render()
 {
     // get all the link categories
     $blogSettings = $this->_blogInfo->getSettings();
     $linkCategoriesOrder = $blogSettings->getValue("link_categories_order", MYLINKS_CATEGORIES_NO_ORDER);
     // get the link categories
     $linkCategories = new MyLinksCategories();
     $blogLinkCategories = $linkCategories->getMyLinksCategories($this->_blogInfo->getId(), $linkCategoriesOrder, $this->_page, DEFAULT_ITEMS_PER_PAGE);
     // get the total number of link categories
     $numLinkCategories = $linkCategories->getNumMyLinksCategories($this->_blogInfo->getId());
     // throw the event
     $this->notifyEvent(EVENT_LINK_CATEGORIES_LOADED, array("linkcategories" => &$blogLinkCategories));
     // create the pager
     $pager = new Pager("?op=editLinkCategories&amp;page=", $this->_page, $numLinkCategories, DEFAULT_ITEMS_PER_PAGE);
     // create the view and fill the template context
     $this->setValue("linkcategories", $blogLinkCategories);
     $this->setValue("pager", $pager);
     // transfer control to the parent class
     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&amp;status=" . $this->_status . "&amp;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();
 }
 /**
  * Carries out the specified action
  */
 function render()
 {
     // prepare a few parameters
     $categories = new ArticleCategories();
     $blogSettings = $this->_blogInfo->getSettings();
     $categoriesOrder = $blogSettings->getValue("categories_order");
     // get the page too
     $this->_page = $this->getCurrentPageFromRequest();
     // retrieve the categories in an paged fashion
     $totalCategories = $categories->getBlogNumCategories($this->_blogInfo->getId(), true);
     $blogCategories = $categories->getBlogCategoriesAdmin($this->_blogInfo->getId(), false, $categoriesOrder, $this->_page, DEFAULT_ITEMS_PER_PAGE);
     if (!$blogCategories) {
         $blogCategories = array();
     }
     // throw the even in case somebody's waiting for it!
     $this->notifyEvent(EVENT_CATEGORIES_LOADED, array("categories" => &$blogCategories));
     $this->setValue("categories", $blogCategories);
     // the pager that will be used
     $pager = new Pager("?op=editArticleCategories&amp;page=", $this->_page, $totalCategories, DEFAULT_ITEMS_PER_PAGE);
     $this->setValue("pager", $pager);
     parent::render();
 }
 /**
  * Carries out the specified action
  */
 function render()
 {
     // get the parameters
     $order = $this->getValue("showOrder");
     $categoryId = $this->getValue("showCategory");
     // get all the links and throw the event
     $links = new MyLinks();
     $blogLinks = $links->getLinks($this->_blogInfo->getId(), $categoryId, $this->_page, DEFAULT_ITEMS_PER_PAGE);
     $this->notifyEvent(EVENT_LINKS_LOADED, array("links" => &$blogLinks));
     // get the number of links
     $numLinks = $links->getNumLinks($this->_blogInfo->getId(), $categoryId);
     // get all the link categories but we have to respect the order that the user asked
     $linkCategories = new MyLinksCategories();
     $blogLinkCategories = $linkCategories->getMyLinksCategories($this->_blogInfo->getId(), $order);
     $this->notifyEvent(EVENT_LINK_CATEGORIES_LOADED, array("linkcategories" => &$blogLinkCategories));
     // prepare the pager
     $pager = new Pager("?op=editLinks&amp;showCategory={$categoryId}&amp;page=", $this->_page, $numLinks, DEFAULT_ITEMS_PER_PAGE);
     // put the data in the view
     $this->setValue("links", $blogLinks);
     $this->setValue("linkscategories", $blogLinkCategories);
     $this->setValue("currentcategory", $categoryId);
     $this->setValue("pager", $pager);
     parent::render();
 }
 function render()
 {
     // get the current page
     $this->_page = $this->getCurrentPageFromRequest();
     $this->_status = $this->getStatusFromRequest();
     // get the users of the blog
     $users = new Users();
     $siteUsers = $users->getAllUsers($this->_status, true, $this->_page, DEFAULT_ITEMS_PER_PAGE);
     $numUsers = $users->getNumUsers($this->_status);
     // in case of problems, empty array...
     if (!$siteUsers) {
         $siteUsers = array();
     }
     // notify the event
     $this->notifyEvent(EVENT_USERS_LOADED, array("users" => &$blogUsers));
     // calculate the links to the different pages
     $pager = new Pager("?op=editSiteUsers&amp;&status=" . $this->_status . "&amp;page=", $this->_page, $numUsers, DEFAULT_ITEMS_PER_PAGE);
     // and generate the view
     $this->setValue("siteusers", $siteUsers);
     $this->setValue("userstatus", UserStatus::getStatusList(true));
     $this->setValue("pager", $pager);
     $this->setValue("currentstatus", $this->_status);
     parent::render();
 }