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


PHP KRequest::set方法代码示例

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


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

示例1: __construct

 /**
  * Constructor
  *
  * Prevent creating instances of this class by making the contructor private
  */
 private final function __construct(KConfig $config)
 {
     $content = self::content();
     if (self::type() == 'HTTP') {
         if (strpos(PHP_SAPI, 'cgi') !== false) {
             $authorization = KRequest::get('server.REDIRECT_HTTP_AUTHORIZATION', 'string');
         } else {
             $authorization = KRequest::get('server.HTTP_AUTHORIZATION', 'url');
         }
         if (strstr($authorization, "Basic")) {
             $parts = explode(':', base64_decode(substr($authorization, 6)));
             if (count($parts) == 2) {
                 KRequest::set('server.PHP_AUTH_USER', $parts[0]);
                 KRequest::set('server.PHP_AUTH_PW', $parts[1]);
             }
         }
     }
     if (!empty($content['data'])) {
         if ($content['type'] == 'application/x-www-form-urlencoded') {
             if (in_array(self::method(), array('PUT', 'DELETE'))) {
                 parse_str($content['data'], $GLOBALS['_' . self::method()]);
                 $GLOBALS['_REQUEST'] = array_merge($GLOBALS['_REQUEST'], $GLOBALS['_' . self::method()]);
             }
         }
         if ($content['type'] == 'application/json') {
             if (in_array(self::method(), array('POST', 'PUT', 'DELETE'))) {
                 $GLOBALS['_' . self::method()] = json_decode($content['data'], true);
                 $GLOBALS['_REQUEST'] = array_merge($GLOBALS['_REQUEST'], $GLOBALS['_' . self::method()]);
             }
         }
     }
 }
开发者ID:janssit,项目名称:www.marlinfishingcanaria.com,代码行数:37,代码来源:request.php

示例2: _initialize

 protected function _initialize(KConfig $config)
 {  
     //Force the view to prevent a redirect
     KRequest::set('get.view', 'results');
      
     parent::_initialize($config);
 }
开发者ID:raeldc,项目名称:com_learn,代码行数:7,代码来源:dispatcher.php

