function set_name_map() { global $_POST; foreach ($_POST as $prodName => $tableName) { $tableName = trim($tableName); if ($prodName == "set_type" || $prodName == "submit") { continue; } echo "<br>"; if ($tableName == "") { echo "提示:产品({$prodName})的表名为空"; continue; } if (preg_match("/\$\\w+\$/", $tableName) === false) { echo "错误:产品({$prodName})的表名({$tableName})只能由字符组成!"; break; } if (strlen($tableName) == 20) { echo "错误:产品({$prodName})的表名({$tableName})长度不能超过20!"; break; } dbUtil(SetProdNameMap, $prodName, $tableName); $retArray = get_db_result(); if ($retArray[0] == 1) { echo $retArray[1]; break; } else { echo $retArray[1]; } } echo " <a href='../../../index.php'>返回</a>"; }
function html_listCommentors($prodName) { $commentorList = dbUtil(GetCommentorList, $prodName); foreach ($commentorList as $commentor) { echo "<option>{$commentor}</option>", "\n"; } }
function set_prod_table_name() { global $_POST; $op_type = "set_prod_table_name"; foreach ($_POST as $prodName => $tableName) { if ($tableName == $op_type) { continue; } $ret = dbUtil(SaveProdTableNameMapInfo, $prodName, $tableName); $retArr = dbUtil(GetStatus); if ($ret != true || $retArr["ret"] != 0) { echo $retArr["msg"]; break; } } echo "Info: 映射产品名与表名成功!"; }
function export_svn_code($code_url, $prod_name, $ldap, $password) { $code_url = trim($code_url); if (strlen($prod_name) > 30) { set_util_result(1, "错误:服务名称不能超过30个字符!"); return; } if (preg_match("/^(https:\\/\\/[^@]+)@(\\d+)\$/", $code_url, $matches) == 0) { set_util_result(1, "错误:无效的svn地址!"); return; } $url_addr = $matches[1]; $version = $matches[2]; $target_dir = dirname(__FILE__) . "/../../code/" . md5($prod_name); if (!file_exists($target_dir)) { mkdir($target_dir); } $target_dir = realpath($target_dir); $target_svn_dir = $target_dir . "/" . $version; if (file_exists($target_svn_dir)) { set_util_result(1, "错误:该版本已经存在!"); return; } $target_exp_file = dirname(__FILE__) . "/../../templates/svn_export.exp"; $content = file_get_contents(dirname(__FILE__) . "/../../templates/svn_export.template"); $content = str_replace('$current_file$', $target_exp_file, $content); $content = str_replace('$user_name$', $ldap, $content); $content = str_replace('$svn_url$', $code_url, $content); $content = str_replace('$target_dirname$', $target_svn_dir, $content); $content = str_replace('$password$', $password, $content); file_put_contents($target_exp_file, $content); $cmd = "chmod 700 {$target_exp_file}; {$target_exp_file}"; exec($cmd, $lines, $ret); $pos = strpos(array_pop($lines), "authorization failed"); if ($pos !== false) { set_util_result(1, "错误:执行expect脚本失败(请确定用户名密码是否正确)!"); return; } dbUtil(AddCodeInfo, $code_url, $version, $prod_name, $ldap, $target_svn_dir); $db_ret = get_db_result(); set_util_result($db_ret[0], $db_ret[1]); }
echo $user; ?> </h3> <div id="title2"> <input type=checkbox id="note_add_mode"/>注释模式 </div> <div id="filePath"> 文件路径: <span></span> </div> <div id="content"> <div id="tree_content" class="sub"> <?php $svnAddr = ""; $codeInfoArr = dbUtil(LoadCodePathInfoTable); foreach ($codeInfoArr as $subArr) { if ($subArr["prodName"] == $prodName && $subArr["version"] == $version) { $svnAddr = $subArr["svnPath"]; break; } } if ($svnAddr == "") { echo "Error: Can't find svn Path based on({$prodName}:{$version})"; } else { $svnDirPath = "../code/" . getCodeDirPath($prodName, $svnAddr); $lines = getTreeHtmlLines(realpath($svnDirPath), "tt"); echo implode("\n", $lines); } ?> </div>
<?php include dirname(__FILE__) . "/../dbLib.php"; $codePathInfoArr = dbUtil(LoadCodePathInfoTable); $nameMapArr = dbUtil(LoadProdTableNameMapInfoTable); ?> <table border='1'> <tr><th>服务名称</th><th>表名</th></tr> <?php $tempArr = array(); foreach ($codePathInfoArr as $codeSubArr) { $prodName = $codeSubArr["prodName"]; if (array_key_exists($prodName, $nameMapArr)) { array_push($tempArr, "<tr><td>{$prodName}</td><td>" . $nameMapArr[$prodName] . "</td></tr>"); } else { array_push($tempArr, "<tr><td>{$prodName}</td><td><input type=text name='{$prodName}' /></td></tr>"); } } echo implode("\n", array_unique($tempArr)); ?> </table>
function addListContent($whitelistName, $whitelistContent) { $ret = dbUtil(EditWhitelistContent, array($whitelistName, "add", $whitelistContent)); return $ret; }
<?php include "./dbUtil.php"; $cateList = dbUtil(ReadCategory); foreach ($cateList as $cateName) { echo "<option>{$cateName}</option>"; }
</style> </head> <center> <form method="POST" action="./php/comment.php"> <table> <tr> <td>产品名:<select id="prod_name" name="prod"><?php html_listProducts(); ?> </select></td> <td><input type="submit" id="comment_btn" value="添加备注" /></td> </tr> <tr> <td>版本号:<select id="version_name" name="ver"><?php $prodList = dbUtil(GetProdList); html_listVersions($prodList[0], 0); ?> </select></td> </tr> <tr> <td>备注人:<select id="commentor_name" name="commentor"><?php html_listCommentors($prodList[0]); ?> </select> <a href='' id="add_commentor">+</a></td> </tr> </table> </form> </center> <div id="code_info"></div>
<style> a {text-decoration: none; color: blue; font-size: 0.8em} a:hover {text-decoration: underline} </style> </head> <body> <?php $prodName = @$_POST["prod"]; $version = @$_POST["ver_name"]; if ($prodName == null || $version == null) { echo "Error: Invalid POST parameters ", "<a href='../index.php'>返回</a>"; return; } include "./util/util.php"; $disk_path = dbUtil(GetCodeDiskPath, $prodName, $version); ?> <div id="header" style="margin-bottom: 10px; margin-left:10px"> <h3 style="display:inline"><?php echo $prodName; ?> - 代码阅读</h3> <a id="return" href="../index.php">返回首页</a> </div> <hr style="border: 1px solid #DCDCDC"> <div id="file_tree" class="assist"> <?php echo getTreeHtmlStr($disk_path);
$type = $rRow["type"]; $solution = $rRow["solution"]; $improvement = $rRow["improvement"]; $priority = $rRow["priority"]; $cmtStr = ""; if (array_key_exists($recordId, $cmtList)) { $cmtStr = implode("\n", $cmtList[$recordId]); } array_push($retArr, array($recordId, $title, $summary, $type, $priority, $solution . "\n" . $improvement . "\n" . $cmtStr)); } return $retArr; } $startRowIdx = getParam("startRowIdx", 1); $itemsInPage = getParam("itemsInPage", 50); $startTime = getParam("startTime", time() - 7 * 24 * 60 * 60); $endTime = getParam("endTime", time()); $issueType = getParam("issueType", "all"); $retArr = array("ret" => 0, "msg" => "", "content" => "", "itemsCount" => -1, "startRowIdx" => $startRowIdx, "itemsInPage" => $itemsInPage, "startTime" => $startTime, "endTime" => $endTime, "issueType" => $issueType); list($ticketArr, $ticketNoteArr, $ticketResArr) = dbUtil(ReadOpIssues, "2011-01-17 09:49:52", "2011-02-17 09:49:52"); list($mlogsArr, $mlogsCmtArr) = dbUtil(ReadMaintainIssues, 1250851454611.0, 1299545507897.0); if ($issueType == "all") { } elseif ($issueType == "operation") { $itemsCount = count($ticketArr); } elseif ($issueType == "maintain") { $itemsCount = count($mlogsArr); } #print_r($ticketArr); #print_r($ticketNoteArr); #print_r($ticketResArr); #date('Y-m-d H:i:s', time()); #strptime($strf, $format);
<h3>测试执行</h3> 服务名称: <select id="serviceList"> <?php foreach ($serviceList as $serviceName) { echo "<option>{$serviceName}</option>", "\n"; } ?> </select> 版本号: <select id="versionList"> <?php include "./dbUtil.php"; $firstService = $serviceList[0]; $versions = dbUtil(LoadVersions, array($firstService)); sort($versions); foreach (array_reverse($versions) as $version) { echo "<option>{$version}</option>", "\n"; } ?> </select> <input type=button id='startRun' value='开始' /> <input type=button id='stopRun' value='停止' /> <div id="runInfo"> </div> </div> <h3>执行状态</h3>
<?php $id = $_POST["id"]; $fieldName = $_POST["fieldName"]; $value = $_POST["value"]; include "dbUtil.php"; dbUtil(UpdateSpecificContent, array($id, $fieldName, $value)); echo json_encode($retArray);
<?php include "dbUtil.php"; $cateList = dbUtil(ReadCategory); echo "<script>var cateListOpStr = \"<option>" . implode("</option><option>", $cateList) . "</option>\";</script>"; ?> </head> <body> <a href="#" id="enlarge" title="放大正文字体">放大</a> <a href="#" id="minify" title="缩小正文字体">缩小</a> <?php header("Content-type: text/html; charset=utf-8"); $id = $_GET["id"]; echo dbUtil(ReadSpecificContent, array($id)); ?> <script> $(function() { var status = ""; $("a[name='edit']").click(function(e) { if (status != "") { alert("警告:当前已经处于编辑状态!"); return false; } status = "edit"; var fieldName = $(this).parents("tr").attr('name'); var content = "";
<?php $prodName = $_POST["prodName"]; include "dbUtil.php"; $versions = dbUtil(LoadVersions, array($prodName)); sort($versions); foreach (array_reverse($versions) as $version) { echo "<option>{$version}</option>", "\n"; }
<?php $cateName = $_GET["cateName"]; include "./dbUtil.php"; dbUtil(SaveCategory, array($cateName)); echo json_encode($retArray);
<?php $whitelistName = $_POST["whitelistName"]; #$whitelistName = "union_stderr_whitelist"; include "dbUtil.php"; $contents = dbUtil(GetWhitelistContents, array($whitelistName)); sort($contents); foreach (array_reverse($contents) as $content) { echo $content, "\n"; }
function setProdNameMap($db, $prodName, $tableName) { $prodNameMap = dbUtil(GetProdNameMap); if (array_key_exists($prodName, $prodNameMap)) { set_db_result(1, "错误:产品名({$prodName})已存在!"); return; } if (in_array($tableName, $prodNameMap)) { set_db_result(1, "错误:表名({$tableName})已存在!"); return; } $collectionNames = $db->getCollectionNames(); if (in_array($tableName, $collectionNames)) { set_db_result(1, "错误:数据库中的表({$tableName})已存在!"); } $obj = preg_match("/^\\w+\$/", $tableName); if ($obj == 0) { set_db_result(1, "错误:表名只能是字符或字母下划线组成!"); return; } if (strlen($tableName) > 20) { set_db_result(1, "错误:表名长度不能大于20个字符"); return; } $db->createCollection($tableName); $collection = $db->prodTableNameMap; $collection->insert(array("prodName" => $prodName, "tableName" => $tableName)); set_db_result(0, "提示:产品名({$prodName})与表名({$tableName})映射成功!"); }
<?php $serviceName = $_POST["serviceName"]; $verName = $_POST["verName"]; $retArray = array(); if ($serviceName == "" && $verName == "") { $retArray = array(1, "错误:输入不能为空!"); } else { include "dbUtil.php"; dbUtil(AddNewVersion, array($serviceName, $verName)); } echo json_encode($retArray);
<?php include "dbUtil.php"; $whitelistNames = dbUtil(GetWhitelistNames, null); sort($whitelistNames); foreach (array_reverse($whitelistNames) as $name) { echo "<option>{$name}</option>", "\n"; }
<?php $prodName = $_POST["prodName"]; $versionName = $_POST["version"]; $timestamp = time(); include "interface.php"; include "dbUtil.php"; $status = getStatus(); if ($status == "stopped") { dbUtil(SaveRunInfo, array($prodName, $versionName, $timestamp)); } $ret = runTool($prodName, $versionName, $timestamp);
<?php include dirname(__FILE__) . "/../dbLib.php"; $temp_arr = array(); $prodName = $_POST["prodName"]; $prodInfoArr = dbUtil(LoadCodePathInfoTable); foreach ($prodInfoArr as $subArr) { if ($prodName != $subArr["prodName"]) { continue; } array_push($temp_arr, "<option>" . $subArr["version"] . "</option>"); } echo implode("\n", $temp_arr);
function load($whitelistName) { $this->whiteListArray = dbUtil(GetWhitelistContents, array($whitelistName)); return $this->whiteListArray; }
include dirname(__FILE__) . "/../dbLib.php"; $prodName = getValue("prodName"); $filePath = getValue("filePath"); if ($filePath == "") { echo json_encode(array("ret" => 1, "msg" => "Error: FilePath is Empty !")); return; } function getValue($keyName) { global $_GET; if (array_key_exists($keyName, $_GET)) { return $_GET[$keyName]; } echo json_encode(array("ret" => 1, "msg" => "Error: Invalid Get Parameters!")); exit(1); } $codeCommentArr = dbUtil(LoadCodeCommentInfoTable, $prodName); $retArr = dbUtil(GetStatus); if ($retArr["ret"] == 1) { echo json_encode($retArr); return; } $retArr = array(); foreach ($codeCommentArr as $subArr) { if ($subArr["filePath"] != $filePath) { continue; } array_push($retArr, $subArr); } $retArr2 = array("ret" => 0, "list" => $retArr); echo json_encode($retArr2);
<?php $user = $_POST["user"]; $title = $_POST["title"]; $desc = $_POST["desc"]; $cateName = $_POST["cateName"]; $corePoint = $_POST["corePoint"]; include "dbUtil.php"; dbUtil(SaveInputContent, array($user, $title, $desc, $cateName, $corePoint)); echo json_encode($retArray);