install.php
changeset 304 e2cb5f1432c8
parent 280 dc08c70ca550
parent 300 c9e192a059c1
child 326 ab66d6d1f1f4
equal deleted inserted replaced
280:dc08c70ca550 304:e2cb5f1432c8
   336 {
   336 {
   337   static $decrypted_pass = false;
   337   static $decrypted_pass = false;
   338   if ( $act_get )
   338   if ( $act_get )
   339     return $decrypted_pass;
   339     return $decrypted_pass;
   340   
   340   
   341   $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE);
   341   $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
   342   
   342   
   343   if ( !empty($_POST['crypt_data']) )
   343   if ( !empty($_POST['crypt_data']) )
   344   {
   344   {
   345     require('config.new.php');
   345     require('config.new.php');
   346     if ( !isset($cryptkey) )
   346     if ( !isset($cryptkey) )
   366 {
   366 {
   367   static $key = false;
   367   static $key = false;
   368   if ( $act_get )
   368   if ( $act_get )
   369     return $key;
   369     return $key;
   370   
   370   
   371   $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE);
   371   $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
   372   $key = $aes->gen_readymade_key();
   372   $key = $aes->gen_readymade_key();
   373   return true;
   373   return true;
   374 }
   374 }
   375 
   375 
   376 function stg_parse_schema($act_get = false)
   376 function stg_parse_schema($act_get = false)
   379   if ( $act_get )
   379   if ( $act_get )
   380     return $schema;
   380     return $schema;
   381   
   381   
   382   $admin_pass = stg_decrypt_admin_pass(true);
   382   $admin_pass = stg_decrypt_admin_pass(true);
   383   $key = stg_generate_aes_key(true);
   383   $key = stg_generate_aes_key(true);
   384   $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE);
   384   $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
   385   $key = $aes->hextostring($key);
   385   $key = $aes->hextostring($key);
   386   $admin_pass = $aes->encrypt($admin_pass, $key, ENC_HEX);
   386   $admin_pass = $aes->encrypt($admin_pass, $key, ENC_HEX);
   387   
   387   
   388   $cacheonoff = is_writable(ENANO_ROOT.'/cache/') ? '1' : '0';
   388   $cacheonoff = is_writable(ENANO_ROOT.'/cache/') ? '1' : '0';
   389   
   389   
   459   // This means we'll have to update the encrypted password in the database.
   459   // This means we'll have to update the encrypted password in the database.
   460   if ( $already_run )
   460   if ( $already_run )
   461   {
   461   {
   462     $admin_pass = stg_decrypt_admin_pass(true);
   462     $admin_pass = stg_decrypt_admin_pass(true);
   463     $key = stg_generate_aes_key(true);
   463     $key = stg_generate_aes_key(true);
   464     $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE);
   464     $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
   465     $key = $aes->hextostring($key);
   465     $key = $aes->hextostring($key);
   466     $admin_pass = $aes->encrypt($admin_pass, $key, ENC_HEX);
   466     $admin_pass = $aes->encrypt($admin_pass, $key, ENC_HEX);
   467     $admin_user = mysql_real_escape_string($_POST['admin_user']);
   467     $admin_user = mysql_real_escape_string($_POST['admin_user']);
   468     $admin_user = str_replace('_', ' ', $admin_user);
   468     $admin_user = str_replace('_', ' ', $admin_user);
   469     
   469     
   823     switch($topic)
   823     switch($topic)
   824     {
   824     {
   825       case 'admin_embed_php':
   825       case 'admin_embed_php':
   826         $title = $lang->get('pophelp_admin_embed_php_title');
   826         $title = $lang->get('pophelp_admin_embed_php_title');
   827         $content = $lang->get('pophelp_admin_embed_php_body');
   827         $content = $lang->get('pophelp_admin_embed_php_body');
       
   828         break;
       
   829       case 'url_schemes':
       
   830         $title = $lang->get('pophelp_url_schemes_title');
       
   831         $content = $lang->get('pophelp_url_schemes_body');
   828         break;
   832         break;
   829       default:
   833       default:
   830         $title = 'Invalid topic';
   834         $title = 'Invalid topic';
   831         $content = 'Invalid help topic.';
   835         $content = 'Invalid help topic.';
   832         break;
   836         break;
  1019     <h3><?php echo $lang->get('sysreqs_heading'); ?></h3>
  1023     <h3><?php echo $lang->get('sysreqs_heading'); ?></h3>
  1020      <p><?php echo $lang->get('sysreqs_blurb'); ?></p>
  1024      <p><?php echo $lang->get('sysreqs_blurb'); ?></p>
  1021     <table border="0" cellspacing="0" cellpadding="0">
  1025     <table border="0" cellspacing="0" cellpadding="0">
  1022     <?php
  1026     <?php
  1023     run_test('return version_compare(\'4.3.0\', PHP_VERSION, \'<\');', $lang->get('sysreqs_req_php'), $lang->get('sysreqs_req_desc_php') );
  1027     run_test('return version_compare(\'4.3.0\', PHP_VERSION, \'<\');', $lang->get('sysreqs_req_php'), $lang->get('sysreqs_req_desc_php') );
       
  1028     run_test('return version_compare(\'5.2.0\', PHP_VERSION, \'<\');', $lang->get('sysreqs_req_php5'), $lang->get('sysreqs_req_desc_php5'), true);
  1024     run_test('return function_exists(\'mysql_connect\');', $lang->get('sysreqs_req_mysql'), $lang->get('sysreqs_req_desc_mysql') );
  1029     run_test('return function_exists(\'mysql_connect\');', $lang->get('sysreqs_req_mysql'), $lang->get('sysreqs_req_desc_mysql') );
  1025     run_test('return @ini_get(\'file_uploads\');', $lang->get('sysreqs_req_uploads'), $lang->get('sysreqs_req_desc_uploads') );
  1030     run_test('return @ini_get(\'file_uploads\');', $lang->get('sysreqs_req_uploads'), $lang->get('sysreqs_req_desc_uploads') );
  1026     run_test('return is_apache();', $lang->get('sysreqs_req_apache'), $lang->get('sysreqs_req_desc_apache'), true);
  1031     run_test('return is_apache();', $lang->get('sysreqs_req_apache'), $lang->get('sysreqs_req_desc_apache'), true);
  1027     run_test('return is_writable(ENANO_ROOT.\'/config.new.php\');', $lang->get('sysreqs_req_config'), $lang->get('sysreqs_req_desc_config') );
  1032     run_test('return is_writable(ENANO_ROOT.\'/config.new.php\');', $lang->get('sysreqs_req_config'), $lang->get('sysreqs_req_desc_config') );
  1028     run_test('return file_exists(\'/usr/bin/convert\');', $lang->get('sysreqs_req_magick'), $lang->get('sysreqs_req_desc_magick'), true);
  1033     run_test('return file_exists(\'/usr/bin/convert\');', $lang->get('sysreqs_req_magick'), $lang->get('sysreqs_req_desc_magick'), true);
  1522             <?php echo $lang->get('website_field_urlscheme_body'); ?>
  1527             <?php echo $lang->get('website_field_urlscheme_body'); ?>
  1523           </td>
  1528           </td>
  1524           <td colspan="2">
  1529           <td colspan="2">
  1525             <input type="radio" <?php if(!is_apache()) echo 'checked="checked" '; ?>name="urlscheme" value="ugly" id="ugly"  />  <label for="ugly"><?php echo $lang->get('website_field_urlscheme_ugly'); ?></label><br />
  1530             <input type="radio" <?php if(!is_apache()) echo 'checked="checked" '; ?>name="urlscheme" value="ugly" id="ugly"  />  <label for="ugly"><?php echo $lang->get('website_field_urlscheme_ugly'); ?></label><br />
  1526             <input type="radio" <?php if(is_apache()) echo 'checked="checked" '; ?>name="urlscheme" value="short" id="short" />  <label for="short"><?php echo $lang->get('website_field_urlscheme_short'); ?></label><br />
  1531             <input type="radio" <?php if(is_apache()) echo 'checked="checked" '; ?>name="urlscheme" value="short" id="short" />  <label for="short"><?php echo $lang->get('website_field_urlscheme_short'); ?></label><br />
  1527             <input type="radio" name="urlscheme" value="tiny" id="petite">  <label for="petite"><?php echo $lang->get('website_field_urlscheme_tiny'); ?></label>
  1532             <input type="radio" name="urlscheme" value="tiny" id="petite">  <label for="petite"><?php echo $lang->get('website_field_urlscheme_tiny'); ?></label><br />
       
  1533             <small><a href="install.php?mode=pophelp&amp;topic=url_schemes" onclick="window.open(this.href, 'pophelpwin', 'width=550,height=400,status=no,toolbars=no,toolbar=no,address=no,scroll=yes'); return false;"><?php echo $lang->get('website_field_urlscheme_helplink'); ?></a></small>
  1528           </td>
  1534           </td>
  1529         </tr>
  1535         </tr>
  1530       </table>
  1536       </table>
  1531       <div class="pagenav">
  1537       <div class="pagenav">
  1532        <table border="0">
  1538        <table border="0">
  1552       $template->footer();
  1558       $template->footer();
  1553       exit;
  1559       exit;
  1554     }
  1560     }
  1555     unset($_POST['_cont']);
  1561     unset($_POST['_cont']);
  1556     require('config.new.php');
  1562     require('config.new.php');
  1557     $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE);
  1563     $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
  1558     if ( isset($crypto_key) )
  1564     if ( isset($crypto_key) )
  1559     {
  1565     {
  1560       $cryptkey = $crypto_key;
  1566       $cryptkey = $crypto_key;
  1561     }
  1567     }
  1562     if(!isset($cryptkey) || ( isset($cryptkey) && strlen($cryptkey) != AES_BITS / 4) )
  1568     if(!isset($cryptkey) || ( isset($cryptkey) && strlen($cryptkey) != AES_BITS / 4) )
  1577     <script type="text/javascript">
  1583     <script type="text/javascript">
  1578       function verify()
  1584       function verify()
  1579       {
  1585       {
  1580         var frm = document.forms.login;
  1586         var frm = document.forms.login;
  1581         ret = true;
  1587         ret = true;
  1582         if ( frm.admin_user.value.match(/^([A-z0-9 \\-\\.]+)$/) && !frm.admin_user.value.match(/^(?:(?:\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(?:\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$/) && frm.admin_user.value.toLowerCase() != \'anonymous\' )
  1588         if ( frm.admin_user.value.match(/^([^<>&\?\'"%\/]+)$/) && !frm.admin_user.value.match(/^(?:(?:\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(?:\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$/) && frm.admin_user.value.toLowerCase() != \'anonymous\' )
  1583         {
  1589         {
  1584           document.getElementById(\'s_user\').src = \'images/good.gif\';
  1590           document.getElementById(\'s_user\').src = \'images/good.gif\';
  1585         }
  1591         }
  1586         else
  1592         else
  1587         {
  1593         {
  1595         else
  1601         else
  1596         {
  1602         {
  1597           document.getElementById(\'s_password\').src = \'images/bad.gif\';
  1603           document.getElementById(\'s_password\').src = \'images/bad.gif\';
  1598           ret = false;
  1604           ret = false;
  1599         }
  1605         }
  1600         if(frm.admin_email.value.match(/^(?:[\\w\\d]+\\.?)+@(?:(?:[\\w\\d]\\-?)+\\.)+\\w{2,4}$/))
  1606         if(frm.admin_email.value.match(/^(?:[\\w\\d_-]+\\.?)+@(?:(?:[\\w\\d-]\\-?)+\\.)+\\w{2,4}$/))
  1601         {
  1607         {
  1602           document.getElementById(\'s_email\').src = \'images/good.gif\';
  1608           document.getElementById(\'s_email\').src = \'images/good.gif\';
  1603         }
  1609         }
  1604         else
  1610         else
  1605         {
  1611         {