Commit 917af377 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

whitespace / codestyle getserviceproviders.php

(cherry picked from commit 78354c7f)
parent 79a08f87
......@@ -42,7 +42,7 @@ function get_country_providers($country)
{
global $serviceproviders;
foreach($serviceproviders as $sp) {
if($sp['attr']['code'] == strtolower($country)) {
if ($sp['attr']['code'] == strtolower($country)) {
return is_array($sp['provider'][0]) ? $sp['provider'] : array($sp['provider']);
}
}
......@@ -62,7 +62,8 @@ function country_list()
}
}
function providers_list($country) {
function providers_list($country)
{
$serviceproviders = get_country_providers($country);
foreach($serviceproviders as $sp) {
echo $sp['name']['value'] . "\n";
......@@ -75,22 +76,22 @@ function provider_plan_data($country,$provider,$connection) {
echo "<connection>\n";
$serviceproviders = get_country_providers($country);
foreach($serviceproviders as $sp) {
if(strtolower($sp['name']['value']) == strtolower($provider)) {
if(strtoupper($connection) == "CDMA") {
if (strtolower($sp['name']['value']) == strtolower($provider)) {
if (strtoupper($connection) == "CDMA") {
$conndata = $sp['cdma'];
} else {
if(!is_array($sp['gsm']['apn'][0])) {
if (!is_array($sp['gsm']['apn'][0])) {
$conndata = $sp['gsm']['apn'];
} else {
foreach($sp['gsm']['apn'] as $apn) {
if($apn['attr']['value'] == $connection) {
if ($apn['attr']['value'] == $connection) {
$conndata = $apn;
break;
}
}
}
}
if(is_array($conndata)) {
if (is_array($conndata)) {
echo "<apn>" . $connection . "</apn>\n";
echo "<username>" . $conndata['username']['value'] . "</username>\n";
echo "<password>" . $conndata['password']['value'] . "</password>\n";
......@@ -109,9 +110,9 @@ function provider_plan_data($country,$provider,$connection) {
function provider_plans_list($country,$provider) {
$serviceproviders = get_country_providers($country);
foreach($serviceproviders as $sp) {
if(strtolower($sp['name']['value']) == strtolower($provider)) {
if(array_key_exists('gsm',$sp)) {
if(array_key_exists('attr',$sp['gsm']['apn'])) {
if (strtolower($sp['name']['value']) == strtolower($provider)) {
if (array_key_exists('gsm',$sp)) {
if (array_key_exists('attr',$sp['gsm']['apn'])) {
$name = ($sp['gsm']['apn']['name'] ? $sp['gsm']['apn']['name'] : $sp['name']['value']);
echo $name . ":" . $sp['gsm']['apn']['attr']['value'];
} else {
......@@ -121,7 +122,7 @@ function provider_plans_list($country,$provider) {
}
}
}
if(array_key_exists('cdma',$sp)) {
if (array_key_exists('cdma',$sp)) {
$name = $sp['cdma']['name']['value'] ? $sp['cdma']['name']['value']:$sp['name']['value'];
echo $name . ":" . "CDMA";
}
......@@ -129,15 +130,14 @@ function provider_plans_list($country,$provider) {
}
}
$_GET_OR_POST = ($_SERVER['REQUEST_METHOD'] === 'POST') ? $_POST : $_GET;
if(isset($_GET_OR_POST['country']) && !isset($_GET_OR_POST['provider'])) {
providers_list($_GET_OR_POST['country']);
} elseif(isset($_GET_OR_POST['country']) && isset($_GET_OR_POST['provider'])) {
if(isset($_GET_OR_POST['plan']))
provider_plan_data($_GET_OR_POST['country'],$_GET_OR_POST['provider'],$_GET_OR_POST['plan']);
else
provider_plans_list($_GET_OR_POST['country'],$_GET_OR_POST['provider']);
if (isset($_REQUEST['country']) && !isset($_REQUEST['provider'])) {
providers_list($_REQUEST['country']);
} elseif (isset($_REQUEST['country']) && isset($_REQUEST['provider'])) {
if (isset($_REQUEST['plan'])) {
provider_plan_data($_REQUEST['country'],$_REQUEST['provider'],$_REQUEST['plan']);
} else {
provider_plans_list($_REQUEST['country'],$_REQUEST['provider']);
}
} else {
country_list();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment