public function check($credentials, array $options = array()) { // This enables PHPBB login: global $phpbb_root_path, $phpEx, $user, $auth, $template, $cache, $db, $config; define('IN_PHPBB', true); $phpbb_root_path = \app\util\Config::get('forum_path'); $phpEx = substr(strrchr(__FILE__, '.'), 1); include $phpbb_root_path . 'common.' . $phpEx; // creates $user and $auth objects here. $user->session_begin(); $logged_in = $user->data['is_registered']; $username = strtolower($user->data['username_clean']); if ($logged_in === false) { // Not Logged In return false; } $model = $this->_model; $query = $this->_query; $conditions = $this->_scope + array('prv_uid' => $username); $id = $model::$query(compact('conditions')); if (!$id) { \lithium\storage\Session::write('non_linked_phpbb_login', true); } return $id; }
public function index() { if (!isset($this->CURRENT_USER)) { $this->flashMessage('You must log in to visit your shopping cart.', array('alertType' => 'error')); return $this->redirect('/'); } $cart = $this->CURRENT_USER->getShoppingCart(); if (!isset($cart)) { $this->flashMessage('No shopping cart found.', array('alertType' => 'error')); return $this->redirect('/'); } $cart_items = $cart->getItems(); $paypal_config = Config::get('paypal'); return compact('cart', 'cart_items', 'paypal_config'); }
public function login() { $result = Auth::check($this->request->adapter, $this->request); $redirectUrl = $this->request->env('HTTP_REFERER') ?: '/'; if ($result) { # Convert array to identity object if ($this->request->adapter === 'password') { $result = Identities::find($result['_id']); } $session_data = array(); $new_session = uniqid(); if (isset($result['session']['id'])) { $session_data['id'] = (array) $result['session']['id']->data(); } else { $session_data['id'] = array(); } // Remember users for two weeks $session_data['expires'] = time() + \app\util\Config::get('session_length', 7) * 24 * 60 * 60; array_push($session_data['id'], $new_session); setcookie('session.id', $new_session, $session_data['expires'], '/', $_SERVER['HTTP_HOST']); $result->save(array('session' => $session_data)); Auth::set('any', $result); } else { $addendum = ''; // Adapter-specific error messages if ($this->request->adapter == 'phpbb') { if (Session::read('non_linked_phpbb_login')) { Session::delete('non_linked_phpbb_login'); $addendum = 'You are logged into the forums, but there is no leagues account associated with with your forum account.'; } else { $addendum = 'Please ensure that you are logged into the <a href="http://www.afdc.com/forum/">forums</a>.'; } } else { Logger::debug("Failed login for " . $this->request->data['email'] . " with password " . $this->request->data["password"]); } $error_message = 'Your login was unsuccessful. '; if (isset($addendum) and !empty($addendum)) { $error_message .= "<br />{$addendum}`<br />"; } $error_message .= 'If you\'re having trouble, checkout the <a href="/help/login">login instructions</a>.'; $this->flashMessage($error_message, array('alertType' => 'error')); } return $this->redirect($redirectUrl); }
use lithium\core\Environment; use lithium\action\Dispatcher; use app\util\Config; /** * This filter intercepts the `run()` method of the `Dispatcher`, and first passes the `'request'` * parameter (an instance of the `Request` object) to the `Environment` class to detect which * environment the application is running in. Then, loads all application routes in all plugins, * loading the default application routes last. * * Change this code if plugin routes must be loaded in a specific order (i.e. not the same order as * the plugins are added in your bootstrap configuration), or if application routes must be loaded * first (in which case the default catch-all routes should be removed). * * If `Dispatcher::run()` is called multiple times in the course of a single request, change the * `include`s to `include_once`. * * @see lithium\action\Request * @see lithium\core\Environment * @see lithium\net\http\Router */ Dispatcher::applyFilter('run', function ($self, $params, $chain) { Environment::set(Config::get('environment', $params['request'])); foreach (array_reverse(Libraries::get()) as $name => $config) { if ($name === 'lithium') { continue; } $file = "{$config['path']}/config/routes.php"; file_exists($file) ? include $file : null; } return $chain->next($self, $params, $chain); });
* As with other `Adaptable`-based configurations, each database configuration is defined by a name, * and an array of information detailing what database adapter to use, and how to connect to the * database server. Unlike when configuring other classes, `Connections` uses two keys to determine * which class to select. First is the `'type'` key, which specifies the type of backend to * connect to. For relational databases, the type is set to `'database'`. For HTTP-based backends, * like CouchDB, the type is `'http'`. Some backends have no type grouping, like MongoDB, which is * unique and connects via a custom PECL extension. In this case, the type is set to `'MongoDb'`, * and no `'adapter'` key is specified. In other cases, the `'adapter'` key identifies the unique * adapter of the given type, i.e. `'MySql'` for the `'database'` type, or `'CouchDb'` for the * `'http'` type. Note that while adapters are always specified in CamelCase form, types are * specified either in CamelCase form, or in underscored form, depending on whether an `'adapter'` * key is specified. See the examples below for more details. * * ### Multiple environments * * As with other `Adaptable` classes, `Connections` supports optionally specifying different * configurations per named connection, depending on the current environment. For information on * specifying environment-based configurations, see the `Environment` class. * * @see lithium\core\Adaptable * @see lithium\core\Environment */ use lithium\data\Connections; /** * Uncomment this configuration to use MongoDB as your default database. */ Connections::add('default', array('type' => 'MongoDb', 'host' => \app\util\Config::get('mongo.server'), 'database' => \app\util\Config::get('mongo.database'), 'classes' => array('entity' => 'app\\extensions\\data\\Document'))); // Connections::get("default")->applyFilter("update", function($self, $params, $chain) { // var_dump($params['query']); die; // return $chain->next($self, $params, $chain); // });
"minuteStep": 30, "showMeridian": true, "modalBackdrop": true, "defaultTime": "value" }); $("div.uneditable-input").each(function(){ if ($(this).data('value')) { $(this).text($(this).data('value')); } }); }); </script> <?php $googleAnalytics = \app\util\Config::get('google_analytics'); ?> <?php if (isset($googleAnalytics)) { ?> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', '<?php echo $googleAnalytics['account']; ?> ']); <?php if (isset($googleAnalytics['domain'])) { ?> _gaq.push(['_setDomainName', '<?php echo $googleAnalytics['domain'];
* alongside the normal registration data in the registration collection */ require __DIR__ . '/bootstrap/modules.php'; /** * This file contains your application's globalization rules, including inflections, * transliterations, localized validation, and how localized text should be loaded. Uncomment this * line if you plan to globalize your site. */ // require __DIR__ . '/bootstrap/g11n.php'; /** * This file contains configurations for handling different content types within the framework, * including converting data to and from different formats, and handling static media assets. */ require __DIR__ . '/bootstrap/media.php'; /** * This file configures console filters and settings, specifically output behavior and coloring. */ if (PHP_SAPI === 'cli') { require __DIR__ . '/bootstrap/console.php'; } $paypal_config = \app\util\Config::get('paypal'); \app\util\Paypal::config($paypal_config['nvp']); $mailchimp_config = \app\util\Config::get('mailchimp'); $MCAPI = new \app\extensions\helper\MCAPI($mailchimp_config['api-key']); if (isset($_COOKIE['session_id'])) { $login_identity = Identities::first(array('conditions' => array('session.id' => $_COOKIE['session_id'], 'session.expires' => array('$gte' => time())))); if ($login_identity) { $login_identity->save(array('session.expires' => time() + \app\util\Config::get('session_length', 7) * 24 * 60 * 60)); Auth::set('any', $login_identity); } }