Changeset 1585
- Timestamp:
- 04/05/08 20:24:35 (5 months ago)
- Files:
-
- branches/punbb-1.3-dev/upload/install.php (modified) (9 diffs)
- branches/punbb-1.3-dev/upload/lang/English/install.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/punbb-1.3-dev/upload/install.php
r1576 r1585 92 92 93 93 if (empty($db_extensions)) 94 error( 'This PHP environment does not have support for any of the databases that PunBB supports. PHP needs to have support for either MySQL, PostgreSQL or SQLite in order for PunBB to be installed.');94 error($lang_install['No database support']); 95 95 96 96 // Make an educated guess regarding base_url … … 339 339 // Validate form 340 340 if (pun_strlen($db_name) == 0) 341 error( 'You must enter a database name. Please go back and correct.');341 error($lang_install['Missing database name']); 342 342 if (pun_strlen($username) < 2) 343 error('Usernames must be at least 2 characters long. Please go back and correct.'); 343 error($lang_install['Username too short']); 344 if (pun_strlen($username) > 25) 345 error($lang_install['Username too long']); 344 346 if (pun_strlen($password1) < 4) 345 error( 'Passwords must be at least 4 characters long. Please go back and correct.');347 error($lang_install['Pass too short']); 346 348 if ($password1 != $password2) 347 error( 'Passwords do not match. Please go back and correct.');349 error($lang_install['Pass not match']); 348 350 if (strtolower($username) == 'guest') 349 error( 'The username guest is reserved. Please go back and correct.');351 error($lang_install['Username guest']); 350 352 if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username)) 351 error('Usernames may not be in the form of an IP address. Please go back and correct.'); 353 error($lang_install['Username IP']); 354 if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) 355 error($lang_install['Username reserved chars']); 352 356 if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username)) 353 error( 'Usernames may not contain any of the text formatting tags (BBCode) that the forum uses. Please go back and correct.');357 error($lang_install['Username BBCode']); 354 358 355 359 // Validate email 356 360 if (strlen($email) > 80 || !preg_match('/^(([^<>()[\]\\.,;:\s@"\']+(\.[^<>()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email)) 357 error( 'The administrator e-mail address you entered is invalid. Please go back and correct.');361 error($lang_install['Invalid email']); 358 362 359 363 // Make sure board title and description aren't left blank … … 364 368 365 369 if (pun_strlen($base_url) == 0) 366 error( 'You must enter a base URL. Please go back and correct.');370 error($lang_install['Missing base url']); 367 371 368 372 … … 387 391 388 392 default: 389 error( '\''.$db_type.'\' is not a valid database type.');393 error(sprintf($lang_install['No such database type'], $db_type)); 390 394 } 391 395 … … 400 404 $mysql_version = $db->result($result); 401 405 if (version_compare($mysql_version, MIN_MYSQL_VERSION, '<')) 402 error( 'You are running MySQL version '.$mysql_version.'. PunBB requires at least MySQL '.MIN_MYSQL_VERSION.' to run properly. You must upgrade your MySQL installation before you can continue.');406 error(sprintf($lang_install['Invalid MySQL version'], $mysql_version, MIN_MYSQL_VERSION)); 403 407 } 404 408 405 409 // Validate prefix 406 410 if (strlen($db_prefix) > 0 && (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $db_prefix) || strlen($db_prefix) > 40)) 407 error( 'The table prefix \''.$db_prefix.'\' contains illegal characters or is too long. The prefix may contain the letters a to z, any numbers and the underscore character. They must however not start with a number. The maximum length is 40 characters. Please choose a different prefix.');411 error(sprintf($lang_install['Invalid table prefix'], $db_prefix)); 408 412 409 413 // Check SQLite prefix collision 410 414 if ($db_type == 'sqlite' && strtolower($db_prefix) == 'sqlite_') 411 error( 'The table prefix \'sqlite_\' is reserved for use by the SQLite engine. Please choose a different prefix.');415 error($lang_install['SQLite prefix collision']); 412 416 413 417 … … 415 419 $result = $db->query('SELECT 1 FROM '.$db_prefix.'users WHERE id=1'); 416 420 if ($db->num_rows($result)) 417 error( 'A table called "'.$db_prefix.'users" is already present in the database "'.$db_name.'". This could mean that PunBB is already installed or that another piece of software is installed and is occupying one or more of the table names PunBB requires. If you want to install multiple copies of PunBB in the same database, you must choose a different table prefix.');421 error(sprintf($lang_install['PunBB already installed'], $db_prefix, $db_name)); 418 422 419 423 … … 1503 1507 'o_regs_verify' => "'0'", 1504 1508 'o_announcement' => "'0'", 1505 'o_announcement_heading' => "' Sample announcement'",1506 'o_announcement_message' => "' <p>Enter your announcement here.</p>'",1509 'o_announcement_heading' => "'".$lang_install['Default announce heading']."'", 1510 'o_announcement_message' => "'".$lang_install['Default announce message']."'", 1507 1511 'o_rules' => "'0'", 1508 'o_rules_message' => "' Enter your rules here.'",1512 'o_rules_message' => "'".$lang_install['Default rules']."'", 1509 1513 'o_maintenance' => "'0'", 1510 'o_maintenance_message' => "' The forums are temporarily down for maintenance. Please try again in a few minutes.<br />\\n<br />\\n/Administrator'",1514 'o_maintenance_message' => "'".$lang_install['Default maint message']."'", 1511 1515 'p_message_bbcode' => "'1'", 1512 1516 'p_message_img_tag' => "'1'", … … 1527 1531 1528 1532 // Insert some other default data 1529 $db->query('INSERT INTO '.$db_prefix."categories (cat_name, disp_position) VALUES('Test category', 1)") or error(__FILE__, __LINE__); 1530 1531 $db->query('INSERT INTO '.$db_prefix."forums (forum_name, forum_desc, num_topics, num_posts, last_post, last_post_id, last_poster, disp_position, cat_id) VALUES('Test forum', 'This is just a test forum', 1, 1, ".$now.", 1, '".$db->escape($username)."', 1, 1)") or error(__FILE__, __LINE__); 1532 1533 $subject = 'Test post'; 1534 $db->query('INSERT INTO '.$db_prefix.'topics (poster, subject, posted, first_post_id, last_post, last_post_id, last_poster, forum_id) VALUES(\''.$db->escape($username).'\', \''.$subject.'\', '.$now.', 1, '.$now.', 1, \''.$db->escape($username).'\', 1)') or error(__FILE__, __LINE__); 1535 1536 $message = 'If you are looking at this (which I guess you are), the install of PunBB appears to have worked! Now log in and head over to the administration control panel to configure your forum.'; 1537 $db->query('INSERT INTO '.$db_prefix.'posts (poster, poster_id, poster_ip, message, posted, topic_id) VALUES(\''.$db->escape($username).'\', 2, \'127.0.0.1\', \''.$message.'\', '.$now.', 1)') or error(__FILE__, __LINE__); 1533 $db->query('INSERT INTO '.$db_prefix."categories (cat_name, disp_position) VALUES('".$lang_install['Default category name']."', 1)") or error(__FILE__, __LINE__); 1534 1535 $db->query('INSERT INTO '.$db_prefix."forums (forum_name, forum_desc, num_topics, num_posts, last_post, last_post_id, last_poster, disp_position, cat_id) VALUES('".$lang_install['Default forum name']."', '".$lang_install['Default forum descrip']."', 1, 1, ".$now.", 1, '".$db->escape($username)."', 1, 1)") or error(__FILE__, __LINE__); 1536 1537 $db->query('INSERT INTO '.$db_prefix.'topics (poster, subject, posted, first_post_id, last_post, last_post_id, last_poster, forum_id) VALUES(\''.$db->escape($username).'\', \''.$lang_install['Default topic subject'].'\', '.$now.', 1, '.$now.', 1, \''.$db->escape($username).'\', 1)') or error(__FILE__, __LINE__); 1538 1539 $db->query('INSERT INTO '.$db_prefix.'posts (poster, poster_id, poster_ip, message, posted, topic_id) VALUES(\''.$db->escape($username).'\', 2, \'127.0.0.1\', \''.$lang_install['Default post contents'].'\', '.$now.', 1)') or error(__FILE__, __LINE__); 1538 1540 1539 1541 // Add new post to search table … … 1544 1546 } 1545 1547 1546 $db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES(' New member', 0)") or error(__FILE__, __LINE__);1547 $db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES(' Member', 10)") or error(__FILE__, __LINE__);1548 $db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES('".$lang_install['Default rank 1']."', 0)") or error(__FILE__, __LINE__); 1549 $db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES('".$lang_install['Default rank 2']."', 10)") or error(__FILE__, __LINE__); 1548 1550 1549 1551 branches/punbb-1.3-dev/upload/lang/English/install.php
r1489 r1585 61 61 'Start install' => 'Start install', // Label for submit button 62 62 63 // Install errors 64 'No database support' => 'This PHP environment does not have support for any of the databases that PunBB supports. PHP needs to have support for either MySQL, PostgreSQL or SQLite in order for PunBB to be installed.', 65 'Missing database name' => 'You must enter a database name. Please go back and correct.', 66 'Username too long' => 'Usernames must be no more than 25 characters long. Please go back and correct.', 67 'Username too short' => 'Usernames must be at least 2 characters long. Please go back and correct.', 68 'Pass too short' => 'Passwords must be at least 4 characters long. Please go back and correct.', 69 'Pass not match' => 'Passwords do not match. Please go back and correct.', 70 'Username guest' => 'The username guest is reserved. Please go back and correct.', 71 'Username BBCode' => 'Usernames may not contain any of the text formatting tags (BBCode) that the forum uses. Please go back and correct.', 72 'Username reserved chars' => 'Usernames may not contain all the characters \', " and [ or ] at once. Please go back and correct.', 73 'Username IP' => 'Usernames may not be in the form of an IP address. Please go back and correct.', 74 'Invalid email' => 'The administrator e-mail address you entered is invalid. Please go back and correct.', 75 'Missing base url' => 'You must enter a base URL. Please go back and correct.', 76 'No such database type' => '\'%s\' is not a valid database type.', 77 'Invalid MySQL version' => 'You are running MySQL version %1$s. PunBB requires at least MySQL %2$s to run properly. You must upgrade your MySQL installation before you can continue.', 78 'Invalid table prefix' => 'The table prefix \'%s\' contains illegal characters or is too long. The prefix may contain the letters a to z, any numbers and the underscore character. They must however not start with a number. The maximum length is 40 characters. Please choose a different prefix.', 79 'SQLite prefix collision' => 'The table prefix \'sqlite_\' is reserved for use by the SQLite engine. Please choose a different prefix.', 80 'PunBB already installed' => 'A table called "%1$susers" is already present in the database "%2$s". This could mean that PunBB is already installed or that another piece of software is installed and is occupying one or more of the table names PunBB requires. If you want to install multiple copies of PunBB in the same database, you must choose a different table prefix.', 81 82 // Used in the install 83 'Default announce heading' => 'Sample announcement', 84 'Default announce message' => '<p>Enter your announcement here.</p>', 85 'Default maint message' => "The forums are temporarily down for maintenance. Please try again in a few minutes.<br />\\n<br />\\n/Administrator", 86 'Default rules' => 'Enter your rules here.', 87 'Default category name' => 'Test category', 88 'Default forum name' => 'Test forum', 89 'Default forum descrip' => 'This is just a test forum', 90 'Default topic subject' => 'Test post', 91 'Default post contents' => 'If you are looking at this (which I guess you are), the install of PunBB appears to have worked! Now log in and head over to the administration control panel to configure your forum.', 92 'Default rank 1' => 'New member', 93 'Default rank 2' => 'Member', 94 63 95 // Installation completed form 64 96 'Success description' => 'Congratulations! PunBB %s has been successfully installed.',
