public function run() { $log = new Logging(); // $parenClass = new ParentClass(); // set path and name of log file (optional) $log->lfile('log.txt'); $json = file_get_contents('php://input'); $log->lwrite("post: " . $json); $update = new Update($json); $message = $update->getMessage(); $chat = $message->getChat(); $chat_id = $chat->getId(); $text = $message->getText(); $client = new Client(); $client->sendMessage($chat_id, $text, null, null, null); $client->sendLocation($chat_id, 53.480759, -2.242631, null, null); $client->sendPhoto($chat_id, 'pic.jpg', 'sweety', null, null); $log->lclose(); }
// get acceptedID $accepted = Accepted::getByUserID(Session::getUserID(), $task->getID()); // update status $accepted->setStatus($status); $accepted->save(); // create the update $update = new Update(array('creator_id' => Session::getUserID(), 'accepted_id' => $accepted->getID(), 'project_id' => $project->getID(), 'title' => $title, 'message' => $message)); $update->save(); // save uploaded files to database foreach ($_POST['file'] as $stored => $orig) { $stored = Filter::text($stored); $orig = Filter::text($orig); Upload::saveToDatabase($orig, $stored, Upload::TYPE_UPDATE, $update->getID(), $project->getID()); } // log it $logEvent = new Event(array('event_type_id' => 'create_update', 'user_1_id' => Session::getUserID(), 'project_id' => $project->getID(), 'item_1_id' => $update->getID(), 'item_2_id' => $accepted->getID(), 'item_3_id' => $task->getID(), 'data_1' => $update->getTitle(), 'data_2' => $update->getMessage())); $logEvent->save(); // we're done here Session::setMessage('You created a new update for this task.'); $json = array('success' => '1', 'successUrl' => Url::update($update->getID())); echo json_encode($json); } elseif ($action == 'edit-update') { // validate update $updateID = Filter::numeric($_GET['u']); $update = Update::load($updateID); if ($update == null) { header('Location: ' . Url::error()); exit; } // get update content $title = Filter::text($_POST['txtTitle']);