예제 #1
0
function getdb()
{
    global $db;
    if (isset($db)) {
        return $db;
    }
    if (!db_available()) {
        return false;
    }
    $db = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
    if ($db->connect_errno) {
        die('Cannot connect to database: (' . $db->connect_errno . ') ' . $db->connect_error);
    }
    $db->set_charset('utf8');
    return $db;
}
예제 #2
0
'.split(','),
        titles: '<?php 
echo implode(',', $fmtdesc['titles']);
?>
'.split(',')
    });
    exprt.on('export', function(e) {
        if( e.fmt )
            submit('export', ui, e.fmt);
    });
    ui.map.addControl(exprt);
}

function addLogin(ui) {
    <?php 
if (!db_available()) {
    ?>
return;<?php 
}
?>
    var loggedIn = <?php 
echo isset($userid) ? 'true' : 'false';
?>
;
    var login = L.functionButtons([{ content: loggedIn ? 'Library' : 'Sign In' }], { position: 'topright' });
    login.on('clicked', function() {
        if( loggedIn ) {
            showHistoryWindow(true);
        } else {
            window.storedBBCode = ui.getBBCode();
            window.open('<?php 
예제 #3
0
    $res = decompress_bbcode($_GET['gz']);
    if ($res && count($res) == 2 && strlen($res[1]) > 10) {
        $title = $res[0];
        $bbcode = $res[1];
    }
}
if ($data && isset($params['key']) && $params['key'] == $data['editid']) {
    $newcode = false;
    $seditid = $params['key'];
    $message = '<b><a href="' . $base_path . '/' . $params['id'] . '" target="mapbbstatic">Share this link</a></b> for read-only view of this map.<br><a href="' . $base_path . '/' . $params['id'] . '/' . $params['key'] . '">Bookmark this</a> to edit the map later';
    $nohide = 1;
    // do not hide message
    if (isset($userid)) {
        update_library($userid, $scodeid, $seditid);
        $message .= ' (or check the library)';
    } elseif (db_available()) {
        $message .= ' (sign in to have it stored for you automatically)';
    }
}
$editing = $params['post'] || isset($seditid) || strlen($bbcode) == 0 && strlen($title) == 0;
$newcode = !isset($seditid);
// see also $actions array in parse_surl
if ($action == 'initdb' && NEED_INIT_DB) {
    initdb();
} elseif ($action == 'fmtlist') {
    $fmtdesc = get_format_arrays();
    return_json($fmtdesc);
} elseif ($action == 'save') {
    save($params, $data);
} elseif ($action == 'signout') {
    unset($_SESSION['user_id']);