Ejemplo n.º 1
0
<?php

$users = $db->users;
$user = $users->findOne(array("facebookid" => $_SESSION['user']));
if (isset($_POST['submit'])) {
    $user['location'] = $_POST['location'];
    $user['phone'] = $_POST['phone'];
    $user['description'] = $_POST['description'];
    $users->update(array("facebookid" => $_SESSION['user']), $user);
    wallPost($_SESSION['user'], $_SESSION['user'], "editprofile", "?profile/edit");
}
$_POST = $user;
formHeader("Edit your profile");
formField("User", "user", "disabled", "", "Your user");
formField("Name", "first", "disabled", "", "Your name");
formField("E-mail", "email", "disabled", "", "Your email");
formField("Joined", "date", "disabled", "", "");
formField("Location", "location", "text", "", "Your location (country, city)");
formField("Phone", "phone", "text", "", "Your phone number");
formField("Short description", "description", "textarea");
formFooter("Save changes");
Ejemplo n.º 2
0
{
    global $code, $appId, $secretCode, $redirectUri;
    return "https://oauth.vk.com/access_token?" . "client_id={$appId}&client_secret={$secretCode}&redirect_uri={$redirectUri}" . "&code={$code}";
}
function wallPost($text)
{
    global $userId, $accessToken;
    $text = urlencode($text);
    $url = "https://api.vk.com/method/wall.post?owner_id={$userId}&access_token={$accessToken}" . "&message={$text}";
    return $url;
}
function makeLink($href)
{
    return "<div><a href={$href}>{$href}</a></div>";
}
$url = wallPost("Салам алейкум");
//$url = getAccessToken();
?>

<div>
    <h2>Response: <?php 
echo $url;
?>
</h2>
    <?php 
