$found = false; while( ($file = readdir($handle)) !== false ) { if( preg_match('/^[\w\d_-]+\.mbtiles$/', $file) && is_file($file) ) { try { $db = new PDO('sqlite:'.$file); $params = readparams($db); $zooms = readzooms($db); $db = null; print '<h3>'.htmlspecialchars($params['name']).'</h3>'; if( isset($params['description']) ) print '<p>'.htmlspecialchars($params['description']).'</p>'; print '<p>Type: '.$params['type'].', format: '.$params['format'].', version: '.$params['version'].'</p>'; if( isset($params['bounds']) ) print '<p>Bounds: '.str_replace(',', ', ',$params['bounds']).'</p>'; print '<p>Zoom levels: '.implode(', ', $zooms).'</p>'; print '<p>OpenLayers: <tt>new OpenLayers.Layer.OSM("'.htmlspecialchars($params['name']).'", "'.getbaseurl().preg_replace('/\.mbtiles/','',$file).'/${z}/${x}/${y}", {numZoomLevels: '.(end($zooms)+1).', isBaseLayer: '.($params['type']=='baselayer'?'true':'false').'});</tt></p>'; print '<p>TMS: <tt>http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/[^\/]+$/','/',$_SERVER['REQUEST_URI']).'1.0.0/'.preg_replace('/\.mbtiles/','',$file).'</tt></p>'; } catch( PDOException $e ) {} } } } else { print 'Error opening script directory.'; } } function getbaseurl() { return 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/(1.0.0\/)?[^\/]*$/','/',$_SERVER['REQUEST_URI']); } function readparams( $db ) { $params = array();
$charset = $conre['charset']; echo $liebiao_ruler = $conre['liebiao_ruler']; echo $liebiao_nrruler = $conre['liebiao_nrruler']; $m = intval(trim($_GET['m'])); $purl = $conlre['lieurl']; echo $purl . "<br>"; $bodys = $charset == "gb2312" ? g2u(ovovgetfile($purl)) : ovovgetfile($purl); $bodyinfo = ovcolect_content($liebiao_nrruler, $charset, $bodys); $bodyinfo = ovcolect_content_all($liebiao_ruler, $charset, $bodyinfo); print_r($bodyinfo); $i = 0; //获取真实的内容源链接 //$url = getbaseurl($source,$s); print_r($bodyinfo); foreach ($bodyinfo as $key) { $fullurl = getbaseurl($purl, $key); if ($Db->RowsAll("SELECT `id` FROM `" . $db_prefix . "collect_history` WHERE `col_id` =" . $article_id . " and `cid`=" . $cid . " and `sid`=" . $sid . " and `fullurl`='" . $fullurl . "' ") == 0) { $Db->ThisQuery("INSERT INTO `" . $db_prefix . "collect_history` (`col_id`,`cid`,`sid`,`fullurl`) VALUES (" . $article_id . "," . $cid . "," . $sid . ",'" . $fullurl . "')"); } $i++; } echo $fullurl . "<br>"; $Db->ThisQuery("update `" . $db_prefix . "collect_liebiao` set `lieurlno`=" . $i . ",`isco`=1 where ID=" . $lid . ""); echo "<font color=red>采集完毕!共采集" . $i . "条链接.完成时间:" . date("Y-m-d H:i:s") . "</font>"; exit; break; //批量集体内容页 //批量集体内容页 case 'config2': $coid = intval(trim($_GET['cid'])); $ccid = intval(trim($_GET['ccid']));
// Installed? if (filesize('../config.php') == 0) { header('Location: index.php'); exit; } define('VALID_ACCESS', TRUE); require 'common.php'; require 'language.php'; require 'database.php'; // Include Config and Common require '../config.php'; if (!defined('DIR_BASE')) { define('DIR_BASE', getbasepath()); } if (!defined('HTTP_BASE')) { define('HTTP_BASE', getbaseurl()); } require '../common.php'; $errors = array(); $language = new language(); $language->get_languages(); $language->check_default(); $database = new Database(); if ($language->error) { $errors[] = $language->error; } $language->load(isset($_POST['language']) ? $_POST['language'] : ($language->detect() ? $language->detect() : 'en')); $languages = $language->langs; $step = isset($_REQUEST['step']) ? $_REQUEST['step'] : 1; $files = array('config.php'); //,'admin'.DIRECTORY_SEPARATOR.'config.php' Not Required
function ovcolect_content_all($ruler, $charset, $bodys) { $uu = explode("[OVOVSPR]", $ruler); $rulnums = count($uu); if ($rulnums == 1) { $ruler = getrole($ruler, $charset); //字符编码 preg_match_all("/" . $ruler . "/iU", $bodys, $bdtt); $bodys = $bdtt[1]; } else { for ($i = 0; $i < $rulnums; $i++) { $ruler = getrole($uu[$i], $article['charset']); //字符编码 $ruler ? preg_match_all("/" . $ruler . "/iU", $bodys, $bdtt) : ""; $newbodys = getbaseurl($bdtt[1]); $bodys = ""; foreach ($newbodys as $temp) { $bodys .= $temp . "{oovv}"; } } $bodys = explode("{oovv}", rtrim($bodys, "{oovv}")); } return $bodys; }