Esempio n. 1
0
 public function request($url, $params = array())
 {
     if (empty(\GO::config()->serverclient_server_url)) {
         \GO::config()->serverclient_server_url = \GO::config()->full_url;
     }
     $url = \GO::config()->serverclient_server_url . '?r=' . $url;
     if (empty(\GO::config()->serverclient_token)) {
         throw new \Exception("Could not connect to mailserver. Please set a strong password in /etc/groupoffice/globalconfig.inc.php.\n\nPlease remove serverclient_username and serverclient_password.\n\nPlease add:\n\n \$config['serverclient_token']='aStrongPasswordOfYourChoice';");
     }
     $params['serverclient_token'] = \GO::config()->serverclient_token;
     return parent::request($url, $params);
 }
Esempio n. 2
0
 protected function actionCheckVersion()
 {
     $rssUrl = "https://sourceforge.net/api/file/index/project-id/76359/mtime/desc/limit/20/rss";
     $httpClient = new \GO\Base\Util\HttpClient();
     $response = $httpClient->request($rssUrl);
     $sXml = simplexml_load_string($response);
     $firstItem = $sXml->channel->item[0];
     $link = (string) $firstItem->link;
     preg_match('/-([0-9]\\.[0-9]{1,2}\\.[0-9]{1,2})\\./', $link, $matches);
     $version = $matches[1];
     $ret = version_compare(GO::config()->version, $version);
     if ($ret !== -1) {
         echo "A new version ({$version}) is available at {$link}";
     } else {
         echo "Your running the latest version";
     }
 }