本文整理汇总了PHP中Phpfox_Url类的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox_Url类的具体用法?PHP Phpfox_Url怎么用?PHP Phpfox_Url使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Phpfox_Url类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Controller
*/
public function process()
{
($sPlugin = Phpfox_Plugin::get('ad.component_controller_admincp_process__start')) ? eval($sPlugin) : false;
$iPage = $this->request()->getInt('page');
if ($iId = $this->request()->getInt('approve')) {
if (Phpfox::getService('ad.process')->approve($iId)) {
$this->url()->send('admincp.ad', null, Phpfox::getPhrase('ad.ad_successfully_approved'));
}
}
if ($iId = $this->request()->getInt('deny')) {
if (Phpfox::getService('ad.process')->deny($iId)) {
$this->url()->send('admincp.ad', null, Phpfox::getPhrase('ad.ad_successfully_denied'));
}
}
if ($iId = $this->request()->getInt('delete')) {
if (Phpfox::getService('ad.process')->delete($iId)) {
$this->url()->send('admincp.ad', null, Phpfox::getPhrase('ad.ad_successfully_deleted'));
}
}
if ($aVals = $this->request()->getArray('val')) {
if (Phpfox::getService('ad.process')->updateActivity($aVals)) {
$this->url()->send('admincp.ad', null, Phpfox::getPhrase('ad.ad_s_successfully_updated'));
}
}
$aPages = array(5, 10, 15, 20);
$aDisplays = array();
foreach ($aPages as $iPageCnt) {
$aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt));
}
$aSorts = array('ad_id' => Phpfox::getPhrase('ad.recently_added'));
$aFilters = array('status' => array('type' => 'select', 'options' => array('1' => Phpfox::getPhrase('ad.pending_approval'), '2' => Phpfox::getPhrase('ad.pending_payment'), '4' => Phpfox::getPhrase('ad.denied')), 'add_any' => true), 'display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '10'), 'sort' => array('type' => 'select', 'options' => $aSorts, 'default' => 'ad_id'), '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' => 'campaigns', 'filters' => $aFilters, 'search' => 'search'));
$sStatus = $oSearch->get('status');
$sView = $this->request()->get('view');
$iLocation = $this->request()->getInt('location');
if ($sStatus == '1') {
$oSearch->setCondition('is_custom = 2');
} elseif ($sStatus == '2') {
$oSearch->setCondition('is_custom = 1');
} elseif ($sStatus == '4') {
$oSearch->setCondition('is_custom = 4');
} else {
switch ($sView) {
case 'pending':
$oSearch->setCondition('is_custom = 2');
break;
default:
// $oSearch->setCondition('is_custom IN(0,2,3)');
break;
}
}
if ($iLocation > 0) {
$oSearch->setCondition('AND location = ' . (int) $iLocation);
}
$iLimit = $oSearch->getDisplay();
list($iCnt, $aAds) = Ad_Service_Ad::instance()->get($oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $iLimit);
Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iLimit, 'count' => $oSearch->getSearchTotal($iCnt)));
$this->template()->setTitle(Phpfox::getPhrase('ad.manage_ad_campaigns'))->setBreadcrumb(Phpfox::getPhrase('ad.manage_ad_campaigns'), $this->url()->makeUrl('admincp.ad'))->assign(array('aAds' => $aAds, 'iPendingCount' => (int) Ad_Service_Ad::instance()->getPendingCount(), 'sPendingLink' => Phpfox_Url::instance()->makeUrl('admincp.ad', array('view' => 'pending')), 'bIsSearch' => $this->request()->get('search-id') ? true : false, 'sView' => $sView));
($sPlugin = Phpfox_Plugin::get('ad.component_controller_admincp_process__end')) ? eval($sPlugin) : false;
}
示例2: add
public function add($aVals, $bIsCustom = false, $aCallback = null)
{
if (!defined('PHPFOX_FORCE_IFRAME')) {
define('PHPFOX_FORCE_IFRAME', true);
}
if (empty($aVals['privacy_comment'])) {
$aVals['privacy_comment'] = 0;
}
if (empty($aVals['privacy'])) {
$aVals['privacy'] = 0;
}
// d($aVals); exit;
if (trim($aVals['link']['url']) == trim($aVals['status_info']) && (!empty($aVals['link']['title']) || !empty($aVals['link']['description']))) {
$aVals['status_info'] = null;
}
$iId = $this->database()->insert($this->_sTable, array('user_id' => Phpfox::getUserId(), 'is_custom' => $bIsCustom ? '1' : '0', 'module_id' => $aCallback === null ? null : $aCallback['module'], 'item_id' => $aCallback === null ? 0 : $aCallback['item_id'], 'parent_user_id' => isset($aVals['parent_user_id']) ? (int) $aVals['parent_user_id'] : 0, 'link' => $this->preParse()->clean($aVals['link']['url'], 255), 'image' => isset($aVals['link']['image_hide']) && $aVals['link']['image_hide'] == '1' || !isset($aVals['link']['image']) ? null : $this->preParse()->clean($aVals['link']['image'], 255), 'title' => isset($aVals['link']['title']) ? $this->preParse()->clean($aVals['link']['title'], 255) : '', 'description' => isset($aVals['link']['description']) ? $this->preParse()->clean($aVals['link']['description'], 200) : '', 'status_info' => empty($aVals['status_info']) ? null : $this->preParse()->prepare($aVals['status_info']), 'privacy' => (int) $aVals['privacy'], 'privacy_comment' => (int) $aVals['privacy_comment'], 'time_stamp' => PHPFOX_TIME, 'has_embed' => empty($aVals['link']['embed_code']) ? '0' : '1'));
if (!empty($aVals['link']['embed_code'])) {
$this->database()->insert(Phpfox::getT('link_embed'), array('link_id' => $iId, 'embed_code' => $this->preParse()->prepare($aVals['link']['embed_code'])));
}
if ($aCallback === null && isset($aVals['parent_user_id']) && $aVals['parent_user_id'] != Phpfox::getUserId()) {
$aUser = $this->database()->select('user_name')->from(Phpfox::getT('user'))->where('user_id = ' . (int) $aVals['parent_user_id'])->execute('getRow');
$sLink = Phpfox_Url::instance()->makeUrl($aUser['user_name'], array('plink-id' => $iId));
Phpfox::getLib('mail')->to($aVals['parent_user_id'])->subject(array('link.full_name_posted_a_link_on_your_wall', array('full_name' => Phpfox::getUserBy('full_name'))))->message(array('link.full_name_posted_a_link_on_your_wall_message', array('full_name' => Phpfox::getUserBy('full_name'), 'link' => $sLink)))->notification('comment.add_new_comment')->send();
if (Phpfox::isModule('notification')) {
Phpfox::getService('notification.process')->add('feed_comment_link', $iId, $aVals['parent_user_id']);
}
}
$this->_iLinkId = $iId;
return $bIsCustom ? $iId : Phpfox::getService('feed.process')->callback($aCallback)->add('link', $iId, $aVals['privacy'], $aVals['privacy_comment'], isset($aVals['parent_user_id']) ? (int) $aVals['parent_user_id'] : 0);
}
示例3: get
public function get()
{
/*
@title Get Feeds
@info Get an activity feed for a specific user.
@method GET
@extra user_id=#{User ID#|int|yes}
@return id=#{Item ID#|int}&title=#{Title of the item|string}&description=#{Description of the item|string}&likes=#{Total number of likes|int}&permalink=#{Link to the item|string}&content=#{Additional text some feeds might have|string}&image=#{Some feeds include an image|string}
*/
define('PHPFOX_SKIP_LOOP_MAX_COUNT', true);
$aFeeds = array();
$aFeedRows = Feed_Service_Feed::instance()->get($this->_oApi->get('user_id'), null, $this->_oApi->get('page'));
foreach ($aFeedRows as $iKey => $aFeedRow) {
foreach ($aFeedRow as $sKey => $mValue) {
if (substr($sKey, 0, 5) == 'feed_') {
if (in_array($sKey, array('feed_reference', 'feed_time_stamp', 'feed_icon', 'feed_month_year', 'feed_image_onclick', 'feed_is_liked'))) {
continue;
}
$sKey = str_replace('feed_', '', $sKey);
switch ($sKey) {
case 'total_like':
$sKey = 'likes';
break;
case 'info':
$mValue = '<a href="' . Phpfox_Url::instance()->makeUrl($aFeedRow['user_name']) . '">' . $aFeedRow['full_name'] . '</a> ' . $mValue;
break;
}
$aFeeds[$iKey][$sKey] = $mValue;
}
}
}
return $aFeeds;
}
示例4: check
public function check()
{
if (!Phpfox::getParam('user.check_promotion_system')) {
return false;
}
if (!Phpfox::isUser()) {
return false;
}
$sCacheId = $this->cache()->set('promotion_' . Phpfox::getUserBy('user_group_id'));
$aPromotion = array();
if (!($aPromotion = $this->cache()->get($sCacheId))) {
$aPromotion = $this->database()->select('*')->from($this->_sTable)->where('user_group_id = ' . Phpfox::getUserBy('user_group_id'))->execute('getSlaveRow');
$this->cache()->save($sCacheId, $aPromotion);
}
if (isset($aPromotion['promotion_id'])) {
if ((int) Phpfox::getUserBy('activity_points') >= (int) $aPromotion['total_activity'] && (int) $aPromotion['total_activity']) {
$this->database()->update(Phpfox::getT('user'), array('user_group_id' => $aPromotion['upgrade_user_group_id']), 'user_id = ' . Phpfox::getUserId());
Phpfox_Url::instance()->send('user.promotion');
} else {
if ((int) $aPromotion['total_day'] > 0) {
if (str_replace('-', '', Phpfox::getUserBy('joined') - PHPFOX_TIME) >= $aPromotion['total_day'] * 86400) {
$this->database()->update(Phpfox::getT('user'), array('user_group_id' => $aPromotion['upgrade_user_group_id']), 'user_id = ' . Phpfox::getUserId());
Phpfox_Url::instance()->send('user.promotion');
}
}
}
}
}
示例5: getFriends
public function getFriends()
{
if ((int) $this->_oApi->get('user_id') === 0) {
$iUserId = $this->_oApi->getUserId();
} else {
$iUserId = $this->_oApi->get('user_id');
}
if ($this->_oApi->isAllowed('friend.get_friends') == false) {
return $this->_oApi->error('friend.get_friends', 'User did not to view friends list');
}
$iCnt = $this->database()->select('COUNT(*)')->from($this->_sTable, 'f')->join(Phpfox::getT('user'), 'u', 'u.user_id = f.friend_user_id')->where('f.is_page = 0 AND f.user_id = ' . (int) $iUserId)->execute('getSlaveField');
$this->_oApi->setTotal($iCnt);
$aRows = $this->database()->select('u.user_id, u.user_name, u.full_name, u.joined, u.user_image, u.country_iso, u.gender')->from($this->_sTable, 'f')->join(Phpfox::getT('user'), 'u', 'u.user_id = f.friend_user_id')->where('f.is_page = 0 AND f.user_id = ' . (int) $iUserId)->limit($this->_oApi->get('page'), 10, $iCnt)->execute('getSlaveRows');
$aFriends = array();
foreach ($aRows as $iKey => $aRow) {
unset($aRows[$iKey]['user_name'], $aRows[$iKey]['country_iso'], $aRows[$iKey]['gender'], $aRows[$iKey]['joined']);
if (!$this->_oApi->isAllowed('user.get_full_name', null, $aRow['user_id'])) {
unset($aRows[$iKey]['full_name']);
} else {
$aRows[$iKey]['name'] = $aRow['full_name'];
}
if (!$this->_oApi->isAllowed('user.get_email', null, $aRow['user_id'])) {
unset($aRows[$iKey]['email']);
}
$sImagePath = $aRow['user_image'];
$aRows[$iKey]['photo_50px'] = Phpfox::getLib('image.helper')->display(array('user' => $aRow, 'suffix' => '_50', 'return_url' => true));
$aRows[$iKey]['photo_50px_square'] = Phpfox::getLib('image.helper')->display(array('user' => $aRow, 'suffix' => '_50_square', 'return_url' => true));
$aRows[$iKey]['photo_120px'] = Phpfox::getLib('image.helper')->display(array('user' => $aRow, 'suffix' => '_120', 'return_url' => true));
$aRows[$iKey]['permalink'] = Phpfox_Url::instance()->makeUrl($aRow['user_name']);
unset($aRows[$iKey]['user_image']);
}
return $aRows;
}
示例6: processRows
public function processRows(&$aRows)
{
foreach ($aRows as $iKey => $aSong) {
$aRows[$iKey]['song_path'] = Phpfox::getService('music')->getSongPath($aSong['song_path'], $aSong['server_id']);
$aRows[$iKey]['aFeed'] = array('feed_display' => 'mini', 'comment_type_id' => 'music_song', 'privacy' => $aSong['privacy'], 'comment_privacy' => $aSong['privacy_comment'], 'like_type_id' => 'music_song', 'feed_is_liked' => isset($aSong['is_liked']) ? $aSong['is_liked'] : false, 'feed_is_friend' => isset($aSong['is_friend']) ? $aSong['is_friend'] : false, 'item_id' => $aSong['song_id'], 'user_id' => $aSong['user_id'], 'total_comment' => $aSong['total_comment'], 'feed_total_like' => $aSong['total_like'], 'total_like' => $aSong['total_like'], 'feed_link' => Phpfox_Url::instance()->permalink('music', $aSong['song_id'], $aSong['title']), 'feed_title' => $aSong['title'], 'type_id' => 'music_song');
}
}
示例7: process
public function process()
{
if (Phpfox::getService('language.process')->useLanguage($this->get('id'))) {
Phpfox::addMessage(Phpfox::getPhrase('language.successfully_updated_your_language_preferences'));
$sReturn = Phpfox::getLib('session')->get('redirect');
if (is_bool($sReturn)) {
$sReturn = '';
}
if ($sReturn) {
$aParts = explode('/', trim($sReturn, '/'));
if (isset($aParts[0])) {
$aParts[0] = Phpfox_Url::instance()->reverseRewrite($aParts[0]);
}
if (isset($aParts[0]) && !Phpfox::isModule($aParts[0])) {
$aUserCheck = Phpfox::getService('user')->getByUserName($aParts[0]);
if (isset($aUserCheck['user_id'])) {
if (isset($aParts[1]) && !Phpfox::isModule($aParts[1])) {
$sReturn = '';
}
} else {
$sReturn = '';
}
}
}
$sReturn = trim($sReturn, '/');
$this->call('window.location.href = window.location.href;');
// . Phpfox_Url::instance()->makeUrl($sReturn) . '\';');
}
}
示例8: getJavascript
public function getJavascript($iPhotoId)
{
$aTags = $this->database()->select('p.user_id AS photo_owner_id, pt.tag_id, pt.user_id AS post_user_id, pt.content, pt.position_x, pt.position_y, pt.width, pt.height, ' . Phpfox::getUserField())->from($this->_sTable, 'pt')->leftJoin(Phpfox::getT('user'), 'u', 'u.user_id = pt.tag_user_id')->join(Phpfox::getT('photo'), 'p', 'p.photo_id = pt.photo_id')->where('pt.photo_id = ' . (int) $iPhotoId)->execute('getSlaveRows');
if (!count($aTags)) {
return false;
}
$sNotes = '[';
foreach ($aTags as $aTag) {
$sNotes .= '{';
$sNotes .= 'note_id: ' . $aTag['tag_id'] . ', ';
$sNotes .= 'x1: ' . $aTag['position_x'] . ', ';
$sNotes .= 'y1: ' . $aTag['position_y'] . ', ';
$sNotes .= 'width: ' . $aTag['width'] . ', ';
$sNotes .= 'height: ' . $aTag['height'] . ', ';
$sRemove = $aTag['post_user_id'] == Phpfox::getUserId() || $aTag['photo_owner_id'] == Phpfox::getUserId() || $aTag['user_id'] == Phpfox::getUserId() ? ' <a href="#" onclick="if (confirm(\\\'' . Phpfox::getPhrase('photo.are_you_sure') . '\\\')) { $(\\\'#noteform\\\').hide(); $(\\\'#js_photo_view_image\\\').imgAreaSelect({ hide: true }); $(this).parent(\\\'span:first\\\').remove();$(\\\'.notep#notep_' . $aTag['tag_id'] . '\\\').remove();$.ajaxCall(\\\'photo.removePhotoTag\\\', \\\'tag_id=' . $aTag['tag_id'] . '\\\'); } return false;"><i class="fa fa-remove"></i></a>' : '';
if (!empty($aTag['user_id'])) {
$sNotes .= 'note: \'<a href="' . Phpfox_Url::instance()->makeUrl($aTag['user_name']) . '" id="js_photo_tag_user_id_' . $aTag['user_id'] . '">' . $aTag['full_name'] . '</a>' . $sRemove . '\'';
} else {
$sNotes .= 'note: \'' . str_replace("'", "\\'", Phpfox::getLib('parse.output')->clean($aTag['content'])) . $sRemove . '\'';
}
$sNotes .= '},';
}
$sNotes = rtrim($sNotes, ',');
$sNotes .= ']';
return $sNotes;
}
示例9: reload
public function reload()
{
$sUrl = Phpfox_Url::instance()->makeUrl('captcha.image', array('id' => md5(rand(100, 1000))));
$sId = htmlspecialchars($this->get('sId'));
$sInput = htmlspecialchars($this->get('sInput'));
$this->call('$("#' . $sId . '").attr("src", "' . $sUrl . '"); $("#' . $sInput . '").val(""); $("#' . $sInput . '").focus(); $("#js_captcha_process").html("");');
}
示例10: processActivityPayment
public function processActivityPayment()
{
$aParts = explode('|', $this->get('item_number'));
if (Phpfox::getService('user.process')->purchaseWithPoints($aParts[0], $aParts[1], $this->get('amount'), $this->get('currency_code'))) {
Phpfox::addMessage('Purchase successfully completed.');
$this->call('window.location.href = \'' . Phpfox_Url::instance()->makeUrl('') . '\'');
}
}
示例11: add
public function add($aVals)
{
Phpfox::isUser(true);
$aPhoto = $this->database()->select('p.photo_id, p.user_id, p.title, u.full_name')->from(Phpfox::getT('photo'), 'p')->join(Phpfox::getT('user'), 'u', 'u.user_id = p.user_id')->where('p.photo_id = ' . (int) $aVals['item_id'])->execute('getSlaveRow');
if (!isset($aPhoto['photo_id'])) {
return Phpfox_Error::set(Phpfox::getPhrase('photo.unable_to_find_the_photo'));
}
if (Phpfox::getUserParam('photo.can_tag_own_photo') && $aPhoto['user_id'] == Phpfox::getUserId() || Phpfox::getUserParam('photo.can_tag_other_photos')) {
$sReturn = '';
$iIsTagged = $this->database()->select('COUNT(*)')->from($this->_sTable)->where('photo_id = ' . (int) $aVals['item_id'] . ' AND position_x = ' . (int) $aVals['x1'] . ' AND position_y = ' . (int) $aVals['y1'] . ' AND width = ' . (int) $aVals['width'] . ' AND height = ' . (int) $aVals['height'] . '')->execute('getSlaveField');
if ($iIsTagged) {
return Phpfox_Error::set(Phpfox::getPhrase('photo.this_photo_is_already_tagged_in_the_same_position'));
}
$iTotalTags = $this->database()->select('COUNT(*)')->from($this->_sTable)->where('photo_id = ' . (int) $aVals['item_id'] . ' AND user_id = ' . Phpfox::getUserId())->execute('getSlaveField');
if ($aPhoto['user_id'] == Phpfox::getUserId() && $iTotalTags >= Phpfox::getUserParam('photo.how_many_tags_on_own_photo') || $aPhoto['user_id'] != Phpfox::getUserId() && $iTotalTags >= Phpfox::getUserParam('photo.how_many_tags_on_other_photo')) {
return Phpfox_Error::set(Phpfox::getPhrase('photo.no_more_tags_for_this_photo_can_be_added'));
}
$iTotalTags = 0;
$iTotalTags = $this->database()->select('COUNT(*)')->from($this->_sTable)->where('photo_id = ' . (int) $aVals['item_id'])->execute('getSlaveField');
if ($iTotalTags > Phpfox::getParam('photo.total_tags_on_photos')) {
}
if (!empty($aVals['note'])) {
if (Phpfox::getLib('parse.format')->isEmpty($aVals['note'])) {
return Phpfox_Error::set(Phpfox::getPhrase('photo.provide_a_photo_tag'));
}
$aVals['note'] = Phpfox::getLib('parse.input')->clean($aVals['note'], 255);
$sReturn = Phpfox::getLib('parse.output')->clean($aVals['note']);
}
Phpfox::getService('ban')->checkAutomaticBan($aVals['note']);
$iTagUserId = 0;
if (!empty($aVals['tag_user_id'])) {
$aUser = Phpfox::getService('user')->getUser($aVals['tag_user_id'], 'u.user_id, u.user_name, u.full_name');
if (isset($aUser['user_id'])) {
$iTagUserId = $aUser['user_id'];
$iIsUserTagged = $this->database()->select('COUNT(*)')->from($this->_sTable)->where('photo_id = ' . (int) $aVals['item_id'] . ' AND tag_user_id = ' . (int) $iTagUserId . '')->execute('getSlaveField');
if ($iIsUserTagged) {
return Phpfox_Error::set(Phpfox::getPhrase('photo.full_name_has_already_been_tagged_in_this_photo', array('full_name' => $aUser['full_name'])));
}
$sReturn = '<a href="' . Phpfox_Url::instance()->makeUrl($aUser['user_name']) . '">' . $aUser['full_name'] . '</a>';
unset($aVals['note']);
}
}
if (empty($aVals['note']) && $iTagUserId < 1) {
return;
}
$iTagId = $this->database()->insert($this->_sTable, array('photo_id' => (int) $aVals['item_id'], 'user_id' => Phpfox::getUserId(), 'tag_user_id' => $iTagUserId, 'content' => empty($aVals['note']) ? null : $aVals['note'], 'time_stamp' => PHPFOX_TIME, 'position_x' => (int) $aVals['x1'], 'position_y' => (int) $aVals['y1'], 'width' => (int) $aVals['width'], 'height' => (int) $aVals['height']));
($sPlugin = Phpfox_Plugin::get('photo.service_tag_process_add__1')) ? eval($sPlugin) : false;
Phpfox::getService('feed.process')->add('photo_tag', $iTagId, 0, 0, $iTagUserId);
$sLink = Phpfox_Url::instance()->permalink('photo', $aPhoto['photo_id'], $aPhoto['title']);
Phpfox::getLib('mail')->to($iTagUserId)->subject(array('photo.full_name_tagged_you_in_a_photo', array('full_name' => Phpfox::getUserBy('full_name'), 'user_id' => Phpfox::getUserId())))->message(Phpfox::getUserId() == $aPhoto['user_id'] ? Phpfox::getPhrase('photo.full_name_tagged_you_on_gender_photo', array('full_name' => Phpfox::getUserBy('full_name'), 'gender' => Phpfox::getService('user')->gender(Phpfox::getUserBy('gender'), 1), 'link' => $sLink, 'title' => $aPhoto['title'])) : Phpfox::getPhrase('photo.full_name_tagged_you_on_user_photo', array('full_name' => Phpfox::getUserBy('full_name'), 'other_full_name' => $aPhoto['full_name'], 'link' => $sLink, 'title' => $aPhoto['title'])))->send();
Phpfox::getService('notification.process')->add('photo_tag', $aPhoto['photo_id'], $iTagUserId);
// }
return $sReturn;
}
return Phpfox_Error::set(Phpfox::getPhrase('photo.not_allowed_to_tag_this_photo'));
}
示例12: __construct
public function __construct()
{
$Template = \Phpfox_Template::instance();
$this->_loader = new View\Loader();
$dir = $Template->theme()->get()->getPath() . 'html';
if (is_dir($dir)) {
$this->_loader->addPath($dir, 'Theme');
}
$this->_loader->addPath(PHPFOX_DIR . 'theme/default/html', 'Theme');
$this->_loader->addPath(PHPFOX_DIR . 'views', 'Base');
$this->_env = new View\Environment($this->_loader, array('cache' => defined('PHPFOX_IS_TECHIE') && PHPFOX_IS_TECHIE || defined('PHPFOX_NO_TEMPLATE_CACHE') ? false : PHPFOX_DIR_FILE . 'cache/twig/', 'autoescape' => false));
$this->_env->setBaseTemplateClass('Core\\View\\Base');
$this->_env->addFunction(new \Twig_SimpleFunction('url', function ($url, $params = []) {
return \Phpfox_Url::instance()->makeUrl($url, $params);
}));
$this->_env->addFunction(new \Twig_SimpleFunction('setting', function () {
return call_user_func_array('setting', func_get_args());
}));
$this->_env->addFunction(new \Twig_SimpleFunction('user', function () {
return call_user_func_array('user', func_get_args());
}));
$this->_env->addFunction(new \Twig_SimpleFunction('phrase', function () {
return call_user_func_array('phrase', func_get_args());
}));
$this->_env->addFunction(new \Twig_SimpleFunction('comments', function () {
\Phpfox::getBlock('feed.comment');
return '';
}));
$this->_env->addFunction(new \Twig_SimpleFunction('payment', function ($params) {
$params = new \Core\Object($params);
\Phpfox::getBlock('api.gateway.form', ['gateway_data' => ['item_number' => '@App/' . $params->callback . '|' . $params->id, 'currency_code' => 'USD', 'amount' => $params->amount, 'item_name' => $params->name, 'return' => $params->return, 'recurring' => '', 'recurring_cost' => '', 'alternative_cost' => '', 'alternative_recurring_cost' => '']]);
return '';
}));
$this->_env->addFunction(new \Twig_SimpleFunction('pager', function () {
$u = \Phpfox_Url::instance();
if (!isset($_GET['page'])) {
$_GET['page'] = 1;
}
$_GET['page']++;
$u->setParam('page', $_GET['page']);
$url = $u->current();
$html = '
<div class="js_pager_view_more_link">
<a href="' . $url . '" class="next_page">
<i class="fa fa-spin fa-circle-o-notch"></i>
<span>View More</span>
</a>
</div>
';
return $html;
}));
$this->_env->addFunction(new \Twig_SimpleFunction('_p', function () {
return call_user_func_array('_p', func_get_args());
}));
}
示例13: email
public function email($sEmail)
{
$iCnt = $this->database()->select('COUNT(*)')->from($this->_sTable)->where("email = '" . $this->database()->escape($sEmail) . "'")->execute('getField');
if ($iCnt) {
Phpfox_Error::set(Phpfox::getPhrase('user.email_is_in_use_and_user_can_login', array('email' => trim(strip_tags($sEmail)), 'link' => Phpfox_Url::instance()->makeUrl('user.login', array('email' => base64_encode($sEmail))))));
}
if (!Phpfox::getService('ban')->check('email', $sEmail)) {
Phpfox_Error::set(Phpfox::getPhrase('user.this_email_is_not_allowed_to_be_used'));
}
return $this;
}
示例14: sendEmails
public function sendEmails($iThreadId, $iPostId = null)
{
$aUsers = $this->database()->select('fs.user_id, ft.forum_id, ft.thread_id, ft.group_id, ft.title, f.name AS forum_name')->from($this->_sTable, 'fs')->join(Phpfox::getT('forum_thread'), 'ft', 'ft.thread_id = fs.thread_id')->leftJoin(Phpfox::getT('forum'), 'f', 'f.forum_id = ft.forum_id')->where('fs.thread_id = ' . (int) $iThreadId)->execute('getSlaveRows');
if (count($aUsers)) {
foreach ($aUsers as $aUser) {
$sLink = Phpfox_Url::instance()->permalink('forum.thread', $aUser['thread_id'], $aUser['title']) . 'view_' . $iPostId . '/';
Phpfox::getService('notification.process')->add('forum_subscribed_post', $iPostId, $aUser['user_id']);
Phpfox::getLib('mail')->to($aUser['user_id'])->subject(array('forum.reply_to_thread_title', array('title' => $aUser['title'])))->message(array('forum.full_name_has_just_replied_to_the_thread_title', array('full_name' => Phpfox::getUserBy('full_name'), 'title' => $aUser['title'], 'link' => $sLink)))->notification('forum.subscribe_new_post')->send();
}
}
}
示例15: processRows
public function processRows(&$aRows)
{
foreach ($aRows as $iKey => $aListing) {
$aRows[$iKey]['aFeed'] = array('feed_display' => 'mini', 'comment_type_id' => 'marketplace', 'privacy' => $aListing['privacy'], 'comment_privacy' => $aListing['privacy_comment'], 'like_type_id' => 'marketplace', 'feed_is_liked' => isset($aListing['is_liked']) ? $aListing['is_liked'] : false, 'feed_is_friend' => isset($aListing['is_friend']) ? $aListing['is_friend'] : false, 'item_id' => $aListing['listing_id'], 'user_id' => $aListing['user_id'], 'total_comment' => $aListing['total_comment'], 'feed_total_like' => $aListing['total_like'], 'total_like' => $aListing['total_like'], 'feed_link' => Phpfox_Url::instance()->permalink('marketplace', $aListing['listing_id'], $aListing['title']), 'feed_title' => $aListing['title'], 'type_id' => 'marketplace');
// Mark expired items here so its easier to display them in the template
if (Phpfox::getParam('marketplace.days_to_expire_listing') > 0 && $aListing['time_stamp'] < PHPFOX_TIME - Phpfox::getParam('marketplace.days_to_expire_listing') * 86400) {
$aRows[$iKey]['is_expired'] = true;
}
$aRows[$iKey]['url'] = Phpfox_Url::instance()->permalink('marketplace', $aListing['listing_id'], $aListing['title']);
}
}