From 4e9db95bcfe7818f4f937f3e29f31ea64cd73330 Mon Sep 17 00:00:00 2001 From: Tom Adams Date: Thu, 30 Jul 2009 20:38:34 +0100 Subject: Use -
  • >
  • +
  • >
  • Date: Wed, 5 Aug 2009 18:27:27 -0400 Subject: Switch DOCTYPE's to the XHTML 5 DOCTYPE --- install.php | 4 +--- lib/htmloutputter.php | 4 +--- plugins/FBConnect/FBC_XDReceiver.php | 4 +--- plugins/FBConnect/FBConnectPlugin.php | 4 +--- plugins/recaptcha/recaptcha.php | 4 +--- tpl/index.php | 6 ++---- 6 files changed, 7 insertions(+), 19 deletions(-) (limited to 'install.php') diff --git a/install.php b/install.php index 227f99789..ea2135651 100644 --- a/install.php +++ b/install.php @@ -383,9 +383,7 @@ function runDbScript($filename, $conn, $type='mysql') ?> xml version="1.0" encoding="UTF-8" "; ?> - + Install Laconica diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 06603ac05..cba8a5f5e 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -110,9 +110,7 @@ class HTMLOutputter extends XMLOutputter $this->extraHeaders(); - $this->startXML('html', - '-//W3C//DTD XHTML 1.0 Strict//EN', - 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'); + $this->startXML('html'); $language = $this->getLanguage(); diff --git a/plugins/FBConnect/FBC_XDReceiver.php b/plugins/FBConnect/FBC_XDReceiver.php index 57c98b4f1..d9677fca7 100644 --- a/plugins/FBConnect/FBC_XDReceiver.php +++ b/plugins/FBConnect/FBC_XDReceiver.php @@ -47,9 +47,7 @@ class FBC_XDReceiverAction extends Action header('Expires:'); header('Pragma:'); - $this->startXML('html', - '-//W3C//DTD XHTML 1.0 Strict//EN', - 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'); + $this->startXML('html'); $language = $this->getLanguage(); diff --git a/plugins/FBConnect/FBConnectPlugin.php b/plugins/FBConnect/FBConnectPlugin.php index 6788793b2..2fb10a675 100644 --- a/plugins/FBConnect/FBConnectPlugin.php +++ b/plugins/FBConnect/FBConnectPlugin.php @@ -82,9 +82,7 @@ class FBConnectPlugin extends Plugin $action->extraHeaders(); - $action->startXML('html', - '-//W3C//DTD XHTML 1.0 Strict//EN', - 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'); + $action->startXML('html'); $language = $action->getLanguage(); diff --git a/plugins/recaptcha/recaptcha.php b/plugins/recaptcha/recaptcha.php index 5ef8352d1..38a860fc7 100644 --- a/plugins/recaptcha/recaptcha.php +++ b/plugins/recaptcha/recaptcha.php @@ -65,9 +65,7 @@ class recaptcha extends Plugin $action->extraHeaders(); - $action->startXML('html', - '-//W3C//DTD XHTML 1.0 Strict//EN', - 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'); + $action->startXML('html'); $action->raw(''); return false; diff --git a/tpl/index.php b/tpl/index.php index 5f1ed8439..be375e75a 100644 --- a/tpl/index.php +++ b/tpl/index.php @@ -1,6 +1,4 @@ - + <?php echo section('title'); ?> @@ -44,4 +42,4 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - \ No newline at end of file + -- cgit v1.2.3-54-g00ecf From 49eb6009a54e9fd5609cce1ba7cfc9d85edff8c0 Mon Sep 17 00:00:00 2001 From: Brett Taylor Date: Fri, 7 Aug 2009 14:17:55 +1200 Subject: install.php: improved support for running Laconica in a sub folder and on a non-standard port, tidyed up configuration file generation, removing duplication from db functions, --- install.php | 130 ++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 82 insertions(+), 48 deletions(-) (limited to 'install.php') diff --git a/install.php b/install.php index ea2135651..f02a06663 100644 --- a/install.php +++ b/install.php @@ -180,6 +180,9 @@ function handlePost() $password = $_POST['password']; $sitename = $_POST['sitename']; $fancy = !empty($_POST['fancy']); + $server = $_SERVER['HTTP_HOST']; + $path = substr(dirname($_SERVER['PHP_SELF']), 1); + ?>
    Page notice
    @@ -219,20 +222,42 @@ function handlePost() } switch($dbtype) { - case 'mysql': mysql_db_installer($host, $database, $username, $password, $sitename, $fancy); - break; - case 'pgsql': pgsql_db_installer($host, $database, $username, $password, $sitename, $fancy); - break; - default: + case 'mysql': + $db = mysql_db_installer($host, $database, $username, $password); + break; + case 'pgsql': + $db = pgsql_db_installer($host, $database, $username, $password); + break; + default: + } + + if (!$db) { + // database connection failed, do not move on to create config file. + return false; + } + + updateStatus("Writing config file..."); + $res = writeConf($sitename, $server, $path, $fancy, $db); + + if (!$res) { + updateStatus("Can't write config file.", true); + showForm(); + return; } - if ($path) $path .= '/'; - updateStatus("You can visit your new Laconica site."); + + /* + TODO https needs to be considered + */ + $link = "http://".$server.'/'.$path; + + updateStatus("Laconica has been installed at $link"); + updateStatus("You can visit your new Laconica site."); ?> 'SMS carrier', 'notice_source' => 'notice source', @@ -276,29 +301,24 @@ function pgsql_db_installer($host, $database, $username, $password, $sitename, $ if ($res === false) { updateStatus(sprintf("Can't run %d script.", $name), true); showForm(); - return; + return false; } } pg_query($conn, 'COMMIT'); - updateStatus("Writing config file..."); if (empty($password)) { $sqlUrl = "pgsql://$username@$host/$database"; } else { $sqlUrl = "pgsql://$username:$password@$host/$database"; } - $res = writeConf($sitename, $sqlUrl, $fancy, 'pgsql'); - if (!$res) { - updateStatus("Can't write config file.", true); - showForm(); - return; - } - updateStatus("Done!"); - + + $db = array('type' => 'pgsql', 'database' => $sqlUrl); + + return $db; } -function mysql_db_installer($host, $database, $username, $password, $sitename, $fancy) { +function mysql_db_installer($host, $database, $username, $password) { updateStatus("Starting installation..."); updateStatus("Checking database..."); @@ -306,21 +326,21 @@ function mysql_db_installer($host, $database, $username, $password, $sitename, $ if (!$conn) { updateStatus("Can't connect to server '$host' as '$username'.", true); showForm(); - return; + return false; } updateStatus("Changing to database..."); $res = mysql_select_db($database, $conn); if (!$res) { updateStatus("Can't change to database.", true); showForm(); - return; + return false; } updateStatus("Running database script..."); $res = runDbScript(INSTALLDIR.'/db/laconica.sql', $conn); if ($res === false) { updateStatus("Can't run database script.", true); showForm(); - return; + return false; } foreach (array('sms_carrier' => 'SMS carrier', 'notice_source' => 'notice source', @@ -331,35 +351,44 @@ function mysql_db_installer($host, $database, $username, $password, $sitename, $ if ($res === false) { updateStatus(sprintf("Can't run %d script.", $name), true); showForm(); - return; + return false; } } - updateStatus("Writing config file..."); $sqlUrl = "mysqli://$username:$password@$host/$database"; - $res = writeConf($sitename, $sqlUrl, $fancy); - if (!$res) { - updateStatus("Can't write config file.", true); - showForm(); - return; - } - updateStatus("Done!"); - } -function writeConf($sitename, $sqlUrl, $fancy, $type='mysql') + $db = array('type' => 'mysql', 'database' => $sqlUrl); + return $db; +} + +function writeConf($sitename, $server, $path, $fancy, $db) { - $res = file_put_contents(INSTALLDIR.'/config.php', - ""); + // assemble configuration file in a string + $cfg = ""; + // write configuration file out to install directory + $res = file_put_contents(INSTALLDIR.'/config.php', $cfg); + return $res; } -function runDbScript($filename, $conn, $type='mysql') +function runDbScript($filename, $conn, $type = 'mysql') { $sql = trim(file_get_contents($filename)); $stmts = explode(';', $sql); @@ -368,10 +397,15 @@ function runDbScript($filename, $conn, $type='mysql') if (!mb_strlen($stmt)) { continue; } - if ($type == 'mysql') { - $res = mysql_query($stmt, $conn); - } elseif ($type=='pgsql') { - $res = pg_query($conn, $stmt); + switch ($type) { + case 'mysql': + $res = mysql_query($stmt, $conn); + break; + case 'pgsql': + $res = pg_query($conn, $stmt); + break; + default: + updateStatus("runDbScript() error: unknown database type ". $type ." provided."); } if ($res === false) { updateStatus("FAILED SQL: $stmt"); -- cgit v1.2.3-54-g00ecf From 04c6272915cf4f53e45b75dedc9b93f8cdfa76cc Mon Sep 17 00:00:00 2001 From: Brett Taylor Date: Tue, 11 Aug 2009 15:26:41 +1200 Subject: fix for trac bug #1805: bug on line 381 referred to non existant variable, and caused a php notice and potentially would create a misconfigured config.php database type setting. --- install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'install.php') diff --git a/install.php b/install.php index f02a06663..9bcee275f 100644 --- a/install.php +++ b/install.php @@ -378,7 +378,7 @@ function writeConf($sitename, $server, $path, $fancy, $db) // database "\$config['db']['database'] = '{$db['database']}';\n\n". - ($type == 'pgsql' ? "\$config['db']['quote_identifiers'] = true;\n\n":''). + ($db['type'] == 'pgsql' ? "\$config['db']['quote_identifiers'] = true;\n\n":''). "\$config['db']['type'] = '{$db['type']}';\n\n". "?>"; -- cgit v1.2.3-54-g00ecf