Пример #1
0
function audit($basic, $extra, $support, $field)
{
    $our_array = array();
    $query = "SELECT * FROM `{$support}`";
    $result = mysql_query($query) or do_error($query, mysql_error(), basename(__FILE__), __LINE__);
    //
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $our_array[$row['id']] = TRUE;
    }
    $query = "SELECT * FROM `{$basic}` ";
    // 8/11/08
    $result = mysql_query($query) or do_error($query, mysql_error(), basename(__FILE__), __LINE__);
    // in_types_id
    $header = FALSE;
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        if (!array_key_exists($row[$field], $our_array)) {
            if (!$header) {
                print "<br /><h3>{$extra} {$GLOBALS['mysql_prefix']}{$basic}</h3>";
                $header = TRUE;
            }
            print "Table '{$support}' missing index {$row[$field]}.  Called for in '{$basic}' record id: {$row['id']} <br />\n ";
        }
        // end while()
    }
    print $header ? "" : "<BR /><h3>Table {$basic}{$extra} OK for '{$field}' </h3><BR />";
}
Пример #2
0
 function authorize()
 {
     global $globals, $db;
     if (empty($_GET['code'])) {
         do_error(_('acceso denegado'), false, false);
     }
     try {
         $this->client->setAccessToken($this->client->authenticate());
         if (!($access_token = $this->client->getAccessToken())) {
             do_error(_('acceso denegado'), false, false);
         }
         $response = $this->gplus->people->get('me');
         $this->uid = $response['id'];
         $this->username = User::get_valid_username($response['displayName']);
     } catch (Exception $e) {
         do_error(_('error de conexión a') . " {$this->service} (authorize2)", false, false);
     }
     $db->transaction();
     if (!$this->user_exists()) {
         $this->url = $response['url'];
         $this->names = $response['displayName'];
         $this->avatar = $response['image']['url'];
         $this->store_user();
     }
     $this->store_auth();
     $db->commit();
     $this->user_login();
 }
Пример #3
0
 function user_exists()
 {
     global $db, $current_user;
     if ($this->uid) {
         $sql = "select user_id, token, secret from auths where service='{$this->service}' and uid = {$this->uid}";
     } else {
         $sql = "select user_id, token, secret from auths where service='{$this->service}' and name = '{$this->username}'";
     }
     $res = $db->get_row($sql);
     if ($res) {
         $this->id = $res->user_id;
         $this->token = $res->token;
         $this->secret = $res->secret;
         $this->user = new User($this->id);
         if ($current_user->user_id && $current_user->user_id != $this->id) {
             if (!$this->user->disabled()) {
                 do_error(_('cuenta asociada a otro usuario') . ': ' . $this->user->username, false, false);
             }
             // We read again, the previous user is another one, already disabled
             $this->user = new User($current_user->user_id);
             $this->id = $this->id = $current_user->user_id;
         } elseif (!$this->user->id || $this->user->disabled()) {
             do_error(_('usuario deshabilitado'), false, false);
         }
     } else {
         if ($current_user->user_id) {
             $this->user = new User($current_user->user_id);
             $this->id = $current_user->user_id;
         } else {
             $this->user = new User();
         }
     }
     return $this->id;
 }
function get_stat_type_type($value)
{
    $stat_type = "Not Used";
    $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}stats_type` WHERE `st_id` = {$value}";
    $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
    if (mysql_num_rows($result) != 0) {
        $row = stripslashes_deep(mysql_fetch_assoc($result));
        $stat_type = $row['stat_type'];
    }
    return $stat_type;
}
Пример #5
0
function get_variable($which)
{
    /* get variable from db settings table, returns FALSE if absent  */
    global $variables;
    if (empty($variables)) {
        $result = mysql_query("SELECT * FROM `{$GLOBALS['mysql_prefix']}settings`") or do_error("get_variable(n:{$name})::mysql_query()", 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
        if (!(mysql_affected_rows($result) == 1)) {
            return FALSE;
        }
        $row = stripslashes_deep(mysql_fetch_assoc($result));
        return $row['value'];
    }
}
function module_tabs_exist($name)
{
    $query = "SELECT COUNT(*) FROM `{$GLOBALS['mysql_prefix']}modules`";
    $result = mysql_query($query);
    $num_rows = @mysql_num_rows($result);
    if ($num_rows) {
        $query_exists = "SELECT * FROM `{$GLOBALS['mysql_prefix']}modules` WHERE `mod_name`=\"{$name}\"";
        $result_exists = mysql_query($query_exists) or do_error($query_exists, 'mysql_query() failed', mysql_error(), __FILE__, __LINE__);
        $num_rows = mysql_num_rows($result_exists);
        if ($num_rows != 0) {
            return 1;
        } else {
            return 0;
        }
    } else {
        return 0;
    }
}
Пример #7
0
 function authorize()
 {
     global $globals, $db;
     $oauth_token = clean_input_string($_GET['oauth_token']);
     $request_token_secret = $_COOKIE['oauth_token_secret'];
     if (!empty($oauth_token) && !empty($request_token_secret)) {
         $this->oauth->setToken($oauth_token, $request_token_secret);
         try {
             $access_token_info = $this->oauth->getAccessToken($this->access_token_url);
         } catch (Exception $e) {
             do_error(_('error de conexión a') . " {$this->service}", false, false);
         }
     } else {
         do_error(_('acceso denegado'), false, false);
     }
     $this->token = $access_token_info['oauth_token'];
     $this->secret = $access_token_info['oauth_token_secret'];
     $this->uid = $access_token_info['user_id'];
     $this->username = User::get_valid_username($access_token_info['screen_name']);
     if (!$this->user_exists()) {
         $this->oauth->setToken($access_token_info['oauth_token'], $access_token_info['oauth_token_secret']);
         try {
             $data = $this->oauth->fetch($this->credentials_url);
         } catch (Exception $e) {
             do_error(_('error de conexión a') . " {$this->service}", false, false);
         }
         if ($data) {
             $response_info = $this->oauth->getLastResponse();
             $response = json_decode($response_info);
             $this->url = $response->url;
             $this->names = $response->name;
             $this->avatar = $response->profile_image_url;
         }
         $db->transaction();
         $this->store_user();
     } else {
         $db->transaction();
     }
     $this->store_auth();
     $db->commit();
     $this->user_login();
 }
function get_modules($calling_file)
{
    global $handle;
    $query = "SELECT COUNT(*) FROM `{$GLOBALS['mysql_prefix']}modules`";
    $result = mysql_query($query);
    $num_rows = @mysql_num_rows($result);
    if ($num_rows) {
        $query2 = "SELECT * FROM `{$GLOBALS['mysql_prefix']}modules` WHERE `mod_status`=1 AND `affecting_files` LIKE '%{$calling_file}%'";
        $result2 = mysql_query($query2) or do_error('mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
        $numb_rows = @mysql_num_rows($result2);
        while ($row2 = stripslashes_deep(mysql_fetch_assoc($result2))) {
            $name = $row2['mod_name'];
            $status = $row2['mod_status'];
            $inc_path = "./modules/" . $name . "/helper.php";
            $display = "get_display_" . $name;
            include $inc_path;
            $display($calling_file);
        }
    }
}
 function do_gt($user)
 {
     $ret_array = array();
     $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}remote_devices` WHERE `user` = '{$user}'";
     //	read location data from incoming table
     $result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), basename(__FILE__), __LINE__);
     if ($result) {
         while ($row = @mysql_fetch_assoc($result)) {
             $id = $row['user'];
             $ret_array[0] = $id;
             $lat = $row['lat'];
             $ret_array[1] = $lat;
             $lng = $row['lng'];
             $ret_array[2] = $lng;
             $time = $row['time'];
             $ret_array[3] = $time;
         }
         // end while
     } else {
         print "-error 1";
     }
     return $ret_array;
 }
