Example #1
0
 /**
  * Return the application option string [main component].
  *
  * @return	string		Option.
  * @since	1.5
  */
 public static function findOption()
 {
     $option = strtolower(JRequest::getCmd('option'));
     $user = JFactory::getUser();
     if ($user->get('guest') || !$user->authorise('core.login.admin')) {
         $option = 'com_login';
         JRequest::setVar('tmpl', 'login');
     }
     if (empty($option)) {
         $menu = JTable::getInstance('Menu', 'JTable');
         $menu->load(array('home' => '1', 'client_id' => '1'));
         $uri = JURI::getInstance();
         $uri->parse($menu->link);
         $vars = $uri->getQuery(true);
         foreach ($vars as $var => $key) {
             JRequest::setVar($var, $key);
             if ($var == 'option') {
                 $option = $key;
             }
         }
         if ($option == '') {
             $option = 'com_cpanel';
             JRequest::setVar('option', $option);
         }
     }
     return $option;
 }
Example #2
0
 /**
  * Method to display a view.
  *
  * @param	boolean	$cachable	If true, the view output will be cached
  * @param	array	$urlparams	An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController	This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     // Get the current URI to redirect to.
     $uri = JURI::getInstance();
     $redirect = base64_encode($uri);
     // Get the document object.
     $document = JFactory::getDocument();
     // Set the default view name and format from the Request.
     if (file_exists(JPATH_CONFIGURATION . '/configuration.php') && filesize(JPATH_CONFIGURATION . '/configuration.php') > 10 && file_exists(JPATH_INSTALLATION . '/index.php')) {
         $default_view = 'remove';
     } else {
         $default_view = 'language';
     }
     $vName = JRequest::getWord('view', $default_view);
     $vFormat = $document->getType();
     $lName = JRequest::getWord('layout', 'default');
     if (strcmp($vName, $default_view) == 0) {
         JRequest::setVar('view', $default_view);
     }
     if ($view = $this->getView($vName, $vFormat)) {
         switch ($vName) {
             default:
                 $model = $this->getModel('Setup', 'JInstallationModel', array('dbo' => null));
                 break;
         }
         // Push the model into the view (as default).
         $view->setModel($model, true);
         $view->setLayout($lName);
         // Push document object into the view.
         $view->document = $document;
         $view->display();
     }
     return $this;
 }
Example #3
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;
 }
Example #4
0
 /**
  * Get Page JavaScript from either session or cached .js file
  *
  * @return string
  */
 public static function js()
 {
     $config = JFactory::getConfig();
     if ($config->get('caching') == 0) {
         $script = self::buildJs();
     } else {
         $uri = JURI::getInstance();
         $session = JFactory::getSession();
         $uri = $uri->toString(array('path', 'query'));
         $file = md5($uri) . '.js';
         $folder = JPATH_SITE . '/cache/com_fabrik/js/';
         if (!JFolder::exists($folder)) {
             JFolder::create($folder);
         }
         $cacheFile = $folder . $file;
         // Check for cached version
         if (!JFile::exists($cacheFile)) {
             $script = self::buildJs();
             file_put_contents($cacheFile, $script);
         } else {
             $script = JFile::read($cacheFile);
         }
     }
     self::clearJs();
     return $script;
 }
Example #5
0
 /**
  * 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('site');
     // Load state from the request.
     $pk = $app->input->getInt('id');
     $this->setState('onlinepayment.id', $pk);
     // Load the parameters.
     $params = $app->getParams();
     $this->setState('params', $params);
     $this->MID = $params->get('zarinpal_merchant_id', NULL);
     $this->Amount = $params->get('diet_price', NULL);
     $user = JFactory::getUser();
     if (!$user->guest && $user->username == 'mohammadnaji') {
         // When we ourselves want to pay, should pay 100 toomans instea.
         $this->Amount = 1000;
     }
     $this->RedirectURL = JURI::getInstance();
     if (!$this->MID) {
         $this->setError(JText::_('COM_SIBDIET_ONLINE_PAYMENT_MID_NOT_SET'));
     } elseif ($Status = $app->input->get('Status', NULL, 'STRING')) {
         $ResNum = $app->input->get('Authority', NULL, 'STRING');
         if ($this->checkTransaction($Status, $ResNum)) {
             $app->redirect(JRoute::_('index.php?option=com_sibdiet&view=requests', false), JText::_('COM_SIBDIET_REQUEST_SAVED'));
         }
     }
 }
Example #6
0
 /**
  * Routes URLs
  *
  * @access public
  */
 function onAfterInitialise()
 {
     $mainframe =& JFactory::getApplication();
     $uri =& JURI::getInstance();
     $router =& $mainframe->getRouter();
     $router->attachParseRule('parseJumiRouter');
 }
