diff --git a/application/classes/auth/ldap.php b/application/classes/Auth/LDAP.php similarity index 61% rename from application/classes/auth/ldap.php rename to application/classes/Auth/LDAP.php index f6eced6..6cb9cfe 100644 --- a/application/classes/auth/ldap.php +++ b/application/classes/Auth/LDAP.php @@ -1,4 +1,4 @@ diff --git a/application/classes/block.php b/application/classes/Block.php similarity index 100% rename from application/classes/block.php rename to application/classes/Block.php diff --git a/application/classes/Config.php b/application/classes/Config.php new file mode 100644 index 0000000..7d9f554 --- /dev/null +++ b/application/classes/Config.php @@ -0,0 +1,107 @@ +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'; + } +} +?> diff --git a/application/classes/controller/template.php b/application/classes/Controller/Template.php similarity index 100% rename from application/classes/controller/template.php rename to application/classes/Controller/Template.php diff --git a/application/classes/Controller/TemplateDefault.php b/application/classes/Controller/TemplateDefault.php new file mode 100644 index 0000000..a26f1d7 --- /dev/null +++ b/application/classes/Controller/TemplateDefault.php @@ -0,0 +1,47 @@ +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; + } +} +?> diff --git a/application/classes/controller/welcome.php b/application/classes/Controller/Welcome.php similarity index 100% rename from application/classes/controller/welcome.php rename to application/classes/Controller/Welcome.php diff --git a/application/classes/database/ldap.php b/application/classes/Database/LDAP.php similarity index 100% rename from application/classes/database/ldap.php rename to application/classes/Database/LDAP.php diff --git a/application/classes/database/ldap/search.php b/application/classes/Database/LDAP/Search.php similarity index 100% rename from application/classes/database/ldap/search.php rename to application/classes/Database/LDAP/Search.php diff --git a/application/classes/database/ldap/search/builder/query.php b/application/classes/Database/LDAP/Search/Builder/Query.php similarity index 100% rename from application/classes/database/ldap/search/builder/query.php rename to application/classes/Database/LDAP/Search/Builder/Query.php diff --git a/application/classes/pla/auth/ldap.php b/application/classes/PLA/Auth/Ldap.php similarity index 98% rename from application/classes/pla/auth/ldap.php rename to application/classes/PLA/Auth/Ldap.php index 0b64e03..ff1eafb 100644 --- a/application/classes/pla/auth/ldap.php +++ b/application/classes/PLA/Auth/Ldap.php @@ -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) {} diff --git a/application/classes/pla/block.php b/application/classes/PLA/Block.php similarity index 62% rename from application/classes/pla/block.php rename to application/classes/PLA/Block.php index dc9e8d2..bcb0a0c 100644 --- a/application/classes/pla/block.php +++ b/application/classes/PLA/Block.php @@ -15,7 +15,6 @@ */ abstract class PLA_Block extends HTMLRender { protected static $_data = array(); - protected static $_spacer = '
 
'; 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 .= ''; - - if (! empty($value['title'])) - $output .= sprintf('',$value['title']); - - if (! empty($value['subtitle'])) - $output .= sprintf('',$value['subtitle']); - - $output .= sprintf('',$value['body']); - - if (! empty($value['footer'])) - $output .= sprintf('',$value['footer']); - - $output .= '
%s
%s
%s
'; - } + 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; } diff --git a/application/classes/pla/controller/template.php b/application/classes/PLA/Controller/Template.php similarity index 91% rename from application/classes/pla/controller/template.php rename to application/classes/PLA/Controller/Template.php index 4b189b1..6c5f7f6 100644 --- a/application/classes/pla/controller/template.php +++ b/application/classes/PLA/Controller/Template.php @@ -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()) { diff --git a/application/classes/pla/database/ldap.php b/application/classes/PLA/Database/LDAP.php similarity index 100% rename from application/classes/pla/database/ldap.php rename to application/classes/PLA/Database/LDAP.php diff --git a/application/classes/pla/database/ldap/search.php b/application/classes/PLA/Database/LDAP/Search.php similarity index 100% rename from application/classes/pla/database/ldap/search.php rename to application/classes/PLA/Database/LDAP/Search.php diff --git a/application/classes/pla/database/ldap/search/builder/query.php b/application/classes/PLA/Database/LDAP/Search/Builder/Query.php similarity index 99% rename from application/classes/pla/database/ldap/search/builder/query.php rename to application/classes/PLA/Database/LDAP/Search/Builder/Query.php index 63c1c21..5905cf3 100644 --- a/application/classes/pla/database/ldap/search/builder/query.php +++ b/application/classes/PLA/Database/LDAP/Search/Builder/Query.php @@ -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); diff --git a/application/classes/PLA/Exception.php b/application/classes/PLA/Exception.php new file mode 100644 index 0000000..959a29f --- /dev/null +++ b/application/classes/PLA/Exception.php @@ -0,0 +1,31 @@ +redirect('login'); + break; + + } + + echo debug::vars(array('m'=>$message,'v'=>$variables,'c'=>$code,'t'=>$this));die(); + } + + public function __toString() { + echo __METHOD__;die(); + } +} +?> diff --git a/application/classes/PLA/SystemMessage.php b/application/classes/PLA/SystemMessage.php new file mode 100644 index 0000000..3492919 --- /dev/null +++ b/application/classes/PLA/SystemMessage.php @@ -0,0 +1,65 @@ +$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; + } +} +?> diff --git a/application/classes/config.php b/application/classes/SystemMessage.php similarity index 57% rename from application/classes/config.php rename to application/classes/SystemMessage.php index 65daaae..bf43e7e 100644 --- a/application/classes/config.php +++ b/application/classes/SystemMessage.php @@ -1,4 +1,4 @@ diff --git a/application/classes/URL.php b/application/classes/URL.php new file mode 100644 index 0000000..a62c98e --- /dev/null +++ b/application/classes/URL.php @@ -0,0 +1,51 @@ +'', + ); + + /** + * 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; + } +} +?> diff --git a/application/classes/controller/login.php b/application/classes/controller/login.php deleted file mode 100644 index f0c1b01..0000000 --- a/application/classes/controller/login.php +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/application/classes/controller/logout.php b/application/classes/controller/logout.php deleted file mode 100644 index b60b0ee..0000000 --- a/application/classes/controller/logout.php +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/application/classes/controller/media.php b/application/classes/controller/media.php deleted file mode 100644 index 53bdf41..0000000 --- a/application/classes/controller/media.php +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/application/classes/htmlrender.php b/application/classes/htmlrender.php deleted file mode 100644 index ed9c6a0..0000000 --- a/application/classes/htmlrender.php +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/application/classes/meta.php b/application/classes/meta.php deleted file mode 100644 index 8750207..0000000 --- a/application/classes/meta.php +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/application/classes/pla/config.php b/application/classes/pla/config.php deleted file mode 100644 index 2c0e5b4..0000000 --- a/application/classes/pla/config.php +++ /dev/null @@ -1,105 +0,0 @@ -'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'); - } -} -?> diff --git a/application/classes/pla/controller/login.php b/application/classes/pla/controller/login.php deleted file mode 100644 index a361c7b..0000000 --- a/application/classes/pla/controller/login.php +++ /dev/null @@ -1,200 +0,0 @@ -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.') - )); - } -} -?> diff --git a/application/classes/pla/controller/logout.php b/application/classes/pla/controller/logout.php deleted file mode 100644 index ded76b5..0000000 --- a/application/classes/pla/controller/logout.php +++ /dev/null @@ -1,26 +0,0 @@ -logged_in()!= 0) { - Auth::instance()->logout(); - - Request::current()->redirect('login'); - } - - Request::current()->redirect('welcome/index'); - } -} -?> diff --git a/application/classes/pla/controller/media.php b/application/classes/pla/controller/media.php deleted file mode 100644 index 9413a08..0000000 --- a/application/classes/pla/controller/media.php +++ /dev/null @@ -1,59 +0,0 @@ -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())); - } -} -?> diff --git a/application/classes/pla/htmlrender.php b/application/classes/pla/htmlrender.php deleted file mode 100644 index 5bf2100..0000000 --- a/application/classes/pla/htmlrender.php +++ /dev/null @@ -1,92 +0,0 @@ -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__)); - } -} -?> diff --git a/application/classes/pla/meta.php b/application/classes/pla/meta.php deleted file mode 100644 index f87c496..0000000 --- a/application/classes/pla/meta.php +++ /dev/null @@ -1,34 +0,0 @@ -_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; - } -} -?> diff --git a/application/classes/pla/script.php b/application/classes/pla/script.php deleted file mode 100644 index 00d8839..0000000 --- a/application/classes/pla/script.php +++ /dev/null @@ -1,53 +0,0 @@ -'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("",$value['data']); - break; - default: - throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type'])); - } - } - - return $foutput.static::$_spacer.$soutput; - } -} -?> diff --git a/application/classes/pla/style.php b/application/classes/pla/style.php deleted file mode 100644 index 29abd5e..0000000 --- a/application/classes/pla/style.php +++ /dev/null @@ -1,54 +0,0 @@ -'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("",$value['data']); - break; - default: - throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type'])); - } - } - - return $foutput.static::$_spacer.$soutput; - } -} -?> diff --git a/application/classes/script.php b/application/classes/script.php deleted file mode 100644 index 676a71a..0000000 --- a/application/classes/script.php +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/application/classes/style.php b/application/classes/style.php deleted file mode 100644 index e5a03bf..0000000 --- a/application/classes/style.php +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/application/config/auth.php b/application/config/auth.php index 6bc0cd8..d91bdac 100644 --- a/application/config/auth.php +++ b/application/config/auth.php @@ -17,5 +17,6 @@ return array( 'lifetime' => 1209600, // 'session_key' => 'auth_user', // 'forced_key' => 'auth_forced', + 'pwreset' => FALSE, ); ?> diff --git a/application/config/config.php b/application/config/config.php index 034e13b..136b4af 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -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', ); ?> diff --git a/application/config/debug.php b/application/config/debug.php new file mode 100644 index 0000000..534ff36 --- /dev/null +++ b/application/config/debug.php @@ -0,0 +1,24 @@ +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 +); +?> diff --git a/application/config/userguide.php b/application/config/userguide.php new file mode 100644 index 0000000..57507b8 --- /dev/null +++ b/application/config/userguide.php @@ -0,0 +1,23 @@ + 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', + ) + ) +); diff --git a/htdocs/images/favicon.ico b/application/media/img/favicon.ico similarity index 100% rename from htdocs/images/favicon.ico rename to application/media/img/favicon.ico diff --git a/htdocs/images/default/logo-small.png b/application/media/img/logo-small.png similarity index 100% rename from htdocs/images/default/logo-small.png rename to application/media/img/logo-small.png diff --git a/application/media/notimplemented.txt b/application/media/notimplemented.txt new file mode 100644 index 0000000..a594f2d --- /dev/null +++ b/application/media/notimplemented.txt @@ -0,0 +1 @@ +This hasnt been implemented yet! diff --git a/htdocs/images/default/key.png b/application/media/theme/claro/css/image/key.png similarity index 100% rename from htdocs/images/default/key.png rename to application/media/theme/claro/css/image/key.png diff --git a/htdocs/images/default/ldap-uid.png b/application/media/theme/claro/css/image/ldap-uid.png similarity index 100% rename from htdocs/images/default/ldap-uid.png rename to application/media/theme/claro/css/image/ldap-uid.png diff --git a/application/media/theme/claro/css/style.css b/application/media/theme/claro/css/style.css new file mode 100644 index 0000000..5ce03ab --- /dev/null +++ b/application/media/theme/claro/css/style.css @@ -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; +} diff --git a/application/views/claro.php b/application/views/claro.php new file mode 100644 index 0000000..d568b1c --- /dev/null +++ b/application/views/claro.php @@ -0,0 +1,83 @@ + + + + + <?php echo $meta->title; ?> + + + + + + + + 'screen')); ?> + 'async: true, parseOnLoad: true')); ?> + 'screen')); ?> + + + + + + + + +
+
+ +
+
+ +
+
+ logged_in()) { ?> +
+
+
+
+
+
+
+
+ +
+
+
+
+ +
+ +
+ +
+
+
+
+ + diff --git a/application/views/claro/block.php b/application/views/claro/block.php new file mode 100644 index 0000000..02a7408 --- /dev/null +++ b/application/views/claro/block.php @@ -0,0 +1,3 @@ +
+ +
diff --git a/application/views/login.php b/application/views/login.php new file mode 100644 index 0000000..8cb656f --- /dev/null +++ b/application/views/login.php @@ -0,0 +1,14 @@ + + + + + + + + + + + + +
User Name:
'login-uid','size'=>40,'class'=>'username'));?>
 
Password:
'login-pwd','size'=>40,'class'=>'password'));?>
 
+ diff --git a/modules/lnApp/classes/lnApp/Controller/Logout.php b/modules/lnApp/classes/lnApp/Controller/Logout.php index f9b094e..8ea745f 100644 --- a/modules/lnApp/classes/lnApp/Controller/Logout.php +++ b/modules/lnApp/classes/lnApp/Controller/Logout.php @@ -12,11 +12,14 @@ */ class lnApp_Controller_Logout extends Controller { public function action_index() { - # If user already signed-in - if (Auth::instance()->logged_in()!= 0) { + // If user already signed-in + if (Auth::instance()->logged_in() != 0) { $ao = Auth::instance()->get_user(); + + if (method_exists($ao,'log')) + $ao->log('Logged Out'); + Auth::instance()->logout(); - $ao->log('Logged Out'); HTTP::redirect('login'); } diff --git a/modules/lnApp/classes/lnApp/Controller/TemplateDefault.php b/modules/lnApp/classes/lnApp/Controller/TemplateDefault.php index 2c1c540..56d443b 100644 --- a/modules/lnApp/classes/lnApp/Controller/TemplateDefault.php +++ b/modules/lnApp/classes/lnApp/Controller/TemplateDefault.php @@ -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