function ringf()
{
    $coords = array();
    $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}responder`";
    $result = mysql_query($query) or do_error($query, mysql_error(), basename(__FILE__), __LINE__);
    $row = stripslashes_deep(mysql_fetch_assoc($result));
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        print $row['id'];
        print " ";
        print $row['ring_fence'];
        print "<br />";
        if ($row['ring_fence'] != NULL && $row['ring_fence'] > 0) {
            $query2 = "SELECT * FROM `{$GLOBALS['mysql_prefix']}lines` WHERE `id` = {$row['ring_fence']}";
            $result2 = mysql_query($query2) or do_error($query2, mysql_error(), basename(__FILE__), __LINE__);
            $row2 = stripslashes_deep(mysql_fetch_assoc($result2));
            extract($row2);
            $points = explode(";", $line_data);
            for ($i = 0; $i < count($points); $i++) {
                $coords[] = explode(",", $points[$i]);
            }
        }
    }
    dump($coords);
}
function popup_ticket($id, $print = 'false', $search = FALSE)
{
    /* 7/9/09 - show specified ticket */
    global $istest, $iw_width;
    if ($istest) {
        print "GET<br />\n";
        dump($_GET);
        print "POST<br />\n";
        dump($_POST);
    }
    if ($id == '' or $id <= 0 or !check_for_rows("SELECT * FROM `{$GLOBALS['mysql_prefix']}ticket` WHERE id='{$id}'")) {
        /* sanity check */
        print "Invalid Ticket ID: '{$id}'<BR />";
        return;
    }
    $restrict_ticket = get_variable('restrict_user_tickets') == 1 && !is_administrator() ? " AND owner={$_SESSION['user_id']}" : "";
    $query = "SELECT *,UNIX_TIMESTAMP(problemstart) AS problemstart,UNIX_TIMESTAMP(problemend) AS problemend,UNIX_TIMESTAMP(date) AS date,UNIX_TIMESTAMP(updated) AS updated, `{$GLOBALS['mysql_prefix']}ticket`.`description` AS `tick_descr` FROM `{$GLOBALS['mysql_prefix']}ticket` WHERE ID='{$id}' {$restrict_ticket}";
    // 8/12/09
    $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
    if (!mysql_num_rows($result)) {
        //no tickets? print "error" or "restricted user rights"
        print "<FONT CLASS=\"warn\">No such ticket or user access to ticket is denied</FONT>";
        exit;
    }
    $row = stripslashes_deep(mysql_fetch_assoc($result));
    ?>
	<TABLE BORDER="0" ID = "outer" ALIGN="left">
<?php 
    print "<TD ALIGN='left'>";
    print "<TABLE ID='theMap' BORDER=0><TR CLASS='odd' ><TD  ALIGN='center'>\n\t\t<DIV ID='map' STYLE='WIDTH:" . get_variable('map_width') . "px; HEIGHT: " . get_variable('map_height') . "PX'></DIV>\n\t\t</TD></TR>";
    // 11/29/08
    print "<FORM NAME='sv_form' METHOD='post' ACTION=''><INPUT TYPE='hidden' NAME='frm_lat' VALUE=" . $row['lat'] . ">";
    // 2/11/09
    print "<INPUT TYPE='hidden' NAME='frm_lng' VALUE=" . $row['lng'] . "></FORM>";
    print "<TR ID='pointl1' CLASS='print_TD' STYLE = 'display:none;'>\n\t\t<TD ALIGN='center'><B>Range:</B>&nbsp;&nbsp; <SPAN ID='range'></SPAN>&nbsp;&nbsp;<B>Brng</B>:&nbsp;&nbsp;\n\t\t\t<SPAN ID='brng'></SPAN></TD></TR>\n\n\t\t<TR ID='pointl2' CLASS='print_TD' STYLE = 'display:none;'>\n\t\t\t<TD ALIGN='center'><B>Lat:</B>&nbsp;<SPAN ID='newlat'></SPAN>\n\t\t\t&nbsp;<B>Lng:</B>&nbsp;&nbsp; <SPAN ID='newlng'></SPAN>&nbsp;&nbsp;<B>NGS:</B>&nbsp;<SPAN ID = 'newusng'></SPAN></TD></TR>\n";
    print "</TABLE>\n";
    print "</TD></TR>";
    print "<TR CLASS='odd' ><TD COLSPAN='2' CLASS='print_TD'>";
    $lat = $row['lat'];
    $lng = $row['lng'];
    print "</TABLE>\n";
    ?>
	<SCRIPT SRC='../js/usng.js' TYPE='text/javascript'></SCRIPT>
	<SCRIPT SRC="../js/graticule.js" type="text/javascript"></SCRIPT>
	<SCRIPT>


	function isNull(val) {								// checks var stuff = null;
		return val === null;
		}

	var the_grid;
	var grid = false;
	function doGrid() {
		if (grid) {
			map.removeOverlay(the_grid);
			grid = false;
			}
		else {
			the_grid = new LatLonGraticule();
			map.addOverlay(the_grid);
			grid = true;
			}
		}

	String.prototype.trim = function () {				// 9/14/08
		return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
		};

	String.prototype.parseDeg = function() {
		if (!isNaN(this)) return Number(this);								// signed decimal degrees without NSEW

		var degLL = this.replace(/^-/,'').replace(/[NSEW]/i,'');			// strip off any sign or compass dir'n
		var dms = degLL.split(/[^0-9.,]+/);									// split out separate d/m/s
		for (var i in dms) if (dms[i]=='') dms.splice(i,1);					// remove empty elements (see note below)
		switch (dms.length) {												// convert to decimal degrees...
			case 3:															// interpret 3-part result as d/m/s
				var deg = dms[0]/1 + dms[1]/60 + dms[2]/3600; break;
			case 2:															// interpret 2-part result as d/m
				var deg = dms[0]/1 + dms[1]/60; break;
			case 1:															// decimal or non-separated dddmmss
				if (/[NS]/i.test(this)) degLL = '0' + degLL;	// - normalise N/S to 3-digit degrees
				var deg = dms[0].slice(0,3)/1 + dms[0].slice(3,5)/60 + dms[0].slice(5)/3600; break;
			default: return NaN;
			}
		if (/^-/.test(this) || /[WS]/i.test(this)) deg = -deg; // take '-', west and south as -ve
		return deg;
		}
	Number.prototype.toRad = function() {  // convert degrees to radians
		return this * Math.PI / 180;
		}

	Number.prototype.toDeg = function() {  // convert radians to degrees (signed)
		return this * 180 / Math.PI;
		}
	Number.prototype.toBrng = function() {  // convert radians to degrees (as bearing: 0...360)
		return (this.toDeg()+360) % 360;
		}
	function brng(lat1, lon1, lat2, lon2) {
		lat1 = lat1.toRad(); lat2 = lat2.toRad();
		var dLon = (lon2-lon1).toRad();

		var y = Math.sin(dLon) * Math.cos(lat2);
		var x = Math.cos(lat1)*Math.sin(lat2) -
						Math.sin(lat1)*Math.cos(lat2)*Math.cos(dLon);
		return Math.atan2(y, x).toBrng();
		}

	distCosineLaw = function(lat1, lon1, lat2, lon2) {
		var R = 6371; // earth's mean radius in km
		var d = Math.acos(Math.sin(lat1.toRad())*Math.sin(lat2.toRad()) +
				Math.cos(lat1.toRad())*Math.cos(lat2.toRad())*Math.cos((lon2-lon1).toRad())) * R;
		return d;
		}
    var km2feet = 3280.83;
	var thisMarker = false;

	var map;
	var icons=[];						// note globals	- 1/29/09
	icons[<?php 
    print $GLOBALS['SEVERITY_NORMAL'];
    ?>
] = "./our_icons/blue.png";		// normal
	icons[<?php 
    print $GLOBALS['SEVERITY_MEDIUM'];
    ?>
] = "./our_icons/green.png";	// green
	icons[<?php 
    print $GLOBALS['SEVERITY_HIGH'];
    ?>
] =  "./our_icons/red.png";		// red
	icons[<?php 
    print $GLOBALS['SEVERITY_HIGH'];
    ?>
+1] =  "./our_icons/white.png";	// white - not in use

	var baseIcon = new GIcon();
	baseIcon.shadow = "./markers/sm_shadow.png";

	baseIcon.iconSize = new GSize(20, 34);
	baseIcon.iconAnchor = new GPoint(9, 34);
	baseIcon.infoWindowAnchor = new GPoint(9, 2);

	map = new GMap2($("map"));		// create the map
<?php 
    $maptype = get_variable('maptype');
    // 08/02/09
    switch ($maptype) {
        case "1":
            break;
        case "2":
            ?>
		map.setMapType(G_SATELLITE_MAP);<?php 
            break;
        case "3":
            ?>
		map.setMapType(G_PHYSICAL_MAP);<?php 
            break;
        case "4":
            ?>
		map.setMapType(G_HYBRID_MAP);<?php 
            break;
        default:
            print "ERROR in " . basename(__FILE__) . " " . __LINE__ . "<BR />";
    }
    ?>
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	map.addControl(new GOverviewMapControl());				// 12/24/08
<?php 
    if (get_variable('terrain') == 1) {
        ?>
	map.addMapType(G_PHYSICAL_MAP);
<?php 
    }
    ?>
	map.setCenter(new GLatLng(<?php 
    print $lat;
    ?>
, <?php 
    print $lng;
    ?>
),11);
	var icon = new GIcon(baseIcon);
	icon.image = icons[<?php 
    print $row['severity'];
    ?>
];
	var point = new GLatLng(<?php 
    print $lat;
    ?>
, <?php 
    print $lng;
    ?>
);	// 1147
	map.addOverlay(new GMarker(point, icon));
	map.enableScrollWheelZoom();

// ====================================Add Active Responding Units to Map =========================================================================
	var icons=[];						// note globals	- 1/29/09
	icons[1] = "./our_icons/white.png";		// normal
	icons[2] = "./our_icons/black.png";	// green

	var baseIcon = new GIcon();
	baseIcon.shadow = "./markers/sm_shadow.png";

	baseIcon.iconSize = new GSize(20, 34);
	baseIcon.iconAnchor = new GPoint(9, 34);
	baseIcon.infoWindowAnchor = new GPoint(9, 2);

	var unit_icon = new GIcon(baseIcon);
	unit_icon.image = icons[1];

function createMarker(unit_point, number) {
	var unit_marker = new GMarker(unit_point, unit_icon);
	// Show this markers index in the info window when it is clicked
	var html = number;
	GEvent.addListener(unit_marker, "click", function() {unit_marker.openInfoWindowHtml(html);});
	return unit_marker;
}


<?php 
    $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}assigns` WHERE ticket_id='{$id}'";
    $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
    while ($row = mysql_fetch_array($result)) {
        $responder_id = $row['responder_id'];
        if ($row['clear'] == NULL) {
            $query_unit = "SELECT * FROM `{$GLOBALS['mysql_prefix']}responder` WHERE id='{$responder_id}'";
            $result_unit = mysql_query($query_unit) or do_error($query_unit, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
            while ($row_unit = mysql_fetch_array($result_unit)) {
                $unit_id = $row_unit['id'];
                $mobile = $row_unit['mobile'];
                if (my_is_float($row_unit['lat']) && my_is_float($row_unit['lng'])) {
                    if ($mobile == 1) {
                        echo "var unit_icon = new GIcon(baseIcon);\n";
                        echo "var unit_icon_url = \"./our_icons/gen_icon.php?blank=0&text=RU\";\n";
                        // 4/18/09
                        echo "unit_icon.image = unit_icon_url;\n";
                        echo "var unit_point = new GLatLng(" . $row_unit['lat'] . "," . $row_unit['lng'] . ");\n";
                        echo "var unit_marker = createMarker(unit_point, '" . addslashes($row_unit['name']) . "', unit_icon);\n";
                        echo "map.addOverlay(unit_marker);\n";
                        echo "\n";
                    } else {
                        echo "var unit_icon = new GIcon(baseIcon);\n";
                        echo "var unit_icon_url = \"./our_icons/gen_icon.php?blank=4&text=RU\";\n";
                        // 4/18/09
                        echo "unit_icon.image = unit_icon_url;\n";
                        echo "var unit_point = new GLatLng(" . $row_unit['lat'] . "," . $row_unit['lng'] . ");\n";
                        echo "var unit_marker = createMarker(unit_point, '" . addslashes($row_unit['name']) . "', unit_icon);\n";
                        echo "map.addOverlay(unit_marker);\n";
                        echo "\n";
                    }
                    // end if/else ($mobile)
                }
                // end ((my_is_float()) - responding units
            }
            // end outer if
        }
        // end inner while
    }
    //	end outer while
    // =====================================End of functions to show responding units========================================================================
    // ====================================Add Facilities to Map 8/1/09================================================
    ?>
	var icons=[];	
	var g=0;

	var fmarkers = [];

	var baseIcon = new GIcon();
	baseIcon.shadow = "./markers/sm_shadow.png";

	baseIcon.iconSize = new GSize(30, 30);
	baseIcon.iconAnchor = new GPoint(15, 30);
	baseIcon.infoWindowAnchor = new GPoint(9, 2);

	var fac_icon = new GIcon(baseIcon);
	fac_icon.image = icons[1];

function createfacMarker(fac_point, fac_name, id, fac_icon) {
	var fac_marker = new GMarker(fac_point, fac_icon);
	// Show this markers index in the info window when it is clicked
	var fac_html = fac_name;
	fmarkers[id] = fac_marker;
	GEvent.addListener(fac_marker, "click", function() {fac_marker.openInfoWindowHtml(fac_html);});
	return fac_marker;
}

<?php 
    $query_fac = "SELECT *,UNIX_TIMESTAMP(updated) AS updated, `{$GLOBALS['mysql_prefix']}facilities`.id AS fac_id, `{$GLOBALS['mysql_prefix']}facilities`.description AS facility_description, `{$GLOBALS['mysql_prefix']}fac_types`.name AS fac_type_name, `{$GLOBALS['mysql_prefix']}facilities`.name AS facility_name FROM `{$GLOBALS['mysql_prefix']}facilities` LEFT JOIN `{$GLOBALS['mysql_prefix']}fac_types` ON `{$GLOBALS['mysql_prefix']}facilities`.type = `{$GLOBALS['mysql_prefix']}fac_types`.id LEFT JOIN `{$GLOBALS['mysql_prefix']}fac_status` ON `{$GLOBALS['mysql_prefix']}facilities`.status_id = `{$GLOBALS['mysql_prefix']}fac_status`.id ORDER BY `{$GLOBALS['mysql_prefix']}facilities`.type ASC";
    $result_fac = mysql_query($query_fac) or do_error($query_fac, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
    while ($row_fac = mysql_fetch_array($result_fac)) {
        $eols = array("\r\n", "\n", "\r");
        // all flavors of eol
        while ($row_fac = stripslashes_deep(mysql_fetch_array($result_fac))) {
            //
            $fac_name = $row_fac['facility_name'];
            //	10/8/09
            $fac_temp = explode("/", $fac_name);
            $fac_index = substr($fac_temp[count($fac_temp) - 1], -6, strlen($fac_temp[count($fac_temp) - 1]));
            // 3/19/11
            print "\t\tvar fac_sym = '{$fac_index}';\n";
            // for sidebar and icon 10/8/09
            $fac_id = $row_fac['id'];
            $fac_type = $row_fac['icon'];
            $f_disp_name = $row_fac['facility_name'];
            //	10/8/09
            $f_disp_temp = explode("/", $f_disp_name);
            $facility_display_name = $f_disp_temp[0];
            if (my_is_float($row_fac['lat']) && my_is_float($row_fac['lng'])) {
                $fac_tab_1 = "<TABLE CLASS='infowin'  width='{$iw_width}' >";
                $fac_tab_1 .= "<TR CLASS='even'><TD COLSPAN=2 ALIGN='center'><B>" . addslashes(shorten($facility_display_name, 48)) . "</B></TD></TR>";
                $fac_tab_1 .= "<TR CLASS='odd'><TD COLSPAN=2 ALIGN='center'><B>" . addslashes(shorten($row_fac['fac_type_name'], 48)) . "</B></TD></TR>";
                $fac_tab_1 .= "<TR CLASS='even'><TD ALIGN='right'>Description:&nbsp;</TD><TD ALIGN='left'>" . addslashes(str_replace($eols, " ", $row_fac['facility_description'])) . "</TD></TR>";
                $fac_tab_1 .= "<TR CLASS='odd'><TD ALIGN='right'>Status:&nbsp;</TD><TD ALIGN='left'>" . addslashes($row_fac['status_val']) . " </TD></TR>";
                $fac_tab_1 .= "<TR CLASS='even'><TD ALIGN='right'>Contact:&nbsp;</TD><TD ALIGN='left'>" . addslashes($row_fac['contact_name']) . "&nbsp;&nbsp;&nbsp;Email: " . addslashes($row_fac['contact_email']) . "</TD></TR>";
                $fac_tab_1 .= "<TR CLASS='odd'><TD ALIGN='right'>Phone:&nbsp;</TD><TD ALIGN='left'>" . addslashes($row_fac['contact_phone']) . " </TD></TR>";
                $fac_tab_1 .= "<TR CLASS='even'><TD ALIGN='right'>As of:&nbsp;</TD><TD ALIGN='left'>" . format_date($row_fac['updated']) . "</TD></TR>";
                $fac_tab_1 .= "</TABLE>";
                $fac_tab_2 = "<TABLE CLASS='infowin'  width='{$iw_width}' >";
                $fac_tab_2 .= "<TR CLASS='odd'><TD ALIGN='right'>Security contact:&nbsp;</TD><TD ALIGN='left'>" . addslashes($row_fac['security_contact']) . " </TD></TR>";
                $fac_tab_2 .= "<TR CLASS='even'><TD ALIGN='right'>Security email:&nbsp;</TD><TD ALIGN='left'>" . addslashes($row_fac['security_email']) . " </TD></TR>";
                $fac_tab_2 .= "<TR CLASS='odd'><TD ALIGN='right'>Security phone:&nbsp;</TD><TD ALIGN='left'>" . addslashes($row_fac['security_phone']) . " </TD></TR>";
                $fac_tab_2 .= "<TR CLASS='even'><TD ALIGN='right'>Access rules:&nbsp;</TD><TD ALIGN='left'>" . addslashes(str_replace($eols, " ", $row_fac['access_rules'])) . "</TD></TR>";
                $fac_tab_2 .= "<TR CLASS='odd'><TD ALIGN='right'>Security reqs:&nbsp;</TD><TD ALIGN='left'>" . addslashes(str_replace($eols, " ", $row_fac['security_reqs'])) . "</TD></TR>";
                $fac_tab_2 .= "<TR CLASS='even'><TD ALIGN='right'>Opening hours:&nbsp;</TD><TD ALIGN='left'>" . addslashes(str_replace($eols, " ", $row_fac['opening_hours'])) . "</TD></TR>";
                $fac_tab_2 .= "<TR CLASS='odd'><TD ALIGN='right'>Prim pager:&nbsp;</TD><TD ALIGN='left'>" . addslashes($row_fac['pager_p']) . " </TD></TR>";
                $fac_tab_2 .= "<TR CLASS='even'><TD ALIGN='right'>Sec pager:&nbsp;</TD><TD ALIGN='left'>" . addslashes($row_fac['pager_s']) . " </TD></TR>";
                $fac_tab_2 .= "</TABLE>";
                ?>
//			var fac_sym = (g+1).toString();
			var myfacinfoTabs = [
				new GInfoWindowTab("<?php 
                print nl2brr(addslashes(shorten($row_fac['facility_name'], 10)));
                ?>
", "<?php 
                print $fac_tab_1;
                ?>
"),
				new GInfoWindowTab("More ...", "<?php 
                print str_replace($eols, " ", $fac_tab_2);
                ?>
")
				];
			<?php 
                if ($row_fac['lat'] == 0.999999 && $row_fac['lng'] == 0.999999) {
                    // check for facilities entered in no maps mode 7/28/10
                    echo "var fac_icon = new GIcon(baseIcon);\n";
                    echo "var fac_type = {$fac_type};\n";
                    echo "var fac_icon_url = \"./our_icons/question1.png\";\n";
                    echo "fac_icon.image = fac_icon_url;\n";
                    echo "var fac_point = new GLatLng(" . get_variable('def_lat') . "," . get_variable('def_lng') . ");\n";
                    echo "var fac_marker = createfacMarker(fac_point, myfacinfoTabs, g, fac_icon);\n";
                    echo "map.addOverlay(fac_marker);\n";
                    echo "\n";
                } else {
                    echo "var fac_icon = new GIcon(baseIcon);\n";
                    echo "var fac_type = {$fac_type};\n";
                    ?>
		var origin = ((fac_sym.length)>3)? (fac_sym.length)-3: 0;						// pick low-order three chars 3/22/11
		var iconStr = fac_sym.substring(origin);
<?php 
                    echo "var fac_icon_url = \"./our_icons/gen_fac_icon.php?blank={$fac_type}&text=\" + (iconStr) + \"\";\n";
                    echo "fac_icon.image = fac_icon_url;\n";
                    echo "var fac_point = new GLatLng(" . $row_fac['lat'] . "," . $row_fac['lng'] . ");\n";
                    echo "var fac_marker = createfacMarker(fac_point, myfacinfoTabs, g, fac_icon);\n";
                    echo "map.addOverlay(fac_marker);\n";
                    echo "\n";
                }
            }
            // end if my_is_float - facilities
            ?>
		g++;
<?php 
        }
        // end while
    }
    // =====================================End of functions to show facilities========================================================================
    do_kml();
    // kml functions
    ?>
	function lat2ddm(inlat) {				// 9/7/08
		var x = new Number(inlat);
		var y  = (inlat>0)?  Math.floor(x):Math.round(x);
		var z = ((Math.abs(x-y)*60).toFixed(1));
		var nors = (inlat>0.0)? " N":" S";
		return Math.abs(y) + '\260 ' + z +"'" + nors;
		}

	function lng2ddm(inlng) {
		var x = new Number(inlng);
		var y  = (inlng>0)?  Math.floor(x):Math.round(x);
		var z = ((Math.abs(x-y)*60).toFixed(1));
		var eorw = (inlng>0.0)? " E":" W";
		return Math.abs(y) + '\260 ' + z +"'" + eorw;
		}


	function do_coords(inlat, inlng) {  //9/14/08
		if(inlat.toString().length==0) return;								// 10/15/08
		var str = inlat + ", " + inlng + "\n";
		str += ll2dms(inlat) + ", " +ll2dms(inlng) + "\n";
		str += lat2ddm(inlat) + ", " +lng2ddm(inlng);
		alert(str);
		}

	function ll2dms(inval) {				// lat/lng to degr, mins, sec's - 9/9/08
		var d = new Number(inval);
		d  = (inval>0)?  Math.floor(d):Math.round(d);
		var mi = (inval-d)*60;
		var m = Math.floor(mi)				// min's
		var si = (mi-m)*60;
		var s = si.toFixed(1);
		return d + '\260 ' + Math.abs(m) +"' " + Math.abs(s) + '"';
		}

	</SCRIPT>
<?php 
}
Пример #12
0
echo '<div id="newswrap">' . "\n";
echo '<div class="topheading"><h2>' . _('noticias más comentadas') . '</h2></div>';
$link = new Link();
// Use memcache if available
if ($globals['memcache_host'] && get_current_page() < 4) {
    $memcache_key = 'topcommented_' . $from . '_' . get_current_page();
}
if (!($memcache_key && ($rows = memcache_mget($memcache_key . 'rows')) && ($links = memcache_mget($memcache_key)))) {
    // It's not in memcache
    if ($time_link) {
        $rows = min(100, $db->get_var("SELECT count(*) FROM links WHERE {$time_link}"));
    } else {
        $rows = min(100, $db->get_var("SELECT count(*) FROM links"));
    }
    if ($rows == 0) {
        do_error(_('no hay noticias seleccionadas'), 500);
    }
    $links = $db->get_results("{$sql} LIMIT {$offset},{$page_size}");
    if ($memcache_key) {
        memcache_madd($memcache_key . 'rows', $rows, 1800);
        memcache_madd($memcache_key, $links, 1800);
    }
}
if ($links) {
    foreach ($links as $dblink) {
        $link->id = $dblink->link_id;
        $link->read();
        $link->print_summary('short');
    }
}
do_pages($rows, $page_size);
function count_facilities()
{
    $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}facilities`";
    $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
    $facilities_no = mysql_affected_rows();
    return $facilities_no;
}
Пример #14
0
<?php

// The source code packaged with this file is Free Software, Copyright (C) 2011 by
// Ricardo Galli <gallir at gmail dot com>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include 'config.php';
$globals['force_ssl'] = False;
// We open the bar always as http to allow loading no https pages
include mnminclude . 'html1.php';
$url_args = $globals['path'];
$id = intval($globals['path'][1]);
if (!$id > 0 || !($link = Link::from_db($id))) {
    do_error(_('enlace no encontrado'), 404);
}
// Mark as read, add click if necessary
$link->add_click();
if ($globals['https'] && !preg_match('/^https:/', $link->url)) {
    redirect($link->url);
    die;
}
$link->title = text_to_summary($link->title, 80);
// From libs/html1.php do_header()
header('Content-Type: text/html; charset=utf-8');
$globals['security_key'] = get_security_key();
setcookie('k', $globals['security_key'], 0, $globals['base_url']);
// From libks/link.php print_summary()
$link->is_votable();
$link->permalink = $link->get_permalink();
 function get_buttons($user_id)
 {
     //	5/3/11
     if (isset($_SESSION['viewed_groups'])) {
         $regs_viewed = explode(",", $_SESSION['viewed_groups']);
     }
     $query2 = "SELECT * FROM `{$GLOBALS['mysql_prefix']}allocates` WHERE `type`= 4 AND `resource_id` = '{$user_id}' ORDER BY `group`";
     //	5/3/11
     $result2 = mysql_query($query2) or do_error($query2, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
     $al_buttons = "";
     while ($row2 = stripslashes_deep(mysql_fetch_assoc($result2))) {
         //	5/3/11
         if (!empty($regs_viewed)) {
             if (in_array($row2['group'], $regs_viewed)) {
                 $al_buttons .= "<DIV style='display: block;'><INPUT TYPE='checkbox' CHECKED name='frm_group[]' VALUE='{$row2['group']}'></INPUT>" . get_groupname($row2['group']) . "&nbsp;&nbsp;</DIV>";
             } else {
                 $al_buttons .= "<DIV style='display: block;'><INPUT TYPE='checkbox' name='frm_group[]' VALUE='{$row2['group']}'></INPUT>" . get_groupname($row2['group']) . "&nbsp;&nbsp;</DIV>";
             }
         } else {
             $al_buttons .= "<DIV style='display: block;'><INPUT TYPE='checkbox' CHECKED name='frm_group[]' VALUE='{$row2['group']}'></INPUT>" . get_groupname($row2['group']) . "&nbsp;&nbsp;</DIV>";
         }
     }
     return $al_buttons;
 }
function cid_lookup($phone)
{
    $aptStr = " Apt:";
    function do_the_row($inRow)
    {
        // for ticket or constituents data
        global $apartment, $misc;
        $outStr = $inRow['contact'] . ";";
        // phone
        $outStr .= $inRow['phone'] . ";";
        // phone
        $outStr .= $inRow['street'] . stripos($inRow['street'], " Apt:") ? "" : $apartment;
        // street and apartment - 3/13/10
        $outStr .= $inRow['street'] . $apartment . ";";
        // street and apartment - 3/13/10
        $outStr .= $inRow['city'] . ";";
        // city
        $outStr .= $inRow['state'] . ";";
        // state
        $outStr .= ";";
        // frm_zip - unused
        $outStr .= $inRow['lat'] . ";";
        $outStr .= $inRow['lng'] . ";";
        $outStr .= $misc . ";";
        // possibly empty - 3/13/10
        return $outStr;
        // end function do_the_row()
    }
    // collect constituent data this phone no.
    $query = "SELECT  * FROM `{$GLOBALS['mysql_prefix']}constituents` WHERE `phone`= '{$phone}'\n\t\tOR `phone_2`= '{$phone}' OR `phone_3`= '{$phone}' OR `phone_4`= '{$phone}'\tLIMIT 1";
    $result = mysql_query($query) or do_error("", 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
    $cons_row = mysql_num_rows($result) == 1 ? stripslashes_deep(mysql_fetch_array($result)) : NULL;
    $apartment = is_null($cons_row) ? "" : $aptStr . $cons_row['apartment'];
    // note brackets
    $misc = is_null($cons_row) ? "" : $cons_row['miscellaneous'];
    $query = "SELECT  * FROM `{$GLOBALS['mysql_prefix']}ticket` WHERE `phone`= '{$phone}' ORDER BY `updated` DESC";
    // 9/29/09
    $result = mysql_query($query) or do_error("", 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
    $ret = mysql_num_rows($result) . ";";
    // hits - common to each return
    if (mysql_num_rows($result) > 0) {
        // build return string from newest incident data
        $row = stripslashes_deep(mysql_fetch_array($result));
        $ret .= do_the_row($row);
    } elseif (!is_null($cons_row)) {
        // 3/13/10
        $ret .= do_the_row($cons_row);
        // otherwise use constituents data
    } else {
        // no priors or constituents - do WP
        $wp_key = get_variable("wp_key");
        // 1/26/09
        $url = "http://api.whitepages.com/reverse_phone/1.0/?phone=" . urlencode($phone) . ";api_key=" . $wp_key;
        if (isset($phone)) {
            // wp phone lookup
            $url = "http://api.whitepages.com/reverse_phone/1.0/?phone=" . urlencode($phone) . ";api_key=" . $wp_key;
        }
        $data = "";
        if (function_exists("curl_init")) {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            $data = curl_exec($ch);
            curl_close($ch);
        } else {
            // not CURL
            if ($fp = @fopen($url, "r")) {
                while (!feof($fp) && strlen($data) < 9000) {
                    $data .= fgets($fp, 128);
                }
                fclose($fp);
            } else {
                print "-error 1";
                // @fopen fails
            }
        }
        //						target: "Arnold Shore;(410) 849-8721;1684 Anne Ct;  Annapolis; MD;21401;lattitude;longitude; miscellaneous"
        if (!(strpos($data, "Invalid") > 0 || strpos($data, "Missing") > 0)) {
            $aryk[0] = "<wp:firstname>";
            $aryk[1] = "<wp:lastname>";
            $aryk[2] = "<wp:fullphone>";
            $aryk[3] = "<wp:fullstreet>";
            $aryk[4] = "<wp:city>";
            $aryk[5] = "<wp:state>";
            $aryk[6] = "<wp:zip>";
            $aryk[7] = "<wp:latitude>";
            $aryk[8] = "<wp:longitude>";
            //			dump($aryk);
            $aryv = array(9);
            // values
            //	First Last;(123) 456-7890;1234 Name Ct,  Where, NY 12345"
            $arys[0] = " ";
            // firstname
            $arys[1] = ";";
            // lastname
            $arys[2] = ";";
            // fullphone
            $arys[3] = ";";
            // fullstreet
            $arys[4] = ";";
            // city
            $arys[5] = ";";
            // state
            $arys[6] = ";";
            // zip
            $arys[7] = ";";
            // latitude
            $arys[8] = ";";
            // longitude
            $pos = 0;
            //
            for ($i = 0; $i < count($aryk); $i++) {
                $pos = strpos($data, $aryk[$i], $pos);
                if ($pos === false) {
                    // bad
                    $arys = "";
                    break;
                }
                $lhe = $pos + strlen($aryk[$i]);
                $rhe = strpos($data, "<", $lhe);
                $aryv[$i] = substr($data, $lhe, $rhe - $lhe);
                // substr ( string, start , length )
            }
            // end for ($i...)
            //			dump($aryv);
            if (!empty($arys)) {
                // 11/11/09
                for ($i = 0; $i < count($aryk); $i++) {
                    // append return string to match count
                    $ret .= $aryv[$i] . $arys[$i];
                    // value + separator
                }
                // end for ()
                unset($result);
            }
        }
    }
    // end no priors
    //dump($ret);
    return $ret;
}
Пример #17
0
 function updt_ticket($id)
 {
     /* 1/25/09 */
     global $addrs, $NOTIFY_TICKET;
     $post_frm_meridiem_problemstart = empty($_POST) || !empty($_POST) && empty($_POST['frm_meridiem_problemstart']) ? "" : $_POST['frm_meridiem_problemstart'];
     $post_frm_meridiem_booked_date = empty($_POST) || !empty($_POST) && empty($_POST['frm_meridiem_booked_date']) ? "" : $_POST['frm_meridiem_booked_date'];
     //10/1/09
     $post_frm_affected = empty($_POST) || !empty($_POST) && empty($_POST['frm_affected']) ? "" : $_POST['frm_affected'];
     $_POST['frm_description'] = strip_html($_POST['frm_description']);
     //clean up HTML tags
     $post_frm_affected = strip_html($post_frm_affected);
     $_POST['frm_scope'] = strip_html($_POST['frm_scope']);
     if (!get_variable('military_time')) {
         //put together date from the dropdown box and textbox values
         if ($post_frm_meridiem_problemstart == 'pm') {
             $post_frm_meridiem_problemstart = ($post_frm_meridiem_problemstart + 12) % 24;
         }
     }
     if (!get_variable('military_time')) {
         //put together date from the dropdown box and textbox values
         if ($post_frm_meridiem_booked_date == 'pm') {
             $post_frm_meridiem_booked_date = ($post_frm_meridiem_booked_date + 12) % 24;
         }
     }
     if (empty($post_frm_owner)) {
         $post_frm_owner = 0;
     }
     $frm_problemstart = "{$_POST['frm_year_problemstart']}-{$_POST['frm_month_problemstart']}-{$_POST['frm_day_problemstart']} {$_POST['frm_hour_problemstart']}:{$_POST['frm_minute_problemstart']}:00{$post_frm_meridiem_problemstart}";
     if (intval($_POST['frm_status']) == 3) {
         // 1/21/11
         $frm_booked_date = "{$_POST['frm_year_booked_date']}-{$_POST['frm_month_booked_date']}-{$_POST['frm_day_booked_date']} {$_POST['frm_hour_booked_date']}:{$_POST['frm_minute_booked_date']}:00{$post_frm_meridiem_booked_date}";
     } else {
         //				$frm_booked_date = "NULL";
         $frm_booked_date = "";
         // 6/20/10
     }
     if (!get_variable('military_time')) {
         //put together date from the dropdown box and textbox values
         if ($post_frm_meridiem_problemstart == 'pm') {
             $_POST['frm_hour_problemstart'] = ($_POST['frm_hour_problemstart'] + 12) % 24;
         }
         if (isset($_POST['frm_meridiem_problemend'])) {
             if ($_POST['frm_meridiem_problemend'] == 'pm') {
                 $_POST['frm_hour_problemend'] = ($_POST['frm_hour_problemend'] + 12) % 24;
             }
         }
         if (isset($_POST['frm_meridiem_booked_date'])) {
             //10/1/09
             if ($_POST['frm_meridiem_booked_date'] == 'pm') {
                 $_POST['frm_hour_booked_date'] = ($_POST['frm_hour_booked_date'] + 12) % 24;
             }
         }
     }
     $frm_problemend = isset($_POST['frm_year_problemend']) ? quote_smart("{$_POST['frm_year_problemend']}-{$_POST['frm_month_problemend']}-{$_POST['frm_day_problemend']} {$_POST['frm_hour_problemend']}:{$_POST['frm_minute_problemend']}:00") : "NULL";
     $now = mysql_format_date(time() - intval(get_variable('delta_mins') * 60));
     // 6/20/10
     if (empty($post_frm_owner)) {
         $post_frm_owner = 0;
     }
     //			$inc_num_ary = unserialize (get_variable('_inc_num'));					// 11/13/10
     $temp = get_variable('_inc_num');
     // 3/2/11
     $inc_num_ary = strpos($temp, "{") > 0 ? unserialize($temp) : unserialize(base64_decode($temp));
     $name_rev = $_POST['frm_scope'];
     if ($inc_num_ary[0] == 0) {
         // no auto numbering scheme
         switch (get_variable('serial_no_ap')) {
             // incident name revise -1/22/09
             case 0:
                 /*  no serial no. */
                 $name_rev = $_POST['frm_scope'];
                 break;
             case 1:
                 /*  prepend  */
                 $name_rev = $id . "/" . $_POST['frm_scope'];
                 break;
             case 2:
                 /*  append  */
                 $name_rev = $_POST['frm_scope'] . "/" . $id;
                 break;
             default:
                 /* error????  */
                 $name_rev = " error  error  error ";
         }
         // end switch
         // 8/23/08, 9/20/08, 8/13/09
     }
     // end if()
     $facility_id = empty($_POST['frm_facility_id']) ? 0 : trim($_POST['frm_facility_id']);
     // 9/28/09
     $rec_facility_id = empty($_POST['frm_rec_facility_id']) ? 0 : trim($_POST['frm_rec_facility_id']);
     // 9/28/09
     $groups = "," . implode(',', $_POST['frm_group']) . ",";
     //	6/10/11
     if ($facility_id > 0) {
         // 9/22/09
         $query_g = "SELECT * FROM {$GLOBALS['mysql_prefix']}facilities WHERE `id`= {$facility_id} LIMIT 1";
         $result_g = mysql_query($query_g) or do_error($query_g, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
         $row_g = stripslashes_deep(mysql_fetch_array($result_g));
         $the_lat = $row_g['lat'];
         // use facility location
         $the_lng = $row_g['lng'];
     } else {
         $the_lat = quote_smart(trim($_POST['frm_lat']));
         // use incident location
         $the_lng = quote_smart(trim($_POST['frm_lng']));
     }
     if (strlen($the_lat) < 3 && strlen($the_lng) < 3) {
         // 1/29/11
         $the_lat = $the_lng = 0.999999;
     }
     // perform db update	//9/22/09 added facility capability, 10/1/09 added receiving facility
     @session_start();
     $by = $_SESSION['user_id'];
     //			$booked_date = empty($frm_booked_date)? "NULL" : quote_smart(trim($frm_booked_date)) ;	// 6/20/10
     $booked_date = intval(trim($_POST['frm_do_scheduled']) == 1) ? quote_smart($frm_booked_date) : "NULL";
     // 1/2/11, 1/19/10
     //			die;
     // 6/26/10
     $query = "UPDATE `{$GLOBALS['mysql_prefix']}ticket` SET \n\t\t\t\t`contact`= " . quote_smart(trim($_POST['frm_contact'])) . ",\n\t\t\t\t`street`= " . quote_smart(trim($_POST['frm_street'])) . ",\n\t\t\t\t`city`= " . quote_smart(trim($_POST['frm_city'])) . ",\n\t\t\t\t`state`= " . quote_smart(trim($_POST['frm_state'])) . ",\n\t\t\t\t`phone`= " . quote_smart(trim($_POST['frm_phone'])) . ",\n\t\t\t\t`facility`= " . quote_smart($facility_id) . ",\n\t\t\t\t`rec_facility`= " . quote_smart($rec_facility_id) . ",\n\t\t\t\t`lat`= " . $the_lat . ",\n\t\t\t\t`lng`= " . $the_lng . ",\n\t\t\t\t`scope`= " . quote_smart(trim($name_rev)) . ",\n\t\t\t\t`owner`= " . quote_smart(trim($post_frm_owner)) . ",\n\t\t\t\t`severity`= " . quote_smart(trim($_POST['frm_severity'])) . ",\n\t\t\t\t`in_types_id`= " . quote_smart(trim($_POST['frm_in_types_id'])) . ",\n\t\t\t\t`status`=" . quote_smart(trim($_POST['frm_status'])) . ",\n\t\t\t\t`problemstart`=" . quote_smart(trim($frm_problemstart)) . ",\n\t\t\t\t`problemend`=" . $frm_problemend . ",\n\t\t\t\t`description`= " . quote_smart(trim($_POST['frm_description'])) . ",\n\t\t\t\t`comments`= " . quote_smart(trim($_POST['frm_comments'])) . ",\n\t\t\t\t`nine_one_one`= " . quote_smart(trim($_POST['frm_nine_one_one'])) . ",\n\t\t\t\t`booked_date`= " . $booked_date . ",\n\t\t\t\t`date`='{$now}',\n\t\t\t\t`updated`='{$now}',\n\t\t\t\t`_by` = {$by}\n\t\t\t\tWHERE ID={$id}";
     $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
     $tick_stat = $_POST['frm_status'];
     // 6/10/11
     $prob_start = quote_smart(trim($frm_problemstart));
     // 6/10/11
     foreach ($_POST['frm_group'] as $grp_val) {
         // 6/10/11
         if (test_allocates($id, $grp_val, 1)) {
             $query_a = "INSERT INTO `{$GLOBALS['mysql_prefix']}allocates` (`group` , `type`, `al_as_of` , `al_status` , `resource_id` , `sys_comments` , `user_id`) VALUES \n\t\t\t\t\t\t({$grp_val}, 1, '{$now}', {$tick_stat}, {$id}, 'Allocated to Group' , {$by})";
             $result_a = mysql_query($query_a) or do_error($query_a, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
         }
     }
     do_log($GLOBALS['LOG_INCIDENT_OPEN'], $id);
     if (intval($facility_id) > 0) {
         //9/22/09, 10/1/09, 3/24/10
         do_log($GLOBALS['LOG_FACILITY_INCIDENT_OPEN'], $id, '', 0, $facility_id);
         // - 7/11/10
     }
     if (intval($rec_facility_id) > 0) {
         do_log($GLOBALS['LOG_CALL_REC_FAC_SET'], $id, 0, 0, 0, $rec_facility_id);
         // 6/20/10 - 7/11/10
     }
     $the_year = date("y");
     if ((int) $inc_num_ary[0] == 3 && !($inc_num_ary[5] == $the_year)) {
         // year style and change?
         $inc_num_ary[3] = 1;
         // roll over and start at 1
         $inc_num_ary[5] = $the_year;
     } else {
         if ((int) $inc_num_ary[0] > 0) {
             // step to next no. if scheme in use
             $inc_num_ary[3]++;
             // do the deed for next use
         }
         $out_str = base64_encode(serialize($inc_num_ary));
         // 3/2/11
         $query = "UPDATE`{$GLOBALS['mysql_prefix']}settings` SET `value` = '{$out_str}' WHERE `name` = '_inc_num'";
         $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
     }
     return $name_rev;
 }
    // print from buffer
    do_stats($buffer);
}
// end else{}
$tick_array2 = array_unique($tick_array);
// delete dupes
$tick_array3 = array_values($tick_array2);
// compress result
$sep = $tick_str = "";
for ($i = 0; $i < count($tick_array3); $i++) {
    $tick_str .= $sep . $tick_array3[$i];
    $sep = ",";
}
//	dump($tick_str);
$query = "SELECT *, \n\t\tUNIX_TIMESTAMP(problemstart) AS `problemstart`,\n\t\tUNIX_TIMESTAMP(problemend) AS `problemend`,\n\t\t`u`.`user` AS `theuser`,\n\t\tNULL AS `unit_name`,\n\t\t`t`.`scope` AS `tick_scope`,\n\t\t`t`.`id` AS `tick_id`,\n\t\t`t`.`description` AS `tick_descr`,\n\t\t`t`.`status` AS `tick_status`,\n\t\t`t`.`street` AS `tick_street`,\n\t\t`t`.`city` AS `tick_city`,\n\t\t`t`.`state` AS `tick_state`,\t\t\t\n\t\t`f`.`name` AS `facy_name` \n\t\tFROM `{$GLOBALS['mysql_prefix']}ticket`\t\t\t `t`\n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}user`\t\t `u` ON (`t`.`_by` = `u`.`id`)\n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}facilities` `f` ON (`t`.`facility` = `f`.`id`)\n\t\tWHERE `t`.`id` NOT IN ({$tick_str})\n\t\tAND `t`.`status` <> '{$GLOBALS['STATUS_RESERVED']}'\n\t\tORDER BY `problemstart` ASC";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
print "<TR><TD COLSPAN=99 ALIGN='center'><B>Not dispatched</B></TD></TR>";
$units_str = "";
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
    // final while ()
    $deltas[$row['severity']] += $row['problemend'] - $row['problemstart'];
    // stats
    $deltas[3] += $row['problemend'] - $row['problemstart'];
    $counts[$row['severity']]++;
    $counts[3]++;
    do_print($row);
}
print "</TABLE>";
print "<BR /><BR /><SPAN STYLE='margin-left:100px'>Mean incident close times by severity:&nbsp;&nbsp;&nbsp;";
for ($i = 0; $i < 3; $i++) {
    // each severity level
 function get_cd_str($in_row)
 {
     // unit row in,
     global $unit_id;
     //																			// first, already on this run?
     $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}assigns` WHERE  `ticket_id` = " . get_ticket_id() . "\n\t\t\t\t\t AND (`responder_id`={$in_row['unit_id']}) \n\t\t\t\t\t AND ((`clear` IS NULL) OR (DATE_FORMAT(`clear`,'%y') = '00')) LIMIT 1;";
     // 6/25/10
     $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
     if (mysql_affected_rows() == 1) {
         return " CHECKED DISABLED ";
     }
     if ($unit_id != "" && (mysql_affected_rows() != 1 || mysql_affected_rows() == 1 && intval($in_row['multi']) == 1)) {
         print "checked";
         return " CHECKED ";
     }
     // 12/18/10 - Checkbox checked here individual unit seleted.
     if (intval($in_row['dispatch']) == 2) {
         return " DISABLED ";
     }
     // 2nd, disallowed  - 5/30/10
     if (intval($in_row['multi']) == 1) {
         return "";
     }
     // 3rd, allowed
     $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}assigns` \n\t\t\t\t\tWHERE `responder_id`={$in_row['unit_id']} \n\t\t\t\t\tAND ((`clear` IS NULL) OR (DATE_FORMAT(`clear`,'%y') = '00'))\n\t\t\t\t\tLIMIT 1;";
     // 6/25/10
     $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
     if (mysql_affected_rows() == 1) {
         return " DISABLED ";
     } else {
         return "";
     }
 }
Пример #20
0
	<div><label>Payment Amount</label></div>
	<div><input type="text" name="payment_amount" maxlength="50" value="<?php 
    echo $family['payment_amount'];
    ?>
" /></div>
	<br clear="all" />

	<div align="right"><input id="button" type="submit" name="submit" value="Save"></div>
	</form>
<?php 
} elseif ($_GET['op'] == 'add') {
    if (isset($_POST['submit'])) {
        $sql = "INSERT INTO nanny_family SET \n                        family_name     = '" . $_POST['family_name'] . "',\n                        payment_rate    = '" . $_POST['payment_rate'] . "',\n                        payment_amount  = '" . $_POST['payment_amount'] . "'";
        if (!mysql_query($sql, $db)) {
            do_error($sql, $db);
        }
        header("Location: family.php");
    }
    $admin_sub_menu = '<h3>Family Admin</h3><ul><li><a href="family.php">Cancel</a></li></ul>';
    include "header.php";
    ?>
        <form method="post">
        <h2>Add New Family</h2>

        <div><label>Family Name (Last Only)</label></div>
        <div><input type="text" name="family_name" alt="Family Name" maxlength="50" /></div>

        <br clear="all" />

        <div><label>Payment Rate</label></div>
Пример #21
0
    /*
    	case 'categories':
    		do_categories();
    		break;
    */
    case 'conversation':
        do_conversation();
        if (!$globals['bot']) {
            do_pages($rows, $page_size, false);
        }
        break;
    case 'profile':
        do_profile();
        break;
    default:
        do_error(_('opción inexistente'), 404);
        break;
}
echo '</div>' . "\n";
do_footer();
function do_profile()
{
    global $user, $current_user, $login, $db, $globals;
    $options = array();
    $options[$user->username] = get_user_uri($user->username);
    //$options[_('categorías personalizadas')] = get_user_uri($user->username, 'categories');
    if ($current_user->user_id == $user->id || $current_user->user_level == 'god') {
        $options[_('modificar perfil') . ' &rarr;'] = $globals['base_url'] . 'profile?login='******'extra_js'][] = 'jquery.flot.min.js';
        $globals['extra_js'][] = 'jquery.flot.time.min.js';
    }
Пример #22
0
<?php

// The source code packaged with this file is Free Software, Copyright (C) 2011 by
// Menéame and Ricardo Galli <gallir at gallir dot com>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
//include('../config.php');
//include('common.php');
include mnminclude . 'html1.php';
if (!$current_user->user_id) {
    do_error(_('debe autentificarse'), 401);
}
$globals['extra_js'][] = 'jquery.form.min.js';
$globals['extra_js'][] = 'autocomplete/jquery.autocomplete.min.js';
$globals['extra_js'][] = 'jquery.user_autocomplete.js';
$globals['extra_css'][] = 'jquery.autocomplete.css';
$globals['ads'] = false;
$page_size = 50;
$offset = (get_current_page() - 1) * $page_size;
$page_title = _('mensajes privados') . ' | ' . _('menéame');
switch ($argv[1]) {
    case 'sent':
        $where = "privates.user = {$current_user->user_id}";
        $order_by = "ORDER BY date desc";
        $limit = "LIMIT {$offset},{$page_size}";
        $view = 1;
        break;
    default:
        $where = "privates.to = {$current_user->user_id}";
Пример #23
0
    $url_args = preg_split('/\\/+/', $_SERVER['PATH_INFO']);
    array_shift($url_args);
    // The first element is always a "/"
    $comment->id = intval($url_args[0]);
} else {
    $url_args = preg_split('/\\/+/', $_REQUEST['id']);
    $comment->id = intval($url_args[0]);
    if ($comment->id > 0 && $globals['base_comment_url']) {
        // Redirect to the right URL if the link has a "semantic" uri
        header('HTTP/1.1 301 Moved Permanently');
        header('Location: ' . $comment->get_relative_individual_permalink());
        die;
    }
}
if (!$comment->read()) {
    do_error(_('comentario no encontrado'), 404);
}
$link = Link::from_db($comment->link, null, false);
if ($link->is_discarded()) {
    $globals['ads'] = false;
    $globals['noindex'] = true;
}
$globals['link'] = $link;
$globals['permalink'] = 'http://' . get_server_name() . $comment->get_relative_individual_permalink();
// Change to a min_value is times is changed for the current link_status
if ($globals['time_enabled_comments_status'][$link->status]) {
    $globals['time_enabled_comments'] = min($globals['time_enabled_comments_status'][$link->status], $globals['time_enabled_comments']);
}
// Check for comment post
if ($_POST['process'] == 'newcomment') {
    $new = new Comment();
function cid_lookup($phone)
{
    $aptStr = " Apt:";
    function do_the_row($inRow, $source_id, $the_phone)
    {
        // for ticket or constituents data
        global $apartment, $misc;
        $outStr = $inRow['contact'] . ";";
        // name
        $outStr .= extr_digits($the_phone) . ";";
        // phone
        $outStr .= $inRow['street'] . stripos($inRow['street'], " Apt:") ? "" : $apartment;
        // street and apartment - 3/13/10
        $outStr .= $inRow['street'] . $apartment . ";";
        // street and apartment - 3/13/10
        $outStr .= $inRow['city'] . ";";
        // city
        $outStr .= $inRow['state'] . ";";
        // state
        $outStr .= ";";
        // frm_zip - unused
        $outStr .= $inRow['lat'] . ";";
        $outStr .= $inRow['lng'] . ";";
        $outStr .= $misc . ";";
        // possibly empty - 3/13/10
        $outStr .= $source_id . ";";
        //
        return $outStr;
        // end function do the_row()
    }
    // collect constituent data this phone no.
    $query = "SELECT  * FROM `{$GLOBALS['mysql_prefix']}constituents` WHERE `phone`= '{$phone}'\n\t\tOR `phone_2`= '{$phone}' OR `phone_3`= '{$phone}' OR `phone_4`= '{$phone}'\tLIMIT 1";
    $result = mysql_query($query) or do_error("", 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
    $cons_row = mysql_num_rows($result) == 1 ? stripslashes_deep(mysql_fetch_array($result)) : NULL;
    $apartment = is_null($cons_row) ? "" : $aptStr . $cons_row['apartment'];
    $misc = is_null($cons_row) ? "" : $cons_row['miscellaneous'];
    $source = 0;
    // none
    $query = "SELECT  * FROM `{$GLOBALS['mysql_prefix']}ticket` WHERE `phone`= '{$phone}' ORDER BY `updated` DESC";
    // 9/29/09
    $result = mysql_query($query) or do_error("", 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
    $ret = mysql_num_rows($result) . ";";
    // hits - common to each return
    if (mysql_num_rows($result) > 0) {
        // build return string from newest incident data
        $row = stripslashes_deep(mysql_fetch_array($result));
        $source_id = 1;
        // incidents
        $ret .= do_the_row($row, $source_id, $phone);
    } elseif (!is_null($cons_row)) {
        // 3/13/10
        $source_id = 2;
        // constituents
        $ret .= do_the_row($cons_row, $source_id, $phone);
        // otherwise use constituents data
    } else {
        // no priors or constituents - do WP
        $source_id = 3;
        // wp
        $ret = get_wp_data($phone, $source_id, $phone);
    }
    // end no priors
    $ret .= ";" . $source;
    // add data source
    return $ret;
    // semicolon-separated string
}
Пример #25
0
		$tab_option = 3;
		break;
	case 'log':
		$tab_option = 4;
		break;
	case 'sneak':
		$tab_option = 5;
		break;
	case 'favorites':
		$tab_option = 6;
		break;
	case 'trackbacks':
		$tab_option = 7;
		break;
	default:
		do_error(_('página inexistente'), 404);
}

// Set globals
$globals['link'] = $link;
$globals['link_id'] = $link->id;
$globals['link_permalink'] = $globals['link']->get_permalink();

// to avoid search engines penalisation
if ($tab_option != 1 || $link->status == 'discard') {
	$globals['noindex'] = true;
}

do_modified_headers($link->modified, $current_user->user_id.'-'.$globals['link_id'].'-'.$link->comments.'-'.$link->modified);

// Enable user AdSense
function do_list($unit_id = "")
{
    global $row_fac, $dispatches, $from_top, $from_left, $eol, $conversion;
    //	2/4/11
    ?>
<SCRIPT>
	var color=0;
	var last_from;
	var last_to;
	var current_id;
	var output_direcs = "";
	var have_direcs = 0;
	var fac_name = "<?php 
    print $row_fac['fac_name'];
    ?>
";	//10/29/09 - 11/13/09
	
	if (GBrowserIsCompatible()) {
		var colors = new Array ('odd', 'even');
	    function setDirections(fromAddress, toAddress, locale, unit_id) {
		$("mail_button").style.display = "none";
		$("loading").style.display = "inline-block";		// 10/28/09
	    	last_from = fromAddress;
	    	last_to = toAddress;
		f_unit = unit_id;
		   	G_START_ICON.image = "./our_icons/sm_white.png";
		   	G_START_ICON.iconSize = new GSize(12,20); 
		   	G_END_ICON.image = "./our_icons/sm_white.png";
		   	G_END_ICON.iconSize = new GSize(12,20);         	

	    	var Direcs = gdir.load("from: " + fromAddress + " to: " + toAddress, { "locale": locale, preserveViewport : true  });
			GEvent.addListener(Direcs, "addoverlay", GEvent.callback(Direcs, cb())); 
	    	}		// end function set Directions()

		function cb() {
			setTimeout(cb2,3000);     // I THINK you need quotes around the named function - here's 2 seconds of delay
		}      // end function cb()


		function cb2() {                                        // callback function 09/11/09
			var output_direcs = "";
			for ( var i = 0; i < gdir.getNumRoutes(); i++) {        // Traverse all routes - not really needed here, but ...
				var groute = gdir.getRoute(i);
				var distanceTravelled = 0;             // if you want to start summing these
 
				for ( var j = 0; j < groute.getNumSteps(); j++) {                // Traverse the steps this route
					var gstep = groute.getStep(j);
					var directions_text =  gstep.getDescriptionHtml();
					var directions_dist = gstep.getDistance().html;
//					alert ("1387 " + gstep.getDescriptionHtml());
//					alert ("1388 " + gstep.getDistance().html);
					output_direcs = output_direcs + directions_text + " " + directions_dist + ". " + "\n";

				}
			}
			output_direcs = output_direcs.replace("<div class=\"google_note\">", "\n - ");
			output_direcs = output_direcs.replace("&nbsp:", " ");
			document.email_form.frm_direcs.value = output_direcs;
			document.email_form.frm_u_id.value = f_unit;
			document.email_form.frm_scope.value = fac_name;	//10/29/09
			$("mail_button").style.display = "inline-block";	//10/6/09
			$("loading").style.display = "none";		// 10/28/09			
		}                // end function cb2()

		function mail_direcs(f) {
			f.target = 'Mail Form'
			newwindow_mail=window.open('',f.target,'titlebar, location=0, resizable=1, scrollbars, height=360,width=600,status=0,toolbar=0,menubar=0,location=0, left=100,top=300,screenX=100,screenY=300');
			if (isNull(newwindow_mail)) {
				alert ("Email edit operation requires popups to be enabled -- please adjust your browser options.");
				return;
				}
			newwindow_mail.focus();
			f.submit();
			return false;
			}

	
		function do_sidebar(sidebar, color, id, unit_id) {						// No map
			var letter = ""+ id;	
			marker = null;
			gmarkers[id] = null;										// marker to array for side_bar click function
	
			side_bar_html += "<TR CLASS='" + colors[(id+1)%2] +"' VALIGN='bottom' onClick = myclick(" + id + "," + unit_id +");><TD>";
			side_bar_html += "<IMG BORDER=0 SRC='rtarrow.gif' ID = \"R" + id + "\"  STYLE = 'visibility:hidden;'></TD>";
			var letter = ""+ id;	
			var the_class = (lats[id])?  "emph" : "td_label";

			side_bar_html += "<TD CLASS='" + the_class + "'>" + letter + ". "+ sidebar +"</TD></TR>\n";
			return null;
			}				// end function create Marker()


		function createMarker(point,sidebar,tabs, color, id, unit_id) {		// Creates marker and sets up click event infowindow
			do_sidebar(sidebar, color, id, unit_id)
			var icon = new GIcon(listIcon);
			var uid = unit_id;
			var letter = ""+ id;	
			var icon_url = "./our_icons/gen_icon.php?blank=" + escape(icons[color]) + "&text=" + letter;
	
			icon.image = icon_url;		// ./our_icons/gen_icon.php?blank=4&text=zz"
			var marker = new GMarker(point, icon);
			marker.id = color;				// for hide/unhide - unused
		
			GEvent.addListener(marker, "click", function() {		// here for both side bar and icon click
				map.closeInfoWindow();
				which = id;
				gmarkers[which].hide();
				marker.openInfoWindowTabsHtml(infoTabs[id]);
				var dMapDiv = document.getElementById("detailmap");
				var detailmap = new GMap2(dMapDiv);
//				detailmap.addControl(new GSmallMapControl());
//				map.setUIToDefault();										// 8/13/10
//				detailmap.setCenter(point, 17;  					// larger # = closer
//				detailmap.addOverlay(marker);
				});
		
			gmarkers[id] = marker;							// marker to array for side_bar click function
			infoTabs[id] = tabs;							// tabs to array
			bounds.extend(point);							// extend the bounding box		
			return marker;
			}				// end function create Marker()
	
		function myclick(id, unit_id) {								// responds to side bar click - 11/13/09
//			alert("550 " + direcs[id]);
			which = id;
			document.getElementById(current_id).style.visibility = "hidden";		// hide last check
			current_id= "R"+id;
			document.getElementById(current_id).style.visibility = "visible";		// show newest
			if (!(lats[id])) {
				alert("611 Cannot route -  no position data currently available\n\nClick map point for directions.");
				$('directions').innerHTML = "";							// 11/13/09	
				$('mail_dir_but').style.visibility = "hidden";			// 11/13/09	
				}
			else {
				$('mail_dir_but').style.visibility = "visible";			// 11/13/09	
				var thelat = <?php 
    print $row_fac['lat'];
    ?>
; var thelng = <?php 
    print $row_fac['lng'];
    ?>
;		// coords of click point
				setDirections(lats[id] + " " + lngs[id], thelat + " " + thelng, "en_US", unit_id);							// get directions
				}
			}					// end function my click(id)
	
		var the_grid;
		var grid = false;
		function doGrid() {
			if (grid) {
				map.removeOverlay(the_grid);
				}
			else {
				the_grid = new LatLonGraticule();
				map.addOverlay(the_grid);
				}
			grid = !grid;
			}			// end function doGrid
			
	    var trafficInfo = new GTrafficOverlay();
	    var toggleState = true;
	
		function doTraffic() {
			if (toggleState) {
		        map.removeOverlay(trafficInfo);
		     	} 
			else {
		        map.addOverlay(trafficInfo);
		    	}
	        toggleState = !toggleState;			// swap
		    }				// end function doTraffic()
	
		var starting = false;

		function sv_win(theLat, theLng) {
			if(starting) {return;}						// dbl-click proof
			starting = true;					
//			alert(622);
			var url = "street_view.php?thelat=" + theLat + "&thelng=" + theLng;
			newwindow_sl=window.open(url, "sta_log",  "titlebar=no, location=0, resizable=1, scrollbars, height=450,width=640,status=0,toolbar=0,menubar=0,location=0, left=100,top=300,screenX=100,screenY=300");
			if (!(newwindow_sl)) {
				alert ("Street view operation requires popups to be enabled. Please adjust your browser options - or else turn off the Call Board option.");
				return;
				}
			newwindow_sl.focus();
			starting = false;
			}		// end function sv win()

		
		function handleErrors(){		//G_GEO_UNKNOWN_DIRECTIONS 
			if (gdir.getStatus().code == G_GEO_UNKNOWN_DIRECTIONS ) {
				alert("501: directions unavailable\n\nClick map point for directions.");
				}
			else if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
				alert("440: No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
			else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
				alert("442: A map request could not be processed, reason unknown.\n Error code: " + gdir.getStatus().code);
			else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
				alert("444: Technical error.\n Error code: " + gdir.getStatus().code);
			else if (gdir.getStatus().code == G_GEO_BAD_KEY)
				alert("448: The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);
			else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
				alert("450: A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
			else alert("451: An unknown error occurred.");
			}		// end function handleErrors()

		function onGDirectionsLoad(){ 
//			var temp = gdir.getSummaryHtml();
			}		// function onGDirectionsLoad()

		function guest () {
			alert ("Demonstration only.  Guests may not commit dispatch!");
			}
			
		function validate(){		// frm_id_str
			msgstr="";
			for (var i =1;i<unit_sets.length;i++) {
				if (unit_sets[i]) {
					msgstr+=unit_names[i]+"\n";
					document.routes_Form.frm_id_str.value += unit_ids[i] + "|";
					}
				}
			if (msgstr.length==0) {
				var more = (nr_units>1)? "s": ""
				alert ("Please select unit" + more + ", or cancel");
				return false;
				}
			else {
				if (confirm ("Please confirm Unit dispatch as follows\n\n" + msgstr)) {
					document.routes_Form.frm_id_str.value = document.routes_Form.frm_id_str.value.substring(0, document.routes_Form.frm_id_str.value.length - 1);	// drop trailing separator
					document.routes_Form.frm_name_str.value = msgstr;	// for re-use
					document.routes_Form.submit();
					document.getElementById("outer").style.display = "none";
					document.getElementById("bottom").style.display = "block";					
					}
				else {
					document.routes_Form.frm_id_str.value="";	
					return false;
					}
				}

			}		// end function validate()
	
		function exists(myarray,myid) {
			var str_key = " " + myid;		// force associative
			return ((typeof myarray[str_key])!="undefined");		// exists if not undefined
			}		// end function exists()
			
		var icons=[];						// note globals
<?php 
    $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}fac_types` ORDER BY `id`";
    // types in use
    $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
    $icons = $GLOBALS['fac_icons'];
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        // map type to blank icon id
        $blank = $icons[$row['icon']];
        print "\ticons[" . $row['id'] . "] = " . $row['icon'] . ";\n";
        //
    }
    unset($result);
    ?>
		var map;
		var center;
		var zoom;
		
	    var gdir;				// directions
	    var geocoder = null;
	    var addressMarker;
		$("mail_button").style.display = "none";		// 10/28/09
		$("loading").style.display = "none";		// 10/28/09
		
		var side_bar_html = "<TABLE border=0 CLASS='sidebar' ID='tbl_responders'>";
		side_bar_html += "<TR class='even'>	<TD  COLSPAN=99 ALIGN='center'><B>Routes to Facility: <I><?php 
    print shorten($row_fac['fac_name'], 20);
    ?>
