install.php
changeset 198 d5dff8148dfe
parent 197 cc358458a012
child 199 c15c1d2bdeb8
equal deleted inserted replaced
197:cc358458a012 198:d5dff8148dfe
   389     run_test('return version_compare(\'4.3.0\', PHP_VERSION, \'<\');', 'PHP Version >=4.3.0', 'It seems that the version of PHP that your server is running is too old to support Enano properly. If this is your server, please upgrade to the most recent version of PHP, remembering to use the --with-mysql configure option if you compile it yourself. If this is not your server, please contact your webhost and ask them if it would be possible to upgrade PHP. If this is not possible, you will need to switch to a different webhost in order to use Enano.');
   389     run_test('return version_compare(\'4.3.0\', PHP_VERSION, \'<\');', 'PHP Version >=4.3.0', 'It seems that the version of PHP that your server is running is too old to support Enano properly. If this is your server, please upgrade to the most recent version of PHP, remembering to use the --with-mysql configure option if you compile it yourself. If this is not your server, please contact your webhost and ask them if it would be possible to upgrade PHP. If this is not possible, you will need to switch to a different webhost in order to use Enano.');
   390     run_test('return function_exists(\'mysql_connect\');', 'MySQL extension for PHP', 'It seems that your PHP installation does not have the MySQL extension enabled. If this is your own server, you may need to just enable the "libmysql.so" extension in php.ini. If you do not have the MySQL extension installed, you will need to either use your distribution\'s package manager to install it, or you will have to compile PHP from source. If you compile PHP from source, please remember to use the "--with-mysql" configure option, and you will have to have the MySQL development files installed (they usually are). If this is not your server, please contact your hosting company and ask them to install the PHP MySQL extension.');
   390     run_test('return function_exists(\'mysql_connect\');', 'MySQL extension for PHP', 'It seems that your PHP installation does not have the MySQL extension enabled. If this is your own server, you may need to just enable the "libmysql.so" extension in php.ini. If you do not have the MySQL extension installed, you will need to either use your distribution\'s package manager to install it, or you will have to compile PHP from source. If you compile PHP from source, please remember to use the "--with-mysql" configure option, and you will have to have the MySQL development files installed (they usually are). If this is not your server, please contact your hosting company and ask them to install the PHP MySQL extension.');
   391     run_test('return @ini_get(\'file_uploads\');', 'File upload support', 'It seems that your server does not support uploading files. Enano *requires* this functionality in order to work properly. Please ask your server administrator to set the "file_uploads" option in php.ini to "On".');
   391     run_test('return @ini_get(\'file_uploads\');', 'File upload support', 'It seems that your server does not support uploading files. Enano *requires* this functionality in order to work properly. Please ask your server administrator to set the "file_uploads" option in php.ini to "On".');
   392     run_test('return is_apache();', 'Apache HTTP Server', 'Apparently your server is running a web server other than Apache. Enano will work nontheless, but there are some known bugs with non-Apache servers, and the "fancy" URLs will not work properly. The "Standard URLs" option will be set on the website configuration page, only change it if you are absolutely certain that your server is running Apache.', true);
   392     run_test('return is_apache();', 'Apache HTTP Server', 'Apparently your server is running a web server other than Apache. Enano will work nontheless, but there are some known bugs with non-Apache servers, and the "fancy" URLs will not work properly. The "Standard URLs" option will be set on the website configuration page, only change it if you are absolutely certain that your server is running Apache.', true);
   393     //run_test('return function_exists(\'finfo_file\');', 'Fileinfo PECL extension', 'The MIME magic PHP extension is used to determine the type of a file by looking for a certain "magic" string of characters inside it. This functionality is used by Enano to more effectively prevent malicious file uploads. The MIME magic option will be disabled by default.', true);
   393     //run_test('return function_exists(\'finfo_file\');', 'Fileinfo PECL extension', 'The MIME magic PHP extension is used to determine the type of a file by looking for a certain "magic" string of characters inside it. This functionality is used by Enano to more effectively prevent malicious file uploads. The MIME magic option will be disabled by default.', true);
   394     run_test('return is_writable(ENANO_ROOT.\'/config.php\');', 'Configuration file writable', 'It looks like the configuration file, config.php, is not writable. Enano needs to be able to write to this file in order to install.<br /><br /><b>If you are installing Enano on a SourceForge web site:</b><br />SourceForge mounts the web partitions read-only now, so you will need to use the project shell service to symlink config.php to a file in the /tmp/persistent directory.');
   394     run_test('return is_writable(ENANO_ROOT.\'/config.new.php\');', 'Configuration file writable', 'It looks like the configuration file, config.new.php, is not writable. Enano needs to be able to write to this file in order to install.<br /><br /><b>If you are installing Enano on a SourceForge web site:</b><br />SourceForge mounts the web partitions read-only now, so you will need to use the project shell service to symlink config.php to a file in the /tmp/persistent directory.');
   395     run_test('return file_exists(\'/usr/bin/convert\');', 'ImageMagick support', 'Enano uses ImageMagick to scale images into thumbnails. Because ImageMagick was not found on your server, Enano will use the width= and height= attributes on the &lt;img&gt; tag to scale images. This can cause somewhat of a performance increase, but bandwidth usage will be higher, especially if you use high-resolution images on your site.<br /><br />If you are sure that you have ImageMagick, you can set the location of the "convert" program using the administration panel after installation is complete.', true);
   395     run_test('return file_exists(\'/usr/bin/convert\');', 'ImageMagick support', 'Enano uses ImageMagick to scale images into thumbnails. Because ImageMagick was not found on your server, Enano will use the width= and height= attributes on the &lt;img&gt; tag to scale images. This can cause somewhat of a performance increase, but bandwidth usage will be higher, especially if you use high-resolution images on your site.<br /><br />If you are sure that you have ImageMagick, you can set the location of the "convert" program using the administration panel after installation is complete.', true);
   396     run_test('return is_writable(ENANO_ROOT.\'/cache/\');', 'Cache directory writable', 'Apparently the cache/ directory is not writable. Enano will still work, but you will not be able to cache thumbnails, meaning the server will need to re-render them each time they are requested. In some cases, this can cause a significant slowdown.', true);
   396     run_test('return is_writable(ENANO_ROOT.\'/cache/\');', 'Cache directory writable', 'Apparently the cache/ directory is not writable. Enano will still work, but you will not be able to cache thumbnails, meaning the server will need to re-render them each time they are requested. In some cases, this can cause a significant slowdown.', true);
   397     run_test('return is_writable(ENANO_ROOT.\'/files/\');', 'File uploads directory writable', 'It seems that the directory where uploaded files are stored (' . ENANO_ROOT . '/files) cannot be written by the server. Enano will still function, but file uploads will not function, and will be disabled by default.', true);
   397     run_test('return is_writable(ENANO_ROOT.\'/files/\');', 'File uploads directory writable', 'It seems that the directory where uploaded files are stored (' . ENANO_ROOT . '/files) cannot be written by the server. Enano will still function, but file uploads will not function, and will be disabled by default.', true);
   398     echo '</table>';
   398     echo '</table>';
   399     if(!$failed)
   399     if(!$failed)
   739       echo 'No POST data signature found. Please <a href="install.php?mode=sysreqs">restart the installation</a>.';
   739       echo 'No POST data signature found. Please <a href="install.php?mode=sysreqs">restart the installation</a>.';
   740       $template->footer();
   740       $template->footer();
   741       exit;
   741       exit;
   742     }
   742     }
   743     unset($_POST['_cont']);
   743     unset($_POST['_cont']);
   744     require('config.php');
   744     require('config.new.php');
   745     $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE);
   745     $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE);
   746     if ( isset($crypto_key) )
   746     if ( isset($crypto_key) )
   747     {
   747     {
   748       $cryptkey = $crypto_key;
   748       $cryptkey = $crypto_key;
   749     }
   749     }
   750     if(!isset($cryptkey) || ( isset($cryptkey) && strlen($cryptkey) != AES_BITS / 4) )
   750     if(!isset($cryptkey) || ( isset($cryptkey) && strlen($cryptkey) != AES_BITS / 4) )
   751     {
   751     {
   752       $cryptkey = $aes->gen_readymade_key();
   752       $cryptkey = $aes->gen_readymade_key();
   753       $handle = @fopen(ENANO_ROOT.'/config.php', 'w');
   753       $handle = @fopen(ENANO_ROOT.'/config.new.php', 'w');
   754       if(!$handle)
   754       if(!$handle)
   755       {
   755       {
   756         echo '<p>ERROR: Cannot open config.php for writing - exiting!</p>';
   756         echo '<p>ERROR: Cannot open config.php for writing - exiting!</p>';
   757         $template->footer();
   757         $template->footer();
   758         exit;
   758         exit;
  1038       
  1038       
  1039       $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE);
  1039       $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE);
  1040       
  1040       
  1041       if ( !empty($_POST['crypt_data']) )
  1041       if ( !empty($_POST['crypt_data']) )
  1042       {
  1042       {
  1043         require('config.php');
  1043         require('config.new.php');
  1044         if ( !isset($cryptkey) )
  1044         if ( !isset($cryptkey) )
  1045         {
  1045         {
  1046           echo 'failed!<br />Cannot get the key from config.php';
  1046           echo 'failed!<br />Cannot get the key from config.new.php';
  1047           break;
  1047           break;
  1048         }
  1048         }
  1049         $key = hexdecode($cryptkey);
  1049         $key = hexdecode($cryptkey);
  1050         
  1050         
  1051         $dec = $aes->decrypt($_POST['crypt_data'], $key, ENC_HEX);
  1051         $dec = $aes->decrypt($_POST['crypt_data'], $key, ENC_HEX);
  1154   define(\'ENANO_INSTALLED\', \'true\');
  1154   define(\'ENANO_INSTALLED\', \'true\');
  1155 }
  1155 }
  1156 $crypto_key = \''.$privkey.'\';
  1156 $crypto_key = \''.$privkey.'\';
  1157 ?>';
  1157 ?>';
  1158 
  1158 
  1159       $cf_handle = fopen(ENANO_ROOT.'/config.php', 'w');
  1159       $cf_handle = fopen(ENANO_ROOT.'/config.new.php', 'w');
  1160       if(!$cf_handle) err('Couldn\'t open file config.php for writing');
  1160       if(!$cf_handle) err('Couldn\'t open file config.php for writing');
  1161       fwrite($cf_handle, $config_file);
  1161       fwrite($cf_handle, $config_file);
  1162       fclose($cf_handle);
  1162       fclose($cf_handle);
  1163       
  1163       
  1164       echo 'done!<br />Starting the Enano API...';
  1164       echo 'done!<br />Starting the Enano API...';
  1183       
  1183       
  1184       $q = $db->sql_query('INSERT INTO ' . $_POST['table_prefix'] . 'logs(log_type,action,time_id,date_string,author,page_text,edit_summary) VALUES(\'security\', \'install_enano\', ' . time() . ', \'' . date('d M Y h:i a') . '\', \'' . mysql_real_escape_string($_POST['admin_user']) . '\', \'' . mysql_real_escape_string(ENANO_VERSION) . '\', \'' . mysql_real_escape_string($_SERVER['REMOTE_ADDR']) . '\');', $conn);
  1184       $q = $db->sql_query('INSERT INTO ' . $_POST['table_prefix'] . 'logs(log_type,action,time_id,date_string,author,page_text,edit_summary) VALUES(\'security\', \'install_enano\', ' . time() . ', \'' . date('d M Y h:i a') . '\', \'' . mysql_real_escape_string($_POST['admin_user']) . '\', \'' . mysql_real_escape_string(ENANO_VERSION) . '\', \'' . mysql_real_escape_string($_SERVER['REMOTE_ADDR']) . '\');', $conn);
  1185       if ( !$q )
  1185       if ( !$q )
  1186         err('Error setting up logs: '.$db->get_error());
  1186         err('Error setting up logs: '.$db->get_error());
  1187       
  1187       
       
  1188       // This is only in RAM; it's meant to correct a race condition encountered by several testers
       
  1189       $session->acl_merge(array(
       
  1190         'clear_logs' => AUTH_ALLOW
       
  1191         ));
       
  1192       
  1188       if ( !$session->get_permissions('clear_logs') )
  1193       if ( !$session->get_permissions('clear_logs') )
  1189       {
  1194       {
  1190         echo '<br />Error: session manager won\'t permit flushing logs, these is a bug.';
  1195         echo '<p><b>The session manager denied the request to flush logs for the main page.</b><br />
       
  1196                  While under most circumstances you can still <a href="install.php?mode=finish">finish the installation</a>, you should be aware that some servers cannot
       
  1197                  properly set cookies due to limitations with PHP. These limitations are exposed primarily when this issue is encountered during installation. If you choose
       
  1198                  to finish the installation, please be aware that you may be unable to log into your site.</p>';
  1191         break;
  1199         break;
  1192       }
  1200       }
  1193       
  1201       
  1194       // unset($session);
  1202       // unset($session);
  1195       // $session = new sessionManager();
  1203       // $session = new sessionManager();
  1196       // $session->start();
  1204       // $session->start();
  1197       
  1205       
  1198       PageUtils::flushlogs('Main_Page', 'Article');
  1206       PageUtils::flushlogs('Main_Page', 'Article');
       
  1207       
       
  1208       echo 'done!<br />Renaming config.new.php and .htaccess.new...';
       
  1209       if ( !@rename('./config.new.php', './config.php') )
       
  1210         err('failed!<p>Please rename config.new.php manually to config.php. If you selected Tiny URLs, please also rename .htaccess.new to .htaccess.');
       
  1211       
       
  1212       if ( $_POST['urlscheme'] == 'tiny' )
       
  1213       {
       
  1214         if ( !@rename('./.htaccess.new', './.htaccess') )
       
  1215           err('failed!<p>Please rename .htaccess.new manually to .htaccess.');
       
  1216       }
  1199       
  1217       
  1200       echo 'done!<h3>Installation of Enano is complete.</h3><p>Review any warnings above, and then <a href="install.php?mode=finish">click here to finish the installation</a>.';
  1218       echo 'done!<h3>Installation of Enano is complete.</h3><p>Review any warnings above, and then <a href="install.php?mode=finish">click here to finish the installation</a>.';
  1201       
  1219       
  1202       // echo '<script type="text/javascript">window.location="'.scriptPath.'/install.php?mode=finish";</script>';
  1220       // echo '<script type="text/javascript">window.location="'.scriptPath.'/install.php?mode=finish";</script>';
  1203       
  1221