19 $this->_oConfig->init($this->_oDb);
21 $this->_aMemActions[] =
'download';
22 $this->aSectionsAdmin[
'pending'] = array(
23 'exclude_btns' => array(
'featured',
'unfeatured')
29 return str_replace($sKey, sha1(
$aInfo[
'medDate']), $sTmpl);
35 $aInfo = $this->_oDb->getFileInfo(array(
'fileId'=>(
int)
$iFileId),
false, array(
'medID',
'medProfId',
'medExt',
'medDate',
'Type',
'medUri'));
37 $sPathFull = $this->_oConfig->getHomePath() .
'data/files/' .
$aInfo[
'medID'] .
'_' . sha1(
$aInfo[
'medDate']);
38 if (file_exists($sPathFull)) {
39 header(
'Connection: close');
41 header(
'Content-Length: ' . filesize($sPathFull));
42 header(
'Last-Modified: ' . gmdate(
'r', filemtime($sPathFull)));
43 header(
'Content-Disposition: attachment; filename="' .
$aInfo[
'medUri'] .
'.' .
$aInfo[
'medExt'] .
'";');
45 $this->_oDb->updateDownloadsCount($sFileUri);
49 $this->_oTemplate->displayPageNotFound();
52 $this->_oTemplate->displayPageNotFound();
54 $this->_oTemplate->displayAccessDenied();
60 if ($this->
isAdmin($this->_iProfileId) || $aFile[
'medProfId'] == $this->_iProfileId)
return true;
61 if (!$this->oPrivacy->check(
'download', $aFile[
'medID'], $this->_iProfileId))
64 $aCheck =
checkAction($this->_iProfileId, CH_FILES_DOWNLOAD, $isPerformAction);
82 header(
'Content-Type: text/html; charset=UTF-8');
84 require_once(
'ChFilesUploader.php');
89 echo $oUploader->serviceCancelFileInfo();
91 case 'accept_file_info':
92 echo $oUploader->serviceAcceptFileInfo();
95 parent::processUpload($oUploader,
$sAction);
100 $aAlbumInfo = array();
101 if (!$bNotAllowView && !
empty($sParamValue1)) {
102 $aAlbumInfo = $this->oAlbums->getAlbumInfo(array(
'fileUri' => $sParamValue1,
'owner' => $this->_iProfileId));
103 if (!
empty($aAlbumInfo))
106 if ($bNotAllowView) {
107 $sKey =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_access_denied');
108 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
DesignBoxContent($sKey,
MsgBox($sKey), 1)),
'',
'',
false);
112 if(is_array($_POST[
'entry']))
113 foreach ($_POST[
'entry']
as $iValue) {
114 $iValue = (int)$iValue;
116 case isset($_POST[
'action_delete']):
119 $this->oAlbums->removeAlbum($iValue);
121 case isset($_POST[
'action_move_to']):
122 $this->oAlbums->moveObject((
int)$_POST[
'album_id'], (
int)$_POST[
'new_album'], $iValue);
124 case isset($_POST[
'action_delete_object']):
130 ch_import(
'PageAlbumsMy', $this->_aModule);
131 $sClassName = $this->_oConfig->getClassPrefix() .
'PageAlbumsMy';
132 $oPage =
new $sClassName($this, $this->_iProfileId, array(
$sParamValue, $sParamValue1, $sParamValue2, $sParamValue3));
137 ch_import(
'PageAlbumsOwner', $this->_aModule);
138 $sClassName = $this->_oConfig->getClassPrefix() .
'PageAlbumsOwner';
139 $oPage =
new $sClassName($this, array(
'browse',
'owner',
getUsername($this->_iProfileId)));
148 $GLOBALS[
'oTopMenu']->setCurrentProfileID($this->_iProfileId);
149 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sCode),
'',
'',
false);
157 $iOwnerId =
getID($sParamValue1);
159 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
MsgBox(
_t(
'_sys_txt_error_you_are_blocked'))));
171 $iIdOwner =
getID($sParamValue1);
173 $this->_oTemplate->displayPageNotFound();
176 $GLOBALS[
'oTopMenu']->setCurrentProfileID($iIdOwner);
177 $this->aPageTmpl[
'header'] =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_browse_by_owner', $sParamValue1);
181 $sClassName = $this->_oConfig->getClassPrefix() .
'PageAlbumsOwner';
182 ch_import(
'PageAlbumsOwner', $this->_aModule);
184 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$oPage->getCode()));
190 if (
$sParamName ==
'album' && $sParamValue1 ==
'owner') {
191 $iOwnerId =
getID($sParamValue2);
193 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
MsgBox(
_t(
'_sys_txt_error_you_are_blocked'))));
199 if (
$sParamName ==
'album' && $sParamValue1 ==
'owner') {
201 $aAlbumInfo = $this->oAlbums->getAlbumInfo(array(
'fileUri' =>
$sParamValue,
'owner' =>
getID($sParamValue2)), array(
'ID',
'Caption',
'Owner',
'AllowAlbumView',
'Description'));
202 if (
empty($aAlbumInfo)) {
203 $this->_oTemplate->displayPageNotFound();
206 if ($aAlbumInfo[
'Owner'] == $this->_iProfileId && $sParamValue2 ===
getUsername($this->_iProfileId)) {
209 } elseif (!
empty($aAlbumInfo[
'AllowAlbumView']) && !$this->oAlbumPrivacy->check(
'album_view', $aAlbumInfo[
'ID'], $this->_iProfileId)) {
210 $sKey =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_access_denied');
212 $this->aPageTmpl[
'header'] = $sKey;
213 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sCode));
216 $GLOBALS[
'oTopMenu']->setCustomSubHeader($aAlbumInfo[
'Caption']);
223 $sParamValue1 = (int)$sParamValue1;
224 $sParamValue2 = (int)$sParamValue2;
227 $sClassName = $this->_oConfig->getClassPrefix() .
'Search';
231 if ($sRss !==
false && $sRss) {
232 $oSearch->aCurrent[
'paginate'][
'perPage'] = 10;
233 echo $oSearch->rss();
238 $sCaption =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_top_menu_' . $sTopPostfix);
245 $oSearch->aCurrent[
'restriction'][
'allow_view'][
'value'] = array($aAlbumInfo[
'AllowAlbumView']);
246 $sCaption =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_browse_by_' .
$sParamName, $aAlbumInfo[
'Caption']);
247 $this->_oTemplate->setPageDescription(substr(strip_tags($aAlbumInfo[
'Description']), 0, 255));
249 $oSearch->aCurrent[
'restriction'][
'not_allow_view'][
'value'] = array(
CH_WSB_PG_HIDDEN);
252 $sCaption =
_t(
'_' . $this->_oConfig->getMainPrefix() .
'_caption_browse_by_day')
253 .
': ' .
getLocaleDate( strtotime(
"{$sParamValue}-{$sParamValue1}-{$sParamValue2}")
257 $oSearch->aCurrent[
'paginate'][
'perPage'] = (int)$this->_oConfig->getGlParam(
'number_all');
258 $sCode = $oSearch->displayResultBlock();
260 if ($oSearch->aCurrent[
'paginate'][
'totalNum'] > 0) {
262 foreach ($aAdd
as $sValue) {
263 if (strlen($sValue) > 0)
264 $sArg .=
'/' . $sValue;
268 $sLink = $this->_oConfig->getBaseUri() .
'browse' . $sArg;
270 'page_url' => $sLink .
'&page={page}&per_page={per_page}',
271 'count' => $oSearch->aCurrent[
'paginate'][
'totalNum'],
272 'per_page' => $oSearch->aCurrent[
'paginate'][
'perPage'],
273 'page' => $oSearch->aCurrent[
'paginate'][
'page'],
274 'on_change_per_page' =>
'return !loadDynamicBlock(1, \'' . $sLink .
'&page=1&per_page=\' + this.value);'
276 $sPaginate = $oPaginate->getPaginate();
283 $this->aPageTmpl[
'css_name'] = array(
'browse.css');
285 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
$sCode));
290 $bAjax = isset($_SERVER[
'HTTP_X_REQUESTED_WITH']) && $_SERVER[
'HTTP_X_REQUESTED_WITH'] ==
'XMLHttpRequest' ?
TRUE : FALSE;
294 $aManageArray = array(
'medTitle',
'medTags',
'medDesc',
'medProfId',
'Categories',
'AllowDownload',
'medUri');
295 $aInfo = $this->_oDb->getFileInfo(array(
'fileId'=>
$iFileId),
false, $aManageArray);
296 $sLangPref =
'_' . $this->_oConfig->getMainPrefix();
302 $oCategories->getTagObjectConfig();
303 $aCategories = $oCategories->getGroupChooser($this->_oConfig->getMainPrefix(), $this->_iProfileId,
true);
306 $aAllowDownload = $this->oPrivacy->getGroupChooser($this->_iProfileId, $this->_oConfig->getUri(),
'download');
307 $aAllowDownload[
'value'] =
$aInfo[
'AllowDownload'];
308 $sUrlPref = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri();
310 'form_attrs' => array(
311 'id' => $sLangPref .
'_upload_form',
313 'action' => $sUrlPref .
'edit/' .
$iFileId,
314 'onsubmit' =>
"return ch_ajax_form_check(this)",
318 'submit_name' =>
'do_submit',
320 'checker_helper' =>
'ChSupportCheckerHelper',
324 'type' =>
'block_header',
325 'caption' =>
_t(
'_Info'),
329 'name' =>
'medTitle',
330 'caption' =>
_t(
'_Title'),
334 'params' => array(3, 128),
335 'error' =>
_t(
'_td_err_incorrect_length'),
337 'value' =>
$aInfo[
'medTitle'],
342 'caption' =>
_t(
'_Tags'),
343 'info' =>
_t(
'_Tags_desc'),
344 'value' =>
$aInfo[
'medTags']
346 'description' => array(
347 'type' =>
'textarea',
349 'caption' =>
_t(
'_Description'),
350 'value' =>
$aInfo[
'medDesc'],
352 'categories' => $aCategories,
353 'AllowDownload' => $aAllowDownload,
359 'medProfId' => array(
361 'name' =>
'medProfId',
362 'value' => $this->_iProfileId,
364 'do_submit' => array(
366 'name' =>
'do_submit',
371 'name' =>
'submit_press',
372 'value' =>
_t(
'_Submit'),
378 if(
getParam(
'ch_files_cat_required') ==
'') {
379 $aForm[
'inputs'][
'categories'][
'required'] =
false;
380 unset(
$aForm[
'inputs'][
'categories'][
'checker']);
384 if (
$oForm->isSubmittedAndValid()) {
386 array_pop($aManageArray);
387 foreach ($aManageArray
as $sKey) {
388 if ($sKey !=
'Categories')
389 $aValues[$sKey] = $_POST[$sKey];
393 if ($this->_oDb->updateData(
$iFileId, $aValues)) {
394 $sType = $this->_oConfig->getMainPrefix();
401 $sCode =
$GLOBALS[
'oFunctions']->msgBox(
_t($sLangPref .
'_save_success'), 3,
'window.location="' . $sUrlPref .
'view/' .
$aInfo[
'medUri'] .
'";');
405 $sCode = $this->_oTemplate->parseHtmlByName(
'default_padding.html', array(
'content' =>
$oForm->getCode()));
406 $sCode = $this->_oTemplate->parseHtmlByName(
'popup.html', array(
'title' =>
$aInfo[
'medTitle'],
'content' =>
$sCode));
410 header(
'Content-type:text/html;charset=utf-8');
417 return parent::serviceGetMemberMenuItem ($sIcon);
422 return parent::serviceGetMemberMenuItemAddContent ($sIcon);
428 'templates' => array(
429 'single' =>
'wall_post.html',
430 'grouped' =>
'wall_post_grouped.html'
438 'templates' => array(
439 'single' =>
'wall_outline.html',
440 'grouped' =>
'wall_outline_grouped.html'
450 return parent::serviceGetWallAddComment($aEvent, array(
451 'templates' => array(
452 'snippet' =>
'wall_post_comment.html'
457 function getInstanceUploadFormArray($aAlbums, $aPrivFieldView, $sAlbumsCaption =
false, $sAlbumTitleCaption =
false, $sCreateNewAlbumCaption =
false)
459 $sLangPref =
'_' . $this->_oConfig->getMainPrefix();
460 return parent::getInstanceUploadFormArray($aAlbums, $aPrivFieldView,
_t($sLangPref .
'_album'),
_t($sLangPref .
'_album_title'),
_t($sLangPref .
'_albums_add_new'));
464 $aInfo = $this->_oDb->getFileInfo(array(
'fileUri' => $sUri));
466 $this->_oTemplate->pageCode($this->aPageTmpl, array(
'page_main_code' =>
MsgBox(
_t(
'_sys_txt_error_you_are_blocked'))));
470 parent::actionView($sUri);