Example #7
0
	/**
	 * Method to wrap around getting the correct links within the email
	 * 
	 * @return string $url
	 * @param string $url
	 * @param boolean $xhtml
	 */	
	static function getExternalURL( $url , $xhtml = false )
	{
		$uri	= JURI::getInstance();
		$base	= $uri->toString( array('scheme', 'host', 'port'));
		
		return $base . TRoute::_( $url , $xhtml );
	}
Example #8
0
 function display($tpl = null)
 {
     $this->context = 'com_solidres.reservation.process';
     $this->config = JComponentHelper::getParams('com_solidres');
     $this->showPoweredByLink = $this->config->get('show_solidres_copyright', '1');
     if ($this->_layout == 'default') {
         $model = $this->getModel();
         $modelName = $model->getName();
         $this->reservation = $model->getItem();
         $this->app = JFactory::getApplication();
         $this->checkin = $model->getState($modelName . '.checkin');
         $this->checkout = $model->getState($modelName . '.checkout');
         $this->totalReservedRoom = $model->getState($modelName . '.totalReservedRoom');
         $this->countries = SolidresHelper::getCountryOptions();
         $this->geoStates = SolidresHelper::getGeoStateOptions($model->getState($modelName . '.countryId'));
         $this->userState = $this->app->getUserState($this->context);
         $this->raid = $model->getState($modelName . '.reservationAssetId');
         $this->uri = JURI::getInstance()->__toString();
         $this->roomTypeObj = SRFactory::get('solidres.roomtype.roomtype');
         $this->numberOfNights = $this->roomTypeObj->calculateDateDiff($this->checkin, $this->checkout);
         JHtml::_('jquery.framework');
     }
     JHtml::stylesheet('com_solidres/assets/main.css', false, true, false);
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     parent::display($tpl);
 }
Example #9
0
	/**
	 * Is this feature enabled?
	 *
	 * @return bool
	 */
	public function isEnabled()
	{
		// We only use this feature in the front-end
		if (F0FPlatform::getInstance()->isBackend())
		{
			return false;
		}

		// The feature must be enabled
		if ($this->cparams->getValue('httpsizer', 0) != 1)
		{
			return false;
		}

		// Make sure we're accessed over SSL (HTTPS)
		$uri = JURI::getInstance();
		$protocol = $uri->toString(array('scheme'));

		if ($protocol != 'https://')
		{
			return false;
		}


		return true;
	}
Example #10
0
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     $today =& JFactory::getDate();
     $uri =& JURI::getInstance();
     $this->uri = $uri->getScheme() . '://' . $uri->getHost() . $uri->getPath();
     $itemid = JRequest::getInt('Itemid');
     $this->step = isset($this->step) ? $this->step : 0;
     $this->assignRef('today', $today);
     if ($this->step != 1 && $this->step > 0) {
         $this->assignRef('av_date', $today);
     }
     $_format = JRequest::getString('tmpl', '');
     $this->is_modal = $_format == 'component' ? true : false;
     $this->_addScripts($this->step, $this->is_modal);
     $user =& JFactory::getUser();
     $this->assignRef('user', $user);
     $this->setstate = JobBoardHelper::renderJobBoard();
     $this->day_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%d' : 'd';
     $this->month_long_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%B' : 'F';
     $this->month_short_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%b' : 'M';
     $this->year_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%Y' : 'Y';
     $this->user_entry_point = 'com_users';
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $this->user_entry_point = 'com_users';
     } elseif (version_compare(JVERSION, '1.5.0', 'ge')) {
         $this->user_entry_point = 'com_user';
     }
     parent::display($tpl);
 }
