Ejemplo n.º 1
0
	function get_location($sip_adr, &$errors){
		global $config;
		static $reg;
		
		$reg = new Creg();
		
		$domainname=$reg->get_domainname($sip_adr);
		
		switch($this->container_type){
		case 'sql':
			$q="select location from ".$config->data_sql->table_netgeo_cache.
				" where domainname='".$domainname."'";
			$res=$this->db->query($q);
			/* if this query failed netgeo is probably not installed -- ignore */
			if (DB::isError($res)) {return "n/a";}
			$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
			$res->free();
		
			if (!$row) return "n/a";
			return $row->location;

		case 'ldap':
			die('NOT IMPLEMENTED: '.__FILE__.":".__LINE__);
		}
	}
Ejemplo n.º 2
0
    exit(1);
}
while ($row = MySQL_Fetch_Object($res)) {
    //for each user get contacts
    $q = "select contact from " . $config->table_location . " where username='******'";
    $res2 = mySQL_query($q);
    if (!$res2) {
        echo "error in SQL query, line: " . __LINE__ . "\n";
        continue;
    }
    $send_na = true;
    unset($user_icao_cache);
    $user_icao_cache = array();
    //for each contact get meter data and send it
    while ($row2 = MySQL_Fetch_Object($res2)) {
        $domain = $reg->get_domainname($row2->contact);
        //get icao for domain
        $q = "select icao from " . $config->table_netgeo_cache . " where domainname='{$domain}'";
        $res3 = MySQL_query($q);
        if (!$res3) {
            echo "error in SQL query, line: " . __LINE__ . "\n";
            continue;
        }
        $row3 = MySQL_Fetch_Object($res3);
        if (!$row3) {
            continue;
        }
        $icao = $row3->icao;
        // if domain isn't in cache, continue with next contact
        if (!$icao) {
            continue;