本文整理汇总了PHP中is_function_callable函数的典型用法代码示例。如果您正苦于以下问题:PHP is_function_callable函数的具体用法?PHP is_function_callable怎么用?PHP is_function_callable使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_function_callable函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: response
if ($chmod_perm === FALSE) {
response(sprintf(trans('File_Permission_Not_Allowed'), is_dir($path) ? lcfirst(trans('Folders')) : lcfirst(trans('Files'))), 403)->send();
exit;
}
// check mode
if (!preg_match("/^[0-7]{3}\$/", $mode)) {
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;
示例3: response
// can't copy/cut files
if ($copy_cut_files === false) {
response(sprintf(trans('Copy_Cut_Not_Allowed'), $_POST['sub_action'] == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut')), trans('Files')), 403)->send();
exit;
}
}
$_SESSION['RF']['clipboard']['path'] = $_POST['path'];
$_SESSION['RF']['clipboard_action'] = $_POST['sub_action'];
break;
case 'clear_clipboard':
$_SESSION['RF']['clipboard'] = null;
$_SESSION['RF']['clipboard_action'] = null;
break;
case 'chmod':
$path = $current_path . $_POST['path'];
if (is_dir($path) && $chmod_dirs === false || is_file($path) && $chmod_files === false || is_function_callable("chmod") === false) {
response(sprintf(trans('File_Permission_Not_Allowed'), is_dir($path) ? lcfirst(trans('Folders')) : lcfirst(trans('Files')), 403), 400)->send();
exit;
} else {
$perm = decoct(fileperms($path) & 0777);
$perm_user = substr($perm, 0, 1);
$perm_group = substr($perm, 1, 1);
$perm_all = substr($perm, 2, 1);
$ret = '<div id="files_permission_start">
<form id="chmod_form">
<table class="table file-perms-table">
<thead>
<tr>
<td></td>
<td>r </td>
<td>w </td>
示例4: die
// can't copy/cut files
if ($copy_cut_files === FALSE) {
die(sprintf(lang_Copy_Cut_Not_Allowed, $_POST['sub_action'] == 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut), lang_Files));
}
}
$_SESSION['RF']['clipboard']['path'] = $_POST['path'];
$_SESSION['RF']['clipboard']['path_thumb'] = $_POST['path_thumb'];
$_SESSION['RF']['clipboard_action'] = $_POST['sub_action'];
break;
case 'clear_clipboard':
$_SESSION['RF']['clipboard'] = NULL;
$_SESSION['RF']['clipboard_action'] = NULL;
break;
case 'chmod':
$path = $current_path . $_POST['path'];
if (is_dir($path) && $chmod_dirs === FALSE || is_file($path) && $chmod_files === FALSE || is_function_callable("chmod") === FALSE) {
die(sprintf(lang_File_Permission_Not_Allowed, is_dir($path) ? lcfirst(lang_Folders) : lcfirst(lang_Files)));
} else {
$perm = decoct(fileperms($path) & 0777);
$perm_user = substr($perm, 0, 1);
$perm_group = substr($perm, 1, 1);
$perm_all = substr($perm, 2, 1);
$ret = '<div id="files_permission_start">
<form id="chmod_form">
<table class="file-perms-table">
<thead>
<tr>
<td></td>
<td>r </td>
<td>w </td>
<td>x </td>
示例5: die
die;
}
// user wants to paste folder to it's own sub folder.. baaaah.
if (is_dir($data['path']) && strpos($path, $data['path']) !== FALSE) {
die;
}
// something terribly gone wrong
if ($action != 'copy' && $action != 'cut') {
die('no action');
}
// check for writability
if (is_really_writable($path) === FALSE || is_really_writable($path_thumb) === FALSE) {
die($path . '--' . $path_thumb . '--' . lang_Dir_No_Write);
}
// check if server disables copy or rename
if (is_function_callable($action == 'copy' ? 'copy' : 'rename') === FALSE) {
die(sprintf(lang_Function_Disabled, $action == 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)));
}
if ($action == 'copy') {
rcopy($data['path'], $path);
rcopy($data['path_thumb'], $path_thumb);
} elseif ($action == 'cut') {
rrename($data['path'], $path);
rrename($data['path_thumb'], $path_thumb);
// cleanup
if (is_dir($data['path']) === TRUE) {
rrename_after_cleaner($data['path']);
rrename_after_cleaner($data['path_thumb']);
}
}
// cleanup