Esempio n. 1
0
function todos_request($config, $uri)
{
    switch ($_SERVER['REQUEST_METHOD']) {
        case 'GET':
            find_activity($config);
            break;
        case 'POST':
            //create
            create_activity($config);
            break;
        case 'PUT':
            //update
            update_activity($config, $uri[3]);
            break;
        case 'DELETE':
            delete_activity($config, $uri[3]);
            break;
        case 'HEAD':
        case 'OPTION':
        default:
            error_activity();
            break;
    }
}
Esempio n. 2
0
         foreach ($vars as $key => $value) {
             $body->set($key, $value);
         }
     }
     break;
 case 7:
     // Update activities
     check_authorization();
     update_activity();
     $tskid = $_POST['taskid'];
     header("Location: index.php?editor=tasks&tskid={$tskid}");
     exit;
 case 8:
     // Delete activity
     check_authorization();
     delete_activity();
     $tskid = $_GET['tskid'];
     header("Location: index.php?editor=tasks&tskid={$tskid}");
     exit;
 case 9:
     // Get activity ID
     check_authorization();
     $body = new Template("templates/tasks/activity.add.tmpl.php");
     $body->set('tskid', $_GET['tskid']);
     $body->set('rewardmethods', $rewardmethods);
     $body->set('activitytypes', $activitytypes);
     $body->set('zoneids', $zoneids);
     $body->set('suggestid', suggest_activity_id());
     $body->set('suggeststep', suggest_step());
     break;
 case 10:
         * labelled as 'old_activity0' for element index 0.
         *
         * The index is set as the button's value, so it's stored in
         * $_POST['editBusinessActivities']. We ake the index and append
         * it to all of our fields. And we gud now.
         *
         * I'm sorry.
         */
        $i = $_POST['editBusinessActivities'];
        $result = update_activity($name, $_POST['old_activity' . $i], $_POST['old_scheduledTime' . $i], $_POST['activity' . $i], $_POST['scheduledTime' . $i], $_POST['discount' . $i], $_POST['interestType' . $i]);
        /* Commit to save changes... */
        OCICommit($db_conn);
    } else {
        if (array_key_exists('deleteBusinessActivities', $_POST)) {
            $i = $_POST['deleteBusinessActivities'];
            $result = delete_activity($name, $_POST['old_activity' . $i], $_POST['old_scheduledTime' . $i]);
            /* Commit to save changes... */
            OCICommit($db_conn);
        } else {
            if (array_key_exists('newBusinessActivity', $_POST)) {
                insert_activity($name, $_POST['activity'], $_POST['scheduledTime'], $_POST['discount'], $_POST['interestType']);
                /* Commit to save changes... */
                OCICommit($db_conn);
            }
        }
    }
} else {
    /* if ($db_conn) */
    echo "cannot connect";
    $e = OCI_Error();
    // For OCILogon errors pass no handle