Пример #1
0
    exit;
}
// Check user
$result = pg_fetch_assoc(pg_query($connection, 'SELECT * FROM users WHERE id=\'' . $user_id . '\''), 0);
if (!$result) {
    echo 'The user with id =  ' . $user_id . ' is not present in the base. Please logout and login back. <br /><a href="javascript:history.back();">Back</a>';
    exit;
}
//
// Load and validate passed osm file
//
try {
    $new = new PieGeometry();
    $empty = new PieGeometry();
    $steps = array();
    $new->import_from_osm($_FILES['file']['tmp_name']);
    $steps = $empty->get_create_steps($new);
    $errors = $empty->validate_update_steps($steps);
} catch (Exception $e) {
    ?>
    <div class="error"><?php 
    echo $e->getMessage();
    ?>
</div>
    <p class="small">
        If you are sure there is no error from your side, fill bug at
        <a href="https://github.com/Foxhind/MapCraft/issues?state=open" target="_blank">github.com/Foxhind/MapCraft/issues</a>
        and attach your osm file.
    </p>
    <p>
        Failed to create a cake. <br /><a href="javascript:history.back();">Back</a>
Пример #2
0
        $filename = tempnam('/tmp', 'uploaded-' . $id . '-');
        if (!copy($_FILES['file']['tmp_name'], $filename)) {
            throw new Exception("Failed to save uploaded file");
        }
    } else {
        // After second step the file is in hidden input field 'filename' pointing to tmp file
        $filename = filter_input(INPUT_POST, 'filename', FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => "/^\\/tmp\\/uploaded-\\d+-\\w+\$/")));
    }
    //
    // Parse file with modifications
    //
    $new = new PieGeometry();
    $current = new PieGeometry();
    $steps = array();
    $current->load_from_db($id);
    $new->import_from_osm($filename);
    $steps = $current->get_update_steps($new);
} catch (Exception $e) {
    ?>
    <div id="pageheader" style="background-color: #92836c;">Can't to parse a new cake</div>
    <div class="error"><?php 
    echo $e->getMessage();
    ?>
</div>
    <p class="small">
        If you are sure there is no error from your side, fill bug at
        <a href="https://github.com/Foxhind/MapCraft/issues?state=open" target="_blank">github.com/Foxhind/MapCraft/issues</a>
        and attach your modified cake.
    </p>
    <br/><p><form class="inline" action="" method="post" enctype="multipart/form-data">
        <input type="hidden" name="step" value="second" />