Cheetah
ChWsbFilesModule.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbModule');
9 ch_import('ChWsbAlbums');
10 ch_import("ChTempFormView");
11 
13 {
16  var $oPrivacy;
18 
19  var $oAlbums;
20 
21  var $_aMemActions = array('add', 'view', 'delete', 'approve', 'edit');
22 
23  var $aSectionsAdmin = array();
24 
28  function __construct(&$aModule)
29  {
30  parent::__construct($aModule);
31  $this->_iProfileId = $this->_oDb->iViewer;
32  $this->aPageTmpl = array(
33  'name_index' => 1,
34  'header' => $GLOBALS['site']['title'],
35  'header_text' => '',
36  );
37  $sClassName = $this->_oConfig->getClassPrefix() . 'Privacy';
38  ch_import('Privacy', $aModule);
39  $this->oPrivacy = new $sClassName();
40  $this->oAlbumPrivacy = new $sClassName('sys_albums');
41  $this->oAlbums = new ChWsbAlbums($this->_oConfig->getMainPrefix(), $this->_iProfileId);
42 
43  $this->aSectionsAdmin = array(
44  'approved' => array(
45  'exclude_btns' => array('activate')
46  ),
47  'disapproved' => array(
48  'exclude_btns' => array('deactivate', 'featured', 'unfeatured')
49  ),
50  'pending' => array(
51  'exclude_btns' => array('activate', 'deactivate', 'featured', 'unfeatured')
52  ),
53  );
54  }
55 
56  function _checkVisible($aParam = array())
57  {
58  $aVis = array(CH_WSB_PG_ALL);
59  if ($this->_iProfileId > 0) {
60  $aVis[] = CH_WSB_PG_MEMBERS;
61  }
62 
63  return $aVis;
64  }
65 
67  {
68  $aNewActions = array();
69  foreach ($this->_aMemActions as $sValue) {
70  $aNewActions[] = $this->_oConfig->getUri() . ' ' . $sValue;
71  }
72 
73  return $aNewActions;
74  }
75 
76  function _defineActions()
77  {
78  $aActionList = $this->_defineActionsArray();
79  defineMembershipActions($aActionList);
80  }
81 
83  {
84  $sConstName = strtoupper(str_replace(' ', '_', $this->_oConfig->getMainPrefix()) . '_' . $sAction);
85 
86  return constant($sConstName);
87  }
88 
90  {
92  if (!$aInfo) {
93  return false;
94  }
95  if ($this->_oDb->deleteData($iFileId)) {
96  $aFilesPostfix = $this->_oConfig->aFilePostfix;
97  //delete temp files
98  $aFilesPostfix['temp'] = '';
99  if (isset($aFilesPostfix['original'])) {
100  $aFilesPostfix['original'] = $this->_getOriginalExt($aInfo, $aFilesPostfix['original']);
101  }
102  foreach ($aFilesPostfix as $sValue) {
103  $sFilePath = $this->_oConfig->getFilesPath() . $iFileId . $sValue;
104  @unlink($sFilePath);
105  }
106  ch_import('ChWsbVoting');
107  $oVoting = new ChWsbVoting($this->_oConfig->getMainPrefix(), 0, 0);
108  $oVoting->deleteVotings($iFileId);
109  ch_import('ChWsbCmts');
110  $oCmts = new ChWsbCmts($this->_oConfig->getMainPrefix(), $iFileId);
111  $oCmts->onObjectDelete();
112 
113  ch_import('ChWsbCategories');
114  //tags & categories parsing
115  $oTag = new ChWsbTags();
116  $oTag->reparseObjTags($this->_oConfig->getMainPrefix(), $iFileId);
117  $oCateg = new ChWsbCategories();
118  $oCateg->reparseObjTags($this->_oConfig->getMainPrefix(), $iFileId);
119 
120  $bUpdateCounter = $aInfo['Approved'] == 'approved' ? true : false;
121  $this->oAlbums->removeObjectTotal($iFileId, $bUpdateCounter);
122 
123  //delete all subscriptions
125  $oSubscription->unsubscribe(array(
126  'type' => 'object_id',
127  'unit' => $this->_oConfig->getMainPrefix(),
128  'object_id' => $iFileId
129  ));
130 
131  ch_import('ChWsbAlerts');
132  $oAlert = new ChWsbAlerts($this->_oConfig->getMainPrefix(), 'delete', $iFileId, $this->_iProfileId, $aInfo);
133  $oAlert->alert();
134 
135  $this->isAllowedDelete($aInfo, true);
136  } else {
137  return false;
138  }
139 
140  return true;
141  }
142 
143  function _deleteAlbumUnits($iAlbumId)
144  {
145  $iAlbumId = (int)$iAlbumId;
146  $aObjects = $this->oAlbums->getAlbumObjList($iAlbumId);
147  $iCount = 0;
148  foreach ($aObjects as $iValue) {
149  $iObj = (int)$iValue;
150  if (!$this->_deleteFile($iObj)) {
151  $iCount++;
152  }
153  }
154 
155  return $iCount;
156  }
157 
158  function _getOriginalExt(&$aInfo, $sTmpl, $sKey = '{ext}')
159  {
160  return str_replace($sKey, $aInfo['medExt'], $sTmpl);
161  }
162 
163  function actionAdministration($sParam = '', $sParam1 = '')
164  {
165  if (!isAdmin($this->_iProfileId)) {
166  return;
167  }
168  $this->checkActions();
169 
170  if (isset($_GET['action']) && $_GET['action'] == 'findMembers') {
171  echo $this->getMemberList();
172  exit;
173  }
174 
175  $aMenu = array(
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'
179  ),
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'
183  ),
184  );
185 
186  switch ($sParam) {
187  case 'settings':
188  $aMenu[$this->_oConfig->getMainPrefix() . '_admin_settings']['active'] = 1;
189  $sCode = $this->getAdminSettings($aMenu);
190  break;
191  default:
192  $aMenu[$this->_oConfig->getMainPrefix() . '_admin_main']['active'] = 1;
193  $sCode = $this->getAdminMainPage($aMenu,
194  $sParam1);
195  break;
196  }
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);
201  }
202 
203  function actionHome()
204  {
205  $sClassName = $this->_oConfig->getClassPrefix() . 'PageHome';
206  ch_import('PageHome', $this->_aModule);
207  $oPage = new $sClassName($this);
208  $sCode = $oPage->getCode();
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));
212  }
213 
214  function actionCategories()
215  {
216  ch_import('ChTemplCategoriesModule');
217  $aParam = array(
218  'type' => $this->_oConfig->getMainPrefix(),
219  );
220  $oCateg = new ChTemplCategoriesModule($aParam, _t('_categ_users'),
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));
225  }
226 
227  function actionTags()
228  {
229  ch_import('ChTemplTagsModule');
230  $aParam = array(
231  'type' => $this->_oConfig->getMainPrefix(),
232  'orderby' => 'popular'
233  );
234  $oTags = new ChTemplTagsModule($aParam,
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));
240  }
241 
242  function actionView($sUri)
243  {
244  $aIdent = array(
245  'fileUri' => $sUri,
246  );
247  $aInfo = $this->_oDb->getFileInfo($aIdent);
248  if (!empty($aInfo)) {
249  if ($aInfo['AllowAlbumView'] == CH_WSB_PG_HIDDEN || !$this->isAllowedView($aInfo)) {
250  $sKey = _t('_' . $this->_oConfig->getMainPrefix() . '_forbidden');
251  $sCode = DesignBoxContent($sKey, MsgBox($sKey), 1);
252  } else {
253  $aInfo['medTitle'] = stripslashes($aInfo['medTitle']);
254  $aInfo['medDesc'] = stripslashes($aInfo['medDesc']);
255  $aInfo['NickName'] = getUsername($aInfo['medProfId']);
256  //meta keywords and descriptions
257  $this->_oTemplate->setPageDescription(substr(strip_tags($aInfo['medDesc']), 0, 255));
258  $this->_oTemplate->addPageKeywords($aInfo['medTags']);
259 
260  // album data about prev and next files
261  // calculation of un-approved files in album
262  $sClassName = $this->_oConfig->getClassPrefix() . 'Search';
263  ch_import('Search', $this->_aModule);
264  $oSearch = new $sClassName();
265  $oSearch->aCurrent['restriction']['albumId'] = array(
266  'value' => $aInfo['albumId'],
267  'field' => 'ID',
268  'operator' => '=',
269  'table' => 'sys_albums'
270  );
271  $oSearch->aCurrent['restriction']['activeStatus']['operator'] = '<>';
272 
273  $aIds = array();
274  $aExcludeList = $oSearch->getSearchData();
275  if (!empty($aExcludeList))
276  foreach ($aExcludeList as $aValue)
277  $aIds[] = $aValue['id'];
278 
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);
283 
284  $aInfo['favorited'] = $this->_oDb->checkFavoritesIn($aInfo['medID']);
285 
286  ch_import('PageView', $this->_aModule);
287  $sClassName = $this->_oConfig->getClassPrefix() . 'PageView';
288  $oPage = new $sClassName($this, $aInfo);
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';
293 
294  if ($this->_iProfileId != $aInfo['medProfId']) {
295  $this->isAllowedView($aInfo, true);
296  }
297  }
298  } else {
299  $this->_oTemplate->displayPageNotFound();
300  }
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'],
306  $sKey => '',
307  ));
308 
309  $this->_oTemplate->addJsTranslation(array('_Are_you_sure'));
310  $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode));
311  }
312 
313  function actionBrowse(
314  $sParamName = '',
315  $sParamValue = '',
316  $sParamValue1 = '',
317  $sParamValue2 = '',
318  $sParamValue3 = ''
319  ) {
320  $bAlbumView = false;
321  if ($sParamName == 'album' && $sParamValue1 == 'owner') {
322  $bAlbumView = true;
323  $aAlbumInfo = $this->oAlbums->getAlbumInfo(array(
324  'fileUri' => $sParamValue,
325  'owner' => getID($sParamValue2)
326  ));
327  if (empty($aAlbumInfo)) {
328  $this->_oTemplate->displayPageNotFound();
329  } else {
330  if (!$this->oAlbumPrivacy->check('album_view', $aAlbumInfo['ID'], $this->_iProfileId)) {
331  $sKey = _t('_' . $this->_oConfig->getMainPrefix() . '_access_denied');
332  $sCode = DesignBoxContent($sKey, MsgBox($sKey), 1);
333  $this->aPageTmpl['header'] = $sKey;
334  $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode));
335 
336  return;
337  }
338 
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'] => '',
344  ));
345 
346  if ($aAlbumInfo['Owner'] == $this->_iProfileId && $sParamValue2 === getUsername($this->_iProfileId)) {
347  $this->actionAlbumsViewMy('main_objects', $sParamValue, $sParamValue1, $sParamValue2,
348  $sParamValue3);
349 
350  return;
351  }
352  }
353  }
354 
355  if ('calendar' == $sParamName) {
356  $sParamValue = (int)$sParamValue;
357  $sParamValue1 = (int)$sParamValue1;
358  $sParamValue2 = (int)$sParamValue2;
359  }
360 
361  $sClassName = $this->_oConfig->getClassPrefix() . 'Search';
362  ch_import('Search', $this->_aModule);
363  $oSearch = new $sClassName($sParamName, $sParamValue, $sParamValue1, $sParamValue2);
364  $sRss = ch_get('rss');
365  if ($sRss !== false && $sRss) {
366  $oSearch->aCurrent['paginate']['perPage'] = 10;
367  header('Content-Type: text/xml; charset=UTF-8');
368  echo $oSearch->rss();
369  exit;
370  }
371 
372  $sTopPostfix = isset($oSearch->aCurrent['restriction'][$sParamName]) || $oSearch->aCurrent['sorting'] == $sParamName ? $sParamName : 'all';
373  $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_top_menu_' . $sTopPostfix);
374  if (!empty($sParamValue) && isset($oSearch->aCurrent['restriction'][$sParamName])) {
376  $oSearch->aCurrent['restriction'][$sParamName]['value'] = $sParamValue;
377  $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_' . $sParamName,
379  }
380  if ($bAlbumView) {
381  $oSearch->aCurrent['restriction']['allow_view']['value'] = array($aAlbumInfo['AllowAlbumView']);
382  $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_' . $sParamName,
383  $aAlbumInfo['Caption']);
384  $this->_oTemplate->setPageDescription(substr(strip_tags($aAlbumInfo['Description']), 0, 255));
385  } else {
386  $oSearch->aCurrent['restriction']['not_allow_view']['value'] = array(CH_WSB_PG_HIDDEN);
387  }
388 
389  $oSearch->aCurrent['paginate']['perPage'] = (int)$this->_oConfig->getGlParam('number_all');
390  $sCode = $oSearch->displayResultBlock();
391  if ($oSearch->aCurrent['paginate']['totalNum'] > 0) {
392  $sCode = $GLOBALS['oFunctions']->centerContent($sCode, '.sys_file_search_unit');
393  $sCode = $this->_oTemplate->parseHtmlByName('default_padding_thd.html', array(
394  'content' => $sCode
395  ));
396 
397  $aAdd = array($sParamName, $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3);
398  foreach ($aAdd as $sValue) {
399  if (strlen($sValue) > 0) {
400  $sArg .= '/' . rawurlencode($sValue);
401  } else {
402  break;
403  }
404  }
405  $sLink = $this->_oConfig->getBaseUri() . 'browse' . $sArg;
406  $oPaginate = new ChWsbPaginate(array(
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;'
412  ));
413  $sPaginate = $oPaginate->getPaginate();
414  } else {
415  $sCode = MsgBox(_t('_Empty'));
416  }
417 
418  if ($sParamName == 'calendar') {
419  $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_caption_browse_by_day')
420  . ': ' . getLocaleDate(strtotime("{$sParamValue}-{$sParamValue1}-{$sParamValue2}")
422  }
423  $aMenu = array();
424  $sCode = DesignBoxContent($sCaption, $sCode . $sPaginate, 1,
425  $this->_oTemplate->getExtraTopMenu($aMenu, CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri()));
426  if ($bAlbumView) {
427  $sCode = $this->getAlbumPageView($aAlbumInfo, $sCode);
428  }
429  $this->aPageTmpl['css_name'] = array('browse.css');
430  $this->aPageTmpl['header'] = $sCaption;
431  $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode));
432  }
433 
435  {
436  $bAjax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ? true : false;
437  $iFileId = (int)$iFileId > 0 ? (int)$iFileId : (int)ch_get('fileId');
438  if (!$iFileId || !$bAjax) {
439  return;
440  }
441 
442  $sPrefix = $this->_oConfig->getMainPrefix();
443  if($sPrefix == 'ch_sounds') {
444  $aManageArray = array('medTitle', 'thumbUrl', 'medTags', 'medDesc', 'medProfId', 'Categories', 'medUri');
445  } else {
446  $aManageArray = array('medTitle', 'medTags', 'medDesc', 'medProfId', 'Categories', 'medUri');
447  }
448  $aInfo = $this->_oDb->getFileInfo(array('fileId' => $iFileId), false, $aManageArray);
449  $sLangPref = '_' . $sPrefix;
450  if (!$this->isAllowedEdit($aInfo)) {
451  $sCode = MsgBox(_t($sLangPref . '_access_denied')) . $sJsCode;
452  } else {
453  $oCategories = new ChWsbCategories();
454  $oCategories->getTagObjectConfig();
455  $aCategories = $oCategories->getGroupChooser($this->_oConfig->getMainPrefix(), $this->_iProfileId,
456  true);
457  $aCategories['value'] = explode(CATEGORIES_DIVIDER, $aInfo['Categories']);
458 
459  $sUrlPref = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri();
460  $aForm = array(
461  'form_attrs' => array(
462  'id' => $sLangPref . '_upload_form',
463  'method' => 'post',
464  'action' => $sUrlPref . 'edit/' . $iFileId,
465  'onsubmit' => "return ch_ajax_form_check(this)",
466  ),
467  'params' => array(
468  'db' => array(
469  'submit_name' => 'do_submit',
470  ),
471  'checker_helper' => 'ChSupportCheckerHelper',
472  ),
473  'inputs' => array(
474  'header' => array(
475  'type' => 'block_header',
476  'caption' => _t('_Info'),
477  ),
478  'title' => array(
479  'type' => 'text',
480  'name' => 'medTitle',
481  'caption' => _t('_Title'),
482  'required' => true,
483  'checker' => array(
484  'func' => 'length',
485  'params' => array(3, 128),
486  'error' => _t('_td_err_incorrect_length'),
487  ),
488  'value' => $aInfo['medTitle'],
489  ),
490  'thumburl' => array(
491  'type' => 'text',
492  'name' => 'thumbUrl',
493  'caption' => _t('_sound_thumb_url'),
494  'required' => false,
495  'value' => $aInfo['thumbUrl'],
496  ),
497  'tags' => array(
498  'type' => 'text',
499  'name' => 'medTags',
500  'caption' => _t('_Tags'),
501  'info' => _t('_Tags_desc'),
502  'value' => $aInfo['medTags']
503  ),
504  'description' => array(
505  'type' => 'textarea',
506  'name' => 'medDesc',
507  'caption' => _t('_Description'),
508  'value' => $aInfo['medDesc'],
509  ),
510  'categories' => $aCategories,
511  'fileId' => array(
512  'type' => 'hidden',
513  'name' => 'fileId',
514  'value' => $iFileId,
515  ),
516  'medProfId' => array(
517  'type' => 'hidden',
518  'name' => 'medProfId',
519  'value' => $this->_iProfileId,
520  ),
521  'do_submit' => array(
522  'type' => 'hidden',
523  'name' => 'do_submit', // hidden submit field for AJAX submit
524  'value' => 1,
525  ),
526  'submit' => array(
527  'type' => 'submit',
528  'name' => 'submit_press',
529  'value' => _t('_Submit'),
530  'colspan' => true,
531  ),
532  ),
533  );
534 
535  // Remove the requirement for categories if option is off.
536  if(getParam($sPrefix . '_cat_required') == '') {
537  $aForm['inputs']['categories']['required'] = false;
538  unset($aForm['inputs']['categories']['checker']);
539  }
540 
541  // Remove the thumb url input on everything but the sounds.
542  if($sPrefix != 'ch_sounds') {
543  unset($aForm['inputs']['thumburl']);
544  }
546  $oForm->initChecker($aInfo);
547  if ($oForm->isSubmittedAndValid()) {
548  if($sPrefix == 'ch_sounds') {
549  $sThumbUrl = $_POST['thumbUrl'];
550  if($sThumbUrl) {
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");
562  }
563  $tmp = imagecreatetruecolor($width, $height);
564  imagecopyresampled($tmp, $src, 0, 0, 0, 0, $width, $height, $width, $height);
565  imagejpeg($tmp, $sFile1);
566  unlink($sFileTmp);
567  }
568  }
569  $aValues = array();
570  array_pop($aManageArray);
571  foreach ($aManageArray as $sKey) {
572  if ($sKey != 'Categories')
573  $aValues[$sKey] = $_POST[$sKey];
574  else
575  $aValues[$sKey] = implode(CATEGORIES_DIVIDER, $_POST[$sKey]);
576  }
577  if ($this->_oDb->updateData($iFileId, $aValues)) {
578  $sType = $this->_oConfig->getMainPrefix();
579 
580  ch_import('ChWsbCategories');
581  $oTag = new ChWsbTags();
582  $oTag->reparseObjTags($sType, $iFileId);
583 
584  $oCateg = new ChWsbCategories();
585  $oCateg->reparseObjTags($sType, $iFileId);
586 
587  $oAlert = new ChWsbAlerts($sType, 'change', $iFileId, $this->_iProfileId, array('Info' => $this->_oDb->getFileInfo(array('fileId' => $iFileId), false, $aManageArray)));
588  $oAlert->alert();
589 
590  $sCode = $GLOBALS['oFunctions']->msgBox(_t($sLangPref . '_save_success'), 3, 'window.location="' . $sUrlPref . 'view/' . $aInfo['medUri'] . '";');
591 
592  }
593  else
594  $sCode = $GLOBALS['oFunctions']->msgBox(_t('_sys_save_nothing'));
595  }
596  else {
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));
601  $sCode = $GLOBALS['oFunctions']->transBox($sCode, true);
602  }
603  }
604  header('Content-type:text/html;charset=utf-8');
605  echo $sCode;
606  exit;
607  }
608 
609  function actionRate()
610  {
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());
616  $sCode = $oPage->getCode();
617  $this->aPageTmpl['header'] = _t('_' . $this->_oConfig->getMainPrefix() . '_top_menu_rate');
618  } else {
619  $sKey = _t('_sys_request_page_not_found_cpt');
620  $sCode = DesignBoxContent($sKey, MsgBox($sKey), 1);
621  }
622  $this->aPageTmpl['css_name'] = array('search.css', 'browse.css');
623  $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode));
624  }
625 
626  function actionRss($sParamName, $sParamValue, $sParamValue1, $sParamValue2)
627  {
628  if ($this->_oConfig->getGlParam('rss_feed_on') == 'on') {
629  switch ($sParamName) {
630  case 'album':
631  $aUnits = array();
632  $aAlbumInfo = $this->oAlbums->getAlbumInfo(array(
633  'fileUri' => $sParamValue,
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',
641  );
642  if ($this->isAllowedView($aFileCopycat)) {
643  $sClassName = $this->_oConfig->getClassPrefix() . 'Search';
644  ch_import('Search', $this->_aModule);
645  $oSearch = new $sClassName();
646  $oSearch->aCurrent['paginate']['perPage'] = 1000;
647  $aUnits = $oSearch->serviceGetFilesInAlbum($aAlbumInfo['ID']);
648  }
649  }
650  $sCode = $this->_oTemplate->getAlbumFeed($aUnits);
651  break;
652  }
653  header('Content-Type: text/xml; charset=UTF-8');
654  echo $sCode;
655  }
656  }
657 
658  function actionReport($sFileUri)
659  {
660  $sLangPref = '_' . $this->_oConfig->getMainPrefix() . '_';
661  $sFileUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $sFileUri;
662  $aForm = $this->getSubmitForm($sFileUri, 'report');
664  $oForm->initChecker();
665  if ($oForm->isSubmittedAndValid()) {
666  if ($this->sendFileInfo($GLOBALS['site']['email'], nl2br(process_pass_data($_POST['messageText'])),
667  $sFileUrl, $_POST['mediaAction'])
668  ) {
669  $sCode = $GLOBALS['oFunctions']->msgBox(_t('_File info was sent'));
670  } else {
671  $sCode = $GLOBALS['oFunctions']->msgBox(_t('_Error'));
672  }
673  } else {
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));
677  $sCode = $GLOBALS['oFunctions']->transBox($sCode, true);
678  }
679  header('Content-type:text/html;charset=utf-8');
680  echo $sCode;
681  exit;
682  }
683 
684  function actionShare($sFileUri)
685  {
686  $sLangPref = '_' . $this->_oConfig->getMainPrefix() . '_';
687  $sFileUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $sFileUri;
688  $aForm = $this->getSubmitForm($sFileUri, 'share');
690  $oForm->initChecker();
691  if ($oForm->isSubmittedAndValid()) {
692  if ($this->sendFileInfo($_POST['email'], nl2br(process_pass_data($_POST['messageText'])), $sFileUrl,
693  $_POST['mediaAction'])
694  ) {
695  $sCode = $GLOBALS['oFunctions']->msgBox(_t('_File info was sent'));
696  } else {
697  $sCode = $GLOBALS['oFunctions']->msgBox(_t('_Error'));
698  }
699  } else {
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));
703  $sCode = $GLOBALS['oFunctions']->transBox($sCode, true);
704  }
705  header('Content-type:text/html;charset=utf-8');
706  echo $sCode;
707  exit;
708  }
709 
711  {
712  if (!$this->_oDb->checkFavoritesIn($iFileId)) {
713  $sMessPost = 'add';
714  $this->_oDb->addToFavorites($iFileId);
715  } else {
716  $sMessPost = 'remove';
717  $this->_oDb->removeFromFavorites($iFileId);
718  }
720  header('Content-Type: text/html; charset=UTF-8');
721  echo MsgBox(_t('_' . $this->_oConfig->getMainPrefix() . '_fav_' . $sMessPost)) . $sJQueryJS;
722  exit;
723  }
724 
725  function actionFeature($iFileId, $iFeatureId = 0)
726  {
727  $iFileId = (int)$iFileId;
728  if ($iFileId > 0 && isAdmin($this->_iProfileId)) {
729  $iFeatureId = (int)$iFeatureId;
730  if ($iFeatureId > 0) {
732  } else {
733  $this->adminMakeFeatured($iFileId);
734  }
736  header('Content-Type: text/html; charset=UTF-8');
737  echo MsgBox(_t('_Saved')) . $sJQueryJS;
738  exit;
739  }
740  }
741 
742  function actionApprove($iFileId, $iApprove = 1)
743  {
744  $iFileId = (int)$iFileId;
745  if ($iFileId) {
746  $iApprove = (int)$iApprove;
747  $aFile = array('medID' => $iFileId, 'medProfId' => 0);
749  if ($this->isAllowedApprove($aFile)) {
750  if ($iApprove) {
751  $this->adminApproveFile($iFileId);
752  } else {
754  }
755  $this->isAllowedApprove($aFile, true);
756  $sMsg = '_Saved';
757  } else {
758  $sMsg = '_Access denied';
759  }
760  header('Content-Type: text/html; charset=UTF-8');
761  echo MsgBox(_t($sMsg)) . $sJQueryJS;
762  exit;
763  }
764  }
765 
766  function actionDelete($iFileId, $sAlbumUri = '', $sOwnerNick = '')
767  {
768  $iFileId = (int)$iFileId;
769  $sJQueryJS = '';
770  $sLangKey = '_' . $this->_oConfig->getMainPrefix() . '_delete';
771  if ($this->_deleteFile($iFileId)) {
772  $sRedirectMain = 'albums/my/main/';
773  if (!empty($sAlbumUri)) {
774  $sAlbumUri = clear_xss($sAlbumUri);
775  $sOwnerNick = clear_xss($sOwnerNick);
776  $sRedirectMain = 'browse/album/' . $sAlbumUri . '/owner/' . $sOwnerNick;
777  }
778  $sRedirect = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . $sRedirectMain;
779  $sJQueryJS = genAjaxyPopupJS($iFileId, 'ajaxy_popup_result_div', $sRedirect);
780  } else {
781  $sLangKey .= '_error';
782  }
783  header('Content-Type: text/html; charset=UTF-8');
784  echo MsgBox(_t($sLangKey)) . $sJQueryJS;
785  exit;
786  }
787 
788  function actionAlbums(
789  $sParamName = '',
790  $sParamValue = '',
791  $sParamValue1 = '',
792  $sParamValue2 = '',
793  $sParamValue3 = ''
794  ) {
795  if ($sParamName == 'my') {
796  $this->actionAlbumsViewMy($sParamValue, $sParamValue1, $sParamValue2, $sParamValue3);
797 
798  return;
799  }
800 
801  if ($sParamName == 'browse' && $sParamValue == 'all') {
802  $sContent = $this->getAlbumPageBrowse(array(
803  $sParamName,
804  $sParamValue,
805  $sParamValue1,
806  $sParamValue2,
807  $sParamValue3
808  ));
809  $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sContent));
810 
811  return;
812  }
813 
814  if ($sParamName == 'browse' && $sParamValue == 'owner') {
815  $iIdOwner = getID($sParamValue1);
816  if (!$iIdOwner) {
817  $this->_oTemplate->displayPageNotFound();
818  exit;
819  }
820  $GLOBALS['oTopMenu']->setCurrentProfileID($iIdOwner);
821  $this->aPageTmpl['header'] = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_owner', $sParamValue1);
822  }
823 
824  $sClassName = $this->_oConfig->getClassPrefix() . 'PageAlbumsOwner';
825  ch_import('PageAlbumsOwner', $this->_aModule);
826  $oPage = new $sClassName($this, array($sParamName, $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3));
827  $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $oPage->getCode()));
828  }
829 
830  function actionAlbumsViewMy($sParamValue = '', $sParamValue1 = '', $sParamValue2 = '', $sParamValue3 = '')
831  {
832  $sAction = ch_get('action');
833  if ($sAction !== false) {
834  header('Content-Type: text/html; charset=UTF-8');
835 
836  if (!isLogged() && ch_get('oid') && ch_get('pwd')) { // in case of request from flash, cookies are not passed, and we have to set it explicitly
837  $_COOKIE['memberID'] = ch_get('oid');
838  $_COOKIE['memberPassword'] = ch_get('pwd');
839  check_logged();
840  }
841 
842  if (!isLogged()) {
843  echo MsgBox(_t('_Access denied'));
844  exit;
845  }
846 
847  $sUpl = 'Uploader';
848  ch_import($sUpl, $this->_aModule);
849  $sClassName = $this->_oConfig->getClassPrefix() . $sUpl;
850  $oUploader = new $sClassName();
851  $this->processUpload($oUploader, $sAction);
852  exit;
853  }
854  $bNotAllowView = $this->_iProfileId == 0 || !isLoggedActive();
855  $aAlbumInfo = array();
856  if (!$bNotAllowView && !empty($sParamValue1)) {
857  $aAlbumInfo = $this->oAlbums->getAlbumInfo(array(
858  'fileUri' => $sParamValue1,
859  'owner' => $this->_iProfileId
860  ));
861  if (!empty($aAlbumInfo)) {
862  $bNotAllowView = $aAlbumInfo['AllowAlbumView'] == CH_WSB_PG_HIDDEN;
863  }
864  }
865  if ($bNotAllowView) {
866  $sKey = _t('_' . $this->_oConfig->getMainPrefix() . '_access_denied');
867  $sCode = DesignBoxContent($sKey, MsgBox($sKey), 1);
868  $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode), '', '', false);
869 
870  return;
871  }
872 
873  //album actions check
874  if (is_array($_POST['entry'])) {
875  foreach ($_POST['entry'] as $iValue) {
876  $iValue = (int)$iValue;
877  switch (true) {
878  case isset($_POST['action_delete']):
879  $iCount = $this->_deleteAlbumUnits($iValue);
880  if ($iCount == 0) {
881  $this->oAlbums->removeAlbum($iValue);
882  }
883  break;
884 
885  case isset($_POST['action_move_to']):
886  $this->oAlbums->moveObject((int)$_POST['album_id'], (int)$_POST['new_album'], $iValue);
887  break;
888 
889  case isset($_POST['action_delete_object']):
890  $this->_deleteFile($iValue);
891  break;
892  }
893  }
894  }
895 
896  $sCode = '';
897  switch ($sParamValue) {
898  case 'main':
899  ch_import('PageAlbumsOwner', $this->_aModule);
900  $sClassName = $this->_oConfig->getClassPrefix() . 'PageAlbumsOwner';
901  $oPage = new $sClassName($this, array('browse', 'owner', getUsername($this->_iProfileId)));
902  $sCode .= $oPage->getCode();
903  break;
904 
905  case 'main_objects':
906  $sCode .= $this->getAlbumPageView($aAlbumInfo);
907  break;
908  }
909 
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));
914 
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);
922  }
923 
924  $GLOBALS['oTopMenu']->setCurrentProfileID($this->_iProfileId);
925  $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $oPage->getCode() . $sCode), '', '',
926  false);
927  }
928 
929  function actionAlbumOrganize($sAlbumUri)
930  {
931  $aSort = $_POST['unit'];
932  $this->oAlbums->sortObjects($sAlbumUri, $aSort);
933  }
934 
935  function actionAlbumReverse($sAlbumUri)
936  {
937  $this->oAlbums->sortObjects($sAlbumUri);
938 
939  $sClassName = $this->_oConfig->getClassPrefix() . 'Search';
940  ch_import('Search', $this->_aModule);
941  $oSearch = new $sClassName('album', $sAlbumUri, 'owner',
942  getUsername($this->_iProfileId));
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);
952  }
953  }
954  header('Content-Type: text/html; charset=UTF-8');
955  echo $sCode . '<div class="clear_both"></div>';
956  }
957 
958  function actionAlbumDelete($sAlbumUri)
959  {
960  $sLangPref = '_' . $this->_oConfig->getMainPrefix();
961  $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => $sAlbumUri));
962  if (!$this->isAllowedDeleteAlbum($aAlbumInfo['ID'], $aAlbumInfo)) {
963  $sMessage = _t($sLangPref . '_access_denied');
964  } else {
965  $iCount = $this->_deleteAlbumUnits($aAlbumInfo['ID']);
966  if ($iCount > 0) {
967  $sMessage = _t($sLangPref . '_album_delete_error', $iCount);
968  } else {
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/';
974  } else {
975  $sRedirect .= 'my/main/';
976  }
977  $sJQueryJS = genAjaxyPopupJS($aAlbumInfo['ID'], 'ajaxy_popup_result_div', $sRedirect);
978  }
979  }
980  header('Content-Type: text/html; charset=UTF-8');
981  echo MsgBox($sMessage) . $sJQueryJS;
982  exit;
983  }
984 
985  function actionCalendar($iYear = '', $iMonth = '')
986  {
987  $sClassName = $this->_oConfig->getClassPrefix() . 'Calendar';
988  ch_import('Calendar', $this->_aModule);
989  $oCalendar = new $sClassName($iYear, $iMonth, $this->_oDb, $this->_oTemplate, $this->_oConfig);
990  $sTitle = _t('_' . $this->_oConfig->getMainPrefix() . '_top_menu_calendar');
991  $sCode = DesignBoxContent($sTitle, $oCalendar->display(), 1);
992  $this->aPageTmpl['header'] = $sTitle;
993  $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode));
994  }
995 
1001  function actionUpload($sSelected = '')
1002  {
1003  header('Content-Type: text/html; charset=UTF-8');
1004 
1005  $sLangPref = '_' . $this->_oConfig->getMainPrefix();
1006  if (!$this->_iProfileId || !$this->isAllowedAdd()) {
1007  $sKey = _t($sLangPref . '_access_denied');
1008  echo DesignBoxContent($sKey, MsgBox($sKey), 1);
1009  exit;
1010  }
1011 
1012  $this->checkDefaultAlbums($this->_iProfileId);
1013 
1014  $aAlbumParams = array('owner' => $this->_iProfileId, 'show_empty' => true, 'hide_default' => true);
1015  $iAlbumsCount = $this->oAlbums->getAlbumCount($aAlbumParams);
1016 
1017  $aAlbums = array();
1018  if ($iAlbumsCount) {
1019  $aAlbumsList = $this->oAlbums->getAlbumList($aAlbumParams, 1, $iAlbumsCount);
1020  foreach ($aAlbumsList as $aAlbum) {
1021  $aAlbums[$aAlbum['ID']] = $aAlbum['Caption'];
1022  }
1023 
1024  if (!empty($sSelected)) {
1025  $aAlbum = $this->oAlbums->getAlbumInfo(array('fileuri' => $sSelected), array('ID', 'Uri'));
1026 
1027  $sSelected = !empty($aAlbum) && is_array($aAlbum) ? (int)$aAlbum['ID'] : '';
1028  }
1029  } else {
1030  $aDefaultAlbums = $this->_oConfig->getDefaultAlbums(true,
1031  array('{nickname}' => getUsername($this->_iProfileId)));
1032  foreach ($aDefaultAlbums as $sDefaultAlbum) {
1033  $aAlbums[$sDefaultAlbum] = $sDefaultAlbum;
1034  }
1035  }
1036 
1037  $aPrivFieldView = $this->oAlbumPrivacy->getGroupChooser($this->_iProfileId, $this->_oConfig->getUri(),
1038  'album_view', array(), _t($sLangPref . '_album_view'));
1039  $aForm = $this->getInstanceUploadFormArray($aAlbums, $aPrivFieldView);
1040  if (!empty($sSelected)) {
1041  $aForm['inputs']['albums']['value'] = $sSelected;
1042 
1043  $aForm['inputs']['title']['tr_attrs']['style'] = 'display:none';
1044  $aForm['inputs']['allow_view']['tr_attrs']['style'] = 'display:none';
1045  }
1046  $oForm = new ChTemplFormView($aForm);
1047 
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()
1052  ))
1053  ));
1054 
1055  echo $GLOBALS['oFunctions']->transBox($sCode, true);
1056  exit;
1057  }
1058 
1060  {
1061  header('Content-Type:text/javascript; charset=utf-8');
1062 
1063  $mixedAlbum = ch_get('album');
1064  if (is_numeric($mixedAlbum)) {
1065  $iAlbumId = (int)$mixedAlbum;
1066  if ($iAlbumId == 0) {
1067  $sTitle = clear_xss(ch_get('title'));
1068  if (empty($sTitle)) {
1069  echo json_encode(array('status' => 'Fail', 'error_msg' => _t('_title_min_lenght', 1)));
1070  exit;
1071  }
1072 
1073  $aNew = array(
1074  'caption' => $sTitle,
1075  'AllowAlbumView' => (int)ch_get('AllowAlbumView'),
1076  'owner' => $this->_iProfileId,
1077  );
1078  $iAlbumId = $this->oAlbums->addAlbum($aNew);
1079  }
1080 
1081  $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileid' => $iAlbumId), array('Uri', 'Owner'));
1082  if (!empty($aAlbumInfo) && $aAlbumInfo['Owner'] == $this->_iProfileId) {
1083  $mixedAlbum = $aAlbumInfo['Uri'];
1084  }
1085  } else {
1086  $mixedAlbum = uriFilter(clear_xss($mixedAlbum));
1087  }
1088 
1089  $sOwnerNick = getUsername($this->_iProfileId);
1090  echo json_encode(array('status' => 'OK', 'album_uri' => $mixedAlbum, 'owner_name' => $sOwnerNick));
1091  exit;
1092  }
1093 
1094  function isAllowedAdd($isPerformAction = false, $isNotDefineActions = false, $isCheckMemberStatus = true)
1095  {
1096  if ($this->isAdmin($this->_iProfileId)) {
1097  return true;
1098  }
1099  if (!isMember($this->_iProfileId)) {
1100  return false;
1101  }
1102  if (!$isDefineActions) {
1103  $this->_defineActions();
1104  }
1105  $aCheck = checkAction($this->_iProfileId, $this->_defineActionName('add'), $isPerformAction, 0,
1106  $isCheckMemberStatus);
1107 
1109  }
1110 
1111  function isAllowedApprove($aFile, $isPerformAction = false)
1112  {
1113  if (in_array($aFile['Approved'], array('pending', 'processing', 'failed'))) {
1114  return false;
1115  } elseif ($this->isAdmin($this->_iProfileId)) {
1116  return true;
1117  } elseif ($aFile['medProfId'] == $this->_iProfileId) {
1118  return false;
1119  }
1120 
1121  $this->_defineActions();
1122  $aCheck = checkAction($this->_iProfileId, $this->_defineActionName('approve'), $isPerformAction);
1123 
1125  }
1126 
1127  function isAllowedEdit(&$aFile, $isPerformAction = false)
1128  {
1129  if ($this->isAdmin($this->_iProfileId)) {
1130  return true;
1131  }
1132  if ($aFile['medProfId'] == $this->_iProfileId) {
1133  return true;
1134  } else {
1135  if (!isMember($this->_iProfileId)) {
1136  return false;
1137  }
1138  $this->_defineActions();
1139  $aCheck = checkAction($this->_iProfileId, $this->_defineActionName('edit'), $isPerformAction);
1140 
1142  }
1143  }
1144 
1145  function isAllowedDelete(&$aFile, $isPerformAction = false)
1146  {
1147  if ($this->isAdmin($this->_iProfileId) || $aFile['medProfId'] == $this->_iProfileId) {
1148  return true;
1149  }
1150  $this->_defineActions();
1151  $aCheck = checkAction($this->_iProfileId, $this->_defineActionName('delete'), $isPerformAction);
1153  return true;
1154  }
1155 
1156  return false;
1157  }
1158 
1159  function isAllowedDeleteAlbum($iAlbumId, $aAlbumInfo = null)
1160  {
1161  $iAlbumId = (int)$iAlbumId;
1162  if ($this->isAdmin($this->_iProfileId)) {
1163  return true;
1164  }
1165  $aAlbumInfo = is_null($aAlbumInfo) ? $this->oAlbums->getAlbumInfo(array('fileid' => $iAlbumId)) : $aAlbumInfo;
1166  if ($aAlbumInfo['Owner'] == $this->_iProfileId) {
1167  return true;
1168  }
1169 
1170  return false;
1171  }
1172 
1173  function isAllowedView(&$aFile, $isPerformAction = false)
1174  {
1175  $bAdmin = $this->isAdmin($this->_iProfileId);
1176  if ($bAdmin || $aFile['medProfId'] == $this->_iProfileId) {
1177  return true;
1178  }
1179  if (!$bAdmin && $aFile['Approved'] != 'approved') {
1180  return false;
1181  }
1182  $aOwnerInfo = getProfileInfo($aFile['medProfId']);
1183  if ($aOwnerInfo['Status'] == 'Rejected' || $aOwnerInfo['Status'] == 'Suspended') {
1184  return false;
1185  }
1186  if (!$this->oAlbumPrivacy->check('album_view', $aFile['albumId'], $this->_iProfileId)) {
1187  return false;
1188  }
1189  $this->_defineActions();
1190  $aCheck = checkAction($this->_iProfileId, $this->_defineActionName('view'), $isPerformAction);
1192  return false;
1193  }
1194 
1195  return true;
1196  }
1197 
1198  function isAdmin($iId = 0)
1199  {
1200  if (isAdmin($iId)) {
1201  return true;
1202  } else {
1203  return isModerator($iId);
1204  }
1205  }
1206 
1208  {
1209  $iFileId = (int)$iFileId;
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);
1214  ch_import('ChWsbCategories');
1215  //tags & categories parsing
1216  $oTag = new ChWsbTags();
1217  $oTag->reparseObjTags($this->_oConfig->getMainPrefix(), $iFileId);
1218  $oCateg = new ChWsbCategories();
1219  $oCateg->reparseObjTags($this->_oConfig->getMainPrefix(), $iFileId);
1220  }
1221  }
1222 
1224  {
1225  $iFileId = (int)$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);
1230  ch_import('ChWsbCategories');
1231  //tags & categories parsing
1232  $oTag = new ChWsbTags();
1233  $oTag->reparseObjTags($this->_oConfig->getMainPrefix(), $iFileId);
1234  $oCateg = new ChWsbCategories();
1235  $oCateg->reparseObjTags($this->_oConfig->getMainPrefix(), $iFileId);
1236  }
1237  }
1238 
1240  {
1241  $this->_oDb->makeFeatured($iFileId);
1242  }
1243 
1245  {
1246  $this->_oDb->makeUnFeatured($iFileId);
1247  }
1248 
1249  function checkActions()
1250  {
1251  $aActionList = $this->_oConfig->getActionArray();
1252  if (!is_array($_POST['entry'])) {
1253  return;
1254  }
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 . ');';
1259  eval($sComm);
1260  }
1261  break;
1262  }
1263  }
1264  }
1265 
1267  {
1268  $sUri = $this->_oConfig->getUri();
1269 
1270  $aAlbums = $this->_oConfig->getDefaultAlbums(true, array('{nickname}' => getUsername($iProfileId)));
1271  foreach ($aAlbums as $sAlbum) {
1272  $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => uriFilter($sAlbum), 'owner' => $iProfileId));
1273  if (!empty($aAlbumInfo) && is_array($aAlbumInfo)) {
1274  continue;
1275  }
1276 
1277  $this->oAlbums->addAlbum(array(
1278  'caption' => $sAlbum,
1279  'owner' => $iProfileId,
1280  'AllowAlbumView' => ($sAlbum == getParam('sys_album_default_name')) ? CH_WSB_PG_HIDDEN : $this->oAlbumPrivacy->_oDb->getDefaultValueModule($sUri,
1281  'album_view'),
1282  ), false);
1283  }
1284  }
1285 
1286  function getMemberList()
1287  {
1288  $sCode = '';
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";
1294  }
1295  }
1296  }
1297 
1298  return $sCode;
1299  }
1300 
1301  function getAdminMainPage(&$aMenu, $sParam = '')
1302  {
1303  $GLOBALS['oAdmTemplate']->addLocation($this->_oConfig->getUri(), $this->_oConfig->getHomePath(),
1304  $this->_oConfig->getHomeUrl());
1305  $sModPref = $this->_oConfig->getMainPrefix();
1306 
1307  $sClassName = $this->_oConfig->getClassPrefix() . 'Search';
1308  ch_import('Search', $this->_aModule);
1309  $oSearch = new $sClassName();
1310  $oSearch->clearFilters(array(), array('albumsObjects', 'albums'));
1311  $oSearch->bAdminMode = true;
1312  $oSearch->id = 1;
1313  $oSearch->aCurrent['paginate']['perPage'] = (int)getParam($sModPref . '_all_count');
1314 
1315  $aSections = $this->aSectionsAdmin;
1316  $bAjaxMode = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') ? true : false;
1317 
1318  $sParam = clear_xss($sParam);
1319  if (mb_strlen($sParam) == 0 || !isset($aSections[$sParam])) {
1320  $sParam = 'approved';
1321  }
1322 
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;
1327 
1328  // array of buttons
1329  $aBtnsArray = $this->_oConfig->getActionArray();
1330  // making search result box menu
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]);
1336  }
1337  }
1338 
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);
1342  }
1343  if (!empty($aBtnsArray)) {
1344  $aBtns = array();
1345  foreach ($aBtnsArray as $sKey => $aValue) {
1346  $aBtns[$sKey] = _t($aValue['caption']);
1347  }
1348  $sManage = $oSearch->showAdminActionsPanel($oSearch->aCurrent['name'] . '_admin_form', $aBtns);
1349  } else {
1350  $sManage = '';
1351  $oSearch->bAdminMode = false;
1352  }
1353 
1354  if ($bAjaxMode) {
1355  $oSearch->aCurrent['restriction']['activeStatus']['value'] = process_db_input($sParam, CH_TAGS_STRIP);
1356  $sPostOwner = ch_get('owner');
1357  $sOwner = $sPostOwner !== false ? process_db_input($sPostOwner,
1358  CH_TAGS_STRIP) : '';
1359  if (strlen($sOwner) > 0) {
1360  $oSearch->aCurrent['restriction']['owner']['value'] = getID($sOwner);
1361  }
1362  $sCode = $oSearch->displayResultBlock();
1363  $aCode = $this->getResultCodeArray($oSearch, $sCode);
1364  header('Content-Type: text/html; charset=UTF-8');
1365  echo $this->_oTemplate->getFilesBox($aCode);
1366  exit;
1367  }
1368  $aInputs['status'] = array('type' => 'hidden');
1369  $aUnits = array(
1370  'head' => $this->_oTemplate->getHeaderCode(),
1371  'module_prefix' => $sModPref,
1372  'search_form' => DesignBoxAdmin(_t('_' . $sModPref . '_admin'),
1373  $this->_oTemplate->getSearchForm($aInputs), $aMenu, '', 11),
1374  );
1375 
1376  $sCode = $oSearch->displayResultBlock();
1377  $aCode = $this->getResultCodeArray($oSearch, $sCode);
1378  $sCode = $this->_oTemplate->getFilesBox($aCode, 'page_block_' . $oSearch->id);
1379  $aUnits['files'] = DesignBoxAdmin(_t('_' . $sModPref), $sCode, $aSections, $sManage);
1380 
1381  return $this->_oTemplate->parseHtmlByName('media_admin.html', $aUnits);
1382  }
1383 
1385  {
1386  $iId = $this->_oDb->getSettingsCategory();
1387  if (empty($iId)) {
1388  return MsgBox(_t('_' . $this->_oConfig->getMainPrefix() . '_msg_page_not_found'));
1389  }
1390  ch_import('ChWsbAdminSettings');
1391 
1392  $mixedResult = '';
1393  if (isset($_POST['save']) && isset($_POST['cat'])) {
1395  $mixedResult = $oSettings->saveChanges($_POST);
1396  }
1397 
1399  $sResult = $oSettings->getForm();
1400 
1401  if ($mixedResult !== true && !empty($mixedResult)) {
1402  $sResult = $mixedResult . $sResult;
1403  }
1404 
1405  return DesignBoxAdmin(_t('_' . $this->_oConfig->getMainPrefix() . '_admin'),
1406  $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $sResult)), $aMenu);
1407  }
1408 
1409  function getAlbumPageView($aInfo, $sBrowseCode = '')
1410  {
1411  $sClassName = $this->_oConfig->getClassPrefix() . 'PageAlbumView';
1412  ch_import('PageAlbumView', $this->_aModule);
1413  $oAlbumPage = new $sClassName($this, $aInfo, $sBrowseCode);
1414  $sCode = $oAlbumPage->getCode();
1415  if (empty($sCode)) {
1416  $sCode = $sBrowseCode;
1417  }
1418 
1419  return $sCode;
1420  }
1421 
1422  function getAlbumPageBrowse($aParams)
1423  {
1424  list($sParamName, $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3) = $aParams;
1425  $sClassName = $this->_oConfig->getClassPrefix() . 'Search';
1426  ch_import('Search', $this->_aModule);
1427  $oSearch = new $sClassName($sParamValue, $sParamValue1, $sParamValue2, $sParamValue3);
1428  if (!empty($sParamValue) && !empty($sParamValue1) && isset($oSearch->aCurrent['restriction'][$sParamValue])) {
1429  $oSearch->aCurrent['restriction'][$sParamValue]['value'] = 'owner' == $sParamValue ? getID($sParamValue1) : $sParamValue1;
1430  }
1431 
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) {
1437  $aAdd = array($sParamName, $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3);
1438  foreach ($aAdd as $sValue) {
1439  if (strlen($sValue) > 0) {
1440  $sArg .= '/' . rawurlencode($sValue);
1441  } else {
1442  break;
1443  }
1444  }
1445  $sLink = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'albums' . $sArg;
1446  $oPaginate = new ChWsbPaginate(array(
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;'
1452  ));
1453  $sPaginate = $oPaginate->getPaginate();
1454  } else {
1455  $sCode = MsgBox(_t('_Empty'));
1456  }
1457 
1458  return DesignBoxContent(_t('_' . $this->_oConfig->getMainPrefix() . '_albums'), $sCode, 11, '', $sPaginate);
1459  }
1460 
1461  function getBlockActionsAlbum($aAlbumInfo)
1462  {
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(),
1468  );
1469 
1470  return $GLOBALS['oFunctions']->genObjectsActions($aReplacement, $sAction);
1471  }
1472 
1474  {
1475  $aPredef = array('tag', 'category');
1476 
1477  return in_array($sParamName, $aPredef) ? uri2title($sParamValue) : $sParamValue;
1478  }
1479 
1480  function getInstanceUploadAlbumTempName($aAlbums, $iAttempt = 1)
1481  {
1482  $sTemp = getLocaleDate(time());
1483  $sNewName = $iAttempt > 1 ? _t('_sys_album_caption_new', $sTemp, $iAttempt) : $sTemp;
1484  if (in_array($sNewName, $aAlbums)) {
1485  $iAttempt++;
1486  $sNewName = $this->getInstanceUploadAlbumTempName($aAlbums, $iAttempt);
1487  }
1488 
1489  return $sNewName;
1490  }
1491 
1493  $aAlbums,
1494  $aPrivFieldView,
1495  $sAlbumsCaption = false,
1496  $sAlbumTitleCaption = false,
1497  $sCreateNewAlbumCaption = false
1498  ) {
1499 
1500  $aAlbums['select'] = _t('_sys_album_select');
1501  $aAlbums[] = $sCreateNewAlbumCaption ? $sCreateNewAlbumCaption : _t('_sys_album_create_new');
1502  ksort($aAlbums);
1503 
1504  $aForm = array(
1505  'form_attrs' => array(
1506  'id' => '_' . $this->_oConfig->getMainPrefix() . '_album_form',
1507  'method' => 'post',
1508  'onSubmit' => 'return submit_quick_upload_form("' . CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . '", $(this).serialize());'
1509  ),
1510  'params' => array(
1511  'db' => array(
1512  'submit_name' => 'submit',
1513  ),
1514  'checker_helper' => 'ChSupportCheckerHelper',
1515  ),
1516  'inputs' => array(
1517  'albums' => array(
1518  'type' => 'select',
1519  'caption' => $sAlbumsCaption ? $sAlbumsCaption : _t('_sys_album'),
1520  'name' => 'album',
1521  'values' => $aAlbums,
1522  'attrs' => array(
1523  'onchange' => 'check_album_name_for_fields(this)',
1524  'id' => 'albumList',
1525  )
1526  ),
1527  'title' => array(
1528  'type' => 'text',
1529  'name' => 'title',
1530  'caption' => $sAlbumTitleCaption ? $sAlbumTitleCaption : _t('_sys_album_caption_capt'),
1531  'required' => true,
1532  'value' => $this->getInstanceUploadAlbumTempName($aAlbums),
1533  ),
1534  'allow_view' => $aPrivFieldView,
1535  'submit' => array(
1536  'type' => 'submit',
1537  'name' => 'submit',
1538  'value' => _t('_Continue'),
1539  ),
1540  ),
1541  );
1542 
1543  return $aForm;
1544  }
1545 
1546  function getResultCodeArray(&$oSearch, $sCode)
1547  {
1548  $aCode = array(
1549  'code' => MsgBox(_t('_Empty')),
1550  'paginate' => ''
1551  );
1552  $iCount = $oSearch->aCurrent['paginate']['totalNum'];
1553  if ($iCount > 0) {
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);
1559  }
1560  $aExclude = array('r');
1561  $aLinkAddon = $oSearch->getLinkAddByPrams($aExclude);
1562  $oPaginate = new ChWsbPaginate(array(
1563  'page_url' => $sLink,
1564  'count' => $iCount,
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);'
1569  ));
1570  $aCode['paginate'] = $oPaginate->getPaginate();
1571  }
1572 
1573  return $aCode;
1574  }
1575 
1576  function getSubmitForm($sFileUri, $sAction)
1577  {
1578  $aEmails = array();
1579  $sFileLink = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $sFileUri;
1580  switch ($sAction) {
1581  case 'share':
1582  $aEmails = array(
1583  'type' => 'text',
1584  'name' => 'email',
1585  'caption' => _t("_Enter email(s)"),
1586  'required' => true,
1587  'checker' => array(
1588  'func' => 'emailSet',
1589  'error' => _t("_Incorrect Email")
1590  ),
1591  );
1592  $aShareSites = array(
1593  'type' => 'custom',
1594  'colspan' => 2,
1595  'content' => $this->_oTemplate->getSitesSetBox($sFileLink),
1596  );
1597  break;
1598  case 'report':
1599  $aEmails = array(
1600  'type' => 'hidden',
1601  'name' => 'email',
1602  'value' => $GLOBALS['site']['email_notify']
1603  );
1604  $aShareSites = array(
1605  'type' => 'custom',
1606  'content' => ''
1607  );
1608  break;
1609  }
1610  $aForm = array(
1611  'form_attrs' => array(
1612  'name' => 'submitAction',
1613  'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . $sAction . '/' . $sFileUri,
1614  'method' => 'post',
1615  'onsubmit' => "return ch_ajax_form_check(this)",
1616  ),
1617  'params' => array(
1618  'db' => array(
1619  'submit_name' => 'do_submit',
1620  ),
1621  'checker_helper' => 'ChSupportCheckerHelper',
1622  ),
1623  'inputs' => array(
1624  'sites' => $aShareSites,
1625  'email' => $aEmails,
1626  'message' => array(
1627  'type' => 'textarea',
1628  'name' => 'messageText',
1629  'caption' => _t('_Message text'),
1630  'value' => '',
1631  'required' => 1,
1632  'checker' => array(
1633  'func' => 'length',
1634  'params' => array(3, 65536),
1635  'error' => _t('_td_err_incorrect_length'),
1636  ),
1637  ),
1638  array(
1639  'type' => 'input_set',
1640  0 => array(
1641  'type' => 'submit',
1642  'name' => 'send',
1643  'value' => _t('_Send')
1644  ),
1645  1 => array(
1646  'type' => 'reset',
1647  'name' => 'rest',
1648  'value' => _t('_Reset')
1649  ),
1650  ),
1651  'do_submit' => array(
1652  'type' => 'hidden',
1653  'name' => 'do_submit', // hidden submit field for AJAX submit
1654  'value' => 1,
1655  ),
1656  'fileUri' => array(
1657  'type' => 'hidden',
1658  'name' => 'fileUri',
1659  'value' => $sFileLink
1660  ),
1661  'mediaAction' => array(
1662  'type' => 'hidden',
1663  'name' => 'mediaAction',
1664  'value' => $sAction
1665  )
1666  )
1667  );
1668 
1669  return $aForm;
1670  }
1671 
1672  function processUpload($oUploader, $sAction)
1673  {
1674  $sCode = '';
1675  switch ($sAction) {
1676  case 'cancel_file':
1677  $sCode = $oUploader->serviceCancelFileInfo();
1678  break;
1679  case 'accept_file_info':
1680  $sCode = $oUploader->serviceAcceptFileInfo();
1681  break;
1682  case 'accept_multi_html5':
1683  $sCode = $oUploader->serviceAcceptHtml5FilesInfo();
1684  break;
1685  default:
1686  $sCode = $oUploader->serviceAcceptUpload($sAction);
1687  break;
1688  }
1689  echo $sCode;
1690  }
1691 
1692  function sendFileInfo($sEmail, $sMessage, $sUrl, $sType = 'share')
1693  {
1694  $aUser = getProfileInfo($this->_iProfileId);
1695  $sUrl = urldecode($sUrl);
1696  $aPlus = array(
1697  'MediaType' => _t('_' . $this->_oConfig->getMainPrefix() . '_single'),
1698  'MediaUrl' => $sUrl,
1699  'SenderNickName' => $aUser ? getNickName($aUser['ID']) : _t("_Visitor"),
1700  'UserExplanation' => $sMessage
1701  );
1702  ch_import('ChWsbEmailTemplates');
1703  $rEmailTemplate = new ChWsbEmailTemplates();
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)) {
1710  return true;
1711  }
1712  }
1713 
1714  return false;
1715  }
1716 
1718  {
1719  return $this->_oConfig->aFilesConfig;
1720  }
1721 
1723  {
1724  $iFileId = (int)$iFileId;
1725 
1726  return $this->_deleteFile($iFileId);
1727  }
1728 
1729  function serviceGetFavoriteList($iMember, $iFrom = 0, $iPerPage = 10)
1730  {
1731  return $this->_oDb->getFavorites($iMember, $iFrom, $iPerPage);
1732  }
1733 
1734  function serviceGetMemberMenuItem($sIcon = 'square-o')
1735  {
1736  $iUser = getLoggedId();
1737  $oMemberMenu = ch_instance('ChWsbMemberMenu');
1738  $aLinkInfo = array(
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),
1745  );
1746 
1747  return $oMemberMenu->getGetExtraMenuLink($aLinkInfo);
1748  }
1749 
1750  function serviceGetMemberMenuItemAddContent($sIcon = 'square-o')
1751  {
1752  if (!$this->isAllowedAdd()) {
1753  return '';
1754  }
1755  $oMemberMenu = ch_instance('ChWsbMemberMenu');
1756  $aLinkInfo = array(
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()),
1762  );
1763 
1764  return $oMemberMenu->getGetExtraMenuLink($aLinkInfo);
1765  }
1766 
1768  {
1769  $sUri = $this->_oConfig->getUri();
1770  $sPrefix = $this->_oConfig->getMainPrefix();
1771 
1772  return array(
1773  'handlers' => array(
1774  array(
1775  'alert_unit' => $sPrefix,
1776  'alert_action' => 'add',
1777  'module_uri' => $sUri,
1778  'module_class' => 'Module',
1779  'module_method' => 'get_wall_post',
1780  'groupable' => 1,
1781  'group_by' => 'album',
1782  'timeline' => 1,
1783  'outline' => 1
1784  ),
1785  array(
1786  'alert_unit' => $sPrefix,
1787  'alert_action' => 'comment_add',
1788  'module_uri' => $sUri,
1789  'module_class' => 'Module',
1790  'module_method' => 'get_wall_add_comment',
1791  'groupable' => 0,
1792  'group_by' => '',
1793  'timeline' => 1,
1794  'outline' => 0
1795  ),
1796 
1797  //DEPRICATED, saved for backward compatibility
1798  array(
1799  'alert_unit' => $sPrefix,
1800  'alert_action' => 'commentPost',
1801  'module_uri' => $sUri,
1802  'module_class' => 'Search',
1803  'module_method' => 'get_wall_post_comment',
1804  'groupable' => 0,
1805  'group_by' => '',
1806  'timeline' => 1,
1807  'outline' => 0
1808  )
1809  ),
1810  'alerts' => array(
1811  array('unit' => $sPrefix, 'action' => 'add')
1812  )
1813  );
1814  }
1815 
1816  function serviceGetWallPost($aEvent)
1817  {
1818  return $this->getWallPost($aEvent);
1819  }
1820 
1821  function serviceGetWallPostOutline($aEvent)
1822  {
1823  return $this->getWallPostOutline($aEvent);
1824  }
1825 
1826  function serviceGetWallAddComment($aEvent, $aParams = array())
1827  {
1828  $iId = (int)$aEvent['object_id'];
1829  $iOwner = (int)$aEvent['owner_id'];
1830  $sOwner = $iOwner != 0 ? getNickName($iOwner) : _t('_Anonymous');
1831 
1832  $aContent = unserialize($aEvent['content']);
1833  if (empty($aContent) || empty($aContent['object_id'])) {
1834  return '';
1835  }
1836 
1837  $sClassName = $this->_oConfig->getClassPrefix() . 'Search';
1838  ch_import('Search', $this->_aModule);
1839  $oSearch = new $sClassName();
1840 
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);
1845  }
1846 
1847  if (!$this->oAlbumPrivacy->check('album_view', (int)$aItem['album_id'], $this->_iProfileId)) {
1848  return '';
1849  }
1850 
1851  ch_import('ChTemplCmtsView');
1852  $oCmts = new ChTemplCmtsView($this->_oConfig->getMainPrefix(), $iItem);
1853  if (!$oCmts->isEnabled()) {
1854  return '';
1855  }
1856 
1857  $aComment = $oCmts->getCommentRow($iId);
1858  if (empty($aComment) || !is_array($aComment)) {
1859  return array('perform_delete' => true);
1860  }
1861 
1862  $sCss = '';
1863  $sUri = $this->_oConfig->getUri();
1864  if ($aEvent['js_mode']) {
1865  $sCss = $this->_oTemplate->addCss('wall_post.css', true);
1866  } else {
1867  $this->_oTemplate->addCss('wall_post.css');
1868  }
1869 
1870  $sTextWallObject = _t('_ch_' . $sUri . '_wall_object');
1871 
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';
1874 
1875  return array(
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'],
1892  'cnt_item_title_attr' => ch_html_attribute($aItem['title']),
1893  'cnt_item_description' => $aItem['description'],
1894  'post_id' => $aEvent['id'],
1895  ))
1896  ))
1897  );
1898  }
1899 
1900  function getWallPost($aEvent, $sIcon = 'save', $aParams = array())
1901  {
1902  $sPrefix = $this->_oConfig->getMainPrefix();
1903 
1904  $aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',',
1905  $aEvent['object_id']) : array($aEvent['object_id']);
1906  rsort($aObjectIds);
1907 
1908  $sClassName = $this->_oConfig->getClassPrefix() . 'Search';
1909  ch_import('Search', $this->_aModule);
1910  $oSearch = new $sClassName();
1911 
1912  $sItemThumbnailType = isset($aParams['thumbnail_type']) ? $aParams['thumbnail_type'] : 'browse';
1913 
1914  $iDeleted = 0;
1915  $aItems = $aTmplItems = array();
1916  foreach ($aObjectIds as $iId) {
1917  $aItem = $oSearch->serviceGetItemArray($iId, $sItemThumbnailType);
1918  if (empty($aItem)) {
1919  $iDeleted++;
1920  continue;
1921  } else {
1922  if ($aItem['status'] == 'approved' && $this->oAlbumPrivacy->check('album_view', $aItem['album_id'],
1923  $this->oModule->_iProfileId)
1924  ) {
1925  $aItems[] = $aItem;
1926  }
1927  }
1928 
1929  $aItem2x = $oSearch->serviceGetItemArray($iId, $sItemThumbnailType . '2x');
1930 
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'],
1939  ));
1940  }
1941 
1942  if ($iDeleted == count($aObjectIds)) {
1943  return array('perform_delete' => true);
1944  }
1945 
1946  $iOwner = 0;
1947  if(!empty($aEvent['owner_id']))
1948  $iOwner = (int)$aEvent['owner_id'];
1949 
1950  $iDate = 0;
1951  if(!empty($aEvent['date']))
1952  $iDate = (int)$aEvent['date'];
1953 
1954  $bItems = !empty($aItems) && is_array($aItems);
1955  if($iOwner == 0 && $bItems && !empty($aItems[0]['owner']))
1956  $iOwner = (int)$aItems[0]['owner'];
1957 
1958  if($iOwner == 0 || !$bItems)
1959  return "";
1960 
1961  $sCss = "";
1962  if ($aEvent['js_mode']) {
1963  $sCss = $this->_oTemplate->addCss(array('wall_post.css', 'wall_post_phone.css'), true);
1964  } else {
1965  $this->_oTemplate->addCss(array('wall_post.css', 'wall_post_phone.css'));
1966  }
1967 
1968  $iItems = count($aItems);
1969  $sOwner = getNickName($iOwner);
1970 
1971  //--- Grouped events
1972  if ($iItems > 1) {
1973  if ($iItems > 4) {
1974  $aItems = array_slice($aItems, 0, 4);
1975  $aTmplItems = array_slice($aTmplItems, 0, 4);
1976  }
1977 
1978  $aExtra = unserialize($aEvent['content']);
1979  $sAlbumUri = $aExtra['album'];
1980 
1981  $oAlbum = new ChWsbAlbums($sPrefix);
1982  $aAlbumInfo = $oAlbum->getAlbumInfo(array('fileUri' => $sAlbumUri, 'owner' => $iOwner));
1983 
1984  $sTemplateName = isset($aParams['templates']['grouped']) ? $aParams['templates']['grouped'] : 'modules/cheetah/wall/|timeline_post_files_grouped.html';
1985 
1986  return array(
1987  'owner_id' => $iOwner,
1988  'title' => _t('_' . $sPrefix . '_wall_added_new_items_title', $sOwner, $iItems),
1989  'description' => '',
1990  'grouped' => array(
1991  'group_id' => $aAlbumInfo['ID'],
1992  'group_cmts_name' => $sPrefix . '_albums'
1993  ),
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']
2003  )),
2004  'date' => $iDate
2005  );
2006  }
2007 
2008  $aItem = $aItems[0];
2009  $aTmplItem = $aTmplItems[0];
2010 
2011  //--- Single public event
2012  $sItemTxt = _t('_' . $sPrefix . '_wall_object');
2013  $sTemplateName = isset($aParams['templates']['single']) ? $aParams['templates']['single'] : 'modules/cheetah/wall/|timeline_post_files.html';
2014 
2015  return array(
2016  'owner_id' => $iOwner,
2017  'title' => _t('_' . $sPrefix . '_wall_added_new_title', $sOwner, $sItemTxt),
2018  'description' => $aItem['description'],
2019  'grouped' => false,
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']
2029  ))),
2030  'date' => $iDate
2031  );
2032  }
2033 
2034  function getWallPostOutline($aEvent, $sIcon = 'save', $aParams = array())
2035  {
2036  $sPrefix = $this->_oConfig->getMainPrefix();
2037  $sPrefixAlbum = $sPrefix . '_albums';
2038  $aOwner = getProfileInfo((int)$aEvent['owner_id']);
2039 
2040  $aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',',
2041  $aEvent['object_id']) : array($aEvent['object_id']);
2042  rsort($aObjectIds);
2043 
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);
2048  }
2049 
2050  $bSave = false;
2051  $aContent = array();
2052  if (!empty($aEvent['content'])) {
2053  $aContent = unserialize($aEvent['content']);
2054  }
2055 
2056  if (!isset($aContent['idims'])) {
2057  $aContent['idims'] = array();
2058  }
2059 
2060  $sClassName = $this->_oConfig->getClassPrefix() . 'Search';
2061  ch_import('Search', $this->_aModule);
2062  $oSearch = new $sClassName();
2063 
2064  $sItemThumbnailType = isset($aParams['thumbnail_type']) ? $aParams['thumbnail_type'] : 'browse';
2065 
2066  $iDeleted = 0;
2067  $aItems = $aTmplItems = array();
2068  foreach ($aObjectIds as $iId) {
2069  $aItem = $oSearch->serviceGetItemArray($iId, $sItemThumbnailType);
2070  if (empty($aItem)) {
2071  $iDeleted++;
2072  } else {
2073  if ($aItem['status'] == 'approved' && $this->oAlbumPrivacy->check('album_view', $aItem['album_id'],
2074  $this->oModule->_iProfileId)
2075  ) {
2076  if (!isset($aContent['idims'][$iId])) {
2077  $sPath = isset($aItem['file_path']) && file_exists($aItem['file_path']) ? $aItem['file_path'] : $aItem['file'];
2078  $aContent['idims'][$iId] = ChWsbImageResize::instance()->getImageSize($sPath);
2079  $bSave = true;
2080  }
2081 
2082  $aItem['dims'] = $aContent['idims'][$iId];
2083  $aItems[] = $aItem;
2084 
2085  $aItem2x = $oSearch->serviceGetItemArray($iId, $sItemThumbnailType . '2x');
2086 
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'],
2095  ));
2096  }
2097  }
2098  }
2099 
2100  if ($iDeleted == count($aObjectIds)) {
2101  return array('perform_delete' => true);
2102  }
2103 
2104  if (empty($aOwner) || empty($aItems)) {
2105  return "";
2106  }
2107 
2108  $aResult = array();
2109  if ($bSave) {
2110  $aResult['save']['content'] = serialize($aContent);
2111  }
2112 
2113  $sCss = "";
2114  if ($aEvent['js_mode']) {
2115  $sCss = $this->_oTemplate->addCss('wall_outline.css', true);
2116  } else {
2117  $this->_oTemplate->addCss('wall_outline.css');
2118  }
2119 
2120  $iOwner = (int)$aEvent['owner_id'];
2121  $sOwner = getNickName($iOwner);
2122  $sOwnerLink = getProfileLink($iOwner);
2123 
2124  //--- Grouped events
2125  $iItems = count($aItems);
2126  if ($iItems > 1) {
2127  $aExtra = unserialize($aEvent['content']);
2128  $sAlbumUri = $aExtra['album'];
2129 
2130  $oAlbum = new ChWsbAlbums($sPrefix);
2131  $aAlbumInfo = $oAlbum->getAlbumInfo(array('fileUri' => $sAlbumUri, 'owner' => $iOwner));
2132 
2133  $oAlbumCmts = new ChTemplCmtsView($sPrefixAlbum, $aAlbumInfo['ID']);
2134  $aAlbumInfo['comments_count'] = (int)$oAlbumCmts->getObjectCommentsCount();
2135  $aAlbumInfo['Url'] = $oSearch->getCurrentUrl('album', $aAlbumInfo['ID'],
2136  $aAlbumInfo['Uri']) . '/owner/' . getUsername($iOwner);
2137 
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']
2153  ));
2154 
2155  return $aResult;
2156  }
2157 
2158  //--- Single public event
2159  $aItem = $aItems[0];
2160  $aTmplItem = $aTmplItems[0];
2161 
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']
2176  )));
2177 
2178  return $aResult;
2179  }
2180 
2182  {
2183  $sModuleUri = $this->_oConfig->getUri();
2184  $AlertName = $this->_oConfig->getMainPrefix();
2185 
2186  return array(
2187  'handlers' => array(
2188  array(
2189  'alert_unit' => $AlertName,
2190  'alert_action' => 'add',
2191  'module_uri' => $sModuleUri,
2192  'module_class' => 'Module',
2193  'module_method' => 'get_spy_post'
2194  ),
2195  array(
2196  'alert_unit' => $AlertName,
2197  'alert_action' => 'rate',
2198  'module_uri' => $sModuleUri,
2199  'module_class' => 'Module',
2200  'module_method' => 'get_spy_post'
2201  ),
2202  array(
2203  'alert_unit' => $AlertName,
2204  'alert_action' => 'commentPost',
2205  'module_uri' => $sModuleUri,
2206  'module_class' => 'Module',
2207  'module_method' => 'get_spy_post'
2208  ),
2209  ),
2210  'alerts' => array(
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')
2216  )
2217  );
2218  }
2219 
2220  function serviceGetSpyPost($sAction, $iObjectId = 0, $iSenderId = 0, $aExtraParams = array())
2221  {
2222  $aRet = array();
2223  $aInfo = $this->_oDb->getFileInfo(array('fileId' => $iObjectId), true,
2224  array('medUri', 'medTitle', 'medProfId'));
2225  $aRet = array(
2226  'params' => array(
2227  'profile_link' => getProfileLink($iSenderId),
2228  'profile_nick' => getNickName($iSenderId),
2229  'entry_url' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aInfo['medUri'],
2230  'entry_caption' => $aInfo['medTitle'],
2231  'recipient_p_link' => getProfileLink($aInfo['medProfId']),
2232  'recipient_p_nick' => getNickName($aInfo['medProfId']),
2233  ),
2234  'recipient_id' => 0,
2235  );
2236  switch ($sAction) {
2237  case 'add' :
2238  $aRet['lang_key'] = '_' . $this->_oConfig->getMainPrefix() . '_spy_added';
2239  break;
2240  case 'rate' :
2241  $aRet['lang_key'] = '_' . $this->_oConfig->getMainPrefix() . '_spy_rated';
2242  $aRet['recipient_id'] = $aInfo['medProfId'];
2243  $aRet['spy_type'] = 'content_activity';
2244  break;
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';
2249  break;
2250  }
2251 
2252  return $aRet;
2253  }
2254 
2256  {
2257  if (!$iProfileId) {
2258  return false;
2259  }
2260 
2261  $aDataEntries = $this->_oDb->getFilesByAuthor($iProfileId);
2262  foreach ($aDataEntries as $iFileId) {
2263  $this->_deleteFile($iFileId);
2264  }
2265  }
2266 
2268  {
2269  if (!$iProfileId) {
2270  return false;
2271  }
2272  $aDataEntries = $this->oAlbums->getAlbumList(array(
2273  'owner' => $iProfileId,
2274  'status' => 'any',
2275  'show_empty' => true
2276  ), 0, 0, true);
2277  foreach ($aDataEntries as $aValue) {
2278  $this->oAlbums->removeAlbum($aValue['ID']);
2279  }
2280  }
2281 
2283  {
2284  if (!($iProfileId = (int)$oAlert->iObject)) {
2285  return false;
2286  }
2287 
2290 
2291  return true;
2292  }
2293 
2294  // return array with info or false result
2296  {
2297  return $this->serviceCheckAction('delete', $iFileId);
2298  }
2299 
2301  {
2302  $iFileId = (int)$iFileId;
2303  $sAction = ucfirst(strip_tags($sAction));
2304  if ($iFileId == 0 || strlen($sAction) == 0) {
2305  return false;
2306  }
2307  $aFileInfo = $this->_oDb->getFileInfo(array('fileId' => $iFileId), true,
2308  array('medID', 'medProfId', 'medExt', 'medDate', 'Approved'));
2309  if (empty($aFileInfo)) {
2310  return false;
2311  }
2312  if (!defined('CH_WSB_CRON_EXECUTE')) {
2313  $sMethodName = 'isAllowed' . $sAction;
2314  if (!method_exists($this, $sMethodName)) {
2315  return false;
2316  }
2317  if (!$this->$sMethodName($aFileInfo)) {
2318  return false;
2319  }
2320  }
2321 
2322  return $aFileInfo;
2323  }
2324 
2326  {
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);
2331  }
2332 
2333  $aActionList = array(
2334  'commentPost' => '_sbs_comments'
2335  );
2336 
2337  $sActionName = isset($aActionList[$sAction]) ? ' (' . _t('_' . $this->_oConfig->getMainPrefix() . $aActionList[$sAction]) . ')' : '';
2338 
2339  return array(
2340  'skip' => false,
2341  'template' => array(
2342  'Subscription' => $aDataEntry['medTitle'] . $sActionName,
2343  'ViewLink' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry['medUri'],
2344  ),
2345  );
2346  }
2347 
2348  // info services
2349  function serviceGetAllAlbums($iProfId, $sStatus = 'active')
2350  {
2351  $aAlbumsArray = $this->oAlbums->getAlbumList(array('owner' => $iProfId, 'status' => $sStatus));
2352  foreach ($aAlbumsArray as $aAlbum) {
2353  $aList[$aAlbum['ID']] = $aAlbum;
2354  }
2355 
2356  return $aList;
2357  }
2358 }
2359 
2360 // support classes
2362 {
2363  function checkEmailSet($sSet)
2364  {
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]*))?/",
2369  $sEmail)
2370  ) {
2371  return false;
2372  }
2373  }
2374 
2375  return true;
2376  }
2377 }
ChWsbFilesModule\actionEdit
actionEdit($iFileId)
Definition: ChWsbFilesModule.php:434
process_db_input
process_db_input($sText, $iStripTags=0)
Definition: utils.inc.php:256
header
</code > Be careful enabling this directive if you have a redirector script that does not use the< code > Location</code > HTTP header
Definition: URI.MungeResources.txt:10
$oSettings
$oSettings
Definition: advanced_settings.php:20
ChWsbFilesModule\$oAlbums
$oAlbums
Definition: ChWsbFilesModule.php:19
ChWsbFilesModule\actionBrowse
actionBrowse( $sParamName='', $sParamValue='', $sParamValue1='', $sParamValue2='', $sParamValue3='')
Definition: ChWsbFilesModule.php:313
ChSupportCheckerHelper
Definition: ChWsbFilesModule.php:2362
$sMessage
$sMessage
Definition: actions.inc.php:17
ChWsbFilesModule\getInstanceUploadAlbumTempName
getInstanceUploadAlbumTempName($aAlbums, $iAttempt=1)
Definition: ChWsbFilesModule.php:1480
$bAjaxMode
$bAjaxMode
Definition: categories.php:21
ChTemplFormView
Definition: ChTemplFormView.php:11
ChWsbFilesModule\sendFileInfo
sendFileInfo($sEmail, $sMessage, $sUrl, $sType='share')
Definition: ChWsbFilesModule.php:1692
true
if(!defined("TRUE_VAL")) define("TRUE_VAL" true
Definition: constants.inc.php:8
ChTemplTagsModule
Definition: ChTemplTagsModule.php:11
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
ChWsbFilesModule\serviceGetSpyData
serviceGetSpyData()
Definition: ChWsbFilesModule.php:2181
ChWsbFilesModule\actionFavorite
actionFavorite($iFileId)
Definition: ChWsbFilesModule.php:710
check_logged
check_logged()
Definition: admin.inc.php:238
ChWsbModule\isLogged
isLogged()
Definition: ChWsbModule.php:113
ChWsbFilesModule\getAlbumPageBrowse
getAlbumPageBrowse($aParams)
Definition: ChWsbFilesModule.php:1422
ChWsbFilesModule\_getOriginalExt
_getOriginalExt(&$aInfo, $sTmpl, $sKey='{ext}')
Definition: ChWsbFilesModule.php:158
ChWsbFilesModule\isAllowedView
isAllowedView(&$aFile, $isPerformAction=false)
Definition: ChWsbFilesModule.php:1173
ChWsbFilesModule\__construct
__construct(&$aModule)
Definition: ChWsbFilesModule.php:28
ChWsbFilesModule\serviceGetSpyPost
serviceGetSpyPost($sAction, $iObjectId=0, $iSenderId=0, $aExtraParams=array())
Definition: ChWsbFilesModule.php:2220
$sCode
$sCode
Definition: explanation.php:19
CHECK_ACTION_RESULT_ALLOWED
const CHECK_ACTION_RESULT_ALLOWED
Definition: membership_levels.inc.php:60
$sResult
$sResult
Definition: advanced_settings.php:26
ChWsbFilesModule\_deleteAlbumUnits
_deleteAlbumUnits($iAlbumId)
Definition: ChWsbFilesModule.php:143
ChWsbFilesModule\serviceGetWallData
serviceGetWallData()
Definition: ChWsbFilesModule.php:1767
$aModule
$aModule
Definition: classifieds.php:21
ChWsbFilesModule\serviceGetAllAlbums
serviceGetAllAlbums($iProfId, $sStatus='active')
Definition: ChWsbFilesModule.php:2349
ChWsbEmailTemplates
Definition: ChWsbEmailTemplates.php:11
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
$aResult
$aResult
Definition: index.php:19
ChWsbFilesModule\serviceDeleteProfileAlbums
serviceDeleteProfileAlbums($iProfileId)
Definition: ChWsbFilesModule.php:2267
ch_get
ch_get($sName)
Definition: utils.inc.php:1664
$oAlert
$oAlert
Definition: embed.php:15
CHECK_ACTION_RESULT
const CHECK_ACTION_RESULT
Definition: membership_levels.inc.php:54
sendMail
sendMail( $sRecipientEmail, $sMailSubject, $sMailBody, $iRecipientID=0, $aPlus=array(), $sEmailFlag='html', $isDisableAlert=false, $bForceSend=false)
Definition: utils.inc.php:461
ChWsbFilesModule\$_aMemActions
$_aMemActions
Definition: ChWsbFilesModule.php:21
ChWsbFilesModule\actionFeature
actionFeature($iFileId, $iFeatureId=0)
Definition: ChWsbFilesModule.php:725
ChWsbFilesModule\actionAlbumOrganize
actionAlbumOrganize($sAlbumUri)
Definition: ChWsbFilesModule.php:929
ChWsbFilesModule\getAlbumPageView
getAlbumPageView($aInfo, $sBrowseCode='')
Definition: ChWsbFilesModule.php:1409
uri2title
uri2title($sValue)
Definition: utils.inc.php:51
$sUrl
$sUrl
Definition: cart.php:15
php
CH_WSB_PG_HIDDEN
const CH_WSB_PG_HIDDEN
Definition: ChWsbPrivacy.php:17
ChWsbTags
Definition: ChWsbTags.php:15
ChWsbFilesModule\getBlockActionsAlbum
getBlockActionsAlbum($aAlbumInfo)
Definition: ChWsbFilesModule.php:1461
ChWsbVoting
Definition: ChWsbVoting.php:90
$iId
$iId
Definition: license.php:15
ChWsbFilesModule\serviceResponseProfileDelete
serviceResponseProfileDelete($oAlert)
Definition: ChWsbFilesModule.php:2282
ChWsbFilesModule\checkDefaultAlbums
checkDefaultAlbums($iProfileId)
Definition: ChWsbFilesModule.php:1266
$sMsg
$sMsg
Definition: actions.inc.php:22
ChWsbFilesModule\serviceGetWallAddComment
serviceGetWallAddComment($aEvent, $aParams=array())
Definition: ChWsbFilesModule.php:1826
ChWsbFilesModule\_defineActionName
_defineActionName($sAction)
Definition: ChWsbFilesModule.php:82
$oPage
$oPage
Definition: search_home.php:83
ChWsbFilesModule\serviceGetWallPostOutline
serviceGetWallPostOutline($aEvent)
Definition: ChWsbFilesModule.php:1821
ChSupportCheckerHelper\checkEmailSet
checkEmailSet($sSet)
Definition: ChWsbFilesModule.php:2363
$sParamValue
$sParamValue
Definition: actions.inc.php:16
ChWsbSubscription\getInstance
static getInstance()
Definition: ChWsbSubscription.php:67
ChTemplCategoriesModule
Definition: ChTemplCategoriesModule.php:11
ChWsbFilesModule\getAdminSettings
getAdminSettings(&$aMenu)
Definition: ChWsbFilesModule.php:1384
$iPerPage
else $iPerPage
Definition: browse.php:61
ChWsbFilesModule\getWallPostOutline
getWallPostOutline($aEvent, $sIcon='save', $aParams=array())
Definition: ChWsbFilesModule.php:2034
ChWsbCategories
Definition: ChWsbCategories.php:13
ChWsbFilesModule\isAllowedEdit
isAllowedEdit(&$aFile, $isPerformAction=false)
Definition: ChWsbFilesModule.php:1127
ChWsbFilesModule\actionCategories
actionCategories()
Definition: ChWsbFilesModule.php:214
ChWsbFilesModule\serviceGetSubscriptionParams
serviceGetSubscriptionParams($sAction, $iEntryId)
Definition: ChWsbFilesModule.php:2325
isLoggedActive
isLoggedActive()
Definition: profiles.inc.php:28
CATEGORIES_DIVIDER
const CATEGORIES_DIVIDER
Definition: ChWsbCategories.php:10
ChWsbFilesModule\serviceGetMemberMenuItemAddContent
serviceGetMemberMenuItemAddContent($sIcon='square-o')
Definition: ChWsbFilesModule.php:1750
isModerator
isModerator($iId=0)
Definition: profiles.inc.php:58
ch_html_attribute
ch_html_attribute($mixedInput)
Definition: utils.inc.php:1324
ChWsbFilesModule\isAllowedApprove
isAllowedApprove($aFile, $isPerformAction=false)
Definition: ChWsbFilesModule.php:1111
ChWsbCmts
Definition: ChWsbCmts.php:99
$aInfo
$aInfo
Definition: constants.inc.php:21
$oForm
$oForm
Definition: host_tools.php:42
ChWsbFilesModule\checkActions
checkActions()
Definition: ChWsbFilesModule.php:1249
ChWsbFilesModule\serviceDeleteProfileData
serviceDeleteProfileData($iProfileId)
Definition: ChWsbFilesModule.php:2255
DesignBoxAdmin
DesignBoxAdmin($sTitle, $sContent, $mixedTopItems='', $sBottomItems='', $iIndex=1)
Definition: admin_design.inc.php:50
ChWsbAlerts
Definition: ChWsbAlerts.php:39
exit
exit
Definition: cart.php:21
ChWsbFilesModule\actionAlbumReverse
actionAlbumReverse($sAlbumUri)
Definition: ChWsbFilesModule.php:935
$sType
$sType
Definition: actions.inc.php:11
$_GET
$_GET['debug']
Definition: index.php:67
ChWsbFilesModule\adminMakeFeatured
adminMakeFeatured($iFileId)
Definition: ChWsbFilesModule.php:1239
$oMemberMenu
$oMemberMenu
Definition: member_menu_queries.php:20
ChWsbImageResize\instance
static instance()
Definition: ChWsbImageResize.php:60
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
ChWsbFilesModule\serviceRemoveObject
serviceRemoveObject($iFileId)
Definition: ChWsbFilesModule.php:1722
$sParamName
$sParamName
Definition: actions.inc.php:15
getLoggedId
getLoggedId()
Definition: profiles.inc.php:32
ChWsbFilesModule\$_iProfileId
$_iProfileId
Definition: ChWsbFilesModule.php:14
ChWsbFilesModule\adminDisapproveFile
adminDisapproveFile($iFileId)
Definition: ChWsbFilesModule.php:1223
$sTitle
$sTitle
Definition: actions.inc.php:13
ChTemplCmtsView
Definition: ChTemplCmtsView.php:14
ChWsbFilesModule\actionHome
actionHome()
Definition: ChWsbFilesModule.php:203
ChWsbFilesModule\$oAlbumPrivacy
$oAlbumPrivacy
Definition: ChWsbFilesModule.php:17
getNickName
getNickName( $ID='')
Definition: profiles.inc.php:461
ChWsbAlbums
Definition: ChWsbAlbums.php:9
strmaxtextlen
strmaxtextlen($sInput, $iMaxLen=60)
Definition: utils.inc.php:207
htmlspecialchars_adv
htmlspecialchars_adv($string)
Definition: utils.inc.php:302
$sJQueryJS
$sJQueryJS
Definition: list_pop.php:32
ChWsbFilesModule
Definition: ChWsbFilesModule.php:13
ChWsbFilesModule\actionTags
actionTags()
Definition: ChWsbFilesModule.php:227
ChWsbFilesModule\_defineActionsArray
_defineActionsArray()
Definition: ChWsbFilesModule.php:66
uriFilter
uriFilter($s)
Definition: utils.inc.php:931
ch_instance
ch_instance($sClassName, $aParams=array(), $aModule=array())
Definition: utils.inc.php:1264
getUsername
getUsername( $ID='')
Definition: profiles.inc.php:443
ChWsbFilesModule\getWallPost
getWallPost($aEvent, $sIcon='save', $aParams=array())
Definition: ChWsbFilesModule.php:1900
ChWsbPaginate
Definition: ChWsbPaginate.php:69
ChWsbFilesModule\isAdmin
isAdmin($iId=0)
Definition: ChWsbFilesModule.php:1198
ChWsbFilesModule\actionAlbums
actionAlbums( $sParamName='', $sParamValue='', $sParamValue1='', $sParamValue2='', $sParamValue3='')
Definition: ChWsbFilesModule.php:788
ChWsbModule
Definition: ChWsbModule.php:41
ChWsbFilesModule\actionReport
actionReport($sFileUri)
Definition: ChWsbFilesModule.php:658
$sContent
$sContent
Definition: bottom_menu_compose.php:169
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
ChWsbFilesModule\getBrowseParam
getBrowseParam($sParamName, $sParamValue)
Definition: ChWsbFilesModule.php:1473
ChWsbFilesModule\serviceGetMemberMenuItem
serviceGetMemberMenuItem($sIcon='square-o')
Definition: ChWsbFilesModule.php:1734
time
that in the case of a Adaptation or at a minimum such credit will if a credit for all contributing authors of the Adaptation or Collection then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors For the avoidance of You may only use the credit required by this Section for the purpose of attribution in the manner set out above by exercising Your rights under this You may not implicitly or explicitly assert or imply any connection sponsorship or endorsement by the Original Licensor and or Attribution as of You or Your use of the without the express prior written permission of the Original Licensor and or Attribution Parties Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable if You Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or You must not modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author s honor or reputation Licensor agrees that in those in which any exercise of the right granted in modification or other derogatory action prejudicial to the Original Author s honor and the Licensor will waive or not as this to the fullest extent permitted by the applicable national to enable You to reasonably exercise Your right under Warranties and Disclaimer UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN LICENSOR OFFERS THE WORK AS IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE STATUTORY OR WITHOUT WARRANTIES OF FITNESS FOR A PARTICULAR OR THE ABSENCE OF LATENT OR OTHER OR THE PRESENCE OF ABSENCE OF WHETHER OR NOT DISCOVERABLE SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED SO SUCH EXCLUSION MAY NOT APPLY TO YOU Limitation on Liability EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES Termination This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License Individuals or entities who have received Adaptations or Collections from You under this will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses and will survive any termination of this License Subject to the above terms and the license granted here is Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time
Definition: license.txt:56
CH_WSB_PG_ALL
const CH_WSB_PG_ALL
Definition: ChWsbPrivacy.php:12
$iDate
$iDate
Definition: cron.php:130
ChWsbFilesModule\serviceCheckAction
serviceCheckAction($sAction, $iFileId)
Definition: ChWsbFilesModule.php:2300
getProfileLink
getProfileLink( $iID, $sLinkAdd='')
Definition: profiles.inc.php:484
CH_WSB_LOCALE_DATE_SHORT
const CH_WSB_LOCALE_DATE_SHORT
Definition: utils.inc.php:15
$aMenu
$aMenu
Definition: categories.php:257
ChWsbFilesModule\actionShare
actionShare($sFileUri)
Definition: ChWsbFilesModule.php:684
ChWsbAdminSettings
Definition: ChWsbAdminSettings.php:35
ChWsbFilesModule\actionAlbumsViewMy
actionAlbumsViewMy($sParamValue='', $sParamValue1='', $sParamValue2='', $sParamValue3='')
Definition: ChWsbFilesModule.php:830
ChWsbFilesModule\serviceGetWallPost
serviceGetWallPost($aEvent)
Definition: ChWsbFilesModule.php:1816
checkAction
checkAction($iMemberId, $actionID, $performAction=false, $iForcedProfID=0, $isCheckMemberStatus=true)
Definition: membership_levels.inc.php:313
ChWsbFilesModule\actionDelete
actionDelete($iFileId, $sAlbumUri='', $sOwnerNick='')
Definition: ChWsbFilesModule.php:766
CH_TAGS_STRIP
const CH_TAGS_STRIP
Definition: utils.inc.php:22
ChWsbFilesModule\actionRate
actionRate()
Definition: ChWsbFilesModule.php:609
ChWsbFilesModule\isAllowedDeleteAlbum
isAllowedDeleteAlbum($iAlbumId, $aAlbumInfo=null)
Definition: ChWsbFilesModule.php:1159
ChWsbFilesModule\$aSectionsAdmin
$aSectionsAdmin
Definition: ChWsbFilesModule.php:23
defineMembershipActions
defineMembershipActions($aActionsAll, $sPrefix='CH_')
Definition: membership_levels.inc.php:744
ChWsbFilesModule\actionAlbumDelete
actionAlbumDelete($sAlbumUri)
Definition: ChWsbFilesModule.php:958
$aUser
$aUser
Definition: profiles.inc.php:74
genAjaxyPopupJS
genAjaxyPopupJS($iTargetID, $sDivID='ajaxy_popup_result_div', $sRedirect='')
Definition: design.inc.php:242
process_pass_data
process_pass_data($text, $strip_tags=0)
Definition: utils.inc.php:290
default
Attr AllowedFrameTargets _parent and _top Values should be as validation will be done in a case sensitive manner despite W3C s recommendation XHTML Strict does not permit the target attribute so this directive will have no effect in that doctype XHTML does not enable the Target module by default
Definition: Attr.AllowedFrameTargets.txt:10
$iFileId
$iFileId
Definition: embed.php:12
getID
getID( $str, $with_email=1)
Definition: admin.inc.php:139
ChWsbFilesModule\actionView
actionView($sUri)
Definition: ChWsbFilesModule.php:242
getProfileInfo
getProfileInfo($iProfileID=0, $checkActiveStatus=false, $forceCache=false)
Definition: profiles.inc.php:249
ChWsbFilesModule\$aPageTmpl
$aPageTmpl
Definition: ChWsbFilesModule.php:15
ChWsbFilesModule\$oPrivacy
$oPrivacy
Definition: ChWsbFilesModule.php:16
ChWsbFilesModule\serviceGetFavoriteList
serviceGetFavoriteList($iMember, $iFrom=0, $iPerPage=10)
Definition: ChWsbFilesModule.php:1729
$aForm
$aForm
Definition: forgot.php:43
ChWsbFilesModule\_defineActions
_defineActions()
Definition: ChWsbFilesModule.php:76
ChWsbFilesModule\getSubmitForm
getSubmitForm($sFileUri, $sAction)
Definition: ChWsbFilesModule.php:1576
CH_WSB_PG_MEMBERS
const CH_WSB_PG_MEMBERS
Definition: ChWsbPrivacy.php:13
ChWsbFilesModule\processUpload
processUpload($oUploader, $sAction)
Definition: ChWsbFilesModule.php:1672
$sCaption
$sCaption
Definition: tellfriend.php:39
$iProfId
$iProfId
Definition: short_profile_info.php:22
ChWsbFilesModule\actionCalendar
actionCalendar($iYear='', $iMonth='')
Definition: ChWsbFilesModule.php:985
ChWsbFilesModule\_checkVisible
_checkVisible($aParam=array())
Definition: ChWsbFilesModule.php:56
ChWsbFilesModule\serviceCheckDelete
serviceCheckDelete($iFileId)
Definition: ChWsbFilesModule.php:2295
$sAction
$sAction
Definition: categories.php:274
ChWsbFilesModule\getResultCodeArray
getResultCodeArray(&$oSearch, $sCode)
Definition: ChWsbFilesModule.php:1546
ChWsbFormCheckerHelper
Definition: ChWsbForm.php:461
DesignBoxContent
DesignBoxContent($title, $content, $db_num=0, $caption_item='', $bottom_item='')
Definition: design.inc.php:78
ChWsbFilesModule\actionApprove
actionApprove($iFileId, $iApprove=1)
Definition: ChWsbFilesModule.php:742
ChWsbFilesModule\isAllowedDelete
isAllowedDelete(&$aFile, $isPerformAction=false)
Definition: ChWsbFilesModule.php:1145
ChWsbFilesModule\actionUpload
actionUpload($sSelected='')
Definition: ChWsbFilesModule.php:1001
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
getLocaleDate
getLocaleDate($sTimestamp='', $iCode=CH_WSB_LOCALE_DATE_SHORT)
Definition: utils.inc.php:70
ChWsbFilesModule\actionRss
actionRss($sParamName, $sParamValue, $sParamValue1, $sParamValue2)
Definition: ChWsbFilesModule.php:626
ChWsbFilesModule\serviceGetFilesConfig
serviceGetFilesConfig()
Definition: ChWsbFilesModule.php:1717
ChWsbFilesModule\isAllowedAdd
isAllowedAdd($isPerformAction=false, $isNotDefineActions=false, $isCheckMemberStatus=true)
Definition: ChWsbFilesModule.php:1094
ChWsbFilesModule\getAdminMainPage
getAdminMainPage(&$aMenu, $sParam='')
Definition: ChWsbFilesModule.php:1301
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
ChWsbFilesModule\actionAdministration
actionAdministration($sParam='', $sParam1='')
Definition: ChWsbFilesModule.php:163
ChWsbFilesModule\_deleteFile
_deleteFile($iFileId)
Definition: ChWsbFilesModule.php:89
ChWsbFilesModule\adminApproveFile
adminApproveFile($iFileId)
Definition: ChWsbFilesModule.php:1207
$sStatus
$sStatus
Definition: actions.inc.php:11
ChWsbFilesModule\getMemberList
getMemberList()
Definition: ChWsbFilesModule.php:1286
ChWsbFilesModule\getInstanceUploadFormArray
getInstanceUploadFormArray( $aAlbums, $aPrivFieldView, $sAlbumsCaption=false, $sAlbumTitleCaption=false, $sCreateNewAlbumCaption=false)
Definition: ChWsbFilesModule.php:1492
$iProfileId
if( $sMembersList) $iProfileId
Definition: communicator.php:29
ChWsbFilesModule\adminMakeUnfeatured
adminMakeUnfeatured($iFileId)
Definition: ChWsbFilesModule.php:1244
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
isMember
isMember($iId=0)
Definition: profiles.inc.php:44
clear_xss
clear_xss($val)
Definition: utils.inc.php:700
ChWsbFilesModule\actionUploadSubmit
actionUploadSubmit()
Definition: ChWsbFilesModule.php:1059
$oSubscription
$oSubscription
Definition: notifies.php:28