Exemple #1
0
		<?php 
if (count($messages)) {
    foreach ($messages as $single) {
        ?>
			<div class="row">
				<div class="col-md-6 col-md-offset-3">
					<div class="testimonials">
						<div class="active item">
							<blockquote>
								<p><?php 
        echo $single['message'];
        ?>
</p>
								<h5 class="">
									<span class="testimonials-name"><?php 
        echo $mm->getNameByNumber($single['phone']);
        ?>
</span>
									<small>Sent <?php 
        echo date('Y-m-d H:i:s', strtotime($single["timestamp"]));
        ?>
</small>
								</h5>
							</blockquote>
						</div>
					</div>
				</div>
			</div>
		<?php 
    }
} else {
}
// end confirmation checks
// Does this message start with "List"
if ('list' == strtolower(substr($messageBody, 0, 4))) {
    $list = $mm->getShoppingList();
    //interesting use of native PHP functions
    $list = http_build_query($list, NULL, ",\n");
    $mm->setSendMessage($receivedFrom, $list);
    header($_SERVER['SERVER_PROTOCOL'] . ' OK', true, 200);
    exit;
}
// Does this message start with "Next"
if ('next' == strtolower(substr($messageBody, 0, 4))) {
    $found = $mm->getWeekBuyer();
    $mm->setSendMessage($receivedFrom, "{$found['name']} is on Monster Monday duty for " . date('l, F jS', $found['weekOf']));
    header($_SERVER['SERVER_PROTOCOL'] . ' OK', true, 200);
    exit;
}
// Brodcast, send to all expect the sender
if ('broadcast' == strtolower(substr($messageBody, 0, 9))) {
    $messageBody = substr($messageBody, 9);
    $messageBody = trim(trim($messageBody, ':'));
    $mm->setSendMessageToAll($mm->getNameByNumber($receivedFrom) . ': ' . $messageBody, $receivedFrom);
    header($_SERVER['SERVER_PROTOCOL'] . ' OK', true, 200);
    exit;
}
// Does this message start with "Rotation" -- list the order of
//@todo check for rotation message
$mm->setSendMessage($receivedFrom, "Sorry, that's not a valid option. See http://monday.dkz.io/ for help... you n00b.");
header($_SERVER['SERVER_PROTOCOL'] . ' OK', true, 200);
exit;