本文整理汇总了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());
// check for return URL from the request first
if ($return = JRequest::getVar('return', '', 'method', '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);
return $data;
}
示例2: getItem
/**
* Returns the server
*
* @return JTable A database object
*
* @since 2.0.0
*/
public function getItem()
{
// Load the server
$id = $this->getState('server.id');
$item = $this->getTable();
if (!$item->load($id) || $item->published != 1) {
$this->setError(JText::_('COM_EXTERNALLOGIN_ERROR_SERVER_UNPUBLISHED'));
return false;
}
// Compute the url
$app = JFactory::getApplication();
$url = $app->input->server->getString('HTTP_REFERER');
if (empty($url) || !JURI::isInternal($url)) {
$redirect = JFactory::getApplication()->getParams('com_externallogin')->get('redirect');
$url = JURI::getInstance()->toString(array('scheme', 'user', 'pass', 'host', 'port')) . JRoute::_('index.php?Itemid=' . $redirect, true);
}
// Compute the URI
$uri = JFactory::getURI($url);
// Return the service/URL
if (JFactory::getUser()->guest) {
$uri->setVar('server', $item->id);
$results = $app->triggerEvent('onGetLoginUrl', array($item, $uri));
if (!empty($results)) {
return $results[0];
} else {
$this->setError(JText::_('COM_EXTERNALLOGIN_ERROR_OCCURS'));
}
} else {
return $uri;
}
}
示例3: getFilePath
/**
* Retrieve path to file in hard disk based from file URL
*
* @param string $file URL to the file
* @return string
*/
public static function getFilePath($file)
{
// Located file from root
if (strpos($file, '/') === 0) {
if (file_exists($tmp = realpath(str_replace(JUri::root(true), JPATH_ROOT, $file)))) {
return $tmp;
} elseif (file_exists($tmp = realpath($_SERVER['DOCUMENT_ROOT'] . '/' . $file))) {
return $tmp;
} elseif (file_exists($tmp = realpath(JPATH_ROOT . '/' . $file))) {
return $tmp;
}
}
if (strpos($file, '://') !== false && JURI::isInternal($file)) {
$path = parse_url($file, PHP_URL_PATH);
if (file_exists($tmp = realpath($_SERVER['DOCUMENT_ROOT'] . '/' . $path))) {
return $tmp;
} elseif (file_exists($tmp = realpath(JPATH_ROOT . '/' . $path))) {
return $tmp;
}
}
$rootURL = JUri::root();
$currentURL = JUri::current();
$currentPath = JPATH_ROOT . '/' . substr($currentURL, strlen($rootURL));
$currentPath = str_replace(DIRECTORY_SEPARATOR, '/', $currentPath);
$currentPath = dirname($currentPath);
return JPath::clean($currentPath . '/' . $file);
}
示例4: save
/**
* Saves a category
*
* @return void
* @since 1.5.5
*/
public function save()
{
$model = $this->getModel('editcategory');
// Get limitstart from request to set the correct limitstart (page) for redirect url
$slimitstart = '';
if (JRequest::getVar('limitstart', null) != null) {
$slimitstart = '&limitstart=' . JRequest::getInt('limitstart', 0);
}
// Set default redirect URL
$redirect = 'index.php?view=usercategories' . $slimitstart;
// Check whether a redirect is requested
if ($url = JRequest::getVar('redirect', '', '', 'base64')) {
$url = base64_decode($url);
if (JURI::isInternal($url)) {
$redirect = $url;
}
}
if ($id = $model->store()) {
$msg = JText::_('COM_JOOMGALLERY_COMMON_MSG_CATEGORY_SAVED');
$this->setRedirect(JRoute::_($redirect, false), $msg);
} else {
$msg = $model->getError();
$this->setRedirect(JRoute::_($redirect, false), $msg, 'error');
}
}
示例5: array
/**
* Method to get the login form.
*
* The base form is loaded from XML and then an event is fired
* for users plugins to extend the form with extra fields.
*
* @access public
* @param string $type The type of form to load (view, model);
* @return mixed JForm object on success, false on failure.
* @since 1.0
*/
function &getLoginForm()
{
// Set the form loading options.
$options = array('array' => false, 'event' => 'onPrepareUsersLoginForm', 'group' => 'users');
// Get the form.
$form = $this->getForm('login', 'com_users.login', $options);
// Check for an error.
if (JError::isError($form)) {
return $form;
}
// Check the session for previously entered login form data.
$app =& JFactory::getApplication();
$data = $app->getUserState('users.login.form.data', array());
// check for return URL from the request first
if ($return = JRequest::getVar('return', '', 'method', '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);
// Bind the form data if present.
if (!empty($data)) {
$form->bind($data);
}
return $form;
}
示例6: upload
/**
* Uploads the selected images
*
* @return void
* @since 1.5.5
*/
public function upload()
{
$this->_mainframe = JFactory::getApplication();
$type = $this->_mainframe->getUserStateFromRequest('joom.upload.type', 'type', 'single', 'post', 'cmd');
// If the applet in JAVA upload checks for the serverProtocol,
// it issues a HEAD request
// Simply return an empty doc to send a HTTP 200
if ($type == 'java' && $_SERVER['REQUEST_METHOD'] == 'HEAD') {
jexit();
}
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/upload.php';
$uploader = new JoomUpload();
if ($uploader->upload($type)) {
$msg = JText::_('COM_JOOMGALLERY_UPLOAD_MSG_SUCCESSFULL');
// Set redirect if we are asked for that
if ($redirect = JRequest::getVar('redirect', '', '', 'base64')) {
$url = base64_decode($redirect);
if (JURI::isInternal($url)) {
$this->setRedirect(JRoute::_($url, false), $msg);
return;
}
}
// Set a redirect according to the correspondent setting in configuration manager
$model = $this->getModel('upload');
$url = $model->getRedirectUrlAfterUpload($type);
if (!empty($url)) {
$this->setRedirect($url, $msg);
}
} else {
if ($error = $uploader->getError()) {
$this->setRedirect(JRoute::_('index.php?view=upload&tab=' . $type, false), $error, 'error');
}
}
}
示例7: login
/**
* Method to call when redirected back from google after authentication
* Grab the return URL if set and handle denial of app privileges from google
*
* @param object $credentials
* @param object $options
* @return void
*/
public function login(&$credentials, &$options)
{
$b64dreturn = '';
// Check the state for our return variable
if ($return = Request::getVar('state', '', 'method', 'base64')) {
$b64dreturn = base64_decode($return);
if (!JURI::isInternal($b64dreturn)) {
$b64dreturn = '';
}
}
$options['return'] = $b64dreturn;
// Set up the config for the google api instance
$client = new Google_Client();
$client->setClientId($this->params->get('app_id'));
$client->setClientSecret($this->params->get('app_secret'));
$client->setRedirectUri(self::getRedirectUri('google'));
// If we have a code comeing back, the user has authorized our app, and we can authenticate
if ($code = Request::getVar('code', NULL)) {
// Authenticate the user
$client->authenticate($code);
// Add the access token to the session
$session = App::get('session');
$session->set('google.token', $client->getAccessToken());
} else {
// User didn't authorize our app or clicked cancel
App::redirect(Route::url('index.php?option=com_users&view=login&return=' . $return), Lang::txt('PLG_AUTHENTICATION_GOOGLE_MUST_AUTHORIZE_TO_LOGIN', Config::get('sitename')), 'error');
}
}
示例8: save
function save($apply = false)
{
jimport('joomla.version');
$version = new JVersion();
if (JFactory::getApplication()->isSite() && JRequest::getInt('Itemid', 0)) {
if (version_compare($version->getShortVersion(), '1.6', '>=')) {
$menu = JSite::getMenu();
$item = $menu->getActive();
if (is_object($item)) {
JRequest::setVar('cb_controller', $item->params->get('cb_controller', null));
JRequest::setVar('cb_category_id', $item->params->get('cb_category_id', null));
}
} else {
$params = JComponentHelper::getParams('com_contentbuilder');
JRequest::setVar('cb_controller', $params->get('cb_controller', null));
JRequest::setVar('cb_category_id', $params->get('cb_category_id', null));
}
}
JRequest::setVar('cbIsNew', 0);
JRequest::setVar('cbInternalCheck', 1);
if (JRequest::getCmd('record_id', '')) {
contentbuilder::checkPermissions('edit', JText::_('COM_CONTENTBUILDER_PERMISSIONS_EDIT_NOT_ALLOWED'), class_exists('cbFeMarker') ? '_fe' : '');
} else {
JRequest::setVar('cbIsNew', 1);
contentbuilder::checkPermissions('new', JText::_('COM_CONTENTBUILDER_PERMISSIONS_NEW_NOT_ALLOWED'), class_exists('cbFeMarker') ? '_fe' : '');
}
$model = $this->getModel('edit');
$id = $model->store();
$submission_failed = JRequest::getBool('cb_submission_failed', false);
$cb_submit_msg = JRequest::setVar('cb_submit_msg', '');
$type = 'message';
if ($id && !$submission_failed) {
$msg = JText::_('COM_CONTENTBUILDER_SAVED');
$return = JRequest::getVar('return', '');
if ($return) {
$return = base64_decode($return);
if (!JRequest::getBool('cbInternalCheck', 1)) {
JFactory::getApplication()->redirect($return, $msg);
}
if (JURI::isInternal($return)) {
JFactory::getApplication()->redirect($return, $msg);
}
}
} else {
$apply = true;
// forcing to stay in form on errors
$type = 'error';
}
if (JRequest::getVar('cb_controller') == 'edit') {
$link = JRoute::_('index.php?option=com_contentbuilder&title=' . JRequest::getVar('title', '') . (JRequest::getVar('tmpl', '') != '' ? '&tmpl=' . JRequest::getVar('tmpl', '') : '') . (JRequest::getVar('layout', '') != '' ? '&layout=' . JRequest::getVar('layout', '') : '') . '&controller=edit&return=' . JRequest::getVar('return', '') . '&Itemid=' . JRequest::getInt('Itemid', 0), false);
} else {
if ($apply) {
$link = JRoute::_('index.php?option=com_contentbuilder&title=' . JRequest::getVar('title', '') . (JRequest::getVar('tmpl', '') != '' ? '&tmpl=' . JRequest::getVar('tmpl', '') : '') . (JRequest::getVar('layout', '') != '' ? '&layout=' . JRequest::getVar('layout', '') : '') . '&controller=edit&return=' . JRequest::getVar('return', '') . '&backtolist=' . JRequest::getInt('backtolist', 0) . '&id=' . JRequest::getInt('id', 0) . '&record_id=' . $id . '&Itemid=' . JRequest::getInt('Itemid', 0) . '&limitstart=' . JRequest::getInt('limitstart', 0) . '&filter_order=' . JRequest::getCmd('filter_order'), false);
} else {
$link = JRoute::_('index.php?option=com_contentbuilder&title=' . JRequest::getVar('title', '') . (JRequest::getVar('tmpl', '') != '' ? '&tmpl=' . JRequest::getVar('tmpl', '') : '') . (JRequest::getVar('layout', '') != '' ? '&layout=' . JRequest::getVar('layout', '') : '') . '&controller=list&id=' . JRequest::getInt('id', 0) . '&limitstart=' . JRequest::getInt('limitstart', 0) . '&filter_order=' . JRequest::getCmd('filter_order') . '&Itemid=' . JRequest::getInt('Itemid', 0), false);
}
}
$this->setRedirect($link, $msg, $type);
}
示例9: getRequestReturnUrl
public function getRequestReturnUrl()
{
if ($return = JRequest::getVar('return', '', 'method', 'base64')) {
$return = base64_decode($return);
if (!JURI::isInternal($return)) {
$return = '';
}
}
return $return;
}
示例10: login
/**
* Actions to perform when logging in a user session
*
* @param array $credentials login credentials
* @param array $options login options
* @return void
*/
public function login(&$credentials, &$options)
{
// Check for return param
if ($return = Request::getVar('return', '', 'method', 'base64')) {
$return = base64_decode($return);
if (!JURI::isInternal($return)) {
$return = '';
}
}
$options['return'] = $return;
}
示例11: _getReturnPage
protected function _getReturnPage()
{
$app =& JFactory::getApplication();
$context = $this->_context . '.';
if (!($return = $app->getUserState($context . '.return'))) {
$return = JRequest::getVar('return', base64_encode(JURI::base()));
}
$return = JFilterInput::getInstance()->clean($return, 'base64');
$return = base64_decode($return);
if (!JURI::isInternal($return)) {
$return = JURI::base();
}
return $return;
}
示例12: renderItems
/**
* Return HTML, subitems in menu
*
* @param: Array items
* @param: int $menuid
*/
protected function renderItems($mItems, $moduleid)
{
$items = '';
if (count($mItems)) {
for ($i = 0; $i < count($mItems); $i++) {
$publish = $mItems[$i]->published == 1 ? 'Unpublish' : 'Publish';
$class_unpublish = $mItems[$i]->published == 0 ? ' unpublish' : '';
$default = $mItems[$i]->home == 1 ? ' default' : '';
$uri = new JURI($mItems[$i]->link);
$link = $uri->toString();
//if external link
if (!JURI::isInternal($link)) {
$link = $mItems[$i]->link;
} else {
$link = JURI::root() . $link;
}
//if default item
if ($mItems[$i]->home == 1) {
$link = JURI::root();
}
$attributes = $this->getCheckboxAttributes($mItems[$i]->id, $moduleid);
if ($mItems[$i]->type == 'alias') {
$aliasparams = new JRegistry();
$aliasparams->loadString($mItems[$i]->params);
$address_itemid = $aliasparams->get('aliasoptions');
if ((int) $address_itemid > 0) {
$address_item = $this->getMenuItem($address_itemid);
if (!$address_item) {
continue;
}
$link = $address_item->link;
if (strpos($link, '?') === false) {
$link .= '?aliasoptions=' . $address_itemid . '&Itemid=' . $mItems[$i]->id;
} else {
$link .= '&aliasoptions=' . $address_itemid . '&Itemid=' . $mItems[$i]->id;
}
$mItems[$i]->link = $link;
}
}
if ($this->hasChild($mItems[$i]->id)) {
$subItems = $this->getItems($mItems[$i]->menutype, $mItems[$i]->id);
//Render item
$items .= JSNHtmlHelper::openTag('li') . JSNHtmlHelper::addInputTag('checkbox', $attributes) . JSNHtmlHelper::openTag('a', array('conClick' => 'javascript:void(0);', 'class' => $default . $class_unpublish, 'href' => $link, 'title' => $this->getMenuItemType($mItems[$i]->link))) . $mItems[$i]->title . JSNHtmlHelper::closeTag('a') . JSNHtmlHelper::openTag('ul', array('class' => 'jsn-menu-items', 'id' => 'item-' + $mItems[$i]->id)) . $this->renderItems($subItems, $moduleid) . JSNHtmlHelper::closeTag('ul') . JSNHtmlHelper::closeTag('li');
} else {
$items .= JSNHtmlHelper::openTag('li') . JSNHtmlHelper::addInputTag('checkbox', $attributes) . JSNHtmlHelper::openTag('a', array('onClick' => 'javascript:void(0);', 'class' => $default . $class_unpublish, 'href' => $link, 'title' => $this->getMenuItemType($mItems[$i]->link))) . $mItems[$i]->title . JSNHtmlHelper::closeTag('a') . JSNHtmlHelper::closeTag('li');
}
}
}
return $items;
}
示例13: getReturn
/**
* Get a return URL for the current page
*
* @return string Return page
*/
public static function getReturn()
{
$module = JModuleHelper::getModule("itpconnect");
$return = "";
if (!empty($module->params)) {
$params = new JRegistry($module->params);
$type = ItpcHelper::getType();
$return = ItpcHelper::getReturnURL($params, $type);
$return = base64_decode($return);
$return = JRoute::_($return, false);
}
if (!$return or !JURI::isInternal($return)) {
$return = "/";
}
return $return;
}
示例14: login
/**
* Method to call when redirected back from twitter after authentication
* Grab the return URL if set and handle denial of app privileges from twitter
*
* @param object $credentials
* @param object $options
* @return void
*/
public function login(&$credentials, &$options)
{
if ($return = Request::getVar('return', '', 'method', 'base64')) {
$b64dreturn = base64_decode($return);
if (!JURI::isInternal($b64dreturn)) {
$b64dreturn = '';
}
}
$options['return'] = $b64dreturn;
// Check to make sure they didn't deny our application permissions
if (Request::getWord('denied', false)) {
// User didn't authorize our app or clicked cancel
App::redirect(Route::url('index.php?option=com_users&view=login&return=' . $return), Lang::txt('PLG_AUTHENTICATION_TWITTER_MUST_AUTHORIZE_TO_LOGIN', Config::get('sitename')), 'error');
return;
}
}
示例15: upload
/**
* Uploads the selected images
*
* @return void
* @since 1.5.5
*/
public function upload()
{
$this->_mainframe = JFactory::getApplication();
$type = $this->_mainframe->getUserStateFromRequest('joom.upload.type', 'type', 'single', 'post', 'cmd');
// If the applet in JAVA upload checks for the serverProtocol,
// it issues a HEAD request
// Simply return an empty doc to send a HTTP 200
if ($type == 'java' && $_SERVER['REQUEST_METHOD'] == 'HEAD') {
jexit();
}
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/upload.php';
$uploader = new JoomUpload();
if ($uploader->upload($type)) {
//T.Trung
$db = JFactory::getDBO();
$db->setQuery("SELECT MAX(id) FROM #__joomgallery");
$img_id = $db->loadResult();
$db->setQuery("INSERT INTO #__joomgallery_image_details (id, details_key, details_value, ordering) VALUES ('" . $img_id . "', 'additional.tags', '" . JRequest::getVar('tags') . "', 4)");
$db->query();
$db->setQuery("INSERT INTO #__joomgallery_image_details (id, details_key, details_value, ordering) VALUES ('" . $img_id . "', 'additional.price', '" . JRequest::getVar('price') . "', 1)");
$db->query();
$db->setQuery("INSERT INTO #__joomgallery_image_details (id, details_key, details_value, ordering) VALUES ('" . $img_id . "', 'additional.code', '" . $this->generateRandomString() . "', 3)");
$db->query();
$db->setQuery("INSERT INTO #__joomgallery_image_details (id, details_key, details_value, ordering) VALUES ('" . $img_id . "', 'additional.like', 0, 2)");
$db->query();
//T.Trung end
$msg = JText::_('COM_JOOMGALLERY_UPLOAD_MSG_SUCCESSFULL');
// Set redirect if we are asked for that
if ($redirect = JRequest::getVar('redirect', '', '', 'base64')) {
$url = base64_decode($redirect);
if (JURI::isInternal($url)) {
$this->setRedirect(JRoute::_($url, false), $msg);
return;
}
}
// Set a redirect according to the correspondent setting in configuration manager
$model = $this->getModel('upload');
$url = $model->getRedirectUrlAfterUpload($type);
if (!empty($url)) {
$this->setRedirect($url, $msg);
}
} else {
if ($error = $uploader->getError()) {
$this->setRedirect(JRoute::_('index.php?view=upload&tab=' . $type, false), $error, 'error');
}
}
}