Clean-up libraries
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
<?php defined('BASEPATH') || exit('No direct script access allowed');
|
||||
/*
|
||||
* Copyright (c) 2011 Karsten Heiken <karsten@disposed.de>
|
||||
* Copyright (c) 2011 Karsten Heiken, Eike Foken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -35,7 +34,10 @@ function check_login() {
|
||||
$public_controllers = array('auth', 'xmlrpc');
|
||||
|
||||
$CI = & get_instance();
|
||||
if (!$CI->input->is_ajax_request() && !$CI->access->loggedIn() && !in_array($CI->router->class, $public_controllers)) {
|
||||
if (!$CI->input->is_ajax_request() && !$CI->access->isLoggedIn() && !in_array($CI->router->class, $public_controllers)) {
|
||||
redirect('auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file global.php */
|
||||
/* Location: ./application/hooks/global.php */
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
$lang['account_creation_successful'] = "Account successfully created";
|
||||
$lang['account_creation_unsuccessful'] = "Unable to create account";
|
||||
$lang['account_creation_duplicate_email'] = "Email already used or invalid";
|
||||
$lang['account_creation_duplicate_username'] = "username already used or invalid";
|
||||
$lang['password_change_successful'] = "Password successfully changed";
|
||||
$lang['password_change_unsuccessful'] = "Unable to change password";
|
||||
$lang['forgot_password_successful'] = "Password reset email sent";
|
||||
$lang['forgot_password_unsuccessful'] = "Unable to reset password";
|
||||
$lang['login_successful'] = "Erfolgreich eingeloggt";
|
||||
$lang['login_unsuccessful'] = "Benutzername oder Passwort falsch";
|
||||
$lang['logout_successful'] = "Erfolgreich ausgeloggt";
|
||||
$lang['update_successful'] = "Account information successfully updated";
|
||||
$lang['update_unsuccessful'] = "Unable to update account information";
|
||||
$lang['delete_successful'] = "User deleted";
|
||||
$lang['delete_unsuccessful'] = "Unable to delete user";
|
||||
|
||||
/* End of file auth_lang.php */
|
||||
/* Location: ./application/language/english/auth_lang.php */
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
$lang['account_creation_successful'] = "Account successfully created";
|
||||
$lang['account_creation_unsuccessful'] = "Unable to create account";
|
||||
$lang['account_creation_duplicate_email'] = "Email already used or invalid";
|
||||
$lang['account_creation_duplicate_username'] = "username already used or invalid";
|
||||
$lang['password_change_successful'] = "Password successfully changed";
|
||||
$lang['password_change_unsuccessful'] = "Unable to change password";
|
||||
$lang['forgot_password_successful'] = "Password reset email sent";
|
||||
$lang['forgot_password_unsuccessful'] = "Unable to reset password";
|
||||
$lang['login_successful'] = "Logged in successfully";
|
||||
$lang['login_unsuccessful'] = "Incorrect username or password";
|
||||
$lang['logout_successful'] = "Logged out successfully";
|
||||
$lang['update_successful'] = "Account information successfully updated";
|
||||
$lang['update_unsuccessful'] = "Unable to update account information";
|
||||
$lang['delete_successful'] = "User deleted";
|
||||
$lang['delete_unsuccessful'] = "Unable to delete user";
|
||||
|
||||
/* End of file auth_lang.php */
|
||||
/* Location: ./application/language/english/auth_lang.php */
|
||||
@@ -1,48 +1,66 @@
|
||||
<?php defined('BASEPATH') || exit("No direct script access allowed");
|
||||
<?php defined('BASEPATH') || exit('No direct script access allowed');
|
||||
/*
|
||||
* Copyright (c) 2011 Karsten Heiken, Eike Foken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Simple auth system.
|
||||
*
|
||||
* @package ScattPort
|
||||
* @author Eike Foken <kontakt@eikefoken.de>
|
||||
*/
|
||||
class Access {
|
||||
|
||||
/**
|
||||
* Contains the CI instance.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $ci;
|
||||
private $CI;
|
||||
|
||||
/**
|
||||
* Contains occured messages (using the language file).
|
||||
* Contains cached stuff.
|
||||
*
|
||||
* @var string
|
||||
* @var array
|
||||
*/
|
||||
protected $messages = array();
|
||||
|
||||
/**
|
||||
* Contains occured errors (using the language file).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $errors = array();
|
||||
private $cache = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->ci =& get_instance();
|
||||
$this->ci->load->config('auth', true);
|
||||
$this->ci->load->library('email');
|
||||
$this->ci->lang->load('auth');
|
||||
$this->ci->load->model('user');
|
||||
$this->ci->load->model('group');
|
||||
$this->ci->load->helper('cookie');
|
||||
$this->CI =& get_instance();
|
||||
$this->CI->load->config('auth', true);
|
||||
$this->CI->load->library('email');
|
||||
$this->CI->load->model('user');
|
||||
$this->CI->load->model('group');
|
||||
$this->CI->load->helper('cookie');
|
||||
|
||||
// auto-login the user if they are remembered
|
||||
if (!$this->loggedIn() && get_cookie('username') && get_cookie('remember_code')) {
|
||||
$this->ci->access = $this;
|
||||
$this->ci->user->loginRememberedUser();
|
||||
if (!$this->isloggedIn() && get_cookie('username') && get_cookie('remember_code')) {
|
||||
$this->CI->access = $this;
|
||||
$this->CI->user->loginRememberedUser();
|
||||
}
|
||||
|
||||
log_message('debug', "Access Class Initialized");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,12 +72,12 @@ class Access {
|
||||
* @return boolean
|
||||
*/
|
||||
public function changePassword($username, $old, $new) {
|
||||
if ($this->ci->user->changePassword($username, $old, $new)) {
|
||||
$this->ci->messages->add(_('Password successfully changed'), 'success');
|
||||
if ($this->CI->user->changePassword($username, $old, $new)) {
|
||||
$this->CI->messages->add(_('Password successfully changed'), 'success');
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->ci->messages->add(_('Unable to change password'), 'error');
|
||||
$this->CI->messages->add(_('Unable to change password'), 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -70,34 +88,34 @@ class Access {
|
||||
* @return void
|
||||
*/
|
||||
public function forgottenPassword($email) {
|
||||
if ($this->ci->user->forgottenPassword($email)) {
|
||||
if ($this->CI->user->forgottenPassword($email)) {
|
||||
// get user information
|
||||
$user = $this->ci->user->getUserByEmail($email);
|
||||
$user = $this->CI->user->getUserByEmail($email);
|
||||
|
||||
$data = array(
|
||||
'username' => $user['username'],
|
||||
'forgotten_password_code' => $user['forgotten_password_code'],
|
||||
);
|
||||
|
||||
$message = $this->ci->load->view('auth/email/forgot_password', $data, true);
|
||||
$this->ci->email->clear();
|
||||
$config['mailtype'] = $this->ci->config->item('email_type', 'auth');
|
||||
$this->ci->email->initialize($config);
|
||||
$this->ci->email->set_newline("\r\n");
|
||||
$this->ci->email->from($this->ci->config->item('admin_email', 'auth'), 'Scattport');
|
||||
$this->ci->email->to($user['email']);
|
||||
$this->ci->email->subject('ScattPort - Forgotten Password Verification');
|
||||
$this->ci->email->message($message);
|
||||
$message = $this->CI->load->view('auth/email/forgot_password', $data, true);
|
||||
$this->CI->email->clear();
|
||||
$config['mailtype'] = $this->CI->config->item('email_type', 'auth');
|
||||
$this->CI->email->initialize($config);
|
||||
$this->CI->email->set_newline("\r\n");
|
||||
$this->CI->email->from($this->CI->config->item('admin_email', 'auth'), 'Scattport');
|
||||
$this->CI->email->to($user['email']);
|
||||
$this->CI->email->subject('ScattPort - Forgotten Password Verification');
|
||||
$this->CI->email->message($message);
|
||||
|
||||
if ($this->ci->email->send()) {
|
||||
$this->ci->messages->add(_('Password reset email sent'), 'success');
|
||||
if ($this->CI->email->send()) {
|
||||
$this->CI->messages->add(_('Password reset email sent'), 'success');
|
||||
return true;
|
||||
} else {
|
||||
$this->ci->messages->add(_('Unable to send password reset email'), 'error');
|
||||
$this->CI->messages->add(_('Unable to send password reset email'), 'error');
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$this->ci->messages->add(_('This email address is not registered'), 'error');
|
||||
$this->CI->messages->add(_('This email address is not registered'), 'error');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -109,14 +127,14 @@ class Access {
|
||||
* @return void
|
||||
*/
|
||||
public function forgottenPasswordComplete($code) {
|
||||
$profile = $this->ci->user->profile($code, true); // pass the code to profile
|
||||
$profile = $this->CI->user->profile($code, true); // pass the code to profile
|
||||
|
||||
if (!is_object($profile)) {
|
||||
$this->ci->messages->add(_('Unable to change password'), 'error');
|
||||
$this->CI->messages->add(_('Unable to change password'), 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
$new_password = $this->ci->user->forgottenPasswordComplete($code, $profile->salt);
|
||||
$new_password = $this->CI->user->forgottenPasswordComplete($code, $profile->salt);
|
||||
|
||||
if ($new_password) {
|
||||
$data = array(
|
||||
@@ -124,27 +142,27 @@ class Access {
|
||||
'new_password' => $new_password
|
||||
);
|
||||
|
||||
$message = $this->ci->load->view('auth/email/forgot_password_complete', $data, true);
|
||||
$message = $this->CI->load->view('auth/email/forgot_password_complete', $data, true);
|
||||
|
||||
$this->ci->email->clear();
|
||||
$config['mailtype'] = $this->ci->config->item('email_type', 'auth');
|
||||
$this->ci->email->initialize($config);
|
||||
$this->ci->email->set_newline("\r\n");
|
||||
$this->ci->email->from($this->ci->config->item('admin_email', 'auth'), $this->ci->config->item('site_title', 'auth'));
|
||||
$this->ci->email->to($profile->email);
|
||||
$this->ci->email->subject('ScattPort - New Password');
|
||||
$this->ci->email->message($message);
|
||||
$this->CI->email->clear();
|
||||
$config['mailtype'] = $this->CI->config->item('email_type', 'auth');
|
||||
$this->CI->email->initialize($config);
|
||||
$this->CI->email->set_newline("\r\n");
|
||||
$this->CI->email->from($this->CI->config->item('admin_email', 'auth'), $this->CI->config->item('site_title', 'auth'));
|
||||
$this->CI->email->to($profile->email);
|
||||
$this->CI->email->subject('ScattPort - New Password');
|
||||
$this->CI->email->message($message);
|
||||
|
||||
if ($this->ci->email->send()) {
|
||||
$this->ci->messages->add(_('Password successfully changed'), 'success');
|
||||
if ($this->CI->email->send()) {
|
||||
$this->CI->messages->add(_('Password successfully changed'), 'success');
|
||||
return true;
|
||||
} else {
|
||||
$this->ci->messages->add(_('Unable to change password'), 'error');
|
||||
$this->CI->messages->add(_('Unable to change password'), 'error');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->ci->messages->add(_('Unable to change password'), 'error');
|
||||
$this->CI->messages->add(_('Unable to change password'), 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -157,10 +175,10 @@ class Access {
|
||||
* @return boolean
|
||||
*/
|
||||
public function login($username, $password, $remember = false) {
|
||||
if ($this->ci->user->login($username, $password, $remember)) {
|
||||
if ($this->CI->user->login($username, $password, $remember)) {
|
||||
return true;
|
||||
} else {
|
||||
$this->ci->messages->add(_('Incorrect username or password'), 'error');
|
||||
$this->CI->messages->add(_('Incorrect username or password'), 'error');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -171,9 +189,9 @@ class Access {
|
||||
* @return boolean
|
||||
*/
|
||||
public function logout() {
|
||||
$this->ci->session->unset_userdata('username');
|
||||
$this->ci->session->unset_userdata('group');
|
||||
$this->ci->session->unset_userdata('user_id');
|
||||
$this->CI->session->unset_userdata('username');
|
||||
$this->CI->session->unset_userdata('group');
|
||||
$this->CI->session->unset_userdata('user_id');
|
||||
|
||||
// delete the remember cookies if they exist
|
||||
if (get_cookie('username')) {
|
||||
@@ -182,20 +200,29 @@ class Access {
|
||||
delete_cookie('remember_code');
|
||||
}
|
||||
|
||||
$this->ci->session->sess_destroy();
|
||||
$this->ci->session->sess_create();
|
||||
$this->CI->session->sess_destroy();
|
||||
$this->CI->session->sess_create();
|
||||
|
||||
$this->ci->messages->add(_('Logged out successfully'), 'success');
|
||||
$this->CI->messages->add(_('Logged out successfully'), 'success');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kept for backwards compatibility.
|
||||
*
|
||||
* @see Access::isLoggedIn()
|
||||
*/
|
||||
public function loggedIn() {
|
||||
return $this->isLoggedIn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the user is logged in.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function loggedIn() {
|
||||
return (boolean) $this->ci->session->userdata('username');
|
||||
public function isLoggedIn() {
|
||||
return (boolean) $this->CI->session->userdata('username');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,18 +232,18 @@ class Access {
|
||||
*/
|
||||
public function isAdmin() {
|
||||
$adminGroup = 'admins';
|
||||
$userGroup = $this->ci->session->userdata('group');
|
||||
$userGroup = $this->CI->session->userdata('group');
|
||||
return $userGroup == $adminGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current user is assigned to the specified group.
|
||||
* Checks if the current user is assigned to the speCIfied group.
|
||||
*
|
||||
* @param string $checkGroup
|
||||
* @return boolean
|
||||
*/
|
||||
public function isGroup($checkGroup) {
|
||||
$userGroup = $this->ci->session->userdata('group');
|
||||
$userGroup = $this->CI->session->userdata('group');
|
||||
|
||||
if (is_array($checkGroup)) {
|
||||
return in_array($userGroup, $checkGroup);
|
||||
@@ -230,7 +257,7 @@ class Access {
|
||||
* @return object
|
||||
*/
|
||||
public function getCurrentUser() {
|
||||
return $this->ci->user->getUserByID($this->ci->session->userdata('user_id'));
|
||||
return $this->CI->user->getUserByID($this->CI->session->userdata('user_id'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -239,7 +266,10 @@ class Access {
|
||||
* @return array
|
||||
*/
|
||||
public function profile() {
|
||||
return $this->ci->user->profile($this->ci->session->userdata('username'));
|
||||
if (!isset($this->cache['profile']->username)) {
|
||||
$this->cache['profile'] = $this->CI->user->profile($this->CI->session->userdata('username'));
|
||||
}
|
||||
return $this->cache['profile'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,30 @@
|
||||
<?php defined('BASEPATH') || exit('No direct script access allowed');
|
||||
/*
|
||||
* Copyright (c) 2011 Karsten Heiken, Eike Foken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Simple library to manage assets.
|
||||
*
|
||||
* @package ScattPort
|
||||
* @author Eike Foken <kontakt@eikefoken.de>
|
||||
*/
|
||||
class Assets {
|
||||
@@ -12,6 +35,11 @@ class Assets {
|
||||
private $css = array();
|
||||
private $javascript = array();
|
||||
|
||||
/**
|
||||
* Contains the CI instance.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
private $CI;
|
||||
|
||||
/**
|
||||
@@ -44,6 +72,7 @@ class Assets {
|
||||
* @param string $type
|
||||
* @param string $filename
|
||||
* @param mixed $attributes
|
||||
* @return string
|
||||
*/
|
||||
public function load($type, $filename, $attributes = '') {
|
||||
// validate type parameter
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php defined('BASEPATH') || exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Data Mapper Class
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php defined('BASEPATH') || exit("No direct script access allowed");
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eike Foken <kontakt@eikefoken.de>
|
||||
*/
|
||||
class Job {
|
||||
|
||||
private $CI;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->CI =& get_instance();
|
||||
|
||||
// load models
|
||||
$this->CI->load->model('program');
|
||||
$this->CI->load->model('experiment');
|
||||
|
||||
log_message('debug', "Job Class Initialized");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $experimentId
|
||||
* @return boolean Returns TRUE on success.
|
||||
*/
|
||||
public function createConfigs($experimentId) {
|
||||
$experiment = $this->CI->experiment->getById($experimentId);
|
||||
$path = FCPATH . 'uploads/' . $experiment['project_id'] . '/' . $experiment['id'] . '/';
|
||||
|
||||
$program = $this->CI->program->getById($experiment['program_id']);
|
||||
|
||||
$handler = fopen($path . 'default.calc', "w");
|
||||
|
||||
$parameters = $this->CI->experiment->getParameters($experimentId);
|
||||
foreach ($parameters as $param) {
|
||||
$line = str_replace("{type}", $param['type'], $program['input_line']);
|
||||
$line = str_replace("{param}", $param['name'], $line);
|
||||
$line = str_replace("{value}", $param['value'], $line);
|
||||
fwrite($handler, $line);
|
||||
}
|
||||
fclose($handler);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php defined('BASEPATH') || exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Jsmin.php - PHP implementation of Douglas Crockford's JSMin.
|
||||
*
|
||||
@@ -36,7 +37,7 @@
|
||||
* SOFTWARE.
|
||||
* --
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @package ScattPort
|
||||
* @author Ryan Grove <ryan@wonko.com>
|
||||
* @copyright 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)
|
||||
* @copyright 2008 Ryan Grove <ryan@wonko.com> (PHP port)
|
||||
|
||||
@@ -1,11 +1,53 @@
|
||||
<?php defined('BASEPATH') || exit("No direct script access allowed");
|
||||
<?php defined('BASEPATH') || exit('No direct script access allowed');
|
||||
/*
|
||||
* Copyright (c) 2011 Karsten Heiken, Eike Foken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Language detection library.
|
||||
*
|
||||
* @package ScattPort
|
||||
* @author Eike Foken <kontakt@eikefoken.de>
|
||||
*/
|
||||
class Lang_detect {
|
||||
|
||||
/**
|
||||
* Contains the CI instance.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
private $CI;
|
||||
|
||||
/**
|
||||
* Contains all supported languages.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $supportedLanguages = array();
|
||||
|
||||
/**
|
||||
* Contains the detected language.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $language = '';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
<?php defined('BASEPATH') || exit("No direct script access allowed");
|
||||
<?php defined('BASEPATH') || exit('No direct script access allowed');
|
||||
/*
|
||||
* Copyright (c) 2011 Karsten Heiken, Eike Foken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Extends CI's form validation class.
|
||||
@@ -13,6 +34,7 @@
|
||||
* file_image_mindim[x,y]
|
||||
* file_image_maxdim[x,y]
|
||||
*
|
||||
* @package ScattPort
|
||||
* @author Eike Foken <kontakt@eikefoken.de>
|
||||
*/
|
||||
class MY_Form_validation extends CI_Form_validation {
|
||||
|
||||
@@ -1,8 +1,30 @@
|
||||
<?php defined('BASEPATH') || exit("No direct script access allowed");
|
||||
<?php defined('BASEPATH') || exit('No direct script access allowed');
|
||||
/*
|
||||
* Copyright (c) 2011 Karsten Heiken, Eike Foken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Extends CI's session class.
|
||||
*
|
||||
* @package ScattPort
|
||||
* @author Eike Foken
|
||||
*/
|
||||
class MY_Session extends CI_Session {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Message:: a class for writing feedback message information to the session
|
||||
* Messages.php - A class for writing feedback message information to the session
|
||||
*
|
||||
* Copyright 2006 Vijay Mahrra & Sheikh Ahmed <webmaster@designbyfail.com>
|
||||
* Copyright (c) 2006 Vijay Mahrra & Sheikh Ahmed <webmaster@designbyfail.com>
|
||||
*
|
||||
* See the enclosed file COPYING for license information (LGPL). If you
|
||||
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
|
||||
*
|
||||
* @package ScattPort
|
||||
* @author Vijay Mahrra & Sheikh Ahmed <webmaster@designbyfail.com>
|
||||
* @author Eike Foken <kontakt@eikefoken>
|
||||
* @link http://www.designbyfail.com/
|
||||
@@ -15,8 +16,19 @@
|
||||
*/
|
||||
class Messages {
|
||||
|
||||
var $_ci;
|
||||
var $_types = array('success', 'error', 'notice');
|
||||
/**
|
||||
* Contains the CI instance.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
private $CI;
|
||||
|
||||
/**
|
||||
* Contains the available message types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $types = array('success', 'error', 'notice');
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -24,10 +36,10 @@ class Messages {
|
||||
* @param array $params
|
||||
*/
|
||||
public function __construct($params = array()) {
|
||||
$this->_ci =& get_instance();
|
||||
$this->_ci->load->library('session');
|
||||
$this->CI =& get_instance();
|
||||
$this->CI->load->library('session');
|
||||
// check if theres already messages, if not, initialise the messages array in the session
|
||||
$messages = $this->_ci->session->userdata('messages');
|
||||
$messages = $this->CI->session->userdata('messages');
|
||||
if (empty($messages)) {
|
||||
$this->clear();
|
||||
}
|
||||
@@ -38,22 +50,22 @@ class Messages {
|
||||
*/
|
||||
public function clear() {
|
||||
$messages = array();
|
||||
foreach ($this->_types as $type) {
|
||||
foreach ($this->types as $type) {
|
||||
$messages[$type] = array();
|
||||
}
|
||||
$this->_ci->session->set_userdata('messages', $messages);
|
||||
$this->CI->session->set_userdata('messages', $messages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a message (default type is 'notice').
|
||||
*/
|
||||
public function add($message, $type = 'notice') {
|
||||
$messages = $this->_ci->session->userdata('messages');
|
||||
$messages = $this->CI->session->userdata('messages');
|
||||
// handle PEAR errors gracefully
|
||||
if (is_a($message, 'PEAR_Error')) {
|
||||
$message = $message->getMessage();
|
||||
$type = 'error';
|
||||
} else if (!in_array($type, $this->_types)) {
|
||||
} else if (!in_array($type, $this->types)) {
|
||||
// set the type to message if the user specified a type that's unknown
|
||||
$type = 'notice';
|
||||
}
|
||||
@@ -61,7 +73,7 @@ class Messages {
|
||||
if (!in_array($message, $messages[$type]) && is_string($message)) {
|
||||
$messages[$type][] = $message;
|
||||
}
|
||||
$messages = $this->_ci->session->set_userdata('messages', $messages);
|
||||
$messages = $this->CI->session->set_userdata('messages', $messages);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,13 +83,13 @@ class Messages {
|
||||
* @return boolean|integer
|
||||
*/
|
||||
public function sum($type = null) {
|
||||
$messages = $this->_ci->session->userdata('messages');
|
||||
$messages = $this->CI->session->userdata('messages');
|
||||
if (!empty($type)) {
|
||||
$i = count($messages[$type]);
|
||||
return $i;
|
||||
}
|
||||
$i = 0;
|
||||
foreach ($this->_types as $type) {
|
||||
foreach ($this->types as $type) {
|
||||
$i += count($messages[$type]);
|
||||
}
|
||||
return $i > 0 ? $i : false;
|
||||
@@ -90,7 +102,7 @@ class Messages {
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($type = null) {
|
||||
$messages = $this->_ci->session->userdata('messages');
|
||||
$messages = $this->CI->session->userdata('messages');
|
||||
if (!empty($type)) {
|
||||
if (count($messages[$type]) == 0) {
|
||||
return false;
|
||||
@@ -99,7 +111,7 @@ class Messages {
|
||||
}
|
||||
// return false if there actually are no messages in the session
|
||||
$i = 0;
|
||||
foreach ($this->_types as $type) {
|
||||
foreach ($this->types as $type) {
|
||||
$i += count($messages[$type]);
|
||||
}
|
||||
if ($i == 0) {
|
||||
@@ -108,7 +120,7 @@ class Messages {
|
||||
|
||||
// order return by order of type array above
|
||||
// i.e. success, error, warning and then informational messages last
|
||||
foreach ($this->_types as $type) {
|
||||
foreach ($this->types as $type) {
|
||||
$return[$type] = $messages[$type];
|
||||
}
|
||||
$this->clear();
|
||||
|
||||
@@ -1,7 +1,38 @@
|
||||
<?php
|
||||
<?php defined('BASEPATH') || exit('No direct script access allowed');
|
||||
/*
|
||||
* Copyright (c) 2011 Karsten Heiken, Eike Foken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package ScattPort
|
||||
* @author Eike Foken <kontakt@eikefoken.de>
|
||||
*/
|
||||
class Program_runner {
|
||||
|
||||
/**
|
||||
* Constains the CI instance.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
private $CI;
|
||||
|
||||
/**
|
||||
@@ -44,3 +75,6 @@ class Program_runner {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* End of file Program_runner.php */
|
||||
/* Location: ./application/libraries/Program_runner.php */
|
||||
|
||||
@@ -233,10 +233,7 @@ class User extends CI_Model {
|
||||
*/
|
||||
public function profile($username = '', $isCode = false) {
|
||||
if (empty($username)) {
|
||||
@$username = $this->session->userdata('username');
|
||||
if (empty($username)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->db->select('users.*, groups.name AS `group`, groups.description AS `group_description`');
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="menu"><?=_('Hello,');?> <a href="<?=site_url('users/profile/' . $this->user->profile()->username);?>"><?=$this->user->profile()->firstname;?> <?=$this->user->profile()->lastname;?></a>! | <?=lang_select('assets/images');?> | <a href="#"><?=_('Help');?></a> | <?=anchor('auth/settings', _('Settings'));?> | <?=anchor('auth/logout', _('Logout'));?></div>
|
||||
<div class="menu"><?=_('Hello,');?> <a href="<?=site_url('users/profile/' . $this->access->profile()->username);?>"><?=$this->access->profile()->firstname;?> <?=$this->access->profile()->lastname;?></a>! | <?=lang_select('assets/images');?> | <a href="#"><?=_('Help');?></a> | <?=anchor('auth/settings', _('Settings'));?> | <?=anchor('auth/logout', _('Logout'));?></div>
|
||||
</div>
|
||||
|
||||
<div id="wrapper">
|
||||
|
||||
Reference in New Issue
Block a user