From 5591b177c3482e53f7d599e0ae64bd9329450178 Mon Sep 17 00:00:00 2001 From: Damien LASSERRE Date: Wed, 7 Sep 2011 10:38:03 +0000 Subject: [PATCH] --- sphinxPHP/.zfproject.xml | 86 +++++++++++++++++++ sphinxPHP/application/Bootstrap.php | 8 ++ sphinxPHP/application/configs/application.ini | 25 ++++++ .../controllers/AnalyseController.php | 18 ++++ .../controllers/ErrorController.php | 58 +++++++++++++ .../controllers/IndexController.php | 18 ++++ .../controllers/OptimisationController.php | 18 ++++ .../controllers/TestController.php | 18 ++++ .../views/scripts/analyse/index.phtml | 4 + .../views/scripts/error/error.phtml | 29 +++++++ .../views/scripts/index/index.phtml | 43 ++++++++++ .../views/scripts/optimisation/index.phtml | 4 + .../views/scripts/test/index.phtml | 4 + sphinxPHP/docs/README.txt | 30 +++++++ sphinxPHP/public/.htaccess | 7 ++ sphinxPHP/public/index.php | 26 ++++++ .../controllers/IndexControllerTest.php | 14 +++ sphinxPHP/tests/bootstrap.php | 18 ++++ sphinxPHP/tests/phpunit.xml | 17 ++++ 19 files changed, 445 insertions(+) create mode 100755 sphinxPHP/.zfproject.xml create mode 100755 sphinxPHP/application/Bootstrap.php create mode 100755 sphinxPHP/application/configs/application.ini create mode 100755 sphinxPHP/application/controllers/AnalyseController.php create mode 100755 sphinxPHP/application/controllers/ErrorController.php create mode 100755 sphinxPHP/application/controllers/IndexController.php create mode 100755 sphinxPHP/application/controllers/OptimisationController.php create mode 100755 sphinxPHP/application/controllers/TestController.php create mode 100755 sphinxPHP/application/views/scripts/analyse/index.phtml create mode 100755 sphinxPHP/application/views/scripts/error/error.phtml create mode 100755 sphinxPHP/application/views/scripts/index/index.phtml create mode 100755 sphinxPHP/application/views/scripts/optimisation/index.phtml create mode 100755 sphinxPHP/application/views/scripts/test/index.phtml create mode 100755 sphinxPHP/docs/README.txt create mode 100755 sphinxPHP/public/.htaccess create mode 100755 sphinxPHP/public/index.php create mode 100755 sphinxPHP/tests/application/controllers/IndexControllerTest.php create mode 100755 sphinxPHP/tests/bootstrap.php create mode 100755 sphinxPHP/tests/phpunit.xml diff --git a/sphinxPHP/.zfproject.xml b/sphinxPHP/.zfproject.xml new file mode 100755 index 0000000..a98fdb3 --- /dev/null +++ b/sphinxPHP/.zfproject.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sphinxPHP/application/Bootstrap.php b/sphinxPHP/application/Bootstrap.php new file mode 100755 index 0000000..613100c --- /dev/null +++ b/sphinxPHP/application/Bootstrap.php @@ -0,0 +1,8 @@ +_getParam('error_handler'); + + if (!$errors || !$errors instanceof ArrayObject) { + $this->view->message = 'You have reached the error page'; + return; + } + + 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); + $priority = Zend_Log::NOTICE; + $this->view->message = 'Page not found'; + break; + default: + // application error + $this->getResponse()->setHttpResponseCode(500); + $priority = Zend_Log::CRIT; + $this->view->message = 'Application error'; + break; + } + + // Log exception, if logger available + if ($log = $this->getLog()) { + $log->log($this->view->message, $priority, $errors->exception); + $log->log('Request Parameters', $priority, $errors->request->getParams()); + } + + // 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->hasResource('Log')) { + return false; + } + $log = $bootstrap->getResource('Log'); + return $log; + } + + +} + diff --git a/sphinxPHP/application/controllers/IndexController.php b/sphinxPHP/application/controllers/IndexController.php new file mode 100755 index 0000000..0c4fe03 --- /dev/null +++ b/sphinxPHP/application/controllers/IndexController.php @@ -0,0 +1,18 @@ +
+
+

