Cheetah
ChWallResponse.php
Go to the documentation of this file.
1 <?php
2 
8 require_once(CH_DIRECTORY_PATH_CLASSES . 'ChWsbAlerts.php');
9 
11 {
12  var $_oModule;
13 
19  {
20  parent::__construct();
21 
22  $this->_oModule = $oModule;
23  }
29  function response($oAlert)
30  {
31  $bFromWall = !empty($oAlert->aExtras) && (int)$oAlert->aExtras['from_wall'] == 1;
32  if(is_array($oAlert->aExtras) && isset($oAlert->aExtras['privacy_view']) && $oAlert->aExtras['privacy_view'] == CH_WSB_PG_HIDDEN)
33  return;
34 
35  if($bFromWall) {
36  $this->_oModule->_iOwnerId = (int)$oAlert->aExtras['owner_id'];
37  $sMedia = $this->_oModule->_oConfig->getCommonType($oAlert->sUnit);
38  $aMedia = $this->_oModule->_oTemplate->_getCommonMedia($sMedia, $oAlert->iObject);
39 
40  $iOwnerId = $this->_oModule->_iOwnerId;
41  $iObjectId = $this->_oModule->_getAuthorId();
42  $sType = $this->_oModule->_oConfig->getCommonPostPrefix() . $sMedia;
43  $sAction = '';
44  $sContent = serialize(array('type' => $sMedia, 'id' => $oAlert->iObject));
45  $sTitle = $aMedia['title'];
46  $sDescription = $aMedia['description'];
47  }
48  else if($this->_oModule->_oConfig->isSystemComment($oAlert->sUnit, $oAlert->sAction)) {
49  $sType = $oAlert->aExtras['object_system'];
50  $sAction = $oAlert->sUnit . '_' . $oAlert->sAction;
51  if(!$this->_oModule->_oConfig->isHandler($sType . '_' . $sAction))
52  return;
53 
54  $iOwnerId = $oAlert->iSender;
55  $iObjectId = $oAlert->iObject;
56  $sContent = serialize(array('object_id' => $oAlert->aExtras['object_id']));
57  $sTitle = $sDescription = '';
58  }
59  else {
60  $iOwnerId = $oAlert->iSender;
61  $iObjectId = $oAlert->iObject;
62  $sType = $oAlert->sUnit;
63  $sAction = $oAlert->sAction;
64  $sContent = is_array($oAlert->aExtras) && !empty($oAlert->aExtras) ? serialize($oAlert->aExtras) : '';
65  $sTitle = $sDescription = '';
66  }
67 
68  if($oAlert->sUnit == 'profile' && $oAlert->sAction == 'delete') {
69  $this->_oModule->_oDb->deleteEvent(array('owner_id' => $oAlert->iObject));
70  $this->_oModule->_oDb->deleteEventCommon(array('object_id' => $oAlert->iObject));
71 
72  //delete all subscriptions
74  $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => 'ch_wall', 'object_id' => $oAlert->iObject));
75  return;
76  }
77 
78  if($oAlert->sUnit == 'profile' && $oAlert->sAction == 'edit' && $iOwnerId != $iObjectId) {
79  return;
80  }
81 
82  $iId = $this->_oModule->_oDb->insertEvent(array(
83  'owner_id' => $iOwnerId,
84  'object_id' => $iObjectId,
85  'type' => $sType,
86  'action' => $sAction,
89  'description' => process_db_input($sDescription, CH_TAGS_NO_ACTION, CH_SLASHES_NO_ACTION),
90  ));
91 
92  if($bFromWall)
93  echo "<script>parent." . $this->_oModule->_oConfig->getJsObject('post') . "._getPost(null, " . $iId . ")</script>";
94  else
95  $this->_oModule->_oDb->updateSimilarObject($iId, $oAlert);
96  }
97 }
ChWallResponse\__construct
__construct($oModule)
Definition: ChWallResponse.php:18
ChWsbAlertsResponse
Definition: ChWsbAlerts.php:127
process_db_input
process_db_input($sText, $iStripTags=0)
Definition: utils.inc.php:256
ChWallResponse\$_oModule
$_oModule
Definition: ChWallResponse.php:12
$oModule
if(! @isAdmin()) $oModule
Definition: admin.php:25
ChWallResponse\response
response($oAlert)
Definition: ChWallResponse.php:29
$oAlert
$oAlert
Definition: embed.php:15
php
CH_WSB_PG_HIDDEN
const CH_WSB_PG_HIDDEN
Definition: ChWsbPrivacy.php:17
$iId
$iId
Definition: license.php:15
ChWsbSubscription\getInstance
static getInstance()
Definition: ChWsbSubscription.php:67
ChWallResponse
Definition: ChWallResponse.php:11
CH_SLASHES_NO_ACTION
const CH_SLASHES_NO_ACTION
Definition: utils.inc.php:30
$sType
$sType
Definition: actions.inc.php:11
$sTitle
$sTitle
Definition: actions.inc.php:13
CH_TAGS_NO_ACTION
const CH_TAGS_NO_ACTION
Definition: utils.inc.php:21
$sContent
$sContent
Definition: bottom_menu_compose.php:169
$sAction
$sAction
Definition: categories.php:274
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
$oSubscription
$oSubscription
Definition: notifies.php:28