function saveAddEdit($actionName, $lableTitle, $fieldNameList) { $tableName = ''; $url = ''; $listUrl = ''; $id = ''; $addOrEdit = ''; $sql = ''; $id = @$_REQUEST['id']; $addOrEdit = IIF($id == '', '添加', '修改'); handlePower($addOrEdit . $lableTitle); //管理权限处理 $GLOBALS['conn='] = OpenConn(); $fieldNameList = ',' . specialStrReplace($fieldNameList) . ','; //特殊字符处理 自定义字段列表 $tableName = lCase($actionName); //表名称 $sql = getPostSql($id, $tableName, $fieldNameList); //call eerr("sql",sql) '调试用 //检测SQL if (checkSql($sql) == false) { errorLog('出错提示:<hr>sql=' . $sql . '<br>'); return ''; } //conn.Execute(sql) '检测SQL时已经处理了,不需要再执行了 //对网站配置单独处理,为动态运行时删除,index.html 动,静,切换20160216 if (lCase($actionName) == 'website') { if (inStr(@$_REQUEST['flags'], 'htmlrun') == false) { DeleteFile('../index.html'); } } $listUrl = getUrlAddToParam(getThisUrl(), '?act=dispalyManageHandle', 'replace'); $listUrl = getUrlAddToParam($listUrl, '?focusid=' . $id, 'replace'); //添加 if ($id == '') { $url = getUrlAddToParam(getThisUrl(), '?act=addEditHandle', 'replace'); $url = getUrlAddToParam($url, '?focusid=' . $id, 'replace'); Rw(getMsg1('数据添加成功,返回继续添加' . $lableTitle . '...<br><a href=\'' . $listUrl . '\'>返回' . $lableTitle . '列表</a>', $url)); } else { $url = getUrlAddToParam(getThisUrl(), '?act=addEditHandle&switchId=' . @$_POST['switchId'], 'replace'); $url = getUrlAddToParam($url, '?focusid=' . $id, 'replace'); //没有返回列表管理设置 if (inStr('|WebSite|', '|' . $actionName . '|') > 0) { Rw(getMsg1('数据修改成功', $url)); } else { Rw(getMsg1('数据修改成功,正在进入' . $lableTitle . '列表...<br><a href=\'' . $url . '\'>继续编辑</a>', $listUrl)); } } writeSystemLog($tableName, $addOrEdit . $lableTitle); //系统日志 }
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; }