Esempio n. 1
0
 public function __construct($listType, $count, $exclude = null, $albumId = null)
 {
     parent::__construct();
     $this->photoService = PHOTO_BOL_PhotoService::getInstance();
     $this->photoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $checkPrivacy = !OW::getUser()->isAuthorized('photo');
     if ($albumId) {
         $photos = $this->photoService->getAlbumPhotos($albumId, 1, $count, $exclude);
     } else {
         $photos = $this->photoService->findPhotoList($listType, 1, $count, $checkPrivacy, $exclude);
     }
     $this->assign('photos', $photos);
     foreach ($photos as $photo) {
         array_push($exclude, $photo['id']);
     }
     if ($albumId) {
         $loadMore = $this->photoAlbumService->countAlbumPhotos($albumId, $exclude);
     } else {
         $loadMore = $this->photoService->countPhotos($listType, $checkPrivacy, $exclude);
     }
     if (!$loadMore) {
         $script = "OWM.trigger('photo.hide_load_more', {});";
         OW::getDocument()->addOnloadScript($script);
     }
 }
Esempio n. 2
0
 /**
  * Returns class instance
  *
  * @return PHOTO_BOL_PhotoService
  */
 public static function getInstance()
 {
     if (null === self::$classInstance) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Esempio n. 3
0
 public function import($params)
 {
     $importDir = $params['importDir'];
     $txtFile = $importDir . 'configs.txt';
     // import configs
     if (file_exists($txtFile)) {
         $string = file_get_contents($txtFile);
         $configs = json_decode($string, true);
     }
     if (!$configs) {
         return;
     }
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $types = array('main', 'preview', 'original');
     $photoDir = $photoService->getPhotoUploadDir();
     $page = 1;
     while (true) {
         $photos = $photoService->findPhotoList('latest', $page, 10);
         $page++;
         if (empty($photos)) {
             break;
         }
         foreach ($photos as $photo) {
             foreach ($types as $type) {
                 $path = $photoService->getPhotoPath($photo['id'], $photo['hash'], $type);
                 $photoName = str_replace($photoDir, '', $path);
                 $content = file_get_contents($configs['url'] . '/' . $photoName);
                 if (mb_strlen($content)) {
                     OW::getStorage()->fileSetContent($path, $content);
                 }
             }
         }
     }
 }
Esempio n. 4
0
 public function albumsDeleteProcess()
 {
     $config = OW::getConfig();
     // check if uninstall is in progress
     if (!$config->getValue('photo', 'uninstall_inprogress')) {
         return;
     }
     // check if cron queue is not busy
     if ($config->getValue('photo', 'uninstall_cron_busy')) {
         return;
     }
     $config->saveConfig('photo', 'uninstall_cron_busy', 1);
     $albumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     try {
         $albumService->deleteAlbums(self::ALBUMS_DELETE_LIMIT);
     } catch (Exception $e) {
         OW::getLogger()->addEntry(json_encode($e));
     }
     $config->saveConfig('photo', 'uninstall_cron_busy', 0);
     if (!$albumService->countAlbums()) {
         BOL_PluginService::getInstance()->uninstall('photo');
         $config->saveConfig('photo', 'uninstall_inprogress', 0);
         PHOTO_BOL_PhotoService::getInstance()->setMaintenanceMode(false);
     }
 }
Esempio n. 5
0
 /**
  * Returns photo list 
  *
  * @param string $type
  * @param int $page
  * @param int $limit
  * @return array of PHOTO_BOL_Photo
  */
 public function findPhotoList($type, $page, $limit, $checkPrivacy = true)
 {
     if ($type == 'toprated') {
         $first = ($page - 1) * $limit;
         $topRatedList = BOL_RateService::getInstance()->findMostRatedEntityList('photo_rates', $first, $limit);
         if (!$topRatedList) {
             return array();
         }
         $photoArr = $this->advancedphotoDao->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->advancedphotoDao->getPhotoList($type, $page, $limit, $checkPrivacy);
     }
     if ($photos) {
         foreach ($photos as $key => $photo) {
             $photos[$key]['url'] = $this->photoService->getPhotoPreviewUrl($photo['id']);
         }
     }
     return $photos;
 }
Esempio n. 6
0
 protected function onSubmitComplete($entityType, $entityId, PHOTO_BOL_PhotoAlbum $album, $photos)
 {
     $result = array();
     if (empty($photos)) {
         OW::getFeedback()->warning(OW::getLanguage()->text('photo', 'no_photo_uploaded'));
         $result["url"] = OW::getRouter()->urlFor(get_class($this), "uploadReset", array("entityType" => $entityType, "entityId" => $entityId));
         return $result;
     }
     $movedArray = array();
     foreach ($photos as $photo) {
         $movedArray[] = array('entityType' => $entityType, 'entityId' => $entityId, 'addTimestamp' => $photo->addDatetime, 'photoId' => $photo->id, 'hash' => $photo->hash);
     }
     $event = new OW_Event(PHOTO_CLASS_EventHandler::EVENT_ON_PHOTO_ADD, $movedArray);
     OW::getEventManager()->trigger($event);
     $userId = OW::getUser()->getId();
     $result["url"] = OW::getRouter()->urlForRoute('photo_user_album', array('user' => BOL_UserService::getInstance()->getUserName($userId), 'album' => $album->id));
     $photoCount = count($photos);
     if ($photoCount == 1) {
         $this->photoService->triggerNewsfeedEventOnSinglePhotoAdd($photos[0]->id, $userId);
     } else {
         $this->photoService->triggerNewsfeedEventOnMultiplePhotosAdd($photos, $userId, $album);
     }
     OW::getFeedback()->info(OW::getLanguage()->text('photo', 'photos_uploaded', array('count' => $photoCount)));
     return $result;
 }
Esempio n. 7
0
 public function view(array $params)
 {
     if (!isset($params['id']) || !($photoId = (int) $params['id'])) {
         throw new Redirect404Exception();
     }
     $lang = OW::getLanguage();
     $photo = $this->photoService->findPhotoById($photoId);
     if (!$photo) {
         throw new Redirect404Exception();
     }
     $album = $this->photoAlbumService->findAlbumById($photo->albumId);
     $this->assign('album', $album);
     $ownerName = BOL_UserService::getInstance()->getUserName($album->userId);
     $albumUrl = OW::getRouter()->urlForRoute('photo_user_album', array('album' => $album->id, 'user' => $ownerName));
     $this->assign('albumUrl', $albumUrl);
     // is owner
     $contentOwner = $this->photoService->findPhotoOwner($photo->id);
     $userId = OW::getUser()->getId();
     $ownerMode = $contentOwner == $userId;
     $this->assign('ownerMode', $ownerMode);
     // is moderator
     $modPermissions = OW::getUser()->isAuthorized('photo');
     $this->assign('moderatorMode', $modPermissions);
     $this->assign('url', $this->photoService->getPhotoUrl($photo->id, false, $photo->hash));
     if (!$ownerMode && !$modPermissions && !OW::getUser()->isAuthorized('photo', 'view')) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('photo', 'view');
         $this->assign('authError', $status['msg']);
         return;
     }
     // permissions check
     if (!$ownerMode && !$modPermissions) {
         $privacyParams = array('action' => 'photo_view_album', 'ownerId' => $contentOwner, 'viewerId' => $userId);
         $event = new OW_Event('privacy_check_permission', $privacyParams);
         OW::getEventManager()->trigger($event);
     }
     $photo->description = UTIL_HtmlTag::autoLink($photo->description);
     $this->assign('photo', $photo);
     $fullsizeUrl = (int) OW::getConfig()->getValue('photo', 'store_fullsize') && $photo->hasFullsize ? $this->photoService->getPhotoFullsizeUrl($photo->id, $photo->hash) : null;
     $this->assign('fullsizeUrl', $fullsizeUrl);
     $this->assign('nextPhoto', $this->photoService->getNextPhotoId($photo->albumId, $photo->id));
     $this->assign('previousPhoto', $this->photoService->getPreviousPhotoId($photo->albumId, $photo->id));
     $photoCount = $this->photoAlbumService->countAlbumPhotos($photo->albumId);
     $this->assign('photoCount', $photoCount);
     $photoIndex = $this->photoService->getPhotoIndex($photo->albumId, $photo->id);
     $this->assign('photoIndex', $photoIndex);
     $avatar = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($contentOwner), true, true, true, false);
     $this->assign('avatar', $avatar[$contentOwner]);
     $cmtParams = new BASE_CommentsParams('photo', 'photo_comments');
     $cmtParams->setEntityId($photo->id);
     $cmtParams->setOwnerId($contentOwner);
     $cmtParams->setDisplayType(BASE_CommentsParams::DISPLAY_TYPE_BOTTOM_FORM_WITH_FULL_LIST);
     $photoCmts = new BASE_MCMP_Comments($cmtParams);
     $this->addComponent('comments', $photoCmts);
     OW::getDocument()->setHeading($album->name);
     $description = strip_tags($photo->description);
     $description = mb_strlen($description) ? $description : $photo->id;
     OW::getDocument()->setTitle($lang->text('photo', 'meta_title_photo_view', array('title' => $description)));
 }