示例3: display

 public function display()
 {
     $topic = $this->getModel()->getItem();
     $this->forum = KFactory::get('site::com.ninjaboard.model.forums')->id($topic->forum_id)->getItem();
     $this->user = KFactory::get('lib.joomla.user');
     $me = KFactory::get('admin::com.ninjaboard.model.people')->getMe();
     $this->watch_button = $me->id && $this->forum->params['email_notification_settings']['enable_email_notification'];
     //Assign forum permissions to topic
     $topic->forum_permissions = $this->forum->forum_permissions;
     $topic->topic_permissions = $this->forum->topic_permissions;
     $topic->post_permissions = $this->forum->post_permissions;
     $topic->attachment_permissions = $this->forum->attachment_permissions;
     if ((!$this->forum->id || !$topic->id || $topic->topic_permissions < 1) && KFactory::tmp('lib.joomla.user')->guest) {
         $this->mixin(KFactory::get('admin::com.ninja.view.user.mixin'));
         $this->setLoginLayout();
         return parent::display();
     } elseif (!$topic->id) {
         JError::raiseError(404, JText::_("Topic not found."));
         return;
     } elseif (!$this->forum->id) {
         JError::raiseError(404, JText::_("Forum not found."));
         return;
     }
     $this->_subtitle = $topic->title;
     //if($topic->id && !KRequest::get('get.layout', 'cmd', false)) $this->setLayout('default');
     $state = $this->getModel()->getState();
     $limit = $state->limit ? $state->limit : 6;
     $offset = KFactory::tmp('site::com.ninjaboard.model.posts')->topic($topic->id)->post($state->post)->limit($limit)->getOffset();
     $offset = KRequest::get('get.offset', 'int', $offset);
     //This is used to set the canonical link correctly in the topic controller after.read
     //@TODO move all this logic out of the view in 1.2
     $this->getModel()->set(array('limit' => $limit, 'offset' => $offset));
     $this->assign('posts', KFactory::tmp('site::com.ninjaboard.controller.post')->setView(KFactory::tmp('site::com.ninjaboard.view.posts.html'))->setModel(KFactory::get('site::com.ninjaboard.model.posts')->setAcl(false))->sort('created_on')->limit($limit)->offset($offset)->post(false)->topic($topic->id)->layout('default')->display());
     if ($this->forum->params['view_settings']['new_topic_button'] == 'topic') {
         $this->new_topic_button = '<div class="new-topic">' . str_replace(array('$title', '$link'), array(JText::_('New Topic'), $this->createRoute('view=post&forum=' . $this->forum->id)), $this->forum->params['tmpl']['new_topic_button']) . '</div>';
     }
     $button = false;
     if (KFactory::get('lib.joomla.user')->guest || $this->forum->post_permissions > 1) {
         $button = str_replace(array('$title', '$link'), array(JText::_('Reply topic'), $this->createRoute('view=post&topic=' . $topic->id)), $this->forum->params['tmpl']['new_topic_button']);
     }
     //$this->reply_topic_button = $this->forum->post_permissions > 1 ? $button : null;
     $this->reply_topic_button = $button;
     $this->lock_topic_button = null;
     $this->move_topic_button = null;
     $this->delete_topic_button = null;
     if ($this->forum->topic_permissions > 2) {
         $this->lock_topic_button = $this->_createActionButton('lock', 'Lock topic', $topic->id, 'lock');
         $this->move_topic_button = str_replace(array('$title', '$link'), array(JText::_('Move topic'), $this->createRoute('view=topic&layout=move&id=' . $topic->id)), $this->forum->params['tmpl']['new_topic_button']);
         $this->delete_topic_button = $this->_createActionButton('delete', 'Delete topic', $topic->id, 'trash');
     }
     $output = parent::display();
     //@TODO move this to the controller
     $hit = KRequest::get('session.' . KFactory::get('admin::com.ninja.helper.default')->formid($topic->id), 'boolean');
     if (!$hit && $topic->created_user_id != $me->id) {
         $topic->hit();
         KRequest::set('session.' . KFactory::get('admin::com.ninja.helper.default')->formid($topic->id), true);
     }
     return $output;
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:59,代码来源:html.php

示例4: persistState

 /**
  * Restores a state for an action
  * 
  * @param  string $action
  * @return void
  */
 public function persistState($action)
 {
     $state = $this->getRequest();
     // Built the session identifier based on the action
     $identifier = $this->_mixer->getIdentifier() . '.' . $action;
     //Set the state in the session
     KRequest::set('session.' . $identifier, KConfig::unbox($state));
 }
开发者ID:walteraries,项目名称:anahita,代码行数:14,代码来源:persistable.php

示例5: _afterBrowse

 /**
  * Saves the model state in the session
  *
  * @param 	KCommandContext		The active command context
  * @return 	void
  */
 protected function _afterBrowse(KCommandContext $context)
 {
     $model = $this->getModel();
     $state = $model->get();
     // Built the session identifier based on the action
     $identifier = $model->getIdentifier() . '.' . $this->_action . '.' . $this->getModel()->get('section');
     //Set the state in the session
     KRequest::set('session.' . $identifier, $state);
 }
开发者ID:raeldc,项目名称:nooku-server,代码行数:15,代码来源:persistable.php

示例6: _actionOauthorize

 /**
  * Authorize an oauth profile to an actor. It needs to authorize 
  * 
  * @param  KCommandContext $context
  * @return void
  */
 protected function _actionOauthorize($context)
 {
     $data = $context->data;
     KRequest::set('session.return', (string) $data->return);
     KRequest::set('session.oauth', null);
     $view = $this->_mixer->getIdentifier()->name;
     $this->getAPI()->setToken(null);
     $context->response->setRedirect($this->getAPI()->getAuthorizationURL());
 }
开发者ID:walteraries,项目名称:anahita,代码行数:15,代码来源:oauthorizable.php

示例7: _actionGet

 protected function _actionGet(KCommandContext $context)
 {
     //Force the application template
     KRequest::set('get.tmpl', 'login');
     //Set the status
     $context->status = KHttpResponse::UNAUTHORIZED;
     //Set the authentciation header
     //$context->headers = array('WWW-Authenticate', 'Basic Realm="'.KRequest::base().'"');
     return parent::_actionGet($context);
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:10,代码来源:login.php

示例8: _afterBrowse

 /**
  * Saves the model state in the session
  *
  * @param 	KCommandContext		The active command context
  * @return 	void
  */
 protected function _afterBrowse(KCommandContext $context)
 {
     $model = $this->getModel();
     $state = $model->get();
     // Built the session identifier based on the action
     $identifier = $model->getIdentifier() . '.' . $context->action;
     //Prevent unused state information from being persisted
     KRequest::set('session.' . $identifier, null);
     //Set the state in the session
     KRequest::set('session.' . $identifier, $state);
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:17,代码来源:persistable.php

示例9: _initialize

 protected function _initialize(KConfig $config)
 {
     if (JFactory::getUser()->guest) {
         if (KRequest::method() == KHttpRequest::GET) {
             //Force the view to prevent a redirect
             KRequest::set('get.view', 'login');
             $config->controller = 'login';
         }
     }
     parent::_initialize($config);
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:11,代码来源:dispatcher.php

示例10: __construct

 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     KRequest::set('get.format', 'file');
     //When no id is set in the url, then we should assume the user wants to see his own profile
     $me = KFactory::get('site::com.ninjaboard.model.people')->getMe();
     $config->append(array('request' => array('id' => $me->id)));
     parent::__construct($config);
     //@TOD To prevent errors like on profile edit screen, remember to remove this line if we add layouts
     $this->_request->layout = 'default';
     $this->_request->format = 'file';
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:16,代码来源:avatar.php

示例11: onAfterStoreUser

 /**
  * store user method.
  *
  * Method is called after user data is stored in the database
  *
  * @param 	array		holds the new user data
  * @param 	bool		true if a new user is stored
  * @param	bool		true if user was succesfully stored in the database
  * @param	string		message
  */
 public function onAfterStoreUser($user, $isnew, $succes, $msg)
 {
     if (!$isnew) {
         return;
     }
     $invite_token = KRequest::get('session.invite_token', 'string', null);
     if (!$invite_token) {
         return;
     }
     KRequest::set('session.invite_token', null);
     $token = KService::get('repos:invites.token')->fetch(array('value' => $invite_token));
     $token->incrementUsed()->save();
 }
开发者ID:e-tyatte,项目名称:anahita,代码行数:23,代码来源:invites.php

示例12: saveReferrer

 /**
  * Store the referrer in the session
  *
  * @param 	KCommandContext		The active command context
  * @return void
  */
 public function saveReferrer(KCommandContext $context)
 {
     $referrer = KRequest::referrer();
     if (isset($referrer) && KRequest::type() == 'HTTP') {
         $request = KRequest::url();
         $request->get(KHttpUri::PART_PATH | KHttpUri::PART_QUERY);
         $referrer->get(KHttpUri::PART_PATH | KHttpUri::PART_QUERY);
         //Compare request url and referrer
         if ($request != $referrer) {
             KRequest::set('session.com.controller.referrer', (string) $referrer);
         }
     }
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:19,代码来源:form.php

示例13: _actionRender

 /**
  * Draw the toolbar
  *
  * @param KCommandContext $context The command context
  *
  * @return string
  */
 protected function _actionRender(KCommandContext $context)
 {
     if ($context->result !== false) {
         $view = $this->getController()->getView();
         //Set the document mimetype
         JFactory::getDocument()->setMimeEncoding($view->mimetype);
         //Disabled the application menubar
         if (!KInflector::isPlural($view->getName()) && !KRequest::has('get.hidemainmenu')) {
             KRequest::set('get.hidemainmenu', 1);
         }
     }
     return parent::_actionRender($context);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:20,代码来源:default.php

示例14: _actionSave2new

 /**
  * Saves the current row and redirects to a new edit form
  *
  * @param KCommandContext $context
  *
  * @return KDatabaseRowInterface A row object containing the saved data
  */
 protected function _actionSave2new(KCommandContext $context)
 {
     // Cache and lock the referrer since _ActionSave would unset it
     $referrer = $this->getReferrer();
     $this->lockReferrer();
     $result = $this->save($context);
     // Re-set the referrer
     KRequest::set('cookie.referrer', (string) $referrer);
     $identifier = $this->getMixer()->getIdentifier();
     $view = KInflector::singularize($identifier->name);
     $url = sprintf('index.php?option=com_%s&view=%s', $identifier->package, $view);
     $this->setRedirect($this->getService('koowa:http.url', array('url' => $url)));
     return $result;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:21,代码来源:editable.php

示例15: setTitle

 public function setTitle()
 {
     $title = KRequest::get('post.title', 'string', 'Untitled');
     $id = KRequest::get('get.id', 'int', 0);
     $table = KFactory::get(KFactory::get($this->getModel())->getTable());
     $primaryKey = current($table->getPrimaryKey())->name;
     $query = $table->getDatabase()->getQuery()->where('title', '=', $title)->where($primaryKey, '!=', $id);
     if ($table->count($query)) {
         KRequest::set('post.title', $title . ' ' . JText::_('copy'), 'string');
         if ((bool) $table->count($table->getDatabase()->getQuery()->where('title', '=', KRequest::get('post.title', 'string'))->where($primaryKey, '!=', $id))) {
             self::setTitle();
         }
     }
     return $this;
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:15,代码来源:default.php


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