Customisations to KH

This commit is contained in:
Deon George 2012-01-19 22:40:53 +11:00
parent a8f534b463
commit 181cc4ca20
108 changed files with 3414 additions and 43 deletions

21
.htaccess Normal file
View File

@ -0,0 +1,21 @@
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /pla
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|includes/kohana)\b.* index.php/$0 [L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

150
application/bootstrap.php Normal file
View File

@ -0,0 +1,150 @@
<?php defined('SYSPATH') or die('No direct script access.');
// -- Environment setup --------------------------------------------------------
// Load the core Kohana class
require SYSPATH.'classes/Kohana/Core'.EXT;
if (is_file(APPPATH.'classes/Kohana'.EXT))
{
// Application extends the core
require APPPATH.'classes/Kohana'.EXT;
}
else
{
// Load empty core extension
require SYSPATH.'classes/Kohana'.EXT;
}
/**
* Set the default time zone.
*
* @link http://kohanaframework.org/guide/using.configuration
* @link http://www.php.net/manual/timezones
*/
date_default_timezone_set('Australia/Melbourne');
/**
* Set the default locale.
*
* @link http://kohanaframework.org/guide/using.configuration
* @link http://www.php.net/manual/function.setlocale
*/
setlocale(LC_ALL, 'en_US.utf-8');
/**
* Enable the Kohana auto-loader.
*
* @link http://kohanaframework.org/guide/using.autoloading
* @link http://www.php.net/manual/function.spl-autoload-register
*/
spl_autoload_register(array('Kohana', 'auto_load'));
/**
* Optionally, you can enable a compatibility auto-loader for use with
* older modules that have not been updated for PSR-0.
*
* It is recommended to not enable this unless absolutely necessary.
*/
//spl_autoload_register(array('Kohana', 'auto_load_lowercase'));
/**
* Enable the Kohana auto-loader for unserialization.
*
* @link http://www.php.net/manual/function.spl-autoload-call
* @link http://www.php.net/manual/var.configuration#unserialize-callback-func
*/
ini_set('unserialize_callback_func', 'spl_autoload_call');
// -- Configuration and initialization -----------------------------------------
/**
* Set the default language
*/
I18n::lang('en-us');
/**
* Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
*
* Note: If you supply an invalid environment name, a PHP warning will be thrown
* saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
*/
if (isset($_SERVER['KOHANA_ENV']))
{
Kohana::$environment = constant('Kohana::'.strtoupper($_SERVER['KOHANA_ENV']));
}
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - integer cache_life lifetime, in seconds, of items cached 60
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
* - boolean expose set the X-Powered-By header FALSE
*/
Kohana::init(array(
'base_url' => '/pla',
'caching' => TRUE,
'index_file' => '',
));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Log_File(APPPATH.'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Config_File);
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array(
'lnapp' => MODPATH.'lnApp',
'auth' => SMDPATH.'auth', // Basic authentication
'cache' => SMDPATH.'cache', // Caching with multiple backends
// 'codebench' => SMDPATH.'codebench', // Benchmarking tool
'database' => SMDPATH.'database', // Database access
// 'image' => SMDPATH.'image', // Image manipulation
'minion' => SMDPATH.'minion', // CLI Tasks
'orm' => SMDPATH.'orm', // Object Relationship Mapping
'pagination' => SMDPATH.'pagination', // Kohana Pagination module for Kohana 3 PHP Framework
// 'unittest' => SMDPATH.'unittest', // Unit testing
// 'userguide' => SMDPATH.'userguide', // User guide and API documentation
'xml' => SMDPATH.'xml', // XML module for Kohana 3 PHP Framework
));
// Static file serving (CSS, JS, images)
Route::set('default/media', 'media(/<file>)', array('file' => '.+'))
->defaults(array(
'controller' => 'media',
'action' => 'get',
));
/**
* Set the routes. Each route must have a minimum of a name, a URI and a set of
* defaults for the URI.
*/
Route::set('default', '(<controller>(/<action>(/<id>)))', array('id'=>'[a-zA-Z0-9_.-]+'))
->defaults(array(
'controller' => 'welcome',
'action' => 'index',
));
/**
* If APC is enabled, and we need to clear the cache
*/
if (file_exists(APPPATH.'cache/CLEAR_APC_CACHE') AND function_exists('apc_clear_cache') AND (PHP_SAPI !== 'cli')) {
if (! apc_clear_cache() OR ! unlink(APPPATH.'cache/CLEAR_APC_CACHE'))
throw new Kohana_Exception('Unable to clear the APC cache.');
}
?>

View File

@ -0,0 +1,16 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class overrides Kohana's Cookie
*
* @package PLA/Modifications
* @category Classes
* @category Helpers
* @author Deon George
* @copyright (c) 2010 Deon George
* @license http://dev.phpldapadmin.org/license.html
*/
class Cookie extends Kohana_Cookie {
public static $salt = 'PLA';
}
?>

View File

@ -0,0 +1,8 @@
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Welcome extends Controller_Template {
public function action_index() {
$this->response->body('hello, world!');
}
} // End Welcome

434
doc/exmail.schema Normal file
View File

@ -0,0 +1,434 @@
#
# Author: Stefan Klatt
# Email: stefan.klatt@cac-netzwerk.de
# Datum: 05.03.2007
# Version: 0.99.4
#
# OID-Prefix: 1.3.6.1.4.1.25926
#
# Attribute: 1.3.6.1.4.1.25926.1.1.1
#
# Objects: 1.3.6.1.4.1.25926.1.1.100
#
# 0.99.04
# 05.03.2007
# - ipprotocolnumber musste in integer umgeaendert werden, da das NIS Schema
# nicht mehr verwendet wird
#
#
# 0.99.05
# 24.04.2011
#
# - Userattribut active hinzugefügt
attributetype ( 1.3.6.1.4.1.25926.1.1.1
name 'EXLocalEmail'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024} )
attributetype ( 1.3.6.1.4.1.25926.1.1.2
name 'EXRemoteEmail'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024} )
attributetype ( 1.3.6.1.4.1.25926.1.1.3
name 'EXServer'
Sup name )
attributetype ( 1.3.6.1.4.1.25926.1.1.4
name 'EXUser-ID'
Sup name )
attributetype ( 1.3.6.1.4.1.25926.1.1.5
name 'EXPassword'
Sup name )
attributetype ( 1.3.6.1.4.1.25926.1.1.6
name 'EXActive'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.7
name 'EXSSL'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.8
name 'EXEmailonServer'
desc 'Nachrichten auf dem Server lassen'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.9
name 'EXPort'
EQUALITY IntegerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.10
name 'EXTimer'
desc 'Zeit zwischen den Abfragen, Zahl sollte ein Teiler von 60 sein'
EQUALITY IntegerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.11
name 'EXServerTyp'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{10}
)
attributetype ( 1.3.6.1.4.1.25926.1.1.12
name 'EXHTTPS'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.13
name 'EXTLSReq'
desc 'Require TLS'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.14
name 'EXAuthTry'
desc 'Try SMTP Auth'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.15
name 'EXAuthReq'
desc 'Require SMTP Auth'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.16
name 'EXSMTPPOP'
desc 'SMTP after POP'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.17
name 'EXFetch'
desc 'Fetchmail-Account Bezeichnung'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.25926.1.1.18
name 'EXsmtp'
desc 'SMTP-Account Bezeichnung'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.25926.1.1.20
name 'EXwebm'
desc 'WebMail-Account Bezeichnung'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.25926.1.1.21
name 'EXDomainIMAP'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.25926.1.1.22
name 'EXDomainExt'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.25926.1.1.23
name 'EXMaxMsgSize'
desc 'Max Emailsize'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
attributetype ( 1.3.6.1.4.1.25926.1.1.24
name 'EXMaxMsgTxt'
desc 'Text for max Emailsize'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.25926.1.1.25
name 'EXAlias'
desc 'Alias to change'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024} )
attributetype ( 1.3.6.1.4.1.25926.1.1.26
name 'EXRecipient'
desc 'Recipient for Email'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024} )
attributetype ( 1.3.6.1.4.1.25926.1.1.27
name 'EXDefaultTimer'
desc 'Default Zeit zwischen den Abfragen, Zahl sollte ein Teiler von 60 sein'
EQUALITY IntegerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.28
name 'EXMailDir'
desc 'Directory for Mails'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024} )
attributetype ( 1.3.6.1.4.1.25926.1.1.29
name 'EXFilter1'
desc 'Filter Zeile1'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{100} )
attributetype ( 1.3.6.1.4.1.25926.1.1.30
name 'EXFilter2'
desc 'Filter Zeile2'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{100} )
attributetype ( 1.3.6.1.4.1.25926.1.1.31
name 'EXFilter3'
desc 'Filter Zeile3'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{100} )
attributetype ( 1.3.6.1.4.1.25926.1.1.32
name 'EXFilter4'
desc 'Filter Zeile4'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{100} )
attributetype ( 1.3.6.1.4.1.25926.1.1.33
name 'EXFilter5'
desc 'Filter Zeile5'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{100} )
attributetype ( 1.3.6.1.4.1.25926.1.1.34
name 'EXFilter6'
desc 'Filter Zeile6'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{100} )
attributetype ( 1.3.6.1.4.1.25926.1.1.35
name 'EXIMAPDir'
desc 'Filter Zeile6'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{100} )
attributetype ( 1.3.6.1.4.1.25926.1.1.36
name 'EXCondition'
desc 'Filter Condition'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{100} )
attributetype ( 1.3.6.1.4.1.25926.1.1.37
name 'EXStatus'
desc 'Wurde Filter geändert'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.38
name 'EXHomeDir'
desc 'Imap User Homedirectory'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{200} )
attributetype ( 1.3.6.1.4.1.25926.1.1.39
name 'EXFilterTyp'
desc 'EXFilter Typ - Subject, From, To, FromTo, Subject, Msgbody'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{200} )
attributetype ( 1.3.6.1.4.1.25926.1.1.40
name 'EXUserinfos'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{200} )
attributetype ( 1.3.6.1.4.1.25926.1.1.41
name 'EXFilter'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{200} )
attributetype ( 1.3.6.1.4.1.25926.1.1.42
name 'EXFilterGen'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{200} )
attributetype ( 1.3.6.1.4.1.25926.1.1.43
name 'EXSpam'
desc 'Spam im Spam-Verzeichnis des Users einsortieren'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.44
name 'EXEmailCopy'
desc 'Eine Kopie der gesendeten Email durch den Userfilter schicken um diese im selben Verzeichnis abzulegen'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.45
name 'EXDomain-Infos'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{200} )
attributetype ( 1.3.6.1.4.1.25926.1.1.46
name 'EXSharedFolder'
desc 'Ablage der Emails unter shared '
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.47
name 'EXFilterOut'
desc 'EXFilter direction Out'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.48
name 'EXVacation'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.49
name 'EXVacationSubject'
desc 'Vacation Subject'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1000} )
attributetype ( 1.3.6.1.4.1.25926.1.1.50
name 'EXVacationMsg'
desc 'Vacation Message'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1000} )
attributetype ( 1.3.6.1.4.1.25926.1.1.51
name 'EXFilterIn'
desc 'EXFilter direction In'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.52
name 'EXUserSpamDir'
desc 'Maildir for Spams identify by User '
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1000} )
attributetype ( 1.3.6.1.4.1.25926.1.1.53
name 'EXUserHamDir'
desc 'Maildir for false recognized Spams identify by User '
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1000} )
attributetype ( 1.3.6.1.4.1.25926.1.1.54
name 'EXNotPersonal'
desc 'Test if Email is not from a person'
EQUALITY BooleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.25926.1.1.55
name 'EXGlobalPublicDir'
desc 'Imap global public directory'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{200} )
attributetype ( 1.3.6.1.4.1.25926.1.1.56
name 'EXAddr2'
desc 'Filter Email-Adresse'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{100} )
attributetype ( 1.3.6.1.4.1.25926.1.1.57
name 'EXAddr2Direction'
desc 'EXFilter Typ - Subject, From, To, FromTo, Subject, Msgbody'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{200} )
attributetype ( 1.3.6.1.4.1.25926.1.1.58
name 'EXDomainRelay'
desc 'Host - Domain Relays'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{200} )
attributetype ( 1.3.6.1.4.1.25926.1.1.60
name 'EXVacationDays'
desc 'Vacation days'
EQUALITY IntegerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE)
objectClass ( 1.3.6.1.4.1.25926.1.1.100
name 'EXSMTP-Account'
STRUCTURAL
must ( EXsmtp $ EXRemoteEmail $ EXServer $ EXUser-ID $
EXPassword $ EXActive
)
may ( EXPort $ EXAuthTry $ EXAuthReq $ EXTLSReq $ EXSMTPPOP $ EXTimer
)
)
objectClass ( 1.3.6.1.4.1.25926.1.1.101
name 'EXFetchmail-Account'
STRUCTURAL
must ( EXFetch $ EXRemoteEmail $ EXServer $ EXServerTyp $
EXUser-ID $ EXPassword $ EXActive $ EXTimer
)
may ( EXSSL $ EXEmailonServer $ EXPort $ EXTLSReq
)
)
objectClass ( 1.3.6.1.4.1.25926.1.1.103
name 'EXWebMail-Account'
STRUCTURAL
must ( EXwebm $ EXRemoteEmail $ EXServer $ EXUser-ID $
EXPassword $ EXServertyp $ EXActive
)
may ( EXEmailonServer $ EXPort $ EXTimer $ EXHTTPS
)
)
objectClass ( 1.3.6.1.4.1.25926.1.1.104
name 'EXDomain-Infos'
STRUCTURAL
must ( EXDomain-Infos $ EXDomainIMAP $ EXDomainExt $ EXGlobalPublicDir $
EXDefaultTimer $ EXMailDir $ EXUserSpamDir $ EXUserHamDir
)
may ( EXMaxMsgSize $ EXMaxMsgTxt $ EXDomainRelay
)
)
objectClass ( 1.3.6.1.4.1.25926.1.1.105
name 'EXAlias'
STRUCTURAL
must ( EXAlias $ EXRecipient
)
)
objectClass ( 1.3.6.1.4.1.25926.1.1.106
name 'EXUserinfos'
STRUCTURAL
must ( EXUserinfos $ EXHomeDir $ EXSpam $ EXEmailCopy $
EXSharedFolder $ EXStatus $
EXVacation $ EXVacationSubject $ EXVacationMsg $ EXVacationDays
)
)
objectClass ( 1.3.6.1.4.1.25926.1.1.107
name 'EXFilterGen'
STRUCTURAL
must ( EXFilterGen $ EXFilter1 $ EXStatus $ EXFilterOut $ EXFilterIn
)
may ( EXFilter2 $ EXFilter3 $ EXFilter4 $ EXFilter5 $ EXFilter6
)
)
objectClass ( 1.3.6.1.4.1.25926.1.1.108
name 'EXFilter'
STRUCTURAL
must ( EXFilter $ EXCondition $ EXIMAPDir $ EXStatus $
EXFilterTyp $ EXFilterOut $ EXFilterIn
)
may ( EXNotPersonal $ EXAddr2 $ EXAddr2Direction
)
)

View File

@ -27,21 +27,21 @@ objectclass: organizationalUnit
ou: Bad DNs ou: Bad DNs
# Entry 4: c=double plus \2B\2B,ou=Bad DNs,dc=example.com # Entry 4: c=double plus \2B\2B,ou=Bad DNs,dc=example.com
dn: c=double plus \2B\2B,ou=Bad DNs,dc=example.com #dn: c=double plus \2B\2B,ou=Bad DNs,dc=example.com
c: double plus ++ #c: double plus \2B\2B
objectclass: country #objectclass: country
# Entry 5: c=end dollar$,ou=Bad DNs,dc=example.com # Entry 5: c=end dollar$,ou=Bad DNs,dc=example.com
dn: c=end dollar$,ou=Bad DNs,dc=example.com #dn: c=end dollar$,ou=Bad DNs,dc=example.com
c: end dollar$ #c: end dollar$
objectclass: country #objectclass: country
# Entry 6: sn=sign@at+uid=multi-mixed,ou=Bad DNs,dc=example.com # Entry 6: sn=sign@at+uid=multi-mixed,ou=Bad DNs,dc=example.com
dn: sn=sign@at+uid=multi-mixed,ou=Bad DNs,dc=example.com #dn: sn=sign@at+uid=multi-mixed,ou=Bad DNs,dc=example.com
cn: Test #cn: Test
objectclass: inetOrgPerson #objectclass: inetOrgPerson
sn: sign@at #sn: sign@at
uid: multi-mixed #uid: multi-mixed
# Entry 7: uid=angle\3Cleft,ou=Bad DNs,dc=example.com # Entry 7: uid=angle\3Cleft,ou=Bad DNs,dc=example.com
dn: uid=angle\3Cleft,ou=Bad DNs,dc=example.com dn: uid=angle\3Cleft,ou=Bad DNs,dc=example.com
@ -86,20 +86,20 @@ sn: Test
uid: colon;semi uid: colon;semi
# Entry 13: uid=multi+uid=sign@at,ou=Bad DNs,dc=example.com # Entry 13: uid=multi+uid=sign@at,ou=Bad DNs,dc=example.com
dn: uid=multi+uid=sign@at,ou=Bad DNs,dc=example.com #dn: uid=multi+uid=sign@at,ou=Bad DNs,dc=example.com
cn: Test #cn: Test
objectclass: inetOrgPerson #objectclass: inetOrgPerson
sn: Test #sn: Test
uid: multi #uid: multi
uid: sign@at #uid: sign@at
# Entry 14: uid=multi+uid=value,ou=Bad DNs,dc=example.com # Entry 14: uid=multi+uid=value,ou=Bad DNs,dc=example.com
dn: uid=multi+uid=value,ou=Bad DNs,dc=example.com #dn: uid=multi+uid=value,ou=Bad DNs,dc=example.com
cn: Test #cn: Test
objectclass: inetOrgPerson #objectclass: inetOrgPerson
sn: Test #sn: Test
uid: multi #uid: multi
uid: value #uid: value
# Entry 15: uid=quote\22double,ou=Bad DNs,dc=example.com # Entry 15: uid=quote\22double,ou=Bad DNs,dc=example.com
dn: uid=quote\22double,ou=Bad DNs,dc=example.com dn: uid=quote\22double,ou=Bad DNs,dc=example.com

177
doc/mozillaOrgPerson.schema Normal file
View File

