__construct() public method

Create a new instance of the uploader
public __construct ( $destination, $extensions = [] )
コード例 #1
0
ファイル: browser.php プロジェクト: unisexx/adf16
 public function __construct()
 {
     parent::__construct();
     if (isset($this->post['dir'])) {
         $dir = $this->checkInputDir($this->post['dir'], true, false);
         if ($dir === false) {
             unset($this->post['dir']);
         }
         $this->post['dir'] = $dir;
     }
     if (isset($this->get['dir'])) {
         $dir = $this->checkInputDir($this->get['dir'], true, false);
         if ($dir === false) {
             unset($this->get['dir']);
         }
         $this->get['dir'] = $dir;
     }
     $thumbsDir = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'];
     if (!is_dir($thumbsDir) && !@mkdir($thumbsDir, $this->config['dirPerms']) || !is_readable($thumbsDir) || !dir::isWritable($thumbsDir) || !is_dir("{$thumbsDir}/{$this->type}") && !@mkdir("{$thumbsDir}/{$this->type}", $this->config['dirPerms'])) {
         $this->errorMsg("Cannot access or create thumbnails folder.");
     }
     $this->thumbsDir = $thumbsDir;
     $this->thumbsTypeDir = "{$thumbsDir}/{$this->type}";
     // Remove temporary zip downloads if exists
     $files = dir::content($this->config['uploadDir'], array('types' => "file", 'pattern' => '/^.*\\.zip$/i'));
     if (is_array($files) && count($files)) {
         $time = time();
         foreach ($files as $file) {
             if (is_file($file) && $time - filemtime($file) > 3600) {
                 unlink($file);
             }
         }
     }
 }
コード例 #2
0
ファイル: browser.php プロジェクト: ahmatjan/xinxintong
 public function __construct()
 {
     parent::__construct();
     if (isset($this->post['dir'])) {
         $dir = $this->checkInputDir($this->post['dir'], true, false);
         if ($dir === false) {
             unset($this->post['dir']);
         }
         $this->post['dir'] = $dir;
     }
     if (isset($this->get['dir'])) {
         $dir = $this->checkInputDir($this->get['dir'], true, false);
         if ($dir === false) {
             unset($this->get['dir']);
         }
         $this->get['dir'] = $dir;
     }
     $thumbsDir = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'];
     $this->initThumbsDir($thumbsDir);
     $this->thumbsDir = $thumbsDir;
     $this->thumbsTypeDir = "{$thumbsDir}/{$this->type}";
     // Remove temporary zip downloads if exists
     $files = dir::content($this->config['uploadDir'], array('types' => "file", 'pattern' => '/^.*\\.zip$/i'));
     if (is_array($files) && count($files)) {
         $time = time();
         foreach ($files as $file) {
             if (is_file($file) && $time - filemtime($file) > 3600) {
                 unlink($file);
             }
         }
     }
     if (isset($this->get['theme']) && $this->get['theme'] == $this->my_basename($this->get['theme']) && is_dir("themes/{$this->get['theme']}")) {
         $this->config['theme'] = $this->get['theme'];
     }
 }
コード例 #3
0
ファイル: class_browser.php プロジェクト: EnkelMagnus/m2
 public function __construct()
 {
     parent::__construct();
     $gpc = new gpc();
     $this->get =& $gpc->get;
     $this->post =& $gpc->post;
     $this->cookie =& $gpc->cookie;
     if (isset($this->config['_sessionVar'])) {
         $this->config['_sessionVar']['browser'] = array();
         $this->session =& $this->config['_sessionVar']['browser'];
     } else {
         $this->session =& $_SESSION;
     }
     if (isset($this->post['dir'])) {
         if (substr($this->post['dir'], 0, 1) == "/") {
             $this->post['dir'] = substr($this->post['dir'], 1);
         }
         $this->post['dir'] = helper::normalize_path($this->post['dir']);
         if (!$this->checkDir($this->post['dir'], false)) {
             $this->backMsg($this->label("Unknown error."));
         }
         $parts = explode("/", $this->post['dir']);
         if (isset($this->types[$parts[0]]) && $this->type != $parts[0]) {
             $this->type = $parts[0];
         }
     } elseif (isset($this->get['dir'])) {
         if (substr($this->get['dir'], 0, 1) == "/") {
             $this->get['dir'] = substr($this->get['dir'], 1);
         }
         $this->get['dir'] = helper::normalize_path($this->get['dir']);
         if (!$this->checkDir($this->get['dir'], false)) {
             $this->backMsg($this->label("Unknown error."));
         }
         $parts = explode("/", $this->get['dir']);
         if (isset($this->types[$parts[0]]) && $this->type != $parts[0]) {
             $this->type = $parts[0];
         }
     }
     $this->config['uploadDir'] = dirname($this->config['uploadDir']) . "/" . $this->type;
     $this->config['uploadURL'] = dirname($this->config['uploadURL']) . "/" . $this->type;
     $thumbsDir = dirname($this->config['uploadDir']) . "/" . $this->config['thumbsDir'];
     if (!is_dir($thumbsDir) && !@mkdir($thumbsDir, $this->config['dirPerms']) || !is_readable($thumbsDir) || !is_writable($thumbsDir)) {
         $this->backMsg($this->label("Cannot access or create thumbnails folder."));
     }
     $thumbsDir .= "/" . $this->type;
     if (!is_dir($thumbsDir)) {
         mkdir($thumbsDir, $this->config['dirPerms']);
     }
 }
コード例 #4
0
ファイル: browser.php プロジェクト: prodevnz/kcfinder
 public function __construct()
 {
     parent::__construct();
     // SECURITY CHECK INPUT DIRECTORY
     if (isset($_REQUEST['dir'])) {
         $dir = $this->checkInputDir($_REQUEST['dir'], true, false);
         if ($dir === false) {
             unset($_REQUEST['dir']);
         }
         // Support the POST.dir
         if (isset($_POST['dir'])) {
             $_POST['dir'] = $dir;
         }
         // Support the GET.dir
         if (isset($_GET['dir'])) {
             $_GET['dir'] = $dir;
         }
         // Support the REQUEST.dir
         if (isset($_REQUEST['dir'])) {
             $_REQUEST['dir'] = $dir;
         }
     }
     $thumbsDir = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'];
     if (!$this->config['disabled'] && (!is_dir($thumbsDir) && !@mkdir($thumbsDir, $this->config['dirPerms']) || !is_readable($thumbsDir) || !dir::isWritable($thumbsDir) || !is_dir("{$thumbsDir}/{$this->type}") && !@mkdir("{$thumbsDir}/{$this->type}", $this->config['dirPerms']))) {
         $this->errorMsg("Cannot access or create thumbnails folder.");
     }
     $this->thumbsDir = $thumbsDir;
     $this->thumbsTypeDir = "{$thumbsDir}/{$this->type}";
     // Remove temporary zip downloads if exists
     if (!$this->config['disabled']) {
         $files = dir::content($this->config['uploadDir'], array('types' => "file", 'pattern' => '/^.*\\.zip$/i'));
         if (is_array($files) && count($files)) {
             $time = time();
             foreach ($files as $file) {
                 if (is_file($file) && $time - filemtime($file) > 3600) {
                     unlink($file);
                 }
             }
         }
     }
     if (isset($_GET['theme']) && $this->checkFilename($_GET['theme']) && is_dir("themes/{$_GET['theme']}")) {
         $this->config['theme'] = $_GET['theme'];
     }
 }