first commit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
class Smedia extends CI_Controller {
|
||||
|
||||
public function index() {
|
||||
$this->serve_file('');
|
||||
}
|
||||
|
||||
private function serve_file($filename) {
|
||||
if ($filename=='' || !file_exists($filename)) {
|
||||
$filename = 'assets/images/accessdenied.png';
|
||||
}
|
||||
// Any additional path checks should go here
|
||||
// TODO: realpath check to /opt/wrenchboard
|
||||
header('Content-type: ' . mime_content_type($filename));
|
||||
readfile($filename);
|
||||
}
|
||||
|
||||
public function DEFAULTS() {
|
||||
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
||||
$this->serve_file('');
|
||||
return;
|
||||
}
|
||||
//var_dump($_SERVER);
|
||||
$filename = str_replace("/smedia/","/opt/wrenchboard/",$_SERVER["SCRIPT_URL"]);
|
||||
//echo $filename;
|
||||
$this->serve_file($filename);
|
||||
}
|
||||
|
||||
public function LIVE() {
|
||||
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
||||
$this->serve_file('');
|
||||
return;
|
||||
}
|
||||
$filename = str_replace("/smedia/","/opt/wrenchboard/",$_SERVER["SCRIPT_URL"]);
|
||||
$this->serve_file($filename);
|
||||
}
|
||||
|
||||
public function media() {
|
||||
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
||||
$this->serve_file('');
|
||||
return;
|
||||
}
|
||||
$filename = str_replace("/smedia/","/opt/wrenchboard/",$_SERVER["SCRIPT_URL"]);
|
||||
$this->serve_file($filename);
|
||||
}
|
||||
|
||||
public function TEST() {
|
||||
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
||||
$this->serve_file('');
|
||||
return;
|
||||
}
|
||||
$filename = str_replace("/smedia/","/opt/wrenchboard/",$_SERVER["SCRIPT_URL"]);
|
||||
$this->serve_file($filename);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user