function snatchGetInfo($url, $para = array())
{
    global $db, $setting;
    $date = isset($para['date']) ? $para['date'] : date("Ymd");
    $url = "http://news.sohu.com/_scroll_newslist/" . $date . "/news.inc";
    $info = array();
    $info['page_count'] = 1;
    $header = array();
    if (isset($para['header'])) {
        $header = $para['header'];
    }
    $info['header'] = $header;
    if ($content = GetRemoteContent($url, $header)) {
        $content = preg_replace("/^.+?(\\{.+\\}).*\$/", '\\1', $content);
        $content = json_decode_js($content, true);
        $info['catList'] = $content['category'];
        $info['newList'] = $content['item'];
        unset($content);
        $info['cat_main'] = $db->result($setting['db']['pre'] . "news_cat", "cat_id", array("cat_name", "=", "新闻资讯"));
        if (empty($info['cat_main'])) {
            $db->insert($setting['db']['pre'] . "news_cat", array(0, $para['web_id'], 0, '新闻资讯', '国内,国际,社会,财经,军事,体育,娱乐,文化,汽车', '国内资讯,国际资讯,社会资讯,财经资讯,军事资讯,体育资讯,娱乐资讯,文化资讯,汽车资讯', 'news', '', '', 1, 0, '', 1, 255, 0, ''));
            $info['cat_main'] = $db->GetInsertId();
        }
        for ($i = 0, $m = count($info['catList']); $i < $m; $i++) {
            $info['catList'][$i][0] = chg_charset($info['catList'][$i][0], "utf-8", $setting['gen']['charset']);
            $cat_id = $db->result($setting['db']['pre'] . "news_cat", "cat_id", array("cat_name", "=", $info['catList'][$i][0]));
            if (empty($cat_id)) {
                $keyword = "";
                $descripiton = "";
                if ($content = GetRemoteContent($info['catList'][$i][1], $header)) {
                    if (preg_match("/<meta name=\"keywords\" content=\"(.+?)\">/i", $content, $matches)) {
                        $keyword = str_replace(" ", ",", $matches[1]);
                        unset($matches);
                    }
                    if (preg_match("/<meta name=\"description\" content=\"(.+?)\">/i", $content, $matches)) {
                        $descripiton = str_replace(" ", ",", $matches[1]);
                        unset($matches);
                    }
                }
                $db->insert($setting['db']['pre'] . "news_cat", array(0, $para['web_id'], $info['cat_main'], $info['catList'][$i][0], $keyword, $descripiton, $info['catList'][$i][0], '', '', 1, 0, '', 2, 255, 0, ''));
                $cat_id = $db->GetInsertId();
            }
            $info['catList'][$i][] = $cat_id;
        }
        deleteCache("news_cat");
        for ($i = 0, $m = count($info['newList']); $i < $m; $i++) {
            $info['newList'][$i][1] = chg_charset($info['newList'][$i][1], "utf-8", $setting['gen']['charset']);
            $info['newList'][$i][] = $info['catList'][$info['newList'][$i][0]][2];
        }
    } else {
        return false;
    }
    return $info;
}
Esempio n. 2
0
        if (!empty($cs)) {
            $sql_list = chg_charset($sql_list, $setting['gen']['charset'], $cs);
        }
        $update_info = array('sql' => $sql_list, 'file' => $file_list, 'content' => array());
        for ($i = 0, $m = count($update_info['file']); $i < $m; $i++) {
            $the_file = $plugin_path . "/" . $p . "/" . $update_info['file'][$i];
            if (file_exists($the_file)) {
                if (is_dir($the_file)) {
                    $update_info['content'][$i] = ".";
                } else {
                    $update_info['content'][$i] = GetFile($the_file);
                    $path_parts = pathinfo($update_info['file'][$i]);
                    if (!empty($cs) && strpos(".php,.tpl,.html,.htm,.sql", $path_parts["extension"]) !== false) {
                        $update_info['content'][$i] = str_ireplace(strtolower($setting['gen']['charset']), strtolower($cs), $update_info['content'][$i]);
                        $update_info['content'][$i] = str_ireplace(strtoupper($setting['gen']['charset']), strtoupper($cs), $update_info['content'][$i]);
                        $update_info['content'][$i] = chg_charset($update_info['content'][$i], $setting['gen']['charset'], $cs);
                    }
                }
            } else {
                $update_info['content'][$i] = "";
            }
        }
        $update = base64_encode(serialize($update_info));
        WriteFile($cache_file, $update, "wb");
    }
    echo $update;
} else {
    $fso = new MyFSO();
    $dir_list = $fso->Get_List($plugin_path);
    $plugin_list = array();
    for ($i = 0, $m = count($dir_list['dir']); $i < $m; $i++) {
Esempio n. 3
0
                $log_info = $setting['language']['plugin_admin_cat_add'];
                $db->insert($setting['db']['pre'] . "admin_cat", $_POST, true);
            } else {
                $log_info = $setting['language']['plugin_admin_cat_edit'];
                $db->update($setting['db']['pre'] . "admin_cat", $_POST, array("id", "n=", $id));
            }
            deleteCache("admin_cat");
        }
        break;
    default:
        $goto_url = $setting['info']['self'];
}
if (!empty($log_info)) {
    write_log($log_info, "id=" . $id);
    includeCache("admin_cat");
    $admin_cat = json_encode(chg_charset($admin_cat, $setting['gen']['charset'], "utf-8"));
    echo <<<mystep
<script language="javascript">
try{
\tparent.admin_cat = {$admin_cat};
\tparent.setNav();
} catch(e){}
location.href="{$setting['info']['self']}";
</script>
mystep;
}
$mystep->pageEnd(false);
function build_page($method)
{
    global $mystep, $req, $db, $setting, $id;
    $tpl_info = array("idx" => $method == "list" ? "list" : "input", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
Esempio n. 4
0
 protected function PackFile($dir = ".", $separator = "|")
 {
     $dir = str_replace("//", "/", $dir);
     $ignore = array();
     if (is_file($dir . "/ignore")) {
         $ignore = file_get_contents($dir . "/ignore");
         if (strlen($ignore) == 0) {
             return;
         }
         $ignore = str_replace("\r", "", $ignore);
         $ignore = explode("\n", $ignore);
     }
     for ($i = 0, $m = count($this->file_ignore); $i < $m; $i++) {
         if (substr($dir, -strlen($this->file_ignore[$i])) == $this->file_ignore[$i]) {
             return;
         }
     }
     if (is_dir($dir)) {
         $content = "dir" . $separator . str_replace($this->pack_dir, "", $dir) . $separator . filemtime($dir) . "\n";
         fwrite($this->pack_fp, $content);
         $mydir = opendir($dir);
         while ($file = readdir($mydir)) {
             if (trim($file, ".") == "" || $file != "install" && array_search($file, $ignore) !== false) {
                 continue;
             }
             $this->PackFile($dir . "/" . $file);
         }
         closedir($mydir);
     } elseif (is_file($dir)) {
         $content = "file" . $separator . str_replace($this->pack_dir, "", $dir) . $separator . filesize($dir) . $separator . filemtime($dir) . "\n";
         if (isset($this->charset['file_ext'])) {
             $file_content = GetFile($dir);
             $path_parts = pathinfo($dir);
             if (strpos($this->charset['file_ext'], $path_parts["extension"]) !== false) {
                 $file_content = str_ireplace(strtolower($this->charset['from']), strtolower($this->charset['to']), $file_content);
                 $file_content = str_ireplace(strtoupper($this->charset['from']), strtoupper($this->charset['to']), $file_content);
                 if (!empty($this->charset['lng_type'])) {
                     $file_content = chg_lng_custom($file_content, $this->charset['lng_type'], $this->charset['from']);
                 } else {
                     if (strtolower($this->charset['to']) == "big5") {
                         $file_content = chs2cht($file_content, $this->charset['from']);
                     }
                 }
                 if (strpos($dir, "include/config.php")) {
                     $file_content = preg_replace("/\\\$setting\\['web'\\]\\['s_pass'\\].+?;/", "\$setting['web']['s_pass'] = '';", $file_content);
                     $file_content = preg_replace("/\\\$setting\\['db'\\]\\['pass'\\].+?;/", "\$setting['db']['pass'] = '';", $file_content);
                     $file_content = preg_replace("/\\\$setting\\['email'\\]\\['password'\\].+?;/", "\$setting['email']['password'] = '';", $file_content);
                 }
                 $result = chg_charset($file_content, $this->charset['from'], $this->charset['to']);
                 $content = "file" . $separator . str_replace($this->pack_dir, "", $dir) . $separator . strlen($result) . $separator . filemtime($dir) . "\n";
                 $file_content = $result;
             }
             $content .= $file_content;
         } else {
             $content .= GetFile($dir);
         }
         fwrite($this->pack_fp, $content);
         $this->file_count++;
         array_push($this->pack_result, "<b>Packing File</b> <font color='blue'>{$dir}</font> (" . GetFileSize($dir) . ")");
     }
     return;
 }
Esempio n. 5
0
                require ROOT_PATH . "/source/class/myzip.class.php";
                $dir = ROOT_PATH . "/" . $setting['path']['upload'] . "/tmp/";
                $zipfile = $dir . "update_" . date("Ymd") . ".zip";
                @unlink($zipfile);
                $dir = $dir . "update/" . date("Ymd/");
                $files = array();
                for ($i = 0; $i < $m; $i++) {
                    if ($update_info['content'][$list[$i]] == ".") {
                        continue;
                    }
                    $files[$i] = $dir . $update_info['file'][$list[$i]];
                    WriteFile($files[$i], $update_info['content'][$list[$i]], "wb");
                }
                if (zip($files, $zipfile, $dir)) {
                    $link = $setting['web']['url'] . "/" . $setting['path']['upload'] . "/tmp/" . basename($zipfile);
                }
                MultiDel($dir);
            }
        }
        echo $link;
        break;
    default:
        $header = array();
        $header['Referer'] = "http://" . $req->GetServer("HTTP_HOST");
        $header['ms_sign'] = $setting['web']['sign'];
        $check_info = GetRemoteContent($setting['gen']['update'] . "?m=check&v=" . $ms_version['ver'] . "&cs=" . $setting['gen']['charset'], $header);
        $check_info = chg_charset($check_info, "utf-8", $setting['gen']['charset']);
        echo $check_info;
        break;
}
$mystep->pageEnd(false);
Esempio n. 6
0
 $keyword = substrPro($keyword, 0, 200);
 $keyword = htmlspecialchars($keyword);
 if ($record = $db->record($setting['db']['pre'] . "search_keyword", "*", array("keyword", "=", $keyword))) {
     $record['chg_date'] = time();
     $record['count'] += 1;
 } else {
     $record['keyword'] = $keyword;
     $record['count'] = 1;
     $record['add_date'] = time();
     $record['chg_date'] = time();
 }
 $db->replace($setting['db']['pre'] . "search_keyword", $record);
 if (!empty($mode)) {
     include dirname(__FILE__) . "/se.php";
     $url = $se[$mode];
     $goto_url = $url . urlencode(chg_charset($keyword, $setting['gen']['charset'], "utf-8") . " site:" . $setting['info']['web']['host']);
 } else {
     $page = $req->getGet("page");
     if (!is_numeric($page) || $page < 1) {
         $page = 1;
     }
     $tpl = $mystep->getInstance("MyTpl", $tpl_info, $cache_info);
     $tpl_info['idx'] = "search";
     $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
     $web_id = $setting['info']['web']['web_id'];
     $list_limit = array_values($setting['list']);
     $page_size = $list_limit[0];
     $condition = array();
     if (!empty($keyword)) {
         $condition[] = array("subject", "like", $keyword);
     }
Esempio n. 7
0
$ms_sign = 1;
$etag_expires = 604800;
define('ROOT_PATH', str_replace("\\", "/", realpath(dirname(__FILE__) . "/../")));
require ROOT_PATH . "/include/config.php";
require ROOT_PATH . "/include/parameter.php";
require ROOT_PATH . "/source/function/etag.php";
require ROOT_PATH . "/source/function/global.php";
require ROOT_PATH . "/source/function/web.php";
require ROOT_PATH . "/source/class/abstract.class.php";
require ROOT_PATH . "/source/class/mystep.class.php";
$mystep = new MyStep();
$mystep->pageStart(true);
header('Content-Type: application/x-javascript');
$cache_file = ROOT_PATH . "/" . $setting['path']['cache'] . "script/" . $setting['info']['web']['idx'] . "_language.js";
if (file_exists($cache_file) && filemtime($cache_file) + $etag_expires > $setting['info']['time_start'] / 1000) {
    $result = GetFile($cache_file);
} else {
    $result = "";
    foreach ($setting['language'] as $key => $value) {
        $setting['language'][$key] = chg_charset($value, $setting['gen']['charset'], "utf-8");
    }
    $result = "var language = " . json_encode($setting['language']) . ";";
    WriteFile($cache_file, $result, "wb");
}
header("Accept-Ranges: bytes");
header("Accept-Length: " . strlen($result));
echo $result;
$mystep->pageEnd(false);
?>
D:/Website/mystep/aa.txtD:/Website/mystep/aa.txt
Esempio n. 8
0
function import_log($log, $charset = "gbk")
{
    global $info_import;
    if ($charset != "utf-8") {
        $log = chg_charset($log, $charset, "utf-8");
    }
    writeFile($info_import, $log . chr(13), "ab");
    return;
}
Esempio n. 9
0
        $_POST["tpl_list_data"] = str_replace("&#160; ", "\t", $_POST["tpl_list_data"]);
        $_POST["tpl_list_data"] = str_replace(hexToStr("c2a0"), "\t", $_POST["tpl_list_data"]);
        WriteFile("setting/{$mid}_list_data.tpl", $_POST["tpl_list_data"], "wb");
        $_POST["ext_script"] = str_replace("&#160; ", "\t", $_POST["ext_script"]);
        $_POST["ext_script"] = str_replace(hexToStr("c2a0"), "\t", $_POST["ext_script"]);
        WriteFile("setting/{$mid}_ext_script.php", $_POST["ext_script"], "wb");
        if (empty($_POST["itemlist"])) {
            include "setting/{$mid}.php";
            $para = var_export($para, true);
        } else {
            $_POST["itemlist"] = chg_charset($_POST["itemlist"], $setting['gen']['charset'], "utf-8");
            $json = json_decode($_POST["itemlist"]);
            $para = var_export($json, true);
            $para = str_replace("stdClass::__set_state(", "", $para);
            $para = str_replace("))", ")", $para);
            $para = chg_charset($para, "utf-8", $setting['gen']['charset']);
        }
        if (function_exists("ext_func")) {
            ext_func();
        }
        WriteFile("setting/{$mid}.php", '<?php
$para = ' . str_replace("\r", "", $para) . ';		
?>', "wb");
        deleteCache("admin_cat");
        unset($para);
        include "setting/{$mid}.php";
        $sql_list = array();
        $del_item = array();
        foreach ($para as $key => $value) {
            if (isset($value['op'])) {
                $item_type = "";