Example #1
1
 public function __construct(JForm $form = null)
 {
     parent::__construct($form);
     static $resources = true;
     if ($resources) {
         $resources = false;
         $name = basename(realpath(dirname(__FILE__) . "/../.."));
         $document = JFactory::getDocument();
         // $this->element is not ready on the constructor
         //$type = (string)$this->element["type"];
         $type = strtolower($this->type);
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) {
             $document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=" . $type . "&type=js");
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) {
             $document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $type . ".css");
         }
         $scope = JFactory::getApplication()->scope;
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $scope . ".js")) {
             $document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=" . $scope . "&type=js");
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $scope . ".css")) {
             $document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $scope . ".css");
         }
     }
 }
 public function display($tpl = null)
 {
     $this->_prepareDocument();
     //
     $user = JFactory::getUser();
     if ($user->guest) {
         $app = JFactory::getApplication();
         $return = base64_encode(JUri::current());
         $app->redirect(JRoute::_('index.php?option=com_users&view=login&return=' . $return));
         return false;
     }
     $this->providerList = $this->get('UnconnectedProviders');
     /*
     $layout = JRequest::getVar('layout');
     switch($layout){
     	case 'edit':
     		$this->form = $this->get('Form');
     		break;
     		
     	default: 
     		$this->data = $this->get('UserData');
     		break;
     }
     */
     //$this->data = $this->get('UserData');
     parent::display($tpl);
 }
Example #3
0
 /**
  * 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);
 }
Example #4
0
 /**
  * This event is triggered after the framework has loaded and the application initialise method has been called.
  *
  * @return	void
  */
 public function onAfterDispatch()
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $input = $app->input;
     // Check to make sure we are loading an HTML view and there is a main component area
     if ($document->getType() !== 'html' || $input->get('tmpl', '', 'cmd') === 'component' || $app->isAdmin()) {
         return true;
     }
     // Get additional data to send
     $attrs = array();
     $attrs['title'] = $document->title;
     $attrs['language'] = $document->language;
     $attrs['referrer'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : JUri::current();
     $attrs['url'] = JURI::getInstance()->toString();
     $user = JFactory::getUser();
     // Get info about the user if logged in
     if (!$user->guest) {
         $attrs['email'] = $user->email;
         $name = explode(' ', $user->name);
         if (isset($name[0])) {
             $attrs['firstname'] = $name[0];
         }
         if (isset($name[count($name) - 1])) {
             $attrs['lastname'] = $name[count($name) - 1];
         }
     }
     $encodedAttrs = urlencode(base64_encode(serialize($attrs)));
     $buffer = $document->getBuffer('component');
     $image = '<img style="display:none" src="' . trim($this->params->get('base_url'), ' \\t\\n\\r\\0\\x0B/') . '/mtracking.gif?d=' . $encodedAttrs . '" />';
     $buffer .= $image;
     $document->setBuffer($buffer, 'component');
     return true;
 }
 /**
  * Check for oAuth authentication/authorization requests and fire
  * appropriate oAuth events.
  *
  * @return  void
  */
 public function onAfterRoute()
 {
     if (JFactory::getApplication()->getName() == 'site') {
         $app = JFactory::getApplication();
         $session = JFactory::getSession();
         $uri = clone JUri::getInstance();
         $task = JArrayHelper::getValue($uri->getQuery(true), 'task');
         $task = $session->get('oauth.task', $task);
         $session->clear('oauth.task');
         $plugin = $session->get('oauth.plugin', $app->input->get('plugin'));
         $session->clear('oauth.plugin');
         if ($task) {
             JPluginHelper::importPlugin('authentication', $plugin);
             $dispatcher = JEventDispatcher::getInstance();
             if ($task == 'oauth.authenticate') {
                 $data = $app->getUserState('users.login.form.data', array());
                 $data['return'] = $app->input->get('return', null);
                 $app->setUserState('users.login.form.data', $data);
                 // update the current task and pass the plugin to the session.
                 $session->set('oauth.task', 'oauth.authorize');
                 $session->set('oauth.plugin', $plugin);
                 $dispatcher->trigger('onOauthAuthenticate', array());
             } else {
                 if ($task == 'oauth.authorize') {
                     $array = $dispatcher->trigger('onOauthAuthorize', array());
                     // redirect user to appropriate area of site.
                     if ($array[0] === true) {
                         $data = $app->getUserState('users.login.form.data', array());
                         $app->setUserState('users.login.form.data', array());
                         $user = JFactory::getUser();
                         if ($this->params->get('review_profile', false) && !(bool) $user->getParam("profile.reviewed", false)) {
                             $item = JFactory::getApplication()->getMenu('site')->getItems(array('link'), array('index.php?option=com_users&view=profile&layout=edit'), true);
                             if ($item) {
                                 $redirect = 'index.php?Itemid=' . $item->id;
                             } else {
                                 $redirect = 'index.php?option=com_users&view=profile&layout=edit';
                             }
                             if ($return) {
                                 $redirect .= '&return=' . $return;
                             }
                             $user->setParam('profile.reviewed', (int) true);
                             $user->save();
                         } else {
                             if ($return = JArrayHelper::getValue($data, 'return')) {
                                 $redirect = base64_decode($return);
                             } else {
                                 $redirect = JUri::current();
                             }
                         }
                         $app->redirect(JRoute::_($redirect, false));
                     } else {
                         $app->redirect(JRoute::_('index.php?option=com_users&view=login', false));
                     }
                 }
             }
         }
     }
 }
Example #6
0
 /**
  * Submit contact form
  */
 function contact()
 {
     $model = $this->getModel('Item');
     if ($model->contact()) {
         $this->setRedirect(JUri::current(), JText::_('COM_JKIT_ITEM_CONTACT_OK'));
     } else {
         $this->setRedirect(JUri::current(), $model->getError(), 'error');
     }
 }
 /**
  * Authenticate the user via the oAuth login and authorize access to the
  * appropriate REST API end-points.
  */
 public function onOauthAuthenticate()
 {
     $oauth = new JTwitterOAuth();
     $oauth->setOption('callback', JUri::current());
     $oauth->setOption('consumer_key', $this->params->get('clientid'));
     $oauth->setOption('consumer_secret', $this->params->get('clientsecret'));
     $oauth->setOption('sendheaders', true);
     $oauth->authenticate();
 }
