Changeset 1585

Show
Ignore:
Timestamp:
04/05/08 20:24:35 (5 months ago)
Author:
Neal
Message:

Moved more hardcoded strings out of install.php and into the language files.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/punbb-1.3-dev/upload/install.php

    r1576 r1585  
    9292 
    9393        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']); 
    9595 
    9696        // Make an educated guess regarding base_url 
     
    339339        // Validate form 
    340340        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']); 
    342342        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']); 
    344346        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']); 
    346348        if ($password1 != $password2) 
    347                 error('Passwords do not match. Please go back and correct.'); 
     349                error($lang_install['Pass not match']); 
    348350        if (strtolower($username) == 'guest') 
    349                 error('The username guest is reserved. Please go back and correct.'); 
     351                error($lang_install['Username guest']); 
    350352        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']); 
    352356        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']); 
    354358 
    355359        // Validate email 
    356360        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']); 
    358362 
    359363        // Make sure board title and description aren't left blank 
     
    364368 
    365369        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']); 
    367371 
    368372 
     
    387391 
    388392                default: 
    389                         error('\''.$db_type.'\' is not a valid database type.'); 
     393                        error(sprintf($lang_install['No such database type'], $db_type)); 
    390394        } 
    391395 
     
    400404                $mysql_version = $db->result($result); 
    401405                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)); 
    403407        } 
    404408 
    405409        // Validate prefix 
    406410        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)); 
    408412 
    409413        // Check SQLite prefix collision 
    410414        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']); 
    412416 
    413417 
     
    415419        $result = $db->query('SELECT 1 FROM '.$db_prefix.'users WHERE id=1'); 
    416420        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)); 
    418422 
    419423 
     
    15031507                'o_regs_verify'                         => "'0'", 
    15041508                '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']."'", 
    15071511                'o_rules'                                       => "'0'", 
    1508                 'o_rules_message'                       => "'Enter your rules here.'", 
     1512                'o_rules_message'                       => "'".$lang_install['Default rules']."'", 
    15091513                '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']."'", 
    15111515                'p_message_bbcode'                      => "'1'", 
    15121516                'p_message_img_tag'                     => "'1'", 
     
    15271531 
    15281532        // 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__); 
    15381540 
    15391541        // Add new post to search table 
     
    15441546        } 
    15451547 
    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__); 
    15481550 
    15491551 
  • branches/punbb-1.3-dev/upload/lang/English/install.php

    r1489 r1585  
    6161'Start install'                         =>      'Start install', // Label for submit button 
    6262 
     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 
    6395// Installation completed form 
    6496'Success description'           =>      'Congratulations! PunBB %s has been successfully installed.',