View script for controller Analyse and script/action name index

+
\ No newline at end of file diff --git a/sphinxPHP/application/views/scripts/error/error.phtml b/sphinxPHP/application/views/scripts/error/error.phtml new file mode 100755 index 0000000..ce16ec0 --- /dev/null +++ b/sphinxPHP/application/views/scripts/error/error.phtml @@ -0,0 +1,29 @@ + + + + + Zend Framework Default Application + + +

An error occurred

+

message ?>

+ + exception)): ?> + +

Exception information:

+

+ Message: exception->getMessage() ?> +

+ +

Stack trace:

+
exception->getTraceAsString() ?>
+  
+ +

Request Parameters:

+
escape(var_export($this->request->getParams(), true)) ?>
+  
+ + + + + diff --git a/sphinxPHP/application/views/scripts/index/index.phtml b/sphinxPHP/application/views/scripts/index/index.phtml new file mode 100755 index 0000000..4b38f0a --- /dev/null +++ b/sphinxPHP/application/views/scripts/index/index.phtml @@ -0,0 +1,43 @@ + +
+

Welcome to the Zend Framework!

+ +

This is your project's main page

+ +
+

+

+ Helpful Links:
+ Zend Framework Website | + Zend Framework Manual +

+
+
\ No newline at end of file diff --git a/sphinxPHP/application/views/scripts/optimisation/index.phtml b/sphinxPHP/application/views/scripts/optimisation/index.phtml new file mode 100755 index 0000000..fc9f6e8 --- /dev/null +++ b/sphinxPHP/application/views/scripts/optimisation/index.phtml @@ -0,0 +1,4 @@ +

+
+

View script for controller Optimisation and script/action name index

+
\ No newline at end of file diff --git a/sphinxPHP/application/views/scripts/test/index.phtml b/sphinxPHP/application/views/scripts/test/index.phtml new file mode 100755 index 0000000..119102f --- /dev/null +++ b/sphinxPHP/application/views/scripts/test/index.phtml @@ -0,0 +1,4 @@ +

+
+

View script for controller Test and script/action name index

+
\ No newline at end of file diff --git a/sphinxPHP/docs/README.txt b/sphinxPHP/docs/README.txt new file mode 100755 index 0000000..30ea1fa --- /dev/null +++ b/sphinxPHP/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. + + + DocumentRoot "/home/divx/NetBeansProjects/sdsphinx/trunk/sphinxPHP/public" + ServerName sphinxPHP.local + + # This should be omitted in the production environment + SetEnv APPLICATION_ENV development + + + Options Indexes MultiViews FollowSymLinks + AllowOverride All + Order allow,deny + Allow from all + + + diff --git a/sphinxPHP/public/.htaccess b/sphinxPHP/public/.htaccess new file mode 100755 index 0000000..7fb009b --- /dev/null +++ b/sphinxPHP/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/sphinxPHP/public/index.php b/sphinxPHP/public/index.php new file mode 100755 index 0000000..a7ade9f --- /dev/null +++ b/sphinxPHP/public/index.php @@ -0,0 +1,26 @@ +bootstrap() + ->run(); \ No newline at end of file diff --git a/sphinxPHP/tests/application/controllers/IndexControllerTest.php b/sphinxPHP/tests/application/controllers/IndexControllerTest.php new file mode 100755 index 0000000..b63670f --- /dev/null +++ b/sphinxPHP/tests/application/controllers/IndexControllerTest.php @@ -0,0 +1,14 @@ +bootstrap = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); + parent::setUp(); + } + + +} + diff --git a/sphinxPHP/tests/bootstrap.php b/sphinxPHP/tests/bootstrap.php new file mode 100755 index 0000000..7022b5c --- /dev/null +++ b/sphinxPHP/tests/bootstrap.php @@ -0,0 +1,18 @@ + + + ./application + + + ./library + + + + + + +