function adminIndex() { $c = ''; loadWebConfig(); $c = getTemplateContent('adminIndex.html'); $c = replace($c, '[$adminonemenulist$]', getAdminOneMenuList()); $c = replace($c, '[$adminmenulist$]', getAdminMenuList()); $c = replace($c, '[$officialwebsite$]', getOfficialWebsite()); //获得官方信息 $c = replaceValueParam($c, 'title', ''); //给手机端用的20160330 $c = handleDisplayLanguage($c, 'loginok'); Rw($c); }
function XY_ForArray($action) { $arrayList = ''; $splitStr = ''; $defaultStr = ''; $splStr = ''; $forI = ''; $title = ''; $s = ''; $c = ''; $nloop = ''; $arrayList = atRParam($action, 'arraylist'); //atRParam获得结果处理动作,但不替换动作内容 $splitStr = RParam($action, 'splitstr'); $nloop = RParam($action, 'nloop'); //循环数 if ($arrayList == '') { $arrayList = copyStr('循环' . $splitStr, $nloop); } $defaultStr = getDefaultValue($action); $splStr = aspSplit($arrayList, $splitStr); for ($forI = 0; $forI <= uBound($splStr); $forI++) { $title = $splStr[$forI]; if ($title != '') { $s = $defaultStr; $s = replaceValueParam($s, 'fortitle', $title); $s = replaceValueParam($s, 'forid', $forI + 1); $s = replaceValueParam($s, 'fori', $forI); $s = replaceValueParam($s, 'forcount', uBound($splStr) + 1); $c = $c . $s; } } $XY_ForArray = $c; return @$XY_ForArray; }
function displayTemplatesList($content) { $templatesFolder = ''; $templatePath = ''; $templatePath2 = ''; $templateName = ''; $defaultList = ''; $folderList = ''; $splStr = ''; $s = ''; $c = ''; $s1 = ''; $s2 = ''; $s3 = ''; $splTemplatesFolder = ''; //加载网址配置 loadWebConfig(); $defaultList = getStrCut($content, '[list]', '[/list]', 2); $splTemplatesFolder = aspSplit('/Templates/|/Templates2015/|/Templates2016/', '|'); foreach ($splTemplatesFolder as $key => $templatesFolder) { if ($templatesFolder != '') { $folderList = getDirFolderNameList($templatesFolder); $splStr = aspSplit($folderList, vbCrlf()); foreach ($splStr as $key => $templateName) { if ($templateName != '' && inStr('#_', left($templateName, 1)) == false) { $templatePath = $templatesFolder . $templateName; $templatePath2 = $templatePath; $s = $defaultList; $s1 = getStrCut($content, '<!--启用 start-->', '<!--启用 end-->', 2); $s2 = getStrCut($content, '<!--恢复数据 start-->', '<!--恢复数据 end-->', 2); $s3 = getStrCut($content, '<!--删除模板 start-->', '<!--删除模板 end-->', 2); if (lCase($GLOBALS['cfg_webtemplate']) == lCase($templatePath)) { $templateName = '<font color=red>' . $templateName . '</font>'; $templatePath2 = '<font color=red>' . $templatePath2 . '</font>'; $s = replace(replace($s, $s1, ''), $s3, ''); } else { $s = replace($s, $s2, ''); } $s = replaceValueParam($s, 'templatename', $templateName); $s = replaceValueParam($s, 'templatepath', $templatePath); $s = replaceValueParam($s, 'templatepath2', $templatePath2); $c = $c . $s . vbCrlf(); } } } } $content = replace($content, '[list]' . $defaultList . '[/list]', $c); $displayTemplatesList = $content; return @$displayTemplatesList; }
function getDetailList($action, $content, $actionName, $lableTitle, $fieldNameList, $nPageSize, $nPage, $addSql) { $GLOBALS['conn='] = OpenConn(); $defaultStr = ''; $i = ''; $s = ''; $c = ''; $tableName = ''; $j = ''; $splxx = ''; $sql = ''; $x = ''; $url = ''; $nCount = ''; $pageInfo = ''; $modI = ''; $startStr = ''; $endStr = ''; $fieldName = ''; //字段名称 $splFieldName = ''; //分割字段 $replaceStr = ''; //替换字符 $tableName = lCase($actionName); //表名称 $listFileName = ''; //列表文件名称 $listFileName = RParam($action, 'listFileName'); $abcolorStr = ''; //A加粗和颜色 $atargetStr = ''; //A链接打开方式 $atitleStr = ''; //A链接的title20160407 $anofollowStr = ''; //A链接的nofollow $id = ''; $idPage = ''; $id = rq('id'); checkIDSQL(@$_REQUEST['id']); if ($fieldNameList == '*') { $fieldNameList = getHandleFieldList($GLOBALS['db_PREFIX'] . $tableName, '字段列表'); } $fieldNameList = specialStrReplace($fieldNameList); //特殊字符处理 $splFieldName = aspSplit($fieldNameList, ','); //字段分割成数组 $defaultStr = getStrCut($content, '<!--#body start#-->', '<!--#body end#-->', 2); $pageInfo = getStrCut($content, '[page]', '[/page]', 1); if ($pageInfo != '') { $content = replace($content, $pageInfo, ''); } //call eerr("pageInfo",pageInfo) $sql = 'select * from ' . $GLOBALS['db_PREFIX'] . $tableName . ' ' . $addSql; //检测SQL if (checkSql($sql) == false) { errorLog('出错提示:<br>sql=' . $sql . '<br>'); return ''; } $rsObj = $GLOBALS['conn']->query($sql); $rs = mysql_fetch_array($rsObj); $nCount = @mysql_num_rows($rsObj); //为动态翻页网址 if ($GLOBALS['isMakeHtml'] == true) { $url = ''; if (len($listFileName) > 5) { $url = mid($listFileName, 1, len($listFileName) - 5) . '[id].html'; $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url); } } else { $url = getUrlAddToParam(getUrl(), '?page=[id]', 'replace'); } $content = replace($content, '[$pageInfo$]', webPageControl($nCount, $nPageSize, $nPage, $url, $pageInfo)); 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); $rs = mysql_fetch_array($rsObj); $x = @mysql_num_rows($rsObj); } //call echo("sql",sql) for ($i = 1; $i <= $x; $i++) { $rs = mysql_fetch_array($rsObj); //给PHP用,因为在 asptophp转换不完善 $startStr = '[list-' . $i . ']'; $endStr = '[/list-' . $i . ']'; //在最后时排序当前交点20160202 if ($i == $x) { $startStr = '[list-end]'; $endStr = '[/list-end]'; } //例[list-mod2] [/list-mod2] 20150112 for ($modI = 6; $modI >= 2; $modI--) { if (inStr($defaultStr, $startStr) == false && $i % $modI == 0) { $startStr = '[list-mod' . $modI . ']'; $endStr = '[/list-mod' . $modI . ']'; if (inStr($defaultStr, $startStr) > 0) { break; } } } //没有则用默认 if (inStr($defaultStr, $startStr) == false || $startStr == '') { $startStr = '[list]'; $endStr = '[/list]'; } if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) { $s = StrCut($defaultStr, $startStr, $endStr, 2); //s = defaultStr $s = replace($s, '[$id$]', $rs['id']); for ($j = 0; $j <= uBound($splFieldName); $j++) { if ($splFieldName[$j] != '') { $splxx = aspSplit($splFieldName[$j] . '|||', '|'); $fieldName = $splxx[0]; $replaceStr = $rs[$fieldName] . ''; $s = replaceValueParam($s, $fieldName, $replaceStr); } if ($GLOBALS['isMakeHtml'] == true) { $url = getHandleRsUrl($rs['filename'], $rs['customaurl'], '/detail/detail' . $rs['id']); } else { $url = handleWebUrl('?act=detail&id=' . $rs['id']); if ($rs['customaurl'] != '') { $url = $rs['customaurl']; } } //A链接添加颜色 $abcolorStr = ''; if (inStr($fieldNameList, ',titlecolor,') > 0) { //A链接颜色 if ($rs['titlecolor'] != '') { $abcolorStr = 'color:' . $rs['titlecolor'] . ';'; } } if (inStr($fieldNameList, ',flags,') > 0) { //A链接加粗 if (inStr($rs['flags'], '|b|') > 0) { $abcolorStr = $abcolorStr . 'font-weight:bold;'; } } if ($abcolorStr != '') { $abcolorStr = ' style="' . $abcolorStr . '"'; } //打开方式2016 if (inStr($fieldNameList, ',target,') > 0) { $atargetStr = IIF($rs['target'] != '', ' target="' . $rs['target'] . '"', ''); } //A的title if (inStr($fieldNameList, ',title,') > 0) { $atitleStr = IIF($rs['title'] != '', ' title="' . $rs['title'] . '"', ''); } //A的nofollow if (inStr($fieldNameList, ',nofollow,') > 0) { $anofollowStr = IIF($rs['nofollow'] != 0, ' rel="nofollow"', ''); } $s = replaceValueParam($s, 'url', $url); $s = replaceValueParam($s, 'abcolor', $abcolorStr); //A链接加颜色与加粗 $s = replaceValueParam($s, 'atitle', $atitleStr); //A链接title $s = replaceValueParam($s, 'anofollow', $anofollowStr); //A链接nofollow $s = replaceValueParam($s, 'atarget', $atargetStr); //A链接打开方式 } } //call echo("tableName",tableName) $idPage = getThisIdPage($GLOBALS['db_PREFIX'] . $tableName, $rs['id'], 10); //【留言】 if ($tableName == 'guestbook') { $url = WEB_ADMINURL . '?act=addEditHandle&actionType=GuestBook&lableTitle=留言&nPageSize=10&parentid=&searchfield=bodycontent&keyword=&addsql=&page=' . $idPage . '&id=' . $rs['id'] . '&n=' . getRnd(11); //【默认显示文章】 } else { $url = WEB_ADMINURL . '?act=addEditHandle&actionType=ArticleDetail&lableTitle=分类信息&nPageSize=10&page=' . $idPage . '&parentid=' . $rs['parentid'] . '&id=' . $rs['id'] . '&n=' . getRnd(11); } $s = handleDisplayOnlineEditDialog($url, $s, '', 'div|li|span'); $c = $c . $s; } $content = replace($content, '<!--#body start#-->' . $defaultStr . '<!--#body end#-->', $c); if ($GLOBALS['isMakeHtml'] == true) { $url = ''; if (len($listFileName) > 5) { $url = mid($listFileName, 1, len($listFileName) - 5) . '[id].html'; $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url); } } else { $url = getUrlAddToParam(getUrl(), '?page=[id]', 'replace'); } $getDetailList = $content; return @$getDetailList; }
function webPageControl($nRecrodCount, $nPageSize, $nPage, $configPageUrl, $action) { $c = ''; $nCountPage = ''; $i = ''; $nDisplay = ''; $nDispalyOK = ''; $nTemp = ''; $cPages = ''; $url = ''; $selStr = ''; $previousPage = ''; $nextPage = ''; //定义上一页,下一页 $isDisplayTip = ''; //是否显示提示翻页信息 $isDisplayTip = true; $sPageStart = ''; $sPageEnd = ''; $sHomePage = ''; $sHomePageFocus = ''; $sUpPage = ''; $sUpPageFocus = ''; $sNextPage = ''; $sNextPageFocus = ''; $sForPage = ''; $sForPageFocus = ''; $sTailPage = ''; $sTailPageFocus = ''; if ($action != '') { $sPageStart = getStrCut($action, '[sPageStart]', '[/sPageStart]', 2); //页头部分 $sPageEnd = getStrCut($action, '[sPageEnd]', '[/sPageEnd]', 2); //页尾部分 $sHomePage = getStrCut($action, '[sHomePage]', '[/sHomePage]', 2); //首页 $sHomePageFocus = getStrCut($action, '[sHomePageFocus]', '[/sHomePageFocus]', 2); //首页交点 $sUpPage = getStrCut($action, '[sUpPage]', '[/sUpPage]', 2); //上一页 $sUpPageFocus = getStrCut($action, '[sUpPageFocus]', '[/sUpPageFocus]', 2); //上一页交点 $sNextPage = getStrCut($action, '[sNextPage]', '[/sNextPage]', 2); //下一页 $sNextPageFocus = getStrCut($action, '[sNextPageFocus]', '[/sNextPageFocus]', 2); //下一页交点 $sForPage = getStrCut($action, '[sForPage]', '[/sForPage]', 2); //循环页 $sForPageFocus = getStrCut($action, '[sForPageFocus]', '[/sForPageFocus]', 2); //循环页交点 $sTailPage = getStrCut($action, '[sTailPage]', '[/sTailPage]', 2); //最后页 $sTailPageFocus = getStrCut($action, '[sTailPageFocus]', '[/sTailPageFocus]', 2); //最后页交点 } //页头部分 if ($sPageStart == '') { $sPageStart = '<ul class="pagecontrolwrap">' . vbCrlf() . '<li class="pageinfo">共[$nRecrodCount$]条 [$nPage$]/[$nCountPage$]页</li>' . vbCrlf(); } //页尾部分 if ($sPageEnd == '') { $sPageEnd = '</ul><div class="clear"></div>' . vbCrlf(); } //首页 if ($sHomePage == '') { $sHomePage = '<li><a href="[$url$]">首页</a></li>' . vbCrlf(); } //首页交点 if ($sHomePageFocus == '') { $sHomePageFocus = '<li class="pageli">首页</li>' . vbCrlf(); } //上一页 if ($sUpPage == '') { $sUpPage = '<li><a href="[$url$]">上一页</a></li>' . vbCrlf(); } //上一页交点 if ($sUpPageFocus == '') { $sUpPageFocus = '<li class="pageli">上一页</li>' . vbCrlf(); } //下一页 if ($sNextPage == '') { $sNextPage = '<li><a href="[$url$]">下一页</a></li>' . vbCrlf(); } //下一页交点 if ($sNextPageFocus == '') { $sNextPageFocus = '<li class="pageli">下一页</li>' . vbCrlf(); } //循环页 if ($sForPage == '') { $sForPage = '<li class="pagefocus">[$i$]</li>' . vbCrlf(); } //循环页交点 if ($sForPageFocus == '') { $sForPageFocus = '<li><a href="[$url$]">[$i$]</a></li>' . vbCrlf(); } //最后页 if ($sTailPage == '') { $sTailPage = '<li><a href="[$url$]">末页</a></li>' . vbCrlf(); } //最后页交点 if ($sTailPageFocus == '') { $sTailPageFocus = '<li class="pageli">末页</li>' . vbCrlf(); } //测试时用到20160630 if (1 == 2) { $c = '[sPageStart]' . vbCrlf() . $sPageStart . '[/sPageStart]' . vbCrlf() . vbCrlf(); $c = $c . '[sHomePage]' . vbCrlf() . $sHomePage . '[/sHomePage]' . vbCrlf() . vbCrlf(); $c = $c . '[sHomePageFocus]' . vbCrlf() . $sHomePageFocus . '[/sHomePageFocus]' . vbCrlf() . vbCrlf(); $c = $c . '[sUpPage]' . vbCrlf() . $sUpPage . '[/sUpPage]' . vbCrlf() . vbCrlf(); $c = $c . '[sUpPageFocus]' . vbCrlf() . $sUpPageFocus . vbCrlf() . '[/sUpPageFocus]' . vbCrlf(); $c = $c . '[sForPage]' . vbCrlf() . $sForPage . '[/sForPage]' . vbCrlf() . vbCrlf(); $c = $c . '[sForPageFocus]' . vbCrlf() . $sForPageFocus . '[/sForPageFocus]' . vbCrlf() . vbCrlf(); $c = $c . '[sNextPage]' . vbCrlf() . $sNextPage . '[/sNextPage]' . vbCrlf() . vbCrlf(); $c = $c . '[sNextPageFocus]' . vbCrlf() . $sNextPageFocus . '[/sNextPageFocus]' . vbCrlf() . vbCrlf(); $c = $c . '[sTailPage]' . vbCrlf() . $sTailPage . '[/sTailPage]' . vbCrlf() . vbCrlf(); $c = $c . '[sTailPageFocus]' . vbCrlf() . $sTailPageFocus . '[/sTailPageFocus]' . vbCrlf() . vbCrlf(); $c = $c . '[sPageEnd]' . vbCrlf() . $sPageEnd . '[/sPageEnd]' . vbCrlf(); rwEnd('[page]' . vbCrlf() . vbCrlf() . $c . vbCrlf() . '[/page]'); } //配置页为空则 if ($configPageUrl == '') { $configPageUrl = getUrlAddToParam(getUrl(), '?page=[id]', 'replace'); } $nDisplay = 6; //显示数 $nDispalyOK = 0; //显示成功数 $nPage = handleNumberType($nPage); if ($nPage == '') { $nPage = 1; } else { $nPage = CInt($nPage); } //获得总页数 $nCountPage = GetCountPage($nRecrodCount, $nPageSize); $previousPage = $nPage - 1; $nextPage = $nPage + 1; //处理上一页 if ($previousPage <= 0) { $previousPage = ''; } //处理下一页 if ($nextPage > $nCountPage) { $nextPage = ''; } //页开始 $c = $sPageStart; //首页 if ($nPage > 1) { $c = $c . replace($sHomePage, '[$url$]', replace($configPageUrl, '[id]', '')); } else { if ($isDisplayTip == true) { $c = $c . $sHomePageFocus; } } //上一页 if ($previousPage != '') { $nTemp = $previousPage; if ($previousPage <= 1) { $nTemp = ''; } $c = $c . replace($sUpPage, '[$url$]', replace($configPageUrl, '[id]', $nTemp)); } else { if ($isDisplayTip == true) { $c = $c . $sUpPageFocus; } } $n = ''; //call echo(npage,ncountpage) $n = $nPage - 3; //call echo("n",n) //翻页循环 for ($i = $n; $i <= $nCountPage; $i++) { if ($i >= 1) { $nDispalyOK = $nDispalyOK + 1; //call echo(i,nPage) if ($i == $nPage) { $c = $c . replace($sForPage, '[$i$]', $i); } else { $nTemp = $i; if ($i <= 1) { $nTemp = ''; } $c = $c . replace(replace($sForPageFocus, '[$url$]', replace($configPageUrl, '[id]', $nTemp)), '[$i$]', $i); } if ($nDispalyOK > $nDisplay) { break; } } } //下一页 if ($nCountPage > $nPage) { $c = $c . replace($sNextPage, '[$url$]', replace($configPageUrl, '[id]', $nextPage)); } else { if ($isDisplayTip == true) { $c = $c . $sNextPageFocus; } } //末页 if ($nCountPage > $nPage) { $c = $c . replace($sTailPage, '[$url$]', replace($configPageUrl, '[id]', $nCountPage)); } else { if ($isDisplayTip == true) { $c = $c . $sTailPageFocus; } } $c = $c . $sPageEnd; $c = replaceValueParam($c, 'nRecrodCount', $nRecrodCount); $c = replaceValueParam($c, 'nPage', $nPage); if ($nCountPage == '0') { $nCountPage = 1; } $c = replaceValueParam($c, 'nCountPage', $nCountPage); if (inStr($c, '[$page-select-openlist$]') > 0) { for ($i = 1; $i <= $nCountPage; $i++) { $url = replace($configPageUrl, '[id]', $i); $selStr = ''; if ($i == $nPage) { $selStr = ' selected'; } $cPages = $cPages . '<option value="' . $url . '"' . $selStr . '>' . $i . '</option>' . vbCrlf(); } $c = replace($c, '[$page-select-openlist$]', $cPages); } $webPageControl = $c . vbCrlf(); return @$webPageControl; }
function handleReplaceValueParam($content, $paramName, $replaceStr) { if (inStr($content, '[$' . $paramName) == false) { $paramName = lCase($paramName); } $handleReplaceValueParam = replaceValueParam($content, $paramName, $replaceStr); return @$handleReplaceValueParam; }