Example #11
0
 function getLimitBox()
 {
     $url = $this->getStatURI();
     $url = JRoute::_($url);
     $myURI = JURI::getInstance($url);
     //if(!empty($itemId))$myURI->setVar('Itemid', $itemId);
     if ($myURI->getQuery()) {
         $wildcard = '&';
     } else {
         $wildcard = '?';
     }
     $url .= $wildcard;
     $limits = array();
     //$url='index.php?virtuemart_category_id[0]=3&virtuemart_category_id[1]=4&view=products&limit=5&option=com_customfilters&limit=';
     //var_dump(JRoute::_($url.'limit=5'));
     // Make the option list.
     //mod fazan 04-12-2012
     //for ($i = 12; $i <= 96; $i += 12) {
     for ($i = 30; $i <= 90; $i += 30) {
         $limits[] = JHtml::_('select.option', 'limit=' . $i, $i);
     }
     $js = 'onchange="window.top.location=\'' . $url . '\'+this.options[this.selectedIndex].value"';
     $selected = 'limit=' . $this->limit;
     $html = JHtml::_('select.genericlist', $limits, 'limit', 'class="inputbox" size="1"' . $js, 'value', 'text', $selected);
     return $html;
 }
Example #12
0
	function save_myApiConnect() {
		$post = JRequest::get('post');
		$u =& JURI::getInstance(JURI::root());
		$port 	= ($u->getPort() == '') ? '' : ":".$u->getPort();
		$host = (substr($u->getHost(),0,4) == 'www.') ? substr($u->getHost(),4) : $u->getHost();
		$connectURL = $u->getScheme().'://'.$host.$port.$u->getPath();
		$baseDomain = $host;
		
		$data['base_domain'] 	= $baseDomain;
		$data['uninstall_url'] 	= JURI::root().'index.php?option=com_myapi&task=deauthorizeCallback';
		$data['connect_url'] 	= $connectURL;
		
		try{
			require_once JPATH_SITE.DS.'plugins'.DS.'system'.DS.'myApiConnectFacebook.php';
			$facebook = new myApiFacebook(array(
				'appId'  => $post['params']['appId'],
				'secret' => $post['params']['secret']
			));
			$app_update = $facebook->api(array('method' => 'admin.setAppProperties','access_token' => $post['params']['appId'].'|'.$post['params']['secret'],'properties'=> json_encode($data)));
			
			$model = $this->getModel('realtime');
			$model->addSubscriptions();
			
			$this->setRedirect( 'index.php?option=com_myapi&view=plugin&plugin=myApiConnect',JText::_('APP_SAVED'));	
		
		}catch (FacebookApiException $e) {
			$this->setRedirect( 'index.php?option=com_myapi&view=plugin&plugin=myApiConnect',JText::_('APP_SAVED_ERROR').$e);		
		}
		
	}
Example #13
0
 public function onAfterDispatch()
 {
     if (JFactory::getApplication()->isAdmin()) {
         return true;
     }
     // Set the variables
     $input = JFactory::getApplication()->input;
     // check option & view
     $option = $input->get('option', '', 'cmd');
     $view = $input->get('view');
     $doc = JFactory::getDocument();
     // Adjust the component buffer.
     if ($option === 'com_content' && $view === 'article' || $option === 'com_k2' && $view === 'item') {
         // leave article settings
     } else {
         $doctype = $doc->getType();
         if ($doctype == 'html') {
             $uri = JURI::getInstance();
             $doc->addCustomTag('<meta property="og:title" content="' . $this->_params->get('og:title') . '" />');
             $doc->addCustomTag('<meta property="og:type" content="' . $this->_params->get('og:type') . '" />');
             $doc->addCustomTag('<meta property="og:image" content="' . $uri->root() . $this->_params->get('og:image') . '" />');
             $doc->addCustomTag('<meta property="og:site_name" content="' . $this->_params->get('og:site_name') . '" />');
             $doc->addCustomTag('<meta property="og:description" content="' . $this->_params->get('og:description') . '" />');
         }
     }
     return true;
 }
