<?php
/*********************************************************      
 文件说明:         
    功能说明:system parameters define

    调用关系:
    变量说明:

作者:Cui Ticun    2006-06-28 
修改注释：
NO.1      
姓名：         
时间：  
修改说明：
*********************************************************/ 
require("../../inc/header.inc");
?>
<body leftmargin="15" rightmargin="10" onload="javascript:adjust();" onresize="javascript:adjust();" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">

<?php
$DEBUG=0;
adjust_head();
adjust_title_head();
//=====================================
//变量定义
//=====================================
$db='OMC_PUB';
$tableName='omcPubVarConf';

//保存修改的参数
if($_REQUEST['actMode'] ){
	//$sql = " SELECT * FROM $tableName WHERE lowPrivilege='1'";
	$sql = " SELECT * FROM $tableName";
	if($DEBUG) 
	echo "<br>sql=$sql";
	$res = @mysqli_query($pubConn,$sql);
	mysqli_error($pubConn);
	while($row = @mysqli_fetch_array($res)){
		$name=$row[pubVarName];
		$value=$_REQUEST[''.$name];

		$sql = " UPDATE $tableName SET
				pubVarValue='$value'
				WHERE pubVarName='$name'
			 ";
		if($DEBUG)
			echo "<br>sql=$sql";
			
		if(strcmp($row[pubVarName],"globalFTPUserName") == 0)
		{
			$updatesql="update OMC_PUB.sysSubsConf set ftpLoginName='$value' ";
			@mysqli_query($pubConn,$updatesql);
		}
		else if(strcmp($row[pubVarName],"globalFTPPassword") == 0)
		{
			$updatesql="update OMC_PUB.sysSubsConf set ftpLoginPwd='$value' ";
			@mysqli_query($pubConn,$updatesql);
		}
		else if(strcmp($row[pubVarName],"ExternalRCM") == 0)
		{
			$updatesql="update OMC_PUB.sysSubsConf set ExternalRCM='$value' ";
			@mysqli_query($pubConn,$updatesql);
			
			if($value == 0)
			{
				$updatesql="update OMC_PUB.sysMenuConf set privilege='-1' where level_1=3 and level_2=21 and level_3=0; ";
				@mysqli_query($pubConn,$updatesql);
				$updatesql="update OMC_PUB.sysMenuConf set privilege='2' where level_1=3 and level_2=20 and level_3=0; ";
				@mysqli_query($pubConn,$updatesql);
				
				$updatesql="update OMC_PUB.sysMenuConf set privilege='-1' where level_1=5 and level_2=3 and level_3=0; ";
				@mysqli_query($pubConn,$updatesql);
				$updatesql="update OMC_PUB.sysMenuConf set privilege='3' where level_1=5 and level_2=2 and level_3=0; ";
				@mysqli_query($pubConn,$updatesql);
				
				$updatesql="update OMC_PUB.sysMenuConf set privilege='-1' where level_1=7 and level_2=4 and level_3=2; ";
				@mysqli_query($pubConn,$updatesql);
				$updatesql="update OMC_PUB.sysMenuConf set privilege='4' where level_1=7 and level_2=4 and level_3=1; ";
				@mysqli_query($pubConn,$updatesql);
				
				$updatesql="update OMC_PUB.sysCsvConf set db_name='PPS_DB' where menu_name_2='card_info'";
				@mysqli_query($pubConn,$updatesql);
				$updatesql="update OMC_PUB.sysCsvConf set if_enable=1 where menu_name_2='used_card_info'";
				@mysqli_query($pubConn,$updatesql);

				$updatesql="update SMCLI.sysCmdDef set serverStr='pps',sysTypeNo=360,tmpTable='OBJ_360.tmpSubsData_1',srcTable='PPS_DB.card_info' where objectStr='ppscard'";
				@mysqli_query($pubConn,$updatesql);
			}
			else
			{
				$updatesql="update OMC_PUB.sysMenuConf set privilege='2' where level_1=3 and level_2=21 and level_3=0; ";
				@mysqli_query($pubConn,$updatesql);
				$updatesql="update OMC_PUB.sysMenuConf set privilege='-1' where level_1=3 and level_2=20 and level_3=0; ";
				@mysqli_query($pubConn,$updatesql);
				
				$updatesql="update OMC_PUB.sysMenuConf set privilege='3' where level_1=5 and level_2=3 and level_3=0; ";
				@mysqli_query($pubConn,$updatesql);
				$updatesql="update OMC_PUB.sysMenuConf set privilege='-1' where level_1=5 and level_2=2 and level_3=0; ";
				@mysqli_query($pubConn,$updatesql);
				
				$updatesql="update OMC_PUB.sysMenuConf set privilege='4' where level_1=7 and level_2=4 and level_3=2; ";
				@mysqli_query($pubConn,$updatesql);
				$updatesql="update OMC_PUB.sysMenuConf set privilege='-1' where level_1=7 and level_2=4 and level_3=1; ";
				@mysqli_query($pubConn,$updatesql);
				
				$updatesql="update OMC_PUB.sysCsvConf set db_name='RCM_RC_DB' where menu_name_2='card_info'";
				@mysqli_query($pubConn,$updatesql);
				$updatesql="update OMC_PUB.sysCsvConf set if_enable=0 where menu_name_2='used_card_info'";
				@mysqli_query($pubConn,$updatesql);

				$updatesql="update SMCLI.sysCmdDef set serverStr='rcm',sysTypeNo=395,tmpTable='OBJ_395.tmpSubsData_1',srcTable='RCM_RC_DB.card_info' where objectStr='ppscard'";
				@mysqli_query($pubConn,$updatesql);
			}
		}
		
		
		if(strcmp($name,"fieldName") == 0||
			strcmp($name,"pssCardMinCount") == 0||
			strcmp($name,"currency_decimal") == 0||
			strcmp($name,"AucManagePwd") == 0||
			strcmp($name,"EirManagePwd") == 0||
			strcmp($name,"cdr_store_server") == 0||
			strcmp($name,"csta_store_server") == 0||
			strcmp($name,"SMCLI_timeout") == 0||
			strcmp($name,"globalFTPUserName") == 0||
			strcmp($name,"globalFTPPassword") == 0||
			strcmp($name,"ExternalRCM") == 0
		)
			mysqli_query($pubConn,$sql);
	}
	echo "<br><FONT color=\"#0000FF\"> Save OK!</FONT>";
}
?>

