public function annotate() { $httpContext = HttpContext::getInstance(); if (!$httpContext->session('username')) { throw new \Exception("Unauthorized", 401); } }
public function __construct() { $context = HttpContext::getInstance(); $this->setName($context->post('name')); $this->setStartDate($context->post('startDate')); $this->setEndDate($context->post('endDate')); $this->setHallId(intval($context->post('hallId'))); }
public function __construct() { $context = HttpContext::getInstance(); $this->setUsername($context->post('username')); $this->setPassword($context->post('password')); $this->setConfirmPassword($context->post('confirm')); $this->setEmail($context->post('email')); $this->setTelephone($context->post('telephone', 'int')); }
public function annotate() { $httpContext = HttpContext::getInstance(); if (!$httpContext->session('username')) { throw new \Exception("Unauthorized", 401); } if (!$this->identity->isInRole("Admin")) { throw new \Exception("Only Admin Access!!"); } }
public function __construct() { $this->dbContext = new DbContext(); $this->context = HttpContext::getInstance(); $this->identity = Identity::getInstance(); if ($this->identity->isAuthorised()) { $this->getInvites(); } $this->onInit(); }
public function __construct(Conference $conference = null) { if (!$conference) { $context = HttpContext::getInstance(); $this->setStartDate($context->post('startDate')); $this->setEndDate($context->post('endDate')); $this->setTitle($context->post('title')); $this->setVenueId($context->post('venueId', 'int')); } else { $this->venueId = intval($conference->getVenueId()); $this->endDate = $conference->getEnd(); $this->startDate = $conference->getStart(); $this->title = $conference->getName(); $this->id = $conference->getId(); } }
private function checkModel($model) { if (HttpContext::getInstance()->getMethod() == 'get') { return; } $path = $this->getView(); $contents = file_get_contents($path); if (is_array($model)) { $modelClassName = explode('\\', get_class($model[0])); } else { $modelClassName = explode('\\', get_class($model)); } $modelClassName = end($modelClassName); preg_match_all("/@model\\s*=\\s*(.*) /", $contents, $matches); if ($matches[1]) { if ($matches[1][0] !== $modelClassName) { throw new \Exception('Invalid view model! Expected ' . $matches[1][0]); } } }
public function __construct() { $context = \ConferenceScheduler\Core\HttpContext\HttpContext::getInstance(); $this->setPassword($context->post('password')); $this->setUsername($context->post('username')); }
echo '<li> <a style="color:red" href="/Me/Invites">Speaker Invites</a></li>'; } else { echo '<li> <a href="/Me/Invites">Speaker Invites</a></li>'; } ?> <?php } ?> </ul> <?php if (!\ConferenceScheduler\Core\HttpContext\HttpContext::getInstance()->session('username')) { ?> <ul class="nav navbar-nav navbar-right"> <li><a href="/Account/Register">Register</a></li> <li><a href="/Account/Login">Login</a></li> </ul> <?php } else { ?> <ul class="nav navbar-nav navbar-right"> <li><a href="#">Hello, <?php echo strtoupper(\ConferenceScheduler\Core\HttpContext\HttpContext::getInstance()->session('username')); ?> </a></li> <li><a href="/account/logout">Logout</a></li> <?php } ?> </div> </div> </div>
public function __construct($lectureId) { $this->username = HttpContext::getInstance()->post('username', 'string|xss'); $this->lectureId = $lectureId; }
function __construct(DbContext $dbContext) { $this->dbContext = $dbContext; $this->context = HttpContext::getInstance(); }