当前位置: 首页>>代码示例>>PHP>>正文


PHP file::isWritable方法代码示例

本文整理汇总了PHP中file::isWritable方法的典型用法代码示例。如果您正苦于以下问题:PHP file::isWritable方法的具体用法?PHP file::isWritable怎么用?PHP file::isWritable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在file的用法示例。


在下文中一共展示了file::isWritable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: file

    /**
     * constructor
     *
     */
    function __construct()
    {
    	//check if the session folder read and writable
    		$dir = new file();
	        if(!file_exists(CONFIG_SYS_DIR_SESSION_PATH))
	        {
	           if(!$dir->mkdir(CONFIG_SYS_DIR_SESSION_PATH))
	           {
	              die('Unable to create session folder.');
	           }
	        }
    		if(!$dir->isReadable(CONFIG_SYS_DIR_SESSION_PATH))
    		{
    			die('Permission denied: ' . CONFIG_SYS_DIR_SESSION_PATH . " is not readable.");
    		}    		
    		if(!$dir->isWritable(CONFIG_SYS_DIR_SESSION_PATH))
    		{
    			die('Permission denied: ' . CONFIG_SYS_DIR_SESSION_PATH . " is not writable.");
    		}
    	$this->dir = backslashToSlash(addTrailingSlash(CONFIG_SYS_DIR_SESSION_PATH));
        $this->lifeTime = get_cfg_var("session.gc_maxlifetime");  
        $this->gcCounterFile = $this->dir . $this->gcCounterFileName; 
        $this->gcLogFile = $this->dir  . $this->gcLogFileName;
       	$this->sessionDir = backslashToSlash($this->dir.session_id().DIRECTORY_SEPARATOR);
        $this->init();    	
    }
开发者ID:hungnv0789,项目名称:vhtm,代码行数:30,代码来源:class.session.php

示例2: getFiles

 protected function getFiles($dir)
 {
     $thumbDir = "{$this->config['uploadDir']}/{$this->config['thumbsDir']}/{$dir}";
     $dir = "{$this->config['uploadDir']}/{$dir}";
     $return = array();
     $files = dir::content($dir, array('types' => "file"));
     if ($files === false) {
         return $return;
     }
     foreach ($files as $file) {
         $size = @getimagesize($file);
         if (is_array($size) && count($size)) {
             $thumb_file = "{$thumbDir}/" . basename($file);
             if (!is_file($thumb_file)) {
                 $this->makeThumb($file, false);
             }
             $smallThumb = $size[0] <= $this->config['thumbWidth'] && $size[1] <= $this->config['thumbHeight'] && in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_PNG, IMAGETYPE_JPEG));
         } else {
             $smallThumb = false;
         }
         $stat = stat($file);
         if ($stat === false) {
             continue;
         }
         $name = basename($file);
         $ext = file::getExtension($file);
         $bigIcon = file_exists("themes/{$this->config['theme']}/img/files/big/{$ext}.png");
         $smallIcon = file_exists("themes/{$this->config['theme']}/img/files/small/{$ext}.png");
         $thumb = file_exists("{$thumbDir}/{$name}");
         $return[] = array('name' => stripcslashes($name), 'size' => $stat['size'], 'mtime' => $stat['mtime'], 'date' => @strftime($this->dateTimeSmall, $stat['mtime']), 'readable' => is_readable($file), 'writable' => file::isWritable($file), 'bigIcon' => $bigIcon, 'smallIcon' => $smallIcon, 'thumb' => $thumb, 'smallThumb' => $smallThumb);
     }
     return $return;
 }
开发者ID:kinghinds,项目名称:kingtest2,代码行数:33,代码来源:browser.php

