<?php require $_SERVER['DOCUMENT_ROOT'] . '/config/main.php'; if ($_POST['email1'] != '' && $_POST['name1'] != '' && $_POST['hours'] != '') { $connected_with = 0; if ($_POST['email2'] != '' && $_POST['name2'] != '') { $connected_with = rand(); } create_meeting_request('direct', date('Y-m-d H:i:s'), $_POST['email1'], $_SESSION['email'], $_SESSION['first_name'] . ' ' . $_SESSION['last_name'], null, null, null, $_POST['hours'], '', null, null, $_POST['name1'], $connected_with); if ($_POST['email2'] != '' && $_POST['name2'] != '') { create_meeting_request('direct', date('Y-m-d H:i:s'), $_POST['email2'], $_SESSION['email'], $_SESSION['first_name'] . ' ' . $_SESSION['last_name'], null, null, null, $_POST['hours'], '', null, null, $_POST['name2'], $connected_with); } if ($_POST['email3'] != '' && $_POST['name3'] != '') { create_meeting_request('direct', date('Y-m-d H:i:s'), $_POST['email3'], $_SESSION['email'], $_SESSION['first_name'] . ' ' . $_SESSION['last_name'], null, null, null, $_POST['hours'], '', null, null, $_POST['name3'], $connected_with); } } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Invitations - Schedule Ninja</title> <?php require $_SERVER['DOCUMENT_ROOT'] . '/includes/head.php'; ?> <style> div.email_box{ width:100%; margin:0 0 15px 0; background:#f5f5f5;
} $contextIO->syncSource($accountId); $r = $contextIO->listMessages($accountId, array('include_body' => true)); foreach ($r->getData() as $message) { $msg_id = $message['message_id']; $subject = $message['subject']; $date_received = date("Y-m-d H:i:s", $message['date_received']); $recipient = $message['addresses']['to'][0]['email']; $sender_email = $message['addresses']['from']['email']; $sender_name = $message['addresses']['from']['name']; $constraints_after = NULL; $constraints_before = NULL; $requested_date = NULL; $hours = 0; $main_body = ''; $bodies = $message['body']; foreach ($bodies as $body) { if ($body['type'] == 'text/plain') { $main_body = $body['content']; } elseif ($main_body == '') { $main_body = $body['content']; } } print "\t"; if (is_meeting_request($subject, $main_body)) { print 'YES ' . $subject . PHP_EOL; create_meeting_request('email', $date_received, $recipient, $sender_email, $sender_name, $constraints_after, $constraints_before, $requested_date, $hours, $subject, $msg_id, $main_body); } else { print 'NO ' . $subject . PHP_EOL; } }
<?php require 'config/main.php'; ?> <?php function random_string($length, $charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') { $str = ''; $count = strlen($charset); while ($length--) { $str .= $charset[mt_rand(0, $count - 1)]; } return $str; } for ($i = 0; $i < 10; $i++) { $type = $i % 2 == 0 ? 'direct' : 'email'; $int = mt_rand(1440646225, 1443334681); $date_received = date("Y-m-d H:i:s", $int); $recipient = $i % 3 == 0 ? '*****@*****.**' : '*****@*****.**'; $sender_name = random_string(9, 'abcdefghijklmnopqrstuvwxyz'); $sender_email = "{$sender_name}@samueltaylor.org"; $hours = rand(1, 6); $constraints_after = $i % 4 == 0 ? NULL : date("Y-m-d H:i:s", $int); $constraints_before = $i % 3 == 0 ? NULL : date("Y-m-d H:i:s", $int + 60 * 60 * 24 * 7); $requested_date = NULL; create_meeting_request($type, $date_received, $recipient, $sender_email, $sender_name, $constraints_after, $constraints_before, $requested_date, $hours); } echo 'yey';