Example #1
0
 public static function GetSystemInfo($returnArray = false)
 {
     exec('/usr/bin/airtime-check-system', $output);
     $output = preg_replace('/\\s+/', ' ', $output);
     $systemInfoArray = array();
     foreach ($output as $key => &$out) {
         $info = explode('=', $out);
         if (isset($info[1])) {
             $key = str_replace(' ', '_', trim($info[0]));
             $key = strtoupper($key);
             $systemInfoArray[$key] = $info[1];
         }
     }
     $outputArray = array();
     $outputArray['STATION_NAME'] = Application_Model_Preference::GetStationName();
     $outputArray['PHONE'] = Application_Model_Preference::GetPhone();
     $outputArray['EMAIL'] = Application_Model_Preference::GetEmail();
     $outputArray['STATION_WEB_SITE'] = Application_Model_Preference::GetStationWebSite();
     $outputArray['STATION_COUNTRY'] = Application_Model_Preference::GetStationCountry();
     $outputArray['STATION_CITY'] = Application_Model_Preference::GetStationCity();
     $outputArray['STATION_DESCRIPTION'] = Application_Model_Preference::GetStationDescription();
     // get web server info
     if (isset($systemInfoArray["AIRTIME_VERSION_URL"])) {
         $url = $systemInfoArray["AIRTIME_VERSION_URL"];
         $index = strpos($url, '/api/');
         $url = substr($url, 0, $index);
         $headerInfo = get_headers(trim($url), 1);
         $outputArray['WEB_SERVER'] = $headerInfo['Server'][0];
     }
     $outputArray['NUM_OF_USERS'] = User::getUserCount();
     $outputArray['NUM_OF_SONGS'] = StoredFile::getFileCount();
     $outputArray['NUM_OF_PLAYLISTS'] = Playlist::getPlaylistCount();
     $outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Schedule::getSchduledPlaylistCount();
     $outputArray['NUM_OF_PAST_SHOWS'] = ShowInstance::GetShowInstanceCount(date("Y-m-d H:i:s"));
     $outputArray['UNIQUE_ID'] = Application_Model_Preference::GetUniqueId();
     $outputArray = array_merge($systemInfoArray, $outputArray);
     $outputString = "\n";
     foreach ($outputArray as $key => $out) {
         if ($out != '') {
             $outputString .= $key . ' : ' . $out . "\n";
         }
     }
     if ($returnArray) {
         $outputArray['PROMOTE'] = Application_Model_Preference::GetPublicise();
         $outputArray['LOGOIMG'] = Application_Model_Preference::GetStationLogo();
         return $outputArray;
     } else {
         return $outputString;
     }
 }