Cheetah
ChWsbTwigModule.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import ('ChWsbModule');
9 
14 {
16  var $_sPrefix;
18 
19  function __construct(&$aModule)
20  {
21  parent::__construct($aModule);
22  $this->_iProfileId = isLogged() ? getLoggedId() : 0;
23  }
24 
25  function _actionHome ($sTitle)
26  {
27  $this->_oTemplate->pageStart();
28  ch_import ('PageMain', $this->_aModule);
29  $sClass = $this->_aModule['class_prefix'] . 'PageMain';
30  $oPage = new $sClass ($this);
31  echo $oPage->getCode();
32  $this->_oTemplate->addCss (array('unit.css', 'main.css', 'twig.css'));
33  $this->_oTemplate->pageCode($sTitle, false, false);
34  }
35 
36  function _actionFiles ($sUri, $sTitle)
37  {
38  if (!($aDataEntry = $this->_preProductTabs($sUri, $sTitle)))
39  return;
40 
41  $aRestriction = array (
42  'id' => $this->_oDb->getMediaIds($aDataEntry[$this->_oDb->_sFieldId], 'files'),
43  );
44  if (!$aRestriction['id']) {
45  $this->_oTemplate->displayNoData ();
46  return;
47  }
48 
49  $this->_oTemplate->pageStart();
50 
51  echo ChWsbService::call ('files', 'get_browse_block', array($aRestriction, $this->_oConfig->getBaseUri() . 'files/' . $sUri), 'Search');
52 
53  $this->_oTemplate->pageCode($sTitle);
54  }
55 
56  function _actionVideos ($sUri, $sTitle)
57  {
58  if (!($aDataEntry = $this->_preProductTabs($sUri, $sTitle)))
59  return;
60 
61  $aRestriction = array (
62  'id' => $this->_oDb->getMediaIds($aDataEntry[$this->_oDb->_sFieldId], 'videos'),
63  );
64  if (!$aRestriction['id']) {
65  $this->_oTemplate->displayNoData ();
66  return;
67  }
68 
69  $this->_oTemplate->pageStart();
70 
71  echo ChWsbService::call ('videos', 'get_browse_block', array($aRestriction, $this->_oConfig->getBaseUri() . 'videos/' . $sUri), 'Search');
72 
73  $this->_oTemplate->pageCode($sTitle);
74  }
75 
76  function _actionSounds ($sUri, $sTitle)
77  {
78  if (!($aDataEntry = $this->_preProductTabs($sUri, $sTitle)))
79  return;
80 
81  $aRestriction = array (
82  'id' => $this->_oDb->getMediaIds($aDataEntry[$this->_oDb->_sFieldId], 'sounds'),
83  );
84  if (!$aRestriction['id']) {
85  $this->_oTemplate->displayNoData ();
86  return;
87  }
88 
89  $this->_oTemplate->pageStart();
90 
91  echo ChWsbService::call ('sounds', 'get_browse_block', array($aRestriction, $this->_oConfig->getBaseUri() . 'sounds/' . $sUri), 'Search');
92 
93  $this->_oTemplate->pageCode($sTitle);
94  }
95 
96  function _actionPhotos ($sUri, $sTitle)
97  {
98  if (!($aDataEntry = $this->_preProductTabs($sUri, $sTitle)))
99  return;
100 
101  $aRestriction = array (
102  'id' => $this->_oDb->getMediaIds($aDataEntry[$this->_oDb->_sFieldId], 'images'),
103  );
104  if (!$aRestriction['id']) {
105  $this->_oTemplate->displayNoData ();
106  return;
107  }
108 
109  $this->_oTemplate->pageStart();
110 
111  echo ChWsbService::call ('photos', 'get_browse_block', array($aRestriction, $this->_oConfig->getBaseUri() . 'photos/' . $sUri), 'Search');
112 
113  $this->_oTemplate->pageCode($sTitle);
114  }
115 
116  function _actionComments ($sUri, $sTitle)
117  {
118  if (!($aDataEntry = $this->_preProductTabs($sUri, $sTitle)))
119  return;
120 
121  ch_import('Cmts', $this->_aModule);
122  $sClass = $this->_aModule['class_prefix'] . 'Cmts';
123  $o = new $sClass ($this->_sPrefix, (int)$aDataEntry[$this->_oDb->_sFieldId]);
124  if (!$o->isEnabled()) {
125  $this->_oTemplate->displayPageNotFound ();
126  return;
127  }
128 
129  $sRet = $o->getCommentsFirst ();
130 
131  $this->_oTemplate->pageStart();
132 
133  echo DesignBoxContent ($sTitle, $sRet, 1);
134 
135  $this->_oTemplate->pageCode($sTitle, 0, 0);
136  }
137 
138  function _actionBrowseFans ($sUri, $sFuncAllowed, $sFuncDbGetFans, $iPerPage, $sUrlBrowse, $sTitle)
139  {
140  if (!($aDataEntry = $this->_preProductTabs($sUri, $sTitle))) {
141  return;
142  }
143 
144  if (!$this->$sFuncAllowed($aDataEntry)) {
145  $this->_oTemplate->displayAccessDenied ();
146  return;
147  }
148 
149  $iPage = (int)$_GET['page'];
150  if( $iPage < 1)
151  $iPage = 1;
152  $iStart = ($iPage - 1) * $iPerPage;
153 
154  $aProfiles = array ();
155  $iNum = $this->_oDb->$sFuncDbGetFans($aProfiles, $aDataEntry[$this->_oDb->_sFieldId], $iStart, $iPerPage);
156  if (!$iNum || !$aProfiles) {
157  $this->_oTemplate->displayNoData ();
158  return;
159  }
160  $iPages = ceil($iNum / $iPerPage);
161 
162  ch_import('ChTemplSearchProfile');
163  $oChTemplSearchProfile = new ChTemplSearchProfile();
164  $sMainContent = '';
165  foreach ($aProfiles as $aProfile) {
166  $sMainContent .= $oChTemplSearchProfile->displaySearchUnit($aProfile);
167  }
168  $sRet = $GLOBALS['oFunctions']->centerContent($sMainContent, '.searchrow_block_simple');
169  $sRet .= '<div class="clear_both"></div>';
170 
171  ch_import('ChWsbPaginate');
172  $sUrlStart = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . $sUrlBrowse . $aDataEntry[$this->_oDb->_sFieldUri];
173  $sUrlStart .= (false === strpos($sUrlStart, '?') ? '?' : '&');
174 
175  $oPaginate = new ChWsbPaginate(array(
176  'page_url' => $sUrlStart . 'page={page}&per_page={per_page}' . (false !== ch_get($this->sFilterName) ? '&' . $this->sFilterName . '=' . ch_get($this->sFilterName) : ''),
177  'count' => $iNum,
178  'per_page' => $iPerPage,
179  'page' => $iPage,
180  'on_change_per_page' => "document.location='" . $sUrlStart . "page=1&per_page=' + this.value + '" . (false !== ch_get($this->sFilterName) ? '&' . $this->sFilterName . '=' . ch_get($this->sFilterName) ."';": "';"),
181  ));
182 
183  $sRet .= $oPaginate->getPaginate();
184 
185  $this->_oTemplate->pageStart();
186 
187  echo DesignBoxContent ($sTitle, $sRet, 11);
188 
189  $this->_oTemplate->pageCode($sTitle, false, false);
190  }
191 
192  function _actionView ($sUri, $sMsgPendingApproval)
193  {
194  if (!($aDataEntry = $this->_preProductTabs($sUri)))
195  return;
196 
197  $this->_oTemplate->pageStart();
198 
199  ch_import ('PageView', $this->_aModule);
200  $sClass = $this->_aModule['class_prefix'] . 'PageView';
201  $oPage = new $sClass ($this, $aDataEntry);
202 
203  if ($aDataEntry[$this->_oDb->_sFieldStatus] == 'pending') {
204  $aVars = array ('msg' => $sMsgPendingApproval); // this product is pending approval, please wait until it will be activated
205  echo $this->_oTemplate->parseHtmlByName ('pending_approval_plank', $aVars);
206  }
207 
208  echo $oPage->getCode();
209 
210  ch_import('Cmts', $this->_aModule);
211  $sClass = $this->_aModule['class_prefix'] . 'Cmts';
212  $oCmts = new $sClass ($this->_sPrefix, 0);
213 
214  $this->_oTemplate->setPageDescription (substr(strip_tags($aDataEntry[$this->_oDb->_sFieldDescription]), 0, 255));
215  $this->_oTemplate->addPageKeywords ($aDataEntry[$this->_oDb->_sFieldTags]);
216 
217  $this->_oTemplate->addJsTranslation(array('_Are_you_sure'));
218 
219  $this->_oTemplate->addCss ('view.css');
220  $this->_oTemplate->addCss ('main.css');
221  $this->_oTemplate->addCss ('entry_view.css');
222  $this->_oTemplate->addCss ('unit_fan.css');
223  $this->_oTemplate->pageCode($aDataEntry[$this->_oDb->_sFieldTitle], false, false);
224 
225  ch_import ('ChWsbViews');
226  new ChWsbViews($this->_sPrefix, $aDataEntry[$this->_oDb->_sFieldId]);
227  }
228 
229  function _actionUploadMedia ($sUri, $sIsAllowedFuncName, $sMedia, $aMediaFields, $sTitle)
230  {
231  if (!($aDataEntry = $this->_preProductTabs($sUri, $sTitle)))
232  return;
233 
234  if (!$this->$sIsAllowedFuncName($aDataEntry)) {
235  $this->_oTemplate->displayAccessDenied ();
236  return;
237  }
238 
239  $this->_oTemplate->pageStart();
240 
241  $iEntryId = $aDataEntry[$this->_oDb->_sFieldId];
242 
243  ch_import ('FormUploadMedia', $this->_aModule);
244  $sClass = $this->_aModule['class_prefix'] . 'FormUploadMedia';
245  $oForm = new $sClass ($this, $aDataEntry[$this->_oDb->_sFieldAuthorId], $iEntryId, $aDataEntry, $sMedia, $aMediaFields);
246  $oForm->initChecker($aDataEntry);
247 
248  if ($oForm->isSubmittedAndValid ()) {
249 
250  $oForm->processMedia($iEntryId, $this->_iProfileId);
251 
252  $this->$sIsAllowedFuncName($aDataEntry, true); // perform action
253 
254  header ('Location:' . CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri]);
255  exit;
256 
257  } else {
258 
259  echo $oForm->getCode ();
260 
261  }
262 
263  $this->_oTemplate->addCss ('main.css');
264  $this->_oTemplate->addCss ('forms_extra.css');
265  $this->_oTemplate->pageCode($sTitle);
266  }
267 
268  function _actionBroadcast ($iEntryId, $sTitle, $sMsgNoRecipients, $sMsgSent)
269  {
270  $iEntryId = (int)$iEntryId;
271  if (!($aDataEntry = $this->_oDb->getEntryById($iEntryId))) {
272  $this->_oTemplate->displayPageNotFound ();
273  return;
274  }
275 
276  if (!$this->isAllowedBroadcast($aDataEntry)) {
277  $this->_oTemplate->displayAccessDenied ();
278  return;
279  }
280 
281  $this->_oTemplate->pageStart();
282 
283  $GLOBALS['oTopMenu']->setCustomSubHeader($aDataEntry[$this->_oDb->_sFieldTitle]);
284  $GLOBALS['oTopMenu']->setCustomVar($this->_sPrefix.'_view_uri', $aDataEntry[$this->_oDb->_sFieldUri]);
285  $GLOBALS['oTopMenu']->setCustomSubHeaderUrl(CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri]);
286  $GLOBALS['oTopMenu']->setCustomBreadcrumbs(array(
287  _t('_'.$this->_sPrefix) => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'home/',
288  $aDataEntry[$this->_oDb->_sFieldTitle] => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri],
289  $sTitle => '',
290  ));
291 
292  $aRecipients = $this->_oDb->getBroadcastRecipients ($iEntryId);
293  if (!$aRecipients) {
294  echo MsgBox ($sMsgNoRecipients);
295  $this->_oTemplate->pageCode($sMsgNoRecipients, true, true);
296  return;
297  }
298 
299  ch_import ('FormBroadcast', $this->_aModule);
300  $sClass = $this->_aModule['class_prefix'] . 'FormBroadcast';
301  $oForm = new $sClass ();
302  $oForm->initChecker();
303 
304  if ($oForm->isSubmittedAndValid ()) {
305 
306  $oEmailTemplate = new ChWsbEmailTemplates();
307  if (!$oEmailTemplate) {
308  $this->_oTemplate->displayErrorOccured();
309  return;
310  }
311  $aTemplate = $oEmailTemplate->getTemplate($this->_sPrefix . '_broadcast');
312  $aTemplateVars = array (
313  'BroadcastTitle' => $this->_oDb->unescape($oForm->getCleanValue ('title')),
314  'BroadcastMessage' => nl2br($this->_oDb->unescape($oForm->getCleanValue ('message'))),
315  'EntryTitle' => $aDataEntry[$this->_oDb->_sFieldTitle],
316  'EntryUrl' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri],
317  );
318  $iSentMailsCounter = 0;
319  foreach ($aRecipients as $aProfile) {
320  $iSentMailsCounter += sendMail($aProfile['Email'], $aTemplate['Subject'], $aTemplate['Body'], $aProfile['ID'], $aTemplateVars);
321  }
322  if (!$iSentMailsCounter) {
323  $this->_oTemplate->displayErrorOccured();
324  return;
325  }
326 
327  echo MsgBox ($sMsgSent);
328 
329  $this->isAllowedBroadcast($aDataEntry, true); // perform send broadcast message action
330  $this->_oTemplate->addCss ('main.css');
331  $this->_oTemplate->pageCode($sMsgSent, true, true);
332  return;
333  }
334 
335  echo $oForm->getCode ();
336 
337  $this->_oTemplate->addCss ('main.css');
338  $this->_oTemplate->pageCode($sTitle);
339  }
340 
341  function _getInviteParams ($aDataEntry, $aInviter)
342  {
343  // override this
344  return array ();
345  }
346 
347  function _actionInvite ($iEntryId, $sEmailTemplate, $iMaxEmailInvitations, $sMsgInvitationSent, $sMsgNoUsers, $sTitle)
348  {
349  $iEntryId = (int)$iEntryId;
350  if (!($aDataEntry = $this->_oDb->getEntryById($iEntryId))) {
351  $this->_oTemplate->displayPageNotFound ();
352  return;
353  }
354 
355  if (!$this->isAllowedSendInvitation ($aDataEntry)) {
356  $this->_oTemplate->displayAccessDenied ();
357  return;
358  }
359 
360  $this->_oTemplate->pageStart();
361 
362  $GLOBALS['oTopMenu']->setCustomSubHeader($aDataEntry[$this->_oDb->_sFieldTitle]);
363  $GLOBALS['oTopMenu']->setCustomVar($this->_sPrefix.'_view_uri', $aDataEntry[$this->_oDb->_sFieldUri]);
364  $GLOBALS['oTopMenu']->setCustomSubHeaderUrl(CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri]);
365  $GLOBALS['oTopMenu']->setCustomBreadcrumbs(array(
366  _t('_'.$this->_sPrefix) => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'home/',
367  $aDataEntry[$this->_oDb->_sFieldTitle] => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri],
368  $sTitle . $aDataEntry[$this->_oDb->_sFieldTitle] => '',
369  ));
370 
371  ch_import('ChWsbTwigFormInviter');
372  $oForm = new ChWsbTwigFormInviter ($this, $sMsgNoUsers);
373  $oForm->initChecker();
374 
375  if ($oForm->isSubmittedAndValid ()) {
376 
377  $aInviter = getProfileInfo($this->_iProfileId);
378  $aPlusOriginal = $this->_getInviteParams ($aDataEntry, $aInviter);
379 
380  $oEmailTemplate = new ChWsbEmailTemplates();
381  $aTemplate = $oEmailTemplate->getTemplate($sEmailTemplate);
382  $iSuccess = 0;
383 
384  // send invitation to registered members
385  if (false !== ch_get('inviter_users') && is_array(ch_get('inviter_users'))) {
386  $aInviteUsers = ch_get('inviter_users');
387  foreach ($aInviteUsers as $iRecipient) {
388  $aRecipient = getProfileInfo($iRecipient);
389  $aPlus = array_merge (array ('NickName' => ' ' . getNickName($aRecipient['ID'])), $aPlusOriginal);
390  $iSuccess += sendMail(trim($aRecipient['Email']), $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus) ? 1 : 0;
391  }
392  }
393 
394  // send invitation to additional emails
395  $iMaxCount = $iMaxEmailInvitations;
396  $aEmails = preg_split ("#[,\s\\b]+#", ch_get('inviter_emails'));
397  $aPlus = array_merge (array ('NickName' => ''), $aPlusOriginal);
398  if ($aEmails && is_array($aEmails)) {
399  foreach ($aEmails as $sEmail) {
400  if (strlen($sEmail) < 5)
401  continue;
402  $iRet = sendMail(trim($sEmail), $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus) ? 1 : 0;
403  $iSuccess += $iRet;
404  if ($iRet && 0 == --$iMaxCount)
405  break;
406  }
407  }
408 
409  $sMsg = sprintf($sMsgInvitationSent, $iSuccess);
410  echo MsgBox($sMsg);
411  $this->_oTemplate->addCss ('main.css');
412  $this->_oTemplate->pageCode ($sMsg, true, false);
413  return;
414  }
415 
416  echo $oForm->getCode ();
417  $this->_oTemplate->addCss ('main.css');
418  $this->_oTemplate->addCss ('inviter.css');
419  $this->_oTemplate->pageCode($sTitle . $aDataEntry[$this->_oDb->_sFieldTitle]);
420  }
421 
422  function _actionCalendar ($iYear, $iMonth, $sTitle)
423  {
424  $iYear = (int)$iYear;
425  $iMonth = (int)$iMonth;
426 
427  if (!$this->isAllowedBrowse()) {
428  $this->_oTemplate->displayAccessDenied ();
429  return;
430  }
431 
432  $this->_oTemplate->pageStart();
433 
434  ch_import ('Calendar', $this->_aModule);
435  $oCalendar = ch_instance ($this->_aModule['class_prefix'] . 'Calendar', array ($iYear, $iMonth, $this->_oDb, $this->_oConfig, $this->_oTemplate));
436 
437  echo $oCalendar->display();
438  $this->_oTemplate->addCss ('main.css');
439  $this->_oTemplate->pageCode($sTitle . $oCalendar->getTitle(), true, false);
440  }
441 
442  function actionBrowse ($sMode = '', $sValue = '', $sValue2 = '', $sValue3 = '')
443  {
444  if ('user' == $sMode || 'my' == $sMode) {
445  $aProfile = getProfileInfo ($this->_iProfileId);
446  if (0 === strcasecmp($sValue, $aProfile['NickName']) || 'my' == $sMode) {
447  $this->_browseMy ($aProfile);
448  return;
449  }
450  }
451 
452  if (!$this->isAllowedBrowse()) {
453  $this->_oTemplate->displayAccessDenied ();
454  return;
455  }
456  if ('tag' == $sMode || 'category' == $sMode)
457  $sValue = uri2title($sValue);
458 
459  ch_import ('SearchResult', $this->_aModule);
460  $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
462 
463  if ($o->isError) {
464  $this->_oTemplate->displayPageNotFound ();
465  return;
466  }
467 
468  if (ch_get('rss')) {
469  echo $o->rss();
470  exit;
471  }
472 
473  $this->_oTemplate->pageStart();
474 
475  if ($s = $o->processing()) {
476  echo $s;
477  } else {
478  $this->_oTemplate->displayNoData ();
479  return;
480  }
481 
482  $this->_oTemplate->addCss (array('unit.css', 'main.css', 'twig.css'));
483  $this->_oTemplate->pageCode($o->aCurrent['title'], false, false);
484  }
485 
486  function _actionSearch ($sKeyword, $sCategory, $sTitle)
487  {
488  if (!$this->isAllowedSearch()) {
489  $this->_oTemplate->displayAccessDenied ();
490  return;
491  }
492 
493  $this->_oTemplate->pageStart();
494 
495  if ($sKeyword)
496  $_GET['Keyword'] = $sKeyword;
497  if ($sCategory)
498  $_GET['Category'] = explode(',', $sCategory);
499 
500  if (is_array($_GET['Category']) && 1 == count($_GET['Category']) && !$_GET['Category'][0]) {
501  unset($_GET['Category']);
502  unset($sCategory);
503  }
504 
505  if ($sCategory || $sKeyword) {
506  $_GET['submit_form'] = 1;
507  }
508 
509  ch_import ('FormSearch', $this->_aModule);
510  $sClass = $this->_aModule['class_prefix'] . 'FormSearch';
511  $oForm = new $sClass ();
512  $oForm->initChecker();
513 
514  if ($oForm->isSubmittedAndValid ()) {
515 
516  ch_import ('SearchResult', $this->_aModule);
517  $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
518  $o = new $sClass('search', $oForm->getCleanValue('Keyword'), $oForm->getCleanValue('Category'));
519 
520  if ($o->isError) {
521  $this->_oTemplate->displayPageNotFound ();
522  return;
523  }
524 
525  if ($s = $o->processing()) {
526 
527  echo $s;
528 
529  } else {
530  $this->_oTemplate->displayNoData ();
531  return;
532  }
533 
534  $this->isAllowedSearch(true); // perform search action
535 
536  $this->_oTemplate->addCss (array('unit.css', 'main.css', 'twig.css'));
537  $this->_oTemplate->pageCode($o->aCurrent['title'], false, false);
538 
539  } else {
540 
541  echo $oForm->getCode ();
542  $this->_oTemplate->addCss ('main.css');
543  $this->_oTemplate->pageCode($sTitle);
544 
545  }
546  }
547 
548  function _actionAdd ($sTitle)
549  {
550  if (!$this->isAllowedAdd()) {
551  $this->_oTemplate->displayAccessDenied ();
552  return;
553  }
554 
555  $this->_oTemplate->pageStart();
556 
557  $this->_addForm(false);
558 
559  $this->_oTemplate->addJs ('main.js');
560  $this->_oTemplate->addCss ('main.css');
561  $this->_oTemplate->addCss ('forms_extra.css');
562  $this->_oTemplate->pageCode($sTitle);
563  }
564 
565  function _actionEdit ($iEntryId, $sTitle)
566  {
567  $iEntryId = (int)$iEntryId;
568  if (!($aDataEntry = $this->_oDb->getEntryById($iEntryId))) {
569  $this->_oTemplate->displayPageNotFound ();
570  return;
571  }
572 
573  $GLOBALS['oTopMenu']->setCustomSubHeader($aDataEntry[$this->_oDb->_sFieldTitle]);
574  $GLOBALS['oTopMenu']->setCustomVar($this->_sPrefix.'_view_uri', $aDataEntry[$this->_oDb->_sFieldUri]);
575  $GLOBALS['oTopMenu']->setCustomSubHeaderUrl(CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri]);
576  $GLOBALS['oTopMenu']->setCustomBreadcrumbs(array(
577  _t('_'.$this->_sPrefix) => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'home/',
578  $aDataEntry[$this->_oDb->_sFieldTitle] => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri],
579  $sTitle => '',
580  ));
581 
582  if (!$this->isAllowedEdit($aDataEntry)) {
583  $this->_oTemplate->displayAccessDenied ();
584  return;
585  }
586 
587  $this->_oTemplate->pageStart();
588 
589  ch_import ('FormEdit', $this->_aModule);
590  $sClass = $this->_aModule['class_prefix'] . 'FormEdit';
591  $oForm = new $sClass ($this, $aDataEntry[$this->_oDb->_sFieldAuthorId], $iEntryId, $aDataEntry);
592  if (isset($aDataEntry[$this->_oDb->_sFieldJoinConfirmation]))
593  $aDataEntry[$this->_oDb->_sFieldJoinConfirmation] = (int)$aDataEntry[$this->_oDb->_sFieldJoinConfirmation];
594 
595  $oForm->initChecker($aDataEntry);
596 
597  if ($oForm->isSubmittedAndValid ()) {
598 
599  $sStatus = $this->_oDb->getParam($this->_sPrefix . '_autoapproval') == 'on' || $this->isAdmin() ? 'approved' : 'pending';
600  $aValsAdd = array ($this->_oDb->_sFieldStatus => $sStatus);
601  if ($oForm->update ($iEntryId, $aValsAdd)) {
602 
603  $oForm->processMedia($iEntryId, $this->_iProfileId);
604 
605  $this->isAllowedEdit($aDataEntry, true); // perform action
606 
607  $this->onEventChanged ($iEntryId, $sStatus);
608  header ('Location:' . CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri]);
609  exit;
610 
611  } else {
612 
613  echo MsgBox(_t('_Error Occured'));
614 
615  }
616 
617  } else {
618 
619  echo $oForm->getCode ();
620 
621  }
622 
623  $this->_oTemplate->addJs ('main.js');
624  $this->_oTemplate->addCss ('main.css');
625  $this->_oTemplate->addCss ('forms_extra.css');
626  $this->_oTemplate->pageCode($sTitle);
627  }
628 
629  function _actionDelete ($iEntryId, $sMsgSuccess)
630  {
631  header('Content-type:text/html;charset=utf-8');
632 
633  $iEntryId = (int)$iEntryId;
634  if (!($aDataEntry = $this->_oDb->getEntryByIdAndOwner($iEntryId, $this->_iProfileId, $this->isAdmin()))) {
635  echo MsgBox(_t('_sys_request_page_not_found_cpt')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
636  exit;
637  }
638 
639  if (!$this->isAllowedDelete($aDataEntry) || 0 !== strcasecmp($_SERVER['REQUEST_METHOD'], 'POST')) {
640  echo MsgBox(_t('_Access denied')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
641  exit;
642  }
643 
644  if ($this->_oDb->deleteEntryByIdAndOwner($iEntryId, $this->_iProfileId, $this->isAdmin())) {
645  $this->isAllowedDelete($aDataEntry, true); // perform action
646  $this->onEventDeleted ($iEntryId, $aDataEntry);
647  $sRedirect = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'browse/' . ($this->_iProfileId ? 'user/' . $this->_oDb->getProfileNickNameById($this->_iProfileId) : '');
648  $sJQueryJS = genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div', $sRedirect);
649  echo MsgBox(_t($sMsgSuccess)) . $sJQueryJS;
650  exit;
651  }
652 
653  echo MsgBox(_t('_Error Occured')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
654  exit;
655  }
656 
657  function _actionMarkFeatured ($iEntryId, $sMsgSuccessAdd, $sMsgSuccessRemove)
658  {
659  header('Content-type:text/html;charset=utf-8');
660 
661  $iEntryId = (int)$iEntryId;
662  if (!($aDataEntry = $this->_oDb->getEntryByIdAndOwner($iEntryId, $this->_iProfileId, $this->isAdmin()))) {
663  echo MsgBox(_t('_sys_request_page_not_found_cpt')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
664  exit;
665  }
666 
667  if (!$this->isAllowedMarkAsFeatured($aDataEntry) || 0 !== strcasecmp($_SERVER['REQUEST_METHOD'], 'POST')) {
668  echo MsgBox(_t('_Access denied')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
669  exit;
670  }
671 
672  if ($this->_oDb->markAsFeatured($iEntryId)) {
673  $this->isAllowedMarkAsFeatured($aDataEntry, true); // perform action
674  $this->onEventMarkAsFeatured ($iEntryId, $aDataEntry);
675  $sRedirect = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri];
676  $sJQueryJS = genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div', $sRedirect);
677  echo MsgBox($aDataEntry[$this->_oDb->_sFieldFeatured] ? $sMsgSuccessRemove : $sMsgSuccessAdd) . $sJQueryJS;
678  exit;
679  }
680 
681  echo MsgBox(_t('_Error Occured')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
682  exit;
683  }
684 
685  function _actionJoin ($iEntryId, $iProfileId, $sMsgAlreadyJoined, $sMsgAlreadyJoinedPending, $sMsgJoinSuccess, $sMsgJoinSuccessPending, $sMsgLeaveSuccess)
686  {
687  header('Content-type:text/html;charset=utf-8');
688 
689  $iEntryId = (int)$iEntryId;
690  if (!($aDataEntry = $this->_oDb->getEntryByIdAndOwner($iEntryId, 0, true))) {
691  echo MsgBox(_t('_sys_request_page_not_found_cpt')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
692  exit;
693  }
694 
695  if (!$this->isAllowedJoin($aDataEntry) || 0 !== strcasecmp($_SERVER['REQUEST_METHOD'], 'POST')) {
696  echo MsgBox(_t('_Access denied')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
697  exit;
698  }
699 
700  $isFan = $this->_oDb->isFan ($iEntryId, $this->_iProfileId, true) || $this->_oDb->isFan ($iEntryId, $this->_iProfileId, false);
701 
702  if ($isFan) {
703 
704  if ($this->_oDb->leaveEntry($iEntryId, $this->_iProfileId)) {
705  $this->_onEventFanRemove($iEntryId, $this->_iProfileId, $aDataEntry, '');
706 
707  $sRedirect = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri];
708  echo MsgBox($sMsgLeaveSuccess) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div', $sRedirect);
709  exit;
710  }
711 
712  } else {
713 
714  $isConfirmed = ($this->isEntryAdmin($aDataEntry) || !$aDataEntry[$this->_oDb->_sFieldJoinConfirmation] ? true : false);
715 
716  if ($this->_oDb->joinEntry($iEntryId, $this->_iProfileId, $isConfirmed)) {
717  if ($isConfirmed) {
718  $this->onEventJoin ($iEntryId, $this->_iProfileId, $aDataEntry);
719  $sRedirect = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri];
720  } else {
721  $this->onEventJoinRequest ($iEntryId, $this->_iProfileId, $aDataEntry);
722  $sRedirect = '';
723  }
724  echo MsgBox($isConfirmed ? $sMsgJoinSuccess : $sMsgJoinSuccessPending) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div', $sRedirect);
725  exit;
726  }
727  }
728 
729  echo MsgBox(_t('_Error Occured')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
730  exit;
731  }
732 
733  function actionActivate ($iEntryId)
734  {
735  header('Content-type:text/html;charset=utf-8');
736 
737  $iEntryId = (int)$iEntryId;
738  if (!($aDataEntry = $this->_oDb->getEntryByIdAndOwner($iEntryId, 0, true))) {
739  echo MsgBox(_t('_sys_request_page_not_found_cpt')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
740  exit;
741  }
742 
743  if (!$this->isAllowedActivate($aDataEntry) || 0 !== strcasecmp($_SERVER['REQUEST_METHOD'], 'POST')) {
744  echo MsgBox(_t('_Access denied')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
745  exit;
746  }
747 
748  if ($this->_oDb->activateEntry($iEntryId)) {
749  $this->isAllowedActivate($aDataEntry, true);
750  $sRedirect = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri];
751  echo MsgBox(_t('_Success')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div', $sRedirect);
752  exit;
753  }
754 
755  echo MsgBox(_t('_Error Occured')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
756  exit;
757  }
758 
759  function _actionManageFansPopup ($iEntryId, $sTitle, $sFuncGetFans = 'getFans', $sFuncIsAllowedManageFans = 'isAllowedManageFans', $sFuncIsAllowedManageAdmins = 'isAllowedManageAdmins', $iMaxFans = 1000)
760  {
761  header('Content-type:text/html;charset=utf-8');
762 
763  $iEntryId = (int)$iEntryId;
764  if (!($aDataEntry = $this->_oDb->getEntryByIdAndOwner ($iEntryId, 0, true))) {
765  echo $GLOBALS['oFunctions']->transBox(MsgBox(_t('_Empty')));
766  exit;
767  }
768 
769  if (!$this->$sFuncIsAllowedManageFans($aDataEntry)) {
770  echo $GLOBALS['oFunctions']->transBox(MsgBox(_t('_Access denied')));
771  exit;
772  }
773 
774  $aProfiles = array ();
775  $iNum = $this->_oDb->$sFuncGetFans($aProfiles, $iEntryId, true, 0, $iMaxFans);
776  if (!$iNum) {
777  echo $GLOBALS['oFunctions']->transBox(MsgBox(_t('_Empty')));
778  exit;
779  }
780 
781  $sActionsUrl = ch_append_url_params(CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . "view/" . $aDataEntry[$this->_oDb->_sFieldUri], 'ajax_action=');
782  $aButtons = array (
783  array (
784  'type' => 'submit',
785  'name' => 'fans_remove',
786  'value' => _t('_sys_btn_fans_remove'),
787  'onclick' => "onclick=\"getHtmlData('sys_manage_items_manage_fans_content', '{$sActionsUrl}remove&ids=' + sys_manage_items_get_manage_fans_ids(), false, 'post'); return false;\"",
788  ),
789  );
790 
791  if ($this->$sFuncIsAllowedManageAdmins($aDataEntry)) {
792 
793  $aButtons = array_merge($aButtons, array (
794  array (
795  'type' => 'submit',
796  'name' => 'fans_add_to_admins',
797  'value' => _t('_sys_btn_fans_add_to_admins'),
798  'onclick' => "onclick=\"getHtmlData('sys_manage_items_manage_fans_content', '{$sActionsUrl}add_to_admins&ids=' + sys_manage_items_get_manage_fans_ids(), false, 'post'); return false;\"",
799  ),
800  array (
801  'type' => 'submit',
802  'name' => 'fans_move_admins_to_fans',
803  'value' => _t('_sys_btn_fans_move_admins_to_fans'),
804  'onclick' => "onclick=\"getHtmlData('sys_manage_items_manage_fans_content', '{$sActionsUrl}admins_to_fans&ids=' + sys_manage_items_get_manage_fans_ids(), false, 'post'); return false;\"",
805  ),
806  ));
807  };
808  ch_import ('ChTemplSearchResult');
809  $sControl = ChTemplSearchResult::showAdminActionsPanel('sys_manage_items_manage_fans', $aButtons, 'sys_fan_unit');
810 
811  $aVarsContent = array (
812  'suffix' => 'manage_fans',
813  'content' => $this->_profilesEdit($aProfiles, false, $aDataEntry),
814  'control' => $sControl,
815  );
816  $aVarsPopup = array (
817  'title' => $sTitle,
818  'content' => $this->_oTemplate->parseHtmlByName('manage_items_form', $aVarsContent),
819  );
820  echo $GLOBALS['oFunctions']->transBox($this->_oTemplate->parseHtmlByName('popup', $aVarsPopup), true);
821  exit;
822  }
823 
824  function _actionSharePopup ($iEntryId, $sTitle, $bAddTempleateExt = false)
825  {
826  header('Content-type:text/html;charset=utf-8');
827 
828  $iEntryId = (int)$iEntryId;
829  if (!($aDataEntry = $this->_oDb->getEntryByIdAndOwner ($iEntryId, 0, true))) {
830  echo MsgBox(_t('_Empty'));
831  exit;
832  }
833 
834  $sEntryUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri];
835 
836  require_once (CH_DIRECTORY_PATH_INC . "shared_sites.inc.php");
837  echo getSitesHtml($sEntryUrl, $sTitle);
838  exit;
839  }
840 
841  function _actionTags($sTitle, $sTitleAllTags = '')
842  {
843  ch_import('ChTemplTagsModule');
844  $aParam = array(
845  'type' => $this->_sPrefix,
846  'orderby' => 'popular'
847  );
848  $oTags = new ChTemplTagsModule($aParam, $sTitleAllTags, CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'tags');
849  $this->_oTemplate->pageStart();
850  echo $oTags->getCode();
851  $this->_oTemplate->pageCode($sTitle, false, false);
852  }
853 
855  {
856  ch_import('ChTemplCategoriesModule');
857  $aParam = array(
858  'type' => $this->_sPrefix
859  );
860  $oCateg = new ChTemplCategoriesModule($aParam, _t('_categ_users'), CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'categories');
861  $this->_oTemplate->pageStart();
862  echo $oCateg->getCode();
863  $this->_oTemplate->pageCode($sTitle, false, false);
864  }
865 
866  function _actionDownload ($aFileInfo, $sFieldMediaId)
867  {
868  $aFile = ChWsbService::call('files', 'get_file_array', array($aFileInfo[$sFieldMediaId]), 'Search');
869  if (!$aFile['date']) {
870  $this->_oTemplate->displayPageNotFound ();
871  exit;
872  }
873  $aFile['full_name'] = uriFilter($aFile['title']) . '.' . $aFile['extension'];
874  $aPathInfo = pathinfo ($aFile['path']);
875  header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
876  header ("Content-type: " . $aFile['mime_type']);
877  header ("Content-Length: " . filesize ($aFile['path']));
878  header ("Content-Disposition: attachment; filename={$aFile['full_name']}");
879  readfile ($aFile['path']);
880  exit;
881  }
882 
883  // ================================== external actions
884 
886  {
887  $iMemberId = (int)$iMemberId;
888  $iForumId = (int)$iForumId;
889 
890  $aFalse = array (
891  'admin' => 0,
892  'read' => 0,
893  'post' => 0,
894  );
895 
896  if (!($aForum = $this->_oDb->getForumById ($iForumId)))
897  return $aFalse;
898 
899  if (!($aDataEntry = $this->_oDb->getEntryById ($aForum['entry_id'])))
900  return $aFalse;
901 
902  $aTrue = array (
903  'admin' => $aDataEntry[$this->_oDb->_sFieldAuthorId] == $iMemberId || $this->isAdmin() ? 1 : 0, // author is admin
904  'read' => $this->isAllowedReadForum ($aDataEntry, $iMemberId) ? 1 : 0,
905  'post' => $this->isAllowedPostInForum ($aDataEntry, $iMemberId) ? 1 : 0,
906  );
907 
908  return $aTrue;
909  }
910 
912  {
913  $iProfileId = (int)$iProfileId;
914 
915  if (!$iProfileId)
916  return false;
917 
918  // delete entries which belongs to particular author
919  $aDataEntries = $this->_oDb->getEntriesByAuthor ($iProfileId);
920  foreach ($aDataEntries as $iEntryId) {
921  if ($this->_oDb->deleteEntryByIdAndOwner($iEntryId, $iProfileId, false))
922  $this->onEventDeleted ($iEntryId);
923  }
924 
925  // delete from list of fans/admins
926  $this->_oDb->removeFanFromAllEntries ($iProfileId);
927  $this->_oDb->removeAdminFromAllEntries ($iProfileId);
928  }
929 
931  {
932  if (!($iProfileId = (int)$oAlert->iObject))
933  return false;
934 
936 
937  return true;
938  }
939 
941  {
942  $iMediaId = (int)$oAlert->iObject;
943  if (!$iMediaId)
944  return false;
945 
946  switch ($oAlert->sUnit) {
947  case 'ch_videos':
948  $sMediaType = 'videos';
949  break;
950  case 'ch_sounds':
951  $sMediaType = 'sounds';
952  break;
953  case 'ch_photos':
954  $sMediaType = 'images';
955  break;
956  case 'ch_files':
957  $sMediaType = 'files';
958  break;
959  default:
960  return false;
961  }
962 
963  return $this->_oDb->deleteMediaFile ($iMediaId, $sMediaType);
964  }
965 
966  function _serviceGetMemberMenuItem ($sTitle, $sAlt, $sIcon, $isExtraCount = true, $sLinkAppend = '')
967  {
968  if (!$this->_iProfileId)
969  return '';
970 
971  $oMemberMenu = ch_instance('ChWsbMemberMenu');
972 
973  $aLinkInfo = array(
974  'item_img_src' => $sIcon,
975  'item_img_alt' => $sAlt,
976  'item_link' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'browse/my/' . $sLinkAppend,
977  'item_title' => $sTitle,
978  'extra_info' => $isExtraCount ? $this->_oDb->getCountByAuthorAndStatus($this->_iProfileId, 'approved') + $this->_oDb->getCountByAuthorAndStatus($this->_iProfileId, 'pending') : '',
979  );
980 
981  return $oMemberMenu -> getGetExtraMenuLink($aLinkInfo);
982  }
983 
984  function _serviceGetWallPost ($aEvent, &$aParams)
985  {
986  if (!($aProfile = getProfileInfo($aEvent['owner_id'])))
987  return '';
988 
989  $aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',', $aEvent['object_id']) : array($aEvent['object_id']);
990  rsort($aObjectIds);
991 
992  $iDeleted = 0;
993  $aItems = array();
994  foreach($aObjectIds as $iId) {
995  $aItem = $this->_oDb->getEntryByIdAndOwner($iId, $aEvent['owner_id'], 1);
996  if(empty($aItem))
997  $iDeleted++;
998  if($aItem[$this->_oDb->_sFieldStatus] == 'approved' && $aParams['obj_privacy']->check($aParams['txt_privacy_view_event'], $iId, $this->_iProfileId))
999  $aItems[] = $aItem;
1000  }
1001 
1002  if($iDeleted == count($aObjectIds))
1003  return array('perform_delete' => true);
1004 
1005  $iOwner = 0;
1006  if(!empty($aEvent['owner_id']))
1007  $iOwner = (int)$aEvent['owner_id'];
1008 
1009  $iDate = 0;
1010  if(!empty($aEvent['date']))
1011  $iDate = (int)$aEvent['date'];
1012 
1013  $bItems = !empty($aItems) && is_array($aItems);
1014  if($iOwner == 0 && $bItems && isset($aParams['fields']['owner']) && !empty($aItems[0][$aParams['fields']['owner']]))
1015  $iOwner = (int)$aItems[0][$aParams['fields']['owner']];
1016 
1017  if($iDate == 0 && $bItems && isset($aParams['fields']['date']) && !empty($aItems[0][$aParams['fields']['date']]))
1018  $iDate = (int)$aItems[0][$aParams['fields']['date']];
1019 
1020  if($iOwner == 0 || empty($aItems))
1021  return '';
1022 
1023  $sCss = '';
1024  $sCssPrefix = str_replace('_', '-', $this->_sPrefix);
1025  $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/';
1026  if($aEvent['js_mode'])
1027  $sCss = $this->_oTemplate->addCss(array('wall_post.css', 'unit.css', 'twig.css'), true);
1028  else
1029  $this->_oTemplate->addCss(array('wall_post.css', 'unit.css', 'twig.css'));
1030 
1031  $iItems = count($aItems);
1032  $sOwner = getNickName($iOwner);
1033 
1034  ch_import('Voting', $this->_aModule);
1035  $sClass = $this->_aModule['class_prefix'] . 'Voting';
1036  $oVoting = new $sClass ($this->_sPrefix, 0, 0);
1037 
1038  //--- Grouped events
1039  if($iItems > 1) {
1040  if($iItems > 4)
1041  $aItems = array_slice($aItems, 0, 4);
1042 
1043  $aTmplItems = array();
1044  foreach($aItems as $aItem)
1045  $aTmplItems[] = array(
1046  'unit' => $this->_oTemplate->unit($aItem, 'unit', $oVoting, true),
1047  );
1048 
1049  $sTmplName = isset($aParams['templates']['grouped']) ? $aParams['templates']['grouped'] : 'modules/cheetah/wall/|timeline_post_twig_grouped.html';
1050  return array(
1051  'owner_id' => $iOwner,
1052  'title' => _t($aParams['txt_added_new_title_plural'], $sOwner, $iItems),
1053  'description' => '',
1054  'content' => $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array(
1055  'mod_prefix' => $sCssPrefix,
1056  'mod_icon' => $aParams['icon'],
1057  'cpt_user_name' => $sOwner,
1058  'cpt_added_new' => _t($aParams['txt_added_new_plural'], $iItems),
1059  'ch_repeat:items' => $aTmplItems,
1060  )),
1061  'date' => $iDate
1062  );
1063  }
1064 
1065  //--- Single public event
1066  $aItem = $aItems[0];
1067 
1068  $sTextWallObject = _t($aParams['txt_object']);
1069 
1070  $sTmplName = isset($aParams['templates']['single']) ? $aParams['templates']['single'] : 'modules/cheetah/wall/|timeline_post_twig.html';
1071  return array(
1072  'owner_id' => $iOwner,
1073  'title' => _t($aParams['txt_added_new_title_single'], $sOwner, $sTextWallObject),
1074  'description' => $aItem[$this->_oDb->_sFieldDescription],
1075  'content' => $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array(
1076  'mod_prefix' => $sCssPrefix,
1077  'mod_icon' => $aParams['icon'],
1078  'cpt_user_name' => $sOwner,
1079  'cpt_added_new' => _t($aParams['txt_added_new_single']),
1080  'cpt_object' => $sTextWallObject,
1081  'cpt_item_url' => $sBaseUrl . $aItem[$this->_oDb->_sFieldUri],
1082  'content' => $this->_oTemplate->unit($aItem, 'unit', $oVoting, true),
1083  )),
1084  'date' => $iDate
1085  );
1086  }
1087 
1088  function _serviceGetWallPostOutline($aEvent, $sIcon, $aParams = array())
1089  {
1090  $iNoPhotoWidth = $iNoPhotoHeight = 140;
1091  $sNoPhoto = $this->_oTemplate->getImageUrl('no-image-thumb.png');
1092  $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/';
1093 
1094  $aOwner = db_assoc_arr("SELECT `ID` AS `id`, `NickName` AS `username` FROM `Profiles` WHERE `ID`='" . (int)$aEvent['owner_id'] . "' LIMIT 1");
1095 
1096  $aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',', $aEvent['object_id']) : array($aEvent['object_id']);
1097  rsort($aObjectIds);
1098 
1099  $iItems = count($aObjectIds);
1100  $iItemsLimit = isset($aParams['grouped']['items_limit']) ? (int)$aParams['grouped']['items_limit'] : 3;
1101  if($iItems > $iItemsLimit)
1102  $aObjectIds = array_slice($aObjectIds, 0, $iItemsLimit);
1103 
1104  $bSave = false;
1105  $aContent = array();
1106  if(!empty($aEvent['content']))
1107  $aContent = unserialize($aEvent['content']);
1108 
1109  if(!isset($aContent['idims']))
1110  $aContent['idims'] = array();
1111 
1112  $iDeleted = 0;
1113  $aItems = $aTmplItems = array();
1114  foreach($aObjectIds as $iId) {
1115  $aItem = $this->_oDb->getEntryByIdAndOwner($iId, $aEvent['owner_id'], 1);
1116  if(empty($aItem))
1117  $iDeleted++;
1118  else if($aItem[$this->_oDb->_sFieldStatus] == 'approved' && $aParams['obj_privacy']->check($aParams['txt_privacy_view_event'], $iId, $this->_iProfileId)) {
1119  $aItem['thumb_file'] = '';
1120  $aItem['thumb_dims'] = array();
1121  if($aItem[$this->_oDb->_sFieldThumb]) {
1122  $aImage = ChWsbService::call('photos', 'get_entry', array($aItem[$this->_oDb->_sFieldThumb], 'browse'), 'Search');
1123  if(!empty($aImage)) {
1124  if(!isset($aContent['idims'][$iId])) {
1125  $sPath = isset($aImage['file_path']) && file_exists($aImage['file_path']) ? $aImage['file_path'] : $aImage['file'];
1126  $aContent['idims'][$iId] = ChWsbImageResize::instance()->getImageSize($sPath);
1127  $bSave = true;
1128  }
1129 
1130  $aItem['thumb_file'] = $aImage['file'];
1131  $aItem['thumb_dims'] = $aContent['idims'][$iId];
1132  }
1133 
1134  $aImage = ChWsbService::call('photos', 'get_entry', array($aItem[$this->_oDb->_sFieldThumb], 'browse2x'), 'Search');
1135  $aItem['thumb_file_2x'] = !empty($aImage) ? $aImage['file'] : $aItem['thumb_file'];
1136  }
1137 
1138  $aItem[$this->_oDb->_sFieldUri] = $sBaseUrl . $aItem[$this->_oDb->_sFieldUri];
1139  $aItems[] = $aItem;
1140 
1141  $aTmplItems[] = array(
1142  'mod_prefix' => $this->_sPrefix,
1143  'item_width' => isset($aItem['thumb_dims']['w']) ? $aItem['thumb_dims']['w'] : $iNoPhotoWidth,
1144  'item_height' => isset($aItem['thumb_dims']['h']) ? $aItem['thumb_dims']['h'] : $iNoPhotoHeight,
1145  'item_icon' => !empty($aItem['thumb_file']) ? $aItem['thumb_file'] : $sNoPhoto,
1146  'item_icon_2x' => !empty($aItem['thumb_file_2x']) ? $aItem['thumb_file_2x'] : $sNoPhoto,
1147  'item_page' => $aItem[$this->_oDb->_sFieldUri],
1148  'item_title' => $aItem[$this->_oDb->_sFieldTitle]
1149  );
1150  }
1151  }
1152 
1153  if($iDeleted == count($aObjectIds))
1154  return array('perform_delete' => true);
1155 
1156  if(empty($aOwner) || empty($aItems))
1157  return "";
1158 
1159  $aResult = array();
1160  if($bSave)
1161  $aResult['save']['content'] = serialize($aContent);
1162 
1163  $sCss = "";
1164  if($aEvent['js_mode'])
1165  $sCss = $this->_oTemplate->addCss('wall_outline.css', true);
1166  else
1167  $this->_oTemplate->addCss('wall_outline.css');
1168 
1169  $iOwner = (int)$aEvent['owner_id'];
1170  $sOwner = getNickName($iOwner);
1171  $sOwnerLink = getProfileLink($iOwner);
1172 
1173  //--- Grouped events
1174  $iItems = count($aItems);
1175  if($iItems > 1) {
1176  $sTmplName = isset($aParams['templates']['grouped']) ? $aParams['templates']['grouped'] : 'modules/cheetah/wall/|outline_item_image_grouped';
1177  $aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array(
1178  'mod_prefix' => $this->_sPrefix,
1179  'mod_icon' => $sIcon,
1180  'user_name' => $sOwner,
1181  'user_link' => $sOwnerLink,
1182  'ch_repeat:items' => $aTmplItems,
1183  'album_url' => '',
1184  'album_title' => '',
1185  'album_description' => '',
1186  'album_comments' => 0 ? _t('_wall_n_comments', 0) : _t('_wall_no_comments'),
1187  'album_comments_link' => '',
1188  'post_id' => $aEvent['id'],
1189  'post_ago' => $aEvent['ago']
1190  ));
1191 
1192  return $aResult;
1193  }
1194 
1195  //--- Single public event
1196  $aItem = $aItems[0];
1197  $aTmplItem = $aTmplItems[0];
1198 
1199  $sTmplName = isset($aParams['templates']['single']) ? $aParams['templates']['single'] : 'modules/cheetah/wall/|outline_item_image';
1200  $aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array_merge($aTmplItem, array(
1201  'mod_prefix' => $this->_sPrefix,
1202  'mod_icon' => $sIcon,
1203  'user_name' => $sOwner,
1204  'user_link' => $sOwnerLink,
1205  'item_page' => $aItem[$this->_oDb->_sFieldUri],
1206  'item_title' => $aItem[$this->_oDb->_sFieldTitle],
1207  'item_description' => $this->_formatSnippetTextForOutline($aItem),
1208  'item_comments' => (int)$aItem[$this->_oDb->_sFieldCommentCount] > 0 ? _t('_wall_n_comments', $aItem[$this->_oDb->_sFieldCommentCount]) : _t('_wall_no_comments'),
1209  'item_comments_link' => $aItem[$this->_oDb->_sFieldUri] . '#cmta-' . $this->_sPrefix . '-' . $aItem[$this->_oDb->_sFieldId],
1210  'post_id' => $aEvent['id'],
1211  'post_ago' => $aEvent['ago']
1212  )));
1213 
1214  return $aResult;
1215  }
1216 
1217  function _serviceGetWallAddComment($aEvent, $aParams)
1218  {
1219  $iId = (int)$aEvent['object_id'];
1220  $iOwner = (int)$aEvent['owner_id'];
1221  $sOwner = $iOwner != 0 ? getNickName($iOwner) : _t('_Anonymous');
1222 
1223  $aContent = unserialize($aEvent['content']);
1224  if(empty($aContent) || empty($aContent['object_id']))
1225  return '';
1226 
1227  $iItem = (int)$aContent['object_id'];
1228  $aItem = $this->_oDb->getEntryByIdAndOwner($iItem, $iOwner, 1);
1229  if(empty($aItem) || !is_array($aItem))
1230  return array('perform_delete' => true);
1231 
1232  if(!$aParams['obj_privacy']->check($aParams['txt_privacy_view_event'], $iItem, $this->_iProfileId))
1233  return '';
1234 
1235  ch_import('Cmts', $this->_aModule);
1236  $sClass = $this->_aModule['class_prefix'] . 'Cmts';
1237  $oCmts = new $sClass($this->_sPrefix, $iItem);
1238  if(!$oCmts->isEnabled())
1239  return '';
1240 
1241  $aComment = $oCmts->getCommentRow($iId);
1242  if(empty($aComment) || !is_array($aComment))
1243  return array('perform_delete' => true);
1244 
1245  $sImage = '';
1246  if($aItem[$this->_oDb->_sFieldThumb]) {
1247  $a = array('ID' => $aItem[$this->_oDb->_sFieldAuthorId], 'Avatar' => $aItem[$this->_oDb->_sFieldThumb]);
1248  $aImage = ChWsbService::call('photos', 'get_image', array($a, 'browse'), 'Search');
1249  $sImage = $aImage['no_image'] ? '' : $aImage['file'];
1250  }
1251 
1252  $sCss = '';
1253  $sCssPrefix = str_replace('_', '-', $this->_sPrefix);
1254  $sUri = $this->_oConfig->getUri();
1255  $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/';
1256  $sNoPhoto = $this->_oTemplate->getIconUrl('no-photo.png');
1257  if($aEvent['js_mode'])
1258  $sCss = $this->_oTemplate->addCss(array('wall_post.css', 'unit.css', 'twig.css'), true);
1259  else
1260  $this->_oTemplate->addCss(array('wall_post.css', 'unit.css', 'twig.css'));
1261 
1262  ch_import('Voting', $this->_aModule);
1263  $sClass = $this->_aModule['class_prefix'] . 'Voting';
1264  $oVoting = new $sClass ($this->_sPrefix, 0, 0);
1265 
1266  $sTextWallObject = _t('_ch_' . $sUri . '_wall_object');
1267 
1268  $sTmplName = isset($aParams['templates']['main']) ? $aParams['templates']['main'] : 'modules/cheetah/wall/|timeline_comment.html';
1269  return array(
1270  'title' => _t('_ch_' . $sUri . '_wall_added_new_title_comment', $sOwner, $sTextWallObject),
1271  'description' => $aComment['cmt_text'],
1272  'content' => $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array(
1273  'mod_prefix' => $sCssPrefix,
1274  'cpt_user_name' => $sOwner,
1275  'cpt_added_new' => _t('_ch_' . $sUri . '_wall_added_new_comment'),
1276  'cpt_object' => $sTextWallObject,
1277  'cpt_item_url' => $sBaseUrl . $aItem[$this->_oDb->_sFieldUri],
1278  'cnt_comment_text' => $aComment['cmt_text'],
1279  'snippet' => $this->_oTemplate->unit($aItem, 'unit', $oVoting)
1280  ))
1281  );
1282  }
1283 
1287  function _serviceGetWallPostComment($aEvent, $aParams)
1288  {
1289  $iId = (int)$aEvent['object_id'];
1290  $iOwner = (int)$aEvent['owner_id'];
1291  $sOwner = getNickName($iOwner);
1292 
1293  $aItem = $this->_oDb->getEntryByIdAndOwner($iId, $iOwner, 1);
1294  if(empty($aItem) || !is_array($aItem))
1295  return array('perform_delete' => true);
1296 
1297  if(!$aParams['obj_privacy']->check($aParams['txt_privacy_view_event'], $iId, $this->_iProfileId))
1298  return '';
1299 
1300  $aContent = unserialize($aEvent['content']);
1301  if(empty($aContent) || !isset($aContent['comment_id']))
1302  return '';
1303 
1304  ch_import('Cmts', $this->_aModule);
1305  $sClass = $this->_aModule['class_prefix'] . 'Cmts';
1306  $oCmts = new $sClass($this->_sPrefix, $iId);
1307  if(!$oCmts->isEnabled())
1308  return '';
1309 
1310  $aComment = $oCmts->getCommentRow((int)$aContent['comment_id']);
1311  if(empty($aComment) || !is_array($aComment))
1312  return array('perform_delete' => true);
1313 
1314  $sImage = '';
1315  if($aItem[$this->_oDb->_sFieldThumb]) {
1316  $a = array('ID' => $aItem[$this->_oDb->_sFieldAuthorId], 'Avatar' => $aItem[$this->_oDb->_sFieldThumb]);
1317  $aImage = ChWsbService::call('photos', 'get_image', array($a, 'browse'), 'Search');
1318  $sImage = $aImage['no_image'] ? '' : $aImage['file'];
1319  }
1320 
1321  $sCss = '';
1322  $sLangPrefix = '_' . trim($this->_oConfig->getDbPrefix(), '_');
1323  $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/';
1324  $sNoPhoto = $this->_oTemplate->getIconUrl('no-photo.png');
1325  if($aEvent['js_mode'])
1326  $sCss = $this->_oTemplate->addCss(array('wall_post.css', 'unit.css', 'twig.css'), true);
1327  else
1328  $this->_oTemplate->addCss(array('wall_post.css', 'unit.css', 'twig.css'));
1329 
1330  ch_import('Voting', $this->_aModule);
1331  $sClass = $this->_aModule['class_prefix'] . 'Voting';
1332  $oVoting = new $sClass ($this->_sPrefix, 0, 0);
1333 
1334  $sTextWallObject = _t($sLangPrefix . '_wall_object');
1335 
1336  $sTmplName = isset($aParams['templates']['main']) ? $aParams['templates']['main'] : 'modules/cheetah/wall/|timeline_comment.html';
1337  return array(
1338  'title' => _t($sLangPrefix . '_wall_added_new_title_comment', $sOwner, $sTextWallObject),
1339  'description' => $aComment['cmt_text'],
1340  'content' => $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array(
1341  'mod_prefix' => $this->_sPrefix,
1342  'cpt_user_name' => $sOwner,
1343  'cpt_added_new' => _t($sLangPrefix . '_wall_added_new_comment'),
1344  'cpt_object' => $sTextWallObject,
1345  'cpt_item_url' => $sBaseUrl . $aItem[$this->_oDb->_sFieldUri],
1346  'cnt_comment_text' => $aComment['cmt_text'],
1347  'snippet' => $this->_oTemplate->unit($aItem, 'unit', $oVoting)
1348  ))
1349  );
1350  }
1351 
1353  {
1354  return array(
1355  'handlers' => array(
1356  array('alert_unit' => $this->_sPrefix, 'alert_action' => 'add', 'module_uri' => $this->_aModule['uri'], 'module_class' => 'Module', 'module_method' => 'get_wall_post', 'groupable' => 0, 'group_by' => '', 'timeline' => 1, 'outline' => 1),
1357  array('alert_unit' => $this->_sPrefix, 'alert_action' => 'comment_add', 'module_uri' => $this->_aModule['uri'], 'module_class' => 'Module', 'module_method' => 'get_wall_add_comment', 'groupable' => 0, 'group_by' => '', 'timeline' => 1, 'outline' => 0),
1358 
1359  //DEPRICATED, saved for backward compatibility
1360  array('alert_unit' => $this->_sPrefix, 'alert_action' => 'commentPost', 'module_uri' => $this->_aModule['uri'], 'module_class' => 'Module', 'module_method' => 'get_wall_post_comment', 'groupable' => 0, 'group_by' => '', 'timeline' => 1, 'outline' => 0)
1361  ),
1362  'alerts' => array(
1363  array('unit' => $this->_sPrefix, 'action' => 'add')
1364  )
1365  );
1366  }
1367 
1368  function _serviceGetSpyPost($sAction, $iObjectId, $iSenderId, $aExtraParams, $aLangKeys)
1369  {
1370  $aProfile = getProfileInfo($iSenderId);
1371  if (!($aDataEntry = $this->_oDb->getEntryByIdAndOwner ($iObjectId, 0, true)))
1372  return array();
1373  if (empty($aLangKeys[$sAction]))
1374  return array();
1375 
1376  return array(
1377  'lang_key' => $aLangKeys[$sAction],
1378  'params' => array(
1379  'profile_link' => $aProfile ? getProfileLink($iSenderId) : 'javascript:void(0)',
1380  'profile_nick' => $aProfile ? getNickName($aProfile['ID']) : _t('_Guest'),
1381  'entry_url' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri],
1382  'entry_title' => $aDataEntry[$this->_oDb->_sFieldTitle],
1383  ),
1384  'recipient_id' => $aDataEntry[$this->_oDb->_sFieldAuthorId],
1385  'spy_type' => 'content_activity',
1386  );
1387  }
1388 
1389  function serviceGetSpyData ()
1390  {
1391  return array(
1392  'handlers' => array(
1393  array('alert_unit' => $this->_sPrefix, 'alert_action' => 'add', 'module_uri' => $this->_aModule['uri'], 'module_class' => 'Module', 'module_method' => 'get_spy_post'),
1394  array('alert_unit' => $this->_sPrefix, 'alert_action' => 'change', 'module_uri' => $this->_aModule['uri'], 'module_class' => 'Module', 'module_method' => 'get_spy_post'),
1395  array('alert_unit' => $this->_sPrefix, 'alert_action' => 'join', 'module_uri' => $this->_aModule['uri'], 'module_class' => 'Module', 'module_method' => 'get_spy_post'),
1396  array('alert_unit' => $this->_sPrefix, 'alert_action' => 'rate', 'module_uri' => $this->_aModule['uri'], 'module_class' => 'Module', 'module_method' => 'get_spy_post'),
1397  array('alert_unit' => $this->_sPrefix, 'alert_action' => 'commentPost', 'module_uri' => $this->_aModule['uri'], 'module_class' => 'Module', 'module_method' => 'get_spy_post'),
1398  ),
1399  'alerts' => array(
1400  array('unit' => $this->_sPrefix, 'action' => 'add'),
1401  array('unit' => $this->_sPrefix, 'action' => 'change'),
1402  array('unit' => $this->_sPrefix, 'action' => 'join'),
1403  array('unit' => $this->_sPrefix, 'action' => 'rate'),
1404  array('unit' => $this->_sPrefix, 'action' => 'delete'),
1405  array('unit' => $this->_sPrefix, 'action' => 'commentPost'),
1406  array('unit' => $this->_sPrefix, 'action' => 'commentRemoved')
1407  )
1408  );
1409  }
1410 
1412  {
1413  if (!$this->_oDb->_sTableShoutbox)
1414  return false;
1415 
1416  return array(
1417  array(
1418  'name' => $this->_sPrefix,
1419  'title' => $this->getTitleKey($this->_aModule['uri']),
1420  'table' => $this->_oDb->_sPrefix . $this->_oDb->_sTableShoutbox,
1421  'code_allow_use' => method_exists($this, 'isFan') ? 'return ChWsbService::call("' . $this->_aModule['uri'] . '", "is_fan", array($iHandler));' : '',
1422  'code_allow_delete' => method_exists($this, 'isEntryAdmin') ? 'return ChWsbService::call("' . $this->_aModule['uri'] . '", "is_entry_admin", array($iHandler));' : '',
1423  'code_allow_block' => '',
1424  ),
1425  );
1426  }
1427 
1428  function serviceIsFan($iEntryId, $iProfileId = 0)
1429  {
1430  return $this->_serviceIsSomebody('isFan', $iEntryId, $iProfileId);
1431  }
1432 
1433  function serviceIsEntryAdmin($iEntryId, $iProfileId = 0)
1434  {
1435  return $this->_serviceIsSomebody('isEntryAdmin', $iEntryId, $iProfileId);
1436  }
1437 
1438  function _serviceIsSomebody($sFunc, $iEntryId, $iProfileId = 0)
1439  {
1440  if (!method_exists($this, $sFunc))
1441  return false;
1442  if (!$iProfileId)
1444 
1445  if (!($aDataEntry = $this->_oDb->getEntryByIdAndOwner ($iEntryId, 0, true)))
1446  return false;
1447 
1448  return $this->$sFunc($aDataEntry, $iProfileId);
1449  }
1450 
1451  function _serviceGetSubscriptionParams ($sAction, $iEntryId, $aAction2Name)
1452  {
1453  if (!($aDataEntry = $this->_oDb->getEntryByIdAndOwner ($iEntryId, 0, true)) || $aDataEntry[$this->_oDb->_sFieldStatus] != 'approved') {
1454  return array('skip' => true);
1455  }
1456 
1457  if (isset($aAction2Name[$sAction]))
1458  $sActionName = $aAction2Name[$sAction];
1459  else
1460  $sActionName = '';
1461 
1462  return array (
1463  'skip' => false,
1464  'template' => array (
1465  'Subscription' => $aDataEntry[$this->_oDb->_sFieldTitle] . ($sActionName ? ' (' . $sActionName . ')' : ''),
1466  'EntryTitle' => $aDataEntry[$this->_oDb->_sFieldTitle],
1467  'ActionName' => $sActionName,
1468  'ViewLink' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri],
1469  ),
1470  );
1471  }
1472 
1473  // ================================== admin actions
1474 
1475  function _actionAdministrationSettings ($sSettingsCatName = '')
1476  {
1477  if (!preg_match('/^[A-Za-z0-9_-]+$/', $sSettingsCatName))
1478  return MsgBox(_t('_sys_request_page_not_found_cpt'));
1479 
1480  $iId = $this->_oDb->getSettingsCategory($sSettingsCatName);
1481  if(empty($iId))
1482  return MsgBox(_t('_sys_request_page_not_found_cpt'));
1483 
1484  ch_import('ChWsbAdminSettings');
1485 
1486  $mixedResult = '';
1487  if(isset($_POST['save']) && isset($_POST['cat'])) {
1489  $mixedResult = $oSettings->saveChanges($_POST);
1490  }
1491 
1493  $sResult = $oSettings->getForm();
1494 
1495  if($mixedResult !== true && !empty($mixedResult))
1496  $sResult = $mixedResult . $sResult;
1497 
1498  $aVars = array (
1499  'content' => $sResult,
1500  );
1501  return $this->_oTemplate->parseHtmlByName('default_padding', $aVars);
1502  }
1503 
1504  function _actionAdministrationManage ($isAdminEntries, $sKeyBtnDelete = '', $sKeyBtnActivate = '', $sUrl = false)
1505  {
1506  if (getPostFieldIfSet('action_activate') && (isset($_POST['entry']) && is_array($_POST['entry']))) {
1507 
1508  foreach ($_POST['entry'] as $iId) {
1509  if ($this->_oDb->activateEntry($iId)) {
1510  $this->onEventChanged ($iId, 'approved');
1511  }
1512  }
1513 
1514  } elseif (getPostFieldIfSet('action_delete') && (isset($_POST['entry']) && is_array($_POST['entry']))) {
1515 
1516  foreach ($_POST['entry'] as $iId) {
1517 
1518  $aDataEntry = $this->_oDb->getEntryById($iId);
1519  if (!$this->isAllowedDelete($aDataEntry))
1520  continue;
1521 
1522  if ($this->_oDb->deleteEntryByIdAndOwner($iId, 0, $this->isAdmin())) {
1523  $this->onEventDeleted ($iId);
1524  }
1525  }
1526  }
1527 
1528  if ($isAdminEntries) {
1529  $sContent = $this->_manageEntries ('admin', '', true, 'ch_twig_admin_form', array(
1530  'action_delete' => $sKeyBtnDelete,
1531  ), '', true, 0, $sUrl);
1532  } else {
1533  $sContent = $this->_manageEntries ('pending', '', true, 'ch_twig_admin_form', array(
1534  'action_activate' => $sKeyBtnActivate,
1535  'action_delete' => $sKeyBtnDelete,
1536  ), '', true, 0, $sUrl);
1537  }
1538 
1539  return $sContent;
1540  }
1541 
1543  {
1544  if (!$this->isAllowedAdd()) {
1545  $this->_oTemplate->displayAccessDenied ();
1546  return;
1547  }
1548 
1549  ob_start();
1550  $this->_addForm(CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/admin_entries');
1551  $aVars = array (
1552  'content' => ob_get_clean(),
1553  );
1554  return $this->_oTemplate->parseHtmlByName('default_padding', $aVars);
1555  }
1556 
1557  // ================================== tags/cats reparse functions
1558 
1559  function reparseTags ($iEntryId)
1560  {
1561  $iEntryId = (int)$iEntryId;
1562  ch_import('ChWsbTags');
1563  $o = new ChWsbTags ();
1564  $o->reparseObjTags($this->_sPrefix, $iEntryId);
1565  }
1566 
1567  function reparseCategories ($iEntryId)
1568  {
1569  $iEntryId = (int)$iEntryId;
1570  ch_import('ChWsbCategories');
1571  $o = new ChWsbCategories ();
1572  $o->reparseObjTags($this->_sPrefix, $iEntryId);
1573  }
1574 
1575  // ================================== events
1576 
1577  function onEventCreate ($iEntryId, $sStatus, $aDataEntry = array())
1578  {
1579  if ('approved' == $sStatus) {
1580  $this->reparseTags ($iEntryId);
1581  $this->reparseCategories ($iEntryId);
1582  }
1583 
1584  if (ChWsbModule::getInstance('ChWmapModule'))
1585  ChWsbService::call('wmap', 'response_entry_add', array($this->_oConfig->getUri(), $iEntryId));
1586 
1587  $this->_oDb->createForum ($aDataEntry, $this->_oDb->getProfileNickNameById($this->_iProfileId));
1588  $oAlert = new ChWsbAlerts($this->_sPrefix, 'add', $iEntryId, $this->_iProfileId, array('Status' => $sStatus));
1589  $oAlert->alert();
1590  }
1591 
1592  function onEventChanged ($iEntryId, $sStatus)
1593  {
1594  $this->reparseTags ($iEntryId);
1595  $this->reparseCategories ($iEntryId);
1596 
1597  if (ChWsbModule::getInstance('ChWmapModule'))
1598  ChWsbService::call('wmap', 'response_entry_change', array($this->_oConfig->getUri(), $iEntryId));
1599 
1600  $oAlert = new ChWsbAlerts($this->_sPrefix, 'change', $iEntryId, $this->_iProfileId, array('Status' => $sStatus));
1601  $oAlert->alert();
1602  }
1603 
1604  function onEventDeleted ($iEntryId, $aDataEntry = array())
1605  {
1606  // delete associated tags and categories
1607  $this->reparseTags ($iEntryId);
1608  $this->reparseCategories ($iEntryId);
1609 
1610  // delete votings
1611  ch_import('Voting', $this->_aModule);
1612  $sClass = $this->_aModule['class_prefix'] . 'Voting';
1613  $oVoting = new $sClass ($this->_sPrefix, 0, 0);
1614  $oVoting->deleteVotings ($iEntryId);
1615 
1616  // delete comments
1617  ch_import('Cmts', $this->_aModule);
1618  $sClass = $this->_aModule['class_prefix'] . 'Cmts';
1619  $oCmts = new $sClass ($this->_sPrefix, $iEntryId);
1620  $oCmts->onObjectDelete ();
1621 
1622  // delete views
1623  ch_import ('ChWsbViews');
1624  $oViews = new ChWsbViews($this->_sPrefix, $iEntryId, false);
1625  $oViews->onObjectDelete();
1626 
1627  // delete forum
1628  $this->_oDb->deleteForum ($iEntryId);
1629 
1630  // delete associated locations
1631  if (ChWsbModule::getInstance('ChWmapModule'))
1632  ChWsbService::call('wmap', 'response_entry_delete', array($this->_oConfig->getUri(), $iEntryId));
1633 
1634  // delete all subscriptions
1636  $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => $this->_sPrefix, 'object_id' => $iEntryId));
1637 
1638  // arise alert
1639  $oAlert = new ChWsbAlerts($this->_sPrefix, 'delete', $iEntryId, $this->_iProfileId);
1640  $oAlert->alert();
1641  }
1642 
1643  function onEventMarkAsFeatured ($iEntryId, $aDataEntry)
1644  {
1645  // arise alert
1646  $oAlert = new ChWsbAlerts($this->_sPrefix, 'mark_as_featured', $iEntryId, $this->_iProfileId, array('Featured' => $aDataEntry[$this->_oDb->_sFieldFeatured]));
1647  $oAlert->alert();
1648  }
1649 
1650  function onEventJoin ($iEntryId, $iProfileId, $aDataEntry)
1651  {
1652  // we do not need to send any notofication mail here because it will be part of standard subscription process
1653  $oAlert = new ChWsbAlerts($this->_sPrefix, 'join', $iEntryId, $iProfileId);
1654  $oAlert->alert();
1655 
1656  ch_import('ChWsbSubscription');
1658  $oSubscription->subscribeMember($iProfileId, $this->_sPrefix, '', $iEntryId);
1659  }
1660 
1661  function _onEventJoinRequest ($iEntryId, $iProfileId, $aDataEntry, $sEmailTemplate, $iMaxFans = 1000)
1662  {
1663  $iNum = $this->_oDb->getAdmins($aGroupAdmins, $iEntryId, 0, $iMaxFans);
1664  $aGroupAdmins[] = getProfileInfo($aDataEntry[$this->_oDb->_sFieldAuthorId]);
1665  foreach ($aGroupAdmins as $aProfile)
1666  $this->_notifyEmail ($sEmailTemplate, $aProfile['ID'], $aDataEntry);
1667 
1668  $oAlert = new ChWsbAlerts($this->_sPrefix, 'join_request', $iEntryId, $iProfileId);
1669  $oAlert->alert();
1670  }
1671 
1672  function _onEventJoinReject ($iEntryId, $iProfileId, $aDataEntry, $sEmailTemplate)
1673  {
1674  $this->_notifyEmail ($sEmailTemplate, $iProfileId, $aDataEntry);
1675  $oAlert = new ChWsbAlerts($this->_sPrefix, 'join_reject', $iEntryId, $iProfileId);
1676  $oAlert->alert();
1677  }
1678 
1679  function _onEventFanRemove ($iEntryId, $iProfileId, $aDataEntry, $sEmailTemplate)
1680  {
1681  if ($sEmailTemplate)
1682  $this->_notifyEmail ($sEmailTemplate, $iProfileId, $aDataEntry);
1683 
1684  $oAlert = new ChWsbAlerts($this->_sPrefix, 'fan_remove', $iEntryId, $iProfileId);
1685  $oAlert->alert();
1686 
1687  ch_import('ChWsbSubscription');
1689  $oSubscription->unsubscribeMember($iProfileId, $this->_sPrefix, '', $iEntryId);
1690  }
1691 
1692  function _onEventFanBecomeAdmin ($iEntryId, $iProfileId, $aDataEntry, $sEmailTemplate)
1693  {
1694  $this->_notifyEmail ($sEmailTemplate, $iProfileId, $aDataEntry);
1695  $oAlert = new ChWsbAlerts($this->_sPrefix, 'fan_become_admin', $iEntryId, $iProfileId);
1696  $oAlert->alert();
1697  }
1698 
1699  function _onEventAdminBecomeFan ($iEntryId, $iProfileId, $aDataEntry, $sEmailTemplate)
1700  {
1701  $this->_notifyEmail ($sEmailTemplate, $iProfileId, $aDataEntry);
1702  $oAlert = new ChWsbAlerts($this->_sPrefix, 'admin_become_fan', $iEntryId, $iProfileId);
1703  $oAlert->alert();
1704  }
1705 
1706  function _onEventJoinConfirm ($iEntryId, $iProfileId, $aDataEntry, $sEmailTemplate)
1707  {
1708  $this->_notifyEmail ($sEmailTemplate, $iProfileId, $aDataEntry);
1709  $oAlert = new ChWsbAlerts($this->_sPrefix, 'join_confirm', $iEntryId, $iProfileId);
1710  $oAlert->alert();
1711  }
1712 
1713  // ================================== other function
1714 
1715  function isAdmin ()
1716  {
1717  return $GLOBALS['logged']['admin'] && isProfileActive($this->_iProfileId);
1718  }
1719 
1720  function _addForm ($sRedirectUrl)
1721  {
1722  ch_import ('FormAdd', $this->_aModule);
1723  $sClass = $this->_aModule['class_prefix'] . 'FormAdd';
1724  $oForm = new $sClass ($this, $this->_iProfileId);
1725  $oForm->initChecker();
1726 
1727  if ($oForm->isSubmittedAndValid ()) {
1728 
1729  $sStatus = $this->_oDb->getParam($this->_sPrefix.'_autoapproval') == 'on' || $this->isAdmin() ? 'approved' : 'pending';
1730  $aValsAdd = array (
1731  $this->_oDb->_sFieldCreated => time(),
1732  $this->_oDb->_sFieldUri => $oForm->generateUri(),
1733  $this->_oDb->_sFieldStatus => $sStatus,
1734  );
1735  $aValsAdd[$this->_oDb->_sFieldAuthorId] = $this->_iProfileId;
1736 
1737  $iEntryId = $oForm->insert ($aValsAdd);
1738 
1739  if ($iEntryId) {
1740 
1741  $this->isAllowedAdd(true); // perform action
1742 
1743  $oForm->processMedia($iEntryId, $this->_iProfileId);
1744 
1745  $aDataEntry = $this->_oDb->getEntryByIdAndOwner($iEntryId, $this->_iProfileId, $this->isAdmin());
1746  $this->onEventCreate($iEntryId, $sStatus, $aDataEntry);
1747  if (!$sRedirectUrl)
1748  $sRedirectUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri];
1749  header ('Location:' . $sRedirectUrl);
1750  exit;
1751 
1752  } else {
1753 
1754  MsgBox(_t('_Error Occured'));
1755  }
1756 
1757  } else {
1758 
1759  echo $oForm->getCode ();
1760 
1761  }
1762  }
1763 
1764  function _manageEntries ($sMode, $sValue, $isFilter, $sFormName, $aButtons, $sAjaxPaginationBlockId = '', $isMsgBoxIfEmpty = true, $iPerPage = 0, $sUrlAdmin = false)
1765  {
1766  ch_import ('SearchResult', $this->_aModule);
1767  $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
1768  $o = new $sClass($sMode, $sValue);
1769  $o->sUnitTemplate = 'unit_admin';
1770 
1771  if ($iPerPage)
1772  $o->aCurrent['paginate']['perPage'] = $iPerPage;
1773 
1774  $sPagination = $sActionsPanel = '';
1775  if ($o->isError) {
1776  $sContent = MsgBox(_t('_Error Occured'));
1777  } elseif (!($sContent = $o->displayResultBlock())) {
1778  if ($isMsgBoxIfEmpty)
1779  $sContent = MsgBox(_t('_Empty'));
1780  else
1781  return '';
1782  } else {
1783  $sPagination = $sAjaxPaginationBlockId ? $o->showPaginationAjax($sAjaxPaginationBlockId) : $o->showPagination(array('url_admin' => $sUrlAdmin));
1784  $sActionsPanel = $o->showAdminActionsPanel ($sFormName, $aButtons);
1785  }
1786 
1787  $aVars = array (
1788  'form_name' => $sFormName,
1789  'content' => $sContent,
1790  'pagination' => $sPagination,
1791  'filter_panel' => $isFilter ? $o->showAdminFilterPanel(false !== ch_get($this->_sFilterName) ? ch_get($this->_sFilterName) : '', 'filter_input_id', 'filter_checkbox_id', $this->_sFilterName) : '',
1792  'actions_panel' => $sActionsPanel,
1793  );
1794  return $this->_oTemplate->parseHtmlByName ('manage', $aVars);
1795  }
1796 
1797  function _preProductTabs ($sUri, $sSubTab = '')
1798  {
1799  if ($GLOBALS['oTemplConfig']->bAllowUnicodeInPreg)
1800  $sReg = '/^[\pL\pN\-_]+$/u'; // unicode characters
1801  else
1802  $sReg = '/^[\d\w\-_]+$/u'; // latin characters only
1803 
1804  if (!preg_match($sReg, $sUri)) {
1805  $this->_oTemplate->displayPageNotFound ();
1806  return false;
1807  }
1808 
1809  if (!($aDataEntry = $this->_oDb->getEntryByUri($sUri))) {
1810  $this->_oTemplate->displayPageNotFound ();
1811  return false;
1812  }
1813 
1814  if ($aDataEntry[$this->_oDb->_sFieldStatus] == 'pending' && !$this->isAdmin() && !($aDataEntry[$this->_oDb->_sFieldAuthorId] == $this->_iProfileId && $aDataEntry[$this->_oDb->_sFieldAuthorId])) {
1815  $this->_oTemplate->displayPageNotFound ();
1816  return false;
1817  }
1818 
1819  $GLOBALS['oTopMenu']->setCustomSubHeader($aDataEntry[$this->_oDb->_sFieldTitle]);
1820  $GLOBALS['oTopMenu']->setCustomVar($this->_sPrefix.'_view_uri', $aDataEntry[$this->_oDb->_sFieldUri]);
1821  $GLOBALS['oTopMenu']->setCustomSubHeaderUrl(CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri]);
1822  $GLOBALS['oTopMenu']->setCustomBreadcrumbs(array(
1823  _t('_'.$this->_sPrefix) => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'home/',
1824  $aDataEntry[$this->_oDb->_sFieldTitle] => $sSubTab ? CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri] : '',
1825  $sSubTab => '',
1826  ));
1827 
1828  if ((!$this->_iProfileId || $aDataEntry[$this->_oDb->_sFieldAuthorId] != $this->_iProfileId) && !$this->isAllowedView($aDataEntry, true)) {
1829  $this->_oTemplate->displayAccessDenied ();
1830  return false;
1831  }
1832 
1833  return $aDataEntry;
1834  }
1835 
1836  function _processFansActions ($aDataEntry, $iMaxFans = 1000)
1837  {
1838  header('Content-type:text/html;charset=utf-8');
1839 
1840  if (false !== ch_get('ajax_action') && $this->isAllowedManageFans($aDataEntry) && 0 === strcasecmp($_SERVER['REQUEST_METHOD'], 'POST')) {
1841 
1842  $iEntryId = $aDataEntry[$this->_oDb->_sFieldId];
1843  $aIds = array ();
1844  if (false !== ch_get('ids'))
1845  $aIds = $this->_getCleanIdsArray (ch_get('ids'));
1846 
1847  $isShowConfirmedFansOnly = false;
1848  switch (ch_get('ajax_action')) {
1849  case 'remove':
1850  $isShowConfirmedFansOnly = true;
1851  if ($this->_oDb->removeFans($iEntryId, $aIds)) {
1852  foreach ($aIds as $iProfileId)
1853  $this->onEventFanRemove ($iEntryId, $iProfileId, $aDataEntry);
1854  }
1855  break;
1856  case 'add_to_admins':
1857  $isShowConfirmedFansOnly = true;
1858  if ($this->isAllowedManageAdmins($aDataEntry) && $this->_oDb->addGroupAdmin($iEntryId, $aIds)) {
1859  $aProfiles = array ();
1860  $iNum = $this->_oDb->getAdmins($aProfiles, $iEntryId, 0, $iMaxFans, $aIds);
1861  foreach ($aProfiles as $aProfile)
1862  $this->onEventFanBecomeAdmin ($iEntryId, $aProfile['ID'], $aDataEntry);
1863  }
1864  break;
1865  case 'admins_to_fans':
1866  $isShowConfirmedFansOnly = true;
1867  $iNum = $this->_oDb->getAdmins($aGroupAdmins, $iEntryId, 0, $iMaxFans);
1868  if ($this->isAllowedManageAdmins($aDataEntry) && $this->_oDb->removeGroupAdmin($iEntryId, $aIds)) {
1869  foreach ($aGroupAdmins as $aProfile) {
1870  if (in_array($aProfile['ID'], $aIds))
1871  $this->onEventAdminBecomeFan ($iEntryId, $aProfile['ID'], $aDataEntry);
1872  }
1873  }
1874  break;
1875  case 'confirm':
1876  if ($this->_oDb->confirmFans($iEntryId, $aIds)) {
1877  echo '<script type="text/javascript" language="javascript">
1878  document.location = "' . CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . "view/" . $aDataEntry[$this->_oDb->_sFieldUri] . '";
1879  </script>';
1880  $aProfiles = array ();
1881  $iNum = $this->_oDb->getFans($aProfiles, $iEntryId, true, 0, $iMaxFans, $aIds);
1882  foreach ($aProfiles as $aProfile) {
1883  $this->onEventJoin ($iEntryId, $aProfile['ID'], $aDataEntry);
1884  $this->onEventJoinConfirm ($iEntryId, $aProfile['ID'], $aDataEntry);
1885  }
1886  }
1887  break;
1888  case 'reject':
1889  if ($this->_oDb->rejectFans($iEntryId, $aIds)) {
1890  foreach ($aIds as $iProfileId)
1891  $this->onEventJoinReject ($iEntryId, $iProfileId, $aDataEntry);
1892  }
1893  break;
1894  case 'list':
1895  break;
1896  }
1897 
1898  $aProfiles = array ();
1899  $iNum = $this->_oDb->getFans($aProfiles, $iEntryId, $isShowConfirmedFansOnly, 0, $iMaxFans);
1900  if (!$iNum) {
1901  echo MsgBox(_t('_Empty'));
1902  } else {
1903  echo $this->_profilesEdit ($aProfiles, true, $aDataEntry);
1904  }
1905  exit;
1906  }
1907  }
1908 
1909  function _getCleanIdsArray ($sIds, $sDivider = ',')
1910  {
1911  $a = explode($sDivider, $sIds);
1912  $aRet = array();
1913  foreach ($a as $iId) {
1914  if (!(int)$iId)
1915  continue;
1916  $aRet[] = (int)$iId;
1917  }
1918  return $aRet;
1919  }
1920 
1921  function _profilesEdit(&$aProfiles, $isCenterContent = false, $aDataEntry = array())
1922  {
1923  $sResult = "";
1924  foreach($aProfiles as $aProfile) {
1925  $aVars = array(
1926  'id' => $aProfile['ID'],
1927  'thumb' => get_member_thumbnail($aProfile['ID'], 'none', true),
1928  'ch_if:admin' => array (
1929  'condition' => $aDataEntry && $this->isEntryAdmin ($aDataEntry, $aProfile['ID']) ? true : false,
1930  'content' => array (),
1931  ),
1932  );
1933  $sResult .= $this->_oTemplate->parseHtmlByName('unit_fan', $aVars);
1934  }
1935 
1936  return $isCenterContent ? $GLOBALS['oFunctions']->centerContent ($sResult, '.sys_fan_unit') : $sResult;
1937  }
1938 
1939  function _notifyEmail ($sEmailTemplateName, $iRecipient, $aDataEntry)
1940  {
1941  if (!($aProfile = getProfileInfo ($iRecipient)))
1942  return false;
1943 
1944  ch_import ('ChWsbEmailTemplates');
1945  $oEmailTemplate = new ChWsbEmailTemplates();
1946  if (!$oEmailTemplate)
1947  return false;
1948 
1949  $aTemplate = $oEmailTemplate->getTemplate($sEmailTemplateName);
1950  $aTemplateVars = array (
1951  'EntryTitle' => $aDataEntry[$this->_oDb->_sFieldTitle],
1952  'EntryUrl' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri],
1953  );
1954 
1955  return sendMail($aProfile['Email'], $aTemplate['Subject'], $aTemplate['Body'], $aProfile['ID'], $aTemplateVars);
1956  }
1957 
1958  function _browseMy (&$aProfile, $sTitle = null)
1959  {
1960  // check access
1961  if (!$this->_iProfileId) {
1962  $this->_oTemplate->displayAccessDenied();
1963  return;
1964  }
1965 
1966  $bAjaxMode = isset($_SERVER['HTTP_X_REQUESTED_WITH']) and $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ? true : false;
1967 
1968  // process delete action
1969  if (ch_get('action_delete') && is_array(ch_get('entry'))) {
1970  $aEntries = ch_get('entry');
1971  foreach ($aEntries as $iEntryId) {
1972  $iEntryId = (int)$iEntryId;
1973  $aDataEntry = $this->_oDb->getEntryById($iEntryId);
1974  if (!$this->isAllowedDelete($aDataEntry))
1975  continue;
1976 
1977  if ($this->_oDb->deleteEntryByIdAndOwner($iEntryId, $this->_iProfileId, 0)) {
1978  $this->onEventDeleted ($iEntryId);
1979  }
1980  }
1981  }
1982 
1983  ch_import ('PageMy', $this->_aModule);
1984  $sClass = $this->_aModule['class_prefix'] . 'PageMy';
1985  $oPage = new $sClass ($this, $aProfile);
1986 
1987  // manage my data entries
1988  if ($bAjaxMode && ($this->_sPrefix . '_my_active') == ch_get('block')) {
1989  header('Content-type:text/html;charset=utf-8');
1990  echo $oPage->getBlockCode_My();
1991  exit;
1992  }
1993 
1994  // manage my pending data entries
1995  if ($bAjaxMode && ($this->_sPrefix . '_my_pending') == ch_get('block')) {
1996  header('Content-type:text/html;charset=utf-8');
1997  echo $oPage->getBlockCode_Pending();
1998  exit;
1999  }
2000 
2001  $this->_oTemplate->pageStart();
2002 
2003  // display whole page
2004  if (!$bAjaxMode)
2005  echo $oPage->getCode();
2006 
2007  $this->_oTemplate->addJs ('main.js');
2008  $this->_oTemplate->addCss ('main.css');
2009  $this->_oTemplate->addCss ('form.css');
2010  $this->_oTemplate->addCss ('admin.css');
2011  $this->_oTemplate->addCss ('forms_extra.css');
2012  $this->_oTemplate->pageCode($sTitle, false, false);
2013  }
2014 
2016  {
2017  return $this->_isMembershipEnabledFor ('CH_PHOTOS_ADD');
2018  }
2019 
2021  {
2022  return $this->_isMembershipEnabledFor ('CH_VIDEOS_ADD');
2023  }
2024 
2026  {
2027  return $this->_isMembershipEnabledFor ('CH_SOUNDS_ADD');
2028  }
2029 
2031  {
2032  return $this->_isMembershipEnabledFor ('CH_FILES_ADD');
2033  }
2034 
2035  function _isMembershipEnabledFor ($sMembershipActionConstant)
2036  {
2037  defineMembershipActions (array('photos add', 'sounds add', 'videos add', 'files add'));
2038  if (!defined($sMembershipActionConstant))
2039  return false;
2040  $aCheck = checkAction(getLoggedId(), constant($sMembershipActionConstant));
2042  }
2043 
2044  function _formatSnippetText ($aEntryData, $iMaxLen = 300)
2045  {
2046  return strmaxtextlen($aEntryData[$this->_oDb->_sFieldDescription], $iMaxLen);
2047  }
2048 
2049  function _formatSnippetTextForOutline($aEntryData)
2050  {
2051  $s = $this->_formatSnippetText($aEntryData, 200);
2052  return $s;
2053  }
2054 
2055 }
ChWsbTwigModule\_onEventFanBecomeAdmin
_onEventFanBecomeAdmin($iEntryId, $iProfileId, $aDataEntry, $sEmailTemplate)
Definition: ChWsbTwigModule.php:1692
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
ChWsbTwigModule\_actionFiles
_actionFiles($sUri, $sTitle)
Definition: ChWsbTwigModule.php:36
ChWsbTwigModule\_actionManageFansPopup
_actionManageFansPopup($iEntryId, $sTitle, $sFuncGetFans='getFans', $sFuncIsAllowedManageFans='isAllowedManageFans', $sFuncIsAllowedManageAdmins='isAllowedManageAdmins', $iMaxFans=1000)
Definition: ChWsbTwigModule.php:759
$oSettings
$oSettings
Definition: advanced_settings.php:20
ChWsbTwigModule
Definition: ChWsbTwigModule.php:14
ChWsbTwigModule\_actionSounds
_actionSounds($sUri, $sTitle)
Definition: ChWsbTwigModule.php:76
ChWsbTwigModule\_actionTags
_actionTags($sTitle, $sTitleAllTags='')
Definition: ChWsbTwigModule.php:841
$bAjaxMode
$bAjaxMode
Definition: categories.php:21
$iMemberId
$iMemberId
Definition: profile.php:91
ChWsbTwigModule\_actionCalendar
_actionCalendar($iYear, $iMonth, $sTitle)
Definition: ChWsbTwigModule.php:422
true
if(!defined("TRUE_VAL")) define("TRUE_VAL" true
Definition: constants.inc.php:8
db_assoc_arr
db_assoc_arr($query, $bindings=[])
Definition: db.inc.php:86
ChWsbTwigModule\_actionHome
_actionHome($sTitle)
Definition: ChWsbTwigModule.php:25
ChWsbTwigModule\_getCleanIdsArray
_getCleanIdsArray($sIds, $sDivider=',')
Definition: ChWsbTwigModule.php:1909
$sMode
else $sMode
Definition: antispam.php:362
ChTemplTagsModule
Definition: ChTemplTagsModule.php:11
ChWsbTwigModule\serviceIsFan
serviceIsFan($iEntryId, $iProfileId=0)
Definition: ChWsbTwigModule.php:1428
ChWsbTwigModule\actionBrowse
actionBrowse($sMode='', $sValue='', $sValue2='', $sValue3='')
Definition: ChWsbTwigModule.php:442
ChWsbTwigModule\isMembershipEnabledForVideos
isMembershipEnabledForVideos()
Definition: ChWsbTwigModule.php:2020
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
ChWsbTwigModule\actionAdministrationCreateEntry
actionAdministrationCreateEntry()
Definition: ChWsbTwigModule.php:1542
ChWsbTwigModule\$_sPrefix
$_sPrefix
Definition: ChWsbTwigModule.php:16
isProfileActive
isProfileActive($iId=0)
Definition: profiles.inc.php:236
ChWsbTwigModule\_actionEdit
_actionEdit($iEntryId, $sTitle)
Definition: ChWsbTwigModule.php:565
$aPathInfo
$aPathInfo
Definition: cmd.php:12
ChWsbModule\getInstance
static getInstance($sClassName)
Definition: ChWsbModule.php:89
ChWsbModule\isLogged
isLogged()
Definition: ChWsbModule.php:113
ChWsbTwigModule\_onEventJoinConfirm
_onEventJoinConfirm($iEntryId, $iProfileId, $aDataEntry, $sEmailTemplate)
Definition: ChWsbTwigModule.php:1706
ChTemplSearchProfile
Definition: ChTemplSearchProfile.php:11
getPostFieldIfSet
getPostFieldIfSet($sField)
Definition: utils.inc.php:1954
CHECK_ACTION_RESULT_ALLOWED
const CHECK_ACTION_RESULT_ALLOWED
Definition: membership_levels.inc.php:60
$sResult
$sResult
Definition: advanced_settings.php:26
ChWsbTwigModule\_onEventJoinRequest
_onEventJoinRequest($iEntryId, $iProfileId, $aDataEntry, $sEmailTemplate, $iMaxFans=1000)
Definition: ChWsbTwigModule.php:1661
ChWsbTwigModule\onEventJoin
onEventJoin($iEntryId, $iProfileId, $aDataEntry)
Definition: ChWsbTwigModule.php:1650
$aModule
$aModule
Definition: classifieds.php:21
ChWsbTwigModule\_serviceGetWallPostComment
_serviceGetWallPostComment($aEvent, $aParams)
Definition: ChWsbTwigModule.php:1287
ChWsbEmailTemplates
Definition: ChWsbEmailTemplates.php:11
ChWsbTwigModule\_processFansActions
_processFansActions($aDataEntry, $iMaxFans=1000)
Definition: ChWsbTwigModule.php:1836
ChWsbTwigModule\$_iProfileId
$_iProfileId
Definition: ChWsbTwigModule.php:15
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
$aResult
$aResult
Definition: index.php:19
ChWsbTwigModule\serviceGetSpyData
serviceGetSpyData()
Definition: ChWsbTwigModule.php:1389
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
ChWsbTwigModule\isMembershipEnabledForImages
isMembershipEnabledForImages()
Definition: ChWsbTwigModule.php:2015
sendMail
sendMail( $sRecipientEmail, $sMailSubject, $sMailBody, $iRecipientID=0, $aPlus=array(), $sEmailFlag='html', $isDisableAlert=false, $bForceSend=false)
Definition: utils.inc.php:461
ChWsbTwigModule\_onEventJoinReject
_onEventJoinReject($iEntryId, $iProfileId, $aDataEntry, $sEmailTemplate)
Definition: ChWsbTwigModule.php:1672
ChWsbTwigModule\_serviceGetWallAddComment
_serviceGetWallAddComment($aEvent, $aParams)
Definition: ChWsbTwigModule.php:1217
uri2title
uri2title($sValue)
Definition: utils.inc.php:51
ChWsbTwigModule\_preProductTabs
_preProductTabs($sUri, $sSubTab='')
Definition: ChWsbTwigModule.php:1797
ChWsbTwigModule\_actionInvite
_actionInvite($iEntryId, $sEmailTemplate, $iMaxEmailInvitations, $sMsgInvitationSent, $sMsgNoUsers, $sTitle)
Definition: ChWsbTwigModule.php:347
$sUrl
$sUrl
Definition: cart.php:15
ChWsbTwigModule\_addForm
_addForm($sRedirectUrl)
Definition: ChWsbTwigModule.php:1720
$aForum
$aForum
Definition: design.php:15
php
ChWsbTags
Definition: ChWsbTags.php:15
$iId
$iId
Definition: license.php:15
$sMsg
$sMsg
Definition: actions.inc.php:22
ChWsbTwigModule\_profilesEdit
_profilesEdit(&$aProfiles, $isCenterContent=false, $aDataEntry=array())
Definition: ChWsbTwigModule.php:1921
ChWsbTwigModule\_serviceGetWallPost
_serviceGetWallPost($aEvent, &$aParams)
Definition: ChWsbTwigModule.php:984
$oPage
$oPage
Definition: search_home.php:83
ChWsbTwigModule\_actionBrowseFans
_actionBrowseFans($sUri, $sFuncAllowed, $sFuncDbGetFans, $iPerPage, $sUrlBrowse, $sTitle)
Definition: ChWsbTwigModule.php:138
ChWsbTwigModule\_actionCategories
_actionCategories($sTitle)
Definition: ChWsbTwigModule.php:854
ChWsbTwigModule\_browseMy
_browseMy(&$aProfile, $sTitle=null)
Definition: ChWsbTwigModule.php:1958
ChWsbSubscription\getInstance
static getInstance()
Definition: ChWsbSubscription.php:67
ChWsbTwigModule\_serviceGetWallPostOutline
_serviceGetWallPostOutline($aEvent, $sIcon, $aParams=array())
Definition: ChWsbTwigModule.php:1088
ChTemplCategoriesModule
Definition: ChTemplCategoriesModule.php:11
ChWsbTwigModule\serviceGetShoutboxData
serviceGetShoutboxData()
Definition: ChWsbTwigModule.php:1411
ChWsbTwigModule\isMembershipEnabledForSounds
isMembershipEnabledForSounds()
Definition: ChWsbTwigModule.php:2025
ChWsbTwigModule\_actionUploadMedia
_actionUploadMedia($sUri, $sIsAllowedFuncName, $sMedia, $aMediaFields, $sTitle)
Definition: ChWsbTwigModule.php:229
ChWsbTwigModule\_actionPhotos
_actionPhotos($sUri, $sTitle)
Definition: ChWsbTwigModule.php:96
$iPerPage
else $iPerPage
Definition: browse.php:61
ChWsbCategories
Definition: ChWsbCategories.php:13
ChWsbTwigModule\_actionAdministrationManage
_actionAdministrationManage($isAdminEntries, $sKeyBtnDelete='', $sKeyBtnActivate='', $sUrl=false)
Definition: ChWsbTwigModule.php:1504
ChWsbTwigModule\onEventDeleted
onEventDeleted($iEntryId, $aDataEntry=array())
Definition: ChWsbTwigModule.php:1604
ChWsbTwigModule\__construct
__construct(&$aModule)
Definition: ChWsbTwigModule.php:19
ChWsbTwigModule\_serviceGetSpyPost
_serviceGetSpyPost($sAction, $iObjectId, $iSenderId, $aExtraParams, $aLangKeys)
Definition: ChWsbTwigModule.php:1368
ChWsbTwigModule\_actionAdd
_actionAdd($sTitle)
Definition: ChWsbTwigModule.php:548
$oForm
$oForm
Definition: host_tools.php:42
ChWsbTwigModule\onEventChanged
onEventChanged($iEntryId, $sStatus)
Definition: ChWsbTwigModule.php:1592
ChWsbAlerts
Definition: ChWsbAlerts.php:39
ChWsbTwigModule\isMembershipEnabledForFiles
isMembershipEnabledForFiles()
Definition: ChWsbTwigModule.php:2030
ChWsbTwigModule\_onEventFanRemove
_onEventFanRemove($iEntryId, $iProfileId, $aDataEntry, $sEmailTemplate)
Definition: ChWsbTwigModule.php:1679
ChWsbTwigModule\_serviceIsSomebody
_serviceIsSomebody($sFunc, $iEntryId, $iProfileId=0)
Definition: ChWsbTwigModule.php:1438
getSitesHtml
getSitesHtml($sLink, $sTitle=false)
Definition: shared_sites.inc.php:37
exit
exit
Definition: cart.php:21
$_GET
$_GET['debug']
Definition: index.php:67
ChWsbTwigModule\_actionSearch
_actionSearch($sKeyword, $sCategory, $sTitle)
Definition: ChWsbTwigModule.php:486
$oMemberMenu
$oMemberMenu
Definition: member_menu_queries.php:20
ChWsbImageResize\instance
static instance()
Definition: ChWsbImageResize.php:60
and
and
Definition: license.txt:18
ChWsbTwigFormInviter
Definition: ChWsbTwigFormInviter.php:14
ChWsbTwigModule\_serviceGetSubscriptionParams
_serviceGetSubscriptionParams($sAction, $iEntryId, $aAction2Name)
Definition: ChWsbTwigModule.php:1451
ChWsbModule\getTitleKey
getTitleKey($sUri)
Definition: ChWsbModule.php:141
get_member_thumbnail
get_member_thumbnail($ID, $float, $bGenProfLink=false, $sForceSex='visitor', $aOnline=array())
Definition: design.inc.php:165
getLoggedId
getLoggedId()
Definition: profiles.inc.php:32
$sTitle
$sTitle
Definition: actions.inc.php:13
$aProfile
$aProfile
Definition: flash.php:14
ChWsbTwigModule\actionActivate
actionActivate($iEntryId)
Definition: ChWsbTwigModule.php:733
ChWsbTwigModule\$_sFilterName
$_sFilterName
Definition: ChWsbTwigModule.php:17
ch_append_url_params
ch_append_url_params($sUrl, $mixedParams)
Definition: utils.inc.php:1697
ChWsbTwigModule\_formatSnippetTextForOutline
_formatSnippetTextForOutline($aEntryData)
Definition: ChWsbTwigModule.php:2049
getNickName
getNickName( $ID='')
Definition: profiles.inc.php:461
strmaxtextlen
strmaxtextlen($sInput, $iMaxLen=60)
Definition: utils.inc.php:207
ChWsbTwigModule\_getInviteParams
_getInviteParams($aDataEntry, $aInviter)
Definition: ChWsbTwigModule.php:341
ChWsbTwigModule\serviceDeleteProfileData
serviceDeleteProfileData($iProfileId)
Definition: ChWsbTwigModule.php:911
$sJQueryJS
$sJQueryJS
Definition: list_pop.php:32
ChWsbViews
Definition: ChWsbViews.php:38
ChWsbTwigModule\_actionJoin
_actionJoin($iEntryId, $iProfileId, $sMsgAlreadyJoined, $sMsgAlreadyJoinedPending, $sMsgJoinSuccess, $sMsgJoinSuccessPending, $sMsgLeaveSuccess)
Definition: ChWsbTwigModule.php:685
uriFilter
uriFilter($s)
Definition: utils.inc.php:931
ChWsbTwigModule\_actionComments
_actionComments($sUri, $sTitle)
Definition: ChWsbTwigModule.php:116
ch_instance
ch_instance($sClassName, $aParams=array(), $aModule=array())
Definition: utils.inc.php:1264
ChWsbPaginate
Definition: ChWsbPaginate.php:69
ChWsbTwigModule\_onEventAdminBecomeFan
_onEventAdminBecomeFan($iEntryId, $iProfileId, $aDataEntry, $sEmailTemplate)
Definition: ChWsbTwigModule.php:1699
ChWsbTwigModule\serviceGetWallData
serviceGetWallData()
Definition: ChWsbTwigModule.php:1352
ChWsbModule
Definition: ChWsbModule.php:41
$sContent
$sContent
Definition: bottom_menu_compose.php:169
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
ChWsbTwigModule\_actionDelete
_actionDelete($iEntryId, $sMsgSuccess)
Definition: ChWsbTwigModule.php:629
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
$iDate
$iDate
Definition: cron.php:130
ChWsbTwigModule\onEventMarkAsFeatured
onEventMarkAsFeatured($iEntryId, $aDataEntry)
Definition: ChWsbTwigModule.php:1643
ChWsbTwigModule\reparseCategories
reparseCategories($iEntryId)
Definition: ChWsbTwigModule.php:1567
getProfileLink
getProfileLink( $iID, $sLinkAdd='')
Definition: profiles.inc.php:484
ChWsbTwigModule\serviceResponseProfileDelete
serviceResponseProfileDelete($oAlert)
Definition: ChWsbTwigModule.php:930
ChWsbTwigModule\_manageEntries
_manageEntries($sMode, $sValue, $isFilter, $sFormName, $aButtons, $sAjaxPaginationBlockId='', $isMsgBoxIfEmpty=true, $iPerPage=0, $sUrlAdmin=false)
Definition: ChWsbTwigModule.php:1764
ChWsbAdminSettings
Definition: ChWsbAdminSettings.php:35
ChWsbTwigModule\reparseTags
reparseTags($iEntryId)
Definition: ChWsbTwigModule.php:1559
checkAction
checkAction($iMemberId, $actionID, $performAction=false, $iForcedProfID=0, $isCheckMemberStatus=true)
Definition: membership_levels.inc.php:313
CH_TAGS_STRIP
const CH_TAGS_STRIP
Definition: utils.inc.php:22
ChWsbTwigModule\serviceGetForumPermission
serviceGetForumPermission($iMemberId, $iForumId)
Definition: ChWsbTwigModule.php:885
ChWsbTwigModule\_notifyEmail
_notifyEmail($sEmailTemplateName, $iRecipient, $aDataEntry)
Definition: ChWsbTwigModule.php:1939
$aVars
$aVars
Definition: license.php:101
defineMembershipActions
defineMembershipActions($aActionsAll, $sPrefix='CH_')
Definition: membership_levels.inc.php:744
$s
$s
Definition: embed.php:13
ChWsbTwigModule\onEventCreate
onEventCreate($iEntryId, $sStatus, $aDataEntry=array())
Definition: ChWsbTwigModule.php:1577
ChWsbTwigModule\_formatSnippetText
_formatSnippetText($aEntryData, $iMaxLen=300)
Definition: ChWsbTwigModule.php:2044
ChWsbTwigModule\_isMembershipEnabledFor
_isMembershipEnabledFor($sMembershipActionConstant)
Definition: ChWsbTwigModule.php:2035
ChWsbTwigModule\_actionVideos
_actionVideos($sUri, $sTitle)
Definition: ChWsbTwigModule.php:56
genAjaxyPopupJS
genAjaxyPopupJS($iTargetID, $sDivID='ajaxy_popup_result_div', $sRedirect='')
Definition: design.inc.php:242
$iPage
$iPage
Definition: browse.php:50
ChWsbTwigModule\_actionAdministrationSettings
_actionAdministrationSettings($sSettingsCatName='')
Definition: ChWsbTwigModule.php:1475
ChWsbTwigModule\isAdmin
isAdmin()
Definition: ChWsbTwigModule.php:1715
getProfileInfo
getProfileInfo($iProfileID=0, $checkActiveStatus=false, $forceCache=false)
Definition: profiles.inc.php:249
ChWsbTwigModule\_actionView
_actionView($sUri, $sMsgPendingApproval)
Definition: ChWsbTwigModule.php:192
ChWsbTwigModule\_actionDownload
_actionDownload($aFileInfo, $sFieldMediaId)
Definition: ChWsbTwigModule.php:866
ChBaseSearchResult\showAdminActionsPanel
static showAdminActionsPanel($sWrapperId, $aButtons, $sCheckboxName='entry', $bSelectAll=true, $bSelectAllChecked=false, $sCustomHtml='')
Definition: ChBaseSearchResult.php:81
ChWsbTwigModule\_actionMarkFeatured
_actionMarkFeatured($iEntryId, $sMsgSuccessAdd, $sMsgSuccessRemove)
Definition: ChWsbTwigModule.php:657
ChWsbTwigModule\_actionSharePopup
_actionSharePopup($iEntryId, $sTitle, $bAddTempleateExt=false)
Definition: ChWsbTwigModule.php:824
$sAction
$sAction
Definition: categories.php:274
DesignBoxContent
DesignBoxContent($title, $content, $db_num=0, $caption_item='', $bottom_item='')
Definition: design.inc.php:78
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
ChWsbTwigModule\serviceIsEntryAdmin
serviceIsEntryAdmin($iEntryId, $iProfileId=0)
Definition: ChWsbTwigModule.php:1433
$o
$o
Definition: cmd.php:193
ChWsbService\call
static call($mixed, $sMethod, $aParams=array(), $sClass='Module')
Definition: ChWsbService.php:32
ChWsbTwigModule\_actionBroadcast
_actionBroadcast($iEntryId, $sTitle, $sMsgNoRecipients, $sMsgSent)
Definition: ChWsbTwigModule.php:268
ChWsbTwigModule\_serviceGetMemberMenuItem
_serviceGetMemberMenuItem($sTitle, $sAlt, $sIcon, $isExtraCount=true, $sLinkAppend='')
Definition: ChWsbTwigModule.php:966
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
$sStatus
$sStatus
Definition: actions.inc.php:11
ChWsbTwigModule\serviceResponseMediaDelete
serviceResponseMediaDelete($oAlert)
Definition: ChWsbTwigModule.php:940
$iProfileId
if( $sMembersList) $iProfileId
Definition: communicator.php:29
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
if
if(!defined("VERSION")) define("VERSION"
Definition: header.inc.php:13
$oSubscription
$oSubscription
Definition: notifies.php:28