Esempio n. 1
0
 public function __construct($pluginKey, $entityType, $entityId, $ownerId)
 {
     parent::__construct();
     $service = BOL_RateService::getInstance();
     $maxRate = $service->getConfig(BOL_RateService::CONFIG_MAX_RATE);
     $cmpId = uniqid();
     $entityId = (int) $entityId;
     $entityType = trim($entityType);
     $ownerId = (int) $ownerId;
     if (OW::getUser()->isAuthenticated()) {
         $userRateItem = $service->findRate($entityId, $entityType, OW::getUser()->getId());
         if ($userRateItem !== null) {
             $userRate = $userRateItem->getScore();
         } else {
             $userRate = null;
         }
     } else {
         $userRate = null;
     }
     $this->assign('maxRate', $maxRate);
     $this->addComponent('totalScore', new BASE_CMP_TotalScore($entityId, $entityType, $maxRate));
     $this->assign('cmpId', $cmpId);
     $jsParamsArray = array('cmpId' => $cmpId, 'userRate' => $userRate, 'entityId' => $entityId, 'entityType' => $entityType, 'itemsCount' => $maxRate, 'respondUrl' => OW::getRouter()->urlFor('BASE_CTRL_Rate', 'updateRate'), 'ownerId' => $ownerId);
     OW::getDocument()->addOnloadScript("var rate{$cmpId} = new OwRate(" . json_encode($jsParamsArray) . "); rate{$cmpId}.init();");
 }
Esempio n. 2
0
 public function updateRate()
 {
     $service = BOL_RateService::getInstance();
     $entityId = (int) $_POST['entityId'];
     $entityType = trim($_POST['entityType']);
     $rate = (int) $_POST['rate'];
     $ownerId = (int) $_POST['ownerId'];
     $userId = OW::getUser()->getId();
     if (!OW::getUser()->isAuthenticated()) {
         echo json_encode(array('errorMessage' => OW::getLanguage()->text('base', 'rate_cmp_auth_error_message')));
         exit;
     }
     if ($userId === $ownerId) {
         echo json_encode(array('errorMessage' => OW::getLanguage()->text('base', 'rate_cmp_owner_cant_rate_error_message')));
         exit;
     }
     if (false) {
         echo json_encode(array('errorMessage' => 'Auth error'));
         exit;
     }
     $rateItem = $service->findRate($entityId, $entityType, $userId);
     if ($rateItem === null) {
         $rateItem = new BOL_Rate();
         $rateItem->setEntityId($entityId)->setEntityType($entityType)->setUserId($userId)->setActive(true);
     }
     $rateItem->setScore($rate)->setTimeStamp(time());
     $service->saveRate($rateItem);
     $event = new OW_Event('ocstopusers.rate_user', array('ownerId' => $entityId, 'userId' => $userId, 'rate' => $rate));
     OW::getEventManager()->trigger($event);
     $totalScoreCmp = new OCSTOPUSERS_CMP_TotalScore($entityId, $entityType);
     echo json_encode(array('totalScoreCmp' => $totalScoreCmp->render(), 'message' => OW::getLanguage()->text('base', 'rate_cmp_success_message')));
     exit;
 }
