本文整理汇总了PHP中Phpfox::callback方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox::callback方法的具体用法?PHP Phpfox::callback怎么用?PHP Phpfox::callback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phpfox
的用法示例。
在下文中一共展示了Phpfox::callback方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
$iRsvp = $this->request()->get('rsvp', 1);
$iPage = $this->request()->getInt('page');
$sModule = $this->request()->get('module', false);
$iItem = $this->request()->getInt('item', false);
$aCallback = $this->getParam('aCallback', false);
$iPageSize = 6;
if (PHPFOX_IS_AJAX) {
$aCallback = false;
if ($sModule && $iItem && Phpfox::hasCallback($sModule, 'getEventInvites')) {
$aCallback = Phpfox::callback($sModule . '.getEventInvites', $iItem);
}
$aEvent = Phpfox::getService('event')->callback($aCallback)->getEvent($this->request()->get('id'), true);
$this->template()->assign('aEvent', $aEvent);
} else {
$aEvent = $this->getParam('aEvent');
$this->template()->assign('aEvent', $aEvent);
}
if ($aCallback !== false) {
$sModule = $aCallback['module'];
$iItem = $aCallback['item'];
}
list($iCnt, $aInvites) = Phpfox::getService('event')->getInvites($aEvent['event_id'], $iRsvp, $iPage, $iPageSize);
Phpfox::getLib('pager')->set(array('ajax' => 'event.listGuests', 'page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt, 'aParams' => array('id' => $aEvent['event_id'], 'module' => $sModule, 'item' => $iItem, 'rsvp' => $iRsvp)));
$this->template()->assign(array('aInvites' => $aInvites, 'iRsvp' => $iRsvp));
if (!PHPFOX_IS_AJAX) {
$sExtra = '';
if ($aCallback !== false) {
$sExtra .= '&module=' . $aCallback['module'] . '&item=' . $aCallback['item'];
}
$this->template()->assign(array('sHeader' => Phpfox::getPhrase('event.event_guests'), 'aMenu' => array(Phpfox::getPhrase('event.attending') => '#event.listGuests?rsvp=1&id=' . $aEvent['event_id'] . $sExtra, Phpfox::getPhrase('event.maybe') => '#event.listGuests?rsvp=2&id=' . $aEvent['event_id'] . $sExtra, Phpfox::getPhrase('event.can_t_make_it') => '#event.listGuests?rsvp=3&id=' . $aEvent['event_id'] . $sExtra, Phpfox::getPhrase('event.not_responded') => '#event.listGuests?rsvp=0&id=' . $aEvent['event_id'] . $sExtra), 'sBoxJsId' => 'event_guests'));
return 'block';
}
}
示例2: process
/**
* Controller
*/
public function process()
{
Phpfox::getUserParam('comment.can_moderate_comments', true);
$iPage = $this->request()->getInt('page');
$aPages = array(20, 30, 40, 50);
$aDisplays = array();
foreach ($aPages as $iPageCnt) {
$aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt));
}
$aFilters = array('search' => array('type' => 'input:text', 'search' => "AND ls.name LIKE '%[VALUE]%'"), 'display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '20'), 'sort' => array('type' => 'select', 'options' => array('time_stamp' => Phpfox::getPhrase('comment.last_activity'), 'rating ' => Phpfox::getPhrase('comment.rating')), 'default' => 'time_stamp', 'alias' => 'cmt'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC'));
$oSearch = Phpfox_Search::instance()->set(array('type' => 'comments', 'filters' => $aFilters, 'search' => 'search'));
if ($this->request()->get('view') == 'approval') {
$oSearch->setCondition('AND cmt.view_id = 1');
} else {
$oSearch->setCondition('AND cmt.view_id = 9');
}
list($iCnt, $aComments) = Phpfox::getService('comment')->get('cmt.*', $oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $oSearch->getDisplay(), null, true);
foreach ($aComments as $iKey => $aComment) {
if (Phpfox::hasCallback($aComment['type_id'], 'getItemName')) {
$aComments[$iKey]['item_name'] = Phpfox::callback($aComment['type_id'] . '.getItemName', $aComment['comment_id'], $aComment['owner_full_name']);
}
}
Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $oSearch->getDisplay(), 'count' => $oSearch->getSearchTotal($iCnt)));
$this->template()->setTitle(Phpfox::getPhrase('comment.comment_title'))->setBreadcrumb(Phpfox::getPhrase('comment.comment_title'), $this->url()->makeUrl('admincp.comment'))->setHeader('cache', array('comment.css' => 'style_css', 'pager.css' => 'style_css'))->assign(array('aComments' => $aComments, 'bIsCommentAdminPanel' => true));
}
示例3: getMessages
/**
* Get the latest shoutouts.
*
* @param int $iLimit Define the limit so we don't return all the shoutouts.
* @return array Array of shoutouts.
*/
public function getMessages($iLimit = 5)
{
if (isset($this->_aCallback['module'])) {
if (Phpfox::hasCallback($this->_aCallback['module'], 'getShoutboxData')) {
$aCallback = Phpfox::callback($this->_aCallback['module'] . '.getShoutboxData');
if (isset($aCallback['table'])) {
$this->_sTable = Phpfox::getT($aCallback['table']);
$this->database()->where('item_id = ' . (int) $this->_aCallback['item']);
}
}
}
$aMessages = $this->database()->select('s.shout_id, s.text, s.time_stamp, ' . Phpfox::getUserField())->from($this->_sTable, 's')->join(Phpfox::getT('user'), 'u', 'u.user_id = s.user_id')->limit($iLimit)->order('s.time_stamp DESC')->execute('getSlaveRows');
foreach ($aMessages as $iKey => $aMessage) {
$aMessage['text'] = Phpfox::getLib('parse.output')->replaceHashTags(Phpfox::getLib('parse.output')->split(Phpfox::getLib('parse.output')->clean($aMessage['text']), Phpfox::getParam('shoutbox.shoutbox_wordwrap')));
if (Phpfox::isModule('emoticon')) {
$aMessages[$iKey]['text'] = Phpfox::getService('emoticon')->parse($aMessage['text']);
}
$aMessages[$iKey]['module'] = isset($this->_aCallback['module']) ? $this->_aCallback['module'] : '';
}
// FUDGE Lovinity January 5, 2016: Filter shouts by users who have been blocked or are blocking
$bIsBlocked = Phpfox::getService('user.block')->isBlocked($aMessages[$iKey]['user_id'], Phpfox::getUserId());
$bIsBlocked2 = Phpfox::getService('user.block')->isBlocked(Phpfox::getUserId(), $aMessages[$iKey]['user_id']);
if ($bIsBlocked || $bIsBlocked2) {
$aMessages[$iKey]['text'] = '<img src="file/public/blocked.png">';
}
// END FUDGE
return $aMessages;
}
示例4: process
/**
* Controller
*/
public function process()
{
Phpfox::isUser(true);
if ($this->request()->getInt('forum')) {
$aForum = Phpfox::getService('forum')->id($this->request()->getInt('forum'))->getForum();
if (!isset($aForum['forum_id'])) {
return Phpfox_Error::display(Phpfox::getPhrase('forum.not_a_valid_forum'));
}
if (Phpfox::getService('forum.thread.process')->markRead($aForum['forum_id'])) {
$this->url()->send('forum', array($aForum['name_url'] . '-' . $aForum['forum_id']), Phpfox::getPhrase('forum.forum_successfully_marked_as_read'));
}
} elseif (($sModule = $this->request()->get('module')) && ($iItemId = $this->request()->getInt('item'))) {
$aCallback = Phpfox::callback($sModule . '.addForum', $iItemId);
if (isset($aCallback['module'])) {
if (Phpfox::getService('forum.thread.process')->markRead(0, $aCallback['item'])) {
$this->url()->send($aCallback['url_home'], array('forum'), Phpfox::getPhrase('forum.forum_successfully_marked_as_read'));
}
}
} else {
$aForums = Phpfox::getService('forum')->live()->getForums();
foreach ($aForums as $aForum) {
Phpfox::getService('forum.thread.process')->markRead($aForum['forum_id']);
$aChildrens = Phpfox::getService('forum')->id($aForum['forum_id'])->getChildren();
if (!is_array($aChildrens)) {
continue;
}
foreach ($aChildrens as $iForumid) {
Phpfox::getService('forum.thread.process')->markRead($iForumid);
}
}
$this->url()->send('forum', null, Phpfox::getPhrase('forum.forum_successfully_marked_as_read'));
}
}
示例5: getMessages
/**
* Get the latest shoutouts.
*
* @param int $iLimit Define the limit so we don't return all the shoutouts.
* @return array Array of shoutouts.
*/
public function getMessages($iLimit = 5)
{
if (isset($this->_aCallback['module']))
{
if (Phpfox::hasCallback($this->_aCallback['module'], 'getShoutboxData'))
{
$aCallback = Phpfox::callback($this->_aCallback['module'] . '.getShoutboxData');
if (isset($aCallback['table']))
{
$this->_sTable = Phpfox::getT($aCallback['table']);
$this->database()->where('item_id = ' . (int) $this->_aCallback['item']);
}
}
}
$aMessages = $this->database()->select('s.shout_id, s.text, s.time_stamp, ' . Phpfox::getUserField())
->from($this->_sTable, 's')
->join(Phpfox::getT('user'), 'u', 'u.user_id = s.user_id')
->limit($iLimit)
->order('s.time_stamp DESC')
->execute('getSlaveRows');
foreach ($aMessages as $iKey => $aMessage)
{
$aMessage['text'] = Phpfox::getLib('parse.output')->split(Phpfox::getLib('parse.output')->clean($aMessage['text']), Phpfox::getParam('shoutbox.shoutbox_wordwrap'));
$aMessages[$iKey]['text'] = Phpfox::getService('emoticon')->parse($aMessage['text']);
$aMessages[$iKey]['module'] = (isset($this->_aCallback['module']) ? $this->_aCallback['module'] : '');
}
return $aMessages;
}
示例6: query
public function query($sQuery, $iPage, $iTotalShow, $sView = null)
{
if ($sView !== null && Phpfox::isModule($sView))
{
$aModuleResults = Phpfox::callback($sView . '.globalUnionSearch', $this->preParse()->clean($sQuery));
}
else
{
$aModuleResults = Phpfox::massCallback('globalUnionSearch', $this->preParse()->clean($sQuery));
}
$iOffset = ($iPage * $iTotalShow);
$aRows = $this->database()->select('item.*, ' . Phpfox::getUserField())
->unionFrom('item')
->join(Phpfox::getT('user'), 'u', 'u.user_id = item.item_user_id')
->limit($iOffset, $iTotalShow)
->order('item_time_stamp DESC')
->execute('getSlaveRows');
$aResults = array();
foreach ($aRows as $iKey => $aRow)
{
$aResults[] = array_merge($aRow, (array) Phpfox::callback($aRow['item_type_id'] . '.getSearchInfo', $aRow));
}
return $aResults;
}
示例7: process
/**
* Controller
*/
public function process()
{
if ($iCommentId = $this->request()->getInt('req3')) {
$aComment = Phpfox::getService('comment')->getComment($iCommentId);
if (!isset($aComment['comment_id'])) {
return Phpfox_Error::display(Phpfox::getPhrase('comment.comment_does_not_exist'));
}
if (Phpfox::hasCallback('comment', 'getRedirectRequest')) {
$this->url()->forward(Phpfox::callback('comment.getRedirectRequest', $aComment['comment_id']));
}
if (Phpfox::hasCallback($aComment['type_id'], 'getParentItemCommentUrl')) {
$sNewUrl = Phpfox::callback($aComment['type_id'] . '.getParentItemCommentUrl', $aComment);
if ($sNewUrl !== false) {
$aComment['callback_url'] = $sNewUrl;
}
}
$this->template()->setTitle(Phpfox::getPhrase('comment.viewing_comment'))->setHeader(array('view.css' => 'module_comment'))->setBreadcrumb(Phpfox::getPhrase('comment.viewing_comment'))->assign(array('aComment' => $aComment));
} else {
$aComment = Phpfox::getService('comment')->getComment($this->request()->getInt('id'));
if (!isset($aComment['comment_id'])) {
return Phpfox_Error::display(Phpfox::getPhrase('comment.comment_does_not_exist'));
}
$this->url()->forward(Phpfox::callback('comment.getRedirectRequest', $aComment['comment_id']));
}
}
示例8: add
public function add($aRating)
{
Phpfox::isUser(true);
if (!is_array($aRating)) {
return Phpfox_Error::set(Phpfox::getPhrase('rate.not_a_valid_post'));
}
$sModule = $aRating['type'];
$sExtra = '';
if (strpos($aRating['type'], '_')) {
$aParts = explode('_', $aRating['type']);
$sModule = $aParts[0];
$sExtra = ucfirst($aParts[1]);
}
$aCallback = Phpfox::callback($sModule . '.getRatingData' . $sExtra, $aRating['item_id']);
$aRow = $this->database()->select($aCallback['field'] . ', user_id')->from(Phpfox::getT(isset($aCallback['check_table']) ? $aCallback['check_table'] : $aCallback['table']))->where($aCallback['field'] . ' = ' . (int) $aRating['item_id'])->execute('getSlaveRow');
if (!isset($aRow[$aCallback['field']])) {
return Phpfox_Error::set(Phpfox::getPhrase('rate.not_a_valid_item_to_rate'));
}
if ($aRow['user_id'] == Phpfox::getUserId()) {
return Phpfox_Error::set(Phpfox::getPhrase('rate.sorry_you_are_not_able_to_rate_your_own_item'));
}
$iIsRated = $this->database()->select('COUNT(*)')->from(Phpfox::getT($aCallback['table_rating']))->where('item_id = ' . (int) $aRating['item_id'] . ' AND user_id = ' . Phpfox::getUserId())->execute('getSlaveField');
if (!$iIsRated) {
$aParts = explode('|', $aRating['star']);
$iId = $this->database()->insert(Phpfox::getT($aCallback['table_rating']), array('item_id' => $aRating['item_id'], 'user_id' => Phpfox::getUserId(), 'rating' => (int) $aParts[0], 'time_stamp' => PHPFOX_TIME));
$aAverage = $this->database()->select('COUNT(*) AS count, AVG(rating) AS average_rating')->from(Phpfox::getT($aCallback['table_rating']))->where('item_id = ' . (int) $aRating['item_id'])->execute('getRow');
$this->database()->update(Phpfox::getT($aCallback['table']), array('total_score' => round($aAverage['average_rating']), 'total_rating' => $aAverage['count']), $aCallback['field'] . ' = ' . (int) $aRating['item_id']);
return $iId;
}
return Phpfox_Error::set(Phpfox::getPhrase('rate.you_have_already_voted_on_this_item'));
}
示例9: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
$sUrl = Phpfox::callback($this->request()->get('req3') . '.getRedirectRequest', $this->request()->get('id'));
if ($sUrl === false) {
return Phpfox_Error::display(Phpfox::getPhrase('request.invalid_request_redirect'));
}
$this->url()->forward($sUrl);
}
示例10: delete
public function delete($sType, $iItemId)
{
$this->database()->delete(Phpfox::getT('like'), 'type_id = \'' . $this->database()->escape($sType) . '\' AND item_id = ' . (int) $iItemId . ' AND user_id = ' . Phpfox::getUserId());
Phpfox::callback($sType . '.deleteLike', $iItemId);
return true;
}
示例11: paymentApiCallback
/**
* Handles API callback for payment gateways.
*
* @param array $aParams ARRAY of params passed from the payment gateway after a payment has been made.
* @return bool|null FALSE if payment is not valid|Nothing returned if everything went well.
*/
public function paymentApiCallback($aParams)
{
Phpfox::log('Module callback recieved: ' . var_export($aParams, true));
Phpfox::log('Attempting to retrieve purchase from the database');
define('PHPFOX_API_CALLBACK', true);
// used to override security checks in the processes
if (preg_match('/sponsor/i', $aParams['item_number'])) {
// we get the sponsored ad
$iId = preg_replace("/[^0-9]/", '', $aParams['item_number']);
Phpfox::log('Ad is sponsored');
$aInvoice = $this->database()->select('*')->from(Phpfox::getT('ad_invoice'))->where('invoice_id = ' . $iId . ' AND is_sponsor = 1')->execute('getSlaveRow');
$aAd = Phpfox::getService('ad')->getSponsor($aInvoice['ad_id']);
} else {
$aAd = Phpfox::getService('ad')->getForEdit($aParams['item_number']);
$aInvoice = Phpfox::getService('ad')->getInvoice($aAd['ad_id']);
}
if (empty($aAd) || $aAd === false) {
Phpfox::log('Purchase is not valid');
return false;
}
if (empty($aInvoice) || $aInvoice === false) {
Phpfox::log('Not a valid invoice');
return false;
}
Phpfox::log('Purchase is valid: ' . var_export($aInvoice, true));
if ($aParams['status'] == 'completed') {
if ($aParams['total_paid'] == $aInvoice['price']) {
Phpfox::log('Paid correct price');
} else {
Phpfox::log('Paid incorrect price');
return false;
}
} else {
Phpfox::log('Payment is not marked as "completed".');
return false;
}
Phpfox::log('Handling purchase');
$this->database()->update(Phpfox::getT('ad_invoice'), array('status' => $aParams['status'], 'time_stamp_paid' => PHPFOX_TIME), 'invoice_id = ' . $aInvoice['invoice_id']);
if (isset($aAd['auto_publish'])) {
// its a sponsor ad
$this->database()->update(Phpfox::getT('ad_sponsor'), array('is_custom' => $aAd['auto_publish'] == 1 ? '3' : '2', 'is_active' => $aAd['auto_publish'] == 1 ? '1' : '0'), 'sponsor_id = ' . $aAd['sponsor_id']);
if ($aAd['auto_publish'] == 1) {
$sModule = $aAd['module_id'];
$sSection = '';
if (strpos($sModule, '-') !== false) {
$aModule = explode('-', $sModule);
$sModule = $aModule[0];
$sSection = $aModule[1];
}
Phpfox::callback($sModule . '.enableSponsor', array('item_id' => $aAd['item_id'], 'section' => $sSection));
}
} else {
$this->database()->update(Phpfox::getT('ad'), array('is_custom' => '2'), 'ad_id = ' . $aAd['ad_id']);
}
$this->cache()->remove('ad', 'substr');
Phpfox::log('Handling complete');
}
示例12: process
public function process()
{
Phpfox::getLib('setting')->setParam(array('profiles.url_image' => Phpfox::getParam('core.url_pic') . 'profiles/'));
$mUser = $this->request()->get('req2');
$sSection = $this->request()->get('req3');
$bIsPublicItemView = false;
if (Phpfox::isPublicView()) {
if (!empty($sSection) && Phpfox::isModule($sSection) && $sSection != 'designer' && Phpfox::hasCallback($sSection, 'getItemView') && Phpfox::callback($sSection . '.getItemView') === true) {
$bIsPublicItemView = true;
}
}
if (!$mUser) {
if (Phpfox::isUser()) {
$this->url()->send('profile');
} else {
Phpfox::isUser(true);
}
}
// If we are unable to find a user lets make sure we return a 404 page not found error
$aExtraProfile = Phpfox::getService('profiles')->getProfile($mUser);
if (count($aExtraProfile) == 0) {
return Phpfox::getLib('module')->setController('error.404');
}
$aUser = Phpfox::getService('user')->get($aExtraProfile['user_id']);
$this->setParam('aExtraProfile', $aExtraProfile);
$this->template()->assign(array('aExtraProfile' => $aExtraProfile));
if (Phpfox::getService('user.block')->isBlocked($aExtraProfile['user_id'], Phpfox::getUserId()) && !Phpfox::getUserParam('user.can_override_user_privacy')) {
$this->url()->send($aUser['user_name']);
}
if (!Phpfox::getService('user.privacy')->hasAccess($aExtraProfile['user_id'], 'profile.view_profile')) {
$this->url()->send($aUser['user_name']);
}
//This is where I want to add $this->request()->get('req3') == gallery
if (!empty($sSection) && $sSection == 'photo') {
Phpfox::getLib('module')->setController('profiles.view');
}
Phpfox::getUserParam('profile.can_view_users_profile', true);
$this->template()->setHeader('cache', array('profile.css' => 'style_css', 'feed.js' => 'module_feed'));
$this->template()->setMeta('description', Phpfox::getPhrase('profiles.meta_description', array('extra_name' => $aExtraProfile['title'], 'site_title' => Phpfox::getParam('core.site_title'), 'meta_description_profile' => Phpfox::getParam('core.meta_description_profile'))));
$sPageTitle = $aExtraProfile['title'];
$this->setParam('aFeed', array('comment_type_id' => 'profiles', 'privacy' => 0, 'comment_privacy' => 0, 'item_id' => $aExtraProfile['extra_id'], 'like_type_id' => 'profiles', 'feed_is_liked' => isset($aExtraProfile['is_liked']) ? $aExtraProfile['is_liked'] : false, 'user_id' => $aExtraProfile['user_id'], 'total_comment' => $aExtraProfile['total_comment'], 'total_like' => 0, 'feed_link' => $this->url()->makeUrl('profiles', $aExtraProfile['title_url']), 'feed_title' => $aExtraProfile['title'], 'feed_display' => 'view', 'report_module' => 'profiles', 'report_phrase' => Phpfox::getPhrase('profiles.report_this_profile')));
if ($this->request()->get('req3') != 'photo') {
$this->template()->setBreadcrumb($sPageTitle, Phpfox::getLib('url')->makeUrl('profiles.browse'));
} elseif ($this->request()->get('req3') == '') {
$this->template()->setBreadcrumb(Phpfox::getPhrase('profiles.extra_profiles'), Phpfox::getLib('url')->makeUrl('profiles.browse'));
}
$this->template()->setTitle($sPageTitle)->setEditor(array('load' => 'simple', 'wysiwyg' => Phpfox::isModule('comment') && Phpfox::getParam('comment.wysiwyg_comments') && Phpfox::getUserParam('comment.wysiwyg_on_comments')))->setUrl('profiles')->setHeader('cache', array('comment.css' => 'style_css', 'pager.css' => 'style_css', 'jquery/plugin/jquery.scrollTo.js' => 'static_script', 'quick_edit.js' => 'static_script', 'jquery/plugin/jquery.highlightFade.js' => 'static_script'));
if ($this->request()->get('update')) {
$this->template()->setHeader('<script type="text/javascript">window.parent.tb_remove();</script>');
}
if ($sPlugin = Phpfox_Plugin::get('profiles.component_controller_index_end')) {
eval($sPlugin);
if (isset($mReturnFromPlugin)) {
return $mReturnFromPlugin;
}
}
}
示例13: getRedirect
public function getRedirect($iId)
{
$aReport = $this->database()->select('data_id, item_id')->from(Phpfox::getT('report_data'))->where('data_id = ' . (int) $iId)->execute('getRow');
if (!isset($aReport['data_id'])) {
return Phpfox_Error::set(Phpfox::getPhrase('report.not_a_valid_report'));
}
$aParts = explode('_', $aReport['item_id']);
return Phpfox::callback($aParts[0] . '.getReportRedirect' . (isset($aParts[2]) ? ucfirst($aParts[1]) : ''), $aParts[count($aParts) - 1]);
}
示例14: add
public function add($aVals, $aCallback = false, $aExtra = array())
{
$aThread = $this->database()->select('*')->from(Phpfox::getT('forum_thread'))->where('thread_id = ' . (int) $aVals['thread_id'])->execute('getSlaveRow');
if ($aThread['group_id'] > 0) {
$aCallback = Phpfox::callback('pages.addForum', $aThread['group_id']);
}
$oParseInput = Phpfox::getLib('parse.input');
$bHasAttachments = Phpfox::getUserParam('forum.can_add_forum_attachments') && Phpfox::isModule('attachment') && isset($aVals['attachment']) && !empty($aVals['attachment']);
$bApprovePost = Phpfox::getUserParam('forum.approve_forum_post') && $aCallback === false ? true : false;
Phpfox::getService('ban')->checkAutomaticBan((isset($aVals['title']) && !empty($aVals['title']) ? $aVals['title'] : '') . ' ' . $aVals['text']);
$iId = $this->database()->insert(Phpfox::getT('forum_post'), array('thread_id' => $aVals['thread_id'], 'view_id' => $bApprovePost ? '1' : '0', 'user_id' => isset($aExtra['user_id']) ? $aExtra['user_id'] : Phpfox::getUserId(), 'title' => empty($aVals['title']) ? '' : $oParseInput->clean($aVals['title'], 255), 'total_attachment' => $bHasAttachments ? Phpfox::getService('attachment')->getCount($aVals['attachment']) : 0, 'time_stamp' => isset($aExtra['user_id']) ? $aExtra['time_stamp'] : PHPFOX_TIME));
$this->database()->insert(Phpfox::getT('forum_post_text'), array('post_id' => $iId, 'text' => $oParseInput->clean($aVals['text']), 'text_parsed' => $oParseInput->prepare($aVals['text'])));
if (!$bApprovePost) {
if ($aCallback === false) {
if (empty($aVals['forum_id'])) {
$aVals['forum_id'] = $aThread['forum_id'];
}
foreach (Phpfox::getService('forum')->id($aVals['forum_id'])->getParents() as $iForumid) {
$this->database()->update(Phpfox::getT('forum'), array('thread_id' => $aVals['thread_id'], 'post_id' => $iId, 'last_user_id' => isset($aExtra['user_id']) ? $aExtra['user_id'] : Phpfox::getUserId()), 'forum_id = ' . $iForumid);
Phpfox::getService('forum.process')->updateCounter($iForumid, 'total_post');
}
}
$this->database()->update(Phpfox::getT('forum_thread'), array('total_post' => array('= total_post +', 1), 'post_id' => $iId, 'time_update' => isset($aExtra['user_id']) ? $aExtra['time_stamp'] : PHPFOX_TIME, 'last_user_id' => isset($aExtra['user_id']) ? $aExtra['user_id'] : Phpfox::getUserId()), 'thread_id = ' . (int) $aVals['thread_id']);
if ($this->_bUpdateCounter) {
Phpfox::getService('user.field.process')->updateCounter(Phpfox::getUserId(), 'total_post');
}
}
// If we uploaded any attachments make sure we update the 'item_id'
if ($bHasAttachments) {
Phpfox::getService('attachment.process')->updateItemId($aVals['attachment'], isset($aExtra['user_id']) ? $aExtra['user_id'] : Phpfox::getUserId(), $iId);
}
if (!$bApprovePost) {
// Update user activity
Phpfox::getService('user.activity')->update(isset($aExtra['user_id']) ? $aExtra['user_id'] : Phpfox::getUserId(), 'forum');
}
if (isset($aVals['is_subscribed']) && $aVals['is_subscribed']) {
Phpfox::getService('forum.subscribe.process')->add($aVals['thread_id'], isset($aExtra['user_id']) ? $aExtra['user_id'] : Phpfox::getUserId());
} else {
Phpfox::getService('forum.subscribe.process')->delete($aVals['thread_id'], isset($aExtra['user_id']) ? $aExtra['user_id'] : Phpfox::getUserId());
}
if (empty($aExtra) && !$bApprovePost) {
Phpfox::getService('forum.subscribe')->sendEmails($aVals['thread_id'], $iId);
$aThread = Phpfox::getService('forum.thread')->getActualThread($aVals['thread_id']);
if (!Phpfox::getService('forum')->isPrivateForum($aThread['forum_id'])) {
if (Phpfox::isModule('feed') && !defined('PHPFOX_SKIP_FEED_ENTRY')) {
Phpfox::getService('feed.process')->callback($aCallback)->add('forum_post', $iId, 0, 0, $aCallback === false ? 0 : $aCallback['item']);
}
}
}
if ($sPlugin = Phpfox_Plugin::get('forum.service_post_process_add_1')) {
eval($sPlugin);
}
if ($bApprovePost) {
return false;
}
return $iId;
}
示例15: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
if (Phpfox::getParam('video.convert_servers_secret') != $this->request()->get('_v_secret')) {
$this->p('Secret does not match', true);
} else {
if ($this->request()->get('_v_action')) {
switch ($this->request()->get('_v_action')) {
case 'completed':
$iCnt = 0;
foreach (Phpfox::getParam('video.convert_servers') as $sServer) {
$iCnt++;
if (md5($sServer) == $this->request()->get('url')) {
break;
}
}
$sDest = '{' . $iCnt . '}' . $this->request()->get('name');
$aVideo = Phpfox::getLib('database')->select('*')->from(Phpfox::getT('video'))->where('custom_v_id = ' . (int) $this->request()->get('id'))->execute('getSlaveRow');
if (isset($aVideo['video_id'])) {
$aCallback = null;
if ($aVideo['module_id'] != 'video' && Phpfox::hasCallback($aVideo['module_id'], 'convertVideo')) {
$aCallback = Phpfox::callback($aVideo['module_id'] . '.convertVideo', $aVideo);
}
Phpfox::isModule('feed') ? Phpfox::getService('feed.process')->callback($aCallback)->allowGuest()->add('video', $aVideo['video_id'], $aVideo['privacy'], $aVideo['privacy_comment'], $aVideo['item_id'], $aVideo['user_id']) : null;
Phpfox::getLib('database')->update(Phpfox::getT('video'), array('in_process' => '0', 'destination' => $sDest, 'image_path' => $sDest . '.jpg'), 'custom_v_id = ' . (int) $this->request()->get('id'));
$bUpdatePoints = $aVideo['module_id'] == 'video' ? Phpfox::getUserParam('video.approve_video_before_display') ? false : true : true;
if ($bUpdatePoints === true) {
// Update user activity
Phpfox::getService('user.activity')->update($aVideo['user_id'], 'video');
}
}
break;
case 'canUpload':
// Will add security checks later
if (Phpfox::getService('video')->checkCustomHash($this->request()->get('hash_id'))) {
$this->p('All is good.');
} else {
$this->p('No token set for this upload.', true);
}
break;
case 'getSettings':
$aSettings = array();
$aParams = array('video.covert_mp4_exec', 'video.covert_webm_exec', 'video.covert_ogg_exec', 'video.covert_mp4_image');
foreach ($aParams as $sParam) {
$aSettings[$sParam] = Phpfox::getParam($sParam);
}
$this->p($aSettings);
break;
}
} else {
$this->p('No action provided', true);
}
}
$this->output();
exit;
}