Example #1
0
function setHistory($options = array())
{
    $defaultOptions = array();
    $defaultOptions['page_name'] = '';
    $defaultOptions['action_type'] = '';
    $defaultOptions['table'] = '';
    $defaultOptions['id_name'] = 'id';
    $defaultOptions['id_value'] = '';
    $defaultOptions['remote'] = false;
    $defaultOptions['pname'] = '';
    $options = array_merge($defaultOptions, $options);
    extract($options);
    $localcn = connectDB();
    $user_id = $_SESSION['UserID'];
    $user_name = $_SESSION['UserName'];
    if ($localcn == '' || trim($action_type) == '' || trim($table) == '' || trim($id_value) == '' || trim($remote) == true && trim($pname) == '' || trim($action_type) != "add" && trim($action_type) != "delete" && trim($action_type) == 'edit') {
        return false;
    }
    $connection_string = $localcn;
    $remote_name = NULL;
    if ($remote === true) {
        $remoteCn = remote_connectDB($pname);
        $connection_string = $remoteCn;
        $remote_name = $pname;
    }
    $qry = "Select * from `{$table}` where {$id_name} = '{$id_value}'";
    $res = Sql_exec($connection_string, $qry);
    $result = Sql_fetch_assoc($res);
    $value_json = json_encode($result);
    if ($remoteCn) {
        ClosedDBConnection($remoteCn);
        rollback_main_connectDB();
    }
    if ($action_type == 'update') {
        $comments = 'Updated !';
    } elseif ($action_type == 'add') {
        $comments = 'Inserted !';
    }
    $row_value = $value_json;
    $action_command = $action_type;
    if ($page_name == "") {
        $page_name = $table;
    }
    $table_name = $table;
    $action_date = date("Y-m-d", strtotime("now"));
    $action_time = date("H:i:s", strtotime("now"));
    $ip_address = $_SERVER['REMOTE_ADDR'];
    $browser = $_SERVER['HTTP_USER_AGENT'];
    $referrer = $_SERVER['HTTP_REFERER'];
    $qry = "INSERT INTO tbl_audit_trail (user_id,user_name,action_command,pname,page_name,table_name,primary_key_column,action_date,action_time,rowvalue,comments,ip_address,browser,referer) VALUES";
    $qry .= "('{$user_id}','{$user_name}','{$action_command}','{$remote_name}','{$page_name}','{$table_name}','{$id_name}','{$action_date}','{$action_time}','{$row_value}','{$comments}','{$ip_address}','{$browser}', '{$referrer}');";
    $result = Sql_exec($localcn, $qry);
    $insert_id = Sql_insert_id($localcn);
    return $insert_id;
}
 function DEL()
 {
     $code_parametre = $this->code_parametre;
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "sys_parametres\n                WHERE code_parametre = '{$code_parametre}'\n                AND id_utilisateur = {$id_utilisateur}";
     if (!Sql_exec($sql)) {
         $this->setError(ERROR);
     }
     if (!$this->isError()) {
         Lib_sqlLog($sql);
     }
     return;
 }
 function DEL()
 {
     $nom_utilisateur = $this->nom_utilisateur;
     $adresse_ip = $this->adresse_ip;
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "sys_ip_interdictions\n\t\t\t\t\t WHERE adresse_ip = '{$adresse_ip}'\n\t\t\t\t\t AND nom_utilisateur = '{$nom_utilisateur}'\n\t\t\t\t\t LIMIT 1";
     if (!Sql_exec($sql)) {
         $this->setError(ERROR);
     }
     if (!$this->isError()) {
         Lib_sqlLog($sql);
     }
     return;
 }
 function DEL()
 {
     if ($this->id_groupe == "" || $this->adresse_ip == "") {
         trigger_error("L'autorisation ne peut être supprimée sans groupe ni adresse IP!", E_USER_ERROR);
         return NULL;
     }
     $id_groupe = $this->id_groupe;
     $adresse_ip = $this->adresse_ip;
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "sys_ip_autorisations\n\t\t\t\t\t WHERE id_groupe = {$id_groupe}\n\t\t\t\t\t AND adresse_ip = '{$adresse_ip}'\n\t\t\t\t\t LIMIT 1";
     if (!Sql_exec($sql)) {
         $this->setError(ERROR);
     }
     if (!$this->isError()) {
         Lib_sqlLog($sql);
     }
     return;
 }
