Example #1
0
/**
 * This file is part of taolin project (http://taolin.fbk.eu)
 * Copyright (C) 2008, 2009 FBK Foundation, (http://www.fbk.eu)
 * Authors: SoNet Group (see AUTHORS.txt)
 *
 * Taolin is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation version 3 of the License.
 *
 * Taolin is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Taolin. If not, see <http://www.gnu.org/licenses/>.
 *
 */

function second_step_main(){

  $sql_scripts_path = "../../install/";
  
  $sql_scripts = array(
      "taolin.struct.sql"
      ,"taolin.struct.post.sql"
      ,"taolin.history.sql"
      ,"taolin.configs.sql"
      ,"taolin.data.sql"
    );
    
  ?>
    <h2 class="title">Step 2: Creating database structure</h2>
    <div class='inner'>
  <?

  $db_config = $_POST['db'];

  // if the user chose to import demo data, process that file as well
  if(isset($_POST['import_demo_data']))
    $sql_scripts[] = "taolin.data.demo.sql";

  $db = database_connection($db_config['host'], $db_config['database'], $db_config['port'], $db_config['login'], $db_config['password']);
  
  if($db){

    echo "<p>Processing SQL scripts in order to create database structure. Once finished, click on the link placed at the bottom of the page in order to go to the next step.</p>";

    echo "<div style='height:400px;overflow-y:auto;border: 1px solid; background: lightGray;'>";

    foreach($sql_scripts as $sql_script){
      echo "<h3>Processing file $sql_script</h3>";
      execute_sql_script($db, $sql_scripts_path.$sql_script);
    }
    echo "</div>";
    notice_message("<b>Database structure created</b>", "notice");

    ?>
        <hr />
        <div id='second-step-bottom'>
          <div class='inner'>
            <form method="POST" class="form" action="install.php?step=2" >
              <div class="group navform" style="padding-top:20px">
                <input type="submit" class="button" value="Next step" />  
              </div>
            </form>
          </div>
        </div>
      </div> 
    <?
  }
  else {
      notice_message("<b>ERROR! Can not connect to the database <i>$dbname</i> on host <i>$host</i></b>", "error");
        
      echo '<h4><b>Uops! Unfortunately something went wrong and connection failed! What can you do now?</b></h4><ul style="padding-left:20px;"><li><a href="install.php">Go back to step 1</a> and re-configure your database properly</li><li>If this error persists, check your database (users, grants..) or submit an issue to Taolin on github.</li></ul></div>';
  }

}
Example #2
0
function step_switcher($step){

  switch($step){
    case 0:
      first_step_main();break;
    case 1:
      second_step_main();break;
    case 2:
      third_step_main();break;
    case 3:
      fourth_step_main();break;
    default:
      notice_message("<b>ERROR! Follow the right path! Please start from <a href='install.php'>the first step</a> of this wizard</b>", "error");
      die();
  }

}
function save_file($dir, $newName, $textarea)
{
    if (!$newName) {
        notice_message("Не указано имя файла");
        return false;
    }
    $dirW = iconv('UTF-8', 'CP1251', $dir);
    $fileNameW = iconv('UTF-8', 'CP1251', $newName);
    if ((bool) ($fp = fopen("{$dirW}/{$fileNameW}", "wb"))) {
        $filecontent = htmlspecialchars_decode($textarea);
        fwrite($fp, $filecontent);
        fclose($fp);
    } else {
        notice_message("Невозможно сохранить файл {$newName}");
        return false;
    }
    return $newName;
}
Example #4
0
      <h1><a href="/">コミュニケーション・ベース</a></h1>
<? include 'menu.php' ?>
      <div class="eye_catch">
        <h2>お問い合わせ</h2>
      </div>
<div class="bread_crambs">
<ol>
<li><a href="/">トップページ</a></li>
<li>お問い合わせ</li>
</ol>
</div>
    </div>
    <div id="wrapper">
      <div id="main">
        <?php 
echo notice_message();
?>
 
        <?php 
echo error_messages();
?>
 
        <form action="inquiry.php" method="post">
<div class="section">
         <h3>お問い合わせフォーム</h3>
        <p class="float_right"><img src="/images/inquiry.jpg" width="200px" height="210px" /></p>
         <p>
            <label>メールアドレス</label><br />
            <?php 
echo text_field('email');
?>
Example #5
0
function print_database_config($fileName)
{
    $lines = file($fileName);
    notice_message("File <i>config/database.php</i> already exists. Please delete it before proceeding with this wizard", 'warning');
    ?>
    <div class="inner">
      <h3>Warning!</h3>
      <p>Database configuration file <i>config/database.php</i> found. Is taolin already installed in this location? Proceeding with the installation will delete an existant database losing all the data contained.</p><br />
      <h3>Proceeding with Taolin installation</h3>
      <p>Before proceeding with the installation process you should delete the database configuration file since it would be regenerated with the configuration settings entered. Then you can continue with this wizard.</p>
      <form method="POST" class="form" action="install.php" >
        <div class="group navform" style="padding-top:20px">
          <input type="submit" class="button" value="Go to step 1 >>" />  
        </div>
      </form>
    </div>
  <?php 
}
function save_output($outputVal, $outputPath = 'tmp_output.txt')
{
    if (!is_array($outputVal)) {
        notice_message("outputVal не является массивом");
        return false;
    }
    $outputPathW = iconv('UTF-8', 'CP1251', $outputPath);
    if (!($fp = fopen($outputPathW, 'wb'))) {
        notice_message("Невозможно сохранить файл {$outputPath}");
        return false;
    }
    foreach ($outputVal as $key => $val) {
        if (is_array($val)) {
            $val = implode(' ', $val);
        }
        fwrite($fp, $val . "\n");
    }
    fclose($fp);
    return $outputVal;
}