/** * Carries out the specified action */ function perform() { // // update the plugin configurations to blog setting $blogSettings = $this->_blogInfo->getSettings(); $blogSettings->setValue("plugin_moderate_enabled", $this->_pluginEnabled); $this->_blogInfo->setSettings($blogSettings); // save the blogs settings $blogs = new Blogs(); if (!$blogs->updateBlog($this->_blogInfo->getId(), $this->_blogInfo)) { $this->_view = new AdminModeratePluginSettingsView($this->_blogInfo); $this->_view->setErrorMessage($this->_locale->tr("error_updating_settings")); $this->setCommonData(); return false; } // if everything went ok... $this->_blogInfo->setSettings($blogSettings); $this->_session->setValue("blogInfo", $this->_blogInfo); $this->saveSession(); $this->_view = new AdminModeratePluginSettingsView($this->_blogInfo); $this->_view->setSuccessMessage($this->_locale->tr("moderate_settings_saved_ok")); $this->setCommonData(); // clear the cache CacheControl::resetBlogCache($this->_blogInfo->getId()); return true; }
function perform() { // // update the plugin configurations to blog setting $blogSettings = $this->_blogInfo->getSettings(); $blogSettings->setValue("plugin_authimage_enabled", $this->_pluginEnabled); $blogSettings->setValue("plugin_authimage_length", $this->_length); $blogSettings->setValue("plugin_authimage_key", $this->_key); $blogSettings->setValue("plugin_authimage_expiredtime", $this->_expiredTime); $blogSettings->setValue("plugin_authimage_default", $this->_default); $this->_blogInfo->setSettings($blogSettings); // save the blogs settings $blogs = new Blogs(); if (!$blogs->updateBlog($this->_blogInfo->getId(), $this->_blogInfo)) { $this->_view = new PluginAuthImageConfigView($this->_blogInfo); $this->_view->setErrorMessage($this->_locale->tr("error_updating_settings")); $this->setCommonData(); return false; } // if everything went ok... $this->_blogInfo->setSettings($blogSettings); $this->_session->setValue("blogInfo", $this->_blogInfo); $this->saveSession(); $this->_view = new PluginAuthImageConfigView($this->_blogInfo); $this->_view->setSuccessMessage($this->_locale->tr("authimage_settings_saved_ok")); $this->setCommonData(); // clear the cache CacheControl::resetBlogCache($this->_blogInfo->getId()); return true; }
function perform() { $this->username = $this->_request->getValue("username"); $this->activeCode = $this->_request->getValue("activeCode"); $users = new Users(); $userInfo = $users->getUserInfoFromUsername($this->username); if (!$userInfo) { $this->_view = new SummaryView("summaryerror"); $this->_view->setErrorMessage($this->_locale->tr("error_invalid_user")); return false; } $activeCode = $userInfo->getValue("activeCode"); if ($activeCode != $this->activeCode) { $this->_view = new SummaryView("summaryerror", $this->_locale->tr("error_invalid_activation_code")); return false; } // active user $userInfo->setStatus(USER_STATUS_ACTIVE); $users->updateUser($userInfo); // also active the blog that user owned // FIXME: how about other blogs that this user take part in? $blogId = $users->getUserBlogId($this->username); $blogs = new Blogs(); $blog = $blogs->getBlogInfo($blogId); $blog->setStatus(BLOG_STATUS_ACTIVE); $blogs->updateBlog($blogId, $blog); $blogUrl = $blog->getBlogRequestGenerator(); // create the message that we're going to show $message = "<p>" . $this->_locale->tr("blog_activated_ok") . "</p><p>" . $this->_locale->pr("register_blog_link", $blog->getBlog(), $blogUrl->blogLink()) . "</p><p>" . $this->_locale->tr("register_blog_admin_link") . "</p>"; $this->_view = new SummaryMessageView($message); $this->setCommonData(); return true; }
/** * Carries out the specified action */ function perform() { // fetch the settings from the db and update them accordingly $blogs = new Blogs(); $blogSettings = $blogs->getBlogSettings($this->_blogInfo->getId()); $blogSettings->setValue("locale", $this->_request->getValue("blogLocale")); $blogSettings->setValue("show_posts_max", $this->_request->getValue("blogMaxMainPageItems")); $blogSettings->setValue("recent_posts_max", $this->_request->getValue("blogMaxRecentItems")); $blogSettings->setValue("template", $this->_request->getValue("blogTemplate")); $blogSettings->setValue("time_offset", $this->_request->getValue("blogTimeOffset")); $blogSettings->setValue("categories_order", $this->_request->getValue("blogCategoriesOrder")); $blogSettings->setValue("link_categories_order", $this->_request->getValue("blogLinkCategoriesOrder")); $blogSettings->setValue("show_more_enabled", Textfilter::checkboxToBoolean($this->_request->getValue("blogShowMoreEnabled"))); $blogSettings->setValue("htmlarea_enabled", Textfilter::checkboxToBoolean($this->_request->getValue("blogEnableHtmlarea"))); $blogSettings->setValue("comments_enabled", Textfilter::checkboxToBoolean($this->_request->getValue("blogCommentsEnabled"))); $blogSettings->setValue("show_future_posts_in_calendar", Textfilter::checkboxToBoolean($this->_request->getValue("blogShowFuturePosts"))); $blogSettings->setValue("new_drafts_autosave_enabled", Textfilter::checkboxToBoolean($this->_request->getValue("blogEnableAutosaveDrafts"))); $blogSettings->setValue("comments_order", $this->_request->getValue("blogCommentsOrder")); $this->_blogInfo->setAbout(Textfilter::filterAllHTML($this->_request->getValue("blogAbout"))); $this->_blogInfo->setBlog(Textfilter::filterAllHTML($this->_request->getValue("blogName"))); $this->_blogInfo->setSettings($blogSettings); $this->_blogInfo->setProperties($this->_request->getValue("properties")); $this->_blogInfo->setMangledBlog(Textfilter::urlize($this->_blogInfo->getBlog())); // and now update the settings in the database $blogs = new Blogs(); // and now we can proceed... $this->notifyEvent(EVENT_PRE_BLOG_UPDATE, array("blog" => &$this->_blogInfo)); if (!$blogs->updateBlog($this->_blogInfo->getId(), $this->_blogInfo)) { $this->_view = new AdminBlogSettingsView($this->_blogInfo); $this->_view->setErrorMessage($this->_locale->tr("error_updating_settings")); $this->setCommonData(); return false; } // do it again, baby :))) $this->_blogInfo->setAbout(Textfilter::filterAllHTML(stripslashes($this->_request->getValue("blogAbout")))); $this->_blogInfo->setBlog(Textfilter::filterAllHTML(stripslashes($this->_request->getValue("blogName")))); $this->_blogInfo->setSettings($blogSettings); $this->_blogInfo->setProperties($this->_blogProperties); $this->_session->setValue("blogInfo", $this->_blogInfo); $this->saveSession(); $this->notifyEvent(EVENT_POST_BLOG_UPDATE, array("blog" => &$this->_blogInfo)); $this->_view = new AdminBlogSettingsView($this->_blogInfo); $this->_locale =& Locales::getLocale($blogSettings->getValue("locale")); $this->_view->setSuccessMessage($this->_locale->pr("blog_settings_updated_ok", $this->_blogInfo->getBlog())); $this->setCommonData(); // clear the cache CacheControl::resetBlogCache($this->_blogInfo->getId()); // better to return true if everything fine return true; }
/** * Carries out the specified action */ function perform() { // fetch the values from the form which have already been validated $this->_blogName = Textfilter::filterAllHTML($this->_request->getValue("blogName")); $this->_blogLocale = $this->_request->getValue("blogLocale"); $this->_blogTemplate = $this->_request->getValue("blogTemplate"); $this->_blogOwner = $this->_request->getValue("blogOwner"); $this->_editBlogId = $this->_request->getValue("blogId"); $this->_blogTimeOffset = $this->_request->getValue("blogTimeOffset"); $this->_blogProperties = $this->_request->getValue("properties"); $this->_blogQuota = $this->_request->getValue("blogResourcesQuota"); $this->_blogUsers = $this->_request->getValue("blogUsers"); $this->_blogStatus = $this->_request->getValue("blogStatus"); //print_r($_REQUEST); // get the blog we're trying to update $blogs = new Blogs(); $blogInfo = $blogs->getBlogInfo($this->_editBlogId); if (!$blogInfo) { $this->_view = new AdminSiteBlogsListView($this->_blogInfo); $this->_view->setErrorMessage($this->_locale->tr("error_fetching_blog")); $this->setCommonData(); return false; } $this->notifyEvent(EVENT_BLOG_LOADED, array("blog" => &$blogInfo)); // make sure that the user we'd like to set as owner exists $users = new Users(); $userInfo = $users->getUserInfoFromId($this->_blogOwner); if (!$userInfo) { $this->_view = new AdminSiteBlogsListView($this->_blogInfo); $this->_view->setErrorMessage($this->_locale->tr("error_incorrect_blog_owner")); $this->setCommonData(); return false; } $this->notifyEvent(EVENT_USER_LOADED, array("user" => &$userInfo)); // set the different settings $blogSettings = $blogInfo->getSettings(); $blogSettings->setValue("locale", $this->_blogLocale); $blogSettings->setValue("template", $this->_blogTemplate); $blogSettings->setValue("time_offset", $this->_blogTimeOffset); $blogInfo->setSettings($blogSettings); $blogInfo->setResourcesQuota($this->_blogQuota); $blogInfo->setBlog($this->_blogName); $blogInfo->setProperties($this->_blogProperties); $blogInfo->setOwner($this->_blogOwner); $blogInfo->setStatus($this->_blogStatus); $blogInfo->setMangledBlog(Textfilter::urlize($blogInfo->getBlog())); $this->notifyEvent(EVENT_PRE_BLOG_UPDATE, array("blog" => &$blogInfo)); if (!$blogs->updateBlog($blogInfo->getId(), $blogInfo)) { $this->_view = new AdminSiteBlogsListView($this->_blogInfo); $this->_view->setErrorMessage($this->_locale->pr("error_updating_blog_settings", $blogInfo->getBlog())); $this->setCommonData(); return false; } // update the user permissions, even if they didn't change (but we have no way to // check that anyway!) $permissions = new UserPermissions(); if (!$permissions->updateBlogUserPermissions($this->_editBlogId, $this->_blogUsers)) { $this->_view = new AdminSiteBlogsListView($this->_blogInfo); $this->_view->setErrorMessage($this->_locale->pr("error_updating_blog_settings", $blogInfo->getBlog())); $this->setCommonData(); return false; } $this->notifyEvent(EVENT_POST_BLOG_UPDATE, array("blog" => &$blogInfo)); // do it again, baby :))) if ($this->_blogInfo->getId() == $blogInfo->getId()) { $this->_blogInfo->setSettings($blogSettings); $blogInfo->setProperties($this->_blogProperties); $this->_session->setValue("blogInfo", $this->_blogInfo); $this->saveSession(); } // if everything went fine, we can show a nice message $this->_view = new AdminSiteBlogsListView($this->_blogInfo); $this->_view->setSuccessMessage($this->_locale->pr("edit_blog_settings_updated_ok", $blogInfo->getBlog())); $this->setCommonData(); // clear the cache CacheControl::resetBlogCache($blogInfo->getId()); // better to return true if everything fine return true; }