/**
  * Test JRequest::getUri
  *
  * @return  void
  */
 public function testGetURI()
 {
     $uri = JUri::getInstance();
     $uri->setPath('/foo/bar');
     $uri->setQuery(array('baz' => 'buz'));
     $this->assertEquals('/foo/bar?baz=buz', JRequest::getUri());
 }
Example #2
0
 /**
  * This method adds alternate meta tags for associated menu items
  *
  * @return	nothing
  * @since	1.7
  */
 public function onAfterDispatch()
 {
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     if ($app->isSite() && $this->params->get('alternate_meta') && $doc->getType() == 'html') {
         // Get active menu item
         $active = $app->getMenu()->getActive();
         if (!$active) {
             return;
         }
         // Get menu item link
         if ($app->getCfg('sef')) {
             $active_link = JRoute::_('index.php?Itemid=' . $active->id, false);
         } else {
             $active_link = JRoute::_($active->link . '&Itemid=' . $active->id, false);
         }
         if ($active_link == JUri::base(true) . '/') {
             $active_link .= 'index.php';
         }
         // Get current link
         $current_link = JRequest::getUri();
         if ($current_link == JUri::base(true) . '/') {
             $current_link .= 'index.php';
         }
         // Check the exact menu item's URL
         if ($active_link == $current_link) {
             // Get menu item associations
             JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
             $associations = MenusHelper::getAssociations($active->id);
             // Remove current menu item
             unset($associations[$active->language]);
             // Associated menu items in other languages
             if ($associations && $this->params->get('menu_associations')) {
                 $menu = $app->getMenu();
                 $server = JURI::getInstance()->toString(array('scheme', 'host', 'port'));
                 foreach (JLanguageHelper::getLanguages() as $language) {
                     if (isset($associations[$language->lang_code])) {
                         $item = $menu->getItem($associations[$language->lang_code]);
                         if ($item && JLanguage::exists($language->lang_code)) {
                             if ($app->getCfg('sef')) {
                                 $link = JRoute::_('index.php?Itemid=' . $associations[$language->lang_code] . '&lang=' . $language->sef, false);
                             } else {
                                 $link = JRoute::_($item->link . '&Itemid=' . $associations[$language->lang_code] . '&lang=' . $language->sef, false);
                             }
                             $doc->addHeadLink($server . $link, 'alternate', 'rel', array('hreflang' => $language->lang_code));
                         }
                     }
                 }
             } elseif ($active->home) {
                 $menu = $app->getMenu();
                 $server = JURI::getInstance()->toString(array('scheme', 'host', 'port'));
                 foreach (JLanguageHelper::getLanguages() as $language) {
                     $item = $menu->getDefault($language->lang_code);
                     if ($item && $item->language != $active->language && $item->language != '*' && JLanguage::exists($language->lang_code)) {
                         if ($app->getCfg('sef')) {
                             $link = JRoute::_('index.php?Itemid=' . $item->id . '&lang=' . $language->sef, false);
                         } else {
                             $link = JRoute::_($item->link . '&Itemid=' . $item->id . '&lang=' . $language->sef, false);
                         }
                         $doc->addHeadLink($server . JRoute::_($item->link . '&Itemid=' . $item->id . '&lang=' . $language->sef), 'alternate', 'rel', array('hreflang' => $language->lang_code));
                     }
                 }
             }
         }
     }
 }
Example #3
0
					</tr>
					<?php 
    }
    ?>
				</tbody>
			</table>
	
		
		<?php 
}
?>

		<?php 
echo $this->pagination->getListFooter();
?>
		<input type="hidden" name="return" value="<?php 
echo base64_encode(JRequest::getUri());
?>
" />
		<input type="hidden" name="option" value="com_weldresource" />
		<input type="hidden" name="weldresource" value="workshop" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="sub" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<?php 
echo JHtml::_('form.token');
?>
	</div>
</form>
    return;
}
$type = 'entry';
if ($view == 'teamblog') {
    $type = 'teamblog';
}
if ($view == 'categories') {
    $type = 'category';
}
// This module will require the main script file since composer needs to be loaded
EB::init('site');
// Ensure that all script are loaded in the site.
EB::init('module');
// Attach modules stylesheet
EB::stylesheet('module')->attach();
// Get a list of subscribers
$model = EB::model('Subscription');
$subscribers = $model->getSubscribers($type, $id);
// Determines if the current user is subscribed
$subscribed = false;
$my = JFactory::getuser();
// Compile the return url
$return = base64_encode(JRequest::getUri());
if (!$my->guest) {
    $subscription = EB::table('Subscriptions');
    $exists = $subscription->load(array('uid' => $id, 'utype' => $type, 'user_id' => $my->id));
    if ($exists) {
        $subscribed = $subscription->id;
    }
}
require JModuleHelper::getLayoutPath('mod_easyblogsubscribers');
Example #5
0
 * @subpackage 	Template
 * @copyright (C) 2008 by Slashes & Dots Sdn Bhd - All rights reserved!
 * @license		GNU/GPL, see LICENSE.php
 *
 */
defined('_JEXEC') or die;
$view = JRequest::getVar('view', 'frontpage', 'REQUEST');
$groupKey = $customToolbar->getToolBarGroupKey();
$toolbarClass = array();
//$toolbarClass = array('frontpage'=> '', 'profile' => '', 'friends'=>'', 'apps'=>'', 'inbox'=>'', 'notify' => '', 'extra' => '' );
//$toolbarClass = array_fill_keys($groupKey, '');
if (!empty($groupKey)) {
    $emptyArr = array_fill(0, count($groupKey), '');
    $toolbarClass = array_combine($groupKey, $emptyArr);
}
$uri = JRequest::getUri();
$activeToolbar = $customToolbar->getActiveToolBarGroup($uri);
/**
 * If cannot locate the uri string, then we use view to determine.
 */
if (empty($activeToolbar)) {
    $activeToolbar = $customToolbar->getGroupActiveView($view);
}
$toolbarClass[$activeToolbar] = 'toolbar-active';
if (!empty($toolbarClass[TOOLBAR_PROFILE])) {
    $toolbarClass[TOOLBAR_PROFILE] = !$isMine && $activeToolbar == TOOLBAR_PROFILE ? '' : $toolbarClass[TOOLBAR_PROFILE];
}
?>

<script type="text/javascript" src="<?php 
echo JURI::root();
Example #6
0
	function onUserLogin($user, $options = array())
	{
		$mainframe = JFactory::getApplication('site');
			
		if (array_key_exists ('skip_joomdlehooks', $options))
			return;

		if ($mainframe->isAdmin()) 
			return;

		$username = $user['username'];
        $moodle_user = JoomdleHelperContent::call_method ("user_id", $username);
        // Do nothing if user does not exist in Moodle
        if (!$moodle_user)
            return;


		$comp_params = JComponentHelper::getParams( 'com_joomdle' );

		$moodle_url = $comp_params->get( 'MOODLE_URL' );
		$redirectless_sso = $comp_params->get( 'redirectless_sso' );

		$session                = JFactory::getSession();
		$token = md5 ($session->getId());

		/* Don't log in Moodle if user is blocked */
		$user_id = JUserHelper::getUserId($username);
		$user_obj = JFactory::getUser($user_id);
		if  ($user_obj->block)
			return;

		$app =  JFactory::getApplication();


		if (JRequest::getVar ('return'))
		{
			$return = JRequest::getVar ('return');
            if (!strncmp ($return, 'B:', 2))
            {
                /* CB login module */
                $login_url = urlencode (base64_decode (substr ($return, 2)));
            }
            else
            {
                /* Normal login */
                $login_url = urlencode (base64_decode (JRequest::getVar ('return')));
            }
		}
		else if (array_key_exists ('url', $options))
			$login_url = urlencode ($options['url']);
		else
			$login_url = urlencode (JRequest::getUri ());

		// Set the remember me cookie if enabled
		// as we are redirecting and this would not be executed by Joomla
		if (isset($options['remember']) && $options['remember'])
		{
			jimport('joomla.utilities.simplecrypt');
			jimport('joomla.utilities.utility');

			//Create the encryption key, apply extra hardening using the user agent string
			$key = JApplication::getHash(@$_SERVER['HTTP_USER_AGENT']);

			$credentials = array ('username'=>$username, 'password'=>$user['password']);

			$crypt = new JSimpleCrypt($key);
			$rcookie = $crypt->encrypt(serialize($credentials));
			$lifetime = time() + 365*24*60*60;
			setcookie( JApplication::getHash('JLOGIN_REMEMBER'), $rcookie, $lifetime, '/' );
		}
		// Metodo nuevo con cURL
		if ($redirectless_sso)
			plgUserJoomdlehooks::log_into_moodle ($username, $token);
		else  // Metodo normal usando redirect
			$app->redirect($moodle_url."/auth/joomdle/land.php?username=$username&token=$token&use_wrapper=0&create_user=0&wantsurl=$login_url" ); 
	}
Example #7
0
 function do_login($username, $options = array())
 {
     $mainframe = JFactory::getApplication('site');
     if (array_key_exists('skip_joomdlehooks', $options)) {
         return;
     }
     if ($mainframe->isAdmin()) {
         return;
     }
     $moodle_user = JoomdleHelperContent::call_method("user_id", $username);
     // Do nothing if user does not exist in Moodle
     if (!$moodle_user) {
         return;
     }
     $comp_params = JComponentHelper::getParams('com_joomdle');
     $moodle_url = $comp_params->get('MOODLE_URL');
     $redirectless_sso = $comp_params->get('redirectless_sso');
     $session = JFactory::getSession();
     $token = md5($session->getId());
     /* Don't log in Moodle if user is blocked */
     $user_id = JUserHelper::getUserId($username);
     $user_obj = JFactory::getUser($user_id);
     if ($user_obj->block) {
         return;
     }
     $app = JFactory::getApplication();
     if (JRequest::getVar('return')) {
         $return = JRequest::getVar('return');
         if (!strncmp($return, 'B:', 2)) {
             /* CB login module */
             $login_url = urlencode(base64_decode(substr($return, 2)));
         } else {
             /* Normal login */
             $login_url = urlencode(base64_decode(JRequest::getVar('return')));
         }
     } else {
         if (array_key_exists('url', $options)) {
             $login_url = urlencode($options['url']);
         } else {
             $login_url = urlencode(JRequest::getUri());
         }
     }
     $username = urlencode($username);
     // Metodo nuevo con cURL
     if ($redirectless_sso) {
         plgUserJoomdlehooks::log_into_moodle($username, $token);
     } else {
         // Metodo normal usando redirect
         $app->redirect($moodle_url . "/auth/joomdle/land.php?username={$username}&token={$token}&use_wrapper=0&create_user=0&wantsurl={$login_url}");
     }
 }