/** * Enter description here... * * @return BOL_FlagService */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
public function onAfterGroupDelete(OW_Event $event) { $params = $event->getParams(); $groupId = $params['groupId']; BOL_ComponentEntityService::getInstance()->onEntityDelete(GROUPS_BOL_Service::WIDGET_PANEL_NAME, $groupId); BOL_CommentService::getInstance()->deleteEntityComments(GROUPS_BOL_Service::ENTITY_TYPE_WAL, $groupId); BOL_FlagService::getInstance()->deleteByTypeAndEntityId(GROUPS_BOL_Service::ENTITY_TYPE_GROUP, $groupId); OW::getEventManager()->trigger(new OW_Event('feed.delete_item', array('entityType' => GROUPS_BOL_Service::FEED_ENTITY_TYPE, 'entityId' => $groupId))); }
public function delete($params) { if (!(OW::getUser()->isAdmin() || BOL_AuthorizationService::getInstance()->isModerator())) { exit; } BOL_FlagService::getInstance()->deleteById($params['id']); OW::getFeedback()->info(OW::getLanguage()->text('base', 'flags_deleted')); $this->redirect($_SERVER['HTTP_REFERER']); }
public function delete(Link $dto) { BOL_CommentService::getInstance()->deleteEntityComments('link', $dto->getId()); BOL_TagService::getInstance()->deleteEntityTags($dto->getId(), 'link'); BOL_VoteService::getInstance()->deleteEntityItemVotes($dto->getId(), 'link'); BOL_FlagService::getInstance()->deleteByTypeAndEntityId('link', $dto->getId()); OW::getCacheManager()->clean(array(LinkDao::CACHE_TAG_LINK_COUNT)); OW::getEventManager()->trigger(new OW_Event('feed.delete_item', array('entityType' => 'link', 'entityId' => $dto->getId()))); $this->dao->delete($dto); }
private function getMenu($active) { $language = OW::getLanguage(); $list = BOL_FlagService::getInstance()->findTypeList(); $mil = array(); $i = 0; foreach ($list as $type) { $mi = new BASE_MenuItem(); $c = BOL_FlagService::getInstance()->countFlaggedItems($type['type']); $a = explode('+', $type['langKey']); $mi->setLabel($language->text($a[0], $a[1]) . ($c > 0 ? " ({$c})" : ''))->setKey($type['type'])->setOrder($i++)->setUrl(OW::getRouter()->urlFor('BASE_CTRL_Flags', 'index', array('type' => $type['type']))); if ($active == $type) { $mi->isActive(true); } $mil[] = $mi; } return new BASE_CMP_ContentMenu($mil); }
public function __construct($entityType, $entityId) { parent::__construct('flag'); $this->setAjax(true); $this->setAction(OW::getRouter()->urlFor('BASE_CTRL_Flag', 'flag')); $element = new HiddenField('entityType'); $element->setValue($entityType); $this->addElement($element); $element = new HiddenField('entityId'); $element->setValue($entityId); $this->addElement($element); $element = new RadioField('reason'); $element->setOptions(array('spam' => OW::getLanguage()->text('base', 'flag_spam'), 'offence' => OW::getLanguage()->text('base', 'flag_offence'), 'illegal' => OW::getLanguage()->text('base', 'flag_illegal'))); $flagDto = BOL_FlagService::getInstance()->findFlag($entityType, $entityId, OW::getUser()->getId()); if ($flagDto !== null) { $element->setValue($flagDto->reason); } $this->addElement($element); OW::getDocument()->addOnloadScript("owForms['{$this->getName()}'].bind('success', function(json){\n\t\t\tswitch( json['result'] ){\n\t\t\t\tcase 'success':\n\t\t\t\t\tOW.registry['flag-panel-fb'].close();\n\t\t\t\t\tOW.addScript(json.js);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t})"); }
public function __construct($type, $id, $title, $url, $langKey, $ownerId) { parent::__construct('flag'); $this->setAjax(true); $this->setAction(OW::getRouter()->urlFor('BASE_CTRL_Flag', 'flag')); $hiddenType = new HiddenField('type'); $hiddenId = new HiddenField('id'); $hiddenTitle = new HiddenField('title'); $hiddenUrl = new HiddenField('url'); $hiddenOwnerId = new HiddenField('ownerId'); $hiddenLangKey = new HiddenField('langKey'); $this->addElement($hiddenType->setValue($type))->addElement($hiddenId->setValue($id))->addElement($hiddenTitle->setValue(htmlspecialchars($title)))->addElement($hiddenUrl->setValue($url))->addElement($hiddenLangKey->setValue($langKey))->addElement($hiddenOwnerId->setValue($ownerId)); $reasonField = new RadioField('reason'); $reasonField->setOptions(array('spam' => OW::getLanguage()->text('base', 'flag_spam'), 'offence' => OW::getLanguage()->text('base', 'flag_offence'), 'illegal' => OW::getLanguage()->text('base', 'flag_illegal'))); $flagDto = BOL_FlagService::getInstance()->findFlag($type, $id, OW::getUser()->getId()); if ($flagDto !== null) { $reasonField->setValue($flagDto->reason); } $this->addElement($reasonField); OW::getDocument()->addOnloadScript("owForms['{$this->getName()}'].bind('success', function(json){\n\t\t\tswitch( json['result'] ){\n\t\t\t\tcase 'success':\n\t\t\t\t\tOW.registry['flag-panel-fb'].close();\n\t\t\t\t\teval(json.js);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t})"); }
public function deletePost($postId) { BOL_CommentService::getInstance()->deleteEntityComments('blog-post', $postId); BOL_RateService::getInstance()->deleteEntityRates($postId, 'blog-post'); BOL_TagService::getInstance()->deleteEntityTags($postId, 'blog-post'); BOL_FlagService::getInstance()->deleteByTypeAndEntityId(BLOGS_CLASS_ContentProvider::ENTITY_TYPE, $postId); OW::getCacheManager()->clean(array(PostDao::CACHE_TAG_POST_COUNT)); OW::getEventManager()->trigger(new OW_Event('feed.delete_item', array('entityType' => 'blog-post', 'entityId' => $postId))); $this->dao->deleteById($postId); }
public function cleanupPluginContent() { BOL_CommentService::getInstance()->deleteEntityTypeComments('vwvr_comments'); BOL_RateService::getInstance()->deleteEntityTypeRates('vwvr_rates'); BOL_TagService::getInstance()->deleteEntityTypeTags('vwvr'); BOL_FlagService::getInstance()->deleteByType('vwvr_clip'); }
* For more information see License.txt in the plugin folder. * ============================================================================= * Copyright (c) 2012 by Aron. All rights reserved. * ============================================================================= * Redistribution and use in source and binary forms, with or without modification, are not permitted provided. * Pass on to others in any form are not permitted provided. * Sale are not permitted provided. * Sale this product are not permitted provided. * Gift this product are not permitted provided. * This plugin should be bought from the developer by paying money to PayPal account: biuro@grafnet.pl * Legal purchase is possible only on the web page URL: http://www.oxwall.org/store * Modyfing of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Modifying source code, all information like:copyright must remain. * Official website only: http://oxwall.a6.pl * Full license available at: http://oxwall.a6.pl * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***/ //---widgates: BOL_FlagService::getInstance()->deleteByType('startpage'); BOL_TagService::getInstance()->deleteEntityTypeTags('startpage');
public function cleanupPluginContent() { BOL_CommentService::getInstance()->deleteEntityTypeComments(self::ENTITY_TYPE); BOL_RateService::getInstance()->deleteEntityTypeRates(self::RATES_ENTITY_TYPE); BOL_TagService::getInstance()->deleteEntityTypeTags(self::TAGS_ENTITY_TYPE); BOL_FlagService::getInstance()->deleteFlagList(self::ENTITY_TYPE); }
<?php /** * This software is intended for use with Oxwall Free Community Software http://www.oxwall.org/ and is * licensed under The BSD license. * --- * Copyright (c) 2011, Oxwall Foundation * All rights reserved. * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: * * - Redistributions of source code must retain the above copyright notice, this list of conditions and * the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and * the following disclaimer in the documentation and/or other materials provided with the distribution. * * - Neither the name of the Oxwall Foundation nor the names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ BOL_FlagService::getInstance()->deleteByType('link'); BOL_TagService::getInstance()->deleteEntityTypeTags('link');
public function deleteExpiredClip() { $config = OW::getConfig(); $availability = $config->getValue('vwls', 'availability'); if ($availability != 0) { // get all clips $example = new OW_Example(); $example->andFieldEqual('status', 'approved'); $example->andFieldEqual('privacy', 'everybody'); $example->setOrder('`addDatetime` DESC'); $clips = $this->findListByExample($example); // if modifDatetime > $avTime, delete clip $avTime = $availability * 86400; // second $expTime = time() - $avTime; foreach ($clips as $clip) { if ($clip->modifDatetime < $expTime) { $id = $clip->id; $this->deleteById($id); BOL_CommentService::getInstance()->deleteEntityComments('vwls_comments', $id); BOL_RateService::getInstance()->deleteEntityRates($id, 'vwls_rates'); BOL_TagService::getInstance()->deleteEntityTags($id, 'vwls'); BOL_FlagService::getInstance()->deleteByTypeAndEntityId('vwls_clip', $id); OW::getEventManager()->trigger(new OW_Event('feed.delete_item', array('entityType' => 'vwls_comments', 'entityId' => $id))); } } } }
public function delete(Post $dto) { BOL_CommentService::getInstance()->deleteEntityComments('blog-post', $dto->getId()); BOL_RateService::getInstance()->deleteEntityRates($dto->getId(), 'blog-post'); BOL_TagService::getInstance()->deleteEntityTags($dto->getId(), 'blog-post'); BOL_FlagService::getInstance()->deleteByTypeAndEntityId('blog_post', $dto->getId()); OW::getCacheManager()->clean(array(PostDao::CACHE_TAG_POST_COUNT)); OW::getEventManager()->trigger(new OW_Event('feed.delete_item', array('entityType' => 'blog-post', 'entityId' => $dto->getId()))); $this->dao->delete($dto); }
public function cleanupPluginContent() { BOL_CommentService::getInstance()->deleteEntityTypeComments('ivideo-comments'); BOL_RateService::getInstance()->deleteEntityTypeRates('ivideo-rates'); BOL_TagService::getInstance()->deleteEntityTypeTags('ivideo-video'); BOL_FlagService::getInstance()->deleteByType('ivideo_video'); }
<?php /** * This software is intended for use with Oxwall Free Community Software http://www.oxwall.org/ and is * licensed under The BSD license. * --- * Copyright (c) 2011, Oxwall Foundation * All rights reserved. * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: * * - Redistributions of source code must retain the above copyright notice, this list of conditions and * the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and * the following disclaimer in the documentation and/or other materials provided with the distribution. * * - Neither the name of the Oxwall Foundation nor the names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ BOL_FlagService::getInstance()->deleteByType('blog_post'); BOL_TagService::getInstance()->deleteEntityTypeTags('blog-post');
/** * Deletes photo * * @param int $id * @return int */ public function deletePhoto($id, $totalAlbum = FALSE) { if (!$id || !($photo = $this->photoDao->findById($id))) { return false; } if ($totalAlbum === FALSE) { $event = new OW_Event(PHOTO_CLASS_EventHandler::EVENT_BEFORE_PHOTO_DELETE, array('id' => $id)); OW::getEventManager()->trigger($event); } if ($this->photoDao->deleteById($id)) { BOL_CommentService::getInstance()->deleteEntityComments('photo_comments', $id); BOL_RateService::getInstance()->deleteEntityRates($id, 'photo_rates'); BOL_TagService::getInstance()->deleteEntityTags($id, 'photo'); $this->photoDao->removePhotoFile($id, $photo->hash, self::TYPE_SMALL); $this->photoDao->removePhotoFile($id, $photo->hash, self::TYPE_PREVIEW); $this->photoDao->removePhotoFile($id, $photo->hash, self::TYPE_MAIN); $this->photoDao->removePhotoFile($id, $photo->hash, self::TYPE_FULLSCREEN); $this->photoDao->removePhotoFile($id, $photo->hash, self::TYPE_ORIGINAL); $this->photoFeaturedDao->markUnfeatured($id); BOL_FlagService::getInstance()->deleteByTypeAndEntityId(PHOTO_CLASS_ContentProvider::ENTITY_TYPE, $id); BOL_TagService::getInstance()->deleteEntityTags($id, PHOTO_BOL_PhotoDao::PHOTO_ENTITY_TYPE); $this->cleanListCache(); OW::getEventManager()->trigger(new OW_Event(PHOTO_CLASS_EventHandler::EVENT_ON_PHOTO_DELETE, array('id' => $id))); return TRUE; } return FALSE; }
<?php /** * This software is intended for use with Oxwall Free Community Software http://www.oxwall.org/ and is * licensed under The BSD license. * --- * Copyright (c) 2011, Oxwall Foundation * All rights reserved. * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: * * - Redistributions of source code must retain the above copyright notice, this list of conditions and * the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and * the following disclaimer in the documentation and/or other materials provided with the distribution. * * - Neither the name of the Oxwall Foundation nor the names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ BOL_FlagService::getInstance()->deleteFlagList('blog_post'); BOL_TagService::getInstance()->deleteEntityTypeTags('blog-post');
public function dashboard($paramList) { if (!OW::getUser()->isAuthenticated()) { throw new AuthenticateException(); } $this->setPageHeading(OW::getLanguage()->text('base', 'dashboard_heading')); $this->setPageHeadingIconClass('ow_ic_house'); $customize = !empty($paramList['mode']) && $paramList['mode'] == 'customize'; $place = BOL_ComponentService::PLACE_DASHBOARD; $template = $customize ? 'drag_and_drop_entity_panel_customize' : 'drag_and_drop_entity_panel'; $customizeUrls = array('customize' => OW::getRouter()->urlForRoute('base_member_dashboard_customize', array('mode' => 'customize')), 'normal' => OW::getRouter()->urlForRoute('base_member_dashboard')); $userId = OW::getUser()->getId(); $this->action($place, $userId, $customize, $customizeUrls, $template); $controllersTemplate = OW::getPluginManager()->getPlugin('BASE')->getCtrlViewDir() . 'widget_panel_dashboard.html'; $this->setTemplate($controllersTemplate); $this->assign('isAdmin', OW::getUser()->isAdmin()); $this->assign('isModerator', BOL_AuthorizationService::getInstance()->isModerator()); if (BOL_AuthorizationService::getInstance()->isModerator() || OW::getUser()->isAdmin()) { $this->assign('disaprvdCount', BOL_UserService::getInstance()->countDisapproved()); $types = BOL_FlagService::getInstance()->findTypeList(); $typeNames = array(); foreach ($types as $typeName) { $typeNames[] = $typeName['type']; } $flaggedCountList = BOL_FlagService::getInstance()->countFlaggedItemsByTypeList($typeNames); $flags = array(); foreach ($types as $type) { $count = empty($flaggedCountList[$type['type']]) ? 0 : $flaggedCountList[$type['type']]; $flags[] = array('type' => $type['type'], 'langKey' => $type['langKey'], 'count' => $count); } $this->assign('flags', $flags); } $this->setDocumentKey('base_user_dashboard'); }
/** * Deletes topic * * @param int $topicId */ public function deleteTopic($topicId) { //delete flags BOL_FlagService::getInstance()->deleteByTypeAndEntityId(FORUM_CLASS_ContentProvider::ENTITY_TYPE, $topicId); $editPostDao = FORUM_BOL_EditPostDao::getInstance(); $readTopicDao = FORUM_BOL_ReadTopicDao::getInstance(); $postIds = $this->postDao->findTopicPostIdList($topicId); if ($postIds) { //delete topic posts edit info $editPostDao->deleteByPostIdList($postIds); //delete topic posts foreach ($postIds as $post) { $this->deletePost($post); } } //delete topic read info $readTopicDao->deleteByTopicId($topicId); OW::getEventManager()->trigger(new OW_Event(self::EVENT_BEFORE_TOPIC_DELETE, array('topicId' => $topicId))); //delete topic $this->topicDao->deleteById($topicId); OW::getEventManager()->trigger(new OW_Event('feed.delete_item', array('entityType' => 'forum-topic', 'entityId' => $topicId))); $event = new OW_Event(self::EVENT_AFTER_TOPIC_DELETE, array('topicId' => $topicId)); OW::getEventManager()->trigger($event); }
/** * Deletes post * * @param int $postId */ public function deletePost($postId) { $editPostDao = FORUM_BOL_EditPostDao::getInstance(); //delete post edit info $editPostDao->deleteByPostId($postId); //delete post $this->postDao->deleteById($postId); //delete attachments FORUM_BOL_PostAttachmentService::getInstance()->deletePostAttachments($postId); //delete flags BOL_FlagService::getInstance()->deleteByTypeAndEntityId('forum_post', $postId); $event = new OW_Event(self::EVENT_AFTER_POST_DELETE, array('postId' => $postId)); OW::getEventManager()->trigger($event); }
public function onCollectModerationToolsMenu(BASE_CLASS_EventCollector $event) { $flagGroups = BOL_FlagService::getInstance()->getContentGroupsWithCount(); if (empty($flagGroups)) { return; } $event->add(array("url" => OW::getRouter()->urlForRoute("base.moderation_flags_index"), "label" => OW::getLanguage()->text("base", "flagged_content"), "iconClass" => "ow_ic_clock", "key" => "flags")); }
/** * Deletes photo * * @param int $id * @return int */ public function deletePhoto($id) { /** @var $photo PHOTO_BOL_Photo */ if (!$id || !($photo = $this->photoDao->findById($id))) { return false; } $event = new OW_Event(PHOTO_CLASS_EventHandler::EVENT_BEFORE_PHOTO_DELETE, array('id' => $id)); OW::getEventManager()->trigger($event); if ($this->photoDao->deleteById($id)) { BOL_CommentService::getInstance()->deleteEntityComments('photo_comments', $id); BOL_RateService::getInstance()->deleteEntityRates($id, 'photo_rates'); BOL_TagService::getInstance()->deleteEntityTags($id, 'photo'); // remove files $this->photoDao->removePhotoFile($id, $photo->hash, 'main'); $this->photoDao->removePhotoFile($id, $photo->hash, 'preview'); $this->photoDao->removePhotoFile($id, $photo->hash, 'original'); $this->photoFeaturedDao->markUnfeatured($id); BOL_FlagService::getInstance()->deleteByTypeAndEntityId('photo', $id); OW::getEventManager()->trigger(new OW_Event('feed.delete_item', array('entityType' => 'photo_comments', 'entityId' => $id))); $this->cleanListCache(); $event = new OW_Event(PHOTO_CLASS_EventHandler::EVENT_ON_PHOTO_DELETE, array('id' => $id)); OW::getEventManager()->trigger($event); return true; } return false; }
public function flagsResponder($params) { if (!OW::getRequest()->isPost() || !(OW::getUser()->isAdmin() || BOL_AuthorizationService::getInstance()->isModerator())) { throw new Redirect403Exception(); } $data = $_POST; $data["items"] = empty($data["items"]) ? array() : $data["items"]; list($command, $type) = explode(".", $data["command"]); $backUrl = OW::getRouter()->urlForRoute("base.moderation_flags", array("group" => $params["group"])); $itemKeys = $type == "single" ? array($data["item"]) : $data["items"]; if (empty($itemKeys)) { OW::getFeedback()->warning(OW::getLanguage()->text("base", "moderation_no_items_warning")); $this->redirect($backUrl); } $itemIds = array(); foreach ($itemKeys as $itemKey) { list($entityType, $entityId) = explode(":", $itemKey); $itemIds[$entityType] = empty($itemIds[$entityType]) ? array() : $itemIds[$entityType]; $itemIds[$entityType][] = $entityId; } $affected = 0; $lastEntityType = null; foreach ($itemIds as $entityType => $entityIds) { if ($command == "delete") { BOL_ContentService::getInstance()->deleteContentList($entityType, $entityIds); } if ($command == "unflag") { // Pass } BOL_FlagService::getInstance()->deleteFlagList($entityType, $entityIds); $affected = count($entityIds); $lastEntityType = $entityType; } // Feedback $assigns = array(); $multiple = $affected > 1; if ($multiple) { $tmp = BOL_ContentService::getInstance()->getContentGroups(); $groupInfo = $tmp[$params["group"]]; $assigns["content"] = strtolower($groupInfo["label"]); $assigns["count"] = $affected; } else { $typeInfo = BOL_ContentService::getInstance()->getContentTypeByEntityType($lastEntityType); $assigns["content"] = $typeInfo["entityLabel"]; } $feedbackKey = $command == "delete" ? "base+moderation_feedback_delete" : "base+moderation_feedback_unflag"; list($langPrefix, $langKey) = explode("+", $feedbackKey); OW::getFeedback()->info(OW::getLanguage()->text($langPrefix, $langKey . ($multiple ? "_multiple" : ""), $assigns)); // Redirection $this->redirect($backUrl); }
<?php /** * This software is intended for use with Oxwall Free Community Software http://www.oxwall.org/ and is a proprietary licensed product. * For more information see License.txt in the plugin folder. * --- * Copyright (c) 2012, Purusothaman Ramanujam * All rights reserved. * Redistribution and use in source and binary forms, with or without modification, are not permitted provided. * This plugin should be bought from the developer by paying money to PayPal account (purushoth.r@gmail.com). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ BOL_CommentService::getInstance()->deleteEntityTypeComments('eventx'); BOL_TagService::getInstance()->deleteEntityTypeTags('eventx'); BOL_FlagService::getInstance()->deleteByType('eventx_event');