/**
 * \brief Migrate to the uploadtree_a table
 *
 * \param $DryRun Do not create the table, just print the sql.
 *
 * \return 0 on success, 1 on failure
 **/
function Migrate_20_21($DryRun)
{
    // Check if uploadtree_a already inherits from uploadtree.  If so, we are done.
    $sql = "SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_inherits WHERE inhrelid = 'public.uploadtree_a'::regclass::oid);";
    $row = RunSQL($sql, $DryRun);
    /** on fedora 18, the column name is 'exist', on other distritution, it is '?column?' */
    foreach ($row as $exist_key => $exist_value) {
    }
    if (@$exist_value == 't') {
        if ($DryRun) {
            echo __FUNCTION__ . ": Data previously migrated.\n";
        }
        return 0;
        // migration has already happened
    }
    // Is there data in uploadtree?  If so then we need to migrate
    $sql = "select uploadtree_pk from uploadtree limit 1";
    $row = RunSQL($sql, $DryRun);
    if (!empty($row)) {
        echo "Migrating existing uploadtree data.\n";
        // drop uploadtree_a, it was put there by core schema for new installs only.
        $sql = "drop table uploadtree_a";
        RunSQL($sql, $DryRun);
        // rename uploadtree to uploadtree_a
        $sql = "alter table uploadtree rename to uploadtree_a";
        RunSQL($sql, $DryRun);
        // create new uploadtree table
        $sql = "create table uploadtree (like uploadtree_a INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES)";
        RunSQL($sql, $DryRun);
        // Fix the foreign keys that moved when the table was renamed
        $sql = "alter table uploadtree add foreign key (upload_fk) references upload(upload_pk) on delete cascade";
        RunSQL($sql, $DryRun);
    }
    // Fix the forieign keys removed when the table was renamed
    $sql = "SELECT conname from pg_constraint where conname= 'uploadtree_a_upload_fk_fkey';";
    $row = RunSQL($sql, $DryRun);
    if (empty($row)) {
        $sql = "alter table uploadtree_a add foreign key (upload_fk) references upload(upload_pk) on delete cascade";
        RunSQL($sql, $DryRun);
    }
    // fix uploadtree_tablename
    $sql = "update upload set uploadtree_tablename='uploadtree_a' where uploadtree_tablename is null";
    RunSQL($sql, $DryRun);
    // have uploadtreee_a inherit uploadtree
    $sql = "alter table uploadtree_a inherit uploadtree";
    RunSQL($sql, $DryRun);
    return 0;
    // success
}
Example #2
0
<?php 
include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
session_start();
header("Expires: Mon, 20 Jul 2000 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", FALSE);
header("Pragma: no-cache");
set_time_limit(0);
opendb();
$id = str_replace("'", "''", NNull($_GET['id'], ''));
RunSQL("delete from pointsofinterest where id=" . $id);
RunSQL("delete from alarms where poiid=" . $id);
print "GeoFence was successfully deleted !";
closedb();
Example #3
0
<?php 
include "../include/db.php";
include "../include/functions.php";
include "../include/params.php";
include "../include/dictionary2.php";
?>

<?php 
session_start();
header("Content-type: text/html; charset=utf-8");
?>

<?php 
$table = getQUERY("table");
$id = getQUERY("id");
opendb();
RunSQL("delete from " . $table . " where id = " . $id);
if ($table == 'fmCosts') {
    RunSQL("delete from newcosts where costtypeid = " . $id);
}
closedb();
Example #4
0
}
$toobject = nnull(getQUERY("toobj"), "");
$flag = '0';
$delivery = "";
$deliverycoll = "";
if ($action == 'user') {
    $fromid = session("user_id");
    if ($toobject == 'vehicle') {
        $toid = nnull(getQUERY("toid"), "");
        $toid = dlookup("select id from vehicles where gsmnumber='" . $toid . "'");
    } else {
        $flag = '1';
        $toid = nnull(getQUERY("toid"), "");
        $delivery = ", now()";
        $deliverycoll = ", dtdelivery";
    }
    $garminid = dlookup("select coalesce((select garminid from messages where toid=" . $toid . " order by datetime desc limit 1), 0)");
    $garminid = $garminid + 1;
}
$clientid = session("client_id");
$userid = session("user_id");
$datetime = nnull(getQUERY("dt"), now());
//$datetime = now();
$subject = nnull(getQUERY("subject"), "");
$body = nnull(utf8_urldecode(getQUERY("body")), "");
$checked = '0';
RunSQL("INSERT INTO messages (fromid, toobject, toid, clientid, userid, datetime, subject, body, checked, garminid, flag" . $deliverycoll . ") \r\n\t    VALUES (" . $fromid . ", '" . $toobject . "', " . $toid . ", " . $clientid . ", " . $userid . ", \r\n\t    '" . $datetime . "', '" . $subject . "', '" . $body . "', " . $checked . ", " . $garminid . ", '" . $flag . "'" . $delivery . ")");
closedb();
echo $garminid;
//echo 54336;
exit;
Example #5
0
<?php

