• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP fix_dirname函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: action

 public function action($parent)
 {
     $c = $parent->config;
     $util = new Utility();
     if (strpos($_POST['path'], '/') === 0 || strpos($_POST['path'], '../') !== false || strpos($_POST['path'], './') === 0) {
         $this->r = array('wrong path', 400);
         return;
     }
     $path = $c['current_path'] . $_POST['path'];
     $info = pathinfo($path);
     $base_folder = $c['current_path'] . $util->fix_dirname($_POST['path']) . "/";
     switch ($info['extension']) {
         case "zip":
             $zip = new \ZipArchive();
             if ($zip->open($path) === true) {
                 //make all the folders
                 for ($i = 0; $i < $zip->numFiles; $i++) {
                     $OnlyFileName = $zip->getNameIndex($i);
                     $FullFileName = $zip->statIndex($i);
                     if (substr($FullFileName['name'], -1, 1) == "/") {
                         $util->create_folder($base_folder . $FullFileName['name']);
                     }
                 }
                 //unzip into the folders
                 for ($i = 0; $i < $zip->numFiles; $i++) {
                     $OnlyFileName = $zip->getNameIndex($i);
                     $FullFileName = $zip->statIndex($i);
                     if (!(substr($FullFileName['name'], -1, 1) == "/")) {
                         $fileinfo = pathinfo($OnlyFileName);
                         if (in_array(strtolower($fileinfo['extension']), $ext)) {
                             copy('zip://' . $path . '#' . $OnlyFileName, $base_folder . $FullFileName['name']);
                         }
                     }
                 }
                 $zip->close();
             } else {
                 $this->r = array('Could not extract. File might be corrupt.', 500);
                 return;
             }
             break;
         case "gz":
             $p = new \PharData($path);
             $p->decompress();
             // creates files.tar
             break;
         case "tar":
             // unarchive from the tar
             $phar = new \PharData($path);
             $phar->decompressFiles();
             $files = array();
             $util->check_files_extensions_on_phar($phar, $files, '', $ext);
             $phar->extractTo($current_path . fix_dirname($_POST['path']) . "/", $files, true);
             break;
         default:
             $this->r = array('This extension is not supported. Valid: zip, gz, tar.', 400);
             return;
             break;
     }
 }
开发者ID:Kingtreemonkey,项目名称:FileManager,代码行数:59,代码来源:Extract.php


示例2: config_loading

function config_loading($current_path, $fld)
{
    if (file_exists($current_path . $fld . ".config")) {
        require_once $current_path . $fld . ".config";
        return true;
    }
    echo "!!!!" . ($parent = fix_dirname($fld));
    if ($parent != "." && !empty($parent)) {
        config_loading($current_path, $parent);
    }
    return false;
}
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:12,代码来源:utils.php


示例3: while

 $cycle = TRUE;
 $max_cycles = 50;
 $i = 0;
 while ($cycle && $i < $max_cycles) {
     $i++;
     if ($parent == "./") {
         $parent = "";
     }
     if (file_exists($current_path . $parent . "config.php")) {
         require_once $current_path . $parent . "config.php";
         $cycle = FALSE;
     }
     if ($parent == "") {
         $cycle = FALSE;
     } else {
         $parent = fix_dirname($parent) . "/";
     }
 }
 if (!is_dir($thumbs_path . $subdir)) {
     create_folder(FALSE, $thumbs_path . $subdir);
 }
 if (isset($_GET['popup'])) {
     $popup = strip_tags($_GET['popup']);
 } else {
     $popup = 0;
 }
 //Sanitize popup
 $popup = !!$popup;
 if (isset($_GET['crossdomain'])) {
     $crossdomain = strip_tags($_GET['crossdomain']);
 } else {
开发者ID:PotsonHumer,项目名称:OGS_V2,代码行数:31,代码来源:dialog.php


示例4: while

}
$base = $current_path;
$path = $current_path . $_POST['path'];
$cycle = TRUE;
$max_cycles = 50;
$i = 0;
while ($cycle && $i < $max_cycles) {
    $i++;
    if ($path == $base) {
        $cycle = FALSE;
    }
    if (file_exists($path . "config.php")) {
        require_once $path . "config.php";
        $cycle = FALSE;
    }
    $path = fix_dirname($path) . "/";
    $cycle = FALSE;
}
$path = $current_path . $_POST['path'];
$path_thumb = $thumbs_base_path . $_POST['path'];
if (isset($_POST['name'])) {
    $name = fix_filename($_POST['name'], $transliteration, $convert_spaces, $replace_with);
    if (strpos($name, '../') !== FALSE) {
        response('wrong name', 400)->send();
        exit;
    }
}
$info = pathinfo($path);
if (isset($info['extension']) && !(isset($_GET['action']) && $_GET['action'] == 'delete_folder') && !in_array(strtolower($info['extension']), $ext) && $_GET['action'] != 'create_file') {
    response('wrong extension', 400)->send();
    exit;
开发者ID:ilhammalik,项目名称:yii2-starter,代码行数:31,代码来源:execute.php


示例5: response

                        response(trans('Zip_No_Extract'), 500)->send();
                        exit;
                    }
                    break;
                case "gz":
                    $p = new PharData($path);
                    $p->decompress();
                    // creates files.tar
                    break;
                case "tar":
                    // unarchive from the tar
                    $phar = new PharData($path);
                    $phar->decompressFiles();
                    $files = array();
                    check_files_extensions_on_phar($phar, $files, '', $ext);
                    $phar->extractTo($current_path . fix_dirname($_POST['path']) . "/", $files, true);
                    break;
                default:
                    response(trans('Zip_Invalid'), 400)->send();
                    exit;
            }
            break;
        case 'media_preview':
            $preview_file = $current_path . $_GET["file"];
            $info = pathinfo($preview_file);
            ob_start();
            ?>
			<div id="jp_container_1" class="jp-video " style="margin:0 auto;">
			    <div class="jp-type-single">
			      <div id="jquery_jplayer_1" class="jp-jplayer"></div>
			      <div class="jp-gui">