Esempio n. 8
0
 public function __construct($photoId)
 {
     parent::__construct();
     $photoEditForm = new PHOTO_CLASS_EditForm($photoId);
     $this->addForm($photoEditForm);
     $photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId);
     $photoEditForm->getElement('id')->setValue($photoId);
     $photoEditForm->getElement('description')->setValue($photo->description);
 }
Esempio n. 9
0
 public function export($params)
 {
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $url = OW::getStorage()->getFileUrl($photoService->getPhotoUploadDir());
     /* @var $za ZipArchives */
     $za = $params['zipArchive'];
     $archiveDir = $params['archiveDir'];
     $string = json_encode(array('url' => $url));
     $za->addFromString($archiveDir . '/' . 'configs.txt', $string);
 }
Esempio n. 10
0
 public function __construct($userId)
 {
     $photos = PHOTO_BOL_PhotoService::getInstance()->findPhotoList('latest', 1, 2);
     if (empty($photos)) {
         $this->setVisible(false);
         return;
     }
     $items = array();
     foreach ($photos as $item) {
         $items[] = array('src' => $item['url']);
     }
     parent::__construct($items, 'Photos');
 }
Esempio n. 11
0
 public function __construct($albumId = NULL, $albumName = NULL, $albumDescription = null, $url = NULL)
 {
     if (!OW::getUser()->isAuthorized('photo', 'upload')) {
         $this->setVisible(FALSE);
         return;
     }
     $userId = OW::getUser()->getId();
     $document = OW::getDocument();
     PHOTO_BOL_PhotoTemporaryService::getInstance()->deleteUserTemporaryPhotos($userId);
     $plugin = OW::getPluginManager()->getPlugin('photo');
     $document->addStyleSheet($plugin->getStaticCssUrl() . 'photo_upload.css');
     $document->addScript($plugin->getStaticJsUrl() . 'jQueryRotate.min.js');
     $document->addScript($plugin->getStaticJsUrl() . 'codemirror.min.js');
     $document->addScript($plugin->getStaticJsUrl() . 'upload.js');
     $document->addScriptDeclarationBeforeIncludes(UTIL_JsGenerator::composeJsString(';window.ajaxPhotoUploadParams = {};
             Object.defineProperties(ajaxPhotoUploadParams, {
                 actionUrl: {
                     value: {$url},
                     writable: false,
                     enumerable: true
                 },
                 maxFileSize: {
                     value: {$size},
                     writable: false,
                     enumerable: true
                 },
                 deleteAction: {
                     value: {$deleteAction},
                     writable: false,
                     enumerable: true
                 }
             });', array('url' => OW::getRouter()->urlForRoute('photo.ajax_upload'), 'size' => PHOTO_BOL_PhotoService::getInstance()->getMaxUploadFileSize(), 'deleteAction' => OW::getRouter()->urlForRoute('photo.ajax_upload_delete'))));
     $document->addOnloadScript(';window.ajaxPhotoUploader.init();');
     $this->addForm(new PHOTO_CLASS_AjaxUploadForm('user', $userId, $albumId, $albumName, $albumDescription, $url));
     $newsfeedAlbum = PHOTO_BOL_PhotoAlbumService::getInstance()->getNewsfeedAlbum($userId);
     $this->assign('albumNameList', PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumNameListByUserId($userId, !empty($newsfeedAlbum) ? array($newsfeedAlbum->id) : array()));
     $language = OW::getLanguage();
     $language->addKeyForJs('photo', 'not_all_photos_uploaded');
     $language->addKeyForJs('photo', 'size_limit');
     $language->addKeyForJs('photo', 'type_error');
     $language->addKeyForJs('photo', 'dnd_support');
     $language->addKeyForJs('photo', 'dnd_not_support');
     $language->addKeyForJs('photo', 'drop_here');
     $language->addKeyForJs('photo', 'please_wait');
     $language->addKeyForJs('photo', 'create_album');
     $language->addKeyForJs('photo', 'album_name');
     $language->addKeyForJs('photo', 'album_desc');
     $language->addKeyForJs('photo', 'describe_photo');
     $language->addKeyForJs('photo', 'photo_upload_error');
 }
Esempio n. 12
0
 public function onInfoRender(OW_Event $event)
 {
     $language = OW::getLanguage();
     $params = $event->getParams();
     if ($params["entityType"] != HINT_BOL_Service::ENTITY_TYPE_USER) {
         return;
     }
     $userId = $params["entityId"];
     if ($params["key"] != "photo-count") {
         return;
     }
     $count = PHOTO_BOL_PhotoService::getInstance()->countUserPhotos($userId);
     $url = OW::getRouter()->urlForRoute("photo_user_albums", array("user" => BOL_UserService::getInstance()->getUserName($userId)));
     $event->setData($language->text("hint", "info_photo_count", array("count" => $count, "url" => $url)));
 }
Esempio n. 13
0
 public function getFloatbox()
 {
     if (empty($_POST['photoId']) || !$_POST['photoId']) {
         throw new Redirect404Exception();
     }
     $photoId = (int) $_POST['photoId'];
     $service = PHOTO_BOL_PhotoService::getInstance();
     $photo = $service->findPhotoById($photoId);
     if (!$photo) {
         exit(json_encode(array('result' => 'error')));
     }
     // is moderator
     $moderatorMode = OW::getUser()->isAuthorized('photo');
     $userId = OW::getUser()->getId();
     $resp['result'] = "success";
     if ($_POST['current'] == "true") {
         $resp['current'] = $this->prepareMarkup($photoId);
         $contentOwner = $this->photoService->findPhotoOwner($photoId);
         $ownerMode = $contentOwner == $userId;
         $resp['current']['authorized'] = $ownerMode || $moderatorMode || OW::getUser()->isAuthorized('photo', 'view');
     }
     if ($_POST['prev'] == "true") {
         $prevPhoto = $service->getPreviousPhoto($photo->albumId, $photo->id);
         if ($prevPhoto) {
             $resp['prev'] = $this->prepareMarkup($prevPhoto['dto']->id);
             $resp['prev']['prev'] = $service->getPreviousPhotoId($photo->albumId, $prevPhoto['dto']->id);
             $resp['prev']['next'] = $photo->id;
             $resp['current']['prev'] = $prevPhoto['dto']->id;
             $contentOwner = $this->photoService->findPhotoOwner($prevPhoto['dto']->id);
             $ownerMode = $contentOwner == $userId;
             $resp['prev']['authorized'] = $ownerMode || $moderatorMode || OW::getUser()->isAuthorized('photo', 'view');
         }
     }
     if ($_POST['next'] == "true") {
         $nextPhoto = $service->getNextPhoto($photo->albumId, $photo->id);
         if ($nextPhoto) {
             $resp['next'] = $this->prepareMarkup($nextPhoto['dto']->id);
             $resp['next']['prev'] = $photo->id;
             $resp['next']['next'] = $service->getNextPhotoId($photo->albumId, $nextPhoto['dto']->id);
             $resp['current']['next'] = $nextPhoto['dto']->id;
             $contentOwner = $this->photoService->findPhotoOwner($nextPhoto['dto']->id);
             $ownerMode = $contentOwner == $userId;
             $resp['next']['authorized'] = $ownerMode || $moderatorMode || OW::getUser()->isAuthorized('photo', 'view');
         }
     }
     exit(json_encode($resp));
 }
Esempio n. 14
0
 public function findIndexedData($searchVal, array $entityTypes = array(), $limit = PHOTO_BOL_SearchService::SEARCH_LIMIT)
 {
     $condition = PHOTO_BOL_PhotoService::getInstance()->getQueryCondition('searchByDesc', array('photo' => 'p', 'album' => 'a'));
     $sql = 'SELECT `index`.*
         FROM `' . $this->getTableName() . '` AS `index`
             INNER JOIN `' . PHOTO_BOL_PhotoDao::getInstance()->getTableName() . '` AS `p` ON(`index`.`entityId` = `p`.`id`)
             INNER JOIN `' . PHOTO_BOL_PhotoAlbumDao::getInstance()->getTableName() . '` AS `a` ON(`a`.`id` = `p`.`albumId`)
         ' . $condition['join'] . '
         WHERE MATCH(`index`.`' . self::CONTENT . '`) AGAINST(:val IN BOOLEAN MODE) AND `p`.`privacy` = :everybody AND `p`.`status` = :status AND ' . $condition['where'];
     if (count($entityTypes) !== 0) {
         $sql .= ' AND `index`.`' . self::ENTITY_TYPE_ID . '` IN (SELECT `entity`.`id`
             FROM `' . PHOTO_BOL_SearchEntityTypeDao::getInstance()->getTableName() . '` AS `entity`
             WHERE `entity`.`' . PHOTO_BOL_SearchEntityTypeDao::ENTITY_TYPE . '` IN( ' . $this->dbo->mergeInClause($entityTypes) . '))';
     }
     $sql .= ' LIMIT :limit';
     return $this->dbo->queryForObjectList($sql, $this->getDtoClassName(), array_merge($condition['params'], array('val' => $searchVal, 'limit' => (int) $limit, 'everybody' => PHOTO_BOL_PhotoDao::PRIVACY_EVERYBODY, 'status' => 'approved')));
 }
Esempio n. 15
0
 public function __construct($photoId = NULL)
 {
     parent::__construct('photo-edit-form');
     $this->setAjax(TRUE);
     $this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxUpdatePhoto'));
     $this->bindJsFunction('success', 'function( data )
         {
             OW.trigger("photo.afterPhotoEdit", data);
         }');
     $photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId);
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($photo->albumId);
     $photoIdField = new HiddenField('photoId');
     $photoIdField->setRequired(TRUE);
     $photoIdField->setValue($photo->id);
     $photoIdField->addValidator(new PHOTO_CLASS_PhotoOwnerValidator());
     $this->addElement($photoIdField);
     $albumField = new TextField('album');
     $albumField->setId('ajax-upload-album');
     $albumField->setRequired();
     $albumField->setValue($album->name);
     $albumField->setLabel(OW::getLanguage()->text('photo', 'create_album'));
     $albumField->addAttribute('class', 'ow_dropdown_btn ow_inputready ow_cursor_pointer');
     $albumField->addAttribute('autocomplete', 'off');
     $albumField->addAttribute('readonly');
     $this->addElement($albumField);
     $albumNameField = new TextField('album-name');
     $albumNameField->setRequired();
     $albumNameField->setValue($album->name);
     $albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(FALSE, NULL, $album->name));
     $albumNameField->setHasInvitation(TRUE);
     $albumNameField->setInvitation(OW::getLanguage()->text('photo', 'album_name'));
     $albumNameField->addAttribute('class', 'ow_smallmargin invitation');
     $this->addElement($albumNameField);
     $desc = new Textarea('description');
     $desc->setHasInvitation(TRUE);
     $desc->setInvitation(OW::getLanguage()->text('photo', 'album_desc'));
     $this->addElement($desc);
     $photoDesc = new PHOTO_CLASS_HashtagFormElement('photo-desc');
     $photoDesc->setValue($photo->description);
     $photoDesc->setLabel(OW::getLanguage()->text('photo', 'album_desc'));
     $this->addElement($photoDesc);
     $submit = new Submit('edit');
     $submit->setValue(OW::getLanguage()->text('photo', 'btn_edit'));
     $this->addElement($submit);
 }
