function handleRParam($action, $LableStr, $typeStr) { $LalbeName = ''; $endTypeStr = ''; $isTrue = ''; $s = ''; $isTrue = false; //是否为真 $endTypeStr = IIF($typeStr != '', $typeStr, ' '); $action = vbCrlf() . ' ' . $action; //给它也加个空格,要不然在没有函数,前面就没有空格 //默认前面加空格 $LalbeName = ' ' . $LableStr; //加个空格是为了精准 //不存在 前面加点 if (inStr($action, $LalbeName . '=' . $typeStr) == false && $isTrue == false) { $LalbeName = '\'' . $LableStr; } else { $isTrue = true; } //不存在 前面加双引号 if (inStr($action, $LalbeName . '=' . $typeStr) == false && $isTrue == false) { $LalbeName = '"' . $LableStr; } else { $isTrue = true; } //不存在 前面加TAB if (inStr($action, $LalbeName . '=' . $typeStr) == false && $isTrue == false) { $LalbeName = vbTab() . $LableStr; } else { $isTrue = true; } //不存在 前面加换行 if (inStr($action, $LalbeName . '=' . $typeStr) == false && $isTrue == false) { $LalbeName = vbCrlf() . $LableStr; } else { $isTrue = true; } if (inStr($action, $LalbeName . '=' . $typeStr) > 0 && inStr($action, $endTypeStr) > 0) { $s = StrCut($action, $LalbeName . '=' . $typeStr, $endTypeStr, 2); $s = handleInModule($s, 'end'); //处理里面参数 追加于20141031 还原内容值 if ($s == '') { $s = '[#空*值_#]'; } //判断是否对参数进行动作制作 if (inStr($s, '{$') > 0 && inStr($s, '$}') > 0) { //handleRParam=HandleTemplateAction(handleRParam,true) '处理动作 //handleRParam = handleModuleReplaceArray(handleRParam)'给AddSqL处理一下动作 这是处理替换,不需要,因为在 HandleTemplateAction有替换了(20151021) } //不要这个,要不不稳定(20151022) //if handleRParam="" then //handleRParam=false //end if } $handleRParam = $s; return @$handleRParam; }
function removeBlankLines($content) { $s = ''; $c = ''; $splStr = ''; $splStr = aspSplit($content, vbCrlf()); foreach ($splStr as $key => $s) { if (replace(replace($s, vbTab(), ''), ' ', '') != '') { if ($c != '') { $c = $c . vbCrlf(); } $c = $c . $s; } } $removeBlankLines = $c; return @$removeBlankLines; }
function formatting($content, $action) { $i = ''; $endStr = ''; $s = ''; $c = ''; $labelName = ''; $startLabel = ''; $endLabel = ''; $endLabelStr = ''; $nLevel = ''; $isYes = ''; $parentLableName = ''; $nextLableName = ''; //下一个标题名称 $isA = ''; //是否为A链接 $isTextarea = ''; //是否为多行输入文本框 $isScript = ''; //脚本语言 $isStyle = ''; //Css层叠样式表 $isPre = ''; //是否为pre $startLabel = '<'; $endLabel = '>'; $nLevel = 0; $action = '|' . $action . '|'; //层级 $isA = false; $isTextarea = false; $isScript = false; $isStyle = false; $isPre = false; $content = replace(replace($content, vbCrlf(), chr(10)), vbTab(), ' '); 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); 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); //call echo("labelName",labelName) if ($labelName == 'a') { $isA = true; } else { if ($labelName == '/a') { $isA = false; } else { if ($labelName == 'textarea') { $isTextarea = true; } else { if ($labelName == '/textarea') { $isTextarea = false; } else { if ($labelName == 'script') { $isScript = true; } else { if ($labelName == '/script') { $isScript = false; } else { if ($labelName == 'style') { $isStyle = true; } else { if ($labelName == '/style') { $isStyle = false; } else { if ($labelName == 'pre') { $isPre = true; } else { if ($labelName == '/pre') { $isPre = false; } } } } } } } } } } $endLabelStr = $endLabel; $nextLableName = getHtmlLableName($endStr, 0); //不为压缩HTML if (inStr($action, '|ziphtml|') == false && $isPre == false) { if ($isA == false) { if (inStr('|a|strong|u|i|s|script|', '|' . $labelName . '|') == false && '/' . $labelName != $nextLableName && inStr('|/a|/strong|/u|/i|/s|/script|', '|' . $nextLableName . '|') == false) { $endLabelStr = $endLabelStr . chr(10); } } } //单标签最后加个 / 20160615 if (inStr('|br|hr|img|input|param|meta|link|', '|' . $labelName . '|') > 0) { $s = $s . ' /'; } $s = $startLabel . $s . $endLabelStr; //不为压缩HTML if (inStr($action, '|ziphtml|') == false && $isPre == false) { //处理这个 aaaaa</span> if ($isA == false && $isYes == false && left($labelName, 1) == '/' && $labelName != '/script' && $labelName != '/a') { //排除这种 <span>天天发团</span> 并且判断上一个字段不等于vbcrlf换行 if ('/' . $parentLableName != $labelName && right(aspTrim($c), 1) != chr(10)) { $s = chr(10) . $s; } } } $parentLableName = $labelName; $isYes = true; } } else { if ($s != '') { $isYes = false; //call echo("isPre",isPre) if ($isPre == false) { if ($s == chr(10)) { if ($isTextarea == false && $isScript == false && $isStyle == false) { $s = ''; } else { if ($isScript == true) { if (inStr($action, '|zipscripthtml|') > 0) { $s = ' '; } } else { if ($isStyle == true) { if (inStr($action, '|zipstylehtml|') > 0) { $s = ''; } } else { if ($isTextarea == true) { if (inStr($action, '|ziptextareahtml|') > 0) { $s = ''; } } else { $s = chr(10); } } } } // Right(Trim(c), 1) = ">") 为在压缩时用到 } else { if ((right(aspTrim($c), 1) == chr(10) || right(aspTrim($c), 1) == '>') && PHPTrim($s) == '' && $isTextarea == false && $isScript == false) { $s = ''; } } } } } $c = $c . $s; } $c = replace($c, chr(10), vbCrlf()); $formatting = $c; return @$formatting; }
function removeExcessRow($content) { $splStr = ''; $s = ''; $c = ''; $TempS = ''; $splStr = aspSplit($content, vbCrlf()); //分割行 foreach ($splStr as $key => $s) { $TempS = replace(replace($s, ' ', ''), vbTab(), ''); if ($TempS != '') { $c = $c . $s . vbCrlf(); } } if ($c != '') { $c = left($c, len($c) - 2); } $removeExcessRow = $c; return @$removeExcessRow; }
function saveSiteMap() { $isWebRunHtml = ''; //是否为html方式显示网站 $changefreg = ''; //更新频率 $priority = ''; //优先级 $s = ''; $c = ''; $url = ''; handlePower('修改生成SiteMap'); //管理权限处理 $changefreg = @$_REQUEST['changefreg']; $priority = @$_REQUEST['priority']; loadWebConfig(); //加载配置 //call eerr("cfg_flags",cfg_flags) if (inStr($GLOBALS['cfg_flags'], '|htmlrun|') > 0) { $isWebRunHtml = true; } else { $isWebRunHtml = false; } $c = $c . '<?xml version="1.0" encoding="UTF-8"?>' . vbCrlf(); $c = $c . vbTab() . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . vbCrlf(); //栏目 $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'webcolumn where isonhtml<>0 order by sortrank asc'); while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) { if ($rsx['nofollow'] == false) { $c = $c . copyStr(vbTab(), 2) . '<url>' . vbCrlf(); if ($isWebRunHtml == true) { $url = getRsUrl($rsx['filename'], $rsx['customaurl'], '/nav' . $rsx['id']); $url = handleAction($url); } else { $url = escape('?act=nav&columnName=' . $rsx['columnname']); } $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url); //call echo(cfg_webSiteUrl,url) $c = $c . copyStr(vbTab(), 3) . '<loc>' . $url . '</loc>' . vbCrlf(); $c = $c . copyStr(vbTab(), 3) . '<lastmod>' . Format_Time($rsx['updatetime'], 2) . '</lastmod>' . vbCrlf(); $c = $c . copyStr(vbTab(), 3) . '<changefreq>' . $changefreg . '</changefreq>' . vbCrlf(); $c = $c . copyStr(vbTab(), 3) . '<priority>' . $priority . '</priority>' . vbCrlf(); $c = $c . copyStr(vbTab(), 2) . '</url>' . vbCrlf(); aspEcho('栏目', '<a href="' . $url . '" target=\'_blank\'>' . $url . '</a>'); } } //文章 $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'articledetail where isonhtml<>0 order by sortrank asc'); while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) { if ($rsx['nofollow'] == false) { $c = $c . copyStr(vbTab(), 2) . '<url>' . vbCrlf(); if ($isWebRunHtml == true) { $url = getRsUrl($rsx['filename'], $rsx['customaurl'], '/detail/detail' . $rsx['id']); $url = handleAction($url); } else { $url = '?act=detail&id=' . $rsx['id']; } $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url); //call echo(cfg_webSiteUrl,url) $c = $c . copyStr(vbTab(), 3) . '<loc>' . $url . '</loc>' . vbCrlf(); $c = $c . copyStr(vbTab(), 3) . '<lastmod>' . Format_Time($rsx['updatetime'], 2) . '</lastmod>' . vbCrlf(); $c = $c . copyStr(vbTab(), 3) . '<changefreq>' . $changefreg . '</changefreq>' . vbCrlf(); $c = $c . copyStr(vbTab(), 3) . '<priority>' . $priority . '</priority>' . vbCrlf(); $c = $c . copyStr(vbTab(), 2) . '</url>' . vbCrlf(); aspEcho('文章', '<a href="' . $url . '">' . $url . '</a>'); } } //单页 $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'onepage where isonhtml<>0 order by sortrank asc'); while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) { if ($rsx['nofollow'] == false) { $c = $c . copyStr(vbTab(), 2) . '<url>' . vbCrlf(); if ($isWebRunHtml == true) { $url = getRsUrl($rsx['filename'], $rsx['customaurl'], '/page/detail' . $rsx['id']); $url = handleAction($url); } else { $url = '?act=onepage&id=' . $rsx['id']; } $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url); //call echo(cfg_webSiteUrl,url) $c = $c . copyStr(vbTab(), 3) . '<loc>' . $url . '</loc>' . vbCrlf(); $c = $c . copyStr(vbTab(), 3) . '<lastmod>' . Format_Time($rsx['updatetime'], 2) . '</lastmod>' . vbCrlf(); $c = $c . copyStr(vbTab(), 3) . '<changefreq>' . $changefreg . '</changefreq>' . vbCrlf(); $c = $c . copyStr(vbTab(), 3) . '<priority>' . $priority . '</priority>' . vbCrlf(); $c = $c . copyStr(vbTab(), 2) . '</url>' . vbCrlf(); aspEcho('单页', '<a href="' . $url . '">' . $url . '</a>'); } } $c = $c . vbTab() . '</urlset>' . vbCrlf(); loadWebConfig(); createFile('sitemap.xml', $c); aspEcho('生成sitemap.xml文件成功', '<a href=\'/sitemap.xml\' target=\'_blank\'>点击预览sitemap.xml</a>'); //判断是否生成sitemap.html if (@$_REQUEST['issitemaphtml'] == '1') { $c = ''; //第二种 //栏目 $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'webcolumn order by sortrank asc'); while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) { if ($rsx['nofollow'] == false) { if ($isWebRunHtml == true) { $url = getRsUrl($rsx['filename'], $rsx['customaurl'], '/nav' . $rsx['id']); $url = handleAction($url); } else { $url = escape('?act=nav&columnName=' . $rsx['columnname']); } $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url); //判断是否生成html if ($rsx['isonhtml'] == true) { $s = '<a href="' . $url . '">' . $rsx['columnname'] . '</a>'; } else { $s = '<span>' . $rsx['columnname'] . '</span>'; } $c = $c . '<li style="width:20%;">' . $s . vbCrlf() . '<ul>' . vbCrlf(); //文章 $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'articledetail where parentId=' . $rsx['id'] . ' order by sortrank asc'); while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) { if ($rss['nofollow'] == false) { if ($isWebRunHtml == true) { $url = getRsUrl($rss['filename'], $rss['customaurl'], '/detail/detail' . $rss['id']); $url = handleAction($url); } else { $url = '?act=detail&id=' . $rss['id']; } $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url); //判断是否生成html if ($rss['isonhtml'] == true) { $s = '<a href="' . $url . '">' . $rss['title'] . '</a>'; } else { $s = '<span>' . $rss['title'] . '</span>'; } $c = $c . '<li style="width:20%;">' . $s . '</li>' . vbCrlf(); } } $c = $c . '</ul>' . vbCrlf() . '</li>' . vbCrlf(); } } //单面 $c = $c . '<li style="width:20%;"><a href="javascript:;">单面列表</a>' . vbCrlf() . '<ul>' . vbCrlf(); $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'onepage order by sortrank asc'); while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) { if ($rsx['nofollow'] == false) { $c = $c . copyStr(vbTab(), 2) . '<url>' . vbCrlf(); if ($isWebRunHtml == true) { $url = getRsUrl($rsx['filename'], $rsx['customaurl'], '/page/detail' . $rsx['id']); $url = handleAction($url); } else { $url = '?act=onepage&id=' . $rsx['id']; } //判断是否生成html if ($rsx['isonhtml'] == true) { $s = '<a href="' . $url . '">' . $rsx['title'] . '</a>'; } else { $s = '<span>' . $rsx['title'] . '</span>'; } $c = $c . '<li style="width:20%;">' . $s . '</li>' . vbCrlf(); // target=""_blank"" 去掉 } } $c = $c . '</ul>' . vbCrlf() . '</li>' . vbCrlf(); $templateContent = ''; $templateContent = getFText($GLOBALS['adminDir'] . '/template_SiteMap.html'); $templateContent = replace($templateContent, '{$content$}', $c); $templateContent = replace($templateContent, '{$Web_Title$}', $GLOBALS['cfg_webTitle']); createFile('sitemap.html', $templateContent); aspEcho('生成sitemap.html文件成功', '<a href=\'/sitemap.html\' target=\'_blank\'>点击预览sitemap.html</a>'); } writeSystemLog('', '保存sitemap.xml'); //系统日志 }
function batchImportColumnList($splField, $listStr, $nOK, $tableName) { $splstr = ''; $splxx = ''; $isColumn = ''; $columnName = ''; $s = ''; $c = ''; $nLen = ''; $id = ''; $parentIdArray = aspArray(99); $columntypeArray = aspArray(99); $flagsArray = aspArray(99); $nIndex = ''; $fieldStr = ''; $fieldName = ''; $valueStr = ''; $nCount = ''; $isColumn = false; $nCount = 0; $listStr = replace($listStr, vbTab(), ' '); $splstr = aspSplit($listStr, vbCrlf()); foreach ($splstr as $key => $s) { if ($s == '【#sub#】') { $isColumn = true; } else { if ($isColumn == true) { $columnName = $s; if (inStr($columnName, '【|】') > 0) { $columnName = mid($columnName, 1, inStr($columnName, '【|】') - 1); } $columnName = aspRTrim($columnName); $nLen = len($columnName); $columnName = aspLTrim($columnName); $nlen = $nLen - len($columnName); $nIndex = cint($nLen / 4); if ($columnName != '') { $parentIdArray[$nIndex] = $columnName; $c = $c . '【columnname】' . $columnName . vbCrlf(); foreach ($splField as $key => $fieldStr) { $splxx = aspSplit($fieldStr . '|', '|'); $fieldName = $splxx[0]; if ($fieldName != '' && $fieldName != 'columnname' && inStr($s, $fieldName . '=\'') > 0) { $valueStr = getStrCut($s, $fieldName . '=\'', '\'', 2); $c = $c . '【' . $fieldName . '】' . $valueStr . vbCrlf(); if ($fieldName == 'columntype') { $columntypeArray[$nIndex] = $valueStr; } else { if ($fieldName == 'flags') { $flagsArray[$nIndex] = $valueStr; } } } } if ($nIndex != 0) { $c = $c . '【parentid】' . $parentIdArray[$nIndex - 1] . vbCrlf(); $c = $c . '【columntype】' . $columntypeArray[$nIndex - 1] . vbCrlf(); $c = $c . '【flags】' . $flagsArray[$nIndex - 1] . vbCrlf(); } else { $c = $c . '【parentid】-1' . vbCrlf(); } $c = $c . '【sortrank】' . $nCount . vbCrlf(); $nCount = $nCount + 1; $c = $c . '-------------------------------' . vbCrlf(); } } } } //call die(createfile("1.txt",c)) //继续导入 if ($c != '') { importTXTData($c, $tableName, '添加'); } }
function isCode($content) { $c = ''; $c = replace($content, ' ', ''); $c = replace($c, chr(13), ''); $c = replace($c, chr(10), ''); $c = replace($c, vbTab(), ''); $isCode = IIF($c != '', true, false); return @$isCode; }