function newReplaceValueParam($content, $paramName, $replaceStr) { $startStr = ''; $endStr = ''; $labelStr = ''; $nLen = ''; $nTimeFormat = ''; $delHtmlYes = ''; $trimYes = ''; //ReplaceStr = ReplaceStr & "这里面放上内容在这时碳呀。" //ReplaceStr = CStr(ReplaceStr) '转成字符类型 if (isNul($replaceStr) == true) { $replaceStr = ''; } $startStr = '[$' . $paramName; $endStr = '$]'; if (inStr($content, $startStr) > 0 && inStr($content, $endStr) > 0) { $labelStr = StrCut($content, $startStr, $endStr, 1); //删除Html $delHtmlYes = rParam($labelStr, 'DelHtml'); //是否删除Html if ($delHtmlYes == 'true') { $replaceStr = replace(delHtml($replaceStr), '<', '<'); } //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); } $content = replace($content, $labelStr, $replaceStr); } $newReplaceValueParam = $content; return @$newReplaceValueParam; }
function getCaiSortCountPage($content) { $i = ''; $s = ''; $getCaiSortCountPage = ''; $content = delHtml($content); $content = handleNumber($content); for ($i = 1; $i <= 30; $i++) { $s = mid($content, 1, len($i)); if ($s == cStr($i)) { $getCaiSortCountPage = $i; //Call Echo(i,s) $content = right($content, len($content) - len($i)); } } return @$getCaiSortCountPage; }
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), '<', '<'); } //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; }
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), '<', '<'); } //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; }