summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xssn.at>2010-06-12 12:41:54 +0200
committerFlorian Pritz <bluewind@xssn.at>2010-06-12 12:41:54 +0200
commite601f848718b576d4f2aabfb8e14e4b9ca35e5a0 (patch)
treeb7a9825715c7fbec1dbaa7c870228108f73998be
parent39a760b1266e43175ad271da39898659df0231e4 (diff)
add support for client update warnings
Signed-off-by: Florian Pritz <bluewind@xssn.at>
-rw-r--r--system/application/controllers/file.php13
-rw-r--r--system/application/models/file_mod.php2
2 files changed, 14 insertions, 1 deletions
diff --git a/system/application/controllers/file.php b/system/application/controllers/file.php
index 09dcace68..d772a3478 100644
--- a/system/application/controllers/file.php
+++ b/system/application/controllers/file.php
@@ -15,6 +15,19 @@ class File extends Controller {
parent::Controller();
$this->load->helper('form');
$this->load->model('file_mod');
+ $this->var->cli_client = false;
+ $this->file_mod->var->cli_client =& $this->var->cli_client;
+
+ if (strpos($_SERVER['HTTP_USER_AGENT'], 'fb-client') !== false) {
+ $latest_client = trim(file_get_contents(FCPATH.'data/client/latest'));
+ $client_version = substr($_SERVER['HTTP_USER_AGENT'], 10);
+ if ($latest_client != $client_version) {
+ echo "Your are using an old client version. Latest is $latest_client.\n";
+ }
+ $this->var->cli_client = "fb-client";
+ } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'libcurl') !== false) {
+ $this->var->cli_client = "curl";
+ }
}
function index()
diff --git a/system/application/models/file_mod.php b/system/application/models/file_mod.php
index 0541d5d2b..faa9740dd 100644
--- a/system/application/models/file_mod.php
+++ b/system/application/models/file_mod.php
@@ -104,7 +104,7 @@ class File_mod extends Model {
$data['url'] = site_url($id).'/';
}
- if (strstr($_SERVER['HTTP_USER_AGENT'], 'libcurl')) {
+ if ($this->var->cli_client) {
echo $data['url']."\n";
} else {
$this->load->view('file/header', $data);