</I></B></TD></TR>\n";
		side_bar_html += "<TR class='odd'>	<TD COLSPAN=99 ALIGN='center'>Click line, icon or map for route</TD></TR>\n";
		side_bar_html += "<TR class='even'>	<TD COLSPAN=3></TD><TD ALIGN='center'>Unit</TD><TD ALIGN='center'>SLD</TD><TD ALIGN='center'>Facility</TD><TD ALIGN='center'>Status</TD><TD ALIGN='center'>As of</TD></TR>\n";

		var gmarkers = [];
		var infoTabs = [];
		var lats = [];
		var lngs = [];
		var distances = [];
		var unit_names = [];			// names
		var unit_contacts = [];		// contact emails
		var unit_sets = [];			// settings
		var unit_ids = [];			// id's
		var unit_assigns =  [];		// unit id's assigned this incident
		var direcs =  [];			// if true, do directions
		var which;			// marker last selected
		var i = 0;			// sidebar/icon index
	
//		map = new GMap2(document.getElementById("map_canvas"));		// create the map
//		map.addControl(new GSmallMapControl());
//		map.addControl(new GMapTypeControl());
<?php 
    if (get_variable('terrain') == 1) {
        ?>
//		map.addMapType(G_PHYSICAL_MAP);
<?php 
    }
    ?>
	

		gdir = new GDirections(map, document.getElementById("directions"));
		
		GEvent.addListener(gdir, "load", onGDirectionsLoad);
		GEvent.addListener(gdir, "error", handleErrors);
		map.setCenter(new GLatLng(<?php 
    echo get_variable('def_lat');
    ?>
, <?php 
    echo get_variable('def_lng');
    ?>
), <?php 
    echo get_variable('def_zoom');
    ?>
);		// <?php 
    echo get_variable('def_lat');
    ?>
	
		var bounds = new GLatLngBounds();						// create empty bounding box
	
		var listIcon = new GIcon();
		listIcon.image = "./markers/yellow.png";	// yellow.png - 16 X 28
