From ac6d834e2b4f02d656e38fe300b5c6404d1f75e6 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 17 May 2012 21:36:32 +0200 Subject: improve is_cli_client() and use everywhere Signed-off-by: Florian Pritz --- application/controllers/file.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'application/controllers/file.php') diff --git a/application/controllers/file.php b/application/controllers/file.php index 1ac3a79c9..b8306b5bc 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -31,16 +31,13 @@ class File extends CI_Controller { $this->load->model('file_mod'); $this->load->model('muser'); - $this->var->cli_client = false; - $this->file_mod->var->cli_client =& $this->var->cli_client; $this->var->latest_client = false; if (file_exists(FCPATH.'data/client/latest')) { $this->var->latest_client = trim(file_get_contents(FCPATH.'data/client/latest')); } - $this->var->cli_client = is_cli_client(); - if ($this->var->cli_client) { + if (is_cli_client()) { $this->var->view_dir = "file_plaintext"; } else { $this->var->view_dir = "file"; @@ -85,11 +82,11 @@ class File extends CI_Controller { $this->data['client_link_deb'] = base_url().'data/client/deb/'; $this->data['client_link_slackware'] = base_url().'data/client/slackware/'; - if (!$this->var->cli_client) { + if (is_cli_client()) { $this->load->view($this->var->view_dir.'/header', $this->data); } $this->load->view($this->var->view_dir.'/client', $this->data); - if (!$this->var->cli_client) { + if (is_cli_client()) { $this->load->view($this->var->view_dir.'/footer', $this->data); } } @@ -106,7 +103,7 @@ class File extends CI_Controller { $this->load->view($this->var->view_dir.'/header', $this->data); $this->load->view($this->var->view_dir.'/upload_form', $this->data); - if ($this->var->cli_client) { + if (is_cli_client()) { $this->client(); } $this->load->view($this->var->view_dir.'/footer', $this->data); @@ -155,7 +152,7 @@ class File extends CI_Controller { foreach($query as $key => $item) { $query[$key]["date"] = date("r", $item["date"]); $query[$key]["filesize"] = format_bytes($item["filesize"]); - if ($this->var->cli_client) { + if (is_cli_client()) { // Keep track of longest string to pad plaintext output correctly foreach($fields as $length_key => $value) { $len = mb_strlen($query[$key][$length_key]); @@ -226,7 +223,7 @@ class File extends CI_Controller { { $this->muser->require_access(); - if (!$this->var->cli_client) { + if (is_cli_client()) { echo "Not a listed cli client, please use the history to delete uploads.\n"; return; } -- cgit v1.2.3-24-g4f1b