install.php
changeset 27 dd659f6ba891
parent 21 663fcf528726
child 32 4d87aad3c4c0
equal deleted inserted replaced
26:acf6f55bf023 27:dd659f6ba891
  1042       $schema = str_replace('{{VERSION}}',      ENANO_VERSION,                                   $schema);
  1042       $schema = str_replace('{{VERSION}}',      ENANO_VERSION,                                   $schema);
  1043       $schema = str_replace('{{ADMIN_EMBED_PHP}}', $_POST['admin_embed_php'],                    $schema);
  1043       $schema = str_replace('{{ADMIN_EMBED_PHP}}', $_POST['admin_embed_php'],                    $schema);
  1044       // Not anymore!! :-D
  1044       // Not anymore!! :-D
  1045       // $schema = str_replace('{{BETA_VERSION}}', ENANO_BETA_VERSION,                              $schema);
  1045       // $schema = str_replace('{{BETA_VERSION}}', ENANO_BETA_VERSION,                              $schema);
  1046       
  1046       
  1047       if(isset($_POST['wiki_mode'])) $schema = str_replace('{{WIKI_MODE}}', '1', $schema);
  1047       if(isset($_POST['wiki_mode']))
  1048       else $schema = str_replace('{{WIKI_MODE}}', '0', $schema);
  1048       {
       
  1049         $schema = str_replace('{{WIKI_MODE}}', '1', $schema);
       
  1050       }
       
  1051       else
       
  1052       {
       
  1053         $schema = str_replace('{{WIKI_MODE}}', '0', $schema);
       
  1054       }
  1049       
  1055       
  1050       // Build an array of queries      
  1056       // Build an array of queries      
       
  1057       $schema = explode("\n", $schema);
       
  1058       
       
  1059       foreach ( $schema as $i => $sql )
       
  1060       {
       
  1061         $query =& $schema[$i];
       
  1062         $t = trim($query);
       
  1063         if ( empty($t) || preg_match('/^(\#|--)/i', $t) )
       
  1064         {
       
  1065           unset($schema[$i]);
       
  1066           unset($query);
       
  1067         }
       
  1068       }
       
  1069       
       
  1070       $schema = array_values($schema);
       
  1071       $schema = implode("\n", $schema);
  1051       $schema = explode(";\n", $schema);
  1072       $schema = explode(";\n", $schema);
       
  1073       
       
  1074       foreach ( $schema as $i => $sql )
       
  1075       {
       
  1076         $query =& $schema[$i];
       
  1077         if ( substr($query, ( strlen($query) - 1 ), 1 ) != ';' )
       
  1078         {
       
  1079           $query .= ';';
       
  1080         }
       
  1081       }
       
  1082       
       
  1083       // echo '<pre>' . htmlspecialchars(print_r($schema, true)) . '</pre>';
       
  1084       // break;
       
  1085       
  1052       echo 'done!<br />Executing schema.sql...';
  1086       echo 'done!<br />Executing schema.sql...';
  1053       
  1087       
  1054       // OK, do the loop, baby!!!
  1088       // OK, do the loop, baby!!!
  1055       foreach($schema as $q)
  1089       foreach($schema as $q)
  1056       {
  1090       {