2011-02-03 23:51:35 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Application_Model_Preference
|
|
|
|
{
|
|
|
|
|
2011-10-14 20:17:06 +02:00
|
|
|
public static function SetValue($key, $value, $isUserValue = false){
|
2011-02-03 23:51:35 +01:00
|
|
|
global $CC_CONFIG, $CC_DBC;
|
2011-02-05 22:00:05 +01:00
|
|
|
|
2011-04-04 06:02:35 +02:00
|
|
|
//called from a daemon process
|
2011-11-09 16:15:44 +01:00
|
|
|
if(!class_exists("Zend_Auth", false) || !Zend_Auth::getInstance()->hasIdentity()) {
|
2011-04-04 06:02:35 +02:00
|
|
|
$id = NULL;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
$id = $auth->getIdentity()->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
$key = pg_escape_string($key);
|
|
|
|
$value = pg_escape_string($value);
|
2011-03-23 23:16:08 +01:00
|
|
|
|
2011-02-03 23:51:35 +01:00
|
|
|
//Check if key already exists
|
|
|
|
$sql = "SELECT COUNT(*) FROM cc_pref"
|
2011-02-04 01:17:52 +01:00
|
|
|
." WHERE keystr = '$key'";
|
2011-10-14 20:17:06 +02:00
|
|
|
|
|
|
|
//For user specific preference, check if id matches as well
|
|
|
|
if($isUserValue) {
|
|
|
|
$sql .= " AND subjid = '$id'";
|
|
|
|
}
|
|
|
|
|
2011-02-03 23:51:35 +01:00
|
|
|
$result = $CC_DBC->GetOne($sql);
|
2011-03-23 23:16:08 +01:00
|
|
|
|
2011-10-24 18:05:55 +02:00
|
|
|
if($result == 1) {
|
|
|
|
// result found
|
|
|
|
if(is_null($id) || !$isUserValue) {
|
|
|
|
// system pref
|
|
|
|
$sql = "UPDATE cc_pref"
|
|
|
|
." SET subjid = NULL, valstr = '$value'"
|
2011-10-14 20:17:06 +02:00
|
|
|
." WHERE keystr = '$key'";
|
2011-10-24 18:05:55 +02:00
|
|
|
} else {
|
|
|
|
// user pref
|
|
|
|
$sql = "UPDATE cc_pref"
|
|
|
|
. " SET valstr = '$value'"
|
|
|
|
. " WHERE keystr = '$key' AND subjid = $id";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// result not found
|
|
|
|
if(is_null($id) || !$isUserValue) {
|
|
|
|
// system pref
|
|
|
|
$sql = "INSERT INTO cc_pref (keystr, valstr)"
|
|
|
|
." VALUES ('$key', '$value')";
|
|
|
|
} else {
|
|
|
|
// user pref
|
|
|
|
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr)"
|
|
|
|
." VALUES ($id, '$key', '$value')";
|
|
|
|
}
|
2011-02-03 23:51:35 +01:00
|
|
|
}
|
2011-10-24 18:05:55 +02:00
|
|
|
|
2011-02-03 23:51:35 +01:00
|
|
|
return $CC_DBC->query($sql);
|
|
|
|
}
|
2011-03-23 23:16:08 +01:00
|
|
|
|
2011-10-14 20:17:06 +02:00
|
|
|
public static function GetValue($key, $isUserValue = false){
|
2011-02-03 23:51:35 +01:00
|
|
|
global $CC_CONFIG, $CC_DBC;
|
|
|
|
//Check if key already exists
|
|
|
|
$sql = "SELECT COUNT(*) FROM cc_pref"
|
2011-02-04 01:17:52 +01:00
|
|
|
." WHERE keystr = '$key'";
|
2011-10-14 20:17:06 +02:00
|
|
|
|
|
|
|
//For user specific preference, check if id matches as well
|
|
|
|
if($isUserValue) {
|
|
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
if($auth->hasIdentity()) {
|
|
|
|
$id = $auth->getIdentity()->id;
|
|
|
|
$sql .= " AND subjid = '$id'";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-03 23:51:35 +01:00
|
|
|
$result = $CC_DBC->GetOne($sql);
|
2011-03-23 23:16:08 +01:00
|
|
|
|
2011-02-03 23:51:35 +01:00
|
|
|
if ($result == 0)
|
2011-02-04 01:22:17 +01:00
|
|
|
return "";
|
2011-02-03 23:51:35 +01:00
|
|
|
else {
|
|
|
|
$sql = "SELECT valstr FROM cc_pref"
|
2011-02-04 01:17:52 +01:00
|
|
|
." WHERE keystr = '$key'";
|
2011-10-14 20:17:06 +02:00
|
|
|
|
|
|
|
//For user specific preference, check if id matches as well
|
|
|
|
if($isUserValue && $auth->hasIdentity()) {
|
|
|
|
$sql .= " AND subjid = '$id'";
|
|
|
|
}
|
|
|
|
|
2011-02-03 23:51:35 +01:00
|
|
|
$result = $CC_DBC->GetOne($sql);
|
2011-02-04 01:17:52 +01:00
|
|
|
return $result;
|
2011-02-03 23:51:35 +01:00
|
|
|
}
|
|
|
|
}
|
2011-03-23 23:16:08 +01:00
|
|
|
|
2011-02-04 01:17:52 +01:00
|
|
|
public static function GetHeadTitle(){
|
|
|
|
/* Caches the title name as a session variable so we dont access
|
|
|
|
* the database on every page load. */
|
|
|
|
$defaultNamespace = new Zend_Session_Namespace('title_name');
|
|
|
|
if (isset($defaultNamespace->title)) {
|
|
|
|
$title = $defaultNamespace->title;
|
|
|
|
} else {
|
2011-09-23 22:26:19 +02:00
|
|
|
$title = self::GetValue("station_name");
|
2011-02-04 01:17:52 +01:00
|
|
|
$defaultNamespace->title = $title;
|
|
|
|
}
|
2011-02-04 01:22:17 +01:00
|
|
|
if (strlen($title) > 0)
|
|
|
|
$title .= " - ";
|
2011-03-23 23:16:08 +01:00
|
|
|
|
2011-02-04 01:22:17 +01:00
|
|
|
return $title."Airtime";
|
2011-02-04 01:17:52 +01:00
|
|
|
}
|
2011-03-23 23:16:08 +01:00
|
|
|
|
2011-02-04 01:17:52 +01:00
|
|
|
public static function SetHeadTitle($title, $view){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("station_name", $title);
|
2011-03-23 23:16:08 +01:00
|
|
|
$defaultNamespace = new Zend_Session_Namespace('title_name');
|
2011-02-04 01:17:52 +01:00
|
|
|
$defaultNamespace->title = $title;
|
2011-09-26 21:19:04 +02:00
|
|
|
Application_Model_RabbitMq::PushSchedule();
|
2011-03-23 23:16:08 +01:00
|
|
|
|
2011-02-04 01:17:52 +01:00
|
|
|
//set session variable to new station name so that html title is updated.
|
|
|
|
//should probably do this in a view helper to keep this controller as minimal as possible.
|
|
|
|
$view->headTitle()->exchangeArray(array()); //clear headTitle ArrayObject
|
2011-09-23 22:26:19 +02:00
|
|
|
$view->headTitle(self::GetHeadTitle());
|
2011-02-04 01:17:52 +01:00
|
|
|
}
|
2011-02-03 23:51:35 +01:00
|
|
|
|
2011-03-23 23:16:08 +01:00
|
|
|
public static function SetShowsPopulatedUntil($timestamp) {
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("shows_populated_until", $timestamp);
|
2011-02-05 22:00:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function GetShowsPopulatedUntil() {
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("shows_populated_until");
|
2011-02-05 22:00:05 +01:00
|
|
|
}
|
|
|
|
|
2011-03-23 23:16:08 +01:00
|
|
|
public static function SetDefaultFade($fade) {
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("default_fade", $fade);
|
2011-02-11 23:46:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function GetDefaultFade() {
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("default_fade");
|
2011-02-11 23:46:55 +01:00
|
|
|
}
|
|
|
|
|
2011-03-04 18:07:22 +01:00
|
|
|
public static function SetStreamLabelFormat($type){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("stream_label_format", $type);
|
2011-09-26 21:19:04 +02:00
|
|
|
Application_Model_RabbitMq::PushSchedule();
|
2011-03-04 18:07:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function GetStreamLabelFormat(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::getValue("stream_label_format");
|
2011-03-04 18:07:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function GetStationName(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::getValue("station_name");
|
2011-03-04 18:07:22 +01:00
|
|
|
}
|
2011-03-18 22:15:12 +01:00
|
|
|
|
2011-10-04 23:38:21 +02:00
|
|
|
public static function SetAutoUploadRecordedShowToSoundcloud($upload) {
|
|
|
|
self::SetValue("soundcloud_auto_upload_recorded_show", $upload);
|
2011-03-18 22:15:12 +01:00
|
|
|
}
|
|
|
|
|
2011-10-04 23:38:21 +02:00
|
|
|
public static function GetAutoUploadRecordedShowToSoundcloud() {
|
|
|
|
return self::GetValue("soundcloud_auto_upload_recorded_show");
|
2011-03-18 22:15:12 +01:00
|
|
|
}
|
|
|
|
|
2011-03-23 23:16:08 +01:00
|
|
|
public static function SetSoundCloudUser($user) {
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("soundcloud_user", $user);
|
2011-03-18 22:15:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function GetSoundCloudUser() {
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("soundcloud_user");
|
2011-03-18 22:15:12 +01:00
|
|
|
}
|
|
|
|
|
2011-03-23 23:16:08 +01:00
|
|
|
public static function SetSoundCloudPassword($password) {
|
2011-03-31 23:30:50 +02:00
|
|
|
if (strlen($password) > 0)
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("soundcloud_password", $password);
|
2011-03-18 22:15:12 +01:00
|
|
|
}
|
|
|
|
|
2011-03-21 20:48:44 +01:00
|
|
|
public static function GetSoundCloudPassword() {
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("soundcloud_password");
|
2011-03-18 22:15:12 +01:00
|
|
|
}
|
|
|
|
|
2011-03-28 21:39:01 +02:00
|
|
|
public static function SetSoundCloudTags($tags) {
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("soundcloud_tags", $tags);
|
2011-03-28 21:39:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function GetSoundCloudTags() {
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("soundcloud_tags");
|
2011-03-28 21:39:01 +02:00
|
|
|
}
|
|
|
|
|
2011-04-02 22:33:45 +02:00
|
|
|
public static function SetSoundCloudGenre($genre) {
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("soundcloud_genre", $genre);
|
2011-04-02 22:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function GetSoundCloudGenre() {
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("soundcloud_genre");
|
2011-04-02 22:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function SetSoundCloudTrackType($track_type) {
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("soundcloud_tracktype", $track_type);
|
2011-04-02 22:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function GetSoundCloudTrackType() {
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("soundcloud_tracktype");
|
2011-04-02 22:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function SetSoundCloudLicense($license) {
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("soundcloud_license", $license);
|
2011-04-02 22:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function GetSoundCloudLicense() {
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("soundcloud_license");
|
2011-04-02 22:33:45 +02:00
|
|
|
}
|
|
|
|
|
2011-03-30 21:34:35 +02:00
|
|
|
public static function SetAllow3rdPartyApi($bool) {
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("third_party_api", $bool);
|
2011-03-30 21:34:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function GetAllow3rdPartyApi() {
|
2011-09-23 22:26:19 +02:00
|
|
|
$val = self::GetValue("third_party_api");
|
2011-03-30 21:34:35 +02:00
|
|
|
if (strlen($val) == 0){
|
|
|
|
return "0";
|
|
|
|
} else {
|
|
|
|
return $val;
|
|
|
|
}
|
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-09 15:56:32 +02:00
|
|
|
public static function SetPhone($phone){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("phone", $phone);
|
2011-06-09 15:56:32 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-09 15:56:32 +02:00
|
|
|
public static function GetPhone(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("phone");
|
2011-06-09 15:56:32 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-09 15:56:32 +02:00
|
|
|
public static function SetEmail($email){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("email", $email);
|
2011-06-09 15:56:32 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-09 15:56:32 +02:00
|
|
|
public static function GetEmail(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("email");
|
2011-06-09 15:56:32 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-09 15:56:32 +02:00
|
|
|
public static function SetStationWebSite($site){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("station_website", $site);
|
2011-06-09 15:56:32 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-09 15:56:32 +02:00
|
|
|
public static function GetStationWebSite(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("station_website");
|
2011-06-09 15:56:32 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-09 15:56:32 +02:00
|
|
|
public static function SetSupportFeedback($feedback){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("support_feedback", $feedback);
|
2011-06-09 15:56:32 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-09 15:56:32 +02:00
|
|
|
public static function GetSupportFeedback(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("support_feedback");
|
2011-06-09 15:56:32 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
public static function SetPublicise($publicise){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("publicise", $publicise);
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
public static function GetPublicise(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("publicise");
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-09 15:56:32 +02:00
|
|
|
public static function SetRegistered($registered){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("registered", $registered);
|
2011-06-09 15:56:32 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-09 15:56:32 +02:00
|
|
|
public static function GetRegistered(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("registered");
|
2011-06-09 15:56:32 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
public static function SetStationCountry($country){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("country", $country);
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
public static function GetStationCountry(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("country");
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
public static function SetStationCity($city){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("city", $city);
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
public static function GetStationCity(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("city");
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
public static function SetStationDescription($description){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("description", $description);
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
public static function GetStationDescription(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("description");
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-12 20:14:07 +02:00
|
|
|
public static function SetTimezone($timezone){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("timezone", $timezone);
|
2011-08-12 21:36:00 +02:00
|
|
|
date_default_timezone_set($timezone);
|
|
|
|
$md = array("timezone" => $timezone);
|
2011-08-12 20:14:07 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-12 20:14:07 +02:00
|
|
|
public static function GetTimezone(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("timezone");
|
2011-08-12 20:14:07 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
public static function SetStationLogo($imagePath){
|
|
|
|
if(!empty($imagePath)){
|
2011-06-30 19:52:51 +02:00
|
|
|
$image = @file_get_contents($imagePath);
|
2011-06-15 18:06:50 +02:00
|
|
|
$image = base64_encode($image);
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("logoImage", $image);
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
public static function GetStationLogo(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("logoImage");
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
public static function GetUniqueId(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("uniqueId");
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
public static function GetCountryList(){
|
|
|
|
global $CC_DBC;
|
|
|
|
$sql = "SELECT * FROM cc_country";
|
|
|
|
$res = $CC_DBC->GetAll($sql);
|
|
|
|
$out = array();
|
2011-06-29 23:46:46 +02:00
|
|
|
$out[""] = "Select Country";
|
2011-06-15 18:06:50 +02:00
|
|
|
foreach($res as $r){
|
2011-06-21 05:31:20 +02:00
|
|
|
$out[$r["isocode"]] = $r["name"];
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
|
|
|
return $out;
|
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-20 23:58:38 +02:00
|
|
|
public static function GetSystemInfo($returnArray=false){
|
2011-11-01 19:52:27 +01:00
|
|
|
exec('/usr/bin/airtime-check-system --no-color', $output);
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
$output = preg_replace('/\s+/', ' ', $output);
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
$systemInfoArray = array();
|
|
|
|
foreach( $output as $key => &$out){
|
|
|
|
$info = explode('=', $out);
|
|
|
|
if(isset($info[1])){
|
2011-06-20 23:58:38 +02:00
|
|
|
$key = str_replace(' ', '_', trim($info[0]));
|
2011-06-15 18:06:50 +02:00
|
|
|
$key = strtoupper($key);
|
2011-06-21 11:20:35 +02:00
|
|
|
$systemInfoArray[$key] = $info[1];
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
$outputArray = array();
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-09-23 22:26:19 +02:00
|
|
|
$outputArray['STATION_NAME'] = self::GetStationName();
|
|
|
|
$outputArray['PHONE'] = self::GetPhone();
|
|
|
|
$outputArray['EMAIL'] = self::GetEmail();
|
|
|
|
$outputArray['STATION_WEB_SITE'] = self::GetStationWebSite();
|
|
|
|
$outputArray['STATION_COUNTRY'] = self::GetStationCountry();
|
|
|
|
$outputArray['STATION_CITY'] = self::GetStationCity();
|
|
|
|
$outputArray['STATION_DESCRIPTION'] = self::GetStationDescription();
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-20 23:58:38 +02:00
|
|
|
// get web server info
|
2011-08-02 19:54:26 +02:00
|
|
|
if(isset($systemInfoArray["AIRTIME_VERSION_URL"])){
|
|
|
|
$url = $systemInfoArray["AIRTIME_VERSION_URL"];
|
|
|
|
$index = strpos($url,'/api/');
|
|
|
|
$url = substr($url, 0, $index);
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-02 19:54:26 +02:00
|
|
|
$headerInfo = get_headers(trim($url),1);
|
|
|
|
$outputArray['WEB_SERVER'] = $headerInfo['Server'][0];
|
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-09-23 23:00:55 +02:00
|
|
|
$outputArray['NUM_OF_USERS'] = Application_Model_User::getUserCount();
|
2011-09-22 18:24:17 +02:00
|
|
|
$outputArray['NUM_OF_SONGS'] = Application_Model_StoredFile::getFileCount();
|
|
|
|
$outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount();
|
2011-09-23 22:50:00 +02:00
|
|
|
$outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Application_Model_Schedule::getSchduledPlaylistCount();
|
2011-09-23 16:54:20 +02:00
|
|
|
$outputArray['NUM_OF_PAST_SHOWS'] = Application_Model_ShowInstance::GetShowInstanceCount(date("Y-m-d H:i:s"));
|
2011-09-23 22:26:19 +02:00
|
|
|
$outputArray['UNIQUE_ID'] = self::GetUniqueId();
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-21 18:23:43 +02:00
|
|
|
$outputArray = array_merge($systemInfoArray, $outputArray);
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
$outputString = "\n";
|
|
|
|
foreach($outputArray as $key => $out){
|
2011-06-26 07:01:35 +02:00
|
|
|
if($out != ''){
|
2011-06-21 18:23:43 +02:00
|
|
|
$outputString .= $key.' : '.$out."\n";
|
|
|
|
}
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
2011-06-20 23:58:38 +02:00
|
|
|
if($returnArray){
|
2011-09-23 22:26:19 +02:00
|
|
|
$outputArray['PROMOTE'] = self::GetPublicise();
|
|
|
|
$outputArray['LOGOIMG'] = self::GetStationLogo();
|
2011-06-20 23:58:38 +02:00
|
|
|
return $outputArray;
|
|
|
|
}else{
|
|
|
|
return $outputString;
|
|
|
|
}
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 18:06:50 +02:00
|
|
|
public static function SetRemindMeDate($now){
|
|
|
|
$weekAfter = mktime(0, 0, 0, date("m") , date("d")+7, date("Y"));
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("remindme", $weekAfter);
|
2011-06-09 15:56:32 +02:00
|
|
|
}
|
2011-06-21 11:20:35 +02:00
|
|
|
|
2011-06-15 23:51:44 +02:00
|
|
|
public static function GetRemindMeDate(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("remindme");
|
2011-06-15 23:51:44 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-08 20:44:05 +02:00
|
|
|
public static function SetImportTimestamp(){
|
|
|
|
$now = time();
|
2011-09-23 22:26:19 +02:00
|
|
|
if(self::GetImportTimestamp()+5 < $now){
|
|
|
|
self::SetValue("import_timestamp", $now);
|
2011-08-09 16:40:10 +02:00
|
|
|
}
|
2011-08-08 20:44:05 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-08 20:44:05 +02:00
|
|
|
public static function GetImportTimestamp(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("import_timestamp");
|
2011-08-08 20:44:05 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-18 19:53:12 +02:00
|
|
|
public static function GetStreamType(){
|
2011-09-23 22:26:19 +02:00
|
|
|
$st = self::GetValue("stream_type");
|
2011-08-18 19:53:12 +02:00
|
|
|
return explode(',', $st);
|
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-18 19:53:12 +02:00
|
|
|
public static function GetStreamBitrate(){
|
2011-09-23 22:26:19 +02:00
|
|
|
$sb = self::GetValue("stream_bitrate");
|
2011-08-18 19:53:12 +02:00
|
|
|
return explode(',', $sb);
|
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-23 21:11:21 +02:00
|
|
|
public static function SetPrivacyPolicyCheck($flag){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("privacy_policy", $flag);
|
2011-08-23 21:11:21 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-23 21:11:21 +02:00
|
|
|
public static function GetPrivacyPolicyCheck(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("privacy_policy");
|
2011-08-23 21:11:21 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-31 22:28:20 +02:00
|
|
|
public static function SetNumOfStreams($num){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("num_of_streams", intval($num));
|
2011-08-26 21:41:20 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-31 22:28:20 +02:00
|
|
|
public static function GetNumOfStreams(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("num_of_streams");
|
2011-08-26 21:41:20 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-26 21:41:20 +02:00
|
|
|
public static function SetMaxBitrate($bitrate){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("max_bitrate", intval($bitrate));
|
2011-08-26 21:41:20 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-26 21:41:20 +02:00
|
|
|
public static function GetMaxBitrate(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("max_bitrate");
|
2011-08-26 21:41:20 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-09-02 16:37:15 +02:00
|
|
|
public static function SetPlanLevel($plan){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("plan_level", $plan);
|
2011-09-02 16:37:15 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-09-02 16:37:15 +02:00
|
|
|
public static function GetPlanLevel(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("plan_level");
|
2011-09-02 16:37:15 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-09-02 17:30:47 +02:00
|
|
|
public static function SetTrialEndingDate($date){
|
2011-09-23 22:26:19 +02:00
|
|
|
self::SetValue("trial_end_date", $date);
|
2011-09-02 17:30:47 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-09-02 17:30:47 +02:00
|
|
|
public static function GetTrialEndingDate(){
|
2011-09-23 22:26:19 +02:00
|
|
|
return self::GetValue("trial_end_date");
|
2011-09-02 17:30:47 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
|
|
|
public static function SetEnableStreamConf($bool){
|
|
|
|
self::SetValue("enable_stream_conf", $bool);
|
2011-09-02 22:13:30 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
|
|
|
public static function GetEnableStreamConf(){
|
2011-10-03 21:25:55 +02:00
|
|
|
if(self::GetValue("enable_stream_conf") == Null){
|
|
|
|
return "true";
|
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
return self::GetValue("enable_stream_conf");
|
2011-09-23 22:26:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function GetAirtimeVersion(){
|
|
|
|
return self::GetValue("system_version");
|
2011-09-02 22:13:30 +02:00
|
|
|
}
|
2011-10-14 20:17:06 +02:00
|
|
|
|
2011-09-29 23:10:17 +02:00
|
|
|
public static function SetUploadToSoundcloudOption($upload) {
|
|
|
|
self::SetValue("soundcloud_upload_option", $upload);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function GetUploadToSoundcloudOption() {
|
|
|
|
return self::GetValue("soundcloud_upload_option");
|
|
|
|
}
|
2011-10-14 20:17:06 +02:00
|
|
|
|
2011-09-29 23:10:17 +02:00
|
|
|
public static function SetSoundCloudDownloadbleOption($upload) {
|
|
|
|
self::SetValue("soundcloud_downloadable", $upload);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function GetSoundCloudDownloadbleOption() {
|
|
|
|
return self::GetValue("soundcloud_downloadable");
|
|
|
|
}
|
2011-10-19 18:42:22 +02:00
|
|
|
|
|
|
|
public static function SetWeekStartDay($day) {
|
|
|
|
self::SetValue("week_start_day", $day);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function GetWeekStartDay() {
|
|
|
|
$val = self::GetValue("week_start_day");
|
|
|
|
if (strlen($val) == 0){
|
|
|
|
return "0";
|
|
|
|
} else {
|
|
|
|
return $val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* User specific preferences start */
|
2011-10-14 20:17:06 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the time scale preference (day/week/month) in Calendar.
|
|
|
|
*
|
|
|
|
* @param $timeScale new time scale
|
|
|
|
*/
|
|
|
|
public static function SetCalendarTimeScale($timeScale) {
|
|
|
|
return self::SetValue("calendar_time_scale", $timeScale, true /* user specific */);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves the time scale preference for the current user.
|
|
|
|
*/
|
|
|
|
public static function GetCalendarTimeScale() {
|
|
|
|
return self::GetValue("calendar_time_scale", true /* user specific */);
|
|
|
|
}
|
2011-10-18 16:10:35 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the number of entries to show preference in library under Playlist Builder.
|
|
|
|
*
|
|
|
|
* @param $numEntries new number of entries to show
|
|
|
|
*/
|
|
|
|
public static function SetLibraryNumEntries($numEntries) {
|
|
|
|
return self::SetValue("library_num_entries", $numEntries, true /* user specific */);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves the number of entries to show preference in library under Playlist Builder.
|
|
|
|
*/
|
|
|
|
public static function GetLibraryNumEntries() {
|
|
|
|
return self::GetValue("library_num_entries", true /* user specific */);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the time interval preference in Calendar.
|
|
|
|
*
|
|
|
|
* @param $timeInterval new time interval
|
|
|
|
*/
|
|
|
|
public static function SetCalendarTimeInterval($timeInterval) {
|
|
|
|
return self::SetValue("calendar_time_interval", $timeInterval, true /* user specific */);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves the time interval preference for the current user.
|
|
|
|
*/
|
|
|
|
public static function GetCalendarTimeInterval() {
|
|
|
|
return self::GetValue("calendar_time_interval", true /* user specific */);
|
|
|
|
}
|
2011-10-19 18:42:22 +02:00
|
|
|
|
|
|
|
/* User specific preferences end */
|
2011-02-03 23:51:35 +01:00
|
|
|
}
|
|
|
|
|