コード例 #1
0
ファイル: index.php プロジェクト: pombredanne/epg_updater
/**
 * Get data for channel and announce parsing
 *
 * @param Channel ID $channel
 * @param 2 for announce, 3 for channel $type
 * @param path for file $path
 */
function get_html($channel, $path)
{
    global $message, $week;
    //$message .= "Get stream of type=$type" . PHP_EOL;
    $referer_channel = 'http://www.kulichki.tv/cgi-bin/gpack.cgi';
    $post_url_channel = 'http://www.kulichki.tv/andgon/cgi-bin/itv.cgi';
    $post_data_channel = "week={$week}&day=1&day=2&day=3&day=4&day=5&day=6&day=7&chanel={$channel}";
    $html = getdata($post_url_channel, 'POST', $referer_channel, $post_data_channel);
    $html = preg_replace("/><pre>/u", ">\n<pre>", $html);
    if (write_html($html, $path) == 0) {
        print $message;
    }
}
コード例 #2
0
ファイル: genhtml.php プロジェクト: it114/witness
function write_var($path, $info, $prefix)
{
    global $globals, $error;
    $error = false;
    $org = set_error_handler('witness_error_handler');
    $var = unserialize($info['value']);
    set_error_handler($org);
    $params = array('name' => $info['name'], 'value' => $error === false ? $var : $info['value'], 'globals' => $globals);
    $file = $prefix . '_' . (isset($info['call']) === true ? $info['call'] . '_' : '') . $info['name'] . '.html';
    if (write_html($params, 'var.template.php', "{$path}/var/{$file}") === false) {
        return null;
    }
    return write_link($file, $params['name'], $params['value']);
}
コード例 #3
0
ファイル: index.php プロジェクト: istrwei/ybs_xiaotou
require 'config.php';
require 'function.php';
$fromurl = 'http://bt.doc5188.com';
$indexhtml = 'index.cache.html';
if (file_exists($indexhtml)) {
    $filetime = filemtime($indexhtml);
    $nowtime = time();
    if ($nowtime - $filetime > $config['cachetime']) {
        $content = get_html($fromurl, $config);
        echo $content;
        write_html($content, $indexhtml);
    } else {
        $content = file_get_contents($indexhtml);
        exit($content);
    }
} else {
    $content = get_html($fromurl, $config);
    echo $content;
    write_html($content, $indexhtml);
}
function get_html($siteurl, $config)
{
    $str = get_url_contents($siteurl);
    $str = str_replace('http://bt.doc5188.com', $config['siteurl'], $str);
    $str = str_replace('优搜磁力搜索', $config['title'], $str);
    $str = str_replace('/statics/', $config['erji'] . 'statics/', $str);
    $str = preg_replace('/<title>([\\s\\S]*?)<\\/title>/i', '<title>' . $config['title'] . ' - 做最全的资源搜索引擎 - 没有搜不到,只有想不到!</title>', $str);
    $str = preg_replace('/<div style="display:none;">([\\s\\S]*?)<\\/div>/i', '<div class="foot">友情链接:' . $config['link'] . '</div><div style="display:none;">' . $config['tongji'] . '</div>', $str);
    $str = str_replace('action="/search"', 'action="' . $config['erji'] . 'search.php"', $str);
    return $str;
}
コード例 #4
0
ファイル: wsc.php プロジェクト: amoryver/ws-converter
function write_worksheet($in, $file, $options = array())
{
    $ext = pathinfo($file, PATHINFO_EXTENSION);
    if (isset($options["write"])) {
        if ($ext != "" && $options["write"] != $ext) {
            fputs(STDERR, "Warning: Ignored the extension to adopt {$options["write"]}.\n");
        }
        $ext = $options["write"];
    }
    switch (strtolower($ext)) {
        case "raw":
            $out = fopen($file, "w");
            while (($line = fgets($in)) !== false) {
                fputs($out, $line);
            }
            fclose($out);
            break;
        case "csv":
            $options["delimiter"] = ",";
            write_csv($in, $file, $options);
            break;
        case "tsv":
            $options["delimiter"] = "\t";
            write_csv($in, $file, $options);
            break;
        case "xlsx":
            write_excel($in, $file, $options);
            break;
        case "json":
            write_json($in, $file, $options);
            break;
        case "yml":
        case "yaml":
            write_yaml($in, $file, $options);
            break;
        case "xml":
            write_xml($in, $file, $options);
            break;
        case "htm":
        case "html":
            // a write only converter
            write_html($in, $file, $options);
            break;
        case "tex":
            // a write only converter
            write_tex($in, $file, $options);
            break;
        case "sql":
            // a write only converter
            write_sql($in, $file, $options);
            break;
        default:
            fputs(STDERR, "Error[{$ext}]: No writer is available.\n");
            break;
    }
    return;
}
コード例 #5
0
ファイル: index.php プロジェクト: robertdherb/just-a-blog
if (file_exists("./blogdir.txt")) {
    $blogDir = file_get_contents("blogdir.txt");
} else {
    trigger_error("Could not find blogdir.txt, make sure it is in the same\n\tdirectory as index.php. Assuming blog is at \"/\"", E_USER_NOTICE);
    $blogDir = "";
}
//$blogDir = $documentRoot . "/" .
preg_match("([0-9A-Za-z_\\-]+)", $blogDir) . "/";
define("BLOG_DIR", $blogDir);
$pages = scandir("pages/");
$pages = array_diff($pages, array("..", "."));
/* Make sure a home page exists. One should be supplied for you. */
if (!file_exists("pages/home.md")) {
    trigger_error("No home page. Make sure there is a file named home.md in \n\t\tthe pages directory.", E_USER_ERROR);
}
sort($pages);
$headerHtml = "templates/header.html";
include "header.php";
$parsedown = new Parsedown();
if (isset($_GET['page'])) {
    $content = file_get_contents("pages/" . $_GET['page'] . ".md");
} else {
    if (isset($_GET['post'])) {
        $content = file_get_contents("posts/" . $_GET['post'] . ".md");
    } else {
        $content = file_get_contents("pages/home.md");
    }
}
print write_html($parsedown->text($content));
write_html(file_get_contents("html/footer.html"));
コード例 #6
0
ファイル: header.php プロジェクト: robertdherb/just-a-blog
<?php

