本文整理汇总了PHP中JUri::isInternal方法的典型用法代码示例。如果您正苦于以下问题:PHP JUri::isInternal方法的具体用法?PHP JUri::isInternal怎么用?PHP JUri::isInternal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUri
的用法示例。
在下文中一共展示了JUri::isInternal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFormData
/**
* Method to get the data that should be injected in the form.
*
* @return array The default data is an empty array.
* @since 1.6
*/
protected function loadFormData()
{
// Check the session for previously entered login form data.
$app = JFactory::getApplication();
$data = $app->getUserState('users.login.form.data', array());
$input = $app->input;
$method = $input->getMethod();
// Check for return URL from the request first
if ($return = $input->{$method}->get('return', '', 'BASE64')) {
$data['return'] = base64_decode($return);
if (!JUri::isInternal($data['return'])) {
$data['return'] = '';
}
}
// Set the return URL if empty.
if (!isset($data['return']) || empty($data['return'])) {
$data['return'] = 'index.php?option=com_users&view=profile';
}
$app->setUserState('users.login.form.data', $data);
$this->preprocessData('com_users.login', $data);
//$user = JFactory::getUser();
// print_r($user->groups);
// exit;
//$data['return'] = JURI::base().'index.php/tracking-time'; // by anwar
return $data;
}
示例2: install
/**
* Install an extension.
*
* @return void
*
* @since 1.5
*/
public function install()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$model = $this->getModel('install');
if ($model->install()) {
$cache = JFactory::getCache('mod_menu');
$cache->clean();
// TODO: Reset the users acl here as well to kill off any missing bits.
}
$app = JFactory::getApplication();
$redirect_url = $app->getUserState('com_installer.redirect_url');
// Don't redirect to an external URL.
if (!JUri::isInternal($redirect_url)) {
$redirect_url = '';
}
if (empty($redirect_url)) {
$redirect_url = JRoute::_('index.php?option=com_installer&view=install', false);
} else {
// Wipe out the user state when we're going to redirect.
$app->setUserState('com_installer.redirect_url', '');
$app->setUserState('com_installer.message', '');
$app->setUserState('com_installer.extension_message', '');
}
$this->setRedirect($redirect_url);
}
示例3: update
/**
* Update a set of extensions.
*
* @return void
*
* @since 1.6
*/
public function update()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
/** @var InstallerModelUpdate $model */
$model = $this->getModel('update');
$uid = $this->input->get('cid', array(), 'array');
JArrayHelper::toInteger($uid, array());
// Get the minimum stability.
$component = JComponentHelper::getComponent('com_installer');
$params = $component->params;
$minimum_stability = $params->get('minimum_stability', JUpdater::STABILITY_STABLE, 'int');
$model->update($uid, $minimum_stability);
if ($model->getState('result', false)) {
$cache = JFactory::getCache('mod_menu');
$cache->clean();
}
$app = JFactory::getApplication();
$redirect_url = $app->getUserState('com_installer.redirect_url');
// Don't redirect to an external URL.
if (!JUri::isInternal($redirect_url)) {
$redirect_url = '';
}
if (empty($redirect_url)) {
$redirect_url = JRoute::_('index.php?option=com_installer&view=update', false);
} else {
// Wipe out the user state when we're going to redirect.
$app->setUserState('com_installer.redirect_url', '');
$app->setUserState('com_installer.message', '');
$app->setUserState('com_installer.extension_message', '');
}
$this->setRedirect($redirect_url);
}
示例4: getReturn
private function getReturn($key, $type)
{
$return = base64_decode($this->app->input->post->get($key, '', $type));
if (!JUri::isInternal($return)) {
$return = '';
}
return $return;
}
示例5: getReturnPage
/**
* Get the return URL.
* If a "return" variable has been passed in the request
*
* @return string The return URL.
*/
protected function getReturnPage()
{
$return = JRequest::getVar('return', null, 'default', 'base64');
if (empty($return) || !JUri::isInternal(base64_decode($return))) {
return JURI::base();
}
return base64_decode($return);
}
示例6: getReturnPage
/**
* Get the return URL
*
* If a "return" variable has been passed in the request
*
* @return string The return URL
*/
protected function getReturnPage()
{
$return = JFactory::getApplication()->input->get('return', '', 'base64');
if (empty($return) || !JUri::isInternal(base64_decode($return))) {
return JURI::base();
} else {
return base64_decode($return);
}
}
示例7: getReturnPage
protected function getReturnPage()
{
$return = $this->input->get('return', null, 'base64');
if (empty($return) || !JUri::isInternal(base64_decode($return))) {
return JUri::base();
} else {
return base64_decode($return);
}
}
示例8: prepareValueForDisplay
public function prepareValueForDisplay($value, $field)
{
if (!$value) {
return $value;
}
$attributes = '';
if (!JUri::isInternal($value)) {
$attributes = 'rel="nofollow" target="_blank"';
}
return '<a href="' . $value . '" ' . $attributes . '>' . $value . '</a>';
}
示例9: getInput
public function getInput($fieldValue = null)
{
if (!$this->isPublished())
{
return "";
}
$file_detect = 0;
$value = !is_null($fieldValue) ? $fieldValue : $this->value;
if ($value)
{
if (JUri::isInternal($value))
{
$file_detect = 1;
if (stripos($value, JUri::root()) === 0)
{
$path = JPATH_ROOT . "/" . str_replace(JUri::root(), "", $value);
}
else
{
$path = JPATH_ROOT . "/" . $value;
}
if (!JFile::exists($path))
{
$file_detect = 2;
}
}
}
$this->setAttribute("type", "text", "input");
$this->addAttribute("class", $this->getInputClass(), "input");
if ((int) $this->params->get("size", 32))
{
$this->setAttribute("size", (int) $this->params->get("size", 32), "input");
}
if ($this->params->get("placeholder", ""))
{
$placeholder = htmlspecialchars($this->params->get("placeholder", ""), ENT_COMPAT, 'UTF-8');
$this->setAttribute("placeholder", $placeholder, "input");
}
$this->setVariable('file_detect', $file_detect);
$this->setVariable('value', $value);
return $this->fetch('input.php', __CLASS__);
}
示例10: populateState
protected function populateState()
{
$app = JFactory::getApplication();
// Load the parameters.
$params = $app->getParams();
$this->setState('params', $params);
$this->mailNewIssueAdmins = $params->get('mailnewissueadmins');
$this->mailNewIssueUser = $params->get('mailnewissueuser');
$return = JRequest::getVar('return', null, 'default', 'base64');
if (!JUri::isInternal(base64_decode($return))) {
$return = null;
}
$this->setState('return_page', base64_decode($return));
}
示例11: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering Ordering column
* @param string $direction 'ASC' or 'DESC'
*
* @return void
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
$jinput = $app->input;
$return = $jinput->get('return', '', 'base64');
if (!JUri::isInternal(base64_decode($return))) {
$return = null;
}
$this->setState('return_page', base64_decode($return));
// Load the parameters.
$params = $app->getParams();
$this->setState('params', $params);
$this->setState('layout', $jinput->get('layout'));
}
示例12: getReturnURL
static function getReturnURL($params, $type)
{
global $cbSpecialReturnAfterLogin, $cbSpecialReturnAfterLogout;
static $returnUrl = null;
if (!isset($returnUrl)) {
$returnUrl = Application::Input()->get('get/return', '', GetterInterface::BASE64);
if ($returnUrl) {
$returnUrl = base64_decode($returnUrl);
if (!JUri::isInternal($returnUrl)) {
// The URL isn't internal to the site; reset it to index to be safe:
$returnUrl = 'index.php';
}
} else {
$isHttps = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off';
$returnUrl = 'http' . ($isHttps ? 's' : '') . '://' . $_SERVER['HTTP_HOST'];
if (!empty($_SERVER['PHP_SELF']) && !empty($_SERVER['REQUEST_URI'])) {
$returnUrl .= $_SERVER['REQUEST_URI'];
} else {
$returnUrl .= $_SERVER['SCRIPT_NAME'];
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
$returnUrl .= '?' . $_SERVER['QUERY_STRING'];
}
}
}
$returnUrl = cbUnHtmlspecialchars(preg_replace('/[\\\\"\\\'][\\s]*javascript:(.*)[\\\\"\\\']/', '""', preg_replace('/eval\\((.*)\\)/', '', htmlspecialchars(urldecode($returnUrl)))));
if (preg_match('/index.php\\?option=com_comprofiler&task=confirm&confirmCode=|index.php\\?option=com_comprofiler&view=confirm&confirmCode=|index.php\\?option=com_comprofiler&task=login|index.php\\?option=com_comprofiler&view=login/', $returnUrl)) {
$returnUrl = 'index.php';
}
}
$secureForm = (int) $params->get('https_post', 0);
if ($type == 'login') {
$loginReturnUrl = $params->get('login', $returnUrl);
if (isset($cbSpecialReturnAfterLogin)) {
$loginReturnUrl = $cbSpecialReturnAfterLogin;
}
$url = cbSef($loginReturnUrl, true, 'html', $secureForm);
} elseif ($type == 'logout') {
$logoutReturnUrl = $params->get('logout', 'index.php');
if ($logoutReturnUrl == '#') {
$logoutReturnUrl = $returnUrl;
}
if (isset($cbSpecialReturnAfterLogout)) {
$logoutReturnUrl = $cbSpecialReturnAfterLogout;
}
$url = cbSef($logoutReturnUrl, true, 'html', $secureForm);
} else {
$url = $returnUrl;
}
return base64_encode($url);
}
示例13: logout
/**
* Method to log out a user.
*
* @return void
*/
public function logout()
{
JSession::checkToken('request') or jexit(JText::_('JInvalid_Token'));
$app = JFactory::getApplication();
$userid = $this->input->getInt('uid', null);
$options = array('clientid' => $userid ? 0 : 1);
$result = $app->logout($userid, $options);
if (!$result instanceof Exception) {
$model = $this->getModel('login');
$return = $model->getState('return');
// Only redirect to an internal URL.
if (JUri::isInternal($return)) {
$app->redirect($return);
}
}
parent::display();
}
示例14: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
$credentials = array('username' => JRequest::getVar('username', '', 'method', 'username'), 'password' => JRequest::getVar('passwd', '', 'post', 'string', JREQUEST_ALLOWRAW), 'secretkey' => JRequest::getVar('secretkey', '', 'post', 'string', JREQUEST_ALLOWRAW));
$this->setState('credentials', $credentials);
// check for return URL from the request first
if ($return = JRequest::getVar('return', '', 'method', 'base64')) {
$return = base64_decode($return);
if (!JUri::isInternal($return)) {
$return = '';
}
}
// Set the return URL if empty.
if (empty($return)) {
$return = 'index.php';
}
$this->setState('return', $return);
}
示例15: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
$app = JFactory::getApplication();
// Load state from the request.
$pk = JRequest::getInt('sub_id');
$this->setState('htraininglogs.sub_id', $pk);
// Add compatibility variable for default naming conventions.
$this->setState('session.id', $pk);
$return = JRequest::getVar('return', null, 'default', 'base64');
if (!JUri::isInternal(base64_decode($return))) {
$return = null;
}
$this->setState('return_page', base64_decode($return));
// Load the parameters.
$params = $app->getParams();
$this->setState('params', $params);
$this->setState('layout', JRequest::getCmd('layout'));
}