protected function page_load() { $this->hasAuthorizedUser = Renegade::hasAuthorizedUser(); if ($this->requiresAuthorization && !$this->hasAuthorizedUser) { header('Location: /'); } $this->session = Renegade::session(); $this->initialize(); }
public function __toString() { $session = Renegade::session(); $owner = $session->user; $users = array(); $this->private = (bool) $this->private ? true : false; if ($this->private) { $users[] = $owner; } return json_encode(array('owner' => $owner, 'api_key' => $this->api_key, 'api_secret' => $this->api_secret, 'private' => $this->private, 'users' => $users, 'type' => RenegadeConstants::kTypeChannel)); }
public function showApplications() { $mongodb = Renegade::database(RenegadeConstants::kDatabaseMongoDB, RenegadeConstants::kDatabaseApplications); $redis = Renegade::database(RenegadeConstants::kDatabaseRedis, RenegadeConstants::kDatabaseCertificates); $session = Renegade::session(); $response = $mongodb->find(array('owner' => $session->user)); if ($response->count()) { foreach ($response as $id => $application) { // mget might be better here... $certificate = json_decode($redis->get($application['certificate']), true); $application['api_key'] = $certificate['key']; $application['api_secret'] = $certificate['secret']; $application['permission_read'] = $application['defaultPermissions'] & RenegadeConstants::kPermissionRead ? 'Yes' : 'No'; $application['permission_write'] = $application['defaultPermissions'] & RenegadeConstants::kPermissionWrite ? 'Yes' : 'No'; $application['permission_delete'] = $application['defaultPermissions'] & RenegadeConstants::kPermissionDelete ? 'Yes' : 'No'; echo new ApplicationDetail($application); } } else { echo 'No Applications'; } }
public function authorizedUser() { $session = Renegade::session(); return $session->user; }
require $_SERVER['DOCUMENT_ROOT'] . '/application/models/Channel.php'; require $_SERVER['DOCUMENT_ROOT'] . '/application/models/Application.php'; require $_SERVER['DOCUMENT_ROOT'] . '/application/lib/axismundi/forms/AMForm.php'; require $_SERVER['DOCUMENT_ROOT'] . '/application/lib/axismundi/forms/validators/AMPatternValidator.php'; require $_SERVER['DOCUMENT_ROOT'] . '/application/lib/axismundi/forms/validators/AMInputValidator.php'; require $_SERVER['DOCUMENT_ROOT'] . '/application/forms/validators/UniqueChannelValidator.php'; require $_SERVER['DOCUMENT_ROOT'] . '/application/forms/validators/ApplicationIdValidator.php'; function form_prepare(&$item, $key) { $item = trim($item); if ($key == 'inputId') { $item = strtolower($item); } } if (count($_POST)) { $session = Renegade::session(); if (strlen($session->user) > 0) { array_walk($_POST, 'form_prepare'); $context = array(AMForm::kDataKey => $_POST); $form = AMForm::formWithContext($context); $form->addValidator(new AMInputValidator('inputName', true, 4, null, 'Channel Name must be at least 4 characters long')); $form->addValidator(new AMPatternValidator('inputName', true, '/^[\\w ]+$/', 'Application Name may only container letters, numbers, spaces or _')); $form->addValidator(new AMPatternValidator('inputType', true, '/^forum$/', 'Invalid Application Type')); $form->addValidator(new ApplicationIdValidator('inputId', true, 'Invalid application id. Please use reverse domain name style starting with com, net, org or edu e.g., com.galaxy.community')); /*$form->addValidator(new ApplicationIdValidator('inputUrl', true, 'Invalid application id. Please use reverse domain name style starting with com, net, org or edu e.g., com.galaxy.community'));*/ /* TODO Need to create an AMUrlValidator */ if ($form->isValid) { // The data for an application is sored in MongoDB, the rest is in Redis /* this is a 2 part process
public function logout() { $session = Renegade::session(); $session->reset(); }