public function __construct(Services_Settings_Container $settings, Dao_Cache $cacheDao)
 {
     $this->_settings = $settings;
     $this->_cacheDao = $cacheDao;
     $this->_clientId = $settings->get('ms_translator_clientid');
     $this->_clientSecret = $settings->get('ms_translator_clientsecret');
 }
 /**
  * Returns an Sevice_Nntp_Engine but tries to minimize
  * the amount of different objects and hence connections 
  * which are created by issueing existing NNTP engines
  * when possible
  *
  * @returns Services_Nntp_Engine Instance of Services_NNTP_Engine
  */
 public static function pool(Services_Settings_Container $settings, $type)
 {
     SpotDebug::msg(SpotDebug::DEBUG, __CLASS__ . '::pool:(' . $type . ') called');
     if (isset(self::$_instances[$type])) {
         return self::$_instances[$type];
     }
     # if
     /*
      * Make sure we have a valid NNTP configuration
      */
     $settings_nntp_hdr = $settings->get('nntp_hdr');
     if (empty($settings_nntp_hdr)) {
         throw new MissingNntpConfigurationException();
     }
     # if
     /*
      * Retrieve the NNTP header settings we can validate those
      */
     switch ($type) {
         case 'hdr':
             self::$_instances[$type] = new Services_Nntp_Engine($settings_nntp_hdr);
             break;
         case 'bin':
             $settings_nntp_bin = $settings->get('nntp_nzb');
             if (empty($settings_nntp_bin['host'])) {
                 self::$_instances[$type] = self::pool($settings, 'hdr');
             } else {
                 self::$_instances[$type] = new Services_Nntp_Engine($settings_nntp_bin);
             }
             # else
             break;
             # nzb
         # nzb
         case 'post':
             $settings_nntp_post = $settings->get('nntp_post');
             if (empty($settings_nntp_post['host'])) {
                 self::$_instances[$type] = self::pool($settings, 'hdr');
             } else {
                 self::$_instances[$type] = new Services_Nntp_Engine($settings_nntp_post);
             }
             # else
             break;
             # post
         # post
         default:
             throw new Exception("Unknown NNTP type engine (" . $type . ") for pool creation");
     }
     # switch
     return self::$_instances[$type];
 }
 function __construct(Dao_Factory $daoFactory, Services_Settings_Container $settings, $force, $retro)
 {
     $this->_daoFactory = $daoFactory;
     $this->_settings = $settings;
     $this->_retro = $retro;
     $this->_force = $force;
     $this->_textServer = $settings->get('nntp_hdr');
     $this->_binServer = $settings->get('nntp_nzb');
     /*
      * Create the specific DAO objects
      */
     $this->_usenetStateDao = $daoFactory->getUsenetStateDao();
     $this->_usenetStateDao->initialize();
     /*
      * Create the service objects for both the NNTP binary group and the
      * textnews group. We only create a basic NNTP_Engine object, but we 
      * don't create any higher level objects
      */
     $this->_svcNntpText = Services_Nntp_EnginePool::pool($this->_settings, 'hdr');
     $this->_svcNntpBin = Services_Nntp_EnginePool::pool($this->_settings, 'bin');
 }
 function settingsValid()
 {
     # Is our settings list still valid?
     return $this->_settings->get('settingsversion') == SPOTWEB_SETTINGS_VERSION;
 }
Example #5
0
 function __construct(Dao_User $userDao, Dao_Audit $auditDao, Services_Settings_Container $settings, array $user, $ipaddr)
 {
     $this->_userDao = $userDao;
     $this->_user = $user;
     $this->_settings = $settings;
     $this->_failAudit = $settings->get('auditlevel') == SpotSecurity::spot_secaudit_failure;
     $this->_allAudit = $settings->get('auditlevel') == SpotSecurity::spot_secaudit_all;
     if ($this->_failAudit || $this->_allAudit) {
         $this->_spotAudit = new SpotAudit($auditDao, $settings, $user, $ipaddr);
     }
     # if
     $this->_permissions = $userDao->getPermissions($user['userid']);
 }