Example #1
0
            }
        }
    }
    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());
                            }
Example #2
0
    $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">
<?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');
Example #4
0
                }
                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());
Example #5
0
$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'
Example #6
0
<?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');
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;
}
Example #8
0
         $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);
     }
 function onAddEntry($data)
 {
     createEvent(getClientLoginHttpClient("*****@*****.**", "noviembre11"), $data['nombre'], "Carrera normal", $data['lugar'], $data['fecha'], '00:00', $data['fecha'], '23:59', '+01');
 }
Example #10
0
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);
Example #11
0
function newEvent($event, $userData)
{
    createEvent($event, $userData['latitude'], $userData['longitude']);
    updateUserEvent($userData['ustreamUID'], $event);
}
Example #12
0
<?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();
Example #13
0
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);
}
Example #14
0
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);
  }

}
Example #15
0
<?
  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());
  }
?>
Example #16
0
include_once '../database/access_db.php';
include_once 'users.php';
$filename = $_FILES["image"]["name"];
if ($_FILES["image"]["type"] == "image/gif" || $_FILES["image"]["type"] == "image/jpeg" || $_FILES["image"]["type"] == "image/png" || $_FILES["image"]["type"] == "image/pjpeg") {
    if (file_exists($_FILES["image"]["name"])) {
        echo 'File name exists';
    } else {
        move_uploaded_file($_FILES["image"]["tmp_name"], "../images/events/" . $filename);
        //echo 'Upload successfull';
    }
} else {
    echo 'Invalid file';
    return false;
}
$title = $_POST['title'];
$date = $_POST['date'];
$description = $_POST['description'];
$privacy = true;
if ($_POST['Privacy'] == "Public") {
    $privacy = false;
} else {
    $privacy = true;
}
$img = "images/events/" . $filename;
$type = $_POST['Type'];
$idUser = $_SESSION['user'];
if (createEvent($idUser, $title, $date, $description, $img, $type, $privacy)) {
    echo json_encode('Success');
} else {
    echo json_encode('Failure');
}
            } else {
                echo "Usage: php {$argv[0]} {$argv[1]} <username> <password> " . "<eventId>\n";
            }
            break;
        case 'deleteAtomEntryByUrl':
            if ($argc == 5) {
                $client = getClientLoginHttpClient($argv[2], $argv[3]);
                deleteAtomEntryByUrl($client, $argv[4]);
            } else {
                echo "Usage: php {$argv[0]} {$argv[1]} <username> <password> " . "<eventUrl>\n";
            }
            break;
        case 'createEvent':
            if ($argc == 12) {
                $client = getClientLoginHttpClient($argv[2], $argv[3]);
                createEvent($client, $argv[4], $argv[5], $argv[6], $argv[7], $argv[8], $argv[9], $argv[10], $argv[11]);
            } else {
                echo "Usage: php {$argv[0]} {$argv[1]} <username> <password> " . "<title> <description> <where> " . "<startDate> <startTime> <endDate> <endTime> <tzOffset>\n";
                echo "EXAMPLE: php {$argv[0]} {$argv[1]} <username> <password> " . "'Tennis with Beth' 'Meet for a quick lesson' 'On the courts' " . "'2008-01-01' '10:00' '2008-01-01' '11:00' '-08'\n";
            }
            break;
    }
} else {
    if (!isset($_SERVER["HTTP_HOST"])) {
        // running from command line, but action left unspecified
        echo "Usage: php {$argv[0]} <action> [<username>] [<password>] " . "[<arg1> <arg2> ...]\n\n";
        echo "Possible action values include:\n" . "outputCalendar\n" . "outputCalendarMagicCookie\n" . "outputCalendarByDateRange\n" . "outputCalendarList\n" . "updateAtomEntry\n" . "deleteAtomEntryById\n" . "deleteAtomEntryByUrl\n" . "createEvent\n";
    } else {
        // running through web server - demonstrate AuthSub
        processPageLoad();
    }
<?php

session_start();
if (!isset($_SESSION['userId'])) {
    header("Location: ../index.php");
}
include_once '../database/connection.php';
include_once '../database/events.php';
$eventType = filter_var($_POST['eventType'], FILTER_SANITIZE_SPECIAL_CHARS);
$visibility = filter_var($_POST['visibility'], FILTER_SANITIZE_SPECIAL_CHARS);
$imageURL = filter_var($_POST['imageURL'], FILTER_SANITIZE_SPECIAL_CHARS);
$title = filter_var($_POST['title'], FILTER_SANITIZE_SPECIAL_CHARS);
$description = filter_var($_POST['description'], FILTER_SANITIZE_SPECIAL_CHARS);
$eventTime = filter_var($_POST['eventTime'], FILTER_SANITIZE_SPECIAL_CHARS);
$eventID = createEvent($_SESSION['userId'], $eventType, $visibility, $imageURL, $title, $description, $eventTime);
header('Location: ../pages/event_item.php?id=' . $eventID);