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


PHP filesystem类代码示例

本文整理汇总了PHP中filesystem的典型用法代码示例。如果您正苦于以下问题:PHP filesystem类的具体用法?PHP filesystem怎么用?PHP filesystem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: md

 /**
  * md文件解析
  */
 public function md()
 {
     $file = $this->get('file');
     $p = $this->get('p');
     // 目录
     $directory = MD_FILE_ROOT_PATH . $p . '/';
     // 如果不存在自动创建
     filesystem::mkdir($directory);
     // 遍历文件夹所有内容
     $path = array();
     $dir = filesystem::ls($directory);
     usort($dir, 'compare');
     foreach ($dir as $d) {
         $path[] = trim($d);
     }
     //  解析mk文件
     $file = $directory . $file;
     if (is_file($file)) {
         $md = new markdown($file);
         $html = $md->parse();
         view::assign('html', $html);
     }
     view::assign('path', $path);
     view::assign('p', $p);
     view::assign('file', str_replace($directory, '', $file));
 }
开发者ID:luozhanhong,项目名称:share,代码行数:29,代码来源:file.php

示例2: bytes

 /**
  * 字节数转换
  */
 public function bytes()
 {
     $bytes = $this->post_ufloat('bytes');
     if ($bytes <= 0) {
         return;
     }
     $result = filesystem::bytes($bytes);
     view::assign('result', $result);
     view::assign('input', $bytes);
 }
开发者ID:kansifang,项目名称:share,代码行数:13,代码来源:misc.php

示例3: make_path

 /**
  * Recursively creates new folders from the specified path or paths
  *
  * @param   mixed   a single path or an array of paths
  * @param   number  initial permissions for 
  * @return  mixed   the cleaned path or array of paths
  */
 public static function make_path($path, $permissions = 0755)
 {
     if (is_array($path)) {
         foreach ($path as $p) {
             $arr = array();
             array_push($arr, filesystem::make_path($p, $permissions));
         }
         return $arr;
     } else {
         $path = preg_replace('%/+%', '/', $path);
         // remove double slashes
         $path = preg_replace('%/$%', '', $path);
         // remove trailing slash
         $folders = preg_split('%(?!^)/%', $path);
         // split into path segments, preserving any initial leading slash
         $path = '';
         foreach ($folders as $folder) {
             $path .= $folder . '/';
             if (!file_exists($path)) {
                 mkdir($path, $permissions);
             }
         }
         return dir($path);
     }
 }
开发者ID:riartem,项目名称:kohana-update,代码行数:32,代码来源:Filesystem.php

示例4: header

<?php

require "config.php";
if (!isset($_GET['path'])) {
    header("Location: ./404.php");
    exit;
} elseif (($path = trim($_GET['path'])) == "") {
    header("Location: ./404.php");
    exit;
} elseif (!is_file($path) || !is_readable($path)) {
    header("Location: ./404.php");
    exit;
} else {
    $myfs = new filesystem($path);
    $info = $myfs->getpath();
    header("Content-Type: application/force-download");
    header("Content-Disposition: attachment; filename=" . ___basename($path));
    header("Accept-Ranges: bytes");
    header("Content-Length: " . $info['size']);
    $fp = fopen($path, "rb");
    while (!feof($fp)) {
        echo fread($fp, 4096);
    }
    fclose($fp);
}
开发者ID:simplesky,项目名称:course,代码行数:25,代码来源:dget.php

示例5: array

<?php