Example #14
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     // get parameters
     $params = clone $app->getParams('com_rsmembership');
     $pathway = $app->getPathway();
     $pathway->addItem(JText::_('COM_RSMEMBERSHIP_RENEW'), '');
     // get the logged user
     $this->user = JFactory::getUser();
     // get the current layout
     $layout = $this->getLayout();
     if ($layout == 'default') {
         $this->payments = RSMembership::getPlugins();
         // get the encoded return url
         $this->return = base64_encode(JURI::getInstance());
         $this->data = $this->get('data');
         // get the membership
         $this->membership = $this->get('membership');
         $this->membershipterms = $this->get('membershipterms');
         $this->fields = RSMembershipHelper::getFields(true);
         $this->fields_validation = RSMembershipHelper::getFieldsValidation($this->membership->id);
         $this->membership_fields = RSMembershipHelper::getMembershipFields($this->membership->id, true, $this->user->id, true, $this->membership->last_transaction_id);
     } elseif ($layout == 'payment') {
         $this->html = $this->get('html');
     }
     // get the extras
     $this->extras = $this->get('extras');
     $this->cid = $this->get('cid');
     $this->config = $this->get('config');
     $this->params = $params;
     $this->token = JHTML::_('form.token');
     $this->currency = RSMembershipHelper::getConfig('currency');
     parent::display();
 }
Example #15
0
 /**
  * 
  * Check and convert to css real path
  * @var url
  */
 public static function cssPath($url = '')
 {
     $url = preg_replace('#[?\\#]+.*$#', '', $url);
     $base = JURI::base();
     $root = JURI::root(true);
     $path = false;
     $ret = false;
     if (substr($url, 0, 2) === '//') {
         //check and append if url is omit http
         $url = JURI::getInstance()->getScheme() . ':' . $url;
     }
     //check for css file extensions
     foreach (self::$cssexts as $ext) {
         if (substr_compare($url, $ext, -strlen($ext), strlen($ext)) === 0) {
             $ret = true;
             break;
         }
     }
     if ($ret) {
         if (preg_match('/^https?\\:/', $url)) {
             //is full link
             if (strpos($url, $base) === false) {
                 // external css
                 return false;
             }
             $path = JPath::clean(JPATH_ROOT . '/' . substr($url, strlen($base)));
         } else {
             $path = JPath::clean(JPATH_ROOT . '/' . ($root && strpos($url, $root) === 0 ? substr($url, strlen($root)) : $url));
         }
         return is_file($path) ? $path : false;
     }
     return false;
 }
Example #16
0
 /**
  * Method to display a view.
  *
  * @return	void
  * @since	1.0
  */
 public function display()
 {
     // Get the current URI to redirect to.
     $uri =& JURI::getInstance();
     $redirect = $uri->toString();
     $redirect = base64_encode($redirect);
     // Get the document object.
     $document =& JFactory::getDocument();
     // Set the default view name and format from the Request.
     $vName = JRequest::getWord('view', 'language');
     $vFormat = $document->getType();
     $lName = JRequest::getWord('layout', 'default');
     if ($view =& $this->getView($vName, $vFormat)) {
         switch ($vName) {
             default:
                 $model =& $this->getModel('Setup', 'JInstallationModel', array('dbo' => null));
                 break;
         }
         // Push the model into the view (as default).
         $view->setModel($model, true);
         $view->setLayout($lName);
         // Push document object into the view.
         $view->assignRef('document', $document);
         $view->display();
     }
 }
Example #17
0
 /**
  * Class constructor
  *
  * @param   array  $options  Associative array of options
  *
  * @since  11.1
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     // Set document type
     $this->_type = 'opensearch';
     // Set mime type
     $this->_mime = 'application/opensearchdescription+xml';
     // Add the URL for self updating
     $update = new JOpenSearchUrl();
     $update->type = 'application/opensearchdescription+xml';
     $update->rel = 'self';
     $update->template = JRoute::_(JURI::getInstance());
     $this->addUrl($update);
     // Add the favicon as the default image
     // Try to find a favicon by checking the template and root folder
     $app = JFactory::getApplication();
     $dirs = array(JPATH_THEMES . '/' . $app->getTemplate(), JPATH_BASE);
     foreach ($dirs as $dir) {
         if (file_exists($dir . '/favicon.ico')) {
             $path = str_replace(JPATH_BASE . '/', '', $dir);
             $path = str_replace('\\', '/', $path);
             $favicon = new JOpenSearchImage();
             $favicon->data = JURI::base() . $path . '/favicon.ico';
             $favicon->height = '16';
             $favicon->width = '16';
             $favicon->type = 'image/vnd.microsoft.icon';
             $this->addImage($favicon);
             break;
         }
     }
 }
 /**
  * Event onAfterInitialise
  */
 public function onAfterInitialise()
 {
     // Don't do anything if MageBridge is not enabled
     if ($this->isEnabled() == false) {
         return false;
     }
     // Perform actions on the frontend
     $application = JFactory::getApplication();
     // Check for postlogin-cookie
     if (isset($_COOKIE['mb_postlogin']) && !empty($_COOKIE['mb_postlogin'])) {
         // If the user is already logged in, remove the cookie
         if (JFactory::getUser()->id > 0) {
             setcookie('mb_postlogin', '', time() - 3600, '/', '.' . JURI::getInstance()->toString(array('host')));
         }
         // Otherwise decrypt the cookie and use it here
         $data = MageBridgeEncryptionHelper::decrypt($_COOKIE['mb_postlogin']);
         if (!empty($data)) {
             $customer_email = $data;
         }
     }
     // Perform a postlogin if needed
     $post = $application->input->post->getArray();
     if (empty($post)) {
         $postlogin_userevents = $this->params->get('postlogin_userevents', 0) == 1 ? true : false;
         if (empty($customer_email)) {
             $customer_email = MageBridgeModelBridge::getInstance()->getSessionData('customer/email');
         }
         if (!empty($customer_email)) {
             MageBridge::getUser()->postlogin($customer_email, null, $postlogin_userevents);
         }
     }
 }