Example #5
0
try {
    $res = Sql_exec($cn, $qry);
    $is_error = 0;
} catch (Exception $e) {
    $is_error = 1;
}
if ($is_error == 1) {
    $return_data = array('status' => false, 'message' => 'Submission Failed');
} else {
    $return_data = array('status' => true, 'message' => $msg);
}
echo json_encode($return_data);
$qry_inbound = "SELECT `ip_address`,`port`,`ep_type`,`user_name`,`password` FROM tbl_softswitch_gateway WHERE `name`='{$soft_inbound_gw}'";
$qry_outbound = "SELECT `ip_address`,`port`,`auth` FROM tbl_softswitch_gateway WHERE `name`='{$soft_outbound_gw}'";
$res_inbound = Sql_exec($cn, $qry_inbound);
$res_outbound = Sql_exec($cn, $qry_outbound);
$data = array();
$data1 = array();
$data2 = array();
$i = 0;
while ($row_inbound = Sql_fetch_array($res_inbound)) {
    $j = 0;
    $data[$i][$j++] = Sql_Result($row_inbound, "ep_type");
    $data[$i][$j++] = Sql_Result($row_inbound, "ip_address");
    $data[$i][$j++] = Sql_Result($row_inbound, "port");
    $data[$i][$j++] = Sql_Result($row_inbound, "user_name");
    $data[$i][$j++] = Sql_Result($row_inbound, "password");
    $i++;
}
$i = 0;
while ($row_outbound = Sql_fetch_array($res_outbound)) {
    if ($function_point != null && $function_point != '' && $function_point != 'null') {
        $count_qry .= " AND `function_point` LIKE '%" . $function_point . "%' ";
        //$load_qry 	.= " AND `function_point` LIKE '%".$function_point."%' ";
    }
    if ($comment != null && $comment != '' && $comment != 'null') {
        $count_qry .= " AND `comment` LIKE '%" . $comment . "%' ";
        //$load_qry 	.= " AND `comment` LIKE '%".$comment."%' ";
    }
    if ($sip != null && $sip != '' && $sip != 'null') {
        $count_qry .= " AND `sip` LIKE '%" . $sip . "%' ";
        //$load_qry 	.= " AND `sip` LIKE '%".$sip."%' ";
    }
    $key = 'id';
    $extraBtn = false;
}
$res = Sql_exec($cn, $count_qry);
while ($row = Sql_fetch_array($res)) {
    $j = 0;
    $data_[$i][$j++] = Sql_Result($row, "sender_type");
    $data_[$i][$j++] = Sql_Result($row, "log_type");
    $data_[$i][$j++] = Sql_Result($row, "submit_time");
    $data_[$i][$j++] = Sql_Result($row, "submit_time_to");
    $data_[$i][$j++] = Sql_Result($row, "log_time");
    $data_[$i][$j++] = Sql_Result($row, "log_to_time");
    $data_[$i][$j++] = Sql_Result($row, "fromId");
    $data_[$i][$j++] = Sql_Result($row, "toId");
    $data_[$i][$j++] = Sql_Result($row, "user_type");
    $data_[$i][$j++] = Sql_Result($row, "source_ip");
    $data_[$i][$j++] = Sql_Result($row, "source_port");
    $data_[$i][$j++] = Sql_Result($row, "functionName");
    $data_[$i][$j++] = Sql_Result($row, "audio_ip");
if ($function_point != null && $function_point != '' && $function_point != 'null') {
    //$count_qry	.= " AND `function_point` LIKE '%".$function_point."%' ";
    $load_qry .= " AND `function_point` LIKE '%" . $function_point . "%' ";
}
if ($comment != null && $comment != '' && $comment != 'null') {
    //$count_qry	.= " AND `comment` LIKE '%".$comment."%' ";
    $load_qry .= " AND `comment` LIKE '%" . $comment . "%' ";
}
if ($sip != null && $sip != '' && $sip != 'null') {
    //$count_qry	.= " AND `sip` LIKE '%".$sip."%' ";
    $load_qry .= " AND `sip` LIKE '%" . $sip . "%' ";
}
$key = 'id';
$extraBtn = false;
//echo $count_qry;$load_qry;
$res = Sql_exec($remoteCn, $load_qry);
$i = 0;
$data = array();
while ($row = Sql_fetch_array($res)) {
    $j = 0;
    $data[$i] = array();
    $data[$i][$j++] = Sql_Result($row, "log_server_time");
    $data[$i][$j++] = Sql_Result($row, "source");
    $data[$i][$j++] = Sql_Result($row, "type");
    $data[$i][$j++] = Sql_Result($row, "source_timestamp");
    $data[$i][$j++] = Sql_Result($row, "from_user");
    $data[$i][$j++] = Sql_Result($row, "to_user");
    $data[$i][$j++] = Sql_Result($row, "call_id");
    $data[$i][$j++] = Sql_Result($row, "caller_callee");
    $data[$i][$j++] = Sql_Result($row, "source_ip");
    $data[$i][$j++] = Sql_Result($row, "source_port");
Example #8
0
function remote_connectDB($pname, $pname_field = 'pname', $table_name = 'tbl_process_db_access')
{
    $cn = connectDB();
    $remoteCnQry = "select * from {$table_name} where {$pname_field}='{$pname}'";
    $res = Sql_exec($cn, $remoteCnQry);
    $dt = Sql_fetch_array($res);
    global $dbtype;
    global $UserID;
    global $Password;
    global $Server;
    global $Database;
    global $temp_dbtype;
    global $temp_UserID;
    global $temp_Password;
    global $temp_Server;
    global $temp_Database;
    $temp_dbtype = $dbtype;
    $temp_UserID = $UserID;
    $temp_Password = $Password;
    $temp_Server = $Server;
    $temp_Database = $Database;
    $dbtype = $dt['db_type'];
    $Server = $dt['db_server'];
    $UserID = $dt['db_uid'];
    $Password = $dt['db_password'];
    $Database = $dt['db_name'];
    ClosedDBConnection($cn);
    $cn = connectDB();
    return $cn;
}
Example #9
0
function News_insert($data)
{
    $sql = "INSERT INTO messages (dt, news, text) VALUES\n\t('" . date('Y-m-d H:i:s') . "', '" . $data['news'] . "', '" . $data['text'] . "')";
    //echo $sql;die; //отладка
    Sql_exec($sql);
}
Example #10
0
if (isset($data['server_id']) && $data['server_id'] && isset($data['service_id']) && $data['service_id']) {
    $cn = connectDB();
    $server_id = mysql_real_escape_string(htmlspecialchars($data['server_id']));
    $service_id = mysql_real_escape_string(htmlspecialchars($data['service_id']));
    $qry = "SELECT * FROM tbl_obd_server_config WHERE id='{$server_id}'";
    $res = Sql_exec($cn, $qry);
    $dt = Sql_fetch_array($res);
    $dbtype = $dt['db_type'];
    $Server = $dt['db_server'];
    $UserID = $dt['db_user'];
    $Password = $dt['db_password'];
    $Database = $dt['db_name'];
    ClosedDBConnection($cn);
    $remoteConnection = connectDB();
    $qry = "SELECT OutDialStatus, COUNT(*) as num FROM outdialque WHERE UserId='{$service_id}' GROUP BY OutDialStatus ORDER BY OutDialStatus ASC";
    $result = Sql_exec($remoteConnection, $qry);
    if (!$result) {
        echo "err+" . $qry . " in line " . __LINE__ . " of file" . __FILE__;
        exit;
    }
    $data = array();
    $i = 0;
    while ($row = Sql_fetch_array($result)) {
        $j = 0;
        $data[$i][$j++] = Sql_Result($row, "OutDialStatus");
        $data[$i][$j++] = Sql_Result($row, "num");
        if (Sql_Result($row, "OutDialStatus") == "QUE") {
            $data[$i][$j++] = '<span  onclick="stop_obd_operation(this,' . "'" . Sql_Result($row, "OutDialStatus") . "'" . '); return false;">&nbsp;<img style="position: relative; cursor: pointer; top: 4px" width="16" height="16" border="0" src="rcportal/img/stop.png" ></span>';
        } else {
            $data[$i][$j++] = '<span onclick="download_obd_dashboard(this,' . "'" . Sql_Result($row, "OutDialStatus") . "'" . '); return false;">&nbsp;<img style="position: relative; cursor: pointer; top: 4px" width="16" height="16" border="0" src="rcportal/img/download.png" ></span>';
        }
Example #11
0
<?php

require_once "../lib/common.php";
$remoteCn = remote_connectDB('ISMP');
$qry = "SELECT \t`app_id`,`app_name`,`config` FROM `tbl_smsgw_config` WHERE `app_id` = 1 AND `app_name` = 'smsgw'";
$res = Sql_exec($remoteCn, $qry);
$dt = Sql_fetch_array($res);
$decode = $dt['config'];
$decode = json_decode($decode, true);
$data = array();
foreach ($decode as $key => $val) {
    $data[$key] = $val;
}
$data['action_id'] = $dt['app_id'];
echo json_encode($data);
ClosedDBConnection($remoteCn);
 /**
 	Cette fonction supprime un chantier de la BDD.
 */
 function DEL()
 {
     if ($this->isError()) {
         return;
     }
     $id_post_auteur = $this->id_post_auteur;
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "post_auteur\n\t\t\t\tWHERE id_post_auteur = {$id_post_auteur}";
     if (!Sql_exec($sql)) {
         $this->setError(ERROR);
     }
     if (!$this->isError()) {
         Lib_sqlLog($sql);
     }
     return;
 }
<?php

include_once "../lib/common.php";
$cn = connectDB();
$arrayInput = array();
//$res = Sql_exec($cn,$remoteCnQry);
//$dt = Sql_fetch_array($res);
$query = "select * FROM tbl_ch_server_info";
$result = Sql_exec($cn, $query);
if (!$result) {
    echo "err+" . $query . " in line " . __LINE__ . " of file" . __FILE__;
    exit;
}
$data = array();
$i = 0;
while ($row = Sql_fetch_array($result)) {
    $j = 0;
    $data[$i][$j++] = Sql_Result($row, "server_name");
    $data[$i][$j++] = Sql_Result($row, "db_type");
    $data[$i][$j++] = Sql_Result($row, "database_server");
    $data[$i][$j++] = Sql_Result($row, "user_id");
    $data[$i][$j++] = Sql_Result($row, "database_password");
    $data[$i][$j++] = Sql_Result($row, "database_name");
    $data[$i][$j++] = Sql_Result($row, "prompt_location");
    $data[$i][$j++] = Sql_Result($row, "url");
    $data[$i][$j++] = Sql_Result($row, "recording_location");
    $data[$i][$j++] = '<span  onclick="edit_input_form_ivr_server_info(this,' . "'" . Sql_Result($row, "server_name") . "'" . '); return false;"  > &nbsp;<img style="position: relative; cursor: pointer; top: 4px" width="16" height="16" border="0" src="rcportal/img/pen.png" >
</span>' . '<span    " onclick="delete_ivr_server_info(this,' . "'" . Sql_Result($row, "server_name") . "'" . '); return false;"  > &nbsp;<img style="position: relative; cursor: pointer; top: 4px" width="16" height="16" border="0" src="rcportal/img/cancel.png" >
</span>';
    $i++;
}
Example #14
0
function Photo_insert($data)
{
    $sql = "INSERT INTO images (title, path) VALUES\n            ('" . $data['title'] . "','" . $data['image'] . "')";
    Sql_exec($sql);
}
Example #15
0
$Server = $dt['db_server'];
$UserID = $dt['db_uid'];
$Password = $dt['db_password'];
$Database = $dt['db_name'];
ClosedDBConnection($cn);
$text = '';
$encodedMsg = rawurlencode($msg);
$encodedMsg = str_replace('.', '%2E', $encodedMsg);
$text .= $dstMN . '|' . $encodedMsg;
$count_qry = "select count(UserID) as c_user from `user` where `UserName`= '" . $_SESSION["UserID"] . "'";
$insert_qry = "insert into `user` (`UserName`,`Password`) values ('" . $_SESSION["UserID"] . "','ssdt')";
$remoteCn = connectDB();
$rs = Sql_exec($remoteCn, $count_qry);
$dt = Sql_fetch_array($rs);
$c_user = intval($dt['c_user']);
if ($c_user == 0) {
    Sql_exec($remoteCn, $insert_qry);
}
ClosedDBConnection($remoteCn);
$url = $single_sms_url . "UserName="******"UserID"] . "&Password=ssdt&Sender=";
//"http://localhost/SendSMS/sendSingleSMS.php?UserName=admin&Password=admin&Sender=1234&text=";
$url .= $srcMN;
$url .= "&text=" . $text;
//$url .="&NO=".$count;
//echo $url;
$response = file_get_contents($url);
if (trim($response) == trim("Successfully inserted to smsoutbox")) {
    echo 0;
} else {
    echo 1;
}
 /**
 Cette fonction supprime un objet Galerie de la BDD.
 */
 function DEL()
 {
     if ($this->isError()) {
         return;
     }
     $id_galerie = $this->id_galerie;
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "galeries\n\t\t\t\t\t WHERE id_galerie = {$id_galerie}";
     if (!Sql_exec($sql)) {
         $this->setError(ERROR);
     }
     if (!$this->isError()) {
         Lib_sqlLog($sql);
     }
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "galeries_lang\n\t\t\t\t\t WHERE id_galerie = {$id_galerie}";
     Sql_exec($sql);
     Lib_sqlLog($sql);
     return;
 }
Example #17
0
<?php

session_start();
include_once "../lib/common.php";
$user_id = $_SESSION["USER_ID"];
$cn = connectDB();
$qry = "SELECT \n\t\t\t\ta.id,\n\t\t\t\tb.name, \n\t\t\t\ta.service_id, \n\t\t\t\ta.display_no, \n\t\t\t\ta.original_no, \n\t\t\t\ta.schedule_date, \n\t\t\t\ta.prompt_location,\n\t\t\t\t(SELECT NAME FROM tbl_obd_server_config WHERE id=a.id_operator_distribution) as distribution_list,\n\t\t\t\ta.status\n \t\tFROM tbl_obd_instance_list a \n\t\tINNER JOIN \n\t\ttbl_obd_server_config b \n\t\tON a.server_id=b.id \n\t\tWHERE a.user_id='{$user_id}'";
$result = Sql_exec($cn, $qry);
if (!$result) {
    echo "err+" . $qry . " in line " . __LINE__ . " of file" . __FILE__;
    exit;
}
if (Sql_Num_Rows($result) > 0) {
    $data = array();
    $i = 0;
    while ($row = Sql_fetch_array($result)) {
        $j = 0;
        $data[$i][$j++] = Sql_Result($row, "id");
        $data[$i][$j++] = Sql_Result($row, "name");
        $data[$i][$j++] = Sql_Result($row, "service_id");
        $data[$i][$j++] = Sql_Result($row, "display_no");
        $data[$i][$j++] = Sql_Result($row, "original_no");
        $data[$i][$j++] = Sql_Result($row, "schedule_date");
        $data[$i][$j++] = Sql_Result($row, "prompt_location");
        $data[$i][$j++] = Sql_Result($row, "distribution_list");
        if (Sql_Result($row, "status") == 0) {
            $data[$i][$j++] = "Open";
        } elseif (Sql_Result($row, "status") == 1) {
            $data[$i][$j++] = "Cancelled";
        } else {
            $data[$i][$j++] = "Closed";
         fwrite($file, trim(Sql_Result($row, "e_allowedPort")) . " ");
         fwrite($file, trim(Sql_Result($row, "e_fwdib")) . " ");
         fwrite($file, trim(Sql_Result($row, "e_fwdiu")) . " ");
         fwrite($file, trim(Sql_Result($row, "e_fwdina")) . " ");
         fwrite($file, trim(Sql_Result($row, "e_rbtno")) . " ");
         fwrite($file, trim(Sql_Result($row, "e_mcaNo")) . " ");
         fwrite($file, trim(Sql_Result($row, "e_status")) . " ");
         fwrite($file, trim(Sql_Result($row, "e_aaaIp")) . " ");
         fwrite($file, trim(Sql_Result($row, "e_aaaPort")) . " ");
         fwrite($file, trim(Sql_Result($row, "e_noOAS")) . "\n");
         $is_error = 1;
     }
 } else {
     if ($update == 2) {
         $qry_file = "SELECT * FROM `tbl_ippbx_extensions` where `is_active`='active'";
         $result = Sql_exec($cn, $qry_file);
         $file = fopen($file_name, "w");
         while ($row = Sql_fetch_array($result)) {
             fwrite($file, trim(Sql_Result($row, "e_userId")) . " ");
             fwrite($file, trim(Sql_Result($row, "e_password")) . " ");
             fwrite($file, trim(Sql_Result($row, "e_userType")) . " ");
             fwrite($file, trim(Sql_Result($row, "e_hwNo")) . " ");
             fwrite($file, trim(Sql_Result($row, "e_allowedIp")) . " ");
             fwrite($file, trim(Sql_Result($row, "e_allowedPort")) . " ");
             fwrite($file, trim(Sql_Result($row, "e_fwdib")) . " ");
             fwrite($file, trim(Sql_Result($row, "e_fwdiu")) . " ");
             fwrite($file, trim(Sql_Result($row, "e_fwdina")) . " ");
             fwrite($file, trim(Sql_Result($row, "e_rbtno")) . " ");
             fwrite($file, trim(Sql_Result($row, "e_mcaNo")) . " ");
             fwrite($file, trim(Sql_Result($row, "e_status")) . " ");
             fwrite($file, trim(Sql_Result($row, "e_aaaIp")) . " ");
Example #19
0
$filename = "White_LIST_" . date('Ymd') . ".csv";
header("Content-Disposition: attachment; filename=\"{$filename}\"");
header("Content-Type: application/vnd.ms-excel");
$user_id = $_SESSION['USER_ID'];
//	$server_id = $_GET['action_id'];
$action_id = $_GET['action_id'];
$arr = explode("S", $action_id);
$server_id = $arr[1];
$arr[0] = str_replace('D', '-', $arr[0]);
$arr[0] = str_replace('T', ' ', $arr[0]);
$time_stamp = str_replace('C', ':', $arr[0]);
// 	$qry = "SELECT `msisdn` FROM `tbl_obd_dnd_list` WHERE `user_id`='".$user_id."' AND `server_id` ='".$server_id."'";
$qry = "SELECT `msisdn` FROM `tbl_obd_white_list` WHERE `server_id` ='" . $server_id . "' AND `time_stamp`='" . $time_stamp . "'";
$count = 0;
try {
    $data = Sql_exec($cn, $qry);
    while ($dt = Sql_fetch_array($data)) {
        $arr = array();
        $arr[0] = $dt[0];
        $v_arr[$count] = $arr;
        $count++;
    }
} catch (Exception $e) {
    $is_error = 1;
    array_push($err_field, $qry);
}
ClosedDBConnection($cn);
//$fp = fopen('php://output', 'w');
if ($v_arr != null && $v_arr != "") {
    foreach ($v_arr as $row) {
        echo implode("\t", $row) . "\r\n";
Example #20
0
<?php

require_once "../lib/common.php";
require_once "../lib/filewriter.php";
$remoteCn = remote_connectDB('ISMP');
$info = $_POST['info'];
$action_id = $info['action_id'];
// unset unnessary filed from array
unset($info['action_id']);
$qry = "SELECT \t`app_id`,`app_name`,`config` FROM `tbl_smsgw_config` WHERE `app_id` = '{$action_id}' AND `app_name` = 'smsgw'";
$res = Sql_exec($remoteCn, $qry);
$dt = Sql_fetch_array($res);
$config_str_json = trim($dt['config']);
$assoc_array = json_decode($config_str_json, true);
foreach ($info as $key => $value) {
    if (array_key_exists($key, $assoc_array)) {
        $assoc_array[$key] = $value;
    }
}
$json_str = json_encode($assoc_array);
$is_error = 0;
$update_config_str = "UPDATE `tbl_smsgw_config` SET `config` = '{$json_str}' WHERE `app_id` = '{$action_id}'";
try {
    Sql_exec($remoteCn, $update_config_str);
    $is_error = file_writer_smsgw_configuration($assoc_array);
} catch (Exception $e) {
    $is_error = 1;
}
echo $is_error;
ClosedDBConnection($remoteCn);
 * User: Shiam
 * Date: 5/18/2015
 * Time: 4:18 PM
 */
require_once "../lib/config.php";
require_once "../lib/common.php";
global $dir_call_handler_test;
global $dir_call_handler_production;
$cn = connectDB();
$arrayInput = $_REQUEST;
$filename_1 = $dir_call_handler_test . "vsdp.ini";
$filename_2 = $dir_call_handler_production . "vsdp.ini";
$file = fopen($filename_1, "w");
fwrite($file, "");
fclose($file);
$file = fopen($filename_2, "w");
fwrite($file, "");
fclose($file);
$file1 = fopen($filename_1, "a");
$file2 = fopen($filename_2, "a");
foreach ($arrayInput as $k => $v) {
    /*echo "$k -> $v";*/
    fwrite($file1, $k . '->' . trim($v) . "\n");
    fwrite($file2, $k . '->' . trim($v) . "\n");
}
$config_text = json_encode($arrayInput);
$time_now = date("Y-m-d H:i:s");
$sql = "insert into `tbl_app_configuration` (applicaiton,component,config_text,updated) VALUES ('call_handler','vsdp','" . $config_text . "','" . $time_now . "')";
Sql_exec($cn, $sql);
fclose($file1);
fclose($file2);
 function DEL()
 {
     $id_utilisateur = $this->id_utilisateur;
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "sys_utilisateurs\n\t\t\t\t\tWHERE id_utilisateur = {$id_utilisateur}\n\t\t\t\t\tAND effacable = '1'";
     if (!Sql_exec($sql)) {
         $this->setError(ERROR);
     }
     if (!$this->isError()) {
         Lib_sqlLog($sql);
     }
     // Puis on supprime tous les droits
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "sys_utilisateurs_droits\n\t\t\t\t\tWHERE id_utilisateur = {$id_utilisateur}";
     Sql_exec($sql);
     Lib_sqlLog($sql);
     return;
 }
Example #23
0
 function DEL()
 {
     $id_groupe = $this->id_groupe;
     $nom_groupe = $this->nom_groupe;
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "sys_groupes\n                WHERE id_groupe = {$id_groupe}\n                AND effacable = '1'";
     Sql_exec($sql);
     Lib_sqlLog($sql);
     // Puis on supprime tous les modules
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "sys_groupes_modules\n                WHERE nom_groupe = '{$nom_groupe}'";
     Sql_exec($sql);
     Lib_sqlLog($sql);
     // Puis on supprime tous les droits
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "sys_groupes_droits\n                WHERE nom_groupe = '{$nom_groupe}'";
     Sql_exec($sql);
     Lib_sqlLog($sql);
     return;
 }
 /**
 	Cette fonction supprime un chantier de la BDD.
 */
 function DEL()
 {
     if ($this->isError()) {
         return;
     }
     $util = Utilisateur_recuperer($this->id_utilisateur);
     $util->DEL();
     $id_adherent = $this->id_adherent;
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "adherent A, " . $GLOBALS['prefix'] . "sys_utilisateurs S\n\t\t\t\tWHERE id_adherent = {$id_adherent}\n\t\t\t\tAND A.id_utilisateur = U.id_utilisateur";
     if (!Sql_exec($sql)) {
         $this->setError(ERROR);
     }
     if (!$this->isError()) {
         Lib_sqlLog($sql);
     }
     return;
 }
if ($action == "update") {
    $msg = "Successfully Updated";
    $action_id = mysql_real_escape_string(htmlspecialchars($_REQUEST['action_id']));
    $qry = "update {$tbl} set dial_plan_context='{$dial_plan_context}', last_updated='{$last_updated}', last_updated_by='{$last_updated_by}'";
    $qry .= " where id='{$action_id}'";
} elseif ($action == "delete") {
    $action_id = $deleted_id;
    $qry = "update {$tbl} set is_active='inactive'";
    $qry .= " where id='{$action_id}'";
    $msg = "Successfully Deleted";
} else {
    $msg = "Successfully Saved";
    $qry = "insert into {$tbl} (dial_plan_context,last_updated,last_updated_by,is_active) values ('{$dial_plan_context}','{$last_updated}','{$last_updated_by}','active')";
}
try {
    $res = Sql_exec($cn, $qry);
    if ($action != "delete") {
        if ($action == "update") {
            $options['cn'] = $cn;
            $options['page_name'] = "Softswitch Dial Plan Context Setting";
            $options['action_type'] = $action;
            $options['table'] = "tbl_ippbx_dialplan_context";
            $options['id_value'] = $action_id;
            setHistory($options);
        } else {
            $action_id = Sql_insert_id($cn);
            $action = 'add';
            $options['cn'] = $cn;
            $options['page_name'] = "Softswitch Dial Plan Context Setting";
            $options['action_type'] = $action;
            $options['table'] = "tbl_ippbx_dialplan_context";
Example #26
0
/**
* - Cas Install_Installer :
* . 
*		Le cas Install_Installer patati patata....
*/
function Install_Installer($data_in = array())
{
    global $lang, $MSG, $data_in, $data_out, $data_srv, $catalogue, $ip;
    $continue = true;
    //-------------------------------------------------
    // Tout d'abord, on verifie si le user existe deja
    //-------------------------------------------------
    Lib_myLog("Tentative de connexion avec l'utilisateur " . $data_in['login']);
    $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeConnexionUser%%'] . " " . $data_in['login'];
    $db_link = @mysql_connect($data_in['serveur'], $data_in['login'], $data_in['mdp']);
    if ($db_link) {
        Lib_myLog("Connexion reussie");
        $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeConnexionUserOK%%'];
    } else {
        Lib_myLog("Erreur de connexion");
        $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeConnexionUserKO%%'];
    }
    //-------------------------------------------------
    // On essaye d'ouvrir la base
    //-------------------------------------------------
    if ($continue) {
        Lib_myLog("Tentative d'ouverture de la base de donnees");
        $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeConnexionBase%%'];
        $res = @mysql_select_db($data_in['bdd']);
        if ($res) {
            Lib_myLog("Ouverture reussie");
            $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeConnexionBaseOK%%'];
        } else {
            Lib_myLog("Erreur d'ouverture");
            $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeConnexionBaseKO%%'] . ": " . mysql_error();
            $continue = false;
        }
    }
    //-------------------------------------------------
    // Maintenant que la base est ouverte, on essaye de creer les tables systeme
    //-------------------------------------------------
    if ($continue) {
        Lib_myLog("Tentative de creation des tables systeme");
        $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeCreationTablesSysteme%%'];
        $sql_file = "dilasys_MDD.sql";
        $sizes_array = Sql_getSqlLenghts($sql_file);
        $handle = @fopen($sql_file, "r");
        foreach ($sizes_array as $size_unit) {
            $sql_query = @fread($handle, $size_unit);
            if ($sql_query != '') {
                if (get_magic_quotes_runtime() == 1) {
                    $sql_query = stripslashes($sql_query);
                }
                $sql_query = trim($sql_query);
                $sql_query = Sql_getSqlTxt($sql_query);
                $sql_query = preg_replace("`%%prefix%%`", $data_in['prefix'], $sql_query);
                $result = Sql_exec($sql_query);
                if (!$result) {
                    $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeCreationTablesSystemeKO%%'] . ": " . mysql_error();
                    $continue = false;
                    break;
                }
            }
        }
    }
    if ($continue) {
        Lib_myLog("Creation tables systeme reussie");
        $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeCreationTablesSystemeOK%%'];
        Lib_myLog("Tentative de creation des autres tables");
        $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeCreationTablesAutres%%'];
        $sql_file = "./config/MDD.sql";
        $sizes_array = Sql_getSqlLenghts($sql_file);
        $handle = @fopen($sql_file, "r");
        foreach ($sizes_array as $size_unit) {
            $sql_query = fread($handle, $size_unit);
            if ($sql_query != '') {
                if (get_magic_quotes_runtime() == 1) {
                    $sql_query = stripslashes($sql_query);
                }
                $sql_query = trim($sql_query);
                $sql_query = Sql_getSqlTxt($sql_query);
                $sql_query = preg_replace("`%%prefix%%`", $data_in['prefix'], $sql_query);
                $result = Sql_exec($sql_query);
                if (!$result) {
                    $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeCreationTablesAutresKO%%'] . ": " . mysql_error();
                    $continue = false;
                    break;
                }
            }
        }
    }
    if ($continue) {
        Lib_myLog("Creation autres tables reussie");
        $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeCreationTablesAutresOK%%'];
        Lib_myLog("Ajout des modules autorises");
        $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeAjoutModulesAutorises%%'];
        $sql_file = "./config/modules.sql";
        $sizes_array = Sql_getSqlLenghts($sql_file);
        $handle = fopen($sql_file, "r");
        foreach ($sizes_array as $size_unit) {
            $sql_query = fread($handle, $size_unit);
            if ($sql_query != '') {
                if (get_magic_quotes_runtime() == 1) {
                    $sql_query = stripslashes($sql_query);
                }
                $sql_query = trim($sql_query);
                $sql_query = Sql_getSqlTxt($sql_query);
                $sql_query = preg_replace("`%%prefix%%`", $data_in['prefix'], $sql_query);
                $result = Sql_exec($sql_query);
                if (!$result) {
                    $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeAjoutModulesAutorisesKO%%'] . ": " . mysql_error();
                    $continue = false;
                    break;
                }
            }
        }
    }
    if ($continue) {
        Lib_myLog("Ajout des modules autorises reussi");
        $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeAjoutModulesAutorisesOK%%'];
    }
    //-------------------------------------------------
    // On cree le fichier de conf
    //-------------------------------------------------
    if ($continue) {
        Lib_myLog("Configuration du fichier de conf");
        $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeConfigurationConf%%'];
        $conf = file('dilasys_conf.txt');
        $conf = implode($conf, "");
        $Out = preg_replace("`%%bdd%%`", $data_in['bdd'], $conf);
        $Out = preg_replace("`%%login%%`", $data_in['login'], $Out);
        $Out = preg_replace("`%%mdp%%`", $data_in['mdp'], $Out);
        $Out = preg_replace("`%%serveur%%`", $data_in['serveur'], $Out);
        $Out = preg_replace("`%%prefix%%`", $data_in['prefix'], $Out);
        $Out = preg_replace("`%%instance%%`", $data_in['instance'], $Out);
        $Out = preg_replace("`%%sgbd%%`", $data_in['sgbd'], $Out);
        $Out = preg_replace("`%%phrase%%`", $data_in['phrase'], $Out);
        $Out = preg_replace("`\r\n`", "\n", $Out);
        Lib_myLog("Creation du fichier conf pour la partie privee (administration)");
        $handle = fopen('../conf.php', 'w+');
        fwrite($handle, $Out);
        fclose($handle);
        Lib_myLog("Configuration terminee");
        $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeConfigurationConfOK%%'];
    }
    //-------------------------------------------------
    // On cree le fichier de params
    //-------------------------------------------------
    if ($continue) {
        Lib_myLog("Configuration du fichier params");
        $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeConfigurationParams%%'];
        $conf = file('dilasys_params.txt');
        $conf = implode($conf, "");
        $Out = preg_replace("`%%bdd%%`", $data_in['bdd'], $conf);
        $Out = preg_replace("`\r\n`", "\n", $Out);
        $var = "";
        foreach ($GLOBALS['auth_modules'] as $module) {
            $var .= "\"{$module}\",\n";
        }
        $Out = preg_replace("`%%modules%%`", $var, $Out);
        $var = "";
        if (isset($GLOBALS['auth_tables'])) {
            foreach ($GLOBALS['auth_tables'] as $table) {
                $var .= "\"" . $table . "\",\n";
            }
        }
        $Out = preg_replace("`%%tables%%`", $var, $Out);
        Lib_myLog("Creation du fichier params");
        $handle = fopen('../params.php', 'w+');
        fwrite($handle, $Out);
        fclose($handle);
        Lib_myLog("Configuration terminee");
        $data_out['etapes'][] = $MSG[$lang]['%%Action_EtapeConfigurationParamsOK%%'];
    }
    if ($continue) {
        // Sinon, message d'erreur indiquant qu'il n'est pas possible d'installer le systeme avec ce user
        $data_out['message'] = "Installation réussie !";
        $data_out['page'] = "Install_Resultat.php";
    } else {
        $data_out['message'] = "MEEEEEEEEEEEEERDE!!!";
        $data_out['page'] = "Install_Resultat.php";
    }
}
Example #27
0
 /**
 Cette fonction supprime un arbo de la BDD.
 */
 function DEL()
 {
     if ($this->isError()) {
         return;
     }
     $id_arbo = $this->id_arbo;
     $sql = " DELETE FROM " . $GLOBALS['prefix'] . "arbo\n\t\t\t\t\tWHERE id_arbo = {$id_arbo}";
     if (!Sql_exec($sql)) {
         $this->setError(ERROR);
     }
     if (!$this->isError()) {
         Lib_sqlLog($sql);
     }
     return;
 }
 $remoteCnQry = "select db_type,db_server,db_uid,db_password,db_name from `tbl_ch_server_info` where id='{$serverid}'";
 //$remoteCnQry="select * from tbl_process_db_access where pname='CH'";
 $res = Sql_exec($cn, $remoteCnQry);
 $dt = Sql_fetch_array($res);
 $dbtype = $dt['db_type'];
 $Server = $dt['db_server'];
 $UserID = $dt['db_uid'];
 $Password = $dt['db_password'];
 $Database = $dt['db_name'];
 ClosedDBConnection($cn);
 //echo "asdasd";
 $remoteCn = connectDB();
 $service_id = mysql_real_escape_string(htmlspecialchars($data['service_id']));
 $page_id = mysql_real_escape_string(htmlspecialchars($data['page_id']));
 $query = "SELECT `current_state`,`key_press`,`short_code`,`next_state`,`NextKey`,`Action_command`,`URL`,`play_file` FROM `ivrmenu` where     Service='{$service_id}' and PageName='{$page_id}'";
 $result = Sql_exec($remoteCn, $query);
 if (!$result) {
     echo "err+" . $query . " in line " . __LINE__ . " of file" . __FILE__;
     exit;
 }
 $data = array();
 $i = 0;
 while ($row = Sql_fetch_array($result)) {
     $j = 0;
     $data[$i][$j++] = Sql_Result($row, "current_state");
     $data[$i][$j++] = Sql_Result($row, "key_press");
     $data[$i][$j++] = Sql_Result($row, "short_code");
     $data[$i][$j++] = Sql_Result($row, "next_state");
     $data[$i][$j++] = Sql_Result($row, "NextKey");
     $data[$i][$j++] = Sql_Result($row, "Action_command");
     $data[$i][$j++] = Sql_Result($row, "URL");
Example #29
0
}
if ($action == "update" || $action == "delete") {
    $action_id = mysql_real_escape_string(htmlspecialchars($info['action_id']));
}
//tbl_smsgw_template
$is_error = 0;
$qry = "";
if ($action == "insert") {
    $qry = "INSERT INTO `tbl_smsgw_contact_group` (`group_name`,`last_updated`)VALUES('{$group}',NOW())";
} elseif ($action == "update") {
    $qry = "UPDATE `tbl_smsgw_contact_group` SET `group_name`='{$group}' WHERE `id`='{$action_id}'";
} elseif ($action == "delete") {
    $qry = "UPDATE `tbl_smsgw_contact_group` SET `is_active` = 'inactive' WHERE `is_active`='active' AND `id`='{$action_id}'";
}
try {
    $rs = Sql_exec($cn, $qry);
    if ($action != "delete") {
        if ($action == "update") {
            $options['page_name'] = "Bulk SMS Group";
            $options['action_type'] = $action;
            $options['table'] = "tbl_smsgw_contact_group";
            $options['id_value'] = $action_id;
            setHistory($options);
        } else {
            $action_id = Sql_insert_id($cn);
            $action = 'add';
            $options['page_name'] = "Bulk SMS Group";
            $options['action_type'] = $action;
            $options['table'] = "tbl_smsgw_contact_group";
            $options['id_value'] = $action_id;
            setHistory($options);
<?php

require_once "../lib/common.php";
$is_available = 0;
$cn = connectDB();
$qry = "Select version_name,curr_version,available_version,available_version_name,auto_upgrade from ugw_version.version where is_active='active' limit 0,1";
$rs = Sql_fetch_array(Sql_exec($cn, $qry));
$curr_version = intval($rs['curr_version']);
$available_version = intval($rs['available_version']);
$available_version_name = $rs['available_version_name'];
$version_name = $rs['version_name'];
if ($available_version > $curr_version && $rs['auto_upgrade'] == "yes") {
    $is_available = 1;
} elseif ($rs['auto_upgrade'] == "no") {
    $is_available = 2;
}
echo $is_available . "|" . $available_version_name . "|" . $curr_version . "|" . $available_version . "|" . $version_name;
ClosedDBConnection($cn);