checkstandname($stand); returnbike($userid, $bikenum, $stand, $note); break; case "validatecoupon": logrequest($userid, $action); checksession(); $coupon = trim($_GET["coupon"]); validatecoupon($userid, $coupon); break; case "forcerent": logrequest($userid, $action); checksession(); checkprivileges($userid); $bikenum = trim($_GET["bikeno"]); checkbikeno($bikenum); rent($userid, $bikenum, TRUE); break; case "forcereturn": logrequest($userid, $action); checksession(); checkprivileges($userid); $bikenum = trim($_GET["bikeno"]); $stand = trim($_GET["stand"]); $note = ""; if (isset($_GET["note"])) { $note = trim($_GET["note"]); } checkbikeno($bikenum); checkstandname($stand); returnBike($userid, $bikenum, $stand, $note, TRUE); break;
case "FREE": freeBikes($sms->Number()); break; case "RENT": validateReceivedSMS($sms->Number(), count($args), 2, _('with bike number:') . " RENT 47"); rent($sms->Number(), $args[1]); //intval break; case "RETURN": validateReceivedSMS($sms->Number(), count($args), 3, _('with bike number and stand name:') . " RETURN 47 RACKO"); returnBike($sms->Number(), $args[1], $args[2], trim(urldecode($sms->Text()))); break; case "FORCERENT": checkUserPrivileges($sms->Number()); validateReceivedSMS($sms->Number(), count($args), 2, _('with bike number:') . " FORCERENT 47"); rent($sms->Number(), $args[1], TRUE); break; case "FORCERETURN": checkUserPrivileges($sms->Number()); validateReceivedSMS($sms->Number(), count($args), 3, _('with bike number and stand name:') . " FORCERETURN 47 RACKO"); returnBike($sms->Number(), $args[1], $args[2], trim(urldecode($sms->Text())), TRUE); break; case "WHERE": case "WHO": validateReceivedSMS($sms->Number(), count($args), 2, _('with bike number:') . " WHERE 47"); where($sms->Number(), $args[1]); break; case "INFO": validateReceivedSMS($sms->Number(), count($args), 2, _('with stand name:') . " INFO RACKO"); info($sms->Number(), $args[1]); break;
} if (isset($_COOKIE["logsession"])) { $session = $_COOKIE["logsession"]; } $request = substr($_SERVER["REQUEST_URI"], strpos($_SERVER["REQUEST_URI"], ".php") + 5); $request = explode("/", $request); $action = $request[0]; if (isset($request[1])) { $parameter = $request[1]; } else { $action = ""; } // mangled QR code, clear action switch ($action) { case "rent": logrequest($userid, $action); checksession(); $bikeno = $parameter; checkbikeno($bikeno); rent($userid, $bikeno); break; case "return": logrequest($userid, $action); checksession(); $stand = $parameter; checkstandname($stand); returnbike($userid, $stand); break; default: unrecognizedqrcode($userid); }
checkstandname($stand); returnBike($userid, $bikeno, $stand, $note); break; case "validatecoupon": logrequest($userid, $action); checksession(); $coupon = trim($_GET["coupon"]); validatecoupon($userid, $coupon); break; case "forcerent": logrequest($userid, $action); checksession(); checkprivileges($userid); $bikeno = trim($_GET["bikeno"]); checkbikeno($bikeno); rent($userid, $bikeno, TRUE); break; case "forcereturn": logrequest($userid, $action); checksession(); checkprivileges($userid); $bikeno = trim($_GET["bikeno"]); $stand = trim($_GET["stand"]); $note = ""; if (isset($_GET["note"])) { $note = trim($_GET["note"]); } checkbikeno($bikeno); checkstandname($stand); returnBike($userid, $bikeno, $stand, $note, TRUE); break;