Example #8
0
 /**
  * Constructor
  *
  * @param	object	&$subject  The object to observe
  * @param	array	$config	   An array that holds the plugin configuration
  *
  * @access	protected
  */
 public function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     // Save this page's URL
     $uri = JFactory::getURI();
     $return = '&return=' . urlencode(base64_encode(JUri::current() . '?' . $uri->getQuery()));
     $app = JFactory::getApplication();
     $app->setUserState('com_attachments.current_url', $return);
     $this->loadLanguage();
 }
Example #9
0
 function plgSystemCCK(&$subject, $config)
 {
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         JFactory::getLanguage()->load('lib_cck', JPATH_SITE);
         if (file_exists(JPATH_SITE . '/plugins/cck_storage_location/joomla_user_note/joomla_user_note.php')) {
             $this->content_objects['joomla_user_note'] = 1;
         }
     }
     jimport('joomla.filesystem.file');
     jimport('cck.base.cck');
     // deprecated
     // Content
     jimport('cck.content.article');
     //jimport( 'cck.content.category' );
     jimport('cck.content.content');
     jimport('cck.content.user');
     // Development
     jimport('cck.development.database');
     // deprecated
     $this->multisite = JCck::_setMultisite();
     if ($this->multisite === true) {
         $this->site = null;
         $this->site_cfg = new JRegistry();
         if (JCck::isSite()) {
             $this->site = JCck::getSite();
             $this->site_cfg->loadString($this->site->configuration);
             if ($app->isSite() && $this->site) {
                 // --- Redirect to Homepage
                 $homepage = $this->site_cfg->get('homepage', 0);
                 if ($homepage > 0) {
                     $current = JUri::current(true);
                     $len = strlen($current);
                     if ($current[$len - 1] == '/') {
                         $current = substr($current, 0, -1);
                     }
                     $current = str_replace(array('http://', 'https://'), '', $current);
                     if ($current == $this->site->host) {
                         $redirect_url = JRoute::_('index.php?Itemid=' . $homepage);
                         if ($redirect_url != JUri::root(true) . '/') {
                             JFactory::getApplication()->redirect($redirect_url);
                         }
                     }
                 }
                 // ---
                 $tag = $this->site_cfg->get('language');
                 if ($tag) {
                     JFactory::getConfig()->set('language', $tag);
                     JFactory::getLanguage()->setLanguage($tag);
                 }
             }
         }
     }
     parent::__construct($subject, $config);
 }
Example #10
0
 public function __construct(JForm $form = null)
 {
     parent::__construct($form);
     static $resources = true;
     if ($resources) {
         $resources = false;
         $name = basename(realpath(dirname(__FILE__) . "/../.."));
         $document = JFactory::getDocument();
         $type = strtolower($this->type);
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) {
             $document->addScript(JUri::current() . "?option=" . $name . "&amp;view=loader&amp;filename=" . $type . "&amp;type=js");
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) {
             $document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $type . ".css");
         }
         $scope = JFactory::getApplication()->scope;
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $scope . ".js")) {
             $document->addScript(JUri::current() . "?option=" . $name . "&amp;view=loader&amp;filename=" . $scope . "&amp;type=js");
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $scope . ".css")) {
             $document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $scope . ".css");
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/glDatePicker.js")) {
             $document->addScript(JUri::current() . "?option=" . $name . "&amp;view=loader&amp;filename=glDatePicker&amp;type=js");
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/glDatePicker.css")) {
             $document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/glDatePicker.css");
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/style.css")) {
             $document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/style.css");
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/script.js")) {
             $document->addScript(JUri::current() . "?option=" . $name . "&amp;view=loader&amp;filename=script&amp;type=js");
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/jquery.mjs.nestedSortable.js")) {
             $document->addScript(JUri::current() . "?option=" . $name . "&amp;view=loader&amp;filename=jquery.mjs.nestedSortable&amp;type=js");
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/nestedSortable.css")) {
             $document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/nestedSortable.css");
         }
         $GLOBALS["com_name"] = basename(realpath(dirname(__FILE__) . "/../.."));
         $module = JFactory::getApplication()->input->get("option") == "com_modules";
         $language = JFactory::getLanguage();
         $enGB = $language->get("tag") == $language->getDefault();
         if (!$enGB || $module) {
             $language->load($GLOBALS["com_name"], JPATH_ADMINISTRATOR, $language->getDefault(), true);
             $language->load($GLOBALS["com_name"], JPATH_ADMINISTRATOR, null, true);
         }
     }
 }
Example #11
0
 protected function getInput()
 {
     $name = basename(realpath(dirname(__FILE__) . "/../.."));
     static $resources = true;
     $i18n = array('public' => JText::_("COM_OZIOGALLERY3_ALBUM_PUBLIC"), 'private' => JText::_("COM_OZIOGALLERY3_ALBUM_PRIVATE"), 'protected' => JText::_("COM_OZIOGALLERY3_ALBUM_PROTECTED"), 'topublic' => JText::_("COM_OZIOGALLERY3_ALBUM_TOPUBLIC"), 'toprivate' => JText::_("COM_OZIOGALLERY3_ALBUM_TOPRIVATE"), 'toprotected' => JText::_("COM_OZIOGALLERY3_ALBUM_TOPROTECTED"));
     if ($resources) {
         $resources = false;
         JHtml::_('behavior.framework', true);
         $document = JFactory::getDocument();
         $prefix = JUri::current() . "?option=" . $name . "&amp;view=loader";
         // pwi
         $document->addScript(JUri::root(true) . "/media/" . $name . "/js/jquery-pwi.js");
         // Alternative code: $type = strtolower($this->type);
         $type = (string) $this->element["type"];
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) {
             $document->addScript($prefix . "&amp;type=js&amp;filename=" . $type);
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) {
             $document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $type . ".css");
         }
         // per la compatibilità con Internet Explorer
         $document->addScript(JURI::root(true) . "/media/" . $name . "/js/jQuery.XDomainRequest.js");
         $document->addScript(JUri::base(true) . "/components/com_oziogallery3/js/get_id.js");
         $document->addScriptDeclaration("var g_ozio_admin_buttons=" . json_encode($i18n) . ";");
         $document->addStyleSheet(JUri::base(true) . "/components/com_oziogallery3/models/fields/fields.css");
     }
     $buttons = '';
     $buttons .= '<div class="ozio-buttons-frame">';
     $buttons .= '<iframe style="margin:0;padding:0;border:0;width:30px;height:22px;overflow:hidden;" src="https://www.opensourcesolutions.es/album_publish_v2.html"></iframe>';
     $buttons .= '</div>';
     $html = array();
     $html[] = '<div id="oziogallery-modal" class="modal hide fade" >';
     $html[] = '';
     $html[] = '	<div class="modal-header">';
     $html[] = '		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>';
     $html[] = '		<h3>Ozio Gallery</h3>';
     $html[] = '	</div>';
     $html[] = '	<div class="modal-body" style="overflow-y:auto;">';
     $html[] = '			<div class="alert alert-info"><button type="button" class="close" data-dismiss="alert">×</button> ';
     $html[] = '			<p><strong>' . JText::_("COM_OZIOGALLERY3_WAIT_GDATA_MSG") . '</strong></p></div> ';
     $html[] = '	<table class="table table-striped">';
     $html[] = '	</table>';
     $html[] = '	</div>';
     $html[] = '	<div class="modal-footer">';
     $html[] = '		<button class="btn" data-dismiss="modal" aria-hidden="true">OK</button>';
     $html[] = '	</div>';
     $html[] = '</div>';
     $buttons .= implode(" ", $html);
     return '<div id="album_selection">' . parent::getInput() . $buttons . '<img id="jform_params_' . (string) $this->element["name"] . '_loader" style="display:none;" src="' . JUri::root(true) . '/media/' . $name . '/views/00fuerte/img/progress.gif">' . '<span id="jform_params_' . (string) $this->element["name"] . '_warning" style="display:none;">' . JText::_("COM_OZIOGALLERY3_ERR_INVALID_USER") . '</span>' . '<span id="jform_params_' . (string) $this->element["name"] . '_selected" style="display:none;">' . $this->value . '</span>' . '</div>';
 }