Esempio n. 16
0
 public function findUserPhotos($userId, $start, $offset)
 {
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $photoDao = PHOTO_BOL_PhotoDao::getInstance();
     $albumDao = PHOTO_BOL_PhotoAlbumDao::getInstance();
     $query = 'SELECT p.* FROM ' . $photoDao->getTableName() . ' AS p
         INNER JOIN ' . $albumDao->getTableName() . ' AS a ON p.albumId=a.id
             WHERE a.userId=:u AND p.status = "approved" ORDER BY p.addDatetime DESC
                 LIMIT :start, :offset';
     $list = OW::getDbo()->queryForList($query, array('u' => $userId, 'start' => $start, 'offset' => $offset));
     $out = array();
     foreach ($list as $photo) {
         $id = $photo['id'];
         $out[$id] = array('id' => $id, 'thumb' => $photoService->getPhotoPreviewUrl($id), 'url' => $photoService->getPhotoUrl($id), 'path' => $photoService->getPhotoPath($id), 'description' => $photo['description'], 'permalink' => OW::getRouter()->urlForRoute('view_photo', array('id' => $id)));
         $out[$id]['oembed'] = json_encode(array('type' => 'photo', 'url' => $out[$id]['url'], 'href' => $out[$id]['permalink'], 'description' => $out[$id]['description']));
     }
     return $out;
 }
Esempio n. 17
0
 /**
  * Class constructor
  */
 public function __construct($photoId)
 {
     parent::__construct('photo-edit-form');
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxUpdatePhoto'));
     $language = OW::getLanguage();
     $photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId);
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($photo->albumId);
     $userId = OW::getUser()->getId();
     // photo id field
     $photoIdField = new HiddenField('id');
     $photoIdField->setRequired(true);
     $this->addElement($photoIdField);
     // photo album Field
     $albumField = new SuggestField('album');
     $responderUrl = OW::getRouter()->urlFor('PHOTO_CTRL_Upload', 'suggestAlbum', array('userId' => $userId));
     $albumField->setResponderUrl($responderUrl);
     if ($album) {
         $albumField->setValue($album->name);
     }
     $albumField->setRequired(true);
     $albumField->setLabel($language->text('photo', 'album'));
     $this->addElement($albumField);
     // description Field
     $descField = new WysiwygTextarea('description', null, false);
     $descField->setId("photo-desc-area");
     $this->addElement($descField->setLabel($language->text('photo', 'description')));
     $tags = array();
     $entityTags = BOL_TagService::getInstance()->findEntityTags($photo->id, 'photo');
     if ($entityTags) {
         $tags = array();
         foreach ($entityTags as $entityTag) {
             $tags[] = $entityTag->label;
         }
         $tagsField = new TagsInputField('tags');
         $tagsField->setValue($tags);
     } else {
         $tagsField = new TagsInputField('tags');
     }
     $this->addElement($tagsField->setLabel($language->text('photo', 'tags')));
     $submit = new Submit('edit');
     $submit->setValue($language->text('photo', 'btn_edit'));
     $this->addElement($submit);
 }
Esempio n. 18
0
 /**
  * @param BASE_CLASS_WidgetParameter $paramObj
  */
 public function __construct(BASE_CLASS_WidgetParameter $paramObj)
 {
     parent::__construct();
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $num = isset($paramObj->customParamList['photoCount']) ? $paramObj->customParamList['photoCount'] : 8;
     $cmpParams = array('photoCount' => $num, 'checkAuth' => false, 'wrapBox' => false, 'uniqId' => uniqid(), 'showTitle' => false, 'showToolbar' => true);
     if (!$paramObj->customizeMode) {
         $items = array('latest', 'toprated');
         if ($photoService->countPhotos('featured')) {
             $items[] = 'featured';
         }
         $menuItems = PHOTO_CMP_IndexPhotoList::getMenuItems($items, $cmpParams['uniqId']);
         $this->addComponent('menu', new BASE_CMP_WidgetMenu($menuItems));
     } else {
         $cmpParams['showMenu'] = false;
     }
     $cmp = new PHOTO_CMP_IndexPhotoList($cmpParams);
     $this->addComponent('cmp', $cmp);
 }
