function run_files($file)
{
    if (is_link($file)) {
        return;
    }
    if (is_dir($file . '/.')) {
        $dh = opendir($file);
        $files = array();
        while (false !== ($f = readdir($dh))) {
            if ($f[0] == '.') {
                continue;
            }
            if (is_dir($file . '/' . $f . '/.')) {
                $files[] = $file . '/' . $f;
            } else {
                $ext = strtolower(substr(strrchr($f, '.'), 1));
                if ($ext == 'css' || $ext == 'html' || $ext == 'php' || $ext == 'js') {
                    $files[] = $file . '/' . $f;
                }
            }
        }
        closedir($dh);
        foreach ($files as $f) {
            run_files($f);
        }
    } else {
        process_file($file);
    }
}
Example #2
0
function dir_enter($entry_dir = '/', $depth = 0)
{
    $found = 0;
    # Remove the last trailing slash and void dual writing
    $entry_dir = preg_replace('/\\/$/i', '', $entry_dir);
    $skip_list = array('.', '..');
    if ($dir_handle = opendir($entry_dir)) {
        while (false !== ($filename = readdir($dir_handle))) {
            if (in_array($filename, $skip_list)) {
                continue;
            }
            $full_file_path = "{$entry_dir}/{$filename}";
            if (is_dir($full_file_path)) {
                # Need to loop here inside the directory
                fecho(str_repeat('  ', $depth));
                # depth marker
                #fecho("{$full_file_path}");
                fecho("{$filename}");
                # Recurse through the file
                $function = __FUNCTION__;
                $found += $function($full_file_path, $depth + 1);
            } else {
                #fecho(str_repeat('  ', $depth)); # depth marker
                #fecho("{$full_file_path}");
                #fecho("{$filename}");
                ++$found;
                process_file($full_file_path, $depth);
            }
        }
        closedir($dir_handle);
    }
    return $found;
}
Example #3
0
/**
 * 监视文件夹
 * @param $host string 服务器地址
 * @param $port int 服务器端口
 * @param $root string 要监视的目录
 * @param $ignore array 忽略的文件
 * @return bool 是否被改变
 */
