includes/common.php
changeset 99 2332ebd75f61
parent 80 cb7dde69c301
child 129 0b5244001799
equal deleted inserted replaced
98:6457a9b983c6 99:2332ebd75f61
   145 $db->free_result();
   145 $db->free_result();
   146 
   146 
   147 if(enano_version(false, true) != $version)
   147 if(enano_version(false, true) != $version)
   148 {
   148 {
   149   grinding_halt('Version mismatch', '<p>It seems that the Enano release we\'re trying to run ('.$version.') is different from the version specified in your database ('.enano_version().'). Perhaps you need to <a href="'.scriptPath.'/upgrade.php">upgrade</a>?</p>');
   149   grinding_halt('Version mismatch', '<p>It seems that the Enano release we\'re trying to run ('.$version.') is different from the version specified in your database ('.enano_version().'). Perhaps you need to <a href="'.scriptPath.'/upgrade.php">upgrade</a>?</p>');
       
   150 }
       
   151 
       
   152 //
       
   153 // Low level maintenance
       
   154 //
       
   155 
       
   156 // If the search algorithm backend has been changed, empty out the search cache (the two cache formats are incompatible with each other)
       
   157 if ( getConfig('last_search_algo') != SEARCH_MODE )
       
   158 {
       
   159   if ( !$db->sql_query('DELETE FROM '.table_prefix.'search_cache;') )
       
   160     $db->_die();
       
   161   setConfig('last_search_algo', SEARCH_MODE);
       
   162 }
       
   163 
       
   164 // If the AES key size has been changed, bail out and fast
       
   165 if ( !getConfig('aes_key_size') )
       
   166 {
       
   167   setConfig('aes_key_size', AES_BITS);
       
   168 }
       
   169 else if ( $ks = getConfig('aes_key_size') )
       
   170 {
       
   171   if ( intval($ks) != AES_BITS )
       
   172   {
       
   173     grinding_halt('AES key size changed', '<p>Enano has detected that the AES key size in constants.php has been changed. This change cannot be performed after installation, otherwise the private key would have to be re-generated and all passwords would have to be re-encrypted.</p><p>Please change the key size back to ' . $ks . ' bits and reload this page.</p>');
       
   174   }
       
   175 }
       
   176 
       
   177 // Same for AES block size
       
   178 if ( !getConfig('aes_block_size') )
       
   179 {
       
   180   setConfig('aes_block_size', AES_BLOCKSIZE);
       
   181 }
       
   182 else if ( $ks = getConfig('aes_block_size') )
       
   183 {
       
   184   if ( intval($ks) != AES_BLOCKSIZE )
       
   185   {
       
   186     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>');
       
   187   }
   150 }
   188 }
   151 
   189 
   152 // Our list of tables included in Enano
   190 // Our list of tables included in Enano
   153 $system_table_list = Array(
   191 $system_table_list = Array(
   154     table_prefix.'categories',
   192     table_prefix.'categories',