Esempio n. 19
0
 public function getMenuItems(array $keys, $uniqId)
 {
     $lang = OW::getLanguage();
     $menuItems = array();
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     if (in_array('latest', $keys)) {
         $count = $photoService->countPhotos('latest');
         $menuItems['latest'] = array('label' => $lang->text('photo', 'menu_latest'), 'id' => 'photo-cmp-menu-latest-' . $uniqId, 'contId' => 'photo-cmp-latest-' . $uniqId, 'active' => true, 'visibility' => $count > $this->visiblePhotoCount ? true : false);
     }
     if (in_array('featured', $keys)) {
         $count = $photoService->countPhotos('featured');
         $menuItems['featured'] = array('label' => $lang->text('photo', 'menu_featured'), 'id' => 'photo-cmp-menu-featured-' . $uniqId, 'contId' => 'photo-cmp-featured-' . $uniqId, 'active' => false, 'visibility' => $count > $this->visiblePhotoCount ? true : false);
     }
     if (in_array('toprated', $keys)) {
         $count = $photoService->countPhotos('toprated');
         $menuItems['toprated'] = array('label' => $lang->text('photo', 'menu_toprated'), 'id' => 'photo-cmp-menu-toprated-' . $uniqId, 'contId' => 'photo-cmp-toprated-' . $uniqId, 'active' => false, 'visibility' => $count > $this->visiblePhotoCount ? true : false);
     }
     return $menuItems;
 }
Esempio n. 20
0
 public function download(array $params)
 {
     $config = OW::getConfig();
     $canDownload = $config->getValue('gphotoviewer', 'can_users_to_download_photos');
     if (!$canDownload) {
         throw new Redirect404Exception();
     }
     if (!isset($params['id']) || !($photoId = (int) $params['id'])) {
         throw new Redirect404Exception();
     }
     $photo = $this->photoService->findPhotoById($photoId);
     if (!$photo) {
         throw new Redirect404Exception();
     }
     $canView = true;
     if (!$ownerMode && !$modPermissions && !OW::getUser()->isAuthorized('photo', 'view')) {
         $canView = false;
         throw new Redirect404Exception();
     }
     if ((int) BOL_PluginService::getInstance()->findPluginByKey('photo')->build > 6272) {
         $url = $this->photoService->getPhotoPath($photo->id, $photo->hash);
     } else {
         $url = $this->photoService->getPhotoPath($photo->id);
     }
     if (file_exists($url) && is_readable($url)) {
         header('Content-Description: File Transfer');
         header('Content-Type: application/octet-stream');
         header('Content-Disposition: attachment; filename=' . basename($url));
         header('Content-Transfer-Encoding: binary');
         header('Expires: 0');
         header('Cache-Control: must-revalidate');
         header('Pragma: public');
         header('Content-Length: ' . filesize($url));
         ob_clean();
         flush();
         readfile($url);
         exit;
     } else {
         throw new Redirect404Exception();
     }
     exit;
 }
Esempio n. 21
0
 public function getService($pluginKey)
 {
     switch ($pluginKey) {
         case 'newsfeed':
             return NEWSFEED_BOL_Service::getInstance();
         case 'blogs':
             return PostService::getInstance();
         case 'groups':
             return GROUPS_BOL_Service::getInstance();
         case 'event':
             return EVENT_BOL_EventService::getInstance();
         case 'links':
             return LinkService::getInstance();
         case 'video':
             return VIDEO_BOL_ClipService::getInstance();
         case 'forum':
             return FORUM_BOL_ForumService::getInstance();
         case 'photo':
             return PHOTO_BOL_PhotoService::getInstance();
     }
 }
Esempio n. 22
0
 /**
  * @param BASE_CLASS_WidgetParameter $paramObj
  */
 public function __construct(BASE_CLASS_WidgetParameter $paramObj)
 {
     parent::__construct();
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $num = !empty($paramObj->customParamList['photoCount']) ? $paramObj->customParamList['photoCount'] : 8;
     $cmpParams = array('photoCount' => $num, 'checkAuth' => false, 'wrapBox' => false, 'uniqId' => uniqid(), 'showTitle' => false, 'showToolbar' => true);
     $uniqId = $cmpParams['uniqId'];
     $cmp = new PHOTO_MCMP_IndexPhotoList($cmpParams);
     $this->addComponent('cmp', $cmp);
     $items = array('latest', 'toprated');
     if ($photoService->countPhotos('featured')) {
         $items[] = 'featured';
     }
     $menuItems = $cmp->getMenuItems($items, $uniqId);
     $menuCmp = new BASE_MCMP_WidgetMenu($menuItems);
     $paramObj->standartParamList->capContent = $menuCmp->render();
     $this->setSettingValue(self::SETTING_TOOLBAR, PHOTO_MCMP_IndexPhotoList::getToolbar($uniqId));
     $script = '';
     foreach ($menuItems as $key => $item) {
         if (!empty($item["visibility"])) {
             $script .= '
                 $("#photo-cmp-menu-' . $key . '-' . $uniqId . '").click(function(){
                     var list = $("#toolbar-photo-' . $key . '-' . $uniqId . '").parents("div:eq(0)").find("a");
                     list.hide();
                     list.css("visibility","hidden");
                     $("#toolbar-photo-' . $key . '-' . $uniqId . '").css("visibility","visible").show();
                 }); ';
         } else {
             $script .= '
                 $("#photo-cmp-menu-' . $key . '-' . $uniqId . '").click(function(){
                     var list = $("#toolbar-photo-' . $key . '-' . $uniqId . '").parents("div:eq(0)").find("a");
                     list.hide();
                     list.css("visibility","hidden");
                     $("#toolbar-photo-' . $key . '-' . $uniqId . '").show();
                 }); ';
         }
     }
     OW::getDocument()->addOnloadScript($script);
     $this->setTemplate(OW::getPluginManager()->getPlugin('photo')->getMobileCmpViewDir() . 'photo_list_widget.html');
 }
