Example #1
0
    $_SESSION['project'] = $_COOKIE['project'];
}
if (isset($_COOKIE['account_href'])) {
    $_SESSION['account_href'] = $_COOKIE['account_href'];
}
if (!isset($_GET['action'])) {
    if (!isset($_SESSION['token'])) {
        $oauth->requestAuthentication(array('user_id' => 10, 'project_id' => 20));
    }
    if (!isset($_SESSION['account_href'])) {
        getAccounts($_SESSION['token']);
    }
    if (!isset($_SESSION['project_href'])) {
        getProjects($_SESSION['account_href'], $_SESSION['token']);
    }
    getTodos($_SESSION['project'], $_SESSION['token']);
} else {
    switch ($_GET['action']) {
        case 'redirect':
            if (!isset($_GET['code'])) {
                throw new InvalidArgumentException("verification code missing");
            }
            $verification_code = $_GET['code'];
            $tokens = $oauth->exchangeVerificationCode($verification_code);
            $_SESSION['token'] = $tokens['access_token'];
            setcookie('token', $tokens['access_token']);
            file_put_contents('tokens', serialize($tokens) . "\n-----------------------\n", FILE_APPEND);
            getAccounts($tokens['access_token']);
            break;
        case 'choose_user':
            $_SESSION['account_href'] = $_POST['url_base'];
Example #2
0
                    </div>
                </div>
                <table class="table table-hover">
                    <tr>
                        <th>
                            <span class='glyphicon glyphicon-ok' aria-hidden='true'></span>
                        </th>
                        <th>Your Task(s)</th>
                    </tr>
                    <?php 
// if (isset($_GET['option1'])) {
//     $rows = getTodos($_SESSION['id'],0);
// } else {
//     $rows = getAllTodos($_SESSION['id']);
// }
$rows = getTodos($_SESSION['id'], 0);
if ($rows) {
    foreach ($rows as $row) {
        ?>
                    <tr>
                        <td><input type="checkbox" name="task_<?php 
        echo $row['id'];
        ?>
" <?php 
        if ($row['status'] == 1) {
            echo "checked";
        }
        ?>
></td>
                        <td><?php 
        echo htmlspecialchars($row['task']);