CMXX - Bugfixes

This commit is contained in:
“VeLiTi”
2024-10-03 16:01:14 +02:00
parent c42de76fb8
commit 7737be560c
3 changed files with 12 additions and 14 deletions

View File

@@ -1,18 +1,16 @@
<?php
defined(page_security_key) or exit;
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
// Configuration file
$file = './settings/settingsprofiles.php';
$page = 'profiles';
/*Check if allowed
//Check if allowed
if (isAllowed($page,$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
header('location: index.php');
exit;
}
*/
// Open the configuration file for reading
$contents = file_get_contents($file);
@@ -67,7 +65,7 @@ function format_tabs($contents) {
// Format form
function format_form($contents) {
$rows = explode("\n", $contents);
$form = '<div class="tab-content active">';
$form = '<div class="tab-content active">Each tab represents a profile. Each element in a profile represents a view and or API access.';
for ($i = 0; $i < count($rows); $i++) {
preg_match('/\/\*(.*?)\*\//', $rows[$i], $match);
if ($match) {
@@ -93,7 +91,7 @@ if (isset($_POST['submit']) && !empty($_POST)) {
foreach($profile_views as $profile_view){
$view_input .= $profile_view.',';
}
$view_input = substr($view_input,0,-1);
$view_input = "'".substr($view_input,0,-1)."'";
// Update the configuration file with the new keys and values
$contents = preg_replace('/define\(\'' . $profile_name . '\'\, ?(.*?)\)/s', 'define(\'' . $profile_name . '\',' . $view_input . ')', $contents);