Example #1
0
// 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>
    </p>
<?php 
Example #2
0
        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" />
        Try again:
        <input type="file" id="file" name="file" required="required" />
        <input class="btn" type="submit" value="Validate" />
    </form></p>
<?php 
    include '../lib/_footer.php';
    exit;
}
//
// If there are any validation errors, show them
//
$errors = $current->validate_update_steps($steps);
if (count($errors)) {
    ?>
    <div id="pageheader" style="background-color: #92836c;">Validatiod errors</div>
    <p>
        Following errors are found in your modification:
    </p>
    <ul class="validation-errors-list">
<?php 
    foreach ($errors as $error) {
        echo "<li><p>" . $error . "</p></li>\n";
    }
    ?>
    </ul>

    <br/><p><form class="inline" action="" method="post" enctype="multipart/form-data">