$error = array();
include '../data/config.inc.php';
require_once '../classes/class.filesystem.php';
$filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
$config['ftp_path'] = $config['ftp_path'] . '/install';
$filesystem->set_wd($config['ftp_path']);
if (isset($_REQUEST['save']) && $_REQUEST['save'] == 1) {
    require_once '../classes/database/' . $config['dbsystem'] . '.inc.php';
    $db = new DB($config['host'], $config['dbuser'], $config['dbpw'], $config['database'], $config['pconnect'], false, $config['dbprefix']);
    $db->errlogfile = '../' . $db->errlogfile;
    $db->pre = $db->prefix();
    $db->connect(false);
    if (!$db->hasConnection()) {
        ?>
	<div class="bbody">Could not connect to database! Pleasy try again later or check the database settings!</div>
	<div class="bfoot center"><a class="submit" href="index.php?package=install&amp;step=<?php 
        echo $step - 2;
        ?>
">Go back</a> <a class="submit" href="index.php?package=install&amp;step=<?php 
        echo $step;
        ?>
">Refresh</a></div>
		<?php 
    } else {
        if (!$db->select_db()) {
            ?>
	<div class="bbody">Could not find database <em><?php 
            echo $db->database;
            ?>
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:9.php

示例6: autoload

<?php

namespace rude;

require_once 'rude-globals.php';
require_once 'rude-filesystem.php';
$_source_list = filesystem::search_files(realpath(__DIR__ . '/../'), 'php');
# scan for .php files
function autoload($class_name)
{
    global $_source_list;
    if (!$_source_list) {
        return;
    }
    $class_name = explode('\\', $class_name)[1];
    # rude\warcraft_map => warcraft_map
    $class_name = str_replace('_', '-', $class_name);
    # warcraft_map => warcraft-map
    foreach ($_source_list as $source_path) {
        $source_file = basename($source_path);
        if ($source_file == 'rude-' . $class_name . '.php') {
            if (file_exists($source_path)) {
                require_once $source_path;
                return;
            }
        }
    }
}
spl_autoload_register('rude\\autoload');
# show all errors/warnings/stricts
if (defined('RUDE_DEBUG') and RUDE_DEBUG) {
开发者ID:ThisNameWasFree,项目名称:rude-univ,代码行数:31,代码来源:rude-autoload.php

示例7: QRCode

 /**
  * 生成二维码
  * @param string $string 生成二维码的数据
  * @param string $errorCorrentionLevel 容错级别 默认L  L|M|Q|H
  * @param int $matrixPointSize 二维码大小 默认4
  * @param int $margin 旁白大小 默认2
  * @param string $logo logo图片路径
  */
 public static function QRCode($string, $logo = NULL, $errorCorrectionLevel = 'L', $matrixPointSize = 4, $margin = 2)
 {
     $path = ROOT . '/extends/phpqrcode/phpqrcode.php';
     if (file_exists($path)) {
         include_once $path;
     }
     $filename = ROOT . '/application/download/' . md5($string) . '.png';
     \QRcode::png($string, $filename, $errorCorrectionLevel, $matrixPointSize, $margin);
     if (!empty($logo) && filesystem::path($logo) && filesystem::path($filename)) {
         $QR = imagecreatefromstring(file_get_contents($filename));
         $logo = imagecreatefromstring(file_get_contents($logo));
         $QR_width = imagesx($filename);
         //二维码图片宽度
         $QR_height = imagesy($filename);
         //二维码图片高度
         $logo_width = imagesx($logo);
         //logo图片宽度
         $logo_height = imagesy($logo);
         //logo图片高度
         $logo_qr_width = $QR_width / 5;
         $scale = $logo_width / $logo_qr_width;
         $logo_qr_height = $logo_height / $scale;
         $from_width = ($QR_width - $logo_qr_width) / 2;
         //重新组合图片并调整大小
         imagecopyresampled($filename, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height);
     }
     return $filename;
 }
开发者ID:jin123456bat,项目名称:home,代码行数:36,代码来源:image.php

示例8: filesystem

<?php

require '../data/config.inc.php';
require_once '../classes/class.filesystem.php';
$filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
$filesystem->set_wd($config['ftp_path']);
if (isset($_REQUEST['save']) && $_REQUEST['save'] == 1) {
    include '../classes/class.phpconfig.php';
    if (isset($_REQUEST['host'])) {
        $config['host'] = trim($_REQUEST['host']);
    } else {
        $config['host'] = 'localhost';
    }
    if (isset($_REQUEST['dbuser'])) {
        $config['dbuser'] = trim($_REQUEST['dbuser']);
    }
    if (isset($_REQUEST['dbpw'])) {
        $config['dbpw'] = trim($_REQUEST['dbpw']);
    }
    if (isset($_REQUEST['database'])) {
        $config['database'] = trim($_REQUEST['database']);
    }
    if (isset($_REQUEST['pconnect']) && isset($_REQUEST['dbsystem']) && $_REQUEST['dbsystem'] == 'mysql') {
        $config['pconnect'] = $_REQUEST['pconnect'];
    } else {
        $config['pconnect'] = 0;
    }
    if (isset($_REQUEST['dbprefix'])) {
        $config['dbprefix'] = trim($_REQUEST['dbprefix']);
    } else {
        $config['dbprefix'] = '';
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:7.php

示例9: filesystem

<?php

include 'data/config.inc.php';
if (!class_exists('filesystem')) {
    require_once 'install/classes/class.filesystem.php';
    $filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
    $filesystem->set_wd($config['ftp_path'], $config['fpath']);
}
$tar_packs = array(1 => 'update.admin.tar', 2 => 'update.misc.tar');
if (empty($_REQUEST['sub']) || !isset($tar_packs[$_REQUEST['sub']])) {
    $sub = 1;
} else {
    $sub = $_REQUEST['sub'];
}
require 'install/classes/function.chmod.php';
require 'install/classes/class.tar.php';
$tar = new tar(realpath('install/files/'), $tar_packs[$sub]);
$tar->ignore_chmod();
$error = $tar->extract_files('./');
$files = implode("\n", $tar->list_files());
$dirs = array('language' => null, 'templates' => null, 'designs' => null, 'images' => null);
preg_match_all('~^(' . implode('|', array_keys($dirs)) . ')/(\\d+)/([^\\n]+)$~m', $files, $replicable, PREG_SET_ORDER);
foreach ($replicable as $rep) {
    if ($dirs[$rep[1]] === null) {
        $dirs[$rep[1]] = array();
        $dir = dir($rep[1]);
        while (false !== ($entry = $dir->read())) {
            if (is_id($entry) && is_dir($rep[1] . '/' . $entry)) {
                $dirs[$rep[1]][$entry] = $rep[1] . '/' . $entry . '/';
            }
        }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:3.php

示例10: array

    global $db;
    $l = array();
    $result = $db->query('SELECT id FROM ' . $db->pre . 'language ORDER BY language', __LINE__, __FILE__);
    while ($row = $db->fetch_assoc($result)) {
        $settings = return_array('settings', $row['id']);
        if (!isset($l[$settings['spellcheck_dict']])) {
            $l[$settings['spellcheck_dict']] = array();
        }
        $l[$settings['spellcheck_dict']] = $row['id'];
    }
    return $l;
}
echo "- Source files loaded<br />";
if (!class_exists('filesystem')) {
    require_once '../classes/class.filesystem.php';
    $filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
    $filesystem->set_wd($config['ftp_path']);
}
if (!class_exists('DB')) {
    require_once '../classes/database/' . $config['dbsystem'] . '.inc.php';
    $db = new DB($config['host'], $config['dbuser'], $config['dbpw'], $config['database'], $config['pconnect'], true, $config['dbprefix']);
    $db->pre = $db->prefix();
    $db->errlogfile = '../' . $db->errlogfile;
}
echo "- FTP class loaded, Database connection started.<br />";
// Config
$c = new manageconfig();
$c->getdata('../data/config.inc.php');
$c->updateconfig('version', str, VISCACHA_VERSION);
$c->updateconfig('syndication_insert_email', int, 0);
$c->savedata();
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:3.php

示例11: array

<?php

$error = array();
if (isset($_REQUEST['save']) && $_REQUEST['save'] == 1) {
    include '../data/config.inc.php';
    require_once '../classes/class.filesystem.php';
    $filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
    $filesystem->set_wd($config['ftp_path']);
    require_once '../classes/database/' . $config['dbsystem'] . '.inc.php';
    $db = new DB($config['host'], $config['dbuser'], $config['dbpw'], $config['database'], $config['pconnect'], false, $config['dbprefix']);
    $db->errlogfile = '../' . $db->errlogfile;
    $db->pre = $db->prefix();
    $db->connect(false);
    if (!is_resource($db->conn)) {
        ?>
	<div class="bbody">Could not connect to database! Pleasy try again later or check the database settings!</div>
	<div class="bfoot center"><a class="submit" href="index.php?step=<?php 
        echo $step - 2;
        ?>
">Go back</a> <a class="submit" href="index.php?step=<?php 
        echo $step;
        ?>
">Refresh</a></div>
		<?php 
    } else {
        if (!$db->select_db()) {
            ?>
	<div class="bbody">Could not find database <em><?php 
            echo $db->database;
            ?>
</em>! Please create a new database with this name or choose another database!</div>
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:9.php

示例12: header

<?php

require "config.php";
if (!isset($_GET['path'])) {
    header("Location: ./404.php");
    exit;
} elseif (is_dir($path = ___realpath(trim($_GET['path'])))) {
    header("Location: ./404.php");
    exit;
}
$fs = new filesystem($path);
xhtml_head(___shortpath($path));
if (!($data = $fs->getpath($path))) {
    echo "<div class=\"error\">\n";
    echo "[<a href=\"./index.php?path=" . urlencode($getcwd) . "\">返回目录</a>]\n";
    echo "</div>\n";
} else {
    echo "<div class=\"love\">\n";
    echo "<a href=\"./index.php?path=" . urlencode(dirname($path)) . "\">[返回]</a>\n<br/>";
    echo "文件名称:" . ___basename($path) . "<br />\n";
    echo "文件大小:" . ___filesize($data['size']) . "<br />\n";
    echo "所有者ID:{$data['uid']}<br />\n";
    echo "所有组ID:{$data['gid']}<br />\n";
    echo "上次访问:" . gmdate("Y-m-d H:i:s", $data['atime'] + TIME) . "<br />\n";
    echo "上次修改:" . gmdate("Y-m-d H:i:s", $data['mtime'] + TIME) . "<br />\n";
    echo "上次改变:" . gmdate("Y-m-d H:i:s", $data['ctime'] + TIME) . "<br />\n";
    echo "</div>\n";
    echo "<div class=\"like\">\n";
    echo "爱特解压<a href=\"./index.php?new&path=" . urlencode(dirname($path)) . "&multiple=unpackdir&getcwd=" . urlencode($path) . "\">目标目录</a>\n";
    echo "</div>\n";
    echo "<div class=\"love\">\n";
开发者ID:simplesky,项目名称:course,代码行数:31,代码来源:file.php

示例13: filetypes

    $_SESSION['email_tmp_file'] = $GO_CONFIG->tmpdir . $filename;
    require $GO_CONFIG->class_path . 'filetypes.class.inc';
    $filetypes = new filetypes();
    $extension = get_extension($filename);
    if (!($type = $filetypes->get_type($extension))) {
        $filetypes->add_type($extesnion, $mime);
    }
}
if ($filename == '') {
    $filename = basename($_SESSION['email_tmp_file']);
} else {
    $filename = smartstrip($filename);
}
if (isset($task) && $task == 'GO_HANDLER') {
    require $GO_CONFIG->class_path . 'filesystem.class.inc';
    $fs = new filesystem();
    if (file_exists(smartstrip($_REQUEST['path']) . '/' . $filename)) {
        $feedback = '<p class="Error">' . $fbNameExists . '</p>';
    } elseif (!$fs->has_write_permission($GO_SECURITY->user_id, smartstrip($_REQUEST['path']))) {
        $feedback = '<p class="Error">' . $strAccessDenied . ': ' . smartstrip($_REQUEST['path']) . '</p>';
    } else {
        $new_path = smartstrip($_REQUEST['path']) . '/' . $filename;
        if ($fs->move($_SESSION['email_tmp_file'], $new_path)) {
            $old_umask = umask(00);
            chmod($new_path, $GO_CONFIG->create_mode);
            umask($old_umask);
            unset($_SESSION['tmp_account_id']);
            unset($_SESSION['email_tmp_file']);
            echo "<script type=\"text/javascript\" language=\"javascript\">\n";
            echo "window.close()\n";
            echo "</script>\n";
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:31,代码来源:save_attachment.php

示例14: header

<?php

require "config.php";
if (!isset($_GET['path'])) {
    header("Location: ./404.php");
    exit;
} elseif (is_dir($path = ___realpath(trim($_GET['path'])))) {
    header("Location: ./404.php");
    exit;
}
$fs = new filesystem($path);
xhtml_head(___shortpath($path));
if (!($data = $fs->getpath($path))) {
    echo "<div class=\"error\">\n";
    echo "[<a href=\"./dlym.php?path=" . urlencode($getcwd) . "\">返回目录</a>]\n";
    echo "</div>\n";
} else {
    echo "<div class=\"like\">\n";
    echo "<a href=\"./dlym.php?path=" . urlencode(dirname($path)) . "\">返回目录</a>文件详情\n";
    echo "</div>\n";
    echo "<div class=\"love\">\n";
    echo "文件名称:" . ___basename($path) . "<br />\n";
    if ($perms = $fs->getperms()) {
        echo "文件权限:{$perms}<br />\n";
    }
    echo "文件大小:" . ___filesize($data['size']) . "<br />\n";
    echo "所有者ID:{$data['uid']}<br />\n";
    echo "所有组ID:{$data['gid']}<br />\n";
    if (function_exists("mime_content_type")) {
        echo "文件类型:" . mime_content_type($path) . "<br />\n";
    }
开发者ID:liuguogen,项目名称:weixin,代码行数:31,代码来源:file.php

示例15: ___realpath

if (!isset($_GET['getcwd'])) {
    $getcwd = OPEN;
} else {
    $getcwd = ___realpath(trim($_GET['getcwd']));
}
xhtml_head("批量复制");
if (!is_dir($gopath = trim($_GET['gopath']))) {
    echo "<div class=\"error\">\n";
    echo "[<a href=\"./multiple.php?type=copy&getcwd=" . urlencode($getcwd) . "\">返回</a>]抱歉,目标目录非法!\n";
    echo "</div>\n";
} elseif (count($_SESSION['flist']) < 1) {
    echo "<div class=\"error\">\n";
    echo "[<a href=\"./dlym.php?path=" . urlencode($getcwd) . "\">返回</a>]抱歉,文件清单为空!\n";
    echo "</div>\n";
} else {
    $i = 0;
    $fs = new filesystem();
    echo "<div class=\"like\">\n";
    echo "<a href=\"./dlym.php?path=" . urlencode($getcwd) . "\">文件列表</a>(操作结果)\n";
    echo "</div>";
    while ($i < count($_SESSION['flist'])) {
        $fs->chpath($_SESSION['flist'][$i]);
        if ($fs->cppath($tmp = $gopath . "/" . ___basename($_SESSION['flist'][$i]))) {
            echo "<div class=\"love\">[{$i}][√]&nbsp;-&nbsp;{$tmp}</div>\n";
        } else {
            echo "<div class=\"error\">[{$i}][×]&nbsp;-&nbsp;{$tmp}</div>\n";
        }
        $i++;
    }
}
xhtml_footer();
开发者ID:liuguogen,项目名称:weixin,代码行数:31,代码来源:copy.php


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