|
@@ -40,14 +40,14 @@
|
|
}
|
|
}
|
|
|
|
|
|
//change the domain
|
|
//change the domain
|
|
- if (is_uuid($_GET["domain_uuid"]) && $_GET["domain_change"] == "true") {
|
|
|
|
|
|
+ if (!empty($_GET["domain_uuid"]) && is_uuid($_GET["domain_uuid"]) && $_GET["domain_change"] == "true") {
|
|
if (permission_exists('domain_select')) {
|
|
if (permission_exists('domain_select')) {
|
|
//get the domain_uuid
|
|
//get the domain_uuid
|
|
$sql = "select * from v_domains ";
|
|
$sql = "select * from v_domains ";
|
|
$sql .= "order by domain_name asc ";
|
|
$sql .= "order by domain_name asc ";
|
|
$database = new database;
|
|
$database = new database;
|
|
$result = $database->select($sql, null, 'all');
|
|
$result = $database->select($sql, null, 'all');
|
|
- if (is_array($result) && sizeof($result) != 0) {
|
|
|
|
|
|
+ if (!empty($result)) {
|
|
foreach($result as $row) {
|
|
foreach($result as $row) {
|
|
if (count($result) == 0) {
|
|
if (count($result) == 0) {
|
|
$_SESSION["domain_uuid"] = $row["domain_uuid"];
|
|
$_SESSION["domain_uuid"] = $row["domain_uuid"];
|
|
@@ -79,7 +79,7 @@
|
|
$domain->set();
|
|
$domain->set();
|
|
|
|
|
|
//redirect the user
|
|
//redirect the user
|
|
- if ($_SESSION["login"]["destination"] != '') {
|
|
|
|
|
|
+ if (!empty($_SESSION["login"]["destination"])) {
|
|
// to default, or domain specific, login destination
|
|
// to default, or domain specific, login destination
|
|
header("Location: ".PROJECT_PATH.$_SESSION["login"]["destination"]["url"]);
|
|
header("Location: ".PROJECT_PATH.$_SESSION["login"]["destination"]["url"]);
|
|
}
|
|
}
|
|
@@ -104,14 +104,14 @@
|
|
$text = $language->get();
|
|
$text = $language->get();
|
|
|
|
|
|
//get the http post data
|
|
//get the http post data
|
|
- if (is_array($_POST['domains'])) {
|
|
|
|
- $action = $_POST['action'];
|
|
|
|
- $search = $_POST['search'];
|
|
|
|
- $domains = $_POST['domains'];
|
|
|
|
|
|
+ if (!empty($_POST['domains'])) {
|
|
|
|
+ $action = $_POST['action'] ?? '';
|
|
|
|
+ $search = $_POST['search'] ?? '';
|
|
|
|
+ $domains = $_POST['domains'] ?? '';
|
|
}
|
|
}
|
|
|
|
|
|
//process the http post data by action
|
|
//process the http post data by action
|
|
- if ($action != '' && is_array($domains) && @sizeof($domains) != 0) {
|
|
|
|
|
|
+ if (!empty($action) && !empty($domains)) {
|
|
switch ($action) {
|
|
switch ($action) {
|
|
case 'copy':
|
|
case 'copy':
|
|
if (permission_exists('domain_add')) {
|
|
if (permission_exists('domain_add')) {
|
|
@@ -133,16 +133,23 @@
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- header('Location: domains.php'.($search != '' ? '?search='.urlencode($search) : null));
|
|
|
|
|
|
+ header('Location: domains.php'.(!empty($search) ? '?search='.urlencode($search) : null));
|
|
exit;
|
|
exit;
|
|
}
|
|
}
|
|
|
|
|
|
-//get order and order by
|
|
|
|
- $order_by = $_GET["order_by"];
|
|
|
|
- $order = $_GET["order"];
|
|
|
|
|
|
+//get order and order by and sanitize the values
|
|
|
|
+ $order_by = $_GET["order_by"] ?? '';
|
|
|
|
+ $order = $_GET["order"] ?? '';
|
|
|
|
+
|
|
|
|
+//set additional variables
|
|
|
|
+ $search = $_GET["search"] ?? '';
|
|
|
|
+ $show = $_GET["show"] ?? '';
|
|
|
|
+
|
|
|
|
+//set from session variables
|
|
|
|
+ $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
|
|
|
|
|
//add the search string
|
|
//add the search string
|
|
- if (isset($_GET["search"])) {
|
|
|
|
|
|
+ if (!empty($search)) {
|
|
$search = strtolower($_GET["search"]);
|
|
$search = strtolower($_GET["search"]);
|
|
$sql_search = " (";
|
|
$sql_search = " (";
|
|
$sql_search .= " lower(domain_name) like :search ";
|
|
$sql_search .= " lower(domain_name) like :search ";
|
|
@@ -153,16 +160,16 @@
|
|
|
|
|
|
//get the count
|
|
//get the count
|
|
$sql = "select count(domain_uuid) from v_domains ";
|
|
$sql = "select count(domain_uuid) from v_domains ";
|
|
- if (isset($sql_search)) {
|
|
|
|
|
|
+ if (!empty($sql_search)) {
|
|
$sql .= "where ".$sql_search;
|
|
$sql .= "where ".$sql_search;
|
|
}
|
|
}
|
|
$database = new database;
|
|
$database = new database;
|
|
- $num_rows = $database->select($sql, $parameters, 'column');
|
|
|
|
|
|
+ $num_rows = $database->select($sql, $parameters ?? null, 'column');
|
|
|
|
|
|
//prepare to page the results
|
|
//prepare to page the results
|
|
- $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
|
|
|
|
|
+ $rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
|
$param = $search ? "&search=".$search : null;
|
|
$param = $search ? "&search=".$search : null;
|
|
- $page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
|
|
|
|
|
|
+ $page = !empty($_GET['page']) ? $_GET['page'] : 0;
|
|
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
|
|
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
|
|
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
|
|
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
|
|
$offset = $rows_per_page * $page;
|
|
$offset = $rows_per_page * $page;
|
|
@@ -170,13 +177,13 @@
|
|
//get the list
|
|
//get the list
|
|
$sql = "select domain_uuid, domain_name, cast(domain_enabled as text), domain_description ";
|
|
$sql = "select domain_uuid, domain_name, cast(domain_enabled as text), domain_description ";
|
|
$sql .= "from v_domains ";
|
|
$sql .= "from v_domains ";
|
|
- if (isset($sql_search)) {
|
|
|
|
|
|
+ if (!empty($sql_search)) {
|
|
$sql .= "where ".$sql_search;
|
|
$sql .= "where ".$sql_search;
|
|
}
|
|
}
|
|
$sql .= order_by($order_by, $order, 'domain_name', 'asc');
|
|
$sql .= order_by($order_by, $order, 'domain_name', 'asc');
|
|
$sql .= limit_offset($rows_per_page, $offset);
|
|
$sql .= limit_offset($rows_per_page, $offset);
|
|
$database = new database;
|
|
$database = new database;
|
|
- $domains = $database->select($sql, $parameters, 'all');
|
|
|
|
|
|
+ $domains = $database->select($sql, $parameters ?? null, 'all');
|
|
unset($sql, $parameters);
|
|
unset($sql, $parameters);
|
|
|
|
|
|
//create token
|
|
//create token
|
|
@@ -204,7 +211,7 @@
|
|
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
|
|
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
|
|
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']);
|
|
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']);
|
|
//echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'domains.php','style'=>($search == '' ? 'display: none;' : null)]);
|
|
//echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'domains.php','style'=>($search == '' ? 'display: none;' : null)]);
|
|
- if ($paging_controls_mini != '') {
|
|
|
|
|
|
+ if (!empty($paging_controls_mini)) {
|
|
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
|
|
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
|
|
}
|
|
}
|
|
echo " </form>\n";
|
|
echo " </form>\n";
|
|
@@ -212,10 +219,10 @@
|
|
echo " <div style='clear: both;'></div>\n";
|
|
echo " <div style='clear: both;'></div>\n";
|
|
echo "</div>\n";
|
|
echo "</div>\n";
|
|
|
|
|
|
- if (permission_exists('domain_edit') && $domains) {
|
|
|
|
|
|
+ if (permission_exists('domain_edit') && !empty($domains)) {
|
|
echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('toggle'); list_form_submit('form_list');"])]);
|
|
echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('toggle'); list_form_submit('form_list');"])]);
|
|
}
|
|
}
|
|
- if (permission_exists('domain_delete') && $domains) {
|
|
|
|
|
|
+ if (permission_exists('domain_delete') && !empty($domains)) {
|
|
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
|
|
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -230,24 +237,25 @@
|
|
echo "<tr class='list-header'>\n";
|
|
echo "<tr class='list-header'>\n";
|
|
if (permission_exists('domain_edit') || permission_exists('domain_delete')) {
|
|
if (permission_exists('domain_edit') || permission_exists('domain_delete')) {
|
|
echo " <th class='checkbox'>\n";
|
|
echo " <th class='checkbox'>\n";
|
|
- echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($domains ?: "style='visibility: hidden;'").">\n";
|
|
|
|
|
|
+ echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(!empty($domains) ?: "style='visibility: hidden;'").">\n";
|
|
echo " </th>\n";
|
|
echo " </th>\n";
|
|
}
|
|
}
|
|
- if ($_GET['show'] == 'all' && permission_exists('domain_all')) {
|
|
|
|
|
|
+ if ($show == 'all' && permission_exists('domain_all')) {
|
|
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
|
|
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
|
|
}
|
|
}
|
|
echo th_order_by('domain_name', $text['label-domain_name'], $order_by, $order);
|
|
echo th_order_by('domain_name', $text['label-domain_name'], $order_by, $order);
|
|
echo "<th class='center'>".$text['label-tools']."</th>";
|
|
echo "<th class='center'>".$text['label-tools']."</th>";
|
|
echo th_order_by('domain_enabled', $text['label-domain_enabled'], $order_by, $order, null, "class='center'");
|
|
echo th_order_by('domain_enabled', $text['label-domain_enabled'], $order_by, $order, null, "class='center'");
|
|
echo " <th class='hide-sm-dn'>".$text['label-domain_description']."</th>\n";
|
|
echo " <th class='hide-sm-dn'>".$text['label-domain_description']."</th>\n";
|
|
- if (permission_exists('domain_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
|
|
|
|
|
+ if (permission_exists('domain_edit') && $list_row_edit_button == 'true') {
|
|
echo " <td class='action-button'> </td>\n";
|
|
echo " <td class='action-button'> </td>\n";
|
|
}
|
|
}
|
|
echo "</tr>\n";
|
|
echo "</tr>\n";
|
|
|
|
|
|
- if (is_array($domains) && @sizeof($domains) != 0) {
|
|
|
|
|
|
+ if (!empty($domains)) {
|
|
$x = 0;
|
|
$x = 0;
|
|
foreach ($domains as $row) {
|
|
foreach ($domains as $row) {
|
|
|
|
+ $list_row_url = '';
|
|
if (permission_exists('domain_edit')) {
|
|
if (permission_exists('domain_edit')) {
|
|
$list_row_url = "domain_edit.php?id=".urlencode($row['domain_uuid']);
|
|
$list_row_url = "domain_edit.php?id=".urlencode($row['domain_uuid']);
|
|
}
|
|
}
|
|
@@ -258,7 +266,7 @@
|
|
echo " <input type='hidden' name='domains[$x][uuid]' value='".escape($row['domain_uuid'])."' />\n";
|
|
echo " <input type='hidden' name='domains[$x][uuid]' value='".escape($row['domain_uuid'])."' />\n";
|
|
echo " </td>\n";
|
|
echo " </td>\n";
|
|
}
|
|
}
|
|
- if ($_GET['show'] == 'all' && permission_exists('domain_all')) {
|
|
|
|
|
|
+ if ($show == 'all' && permission_exists('domain_all')) {
|
|
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
|
|
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
|
|
}
|
|
}
|
|
echo " <td>\n";
|
|
echo " <td>\n";
|
|
@@ -287,7 +295,7 @@
|
|
echo " </td>\n";
|
|
echo " </td>\n";
|
|
}
|
|
}
|
|
echo " <td class='description overflow hide-sm-dn'>".escape($row['domain_description'])."</td>\n";
|
|
echo " <td class='description overflow hide-sm-dn'>".escape($row['domain_description'])."</td>\n";
|
|
- if (permission_exists('domain_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
|
|
|
|
|
+ if (permission_exists('domain_edit') && $list_row_edit_button == 'true') {
|
|
echo " <td class='action-button'>\n";
|
|
echo " <td class='action-button'>\n";
|
|
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
|
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
|
echo " </td>\n";
|
|
echo " </td>\n";
|