From bb4988168002dbde5435960efbf8c47d0c0f279b Mon Sep 17 00:00:00 2001 From: Jeremy Booker Date: Wed, 27 May 2026 09:24:56 -0400 Subject: [PATCH] fix: always include db name in db connection string --- setup/class/Setup.php | 606 ++++++++++++++++++++++++++++-------------- 1 file changed, 405 insertions(+), 201 deletions(-) diff --git a/setup/class/Setup.php b/setup/class/Setup.php index 17a96fa5b..b1851c1b4 100644 --- a/setup/class/Setup.php +++ b/setup/class/Setup.php @@ -73,25 +73,39 @@ public function createConfig() } else { $configDir = PHPWS_SOURCE_DIR . 'config/core/'; if (is_file($configDir . 'config.php')) { - $this->content[] = dgettext('core', - 'Your configuration file already exists.'); - $this->content[] = dgettext('core', - 'Remove the following file and refresh to continue:'); + $this->content[] = dgettext( + 'core', + 'Your configuration file already exists.' + ); + $this->content[] = dgettext( + 'core', + 'Remove the following file and refresh to continue:' + ); $this->content[] = '
' . $configDir . 'config.php
'; } elseif ($this->writeConfigFile()) { \phpws\PHPWS_Core::killSession('configSettings'); - $this->content[] = dgettext('core', - 'Your configuration file was written successfully!') . '
'; - $this->content[] = '' . dgettext('core', - 'Move on to Step 3') . ''; + $this->content[] = dgettext( + 'core', + 'Your configuration file was written successfully!' + ) . '
'; + $this->content[] = '' . dgettext( + 'core', + 'Move on to Step 3' + ) . ''; } else { - $this->content[] = dgettext('core', - 'Your configuration file could not be written into the following directory:'); + $this->content[] = dgettext( + 'core', + 'Your configuration file could not be written into the following directory:' + ); $this->content[] = "
$configDir
"; - $this->content[] = dgettext('core', - 'Please check your directory permissions and try again.'); - $this->content[] = '' . dgettext('core', - 'Permission Help') . ''; + $this->content[] = dgettext( + 'core', + 'Please check your directory permissions and try again.' + ); + $this->content[] = '' . dgettext( + 'core', + 'Permission Help' + ) . ''; } } $this->title = 'Create Configuration File'; @@ -124,29 +138,41 @@ public function writeConfigFile() $filename = $location . 'config.php'; if (is_file($filename)) { - $this->messages[] = dgettext('core', - 'Configuration file already exists.'); + $this->messages[] = dgettext( + 'core', + 'Configuration file already exists.' + ); return false; } $config_file[] = '", - str_replace('setup/', '', \phpws\PHPWS_Core::getHomeHttp(false))); + $source_http = sprintf( + "", + str_replace('setup/', '', \phpws\PHPWS_Core::getHomeHttp(false)) + ); if (is_file($location . 'source.php')) { $this->messages[] = 'source.php already exists! New copy saved as source.new.php'; return file_put_contents($location . 'source.new.php', $source_http); @@ -164,11 +190,15 @@ private function postUser() // all is well $aiw = true; - if (empty($_POST['username']) || preg_match('/[^\w\.\-]/', - $_POST['username'])) { + if (empty($_POST['username']) || preg_match( + '/[^\w\.\-]/', + $_POST['username'] + )) { $aiw = false; - $this->messages[] = dgettext('users', - 'Username is improperly formatted.'); + $this->messages[] = dgettext( + 'users', + 'Username is improperly formatted.' + ); } else { $_SESSION['User']->username = $_POST['username']; } @@ -182,8 +212,10 @@ private function postUser() if (empty($_POST['email'])) { $aiw = false; - $this->messages[] = dgettext('core', - 'Please enter an email address.'); + $this->messages[] = dgettext( + 'core', + 'Please enter an email address.' + ); } else { $_SESSION['User']->setEmail($_POST['email']); } @@ -199,22 +231,28 @@ public function postConfig() if (!empty($_POST['dbuser'])) { $this->setConfigSet('dbuser', $_POST['dbuser']); } else { - $this->messages['dbuser'] = dgettext('core', - 'Missing a database user name.'); + $this->messages['dbuser'] = dgettext( + 'core', + 'Missing a database user name.' + ); $check = false; } if (!empty($_POST['dbpass'])) { if (preg_match('/[^\w\s\.!\?]/', $_POST['dbpass'])) { - $this->messages['dbpass'] = dgettext('core', - 'Database password may contain alphanumeric characters, punctuation, spaces and underscores only.'); + $this->messages['dbpass'] = dgettext( + 'core', + 'Database password may contain alphanumeric characters, punctuation, spaces and underscores only.' + ); $check = false; } else { $this->setConfigSet('dbpass', $_POST['dbpass']); } } elseif (empty($currentPW)) { - $this->messages['dbpass'] = dgettext('core', - 'Missing a database password.'); + $this->messages['dbpass'] = dgettext( + 'core', + 'Missing a database password.' + ); $check = false; } @@ -223,15 +261,19 @@ public function postConfig() if (!empty($_POST['dbname'])) { $this->setConfigSet('dbname', $_POST['dbname']); } else { - $this->messages['dbname'] = dgettext('core', - 'Missing a database name.'); + $this->messages['dbname'] = dgettext( + 'core', + 'Missing a database name.' + ); $check = false; } if (!empty($_POST['dbprefix'])) { if (preg_match('/\W/', $_POST['dbprefix'])) { - $this->messages['dbpref'] = dgettext('core', - 'Table prefix must be alphanumeric characters or underscores only'); + $this->messages['dbpref'] = dgettext( + 'core', + 'Table prefix must be alphanumeric characters or underscores only' + ); $check = false; } else { $this->setConfigSet('dbprefix', $_POST['dbprefix']); @@ -270,19 +312,31 @@ public function postConfig() $this->messages[] = 'Database found.'; return true; } elseif ($checkConnection == 2) { - $sub[] = dgettext('core', - 'Canopy was able to connect, but the database already contained tables.'); + $sub[] = dgettext( + 'core', + 'Canopy was able to connect, but the database already contained tables.' + ); if ($this->getConfigSet('dbprefix')) { - $sub[] = dgettext('core', - 'Since you set a table prefix, you may force an installation into this database.'); - $sub[] = dgettext('core', - 'Click the link below to continue or change your connection settings.'); - $sub[] = sprintf('%s', - dgettext('core', - 'I want to install Canopy in this database.')); + $sub[] = dgettext( + 'core', + 'Since you set a table prefix, you may force an installation into this database.' + ); + $sub[] = dgettext( + 'core', + 'Click the link below to continue or change your connection settings.' + ); + $sub[] = sprintf( + '%s', + dgettext( + 'core', + 'I want to install Canopy in this database.' + ) + ); } else { - $sub[] = dgettext('core', - 'Create a new database, remove all tables from the database you want to use, or use table prefixing.'); + $sub[] = dgettext( + 'core', + 'Create a new database, remove all tables from the database you want to use, or use table prefixing.' + ); $_SESSION['configSettings']['database'] = false; } $this->messages['main'] = implode('
', $sub); @@ -296,26 +350,32 @@ public function postConfig() $this->databaseConfig(); } } else { - $this->messages[] = dgettext('core', - 'Unable to connect to the database with the information provided.'); - $this->messages[] = '' . dgettext('core', - 'Database Help') . ''; + $this->messages[] = dgettext( + 'core', + 'Unable to connect to the database with the information provided.' + ); + $this->messages[] = '' . dgettext( + 'core', + 'Database Help' + ) . ''; return false; } } public function createDatabase() { - $dsn = $this->getPDODSN(false); + $dsn = $this->getPDODSN(); $dbuser = $this->getConfigSet('dbuser'); $dbpass = $this->getConfigSet('dbpass'); try { - $db = new \PDO($this->getPDODSN(false), $dbuser, $dbpass); + $db = new \PDO($this->getPDODSN(), $dbuser, $dbpass); } catch (\Exception $e) { PHPWS_Error::log($e->getMessage()); $this->messages[] = 'Unable to connect.'; - $this->messages[] = dgettext('core', - 'Check your configuration settings.'); + $this->messages[] = dgettext( + 'core', + 'Check your configuration settings.' + ); return false; } @@ -324,10 +384,14 @@ public function createDatabase() $result = $db->exec($sql); } catch (\Exception $e) { PHPWS_Error::log($e->getMessage()); - $this->messages[] = dgettext('core', - 'Unable to create the database.'); - $this->messages[] = dgettext('core', - 'You will need to create it manually and rerun the setup.'); + $this->messages[] = dgettext( + 'core', + 'Unable to create the database.' + ); + $this->messages[] = dgettext( + 'core', + 'You will need to create it manually and rerun the setup.' + ); return false; } @@ -403,7 +467,7 @@ public function testDBConnect($dsn = null) $dbuser = $this->getConfigSet('dbuser'); $dbpass = $this->getConfigSet('dbpass'); try { - $connection = new \PDO($this->getPDODSN(false), $dbuser, $dbpass); + $connection = new \PDO($this->getPDODSN(), $dbuser, $dbpass); } catch (\Exception $e) { if (preg_match('/\[28000\] \[1045\]|08006/', $e->getMessage())) { return 0; @@ -456,42 +520,62 @@ public function databaseConfig() $databases = array('mysql' => 'MySQL', 'pgsql' => 'PostgreSQL'); - $formTpl['DBTYPE_DEF'] = dgettext('core', - 'Canopy supports MySQL and PostgreSQL. Choose the type your server currently is running.'); - - $formTpl['DBUSER_DEF'] = dgettext('core', - 'This is the user name that Canopy will use to access its database.') - . '
' . dgettext('core', - 'Note: it is a good idea to give each Canopy installation its own user.') . ''; + $formTpl['DBTYPE_DEF'] = dgettext( + 'core', + 'Canopy supports MySQL and PostgreSQL. Choose the type your server currently is running.' + ); + + $formTpl['DBUSER_DEF'] = dgettext( + 'core', + 'This is the user name that Canopy will use to access its database.' + ) + . '
' . dgettext( + 'core', + 'Note: it is a good idea to give each Canopy installation its own user.' + ) . ''; if (isset($this->messages['dbuser'])) { $formTpl['DBUSER_ERR'] = $this->messages['dbuser']; } - $formTpl['DBPASS_DEF'] = dgettext('core', - 'Enter the database\'s user password here.'); + $formTpl['DBPASS_DEF'] = dgettext( + 'core', + 'Enter the database\'s user password here.' + ); if (isset($this->messages['dbpass'])) { $formTpl['DBPASS_ERR'] = $this->messages['dbpass']; } - $formTpl['DBPREF_DEF'] = dgettext('core', - 'If you are installing Canopy in a shared environment, you may assign a prefix to tables.
We recommend you run without one.'); + $formTpl['DBPREF_DEF'] = dgettext( + 'core', + 'If you are installing Canopy in a shared environment, you may assign a prefix to tables.
We recommend you run without one.' + ); if (isset($this->messages['dbpref'])) { $formTpl['DBPREF_ERR'] = $this->messages['dbpref']; } - $formTpl['DBHOST_DEF'] = dgettext('core', - 'If your database is on the same server as your Canopy installation, leave this as "localhost".') - . '
' . dgettext('core', - 'Otherwise, enter the ip or dns to the database server.'); - - $formTpl['DBPORT_DEF'] = dgettext('core', - 'If your host specification requires access via a specific port, enter it here.'); - - $formTpl['DBNAME_DEF'] = dgettext('core', - 'The database\'s name into which you are installing Canopy.') - . '
' . dgettext('core', - 'Note: if you have not made this database yet, you should do so before continuing.') . ''; + $formTpl['DBHOST_DEF'] = dgettext( + 'core', + 'If your database is on the same server as your Canopy installation, leave this as "localhost".' + ) + . '
' . dgettext( + 'core', + 'Otherwise, enter the ip or dns to the database server.' + ); + + $formTpl['DBPORT_DEF'] = dgettext( + 'core', + 'If your host specification requires access via a specific port, enter it here.' + ); + + $formTpl['DBNAME_DEF'] = dgettext( + 'core', + 'The database\'s name into which you are installing Canopy.' + ) + . '
' . dgettext( + 'core', + 'Note: if you have not made this database yet, you should do so before continuing.' + ) . ''; if (isset($this->messages['dbname'])) { $formTpl['DBNAME_ERR'] = $this->messages['dbname']; } @@ -555,8 +639,11 @@ public function show($content, $title = NULL, $forward = false) if ($forward && AUTO_FORWARD) { $time = 2; $address = 'index.php?step=3'; - $setupData['META'] = sprintf('', - $time, $address); + $setupData['META'] = sprintf( + '', + $time, + $address + ); } $setupData['TITLE'] = $title; $setupData['MAIN_CONTENT'] = implode('
', $content); @@ -582,15 +669,27 @@ public function checkSession() // step > 2; check for session if (!isset($_SESSION['session_check'])) { - $this->content[] = dgettext('core', - 'Canopy depends on sessions to move data between pages.'); - $this->content[] = sprintf('%s', - DEFAULT_LANGUAGE, 'Sessions Help'); - $this->content[] = sprintf(dgettext('core', - 'If you think your sessions are working properly, %syou can click here return to the beginning%s.'), - '', ''); - $this->title = dgettext('core', - 'There is a problem with your sessions.'); + $this->content[] = dgettext( + 'core', + 'Canopy depends on sessions to move data between pages.' + ); + $this->content[] = sprintf( + '%s', + DEFAULT_LANGUAGE, + 'Sessions Help' + ); + $this->content[] = sprintf( + dgettext( + 'core', + 'If you think your sessions are working properly, %syou can click here return to the beginning%s.' + ), + '', + '' + ); + $this->title = dgettext( + 'core', + 'There is a problem with your sessions.' + ); $this->display(); } } @@ -602,34 +701,54 @@ public function welcome() if (CONFIG_CREATED) { switch ($this->testDBConnect(PHPWS_DSN)) { case '2': - $this->content[] = dgettext('core', - 'Canopy configuration file and database have been found. We are assuming your installation is complete.'); - $this->content[] = dgettext('core', - 'You should move or delete the setup directory.'); - $this->content[] = dgettext('core', - 'If you are returning here from a previous incomplete installation, you will need to clear the database of all tables and try again.'); - $this->title = dgettext('core', - 'There is a problem with your database'); + $this->content[] = dgettext( + 'core', + 'Canopy configuration file and database have been found. We are assuming your installation is complete.' + ); + $this->content[] = dgettext( + 'core', + 'You should move or delete the setup directory.' + ); + $this->content[] = dgettext( + 'core', + 'If you are returning here from a previous incomplete installation, you will need to clear the database of all tables and try again.' + ); + $this->title = dgettext( + 'core', + 'There is a problem with your database' + ); $this->display(); exit(); case '-1': - $this->content[] = dgettext('core', - 'The Canopy configuration file exists but it\'s specified database does not.'); - $this->content[] = dgettext('core', - 'Create the database set in the config file or delete the config file.'); - $this->title = dgettext('core', - 'There is a problem with your database'); + $this->content[] = dgettext( + 'core', + 'The Canopy configuration file exists but it\'s specified database does not.' + ); + $this->content[] = dgettext( + 'core', + 'Create the database set in the config file or delete the config file.' + ); + $this->title = dgettext( + 'core', + 'There is a problem with your database' + ); $this->display(); exit(); case '0': - $this->content[] = dgettext('core', - 'The Canopy configuration file exists but we could not connect to it\'s specified database.'); - $this->content[] = dgettext('core', - 'Check your dsn settings or delete the config file.'); - $this->title = dgettext('core', - 'There is a problem with your database'); + $this->content[] = dgettext( + 'core', + 'The Canopy configuration file exists but we could not connect to it\'s specified database.' + ); + $this->content[] = dgettext( + 'core', + 'Check your dsn settings or delete the config file.' + ); + $this->title = dgettext( + 'core', + 'There is a problem with your database' + ); $this->display(); exit(); @@ -680,10 +799,14 @@ public function createCore() if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); - $this->content[] = dgettext('core', - 'Some errors occurred while creating the core database tables.'); - $this->content[] = dgettext('core', - 'Please check your error log file.'); + $this->content[] = dgettext( + 'core', + 'Some errors occurred while creating the core database tables.' + ); + $this->content[] = dgettext( + 'core', + 'Please check your error log file.' + ); return false; } @@ -698,14 +821,20 @@ public function createCore() if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); - $this->content[] = dgettext('core', - 'Some errors occurred while creating the core database tables.'); - $this->content[] = dgettext('core', - 'Please check your error log file.'); + $this->content[] = dgettext( + 'core', + 'Some errors occurred while creating the core database tables.' + ); + $this->content[] = dgettext( + 'core', + 'Please check your error log file.' + ); return false; } else { - $this->content[] = dgettext('core', - 'Core installation successful.'); + $this->content[] = dgettext( + 'core', + 'Core installation successful.' + ); return true; } } @@ -721,10 +850,14 @@ private function installModules($modules) if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); - $this->content[] = dgettext('core', - 'An error occurred while trying to install your modules.') - . ' ' . dgettext('core', - 'Please check your error logs and try again.'); + $this->content[] = dgettext( + 'core', + 'An error occurred while trying to install your modules.' + ) + . ' ' . dgettext( + 'core', + 'Please check your error logs and try again.' + ); return true; } else { $this->content[] = $result; @@ -752,21 +885,33 @@ public function installCoreModules() public function finish() { $this->content[] = '
'; - $this->content[] = dgettext('core', - 'Installation of Canopy is complete.') . '
'; - $this->content[] = dgettext('core', - 'If you experienced any error messages, check your error.log file.') . '
'; + $this->content[] = dgettext( + 'core', + 'Installation of Canopy is complete.' + ) . '
'; + $this->content[] = dgettext( + 'core', + 'If you experienced any error messages, check your error.log file.' + ) . '
'; if (CHECK_DIRECTORY_PERMISSIONS) { - $this->content[] = dgettext('core', - 'Check Directory Permissions is enabled so be sure to secure your config and templates directories!'); - $this->content[] = dgettext('core', - 'If you do not change it now, your next page will be an error screen.'); + $this->content[] = dgettext( + 'core', + 'Check Directory Permissions is enabled so be sure to secure your config and templates directories!' + ); + $this->content[] = dgettext( + 'core', + 'If you do not change it now, your next page will be an error screen.' + ); } else { - $this->content[] = dgettext('core', - 'After you finish installing your modules in Boost, you should make your config and template directories non-writable.'); + $this->content[] = dgettext( + 'core', + 'After you finish installing your modules in Boost, you should make your config and template directories non-writable.' + ); } - $this->content[] = '' . dgettext('core', - 'Go to my new website!') . '' . '
'; + $this->content[] = '' . dgettext( + 'core', + 'Go to my new website!' + ) . '' . '
'; } public function display() @@ -776,14 +921,14 @@ public function display() if (is_array($this->content)) { $content = PHPWS_Text::tag_implode('p', $this->content); } else { - $content = & $this->content; + $content = &$this->content; } if (!empty($this->messages)) { if (is_array($this->messages)) { $message = PHPWS_Text::tag_implode('p', $this->messages); } else { - $message = & $this->messages; + $message = &$this->messages; } } else { $message = null; @@ -810,10 +955,14 @@ public function checkServerSettings() } $test['session_auto_start']['pass'] = !(bool) ini_get('session.auto_start'); // need 0 - $test['session_auto_start']['fail'] = dgettext('core', - 'session.auto_start must be set to 0 for Canopy to work. Please review your php.ini file.'); - $test['session_auto_start']['name'] = dgettext('core', - 'Session auto start disabled'); + $test['session_auto_start']['fail'] = dgettext( + 'core', + 'session.auto_start must be set to 0 for Canopy to work. Please review your php.ini file.' + ); + $test['session_auto_start']['name'] = dgettext( + 'core', + 'Session auto start disabled' + ); $test['session_auto_start']['crit'] = true; $test['pear_files']['pass'] = is_file('vendor/autoload.php'); @@ -822,49 +971,74 @@ public function checkServerSettings() $test['pear_files']['crit'] = true; $test['gd']['pass'] = extension_loaded('gd'); - $test['gd']['fail'] = sprintf(dgettext('core', - 'You need to compile the %sGD image library%s into PHP.'), - '', ''); + $test['gd']['fail'] = sprintf( + dgettext( + 'core', + 'You need to compile the %sGD image library%s into PHP.' + ), + '', + '' + ); $test['gd']['name'] = 'GD graphic libraries installed'; $test['gd']['crit'] = true; $test['image_dir']['pass'] = is_dir('images/') && is_writable('images/'); - $test['image_dir']['fail'] = sprintf(dgettext('core', - '%s directory does not exist or is not writable.'), - PHPWS_SOURCE_DIR . 'images/'); + $test['image_dir']['fail'] = sprintf( + dgettext( + 'core', + '%s directory does not exist or is not writable.' + ), + PHPWS_SOURCE_DIR . 'images/' + ); $test['image_dir']['name'] = 'Image directory ready'; $test['image_dir']['crit'] = true; $test['conf']['pass'] = is_dir('config/core/') && is_writable('config/core/'); - $test['conf']['fail'] = sprintf(dgettext('core', - '%s directory does not exist or is not writable.'), - PHPWS_SOURCE_DIR . 'config/core/'); + $test['conf']['fail'] = sprintf( + dgettext( + 'core', + '%s directory does not exist or is not writable.' + ), + PHPWS_SOURCE_DIR . 'config/core/' + ); $test['conf']['name'] = 'Config directory ready'; $test['conf']['crit'] = true; $test['file_dir']['pass'] = is_dir('files/') && is_writable('files/'); - $test['file_dir']['fail'] = sprintf(dgettext('core', - '%s directory does not exist or is not writable.'), - PHPWS_SOURCE_DIR . 'files/'); + $test['file_dir']['fail'] = sprintf( + dgettext( + 'core', + '%s directory does not exist or is not writable.' + ), + PHPWS_SOURCE_DIR . 'files/' + ); $test['file_dir']['name'] = 'File directory ready'; $test['file_dir']['crit'] = true; $test['log_dir']['pass'] = is_dir('logs/') && is_writable('logs/'); - $test['log_dir']['fail'] = sprintf(dgettext('core', - '%s directory does not exist or is not writable.'), - PHPWS_SOURCE_DIR . 'logs/'); + $test['log_dir']['fail'] = sprintf( + dgettext( + 'core', + '%s directory does not exist or is not writable.' + ), + PHPWS_SOURCE_DIR . 'logs/' + ); $test['log_dir']['name'] = 'Log directory ready'; $test['log_dir']['crit'] = true; $test['ffmpeg']['pass'] = is_file('/usr/bin/ffmpeg'); - $test['ffmpeg']['fail'] = dgettext('core', - 'You do not appear to have ffmpeg installed. File Cabinet will not be able to create thumbnail images from uploaded videos'); + $test['ffmpeg']['fail'] = dgettext( + 'core', + 'You do not appear to have ffmpeg installed. File Cabinet will not be able to create thumbnail images from uploaded videos' + ); $test['ffmpeg']['name'] = 'FFMPEG installed'; $test['ffmpeg']['crit'] = false; $test['mime_type']['pass'] = function_exists('finfo_open') || function_exists('mime_content_type') || !ini_get('safe_mode'); - $test['mime_type']['fail'] = dgettext('core', - 'Unable to detect MIME file type. You will need to compile finfo_open into PHP.'); + $test['mime_type']['fail'] = dgettext( + 'core', + 'Unable to detect MIME file type. You will need to compile finfo_open into PHP.' + ); $test['mime_type']['name'] = 'MIME file type detection'; $test['mime_type']['crit'] = true; @@ -874,27 +1048,40 @@ public function checkServerSettings() $phpversion = PHP_VERSION; } - $test['php_version']['pass'] = version_compare($phpversion, '5.1.0', - '>='); - $test['php_version']['fail'] = sprintf(dgettext('core', - 'Your server must run PHP version 5.1.0 or higher. You are running version %s.'), - $phpversion); + $test['php_version']['pass'] = version_compare( + $phpversion, + '5.1.0', + '>=' + ); + $test['php_version']['fail'] = sprintf( + dgettext( + 'core', + 'Your server must run PHP version 5.1.0 or higher. You are running version %s.' + ), + $phpversion + ); $test['php_version']['name'] = 'PHP 5 version check'; $test['php_version']['crit'] = true; $memory_limit = (int) ini_get('memory_limit'); $test['memory']['pass'] = ($memory_limit > 8); - $test['memory']['fail'] = dgettext('core', - 'Your PHP memory limit is less than 8MB. You may encounter problems with the script at this level.'); - $test['memory']['fail'] .= dgettext('core', - 'We suggest raising the limit in your php.ini file or uncommenting the "ini_set(\'memory_limit\', \'10M\');" line in your config/core/config.php file after installation.'); + $test['memory']['fail'] = dgettext( + 'core', + 'Your PHP memory limit is less than 8MB. You may encounter problems with the script at this level.' + ); + $test['memory']['fail'] .= dgettext( + 'core', + 'We suggest raising the limit in your php.ini file or uncommenting the "ini_set(\'memory_limit\', \'10M\');" line in your config/core/config.php file after installation.' + ); $test['memory']['name'] = 'Memory limit exceeded'; $test['memory']['crit'] = false; $test['globals']['pass'] = !(bool) ini_get('register_globals'); - $test['globals']['fail'] = dgettext('core', - 'You have register_globals enabled. You should disable it.'); + $test['globals']['fail'] = dgettext( + 'core', + 'You have register_globals enabled. You should disable it.' + ); $test['globals']['name'] = 'Register globals disabled'; $test['globals']['crit'] = false; @@ -912,8 +1099,10 @@ public function checkServerSettings() $content = array(); if (!$allow_install) { - $this->title = dgettext('core', - 'Cannot install Canopy because of the following reasons:'); + $this->title = dgettext( + 'core', + 'Cannot install Canopy because of the following reasons:' + ); $this->content = ''; $this->display(); } else { @@ -951,10 +1140,14 @@ function goToStep() case '3': if ($this->createCore()) { if ($this->installCoreModules()) { - $this->content[] = dgettext('core', - 'Core modules installed successfully.'); - $this->content[] = sprintf('%s', - 'Click to continue'); + $this->content[] = dgettext( + 'core', + 'Core modules installed successfully.' + ); + $this->content[] = sprintf( + '%s', + 'Click to continue' + ); } } break; @@ -970,18 +1163,24 @@ function goToStep() if (empty($result)) { $_SESSION['User']->setDisplayName('Administrator'); $_SESSION['User']->save(); - $this->content[] = dgettext('core', - 'New user created successfully.'); + $this->content[] = dgettext( + 'core', + 'New user created successfully.' + ); $this->step = 6; $this->goToStep(); break; } elseif (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); - $this->content[] = dgettext('core', - 'Sorry an error occurred. Please check your logs.'); + $this->content[] = dgettext( + 'core', + 'Sorry an error occurred. Please check your logs.' + ); } else { - $this->content[] = dgettext('core', - 'Cannot create a new user. Initial user already exists.'); + $this->content[] = dgettext( + 'core', + 'Cannot create a new user. Initial user already exists.' + ); $this->display(); } } else { @@ -991,13 +1190,19 @@ function goToStep() case '6': if ($this->installContentModules()) { - $this->content[] = dgettext('core', - 'Starting modules installed.'); - $this->content[] = dgettext('core', - 'The site should be ready for you to use.'); + $this->content[] = dgettext( + 'core', + 'Starting modules installed.' + ); + $this->content[] = dgettext( + 'core', + 'The site should be ready for you to use.' + ); // $this->content[] = sprintf('%s', PHPWS_SOURCE_HTTP, 'Continue to your new site...'); - $this->content[] = sprintf('%s', - 'Continue to your new site...'); + $this->content[] = sprintf( + '%s', + 'Continue to your new site...' + ); unset($_SESSION['configSettings']); unset($_SESSION['User']); unset($_SESSION['session_check']); @@ -1019,5 +1224,4 @@ function goToStep() } $this->display(); } - }