Beispiel #1
0
    }
}
/**
 * Simple debugging printput
 *
 * Add this in /etc/syslog.conf and see /var/log/debug file:
 * # Debug
 * *.=debug			/var/log/debug
 * 
 */
function DBG($str)
{
    global $debug;
    system("echo \"forum: " . $str . "\n\" >> /tmp/forum.log");
    if ($debug == 1) {
        syslog(LOG_DEBUG, "forum_gateway: " . $str);
    } else {
        if ($debug == 2) {
            echo $str . "\n";
        }
    }
}
/* Main routine */
$debug = 0;
$listforum = new ForumGateway();
if ($listforum->isError()) {
    mail($listforum->FromEmail, 'Forum Post Rejected', $listforum->getErrorMessage());
    DBG('Final Message: ' . $listforum->getErrorMessage());
} else {
    //	DBG("Success!!");
}
 function mime_header_decode_string($string)
 {
     $decoded_arr = $this->mime_header_decode($string);
     $return_string = $decoded_arr[0]['text'];
     /* Need a space? */
     for ($i = 1; $i < count($decoded_arr); $i++) {
         $return_string .= $decoded_arr[$i]['text'];
     }
     DBG("mime_header: {$string} -> {$return_string} \n");
     return $return_string;
 }
/**
 * Simple debugging printput
 *
 * Add this in /etc/syslog.conf and see /var/log/debug file:
 * # Debug
 * *.=debug			/var/log/debug
 * 
 */
function DBG($str)
{
    global $debug;
    if ($debug == 1) {
        system("echo \"artifact: " . $str . "\n\" >> /tmp/tracker.log");
        syslog(LOG_DEBUG, "artifact_gateway: " . $str);
    } else {
        if ($debug == 2) {
            echo $str . "\n";
        }
    }
}
/* Main routine */
$debug = 0;
$myTrackerGateway = new TrackerGateway();
if ($myTrackerGateway->isError()) {
    if ($myTrackerGateway->FromEmail) {
        mail($myTrackerGateway->FromEmail, 'Tracker Post Rejected', $myTrackerGateway->getErrorMessage());
    }
    DBG('Final Message: ' . $myTrackerGateway->getErrorMessage());
} else {
    //	DBG("Success!!");
}
Beispiel #4
0
        $sdm .= '},{';
    }
    $sdm .= implode(',', $dm[$i]);
}
$sdm .= '}}\'::float8[]';
// Connect to database
$con = pg_connect("dbname=" . PG_DB . " host=" . PG_HOST . " user="******"SELECT array_to_string(array_agg(id), ',')\n            FROM pgr_tsp({$sdm}, {$istart}, {$istop})";
DBG("sql: " . $sql);
$query = pg_query($con, $sql);
if (!$query) {
    pg_close($con);
    respond(2, $sql);
}
$r = pg_fetch_result($query, 0, 0);
DBG("order: {$r}");
// Close database connection
pg_close($con);
$ordered = explode(',', $r);
$result = "\"order\": [{$r}], \"route_geometry\": [\"";
for ($i = 0; $i < count($ordered) - 1; $i++) {
    if ($i > 0) {
        $result .= '","';
    }
    $result .= $dmc[$ordered[$i]][$ordered[$i + 1]]['route_geometry'];
}
// wrap the route back to the start is $istop == -1
if ($istop == -1) {
    $result .= '","';
    $result .= $dmc[$ordered[count($ordered) - 1]][$ordered[0]]['route_geometry'];
}