1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18:
19: function cecFrontendCategoryAccess($idlang, $idcat, $user)
20: {
21: global $cfg;
22:
23: $db = cRegistry::getDb();
24:
25: $frontendUser = new cApiFrontendUser();
26: $frontendUser->loadByPrimaryKey($user);
27:
28: if ($frontendUser->virgin) {
29: return false;
30: }
31:
32: $groups = $frontendUser->getGroupsForUser();
33:
34: $frontendPermissionCollection = new cApiFrontendPermissionCollection();
35:
36: $sql = "SELECT idcatlang FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat = " . cSecurity::toInteger($idcat) . " AND idlang = " . cSecurity::toInteger($idlang);
37: $db->query($sql);
38:
39: if ($db->nextRecord()) {
40: $idcatlang = $db->f("idcatlang");
41: } else {
42: return false;
43: }
44:
45: foreach ($groups as $group) {
46: $allow = $frontendPermissionCollection->checkPerm($group, "category", "access", $idcatlang);
47: if ($allow == true) {
48: return true;
49: }
50: }
51:
52: return false;
53: }
54:
55: ?>