27 lines
560 B
PHP
27 lines
560 B
PHP
<?php
|
|
|
|
class EdittrackController extends Controller
|
|
{
|
|
|
|
function __construct()
|
|
{
|
|
if (!App::$user->id) {
|
|
App::redirect('/');
|
|
}
|
|
}
|
|
|
|
function actionTrip()
|
|
{
|
|
$id = intval(App::getParam('id'));
|
|
$trip = Trips::model()->getByPK($id);
|
|
|
|
if (empty($_POST['name']) || $trip->isEmpty() || $trip->owner != App::$user->id) {
|
|
App::error404();
|
|
}
|
|
|
|
$trip->name = trim($_POST['name']);
|
|
$trip->description = trim($_POST['description']);
|
|
$trip->status = ($_POST['isPublic'] == 'true') ? Trips::STATUS_PUBLIC : Trips::STATUS_PRIVATE;
|
|
$trip->save();
|
|
}
|
|
} |