use Friendica\App;
use Friendica\BaseModule;
-use Friendica\Database\DBA;
-use Friendica\Database\DBStructure;
use Friendica\Core;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\Util\Strings;
use Friendica\Util\Temporal;
class Install extends BaseModule
// We overwrite current theme css, because during install we may not have a working mod_rewrite
// so we may not have a css at all. Here we set a static css file for the install procedure pages
- $a->theme['stylesheet'] = $a->getBaseURL() . '/view/install/style.css';
+ Renderer::$theme['stylesheet'] = $a->getBaseURL() . '/view/install/style.css';
self::$installer = new Core\Installer();
self::$currentWizardStep = defaults($_POST, 'pass', self::SYSTEM_CHECK);
break;
case self::SITE_SETTINGS:
- $dbhost = notags(trim(defaults($_POST, 'dbhost', Core\Installer::DEFAULT_HOST)));
- $dbuser = notags(trim(defaults($_POST, 'dbuser', '')));
- $dbpass = notags(trim(defaults($_POST, 'dbpass', '')));
- $dbdata = notags(trim(defaults($_POST, 'dbdata', '')));
+ $dbhost = Strings::escapeTags(trim(defaults($_POST, 'dbhost', Core\Installer::DEFAULT_HOST)));
+ $dbuser = Strings::escapeTags(trim(defaults($_POST, 'dbuser', '')));
+ $dbpass = Strings::escapeTags(trim(defaults($_POST, 'dbpass', '')));
+ $dbdata = Strings::escapeTags(trim(defaults($_POST, 'dbdata', '')));
// If we cannot connect to the database, return to the previous step
if (!self::$installer->checkDB($dbhost, $dbuser, $dbpass, $dbdata)) {
case self::FINISHED:
$urlpath = $a->getURLPath();
- $dbhost = notags(trim(defaults($_POST, 'dbhost', Core\Installer::DEFAULT_HOST)));
- $dbuser = notags(trim(defaults($_POST, 'dbuser', '')));
- $dbpass = notags(trim(defaults($_POST, 'dbpass', '')));
- $dbdata = notags(trim(defaults($_POST, 'dbdata', '')));
- $timezone = notags(trim(defaults($_POST, 'timezone', Core\Installer::DEFAULT_TZ)));
- $language = notags(trim(defaults($_POST, 'language', Core\Installer::DEFAULT_LANG)));
- $adminmail = notags(trim(defaults($_POST, 'adminmail', '')));
+ $dbhost = Strings::escapeTags(trim(defaults($_POST, 'dbhost', Core\Installer::DEFAULT_HOST)));
+ $dbuser = Strings::escapeTags(trim(defaults($_POST, 'dbuser', '')));
+ $dbpass = Strings::escapeTags(trim(defaults($_POST, 'dbpass', '')));
+ $dbdata = Strings::escapeTags(trim(defaults($_POST, 'dbdata', '')));
+ $timezone = Strings::escapeTags(trim(defaults($_POST, 'timezone', Core\Installer::DEFAULT_TZ)));
+ $language = Strings::escapeTags(trim(defaults($_POST, 'language', Core\Installer::DEFAULT_LANG)));
+ $adminmail = Strings::escapeTags(trim(defaults($_POST, 'adminmail', '')));
// If we cannot connect to the database, return to the Database config wizard
if (!self::$installer->checkDB($dbhost, $dbuser, $dbpass, $dbdata)) {
$output = '';
- $install_title = L10n::t('Friendica Communctions Server - Setup');
+ $install_title = L10n::t('Friendica Communications Server - Setup');
switch (self::$currentWizardStep) {
case self::SYSTEM_CHECK:
'$pass' => L10n::t('System check'),
'$checks' => self::$installer->getChecks(),
'$passed' => $status,
- '$see_install' => L10n::t('Please see the file "Install.txt".'),
+ '$see_install' => L10n::t('Please see the file "INSTALL.txt".'),
'$next' => L10n::t('Next'),
'$reload' => L10n::t('Check again'),
'$phpath' => $phppath,
break;
case self::DATABASE_CONFIG:
- $dbhost = notags(trim(defaults($_POST, 'dbhost' , Core\Installer::DEFAULT_HOST)));
- $dbuser = notags(trim(defaults($_POST, 'dbuser' , '' )));
- $dbpass = notags(trim(defaults($_POST, 'dbpass' , '' )));
- $dbdata = notags(trim(defaults($_POST, 'dbdata' , '' )));
- $phpath = notags(trim(defaults($_POST, 'phpath' , '' )));
- $adminmail = notags(trim(defaults($_POST, 'adminmail', '' )));
+ $dbhost = Strings::escapeTags(trim(defaults($_POST, 'dbhost' , Core\Installer::DEFAULT_HOST)));
+ $dbuser = Strings::escapeTags(trim(defaults($_POST, 'dbuser' , '' )));
+ $dbpass = Strings::escapeTags(trim(defaults($_POST, 'dbpass' , '' )));
+ $dbdata = Strings::escapeTags(trim(defaults($_POST, 'dbdata' , '' )));
+ $phpath = Strings::escapeTags(trim(defaults($_POST, 'phpath' , '' )));
+ $adminmail = Strings::escapeTags(trim(defaults($_POST, 'adminmail', '' )));
$tpl = Renderer::getMarkupTemplate('install_db.tpl');
$output .= Renderer::replaceMacros($tpl, [
break;
case self::SITE_SETTINGS:
- $dbhost = notags(trim(defaults($_POST, 'dbhost', Core\Installer::DEFAULT_HOST)));
- $dbuser = notags(trim(defaults($_POST, 'dbuser', '' )));
- $dbpass = notags(trim(defaults($_POST, 'dbpass', '' )));
- $dbdata = notags(trim(defaults($_POST, 'dbdata', '' )));
- $phpath = notags(trim(defaults($_POST, 'phpath', '' )));
+ $dbhost = Strings::escapeTags(trim(defaults($_POST, 'dbhost', Core\Installer::DEFAULT_HOST)));
+ $dbuser = Strings::escapeTags(trim(defaults($_POST, 'dbuser', '' )));
+ $dbpass = Strings::escapeTags(trim(defaults($_POST, 'dbpass', '' )));
+ $dbdata = Strings::escapeTags(trim(defaults($_POST, 'dbdata', '' )));
+ $phpath = Strings::escapeTags(trim(defaults($_POST, 'phpath', '' )));
- $adminmail = notags(trim(defaults($_POST, 'adminmail', '')));
+ $adminmail = Strings::escapeTags(trim(defaults($_POST, 'adminmail', '')));
$timezone = defaults($_POST, 'timezone', Core\Installer::DEFAULT_TZ);
/* Installed langs */
* @param App $a The global App
*
* @return string The text for the next steps
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function whatNext($a)
{