diff --git a/Changelog b/Changelog index 8c3440cf1..722fa950f 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,14 @@ +1.9.1 - August 17th, 2011 + *Fixes + -airtime-user shell script failing to start + -Progress bar for tracks appearing when no content scheduled + -Fix upgrades from Airtime 1.8.2 failing + -Fix various install issues with virtualenv + -Prevent users from doing a manual install of Airtime if they already have the + Debian package version installed + *Changes + -Support Settings moved to a seperate page accessible by Admin user only. + 1.9.0 - August 9, 2011 The cool stuff: diff --git a/VERSION b/VERSION index b12c06c18..df9515d6e 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ PRODUCT_ID=Airtime -PRODUCT_RELEASE=1.9.0 +PRODUCT_RELEASE=1.9.1 diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php index 1eb796bf1..28db07932 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -1,6 +1,6 @@ 'default', 'controller' => 'Preference', 'action' => 'directory-config' + ), + array( + 'label' => 'Support Settings', + 'module' => 'default', + 'controller' => 'Preference', + 'action' => 'support-setting' ) ) ), diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index cf5d29b1b..7b7c62c65 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -7,9 +7,7 @@ class PreferenceController extends Zend_Controller_Action { /* Initialize action controller here */ $ajaxContext = $this->_helper->getHelper('AjaxContext'); - $ajaxContext/*->addActionContext('register', 'json') - ->addActionContext('remindme', 'json')*/ - ->addActionContext('server-browse', 'json') + $ajaxContext->addActionContext('server-browse', 'json') ->addActionContext('change-stor-directory', 'json') ->addActionContext('reload-watch-directory', 'json') ->addActionContext('remove-watch-directory', 'json') @@ -45,30 +43,51 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::SetSoundCloudLicense($values["preferences_soundcloud"]["SoundCloudLicense"]); - Application_Model_Preference::SetPhone($values["preferences_support"]["Phone"]); - Application_Model_Preference::SetEmail($values["preferences_support"]["Email"]); - Application_Model_Preference::SetStationWebSite($values["preferences_support"]["StationWebSite"]); - Application_Model_Preference::SetSupportFeedback($values["preferences_support"]["SupportFeedback"]); - Application_Model_Preference::SetPublicise($values["preferences_support"]["Publicise"]); - - $form->getSubForm('preferences_support')->Logo->receive(); - $imagePath = $form->getSubForm('preferences_support')->Logo->getFileName(); - - Application_Model_Preference::SetStationCountry($values["preferences_support"]["Country"]); - Application_Model_Preference::SetStationCity($values["preferences_support"]["City"]); - Application_Model_Preference::SetStationDescription($values["preferences_support"]["Description"]); - Application_Model_Preference::SetStationLogo($imagePath); - $this->view->statusMsg = "
Preferences updated.
"; } } - $logo = Application_Model_Preference::GetStationLogo(); - if($logo){ - $this->view->logoImg = $logo; - } $this->view->form = $form; } + public function supportSettingAction() + { + $request = $this->getRequest(); + $baseUrl = $request->getBaseUrl(); + + $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/support-setting.js','text/javascript'); + $this->view->statusMsg = ""; + + $form = new Application_Form_SupportSettings(); + + if ($request->isPost()) { + if ($form->isValid($request->getPost())) { + $values = $form->getValues(); + + Application_Model_Preference::SetHeadTitle($values["stationName"], $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"]); + + $form->Logo->receive(); + $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); + + $this->view->statusMsg = "
Support setting updated.
"; + } + } + $logo = Application_Model_Preference::GetStationLogo(); + if($logo){ + $this->view->logoImg = $logo; + } + $this->view->form = $form; + } + public function directoryConfigAction() { $request = $this->getRequest(); diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index 3e5ba710e..b048f150f 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -9,24 +9,23 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm array('ViewScript', array('viewScript' => 'form/preferences_general.phtml')) )); + $defaultFade = Application_Model_Preference::GetDefaultFade(); + if($defaultFade == ""){ + $defaultFade = '00:00:00.000000'; + } + //Station name $this->addElement('text', 'stationName', array( 'class' => 'input_text', 'label' => 'Station Name', - 'required' => true, + 'required' => false, 'filters' => array('StringTrim'), - 'validators' => array('NotEmpty'), 'value' => Application_Model_Preference::GetValue("station_name"), 'decorators' => array( 'ViewHelper' ) )); - - $defaultFade = Application_Model_Preference::GetDefaultFade(); - if($defaultFade == ""){ - $defaultFade = '00:00:00.000000'; - } - + //Default station fade $this->addElement('text', 'stationDefaultFade', array( 'class' => 'input_text', diff --git a/airtime_mvc/application/forms/Preferences.php b/airtime_mvc/application/forms/Preferences.php index 963a58717..0fa9f0b58 100644 --- a/airtime_mvc/application/forms/Preferences.php +++ b/airtime_mvc/application/forms/Preferences.php @@ -18,8 +18,8 @@ class Application_Form_Preferences extends Zend_Form $soundcloud_pref = new Application_Form_SoundcloudPreferences(); $this->addSubForm($soundcloud_pref, 'preferences_soundcloud'); - $support_pref = new Application_Form_SupportPreferences(); - $this->addSubForm($support_pref, 'preferences_support'); + /*$support_pref = new Application_Form_SupportPreferences(); + $this->addSubForm($support_pref, 'preferences_support');*/ $this->addElement('submit', 'submit', array( 'class' => 'ui-button ui-state-default right-floated', diff --git a/airtime_mvc/application/forms/SupportPreferences.php b/airtime_mvc/application/forms/SupportSettings.php similarity index 81% rename from airtime_mvc/application/forms/SupportPreferences.php rename to airtime_mvc/application/forms/SupportSettings.php index 62c6496cf..ef6b9f2fa 100644 --- a/airtime_mvc/application/forms/SupportPreferences.php +++ b/airtime_mvc/application/forms/SupportSettings.php @@ -1,6 +1,6 @@ setDecorators(array( - array('ViewScript', array('viewScript' => 'form/preferences_support.phtml')), - array('File', array('viewScript' => 'form/preferences_support.phtml', 'placement' => false))) + array('ViewScript', array('viewScript' => 'form/support-setting.phtml')), + array('File', array('viewScript' => 'form/support-setting.phtml', 'placement' => false))) ); + + //Station name + $this->addElement('text', 'stationName', array( + 'class' => 'input_text', + 'label' => 'Station Name', + 'required' => true, + 'filters' => array('StringTrim'), + 'validator' => array('NotEmpty'), + 'value' => Application_Model_Preference::GetValue("station_name"), + 'decorators' => array( + 'ViewHelper' + ) + )); // Phone number $this->addElement('text', 'Phone', array( @@ -134,18 +147,26 @@ class Application_Form_SupportPreferences extends Zend_Form_SubForm $checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's privacy policy.") ->setDecorators(array('ViewHelper')); $this->addElement($checkboxPrivacy); + + // submit button + $submit = new Zend_Form_Element_Submit("submit"); + $submit->class = 'ui-button ui-state-default right-floated'; + $submit->setIgnore(true) + ->setLabel("Submit") + ->setDecorators(array('ViewHelper')); + $this->addElement($submit); } // overwriting isValid function public function isValid ($data) { - parent::isValid($data); + $isValid = parent::isValid($data); $checkPrivacy = $this->getElement('Privacy'); if($data["SupportFeedback"] == "1" && $data["Privacy"] != "1"){ $checkPrivacy->addError("You have to agree to privacy policy."); - return false; + $isValid = false; } - return true; + return $isValid; } } diff --git a/airtime_mvc/application/models/Dashboard.php b/airtime_mvc/application/models/Dashboard.php index 1234c96e2..dfdc97acd 100644 --- a/airtime_mvc/application/models/Dashboard.php +++ b/airtime_mvc/application/models/Dashboard.php @@ -23,10 +23,14 @@ class Application_Model_Dashboard } } else { if (count($row) == 0){ - //last item is a show instance - return array("name"=>$showInstance->getName(), - "starts"=>$showInstance->getShowStart(), - "ends"=>$showInstance->getShowEnd()); + if ($showInstance->isRecorded()){ + //last item is a show instance + return array("name"=>$showInstance->getName(), + "starts"=>$showInstance->getShowStart(), + "ends"=>$showInstance->getShowEnd()); + } else { + return null; + } } else { //return the one that started later. if ($row[0]["starts"] >= $showInstance->getShowStart()){ @@ -69,11 +73,15 @@ class Application_Model_Dashboard } else { if (count($row) == 0){ //last item is a show instance - return array("name"=>$showInstance->getName(), - "starts"=>$showInstance->getShowStart(), - "ends"=>$showInstance->getShowEnd(), - "media_item_played"=>false, - "record"=>$showInstance->isRecorded()); + if ($showInstance->isRecorded()){ + return array("name"=>$showInstance->getName(), + "starts"=>$showInstance->getShowStart(), + "ends"=>$showInstance->getShowEnd(), + "media_item_played"=>false, + "record"=>true); + } else { + return null; + } } else { return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"], "starts"=>$row[0]["starts"], @@ -103,10 +111,14 @@ class Application_Model_Dashboard } } else { if (count($row) == 0){ - //last item is a show instance - return array("name"=>$showInstance->getName(), - "starts"=>$showInstance->getShowStart(), - "ends"=>$showInstance->getShowEnd()); + if ($showInstance->isRecorded()){ + //last item is a show instance + return array("name"=>$showInstance->getName(), + "starts"=>$showInstance->getShowStart(), + "ends"=>$showInstance->getShowEnd()); + } else { + return null; + } } else { //return the one that starts sooner. diff --git a/airtime_mvc/application/views/scripts/form/preferences.phtml b/airtime_mvc/application/views/scripts/form/preferences.phtml index f1a8be62b..d6d20ea00 100644 --- a/airtime_mvc/application/views/scripts/form/preferences.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences.phtml @@ -9,11 +9,6 @@ element->getSubform('preferences_soundcloud') ?> -

Support Settings

- -
element->getElement('submit') ?>
diff --git a/airtime_mvc/application/views/scripts/form/preferences_general.phtml b/airtime_mvc/application/views/scripts/form/preferences_general.phtml index 21df5c566..b085f25f3 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_general.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_general.phtml @@ -1,9 +1,7 @@
-
-
diff --git a/airtime_mvc/application/views/scripts/form/preferences_support.phtml b/airtime_mvc/application/views/scripts/form/support-setting.phtml similarity index 88% rename from airtime_mvc/application/views/scripts/form/preferences_support.phtml rename to airtime_mvc/application/views/scripts/form/support-setting.phtml index d0e100f42..bb24b89ed 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_support.phtml +++ b/airtime_mvc/application/views/scripts/form/support-setting.phtml @@ -30,10 +30,25 @@ -
-
-

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

- +

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

+
+ \ No newline at end of file diff --git a/airtime_mvc/application/views/scripts/preference/support-setting.phtml b/airtime_mvc/application/views/scripts/preference/support-setting.phtml new file mode 100644 index 000000000..1bc60e81e --- /dev/null +++ b/airtime_mvc/application/views/scripts/preference/support-setting.phtml @@ -0,0 +1,12 @@ +
+

Support Settings

+
+
+ statusMsg ?> + form ?> +
+
+ form->getElement('submit') ?> +
+
+
diff --git a/airtime_mvc/public/js/airtime/preferences/preferences.js b/airtime_mvc/public/js/airtime/preferences/preferences.js index 8a77bb68a..d1d2585be 100644 --- a/airtime_mvc/public/js/airtime/preferences/preferences.js +++ b/airtime_mvc/public/js/airtime/preferences/preferences.js @@ -4,39 +4,9 @@ function showErrorSections() { $("#soundcloud-settings").show(); $(window).scrollTop($("soundcloud-settings .errors").position().top); } - if($("#support-settings .errors").length > 0) { - $("#support-settings").show(); - $(window).scrollTop($("#support-settings .errors").position().top); - } -} - -function resizeImg(ele){ - var img = $(ele); - - var width = ele.width; - var height = ele.height; - - // resize img proportionaly - if( width > height && width > 450){ - var ratio = 450/width; - img.css("width", "450px"); - var newHeight = height * ratio; - img.css("height", newHeight ); - - }else if( width < height && height > 450){ - var ratio = 450/height; - img.css("height", "450px"); - var newWidth = width * ratio; - img.css("width", newWidth ); - }else if( width == height && width > 450){ - img.css("height", "450px"); - img.css("width", "450px" ); - } - } $(document).ready(function() { - var form = $("form"); $('.collapsible-header').live('click',function() { $(this).next().toggle('fast'); @@ -44,36 +14,5 @@ $(document).ready(function() { return false; }).next().hide(); - $("#SupportFeedback").click( function(){ - var pub = $("#Publicise"); - if( !$(this).is(':checked') ){ - pub.removeAttr("checked"); - pub.attr("disabled", true); - }else{ - pub.removeAttr("disabled"); - } - }); - - var promote = $("#Publicise"); - if(!$("#SupportFeedback").is(':checked')){ - promote.removeAttr("checked"); - promote.attr("disabled", true); - } - promote.live('click', function(){ - if($(this).is(':checked')){ - $("#public-info").show(); - }else{ - $("#public-info").hide(); - } - }); - if( promote.is(":checked")){ - $("#public-info").show(); - } - showErrorSections(); - - $('.toggle legend').click(function() { - $('.toggle').toggleClass('closed'); - return false; - }); }); diff --git a/airtime_mvc/public/js/airtime/preferences/support-setting.js b/airtime_mvc/public/js/airtime/preferences/support-setting.js new file mode 100644 index 000000000..d22ee962c --- /dev/null +++ b/airtime_mvc/public/js/airtime/preferences/support-setting.js @@ -0,0 +1,73 @@ +function showErrorSections() { + + if($("soundcloud-settings .errors").length > 0) { + $("#soundcloud-settings").show(); + $(window).scrollTop($("soundcloud-settings .errors").position().top); + } + if($("#support-settings .errors").length > 0) { + $("#support-settings").show(); + $(window).scrollTop($("#support-settings .errors").position().top); + } +} + +function resizeImg(ele){ + var img = $(ele); + + var width = ele.width; + var height = ele.height; + + // resize img proportionaly + if( width > height && width > 450){ + var ratio = 450/width; + img.css("width", "450px"); + var newHeight = height * ratio; + img.css("height", newHeight ); + + }else if( width < height && height > 450){ + var ratio = 450/height; + img.css("height", "450px"); + var newWidth = width * ratio; + img.css("width", newWidth ); + }else if( width == height && width > 450){ + img.css("height", "450px"); + img.css("width", "450px" ); + } + +} + +$(document).ready(function() { + var form = $("form"); + + $("#SupportFeedback").click( function(){ + var pub = $("#Publicise"); + if( !$(this).is(':checked') ){ + pub.removeAttr("checked"); + pub.attr("disabled", true); + }else{ + pub.removeAttr("disabled"); + } + }); + + var promote = $("#Publicise"); + if(!$("#SupportFeedback").is(':checked')){ + promote.removeAttr("checked"); + promote.attr("disabled", true); + } + promote.live('click', function(){ + if($(this).is(':checked')){ + $("#public-info").show(); + }else{ + $("#public-info").hide(); + } + }); + if( promote.is(":checked")){ + $("#public-info").show(); + } + + showErrorSections(); + + $('.toggle legend').click(function() { + $('.toggle').toggleClass('closed'); + return false; + }); +}); diff --git a/install_minimal/DoctrineMigrations/Version20110711161043.php b/install_minimal/DoctrineMigrations/Version20110711161043.php index 4a0bed554..c0bcf1c68 100644 --- a/install_minimal/DoctrineMigrations/Version20110711161043.php +++ b/install_minimal/DoctrineMigrations/Version20110711161043.php @@ -28,6 +28,13 @@ class Version20110711161043 extends AbstractMigration $cc_files->addNamedForeignKeyConstraint('cc_music_dirs_folder_fkey', $cc_music_dirs, array('directory'), array('id'), array('onDelete' => 'CASCADE')); + // before 3) we have to delete all entries in cc_schedule with file_id that are not in cc_file table + $this->_addSql("DELETE FROM cc_schedule WHERE cc_schedule.id IN( + SELECT cc_schedule.id + FROM cc_schedule + LEFT JOIN cc_files + ON cc_schedule.file_id = cc_files.id + WHERE cc_files.id IS NULL)"); /* 3) create a foreign key relationship from cc_schedule to cc_files */ $cc_schedule = $schema->getTable('cc_schedule'); $cc_schedule->addNamedForeignKeyConstraint('cc_files_folder_fkey', $cc_files, array('file_id'), array('id'), array('onDelete' => 'CASCADE')); diff --git a/install_minimal/airtime-install b/install_minimal/airtime-install index cc104e775..d1e5afa67 100755 --- a/install_minimal/airtime-install +++ b/install_minimal/airtime-install @@ -1,5 +1,11 @@ #!/bin/bash +DEB=$(dpkg -s airtime 2> /dev/null | grep Status) +if [[ "$DEB" = "Status: install ok installed" ]]; then + echo -e "\nDebian package of Airtime detected. Please use the debian package to upgrade.\n" + exit 1 +fi + echo -e "\n******************************** Install Begin *********************************" # Absolute path to this script @@ -8,6 +14,7 @@ SCRIPT=`readlink -f $0` SCRIPTPATH=`dirname $SCRIPT` VIRTUAL_ENV_DIR="/usr/lib/airtime/airtime_virtualenv" +VIRTUAL_ENV_SHARE="/usr/share/python-virtualenv/" if [ ! -d "$VIRTUAL_ENV_DIR" ]; then echo -e "\n*** Creating Virtualenv for Airtime ***" EXTRAOPTION=$(virtualenv --help | grep extra-search-dir) @@ -15,9 +22,11 @@ if [ ! -d "$VIRTUAL_ENV_DIR" ]; then if [ "$?" -eq "0" ]; then sudo virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv else - # copy distibute-0.6.10.tar.gz to /usr/share/python-virtualenv/ + # copy distribute-0.6.10.tar.gz to /usr/share/python-virtualenv/ # this is due to the bug in virtualenv 1.4.9 - cp ${SCRIPTPATH}/3rd_party/distribute-0.6.10.tar.gz /usr/share/python-virtualenv/ + if [ -d "$VIRTUAL_ENV_SHARE" ]; then + cp ${SCRIPTPATH}/3rd_party/distribute-0.6.10.tar.gz /usr/share/python-virtualenv/ + fi sudo virtualenv --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv fi diff --git a/install_minimal/include/AirtimeInstall.php b/install_minimal/include/AirtimeInstall.php index 78371447f..50da8b498 100644 --- a/install_minimal/include/AirtimeInstall.php +++ b/install_minimal/include/AirtimeInstall.php @@ -341,6 +341,10 @@ class AirtimeInstall echo "* Installing airtime-check-system".PHP_EOL; $dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-check-system"; exec("ln -s $dir /usr/bin/airtime-check-system"); + + echo "* Installing airtime-user".PHP_EOL; + $dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-user"; + exec("ln -s $dir /usr/bin/airtime-user"); } public static function RemoveSymlinks() diff --git a/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php b/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php index dfaff0944..db7e97bb9 100644 --- a/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php +++ b/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php @@ -20,6 +20,14 @@ const CONF_DIR_BINARIES = "/usr/lib/airtime"; class AirtimeInstall{ const CONF_DIR_LOG = "/var/log/airtime"; + const CONF_DIR_BINARIES = "/usr/lib/airtime"; + + public static function CreateSymlinksToUtils() + { + echo "* Installing airtime-user".PHP_EOL; + $dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-user"; + exec("ln -s $dir /usr/bin/airtime-user"); + } public static function CreateZendPhpLogFile(){ global $CC_CONFIG; diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index ccbfeb909..7456a3550 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -21,7 +21,7 @@ from urlparse import urlparse import base64 from configobj import ConfigObj -AIRTIME_VERSION = "1.9.0-devel" +AIRTIME_VERSION = "1.9.1" def api_client_factory(config): logger = logging.getLogger() diff --git a/utils/airtime-check-system b/utils/airtime-check-system index 7a67e6845..164fac6f9 100755 --- a/utils/airtime-check-system +++ b/utils/airtime-check-system @@ -21,7 +21,7 @@ # #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- -# This script cleans audio files in Airtime. +# This script for a correct system environment for Airtime. # # Absolute path to this script SCRIPT=`readlink -f $0` diff --git a/utils/airtime-user b/utils/airtime-user new file mode 100755 index 000000000..b6a30ac17 --- /dev/null +++ b/utils/airtime-user @@ -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 creates users 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 airtime-user.php "$@" || exit 1 diff --git a/utils/airtime-user.php b/utils/airtime-user.php old mode 100755 new mode 100644 index 6e0cca3a0..30ad66c39 --- a/utils/airtime-user.php +++ b/utils/airtime-user.php @@ -1,12 +1,14 @@ -#!/usr/bin/php setLastName($line); do{ - echo "Enter user type [(A)dmin|(H)ost|(G)uest]: "; + echo "Enter user type [(A)dmin|(P)rogram Manager|(D)J|(G)uest]: "; $line = trim(fgets(fopen("php://stdin","r"))); - } while($line != "A" && $line != "H" && $line != "G"); - $user->setType($line); + } while($line != "A" && $line != "P" && $line != "D" && $line != "G"); + + $types = array("A"=>"A", "P"=>"P", "D"=>"H", "G"=>"G",); + $user->setType($types[$line]); $user->save(); } elseif ($action == "delete") { @@ -115,3 +119,15 @@ if ($action == "addupdate") { $user->delete(); } } + +function GetAirtimeConf() +{ + $ini = parse_ini_file("/etc/airtime/airtime.conf", true); + + if ($ini === false){ + echo "Error reading /etc/airtime/airtime.conf.".PHP_EOL; + exit; + } + + return $ini; +}