/** * @return array * @throws DreamFactory\Platform\Exceptions\BadRequestException */ protected function _parseRequest() { $_resourceId = strtolower(trim(FilterInput::request('resource', null, FILTER_SANITIZE_STRING))); $_id = FilterInput::request('id', null, FILTER_SANITIZE_STRING); if (empty($_resourceId) || empty($_resourceId) && empty($_id)) { throw new BadRequestException(404, 'Not found.'); } // Handle a plural request if (false !== ($_tempId = Inflector::isPlural($_resourceId, true))) { $_resourceId = $_tempId; } $this->setModelClass('DreamFactory\\Platform\\Yii\\Models\\' . Inflector::deneutralize($_resourceId)); return array($_resourceId, $_id); }
/** * Handle inbound redirect from various services * * @throws DreamFactory\Platform\Exceptions\RestException */ public function actionAuthorize() { Log::debug('Inbound $REQUEST: ' . print_r($_REQUEST, true)); $_state = Storage::defrost(Option::request('state')); $_origin = Option::get($_state, 'origin'); $_apiKey = Option::get($_state, 'api_key'); Log::debug('Inbound state: ' . print_r($_state, true)); if (empty($_origin) || empty($_apiKey)) { Log::error('Invalid request state.'); throw new BadRequestException(); } if ($_apiKey != ($_testKey = sha1($_origin))) { Log::error('API Key mismatch: ' . $_apiKey . ' != ' . $_testKey); throw new ForbiddenException(); } $_code = FilterInput::request('code', null, FILTER_SANITIZE_STRING); if (!empty($_code)) { Log::debug('Inbound code received: ' . $_code . ' from ' . $_state['origin']); } else { if (null === Option::get($_REQUEST, 'access_token')) { Log::error('Inbound request code missing.'); throw new RestException(HttpResponse::BadRequest); } else { Log::debug('Token received. Relaying to origin.'); } } $_redirectUri = Option::get($_state, 'redirect_uri', $_state['origin']); $_redirectUrl = $_redirectUri . (false === strpos($_redirectUri, '?') ? '?' : '&') . \http_build_query($_REQUEST); Log::debug('Proxying request to: ' . $_redirectUrl); header('Location: ' . $_redirectUrl); exit; }
use Kisma\Core\Utility\Curl; use Kisma\Core\Utility\FilterInput; /** * @var string $content * @var ConsoleController $this */ $_route = $this->route; $_step = 'light'; $_headline = 'DSP Settings'; $_themeList = null; // Change these to update the CDN versions used. Set to false to disable $_bootstrapVersion = '3.1.1'; // Set to false to disable $_bootswatchVersion = '3.1.1'; $_dataTablesVersion = '1.9.4'; $_bootswatchTheme = FilterInput::request('theme', Pii::getState('admin.default_theme', 'default'), FILTER_SANITIZE_STRING); Pii::setState('dsp.admin_theme', $_bootswatchTheme); $_useBootswatchThemes = 'default' != $_bootswatchTheme; $_fontAwesomeVersion = '4.0.3'; // Set to false to disable $_jqueryVersion = '1.11.0'; $_themes = array('Default', 'Amelia', 'Cerulean', 'Cosmo', 'Cyborg', 'Flatly', 'Journal', 'Readable', 'Simplex', 'Slate', 'Spacelab', 'United'); $_url = Curl::currentUrl(false); foreach ($_themes as $_item) { $_name = strtolower($_item); $_class = $_bootswatchTheme == $_name ? 'class="active"' : null; $_themeList .= <<<HTML \t<li {$_class}><a href="{$_url}?theme={$_name}">{$_item}</a></li> HTML; } // Our css building begins...