//		listIcon.shadow = "./markers/sm_shadow.png";
		listIcon.iconSize = new GSize(20, 34);
//		listIcon.shadowSize = new GSize(37, 34);
		listIcon.iconAnchor = new GPoint(8, 28);
		listIcon.infoWindowAnchor = new GPoint(9, 2);
//		listIcon.infoShadowAnchor = new GPoint(18, 25);
	
		var newIcon = new GIcon();
		newIcon.image = "./markers/white.png";	// yellow.png - 20 X 34
//		newIcon.shadow = "./markers/shadow.png";
		newIcon.iconSize = new GSize(20, 34);
//		newIcon.shadowSize = new GSize(37, 34);
		newIcon.iconAnchor = new GPoint(8, 28);
		newIcon.infoWindowAnchor = new GPoint(9, 2);
//		newIcon.infoShadowAnchor = new GPoint(18, 25);
																	// set Incident position
		var point = new GLatLng(<?php 
    print $row_fac['lat'];
    ?>
, <?php 
    print $row_fac['lng'];
    ?>
);
		bounds.extend(point);

	
		GEvent.addListener(map, "infowindowclose", function() {		// re-center after  move/zoom
			setDirections(last_from, last_to, "en_US") ;
			});
		var accept_click = false;
		GEvent.addListener(map, "click", function(marker, point) {		// point.lat()
			var the_start = point.lat().toString() + "," + point.lng().toString();
			var the_end = thelat.toString() + "," + thelng.toString();			
			setDirections(the_start, the_end, "en_US");			
			});				// end GEvent.addListener()

		var nr_units = 	0;
		var email= false;
	    var km2mi = <?php 
    print $conversion;
    ?>
