Fatal error: Class 'JRequest' not found in

General questions relating to Joomla! 3.x. Please consider the availability of third-party templates and extensions when deciding which Joomla version to use.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
shep2014
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Jun 14, 2013 8:13 pm

Fatal error: Class 'JRequest' not found in

Postby shep2014 » Fri Jun 14, 2013 8:30 pm

Help!!!! I published my website with cpanel and now this shows up.
Idk what to do?

Fatal error: Class 'JRequest' not found in /home/ragingcl/public_html/installation/includes/application.php on line 119

Code: Select all

$requestLang = JRequest::getCmd('lang', null);   

That is line 119, what does it mean?

Code: Select all

<?php
/**
 * @package      Joomla.Installation
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license      GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Joomla Application class
 *
 * Provide many supporting API functions
 *
 * @package      Joomla.Installation
 */
class JInstallation extends JApplication
{
   /**
    * The url of the site
    *
    * @var string
    */
   protected $_siteURL = null;

   /**
   * Class constructor
   *
   * @param   array $config   An optional associative array of configuration settings.
   * Recognized key values include 'clientId' (this list is not meant to be comprehensive).
   *
   * @return   void
   */
   public function __construct(array $config = array())
   {
      $config['clientId'] = 2;
      parent::__construct($config);

      $this->_createConfiguration('');

      // Set the root in the URI based on the application name.
      JURI::root(null, str_replace('/'.$this->getName(), '', JURI::base(true)));
   }

   /**
    * Render the application
    *
    * @return   void
    */
   public function render()
   {
      $document = JFactory::getDocument();
      $config = JFactory::getConfig();
      $user = JFactory::getUser();

      switch($document->getType())
      {
         case 'html' :
            // Set metadata
            $document->setTitle(JText::_('INSTL_PAGE_TITLE'));
            break;
         default :
            break;
      }

      // Define component path
      define('JPATH_COMPONENT', JPATH_BASE);
      define('JPATH_COMPONENT_SITE', JPATH_SITE);
      define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR);

      // Start the output buffer.
      ob_start();

      // Import the controller.
      require_once JPATH_COMPONENT.'/controller.php';

      // Execute the task.
      $controller   = JControllerLegacy::getInstance('JInstallation');
      $controller->execute(JRequest::getVar('task'));
      $controller->redirect();

      // Get output from the buffer and clean it.
      $contents = ob_get_contents();
      ob_end_clean();

      $file = JRequest::getCmd('tmpl', 'index');

      $params = array(
         'template'   => 'template',
         'file'      => $file.'.php',
         'directory' => JPATH_THEMES,
         'params'   => '{}'
      );

      $document->setBuffer($contents, 'installation');
      $document->setTitle(JText::_('INSTL_PAGE_TITLE'));

