Пример #1
0
 /**
  * ISteamUserStats/GetSchemaForGame/v0002
  * 
  * @param string $lang Localized language to return
  * @return array An array of game schema information
  */
 public function getSchema($lang = 'en')
 {
     $data = SteamCommunity::apiRequest('ISteamUserStats', 'GetSchemaForGame', 2, array('appid' => $this->_id, 'l' => $lang));
     if (empty($data)) {
         return array();
     }
     $data = json_decode($data, true);
     return $data['game'];
 }
Пример #2
0
 /**
  * Raised right BEFORE the application processes the request.
  * @param CEvent $event the event parameter
  * @throws CHttpException if the /install folder exists
  */
 public static function onBeginRequest($event)
 {
     if (!YII_DEBUG && file_exists(Yii::getPathOfAlias('webroot.install'))) {
         throw new CHttpException(403, 'Please delete the /install folder.');
     }
     // Set timezone
     if (!Yii::app()->user->isGuest && !empty(Yii::app()->user->data->timezone)) {
         Yii::app()->setTimeZone(Yii::app()->user->data->timezone);
     } else {
         if (!empty(SourceBans::app()->settings->timezone)) {
             Yii::app()->setTimeZone(SourceBans::app()->settings->timezone);
         }
     }
     // Set date/time format
     if (!empty(SourceBans::app()->settings->date_format)) {
         Yii::app()->format->datetimeFormat = SourceBans::app()->settings->date_format;
     }
     // Set language
     if (!Yii::app()->user->isGuest && !empty(Yii::app()->user->data->language)) {
         Yii::app()->setLanguage(Yii::app()->user->data->language);
     } else {
         if (!empty(SourceBans::app()->settings->language)) {
             Yii::app()->setLanguage(SourceBans::app()->settings->language);
         }
     }
     // Set theme
     if (!Yii::app()->user->isGuest && !empty(Yii::app()->user->data->theme)) {
         Yii::app()->setTheme(Yii::app()->user->data->theme);
     } else {
         if (!empty(SourceBans::app()->settings->theme)) {
             Yii::app()->setTheme(SourceBans::app()->settings->theme);
         }
     }
     // Set mailer
     if (SourceBans::app()->settings->enable_smtp) {
         Yii::app()->mailer->mailer = 'smtp';
         Yii::app()->mailer->host = SourceBans::app()->settings->smtp_host;
         Yii::app()->mailer->port = SourceBans::app()->settings->smtp_port;
         Yii::app()->mailer->username = SourceBans::app()->settings->smtp_username;
         Yii::app()->mailer->password = SourceBans::app()->settings->smtp_password;
         Yii::app()->mailer->security = SourceBans::app()->settings->smtp_secure;
     }
     if (!empty(SourceBans::app()->settings->mailer_from)) {
         Yii::app()->mailer->From = SourceBans::app()->settings->mailer_from;
     }
     SteamCommunity::setApiKey(SourceBans::app()->settings->steam_web_api_key);
     SourceBans::app()->getPlugins();
     SourceBans::app()->trigger('app.beginRequest', $event);
 }
Пример #3
0
 /**
  * Normalizes a request
  * 
  * @param string $path The request path
  * @param array $data The request data
  * @return string The request output
  */
 private function _request($path = '', $data = array())
 {
     $path = (is_numeric($this->_id) ? 'profiles/' . $this->_id : 'id/' . $this->_id) . (!empty($path) ? '/' . $path : '');
     return SteamCommunity::request($path, $data);
 }
Пример #4
0
 /**
  * Normalizes a request
  * 
  * @param string $path
  * @param array $data
  * @return string
  */
 private function _request($path, $data = array())
 {
     $path = (is_numeric($this->_id) ? 'gid/' . $this->_id : 'groups/' . $this->_id) . '/' . $path;
     return SteamCommunity::request($path, $data);
 }
Пример #5
0
 /**
  * Sets the Steam Web API Key
  * 
  * @param string $apiKey The Steam Web API Key
  */
 public static function setApiKey($apiKey)
 {
     self::$_apiKey = $apiKey;
 }