summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2013-08-22 18:08:48 +0200
committerFlorian Pritz <bluewind@xinu.at>2013-08-22 18:15:50 +0200
commitd87e4e2881d4cfa17dfd0445fae1fa881d5707c0 (patch)
tree55a93216930b43242fc5b513fc12e45c8bb580e8 /application/controllers
parent203f824ae5a9ec4a979542f4eb9e09fcb07cb36c (diff)
Deduplicate initialisation code in controllers
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/file.php20
-rw-r--r--application/controllers/user.php18
2 files changed, 4 insertions, 34 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index e8bb5896f..25e283e4b 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -7,27 +7,12 @@
*
*/
-class File extends CI_Controller {
-
- public $data = array();
- public $var;
+class File extends MY_Controller {
function __construct()
{
parent::__construct();
- $this->var = new StdClass();
-
- $this->load->library('migration');
- if ( ! $this->migration->current()) {
- show_error($this->migration->error_string());
- }
-
- $old_path = getenv("PATH");
- putenv("PATH=$old_path:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin");
-
- mb_internal_encoding('UTF-8');
- $this->load->helper(array('form', 'filebin'));
$this->load->model('mfile');
$this->load->model('muser');
@@ -36,9 +21,6 @@ class File extends CI_Controller {
} else {
$this->var->view_dir = "file";
}
-
- $this->data['username'] = $this->muser->get_username();
- $this->data['title'] = "FileBin";
}
function index()
diff --git a/application/controllers/user.php b/application/controllers/user.php
index 27e027ac7..37c84b1ed 100644
--- a/application/controllers/user.php
+++ b/application/controllers/user.php
@@ -7,29 +7,15 @@
*
*/
-class User extends CI_Controller {
-
- public $data = array();
- public $var;
+class User extends MY_Controller {
function __construct()
{
parent::__construct();
- $this->var = new StdClass();
-
- $this->load->library('migration');
- if ( ! $this->migration->current()) {
- show_error($this->migration->error_string());
- }
-
$this->load->model("muser");
- $this->data["title"] = "FileBin";
-
- $this->load->helper(array('form', 'filebin'));
$this->var->view_dir = "user/";
- $this->data['username'] = $this->muser->get_username();
}
function index()
@@ -293,6 +279,8 @@ class User extends CI_Controller {
// This simply queries the username
function _reset_password_username_form()
{
+ $this->data['username'] = $this->muser->get_username();
+
$this->load->view('header', $this->data);
$this->load->view($this->var->view_dir.'reset_password_username_form', $this->data);
$this->load->view('footer', $this->data);