本文整理汇总了PHP中uploader::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP uploader::__construct方法的具体用法?PHP uploader::__construct怎么用?PHP uploader::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uploader
的用法示例。
在下文中一共展示了uploader::__construct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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: __construct
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: __construct
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: __construct
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'];
}
}