function getColumnNames($table) { $table_col_count = getColumnCount($table); $names = array(); for ($i = 0; $i < $table_col_count; $i++) { $column_name = getColumnName($table, $i); array_push($names, $column_name); } return $names; pg_close($connection); }
?> <td class="custom"> <span><?php echo getColumnName($arHeader); ?> :</span> <?php echo $arItem["DISCOUNT_PRICE_PERCENT_FORMATED"]; ?> </td> <?php } elseif ($arHeader["id"] == "WEIGHT") { ?> <td class="custom"> <span><?php echo getColumnName($arHeader); ?> :</span> <?php echo $arItem["WEIGHT_FORMATED"]; ?> </td> <?php } else { ?> <td class="custom"> <?php if ($arHeader["id"] == "SUM") { ?> <div id="sum_<?php echo $arItem["ID"];
// not image echo $arValues["value"] . "<br/>"; } } ?> </td> <?php } else { // not array, but simple value ?> <td class="custom" style="<?php echo $columnStyle; ?> "> <span><?php echo getColumnName($arColumn); ?> :</span> <?php echo $arItem[$arColumn["id"]]; ?> </td> <?php } } } ?> </tr> <?php } ?>
$current_table = $tables_dict[$sequence_step]; $table_col_count = getColumnCount($current_table); $names = getColumnNames($current_table); $last_id = getNextId($current_table, $names[0]); $stored_id_map = array(); if (isset($_POST['iterator'])) { rebuildStoredIdMap(); } echo "\n\t\t\t<form action=\"connector.php\" method=\"post\">\n\t\t\t\t<table>"; for ($i = 0; $i < $table_col_count; $i++) { if ($i == 0) { $column_name = getColumnName($current_table, $i); $label = strval($column_name); $current_field = $i + 1; $stored_id_map[$column_name] = $last_id; echo "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>{$label}</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" name=\"field_" . $i . "\" value=\"" . $last_id . "\" />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"current_field\" value=\"" . $current_field . "\" />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"current_table\" value=\"" . $current_table . "\" />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"sequence_step\" value=\"" . $sequence_step . "\" />\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>"; } else { $column_name = getColumnName($current_table, $i); $label = strval($column_name); $current_field = $i + 1; echo "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>{$label}</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" name=\"field_{$i}\"" . prefill($label) . " />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"current_field\" value=\"" . $current_field . "\" />\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>"; } } postStoredIdMap(); echo "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan=\"2\"><input type=\"submit\" value=\"Wyślij\" id=\"submit\"/></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</form>\n\n\t\t\t<hr />"; echo '<pre>'; print_r($stored_id_map); echo '</pre>'; ?> </body> </html>
function XY_AP_GeneralList($action, $tableName, $addSql) { $title = ''; $topNumb = ''; $nTop = ''; $isB = ''; $sql = ''; $columnName = ''; $columnEnName = ''; $aboutcontent = ''; $bodyContent = ''; $showTitle = ''; $bannerImage = ''; $smallImage = ''; $bigImage = ''; $id = ''; $defaultStr = ''; $i = ''; $j = ''; $s = ''; $c = ''; $startStr = ''; $endStr = ''; $url = ''; $noFollow = ''; //不追踪 20141222 $defaultStr = getDefaultValue($action); //获得默认内容 $modI = ''; //余循环20150112 $noFollow = aspTrim(lCase(RParam($action, 'noFollow'))); //不追踪 $lableTitle = ''; //标题标题 $target = ''; //a链接打开目标方式 $adddatetime = ''; //添加时间 $isFocus = ''; $fieldNameList = ''; //字段列表 $abcolorStr = ''; //A加粗和颜色 $atargetStr = ''; //A链接打开方式 $atitleStr = ''; //A链接的title20160407 $anofollowStr = ''; //A链接的nofollow $splFieldName = ''; $fieldName = ''; $replaceStr = ''; $k = ''; $idPage = ''; $tableName = lCase($tableName); //转小写 $fieldNameList = getHandleFieldList($GLOBALS['db_PREFIX'] . $tableName, '字段列表'); $splFieldName = aspSplit($fieldNameList, ','); $topNumb = RParam($action, 'topNumb'); $nTop = $topNumb; if ($nTop != '') { $nTop = CInt($nTop); } else { $nTop = 999; } if ($sql == '') { if ($topNumb != '') { $topNumb = ' top ' . $topNumb . ' '; } $sql = 'Select ' . $topNumb . '* From ' . $GLOBALS['db_PREFIX'] . $tableName; } //追加sql if ($addSql != '') { $sql = getWhereAnd($sql, $addSql); } $sql = replaceGlobleVariable($sql); //替换全局变量 //检测SQL if (checkSql($sql) == false) { errorLog('出错提示:<br>action=' . $action . '<hr>sql=' . $sql . '<br>'); return ''; } $rsObj = $GLOBALS['conn']->query($sql); for ($i = 1; $i <= @mysql_num_rows($rsObj); $i++) { $rs = mysql_fetch_array($rsObj); $startStr = ''; $endStr = ''; //call echo(sql,i & "," & nTop) if ($i > $nTop) { break; } //#【PHP】$rs=mysql_fetch_array($rsObj); //给PHP用,因为在 asptophp转换不完善 $isFocus = false; //交点为假 $id = $rs['id']; //【导航】 if ($tableName == 'webcolumn') { if ($GLOBALS['isMakeHtml'] == true) { $url = getRsUrl($rs['filename'], $rs['customaurl'], '/nav' . $rs['id']); } else { $url = handleWebUrl('?act=nav&columnName=' . $rs['columnname']); //会追加gl等参数 if ($rs['customaurl'] != '') { $url = $rs['customaurl']; $url = replaceGlobleVariable($url); } } //全局栏目名称为空则为自动定位首页 追加(20160128) if ($GLOBALS['glb_columnName'] == '' && $rs['columntype'] == '首页') { $GLOBALS['glb_columnName'] = $rs['columnname']; } if ($rs['columnname'] == $GLOBALS['glb_columnName']) { $isFocus = true; } //【文章】 } else { if ($tableName == 'articledetail') { if ($GLOBALS['isMakeHtml'] == true) { $url = getRsUrl($rs['filename'], $rs['customaurl'], 'detail/detail' . $rs['id']); } else { $url = handleWebUrl('?act=detail&id=' . $rs['id']); //会追加gl等参数 if ($rs['customaurl'] != '') { $url = $rs['customaurl']; } } //评论 } else { if ($tableName == 'tablecomment') { } } } //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"', ''); } //交点判断(给栏目导航用的) if ($isFocus == true) { $startStr = '[list-focus]'; $endStr = '[/list-focus]'; } else { $startStr = '[list-' . $i . ']'; $endStr = '[/list-' . $i . ']'; } //在最后时排序当前交点20160202 if ($i == $topNumb && $isFocus == false) { $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 = '[list]'; $endStr = '[/list]'; } if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) { $s = StrCut($defaultStr, $startStr, $endStr, 2); $s = replaceValueParam($s, 'i', $i); //循环编号 $s = replaceValueParam($s, '编号', $i); //循环编号 $s = replaceValueParam($s, 'id', $rs['id']); //id编号 因为获得字段他不获得id $s = replaceValueParam($s, 'url', $url); //网址 $s = replaceValueParam($s, 'aurl', 'href="' . $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链接打开方式 for ($k = 0; $k <= uBound($splFieldName); $k++) { if ($splFieldName[$k] != '') { $fieldName = $splFieldName[$k]; $replaceStr = $rs[$fieldName] . ''; $s = replaceValueParam($s, $fieldName, $replaceStr); } } //开始位置加Dialog内容 $startStr = '[list-' . $i . ' startdialog]'; $endStr = '[/list-' . $i . ' startdialog]'; if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) { $s = StrCut($defaultStr, $startStr, $endStr, 2) . $s; } //结束位置加Dialog内容 $startStr = '[list-' . $i . ' enddialog]'; $endStr = '[/list-' . $i . ' enddialog]'; if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) { $s = $s . StrCut($defaultStr, $startStr, $endStr, 2); } //加控制 //【导航】 if ($tableName == 'webcolumn') { $url = WEB_ADMINURL . '?act=addEditHandle&actionType=WebColumn&lableTitle=网站栏目&nPageSize=10&page=&id=' . $rs['id'] . '&n=' . getRnd(11); //【评论】 } else { if ($tableName == 'tablecomment') { $idPage = getThisIdPage($GLOBALS['db_PREFIX'] . $tableName, $rs['id'], 10); $url = WEB_ADMINURL . '?act=addEditHandle&actionType=TableComment&lableTitle=评论&nPageSize=10&parentid=&searchfield=bodycontent&keyword=&addsql=&page=' . $idPage . '&id=' . $rs['id'] . '&n=' . getRnd(11); //【文章】 } else { if ($tableName == 'articledetail') { $idPage = getThisIdPage($GLOBALS['db_PREFIX'] . $tableName, $rs['id'], 10); $url = WEB_ADMINURL . '?act=addEditHandle&actionType=ArticleDetail&lableTitle=分类信息&nPageSize=10&page=' . $idPage . '&parentid=' . $rs['parentid'] . '&id=' . $rs['id'] . '&n=' . getRnd(11); $s = replaceValueParam($s, 'columnurl', getColumnUrl($rs['parentid'], '')); //文章对应栏目URL 20160304 $s = replaceValueParam($s, 'columnname', getColumnName($rs['parentid'])); //文章对应栏目名称 20160304 } } } $s = handleDisplayOnlineEditDialog($url, $s, '', 'div|li|span'); //处理是否添加在线修改管理器 $c = $c . $s; } } //开始内容加Dialog内容 $startStr = '[dialog start]'; $endStr = '[/dialog start]'; if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) { $c = StrCut($defaultStr, $startStr, $endStr, 2) . $c; } //结束内容加Dialog内容 $startStr = '[dialog end]'; $endStr = '[/dialog end]'; if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) { $c = $c . StrCut($defaultStr, $startStr, $endStr, 2); } $XY_AP_GeneralList = $c; return @$XY_AP_GeneralList; }
function handleCreateTable(&$schema, &$input, &$line) { if (preg_match('/^CREATE\\ TABLE\\ ([a-z]*\\.)?([a-z_]+)$/', $line, $match) == 1) { $tabName = $match[2]; // eat ( getNextLine($input); $lastcolumn = false; while ($line = getNextLine($input)) { $comment = false; while ($commentLine = getComment($line)) { $comment = $comment . "\n" . $commentLine; $line = getNextLine($input); } $column = getColumnName($line); if ($column) { $lastcolumn = $column; } if (!isset($schema[$tabName]['fields'][$lastcolumn])) { $schema[$tabName]['fields'][$lastcolumn] = array('description' => "No description for column {$lastcolumn} available, please fix"); } if ($comment) { $schema[$tabName]['fields'][$lastcolumn]['description'] = $comment; } if (getColumnType($schema[$tabName], $lastcolumn, $line)) { continue; } if (preg_match('/^\\) WITHOUT OIDS;/', $line)) { continue; } if ($uniqueconstraints = getUniqueConstraints($line)) { $keyname = $uniqueconstraints['name']; $schema[$tabName]['unique keys'][$keyname] = $uniqueconstraints['keys']; continue; } if ($primaryKey = getPrimaryKey($line)) { $schema[$tabName]['primary key'] = $primaryKey; continue; } fwrite(STDERR, "Unknown statements within CREATE TABLE: {$line}\n"); } return true; } return false; }
function resetPassword($number, $pass1, $id) { $conn = getMainConnection(); $column = getColumnName($number, $id); if ($column != NULL) { $conn = getMainConnection(); $hashed_pswd = md5($pass1); $query1 = "UPDATE student SET " . $column . " = '" . $hashed_pswd . "' WHERE ID = " . $id; $result1 = mysql_query($query1); if ($result1) { return true; } else { return false; } } else { return false; } }
function showColumnList($parentid, $tableName, $showFieldName, $thisPId, $nCount, $action) { $i = ''; $s = ''; $c = ''; $selectcolumnname = ''; $selStr = ''; $url = ''; $isFocus = ''; $sql = ''; $addSql = ''; $listLableStr = ''; $topnav = ''; $thisColumnName = ''; $navheaderStr = ''; $navfooterStr = ''; $parentid = aspTrim($parentid); $listLableStr = 'list'; $topnav = getStrCut($action, '[topnav]', '[/topnav]', 2); $thisColumnName = getColumnName($parentid); //call echo(parentid,topnav) if ($parentid != $topnav) { if (inStr($action, '[small-list') > 0) { $listLableStr = 'small-list'; } } //call echo("listLableStr",listLableStr) $fieldNameList = ''; $splFieldName = ''; $k = ''; $fieldName = ''; $replaceStr = ''; $startStr = ''; $endStr = ''; $topNumb = ''; $modI = ''; $title = ''; $subHeaderStr = ''; $subFooterStr = ''; $subHeaderStartStr = ''; $subHeaderEndStr = ''; $subFooterStartStr = ''; $subFooterEndStr = ''; $fieldNameList = getHandleFieldList($GLOBALS['db_PREFIX'] . $tableName, '字段列表'); $splFieldName = aspSplit($fieldNameList, ','); $sql = 'select * from ' . $GLOBALS['db_PREFIX'] . $tableName . ' where parentid=' . $parentid; // call echo("sql1111111111111",tableName) //处理追加SQL $startStr = '[sql-' . $nCount . ']'; $endStr = '[/sql-' . $nCount . ']'; if (inStr($action, $startStr) == false && inStr($action, $endStr) == false) { $startStr = '[sql]'; $endStr = '[/sql]'; } $addSql = getStrCut($action, $startStr, $endStr, 2); if ($addSql != '') { $sql = getWhereAnd($sql, $addSql); } $rsObj = $GLOBALS['conn']->query($sql . ' order by sortrank asc'); //call echo(sql,rs.recordcount) for ($i = 1; $i <= @mysql_num_rows($rsObj); $i++) { $rs = mysql_fetch_array($rsObj); if (@mysql_num_rows($rsObj) != 0) { $startStr = ''; $endStr = ''; $selStr = ''; $isFocus = false; if (cStr($rs['id']) == cStr($thisPId)) { $selStr = ' selected '; $isFocus = true; } //网址判断 if ($isFocus == true) { $startStr = '[' . $listLableStr . '-focus]'; $endStr = '[/' . $listLableStr . '-focus]'; } else { $startStr = '[' . $listLableStr . '-' . $thisColumnName . ']'; $endStr = '[/' . $listLableStr . '-' . $thisColumnName . ']'; if (inStr($action, $startStr) == false && inStr($action, $endStr) == false) { $startStr = '[' . $listLableStr . '-' . $i . ']'; $endStr = '[/' . $listLableStr . '-' . $i . ']'; } else { //call echo(rs("columnname"),startStr) } } //在最后时排序当前交点20160202 if ($i == $topNumb && $isFocus == false) { $startStr = '[' . $listLableStr . '-end]'; $endStr = '[/' . $listLableStr . '-end]'; } //例[list-mod2] [/list-mod2] 20150112 for ($modI = 6; $modI >= 2; $modI--) { if (inStr($action, $startStr) == false && $i % $modI == 0) { $startStr = '[' . $listLableStr . '-mod' . $modI . ']'; $endStr = '[/' . $listLableStr . '-mod' . $modI . ']'; if (inStr($action, $startStr) > 0) { break; } } } //没有则用默认 if (inStr($action, $startStr) == false && inStr($action, $endStr) == false) { $startStr = '[' . $listLableStr . ']'; $endStr = '[/' . $listLableStr . ']'; } //call rwend(action) //call echo(startStr,endStr) if (inStr($action, $startStr) > 0 && inStr($action, $endStr) > 0) { $s = StrCut($action, $startStr, $endStr, 2); $s = replaceValueParam($s, 'id', $rs['id']); $s = replaceValueParam($s, 'selected', $selStr); $selectcolumnname = $rs[$showFieldName]; $title = $selectcolumnname; if ($nCount >= 1) { $selectcolumnname = copyStr(' ', $nCount) . '├─' . $selectcolumnname; } $s = replaceValueParam($s, 'selectcolumnname', $selectcolumnname); $s = replaceValueParam($s, 'title', $title); for ($k = 0; $k <= uBound($splFieldName); $k++) { if ($splFieldName[$k] != '') { $fieldName = $splFieldName[$k]; $replaceStr = $rs[$fieldName] . ''; $s = replaceValueParam($s, $fieldName, $replaceStr); } } //url = WEB_VIEWURL & "?act=nav&columnName=" & rs(showFieldName) '以栏目名称显示列表 $url = WEB_VIEWURL . '?act=nav&id=' . $rs['id']; //以栏目ID显示列表 //自定义网址 if (aspTrim($rs['customaurl']) != '') { $url = aspTrim($rs['customaurl']); } $s = replace($s, '[$viewWeb$]', $url); $s = replaceValueParam($s, 'url', $url); //网站栏目没有page位置处理 追加于20160716 home $url = WEB_ADMINURL . '?act=addEditHandle&actionType=WebColumn&lableTitle=网站栏目&nPageSize=10&page=&id=' . $rs['id'] . '&n=' . getRnd(11); $s = handleDisplayOnlineEditDialog($url, $s, '', 'div|li|span'); //处理是否添加在线修改管理器 if (EDITORTYPE == 'php') { $s = replace($s, '[$phpArray$]', '[]'); } else { $s = replace($s, '[$phpArray$]', ''); } //s=copystr("",nCount) & rs("columnname") & "<hr>" if ($rs['parentid'] == '-1' && inStr($action, '[navheader]') > 0) { $navheaderStr = getStrCut($action, '[navheader]', '[/navheader]', 2); $navfooterStr = getStrCut($action, '[navfooter]', '[/navfooter]', 2); //call die(navfooterStr) } $c = $c . $navheaderStr . $s . vbCrlf(); $s = showColumnList($rs['id'], $tableName, $showFieldName, $thisPId, $nCount + 1, $action) . $navfooterStr; $subHeaderStartStr = '[subheader-' . $rs['columnname'] . ']'; $subHeaderEndStr = '[/subheader-' . $rs['columnname'] . ']'; if (inStr($action, $subHeaderStartStr) == false && inStr($action, $subHeaderEndStr) == false) { $subHeaderStartStr = '[subheader]'; $subHeaderEndStr = '[/subheader]'; } $subFooterStartStr = '[subfooter-' . $rs['columnname'] . ']'; $subFooterEndStr = '[/subfooter-' . $rs['columnname'] . ']'; if (inStr($action, $subFooterStartStr) == false && inStr($action, $subFooterStartStr) == false) { $subFooterStartStr = '[subfooter]'; $subFooterEndStr = '[/subfooter]'; } $subHeaderStr = getStrCut($action, $subHeaderStartStr, $subHeaderEndStr, 2); $subFooterStr = getStrCut($action, $subFooterStartStr, $subFooterEndStr, 2); //call echo(rs("columnname"),"哈哈") if ($s != '') { $s = vbCrlf() . $subHeaderStr . $s . $subFooterStr; } $c = $c . $s; } } } $showColumnList = $c; return @$showColumnList; }
function makeWebHtml($action) { $actionType = ''; $npagesize = ''; $npage = ''; $url = ''; $addSql = ''; $sortSql = ''; $sortFieldName = ''; $ascOrDesc = ''; $serchKeyWordName = ''; $parentid = ''; //追加于20160716 home $actionType = RParam($action, 'actionType'); $npage = RParam($action, 'npage'); $npage = getNumber($npage); if ($npage == '') { $npage = 1; } else { $npage = CInt($npage); } //导航 if ($actionType == 'nav') { $GLOBALS['glb_columnType'] = RParam($action, 'columnType'); $GLOBALS['glb_columnName'] = RParam($action, 'columnName'); $GLOBALS['glb_columnId'] = RParam($action, 'columnId'); if ($GLOBALS['glb_columnId'] == '') { $GLOBALS['glb_columnId'] = RParam($action, 'id'); } if ($GLOBALS['glb_columnType'] != '') { $addSql = 'where columnType=\'' . $GLOBALS['glb_columnType'] . '\''; } if ($GLOBALS['glb_columnName'] != '') { $addSql = getWhereAnd($addSql, 'where columnName=\'' . $GLOBALS['glb_columnName'] . '\''); } if ($GLOBALS['glb_columnId'] != '') { $addSql = getWhereAnd($addSql, 'where id=' . $GLOBALS['glb_columnId'] . ''); } //call echo("addsql",addsql) $rsObj = $GLOBALS['conn']->query('Select * from ' . $GLOBALS['db_PREFIX'] . 'webcolumn ' . $addSql); if (@mysql_num_rows($rsObj) != 0) { $rs = mysql_fetch_array($rsObj); $GLOBALS['glb_columnId'] = $rs['id']; $GLOBALS['glb_columnName'] = $rs['columnname']; $GLOBALS['glb_columnType'] = $rs['columntype']; $GLOBALS['glb_bodyContent'] = $rs['bodycontent']; $GLOBALS['glb_detailTitle'] = $GLOBALS['glb_columnName']; $GLOBALS['glb_flags'] = $rs['flags']; $npagesize = $rs['npagesize']; //每页显示条数 $GLOBALS['glb_isonhtml'] = $rs['isonhtml']; //是否生成静态网页 $sortSql = ' ' . $rs['sortsql']; //排序SQL if ($rs['webtitle'] != '') { $GLOBALS['cfg_webTitle'] = $rs['webtitle']; //网址标题 } if ($rs['webkeywords'] != '') { $GLOBALS['cfg_webKeywords'] = $rs['webkeywords']; //网站关键词 } if ($rs['webdescription'] != '') { $GLOBALS['cfg_webDescription'] = $rs['webdescription']; //网站描述 } if ($GLOBALS['templateName'] == '') { if (aspTrim($rs['templatepath']) != '') { $GLOBALS['templateName'] = $rs['templatepath']; } else { if ($rs['columntype'] != '首页') { $GLOBALS['templateName'] = getDateilTemplate($rs['id'], 'List'); } } } } $GLOBALS['glb_columnENType'] = handleColumnType($GLOBALS['glb_columnType']); $GLOBALS['glb_url'] = getColumnUrl($GLOBALS['glb_columnName'], 'name'); //文章类列表 if (inStr('|产品|新闻|视频|下载|案例|', '|' . $GLOBALS['glb_columnType'] . '|') > 0) { $GLOBALS['glb_bodyContent'] = getDetailList($action, defaultListTemplate($GLOBALS['glb_columnType'], $GLOBALS['glb_columnName']), 'ArticleDetail', '栏目列表', '*', $npagesize, $npage, 'where parentid=' . $GLOBALS['glb_columnId'] . $sortSql); //留言类列表 } else { if (inStr('|留言|', '|' . $GLOBALS['glb_columnType'] . '|') > 0) { $GLOBALS['glb_bodyContent'] = getDetailList($action, defaultListTemplate($GLOBALS['glb_columnType'], $GLOBALS['glb_columnName']), 'GuestBook', '留言列表', '*', $npagesize, $npage, ' where isthrough<>0 ' . $sortSql); } else { if ($GLOBALS['glb_columnType'] == '文本') { //航行栏目加管理 if (@$_REQUEST['gl'] == 'edit') { $GLOBALS['glb_bodyContent'] = '<span>' . $GLOBALS['glb_bodyContent'] . '</span>'; } $url = WEB_ADMINURL . '?act=addEditHandle&actionType=WebColumn&lableTitle=网站栏目&nPageSize=10&page=&id=' . $GLOBALS['glb_columnId'] . '&n=' . getRnd(11); $GLOBALS['glb_bodyContent'] = handleDisplayOnlineEditDialog($url, $GLOBALS['glb_bodyContent'], '', 'span'); } } } //细节 } else { if ($actionType == 'detail') { $GLOBALS['glb_locationType'] = 'detail'; $rsObj = $GLOBALS['conn']->query('Select * from ' . $GLOBALS['db_PREFIX'] . 'articledetail where id=' . RParam($action, 'id')); if (@mysql_num_rows($rsObj) != 0) { $rs = mysql_fetch_array($rsObj); $GLOBALS['glb_columnName'] = getColumnName($rs['parentid']); $GLOBALS['glb_detailTitle'] = $rs['title']; $GLOBALS['glb_flags'] = $rs['flags']; $GLOBALS['glb_isonhtml'] = $rs['isonhtml']; //是否生成静态网页 $GLOBALS['glb_id'] = $rs['id']; //文章ID if ($GLOBALS['isMakeHtml'] == true) { $GLOBALS['glb_url'] = getHandleRsUrl($rs['filename'], $rs['customaurl'], '/detail/detail' . $rs['id']); } else { $GLOBALS['glb_url'] = handleWebUrl('?act=detail&id=' . $rs['id']); } if ($rs['webtitle'] != '') { $GLOBALS['cfg_webTitle'] = $rs['webtitle']; //网址标题 } if ($rs['webkeywords'] != '') { $GLOBALS['cfg_webKeywords'] = $rs['webkeywords']; //网站关键词 } if ($rs['webdescription'] != '') { $GLOBALS['cfg_webDescription'] = $rs['webdescription']; //网站描述 } //改进20160628 $sortFieldName = 'id'; $ascOrDesc = 'asc'; $addsql = aspTrim(getWebColumnSortSql($rs['parentid'])); if ($addsql != '') { $sortFieldName = aspTrim(replace(replace(replace($addsql, 'order by', ''), ' desc', ''), ' asc', '')); if (inStr($addsql, ' desc') > 0) { $ascOrDesc = 'desc'; } } $GLOBALS['glb_artitleAuthor'] = $rs['author']; $GLOBALS['glb_artitleAdddatetime'] = $rs['adddatetime']; $GLOBALS['glb_upArticle'] = upArticle($rs['parentid'], $sortFieldName, $rs[$sortFieldName], $ascOrDesc); $GLOBALS['glb_downArticle'] = downArticle($rs['parentid'], $sortFieldName, $rs[$sortFieldName], $ascOrDesc); $GLOBALS['glb_aritcleRelatedTags'] = aritcleRelatedTags($rs['relatedtags']); $GLOBALS['glb_aritcleSmallImage'] = $rs['smallimage']; $GLOBALS['glb_aritcleBigImage'] = $rs['bigimage']; //文章内容 //glb_bodyContent = "<div class=""articleinfowrap"">[$articleinfowrap$]</div>" & rs("bodycontent") & "[$relatedtags$]<ul class=""updownarticlewrap"">[$updownArticle$]</ul>" //上一篇文章,下一篇文章 //glb_bodyContent = Replace(glb_bodyContent, "[$updownArticle$]", upArticle(rs("parentid"), "sortrank", rs("sortrank")) & downArticle(rs("parentid"), "sortrank", rs("sortrank"))) //glb_bodyContent = Replace(glb_bodyContent, "[$articleinfowrap$]", "来源:" & rs("author") & " 发布时间:" & format_Time(rs("adddatetime"), 1)) //glb_bodyContent = Replace(glb_bodyContent, "[$relatedtags$]", aritcleRelatedTags(rs("relatedtags"))) $GLOBALS['glb_bodyContent'] = $rs['bodycontent']; //文章详细加控制 if (@$_REQUEST['gl'] == 'edit') { $GLOBALS['glb_bodyContent'] = '<span>' . $GLOBALS['glb_bodyContent'] . '</span>'; } $url = WEB_ADMINURL . '?act=addEditHandle&actionType=ArticleDetail&lableTitle=分类信息&nPageSize=10&page=&parentid=&id=' . RParam($action, 'id') . '&n=' . getRnd(11); $GLOBALS['glb_bodyContent'] = handleDisplayOnlineEditDialog($url, $GLOBALS['glb_bodyContent'], '', 'span'); if ($GLOBALS['templateName'] == '') { if (aspTrim($rs['templatepath']) != '') { $GLOBALS['templateName'] = $rs['templatepath']; } else { $GLOBALS['templateName'] = getDateilTemplate($rs['parentid'], 'Detail'); } } } //单页 } else { if ($actionType == 'onepage') { $rsObj = $GLOBALS['conn']->query('Select * from ' . $GLOBALS['db_PREFIX'] . 'onepage where id=' . RParam($action, 'id')); if (@mysql_num_rows($rsObj) != 0) { $rs = mysql_fetch_array($rsObj); $GLOBALS['glb_detailTitle'] = $rs['title']; $GLOBALS['glb_isonhtml'] = $rs['isonhtml']; //是否生成静态网页 if ($GLOBALS['isMakeHtml'] == true) { $GLOBALS['glb_url'] = getHandleRsUrl($rs['filename'], $rs['customaurl'], '/page/page' . $rs['id']); } else { $GLOBALS['glb_url'] = handleWebUrl('?act=detail&id=' . $rs['id']); } if ($rs['webtitle'] != '') { $GLOBALS['cfg_webTitle'] = $rs['webtitle']; //网址标题 } if ($rs['webkeywords'] != '') { $GLOBALS['cfg_webKeywords'] = $rs['webkeywords']; //网站关键词 } if ($rs['webdescription'] != '') { $GLOBALS['cfg_webDescription'] = $rs['webdescription']; //网站描述 } //内容 $GLOBALS['glb_bodyContent'] = $rs['bodycontent']; //文章详细加控制 if (@$_REQUEST['gl'] == 'edit') { $GLOBALS['glb_bodyContent'] = '<span>' . $GLOBALS['glb_bodyContent'] . '</span>'; } $url = WEB_ADMINURL . '?act=addEditHandle&actionType=ArticleDetail&lableTitle=分类信息&nPageSize=10&page=&parentid=&id=' . RParam($action, 'id') . '&n=' . getRnd(11); $GLOBALS['glb_bodyContent'] = handleDisplayOnlineEditDialog($url, $GLOBALS['glb_bodyContent'], '', 'span'); if ($GLOBALS['templateName'] == '') { if (aspTrim($rs['templatepath']) != '') { $GLOBALS['templateName'] = $rs['templatepath']; } else { $GLOBALS['templateName'] = 'Main_Model.html'; //call echo(templateName,"templateName") } } } //搜索 } else { if ($actionType == 'Search') { $GLOBALS['templateName'] = 'Main_Model.html'; $serchKeyWordName = @$_REQUEST['keywordname']; $parentid = @$_REQUEST['parentid']; if ($serchKeyWordName == '') { $serchKeyWordName = 'wd'; } $GLOBALS['glb_searchKeyWord'] = replace(@$_REQUEST[$serchKeyWordName], '<', '<'); $addSql = ''; if ($parentid != '') { $addSql = ' where parentid=' . $parentid; } $addSql = getWhereAnd($addSql, ' where title like \'%' . $GLOBALS['glb_searchKeyWord'] . '%\''); $npagesize = 20; //call echo(npagesize, npage) $GLOBALS['glb_bodyContent'] = getDetailList($action, defaultListTemplate($GLOBALS['glb_columnType'], $GLOBALS['glb_columnName']), 'ArticleDetail', '网站栏目', '*', $npagesize, $npage, $addSql); $GLOBALS['positionEndStr'] = ' >> 搜索内容”' . $GLOBALS['glb_searchKeyWord'] . '“'; //加载等待 } else { if ($actionType == 'loading') { rwEnd('页面正在加载中。。。'); } } } } } //模板为空,则用默认首页模板 if ($GLOBALS['templateName'] == '') { $GLOBALS['templateName'] = 'Index_Model.html'; //默认模板 } //检测当前路径是否有模板 if (inStr($GLOBALS['templateName'], '/') == false) { $GLOBALS['templateName'] = $GLOBALS['cfg_webTemplate'] . '/' . $GLOBALS['templateName']; } //call echo("templateName",templateName) if (CheckFile($GLOBALS['templateName']) == false) { Eerr('未找到模板文件', $GLOBALS['templateName']); } $GLOBALS['code'] = getFText($GLOBALS['templateName']); $GLOBALS['code'] = handleAction($GLOBALS['code']); //处理动作 $GLOBALS['code'] = thisPosition($GLOBALS['code']); //位置 $GLOBALS['code'] = replaceGlobleVariable($GLOBALS['code']); //替换全局标签 $GLOBALS['code'] = handleAction($GLOBALS['code']); //处理动作 '再来一次,处理数据内容里动作 $GLOBALS['code'] = handleAction($GLOBALS['code']); //处理动作 $GLOBALS['code'] = handleAction($GLOBALS['code']); //处理动作 $GLOBALS['code'] = thisPosition($GLOBALS['code']); //位置 $GLOBALS['code'] = replaceGlobleVariable($GLOBALS['code']); //替换全局标签 $GLOBALS['code'] = delTemplateMyNote($GLOBALS['code']); //删除无用内容 //格式化HTML if (inStr($GLOBALS['cfg_flags'], '|formattinghtml|') > 0) { //code = HtmlFormatting(code) '简单 $GLOBALS['code'] = handleHtmlFormatting($GLOBALS['code'], false, 0, '删除空行'); //自定义 //格式化HTML第二种 } else { if (inStr($GLOBALS['cfg_flags'], '|formattinghtmltow|') > 0) { $GLOBALS['code'] = htmlFormatting($GLOBALS['code']); //简单 $GLOBALS['code'] = handleHtmlFormatting($GLOBALS['code'], false, 0, '删除空行'); //自定义 //压缩HTML } else { if (inStr($GLOBALS['cfg_flags'], '|ziphtml|') > 0) { $GLOBALS['code'] = zipHTML($GLOBALS['code']); } } } //闭合标签 if (inStr($GLOBALS['cfg_flags'], '|labelclose|') > 0) { $GLOBALS['code'] = handleCloseHtml($GLOBALS['code'], true, ''); //图片自动加alt "|*|", } //在线编辑20160127 if (rq('gl') == 'edit') { if (inStr($GLOBALS['code'], '</head>') > 0) { if (inStr(lCase($GLOBALS['code']), 'jquery.min.js') == false) { $GLOBALS['code'] = replace($GLOBALS['code'], '</head>', '<script src="/Jquery/jquery.Min.js"></script></head>'); } $GLOBALS['code'] = replace($GLOBALS['code'], '</head>', '<script src="/Jquery/Callcontext_menu.js"></script></head>'); } if (inStr($GLOBALS['code'], '<body>') > 0) { //Code = Replace(Code,"<body>", "<body onLoad=""ContextMenu.intializeContextMenu()"">") } } //call echo(templateName,templateName) $makeWebHtml = $GLOBALS['code']; return @$makeWebHtml; }
function backupDatabase() { $isUnifyToFile = ''; $tableNameList = ''; $databaseTableNameList = ''; $fieldConfig = ''; $fieldName = ''; $fieldType = ''; $splField = ''; $fieldValue = ''; $nLen = ''; $isOK = ''; $splStr = ''; $splxx = ''; $tableName = ''; $s = ''; $c = ''; $backupDir = ''; $backupFilePath = ''; handlePower('备份数据库'); $tableNameList = lCase(@$_REQUEST['tableNameList']); //自定义备份数据表列表 $isUnifyToFile = @$_REQUEST['isUnifyToFile']; //统一放到一个文件里 $databaseTableNameList = lCase($GLOBALS['db_PREFIX'] . 'webcolumn' . vbCrlf() . getTableList()); //让db_PREFIX在最前面,因为文章类型要从这里读取 $nLen = len($GLOBALS['db_PREFIX']); //处理自定义表列表 if ($tableNameList != '') { $splStr = aspSplit($tableNameList, '|'); foreach ($splStr as $key => $tableName) { if (inStr(vbCrlf() . $databaseTableNameList . vbCrlf(), vbCrlf() . $GLOBALS['db_PREFIX'] . $tableName . vbCrlf()) > 0) { if ($c != '') { $c = $c . vbCrlf(); } $c = $c . $GLOBALS['db_PREFIX'] . $tableName; } } if ($c == '') { eerr('自定义备份表不正确 <a href="javascript:history.go(-1)">点击返回</a>', $tableNameList); } $databaseTableNameList = $c; } $splStr = aspSplit($databaseTableNameList, vbCrlf()); $c = ''; foreach ($splStr as $key => $tableName) { $tableName = aspTrim($tableName); $isOK = true; //判断前缀是否一样 if ($nLen > 0) { if (mid($tableName, 1, $nLen) != $GLOBALS['db_PREFIX']) { $isOK = false; } } if ($isOK == true) { $fieldConfig = lCase(getFieldConfigList($tableName)); aspEcho($tableName, $fieldConfig); $rsObj = $GLOBALS['conn']->query('select * from ' . $tableName); $c = $c . '【table】' . mid($tableName, len($GLOBALS['db_PREFIX']) + 1, -1) . vbCrlf(); while ($rs = $GLOBALS['conn']->fetch_array($rsObj)) { $splField = aspSplit($fieldConfig, ','); foreach ($splField as $key => $s) { if (inStr($s, '|') > 0) { $splxx = aspSplit($s, '|'); $fieldName = $splxx[0]; $fieldType = $splxx[1]; $fieldValue = $rs[$fieldName]; if ($fieldType == 'numb') { $fieldValue = replace(replace($fieldValue, 'True', '1'), 'False', '0'); } //后台菜单 if ($tableName == $GLOBALS['db_PREFIX'] . 'listmenu' && $fieldName == 'parentid') { $fieldValue = getListMenuName($fieldValue); //网站栏目 } else { if ($tableName == $GLOBALS['db_PREFIX'] . 'webcolumn' && $fieldName == 'parentid') { $fieldValue = getColumnName($fieldValue); } } if ($fieldValue != '') { if (inStr($fieldValue, vbCrlf()) > 0) { $fieldValue = $fieldValue . '【/' . $fieldName . '】'; } $c = $c . '【' . $fieldName . '】' . $fieldValue . vbCrlf(); } } } $c = $c . '-------------------------------' . vbCrlf(); } $c = $c . '===============================' . vbCrlf(); } } $backupDir = $GLOBALS['adminDir'] . '/Data/BackUpDateBases/'; $backupFilePath = $backupDir . '/' . Format_Time(now(), 4) . '.txt'; createDirFolder($backupDir); deleteFile($backupFilePath); //删除旧备份文件 createFile($backupFilePath, $c); //创建备份文件 HR(); aspEcho('backupDir', $backupDir); aspEcho('backupFilePath', $backupFilePath); eerr('操作完成', '<a href=\'?act=displayLayout&templateFile=layout_manageDatabases.html&lableTitle=数据库\'>点击返回 备份恢复数据</a>'); }
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; }