function getWhereAnd($sql, $addSql) { $LCaseAddSql = ''; $AddType = ''; $s = ''; //追加SQl为空则退出 if (aspTrim($addSql) == '') { $getWhereAnd = $sql; return @$getWhereAnd; } if (inStr(lCase($sql), ' where ') > 0) { $AddType = ' And '; } else { $AddType = ' Where '; } if ($addSql != '') { $addSql = aspTrim($addSql); $LCaseAddSql = lCase($addSql); if (left($LCaseAddSql, 6) == 'order ' || left($LCaseAddSql, 6) == 'group ') { $getWhereAnd = $sql . ' ' . $addSql; return @$getWhereAnd; //改进必需加空格,因为前面已经删除了20160115 } else { if (left($LCaseAddSql, 6) == 'where ') { $addSql = mid($addSql, 7, -1); } else { if (left($LCaseAddSql, 4) == 'and ') { $addSql = mid($addSql, 5, -1); } } } //对where 改进 20160623 $s = lCase($addSql); if ($s != 'and' && $s != 'or' && $s != 'where') { $sql = $sql . $AddType . $addSql; } } $getWhereAnd = $sql; return @$getWhereAnd; }
function FormSubmit() { $TableName = ''; $SplStr = ''; $S = ''; $FieldName = ''; $FieldContent = ''; $FieldList = ''; $YZM = ''; $GLOBALS['conn='] = OpenConn(); $SplStr = aspSplit(@$_POST[], '&'); $TableName = Rf('TableName'); $YZM = aspTrim(Rf('YZM')); if ($YZM != '') { if (@$_SESSION['YZM'] != $YZM) { javascript('返回', '验证码不正确', ''); die; } } $FieldList = lCase(getFieldList($TableName)); //Call Echo("FieldList",FieldList) //Call Echo("TableName", TableName) $RsObj = $GLOBALS['conn']->query('Select * From [' . $TableName . ']'); foreach ($SplStr as $key => $S) { $FieldName = lCase(mid($S, 1, inStr($S, '=') - 1)); //FieldContent = Mid(S,InStr(S,"=")+1) $FieldContent = Rf($FieldName); if (inStr(',' . $FieldList . ',', ',' . $FieldName . ',') > 0) { $Rs[$FieldName] = $FieldContent; } //Call Echo(FieldName,FieldContent & "," & unescape(FieldContent)) } // Call Echo("DialogTitle",Rf("DialogTitle")) //Call Die("留言内容") javascript('返回', '提交' . Rf('DialogTitle') . '成功', ''); }
function setHtmlParam($content, $ParamList) { $splStr = ''; $startStr = ''; $endStr = ''; $c = ''; $paramValue = ''; $ReplaceStartStr = ''; $endStr = '\''; $splStr = aspSplit($ParamList, '|'); foreach ($splStr as $key => $startStr) { $startStr = aspTrim($startStr); if ($startStr != '') { //替换开始字符 因为开始字符类型可变 不同 $ReplaceStartStr = $startStr; if (left($ReplaceStartStr, 3) == 'img') { $ReplaceStartStr = mid($ReplaceStartStr, 4, -1); } else { if (left($ReplaceStartStr, 1) == 'a') { $ReplaceStartStr = mid($ReplaceStartStr, 2, -1); } else { if (inStr('|ul|li|', '|' . left($ReplaceStartStr, 2) . '|') > 0) { $ReplaceStartStr = mid($ReplaceStartStr, 3, -1); } } } $ReplaceStartStr = ' ' . $ReplaceStartStr . '=\''; $startStr = ' ' . $startStr . '=\''; if (inStr($content, $startStr) > 0 && inStr($content, $endStr) > 0) { $paramValue = StrCut($content, $startStr, $endStr, 2); $paramValue = HandleInModule($paramValue, 'end'); //处理内部模块 $c = $c . $ReplaceStartStr . $paramValue . $endStr; } } } $setHtmlParam = $c; return @$setHtmlParam; }
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 readColumeSetTitle($action, $id, $ColumeTitle, $ColumeContent) { $TitleWidth = ''; //标题宽度 $TitleHeight = ''; //标题高度 $ContentHeight = ''; //内容高度 $ContentWidth = ''; //内容宽度 $ContentCss = ''; $TitleWidth = RParam($action, 'TitleWidth'); //获得标题高度 待应用20150715 $TitleHeight = RParam($action, 'TitleHeight'); //获得标题宽度 $ContentWidth = RParam($action, 'ContentWidth'); //获得内容宽度 $ContentHeight = RParam($action, 'ContentHeight'); //获得内容高度 //标题宽 $TitleWidth = aspTrim($TitleWidth); //自动加px单位,不加会无效果 20150115 if (right($TitleHeight, 1) != '%' && right($TitleHeight, 2) != 'px' && $TitleHeight != '' && $TitleHeight != 'auto') { $TitleHeight = $TitleHeight . 'px'; } if (right($TitleWidth, 1) != '%' && right($TitleWidth, 2) != 'px' && $TitleWidth != '' && $TitleWidth != 'auto') { $TitleWidth = $TitleWidth . 'px'; } //内容高 $ContentHeight = aspTrim($ContentHeight); //自动加px单位,不加会无效果 20150115 if (right($ContentHeight, 1) != '%' && right($ContentHeight, 2) != 'px' && $ContentHeight != '' && $ContentHeight != 'auto') { $ContentHeight = $ContentHeight . 'px'; } //内容宽 $ContentWidth = aspTrim($ContentWidth); //自动加px单位,不加会无效果 20150115 if (right($ContentWidth, 1) != '%' && right($ContentWidth, 2) != 'px' && $ContentWidth != '' && $ContentWidth != 'auto') { $ContentWidth = $ContentWidth . 'px'; } if ($ContentHeight != '') { $ContentCss = 'height:' . $ContentHeight . ';'; } if ($ContentWidth != '') { $ContentCss = $ContentCss . 'width:' . $ContentWidth . ';'; } $content = ''; $content = readColumn($id); //标题宽 if ($TitleWidth != '') { $content = replace($content, '<div class="tvalue">', '<div class="tvalue" style=\'width:' . $TitleWidth . ';\'>'); } //内容高 if ($ContentCss != '') { $content = replace($content, '<div class="ccontent">', '<div class="ccontent" style=\'' . $ContentCss . '\'>'); } //call echo(ContentWidth,ContentCss) $content = replace($content, '栏目标题', $ColumeTitle); $content = replace($content, '栏目内容', $ColumeContent); $readColumeSetTitle = $content; return @$readColumeSetTitle; }
function XY_JsWebStat($action) { $s = ''; $fileName = ''; $sType = ''; $sType = RParam($action, 'stype'); $fileName = aspTrim(RParam($action, 'fileName')); if ($fileName == '') { $fileName = '[$WEB_VIEWURL$]?act=webstat&stype=' . $sType; } $fileName = replace($fileName, '/', '\\/'); $s = '<script>document.writeln("<script src=\\\'' . $fileName . '&GoToUrl="'; $s = $s . '+escape(document.referrer)+"&ThisUrl="+escape(window.location.href)+"&screen="+escape(window.screen.width+"x"+window.screen.height)'; $s = $s . '+"&co="+escape(document.cookie)'; //收集cookie 不需要则屏蔽掉 $s = $s . '+" \\\'><\\/script>");</script>'; $XY_JsWebStat = $s; return @$XY_JsWebStat; }
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; }
function replaceDim($content) { $splStr = ''; $s = ''; $tempS = ''; $c = ''; $lCaseS = ''; $DimInTHNumb = ''; $splStr = aspSplit($content, ','); foreach ($splStr as $key => $s) { $s = aspTrim($s); $lCaseS = lCase($s); if ($s != '') { //对变量中()处理, if (inStr($s, '(') > 0) { $s = mid($s, 1, inStr($s, '(') - 1); } $DimInTHNumb = inStr(lCase($GLOBALS['ReplaceDimList']), ',' . $lCaseS . '='); //替换变量 if ($DimInTHNumb > 0) { //替换变量 $tempS = mid($GLOBALS['ReplaceDimList'], $DimInTHNumb + 1, -1); $tempS = mid($tempS, 1, inStr($tempS, ',') - 1); $tempS = mid($tempS, inStr($tempS, '=') + 1, -1); if (inStr($GLOBALS['FunDim'] . $GLOBALS['RootFunDim'], ',' . $tempS . ',') == false) { $s = $tempS; } } $c = $c . $s . ','; } } if ($c != '') { $c = left($c, len($c) - 1); } $replaceDim = $c; return @$replaceDim; }
function handleCssPX($nValue) { $nValue = lCase(aspTrim($nValue)); if (right($nValue, 1) != '%' && right($nValue, 2) != 'px') { $nValue = $nValue . 'px'; } $handleCssPX = $nValue; return @$handleCssPX; }
function makeWebHtml($action) { $actionType = ''; $npagesize = ''; $npage = ''; $url = ''; $addSql = ''; $sortSql = ''; $sortFieldName = ''; $ascOrDesc = ''; $serchKeyWordName = ''; $parentid = ''; //追加于20160716 home $actionType = RParam($action, 'actionType'); $npage = RParam($action, 'npage'); $npage = getNumber($npage); if ($npage == '') { $npage = 1; } else { $npage = CInt($npage); } //导航 if ($actionType == 'nav') { $GLOBALS['glb_columnType'] = RParam($action, 'columnType'); $GLOBALS['glb_columnName'] = RParam($action, 'columnName'); $GLOBALS['glb_columnId'] = RParam($action, 'columnId'); if ($GLOBALS['glb_columnId'] == '') { $GLOBALS['glb_columnId'] = RParam($action, 'id'); } if ($GLOBALS['glb_columnType'] != '') { $addSql = 'where columnType=\'' . $GLOBALS['glb_columnType'] . '\''; } if ($GLOBALS['glb_columnName'] != '') { $addSql = getWhereAnd($addSql, 'where columnName=\'' . $GLOBALS['glb_columnName'] . '\''); } if ($GLOBALS['glb_columnId'] != '') { $addSql = getWhereAnd($addSql, 'where id=' . $GLOBALS['glb_columnId'] . ''); } //call echo("addsql",addsql) $rsObj = $GLOBALS['conn']->query('Select * from ' . $GLOBALS['db_PREFIX'] . 'webcolumn ' . $addSql); if (@mysql_num_rows($rsObj) != 0) { $rs = mysql_fetch_array($rsObj); $GLOBALS['glb_columnId'] = $rs['id']; $GLOBALS['glb_columnName'] = $rs['columnname']; $GLOBALS['glb_columnType'] = $rs['columntype']; $GLOBALS['glb_bodyContent'] = $rs['bodycontent']; $GLOBALS['glb_detailTitle'] = $GLOBALS['glb_columnName']; $GLOBALS['glb_flags'] = $rs['flags']; $npagesize = $rs['npagesize']; //每页显示条数 $GLOBALS['glb_isonhtml'] = $rs['isonhtml']; //是否生成静态网页 $sortSql = ' ' . $rs['sortsql']; //排序SQL if ($rs['webtitle'] != '') { $GLOBALS['cfg_webTitle'] = $rs['webtitle']; //网址标题 } if ($rs['webkeywords'] != '') { $GLOBALS['cfg_webKeywords'] = $rs['webkeywords']; //网站关键词 } if ($rs['webdescription'] != '') { $GLOBALS['cfg_webDescription'] = $rs['webdescription']; //网站描述 } if ($GLOBALS['templateName'] == '') { if (aspTrim($rs['templatepath']) != '') { $GLOBALS['templateName'] = $rs['templatepath']; } else { if ($rs['columntype'] != '首页') { $GLOBALS['templateName'] = getDateilTemplate($rs['id'], 'List'); } } } } $GLOBALS['glb_columnENType'] = handleColumnType($GLOBALS['glb_columnType']); $GLOBALS['glb_url'] = getColumnUrl($GLOBALS['glb_columnName'], 'name'); //文章类列表 if (inStr('|产品|新闻|视频|下载|案例|', '|' . $GLOBALS['glb_columnType'] . '|') > 0) { $GLOBALS['glb_bodyContent'] = getDetailList($action, defaultListTemplate($GLOBALS['glb_columnType'], $GLOBALS['glb_columnName']), 'ArticleDetail', '栏目列表', '*', $npagesize, $npage, 'where parentid=' . $GLOBALS['glb_columnId'] . $sortSql); //留言类列表 } else { if (inStr('|留言|', '|' . $GLOBALS['glb_columnType'] . '|') > 0) { $GLOBALS['glb_bodyContent'] = getDetailList($action, defaultListTemplate($GLOBALS['glb_columnType'], $GLOBALS['glb_columnName']), 'GuestBook', '留言列表', '*', $npagesize, $npage, ' where isthrough<>0 ' . $sortSql); } else { if ($GLOBALS['glb_columnType'] == '文本') { //航行栏目加管理 if (@$_REQUEST['gl'] == 'edit') { $GLOBALS['glb_bodyContent'] = '<span>' . $GLOBALS['glb_bodyContent'] . '</span>'; } $url = WEB_ADMINURL . '?act=addEditHandle&actionType=WebColumn&lableTitle=网站栏目&nPageSize=10&page=&id=' . $GLOBALS['glb_columnId'] . '&n=' . getRnd(11); $GLOBALS['glb_bodyContent'] = handleDisplayOnlineEditDialog($url, $GLOBALS['glb_bodyContent'], '', 'span'); } } } //细节 } else { if ($actionType == 'detail') { $GLOBALS['glb_locationType'] = 'detail'; $rsObj = $GLOBALS['conn']->query('Select * from ' . $GLOBALS['db_PREFIX'] . 'articledetail where id=' . RParam($action, 'id')); if (@mysql_num_rows($rsObj) != 0) { $rs = mysql_fetch_array($rsObj); $GLOBALS['glb_columnName'] = getColumnName($rs['parentid']); $GLOBALS['glb_detailTitle'] = $rs['title']; $GLOBALS['glb_flags'] = $rs['flags']; $GLOBALS['glb_isonhtml'] = $rs['isonhtml']; //是否生成静态网页 $GLOBALS['glb_id'] = $rs['id']; //文章ID if ($GLOBALS['isMakeHtml'] == true) { $GLOBALS['glb_url'] = getHandleRsUrl($rs['filename'], $rs['customaurl'], '/detail/detail' . $rs['id']); } else { $GLOBALS['glb_url'] = handleWebUrl('?act=detail&id=' . $rs['id']); } if ($rs['webtitle'] != '') { $GLOBALS['cfg_webTitle'] = $rs['webtitle']; //网址标题 } if ($rs['webkeywords'] != '') { $GLOBALS['cfg_webKeywords'] = $rs['webkeywords']; //网站关键词 } if ($rs['webdescription'] != '') { $GLOBALS['cfg_webDescription'] = $rs['webdescription']; //网站描述 } //改进20160628 $sortFieldName = 'id'; $ascOrDesc = 'asc'; $addsql = aspTrim(getWebColumnSortSql($rs['parentid'])); if ($addsql != '') { $sortFieldName = aspTrim(replace(replace(replace($addsql, 'order by', ''), ' desc', ''), ' asc', '')); if (inStr($addsql, ' desc') > 0) { $ascOrDesc = 'desc'; } } $GLOBALS['glb_artitleAuthor'] = $rs['author']; $GLOBALS['glb_artitleAdddatetime'] = $rs['adddatetime']; $GLOBALS['glb_upArticle'] = upArticle($rs['parentid'], $sortFieldName, $rs[$sortFieldName], $ascOrDesc); $GLOBALS['glb_downArticle'] = downArticle($rs['parentid'], $sortFieldName, $rs[$sortFieldName], $ascOrDesc); $GLOBALS['glb_aritcleRelatedTags'] = aritcleRelatedTags($rs['relatedtags']); $GLOBALS['glb_aritcleSmallImage'] = $rs['smallimage']; $GLOBALS['glb_aritcleBigImage'] = $rs['bigimage']; //文章内容 //glb_bodyContent = "<div class=""articleinfowrap"">[$articleinfowrap$]</div>" & rs("bodycontent") & "[$relatedtags$]<ul class=""updownarticlewrap"">[$updownArticle$]</ul>" //上一篇文章,下一篇文章 //glb_bodyContent = Replace(glb_bodyContent, "[$updownArticle$]", upArticle(rs("parentid"), "sortrank", rs("sortrank")) & downArticle(rs("parentid"), "sortrank", rs("sortrank"))) //glb_bodyContent = Replace(glb_bodyContent, "[$articleinfowrap$]", "来源:" & rs("author") & " 发布时间:" & format_Time(rs("adddatetime"), 1)) //glb_bodyContent = Replace(glb_bodyContent, "[$relatedtags$]", aritcleRelatedTags(rs("relatedtags"))) $GLOBALS['glb_bodyContent'] = $rs['bodycontent']; //文章详细加控制 if (@$_REQUEST['gl'] == 'edit') { $GLOBALS['glb_bodyContent'] = '<span>' . $GLOBALS['glb_bodyContent'] . '</span>'; } $url = WEB_ADMINURL . '?act=addEditHandle&actionType=ArticleDetail&lableTitle=分类信息&nPageSize=10&page=&parentid=&id=' . RParam($action, 'id') . '&n=' . getRnd(11); $GLOBALS['glb_bodyContent'] = handleDisplayOnlineEditDialog($url, $GLOBALS['glb_bodyContent'], '', 'span'); if ($GLOBALS['templateName'] == '') { if (aspTrim($rs['templatepath']) != '') { $GLOBALS['templateName'] = $rs['templatepath']; } else { $GLOBALS['templateName'] = getDateilTemplate($rs['parentid'], 'Detail'); } } } //单页 } else { if ($actionType == 'onepage') { $rsObj = $GLOBALS['conn']->query('Select * from ' . $GLOBALS['db_PREFIX'] . 'onepage where id=' . RParam($action, 'id')); if (@mysql_num_rows($rsObj) != 0) { $rs = mysql_fetch_array($rsObj); $GLOBALS['glb_detailTitle'] = $rs['title']; $GLOBALS['glb_isonhtml'] = $rs['isonhtml']; //是否生成静态网页 if ($GLOBALS['isMakeHtml'] == true) { $GLOBALS['glb_url'] = getHandleRsUrl($rs['filename'], $rs['customaurl'], '/page/page' . $rs['id']); } else { $GLOBALS['glb_url'] = handleWebUrl('?act=detail&id=' . $rs['id']); } if ($rs['webtitle'] != '') { $GLOBALS['cfg_webTitle'] = $rs['webtitle']; //网址标题 } if ($rs['webkeywords'] != '') { $GLOBALS['cfg_webKeywords'] = $rs['webkeywords']; //网站关键词 } if ($rs['webdescription'] != '') { $GLOBALS['cfg_webDescription'] = $rs['webdescription']; //网站描述 } //内容 $GLOBALS['glb_bodyContent'] = $rs['bodycontent']; //文章详细加控制 if (@$_REQUEST['gl'] == 'edit') { $GLOBALS['glb_bodyContent'] = '<span>' . $GLOBALS['glb_bodyContent'] . '</span>'; } $url = WEB_ADMINURL . '?act=addEditHandle&actionType=ArticleDetail&lableTitle=分类信息&nPageSize=10&page=&parentid=&id=' . RParam($action, 'id') . '&n=' . getRnd(11); $GLOBALS['glb_bodyContent'] = handleDisplayOnlineEditDialog($url, $GLOBALS['glb_bodyContent'], '', 'span'); if ($GLOBALS['templateName'] == '') { if (aspTrim($rs['templatepath']) != '') { $GLOBALS['templateName'] = $rs['templatepath']; } else { $GLOBALS['templateName'] = 'Main_Model.html'; //call echo(templateName,"templateName") } } } //搜索 } else { if ($actionType == 'Search') { $GLOBALS['templateName'] = 'Main_Model.html'; $serchKeyWordName = @$_REQUEST['keywordname']; $parentid = @$_REQUEST['parentid']; if ($serchKeyWordName == '') { $serchKeyWordName = 'wd'; } $GLOBALS['glb_searchKeyWord'] = replace(@$_REQUEST[$serchKeyWordName], '<', '<'); $addSql = ''; if ($parentid != '') { $addSql = ' where parentid=' . $parentid; } $addSql = getWhereAnd($addSql, ' where title like \'%' . $GLOBALS['glb_searchKeyWord'] . '%\''); $npagesize = 20; //call echo(npagesize, npage) $GLOBALS['glb_bodyContent'] = getDetailList($action, defaultListTemplate($GLOBALS['glb_columnType'], $GLOBALS['glb_columnName']), 'ArticleDetail', '网站栏目', '*', $npagesize, $npage, $addSql); $GLOBALS['positionEndStr'] = ' >> 搜索内容”' . $GLOBALS['glb_searchKeyWord'] . '“'; //加载等待 } else { if ($actionType == 'loading') { rwEnd('页面正在加载中。。。'); } } } } } //模板为空,则用默认首页模板 if ($GLOBALS['templateName'] == '') { $GLOBALS['templateName'] = 'Index_Model.html'; //默认模板 } //检测当前路径是否有模板 if (inStr($GLOBALS['templateName'], '/') == false) { $GLOBALS['templateName'] = $GLOBALS['cfg_webTemplate'] . '/' . $GLOBALS['templateName']; } //call echo("templateName",templateName) if (CheckFile($GLOBALS['templateName']) == false) { Eerr('未找到模板文件', $GLOBALS['templateName']); } $GLOBALS['code'] = getFText($GLOBALS['templateName']); $GLOBALS['code'] = handleAction($GLOBALS['code']); //处理动作 $GLOBALS['code'] = thisPosition($GLOBALS['code']); //位置 $GLOBALS['code'] = replaceGlobleVariable($GLOBALS['code']); //替换全局标签 $GLOBALS['code'] = handleAction($GLOBALS['code']); //处理动作 '再来一次,处理数据内容里动作 $GLOBALS['code'] = handleAction($GLOBALS['code']); //处理动作 $GLOBALS['code'] = handleAction($GLOBALS['code']); //处理动作 $GLOBALS['code'] = thisPosition($GLOBALS['code']); //位置 $GLOBALS['code'] = replaceGlobleVariable($GLOBALS['code']); //替换全局标签 $GLOBALS['code'] = delTemplateMyNote($GLOBALS['code']); //删除无用内容 //格式化HTML if (inStr($GLOBALS['cfg_flags'], '|formattinghtml|') > 0) { //code = HtmlFormatting(code) '简单 $GLOBALS['code'] = handleHtmlFormatting($GLOBALS['code'], false, 0, '删除空行'); //自定义 //格式化HTML第二种 } else { if (inStr($GLOBALS['cfg_flags'], '|formattinghtmltow|') > 0) { $GLOBALS['code'] = htmlFormatting($GLOBALS['code']); //简单 $GLOBALS['code'] = handleHtmlFormatting($GLOBALS['code'], false, 0, '删除空行'); //自定义 //压缩HTML } else { if (inStr($GLOBALS['cfg_flags'], '|ziphtml|') > 0) { $GLOBALS['code'] = zipHTML($GLOBALS['code']); } } } //闭合标签 if (inStr($GLOBALS['cfg_flags'], '|labelclose|') > 0) { $GLOBALS['code'] = handleCloseHtml($GLOBALS['code'], true, ''); //图片自动加alt "|*|", } //在线编辑20160127 if (rq('gl') == 'edit') { if (inStr($GLOBALS['code'], '</head>') > 0) { if (inStr(lCase($GLOBALS['code']), 'jquery.min.js') == false) { $GLOBALS['code'] = replace($GLOBALS['code'], '</head>', '<script src="/Jquery/jquery.Min.js"></script></head>'); } $GLOBALS['code'] = replace($GLOBALS['code'], '</head>', '<script src="/Jquery/Callcontext_menu.js"></script></head>'); } if (inStr($GLOBALS['code'], '<body>') > 0) { //Code = Replace(Code,"<body>", "<body onLoad=""ContextMenu.intializeContextMenu()"">") } } //call echo(templateName,templateName) $makeWebHtml = $GLOBALS['code']; return @$makeWebHtml; }
function enToCompany($content) { $content = replace($content, 'Shang Hai', 'Shanghai'); $content = replace($content, 'You Xian Gong Si', ' Co.,Ltd.'); $enToCompany = aspTrim($content); return @$enToCompany; }
function contentTranscoding($content) { $content = replace(replace(replace(replace($content, '<?', '<?'), '?>', '?>'), '<' . '%', '<%'), '?>', '%>'); $splStr = ''; $i = ''; $s = ''; $c = ''; $isTranscoding = ''; $isBR = ''; $isTranscoding = false; $isBR = false; $splStr = aspSplit($content, vbCrlf()); foreach ($splStr as $key => $s) { if (inStr($s, '[&html转码&]') > 0) { $isTranscoding = true; } if (inStr($s, '[&html转码end&]') > 0) { $isTranscoding = false; } if (inStr($s, '[&全部换行&]') > 0) { $isBR = true; } if (inStr($s, '[&全部换行end&]') > 0) { $isBR = false; } if ($isTranscoding == true) { $s = replace(replace($s, '[&html转码&]', ''), '<', '<'); } else { $s = replace($s, '[&html转码end&]', ''); } if ($isBR == true) { $s = replace($s, '[&全部换行&]', ''); if (right(aspTrim($s), 8) != '【《】/div>') { $s = $s . '<br>'; } } else { $s = replace($s, '[&全部换行end&]', ''); } //标签样式超简单添加 20160628 if (inStr($s, '【article_lable】') > 0) { $s = replace($s, '【article_lable】', ''); $s = '<div class="article_lable">' . $s . '</div>'; } else { if (inStr($s, '【article_blockquote】') > 0) { $s = replace($s, '【article_blockquote】', ''); $s = '<div class="article_blockquote">' . $s . '</div>'; } } if ($c != '') { $c = $c . vbCrlf(); } $c = $c . $s; } $c = replace(replace($c, '【b】', '<b>'), '【/b】', '</b>'); $c = replace($c, '【《】', '<'); $c = replace(replace($c, '【strong】', '<strong>'), '【/strong】', '</strong>'); $contentTranscoding = $c; return @$contentTranscoding; }
function inputTextArea($textName, $valueStr, $width, $height, $helpStr) { $Css = ''; $HeightStr = ''; $width = aspTrim(lCase($width)); if ($width != '') { if (right($width, 1) != '%' && right($width, 2) != 'px') { $width = $width . 'px'; } $Css = ' style=\'width:' . $width . ';\''; } if ($height != '') { if (checkNumber($height)) { //自动加个px像素 $height = $height . 'px'; } $HeightStr = 'height:' . $height . ';'; if ($Css != '') { $Css = replace($Css, ';\'', ';' . $HeightStr . ';\''); } else { $Css = ' style=\'height:' . $height . ';\''; } } $Css = replace($Css, ';;', ';'); //去掉多余的值 $inputTextArea = '<textarea name="' . $textName . '" type="text" id="' . $textName . '"' . $Css . '>' . $valueStr . '</textarea>' . $helpStr; return @$inputTextArea; }
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 dispalyManage($actionName, $lableTitle, $nPageSize, $addSql) { handlePower('显示' . $lableTitle); //管理权限处理 loadWebConfig(); $content = ''; $i = ''; $s = ''; $c = ''; $fieldNameList = ''; $sql = ''; $action = ''; $x = ''; $url = ''; $nCount = ''; $nPage = ''; $idInputName = ''; $tableName = ''; $j = ''; $splxx = ''; $fieldName = ''; //字段名称 $splFieldName = ''; //分割字段 $searchfield = ''; $keyWord = ''; //搜索字段,搜索关键词 $parentid = ''; //栏目id $replaceStr = ''; //替换字符 $tableName = lCase($actionName); //表名称 $searchfield = @$_REQUEST['searchfield']; //获得搜索字段值 $keyWord = @$_REQUEST['keyword']; //获得搜索关键词值 if (@$_POST['parentid'] != '') { $parentid = @$_POST['parentid']; } else { $parentid = @$_GET['parentid']; } $id = ''; $focusid = ''; //是判断传过来的id是否在当前列表中是交点20160715 home $id = rq('id'); $focusid = rq('focusid'); $fieldNameList = getHandleFieldList($GLOBALS['db_PREFIX'] . $tableName, '字段列表'); $fieldNameList = specialStrReplace($fieldNameList); //特殊字符处理 $splFieldName = aspSplit($fieldNameList, ','); //字段分割成数组 //读模板 $content = getTemplateContent('manage_' . $tableName . '.html'); $action = getStrCut($content, '[list]', '[/list]', 2); //网站栏目单独处理 栏目不一样20160301 if ($actionName == 'WebColumn') { $action = getStrCut($content, '[action]', '[/action]', 1); $content = replace($content, $action, showColumnList(-1, 'WebColumn', 'columnname', '', 0, $action)); } else { if ($actionName == 'ListMenu') { $action = getStrCut($content, '[action]', '[/action]', 1); $content = replace($content, $action, showColumnList(-1, 'listmenu', 'title', '', 0, $action)); } else { if ($keyWord != '' && $searchfield != '') { $addSql = getWhereAnd(' where ' . $searchfield . ' like \'%' . $keyWord . '%\' ', $addSql); } if ($parentid != '') { $addSql = getWhereAnd(' where parentid=' . $parentid . ' ', $addSql); } //call echo(tableName,addsql) $sql = 'select * from ' . $GLOBALS['db_PREFIX'] . $tableName . ' ' . $addSql; //检测SQL if (checkSql($sql) == false) { errorLog('出错提示:<br>action=' . $action . '<hr>sql=' . $sql . '<br>'); return ''; } $rsObj = $GLOBALS['conn']->query($sql); $nCount = @mysql_num_rows($rsObj); $nPage = @$_REQUEST['page']; $content = replace($content, '[$pageInfo$]', webPageControl($nCount, $nPageSize, $nPage, $url, '')); $content = replace($content, '[$accessSql$]', $sql); if (EDITORTYPE == 'asp') { $x = getRsPageNumber($rs, $nCount, $nPageSize, $nPage); //获得Rs页数 '记录总数 } else { if ($nPage != '') { $nPage = $nPage - 1; } $sql = 'select * from ' . $GLOBALS['db_PREFIX'] . '' . $tableName . ' ' . $addSql . ' limit ' . $nPageSize * $nPage . ',' . $nPageSize; $rsObj = $GLOBALS['conn']->query($sql); $x = @mysql_num_rows($rsObj); } for ($i = 1; $i <= $x; $i++) { $rs = mysql_fetch_array($rsObj); //给PHP用,因为在 asptophp转换不完善 特殊 $s = replace($action, '[$id$]', $rs['id']); for ($j = 0; $j <= uBound($splFieldName); $j++) { if ($splFieldName[$j] != '') { $splxx = aspSplit($splFieldName[$j] . '|||', '|'); $fieldName = $splxx[0]; $replaceStr = $rs[$fieldName] . ''; //对文章旗处理 if ($fieldName == 'flags') { $replaceStr = displayFlags($replaceStr); } //call echo("fieldname",fieldname) //s = Replace(s, "[$" & fieldName & "$]", replaceStr) $s = replaceValueParam($s, $fieldName, $replaceStr); } } $idInputName = 'id'; $s = replace($s, '[$selectid$]', '<input type=\'checkbox\' name=\'' . $idInputName . '\' id=\'' . $idInputName . '\' value=\'' . $rs['id'] . '\' >'); $s = replace($s, '[$phpArray$]', ''); $url = '【NO】'; if ($actionName == 'ArticleDetail') { $url = WEB_VIEWURL . '?act=detail&id=' . $rs['id']; } else { if ($actionName == 'OnePage') { $url = WEB_VIEWURL . '?act=onepage&id=' . $rs['id']; //给评论加预览=文章 20160129 } else { if ($actionName == 'TableComment') { $url = WEB_VIEWURL . '?act=detail&id=' . $rs['itemid']; } } } //必需有自定义字段 if (inStr($fieldNameList, 'customaurl') > 0) { //自定义网址 if (aspTrim($rs['customaurl']) != '') { $url = aspTrim($rs['customaurl']); } } $s = replace($s, '[$viewWeb$]', $url); $s = replaceValueParam($s, 'cfg_websiteurl', $GLOBALS['cfg_webSiteUrl']); //call echo(focusid & "/" & rs("id"),IIF(focusid=cstr(rs("id")),"true","false")) $s = replaceValueParam($s, 'focusid', $focusid); $c = $c . $s; } $content = replace($content, '[list]' . $action . '[/list]', $c); //表单提交处理,parentid(栏目ID) searchfield(搜索字段) keyword(关键词) addsql(排序) $url = '?page=[id]&addsql=' . @$_REQUEST['addsql'] . '&keyword=' . @$_REQUEST['keyword'] . '&searchfield=' . @$_REQUEST['searchfield'] . '&parentid=' . @$_REQUEST['parentid']; $url = getUrlAddToParam(getUrl(), $url, 'replace'); //call echo("url",url) $content = replace($content, '[list]' . $action . '[/list]', $c); } } if (inStr($content, '[$input_parentid$]') > 0) { $action = '[list]<option value="[$id$]"[$selected$]>[$selectcolumnname$]</option>[/list]'; $c = '<select name="parentid" id="parentid"><option value="">≡ 选择栏目 ≡</option>' . showColumnList(-1, 'webcolumn', 'columnname', $parentid, 0, $action) . vbCrlf() . '</select>'; $content = replace($content, '[$input_parentid$]', $c); //上级栏目 } $content = replaceValueParam($content, 'searchfield', @$_REQUEST['searchfield']); //搜索字段 $content = replaceValueParam($content, 'keyword', @$_REQUEST['keyword']); //搜索关键词 $content = replaceValueParam($content, 'nPageSize', @$_REQUEST['nPageSize']); //每页显示条数 $content = replaceValueParam($content, 'addsql', @$_REQUEST['addsql']); //追加sql值条数 $content = replaceValueParam($content, 'tableName', $tableName); //表名称 $content = replaceValueParam($content, 'actionType', @$_REQUEST['actionType']); //动作类型 $content = replaceValueParam($content, 'lableTitle', @$_REQUEST['lableTitle']); //动作标题 $content = replaceValueParam($content, 'id', $id); //id $content = replaceValueParam($content, 'page', @$_REQUEST['page']); //页 $content = replaceValueParam($content, 'parentid', @$_REQUEST['parentid']); //栏目id $content = replaceValueParam($content, 'focusid', $focusid); $url = getUrlAddToParam(getThisUrl(), '?parentid=&keyword=&searchfield=&page=', 'delete'); $content = replaceValueParam($content, 'position', '系统管理 > <a href=\'' . $url . '\'>' . $lableTitle . '列表</a>'); //position位置 $content = replace($content, '{$EDITORTYPE$}', EDITORTYPE); //asp与phh $content = replace($content, '{$WEB_VIEWURL$}', WEB_VIEWURL); //前端浏览网址 $content = replace($content, '{$Web_Title$}', $GLOBALS['cfg_webTitle']); $content = $content . stat2016(true); $content = handleDisplayLanguage($content, 'handleDisplayLanguage'); //语言处理 Rw($content); }
function handleHtmlAHref($content, $labelName, $addToHttpUrl, $action) { $i = ''; $s = ''; $c = ''; $temp = ''; $isValue = ''; //是否为内容值 $valueStr = ''; //存储内容值 $yinghaoLabel = ''; //引号类型如'" $parentName = ''; //参数名称 $behindStr = ''; //后面全部字符 $noDanYinShuangYinStr = ''; //不是单引号和双引号字符 $action = '|' . $action . '|'; $content = replace($content . ' ', vbTab(), ' '); //退格替换成空格,最后加一个空格,方便计算 $content = replace(replace($content, ' =', '='), ' =', '='); $isValue = false; //默认内容为假,因为先是获得标签名称 for ($i = 1; $i <= len($content); $i++) { $s = mid($content, $i, 1); //获得当前一个字符 $behindStr = mid($content, $i, -1); //后面字符 if ($s == '=' && $isValue == false) { //不是内容值,并为=号 $isValue = true; $valueStr = ''; $yinghaoLabel = ''; if ($c != '' && right($c, 1) != ' ') { $c = $c . ' '; } $parentName = lCase($temp); //参数名称转小写 $c = $c . $parentName . $s; $temp = ''; //获得值第一个字符,因为它是引号类型 } else { if ($isValue == true && $yinghaoLabel == '') { if ($s != ' ') { if ($s != '\'' && $s != '"') { $noDanYinShuangYinStr = $s; //不是单引号和双引号字符 $s = ' '; } $yinghaoLabel = $s; //call echo("yinghaoLabel",yinghaoLabel) } } else { if ($isValue == true && $yinghaoLabel != '') { //为引号结束 if ($yinghaoLabel == $s) { $isValue = false; if ($labelName == 'a' && $parentName == 'href' && inStr($action, '|处理A链接|') > 0) { //处理 if (inStr($valueStr, '?') > 0) { $valueStr = replace($valueStr, '?', 'WenHao') . '.html'; } if (inStr('|asp|php|aspx|jsp|', '|' . lCase(mid($valueStr, inStrRev($valueStr, '.') + 1, -1)) . '|') > 0) { $valueStr = $valueStr . '.html'; } $valueStr = addToOrAddHttpUrl($addToHttpUrl, $valueStr, '替换'); } //call echo("labelName",labelName) if ($yinghaoLabel == ' ') { $c = $c . '"' . $noDanYinShuangYinStr . $valueStr . '" '; //追加 不是单引号和双引号字符 补全 } else { $c = $c . $yinghaoLabel . $valueStr . $yinghaoLabel; //追加 不是单引号和双引号字符 } $yinghaoLabel = ''; $noDanYinShuangYinStr = ''; //不是单引号和双引号字符 清空 } else { $valueStr = $valueStr . $s; } //为 分割 } else { if ($s == ' ') { //暂存内容不为空 if ($temp != '') { if (left(aspTrim($behindStr) . ' ', 1) == '=') { //后面一个字符等于=不处理 } else { //为标签 if ($isValue == false) { $temp = lCase($temp) . ' '; //标签类型名称转小写 } $c = $c . $temp; $temp = ''; } } } else { $temp = $temp . $s; } } } } } $c = aspTrim($c); $handleHtmlAHref = $c; return @$handleHtmlAHref; }
function getNumber($content) { $i = ''; $s = ''; $c = ''; $c = ''; $content = aspTrim($content); for ($i = 1; $i <= len($content); $i++) { $s = mid($content, $i, 1); if (inStr('0123456789', $s) > 0) { if ($c == '' && $s == '0') { //待改进,因为现在脑子不够用了,就这么定敢20150322 } else { $c = $c . $s; } } } $getNumber = ''; if ($c != '') { $getNumber = int($c); } return @$getNumber; }
function getHttpUrlStateAbout($nState) { $s = ''; $c = ''; $s = cStr(aspTrim($nState)); switch ($s) { case '100': $c = '继续'; break; case '101': $c = '开关协议'; break; case '200': $c = '成功'; break; case '201': $c = '创建'; break; case '202': $c = '接受'; break; case '203': $c = '非权威信息'; break; case '204': $c = '不含内容'; break; case '205': $c = '重置内容'; break; case '206': $c = '部分内容'; break; case '300': $c = '多项选择'; break; case '301': $c = '移动永久'; break; case '302': $c = '暂时移动'; break; case '303': $c = '看其他的'; break; case '304': $c = '未修改'; break; case '305': $c = '使用代理'; break; case '307': $c = '临时重定向'; break; case '400': $c = '坏的要求'; break; case '401': $c = '未经授权'; break; case '402': $c = '付款要求'; break; case '403': $c = '禁止'; break; case '404': $c = '未找到'; break; case '405': $c = '不允许的方法'; break; case '406': $c = '不可接受'; break; case '407': $c = '代理验证所需'; break; case '408': $c = '请求超时'; break; case '409': $c = '冲突'; break; case '410': $c = '消失'; break; case '411': $c = '所需长度'; break; case '412': $c = '先决条件'; break; case '413': $c = '请求实体过大'; break; case '414': $c = '的请求URI太长'; break; case '415': $c = '不支持的媒体类型'; break; case '416': $c = '的请求范围不满足'; break; case '417': $c = '期望失败'; break; case '500': $c = '内部服务器错误'; break; case '501': $c = '未实施'; break; case '502': $c = '坏网关'; break; case '503': $c = '服务不可用'; break; case '504': $c = '网关超时'; break; case '505': $c = '的HTTP版本不支持'; break; case '509': $c = '带宽限制超过'; } $getHttpUrlStateAbout = $c; return @$getHttpUrlStateAbout; }
function foundInArr($strArr, $strToFind, $strSplit) { $arrTemp = ''; $i = ''; $foundInArr = false; if (inStr($strArr, $strSplit) > 0) { $arrTemp = aspSplit($strArr, $strSplit); for ($i = 0; $i <= uBound($arrTemp); $i++) { if (lCase(aspTrim($arrTemp[$i])) == lCase(aspTrim($strToFind))) { $foundInArr = true; break; } } } else { if (lCase(aspTrim($strArr)) == lCase(aspTrim($strToFind))) { $foundInArr = true; } } return @$foundInArr; }