Example #1
0
function createEvent($token, $title, $description, $location, $start, $end)
{
    global $db;
    $uid = $token['uid'];
    $session = $token['session'];
    $db->query("INSERT INTO events (`author_id`, `title`, `description`, `location`, `start`, `end`) VALUES({$uid}, '{$title}', '{$description}', '{$location}', '{$start}', '{$end}')");
    if ($db->numOfRows) {
        $id = $db->lastInsertId();
        $url = 'http://isense.cs.uml.edu/events.php?id=' . $id;
        publishToTwitter('Latest Event: "' . $title . '" - ' . $url . ' #isenseevents');
        $title = 'iSENSE Event - ' . $title;
        publishToDelicious($title, $url, $description, array('isenseevents', 'isense', 'education'));
        return $id;
    }
    return false;
}
Example #2
0
function createNewsItem($token, $title, $content, $publish = 1)
{
    global $db;
    $uid = $token['uid'];
    $session = $token['session'];
    $db->query("INSERT INTO news (`author_id`, `title`, `pubDate`, `content`, `published`) VALUES({$uid}, '{$title}', NOW(), '{$content}', {$publish})");
    if ($db->numOfRows) {
        $id = $db->lastInsertId();
        $url = 'http://isense.cs.uml.edu/news.php?id=' . $id;
        publishToTwitter('Latest News: "' . $title . '" - ' . $url);
        $title = 'iSENSE News - ' . $title;
        $content = substr($content, 0, 150) . '...';
        publishToDelicious($title, $url, $content, array('isensenews', 'isense', 'education'));
        return $id;
    }
    return false;
}
Example #3
0
function createExperiment($token, $name, $description, $fields, $defaultJoin = true, $joinKey = "", $defaultBrowse = true, $browseKey = "")
{
    global $db;
    $uid = $token['uid'];
    $session = $token['session'];
    if ($name == "") {
        return false;
    }
    if ($defaultJoin == false && $joinKey == "") {
        return false;
    }
    if ($defaultBrowse == false && $browseKey == "") {
        return false;
    }
    $db->query("INSERT INTO experiments ( experiment_id, owner_id, name, description, timecreated, timemodified, default_read, default_join) VALUES ( NULL, {$uid}, '{$name}', '{$description}', NOW(), NOW(), {$defaultBrowse}, {$defaultJoin})");
    if ($db->numOfRows) {
        $eid = $db->lastInsertId();
        $db->query("INSERT INTO experiment_user_permissions (`experiment_id`, `user_id`, `read`, `write`, `join`) VALUES({$eid}, {$uid}, 1, 1, 1)");
        publishToDelicious($name, 'http://isense.cs.uml.edu/rc1/experiment.php?id=' . $eid, $description);
        return getExperiment($eid);
    }
    return false;
}