Esempio n. 23
0
 /**
  * @return Constructor.
  */
 public function __construct(BASE_CLASS_WidgetParameter $paramObj)
 {
     parent::__construct();
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $photoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $userId = $paramObj->additionalParamList['entityId'];
     $user = BOL_UserService::getInstance()->getUserName($userId);
     $this->assign('user', $user);
     $num = isset($paramObj->customParamList['albumsCount']) ? $paramObj->customParamList['albumsCount'] : 4;
     $albums = $photoAlbumService->findUserAlbumList($userId, 1, $num);
     if ($albums) {
         $this->assign('albums', $albums);
         $albumsCount = $photoAlbumService->countUserAlbums($userId);
         $this->assign('albumsCount', $albumsCount);
     } else {
         if (!$paramObj->customizeMode) {
             $this->setVisible(false);
         }
         $this->assign('albums', null);
         $this->assign('albumsCount', 0);
         $albumsCount = 0;
     }
     // privacy check
     $viewerId = OW::getUser()->getId();
     $ownerMode = $userId == $viewerId;
     $modPermissions = OW::getUser()->isAuthorized('photo');
     if (!$ownerMode && !$modPermissions) {
         $privacyParams = array('action' => 'photo_view_album', 'ownerId' => $userId, 'viewerId' => $viewerId);
         $event = new OW_Event('privacy_check_permission', $privacyParams);
         try {
             OW::getEventManager()->trigger($event);
         } catch (RedirectException $e) {
             $this->setVisible(false);
         }
     }
     $showTitles = isset($paramObj->customParamList['showTitles']) ? $paramObj->customParamList['showTitles'] : false;
     $this->assign('showTitles', $showTitles);
     $lang = OW::getLanguage();
     $this->setSettingValue(self::SETTING_TOOLBAR, array(array('label' => $lang->text('photo', 'total_albums', array('total' => $albumsCount))), array('label' => $lang->text('base', 'view_all'), 'href' => OW::getRouter()->urlForRoute('photo_user_albums', array('user' => $user)))));
 }
Esempio n. 24
0
 public function __construct($albumId = null, $albumName = null, $albumDescription = null, $url = null, $data = null)
 {
     parent::__construct();
     if (!OW::getUser()->isAuthorized('photo', 'upload')) {
         $this->setVisible(false);
         return;
     }
     $userId = OW::getUser()->getId();
     $document = OW::getDocument();
     PHOTO_BOL_PhotoTemporaryService::getInstance()->deleteUserTemporaryPhotos($userId);
     $plugin = OW::getPluginManager()->getPlugin('photo');
     $document->addStyleSheet($plugin->getStaticCssUrl() . 'photo_upload.css');
     $document->addScript($plugin->getStaticJsUrl() . 'codemirror.min.js');
     $document->addScript($plugin->getStaticJsUrl() . 'upload.js');
     $document->addScriptDeclarationBeforeIncludes(UTIL_JsGenerator::composeJsString(';window.ajaxPhotoUploadParams = Object.freeze({$params});', array('params' => array('actionUrl' => OW::getRouter()->urlForRoute('photo.ajax_upload'), 'maxFileSize' => PHOTO_BOL_PhotoService::getInstance()->getMaxUploadFileSize(), 'deleteAction' => OW::getRouter()->urlForRoute('photo.ajax_upload_delete')))));
     $document->addOnloadScript(';window.ajaxPhotoUploader.init();');
     $form = new PHOTO_CLASS_AjaxUploadForm('user', $userId, $albumId, $albumName, $albumDescription, $url, $data);
     $this->addForm($form);
     $this->assign('extendInputs', $form->getExtendedElements());
     $this->assign('albumId', $albumId);
     $this->assign('userId', $userId);
     $newsfeedAlbum = PHOTO_BOL_PhotoAlbumService::getInstance()->getNewsfeedAlbum($userId);
     $exclude = !empty($newsfeedAlbum) ? array($newsfeedAlbum->id) : array();
     $this->addComponent('albumNames', OW::getClassInstance('PHOTO_CMP_AlbumNameList', $userId, $exclude));
     $language = OW::getLanguage();
     $language->addKeyForJs('photo', 'not_all_photos_uploaded');
     $language->addKeyForJs('photo', 'size_limit');
     $language->addKeyForJs('photo', 'type_error');
     $language->addKeyForJs('photo', 'dnd_support');
     $language->addKeyForJs('photo', 'dnd_not_support');
     $language->addKeyForJs('photo', 'drop_here');
     $language->addKeyForJs('photo', 'please_wait');
     $language->addKeyForJs('photo', 'create_album');
     $language->addKeyForJs('photo', 'album_name');
     $language->addKeyForJs('photo', 'album_desc');
     $language->addKeyForJs('photo', 'describe_photo');
     $language->addKeyForJs('photo', 'photo_upload_error');
 }
