diff options
Diffstat (limited to 'pages/Privileges/Update.c.xml')
-rw-r--r-- | pages/Privileges/Update.c.xml | 39 |
1 files changed, 5 insertions, 34 deletions
diff --git a/pages/Privileges/Update.c.xml b/pages/Privileges/Update.c.xml index 033bb7f..a8a8c54 100644 --- a/pages/Privileges/Update.c.xml +++ b/pages/Privileges/Update.c.xml @@ -3,7 +3,7 @@ <info> <name>Privileges:Update</name> <template>phpexec</template> - <access>00</access> + <access>0</access> <type>c</type> </info> <data> @@ -30,46 +30,17 @@ $page = substr($page, 0, -2); - $access = array_fill(0, $group_max/8 + 1, 0); + $access = join('', array_fill(0, $group_max/4 + 1, '0')); - foreach($groups as $group) { + foreach($groups as $group) if(isset($_POST[$page . ':' . $group[0]])) - $access[$group[0]/8] |= (1 << ($group[0]%8)); - } + $access[$group[0]/4] = dechex(hexdec($access[$group[0]/4]) | (1 << ($group[0]%4))); - $privileges = join('', array_map('chr', $access)); - - $GLOBALS['db']->Execute('UPDATE pages SET access = ? WHERE name = ?', array($privileges, $page)); - - if($GLOBALS['db']->Affected_Rows()) continue; - - $pagedata = $GLOBALS['pages']->GetPageData($page, $_POST['type']); - - $access = ''; - - for($i = 0; $i < strlen($pagedata['access']); $i+=2) - $access .= chr(hexdec(substr($pagedata['access'], $i, 2))); - - if($access == substr($privileges, 0, strlen($access))) { - for($i = strlen($access); $i < strlen($privileges); $i++) - if($privileges[$i] != 0) break; - - if($i == strlen($privileges)) continue; - } - - $string = ''; - - foreach($pagedata['data'] as $key => $val) - $string .= urlencode($key) . '=' . urlencode($val) . '&'; - - $GLOBALS['db']->Execute('INSERT INTO pages (name, template, access, data, type) VALUES (?, ?, ?, ?, ?)', - array($page, $pagedata['template'], $access, $string, $_POST['type'])); + $GLOBALS['pages']->SetAccess($page, $_POST['type'], $access); } header('Location: ' . $GLOBALS['links']->GetNeonLink('Privileges', 'type=' . $_POST['type'], false)); exit(); - - $GLOBALS['pages']->GetPageData() ?> ]]> </code> |