public function testServiceRequestEvents() { // A post test Platform::on('user.list', 'http://dsp.local/web/eventReceiver', static::API_KEY); // An inline test Platform::on('user.list', function ($event, $eventName, $dispatcher) { $this->assertEquals('user.list', $eventName); $this->_actionEventFired = 1; echo 'event "user.list" has been fired.'; }, static::API_KEY); $this->_preProcessFired = $this->_postProcessFired = 0; $_config = (require dirname(dirname(__DIR__)) . '/config/web.php'); /** @var \RestController $_controller */ list($_controller, $_actionId) = Pii::app()->createController('rest/user'); try { $_controller->setService('user'); $_service = ServiceHandler::getService($_controller->getService()); $_service->on(PlatformServiceEvents::PRE_PROCESS, function ($event, $eventName, $dispatcher) { $this->assertEquals('user.get.pre_process', $eventName); $this->_preProcessFired = 1; }); $_service->on(PlatformServiceEvents::POST_PROCESS, function ($event, $eventName, $dispatcher) { $this->assertEquals('user.get.post_process', $eventName); $this->_postProcessFired = 1; }); // Test GET $_request = Pii::app()->getRequestObject(); $_request->query->set('app_name', Inflector::neutralize(__CLASS__)); $_request->overrideGlobals(); $_response = $_service->processRequest(null, HttpMethod::GET, false); $this->assertTrue(is_array($_response) && isset($_response['resource'])); $this->assertTrue(1 == $this->_preProcessFired && 1 == $this->_postProcessFired && 1 == $this->_actionEventFired); } catch (\Exception $ex) { RestResponse::sendErrors($ex); } }
* you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ use DreamFactory\Yii\Utility\Pii; /** * @var $this WebController */ $this->pageTitle = Pii::appName(); ?> <div class="container-fluid scrollable"> <?php if (!isset($_SESSION)) { session_start(); } echo '<h2 class="inset">' . $this->pageTitle . ' Environment</h2>'; echo "Session Info: <br />"; echo 'Module: ' . session_module_name() . ' Name: ' . session_name() . ' Id: ' . session_id(); echo "<br /><br />"; echo 'API Version: ' . API_VERSION . "<br />"; echo 'DSP Version: ' . DSP_VERSION . "<br />"; echo 'SQL DB Data Source Name: ' . Yii::app()->db->connectionString . "<br />"; echo "<br /><br />"; ?>
<?php use DreamFactory\Yii\Utility\Pii; use Kisma\Core\Utility\Option; /** * supplies info for the roll your own list */ if (false !== ($_options = Pii::getParam('dashboard.bitnami', false))) { $_featureEnabled = Option::get($_options, 'enabled', false); $_url = Option::get($_options, 'url'); $_wikiUrl = Option::get($_options, 'wiki_url'); if ($_featureEnabled) { $_body = <<<HTML <p>Click the link to launch a DSP using a BitNami stack:<br/> <a target="_blank" href="{$_url}">{$_url}</a></p> <p>More information may be found in the README: <br/> <a target="_blank" href="{$_wikiUrl}">{$_wikiUrl}</a></p> HTML; } else { $_body = <<<HTML <p><strong>This feature is coming soon! Stay tuned!</strong></p> HTML; } return array('id' => 'bitnami', 'title' => 'BitNami', 'body' => $_body); } return array();
/** * Logs in the user using the given username and password in the model. * * @return boolean whether activate is successful */ public function activate() { $_identity = $this->_identity; if (empty($_identity)) { $_identity = new DrupalUserIdentity($this->username, $this->password); if (!$_identity->authenticate()) { $_identity = null; return false; } } if (\CBaseUserIdentity::ERROR_NONE == $_identity->errorCode) { $this->_identity = $_identity; return Pii::user()->login($_identity); } return false; }
/** * @param string $cache Which cache to flush * * @return bool * @throws DreamFactory\Platform\Exceptions\BadRequestException */ public function actionFlush($cache) { $this->layout = false; switch (strtolower($cache)) { case 'platform': Platform::storeDeleteAll(); Pii::flushConfig(); break; case 'swagger': SwaggerManager::clearCache(); break; default: throw new BadRequestException(); } echo json_encode(array('success' => true, 'cache' => $cache)); return Pii::end(); }
/** * @var $this \Cerberus\Yii\Controllers\WebController * @var $models Instance[] */ use DreamFactory\Common\Enums\PageLocation; use DreamFactory\Fabric\Yii\Models\Auth\User; use DreamFactory\Fabric\Yii\Models\Deploy\Instance; use DreamFactory\Yii\Utility\Pii; if (!isset($models) || empty($models)) { $models = array(); } $_html = null; $_pdo = Pii::pdo('db.fabric_auth'); Pii::cssFile('/css/df.datatables.css'); Pii::scriptFile(array('/static/datatables/js/jquery.dataTables.js', '/js/df.datatables.js'), PageLocation::End); foreach ($models as $_model) { if (isset($_model['email_addr_text'])) { $_email = '<a title="Click to view this user in Drupal" target="_blank" href="https://www.dreamfactory.com/user/' . $_model['drupal_id'] . '">' . $_model['email_addr_text'] . '</a>'; $_lastLogin = $_model['last_login_date']; } else { $_email = 'Unknown'; $_lastLogin = '******'; } $_html .= '<tr id="' . $this->hashId($_model['id']) . '">'; $_html .= '<td>' . $_model['instance_name_text'] . '<a title="Click to edit this row" class="pull-right" href="#"><i class="icon-pencil hide edit-row"></i></a></td>'; $_html .= '<td><a title="Click to browse this URL" target="_blank" href="http://' . $_model['public_host_text'] . '">' . $_model['public_host_text'] . '</a></td>'; $_html .= '<td>' . $_email . '</td>'; $_html .= '<td>' . $_model['create_date'] . '</td>'; $_html .= '<td>' . $_lastLogin . '</td>'; $_html .= '</tr>';
/** * @param array $options * @param bool $fromCreate * * @throws DreamFactory\Platform\Exceptions\BadRequestException */ public function actionUpdate($options = array(), $fromCreate = false) { $_id = $_schema = $_errors = null; // New provider if (false !== $fromCreate && null !== ($_resourceId = FilterInput::request('resource'))) { // New request $_model = ResourceStore::model($_resourceId); $_displayName = Inflector::display($_resourceId); $_schema = $this->_loadConfigSchema($_resourceId, $_model->hasAttribute('config_text') ? $_model->config_text : array()); } else { // Requests will come in like: /admin/update/<resource>/<id> list($_resourceId, $_id) = $this->_parseRequest(); $_displayName = Inflector::display($_resourceId); // Load it up. /** @var $_model BasePlatformSystemModel */ if (null !== ($_model = ResourceStore::model($_resourceId)->findByPk($_id))) { $_schema = $this->_loadConfigSchema($_resourceId, $_model->hasAttribute('config_text') ? $_model->config_text : array()); if (Pii::postRequest()) { // On a post, update if (null === ($_data = Option::get($_POST, $_displayName))) { throw new BadRequestException('No payload received.'); } /** @var Provider $_model */ if ($_model->hasAttribute('config_text')) { $_len = strlen(static::SCHEMA_PREFIX); $_config = Option::clean($_model->config_text); foreach ($_data as $_key => $_value) { if (static::SCHEMA_PREFIX == substr($_key, 0, $_len)) { $_newKey = str_replace(static::SCHEMA_PREFIX, null, $_key); if (isset($_config[$_newKey])) { $_config[$_newKey] = $_value; } unset($_data[$_key]); } } $_model->config_text = $_config; unset($_data['config_text']); } $_model->setAttributes($_data); $_model->save(); Pii::setState('status_message', 'Resource Updated Successfully'); $this->redirect('/admin/' . $_resourceId . '/update/' . $_id); } } if ($_model->hasAttribute('name')) { $_displayName = $_model->name; } else { if ($_model->hasAttribute('provider_name')) { $_displayName = $_model->provider_name; } else { if ($_model->hasAttribute('api_name')) { $_displayName = $_model->api_name; } } } } $this->render('update', array('model' => $_model, 'schema' => $_schema, 'errors' => $_errors, 'resourceName' => $_resourceId, 'displayName' => $_displayName, 'update' => null !== $_id)); }
/** * Lists all models. */ public function actionIndex() { Pii::end(); }
<?php use DreamFactory\Yii\Utility\Pii; use Kisma\Core\Utility\Option; /** * supplies info for the roll your own list */ if (false !== ($_options = Pii::getParam('dashboard.amazon_ec2', false))) { $_featureEnabled = Option::get($_options, 'enabled', false); $_ami = Option::get($_options, 'ami'); $_wikiUrl = Option::get($_options, 'wiki_url'); $_launchUrl = str_replace('{{ami}}', $_ami, Option::get($_options, 'launch_url')); if ($_featureEnabled) { $_body = <<<HTML <p>Click the link to launch a DSP using our AMI:<br/><a target="_blank" href="{$_launchUrl}">{$_launchUrl}</a></p> <p>A complete step-by-step tutorial is available in the wiki:<br/> <a target="_blank" href="{$_wikiUrl}">{$_wikiUrl}</a></p> HTML; } else { $_body = <<<HTML <p><strong>This feature is coming soon! Stay tuned!</strong></p> HTML; } return array('id' => 'amazon-ec2', 'title' => 'Amazon EC2', 'body' => $_body); } return array();
/** * Initialize controller and populate request object */ public function init() { parent::init(); $this->_requestObject = Pii::requestObject(); }
} } echo <<<HTML <div class="alert alert-error alert-block alert-fixed fade in" data-alert="alert"> \t<strong>{$_headline}</strong> \t{$_messages}</div> HTML; } if (null !== ($_status = Pii::getState('status_message'))) { echo <<<HTML <div class="alert alert-success alert-block fade in" data-alert="alert"> \t<strong>Success!</strong><br/> \t{$_status} </div> HTML; Pii::clearState('status_message'); } $_hashedId = $model->isNewRecord ? null : $this->hashId($model->id); $_form = new BootstrapForm(Bootstrap::Horizontal, array('id' => 'update-resource', 'method' => 'POST', 'x_editable_url' => '/admin/' . $resourceName . '/update', 'x_editable_pk' => $_hashedId, 'prefix' => $_prefix)); // Make sure the renderer removes these... $_form->setRemovePrefix(ConsoleController::SCHEMA_PREFIX); $_form->setFormData($model->getAttributes()); $_fields = array('Basic Settings' => array('api_name' => array('type' => 'text', 'class' => $model->isNewRecord ? 'required' : 'uneditable-input', 'placeholder' => 'How to address this provider via REST', 'hint' => 'The URI portion to be used when calling this provider. For example: "github", or "facebook".', 'maxlength' => 64), 'provider_name' => array('type' => 'text', 'class' => 'required' . ($_update ? ' x-editable' : null), 'hint' => 'The real name, or "display" name for this provider.', 'maxlength' => 64)), 'Configuration' => $schema, 'Metrics' => array('created_date' => array('type' => 'text', 'class' => 'uneditable-input'), 'last_modified_date' => array('type' => 'text', 'class' => 'uneditable-input'))); ?> <div class="row-fluid" style="border-bottom:1px solid #ddd"> <div class="pull-right"> <h2 style="margin-bottom: 0"><?php echo $displayName; ?> <small><?php echo $_update ? 'Edit' : 'New';
* See the License for the specific language governing permissions and * limitations under the License. */ use DreamFactory\Yii\Utility\Pii; use DreamFactory\Yii\Utility\Validate; use Kisma\Core\Utility\Option; /** * @var WebController $this * @var ProfileForm $model * @var CActiveForm $form * @var string $backUrl * @var array $session */ Validate::register('form#profile-form', array('ignoreTitle' => true, 'errorClass' => 'error', 'errorPlacement' => 'function(error,element){error.appendTo(element.closest("div.form-group"));}', 'rules' => array('ProfileForm[email]' => array('required' => true, 'email' => true), 'ProfileForm[first_name]' => array('required' => true, 'minlength' => 3), 'ProfileForm[last_name]' => array('required' => true, 'minlength' => 3), 'ProfileForm[display_name]' => array('required' => true, 'minlength' => 6)))); CHtml::$errorSummaryCss = 'alert alert-danger'; if (null !== ($_flash = Pii::getFlash('profile-form'))) { $_flash = <<<HTML <div class="alert alert-success"> \t{$_flash} </div> HTML; } $_appOptions = '<option name="ProfileForm[default_app_id]" value="0">None</option>'; if (isset($session)) { $_defaultAppId = Option::get($session, 'default_app_id', 0); /** @var array $_app */ foreach ($session['allowed_apps'] as $_app) { $_selected = $_app['id'] == $_defaultAppId; $_appOptions .= '<option name="ProfileForm[default_app_id]" value="' . $_app['id'] . '"' . ($_selected ? ' selected="selected" ' : null) . '>' . $_app['api_name'] . '</option>'; } }
<?php /** * @var array $resourceColumns */ use DreamFactory\Common\Enums\PageLocation; use DreamFactory\Platform\Enums\ResponseFormats; use DreamFactory\Yii\Utility\Pii; use Kisma\Core\Utility\Inflector; use Kisma\Core\Utility\Option; $_state = $_content = $_tabs = null; Pii::scriptFile('/js/df.datatables.js', PageLocation::End); //if ( null !== ( $_state = Pii::getState( 'admin.state' ) ) ) $_state = array(); $_class = ' class="active"'; foreach ($resourceColumns as $_resource => $_config) { $_html = '<h3>Coming Soon!</h3>'; $_buttons = $_labels = null; $_active = $_resource == 'app' ? ' active' : null; // Get/create a menu name $_menuName = Option::get($_config, 'menu_name', Option::get($_config, 'header', Inflector::pluralize($_config['resource']))); if (isset($_config['labels']) && !empty($_config['labels'])) { $_id = 'tab-' . $_resource; $_count = 0; foreach ($_config['labels'] as $_label) { $_labels .= '<th>' . $_label . '</th>'; $_count++; } if (null !== ($_displayName = Option::get($_config, 'display_name'))) { $_buttons = '<button class="btn btn-success" id="create-' . $_resource . '">Add ' . $_displayName . '</button>'; }
* * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ use DreamFactory\Yii\Utility\Pii; /** * aliases.config.php * A single location for all your aliasing needs! */ $_libPath = dirname(dirname(__DIR__)); $_vendorPath = $_libPath . '/vendor'; Pii::setPathOfAlias('vendor', $_vendorPath); // lib-php-common-yii Pii::alias('DreamFactory.Yii.*', $_vendorPath . '/dreamfactory/lib-php-common-yii/DreamFactory/Yii'); Pii::alias('DreamFactory.Yii.Components', $_vendorPath . '/dreamfactory/lib-php-common-yii/DreamFactory/Yii/Components'); Pii::alias('DreamFactory.Yii.Behaviors', $_vendorPath . '/dreamfactory/lib-php-common-yii/DreamFactory/Yii/Behaviors'); Pii::alias('DreamFactory.Yii.Utility', $_vendorPath . '/dreamfactory/lib-php-common-yii/DreamFactory/Yii/Utility'); Pii::alias('DreamFactory.Yii.Logging', $_vendorPath . '/dreamfactory/lib-php-common-yii/DreamFactory/Yii/Logging'); // lib-php-common-platform Pii::alias('DreamFactory.Platform.Services', $_libPath . '/Services'); Pii::alias('DreamFactory.Platform.Services.Portal', $_libPath . '/Services/Portal'); Pii::alias('DreamFactory.Platform.Yii.Behaviors', $_libPath . '/Yii/Behaviors'); Pii::alias('DreamFactory.Platform.Yii.Models', $_libPath . '/Yii/Models'); // Vendors Pii::alias('Swift', $_vendorPath . '/swiftmailer/swiftmailer/lib/classes');
if (!empty($_envConfig) && is_array($_envConfig)) { foreach ($_envConfig as $_key => $_value) { if (!is_string($_value)) { $_value = json_encode($_value); } if (false === putenv($_key . '=' . $_value)) { Log::error('Error setting environment variable: ' . $_key . ' = ' . $_value); } } } } /** * Load up the database configuration, free edition, private hosted, or others. * Look for non-default database config to override. */ if (false === ($_dbConfig = Pii::includeIfExists(__DIR__ . DATABASE_CONFIG_PATH, true))) { if (Fabric::fabricHosted()) { $_fabricHosted = true; list($_dbConfig, $_metadata) = Fabric::initialize(); } else { /** * Database names vary by type of DSP: * * 1. Free Edition/Hosted: DSP name * 2. Hosted Private: hpp_<DSP Name> * 3. All others: dreamfactory or whatever is in non-default config. */ if (false !== ($_host = Fabric::hostedPrivatePlatform(true))) { $_dbName = 'hpp_' . str_ireplace(array('.dreamfactory.com', '-', '.cloud', '.'), array(null, '_', null, '_'), $_host); } else { $_dbName = 'dreamfactory';
/** * @covers DreamFactory\Platform\Utility\Platform::getStoragePath() */ public function testGetLibraryPath() { $_control = Pii::getParam(LocalStorageTypes::LIBRARY_PATH); $this->assertEquals($_control, Platform::getLibraryPath()); }
$_logFileName = basename(\Kisma::get('app.log_file_name')); // Finally the name of our app $_appName = 'DreamFactory Services Platform'; // Ensure the assets path exists so Yii doesn't puke. $_assetsPath = $_docRoot . '/assets'; if (!is_dir($_assetsPath)) { @mkdir($_assetsPath, 0777, true); } /** * Keys and salts */ $_dspSalts = array(); // Load some keys $_keys = Pii::includeIfExists(__DIR__ . KEYS_CONFIG_PATH, true) ?: array(); /** @noinspection PhpIncludeInspection */ if (false !== ($_salts = Pii::includeIfExists(__DIR__ . SALT_CONFIG_PATH, true))) { if (!empty($_salts)) { foreach ($_salts as $_key => $_salt) { if ($_salt) { $_dspSalts['dsp.salts.' . $_key] = $_salt; } } } unset($_salts); } /** * Application Paths */ \Kisma::set(array('app.app_name' => $_appName, 'app.project_root' => $_basePath, 'app.vendor_path' => $_vendorPath, 'app.log_path' => $_logFilePath, 'app.log_file_name' => $_logFileName, 'app.install_type' => array($_installType => $_installName), 'app.fabric_hosted' => $_fabricHosted, 'app.doc_root' => $_docRoot)); /** * Database Caching
// Start path given or this file's directory $_path = __DIR__; while (true) { $_path = rtrim($_path, ' /'); if (file_exists($_path . '/vendor/autoload.php')) { break; } if (file_exists($_path . '/.dreamfactory.php') && is_dir($_path . '/storage/.private')) { break; } // Too low, go up a level $_path = dirname($_path); // If we get to the root, ain't no DSP... if ('/' == $_path || empty($_path)) { $_path = false; break; } } if (false === $_path) { throw new RuntimeException('DreamFactory installation not found. Cannot load app.'); } /** @noinspection PhpIncludeInspection */ $_autoloader = (require $_path . '/vendor/autoload.php'); /** @noinspection PhpIncludeInspection */ require $_path . '/vendor/dreamfactory/yii/framework/yiilite.php'; // Comment both lines to disable debug mode ini_set('display_errors', 1); defined('YII_DEBUG') or define('YII_DEBUG', true); // Create the application but do not run... Pii::run(__DIR__ . '/src', $_autoloader, 'DreamFactory\\Platform\\Yii\\Components\\PlatformWebApplication', $_path . '/config/web.php', false, false);
*/ const DSP_DEBUG = false; /** * @type bool Global PHP-ERROR flag: If true, PHP-ERROR will be utilized if available. See https://github.com/JosephLenton/PHP-Error for more info. */ const DSP_DEBUG_PHP_ERROR = false; $_class = 'DreamFactory\\Platform\\Yii\\Components\\Platform' . ('cli' == PHP_SAPI ? 'Console' : 'Web') . 'Application'; /** * Debug-level output based on constant value above * For production mode, you'll want to set the above constants to FALSE * Get this turned on before anything is loaded */ if (DSP_DEBUG) { ini_set('display_errors', true); ini_set('error_reporting', -1); defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3); } // Load up composer... $_autoloader = (require_once __DIR__ . '/../vendor/autoload.php'); // Load up Yii if it's not been already if (!class_exists('\\Yii', false)) { require_once __DIR__ . '/../vendor/dreamfactory/yii/framework/yiilite.php'; } // php-error utility if (DSP_DEBUG_PHP_ERROR && function_exists('reportErrors')) { reportErrors(); } // Create the application and run. This doe not return until the request is complete. Pii::run(__DIR__, $_autoloader, $_class);
<?php use DreamFactory\Yii\Utility\Pii; use Kisma\Core\Utility\Option; /** * supplies info for the roll your own list */ if (false !== ($_options = Pii::getParam('dashboard.vmware', false))) { $_featureEnabled = Option::get($_options, 'enabled', false); $_wikiUrl = Option::get($_options, 'wiki_url'); $_launchUrl = Option::get($_options, 'launch_url'); if ($_featureEnabled) { $_body = <<<HTML <p>Our VMWare appliance is available at <a target="_blank" href="{$_launchUrl}">{$_launchUrl}</a>.</p> <p>More information is available here:<br/> <a target="_blank" href="{$_wikiUrl}">{$_wikiUrl}</a></p> HTML; } else { $_body = <<<HTML <p><strong>This feature is coming soon! Stay tuned!</strong></p> HTML; } return array('id' => 'vmware', 'title' => 'VMWare Appliance', 'body' => $_body); } return array();
<?php use DreamFactory\Yii\Utility\Pii; use Kisma\Core\Utility\Option; /** * supplies info for the roll your own list */ if (false !== ($_options = Pii::getParam('dashboard.rackspace', false))) { $_featureEnabled = Option::get($_options, 'enabled', false); if ($_featureEnabled) { $_body = <<<HTML <p>Rackspace has no specific image. Instead, install one of our pre-built packages! For Redhat or CentOS flavors, \t\t\t\tsee our <a href="http://wiki.dreamfactory.com/wiki/Packages/Rpm" target="_blank">installation guide</a>. We also have one for Debian/Ubuntu systems <a \t\thref="http://wiki.dreamfactory.com/wiki/Packages/Deb" target="_blank">here</a>.</p> HTML; } else { $_body = <<<HTML <p><strong>This feature is coming soon! Stay tuned!</strong></p> HTML; } return array('id' => 'rackspace', 'title' => 'Rackspace', 'body' => $_body); } return array();
use Kisma\Core\Utility\Curl; use Kisma\Core\Utility\HtmlMarkup; use Kisma\Core\Utility\Inflector; //************************************************************************* // Constants //************************************************************************* /** * @type string */ const APPLICATION_NAME = 'portal-sandbox'; //******************************************************************************** //* Bootstrap and Debugging //******************************************************************************** require dirname(__DIR__) . '/autoload.php'; // Must be logged in... if (Pii::guest()) { header('Location: /web/login'); die; } //******************************************************************************** //* Load data for drop-downs... //******************************************************************************** $_apps = $_providers = null; $_providerCache = new \stdClass(); $_models = ResourceStore::model('app')->findAll(array('select' => 'id, api_name, name', 'order' => 'name')); if (!empty($_models)) { /** @var App[] $_models */ foreach ($_models as $_model) { $_attributes = array('value' => $_model->api_name, 'name' => $_model->api_name); if (APPLICATION_NAME == $_model->api_name) { $_attributes['selected'] = 'selected';
// Log::debug( 'login providers: ' . print_r( $loginProviders, true ) ); foreach ($loginProviders as $_provider) { if (!$_provider['is_active'] || !$_provider['is_login_provider']) { continue; } $_icon = $_providerType = strtolower($_provider['provider_name']); // Google icon has a different name if ('google' == $_icon) { $_icon = 'google-plus'; } $_providerHtml .= '<i class="fa fa-' . $_icon . ' fa-3x" data-provider="' . $_providerType . '"></i>'; } $_providerHider = !empty($_providerHtml) ? null : ' hide '; } CHtml::$errorSummaryCss = 'alert alert-danger'; if (null !== ($_flash = Pii::getFlash('login-form'))) { $_flash = <<<HTML <div class="alert alert-success"> \t{$_flash} </div> HTML; } ?> <div class="box-wrapper"> <div id="formbox" class="form-light boxed drop-shadow lifted"> <h2 class="inset">User Login</h2> <h4>Please sign in to continue</h4> <?php echo $_flash; ?>
/** * @param PlatformEvent|array $event * * @return array */ public static function buildRequestArray($event = null) { $reqObj = Pii::request(false); $data = $event ? is_array($event) ? $event : $event->getRequestData() : null; $request = ['method' => strtoupper($reqObj->getMethod()), 'headers' => $reqObj->headers->all(), 'cookies' => $reqObj->cookies->all(), 'query' => $reqObj->query->all(), 'body' => $data, 'files' => false]; $files = $reqObj->files->all(); if (!empty($files)) { $request['files'] = $files; } return $request; }
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ use DreamFactory\Yii\Utility\Pii; use DreamFactory\Yii\Utility\Validate; /** * @var WebController $this * @var ActivateForm $model * @var CActiveForm $form */ Validate::register('form#activate-form', array('ignoreTitle' => true, 'errorClass' => 'error', 'errorPlacement' => 'function(error,element){error.appendTo(element.closest("div.form-group"));}', 'rules' => array('ActivateForm[username]' => 'required email', 'ActivateForm[password]' => array('required' => true, 'minlength' => 3)), 'messages' => array('ActivateForm[username]' => 'Please enter an actual email address', 'ActivateForm[password]' => array('required' => 'You must enter a password to continue', 'minlength' => 'Your password must be at least 3 characters long')))); CHtml::$errorSummaryCss = 'alert alert-danger'; if (null !== ($_flash = Pii::getFlash('activate-form'))) { $_flash = <<<HTML <div class="alert alert-success"> \t{$_flash} </div> HTML; } ?> <div class="box-wrapper"> <div id="formbox" class="form-light boxed drop-shadow lifted"> <h2 class="inset">Activation Required</h2> <h4 style="text-align: left;">To activate this DSP, please enter your email and password from the main <a target="_blank" href="https://www.dreamfactory.com">DreamFactory site</a>. </h4> <h4 style="text-align:left;">You will automatically be made an admin user of this DSP. This user can be modified, and more users can be added, once your DSP is activated.</h4>
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... $_css = '<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700,800" rel="stylesheet" type="text/css">';