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