Esempio n. 25
0
$EmailVerifyService = BOL_EmailVerifyService::getInstance();
$BOL_AvatarService_inst = BOL_AvatarService::getInstance();
$SKAPI_BOL_Service_inst = SKAPI_BOL_Service::getInstance();
$PHOTO_BOL_PhotoService_inst = PHOTO_BOL_PhotoService::getInstance();
$PHOTO_BOL_PhotoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
$PHOTO_BOL_PhotoTemporaryService = PHOTO_BOL_PhotoTemporaryService::getInstance();
$UserResetPassword = BOL_UserResetPasswordDao::getInstance();
$QuestionService = BOL_QuestionService::getInstance();
$AccountTypeToGenderService = SKADATE_BOL_AccountTypeToGenderService::getInstance();
$BOL_AuthorizationService = BOL_AuthorizationService::getInstance();
$BOL_UserOnlineDao = BOL_UserOnlineDao::getInstance();
$USEARCH_BOL_Service = USEARCH_BOL_Service::getInstance();
$BOL_SearchService = BOL_SearchService::getInstance();
$getPluginManager = OW::getPluginManager();
$CONTACTUS_BOL_Service = CONTACTUS_BOL_Service::getInstance();
$PHOTO_BOL_PhotoService = PHOTO_BOL_PhotoService::getInstance();
$PHOTO_BOL_PhotoAlbumCoverDao = PHOTO_BOL_PhotoAlbumCoverDao::getInstance();
$PHOTO_BOL_PhotoDao = PHOTO_BOL_PhotoDao::getInstance();
$getRouter = OW::getRouter();
$language = OW::getLanguage();
$getMailer = OW::getMailer();
$getConfig = OW::getConfig();
$getFeedback = OW::getFeedback();
$getEventManager = OW::getEventManager();
$getMailer = OW::getMailer();
$ow = OW_DB_PREFIX;
$LanguageService = BOL_LanguageService::getInstance();
$OW_Language = OW_Language::getInstance();
$QUESTION_PRESENTATION_DATE = BOL_QuestionService::QUESTION_PRESENTATION_DATE;
$QUESTION_PRESENTATION_RANGE = BOL_QuestionService::QUESTION_PRESENTATION_RANGE;
$QUESTION_PRESENTATION_BIRTHDATE = BOL_QuestionService::QUESTION_PRESENTATION_BIRTHDATE;
Esempio n. 26
0
    /**
     * Class constructor
     *
     * @param string $listType
     * @param int $count
     * @param string $tag
     */
    public function __construct(array $params)
    {
        parent::__construct();
        $listType = $params['type'];
        $count = isset($params['count']) ? $params['count'] : 5;
        $this->photoService = PHOTO_BOL_PhotoService::getInstance();
        $page = !empty($_GET['page']) && (int) $_GET['page'] ? abs((int) $_GET['page']) : 1;
        $config = OW::getConfig();
        $photosPerPage = $config->getValue('photo', 'photos_per_page');
        if (isset($params['tag']) && strlen($tag = $params['tag'])) {
            $photos = $this->photoService->findTaggedPhotos($tag, $page, $photosPerPage);
            $records = $this->photoService->countTaggedPhotos($tag);
        } else {
            $checkPrivacy = $listType == 'latest' && !OW::getUser()->isAuthorized('photo');
            $photos = $this->photoService->findPhotoList($listType, $page, $photosPerPage, $checkPrivacy);
            $records = $this->photoService->countPhotos($listType, $checkPrivacy);
        }
        if ($photos) {
            $userIds = array();
            foreach ($photos as $photo) {
                if (!in_array($photo['userId'], $userIds)) {
                    array_push($userIds, $photo['userId']);
                }
            }
            $names = BOL_UserService::getInstance()->getDisplayNamesForList($userIds);
            $this->assign('names', $names);
            $usernames = BOL_UserService::getInstance()->getUserNamesForList($userIds);
            $this->assign('usernames', $usernames);
            // Paging
            $pages = (int) ceil($records / $photosPerPage);
            $paging = new BASE_CMP_Paging($page, $pages, 10);
            $this->addComponent('paging', $paging);
            $this->assign('photos', $photos);
            $this->assign('no_content', false);
        } else {
            $this->assign('no_content', true);
        }
        $this->assign('listType', $listType);
        $this->assign('widthConfig', $config->getValue('photo', 'preview_image_width'));
        $this->assign('heightConfig', $config->getValue('photo', 'preview_image_height'));
        $this->assign('count', $count);
        OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'jquery.bbq.min.js');
        OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('photo')->getStaticJsUrl() . 'photo.js');
        OW::getLanguage()->addKeyForJs('photo', 'tb_edit_photo');
        OW::getLanguage()->addKeyForJs('photo', 'confirm_delete');
        OW::getLanguage()->addKeyForJs('photo', 'mark_featured');
        OW::getLanguage()->addKeyForJs('photo', 'remove_from_featured');
        $objParams = array('ajaxResponder' => OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxResponder'), 'fbResponder' => OW::getRouter()->urlForRoute('photo.floatbox'));
        $script = '$("div.ow_photo_list_item_thumb a").on("click", function(e){
            e.preventDefault();
            var photo_id = $(this).attr("rel");

            if ( !window.photoViewObj ) {
                window.photoViewObj = new photoView(' . json_encode($objParams) . ');
            }
            
            window.photoViewObj.setId(photo_id);
        });
        
        $(window).bind( "hashchange", function(e) {
            var photo_id = $.bbq.getState("view-photo");
            if ( photo_id != undefined )
            {
                if ( window.photoFBLoading ) { return; }
                window.photoViewObj.showPhotoCmp(photo_id);
            }
        });';
        OW::getDocument()->addOnloadScript($script);
    }
Esempio n. 27
0
 public function getUserPhotoCount($userId)
 {
     if (!$this->isActive()) {
         return null;
     }
     return PHOTO_BOL_PhotoService::getInstance()->countUserPhotos($userId);
 }