      $data = $document->render(false, $params);
      JResponse::setBody($data);
      if (JFactory::getConfig()->get('debug_lang')) {
         $this->debugLanguage();
      }
   }

   /**
    * Initialise the application.
    *
    * @param   array   $options
    *
    * @return   void
    */
   public function initialise($options = array())
   {
      //Get the localisation information provided in the localise.xml file.
      $forced = $this->getLocalise();

      // Check the request data for the language.
      if (empty($options['language'])) {
            $requestLang = JRequest::getCmd('lang', null);      
         if (!is_null($requestLang)) {
            $options['language'] = $requestLang;
         }
      }

      // Check the session for the language.
      if (empty($options['language'])) {
         $sessionLang = JFactory::getSession()->get('setup.language');
         if (!is_null($sessionLang)) {
            $options['language'] = $sessionLang;
         }
      }

      // This could be a first-time visit - try to determine what the client accepts.
      if (empty($options['language'])) {
         if (!empty($forced['language'])) {
            $options['language'] = $forced['language'];
         } else {
            $options['language'] = JLanguageHelper::detectLanguage();
            if (empty($options['language'])) {
               $options['language'] = 'en-GB';
            }
         }
      }

      // Give the user English
      if (empty($options['language'])) {
         $options['language'] = 'en-GB';
      }

      // Set the language in the class
      $conf = JFactory::getConfig();
      $conf->set('language', $options['language']);
      $conf->set('debug_lang', $forced['debug']);
      $conf->set('sampledata', $forced['sampledata']);
   }

   /**
    * @return   void
    */
   public static function debugLanguage()
   {
      ob_start();
      $lang = JFactory::getLanguage();
      echo '<h4>Parsing errors in language files</h4>';
      $errorfiles = $lang->getErrorFiles();

      if (count($errorfiles)) {
         echo '<ul>';

         foreach ($errorfiles as $file => $error)
         {
            echo "<li>$error</li>";
         }
         echo '</ul>';
      }
      else {
         echo '<pre>None</pre>';
      }

      echo '<h4>Untranslated Strings</h4>';
      echo '<pre>';
      $orphans = $lang->getOrphans();

      if (count($orphans)) {
         ksort($orphans, SORT_STRING);

         foreach ($orphans as $key => $occurance)
         {
            $guess = str_replace('_', ' ', $key);

            $parts = explode(' ', $guess);
            if (count($parts) > 1) {
               array_shift($parts);
               $guess = implode(' ', $parts);
            }

            $guess = trim($guess);


            $key = trim(strtoupper($key));
            $key = preg_replace('#\s+#', '_', $key);
            $key = preg_replace('#\W#', '', $key);

            // Prepare the text
            $guesses[] = $key.'="'.$guess.'"';
         }

         echo "\n\n# ".$file."\n\n";
         echo implode("\n", $guesses);
      }
      else {
         echo 'None';
      }
      echo '</pre>';
      $debug = ob_get_clean();
      JResponse::appendBody($debug);
   }

   /**
    * Set configuration values
    *
    * @param   array   $vars      Array of configuration values
    * @param   string   $namespace   The namespace
    *
    * @return   void
    */
   public function setCfg(array $vars = array(), $namespace = 'config')
   {
      $this->_registry->loadArray($vars, $namespace);
   }

   /**
    * Create the configuration registry
    *
    * @return   void
    */
   public function _createConfiguration($file)
   {
      // Create the registry with a default namespace of config which is read only
      $this->_registry = new JRegistry('config');
   }

   /**
   * Get the template
   *
   * @return string The template name
   */
   public function getTemplate($params = false)
   {
      if ((bool) $params) {
         $template = new stdClass();
         $template->template = 'template';
         $template->params = new JRegistry;
         return $template;
      }
      return 'template';
   }

   /**
    * Create the user session
    *
    * @param   string   $name   The sessions name
    *
    * @return   object   JSession
    */
   public function & _createSession($name)
   {
      $options = array();
      $options['name'] = $name;

      $session = JFactory::getSession($options);
      if (!$session->get('registry') instanceof JRegistry) {
         // Registry has been corrupted somehow
         $session->set('registry', new JRegistry('session'));
      }

      return $session;
   }

   /**
    * Returns the language code and help url set in the localise.xml file.
    * Used for forcing a particular language in localised releases.
    *
    * @return   bool|array   False on failure, array on success.
    */
   public function getLocalise()
   {
      $xml = JFactory::getXML(JPATH_SITE . '/installation/localise.xml');

      if (!$xml) {
         return false;
      }

      // Check that it's a localise file
      if ($xml->getName() != 'localise') {
         return false;
      }

      $ret = array();

      $ret['language'] = (string)$xml->forceLang;
      $ret['helpurl'] = (string)$xml->helpurl;
      $ret['debug'] = (string)$xml->debug;
      $ret['sampledata'] = (string)$xml->sampledata;

      return $ret;
   }

   /**
     * Returns the installed language files in the administrative and
     * front-end area.
     *
     * @param   boolean   $db
     *
     * @return array Array with installed language packs in admin and site area
     */
    public function getLocaliseAdmin($db=false)
    {
       jimport('joomla.filesystem.folder');

       // Read the files in the admin area
       $path = JLanguage::getLanguagePath(JPATH_ADMINISTRATOR);
       $langfiles['admin'] = JFolder::folders($path);

       // Read the files in the site area
       $path = JLanguage::getLanguagePath(JPATH_SITE);
       $langfiles['site'] = JFolder::folders($path);

       if ($db) {
          $langfiles_disk = $langfiles;
          $langfiles = array();
          $langfiles['admin'] = array();
          $langfiles['site'] = array();
          $query = $db->getQuery(true);
          $query->select('element,client_id');
          $query->from('#__extensions');
          $query->where('type = '.$db->quote('language'));
          $db->setQuery($query);
          $langs = $db->loadObjectList();
          foreach ($langs as $lang)
          {
             switch($lang->client_id)
             {
                case 0: // site
                   if (in_array($lang->element, $langfiles_disk['site'])) {
                      $langfiles['site'][] = $lang->element;
                   }
                   break;
                case 1: // administrator
                   if (in_array($lang->element, $langfiles_disk['admin'])) {
                      $langfiles['admin'][] = $lang->element;
                   }
                   break;
             }
          }
       }

       return $langfiles;
    }
}

User avatar
toivo
Joomla! Champion
Joomla! Champion
Posts: 7332
Joined: Thu Feb 15, 2007 5:48 am
Location: Nottingham, UK
Contact:

Re: Fatal error: Class 'JRequest' not found in

Postby toivo » Sat Jun 22, 2013 11:18 am

The class JRequest is defined in the file /libraries/legacy/request/request.php. That file must be missing from the file system. You can find the file from the installation archive. Copy it to your server and see if that fixes the problem.

If more classes or similar are missing, it is best to copy all the files to the server, except the folder 'installaiton'.
Toivo Talikka, Global Moderator
my first programs were assembled and run in 16KB :)
http://archive.computerhistory.org/resources/text/GE/GE.GE-115SystemSoftware.1967.102646096.pdf#zoom=100

Marianne0987
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sun Jul 07, 2013 1:46 pm

Re: Fatal error: Class 'JRequest' not found in

Postby Marianne0987 » Sun Jul 07, 2013 2:08 pm

Hello,

I have big trouble after upgrading from 2.5 to 3.1 to find te right way to replace the 'Jrequest' command which no longer works:

In my template the Jrequest determined if it was the homepage, now I have no homepage,
here's what i have:

Can anyone help me please?


<?php
/**
* @version $Id: index.php 21720 2011-07-01 08:31:15Z chdemko $
* @package Joomla.Site
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

/* The following line loads the MooTools JavaScript Library */
JHtml::_('behavior.framework', true);

/* The following line gets the application object for things like displaying the site name */
$app = JFactory::getApplication();


// haal pagina titel alias op
$theMenu = JSite::getMenu();
$theActiveMenu = $theMenu->getActive();
$jinput = JFactory::getApplication()->input;

// haal pagina category op
$db = &JFactory::getDBO();
$id = JRequest::getString('id');
$db->setQuery('SELECT #__categories.title FROM #__content, #__categories WHERE #__content.catid = #__categories.id AND #__content.id = '.$id);
$category = $db->loadResult();
?>
<?php echo '<?'; ?>xml version="1.0" encoding="<?php echo $this->_charset ?>"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" >
<head>
<link href='http://fonts.googleapis.com/css?family=Mako' rel='stylesheet' type='text/css'> <!-- The following JDOC Head tag loads all the header and meta information from your site config and content. -->


<jdoc:include type="head" />

<!-- The following line loads the template CSS file located in the template folder. -->
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/template.css" type="text/css" />

<!-- The following line loads the template JavaScript file located in the template folder. It's blank by default. -->
<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/template.js"></script>

</head>
<body>
<?php
// dedecteer homepage
if(JRequest::getVar('view') == 'featured' ) :

?>
<div id="floater"></div>
<div id="centered">
<div class="home_left">
<div class="homelink_zaaien">
<a href="index.php/toepassingen/zaai">Zaaien</a>
</div>
<div class="homelink_stek">
<a href="index.php/toepassingen/stek">Stek</a>
</div>
<div class="homelink_weefselkweek">
<a href="index.php/toepassingen/weefselkweek">Weefsel<br />kweek</a>
</div>
</div><!-- einde home_left -->
<div class="home_right">
<div class="joomla-header_home">

</div>
<?php if($this->countModules('atomic-topmenu')) : ?>
<jdoc:include type="modules" name="atomic-topmenu" style="container_home_menu" />
<?php endif; ?>
<jdoc:include type="message" />
<jdoc:include type="component" />
</div><!-- einde home_right -->
<div class="clear"></div>
</div><!-- einde centered -->

<?
//not homepage
else :
?>
<div class="border">
<div class="colleft">
<div class="leftcol_top" style="background:url('images/random/<?php echo rand(1, 11); ?>.jpg') no-repeat 0 0;">
<div class="categorie_titel"><?php echo $category; ?></div>
</div>
<?php if($this->countModules('atomic-bottomleft')) : ?>
<div class="links">
<jdoc:include type="modules" name="atomic-bottomleft" style="bottommodule" />
</div>
<?php endif; ?>

</div><!-- einde colleft -->
<div class="colright">
<div class="container">
<div class="joomla-header">

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 21437
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: Fatal error: Class 'JRequest' not found in

Postby Per Yngve Berg » Sun Jul 07, 2013 2:44 pm


sovainfo
Joomla! Champion
Joomla! Champion
Posts: 7432
Joined: Sat Oct 01, 2011 7:06 pm

Re: Fatal error: Class 'JRequest' not found in

Postby sovainfo » Sun Jul 07, 2013 4:33 pm

Issue with migrating? Include logs/joomla_update.php in your report!
Blank screen? Verify pagesource for HTML code (javascript error)
Installation failing on populating database? Install with set_time_limit(0)
Document your customizations!


Return to “General Questions/New to Joomla! 3.x”

Who is online

Users browsing this forum: veblis, waarnemer and 20 guests