Example #1
0
foreach ($urls as $k => $url_list) {
    $url = collection::get_url_lists($url_list, $cjconfig);
    //var_dump($url );exit;
    if (is_array($url) && !empty($url)) {
        foreach ($url as $v) {
            //if (empty($v['url']) || empty($v['title']) || (strpos($v['url'],'www.chinacatholic.org')<1)) continue;
            if (empty($v['url']) || empty($v['title']) || strpos($v['url'], 'www.chinacatholic.org') < 1) {
                echo '<b>invalid url:' . $v['url'] . '</b><br/>';
                continue;
            }
            //$v = new_addslashes($v);
            $v['url'] = str_replace('/index/id', '', $v['url']);
            $v['title'] = strip_tags($v['title']);
            $md5 = md5($v['url']);
            if (!$db->get_one('id', 'faithlife', " md5url='{$md5}' ")) {
                $cinfo = get_content($v['url']);
                //获取发布时间、作者、来源、内容
                //生成静态页面
                ob_start();
                include WX_PATH . 'faithlife' . DIRECTORY_SEPARATOR . 'show.tpl.php';
                $file = 'faithlife' . DIRECTORY_SEPARATOR . date('Y') . DIRECTORY_SEPARATOR . date('m') . DIRECTORY_SEPARATOR . md5($v['url']) . '.html';
                $nurl = WX_PATH . $file;
                createhtml($nurl);
                $addinfo = array('md5url' => $md5, 'ctype' => (int) ($k / 100), 'furl' => $v['url'], 'title' => $v['title'], 'nurl' => $file, 'inputtime' => $cinfo['inputtime'], 'picurl' => $v['pic']);
                $addinfo = new_addslashes($addinfo);
                $db->insert($addinfo, 'faithlife');
                echo 'new ' . $file . '</br>';
            }
        }
    }
}
Example #2
0
            if (empty($makecache['ele'])) {
                break;
            }
            $total = count($makecache['ele']);
            $ele = array();
            $ele = array_shift($makecache['ele']);
            $qarr = parseparameter($ele);
            $_SGET = $qarr;
            $_SGET['page'] = empty($_SGET['page']) || intval($_SGET['page']) < 1 ? 1 : intval($_SGET['page']);
            if ($qarr['action'] == 'model') {
                $qarr['action'] = 'modelview';
            }
            if (empty($channels['menus'][$qarr['action']]['upnameid']) && $channels['menus'][$qarr['action']]['upnameid'] != 'news') {
                $rs = createhtml(S_ROOT . "./{$qarr['action']}.php", $ele);
            } else {
                $rs = createhtml(S_ROOT . "./news.php", $ele);
            }
            if ($rs != true) {
                showmessage($rs);
            }
        }
        $cachetext = '$makecache=' . arrayeval($makecache);
        writefile($cachefile, $cachetext, 'php');
        $nexturl = CPURL . '?action=freshhtml&op=making&page=' . ++$page;
        jumpmessage($nexturl, $alang['freshhtml_making_page_info_0'] . $total . $alang['freshhtml_making_page_info_1'] . $perpage . $alang['freshhtml_making_page_info_2'] . $page . $alang['freshhtml_making_page_info_3']);
    } else {
        $nexturl = CPURL . '?action=freshhtml&op=cache';
        jumpmessage($nexturl, $alang['making_page_cache_update']);
    }
}
include template('admin/tpl/freshhtml.htm', 1);