本文整理汇总了PHP中Phpfox::isModule方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox::isModule方法的具体用法?PHP Phpfox::isModule怎么用?PHP Phpfox::isModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phpfox
的用法示例。
在下文中一共展示了Phpfox::isModule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Controller
*/
public function process()
{
if (!defined('PHPFOX_IS_USER_PROFILE') && !defined('PHPFOX_IS_PAGES_VIEW')) {
return false;
}
if (defined('PHPFOX_IS_PAGES_VIEW')) {
$aUser = $this->getParam('aPage');
$aUser['user_image'] = $aUser['image_path'];
$aUser['profile_page_id'] = $aUser['page_id'];
$aUser['server_id'] = $aUser['image_server_id'];
} else {
$aUser = $this->getParam('aUser');
}
$aUserInfo = array('title' => $aUser['full_name'], 'path' => 'core.url_user', 'file' => $aUser['user_image'], 'suffix' => '_50_square', 'max_width' => 75, 'max_height' => 75, 'no_default' => Phpfox::getUserId() == $aUser['user_id'] ? false : true, 'thickbox' => true, 'class' => 'profile_user_image');
if (defined('PHPFOX_IS_PAGES_VIEW')) {
$sImage = Phpfox::getLib('image.helper')->display(array_merge(array('user' => $aUser), $aUserInfo));
} else {
$sImage = Phpfox::getLib('image.helper')->display(array_merge(array('user' => Phpfox::getService('user')->getUserFields(true, $aUser)), $aUserInfo));
}
$bIsInfo = false;
if (isset($aUser['landing_page']) && $aUser['landing_page'] == 'info' && Phpfox_Request::instance()->get('req2') != 'wall' || Phpfox_Request::instance()->get('req2') == 'info') {
$bIsInfo = true;
}
if (defined('PHPFOX_IS_PAGES_VIEW') && empty($aUser['vanity_url'])) {
if (isset($aUser['landing_page']) && $aUser['landing_page'] == 'info' && Phpfox_Request::instance()->get('req3') != 'wall' || Phpfox_Request::instance()->get('req3') == 'info') {
$bIsInfo = true;
}
}
$this->template()->assign(array('aUser' => $aUser, 'sProfileImage' => $sImage, 'bIsInfo' => $bIsInfo, 'bCanPoke' => Phpfox::isModule('poke') && Phpfox::getService('poke')->canSendPoke($aUser['user_id'])));
}
示例2: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
$this->template()->assign(array(
'sJanrainUrl' => (Phpfox::isModule('janrain') ? Phpfox::getService('janrain')->getUrl() : '')
)
);
}
示例3: process
/**
* Controller
*/
public function process()
{
Phpfox::isUser(true);
if (!Phpfox::getUserParam('user.can_control_notification_privacy') && !Phpfox::getUserParam('user.can_control_profile_privacy')) {
return Phpfox_Error::display(Phpfox::getPhrase('user.privacy_settings_have_been_disabled_for_your_user_group'));
}
if ($aVals = $this->request()->getArray('val')) {
if (Phpfox::getService('user.privacy.process')->update($aVals)) {
$this->url()->send('user.privacy', null, Phpfox::getPhrase('user.privacy_settings_successfully_updated'));
}
}
list($aUserPrivacy, $aNotifications, $aProfiles, $aItems) = Phpfox::getService('user.privacy')->get();
$aUserInfo = Phpfox::getService('user')->get(Phpfox::getUserId());
($sPlugin = Phpfox_Plugin::get('user.component_controller_index_process')) ? eval($sPlugin) : false;
$aMenus = array('profile' => Phpfox::getPhrase('user.profile'), 'items' => Phpfox::getPhrase('user.items'), 'notifications' => Phpfox::getPhrase('user.notifications'), 'blocked' => Phpfox::getPhrase('user.blocked_users'));
if (!Phpfox::isModule('privacy')) {
unset($aMenus['items']);
}
if (Phpfox::getUserParam('user.can_be_invisible')) {
// $aMenus['invisible'] = Phpfox::getPhrase('user.invisible_mode');
}
$this->template()->buildPageMenu('js_privacy_block', $aMenus, array('no_header_border' => true, 'link' => $this->url()->makeUrl(Phpfox::getUserBy('user_name')), 'phrase' => Phpfox::getPhrase('user.view_your_profile')));
if ($this->request()->get('view') == 'blocked') {
$this->template()->assign(array('bGoToBlocked' => true));
}
$this->template()->setTitle(Phpfox::getPhrase('user.privacy_settings'))->setBreadcrumb('Account', $this->url()->makeUrl('profile'))->setBreadcrumb(Phpfox::getPhrase('user.privacy_settings'), $this->url()->makeUrl('user.privacy'), true)->setFullSite()->setHeader(array('privacy.css' => 'module_user'))->assign(array('aForms' => $aUserPrivacy['privacy'], 'aPrivacyNotifications' => $aNotifications, 'aProfiles' => $aProfiles, 'aUserPrivacy' => $aUserPrivacy, 'aBlockedUsers' => Phpfox::getService('user.block')->get(), 'aUserInfo' => $aUserInfo, 'aItems' => $aItems));
}
示例4: process
/**
* Controller
*/
public function process()
{
if (Phpfox::isUser() && Phpfox::isModule('pages')) {
list(, $pages) = Pages_Service_Pages::instance()->getMyLoginPages(0, 20);
$this->template()->assign(['pages' => $pages]);
}
}
示例5: sendPoke
/**
* This function sends a poke to $iUser from Phpfox::getUserId()
* `status_id` tells if the poke has been seen:
* 1: not seen
* 2: seen
*
* @param int $iUserId
* @return boolean true if we added a poke.
*/
public function sendPoke($iUserId)
{
/* if the other user has not seen a poke then we do not add it */
$iExists = $this->database()->select('poke_id')
->from($this->_sTable)
->where('user_id = ' . Phpfox::getUserId() . ' AND to_user_id = ' . (int)$iUserId . ' AND status_id = 1')
->execute('getSlaveField');
if ($iExists > 0)
{
return false;
}
$iPokeId = $this->database()->insert($this->_sTable, array(
'user_id' => Phpfox::getUserId(),
'to_user_id' => (int)$iUserId,
'status_id' => 1
));
/* Ignore all pokes from $iUserId to us */
$this->ignore($iUserId);
if (Phpfox::getParam('poke.add_to_feed') && Phpfox::isModule('feed'))
{
Phpfox::getService('feed.process')->add('poke', $iPokeId);
}
return true;
}
示例6: 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;
}
$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::getLib('url')->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);
}
示例7: getNotificationAction
/** This function catches all the "actions" (Dislike, and in the future maybe others)
* */
public function getNotificationAction($aNotification)
{
//d($aNotification);die();
// get the type of item that was marked ("blog", "photo"...)
$aAction = $this->database()->select('*')->from(Phpfox::getT('action'))->where('action_id = ' . (int) $aNotification['item_id'])->limit(1)->execute('getSlaveRow');
if (empty($aAction) || !isset($aAction['item_type_id'])) {
return false;
throw new Exception('No type for this action (' . print_r($aAction, true) . ')');
}
// Check if the module is a sub module
if (preg_match('/(?P<module>[a-z]+)[_]?(?P<submodule>[a-z]{0,99})/i', $aAction['item_type_id'], $aMatch) < 1) {
throw new Exception('Malformed item_type');
}
// Call the module and get the title
if (!Phpfox::isModule($aMatch['module'])) {
return false;
}
$aRow = Phpfox::getService($aMatch['module'])->getInfoForAction($aAction);
$sUsers = Phpfox::getService('notification')->getUsers($aNotification);
$sTitle = Phpfox::getLib('parse.output')->shorten($aRow['title'], Phpfox::getParam('notification.total_notification_title_length'), '...');
$sPhrase = '';
if ($aNotification['user_id'] == $aRow['user_id']) {
// {users} disliked {gender} own {item} "{title}"
$sPhrase = Phpfox::getPhrase('like.users_disliked_gender_own_item_title', array('users' => $sUsers, 'gender' => Phpfox::getService('user')->gender($aRow['gender'], 1), 'title' => $sTitle, 'item' => $aAction['item_type_id']));
} elseif ($aRow['user_id'] == Phpfox::getUserId()) {
// {users} liked your blog "{title}"
$sPhrase = Phpfox::getPhrase('like.users_disliked_your_item_title', array('users' => $sUsers, 'title' => $sTitle, 'item' => $aAction['item_type_id']));
} else {
$sPhrase = Phpfox::getPhrase('like.users_disliked_users_item', array('users' => $sUsers, 'row_full_name' => $aRow['full_name'], 'title' => $sTitle, 'item' => $aAction['item_type_id']));
}
return array('link' => $aRow['link'], 'message' => $sPhrase, 'icon' => Phpfox_Template::instance()->getStyle('image', 'activity.png', 'blog'));
}
示例8: process
/**
* Class process method which is used to execute this component.
*/
public function process()
{
if (!Phpfox::isModule('ad'))
{
return false;
}
if (defined('PHPFOX_IS_GROUP_VIEW'))
{
return false;
}
$aSponsorEvents = Phpfox::getService('event')->getRandomSponsored();
if (empty($aSponsorEvents))
{
return false;
}
Phpfox::getService('ad.process')->addSponsorViewsCount($aSponsorEvents['sponsor_id'], 'event');
$this->template()->assign(array(
'sHeader' => Phpfox::getPhrase('event.sponsored_event'),
'aSponsorEvents' => $aSponsorEvents,
'aFooter' => array(Phpfox::getPhrase('event.encourage_sponsor') => $this->url()->makeUrl('event', array('view' => 'my', 'sponsor' => 1)))
)
);
return 'block';
}
示例9: getQueryJoins
public function getQueryJoins($bIsCount = false, $bNoQueryFriend = false)
{
if (Phpfox::isModule('friend') && Phpfox::getService('friend')->queryJoin($bNoQueryFriend)) {
$this->database()->join(Phpfox::getT('friend'), 'friends', 'friends.user_id = m.user_id AND friends.friend_user_id = ' . Phpfox::getUserId());
}
if ($this->_sCategory !== null) {
$this->database()->innerJoin(Phpfox::getT('fevent_category_data'), 'mcd', 'mcd.fevent_id = m.fevent_id');
if (!$bIsCount) {
$this->database()->group('m.fevent_id');
}
}
if ($this->_iAttending !== null) {
$this->database()->innerJoin(Phpfox::getT('fevent_invite'), 'ei', 'ei.fevent_id = m.fevent_id AND ei.rsvp_id = ' . (int) $this->_iAttending . ' AND ei.invited_user_id = ' . Phpfox::getUserId());
if (!$bIsCount) {
$this->database()->select('ei.rsvp_id, ');
$this->database()->group('m.fevent_id');
}
} else {
if (Phpfox::isUser()) {
$this->database()->leftJoin(Phpfox::getT('fevent_invite'), 'ei', 'ei.fevent_id = m.fevent_id AND ei.invited_user_id = ' . Phpfox::getUserId());
if (!$bIsCount) {
$this->database()->select('ei.rsvp_id, ');
$this->database()->group('m.fevent_id');
}
}
}
}
示例10: 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;
}
示例11: getQueryJoins
public function getQueryJoins($bIsCount = false, $bNoQueryFriend = false)
{
if (Phpfox::isModule('friend') && Phpfox::getService('friend')->queryJoin($bNoQueryFriend))
{
$this->database()->join(Phpfox::getT('friend'), 'friends', 'friends.user_id = q.user_id AND friends.friend_user_id = ' . Phpfox::getUserId());
}
}
示例12: 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;
}
示例13: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
if ($this->request()->get('req2') == 'view' && ($sLegacyTitle = $this->request()->get('req3')) && !empty($sLegacyTitle)) {
Phpfox::getService('core')->getLegacyItem(array('field' => array('listing_id', 'title'), 'table' => 'marketplace', 'redirect' => 'marketplace', 'title' => $sLegacyTitle));
}
Phpfox::getUserParam('marketplace.can_access_marketplace', true);
if (!($iListingId = $this->request()->get('req2'))) {
$this->url()->send('marketplace');
}
if (!($aListing = Phpfox::getService('marketplace')->getListing($iListingId))) {
return Phpfox_Error::display(Phpfox::getPhrase('marketplace.the_listing_you_are_looking_for_either_does_not_exist_or_has_been_removed'));
}
$this->setParam('aListing', $aListing);
if (Phpfox::isUser() && $aListing['invite_id'] && !$aListing['visited_id'] && $aListing['user_id'] != Phpfox::getUserId()) {
Phpfox::getService('marketplace.process')->setVisit($aListing['listing_id'], Phpfox::getUserId());
}
if (Phpfox::isUser() && Phpfox::isModule('notification')) {
Phpfox::getService('notification.process')->delete('comment_marketplace', $this->request()->getInt('req2'), Phpfox::getUserId());
Phpfox::getService('notification.process')->delete('marketplace_like', $this->request()->getInt('req2'), Phpfox::getUserId());
}
if (Phpfox::isModule('notification') && $aListing['user_id'] == Phpfox::getUserId()) {
Phpfox::getService('notification.process')->delete('marketplace_approved', $aListing['listing_id'], Phpfox::getUserId());
}
Phpfox::getService('core.redirect')->check($aListing['title']);
if (Phpfox::isModule('privacy')) {
Phpfox::getService('privacy')->check('marketplace', $aListing['listing_id'], $aListing['user_id'], $aListing['privacy'], $aListing['is_friend']);
}
$this->setParam('aRatingCallback', array('type' => 'user', 'default_rating' => $aListing['total_score'], 'item_id' => $aListing['user_id'], 'stars' => range(1, 10)));
$this->setParam('aFeed', array('comment_type_id' => 'marketplace', 'privacy' => $aListing['privacy'], 'comment_privacy' => $aListing['privacy_comment'], 'like_type_id' => 'marketplace', 'feed_is_liked' => $aListing['is_liked'], 'feed_is_friend' => $aListing['is_friend'], 'item_id' => $aListing['listing_id'], 'user_id' => $aListing['user_id'], 'total_comment' => $aListing['total_comment'], 'total_like' => $aListing['total_like'], 'feed_link' => $this->url()->permalink('marketplace', $aListing['listing_id'], $aListing['title']), 'feed_title' => $aListing['title'], 'feed_display' => 'view', 'feed_total_like' => $aListing['total_like'], 'report_module' => 'marketplace', 'report_phrase' => Phpfox::getPhrase('marketplace.report_this_listing_lowercase')));
$this->template()->setTitle($aListing['title'] . ($aListing['view_id'] == '2' ? ' (' . Phpfox::getPhrase('marketplace.sold') . ')' : ''))->setBreadcrumb(Phpfox::getPhrase('marketplace.marketplace'), $this->url()->makeUrl('marketplace'))->setMeta('description', $aListing['description'])->setMeta('keywords', $this->template()->getKeywords($aListing['title'] . $aListing['description']))->setMeta('og:image', Phpfox::getLib('image.helper')->display(array('server_id' => $aListing['listing_id'], 'path' => 'marketplace.url_image', 'file' => $aListing['image_path'], 'suffix' => '_400', 'return_url' => true)))->setBreadcrumb($aListing['title'] . ($aListing['view_id'] == '2' ? ' (' . Phpfox::getPhrase('marketplace.sold') . ')' : ''), $this->url()->permalink('marketplace', $aListing['listing_id'], $aListing['title']), true)->setHeader('cache', array('jquery/plugin/star/jquery.rating.js' => 'static_script', 'jquery.rating.css' => 'style_css', 'jquery/plugin/jquery.highlightFade.js' => 'static_script', 'jquery/plugin/jquery.scrollTo.js' => 'static_script', 'quick_edit.js' => 'static_script', 'comment.css' => 'style_css', 'pager.css' => 'style_css', 'switch_legend.js' => 'static_script', 'switch_menu.js' => 'static_script', 'view.js' => 'module_marketplace', 'view.css' => 'module_marketplace', 'pager.css' => 'style_css', 'feed.js' => 'module_feed'))->setEditor(array('load' => 'simple'))->assign(array('aListing' => $aListing, 'sMicroPropType' => 'Product'));
if (Phpfox::isModule('rate')) {
$this->template()->setPhrase(array('rate.thanks_for_rating'))->setHeader(array('rate.js' => 'module_rate', '<script type="text/javascript">$Behavior.rateMarketplaceUser = function() { $Core.rate.init({display: false}); }</script>'));
}
($sPlugin = Phpfox_Plugin::get('marketplace.component_controller_view_process_end')) ? eval($sPlugin) : false;
}
示例14: getValidation
public function getValidation($sStep = null)
{
$aValidation = array();
if ($sStep == 1 || $sStep === null) {
$aValidation['full_name'] = Phpfox::getPhrase('user.provide_your_full_name');
$aValidation['email'] = array('def' => 'email', 'title' => Phpfox::getPhrase('user.provide_a_valid_email_address'));
$aValidation['password'] = array('def' => 'password', 'title' => Phpfox::getPhrase('user.provide_a_valid_password'));
if (Phpfox::getParam('user.new_user_terms_confirmation')) {
$aValidation['agree'] = array('def' => 'checkbox', 'title' => Phpfox::getPhrase('user.check_our_agreement_in_order_to_join_our_site'));
}
if (!Phpfox::getParam('user.profile_use_id') && !Phpfox::getParam('user.disable_username_on_sign_up')) {
$aValidation['user_name'] = array('def' => 'username', 'title' => Phpfox::getPhrase('user.provide_a_valid_user_name', array('min' => Phpfox::getParam('user.min_length_for_username'), 'max' => Phpfox::getParam('user.max_length_for_username'))));
}
}
if ($sStep == 2 || $sStep === null) {
if (Phpfox::getParam('core.registration_enable_dob')) {
$aValidation['month'] = Phpfox::getPhrase('user.select_month_of_birth');
$aValidation['day'] = Phpfox::getPhrase('user.select_day_of_birth');
$aValidation['year'] = Phpfox::getPhrase('user.select_year_of_birth');
}
if (Phpfox::getParam('core.registration_enable_location')) {
$aValidation['country_iso'] = Phpfox::getPhrase('user.select_current_location');
}
if (Phpfox::getParam('core.registration_enable_gender')) {
$aValidation['gender'] = Phpfox::getPhrase('user.select_your_gender');
}
}
if (Phpfox::isModule('captcha') && Phpfox::getParam('user.captcha_on_signup') && $sStep === null) {
$aValidation['image_verification'] = Phpfox::getPhrase('captcha.complete_captcha_challenge');
}
return $aValidation;
}
示例15: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
// assign the categories
$this->template()->assign(array('aCategories' => Phpfox::getService('contact.contact')->getCategories()));
// create the captcha check JS
// they need to input some text always
$aValidation = array('text' => Phpfox::getPhrase('contact.fill_in_some_text_for_your_message'), 'category_id' => Phpfox::getPhrase('contact.you_need_to_choose_a_category'), 'subject' => Phpfox::getPhrase('contact.provide_a_subject'), 'full_name' => Phpfox::getPhrase('contact.provide_your_full_name'));
// do they need to complete a captcha challenge?
if (Phpfox::isModule('captcha') && Phpfox::getParam('contact.contact_enable_captcha')) {
$aValidation['image_verification'] = Phpfox::getPhrase('captcha.complete_captcha_challenge');
}
// They always need to input their email address
$aValidation['email'] = array('def' => 'email', 'title' => Phpfox::getPhrase('contact.provide_a_valid_email'));
$oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_contact_form', 'aParams' => $aValidation));
// check if we're getting a request:
if ($aVals = $this->request()->getArray('val')) {
// check the fields are valid
if ($oValid->isValid($aVals)) {
if (Phpfox::getService('contact.contact')->sendContactMessage($aVals)) {
if (!empty($aVals['category_id']) && $aVals['category_id'] == 'phpfox_sales_ticket') {
$this->url()->send('contact', array('sent' => 'true'));
} else {
$this->url()->send('contact', null, Phpfox::getPhrase('contact.your_message_was_successfully_sent'));
}
} else {
$this->template()->assign(array('aContactErrors' => Phpfox_Error::set(Phpfox::getPhrase('error.site_email_not_set'))));
}
}
}
if (Phpfox::isUser()) {
$this->template()->assign(array('sFullName' => Phpfox::getUserBy('full_name'), 'sEmail' => Phpfox::getUserBy('email')));
}
$this->template()->setTitle(Phpfox::getPhrase('contact.contact_us'))->setBreadcrumb(Phpfox::getPhrase('contact.contact_us'))->assign(array('sCreateJs' => $oValid->createJs(), 'sGetJsForm' => $oValid->getJsForm(), 'bIsSent' => $this->request()->get('sent')))->setFullSite();
}