本文整理汇总了PHP中check_file函数的典型用法代码示例。如果您正苦于以下问题:PHP check_file函数的具体用法?PHP check_file怎么用?PHP check_file使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scan
function scan($dir, $ext, $callback, $find = array(), $replace = array())
{
$result = array();
if (!is_dir($dir)) {
return $result;
}
$args = func_get_args();
// print_r($args);
$args = array_slice($args, 3, null, true);
// print_r($args);exit;
$fp = scandir($dir);
if ($fp) {
foreach ($fp as $v) {
if ($v == '.' || $v == '..') {
continue;
}
if (is_dir($dir . '/' . $v)) {
$end = scan($dir . '/' . $v, $ext, $callback, $find, $replace);
if ($end) {
$result = array_merge($result, $end);
}
} else {
if (check_file($dir . '/' . $v, $ext)) {
$args = array($dir . '/' . $v, $find, $replace);
$end = call_user_func_array($callback, $args);
if ($end) {
$result[] = $end;
}
}
}
}
}
return $result;
}
示例2: download_file
function download_file($src, $fname, $convert_path)
{
global $error;
$download_file = "albumart/" . $fname;
debuglog(" Downloading Image " . $src . " to " . $download_file, "GETALBUMCOVER");
if (file_exists($download_file)) {
unlink($download_file);
}
$aagh = url_get_contents($src, $_SERVER['HTTP_USER_AGENT']);
$fp = fopen($download_file, "x");
if ($fp) {
fwrite($fp, $aagh['contents']);
fclose($fp);
check_file($download_file, $aagh['contents']);
$o = array();
$c = $convert_path . "identify \"" . $download_file . "\" 2>&1";
// debuglog(" Command is ".$c,"GETALBUMCOVER");
$r = exec($c, $o);
debuglog(" Return value from identify was " . $r, "GETALBUMCOVER");
if ($r == '' || preg_match('/GIF 1x1/', $r) || preg_match('/unable to open/', $r) || preg_match('/no decode delegate/', $r)) {
debuglog(" Broken/Invalid file returned", "GETALBUMCOVER");
$error = 1;
}
} else {
debuglog(" File open failed!", "GETALBUMCOVER");
$error = 1;
}
return $download_file;
}
示例3: movies_storing
function movies_storing($db, $filename = "movies.csv")
{
if (check_file($filename)) {
$collection = $db->createCollection("movies");
$i = parse_file($collection, get_data($filename));
echo $i . " movies successfully stored !\n";
}
}
示例4: check_dir
function check_dir($dir, &$functions)
{
// Collect files and diretcories in these arrays
$directories = array();
$files = array();
// Open and traverse the directory
$handle = @opendir($dir);
while ($file = @readdir($handle)) {
// Collect XML files
if (strstr($file, ".xml")) {
$files[] = $file;
}
}
@closedir($handle);
// Sort and check files
sort($files);
foreach ($files as $file) {
check_file($dir, $file, $functions);
}
}
示例5: file_list
function file_list($path, $sub_flag, $file_type)
{
global $file_nums_all;
global $file_nums_use;
global $file_use_arr;
system("net use " . $path . " /user:kundyZhang cv0837CVJ ");
$file_type_arr = explode(",", $file_type);
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($path . "\\" . $file)) {
//echo StripSlashes($path)."\\".$file."<br>";//目录名称
if ($sub_flag == "1") {
file_list($path . "\\\\" . $file, "1", $file_type);
}
} else {
//echo StripSlashes($path)."\\".$file."<br>";//文件名称
$file_nums_all++;
$check_file_type = check_file($file);
if (in_array($check_file_type["type"], $file_type_arr)) {
$file_nums_use++;
array_push($file_use_arr, StripSlashes($path) . "\\" . $file);
}
}
}
}
}
}
示例6: check_target
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<?php
include "./navbar.php";
?>
</nav>
<div class="container-fluid main main-signup">
<div class="row">
<?php
if (isset($_POST['submit']) && $_POST['submit'] == "Valider") {
$success = "Bienvenue ";
$tmp = $_POST;
check_target();
if (check_file() == 1) {
$file = file_get_contents("./private/passwd");
$accounts = unserialize($file);
if (dont_exists($accounts, $_POST['s_email']) == 1) {
$accounts[] = createaccount($tmp);
$serialized = serialize($accounts);
file_put_contents("./private/passwd", $serialized);
$_SESSION['logged_on_user'] = $_POST['s_prenom'];
echo '<div class="col-sm-offset-3 col-sm-6 signin_form">
<form class="signup_form"">
<div class="form-group">
<p class="welcome_message">Bienvenue ' . $_SESSION['logged_on_user'] . '</p>
</div>
</form>
</div>';
} else {
示例7: list
if (isset($ExtraTor->Dec['encrypted_files'])) {
$Err = 'At least one of the torrents contain an encrypted file list which is not supported here';
break;
}
if (!$ExtraTor->is_private()) {
$ExtraTor->make_private();
// The torrent is now private.
$PublicTorrent = true;
}
// File list and size
list($ExtraTotalSize, $ExtraFileList) = $ExtraTor->file_list();
$ExtraDirName = isset($ExtraTor->Dec['info']['files']) ? Format::make_utf8($ExtraTor->get_name()) : '';
$ExtraTmpFileList = array();
foreach ($ExtraFileList as $ExtraFile) {
list($ExtraSize, $ExtraName) = $ExtraFile;
check_file($Type, $ExtraName);
// Make sure the file name is not too long
if (mb_strlen($ExtraName, 'UTF-8') + mb_strlen($ExtraDirName, 'UTF-8') + 1 > MAX_FILENAME_LENGTH) {
$Err = "The torrent contained one or more files with too long of a name: <br />{$ExtraDirName}/{$ExtraName}";
break;
}
// Add file and size to array
$ExtraTmpFileList[] = Torrents::filelist_format_file($ExtraFile);
}
// To be stored in the database
$ThisInsert['FilePath'] = db_string($ExtraDirName);
$ThisInsert['FileString'] = db_string(implode("\n", $ExtraTmpFileList));
$ThisInsert['InfoHash'] = pack('H*', $ExtraTor->info_hash());
$ThisInsert['NumFiles'] = count($ExtraFileList);
$ThisInsert['TorEnc'] = db_string($ExtraTor->encode());
$ThisInsert['TotalSize'] = $ExtraTotalSize;
示例8: get_current_user
if (function_exists('get_current_user')) {
echo 'B. running user ' . get_current_user() . " \n";
} else {
echo 'B. running user ' . 'NOT available' . " \n";
}
if (function_exists('getmyuid')) {
echo 'C. script owner ' . getmyuid() . " \n";
} else {
echo 'C. script owner ' . 'NOT available' . " \n";
}
define('ROOT', dirname(__FILE__));
define('APPLICATION_PATH', ROOT . '/application');
define('LIBRARY_PATH', ROOT . '/library');
define('FILES_DIR', ROOT . '/upload');
// place where we will upload project files
define('CACHE_DIR', ROOT . '/cache');
define('THEMES_DIR', ROOT . '/public/assets/themes');
define('PLUGINS_DIR', APPLICATION_PATH . '/plugins');
check_directory(ROOT);
check_directory(APPLICATION_PATH);
check_directory(LIBRARY_PATH);
check_directory(FILES_DIR);
check_directory(CACHE_DIR);
check_directory(PLUGINS_DIR);
check_directory(ROOT . '/config');
check_directory(ROOT . '/public');
check_file(ROOT . '/config/config.php');
check_file(ROOT . '/cache/autoloader.php');
check_file(ROOT . '/cache/trace.txt');
check_file(ROOT . '/cache/log.php');
示例9: delete_file
/**
* Delete file
*
* @param string|array $file
*
* @return boolean
*
* @throws \Exception
*/
function delete_file($file)
{
//Delete list of files
if (is_array($file) && count($file)) {
foreach ($file as $one) {
delete_file($one);
}
return true;
}
if (check_file($file)) {
try {
\Illuminate\Support\Facades\File::delete($file);
} catch (Exception $ex) {
throw new \Exception('Whoop!! Can not delete file. ' . $ex->getMessage());
}
}
return true;
}
示例10: check_file
global $usage;
// check for valid filename
if (!is_file($name)) {
echo 'ERROR (' . $desc . '): "' . $name . '" is not a file' . "\n";
echo $usage;
exit;
}
if (!is_readable($name)) {
echo 'ERROR (' . $desc . '): "' . $name . '" is not readable' . "\n";
echo $usage;
exit;
}
}
check_file($args['f'], 'test case file');
if (!empty($args['c'])) {
check_file($args['c'], 'configuration file');
}
$classes_old = get_declared_classes();
echo "\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\nRunning all in {$args['f']}\n";
ob_start();
include_once $args['f'];
foreach (array_diff(get_declared_classes(), $classes_old) as $newclass) {
$r = new ReflectionClass($newclass);
if ($r->isSubclassOf($unitTestBaseClass)) {
echo "{$newclass}:\n";
$testcase = new $newclass();
$testcase->{$unitTestRunMethod}();
}
}
ob_end_flush();
echo "\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n";
示例11: clearInput
<?php
require_once 'lib.php';
if (isset($_GET['file'])) {
//Получение названия файла
$edit_file = clearInput($_GET['file'], 's');
// Проверка на наличие файла в папке
if (!check_file($edit_file, $files)) {
$errors[] = "Sorry, but file does not exist";
}
}
?>
<!doctype html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=1000">
<title>Просмотр</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<div class="wrap">
<div class="container">
<h3>Просмотр текста</h3>
<div>
<?php
echo file_read($edit_file);
?>
</div>
示例12: filter_input_array
<?php
require __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'setting.php';
$clean = filter_input_array(INPUT_GET, array('CKEditorFuncNum' => FILTER_VALIDATE_INT));
$clean['upload'] = check_file($_FILES['upload']);
move_file($clean['upload'], 'ckeditor', $_SESSION['USER_ID']);
if (class_exists("Imagick")) {
/*** the image file ***/
$image = UPLOAD_DIRECTORY . '/ckeditor/' . $_SESSION['USER_ID'] . '/' . $clean['upload']['name'];
/*** a new imagick object ***/
$im = new Imagick();
/*** ping the image ***/
$im->pingImage($image);
/*** read the image into the object ***/
$im->readImage($image);
/*** thumbnail the image ***/
$im->resizeImage(760, 0, Imagick::FILTER_LANCZOS, 1);
/*** Write the thumbnail to disk ***/
$im->writeImage();
/*** Free resources associated with the Imagick object ***/
$im->destroy();
echo UPLOAD_DIRECTORY . '/ckeditor/' . $_SESSION['USER_ID'] . '/' . $clean['upload']['name'];
} else {
echo '2';
}
// require WEBROOT_DIRECTORY . DIRECTORY_SEPARATOR . 'phpThumb' . DIRECTORY_SEPARATOR . 'phpThumb.config.php';
$url = '/uploads/ckeditor/' . $_SESSION['USER_ID'] . '/' . $clean['upload']['name'];
echo '<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction(' . $clean['CKEditorFuncNum'] . ',"' . $url . '","업로드 완료")</script>';
示例13: array
<?php
/**
** @Author: Guillermina Gonjon
** @Application_name: Contributions
** @version: 0.1 // -Alpha
** @email: ggonjon@gmail.com
** @file_name: index.php // Main interface
** @license: GPL
**/
require_once './initializer.inc.php';
$main_files = array(CONFIG_DIRECTORY => 'configDb.class.php');
require_once './templates/GManonTemplate.class.php';
$style = file_get_contents('./templates/style/style.css');
$vars = array('PAGE_TITLE' => 'This is my title', 'STYLE' => $style, 'TOP_MENU' => 'HOME | CONTACT | WE | WHATYOULIKE', 'USER_MENU' => 'ME | YO | WHATIAMALLOWED', 'PAGE_SEARCH' => 'Search Form goes here', 'MAIN_MENU' => 'Catalog | SeeThis | Continue here', 'CONTENT_PAGE' => 'The lines come here. This is the actual content.', 'FOOTER' => 'Get this at the foot of the page');
$gmtemplate = new GManonTemplate();
echo $gmtemplate->replaceVars($vars, "./templates/template.inc.php");
foreach ($main_files as $directory => $file) {
check_file($directory, $file);
}
示例14: ob_start
* (at your option) any later version. Although none of the code may be
* sold. If you have been sold this script, get a refund.
***************************************************************************/
ob_start('ob_gzhandler');
header("Content-type: text/javascript");
include 'includes/checks/files.php';
if (isset($_GET['js'])) {
$js = explode(';', $_GET['js']);
foreach ($js as $val) {
$ext = substr($val, strrpos($val, '.') + 1);
if ($ext == 'php') {
if (check_file($val)) {
include $val;
}
} elseif ($ext == 'js' || $ext == 'css') {
if (check_file($val) && is_file($val)) {
echo file_get_contents($val);
echo "\n";
}
}
}
}
ob_end_flush();
function check_file($file)
{
global $file_allowed;
$tmp = $file_allowed;
$folders = explode('/', $file);
foreach ($folders as $val) {
if (isset($tmp[$val])) {
$tmp = $tmp[$val];
示例15: process_upload_zip
function process_upload_zip()
{
$pano_id = $_GET['id'];
// Make a pano file at the directory if it doesn't exist
$pano_directory = ABSPATH . "wp-content/panos/";
// If the upload directory doesn't exist, make it
if (!check_file($pano_directory)) {
mkdir($pano_directory, 0755, true);
}
// Setting up the file path and target path
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : $_FILES["file"]["name"];
$filePath = $pano_directory . "pano" . $pano_id . ".zip";
$target_path = $pano_directory . $pano_id;
// Creates the target path if it doesnt exist
if (!check_file($target_path)) {
mkdir($target_path, 0755, true);
}
// Displays an error if the file was not uploaded
if (empty($_FILES) || $_FILES['file']['error']) {
die('{"OK": 0, "info": "Failed to move uploaded file."}');
}
// Using Plupload Chunks
$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
// Open temp file
$out = @fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab");
if ($out) {
// Read binary input stream and append it to temp file
$in = @fopen($_FILES['file']['tmp_name'], "rb");
if ($in) {
while ($buff = fread($in, 4096)) {
fwrite($out, $buff);
}
} else {
die('{"OK": 0, "info": "Failed to open input stream."}');
}
@fclose($in);
@fclose($out);
@unlink($_FILES['file']['tmp_name']);
} else {
die('{"OK": 0, "info": "Failed to open output stream."}');
}
// Check if file has been uploaded
if (!$chunks || $chunk == $chunks - 1) {
// Strip the temp .part suffix off
rename("{$filePath}.part", $filePath);
// Unzips the file and moves it to the target path
$zip = new ZipArchive();
$x = $zip->open($filePath, ZIPARCHIVE::CREATE | ZIPARCHIVE::CREATE);
if ($x === true) {
$zip->extractTo($target_path);
// change this to the correct site path
$zip->close();
unlink($filePath);
}
}
die('{"OK": 1, "info": "Upload successful."}');
}