Esempio n. 28
0
 /**
  * Class constructor
  *
  * @param string $listType
  * @param int $count
  * @param string $tag
  */
 public function __construct(array $params)
 {
     parent::__construct();
     $photoId = $params['photoId'];
     $config = OW::getConfig();
     $lang = OW::getLanguage();
     $this->photoService = PHOTO_BOL_PhotoService::getInstance();
     $this->photoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $photo = $this->photoService->findPhotoById($photoId);
     $album = $this->photoAlbumService->findAlbumById($photo->albumId);
     $this->assign('album', $album);
     // is owner
     $contentOwner = $this->photoService->findPhotoOwner($photo->id);
     $userId = OW::getUser()->getId();
     $ownerMode = $contentOwner == $userId;
     $this->assign('ownerMode', $ownerMode);
     // is moderator
     $modPermissions = OW::getUser()->isAuthorized('photo');
     $this->assign('moderatorMode', $modPermissions);
     $canView = true;
     if (!$ownerMode && !$modPermissions && !OW::getUser()->isAuthorized('photo', 'view')) {
         $canView = false;
     }
     $this->assign('canView', $canView);
     $cmtParams = new BASE_CommentsParams('photo', 'photo_comments');
     $cmtParams->setEntityId($photo->id);
     $cmtParams->setOwnerId($contentOwner);
     $cmtParams->setDisplayType(BASE_CommentsParams::DISPLAY_TYPE_BOTTOM_FORM_WITH_FULL_LIST);
     $photoCmts = new BASE_CMP_Comments($cmtParams);
     $this->addComponent('comments', $photoCmts);
     $photoRates = new BASE_CMP_Rate('photo', 'photo_rates', $photo->id, $contentOwner);
     $this->addComponent('rate', $photoRates);
     $photoTags = new BASE_CMP_EntityTagCloud('photo');
     $photoTags->setEntityId($photo->id);
     $photoTags->setRouteName('view_tagged_photo_list');
     $this->addComponent('tags', $photoTags);
     $description = $photo->description;
     $photo->description = UTIL_HtmlTag::autoLink($photo->description);
     $this->assign('photo', $photo);
     $this->assign('url', $this->photoService->getPhotoUrl($photo->id, false, $photo->hash));
     $this->assign('ownerName', BOL_UserService::getInstance()->getUserName($album->userId));
     $is_featured = PHOTO_BOL_PhotoFeaturedService::getInstance()->isFeatured($photo->id);
     if ((int) $config->getValue('photo', 'store_fullsize') && $photo->hasFullsize) {
         $this->assign('fullsizeUrl', $this->photoService->getPhotoFullsizeUrl($photo->id, $photo->hash));
     } else {
         $this->assign('fullsizeUrl', null);
     }
     $action = new BASE_ContextAction();
     $action->setKey('photo-moderate');
     $context = new BASE_CMP_ContextAction();
     $context->addAction($action);
     $contextEvent = new BASE_CLASS_EventCollector('photo.collect_photo_context_actions', array('photoId' => $photoId, 'photoDto' => $photo));
     OW::getEventManager()->trigger($contextEvent);
     foreach ($contextEvent->getData() as $contextAction) {
         $action = new BASE_ContextAction();
         $action->setKey(empty($contextAction['key']) ? uniqid() : $contextAction['key']);
         $action->setParentKey('photo-moderate');
         $action->setLabel($contextAction['label']);
         if (!empty($contextAction['id'])) {
             $action->setId($contextAction['id']);
         }
         if (!empty($contextAction['order'])) {
             $action->setOrder($contextAction['order']);
         }
         if (!empty($contextAction['class'])) {
             $action->setClass($contextAction['class']);
         }
         if (!empty($contextAction['url'])) {
             $action->setUrl($contextAction['url']);
         }
         $attributes = empty($contextAction['attributes']) ? array() : $contextAction['attributes'];
         foreach ($attributes as $key => $value) {
             $action->addAttribute($key, $value);
         }
         $context->addAction($action);
     }
     if ($userId && !$ownerMode) {
         $action = new BASE_ContextAction();
         $action->setKey('flag');
         $action->setParentKey('photo-moderate');
         $action->setLabel($lang->text('base', 'flag'));
         $action->setId('btn-photo-flag');
         $action->addAttribute('rel', $photoId);
         $action->addAttribute('url', OW::getRouter()->urlForRoute('view_photo', array('id' => $photo->id)));
         $context->addAction($action);
     }
     if ($ownerMode || $modPermissions) {
         $action = new BASE_ContextAction();
         $action->setKey('edit');
         $action->setParentKey('photo-moderate');
         $action->setLabel($lang->text('base', 'edit'));
         $action->setId('btn-photo-edit');
         $action->addAttribute('rel', $photoId);
         $context->addAction($action);
         $action = new BASE_ContextAction();
         $action->setKey('delete');
         $action->setParentKey('photo-moderate');
         $action->setLabel($lang->text('base', 'delete'));
         $action->setId('photo-delete');
         $action->addAttribute('rel', $photoId);
         $context->addAction($action);
     }
     if ($modPermissions) {
         if ($is_featured) {
             $action = new BASE_ContextAction();
             $action->setKey('unmark-featured');
             $action->setParentKey('photo-moderate');
             $action->setLabel($lang->text('photo', 'remove_from_featured'));
             $action->setId('photo-mark-featured');
             $action->addAttribute('rel', 'remove_from_featured');
             $action->addAttribute('photo-id', $photoId);
             $context->addAction($action);
         } else {
             $action = new BASE_ContextAction();
             $action->setKey('mark-featured');
             $action->setParentKey('photo-moderate');
             $action->setLabel($lang->text('photo', 'mark_featured'));
             $action->setId('photo-mark-featured');
             $action->addAttribute('rel', 'mark_featured');
             $action->addAttribute('photo-id', $photoId);
             $context->addAction($action);
         }
     }
     $this->addComponent('contextAction', $context);
     $nextPhoto = $this->photoService->getNextPhoto($photo->albumId, $photo->id);
     $this->assign('nextPhoto', $nextPhoto);
     $previousPhoto = $this->photoService->getPreviousPhoto($photo->albumId, $photo->id);
     $this->assign('previousPhoto', $previousPhoto);
     $photoCount = $this->photoAlbumService->countAlbumPhotos($photo->albumId);
     $this->assign('photoCount', $photoCount);
     $photoIndex = $this->photoService->getPhotoIndex($photo->albumId, $photo->id);
     $this->assign('photoIndex', $photoIndex);
     $avatar = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($contentOwner), true, true, true, false);
     $this->assign('avatar', $avatar[$contentOwner]);
 }
Esempio n. 29
0
 public function findPhotoIdListByUserIdList(array $idList)
 {
     if (empty($idList)) {
         return array();
     }
     $condition = PHOTO_BOL_PhotoService::getInstance()->getQueryCondition('searchByUsername', array('photo' => 'p', 'album' => 'a'));
     $sql = ' SELECT `p`.`id`
         FROM `' . $this->getTableName() . '` AS `p`
             INNER JOIN ' . PHOTO_BOL_PhotoAlbumDao::getInstance()->getTableName() . ' AS `a` ON(`p`.`albumId` = `a`.`id`)
         ' . $condition['join'] . '
         WHERE `a`.`userId` IN(' . $this->dbo->mergeInClause($idList) . ') AND ' . $condition['where'];
     return $this->dbo->queryForColumnList($sql, $condition['params']);
 }
Esempio n. 30
0
 public function updatePhotoStatus($photoId, $status)
 {
     if (!$this->isActive()) {
         return null;
     }
     $photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId);
     $photo->status = $status;
     PHOTO_BOL_PhotoDao::getInstance()->save($photo);
 }