summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/controllers/welcome.php50
-rw-r--r--core/views/welcome.html.php29
-rw-r--r--core/views/welcome_syscheck.html.php49
-rw-r--r--index.php6
4 files changed, 129 insertions, 5 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php
index 3329a402..1e77ad4a 100644
--- a/core/controllers/welcome.php
+++ b/core/controllers/welcome.php
@@ -17,8 +17,54 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
-class Welcome_Controller extends Controller {
+class Welcome_Controller extends Template_Controller {
+ public $template = 'welcome.html';
+
function Index() {
- print new View('welcome.html');
+ }
+
+ function Syscheck() {
+ $errors = array();
+ if (!file_exists(VARPATH)) {
+ $error = new stdClass();
+ $error->message = "Missing: " . VARPATH;
+ $error->instructions[] = "mkdir " . VARPATH;
+ $error->instructions[] = "chmod 777 " . VARPATH;
+ $errors[] = $error;
+ } else if (!is_writable(VARPATH)) {
+ $error = new stdClass();
+ $error->message = "Not writable: " . VARPATH;
+ $error->instructions[] = "chmod 777 " . VARPATH;
+ $errors[] = $error;
+ }
+
+ $db_php = VARPATH . "database.php";
+ if (!file_exists($db_php)) {
+ $error = new stdClass();
+ $error->message = "Missing: $db_php";
+ $error->instructions[] = "cp kohana/config/database.php $db_php";
+ $error->instructions[] = "chmod 644 $db_php";
+ $error->message2 = "Then edit this file and enter your database configuration settings.";
+ $errors[] = $error;
+ } else if (!is_readable($db_php)) {
+ $error->message = "Not readable: $db_php";
+ $error->instructions[] = "chmod 644 $db_php";
+ $error->message2 = "Then edit this file and enter your database configuration settings.";
+ $errors[] = $error;
+ }
+
+ if (empty($errors)) {
+ Database::instance()->connect();
+ }
+
+ $this->_create_directories();
+ $this->template = new View('welcome_syscheck.html');
+ $this->template->errors = $errors;
+ }
+
+ function _create_directories() {
+ foreach (array("logs") as $dir) {
+ @mkdir(VARPATH . "$dir");
+ }
}
}
diff --git a/core/views/welcome.html.php b/core/views/welcome.html.php
index da75ebcc..a22bb324 100644
--- a/core/views/welcome.html.php
+++ b/core/views/welcome.html.php
@@ -13,16 +13,34 @@
background: white;
border: 1px solid black;
margin: 0 auto;
+ padding: -10px;
}
div.inner {
- padding: 1em;
+ padding: 0 1em 0 1em;
+ margin: 0px;
}
p {
+ margin: 0 0 0 0;
padding-left: 1em;
}
+ pre {
+ margin: 0;
+ padding-left: 2em;
+ }
+
+ .error {
+ color: red;
+ }
+
+ div.block {
+ padding: 0px;
+ margin: 0px;
+ padding-bottom: 1em;
+ }
+
ul {
margin-top: -1em;
}
@@ -51,7 +69,14 @@
links to get you started.
</p>
- <h2>Useful Links</h2>
+ <h2>About your config</h2>
+ <iframe width="100%" src="<?= url::site("welcome/syscheck") ?>"/></iframe>
+
+ <h2>Activities</h2>
+ <p>
+ </p>
+
+ <h2>Documentation</h2>
<ul>
<li>
<a href="http://docs.google.com/Doc?id=dfjxt593_184ff9jhmd8&hl=en">Gallery3: Prioritized Feature List</a>
diff --git a/core/views/welcome_syscheck.html.php b/core/views/welcome_syscheck.html.php
new file mode 100644
index 00000000..c87c4763
--- /dev/null
+++ b/core/views/welcome_syscheck.html.php
@@ -0,0 +1,49 @@
+<? defined("SYSPATH") or die("No direct script access."); ?>
+<html>
+ <head>
+ <title>Gallery3 Scaffold</title>
+ <style>
+ body {
+ font-family: Trebuchet MS;
+ }
+
+ p {
+ margin: 0 0 0 0;
+ padding: 5px;
+ }
+
+ pre {
+ margin: 0;
+ padding-left: 1em;
+ }
+
+ .error {
+ color: red;
+ }
+
+ div.block {
+ border: 1px solid black;
+ margin-bottom: 5px;
+ paddding: 1em;
+ }
+ </style>
+ </head>
+ <body>
+ <? foreach ($errors as $error): ?>
+ <div class="block">
+ <p class="error">
+ <?= $error->message ?>
+ </p>
+ <? foreach ($error->instructions as $line): ?>
+ <pre><?= $line ?></pre>
+ <? endforeach ?>
+
+ <? if (!empty($error->message2)): ?>
+ <p class="error">
+ <?= $error->message2 ?>
+ </p>
+ <? endif ?>
+ </div>
+ <? endforeach ?>
+ </body>
+</html>
diff --git a/index.php b/index.php
index a9310500..9d278e62 100644
--- a/index.php
+++ b/index.php
@@ -49,7 +49,11 @@ if (PHP_SAPI == 'cli') {
@system('mkdir -p test/var/logs');
define('VARPATH', realpath('test/var') . '/');
} else {
- define('VARPATH', realpath('var') . '/');
+ if (file_exists('var')) {
+ define('VARPATH', realpath('var') . '/');
+ } else {
+ define('VARPATH', getcwd() . "/var/");
+ }
}
// Initialize.