Mercurial > epgrec.yaz
annotate install/step3.php @ 105:29e7a40e6587
operator == will fail on ubuntu where dash has been used as the sh equivalent.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Tue, 09 Mar 2010 05:42:26 +0900 |
parents | 69e0dabc765a |
children | f854f6606fa5 |
rev | line source |
---|---|
32
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
1 <?php |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
2 include_once("../config.php"); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
3 include_once("../Smarty/Smarty.class.php"); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
4 include_once("../DBRecord.class.php"); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
5 include_once("../Settings.class.php"); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
6 include_once("../reclib.php" ); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
7 |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
8 $settings = Settings::factory(); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
9 $settings->post(); // いったん保存する |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
10 $settings->save(); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
11 |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
12 // データベース接続チェック |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
13 $dbh = @mysql_connect( $settings->db_host, $settings->db_user, $settings->db_pass ); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
14 if( $dbh == false ) { |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
15 jdialog( "MySQLに接続できません。ホスト名/ユーザー名/パスワードを再チェックしてください", "step2.php" ); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
16 exit(); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
17 } |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
18 |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
19 $sqlstr = "use ".$settings->db_name; |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
20 $res = @mysql_query( $sqlstr ); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
21 if( $res == false ) { |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
22 jdialog( "データベース名が異なるようです", "step2.php" ); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
23 exit(); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
24 } |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
25 |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
26 // DBテーブルの作成 |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
27 |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
28 try { |
45 | 29 $rec = new DBRecord( RESERVE_TBL ); |
32
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
30 $rec->createTable( RESERVE_STRUCT ); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
31 |
45 | 32 $rec = new DBRecord( PROGRAM_TBL ); |
32
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
33 $rec->createTable( PROGRAM_STRUCT ); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
34 |
45 | 35 $rec = new DBRecord( CHANNEL_TBL ); |
32
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
36 $rec->createTable( CHANNEL_STRUCT ); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
37 |
45 | 38 $rec = new DBRecord( CATEGORY_TBL ); |
32
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
39 $rec->createTable( CATEGORY_STRUCT ); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
40 |
45 | 41 $rec = new DBRecord( KEYWORD_TBL ); |
32
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
42 $rec->createTable( KEYWORD_STRUCT ); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
43 } |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
44 catch( Exception $e ) { |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
45 jdialog("テーブルの作成に失敗しました。データベースに権限がない等の理由が考えられます。", "step2.php" ); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
46 exit(); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
47 } |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
48 |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
49 $smarty = new Smarty(); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
50 $smarty->template_dir = "../templates/"; |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
51 $smarty->compile_dir = "../templates_c/"; |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
52 $smarty->cache_dir = "../cache/"; |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
53 |
76
69e0dabc765a
fixed: Reservation.class.php
Sushi-k <epgrec@park.mda.or.jp>
parents:
45
diff
changeset
|
54 $smarty->assign( "record_mode", $RECORD_MODE ); |
32
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
55 $smarty->assign( "settings", $settings ); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
56 $smarty->assign( "install_path", INSTALL_PATH ); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
57 $smarty->assign( "post_to", "step4.php" ); |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
58 $smarty->assign( "sitetitle", "インストールステップ3" ); |
40 | 59 $smarty->assign( "message" , "環境設定を行います。これらの設定はデフォルトのままでも制限付きながら動作します。" ); |
32
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
60 |
01a8fdc0cebb
testing: Web base setting page.
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff
changeset
|
61 $smarty->display("envSetting.html"); |
45 | 62 ?> |