示例#1
0
function point_check($point, $displace)
{
    $config = (include dirname(__FILE__) . "/../config/config.php");
    // Inside allowed area?
    if (!validate_meldung_im_erlaubten_bereich($config, $point)) {
        return '1002#1002#' . $config['labels']['errors']['ausserhalb_des_bereichs'];
    }
    return false;
}
$required_keys = array('email', 'task', 'point');
foreach ($required_keys as $key) {
    if (!array_key_exists($key, $_REQUEST)) {
        die(sprintf('1100#1100#[%s] fehlt', $key));
    }
}
$trashmail_check = trashmail_check($config, $data['email']);
if ($trashmail_check) {
    die($trashmail_check);
}
switch ($data["task"]) {
    case "validate":
        print json_encode(validate_meldung_im_erlaubten_bereich($config, $data["point"]));
        break;
    case "submit":
        if (validate_meldung_im_erlaubten_bereich($config, $data["point"])) {
            $backend_data = array("typ" => $data["typ"], "kategorie" => $data["unterkategorie"] ? $data["unterkategorie"] : $data["hauptkategorie"], "oviWkt" => $data["point"], "autorEmail" => $data["email"], "beschreibung" => $data["beschreibung"]);
            if (isset($data["foto"])) {
                $origImgPath = $data["foto"]["tmp_name"];
                $imgInfo = pathinfo($data['foto']['name']);
                if ($data['foto'] != NULL && $data['foto']['name'] !== '' && !in_array(strtolower($imgInfo['extension']), array('jpg', 'jpeg', 'png', 'gif'))) {
                    die("1110#1110#Der Dateityp des Fotos wurde nicht erkannt.");
                }
                $scaledImgPath = scaleImage($origImgPath, 720, 720);
                $fh = fopen($scaledImgPath, "r");
                if ($fh) {
                    $fd = fread($fh, filesize($scaledImgPath));
                    $fd_base64 = base64_encode($fd);
                    $backend_data["bild"] = $fd_base64;
                }
            }