예제 #1
0
function param($name, $default = '', $trim = true)
{
    $p = queryParams();
    if (!isset($p[$name])) {
        if (isPost()) {
            $p = $_POST;
        } else {
            return $default;
        }
    }
    return isset($p[$name]) ? $trim ? trim($p[$name]) : $p[name] : $default;
}
예제 #2
0
 function do_edit($id)
 {
     $params = queryParams();
     $entry = $this->getEditable('Entry', $id);
     if ($entry->canEdit($this->currentUser)) {
         $entry->user->get();
         $this->render(null, array('entry' => $entry));
     } else {
         $this->flash('Login as the owner of this entry to edit it.');
         $this->setReturnTo(url_to($entry, 'edit'));
         redirect(url_to('users', 'login'));
     }
 }