Skip to content

Commit

Permalink
Pruned a bit too much
Browse files Browse the repository at this point in the history
We are stil using basic views of various utility scripts, so can't get
rid of endpoint yet.
  • Loading branch information
slusarz committed Oct 17, 2014
1 parent d9e62b4 commit a2f02d6
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
55 changes: 55 additions & 0 deletions imp/basic.php
@@ -0,0 +1,55 @@
<?php
/**
* IMP basic view.
*
* Base URL Parameters:
* - page: (string) The current page view.
*
* Copyright 2013-2014 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @copyright 2013-2014 Horde LLC
* @license http://www.horde.org/licenses/gpl GPL
* @package IMP
*/

require_once __DIR__ . '/lib/Application.php';

$vars = Horde_Variables::getDefaultVariables();
Horde_Registry::appInit('imp', array(
'impmode' => Horde_Registry::VIEW_BASIC,
'session_control' => ($vars->page == 'compose' ? 'netscape' : null),
'timezone' => in_array($vars->page, array('compose', 'mailbox', 'message'))
));

$class = 'IMP_Basic_' . Horde_String::ucfirst($vars->page);
if (!class_exists($class)) {
throw new IMP_Exception('Page not found: ' . $vars->page);
}

try {
$ob = new $class($vars);
} catch (Exception $e) {
if ($registry->getView() == $registry::VIEW_BASIC) {
$notification->push($e);
$ob = new IMP_Basic_Error($vars);
} else {
throw $e;
}
}

$status = $ob->status();

$page_output->header(array_merge(array(
'title' => $ob->title,
'view' => $registry::VIEW_BASIC
), $ob->header_params));

echo $status;
$ob->render();

$page_output->footer();
31 changes: 31 additions & 0 deletions imp/lib/Basic/Error.php
@@ -0,0 +1,31 @@
<?php
/**
* Copyright 2013-2014 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @category Horde
* @copyright 2013-2014 Horde LLC
* @license http://www.horde.org/licenses/gpl GPL
* @package IMP
*/

/**
* Used to dispay page when fatal error occurs in basic view.
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @copyright 2013-2014 Horde LLC
* @license http://www.horde.org/licenses/gpl GPL
* @package IMP
*/
class IMP_Basic_Error extends IMP_Basic_Base
{
/**
*/
protected function _init()
{
}

}

0 comments on commit a2f02d6

Please sign in to comment.