/usr/share/phpgacl/admin/acl_admin.php is in phpgacl 3.3.7-7.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | <?php
require_once('gacl_admin.inc.php');
if (!isset($_POST['action']) ) {
$_POST['action'] = FALSE;
}
if (!isset($_GET['action']) ) {
$_GET['action'] = FALSE;
}
switch ($_POST['action']) {
case 'Delete':
break;
case 'Submit':
$gacl_api->debug_text('Submit!!');
//showarray($_POST['selected_aco']);
//showarray($_POST['selected_aro']);
//Parse the form values
foreach (array('aco','aro','axo') as $type) {
$type_array = 'selected_'. $type .'_array';
$$type_array = array();
if (is_array($_POST['selected_'. $type])) {
foreach ($_POST['selected_'. $type] as $value) {
$split_value = explode('^', $value);
${$type_array}[$split_value[0]][] = $split_value[1];
}
}
//showarray($$type_array);
}
//Some sanity checks.
if (empty($selected_aco_array)) {
echo 'Must select at least one Access Control Object<br />' . "\n";
exit;
}
if (empty($selected_aro_array) AND empty($_POST['aro_groups'])) {
echo 'Must select at least one Access Request Object or Group<br />' . "\n";
exit;
}
$enabled = $_POST['enabled'];
if (empty($enabled)) {
$enabled = 0;
}
//function add_acl($aco_array, $aro_array, $aro_group_ids=NULL, $axo_array=NULL, $axo_group_ids=NULL, $allow=1, $enabled=1, $acl_id=FALSE ) {
if (!empty($_POST['acl_id'])) {
//Update existing ACL
$acl_id = $_POST['acl_id'];
if ($gacl_api->edit_acl($acl_id, $selected_aco_array, $selected_aro_array, $_POST['aro_groups'], $selected_axo_array, $_POST['axo_groups'], $_POST['allow'], $enabled, $_POST['return_value'], $_POST['note'], $_POST['acl_section']) == FALSE) {
echo 'ERROR editing ACL, possible conflict or error found...<br />' . "\n";
exit;
}
} else {
//Insert new ACL.
if ($gacl_api->add_acl($selected_aco_array, $selected_aro_array, $_POST['aro_groups'], $selected_axo_array, $_POST['axo_groups'], $_POST['allow'], $enabled, $_POST['return_value'], $_POST['note'], $_POST['acl_section']) == FALSE) {
echo 'ERROR adding ACL, possible conflict or error found...<br />' . "\n";
exit;
}
}
$gacl_api->return_page($_POST['return_page']);
break;
default:
//showarray($_GET);
if ($_GET['action'] == 'edit' AND !empty($_GET['acl_id'])) {
$gacl_api->debug_text('EDITING ACL');
//Grab ACL information
$query = '
SELECT id,section_value,allow,enabled,return_value,note
FROM '. $gacl_api->_db_table_prefix .'acl
WHERE id='. $db->qstr($_GET['acl_id']);
$acl_row = $db->GetRow($query);
list($acl_id, $acl_section_value, $allow, $enabled, $return_value, $note) = $acl_row;
//Grab selected objects
foreach (array('aco','aro','axo') as $type) {
$type_array = 'options_selected_'. $type;
$$type_array = array();
$query = '
SELECT a.section_value,a.value,c.name,b.name
FROM '. $gacl_api->_db_table_prefix . $type .'_map a
INNER JOIN '. $gacl_api->_db_table_prefix . $type .' b ON b.section_value=a.section_value AND b.value=a.value
INNER JOIN '. $gacl_api->_db_table_prefix . $type .'_sections c ON c.value=a.section_value
WHERE a.acl_id='. $db->qstr($acl_id);
$rs = $db->Execute($query);
if (is_object($rs)) {
while ($row = $rs->FetchRow()) {
list($section_value, $value, $section, $obj) = $row;
$gacl_api->debug_text("Section Value: $section_value Value: $value Section: $section ACO: $aco");
${$type_array}[$section_value.'^'.$value] = $section.' > '.$obj;
}
}
//showarray($$type_array);
}
//Grab selected groups.
foreach (array('aro','axo') as $type) {
$type_array = 'selected_'. $type .'_groups';
$query = '
SELECT group_id
FROM '. $gacl_api->_db_table_prefix . $type .'_groups_map
WHERE acl_id='. $db->qstr($acl_id);
$$type_array = $db->GetCol($query);
//showarray($$type_array);
}
$show_axo = (!empty($selected_axo_groups) OR !empty($options_selected_axo));
} else {
$gacl_api->debug_text('NOT EDITING ACL');
$allow=1;
$enabled=1;
$acl_section_value='user';
$show_axo = isset($_COOKIE['show_axo']) && $_COOKIE['show_axo'] == '1';
}
//Grab sections for select boxes
foreach (array('acl','aco','aro','axo') as $type) {
$type_array = 'options_'. $type .'_sections';
$$type_array = array();
$query = '
SELECT value,name
FROM '. $gacl_api->_db_table_prefix . $type .'_sections
WHERE hidden=0
ORDER BY order_value,name';
$rs = $db->Execute($query);
if (is_object($rs)) {
while ($row = $rs->FetchRow()) {
${$type_array}[$row[0]] = $row[1];
}
}
${$type .'_section_id'} = reset($$type_array);
}
//Init the main js array
$js_array = 'var options = new Array();' . "\n";
//Grab objects for select boxes
foreach (array('aco','aro','axo') as $type) {
//Init the main object js array.
$js_array .= 'options[\''. $type .'\'] = new Array();' . "\n";
unset($tmp_section_value);
$query = '
SELECT section_value,value,name
FROM '. $gacl_api->_db_table_prefix . $type .'
WHERE hidden=0
ORDER BY section_value,order_value,name';
$rs = $db->SelectLimit($query,$gacl_api->_max_select_box_items);
if (is_object($rs)) {
while ($row = $rs->FetchRow()) {
$section_value = addslashes($row[0]);
$value = addslashes($row[1]);
$name = addslashes($row[2]);
//Prepare javascript code for dynamic select box.
//Init the javascript sub-array.
if (!isset($tmp_section_value) OR $section_value != $tmp_section_value) {
$i = 0;
$js_array .= 'options[\''. $type .'\'][\''. $section_value . '\'] = new Array();' . "\n";
$tmp_section_value = $section_value;
}
//Add each select option for the section
$js_array .= 'options[\''. $type .'\'][\''. $section_value .'\']['. $i .'] = new Array(\''. $value . '\', \''. $name . "');\n";
$i++;
}
}
}
//echo "Section ID: $section_id<br>\n";
//echo "Section Value: ". $acl_section_value ."<br>\n";
$smarty->assign('options_acl_sections', $options_acl_sections);
$smarty->assign('acl_section_value', $acl_section_value);
$smarty->assign('options_axo_sections', $options_axo_sections);
$smarty->assign('axo_section_value', $axo_section_value);
$smarty->assign('options_aro_sections', $options_aro_sections);
$smarty->assign('aro_section_value', $aro_section_value);
$smarty->assign('options_aco_sections', $options_aco_sections);
$smarty->assign('aco_section_value', $aco_section_value);
$smarty->assign('js_array', $js_array);
$smarty->assign('js_aco_array_name', 'aco');
$smarty->assign('js_aro_array_name', 'aro');
$smarty->assign('js_axo_array_name', 'axo');
//Grab formatted ARO Groups for select box
$smarty->assign('options_aro_groups', $gacl_api->format_groups($gacl_api->sort_groups('ARO')) );
$smarty->assign('selected_aro_groups', $selected_aro_groups);
//Grab formatted AXO Groups for select box
$smarty->assign('options_axo_groups', $gacl_api->format_groups($gacl_api->sort_groups('AXO')) );
$smarty->assign('selected_axo_groups', $selected_axo_groups);
$smarty->assign('allow', $allow);
$smarty->assign('enabled', $enabled);
$smarty->assign('return_value', $return_value);
$smarty->assign('note', $note);
if (isset($options_selected_aco)) {
$smarty->assign('options_selected_aco', $options_selected_aco);
}
$smarty->assign('selected_aco', @array_keys($options_selected_aco));
if (isset($options_selected_aro)) {
$smarty->assign('options_selected_aro', $options_selected_aro);
}
$smarty->assign('selected_aro', @array_keys($options_selected_aro));
if (isset($options_selected_axo)) {
$smarty->assign('options_selected_axo', $options_selected_axo);
}
$selected_axo = @array_keys($options_selected_axo);
$smarty->assign('selected_axo', $selected_axo);
//Show AXO layer if AXO's are selected.
$smarty->assign('show_axo', $show_axo);
if (isset($_GET['acl_id'])) {
$smarty->assign('acl_id', $_GET['acl_id'] );
}
break;
}
//$smarty->assign('return_page', urlencode($_SERVER[REQUEST_URI]) );
if (isset($_GET['return_page'])) {
$smarty->assign('return_page', $_GET['return_page']);
}
if (isset($_GET['action'])) {
$smarty->assign('action', $_GET['action']);
}
$smarty->assign('current','acl_admin');
$smarty->assign('page_title', 'ACL Admin');
$smarty->assign('phpgacl_version', $gacl_api->get_version() );
$smarty->assign('phpgacl_schema_version', $gacl_api->get_schema_version() );
$smarty->display('phpgacl/acl_admin.tpl');
?>
|