<body>
<?php
	echo "<table id=\"table_up\" border=0 width=100%>";
		echo "<tr>";
		echo "<td width=\"50%\" align=\"left\">";
		echo "Maintenance > Control Panel > System";
		echo "</td>";
		echo "<td align=right>";
		$helpId="5.2.1";
		showHelp($helpId);
		echo "</td></tr>";
	echo "</table>";
adjust_title_tail();
adjust_content_head();
echo "<br>";
?>
<form name="listForm" method="POST" action="<?php echo"$PHP_SELF";?>">
<table border="1" width="100%" cellpadding="2" cellspacing="0"  bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF"  >
<?php
echo "<tr><td width=\"100%\" colspan=\"3\" align=\"center\" bgcolor=\"#E6E6E6\">";
echo "<font size=3>System Configuration</font>";
echo "</td></tr>";

//title
echo "<tr  bgcolor=\"#E6E6E6\">";		
echo "<td width=\"30%\">Name</td>";
echo "<td width=\"30%\">Value</td>";
echo "<td width=\"40%\">Remark</td>";
echo "</tr>";

//$sql = " SELECT * FROM $tableName WHERE lowPrivilege='1' ORDER BY instance";
$sql = " SELECT * FROM $tableName ORDER BY instance";

if($DEBUG) 
	echo "<br>sql=$sql db=$db";
$res = @mysqli_query($pubConn,$sql);

//fieldName
$row = @mysqli_fetch_array($res);
echo "<tr>";		
echo "<td width=\"30%\">Field Name</td>";
echo "<td width=\"30%\">";
echo "<input type=\"text\" name=\"{$row[pubVarName]}\" value=\"{$row[pubVarValue]}\" size=\"32\" class=\"text\">";
echo "</td>";
echo "<td width=\"40%\">&nbsp;</td>";
echo "</tr>";

//Minimum currency unit
$row = @mysqli_fetch_array($res);
echo "<tr>";		
echo "<td width=\"30%\">Minimum currency unit</td>";
echo "<td width=\"30%\">";
echo "<input type=\"text\" name=\"{$row[pubVarName]}\" value=\"{$row[pubVarValue]}\" size=\"32\" class=\"text\">";
echo "</td>";
echo "<td width=\"40%\">For PPS</td>";
echo "</tr>";

//Decimal number of currency
$row = @mysqli_fetch_array($res);
echo "<tr>";		
echo "<td width=\"30%\">Decimal number of currency</td>";
echo "<td width=\"30%\">";
echo "<input type=\"text\" name=\"{$row[pubVarName]}\" value=\"{$row[pubVarValue]}\" size=\"32\" class=\"text\">";
echo "</td>";
echo "<td width=\"40%\">For PPS</td>";
echo "</tr>";

//AC Subscriber Management Password
$row = @mysqli_fetch_array($res);
echo "<tr>";		
echo "<td width=\"30%\">AUC Subscriber Management Password</td>";
echo "<td width=\"30%\">";
echo "<input type=\"password\" name=\"{$row[pubVarName]}\" value=\"{$row[pubVarValue]}\" size=\"32\" class=\"text\">";
echo "</td>";
echo "<td width=\"40%\">For AUC</td>";
echo "</tr>";

