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: 20: 21: 22: 23: 24:
25: function cecFrontendCategoryAccess($idlang, $idcat, $idfrontenduser) {
26:
27: global $cfg;
28:
29:
30:
31: $db = cRegistry::getDb();
32: $db->query("
33: SELECT
34: idcatlang
35: FROM
36: " . $cfg["tab"]["cat_lang"] . "
37: WHERE
38: idcat = " . cSecurity::toInteger($idcat) . "
39: AND idlang = " . cSecurity::toInteger($idlang));
40: if ($db->nextRecord()) {
41: $idcatlang = $db->f('idcatlang');
42: } else {
43: return false;
44: }
45:
46:
47: $frontendUser = new cApiFrontendUser();
48: $frontendUser->loadByPrimaryKey($idfrontenduser);
49: if (true !== $frontendUser->isLoaded()) {
50: return false;
51: }
52:
53:
54: $coll = new cApiFrontendPermissionCollection();
55: foreach ($frontendUser->getGroupsForUser() as $group) {
56: if ($coll->checkPerm($group, 'category', 'access', $idcatlang)) {
57: return true;
58: }
59: }
60:
61: return false;
62: }
63:
64: ?>