Example #12
0
 public function __construct(JForm $form = null)
 {
     parent::__construct($form);
     /*
     					 (include_once JPATH_ROOT . "/components/com_foxcontact/helpers/flogger.php") or die(JText::sprintf("JLIB_FILESYSTEM_ERROR_READ_UNABLE_TO_OPEN_FILE", "flogger.php"));
     					 $log = new FLogger($this->type, "debug");
     					 $log->Write($this->element["name"] . " getLabel()");
     */
     static $resources = true;
     if ($resources) {
         $resources = false;
         $name = basename(realpath(dirname(__FILE__) . "/../.."));
         $document = JFactory::getDocument();
         // $this->element is not ready on the constructor
         //$type = (string)$this->element["type"];
         $type = strtolower($this->type);
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) {
             $document->addScript(JUri::current() . "?option=" . $name . "&amp;view=loader&amp;filename=" . $type . "&amp;type=js");
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) {
             $document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $type . ".css");
         }
         $scope = JFactory::getApplication()->scope;
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $scope . ".js")) {
             $document->addScript(JUri::current() . "?option=" . $name . "&amp;view=loader&amp;filename=" . $scope . "&amp;type=js");
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $scope . ".css")) {
             $document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $scope . ".css");
         }
         $GLOBALS["com_name"] = basename(realpath(dirname(__FILE__) . "/../.."));
         // If we are in module manager always load the language, since the default module admin language is empty
         $option = JFactory::getApplication()->input->get("option");
         // $option != "com_menus" includes "com_modules", "com_advancedmodules" and similar module manager
         $module = $option != "com_menus";
         $language = JFactory::getLanguage();
         $enGB = $language->get("tag") == $language->getDefault();
         // If we are within the component, don't waste our time reloading the same English language two more times.
         // Using less CPU power reduces the world carbon dioxide emissions.
         if (!$enGB || $module) {
             // The current language is already been loaded, so it is important for the following workaround to work, that the parameter $reload is set to true
             // Reload the default language (en-GB)
             $language->load($GLOBALS["com_name"], JPATH_ADMINISTRATOR, $language->getDefault(), true);
             // Reload current language, overwriting nearly all the strings, but keeping the english version for untranslated strings
             $language->load($GLOBALS["com_name"], JPATH_ADMINISTRATOR, null, true);
         }
     }
 }
Example #13
0
 /**
  * Add the canonical uri to the head
  *
  * @return  void
  *
  * @since   3.0
  */
 public function onAfterRoute()
 {
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     if ($app->getName() != 'site' || $doc->getType() !== 'html') {
         return true;
     }
     $uri = JUri::getInstance();
     $domain = $this->params->get('domain');
     $current = JUri::current();
     if ($domain === null || $domain === '') {
         $domain = $uri->toString(array('scheme', 'host', 'port'));
     }
     $link = 'index.php' . $uri->toString(array('query', 'fragment'));
     $link = $domain . JRoute::_($link);
     if ($current !== $link) {
         $doc->addHeadLink($link, 'canonical');
     }
 }
Example #14
0
 protected function getInput()
 {
     $name = basename(realpath(dirname(__FILE__) . "/../.."));
     static $resources = true;
     if ($resources) {
         $resources = false;
         $document = JFactory::getDocument();
         $prefix = JUri::current() . "?option=" . $name . "&amp;view=loader";
         // pwi
         $document->addScript(JUri::root(true) . "/components/" . $name . "/js/jquery-pwi.js");
         // Alternative code: $type = strtolower($this->type);
         $type = (string) $this->element["type"];
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) {
             $document->addScript($prefix . "&amp;type=js&amp;filename=" . $type);
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) {
             $document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $type . ".css");
         }
         // per la compatibilità con Internet Explorer
         $document->addScript(JURI::root(true) . "/components/" . $name . "/js/jQuery.XDomainRequest.js");
     }
     return '<div id="album_selection">' . parent::getInput() . '<img id="jform_params_' . (string) $this->element["name"] . '_loader" style="display:none;" src="' . JUri::root(true) . '/components/' . $name . '/views/00fuerte/img/progress.gif">' . '<span id="jform_params_' . (string) $this->element["name"] . '_warning" style="display:none;">' . JText::_("COM_OZIOGALLERY3_ERR_INVALID_USER") . '</span>' . '<span id="jform_params_' . (string) $this->element["name"] . '_selected" style="display:none;">' . $this->value . '</span>' . '</div>';
 }
 function getCalendarLink($month, $year)
 {
     $getquery = JRequest::get('GET');
     //get the GET query
     $calendarLink = JUri::current() . '?';
     //get the current url, without the GET query; and add "?", to set the GET vars
     foreach ($getquery as $key => $value) {
         /*this bucle goes through every GET variable that was in the url*/
         if ($key != 'month' and $key != 'year' and $key != 'day' and $value) {
             /*the month,year, and day Variables must be diferent of the current ones, because this is a link for a diferent month */
             $calendarLink .= $key . '=' . $value . '&amp;';
         }
     }
     $calendarLink .= 'month=' . $month . '&amp;year=' . $year;
     //add the month and the year that was passed to the function to the GET string
     return $calendarLink;
 }