//Eir Subscriber Management Password
$row = @mysqli_fetch_array($res);
echo "<tr>";		
echo "<td width=\"30%\">EIR Subscriber Management Password</td>";
echo "<td width=\"30%\">";
echo "<input type=\"password\" name=\"{$row[pubVarName]}\" value=\"{$row[pubVarValue]}\" size=\"32\" class=\"text\">";
echo "</td>";
echo "<td width=\"40%\">For EIR</td>";
echo "</tr>";

//CDR Store Server
$row = @mysqli_fetch_array($res);
echo "<tr>";		
echo "<td width=\"30%\">CDR Collecting System</td>";
echo "<td width=\"30%\">";
echo "<input type=\"text\" name=\"{$row[pubVarName]}\" value=\"{$row[pubVarValue]}\" size=\"32\" class=\"text\">";
echo "</td>";
echo "<td width=\"40%\">{$row[remark]}</td>";
echo "</tr>";

//CSTA Store Server
$row = @mysqli_fetch_array($res);
echo "<tr>";		
echo "<td width=\"30%\">CSTA Collecting System</td>";
echo "<td width=\"30%\">";
echo "<input type=\"text\" name=\"{$row[pubVarName]}\" value=\"{$row[pubVarValue]}\" size=\"32\" class=\"text\">";
echo "</td>";
echo "<td width=\"40%\">{$row[remark]}</td>";
echo "</tr>";

//Time out of SMCLI client
$row = @mysqli_fetch_array($res);
echo "<tr>";		
echo "<td width=\"30%\">Time out of SMCLI client</td>";
echo "<td width=\"30%\">";
echo "<input type=\"text\" name=\"{$row[pubVarName]}\" value=\"{$row[pubVarValue]}\" size=\"32\" class=\"text\">";
echo "</td>";
echo "<td width=\"40%\">Unit:Minutes</td>";
echo "</tr>";

$row = @mysqli_fetch_array($res);
$row = @mysqli_fetch_array($res);
$row = @mysqli_fetch_array($res);
$row = @mysqli_fetch_array($res);
$row = @mysqli_fetch_array($res);
$row = @mysqli_fetch_array($res);
$row = @mysqli_fetch_array($res);
$row = @mysqli_fetch_array($res);
$row = @mysqli_fetch_array($res);
//Global FTP user name
$row = @mysqli_fetch_array($res);
echo "<tr>";		
echo "<td width=\"30%\">MSS FTP User Name</td>";
echo "<td width=\"30%\">";
echo "<input type=\"text\" name=\"{$row[pubVarName]}\" value=\"{$row[pubVarValue]}\" size=\"32\" class=\"text\">";
echo "</td>";
echo "<td width=\"40%\">For Import subscriber, download PPS Tarriff, backup MSS subs data and MSS Configuration Synchronization</td>";
echo "</tr>";

$row = @mysqli_fetch_array($res);
echo "<tr>";		
echo "<td width=\"30%\">MSS FTP Password</td>";
echo "<td width=\"30%\">";
echo "<input type=\"text\" name=\"{$row[pubVarName]}\" value=\"{$row[pubVarValue]}\" size=\"32\" class=\"text\">";
echo "</td>";
echo "<td width=\"40%\">For Import subscriber, download PPS Tarriff, backup MSS subs data and MSS Configuration Synchronization</td>";
echo "</tr>";

$row = @mysqli_fetch_array($res);
$row = @mysqli_fetch_array($res);
//ExternalRCM
$row = @mysqli_fetch_array($res);
echo "<tr>";		
echo "<td width=\"30%\">External RCM</td>";
echo "<td width=\"30%\">";
echo "<input type=\"text\" name=\"{$row[pubVarName]}\" value=\"{$row[pubVarValue]}\" size=\"32\" class=\"text\">";
echo "</td>";
echo "<td width=\"40%\">0-disable, 1-enable</td>";
echo "</tr>";
/*
//Get BSS Status And Alarm Timer
$row = @mysqli_fetch_array($res);
echo "<tr>";		
echo "<td width=\"30%\">Get BSS Status And Alarm Timer</td>";
echo "<td width=\"30%\">";
echo "<select name=\"{$row[pubVarName]}\" size=\"1\">";
for($i=0;$i<=60;$i++){
	if($i==0){
		if($i == $row[pubVarValue]){
			echo "<option value=\"$i\" selected>Disable</option>";
		}else{
			echo "<option value=\"$i\">Disable</option>";
		}
	}else{
		if($i == $row[pubVarValue]){
			echo "<option value=\"$i\" selected>$i&nbsp;minutes</option>";
		}else{
			echo "<option value=\"$i\">$i&nbsp;minutes</option>";
		}
	}
}
echo "</select>";
echo "</td>";
echo "<td width=\"40%\">&nbsp;</td>";
echo "</tr>";
*/

?>

</table>
<br>
<input type="submit" value="Save" name="actMode" class="button">
&nbsp;&nbsp;&nbsp;&nbsp;
</form>
<?php
adjust_content_tail();
?>
</body>
</html>