include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
?>


<?php 
opendb();
$idTocki = str_replace("'", "''", NNull($_GET['selektiraniActive'], ''));
RunSQL("update pointsofinterest set active = B'1' where id in (" . $idTocki . ")");
RunSQL("INSERT INTO poiactivetimestatus(idpoi, active)\n\tSELECT cast(id as integer), '1' active\n\tFROM unnest(string_to_array('" . $idTocki . "',',')) g(id)");
closedb();
Example #6
0
<?php

include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
?>


<?php 
opendb();
$idTocki = str_replace("'", "''", NNull($_GET['selektirani'], ''));
$groupid = str_replace("'", "''", NNull($_GET['groupid'], ''));
RunSQL("update pointsofinterest set groupid = " . $groupid . " where id in (" . $idTocki . ")");
closedb();
Example #7
0
function genInstallationProcessPage($sErrorMessage = '')
{
    global $aConf, $confFirst, $aDbConf, $aGeneral;
    $sAdminName = get_magic_quotes_gpc() ? stripslashes($_REQUEST['admin_username']) : $_REQUEST['admin_username'];
    $sAdminPassword = get_magic_quotes_gpc() ? stripslashes($_REQUEST['admin_password']) : $_REQUEST['admin_password'];
    $resRunSQL = RunSQL($sAdminName, $sAdminPassword);
    $sForm = '';
    if ('done' == $resRunSQL) {
        $sForm = '
            <form action="' . $_SERVER['PHP_SELF'] . '" method="post">
                <input type="submit" value="Next" class="bx-btn bx-btn-primary" />
                <input type="hidden" name="action" value="step5" />
            </form>';
    } else {
        $sForm = $resRunSQL . '
            <form action="' . $_SERVER['PHP_SELF'] . '" method="post">
                <input type="submit" value="Back" class="bx-btn" />';
        foreach ($_POST as $sKey => $sValue) {
            if ($sKey != "action") {
                $sForm .= '<input type="hidden" name="' . $sKey . '" value="' . $sValue . '" />';
            }
        }
        $sForm .= '<input type="hidden" name="action" value="step2" />
            </form>';
        return $sForm;
    }
    foreach ($confFirst as $key => $val) {
        $aConf['headerTempl'] = str_replace("%{$key}%", $_POST[$key], $aConf['headerTempl']);
    }
    foreach ($aDbConf as $key => $val) {
        $aConf['headerTempl'] = str_replace("%{$key}%", $_POST[$key], $aConf['headerTempl']);
    }
    foreach ($aGeneral as $key => $val) {
        $aConf['headerTempl'] = str_replace("%{$key}%", $_POST[$key], $aConf['headerTempl']);
    }
    $aConf['periodicTempl'] = str_replace("%site_email%", $_POST['site_email'], $aConf['periodicTempl']);
    $aConf['periodicTempl'] = str_replace("%dir_root%", $_POST['dir_root'], $aConf['periodicTempl']);
    $aConf['periodicTempl'] = str_replace("%dir_php%", $_POST['dir_php'], $aConf['periodicTempl']);
    $sInnerCode .= "<div class=\"bx-install-debug bx-def-border bx-def-padding-sec\">{$aConf['periodicTempl']}</div>";
    $fp = fopen($aConf['dolFile'], 'w');
    if ($fp) {
        fputs($fp, $aConf['headerTempl']);
        fclose($fp);
        chmod($aConf['dolFile'], 0666);
    } else {
        $trans = get_html_translation_table(HTML_ENTITIES);
        $templ = strtr($aConf['headerTempl'], $trans);
        $text = 'Warning!!! can not get write access to config file ' . $aConf['dolFile'] . '. Please save config file below manually:</font><br>';
        $sInnerCode .= '<div class="bx-def-margin-top">';
        $sInnerCode .= printInstallError($text);
        $sInnerCode .= '<textarea cols="20" rows="10" class="headerTextarea bx-def-font bx-def-round-corners-with-border">' . $aConf['headerTempl'] . '</textarea>';
        $sInnerCode .= '</div>';
    }
    return <<<EOF
<div class="bx-install-header-caption bx-def-font-h1 bx-def-margin-bottom">
    Cron Jobs
</div>

<div class="bx-install-header-text bx-def-font-large bx-def-font-grayed bx-def-margin-bottom">
    Setup Cron Jobs as specified below. Helpful info about Cron Jobs is <a href="http://www.boonex.com/trac/dolphin/wiki/DetailedInstall#InstallScript-Step5-CronJobs" target="_blank">available here</a>.
</div>

{$sInnerCode}


<div class="bx-install-buttons bx-def-margin-top">
    {$sForm}
</div>

EOF;
}
Example #8
0
<?php 
include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
set_time_limit(0);
opendb();
$directionname = nnull(utf8_urldecode(getQUERY('directionname')), "");
$startgoogleaddress = nnull(utf8_urldecode(getQUERY('startgoogleaddress')), "");
$startgeocodeaddress = nnull(utf8_urldecode(getQUERY('startgeocodeaddress')), "");
$startlongitude = getQUERY("startlongitude");
$startlatitude = getQUERY("startlatitude");
$endgoogleaddress = nnull(utf8_urldecode(getQUERY('endgoogleaddress')), "");
$endgeocodeaddress = nnull(utf8_urldecode(getQUERY('endgeocodeaddress')), "");
$endlongitude = getQUERY("endlongitude");
$endlatitude = getQUERY("endlatitude");
$shortlineid = getQUERY('shortlineid');
$fastlineid = getQUERY('fastlineid');
$sqlAddDirection = "insert into directions (userid, clientid, directionname, startgoogleaddress, startgeocodeaddress, \r\n            startlongitude, startlatitude, endgoogleaddress, endgeocodeaddress, \r\n            endlongitude, endlatitude, shortlineid, fastlineid) values";
$sqlAddDirection .= "(" . session("user_id") . ", " . session("client_id") . ", '" . $directionname . "'";
$sqlAddDirection .= ",'" . $startgoogleaddress . "', '" . $startgeocodeaddress . "', " . $startlongitude;
$sqlAddDirection .= "," . $startlatitude . ", '" . $endgoogleaddress . "', '" . $endgeocodeaddress . "'";
$sqlAddDirection .= "," . $endlongitude . ", " . $endlatitude . ", " . $shortlineid . ", " . $fastlineid . ")";
//echo $sqlAddDirection;
$retID = RunSQL($sqlAddDirection);
echo $retID;
closedb();
exit;
Example #9
0
$per = getQUERY("per");
$day = getQUERY("day");
$date1 = getQUERY("date1");
$saati = getQUERY("saati");
$email = getQUERY("email");
$uid = getQUERY("uid");
$path = getQUERY("path");
$doctype = getQUERY("doctype");
$Today = DateTimeFormat(now(), "Y-m-d H:i:s");
opendb();
$vehID = nnull(dlookup("select id from vehicles where registration = '" . $veh . "'"), 0);
$dayInsert = "";
if ($per == "Weekly") {
    $dayInsert = $day;
}
if ($per == "Daily") {
    $dayInsert = "";
}
if ($per == "Monthly") {
    $dayInsert = $date1;
}
$time = $saati . ":00";
/* echo "insert into Scheduler (clientID, userID, report, vehicle, period, day, time, email, 
   subusers, range, vehID, path, CreationDate) values(" . Session("client_id") . "," . $uid . ",
   '" . $rep . "','" . $veh . "','" . $per . "','" . $dayInsert . "','" . $time . "','" . $email . "','', 
   '" . $range . "', '" . $vehID . "', '" . $path . "', '" . $Today . "');";
       */
