当前位置: 首页>>代码示例>>PHP>>正文


PHP Phpfox::setCookie方法代码示例

本文整理汇总了PHP中Phpfox::setCookie方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox::setCookie方法的具体用法?PHP Phpfox::setCookie怎么用?PHP Phpfox::setCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phpfox的用法示例。


在下文中一共展示了Phpfox::setCookie方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 public function process()
 {
     if (!defined('PHPFOX_ALLOW_MODE')) {
         exit;
     }
     $demoId = 0;
     if ($demoId = $this->request()->get('id')) {
         $Themes = new Core\Theme($demoId);
         Phpfox::setCookie('flavor_id', $demoId);
         $this->url()->send('');
     }
     /*
     else {
     	$this->url()->send('');
     }
     */
     Core\View::$template = 'blank';
     $Themes = new Core\Theme();
     $flavors = [];
     foreach ($Themes->all() as $Theme) {
         foreach ($Theme->flavors() as $Flavor) {
             $flavors[] = $Flavor;
         }
     }
     $this->template()->assign(['flavors' => $flavors, 'demoId' => $demoId]);
 }
开发者ID:lev1976g,项目名称:core,代码行数:26,代码来源:demo.class.php

示例2: process

 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if (defined('PHPFOX_IS_AD_PREVIEW')) {
         return false;
     }
     if (Phpfox::getUserBy('profile_page_id') > 0) {
         return false;
     }
     $oRequest = Phpfox::getLib('request');
     if ($this->template()->bIsSample || $oRequest->get('req2') == 'designer' || $oRequest->get('req2') == 'index-member' && $oRequest->get('req3') == 'customize') {
         return false;
     }
     if (!Phpfox::isModule('friend')) {
         return false;
     }
     $sLastOpenWindow = null;
     $sLastWindowParam = null;
     if ($sLastOpenWindow = Phpfox::getCookie('im_last_open_window')) {
         if (preg_match("/chat_(.*)/i", $sLastOpenWindow, $aMatches)) {
             $sLastOpenWindow = 'chat';
             $sLastWindowParam = (int) $aMatches[1];
         } elseif ($sLastOpenWindow == 'messenger') {
             $sLastOpenWindow = 'messenger';
         }
         Phpfox::setCookie('im_last_open_window', '', -1);
     }
     $iCnt = 0;
     if (Phpfox::getUserBy('im_hide') != '1') {
         $aCond = array('AND f.user_id = ' . Phpfox::getUserId() . ' AND u.im_hide != 1');
         list($iCnt, $aFriends) = Phpfox::getService('im')->getOnlineFriends(Phpfox::getUserId(), $aCond);
     }
     $this->template()->assign(array('iTotalFriendsOnline' => $iCnt, 'sLastOpenWindow' => $sLastOpenWindow, 'sLastWindowParam' => $sLastWindowParam));
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:36,代码来源:footer.class.php

示例3: remove

 /**
  * Removes a session.
  *
  * @param mixed $mName STRING name of session, ARRAY of sessions.
  */
 public function remove($mName)
 {
     if (!is_array($mName)) {
         $mName = array($mName);
     }
     foreach ($mName as $sName) {
         Phpfox::setCookie($sName, '', -1);
     }
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:14,代码来源:cookie.class.php

示例4: designdnd

 public function designdnd()
 {
     if ($this->get('enable') == 1 && Phpfox::getUserParam('core.can_design_dnd')) {
         Phpfox::setCookie('doDnD', '1', PHPFOX_TIME + 3600);
         if ($this->get('inline')) {
             $this->call('windowjavascript:location.reload(true);');
         } else {
             $this->call('window.location.href = \'' . Phpfox::getLib('url')->makeUrl('') . '\';');
         }
     } else {
         Phpfox::setCookie('doDnD', -1, PHPFOX_TIME);
         $this->call('windowjavascript:location.reload(true);');
     }
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:14,代码来源:ajax.class.php

示例5: process


//.........这里部分代码省略.........
                 $iId = $aPost['thread_id'];
                 $this->template()->assign(array('aForms' => $aPost, 'iEditId' => $aPost['post_id']));
                 if (PHPFOX_IS_AJAX) {
                     Phpfox_Ajax::instance()->setTitle(Phpfox::getPhrase('forum.editing_post') . ': ' . (empty($aPost['title']) ? '#' . $aPost['post_id'] : Phpfox::getLib('parse.output')->shorten($aPost['title'], 80, '...')));
                 }
             } else {
                 return Phpfox_Error::display(Phpfox::getPhrase('forum.insufficient_permission_to_edit_this_thread'));
             }
         }
         $aThread = Forum_Service_Thread_Thread::instance()->getActualThread($iId, $aCallback);
         if (!isset($aThread['thread_id'])) {
             return Phpfox_Error::display(Phpfox::getPhrase('forum.not_a_valid_thread'));
         }
         if ($aThread['is_closed'] && (isset($bCanEditPost) && !$bCanEditPost || !isset($bCanEditPost))) {
             return Phpfox_Error::display(Phpfox::getPhrase('forum.thread_is_closed'));
         }
         if ($aCallback === false && $aThread['forum_is_closed']) {
             return Phpfox_Error::display(Phpfox::getPhrase('forum.forum_is_closed'));
         }
         if (!$iEditId && $aThread['is_announcement']) {
             return Phpfox_Error::display(Phpfox::getPhrase('forum.thread_is_an_announcement_not_allowed_to_leave_a_reply'));
         }
         if (!$bIsEdit) {
             $bPass = false;
             if (Phpfox::getUserParam('forum.can_reply_to_own_thread') && $aThread['user_id'] == Phpfox::getUserId() || Phpfox::getUserParam('forum.can_reply_on_other_threads') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'can_reply')) {
                 $bPass = true;
             }
             if ($bPass === false) {
                 return Phpfox_Error::display(Phpfox::getPhrase('forum.insufficient_permission_to_reply_to_this_thread'));
             }
         }
         $sExtraText = '';
         if ($sSavedText = $this->request()->get('save_text')) {
             $sExtraText .= Phpfox::getLib('parse.output')->clean($sSavedText);
         }
         if (Phpfox::getUserParam('forum.can_multi_quote_forum') && (($iQuote = $this->request()->getInt('quote')) || ($sCookie = Phpfox::getCookie('forum_quote')) && !empty($sCookie))) {
             $sCookie = Phpfox::getCookie('forum_quote');
             if (!empty($sCookie)) {
                 $iQuote = $sCookie . $iQuote;
             }
             $sExtraText .= Phpfox::getService('forum.post')->getQuotes($aThread['thread_id'], $iQuote);
         }
         if (($iQuoteId = $this->request()->getInt('quote')) && ($aQuotePost = Phpfox::getService('forum.post')->getForEdit($iQuoteId))) {
             Phpfox_Ajax::instance()->setTitle(Phpfox::getPhrase('forum.replying_to_a_post_by_full_name', array('full_name' => Phpfox::getLib('parse.output')->shorten($aQuotePost['full_name'], 80, '...'))));
         }
         $aSubForms = array();
         if (isset($aThread['is_subscribed'])) {
             $aSubForms['is_subscribed'] = $aThread['is_subscribed'];
         }
         if (!empty($sExtraText)) {
             $aSubForms['text'] = $sExtraText;
         }
         if (isset($bCanEditPost) && $bCanEditPost) {
             $aSubForms = array_merge($aSubForms, $aPost);
         }
         $this->template()->assign('aForms', $aSubForms);
         $aValidation = array('text' => Phpfox::getPhrase('forum.provide_some_text'));
         if (Phpfox::isModule('captcha') && Phpfox::getUserParam('forum.enable_captcha_on_posting')) {
             $aValidation['image_verification'] = Phpfox::getPhrase('captcha.complete_captcha_challenge');
         }
         $oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
         $aForum = Phpfox::getService('forum')->id($aThread['forum_id'])->getForum();
         if ($aVals = $this->request()->getArray('val')) {
             $aVals['forum_id'] = $aThread['forum_id'];
             if ($oValid->isValid($aVals)) {
                 Phpfox::setCookie('forum_quote', '', -1);
                 if ($bIsEdit) {
                     if (Phpfox::getService('forum.post.process')->update($aPost['post_id'], $aPost['user_id'], $aVals)) {
                         $this->url()->permalink('forum', $aThread['thread_id'], $aThread['title'], true, null, array('post' => $aPost['post_id']));
                     }
                 } else {
                     if (($iFlood = Phpfox::getUserParam('forum.forum_post_flood_control')) !== 0) {
                         $aFlood = array('action' => 'last_post', 'params' => array('field' => 'time_stamp', 'table' => Phpfox::getT('forum_post'), 'condition' => 'user_id = ' . Phpfox::getUserId(), 'time_stamp' => $iFlood * 60));
                         // actually check if flooding
                         if (Phpfox::getLib('spam')->check($aFlood)) {
                             Phpfox_Error::set(Phpfox::getPhrase('forum.posting_a_reply_a_little_too_soon') . ' ' . Phpfox::getLib('spam')->getWaitTime());
                         }
                     }
                     if (Phpfox_Error::isPassed()) {
                         if ($iId = Phpfox::getService('forum.post.process')->add($aVals, $aCallback)) {
                             $this->url()->permalink('forum', $aThread['thread_id'], $aThread['title'], true, null, array('post' => $iId));
                         } else {
                             if (Phpfox::getUserParam('forum.approve_forum_post')) {
                                 $this->url()->permalink('forum', $aThread['thread_id'], $aThread['title'], true, Phpfox::getPhrase('forum.your_post_has_successfully_been_added_however_it_is_pending_an_admins_approval_before_it_can_be_displayed_publicly'), array('post' => $iId));
                             }
                         }
                     }
                 }
             }
         }
         if ($aCallback === false) {
             $this->template()->setBreadcrumb($aForum['breadcrumb'])->setBreadcrumb($aForum['name'], $this->url()->makeUrl('forum', $aForum['name_url'] . '-' . $aForum['forum_id']));
         } else {
         }
         $this->template()->setBreadcrumb($aThread['title'], $aCallback === false ? $this->url()->makeUrl('forum', array($aForum['name_url'] . '-' . $aForum['forum_id'], $aThread['title_url'])) : $this->url()->makeUrl($aCallback['url_home'] . '.forum', $aThread['title_url']))->setBreadcrumb($bIsEdit ? Phpfox::getPhrase('forum.editing_post') . ': ' . (empty($aPost['title']) ? '#' . $aPost['post_id'] : $aPost['title']) : Phpfox::getPhrase('forum.post_new_reply'), $bIsEdit ? $aCallback === false ? $this->url()->makeUrl('forum', array($aThread['forum_url'] . '-' . $aThread['forum_id'], $aThread['title_url'], 'post_' . $aPost['post_id'])) : $this->url()->makeUrl($aCallback['url_home'] . '.forum', array($aThread['title_url'], 'post' => $aPost['post_id'])) : null, true)->assign(array('iThreadId' => $iId, 'iActualForumId' => $aForum['forum_id'], 'sFormLink' => $aCallback === false ? $this->url()->makeUrl('forum.post.reply', array('id' => $iId)) : $this->url()->makeUrl('forum.post.reply', array('id' => $iId, 'module' => $sModule, 'item' => $iItemId)), 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(PHPFOX_IS_AJAX ? false : true), 'sReturnLink' => $bIsEdit ? $aCallback === false ? $this->url()->makeUrl('forum', array($aThread['forum_url'] . '-' . $aThread['forum_id'], $aThread['title_url'], 'post_' . $aPost['post_id'])) : $this->url()->makeUrl($aCallback['url_home'] . '.forum', $aThread['title_url']) : '', 'sThreadReturnLink' => $aCallback === false ? $this->url()->makeUrl('forum', array($aThread['forum_url'] . '-' . $aThread['forum_id'], $aThread['title_url'])) : $this->url()->makeUrl($aCallback['url_home'], array('forum', $aThread['title_url'])), 'aPreviews' => Phpfox::getService('forum.post')->getPreview($aThread['thread_id']), 'iTotalPosts' => $aThread['total_post'], 'bIsEdit' => $bIsEdit, 'aCallback' => $aCallback, 'iTotalPostPreview' => Phpfox::getParam('forum.total_forum_post_preview')));
         if (Phpfox::getUserParam('forum.can_add_forum_attachments')) {
             $this->setParam('attachment_share', array('type' => 'forum', 'inline' => PHPFOX_IS_AJAX ? true : false, 'id' => 'js_forum_form', 'edit_id' => $bIsEdit ? $aPost['post_id'] : ''));
         }
     }
 }
