14 require_once(
'ChWallCmts.php');
15 require_once(
'ChWallVoting.php');
16 require_once(
'ChWallPrivacy.php');
17 require_once(
'ChWallResponse.php');
19 define(
'CH_WALL_FILTER_ALL',
'all');
20 define(
'CH_WALL_FILTER_OWNER',
'owner');
21 define(
'CH_WALL_FILTER_OTHER',
'other');
23 define(
'CH_WALL_VIEW_TIMELINE',
'timeline');
24 define(
'CH_WALL_VIEW_OUTLINE',
'outline');
26 define(
'CH_WALL_PARSE_TYPE_TEXT',
'text');
27 define(
'CH_WALL_PARSE_TYPE_LINK',
'link');
28 define(
'CH_WALL_PARSE_TYPE_PHOTOS',
'photos');
29 define(
'CH_WALL_PARSE_TYPE_SOUNDS',
'sounds');
30 define(
'CH_WALL_PARSE_TYPE_VIDEOS',
'videos');
31 define(
'CH_WALL_PARSE_TYPE_REPOST',
'repost');
33 define(
'CH_WALL_MEDIA_CATEGORY_NAME',
'wall');
35 define(
'CH_WALL_DIVIDER_ID',
',');
36 define(
'CH_WALL_DIVIDER_OBJECT_ID',
',');
37 define(
'CH_WALL_DIVIDER_TIMELINE',
'-');
57 $this->_oConfig->init($this->_oDb);
58 $this->_oTemplate->setModule($this);
63 defineMembershipActions(array(
'timeline repost',
'timeline post comment',
'timeline delete comment'),
'ACTION_ID_');
73 $iId = (int)$this->_oDb->getOne(
"SELECT `ID` FROM `sys_options_cats` WHERE `name`='Timeline'");
75 return MsgBox(
_t(
'_wall_msg_no_results'));
80 if($mixedResult !==
true && !
empty($mixedResult))
87 $iId = (int)$this->_oDb->getOne(
"SELECT `ID` FROM `sys_options_cats` WHERE `name`='Timeline'");
89 return MsgBox(
_t(
'_wall_msg_no_results'));
103 $sJsObject = $this->_oConfig->getJsObject(
'post');
105 $sResult =
"parent." . $sJsObject .
".loading(false);\n";
107 $this->_iOwnerId = (int)$_POST[
'WallOwnerId'];
109 return "<script>" .
$sResult .
"alert('" .
ch_js_string(
_t(
'_wall_msg_not_allowed_post')) .
"');</script>";
114 $sMethod =
"_process" . ucfirst($sPostType) . ucfirst($sContentType);
115 if(method_exists($this, $sMethod)) {
118 $iId = $this->_oDb->insertEvent(array(
119 'owner_id' => $this->_iOwnerId,
120 'object_id' =>
$aResult[
'object_id'],
121 'type' => $this->_oConfig->getCommonPostPrefix() . $sPostType,
130 $sResult =
"parent.$('form#WallPost" . ucfirst($sPostType) .
"').find(':input:not(:button,:submit,[type = hidden],[type = radio],[type = checkbox])').val('');\n";
131 $sResult .=
"parent." . $sJsObject .
"._getPost(null, " .
$iId .
");";
137 return '<script>' .
$sResult .
'</script>';
144 $iOwnerId = (int)
ch_get(
'owner_id');
148 'object_id' => (
int)
ch_get(
'object_id'),
151 $aReposted = $this->_oDb->getReposted($aContent[
'type'], $aContent[
'action'], $aContent[
'object_id']);
152 if(
empty($aReposted) || !is_array($aReposted)) {
153 $this->
_echoResultJson(array(
'code' => 1,
'msg' =>
_t(
'_wall_txt_err_cannot_repost')));
158 if($mixedAllowed !==
true) {
159 $this->
_echoResultJson(array(
'code' => 2,
'msg' => strip_tags($mixedAllowed)));
163 $bReposted = $this->_oDb->isReposted($aReposted[
'id'], $iOwnerId, $iAuthorId);
165 $this->
_echoResultJson(array(
'code' => 3,
'msg' =>
_t(
'_wall_txt_err_already_reposted')));
170 $iId = $this->_oDb->insertEvent(array(
171 'owner_id' => $iOwnerId,
172 'type' => $this->_oConfig->getPrefix(
'common_post') .
'repost',
174 'object_id' => $iAuthorId,
175 'content' => serialize($aContent),
181 $this->
_echoResultJson(array(
'code' => 4,
'msg' =>
_t(
'_wall_txt_err_cannot_repost')));
187 $aReposted = $this->_oDb->getReposted($aContent[
'type'], $aContent[
'action'], $aContent[
'object_id']);
190 'msg' =>
_t(
'_wall_txt_msg_success_repost'),
191 'count' => $aReposted[
'reposts'],
192 'counter' => $this->_oTemplate->getRepostCounter($aReposted),
193 'disabled' => !$bReposted
204 header(
'Content-Type:text/javascript');
206 $this->_iOwnerId = (int)$_POST[
'WallOwnerId'];
208 $iEvent = (int)$_POST[
'WallEventId'];
209 $aEvent = $this->_oDb->getEvents(array(
'browse' =>
'id',
'object_id' => $iEvent));
212 return json_encode(array(
'code' => 1));
214 $bResult = $this->_oDb->deleteEvent(array(
'id' => $iEvent));
218 return json_encode(array(
'code' => 0,
'id' => $iEvent));
220 return json_encode(array(
'code' => 2));
229 $this->_oConfig->setJsMode(
true);
230 $this->_iOwnerId = (int)$_POST[
'WallOwnerId'];
231 $iPostId = (int)$_POST[
'WallPostId'];
233 $aEvent = $this->_oDb->getEvents(array(
'browse' =>
'id',
'object_id' => $iPostId));
235 header(
'Content-Type: text/html; charset=utf-8');
236 return $this->_oTemplate->getCommon($aEvent);
245 $this->_oConfig->setJsMode(
true);
247 $this->_iOwnerId = $_POST[
'WallOwnerId'];
251 $iStart = isset($_POST[
'WallStart']) && !
empty($_POST[
'WallStart']) ? (int)$_POST[
'WallStart'] : 0;
252 $iPerPage = isset($_POST[
'WallPerPage']) && !
empty($_POST[
'WallPerPage']) ? (int)$_POST[
'WallPerPage'] : $this->_oConfig->getPerPage();
257 header(
'Content-Type: text/html; charset=utf-8');
267 $this->_oConfig->setJsMode(
true);
269 $iStart = isset($_POST[
'WallStart']) && !
empty($_POST[
'WallStart']) ? (int)$_POST[
'WallStart'] : 0;
270 $iPerPage = isset($_POST[
'WallPerPage']) && !
empty($_POST[
'WallPerPage']) ? (int)$_POST[
'WallPerPage'] : $this->_oConfig->getPerPage();
276 header(
'Content-Type:text/javascript; charset=utf-8');
277 return json_encode(array(
280 'paginate' => $sPaginate
290 $this->_iOwnerId = $_POST[
'WallOwnerId'];
294 $iStart = isset($_POST[
'WallStart']) && !
empty($_POST[
'WallStart']) ? (int)$_POST[
'WallStart'] : 0;
295 $iPerPage = isset($_POST[
'WallPerPage']) && !
empty($_POST[
'WallPerPage']) ? (int)$_POST[
'WallPerPage'] : $this->_oConfig->getPerPage();
300 header(
'Content-Type: text/html; charset=utf-8');
310 $this->_iOwnerId = $_POST[
'WallOwnerId'];
314 $iStart = isset($_POST[
'WallStart']) && !
empty($_POST[
'WallStart']) ? (int)$_POST[
'WallStart'] : 0;
315 $iPerPage = isset($_POST[
'WallPerPage']) && !
empty($_POST[
'WallPerPage']) ? (int)$_POST[
'WallPerPage'] : $this->_oConfig->getPerPage();
322 header(
'Content-Type: text/html; charset=utf-8');
323 return $oPaginate->getPaginate($iStart,
$iPerPage);
332 $this->_iOwnerId = $iOwnerId;
333 header(
'Content-Type: text/html; charset=utf-8');
335 if(!in_array(
$sType, array(
'photo',
'sound',
'video')))
338 return $this->_oTemplate->getUploader($iOwnerId,
$sType, $sSubType);
347 $iRepostedId = (int)
ch_get(
'id');
349 header(
'Content-Type:text/javascript; charset=utf-8');
350 return json_encode(array(
352 'content' => $this->_oTemplate->getRepostedBy($iRepostedId)
362 $sNoImage = $this->_oTemplate->getImageUrl(
'no-image.png');
364 $aEvent = $this->_oDb->getEvents(array(
'browse' =>
'id',
'object_id' =>
$iId));
365 if(
empty($aEvent) || !is_array($aEvent) || strpos($aEvent[
'content'], urlencode(
$sUrl)) ===
false) {
366 header(
"Location: " . $sNoImage);
372 $sProtoHttp =
'http';
373 $sProtoHttps =
'https';
377 if($sProtoSite == $sProtoHttp || ($sProtoSite == $sProtoHttps && $sProtoImage == $sProtoHttps)) {
383 $aHeaders = get_headers(
$sUrl);
385 $bHeaderCache =
false;
386 $sHeaderCache =
'Cache-Control: max-age=2592000';
388 foreach ($aHeaders
as $sHeader) {
391 if(preg_match(
"/^Content-Type:\s*([a-z]*)\/([a-z]*)$/i", $sHeader, $aMatches)) {
392 if($aMatches[1] ==
'image' && in_array($aMatches[2], array(
'png',
'jpeg',
'gif')))
398 if(preg_match(
"/^Cache-Control:\s*max-age\s*=\s*([0-9]*)$/i", $sHeader, $aMatches)) {
399 $bHeaderCache =
true;
401 if((
int)$aMatches[1] < 2592000)
402 $sHeader = $sHeaderCache;
409 header(
"Location: " . $sNoImage);
428 $aEvents = $this->_oDb->getEvents(array(
430 'owner_id' => $aOwner[
'id'],
433 'count' => $this->_oConfig->getRssLength(),
437 $sRssBaseUrl = $this->_oConfig->getBaseUri() .
'index/' . $aOwner[
'username'] .
'/';
439 foreach($aEvents
as $aEvent) {
440 if(
empty($aEvent[
'title']))
continue;
442 $aRssData[$aEvent[
'id']] = array(
443 'UnitID' => $aEvent[
'id'],
444 'OwnerID' => $aOwner[
'id'],
445 'UnitTitle' => $aEvent[
'title'],
446 'UnitLink' => CH_WSB_URL_ROOT . $sRssBaseUrl .
'#wall-event-' . $aEvent[
'id'],
447 'UnitDesc' => $aEvent[
'description'],
448 'UnitDateTimeUTS' => $aEvent[
'date'],
455 header(
'Content-Type: text/html; charset=utf-8');
456 return $oRss->GenRssByData($aRssData, $aOwner[
'username'] .
' ' .
_t(
'_wall_rss_caption'), $sRssBaseUrl);
483 $this->_iOwnerId = $aOwner[
'id'];
489 if(
empty($aTopMenu) ||
empty($aTopMenu[
'tabs']))
493 $sClassActive =
' wall-ptc-active';
494 $sContent = $this->_oTemplate->parseHtmlByName(
'post.html', array (
495 'js_code' => $this->_oTemplate->getJsCode(
'post', array(
'iOwnerId' => 0)),
496 'class_text' => !
empty($aTopMenu[
'mask'][
'text']) ? $sClassActive :
'',
497 'content_text' => isset($aTopMenu[
'mask'][
'text']) ? $this->
_getWriteForm(
'_getWriteFormIndex') :
'',
498 'class_link' => !
empty($aTopMenu[
'mask'][
'link']) ? $sClassActive :
'',
499 'content_link' => isset($aTopMenu[
'mask'][
'link']) ? $this->
_getShareLinkForm(
'_getShareLinkFormIndex') :
'',
500 'class_photo' => !
empty($aTopMenu[
'mask'][
'photo']) ? $sClassActive :
'',
501 'content_photo' => isset($aTopMenu[
'mask'][
'photo']) ? $this->_oTemplate->getUploader(0,
'photo') :
'',
502 'class_sound' => !
empty($aTopMenu[
'mask'][
'sound']) ? $sClassActive :
'',
503 'content_sound' => isset($aTopMenu[
'mask'][
'sound']) ? $this->_oTemplate->getUploader(0,
'sound') :
'',
504 'class_video' => !
empty($aTopMenu[
'mask'][
'video']) ? $sClassActive :
'',
505 'content_video' => isset($aTopMenu[
'mask'][
'video']) ? $this->_oTemplate->getUploader(0,
'video') :
'',
508 $this->_oTemplate->addCss(
'post.css');
509 $this->_oTemplate->addJs(array(
'main.js',
'post.js'));
510 return array(
$sContent, $aTopMenu[
'tabs'],
LoadingBox(
'ch-wall-post-loading'),
true,
'getBlockCaptionMenu');
515 $this->_iOwnerId = 0;
520 $iPerPage = $this->_oConfig->getPerPage(
'index_tl');
527 'view_js_content' => $this->_oTemplate->getJsCode(
'view', array(
'iOwnerId' => $this->_iOwnerId), array(
528 'WallOwnerId' => $this->_iOwnerId,
529 'WallStart' => $iStart,
531 'WallFilter' => $sFilter,
532 'WallTimeline' => $sTimeline,
539 $oForm->addCssJs(
true,
true);
541 $this->_oTemplate->addCss(array(
'view.css',
'view_phone.css'));
542 $this->_oTemplate->addJs(array(
'modernizr.js',
'main.js',
'view.js'));
543 return array($this->_oTemplate->parseHtmlByName(
'view.html', $aVariables), array(),
LoadingBox(
'ch-wall-view-loading'),
false,
'getBlockCaptionMenu');
554 $aOwner = $this->_oDb->getUser($mixed,
$sType);
555 $this->_iOwnerId = $aOwner[
'id'];
561 if(
empty($aTopMenu) ||
empty($aTopMenu[
'tabs']))
565 $sClassActive =
' wall-ptc-active';
566 $sContent = $this->_oTemplate->parseHtmlByName(
'post.html', array (
567 'js_code' => $this->_oTemplate->getJsCode(
'post', array(
'iOwnerId' => $this->_iOwnerId)),
568 'class_text' => !
empty($aTopMenu[
'mask'][
'text']) ? $sClassActive :
'',
569 'content_text' => isset($aTopMenu[
'mask'][
'text']) ? $this->
_getWriteForm() :
'',
570 'class_link' => !
empty($aTopMenu[
'mask'][
'link']) ? $sClassActive :
'',
571 'content_link' => isset($aTopMenu[
'mask'][
'link']) ? $this->
_getShareLinkForm() :
'',
572 'class_photo' => !
empty($aTopMenu[
'mask'][
'photo']) ? $sClassActive :
'',
573 'content_photo' => isset($aTopMenu[
'mask'][
'photo']) ? $this->_oTemplate->getUploader($this->_iOwnerId,
'photo') :
'',
574 'class_sound' => !
empty($aTopMenu[
'mask'][
'sound']) ? $sClassActive :
'',
575 'content_sound' => isset($aTopMenu[
'mask'][
'sound']) ? $this->_oTemplate->getUploader($this->_iOwnerId,
'sound') :
'',
576 'class_video' => !
empty($aTopMenu[
'mask'][
'video']) ? $sClassActive :
'',
577 'content_video' => isset($aTopMenu[
'mask'][
'video']) ? $this->_oTemplate->getUploader($this->_iOwnerId,
'video') :
'',
580 $GLOBALS[
'oTopMenu']->setCurrentProfileID((
int)$this->_iOwnerId);
582 $this->_oTemplate->addCss(
'post.css');
583 $this->_oTemplate->addJs(array(
'main.js',
'post.js'));
584 return array(
$sContent, $aTopMenu[
'tabs'],
LoadingBox(
'ch-wall-post-loading'),
true,
'getBlockCaptionMenu');
589 $sJsObject = $this->_oConfig->getJsObject(
'post');
590 $aUploadersHidden = $this->_oConfig->getUploadersHidden(
$sType);
592 $aTabs = $aMask = array();
593 if(!in_array(
'text', $aUploadersHidden)) {
595 $aTabs[
'wall-ptype-text'] = array(
'href' =>
'javascript:void(0)',
'onclick' =>
'javascript:' . $sJsObject .
'.changePostType(this)',
'class' =>
'wall-ptype-ctl',
'icon' =>
'comment-o',
'title' =>
_t(
'_wall_write'));
598 if(!in_array(
'link', $aUploadersHidden)) {
600 $aTabs[
'wall-ptype-link'] = array(
'href' =>
'javascript:void(0)',
'onclick' =>
'javascript:' . $sJsObject .
'.changePostType(this)',
'class' =>
'wall-ptype-ctl',
'icon' =>
'link',
'title' =>
_t(
'_wall_share_link'));
603 if(!in_array(
'photo', $aUploadersHidden) && $this->_oDb->isModule(
'photos')) {
605 $aTabs[
'wall-ptype-photo'] = array(
'href' =>
'javascript:void(0)',
'onclick' =>
'javascript:' . $sJsObject .
'.changePostType(this)',
'class' =>
'wall-ptype-ctl',
'icon' =>
'picture-o',
'title' =>
_t(
'_wall_add_photo'));
608 if(!in_array(
'sound', $aUploadersHidden) && $this->_oDb->isModule(
'sounds')) {
610 $aTabs[
'wall-ptype-sound'] = array(
'href' =>
'javascript:void(0)',
'onclick' =>
'javascript:' . $sJsObject .
'.changePostType(this)',
'class' =>
'wall-ptype-ctl',
'icon' =>
'music',
'title' =>
_t(
'_wall_add_sound'));
613 if(!in_array(
'video', $aUploadersHidden) && $this->_oDb->isModule(
'videos')) {
615 $aTabs[
'wall-ptype-video'] = array(
'href' =>
'javascript:void(0)',
'onclick' =>
'javascript:' . $sJsObject .
'.changePostType(this)',
'class' =>
'wall-ptype-ctl',
'icon' =>
'film',
'title' =>
_t(
'_wall_add_video'));
620 $sActive = key($aTabs);
622 $aTabs[$sActive][
'active'] = 1;
635 $sJsObject = $this->_oConfig->getJsObject(
'view');
637 $aOwner = $this->_oDb->getUser($mixed,
$sType);
638 $this->_iOwnerId = $aOwner[
'id'];
647 'wall-view-all' => array(
'href' =>
'javascript:void(0)',
'onclick' =>
'javascript:' . $sJsObject .
'.changeFilter(this)',
'title' =>
_t(
'_wall_view_all'),
'active' => 1),
648 'wall-view-owner' => array(
'href' =>
'javascript:void(0)',
'onclick' =>
'javascript:' . $sJsObject .
'.changeFilter(this)',
'title' =>
_t(
'_wall_view_owner',
getNickName($aOwner[
'id']))),
649 'wall-view-other' => array(
'href' =>
'javascript:void(0)',
'onclick' =>
'javascript:' . $sJsObject .
'.changeFilter(this)',
'title' =>
_t(
'_wall_view_other')),
650 'wall-get-rss' => array(
'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'rss/' . $aOwner[
'username'] .
'/',
'target' =>
'_blank',
'title' =>
_t(
'_wall_get_rss')),
651 'wall-subscription' => array(
'href' =>
'javascript:void(0);',
'onclick' =>
'javascript:' . $aButton[
'script'] .
'',
'title' => $aButton[
'title']),
657 $iPerPage = $this->_oConfig->getPerPage(
'profile');
664 'view_js_content' => $this->_oTemplate->getJsCode(
'view', array(
'iOwnerId' => $this->_iOwnerId), array(
665 'WallOwnerId' => $this->_iOwnerId,
666 'WallStart' => $iStart,
668 'WallFilter' => $sFilter,
669 'WallTimeline' => $sTimeline,
674 $GLOBALS[
'oTopMenu']->setCurrentProfileID((
int)$this->_iOwnerId);
678 $oForm->addCssJs(
true,
true);
680 $this->_oTemplate->addCss(array(
'view.css',
'view_phone.css'));
681 $this->_oTemplate->addJs(array(
'modernizr.js',
'main.js',
'view.js'));
682 return array(
$oSubscription->getData() . $this->_oTemplate->parseHtmlByName(
'view.html', $aVariables), $aTopMenu,
LoadingBox(
'ch-wall-view-loading'),
false,
'getBlockCaptionMenu');
687 $aOwner = $this->_oDb->getUser($mixed,
$sType);
688 $this->_iOwnerId = $aOwner[
'id'];
692 return $this->_oTemplate->getEmpty(
true);
694 $this->_iOwnerId = array_keys($aFriends);
700 $iPerPage = $this->_oConfig->getPerPage(
'account');
707 'view_js_content' => $this->_oTemplate->getJsCode(
'view', array(
'iOwnerId' => $sOwnerId), array(
708 'WallOwnerId' => $sOwnerId,
709 'WallStart' => $iStart,
711 'WallFilter' => $sFilter,
712 'WallTimeline' => $sTimeline,
719 $oForm->addCssJs(
true,
true);
721 $this->_oTemplate->addCss(array(
'view.css',
'view_phone.css'));
722 $this->_oTemplate->addJs(array(
'main.js',
'view.js'));
723 return array($this->_oTemplate->parseHtmlByName(
'view.html', $aVariables), array(),
LoadingBox(
'ch-wall-view-loading'),
false,
'getBlockCaptionMenu');
729 $this->_iOwnerId = 0;
734 $iPerPage = $this->_oConfig->getPerPage(
'index_ol');
743 'outline_js_content' => $this->_oTemplate->getJsCode(
'outline', array(
'iOwnerId' => 0), array(
744 'WallFilter' => $sFilter,
748 'paginate' => $sPaginate
751 $this->_oTemplate->addCss(array(
'outline.css',
'outline_tablet.css',
'outline_phone.css'));
752 $this->_oTemplate->addJs(array(
'masonry.pkgd.min.js',
'main.js',
'outline.js'));
753 return array($this->_oTemplate->parseHtmlByName(
'outline.html', $aTmplVars), array(),
LoadingBox(
'ch-wall-view-loading'),
true,
'getBlockCaptionMenu');
760 $aHandlers = $this->_oDb->getHandlers(array(
'type' =>
$sType));
763 foreach($aHandlers
as $aHandler) {
766 $aModule[
'title'] =
_t(
'_wall_alert_module_' . $aHandler[
'alert_unit']);
768 $aResults[$aHandler[
'id']] =
_t(
'_wall_alert_action_' . $aHandler[
'alert_action'],
$aModule[
'title']);
778 'text' =>
_t(
'_wall_write'),
779 'link' =>
_t(
'_wall_share_link')
782 if($this->_oDb->isModule(
'photos'))
785 if($this->_oDb->isModule(
'sounds'))
788 if($this->_oDb->isModule(
'videos'))
797 $aModules = $sModuleUri ==
'all' ? $this->_oDb->getModules() : array($this->_oDb->getModuleByUri($sModuleUri));
804 $this->_oDb->insertData($aData);
806 $this->_oDb->deleteData($aData);
816 $aLanguageKeys = array(
817 'wall' =>
_t(
'_wall_pc_view' ),
822 'item_img_src' =>
'time',
823 'item_img_alt' => $aLanguageKeys[
'wall'],
824 'item_link' => CH_WSB_URL_ROOT . $this -> _oConfig -> getBaseUri(),
825 'item_onclick' =>
null,
826 'item_title' => $aLanguageKeys[
'wall'],
827 'extra_info' =>
null,
834 $sUnit = str_replace(
'ch_',
'_', $sUnit);
842 'ViewLink' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'index/' .
$aProfileInfo[
'NickName']
849 $AlertName = $this->_oConfig->getAlertSystemName();
853 array(
'alert_unit' => $AlertName,
'alert_action' =>
'post',
'module_uri' => $this->_oConfig->getUri(),
'module_class' =>
'Module',
'module_method' =>
'get_spy_post'),
854 array(
'alert_unit' => $AlertName,
'alert_action' =>
'repost',
'module_uri' => $this->_oConfig->getUri(),
'module_class' =>
'Module',
'module_method' =>
'get_spy_post'),
855 array(
'alert_unit' => $AlertName,
'alert_action' =>
'rate',
'module_uri' => $this->_oConfig->getUri(),
'module_class' =>
'Module',
'module_method' =>
'get_spy_post'),
856 array(
'alert_unit' => $AlertName,
'alert_action' =>
'commentPost',
'module_uri' => $this->_oConfig->getUri(),
'module_class' =>
'Module',
'module_method' =>
'get_spy_post'),
859 array(
'unit' => $AlertName,
'action' =>
'post'),
860 array(
'unit' => $AlertName,
'action' =>
'repost'),
861 array(
'unit' => $AlertName,
'action' =>
'delete'),
862 array(
'unit' => $AlertName,
'action' =>
'rate'),
863 array(
'unit' => $AlertName,
'action' =>
'commentPost'),
864 array(
'unit' => $AlertName,
'action' =>
'commentRemoved')
871 $aEvent = $this->_oDb->getEvents(array(
'browse' =>
'id',
'object_id' => $iObjectId));
872 if($aEvent[
'owner_id'] == $iSenderId)
878 $sLangKey =
'_wall_spy_post';
881 $sLangKey =
'_wall_spy_repost';
884 $sLangKey =
'_wall_spy_rate';
887 $sLangKey =
'_wall_spy_post_comment';
896 'recipient_p_nick' =>
getNickName($aEvent[
'owner_id']),
898 'recipient_id' => $aEvent[
'owner_id'],
899 'lang_key' => $sLangKey
905 $aParams = array_merge($this->_oConfig->getRepostDefaults(), $aParams);
906 return $this->_oTemplate->getRepostElement($iOwnerId,
$sType,
$sAction, $iObjectId, $aParams);
911 $aReposted = $this->_oDb->getReposted(
$sType,
$sAction, $iObjectId);
913 return $this->_oTemplate->getRepostCounter($aReposted, $aParams);
918 return $this->_oTemplate->getRepostJsScript();
923 return $this->_oTemplate->getRepostJsClick($iOwnerId,
$sType,
$sAction, $iObjectId);
928 $sLanguageKey =
'_wall_reposted_';
930 $sLanguageKey .=
'title_';
938 $sLanguageKey .=
'_grouped';
940 return $sLanguageKey;
957 $sCommonPostPrefix = $this->_oConfig->getPrefix(
'common_post');
961 $this->_oDb->deleteRepostTrack($aEvent[
'id']);
963 $aContent = unserialize($aEvent[
'content']);
964 $aReposted = $this->_oDb->getReposted($aContent[
'type'], $aContent[
'action'], $aContent[
'object_id']);
965 if(!
empty($aReposted) && is_array($aReposted))
966 $this->_oDb->updateRepostCounter($aReposted[
'id'], $aReposted[
'reposts'], -1);
970 $bSystem = $this->_oConfig->isSystem($aEvent[
'type'], $aEvent[
'action']);
971 $aRepostEvents = $this->_oDb->getEvents(array(
'browse' =>
'reposted_by_descriptor',
'type' => $aEvent[
'type']));
972 foreach($aRepostEvents
as $aRepostEvent) {
973 $aContent = unserialize($aRepostEvent[
'content']);
974 if(isset($aContent[
'type']) && $aContent[
'type'] == $aEvent[
'type'] && isset($aContent[
'object_id']) && (($bSystem && (
int)$aContent[
'object_id'] == (
int)$aEvent[
'object_id']) || (!$bSystem && (
int)$aContent[
'object_id'] == (
int)$aEvent[
'id'])))
975 $this->_oDb->deleteEvent(array(
'id' => (
int)$aRepostEvent[
'id']));
987 $aEvent = $this->_oDb->getEvents(array(
'browse' =>
'id',
'object_id' =>
$iId));
989 if(
empty($aReposted)) {
990 $aContent = unserialize($aEvent[
'content']);
992 $aReposted = $this->_oDb->getReposted($aContent[
'type'], $aContent[
'action'], $aContent[
'object_id']);
993 if(
empty($aReposted) || !is_array($aReposted))
998 $this->_oDb->insertRepostTrack($aEvent[
'id'], $iUserId, $this->
_getAuthorIp(), $aReposted[
'id']);
999 $this->_oDb->updateRepostCounter($aReposted[
'id'], $aReposted[
'reposts']);
1002 $oAlert =
new ChWsbAlerts($this->_oConfig->getAlertSystemName(),
'repost', $aReposted[
'id'], $iUserId, array(
'repost_id' => $aEvent[
'id']));
1013 $sJsObject = $this->_oConfig->getJsObject(
'view');
1024 'message' =>
'_wall_msg_text_empty_message'
1028 $iMaxLength = $this->_oConfig->getCharsDisplayMax();
1029 if(mb_strlen(
$sContent) > $iMaxLength) {
1030 $iLength = mb_strpos(
$sContent,
' ', $iMaxLength);
1032 $sContentMore = trim(mb_substr(
$sContent, $iLength));
1038 'object_id' => $aOwner[
'id'],
1039 'content' => $this->_oTemplate->parseHtmlByName(
'common_text.html', array(
1041 'ch_if:show_more' => array(
1042 'condition' => !
empty($sContentMore),
1044 'js_object' => $sJsObject,
1045 'post_content_more' => $sContentMore
1049 'title' =>
_t(
'_wall_added_title_text',
getNickName($aOwner[
'id'])),
1061 'message' =>
'_wall_msg_link_empty_link'
1065 'thumbnailUrl' => array(
'tag' =>
'link',
'content_attr' =>
'href'),
1066 'OGImage' => array(
'name_attr' =>
'property',
'name' =>
'og:image'),
1068 $sTitle = isset($aSiteInfo[
'title']) ? $aSiteInfo[
'title'] :
$sUrl;
1070 if(isset($aSiteInfo[
'description']))
1071 $sDescription = preg_replace(
'/[^ -\x{2122}]\s+|\s*[^ -\x{2122}]/u',
'', $aSiteInfo[
'description']);
1074 if(!
empty($aSiteInfo[
'thumbnailUrl']))
1075 $sThumbnail = $aSiteInfo[
'thumbnailUrl'];
1076 else if(!
empty($aSiteInfo[
'OGImage']))
1077 $sThumbnail = $aSiteInfo[
'OGImage'];
1078 $bThumbnail = !
empty($sThumbnail);
1081 'object_id' => $aOwner[
'id'],
1082 'content' => $this->_oTemplate->parseHtmlByName(
'common_link.html', array(
1083 'ch_if:show_thumnail' => array(
1084 'condition' => $bThumbnail,
1086 'thumbnail' =>
'{ch_wall_get_image_url}' . urlencode(base64_encode($sThumbnail))
1090 'url' => strpos(
$sUrl,
'http://') ===
false && strpos(
$sUrl,
'https://') ===
false ?
'http://' .
$sUrl :
$sUrl,
1091 'description' => $sDescription
1093 'title' =>
_t(
'_wall_added_title_link',
getNickName($aOwner[
'id'])),
1104 return $this->_oTemplate->getTimeline($iStart,
$iPerPage, $sFilter, $sTimeline,
$aModules);
1108 return $this->_oTemplate->getLoadMore($iStart,
$iPerPage, $bEnabled, $bVisible);
1112 return $this->_oTemplate->getLoadMoreOutline($iStart,
$iPerPage, $bEnabled, $bVisible);
1116 $sJsObject = $this->_oConfig->getJsObject(
'view');
1119 'page_url' =>
'javascript:void(0);',
1121 'count' => $this->_oDb->getEventsCount($this->_iOwnerId, $sFilter, $sTimeline,
$aModules),
1122 'per_page' => $this->_oConfig->getPerPage(),
1123 'on_change_page' => $sJsObject .
'.changePage({start}, {per_page})',
1124 'on_change_per_page' => $sJsObject .
'.changePerPage(this)',
1130 $bPrevious = $bNext =
false;
1132 $iStartEv = $iStart;
1136 if($iStart - 1 >= 0) {
1144 $aEvents = $this->_oDb->getEvents(array(
1145 'browse' =>
'owner',
1146 'owner_id' => $this->_iOwnerId,
1148 'start' => $iStartEv,
1149 'count' => $iPerPageEv,
1150 'filter' => $sFilter,
1151 'timeline' => $sTimeline,
1157 $aEvent = array_shift($aEvents);
1158 $iDays = (int)$aEvent[
'days'];
1163 $aEvent = array_pop($aEvents);
1167 $iEvents = count($aEvents);
1168 $sContent = $this->_oTemplate->getEmpty($iEvents <= 0);
1170 $sContent .= $this->_oTemplate->getDividerToday();
1173 foreach($aEvents
as $aEvent) {
1174 $aEvent[
'content'] = !
empty($aEvent[
'action']) ? $this->_oTemplate->getSystem($aEvent) : $this->_oTemplate->getCommon($aEvent);
1175 if(
empty($aEvent[
'content']))
1179 $sContent .= $this->_oTemplate->getDividerToday($aEvent);
1183 $sContent .= !
empty($aEvent[
'content']) ? $this->_oTemplate->getDivider($iDays, $aEvent) :
'';
1192 $iStartEv = $iStart;
1197 $aEvents = $this->_oDb->getEvents(array(
1200 'start' => $iStartEv,
1201 'count' => $iPerPageEv,
1202 'filter' => $sFilter,
1209 $aEvent = array_pop($aEvents);
1213 $iEvents = count($aEvents);
1214 foreach($aEvents
as $aEvent) {
1215 if(
empty($aEvent[
'action']))
1219 if(
empty($aEvent[
'content']))
1230 if(!method_exists($this, $sGetFormArrayMethod))
1233 $aForm = $this->$sGetFormArrayMethod();
1235 return $oForm->getCode();
1239 $sJsObject = $this->_oConfig->getJsObject(
'post');
1242 'form_attrs' => array(
1243 'name' =>
'WallPostText',
1244 'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'post/',
1246 'enctype' =>
'multipart/form-data',
1247 'target' =>
'WallPostIframe',
1248 'onsubmit' =>
'javascript:return ' . $sJsObject .
'.postSubmit(this);'
1252 'type' =>
'textarea',
1253 'name' =>
'content',
1260 'value' =>
_t(
'_wall_post'),
1272 $aForm[
'inputs'][
'WallOwnerId'][
'value'] = 0;
1278 if(!method_exists($this, $sGetFormArrayMethod))
1281 $aForm = $this->$sGetFormArrayMethod();
1283 return $oForm->getCode();
1287 $sJsObject = $this->_oConfig->getJsObject(
'post');
1290 'form_attrs' => array(
1291 'name' =>
'WallPostLink',
1292 'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'post/',
1294 'enctype' =>
'multipart/form-data',
1295 'target' =>
'WallPostIframe',
1296 'onsubmit' =>
'javascript:return ' . $sJsObject .
'.postSubmit(this);'
1302 'caption' =>
_t(
'_wall_link_url'),
1307 'value' =>
_t(
'_wall_post'),
1319 $aForm[
'inputs'][
'WallOwnerId'][
'value'] = 0;
1329 if(in_array($aEvent[
'type'], array(
'profile',
'friend')) || in_array($aEvent[
'action'], array(
'commentPost',
'comment_add')))
1332 $sType = $aEvent[
'type'];
1334 $iObjectId = $aEvent[
'object_id'];
1335 if($this->_oConfig->isGrouped(
$sType,
$sAction, $iObjectId) || $this->_oConfig->isGroupedObject($iObjectId))
1339 if($oVoting->isEnabled())
1347 return new ChWallVoting($this->_oConfig->getVotingSystemName(), $iEventId);
1353 'WallOwnerId' => array (
1355 'name' =>
'WallOwnerId',
1356 'value' => $this->_iOwnerId,
1358 'WallPostAction' => array (
1360 'name' =>
'WallPostAction',
1363 'WallPostType' => array (
1365 'name' =>
'WallPostType',
1366 'value' => $sPostType,
1368 'WallContentType' => array (
1370 'name' =>
'WallContentType',
1371 'value' => $sContentType,
1378 return $oPrivacy->check(
'view', $this->_iOwnerId, $this->
_getAuthorId());
1386 if($iAuthorId == 0 &&
getParam(
'wall_enable_guest_comments') ==
'on')
1389 if(
isBlocked($this->_iOwnerId, $iAuthorId))
1392 $aCheckResult =
checkAction($iAuthorId, ACTION_ID_TIMELINE_POST_COMMENT, $bPerform);
1404 $sCommonPostPrefix = $this->_oConfig->getCommonPostPrefix();
1405 if((
int)$aEvent[
'owner_id'] == $iUserId || (strpos($aEvent[
'type'], $sCommonPostPrefix) === 0 && (int)$aEvent[
'object_id'] == $iUserId))
1408 $aCheckResult =
checkAction($iUserId, ACTION_ID_TIMELINE_DELETE_COMMENT, $bPerform);
1416 $bSystem = $this->_oConfig->isSystem($aEvent[
'type'], $aEvent[
'action']);
1417 if($bSystem && strcmp($aEvent[
'action'],
'commentPost') === 0)
1424 if(($bSystem && (
int)$aEvent[
'owner_id'] == $iUserId) || (!$bSystem && (int)$aEvent[
'object_id'] == $iUserId))
1427 $aCheckResult =
checkAction($iUserId, ACTION_ID_TIMELINE_REPOST, $bPerform);
1444 header(
'Content-type: text/html; charset=utf-8');
1446 $s = json_encode($a);
1447 if ($isAutoWrapForFormFileSubmit && !
empty($_FILES))
1448 $s =
'<textarea>' .
$s .
'</textarea>';