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; }
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; }
$videoEntry->setMediaSource($fs); $videoEntry->setVideoTitle($vtitle); $videoEntry->setVideoDescription($description); $videoEntry->setVideoCategory('Education'); $videoEntry->setVideoTags('isense'); $uploadUrl = 'http://uploads.gdata.youtube.com/feeds/api/users/default/uploads'; $newEntry = null; try { $newEntry = $yt->insertEntry($videoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry'); } catch (Zend_Gdata_App_HttpException $httpException) { array_push($errors, $httpException->getRawResponseBody()); } catch (Zend_Gdata_App_Exception $e) { array_push($errors, $e->getMessage()); } if (count($errors) == 0) { $done = true; $videoId = $newEntry->getVideoId(); $url = 'http://www.youtube.com/watch?v=' . $videoId; createVideoItem($session->userid, $meta['experiment_id'], $vtitle, $description, $street, $citystate, $videoId, $url); publishToTwitter('New Video Added To: "' . $meta['name'] . '" http://isense.cs.uml.edu/experiment.php?id=' . $meta['experiment_id']); } } } $smarty->assign('meta', $meta); $smarty->assign('values', $values); $smarty->assign('errors', $errors); $smarty->assign('done', $done); $smarty->assign('title', ucwords($meta['name']) . ' - Add New Video'); $smarty->assign('user', $session->getUser()); $smarty->assign('content', $smarty->fetch('upload-videos.tpl')); $smarty->display('skeleton.tpl');
function addFeaturedExperiment($eid) { global $db; $db->query("UPDATE experiments SET featured = 1 WHERE experiment_id = {$eid}"); $output = $db->query("SELECT name from experiments WHERE experiment_id = {$eid}"); $name = ""; if ($db->numOfRows) { $name = $output[0]['name']; } if ($name != "") { publishToTwitter('Latest Featured Experiment: "' . $name . '" - http://isense.cs.uml.edu/rc1/experiment.php?id=' . $eid); } updateTimeModifiedForExperiment($eid); return true; }