diff install/step3.php @ 32:01a8fdc0cebb

testing: Web base setting page.
author Sushi-k <epgrec@park.mda.or.jp>
date Mon, 27 Jul 2009 18:48:51 +0900
parents
children a935b4789aff
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/install/step3.php	Mon Jul 27 18:48:51 2009 +0900
@@ -0,0 +1,60 @@
+<?php
+include_once("../config.php");
+include_once("../Smarty/Smarty.class.php");
+include_once("../DBRecord.class.php");
+include_once("../Settings.class.php");
+include_once("../reclib.php" );
+
+$settings = Settings::factory();
+$settings->post();	// いったん保存する
+$settings->save();
+
+// データベース接続チェック
+$dbh = @mysql_connect( $settings->db_host, $settings->db_user, $settings->db_pass );
+if( $dbh == false ) {
+	jdialog( "MySQLに接続できません。ホスト名/ユーザー名/パスワードを再チェックしてください", "step2.php" );
+	exit();
+}
+
+$sqlstr = "use ".$settings->db_name;
+$res = @mysql_query( $sqlstr );
+if( $res == false ) {
+	jdialog( "データベース名が異なるようです", "step2.php" );
+	exit();
+}
+
+// DBテーブルの作成
+
+try {
+    $rec = new DBRecord( $settings->tbl_prefix . RESERVE_TBL );
+    $rec->createTable( RESERVE_STRUCT );
+
+    $rec = new DBRecord( $settings->tbl_prefix . PROGRAM_TBL );
+    $rec->createTable( PROGRAM_STRUCT );
+
+    $rec = new DBRecord( $settings->tbl_prefix . CHANNEL_TBL );
+    $rec->createTable( CHANNEL_STRUCT );
+
+    $rec = new DBRecord( $settings->tbl_prefix . CATEGORY_TBL );
+    $rec->createTable( CATEGORY_STRUCT );
+    
+    $rec = new DBRecord( $settings->tbl_prefix . KEYWORD_TBL );
+    $rec->createTable( KEYWORD_STRUCT );
+}
+catch( Exception $e ) {
+	jdialog("テーブルの作成に失敗しました。データベースに権限がない等の理由が考えられます。", "step2.php" );
+	exit();
+}
+
+$smarty = new Smarty();
+$smarty->template_dir = "../templates/";
+$smarty->compile_dir = "../templates_c/";
+$smarty->cache_dir = "../cache/";
+
+$smarty->assign( "settings", $settings );
+$smarty->assign( "install_path", INSTALL_PATH );
+$smarty->assign( "post_to", "step4.php" );
+$smarty->assign( "sitetitle", "インストールステップ3" );
+
+$smarty->display("envSetting.html");
+?>
\ No newline at end of file