Ejemplo n.º 1
0
 function initialize()
 {
     // For various reasons this gets squished
     global $tldTree;
     if (empty($tldTree)) {
         if (!empty(self::$_thetree)) {
             $tldTree = self::$_thetree;
         }
     }
     $nickname = StatusNet::currentSite();
     if (empty($nickname)) {
         $this->log(LOG_WARNING, "No current site");
         return;
     }
     try {
         $sn = Status_network::staticGet('nickname', $nickname);
     } catch (Exception $e) {
         $this->log(LOG_ERR, $e->getMessage());
         return;
     }
     $tags = $sn->getTags();
     foreach ($tags as $tag) {
         if (strncmp($tag, 'domain=', 7) == 0) {
             $domain = substr($tag, 7);
             $this->log(LOG_INFO, "Setting email domain to {$domain}");
             common_config_append('email', 'whitelist', $domain);
         }
     }
 }
Ejemplo n.º 2
0
Archivo: doc.php Proyecto: himmelex/NTW
 function getFilename()
 {
     $localDef = null;
     $local = null;
     $site = StatusNet::currentSite();
     if (!empty($site) && file_exists(INSTALLDIR . '/local/doc-src/' . $site . '/' . $this->title)) {
         $localDef = INSTALLDIR . '/local/doc-src/' . $site . '/' . $this->title;
         $local = glob(INSTALLDIR . '/local/doc-src/' . $site . '/' . $this->title . '.*');
         if ($local === false) {
             // Some systems return false, others array(), if dir didn't exist.
             $local = array();
         }
     } else {
         if (file_exists(INSTALLDIR . '/local/doc-src/' . $this->title)) {
             $localDef = INSTALLDIR . '/local/doc-src/' . $this->title;
         }
         $local = glob(INSTALLDIR . '/local/doc-src/' . $this->title . '.*');
         if ($local === false) {
             $local = array();
         }
     }
     if (count($local) || isset($localDef)) {
         return $this->negotiateLanguage($local, $localDef);
     }
     if (file_exists(INSTALLDIR . '/doc-src/' . $this->title)) {
         $distDef = INSTALLDIR . '/doc-src/' . $this->title;
     }
     $dist = glob(INSTALLDIR . '/doc-src/' . $this->title . '.*');
     if ($dist === false) {
         $dist = array();
     }
     if (count($dist) || isset($distDef)) {
         return $this->negotiateLanguage($dist, $distDef);
     }
     return null;
 }
Ejemplo n.º 3
0
 /**
  * Make sure we're on the right site configuration
  */
 protected function switchSite()
 {
     if ($this->site != StatusNet::currentSite()) {
         common_log(LOG_DEBUG, __METHOD__ . ": switching to site {$this->site}");
         $this->stats('switch');
         StatusNet::switchSite($this->site);
     }
 }
Ejemplo n.º 4
0
 /**
  * Change site configuration to site specified by nickname,
  * if set up via Status_network. If not, sites other than
  * the current will fail horribly.
  *
  * May throw exception or trigger a fatal error if the given
  * site is missing or configured incorrectly.
  *
  * @param string $nickname
  */
 public static function switchSite($nickname)
 {
     if ($nickname == StatusNet::currentSite()) {
         return true;
     }
     $sn = Status_network::staticGet('nickname', $nickname);
     if (empty($sn)) {
         return false;
         throw new Exception("No such site nickname '{$nickname}'");
     }
     $server = $sn->getServerName();
     StatusNet::init($server);
 }
Ejemplo n.º 5
0
 /**
  * Combines the queue_basename from configuration with the
  * group name for this queue to give eg:
  *
  * /queue/statusnet/main
  * /queue/statusnet/main/distrib
  * /queue/statusnet/xmpp/xmppout/site01
  *
  * @param string $queue
  * @return string
  */
 protected function queueName($queue)
 {
     $group = $this->queueGroup($queue);
     $site = StatusNet::currentSite();
     $specs = array("{$group}/{$queue}/{$site}", "{$group}/{$queue}");
     foreach ($specs as $spec) {
         if (in_array($spec, $this->breakout)) {
             return $this->base . $spec;
         }
     }
     return $this->base . $group;
 }
Ejemplo n.º 6
0
 static function mailPaths()
 {
     $paths = array(INSTALLDIR . '/local/mail-src/', INSTALLDIR . '/mail-src/');
     $site = StatusNet::currentSite();
     if (!empty($site)) {
         array_unshift($paths, INSTALLDIR . '/local/mail-src/' . $site . '/');
     }
     return $paths;
 }