".mysql_error()); $dbconnexion = mysql_select_db($base, $connexion); $got_options = false; $got_types = false; ?> b2 > Installation

Checking for tables...

\n"; } if (!$got_types) { echo "

Can't find table '$tableextraoptiontypes', gonna create it...

\n"; $sql = "CREATE TABLE $tableextraoptiontypes ( " . " option_id int(11) NOT NULL auto_increment, " . " option_name tinytext NOT NULL, ". " PRIMARY KEY (option_id) ". ") "; $result = mysql_query($sql) or print ("Can't create the table '$tableextraoptiontypes' in the database.
" . $sql . "
" . mysql_error()); if ($result != false) { echo "

Table '$tableextraoptiontypes' created OK

\n"; $got_types = true; } } else { echo "

Found table '$tableextraoptiontypes', don't need to create it...

\n"; } if (!$got_options) { echo "

Can't find '$tableextraoptions', gonna create it...

\n"; $sql = "CREATE TABLE $tableextraoptions ( " . " option_id int(11) NOT NULL auto_increment, " . " option_name varchar(64) UNIQUE NOT NULL default '', " . " option_type int(11) NOT NULL default 1, " . " option_value varchar(255) NOT NULL default '', " . " option_description varchar(255) NOT NULL default '', " . " option_level int NOT NULL DEFAULT '1', " . " PRIMARY KEY (option_id) " . ") "; $result = mysql_query($sql) or print ("Can't create the table '$tableextraoptions' in the database.
" . $sql . "
" . mysql_error()); if ($result != false) { echo "

Table '$tableextraoptions' created OK

\n"; $got_options = true; } } else { echo "

Found table '$tableextraoptions', don't need to create it...

\n"; } if ($got_options && $got_types) { $got_1 = false; $got_2 = false; $got_3 = false; $got_4 = false; echo "

Looking for types...

\n"; $sql = "SELECT option_id, option_name FROM $tableextraoptiontypes "; $result = mysql_query($sql) or print ("Can't query '$tableextraoptiontypes'.
" . $sql . "
" . mysql_error()); if ($result != false) { while ($row = mysql_fetch_object($result)) { if ($row->{'option_id'} == 1) { echo "

You have got type 1. Good!

\n"; $got_1 = true; } if ($row->{'option_id'} == 2) { echo "

You have got type 2. Good!

\n"; $got_2 = true; } if ($row->{'option_id'} == 3) { echo "

You have got type 3. Good!

\n"; $got_3 = true; } if ($row->{'option_id'} == 4) { echo "

You have got type 4. Good!

\n"; $got_4 = true; } } if (!$got_1) { echo "

Gonna insert type 1...

\n"; $sql = "INSERT INTO $tableextraoptiontypes (option_id, option_name) VALUES (1, 'int')"; $result = mysql_query($sql) or print ("Can't insert type.
" . $sql . "
" . mysql_error()); if ($result != false) { echo "

Inserted type Ok

\n"; $got_1 = true; } } if (!$got_2) { echo "

Gonna insert type 2...

\n"; $sql = "INSERT INTO $tableextraoptiontypes (option_id, option_name) VALUES (2, 'boolean')"; $result = mysql_query($sql) or print ("Can't insert type.
" . $sql . "
" . mysql_error()); if ($result != false) { echo "

Inserted type Ok

\n"; $got_2 = true; } } if (!$got_3) { echo "

Gonna insert type 3...

\n"; $sql = "INSERT INTO $tableextraoptiontypes (option_id, option_name) VALUES (3, 'string')"; $result = mysql_query($sql) or print ("Can't insert type.
" . $sql . "
" . mysql_error()); if ($result != false) { echo "

Inserted type Ok

\n"; $got_3 = true; } } if (!$got_4) { echo "

Gonna insert type 4...

\n"; $sql = "INSERT INTO $tableextraoptiontypes (option_id, option_name) VALUES (4, 'date')"; $result = mysql_query($sql) or print ("Can't insert type.
" . $sql . "
" . mysql_error()); if ($result != false) { echo "

Inserted type Ok

\n"; $got_4 = true; } } } else { echo ("No results from query '$tableextraoptiontypes'.
" . $sql . "
" . mysql_error()); } $got_option_1 = false; $got_option_2 = false; echo "

Looking for extra options...

\n"; $sql = "SELECT option_name FROM $tableextraoptions "; $result = mysql_query($sql) or print ("Can't query '$tableextraoptions'.
" . $sql . "
" . mysql_error()); if ($result != false) { while ($row = mysql_fetch_object($result)) { if ($row->{'option_name'} == 'add_options_min_level') { echo "

You have got 'add_options_min_level'. Good!

\n"; $got_option_1 = true; } if ($row->{'option_name'} == 'blog_closed') { echo "

You have got 'blog_closed'. Good!

\n"; $got_option_2 = true; } } if (!$got_option_1) { echo "

Gonna insert extra option 1...

\n"; $sql = "INSERT INTO $tableextraoptions " . " (option_id, option_name, option_type, option_value, option_description, option_level) " . " VALUES (1,'add_options_min_level', 1, '10','The minimum user level to add/edit extra options.', 10)"; $result = mysql_query($sql) or print ("Can't query extra option.
" . $sql . "
" . mysql_error()); if ($result != false) { echo "

Inserted extra option Ok

\n"; $got_option_1 = true; } } if (!$got_option_2) { echo "

Gonna insert extra option 2...

\n"; $sql = "INSERT INTO $tableextraoptions " . " (option_id, option_name, option_type, option_value, option_description, option_level) " . " VALUES (2,'blog_closed', 2, 'false','Set this to true to temporarily close the blog.', 5)"; $result = mysql_query($sql) or print ("Can't query extra option.
" . $sql . "
" . mysql_error()); if ($result != false) { echo "

Inserted extra option Ok

\n"; $got_option_2 = true; } } } } if ($got_1 && $got_2 && $got_3 && $got_4 && $got_option_1 && $got_option_2) { echo "

All done.

\n"; } ?>