コード例 #1
0
/**
 * Copy file in one directories to another
 *
 * @param string $source
 * @param string $path
 */
function _copydir($source, $path)
{
    if (is_dir($path) === false) {
        // echo 'Create: ', $path, PHP_EOL;
        _mkdir($path);
    }
    $d = new DirectoryIterator($source);
    foreach ($d as $node) {
        /*@var $node DirectoryIterator*/
        if ($node->isDot()) {
            continue;
        }
        if ($node->isDir() === true) {
            if ($node->getFilename() == '.svn') {
                continue;
            }
            _copydir($node->getPathname(), $path . DIRECTORY_SEPARATOR . $node->getFilename());
            continue;
        }
        if ($node->isFile() === true) {
            //echo 'Copy: ', $node->getPathname(), PHP_EOL;
            _copy($node->getPathname(), $path);
            continue;
        }
    }
}
コード例 #2
0
ファイル: checkimages.php プロジェクト: 4images/4images
function copyFile($src, $dest, $name, $cat_id = 0)
{
    if ($cat_id) {
        $dest .= "/" . $cat_id;
    }
    $result = true;
    if (!@is_dir($dest)) {
        $oldumask = umask(0);
        $result = _mkdir($dest, 0755);
        umask($oldumask);
    }
    if ($result) {
        return copy($src, $dest . "/" . $name);
    }
    return false;
}
コード例 #3
0
<?
コード例 #4
0
ファイル: general.inc.php プロジェクト: EDVLanger/phpwcms
function saveUploadedFile($file, $target, $exttype = '', $imgtype = '', $rename = 0, $maxsize = 0)
{
    // imgtype can be all exif_imagetype supported by your PHP install
    // see http://www.php.net/exif_imagetype
    $file_status = array('status' => false, 'error' => '', 'name' => '', 'tmp_name' => '', 'size' => 0, 'path' => '', 'ext' => '', 'rename' => '', 'maxsize' => intval($maxsize), 'error_num' => 0, 'type' => '');
    if (!isset($_FILES[$file]) || !is_uploaded_file($_FILES[$file]['tmp_name'])) {
        $file_status['error'] = 'Upload not defined';
        return $file_status;
    }
    $file_status['name'] = sanitize_filename($_FILES[$file]['name']);
    $file_status['ext'] = which_ext($file_status['name']);
    $file_status['tmp_name'] = $_FILES[$file]['tmp_name'];
    $file_status['size'] = $_FILES[$file]['size'];
    $file_status['type'] = empty($_FILES[$file]['type']) || !is_mimetype_format($_FILES[$file]['type']) ? get_mimetype_by_extension($file_status['ext']) : $_FILES[$file]['type'];
    $file_status['path'] = $target;
    $file_status['rename'] = $file_status['name'];
    $file_status['maxsize'] = empty($file_status['maxsize']) ? $GLOBALS['phpwcms']['file_maxsize'] : $file_status['maxsize'];
    if (intval($file_status['size']) > $file_status['maxsize']) {
        $file_status['error'] = 'File is too large';
        $file_status['error_num'] = 400;
        return $file_status;
    }
    if (empty($target)) {
        $file_status['error'] = 'Target directory not defined';
        $file_status['error_num'] = 412;
        return $file_status;
    }
    if (!@_mkdir($target)) {
        $file_status['error'] = 'The target directory "' . $target . '" can not be found or generated';
        $file_status['error_num'] = 412;
        return $file_status;
    }
    if ($_FILES[$file]['error']) {
        $file_status['error'] = $_FILES[$file]['error'];
        $file_status['error_num'] = 409;
        return $file_status;
    }
    if ($imgtype) {
        $imgtype = convertStringToArray(strtolower($imgtype));
        if (count($imgtype)) {
            $data = @getimagesize($_FILES[$file]['tmp_name']);
            $exif_imagetype = array(1 => 'gif', 2 => 'jpeg', 2 => 'jpg', 3 => 'png', 4 => 'swf', 5 => 'psd', 6 => 'bmp', 7 => 'tif', 8 => 'tiff', 9 => 'jpc', 10 => 'jp2', 11 => 'jpx', 12 => 'jb2', 13 => 'swc', 14 => 'iff', 15 => 'wbmp', 16 => 'xbm');
            if (!$data && !$exttype) {
                $file_status['error'] = 'Format' . ($file_status['ext'] ? ' *.' . $file_status['ext'] : '') . ' not supported (';
                $allowed = array();
                foreach ($imgtype as $value) {
                    $allowed[] = '*.' . $exif_imagetype[$value];
                }
                $file_status['error'] .= implode(', ', $allowed) . ')';
                $file_status['error_num'] = 415;
                @unlink($_FILES[$file]['tmp_name']);
                return $file_status;
            } elseif ($data) {
                if (empty($exif_imagetype[$data[2]]) || !in_array($data[2], $imgtype)) {
                    $file_status['error'] = 'File type ';
                    $file_status['error'] .= empty($exif_imagetype[$data[2]]) ? $data[2] : $exif_imagetype[$data[2]];
                    $file_status['error'] .= ' is not supported for this upload (';
                    foreach ($imgtype as $imgt) {
                        $file_status['error'] .= empty($exif_imagetype[$imgt]) ? $imgt : $exif_imagetype[$imgt];
                        $file_status['error'] .= ', ';
                    }
                    $file_status['error'] = trim(trim($file_status['error']), ',');
                    $file_status['error'] .= ' only)';
                    $file_status['error_num'] = 415;
                    @unlink($_FILES[$file]['tmp_name']);
                    return $file_status;
                }
                $file_status['image'] = $data;
                $exttype = '';
            }
        }
    }
    if ($exttype) {
        $exttype = convertStringToArray(strtolower($exttype));
        if (!in_array($file_status['ext'], $exttype)) {
            $file_status['error'] = 'File type *.' . $file_status['ext'] . ' is not supported for this upload (*.' . implode(', *.', $exttype) . ' only)';
            $file_status['error_num'] = 415;
            @unlink($_FILES[$file]['tmp_name']);
            return $file_status;
        }
    }
    if (!is_writable($target)) {
        $file_status['error'] = 'Target directory <b>' . str_replace(PHPWCMS_ROOT, '', $target) . '</b> is not writable';
        $file_status['error_num'] = 412;
        @unlink($_FILES[$file]['tmp_name']);
        return $file_status;
    }
    $rename = convertStringToArray($rename);
    if (count($rename)) {
        $_temp_name = cut_ext($file_status['rename']);
        foreach ($rename as $value) {
            switch ($value) {
                case 1:
                    $_temp_name = str_replace(array(':', '/', "\\", ' '), array('-', '-', '-', '_'), phpwcms_remove_accents($_temp_name));
                    $_temp_name = preg_replace('/[^0-9a-z_\\-\\.]/i', '', $_temp_name);
                    break;
                case 2:
                    $_temp_name = time() . '_' . $_temp_name;
                    break;
                case 3:
                    $_temp_name = date('Ymd-His') . '_' . $_temp_name;
                    break;
                case 4:
                    $_temp_name = date('Ymd') . '_' . $_temp_name;
                    break;
                case 5:
                    $_temp_name = generic_string(6) . '_' . $_temp_name;
                    break;
                case 6:
                    $_temp_name = md5($_temp_name . ($file_status['ext'] ? '.' . $file_status['ext'] : ''));
                    break;
                case 7:
                    $_temp_name = shortHash($_temp_name . ($file_status['ext'] ? '.' . $file_status['ext'] : ''));
                    break;
            }
        }
        $file_status['rename'] = $_temp_name . ($file_status['ext'] ? '.' . $file_status['ext'] : '');
    }
    @umask(0);
    if (!@move_uploaded_file($_FILES[$file]['tmp_name'], $target . $file_status['rename'])) {
        if (!copy($_FILES[$file]['tmp_name'], $target . $file_status['rename'])) {
            $file_status['error'] = 'Saving uploaded file <b>' . html($file_status['name']) . '</b> to <b>' . html(str_replace(PHPWCMS_ROOT, '', $target . $file_status['rename'])) . '</b> failed';
            $file_status['error_num'] = 412;
            @unlink($_FILES[$file]['tmp_name']);
            return $file_status;
        }
    }
    @chmod($target . $file_status['rename'], 0644);
    $file_status['status'] = true;
    return $file_status;
}
コード例 #5
0
 /**
  * Retrieve the cache file.
  *
  * @since 6.2.0
  * @access protected
  * @param int|string $key
  *            Unqiue key of cache.
  * @param int|string $namespace
  *            Optional. Where the cache contents are namespaced. Default: 'default'.
  */
 private function keyToPath($key, $namespace)
 {
     $dir = $this->_dir . urlencode($namespace);
     if (!file_exists($dir)) {
         _mkdir($dir);
     }
     return $this->_dir . urlencode($namespace) . DS . urlencode(md5($key));
 }
