10 define(
'PROFILE_PHOTO_CATEGORY',
'Profile photos');
18 $this->aSectionsAdmin[
'pending'] = array(
19 'exclude_btns' => array(
'featured',
'unfeatured')
21 $this->iHeaderCacheTime = (int)$this->_oConfig->getGlParam(
'header_cache');
26 $iPicId = (int)$iPicId;
30 $aInfo = $oMedia->serviceGetPhotoArray($iPicId,
'file');
34 $oMedia->getRatePart();
35 $aInfo[
'rate'] = $oMedia->oRate->getJustVotingElement(0, 0,
$aInfo[
'rate']);
36 $aLinkAddon = $oMedia->getLinkAddByPrams();
38 'count' => (
int)
$_GET[
'total'],
40 'page' => (
int)
$_GET[
'page'],
41 'on_change_page' =>
'getCurrentImage({page})',
43 $aInfo[
'paginate'] = $oPaginate->getPaginate();
44 header(
'Content-Type:text/javascript; charset=utf-8');
53 $iPointPos = strrpos($sParamValue1,
'.');
55 $iId = (int)$this->_oDb->getIdByHash(substr($sParamValue1, 0, $iPointPos));
57 header(
"Location: " . $this->_oTemplate->getIconUrl(
'no_image.png'));
61 $aInfo = $this->_oDb->getFileInfo(array(
'fileId' =>
$iId));
63 header(
"Location: " . $this->_oTemplate->getIconUrl(
'no_image.png'));
68 header(
"Location: " . $this->_oTemplate->getIconUrl(
'private.png'));
72 $sExt = substr($sParamValue1, $iPointPos + 1);
75 $sCntType =
'image/x-png';
78 $sCntType =
'image/gif';
81 $sCntType =
'image/jpeg';
83 $sPath = $this->_oConfig->getFilesPath() .
$iId . str_replace(
'{ext}',
$sExt, $this->_oConfig->aFilePostfix[
$sParamValue]);
85 if ($this->iHeaderCacheTime > 0) {
86 $iLastModTime = filemtime($sPath);
87 $sAdd =
", max-age={$this->iHeaderCacheTime}, Last-Modified: " . gmdate(
"D, d M Y H:i:s", $iLastModTime) .
" GMT";
89 header(
"Cache-Control: must-revalidate, post-check=0, pre-check=0" . $sAdd);
90 header(
"Content-Type:" . $sCntType);
91 header(
"Content-Length: " . filesize($sPath));
97 header(
'Content-Type:text/html; charset=utf-8');
99 $aInfo = $this->_oDb->getFileInfo(array(
'fileId' => $iPhotoID));
102 die(json_encode(array(
104 'message' =>
_t(
'_sys_media_not_found'),
108 die(json_encode(array(
110 'message' =>
_t(
'_Access denied'),
114 $sSrcFileName = $this->_oConfig->getFilesPath() .
$aInfo[
'medID'] . str_replace(
'{ext}',
$aInfo[
'medExt'], $this->_oConfig->aFilesConfig[
'original'][
'postfix']);
115 $sTmpFileName = CH_DIRECTORY_PATH_ROOT .
'tmp/' . $this->_oConfig->getMainPrefix() . mt_rand() .
'.' .
$aInfo[
'medExt'];
116 $bCropResult =
$o->crop(
117 (
float)$_POST[
'imgW'], (
float)$_POST[
'imgH'],
118 (
float)$_POST[
'imgX1'], (
float)$_POST[
'imgY1'],
119 (
float)$_POST[
'cropW'], (
float)$_POST[
'cropH'],
120 -(
float)$_POST[
'rotation'],
121 $sSrcFileName, $sTmpFileName);
124 die(json_encode(array(
126 'message' =>
$o->getError(),
129 $_POST[
'extra_param_album'] =
$aInfo[
'albumUri'];
132 $sClassName = $this->_oConfig->getClassPrefix() .
'Uploader';
133 $oUploader =
new $sClassName();
134 $a = $oUploader->performUpload ($sTmpFileName, pathinfo($sSrcFileName, PATHINFO_BASENAME),
$aInfo,
false);
135 @unlink($sTmpFileName);
137 if (!
empty($a[
'error']))
138 die(json_encode(array(
140 'message' => $a[
'error'],
144 $aInfoNew = $this->_oDb->getFileInfo(array(
'fileId' => $a[
'id']));
148 $sImgUrl = $oSearch->getImgUrl($aInfoNew[
'Hash'],
'file');
150 echo(json_encode(array(
151 'status' =>
'success',
153 'redirect_url' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'view/' . $aInfoNew[
'medUri'],
159 $aInfo = $this->_oDb->getFileInfo(array(
'fileId' => $iPhotoID));
162 $this->_oTemplate->displayPageNotFound();
167 $this->_oTemplate->displayAccessDenied();
172 $sClassName = $this->_oConfig->getClassPrefix() .
'PageView';
173 $oPage =
new $sClassName($this,
$aInfo, $this->_oConfig->getMainPrefix() .
'_crop');
176 $this->aPageTmpl[
'header'] =
$aInfo[
'medTitle'];
177 $GLOBALS[
'oTopMenu']->setCustomSubHeader(
_t(
'_sys_album_x_photo_x',
$aInfo[
'albumCaption'],
$aInfo[
'medTitle']));
178 $GLOBALS[
'oTopMenu']->setCustomBreadcrumbs(array(
179 _t(
'_' . $this->_oConfig->getMainPrefix()) => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'home/',
180 $aInfo[
'albumCaption'] => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'browse/album/' .
$aInfo[
'albumUri'] .
'/owner/' .
$aInfo[
'NickName'],
184 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sCode));
190 $aInfo = $this->_oDb->getFileInfo(array(
'fileId' => $iPhotoID));
191 $sRedirect = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'view/' .
$aInfo[
'medUri'];
193 $sLangKey =
'_Success';
196 $sLangKey =
'_Error occured';
198 header(
'Content-Type: text/html; charset=UTF-8');
208 if (!($aFileInfo = $this->_oDb->getFileInfo(array(
'fileId' => $iPhotoID))))
211 if ($aFileInfo[
'medProfId'] != $iAuthorId)
216 if ($sProfileAlbumUri != $aFileInfo[
'albumUri'])
219 return $this->_oDb->setAvatar($iPhotoID, $aFileInfo[
'albumId']);
229 if ($this->_iProfileId == 0)
233 $oMedia->clearFilters(array(
'activeStatus',
'allow_view',
'album_status',
'albumType',
'ownerStatus'), array(
'albumsObjects',
'albums'));
234 if (isset($oMedia->aAddPartsConfig[
'favorite']) && !
empty($oMedia->aAddPartsConfig[
'favorite'])) {
235 $oMedia->aCurrent[
'join'][
'favorite'] = $oMedia->aAddPartsConfig[
'favorite'];
236 $oMedia->aCurrent[
'restriction'][
'fav'] = array(
238 'field' => $oMedia->aAddPartsConfig[
'favorite'][
'userField'],
240 'table' => $oMedia->aAddPartsConfig[
'favorite'][
'table']
243 $oMedia->aCurrent[
'paginate'][
'perPage'] = (int)$this->oConfig->getGlParam(
'number_top');
244 $sCode = $oMedia->displayResultBlock();
245 if ($oMedia->aCurrent[
'paginate'][
'totalNum'] > 0) {
246 $oMedia->aConstants[
'linksTempl'][
'favorited'] =
'browse/favorited';
249 $aBottomMenu = $oMedia->getBottomMenu(
'favorited', 0,
'');
250 return array(
$sCode, $aTopMenu, $aBottomMenu,
false);
256 return parent::serviceGetMemberMenuItem ($sIcon);
261 return parent::serviceGetMemberMenuItemAddContent ($sIcon);
276 $aDefaultAlbums = $this->_oConfig->getDefaultAlbums();
277 if(!
empty($sSelectedAlbum) && in_array($sSelectedAlbum, $aDefaultAlbums))
280 return CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'upload/' . $sSelectedAlbum;
287 $aDefaultAlbums = $this->_oConfig->getDefaultAlbums();
288 if(!
empty($sSelectedAlbum) && in_array($sSelectedAlbum, $aDefaultAlbums))
291 return CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'albums/my/add_objects/' . $sSelectedAlbum .
'/owner/' .
getUsername(
$iProfileId);
298 $aDefaultAlbums = $this->_oConfig->getDefaultAlbums();
299 if(!
empty($sSelectedAlbum) && in_array($sSelectedAlbum, $aDefaultAlbums))
302 return CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'albums/my/manage_profile_photos/' . $sSelectedAlbum .
'/owner/' .
getUsername(
$iProfileId);
316 $aInfo = $this->_oDb->getFileInfo(array(
'fileUri' => $sUri));
318 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
MsgBox(
_t(
'_sys_txt_error_you_are_blocked'))));
322 parent::actionView($sUri);
326 if (
$sParamName ==
'album' && $sParamValue1 ==
'owner') {
327 $iOwnerId =
getID($sParamValue2);
329 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
MsgBox(
_t(
'_sys_txt_error_you_are_blocked'))));
339 $iOwnerId =
getID($sParamValue1);
341 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
MsgBox(
_t(
'_sys_txt_error_you_are_blocked'))));