Esempio n. 3
0
 /**
  * Returns an instance of class (singleton pattern implementation).
  *
  * @return BOL_RateService
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Esempio n. 4
0
function ocstopusers_delete_user_rates(OW_Event $event)
{
    $params = $event->getParams();
    $userId = (int) $params['userId'];
    if ($userId > 0) {
        BOL_RateService::getInstance()->deleteEntityRates($userId, 'user_rates');
    }
}
Esempio n. 5
0
 public function __construct($entityId, $entityType, $maxRate = 5)
 {
     parent::__construct();
     $service = BOL_RateService::getInstance();
     $info = $service->findRateInfoForEntityItem($entityId, $entityType);
     $info['width'] = !isset($info['avg_score']) ? null : (int) floor((double) $info['avg_score'] / $maxRate * 100);
     $info['avgScore'] = !isset($info['avg_score']) ? 0 : round($info['avg_score'], 2);
     $info['ratesCount'] = !isset($info['rates_count']) ? 0 : (int) $info['rates_count'];
     $this->assign('info', $info);
 }
Esempio n. 6
0
 public static function displayRate(array $params)
 {
     $service = BOL_RateService::getInstance();
     $minRate = 1;
     $maxRate = $service->getConfig(BOL_RateService::CONFIG_MAX_RATE);
     if (!isset($params['avg_rate']) || (double) $params['avg_rate'] < $minRate || (double) $params['avg_rate'] > $maxRate) {
         return '_INVALID_RATE_PARAM_';
     }
     $width = (int) floor((double) $params['avg_rate'] / $maxRate * 100);
     return '<div class="inactive_rate_list"><div class="active_rate_list" style="width:' . $width . '%;"></div></div>';
 }
 public function __construct(BASE_CLASS_WidgetParameter $params)
 {
     parent::__construct();
     $userId = $params->additionalParamList['entityId'];
     $service = BOL_RateService::getInstance();
     $ownerMode = $userId == OW::getUser()->getId();
     $this->assign('ownerMode', $ownerMode);
     if ($ownerMode) {
         $limit = $params->customParamList['userCount'];
         $topService = OCSTOPUSERS_BOL_Service::getInstance();
         $ratedList = $topService->findRateUserList($userId, 1, $limit);
         if ($ratedList) {
             $idList = array();
             foreach ($ratedList as $user) {
                 array_push($idList, $user['dto']->id);
             }
             $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList);
             $this->assign('avatars', $avatars);
             $this->assign('list', $ratedList);
             $total = $topService->countRateUsers($userId);
             if ($total > $limit) {
                 $toolbar = array('label' => OW::getLanguage()->text('base', 'view_all'), 'href' => OW::getRouter()->urlForRoute('ocstopusers.rated_list'));
                 $this->assign('toolbar', array($toolbar));
             } else {
                 $this->assign('toolbar', null);
             }
         } else {
             $this->assign('list', null);
         }
     }
     $maxRate = $service->getConfig(BOL_RateService::CONFIG_MAX_RATE);
     $this->assign('maxRate', $maxRate);
     $cmpId = rand(1, 100000);
     $this->assign('cmpId', $cmpId);
     $entityId = $userId;
     $entityType = 'user_rates';
     $ownerId = $ownerMode ? $userId : null;
     if (OW::getUser()->isAuthenticated()) {
         $userRateItem = $service->findRate($entityId, $entityType, OW::getUser()->getId());
         if ($userRateItem !== null) {
             $userRate = $userRateItem->getScore();
         } else {
             $userRate = null;
         }
     } else {
         $userRate = null;
     }
     $this->addComponent('total_score', new OCSTOPUSERS_CMP_TotalScore($entityId, $entityType));
     $jsParamsArray = array('cmpId' => $cmpId, 'userRate' => $userRate, 'entityId' => $entityId, 'entityType' => $entityType, 'itemsCount' => $maxRate, 'respondUrl' => OW::getRouter()->urlFor('OCSTOPUSERS_CTRL_List', 'updateRate'), 'ownerId' => $ownerId);
     OW::getDocument()->addOnloadScript("var rate{$cmpId} = new OwRate(" . json_encode($jsParamsArray) . "); rate{$cmpId}.init();");
 }
Esempio n. 8
0
 public function __construct($params)
 {
     $softs = SPDOWNLOAD_BOL_FileService::getInstance()->getFileItemUser($params['fileId'], $params['authorId'], $params['quantitySoft']);
     $url = OW::getPluginManager()->getPlugin('spdownload')->getUserFilesUrl();
     foreach ($softs as $key => $value) {
         $nameImage = 'icon_small_' . $value->id . '.png';
         $value->icon = $url . $nameImage;
         $rate = BOL_RateService::getInstance()->findRateInfoForEntityItem($value->id, self::RATES_ENTITY_TYPE);
         if (!empty($rate)) {
             $value->avg_score = $rate["avg_score"];
         }
     }
     $this->assign('softs', $softs);
 }
 public function onUpdateInfo(OW_Event $event)
 {
     $params = $event->getParams();
     $data = $event->getData();
     if ($params["entityType"] != self::ENTITY_TYPE) {
         return;
     }
     foreach ($data as $entityId => $info) {
         $statusActive = $info["status"] == BOL_ContentService::STATUS_ACTIVE;
         $status = $statusActive ? "approved" : "approval";
         // Set tags status
         BOL_TagService::getInstance()->setEntityStatus(VIDEO_BOL_ClipService::TAGS_ENTITY_TYPE, $entityId, $statusActive);
         // Set rates status
         BOL_RateService::getInstance()->setEntityStatus(VIDEO_BOL_ClipService::RATES_ENTITY_TYPE, $entityId, $statusActive);
         $entityDto = $this->service->findClipById($entityId);
         $entityDto->status = $status;
         $this->service->saveClip($entityDto);
     }
 }
Esempio n. 10
0
 public function findPhotoList($type, $page, $limit, $checkPrivacy = true, $exclude = null)
 {
     if ($type == 'toprated') {
         $first = ($page - 1) * $limit;
         $topRatedList = BOL_RateService::getInstance()->findMostRatedEntityList('photo_rates', $first, $limit, $exclude);
         if (!$topRatedList) {
             return array();
         }
         $photoArr = $this->findPhotoInfoListByIdList(array_keys($topRatedList));
         $photos = array();
         foreach ($photoArr as $key => $photo) {
             $photos[$key] = $photo;
             $photos[$key]['score'] = $topRatedList[$photo['id']]['avgScore'];
             $photos[$key]['rates'] = $topRatedList[$photo['id']]['ratesCount'];
         }
         usort($photos, array('PHOTO_BOL_PhotoService', 'sortArrayItemByDesc'));
     } else {
         $photos = $this->getPhotoList($type, $page, $limit, $checkPrivacy, $exclude);
     }
     if ($photos) {
         foreach ($photos as $key => $photo) {
             $photos[$key]['url'] = $this->getPhotoUrl($photo['id'], $photo['hash'], FALSE);
         }
     }
     return $photos;
 }
Esempio n. 11
0
 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)));
             }
         }
     }
 }
Esempio n. 12
0
 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);
 }
Esempio n. 13
0
 public function myFile($params)
 {
     if ($params['userId'] != OW::getUser()->getId()) {
         throw new Redirect404Exception();
     }
     $page = empty($_GET['page']) ? 1 : $_GET['page'];
     $rpp = 5;
     $first = ($page - 1) * $rpp;
     $count = $rpp;
     $fileId = 0;
     $softs = SPDOWNLOAD_BOL_FileService::getInstance()->getFileListPage(OW::getUser()->getId(), $first, $rpp);
     $itemCount = SPDOWNLOAD_BOL_FileService::getInstance()->getCountFile(OW::getUser()->getId());
     $pageCount = ceil($itemCount / $rpp);
     $this->addComponent('paging', new BASE_CMP_Paging($page, $pageCount, 5));
     $url = OW::getPluginManager()->getPlugin('spdownload')->getUserFilesUrl();
     foreach ($softs as $key => $value) {
         $value->addedTime = date("Y-m-d H:i:s", $value->addedTime);
         $value->updated = date("Y-m-d H:i:s", $value->updated);
         $nameImage = 'icon_small_' . $value->id . '.png';
         $value->icon = $url . $nameImage;
         $rate = BOL_RateService::getInstance()->findRateInfoForEntityItem($value->id, self::RATES_ENTITY_TYPE);
         if (!empty($rate)) {
             $value->avg_score = $rate["avg_score"];
         }
         $value->url = OW::getRouter()->urlForRoute('spdownload.uploadId', array('fileId' => $value->id . '-' . $value->slug));
     }
     $this->assign('softs', $softs);
 }
Esempio n. 14
0
 public function countUsers()
 {
     return BOL_RateService::getInstance()->findMostRatedEntityCount('user_rates');
 }
Esempio n. 15
0
 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);
 }
Esempio n. 16
0
 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);
 }
Esempio n. 17
0
 private function getToolbar($idList, $list, $ulist, $nlist)
 {
     if (empty($idList)) {
         return array();
     }
     $info = array();
     $info['comment'] = BOL_CommentService::getInstance()->findCommentCountForEntityList('blog-post', $idList);
     $info['rate'] = BOL_RateService::getInstance()->findRateInfoForEntityList('blog-post', $idList);
     $info['tag'] = BOL_TagService::getInstance()->findTagListByEntityIdList('blog-post', $idList);
     $toolbars = array();
     foreach ($list as $item) {
         $id = $item['dto']->id;
         $userId = $item['dto']->authorId;
         $toolbars[$id] = array(array('class' => 'ow_icon_control ow_ic_user', 'label' => !empty($nlist[$userId]) ? $nlist[$userId] : OW::getLanguage()->text('base', 'deleted_user'), 'href' => !empty($ulist[$userId]) ? $ulist[$userId] : '#'), array('class' => 'ow_ipc_date', 'label' => UTIL_DateTime::formatDate($item['dto']->timestamp)));
         if ($info['rate'][$id]['avg_score'] > 0) {
             $toolbars[$id][] = array('label' => OW::getLanguage()->text('blogs', 'rate') . ' <span class="ow_txt_value">' . ($info['rate'][$id]['avg_score'] - intval($info['rate'][$id]['avg_score']) == 0 ? intval($info['rate'][$id]['avg_score']) : sprintf('%.2f', $info['rate'][$id]['avg_score'])) . '</span>');
         }
         if (!empty($info['comment'][$id])) {
             $toolbars[$id][] = array('label' => OW::getLanguage()->text('blogs', 'comments') . ' <span class="ow_txt_value">' . $info['comment'][$id] . '</span>');
         }
         if (empty($info['tag'][$id])) {
             continue;
         }
         $value = "<span class='ow_wrap_normal'>" . OW::getLanguage()->text('blogs', 'tags') . ' ';
         foreach ($info['tag'][$id] as $tag) {
             $value .= '<a href="' . OW::getRouter()->urlForRoute('blogs.list', array('list' => 'browse-by-tag')) . "?tag={$tag}" . "\">{$tag}</a>, ";
         }
         $value = mb_substr($value, 0, mb_strlen($value) - 2);
         $value .= "</span>";
         $toolbars[$id][] = array('label' => $value);
     }
     return $toolbars;
 }
Esempio n. 18
0
 /**
  * Counts photos
  *
  * @param string $type
  * @return int
  */
 public function countPhotosFeature($type, $checkPrivacy = true)
 {
     if ($type == 'toprated') {
         return BOL_RateService::getInstance()->findMostRatedEntityCount('photo');
     }
     return $this->advancedphotoDao->countPhotosFeature($type, $checkPrivacy);
 }
