private static function getUser() { if (!isset(self::$_user)) { self::$_user = User::getLoggedIn(); } return self::$_user; }
public static function __bootstrap() { Model::register('user'); if (User::getLoggedIn()) { return true; } $user = new UserModel(); $user->verifyCookie(false); return true; }
public static function __bootstrap() { Model::register('user'); if (($user = User::getLoggedIn()) && $user->getDebug()) { $config = Config::getInstance(); $config->debug = true; if (!in_array('Debugger', $config->documentProcessors['html'])) { $config->documentProcessors['html'][] = 'Debugger'; } } return true; }
public static function mergeUserToClient() { Model::register('user'); Model::register('shop'); if ($user = User::getLoggedIn()) { // Do we have a saved cart for logged in user? $userCart = new CartModel(); if ($userCart->loadByUser($user)) { // Do we have a saved cart for client? $clientCart = new CartModel(); if ($clientCart->loadByClient() === false) { $clientCart->client = md5($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']); $clientCart->insert(); } foreach ($userCart->getItems() as $item) { /* @var $item Ajde_Shop_Cart_Item */ $clientCart->addItem($item->getEntity(), null, $item->getQty()); } $userCart->delete(); } } }