Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
917af377
Commit
917af377
authored
Mar 14, 2016
by
Ad Schellevis
Committed by
Franco Fichtner
Mar 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whitespace / codestyle getserviceproviders.php
(cherry picked from commit
78354c7f
)
parent
79a08f87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
85 deletions
+85
-85
getserviceproviders.php
src/www/getserviceproviders.php
+85
-85
No files found.
src/www/getserviceproviders.php
View file @
917af377
...
@@ -40,105 +40,105 @@ $serviceproviders = &$serviceproviders_attr['serviceproviders']['country'];
...
@@ -40,105 +40,105 @@ $serviceproviders = &$serviceproviders_attr['serviceproviders']['country'];
function
get_country_providers
(
$country
)
function
get_country_providers
(
$country
)
{
{
global
$serviceproviders
;
global
$serviceproviders
;
foreach
(
$serviceproviders
as
$sp
)
{
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'
]);
return
is_array
(
$sp
[
'provider'
][
0
])
?
$sp
[
'provider'
]
:
array
(
$sp
[
'provider'
]);
}
}
}
}
return
$provider_list
;
return
$provider_list
;
}
}
function
country_list
()
function
country_list
()
{
{
global
$serviceproviders
;
global
$serviceproviders
;
$country_list
=
get_country_codes
();
$country_list
=
get_country_codes
();
foreach
(
$serviceproviders
as
$sp
)
{
foreach
(
$serviceproviders
as
$sp
)
{
foreach
(
$country_list
as
$code
=>
$country
)
{
foreach
(
$country_list
as
$code
=>
$country
)
{
if
(
strtoupper
(
$sp
[
'attr'
][
'code'
])
==
$code
)
{
if
(
strtoupper
(
$sp
[
'attr'
][
'code'
])
==
$code
)
{
echo
$country
.
":"
.
$code
.
"
\n
"
;
echo
$country
.
":"
.
$code
.
"
\n
"
;
}
}
}
}
}
}
}
}
function
providers_list
(
$country
)
{
function
providers_list
(
$country
)
$serviceproviders
=
get_country_providers
(
$country
);
{
foreach
(
$serviceproviders
as
$sp
)
{
$serviceproviders
=
get_country_providers
(
$country
);
echo
$sp
[
'name'
][
'value'
]
.
"
\n
"
;
foreach
(
$serviceproviders
as
$sp
)
{
}
echo
$sp
[
'name'
][
'value'
]
.
"
\n
"
;
}
}
}
function
provider_plan_data
(
$country
,
$provider
,
$connection
)
{
function
provider_plan_data
(
$country
,
$provider
,
$connection
)
{
header
(
"Content-type: application/xml;"
);
header
(
"Content-type: application/xml;"
);
echo
"<?xml version=
\"
1.0
\"
?>
\n
"
;
echo
"<?xml version=
\"
1.0
\"
?>
\n
"
;
echo
"<connection>
\n
"
;
echo
"<connection>
\n
"
;
$serviceproviders
=
get_country_providers
(
$country
);
$serviceproviders
=
get_country_providers
(
$country
);
foreach
(
$serviceproviders
as
$sp
)
{
foreach
(
$serviceproviders
as
$sp
)
{
if
(
strtolower
(
$sp
[
'name'
][
'value'
])
==
strtolower
(
$provider
))
{
if
(
strtolower
(
$sp
[
'name'
][
'value'
])
==
strtolower
(
$provider
))
{
if
(
strtoupper
(
$connection
)
==
"CDMA"
)
{
if
(
strtoupper
(
$connection
)
==
"CDMA"
)
{
$conndata
=
$sp
[
'cdma'
];
$conndata
=
$sp
[
'cdma'
];
}
else
{
}
else
{
if
(
!
is_array
(
$sp
[
'gsm'
][
'apn'
][
0
]))
{
if
(
!
is_array
(
$sp
[
'gsm'
][
'apn'
][
0
]))
{
$conndata
=
$sp
[
'gsm'
][
'apn'
];
$conndata
=
$sp
[
'gsm'
][
'apn'
];
}
else
{
}
else
{
foreach
(
$sp
[
'gsm'
][
'apn'
]
as
$apn
)
{
foreach
(
$sp
[
'gsm'
][
'apn'
]
as
$apn
)
{
if
(
$apn
[
'attr'
][
'value'
]
==
$connection
)
{
if
(
$apn
[
'attr'
][
'value'
]
==
$connection
)
{
$conndata
=
$apn
;
$conndata
=
$apn
;
break
;
break
;
}
}
}
}
}
}
}
}
if
(
is_array
(
$conndata
))
{
if
(
is_array
(
$conndata
))
{
echo
"<apn>"
.
$connection
.
"</apn>
\n
"
;
echo
"<apn>"
.
$connection
.
"</apn>
\n
"
;
echo
"<username>"
.
$conndata
[
'username'
][
'value'
]
.
"</username>
\n
"
;
echo
"<username>"
.
$conndata
[
'username'
][
'value'
]
.
"</username>
\n
"
;
echo
"<password>"
.
$conndata
[
'password'
][
'value'
]
.
"</password>
\n
"
;
echo
"<password>"
.
$conndata
[
'password'
][
'value'
]
.
"</password>
\n
"
;
$dns_arr
=
is_array
(
$conndata
[
'dns'
][
0
])
?
$conndata
[
'dns'
]
:
array
(
$conndata
[
'dns'
]
);
$dns_arr
=
is_array
(
$conndata
[
'dns'
][
0
])
?
$conndata
[
'dns'
]
:
array
(
$conndata
[
'dns'
]
);
foreach
(
$dns_arr
as
$dns
)
{
foreach
(
$dns_arr
as
$dns
)
{
echo
'<dns>'
.
$dns
[
'value'
]
.
"</dns>
\n
"
;
echo
'<dns>'
.
$dns
[
'value'
]
.
"</dns>
\n
"
;
}
}
}
}
break
;
break
;
}
}
}
}
echo
"</connection>"
;
echo
"</connection>"
;
}
}
function
provider_plans_list
(
$country
,
$provider
)
{
function
provider_plans_list
(
$country
,
$provider
)
{
$serviceproviders
=
get_country_providers
(
$country
);
$serviceproviders
=
get_country_providers
(
$country
);
foreach
(
$serviceproviders
as
$sp
)
{
foreach
(
$serviceproviders
as
$sp
)
{
if
(
strtolower
(
$sp
[
'name'
][
'value'
])
==
strtolower
(
$provider
))
{
if
(
strtolower
(
$sp
[
'name'
][
'value'
])
==
strtolower
(
$provider
))
{
if
(
array_key_exists
(
'gsm'
,
$sp
))
{
if
(
array_key_exists
(
'gsm'
,
$sp
))
{
if
(
array_key_exists
(
'attr'
,
$sp
[
'gsm'
][
'apn'
]))
{
if
(
array_key_exists
(
'attr'
,
$sp
[
'gsm'
][
'apn'
]))
{
$name
=
(
$sp
[
'gsm'
][
'apn'
][
'name'
]
?
$sp
[
'gsm'
][
'apn'
][
'name'
]
:
$sp
[
'name'
][
'value'
]);
$name
=
(
$sp
[
'gsm'
][
'apn'
][
'name'
]
?
$sp
[
'gsm'
][
'apn'
][
'name'
]
:
$sp
[
'name'
][
'value'
]);
echo
$name
.
":"
.
$sp
[
'gsm'
][
'apn'
][
'attr'
][
'value'
];
echo
$name
.
":"
.
$sp
[
'gsm'
][
'apn'
][
'attr'
][
'value'
];
}
else
{
}
else
{
foreach
(
$sp
[
'gsm'
][
'apn'
]
as
$apn_info
)
{
foreach
(
$sp
[
'gsm'
][
'apn'
]
as
$apn_info
)
{
$name
=
(
$apn_info
[
'name'
][
'value'
]
?
$apn_info
[
'name'
][
'value'
]
:
$apn_info
[
'gsm'
][
'apn'
][
'name'
]);
$name
=
(
$apn_info
[
'name'
][
'value'
]
?
$apn_info
[
'name'
][
'value'
]
:
$apn_info
[
'gsm'
][
'apn'
][
'name'
]);
echo
$name
.
":"
.
$apn_info
[
'attr'
][
'value'
]
.
"
\n
"
;
echo
$name
.
":"
.
$apn_info
[
'attr'
][
'value'
]
.
"
\n
"
;
}
}
}
}
}
}
if
(
array_key_exists
(
'cdma'
,
$sp
))
{
if
(
array_key_exists
(
'cdma'
,
$sp
))
{
$name
=
$sp
[
'cdma'
][
'name'
][
'value'
]
?
$sp
[
'cdma'
][
'name'
][
'value'
]
:
$sp
[
'name'
][
'value'
];
$name
=
$sp
[
'cdma'
][
'name'
][
'value'
]
?
$sp
[
'cdma'
][
'name'
][
'value'
]
:
$sp
[
'name'
][
'value'
];
echo
$name
.
":"
.
"CDMA"
;
echo
$name
.
":"
.
"CDMA"
;
}
}
}
}
}
}
}
}
$_GET_OR_POST
=
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
)
?
$_POST
:
$_GET
;
if
(
isset
(
$_REQUEST
[
'country'
])
&&
!
isset
(
$_REQUEST
[
'provider'
]))
{
providers_list
(
$_REQUEST
[
'country'
]);
if
(
isset
(
$_GET_OR_POST
[
'country'
])
&&
!
isset
(
$_GET_OR_POST
[
'provider'
]))
{
}
elseif
(
isset
(
$_REQUEST
[
'country'
])
&&
isset
(
$_REQUEST
[
'provider'
]))
{
providers_list
(
$_GET_OR_POST
[
'country'
]);
if
(
isset
(
$_REQUEST
[
'plan'
]))
{
}
elseif
(
isset
(
$_GET_OR_POST
[
'country'
])
&&
isset
(
$_GET_OR_POST
[
'provider'
]))
{
provider_plan_data
(
$_REQUEST
[
'country'
],
$_REQUEST
[
'provider'
],
$_REQUEST
[
'plan'
]);
if
(
isset
(
$_GET_OR_POST
[
'plan'
]))
}
else
{
provider_plan_data
(
$_GET_OR_POST
[
'country'
],
$_GET_OR_POST
[
'provider'
],
$_GET_OR_POST
[
'plan'
]);
provider_plans_list
(
$_REQUEST
[
'country'
],
$_REQUEST
[
'provider'
]);
else
}
provider_plans_list
(
$_GET_OR_POST
[
'country'
],
$_GET_OR_POST
[
'provider'
]);
}
else
{
}
else
{
country_list
();
country_list
();
}
}
?>
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment