-
Notifications
You must be signed in to change notification settings - Fork 3
/
provider_setup.php
158 lines (133 loc) · 5.52 KB
/
provider_setup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <[email protected]>
Portions created by the Initial Developer are Copyright (C) 2023
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <[email protected]>
*/
//includes files
require_once dirname(__DIR__, 2) . "/resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('provider_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//connect to the database
$database = database::new();
//get the provider
if (isset($_GET['id'])) {
//get the provider id
$id = $_GET['id'];
//add the provider
$provider = new providers;
$provider->id = $id;
$provider->setup();
//set the add message
message::add($text['message-add']);
//redirect the user
header("Location: providers.php");
return;
}
//provider selection
$provider_list = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/*/resources/providers/settings.php");
foreach ($provider_list as $setting_path) {
include($setting_path);
}
//installed providers
$sql = "select provider_uuid from v_providers ";
$database_providers = $database->select($sql, null, 'all');
//loop through installed providers
$x = 0;
foreach ($array['providers'] as $row) {
foreach ($database_providers as $field) {
if ($row['provider_uuid'] == $field['provider_uuid']) {
$array['providers'][$x]['provider_installed'] = 'true';
}
}
$x++;
}
unset($sql);
//include header
$document['title'] = $text['title-providers'];
require_once "resources/header.php";
//show the content
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title-providers']."</b></div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'providers.php'.(!empty($page) && is_numeric($page) ? '?page='.$page : null)]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
//providers
echo "<div class='card'>\n";
foreach ($array['providers'] as $row) {
echo "<div class='row'>\n";
echo " <div class='col-sm-4' style='padding-top: 0px;'>\n";
echo " <br><br>\n";
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/providers/resources/images/".$row['provider_name'].".png")) {
echo " <a href='".$row['provider_website']."' target='_blank'>\n";
echo " <img src='/app/providers/resources/images/".$row['provider_name'].".png' style='width: 200px;' class='center-block img-responsive'><br>\n";
echo " </a>\n";
}
else {
echo " <h2>".$row['provider_name']."</h2>\n";
}
echo " </div>\n";
echo " <div class='col-sm-8' style='padding-top: 0px;'>\n";
echo " <br><br>\n";
echo " <strong>".escape($text['label-features'] ?? '')."</strong><br>\n";
echo " ".escape($row['provider_description'] ?? '')."\n";
echo " <br><br>\n";
echo " <strong>".$text['label-region']."</strong><br>\n";
echo " ".escape($row['provider_region'] ?? '')."\n";
echo " <br><br>\n";
//echo " <strong>".$text['label-about']."</strong><br>\n";
//echo " ".$row['provider_about']."\n";
//echo " <br><br>\n";
if (isset($row['provider_website']) && strlen($row['provider_website']) > 0) {
echo " <a href='".$row['provider_website']."' target='_blank'><button type=\"button\" class=\"btn btn-success\">".$text['button-website']."</button></a>\n";
}
//echo " <a href='http://skye.tel/fusion-pricing' target='_blank'><button type=\"button\" class=\"btn btn-success\">".$text['button-pricing']."</button></a>\n";
if (isset($row['provider_signup']) && strlen($row['provider_signup']) > 0) {
echo " <a href='".$row['provider_signup']."' target='_blank'><button type=\"button\" class=\"btn btn-primary\">".$text['button-signup']."</button></a>\n";
}
if (!empty($row['provider_installed']) && $row['provider_installed'] == 'true') {
echo " <a href=\"#\" onclick=\"\"><button type=\"button\" class=\"btn btn-success\">".$text['label-installed']."</button></a>\n";
//echo " <a href=\"provider_delete.php?provider_uuid=".$row['provider_uuid']."\" onclick=\"return confirm(".$text['confirm-delete'].")\"><button type=\"button\" class=\"btn btn-danger\">".$text['button-remove']."</button></a>\n";
}
else {
echo " <a href=\"provider_setup.php?id=".md5($row['provider_name'])."\" onclick=\"return confirm(".$text['confirm-setup'].")\"><button type=\"button\" class=\"btn btn-success\">".$text['button-setup']."</button></a>\n";
//echo " <button type=\"button\" onclick=\"window.location='provider_setup.php?provider=skyetel'\" class=\"btn btn-primary\">".$text['button-setup']."</button>\n";
}
echo " </div>\n";
echo "</div>\n";
echo "<div style='clear: both;'></div>\n";
echo "<br/><br/><hr /><br/>\n";
}
echo "</div>\n";
echo "<br><br>\n";
echo "<hr>\n";
echo "<br>\n";
//include the footer
require_once "resources/footer.php";
?>