开发者ID:kipps,项目名称:sri-lanka,代码行数:31,代码来源:ajax_calls.php


示例6: die

    die('wrong path');
}
$path = $storeFolder;
$cycle = true;
$max_cycles = 50;
$i = 0;
while ($cycle && $i < $max_cycles) {
    $i++;
    if ($path == $current_path) {
        $cycle = false;
    }
    if (file_exists($path . "config.php")) {
        require_once $path . "config.php";
        $cycle = false;
    }
    $path = fix_dirname($path) . '/';
}
if (!empty($_FILES)) {
    $info = pathinfo($_FILES['file']['name']);
    if (in_array(fix_strtolower($info['extension']), $ext)) {
        $tempFile = $_FILES['file']['tmp_name'];
        $targetPath = $storeFolder;
        $targetPathThumb = $storeFolderThumb;
        $_FILES['file']['name'] = fix_filename($_FILES['file']['name']);
        if (file_exists($targetPath . $_FILES['file']['name'])) {
            $i = 1;
            $info = pathinfo($_FILES['file']['name']);
            while (file_exists($targetPath . $info['filename'] . ".[" . $i . "]." . $info['extension'])) {
                $i++;
            }
            $_FILES['file']['name'] = $info['filename'] . ".[" . $i . "]." . $info['extension'];
开发者ID:heruprasetya,项目名称:Codeigniter-SMS-Gateway-Gammu,代码行数:31,代码来源:upload.php


示例7: while

 $cycle = true;
 $max_cycles = 50;
 $i = 0;
 while ($cycle && $i < $max_cycles) {
     $i++;
     if ($parent == './') {
         $parent = '';
     }
     if (file_exists($current_path . $parent . 'config.php')) {
         require_once $current_path . $parent . 'config.php';
         $cycle = false;
     }
     if ($parent == '') {
         $cycle = false;
     } else {
         $parent = fix_dirname($parent) . '/';
     }
 }
 if (!is_dir($thumbs_path . $subdir)) {
     create_folder(false, $thumbs_path . $subdir);
 }
 if (isset($_GET['popup'])) {
     $popup = $_GET['popup'];
 } else {
     $popup = 0;
 }
 //Sanitize popup
 $popup = !!$popup;
 //view type
 if (!isset($_SESSION['view_type'])) {
     $view = $default_view;
开发者ID:evgrishin,项目名称:se1614,代码行数:31,代码来源:dialog.php


示例8: receive_uploaded_files


//.........这里部分代码省略.........
                 }
                 $files_data['fullName'] = 'Demo mode<BR>No file storing';
                 array_push($this->files, $files_data);
             }
             unlink($tmpname);
             $cnt++;
             continue;
         }
         //If we get here, the upload is a real one (no demo)
         if ($jupart) {
             // got a chunk of a multi-part upload
             $len = filesize($tmpname);
             $_SESSION[$this->classparams['var_prefix'] . 'size'] += $len;
             if ($len > 0) {
                 $src = fopen($tmpname, 'rb');
                 $dst = fopen($dstname, $jupart == 1 ? 'wb' : 'ab');
                 while ($len > 0) {
                     $rlen = $len > 8192 ? 8192 : $len;
                     $buf = fread($src, $rlen);
                     if (!$buf) {
                         fclose($src);
                         fclose($dst);
                         unlink($dstname);
                         $this->abort('read IO error');
                     }
                     if (!fwrite($dst, $buf, $rlen)) {
                         fclose($src);
                         fclose($dst);
                         unlink($dstname);
                         $this->abort('write IO error');
                     }
                     $len -= $rlen;
                 }
                 fclose($src);
                 fclose($dst);
                 unlink($tmpname);
             }
             if ($jufinal) {
                 // This is the last chunk. Check total lenght and
                 // rename it to it's final name.
                 $dlen = filesize($dstname);
                 if ($dlen != $_SESSION[$this->classparams['var_prefix'] . 'size']) {
                     $this->abort('file size mismatch');
                 }
                 if ($this->appletparams['sendMD5Sum'] == 'true') {
                     if ($md5sums[$cnt] != md5_file($dstname)) {
                         $this->abort('MD5 checksum mismatch');
                     }
                 }
                 // remove zero sized files
                 if ($dlen > 0 || $this->classparams['allow_zerosized']) {
                     $dstfinal = $this->dstfinal($files_data['name'], $files_data['relativePath']);
                     if (!rename($dstname, $dstfinal)) {
                         $this->abort('rename IO error');
                     }
                     $_umask = umask(0);
                     // override the system mask
                     if (!chmod($dstfinal, $this->classparams['fileperm'])) {
                         $this->abort('chmod IO error');
                     }
                     umask($_umask);
                     $files_data['size'] = filesize($dstfinal);
                     $files_data['fullName'] = $dstfinal;
                     $files_data['path'] = fix_dirname($dstfinal);
                     array_push($this->files, $files_data);
                 } else {
                     unlink($dstname);
                 }
                 // reset session var
                 $_SESSION[$this->classparams['var_prefix'] . 'size'] = 0;
             }
         } else {
             // Got a single file upload. Trivial.
             if ($this->appletparams['sendMD5Sum'] == 'true') {
                 if ($md5sums[$cnt] != md5_file($tmpname)) {
                     $this->abort('MD5 checksum mismatch');
                 }
             }
             $dstfinal = $this->dstfinal($files_data['name'], $files_data['relativePath']);
             if (!rename($tmpname, $dstfinal)) {
                 $this->abort('rename IO error');
             }
             $_umask = umask(0);
             // override the system mask
             if (!chmod($dstfinal, $this->classparams['fileperm'])) {
                 $this->abort('chmod IO error');
             }
             umask($_umask);
             $files_data['size'] = filesize($dstfinal);
             $files_data['fullName'] = $dstfinal;
             $files_data['path'] = fix_dirname($dstfinal);
             array_push($this->files, $files_data);
         }
         $cnt++;
     }
     echo $this->appletparams['stringUploadSuccess'] . "\n";
     $_SESSION[$this->classparams['var_prefix'] . 'files'] = $this->files;
     session_write_close();
     exit;
 }