function watch_dir($host, $port, $id, $root, $ignore)
{
    $socket = null;
    $changed = false;
    $modify_table = load_modify_time();
    if (!is_dir($root)) {
        echo "{$root} not dir\n";
        exit(1);
    }
    $queue = array($root);
    $t = -microtime(true);
    while (!empty($queue)) {
        // echo "queue\n"; var_dump($queue);
        $root_dir = array_shift($queue);
        // echo "enter dir $root_dir\n";
        $d = opendir($root_dir);
        if ($d === false) {
            echo "{$root_dir} not exists\n";
            exit(1);
        }
        while (($f = readdir($d)) !== false) {
            if ($f == '.' || $f == '..') {
                continue;
            }
            if (in_array($f, $ignore)) {
                // echo "skip $f\n";
                continue;
            }
            $filename = "{$root_dir}/{$f}";
            if (is_file($filename)) {
                $filesize = filesize($filename);
                assert($filesize !== false);
                if ($filesize > 100 * 1024 * 1024) {
                    // big than 100M
                    echo "skip {$filename} with size {$filesize}\n";
                } else {
                    list($modify_table, $socket, $changed) = process_file($host, $port, $id, $root, $modify_table, $filename, $socket, $changed);
                }
            } elseif (is_dir($filename)) {
                // echo "add to queue $filename\n";
                $queue[] = "{$filename}";
            }
        }
    }
    $t += microtime(true);
    echo " ({$root} " . intval($t * 1000) . " ms)";
    // echo "ok\n";
    save_modify_time(modify_time());
    if ($socket !== null) {
        end_socket($socket);
    }
    return $changed;
}
Example #4
0
function doMpdParse($command, &$dirs, $domains)
{
    global $connection, $collection, $mpd_file_model, $array_params;
    global $parse_time;
    if (!$connection) {
        return;
    }
    fputs($connection, $command . "\n");
    $filedata = $mpd_file_model;
    $parts = true;
    if (count($domains) == 0) {
        $domains = null;
    }
    $pstart = microtime(true);
    while (!feof($connection) && $parts) {
        $parts = getline($connection);
        if (is_array($parts)) {
            switch ($parts[0]) {
                case "directory":
                    $dirs[] = trim($parts[1]);
                    break;
                case "Last-Modified":
                    if ($filedata['file'] != null) {
                        // We don't want the Last-Modified stamps of the directories
                        // to be used for the files.
                        $filedata[$parts[0]] = $parts[1];
                    }
                    break;
                case 'file':
                    if ($filedata['file'] != null && (!is_array($domains) || in_array(getDomain($filedata['file']), $domains))) {
                        $parse_time += microtime(true) - $pstart;
                        process_file($filedata);
                        $pstart = microtime(true);
                    }
                    $filedata = $mpd_file_model;
                    // Fall through to default
                // Fall through to default
                default:
                    if (in_array($parts[0], $array_params)) {
                        $filedata[$parts[0]] = array_unique(explode(';', $parts[1]));
                    } else {
                        $filedata[$parts[0]] = explode(';', $parts[1])[0];
                    }
                    break;
            }
        }
    }
    if ($filedata['file'] !== null && (!is_array($domains) || in_array(getDomain($filedata['file']), $domains))) {
        $parse_time += microtime(true) - $pstart;
        process_file($filedata);
    }
}
Example #5
0
function process_path($path)
{
    if (is_dir($path)) {
        //echo "dir: [$path]\n";
        $path = rtrim($path, "\\/") . "/";
        foreach (glob($path . "*", GLOB_ONLYDIR) as $subdir) {
            process_path($subdir);
        }
        foreach (glob($path . "*.class.php") as $file) {
            process_path($file);
        }
    } else {
        process_file($path);
    }
}
Example #6
0
function process_directory($path)
{
    $dir = opendir($path);
    while ($file = readdir($dir)) {
        if (substr($file, 0, 1) == '.') {
            continue;
        }
        $filepath = $path . '/' . $file;
        if (is_dir($filepath)) {
            process_directory($filepath);
        } elseif (is_file($filepath)) {
            if (substr($file, -4) == '.php') {
                process_file($filepath);
            }
        } else {
            print "Unknown type: {$filepath}\n";
        }
    }
    closedir($dir);
}
Example #7
0
function run_files($file)
{
    if (is_link($file)) {
        return;
    }
    if (is_dir($file . '/.')) {
        $dh = opendir($file);
        $files = array();
        while (false !== ($f = readdir($dh))) {
            if ($f[0] != '.') {
                $files[] = $file . '/' . $f;
            }
        }
        closedir($dh);
        foreach ($files as $f) {
            run_files($f);
        }
    } else {
        process_file($file);
    }
}
Example #8
0
    if (!$file_contents) {
        echo "downloading failed\n";
    }
    $file_contents = str_replace("<xhtml:p xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">", htmlspecialchars("<p>"), $file_contents);
    $file_contents = str_replace("</xhtml:p>", htmlspecialchars("</p>"), $file_contents);
    if (!($OUT = fopen($download_cache_path, "w+"))) {
        debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $download_cache_path);
        return;
    }
    fwrite($OUT, $file_contents);
    fclose($OUT);
    if (filesize($download_cache_path)) {
        clearstatcache();
        echo "{$file_name} - " . filesize($download_cache_path) . "<br>\n";
        echo "<hr>Parsing Document {$file_name}<hr>\n";
        process_file($download_cache_path, $url);
        echo "Processed {$file_name}\n";
    }
}
if (!($OUT = fopen($new_resource_path, "w+"))) {
    debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $new_resource_path);
    return;
}
fwrite($OUT, serialize($all_taxa));
fclose($OUT);
shell_exec(PHP_BIN_PATH . dirname(__FILE__) . "/helpers/plazi_step_two.php");
shell_exec("rm -f " . DOC_ROOT . "temp/30.xml");
shell_exec("rm -f " . DOC_ROOT . "temp/downloaded_rdf.rdf");
shell_exec("rm -f " . DOC_ROOT . "temp/plazi.xml");
function process_file($path, $url)
{
Example #9
0
<?php

echo "go...<br>";
require_once "../_connect.php";
echo "go...<br>";
$dir = 'data/files';
$files = scandir($dir, 0);
print_r($files);
$logname = "data_load_from_file";
foreach ($files as $filename) {
    if (substr($filename, -4) == ".csv") {
        process_file($dir . "/" . $filename);
    } else {
    }
}
// *******************************************************************
// ****  process file  ***********************************************
// *******************************************************************
function process_file($filename)
{
    global $conn;
    echome("Processing file {$filename}", 1);
    $fi2 = file($filename);
    $filepath = $filename;
    $sql = <<<MOUT
load data local infile '{$filepath}'
into table data_in
fields terminated by ","
optionally enclosed by "\\""
lines terminated by "
"
Example #10
0
function get_directory($dir, $level = 0) {
  $ignore = array( 'cgi-bin', '.', '..' );
  $dh = @opendir($dir);
  while( false !== ( $file = readdir($dh))){
    if( !in_array( $file, $ignore ) ){
      if(is_dir("$dir/$file")) {
        echo "\n$file\n";
        get_directory("$dir/$file", ($level+1));
      }
      else {
        //echo "$spaces $file\n";
        process_file("$dir/$file");
      }
    }
  }

  closedir( $dh );

  if(is_dir_empty($dir) && $dir != "D:/wamp/www/tmp_dir") {
    //print "\n-= Removing $dir =-\n";
    rmdir($dir);

  }

}
Example #11
0
        showmessage('服务器无法创建上传目录');
    }
    //本地上传
    $new_name = $_SC['attachdir'] . './' . $filepath;
    $tmp_name = $FILE['tmp_name'];
    if (@copy($tmp_name, $new_name)) {
        //移动文件
        @unlink($tmp_name);
        //删除POST的临时文件
    } elseif (function_exists('move_uploaded_file') && @move_uploaded_file($tmp_name, $new_name)) {
    } elseif (@rename($tmp_name, $new_name)) {
    } else {
        showmessage('对不起,无法转移临时文件到服务器指定目录。~~~~(>_<)~~~~ ');
    }
    $filedownload = '';
    $result = process_file($new_name, &$filedownload);
    if ($result == 1) {
        showmessage('上传成功,感谢您的邀请!', $_POST[refer], 0);
    } else {
        showmessage('文件存在部分问题,请根据链接地址下载后更新重新提交' . "<a href=" . './plugin/invite/download/' . $filedownload . " style=color:red;" . ">点击下载无效记录</a>");
    }
}
//43
include template("cp_invitefriend");
//读取excel文件的内容
function process_file($filename, &$tempname)
{
    global $_SGLOBAL;
    $isfile = 1;
    $data = new Spreadsheet_Excel_Reader();
    $data->setOutputEncoding('UTF-8');
Example #12
0
/**
 * Recursively process a directory, picking regular files and feeding
 * them to process_file().
 *
 * @param string $dir the full path of the directory to process
 * @param string $userfield the prefix_user table field to use to
 *               match picture files to users.
 * @param bool $overwrite overwrite existing picture or not.
 * @param array $results (by reference) accumulated statistics of
 *              users updated and errors.
 *
 * @return nothing
 */
function process_directory($dir, $userfield, $overwrite, &$results)
{
    if (!($handle = opendir($dir))) {
        notify(get_string('uploadpicture_cannotprocessdir', 'admin'));
        return;
    }
    while (false !== ($item = readdir($handle))) {
        if ($item != '.' && $item != '..') {
            if (is_dir($dir . '/' . $item)) {
                process_directory($dir . '/' . $item, $userfield, $overwrite, $results);
            } else {
                if (is_file($dir . '/' . $item)) {
                    $result = process_file($dir . '/' . $item, $userfield, $overwrite);
                    switch ($result) {
                        case PIX_FILE_ERROR:
                            $results['errors']++;
                            break;
                        case PIX_FILE_UPDATED:
                            $results['updated']++;
                            break;
                    }
                }
            }
            // Ignore anything else that is not a directory or a file (e.g.,
            // symbolic links, sockets, pipes, etc.)
        }
    }
    closedir($handle);
}
Example #13
0
     $isfile = 1;
     $filename = basename($_FILES['file']['name']);
     $ext = substr($filename, strpos($filename, '.') + 1);
     if ($ext == "xls" && $_FILES["file"]["size"] < 100000) {
         //检测是否有同名的文件存在
         //if (!file_exists($newname)) {
         //存储在一个地址
         //确定存储地址
         //$newname = getsiteurl().'\upload2\\'.$filename;
         $newname = S_ROOT . './plugin/invite/upload/' . $filename;
         if (move_uploaded_file($_FILES['file']['tmp_name'], $newname)) {
             //重命名文件
             $renamefilename = S_ROOT . './plugin/invite/phpreadexcel/upload/' . date("Y-m-d") . '_upload_' . rand() . '.' . $ext;
             rename($newname, $renamefilename);
             $filedownload = '';
             $r = process_file($renamefilename, &$filedownload);
             //echo "文件已被保存和上传
             if ($r == 1) {
                 showmessage('upload_success');
             } else {
                 //exit(getsiteurl);
                 showmessage('文件存在部分问题,请根据链接地址下载后更新重新提交' . "<a href=" . './plugin/invite/download/' . $filedownload . " style=color:red;" . ">点击下载无效记录</a>");
             }
         } else {
             showmessage('upload_failure');
         }
     } else {
         showmessage('file_limit');
     }
 } else {
     showmessage('no_file_upload');
Example #14
0
 /**
  * Processes the calendar set for the calling Parser object.
  *
  * @access public
  * @alias process_file
  */
 function process_cal()
 {
     process_file($this->cal->filename);
 }
Example #15
0
<?php

include '../util.php';
include '../solver.php';
include '../reader.php';
date_default_timezone_set('Europe/Amsterdam');
$message = null;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (isset($_FILES['knowledgebase'])) {
        $message = process_file($_FILES['knowledgebase']);
    } else {
        if (isset($_POST['delete-file'])) {
            $message = delete_file($_POST['delete-file']);
        }
    }
}
function process_file($file)
{
    if ($file['error'] != 0) {
        return "Er is een fout opgetreden bij het uploaden.";
    }
    $reader = new KnowledgeBaseReader();
    $errors = $reader->lint($file['tmp_name']);
    if (!preg_match('/^[a-zA-Z0-9_\\-\\.]+\\.xml$/i', $file['name'])) {
        return "De bestandsnaam bevat karakters die niet goed verwerkt kunnen worden.";
    }
    if (count($errors) > 0) {
        $out = "De volgende fouten zijn gevonden in de knowledge-base:\n<ul>";
        foreach ($errors as $error) {
            $out .= sprintf("\n<li title=\"%s\">%s</li>\n", htmlspecialchars($error->file . ':' . $error->line, ENT_QUOTES, 'utf-8'), $error->message);
        }
Example #16
0
<?php

echo "go...<br>";
require_once "../_connect.php";
echo "go...<br>";
$logname = "data_load_from_file";
$filename = 'files/204.csv';
if (file_exists($filename)) {
    process_file($filename);
} else {
}
// *******************************************************************
// ****  process file  ***********************************************
// *******************************************************************
function process_file($filename)
{
    global $conn;
    echome("Processing file {$filename}", 1);
    $fi2 = file($filename);
    $filepath = $filename;
    $sql = <<<MOUT
load data local infile '{$filepath}'
into table data_in2 
fields terminated by ","
optionally enclosed by "\\""
lines terminated by "
"
(show_fk,dt,people,media_type,media_code,media_url,media_title,media_desc)
MOUT;
    $conn->query($sql) or die("oops {$sql}");
    //	echome("Deleting file",1);
<?php

/************************
 AUTHOR: Ethan Gruber
MODIFIED: January, 2013
DESCRIPTION: Convert electrum spreadsheet to NUDS
REQUIRED LIBRARIES: php5, php5-curl, php5-cgi
************************/
//create an array with pre-defined labels and values passed from the Filemaker POST
$labels = array("region", "region_uri", "mint", "mint_uri", "material", "material_uri", "skip1", "skip2", "denomination", "denomination_uri", "weight", "weight_standard", "diameter", "obverseType", "reverseType", "date", "dob", "fromDate", "toDate", "ref1", "ref1_donum", "ref2", "ref2_donum", "ref3", "ref3_donum", "ref4", "ref4_donum", "ref5", "ref5_donum", "auc1", "auc1_donum", "auc1_lot", "auc2", "auc2_donum", "auc2_lot", "auc3", "auc3_donum", "auc3_lot", "auc4", "auc4_donum", "auc4_lot", "auc5", "auc5_donum", "auc5_lot", "repository", "identifier", "findspot", "hoard", "hoard_uri", "provenance", "cross_reference", "notes", "rnotes1_skip", "obv_image", "rev_image", "rnotes2_skip", "skip3", "skip4", "skip5");
$files = scandir('csv');
foreach ($files as $file) {
    if (strpos($file, '.csv') > 0) {
        $filename = 'csv/' . $file;
        process_file($filename, $labels);
    }
}
function process_file($filename, $labels)
{
    if (($handle = fopen($filename, "r")) !== FALSE) {
        echo "Processing {$filename}\n";
        $count = -1;
        while (($data = fgetcsv($handle, 1000, ",", '"')) !== FALSE) {
            //skip first (label) row
            if ($count > 0) {
                $row = array();
                foreach ($labels as $key => $label) {
                    //escape conflicting XML characters
                    $row[$label] = $data[$key];
                }
                $recordId = substr(md5(rand()), 0, 9);
Example #18
0
function process_all($path)
{
    if ($dir = opendir($path)) {
        while ($fname = readdir($dir)) {
            $fname2 = $path . '/' . $fname;
            var_dump($fname2);
            if (is_dir($fname2) && $fname != '.' && $fname != '..' && $fname != 'CVS') {
                process_all($fname2);
                echo "recursing into {$fname2}\n";
            } elseif (preg_match('#[\\/\\\\]\\w+[\\/\\\\]functions[\\/\\\\]([a-zA-Z0-9\\._-]+)\\.xml$#', $fname2, $regs)) {
                process_file($fname2, OUT_PATH . $regs[1] . '.txt');
            }
        }
        closedir($dir);
    } else {
        echo "Not a dir \${$path}\n";
    }
}
Example #19
0
$dates = array();
$startdate = strtotime("2016-01-05");
$enddate = time();
$enddate = strtotime("2016-01-07");
//$startdate = strtotime( "2015-06-01" );
//$enddate = strtotime( "2015-07-0" );
//echo "start: $startdate" ;
//echo "end: $enddate";
for ($thisdate = $startdate; $thisdate <= $enddate; $thisdate += 86400) {
    $dates[] = date("md", $thisdate);
}
/** 
 * Fetch and save the bwtrace.vt.mmdd file for each of the selected hosts
 */
if (true) {
    foreach ($dates as $date) {
        foreach ($hosts as $host) {
            $content = get_vt($host, $date);
            save_vt($host, $date, $content);
        }
    }
}
/**
 * Process each of the files from the hosts
 */
oik_require("vt.php", "play");
foreach ($dates as $date) {
    foreach ($hosts as $host) {
        process_file("{$host}/{$date}.vt");
    }
}
Example #20
0
//$enddate = strtotime( "2016-07-27" );
//$startdate = strtotime( "2015-06-01" );
//$enddate = strtotime( "2015-07-0" );
//echo "start: $startdate" ;
//echo "end: $enddate";
for ($thisdate = $startdate; $thisdate <= $enddate; $thisdate += 86400) {
    $dates[] = date("md", $thisdate);
}
echo " Start:" . reset($dates) . PHP_EOL;
echo "End: " . end($dates) . PHP_EOL;
/** 
 * Fetch and save the bwtrace.vt.mmdd file for each of the selected hosts
 */
if (true) {
    foreach ($dates as $date) {
        foreach ($hosts as $host) {
            $content = get_vt($host, $date);
            save_vt($host, $date, $content);
        }
    }
}
/**
 * Process each of the files from the hosts
 */
oik_require("vt.php", "play");
ini_set('memory_limit', '2048M');
foreach ($dates as $date) {
    foreach ($hosts as $host) {
        process_file("vt2016/{$host}/{$date}.vt");
    }
}
Example #21
0
}
//echo "Handle: " . $d->handle . "\n";
//echo "Path: " . $d->path . "\n";
$g_total = 0;
$g_good = 0;
$g_poor = 0;
$g_neutral = 0;
while (false !== ($entry = $d->read())) {
    if ($entry == '.' || $entry == '..' || is_dir($d->path . '/' . $entry)) {
        continue;
    }
    //$prefix = "spm_2010-03-1";
    //if ( strncmp($entry, $prefix, strlen($prefix)) != 0 ) continue;
    echo "reading '{$entry}'...\n";
    $path = $d->path . '/' . $entry;
    process_file($path, $folder);
}
$d->close();
//*/
echo "Total:good/neutral/poor/total={$g_good}/{$g_neutral}/{$g_poor}/{$g_total}\n";
$g_diff = $g_total - $g_good - $g_neutral - $g_poor;
echo "Total:check sum: {$g_diff}\n";
function process_file($path, $folder)
{
    global $g_total, $g_good, $g_poor, $g_neutral;
    $fh = fopen($path, "rb");
    if (!$fh) {
        return;
    }
    //$fp = fsockopen("192.168.1.233", 19990);
    $output = '';
Example #22
0
<?php

include '../util.php';
include '../solver.php';
include '../reader.php';
date_default_timezone_set('Europe/Amsterdam');
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['knowledgebase']) && ($file = process_file($_FILES['knowledgebase'], $errors))) {
    switch ($_POST['action']) {
        case 'analyse':
            header('Location: analyse.php?kb=' . rawurlencode($file));
            break;
        case 'run':
            header('Location: webfrontend.php?kb=' . rawurlencode($file));
            break;
    }
    exit;
}
function process_file($file, array &$errors = array())
{
    if ($file['error'] != 0) {
        return "Er is een fout opgetreden bij het uploaden.";
    }
    $reader = new KnowledgeBaseReader();
    $errors = $reader->lint($file['tmp_name']);
    $unique_name = sha1(microtime() . uniqid('kb', true)) . '.xml';
    if (count($errors) > 0) {
        return false;
    }
    if (!move_uploaded_file($file['tmp_name'], '../knowledgebases/' . $unique_name)) {
        $errors[] = "De knowledge-base kon niet worden opgeslagen op de server.";
<?php

$unique_spells = "";
for ($i = 0; $i < 65535; $i++) {
    $unique_spells[$i] = 0;
}
$srcdir = "./spell_lists";
if ($curdir = opendir($srcdir)) {
    while ($file = readdir($curdir)) {
        if ($file != '.' && $file != '..') {
            $srcfile = $srcdir . '\\' . $file;
            if (is_file($srcfile)) {
                process_file($srcfile);
            }
        }
    }
}
closedir($curdir);
//now get max values
$max = 0;
for ($i = 0; $i < 65535; $i++) {
    if ($unique_spells[$i] > $max) {
        $max = $unique_spells[$i];
    }
}
//print out common spells
if ($max > 0) {
    for ($i = 0; $i < 65535; $i++) {
        if ($unique_spells[$i] == $max) {
            echo "{$i}<br>";
        }
Example #24
0
$all_file = "c:/all_ipv4.good";
$all_total = 0;
$all_good = 0;
$all_poor = 0;
$all_neutral = 0;
$no_content = '';
file_put_contents($all_file, $no_content);
while (false !== ($entry = $d->read())) {
    if ($entry == '.' || $entry == '..' || is_dir($d->path . '/' . $entry)) {
        continue;
    }
    //$prefix = "spm_2010-03-1";
    //if ( strncmp($entry, $prefix, strlen($prefix)) != 0 ) continue;
    echo "reading '{$entry}'...\n";
    $path = $d->path . '/' . $entry;
    process_file($path);
}
$d->close();
//*/
echo "ChangeTo Total:good/neutral/poor/total={$all_good}/{$all_neutral}/{$all_poor}/{$all_total}\n";
$all_diff = $all_total - $all_good - $all_neutral - $all_poor;
echo "ChangeTo Total:check sum: {$all_diff}\n";
function process_file($path)
{
    global $all_file, $all_total, $all_good, $all_poor, $all_neutral;
    $fh = fopen($path, "rb");
    if (!$fh) {
        return;
    }
    $fp = fsockopen("localhost", 56789);
    $output = '';
Example #25
0
    }
    if ($inblock) {
        echo "Error (ended in __asm__ block???)\n";
    }
    fclose($in);
    fclose($out);
}
$nasm = "nasm";
$want_funclead = "";
$fmt = "win64";
if (isset($argv[1]) && $argv[1] != "") {
    $fmt = $argv[1];
}
$fnout = "asm-nseel-x64.asm";
if ($fmt == "macho64") {
    $fnout = "asm-nseel-x64-macho.asm";
    $nasm = "nasm64";
    $want_funclead = "_";
}
if ($fmt == "macho64x") {
    $fnout = "asm-nseel-x64-macho.asm";
    $nasm = "nasm";
    $want_funclead = "_";
    $fmt = "macho64";
}
if ($fmt == "win64x") {
    $nasm = "nasm64";
    $fmt = "win64";
}
process_file("asm-nseel-x86-gcc.c", $fnout, $fmt != "win64" ? "%define AMD64ABI\n" : "");
system("{$nasm} -f {$fmt} {$fnout}");
Example #26
0
function process_dir($host, $user, $password, $root, $level, $proc)
{
    global $PROCESSING_EXTS;
    if ($level <= 0) {
        return;
    }
    print "Processing: {$root}\n";
    list($dirs, $files) = list_dir($host, $user, $password, $root);
    if (sizeof($dirs) > 0 && sizeof($files) > 0) {
        //~ #~ print dirs, files
        //~ #~ print len(dirs), len(files)
        fsave("ok_accounts.txt", implode("\t", array($host, $user, $password, $root)) . "\n", true);
        foreach ($dirs as $d) {
            process_dir($host, $user, $password, $root . "/" . $d, $level - 1, $proc);
        }
        foreach ($files as $f) {
            foreach ($PROCESSING_EXTS as $i) {
                if (strpos($f, $i) !== false) {
                    process_file($host, $user, $password, $root . "/" . $f, $proc);
                    break;
                }
            }
        }
    } else {
        fsave("fail_accounts.txt", implode("\t", array($host, $user, $password, $root)) . "\n", true);
    }
}
Example #27
0
    $db->queryExec($create_query);
    $db->queryExec("insert into guidepost values (NULL, 50.1, 17.1, 'x', 'znacka');");
    $db->queryExec("insert into guidepost values (NULL, 50.2, 17.2, 'x', 'znacka');");
    $db->queryExec("insert into guidepost values (NULL, 50.3, 17.3, 'x', 'znacka');");
    $db->queryExec("insert into guidepost values (NULL, 50.4, 17.4, 'x', 'znacka');");
}
$action = get_param("action");
switch ($action) {
    case "show_dialog":
        page_header();
        show_upload_dialog();
        page_footer();
        break;
    case "file":
        page_header();
        process_file();
        page_footer();
        break;
    case "":
        $bbox = get_param('bbox');
        if ($bbox == "") {
            printdebug("no bbox");
            die("No bbox provided\n");
        } else {
            printdebug("bbox: " . $bbox);
        }
        list($minlon, $minlat, $maxlon, $maxlat) = preg_split('/,/', $bbox, 4);
        $db = new SQLite3('guidepost');
        if ($db) {
            $i = 0;
            $result = array();
set_time_limit(30 * 60);
$dbhost = "localhost";
$dbuname = "root";
$dbupass = "";
$dbname = "temp";
//database connection
$dbi = mysql_connect($dbhost, $dbuname, $dbupass, true) or die("Couldn't connect to database server!");
mysql_select_db($dbname, $dbi) or die("Q 200603201239" . mysql_error($dbi));
$fout = fopen("vendors_out.sql", "wt");
//	$vendor_entries="19065,18822,5049,34093,23483,46555";
$vendor_entries = "58155";
$vendors_vect = explode(",", $vendor_entries);
asort($vendors_vect);
foreach ($vendors_vect as $key => $t_entry) {
    if ($t_entry) {
        process_file($t_entry);
    }
}
fclose($fout);
function process_file($t_entry)
{
    global $dbi, $fout;
    $new_line = "<br>";
    $new_line = "\n";
    $UNIT_NPC_FLAG_GOSSIP = 1;
    $UNIT_NPC_FLAG_VENDOR = 0x80;
    $link = "./wowhead npc/npc=" . $t_entry . ".htm";
    //echo " Getting information for npc: ".$t_entry." from wowhead : $link <br> ";
    $file = @fopen($link, "r");
    if ($file) {
        //echo "have file<br>";
Example #29
0
                    }
                    $sline = $inst;
                    if ($parms != "") {
                        $sline .= " " . $parms;
                    }
                    $sline .= ";";
                }
                $sline = preg_replace("/FPREG_([0-9]+)/", "st(\$1)", $sline);
                $line = $beg_restore . $sline . $end_restore;
            }
        }
        if (!$nowrite) {
            if (strstr($line, "__TEMP_REPLACE__")) {
                $a = strstr($line, "//REPLACE=");
                if ($a === false) {
                    die("__TEMP_REPLACE__ found, no REPLACE=\n");
                }
                $line = str_replace("__TEMP_REPLACE__", substr($a, 10), $line);
            }
            fputs($out, $line . "\n");
        }
    }
    if ($inblock) {
        echo "Error (ended in __asm__ block???)\n";
    }
    fclose($in);
    fclose($out);
}
process_file("asm-nseel-x86-gcc.c", "asm-nseel-x86-msvc.c");
// process_file("asm-miscfunc-x86-gcc.c" , "asm-miscfunc-x86-msvc.c");
//process_file("asm-megabuf-x86-gcc.c" , "asm-megabuf-x86-msvc.c");
    // get all file names
    foreach ($files as $file) {
        // iterate files
        if (is_file($file)) {
            unlink($file);
        }
        // delete file
    }
    $uploaded_header = 0;
    $uploaded_banner = 0;
    if (isset($_FILES["image"]["name"])) {
        $uploaded_header = process_file("image", "header_image", "temp/");
    }
    if (isset($_FILES["banner_image"]["name"])) {
        if ($_FILES["banner_image"]["name"] != "") {
            $uploaded_banner = process_file("banner_image", "banner_image", "temp/");
        }
    }
    $HeaderText = isset($_POST['text']) ? $_POST['text'] != "" ? $_POST['text'] : 'Calendar of Events' : 'Calendar of Events';
    /****Begin Header Code ******/
    ob_start();
    ?>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
	<link rel="stylesheet" href="/font/stylesheet.css" />
	<style type="text/css">
	<?php 
    include "cssmin-v3.0.1.php";
    $css = CssMin::minify(file_get_contents('css.php'));
    //$css = file_get_contents('css.php');
    echo $css;