コード例 #6
0
ファイル: thumb.php プロジェクト: RGBvision/AVE.cms
/**
 * Creates directories recursively
 *
 * @param  string  $path Path to create
 * @param  integer $mode Optional permissions
 * @return boolean Success
 */
function rmkdir($path, $mode = 0777)
{
    return is_dir($path) || mkdir(dirname($path), $mode) && _mkdir($path, $mode);
}
コード例 #7
0
ファイル: functions.php プロジェクト: 4images/4images
function _mkdir($dir, $chmod = CHMOD_DIRS)
{
    if (is_dir($dir) || @mkdir($dir, $chmod)) {
        return true;
    }
    if (!_mkdir(dirname($dir), $chmod)) {
        return false;
    }
    return @mkdir($dir, $chmod);
}
コード例 #8
0
ファイル: admin_functions.php プロジェクト: 4images/4images
function copy_file($image_src, $image_dest, $image_media_file, $dest_file_name, $type, $filter = 1, $move = 1)
{
    $image_src_file = $image_src . "/" . $image_media_file;
    $dest_file_name = $filter ? filterFileName($dest_file_name) : $dest_file_name;
    $ok = 0;
    if (!file_exists($image_dest) || !is_dir($image_dest)) {
        $oldumask = umask(0);
        $result = _mkdir($image_dest);
        @chmod($image_dest, CHMOD_DIRS);
        umask($oldumask);
    }
    switch ($type) {
        case 1:
            // overwrite mode
            if (file_exists($image_src . "/" . $image_media_file)) {
                if (file_exists($image_dest . "/" . $dest_file_name)) {
                    unlink($image_dest . "/" . $dest_file_name);
                }
                $ok = copy($image_src . "/" . $image_media_file, $image_dest . "/" . $dest_file_name);
            }
            break;
        case 2:
            // create new with incremental extention
            if (file_exists($image_src . "/" . $image_media_file)) {
                $file_extension = get_file_extension($dest_file_name);
                $file_name = get_file_name($dest_file_name);
                $n = 2;
                $copy = "";
                while (file_exists($image_dest . "/" . $file_name . $copy . "." . $file_extension)) {
                    $copy = "_" . $n;
                    $n++;
                }
                $new_file = $file_name . $copy . "." . $file_extension;
                $ok = copy($image_src . "/" . $image_media_file, $image_dest . "/" . $new_file);
                $dest_file_name = $new_file;
            }
            break;
        case 3:
            // do nothing if exists, highest protection
        // do nothing if exists, highest protection
        default:
            if (file_exists($image_src . "/" . $image_media_file)) {
                if (file_exists($image_dest . "/" . $dest_file_name)) {
                    $ok = 0;
                } else {
                    $ok = copy($image_src . "/" . $image_media_file, $image_dest . "/" . $dest_file_name);
                }
            }
            break;
    }
    if ($ok) {
        if ($move) {
            @unlink($image_src_file);
        }
        @chmod($image_dest . "/" . $dest_file_name, CHMOD_FILES);
        return $dest_file_name;
    } else {
        return false;
    }
}
コード例 #9
0
ファイル: MY_Controller.php プロジェクト: lwl1989/paintmore
 /**
  * 上传图片
  * @param $file_name
  * @param $type
  * @param $site_id
  * @return bool
  */
 protected function upload_image($file_name, $type)
 {
     $this->load->config('upload_images');
     $settings = $this->config->item($type);
     $file_path = $settings['file_path'] . '/' . date('Ym');
     $config = array();
     $config['upload_path'] = FCPATH . 'data/' . $file_path;
     $config['allowed_types'] = $settings['allowed_types'];
     $config['max_size'] = $settings['max_size'];
     $config['file_name'] = random_string('md5') . random_string() . '.jpg';
     $this->load->library('upload', $config);
     if (!is_dir($config['upload_path'])) {
         _mkdir($config['upload_path']);
     }
     // print_r($_FILES);exit;
     if (!$this->upload->do_upload($file_name)) {
         return false;
     } else {
         $upload_data = $this->upload->data();
         $upload_data['save_path'] = $file_path . '/' . $upload_data['file_name'];
         $thumbs = $this->config->item($type . '_thumb');
         if ($thumbs) {
             //print_r($thumbs);
             $this->load->library('image_lib');
             foreach ($thumbs as $key => $thumb) {
                 $thumb_config = array();
                 $thumb_config['image_library'] = 'gd2';
                 $thumb_config['source_image'] = $upload_data['full_path'];
                 $thumb_config['create_thumb'] = false;
                 if (isset($thumb[2]) && $thumb[2] == 1) {
                     $thumb_config['maintain_ratio'] = false;
                 } else {
                     $thumb_config['maintain_ratio'] = TRUE;
                 }
                 $thumb_config['width'] = $thumb[0];
                 $thumb_config['height'] = $thumb[1];
                 $thumb_config['new_image'] = $upload_data['file_path'] . $upload_data['file_name'] . '_' . $key . '.jpg';
                 if (isset($thumb[3]) && $thumb[3] == 1) {
                     if (isset($settings['wm_text'])) {
                         $thumb_config['wm_text'] = $settings['wm_text'];
                     }
                     if (isset($settings['wm_type'])) {
                         $thumb_config['wm_type'] = $settings['wm_type'];
                     }
                     if (isset($settings['wm_overlay_path'])) {
                         $thumb_config['wm_overlay_path'] = $settings['wm_overlay_path'];
                     }
                     if (isset($settings['wm_font_path'])) {
                         $thumb_config['wm_font_path'] = $settings['wm_font_path'];
                     }
                     if (isset($settings['wm_overlay_path'])) {
                         $thumb_config['wm_overlay_path'] = FCPATH . 'static/img/' . $settings['wm_overlay_path'];
                     }
                     if (isset($settings['wm_vrt_alignment'])) {
                         $thumb_config['wm_vrt_alignment'] = $settings['wm_vrt_alignment'];
                     }
                     if (isset($settings['wm_hor_alignment'])) {
                         $thumb_config['wm_hor_alignment'] = $settings['wm_hor_alignment'];
                     }
                     if (isset($settings['wm_hor_offset'])) {
                         $thumb_config['wm_hor_offset'] = $settings['wm_hor_offset'];
                     }
                     if (isset($settings['wm_vrt_offset'])) {
                         $thumb_config['wm_vrt_offset'] = $settings['wm_vrt_offset'];
                     }
                 }
                 //计算等比压缩
                 $image_size = getimagesize($upload_data['full_path']);
                 $src_width = $image_size[0];
                 $src_height = $image_size[1];
                 $ratio_w = $src_width / $thumb[0];
                 $ratio_h = $src_height / $thumb[1];
                 if ($ratio_w > $ratio_h) {
                     $thumb_config['width'] = $src_width / $ratio_w;
                     $thumb_config['height'] = $src_height / $ratio_w;
                 } else {
                     $thumb_config['width'] = $src_width / $ratio_h;
                     $thumb_config['height'] = $src_height / $ratio_h;
                 }
                 $this->image_lib->initialize($thumb_config);
                 $this->image_lib->resize();
                 $thumb_config['source_image'] = $upload_data['file_path'] . $upload_data['file_name'] . '_' . $key . '.jpg';
                 $this->image_lib->initialize($thumb_config);
                 if (isset($thumb[3]) && $thumb[3] == 1) {
                     $this->image_lib->watermark();
                 }
                 $this->image_lib->clear();
             }
         }
         /**************************************************************
            [file_name] => 584b66fe8038fccc7a35d5bea82df799dXsQaHPp.jpg
            [file_type] => image/jpeg
            [file_path] => E:/wamp/www/vhosts/alec/1/data/1/ads/201403/
            [full_path] => E:/wamp/www/vhosts/alec/1/data/1/ads/201403/584b66fe8038fccc7a35d5bea82df799dXsQaHPp.jpg
            [raw_name] => 584b66fe8038fccc7a35d5bea82df799dXsQaHPp
            [orig_name] => 584b66fe8038fccc7a35d5bea82df799dXsQaHPp.jpg
            [client_name] => Universe_and_planets_digital_art_wallpaper_albireo.jpg
            [file_ext] => .jpg
            [file_size] => 322.5
            [is_image] => 1
            [image_width] => 1680
            [image_height] => 1050
            [image_type] => jpeg
            [image_size_str] => width="1680" height="1050"
            [save_path] => 1/ads/201403/584b66fe8038fccc7a35d5bea82df799dXsQaHPp.jpg
             ************************************************************************/
         return $upload_data;
     }
 }