RunSQL("delete from Scheduler where clientID = " . Session("client_id") . " and userID = " . $uid . " and report = '" . $rep . "' and vehicle = '" . $veh . "' and period = '" . $per . "' and day = '" . $dayInsert . "' and time = '" . $time . "' and email = '" . $email . "'");
$ret = DlookUP("insert into Scheduler (clientID, userID, report, vehicle, period, day, time, email, subusers, range, \r\n    vehID, path, CreationDate, doctype) values(" . Session("client_id") . "," . $uid . ",\r\n    '" . $rep . "','" . $veh . "','" . $per . "','" . $dayInsert . "','" . $time . "','" . $email . "','', \r\n    '" . $range . "', '" . $vehID . "', '" . $path . "', '" . $Today . "', '" . $doctype . "') ");
closedb();
echo $ret;
Example #10
0
?>

<?php 
session_start();
header("Content-type: text/html; charset=utf-8");
?>

<?php 
$vehID = getQUERY("vehID");
$dt = DateTimeFormat(getQUERY("dt"), 'Y-m-d H:i:s');
$driver = nnull(getQUERY("driver"), "");
$km = getQUERY("km");
$loc = getQUERY("loc");
$liters = nnull(getQUERY("liters"), 0);
$litersLast = nnull(getQUERY("litersLast"), 0);
$price = nnull(getQUERY("price"), 0);
$pay = getQUERY("pay");
opendb();
$checkCnt = dlookup("select count(*) from fuel where vehicleid=" . $vehID . " and datetime = '" . $dt . "' and driverid=" . $driver . "\r\n\tand km = " . $km . " and price = " . $price . " and liters = " . $liters . " and literslast = " . $litersLast . " and pay = '" . $pay . "' and location = '" . $loc . "'");
if ($checkCnt == 0) {
    if ($driver == "") {
        RunSQL("INSERT INTO fuel (vehicleid, datetime, km, price, liters, literslast, pay, location) \r\n\t\t    VALUES (" . $vehID . ", '" . DateTimeFormat($dt, "Y-m-d H:i:s") . "', " . $km . ", " . $price . ", " . $liters . ", \r\n\t\t    " . $litersLast . ", '" . $pay . "','" . $loc . "')");
    } else {
        RunSQL("INSERT INTO fuel (vehicleid, datetime, driverid, km, price, liters, literslast, pay, location) \r\n\t\t    VALUES (" . $vehID . ", '" . DateTimeFormat($dt, "Y-m-d H:i:s") . "', " . $driver . ", " . $km . ", " . $price . ", " . $liters . ", \r\n\t\t    " . $litersLast . ", '" . $pay . "', '" . $loc . "')");
    }
    echo 1;
} else {
    echo 0;
}
closedb();
exit;
Example #11
0
<?php 
include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
session_start();
header("Expires: Mon, 20 Jul 2000 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", FALSE);
header("Pragma: no-cache");
set_time_limit(0);
opendb();
$_idx = str_replace("'", "''", NNull($_GET['idx'], ''));
$p = str_replace("'", "''", NNull($_GET['points'], ''));
$_ida = str_replace("'", "''", NNull($_GET['ida'], ''));
RunSQL("insert into addareatemp(pointsofinterestid, areapoints, index, clientid) values('" . $_ida . "', '" . $p . "', '" . $_idx . "', '" . Session("client_id") . "')");
/*$tmpPoint = dlookup("select ST_AsText(geom) from pointsofinterest where id=".$_ida);
	$tmp3 =  strripos($tmpPoint, ",");
	$tmpPointNew = substr($tmpPoint, 0, $tmp3).",".$p.substr($tmpPoint, $tmp3, strlen($tmpPoint));
	echo $tmpPointNew;
	
	RunSQL("update pointsofinterest set geom = ST_PolygonFromText('" . $tmpPointNew . "') where id=75845");
	*/
