Fixes to work with KH 3.3

This commit is contained in:
Deon George 2012-11-26 16:57:18 +11:00
parent 5bd1841571
commit fc2ffd7bad
97 changed files with 5459 additions and 578 deletions

View File

@ -114,7 +114,7 @@ Kohana::modules(array(
'cron' => SMDPATH.'cron', // Kohana Cron Module 'cron' => SMDPATH.'cron', // Kohana Cron Module
// 'codebench' => SMDPATH.'codebench', // Benchmarking tool // 'codebench' => SMDPATH.'codebench', // Benchmarking tool
'database' => SMDPATH.'database', // Database access 'database' => SMDPATH.'database', // Database access
'gchart' => MODPATH.'gchart', // Google Chart Module // 'gchart' => MODPATH.'gchart', // Google Chart Module
// 'image' => SMDPATH.'image', // Image manipulation // 'image' => SMDPATH.'image', // Image manipulation
'khemail' => SMDPATH.'khemail', // Email module for Kohana 3 PHP Framework 'khemail' => SMDPATH.'khemail', // Email module for Kohana 3 PHP Framework
'minion' => SMDPATH.'minion', // CLI Tasks 'minion' => SMDPATH.'minion', // CLI Tasks
@ -155,7 +155,7 @@ Route::set('default', '(<controller>(/<action>(/<id>)))', array('id'=>'[a-zA-Z0-
/** /**
* If APC is enabled, and we need to clear the cache * 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 ! Kohana::$is_cli) { 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')) if (! apc_clear_cache() OR ! unlink(APPPATH.'cache/CLEAR_APC_CACHE'))
throw new Kohana_Exception('Unable to clear the 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 PTA/Modifications
* @category Classes
* @category Helpers
* @author Deon George
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
class Cookie extends Kohana_Cookie {
public static $salt = 'PTA';
}
?>

View File

@ -10,7 +10,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class ORMTSM extends ORM { abstract class TSM_ORM extends ORM {
// Suppress ORMs inclusion of <table_name>.* // Suppress ORMs inclusion of <table_name>.*
protected $_disable_wild_select = TRUE; protected $_disable_wild_select = TRUE;
// Suppress ORMs inclusion of <table_name>. to column joins // Suppress ORMs inclusion of <table_name>. to column joins
@ -35,11 +35,11 @@ class ORMTSM extends ORM {
*/ */
protected function _initialize() { protected function _initialize() {
// Set out DB connection configuration. // Set out DB connection configuration.
$this->_db_group = Kohana::config('config.client_type'); $this->_db_group = Kohana::$config->load('config.client_type');
// Adjustments for DSMADMC or DB2 connections // Adjustments for DSMADMC or DB2 connections
if (array_key_exists(Kohana::config('config.client_type'),$this->_tsm)) if (array_key_exists($this->_db_group,$this->_tsm))
foreach ($this->_tsm[Kohana::config('config.client_type')] as $k => $v) foreach ($this->_tsm[$this->_db_group] as $k => $v)
if (preg_match('/^_/',$k)) if (preg_match('/^_/',$k))
$this->{$k} = $v; $this->{$k} = $v;
@ -51,8 +51,8 @@ class ORMTSM extends ORM {
public function __get($column) { public function __get($column) {
// Get a substited column name - need for DB2/DSMADMC schema differences // Get a substited column name - need for DB2/DSMADMC schema differences
if (isset($this->_tsm[Kohana::config('config.client_type')]['translate']) AND array_key_exists($column,$this->_tsm[Kohana::config('config.client_type')]['translate'])) { if (isset($this->_tsm[$this->_db_group]['translate']) AND array_key_exists($column,$this->_tsm[$this->_db_group]['translate'])) {
return is_null($c=$this->_tsm[Kohana::config('config.client_type')]['translate'][$column]) ? NULL : parent::__get($c); return is_null($c=$this->_tsm[$this->_db_group]['translate'][$column]) ? NULL : parent::__get($c);
} }
else else
return parent::__get($column); return parent::__get($column);
@ -104,7 +104,7 @@ class ORMTSM extends ORM {
private function isCacheable() { private function isCacheable() {
$preload = array('NODES','VOLUMES'); $preload = array('NODES','VOLUMES');
$config = Kohana::config('database')->{Database::$default}; $config = Kohana::$config->load('database')->{Database::$default};
if ($config['caching'] AND isset($config['cachepreload'][$this->_table_name]) AND count($this->_db_pending) == 1 AND $this->_db_pending[0]['name'] == 'where' AND $this->_db_pending[0]['args'][0] == $this->_primary_key AND $this->_db_pending[0]['args'][1] == '=') if ($config['caching'] AND isset($config['cachepreload'][$this->_table_name]) AND count($this->_db_pending) == 1 AND $this->_db_pending[0]['name'] == 'where' AND $this->_db_pending[0]['args'][0] == $this->_primary_key AND $this->_db_pending[0]['args'][1] == '=')
return $config['cachepreload'][$this->_table_name]; return $config['cachepreload'][$this->_table_name];
@ -126,6 +126,7 @@ class ORMTSM extends ORM {
* we hard code the cache to 7 days. * we hard code the cache to 7 days.
* *
* @return array * @return array
* @todo This cache time needs to be better integrated with other caching times.
*/ */
public function list_columns() { public function list_columns() {
// We'll cache our query results // We'll cache our query results

View File

@ -22,7 +22,7 @@ class Auth_ORM extends Kohana_Auth_ORM {
// Override Kohana logged_in() - if we can get the user, we are logged in. // Override Kohana logged_in() - if we can get the user, we are logged in.
public function logged_in($role = NULL, $all_required = TRUE) { public function logged_in($role = NULL, $all_required = TRUE) {
return FALSE !== $this->get_user(); return NULL !== $this->get_user();
} }
} }
?> ?>

View File

@ -26,12 +26,14 @@ class Auth_TSM extends Auth_ORM {
// Load the user // Load the user
$user = ORM::factory('admin') $user = ORM::factory('admin')
->where('ADMIN_NAME','=',$username) ->where('ADMIN_NAME','=',strtoupper($username))
->cached(0)
->find(); ->find();
return $user->loaded();
} }
// Normally, if we get this far, we are already logged in. return FALSE;
return TRUE;
} }
} }
?> ?>

View File

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

View File

@ -47,7 +47,7 @@ class Controller_DOMAIN extends Controller_TemplateDefault {
'body'=>_('The domain name is required.'), 'body'=>_('The domain name is required.'),
)); ));
Request::current()->redirect('domain'); HTTP::redirect('domain');
} }
$do = ORM::factory('domain',$domain_name); $do = ORM::factory('domain',$domain_name);
@ -58,7 +58,7 @@ class Controller_DOMAIN extends Controller_TemplateDefault {
'body'=>sprintf(_('The domain [%s] does not exist?.'),$domain_name), 'body'=>sprintf(_('The domain [%s] does not exist?.'),$domain_name),
)); ));
Request::current()->redirect('domain'); HTTP::redirect('domain');
} }
Block::add(array( Block::add(array(

View File

@ -47,7 +47,7 @@ class Controller_LIBRARY extends Controller_TemplateDefault {
'body'=>_('The library pool name is required.'), 'body'=>_('The library pool name is required.'),
)); ));
Request::current()->redirect('library'); HTTP::redirect('library');
} }
$lo = ORM::factory('library',$library); $lo = ORM::factory('library',$library);
@ -58,7 +58,7 @@ class Controller_LIBRARY extends Controller_TemplateDefault {
'body'=>sprintf(_('The library pool [%s] does not exist?.'),$library), 'body'=>sprintf(_('The library pool [%s] does not exist?.'),$library),
)); ));
Request::current()->redirect('library'); HTTP::redirect('library');
} }
Block::add(array( Block::add(array(

View File

@ -1,199 +0,0 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides login capability
*
* @package lnApp
* @subpackage Page/Login
* @category Controllers
* @author Deon George
* @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html
* @also [logout]
*/
class Controller_lnApp_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
Request::current()->redirect('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('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');
Request::current()->redirect($redir);
} else
Request::current()->redirect('welcome/index');
} else {
SystemMessage::add(array(
'title'=>_('Invalid username or password'),
'type'=>'error',
'body'=>_('The username or password was invalid.')
));
}
}
Block::add(array(
'title'=>_('Login to server'),
'body'=>View::factory('login'),
'style'=>array('css/login.css'=>'screen'),
));
Script::add(array('type'=>'stdin','data'=>'
$(document).ready(function() {
$("#ajxbody").click(function() {$("#ajBODY").load("'.$this->request->uri().'/"); return false;});
});'
));
}
public function action_register() {
// If user already signed-in
if (Auth::instance()->logged_in()!= 0) {
// Redirect to the user account
Request::current()->redirect('welcome/index');
}
// Instantiate a new user
$account = ORM::factory('account');
// If there is a post and $_POST is not empty
if ($_POST) {
// Check Auth
$status = $account->values($_POST)->check();
if (! $status) {
foreach ($account->validation()->errors('form/register') as $f => $r) {
// $r[0] has our reason for validation failure
switch ($r[0]) {
// Generic validation reason
default:
SystemMessage::add(array(
'title'=>_('Validation failed'),
'type'=>'error',
'body'=>sprintf(_('The defaults on your submission were not valid for field %s (%s).'),$f,$r)
));
}
}
}
$ido = ORM::factory('module')
->where('name','=','account')
->find();
$account->id = $ido->record_id->next_id($ido->id);
// Save the user details
if ($account->save()) {}
}
SystemMessage::add(array(
'title'=>_('Already have an account?'),
'type'=>'info',
'body'=>_('If you already have an account, please login..')
));
Block::add(array(
'title'=>_('Register'),
'body'=>View::factory('bregister')
->set('account',$account)
->set('errors',$account->validation()->errors('form/register')),
));
$this->template->left = HTML::anchor('login','Login').'...';
}
/**
* Enable user password reset
*/
public function action_reset() {
// If user already signed-in
if (Auth::instance()->logged_in()!= 0) {
// Redirect to the user account
Request::current()->redirect('welcome/index');
}
// If the user posted their details to reset their password
if ($_POST) {
// If the email address is correct, create a method token
if (! empty($_POST['email']) AND ($ao=ORM::factory('account',array('email'=>$_POST['email']))) AND $ao->loaded()) {
$mt = ORM::factory('module_method_token');
// Find out our password reset method id
// @todo move this to a more generic method, so that it can be called by other methods
$mo = ORM::factory('module',array('name'=>'account'));
$mmo = ORM::factory('module_method',array('name'=>'user_resetpassword','module_id'=>$mo->id));
// Check to see if there is already a token, if so, do nothing.
if ($mt->where('account_id','=',$ao->id)->and_where('method_id','=',$mmo->id)->find()) {
if ($mt->date_expire < time()) {
$mt->delete();
$mt->clear();
}
}
if (! $mt->loaded()) {
$mt->account_id = $ao->id;
$mt->method_id = $mmo->id;
$mt->date_expire = time() + 15*3600;
$mt->token = md5(sprintf('%s:%s:%s',$mt->account_id,$mt->method_id,$mt->date_expire));
$mt->save();
// Send our email with the token
$et = EmailTemplate::instance('account_reset_password');
$et->to = array($mt->account->email=>sprintf('%s %s',$mt->account->first_name,$mt->account->last_name));
$et->variables = array(
'SITE'=>URL::base(TRUE,TRUE),
'SITE_ADMIN'=>Config::sitename(),
'SITE_NAME'=>Config::sitename(),
'TOKEN'=>$mt->token,
'USER_NAME'=>sprintf('%s %s',$mt->account->first_name,$mt->account->last_name),
);
$et->send();
}
// Redirect to our password reset, the Auth will validate the token.
} elseif (! empty($_REQUEST['token'])) {
Request::current()->redirect(sprintf('user/account/resetpassword?token=%s',$_REQUEST['token']));
}
// Show our token screen even if the email was invalid.
if (isset($_POST['email']))
Block::add(array(
'title'=>_('Reset your password'),
'body'=>View::factory('login_reset_sent'),
'style'=>array('css/login.css'=>'screen'),
));
else
Request::current()->redirect('login');
} else {
Block::add(array(
'title'=>_('Reset your password'),
'body'=>View::factory('login_reset'),
'style'=>array('css/login.css'=>'screen'),
));
}
}
public function action_noaccess() {
SystemMessage::add(array(
'title'=>_('No access to requested resource'),
'type'=>'error',
'body'=>_('You do not have access to the requested resource, please contact your administrator.')
));
}
}
?>

View File

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

View File

@ -1,4 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.'); <?php defined('SYSPATH') or die('No direct access allowed.');
class Controller_Logout extends Controller_lnApp_Logout {} 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