示例3: getFiles

 protected function getFiles($dir)
 {
     $thumbDir = "{$this->config['uploadDir']}/{$this->config['thumbsDir']}/{$dir}";
     $dir = "{$this->config['uploadDir']}/{$dir}";
     $return = array();
     $files = dir::content($dir, array('types' => "file"));
     if ($files === false) {
         return $return;
     }
     foreach ($files as $file) {
         $this->makeThumb($file, false);
         $image = new gd($file);
         $image = !$image->init_error && $image->get_width() <= $this->config['thumbWidth'] && $image->get_height() <= $this->config['thumbHeight'];
         $stat = stat($file);
         if ($stat === false) {
             continue;
         }
         $name = basename($file);
         $ext = file::getExtension($file);
         $bigIcon = file_exists("themes/{$this->config['theme']}/img/files/big/{$ext}.png");
         $smallIcon = file_exists("themes/{$this->config['theme']}/img/files/small/{$ext}.png");
         $thumb = file_exists("{$thumbDir}/{$name}");
         $return[] = array('name' => stripcslashes($name), 'size' => $stat['size'], 'mtime' => $stat['mtime'], 'date' => @strftime($this->dateTimeSmall, $stat['mtime']), 'readable' => is_readable($file), 'writable' => file::isWritable($file), 'bigIcon' => $bigIcon, 'smallIcon' => $smallIcon, 'thumb' => $thumb, 'smallThumb' => $image);
     }
     return $return;
 }
开发者ID:unisexx,项目名称:adf16,代码行数:26,代码来源:browser.php

示例4: getFiles

 protected function getFiles($dir)
 {
     $thumbDir = "{$this->config['uploadDir']}/{$this->config['thumbsDir']}/{$dir}";
     $dir = "{$this->config['uploadDir']}/{$dir}";
     $return = array();
     $files = dir::content($dir, array('types' => "file"));
     if ($files === false) {
         return $return;
     }
     foreach ($files as $file) {
         $img = new fastImage($file);
         $type = $img->getType();
         if ($type !== false) {
             $size = $img->getSize($file);
             if (is_array($size) && count($size)) {
                 $thumb_file = "{$thumbDir}/" . basename($file);
                 if (!is_file($thumb_file)) {
                     $this->makeThumb($file, false);
                 }
                 $smallThumb = $size[0] <= $this->config['thumbWidth'] && $size[1] <= $this->config['thumbHeight'] && in_array($type, array("gif", "jpeg", "png"));
             } else {
                 $smallThumb = false;
             }
         } else {
             $smallThumb = false;
         }
         $img->close();
         $stat = stat($file);
         if ($stat === false) {
             continue;
         }
         $name = basename($file);
         $ext = file::getExtension($file);
         $types = $this->config['types'];
         $types = explode(' ', $types['images'] . ' ' . $types['image']);
         if (substr($name, 0, 1) == '.' && !$this->config['showHiddenFiles']) {
             continue;
         }
         if ($this->type == 'images' && !in_array(strtolower($ext), $types)) {
             continue;
         }
         $bigIcon = file_exists("themes/{$this->config['theme']}/img/files/big/{$ext}.png");
         $smallIcon = file_exists("themes/{$this->config['theme']}/img/files/small/{$ext}.png");
         $thumb = file_exists("{$thumbDir}/{$name}");
         $return[] = array('name' => stripcslashes($name), 'size' => $stat['size'], 'mtime' => $stat['mtime'], 'date' => @strftime($this->dateTimeSmall, $stat['mtime']), 'readable' => is_readable($file), 'writable' => file::isWritable($file), 'bigIcon' => $bigIcon, 'smallIcon' => $smallIcon, 'thumb' => $thumb, 'smallThumb' => $smallThumb);
     }
     return $return;
 }
开发者ID:Fess7,项目名称:evolution,代码行数:48,代码来源:browser.php

