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');
 }
Ejemplo n.º 2
0
 /**
  * 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];
 }
Ejemplo n.º 3
0
 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');
 }
 /**
  * Add a source of settings. For all these observers, we notify
  * when to update
  *
  * @param Services_Settings_IContainer $source
  */
 public function addSource(Services_Settings_IContainer $source)
 {
     self::$_sources[] = $source;
     self::$_settings = array_merge(self::$_settings, $source->getAllSettings());
     /*
      * When no specific NNTP header / comments server is entered, we override these with the NZB server
      * header. This allows us to always assume those are entered by the user.
      */
     if (empty(self::$_settings['nntp_hdr']['host']) && !empty(self::$_settings['nntp_nzb'])) {
         self::$_settings['nntp_hdr'] = self::$_settings['nntp_nzb'];
     }
     # if
     # Same for the NNTP upload server
     if (empty(self::$_settings['nntp_post']['host']) && !empty(self::$_settings['nntp_nzb'])) {
         self::$_settings['nntp_post'] = self::$_settings['nntp_nzb'];
     }
     # if
 }
Ejemplo n.º 5
0
 /**
  * Bootup the settings system
  */
 public function getSettings(Dao_Factory $daoFactory, $requireDb)
 {
     $settingsContainer = Services_Settings_Container::singleton();
     /**
      * Add a database source
      */
     try {
         $dbSource = new Services_Settings_DbContainer();
         $dbSource->initialize(array('dao' => $daoFactory->getSettingDao()));
         $settingsContainer->addSource($dbSource);
     } catch (Exception $x) {
         if ($requireDb) {
             throw $x;
         }
         # if
     }
     # catch
     /**
      * Add the file (ownsettings.php etc) source to override settings
      */
     require "settings.php";
     $fileSource = new Services_Settings_FileContainer();
     $fileSource->initialize($settings);
     $settingsContainer->addSource($fileSource);
     return $settingsContainer;
 }
Ejemplo n.º 6
0
 function settingsValid()
 {
     # Is our settings list still valid?
     return $this->_settings->get('settingsversion') == SPOTWEB_SETTINGS_VERSION;
 }
Ejemplo n.º 7
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']);
 }