//POLYGON((42.003263 21.395151,42.003662 21.395274,42.00345 21.396808,42.003048 21.396722,42.003172 21.395778,42.003263 21.395151,42.16 21.16,42.003263 21.395151,41.04 21.04,42 22,42.003263 21.395151,41.04 21.04,42.00 22.00,42.003263 21.395151))
//RunSQL("insert into AreaTempPoints(AreaID, AreaPoints, Idx, UserID, ClientID) values('" . $_ida . "', '" . $p . "', '" . $_idx . "', '" . session("user_id") . "', '" . Session("client_id") . "')");
closedb();
Example #12
0
<?php

include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
?>

<?php 
opendb();
$id = str_replace("'", "''", NNull($_GET['id1'], ''));
$name = str_replace("'", "''", NNull($_GET['GroupName'], ''));
$color = str_replace("'", "''", NNull($_GET['ColorName'], ''));
$image = str_replace("'", "''", NNull($_GET['image'], '0'));
echo "update pointsofinterestgroups set fillcolor = '" . $color . "', name ='" . $name . "', strokecolor = '#000000', image = " . (int) $image . " where id = '" . $id . "' and clientid =" . Session("client_id");
RunSQL("update pointsofinterestgroups set fillcolor = '" . $color . "', name ='" . $name . "', strokecolor = '#000000', image = " . (int) $image . " where id = '" . $id . "' and clientid =" . Session("client_id"));
closedb();
Example #13
0
$km = getQUERY("km");
$type = getQUERY("type");
$loc = getQUERY("loc");
$desc = getQUERY("desc");
$comp = getQUERY("comp");
$price = getQUERY("price");
$pay = getQUERY("pay");
if (is_numeric($km) == false) {
    $km = "0";
}
if (is_numeric($price) == false) {
    $price = "0";
}
if ($type == 0) {
    $type = "Associate";
} else {
    $type = "Regular";
}
opendb();
$checkCnt = dlookup("select count(*) from service where clientid=" . Session("client_id") . " and datetime='" . DateTimeFormat($datetime, "Y-m-d H:i:s") . "' \r\n\tand vehicleid=" . $veh . " and location='" . $loc . "' and userid=" . Session("user_id") . " and type='" . $type . "' and description='" . $desc . "' \r\n\tand components='" . $comp . "' and price=" . intval($price) . " and km=" . intval($km) . " and pay='" . $pay . "' and driverid=" . $driver);
if ($checkCnt == 0) {
    if ($driver == "") {
        RunSQL("INSERT INTO service (clientid, datetime, vehicleid, location, userid, type, description, components, price, km, pay) \r\n\t\t    VALUES (" . Session("client_id") . ", '" . DateTimeFormat($datetime, "Y-m-d H:i:s") . "', " . $veh . ", '" . $loc . "', " . Session("user_id") . ", \r\n\t\t    '" . $type . "', '" . $desc . "', '" . $comp . "', " . intval($price) . ", " . intval($km) . ", '" . $pay . "')");
    } else {
        RunSQL("INSERT INTO service (clientid, datetime, driverid, vehicleid, location, userid, type, description, components, price, km, pay) \r\n\t\t    VALUES (" . Session("client_id") . ", '" . DateTimeFormat($datetime, "Y-m-d H:i:s") . "', " . $driver . ", " . $veh . ", '" . $loc . "', " . Session("user_id") . ", \r\n\t\t    '" . $type . "', '" . $desc . "', '" . $comp . "', " . intval($price) . ", " . intval($km) . ", '" . $pay . "')");
    }
    echo 1;
} else {
    echo 0;
}
closedb();
Example #14
0
<?php

