function tpl_checkperm($tpl) { global $_G; list($file, $id) = explode(':', $tpl); if ($file == 'portal/portal_topic_content') { $topicid = max(0, intval($id)); $topic = C::t('portal_topic')->fetch($topicid); topic_checkperm($topic); } elseif ($file == 'portal/list') { $catid = max(0, intval($id)); $category = $_G['cache']['portalcategory'][$catid]; category_checkperm($category); } else { if (!$_G['group']['allowdiy']) { showmessage('diy_nopermission'); } } }
function tpl_checkperm($tpl) { global $_G; list($file, $id) = explode(':', $tpl); if ($file == 'portal/portal_topic_content') { $topicid = max(0, intval($id)); $topic = DB::fetch_first("SELECT * FROM " . DB::table('portal_topic') . " WHERE topicid='{$topicid}'"); topic_checkperm($topic); } elseif ($file == 'portal/list') { $catid = max(0, intval($id)); $category = DB::fetch_first("SELECT * FROM " . DB::table('portal_category') . " WHERE catid='{$catid}'"); category_checkperm($category); } else { if (!$_G['group']['allowdiy']) { showmessage('diy_nopermission'); } } }