Example #1
0
function handleGetSetFileParameValue($ConfigPath, $paramName, $valueStr, $sType)
{
    $content = '';
    $startStr = '';
    $endStr = '';
    $YunStr = '';
    $replaceStr = '';
    //文件为假时,创建一个空文件看看,如果不能创建这个文件则说明这个文件地址有问题,则退出20150324
    if (CheckFile($ConfigPath) == false) {
        createFile($ConfigPath, '');
    }
    if (CheckFile($ConfigPath) == false) {
        return '';
    }
    //文件不存在则退出
    $content = TrimVbCrlf(getFText($ConfigPath));
    $startStr = vbCrlf() . $paramName . '=';
    $endStr = vbCrlf();
    $replaceStr = vbCrlf() . $paramName . '=' . $valueStr . vbCrlf();
    if (inStr(vbCrlf() . $content, $startStr) > 0 && inStr($content . vbCrlf(), $endStr) > 0) {
        $YunStr = StrCut(vbCrlf() . $content . vbCrlf(), $startStr, $endStr, 2);
        if ($sType == '获得') {
            $handleGetSetFileParameValue = $YunStr;
            return @$handleGetSetFileParameValue;
        }
        $YunStr = $startStr . $YunStr . $endStr;
        $content = replace(vbCrlf() . $content . vbCrlf(), $YunStr, $replaceStr);
        createFile($ConfigPath, $content);
    } else {
        createFile($ConfigPath, $content . vbCrlf() . TrimVbCrlf($replaceStr));
    }
    return @$handleGetSetFileParameValue;
}
Example #2
0
function handleHtmlFormatting($content, $isMsgBox, $nErrLevel, $action)
{
    $splStr = '';
    $s = '';
    $tempS = '';
    $lCaseS = '';
    $c = '';
    $left4Str = '';
    $left5Str = '';
    $left6Str = '';
    $left7Str = '';
    $left8Str = '';
    $nLevel = '';
    //级别
    $elseS = '';
    $elseLable = '';
    $levelArray = aspArray(299);
    $keyWord = '';
    $lableName = '';
    //标签名称
    $isJavascript = '';
    //为javascript
    $isTextarea = '';
    //为表单文本域<textarea
    $isPre = '';
    //为pre
    $isJavascript = false;
    //默认javascript为假
    $isTextarea = false;
    //表单文件域为假
    $isPre = false;
    //默认pre为假
    $nLevel = 0;
    //级别数
    $action = '|' . $action . '|';
    //动作
    $splStr = aspSplit($content, vbCrlf());
    foreach ($splStr as $key => $s) {
        $tempS = $s;
        $elseS = $s;
        $s = TrimVbCrlf($s);
        $lCaseS = lCase($s);
        //判断于20150710
        if ((left($lCaseS, 8) == '<script ' || left($lCaseS, 8) == '<script>') && inStr($s, '</script>') == false && $isJavascript == false) {
            $isJavascript = true;
            $c = $c . PHPTrim($tempS) . vbCrlf();
        } else {
            if ($isJavascript == true) {
                if (left($lCaseS, 9) == '</script>') {
                    $isJavascript = false;
                    $c = $c . PHPTrim($tempS) . vbCrlf();
                    //最后清除两边空格
                } else {
                    $c = $c . $tempS . vbCrlf();
                    //为js则显示原文本  不处理清空两边空格phptrim(tempS)
                }
                //表单文本域判断于20151019
            } else {
                if ((left($lCaseS, 10) == '<textarea ' || left($lCaseS, 10) == '<textarea>') && inStr($s, '</textarea>') == false && $isTextarea == false) {
                    $isTextarea = true;
                    $c = $c . PHPTrim($tempS) . vbCrlf();
                } else {
                    if ($isTextarea == true) {
                        $c = $c . PHPTrim($tempS) . vbCrlf();
                        if (left($lCaseS, 11) == '</textarea>') {
                            $isTextarea = false;
                        }
                        //表单文本域判断于20151019
                    } else {
                        if ((left($lCaseS, 5) == '<pre ' || left($lCaseS, 5) == '<pre>') && inStr($s, '</pre>') == false && $isPre == false) {
                            $isPre = true;
                            $c = $c . PHPTrim($tempS) . vbCrlf();
                        } else {
                            if ($isPre == true) {
                                $c = $c . $tempS . vbCrlf();
                                if (left($lCaseS, 6) == '</pre>') {
                                    $isPre = false;
                                }
                            } else {
                                if ($s != '' && $isJavascript == false && $isTextarea == false) {
                                    $left4Str = '|' . left($lCaseS, 4) . '|';
                                    $left5Str = '|' . left($lCaseS, 5) . '|';
                                    $left6Str = '|' . left($lCaseS, 6) . '|';
                                    $left7Str = '|' . left($lCaseS, 7) . '|';
                                    $left8Str = '|' . left($lCaseS, 8) . '|';
                                    $keyWord = '';
                                    //关键词初始清空
                                    $lableName = '';
                                    //标签名称
                                    if (inStr('|<ul>|<ul |<li>|<li |<dt>|<dt |<dl>|<dl |<dd>|<dd |<tr>|<tr |<td>|<td |', $left4Str) > 0) {
                                        $keyWord = $left4Str;
                                        $lableName = mid($left4Str, 3, 2);
                                    } else {
                                        if (inStr('|<div>|<div |', $left5Str) > 0) {
                                            $keyWord = $left5Str;
                                            $lableName = mid($left5Str, 3, 3);
                                        } else {
                                            if (inStr('|<span>|<span |<form>|<form |', $left6Str) > 0) {
                                                $keyWord = $left6Str;
                                                $lableName = mid($left6Str, 3, 4);
                                            } else {
                                                if (inStr('|<table>|<table |<tbody>|<tbody |', $left7Str) > 0) {
                                                    $keyWord = $left7Str;
                                                    $lableName = mid($left7Str, 3, 5);
                                                } else {
                                                    if (inStr('|<center>|<center |', $left8Str) > 0) {
                                                        $keyWord = $left8Str;
                                                        $lableName = mid($left8Str, 3, 6);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    $keyWord = aspTrim(replace(replace($keyWord, '<', ''), '>', ''));
                                    //call echo(KeyWord,lableName)
                                    //开始
                                    if ($keyWord != '') {
                                        $s = copyStr('    ', $nLevel) . $s;
                                        if (right($lCaseS, 3 + len($lableName)) != '</' . $lableName . '>' && inStr($lCaseS, '</' . $lableName . '>') == false) {
                                            $nLevel = $nLevel + 1;
                                            if ($nLevel >= 0) {
                                                $levelArray[$nLevel] = $keyWord;
                                            }
                                        }
                                    } else {
                                        if (inStr('|</ul>|</li>|</dl>|</dt>|</dd>|</tr>|</td>|', '|' . left($lCaseS, 5) . '|') > 0 || inStr('|</div>|', '|' . left($lCaseS, 6) . '|') > 0 || inStr('|</span>|</form>|', '|' . left($lCaseS, 7) . '|') > 0 || inStr('|</table>|</tbody>|', '|' . left($lCaseS, 8) . '|') > 0 || inStr('|</center>|', '|' . left($lCaseS, 9) . '|') > 0) {
                                            $nLevel = $nLevel - 1;
                                            $s = copyStr('    ', $nLevel) . $s;
                                        } else {
                                            $s = copyStr('    ', $nLevel) . $s;
                                            //最后是结束标签则减一级
                                            if (right($lCaseS, 6) == '</div>') {
                                                if (checkHtmlFormatting($lCaseS) == false) {
                                                    $s = left($s, len($s) - 6);
                                                    $nLevel = $nLevel - 1;
                                                    $s = $s . vbCrlf() . copyStr('    ', $nLevel) . '</div>';
                                                }
                                            } else {
                                                if (right($lCaseS, 7) == '</span>') {
                                                    if (checkHtmlFormatting($lCaseS) == false) {
                                                        $s = left($s, len($s) - 7);
                                                        $nLevel = $nLevel - 1;
                                                        $s = $s . vbCrlf() . copyStr('    ', $nLevel) . '</span>';
                                                    }
                                                } else {
                                                    if (inStr('|</ul>|</dt>|<dl>|<dd>|', $left5Str) > 0) {
                                                        $s = left($s, len($s) - 5);
                                                        $nLevel = $nLevel - 1;
                                                        $s = $s . vbCrlf() . copyStr('    ', $nLevel) . right($lCaseS, 5);
                                                    }
                                                }
                                            }
                                            //对   aaa</li>   这种进处理   20160106
                                            $elseS = PHPTrim(lCase($elseS));
                                            if (inStr($elseS, '</') > 0) {
                                                $elseLable = mid($elseS, inStr($elseS, '</'), -1);
                                                if (inStr('|</ul>|</li>|</dl>|</dt>|</dd>|</tr>|</td>|</div>|</span>|<form>|', '|' . $elseLable . '|') > 0 && $nLevel > 0) {
                                                    $nLevel = $nLevel - 1;
                                                }
                                            }
                                            //call echo("s",replace(s,"<","&lt;"))
                                        }
                                    }
                                    //call echo("",ShowHtml(temps)
                                    $c = $c . $s . vbCrlf();
                                } else {
                                    if ($s == '') {
                                        if (inStr($action, '|delblankline|') == false && inStr($action, '|删除空行|') == false) {
                                            //删除空行
                                            $c = $c . vbCrlf();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    $handleHtmlFormatting = $c;
    $nErrLevel = $nLevel;
    //获得错误级别
    if ($nLevel != 0 && (lCase($isMsgBox) == '1' || lCase($isMsgBox) == 'true')) {
        aspEcho('HTML标签有错误', $nLevel);
    }
    //Call Echo("nLevel",nLevel & "," & levelArray(nLevel))                '显示错误标题20150212
    return @$handleHtmlFormatting;
}
Example #3
0
function addIndent($content, $IndentStr)
{
    $splStr = '';
    $s = '';
    $c = '';
    $c = '';
    $splStr = aspSplit($content, vbCrlf());
    foreach ($splStr as $key => $s) {
        $c = $c . $IndentStr . $s . vbCrlf();
    }
    $addIndent = TrimVbCrlf($c);
    return @$addIndent;
}
Example #4
0
function XY_handleGetTableBody($action, $tableName, $fieldParamName, $defaultFileName, $adminUrl)
{
    $url = '';
    $content = '';
    $id = '';
    $sql = '';
    $addSql = '';
    $fieldName = '';
    $fieldParamValue = '';
    $fieldNameList = '';
    $nLen = '';
    $delHtmlYes = '';
    $trimYes = '';
    $defaultStr = '';
    $noisonhtml = '';
    $intoFieldStr = '';
    $valuesStr = '';
    $nonull = '';
    $fieldName = RParam($action, 'fieldname');
    //字段名称
    $noisonhtml = RParam($action, 'noisonhtml');
    //不生成html
    $nonull = RParam($action, 'noisonhtml');
    //内容不能为空20160716 home
    if ($noisonhtml == 'true') {
        $intoFieldStr = ',isonhtml';
        $valuesStr = ',0';
    }
    $fieldNameList = getHandleFieldList($GLOBALS['db_PREFIX'] . $tableName, '字段列表');
    //字段名称不为空,并且要在表字段里
    if ($fieldName == '' || inStr($fieldNameList, ',' . $fieldName . ',') == false) {
        $fieldName = $defaultFileName;
    }
    $fieldName = lCase($fieldName);
    //转为小写,因为在PHP里是全小写的
    $fieldParamValue = RParam($action, $fieldParamName);
    //截取字段内容
    $id = handleNumber(RParam($action, 'id'));
    //获得ID
    $addSql = ' where ' . $fieldParamName . '=\'' . $fieldParamValue . '\'';
    if ($id != '') {
        $addSql = ' where id=' . $id;
    }
    $content = getDefaultValue($action);
    $defaultStr = $content;
    //获得默认内容
    $sql = 'select * from ' . $GLOBALS['db_PREFIX'] . $tableName . $addSql;
    $rsObj = $GLOBALS['conn']->query($sql);
    if (@mysql_num_rows($rsObj) == 0) {
        $rs = mysql_fetch_array($rsObj);
        //自动添加 20160113
        if (RParam($action, 'autoadd') == 'true') {
            connexecute('insert into ' . $GLOBALS['db_PREFIX'] . $tableName . ' (' . $fieldParamName . ',' . $fieldName . $intoFieldStr . ') values(\'' . $fieldParamValue . '\',\'' . ADSql($content) . '\'' . $valuesStr . ')');
        }
    } else {
        $id = $rs['id'];
        $content = $rs[$fieldName];
        if (len($content) <= 0) {
            $content = $defaultStr;
            connexecute('update ' . $GLOBALS['db_PREFIX'] . $tableName . ' set ' . $fieldName . '=\'' . $content . '\' where id=' . $rs['id']);
        }
    }
    //删除Html
    $delHtmlYes = RParam($action, 'delHtml');
    //是否删除Html
    if ($delHtmlYes == 'true') {
        $content = replace(delHtml($content), '<', '&lt;');
    }
    //HTML处理
    //删除两边空格
    $trimYes = RParam($action, 'trim');
    //是否删除两边空格
    if ($trimYes == 'true') {
        $content = TrimVbCrlf($content);
    }
    //截取字符处理
    $nLen = RParam($action, 'len');
    //字符长度值
    $nLen = handleNumber($nLen);
    //If nLen<>"" Then ReplaceStr = CutStr(ReplaceStr,nLen,"null")' Left(ReplaceStr,nLen)
    if ($nLen != '') {
        $content = CutStr($content, $nLen, '...');
    }
    //Left(ReplaceStr,nLen)
    if ($id == '') {
        $id = XY_AP_GetFieldValue('', $sql, 'id');
    }
    $url = $adminUrl . '&id=' . $id . '&n=' . getRnd(11);
    if (@$_REQUEST['gl'] == 'edit') {
        $content = '<span>' . $content . '</span>';
    }
    //call echo(sql,url)
    $content = handleDisplayOnlineEditDialog($url, $content, '', 'span');
    $XY_handleGetTableBody = $content;
    return @$XY_handleGetTableBody;
}
Example #5
0
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), '<', '&lt;');
            }
            //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;
}