示例5: act_mv_cbd

 protected function act_mv_cbd()
 {
     $dir = $this->postDir();
     if (!$this->config['access']['files']['move'] || !isset($_POST['dir']) || !is_dir($dir) || !is_readable($dir) || !dir::isWritable($dir) || !isset($_POST['files']) || !is_array($_POST['files']) || !count($_POST['files'])) {
         $this->errorMsg("Unknown error.");
     }
     $error = array();
     foreach ($_POST['files'] as $file) {
         $file = path::normalize($file);
         if (substr($file, 0, 1) == ".") {
             continue;
         }
         $type = explode("/", $file);
         $type = $type[0];
         if ($type != $this->type) {
             continue;
         }
         $path = "{$this->config['uploadDir']}/{$file}";
         if (!$this->checkFilePath($path)) {
             continue;
         }
         $base = basename($file);
         $replace = array('file' => $this->htmlData($base));
         $ext = file::getExtension($base);
         if (!file_exists($path)) {
             $error[] = $this->label("The file '{file}' does not exist.", $replace);
         } elseif (substr($base, 0, 1) == ".") {
             $error[] = $this->htmlData($base) . ": " . $this->label("File name shouldn't begins with '.'");
         } elseif (!$this->validateExtension($ext, $type)) {
             $error[] = $this->htmlData($base) . ": " . $this->label("Denied file extension.");
         } elseif (file_exists("{$dir}/{$base}")) {
             $error[] = $this->htmlData($base) . ": " . $this->label("A file or folder with that name already exists.");
         } elseif (!is_readable($path) || !is_file($path)) {
             $error[] = $this->label("Cannot read '{file}'.", $replace);
         } elseif (!file::isWritable($path) || !@rename($path, "{$dir}/{$base}")) {
             $error[] = $this->label("Cannot move '{file}'.", $replace);
         } else {
             if (function_exists("chmod")) {
                 @chmod("{$dir}/{$base}", $this->config['filePerms']);
             }
             $fromThumb = "{$this->thumbsDir}/{$file}";
             if (is_file($fromThumb) && is_readable($fromThumb)) {
                 $toThumb = "{$this->thumbsTypeDir}/{$_POST['dir']}";
                 if (!is_dir($toThumb)) {
                     @mkdir($toThumb, $this->config['dirPerms'], true);
                 }
                 $toThumb .= "/{$base}";
                 @rename($fromThumb, $toThumb);
             }
         }
     }
     if (count($error)) {
         return json_encode(array('error' => $error));
     }
     return true;
 }
开发者ID:CapsuleCorpIndonesia,项目名称:biji_katak,代码行数:56,代码来源:browser.php

示例6: getFiles

 protected function getFiles($dir)
 {
     $thumbDir = "{$this->config['uploadDir']}/{$this->config['thumbsDir']}/{$dir}";
     $dir = "{$this->config['uploadDir']}/{$dir}";
     $return = array();
     $files = dir::content($dir, array('types' => "file"));
     if ($files === false) {
         return $return;
     }
     foreach ($files as $file) {
         $size = @getimagesize($file);
         if (is_array($size) && count($size)) {
             $thumb_file = "{$thumbDir}/" . basename($file);
             if (!is_file($thumb_file)) {
                 $this->makeThumb($file, false);
             }
             $smallThumb = $size[0] <= $this->config['thumbWidth'] && $size[1] <= $this->config['thumbHeight'] && in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_PNG, IMAGETYPE_JPEG));
         } else {
             $smallThumb = false;
         }
         $stat = stat($file);
         if ($stat === false) {
             continue;
         }
         $filename = basename($file);
         if ('WIN' == substr(PHP_OS, 0, 3)) {
             setlocale(LC_CTYPE, '');
             // Resets the codepage to the system codepage so it can be properly retrieved
             $codepage = 'Windows-' . trim(strstr(setlocale(LC_CTYPE, 0), '.'), '.');
             if (function_exists('iconv')) {
                 $filename = iconv($codepage, 'UTF-8', $filename);
             } elseif (function_exists('mb_convert_encoding')) {
                 $filename = mb_convert_encoding($filename, $codepage, 'UTF-8');
             }
         }
         $name = $filename;
         $ext = file::getExtension($file);
         $bigIcon = file_exists("themes/{$this->config['theme']}/img/files/big/{$ext}.png");
         $smallIcon = file_exists("themes/{$this->config['theme']}/img/files/small/{$ext}.png");
         $thumb = file_exists("{$thumbDir}/{$name}");
         $return[] = array('name' => stripcslashes($name), 'size' => $stat['size'], 'mtime' => $stat['mtime'], 'date' => @strftime($this->dateTimeSmall, $stat['mtime']), 'readable' => is_readable($file), 'writable' => file::isWritable($file), 'bigIcon' => $bigIcon, 'smallIcon' => $smallIcon, 'thumb' => $thumb, 'smallThumb' => $smallThumb);
     }
     return $return;
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:44,代码来源:browser.php


注:本文中的file::isWritable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。