开发者ID:duonghoaikhanh,项目名称:hondabac,代码行数:101,代码来源:jupload.php


示例9: while

include 'jupload.php';
include '../include/utils.php';
$path = $current_path . $_GET['path'];
$cycle = true;
$max_cycles = 50;
$i = 0;
while ($cycle && $i < $max_cycles) {
    $i++;
    if ($path == $current_path) {
        $cycle = false;
    }
    if (file_exists($path . "config.php")) {
        require_once $path . "config.php";
        $cycle = false;
    }
    $path = fix_dirname($path) . DS;
}
$path = $current_path . $_GET['path'];
if (strpos($_GET['path'], '../') !== FALSE || strpos($_GET['path'], './') !== FALSE || strpos($_GET['path'], '/') === 0) {
    die('path error');
}
$path = str_replace([' ', '/'], ['~', DS], $path);
////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////   The user callback function, that can be called after upload   ////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 * This function will be called, once all files are uploaded, with the list of uploaded files as an argument.
 *
 * Condition to have this function called:
 * - Have the applet parameter afterUploadURL unset in this file. This makes the applet use its default behavior, that is: afterUploadURL is
 *  the current web page, with the ?afterupload=1 parameter added.
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:31,代码来源:index.php


示例10: die

			    });
			  </script>
			    
			<?php 
            }
            break;
        case 'copy_cut':
            if ($_POST['sub_action'] != 'copy' && $_POST['sub_action'] != 'cut') {
                die('wrong sub-action');
            }
            if (trim($_POST['path']) == '' || trim($_POST['path_thumb']) == '') {
                die('no path');
            }
            $path = $current_path . $_POST['path'];
            $info = pathinfo($path);
            $base_folder = $current_path . fix_dirname($_POST['path']) . "/";
            if (is_dir($path)) {
                // can't copy/cut dirs
                if ($copy_cut_dirs === FALSE) {
                    die(sprintf(lang_Copy_Cut_Not_Allowed, $_POST['sub_action'] == 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut), lang_Folders));
                }
                // size over limit
                if ($copy_cut_max_size !== FALSE && is_int($copy_cut_max_size)) {
                    if ($copy_cut_max_size * 1024 * 1024 < foldersize($path)) {
                        die(sprintf(lang_Copy_Cut_Size_Limit, $_POST['sub_action'] == 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut), $copy_cut_max_size));
                    }
                }
                // file count over limit
                if ($copy_cut_max_count !== FALSE && is_int($copy_cut_max_count)) {
                    if ($copy_cut_max_count < filescount($path)) {
                        die(sprintf(lang_Copy_Cut_Count_Limit, $_POST['sub_action'] == 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut), $copy_cut_max_count));
开发者ID:beingjungshahi,项目名称:theexcursionnepal,代码行数:31,代码来源:ajax_calls.php


示例11: PharData

                    } else {
                        echo 'failed to open file';
                    }
                    break;
                case "gz":
                    $p = new PharData($path);
                    $p->decompress();
                    // creates files.tar
                    break;
                case "tar":
                    // unarchive from the tar
                    $phar = new PharData($path);
                    $phar->decompressFiles();
                    $files = array();
                    check_files_extensions_on_phar($phar, $files, '', $ext);
                    $phar->extractTo($current_path . fix_dirname($ttH->post['path']) . "/", $files, TRUE);
                    break;
            }
            break;
        case 'media_preview':
            $preview_file = $ttH->get["file"];
            $info = pathinfo($preview_file);
            ?>
