install.php
changeset 32 4d87aad3c4c0
parent 27 dd659f6ba891
child 33 143d3ee32f3c
equal deleted inserted replaced
31:dc8741857bde 32:4d87aad3c4c0
  1126       $cf_handle = fopen(ENANO_ROOT.'/config.php', 'w');
  1126       $cf_handle = fopen(ENANO_ROOT.'/config.php', 'w');
  1127       if(!$cf_handle) err('Couldn\'t open file config.php for writing');
  1127       if(!$cf_handle) err('Couldn\'t open file config.php for writing');
  1128       fwrite($cf_handle, $config_file);
  1128       fwrite($cf_handle, $config_file);
  1129       fclose($cf_handle);
  1129       fclose($cf_handle);
  1130       
  1130       
       
  1131       echo 'done!<br />Starting the Enano API...';
       
  1132       
       
  1133       $template_bak = $template;
       
  1134       
       
  1135       // Get Enano loaded
       
  1136       $_GET['title'] = 'Main_Page';
       
  1137       require('includes/common.php');
       
  1138       
       
  1139       // We need to be logged in (with admin rights) before logs can be flushed
       
  1140       $session->login_without_crypto($_POST['admin_user'], $dec, false);
       
  1141       
       
  1142       // Now that login cookies are set, initialize the session manager and ACLs
       
  1143       $session->start();
       
  1144       $paths->init();
       
  1145       
       
  1146       unset($template);
       
  1147       $template =& $template_bak;
       
  1148       
  1131       echo 'done!<br />Initializing logs...';
  1149       echo 'done!<br />Initializing logs...';
  1132       
  1150       
  1133       $q = mysql_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);
  1151       $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);
  1134       if ( !$q )
  1152       if ( !$q )
  1135         err('Error setting up logs: '.mysql_error());
  1153         err('Error setting up logs: '.$db->get_error());
  1136       
  1154       
  1137       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>.';
  1155       if ( !$session->get_permissions('clear_logs') )
       
  1156       {
       
  1157         echo '<br />Error: session manager won\'t permit flushing logs, these is a bug.';
       
  1158         break;
       
  1159       }
       
  1160       
       
  1161       // unset($session);
       
  1162       // $session = new sessionManager();
       
  1163       // $session->start();
       
  1164       
       
  1165       PageUtils::flushlogs('Main_Page', 'Article');
       
  1166       
       
  1167       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>.';
  1138       
  1168       
  1139       // echo '<script type="text/javascript">window.location="'.scriptPath.'/install.php?mode=finish";</script>';
  1169       // echo '<script type="text/javascript">window.location="'.scriptPath.'/install.php?mode=finish";</script>';
  1140       
  1170       
  1141     break;
  1171     break;
  1142   case "finish":
  1172   case "finish":