Example #16
0
<?php 
if ($headerText) {
    ?>
	<div class="pretext"><p><?php 
    echo $headerText;
    ?>
</p></div>
<?php 
}
?>

<?php 
if ($params->get('dropdown', 1)) {
    ?>
	<form name="lang" method="post" action="<?php 
    echo htmlspecialchars(JUri::current(), ENT_COMPAT, 'UTF-8');
    ?>
">
	<select class="inputbox" onchange="document.location.replace(this.value);" >
	<?php 
    foreach ($list as $language) {
        ?>
		<option dir=<?php 
        echo $language->rtl ? '"rtl"' : '"ltr"';
        ?>
 value="<?php 
        echo $language->link;
        ?>
" <?php 
        echo $language->active ? 'selected="selected"' : '';
        ?>
Example #17
0
 /**
  *
  * Show thememagic form
  */
 public static function thememagic($path)
 {
     $app = JFactory::getApplication();
     $input = $app->input;
     $isadmin = $app->isAdmin();
     if ($isadmin) {
         $tplparams = T3::getTplParams();
     } else {
         $tplparams = $app->getTemplate(true)->params;
     }
     $url = $isadmin ? JUri::root(true) . '/index.php' : JUri::current();
     $url .= (preg_match('/\\?/', $url) ? '&' : '?') . 'themer=1';
     $url .= $tplparams->get('theme', -1) != -1 ? '&t3style=' . $tplparams->get('theme') : '';
     if ($isadmin) {
         $url .= '&t3tmid=' . $input->getCmd('id');
     }
     $assetspath = T3_TEMPLATE_PATH;
     $themepath = $assetspath . '/less/themes';
     if (!class_exists('JRegistryFormatLESS')) {
         include_once T3_ADMIN_PATH . '/includes/format/less.php';
     }
     $themes = array();
     $jsondata = array();
     //push a default theme
     $tobj = new stdClass();
     $tobj->id = 'base';
     $tobj->title = JText::_('JDEFAULT');
     $themes['base'] = $tobj;
     $varfile = $assetspath . '/less/variables.less';
     if (file_exists($varfile)) {
         $params = new JRegistry();
         $params->loadString(JFile::read($varfile), 'LESS');
         $jsondata['base'] = $params->toArray();
     }
     if (JFolder::exists($themepath)) {
         $listthemes = JFolder::folders($themepath);
         if (count($listthemes)) {
             foreach ($listthemes as $theme) {
                 $varsfile = $themepath . '/' . $theme . '/variables-custom.less';
                 if (file_exists($varsfile)) {
                     $tobj = new stdClass();
                     $tobj->id = $theme;
                     $tobj->title = $theme;
                     //check for all less file in theme folder
                     $params = false;
                     $others = JFolder::files($themepath . '/' . $theme, '.less');
                     foreach ($others as $other) {
                         //get those developer custom values
                         if ($other == 'variables.less') {
                             $params = new JRegistry();
                             $params->loadString(JFile::read($themepath . '/' . $theme . '/variables.less'), 'LESS');
                         }
                         if ($other != 'variables-custom.less') {
                             $tobj->{$other} = true;
                         }
                     }
                     $cparams = new JRegistry();
                     $cparams->loadString(JFile::read($varsfile), 'LESS');
                     if ($params) {
                         foreach ($cparams->toArray() as $key => $value) {
                             $params->set($key, $value);
                         }
                     } else {
                         $params = $cparams;
                     }
                     $themes[$theme] = $tobj;
                     $jsondata[$theme] = $params->toArray();
                 }
             }
         }
     }
     $langs = array('addTheme' => JText::_('T3_TM_ASK_ADD_THEME'), 'delTheme' => JText::_('T3_TM_ASK_DEL_THEME'), 'overwriteTheme' => JText::_('T3_TM_ASK_OVERWRITE_THEME'), 'correctName' => JText::_('T3_TM_ASK_CORRECT_NAME'), 'themeExist' => JText::_('T3_TM_EXISTED'), 'saveChange' => JText::_('T3_TM_ASK_SAVE_CHANGED'), 'previewError' => JText::_('T3_TM_PREVIEW_ERROR'), 'unknownError' => JText::_('T3_MSG_UNKNOWN_ERROR'), 'lblCancel' => JText::_('JCANCEL'), 'lblOk' => JText::_('T3_TM_LABEL_OK'), 'lblNo' => JText::_('JNO'), 'lblYes' => JText::_('JYES'), 'lblDefault' => JText::_('JDEFAULT'));
     //Keepalive
     $config = JFactory::getConfig();
     $lifetime = $config->get('lifetime') * 60000;
     $refreshTime = $lifetime <= 60000 ? 30000 : $lifetime - 60000;
     // Refresh time is 1 minute less than the liftime assined in the configuration.php file.
     // The longest refresh period is one hour to prevent integer overflow.
     if ($refreshTime > 3600000 || $refreshTime <= 0) {
         $refreshTime = 3600000;
     }
     $backurl = JFactory::getURI();
     $backurl->delVar('t3action');
     $backurl->delVar('t3task');
     if (!$isadmin) {
         $backurl->delVar('tm');
         $backurl->delVar('themer');
     }
     T3::import('depend/t3form');
     $form = new T3Form('thememagic.themer', array('control' => 't3form'));
     $form->load(JFile::read(JFile::exists(T3_TEMPLATE_PATH . '/thememagic.xml') ? T3_TEMPLATE_PATH . '/thememagic.xml' : T3_PATH . '/params/thememagic.xml'));
     $form->loadFile(T3_TEMPLATE_PATH . '/templateDetails.xml', true, '//config');
     $tplform = new T3Form('thememagic.overwrite', array('control' => 't3form'));
     $tplform->loadFile(T3_TEMPLATE_PATH . '/templateDetails.xml', true, '//config');
     $fieldSets = $form->getFieldsets('thememagic');
     $tplFieldSets = $tplform->getFieldsets('thememagic');
     $disabledFieldSets = array();
     foreach ($tplFieldSets as $name => $fieldSet) {
         if (isset($fieldSet->disabled)) {
             $disabledFieldSets[] = $name;
         }
     }
     include T3_ADMIN_PATH . '/admin/thememagic/thememagic.tpl.php';
     exit;
 }
Example #18
0
 /**
  * Method to parse all link to css files from the html markup
  * and compress it
  *
  * @param   string  $htmlMarkup  HTML Content to response to browser
  *
  * @return  void
  */
 public static function compress($styleSheets)
 {
     static $compressedFiles;
     // Get object for working with URI
     $uri = JUri::getInstance();
     // Generate link prefix if current scheme is HTTPS
     $prefix = '';
     if ($uri->getScheme() == 'https') {
         $prefix = $uri->toString(array('scheme', 'host', 'port'));
     }
     // Initialize variables
     $groupIndex = 0;
     $groupType = 'screen';
     $groupFiles = array();
     $compress = array();
     // Sometime, stylesheet file need to be stored in the original location and file name
     $document = JFactory::getDocument();
     $leaveAlone = preg_split('/[\\r\\n]+/', $document->params->get('compressionExclude'));
     // We already know that the file galleria.classic.css must be excluded
     $leaveAlone[] = 'galleria.classic.css';
     // Parse link tags
     foreach ($styleSheets as $key => $line) {
         // Set default media attribute
         $attributes['media'] = is_null($line['media']) ? '' : strtolower($line['media']);
         $attributes['href'] = $key;
         // Add to result list if this is external file
         if (!($isInternal = JUri::isInternal($attributes['href'])) or strpos($attributes['href'], '//') === 0) {
             $compress[] = array('href' => $attributes['href'], 'media' => $attributes['media']);
             continue;
         }
         // Add to result list if this is dynamic generation content
         $questionPos = false;
         if (($questionPos = strpos($attributes['href'], '?')) !== false) {
             $isDynamic = substr($attributes['href'], $questionPos - 4, 4) == '.php';
             $path = JSNTplCompressHelper::getFilePath(substr($attributes['href'], 0, $questionPos));
             // Check if this is a dynamic generation content
             if (!$isDynamic and $isInternal) {
                 $isDynamic = !is_file($path);
             }
             if ($isDynamic) {
                 $compress[] = array('href' => $attributes['href'], 'media' => $attributes['media']);
                 continue;
             }
         }
         // Check if reserving stylesheet file name is required
         $stylesheetName = basename($questionPos !== false ? $path : $attributes['href']);
         if (in_array($stylesheetName, $leaveAlone)) {
             $attributes['media'] .= '|reserve|' . $stylesheetName;
         }
         // Create new compression group when media attribute different with group type
         if ($attributes['media'] != $groupType) {
             // Add collected files to compress list
             if (isset($groupFiles[$groupIndex]) and !empty($groupFiles[$groupIndex])) {
                 $compress[] = array('files' => $groupFiles[$groupIndex], 'media' => $groupType);
             }
             // Increase index number of the group
             $groupIndex++;
             $groupType = $attributes['media'];
         }
         // Initial group
         if (!isset($groupFiles[$groupIndex])) {
             $groupFiles[$groupIndex] = array();
         }
         $href = $attributes['href'];
         $queryStringIndex = strpos($href, '?');
         if ($queryStringIndex !== false) {
             $href = substr($href, 0, $queryStringIndex);
         }
         // Add file to the group
         $groupFiles[$groupIndex][] = preg_match('/^([^\\|]*)\\|reserve\\|.+$/', $groupType) ? $attributes['href'] : $href;
     }
     // Add collected files to result list
     if (isset($groupFiles[$groupIndex]) and !empty($groupFiles[$groupIndex])) {
         $compress[] = array('files' => $groupFiles[$groupIndex], 'media' => $groupType);
     }
     // Initial compress result
     $compressResult = array();
     $fileCompressed = array();
     // Get template details
     $templateName = JFactory::getApplication()->getTemplate();
     // Generate path to cache directory
     if (!preg_match('#^(/|\\|[a-z]:)#i', $document->params->get('cacheDirectory'))) {
         $compressPath = JPATH_ROOT . '/' . rtrim($document->params->get('cacheDirectory'), '\\/');
     } else {
         $compressPath = rtrim($document->params->get('cacheDirectory'), '\\/');
     }
     $compressPath = $compressPath . '/' . $templateName . '/';
     // Create directory if not exists
     if (!is_dir($compressPath)) {
         JFolder::create($compressPath);
     }
     // Loop to each compress element to compress file
     $modifiedFlag = false;
     foreach ($compress as $group) {
         // Ignore compress when group is a external file
         if (isset($group['href'])) {
             $ignoreCompressMedia = '';
             $link = '<link rel="stylesheet" href="' . $group['href'] . '" ';
             if (isset($group['media']) and !empty($group['media'])) {
                 $link .= 'media="' . $group['media'] . '" ';
                 $ignoreCompressMedia = $group['media'];
             }
             $link .= '/>';
             $compressResult[] = $link;
             $fileCompressed[] = array('media' => $ignoreCompressMedia, 'file' => $group['href']);
             continue;
         }
         // Check if reserving stylesheet file name is required
         if (isset($group['media']) and preg_match('/^([^\\|]*)\\|reserve\\|.+$/', $group['media'], $m)) {
             $reservingStylesshetMedia = '';
             $link = '<link rel="stylesheet" href="' . $group['files'][0] . '" ';
             if (isset($m[1]) and !empty($m[1])) {
                 $link .= 'media="' . $m[1] . '" ';
                 $reservingStylesshetMedia = $m[1];
             }
             $link .= '/>';
             $compressResult[] = $link;
             $fileCompressed[] = array('media' => $reservingStylesshetMedia, 'file' => $group['files'][0]);
             continue;
         }
         // Generate compress file name
         $compressFile = md5(implode('', $group['files'])) . '.css';
         $lastModified = 0;
         // Check last modified time for each file in the group
         foreach ($group['files'] as $file) {
             $path = JSNTplCompressHelper::getFilePath($file);
             $lastModified = is_file($path) && @filemtime($path) > $lastModified ? @filemtime($path) : $lastModified;
         }
         if (@filemtime($compressPath . $compressFile) < $lastModified) {
             $modifiedFlag = true;
         }
         // Compress group when expired
         if (!is_file($compressPath . $compressFile) or @filemtime($compressPath . $compressFile) < $lastModified) {
             // Preset compression buffer
             $buffer = '';
             // Preset remote file array
             $remoteFiles = array();
             // Preset some variables to hold compression status
             $processedFiles = array();
             $maxFileSize = 1024 * (int) $document->params->get('maxCompressionSize');
             $currentSize = 0;
             // Read content of each file and write it to the cache file
             foreach ($group['files'] as $file) {
                 $filePath = JSNTplCompressHelper::getFilePath($file);
                 // Skip when cannot access to file
                 if (!is_file($filePath) or !is_readable($filePath)) {
                     continue;
                 }
                 // Do compression
                 $result = trim(self::_loadFileInto($buffer, $filePath, $maxFileSize, $currentSize, $remoteFiles));
                 if (empty($result)) {
                     // Store processed file
                     $processedFiles[] = $filePath;
                 } else {
                     // Write buffer to cache file
                     JFile::write($compressPath . $compressFile, $buffer);
                     // Rename created cache file
                     $newFileName = md5(implode('', $processedFiles)) . '.css';
                     JFile::move($compressPath . $compressFile, $compressPath . $newFileName);
                     // Save every compressed file associated with this page for maintenance later
                     $compressedFiles[] = str_replace('\\', '/', $compressPath) . $newFileName;
                     // Add compressed file to the remote file import list
                     $remoteFiles[] = str_replace(str_replace('\\', '/', JPATH_ROOT), JUri::root(true), str_replace('\\', '/', $compressPath)) . $newFileName;
                     // Reset compression buffer
                     $buffer = $result;
                     // Reset compression status variables
                     $currentSize = strlen($result);
                     $processedFiles = array($filePath);
                 }
             }
             // Write buffer to cache file
             JFile::write($compressPath . $compressFile, $buffer);
             // Save every compressed file associated with this page for maintenance later
             $compressedFiles[] = str_replace('\\', '/', $compressPath) . $compressFile;
             if (!empty($remoteFiles)) {
                 for ($n = count($remoteFiles), $i = $n - 1; $i >= 0; $i--) {
                     JSNTplCompressHelper::prependIntoFile("@import url({$remoteFiles[$i]});" . ($i + 1 < $n ? "\n" : "\n\n"), $compressPath . $compressFile);
                 }
             }
         }
         // Add compressed file to the compress result list
         $compressUrl = str_replace(str_replace('\\', '/', JPATH_ROOT), JUri::root(true), str_replace('\\', '/', $compressPath)) . $compressFile;
         $link = '<link rel="stylesheet" href="' . $prefix . $compressUrl . '" ';
         $mediaCompressedFile = '';
         if (isset($group['media']) and !empty($group['media'])) {
             $link .= 'media="' . preg_replace('/\\|reserve\\|(.+)$/', '', $group['media']) . '" ';
             $mediaCompressedFile = preg_replace('/\\|reserve\\|(.+)$/', '', $group['media']);
         }
         $link .= '/>';
         $compressResult[] = $link;
         $fileCompressed[] = array('media' => $mediaCompressedFile, 'file' => $compressUrl);
     }
     // Verify if stylesheets associated with this page has been changed
     if (isset($compressedFiles)) {
         $trackFile = $compressPath . 'tracking.php';
         $pageLink = JUri::current();
         $cleanUp = array();
         if (file_exists($trackFile)) {
             if (!file_exists("{$trackFile}.lock")) {
                 // Get tracking data
                 include $trackFile;
                 if (isset($tracking) && isset($tracking[$pageLink]) && isset($tracking[$pageLink]['css'])) {
                     foreach ($tracking[$pageLink]['css'] as $file) {
                         if (!in_array($file, $compressedFiles)) {
                             // Store obsolete file to be removed
                             $cleanUp[] = $file;
                         }
                     }
                     // Remove obsolete file only if not used in another page
                     foreach ($cleanUp as $file) {
                         $removable = true;
                         foreach ($tracking as $link => $assets) {
                             if ($pageLink == $link) {
                                 continue;
                             }
                             if (@in_array($file, $assets['css'])) {
                                 $removable = false;
                                 break;
                             }
                         }
                         if ($removable && !$modifiedFlag) {
                             JFile::delete($file);
                         }
                     }
                 }
             }
         } else {
             // Clean all unmaintained compressed files
             if ($files = glob($compressPath . '*.css')) {
                 foreach ($files as $file) {
                     $file = str_replace('\\', '/', $file);
                     if (!in_array($file, $compressedFiles)) {
                         JFile::delete($file);
                     }
                 }
             }
         }
         // Update tracking file if not locked
         if (!file_exists("{$trackFile}.lock")) {
             // Create lock file
             $content = 'Updating';
             JFile::write("{$trackFile}.lock", $content);
             // Preset tracking array
             if (!isset($tracking)) {
                 $tracking = array($pageLink => array());
             }
             $tracking[$pageLink]['css'] = $compressedFiles;
             // Update tracking data
             $content = "<?php\n\$tracking = json_decode('" . json_encode($tracking) . "', true);\n?>";
             // Update tracking file
             JFile::write($trackFile, $content);
             // Remove lock file
             JFile::delete("{$trackFile}.lock");
         }
     }
     return $fileCompressed;
 }
Example #19
0
	<h3>
		<?php 
    echo JText::_('COM_AKEEBA_CPANEL_MSG_MUSTENTERDLID');
    ?>
	</h3>
	<p>
		<?php 
    echo JText::sprintf('COM_AKEEBA_LBL_CPANEL_NEEDSDLID', 'https://www.akeebabackup.com/instructions/1435-akeeba-backup-download-id.html');
    ?>
	</p>
	<form name="dlidform" action="index.php" method="post" class="form-inline">
		<input type="hidden" name="option" value="com_akeeba" />
		<input type="hidden" name="view" value="cpanel" />
		<input type="hidden" name="task" value="applydlid" />
		<input type="hidden" name="returnurl" value="<?php 
    echo base64_encode(JUri::current());
    ?>
" />
		<input type="hidden" name="<?php 
    echo JFactory::getSession()->getFormToken();
    ?>
" value="1" />
		<span>
			<?php 
    echo JText::_('COM_AKEEBA_CPANEL_MSG_PASTEDLID');
    ?>
		</span>
		<input type="text" name="dlid" placeholder="<?php 
    echo JText::_('CONFIG_DOWNLOADID_LABEL');
    ?>
" class="input-xlarge">
Example #20
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $html = '';
     jimport('nextend.library');
     nextendimport('nextend.css.css');
     nextendimport('nextend.javascript.javascript');
     $css = NextendCss::getInstance();
     $js = NextendJavascript::getInstance();
     $css->addCssLibraryFile('common.css');
     $css->addCssLibraryFile('window.css');
     $css->addCssLibraryFile('configurator.css');
     $configurationXmlFile = JPATH_SITE . $node->attributes('xml');
     if (NextendFilesystem::fileexists($configurationXmlFile)) {
         $js->loadLibrary('dojo');
         $js->addLibraryJsLibraryFile('dojo', 'dojo/window.js');
         $js->addLibraryJsAssetsFile('dojo', 'window.js');
         $js->addLibraryJs('dojo', '
             new NextendWindow({
               button: dojo.byId("nextend-configurator-button"),
               node: dojo.byId("nextend-configurator-lightbox"),
               save: dojo.byId("nextend-configurator-save"),
               message: dojo.byId("nextend-configurator-message"),
               onHide: function(){
                 this.message.innerHTML = "Now you should save the module settings to apply changes!";
               }
             });
         ');
         $html .= '<div id="nextend-configurator-lightbox" class="gk_hack nextend-window ' . $node->attributes('identifier') . '">';
         $html .= '<div class="gk_hack nextend-window-container">';
         $html .= '<div class="gk_hack nextend-topbar"><div class="gk_hack nextend-topbar-logo"></div>';
         $manual = $node->attributes('manual');
         if ($manual != "") {
             $html .= '<a href="' . $manual . '" target="_blank" class="gk_hack nextend-topbar-button nextend-topbar-manual">Manual</a>';
         }
         $support = $node->attributes('support');
         if ($support != "") {
             $html .= '<a href="' . $support . '" target="_blank" class="gk_hack nextend-topbar-button nextend-topbar-support">Support</a>';
         }
         $html .= '<div id="nextend-configurator-save" class="nextend-window-save"><div class="NextendWindowSave">APPLY</div></div>';
         $html .= '</div>';
         $html .= '<div class="gk_hack nextend-window-container-inner">';
         $html .= '<fieldset id="nextend-configurator-panels" class="gk_hack panelform">';
         $html .= '<div id="menu-pane" class="gk_hack pane-sliders">';
         nextendimport('nextend.form.form');
         $form = new NextendForm();
         $form->loadArray($this->_parent->toArray());
         $form->set('manual', $manual);
         $form->set('support', $support);
         $form->loadXMLFile($configurationXmlFile);
         ob_start();
         $form->render($control_name);
         $html .= ob_get_clean();
         $html .= '</div>';
         $html .= '</fieldset>';
         $html .= '</div>';
         $html .= '</div>';
         $html .= '</div>';
         $html .= '<a id="nextend-configurator-button" class="nextend-configurator-button" href="#">Configure<span></span></a>
                   <span id="nextend-configurator-message">&nbsp;</span>';
         $js->addLibraryJsAssetsFile('dojo', 'form.js');
         $js->addLibraryJs('dojo', '
             new NextendForm({
               container: "nextend-configurator-lightbox",
               data: ' . json_encode($form->_data) . ',
               xml: "' . NextendFilesystem::toLinux(NextendFilesystem::pathToRelativePath($configurationXmlFile)) . '",
               control_name: "' . $control_name . '",
               url: "' . JUri::current() . '",
               loadedJSS: ' . json_encode($js->generateArrayJs()) . ',
               loadedCSS: ' . json_encode($css->generateArrayCSS()) . '
             });
         ', true);
         return $html;
     } else {
         return NextendText::_("Not found xml configuration: ") . $configurationXmlFile;
     }
     return "asd";
     return '<input type="hidden" name="' . $control_name . '[' . $name . ']" id="' . $control_name . $name . '" value="' . $value . '" ' . $class . ' />';
 }
Example #21
0
<?php 
if ($headerText) {
    ?>
	<div class="pretext"><p><?php 
    echo $headerText;
    ?>
</p></div>
<?php 
}
?>

<?php 
if ($params->get('dropdown', 1)) {
    ?>
    <form name="lang" method="post" action="<?php 
    echo htmlspecialchars(JUri::current());
    ?>
">
	<select class="inputbox" onchange="document.location.replace(this.value);" >
	<?php 
    foreach ($list as $language) {
        ?>
        <?php 
        if ($language->display) {
            ?>
		    <option value="<?php 
            echo $language->link;
            ?>
" <?php 
            echo !empty($language->active) ? 'selected="selected"' : '';
            ?>
Example #22
0
 /**
  * Method to reset class static members for testing and other various issues.
  *
  * @return  void
  *
  * @since   11.1
  */
 public static function reset()
 {
     self::$instances = array();
     self::$base = array();
     self::$root = array();
     self::$current = '';
 }
Example #23
0
 private function isHomePage()
 {
     $menu = JFactory::getApplication()->getMenu();
     $url = parse_url(JUri::current());
     return $menu->getActive() == $menu->getDefault() && isset($url['path']) && $url['path'] == '/';
 }
Example #24
0
 /**
  * Get a url link of $provider
  * 
  * a class name of 'hs_token_target' must be added to the element and 
  * must call self::loadTokenJs() to add token to the link.
  * 
  * 
  * @param String $provider social service name
  * @param String $returnURL Raw URL of landing page. If the value is 'home', then the top page url is used.
  * @return String parsed url
  * 
  */
 static function getLinkOf($provider, $returnURL = null)
 {
     $link = self::getLinkBase() . '&provider=' . strtolower($provider);
     if ($returnURL != null) {
         if ($returnURL == 'home') {
             $returnURL = JUri::base();
         }
         switch ($returnURL) {
             case 'home':
                 $returnURL = JUri::base();
                 break;
             case 'current':
                 $returnURL = JUri::current();
                 break;
         }
         $link = $link . '&return=' . base64_encode($returnURL);
     }
     return JRoute::_($link);
 }
$list_adults = [];
for ($i = 1; $i <= $config->search_adults; $i++) {
    $list_adults[$i] = CHClient::numstring($i, 'guests_adult');
}
// children list
$list_children = [];
for ($i = 0; $i <= $config->search_children; $i++) {
    $list_children[$i] = CHClient::numstring($i, 'guests_child_baby');
}
// children ages list
$list_ages = [];
for ($i = 0; $i <= $config->search_children_ages; $i++) {
    $list_ages[] = $i;
}
// display data
$action = isset($displayData['action']) ? $displayData['action'] : JUri::current();
$title = isset($displayData['title']) ? $displayData['title'] : CHClient::string('reservations');
?>
<div class="uk-panel uk-panel-box uk-panel-header ch-engine-search">

	<h3 class="uk-panel-title"><?php 
echo $title;
?>
</h3>

	<form data-ch-search-form class="uk-form" action="<?php 
echo $action;
?>
">

		<fieldset>
Example #26
0
 /**
  * Dispatch the application
  *
  * @param   string
  */
 public function dispatch($component = null)
 {
     // Get the component if not set.
     if (!$component) {
         $component = $this->input->get('option');
     }
     $document = JFactory::getDocument();
     $router = $this->getRouter();
     $params = $this->getParams();
     switch ($document->getType()) {
         case 'html':
             // Get language
             $lang_code = JFactory::getLanguage()->getTag();
             $languages = JLanguageHelper::getLanguages('lang_code');
             // Set metadata
             if (isset($languages[$lang_code]) && $languages[$lang_code]->metakey) {
                 $document->setMetaData('keywords', $languages[$lang_code]->metakey);
             } else {
                 $document->setMetaData('keywords', $this->getCfg('MetaKeys'));
             }
             $document->setMetaData('rights', $this->getCfg('MetaRights'));
             if ($router->getMode() == JROUTER_MODE_SEF) {
                 $document->setBase(htmlspecialchars(JUri::current()));
             }
             break;
         case 'feed':
             $document->setBase(htmlspecialchars(JUri::current()));
             break;
     }
     $document->setTitle($params->get('page_title'));
     $document->setDescription($params->get('page_description'));
     // Add version number or not based on global configuration
     if ($this->getCfg('MetaVersion', 0)) {
         $document->setGenerator('Joomla! - Open Source Content Management  - Version ' . JVERSION);
     } else {
         $document->setGenerator('Joomla! - Open Source Content Management');
     }
     $contents = JComponentHelper::renderComponent($component);
     $document->setBuffer($contents, 'component');
     // Trigger the onAfterDispatch event.
     JPluginHelper::importPlugin('system');
     $this->triggerEvent('onAfterDispatch');
 }
Example #27
0
 /**
  * Gets a list of available languages
  *
  * @param   JRegistry  &$params  module params
  *
  * @return  array
  */
 public static function getList(&$params)
 {
     $user = JFactory::getUser();
     $lang = JFactory::getLanguage();
     $app = JFactory::getApplication();
     $menu = $app->getMenu();
     // Get menu home items
     $homes = array();
     foreach ($menu->getMenu() as $item) {
         if ($item->home) {
             $homes[$item->language] = $item;
         }
     }
     // Load associations
     $assoc = JLanguageAssociations::isEnabled();
     if ($assoc) {
         $active = $menu->getActive();
         if ($active) {
             $associations = MenusHelper::getAssociations($active->id);
         }
         // Load component associations
         $option = $app->input->get('option');
         $eName = JString::ucfirst(JString::str_ireplace('com_', '', $option));
         $cName = JString::ucfirst($eName . 'HelperAssociation');
         JLoader::register($cName, JPath::clean(JPATH_COMPONENT_SITE . '/helpers/association.php'));
         if (class_exists($cName) && is_callable(array($cName, 'getAssociations'))) {
             $cassociations = call_user_func(array($cName, 'getAssociations'));
         }
     }
     $levels = $user->getAuthorisedViewLevels();
     $languages = JLanguageHelper::getLanguages();
     $activeLanguage = JFactory::getLanguage()->getTag();
     // Filter allowed languages
     foreach ($languages as $i => &$language) {
         // Do not display language without frontend UI
         if (!JLanguage::exists($language->lang_code)) {
             unset($languages[$i]);
         } elseif (!isset($homes[$language->lang_code])) {
             unset($languages[$i]);
         } elseif (isset($language->access) && $language->access && !in_array($language->access, $levels)) {
             unset($languages[$i]);
         } else {
             $language->active = $language->lang_code == $lang->getTag();
             if (JLanguageMultilang::isEnabled()) {
                 if (isset($cassociations[$language->lang_code])) {
                     $language->link = JRoute::_($cassociations[$language->lang_code] . '&lang=' . $language->sef);
                 } elseif (isset($associations[$language->lang_code]) && $menu->getItem($associations[$language->lang_code])) {
                     $itemid = $associations[$language->lang_code];
                     if ($app->get('sef') == '1') {
                         $language->link = JRoute::_('index.php?lang=' . $language->sef . '&Itemid=' . $itemid);
                     } else {
                         $language->link = 'index.php?lang=' . $language->sef . '&amp;Itemid=' . $itemid;
                     }
                 } else {
                     if ($language->lang_code == $activeLanguage) {
                         $language->link = JUri::current();
                     } elseif ($app->get('sef') == '1') {
                         $itemid = isset($homes[$language->lang_code]) ? $homes[$language->lang_code]->id : $homes['*']->id;
                         $language->link = JRoute::_('index.php?lang=' . $language->sef . '&Itemid=' . $itemid);
                     } else {
                         $language->link = 'index.php?lang=' . $language->sef;
                     }
                 }
             } else {
                 $language->link = JRoute::_('&Itemid=' . $homes['*']->id);
             }
         }
     }
     return $languages;
 }
Example #28
0
 public function getMetakeysFromsh404SEF()
 {
     JvrelInit::debug("Fetching meta keywords of article from sh404SEF");
     $current_sefurl = JString::str_ireplace(JUri::root(), "", JUri::current());
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select("m.metakey")->from("#__sh404sef_metas as m")->join("inner", "#__sh404sef_urls as u on m.newurl = u.newurl")->where("u.oldurl = '" . $db->escape($current_sefurl) . "'");
     $db->setQuery($query);
     return $db->loadResult();
 }
Example #29
0
    }
    ?>
			<?php 
    if ($this->params->get('plusone', 1)) {
        ?>
<div><div class="g-plusone" data-href="<?php 
        echo JUri::current();
        ?>
" data-size="medium" data-annotation="none"></div></div><?php 
    }
    ?>
			<?php 
    if ($this->params->get('fblike', 1)) {
        ?>
<div><div class="fb-like" data-href="<?php 
        echo JUri::current();
        ?>
" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false" data-action="like" data-colorscheme="light"></div></div><?php 
    }
    ?>
		</div>
	<?php 
}
?>

	<?php 
if ($this->params->get('disqus') && $this->params->get('disqus_name')) {
    ?>
		<hr>   
		<div id="disqus_thread"></div>
		<script>
 /**
  * Test the current method.
  *
  * @return  void
  *
  * @since   11.1
  * @covers  JUri::current
  */
 public function testCurrent()
 {
     $this->assertThat(JUri::current(), $this->equalTo('http://www.example.com:80/joomla/index.php'));
 }