Skip to content

Instantly share code, notes, and snippets.

@tobiasgies
Created September 17, 2013 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobiasgies/6591863 to your computer and use it in GitHub Desktop.
Save tobiasgies/6591863 to your computer and use it in GitHub Desktop.
How PHPBB checks if you're allowed to access an ACP module...
<?php
function module_auth($module_auth, $forum_id = false)
{
// ...
$is_auth = false;
eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z0-9_]+)(,\$id)?#', '#\$id#', '#aclf_([a-z0-9_]+)#', '#cfg_([a-z0-9_]+)#', '#request_([a-zA-Z0-9_]+)#'), array('(int) $auth->acl_get(\'\\1\'\\2)', '(int) $forum_id', '(int) $auth->acl_getf_global(\'\\1\')', '(int) $config[\'\\1\']', '!empty($_REQUEST[\'\\1\'])'), $module_auth) . ');');
// AAAAAAAAAAAAAAAAAAAAAAAHHH!
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment