[geeklog-cvs] geeklog: An attempt to provide a nicer welcome to those who call...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Jan 2 11:31:00 EST 2010


changeset 7576:8ee64e267b94
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/8ee64e267b94
user: Dirk Haun <dirk at haun-online.de>
date: Sat Jan 02 13:22:20 2010 +0100
description:
An attempt to provide a nicer welcome to those who call up Geeklog without running the install script first (inspired by MediaWiki)

diffstat:

 public_html/lib-common.php |  63 +++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)

diffs (80 lines):

diff -r 2d229bad3fce -r 8ee64e267b94 public_html/lib-common.php
--- a/public_html/lib-common.php	Sat Jan 02 13:15:41 2010 +0100
+++ b/public_html/lib-common.php	Sat Jan 02 13:22:20 2010 +0100
@@ -90,6 +90,8 @@
 */
 require_once 'siteconfig.php';
 
+COM_checkInstalled();
+
 /**
 * Configuration class
 */
@@ -7052,6 +7054,67 @@
 }
 
 /**
+* Check if Geeklog has been installed yet
+*
+* This is a (very) simple check to see if the user already ran the install
+* script. If not, abort and display a nice(r) welcome screen with handy links
+* to the install script and instructions. Inspired by MediaWiki ...
+*
+*/
+function COM_checkInstalled()
+{
+    global $_CONF;
+
+    $not_installed = false;
+
+    // this is the only thing we check for now ...
+    if (empty($_CONF) || !isset($_CONF['path']) ||
+            ($_CONF['path'] == '/path/to/Geeklog/')) {
+        $not_installed = true;
+    }
+
+    if ($not_installed) {
+        $rel = '';
+        $cd = getcwd();
+        if (! file_exists($cd . '/admin/install.index.php')) {
+            // this should cover most (though not all) cases
+            $rel = '../';
+        }
+
+        $display =
+'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<title>Welcome to Geeklog</title>
+<meta name="robots" content="noindex,nofollow" />
+<style type="text/css">
+  html, body {
+    color:#000;
+    background-color:#fff;
+    font-family:sans-serif;
+    text-align:center;
+  }
+</style>
+</head>
+
+<body>
+<img src="' . $rel . 'docs/images/newlogo.gif" alt="" />
+
+<h1>Geeklog ' . VERSION . '</h1>
+<p>Please run the <a href="' . $rel . 'admin/install/index.php" rel="nofollow">install script</a> first.</p>
+<p>For more information, please refer to the <a href="' . $rel . 'docs/english/install.html" rel="nofollow">installation instructions</a>.</p>
+</body>
+</html>
+';
+
+        header("HTTP/1.1 503 Service Unavailable");
+        header("Status: 503 Service Unavailable");
+        header('Content-Type: text/html; charset=' . $_CONF['default_charset']);
+        die($display);
+    }
+}
+
+/**
 * Now include all plugin functions
 */
 foreach ($_PLUGINS as $pi_name) {



More information about the geeklog-cvs mailing list