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


PHP rchmod函数代码示例

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


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

示例1: action

 public function action()
 {
     $mode = $_POST['new_mode'];
     $rec_option = $_POST['is_recursive'];
     $valid_options = array('none', 'files', 'folders', 'both');
     $chmod_perm = is_dir($path) ? $chmod_dirs : $chmod_files;
     // check perm
     if ($chmod_perm === FALSE) {
         $fileORfolder = is_dir($path) ? 'folders' : 'files';
         $response = "Changing" . $fileORfolder . "permissions are not allowed.";
         $this->r = array($response, 403);
         return;
     }
     // check mode
     if (!preg_match("/^[0-7]{3}\$/", $mode)) {
         $this->r = array('The supplied permission mode is incorrect.', 400);
         return;
     }
     // check recursive option
     if (!in_array($rec_option, $valid_options)) {
         $this->r = array("wrong option", 400);
         return;
     }
     // check if server disabled chmod
     if (is_function_callable('chmod') === FALSE) {
         $this->r = array('The chmod function has been disabled by the server.', 'chmod', 403);
         return;
     }
     $mode = "0" . $mode;
     $mode = octdec($mode);
     rchmod($path, $mode, $rec_option);
 }
开发者ID:Kingtreemonkey,项目名称:FileManager,代码行数:32,代码来源:Chmod.php

示例2: rchmod

function rchmod($source, $mode, $rec_option = "none", $is_rec = FALSE)
{
    if ($rec_option == "none") {
        chmod($source, $mode);
    } else {
        if ($is_rec === FALSE) {
            chmod($source, $mode);
        }
        $files = scandir($source);
        foreach ($files as $file) {
            if ($file != "." && $file != "..") {
                if (is_dir($source . DIRECTORY_SEPARATOR . $file)) {
                    if ($rec_option == "folders" || $rec_option == "both") {
                        chmod($source . DIRECTORY_SEPARATOR . $file, $mode);
                    }
                    rchmod($source . DIRECTORY_SEPARATOR . $file, $mode, $rec_option, TRUE);
                } else {
                    if ($rec_option == "files" || $rec_option == "both") {
                        chmod($source . DIRECTORY_SEPARATOR . $file, $mode);
                    }
                }
            }
        }
    }
}
开发者ID:Vatia13,项目名称:funtime,代码行数:25,代码来源:utils.php

示例3: response

         response(trans('File_Permission_Wrong_Mode'), 400)->send();
         exit;
     }
     // check recursive option
     if (!in_array($rec_option, $valid_options)) {
         response("wrong option", 400)->send();
         exit;
     }
     // check if server disabled chmod
     if (is_function_callable('chmod') === FALSE) {
         response(sprintf(trans('Function_Disabled'), 'chmod'), 403)->send();
         exit;
     }
     $mode = "0" . $mode;
     $mode = octdec($mode);
     rchmod($path, $mode, $rec_option);
     break;
 case 'save_text_file':
     $content = $_POST['new_content'];
     // $content = htmlspecialchars($content); not needed
     // $content = stripslashes($content);
     // no file
     if (!file_exists($path)) {
         response(trans('File_Not_Found'), 404)->send();
         exit;
     }
     // not writable or edit not allowed
     if (!is_writable($path) || $edit_text_files === FALSE) {
         response(sprintf(trans('File_Open_Edit_Not_Allowed'), strtolower(trans('Edit'))), 403)->send();
         exit;
     }
开发者ID:ilhammalik,项目名称:yii2-starter,代码行数:31,代码来源:execute.php

示例4: changePermissions

 public function changePermissions()
 {
     $this->log('<comment>~ Changing permissions</comment>');
     rchmod(storage_path(), 0777, 0777);
     rchmod(base_path('bootstrap/cache'), 0777, 0777);
     if ($this->post('db_type') == 'sqlite') {
         $db_name = $this->post('db_name', '');
         rchmod($this->baseDirectory . DIRECTORY_SEPARATOR . $db_name, 0777, 0777);
     }
     $this->log('<info>[ + ] Changing permissions [OK]</info>');
 }
开发者ID:zedx,项目名称:core,代码行数:11,代码来源:Installer.php

示例5: rchmod

 /**
  * Recursive chmod.
  *
  * @param string $path
  * @param int    $filePerm
  * @param int    $dirPerm
  *
  * @return bool
  */
 function rchmod($path, $filePerm = 0644, $dirPerm = 0755)
 {
     if (!file_exists($path)) {
         return false;
     }
     if (is_file($path)) {
         chmod($path, $filePerm);
     } elseif (is_dir($path)) {
         $foldersAndFiles = scandir($path);
         $entries = array_slice($foldersAndFiles, 2);
         foreach ($entries as $entry) {
             rchmod($path . DIRECTORY_SEPARATOR . $entry, $filePerm, $dirPerm);
         }
         chmod($path, $dirPerm);
     }
     return true;
 }
开发者ID:zedx,项目名称:core,代码行数:26,代码来源:helpers.php

示例6: rchmod

function rchmod($path, $filemode, $dirmode)
{
    if (is_dir($path)) {
        if (!chmod($path, $dirmode)) {
            return false;
        }
        $objects = scandir($path);
        if (is_array($objects)) {
            foreach ($objects as $file) {
                if ($file != '.' && $file != '..') {
                    if (!rchmod($path . '/' . $file, $filemode, $dirmode)) {
                        return false;
                    }
                }
            }
        }
        return true;
    } elseif (is_link($path)) {
        return true;
    } elseif (is_file($path)) {
        return chmod($path, $filemode);
    }
    return false;
}
开发者ID:LNDDYL,项目名称:filemanager,代码行数:24,代码来源:filemanager.php


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