Example #19
0
 /**
  * Register the API server.
  *
  * @throws \Exception
  * @return  boolean
  */
 public function register()
 {
     $uri = \JURI::getInstance();
     if (!$this->isApi()) {
         return false;
     }
     $app = \JFactory::getApplication();
     $input = $app->input;
     // Restore Joomla handler and using our Json handler.
     JsonResponse::registerErrorHandler();
     // Authentication
     if (!$this->isUserOperation($uri) && $this->option['authorise']) {
         if (!Authentication::authenticate($input->get('session_key'))) {
             throw new \Exception(\JText::_('JERROR_ALERTNOAUTHOR'), 403);
         }
     }
     // Set Format to JSON
     $input->set('format', 'json');
     // Store JDocumentJson to Factory
     \JFactory::$document = \JDocument::getInstance('json');
     $router = $app::getRouter();
     // Attach a hook to Router
     $router->attachParseRule(array($this, 'parseRule'));
     return true;
 }
Example #20
0
 function display($tmpl = 'default', $return = false)
 {
     //JHTMLBehavior::formvalidation();
     $form =& JForm::getInstance('plg_contactformpro.form', dirname(__FILE__) . '/../../forms/form.xml');
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     $dispatcher = JDispatcher::getInstance();
     // CHANGE FOR A COPY OF POST + CUSTOM FIELDS
     // Trigger the form preparation event.
     $dispatcher->trigger('onContentPrepareForm', array($form, $this->params));
     // Trigger the data preparation event.
     $dispatcher->trigger('onContentPrepareData', array('plg_contactformpro.form', $this->params));
     // Load the data into the form after the plugins have operated.
     $form->bind($this->params);
     $config = JFactory::getConfig();
     $site_url = $config->get('site_url');
     if (trim($site_url) == '') {
         $uri = JURI::getInstance();
         $site_url = $uri->toString(array('scheme', 'host', 'port'));
     }
     $footer = defined('JF_PREMIUM_PATH') ? '' : '<p class="jf-copy" style="display:block !important;position:absolute;bottom:0;right:0;background: none #ffffff;margin:0;padding:0;"><small><a href="http://joomfever.com/extensions-joomla/viewcategory/24-banner-rotator">Joomla! Banner Rotator</a></small></p>';
     if ($return) {
         ob_start();
     }
     include 'tmpl' . DS . $tmpl . '.php';
     if ($return) {
         return ob_get_clean();
     }
 }
