本文整理汇总了PHP中KRequest::referrer方法的典型用法代码示例。如果您正苦于以下问题:PHP KRequest::referrer方法的具体用法?PHP KRequest::referrer怎么用?PHP KRequest::referrer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KRequest
的用法示例。
在下文中一共展示了KRequest::referrer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _actionLogout
protected function _actionLogout(KCommandContext $context)
{
$result = JFactory::getApplication()->logout();
if (!JError::isError($result)) {
$this->_redirect = 'index.php?Itemid=' . JSite::getMenu()->getDefault()->id;
} else {
$this->setRedirect(KRequest::referrer(), $result->getError(), 'error');
}
}
示例2: _actionDelete
protected function _actionDelete(KCommandContext $context)
{
$data = parent::_actionDelete($context);
// TODO: Remove this temporary when upgrading Nooku Framework.
if ($context->status == KHttpResponse::NO_CONTENT) {
$context->status = KHttpResponse::OK;
}
$this->setRedirect(KRequest::referrer(), JText::_('Comment has been deleted.'), 'message');
return $data;
}
示例3: _actionCheckin
public function _actionCheckin(KCommandContext $context)
{
JFactory::getLanguage()->load('com_checkin', JPATH_ADMINISTRATOR);
$table = $this->getModel()->getTable();
$database = $table->getDatabase();
$query = 'UPDATE #__' . $table->getName() . ' SET `locked_on` = \'0000-00-00 00:00:00\', `locked_by` = 0 WHERE locked_by > 0;';
$database->execute($query);
$rows = $database->getConnection()->affected_rows;
$this->setRedirect(KRequest::referrer(), JText::plural('COM_CHECKIN_N_ITEMS_CHECKED_IN', $rows));
}
示例4: __construct
/**
* Constructor
*
* @param object An optional KConfig object with configuration options.
*/
public function __construct(KConfig $config)
{
//To prevent these states to be set while browsing after a delete/unwatch
$config->append(array('request' => array('sort' => 'created_on', 'direction' => 'desc')));
$config->persistent = false;
parent::__construct($config);
$this->registerCallback('before.add', array($this, 'setUser'));
$this->registerCallback('before.edit', array($this, 'setUser'));
$this->registerCallback('before.delete', array($this, 'beforeDelete'));
//Set default redirect
$this->_redirect = KRequest::referrer();
}
示例5: _afterDelete
protected function _afterDelete(KCommandContext $context)
{
if ($context->status == KHttpResponse::NO_CONTENT) {
$extension = $context->result instanceof KDatabaseRowsetInterface ? $context->result->top() : $context->result;
$url = KRequest::referrer();
$query = $url->getQuery(true);
$query['event'] = 'uninstall';
$query['name'] = $extension->name;
$query['version'] = $extension->version;
$url->setQuery($query);
$this->setRedirect($url);
}
}
示例6: 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);
}
}
}
示例7: _actionIndex
public function _actionIndex(KCommandContext $context)
{
// We will get all the items of the database and resave them to index everything.
set_time_limit(1440);
$modelIdentifier = clone $context->caller->getIdentifier();
$modelIdentifier->path = array('model');
$modelIdentifier->name = KInflector::pluralize($modelIdentifier->name);
$model = $this->getService($modelIdentifier);
$items = $model->limit(0)->getList();
foreach ($items as $item) {
$item->save();
}
JFactory::getApplication()->redirect(KRequest::referrer(), JText::_(ucfirst($modelIdentifier->name) . ' reindexed'));
}
示例8: _actionLogout
protected function _actionLogout(KCommandContext $context)
{
$users = $this->getModel()->getList();
if (count($users)) {
foreach ($users as $user) {
$clients = array(0, 1);
//Force logout from site and administrator
$result = JFactory::getApplication()->logout($user->id, array('clientid' => $clients));
if (JError::isError($result)) {
$this->_redirect_type = 'error';
$this->_redirect_message = $result->getError();
}
}
}
$this->_redirect = KRequest::referrer();
}
示例9: _actionLogout
protected function _actionLogout(KCommandContext $context)
{
$user = JFactory::getUser();
if ($user->id) {
$app = JFactory::getApplication();
$error = $app->logout();
if (!$error instanceof Exception) {
} else {
$context->status = KHttpResponse::OK;
}
}
if (KRequest::type() != 'AJAX') {
$this->_redirect = KRequest::referrer();
// return $rowset;
}
}
示例10: setReferrer
/**
* Set the referrer
*
* @return void
*/
public function setReferrer()
{
$identifier = $this->getMixer()->getIdentifier();
if (!KRequest::has('cookie.referrer_locked')) {
$request = KRequest::url();
$referrer = KRequest::referrer();
//Compare request url and referrer
if (!isset($referrer) || (string) $referrer == (string) $request) {
$option = 'com_' . $identifier->package;
$view = KInflector::pluralize($identifier->name);
$url = 'index.php?option=' . $option . '&view=' . $view;
$referrer = $this->getService('koowa:http.url', array('url' => $url));
}
KRequest::set('cookie.referrer', (string) $referrer);
}
}
示例11: _actionRemind
protected function _actionRemind(KCommandContext $context)
{
$email = KRequest::get('post.email', 'email');
if (!$this->getService('koowa:filter.email')->validate($email)) {
$this->setRedirect(KRequest::referrer(), JText::_('INVALID_EMAIL_ADDRESS'), 'error');
return false;
}
$user = $this->getService('com://site/users.model.users')->set('email', $email)->getItem();
if (!$user->id) {
$this->setRedirect(KRequest::referrer(), JText::_('COULD_NOT_FIND_EMAIL'), 'error');
return false;
}
$config = JFactory::getConfig();
$site_url = KRequest::url()->get(KHttpUrl::SCHEME | KHttpUrl::HOST | KHttpUrl::PORT);
$url = $site_url . JRoute::_('index.php?option=com_users&view=login');
$details = array('from_email' => $config->getValue('mailfrom'), 'from_name' => $config->getValue('fromname'), 'subject' => JText::sprintf('USERNAME_REMINDER_EMAIL_TITLE', $config->getValue('sitename')), 'body' => JText::sprintf('USERNAME_REMINDER_EMAIL_TEXT', $config->getValue('sitename'), $user->username, $url));
if (!JUtility::sendMail($details['from_email'], $details['from_name'], $email, $details['subject'], $details['body'])) {
$this->setRedirect(KRequest::referrer(), JText::_('ERROR_SENDING_REMINDER_EMAIL'), 'error');
return false;
}
}
示例12: __construct
public function __construct(KConfig $config)
{
parent::__construct($config);
$lang =& JFactory::getLanguage();
$orphans = $lang->getOrphans();
if ($orphans) {
ksort($orphans, SORT_STRING);
$guesses = array();
foreach ($orphans as $key => $occurance) {
if (is_array($occurance) and isset($occurance[0])) {
$info =& $occurance[0];
$file = @$info['step']['file'];
$guess = str_replace('_', ' ', $info['string']);
// Integers isn't translatable
if (is_numeric($key) || strpos($key, '??') === 0 || strpos($guess, '•') === 0) {
continue;
}
$guesses[] = array('file' => $file, 'keys' => strtoupper($key) . '=' . $guess);
}
}
$append = false;
foreach ($guesses as $guess) {
if (!$guess['file'] || strpos($guess['file'], '/components/' . $config->option . '/') === false && strpos($guess['file'], '/components/com_ninja/') === false) {
continue;
}
$append .= "\n" . $guess['keys'];
}
if (!$append) {
return;
}
$langfile = key($lang->getPaths($config->option));
$readfile = JFile::read($langfile);
$text = $readfile . "\n\n# " . KInflector::humanize(KRequest::get('get.view', 'cmd')) . "\n# @file " . $guess['file'] . "\n# @url " . KRequest::url() . "\n# @referrer " . KRequest::referrer() . "\n" . $append;
JFile::write($langfile, $text);
//echo $readfile;
//die('<pre>'.var_export($langfile, true).'</pre>');
}
//die('<script type="text/javascript">console.log('.json_encode($orphans).')</script>');
}
示例13: save
/**
* Saves the row to the database. And saves a Joomla User.
*
* This performs an intelligent insert/update and reloads the properties
* with fresh data from the table on success.
*
* @return boolean If successfull return TRUE, otherwise FALSE
*/
public function save()
{
$user = JUser::getInstance();
if (isset($this->_modified['password'])) {
$data = array('id' => $this->id, 'name' => $this->name, 'username' => $this->username, 'email' => $this->email, 'groups' => $this->groups);
if ($this->password !== '' && $this->password_verify !== '') {
$data['password'] = $this->password;
$data['password2'] = $this->password_verify;
}
$user->id = $this->id;
$user->bind($data);
if ($this->isNew() && empty($this->password)) {
JFactory::getApplication()->redirect(KRequest::referrer(), 'No password.', 'error');
}
if (!$user->save()) {
JFactory::getApplication()->redirect(KRequest::referrer(), 'Error while saving Joomla user.', 'error');
}
}
if ($this->isNew()) {
$this->setData(array('id' => $user->id, 'profile_user_id' => $user->id));
}
parent::save();
}
示例14: setMessage
/**
* Filter that creates a redirect message based on the action
*
* This function takes the row(set) status into account. If the status is STATUS_FAILED the status message information
* us used to generate an appropriate redirect message and set the redirect to the referrer. Otherwise, we generate the
* message based on the action and identifier name.
*
* @param KCommandContext The active command context
* @return void
*/
public function setMessage(KCommandContext $context)
{
if ($context->result instanceof KDatabaseRowsetInterface) {
$row = $context->result->top();
} else {
$row = $context->result;
}
$action = KRequest::get('post.action', 'cmd');
$name = $this->_identifier->name;
$status = $row->getStatus();
if ($status == KDatabase::STATUS_FAILED) {
$this->_redirect = KRequest::referrer();
$this->_redirect_type = 'error';
if ($row->getStatusMessage()) {
$this->_redirect_message = $row->getStatusMessage();
} else {
$this->_redirect_message = JText::_(ucfirst(KInflector::singularize($name)) . ' ' . $action . ' failed');
}
}
if (!is_null($status) && $status != KDatabase::STATUS_LOADED) {
$suffix = $action == 'add' || $action == 'edit' ? 'ed' : 'd';
$this->_redirect_message = JText::_(ucfirst(KInflector::singularize($name)) . ' ' . $action . $suffix);
}
}
示例15: unsetReferrer
/**
* Unset the referrer
*
* @return void
*/
public function unsetReferrer()
{
$identifier = $this->getMixer()->getIdentifier();
KRequest::set('cookie.referrer_' . md5(KRequest::referrer()), null);
}