<?php include_once '../secret/api_key.php'; include '../_top.php'; include '../functions.php'; include_once '../hp-includes/people_lib.php'; function getArticleId($time, $place, $link, $title, $photo, $source) { $s = mysql_query("SELECT id FROM news_articles WHERE link='{$link}'"); if ($r = mysql_fetch_array($s)) { return $r['id']; } else { mysql_query("INSERT INTO news_articles(time, place, link, title, photo, source)\n VALUES({$time}, '{$place}', '{$link}', '{$title}', '{$photo}', '{$source}')"); return mysql_insert_id(); } } $idperson = trim($_POST['id']); $time = trim($_POST['time']); $place = trim($_POST['place']); $link = trim($_POST['link']); $title = trim($_POST['title']); $source = trim($_POST['source']); $photo = trim($_POST['photo']); $idarticle = trim($_POST['idarticle']); if (!$idarticle) { $idarticle = getArticleId($time, $place, $link, $title, $photo, $source); } if ($idperson > 0) { mysql_query("INSERT IGNORE INTO news_people(idperson, idarticle)\n VALUES({$idperson}, {$idarticle})"); } echo $idarticle;
/** * Execute the console command. * * @return mixed */ public function handle() { $client = new Client(); $crawler = $client->request('GET', 'http://claremontindependent.com/category/campus-news/'); $status_code = $client->getResponse()->getStatus(); if ($status_code == 200) { echo '200 OK<br>'; } $crawler->filter('div.site-content article')->each(function ($node) { $url = $node->filter('a.post-thumbnail')->attr('href'); //url $imgUrl = $node->filter('a.post-thumbnail img')->attr('src'); //imgUrl $title = $node->filter('header h1')->text(); //title $date = substr($node->filter('header div.entry-meta span.entry-date time')->attr('datetime'), 0, 10); //date $author = $node->filter('header div.entry-meta span.byline span.author a')->text(); //author $description = substr(mb_convert_encoding($node->filter('div.entry-content p')->text(), "HTML-ENTITIES", "UTF-8"), 0, 500); //description $id = getArticleId($date); if (Posts::where('title', '=', $title)->exists()) { echo $title . " already exists"; } else { $post = new Posts(); $post->article_id = $id; $post->author = $author; $post->title = $title; $post->description = $description; $post->imgUrl = $imgUrl; $post->url = $url; $post->source = 'Claremont Independent'; $post->save(); echo "stored " . $title . "!"; } }); $client = new Client(); $crawler = $client->request('GET', 'http://www.thegoldenantlers.com/'); $status_code = $client->getResponse()->getStatus(); if ($status_code == 200) { echo '200 OK<br>'; } $count = 0; $crawler->filter('div.bl_posts_information')->each(function ($node, $count) { if ($count == 0) { $node->filter('article')->each(function ($node1) { $author = ucwords(str_replace('-', ' ', $node1->attr('data-categoryslug'))); //author $url = $node1->filter('div.post-image a')->attr('href'); //url $imgUrl = $node1->filter('div.post-image img')->attr('src'); //imgUrl $date = $node1->filter('div.post-image div.meta-info div.info-date time')->attr('datetime'); //date $date = substr(createDateAntlers($date), 0, 10); $title = $node1->filter('div.post-body h3')->text(); //title $description = str_replace("CONTINUE READING", "", trimWhiteSpace(str_replace(" ", "", mb_convert_encoding($node1->filter('div.post-body div.post-content p')->text(), "HTML-ENTITIES", "UTF-8")))); //description $id = getArticleId($date); if (Posts::where('title', '=', $title)->exists()) { echo $title . " already exists"; } else { $post = new Posts(); $post->article_id = $id; $post->author = $author; $post->title = $title; $post->description = $description; $post->imgUrl = $imgUrl; $post->url = $url; $post->source = 'The Golden Antlers'; $post->save(); echo "stored " . $title . "!"; } }); } $count++; }); $client = new Client(); $crawler = $client->request('GET', 'http://cmcforum.com/'); $status_code = $client->getResponse()->getStatus(); if ($status_code == 200) { echo '200 OK<br>'; } $count = 0; $crawler->filter('div.td-big-grid-wrapper div.td-big-grid-post')->each(function ($node, $count) { if ($count == 0) { $url = $node->filter('div.td-module-thumb a')->attr('href'); //url no clean $imgUrl = $node->filter('a img')->attr('src'); //imgUrl no clean $title = $node->filter('div.td-big-grid-meta h3 a')->text(); //clean title $date = substr($node->filter('div.td-big-grid-meta div.td-module-meta-info div.td-post-date time')->attr('datetime'), 0, 10); //date clean $author = $node->filter('div.td-big-grid-meta div.td-module-meta-info div.td-post-author-name a')->text(); //author clean $client2 = new Client(); $crawler2 = $client2->request('GET', $url); $description = $crawler2->filter('div.td-post-content p')->text(); $id = DB::table('email_articles')->where('post_date', $date)->value('article_id'); if (Posts::where('title', '=', $title)->exists()) { echo $title . " already exists"; } else { $post = new Posts(); $post->article_id = $id; $post->author = $author; $post->title = $title; $post->description = $description; $post->imgUrl = $imgUrl; $post->url = $url; $post->source = 'The Forum'; $post->save(); echo "stored " . $title . "!"; } } $count++; }); }
function resetAccessData_temp() { handlePower('恢复模板数据'); //管理权限处理 $GLOBALS['conn='] = OpenConn(); $splStr = ''; $i = ''; $s = ''; $columnname = ''; $title = ''; $nCount = ''; $webdataDir = ''; $webdataDir = @$_REQUEST['webdataDir']; if ($webdataDir != '') { if (checkFolder($webdataDir) == false) { eerr('网站数据目录不存在,恢复默认数据未成功', $webdataDir); } } else { $webdataDir = '/Data/WebData/'; } aspEcho('提示', '恢复数据完成'); rw('<hr><a href=\'../index.php\' target=\'_blank\'>进入首页</a> | <a href="?" target=\'_blank\'>进入后台</a>'); $content = ''; $filePath = ''; $parentid = ''; $author = ''; $adddatetime = ''; $fileName = ''; $bodycontent = ''; $webtitle = ''; $webkeywords = ''; $webdescription = ''; $sortrank = ''; $labletitle = ''; $target = ''; $websitebottom = ''; $webTemplate = ''; $webimages = ''; $webcss = ''; $webjs = ''; $flags = ''; $websiteurl = ''; $splxx = ''; $columntype = ''; $relatedtags = ''; $npagesize = ''; $customaurl = ''; $nofollow = ''; $templatepath = ''; $isthrough = ''; $titlecolor = ''; $showreason = ''; $ncomputersearch = ''; $nmobliesearch = ''; $ncountsearch = ''; $ndegree = ''; //竞价表 $displaytitle = ''; $aboutcontent = ''; $isonhtml = ''; //单页表 $columnenname = ''; //导航表 $smallimage = ''; $bigImage = ''; $bannerimage = ''; //文章表 $httpurl = ''; $price = ''; $morepageurl = ''; $charset = ''; $thispage = ''; $countpage = ''; $bigClassName = ''; $startStr = ''; $endStr = ''; $startaddstr = ''; $endaddstr = ''; $sType = ''; $saction = ''; $fieldName = ''; $fieldcheck = ''; //网站配置 $content = GetFText($webdataDir . '/website.txt'); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } if ($content != '') { $webtitle = newGetStrCut($content, 'webtitle'); $webkeywords = newGetStrCut($content, 'webkeywords'); $webdescription = newGetStrCut($content, 'webdescription'); $websitebottom = newGetStrCut($content, 'websitebottom'); $webTemplate = newGetStrCut($content, 'webtemplate'); $webimages = newGetStrCut($content, 'webimages'); $webcss = newGetStrCut($content, 'webcss'); $webjs = newGetStrCut($content, 'webjs'); $flags = newGetStrCut($content, 'flags'); $websiteurl = newGetStrCut($content, 'websiteurl'); if (getRecordCount($GLOBALS['db_PREFIX'] . 'website', '') == 0) { connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'website(webtitle) values(\'测试\')'); } connexecute('update ' . $GLOBALS['db_PREFIX'] . 'website set webtitle=\'' . $webtitle . '\',webkeywords=\'' . $webkeywords . '\',webdescription=\'' . $webdescription . '\',websitebottom=\'' . $websitebottom . '\',webtemplate=\'' . $webTemplate . '\',webimages=\'' . $webimages . '\',webcss=\'' . $webcss . '\',webjs=\'' . $webjs . '\',flags=\'' . $flags . '\',websiteurl=\'' . $websiteurl . '\''); } //导航 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'webcolumn'); $content = getDirTxtList($webdataDir . '/webcolumn/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('导航', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【webtitle】') > 0) { $s = $s . vbCrlf(); $webtitle = newGetStrCut($s, 'webtitle'); $webkeywords = newGetStrCut($s, 'webkeywords'); $webdescription = newGetStrCut($s, 'webdescription'); $customaurl = newGetStrCut($s, 'customaurl'); $sortrank = newGetStrCut($s, 'sortrank'); if ($sortrank == '') { $sortrank = 0; } $fileName = newGetStrCut($s, 'filename'); $columnname = newGetStrCut($s, 'columnname'); $columnenname = newGetStrCut($s, 'columnenname'); $columntype = newGetStrCut($s, 'columntype'); $flags = newGetStrCut($s, 'flags'); $parentid = newGetStrCut($s, 'parentid'); $parentid = phpTrim(getColumnId($parentid)); //可根据栏目名称找到对应ID 不存在为-1 //call echo("parentid",parentid) $labletitle = newGetStrCut($s, 'labletitle'); //每页显示条数 $npagesize = newGetStrCut($s, 'npagesize'); if ($npagesize == '') { $npagesize = 10; } //默认分页数为10条 $target = newGetStrCut($s, 'target'); $smallimage = newGetStrCut($s, 'smallimage'); $bigImage = newGetStrCut($s, 'bigImage'); $bannerimage = newGetStrCut($s, 'bannerimage'); $templatepath = newGetStrCut($s, 'templatepath'); $bodycontent = newGetStrCut($s, 'bodycontent'); $bodycontent = contentTranscoding($bodycontent); //是否启用生成html $isonhtml = newGetStrCut($s, 'isonhtml'); if ($isonhtml == '0' || lCase($isonhtml) == 'false') { $isonhtml = 0; } else { $isonhtml = 1; } //是否为nofollow $nofollow = newGetStrCut($s, 'nofollow'); if ($nofollow == '1' || lCase($nofollow) == 'true') { $nofollow = 1; } else { $nofollow = 0; } //call echo(columnname,nofollow) $aboutcontent = newGetStrCut($s, 'aboutcontent'); $aboutcontent = contentTranscoding($aboutcontent); $bodycontent = newGetStrCut($s, 'bodycontent'); $bodycontent = contentTranscoding($bodycontent); connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'webcolumn (webtitle,webkeywords,webdescription,columnname,columnenname,columntype,sortrank,filename,customaurl,flags,parentid,labletitle,aboutcontent,bodycontent,npagesize,isonhtml,nofollow,target,smallimage,bigImage,bannerimage,templatepath) values(\'' . $webtitle . '\',\'' . $webkeywords . '\',\'' . $webdescription . '\',\'' . $columnname . '\',\'' . $columnenname . '\',\'' . $columntype . '\',' . $sortrank . ',\'' . $fileName . '\',\'' . $customaurl . '\',\'' . $flags . '\',' . $parentid . ',\'' . $labletitle . '\',\'' . $aboutcontent . '\',\'' . $bodycontent . '\',' . $npagesize . ',' . $isonhtml . ',' . $nofollow . ',\'' . $target . '\',\'' . $smallimage . '\',\'' . $bigImage . '\',\'' . $bannerimage . '\',\'' . $templatepath . '\')'); } } } } //文章 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'articledetail'); $content = getDirAllFileList($webdataDir . '/articledetail/', 'txt'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('文章', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【title】') > 0) { $s = $s . vbCrlf(); $parentid = newGetStrCut($s, 'parentid'); $parentid = getColumnId($parentid); $title = newGetStrCut($s, 'title'); $titlecolor = newGetStrCut($s, 'titlecolor'); $webtitle = newGetStrCut($s, 'webtitle'); $webkeywords = newGetStrCut($s, 'webkeywords'); $webdescription = newGetStrCut($s, 'webdescription'); $author = newGetStrCut($s, 'author'); $sortrank = newGetStrCut($s, 'sortrank'); if ($sortrank == '') { $sortrank = 0; } $adddatetime = newGetStrCut($s, 'adddatetime'); $fileName = newGetStrCut($s, 'filename'); $templatepath = newGetStrCut($s, 'templatepath'); $flags = newGetStrCut($s, 'flags'); $relatedtags = newGetStrCut($s, 'relatedtags'); $customaurl = newGetStrCut($s, 'customaurl'); $target = newGetStrCut($s, 'target'); $smallimage = newGetStrCut($s, 'smallimage'); $bigImage = newGetStrCut($s, 'bigImage'); $bannerimage = newGetStrCut($s, 'bannerimage'); $labletitle = newGetStrCut($s, 'labletitle'); $aboutcontent = newGetStrCut($s, 'aboutcontent'); $aboutcontent = contentTranscoding($aboutcontent); $bodycontent = newGetStrCut($s, 'bodycontent'); $bodycontent = contentTranscoding($bodycontent); //是否启用生成html $isonhtml = newGetStrCut($s, 'isonhtml'); if ($isonhtml == '0' || lCase($isonhtml) == 'false') { $isonhtml = 0; } else { $isonhtml = 1; } //是否为nofollow $nofollow = newGetStrCut($s, 'nofollow'); if ($nofollow == '1' || lCase($nofollow) == 'true') { $nofollow = 1; } else { $nofollow = 0; } //价格 $price = getDianNumb(newGetStrCut($s, 'price')); if ($price == '') { $price = 0; } connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'articledetail (parentid,title,titlecolor,webtitle,webkeywords,webdescription,author,sortrank,adddatetime,filename,flags,relatedtags,aboutcontent,bodycontent,updatetime,isonhtml,customaurl,nofollow,target,smallimage,bigImage,bannerimage,templatepath,labletitle,price) values(' . $parentid . ',\'' . $title . '\',\'' . $titlecolor . '\',\'' . $webtitle . '\',\'' . $webkeywords . '\',\'' . $webdescription . '\',\'' . $author . '\',' . $sortrank . ',\'' . $adddatetime . '\',\'' . $fileName . '\',\'' . $flags . '\',\'' . $relatedtags . '\',\'' . $aboutcontent . '\',\'' . $bodycontent . '\',\'' . now() . '\',' . $isonhtml . ',\'' . $customaurl . '\',' . $nofollow . ',\'' . $target . '\',\'' . $smallimage . '\',\'' . $bigImage . '\',\'' . $bannerimage . '\',\'' . $templatepath . '\',\'' . $labletitle . '\',' . $price . ')'); } } } } //单页 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'OnePage'); $content = getDirTxtList($webdataDir . '/OnePage/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('单页', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【webkeywords】') > 0) { $s = $s . vbCrlf(); $title = newGetStrCut($s, 'title'); $displaytitle = newGetStrCut($s, 'displaytitle'); $webtitle = newGetStrCut($s, 'webtitle'); $webkeywords = newGetStrCut($s, 'webkeywords'); $webdescription = newGetStrCut($s, 'webdescription'); $adddatetime = newGetStrCut($s, 'adddatetime'); $fileName = newGetStrCut($s, 'filename'); $aboutcontent = newGetStrCut($s, 'aboutcontent'); $aboutcontent = contentTranscoding($aboutcontent); $target = newGetStrCut($s, 'target'); $templatepath = newGetStrCut($s, 'templatepath'); $bodycontent = newGetStrCut($s, 'bodycontent'); $bodycontent = contentTranscoding($bodycontent); //是否启用生成html $isonhtml = newGetStrCut($s, 'isonhtml'); if ($isonhtml == '0' || lCase($isonhtml) == 'false') { $isonhtml = 0; } else { $isonhtml = 1; } //是否为nofollow $nofollow = newGetStrCut($s, 'nofollow'); if ($nofollow == '1' || lCase($nofollow) == 'true') { $nofollow = 1; } else { $nofollow = 0; } connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'onepage (title,displaytitle,webtitle,webkeywords,webdescription,adddatetime,filename,isonhtml,aboutcontent,bodycontent,nofollow,target,templatepath) values(\'' . $title . '\',\'' . $displaytitle . '\',\'' . $webtitle . '\',\'' . $webkeywords . '\',\'' . $webdescription . '\',\'' . $adddatetime . '\',\'' . $fileName . '\',' . $isonhtml . ',\'' . $aboutcontent . '\',\'' . $bodycontent . '\',' . $nofollow . ',\'' . $target . '\',\'' . $templatepath . '\')'); } } } } //竞价 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'Bidding'); $content = getDirTxtList($webdataDir . '/Bidding/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('竞价', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【webkeywords】') > 0) { $s = $s . vbCrlf(); $webkeywords = newGetStrCut($s, 'webkeywords'); $showreason = newGetStrCut($s, 'showreason'); $ncomputersearch = newGetStrCut($s, 'ncomputersearch'); $nmobliesearch = newGetStrCut($s, 'nmobliesearch'); $ncountsearch = newGetStrCut($s, 'ncountsearch'); $ndegree = newGetStrCut($s, 'ndegree'); $ndegree = getNumber($ndegree); if ($ndegree == '') { $ndegree = 0; } connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'Bidding (webkeywords,showreason,ncomputersearch,nmobliesearch,ndegree) values(\'' . $webkeywords . '\',\'' . $showreason . '\',' . $ncomputersearch . ',' . $nmobliesearch . ',' . $ndegree . ')'); } } } } //搜索统计 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'SearchStat'); $content = getDirTxtList($webdataDir . '/SearchStat/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('搜索统计', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【title】') > 0) { $s = $s . vbCrlf(); $title = newGetStrCut($s, 'title'); $webtitle = newGetStrCut($s, 'webtitle'); $webkeywords = newGetStrCut($s, 'webkeywords'); $webdescription = newGetStrCut($s, 'webdescription'); $customaurl = newGetStrCut($s, 'customaurl'); $target = newGetStrCut($s, 'target'); $isthrough = newGetStrCut($s, 'isthrough'); if ($isthrough == '0' || lCase($isthrough) == 'false') { $isthrough = 0; } else { $isthrough = 1; } $sortrank = newGetStrCut($s, 'sortrank'); if ($sortrank == '') { $sortrank = 0; } //是否启用生成html $isonhtml = newGetStrCut($s, 'isonhtml'); if ($isonhtml == '0' || lCase($isonhtml) == 'false') { $isonhtml = 0; } else { $isonhtml = 1; } //是否为nofollow $nofollow = newGetStrCut($s, 'nofollow'); if ($nofollow == '1' || lCase($nofollow) == 'true') { $nofollow = 1; } else { $nofollow = 0; } //call echo("title",title) connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'SearchStat (title,webtitle,webkeywords,webdescription,customaurl,target,isthrough,sortrank,isonhtml,nofollow) values(\'' . $title . '\',\'' . $webtitle . '\',\'' . $webkeywords . '\',\'' . $webdescription . '\',\'' . $customaurl . '\',\'' . $target . '\',' . $isthrough . ',' . $sortrank . ',' . $isonhtml . ',' . $nofollow . ')'); } } } } $itemid = ''; $userName = ''; $ip = ''; $reply = ''; $tableName = ''; //评论 //评论 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'TableComment'); $content = getDirTxtList($webdataDir . '/TableComment/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('评论', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【title】') > 0) { $s = $s . vbCrlf(); $tableName = newGetStrCut($s, 'tablename'); $title = newGetStrCut($s, 'title'); $itemid = getArticleId(newGetStrCut($s, 'itemid')); if ($itemid == '') { $itemid = 0; } //call echo("itemID",itemID) $adddatetime = newGetStrCut($s, 'adddatetime'); $userName = newGetStrCut($s, 'username'); $ip = newGetStrCut($s, 'ip'); $bodycontent = newGetStrCut($s, 'bodycontent'); $reply = newGetStrCut($s, 'reply'); $isthrough = newGetStrCut($s, 'isthrough'); if ($isthrough == '0' || lCase($isthrough) == 'false') { $isthrough = 0; } else { $isthrough = 1; } //call echo("title",title) connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'TableComment (tablename,title,itemid,adddatetime,username,ip,bodycontent,reply,isthrough) values(\'' . $tableName . '\',\'' . $title . '\',' . $itemid . ',\'' . $adddatetime . '\',\'' . $userName . '\',\'' . $ip . '\',\'' . $bodycontent . '\',\'' . $reply . '\',' . $isthrough . ')'); } } } } //友情链接 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'FriendLink'); $content = getDirTxtList($webdataDir . '/FriendLink/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('评论', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【title】') > 0) { $s = $s . vbCrlf(); $title = newGetStrCut($s, 'title'); $httpurl = newGetStrCut($s, 'httpurl'); $smallimage = newGetStrCut($s, 'smallimage'); $flags = newGetStrCut($s, 'flags'); $target = newGetStrCut($s, 'target'); $sortrank = newGetStrCut($s, 'sortrank'); if ($sortrank == '0' || lCase($sortrank) == 'false') { $sortrank = 0; } else { $sortrank = 1; } $isthrough = newGetStrCut($s, 'isthrough'); if ($isthrough == '0' || lCase($isthrough) == 'false') { $isthrough = 0; } else { $isthrough = 1; } //call echo("title",title) connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'FriendLink (title,httpurl,smallimage,flags,sortrank,isthrough,target) values(\'' . $title . '\',\'' . $httpurl . '\',\'' . $smallimage . '\',\'' . $flags . '\',' . $sortrank . ',' . $isthrough . ',\'' . $target . '\')'); } } } } //留言 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'GuestBook'); $content = getDirTxtList($webdataDir . '/GuestBook/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('留言', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【adddatetime】') > 0) { $s = $s . vbCrlf(); $adddatetime = newGetStrCut($s, 'adddatetime'); $bodycontent = newGetStrCut($s, 'bodycontent'); $reply = newGetStrCut($s, 'reply'); $isthrough = newGetStrCut($s, 'isthrough'); if ($isthrough == '0' || lCase($isthrough) == 'false') { $isthrough = 0; } else { $isthrough = 1; } connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'GuestBook (adddatetime,bodycontent,reply,isthrough) values(\'' . $adddatetime . '\',\'' . $bodycontent . '\',\'' . $reply . '\',' . $isthrough . ')'); } } } } //采集网站 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'CaiWeb'); $content = getDirTxtList($webdataDir . '/CaiWeb/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('采集网站', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【bigclassname】') > 0) { $s = $s . vbCrlf(); $bigClassName = newGetStrCut($s, 'bigclassname'); $httpurl = newGetStrCut($s, 'httpurl'); $morepageurl = newGetStrCut($s, 'morepageurl'); $charset = newGetStrCut($s, 'charset'); $adddatetime = newGetStrCut($s, 'adddatetime'); $bodycontent = newGetStrCut($s, 'bodycontent'); $sortrank = newGetStrCut($s, 'sortrank'); if ($sortrank == '') { $sortrank = 0; } $thispage = newGetStrCut($s, 'thispage'); if ($thispage == '') { $thispage = 0; } $countpage = newGetStrCut($s, 'countpage'); if ($countpage == '') { $thispage = 0; } $columnname = newGetStrCut($s, 'columnname'); connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'CaiWeb (adddatetime,bodycontent,httpurl,morepageurl,charset,sortrank,thispage,countpage,bigclassname,columnname) values(\'' . $adddatetime . '\',\'' . $bodycontent . '\',\'' . $httpurl . '\',\'' . $morepageurl . '\',\'' . $charset . '\',' . $sortrank . ',' . $thispage . ',' . $countpage . ',\'' . $bigClassName . '\',\'' . $columnname . '\')'); } } } } //采集配置 connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'CaiConfig'); $content = getDirTxtList($webdataDir . '/CaiConfig/'); $content = contentNameSort($content, ''); $splStr = aspSplit($content, vbCrlf()); HR(); foreach ($splStr as $key => $filePath) { $fileName = getFileName($filePath); if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) { aspEcho('采集配置', $filePath); $content = GetFText($filePath); //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10) 20160409 if (inStr($content, vbCrlf()) == false) { $content = replace($content, chr(10), vbCrlf()); } $splxx = aspSplit($content, vbCrlf() . '-------------------------------'); foreach ($splxx as $key => $s) { if (inStr($s, '【bigclassname】') > 0) { $s = $s . vbCrlf(); $bigClassName = newGetStrCut($s, 'bigclassname'); $sType = newGetStrCut($s, 'stype'); $startStr = newGetStrCut($s, 'startstr'); $endStr = newGetStrCut($s, 'endstr'); $startaddstr = newGetStrCut($s, 'startaddstr'); $endaddstr = newGetStrCut($s, 'endaddstr'); $adddatetime = newGetStrCut($s, 'adddatetime'); $sortrank = newGetStrCut($s, 'sortrank'); if ($sortrank == '') { $sortrank = 0; } $saction = newGetStrCut($s, 'saction'); $isthrough = newGetStrCut($s, 'isthrough'); $isthrough = IIF($isthrough == '0' || lCase($isthrough) == 'false', 0, 1); $fieldName = newGetStrCut($s, 'fieldname'); $fieldcheck = newGetStrCut($s, 'fieldcheck'); if ($fieldcheck == '') { $fieldcheck = 0; } connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'CaiConfig (adddatetime,sortrank,bigclassname,stype,startstr,endstr,startaddstr,endaddstr,saction,isthrough,fieldname,fieldcheck) values(\'' . $adddatetime . '\',' . $sortrank . ',\'' . $bigClassName . '\',\'' . $sType . '\',\'' . $startStr . '\',\'' . $endStr . '\',\'' . $startaddstr . '\',\'' . $endaddstr . '\',\'' . $saction . '\',' . $isthrough . ',\'' . $fieldName . '\',' . $fieldcheck . ')'); } } } } writeSystemLog('', '恢复默认数据' . $GLOBALS['db_PREFIX']); //系统日志 }