function onPostDelete($aTopic, $iPostId, $sUser) { $oProfile = new BxDolProfile($sUser); $fdb = new DbForum(); $aPost = $fdb->getPost($iPostId, false); if (BX_ORCA_INTEGRATION == 'dolphin' && $sUser != $aPost['user'] && !isAdmin($oProfile->getID())) { defineForumActions(); checkAction($oProfile->getID(), BX_FORUM_DELETE_ALL, true); // perform action } forumAlert('edit_del', $iPostId, $oProfile->getID(), array('post' => $aPost)); }
/** * returns single post XML * @param $post_id post id * @param $force_show force show hidden post */ function getHiddenPostXML($post_id, $force_show) { global $gConf; $post_id = (int) $post_id; if (!$post_id) { return false; } $ui = array(); $fdb = new DbForum(); $topic_id = $fdb->getTopicIdByPostId($post_id); $forum_id = $fdb->getForumIdByPostId($post_id); // check user permission to read this topic posts $forum_type = $fdb->getForumTypeByTopicId($topic_id); if (!$this->_checkUserPerm('', $forum_type, 'read')) { return $this->_no_access(); } // check user permissions to delete or edit posts $gl_allow_edit = 0; $gl_allow_del = 0; if ($this->_checkUserPerm('', $forum_type, 'edit')) { $gl_allow_edit = 1; } if ($this->_checkUserPerm('', $forum_type, 'del')) { $gl_allow_del = 1; } $u = $this->_getLoginUser(); $r = $fdb->getPost($post_id, $u); // acquire user info if (!$ui[$r['user']]) { $aa = $this->_getUserInfo($r['user']); $ui[$r['user']] = array('posts' => (int) $fdb->getUserPosts($r['user']), 'avatar' => $aa['avatar'], 'url' => $aa['profile_url'], 'onclick' => $aa['profile_onclick']); } $allow_edit = $gl_allow_edit; $allow_del = $gl_allow_del; if (!$allow_edit && $r['user'] == $this->_getLoginUserName()) { if ($this->_checkUserPerm($r['user'], 'own', 'edit')) { $allow_edit = 1; } } if (!$allow_del && $r['user'] == $this->_getLoginUserName()) { if ($this->_checkUserPerm($r['user'], 'own', 'del')) { $allow_del = 1; } } $cu = $this->getUrlsXml(); encode_post_text($r['post_text']); return <<<EOF <root> {$cu} <forum><id>{$forum_id}</id></forum> <topic><id>{$topic_id}</id></topic> <post id="{$r['post_id']}" force_show="{$force_show}"> \t<text>{$r['post_text']}</text> \t<when>{$r['when']}</when> \t<allow_edit>{$allow_edit}</allow_edit> \t<allow_del>{$allow_del}</allow_del> \t<points>{$r['votes']}</points> \t<vote_user_point>{$r['vote_user_point']}</vote_user_point>\t \t<user posts="{$ui[$r['user']]['posts']}" name="{$r['user']}"> \t\t<avatar>{$ui[$r['user']]['avatar']}</avatar> \t\t<url>{$ui[$r['user']]['url']}</url> \t\t<onclick>{$ui[$r['user']]['onclick']}</onclick> \t</user> \t<min_point>{$gConf['min_point']}</min_point> </post> </root> EOF; }