コード例 #1
0
ファイル: sam_install.php プロジェクト: pangudashu/samframe
function scanFile($directory)
{
    $arr = array();
    $mydir = dir($directory);
    while ($file = $mydir->read()) {
        if (in_array($file, array('phptemplate'))) {
            continue;
        }
        if (is_dir("{$directory}/{$file}") && $file != "." && $file != ".." && $file != "smarty" && $file != "Public" && $file != "project_tools" && $file != ".svn" && $file != 'Include') {
            $res = scanFile("{$directory}/{$file}");
            $arr = array_merge($arr, $res);
        } else {
            if ($file != "." && $file != "..") {
                $file_path = $directory . "/" . $file;
                $file_info = pathinfo($file_path);
                if (isset($file_info['extension']) && $file_info['extension'] == 'php') {
                    $classes = getClassName($file_path);
                    foreach ($classes as $class) {
                        $arr[$class] = $file_info['dirname'] . '/' . $file_info['basename'];
                    }
                }
            }
        }
    }
    $mydir->close();
    return $arr;
}
コード例 #2
0
ファイル: jsls.php プロジェクト: rommmka/axiscommerce
function scanDirectory($path)
{
    if (strstr("{$path}", '/.svn')) {
        echo 'SKIPPING ' . $path . "\n";
    } elseif (is_dir($path)) {
        echo 'SCANNING ' . $path . "\n";
        $dir = dir($path);
        while (false !== ($file = $dir->read())) {
            if ($file != '.' && $file != '..') {
                if (!is_link("{$path}/{$file}") && is_dir("{$path}/{$file}")) {
                    scanDirectory("{$path}/{$file}");
                } else {
                    scanFile("{$path}/{$file}");
                }
            }
        }
        $dir->close();
    }
}
コード例 #3
0
ファイル: classmap.php プロジェクト: pangudashu/samframe
function scanFile($directory)
{
    $arr = array();
    $mydir = dir($directory);
    while ($file = $mydir->read()) {
        if (is_dir("{$directory}/{$file}") && $file != "." && $file != ".." && $file != "smarty" && $file != "myinclude" && $file != ".svn") {
            $res = scanFile("{$directory}/{$file}");
            $arr = array_merge($arr, $res);
        } else {
            if ($file != "." && $file != "..") {
                $file_path = $directory . "/" . $file;
                $file_info = pathinfo($file_path);
                if ($file_info['extension'] == 'php') {
                    $classes = getClassName($file_path);
                    foreach ($classes as $class) {
                        $arr[$class] = $file_info['dirname'] . '/' . $file_info['basename'];
                    }
                }
            }
        }
    }
    $mydir->close();
    return $arr;
}
コード例 #4
0
ファイル: upload.php プロジェクト: slepp/filebin.ca
 }
 $upload_dir = FILEBIN_STORE_PATH;
 $upload_name = hash_file('sha1', $f['tmp_name']);
 $upload_file = $upload_dir . "/" . $upload_name;
 if (!file_exists($upload_file)) {
     if (!move_uploaded_file($f['tmp_name'], $upload_file)) {
         logError("Could not move uploaded file. Sorry.");
         exit;
     }
     chmod($upload_file, 0644);
 }
 if (filesize($upload_file) == 0) {
     logError("File is empty.");
     exit;
 }
 if (!scanFile($upload_file)) {
     rename($upload_file, $upload_file . "-virus");
     logError("File did not pass the virus scan.");
     exit;
 }
 $fd = fopen("/tmp/upload.log", "a");
 fwrite($fd, "Upload: " . serialize($_FILES) . " with " . serialize($_POST) . "\n");
 fclose($fd);
 print_r($_FILES);
 $file = new File();
 $file->byPath($upload_file);
 if ($file->isValid()) {
     $file->incrementShrinks();
 } else {
     $file->path = $upload_file;
     $file->tag = randomTag();
コード例 #5
0
 if ($action == 'remove') {
     if (!$access->mayTranslate($translang)) {
         $tpl->error(ERROR_NO_ACCESS);
     }
     remove();
 } else {
     if ($action == 'scan') {
         scan();
     } else {
         if ($action == 'scanstart') {
             scanStart();
             exit;
         } else {
             if ($action == 'scanfile') {
                 $filename = isset($_REQUEST['filename']) ? $_REQUEST['filename'] : '';
                 scanFile($filename);
                 exit;
             } else {
                 if ($action == 'quicknone') {
                     $cookie->un_set('translate_mode');
                 } else {
                     if ($action == 'quicknew') {
                         $cookie->set('translate_mode', 'new');
                     } else {
                         if ($action == 'quickall') {
                             $cookie->set('translate_mode', 'all');
                         }
                     }
                 }
                 $action = 'listnew';
                 $trans = sql("SELECT DISTINCT `sys_trans`.`id`, `sys_trans`.`text` FROM `sys_trans` LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&1' LEFT JOIN `sys_trans_ref` ON `sys_trans`.`id`=`sys_trans_ref`.`trans_id` WHERE (ISNULL(`sys_trans_text`.`trans_id`) OR `sys_trans_text`.`text`='') ORDER BY `sys_trans`.`id` DESC", $translang);
コード例 #6
0
<?php

/**
 * This file will scan all files in the project and output an array with event names.
 */
$basePath = dirname(dirname(dirname(__FILE__)));
$i = new RecursiveDirectoryIterator($basePath);
$i2 = new RecursiveIteratorIterator($i);
$events = array();
foreach ($i2 as $file) {
    /* @var $file SplFileInfo */
    if (substr($file->getFileName(), -3, 3) == 'php') {
        scanFile($file->getPathname());
    }
}
$events = array_unique($events);
sort($events);
print_r($events);
function scanFile($fileName)
{
    global $events;
    $contents = file_get_contents($fileName);
    $regex = '/(.*)new[[:space:]]+PluginEvent[[:space:]]*\\([[:space:]]*[\'"]+(.*)[\'"]+/';
    $count = preg_match_all($regex, $contents, $matches);
    if ($count > 0) {
        $events = array_merge($events, $matches[2]);
    }
}