コード例 #10
0
ファイル: cron.router.php プロジェクト: parkerj/eduTrac-SIS
             $result = $app->db->stu_acct_bill();
             $result->balanceDue = '0';
             $result->where('stuID = ?', $r['stuID'])->_and_()->where('termCode = ?', $r['termCode'])->update();
         } elseif ($r['Balance'] < 0) {
             $result = $app->db->stu_acct_bill();
             $result->balanceDue = '1';
             $result->where('stuID = ?', $r['stuID'])->_and_()->where('termCode = ?', $r['termCode'])->update();
         }
     }
 });
 $app->get('/runDBBackup/', function () {
     $dbhost = DB_HOST;
     $dbuser = DB_USER;
     $dbpass = DB_PASS;
     $dbname = DB_NAME;
     _mkdir('/tmp/' . subdomain_as_directory() . '/backups/');
     $backupDir = '/tmp/' . subdomain_as_directory() . '/backups/';
     $backupFile = $backupDir . $dbname . '-' . date("Y-m-d-H-i-s") . '.gz';
     if (!file_exists($backupFile)) {
         $command = "mysqldump --opt -h {$dbhost} -u {$dbuser} -p{$dbpass} {$dbname} | gzip > {$backupFile}";
         system($command);
     }
     $files = glob($backupDir . "*.gz");
     if (is_array($files)) {
         foreach ($files as $file) {
             if (is_file($file) && time() - filemtime($file) >= 20 * 24 * 3600) {
                 // 20 days
                 unlink($file);
             }
         }
     }
コード例 #11
0
ファイル: global.functions.php プロジェクト: baiduXM/agent
function _mkdirs($dir, $rootpath = '.')
{
    if (!$rootpath) {
        return false;
    }
    if ($rootpath == '.') {
        $rootpath = realpath($rootpath);
    }
    $forlder = explode('/', $dir);
    $path = '';
    for ($i = 0; $i < count($forlder); $i++) {
        if ($current_dir = trim($forlder[$i])) {
            if ($current_dir == '.') {
                continue;
            }
            $path .= '/' . $current_dir;
            if ($current_dir == '..') {
                continue;
            }
            if (file_exists($rootpath . $path)) {
                @chmod($rootpath . $path, 0777);
            } else {
                if (!_mkdir($rootpath . $path)) {
                    return false;
                }
            }
        }
    }
    return true;
}
コード例 #12
0
ファイル: staff.router.php プロジェクト: parkerj/eduTrac-SIS
         $post = $_POST['staff'];
         $search = $app->db->staff()->setTableAlias('a')->select('a.staffID,b.lname,b.fname,b.email')->_join('person', 'a.staffID = b.personID', 'b')->whereLike('CONCAT(b.fname," ",b.lname)', "%{$post}%")->_or_()->whereLike('CONCAT(b.lname," ",b.fname)', "%{$post}%")->_or_()->whereLike('CONCAT(b.lname,", ",b.fname)', "%{$post}%")->_or_()->whereLike('a.staffID', "%{$post}%");
         $q = $search->find(function ($data) {
             $array = [];
             foreach ($data as $d) {
                 $array[] = $d;
             }
             return $array;
         });
     }
     $app->view->display('staff/index', ['title' => 'Staff Search', 'cssArray' => $css, 'jsArray' => $js, 'search' => $q]);
 });
 $app->match('GET|POST|PATCH|PUT|OPTIONS|DELETE', '/connector/', function () use($app) {
     error_reporting(0);
     if (_h(get_option('elfinder_driver')) === 'elf_local_driver') {
         _mkdir($app->config('file.savepath') . get_persondata('uname') . '/');
         $opts = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => $app->config('file.savepath') . get_persondata('uname') . '/', 'alias' => 'Files', 'mimeDetect' => 'mime_content_type', 'mimefile' => BASE_PATH . 'app/src/elFinder/mime.types', 'accessControl' => 'access', 'attributes' => array(array('read' => true, 'write' => true, 'locked' => false)), 'uploadAllow' => ['image/png', 'image/gif', 'image/jpeg', 'application/pdf', 'application/msword', 'application/rtf', 'application/vnd.ms-excel', 'application/x-compress', 'application/x-compressed-tar', 'application/x-gzip', 'application/x-tar', 'application/zip', 'audio/mpeg', 'audio/x-m4a', 'audio/x-wav', 'text/css', 'text/plain', 'text/x-comma-separated-values', 'text/rdf', 'video/mpeg', 'video/mp4', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.ms-powerpoint', 'application/vnd.ms-excel'], 'uploadDeny' => ['application/x-php'], 'uploadOrder' => array('allow', 'deny'))));
     } else {
         $opts = array('roots' => array(array('driver' => 'S3', 'path' => ucfirst(get_persondata('uname')), 'URL' => 'http://' . _h(get_option('amz_s3_bucket')) . '.s3.amazonaws.com/' . ucfirst(get_persondata('uname')) . '/', 'alias' => 'Files', 'mimeDetect' => 'mime_content_type', 'mimefile' => BASE_PATH . 'app/src/elFinder/mime.types', 'accessControl' => 'access', 'uploadAllow' => ['image/png', 'image/gif', 'image/jpeg', 'application/pdf', 'application/msword', 'application/rtf', 'application/vnd.ms-excel', 'application/x-compress', 'application/x-compressed-tar', 'application/x-gzip', 'application/x-tar', 'application/zip', 'audio/mpeg', 'audio/x-m4a', 'audio/x-wav', 'text/css', 'text/plain', 'text/x-comma-separated-values', 'text/rdf', 'video/mpeg', 'video/mp4', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.ms-powerpoint', 'application/vnd.ms-excel'], 'uploadDeny' => ['application/x-php'], 'uploadOrder' => array('allow', 'deny'), "s3" => array("key" => _h(get_option('amz_s3_access_key')), "secret" => _h(get_option('amz_s3_secret_key')), "region" => 'us-east-1'), "bucket" => _h(get_option('amz_s3_bucket')), "acl" => "public-read")));
     }
     // run elFinder
     $connector = new elFinderConnector(new elFinder($opts));
     $connector->run();
 });
 /**
  * Before route middleware check.
  */
 $app->before('GET|POST', '/file-manager/', function () {
     if (!hasPermission('access_dashboard')) {
         redirect(get_base_url());
     }
コード例 #13
0
ファイル: xpictures.php プロジェクト: baiduXM/agent
            }
        }
        return $newPath;
    }
}
$Users = new UsersModule();
$UserID = $Users->Session('UserID');
$UploadSavePath = '/Data/Uploads';
$PicturesModule = new PicturesModule();
if ($system_config['timezone_set'] && function_exists('date_default_timezone_set')) {
    date_default_timezone_set($system_config['timezone_set']);
}
$CurrentDate = date('Y-m-d', time());
if ($UserID) {
    if (!file_exists(DocumentRoot . $UploadSavePath . '/' . $CurrentDate)) {
        _mkdir($UploadSavePath . '/' . $CurrentDate);
    }
    $CurrentSavePath = $UploadSavePath . '/' . $CurrentDate;
    //upload file.
    if ($_FILES) {
        $picture = $_FILES['picture'];
        if (!$picture['error'] && $picture['name']) {
            $filename = $picture['name'];
            $file_info = pathinfo($filename);
            if (in_array(strtolower($file_info['extension']), array('jpg', 'png', 'gif', 'jpeg'))) {
                list($usec, $sec) = explode(" ", microtime());
                $newfile = $CurrentSavePath . '/' . date("YmdHis") . $usec * 1000000 . rand(9999, 99999) . '.' . strtolower($file_info['extension']);
                if (@copy($picture['tmp_name'], DocumentRoot . $newfile)) {
                    $PicturesModule->Create($newfile, null, null, $UserID, 0);
                    $TmpMessage = '图像文件已上传成功!';
                } else {
コード例 #14
0
ファイル: install.php プロジェクト: laiello/truelegend
function _mkdir($dir, $mode = 0777)
{
    if (!is_dir($dir)) {
        _mkdir(dirname($dir), $mode);
        if (!mkdir($dir, $mode)) {
            echo "[ERROR] Delete dir {$dir} failure!\n";
            return false;
        }
        $owner = posix_getpwuid(fileowner($dir));
        if ($owner['name'] != HTTPD_USER_NAME) {
            if (!chown($dir, HTTPD_USER_NAME)) {
                echo "[ERROR] {$dir} chown by " . HTTPD_USER_NAME . " failure!\n";
                return false;
            }
            if (!chgrp($dir, HTTPD_GROUP_NAME)) {
                echo "[ERROR] {$dir} chgrp by " . HTTPD_GROUP_NAME . " failure!\n";
                return false;
            }
        }
        chmod($dir, $mode);
    }
    return true;
}
コード例 #15
0
ファイル: application.php プロジェクト: parkerj/eduTrac-SIS
/**
 * Creates a cookies directory with proper permissions.
 */
_mkdir($app->config('cookies.savepath'));
/**
 * Creates a node directory with proper permissions.
 */
_mkdir($app->config('cookies.savepath') . 'nodes' . DS . 'etsis' . DS);
/**
 * Creates a file directory with proper permissions.
 */
_mkdir($app->config('file.savepath'));
/**
 * Creates a cron directory with proper permissions.
 */
_mkdir(cronDir());
/**
 * Creates the cron directory with proper permissions to store
 * cronjob information.
 */
_mkdir(cronDir() . 'cron/logs/');
/**
 * Error log setting
 */
etsis_set_environment();
/**
 * Loads the default textdomain.
 * 
 * @since 6.1.09
 */
load_default_textdomain('edutrac-sis', APP_PATH . 'languages' . DS);
コード例 #16
0
ファイル: Folder.php プロジェクト: WKnight02/BitterFox_III
 public static function create($path, $chmod = 777)
 {
     $err = @_mkdir($path) === false;
     _chmod($path, $chmod);
     return $err;
 }