Example #21
0
 /**
  * Display the XML sitemap
  * @access public
  * @return void
  */
 function display($tpl = null)
 {
     $document = $this->document;
     $document->setMimeEncoding('application/xml');
     // Call by cache handler get no params, so recover from model state
     if (!$tpl) {
         $tpl = $this->getModel()->getState('documentformat');
     }
     $language = JFactory::getLanguage();
     $langTag = $language->getTag();
     $langCode = @array_shift(explode('-', $langTag));
     $this->sysLang = $langCode;
     $this->globalConfig = JFactory::getConfig();
     $this->data = $this->get('SitemapData');
     $this->cparams = $this->getModel()->getState('cparams');
     $this->outputtedLinksBuffer = array();
     $this->application = JFactory::getApplication();
     $this->xslt = $this->getModel()->getState('xslt');
     $uriInstance = JURI::getInstance();
     if ($this->cparams->get('append_livesite', true)) {
         $customHttpPort = trim($this->cparams->get('custom_http_port', ''));
         $getPort = $customHttpPort ? ':' . $customHttpPort : '';
         $customDomain = trim($this->cparams->get('custom_sitemap_domain', ''));
         $getDomain = $customDomain ? rtrim($customDomain, '/') : rtrim($uriInstance->getScheme() . '://' . $uriInstance->getHost(), '/');
         $this->liveSite = rtrim($getDomain . $getPort, '/');
     } else {
         $this->liveSite = null;
     }
     $this->setLayout('default');
     parent::display($tpl);
 }
 function search()
 {
     $post['searchword'] = JRequest::getString('searchword', null, 'post');
     $post['ordering'] = JRequest::getWord('ordering', null, 'post');
     $post['searchphrase'] = JRequest::getWord('searchphrase', 'all', 'post');
     $post['limit'] = JRequest::getInt('limit', null, 'post');
     if ($post['limit'] === null) {
         unset($post['limit']);
     }
     $areas = JRequest::getVar('areas', null, 'post', 'array');
     if ($areas) {
         foreach ($areas as $area) {
             $post['areas'][] = JFilterInput::clean($area, 'cmd');
         }
     }
     // set Itemid id for links
     $menu =& JSite::getMenu();
     $items = $menu->getItems('link', 'index.php?option=com_search_lucene&view=search');
     if (isset($items[0])) {
         $post['Itemid'] = $items[0]->id;
     }
     unset($post['task']);
     unset($post['submit']);
     $uri = JURI::getInstance();
     $uri->setQuery($post);
     $uri->setVar('option', 'com_search_lucene');
     $this->setRedirect(JRoute::_('index.php' . $uri->toString(array('query', 'fragment')), false));
 }
Example #23
0
 function emailFriend()
 {
     JRequest::checkToken() or jexit('Invalid Token');
     require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'jobboard_member.php';
     $app = JFactory::getApplication();
     if (JobBoardHelper::verifyHumans()) {
         if (!JobBoardMemberHelper::matchHumanCode(JRequest::getString('human_ver', ''))) {
             $post = JArrayHelper::toObject(JRequest::get('post'));
             $post->errors = 1;
             if (isset($post->human_ver)) {
                 unset($post->human_ver);
             }
             $app->setUserState('com_jobboard.sfields', $post);
             $app->redirect(JRoute::_('index.php?option=com_jobboard&view=share&errors=1&job_id=' . $post->job_id . '&Itemid=' . JRequest::getInt('Itemid')), JText::_('COM_JOBBOARD_FORM_CAPTCHA_FAILMSG'), 'error');
             return;
         }
     }
     $message = new JObject();
     $message->job_id = JRequest::getVar('job_id', '', '', 'int');
     $catid = JRequest::getVar('catid', '', '', 'int');
     $message->job_title = JRequest::getVar('job_title', '', '', 'string');
     $message->job_city = JRequest::getVar('job_city', '', '', 'string');
     $message->personal_message = JRequest::getVar('personal_message', '', '', 'string');
     $uri =& JURI::getInstance();
     $message->link = $uri->getScheme() . '://' . $uri->getHost() . JRequest::getVar('job_path', '', '', 'string');
     $fields_valid = $this->validateFields();
     $message->sender_email = $fields_valid->sender_email;
     $message->sender_name = $fields_valid->sender_name;
     $message->rec_emails = $fields_valid->rec_emails;
     if ($fields_valid->errors === true) {
         $errmsg = $fields_valid->errmsg . '</ul>';
         $app->setUserState('sfields', $message);
         $link = JRoute::_('index.php?option=com_jobboard&view=share&errors=1&job_id=' . $message->job_id . '&Itemid=' . $itemid);
         $this->setRedirect($link, $errmsg, '');
         return;
     } else {
         if (stristr($message->rec_emails, ',') === TRUE) {
             $rec_emailarray = explode(',', $message->rec_emails);
             foreach ($rec_emailarray as $email_recipient) {
                 $this->sendEmail($message, trim($email_recipient));
             }
         } else {
             $this->sendEmail($message, trim($message->rec_emails));
         }
         $mesgModel =& $this->getModel('Message');
         $saved = $mesgModel->saveMessage($message);
         if ($saved) {
             $msg = '&nbsp;' . JText::_('SEND_MSG_SUCCESS');
             $link = JRoute::_('index.php?option=com_jobboard&view=job&id=' . $message->job_id, false);
             $this->setRedirect($link, $msg, '');
             return;
         } else {
             $msg = '&nbsp;' . JText::_('ERR_WAIT');
             $link = JRoute::_('index.php?option=com_jobboard&view=job&id=' . $message->job_id, false);
             $this->setRedirect($link, $msg, '');
             return;
         }
     }
     parent::display();
 }
Example #24
0
 function passURLs(&$parent, &$params, $selection = array(), $assignment = 'all')
 {
     $url = JURI::getInstance();
     $url = $url->toString();
     $regex = isset($params->regex) ? $params->regex : 0;
     if (!is_array($selection)) {
         $selection = explode("\n", $selection);
     }
     $pass = 0;
     foreach ($selection as $s) {
         $s = trim($s);
         if ($s != '') {
             if ($regex) {
                 $url_part = str_replace(array('#', '&amp;'), array('\\#', '(&amp;|&)'), $s);
                 $s = '#' . $url_part . '#si';
                 if (@preg_match($s . 'u', $url) || @preg_match($s . 'u', html_entity_decode($url, ENT_COMPAT, 'UTF-8')) || @preg_match($s, $url) || @preg_match($s, html_entity_decode($url, ENT_COMPAT, 'UTF-8'))) {
                     $pass = 1;
                     break;
                 }
             } else {
                 if (!(strpos($url, $s) === false) || !(strpos(html_entity_decode($url, ENT_COMPAT, 'UTF-8'), $s) === false)) {
                     $pass = 1;
                     break;
                 }
             }
         }
     }
     return $parent->pass($pass, $assignment);
 }
Example #25
0
 /**
  * Class constructor
  *
  * @param	array An optional associative array of configuration settings.
  * Recognized key values include 'clientId' (this list is not meant to be comprehensive).
  */
 public function __construct($config = array())
 {
     $config['clientId'] = 0;
     \Event::listen(function ($event) {
         // This must be done before the session is read, otherwise it will overwrite
         // the existing session with a guest non-https session prior to redirecting to https
         // NOTE: we're including a cli check here because the console currently uses the 'site'
         // application.  This should be remedied in the new framework.
         $app = $event->getArgument('app');
         if ($app->getCfg('force_ssl') == 2 && php_sapi_name() != 'cli') {
             $uri = JURI::getInstance();
             if (strtolower($uri->getScheme()) != 'https') {
                 // We also can't use the Application::redirect method here as
                 // it tries to use JFactory::getDocument, which doesn't work
                 // prior to application initialization
                 $uri->setScheme('https');
                 header('HTTP/1.1 303 See other');
                 header('Location: ' . (string) $uri);
                 header('Content-Type: text/html;');
                 $app->close();
             }
         }
     }, 'application_onBeforeSessionCreate');
     parent::__construct($config);
 }
Example #26
0
 function __construct()
 {
     require_once 'rtbrowser.class.php';
     //$this->checkRedirect();
     $this->browser = new RTBrowser();
     // some more init
     $this->basePath = JPATH_ROOT;
     $this->adminPath = $this->basePath . DS . 'administrator';
     $this->templateName = $this->_getCurrentAdminTemplate();
     $this->templatePath = $this->adminPath . DS . 'templates' . DS . $this->templateName;
     $this->templateUrl = $this->baseUrl . 'templates/' . $this->templateName;
     $this->templateUrlAbsolute = JURI::root(true) . '/administrator/' . $this->templateUrl;
     // Set the main class vars to match the call
     JHTML::_('behavior.mootools');
     $doc =& JFactory::getDocument();
     $this->document = $doc;
     $this->user =& JFactory::getUser();
     $this->language = $doc->language;
     $this->direction = $doc->direction;
     $this->session =& JFactory::getSession();
     $this->baseUrl = JURI::root(true) . "/";
     $uri = JURI::getInstance();
     $this->currentUrl = $uri->toString();
     $this->params = $this->getTemplateParams();
 }
