Execute("insert into intphones (intnumber, name) values ('".$_POST["internally"]."', '".$_POST["name"]."')");
}
# После этих операций данные не будем брать из кеша.
header("Location: ?cacheflush=1");
die;
}
else if (isset($_POST["edit"]) && $_POST["edit"])
{
if ($_POST["internally"] == "")
{
header("Location: ?msg=3");
die;
}
if ($_POST["name"] == "")
{
header("Location: ?msg=2");
die;
}
$q4="SELECT 0 FROM intphones WHERE intnumber = '".$_POST["edit"]."'";
if($debug) echo $q4."
";
$res = $conn->Execute($q4);
if (isset($res->fields[0])){
if(!$demoMode){
$conn->Execute("update intphones set intnumber='".$_POST["internally"]."', name = '".$_POST["name"]."' where intnumber = '".$_POST["edit"]."'");
}
}else{
if(!$demoMode){
$conn->Execute("insert into intphones (intnumber, name) values ('".$_POST["internally"]."', '".$_POST["name"]."')");
}
}
# После этих операций данные не будем брать из кеша.
header("Location: ?cacheflush=1");
die;
}
else if (isset($_GET["delete"]) && $_GET["delete"])
{
$q5="delete from intphones where intnumber = '".$_GET["delete"]."'";
if($debug) echo $q5."
";
if(!$demoMode){
$conn->Execute($q5);
}
# После этих операций данные не будем брать из кеша.
header("Location: ?cacheflush=1");
die;
}
$title=strtr($GUI_LANG['ParametersOfInternalPhones'],$GUI_LANG['UpperCase'],$GUI_LANG['LowerCase']);
if(empty($export)) include("../include/set/header.html");
?>
".$GUI_LANG['ChangeDefaultAdminPassword']." ";
?> |
|
|
".$GUI_LANG['Phones'].":";
if(isset($_GET["msg"])){
switch ($_GET["msg"])
{
case 2:
echo " ".$GUI_LANG['EnterTheDescriptionOfInternalPhone']." ";
break;
case 3:
echo "".$GUI_LANG['EnterAnInternalPhoneNumber']." ";
break;
}
}
$q1="SELECT calls.internally,users.lastname, users.firstname, users.secondname
FROM calls
LEFT JOIN users ON users.internally = calls.internally
group by calls.internally,users.lastname,users.firstname,users.secondname
order by internally ASC
";
if($debug) echo $q1." ";
$q2="SELECT intnumber, name from intphones order by intnumber ASC";
if($debug) echo $q2." ";
$conn->setFetchMode(ADODB_FETCH_NUM);
if(isset($cacheflush) && $cacheflush) $res1 = $conn->CacheFlush($q1);
$res1 = $conn->CacheExecute($q1);
if ($res1 && $res1->RecordCount() > 0) {
while (!$res1->EOF) {
$mamba=$res1->fields;
$allIntern[]=array(0 => $mamba[0],2 => $mamba[1],3 => $mamba[2],4 => $mamba[3]);
$res1->MoveNext();
}
}
$conn->setFetchMode(ADODB_FETCH_NUM);
if(isset($cacheflush) && $cacheflush) $res = $conn->CacheFlush($q2);
$res = $conn->CacheExecute($q2);
if ($res && $res->RecordCount() > 0) {
while (!$res->EOF) {
$allRows[]=$res->fields;
$res->MoveNext();
}
}
if(!empty($allIntern)){
while (list($k, $v) = each($allIntern)) {
if(!empty($allRows)){
reset($allRows);
while (list($ke, $va) = each($allRows)) {
if ($v[0]==$va[0]){
$dobavit=FALSE;
break;
}else{
$dobavit=TRUE;
}
}
}else{
$dobavit=TRUE;
}
if($dobavit){
$allRows[]=$v;
}
}
}
if(!empty($allRows)){
reset($allRows);
ksort($allRows);
}
echo "
";
include("../include/set/footer.html");
?>
|