/** * 格式化数据统一输出 * @param array $data * @return array */ function _cookData($data) { global $db_bbsurl; $data['url'] = $db_bbsurl . '/' . getColumnUrl($data['column_id']); $data['title'] = strip_tags($data['name']); $data['descrip'] = strip_tags($data['name']); return $data; }
function aritcleRelatedTags($relatedTags) { $c = ''; $splStr = ''; $s = ''; $url = ''; $splStr = aspSplit($relatedTags, ','); foreach ($splStr as $key => $s) { if ($s != '') { if ($c != '') { $c = $c . ','; } $url = getColumnUrl($s, 'name'); $c = $c . '<a href="' . $url . '" rel="category tag" class="ablue">' . $s . '</a>' . vbCrlf(); } } $c = '<footer class="articlefooter">' . vbCrlf() . '标签: ' . $c . '</footer>' . vbCrlf(); $aritcleRelatedTags = $c; return @$aritcleRelatedTags; }
/** * 获取页面位置 * @param $cid * @param $id * @param $columns */ function getPosition($cid, $id = 0, $columns = array(), $cms_sitename = '') { if (!$columns) { $columnService = C::loadClass('columnservice'); $columns = $columnService->findAllColumns(); } $postion = $cms_sitename ? "<a href='index.php?m=cms'>{$cms_sitename}</a>" : '<a href="index.php?m=cms">资讯</a>'; if (!$cid) { return $postion . '<em>></em>文章列表'; } $columnLists = getColumnList($columns, $cid); foreach ($columnLists as $value) { $postion .= '<em>></em><a href="' . getColumnUrl($value['column_id']) . '">' . $value['name'] . '</a>'; } if (!$id) { return $postion; } return $postion . '<em>></em>正文内容'; }
function XY_GetColumnUrl($action) { $columnName = ''; $url = ''; $columnName = RParam($action, 'columnName'); $url = getColumnUrl($columnName, 'name'); //handleWebUrl 有对gl处理 //If Request("gl") <> "" Then // url = url & "&gl=" & Request("gl") //End If $XY_GetColumnUrl = $url; return @$XY_GetColumnUrl; }
/** * 格式化数据统一输出 * @param array $data * @return array */ function _cookData($data) { global $db_bbsurl; $data['author'] = $data['username']; $data['authorurl'] = 'u.php?uid=' . $data['userid']; $data['url'] = urlRewrite($db_bbsurl . '/' . getArticleUrl($data['article_id'])); $data['title'] = strip_tags($data['subject']); $data['forumname'] = $data['columnname'] = $this->_getColumnName($data['column_id']); $data['forumurl'] = $data['columnurl'] = getColumnUrl($data['column_id']); $data['postdate'] = strtotime($data['postdate']); return $data; }
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 replaceValueParam($content, $paramName, $replaceStr) { $startStr = ''; $endStr = ''; $labelStr = ''; $tempLabelStr = ''; $nLen = ''; $nTimeFormat = ''; $delHtmlYes = ''; $funStr = ''; $trimYes = ''; $isEscape = ''; $s = ''; $i = ''; $ifStr = ''; //判断字符 $elseIfStr = ''; //第二判断字符 $valueStr = ''; //显示字符 $elseStr = ''; //否则字符 $elseIfValue = ''; $elseValue = ''; //第二判断值 $instrStr = ''; $instr2Str = ''; //查找字符 $tempReplaceStr = ''; //暂存 //ReplaceStr = ReplaceStr & "这里面放上内容在这时碳呀。" //ReplaceStr = CStr(ReplaceStr) '转成字符类型 if (isNul($replaceStr) == true) { $replaceStr = ''; } $tempReplaceStr = $replaceStr; //最多处理99个 20160225 for ($i = 1; $i <= 999; $i++) { $replaceStr = $tempReplaceStr; //恢复 $startStr = '[$' . $paramName; $endStr = '$]'; //字段名称严格判断 20160226 if (inStr($content, $startStr) > 0 && inStr($content, $endStr) > 0 && (inStr($content, $startStr . ' ') > 0 || inStr($content, $startStr . $endStr) > 0)) { //获得对应字段加强版20151231 if (inStr($content, $startStr . $endStr) > 0) { $labelStr = $startStr . $endStr; } else { if (inStr($content, $startStr . ' ') > 0) { $labelStr = StrCut($content, $startStr . ' ', $endStr, 1); } else { $labelStr = StrCut($content, $startStr, $endStr, 1); } } $tempLabelStr = $labelStr; $labelStr = HandleInModule($labelStr, 'start'); //删除Html $delHtmlYes = RParam($labelStr, 'delHtml'); //是否删除Html if ($delHtmlYes == 'true') { $replaceStr = replace(delHtml($replaceStr), '<', '<'); } //HTML处理 //删除两边空格 $trimYes = RParam($labelStr, 'trim'); //是否删除两边空格 if ($trimYes == 'true') { $replaceStr = TrimVbCrlf($replaceStr); } //截取字符处理 $nLen = RParam($labelStr, 'len'); //字符长度值 $nLen = handleNumber($nLen); //If nLen<>"" Then ReplaceStr = CutStr(ReplaceStr,nLen,"null")' Left(ReplaceStr,nLen) if ($nLen != '') { $replaceStr = CutStr($replaceStr, $nLen, '...'); } //Left(ReplaceStr,nLen) //时间处理 $nTimeFormat = RParam($labelStr, 'format_time'); //时间处理值 if ($nTimeFormat != '') { $replaceStr = Format_Time($replaceStr, $nTimeFormat); } //获得栏目名称 $s = RParam($labelStr, 'getcolumnname'); if ($s != '') { if ($s == '@ME') { $s = $replaceStr; } $replaceStr = getColumnName($s); } //获得栏目URL $s = RParam($labelStr, 'getcolumnurl'); if ($s != '') { if ($s == '@ME') { $s = $replaceStr; } $replaceStr = getColumnUrl($s, 'id'); } //是否为密码类型 $s = RParam($labelStr, 'password'); if ($s != '') { if ($s != '') { $replaceStr = $s; } } $ifStr = RParam($labelStr, 'if'); $elseIfStr = RParam($labelStr, 'elseif'); $valueStr = RParam($labelStr, 'value'); $elseifValue = RParam($labelStr, 'elseifvalue'); $elseValue = RParam($labelStr, 'elsevalue'); $instrStr = RParam($labelStr, 'instr'); $instr2Str = RParam($labelStr, 'instr2'); //call echo("ifStr",ifStr) //call echo("valueStr",valueStr) //call echo("elseStr",elseStr) //call echo("elseIfStr",elseIfStr) //call echo("replaceStr",replaceStr) if ($ifStr != '' || $instrStr != '') { if ($ifStr == cStr($replaceStr) && $ifStr != '') { $replaceStr = $valueStr; } else { if ($elseIfStr == cStr($replaceStr) && $elseIfStr != '') { $replaceStr = $valueStr; if ($elseifValue != '') { $replaceStr = $elseifValue; } } else { if (inStr(cStr($replaceStr), $instrStr) > 0 && $instrStr != '') { $replaceStr = $valueStr; } else { if (inStr(cStr($replaceStr), $instr2Str) > 0 && $instr2Str != '') { $replaceStr = $valueStr; if ($elseifValue != '') { $replaceStr = $elseifValue; } } else { if ($elseValue != '@ME') { $replaceStr = $elseValue; } } } } } } //函数处理20151231 [$title function='left(@ME,40)'$] $funStr = RParam($labelStr, 'function'); //函数 if ($funStr != '') { $funStr = replace($funStr, '@ME', $replaceStr); $replaceStr = HandleContentCode($funStr, ''); } //默认值 $s = RParam($labelStr, 'default'); if ($s != '' && $s != '@ME') { if ($replaceStr == '') { $replaceStr = $s; } } //escape转码 $isEscape = lCase(RParam($labelStr, 'escape')); if ($isEscape == '1' || $isEscape == 'true') { $replaceStr = escape($replaceStr); } //文本颜色 $s = RParam($labelStr, 'fontcolor'); //函数 if ($s != '') { $replaceStr = '<font color="' . $s . '">' . $replaceStr . '</font>'; } //call echo(tempLabelStr,replaceStr) $content = replace($content, $tempLabelStr, $replaceStr); } else { break; } } $replaceValueParam = $content; return @$replaceValueParam; }