Пример #1
0
function XY_AP_ColumnMenu($action)
{
    $defaultStr = '';
    $thisId = '';
    $parentid = '';
    $c = '';
    $parentid = aspTrim(RParam($action, 'parentid'));
    $parentid = getColumnId($parentid);
    if ($parentid == '') {
        $parentid = -1;
    }
    $thisId = $GLOBALS['glb_columnId'];
    if ($thisId == '') {
        $thisId = -1;
    }
    $defaultStr = getDefaultValue($action);
    //获得默认内容
    $defaultStr = $defaultStr . '[topnav]' . $parentid . '[/topnav]';
    $XY_AP_ColumnMenu = showColumnList($parentid, 'webcolumn', 'columnname', $thisId, 0, $defaultStr);
    return @$XY_AP_ColumnMenu;
}
Пример #2
0
function addEditDisplay($actionName, $lableTitle, $fieldNameList)
{
    $content = '';
    $addOrEdit = '';
    $splxx = '';
    $i = '';
    $j = '';
    $s = '';
    $c = '';
    $tableName = '';
    $url = '';
    $aStr = '';
    $fieldName = '';
    //字段名称
    $splFieldName = '';
    //分割字段
    $fieldSetType = '';
    //字段设置类型
    $fieldValue = '';
    //字段值
    $sql = '';
    //sql语句
    $defaultList = '';
    //默认列表
    $flagsInputName = '';
    //旗input名称给ArticleDetail用
    $titlecolor = '';
    //标题颜色
    $flags = '';
    //旗
    $splStr = '';
    $fieldConfig = '';
    $defaultFieldValue = '';
    $postUrl = '';
    $subTableName = '';
    $subFileName = '';
    //子列表的表名称,子列表字段名称
    $templateListStr = '';
    $listStr = '';
    $listS = '';
    $listC = '';
    $id = '';
    $id = rq('id');
    $addOrEdit = '添加';
    if ($id != '') {
        $addOrEdit = '修改';
    }
    if (inStr(',Admin,', ',' . $actionName . ',') > 0 && $id == @$_SESSION['adminId'] . '') {
        handlePower('修改自身');
        //管理权限处理
    } else {
        handlePower('显示' . $lableTitle);
        //管理权限处理
    }
    $fieldNameList = ',' . specialStrReplace($fieldNameList) . ',';
    //特殊字符处理 自定义字段列表
    $tableName = lCase($actionName);
    //表名称
    $systemFieldList = '';
    //表字段列表
    $systemFieldList = getHandleFieldList($GLOBALS['db_PREFIX'] . $tableName, '字段配置列表');
    $splStr = aspSplit($systemFieldList, ',');
    //读模板
    $content = getTemplateContent('addEdit_' . $tableName . '.html');
    //关闭编辑器
    if (inStr($GLOBALS['cfg_flags'], '|iscloseeditor|') > 0) {
        $s = getStrCut($content, '<!--#editor start#-->', '<!--#editor end#-->', 1);
        if ($s != '') {
            $content = replace($content, $s, '');
        }
    }
    //id=*  是给网站配置使用的,因为它没有管理列表,直接进入修改界面
    if ($id == '*') {
        $sql = 'select * from ' . $GLOBALS['db_PREFIX'] . '' . $tableName;
    } else {
        $sql = 'select * from ' . $GLOBALS['db_PREFIX'] . '' . $tableName . ' where id=' . $id;
    }
    if ($id != '') {
        $rsObj = $GLOBALS['conn']->query($sql);
        if (@mysql_num_rows($rsObj) != 0) {
            $rs = mysql_fetch_array($rsObj);
            $id = $rs['id'];
        }
        //标题颜色
        if (inStr($systemFieldList, ',titlecolor|') > 0) {
            $titlecolor = $rs['titlecolor'];
        }
        //旗
        if (inStr($systemFieldList, ',flags|') > 0) {
            $flags = $rs['flags'];
        }
    }
    if (inStr(',Admin,', ',' . $actionName . ',') > 0) {
        //当修改超级管理员的时间,判断他是否有超级管理员权限
        if ($flags == '|*|') {
            handlePower('*');
            //管理权限处理
        }
        //对模板处理
        $templateListStr = getStrCut($content, '<!--template_list-->', '<!--/template_list-->', 2);
        $listStr = getStrCut($templateListStr, '<!--list-->', '<!--/list-->', 2);
        if ($listStr != '') {
            $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'ListMenu where parentId<>-1 order by sortrank asc');
            while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) {
                //call echo("",rsx("title"))
                $listS = getStrCut($content, '<!--list' . $rsx['title'] . '-->', '<!--/list' . $rsx['title'] . '-->', 2);
                if ($listS == '') {
                    $listS = $listStr;
                }
                $listS = replace($listS, '[$title$]', $rsx['title']);
                $listS = replace($listS, '[$id$]', $rsx['id']);
                $listC = $listC . $listS . vbCrlf();
            }
        }
        if ($templateListStr != '') {
            $content = replace($content, '<!--template_list-->' . $templateListStr . '<!--/template_list-->', $listC);
        }
        if ($flags == '|*|' || @$_SESSION['adminId'] == $id && @$_SESSION['adminflags'] == '|*|' && $id != '') {
            $s = getStrCut($content, '<!--普通管理员-->', '<!--普通管理员end-->', 1);
            $content = replace($content, $s, '');
            $s = getStrCut($content, '<!--用户权限-->', '<!--用户权限end-->', 1);
            $content = replace($content, $s, '');
            //call echo("","1")
            //普通管理员权限选择列表
        } else {
            if (($id != '' || $addOrEdit == '添加') && @$_SESSION['adminflags'] == '|*|') {
                $s = getStrCut($content, '<!--超级管理员-->', '<!--超级管理员end-->', 1);
                $content = replace($content, $s, '');
                $s = getStrCut($content, '<!--用户权限-->', '<!--用户权限end-->', 1);
                $content = replace($content, $s, '');
                //call echo("","2")
            } else {
                $s = getStrCut($content, '<!--超级管理员-->', '<!--超级管理员end-->', 1);
                $content = replace($content, $s, '');
                $s = getStrCut($content, '<!--普通管理员-->', '<!--普通管理员end-->', 1);
                $content = replace($content, $s, '');
                //call echo("","3")
            }
        }
    }
    foreach ($splStr as $key => $fieldConfig) {
        if ($fieldConfig != '') {
            $splxx = aspSplit($fieldConfig . '|||', '|');
            $fieldName = $splxx[0];
            //字段名称
            $fieldSetType = $splxx[1];
            //字段设置类型
            $defaultFieldValue = $splxx[2];
            //默认字段值
            //用自定义
            if (inStr($fieldNameList, ',' . $fieldName . '|') > 0) {
                $fieldConfig = mid($fieldNameList, inStr($fieldNameList, ',' . $fieldName . '|') + 1, -1);
                $fieldConfig = mid($fieldConfig, 1, inStr($fieldConfig, ',') - 1);
                $splxx = aspSplit($fieldConfig . '|||', '|');
                $fieldSetType = $splxx[1];
                //字段设置类型
                $defaultFieldValue = $splxx[2];
                //默认字段值
            }
            $fieldValue = $defaultFieldValue;
            if ($addOrEdit == '修改') {
                $fieldValue = $rs[$fieldName];
            }
            //call echo(fieldConfig,fieldValue)
            //密码类型则显示为空
            if ($fieldSetType == 'password') {
                $fieldValue = '';
            }
            if ($fieldValue != '') {
                $fieldValue = replace(replace($fieldValue, '"', '&quot;'), '<', '&lt;');
                //在input里如果直接显示"的话就会出错了
            }
            if (inStr(',ArticleDetail,WebColumn,ListMenu,', ',' . $actionName . ',') > 0 && $fieldName == 'parentid') {
                $defaultList = '[list]<option value="[$id$]"[$selected$]>[$selectcolumnname$]</option>[/list]';
                if ($addOrEdit == '添加') {
                    $fieldValue = @$_REQUEST['parentid'];
                }
                $subTableName = 'webcolumn';
                $subFileName = 'columnname';
                if ($actionName == 'ListMenu') {
                    $subTableName = 'listmenu';
                    $subFileName = 'title';
                }
                $c = '<select name="parentid" id="parentid"><option value="-1">≡ 作为一级栏目 ≡</option>' . showColumnList(-1, $subTableName, $subFileName, $fieldValue, 0, $defaultList) . vbCrlf() . '</select>';
                $content = replace($content, '[$input_parentid$]', $c);
                //上级栏目
            } else {
                if ($actionName == 'WebColumn' && $fieldName == 'columntype') {
                    $content = replace($content, '[$input_columntype$]', showSelectList('columntype', WEBCOLUMNTYPE, '|', $fieldValue));
                } else {
                    if (inStr(',ArticleDetail,WebColumn,', ',' . $actionName . ',') > 0 && $fieldName == 'flags') {
                        $flagsInputName = 'flags';
                        if (EDITORTYPE == 'php') {
                            $flagsInputName = 'flags[]';
                            //因为PHP这样才代表数组
                        }
                        if ($actionName == 'ArticleDetail') {
                            $s = inputCheckBox3($flagsInputName, IIF(inStr('|' . $fieldValue . '|', '|h|') > 0, 1, 0), 'h', '头条[h]');
                            $s = $s . inputCheckBox3($flagsInputName, IIF(inStr('|' . $fieldValue . '|', '|c|') > 0, 1, 0), 'c', '推荐[c]');
                            $s = $s . inputCheckBox3($flagsInputName, IIF(inStr('|' . $fieldValue . '|', '|f|') > 0, 1, 0), 'f', '幻灯[f]');
                            $s = $s . inputCheckBox3($flagsInputName, IIF(inStr('|' . $fieldValue . '|', '|a|') > 0, 1, 0), 'a', '特荐[a]');
                            $s = $s . inputCheckBox3($flagsInputName, IIF(inStr('|' . $fieldValue . '|', '|s|') > 0, 1, 0), 's', '滚动[s]');
                            $s = $s . replace(inputCheckBox3($flagsInputName, IIF(inStr('|' . $fieldValue . '|', '|b|') > 0, 1, 0), 'b', '加粗[b]'), '', '');
                            $s = replace($s, ' value=\'b\'>', ' onclick=\'input_font_bold()\' value=\'b\'>');
                        } else {
                            if ($actionName == 'WebColumn') {
                                $s = inputCheckBox3($flagsInputName, IIF(inStr('|' . $fieldValue . '|', '|top|') > 0, 1, 0), 'top', '顶部显示');
                                $s = $s . inputCheckBox3($flagsInputName, IIF(inStr('|' . $fieldValue . '|', '|foot|') > 0, 1, 0), 'foot', '底部显示');
                                $s = $s . inputCheckBox3($flagsInputName, IIF(inStr('|' . $fieldValue . '|', '|left|') > 0, 1, 0), 'left', '左边显示');
                                $s = $s . inputCheckBox3($flagsInputName, IIF(inStr('|' . $fieldValue . '|', '|center|') > 0, 1, 0), 'center', '中间显示');
                                $s = $s . inputCheckBox3($flagsInputName, IIF(inStr('|' . $fieldValue . '|', '|right|') > 0, 1, 0), 'right', '右边显示');
                                $s = $s . inputCheckBox3($flagsInputName, IIF(inStr('|' . $fieldValue . '|', '|other|') > 0, 1, 0), 'other', '其它位置显示');
                            }
                        }
                        $content = replace($content, '[$input_flags$]', $s);
                    } else {
                        if ($fieldSetType == 'textarea1') {
                            $content = replace($content, '[$input_' . $fieldName . '$]', handleInputHiddenTextArea($fieldName, $fieldValue, '97%', '120px', 'input-text', ''));
                        } else {
                            if ($fieldSetType == 'textarea2') {
                                $content = replace($content, '[$input_' . $fieldName . '$]', handleInputHiddenTextArea($fieldName, $fieldValue, '97%', '300px', 'input-text', ''));
                            } else {
                                if ($fieldSetType == 'textarea3') {
                                    $content = replace($content, '[$input_' . $fieldName . '$]', handleInputHiddenTextArea($fieldName, $fieldValue, '97%', '500px', 'input-text', ''));
                                } else {
                                    if ($fieldSetType == 'password') {
                                        $content = replace($content, '[$input_' . $fieldName . '$]', '<input name=\'' . $fieldName . '\' type=\'password\' id=\'' . $fieldName . '\' value=\'' . $fieldValue . '\' style=\'width:97%;\' class=\'input-text\'>');
                                    } else {
                                        if (inStr($content, '[$textarea1_' . $fieldName . '$]') > 0) {
                                            $content = replace($content, '[$textarea1_' . $fieldName . '$]', handleInputHiddenTextArea($fieldName, $fieldValue, '97%', '120px', 'input-text', ''));
                                        } else {
                                            //追加于20160717 home  等改进
                                            if (inStr($content, '[$textarea1_' . $fieldName . '$]') > 0) {
                                                $content = replace($content, '[$textarea1_' . $fieldName . '$]', handleInputHiddenTextArea($fieldName, $fieldValue, '97%', '120px', 'input-text', ''));
                                            } else {
                                                if (inStr($content, '[$textarea2_' . $fieldName . '$]') > 0) {
                                                    $content = replace($content, '[$textarea2_' . $fieldName . '$]', handleInputHiddenTextArea($fieldName, $fieldValue, '97%', '300px', 'input-text', ''));
                                                } else {
                                                    if (inStr($content, '[$textarea3_' . $fieldName . '$]') > 0) {
                                                        $content = replace($content, '[$textarea3_' . $fieldName . '$]', handleInputHiddenTextArea($fieldName, $fieldValue, '97%', '500px', 'input-text', ''));
                                                    } else {
                                                        $content = replace($content, '[$input_' . $fieldName . '$]', inputText2($fieldName, $fieldValue, '97%', 'input-text', ''));
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            $content = replaceValueParam($content, $fieldName, $fieldValue);
        }
    }
    if ($id != '') {
    }
    //call die("")
    $content = replace($content, '[$switchId$]', @$_REQUEST['switchId']);
    $url = getUrlAddToParam(getThisUrl(), '?act=dispalyManageHandle', 'replace');
    $url = getUrlAddToParam($url, '?focusid=' . $id, 'replace');
    //call echo(getThisUrl(),url)
    if (inStr('|WebSite|', '|' . $actionName . '|') == false) {
        $aStr = '<a href=\'' . $url . '\'>' . $lableTitle . '列表</a> > ';
    }
    $content = replaceValueParam($content, 'position', '系统管理 > ' . $aStr . $addOrEdit . '信息');
    $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 = replace($content, '{$EDITORTYPE$}', EDITORTYPE);
    //asp与phh
    $content = replace($content, '{$WEB_VIEWURL$}', WEB_VIEWURL);
    //前端浏览网址
    $content = replace($content, '{$Web_Title$}', $GLOBALS['cfg_webTitle']);
    $postUrl = getUrlAddToParam(getThisUrl(), '?act=saveAddEditHandle&id=' . $id, 'replace');
    $content = replaceValueParam($content, 'postUrl', $postUrl);
    //20160113
    if (EDITORTYPE == 'asp') {
        $content = replace($content, '[$phpArray$]', '');
    } else {
        if (EDITORTYPE == 'php') {
            $content = replace($content, '[$phpArray$]', '[]');
        }
    }
    $content = handleDisplayLanguage($content, 'handleDisplayLanguage');
    //语言处理
    Rw($content);
}