diff --git a/utils/airtime-user b/utils/airtime-user deleted file mode 100755 index b6a30ac17..000000000 --- a/utils/airtime-user +++ /dev/null @@ -1,34 +0,0 @@ -#!/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 deleted file mode 100644 index 2ac5d3bb5..000000000 --- a/utils/airtime-user.php +++ /dev/null @@ -1,148 +0,0 @@ -\n"; - echo " Add the user or update user information.\n"; - echo " --delete \n"; - echo " Remove the user.\n"; - echo "\n"; -} - -/** - * Ensures that the user is running this PHP script with root - * permissions. If not running with root permissions, causes the - * script to exit. - */ -function exitIfNotRoot() -{ - // Need to check that we are superuser before running this. - if(exec("whoami") != "root"){ - echo "Must be root user.\n"; - exit(1); - } -} - -if (count($argv) != 3) { - printUsage(); - exit; -} - - -$action = null; -switch ($argv[1]) { - case '--addupdate': - $action = "addupdate"; - break; - case '--delete': - $action = "delete"; - break; -} - -$username = $argv[2]; - -if (is_null($action)) { - printUsage(); - exit; -} - -PEAR::setErrorHandling(PEAR_ERROR_RETURN); -$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE); -if (PEAR::isError($CC_DBC)) { - die($CC_DBC->getMessage()); -} -$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); - - -// Check if the user exists -$id = Application_Model_User::GetUserID($username); - -if ($action == "addupdate") { - - if ($id < 0) { - echo "Creating user\n"; - $user = new Application_Model_User(""); - $user->setLogin($username); - } else { - echo "Updating user\n"; - $user = new Application_Model_User($id); - } - - do{ - echo "Enter password (min 6 characters): "; - $line = trim(fgets(fopen("php://stdin","r"))); - }while(strlen($line) < 6); - $user->setPassword($line); - - do{ - echo "Enter first name: "; - $line = trim(fgets(fopen("php://stdin","r"))); - }while(strlen($line) < 1); - $user->setFirstName($line); - - do{ - echo "Enter last name: "; - $line = trim(fgets(fopen("php://stdin","r"))); - }while(strlen($line) < 1); - $user->setLastName($line); - - do{ - echo "Enter user type [(A)dmin|(P)rogram Manager|(D)J|(G)uest]: "; - $line = trim(fgets(fopen("php://stdin","r"))); - } 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") { - if ($id < 0){ - echo "Username not found!\n"; - exit; - } else { - echo "Deleting user\n"; - $user = new Application_Model_User($id); - $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; -}