function ad_permission_check in Advertisement 5.2
Determine whether the user has a given privilege.
1 call to ad_permission_check()
- ad_permission in ./
ad.module - Stub for ad_permission module, used to determine whether the user has a given privilege. If the ad_permission module is not enabled, all permissions are granted.
1 string reference to 'ad_permission_check'
- ad_permission in ./
ad.module - Stub for ad_permission module, used to determine whether the user has a given privilege. If the ad_permission module is not enabled, all permissions are granted.
File
- permission/
ad_permission.module, line 409 - Provide granular permissions for advertisements.
Code
function ad_permission_check($aid, $string, $account) {
static $permissions = array();
if (!isset($permissions[$aid][$account->uid])) {
$oid = db_result(db_query("SELECT oid FROM {ad_owners} WHERE aid = %d and uid = %d", $aid, $account->uid));
$permissions[$aid][$account->uid] = explode('|,|', db_result(db_query("SELECT permissions FROM {ad_permissions} WHERE oid = %d", $oid)));
}
return in_array("{$string}", $permissions[$aid][$account->uid]);
}