Cheetah
All Classes Namespaces Files Functions Variables Pages
customFunctions.inc.php
Go to the documentation of this file.
1 <?php
2 
8 function post($sSystem, $iId, $iCmtAuthorId, $iCmtParentId, $iMood, $sFileId)
9 {
13 
14  $iId = (int)$iId;
15  $iCmtParentId = (int)$iCmtParentId;
16  $iMood = (int)$iMood;
17 
18  ch_import ('ChWsbCmts');
19  $oCmts = ChWsbCmts::getObjectInstance($sSystem, $iId);
20  if (!$oCmts)
21  return 0;
22 
23  $sText = '<iframe width="100%" height="240" src="[ray_url]modules/video_comments/embed.php?id=' . $sFileId . '" frameborder="0" allowfullscreen></iframe>';
24 
25  $mixedOverrideResult = null;
26  $oAlert = new ChWsbAlerts('ch_video_comments', 'post', $sFileId, getLoggedId(), array(
27  'override' => &$mixedOverrideResult,
28  'text' => &$sText,
29  'file_id' => &$sFileId,
30  'object_id' => &$iId,
31  'author' => &$iCmtAuthorId,
32  'parent_id' => &$iCmtParentId,
33  'mood' => &$iMood,
34  ));
35  $oAlert->alert();
36 
37  if (null !== $mixedOverrideResult)
38  return $mixedOverrideResult;
39 
40  $iCmtNewId = $oCmts->_oQuery->addComment ($iId, $iCmtParentId, $iCmtAuthorId, $sText, $iMood);
41 
42  if(false === $iCmtNewId)
43  return 0;
44 
45  ch_import('ChWsbAlerts');
46  $oZ = new ChWsbAlerts($sSystem, 'commentPost', $oCmts->getId(), $oCmts->_getAuthorId(), array('comment_id' => $iCmtNewId, 'comment_author_id' => $iCmtAuthorId));
47  $oZ->alert();
48 
49  $oCmts->_triggerComment();
50 
51  return $iCmtNewId;
52 }
53 
54 function deleteFileByCommentId($iCommentId)
55 {
57  $sDBModule = DB_PREFIX . ucfirst($sModule);
58 
59  $iId = (int)getValue("SELECT `ID` FROM `" . $sDBModule . "Files` WHERE `Description`='" . $iCommentId . "' LIMIT 1");
60  if($iId > 0)
62 }
$sIncPath
$sIncPath
Definition: header.inc.php:64
post
post($sTable, $sId, $sAuthor, $sParent, $sMood, $sFileId)
Definition: customFunctions.inc.php:8
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
$oAlert
$oAlert
Definition: embed.php:15
$sHomeUrl
$sHomeUrl
Definition: header.inc.php:41
php
$oZ
$oZ
Definition: db.php:20
getValue
getValue($sQuery)
Definition: db.inc.php:59
$iId
$iId
Definition: license.php:15
$sModule
if(!file_exists($sRayHeaderPath)) $sModule
Definition: index.php:14
ChWsbCmts\getObjectInstance
static getObjectInstance($sSys, $iId, $iInit=true)
Definition: ChWsbCmts.php:154
ChWsbAlerts
Definition: ChWsbAlerts.php:39
getLoggedId
getLoggedId()
Definition: profiles.inc.php:32
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
_deleteFile
_deleteFile($sFile)
Definition: functions.inc.php:240
deleteFileByCommentId
deleteFileByCommentId($iCommentId)
Definition: customFunctions.inc.php:54
$sDBModule
$sDBModule
Definition: header.inc.php:26