$nav = "<ul class=\"nav\">\n";
foreach ($pages as $thisPage) {
    $nav .= "\t\t\t<li id=\"" . $thisPage . "\">\n\t\t\t\t<a href=\"" . URL . BLOG_DIR . "/page/" . link_name($thisPage) . "\">" . format_name($thisPage) . "</a></li>\n";
}
$nav .= "</ul>";
$title = "Just a Blog";
if (isset($_GET['page'])) {
    $thisPage = $_GET['page'];
    $title .= " - " . format_name($thisPage);
}
write_html(file_get_contents("html/header.html"), $title, $blogDir, $nav);
コード例 #7
0
ファイル: parser.php プロジェクト: pombredanne/epg_updater
function get_html($channel, $type, $path)
{
    if ($type == 'sputnik') {
        $type = 3;
    } elseif ($type == 'anons') {
        //anonces
        $type = 2;
    }
    $week = '0505';
    $host = 'tv.kulichki.net';
    //$referer_packets = 'http://tv.kulichki.net/';
    $referer_channel = 'http://tv.kulichki.net/cgi-bin/gpack.cgi';
    $post_url_channel = '/andgon/cgi-bin/itv.cgi';
    $post_data_channel = "week={$week}&day=1&day=2&day=3&day=4&day=5&day=6&day=7&chanel={$channel}.{$type}";
    //$post_url_packets = '/cgi-bin/gpack.cgi';
    //$post_data_packets = "week=$week&pakets=sputnik";
    //$post_parameters_packets = array ('week', 'pakets' );
    //$post_parameters_channel = array ('week', 'tv', 'chanel' );
    $html = getdata($host, $referer_channel, $post_url_channel, $post_data_channel);
    $html = preg_replace("/><pre>/", "/>\n<pre>", $html);
    //remove header
    $html = preg_replace('/.*<\\/HEAD>/su', '', $html);
    write_html($html, $path);
}