本文整理汇总了PHP中Phpfox::getService方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox::getService方法的具体用法?PHP Phpfox::getService怎么用?PHP Phpfox::getService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phpfox
的用法示例。
在下文中一共展示了Phpfox::getService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addUserFacebook
/**
* Add facebook user
*/
public function addUserFacebook($aVals, $iFacebookUserId, $sAccessToken)
{
if (!defined('PHPFOX_IS_FB_USER')) {
define('PHPFOX_IS_FB_USER', true);
}
//get facebook setting
$bFbConnect = Phpfox::getParam('facebook.enable_facebook_connect');
if ($bFbConnect == false) {
return false;
} else {
if (Phpfox::getService('accountapi.facebook')->checkUserFacebook($iFacebookUserId) == false) {
if (Phpfox::getParam('user.disable_username_on_sign_up')) {
$aVals['user_name'] = Phpfox::getLib('parse.input')->cleanTitle($aVals['full_name']);
}
$aVals['country_iso'] = null;
if (Phpfox::getParam('user.split_full_name')) {
$aNameSplit = preg_split('[ ]', $aVals['full_name']);
$aVals['first_name'] = $aNameSplit[0];
unset($aNameSplit[0]);
$aVals['last_name'] = implode(' ', $aNameSplit);
}
$iUserId = Phpfox::getService('user.process')->add($aVals);
if ($iUserId === false) {
return false;
} else {
Phpfox::getService('facebook.process')->addUser($iUserId, $iFacebookUserId);
//update fb profile image to db
$bCheck = Phpfox::getService('accountapi.facebook')->addImagePicture($sAccessToken, $iUserId);
}
}
}
return true;
}
示例2: process
public function process()
{
if ($aVals = $this->request()->getArray('val')) {
if (Phpfox::getService('custom.relation.process')->add($aVals)) {
$this->url()->send('admincp.custom.relationships', array(), Phpfox::getPhrase('custom.status_added'));
}
}
if ($iId = $this->request()->getInt('delete')) {
if (Phpfox::getService('custom.relation.process')->delete($iId)) {
$this->url()->send('admincp.custom.relationships', array(), Phpfox::getPhrase('custom.status_deleted'));
}
}
$aStatuses = Phpfox::getService('custom.relation')->getAll();
/* If we're editing lets make it easier and just find the one we're looking for here */
if ($iEdit = $this->request()->getInt('edit')) {
$aEdit = array();
foreach ($aStatuses as $aStatus) {
if ($aStatus['relation_id'] == $iEdit) {
$aEdit = $aStatus;
break;
}
}
if (empty($aEdit)) {
Phpfox_Error::display(Phpfox::getPhrase('custom.not_found'));
} else {
$this->template()->assign(array('aEdit' => $aEdit));
}
}
$this->template()->setTitle(Phpfox::getPhrase('custom.admin_menu_manage_relationships'))->setBreadcrumb(Phpfox::getPhrase('custom.admin_menu_manage_relationships'))->setPhrase(array())->assign(array('aStatuses' => $aStatuses));
}
示例3: moderation
/**
* Need this to take over photo moderation
* Enter description here ...
*/
public function moderation()
{
Phpfox::isUser(true);
switch ($this->get('action')) {
case 'approve':
Phpfox::getUserParam('photo.can_approve_photos', true);
foreach ((array) $this->get('item_moderate') as $iId) {
Phpfox::getService('photo.process')->approve($iId);
$this->call('$(\'#js_photo_id_' . $iId . '\').remove();');
}
$sMessage = Phpfox::getPhrase('photo.photo_s_successfully_approved');
$this->alert($sMessage, 'Moderation', 300, 150, true);
break;
case 'delete':
Phpfox::getUserParam('photo.can_delete_other_photos', true);
$item = $this->get('item_moderate')[0];
$bReload = Phpfox::getService('profiles')->getUserAndProfile($item);
if ($bReload) {
$this->call('location.reload();');
}
foreach ((array) $this->get('item_moderate') as $iId) {
Phpfox::getService('photo.process')->delete($iId);
$this->call('$(\'#js_photo_id_' . $iId . '\').remove();');
}
$sMessage = Phpfox::getPhrase('photo.photo_s_successfully_deleted');
break;
}
$this->updateCount();
$this->hide('.moderation_process');
}
示例4: sendEmail
public function sendEmail($sType)
{
$this->database()->update($this->_sTable, array(
'send_email' => (int) $sType
), 'user_id = ' . Phpfox::getUserId()
);
if ((int) $sType === 2)
{
$aUserInfo = Phpfox::getService('facebook.api')->getUserInfo();
if (Phpfox::getService('facebook')->checkEmail($aUserInfo['email']) !== false)
{
return false;
}
$this->database()->update(Phpfox::getT('user'), array(
'email' => $aUserInfo['email']
), 'user_id = ' . Phpfox::getUserId()
);
if ($aUserInfo['email'] == $aUserInfo['proxied_email'])
{
$this->database()->update($this->_sTable, array(
'is_proxy_email' => '1'
), 'user_id = ' . Phpfox::getUserId()
);
}
}
return true;
}
示例5: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
if ($aOrder = $this->request()->getArray('order'))
{
if (Phpfox::getService('event.category.process')->updateOrder($aOrder))
{
$this->url()->send('admincp.event', null, Phpfox::getPhrase('event.category_order_successfully_updated'));
}
}
if ($iDelete = $this->request()->getInt('delete'))
{
if (Phpfox::getService('event.category.process')->delete($iDelete))
{
$this->url()->send('admincp.event', null, Phpfox::getPhrase('event.category_successfully_deleted'));
}
}
$this->template()->setTitle(Phpfox::getPhrase('event.manage_categories'))
->setBreadcrumb(Phpfox::getPhrase('event.manage_categories'), $this->url()->makeUrl('admincp.event'))
->setPhrase(array(
'event.are_you_sure_this_will_delete_all_events_that_belong_to_this_category_and_cannot_be_undone'
)
)
->setHeader(array(
'jquery/ui.js' => 'static_script',
'admin.js' => 'module_event',
'<script type="text/javascript">$Core.event.url(\'' . $this->url()->makeUrl('admincp.event') . '\');</script>'
)
)
->assign(array(
'sCategories' => Phpfox::getService('event.category')->display('admincp')->get()
)
);
}
示例6: 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');
}
}
}
}
示例7: 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();
}
示例8: process
/**
* Controller
*/
public function process()
{
if ($sPlugin = Phpfox_Plugin::get('core.component_controller_index_visitor_start')) {
eval($sPlugin);
}
$image = [];
list($total, $featured) = Photo_Service_Photo::instance()->getFeatured();
if (is_array($featured) && isset($featured[0])) {
$photo = $featured[0];
$url = Phpfox_Image_Helper::instance()->display(['server_id' => $photo['server_id'], 'path' => 'photo.url_photo', 'file' => $photo['destination'], 'suffix' => '_1024', 'return_url' => true]);
$image = ['image' => $url, 'info' => strip_tags($photo['title']) . ' by ' . $photo['full_name']];
}
if (!$image) {
$images = ['create-a-community-for-musicians.jpg' => 'Creating communities for Musicians', 'create-a-community-for-athletes.jpg' => 'Creating communities for Athletes', 'create-a-community-for-photographers.jpg' => 'Creating communities for Photographers', 'create-a-social-network-for-fine-cooking.jpg' => 'Creating communities for Fine Cooking'];
$total = rand(1, count($images));
$image = [];
$cnt = 0;
foreach ($images as $image => $info) {
$cnt++;
$image = ['image' => 'http://bg.m9.io/' . $image, 'info' => $info];
if ($cnt === $total) {
break;
}
}
}
$this->template()->setHeader('cache', array('register.js' => 'module_user', 'country.js' => 'module_core', 'comment.css' => 'style_css'))->setBreadCrumb(Phpfox::getParam('core.site_title'))->setPhrase(array('user.continue'))->assign(array('aSettings' => Phpfox::getService('custom')->getForEdit(array('user_main', 'user_panel', 'profile_panel'), null, null, true), 'image' => $image));
}
示例9: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
define('PHPFOX_DONT_SAVE_PAGE', true);
if (Phpfox::isUser()) {
$this->url()->send('profile');
}
switch (Phpfox::getParam('user.login_type')) {
case 'user_name':
$aValidation['login'] = Phpfox::getPhrase('user.provide_your_user_name');
break;
case 'email':
$aValidation['login'] = Phpfox::getPhrase('user.provide_your_email');
break;
default:
$aValidation['login'] = Phpfox::getPhrase('user.provide_your_user_name_email');
}
$aValidation['password'] = Phpfox::getPhrase('user.provide_your_password');
$oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_login_form', 'aParams' => $aValidation));
if ($aVals = $this->request()->getArray('val')) {
if ($oValid->isValid($aVals)) {
list($bLogged, $aUser) = Phpfox::getService('user.auth')->login($aVals['login'], $aVals['password'], isset($aVals['remember_me']) ? true : false, Phpfox::getParam('user.login_type'));
if ($bLogged) {
$this->url()->send('');
}
}
}
}
示例10: 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) . '\';');
}
}
示例11: 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'));
}
示例12: process
/**
* Controller
*/
public function process()
{
$sCountryChildValue = $this->getParam('country_child_value');
$mCountryChildFilter = $this->getParam('country_child_filter', $this->request()->get('country_child_filter', null));
$sCountryChildType = $this->getParam('country_child_type', null);
$sCountryChildId = null;
if (empty($sCountryChildValue) && Phpfox::isUser() && $mCountryChildFilter === null && !$this->getParam('country_not_user')) {
$sCountryChildValue = Phpfox::getUserBy('country_iso');
}
$iSearchId = 0;
if ($mCountryChildFilter !== null) {
$iSearchId = $this->request()->get('search-id');
if (!empty($iSearchId) && isset($_SESSION[Phpfox::getParam('core.session_prefix')]['search'][$sCountryChildType][$iSearchId]['country'])) {
$sCountryChildValue = $_SESSION[Phpfox::getParam('core.session_prefix')]['search'][$sCountryChildType][$iSearchId]['country'];
}
if (isset($_SESSION[Phpfox::getParam('core.session_prefix')]['search'][$sCountryChildType][$iSearchId]['country_child_id'])) {
$sCountryChildId = $_SESSION[Phpfox::getParam('core.session_prefix')]['search'][$sCountryChildType][$iSearchId]['country_child_id'];
}
}
/* Last resort, get is a little heavy but controller didnt provide a child country*/
if ($sCountryChildId == null && $this->getParam('country_child_id') == null) {
$aUser = Phpfox::getService('user')->get(Phpfox::getUserId(), true);
$sCountryChildId = $aUser['country_child_id'];
}
$this->template()->assign(array('aCountryChildren' => Phpfox::getService('core.country')->getChildren($sCountryChildValue), 'iCountryChildId' => (int) $this->getParam('country_child_id', $sCountryChildId), 'bForceDiv' => $this->getParam('country_force_div', false), 'mCountryChildFilter' => $mCountryChildFilter));
}
示例13: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
if (($sLegacyTitle = $this->request()->get('req2')) && !empty($sLegacyTitle)) {
Phpfox::getService('core')->getLegacyItem(array('field' => array('group_id', 'title'), 'table' => 'group', 'redirect' => 'pages', 'title' => $sLegacyTitle));
}
$this->url()->send('pages', array(), null, 301);
}
示例14: process
/**
* Controller
*/
public function process()
{
$aValidation = array('name' => Phpfox::getPhrase('forum.provide_a_name_for_your_forum'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
$bIsEdit = false;
if ($iId = $this->request()->getInt('id')) {
$bIsEdit = true;
Phpfox::getUserParam('forum.can_edit_forum', true);
$aForum = Phpfox::getService('forum')->getForEdit($iId);
$this->template()->assign('aForms', $aForum);
} else {
Phpfox::getUserParam('forum.can_add_new_forum', true);
}
if ($aVals = $this->request()->getArray('val')) {
if ($oValid->isValid($aVals)) {
if ($bIsEdit) {
if (Phpfox::getService('forum.process')->update($aForum['forum_id'], $aVals)) {
$this->url()->send('admincp.forum', null, Phpfox::getPhrase('forum.forum_successfully_updated'));
}
} else {
if (Phpfox::getService('forum.process')->add($aVals)) {
$this->url()->send('admincp.forum.add', null, Phpfox::getPhrase('forum.forum_successfully_added'));
}
}
}
}
$sTitle = $bIsEdit ? Phpfox::getPhrase('forum.editing_forum') . ': ' . $aForum['name'] : Phpfox::getPhrase('forum.create_new_form');
$this->template()->setTitle($sTitle)->setBreadCrumb($sTitle, $this->url()->makeUrl('admincp.forum'))->assign(array('sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'sForumParents' => Phpfox::getService('forum')->active($bIsEdit ? $aForum['parent_id'] : $this->request()->getInt('child'))->edit($bIsEdit ? $aForum['forum_id'] : 0)->getJumpTool(true, $bIsEdit)));
}
示例15: process
public function process()
{
$sAction = $this->request()->get('req4');
$sFlag = $this->request()->get('flag');
if ($sFlag == '') {
if ($sAction == 'install') {
$oInstaller = Phpfox::getService('blog.import');
if ($oInstaller->uninstall() && $oInstaller->install()) {
$this->clearCache("file/cache");
$this->clearCache("file/gzip");
$this->url()->send('admincp.blog.installer.install' . '/flag_success1');
} else {
Phpfox_Error::set('The module blog importer cannot installed, please try again');
}
} elseif ($sAction == 'uninstall2') {
if (Phpfox::getService('blog.import')->uninstall()) {
$this->clearCache("file/cache");
$this->clearCache("file/gzip");
$this->url()->send('admincp.blog.installer.uninstall' . '/flag_success2');
} else {
Phpfox_Error::set('The module blog importer cannot uninstalled, please try again');
}
} elseif ($sAction == 'uninstall') {
} else {
$this->url()->send('subcribe');
}
} elseif ($sFlag == 'success1') {
$this->url()->send('admincp.blog.installer.install' . '/flag_success', null, 'Congratulation ! The module blog importer v3.02p2 has been installed successfully');
} elseif ($sFlag == 'success2') {
$this->url()->send('admincp.blog.installer.uninstall' . '/flag_success', null, 'Uninstall blog importer v3.02p3 done !');
}
$this->template()->assign(array('sAction' => $sAction, 'sFlag' => $sFlag))->setBreadCrumb(Phpfox::getPhrase('blog.blog'), $this->url()->makeUrl('admincp.blog'));
}