function qwp_tmpl_security_check() { global $MODULE_URI, $PAGE, $OP; if (qwp_is_passport_module()) { return true; } $acls = C('acls', null); if (!$acls) { qwp_tmpl_init_security($acls); } if (!isset($acls['modules'][$MODULE_URI])) { return false; } if ($OP) { $path = $MODULE_URI; if ($PAGE) { $path .= '#' . $PAGE; } return isset($acls['ops'][$path]) && isset($acls['ops'][$path][$OP]); } if ($PAGE) { return isset($acls['pages'][$MODULE_URI]) && isset($acls['pages'][$MODULE_URI][$PAGE]); } log_info('security check is passed: ' . $MODULE_URI); }
function qwp_tmpl_init_login() { global $USER; $USER = new QWPUser(1, QWP_ROLE_ADMIN, '*****@*****.**', 'admin', 'admin'); _C('u', $USER); require_once QWP_ROOT . '/sample/security.php'; qwp_tmpl_init_security($acls); }