function remoteArrayJingHao($splStr) { $s = ''; $c = ''; $splType = ''; $splType = '[|-|_]'; foreach ($splStr as $key => $s) { if (left(PHPTrim($s), 1) != '#' && left(PHPTrim($s), 1) != '_') { if ($c != '') { $c = $c . $splType; } $c = $c . $s; } } $splStr = aspSplit($c, $splType); $remoteArrayJingHao = $splStr; return @$remoteArrayJingHao; }
function handleScanUrlList($httpurl, $urlList) { $splstr = ''; $url = ''; $c = ''; $lCaseUrl = ''; $splstr = aspSplit($urlList, vbCrlf()); foreach ($splstr as $key => $url) { $url = PHPTrim($url); $lCaseUrl = lCase($url); if ($url != '' && left($url, 10) != 'tencent://' && left($url, 11) != 'javascript:' && left($url, 1) != '#') { $url = fullHttpUrl($httpurl, $url); if (inStr(vbCrlf() . $c . vbCrlf(), vbCrlf() . $url . vbCrlf()) == false) { $c = $c . $url . vbCrlf(); } } } $handleScanUrlList = $c; return @$handleScanUrlList; }
function getSetName($c) { $c = PHPTrim(lCase($c)); $c = mid($c, 1, inStr($c, '=') - 1); $getSetName = aspTrim($c); return @$getSetName; }
function getHtmlValue($content, $sType) { $i = ''; $endStr = ''; $s = ''; $labelName = ''; $startLabel = ''; $endLabel = ''; $LCaseEndStr = ''; $paramName = ''; $startLabel = '<'; $endLabel = '>'; for ($i = 1; $i <= len($content); $i++) { $s = mid($content, $i, 1); $endStr = mid($content, $i, -1); if ($s == '<') { if (inStr($endStr, '>') > 0) { $s = mid($endStr, 1, inStr($endStr, '>')); $i = $i + len($s) - 1; $s = mid($s, 2, len($s) - 2); $s = PHPTrim($s); if (right($s, 1) == '/') { $s = PHPTrim(left($s, len($s) - 1)); } $endStr = right($endStr, len($endStr) - len($s) - 2); //最后字符减去当前标签 -2是因为它有<>二个字符 //注意之前放在labelName下面 $labelName = mid($s, 1, inStr($s . ' ', ' ') - 1); $labelName = lCase($labelName); if ($labelName == 'title' && $sType == 'webtitle') { $LCaseEndStr = lCase($endStr); if (inStr($LCaseEndStr, '</title>') > 0) { $s = mid($endStr, 1, inStr($LCaseEndStr, '</title>') - 1); } else { $s = ''; } $getHtmlValue = $s; return @$getHtmlValue; } else { if ($labelName == 'meta' && ($sType == 'webkeywords' || $sType == 'webdescription')) { $LCaseEndStr = lCase($endStr); $paramName = PHPTrim(lCase(getParamValue($s, 'name'))); if ('web' . $paramName == $sType) { $getHtmlValue = getParamValue($s, 'content'); return @$getHtmlValue; } } } } } } $getHtmlValue = ''; return @$getHtmlValue; }
function setRParam($ConfigPath, $paramName, $paramValue, $isNoAdd) { $content = ''; $startStr = ''; $endStr = ''; $s = ''; $content = PHPTrim(getFText($ConfigPath)); $startStr = $paramName . '=\''; $endStr = '\''; if (inStr($content, $startStr) > 0 && inStr($content, $endStr) > 0) { $s = StrCut($content, $startStr, $endStr, 2); $content = replace($content, $startStr . $s . $endStr, $startStr . $paramValue . $endStr); createFile($ConfigPath, $content); } else { if (aspTrim($isNoAdd) == '1') { CreateAddFile($ConfigPath, $startStr . $paramValue . $endStr); } } }
function delJsNote($content) { $splstr = ''; $s = ''; $c = ''; $isMultiLineNote = ''; $s2 = ''; $isMultiLineNote = false; //多行注释默认为假 $splstr = aspSplit($content, vbCrlf()); foreach ($splstr as $key => $s) { $s2 = PHPTrim($s); if ($isMultiLineNote == true) { if (len($s2) >= 2) { if (right($s2, 2) == '*/') { $isMultiLineNote = false; } } $s = ''; } else { if (left($s2, 2) == '/*') { if (right($s2, 2) != '*/') { $isMultiLineNote = true; } $s = ''; } else { if (left($s2, 2) == '//') { $s = ''; } } } $c = $c . $s . vbCrlf(); } $delJsNote = $c; return @$delJsNote; }
function checkHtmlFormatting($content) { $splStr = ''; $s = ''; $c = ''; $splxx = ''; $nLable = ''; $lableStr = ''; $content = lCase($content); $splStr = aspSplit('ul|li|dt|dd|dl|div|span', '|'); foreach ($splStr as $key => $s) { $s = PHPTrim($s); if ($s != '') { $nLable = 0; $lableStr = '<' . $s . ' '; if (inStr($content, $lableStr) > 0) { $splxx = aspSplit($content, $lableStr); $nLable = $nLable + uBound($splxx); } $lableStr = '<' . $s . '>'; if (inStr($content, $lableStr) > 0) { $splxx = aspSplit($content, $lableStr); $nLable = $nLable + uBound($splxx); } $lableStr = '</' . $s . '>'; if (inStr($content, $lableStr) > 0) { $splxx = aspSplit($content, $lableStr); $nLable = $nLable - uBound($splxx); } //call echo(ShowHtml(lableStr),nLable) if ($nLable != 0) { $checkHtmlFormatting = false; return @$checkHtmlFormatting; } } } $checkHtmlFormatting = true; return @$checkHtmlFormatting; }
function XY_ReadColumeSetTitle($action) { $startStr = ''; $endStr = ''; $Style = ''; $title = ''; $valueStr = ''; $MoreClass = ''; $MoreUrl = ''; $MoreStr = ''; $aStr = ''; $c = ''; $action = HandleInModule($action, 'start'); $Style = RParam($action, 'style'); $title = RParam($action, 'Title'); //Call Echo("ContentHeight",ContentHeight) //ValueStr = RParam(Action,"value") //根据模块找内容 $valueStr = moduleFindContent($action, 'value'); //Call Eerr("ValueStr",ValueStr) $valueStr = findModuleStr($GLOBALS['code'], $valueStr); //找模块对应内容 $MoreClass = RParam($action, 'MoreClass'); $MoreUrl = PHPTrim(RParam($action, 'MoreUrl')); $MoreStr = RParam($action, 'MoreStr'); $valueStr = HandleInModule($valueStr, 'end'); $c = readColumeSetTitle($action, $Style, $title, $valueStr); if ($MoreClass == '') { $MoreClass = 'more'; } //More链接为空 则用默认代替 //If MoreUrl="" Then MoreUrl="#" 'More链接网址为空 则用默认#代替 //More链接样式不能为空,因为没有样式它就不能让More在最近边 if ($MoreUrl != '' && $MoreStr != '') { //AStr = "<a href='"& MoreUrl &"' class='"& MoreClass &"'>"& MoreStr &"</a>" $aStr = '<a ' . aHref($MoreUrl, $title, '') . ' class=\'' . $MoreClass . '\'>' . $MoreStr . '</a>'; $c = replace($c, '<!--#AMore#-->', $aStr); } $XY_ReadColumeSetTitle = $c; return @$XY_ReadColumeSetTitle; }
function getAdminMenuList() { $s = ''; $c = ''; $url = ''; $selStr = ''; $addSql = ''; $sql = ''; if (@$_SESSION['adminflags'] != '|*|') { $addSql = ' and isDisplay<>0 '; } $sql = 'select * from ' . $GLOBALS['db_PREFIX'] . 'listmenu where parentid=-1 ' . $addSql . ' order by sortrank'; //检测SQL if (checkSql($sql) == false) { errorLog('出错提示:<br>function=getAdminMenuList<hr>sql=' . $sql . '<br>'); return ''; } $rsObj = $GLOBALS['conn']->query($sql); while ($rs = $GLOBALS['conn']->fetch_array($rsObj)) { $selStr = 'didoff'; if ($c == '') { $selStr = 'didon'; } $c = $c . '<ul class="navwrap">' . vbCrlf(); $c = $c . '<li class="' . $selStr . '">' . $rs['title'] . '</li>' . vbCrlf(); $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'listmenu where parentid=' . $rs['id'] . ' ' . $addSql . ' order by sortrank'); while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) { $url = PHPTrim($rsx['customaurl']); $c = $c . ' <li class="item" onClick="window1(\'' . $url . '\',\'' . $rsx['lablename'] . '\');">' . $rsx['title'] . '</li>' . vbCrlf(); } $c = $c . '</ul>' . vbCrlf(); } $c = replaceLableContent($c); $getAdminMenuList = $c; return @$getAdminMenuList; }
function copyHtmlToWeb() { $webDir = ''; $toWebDir = ''; $toFilePath = ''; $filePath = ''; $fileName = ''; $fileList = ''; $splStr = ''; $content = ''; $s = ''; $s1 = ''; $c = ''; $webImages = ''; $webCss = ''; $webJs = ''; $splJs = ''; $webFolderName = ''; $jsFileList = ''; $setFileCode = ''; $nErrLevel = ''; $jsFilePath = ''; $url = ''; $setFileCode = @$_REQUEST['setcode']; //设置文件保存编码 handlePower('复制生成HTML页面'); //管理权限处理 writeSystemLog('', '复制生成HTML页面'); //系统日志 $webFolderName = $GLOBALS['cfg_webTemplate']; if (left($webFolderName, 1) == '/') { $webFolderName = mid($webFolderName, 2, -1); } if (right($webFolderName, 1) == '/') { $webFolderName = mid($webFolderName, 1, len($webFolderName) - 1); } if (inStr($webFolderName, '/') > 0) { $webFolderName = mid($webFolderName, inStr($webFolderName, '/') + 1, -1); } $webDir = '/htmladmin/' . $webFolderName . '/'; $toWebDir = '/htmlw' . 'eb/viewweb/'; CreateDirFolder($toWebDir); $toWebDir = $toWebDir . pinYin2($webFolderName) . '/'; deleteFolder($toWebDir); //删除 CreateFolder('/htmlweb/web'); //创建文件夹 防止web文件夹不存在20160504 deleteFolder($webDir); CreateDirFolder($webDir); $webImages = $webDir . 'Images/'; $webCss = $webDir . 'Css/'; $webJs = $webDir . 'Js/'; copyFolder($GLOBALS['cfg_webImages'], $webImages); copyFolder($GLOBALS['cfg_webCss'], $webCss); CreateFolder($webJs); //创建Js文件夹 //处理Js文件夹 $splJs = aspSplit(getDirJsList($webJs), vbCrlf()); foreach ($splJs as $key => $filePath) { if ($filePath != '') { $toFilePath = $webJs . getFileName($filePath); aspEcho('js', $filePath); moveFile($filePath, $toFilePath); } } //处理Css文件夹 $splStr = aspSplit(getDirCssList($webCss), vbCrlf()); foreach ($splStr as $key => $filePath) { if ($filePath != '') { $content = getFText($filePath); $content = replace($content, $GLOBALS['cfg_webImages'], '../images/'); $content = deleteCssNote($content); $content = PHPTrim($content); //设置为utf-8编码 20160527 if (lCase($setFileCode) == 'utf-8') { $content = replace($content, 'gb2312', 'utf-8'); } WriteToFile($filePath, $content, $setFileCode); aspEcho('css', $GLOBALS['cfg_webImages']); } } //复制栏目HTML $GLOBALS['isMakeHtml'] = true; $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'webcolumn where isonhtml=true'); while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) { $GLOBALS['glb_filePath'] = replace(getColumnUrl($rss['columnname'], 'name'), $GLOBALS['cfg_webSiteUrl'] . '/', ''); if (right($GLOBALS['glb_filePath'], 1) == '/' || right($GLOBALS['glb_filePath'], 1) == '') { $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html'; } if (right($GLOBALS['glb_filePath'], 5) == '.html') { if (right($GLOBALS['glb_filePath'], 11) == '/index.html') { $fileList = $fileList . $GLOBALS['glb_filePath'] . vbCrlf(); } else { $fileList = $GLOBALS['glb_filePath'] . vbCrlf() . $fileList; } $fileName = replace($GLOBALS['glb_filePath'], '/', '_'); $toFilePath = $webDir . $fileName; copyFile($GLOBALS['glb_filePath'], $toFilePath); aspEcho('导航', $GLOBALS['glb_filePath']); } } //复制文章HTML $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'articledetail where isonhtml=true'); while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) { $GLOBALS['glb_url'] = getHandleRsUrl($rss['filename'], $rss['customaurl'], '/detail/detail' . $rss['id']); $GLOBALS['glb_filePath'] = replace($GLOBALS['glb_url'], $GLOBALS['cfg_webSiteUrl'] . '/', ''); if (right($GLOBALS['glb_filePath'], 1) == '/' || right($GLOBALS['glb_filePath'], 1) == '') { $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html'; } if (right($GLOBALS['glb_filePath'], 5) == '.html') { if (right($GLOBALS['glb_filePath'], 11) == '/index.html') { $fileList = $fileList . $GLOBALS['glb_filePath'] . vbCrlf(); } else { $fileList = $GLOBALS['glb_filePath'] . vbCrlf() . $fileList; } $fileName = replace($GLOBALS['glb_filePath'], '/', '_'); $toFilePath = $webDir . $fileName; copyFile($GLOBALS['glb_filePath'], $toFilePath); aspEcho('文章' . $rss['title'], $GLOBALS['glb_filePath']); } } //复制单面HTML $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'onepage where isonhtml=true'); while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) { $GLOBALS['glb_url'] = getHandleRsUrl($rss['filename'], $rss['customaurl'], '/page/page' . $rss['id']); $GLOBALS['glb_filePath'] = replace($GLOBALS['glb_url'], $GLOBALS['cfg_webSiteUrl'] . '/', ''); if (right($GLOBALS['glb_filePath'], 1) == '/' || right($GLOBALS['glb_filePath'], 1) == '') { $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html'; } if (right($GLOBALS['glb_filePath'], 5) == '.html') { if (right($GLOBALS['glb_filePath'], 11) == '/index.html') { $fileList = $fileList . $GLOBALS['glb_filePath'] . vbCrlf(); } else { $fileList = $GLOBALS['glb_filePath'] . vbCrlf() . $fileList; } $fileName = replace($GLOBALS['glb_filePath'], '/', '_'); $toFilePath = $webDir . $fileName; copyFile($GLOBALS['glb_filePath'], $toFilePath); aspEcho('单页' . $rss['title'], $GLOBALS['glb_filePath']); } } //批量处理html文件列表 //call echo(cfg_webSiteUrl,cfg_webTemplate) //call rwend(fileList) $sourceUrl = ''; $replaceUrl = ''; $splStr = aspSplit($fileList, vbCrlf()); foreach ($splStr as $key => $filePath) { if ($filePath != '') { $filePath = $webDir . replace($filePath, '/', '_'); aspEcho('filePath', $filePath); $content = getFText($filePath); foreach ($splStr as $key => $s) { $s1 = $s; if (right($s1, 11) == '/index.html') { $s1 = left($s1, len($s1) - 11) . '/'; } $sourceUrl = $GLOBALS['cfg_webSiteUrl'] . $s1; $replaceUrl = $GLOBALS['cfg_webSiteUrl'] . replace($s, '/', '_'); //Call echo(sourceUrl, replaceUrl) '屏蔽 否则大量显示20160613 $content = replace($content, $sourceUrl, $replaceUrl); } $content = replace($content, $GLOBALS['cfg_webSiteUrl'], ''); //删除网址 $content = replace($content, $GLOBALS['cfg_webTemplate'] . '/', ''); //删除模板路径 记 //content=nullLinkAddDefaultName(content) foreach ($splJs as $key => $s) { if ($s != '') { $fileName = getFileName($s); $content = replace($content, 'Images/' . $fileName, 'js/' . $fileName); } } if (inStr($content, '/Jquery/Jquery.Min.js') > 0) { $content = replace($content, '/Jquery/Jquery.Min.js', 'js/Jquery.Min.js'); copyFile('/Jquery/Jquery.Min.js', $webJs . '/Jquery.Min.js'); } $content = replace($content, '<a href="" ', '<a href="index.html" '); //让首页加index.html createFileGBK($filePath, $content); } } //把复制网站夹下的images/文件夹下的js移到js/文件夹下 20160315 $htmlFileList = ''; $splHtmlFile = ''; $splJsFile = ''; $htmlFilePath = ''; $jsFileName = ''; $jsFileList = getDirJsNameList($webImages); $htmlFileList = getDirHtmlList($webDir); $splHtmlFile = aspSplit($htmlFileList, vbCrlf()); $splJsFile = aspSplit($jsFileList, vbCrlf()); foreach ($splHtmlFile as $key => $htmlFilePath) { $content = getFText($htmlFilePath); foreach ($splJsFile as $key => $jsFileName) { $content = regExp_Replace($content, 'Images/' . $jsFileName, 'js/' . $jsFileName); } $nErrLevel = 0; $content = handleHtmlFormatting($content, false, $nErrLevel, '|删除空行|'); //|删除空行| $content = handleCloseHtml($content, true, ''); //闭合标签 $nErrLevel = checkHtmlFormatting($content); if (checkHtmlFormatting($content) == false) { echoRed($htmlFilePath . '(格式化错误)', $nErrLevel); //注意 } //设置为utf-8编码 if (lCase($setFileCode) == 'utf-8') { $content = replace($content, '<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />', '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'); } $content = PHPTrim($content); WriteToFile($htmlFilePath, $content, $setFileCode); } //images下js移动到js下 foreach ($splJsFile as $key => $jsFileName) { $jsFilePath = $webImages . $jsFileName; $content = getFText($jsFilePath); $content = PHPTrim($content); WriteToFile($webJs . $jsFileName, $content, $setFileCode); DeleteFile($jsFilePath); } copyFolder($webDir, $toWebDir); //使htmlWeb文件夹用php压缩 if (@$_REQUEST['isMakeZip'] == '1') { makeHtmlWebToZip($webDir); } //使网站用xml打包20160612 if (@$_REQUEST['isMakeXml'] == '1') { makeHtmlWebToXmlZip('/htmladmin/', $webFolderName); } //浏览地址 $url = 'http://10.10.10.57/' . $toWebDir; aspEcho('浏览', '<a href=\'' . $url . '\' target=\'_blank\'>' . $url . '</a>'); }
function scanCheckDomain() { $url = ''; $nSetTime = ''; $isdomain = ''; $htmlDir = ''; $txtFilePath = ''; $nThis = ''; $nCount = ''; $startTime = ''; $nSetTime = 3; $nThis = @$_REQUEST['nThis']; if ($nThis == '') { $nThis = 0; } else { $nThis = cint($nThis); } $GLOBALS['conn='] = OpenConn(); $rsObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'webdomain where isthrough=true'); $rs = mysql_fetch_array($rsObj); $nCount = @$_REQUEST['nCount']; if ($nCount == '') { $nCount = @mysql_num_rows($rsObj); } while ($rs = $GLOBALS['conn']->fetch_array($rsObj)) { $nThis = $nThis + 1; aspEcho($nThis . '/' . $nCount, $rs['website']); doEvents(); $htmlDir = '/../网站UrlScan/域名/'; CreateDirFolder($htmlDir); $txtFilePath = $htmlDir . '/' . setFileName($rs['website']) . '.txt'; if (CheckFile($txtFilePath) == true) { $isdomain = PHPTrim(getFText($txtFilePath)); aspEcho('类型', '本地'); $nSetTime = 1; } else { $isdomain = IIF(checkDomainName($rs['website']), 1, 0); createFile($txtFilePath, $isdomain . ' '); //防止PHP版写入不进去 0 这个内容 aspEcho('类型', '网络' . $txtFilePath . '(' . CheckFile($txtFilePath) . ')=' . $isdomain); } //这样写是给转PHP时方便 connexecute('update ' . $GLOBALS['db_PREFIX'] . 'webdomain set isthrough=false,isdomain=' . $isdomain . ',updatetime=\'' . now() . '\' where id=' . $rs['id'] . ''); $startTime = @$_REQUEST['startTime']; if ($startTime == '') { $startTime = now(); } Rw(VBRunTimer($startTime) . '<hr>'); $url = getUrlAddToParam(getThisUrl(), '?nThis=' . $nThis . '&nCount=' . $nCount . '&startTime=' . $startTime . '&N=' . getRnd(11), 'replace'); Rw(jsTiming($url, $nSetTime)); die; } aspEcho('操作完成', '<a href=\'?act=dispalyManageHandle&actionType=WebDomain&addsql=order by id desc&lableTitle=网站域名\'>OK,共(' . $nThis . ')条</a>'); }
function htmlAddAction($content, $jsAction) { $s = ''; $startStr = ''; $endStr = ''; $isHandle = ''; $lableName = ''; $s = $content; $s = PHPTrim($s); $startStr = mid($s, 1, inStr($s, ' ')); $endStr = '>'; $isHandle = true; $lableName = aspTrim(lCase(replace($startStr, '<', ''))); if (inStr($s, $startStr) == false || inStr($s, $endStr) == false || inStr('|a|div|span|font|h1|h2|h3|h4|h5|h6|dt|dd|dl|li|ul|table|tr|td|', '|' . $lableName . '|') == false) { $isHandle = false; } if ($isHandle == true) { $content = $startStr . $jsAction . right($s, len($s) - len($startStr)); } $htmlAddAction = $content; return @$htmlAddAction; }