include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
?>

<?php 
opendb();
$id = str_replace("'", "''", NNull($_GET['id1'], ''));
$groupid = str_replace("'", "''", NNull($_GET['groupidVtoro'], ''));
RunSQL("update pointsofinterest set groupid = '" . $groupid . "' where id = '" . $id . "' and clientid =" . Session("client_id"));
closedb();
Example #15
0
<?php 
include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
session_start();
$userID = getQUERY("uid");
$lista = getQUERY("lista");
$lista1 = explode(",", $lista);
$list1 = '';
for ($i = 0; $i < sizeof($lista1); $i++) {
    $list1 = $list1 . "'1'";
    if ($i < sizeof($lista1) - 1) {
        $list1 = $list1 . ',';
    }
}
opendb();
RunSQL("delete from privilegessettings where userID = " . $userID);
RunSQL("insert into privilegessettings (userid," . $lista . ") values (" . $userID . "," . $list1 . ")");
print "Ok";
closedb();
Example #16
0
$fmalertservice = "checked='checked'";
$fmalertreg = "checked='checked'";
$fmeditcosts = "checked='checked'";
$fmoverview = "checked='checked'";
$fmreportcosts = "checked='checked'";
$fmreportchangetires = "checked='checked'";
$fmreportperformed = "checked='checked'";
$fmothercosts = "checked='checked'";
$fmreportfuel = "checked='checked'";
$fmchangetires = "checked='checked'";
$fmcurrentmileage = "checked='checked'";
$fmcosts = "checked='checked'";
if (pg_fetch_result($dsUsers, 0, "roleid") == "3") {
    $dsSett = query("select * from privilegessettings where userid=" . $userID);
    if (pg_num_rows($dsSett) == 0) {
        RunSQL("insert into privilegessettings (userid) values (" . $userID . ")");
        $dsSett = query("select * from privilegessettings where userid=" . $userID);
    }
    $reports1 = pg_fetch_result($dsSett, 0, "reports");
    $settings1 = pg_fetch_result($dsSett, 0, "settings");
    $routes1 = pg_fetch_result($dsSett, 0, "routes");
    $insertpoi1 = pg_fetch_result($dsSett, 0, "addpoi");
    $viewpoi1 = pg_fetch_result($dsSett, 0, "viewpoi");
    $insertzone1 = pg_fetch_result($dsSett, 0, "addzones");
    $viewzone1 = pg_fetch_result($dsSett, 0, "viewzones");
    $livetracking1 = pg_fetch_result($dsSett, 0, "livetracking");
    $dashboard1 = pg_fetch_result($dsSett, 0, "dashboard");
    $fleetreport1 = pg_fetch_result($dsSett, 0, "fleetreport");
    $overview1 = pg_fetch_result($dsSett, 0, "overview");
    $shortreport1 = pg_fetch_result($dsSett, 0, "shortreport");
    $detailreport1 = pg_fetch_result($dsSett, 0, "detailreport");
Example #17
0
<?php 
include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
session_start();
$veh = str_replace("'", "''", NNull($_GET['veh'], ''));
$reg = str_replace("'", "''", NNull($_GET['reg'], ''));
$no = str_replace("'", "''", NNull($_GET['no'], ''));
opendb();
RunSQL("UPDATE Vehicles SET registration='" . $reg . "', code = " . intval($no) . " WHERE id = " . intval($veh) . "");
closedb();
Example #18
0
<?php

include "../include/db.php";
include "../include/functions.php";
include "../include/params.php";
include "../include/dictionary2.php";
session_start();
header("Content-type: text/html; charset=utf-8");
$pocetok = DateTimeFormat(getQUERY("pocetok"), 'Y-m-d');
$kraj = DateTimeFormat(getQUERY("kraj"), 'Y-m-d');
$kopce = str_replace("'", "''", NNull($_GET['input'], ''));
$cid = Session("client_id");
opendb();
$zaId = dlookup("select Max(id)+1 from drivers");
$proverka = query("select * from vehicleslicense");
$LicenseCheck = dlookup("SELECT count(*) FROM vehicleslicense WHERE vehicleid = '" . $kopce . "' and userid = " . $zaId . "");
if ($LicenseCheck > 0) {
    echo 1;
} else {
    if (pg_num_rows($proverka) == 0) {
        $posledno = 1;
        RunSQL("INSERT INTO vehicleslicense(id, vehicleid, clientid, begining, ending, userid) VALUES(" . $posledno . ", " . $kopce . "," . $cid . ",\n  \t\t'" . DateTimeFormat($pocetok, "Y-m-d") . "',\n  \t\t'" . DateTimeFormat($kraj, "Y-m-d") . "' , " . $zaId . ")");
    } else {
        $posledno = dlookup("select Max(id)+1 from vehicleslicense");
        RunSQL("INSERT INTO vehicleslicense(id, vehicleid, clientid, begining, ending, userid) VALUES(" . $posledno . ", " . $kopce . "," . $cid . ",\n  \t\t'" . DateTimeFormat($pocetok, "Y-m-d") . "',\n  \t\t'" . DateTimeFormat($kraj, "Y-m-d") . "' , " . $zaId . ")");
    }
}
closedb();
Example #19
0
<?php 
include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
set_time_limit(0);
opendb();
$vehid = getQUERY("vehid");
$lon = getQUERY('lon');
$lat = getQUERY('lat');
$_name = nnull(utf8_urldecode(getQUERY('name')), "");
$_description = nnull(utf8_urldecode(getQUERY('description')), "");
$garminid = dlookup("select coalesce((select garminid from stopstatus where toid=" . $vehid . " order by datetime desc limit 1), 0)");
$garminid = $garminid + 1;
$sqlAddPoi = "insert into stopstatus (fromid, toid, clientid, userid, datetime, text, garminid, latitude, longitude, location) values";
$sqlAddPoi .= "(" . session("user_id") . ", " . $vehid . ", " . session("client_id") . ", " . session("user_id") . ", now(),";
$sqlAddPoi .= "'" . $_name . "', " . $garminid . ", " . $lat . ", " . $lon . ", '" . $_description . "')";
$ret = RunSQL($sqlAddPoi);
echo $garminid;
closedb();
Example #20
0
$br = 1;
while ($row = pg_fetch_array($ds)) {
    $latC = $row["latitude"];
    $longC = $row["longitude"];
    $url = "http://ws.geonames.org/timezone?lat=" . $latC . "&lng=" . $longC;
    $xml = simplexml_load_file($url);
    $tzoneUser = $xml->timezone->dstOffset;
    $url1 = "http://ws.geonames.org/timezone?lat=41.995900&lng=21.431500";
    $xml1 = simplexml_load_file($url1);
    $tzoneLocal = $xml1->timezone->dstOffset;
    $tzone1 = $tzoneUser - $tzoneLocal;
    /*print_r($xml);
    		echo "<br/>";
    		print_r($xml1);
    		echo "<br/>";*/
    if ($tzoneUser == "" || $tzoneLocal == "") {
        print_r($xml);
        echo "<br/><br/>";
        echo $br . ".   userid=" . $row["id"] . " tzone=" . $tzone1 . "<br/><br/><br/><br/>";
        $ok = 0;
        $br++;
    } else {
        RunSQL("update users set tzone=" . $tzone1 . " where id=" . $row["id"]);
    }
}
if ($ok == 1) {
    echo "Uspecno azuriranje na vremenski zoni za korisnicite!!!";
} else {
    echo "Error!!!";
}
closedb();
Example #21
0
<?php 
include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
session_start();
$dat = getQUERY("dt");
$reg = getQUERY("reg");
$type = getQUERY("type");
$note = getQUERY("note");
//list($d, $m, $y) = explode('-', $dat);
//$a = explode(" ", $y);
//$d1 = explode(":", $a[1]);
//$d2 = explode(".", $d1[2]);
//echo $dat . "<br />";
//echo $d . "_" . $m . "_" . $a[0] . "_" . $d1[0] . "_" . $d1[1] . "_" . $d2[0] . "_" . $d2[1];
//exit;
opendb();
$vehID = dlookup("select id from vehicles where registration='" . $reg . "'");
RunSQL("update alarmshistory set note='" . $note . "' where datetime='" . $dat . "' and vehicleid=" . $vehID . " and name='" . $type . "'");
print "Ok";
closedb();
Example #22
0
<?php 
include "../include/db.php";
include "../include/functions.php";
include "../include/params.php";
include "../include/dictionary2.php";
?>

<?php 
session_start();
header("Content-type: text/html; charset=utf-8");
?>

<?
       
    $kod = getQUERY('kod');
    $orgUnit = getQUERY('orgUnit');
    $desc = getQUERY('desc');
   
    opendb();
   
    //insert na nova o.e. vo baza, vo tabelata organisation
    RunSQL("INSERT INTO organisation (clientID, code, name, description) VALUES (" . Session("client_id") . ", '" . $kod . "', '" . $orgUnit . "', '" . $desc . "')");
    
	closedb();
	
?>
Example #23
0
	$xml = simplexml_load_file($url);
	$tzoneLocal = $xml->timezone->dstOffset;
	$tzone1 = $tzoneUser - $tzoneLocal;*/
$dsUserSett = query("select tzone, datetimeformat from users where id=" . session("user_id"));
$tzone1 = pg_fetch_result($dsUserSett, 0, "tzone");
$FormatDT = pg_fetch_result($dsUserSett, 0, 'datetimeformat');
$FormatDT1 = explode(" ", $FormatDT);
$dateformat = $FormatDT1[0];
$timeformat = $FormatDT1[1];
if ($timeformat == 'h:i:s') {
    $timeformat = $timeformat . " A";
}
$numveh = getQUERY("numofveh");
$valtraj = getQUERY("valtraj");
if ($valtraj != -1) {
    RunSQL("update users set trace = " . $valtraj . " where id=" . session("user_id"));
}
$dsv = query("select id from vehicles where clientid=" . session("client_id") . " and code='" . $numveh . "'");
$str = "";
$strSQL = "select latitude, longitude, datetime from historylog where vehicleid = " . pg_fetch_result($dsv, 0, "id");
$strSQL .= " and datetime > (select datetime from historylog where vehicleid = " . pg_fetch_result($dsv, 0, "id") . " and datetime <= now() + cast('" . $tzone1 . " hour' as interval) order by datetime desc limit 1)+cast('-' || (select trace from users where id=" . session("user_id") . ") || ' min' as interval)";
$strSQL .= " and datetime <= now() + cast('" . $tzone1 . " hour' as interval) order by datetime asc";
$ds = query($strSQL);
//"select latitude, longitude from historylog where vehicleid = " . pg_fetch_result($dsv, 0, "id") . " order by datetime desc");
$str1 = "";
$str2 = "";
$dist = "";
$dt = "";
$alpha = "";
$lastdt = "";
$lastLon = "";
Example #24
0
<?php 
include "../include/db.php";
include "../include/functions.php";
include "../include/params.php";
include "../include/dictionary2.php";
?>

<?php 
session_start();
header("Content-type: text/html; charset=utf-8");
?>


<?php 
$selected = getQUERY("selected");
$vehID = getQUERY("vehID");
$driArray = explode("*", $selected);
opendb();
for ($i = 0; $i < count($driArray) - 1; $i++) {
    RunSQL("INSERT INTO vehicledriver (vehicleid, driverid) VALUES (" . $vehID . ", " . $driArray[$i] . ")");
}
closedb();
Example #25
0
function addlog($idevent, $desc = '')
{
    opendb();
    $ipa = getIP();
    $currDateTime = new Datetime();
    $currDateTime = $currDateTime->format("Y-m-d H:i:s");
    $ua = getBrowser();
    $sqlInsert = "";
    $sqlInsert .= "insert into userlog (datetime, userid, eventtypeid, description, ipaddress, notes) values ";
    $sqlInsert .= "('" . $currDateTime . "', '" . Session("user_id") . "', '" . $idevent . "', '" . $desc . "', '" . $ipa . "','" . $ua['userAgent'] . "/" . $ua['platform'] . "')";
    RunSQL($sqlInsert);
}
Example #26
0
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
session_start();
header("Expires: Mon, 20 Jul 2000 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", FALSE);
header("Pragma: no-cache");
set_time_limit(0);
opendb();
$_ida = str_replace("'", "''", NNull($_GET['ida'], ''));
$dsAP = query("select areapoints from addareatemp where pointsofinterestid=" . $_ida . " order by index asc");
$strArrPoints = "";
while ($row = pg_fetch_array($dsAP)) {
    $strArrPoints .= $row["areapoints"] . "";
}
$a = explode("^", $strArrPoints);
$strPoly = "POLYGON((";
for ($i = 1; $i < sizeof($a); $i++) {
    $b = explode("@", $a[$i]);
    $strPoly .= $b[1] . " " . $b[0] . ",";
    //RunSQL("insert into AreaPoints(AreaID, Longitude, Latitude) values (" . $_ida . ", '" . $b[0] . "', '" . $b[1] . "')");
}
$strPoly = substr($strPoly, 0, strlen($strPoly) - 1) . "))";
//$_id = DlookUP("select ForeignID from Areas where ID=" . $_ida);
RunSQL("update pointsofinterest set geom = ST_PolygonFromText('" . $strPoly . "', 26986), povrsina=ST_Area(ST_SetSRID(ST_PolygonFromText('" . $strPoly . "'),3035))*1000000000 where id= " . $_ida);
RunSQL("delete from addareatemp where pointsofinterestid=" . $_ida);
closedb();
Example #27
0
$city = nnull(utf8_urldecode(getQUERY('city')), "");
$country = getQUERY("country");
$elevation = nnull(utf8_urldecode(getQUERY('elevation')), "");
$fullname = nnull(utf8_urldecode(getQUERY('fullname')), "");
$lon = getQUERY("lon");
$lat = getQUERY("lat");
$otime = getQUERY("otime");
$temp = getQUERY("temp");
$feelslike = getQUERY("feelslike");
$wind = getQUERY("wind");
$visibility = getQUERY("visibility");
$weather = nnull(utf8_urldecode(getQUERY("weather")), "");
$humidity = getQUERY("humidity");
$icon = nnull(utf8_urldecode(getQUERY("icon")), "");
$iconurl = nnull(utf8_urldecode(getQUERY("iconurl")), "");
$cntW = dlookup("select count(*) from weatherstations where city='" . $city . "'");
if ($cntW > 0) {
    $sqlAddW = "UPDATE weatherstations set observationtime='" . $otime . "', temerature=" . $temp;
    $sqlAddW .= ", feelslike=" . $feelslike . ", weather='" . $weather . "', humidity='" . $humidity;
    $sqlAddW .= "', visibility=" . $visibility . ", wind=" . $wind . ", icon='" . $icon . "', iconurl='" . $iconurl . "'";
    $sqlAddW .= " where city='" . $city . "'";
    RunSQL($sqlAddW);
    echo "update";
} else {
    $sqlAddW = "INSERT INTO weatherstations (city, country, elevation, fullname, latitude, longitude, observationtime, temerature, feelslike, weather, humidity, visibility, wind, icon, iconurl) VALUES ";
    $sqlAddW .= "('" . $city . "', '" . $country . "', '" . $elevation . "', '" . $fullname . "', " . $lat . ", " . $lon . ", '" . $otime . "', " . $temp . ", " . $feelslike . ", '" . $weather . "', '" . $humidity . "', " . $visibility . ", " . $wind . ", '" . $icon . "', '" . $iconurl . "')";
    RunSQL($sqlAddW);
    echo "insert";
}
closedb();
exit;
Example #28
0
<?php

include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
session_start();
?>

<?php 
$id = str_replace("'", "''", NNull($_GET['id'], ''));
opendb();
RunSQL("Delete from pointsofinterest where id = " . $id . " and clientid =" . Session("client_id"));
closedb();
Example #29
0
$fromto = getQUERY("fromto");
opendb();
$datetimeformat = dlookup("select datetimeformat from users where id=" . session("user_id"));
$datfor = explode(" ", $datetimeformat);
$dateformat = $datfor[0];
$timeformat = $datfor[1];
if ($timeformat == 'h:i:s') {
    $timeformat = $timeformat . " a";
}
?>
 <body>
 
  <?php 
$mess = query("select * from messages where id= " . $messid);
if ($fromto == 'inbox') {
    RunSQL("update messages set checked='1' where id= " . $messid);
}
$totalUnreadInbox = dlookup("select count(*) from messages where checked='0' and toid=" . session("user_id"));
?>
 
 <table class="text2_" width=95% style="margin:35px">
 <tr>
 	<td width=20% style="font-size:16px; font-weight: bold"><!--<?php 
echo pg_fetch_result($mess, 0, "subject");
?>
--></td>
 	<td width=80% style="text-align: right; font-size:11px">
 	<?php 
if ($fromto == "inbox") {
    $from = dlookup("select fullname from users where id=" . pg_fetch_result($mess, 0, "fromid"));
    ?>
Example #30
0
$rfId = getQUERY("rfId");
$contract = getQUERY("contract");
if (is_numeric($contract) == false) {
    $contract = 0;
}
$sc = DateTimeFormat(getQUERY("startCom"), 'Y-m-d');
//start date in company
$categories = getQUERY("categories");
$fl = DateTimeFormat(getQUERY("firstLic"), 'Y-m-d');
//first license
$le = DateTimeFormat(getQUERY("licExp"), 'Y-m-d');
//license expire
$interLic = getQUERY("interLic");
$ie = DateTimeFormat(getQUERY("IntLicExp"), 'Y-m-d');
//international license expire
opendb();
$removed = getQUERY("removed");
if ($removed != "") {
    $remArr = explode(";", $removed);
    for ($i = 0; $i < count($remArr) - 1; $i++) {
        RunSQL("delete from vehicledriver where id=" . $remArr[$i]);
    }
}
$CheckCode = dlookup("SELECT count(*) FROM drivers WHERE code = '" . $code . "' and clientid = " . Session("client_id") . " and code not in (select code from drivers where id=" . $id . ")");
if ($CheckCode > 0) {
    echo 1;
    exit;
} else {
    RunSQL("UPDATE drivers set fullname='" . $name . "', code='" . $code . "', borndate='" . $bd . "', \r\n    gender='" . $gender . "', startincompany='" . $sc . "', jobcontract=" . $contract . ", \r\n    rfid= '" . $rfId . "', licensetype='" . $categories . "', firstlicense='" . $fl . "', \r\n    licenseexp= '" . $le . "', interlicense=B'" . $interLic . "', interlicenseexp='" . $ie . "', \r\n    organisationid = " . $orgUnit . " where id=" . $id);
}
closedb();