<div id="jp_container_1" class="jp-video " style="margin:0 auto;">
    <div class="jp-type-single">
      <div id="jquery_jplayer_1" class="jp-jplayer"></div>
      <div class="jp-gui">
        <div class="jp-video-play">
          <a href="javascript:;" class="jp-video-play-icon" tabindex="1">play</a>
        </div>
        <div class="jp-interface">
开发者ID:duonghoaikhanh,项目名称:shophoa,代码行数:31,代码来源:ajax_calls.php


示例12: chmod

     } else {
         if (is_function_callable('chmod') !== FALSE) {
             chmod($path, 0644);
         }
         echo lang_File_Save_OK;
         $fm->upload($_SESSION['RF']['subfolder'], $path, $parts[count($parts) - 1], "0");
     }
     break;
 case 'rename_file':
     if ($rename_files) {
         $name = fix_filename($name, $transliteration, $convert_spaces, $replace_with);
         if (!empty($name)) {
             if (!rename_file($path, $name, $transliteration)) {
                 die(lang_Rename_existing_file);
             }
             $new_path = fix_dirname($path) . "/" . $name;
             $extenA = explode(".", $path);
             $fm->changePath($new_path . '.' . $extenA[count($extenA) - 1], $path);
             rename_file($path_thumb, $name, $transliteration);
             if ($fixed_image_creation) {
                 $info = pathinfo($path);
                 foreach ($fixed_path_from_filemanager as $k => $paths) {
                     if ($paths != "" && $paths[strlen($paths) - 1] != "/") {
                         $paths .= "/";
                     }
                     $base_dir = $paths . substr_replace($info['dirname'] . "/", '', 0, strlen($current_path));
                     if (file_exists($base_dir . $fixed_image_creation_name_to_prepend[$k] . $info['filename'] . $fixed_image_creation_to_append[$k] . "." . $info['extension'])) {
                         rename_file($base_dir . $fixed_image_creation_name_to_prepend[$k] . $info['filename'] . $fixed_image_creation_to_append[$k] . "." . $info['extension'], $fixed_image_creation_name_to_prepend[$k] . $name . $fixed_image_creation_to_append[$k], $transliteration);
                     }
                 }
             }
开发者ID:shiyake,项目名称:PHP,代码行数:31,代码来源:execute.php


示例13: upload

 function upload()
 {
     if (!defined('FMPATH')) {
         define('FMPATH', 'public/vendor/filemanager/');
     }
     include FMPATH . 'config/config.php';
     if ($_SESSION['RF']["verify"] != "RESPONSIVEfilemanager") {
         die('forbiden');
     }
     include FMPATH . 'include/utils.php';
     if (isset($_POST['path'])) {
         $storeFolder = $_POST['path'];
         $storeFolderThumb = $_POST['path_thumb'];
     } else {
         $storeFolder = $current_path . $_POST["fldr"];
         // correct for when IE is in Compatibility mode
         $storeFolderThumb = $thumbs_base_path . $_POST["fldr"];
     }
     $path_pos = strpos($storeFolder, $current_path);
     $thumb_pos = strpos($storeFolderThumb, $thumbs_base_path);
     if ($path_pos !== 0 || $thumb_pos !== 0 || strpos($storeFolderThumb, '../', strlen($thumbs_base_path)) !== FALSE || strpos($storeFolderThumb, './', strlen($thumbs_base_path)) !== FALSE || strpos($storeFolder, '../', strlen($current_path)) !== FALSE || strpos($storeFolder, './', strlen($current_path)) !== FALSE) {
         die('wrong path');
     }
     $path = $storeFolder;
     $cycle = TRUE;
     $max_cycles = 50;
     $i = 0;
     while ($cycle && $i < $max_cycles) {
         $i++;
         if ($path == $current_path) {
             $cycle = FALSE;
         }
         if (file_exists($path . "config.php")) {
             require_once $path . "config.php";
             $cycle = FALSE;
         }
         $path = fix_dirname($path) . '/';
     }
     if (!empty($_FILES)) {
         $info = pathinfo($_FILES['file']['name']);
         if (in_array(fix_strtolower($info['extension']), $ext)) {
             $tempFile = $_FILES['file']['tmp_name'];
             $targetPath = $storeFolder;
             $targetPathThumb = $storeFolderThumb;
             $_FILES['file']['name'] = fix_filename($_FILES['file']['name'], $transliteration, $convert_spaces, $replace_with);
             // Gen. new file name if exists
             if (file_exists($targetPath . $_FILES['file']['name'])) {
                 $i = 1;
                 $info = pathinfo($_FILES['file']['name']);
                 // append number
                 while (file_exists($targetPath . $info['filename'] . "_" . $i . "." . $info['extension'])) {
                     $i++;
                 }
                 $_FILES['file']['name'] = $info['filename'] . "_" . $i . "." . $info['extension'];
             }
             $targetFile = $targetPath . $_FILES['file']['name'];
             $targetFileThumb = $targetPathThumb . $_FILES['file']['name'];
             // check if image (and supported)
             if (in_array(fix_strtolower($info['extension']), $ext_img)) {
                 $is_img = TRUE;
             } else {
                 $is_img = FALSE;
             }
             // upload
             move_uploaded_file($tempFile, $targetFile);
             chmod($targetFile, 0755);
             if ($is_img) {
                 $memory_error = FALSE;
                 if (!create_img($targetFile, $targetFileThumb, 122, 91)) {
                     $memory_error = FALSE;
                 } else {
                     // TODO something with this long function baaaah...
                     if (!new_thumbnails_creation($targetPath, $targetFile, $_FILES['file']['name'], $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $relative_image_creation_option, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height, $fixed_image_creation_option)) {
                         $memory_error = FALSE;
                     } else {
                         $imginfo = getimagesize($targetFile);
                         $srcWidth = $imginfo[0];
                         $srcHeight = $imginfo[1];
                         // resize images if set
                         if ($image_resizing) {
                             if ($image_resizing_width == 0) {
                                 if ($image_resizing_height == 0) {
                                     $image_resizing_width = $srcWidth;
                                     $image_resizing_height = $srcHeight;
                                 } else {
                                     $image_resizing_width = $image_resizing_height * $srcWidth / $srcHeight;
                                 }
                             } elseif ($image_resizing_height == 0) {
                                 $image_resizing_height = $image_resizing_width * $srcHeight / $srcWidth;
                             }
                             // new dims and create
                             $srcWidth = $image_resizing_width;
                             $srcHeight = $image_resizing_height;
                             create_img($targetFile, $targetFile, $image_resizing_width, $image_resizing_height, $image_resizing_mode);
                         }
                         //max resizing limit control
                         $resize = FALSE;
                         if ($image_max_width != 0 && $srcWidth > $image_max_width && $image_resizing_override === FALSE) {
                             $resize = TRUE;
                             $srcWidth = $image_max_width;
//.........这里部分代码省略.........
开发者ID:nurulimamnotes,项目名称:pusakacms,代码行数:101,代码来源:Panel.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP fix_filename函数代码示例发布时间:2022-05-15
下一篇:
PHP fix_date函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap