diff --git a/airtime_mvc/application/controllers/NowplayingController.php b/airtime_mvc/application/controllers/NowplayingController.php index 06cdc0300..dac297494 100644 --- a/airtime_mvc/application/controllers/NowplayingController.php +++ b/airtime_mvc/application/controllers/NowplayingController.php @@ -21,8 +21,11 @@ class NowplayingController extends Zend_Controller_Action //popup if previous page was login $refer_sses = new Zend_Session_Namespace('referrer'); + $userInfo = Zend_Auth::getInstance()->getStorage()->read(); + $user = new User($userInfo->id); + if($refer_sses->referrer == 'login' && Application_Model_Nowplaying::ShouldShowPopUp() - && !Application_Model_Preference::GetSupportFeedback()){ + && !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js','text/javascript'); } } diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index ea2528c73..82b1a1ff3 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -116,42 +116,6 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::SetRemindMeDate($now); die(); } - - /*public function registersubmitAction(){ - $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); - - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js','text/javascript'); - $this->view->statusMsg = ""; - - $form = new Application_Form_RegisterAirtime(); - - if ($request->isPost()) { - - if ($form->isValid($request->getPost())) { - - $values = $form->getValues(); - var_dump($values); - Application_Model_Preference::SetHeadTitle($values["stnName"], $this->view); - Application_Model_Preference::SetPhone($values["Phone"]); - Application_Model_Preference::SetEmail($values["Email"]); - Application_Model_Preference::SetStationWebSite($values["StationWebSite"]); - Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]); - Application_Model_Preference::SetPublicise($values["Publicise"]); - - $imagePath = $form->Logo->getFileName(); - - Application_Model_Preference::SetStationCountry($values["Country"]); - Application_Model_Preference::SetStationCity($values["City"]); - Application_Model_Preference::SetStationDescription($values["Description"]); - Application_Model_Preference::SetStationLogo($imagePath); - - // unset session - Zend_Session::namespaceUnset('referrer'); - } - } - $this->_redirect('Nowplaying'); - }*/ } diff --git a/airtime_mvc/application/forms/RegisterAirtime.php b/airtime_mvc/application/forms/RegisterAirtime.php index 29f0e04fe..ee861cab4 100644 --- a/airtime_mvc/application/forms/RegisterAirtime.php +++ b/airtime_mvc/application/forms/RegisterAirtime.php @@ -17,7 +17,7 @@ class Application_Form_RegisterAirtime extends Zend_Form // Station Name $stnName = new Zend_Form_Element_Text("stnName"); - $stnName->setLabel("Station Name:") + $stnName->setLabel("Station Name:(*)") ->setRequired(true) ->setValue(Application_Model_Preference::GetStationName()) ->setDecorators(array('ViewHelper')); @@ -27,7 +27,7 @@ class Application_Form_RegisterAirtime extends Zend_Form $this->addElement('text', 'Phone', array( 'class' => 'input_text', 'label' => 'Phone:', - 'required' => true, + 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetPhone(), 'decorators' => array( @@ -38,7 +38,7 @@ class Application_Form_RegisterAirtime extends Zend_Form //Email $this->addElement('text', 'Email', array( 'class' => 'input_text', - 'label' => 'Email:', + 'label' => 'Email:(*)', 'required' => true, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetEmail(), @@ -61,7 +61,7 @@ class Application_Form_RegisterAirtime extends Zend_Form // county list dropdown $this->addElement('select', 'Country', array( 'label' => 'Country:', - 'required' => true, + 'required' => false, 'value' => Application_Model_Preference::GetStationCountry(), 'multiOptions' => $country_list, 'decorators' => array( @@ -72,7 +72,7 @@ class Application_Form_RegisterAirtime extends Zend_Form // Station city $this->addElement('text', 'City', array( 'label' => 'City:', - 'required' => true, + 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationCity(), 'decorators' => array( @@ -84,7 +84,7 @@ class Application_Form_RegisterAirtime extends Zend_Form $description = new Zend_Form_Element_Textarea('Description'); $description->class = 'input_text_area'; $description->setLabel('Station Description:') - ->setRequired(true) + ->setRequired(false) ->setValue(Application_Model_Preference::GetStationDescription()) ->setDecorators(array('ViewHelper')) ->setAttrib('ROWS','2') @@ -99,17 +99,17 @@ class Application_Form_RegisterAirtime extends Zend_Form ->addValidator('Count', false, 1) ->addValidator('Extension', false, 'jpg,png,gif') ->addValidator('ImageSize', false, array( - 'minwidth' => 180, - 'minheight' => 180, - 'maxwidth' => 1000, - 'maxheight' => 1000)); + 'minwidth' => 200, + 'minheight' => 200, + 'maxwidth' => 600, + 'maxheight' => 600)); $this->addElement($upload); //enable support feedback $this->addElement('checkbox', 'SupportFeedback', array( 'label' => 'Send support feedback', 'required' => false, - 'value' => Application_Model_Preference::GetSupportFeedback(), + 'value' => 1, 'decorators' => array( 'ViewHelper' ) @@ -121,9 +121,6 @@ class Application_Form_RegisterAirtime extends Zend_Form ->setRequired(false) ->setDecorators(array('ViewHelper')) ->setValue(Application_Model_Preference::GetPublicise()); - if(!Application_Model_Preference::GetSupportFeedback()){ - $checkboxPublicise->setAttrib("disabled", "disabled"); - } $this->addElement($checkboxPublicise); // text area for sending detail @@ -132,7 +129,8 @@ class Application_Form_RegisterAirtime extends Zend_Form 'required' => false, 'filters' => array('StringTrim'), 'readonly' => true, - 'rows' => 24, + 'rows' => 5, + 'cols' => 61, 'value' => Application_Model_Preference::GetSystemInfo(), 'decorators' => array( 'ViewHelper' diff --git a/airtime_mvc/application/forms/SupportPreferences.php b/airtime_mvc/application/forms/SupportPreferences.php index a3c7a22f1..91dcafe38 100644 --- a/airtime_mvc/application/forms/SupportPreferences.php +++ b/airtime_mvc/application/forms/SupportPreferences.php @@ -16,7 +16,7 @@ class Application_Form_SupportPreferences extends Zend_Form_SubForm $this->addElement('text', 'Phone', array( 'class' => 'input_text', 'label' => 'Phone:', - 'required' => true, + 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetPhone(), 'decorators' => array( @@ -50,7 +50,7 @@ class Application_Form_SupportPreferences extends Zend_Form_SubForm // county list dropdown $this->addElement('select', 'Country', array( 'label' => 'Country:', - 'required' => true, + 'required' => false, 'value' => Application_Model_Preference::GetStationCountry(), 'multiOptions' => $country_list, 'decorators' => array( @@ -61,7 +61,7 @@ class Application_Form_SupportPreferences extends Zend_Form_SubForm // Station city $this->addElement('text', 'City', array( 'label' => 'City:', - 'required' => true, + 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationCity(), 'decorators' => array( @@ -72,7 +72,7 @@ class Application_Form_SupportPreferences extends Zend_Form_SubForm // Station Description $this->addElement('textarea', 'Description', array( 'label' => 'Station Description:', - 'required' => true, + 'required' => false, 'class' => 'input_text_area', 'value' => Application_Model_Preference::GetStationDescription(), 'decorators' => array( diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index b2f55891d..e92ffbe48 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -288,7 +288,7 @@ class Application_Model_Preference return $out; } - public static function GetSystemInfo(){ + public static function GetSystemInfo($returnArray=false){ exec('/usr/bin/airtime-check-system', $output); $output = preg_replace('/\s+/', ' ', $output); @@ -297,7 +297,7 @@ class Application_Model_Preference foreach( $output as $key => &$out){ $info = explode('=', $out); if(isset($info[1])){ - $key = str_replace(' ', '_', $info[0]); + $key = str_replace(' ', '_', trim($info[0])); $key = strtoupper($key); $systemInfoArray[$key] = $info[1]; } @@ -306,17 +306,26 @@ class Application_Model_Preference $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(); $outputArrat['STATION_DESCRIPTION'] = Application_Model_Preference::GetStationDescription(); - //$outputArray['Version'] = $systemInfoArray['AIRTIME_VERSION']; - $outputArray['WEB_SERVER'] = php_sapi_name(); - //$outputArray['OS Info'] = $systemInfoArray['OS']; + + // get web server info + $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_PLAYLIST'] = Schedule::getSchduledPlaylistCount(); + $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($outputArray, $systemInfoArray); @@ -325,8 +334,11 @@ class Application_Model_Preference foreach($outputArray as $key => $out){ $outputString .= $key.' : '.$out."\n"; } - - return $outputString; + if($returnArray){ + return $outputArray; + }else{ + return $outputString; + } } public static function SetRemindMeDate($now){ diff --git a/airtime_mvc/application/models/Shows.php b/airtime_mvc/application/models/Shows.php index 017bc6178..d52721a26 100644 --- a/airtime_mvc/application/models/Shows.php +++ b/airtime_mvc/application/models/Shows.php @@ -1866,6 +1866,13 @@ class ShowInstance { return new ShowInstance($id); } } + + // returns number of show instances that ends later than $day + public static function GetShowInstanceCount($day){ + global $CC_CONFIG, $CC_DBC; + $sql = "SELECT count(*) as cnt FROM $CC_CONFIG[showInstances] WHERE ends < '$day'"; + return $CC_DBC->GetOne($sql); + } } /* Show Data Access Layer */ diff --git a/airtime_mvc/application/views/scripts/form/register-dialog.phtml b/airtime_mvc/application/views/scripts/form/register-dialog.phtml index dc52af6e6..3e335e434 100644 --- a/airtime_mvc/application/views/scripts/form/register-dialog.phtml +++ b/airtime_mvc/application/views/scripts/form/register-dialog.phtml @@ -1,162 +1,164 @@ -
-
-
-
-

Help Airtime improve by letting us know you are using it. This info - will be collected regularly in order to improve your user experience.

-
-
- - element->getElement('SupportFeedback')->hasErrors()) : ?> -
    - element->getElement('SupportFeedback')->getMessages() as $error): ?> -
  • - -
- -
-
-

Click the box below to advertise your station on Sourcefabric.org.

-
-
- - element->getElement('Publicise')->hasErrors()) : ?> -
    - element->getElement('Publicise')->getMessages() as $error): ?> -
  • - -
- -
-

Note: In order to publicise your station, "Send support feedback" must be enabled

- -
-

- Show me what I am sending -

- - -
+
+
+
+
+
+ Help Airtime improve by letting us know you are using it. This info + will be collected regularly in order to improve your user experience. +
+
+ + element->getElement('SupportFeedback')->hasErrors()) : ?> +
    + element->getElement('SupportFeedback')->getMessages() as $error): ?> +
  • + +
+ +
+
+ Click the box below to advertise your station on Sourcefabric.org. In order to publicise your station, "Send support feedback" must be enabled +
+
+ + element->getElement('Publicise')->hasErrors()) : ?> +
    + element->getElement('Publicise')->getMessages() as $error): ?> +
  • + +
+ +
+
+ +
+

+ Show me what I am sending +

+ + +
\ No newline at end of file diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index b2d4f24f5..17efc4181 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -357,10 +357,11 @@ input[type="text"]:focus, input[type="password"]:focus, textarea:focus, .input_t border: 1px solid #5b5b5b; box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2) inset; font-size: 13px; - text-indent: 3px; + margin:0; } -.input_select { +.input_select, select { background-color: #DDDDDD; + box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2) inset; border: 1px solid #5b5b5b; font-family: Arial,Helvetica,sans-serif; font-size: 12px; @@ -1639,10 +1640,6 @@ dd.radio-inline-list, .preferences dd.radio-inline-list { height: 120px; } -.preferences dd#Description-element.block-display .input_text_area { - height: 60px; -} - #show_time_info { font-size:12px; height:30px; @@ -1669,43 +1666,73 @@ button.ui-button.md-cancel { .dialogPopup dl { margin:0; padding:0; -} -.dialogPopup dt { - margin:0; - padding: 0 0 5px; -} -.dialogPopup dt label { - font-weight: bold; -} -.dialogPopup dd { - margin:0 0 4px 0; - padding: 0 0 5px; -} -.dialogPopup dd input[type="text"]{ + clear:both; width:100%; } +.dialogPopup dt { + clear: left; + padding: 0; + float:left; + width:35%; +} -.info-text p { +.dialogPopup dt.block-display { + float:none; + width:100%; + padding: 0 0 10px; +} + +.dialogPopup dt label { + font-weight: bold; + line-height:24px; +} +.dialogPopup dd { + padding: 0; + float:left; + width:65%; + margin:0 0 6px 0; +} +.dialogPopup dd.block-display { + float:none; + width:100%; + padding: 0 0 10px; + margin:0 0 8px 0; +} +.dialogPopup fieldset dt:last-child, .dialogPopup fieldset dd:last-child { + margin:0; +} + +.info-text { font-size:12px; color:#5b5b5b; line-height:150%; - margin-top:0; -} + padding:0 0 6px; + margin:0; +} .dialogPopup label input[type="checkbox"] { float:left; margin-right:6px; } .dialogPopup fieldset { - padding: 10px; + padding: 0; + clear:both; + border:none; } -.dialogPopup fieldset dd input[type="text"] { - width:99%; +.dialogPopup fieldset dd input[type="text"], .dialogPopup fieldset dd textarea { + width:99.5%; + padding:0; } +.dialogPopup fieldset dd select { + width:100%; +} + fieldset.display_field { background-color:#d5d5d5; box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2) inset; + padding:10px; + border: 1px solid #8F8F8F; } label span { font-weight:normal; @@ -1720,7 +1747,6 @@ label span { padding: 6px 0; text-align: left; width:60%; - } .dialogPopup .display_field dt { @@ -1728,8 +1754,3 @@ label span { font-weight:bold; width:40%; } - -.sending_textarea { - width: 100%; - resize: none; -} \ No newline at end of file diff --git a/airtime_mvc/public/js/airtime/nowplaying/register.js b/airtime_mvc/public/js/airtime/nowplaying/register.js index 01203b6f3..62555ea87 100644 --- a/airtime_mvc/public/js/airtime/nowplaying/register.js +++ b/airtime_mvc/public/js/airtime/nowplaying/register.js @@ -4,10 +4,10 @@ $(document).ready(function(){ dialog.dialog({ autoOpen: false, - width: 450, + width: 500, resizable: false, modal: true, - position:'center', + position:['center',50], buttons: { "Remind me in 1 week": function() { var url = '/Preference/remindme'; @@ -55,22 +55,20 @@ $(document).ready(function(){ $("#public-info").hide(); } }); + + $("#link_to_whos_using").live('click', function(){ + window.open("http://sourcefabric.org/en/products/airtime_whosusing"); + }); }); function validateFields(){ var stnName = $("#stnName"); - var phone = $("#Phone"); var email = $("#Email"); - var city = $("#City"); - var description = $("#Description"); var errors = new Array(); errors[0] = displayError(stnName); - errors[1] = displayError(phone); - errors[2] = displayError(email); - errors[3] = displayError(city); - errors[4] = displayError(description); + errors[1] = displayError(email); for( e in errors ){ if(errors[e]){ diff --git a/install/airtime-install.php b/install/airtime-install.php index 5ff9e5118..ac44d4715 100644 --- a/install/airtime-install.php +++ b/install/airtime-install.php @@ -127,5 +127,11 @@ AirtimeInstall::CreateZendPhpLogFile(); AirtimeInstall::SetUniqueId(); +$h = rand(0,23); +$m = rand(0,59); + +$fp = fopen('/etc/cron.d/airtime-crons','a'); +fwrite($fp, "$m $h * * * root /usr/lib/airtime/utils/phone_home_stat\n"); +fclose($fp); /* FINISHED AIRTIME PHP INSTALLER */ diff --git a/install/airtime-uninstall.php b/install/airtime-uninstall.php index d1489d893..a5c7dc304 100644 --- a/install/airtime-uninstall.php +++ b/install/airtime-uninstall.php @@ -89,4 +89,6 @@ AirtimeInstall::RemoveSymlinks(); AirtimeInstall::UninstallBinaries(); AirtimeInstall::RemoveLogDirectories(); +unlink('/etc/cron.d/airtime-crons'); + /* FINISHED AIRTIME PHP UNINSTALLER */ diff --git a/utils/phone_home_stat b/utils/phone_home_stat new file mode 100755 index 000000000..dd16961b7 --- /dev/null +++ b/utils/phone_home_stat @@ -0,0 +1,34 @@ +#!/bin/bash +#------------------------------------------------------------------------------- +# Copyright (c) 2010 Sourcefabric O.P.S. +# +# This file is part of the Airtime project. +# http://airtime.sourcefabric.org/ +# +# Airtime is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Airtime is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Airtime; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- +# This script cleans audio files in Airtime. +# +# Absolute path to this script +SCRIPT=`readlink -f $0` +# Absolute directory this script is in +SCRIPTPATH=`dirname $SCRIPT` + +invokePwd=$PWD +cd $SCRIPTPATH + +php -q phone_home_stat.php "$@" || exit 1 \ No newline at end of file diff --git a/utils/phone_home_stat.php b/utils/phone_home_stat.php new file mode 100644 index 000000000..84cedb5d7 --- /dev/null +++ b/utils/phone_home_stat.php @@ -0,0 +1,71 @@ +#!/usr/bin/env php +getMessage().PHP_EOL; + echo $CC_DBC->getUserInfo().PHP_EOL; + echo "Database connection problem.".PHP_EOL; + echo "Check if database '{$CC_CONFIG['dsn']['database']}' exists". + " with corresponding permissions.".PHP_EOL; + if ($p_exitOnError) { + exit(1); + } +} else { + echo "* Connected to database".PHP_EOL; + $CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); +} +$infoArray = Application_Model_Preference::GetSystemInfo(true); + +$ch = curl_init(); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); +curl_setopt($ch, CURLOPT_POST, 1); +curl_setopt($ch, CURLOPT_URL, 'http://stat.sourcefabric.org/index.php?p=airtime'); + +$data = json_encode($infoArray); + +$dataArray = array("data" => $data ); + +curl_setopt($ch, CURLOPT_POSTFIELDS, $dataArray); +$result = curl_exec($ch); +?> \ No newline at end of file