开发者ID:lev1976g,项目名称:core,代码行数:101,代码来源:post.class.php

示例6: snoop

 /**
  * This function allows a user to log in as another user.
  * @param array $aUser
  * @return boolean
  */
 public function snoop($aUser)
 {
     Phpfox::isUser(true);
     if (!Phpfox::getUserParam('user.can_member_snoop')) {
         return Phpfox_Error::set('Admin lacks permissions');
     }
     $sPasswordHash = Phpfox::getLib('hash')->setRandomHash(Phpfox::getLib('hash')->setHash($aUser['password'], $aUser['password_salt']));
     // Set cookie (yummy)
     $iTime = 0;
     $this->database()->insert(Phpfox::getT('user_snoop'), array('time_stamp' => PHPFOX_TIME, 'user_id' => Phpfox::getUserId(), 'logging_in_as' => $aUser['user_id']));
     Phpfox::setCookie($this->_sNameCookieUserId, $aUser['user_id'], $iTime);
     Phpfox::setCookie($this->_sNameCookieHash, $sPasswordHash, $iTime);
     if (!defined('PHPFOX_INSTALLER')) {
         Phpfox::getLib('session')->remove(Phpfox::getParam('core.theme_session_prefix') . 'theme');
     }
     $this->database()->update($this->_sTable, array('last_login' => PHPFOX_TIME), 'user_id = ' . $aUser['user_id']);
     $this->database()->insert(Phpfox::getT('user_ip'), array('user_id' => $aUser['user_id'], 'type_id' => 'login', 'ip_address' => Phpfox::getIp(), 'time_stamp' => PHPFOX_TIME));
     return true;
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:24,代码来源:auth.class.php

示例7: registerInvited

 /**
  * Actions to take after an invited guest signs up
  * @param <type> $iGuestId
  * @param <type> $iUser
  * @return <type>
  */
 public function registerInvited($iUserId)
 {
     if ($iInviteId = Phpfox::getCookie('invited_by_user')) {
         $aInvite = $this->database()->select('user_id')->from(Phpfox::getT('user'))->where('user_id = ' . (int) $iInviteId)->execute('getSlaveRow');
     } elseif ($iInviteId = Phpfox::getCookie('invited_by_email')) {
         $aInvite = $this->database()->select('invite_id, user_id')->from($this->_sTable)->where('invite_id = ' . (int) $iInviteId)->execute('getSlaveRow');
         if (isset($aInvite['invite_id'])) {
             $this->database()->delete(Phpfox::getT('invite'), "invite_id = '" . $aInvite['invite_id'] . "'");
         }
     }
     if (isset($aInvite['user_id'])) {
         // Both should now be friends
         $this->_makeFriends($iUserId, $aInvite['user_id']);
         // update the user table field for invite_user_id
         $this->database()->update(Phpfox::getT('user'), array('invite_user_id' => (int) $aInvite['user_id']), 'user_id = ' . $iUserId);
         // award points
         // relying on the script's type validation as its defined as integer
         Phpfox::getService('user.activity')->update($iUserId, 'invite', '+');
         Phpfox::getService('user.activity')->update($aInvite['user_id'], 'invite', '+');
     }
     Phpfox::setCookie('invited_by_user', 0, '-1');
     Phpfox::setCookie('invited_by_email', 0, '-1');
 }
开发者ID:lev1976g,项目名称:core,代码行数:29,代码来源:process.class.php

示例8: process

	/**
	 * Class process method wnich is used to execute this component.
	 */
	public function process()
	{	
		if (!Phpfox::getParam('user.allow_user_registration'))
		{
			$this->url()->send('');	
		}
		
		define('PHPFOX_DONT_SAVE_PAGE', true);
		
		if (Phpfox::isUser())
		{
			$this->url()->send('profile');
		}

		$oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_form', 'aParams' => Phpfox::getService('user.register')->getValidation()));

		if ($aVals = $this->request()->getArray('val'))
		{
			if (Phpfox::getService('invite')->isInviteOnly())
			{
				if (Phpfox::getService('invite')->isValidInvite($aVals['invite_email']))
				{
					$iExpire = (Phpfox::getParam('invite.invite_expire') > 0 ? (Phpfox::getParam('invite.invite_expire')*60*60*24) : (7*60*60*24));
					
					Phpfox::setCookie('invite_only_pass', $aVals['invite_email'], PHPFOX_TIME + $iExpire);
					
					$this->url()->send('user.register');
				}
			}
			else 
			{
				if (!Phpfox::getParam('user.profile_use_id') && !Phpfox::getParam('user.disable_username_on_sign_up'))
				{
					$aVals['user_name'] = str_replace(' ', '_', $aVals['user_name']);
					Phpfox::getService('user.validate')->user($aVals['user_name']);
				}		
				(($sPlugin = Phpfox_Plugin::get('user.component_controller_register_1')) ? eval($sPlugin) : false);
	
				Phpfox::getService('user.validate')->email($aVals['email']);
	
				(($sPlugin = Phpfox_Plugin::get('user.component_controller_register_2')) ? eval($sPlugin) : false);
				if ($oValid->isValid($aVals))
				{
					if ($iId = Phpfox::getService('user.process')->add($aVals))
					{
						if (Phpfox::getService('user.auth')->login($aVals['email'], $aVals['password']))
						{						
							if (is_array($iId))
							{
								(($sPlugin = Phpfox_Plugin::get('user.component_controller_register_3')) ? eval($sPlugin) : false);
								$this->url()->forward($iId[0]);	
							}
							else 
							{
								$sRedirect = Phpfox::getParam('user.redirect_after_signup');
								
								if (!empty($sRedirect))
								{
									(($sPlugin = Phpfox_Plugin::get('user.component_controller_register_4')) ? eval($sPlugin) : false);
									$this->url()->send($sRedirect);
								}
								
								if (Phpfox::getParam('user.multi_step_registration_form') && is_array(Phpfox::getParam('user.registration_steps')) && count(Phpfox::getParam('user.registration_steps')))
								{
									$aUrls = Phpfox::getParam('user.registration_steps');
									
									(($sPlugin = Phpfox_Plugin::get('user.component_controller_register_5')) ? eval($sPlugin) : false);
									$this->url()->send($aUrls[0], 'register');
								}
								else 
								{
									(($sPlugin = Phpfox_Plugin::get('user.component_controller_register_6')) ? eval($sPlugin) : false);
									$this->url()->send('');
								}
							}
						}
					}
					else 
					{
						if (Phpfox::getParam('user.multi_step_registration_form'))
						{
							$this->template()->assign('bIsPosted', true);
							(($sPlugin = Phpfox_Plugin::get('user.component_controller_register_7')) ? eval($sPlugin) : false);
						}					
					}				
				}
				else
				{				
					$this->template()->assign(array(
							'bCorrectUsername' => (!Phpfox::getParam('user.profile_use_id') && !Phpfox::getParam('user.disable_username_on_sign_up') ? Phpfox::getService('user.validate')->user($aVals['user_name']) : ''),
							'sUsername' => ((!Phpfox::getParam('user.profile_use_id') && !Phpfox::getParam('user.disable_username_on_sign_up')) ? $aVals['user_name'] : ''),
							'iTimeZonePosted' => (isset($aVals['time_zone']) ? $aVals['time_zone'] : 0)
						)
					);
					
					if (Phpfox::getParam('user.multi_step_registration_form'))
					{
//.........这里部分代码省略.........
开发者ID:hoanghd,项目名称:tools,代码行数:101,代码来源:register.class.php

示例9: cropPhoto

 public function cropPhoto()
 {
     $aPostVals = $this->get('val');
     if (empty($aPostVals['w']) && !isset($aPostVals['skip_croping'])) {
         $this->show('#js_photo_preview_ajax')->html('#js_photo_preview_ajax', '');
         return Phpfox_Error::set(Phpfox::getPhrase('photo.select_an_area_on_your_photo_to_crop'));
     }
     if ($this->get('in_process')) {
         $oImage = Phpfox_Image::instance();
         $sFileName = $this->get('in_process');
         $aImages = array();
         if ($sPhotos = $this->get('photos')) {
             $aImages = unserialize(base64_decode(urldecode($this->get('photos'))));
         }
         $iNotCompleted = 0;
         foreach (Phpfox::getParam('user.user_pic_sizes') as $iSize) {
             if (isset($aImages[sprintf($sFileName, '_' . $iSize)])) {
                 continue;
             }
             if (Phpfox::getParam('core.keep_non_square_images')) {
                 $oImage->createThumbnail(Phpfox::getParam('core.dir_user') . sprintf($sFileName, ''), Phpfox::getParam('core.dir_user') . sprintf($sFileName, '_' . $iSize), $iSize, $iSize);
             }
             $oImage->createThumbnail(Phpfox::getParam('core.dir_user') . sprintf($sFileName, ''), Phpfox::getParam('core.dir_user') . sprintf($sFileName, '_' . $iSize . '_square'), $iSize, $iSize, false);
             $aImages[sprintf($sFileName, '_' . $iSize)] = true;
             $iNotCompleted++;
             $this->call('p(\'Processing photo: ' . sprintf($sFileName, '_' . $iSize) . '\');');
             break;
         }
         $sValues = '';
         foreach ($this->get('val') as $sKey => $mValue) {
             $sValues .= '&val[' . $sKey . ']=' . urlencode($mValue);
         }
         if ($iNotCompleted) {
             $this->call('$.ajaxCall(\'user.cropPhoto\', \'js_disable_ajax_restart=true&photos=' . urlencode(base64_encode(serialize($aImages))) . '&in_process=' . $this->get('in_process') . '&file=' . $this->get('in_process') . '' . $sValues . '\');');
         } else {
             $oFile = Phpfox_File::instance();
             $iServerId = Phpfox_Request::instance()->getServer('PHPFOX_SERVER_ID');
             $this->call('p(\'Completed resizing photos.\');');
             if (Phpfox::getUserBy('user_image') != '') {
                 if (file_exists(Phpfox::getParam('core.dir_user') . sprintf(Phpfox::getUserBy('user_image'), ''))) {
                     $oFile->unlink(Phpfox::getParam('core.dir_user') . sprintf(Phpfox::getUserBy('user_image'), ''));
                     foreach (Phpfox::getParam('user.user_pic_sizes') as $iSize) {
                         if (file_exists(Phpfox::getParam('core.dir_user') . sprintf(Phpfox::getUserBy('user_image'), '_' . $iSize))) {
                             $oFile->unlink(Phpfox::getParam('core.dir_user') . sprintf(Phpfox::getUserBy('user_image'), '_' . $iSize));
                         }
                         if (file_exists(Phpfox::getParam('core.dir_user') . sprintf(Phpfox::getUserBy('user_image'), '_' . $iSize . '_square'))) {
                             $oFile->unlink(Phpfox::getParam('core.dir_user') . sprintf(Phpfox::getUserBy('user_image'), '_' . $iSize . '_square'));
                         }
                     }
                 }
             }
             $sFileName = $this->get('file');
             Phpfox_Database::instance()->update(Phpfox::getT('user'), array('user_image' => $sFileName, 'server_id' => $iServerId), 'user_id = ' . Phpfox::getUserId());
             Phpfox::isModule('feed') ? Phpfox::getService('feed.process')->delete('user_photo', Phpfox::getUserId()) : null;
             Phpfox::isModule('feed') ? Phpfox::getService('feed.process')->add('user_photo', Phpfox::getUserId(), serialize(array('destination' => $sFileName, 'server_id' => $iServerId))) : null;
             $this->call('$.ajaxCall(\'user.cropPhoto\', \'crop=true&js_disable_ajax_restart=true' . $sValues . '\');');
             if (Phpfox::isModule('photo')) {
                 Phpfox::getService('photo.album')->getForProfileView(Phpfox::getUserId(), true);
             }
         }
         return;
     }
     $aVals = $this->get('val');
     if (isset($aVals['skip_croping']) || !isset($aVals['skip_croping'])) {
         $this->call('p(\'Cropping photo.\');');
         if (Phpfox::getService('user.process')->cropPhoto($this->get('val'))) {
             /*
             				if ($this->get('crop'))
             				{
             * 
             */
             Phpfox::addMessage(Phpfox::getPhrase('user.profile_photo_successfully_updated'));
             Phpfox::setCookie('recache_image', 'yes', PHPFOX_TIME + 600);
             $this->call('window.location.href = \'' . Phpfox_Url::instance()->makeUrl('profile') . '\';');
             /*
             				}
             				else 
             				{
             					$this->show('#js_photo_preview_ajax')->html('#js_photo_preview_ajax', '<span class="valid_message">' . Phpfox::getPhrase('user.done') . '</span>', '.fadeOut(5000)');
             					$sImageAvatar = Phpfox::getLib('image.helper')->display(array(
             							'server_id' => Phpfox::getUserBy('server_id'),
             							'title' => Phpfox::getUserBy('full_name'),
             							'path' => 'core.url_user',
             							'file' => Phpfox::getUserBy('user_image'),
             							'suffix' => '_75_square',
             							'max_width' => 75,
             							'max_height' => 75,
             							'no_default' => true,
             							'time_stamp' => true,
             							'class' => 'border'		
             						)
             					);
             					$this->html('#js_user_avatar', $sImageAvatar);	
             				}			
             * 
             */
         } else {
             $this->show('#js_photo_preview_ajax')->html('#js_photo_preview_ajax', '');
         }
     }
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:phpfox-dist,代码行数:101,代码来源:ajax.class.php

示例10: process

 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if (!Phpfox::getParam('user.allow_user_registration')) {
         $this->url()->send('');
     }
     define('PHPFOX_DONT_SAVE_PAGE', true);
     if (Phpfox::isUser()) {
         $this->url()->send('profile');
     }
     $oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_form', 'aParams' => Phpfox::getService('user.register')->getValidation()));
     if ($aVals = $this->request()->getArray('val')) {
         $sTab = 'individual_tab';
         if (isset($aVals['type_register']) && $aVals['type_register'] == 'organization') {
             $sTab = 'organization_tab';
             $oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_form', 'aParams' => Phpfox::getService('organization.user')->getValidation()));
         }
         if (Phpfox::isModule('invite') && Phpfox::getService('invite')->isInviteOnly()) {
             if (Phpfox::getService('invite')->isValidInvite($aVals['invite_email'])) {
                 $iExpire = Phpfox::getParam('invite.invite_expire') > 0 ? Phpfox::getParam('invite.invite_expire') * 60 * 60 * 24 : 7 * 60 * 60 * 24;
                 Phpfox::setCookie('invite_only_pass', $aVals['invite_email'], PHPFOX_TIME + $iExpire);
                 $this->url()->send('user.register');
             }
         } else {
             if (!Phpfox::getParam('user.profile_use_id') && !Phpfox::getParam('user.disable_username_on_sign_up')) {
                 // http://www.phpfox.com/tracker/view/15155/
                 $aVals['user_name'] = str_replace(' ', '-', $aVals['user_name']);
                 $aVals['user_name'] = str_replace('_', '-', $aVals['user_name']);
                 Phpfox::getService('user.validate')->user($aVals['user_name']);
             }
             ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_1')) ? eval($sPlugin) : false;
             if (isset($aVals['type_register']) && $aVals['type_register'] == 'organization') {
                 Phpfox::getService('user.validate')->email($aVals['organization_email']);
             } else {
                 Phpfox::getService('user.validate')->email($aVals['email']);
             }
             if (Phpfox::getParam('user.reenter_email_on_signup')) {
                 if (empty($aVals['email']) || empty($aVals['confirm_email'])) {
                     Phpfox_Error::set(Phpfox::getPhrase('user.email_s_do_not_match'));
                 } else {
                     if ($aVals['email'] != $aVals['confirm_email']) {
                         Phpfox_Error::set(Phpfox::getPhrase('user.email_s_do_not_match'));
                     }
                 }
             }
             ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_2')) ? eval($sPlugin) : false;
             if ($oValid->isValid($aVals)) {
                 if ($iId = Phpfox::getService('user.process')->add($aVals)) {
                     if (isset($aVals['type_register']) && $aVals['type_register'] == 'organization') {
                         $aVals['email'] = $aVals['organization_email'];
                         $aVals['password'] = $aVals['organization_password'];
                     }
                     if (Phpfox::getService('user.auth')->login($aVals['email'], $aVals['password'])) {
                         if (is_array($iId)) {
                             ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_3')) ? eval($sPlugin) : false;
                             $this->url()->forward($iId[0]);
                         } else {
                             $sRedirect = Phpfox::getParam('user.redirect_after_signup');
                             if (!empty($sRedirect)) {
                                 ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_4')) ? eval($sPlugin) : false;
                                 if (PHPFOX_IS_AJAX) {
                                     echo 'window.location.href="' . Phpfox::getLib('url')->makeUrl($sRedirect) . '";';
                                     die;
                                 }
                                 $this->url()->send($sRedirect);
                             }
                             if (Phpfox::getParam('user.multi_step_registration_form') && is_array(Phpfox::getParam('user.registration_steps')) && count(Phpfox::getParam('user.registration_steps'))) {
                                 $aUrls = Phpfox::getParam('user.registration_steps');
                                 ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_5')) ? eval($sPlugin) : false;
                                 $this->url()->send($aUrls[0], 'register');
                             } else {
                                 ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_6')) ? eval($sPlugin) : false;
                                 if (Phpfox::getLib('session')->get('appinstall') != '') {
                                     $this->url()->send('apps.install.' . Phpfox::getLib('session')->get('appinstall'));
                                 } else {
                                     if (PHPFOX_IS_AJAX) {
                                         echo 'window.location.href="' . Phpfox::getLib('url')->makeUrl('') . '";';
                                         die;
                                     }
                                     $this->url()->send('');
                                 }
                             }
                         }
                     }
                 } else {
                     if (PHPFOX_IS_AJAX) {
                         $aErrors = Phpfox_Error::get();
                         echo '$(".' . $sTab . ' .register_error_panel").html("");';
                         foreach ($aErrors as $key => $value) {
                             $value = str_replace('"', "'", $value);
                             echo '$(".' . $sTab . ' .register_error_panel").append("<div>' . $value . '</div>");';
                         }
                         echo '$(".' . $sTab . ' .register_error_panel").fadeIn();';
                         die;
                     }
                     if (Phpfox::getParam('user.multi_step_registration_form')) {
                         $this->template()->assign('bIsPosted', true);
                         ($sPlugin = Phpfox_Plugin::get('user.component_controller_register_7')) ? eval($sPlugin) : false;
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:kr-indian,代码行数:101,代码来源:register.class.php

示例11: setUserSession

 public function setUserSession()
 {
     $oSession = Phpfox::getLib('session');
     $oRequest = Phpfox_Request::instance();
     $sSessionHash = $oSession->get('session');
     if (Phpfox::getParam('core.store_only_users_in_session')) {
         $this->_aSession = Phpfox::getService('user.auth')->getUserSession();
     } else {
         if ($sSessionHash) {
             $this->_aSession = Phpfox::getService('user.auth')->getUserSession();
             if (!isset($this->_aSession['session_hash']) && !Phpfox::getParam('core.store_only_users_in_session')) {
                 $this->database()->where("s.session_hash = '" . $this->database()->escape($oSession->get('session')) . "' AND s.id_hash = '" . $this->database()->escape($oRequest->getIdHash()) . "'");
                 $this->_aSession = $this->database()->select('s.session_hash, s.id_hash, s.captcha_hash, s.user_id')->from($this->_sTable, 's')->execute('getRow');
             }
         }
     }
     $sLocation = $oRequest->get(PHPFOX_GET_METHOD);
     $sLocation = substr($sLocation, 0, 244);
     $sBrowser = substr(Phpfox_Request::instance()->getBrowser(), 0, 99);
     $sIp = Phpfox_Request::instance()->getIp();
     if (Phpfox::getParam('core.log_site_activity')) {
         // Unsure why this is here. Causes http://www.phpfox.com/tracker/view/15330/
         // Perhaps instead of the database delete, the log is only for logged in users?
         // I cannot find a reason why the script should log guests activity.
         // Besides, guest activity may increase the number of inserts into this table very largely
         /*if(Phpfox::getUserId() > 0) 
         		{
         			$this->database()->delete($this->_sTable, 'user_id = ' . Phpfox::getUserId());
         		}*/
         // Like this:
         if (Phpfox::getUserId() > 0) {
             $this->database()->insert(Phpfox::getT('log_view'), array('user_id' => Phpfox::getUserId(), 'ip_address' => $sIp, 'protocal' => $_SERVER['REQUEST_METHOD'], 'cache_data' => serialize(array('location' => $_SERVER['REQUEST_URI'], 'referrer' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null, 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'request' => strtoupper($_SERVER['REQUEST_METHOD']) == 'POST' ? serialize($_POST) : serialize($_GET))), 'time_stamp' => PHPFOX_TIME));
         }
     }
     /**
      * @todo Needs to be added into the 'setting' db table
      */
     $aDisAllow = array('captcha/image');
     // Don't log a session into the DB if we disallow it
     if (Phpfox_Url::instance()->isUrl($aDisAllow)) {
         return;
     }
     $bIsForum = strstr($sLocation, Phpfox::getParam('core.module_forum')) ? true : false;
     $iForumId = 0;
     if ($bIsForum) {
         $aForumIds = explode('-', $oRequest->get('req2'));
         if (isset($aForumIds[count($aForumIds) - 1])) {
             $iForumId = (int) $aForumIds[count($aForumIds) - 1];
         }
     }
     $iIsHidden = 0;
     if (Phpfox::isUser()) {
         if (Phpfox::getUserBy('im_hide')) {
             $iIsHidden = 1;
         }
     }
     if (Phpfox::getParam('core.store_only_users_in_session')) {
         if (Phpfox::isUser()) {
             if (!isset($this->_aSession['session_hash'])) {
                 if (Phpfox::getUserId() > 0) {
                     $this->database()->delete(Phpfox::getT('session'), 'user_id = ' . Phpfox::getUserId());
                 }
                 $this->database()->insert(Phpfox::getT('session'), array('user_id' => Phpfox::getUserId(), 'last_activity' => PHPFOX_TIME));
             } else {
                 $this->database()->update(Phpfox::getT('session'), array('last_activity' => PHPFOX_TIME), 'user_id = ' . (int) Phpfox::getUserId());
             }
         }
     } else {
         if (!isset($this->_aSession['session_hash'])) {
             $sSessionHash = $oRequest->getSessionHash();
             if (Phpfox::getUserId() > 0) {
                 $this->database()->delete($this->_sTable, 'user_id = ' . Phpfox::getUserId());
             }
             $this->database()->insert($this->_sTable, array('session_hash' => $sSessionHash, 'id_hash' => $oRequest->getIdHash(), 'user_id' => Phpfox::getUserId(), 'last_activity' => PHPFOX_TIME, 'location' => $sLocation, 'is_forum' => $bIsForum ? '1' : '0', 'forum_id' => $iForumId, 'im_hide' => $iIsHidden, 'ip_address' => $sIp, 'user_agent' => $sBrowser));
             $oSession->set('session', $sSessionHash);
         } else {
             if (isset($this->_aSession['session_hash'])) {
                 $this->database()->update($this->_sTable, array('last_activity' => PHPFOX_TIME, 'user_id' => Phpfox::getUserId(), "location" => $sLocation, "is_forum" => $bIsForum ? "1" : "0", "forum_id" => $iForumId, 'im_hide' => $iIsHidden, "ip_address" => $sIp, "user_agent" => $sBrowser), "session_hash = '" . $this->_aSession["session_hash"] . "'");
             }
         }
     }
     if (!Phpfox::getCookie('visit')) {
         Phpfox::setCookie('visit', PHPFOX_TIME);
     }
     if (Phpfox::isUser()) {
         if (!Phpfox::getCookie('last_login')) {
             Phpfox::setCookie('last_login', PHPFOX_TIME, PHPFOX_TIME + Phpfox::getParam('log.active_session') * 60);
             if (Phpfox::getUserBy('last_activity') < PHPFOX_TIME + Phpfox::getParam('log.active_session') * 60) {
                 $this->database()->update(Phpfox::getT('user'), array('last_login' => PHPFOX_TIME), 'user_id = ' . Phpfox::getUserId());
                 $this->database()->insert(Phpfox::getT('user_ip'), array('user_id' => Phpfox::getUserId(), 'type_id' => 'session_login', 'ip_address' => Phpfox::getIp(), 'time_stamp' => PHPFOX_TIME));
             }
         }
         if (!Phpfox::getParam('user.disable_store_last_user')) {
             $this->database()->update(Phpfox::getT('user'), array('last_activity' => PHPFOX_TIME, 'last_ip_address' => Phpfox::getIp()), 'user_id = ' . Phpfox::getUserId());
         }
     }
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:97,代码来源:session.class.php

示例12: setUserSession


//.........这里部分代码省略.........
							'user_agent' => $_SERVER['HTTP_USER_AGENT'],
							'request' => (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST' ? serialize($_POST) : serialize($_GET))
						)
					),
					'time_stamp' => PHPFOX_TIME
				)
			);
		}

		/**
		 * @todo Needs to be added into the 'setting' db table
		 */
		$aDisAllow = array(
			'captcha/image'
		);
		
		// Don't log a session into the DB if we disallow it
		if (Phpfox::getLib('url')->isUrl($aDisAllow))
		{
			return;
		}	
		
		$bIsForum = (strstr($sLocation, Phpfox::getParam('core.module_forum')) ? true : false);
		$iForumId = 0;
		if ($bIsForum)
		{
			$aForumIds = explode('-', $oRequest->get('req2'));
			if (isset($aForumIds[(count($aForumIds) - 1)]))
			{
				$iForumId = (int) $aForumIds[(count($aForumIds) - 1)];				
			}			
		}
		
		$iIsHidden = 0;
		if (Phpfox::isUser())
		{
			if (Phpfox::getUserBy('im_hide'))
			{
				$iIsHidden = 1;	
			}			
		}
		
		if (!isset($this->_aSession['session_hash']))
		{
			$sSessionHash = $oRequest->getSessionHash();
			$this->database()->insert($this->_sTable, array(
					'session_hash' => $sSessionHash,
					'id_hash' => $oRequest->getIdHash(),
					'user_id' => Phpfox::getUserId(),
					'last_activity' => PHPFOX_TIME,
					'location' => $sLocation,
					'is_forum' => ($bIsForum ? '1' : '0'),
					'forum_id' => $iForumId,
					'im_hide' => $iIsHidden,
					'ip_address' => $sIp,
					'user_agent' => $sBrowser
				)
			);
			$oSession->set('session', $sSessionHash);
		}
		else 
		{
			$this->database()->update($this->_sTable, array(
				'last_activity' => PHPFOX_TIME, 
				'user_id' => Phpfox::getUserId(),
				"location" => $sLocation,
				"is_forum" => ($bIsForum ? "1" : "0"),
				"forum_id" => $iForumId,
				'im_hide' => $iIsHidden,
				"ip_address" => $sIp,
				"user_agent" => $sBrowser
			),"session_hash = '" . $this->_aSession["session_hash"] . "'");	
		}
		
		if (!Phpfox::getCookie('visit'))
		{
			Phpfox::setCookie('visit', PHPFOX_TIME);			
		}		
		
		if (Phpfox::isUser())
		{
			if (!Phpfox::getCookie('last_login'))
			{			
				Phpfox::setCookie('last_login', PHPFOX_TIME, (PHPFOX_TIME + (Phpfox::getParam('log.active_session') * 60)));
				if (Phpfox::getUserBy('last_activity') < (PHPFOX_TIME + (Phpfox::getParam('log.active_session') * 60)))
				{
					$this->database()->update(Phpfox::getT('user'), array('last_login' => PHPFOX_TIME), 'user_id = ' . Phpfox::getUserId());
					$this->database()->insert(Phpfox::getT('user_ip'), array(
							'user_id' => Phpfox::getUserId(),
							'type_id' => 'session_login',
							'ip_address' => Phpfox::getIp(),
							'time_stamp' => PHPFOX_TIME
						)
					);	
				}
			}		
			
			$this->database()->update(Phpfox::getT('user'), array('last_activity' => PHPFOX_TIME, 'last_ip_address' => Phpfox::getIp()), 'user_id = ' . Phpfox::getUserId());
		}
	}
开发者ID:hoanghd,项目名称:tools,代码行数:101,代码来源:session.class.php

示例13: clearLogin

 public function clearLogin($iUserId)
 {
     $this->database()->delete(Phpfox::getT('pages_login'), 'user_id = ' . (int) $iUserId);
     Phpfox::setCookie('page_login', '', -1);
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:5,代码来源:process.class.php


注:本文中的Phpfox::setCookie方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。