includes/common.php
changeset 209 8a00247d1dee
parent 205 c4542792db2b
child 227 0eca1498a77b
equal deleted inserted replaced
208:c75ad574b56d 209:8a00247d1dee
   102 global $db, $session, $paths, $template, $plugins; // Common objects
   102 global $db, $session, $paths, $template, $plugins; // Common objects
   103 global $enano_config; // A global used to cache config information without making loads of queries ;-)
   103 global $enano_config; // A global used to cache config information without making loads of queries ;-)
   104                       // In addition, $enano_config is used to fetch config information if die_semicritical() is called.
   104                       // In addition, $enano_config is used to fetch config information if die_semicritical() is called.
   105                       
   105                       
   106 global $email;
   106 global $email;
       
   107 global $lang;
   107 
   108 
   108 if(!isset($_SERVER['HTTP_HOST'])) grinding_halt('Cannot get hostname', '<p>Your web browser did not provide the HTTP Host: field. This site requires a modern browser that supports the HTTP 1.1 standard.</p>');
   109 if(!isset($_SERVER['HTTP_HOST'])) grinding_halt('Cannot get hostname', '<p>Your web browser did not provide the HTTP Host: field. This site requires a modern browser that supports the HTTP 1.1 standard.</p>');
   109                      
   110                      
   110 $db = new mysql();
   111 $db = new mysql();
   111 dc_here('common: calling $db->connect();');
   112 dc_here('common: calling $db->connect();');
   184 {
   185 {
   185   if ( intval($ks) != AES_BLOCKSIZE )
   186   if ( intval($ks) != AES_BLOCKSIZE )
   186   {
   187   {
   187     grinding_halt('AES block size changed', '<p>Enano has detected that the AES block size in constants.php has been changed. This change cannot be performed after installation, otherwise all passwords would have to be re-encrypted.</p><p>Please change the block size back to ' . $ks . ' bits and reload this page.</p>');
   188     grinding_halt('AES block size changed', '<p>Enano has detected that the AES block size in constants.php has been changed. This change cannot be performed after installation, otherwise all passwords would have to be re-encrypted.</p><p>Please change the block size back to ' . $ks . ' bits and reload this page.</p>');
   188   }
   189   }
       
   190 }
       
   191 
       
   192 // Is there no default language?
       
   193 if ( getConfig('lang_default') === false )
       
   194 {
       
   195   $q = $db->sql_query('SELECT lang_id FROM '.table_prefix.'language LIMIT 1;');
       
   196   if ( !$q )
       
   197     $db->_die('common.php - setting default language');
       
   198   if ( $db->numrows() < 1 && !defined('ENANO_ALLOW_LOAD_NOLANG') )
       
   199   {
       
   200     grinding_halt('No languages', '<p>There are no languages installed on this site.</p>
       
   201         <p>If you are the website administrator, you may install a language by writing and executing a simple PHP script to install it:</p>
       
   202         <pre>
       
   203 &lt;?php
       
   204 define("ENANO_ALLOW_LOAD_NOLANG", 1);
       
   205 $_GET["title"] = "langinstall";
       
   206 require("includes/common.php");
       
   207 install_language("eng", "English", "English", ENANO_ROOT . "/language/english/enano.json");</pre>');
       
   208   }
       
   209   $row = $db->fetchrow();
       
   210   setConfig('default_language', $row['lang_id']);
   189 }
   211 }
   190 
   212 
   191 // Our list of tables included in Enano
   213 // Our list of tables included in Enano
   192 $system_table_list = Array(
   214 $system_table_list = Array(
   193     table_prefix.'categories',
   215     table_prefix.'categories',