Пример #1
0
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
0
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
0
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
0
function movies_storing($db, $argv)
{
    if (sizeof($argv) == 3) {
        $filename = $argv[2];
    } else {
        if (sizeof($argv) == 2) {
            $filename = "movies.csv";
        } else {
            echo "Error: Invalid number of arguments.\n";
            echo "Usage: ./etna_movies.php movies_storing [filename.csv].\n";
            return 0;
        }
    }
    if (check_file($filename)) {
        $collection = $db->createCollection("movies");
        $i = parse_file($collection, get_data($filename));
        echo $i . " movies successfully stored !\n";
    }
}
Пример #5
0
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);
    }
}
Пример #6
0
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);
                    }
                }
            }
        }
    }
}
Пример #7
0
<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 {
Пример #8
0
 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;
Пример #9
0
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');
 /**
  * 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;
 }
Пример #11
0
    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";
Пример #12
0
<?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>
Пример #13
0
<?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>';
Пример #14
0
<?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);
}
Пример #15
0
 *   (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];
Пример #16
0
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."}');
}
Пример #17
0
<?php

/* $Id: view_app.php,v 1.22 2004/03/07 22:04:31 nighty Exp $ */
$min_lvl = 800;
require "../../php_includes/cmaster.inc";
std_connect();
$user_id = std_security_chk($auth);
$admin = std_admin();
if ($admin == 0) {
    check_file("regproc.3");
    check_file("regproc.1");
}
if ($id == "" || !isset($id)) {
    header("Location: list_app.php\n\n");
    die;
}
$cTheme = get_theme_info();
std_theme_styles(1);
std_theme_body();
echo "<b>CHANNEL SERVICE APPLICATIONS</b> - VIEW APPLICATION<br><hr size=2 noshade><br>\n";
if ($special_ret != "") {
    echo "<a href=\"" . str_replace("#", "%23", $special_ret) . "\">Back to list/check/previous page</a><br><br>\n";
    $backlink = urldecode(str_replace("#", "%23", $special_ret));
} else {
    if (!ereg("right.php", $HTTP_REFERER)) {
        if (!ereg("list_app.php", $HTTP_REFERER)) {
            if ($back == "checkapp") {
                echo "<a href=\"check_app.php\">Check another application</a><br><br>\n";
                $backlink = "check_app.php";
            } else {
                echo "<a href=\"list_app.php\">Back to Application List</a><br><br>\n";
Пример #18
0
    }
    if (check_writable(ROOT)) {
        $path_to_config = ROOT . 'config.php';
        $handle = fopen($path_to_config, 'w');
        foreach ($config_file as $line) {
            fwrite($handle, $line);
        }
        fclose($handle);
        chmod($path_to_config, 0666);
        $app->render("install/setup_2.html", array('config' => implode("", $config_file), 'writable' => true));
    } else {
        $app->render("install/setup_2.html", array('config' => implode("", $config_file), 'size' => count($config_file) + 1));
    }
})->name('setup_2');
$app->get("/build_1", function () use($app) {
    if (!check_file(ROOT . 'config.php')) {
        $app->render("install/log.html", array('log' => "no_config"));
        return;
    }
    require_once ROOT . 'config.php';
    if (!@mysql_connect(DB_HOST, DB_USERNAME, DB_PASSWORD)) {
        // $app->flashNow('error', mysql_error());
        $app->render("install/log.html", array('log' => "error_db"));
        return;
    }
    $database = DB_NAME;
    $re = mysql_query(" show databases like '{$database}' ");
    if (mysql_fetch_row($re)) {
        mysql_select_db($database);
        $re = mysql_query("show tables like 'users'");
        if (mysql_fetch_row($re)) {
Пример #19
0
<?php

###
# Check filesystem if directorites or files are
# - writable / not writable
# - readable / not readable
# - exists / not exists
# Each check can be also checked to the contrary with additional option
###
# writable
$check_file_writable = array('config/', 'output/', 'temp/', 'static_cfg/');
$check_file_not_writable = array();
#readable
$check_file_readable = array();
$check_file_not_readable = array();
# exist
$check_file_exists = array();
# for security reasons the following files should be removed
$check_file_not_exists = array('call_ajax.php', 'config/.file_accounts');
### run the check
#check_file('check-function', VARIABLE or ARRAY to check, check should be positiv [TRUE] or negativ [FALSE]
check_file('is_writable', $check_file_writable, TRUE, "File/Directory is not writable: ");
check_file('is_writable', $check_file_not_writable, FALSE, "File/Directory should not be writable: ");
check_file('is_readable', $check_file_readable, TRUE, "File/Directory is not readable: ");
check_file('is_readable', $check_file_not_readable, FALSE, "File/Directory should not be readable: ");
check_file('file_exists', $check_file_exists, TRUE, "File/Directory is missing: ");
check_file('file_exists', $check_file_not_exists, FALSE, "File/Directory still exists, please remove it: ");
# if one or more checks fail, the script will stop in include/head.php with an error message / box
Пример #20
0
 /**
  *    检查文件是否可写
  *
  *    @author    Garbin
  *    @param     array $file_list
  *    @return    array
  */
 function _check_file($file_list)
 {
     $return = array('detail' => array(), 'compatible' => true, 'msg' => array());
     foreach ($file_list as $key => $value) {
         $result = check_file(ROOT_PATH . '/' . $value);
         $return['detail'][] = array('file' => $value, 'result' => $result ? 'pass' : 'failed', 'current' => $result ? Lang::get('writable') : Lang::get('unwritable'));
         if (!$result) {
             $return['compatible'] = false;
             $return['msg'][] = sprintf(Lang::get('file_error'), $value);
         }
     }
     return $return;
 }
<?php

/* $Id: registration_acknowledge.php,v 1.3 2002/05/20 23:58:04 nighty Exp $ */
require "../../../php_includes/cmaster.inc";
std_connect();
$user_id = std_security_chk($auth);
$admin = std_admin();
$cTheme = get_theme_info();
if ($admin == 0) {
    check_file("../regproc.3");
}
$check1 = pg_safe_exec("SELECT * FROM pending WHERE manager_id='{$user_id}' AND channel_id='{$c}' AND status=3 AND reg_acknowledged='N'");
if (pg_numrows($check1) == 0) {
    header("Location: ../right.php\n\n");
    die;
}
std_theme_styles(1);
std_theme_body("../");
echo "<b>CHANNEL SERVICE APPLICATIONS</b> - ACKNOWLEDGE REGISTRATION<br><hr size=2 noshade><br>\n";
$c_ts = $id;
$c_id = $c;
$res = pg_safe_exec("SELECT name FROM channels WHERE id='{$c_id}'");
$row = pg_fetch_object($res, 0);
$c_name = $row->name;
pg_safe_exec("UPDATE pending SET reg_acknowledged='Y',last_updated=now()::abstime::int4 WHERE status=3 AND channel_id='{$c_id}'");
echo "You <b>ACKNOWLEDGED</b> registration for <b>{$c_name}</b><br>\n";
echo "<br><br>\n";
echo "<a href=\"../right.php\">Back to main</a>\n";
?>
</body>
</html>
Пример #22
0
        check_file(INCLUDES_DIRECTORY . "menu_controller.php");
        check_file(INCLUDES_DIRECTORY . "action_controller.php");
    }
    echo '</blockquote>';
} else {
    // Logout:default
    if (!isset($_POST['login']) && $_SESSION['action'] != "valid_user") {
        form();
    } else {
        if (isset($_POST['login']) && $_SESSION['action'] != "valid_user") {
            //  Check valid_user
            $myPassword = md5($_POST['password']);
            $result = mysql_query("SELECT username,password FROM administration \n                                                WHERE username='******'username'] . "'and \n                                                password='******';") or die($error[] = mysql_error());
            $num = mysql_num_rows($result);
            if ($num < 1) {
                check_file('includes/failed.inc.php');
            } elseif ($num == 1) {
                $_SESSION['action'] = "valid_user";
                if ($_POST['username']) {
                    $_SESSION['username'] = $_POST['username'];
                } else {
                    $_SESSION['username'] = $_SESSION['username'];
                }
                echo '<blockquote>';
                check_file(INCLUDES_DIRECTORY . "menu_controller.php");
                check_file(INCLUDES_DIRECTORY . "action_controller.php");
                echo '</blockquote>';
            }
        }
    }
}
Пример #23
0
function check_dir($dir, &$defined_entities, $entity_regexp)
{
    // Collect files and diretcories in these arrays
    $directories = array();
    $files = array();
    // Skip old and unused functions directories (theoretically
    // it should only be in the English tree, but we are smart
    // and check for other language trees too...)
    if (preg_match("!/([a-z]{2}|pt_BR)/functions!", $dir)) {
        return;
    }
    // Open and traverse the directory
    $handle = @opendir($dir);
    while ($file = @readdir($handle)) {
        // Collect directories and XML files
        if ($file != 'CVS' && $file != '.' && $file != '..' && is_dir($dir . $file)) {
            $directories[] = $file;
        } elseif (strstr($file, ".xml")) {
            $files[] = $file;
        }
    }
    @closedir($handle);
    // Sort files and directories
    sort($directories);
    sort($files);
    // Files first...
    foreach ($files as $file) {
        check_file($dir . $file, $defined_entities, $entity_regexp);
    }
    // than the subdirs
    foreach ($directories as $file) {
        check_dir($dir . $file . "/", $defined_entities, $entity_regexp);
    }
}
Пример #24
0
Файл: style.php Проект: 01J/topm
        }
    }
    die;
}
//switching styles
// displaying the style
// prefer the one set in cookie
if (isset($_COOKIE[$file . '-style']) && !empty($_COOKIE[$file . '-style'])) {
    check_file($_COOKIE[$file . '-style']);
    $filename = $_COOKIE[$file . '-style'];
} elseif (isset($_GET['default']) && !empty($_GET['default'])) {
    // try the one defined via GET parameter
    check_file(trim($_GET['default']));
    $filename = $_GET['default'];
} elseif (isset($defaultStyle) && !empty($defaultStyle)) {
    // try the one defined via $defaultStyle variable
    check_file(trim($defaultStyle));
    $filename = $defaultStyle;
} else {
    die('Please define a default CSS file with "default" GET parameter or via the PHP variable; or set the current style with the "style" GET parameter.');
}
// output the content of the CSS file
ob_end_clean();
if ($gzipOutput) {
    ob_start('ob_gzhandler');
}
// prevent caching to force fresh CSS
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Content-Type: text/css');
readfile(trim($filename));
Пример #25
0
function check_docs_ax()
{
    if (check_file("packages/docs.ax")) {
        return true;
    }
    return false;
}
Пример #26
0
function check_file()
{
    global $file_name, $filename;
    $backupstring = "copy_of_";
    $filename = $backupstring . "{$filename}";
    if (file_exists($filename)) {
        check_file();
    }
}
Пример #27
0
$go = $liteupdate->input->clean_gpc('r', 'go', TYPE_STR);
$product = $liteupdate->input->clean_gpc('r', 'p', TYPE_STR);
define("OK_MESSAGE", "ok");
define("ERROR_MESSAGE", "error");
if ($product != '') {
    $product = $product . "/";
}
if ($go == 'check') {
    $filename = DIR . "/files/" . $product . "lu_version.txt";
    check_file($filename);
    $version_number = file_get_contents($filename);
    echo OK_MESSAGE . "\n" . $version_number;
} else {
    $fname = $liteupdate->input->clean_gpc('r', 'f', TYPE_STR);
    $filename = DIR . "/files/" . $product . $fname;
    check_file($filename);
    if ($go == 'down') {
        readfile($filename);
    } else {
        if ($go == 'size') {
            echo OK_MESSAGE . "\n" . filesize($filename);
        } else {
            echo ERROR_MESSAGE . "\nServer error";
        }
    }
}
function check_file($filename)
{
    if (file_exists($filename)) {
        return;
    }
Пример #28
0
$DirName = isset($Tor->Dec['info']['files']) ? Format::make_utf8($Tor->get_name()) : '';
$IgnoredLogFileNames = array('audiochecker.log', 'sox.log');
check_name($DirName);
// check the folder name against the blacklist
foreach ($FileList as $File) {
    list($Size, $Name) = $File;
    // add +log to encoding
    if ($T['Encoding'] == "'Lossless'" && !in_array($Name, $IgnoredLogFileNames) && substr($Name, -4, 4) === '.log') {
        $HasLog = 1;
    }
    // add +cue to encoding
    if ($T['Encoding'] == "'Lossless'" && preg_match('/\\.cue$/i', $Name)) {
        $HasCue = 1;
    }
    // Check file name and extension against blacklist/whitelist
    check_file($Type, $Name);
    // Make sure the filename is not too long
    if (mb_strlen($Name, 'UTF-8') + mb_strlen($DirName, 'UTF-8') + 1 > MAX_FILENAME_LENGTH) {
        $TooLongPaths[] = "{$DirName}/{$Name}";
    }
    // Add file info to array
    $TmpFileList[] = Torrents::filelist_format_file($File);
}
if (count($TooLongPaths) > 0) {
    $Names = implode(' <br />', $TooLongPaths);
    $Err = "The torrent contained one or more files with too long a name:<br /> {$Names}";
}
$FilePath = db_string($DirName);
$FileString = db_string(implode("\n", $TmpFileList));
$Debug->set_flag('upload: torrent decoded');
if ($Type == 'Music') {
Пример #29
0
 /**
  * Delete product temporary images that was uploaded to temp folder
  *
  * @param Illuminate\Http\Request $request
  *
  * @return void
  */
 protected function _deleteProductTempImg($request)
 {
     $tempPath = config('front.temp_path');
     foreach ([1, 2, 3, 4] as $one) {
         $imgToDel = $request->get("product_image_{$one}");
         if ($imgToDel !== '' && check_file($tempPath . $imgToDel)) {
             foreach ($this->_productImgSizes as $size) {
                 $nameBySize = str_replace(_const('TOBEREPLACED'), "_{$size}", $imgToDel);
                 delete_file($tempPath . $nameBySize);
             }
             delete_file($tempPath . $imgToDel);
         }
     }
 }
Пример #30
0
function check_dir($dir, &$used_tags)
{
    // Collect files and directories in these arrays
    $directories = array();
    $files = array();
    // Open and traverse the directory
    $handle = @opendir($dir);
    while ($file = @readdir($handle)) {
        // Collect directories and XML files
        if ($file != 'CVS' && $file != '.' && $file != '..' && is_dir($dir . $file)) {
            $directories[] = $file;
        } elseif (strstr($file, ".xml")) {
            $files[] = $file;
        }
    }
    @closedir($handle);
    // Sort files and directories
    sort($directories);
    sort($files);
    // Files first...
    foreach ($files as $file) {
        check_file($dir . $file, $used_tags);
    }
    // than the subdirs
    foreach ($directories as $file) {
        check_dir($dir . $file . "/", $used_tags);
    }
}