@ -47,7 +47,7 @@ class Controller_NODE extends Controller_TemplateDefault {
'body'=>_('The node name is required.'), 'body'=>_('The node name is required.'),
)); ));
Request::current()->redirect('node'); HTTP::redirect('node');
} }
$no = ORM::factory('node',$node_name); $no = ORM::factory('node',$node_name);
@ -58,7 +58,7 @@ class Controller_NODE extends Controller_TemplateDefault {
'body'=>sprintf(_('The node [%s] does not exist?.'),$node_name), 'body'=>sprintf(_('The node [%s] does not exist?.'),$node_name),
)); ));
Request::current()->redirect('node'); HTTP::redirect('node');
} }
Block::add(array( Block::add(array(

View File

@ -47,7 +47,7 @@ class Controller_STGPOOL extends Controller_TemplateDefault {
'body'=>_('The stgpool pool name is required.'), 'body'=>_('The stgpool pool name is required.'),
)); ));
Request::current()->redirect('stgpool'); HTTP::redirect('stgpool');
} }
$so = ORM::factory('stgpool',$stgpool); $so = ORM::factory('stgpool',$stgpool);
@ -58,7 +58,7 @@ class Controller_STGPOOL extends Controller_TemplateDefault {
'body'=>sprintf(_('The stgpool pool [%s] does not exist?.'),$stgpool), 'body'=>sprintf(_('The stgpool pool [%s] does not exist?.'),$stgpool),
)); ));
Request::current()->redirect('stgpool'); HTTP::redirect('stgpool');
} }
Block::add(array( Block::add(array(

View File

@ -10,7 +10,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Controller_TemplateDefault extends Controller_lnApp_TemplateDefault { class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
protected $auth_required = TRUE; protected $auth_required = TRUE;
} }
?> ?>

View File

@ -10,7 +10,7 @@
* @copyright (c) 2010 Open Source Billing * @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class Controller_Tree extends Controller_lnApp_Tree { class Controller_Tree extends lnApp_Controller_Tree {
protected $auth_required = TRUE; protected $auth_required = TRUE;
/** /**
@ -21,7 +21,7 @@ class Controller_Tree extends Controller_lnApp_Tree {
* *
* @param id * @param id
*/ */
public function action_json($id=null,array $data=array()) { public function action_json(array $data=array()) {
// @todo Our menu options // @todo Our menu options
array_push($data,array( array_push($data,array(
'id'=>'domain', 'id'=>'domain',
@ -63,7 +63,7 @@ class Controller_Tree extends Controller_lnApp_Tree {
'attr_href'=>URL::Site('stgpool'), 'attr_href'=>URL::Site('stgpool'),
)); ));
return parent::action_json($id,$data); return parent::action_json($data);
} }
} }
?> ?>

View File

@ -14,11 +14,11 @@ class Controller_Welcome extends Controller_TemplateDefault {
protected $auth_required = FALSE; protected $auth_required = FALSE;
public function action_index() { public function action_index() {
if (! Kohana::config('config.client')) if (! Kohana::$config->load('config')->client)
Request::current()->redirect('guide/pta'); HTTP::redirect('guide/app');
if (! Auth::instance()->logged_in()) if (! Auth::instance()->logged_in())
Request::current()->redirect('login'); HTTP::redirect('login');
Block::add(array( Block::add(array(
'title'=>sprintf('%s: %s (%s)',_('Server'),TSM::name(),TSM::version()), 'title'=>sprintf('%s: %s (%s)',_('Server'),TSM::name(),TSM::version()),

View File

@ -69,7 +69,9 @@ abstract class Database_TSM extends Database {
public function query($type, $sql, $as_object = FALSE, array $params = NULL) { public function query($type, $sql, $as_object = FALSE, array $params = NULL) {
// Make sure the database is connected // Make sure the database is connected
$this->_connection or $this->connect(); if (! $this->_connection && ! $this->connect())
return new Database_TSM_Result(array(),'',$as_object,$params);
$this->clear(); $this->clear();
if ( ! empty($this->_config['profiling'])) if ( ! empty($this->_config['profiling']))
@ -84,8 +86,7 @@ abstract class Database_TSM extends Database {
if (isset($benchmark)) if (isset($benchmark))
Profiler::delete($benchmark); Profiler::delete($benchmark);
SystemMessage::TSM_Error(sprintf('%s (%s)',$this->execute_stdout,$this->execute_stderr),$sql); SystemMessage::TSM('error',sprintf('%s (%s)',$this->execute_stdout,$this->execute_stderr),$sql);
Request::current()->redirect('welcome');
} }
if (isset($benchmark)) if (isset($benchmark))
@ -106,9 +107,6 @@ abstract class Database_TSM extends Database {
} }
public function escape($value) { public function escape($value) {
// Make sure the database is connected
$this->_connection or $this->connect();
// SQL standard is to use single-quotes for all values // SQL standard is to use single-quotes for all values
return "'$value'"; return "'$value'";
} }

View File

@ -35,7 +35,7 @@ class Database_TSM_DB2 extends Database_TSM {
unset($this->_config['connection']['username'], $this->_config['connection']['password']); unset($this->_config['connection']['username'], $this->_config['connection']['password']);
if (! $username OR ! $password) if (! $username OR ! $password)
Request::current()->redirect('/login?need_login=1'); HTTP::redirect('login');
try { try {
if ($persistent) { if ($persistent) {
@ -56,7 +56,7 @@ class Database_TSM_DB2 extends Database_TSM {
return TSM::instance()->set($username,$password,$result); return TSM::instance()->set($username,$password,$result);
} else } else
Request::current()->redirect(Request::detect_uri()); HTTP::redirect(Request::detect_uri());
} }
} catch (ErrorException $e) { } catch (ErrorException $e) {

View File

@ -12,9 +12,6 @@
*/ */
class Database_TSM_DSMADMC extends Database_TSM { class Database_TSM_DSMADMC extends Database_TSM {
public function connect() { public function connect() {
if ($this->_connection)
return;
// Extract the connection parameters, adding required variabels // Extract the connection parameters, adding required variabels
extract($this->_config['connection'] + array( extract($this->_config['connection'] + array(
'database' => '', 'database' => '',
@ -26,23 +23,21 @@ class Database_TSM_DSMADMC extends Database_TSM {
// Get user login details from user session - these are set by login // Get user login details from user session - these are set by login
if (! $username) if (! $username)
$username = Session::instance()->get_once(Kohana::config('auth.session_key')); $username = Session::instance()->get_once(Kohana::$config->load('auth')->session_key);
if (! $password) if (! $password)
$password = Session::instance()->get_once('password'); $password = Session::instance()->get_once('password');
// Prevent this information from showing up in traces // Prevent this information from showing up in traces
unset($this->_config['connection']['username'], $this->_config['connection']['password']); unset($this->_config['connection']['username'], $this->_config['connection']['password']);
if (! file_exists(Kohana::config('config.client'))) { if (! file_exists(Kohana::$config->load('config')->client)) {
system_message(array('title'=>'Cant find DSMADMC', SystemMessage::TSM('error',sprintf('Unable to find the dsmadmc at <b>%s</b>',Kohana::$config->load('config')->client),'');
'body'=>sprintf('Unable to find the dsmadmc at <b>%s</b>',Kohana::config('client.config')),
'type'=>'error'));
return FALSE; return FALSE;
} }
if (! $username OR ! $password) if (! $username OR ! $password)
Request::current()->redirect('/login?need_login=1'); HTTP::redirect('login');
try { try {
if ($persistent) { if ($persistent) {
@ -52,20 +47,31 @@ class Database_TSM_DSMADMC extends Database_TSM {
} else { } else {
// Create a connection and force it to be a new link // Create a connection and force it to be a new link
$this->_connection = sprintf('%s %s -id=%s -password=%s -displ=list -editor=no -dataonly=YES %s %s ', $this->_connection = sprintf('%s %s -id=%s -password=%s -displ=list -editor=no -dataonly=YES %s %s ',
Kohana::config('config.client'), Kohana::$config->load('config')->client,
$database ? '-server='.$database : '', $database ? '-server='.$database : '',
$username, $username,
$password, $password,
Kohana::config('config.client_errorlogname') ? sprintf('-errorlogname=%s',Kohana::config('config.client_errorlogname')) : '', Kohana::$config->load('config')->client_errorlogname ? sprintf('-errorlogname=%s',Kohana::$config->load('config')->client_errorlogname) : '',
$database ? sprintf('-se=%s',$database) : '' $database ? sprintf('-se=%s',$database) : ''
); );
$result = $this->query(Database::SELECT,'SELECT server_name,platform,version,release,level,sublevel FROM status'); $result = $this->query(Database::SELECT,'SELECT server_name,platform,version,release,level,sublevel FROM status');
if ($result) if ($result->count()) {
return TSM::instance()->set($username,$password,$result); return TSM::instance()->set($username,$password,$result);
else
Request::current()->redirect(Request::detect_uri()); } else {
$this->_connection = FALSE;
// @todo Get ANS8034E (ID not recognised), or ??????E (invalid password)
SystemMessage::add(array(
'title'=>_('Login Failed'),
'type'=>'error',
'body'=>_('Invalid Username and/or Password.')
));
return FALSE;
}
} }
} catch (ErrorException $e) { } catch (ErrorException $e) {
@ -77,14 +83,6 @@ class Database_TSM_DSMADMC extends Database_TSM {
), ),
$e->getCode()); $e->getCode());
} }
// \xFF is a better delimiter, but the PHP driver uses underscore
$this->_connection_id = sha1($hostname.'_'.$username.'_'.$password);
if ( ! empty($this->_config['charset'])) {
// Set the character set
$this->set_charset($this->_config['charset']);
}
} }
protected function execute($sql) { protected function execute($sql) {
@ -95,6 +93,8 @@ class Database_TSM_DSMADMC extends Database_TSM {
$sql = str_replace('\\','\\\\',$sql); $sql = str_replace('\\','\\\\',$sql);
$this->execute_stderr = exec($this->_connection.'"'.$sql.'"',$this->execute_stdout,$this->execute_rc); $this->execute_stderr = exec($this->_connection.'"'.$sql.'"',$this->execute_stdout,$this->execute_rc);
if (Kohana::$config->load('config.site.mode') == Kohana::DEVELOPMENT)
SystemMessage::TSM('info',sprintf('%s (%s) [%s]',$this->_connection.'"'.$sql.'"',join("\n",$this->execute_stdout),$this->execute_rc),$sql);
// Work out our message codes // Work out our message codes
$result = array(); $result = array();
@ -180,7 +180,7 @@ class Database_TSM_DSMADMC extends Database_TSM {
$columns[$row['COLNAME']] = $column; $columns[$row['COLNAME']] = $column;
} }
return $columns; return $columns ? $columns : array('');
} }
} }
?> ?>

View File

@ -11,10 +11,10 @@
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
class HTTP_Exception_404 extends Kohana_HTTP_Exception_404 { class HTTP_Exception_404 extends Kohana_HTTP_Exception_404 {
public function __construct($message, array $variables = NULL, $code = 0) public function __construct($message = NULL, array $variables = NULL, Exception $previous = NULL)
{ {
set_exception_handler(array(get_class($this),'handler')); set_exception_handler(array(get_class($this),'handler'));
parent::__construct($message, $variables, (int) $code); parent::__construct($message, $variables, $previous);
} }
public static function handler(Exception $e) public static function handler(Exception $e)
@ -25,6 +25,7 @@ class HTTP_Exception_404 extends Kohana_HTTP_Exception_404 {
'body'=>sprintf(_('The page [%s] you requested was not found?'),Request::detect_uri()), 'body'=>sprintf(_('The page [%s] you requested was not found?'),Request::detect_uri()),
)); ));
Request::factory()->redirect('welcome'); HTTP::redirect('welcome');
} }
} }
?>

View File

@ -0,0 +1,64 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides access to rendering media items (javascript, images and css).
*
* @package lnApp
* @subpackage Page/Media
* @category Controllers
* @author Deon George
* @copyright (c) 2010 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

@ -10,7 +10,7 @@
* @copyright (c) 2010 Deon George * @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
abstract class Controller_lnApp_Default extends Controller { abstract class lnApp_Controller_Default extends Controller {
/** /**
* The variable that our output is stored in * The variable that our output is stored in
*/ */
@ -52,7 +52,7 @@ abstract class Controller_lnApp_Default extends Controller {
*/ */
protected function _auth_required() { protected function _auth_required() {
// If our global configurable is disabled, then continue // If our global configurable is disabled, then continue
if (! Kohana::Config('config.method_security')) if (! Kohana::$config->load('config')->method_security)
return FALSE; return FALSE;
return (($this->auth_required !== FALSE && Auth::instance()->logged_in() === FALSE) || return (($this->auth_required !== FALSE && Auth::instance()->logged_in() === FALSE) ||
@ -71,11 +71,11 @@ abstract class Controller_lnApp_Default extends Controller {
// For no AJAX/JSON requests, display an access page // For no AJAX/JSON requests, display an access page
} elseif (Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__)) { } elseif (Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__)) {
Request::current()->redirect('login/noaccess'); HTTP::redirect('login/noaccess');
} else { } else {
Session::instance()->set('afterlogin',Request::detect_uri()); Session::instance()->set('afterlogin',Request::detect_uri());
Request::current()->redirect($this->noauth_redirect); HTTP::redirect($this->noauth_redirect);
} }
} }
} }
@ -84,7 +84,7 @@ abstract class Controller_lnApp_Default extends Controller {
parent::after(); parent::after();
// Generate and check the ETag for this file // Generate and check the ETag for this file
$this->response->check_cache(NULL,$this->request); $this->check_cache(sha1($this->response->body()));
} }
} }
?> ?>

View File

@ -0,0 +1,70 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides login capability
*
* @package lnApp
* @subpackage Page/Login
* @category Controllers
* @author Deon George
* @copyright (c) 2010 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('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('welcome/index');
} else {
SystemMessage::add(array(
'title'=>_('Invalid username or password'),
'type'=>'error',
'body'=>_('The username or password was invalid.')
));
}
}
Block::add(array(
'title'=>_('Login to server'),
'body'=>View::factory('login'),
'style'=>array('css/login.css'=>'screen'),
));
Script::add(array('type'=>'stdin','data'=>'
$(document).ready(function() {
$("#ajxbody").click(function() {$("#ajBODY").load("'.$this->request->uri().'/"); return false;});
});'
));
}
public function action_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

@ -11,16 +11,16 @@
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
* @also [login] * @also [login]
*/ */
class Controller_lnApp_Logout extends Controller { class lnApp_Controller_Logout extends Controller {
public function action_index() { public function action_index() {
# If user already signed-in # If user already signed-in
if (Auth::instance()->logged_in()!= 0) { if (Auth::instance()->logged_in()!= 0) {
Auth::instance()->logout(); Auth::instance()->logout();
Request::current()->redirect('login'); HTTP::redirect('login');
} }
Request::current()->redirect('welcome/index'); HTTP::redirect('welcome/index');
} }
} }
?> ?>

View File

@ -10,7 +10,7 @@
* @copyright (c) 2010 Deon George * @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
abstract class Controller_lnApp_TemplateDefault extends Controller_Template { abstract class lnApp_Controller_TemplateDefault extends Controller_Template {
/** /**
* @var string page template * @var string page template
*/ */
@ -42,6 +42,14 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template {
'menu' => TRUE, 'menu' => TRUE,
); );
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 * Check and see if this controller needs authentication
* *
@ -54,7 +62,7 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template {
*/ */
protected function _auth_required() { protected function _auth_required() {
// If our global configurable is disabled, then continue // If our global configurable is disabled, then continue
if (! Kohana::Config('config.method_security')) if (! Kohana::$config->load('config')->method_security)
return FALSE; return FALSE;
return (($this->auth_required !== FALSE && Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__) === FALSE) || return (($this->auth_required !== FALSE && Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__) === FALSE) ||
@ -75,13 +83,14 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template {
return; 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(); parent::before();
// Check user auth and role // Check user auth and role
if ($this->_auth_required()) { 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. // If auth is required and the user is logged in, then they dont have access.
// (We have already checked authorisation.) // (We have already checked authorisation.)
if (Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__)) { if (Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__)) {
@ -89,7 +98,7 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template {
SystemMessage::add(array( SystemMessage::add(array(
'title'=>_('Insufficient Access'), 'title'=>_('Insufficient Access'),
'type'=>'debug', 'type'=>'debug',
'body'=>Kohana::debug(array('required'=>$this->auth_required,'action'=>$this->request->action(),'user'=>Auth::instance()->get_user()->username)), '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? // @todo Login No Access redirects are not handled in JS?
@ -97,11 +106,11 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template {
echo _('You dont have enough permissions.'); echo _('You dont have enough permissions.');
die(); die();
} else } else
Request::current()->redirect('login/noaccess'); HTTP::redirect('login/noaccess');
} else { } else {
Session::instance()->set('afterlogin',Request::detect_uri()); Session::instance()->set('afterlogin',Request::detect_uri());
Request::current()->redirect($this->noauth_redirect); HTTP::redirect($this->noauth_redirect);
} }
} }
@ -121,13 +130,12 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template {
'data'=>'css/default.css', 'data'=>'css/default.css',
)); ));
// Our default scripts // Our default script(s)
// This is in a reverse list, since we push them to the beginging of the scripts to render. foreach (array('file'=>array_reverse(array(
foreach (array('file'=>array( 'js/jquery-1.6.4.min.js',
'js/jquery.jstree-1.0rc3.js',
'js/jquery.cookie.js', 'js/jquery.cookie.js',
'js/jquery.jstree-1.0rc.js', ))) as $type => $datas) {
'js/jquery-1.4.2.js',
)) as $type => $datas) {
foreach ($datas as $data) { foreach ($datas as $data) {
Script::add(array( Script::add(array(
@ -185,17 +193,25 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template {
if ($s = $this->_sysmsg() AND (string)$s) if ($s = $this->_sysmsg() AND (string)$s)
$this->response->body(sprintf('<table class="sysmsg"><tr><td>%s</td></tr></table>',$s)); $this->response->body(sprintf('<table class="sysmsg"><tr><td>%s</td></tr></table>',$s));
# In case there any style sheets or scrpits for this render. // In case there any style sheets for this render.
$this->response->bodyadd(Style::factory()); $this->response->bodyadd(Style::factory());
# Get the response body // 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)); $this->response->bodyadd(sprintf('<table class="content"><tr><td>%s</td></tr></table>',$this->template->content));
} }
parent::after(); parent::after();
// Generate and check the ETag for this file // Generate and check the ETag for this file
$this->response->check_cache(NULL,$this->request); if (Kohana::$environment === Kohana::PRODUCTION OR Kohana::$config->load('debug')->etag)
$this->check_cache(sha1($this->response->body()));
} }
/** /**
@ -237,48 +253,5 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template {
public function _footer() { public function _footer() {
return sprintf('&copy; %s',Config::SiteName()); return sprintf('&copy; %s',Config::SiteName());
} }
/**
* This action will render all the media related files for a page
* @return void
*/
final public function action_media() {
// 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 site_id
} elseif ($f = Kohana::find_file(sprintf('media/%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
$this->response->check_cache(NULL,$this->request);
// Set the proper headers to allow caching
$this->response->headers('Content-Type',File::mime_by_ext($ext));
$this->response->headers('Content-Length',(string)$this->response->content_length());
$this->response->headers('Last-Modified',date('r', $f ? filemtime($f) : time()));
}
} }
?> ?>

View File

@ -10,17 +10,17 @@
* @copyright (c) 2010 Open Source Billing * @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class Controller_lnApp_Tree extends Controller_Default { class lnApp_Controller_Tree extends Controller_Default {
/** /**
* @var string page media route as per [Route] * @var string page media route as per [Route]
*/ */
protected static $jsmediaroute = 'default/media'; protected static $jsmediaroute = 'default/media';
public function after() { public function after() {
parent::after();
$this->response->headers('Content-Type','application/json'); $this->response->headers('Content-Type','application/json');
$this->response->body(sprintf('[%s]',json_encode($this->output))); $this->response->body(json_encode($this->output));
parent::after();
} }
public static function js() { public static function js() {
@ -29,11 +29,13 @@ class Controller_lnApp_Tree extends Controller_Default {
return ' return '
<div id="tree" class=""></div> <div id="tree" class=""></div>
<script type="text/javascript"> <script type="text/javascript">
<!--
$(function () { $(function () {
var use_ajax = false;
$("#tree").jstree({ $("#tree").jstree({
themes : { themes : {
"theme" : "default", "theme" : "classic",
"url" : "'.URL::site($mediapath->uri(array('file'=>'css/jquery.jstree.css'))).'",
}, },
ui : { ui : {
"select_limit" : 1, "select_limit" : 1,
@ -41,12 +43,13 @@ $(function () {
}, },
cookies : { cookies : {
"save_selected" : false, "save_selected" : false,
"cookie_options" : { path : "'.URL::site().'" }
}, },
json_data : { json_data : {
"correct_state" : "true", "correct_state" : "true",
"progressive_render" : "true", "progressive_render" : "true",
"ajax" : { "ajax" : {
"url" : "'.URL::site('/tree/json').'", "url" : "'.URL::site('tree/json').'",
"data" : function (n) { "data" : function (n) {
return { id : n.attr ? n.attr("id") : "N_"+0 }; return { id : n.attr ? n.attr("id") : "N_"+0 };
} }
@ -60,18 +63,25 @@ $(function () {
if (a = data.rslt.obj.attr(\'id\').indexOf(\'_\')) { if (a = data.rslt.obj.attr(\'id\').indexOf(\'_\')) {
id = data.rslt.obj.attr(\'id\').substr(a+1); id = data.rslt.obj.attr(\'id\').substr(a+1);
if (href = $("#N_"+id).attr("href")) 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) { $("#ajBODY").load(href, function(r,s,x) {
if (s == "error") { if (s == "error") {
var msg = "Sorry but there was an error: "; var msg = "Sorry but there was an error: ";
$("#ajBODY").html(msg + x.status + " " + x.statusText + r); $("#ajBODY").html(msg + x.status + " " + x.statusText + r);
} }
}); });
else } else
alert("Unknown: "+id+" HREF:"+href); alert("Unknown: "+id+" HREF:"+href);
} }
}); });
}); });
// -->
</script>'; </script>';
} }
@ -81,12 +91,12 @@ $(function () {
* The incoming ID is either a Branch B_x or a Node N_x * The incoming ID is either a Branch B_x or a Node N_x
* Where X is actually the module. * Where X is actually the module.
* *
* @param id * @param array $data Tree data passed in by inherited methods
*/ */
public function action_json($id=null,array $data=array()) { public function action_json(array $data=array()) {
if ($this->_auth_required() AND ! Auth::instance()->logged_in()) { if ($this->_auth_required() AND ! Auth::instance()->logged_in()) {
$this->output = array('attr'=>array('id'=>'a_login'), $this->output = array('attr'=>array('id'=>'a_login'),
'data'=>array('title'=>_('Please Login').'...','attr'=>array('id'=>'N_login','href'=>URL::site('/login')))); 'data'=>array('title'=>_('Please Login').'...','attr'=>array('id'=>'N_login','href'=>URL::site('login'))));
return; return;
} }
@ -98,7 +108,7 @@ $(function () {
'attr'=>array('id'=>sprintf('B_%s',$branch['id'])), 'attr'=>array('id'=>sprintf('B_%s',$branch['id'])),
'state'=>$branch['state'], 'state'=>$branch['state'],
'data'=>array('title'=>$branch['name']), 'data'=>array('title'=>$branch['name']),
'attr'=>array('id'=>sprintf('N_%s',$branch['id']),'href'=>empty($branch['attr_href']) ? URL::site(sprintf('/%s/menu',$branch['name'])) : $branch['attr_href']), 'attr'=>array('id'=>sprintf('N_%s',$branch['id']),'href'=>empty($branch['attr_href']) ? URL::site(sprintf('%s/menu',$branch['name'])) : $branch['attr_href']),
) )
); );
} }

View File

@ -13,7 +13,7 @@
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
* @uses Style * @uses Style
*/ */
class lnApp_Block extends HTMLRender { abstract class lnApp_Block extends HTMLRender {
protected static $_data = array(); protected static $_data = array();
protected static $_spacer = '<table><tr class="spacer"><td>&nbsp;</td></tr></table>'; protected static $_spacer = '<table><tr class="spacer"><td>&nbsp;</td></tr></table>';
protected static $_required_keys = array('body'); protected static $_required_keys = array('body');
@ -24,6 +24,10 @@ class lnApp_Block extends HTMLRender {
* @param array Block attributes * @param array Block attributes
*/ */
public static function add($block,$prepend=FALSE) { 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); parent::add($block);
// Detect any style sheets. // Detect any style sheets.

View File

@ -10,7 +10,7 @@
* @copyright (c) 2010 Deon George * @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
class lnApp_Breadcrumb extends HTMLRender { abstract class lnApp_Breadcrumb extends HTMLRender {
protected static $_data = array(); protected static $_data = array();
protected static $_spacer = ' &raquo; '; protected static $_spacer = ' &raquo; ';
protected static $_required_keys = array('body'); protected static $_required_keys = array('body');
@ -23,17 +23,32 @@ class lnApp_Breadcrumb extends HTMLRender {
public static function set($path) { public static function set($path) {
if (is_string($path)) if (is_string($path))
static::$_data['path'] = explode('/',$path); static::$_data['path'] = explode('/',$path);
else elseif (is_array($path))
static::$_data['path'] = $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 * Enable a friendly name to be used for a path
*/ */
public static function name($path,$name) { public static function name($path,$name,$override=TRUE) {
if (isset(static::$_data['name'][$path]) AND ! $override)
return;
static::$_data['name'][$path] = $name; static::$_data['name'][$path] = $name;
} }
/**
* Enable specifying the URL for a path
*/
public static function URL($path,$url,$override=TRUE) {
if (isset(static::$_data['url'][$path]) AND ! $override)
return;
static::$_data['url'][$path] = $url;
}
/** /**
* Return an instance of this class * Return an instance of this class
* *
@ -47,17 +62,26 @@ class lnApp_Breadcrumb extends HTMLRender {
* Render this Breadcrumb * Render this Breadcrumb
*/ */
protected function render() { protected function render() {
$output = HTML::anchor('/',_('Home')); $output = '<ul id="breadcrumb">';
$output .= '<li>'.HTML::anchor('/',_('Home')).'</li>';
$data = empty(static::$_data['path']) ? explode('/',preg_replace('/^\//','',Request::detect_uri())) : static::$_data['path']; $data = empty(static::$_data['path']) ? explode('/',preg_replace('/^\//','',Request::detect_uri())) : static::$_data['path'];
$c = count($data);
$i=0;
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
$output .= static::$_spacer; $i++;
$p = join('/',array_slice($data,0,$k+1)); $p = join('/',array_slice($data,0,$k+1));
$output .= HTML::anchor($p,empty(static::$_data['name'][$p]) ? ucfirst($v) : static::$_data['name'][$p]); $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; return $output;
} }
} }

View File

@ -12,76 +12,107 @@
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
abstract class lnApp_Config extends Kohana_Config { abstract class lnApp_Config extends Kohana_Config {
protected static $logo = 'img/logo-small.png';
/**
* Some early initialisation
*
* At this point, KH hasnt been fully initialised either, so we cant rely on
* too many KH functions yet.
* NOTE: Kohana doesnt provide a parent construct for the Kohana_Config class.
*/
public function __construct() {
if (defined('PHPUNITTEST'))
$_SERVER['SERVER_NAME'] = PHPUNITTEST;
}
/** /**
* Return our site name * Return our site name
*/ */
public static function site() { public static function site() {
if (! empty($_SERVER['SERVER_NAME'])) return $_SERVER['SERVER_NAME'];
return $_SERVER['SERVER_NAME'];
if (! $site = CLI::options('site'))
throw new Kohana_Exception(_('Cant figure out the site, use --site= for CLI'));
return $site['site'];
} }
/** /**
* Work out our site ID for multiehosting * Work out our site ID for multiehosting
* @todo Change this to query the DB for site number.
*/ */
public static function siteid() { public static function siteid() {
$sites = Kohana::config('config.site'); return Kohana::$config->load('config.site.id');
// If we havent been configured for sites
if (is_null($sites) OR ! is_array($sites) OR ! isset($sites[static::site()]))
return 0;
else
return $sites[static::site()];
} }
/** /**
* Work out our site mode (dev,test,prod) * Work out our site mode (dev,test,prod)
* @todo Change this to query the DB for mode.
*/ */
public static function sitemode() { public static function sitemode() {
$sites = Kohana::config('config.site_mode'); return Kohana::$config->load('config.site.mode');
}
// If we havent been configured for sites public static function sitemodeverbose() {
if (is_null($sites) OR ! is_array($sites) OR ! isset($sites[static::site()])) $modes = array(
return Kohana::PRODUCTION; Kohana::PRODUCTION=>'Production',
else Kohana::STAGING=>'Staging',
return $sites[static::site()]; Kohana::TESTING=>'Testing',
Kohana::DEVELOPMENT=>'Development',
);
return (! isset($modes[static::sitemode()])) ? 'Unknown' : $modes[static::sitemode()];
}
public static function submode() {
$submode = Kohana::$config->load('config.debug.submode');
return (isset($submode[Request::$client_ip])) ? $submode[Request::$client_ip] : FALSE;
} }
public static function sitename() { public static function sitename() {
return Kohana::config('config.site_name'); return Kohana::$config->load('config')->site_name;
} }
// Called in Invoice/Emailing to embed the file.
public static function logo_file() { public static function logo_file() {
// @todo Move the logo filename to a config file list ($path,$suffix) = explode('.',static::$logo);
return Kohana::find_file(sprintf('media/%s',Config::siteid()),'img/logo-small','png'); return ($a=Kohana::find_file(sprintf('media/site/%s',Config::siteid()),$path,$suffix)) ? $a : Kohana::find_file('media',$path,$suffix);
}
public static function logo_uri() {
list ($path,$suffix) = explode('.',static::$logo);
return URL::site(Route::get('default/media')->uri(array('file'=>$path.'.'.$suffix),array('alt'=>static::sitename())),'http');
} }
public static function logo() { public static function logo() {
// @todo Move the logo filename to a config file return HTML::image(static::logo_uri(),array('class'=>'headlogo','alt'=>_('Logo')));
$mediapath = Route::get('default/media'); }
$logo = $mediapath->uri(array('file'=>'img/logo-small.png'),array('alt'=>static::sitename()));
return HTML::image($logo,array('class'=>'headlogo','alt'=>_('Logo'))); public static function login_uri() {
return ($ao = Auth::instance()->get_user() AND is_object($ao)) ? HTML::anchor('user/account/edit',$ao->name()) : HTML::anchor('login',_('Login'));
} }
/** /**
* Return our caching mechanism * Return our caching mechanism
*/ */
public static function cachetype() { public static function cachetype() {
return is_null(Kohana::config('config.cache_type')) ? 'file' : Kohana::config('config.cache_type'); return is_null(Kohana::$config->load('config')->cache_type) ? 'file' : Kohana::$config->load('config')->cache_type;
} }
/** /**
* Show a date using a site configured format * Show a date using a site configured format
*/ */
public static function date($date) { public static function date($date) {
return date(Kohana::config('config.date_format'),$date); return $date ? date(Kohana::$config->load('config')->date_format,$date) : '&gt;Not Set&lt;';
}
/**
* Show a date using a site configured format
*/
public static function time($date) {
return date(Kohana::$config->load('config')->time_format,$date);
}
/**
* Show a date using a site configured format
*/
public static function datetime($date) {
return sprintf('%s %s',static::date($date),static::time($date));
} }
/** /**
@ -91,12 +122,16 @@ abstract class lnApp_Config extends Kohana_Config {
* @return mixed|array - Email to send test emails to * @return mixed|array - Email to send test emails to
*/ */
public static function testmail($template) { public static function testmail($template) {
$config = Kohana::config('config.email_admin_only'); $config = Kohana::$config->load('config')->email_admin_only;
if (is_null($config) OR ! is_array($config) OR empty($config[$template])) if (is_null($config) OR ! is_array($config) OR empty($config[$template]))
return FALSE; return FALSE;
else else
return $config[$template]; return $config[$template];
} }
public static function theme() {
return Kohana::$config->load('config')->theme;
}
} }
?> ?>

View File

@ -10,10 +10,10 @@
* @copyright (c) 2010 Deon George * @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
class lnApp_HeadImages extends HTMLRender { abstract class lnApp_HeadImages extends HTMLRender {
protected static $_data = array(); protected static $_data = array();
protected static $_spacer = '&nbsp;'; protected static $_spacer = '&nbsp;';
protected static $_required_keys = array('url','img'); protected static $_required_keys = array('img');
/** /**
* Return an instance of this class * Return an instance of this class
@ -35,7 +35,10 @@ class lnApp_HeadImages extends HTMLRender {
foreach (static::$_data as $value) { foreach (static::$_data as $value) {
$i = HTML::image($mediapath->uri(array('file'=>$value['img'])),array('alt'=>isset($value['attrs']['title']) ? $value['attrs']['title'] : '')); $i = HTML::image($mediapath->uri(array('file'=>$value['img'])),array('alt'=>isset($value['attrs']['title']) ? $value['attrs']['title'] : ''));
$output .= HTML::anchor($value['url'],$i,(isset($value['attrs']) && is_array($value['attrs'])) ? $value['attrs'] : null); 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; $output .= static::$_spacer;
} }

View File

@ -10,7 +10,7 @@
* @copyright (c) 2010 Deon George * @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
class lnApp_HTML extends Kohana_HTML { abstract class lnApp_HTML extends Kohana_HTML {
public static function nbsp($string) { public static function nbsp($string) {
if (strlen((string)$string)) if (strlen((string)$string))
return $string; return $string;

View File

@ -77,9 +77,7 @@ abstract class lnApp_HTMLRender {
// Display the exception message // Display the exception message
catch (Exception $e) { catch (Exception $e) {
Kohana::exception_handler($e); Kohana_Exception::handler($e);
return '';
} }
} }

View File

@ -10,7 +10,7 @@
* @copyright (c) 2010 Deon George * @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
class lnApp_Meta { abstract class lnApp_Meta {
private $_data = array(); private $_data = array();
private $_array_keys = array(); private $_array_keys = array();
@ -19,7 +19,7 @@ class lnApp_Meta {
return array(); return array();
if (empty($this->_data[$key])) if (empty($this->_data[$key]))
return null; return NULL;
else else
return $this->_data[$key]; return $this->_data[$key];
} }

View File

@ -10,11 +10,12 @@
* @copyright (c) 2010 Deon George * @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
class lnApp_Script extends HTMLRender { abstract class lnApp_Script extends HTMLRender {
protected static $_data = array(); protected static $_data = array();
protected static $_spacer = "\n"; protected static $_spacer = "\n";
protected static $_required_keys = array('type','data'); protected static $_required_keys = array('type','data');
protected static $_unique_vals = array('file'=>'type'); protected static $_unique_vals = array('file'=>'type');
protected static $_rendered = FALSE;
/** /**
* Return an instance of this class * Return an instance of this class
@ -34,26 +35,28 @@ class lnApp_Script extends HTMLRender {
$foutput = $soutput = ''; $foutput = $soutput = '';
$mediapath = Route::get(static::$_media_path); $mediapath = Route::get(static::$_media_path);
$i = $j = 0;
foreach (static::$_data as $value) { foreach (static::$_data as $value) {
switch ($value['type']) { switch ($value['type']) {
case 'file': case 'file':
$foutput .= HTML::script($mediapath->uri(array('file'=>$value['data']))); $foutput .= HTML::script($mediapath->uri(array('file'=>$value['data'])));
if ($i++)
$foutput .= static::$_spacer;
break; break;
case 'stdin': case 'stdin':
$soutput .= sprintf("<script type=\"text/javascript\">//<![CDATA[\n%s\n//]]></script>",$value['data']); $soutput .= sprintf("<script type=\"text/javascript\">//<![CDATA[\n%s\n//]]></script>",$value['data']);
if ($j++)
$soutput .= static::$_spacer;
break; break;
default: default:
throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type'])); throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type']));
} }
} }
static::$_rendered = TRUE;
return $foutput.static::$_spacer.$soutput; 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

@ -11,7 +11,7 @@
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
* @uses Style * @uses Style
*/ */
class lnApp_Sort { abstract class lnApp_Sort {
/** /**
* Sort a multi dimensional array. * Sort a multi dimensional array.
* *
@ -20,86 +20,71 @@ class lnApp_Sort {
* @param boolean Whether to reverse sort. * @param boolean Whether to reverse sort.
* @return array Sorted multi demension array. * @return array Sorted multi demension array.
*/ */
public static function masort(&$data,$sortby,$rev=0) { public static function MAsort(&$data,$sortby,$rev=0) {
// if the array to sort is null or empty // if the array to sort is null or empty, or our sortby is bad
if (! $data) if (! preg_match('/^([a-zA-Z0-9_]+(\([a-zA-Z0-9_,]*\)(->[a-zA-Z0-9])?)?,?)+$/',$sortby) || ! $data)
return; return;
static $MASORT_CACHE = array(); $code = '$c=0;';
if (empty($MASORT_CACHE[$sortby])) { foreach (explode(',',$sortby) as $key) {
$code = "\$c=0;\n"; $code .= 'if (is_object($a) || is_object($b)) {';
foreach (array('a','b') as $x) {
foreach (explode(',',$sortby) as $key) { $code .= 'if (is_array($'.$x.'->'.$key.')) {';
$code .= "if (is_object(\$a) || is_object(\$b)) {\n"; $code .= 'asort($'.$x.'->'.$key.');';
$code .= '$x'.$x.' = array_shift($'.$x.'->'.$key.');';
$code .= " if (is_array(\$a->$key)) {\n"; $code .= '} else';
$code .= " asort(\$a->$key);\n"; $code .= '$x'.$x.' = $'.$x.'->'.$key.';';
$code .= " \$aa = array_shift(\$a->$key);\n";
$code .= " } else\n";
$code .= " \$aa = \$a->$key;\n";
$code .= " if (is_array(\$b->$key)) {\n";
$code .= " asort(\$b->$key);\n";
$code .= " \$bb = array_shift(\$b->$key);\n";
$code .= " } else\n";
$code .= " \$bb = \$b->$key;\n";
$code .= " if (\$aa != \$bb)";
if ($rev)
$code .= " return (\$aa < \$bb ? 1 : -1);\n";
else
$code .= " return (\$aa > \$bb ? 1 : -1);\n";
$code .= "} else {\n";
$code .= " \$a = array_change_key_case(\$a);\n";
$code .= " \$b = array_change_key_case(\$b);\n";
$key = strtolower($key);
$code .= " if ((! isset(\$a['$key'])) && isset(\$b['$key'])) return 1;\n";
$code .= " if (isset(\$a['$key']) && (! isset(\$b['$key']))) return -1;\n";
$code .= " if ((isset(\$a['$key'])) && (isset(\$b['$key']))) {\n";
$code .= " if (is_array(\$a['$key'])) {\n";
$code .= " asort(\$a['$key']);\n";
$code .= " \$aa = array_shift(\$a['$key']);\n";
$code .= " } else\n";
$code .= " \$aa = \$a['$key'];\n";
$code .= " if (is_array(\$b['$key'])) {\n";
$code .= " asort(\$b['$key']);\n";
$code .= " \$bb = array_shift(\$b['$key']);\n";
$code .= " } else\n";
$code .= " \$bb = \$b['$key'];\n";
$code .= " if (\$aa != \$bb)\n";
$code .= " if (is_numeric(\$aa) && is_numeric(\$bb)) {\n";
if ($rev)
$code .= " return (\$aa < \$bb ? 1 : -1);\n";
else
$code .= " return (\$aa > \$bb ? 1 : -1);\n";
$code .= " } else {\n";
if ($rev)
$code .= " if ( (\$c = strcasecmp(\$bb,\$aa)) != 0 ) return \$c;\n";
else
$code .= " if ( (\$c = strcasecmp(\$aa,\$bb)) != 0 ) return \$c;\n";
$code .= " }\n";
$code .= " }\n";
$code .= "}\n";
} }
$code .= 'return $c;'; $code .= 'if ($xa != $xb)';
if ($rev)
$code .= 'return ($xa < $xb ? 1 : -1);';
else
$code .= 'return ($xa > $xb ? 1 : -1);';
$MASORT_CACHE[$sortby] = create_function('$a, $b',$code); $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 .= '}}}';
} }
uasort($data,$MASORT_CACHE[$sortby]); $code .= 'return $c;';
$result = create_function('$a, $b',$code);
uasort($data,$result);
} }
} }
?> ?>

View File

@ -10,10 +10,11 @@
* @copyright (c) 2010 Deon George * @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
class lnApp_Style extends HTMLRender { abstract class lnApp_Style extends HTMLRender {
protected static $_data = array(); protected static $_data = array();
protected static $_spacer = "\n"; protected static $_spacer = "\n";
protected static $_required_keys = array('type','data'); protected static $_required_keys = array('type','data');
protected static $_unique_vals = array('file'=>'type');
/** /**
* Return an instance of this class * Return an instance of this class
@ -30,25 +31,24 @@ class lnApp_Style extends HTMLRender {
* @see HTMLRender::render() * @see HTMLRender::render()
*/ */
protected function render() { protected function render() {
$output = ''; $foutput = $soutput = '';
$mediapath = Route::get(static::$_media_path); $mediapath = Route::get(static::$_media_path);
$i = 0;
foreach (static::$_data as $value) { foreach (static::$_data as $value) {
if ($i++)
$output .= static::$_spacer;
switch ($value['type']) { switch ($value['type']) {
case 'file': case 'file':
$output .= HTML::style($mediapath->uri(array('file'=>$value['data'])), $foutput .= HTML::style($mediapath->uri(array('file'=>$value['data'])),
array('media'=>(! empty($value['media'])) ? $value['media'] : 'screen'),TRUE); array('media'=>(! empty($value['media'])) ? $value['media'] : 'screen'),TRUE);
break; break;
case 'stdin':
$soutput .= sprintf("<style type=\"text/css\">%s</style>",$value['data']);
break;
default: default:
throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type'])); throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type']));
} }
} }
return $output; return $foutput.static::$_spacer.$soutput;
} }
} }
?> ?>

View File

@ -10,7 +10,7 @@
* @copyright (c) 2010 Deon George * @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
class lnApp_SystemMessage extends HTMLRender { abstract class lnApp_SystemMessage extends HTMLRender {
protected static $_data = array(); protected static $_data = array();
protected static $_spacer = '<table><tr class="spacer"><td>&nbsp;</td></tr></table>'; protected static $_spacer = '<table><tr class="spacer"><td>&nbsp;</td></tr></table>';
protected static $_required_keys = array('title','body','type'); protected static $_required_keys = array('title','body','type');
@ -69,7 +69,7 @@ class lnApp_SystemMessage extends HTMLRender {
/** /**
* Render an image for the System Message * Render an image for the System Message
*/ */
private static function image($type,$raw=false,$big=false,$alt='') { public static function image($type,$raw=false,$big=false,$alt='') {
$mediapath = Route::get(static::$_media_path); $mediapath = Route::get(static::$_media_path);
switch ($type) { switch ($type) {

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_ACTLOG extends ORMTSM { class Model_ACTLOG extends TSM_ORM {
protected $_table_name = 'ACTLOG'; protected $_table_name = 'ACTLOG';
protected $_primary_key = 'DATE_TIME'; // We need a primary key to detect that the object is loaded. protected $_primary_key = 'DATE_TIME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array( protected $_sorting = array(

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_ASSOCIATION extends ORMTSM { class Model_ASSOCIATION extends TSM_ORM {
protected $_table_name = 'ASSOCIATIONS'; protected $_table_name = 'ASSOCIATIONS';
protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded. protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array( protected $_sorting = array(

View File

@ -16,7 +16,7 @@ class Model_Auth_UserDefault extends Model_Auth_User {
protected function _initialize() { protected function _initialize() {
// Set out DB connection configuration. // Set out DB connection configuration.
$this->_db_group = Kohana::config('config.client_type'); $this->_db_group = Kohana::$config->load('config')->client_type;
parent::_initialize(); parent::_initialize();
} }

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_CLIENTOPT extends ORMTSM { class Model_CLIENTOPT extends TSM_ORM {
protected $_table_name = 'CLIENTOPTS'; protected $_table_name = 'CLIENTOPTS';
protected $_primary_key = 'OPTIONSET_NAME'; // We need a primary key to detect that the object is loaded. protected $_primary_key = 'OPTIONSET_NAME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array( protected $_sorting = array(

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_COPYGROUP_AR extends ORMTSM { class Model_COPYGROUP_AR extends TSM_ORM {
protected $_table_name = 'AR_COPYGROUPS'; protected $_table_name = 'AR_COPYGROUPS';
protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded. protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array( protected $_sorting = array(

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_COPYGROUP_BU extends ORMTSM { class Model_COPYGROUP_BU extends TSM_ORM {
protected $_table_name = 'BU_COPYGROUPS'; protected $_table_name = 'BU_COPYGROUPS';
protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded. protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array( protected $_sorting = array(

View File

@ -10,7 +10,7 @@
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
* @note This is model is using the plural name, as storage pools have an attribute with the singular name * @note This is model is using the plural name, as storage pools have an attribute with the singular name
*/ */
class Model_DEVCLASSES extends ORMTSM { class Model_DEVCLASSES extends TSM_ORM {
protected $_table_name = 'DEVCLASSES'; protected $_table_name = 'DEVCLASSES';
protected $_primary_key = 'DEVCLASS_NAME'; // We need a primary key to detect that the object is loaded. protected $_primary_key = 'DEVCLASS_NAME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array( protected $_sorting = array(

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_DOMAIN extends ORMTSM { class Model_DOMAIN extends TSM_ORM {
protected $_table_name = 'DOMAINS'; protected $_table_name = 'DOMAINS';
protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded. protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array( protected $_sorting = array(

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_DRIVE extends ORMTSM { class Model_DRIVE extends TSM_ORM {
protected $_table_name = 'DRIVES'; protected $_table_name = 'DRIVES';
protected $_primary_key = 'DRIVE_NAME'; protected $_primary_key = 'DRIVE_NAME';
protected $_sorting = array( protected $_sorting = array(

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_EVENT extends ORMTSM { class Model_EVENT extends TSM_ORM {
protected $_table_name = 'EVENTS'; protected $_table_name = 'EVENTS';
protected $_primary_key = 'NODE_NAME'; // We need a primary key to detect that the object is loaded. protected $_primary_key = 'NODE_NAME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array( protected $_sorting = array(
@ -19,13 +19,13 @@ class Model_EVENT extends ORMTSM {
protected $_display_filters = array( protected $_display_filters = array(
'SCHEDULED_START'=>array( 'SCHEDULED_START'=>array(
array('ORMTSM::date',array(':value','d-M H:i')), array('TSM_ORM::date',array(':value','d-M H:i')),
), ),
'ACTUAL_START'=>array( 'ACTUAL_START'=>array(
array('ORMTSM::date',array(':value','d-M H:i')), array('TSM_ORM::date',array(':value','d-M H:i')),
), ),
'COMPLETED'=>array( 'COMPLETED'=>array(
array('ORMTSM::date',array(':value','d-M H:i')), array('TSM_ORM::date',array(':value','d-M H:i')),
), ),
); );
} }

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_FILESPACE extends ORMTSM { class Model_FILESPACE extends TSM_ORM {
protected $_table_name = 'FILESPACES'; protected $_table_name = 'FILESPACES';
protected $_primary_key = 'FILESPACE_NAME'; // We need a primary key to detect that the object is loaded. protected $_primary_key = 'FILESPACE_NAME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array( protected $_sorting = array(
@ -44,7 +44,7 @@ class Model_FILESPACE extends ORMTSM {
protected $_display_filters = array( protected $_display_filters = array(
'BACKUP_END'=>array( 'BACKUP_END'=>array(
array('ORMTSM::date',array(':value','d-M-Y')), array('TSM_ORM::date',array(':value','d-M-Y')),
), ),
); );

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_LIBRARY extends ORMTSM { class Model_LIBRARY extends TSM_ORM {
protected $_table_name = 'LIBRARIES'; protected $_table_name = 'LIBRARIES';
protected $_primary_key = 'LIBRARY_NAME'; protected $_primary_key = 'LIBRARY_NAME';
protected $_sorting = array( protected $_sorting = array(
@ -110,7 +110,7 @@ class Model_LIBRARY extends ORMTSM {
if (! isset($CACHE[__METHOD__][$ptype])) if (! isset($CACHE[__METHOD__][$ptype]))
foreach ($this->storagepoolstype($ptype) as $spo) foreach ($this->storagepoolstype($ptype) as $spo)
foreach ($ainout as $cinout) foreach ($ainout as $cinout)
foreach (Kohana::config('config.tsmvolstatus') as $cstatus) { foreach (Kohana::$config->load('config')->tsmvolstatus as $cstatus) {
if (! isset($CACHE[__METHOD__][$spo->POOLTYPE][$cinout][$cstatus])) if (! isset($CACHE[__METHOD__][$spo->POOLTYPE][$cinout][$cstatus]))
$CACHE[__METHOD__][$spo->POOLTYPE][$cinout][$cstatus] = array(); $CACHE[__METHOD__][$spo->POOLTYPE][$cinout][$cstatus] = array();
@ -131,7 +131,7 @@ class Model_LIBRARY extends ORMTSM {
static $CACHE = array(); static $CACHE = array();
if (! isset($CACHE[__METHOD__])) if (! isset($CACHE[__METHOD__]))
foreach (ORM::factory('volhistory')->where('TYPE','IN',Kohana::config('config.tsmdbtypes'))->find_all() as $vho) foreach (ORM::factory('volhistory')->where('TYPE','IN',Kohana::$config->load('config')->tsmdbtypes)->find_all() as $vho)
$CACHE[__METHOD__][$vho->LIBVOLUME->LIBRARY_NAME ? 'IN' : 'OUT'][] = $vho; $CACHE[__METHOD__][$vho->LIBVOLUME->LIBRARY_NAME ? 'IN' : 'OUT'][] = $vho;
return isset($CACHE[__METHOD__][$inout]) ? $CACHE[__METHOD__][$inout] : array(); return isset($CACHE[__METHOD__][$inout]) ? $CACHE[__METHOD__][$inout] : array();

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_LIBVOLUME extends ORMTSM { class Model_LIBVOLUME extends TSM_ORM {
protected $_table_name = 'LIBVOLUMES'; protected $_table_name = 'LIBVOLUMES';
protected $_primary_key = 'HOME_ELEMENT'; protected $_primary_key = 'HOME_ELEMENT';
protected $_sorting = array( protected $_sorting = array(

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_MEDIA extends ORMTSM { class Model_MEDIA extends TSM_ORM {
protected $_table_name = 'MEDIA'; protected $_table_name = 'MEDIA';
protected $_primary_key = 'VOLUME_NAME'; protected $_primary_key = 'VOLUME_NAME';
protected $_sorting = array( protected $_sorting = array(

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_MGMTCLASS extends ORMTSM { class Model_MGMTCLASS extends TSM_ORM {
protected $_table_name = 'MGMTCLASSES'; protected $_table_name = 'MGMTCLASSES';
protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded. protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array( protected $_sorting = array(

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_NODE extends ORMTSM { class Model_NODE extends TSM_ORM {
protected $_table_name = 'NODES'; protected $_table_name = 'NODES';
protected $_primary_key = 'NODE_NAME'; protected $_primary_key = 'NODE_NAME';
protected $_sorting = array( protected $_sorting = array(
@ -86,13 +86,13 @@ class Model_NODE extends ORMTSM {
protected $_display_filters = array( protected $_display_filters = array(
'REG_TIME'=>array( 'REG_TIME'=>array(
array('ORMTSM::date',array(':value','d-M-Y')), array('TSM_ORM::date',array(':value','d-M-Y')),
), ),
'PWSET_TIME'=>array( 'PWSET_TIME'=>array(
array('ORMTSM::date',array(':value','d-M-Y')), array('TSM_ORM::date',array(':value','d-M-Y')),
), ),
'LASTACC_TIME'=>array( 'LASTACC_TIME'=>array(
array('ORMTSM::date',array(':value','d-M-Y')), array('TSM_ORM::date',array(':value','d-M-Y')),
), ),
'LASTSESS_SENT'=>array( 'LASTSESS_SENT'=>array(
array('number_format',array(':value',0)), array('number_format',array(':value',0)),
@ -207,7 +207,7 @@ class Model_NODE extends ORMTSM {
public function getAllStoragePoolsType($ptype) { public function getAllStoragePoolsType($ptype) {
$result = array(); $result = array();
foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype) foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype)
$result = array_merge($result,$this->getStoragePoolsType($btype,$ptype)); $result = array_merge($result,$this->getStoragePoolsType($btype,$ptype));
return $result; return $result;
@ -240,7 +240,7 @@ class Model_NODE extends ORMTSM {
public function getStorageTypeVols($ptype,$spo='') { public function getStorageTypeVols($ptype,$spo='') {
$result = array(); $result = array();
foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype) foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype)
$result = array_merge($result,$this->getStorageModeVols($ctype,$ptype,$spo)); $result = array_merge($result,$this->getStorageModeVols($ctype,$ptype,$spo));
return $result; return $result;
@ -262,7 +262,7 @@ class Model_NODE extends ORMTSM {
public function getStorageTypeFiles($ptype,$spo='') { public function getStorageTypeFiles($ptype,$spo='') {
$count = 0; $count = 0;
foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype) foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype)
$count += $this->getStorageModeFiles($btype,$ptype,$spo); $count += $this->getStorageModeFiles($btype,$ptype,$spo);
return $count; return $count;
@ -284,7 +284,7 @@ class Model_NODE extends ORMTSM {
public function getStorageTypeData($ptype,$spo='') { public function getStorageTypeData($ptype,$spo='') {
$count = 0; $count = 0;
foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype) foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype)
$count += $this->getStorageModeData($btype,$ptype,$spo); $count += $this->getStorageModeData($btype,$ptype,$spo);
return $count; return $count;

View File

@ -10,7 +10,7 @@
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
* @node This has been renamed to OCC from OCCUPANCY, as DB2/FILESPACES has an OCCUPANCY column * @node This has been renamed to OCC from OCCUPANCY, as DB2/FILESPACES has an OCCUPANCY column
*/ */
class Model_OCC extends ORMTSM { class Model_OCC extends TSM_ORM {
protected $_table_name = 'OCCUPANCY'; protected $_table_name = 'OCCUPANCY';
protected $_primary_key = 'NODE_NAME'; // We need a primary key to detect that the object is loaded. protected $_primary_key = 'NODE_NAME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array( protected $_sorting = array(

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_PATH extends ORMTSM { class Model_PATH extends TSM_ORM {
protected $_table_name = 'PATHS'; protected $_table_name = 'PATHS';
protected $_primary_key = 'DEVICE'; protected $_primary_key = 'DEVICE';
protected $_sorting = array( protected $_sorting = array(

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_SCHEDULE_CLIENT extends ORMTSM { class Model_SCHEDULE_CLIENT extends TSM_ORM {
protected $_table_name = 'CLIENT_SCHEDULES'; protected $_table_name = 'CLIENT_SCHEDULES';
protected $_primary_key = 'SCHEDULE_NAME'; // We need a primary key to detect that the object is loaded. protected $_primary_key = 'SCHEDULE_NAME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array( protected $_sorting = array(
@ -22,7 +22,7 @@ class Model_SCHEDULE_CLIENT extends ORMTSM {
protected $_display_filters = array( protected $_display_filters = array(
'STARTTIME'=>array( 'STARTTIME'=>array(
array('ORMTSM::date',array(':value','h:m')), array('TSM_ORM::date',array(':value','h:m')),
), ),
); );

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_STGPOOL extends ORMTSM { class Model_STGPOOL extends TSM_ORM {
protected $_table_name = 'STGPOOLS'; protected $_table_name = 'STGPOOLS';
protected $_primary_key = 'STGPOOL_NAME'; protected $_primary_key = 'STGPOOL_NAME';
protected $_sorting = array( protected $_sorting = array(

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_SUMMARY extends ORMTSM { class Model_SUMMARY extends TSM_ORM {
protected $_table_name = 'SUMMARY'; protected $_table_name = 'SUMMARY';
protected $_primary_key = 'ACTIVITY'; // We need a primary key to detect that the object is loaded. protected $_primary_key = 'ACTIVITY'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array( protected $_sorting = array(
@ -20,10 +20,10 @@ class Model_SUMMARY extends ORMTSM {
protected $_display_filters = array( protected $_display_filters = array(
'START_TIME'=>array( 'START_TIME'=>array(
array('ORMTSM::date',array(':value','d-M H:i')), array('TSM_ORM::date',array(':value','d-M H:i')),
), ),
'END_TIME'=>array( 'END_TIME'=>array(
array('ORMTSM::date',array(':value','d-M H:i')), array('TSM_ORM::date',array(':value','d-M H:i')),
), ),
); );
} }

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_VOLHISTORY extends ORMTSM { class Model_VOLHISTORY extends TSM_ORM {
protected $_table_name = 'VOLHISTORY'; protected $_table_name = 'VOLHISTORY';
protected $_primary_key = 'VOLUME_NAME'; protected $_primary_key = 'VOLUME_NAME';
protected $_sorting = array( protected $_sorting = array(
@ -25,7 +25,7 @@ class Model_VOLHISTORY extends ORMTSM {
protected $_display_filters = array( protected $_display_filters = array(
'DATE_TIME'=>array( 'DATE_TIME'=>array(
array('ORMTSM::date',array(':value','d-M-Y')), array('TSM_ORM::date',array(':value','d-M-Y')),
), ),
); );

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_VOLUME extends ORMTSM { class Model_VOLUME extends TSM_ORM {
protected $_table_name = 'VOLUMES'; protected $_table_name = 'VOLUMES';
protected $_primary_key = 'VOLUME_NAME'; protected $_primary_key = 'VOLUME_NAME';
protected $_sorting = array( protected $_sorting = array(
@ -27,10 +27,10 @@ class Model_VOLUME extends ORMTSM {
protected $_display_filters = array( protected $_display_filters = array(
'LAST_READ_DATE'=>array( 'LAST_READ_DATE'=>array(
array('ORMTSM::date',array(':value','d-M-Y')), array('TSM_ORM::date',array(':value','d-M-Y')),
), ),
'LAST_WRITE_DATE'=>array( 'LAST_WRITE_DATE'=>array(
array('ORMTSM::date',array(':value','d-M-Y')), array('TSM_ORM::date',array(':value','d-M-Y')),
), ),
); );
@ -63,7 +63,7 @@ class Model_VOLUME extends ORMTSM {
} }
public function recycle() { public function recycle() {
return Kohana::config('config.tsmtapeage') < $this->age() ? TRUE : FALSE; return Kohana::$config->load('config')->tsmtapeage < $this->age() ? TRUE : FALSE;
} }
} }
?> ?>

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class Model_VOLUMEUSAGE extends ORMTSM { class Model_VOLUMEUSAGE extends TSM_ORM {
protected $_table_name = 'VOLUMEUSAGE'; protected $_table_name = 'VOLUMEUSAGE';
protected $_primary_key = 'NODE_NAME'; // We need a primary key to detect that the object is loaded. protected $_primary_key = 'NODE_NAME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array( protected $_sorting = array(

View File

@ -3,14 +3,14 @@
/** /**
* This class overrides Kohana's ORM * This class overrides Kohana's ORM
* *
* @package lnApp/Modifications * @package PTA/Modifications
* @category Classes * @category Classes
* @category Helpers * @category Helpers
* @author Deon George * @author Deon George
* @copyright (c) 2010 Deon George * @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
class ORM extends Kohana_ORM { abstract class ORM extends Kohana_ORM {
protected $_table_names_plural = FALSE; protected $_table_names_plural = FALSE;
protected $_model_names_plural = FALSE; protected $_model_names_plural = FALSE;
private $_object_formated = array(); private $_object_formated = array();
@ -58,7 +58,7 @@ class ORM extends Kohana_ORM {
$value = $this->__get($column); $value = $this->__get($column);
// If some of our fields need to be formated for display purposes. // If some of our fields need to be formated for display purposes.
if ($this->_loaded AND ! $this->_formated AND $this->_display_filters) if (! $this->_formated AND $this->_display_filters)
$this->_format(); $this->_format();
if (isset($this->_object_formated[$column])) if (isset($this->_object_formated[$column]))

View File

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

View File

@ -11,11 +11,11 @@
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class SystemMessage extends lnApp_SystemMessage { class SystemMessage extends lnApp_SystemMessage {
static public function TSM_Error($error,$sql) { static public function TSM($type,$error,$sql=NULL) {
SystemMessage::add(array( SystemMessage::add(array(
'title'=>_('Error while talking to TSM'), 'title'=>_('While talking to TSM'),
'body'=>_('Running SQL').': <b>'.$sql.'</b><br/><br/>'.(is_array($error) ? implode('<br/>',$error) : $error), 'body'=>($sql ? _('Running SQL').': <b>'.$sql.'</b><br/><br/>' : '').(is_array($error) ? implode('<br/>',$error) : $error),
'type'=>'error', 'type'=>$type,
)); ));
} }
} }

View File

@ -11,12 +11,19 @@
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
class TSM { class TSM {
static $_online = FALSE;
public function set($username,$password,Database_TSM_Result $server) { public function set($username,$password,Database_TSM_Result $server) {
// @todo Consider encrypting this // @todo Consider encrypting this
Session::instance()->set(Kohana::config('auth.session_key'),$username); Session::instance()->set(Kohana::$config->load('auth')->session_key,$username);
Session::instance()->set('password',$password); Session::instance()->set('password',$password);
Session::instance()->set('SERVER',$server); Session::instance()->set('SERVER',$server);
return TSM::$_online = TRUE;
}
public static function online() {
return TSM::$_online;
} }
public static function instance() { public static function instance() {
@ -24,7 +31,7 @@ class TSM {
} }
public static function name() { public static function name() {
return Session::instance()->get('SERVER')->rewind()->get('SERVER_NAME'); return Session::instance()->get('SERVER')->get('SERVER_NAME');
} }
public static function version() { public static function version() {

View File

@ -9,7 +9,7 @@
* @copyright (c) 2010 Deon George * @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
class Valid extends Kohana_Valid { abstract class Valid extends Kohana_Valid {
/** /**
* Checks if a field matches the value of another field, if it is set. * Checks if a field matches the value of another field, if it is set.
* Field is ignored if it is blank. * Field is ignored if it is blank.

View File

@ -4,6 +4,7 @@
* PTA Configuration - Authentication Driver * PTA Configuration - Authentication Driver
* *
* @package PTA * @package PTA
* @subpackage Authentication
* @category Configuration * @category Configuration
* @author Deon George * @author Deon George
* @copyright (c) 2010 phpTSMadmin Development Team * @copyright (c) 2010 phpTSMadmin Development Team

View File

@ -1,9 +1,9 @@
<?php defined('SYSPATH') or die('No direct access allowed.'); <?php defined('SYSPATH') or die('No direct access allowed.');
/** /**
* lnApp Configuration - Cache Driver * PTA Configuration - Cache Driver
* *
* @package lnApp * @package PTA
* @subpackage Cache * @subpackage Cache
* @category Configuration * @category Configuration
* @author Deon George * @author Deon George
@ -11,13 +11,22 @@
* @license http://phptsmadmin.sf.net/license.html * @license http://phptsmadmin.sf.net/license.html
*/ */
return array return array(
( 'apc' => array(
'file' => array 'driver' => 'apc',
( 'default_expire' => 3600,
),
'file' => array(
'driver' => 'file', 'driver' => 'file',
'cache_dir' => Kohana::$cache_dir ? Kohana::$cache_dir : '/dev/shm/lnapp', 'cache_dir' => Kohana::$cache_dir ? Kohana::$cache_dir : '/dev/shm/lnapp',
'default_expire' => 3600, 'default_expire' => 3600,
) 'ignore_on_delete' => array(
'.gitignore',
'.git',
'.htaccess',
'.svn'
)
),
); );
?> ?>

View File

@ -13,7 +13,7 @@
return array( return array(
'cache_type' => 'file', 'cache_type' => 'file',
'client' => '/opt/tivoli/tsm/client/ba/bin/dsmadmc', 'client' => '/opt/tivoli/tsm/client/ba/bin/dsmadmc',
'client_type' => 'db2', 'client_type' => 'dsmadmc',
'client_errorlogname' => '/tmp/pta-tsm-errorlog.log', 'client_errorlogname' => '/tmp/pta-tsm-errorlog.log',
'date_format' => 'd-m-Y', 'date_format' => 'd-m-Y',
'tsmdatatypes' => array('Bkup'=>'BACKUP','Arch'=>'ARCHIVE'), 'tsmdatatypes' => array('Bkup'=>'BACKUP','Arch'=>'ARCHIVE'),
@ -28,9 +28,10 @@ return array(
), ),
'method_security' => TRUE, // Enables Method Security. Setting to false means any method can be run without authentication 'method_security' => TRUE, // Enables Method Security. Setting to false means any method can be run without authentication
'site' => array( 'site' => array(
'mode' => Kohana::PRODUCTION,
), ),
'site_debug' => FALSE, 'site_debug' => FALSE,
'site_mode' => array( 'site_name' => 'phpTSMadmin',
) 'theme' => 'yaml',
); );
?> ?>

View File

@ -0,0 +1,20 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* PTA Configuration - Debug Settings
*
* @package PTA
* @subpackage Debug
* @category Configuration
* @author Deon George
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
return array
(
'ajax'=>FALSE, // AJAX actions can only be run by ajax calls if set to FALSE
'etag'=>FALSE, // Force generating ETAGS
'task_sim'=>FALSE, // Simulate running tasks
);
?>

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

View File

@ -0,0 +1,61 @@
/*
* jsTree apple theme 1.0
* Supported features: dots/no-dots, icons/no-icons, focused, loading
* Supported plugins: ui (hovered, clicked), checkbox, contextmenu, search
*/
.jstree-apple > ul { background:url("bg.jpg") left top repeat; }
.jstree-apple li,
.jstree-apple ins { background-image:url("d.png"); background-repeat:no-repeat; background-color:transparent; }
.jstree-apple li { background-position:-90px 0; background-repeat:repeat-y; }
.jstree-apple li.jstree-last { background:transparent; }
.jstree-apple .jstree-open > ins { background-position:-72px 0; }
.jstree-apple .jstree-closed > ins { background-position:-54px 0; }
.jstree-apple .jstree-leaf > ins { background-position:-36px 0; }
.jstree-apple a { border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px; text-shadow:1px 1px 1px white; }
.jstree-apple .jstree-hovered { background:#e7f4f9; border:1px solid #d8f0fa; padding:0 3px 0 1px; text-shadow:1px 1px 1px silver; }
.jstree-apple .jstree-clicked { background:#beebff; border:1px solid #99defd; padding:0 3px 0 1px; }
.jstree-apple a .jstree-icon { background-position:-56px -20px; }
.jstree-apple a.jstree-loading .jstree-icon { background:url("throbber.gif") center center no-repeat !important; }
.jstree-apple.jstree-focused { background:white; }
.jstree-apple .jstree-no-dots li,
.jstree-apple .jstree-no-dots .jstree-leaf > ins { background:transparent; }
.jstree-apple .jstree-no-dots .jstree-open > ins { background-position:-18px 0; }
.jstree-apple .jstree-no-dots .jstree-closed > ins { background-position:0 0; }
.jstree-apple .jstree-no-icons a .jstree-icon { display:none; }
.jstree-apple .jstree-search { font-style:italic; }
.jstree-apple .jstree-no-icons .jstree-checkbox { display:inline-block; }
.jstree-apple .jstree-no-checkboxes .jstree-checkbox { display:none !important; }
.jstree-apple .jstree-checked > a > .jstree-checkbox { background-position:-38px -19px; }
.jstree-apple .jstree-unchecked > a > .jstree-checkbox { background-position:-2px -19px; }
.jstree-apple .jstree-undetermined > a > .jstree-checkbox { background-position:-20px -19px; }
.jstree-apple .jstree-checked > a > .checkbox:hover { background-position:-38px -37px; }
.jstree-apple .jstree-unchecked > a > .jstree-checkbox:hover { background-position:-2px -37px; }
.jstree-apple .jstree-undetermined > a > .jstree-checkbox:hover { background-position:-20px -37px; }
#vakata-dragged.jstree-apple ins { background:transparent !important; }
#vakata-dragged.jstree-apple .jstree-ok { background:url("d.png") -2px -53px no-repeat !important; }
#vakata-dragged.jstree-apple .jstree-invalid { background:url("d.png") -18px -53px no-repeat !important; }
#jstree-marker.jstree-apple { background:url("d.png") -41px -57px no-repeat !important; text-indent:-100px; }
.jstree-apple a.jstree-search { color:aqua; }
.jstree-apple .jstree-locked a { color:silver; cursor:default; }
#vakata-contextmenu.jstree-apple-context,
#vakata-contextmenu.jstree-apple-context li ul { background:#f0f0f0; border:1px solid #979797; -moz-box-shadow: 1px 1px 2px #999; -webkit-box-shadow: 1px 1px 2px #999; box-shadow: 1px 1px 2px #999; }
#vakata-contextmenu.jstree-apple-context li { }
#vakata-contextmenu.jstree-apple-context a { color:black; }
#vakata-contextmenu.jstree-apple-context a:hover,
#vakata-contextmenu.jstree-apple-context .vakata-hover > a { padding:0 5px; background:#e8eff7; border:1px solid #aecff7; color:black; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; }
#vakata-contextmenu.jstree-apple-context li.jstree-contextmenu-disabled a,
#vakata-contextmenu.jstree-apple-context li.jstree-contextmenu-disabled a:hover { color:silver; background:transparent; border:0; padding:1px 4px; }
#vakata-contextmenu.jstree-apple-context li.vakata-separator { background:white; border-top:1px solid #e0e0e0; margin:0; }
#vakata-contextmenu.jstree-apple-context li ul { margin-left:-4px; }
/* TODO: IE6 support - the `>` selectors */

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

View File

@ -0,0 +1,77 @@
/*
* jsTree classic theme 1.0
* Supported features: dots/no-dots, icons/no-icons, focused, loading
* Supported plugins: ui (hovered, clicked), checkbox, contextmenu, search
*/
.jstree-classic li,
.jstree-classic ins { background-image:url("d.png"); background-repeat:no-repeat; background-color:transparent; }
.jstree-classic li { background-position:-90px 0; background-repeat:repeat-y; }
.jstree-classic li.jstree-last { background:transparent; }
.jstree-classic .jstree-open > ins { background-position:-72px 0; }
.jstree-classic .jstree-closed > ins { background-position:-54px 0; }
.jstree-classic .jstree-leaf > ins { background-position:-36px 0; }
.jstree-classic .jstree-hovered { background:#AABBCC; border:0px solid #FFFFFF; padding:0 2px 0 1px; }
.jstree-classic .jstree-clicked { background:#E6E6E8; border:0px solid #FFFFFF; padding:0 2px 0 1px; }
.jstree-classic a .jstree-icon { background-position:-56px -19px; }
.jstree-classic .jstree-open > a .jstree-icon { background-position:-56px -36px; }
.jstree-classic a.jstree-loading .jstree-icon { background:url("throbber.gif") center center no-repeat !important; }
/* .jstree-classic.jstree-focused { background:#FCFCFE; } */
.jstree-classic .jstree-no-dots li,
.jstree-classic .jstree-no-dots .jstree-leaf > ins { background:transparent; }
.jstree-classic .jstree-no-dots .jstree-open > ins { background-position:-18px 0; }
.jstree-classic .jstree-no-dots .jstree-closed > ins { background-position:0 0; }
.jstree-classic .jstree-no-icons a .jstree-icon { display:none; }
.jstree-classic .jstree-search { font-style:italic; }
.jstree-classic .jstree-no-icons .jstree-checkbox { display:inline-block; }
.jstree-classic .jstree-no-checkboxes .jstree-checkbox { display:none !important; }
.jstree-classic .jstree-checked > a > .jstree-checkbox { background-position:-38px -19px; }
.jstree-classic .jstree-unchecked > a > .jstree-checkbox { background-position:-2px -19px; }
.jstree-classic .jstree-undetermined > a > .jstree-checkbox { background-position:-20px -19px; }
.jstree-classic .jstree-checked > a > .jstree-checkbox:hover { background-position:-38px -37px; }
.jstree-classic .jstree-unchecked > a > .jstree-checkbox:hover { background-position:-2px -37px; }
.jstree-classic .jstree-undetermined > a > .jstree-checkbox:hover { background-position:-20px -37px; }
#vakata-dragged.jstree-classic ins { background:transparent !important; }
#vakata-dragged.jstree-classic .jstree-ok { background:url("d.png") -2px -53px no-repeat !important; }
#vakata-dragged.jstree-classic .jstree-invalid { background:url("d.png") -18px -53px no-repeat !important; }
#jstree-marker.jstree-classic { background:url("d.png") -41px -57px no-repeat !important; text-indent:-100px; }
.jstree-classic a.jstree-search { color:aqua; }
.jstree-classic .jstree-locked a { color:silver; cursor:default; }
#vakata-contextmenu.jstree-classic-context,
#vakata-contextmenu.jstree-classic-context li ul { background:#f0f0f0; border:1px solid #979797; -moz-box-shadow: 1px 1px 2px #999; -webkit-box-shadow: 1px 1px 2px #999; box-shadow: 1px 1px 2px #999; }
#vakata-contextmenu.jstree-classic-context li { }
#vakata-contextmenu.jstree-classic-context a { color:black; }
#vakata-contextmenu.jstree-classic-context a:hover,
#vakata-contextmenu.jstree-classic-context .vakata-hover > a { padding:0 5px; background:#e8eff7; border:1px solid #aecff7; color:black; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; }
#vakata-contextmenu.jstree-classic-context li.jstree-contextmenu-disabled a,
#vakata-contextmenu.jstree-classic-context li.jstree-contextmenu-disabled a:hover { color:silver; background:transparent; border:0; padding:1px 4px; }
#vakata-contextmenu.jstree-classic-context li.vakata-separator { background:white; border-top:1px solid #e0e0e0; margin:0; }
#vakata-contextmenu.jstree-classic-context li ul { margin-left:-4px; }
/* IE6 BEGIN */
.jstree-classic li,
.jstree-classic ins,
#vakata-dragged.jstree-classic .jstree-invalid,
#vakata-dragged.jstree-classic .jstree-ok,
#jstree-marker.jstree-classic { _background-image:url("d.gif"); }
.jstree-classic .jstree-open ins { _background-position:-72px 0; }
.jstree-classic .jstree-closed ins { _background-position:-54px 0; }
.jstree-classic .jstree-leaf ins { _background-position:-36px 0; }
.jstree-classic .jstree-open a ins.jstree-icon { _background-position:-56px -36px; }
.jstree-classic .jstree-closed a ins.jstree-icon { _background-position:-56px -19px; }
.jstree-classic .jstree-leaf a ins.jstree-icon { _background-position:-56px -19px; }
#vakata-contextmenu.jstree-classic-context ins { _display:none; }
#vakata-contextmenu.jstree-classic-context li { _zoom:1; }
.jstree-classic .jstree-undetermined a .jstree-checkbox { _background-position:-20px -19px; }
.jstree-classic .jstree-checked a .jstree-checkbox { _background-position:-38px -19px; }
.jstree-classic .jstree-unchecked a .jstree-checkbox { _background-position:-2px -19px; }
/* IE6 END */

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

View File

@ -0,0 +1,84 @@
/*
* jsTree default-rtl theme 1.0
* Supported features: dots/no-dots, icons/no-icons, focused, loading
* Supported plugins: ui (hovered, clicked), checkbox, contextmenu, search
*/
.jstree-default-rtl li,
.jstree-default-rtl ins { background-image:url("d.png"); background-repeat:no-repeat; background-color:transparent; }
.jstree-default-rtl li { background-position:-90px 0; background-repeat:repeat-y; }
.jstree-default-rtl li.jstree-last { background:transparent; }
.jstree-default-rtl .jstree-open > ins { background-position:-72px 0; }
.jstree-default-rtl .jstree-closed > ins { background-position:-54px 0; }
.jstree-default-rtl .jstree-leaf > ins { background-position:-36px 0; }
.jstree-default-rtl .jstree-hovered { background:#e7f4f9; border:1px solid #d8f0fa; padding:0 2px 0 1px; }
.jstree-default-rtl .jstree-clicked { background:#beebff; border:1px solid #99defd; padding:0 2px 0 1px; }
.jstree-default-rtl a .jstree-icon { background-position:-56px -19px; }
.jstree-default-rtl a.jstree-loading .jstree-icon { background:url("throbber.gif") center center no-repeat !important; }
.jstree-default-rtl.jstree-focused { background:#ffffee; }
.jstree-default-rtl .jstree-no-dots li,
.jstree-default-rtl .jstree-no-dots .jstree-leaf > ins { background:transparent; }
.jstree-default-rtl .jstree-no-dots .jstree-open > ins { background-position:-18px 0; }
.jstree-default-rtl .jstree-no-dots .jstree-closed > ins { background-position:0 0; }
.jstree-default-rtl .jstree-no-icons a .jstree-icon { display:none; }
.jstree-default-rtl .jstree-search { font-style:italic; }
.jstree-default-rtl .jstree-no-icons .jstree-checkbox { display:inline-block; }
.jstree-default-rtl .jstree-no-checkboxes .jstree-checkbox { display:none !important; }
.jstree-default-rtl .jstree-checked > a > .jstree-checkbox { background-position:-38px -19px; }
.jstree-default-rtl .jstree-unchecked > a > .jstree-checkbox { background-position:-2px -19px; }
.jstree-default-rtl .jstree-undetermined > a > .jstree-checkbox { background-position:-20px -19px; }
.jstree-default-rtl .jstree-checked > a > .jstree-checkbox:hover { background-position:-38px -37px; }
.jstree-default-rtl .jstree-unchecked > a > .jstree-checkbox:hover { background-position:-2px -37px; }
.jstree-default-rtl .jstree-undetermined > a > .jstree-checkbox:hover { background-position:-20px -37px; }
#vakata-dragged.jstree-default-rtl ins { background:transparent !important; }
#vakata-dragged.jstree-default-rtl .jstree-ok { background:url("d.png") -2px -53px no-repeat !important; }
#vakata-dragged.jstree-default-rtl .jstree-invalid { background:url("d.png") -18px -53px no-repeat !important; }
#jstree-marker.jstree-default-rtl { background:url("d.png") -41px -57px no-repeat !important; text-indent:-100px; }
.jstree-default-rtl a.jstree-search { color:aqua; }
.jstree-default-rtl .jstree-locked a { color:silver; cursor:default; }
#vakata-contextmenu.jstree-default-rtl-context,
#vakata-contextmenu.jstree-default-rtl-context li ul { background:#f0f0f0; border:1px solid #979797; -moz-box-shadow: 1px 1px 2px #999; -webkit-box-shadow: 1px 1px 2px #999; box-shadow: 1px 1px 2px #999; }
#vakata-contextmenu.jstree-default-rtl-context li { }
#vakata-contextmenu.jstree-default-rtl-context a { color:black; }
#vakata-contextmenu.jstree-default-rtl-context a:hover,
#vakata-contextmenu.jstree-default-rtl-context .vakata-hover > a { padding:0 5px; background:#e8eff7; border:1px solid #aecff7; color:black; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; }
#vakata-contextmenu.jstree-default-rtl-context li.jstree-contextmenu-disabled a,
#vakata-contextmenu.jstree-default-rtl-context li.jstree-contextmenu-disabled a:hover { color:silver; background:transparent; border:0; padding:1px 4px; }
#vakata-contextmenu.jstree-default-rtl-context li.vakata-separator { background:white; border-top:1px solid #e0e0e0; margin:0; }
#vakata-contextmenu.jstree-default-rtl-context li ul { margin-left:-4px; }
/* IE6 BEGIN */
.jstree-default-rtl li,
.jstree-default-rtl ins,
#vakata-dragged.jstree-default-rtl .jstree-invalid,
#vakata-dragged.jstree-default-rtl .jstree-ok,
#jstree-marker.jstree-default-rtl { _background-image:url("d.gif"); }
.jstree-default-rtl .jstree-open ins { _background-position:-72px 0; }
.jstree-default-rtl .jstree-closed ins { _background-position:-54px 0; }
.jstree-default-rtl .jstree-leaf ins { _background-position:-36px 0; }
.jstree-default-rtl a ins.jstree-icon { _background-position:-56px -19px; }
#vakata-contextmenu.jstree-default-rtl-context ins { _display:none; }
#vakata-contextmenu.jstree-default-rtl-context li { _zoom:1; }
.jstree-default-rtl .jstree-undetermined a .jstree-checkbox { _background-position:-18px -19px; }
.jstree-default-rtl .jstree-checked a .jstree-checkbox { _background-position:-36px -19px; }
.jstree-default-rtl .jstree-unchecked a .jstree-checkbox { _background-position:0px -19px; }
/* IE6 END */
/* RTL part */
.jstree-default-rtl .jstree-hovered, .jstree-default-rtl .jstree-clicked { padding:0 1px 0 2px; }
.jstree-default-rtl li { background-image:url("dots.gif"); background-position: 100% 0px; }
.jstree-default-rtl .jstree-checked > a > .jstree-checkbox { background-position:-36px -19px; margin-left:2px; }
.jstree-default-rtl .jstree-unchecked > a > .jstree-checkbox { background-position:0px -19px; margin-left:2px; }
.jstree-default-rtl .jstree-undetermined > a > .jstree-checkbox { background-position:-18px -19px; margin-left:2px; }
.jstree-default-rtl .jstree-checked > a > .jstree-checkbox:hover { background-position:-36px -37px; }
.jstree-default-rtl .jstree-unchecked > a > .jstree-checkbox:hover { background-position:0px -37px; }
.jstree-default-rtl .jstree-undetermined > a > .jstree-checkbox:hover { background-position:-18px -37px; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -0,0 +1,74 @@
/*
* jsTree default theme 1.0
* Supported features: dots/no-dots, icons/no-icons, focused, loading
* Supported plugins: ui (hovered, clicked), checkbox, contextmenu, search
*/
.jstree-default li,
.jstree-default ins { background-image:url("d.png"); background-repeat:no-repeat; background-color:transparent; }
.jstree-default li { background-position:-90px 0; background-repeat:repeat-y; }
.jstree-default li.jstree-last { background:transparent; }
.jstree-default .jstree-open > ins { background-position:-72px 0; }
.jstree-default .jstree-closed > ins { background-position:-54px 0; }
.jstree-default .jstree-leaf > ins { background-position:-36px 0; }
.jstree-default .jstree-hovered { background:#e7f4f9; border:1px solid #d8f0fa; padding:0 2px 0 1px; }
.jstree-default .jstree-clicked { background:#beebff; border:1px solid #99defd; padding:0 2px 0 1px; }
.jstree-default a .jstree-icon { background-position:-56px -19px; }
.jstree-default a.jstree-loading .jstree-icon { background:url("throbber.gif") center center no-repeat !important; }
.jstree-default.jstree-focused { background:#ffffee; }
.jstree-default .jstree-no-dots li,
.jstree-default .jstree-no-dots .jstree-leaf > ins { background:transparent; }
.jstree-default .jstree-no-dots .jstree-open > ins { background-position:-18px 0; }
.jstree-default .jstree-no-dots .jstree-closed > ins { background-position:0 0; }
.jstree-default .jstree-no-icons a .jstree-icon { display:none; }
.jstree-default .jstree-search { font-style:italic; }
.jstree-default .jstree-no-icons .jstree-checkbox { display:inline-block; }
.jstree-default .jstree-no-checkboxes .jstree-checkbox { display:none !important; }
.jstree-default .jstree-checked > a > .jstree-checkbox { background-position:-38px -19px; }
.jstree-default .jstree-unchecked > a > .jstree-checkbox { background-position:-2px -19px; }
.jstree-default .jstree-undetermined > a > .jstree-checkbox { background-position:-20px -19px; }
.jstree-default .jstree-checked > a > .jstree-checkbox:hover { background-position:-38px -37px; }
.jstree-default .jstree-unchecked > a > .jstree-checkbox:hover { background-position:-2px -37px; }
.jstree-default .jstree-undetermined > a > .jstree-checkbox:hover { background-position:-20px -37px; }
#vakata-dragged.jstree-default ins { background:transparent !important; }
#vakata-dragged.jstree-default .jstree-ok { background:url("d.png") -2px -53px no-repeat !important; }
#vakata-dragged.jstree-default .jstree-invalid { background:url("d.png") -18px -53px no-repeat !important; }
#jstree-marker.jstree-default { background:url("d.png") -41px -57px no-repeat !important; text-indent:-100px; }
.jstree-default a.jstree-search { color:aqua; }
.jstree-default .jstree-locked a { color:silver; cursor:default; }
#vakata-contextmenu.jstree-default-context,
#vakata-contextmenu.jstree-default-context li ul { background:#f0f0f0; border:1px solid #979797; -moz-box-shadow: 1px 1px 2px #999; -webkit-box-shadow: 1px 1px 2px #999; box-shadow: 1px 1px 2px #999; }
#vakata-contextmenu.jstree-default-context li { }
#vakata-contextmenu.jstree-default-context a { color:black; }
#vakata-contextmenu.jstree-default-context a:hover,
#vakata-contextmenu.jstree-default-context .vakata-hover > a { padding:0 5px; background:#e8eff7; border:1px solid #aecff7; color:black; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; }
#vakata-contextmenu.jstree-default-context li.jstree-contextmenu-disabled a,
#vakata-contextmenu.jstree-default-context li.jstree-contextmenu-disabled a:hover { color:silver; background:transparent; border:0; padding:1px 4px; }
#vakata-contextmenu.jstree-default-context li.vakata-separator { background:white; border-top:1px solid #e0e0e0; margin:0; }
#vakata-contextmenu.jstree-default-context li ul { margin-left:-4px; }
/* IE6 BEGIN */
.jstree-default li,
.jstree-default ins,
#vakata-dragged.jstree-default .jstree-invalid,
#vakata-dragged.jstree-default .jstree-ok,
#jstree-marker.jstree-default { _background-image:url("d.gif"); }
.jstree-default .jstree-open ins { _background-position:-72px 0; }
.jstree-default .jstree-closed ins { _background-position:-54px 0; }
.jstree-default .jstree-leaf ins { _background-position:-36px 0; }
.jstree-default a ins.jstree-icon { _background-position:-56px -19px; }
#vakata-contextmenu.jstree-default-context ins { _display:none; }
#vakata-contextmenu.jstree-default-context li { _zoom:1; }
.jstree-default .jstree-undetermined a .jstree-checkbox { _background-position:-20px -19px; }
.jstree-default .jstree-checked a .jstree-checkbox { _background-position:-38px -19px; }
.jstree-default .jstree-unchecked a .jstree-checkbox { _background-position:-2px -19px; }
/* IE6 END */

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -14,10 +14,10 @@
<td>OS</td> <td>OS</td>
<td>Last Access</td> <td>Last Access</td>
<td>Last IP Addr</td> <td>Last IP Addr</td>
<?php foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype) { ?> <?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<td><?php echo $ctype[0]; ?></td> <td><?php echo $ctype[0]; ?></td>
<?php } ?> <?php } ?>
<?php foreach (Kohana::config('config.tsmpooltypes') as $type) { ?> <?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type) { ?>
<td colspan="3" class="right"><?php echo $type; ?>(Vol/Fil/Dat)</td> <td colspan="3" class="right"><?php echo $type; ?>(Vol/Fil/Dat)</td>
<?php } ?> <?php } ?>
</tr> </tr>
@ -28,10 +28,10 @@
<td class="data"><?php echo $no->platform(); ?></td> <td class="data"><?php echo $no->platform(); ?></td>
<td class="data"><?php echo $no->display('LASTACC_TIME'); ?></td> <td class="data"><?php echo $no->display('LASTACC_TIME'); ?></td>
<td class="data"><?php echo $no->display('TCP_ADDRESS'); ?></td> <td class="data"><?php echo $no->display('TCP_ADDRESS'); ?></td>
<?php foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype) { ?> <?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<td class="data"><?php echo $no->hasData($btype) ? 'Y' : 'N'; ?></td> <td class="data"><?php echo $no->hasData($btype) ? 'Y' : 'N'; ?></td>
<?php } ?> <?php } ?>
<?php foreach (Kohana::config('config.tsmpooltypes') as $type) { ?> <?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type) { ?>
<td class="data-right"><?php echo count($no->getStorageTypeVols($type)); ?></td> <td class="data-right"><?php echo count($no->getStorageTypeVols($type)); ?></td>
<td class="data-right"><?php echo $no->getStorageTypeFiles($type); ?></td> <td class="data-right"><?php echo $no->getStorageTypeFiles($type); ?></td>
<td class="data-right"><?php echo $no->getStorageTypeData($type); ?></td> <td class="data-right"><?php echo $no->getStorageTypeData($type); ?></td>
@ -68,11 +68,11 @@
<td class="right">Files</td> <td class="right">Files</td>
<td class="right">MB</td> <td class="right">MB</td>
</tr> </tr>
<?php foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype) { ?> <?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<tr class="subhead"> <tr class="subhead">
<td colspan="15"><?php echo $btype; ?></td> <td colspan="15"><?php echo $btype; ?></td>
</tr> </tr>
<?php foreach (Kohana::config('config.tsmpooltypes') as $type) { ?> <?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type) { ?>
<tr class="subhead"> <tr class="subhead">
<td>&nbsp;</td> <td>&nbsp;</td>
<td colspan="14"><?php echo $type; ?></td> <td colspan="14"><?php echo $type; ?></td>
@ -125,11 +125,11 @@
<td class="right">Nodes</td> <td class="right">Nodes</td>
<td class="right">Location</td> <td class="right">Location</td>
</tr> </tr>
<?php foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype) { ?> <?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<tr class="subhead"> <tr class="subhead">
<td colspan="14"><?php echo $btype; ?></td> <td colspan="14"><?php echo $btype; ?></td>
</tr> </tr>
<?php foreach (Kohana::config('config.tsmpooltypes') as $type) { ?> <?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type) { ?>
<tr class="subhead"> <tr class="subhead">
<td>&nbsp;</td> <td>&nbsp;</td>
<td colspan="13"><?php echo $type; ?></td> <td colspan="13"><?php echo $type; ?></td>

View File

@ -82,7 +82,7 @@
<td class="data" colspan="8"><?php echo count($lo->readonlyvol()); ?></td> <td class="data" colspan="8"><?php echo count($lo->readonlyvol()); ?></td>
</tr> </tr>
<tr> <tr>
<td colspan="2">&sup1; Stale Storage Pool Volumes (<span class="data"><?php echo Kohana::config('config.tsmtapeage'); ?></span> days)</td> <td colspan="2">&sup1; Stale Storage Pool Volumes (<span class="data"><?php echo Kohana::$config->load('config')->tsmtapeage; ?></span> days)</td>
<td class="data" colspan="8"><?php echo count($lo->stalevol()); ?></td> <td class="data" colspan="8"><?php echo count($lo->stalevol()); ?></td>
</tr> </tr>
<tr> <tr>
@ -101,7 +101,7 @@
<tr> <tr>
<td colspan="2">Storage Type</td> <td colspan="2">Storage Type</td>
<?php foreach (array('IN','OUT') as $inout) { ?> <?php foreach (array('IN','OUT') as $inout) { ?>
<?php foreach (Kohana::config('config.tsmvolstatus') as $status) { ?> <?php foreach (Kohana::$config->load('config')->tsmvolstatus as $status) { ?>
<td class="right"><?php printf('%s: %s',$inout,$status); ?></td> <td class="right"><?php printf('%s: %s',$inout,$status); ?></td>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
@ -113,7 +113,7 @@
<td colspan="3">&nbsp;</td> <td colspan="3">&nbsp;</td>
<?php } ?> <?php } ?>
</tr> </tr>
<?php $i=0; foreach (Kohana::config('config.tsmdbtypes') as $type) { ?> <?php $i=0; foreach (Kohana::$config->load('config')->tsmdbtypes as $type) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>"> <tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td>&nbsp;</td> <td>&nbsp;</td>
<td><?php echo $type; ?></td> <td><?php echo $type; ?></td>
@ -123,11 +123,11 @@
<?php } ?> <?php } ?>
</tr> </tr>
<?php } ?> <?php } ?>
<?php foreach (Kohana::config('config.tsmpooltypes') as $type) { ?> <?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>"> <tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data" colspan="2"><?php echo $type; ?></td> <td class="data" colspan="2"><?php echo $type; ?></td>
<?php foreach (array('IN','OUT') as $inout) { ?> <?php foreach (array('IN','OUT') as $inout) { ?>
<?php foreach (Kohana::config('config.tsmvolstatus') as $status) { ?> <?php foreach (Kohana::$config->load('config')->tsmvolstatus as $status) { ?>
<td class="data-right"><?php echo count($lo->volstype($type,$inout,$status)); ?></td> <td class="data-right"><?php echo count($lo->volstype($type,$inout,$status)); ?></td>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
@ -137,7 +137,7 @@
<td>&nbsp;</td> <td>&nbsp;</td>
<td><?php echo $spo; ?></td> <td><?php echo $spo; ?></td>
<?php foreach (array('IN','OUT') as $inout) { ?> <?php foreach (array('IN','OUT') as $inout) { ?>
<?php foreach (Kohana::config('config.tsmvolstatus') as $status) { ?> <?php foreach (Kohana::$config->load('config')->tsmvolstatus as $status) { ?>
<td class="right"><?php echo count($spo->libvolstype($inout,$status)); ?></td> <td class="right"><?php echo count($spo->libvolstype($inout,$status)); ?></td>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>

View File

@ -13,7 +13,7 @@
<td>File Space</td> <td>File Space</td>
<td>Last Date</td> <td>Last Date</td>
<td class="right">Utilisation</td> <td class="right">Utilisation</td>
<?php foreach (Kohana::config('config.tsmpooltypes') as $type) <?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type)
if (count($pools = $node->getStoragePoolsType('Bkup',$type))) if (count($pools = $node->getStoragePoolsType('Bkup',$type)))
foreach ($pools as $pool_name) { ?> foreach ($pools as $pool_name) { ?>
<td class="right"><?php echo $pool_name; ?> <span style="vertical-align: super; font-size: 60%;"><?echo $type; ?></span></td> <td class="right"><?php echo $pool_name; ?> <span style="vertical-align: super; font-size: 60%;"><?echo $type; ?></span></td>
@ -24,7 +24,7 @@
<td class="data"><?php echo $fso->display('FILESPACE_NAME'); ?></td> <td class="data"><?php echo $fso->display('FILESPACE_NAME'); ?></td>
<td class="data"><?php echo $fso->display('BACKUP_END'); ?></td> <td class="data"><?php echo $fso->display('BACKUP_END'); ?></td>
<td class="data-right"><?php echo number_format($fso->utilsation(),2); ?></td> <td class="data-right"><?php echo number_format($fso->utilsation(),2); ?></td>
<?php foreach (Kohana::config('config.tsmpooltypes') as $type) <?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type)
if (count($pools = $node->getStoragePoolsType('Bkup',$type))) if (count($pools = $node->getStoragePoolsType('Bkup',$type)))
foreach ($pools as $pool_name) { ?> foreach ($pools as $pool_name) { ?>
<td class="data-right"><?php echo number_format($fso->pool_logical_util($pool_name,'Bkup'),2); ?> (<?php echo $fso->pool_numvols($pool_name,'BACKUP'); ?>)</td> <td class="data-right"><?php echo number_format($fso->pool_logical_util($pool_name,'Bkup'),2); ?> (<?php echo $fso->pool_numvols($pool_name,'BACKUP'); ?>)</td>
@ -50,7 +50,7 @@
<td class="right">Files</td> <td class="right">Files</td>
<td class="right">MB</td> <td class="right">MB</td>
</tr> </tr>
<?php $i=0; foreach (Kohana::config('config.tsmpooltypes') as $type) { ?> <?php $i=0; foreach (Kohana::$config->load('config')->tsmpooltypes as $type) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>"> <tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data" colspan="2"><?php echo $type; ?></td> <td class="data" colspan="2"><?php echo $type; ?></td>
<td class="data-right"><?php echo count($node->getStorageTypeVols($type)); ?></td> <td class="data-right"><?php echo count($node->getStorageTypeVols($type)); ?></td>
@ -82,7 +82,7 @@
</tr> </tr>
<tr> <tr>
<td>File Space</td> <td>File Space</td>
<?php foreach (Kohana::config('config.tsmpooltypes') as $type) <?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type)
if (count($pools = $node->getStoragePoolsType('Arch',$type))) if (count($pools = $node->getStoragePoolsType('Arch',$type)))
foreach ($pools as $pool_name) { ?> foreach ($pools as $pool_name) { ?>
<td class="right"><?php echo $pool_name; ?> <span style="vertical-align: super; font-size: 60%;"><?echo $type; ?></span></td> <td class="right"><?php echo $pool_name; ?> <span style="vertical-align: super; font-size: 60%;"><?echo $type; ?></span></td>
@ -91,7 +91,7 @@
<?php $i=0;foreach ($node->FILESPACE->find_all() as $fso) { ?> <?php $i=0;foreach ($node->FILESPACE->find_all() as $fso) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>"> <tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data"><?php echo $fso->display('FILESPACE_NAME'); ?></td> <td class="data"><?php echo $fso->display('FILESPACE_NAME'); ?></td>
<?php foreach (Kohana::config('config.tsmpooltypes') as $type) <?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type)
if (count($pools = $node->getStoragePoolsType('Arch',$type))) if (count($pools = $node->getStoragePoolsType('Arch',$type)))
foreach ($pools as $pool_name) { ?> foreach ($pools as $pool_name) { ?>
<td class="data-right"><?php echo number_format($fso->pool_logical_util($pool_name,'Arch'),2); ?> (<?php echo $fso->pool_numvols($pool_name,'ARCHIVE'); ?>)</td> <td class="data-right"><?php echo number_format($fso->pool_logical_util($pool_name,'Arch'),2); ?> (<?php echo $fso->pool_numvols($pool_name,'ARCHIVE'); ?>)</td>

View File

@ -1,5 +1,5 @@
<table width="100%"> <table width="100%">
<?php foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype) { ?> <?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<tr> <tr>
<td style="width: 100%; vertical-align: top;"> <td style="width: 100%; vertical-align: top;">
<table class="box-full"> <table class="box-full">

View File

@ -189,7 +189,7 @@
<td class="right">Errors R/W</td> <td class="right">Errors R/W</td>
<td class="right">Util %</td> <td class="right">Util %</td>
<td class="right">Reclaim</td> <td class="right">Reclaim</td>
<?php foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype) { ?> <?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<td class="right"><?php echo 'FS '.$btype; ?></td> <td class="right"><?php echo 'FS '.$btype; ?></td>
<td class="right"><?php echo 'Node '.$btype; ?></td> <td class="right"><?php echo 'Node '.$btype; ?></td>
<?php } ?> <?php } ?>
@ -204,7 +204,7 @@
<td class="data-right"><?php printf('%s/%s',$vo->READ_ERRORS,$vo->WRITE_ERRORS); ?></td> <td class="data-right"><?php printf('%s/%s',$vo->READ_ERRORS,$vo->WRITE_ERRORS); ?></td>
<td class="data-right"><?php echo $vo->display('EST_CAPACITY_MB'); ?></td> <td class="data-right"><?php echo $vo->display('EST_CAPACITY_MB'); ?></td>
<td class="data-right"><?php echo $vo->display('PCT_RECLAIM'); ?></td> <td class="data-right"><?php echo $vo->display('PCT_RECLAIM'); ?></td>
<?php foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype) { ?> <?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<td class="data-right"><?php echo $vo->getFSOnVol($ctype); ?></td> <td class="data-right"><?php echo $vo->getFSOnVol($ctype); ?></td>
<td class="data-right"><?php echo $vo->getNodesOnVol($ctype); ?></td> <td class="data-right"><?php echo $vo->getNodesOnVol($ctype); ?></td>
<?php } ?> <?php } ?>