;				// 
		
<?php 
    $eols = array("\r\n", "\n", "\r");
    // all flavors of eol
    // build js array of responders to this ticket - possibly none
    $where = empty($unit_id) ? "" : " WHERE `{$GLOBALS['mysql_prefix']}responder`.`id` = {$unit_id} ";
    // revised 5/23/08 per AD7PE
    $query = "SELECT *, UNIX_TIMESTAMP(updated) AS updated, `{$GLOBALS['mysql_prefix']}responder`.`id` AS `unit_id`, `s`.`status_val` AS `unitstatus`, `contact_via` FROM {$GLOBALS['mysql_prefix']}responder\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}un_status` `s` ON (`{$GLOBALS['mysql_prefix']}responder`.`un_status_id` = `s`.`id`)\n\t\t\t{$where}\n\t\t\tORDER BY `name` ASC, `unit_id` ASC";
    $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
    if (mysql_affected_rows() > 0) {
        // major while ... for RESPONDER data starts here
        $i = $k = 1;
        // sidebar/icon index
        while ($unit_row = stripslashes_deep(mysql_fetch_assoc($result))) {
            $has_coords = my_is_float($unit_row['lat']) && my_is_float($unit_row['lng']);
            if (is_email($unit_row['contact_via'])) {
                print "\t\temail= true\n";
            }
            ?>
				nr_units++;

				var i = <?php 
            print $i;
            ?>
;						// top of loop
				
				unit_names[i] = "<?php 
            print addslashes($unit_row['name']);
            ?>
";
				unit_sets[i] = false;								// pre-set checkbox settings				
				unit_ids[i] = <?php 
            print $unit_row['unit_id'];
            ?>
;
				distances[i]=9999.9;
 				direcs[i] = <?php 
            print intval($unit_row['direcs']) == 1 ? "true" : "false";
            ?>
;
<?php 
            if ($has_coords) {
                //					snap (__LINE__, $unit_row['unit_id']);
                $tab_1 = "<TABLE CLASS='infowin' width='" . $_SESSION['scr_width'] / 4 . "px'>";
                $tab_1 .= "<TR CLASS='odd'><TD COLSPAN=2 ALIGN='center'>" . shorten($unit_row['name'], 48) . "</TD></TR>";
                $tab_1 .= "<TR CLASS='even'><TD>Description:</TD><TD>" . shorten(str_replace($eols, " ", $unit_row['description']), 32) . "</TD></TR>";
                $tab_1 .= "<TR CLASS='odd'><TD>Status:</TD><TD>" . $unit_row['unitstatus'] . " </TD></TR>";
                $tab_1 .= "<TR CLASS='even'><TD>Contact:</TD><TD>" . $unit_row['contact_name'] . " Via: " . $unit_row['contact_via'] . "</TD></TR>";
                $tab_1 .= "<TR CLASS='odd'><TD>As of:</TD><TD>" . format_date($unit_row['updated']) . "</TD></TR>";
                $tab_1 .= "</TABLE>";
            }
            ?>
//				new_element = document.createElement("input");								// please don't ask!
//				new_element.setAttribute("type", 	"checkbox");
//				new_element.setAttribute("name", 	"unit_<?php 
            print $unit_row['unit_id'];
            ?>
");
//				new_element.setAttribute("id", 		"element_id");
//				new_element.setAttribute("style", 	"visibility:hidden");
//				document.forms['routes_Form'].appendChild(new_element);
				var dist_mi = "na";
				var multi = <?php 
            print intval($unit_row['multi']) == 1 ? "true;\n" : "false;\n";
            ?>
	
<?php 
            $dispatched_to = array_key_exists($unit_row['unit_id'], $dispatches) ? $dispatches[$unit_row['unit_id']] : "";
            if ($has_coords) {
                ?>
		
					lats[i] = <?php 
                print $unit_row['lat'];
                ?>
; 		// 774 now compute distance - in km
					lngs[i] = <?php 
                print $unit_row['lng'];
                ?>
;
					distances[i] = distCosineLaw(parseFloat(lats[i]), parseFloat(lngs[i]), parseFloat(<?php 
                print $row_fac['lat'];
                ?>
), parseFloat(<?php 
                print $row_fac['lng'];
                ?>
));
					var dist_mi = ((distances[i] * km2mi).toFixed(1)).toString();				// to miles
<?php 
            } else {
                ?>
					distances[i] = 9999.9;
					var dist_mi = "na";
<?php 
            }
            if (!empty($unit_row['callsign'])) {
                $thespeed = "";
                $query = "SELECT *,UNIX_TIMESTAMP(packet_date) AS packet_date, UNIX_TIMESTAMP(updated) AS updated FROM {$GLOBALS['mysql_prefix']}tracks\n\t\t\t\t\t\tWHERE `source`= '{$unit_row['callsign']}' ORDER BY `packet_date` DESC LIMIT 1";
                $result_tr = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
                if (mysql_affected_rows() > 0) {
                    // got a track?
                    $track_row = stripslashes_deep(mysql_fetch_array($result_tr));
                    // most recent track report
                    $tab_2 = "<TABLE CLASS='infowin' width='" . $_SESSION['scr_width'] / 4 . "px'>";
                    $tab_2 .= "<TR><TH CLASS='even' COLSPAN=2>" . $track_row['source'] . "</TH></TR>";
                    $tab_2 .= "<TR CLASS='odd'><TD>Course: </TD><TD>" . $track_row['course'] . ", Speed:  " . $track_row['speed'] . ", Alt: " . $track_row['altitude'] . "</TD></TR>";
                    $tab_2 .= "<TR CLASS='even'><TD>Closest city: </TD><TD>" . $track_row['closest_city'] . "</TD></TR>";
                    $tab_2 .= "<TR CLASS='odd'><TD>Status: </TD><TD>" . $track_row['status'] . "</TD></TR>";
                    $tab_2 .= "<TR CLASS='even'><TD>As of: </TD><TD>" . format_date($track_row['packet_date']) . "</TD></TR>";
                    $tab_2 .= "</TABLE>";
                    ?>
						var myinfoTabs = [
							new GInfoWindowTab("<?php 
                    print nl2brr(shorten($unit_row['name'], 8));
                    ?>
", "<?php 
                    print $tab_1;
                    ?>
"),
							new GInfoWindowTab("<?php 
                    print $track_row['source'];
                    ?>
", "<?php 
                    print $tab_2;
                    ?>
"),
							new GInfoWindowTab("Zoom", "<DIV ID='detailmap' CLASS='detailmap'></DIV>")
							];
<?php 
                    $thespeed = $track_row['speed'] == 0 ? "<FONT COLOR='red'><B>&bull;</B></FONT>" : "<FONT COLOR='green'><B>&bull;</B></FONT>";
                    if ($track_row['speed'] >= 50) {
                        $thespeed = "<FONT COLOR='WHITE'><B>&bull;</B></FONT>";
                    }
                    ?>
						var point = new GLatLng(<?php 
                    print $track_row['latitude'];
                    ?>
, <?php 
                    print $track_row['longitude'];
                    ?>
);
						bounds.extend(point);								// point into BB
<?php 
                } else {
                    // no track data
                    $k--;
                    // not a clickable unit for dispatch
                    ?>
						var myinfoTabs = [
							new GInfoWindowTab("<?php 
                    print nl2brr(shorten($unit_row['name'], 12));
                    ?>
", "<?php 
                    print $tab_1;
                    ?>
"),
							new GInfoWindowTab("Zoom", "<DIV ID='detailmap' CLASS='detailmap'></DIV>")
							];
<?php 
                }
                // end  no track data
            } else {
                // no callsign
                if ($has_coords) {
                    ?>
						var myinfoTabs = [
							new GInfoWindowTab("<?php 
                    print nl2brr(shorten($unit_row['name'], 12));
                    ?>
", "<?php 
                    print $tab_1;
                    ?>
"),
							new GInfoWindowTab("Zoom", "<DIV ID='detailmap' CLASS='detailmap'></DIV>")
							];
						
						lats[i] = <?php 
                    print $unit_row['lat'];
                    ?>
; // 819 now compute distance - in km
						lngs[i] = <?php 
                    print $unit_row['lng'];
                    ?>
;
						distances[i] = distCosineLaw(parseFloat(lats[i]), parseFloat(lngs[i]), parseFloat(<?php 
                    print $row_fac['lat'];
                    ?>
), parseFloat(<?php 
                    print $row_fac['lng'];
                    ?>
));	// note: km
					    var km2mi = <?php 
                    print $conversion;
                    ?>
;				// 
						var dist_mi = ((distances[i] * km2mi).toFixed(1)).toString();				// to feet
<?php 
                }
                // end if ($has_coords)
                $thespeed = "";
            }
            // END IF/ELSE (callsign)
            print !(intval($unit_row['multi']) == 1) && isset($dispatches[$unit_row['unit_id']]) ? "\n\tvar is_checked =  ' CHECKED ';\n\tvar is_disabled =  ' DISABLED ';\n" : "\n\tvar is_checked =  '';\n\tvar is_disabled =  '';\n";
            ?>
					
				sidebar_line = "<TD ALIGN='center'><INPUT TYPE='hidden' NAME = 'unit_" + <?php 
            print $unit_row['unit_id'];
            ?>
 + "' onClick='unit_sets[<?php 
            print $i;
            ?>
]=this.checked;'></TD>";

				sidebar_line += "<TD TITLE = \"<?php 
            print addslashes($unit_row['name']);
            ?>
\">";
				sidebar_line += "<NOBR><?php 
            print shorten($unit_row['name'], 20);
            ?>
</NOBR></TD>";

				sidebar_line += "<TD>"+ dist_mi+"</TD>"; // 8/25/08, 4/27/09
				sidebar_line += "<TD><NOBR><?php 
            print shorten(addslashes($dispatched_to), 20);
            ?>
</NOBR></TD>";
				sidebar_line += "<TD TITLE = \"<?php 
            print $unit_row['unitstatus'];
            ?>
\" CLASS='td_data'><?php 
            print shorten($unit_row['unitstatus'], 12);
            ?>
</TD>";
//				sidebar_line += "<TD CLASS='td_data'><?php 
            print $thespeed;
            ?>
</TD>";
				sidebar_line += "<TD CLASS='td_data'><?php 
            print substr(format_sb_date($unit_row['updated']), 4);
            ?>
</TD>";
<?php 
            if ($has_coords) {
                //  2/25/09
                ?>
		
					var point = new GLatLng(<?php 
                print $unit_row['lat'];
                ?>
, <?php 
                print $unit_row['lng'];
                ?>
);	//  840 for each responder 832
					var unit_id = <?php 
                print $unit_row['unit_id'];
                ?>
;
					bounds.extend(point);																// point into BB
					var marker = createMarker(point, sidebar_line, myinfoTabs,<?php 
                print $unit_row['type'];
                ?>
, i, unit_id);	// (point,sidebar,tabs, color, id, unit_id)
					if (!(isNull(marker))) {
						map.addOverlay(marker);
						}
<?php 
            } else {
                print "\n\tdo_sidebar(sidebar_line, color, i);\n";
            }
            // end if/else ($has_coords)
            $i++;
            $k++;
        }
        // end major while ($unit_row = ...)  for each responder
    }
    // end if(mysql_affected_rows()>0)
    ?>
 		var point = new GLatLng(<?php 
    echo $row_fac['lat'];
    ?>
, <?php 
    echo $row_fac['lng'];
    ?>
);	//
		var baseIcon = new GIcon();
		var inc_icon = new GIcon(baseIcon, "./markers/sm_black.png", null);
		var thisMarker = new GMarker(point);
		map.addOverlay(thisMarker);

		if (nr_units==0) {
			side_bar_html +="<TR CLASS='odd'><TD ALIGN='center' COLSPAN=99><BR /><B>No Units!</B></TD></TR>";;		
			map.setCenter(new GLatLng(<?php 
    echo $row_fac['lat'];
    ?>
, <?php 
    echo $row_fac['lng'];
    ?>
), <?php 
    echo get_variable('def_zoom');
    ?>
);
			}
		else {
			center = bounds.getCenter();
			zoom = map.getBoundsZoomLevel(bounds);		// -1 for further out	
			map.setCenter(center,zoom);
			side_bar_html+= "<TR CLASS='" + colors[i%2] +"'><TD COLSPAN=99>&nbsp;</TD></TR>\n";
			side_bar_html+= "<TR><TD>&nbsp;</TD></TR>\n";
			}
				
		side_bar_html +="</TABLE>\n";
		document.getElementById("side_bar").innerHTML = side_bar_html;	// put the assembled side_bar_html contents into the side_bar div

		var thelat = <?php 
    print $row_fac['lat'];
    ?>
; var thelng = <?php 
    print $row_fac['lng'];
    ?>
;
		var start = min(distances);		// min straight-line distance to Incident

		if (start>0) {
			var current_id= "R"+start;			//
//			document.getElementById(current_id).style.visibility = "visible";		// show link check image at the selected sidebar el ement
//			if (lats[start]) {
//				setDirections(lats[start] + " " + lngs[start], thelat + " " + thelng, "en_US");
//				}
			}
		}		// end if (GBrowserIsCompatible())

	else {
		alert("Sorry,  browser compatibility problem. Contact your tech support group.");
		}

	</SCRIPT>
	
<?php 
}
Пример #27
0
            $l = Link::from_db($id, null, false);
            if (!$l) {
                exit(0);
            }
            if (!$globals['mobile'] && !$globals['mobile_version'] && !empty($l->url) && $current_user->user_id > 0 && (empty($globals['https']) || preg_match('/^https:/', $l->url)) && User::get_pref($current_user->user_id, 'use_bar') && $db->get_var("select blog_type from blogs where blog_id = {$l->blog}") != 'noiframe') {
                $url = $globals['scheme'] . '//' . get_server_name() . $globals['base_url'] . 'b/' . $id;
                // we use always http to load no https pages
                do_redirection($url, 307);
            } else {
                if (empty($l->url)) {
                    $url = $l->get_permalink();
                } else {
                    $url = $l->url;
                }
                do_redirection($url);
            }
            $l->add_click();
            exit(0);
    }
} else {
    require mnminclude . $globals['html_main'];
    do_error(_('enlace inexistente'), 404);
}
function do_redirection($url, $code = 301)
{
    if (isset($_GET['quiet'])) {
        return;
        // Don't redirect if the caller asked so
    }
    redirect($url, $code);
}
*/
error_reporting(E_ALL);
@session_start();
require_once $_SESSION['fip'];
//7/28/10
$now = "'" . mysql_format_date(time() - get_variable('delta_mins') * 60) . "'";
/*
USERS: you may replace NULL with $now (EXACTLY THAT!) in the following sql query to meet local needs
*/
$GLOBALS['LOG_CALL_RESET'] = 34;
// 5/25/09
//$query = "UPDATE `$GLOBALS[mysql_prefix]assigns` SET
//	`dispatched` = NULL,
//	`responding` = NULL,
//	`on_scene` = NULL,
//	`u2fenr` = NULL,
//	`u2farr` = NULL,
//	`clear` = NULL,
//	`as_of` = $now
//	WHERE `id` = {$_POST['frm_id']} LIMIT 1;";
$query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}assigns` WHERE `id` =  {$_POST['frm_id']} LIMIT 1";
$result = mysql_query($query) or do_error($query, "", mysql_error(), basename(__FILE__), __LINE__);
$row = mysql_fetch_assoc($result);
// collect for log
do_log($GLOBALS['LOG_CALL_RESET'], $row['ticket_id'], $row['responder_id'], $row['id']);
set_u_updated($_POST['frm_id']);
// 9/1/10
$query = "DELETE FROM `{$GLOBALS['mysql_prefix']}assigns` WHERE `id` = {$_POST['frm_id']} LIMIT 1;";
$result = mysql_query($query) or do_error($query, "", mysql_error(), basename(__FILE__), __LINE__);
//snap(__LINE__, $query );
unset($result);
Пример #29
0
     $globals['description'] = _('Autor') . ": {$user->username}, " . _('Resumen') . ': ' . $summary;
     $page_title = text_to_summary($summary, 120);
     if ($user->avatar) {
         $globals['thumbnail'] = get_avatar_url($user->id, $user->avatar, 80);
     }
     //$page_title = sprintf(_('nota de %s'), $user->username) . " ($post_id)";
     $globals['search_options']['u'] = $user->username;
     $where = "post_id = {$post_id}";
     $order_by = "";
     $limit = "";
     $rows = 1;
 } else {
     // User is specified
     $user->username = $db->escape($argv[0]);
     if (!$user->read() || $user->disabled()) {
         do_error(_('usuario no encontrado'), 404);
     }
     switch ($argv[1]) {
         case '_friends':
             $view = 1;
             $page_title = sprintf(_('amigos de %s'), $user->username);
             $from = ", friends";
             $where = "friend_type='manual' and friend_from = {$user->id} and friend_to=post_user_id and friend_value > 0";
             $order_by = "ORDER BY post_id desc";
             $limit = "LIMIT {$offset},{$page_size}";
             $rows = $db->get_var("SELECT count(*) FROM posts, friends WHERE friend_type='manual' and friend_from = {$user->id} and friend_to=post_user_id and friend_value > 0");
             $rss_option = "sneakme_rss2.php?friends_of={$user->id}";
             break;
         case '_favorites':
             $view = 2;
             $page_title = sprintf(_('favoritas de %s'), $user->username);
function do_t_tracker()
{
    //	6/10/11
    $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}responder` WHERE `t_tracker`= 1 AND `callsign` <> ''";
    // work each call/license, 8/10/09
    $result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), basename(__FILE__), __LINE__);
    while ($row = @mysql_fetch_assoc($result)) {
        $tracking_id = $row['callsign'];
        $db_lat = $row['lat'];
        $db_lng = $row['lng'];
        $db_updated = $row['updated'];
        $update_error = strtotime('now - 4 hours');
        $query2 = "SELECT * FROM `{$GLOBALS['mysql_prefix']}remote_devices` WHERE `user` = '{$tracking_id}'";
        //	read location data from incoming table
        $result2 = mysql_query($query2) or do_error($query2, 'mysql_query() failed', mysql_error(), basename(__FILE__), __LINE__);
        while ($row2 = @mysql_fetch_assoc($result2)) {
            $ic_lat = $row2['lat'];
            $ic_lng = $row2['lng'];
            $ic_speed = $row2['speed'];
            $ic_altitude = $row2['altitude'];
            $ic_direction = $row2['direction'];
            $ic_time = $row2['time'];
            if ($db_updated == $ic_time && $update_error > $ic_time) {
            } else {
                $query3 = "DELETE FROM `{$GLOBALS['mysql_prefix']}tracks` WHERE packet_date < (NOW() - INTERVAL 14 DAY)";
                // remove ALL expired track records
                $result3 = mysql_query($query3) or do_error($query3, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
                $query4 = "UPDATE `{$GLOBALS['mysql_prefix']}responder` SET `lat` = '{$ic_lat}', `lng` ='{$ic_lng}', `updated` = '{$ic_time}' WHERE `t_tracker` = 1 AND `callsign` = '{$tracking_id}'";
                $result4 = mysql_query($query4) or do_error($query4, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
                $query5 = "DELETE FROM `{$GLOBALS['mysql_prefix']}tracks_hh` WHERE `source` = '{$tracking_id}'";
                // remove prior track this device
                $result5 = mysql_query($query5);
                $query6 = "INSERT INTO `{$GLOBALS['mysql_prefix']}tracks_hh` (source, latitude, longitude, speed, altitude, updated) VALUES ('{$tracking_id}', '{$ic_lat}', '{$ic_lng}', round({$ic_speed}), {$ic_altitude}, '{$ic_time}')";
                // 6/24/10
                $result6 = mysql_query($query6) or do_error($query6, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
                $query7 = "INSERT INTO `{$GLOBALS['mysql_prefix']}tracks` (source, latitude, longitude, speed, altitude, packet_date, updated) VALUES ('{$tracking_id}', '{$ic_latitude}', '{$ic_longitude}', round({$ic_speed}), {$ic_altitude}, '{$ic_time}', '{$ic_time}')";
                $result7 = mysql_query($query7) or do_error($query7, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
                $response_code7 = $result7 ? 700 : 799;
            }
            //end if
        }
        // end while
    }
    // end while
}