Basic layout and login functioning
@ -1,4 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Auth_LDAP extends PLA_Auth_LDAP {}
|
||||
class Auth_LDAP extends PLA_Auth_Ldap {}
|
||||
?>
|
107
application/classes/Config.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class extends the core Kohana class by adding some core application
|
||||
* specific functions, and configuration.
|
||||
*
|
||||
* @package PLA
|
||||
* @subpackage Config
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
*/
|
||||
class Config extends Kohana_Config {
|
||||
// Our default logo, if there is no site logo
|
||||
public static $logo = 'img/logo-small.png';
|
||||
|
||||
/**
|
||||
* Some early initialisation
|
||||
*
|
||||
* At this point, KH hasnt been fully initialised either, so we cant rely on
|
||||
* too many KH functions yet.
|
||||
*
|
||||
* NOTE: Kohana doesnt provide a parent construct for the Kohana_Config class.
|
||||
*/
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the singleton instance of Config.
|
||||
*
|
||||
* $config = Config::instance();
|
||||
*
|
||||
* @return Config
|
||||
* @compat Restore KH 3.1 functionality
|
||||
*/
|
||||
public static function instance() {
|
||||
if (Config::$_instance === NULL)
|
||||
// Create a new instance
|
||||
Config::$_instance = new Config;
|
||||
|
||||
return Config::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return our caching mechanism
|
||||
*/
|
||||
public static function cachetype() {
|
||||
return is_null(Kohana::$config->load('config')->cache_type) ? 'file' : Kohana::$config->load('config')->cache_type;
|
||||
}
|
||||
|
||||
public static function copywrite() {
|
||||
return '(c) phpLDAPadmin Development Team';
|
||||
}
|
||||
|
||||
public static function country() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public static function language() {
|
||||
// @todo To implement
|
||||
return 'auto';
|
||||
}
|
||||
|
||||
/**
|
||||
* The URI to show for the login prompt.
|
||||
* Normally if the user is logged in, we can replace it with something else
|
||||
*/
|
||||
public static function login_uri() {
|
||||
return ($ao = Auth::instance()->get_user() AND is_object($ao)) ? $ao->name() : HTML::anchor('login',_('Login'));
|
||||
}
|
||||
|
||||
public static function logo() {
|
||||
return HTML::image(static::logo_uri(),array('class'=>'headlogo','alt'=>_('Logo')));
|
||||
}
|
||||
|
||||
public static function logo_uri($protocol=NULL) {
|
||||
list ($path,$suffix) = explode('.',static::$logo);
|
||||
|
||||
return URL::site(Route::get('default/media')->uri(array('file'=>$path.'.'.$suffix),array('alt'=>static::sitename())),$protocol);
|
||||
}
|
||||
|
||||
public static function siteid($format=FALSE) {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Work out our site mode (dev,test,prod)
|
||||
*/
|
||||
public static function sitemode() {
|
||||
return Kohana::$config->load('config.site')->mode;
|
||||
}
|
||||
|
||||
public static function sitename() {
|
||||
return 'phpLDAPadmin';
|
||||
}
|
||||
|
||||
public static function theme() {
|
||||
return Kohana::$config->load('config')->theme;
|
||||
}
|
||||
|
||||
public static function version() {
|
||||
// @todo Work out our versioning
|
||||
return 'TBA';
|
||||
}
|
||||
}
|
||||
?>
|
47
application/classes/Controller/TemplateDefault.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class provides the default template controller for rendering pages.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Page/Template
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
*/
|
||||
class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
|
||||
public function __construct(Request $request, Response $response) {
|
||||
if (Config::theme())
|
||||
$this->template = Config::theme().'/page';
|
||||
|
||||
return parent::__construct($request,$response);
|
||||
}
|
||||
|
||||
protected function _headimages() {
|
||||
// This is where we should be able to change our country
|
||||
// @todo To implement
|
||||
$co = Config::country();
|
||||
/*
|
||||
HeadImages::add(array(
|
||||
'img'=>sprintf('img/country/%s.png',strtolower($co->two_code)),
|
||||
'attrs'=>array('onclick'=>"target='_blank';",'title'=>$co->display('name'))
|
||||
));
|
||||
*/
|
||||
|
||||
return HeadImages::factory();
|
||||
}
|
||||
|
||||
protected function _left() {
|
||||
if ($this->template->left)
|
||||
return $this->template->left;
|
||||
|
||||
elseif (Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__))
|
||||
return Controller_Tree::js();
|
||||
}
|
||||
|
||||
protected function _right() {
|
||||
return empty($this->template->right) ? '' : $this->template->right;
|
||||
}
|
||||
}
|
||||
?>
|
@ -9,7 +9,7 @@
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
*/
|
||||
class PLA_Auth_LDAP extends Auth {
|
||||
class PLA_Auth_Ldap extends Auth {
|
||||
// Unnused required abstract functions
|
||||
public function password($username) {}
|
||||
public function check_password($password) {}
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
abstract class PLA_Block extends HTMLRender {
|
||||
protected static $_data = array();
|
||||
protected static $_spacer = '<table><tr class="spacer"><td> </td></tr></table>';
|
||||
protected static $_required_keys = array('body');
|
||||
|
||||
/**
|
||||
@ -52,28 +51,13 @@ abstract class PLA_Block extends HTMLRender {
|
||||
*/
|
||||
protected function render() {
|
||||
$output = '';
|
||||
$styles = array();
|
||||
|
||||
$i = 0;
|
||||
foreach (static::$_data as $value) {
|
||||
if ($i++)
|
||||
$output .= static::$_spacer;
|
||||
|
||||
$output .= '<table class="block" border="0">';
|
||||
|
||||
if (! empty($value['title']))
|
||||
$output .= sprintf('<tr class="title"><td>%s</td></tr>',$value['title']);
|
||||
|
||||
if (! empty($value['subtitle']))
|
||||
$output .= sprintf('<tr class="subtitle"><td>%s</td></tr>',$value['subtitle']);
|
||||
|
||||
$output .= sprintf('<tr class="body"><td>%s</td></tr>',$value['body']);
|
||||
|
||||
if (! empty($value['footer']))
|
||||
$output .= sprintf('<tr class="footer"><td>%s</td></tr>',$value['footer']);
|
||||
|
||||
$output .= '</table>';
|
||||
}
|
||||
foreach (static::$_data as $value)
|
||||
$output .= View::factory(Kohana::Config('config.theme').'/block')
|
||||
->set('title',empty($value['title']) ? '' : $value['title'])
|
||||
->set('subtitle',empty($value['subtitle']) ? '' : $value['subtitle'])
|
||||
->set('body',empty($value['body']) ? '' : $value['body'])
|
||||
->set('footer',empty($value['footer']) ? '' : $value['footer']);
|
||||
|
||||
return $output;
|
||||
}
|
@ -15,7 +15,7 @@ abstract class PLA_Controller_Template extends Kohana_Controller_Template {
|
||||
private $meta;
|
||||
|
||||
public function __construct(Request $request, Response $response) {
|
||||
$this->template = Kohana::Config('config.theme');
|
||||
$this->template = Kohana::$config->load('config')->theme;
|
||||
|
||||
return parent::__construct($request,$response);
|
||||
}
|
||||
@ -38,14 +38,14 @@ abstract class PLA_Controller_Template extends Kohana_Controller_Template {
|
||||
$this->template->content = '';
|
||||
|
||||
// Setup the page template
|
||||
$this->meta = new meta;
|
||||
$this->meta = new Meta;
|
||||
View::bind_global('meta',$this->meta);
|
||||
}
|
||||
|
||||
public function after() {
|
||||
if ($this->auto_render === TRUE) {
|
||||
// Application Title
|
||||
$this->meta->title = Kohana::Config('config.appname');
|
||||
$this->meta->title = Kohana::$config->load('config')->appname;
|
||||
|
||||
// Language
|
||||
// @todo
|
||||
@ -80,7 +80,6 @@ abstract class PLA_Controller_Template extends Kohana_Controller_Template {
|
||||
|
||||
// Our default script(s)
|
||||
foreach (array('file'=>array_reverse(array(
|
||||
'js/jquery-1.6.4.min.js',
|
||||
))) as $type => $datas) {
|
||||
|
||||
foreach ($datas as $data) {
|
||||
@ -91,12 +90,6 @@ abstract class PLA_Controller_Template extends Kohana_Controller_Template {
|
||||
}
|
||||
}
|
||||
|
||||
// Add our logo
|
||||
Style::add(array(
|
||||
'type'=>'stdin',
|
||||
'data'=>'h1 span{background:url('.Config::logo_uri().') no-repeat;}',
|
||||
));
|
||||
|
||||
// For any ajax rendered actions, we'll need to capture the content and put it in the response
|
||||
// @todo
|
||||
} elseif ($this->request->is_ajax() && isset($this->template->content) && ! $this->response->body()) {
|
@ -91,7 +91,7 @@ abstract class PLA_Database_LDAP_Search_Builder_Query extends Database_Query_Bui
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function compile(Database $db) {
|
||||
public function compile($db = NULL) {
|
||||
$filter = '';
|
||||
|
||||
return $this->_compile_conditions($db,$this->_where);
|
31
application/classes/PLA/Exception.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class extends the core Kohana exception handling
|
||||
*
|
||||
* @package PLA
|
||||
* @category Exceptions
|
||||
* @author Deon George
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
*/
|
||||
class PLA_Exception extends Kohana_Exception {
|
||||
public function __construct($message, array $variables = NULL, $code = 0) {
|
||||
parent::__construct($message,$variables,$code);
|
||||
|
||||
switch ($code) {
|
||||
case '400':
|
||||
SystemMessage::add('warn',$message);
|
||||
Request::current()->redirect('login');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
echo debug::vars(array('m'=>$message,'v'=>$variables,'c'=>$code,'t'=>$this));die();
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
echo __METHOD__;die();
|
||||
}
|
||||
}
|
||||
?>
|
65
application/classes/PLA/SystemMessage.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is for rendering PLA System Messages
|
||||
*
|
||||
* It will provide a header, body and footer.
|
||||
*
|
||||
* @package PLA
|
||||
* @subpackage Page
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
* @uses Style
|
||||
*/
|
||||
abstract class PLA_SystemMessage extends HTMLRender {
|
||||
protected static $_data = array();
|
||||
protected static $_required_keys = array('body');
|
||||
|
||||
/**
|
||||
* Add a block to be rendered
|
||||
*
|
||||
* @param array Block attributes
|
||||
*/
|
||||
public static function add($block,$prepend=FALSE) {
|
||||
parent::add($block);
|
||||
|
||||
// Detect any style sheets.
|
||||
if (! empty($block['style']) && is_array($block['style']))
|
||||
foreach ($block['style'] as $data=>$media)
|
||||
Style::add(array(
|
||||
'type'=>'file',
|
||||
'data'=>$data,
|
||||
'media'=>$media,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of this class
|
||||
*
|
||||
* @return Block
|
||||
*/
|
||||
public static function factory() {
|
||||
return new SystemMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render this block
|
||||
*
|
||||
* @see HTMLRender::render()
|
||||
*/
|
||||
protected function render() {
|
||||
$output = '';
|
||||
|
||||
foreach (static::$_data as $value)
|
||||
$output .= View::factory(Kohana::Config('config.theme').'/block')
|
||||
->set('title',empty($value['title']) ? '' : $value['title'])
|
||||
->set('subtitle',empty($value['subtitle']) ? '' : $value['subtitle'])
|
||||
->set('body',empty($value['body']) ? '' : $value['body'])
|
||||
->set('footer',empty($value['footer']) ? '' : $value['footer']);
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,4 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Config extends PLA_Config {}
|
||||
class SystemMessage extends PLA_SystemMessage {}
|
||||
?>
|
51
application/classes/URL.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class overrides Kohana's URL
|
||||
*
|
||||
* @package OSB/Modifications
|
||||
* @category Classes
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
*/
|
||||
class URL extends Kohana_URL {
|
||||
// Our method paths for different functions
|
||||
public static $method_directory = array(
|
||||
'user'=>'',
|
||||
);
|
||||
|
||||
/**
|
||||
* Wrapper to provide a URL::site() link based on function
|
||||
*/
|
||||
public static function link($dir,$src,$site=FALSE) {
|
||||
if (! $dir)
|
||||
return $src;
|
||||
|
||||
if (! array_key_exists($dir,URL::$method_directory))
|
||||
throw new Kohana_Exception('Unknown directory :dir for :src',array(':dir'=>$dir,':src'=>$src));
|
||||
|
||||
$x = URL::$method_directory[$dir].'/'.$src;
|
||||
|
||||
return $site ? URL::site($x) : $x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to reveal the real directory for a URL
|
||||
*/
|
||||
public static function dir($dir) {
|
||||
// Quick check if we can do something here
|
||||
if (! in_array(strtolower($dir),URL::$method_directory))
|
||||
return $dir;
|
||||
|
||||
// OK, we can, find it.
|
||||
foreach (URL::$method_directory as $k=>$v)
|
||||
if (strtolower($dir) == $v)
|
||||
return ucfirst($k);
|
||||
|
||||
// If we get here, we didnt have anything.
|
||||
return $dir;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,4 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Controller_Login extends PLA_Controller_Login {}
|
||||
?>
|
@ -1,4 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Controller_Logout extends PLA_Controller_Logout {}
|
||||
?>
|
@ -1,4 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Controller_Media extends PLA_Controller_Media {}
|
||||
?>
|
@ -1,4 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class HTMLRender extends PLA_HTMLRender {}
|
||||
?>
|
@ -1,4 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Meta extends PLA_Meta {}
|
||||
?>
|
@ -1,105 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class extends the core Kohana class by adding some core application
|
||||
* specific functions, and configuration.
|
||||
*
|
||||
* @package PLA
|
||||
* @subpackage Config
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
*/
|
||||
abstract class PLA_Config extends Kohana_Config {
|
||||
protected static $logo = 'img/logo-small.png';
|
||||
|
||||
/**
|
||||
* Some early initialisation
|
||||
*
|
||||
* At this point, KH hasnt been fully initialised either, so we cant rely on
|
||||
* too many KH functions yet.
|
||||
* NOTE: Kohana doesnt provide a parent construct for the Kohana_Config class.
|
||||
*/
|
||||
public function __construct() {
|
||||
if (Kohana::$is_cli) {
|
||||
if (! $site = CLI::options('site'))
|
||||
throw new Kohana_Exception(_('Cant figure out the site, use --site= for CLI'));
|
||||
else
|
||||
$_SERVER['SERVER_NAME'] = $site['site'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return our site name
|
||||
*/
|
||||
public static function site() {
|
||||
return $_SERVER['SERVER_NAME'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Work out our site ID for multiehosting
|
||||
*/
|
||||
public static function siteid() {
|
||||
return Kohana::Config('config.site.id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Work out our site mode (dev,test,prod)
|
||||
*/
|
||||
public static function sitemode() {
|
||||
return Kohana::Config('config.site.mode');
|
||||
}
|
||||
|
||||
public static function sitemodeverbose() {
|
||||
$modes = array(
|
||||
Kohana::PRODUCTION=>'Production',
|
||||
Kohana::STAGING=>'Staging',
|
||||
Kohana::TESTING=>'Testing',
|
||||
Kohana::DEVELOPMENT=>'Development',
|
||||
);
|
||||
|
||||
return (! isset($modes[static::sitemode()])) ? 'Unknown' : $modes[static::sitemode()];
|
||||
}
|
||||
|
||||
public static function submode() {
|
||||
$submode = Kohana::Config('config.debug.submode');
|
||||
|
||||
return (isset($submode[Request::$client_ip])) ? $submode[Request::$client_ip] : FALSE;
|
||||
}
|
||||
|
||||
public static function sitename() {
|
||||
return Kohana::Config('config.site.name');
|
||||
}
|
||||
|
||||
// Called in Invoice/Emailing to embed the file.
|
||||
public static function logo_file() {
|
||||
list ($path,$suffix) = explode('.',static::$logo);
|
||||
return Kohana::find_file(sprintf('media/%s',Config::siteid()),$path,$suffix);
|
||||
}
|
||||
|
||||
public static function logo_uri() {
|
||||
list ($path,$suffix) = explode('.',static::$logo);
|
||||
return URL::site(Route::get('default/media')->uri(array('file'=>$path.'.'.$suffix),array('alt'=>static::sitename())),'http');
|
||||
}
|
||||
|
||||
public static function logo() {
|
||||
return HTML::image(static::logo_uri(),array('class'=>'headlogo','alt'=>_('Logo')));
|
||||
}
|
||||
|
||||
public static function login_uri() {
|
||||
return ($ao = Auth::instance()->get_user()) ? $ao->name() : HTML::anchor('login',_('Login'));
|
||||
}
|
||||
|
||||
public static function copywrite() {
|
||||
return '(c) phpLDAPadmin Development Team';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return our caching mechanism
|
||||
*/
|
||||
public static function cachetype() {
|
||||
return is_null(Kohana::config('config.cache_type')) ? 'file' : Kohana::config('config.cache_type');
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,200 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class provides login capability
|
||||
*
|
||||
* @package PLA
|
||||
* @subpackage Page/Login
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
* @also [logout]
|
||||
*/
|
||||
class PLA_Controller_Login extends Controller_Template {
|
||||
protected $auth_required = FALSE;
|
||||
|
||||
public function action_index() {
|
||||
// If user already signed-in
|
||||
if (Auth::instance()->logged_in()!= 0) {
|
||||
// Redirect to the user account
|
||||
Request::current()->redirect('user/welcome');
|
||||
}
|
||||
|
||||
// If there is a post and $_POST is not empty
|
||||
if ($_POST) {
|
||||
//echo debug::vars(array('p'=>$_POST,'ai'=>Auth::instance()));die();
|
||||
// Store our details in a session key
|
||||
Session::instance()->set('login',$_POST['username']);
|
||||
Session::instance()->set('password',$_POST['password']);
|
||||
|
||||
// If the post data validates using the rules setup in the user model
|
||||
if (Auth::instance()->login($_POST['username'],$_POST['password'])) {
|
||||
// Redirect to the user account
|
||||
if ($redir = Session::instance()->get('afterlogin')) {
|
||||
Session::instance()->delete('afterlogin');
|
||||
Request::current()->redirect($redir);
|
||||
|
||||
} else
|
||||
Request::current()->redirect('user/welcome');
|
||||
|
||||
} else {
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Invalid username or password'),
|
||||
'type'=>'error',
|
||||
'body'=>_('The username or password was invalid.')
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Block::add(array(
|
||||
'title'=>_('Login to server'),
|
||||
'body'=>View::factory('login'),
|
||||
'style'=>array('css/login.css'=>'screen'),
|
||||
));
|
||||
|
||||
Script::add(array('type'=>'stdin','data'=>'
|
||||
$(document).ready(function() {
|
||||
$("#ajxbody").click(function() {$("#ajBODY").load("'.$this->request->uri().'/"); return false;});
|
||||
});'
|
||||
));
|
||||
}
|
||||
|
||||
public function action_register() {
|
||||
// If user already signed-in
|
||||
if (Auth::instance()->logged_in()!= 0) {
|
||||
// Redirect to the user account
|
||||
Request::current()->redirect('welcome/index');
|
||||
}
|
||||
|
||||
// Instantiate a new user
|
||||
$account = ORM::factory('account');
|
||||
|
||||
// If there is a post and $_POST is not empty
|
||||
if ($_POST) {
|
||||
// Check Auth
|
||||
$status = $account->values($_POST)->check();
|
||||
|
||||
if (! $status) {
|
||||
foreach ($account->validation()->errors('form/register') as $f => $r) {
|
||||
// $r[0] has our reason for validation failure
|
||||
switch ($r[0]) {
|
||||
// Generic validation reason
|
||||
default:
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Validation failed'),
|
||||
'type'=>'error',
|
||||
'body'=>sprintf(_('The defaults on your submission were not valid for field %s (%s).'),$f,$r)
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ido = ORM::factory('module')
|
||||
->where('name','=','account')
|
||||
->find();
|
||||
|
||||
$account->id = $ido->record_id->next_id($ido->id);
|
||||
// Save the user details
|
||||
if ($account->save()) {}
|
||||
|
||||
}
|
||||
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Already have an account?'),
|
||||
'type'=>'info',
|
||||
'body'=>_('If you already have an account, please login..')
|
||||
));
|
||||
|
||||
Block::add(array(
|
||||
'title'=>_('Register'),
|
||||
'body'=>View::factory('bregister')
|
||||
->set('account',$account)
|
||||
->set('errors',$account->validation()->errors('form/register')),
|
||||
));
|
||||
|
||||
$this->template->left = HTML::anchor('login','Login').'...';
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable user password reset
|
||||
*/
|
||||
public function action_reset() {
|
||||
// If user already signed-in
|
||||
if (Auth::instance()->logged_in()!= 0) {
|
||||
// Redirect to the user account
|
||||
Request::current()->redirect('welcome/index');
|
||||
}
|
||||
|
||||
// If the user posted their details to reset their password
|
||||
if ($_POST) {
|
||||
// If the email address is correct, create a method token
|
||||
if (! empty($_POST['email']) AND ($ao=ORM::factory('account',array('email'=>$_POST['email']))) AND $ao->loaded()) {
|
||||
$mt = ORM::factory('module_method_token');
|
||||
|
||||
// Find out our password reset method id
|
||||
// @todo move this to a more generic method, so that it can be called by other methods
|
||||
$mo = ORM::factory('module',array('name'=>'account'));
|
||||
$mmo = ORM::factory('module_method',array('name'=>'user_resetpassword','module_id'=>$mo->id));
|
||||
|
||||
// Check to see if there is already a token, if so, do nothing.
|
||||
if ($mt->where('account_id','=',$ao->id)->and_where('method_id','=',$mmo->id)->find()) {
|
||||
if ($mt->date_expire < time()) {
|
||||
$mt->delete();
|
||||
$mt->clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (! $mt->loaded()) {
|
||||
$mt->account_id = $ao->id;
|
||||
$mt->method_id = $mmo->id;
|
||||
$mt->date_expire = time() + 15*3600;
|
||||
$mt->token = md5(sprintf('%s:%s:%s',$mt->account_id,$mt->method_id,$mt->date_expire));
|
||||
$mt->save();
|
||||
|
||||
// Send our email with the token
|
||||
$et = EmailTemplate::instance('account_reset_password');
|
||||
$et->to = array($mt->account->email=>sprintf('%s %s',$mt->account->first_name,$mt->account->last_name));
|
||||
$et->variables = array(
|
||||
'SITE'=>URL::base(TRUE,TRUE),
|
||||
'SITE_ADMIN'=>Config::sitename(),
|
||||
'SITE_NAME'=>Config::sitename(),
|
||||
'TOKEN'=>$mt->token,
|
||||
'USER_NAME'=>sprintf('%s %s',$mt->account->first_name,$mt->account->last_name),
|
||||
);
|
||||
$et->send();
|
||||
}
|
||||
|
||||
// Redirect to our password reset, the Auth will validate the token.
|
||||
} elseif (! empty($_REQUEST['token'])) {
|
||||
Request::current()->redirect(sprintf('user/account/resetpassword?token=%s',$_REQUEST['token']));
|
||||
}
|
||||
|
||||
// Show our token screen even if the email was invalid.
|
||||
if (isset($_POST['email']))
|
||||
Block::add(array(
|
||||
'title'=>_('Reset your password'),
|
||||
'body'=>View::factory('login_reset_sent'),
|
||||
'style'=>array('css/login.css'=>'screen'),
|
||||
));
|
||||
else
|
||||
Request::current()->redirect('login');
|
||||
|
||||
} else {
|
||||
Block::add(array(
|
||||
'title'=>_('Reset your password'),
|
||||
'body'=>View::factory('login_reset'),
|
||||
'style'=>array('css/login.css'=>'screen'),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public function action_noaccess() {
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('No access to requested resource'),
|
||||
'type'=>'error',
|
||||
'body'=>_('You do not have access to the requested resource, please contact your administrator.')
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,26 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class provides logout capability
|
||||
*
|
||||
* @package PLA
|
||||
* @subpackage Page/Logout
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
* @also [login]
|
||||
*/
|
||||
class PLA_Controller_Logout extends Controller {
|
||||
public function action_index() {
|
||||
# If user already signed-in
|
||||
if (Auth::instance()->logged_in()!= 0) {
|
||||
Auth::instance()->logout();
|
||||
|
||||
Request::current()->redirect('login');
|
||||
}
|
||||
|
||||
Request::current()->redirect('welcome/index');
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,59 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class provides access to rendering media items (javascript, images and css).
|
||||
*
|
||||
* @package PLA
|
||||
* @subpackage Page/Media
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
*/
|
||||
abstract class PLA_Controller_Media extends Controller {
|
||||
/**
|
||||
* This action will render all the media related files for a page
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function action_get() {
|
||||
// Get the file path from the request
|
||||
$file = $this->request->param('file');
|
||||
|
||||
// Find the file extension
|
||||
$ext = pathinfo($file,PATHINFO_EXTENSION);
|
||||
|
||||
// Remove the extension from the filename
|
||||
$file = substr($file,0,-(strlen($ext)+1));
|
||||
$f = '';
|
||||
|
||||
// If our file is pathed with session, our file is in our session.
|
||||
if ($fd = Session::instance()->get_once($this->request->param('file'))) {
|
||||
$this->response->body($fd);
|
||||
|
||||
// If not found try a default media file
|
||||
} elseif ($f = Kohana::find_file('media/'.Kohana::Config('config.theme'),$file,$ext)) {
|
||||
// Send the file content as the response
|
||||
$this->response->body(file_get_contents($f));
|
||||
|
||||
// If not found try a default media file
|
||||
} elseif ($f = Kohana::find_file('media',$file,$ext)) {
|
||||
// Send the file content as the response
|
||||
$this->response->body(file_get_contents($f));
|
||||
|
||||
} else {
|
||||
// Return a 404 status
|
||||
$this->response->status(404);
|
||||
}
|
||||
|
||||
// Generate and check the ETag for this file
|
||||
if (Kohana::$environment === Kohana::PRODUCTION)
|
||||
$this->response->check_cache(NULL,$this->request);
|
||||
|
||||
// Set the proper headers to allow caching
|
||||
$this->response->headers('Content-Type',File::mime_by_ext($ext));
|
||||
$this->response->headers('Content-Length',(string)$this->response->content_length());
|
||||
$this->response->headers('Last-Modified',date('r', $f ? filemtime($f) : time()));
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,92 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is the base used for common static methods that are used
|
||||
* for rendering.
|
||||
*
|
||||
* @package PLA
|
||||
* @subpackage Page
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
*/
|
||||
abstract class PLA_HTMLRender {
|
||||
protected static $_media_path = 'default/media';
|
||||
protected static $_required_keys = array();
|
||||
protected static $_unique_vals = array();
|
||||
|
||||
public function __construct() {
|
||||
if (! isset(static::$_data))
|
||||
throw new Kohana_Exception(':class is missing important static variables',array(':class'=>get_called_class()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an item to be rendered
|
||||
*
|
||||
* @param array Item to be added
|
||||
*/
|
||||
public static function add($item,$prepend=FALSE) {
|
||||
foreach (static::$_required_keys as $key)
|
||||
if (! isset($item[$key]))
|
||||
throw new Kohana_Exception('Missing key :key for image',array(':key'=>$key));
|
||||
|
||||
// Check for unique keys
|
||||
if (static::$_unique_vals)
|
||||
foreach (static::$_unique_vals as $v=>$u)
|
||||
foreach (static::$_data as $d)
|
||||
if (isset($d[$u]) && $d['data'] == $item['data'])
|
||||
return;
|
||||
|
||||
if ($prepend)
|
||||
array_unshift(static::$_data,$item);
|
||||
else
|
||||
array_push(static::$_data,$item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the space used between rendering output
|
||||
*/
|
||||
public static function setSpacer($spacer) {
|
||||
static::$_spacer = $spacer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Kohana Media Path, used to determine where to find additional
|
||||
* HTML content required for rendering.
|
||||
*/
|
||||
public static function setMediaPath($path) {
|
||||
static::$_media_path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory instance method must be declared by the child class
|
||||
*/
|
||||
public static function factory() {
|
||||
throw new Kohana_Exception(':class is calling :method, when it should have its own method',
|
||||
array(':class'=>get_called_class(),':method'=>__METHOD__));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the HTML to render the header images
|
||||
*/
|
||||
public function __toString() {
|
||||
try {
|
||||
return static::render();
|
||||
}
|
||||
|
||||
// Display the exception message
|
||||
catch (Exception $e) {
|
||||
Kohana_Exception::handler($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rendering must be declared by the child class
|
||||
*/
|
||||
protected function render() {
|
||||
throw new Kohana_Exception(':class is calling :method, when it should have its own method',
|
||||
array(':class'=>get_called_class(),':method'=>__METHOD__));
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,34 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This is class is for all HTML page attributes.
|
||||
*
|
||||
* @package PLA
|
||||
* @subpackage Page
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
*/
|
||||
abstract class PLA_Meta {
|
||||
private $_data = array();
|
||||
private $_array_keys = array();
|
||||
|
||||
public function __get($key) {
|
||||
if (in_array($key,$this->_array_keys) && empty($this->_data[$key]))
|
||||
return array();
|
||||
|
||||
if (empty($this->_data[$key]))
|
||||
return null;
|
||||
else
|
||||
return $this->_data[$key];
|
||||
}
|
||||
|
||||
public function __set($key,$value) {
|
||||
if (in_array($key,$this->_array_keys) && ! is_array($value))
|
||||
throw new Kohana_Exception('Key :key must be an array',array(':key'=>$key));
|
||||
|
||||
$this->_data[$key] = $value;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,53 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is for rendering HTML script tags
|
||||
*
|
||||
* @package PLA
|
||||
* @subpackage Page
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
*/
|
||||
abstract class PLA_Script extends HTMLRender {
|
||||
protected static $_data = array();
|
||||
protected static $_spacer = "\n";
|
||||
protected static $_required_keys = array('type','data');
|
||||
protected static $_unique_vals = array('file'=>'type');
|
||||
|
||||
/**
|
||||
* Return an instance of this class
|
||||
*
|
||||
* @return Script
|
||||
*/
|
||||
public static function factory() {
|
||||
return new Script;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the script tag
|
||||
*
|
||||
* @see HTMLRender::render()
|
||||
*/
|
||||
protected function render() {
|
||||
$foutput = $soutput = '';
|
||||
$mediapath = Route::get(static::$_media_path);
|
||||
|
||||
foreach (static::$_data as $value) {
|
||||
switch ($value['type']) {
|
||||
case 'file':
|
||||
$foutput .= HTML::script($mediapath->uri(array('file'=>$value['data'])));
|
||||
break;
|
||||
case 'stdin':
|
||||
$soutput .= sprintf("<script type=\"text/javascript\">//<![CDATA[\n%s\n//]]></script>",$value['data']);
|
||||
break;
|
||||
default:
|
||||
throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type']));
|
||||
}
|
||||
}
|
||||
|
||||
return $foutput.static::$_spacer.$soutput;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,54 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is for rendering HTML style tags
|
||||
*
|
||||
* @package PLA
|
||||
* @subpackage Page
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
*/
|
||||
abstract class PLA_Style extends HTMLRender {
|
||||
protected static $_data = array();
|
||||
protected static $_spacer = "\n";
|
||||
protected static $_required_keys = array('type','data');
|
||||
protected static $_unique_vals = array('file'=>'type');
|
||||
|
||||
/**
|
||||
* Return an instance of this class
|
||||
*
|
||||
* @return Style
|
||||
*/
|
||||
public static function factory() {
|
||||
return new Style;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the style tag
|
||||
*
|
||||
* @see HTMLRender::render()
|
||||
*/
|
||||
protected function render() {
|
||||
$foutput = $soutput = '';
|
||||
$mediapath = Route::get(static::$_media_path);
|
||||
|
||||
foreach (static::$_data as $value) {
|
||||
switch ($value['type']) {
|
||||
case 'file':
|
||||
$foutput .= HTML::style($mediapath->uri(array('file'=>$value['data'])),
|
||||
array('media'=>(! empty($value['media'])) ? $value['media'] : 'screen'),TRUE);
|
||||
break;
|
||||
case 'stdin':
|
||||
$soutput .= sprintf("<style type=\"text/css\">%s</style>",$value['data']);
|
||||
break;
|
||||
default:
|
||||
throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type']));
|
||||
}
|
||||
}
|
||||
|
||||
return $foutput.static::$_spacer.$soutput;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,4 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Script extends PLA_Script {}
|
||||
?>
|
@ -1,4 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Style extends PLA_Style {}
|
||||
?>
|
@ -17,5 +17,6 @@ return array(
|
||||
'lifetime' => 1209600,
|
||||
// 'session_key' => 'auth_user',
|
||||
// 'forced_key' => 'auth_forced',
|
||||
'pwreset' => FALSE,
|
||||
);
|
||||
?>
|
||||
|
@ -10,15 +10,14 @@
|
||||
* @copyright (c) phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
*/
|
||||
|
||||
return array(
|
||||
// Our application name, as shown in the title bar of pages
|
||||
'appname' => 'phpLDAPadmin - LDAP Administration',
|
||||
'appname' => 'phpLDAPadmin - LDAP Administration', // Our application name, as shown in the title bar of pages
|
||||
'method_security' => FALSE, // Enables Method Security. Setting to false means any method can be run without authentication
|
||||
// Our mode level (PRODUCTION, STAGING, TESTING, DEVELOPMENT) - see [Kohana]
|
||||
'mode' => Kohana::PRODUCTION,
|
||||
'site' => array(
|
||||
'name'=>'phpLDAPadmin',
|
||||
),
|
||||
// Our custom theme
|
||||
'theme' => 'original',
|
||||
'loginpage' => 'welcome',
|
||||
'theme' => 'claro',
|
||||
);
|
||||
?>
|
||||
|
24
application/config/debug.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* PLA Configuration - Debug Settings
|
||||
*
|
||||
* @package PLA
|
||||
* @subpackage Debug
|
||||
* @category Configuration
|
||||
* @author Deon George
|
||||
* @copyright (c) 2013 phpLDAPadmin Development Team
|
||||
* @license http://dev.phpldapadmin.org/license.html
|
||||
*/
|
||||
|
||||
return array
|
||||
(
|
||||
'ajax'=>FALSE, // AJAX actions can only be run by ajax calls if set to FALSE
|
||||
'etag'=>FALSE, // Force generating ETAGS
|
||||
'checkout_notify'=>FALSE, // Test mode to test a particular checkout_notify item
|
||||
'invoice'=>0, // Number of invoices to generate in a pass
|
||||
'site'=>FALSE, // Glogal site debug
|
||||
'show_inactive'=>FALSE, // Show Inactive Items
|
||||
'task_sim'=>FALSE, // Simulate running tasks
|
||||
);
|
||||
?>
|
23
application/config/userguide.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php defined('SYSPATH') or die('No direct script access.');
|
||||
|
||||
return array(
|
||||
// Leave this alone
|
||||
'modules' => array(
|
||||
|
||||
// This should be the path to this modules userguide pages, without the 'guide/'. Ex: '/guide/modulename/' would be 'modulename'
|
||||
'pla' => array(
|
||||
|
||||
// Whether this modules userguide pages should be shown
|
||||
'enabled' => TRUE,
|
||||
|
||||
// The name that should show up on the userguide index page
|
||||
'name' => 'phpLDAPadmin',
|
||||
|
||||
// A short description of this module, shown on the index page
|
||||
'description' => 'phpLDAPadmin API guide.',
|
||||
|
||||
// Copyright message, shown in the footer for this module
|
||||
'copyright' => '© 2008–2010 phpLDAPadmin Developer Team',
|
||||
)
|
||||
)
|
||||
);
|
Before Width: | Height: | Size: 902 B After Width: | Height: | Size: 902 B |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
1
application/media/notimplemented.txt
Normal file
@ -0,0 +1 @@
|
||||
This hasnt been implemented yet!
|
Before Width: | Height: | Size: 519 B After Width: | Height: | Size: 519 B |
Before Width: | Height: | Size: 654 B After Width: | Height: | Size: 654 B |
95
application/media/theme/claro/css/style.css
Normal file
@ -0,0 +1,95 @@
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.claro #appLayout {
|
||||
height: 100%;
|
||||
}
|
||||
.claro #appHeader {
|
||||
border: 0px;
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
.claro #appControl {
|
||||
border-top: 1px #AAAACC solid;
|
||||
border-bottom: 0;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
.claro #appLeft {
|
||||
border: 1px #AAAACC solid;
|
||||
width: 14em;
|
||||
}
|
||||
.claro #appBody {
|
||||
border: 1px #AAAACC solid;
|
||||
padding: 0;
|
||||
}
|
||||
.claro #appStatus {
|
||||
display: none;
|
||||
}
|
||||
.claro #appContent {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.claro #appFooter {
|
||||
border-top: 1px #AAAACC solid;
|
||||
border-bottom: 0;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
padding-top: 3px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
.claro .headlogo {
|
||||
border: 0px;
|
||||
}
|
||||
.claro .foottext {
|
||||
text-align: right;
|
||||
font-size: 75%;
|
||||
font-weight: bold;
|
||||
}
|
||||
/* Login Box */
|
||||
.claro table.login {
|
||||
background-color: #FAFAFF;
|
||||
border: 1px #AAAACC solid;
|
||||
padding: 5px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
.claro table.login .username {
|
||||
background: url('image/ldap-uid.png') no-repeat 0 1px;
|
||||
background-color: #FAFAFF;
|
||||
color: #500000;
|
||||
padding-left: 17px;
|
||||
}
|
||||
|
||||
.claro table.login .username:focus {
|
||||
background-color: #F0F0FF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.claro table.login .username:disabled {
|
||||
background-color: #DDDDFF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.claro table.login .password {
|
||||
background: url('image/key.png') no-repeat 0 1px;
|
||||
background-color: #FAFAFF;
|
||||
color: #000000;
|
||||
padding-left: 17px;
|
||||
}
|
||||
|
||||
.claro table.login .password:focus {
|
||||
background-color: #F0F0FF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.claro table.login .password:disabled {
|
||||
background-color: #DDDDFF;
|
||||
color: #000000;
|
||||
}
|
83
application/views/claro.php
Normal file
@ -0,0 +1,83 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<!-- DOJO claro Template Layout -->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="auto" lang="auto">
|
||||
<head>
|
||||
<title><?php echo $meta->title; ?></title>
|
||||
<link rel="shortcut icon" href="<?php echo $meta->shortcut_icon ? $meta->shortcut_icon : URL::Site('media/img/favicon.ico'); ?>" type="image/vnd.microsoft.icon" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="Content-Language" content="<?php echo $meta->language; ?>" />
|
||||
<meta name="keywords" content="<?php echo $meta->keywords; ?>" />
|
||||
<meta name="description" content="<?php echo $meta->description; ?>" />
|
||||
<meta name="copyright" content="<?php echo Config::copywrite(); ?>" />
|
||||
<!-- Load dojo and provide config via data attribute -->
|
||||
<?php echo HTML::Style('media/js/dojo-release-1.7.2/dijit/themes/claro/claro.css',array('media'=>'screen')); ?>
|
||||
<?php echo HTML::Script('media/js/dojo-release-1.7.2/dojo/dojo.js',array('data-dojo-config'=>'async: true, parseOnLoad: true')); ?>
|
||||
<?php echo HTML::Style('media/theme/claro/css/style.css',array('media'=>'screen')); ?>
|
||||
<script>
|
||||
require(["dijit/layout/BorderContainer","dijit/layout/TabContainer","dijit/layout/ContentPane","dijit/Dialog","dijit/MenuBar","dijit/MenuBarItem"]);
|
||||
require(["dojo/data/ItemFileWriteStore","dijit/Tree"]);
|
||||
</script>
|
||||
<!-- Other Style sheets or scripts that are used -->
|
||||
<?php echo Style::factory(); ?>
|
||||
<?php echo Script::factory(); ?>
|
||||
<!-- testing -->
|
||||
<script type="text/javascript">
|
||||
require(["dojo/ready"], function() {
|
||||
dojo.addOnLoad(function() {
|
||||
var store = new dojo.data.ItemFileWriteStore({
|
||||
url: "/pla/media/demo1.json"
|
||||
});
|
||||
|
||||
var model = new dijit.tree.TreeStoreModel({
|
||||
store: store,
|
||||
childrenAttrs: ["children"]
|
||||
});
|
||||
|
||||
new dijit.Tree({
|
||||
model: model,
|
||||
}, "ldaptree");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body class="claro">
|
||||
<div id="appLayout" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design: 'headline'">
|
||||
<div id="appHeader" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'top'">
|
||||
<?php echo Config::logo(); ?>
|
||||
</div>
|
||||
<div id="appControl" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'top'">
|
||||
<div dojoType="dijit.MenuBar" id="navMenu">
|
||||
<div dojoType="dijit.MenuBarItem" onClick="window.location='<?php echo URL::site('login'); ?>'">
|
||||
<span>Login</span>
|
||||
</div>
|
||||
<div dojoType="dijit.MenuBarItem" onClick="dijit.byId('helpDialog').show();">
|
||||
<span>Help</span>
|
||||
</div>
|
||||
</div>
|
||||
<div data-dojo-type="dijit.Dialog" id="helpDialog" data-dojo-props="title: ' Help &amp; Support'" href="<?php echo URL::Site('media/notimplemented.txt'); ?>"></div>
|
||||
</div>
|
||||
<?php if (Auth::instance()->logged_in()) { ?>
|
||||
<div id="appLeft" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'left', splitter: true">
|
||||
<div id="ldaptree"></div>
|
||||
</div>
|
||||
<div id="appBody" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'center'">
|
||||
<div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design: 'headline'">
|
||||
<div id="appStatus" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'top'"></div>
|
||||
<div id="appContent" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'center'">
|
||||
<div data-dojo-type="dijit.layout.TabContainer" data-dojo-props="">
|
||||
<?php echo $content; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div id="appBody" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'center'">
|
||||
<?php echo $content; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div id="appFooter" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'">
|
||||
<div class="foottext"><?php echo Config::version(); ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
3
application/views/claro/block.php
Normal file
@ -0,0 +1,3 @@
|
||||
<div data-dojo-type="dijit.layout.ContentPane" title="<?php echo $title ?>">
|
||||
<?php echo $body; ?>
|
||||
</div>
|
14
application/views/login.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php echo Form::open(); ?>
|
||||
<table class="login">
|
||||
<tr><td><b>User Name:</b></td></tr>
|
||||
<tr><td><?php echo Form::input('username',null,array('id'=>'login-uid','size'=>40,'class'=>'username'));?></td></tr>
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<tr><td><b>Password:</b></td></tr>
|
||||
<tr><td><?php echo Form::password('password',null,array('id'=>'login-pwd','size'=>40,'class'=>'password'));?></td></tr>
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<? if (Kohana::Config('auth.pwreset')) { ?>
|
||||
<tr><td colspan="2"><?php echo HTML::anchor('login/reset',_('Forgot your password?')); ?></td></tr>
|
||||
<? } ?>
|
||||
<tr><td colspan="2" style="text-align: center;"><?php echo Form::submit('submit',_('Authenticate'));?></td></tr>
|
||||
</table>
|
||||
<?php echo Form::close(); ?>
|
@ -12,12 +12,15 @@
|
||||
*/
|
||||
class lnApp_Controller_Logout extends Controller {
|
||||
public function action_index() {
|
||||
# If user already signed-in
|
||||
// If user already signed-in
|
||||
if (Auth::instance()->logged_in() != 0) {
|
||||
$ao = Auth::instance()->get_user();
|
||||
Auth::instance()->logout();
|
||||
|
||||
if (method_exists($ao,'log'))
|
||||
$ao->log('Logged Out');
|
||||
|
||||
Auth::instance()->logout();
|
||||
|
||||
HTTP::redirect('login');
|
||||
}
|
||||
|
||||
|
@ -158,10 +158,11 @@ abstract class lnApp_Controller_TemplateDefault extends Controller_Template {
|
||||
|
||||
if ($this->auto_render) {
|
||||
// Application Title
|
||||
if ($mo=ORM::factory('Module',array('name'=>Request::current()->controller())) AND $mo->loaded())
|
||||
if (class_exists('Model_Module') AND $mo=ORM::factory('Module',array('name'=>Request::current()->controller())) AND $mo->loaded())
|
||||
$this->meta->title = sprintf('%s: %s',Kohana::$config->load('config')->appname,$mo->display('name'));
|
||||
else
|
||||
$this->meta->title = Kohana::$config->load('config')->appname;
|
||||
|
||||
$this->template->title = '';
|
||||
|
||||
// Language
|
||||
|