Exemplo n.º 1
0
         $row = $forum_db->fetch_assoc($result);
         if (!$row || !isset($row['Value']) || strtolower($row['Value']) != 'yes') {
             error($lang_install['MySQL InnoDB Not Supported']);
         }
     }
 }
 // Validate prefix
 if (strlen($db_prefix) > 0 && (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $db_prefix) || strlen($db_prefix) > 40)) {
     error(sprintf($lang_install['Invalid table prefix'], $db_prefix));
 }
 // Check SQLite prefix collision
 if (in_array($db_type, array('sqlite', 'sqlite3')) && strtolower($db_prefix) == 'sqlite_') {
     error($lang_install['SQLite prefix collision']);
 }
 // Make sure PunBB isn't already installed
 if ($forum_db->table_exists('users')) {
     $query = array('SELECT' => 'COUNT(id)', 'FROM' => 'users', 'WHERE' => 'id=1');
     $result = $forum_db->query_build($query);
     if ($forum_db->result($result) > 0) {
         error(sprintf($lang_install['PunBB already installed'], $db_prefix, $db_name));
     }
 }
 // Start a transaction
 $forum_db->start_transaction();
 // Create all tables
 $schema = array('FIELDS' => array('id' => array('datatype' => 'SERIAL', 'allow_null' => false), 'username' => array('datatype' => 'VARCHAR(200)', 'allow_null' => true), 'ip' => array('datatype' => 'VARCHAR(255)', 'allow_null' => true), 'email' => array('datatype' => 'VARCHAR(80)', 'allow_null' => true), 'message' => array('datatype' => 'VARCHAR(255)', 'allow_null' => true), 'expire' => array('datatype' => 'INT(10) UNSIGNED', 'allow_null' => true), 'ban_creator' => array('datatype' => 'INT(10) UNSIGNED', 'allow_null' => false, 'default' => '0')), 'PRIMARY KEY' => array('id'));
 $forum_db->create_table('bans', $schema);
 $schema = array('FIELDS' => array('id' => array('datatype' => 'SERIAL', 'allow_null' => false), 'cat_name' => array('datatype' => 'VARCHAR(80)', 'allow_null' => false, 'default' => '\'New Category\''), 'disp_position' => array('datatype' => 'INT(10)', 'allow_null' => false, 'default' => '0')), 'PRIMARY KEY' => array('id'));
 $forum_db->create_table('categories', $schema);
 $schema = array('FIELDS' => array('id' => array('datatype' => 'SERIAL', 'allow_null' => false), 'search_for' => array('datatype' => 'VARCHAR(60)', 'allow_null' => false, 'default' => '\'\''), 'replace_with' => array('datatype' => 'VARCHAR(60)', 'allow_null' => false, 'default' => '\'\'')), 'PRIMARY KEY' => array('id'));
 $forum_db->create_table('censoring', $schema);