예제 #1
0
 /**
  * Returns the current context.
  *
  * @param \Aimeos\MW\Config\Iface Configuration object
  * @return MShop_Context_Item_Interface Context object
  */
 public static function getContext(\Aimeos\MW\Config\Iface $config)
 {
     if (self::$context === null) {
         $context = new \Aimeos\MShop\Context\Item\Typo3();
         $context->setConfig($config);
         $dbm = new \Aimeos\MW\DB\Manager\PDO($config);
         $context->setDatabaseManager($dbm);
         $fsm = new \Aimeos\MW\Filesystem\Manager\Standard($config);
         $context->setFilesystemManager($fsm);
         $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context);
         $context->setLogger($logger);
         $cache = self::getCache($context);
         $context->setCache($cache);
         $mailer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
         $context->setMail(new \Aimeos\MW\Mail\Typo3($mailer));
         if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('saltedpasswords') && \TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled('FE')) {
             $object = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance();
             $context->setHasherTypo3($object);
         }
         if (isset($GLOBALS['TSFE']->fe_user)) {
             $session = new \Aimeos\MW\Session\Typo3($GLOBALS['TSFE']->fe_user);
         } else {
             $session = new \Aimeos\MW\Session\None();
         }
         $context->setSession($session);
         self::$context = $context;
     }
     self::$context->setConfig($config);
     return self::$context;
 }
예제 #2
0
 /**
  * Returns the current context
  *
  * @param \Aimeos\MW\Config\Iface Configuration object
  * @return \Aimeos\MShop\Context\Item\Iface Context object
  */
 public static function get(\Aimeos\MW\Config\Iface $config)
 {
     if (self::$context === null) {
         // TYPO3 specifc context with password hasher
         $context = new \Aimeos\MShop\Context\Item\Typo3();
         $context->setConfig($config);
         self::addDataBaseManager($context);
         self::addFilesystemManager($context);
         self::addMessageQueueManager($context);
         self::addLogger($context);
         self::addCache($context);
         self::addMailer($context);
         self::addSession($context);
         self::addHasher($context);
         self::addUser($context);
         self::addGroups($context);
         self::$context = $context;
     }
     // Use local TS configuration from plugins
     self::$context->setConfig($config);
     return self::$context;
 }