aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2015-03-17 07:40:13 +0100
committerChristian Weiske <cweiske@cweiske.de>2015-03-17 07:40:13 +0100
commite74217a7bbd58cf76963c15c73221669e1153510 (patch)
treebe9a61b9f61797602e494c0c591c268c8b906b0f
parentd0262203af0890dfc3c0128fd92e41ee03453456 (diff)
downloadgrauphel-e74217a7bbd58cf76963c15c73221669e1153510.tar.gz
grauphel-e74217a7bbd58cf76963c15c73221669e1153510.zip
show error message when oauth extension is missing
-rw-r--r--controller/guicontroller.php15
-rw-r--r--templates/error.php18
2 files changed, 31 insertions, 2 deletions
diff --git a/controller/guicontroller.php b/controller/guicontroller.php
index 127daaf..b09ef4a 100644
--- a/controller/guicontroller.php
+++ b/controller/guicontroller.php
@@ -59,7 +59,18 @@ class GuiController extends Controller
*/
public function index()
{
- $this->checkDeps();
+ try {
+ $this->checkDeps();
+ } catch (\Exception $e) {
+ $res = new TemplateResponse('grauphel', 'error');
+ $res->setParams(
+ array(
+ 'message' => $e->getMessage(),
+ 'code' => $e->getCode(),
+ )
+ );
+ return $res;
+ }
$res = new TemplateResponse('grauphel', 'index');
$res->setParams(
@@ -301,7 +312,7 @@ class GuiController extends Controller
protected function checkDeps()
{
if (!class_exists('OAuthProvider')) {
- throw new \Exception('PHP extension "oauth" is required');
+ throw new \Exception('PHP extension "oauth" is required', 1001);
}
}
diff --git a/templates/error.php b/templates/error.php
new file mode 100644
index 0000000..7ce4f8d
--- /dev/null
+++ b/templates/error.php
@@ -0,0 +1,18 @@
+<link rel="stylesheet" href="<?php p(OCP\Util::linkTo('grauphel','grauphel.css')); ?>" type="text/css"/>
+
+<div id="app-content" class="content">
+ <div>
+ <h1>grauphel - Tomboy notes server</h1>
+ <h2>Error</h2>
+ <p><?php p($_['message']); ?></p>
+ <?php if ($_['code'] == 1001) { ?>
+ <p>
+ You need to install the PHP PECL OAuth extension to make grauphel work.
+ See the
+ <a class="lined" href="http://cweiske.de/grauphel.htm#manual">
+ installation instructions</a>
+ for more information.
+ </p>
+ <?php } ?>
+ </div>
+</div>