diff options
-rw-r--r-- | application/Bootstrap.php | 8 | ||||
-rw-r--r-- | application/configs/application.ini | 20 | ||||
-rw-r--r-- | application/controllers/ErrorController.php | 51 | ||||
-rw-r--r-- | application/controllers/IndexController.php | 18 | ||||
-rw-r--r-- | application/views/scripts/error/error.phtml | 28 | ||||
-rw-r--r-- | application/views/scripts/index/index.phtml | 43 | ||||
-rw-r--r-- | docs/README.txt | 30 | ||||
-rw-r--r-- | public/.htaccess | 7 | ||||
-rw-r--r-- | public/index.php | 26 | ||||
-rw-r--r-- | tests/application/bootstrap.php | 0 | ||||
-rw-r--r-- | tests/library/bootstrap.php | 0 | ||||
-rw-r--r-- | tests/phpunit.xml | 0 |
12 files changed, 231 insertions, 0 deletions
diff --git a/application/Bootstrap.php b/application/Bootstrap.php new file mode 100644 index 0000000..613100c --- /dev/null +++ b/application/Bootstrap.php @@ -0,0 +1,8 @@ +<?php + +class Bootstrap extends Zend_Application_Bootstrap_Bootstrap +{ + + +} + diff --git a/application/configs/application.ini b/application/configs/application.ini new file mode 100644 index 0000000..d388364 --- /dev/null +++ b/application/configs/application.ini @@ -0,0 +1,20 @@ +[production] +phpSettings.display_startup_errors = 0 +phpSettings.display_errors = 0 +includePaths.library = APPLICATION_PATH "/../library" +bootstrap.path = APPLICATION_PATH "/Bootstrap.php" +bootstrap.class = "Bootstrap" +appnamespace = "Application" +resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" +resources.frontController.params.displayExceptions = 0 + +[staging : production] + +[testing : production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 + +[development : production] +phpSettings.display_startup_errors = 1 +phpSettings.display_errors = 1 +resources.frontController.params.displayExceptions = 1 diff --git a/application/controllers/ErrorController.php b/application/controllers/ErrorController.php new file mode 100644 index 0000000..5bb2749 --- /dev/null +++ b/application/controllers/ErrorController.php @@ -0,0 +1,51 @@ +<?php + +class ErrorController extends Zend_Controller_Action +{ + + public function errorAction() + { + $errors = $this->_getParam('error_handler'); + + switch ($errors->type) { + case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE: + case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: + case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: + + // 404 error -- controller or action not found + $this->getResponse()->setHttpResponseCode(404); + $this->view->message = 'Page not found'; + break; + default: + // application error + $this->getResponse()->setHttpResponseCode(500); + $this->view->message = 'Application error'; + break; + } + + // Log exception, if logger available + if ($log = $this->getLog()) { + $log->crit($this->view->message, $errors->exception); + } + + // conditionally display exceptions + if ($this->getInvokeArg('displayExceptions') == true) { + $this->view->exception = $errors->exception; + } + + $this->view->request = $errors->request; + } + + public function getLog() + { + $bootstrap = $this->getInvokeArg('bootstrap'); + if (!$bootstrap->hasPluginResource('Log')) { + return false; + } + $log = $bootstrap->getResource('Log'); + return $log; + } + + +} + diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php new file mode 100644 index 0000000..0c4fe03 --- /dev/null +++ b/application/controllers/IndexController.php @@ -0,0 +1,18 @@ +<?php + +class IndexController extends Zend_Controller_Action +{ + + public function init() + { + /* Initialize action controller here */ + } + + public function indexAction() + { + // action body + } + + +} + diff --git a/application/views/scripts/error/error.phtml b/application/views/scripts/error/error.phtml new file mode 100644 index 0000000..1997506 --- /dev/null +++ b/application/views/scripts/error/error.phtml @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <title>Zend Framework Default Application</title> +</head> +<body> + <h1>An error occurred</h1> + <h2><?php echo $this->message ?></h2> + + <?php if (isset($this->exception)): ?> + + <h3>Exception information:</h3> + <p> + <b>Message:</b> <?php echo $this->exception->getMessage() ?> + </p> + + <h3>Stack trace:</h3> + <pre><?php echo $this->exception->getTraceAsString() ?> + </pre> + + <h3>Request Parameters:</h3> + <pre><?php echo var_export($this->request->getParams(), true) ?> + </pre> + <?php endif ?> + +</body> +</html> diff --git a/application/views/scripts/index/index.phtml b/application/views/scripts/index/index.phtml new file mode 100644 index 0000000..4b38f0a --- /dev/null +++ b/application/views/scripts/index/index.phtml @@ -0,0 +1,43 @@ +<style> + a:link, + a:visited + { + color: #0398CA; + } + + span#zf-name + { + color: #91BE3F; + } + + div#welcome + { + color: #FFFFFF; + background-image: url(http://framework.zend.com/images/bkg_header.jpg); + width: 600px; + height: 400px; + border: 2px solid #444444; + overflow: hidden; + text-align: center; + } + + div#more-information + { + background-image: url(http://framework.zend.com/images/bkg_body-bottom.gif); + height: 100%; + } +</style> +<div id="welcome"> + <h1>Welcome to the <span id="zf-name">Zend Framework!</span></h1> + + <h3>This is your project's main page</h3> + + <div id="more-information"> + <p><img src="http://framework.zend.com/images/PoweredBy_ZF_4LightBG.png" /></p> + <p> + Helpful Links: <br /> + <a href="http://framework.zend.com/">Zend Framework Website</a> | + <a href="http://framework.zend.com/manual/en/">Zend Framework Manual</a> + </p> + </div> +</div>
\ No newline at end of file diff --git a/docs/README.txt b/docs/README.txt new file mode 100644 index 0000000..1f144e6 --- /dev/null +++ b/docs/README.txt @@ -0,0 +1,30 @@ +README +====== + +This directory should be used to place project specfic documentation including +but not limited to project notes, generated API/phpdoc documentation, or +manual files generated or hand written. Ideally, this directory would remain +in your development environment only and should not be deployed with your +application to it's final production location. + + +Setting Up Your VHOST +===================== + +The following is a sample VHOST you might want to consider for your project. + +<VirtualHost *:80> + DocumentRoot "/home/sf34/pbs2/public" + ServerName pbs2.local + + # This should be omitted in the production environment + SetEnv APPLICATION_ENV development + + <Directory "/home/sf34/pbs2/public"> + Options Indexes MultiViews FollowSymLinks + AllowOverride All + Order allow,deny + Allow from all + </Directory> + +</VirtualHost> diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..7fb009b --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,7 @@ + +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} -s [OR] +RewriteCond %{REQUEST_FILENAME} -l [OR] +RewriteCond %{REQUEST_FILENAME} -d +RewriteRule ^.*$ - [NC,L] +RewriteRule ^.*$ index.php [NC,L] diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..a7ade9f --- /dev/null +++ b/public/index.php @@ -0,0 +1,26 @@ +<?php + +// Define path to application directory +defined('APPLICATION_PATH') + || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); + +// Define application environment +defined('APPLICATION_ENV') + || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); + +// Ensure library/ is on include_path +set_include_path(implode(PATH_SEPARATOR, array( + realpath(APPLICATION_PATH . '/../library'), + get_include_path(), +))); + +/** Zend_Application */ +require_once 'Zend/Application.php'; + +// Create application, bootstrap, and run +$application = new Zend_Application( + APPLICATION_ENV, + APPLICATION_PATH . '/configs/application.ini' +); +$application->bootstrap() + ->run();
\ No newline at end of file diff --git a/tests/application/bootstrap.php b/tests/application/bootstrap.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/application/bootstrap.php diff --git a/tests/library/bootstrap.php b/tests/library/bootstrap.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/library/bootstrap.php diff --git a/tests/phpunit.xml b/tests/phpunit.xml new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/phpunit.xml |