public function testPageTitleCarrierWithCustomSeperator() { Nimble::set_config('site_title', 'Mysite'); Nimble::set_config('title_seperator', '->'); Nimble::set_title('My Page'); $this->assertEquals('Mysite->My Page', Nimble::get_title()); }
public function index() { $this->set_default_side_bar(); $this->title = 'All Packages'; Nimble::set_title($this->title); $page = isset($_GET['page']) ? $_GET['page'] : NULL; switch ($this->format) { case 'xml': $this->packages = Package::find_all(); $this->header('Content-Type: text/xml', 200); echo $this->packages->to_xml(); $this->layout = false; $this->has_rendered = true; break; case 'json': $this->packages = Package::find_all(); $this->header('Content-type: application/json', 200); echo $this->packages->to_json(); $this->layout = false; $this->has_rendered = true; break; case 'atom': $this->layout = false; $this->has_rendered = true; break; case 'rss': $this->layout = false; $this->has_rendered = true; break; default: $this->full = true; $this->packages = Package::paginate(array('select' => '`packages`.*, AVG(`package_ratings`.`rating`) as rating', 'order' => 'rating DESC', 'per_page' => 20, 'page' => $page, 'joins' => 'LEFT JOIN `package_ratings` on `package_ratings`.`package_id` = `packages`.`id`', 'group' => '`packages`.id')); break; } }
public function index() { $this->title = 'Making it trivially easy to create PEAR packages.'; Nimble::set_title($this->title); $this->set_default_side_bar(); if ($this->is_logged_in()) { $this->login_user(); } }
public function show() { if ($this->is_logged_in()) { $this->login_user(); } try { $user = User::find_by_username($_GET['username']); $this->package = Package::find('first', array('conditions' => array('user_id' => $user->id, 'name' => $_GET['package_name']))); $this->version = Version::find('first', array('conditions' => array('package_id' => $this->package->id, 'version' => $_GET['version']))); $this->title = $this->package->name . ' ' . $this->version->version; Nimble::set_title($this->title); $this->data = unserialize($this->version->meta); } catch (NimbleRecordNotFound $e) { Nimble::flash('notice', 'Version does not exist'); $this->redirect_to('/'); } }
public function login() { $this->title = 'Login'; Nimble::set_title($this->title); try { if (isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && User::authenticate($_POST['username'], $_POST['password'])) { $user = User::find_by_username($_POST['username']); $_SESSION['user'] = $user->id; $this->redirect_if_logged_in(); } else { Nimble::flash('notice', 'Invalid Login Information'); $this->render('login/form.php'); } } catch (NimbleRecordNotFound $e) { Nimble::flash('notice', 'Invalid Login Information'); $this->render('login/form.php'); } }
public function index() { $this->set_default_side_bar(); $this->title = 'All Packages'; Nimble::set_title($this->title); $page = isset($_GET['page']) ? $_GET['page'] : NULL; $this->packages = Package::paginate(array('order' => 'name DESC', 'per_page' => 20, 'page' => $page)); switch ($this->format) { case 'xml': $this->header('Content-Type: text/xml', 200); echo $this->packages->to_xml(array('include' => array('versions'))); $this->layout = false; $this->has_rendered = true; break; case 'atom': break; case 'rss': break; } }
public function stats() { $this->title = 'Pearfarm Stats'; Nimble::set_title($this->title); }