本文整理汇总了PHP中createEvent函数的典型用法代码示例。如果您正苦于以下问题:PHP createEvent函数的具体用法?PHP createEvent怎么用?PHP createEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: http_response_code
}
}
}
return true;
}
if (!isUserLoggedIn()) {
http_response_code(403);
showError('You need to login to create an event.');
} else {
if (isset($_POST['submit'])) {
if (isset($_POST['type']) && isset($_POST['name']) && isset($_POST['description']) && isset($_POST['date']) && isset($_FILES["image"]) && isset($_POST["csrf_token"])) {
if (validateCSRFToken($_POST["csrf_token"])) {
$extension = pathinfo($_FILES["image"]["name"], PATHINFO_EXTENSION);
if (isset($extension)) {
if (test_date($_POST['date'])) {
$idEvent = createEvent($_POST['type'], $_POST['name'], $_POST['description'], $_POST['date'], isset($_POST['public']), $_SESSION['userid']);
if ($idEvent != -1) {
try {
if (file_exists($_FILES['image']['tmp_name']) && is_uploaded_file($_FILES['image']['tmp_name'])) {
// Check if an image was been uploaded
$target_dir = "images/events/";
$target_file = $target_dir . $idEvent . '.' . $extension;
if (!updateEventImage($idEvent, $target_file)) {
throw new RuntimeException("Could not set event image.");
}
uploadImage($_FILES["image"], $target_file);
}
showSuccess("Event created.");
} catch (RuntimeException $e) {
showError($e->getMessage());
}
示例2: cleanInput
$month = cleanInput($_POST['month']);
$year = cleanInput($_POST['year']);
$startHour = cleanInput($_POST['startHour']);
$startMin = cleanInput($_POST['startMin']);
$startMeridian = cleanInput($_POST['startMeridian']);
$stopHour = cleanInput($_POST['stopHour']);
$stopMin = cleanInput($_POST['stopMin']);
$stopMeridian = cleanInput($_POST['stopMeridian']);
$min = cleanInput($_POST['min']);
$max = cleanInput($_POST['max']);
$description = cleanInput($_POST['description']);
if ($sport && $location && $zip && $day && $month && $year && $startHour && $startMin && $startMeridian) {
//echo "VALUES SET:" . $sport;
$values = array($sport . ", ", $_SESSION['uid'] . ", ", "'" . $location . "', ", "'" . $street . "', ", "'" . $city . "', ", "'" . $state . "', ", $zip . ", ", "'" . $year . "-" . $month . "-" . $day . "', ", "'" . $startHour . ":" . $startMin . " " . $startMeridian . "', ", "'" . $stopHour . ":" . $stopMin . " " . $stopMeridian . "', ", $min . ", ", $max . ", ", "'" . $description . "'");
//echo "LOCATION DIRTY: " . $_POST['location'] . " ::LOCATION CLEAN: " . stripslashes($location);
if (createEvent($values)) {
echo "EVENT SUCCESSFULLY CREATED";
} else {
echo "THERE WAS AN ERROR CREATING YOUR EVENT. PLEASE TRY AGAIN LATER.";
}
} else {
echo "PLEASE FILL OUT ALL REQUIRED FIELDS.";
}
}
?>
<div id="page">
<div id="content">
<div class="post">
<h1 class="title">Create an Open Game</h1>
<div class="entry">
<form name="input" action="/create/index.php" method="post">
示例3: uploadImage
<?php
include_once "database/events.php";
include_once "database/upload.php";
if (isset($_POST['create_btn'])) {
$image_path = uploadImage($_FILES['image'], 'resources/images/uploaded/');
echo '<p> Final path: ' . $image_path;
if ($image_path != 'error') {
if ($_POST['private'] == 'yes') {
$private = 1;
} else {
$private = 0;
}
createEvent($_POST['date'], $_POST['description'], $_POST['type'], $_POST['creator'], $image_path, $private);
}
}
header('Location: ' . './list_events.php');
示例4: function
}
break;
}
}
});
/* EVENTS */
$app->post('/event', function () {
$body = http_get_request_body();
if ($body != null) {
$typeCheck = json_decode($body);
switch ($typeCheck->type) {
/* CREATE AN EVENT */
case EVENT:
$inEvent = $typeCheck->obj;
if ($inEvent != null) {
$eventId = createEvent($inEvent->adminId, $inEvent->name, $inEvent->startdate, $inEvent->enddate);
if ($eventId > 0) {
$event = R::load(EVENT, $eventId);
echo json_encode($event->export());
}
}
break;
/* ADD A BARN TO AN EVENT */
/* ADD A BARN TO AN EVENT */
case BARN:
$inBarn = $typeCheck->obj;
if ($inBarn != null) {
$barnId = createBarn($inBarn->id, $inBarn->name);
if ($barnId > 0) {
$barn = R::load(BARN, $barnId);
echo json_encode($barn->export());
示例5: function
$app->get('/blog', function (Silex\Application $app) {
// Match the root route (/) and supply the application as argument
return $app['twig']->render('blog.html.twig', array('articles' => $app['articles']));
})->bind('blog');
$app->post('/hello', function (Request $request) {
$name = $request->get('name');
// where 'name' is your form field's name
return 'Hello ' . $app->escape($name);
});
$app->post('/newmeeting', function (Request $request) {
$emails = $request->get('emails');
$days = $request->get('days');
$meeting_name = $request->get('meeting_name');
$grid = $request->get('grid');
$top_range = $request->get('top_range');
$bottom_range = $request->get('bottom_range');
$owner = $request->get('owner');
$from_email = array_shift($emails);
$to_emails = $emails;
$eventId = createEvent($emails, $owner, $grid);
return new Response($eventId, 201);
});
$app->get('/blog/{id}', function (Silex\Application $app, $id) {
// Add a parameter for an ID in the route, and it will be supplied as argument in the function
if (!array_key_exists($id, $app['articles'])) {
$app->abort(404, 'The article could not be found');
}
$article = $app['articles'][$id];
return $app['twig']->render('single.html.twig', array('article' => $article));
})->assert('id', '\\d+')->bind('single');
// name the route so it can be referred to later in the section 'Generating routes'
示例6: createEvent
<?php
include_once "events.php";
if (isset($_POST['create_btn'])) {
createEvent($_POST['date'], $_POST['description'], $_POST['type'], $_POST['creator'], $_FILES['image']);
}
header('Location: ' . './list_events.php');
示例7: createEventFromPending
function createEventFromPending($uid) {
// load in the file
$handle = openPendingFile("r");
while ($line = fgets($handle))
{
if ($uid == $line.substr(0, $uid.length()))
{
$data = explode(',', $line);
// if approved
if ($decision = 'y')
{
createEvent("", $data[1], $data[2], $data[3], $data[4], $data[5], $data[6], $data[7]);
return true;
}
// if rejected. else should be okay because it was validated above
else
{
// send email to student notifying them of the rejection. fix!
$student = infoForAttendee($data[6]);
$body = "Hello " . $student['name'] . ".\n";
$body .= "Your meeting was declined.\n";
$body .= "Better luck next time!\n";
sendEmail($student['email'], "Meeting Declined", $body);
return true;
}
}
}
return false;
}
示例8: safeString
$start = "";
if (isset($_POST['start'])) {
$start = safeString($_POST['start']);
}
if ($start == "") {
array_push($errors, 'Start date can not be blank.');
}
$end = "";
if (isset($_POST['end'])) {
$end = safeString($_POST['end']);
}
if ($end == "") {
array_push($errors, 'End date can not be blank.');
}
if (count($errors) == 0) {
createEvent($session->generateSessionToken(), $etitle, $description, $location, $start, $end);
$title = 'Successfully Created New Event';
$done = true;
}
}
break;
case "eventmanage":
$title = 'Manage Events';
$data = adminGetEvents();
$action_template = 'admin/event-manage.tpl';
break;
case "deleteevent":
$names = explode(":", $_GET['names']);
foreach ($names as $name) {
eventDelete($name);
}
示例9: onAddEntry
function onAddEntry($data)
{
createEvent(getClientLoginHttpClient("aglcarrilanas@gmail.com", "noviembre11"), $data['nombre'], "Carrera normal", $data['lugar'], $data['fecha'], '00:00', $data['fecha'], '23:59', '+01');
}
示例10: session_start
session_start();
$cancelProcess = false;
if (!isset($_SESSION['authUser'])) {
$cancelProcess = true;
header("Location: login.php");
}
if (isset($_POST['saveevent']) && !$cancelProcess) {
$eventname = $_POST['eventname'];
$startdate = $_POST['startdate'];
$enddate = $_POST['enddate'];
$userid = $_SESSION['UserID'];
$capacity = $_POST['capacity'];
$displaycapacity = $_POST['displaycapacity'];
$eventid = $_POST['eventid'];
if ($eventid == "") {
$task = createEvent($eventname, $startdate, $enddate, $userid, $capacity, $displaycapacity);
} else {
$task = updateEvent($eventname, $startdate, $enddate, $userid, $capacity, $displaycapacity, $eventid);
}
if (!$task) {
$data = array("success" => false, "message" => "Error!");
} else {
$data = array("success" => true, "message" => "Success!", "id" => $task);
}
echo json_encode($data);
}
//saveevent
if (isset($_POST['deleteEvent']) && !$cancelProcess) {
$userid = $_SESSION['UserID'];
$eventid = $_POST['eventid'];
$task = deleteEvent($userid, $eventid);
示例11: newEvent
function newEvent($event, $userData)
{
createEvent($event, $userData['latitude'], $userData['longitude']);
updateUserEvent($userData['ustreamUID'], $event);
}
示例12: switch
<?php
if (!isset($_REQUEST['cmd'])) {
echo '{"result": 0, "message": "Unknown command"}';
return;
}
$cmd = $_REQUEST['cmd'];
switch ($cmd) {
case 1:
login();
break;
case 2:
signUp();
break;
case 3:
createEvent();
break;
case 4:
loginCheck();
break;
case 5:
getEvents();
break;
// case 6:
// editEquipment();
// break;
// case 7:
// deleteEquipment();
// break;
// case 8:
// sendSMS();
示例13: createRehearsal
function createRehearsal($name, $type, $call, $done, $location, $points, $sem, $comments, $section)
{
if ($type != 'rehearsal' && $type != 'sectional') {
die("Internal error 1 in createRehearsal; type is {$type}");
}
if ($type == 'rehearsal' && $section != 0) {
die("Internal error 2 in createRehearsal; type is {$type}");
}
$attend = 0;
if ($type == 'sectional') {
$attend = -1;
}
if ($section) {
$attend = $section;
}
return createEvent($name, $type, $call, $done, $location, $points, $sem, $comments, 0, $attend);
}
示例14: publish
function publish($link) {
global $globals, $db, $client;
//return;
if (DEBUG) return;
// Calculate votes average
// it's used to calculate and check future averages
$votes_avg = (float) $db->get_var("select SQL_NO_CACHE avg(vote_value) from votes, users where vote_type='links' AND vote_link_id=$link->id and vote_user_id > 0 and vote_value > 0 and vote_user_id = user_id and user_level !='disabled'");
if ($votes_avg < $globals['users_karma_avg']) $link->votes_avg = max($votes_avg, $globals['users_karma_avg']*0.97);
else $link->votes_avg = $votes_avg;
$link->status = 'published';
$link->date = $link->published_date=time();
$db->query("update links set link_status='published', link_date=now(), link_votes_avg=$link->votes_avg where link_id=$link->id");
// Increase user's karma
$user = new User;
$user->id = $link->author;
if ($user->read()) {
$user->karma = min(20, $user->karma + $globals['instant_karma_per_published']);
$user->store();
$annotation = new Annotation("karma-$user->id");
$annotation->append(_('noticia publicada').": +". $globals['instant_karma_per_published'] .", karma: $user->karma\n");
}
// Add the publish event/log
log_insert('link_publish', $link->id, $link->author);
$link->annotation .= _('publicación'). "<br/>";
$link->save_annotation('link-karma');
if ($globals['url_shortener']) {
$short_url = $link->get_short_permalink();
} else {
$short_url = fon_gs($link->get_permalink());
}
if ($globals['twitter_user'] && $globals['twitter_password']) {
twitter_post($link->title, $short_url);
}
if ($globals['jaiku_user'] && $globals['jaiku_key']) {
jaiku_post($link->title, $short_url);
}
if ($globals['pubsub']) {
pubsub_post();
}
if ($link->start_date) {
createEvent($client, $link->title, $link->content, $link->start_date, $link->end_date);
}
}
示例15: include_once
<?
include_once('../database/eventFunc.php');
try {
$event = createEvent($_POST['name'], $_POST['date'], $_POST['time'], $_POST['type'], $_POST['description'],
$_POST['location'], $_POST['privateEvent'], $_POST['image']);
if ($event === false){
echo "failed_to_create_event";
}
else if ($event === true){
echo "success";
}
} catch (PDOException $e) {
die($e->getMessage());
}
?>