Esempio n. 19
0
 /**
  * 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;
 }
Esempio n. 20
0
 public function getFloatbox($params)
 {
     if (empty($params['photoId']) || !$params['photoId']) {
         throw new Redirect404Exception();
     }
     $photoId = (int) $params['photoId'];
     if (($photo = $this->photoService->findPhotoById($photoId)) === NULL) {
         return array('result' => 'error');
     }
     $event = new BASE_CLASS_EventCollector('photo.collectPhotoList');
     OW::getEventManager()->trigger($event);
     $data = array();
     $listTypes = array('list' => array_merge($event->getData(), array('latest', 'toprated', 'albumPhotos', 'userPhotos', 'featured', 'entityPhotos', 'most_discussed')), 'search' => array('hash', 'user', 'desc', 'all'));
     if (array_search($params['listType'], $listTypes['list']) === FALSE && array_search($params['listType'], $listTypes['search']) === FALSE) {
         $listType = 'latest';
     } else {
         $listType = $params['listType'];
     }
     switch ($listType) {
         case 'hash':
         case 'user':
         case 'desc':
         case 'all':
             $data['id'] = @$params['id'];
             $data['searchVal'] = $params['searchVal'];
             $listService = PHOTO_BOL_SearchService::getInstance();
             break;
         default:
             $event = new OW_Event('photo.getPhotoListService', array('listType' => $listType));
             OW::getEventManager()->trigger($event);
             $service = $event->getData();
             if (!empty($service)) {
                 $listService = $service;
             } else {
                 $listService = $this->photoService;
             }
             break;
     }
     $userId = OW::getUser()->getId();
     $resp = array('result' => TRUE);
     if (!empty($params['photos'])) {
         foreach (array_unique($params['photos']) as $photoId) {
             $resp['photos'][$photoId] = $this->prepareMarkup($photoId, $params['layout']);
             $resp['photos'][$photoId]['ownerId'] = $this->photoService->findPhotoOwner($photoId);
             $rateInfo = BOL_RateService::getInstance()->findRateInfoForEntityList('photo_rates', array($photoId));
             $userScore = BOL_RateService::getInstance()->findUserSocre($userId, 'photo_rates', array($photoId));
             $resp['photos'][$photoId]['rateInfo'] = $rateInfo[$photoId];
             $resp['photos'][$photoId]['userScore'] = $userScore[$photoId];
         }
     }
     if (!empty($params['loadPrevList']) || !empty($params['loadPrevPhoto'])) {
         $resp['prevList'] = $prevIdList = $listService->getPrevPhotoIdList($listType, $photo->id, $data);
         if (count($prevIdList) < PHOTO_BOL_PhotoService::ID_LIST_LIMIT) {
             $resp['prevCompleted'] = TRUE;
             $resp['firstList'] = $firstIdList = $listService->getFirstPhotoIdList($listType, $photo->id, $data);
         }
         if (!empty($params['loadPrevPhoto'])) {
             $prevId = !empty($prevIdList) ? min($prevIdList) : (!empty($firstIdList) ? min($firstIdList) : null);
             if ($prevId && !isset($resp['photos'][$prevId])) {
                 $resp['photos'][$prevId] = $this->prepareMarkup($prevId, $params['layout']);
                 $resp['photos'][$prevId]['ownerId'] = $this->photoService->findPhotoOwner($prevId);
                 $rateInfo = BOL_RateService::getInstance()->findRateInfoForEntityList('photo_rates', array($prevId));
                 $userScore = BOL_RateService::getInstance()->findUserSocre($userId, 'photo_rates', array($prevId));
                 $resp['photos'][$prevId]['rateInfo'] = $rateInfo[$prevId];
                 $resp['photos'][$prevId]['userScore'] = $userScore[$prevId];
             }
         }
     }
     if (!empty($params['loadNextList']) || !empty($params['loadNextPhoto'])) {
         $resp['nextList'] = $nextIdList = $listService->getNextPhotoIdList($listType, $photo->id, $data);
         if (count($nextIdList) < PHOTO_BOL_PhotoService::ID_LIST_LIMIT) {
             $resp['nextCompleted'] = TRUE;
             $resp['lastList'] = $lastIdList = $listService->getLastPhotoIdList($listType, $photo->id, $data);
         }
         if (!empty($params['loadNextPhoto'])) {
             $nextId = !empty($nextIdList) ? max($nextIdList) : (!empty($lastIdList) ? max($lastIdList) : null);
             if ($nextId && !isset($resp['photos'][$nextId])) {
                 $resp['photos'][$nextId] = $this->prepareMarkup($nextId, $params['layout']);
                 $resp['photos'][$nextId]['ownerId'] = $this->photoService->findPhotoOwner($nextId);
                 $rateInfo = BOL_RateService::getInstance()->findRateInfoForEntityList('photo_rates', array($nextId));
                 $userScore = BOL_RateService::getInstance()->findUserSocre($userId, 'photo_rates', array($nextId));
                 $resp['photos'][$nextId]['rateInfo'] = $rateInfo[$nextId];
                 $resp['photos'][$nextId]['userScore'] = $userScore[$nextId];
             }
         }
     }
     return $resp;
 }
Esempio n. 21
0
 public function onDeleteUserContent(OW_Event $event)
 {
     $params = $event->getParams();
     $userId = (int) $params['userId'];
     if ($userId > 0) {
         $moderatorId = BOL_AuthorizationService::getInstance()->getModeratorIdByUserId($userId);
         if ($moderatorId !== null) {
             BOL_AuthorizationService::getInstance()->deleteModerator($moderatorId);
         }
         BOL_AuthorizationService::getInstance()->deleteUserRolesByUserId($userId);
         if (isset($params['deleteContent']) && (bool) $params['deleteContent']) {
             BOL_CommentService::getInstance()->deleteUserComments($userId);
             BOL_RateService::getInstance()->deleteUserRates($userId);
             BOL_VoteService::getInstance()->deleteUserVotes($userId);
         }
         //delete widgets
         BOL_ComponentEntityService::getInstance()->onEntityDelete(BOL_ComponentEntityService::PLACE_DASHBOARD, $userId);
         BOL_ComponentEntityService::getInstance()->onEntityDelete(BOL_ComponentEntityService::PLACE_PROFILE, $userId);
         // delete email verify
         BOL_EmailVerifyService::getInstance()->deleteByUserId($userId);
         // delete remote auth info
         BOL_RemoteAuthService::getInstance()->deleteByUserId($userId);
         // delete user auth token
         BOL_AuthTokenDao::getInstance()->deleteByUserId($userId);
     }
 }
Esempio n. 22
0
 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');
 }
Esempio n. 23
0
 /**
  * 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;
 }
Esempio n. 24
0
 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');
 }