@ -0,0 +1,177 @@
#
# mozillaOrgPerson schema v. 0.6.3
#
# req. core
# req. cosine
# req. inetorgperson
# attribute defs
attributetype ( 1.3.6.1.4.1.13769.2.1.1
NAME ( 'mozillaNickname' )
SUP name )
attributetype ( 1.3.6.1.4.1.13769.2.1.2
NAME ( 'mozillaUseHtmlMail' )
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.13769.2.1.3
NAME 'mozillaSecondEmail'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
attributetype ( 1.3.6.1.4.1.13769.2.1.4
NAME 'mozillaHomeLocalityName'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
attributetype ( 1.3.6.1.4.1.13769.2.1.5
NAME 'mozillaPostalAddress2'
EQUALITY caseIgnoreListMatch
SUBSTR caseIgnoreListSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )
attributetype ( 1.3.6.1.4.1.13769.2.1.6
NAME 'mozillaHomePostalAddress2'
EQUALITY caseIgnoreListMatch
SUBSTR caseIgnoreListSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )
attributetype ( 1.3.6.1.4.1.13769.2.1.7
NAME ( 'mozillaHomeState' ) SUP name )
attributetype ( 1.3.6.1.4.1.13769.2.1.8
NAME 'mozillaHomePostalCode'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{40} )
attributetype ( 1.3.6.1.4.1.13769.2.1.9
NAME ( 'mozillaHomeCountryName' )
SUP name SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.13769.2.1.10
NAME ( 'mozillaHomeFriendlyCountryName' )
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
attributetype ( 1.3.6.1.4.1.13769.2.1.11
NAME ( 'mozillaHomeUrl' )
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
attributetype ( 1.3.6.1.4.1.13769.2.1.12
NAME ( 'mozillaWorkUrl' )
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
# un-comment for all LDAP server NOT supporting SYNTAX 2.16.840.1.113730.3.7.1
attributetype ( 1.3.6.1.4.1.13769.2.1.13
NAME ( 'nsAIMid' )
DESC 'AOL Instant Messenger (AIM) Identity'
EQUALITY telephoneNumberMatch
SUBSTR telephoneNumberSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
attributetype ( 1.3.6.1.4.1.13769.2.1.14 NAME ( 'mozillaHomeStreet' )
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
# un-comment for Netscape 6.x and all other LDAP server supporting SYNTAX 2.16.840.1.113730.3.7.1
# attributeTypes ( 2.16.840.1.113730.3.1.2013
# NAME ( 'nsAIMid' )
# DESC 'AOL Instant Messenger (AIM) Identity'
# SYNTAX 2.16.840.1.113730.3.7.1 )
attributetype ( 1.3.6.1.4.1.13769.2.1.96
NAME ( 'mozillaCustom1' )
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.13769.2.1.97
NAME ( 'mozillaCustom2' )
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.13769.2.1.98
NAME ( 'mozillaCustom3' )
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.13769.2.1.99
NAME ( 'mozillaCustom4' )
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
# defined in "A Summary of the X.500(96) User Schema for use with LDAPv3" - RFC 2256
#
# attributetype ( 2.5.4.6 NAME ( 'c' 'countryName' )
# DESC 'RFC2256: ISO-3166 country 2-letter code'
# SUP name SINGLE-VALUE )
# defined in "The COSINE and Internet X.500 Schema" - RFC 1274
#
# attributetype ( 0.9.2342.19200300.100.1.43
# NAME ( 'co' 'friendlyCountryName' )
# DESC 'RFC1274: friendly country name'
# EQUALITY caseIgnoreMatch
# SUBSTR caseIgnoreSubstringsMatch
# SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
# objectClass defs
objectclass ( 1.3.6.1.4.1.13769.2.2.1
NAME 'mozillaOrgPerson'
SUP top
AUXILIARY
MAY (
sn $
givenName $
cn $
displayName $
mozillaNickname $
title $
telephoneNumber $
facsimileTelephoneNumber $
mobile $
pager $
homePhone $
street $
postalCode $
mozillaPostalAddress2 $
mozillaHomeStreet $
mozillaHomePostalAddress2 $
l $
mozillaHomeLocalityName $
st $
mozillaHomeState $
mozillaHomePostalCode $
c $
mozillaHomeCountryName $
co $
mozillaHomeFriendlyCountryName $
ou $
o $
mail $
mozillaSecondEmail $
mozillaUseHtmlMail $
nsAIMid $
mozillaHomeUrl $
mozillaWorkUrl $
description $
mozillaCustom1 $
mozillaCustom2 $
mozillaCustom3 $
mozillaCustom4 ) )
# not part of the official Mozilla schema but read by Mozilla: 'departmentNumber' and 'postOfficeBox'
#

View File

@ -1,6 +1,6 @@
include /etc/openldap/schema/uidpool.schema include /etc/openldap/schema/uidpool.schema
include /etc/openldap/schema/sudo.schema include /etc/openldap/schema/sudo.schema
include /etc/openldap/schema/autofs.schema include /etc/openldap/schema/exmail.schema
TLSCACertificateFile /etc/openldap/pla/ca-bundle.crt TLSCACertificateFile /etc/openldap/pla/ca-bundle.crt
TLSCertificateFile /etc/openldap/pla/slapd.crt TLSCertificateFile /etc/openldap/pla/slapd.crt
@ -35,7 +35,7 @@ access to *
authz-policy any authz-policy any
database ldbm database bdb
suffix "dc=example.com" suffix "dc=example.com"
rootdn "cn=Manager,dc=example.com" rootdn "cn=Manager,dc=example.com"
rootpw NotAllowed rootpw NotAllowed
@ -50,7 +50,7 @@ index uidNumber,gidNumber,loginShell eq,pres
index uid,memberUid eq,pres,sub index uid,memberUid eq,pres,sub
index nisMapName,nisMapEntry eq,pres,sub index nisMapName,nisMapEntry eq,pres,sub
database ldbm database bdb
suffix "dc=example,dc=com" suffix "dc=example,dc=com"
rootdn "cn=Manager,dc=example,dc=com" rootdn "cn=Manager,dc=example,dc=com"
rootpw NotAllowed rootpw NotAllowed
@ -65,7 +65,7 @@ index uidNumber,gidNumber,loginShell eq,pres
index uid,memberUid eq,pres,sub index uid,memberUid eq,pres,sub
index nisMapName,nisMapEntry eq,pres,sub index nisMapName,nisMapEntry eq,pres,sub
database ldbm database bdb
suffix "o=Simpsons" suffix "o=Simpsons"
rootdn "cn=Manager,o=Simpsons" rootdn "cn=Manager,o=Simpsons"
rootpw NotAllowed rootpw NotAllowed

37
doc/sudo.schema Normal file
View File

@ -0,0 +1,37 @@
attributetype ( 1.3.6.1.4.1.15953.9.1.1
NAME 'sudoUser'
DESC 'User(s) who may run sudo'
EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.15953.9.1.2
NAME 'sudoHost'
DESC 'Host(s) who may run sudo'
EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.15953.9.1.3
NAME 'sudoCommand'
DESC 'Command(s) to be executed by sudo'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.15953.9.1.4
NAME 'sudoRunAs'
DESC 'User(s) impersonated by sudo'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.15953.9.1.5
NAME 'sudoOption'
DESC 'Options(s) followed by sudo'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
objectclass ( 1.3.6.1.4.1.15953.9.2.1 NAME 'sudoRole' SUP top STRUCTURAL
DESC 'Sudoer Entries'
MUST ( cn )
MAY ( sudoUser $ sudoHost $ sudoCommand $ sudoRunAs $ sudoOption
$description ) )

View File

@ -92,7 +92,7 @@ class Kohana_Minion_CLI {
{ {
foreach ($values as $opt => $value) foreach ($values as $opt => $value)
{ {
if ( ! in_array($opt, $options)) if ( ! in_array($opt, $options, TRUE))
{ {
// Set the given value // Set the given value
unset($values[$opt]); unset($values[$opt]);

View File

@ -15,13 +15,15 @@ $application = 'application';
*/ */
$modules = 'modules'; $modules = 'modules';
$sysmodules = 'includes/kohana/modules';
/** /**
* The directory in which the Kohana resources are located. The system * The directory in which the Kohana resources are located. The system
* directory must contain the classes/kohana.php file. * directory must contain the classes/kohana.php file.
* *
* @link http://kohanaframework.org/guide/about.install#system * @link http://kohanaframework.org/guide/about.install#system
*/ */
$system = 'system'; $system = 'includes/kohana/system';
/** /**
* The default extension of resource files. If you change this, all resources * The default extension of resource files. If you change this, all resources
@ -74,6 +76,12 @@ if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))
$modules = DOCROOT.$modules; $modules = DOCROOT.$modules;
} }
// Make the system relative to the docroot, for symlink'd index.php
if ( ! is_dir($sysmodules) AND is_dir(DOCROOT.$sysmodules))
{
$sysmodules = DOCROOT.$sysmodules;
}
// Make the system relative to the docroot // Make the system relative to the docroot
if ( ! is_dir($system) AND is_dir(DOCROOT.$system)) if ( ! is_dir($system) AND is_dir(DOCROOT.$system))
{ {
@ -83,10 +91,11 @@ if ( ! is_dir($system) AND is_dir(DOCROOT.$system))
// Define the absolute paths for configured directories // Define the absolute paths for configured directories
define('APPPATH', realpath($application).DIRECTORY_SEPARATOR); define('APPPATH', realpath($application).DIRECTORY_SEPARATOR);
define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR); define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);
define('SMDPATH', realpath($sysmodules).DIRECTORY_SEPARATOR);
define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR); define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR);
// Clean up the configuration vars // Clean up the configuration vars
unset($application, $modules, $system); unset($application, $modules, $sysmodules, $system);
/** /**
* Define the start time of the application, used for profiling. * Define the start time of the application, used for profiling.
@ -104,6 +113,8 @@ if ( ! defined('KOHANA_START_MEMORY'))
define('KOHANA_START_MEMORY', memory_get_usage()); define('KOHANA_START_MEMORY', memory_get_usage());
} }
define('PHPUNITTEST','192.168.242.3');
// Bootstrap the application // Bootstrap the application
require APPPATH.'bootstrap'.EXT; require APPPATH.'bootstrap'.EXT;
@ -122,4 +133,4 @@ if (($ob_len = ob_get_length()) !== FALSE)
} }
// Enable the unittest module // Enable the unittest module
Kohana::modules(Kohana::modules() + array('unittest' => MODPATH.'unittest')); Kohana::modules(Kohana::modules() + array('unittest' => SMDPATH.'unittest'));

View File

@ -252,13 +252,17 @@ class Kohana_Debug {
{ {
$file = 'APPPATH'.DIRECTORY_SEPARATOR.substr($file, strlen(APPPATH)); $file = 'APPPATH'.DIRECTORY_SEPARATOR.substr($file, strlen(APPPATH));
} }
elseif (strpos($file, MODPATH) === 0)
{
$file = 'MODPATH'.DIRECTORY_SEPARATOR.substr($file, strlen(MODPATH));
}
elseif (strpos($file, SYSPATH) === 0) elseif (strpos($file, SYSPATH) === 0)
{ {
$file = 'SYSPATH'.DIRECTORY_SEPARATOR.substr($file, strlen(SYSPATH)); $file = 'SYSPATH'.DIRECTORY_SEPARATOR.substr($file, strlen(SYSPATH));
} }
elseif (strpos($file, MODPATH) === 0) elseif (strpos($file, SMDPATH) === 0)
{ {
$file = 'MODPATH'.DIRECTORY_SEPARATOR.substr($file, strlen(MODPATH)); $file = 'SMDPATH'.DIRECTORY_SEPARATOR.substr($file, strlen(SMDPATH));
} }
elseif (strpos($file, DOCROOT) === 0) elseif (strpos($file, DOCROOT) === 0)
{ {

View File

@ -250,7 +250,7 @@ class Kohana_CoreTest extends Unittest_TestCase
{ {
return array( return array(
array(array('unittest' => MODPATH.'fo0bar')), array(array('unittest' => MODPATH.'fo0bar')),
array(array('unittest' => MODPATH.'unittest', 'fo0bar' => MODPATH.'fo0bar')), array(array('unittest' => SMDPATH.'unittest', 'fo0bar' => MODPATH.'fo0bar')),
); );
} }
@ -292,7 +292,7 @@ class Kohana_CoreTest extends Unittest_TestCase
{ {
return array( return array(
array(array(), array()), array(array(), array()),
array(array('unittest' => MODPATH.'unittest'), array('unittest' => $this->dirSeparator(MODPATH.'unittest/'))), array(array('unittest' => SMDPATH.'unittest'), array('unittest' => $this->dirSeparator(SMDPATH.'unittest/'))),
); );
} }

View File

@ -59,8 +59,8 @@ class Kohana_DebugTest extends Unittest_TestCase
'SYSPATH'.DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.'kohana.php' 'SYSPATH'.DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.'kohana.php'
), ),
array( array(
MODPATH.$this->dirSeparator('unittest/classes/kohana/unittest/runner').EXT, SMDPATH.$this->dirSeparator('unittest/classes/kohana/unittest/runner').EXT,
$this->dirSeparator('MODPATH/unittest/classes/kohana/unittest/runner').EXT $this->dirSeparator('SMDPATH/unittest/classes/kohana/unittest/runner').EXT
), ),
); );
} }

132
index.php
View File

@ -1,11 +1,131 @@
<?php <?php
// $Header$
/** /**
* @package phpLDAPadmin * The directory in which your application specific resources are located.
* The application directory must contain the bootstrap.php file.
*
* @link http://kohanaframework.org/guide/about.install#application
*/
$application = 'application';
/**
* The directory in which your modules are located.
*
* @link http://kohanaframework.org/guide/about.install#modules
*/
$modules = 'modules';
/**
* The directory in which upstream Kohana resources (modules) are located.
*/
$sysmodules = 'includes/kohana/modules';
/**
* The directory in which the Kohana resources are located. The system
* directory must contain the classes/kohana.php file.
*
* @link http://kohanaframework.org/guide/about.install#system
*/
$system = 'includes/kohana/system';
/**
* The default extension of resource files. If you change this, all resources
* must be renamed to use the new extension.
*
* @link http://kohanaframework.org/guide/about.install#ext
*/
define('EXT', '.php');
/**
* Set the PHP error reporting level. If you set this in php.ini, you remove this.
* @link http://www.php.net/manual/errorfunc.configuration#ini.error-reporting
*
* When developing your application, it is highly recommended to enable notices
* and strict warnings. Enable them by using: E_ALL | E_STRICT
*
* In a production environment, it is safe to ignore notices and strict warnings.
* Disable them by using: E_ALL ^ E_NOTICE
*
* When using a legacy application with PHP >= 5.3, it is recommended to disable
* deprecated notices. Disable with: E_ALL & ~E_DEPRECATED
*/
error_reporting(E_ALL | E_STRICT);
/**
* End of standard configuration! Changing any of the code below should only be
* attempted by those with a working knowledge of Kohana internals.
*
* @link http://kohanaframework.org/guide/using.configuration
*/ */
# You should secure your PLA by making the htdocs/ your docroot. // Set the full path to the docroot
header('Location: htdocs/index.php'); define('DOCROOT', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);
die();
?> // Make the application relative to the docroot, for symlink'd index.php
if ( ! is_dir($application) AND is_dir(DOCROOT.$application))
$application = DOCROOT.$application;
// Make the modules relative to the docroot, for symlink'd index.php
if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))
$modules = DOCROOT.$modules;
// Make the system relative to the docroot, for symlink'd index.php
if ( ! is_dir($sysmodules) AND is_dir(DOCROOT.$sysmodules))
$sysmodules = DOCROOT.$sysmodules;
// Make the system relative to the docroot, for symlink'd index.php
if ( ! is_dir($system) AND is_dir(DOCROOT.$system))
$system = DOCROOT.$system;
// Define the absolute paths for configured directories
define('APPPATH', realpath($application).DIRECTORY_SEPARATOR);
define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);
define('SMDPATH', realpath($sysmodules).DIRECTORY_SEPARATOR);
define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR);
// Clean up the configuration vars
unset($application, $modules, $sysmodules, $system);
if (file_exists('install'.EXT))
{
// Load the installation check
return include 'install'.EXT;
}
/**
* Define the start time of the application, used for profiling.
*/
if ( ! defined('KOHANA_START_TIME'))
{
define('KOHANA_START_TIME', microtime(TRUE));
}
/**
* Define the memory usage at the start of the application, used for profiling.
*/
if ( ! defined('KOHANA_START_MEMORY'))
{
define('KOHANA_START_MEMORY', memory_get_usage());
}
// Bootstrap the application
require APPPATH.'bootstrap'.EXT;
if (PHP_SAPI == 'cli') // Try and load minion
{
class_exists('Minion_Task') OR die('Please enable the Minion module for CLI support.');
set_exception_handler(array('Minion_Exception', 'handler'));
Minion_Task::factory(Minion_CLI::options())->execute();
}
else
{
/**
* Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
* If no source is specified, the URI will be automatically detected.
*/
echo Request::factory(TRUE, array(), FALSE)
->execute()
->send_headers(TRUE)
->body();
}

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Block extends lnApp_Block {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Block_Sub extends lnApp_Block_Sub {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class BreadCrumb extends lnApp_BreadCrumb {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Controller_Default extends lnApp_Controller_Default {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Controller_Login extends lnApp_Controller_Login {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Controller_Logout extends lnApp_Controller_Logout {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Controller_Media extends lnApp_Controller_Media {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Controller_Task extends lnApp_Controller_Task {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class HTML extends lnApp_HTML {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class HTMLRender extends lnApp_HTMLRender {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class HeadImages extends lnApp_HeadImages {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Meta extends lnApp_Meta {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class PWGen extends lnApp_PWGen {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Random extends lnApp_Random {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Script extends lnApp_Script {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Sort extends lnApp_Sort {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Style extends lnApp_Style {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class SystemMessage extends lnApp_SystemMessage {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Table extends lnApp_Table {}
?>

View File

@ -0,0 +1,84 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for rendering HTML body blocks (left, center, right).
*
* It will provide a header, body and footer.
*
* @package lnApp
* @category lnApp/Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
* @uses Style
*/
abstract class lnApp_Block extends HTMLRender {
protected static $_data = array();
protected static $_spacer = '<table><tr class="spacer"><td>&nbsp;</td></tr></table>';
protected static $_required_keys = array('body');
/**
* Add a block to be rendered
*
* @param array Block attributes
*/
public static function add($block,$prepend=FALSE) {
// Any body objects should be converted to a string, so that any calls to Style/Script are processed
if (isset($block['body']))
$block['body'] = (string)$block['body'];
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 Block;
}
/**
* Render this block
*
* @see HTMLRender::render()
*/
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>';
}
return $output;
}
}
?>

View File

@ -0,0 +1,94 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for rendering HTML sub body blocks.
*
* It will provide a header, body and footer.
*
* @package lnApp
* @category lnApp/Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
* @uses Style
*/
class lnApp_Block_Sub extends HTMLRender {
protected static $_data = array();
protected static $_spacer = '<table><tr class="spacer"><td>&nbsp;</td></tr></table>';
protected static $_required_keys = array('body','position');
/**
* 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 Block_Sub;
}
/**
* Render this block
*
* @see HTMLRender::render()
*/
protected function render() {
$output = '';
$o = array();
$i = 0;
$x = $y = 0;
Sort::MAsort(static::$_data,'order,position,title,subtitle');
foreach (static::$_data as $value) {
$i = (! isset($value['order'])) ? $i+1 : $value['order'];
// Work out our dimentions
if ($value['position'] > $y)
$y = $value['position'];
if ($i > $x)
$x = $i;
// @todo Alert if a sub block has already been defined.
$o[$i][$value['position']] = '<table class="subblock" border="0">';
if (! empty($value['title']))
$o[$i][$value['position']] .= sprintf('<tr class="title"><td>%s</td></tr>',$value['title']);
if (! empty($value['subtitle']))
$o[$i][$value['position']] .= sprintf('<tr class="subtitle"><td>%s</td></tr>',$value['subtitle']);
$o[$i][$value['position']] .= sprintf('<tr class="body"><td>%s</td></tr>',$value['body']);
if (! empty($value['footer']))
$o[$i][$value['position']] .= sprintf('<tr class="footer"><td>%s</td></tr>',$value['footer']);
$o[$i][$value['position']] .= '</table>';
}
// Render our output.
$output .= '<table class="subblockhead">';
foreach ($o as $k => $v)
$output .= sprintf('<tr><td style="width: %s%%;">%s</td></tr>',$x=round(100/$y,0),implode(sprintf('</td><td style="width: %s%%;">',$x),$v));
$output .= '</table>';
return $output;
}
}
?>

View File

@ -0,0 +1,92 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for rendering a BreadCrumb menu.
*
* @package lnApp
* @category lnApp/Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_BreadCrumb extends HTMLRender {
protected static $_data = array();
protected static $_spacer = ' &raquo; ';
protected static $_required_keys = array('body');
/**
* Set the BreadCrumb path
*
* @param array Block attributes
*/
public static function set($path) {
$path = strtolower($path);
if (is_string($path))
static::$_data['path'] = explode('/',$path);
elseif (is_array($path))
static::$_data['path'] = $path;
else
throw new Kohana_Exception('Path is not a string, nor an array');
}
/**
* Enable a friendly name to be used for a path
*/
public static function name($path,$name,$override=TRUE) {
if (isset(static::$_data['name'][$path]) AND ! $override)
return;
static::$_data['name'][$path] = $name;
}
/**
* Enable specifying the URL for a path
*/
public static function URL($path,$url,$override=TRUE) {
$path = strtolower($path);
$url = strtolower($url);
if (isset(static::$_data['url'][$path]) AND ! $override)
return;
static::$_data['url'][$path] = $url;
}
/**
* Return an instance of this class
*
* @return BreadCrumb
*/
public static function factory() {
return new BreadCrumb;
}
/**
* Render this BreadCrumb
*/
protected function render() {
$output = '<ul id="breadcrumb">';
$output .= '<li>'.HTML::anchor('/',_('Home')).'</li>';
$data = empty(static::$_data['path']) ? explode('/',preg_replace('/^\//','',Request::detect_uri())) : static::$_data['path'];
$c = count($data);
$i=0;
foreach ($data as $k => $v) {
$i++;
$p = join('/',array_slice($data,0,$k+1));
$output .= $i==$c ? '<li id="active">' : '<li>';
$output .= HTML::anchor(
(empty(static::$_data['url'][$p]) ? $p : static::$_data['url'][$p]),
(empty(static::$_data['name'][$p]) ? ucfirst($v) : static::$_data['name'][$p])
);
$output .= '</li>';
}
$output .= '</ul>';
return $output;
}
}
?>

View File

@ -0,0 +1,89 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides the default controller for rendering pages.
*
* @package lnApp
* @category lnApp/Controllers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_Controller_Default extends Controller {
/**
* The variable that our output is stored in
*/
protected $output = NULL;
/**
* @var string page media route as per [Route]
*/
protected $mediaroute = 'default/media';
/**
* Controls access to this controller.
* Can be set to a string or an array, for example 'login' or array('login', 'admin')
* Note that in second(array) example, user must have both 'login' AND 'admin' roles set in database
*
* @var boolean is authenticate required with this controller
*/
protected $auth_required = FALSE;
/**
* If redirecting to a login page, which page to redirect to
*/
protected $noauth_redirect = 'login';
/**
* Controls access for separate actions, eg:
* 'adminpanel' => 'admin' will only allow users with the role admin to access action_adminpanel
* 'moderatorpanel' => array('login', 'moderator') will only allow users with the roles login and moderator to access action_moderatorpanel
*
* @var array actions that require a valid user
*/
protected $secure_actions = array();
/**
* Check and see if this controller needs authentication
*
* if $this->auth_required is TRUE, then the user must be logged in only.
* if $this->auth_required is FALSE, AND $this->secure_actions has an array of
* methods set to TRUE, then the user must be logged in AND a member of the
* role.
*
* @return boolean
*/
protected function _auth_required() {
// If our global configurable is disabled, then continue
if (! Kohana::$config->load('config')->method_security)
return FALSE;
return (($this->auth_required !== FALSE && Auth::instance()->logged_in() === FALSE) ||
(is_array($this->secure_actions) && array_key_exists($this->request->action(),$this->secure_actions) &&
Auth::instance()->logged_in($this->secure_actions[$this->request->action()]) === FALSE));
}
public function before() {
parent::before();
// Check user auth and role
if ($this->_auth_required()) {
// For AJAX/JSON requests, authorisation is controlled in the method.
if (Request::current()->is_ajax() && $this->request->action() === 'json') {
// Nothing required.
// For no AJAX/JSON requests, display an access page
} elseif (Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__)) {
HTTP::redirect('login/noaccess');
} else {
Session::instance()->set('afterlogin',Request::detect_uri());
HTTP::redirect($this->noauth_redirect);
}
}
}
public function after() {
parent::after();
// Generate and check the ETag for this file
$this->check_cache(sha1($this->response->body()));
}
}
?>

View File

@ -0,0 +1,73 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides login capability
*
* @package lnApp
* @category lnApp/Controllers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
* @also [logout]
*/
class lnApp_Controller_Login extends Controller_TemplateDefault {
protected $auth_required = FALSE;
public function action_index() {
// If user already signed-in
if (Auth::instance()->logged_in()!= 0) {
// Redirect to the user account
HTTP::redirect(URL::link('user','welcome/index'));
}
// If there is a post and $_POST is not empty
if ($_POST) {
// Store our details in a session key
Session::instance()->set(Kohana::$config->load('auth')->session_key,$_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');
HTTP::redirect($redir);
} else
HTTP::redirect(URL::link('user','welcome/index'));
} else {
// We are not successful logging in, so delete our session data
Session::instance()->delete(Kohana::$config->load('auth')->session_key);
Session::instance()->delete('password');
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_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.')
));
}
}
?>

View File

@ -0,0 +1,27 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides logout capability
*
* @package lnApp
* @category lnApp/Controllers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
* @also [login]
*/
class lnApp_Controller_Logout extends Controller {
public function action_index() {
# If user already signed-in
if (Auth::instance()->logged_in()!= 0) {
$ao = Auth::instance()->get_user();
Auth::instance()->logout();
$ao->log('Logged Out');
HTTP::redirect('login');
}
HTTP::redirect('welcome/index');
}
}
?>

View File

@ -0,0 +1,63 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides access to rendering media items (javascript, images and css).
*
* @package lnApp
* @category lnApp/Controllers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_Controller_Media extends Controller {
/**
* This action will render all the media related files for a page
*
* @return void
*/
final 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);
// First try and find media files for the theme-site_id
} elseif ($f = Kohana::find_file($x=sprintf('media/site/%s/theme/%s',Config::siteid(),Config::theme()),$file,$ext)) {
// Send the file content as the response
$this->response->body(file_get_contents($f));
// Try and find media files for the site_id
} elseif ($f = Kohana::find_file(sprintf('media/site/%s',Config::siteid()),$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 OR Kohana::$config->load('debug')->etag)
$this->check_cache(sha1($this->response->body()));
// 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()));
}
}
?>

View File

@ -0,0 +1,20 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides the default controller for tasks.
*
* @package lnApp
* @category lnApp/Controllers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_Controller_Task extends Controller {
public function before() {
if (! Kohana::$is_cli)
throw new Kohana_Exception('Cant run :method, it must be run by the CLI',array(':method'=>$this->request->action()));
parent::before();
}
}
?>

View File

@ -0,0 +1,273 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides the default template controller for rendering pages.
*
* @package lnApp
* @category lnApp/Controllers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_Controller_TemplateDefault extends Controller_Template {
/**
* @var string page template
*/
public $template = 'lnapp/default';
/**
* @var object meta object information as per [meta]
*/
protected $meta;
/**
* Controls access to this controller.
* Can be set to a string or an array, for example 'login' or array('login', 'admin')
* Note that in second(array) example, user must have both 'login' AND 'admin' roles set in database
*
* @var boolean is authenticate required with this controller
*/
protected $auth_required = FALSE;
/**
* If redirecting to a login page, which page to redirect to
*/
protected $noauth_redirect = 'login';
/**
* Controls access for separate actions, eg:
* 'adminpanel' => 'admin' will only allow users with the role admin to access action_adminpanel
* 'moderatorpanel' => array('login', 'moderator') will only allow users with the roles login and moderator to access action_moderatorpanel
*
* @var array actions that require a valid user
*/
protected $secure_actions = array(
);
public function __construct(Request $request,Response $response) {
// Our Menu's can run without method authentication by default.
if (! isset($this->secure_actions['menu']))
$this->secure_actions['menu'] = FALSE;
return parent::__construct($request,$response);
}
/**
* Check and see if this controller needs authentication
*
* if $this->auth_required is TRUE, then the user must be logged in only.
* if $this->auth_required is FALSE, AND $this->secure_actions has an array of
* methods set to TRUE, then the user must be logged in AND a member of the
* role.
*
* @return boolean
*/
protected function _auth_required() {
// If our global configurable is disabled, then continue
if (! Kohana::$config->load('config')->method_security)
return FALSE;
return (($this->auth_required !== FALSE && Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__) === FALSE) ||
(is_array($this->secure_actions) && array_key_exists($this->request->action(),$this->secure_actions) &&
Auth::instance()->logged_in($this->secure_actions[$this->request->action()],get_class($this).'|'.__METHOD__) === FALSE));
}
/**
* Loads the template [View] object.
*
* Page information is provided by [meta].
* @uses meta
*/
public function before() {
// Do not template media files
if ($this->request->action() === 'media') {
$this->auto_render = FALSE;
return;
}
// Actions that start with ajax, should only be ajax
if (! Kohana::$config->load('debug')->ajax AND preg_match('/^ajax/',Request::current()->action()) AND ! Request::current()->is_ajax())
die();
parent::before();
// Check user auth and role
if ($this->_auth_required()) {
if (Kohana::$is_cli)
throw new Kohana_Exception('Cant run :method, authentication not possible',array(':method'=>$this->request->action()));
// If auth is required and the user is logged in, then they dont have access.
// (We have already checked authorisation.)
if (Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__)) {
if (Config::sitemode() == Kohana::DEVELOPMENT)
SystemMessage::add(array(
'title'=>_('Insufficient Access'),
'type'=>'debug',
'body'=>Debug::vars(array('required'=>$this->auth_required,'action'=>$this->request->action(),'user'=>Auth::instance()->get_user()->username)),
));
// @todo Login No Access redirects are not handled in JS?
if ($this->request->is_ajax()) {
echo _('You dont have enough permissions.');
die();
} else
HTTP::redirect('login/noaccess');
} else {
Session::instance()->set('afterlogin',Request::detect_uri());
HTTP::redirect($this->noauth_redirect);
}
}
// For AJAX calls, we dont need to render the complete page.
if ($this->request->is_ajax()) {
$this->auto_render = FALSE;
return;
}
// Bind our template meta variable
$this->meta = new Meta;
View::bind_global('meta',$this->meta);
// Add our logo
Style::add(array(
'type'=>'stdin',
'data'=>'h1 span{background:url('.Config::logo_uri().') no-repeat;}',
));
// Our default script(s)
foreach (array('file'=>array_reverse(array(
'js/jquery-1.6.4.min.js',
'js/jquery.jstree-1.0rc3.js',
'js/jquery.cookie.js',
))) as $type => $datas) {
foreach ($datas as $data) {
Script::add(array(
'type'=>$type,
'data'=>$data,
),TRUE);
}
}
// Initialise our content
$this->template->left = '';
$this->template->content = '';
$this->template->right = '';
}
public function after() {
if (! is_string($this->template) AND empty($this->template->content))
$this->template->content = Block::factory();
if ($this->auto_render) {
// Application Title
if ($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
$this->meta->language = Config::language();
// Description
$this->meta->description = sprintf('%s::%s',$this->request->controller(),$this->request->action());
// Link images on the header line
$this->template->headimages = $this->_headimages();
// System Messages line
$this->template->sysmsg = $this->_sysmsg();
// Left Item
$this->template->left = $this->_left();
// Right Item
$this->template->right = $this->_right();
// Footer
$this->template->footer = $this->_footer();
// For any ajax rendered actions, we'll need to capture the content and put it in the response
} elseif ($this->request->is_ajax() && isset($this->template->content) && ! $this->response->body()) {
// @todo move this formatting to a view?
if ($s = $this->_sysmsg() AND (string)$s)
$this->response->body(sprintf('<table class="sysmsg"><tr><td>%s</td></tr></table>',$s));
// In case there any style sheets for this render.
$this->response->bodyadd(Style::factory());
// Since we are ajax, we should re-render the breadcrumb
Session::instance()->set('breadcrumb',(string)BreadCrumb::factory());
$this->response->bodyadd(Script::add(array('type'=>'stdin','data'=>'$().ready($("#ajCONTROL").load("'.URL::site('welcome/breadcrumb').'",null,function(x,s,r) {}));')));
// In case there any javascript for this render.
$this->response->bodyadd(Script::factory());
// Get the response body
$this->response->bodyadd(sprintf('<table class="content"><tr><td>%s</td></tr></table>',$this->template->content));
}
parent::after();
// Generate and check the ETag for this file
if (Kohana::$environment === Kohana::PRODUCTION OR Kohana::$config->load('debug')->etag)
$this->check_cache(sha1($this->response->body()));
}
/**
* Default Method to call from the tree menu
*/
public function action_menu() {
$this->template->content = _('Please choose from the menu on the left - you may need to expand the items by pressing on the plus.');
}
protected function _headimages() {
HeadImages::add(array(
'url'=>'http://dev.leenooks.net',
'img'=>'img/forum-big.png',
'attrs'=>array('onclick'=>"target='_blank';",'title'=>'Link')
));
return HeadImages::factory();
}
protected function _sysmsg() {
return SystemMessage::factory();
}
protected function _left() {
return empty($this->template->left) ? Controller_Tree::js() : $this->template->left;
}
protected function _right() {
return empty($this->template->right) ? '' : $this->template->right;
}
public function _footer() {
return sprintf('&copy; %s',Config::sitename());
}
/**
* Generate a view path to help View::factory() calls
*
* The purpose of this method is to ensure that we have a consistant
* layout for our view files, including those that are needed by
* plugins
*
* @param string Plugin Name (optional)
*/
public function viewpath($plugin='') {
$request = Request::current();
$path = $request->controller();
if ($request->directory())
$path .= ($path ? '/' : '').$request->directory();
if ($plugin)
$path .= ($path ? '/' : '').$plugin;
$path .= ($path ? '/' : '').$request->action();
return strtolower($path);
}
}
?>

View File

@ -0,0 +1,116 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class extends renders OSB menu tree.
*
* @package lnApp
* @category lnApp/Controllers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
class lnApp_Controller_Tree extends Controller_Default {
/**
* @var string page media route as per [Route]
*/
protected static $jsmediaroute = 'default/media';
public function after() {
$this->response->headers('Content-Type','application/json');
$this->response->body(json_encode($this->output));
parent::after();
}
public static function js() {
$mediapath = Route::get(static::$jsmediaroute);
return '
<div id="tree" class=""></div>
<script type="text/javascript">
<!--
$(function () {
var use_ajax = false;
$("#tree").jstree({
themes : {
"theme" : "classic",
},
ui : {
"select_limit" : 1,
"select_node" : false,
},
cookies : {
"save_selected" : false,
"cookie_options" : { path : "'.URL::site().'" }
},
json_data : {
"correct_state" : "true",
"progressive_render" : "true",
"ajax" : {
"url" : "'.URL::site('tree/json').'",
"data" : function (n) {
return { id : n.attr ? n.attr("id") : "N_"+0 };
}
}
},
plugins : [ "themes", "json_data", "ui", "cookies" ],
});
// On selection
$("#tree").bind("select_node.jstree", function (e, data) {
if (a = data.rslt.obj.attr(\'id\').indexOf(\'_\')) {
id = data.rslt.obj.attr(\'id\').substr(a+1);
if (href = $("#N_"+id).attr("href")) {
if (! use_ajax) {
window.location = href;
return;
}
$("#ajBODY").empty().html("<img src=\"'.URL::site('media/img/ajax-progress.gif').'\" alt=\"Loading...\" />");
$("#ajBODY").load(href, function(r,s,x) {
if (s == "error") {
var msg = "Sorry but there was an error: ";
$("#ajBODY").html(msg + x.status + " " + x.statusText + r);
}
});
} else
alert("Unknown: "+id+" HREF:"+href);
}
});
});
// -->
</script>';
}
/**
* Draw the Tree Menu
*
* The incoming ID is either a Branch B_x or a Node N_x
* Where X is actually the module.
*
* @param array $data Tree data passed in by inherited methods
*/
public function action_json(array $data=array()) {
if ($this->_auth_required() AND ! Auth::instance()->logged_in()) {
$this->output = array('attr'=>array('id'=>'a_login'),
'data'=>array('title'=>_('Please Login').'...','attr'=>array('id'=>'N_login','href'=>URL::site('login'))));
return;
}
$this->output = array();
foreach ($data as $branch) {
array_push($this->output,array(
'attr'=>array('id'=>sprintf('B_%s',$branch['id'])),
'state'=>$branch['state'],
'data'=>array('title'=>$branch['name']),
'attr'=>array('id'=>sprintf('N_%s',$branch['id']),'href'=>empty($branch['attr_href']) ? URL::link('user',$branch['name'].'/menu',TRUE) : $branch['attr_href']),
)
);
}
}
}
?>

View File

@ -0,0 +1,20 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class extends Kohana's HTML
*
* @package lnApp
* @category Modifications
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_HTML extends Kohana_HTML {
public static function nbsp($string) {
if (strlen((string)$string))
return $string;
else
return '&nbsp;';
}
}
?>

View File

@ -0,0 +1,91 @@
<?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 lnApp
* @category lnApp/Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_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__));
}
}
?>

View File

@ -0,0 +1,47 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for all image icons shown on the page header.
*
* @package lnApp
* @category lnApp/Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_HeadImages extends HTMLRender {
protected static $_data = array();
protected static $_spacer = '&nbsp;';
protected static $_required_keys = array('img');
/**
* Return an instance of this class
*
* @return HeadImage
*/
public static function factory() {
return new HeadImages;
}
/**
* Render this Header Image
*
* @see HTMLRender::render()
*/
protected function render() {
$output = '';
$mediapath = Route::get(static::$_media_path);
foreach (static::$_data as $value) {
$i = HTML::image($mediapath->uri(array('file'=>$value['img'])),array('alt'=>isset($value['attrs']['title']) ? $value['attrs']['title'] : ''));
if (isset($value['url']))
$output .= HTML::anchor($value['url'],$i,(isset($value['attrs']) && is_array($value['attrs'])) ? $value['attrs'] : NULL);
else
$output .= $i;
$output .= static::$_spacer;
}
return $output;
}
}
?>

View File

@ -0,0 +1,33 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This is class is for all HTML page attributes.
*
* @package lnApp
* @category lnApp/Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_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;
}
}
?>

View File

@ -0,0 +1,35 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for providing password from a password genarator
*
* @package lnApp
* @category lnApp/Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_PWgen {
public static function get($pwonly=TRUE) {
if (! Kohana::$config->load('pwgen')->host OR ! Kohana::$config->load('pwgen')->port)
throw new Kohana_Exception('No configuration for host or port (:host/:port)',array(':host'=>Kohana::$config->load('pwgen')->host,':port'=>Kohana::$config->load('pwgen')->port));
$ps = socket_create(AF_INET,SOCK_STREAM,0);
if (! socket_connect($ps,Kohana::$config->load('pwgen')->host,Kohana::$config->load('pwgen')->port))
throw new Kohana_Exception('Unable to connect to password server');
// echo "Reading response:\n\n";
$pw = '';
while ($out = socket_read($ps,64))
$pw .= rtrim($out);
// echo "Closing socket...";
socket_close ($ps);
list($passwd,$passwdSay) = explode(' ',$pw);
// print " Password [$passwd] ($passwdSay) [$pw] ".md5($passwd)."<BR>";
return $pwonly ? $passwd : array('pw'=>$passwd,'say'=>$passwdSay);
}
}
?>

View File

@ -0,0 +1,17 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for generating Random data.
*
* @package lnApp
* @category lnApp/Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_Random {
public static function char($num=NULL) {
return substr(md5(rand()),0,is_null($num) ? rand(6,10) : $num-1);
}
}
?>

View File

@ -0,0 +1,64 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for rendering HTML script tags
*
* @package lnApp
* @category lnApp/Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_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');
protected static $_rendered = FALSE;
/**
* 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 'src':
$foutput .= HTML::script($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']));
}
}
static::$_rendered = TRUE;
return $foutput.static::$_spacer.$soutput;
}
public static function add($item,$prepend=FALSE,$x='') {
if (static::$_rendered)
throw new Kohana_Exception('Already rendered?');
return parent::add($item,$prepend);
}
}
?>

View File

@ -0,0 +1,89 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is used to sort multiple dimension arrays.
*
* @package lnApp
* @category lnApp/Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
* @uses Style
*/
abstract class lnApp_Sort {
/**
* Sort a multi dimensional array.
*
* @param array Multi demension array passed by reference
* @param string Comma delimited string of sort keys.
* @param boolean Whether to reverse sort.
* @return array Sorted multi demension array.
*/
public static function MAsort(&$data,$sortby,$rev=0) {
// if the array to sort is null or empty, or our sortby is bad
if (! preg_match('/^([a-zA-Z0-9_]+(\([a-zA-Z0-9_,]*\)(->[a-zA-Z0-9])?)?,?)+$/',$sortby) || ! $data)
return;
$code = '$c=0;';
foreach (explode(',',$sortby) as $key) {
$code .= 'if (is_object($a) || is_object($b)) {';
foreach (array('a','b') as $x) {
$code .= 'if (is_array($'.$x.'->'.$key.')) {';
$code .= 'asort($'.$x.'->'.$key.');';
$code .= '$x'.$x.' = array_shift($'.$x.'->'.$key.');';
$code .= '} else';
$code .= '$x'.$x.' = $'.$x.'->'.$key.';';
}
$code .= 'if ($xa != $xb)';
if ($rev)
$code .= 'return ($xa < $xb ? 1 : -1);';
else
$code .= 'return ($xa > $xb ? 1 : -1);';
$code .= '} else {';
foreach (array('a','b') as $x)
$code .= '$'.$x.' = array_change_key_case($'.$x.');';
$key = strtolower($key);
$code .= 'if ((! isset($a[\''.$key.'\'])) && isset($b[\''.$key.'\'])) return 1;';
$code .= 'if (isset($a[\''.$key.'\']) && (! isset($b[\''.$key.'\']))) return -1;';
$code .= 'if ((isset($a[\''.$key.'\'])) && (isset($b[\''.$key.'\']))) {';
foreach (array('a','b') as $x) {
$code .= 'if (is_array($'.$x.'[\''.$key.'\'])) {';
$code .= 'asort($'.$x.'[\''.$key.'\']);';
$code .= '$x'.$x.' = array_shift($'.$x.'[\''.$key.'\']);';
$code .= '} else';
$code .= '$x'.$x.' = $'.$x.'[\''.$key.'\'];';
}
$code .= 'if ($xa != $xb)';
$code .= 'if (is_numeric($xa) && is_numeric($xb)) {';
if ($rev)
$code .= 'return ($xa < $xb ? 1 : -1);';
else
$code .= 'return ($xa > $xb ? 1 : -1);';
$code .= '} else {';
if ($rev)
$code .= 'if (($c = strcasecmp($xb,$xa)) != 0) return $c;';
else
$code .= 'if (($c = strcasecmp($xa,$xb)) != 0) return $c;';
$code .= '}}}';
}
$code .= 'return $c;';
$result = create_function('$a, $b',$code);
uasort($data,$result);
}
}
?>

View File

@ -0,0 +1,53 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for rendering HTML style tags
*
* @package lnApp
* @category lnApp/Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_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;
}
}
?>

View File

@ -0,0 +1,128 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for rendering system information messages.
*
* @package lnApp
* @category lnApp/Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_SystemMessage extends HTMLRender {
protected static $_data = array();
protected static $_spacer = '<table><tr class="spacer"><td>&nbsp;</td></tr></table>';
protected static $_required_keys = array('title','body','type');
/**
* Add a system message to be rendered
*
* @param array System Message attributes
*/
public static function add($msg,$prepend=FALSE) {
if ($msgs = Session::instance()->get('sessionmsgs')) {
static::$_data = $msgs;
}
parent::add($msg);
// Add a gribber popup
Style::add(array(
'type'=>'file',
'data'=>'css/jquery.gritter.css',
'media'=>'screen',
));
Script::add(array(
'type'=>'file',
'data'=>'js/jquery.gritter-1.5.js',
));
Script::add(array(
'type'=>'stdin',
'data'=>sprintf(
'$(document).ready(function() {
$.extend($.gritter.options, {
fade_in_speed: "medium",
fade_out_speed: 2000,
time: "3000",
sticky: false,
});
$.gritter.add({
title: "%s",
text: "%s",
image: "%s",
});});',$msg['title'],$msg['body'],URL::site().static::image($msg['type'],true))));
// Save our messages in our session, so that we get them for redirects
Session::instance()->set('sessionmsgs',static::$_data);
}
/**
* Return an instance of this class
*
* @return SystemMessage
*/
public static function factory() {
return new SystemMessage;
}
/**
* Render an image for the System Message
*/
public static function image($type,$raw=false,$big=false,$alt='') {
$mediapath = Route::get(static::$_media_path);
switch ($type) {
case 'error':
$file = sprintf('img/dialog-error%s.png',$big ? '-big' : '');
break;
case 'info':
$file = sprintf('img/dialog-information%s.png',$big ? '-big' : '');
break;
case 'warning':
$file = sprintf('img/dialog-warning%s.png',$big ? '-big' : '');
break;
case 'debug':
$file = sprintf('img/dialog-question%s.png',$big ? '-big' : '');
break;
default:
throw new Kohana_Exception('Unknown system message type :type',array(':type'=>$value['type']));
}
if ($raw)
return $mediapath->uri(array('file'=>$file));
else
return HTML::image($mediapath->uri(array('file'=>$file)),array('alt'=>$alt ? $alt : '','class'=>'sysicon'));
}
/**
* Render this system message
*
* @see HTMLRender::render()
*/
protected function render() {
$output = '';
$mediapath = Route::get(static::$_media_path);
// Reload our message from the session
if ($msgs = Session::instance()->get('sessionmsgs')) {
Session::instance()->delete('sessionmsgs');
static::$_data = $msgs;
}
$i = 0;
foreach (static::$_data as $value) {
if ($i++)
$output .= static::$_spacer;
$output .= '<table><tr>';
$output .= sprintf('<td class="icon" rowspan="2">%s</td>',static::image($value['type'],false,false,isset($value['alt']) ? $value['alt'] : ''));
$output .= sprintf('<td class="head">%s</td>',$value['title']);
$output .= '</tr><tr>';
$output .= sprintf('<td class="body">%s</td>',$value['body']);
$output .= '</tr></table>';
}
return $output;
}
}
?>

View File

@ -0,0 +1,275 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for rendering a table of data.
*
* @package lnApp
* @category lnApp/Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
* @uses Style
*/
abstract class lnApp_Table {
public static function resolve($d,$key) {
if (is_array($d) AND isset($d[$key]))
$x = $d[$key];
// If the key is a method, we need to eval it
elseif (preg_match('/\(/',$key) OR preg_match('/-\>/',$key))
eval("\$x = \$d->$key;");
elseif (preg_match('/^__VALUE__$/',$key))
$x = $d;
else
$x = $d->display($key);
return $x;
}
public static function display($data,$rows,array $cols,array $option) {
if (! (array)$data)
return '';
$pag = NULL;
$view = $output = $button = '';
if (isset($option['type']) AND $option['type'])
switch ($option['type']) {
case 'select':
$view = 'table/select';
if (! empty($option['button']))
$button = implode('',$option['button']);
else
$button = Form::button('Submit','View/Edit',array('class'=>'form_button','type'=>'submit'));
Script::add(array(
'type'=>'stdin',
'data'=>'
(function($) {
// Enable Range Selection
$.fn.enableCheckboxRangeSelection = function() {
var lastCheckbox = null;
var followOn = 0;
var $spec = this;
$spec.bind("click", function(e) {
if (lastCheckbox != null && e.shiftKey) {
x = y = 0;
if (followOn != 0) {
if ($spec.index(lastCheckbox) < $spec.index(e.target)) {
x = 1 - ((followOn == 1) ? 1 : 0);
} else {
y = 1 - ((followOn == -1) ? 1 : 0);
}
}
$spec.slice(
Math.min($spec.index(lastCheckbox) - x, $spec.index(e.target)) + 1,
Math.max($spec.index(lastCheckbox), $spec.index(e.target)) + y
).attr("checked",function() { return ! this.checked; })
.parent().parent().toggleClass("selected");
followOn = ($spec.index(lastCheckbox) < $spec.index(e.target)) ? 1 : -1;
} else {
followOn = 0;
}
lastCheckbox = e.target;
});
return $spec;
};
// Enable Toggle, (De)Select All
$.fn.check = function(mode) {
// if mode is undefined, use "on" as default
var mode = mode || "on";
switch(mode) {
case "on":
$("#select-table tr:not(.head)")
.filter(":has(:checkbox:not(checked))")
.toggleClass("selected")
break;
case "off":
$("#select-table tr:not(.head)")
.filter(":has(:checkbox:checked)")
.toggleClass("selected")
break;
case "toggle":
$("#select-table tr:not(.head)")
.toggleClass("selected");
break;
}
return this.each(function(e) {
switch(mode) {
case "on":
this.checked = true;
break;
case "off":
this.checked = false;
break;
case "toggle":
this.checked = !this.checked;
break;
}
});
};
})(jQuery);
// Bind our actions
$(document).ready(function() {
$("#select-table :checkbox").enableCheckboxRangeSelection();
$("#select-menu > #toggle").bind("click",function() {
$("#select-table :checkbox").check("toggle");
});
$("#select-menu > #all_on").bind("click",function() {
$("#select-table :checkbox").check("on");
});
$("#select-menu > #all_off").bind("click",function() {
$("#select-table :checkbox").check("off");
});
// Our mouse over row highlight
$("#select-table tr:not(.head)").hover(function() {
$(this).children().toggleClass("highlight");
},
function() {
$(this).children().toggleClass("highlight");
});
// Click to select Row
$("#select-table tr:not(.head)")
.filter(":has(:checkbox:checked)")
.addClass("selected")
.end()
.click(function(e) {
$(this).toggleClass("selected");
if (e.target.type !== "checkbox") {
$(":checkbox", this).attr("checked", function() {
return !this.checked;
});
}
});
// Double click to select a row
$("#select-table tr:not(.head)")
.dblclick(function(e) {
window.location = $("a", this).attr("href");
});
});
'));
$output .= Form::open((isset($option['form']) ? $option['form'] : ''));
if (! empty($option['hidden']))
$output .= '<div>'.implode('',$option['hidden']).'</div>';
break;
case 'list':
default:
Script::add(array(
'type'=>'stdin',
'data'=>'
// Bind our actions
$(document).ready(function() {
// Our mouse over row highlight
$("#list-table tr:not(.head)").hover(function() {
$(this).children().toggleClass("highlight");
},
function() {
$(this).children().toggleClass("highlight");
});
});
'));
}
If (! $view)
$view = 'table/list';
if (isset($option['page']) AND $option['page']) {
$pag = new Pagination(array(
'total_items'=>count($data),
'items_per_page'=>$rows,
));
$output .= (string)$pag;
}
$other = $i = 0;
$td = $th = array();
foreach ($cols as $col => $details) {
$th[$col] = isset($details['label']) ? $details['label'] : '';
$td[$col]['class'] = isset($details['class']) ? $details['class'] : '';
$td[$col]['url'] = isset($details['url']) ? $details['url'] : '';
}
$output .= View::factory($view.'_head')
->set('th',array_values($th));
foreach ($data as $do) {
if ($pag) {
if (++$i < $pag->current_first_item())
continue;
elseif ($i > $pag->current_last_item())
break;
}
if ($pag OR ($i++ < $rows) OR is_null($rows)) {
foreach (array_keys($cols) as $col)
$td[$col]['value'] = Table::resolve($do,$col);
$output .= View::factory($view.'_body')
->set('td',$td);
} elseif (isset($option['show_other']) AND ($col=$option['show_other'])) {
$other += Table::resolve($do,$col);
}
}
if ($other)
$output .= View::factory($view.'_xtra')
->set('td',array_values($cols))
->set('count',$i-$rows)
->set('other',$other);
$output .= View::factory($view.'_foot')
->set('button',$button);
if (isset($option['type']) AND $option['type'])
switch ($option['type']) {
case 'select':
$output .= Form::close();
}
return $output;
}
public static function post($key,$i='id') {
if (isset($_POST[$i]))
Session::instance()->set('page_table_view'.$key,$_POST[$i]);
}
public static function page($key) {
// We have preference for parameters passed to the action.
if (is_null($id = Request::current()->param('id'))) {
if (isset($_POST['id']) AND is_array($_POST['id']))
Table::post($key,'id');
if ($ids = Session::instance()->get('page_table_view'.$key)) {
$pag = new Pagination(array(
'total_items'=>count($ids),
'items_per_page'=>1,
));
return array($ids[$pag->current_first_item()-1],(string)$pag);
}
}
// If we get here, then there is no previous data to retrieve.
return array($id,'');
}
}
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

View File

@ -0,0 +1,351 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Dashboard I Admin Panel</title>
<link rel="stylesheet" href="css/layout.css" type="text/css" media="screen" />
<!--[if lt IE 9]>
<link rel="stylesheet" href="css/ie.css" type="text/css" media="screen" />
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="js/jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="js/hideshow.js" type="text/javascript"></script>
<script src="js/jquery.tablesorter.min.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.equalHeight.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(".tablesorter").tablesorter();
}
);
$(document).ready(function() {
//When page loads...
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active ID content
return false;
});
});
</script>
<script type="text/javascript">
$(function(){
$('.column').equalHeight();
});
</script>
</head>
<body>
<header id="header">
<hgroup>
<h1 class="site_title"><a href="index.html">Website Admin</a></h1>
<h2 class="section_title">Dashboard</h2><div class="btn_view_site"><a href="http://www.medialoot.com">View Site</a></div>
</hgroup>
</header> <!-- end of header bar -->
<section id="secondary_bar">
<div class="user">
<p>John Doe (<a href="#">3 Messages</a>)</p>
<!-- <a class="logout_user" href="#" title="Logout">Logout</a> -->
</div>
<div class="breadcrumbs_container">
<article class="breadcrumbs"><a href="index.html">Website Admin</a> <div class="breadcrumb_divider"></div> <a class="current">Dashboard</a></article>
</div>
</section><!-- end of secondary bar -->
<aside id="sidebar" class="column">
<form class="quick_search">
<input type="text" value="Quick Search" onfocus="if(!this._haschanged){this.value=''};this._haschanged=true;">
</form>
<hr/>
<h3>Content</h3>
<ul class="toggle">
<li class="icn_new_article"><a href="#">New Article</a></li>
<li class="icn_edit_article"><a href="#">Edit Articles</a></li>
<li class="icn_categories"><a href="#">Categories</a></li>
<li class="icn_tags"><a href="#">Tags</a></li>
</ul>
<h3>Users</h3>
<ul class="toggle">
<li class="icn_add_user"><a href="#">Add New User</a></li>
<li class="icn_view_users"><a href="#">View Users</a></li>
<li class="icn_profile"><a href="#">Your Profile</a></li>
</ul>
<h3>Media</h3>
<ul class="toggle">
<li class="icn_folder"><a href="#">File Manager</a></li>
<li class="icn_photo"><a href="#">Gallery</a></li>
<li class="icn_audio"><a href="#">Audio</a></li>
<li class="icn_video"><a href="#">Video</a></li>
</ul>
<h3>Admin</h3>
<ul class="toggle">
<li class="icn_settings"><a href="#">Options</a></li>
<li class="icn_security"><a href="#">Security</a></li>
<li class="icn_jump_back"><a href="#">Logout</a></li>
</ul>
<footer>
<hr />
<p><strong>Copyright &copy; 2011 Website Admin</strong></p>
<p>Theme by <a href="http://www.medialoot.com">MediaLoot</a></p>
</footer>
</aside><!-- end of sidebar -->
<section id="main" class="column">
<h4 class="alert_info">Welcome to the free MediaLoot admin panel template, this could be an informative message.</h4>
<article class="module width_full">
<header><h3>Stats</h3></header>
<div class="module_content">
<article class="stats_graph">
<img src="http://chart.apis.google.com/chart?chxr=0,0,3000&chxt=y&chs=520x140&cht=lc&chco=76A4FB,80C65A&chd=s:Tdjpsvyvttmiihgmnrst,OTbdcfhhggcTUTTUadfk&chls=2|2&chma=40,20,20,30" width="520" height="140" alt="" />
</article>
<article class="stats_overview">
<div class="overview_today">
<p class="overview_day">Today</p>
<p class="overview_count">1,876</p>
<p class="overview_type">Hits</p>
<p class="overview_count">2,103</p>
<p class="overview_type">Views</p>
</div>
<div class="overview_previous">
<p class="overview_day">Yesterday</p>
<p class="overview_count">1,646</p>
<p class="overview_type">Hits</p>
<p class="overview_count">2,054</p>
<p class="overview_type">Views</p>
</div>
</article>
<div class="clear"></div>
</div>
</article><!-- end of stats article -->
<article class="module width_3_quarter">
<header><h3 class="tabs_involved">Content Manager</h3>
<ul class="tabs">
<li><a href="#tab1">Posts</a></li>
<li><a href="#tab2">Comments</a></li>
</ul>
</header>
<div class="tab_container">
<div id="tab1" class="tab_content">
<table class="tablesorter" cellspacing="0">
<thead>
<tr>
<th></th>
<th>Entry Name</th>
<th>Category</th>
<th>Created On</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="checkbox"></td>
<td>Lorem Ipsum Dolor Sit Amet</td>
<td>Articles</td>
<td>5th April 2011</td>
<td><input type="image" src="images/icn_edit.png" title="Edit"><input type="image" src="images/icn_trash.png" title="Trash"></td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>Ipsum Lorem Dolor Sit Amet</td>
<td>Freebies</td>
<td>6th April 2011</td>
<td><input type="image" src="images/icn_edit.png" title="Edit"><input type="image" src="images/icn_trash.png" title="Trash"></td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>Sit Amet Dolor Ipsum</td>
<td>Tutorials</td>
<td>10th April 2011</td>
<td><input type="image" src="images/icn_edit.png" title="Edit"><input type="image" src="images/icn_trash.png" title="Trash"></td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>Dolor Lorem Amet</td>
<td>Articles</td>
<td>16th April 2011</td>
<td><input type="image" src="images/icn_edit.png" title="Edit"><input type="image" src="images/icn_trash.png" title="Trash"></td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>Dolor Lorem Amet</td>
<td>Articles</td>
<td>16th April 2011</td>
<td><input type="image" src="images/icn_edit.png" title="Edit"><input type="image" src="images/icn_trash.png" title="Trash"></td>
</tr>
</tbody>
</table>
</div><!-- end of #tab1 -->
<div id="tab2" class="tab_content">
<table class="tablesorter" cellspacing="0">
<thead>
<tr>
<th></th>
<th>Comment</th>
<th>Posted by</th>
<th>Posted On</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="checkbox"></td>
<td>Lorem Ipsum Dolor Sit Amet</td>
<td>Mark Corrigan</td>
<td>5th April 2011</td>
<td><input type="image" src="images/icn_edit.png" title="Edit"><input type="image" src="images/icn_trash.png" title="Trash"></td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>Ipsum Lorem Dolor Sit Amet</td>
<td>Jeremy Usbourne</td>
<td>6th April 2011</td>
<td><input type="image" src="images/icn_edit.png" title="Edit"><input type="image" src="images/icn_trash.png" title="Trash"></td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>Sit Amet Dolor Ipsum</td>
<td>Super Hans</td>
<td>10th April 2011</td>
<td><input type="image" src="images/icn_edit.png" title="Edit"><input type="image" src="images/icn_trash.png" title="Trash"></td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>Dolor Lorem Amet</td>
<td>Alan Johnson</td>
<td>16th April 2011</td>
<td><input type="image" src="images/icn_edit.png" title="Edit"><input type="image" src="images/icn_trash.png" title="Trash"></td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>Dolor Lorem Amet</td>
<td>Dobby</td>
<td>16th April 2011</td>
<td><input type="image" src="images/icn_edit.png" title="Edit"><input type="image" src="images/icn_trash.png" title="Trash"></td>
</tr>
</tbody>
</table>
</div><!-- end of #tab2 -->
</div><!-- end of .tab_container -->
</article><!-- end of content manager article -->
<article class="module width_quarter">
<header><h3>Messages</h3></header>
<div class="message_list">
<div class="module_content">
<div class="message"><p>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor.</p>
<p><strong>John Doe</strong></p></div>
<div class="message"><p>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor.</p>
<p><strong>John Doe</strong></p></div>
<div class="message"><p>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor.</p>
<p><strong>John Doe</strong></p></div>
<div class="message"><p>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor.</p>
<p><strong>John Doe</strong></p></div>
<div class="message"><p>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor.</p>
<p><strong>John Doe</strong></p></div>
</div>
</div>
<footer>
<form class="post_message">
<input type="text" value="Message" onfocus="if(!this._haschanged){this.value=''};this._haschanged=true;">
<input type="submit" class="btn_post_message" value=""/>
</form>
</footer>
</article><!-- end of messages article -->
<div class="clear"></div>
<article class="module width_full">
<header><h3>Post New Article</h3></header>
<div class="module_content">
<fieldset>
<label>Post Title</label>
<input type="text">
</fieldset>
<fieldset>
<label>Content</label>
<textarea rows="12"></textarea>
</fieldset>
<fieldset style="width:48%; float:left; margin-right: 3%;"> <!-- to make two field float next to one another, adjust values accordingly -->
<label>Category</label>
<select style="width:92%;">
<option>Articles</option>
<option>Tutorials</option>
<option>Freebies</option>
</select>
</fieldset>
<fieldset style="width:48%; float:left;"> <!-- to make two field float next to one another, adjust values accordingly -->
<label>Tags</label>
<input type="text" style="width:92%;">
</fieldset><div class="clear"></div>
</div>
<footer>
<div class="submit_link">
<select>
<option>Draft</option>
<option>Published</option>
</select>
<input type="submit" value="Publish" class="alt_btn">
<input type="submit" value="Reset">
</div>
</footer>
</article><!-- end of post new article -->
<h4 class="alert_warning">A Warning Alert</h4>
<h4 class="alert_error">An Error Message</h4>
<h4 class="alert_success">A Success Message</h4>
<article class="module width_full">
<header><h3>Basic Styles</h3></header>
<div class="module_content">
<h1>Header 1</h1>
<h2>Header 2</h2>
<h3>Header 3</h3>
<h4>Header 4</h4>
<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cras mattis consectetur purus sit amet fermentum. Maecenas faucibus mollis interdum. Maecenas faucibus mollis interdum. Cras justo odio, dapibus ac facilisis in, egestas eget quam.</p>
<p>Donec id elit non mi porta <a href="#">link text</a> gravida at eget metus. Donec ullamcorper nulla non metus auctor fringilla. Cras mattis consectetur purus sit amet fermentum. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</p>
<ul>
<li>Donec ullamcorper nulla non metus auctor fringilla. </li>
<li>Cras mattis consectetur purus sit amet fermentum.</li>
<li>Donec ullamcorper nulla non metus auctor fringilla. </li>
<li>Cras mattis consectetur purus sit amet fermentum.</li>
</ul>
</div>
</article><!-- end of styles article -->
<div class="spacer"></div>
</section>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More