31 $this->_iProfileId = $this->_oDb->iViewer;
32 $this->aPageTmpl = array(
34 'header' =>
$GLOBALS[
'site'][
'title'],
37 $sClassName = $this->_oConfig->getClassPrefix() .
'Privacy';
39 $this->oPrivacy =
new $sClassName();
40 $this->oAlbumPrivacy =
new $sClassName(
'sys_albums');
41 $this->oAlbums =
new ChWsbAlbums($this->_oConfig->getMainPrefix(), $this->_iProfileId);
43 $this->aSectionsAdmin = array(
45 'exclude_btns' => array(
'activate')
47 'disapproved' => array(
48 'exclude_btns' => array(
'deactivate',
'featured',
'unfeatured')
51 'exclude_btns' => array(
'activate',
'deactivate',
'featured',
'unfeatured')
59 if ($this->_iProfileId > 0) {
68 $aNewActions = array();
69 foreach ($this->_aMemActions
as $sValue) {
70 $aNewActions[] = $this->_oConfig->getUri() .
' ' . $sValue;
84 $sConstName = strtoupper(str_replace(
' ',
'_', $this->_oConfig->getMainPrefix()) .
'_' .
$sAction);
86 return constant($sConstName);
95 if ($this->_oDb->deleteData(
$iFileId)) {
96 $aFilesPostfix = $this->_oConfig->aFilePostfix;
98 $aFilesPostfix[
'temp'] =
'';
99 if (isset($aFilesPostfix[
'original'])) {
102 foreach ($aFilesPostfix
as $sValue) {
103 $sFilePath = $this->_oConfig->getFilesPath() .
$iFileId . $sValue;
107 $oVoting =
new ChWsbVoting($this->_oConfig->getMainPrefix(), 0, 0);
111 $oCmts->onObjectDelete();
116 $oTag->reparseObjTags($this->_oConfig->getMainPrefix(),
$iFileId);
118 $oCateg->reparseObjTags($this->_oConfig->getMainPrefix(),
$iFileId);
120 $bUpdateCounter =
$aInfo[
'Approved'] ==
'approved' ?
true :
false;
121 $this->oAlbums->removeObjectTotal(
$iFileId, $bUpdateCounter);
126 'type' =>
'object_id',
127 'unit' => $this->_oConfig->getMainPrefix(),
145 $iAlbumId = (int)$iAlbumId;
146 $aObjects = $this->oAlbums->getAlbumObjList($iAlbumId);
148 foreach ($aObjects
as $iValue) {
149 $iObj = (int)$iValue;
160 return str_replace($sKey,
$aInfo[
'medExt'], $sTmpl);
165 if (!
isAdmin($this->_iProfileId)) {
170 if (isset(
$_GET[
'action']) &&
$_GET[
'action'] ==
'findMembers') {
176 $this->_oConfig->getMainPrefix() .
'_admin_main' => array(
177 'title' =>
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_admin_main'),
178 'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'administration/home'
180 $this->_oConfig->getMainPrefix() .
'_admin_settings' => array(
181 'title' =>
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_admin_settings'),
182 'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'administration/settings'
188 $aMenu[$this->_oConfig->getMainPrefix() .
'_admin_settings'][
'active'] = 1;
192 $aMenu[$this->_oConfig->getMainPrefix() .
'_admin_main'][
'active'] = 1;
197 $this->aPageTmpl[
'name_index'] = 9;
198 $this->aPageTmpl[
'header'] =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_admin_title');
199 $this->aPageTmpl[
'css_name'] = array(
'forms_adv.css',
'my.css',
'search.css',
'search_admin.css');
200 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sCode), array(), array(),
true);
205 $sClassName = $this->_oConfig->getClassPrefix() .
'PageHome';
207 $oPage =
new $sClassName($this);
209 $this->aPageTmpl[
'css_name'] = array(
'browse.css');
210 $this->aPageTmpl[
'header'] =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_home');
211 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sCode));
218 'type' => $this->_oConfig->getMainPrefix(),
221 CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'categories');
222 $sCode = $oCateg->getCode();
223 $this->aPageTmpl[
'header'] =
_t(
'_' . $aParam[
'type'] .
'_top_menu_categories');
224 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sCode));
231 'type' => $this->_oConfig->getMainPrefix(),
232 'orderby' =>
'popular'
235 _t(
'_' . $this->_oConfig->getMainPrefix() .
'_bcaption_all'),
236 CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'tags');
237 $sCode = $oTags->getCode();
238 $this->aPageTmpl[
'header'] =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_top_menu_tags');
239 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sCode));
247 $aInfo = $this->_oDb->getFileInfo($aIdent);
250 $sKey =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_forbidden');
257 $this->_oTemplate->setPageDescription(substr(strip_tags(
$aInfo[
'medDesc']), 0, 255));
258 $this->_oTemplate->addPageKeywords(
$aInfo[
'medTags']);
262 $sClassName = $this->_oConfig->getClassPrefix() .
'Search';
264 $oSearch =
new $sClassName();
265 $oSearch->aCurrent[
'restriction'][
'albumId'] = array(
266 'value' =>
$aInfo[
'albumId'],
269 'table' =>
'sys_albums'
271 $oSearch->aCurrent[
'restriction'][
'activeStatus'][
'operator'] =
'<>';
274 $aExcludeList = $oSearch->getSearchData();
275 if (!
empty($aExcludeList))
276 foreach ($aExcludeList
as $aValue)
277 $aIds[] = $aValue[
'id'];
279 $aInfo[
'prevItem'] = $this->oAlbums->getClosestObj(
$aInfo[
'albumId'],
$aInfo[
'medID'],
'prev',
280 $aInfo[
'obj_order'], $aIds);
281 $aInfo[
'nextItem'] = $this->oAlbums->getClosestObj(
$aInfo[
'albumId'],
$aInfo[
'medID'],
'next',
282 $aInfo[
'obj_order'], $aIds);
284 $aInfo[
'favorited'] = $this->_oDb->checkFavoritesIn(
$aInfo[
'medID']);
287 $sClassName = $this->_oConfig->getClassPrefix() .
'PageView';
289 $sCode = $this->_oTemplate->getJsInclude() .
$oPage->getCode();
290 $this->aPageTmpl[
'header'] = $sKey =
$aInfo[
'medTitle'];
291 $this->aPageTmpl[
'js_name'] =
'ChWsbFiles.js';
292 $this->aPageTmpl[
'css_name'] =
'explanation.css';
294 if ($this->_iProfileId !=
$aInfo[
'medProfId']) {
299 $this->_oTemplate->displayPageNotFound();
301 $GLOBALS[
'oTopMenu']->setCustomSubHeader(
_t(
'_sys_album_x_photo_x',
$aInfo[
'albumCaption'], $sKey));
302 $GLOBALS[
'oTopMenu']->setCustomSubHeaderUrl(CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'browse/album/' .
$aInfo[
'albumUri'] .
'/owner/' .
$aInfo[
'NickName']);
303 $GLOBALS[
'oTopMenu']->setCustomBreadcrumbs(array(
304 _t(
'_' . $this->_oConfig->getMainPrefix()) => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'home/',
305 $aInfo[
'albumCaption'] => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'browse/album/' .
$aInfo[
'albumUri'] .
'/owner/' .
$aInfo[
'NickName'],
309 $this->_oTemplate->addJsTranslation(array(
'_Are_you_sure'));
310 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sCode));
321 if (
$sParamName ==
'album' && $sParamValue1 ==
'owner') {
323 $aAlbumInfo = $this->oAlbums->getAlbumInfo(array(
325 'owner' =>
getID($sParamValue2)
327 if (
empty($aAlbumInfo)) {
328 $this->_oTemplate->displayPageNotFound();
330 if (!$this->oAlbumPrivacy->check(
'album_view', $aAlbumInfo[
'ID'], $this->_iProfileId)) {
331 $sKey =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_access_denied');
333 $this->aPageTmpl[
'header'] = $sKey;
334 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sCode));
339 $GLOBALS[
'oTopMenu']->setCustomSubHeader(
_t(
'_sys_album_x', $aAlbumInfo[
'Caption']));
340 $GLOBALS[
'oTopMenu']->setCustomSubHeaderUrl(CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'browse/album/' . $aAlbumInfo[
'Uri'] .
'/owner/' . $sParamValue2);
341 $GLOBALS[
'oTopMenu']->setCustomBreadcrumbs(array(
342 _t(
'_' . $this->_oConfig->getMainPrefix()) => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'home/',
343 $aAlbumInfo[
'Caption'] =>
'',
346 if ($aAlbumInfo[
'Owner'] == $this->_iProfileId && $sParamValue2 ===
getUsername($this->_iProfileId)) {
357 $sParamValue1 = (int)$sParamValue1;
358 $sParamValue2 = (int)$sParamValue2;
361 $sClassName = $this->_oConfig->getClassPrefix() .
'Search';
365 if ($sRss !==
false && $sRss) {
366 $oSearch->aCurrent[
'paginate'][
'perPage'] = 10;
367 header(
'Content-Type: text/xml; charset=UTF-8');
368 echo $oSearch->rss();
373 $sCaption =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_top_menu_' . $sTopPostfix);
381 $oSearch->aCurrent[
'restriction'][
'allow_view'][
'value'] = array($aAlbumInfo[
'AllowAlbumView']);
383 $aAlbumInfo[
'Caption']);
384 $this->_oTemplate->setPageDescription(substr(strip_tags($aAlbumInfo[
'Description']), 0, 255));
386 $oSearch->aCurrent[
'restriction'][
'not_allow_view'][
'value'] = array(
CH_WSB_PG_HIDDEN);
389 $oSearch->aCurrent[
'paginate'][
'perPage'] = (int)$this->_oConfig->getGlParam(
'number_all');
390 $sCode = $oSearch->displayResultBlock();
391 if ($oSearch->aCurrent[
'paginate'][
'totalNum'] > 0) {
393 $sCode = $this->_oTemplate->parseHtmlByName(
'default_padding_thd.html', array(
398 foreach ($aAdd
as $sValue) {
399 if (strlen($sValue) > 0) {
400 $sArg .=
'/' . rawurlencode($sValue);
405 $sLink = $this->_oConfig->getBaseUri() .
'browse' . $sArg;
407 'page_url' => $sLink .
'&page={page}&per_page={per_page}',
408 'count' => $oSearch->aCurrent[
'paginate'][
'totalNum'],
409 'per_page' => $oSearch->aCurrent[
'paginate'][
'perPage'],
410 'page' => $oSearch->aCurrent[
'paginate'][
'page'],
411 'on_change_per_page' =>
'document.location=\'' . CH_WSB_URL_ROOT . $sLink .
'&page=1&per_page=\' + this.value;'
413 $sPaginate = $oPaginate->getPaginate();
419 $sCaption =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_caption_browse_by_day')
420 .
': ' .
getLocaleDate(strtotime(
"{$sParamValue}-{$sParamValue1}-{$sParamValue2}")
425 $this->_oTemplate->getExtraTopMenu(
$aMenu, CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri()));
429 $this->aPageTmpl[
'css_name'] = array(
'browse.css');
431 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sCode));
436 $bAjax = isset($_SERVER[
'HTTP_X_REQUESTED_WITH']) && $_SERVER[
'HTTP_X_REQUESTED_WITH'] ==
'XMLHttpRequest' ?
true :
false;
442 $sPrefix = $this->_oConfig->getMainPrefix();
443 if($sPrefix ==
'ch_sounds') {
444 $aManageArray = array(
'medTitle',
'thumbUrl',
'medTags',
'medDesc',
'medProfId',
'Categories',
'medUri');
446 $aManageArray = array(
'medTitle',
'medTags',
'medDesc',
'medProfId',
'Categories',
'medUri');
448 $aInfo = $this->_oDb->getFileInfo(array(
'fileId' =>
$iFileId),
false, $aManageArray);
449 $sLangPref =
'_' . $sPrefix;
454 $oCategories->getTagObjectConfig();
455 $aCategories = $oCategories->getGroupChooser($this->_oConfig->getMainPrefix(), $this->_iProfileId,
459 $sUrlPref = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri();
461 'form_attrs' => array(
462 'id' => $sLangPref .
'_upload_form',
464 'action' => $sUrlPref .
'edit/' .
$iFileId,
465 'onsubmit' =>
"return ch_ajax_form_check(this)",
469 'submit_name' =>
'do_submit',
471 'checker_helper' =>
'ChSupportCheckerHelper',
475 'type' =>
'block_header',
476 'caption' =>
_t(
'_Info'),
480 'name' =>
'medTitle',
481 'caption' =>
_t(
'_Title'),
485 'params' => array(3, 128),
486 'error' =>
_t(
'_td_err_incorrect_length'),
488 'value' =>
$aInfo[
'medTitle'],
492 'name' =>
'thumbUrl',
493 'caption' =>
_t(
'_sound_thumb_url'),
495 'value' =>
$aInfo[
'thumbUrl'],
500 'caption' =>
_t(
'_Tags'),
501 'info' =>
_t(
'_Tags_desc'),
502 'value' =>
$aInfo[
'medTags']
504 'description' => array(
505 'type' =>
'textarea',
507 'caption' =>
_t(
'_Description'),
508 'value' =>
$aInfo[
'medDesc'],
510 'categories' => $aCategories,
516 'medProfId' => array(
518 'name' =>
'medProfId',
519 'value' => $this->_iProfileId,
521 'do_submit' => array(
523 'name' =>
'do_submit',
528 'name' =>
'submit_press',
529 'value' =>
_t(
'_Submit'),
536 if(
getParam($sPrefix .
'_cat_required') ==
'') {
537 $aForm[
'inputs'][
'categories'][
'required'] =
false;
538 unset(
$aForm[
'inputs'][
'categories'][
'checker']);
542 if($sPrefix !=
'ch_sounds') {
543 unset(
$aForm[
'inputs'][
'thumburl']);
547 if (
$oForm->isSubmittedAndValid()) {
548 if($sPrefix ==
'ch_sounds') {
549 $sThumbUrl = $_POST[
'thumbUrl'];
551 $sFile1 =
$GLOBALS[
'dir'][
'root'] .
'flash/modules/mp3/files/' .
$iFileId .
'.jpg';
552 $sFileTmp =
$GLOBALS[
'dir'][
'tmp'] . md5(microtime());
553 file_put_contents($sFileTmp, file_get_contents($sThumbUrl));
554 $img_info = getimagesize($sFileTmp);
555 $width = $img_info[0];
556 $height = $img_info[1];
557 switch ($img_info[2]) {
558 case IMAGETYPE_GIF : $src = imagecreatefromgif($sFileTmp);
break;
559 case IMAGETYPE_JPEG : $src = imagecreatefromjpeg($sFileTmp);
break;
560 case IMAGETYPE_PNG : $src = imagecreatefrompng($sFileTmp);
break;
561 default : die(
"Unknown filetype");
563 $tmp = imagecreatetruecolor($width, $height);
564 imagecopyresampled($tmp, $src, 0, 0, 0, 0, $width, $height, $width, $height);
565 imagejpeg($tmp, $sFile1);
570 array_pop($aManageArray);
571 foreach ($aManageArray
as $sKey) {
572 if ($sKey !=
'Categories')
573 $aValues[$sKey] = $_POST[$sKey];
577 if ($this->_oDb->updateData(
$iFileId, $aValues)) {
578 $sType = $this->_oConfig->getMainPrefix();
590 $sCode =
$GLOBALS[
'oFunctions']->msgBox(
_t($sLangPref .
'_save_success'), 3,
'window.location="' . $sUrlPref .
'view/' .
$aInfo[
'medUri'] .
'";');
597 $sCode = $this->_oTemplate->parseHtmlByName(
'default_padding.html',
598 array(
'content' =>
$oForm->getCode()));
599 $sCode = $this->_oTemplate->parseHtmlByName(
'popup.html',
600 array(
'title' =>
$aInfo[
'medTitle'],
'content' =>
$sCode));
604 header(
'Content-type:text/html;charset=utf-8');
611 $sClassPath = $this->_oConfig->getClassPath() . $this->_oConfig->getClassPrefix() .
'Rate.php';
612 if (file_exists($sClassPath)) {
613 require_once($sClassPath);
614 $sClassName = $this->_oConfig->getClassPrefix() .
'Rate';
615 $oPage =
new $sClassName($this->_oConfig->getMainPrefix());
617 $this->aPageTmpl[
'header'] =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_top_menu_rate');
619 $sKey =
_t(
'_sys_request_page_not_found_cpt');
622 $this->aPageTmpl[
'css_name'] = array(
'search.css',
'browse.css');
623 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sCode));
628 if ($this->_oConfig->getGlParam(
'rss_feed_on') ==
'on') {
632 $aAlbumInfo = $this->oAlbums->getAlbumInfo(array(
634 'owner' =>
getID($sParamValue2)
635 ), array(
'ID',
'Owner'));
636 if (!
empty($aAlbumInfo)) {
637 $aFileCopycat = array(
638 'albumId' => $aAlbumInfo[
'ID'],
639 'medProfId' => $aAlbumInfo[
'Owner'],
640 'Approved' =>
'approved',
643 $sClassName = $this->_oConfig->getClassPrefix() .
'Search';
645 $oSearch =
new $sClassName();
646 $oSearch->aCurrent[
'paginate'][
'perPage'] = 1000;
647 $aUnits = $oSearch->serviceGetFilesInAlbum($aAlbumInfo[
'ID']);
650 $sCode = $this->_oTemplate->getAlbumFeed($aUnits);
653 header(
'Content-Type: text/xml; charset=UTF-8');
660 $sLangPref =
'_' . $this->_oConfig->getMainPrefix() .
'_';
661 $sFileUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'view/' . $sFileUri;
665 if (
$oForm->isSubmittedAndValid()) {
667 $sFileUrl, $_POST[
'mediaAction'])
674 $sCode = $this->_oTemplate->parseHtmlByName(
'default_padding.html', array(
'content' =>
$oForm->getCode()));
675 $sCode = $this->_oTemplate->parseHtmlByName(
'popup.html',
676 array(
'title' =>
_t($sLangPref .
'action_report'),
'content' =>
$sCode));
679 header(
'Content-type:text/html;charset=utf-8');
686 $sLangPref =
'_' . $this->_oConfig->getMainPrefix() .
'_';
687 $sFileUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'view/' . $sFileUri;
691 if (
$oForm->isSubmittedAndValid()) {
693 $_POST[
'mediaAction'])
700 $sCode = $this->_oTemplate->parseHtmlByName(
'default_padding.html', array(
'content' =>
$oForm->getCode()));
701 $sCode = $this->_oTemplate->parseHtmlByName(
'popup.html',
702 array(
'title' =>
_t(
'_Share'),
'content' =>
$sCode));
705 header(
'Content-type:text/html;charset=utf-8');
712 if (!$this->_oDb->checkFavoritesIn(
$iFileId)) {
714 $this->_oDb->addToFavorites(
$iFileId);
716 $sMessPost =
'remove';
717 $this->_oDb->removeFromFavorites(
$iFileId);
720 header(
'Content-Type: text/html; charset=UTF-8');
721 echo
MsgBox(
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_fav_' . $sMessPost)) .
$sJQueryJS;
729 $iFeatureId = (int)$iFeatureId;
730 if ($iFeatureId > 0) {
736 header(
'Content-Type: text/html; charset=UTF-8');
746 $iApprove = (int)$iApprove;
747 $aFile = array(
'medID' =>
$iFileId,
'medProfId' => 0);
758 $sMsg =
'_Access denied';
760 header(
'Content-Type: text/html; charset=UTF-8');
770 $sLangKey =
'_' . $this->_oConfig->getMainPrefix() .
'_delete';
772 $sRedirectMain =
'albums/my/main/';
773 if (!
empty($sAlbumUri)) {
776 $sRedirectMain =
'browse/album/' . $sAlbumUri .
'/owner/' . $sOwnerNick;
778 $sRedirect = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . $sRedirectMain;
781 $sLangKey .=
'_error';
783 header(
'Content-Type: text/html; charset=UTF-8');
809 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sContent));
815 $iIdOwner =
getID($sParamValue1);
817 $this->_oTemplate->displayPageNotFound();
820 $GLOBALS[
'oTopMenu']->setCurrentProfileID($iIdOwner);
821 $this->aPageTmpl[
'header'] =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_browse_by_owner', $sParamValue1);
824 $sClassName = $this->_oConfig->getClassPrefix() .
'PageAlbumsOwner';
825 ch_import(
'PageAlbumsOwner', $this->_aModule);
827 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$oPage->getCode()));
834 header(
'Content-Type: text/html; charset=UTF-8');
837 $_COOKIE[
'memberID'] =
ch_get(
'oid');
838 $_COOKIE[
'memberPassword'] =
ch_get(
'pwd');
849 $sClassName = $this->_oConfig->getClassPrefix() . $sUpl;
850 $oUploader =
new $sClassName();
855 $aAlbumInfo = array();
856 if (!$bNotAllowView && !
empty($sParamValue1)) {
857 $aAlbumInfo = $this->oAlbums->getAlbumInfo(array(
858 'fileUri' => $sParamValue1,
859 'owner' => $this->_iProfileId
861 if (!
empty($aAlbumInfo)) {
865 if ($bNotAllowView) {
866 $sKey =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_access_denied');
868 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sCode),
'',
'',
false);
874 if (is_array($_POST[
'entry'])) {
875 foreach ($_POST[
'entry']
as $iValue) {
876 $iValue = (int)$iValue;
878 case isset($_POST[
'action_delete']):
881 $this->oAlbums->removeAlbum($iValue);
885 case isset($_POST[
'action_move_to']):
886 $this->oAlbums->moveObject((
int)$_POST[
'album_id'], (
int)$_POST[
'new_album'], $iValue);
889 case isset($_POST[
'action_delete_object']):
899 ch_import(
'PageAlbumsOwner', $this->_aModule);
900 $sClassName = $this->_oConfig->getClassPrefix() .
'PageAlbumsOwner';
901 $oPage =
new $sClassName($this, array(
'browse',
'owner',
getUsername($this->_iProfileId)));
910 ch_import(
'PageAlbumsMy', $this->_aModule);
911 $sClassName = $this->_oConfig->getClassPrefix() .
'PageAlbumsMy';
912 $oPage =
new $sClassName($this, $this->_iProfileId,
913 array(
$sParamValue, $sParamValue1, $sParamValue2, $sParamValue3));
915 $sClassPostfix =
$oPage->getViewLevel() == 0 ?
'PageAlbumsOwner' :
'PageAlbumView';
916 ch_import($sClassPostfix, $this->_aModule);
917 $sClassName = $this->_oConfig->getClassPrefix() . $sClassPostfix;
918 $oPageViewOwner =
new $sClassName($this, array());
919 $iPageWidth = $oPageViewOwner->getPageWidth();
920 if ($iPageWidth != 0) {
921 $oPage->forcePageWidth($iPageWidth);
924 $GLOBALS[
'oTopMenu']->setCurrentProfileID($this->_iProfileId);
925 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$oPage->getCode() .
$sCode),
'',
'',
931 $aSort = $_POST[
'unit'];
932 $this->oAlbums->sortObjects($sAlbumUri, $aSort);
937 $this->oAlbums->sortObjects($sAlbumUri);
939 $sClassName = $this->_oConfig->getClassPrefix() .
'Search';
941 $oSearch =
new $sClassName(
'album', $sAlbumUri,
'owner',
943 $oSearch->bAdminMode =
false;
944 $oSearch->aCurrent[
'view'] =
'short';
945 $oSearch->aCurrent[
'restriction'][
'album'][
'value'] = $sAlbumUri;
946 $oSearch->aCurrent[
'restriction'][
'albumType'][
'value'] = $oSearch->aCurrent[
'name'];
947 $oSearch->aCurrent[
'paginate'][
'perPage'] = 1000;
948 $aUnits = $oSearch->getSearchData();
949 if (is_array($aUnits)) {
950 foreach ($aUnits
as $aData) {
951 $sCode .= $oSearch->displaySearchUnit($aData);
954 header(
'Content-Type: text/html; charset=UTF-8');
955 echo
$sCode .
'<div class="clear_both"></div>';
960 $sLangPref =
'_' . $this->_oConfig->getMainPrefix();
961 $aAlbumInfo = $this->oAlbums->getAlbumInfo(array(
'fileUri' => $sAlbumUri));
967 $sMessage =
_t($sLangPref .
'_album_delete_error', $iCount);
969 $sMessage =
_t($sLangPref .
'_album_delete_success');
970 $this->oAlbums->removeAlbum($aAlbumInfo[
'ID']);
971 $sRedirect = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'albums/';
972 if ($this->_iProfileId != $aAlbumInfo[
'Owner']) {
973 $sRedirect .=
'browse/all/';
975 $sRedirect .=
'my/main/';
980 header(
'Content-Type: text/html; charset=UTF-8');
987 $sClassName = $this->_oConfig->getClassPrefix() .
'Calendar';
989 $oCalendar =
new $sClassName($iYear, $iMonth, $this->_oDb, $this->_oTemplate, $this->_oConfig);
990 $sTitle =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_top_menu_calendar');
992 $this->aPageTmpl[
'header'] =
$sTitle;
993 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sCode));
1003 header(
'Content-Type: text/html; charset=UTF-8');
1005 $sLangPref =
'_' . $this->_oConfig->getMainPrefix();
1007 $sKey =
_t($sLangPref .
'_access_denied');
1014 $aAlbumParams = array(
'owner' => $this->_iProfileId,
'show_empty' =>
true,
'hide_default' =>
true);
1015 $iAlbumsCount = $this->oAlbums->getAlbumCount($aAlbumParams);
1018 if ($iAlbumsCount) {
1019 $aAlbumsList = $this->oAlbums->getAlbumList($aAlbumParams, 1, $iAlbumsCount);
1020 foreach ($aAlbumsList
as $aAlbum) {
1021 $aAlbums[$aAlbum[
'ID']] = $aAlbum[
'Caption'];
1024 if (!
empty($sSelected)) {
1025 $aAlbum = $this->oAlbums->getAlbumInfo(array(
'fileuri' => $sSelected), array(
'ID',
'Uri'));
1027 $sSelected = !
empty($aAlbum) && is_array($aAlbum) ? (int)$aAlbum[
'ID'] :
'';
1030 $aDefaultAlbums = $this->_oConfig->getDefaultAlbums(
true,
1031 array(
'{nickname}' =>
getUsername($this->_iProfileId)));
1032 foreach ($aDefaultAlbums
as $sDefaultAlbum) {
1033 $aAlbums[$sDefaultAlbum] = $sDefaultAlbum;
1037 $aPrivFieldView = $this->oAlbumPrivacy->getGroupChooser($this->_iProfileId, $this->_oConfig->getUri(),
1038 'album_view', array(),
_t($sLangPref .
'_album_view'));
1040 if (!
empty($sSelected)) {
1041 $aForm[
'inputs'][
'albums'][
'value'] = $sSelected;
1043 $aForm[
'inputs'][
'title'][
'tr_attrs'][
'style'] =
'display:none';
1044 $aForm[
'inputs'][
'allow_view'][
'tr_attrs'][
'style'] =
'display:none';
1048 $sCode = $this->_oTemplate->parseHtmlByName(
'popup.html', array(
1049 'title' =>
_t($sLangPref .
'_upload_instance'),
1050 'content' => $this->_oTemplate->parseHtmlByName(
'default_padding.html', array(
1051 'content' => $this->_oTemplate->addJs(array(
'albums.js'),
true) .
$oForm->getCode()
1061 header(
'Content-Type:text/javascript; charset=utf-8');
1063 $mixedAlbum =
ch_get(
'album');
1064 if (is_numeric($mixedAlbum)) {
1065 $iAlbumId = (int)$mixedAlbum;
1066 if ($iAlbumId == 0) {
1069 echo json_encode(array(
'status' =>
'Fail',
'error_msg' =>
_t(
'_title_min_lenght', 1)));
1075 'AllowAlbumView' => (
int)
ch_get(
'AllowAlbumView'),
1076 'owner' => $this->_iProfileId,
1078 $iAlbumId = $this->oAlbums->addAlbum($aNew);
1081 $aAlbumInfo = $this->oAlbums->getAlbumInfo(array(
'fileid' => $iAlbumId), array(
'Uri',
'Owner'));
1082 if (!
empty($aAlbumInfo) && $aAlbumInfo[
'Owner'] == $this->_iProfileId) {
1083 $mixedAlbum = $aAlbumInfo[
'Uri'];
1090 echo json_encode(array(
'status' =>
'OK',
'album_uri' => $mixedAlbum,
'owner_name' => $sOwnerNick));
1094 function isAllowedAdd($isPerformAction =
false, $isNotDefineActions =
false, $isCheckMemberStatus =
true)
1096 if ($this->
isAdmin($this->_iProfileId)) {
1099 if (!
isMember($this->_iProfileId)) {
1102 if (!$isDefineActions) {
1106 $isCheckMemberStatus);
1113 if (in_array($aFile[
'Approved'], array(
'pending',
'processing',
'failed'))) {
1115 } elseif ($this->
isAdmin($this->_iProfileId)) {
1117 } elseif ($aFile[
'medProfId'] == $this->_iProfileId) {
1129 if ($this->
isAdmin($this->_iProfileId)) {
1132 if ($aFile[
'medProfId'] == $this->_iProfileId) {
1135 if (!
isMember($this->_iProfileId)) {
1147 if ($this->
isAdmin($this->_iProfileId) || $aFile[
'medProfId'] == $this->_iProfileId) {
1161 $iAlbumId = (int)$iAlbumId;
1162 if ($this->
isAdmin($this->_iProfileId)) {
1165 $aAlbumInfo = is_null($aAlbumInfo) ? $this->oAlbums->getAlbumInfo(array(
'fileid' => $iAlbumId)) : $aAlbumInfo;
1166 if ($aAlbumInfo[
'Owner'] == $this->_iProfileId) {
1175 $bAdmin = $this->
isAdmin($this->_iProfileId);
1176 if ($bAdmin || $aFile[
'medProfId'] == $this->_iProfileId) {
1179 if (!$bAdmin && $aFile[
'Approved'] !=
'approved') {
1183 if ($aOwnerInfo[
'Status'] ==
'Rejected' || $aOwnerInfo[
'Status'] ==
'Suspended') {
1186 if (!$this->oAlbumPrivacy->check(
'album_view', $aFile[
'albumId'], $this->_iProfileId)) {
1210 $aInfo = $this->_oDb->getFileInfo(array(
'fileId' =>
$iFileId),
true, array(
'Approved'));
1211 if (
$aInfo[
'Approved'] !=
'approved') {
1212 $this->_oDb->approveFile(
$iFileId);
1213 $this->oAlbums->updateObjCounterById(
$iFileId);
1217 $oTag->reparseObjTags($this->_oConfig->getMainPrefix(),
$iFileId);
1219 $oCateg->reparseObjTags($this->_oConfig->getMainPrefix(),
$iFileId);
1226 $aInfo = $this->_oDb->getFileInfo(array(
'fileId' =>
$iFileId),
true, array(
'Approved'));
1227 $this->_oDb->disapproveFile(
$iFileId);
1228 if (
$aInfo[
'Approved'] ==
'approved') {
1229 $this->oAlbums->updateObjCounterById(
$iFileId,
false);
1233 $oTag->reparseObjTags($this->_oConfig->getMainPrefix(),
$iFileId);
1235 $oCateg->reparseObjTags($this->_oConfig->getMainPrefix(),
$iFileId);
1241 $this->_oDb->makeFeatured(
$iFileId);
1246 $this->_oDb->makeUnFeatured(
$iFileId);
1251 $aActionList = $this->_oConfig->getActionArray();
1252 if (!is_array($_POST[
'entry'])) {
1255 foreach ($aActionList
as $sKey => $aValue) {
1256 if (isset($_POST[$sKey]) && method_exists($this, $aValue[
'method'])) {
1257 foreach ($_POST[
'entry']
as $iValue) {
1258 $sComm =
'$this->' . $aValue[
'method'] .
'(' . (int)$iValue .
');';
1268 $sUri = $this->_oConfig->getUri();
1271 foreach ($aAlbums
as $sAlbum) {
1272 $aAlbumInfo = $this->oAlbums->getAlbumInfo(array(
'fileUri' =>
uriFilter($sAlbum),
'owner' =>
$iProfileId));
1273 if (!
empty($aAlbumInfo) && is_array($aAlbumInfo)) {
1277 $this->oAlbums->addAlbum(array(
1278 'caption' => $sAlbum,
1280 'AllowAlbumView' => ($sAlbum ==
getParam(
'sys_album_default_name')) ?
CH_WSB_PG_HIDDEN : $this->oAlbumPrivacy->_oDb->getDefaultValueModule($sUri,
1289 if (isset(
$_GET[
'q'])) {
1290 $aMemList = $this->_oDb->getMemberList(
$_GET[
'q']);
1291 if (count($aMemList) > 0) {
1292 foreach ($aMemList
as $aData) {
1293 $sCode .= $aData[
'NickName'] .
" \n";
1303 $GLOBALS[
'oAdmTemplate']->addLocation($this->_oConfig->getUri(), $this->_oConfig->getHomePath(),
1304 $this->_oConfig->getHomeUrl());
1305 $sModPref = $this->_oConfig->getMainPrefix();
1307 $sClassName = $this->_oConfig->getClassPrefix() .
'Search';
1309 $oSearch =
new $sClassName();
1310 $oSearch->clearFilters(array(), array(
'albumsObjects',
'albums'));
1311 $oSearch->bAdminMode =
true;
1313 $oSearch->aCurrent[
'paginate'][
'perPage'] = (int)
getParam($sModPref .
'_all_count');
1316 $bAjaxMode = (isset($_SERVER[
'HTTP_X_REQUESTED_WITH']) && $_SERVER[
'HTTP_X_REQUESTED_WITH'] ==
'XMLHttpRequest') ?
true :
false;
1319 if (mb_strlen($sParam) == 0 || !isset($aSections[$sParam])) {
1320 $sParam =
'approved';
1323 $oSearch->aCurrent[
'restriction'][
'activeStatus'][
'value'] = $sParam;
1324 $oSearch->aCurrent[
'restriction'][
'not_allow_view'][
'value'] =
CH_WSB_PG_HIDDEN;
1325 $oSearch->aCurrent[
'restriction'][
'albumType'][
'value'] = $sModPref;
1326 $aSections[$sParam][
'active'] = 1;
1329 $aBtnsArray = $this->_oConfig->getActionArray();
1331 if ($aSections[$sParam][
'exclude_btns'] ==
'all') {
1332 $aBtnsArray = array();
1333 } elseif (is_array($aSections[$sParam][
'exclude_btns'])) {
1334 foreach ($aSections[$sParam][
'exclude_btns']
as $sValue) {
1335 unset($aBtnsArray[
'action_' . $sValue]);
1339 foreach ($aSections
as $sKey => $aValue) {
1340 $aSections[$sKey][
'href'] = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'administration/home/' . $sKey;
1341 $aSections[$sKey][
'title'] =
_t(
'_' . $sModPref .
'_' . $sKey);
1343 if (!
empty($aBtnsArray)) {
1345 foreach ($aBtnsArray
as $sKey => $aValue) {
1346 $aBtns[$sKey] =
_t($aValue[
'caption']);
1348 $sManage = $oSearch->showAdminActionsPanel($oSearch->aCurrent[
'name'] .
'_admin_form', $aBtns);
1351 $oSearch->bAdminMode =
false;
1356 $sPostOwner =
ch_get(
'owner');
1359 if (strlen($sOwner) > 0) {
1360 $oSearch->aCurrent[
'restriction'][
'owner'][
'value'] =
getID($sOwner);
1362 $sCode = $oSearch->displayResultBlock();
1364 header(
'Content-Type: text/html; charset=UTF-8');
1365 echo $this->_oTemplate->getFilesBox($aCode);
1368 $aInputs[
'status'] = array(
'type' =>
'hidden');
1370 'head' => $this->_oTemplate->getHeaderCode(),
1371 'module_prefix' => $sModPref,
1373 $this->_oTemplate->getSearchForm($aInputs),
$aMenu,
'', 11),
1376 $sCode = $oSearch->displayResultBlock();
1378 $sCode = $this->_oTemplate->getFilesBox($aCode,
'page_block_' . $oSearch->id);
1381 return $this->_oTemplate->parseHtmlByName(
'media_admin.html', $aUnits);
1386 $iId = $this->_oDb->getSettingsCategory();
1388 return MsgBox(
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_msg_page_not_found'));
1393 if (isset($_POST[
'save']) && isset($_POST[
'cat'])) {
1395 $mixedResult =
$oSettings->saveChanges($_POST);
1401 if ($mixedResult !==
true && !
empty($mixedResult)) {
1405 return DesignBoxAdmin(
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_admin'),
1406 $GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'design_box_content.html', array(
'content' =>
$sResult)),
$aMenu);
1411 $sClassName = $this->_oConfig->getClassPrefix() .
'PageAlbumView';
1412 ch_import(
'PageAlbumView', $this->_aModule);
1413 $oAlbumPage =
new $sClassName($this,
$aInfo, $sBrowseCode);
1414 $sCode = $oAlbumPage->getCode();
1425 $sClassName = $this->_oConfig->getClassPrefix() .
'Search';
1427 $oSearch =
new $sClassName(
$sParamValue, $sParamValue1, $sParamValue2, $sParamValue3);
1432 $oSearch->aCurrent[
'paginate'][
'perPage'] = isset(
$_GET[
'per_page']) ? (int)
$_GET[
'per_page'] : (
int)$this->_oConfig->getGlParam(
'number_albums_browse');
1433 $oSearch->aCurrent[
'paginate'][
'page'] = isset(
$_GET[
'page']) ? (int)
$_GET[
'page'] : $oSearch->aCurrent[
'paginate'][
'page'];
1434 $sCode = $oSearch->getAlbumList($oSearch->aCurrent[
'paginate'][
'page'],
1435 $oSearch->aCurrent[
'paginate'][
'perPage'], array(
'hide_default' =>
true));
1436 if ($oSearch->aCurrent[
'paginate'][
'totalAlbumNum'] > 0) {
1438 foreach ($aAdd
as $sValue) {
1439 if (strlen($sValue) > 0) {
1440 $sArg .=
'/' . rawurlencode($sValue);
1445 $sLink = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'albums' . $sArg;
1447 'page_url' => $sLink .
'&page={page}&per_page={per_page}',
1448 'count' => $oSearch->aCurrent[
'paginate'][
'totalAlbumNum'],
1449 'per_page' => $oSearch->aCurrent[
'paginate'][
'perPage'],
1450 'page' => $oSearch->aCurrent[
'paginate'][
'page'],
1451 'on_change_per_page' =>
'document.location=\'' . $sLink .
'&page=1&per_page=\' + this.value;'
1453 $sPaginate = $oPaginate->getPaginate();
1463 $sAction = $this->_oConfig->getMainPrefix() .
'_album';
1464 $aReplacement = array(
1465 'ID' => $aAlbumInfo[
'ID'],
1466 'albumUri' => $aAlbumInfo[
'Uri'],
1467 'moduleUrl' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri(),
1475 $aPredef = array(
'tag',
'category');
1483 $sNewName = $iAttempt > 1 ?
_t(
'_sys_album_caption_new', $sTemp, $iAttempt) : $sTemp;
1484 if (in_array($sNewName, $aAlbums)) {
1495 $sAlbumsCaption =
false,
1496 $sAlbumTitleCaption =
false,
1497 $sCreateNewAlbumCaption =
false
1500 $aAlbums[
'select'] =
_t(
'_sys_album_select');
1501 $aAlbums[] = $sCreateNewAlbumCaption ? $sCreateNewAlbumCaption :
_t(
'_sys_album_create_new');
1505 'form_attrs' => array(
1506 'id' =>
'_' . $this->_oConfig->getMainPrefix() .
'_album_form',
1508 'onSubmit' =>
'return submit_quick_upload_form("' . CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'", $(this).serialize());'
1512 'submit_name' =>
'submit',
1514 'checker_helper' =>
'ChSupportCheckerHelper',
1519 'caption' => $sAlbumsCaption ? $sAlbumsCaption :
_t(
'_sys_album'),
1521 'values' => $aAlbums,
1523 'onchange' =>
'check_album_name_for_fields(this)',
1524 'id' =>
'albumList',
1530 'caption' => $sAlbumTitleCaption ? $sAlbumTitleCaption :
_t(
'_sys_album_caption_capt'),
1534 'allow_view' => $aPrivFieldView,
1538 'value' =>
_t(
'_Continue'),
1552 $iCount = $oSearch->aCurrent[
'paginate'][
'totalNum'];
1554 $aCode[
'code'] =
$GLOBALS[
'oFunctions']->centerContent(
$sCode,
'.sys_file_search_unit');
1555 $sLink = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'administration/home/' . $oSearch->aCurrent[
'restriction'][
'activeStatus'][
'value'];
1556 $sKeyWord =
ch_get(
'keyword');
1557 if ($sKeyWord !==
false) {
1558 $sLink .=
'&keyword=' .
clear_xss($sKeyWord);
1560 $aExclude = array(
'r');
1561 $aLinkAddon = $oSearch->getLinkAddByPrams($aExclude);
1563 'page_url' => $sLink,
1565 'per_page' => $oSearch->aCurrent[
'paginate'][
'perPage'],
1566 'page' => $oSearch->aCurrent[
'paginate'][
'page'],
1567 'on_change_page' =>
'return !loadDynamicBlock(' . $oSearch->id .
', \'' . $sLink . $aLinkAddon[
'params'] . $aLinkAddon[
'paginate'] .
'\');
',
1568 'on_change_per_page
' => 'return !loadDynamicBlock(
' . $oSearch->id . ', \
'' . $sLink . $aLinkAddon[
'params'] .
'&page=1&per_page=\' + this.value);'
1570 $aCode[
'paginate'] = $oPaginate->getPaginate();
1579 $sFileLink = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'view/' . $sFileUri;
1585 'caption' =>
_t(
"_Enter email(s)"),
1588 'func' =>
'emailSet',
1589 'error' =>
_t(
"_Incorrect Email")
1592 $aShareSites = array(
1595 'content' => $this->_oTemplate->getSitesSetBox($sFileLink),
1602 'value' =>
$GLOBALS[
'site'][
'email_notify']
1604 $aShareSites = array(
1611 'form_attrs' => array(
1612 'name' =>
'submitAction',
1613 'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
$sAction .
'/' . $sFileUri,
1615 'onsubmit' =>
"return ch_ajax_form_check(this)",
1619 'submit_name' =>
'do_submit',
1621 'checker_helper' =>
'ChSupportCheckerHelper',
1624 'sites' => $aShareSites,
1625 'email' => $aEmails,
1627 'type' =>
'textarea',
1628 'name' =>
'messageText',
1629 'caption' =>
_t(
'_Message text'),
1634 'params' => array(3, 65536),
1635 'error' =>
_t(
'_td_err_incorrect_length'),
1639 'type' =>
'input_set',
1643 'value' =>
_t(
'_Send')
1648 'value' =>
_t(
'_Reset')
1651 'do_submit' => array(
1653 'name' =>
'do_submit',
1658 'name' =>
'fileUri',
1659 'value' => $sFileLink
1661 'mediaAction' => array(
1663 'name' =>
'mediaAction',
1677 $sCode = $oUploader->serviceCancelFileInfo();
1679 case 'accept_file_info':
1680 $sCode = $oUploader->serviceAcceptFileInfo();
1682 case 'accept_multi_html5':
1683 $sCode = $oUploader->serviceAcceptHtml5FilesInfo();
1697 'MediaType' =>
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_single'),
1698 'MediaUrl' =>
$sUrl,
1704 $sSubject =
't_' . $this->_oConfig->getMainPrefix() .
'_' .
$sType;
1705 $aEmails = explode(
",", $sEmail);
1706 foreach ($aEmails
as $sMail) {
1707 $aTemplate = $rEmailTemplate->getTemplate($sSubject);
1708 $sMail = trim($sMail);
1709 if (
sendMail($sMail, $aTemplate[
'Subject'], $aTemplate[
'Body'],
'', $aPlus)) {
1719 return $this->_oConfig->aFilesConfig;
1731 return $this->_oDb->getFavorites($iMember, $iFrom,
$iPerPage);
1739 'item_img_src' => $sIcon,
1740 'item_img_alt' =>
_t(
'_' . $this->_oConfig->getMainPrefix()),
1741 'item_link' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'albums/my/',
1742 'item_onclick' =>
null,
1743 'item_title' =>
_t(
'_' . $this->_oConfig->getMainPrefix()),
1744 'extra_info' => $this->_oDb->getFilesCountByAuthor($iUser),
1757 'item_img_src' => $sIcon,
1758 'item_img_alt' =>
_t(
'_' . $this->_oConfig->getMainPrefix()),
1759 'item_link' =>
'javascript:void(0);',
1760 'item_onclick' =>
"showPopupAnyHtml('" . CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
"upload');",
1761 'item_title' =>
_t(
'_' . $this->_oConfig->getMainPrefix()),
1769 $sUri = $this->_oConfig->getUri();
1770 $sPrefix = $this->_oConfig->getMainPrefix();
1773 'handlers' => array(
1775 'alert_unit' => $sPrefix,
1776 'alert_action' =>
'add',
1777 'module_uri' => $sUri,
1778 'module_class' =>
'Module',
1779 'module_method' =>
'get_wall_post',
1781 'group_by' =>
'album',
1786 'alert_unit' => $sPrefix,
1787 'alert_action' =>
'comment_add',
1788 'module_uri' => $sUri,
1789 'module_class' =>
'Module',
1790 'module_method' =>
'get_wall_add_comment',
1799 'alert_unit' => $sPrefix,
1800 'alert_action' =>
'commentPost',
1801 'module_uri' => $sUri,
1802 'module_class' =>
'Search',
1803 'module_method' =>
'get_wall_post_comment',
1811 array(
'unit' => $sPrefix,
'action' =>
'add')
1828 $iId = (int)$aEvent[
'object_id'];
1829 $iOwner = (int)$aEvent[
'owner_id'];
1830 $sOwner = $iOwner != 0 ?
getNickName($iOwner) :
_t(
'_Anonymous');
1832 $aContent = unserialize($aEvent[
'content']);
1833 if (
empty($aContent) ||
empty($aContent[
'object_id'])) {
1837 $sClassName = $this->_oConfig->getClassPrefix() .
'Search';
1839 $oSearch =
new $sClassName();
1841 $iItem = (int)$aContent[
'object_id'];
1842 $aItem = $oSearch->serviceGetEntry($iItem,
'browse');
1843 if (
empty($aItem) || !is_array($aItem)) {
1844 return array(
'perform_delete' =>
true);
1847 if (!$this->oAlbumPrivacy->check(
'album_view', (
int)$aItem[
'album_id'], $this->_iProfileId)) {
1852 $oCmts =
new ChTemplCmtsView($this->_oConfig->getMainPrefix(), $iItem);
1853 if (!$oCmts->isEnabled()) {
1857 $aComment = $oCmts->getCommentRow(
$iId);
1858 if (
empty($aComment) || !is_array($aComment)) {
1859 return array(
'perform_delete' =>
true);
1863 $sUri = $this->_oConfig->getUri();
1864 if ($aEvent[
'js_mode']) {
1865 $sCss = $this->_oTemplate->addCss(
'wall_post.css',
true);
1867 $this->_oTemplate->addCss(
'wall_post.css');
1870 $sTextWallObject =
_t(
'_ch_' . $sUri .
'_wall_object');
1872 $sTmplName = isset($aParams[
'templates'][
'main']) ? $aParams[
'templates'][
'main'] :
'modules/cheetah/wall/|timeline_comment.html';
1873 $sTmplNameSnippet = isset($aParams[
'templates'][
'snippet']) ? $aParams[
'templates'][
'snippet'] :
'modules/cheetah/wall/|timeline_comment_files.html';
1876 'title' =>
_t(
'_ch_' . $sUri .
'_wall_added_new_comment_title', $sOwner, $sTextWallObject),
1877 'description' => $aComment[
'cmt_text'],
1878 'content' => $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array(
1879 'mod_prefix' =>
'ch_' . $sUri,
1880 'cpt_user_name' => $sOwner,
1881 'cpt_added_new' =>
_t(
'_ch_' . $sUri .
'_wall_added_new_comment'),
1882 'cpt_object' => $sTextWallObject,
1883 'cpt_item_url' => $aItem[
'url'],
1884 'cnt_comment_text' => $aComment[
'cmt_text'],
1885 'snippet' => $this->_oTemplate->parseHtmlByName($sTmplNameSnippet, array(
1886 'mod_prefix' =>
'ch_' . $sUri,
1887 'cnt_item_page' => $aItem[
'url'],
1888 'cnt_item_width' => $aItem[
'width'],
1889 'cnt_item_height' => $aItem[
'height'],
1890 'cnt_item_icon' => $aItem[
'file'],
1891 'cnt_item_title' => $aItem[
'title'],
1893 'cnt_item_description' => $aItem[
'description'],
1894 'post_id' => $aEvent[
'id'],
1902 $sPrefix = $this->_oConfig->getMainPrefix();
1904 $aObjectIds = strpos($aEvent[
'object_id'],
',') !==
false ? explode(
',',
1905 $aEvent[
'object_id']) : array($aEvent[
'object_id']);
1908 $sClassName = $this->_oConfig->getClassPrefix() .
'Search';
1910 $oSearch =
new $sClassName();
1912 $sItemThumbnailType = isset($aParams[
'thumbnail_type']) ? $aParams[
'thumbnail_type'] :
'browse';
1915 $aItems = $aTmplItems = array();
1916 foreach ($aObjectIds
as $iId) {
1917 $aItem = $oSearch->serviceGetItemArray(
$iId, $sItemThumbnailType);
1918 if (
empty($aItem)) {
1922 if ($aItem[
'status'] ==
'approved' && $this->oAlbumPrivacy->check(
'album_view', $aItem[
'album_id'],
1923 $this->oModule->_iProfileId)
1929 $aItem2x = $oSearch->serviceGetItemArray(
$iId, $sItemThumbnailType .
'2x');
1931 $aTmplItems[] = array_merge($aItem, array(
1932 'mod_prefix' => $sPrefix,
1933 'cnt_item_width' => $aItem[
'width'],
1934 'cnt_item_height' => $aItem[
'height'],
1935 'cnt_item_icon' => $aItem[
'file'],
1936 'cnt_item_icon_2x' => !
empty($aItem2x[
'file']) ? $aItem2x[
'file'] : $aItem[
'file'],
1937 'cnt_item_page' => $aItem[
'url'],
1938 'cnt_item_title' => $aItem[
'title'],
1942 if ($iDeleted == count($aObjectIds)) {
1943 return array(
'perform_delete' =>
true);
1947 if(!
empty($aEvent[
'owner_id']))
1948 $iOwner = (int)$aEvent[
'owner_id'];
1951 if(!
empty($aEvent[
'date']))
1952 $iDate = (
int)$aEvent[
'date'];
1954 $bItems = !
empty($aItems) && is_array($aItems);
1955 if($iOwner == 0 && $bItems && !
empty($aItems[0][
'owner']))
1956 $iOwner = (int)$aItems[0][
'owner'];
1958 if($iOwner == 0 || !$bItems)
1962 if ($aEvent[
'js_mode']) {
1963 $sCss = $this->_oTemplate->addCss(array(
'wall_post.css',
'wall_post_phone.css'),
true);
1965 $this->_oTemplate->addCss(array(
'wall_post.css',
'wall_post_phone.css'));
1968 $iItems = count($aItems);
1974 $aItems = array_slice($aItems, 0, 4);
1975 $aTmplItems = array_slice($aTmplItems, 0, 4);
1978 $aExtra = unserialize($aEvent[
'content']);
1979 $sAlbumUri = $aExtra[
'album'];
1982 $aAlbumInfo = $oAlbum->getAlbumInfo(array(
'fileUri' => $sAlbumUri,
'owner' => $iOwner));
1984 $sTemplateName = isset($aParams[
'templates'][
'grouped']) ? $aParams[
'templates'][
'grouped'] :
'modules/cheetah/wall/|timeline_post_files_grouped.html';
1987 'owner_id' => $iOwner,
1988 'title' =>
_t(
'_' . $sPrefix .
'_wall_added_new_items_title', $sOwner, $iItems),
1989 'description' =>
'',
1991 'group_id' => $aAlbumInfo[
'ID'],
1992 'group_cmts_name' => $sPrefix .
'_albums'
1994 'content' => $sCss . $this->_oTemplate->parseHtmlByName($sTemplateName, array(
1995 'mod_prefix' => $sPrefix,
1996 'mod_icon' => $sIcon,
1997 'cpt_user_name' => $sOwner,
1998 'cpt_added_new' =>
_t(
'_' . $sPrefix .
'_wall_added_new_items', $iItems),
1999 'cpt_album_url' => $oSearch->getCurrentUrl(
'album', $aAlbumInfo[
'ID'], $aAlbumInfo[
'Uri']) .
'/owner/' .
getUsername($iOwner),
2000 'cpt_album_title' => $aAlbumInfo[
'Caption'],
2001 'ch_repeat:items' => $aTmplItems,
2002 'post_id' => $aEvent[
'id']
2008 $aItem = $aItems[0];
2009 $aTmplItem = $aTmplItems[0];
2012 $sItemTxt =
_t(
'_' . $sPrefix .
'_wall_object');
2013 $sTemplateName = isset($aParams[
'templates'][
'single']) ? $aParams[
'templates'][
'single'] :
'modules/cheetah/wall/|timeline_post_files.html';
2016 'owner_id' => $iOwner,
2017 'title' =>
_t(
'_' . $sPrefix .
'_wall_added_new_title', $sOwner, $sItemTxt),
2018 'description' => $aItem[
'description'],
2020 'content' => $sCss . $this->_oTemplate->parseHtmlByName($sTemplateName, array_merge($aTmplItem, array(
2021 'mod_prefix' => $sPrefix,
2022 'mod_icon' => $sIcon,
2023 'cpt_user_name' => $sOwner,
2024 'cpt_added_new' =>
_t(
'_' . $sPrefix .
'_wall_added_new'),
2025 'cpt_item_url' => $aItem[
'url'],
2026 'cpt_item_title' => $aItem[
'title'],
2027 'cpt_item' => $sItemTxt,
2028 'post_id' => $aEvent[
'id']
2036 $sPrefix = $this->_oConfig->getMainPrefix();
2037 $sPrefixAlbum = $sPrefix .
'_albums';
2040 $aObjectIds = strpos($aEvent[
'object_id'],
',') !==
false ? explode(
',',
2041 $aEvent[
'object_id']) : array($aEvent[
'object_id']);
2044 $iItems = count($aObjectIds);
2045 $iItemsLimit = isset($aParams[
'grouped'][
'items_limit']) ? (int)$aParams[
'grouped'][
'items_limit'] : 3;
2046 if ($iItems > $iItemsLimit) {
2047 $aObjectIds = array_slice($aObjectIds, 0, $iItemsLimit);
2051 $aContent = array();
2052 if (!
empty($aEvent[
'content'])) {
2053 $aContent = unserialize($aEvent[
'content']);
2056 if (!isset($aContent[
'idims'])) {
2057 $aContent[
'idims'] = array();
2060 $sClassName = $this->_oConfig->getClassPrefix() .
'Search';
2062 $oSearch =
new $sClassName();
2064 $sItemThumbnailType = isset($aParams[
'thumbnail_type']) ? $aParams[
'thumbnail_type'] :
'browse';
2067 $aItems = $aTmplItems = array();
2068 foreach ($aObjectIds
as $iId) {
2069 $aItem = $oSearch->serviceGetItemArray(
$iId, $sItemThumbnailType);
2070 if (
empty($aItem)) {
2073 if ($aItem[
'status'] ==
'approved' && $this->oAlbumPrivacy->check(
'album_view', $aItem[
'album_id'],
2074 $this->oModule->_iProfileId)
2076 if (!isset($aContent[
'idims'][
$iId])) {
2077 $sPath = isset($aItem[
'file_path']) && file_exists($aItem[
'file_path']) ? $aItem[
'file_path'] : $aItem[
'file'];
2082 $aItem[
'dims'] = $aContent[
'idims'][
$iId];
2085 $aItem2x = $oSearch->serviceGetItemArray(
$iId, $sItemThumbnailType .
'2x');
2087 $aTmplItems[] = array_merge($aItem, array(
2088 'mod_prefix' => $sPrefix,
2089 'item_width' => $aItem[
'dims'][
'w'],
2090 'item_height' => $aItem[
'dims'][
'h'],
2091 'item_icon' => $aItem[
'file'],
2092 'item_icon_2x' => !
empty($aItem2x[
'file']) ? $aItem2x[
'file'] : $aItem[
'file'],
2093 'item_page' => $aItem[
'url'],
2094 'item_title' => $aItem[
'title'],
2100 if ($iDeleted == count($aObjectIds)) {
2101 return array(
'perform_delete' =>
true);
2110 $aResult[
'save'][
'content'] = serialize($aContent);
2114 if ($aEvent[
'js_mode']) {
2115 $sCss = $this->_oTemplate->addCss(
'wall_outline.css',
true);
2117 $this->_oTemplate->addCss(
'wall_outline.css');
2120 $iOwner = (int)$aEvent[
'owner_id'];
2125 $iItems = count($aItems);
2127 $aExtra = unserialize($aEvent[
'content']);
2128 $sAlbumUri = $aExtra[
'album'];
2131 $aAlbumInfo = $oAlbum->getAlbumInfo(array(
'fileUri' => $sAlbumUri,
'owner' => $iOwner));
2134 $aAlbumInfo[
'comments_count'] = (int)$oAlbumCmts->getObjectCommentsCount();
2135 $aAlbumInfo[
'Url'] = $oSearch->getCurrentUrl(
'album', $aAlbumInfo[
'ID'],
2136 $aAlbumInfo[
'Uri']) .
'/owner/' .
getUsername($iOwner);
2138 $sTmplName = isset($aParams[
'templates'][
'grouped']) ? $aParams[
'templates'][
'grouped'] :
'modules/cheetah/wall/|outline_item_image_grouped.html';
2139 $aResult[
'content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array(
2140 'mod_prefix' => $sPrefix,
2141 'mod_icon' => $sIcon,
2142 'user_name' => $sOwner,
2143 'user_link' => $sOwnerLink,
2144 'ch_repeat:items' => $aTmplItems,
2145 'album_url' => $aAlbumInfo[
'Url'],
2146 'album_title' => $aAlbumInfo[
'Caption'],
2147 'album_description' =>
strmaxtextlen($aAlbumInfo[
'Description'], 200),
2148 'album_comments' => (
int)$aAlbumInfo[
'comments_count'] > 0 ?
_t(
'_wall_n_comments',
2149 $aAlbumInfo[
'comments_count']) :
_t(
'_wall_no_comments'),
2150 'album_comments_link' => $aAlbumInfo[
'Url'] .
'#cmta-' . $sPrefixAlbum .
'-' . $aAlbumInfo[
'ID'],
2151 'post_id' => $aEvent[
'id'],
2152 'post_ago' => $aEvent[
'ago']
2159 $aItem = $aItems[0];
2160 $aTmplItem = $aTmplItems[0];
2162 $sTmplName = isset($aParams[
'templates'][
'single']) ? $aParams[
'templates'][
'single'] :
'modules/cheetah/wall/|outline_item_image.html';
2163 $aResult[
'content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array_merge($aTmplItem, array(
2164 'mod_prefix' => $sPrefix,
2165 'mod_icon' => $sIcon,
2166 'user_name' => $sOwner,
2167 'user_link' => $sOwnerLink,
2168 'item_page' => $aItem[
'url'],
2169 'item_title' => $aItem[
'title'],
2170 'item_description' =>
strmaxtextlen($aItem[
'description'], 200),
2171 'item_comments' => (
int)$aItem[
'comments_count'] > 0 ?
_t(
'_wall_n_comments',
2172 $aItem[
'comments_count']) :
_t(
'_wall_no_comments'),
2173 'item_comments_link' => $aItem[
'url'] .
'#cmta-' . $sPrefix .
'-' . $aItem[
'id'],
2174 'post_id' => $aEvent[
'id'],
2175 'post_ago' => $aEvent[
'ago']
2183 $sModuleUri = $this->_oConfig->getUri();
2184 $AlertName = $this->_oConfig->getMainPrefix();
2187 'handlers' => array(
2189 'alert_unit' => $AlertName,
2190 'alert_action' =>
'add',
2191 'module_uri' => $sModuleUri,
2192 'module_class' =>
'Module',
2193 'module_method' =>
'get_spy_post'
2196 'alert_unit' => $AlertName,
2197 'alert_action' =>
'rate',
2198 'module_uri' => $sModuleUri,
2199 'module_class' =>
'Module',
2200 'module_method' =>
'get_spy_post'
2203 'alert_unit' => $AlertName,
2204 'alert_action' =>
'commentPost',
2205 'module_uri' => $sModuleUri,
2206 'module_class' =>
'Module',
2207 'module_method' =>
'get_spy_post'
2211 array(
'unit' => $AlertName,
'action' =>
'add'),
2212 array(
'unit' => $AlertName,
'action' =>
'rate'),
2213 array(
'unit' => $AlertName,
'action' =>
'delete'),
2214 array(
'unit' => $AlertName,
'action' =>
'commentPost'),
2215 array(
'unit' => $AlertName,
'action' =>
'commentRemoved')
2223 $aInfo = $this->_oDb->getFileInfo(array(
'fileId' => $iObjectId),
true,
2224 array(
'medUri',
'medTitle',
'medProfId'));
2229 'entry_url' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'view/' .
$aInfo[
'medUri'],
2230 'entry_caption' =>
$aInfo[
'medTitle'],
2234 'recipient_id' => 0,
2238 $aRet[
'lang_key'] =
'_' . $this->_oConfig->getMainPrefix() .
'_spy_added';
2241 $aRet[
'lang_key'] =
'_' . $this->_oConfig->getMainPrefix() .
'_spy_rated';
2242 $aRet[
'recipient_id'] =
$aInfo[
'medProfId'];
2243 $aRet[
'spy_type'] =
'content_activity';
2245 case 'commentPost' :
2246 $aRet[
'lang_key'] =
'_' . $this->_oConfig->getMainPrefix() .
'_spy_comment_posted';
2247 $aRet[
'recipient_id'] =
$aInfo[
'medProfId'];
2248 $aRet[
'spy_type'] =
'content_activity';
2261 $aDataEntries = $this->_oDb->getFilesByAuthor(
$iProfileId);
2272 $aDataEntries = $this->oAlbums->getAlbumList(array(
2275 'show_empty' =>
true
2277 foreach ($aDataEntries
as $aValue) {
2278 $this->oAlbums->removeAlbum($aValue[
'ID']);
2307 $aFileInfo = $this->_oDb->getFileInfo(array(
'fileId' =>
$iFileId),
true,
2308 array(
'medID',
'medProfId',
'medExt',
'medDate',
'Approved'));
2309 if (
empty($aFileInfo)) {
2312 if (!defined(
'CH_WSB_CRON_EXECUTE')) {
2313 $sMethodName =
'isAllowed' .
$sAction;
2314 if (!method_exists($this, $sMethodName)) {
2317 if (!$this->$sMethodName($aFileInfo)) {
2327 $aDataEntry = $this->_oDb->getFileInfo(array(
'fileId' => $iEntryId),
true,
2328 array(
'medUri',
'medTitle',
'Approved'));
2329 if (
empty($aDataEntry) || $aDataEntry[
'Approved'] !=
'approved') {
2330 return array(
'skip' =>
true);
2333 $aActionList = array(
2334 'commentPost' =>
'_sbs_comments'
2337 $sActionName = isset($aActionList[
$sAction]) ?
' (' .
_t(
'_' . $this->_oConfig->getMainPrefix() . $aActionList[
$sAction]) .
')' :
'';
2341 'template' => array(
2342 'Subscription' => $aDataEntry[
'medTitle'] . $sActionName,
2343 'ViewLink' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'view/' . $aDataEntry[
'medUri'],
2351 $aAlbumsArray = $this->oAlbums->getAlbumList(array(
'owner' =>
$iProfId,
'status' =>
$sStatus));
2352 foreach ($aAlbumsArray
as $aAlbum) {
2353 $aList[$aAlbum[
'ID']] = $aAlbum;
2365 $aEmails = explode(
',', $sSet);
2366 foreach ($aEmails
as $sEmail) {
2367 $sEmail = trim($sEmail);
2368 if (!preg_match(
"/(([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?/",