echo file_get_contents($url);
?>
</div>
<?php 
echo makeLink(getAuthUrl());
//echo makeLink(getAccessToken());
        $requests->update(array("travel" => $ID, "user" => $_SESSION['user']), $_POST);
        header("Location: ?product_request/{$ACTION}/{$ID}");
    }
    uploadFile("picture", $ID . $_SESSION['user']);
    $wall_post_insert = true;
}
$when = dateToRelative($entry['date']);
$changed = relativeTime($entry['update']);
$tmp = array();
if (isset($wall_post_insert)) {
    wallPost($entry['user'], $_SESSION['user'], "newrequest", "?product_request/{$ACTION}/{$ID}");
    wallPost($_SESSION['user'], $entry['user'], "newrequestclient", "?product_request/{$ACTION}/{$ID}");
}
if (isset($wall_post_revoke)) {
    wallPost($entry['user'], $_SESSION['user'], "newrequestrevoke", "?product_request/{$ACTION}/{$ID}");
    wallPost($_SESSION['user'], $entry['user'], "newrequestrevokeclient", "?product_request/{$ACTION}/{$ID}");
}
if (isset($entry['size']) && !empty($entry['size'])) {
    $tmp[] = "Maximum allowed size: {$entry['size']}<br>";
}
if (isset($entry['weight']) && !empty($entry['weight'])) {
    $tmp[] = "Maximum allowed weight: {$entry['weight']}<br>";
}
if (isset($entry['handluggage']) && !empty($entry['handluggage'])) {
    $tmp[] = "Items can be transfered only in hand luggage<br>";
}
if (empty($tmp)) {
    $tmp = "No details added";
} else {
    $tmp = "<ul><li>" . implode("<li>", $tmp) . "</ul>";
}
Ejemplo n.º 4
0
        $requests->update(array("travel" => $ID, "user" => $_SESSION['user']), $_POST);
        header("Location: ?travel_plan/{$ACTION}/{$ID}");
    }
    uploadFile("picture", $ID . $_SESSION['user']);
    $wall_post_insert = true;
}
$when = dateToRelative($entry['date']);
$changed = relativeTime($entry['update']);
$tmp = array();
if (isset($wall_post_insert)) {
    wallPost($entry['user'], $_SESSION['user'], "newrequest", "?travel_plan/{$ACTION}/{$ID}");
    wallPost($_SESSION['user'], $entry['user'], "newrequestclient", "?travel_plan/{$ACTION}/{$ID}");
}
if (isset($wall_post_revoke)) {
    wallPost($entry['user'], $_SESSION['user'], "newrequestrevoke", "?travel_plan/{$ACTION}/{$ID}");
    wallPost($_SESSION['user'], $entry['user'], "newrequestrevokeclient", "?travel_plan/{$ACTION}/{$ID}");
}
if (isset($entry['size']) && !empty($entry['size'])) {
    $tmp[] = "Maximum allowed size: {$entry['size']}<br>";
}
if (isset($entry['weight']) && !empty($entry['weight'])) {
    $tmp[] = "Maximum allowed weight: {$entry['weight']}<br>";
}
if (isset($entry['handluggage']) && !empty($entry['handluggage'])) {
    $tmp[] = "Items can be transfered only in hand luggage<br>";
}
if (empty($tmp)) {
    $tmp = "No details added";
} else {
    $tmp = "<ul><li>" . implode("<li>", $tmp) . "</ul>";
}
Ejemplo n.º 5
0
    try {
        $_POST = $travel_plans->findOne(array("_id" => new MongoId($ID)));
    } catch (Exception $e) {
        header("Location: ?travel_plan");
        die;
    }
} else {
    if ($ACTION == "delete") {
        try {
            $entry = $travel_plans->findOne(array("_id" => new MongoId($ID)));
        } catch (Exception $e) {
            header("Location: ?travel_plan");
        }
        if (isset($_GET['confirm'])) {
            $travel_plans->remove(array("_id" => new MongoId($ID)));
            wallPost($_SESSION['user'], $_id, "travelplandeleted", "?travel_plan/view/{$ID}");
            header("Location: ?travel_plan");
        }
        $entry['date'] = convertDate($entry['date']);
        $HTML[] = <<<EOF
\t\t<div class="alert alert-danger center" role="alert">
\t\t\tAre your sure you want to delete travel plan from {$entry['from']} to {$entry['to']} ({$entry['date']})?<br><br>
\t\t\t<a href="?travel_plan/{$ACTION}/{$ID}/&confirm" class="btn btn-danger">Yes</a>
\t\t\t&nbsp;&nbsp;
\t\t\t<a href="#" onClick="history.go(-1)">No</a>
\t\t</div>
EOF;
    }
}
if ($ACTION != "delete") {
    /** add form */
            $ID = $_POST["_id"];
            header("Location: ?product_request/view/{$ID}");
            wallPost($_SESSION['user'], $_SESSION['user'], "requestmodified", "?product_request/view/{$ID}");
            uploadFile("picture", $ID . $_SESSION['user']);
            $SUCCESS[] = "You have successfully added new product request";
        } else {
            $_POST['modified'] = date("Y-m-d H:i:s");
            try {
                $travel_plans->update(array("_id" => new MongoId($ID)), $_POST);
            } catch (Exception $e) {
                header("Location: ?product_request");
                die;
            }
            $ID = $_POST["_id"];
            header("Location: ?product_request/view/{$ID}");
            wallPost($_SESSION['user'], $_SESSION['user'], "requestcreated", "?product_request/view/{$ID}");
            uploadFile("picture", $ID . $_SESSION['user']);
            $SUCCESS[] = "You have successfully modified your product request";
        }
    } else {
        header("Location: " . $_SERVER['REQUEST_URI']);
    }
}
/** if we edit travel plan, populate fields to $_POST, that are latter used */
if ($ACTION == "edit") {
    try {
        $_POST = $travel_plans->findOne(array("_id" => new MongoId($ID)));
    } catch (Exception $e) {
        header("Location: ?product_request");
        die;
    }