Example #27
0
	function plgSystemmyApiOpenGraph(&$subject, $config){
		parent::__construct($subject, $config);
		if(!class_exists('plgSystemmyApiConnect')) return;
		
		$cache = & JFactory::getCache('plgSystemmyApiOpenGraph - FB Admins query');
		$cache->setCaching( 1 );
		$config 	=& JFactory::getConfig();
		$connect_plugin 	=& JPluginHelper::getPlugin('system', 'myApiConnect');
		$connect_params 	= new JParameter( $connect_plugin->params );
		
		$plugin =& JPluginHelper::getPlugin('system', 'myApiOpenGraph');
		$plugin_params = new JParameter( $plugin->params );
		
		$db_admins = $cache->call( array( 'plgSystemmyApiOpenGraph', 'getFbAdmins'));
		$param_admins = ($plugin_params->get('fbadmins') != '') ? explode(',',$plugin_params->get('fbadmins')) : array();
		$admins = array_merge($db_admins,$param_admins);
		
		$ogptags_default					= array();
		$ogptags_default['og:title']		= $config->getValue( 'config.sitename' );
		$ogptags_default['og:type'] 		= 'website';
		$ogptags_default['og:url'] 			= JURI::getInstance()->toString();
		$ogptags_default['og:site_name']	= $config->getValue( 'config.sitename' );
		$ogptags_default['fb:app_id'] 		= $connect_params->get('appId');
		$ogptags_default['fb:admins']		= implode(',',$admins);
		if($plugin_params->get('ogimage') != '' && $plugin_params->get('ogimage') != -1) $ogptags_default['og:image'] = JURI::base().'images/'.$plugin_params->get('ogimage');
		if($plugin_params->get('fbpageid') != '') $ogptags_default['fb:page_id'] = $plugin_params->get('fbpageid');
		
		
		plgSystemmyApiOpenGraph::setTags($ogptags_default);
	}
Example #28
0
 public static function edit($weblink, $params, $attribs = array())
 {
     $uri = JURI::getInstance();
     if ($params && $params->get('popup')) {
         return;
     }
     if ($weblink->state < 0) {
         return;
     }
     JHtml::_('behavior.tooltip');
     $url = WeblinksHelperRoute::getFormRoute($weblink->id, base64_encode($uri));
     $icon = $weblink->state ? 'edit.png' : 'edit_unpublished.png';
     $text = JHtml::_('image', 'system/' . $icon, JText::_('JGLOBAL_EDIT'), null, true);
     if ($weblink->state == 0) {
         $overlib = JText::_('JUNPUBLISHED');
     } else {
         $overlib = JText::_('JPUBLISHED');
     }
     $date = JHtml::_('date', $weblink->created);
     $author = $weblink->created_by_alias ? $weblink->created_by_alias : $weblink->author;
     $overlib .= '&lt;br /&gt;';
     $overlib .= $date;
     $overlib .= '&lt;br /&gt;';
     $overlib .= htmlspecialchars($author, ENT_COMPAT, 'UTF-8');
     $button = JHtml::_('link', JRoute::_($url), $text);
     $output = '<span class="hasTip" title="' . JText::_('COM_WEBLINKS_EDIT') . ' :: ' . $overlib . '">' . $button . '</span>';
     return $output;
 }
Example #29
0
 /**
  * Routes URLs
  *
  * @access public
  */
 function onAfterInitialise()
 {
     global $mainframe;
     $uri =& JURI::getInstance();
     $router =& $mainframe->getRouter();
     $router->attachParseRule('parseJumiRouter');
 }
Example #30
0
 function display($tpl = null)
 {
     $this->params = clone JFactory::getApplication()->getParams('com_rsmembership');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('pagination');
     $this->total = $this->get('total');
     $this->action = $this->escape(JRoute::_(JURI::getInstance(), false));
     $this->date_format = RSMembershipHelper::getConfig('date_format');
     $this->transactions = $this->get('transactions');
     $this->limitstart = JFactory::getApplication()->input->get('limitstart', 0, 'int');
     $Itemid = JFactory::getApplication()->input->get('Itemid', 0, 'int');
     if ($Itemid > 0) {
         $this->Itemid = '&Itemid=' . $Itemid;
     } else {
         $this->Itemid = '';
     }
     // Description
     if ($this->params->get('menu-meta_description')) {
         $this->document->setDescription($this->params->get('menu-meta_description'));
     }
     // Keywords
     if ($this->params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
     }
     // Robots
     if ($this->params->get('robots')) {
         $this->document->setMetadata('robots', $this->params->get('robots'));
     }
     parent::display();
 }