function PermissionBlock() { global $smcFunc, $context, $txt; checkSession('get'); if (!empty($_REQUEST['id']) && is_numeric($_REQUEST['id'])) { $id = (int) $_REQUEST['id']; } else { fatal_lang_error('adkfatal_empty_block_id', FALSE); } //Load Groups $context['adk_groups'] = loadAdkGroups('min_posts = {int:p}', array('p' => -1)); //Load my block $context['block_permissions'] = loadBlock($id); if ($context['block_permissions']['num_rows'] == 0) { fatal_lang_error('adkfatal_empty_block_id', false); } $context['sub_template'] = 'permissions'; $context['page_title'] = $context['block_permissions']['name'] . ' - ' . $txt['adkblock_permissions']; }
function ContactAdmin() { global $smcFunc, $context, $txt; //CheckSession checkSession('get'); $context['groups'] = loadAdkGroups('min_posts = {int:posts} AND id_group <> {int:admin} AND id_group <> {int:moderator}', array('posts' => -1, 'admin' => 1, 'moderator' => 3)); //Adding guests and regulars users $context['groups'] += array(-1 => array('name' => $txt['adkmodules_guests']), 0 => array('name' => $txt['adkmodules_regulars_users'])); //order array ksort($context['groups']); $context['sub_template'] = 'contact_admin'; $context['page_title'] = $txt['adkmod_modules_contacto']; }
function load_membergroups_edit($id_array) { global $smcFunc, $context, $txt; $id_array2 = explode(",", $id_array); $groups = loadAdkGroups('id_group <> {int:moderator} AND id_group <> {int:admin}', array('admin' => 1, 'moderator' => 3), 'id_group DESC'); $context['all_checked'] = true; echo '<input style="vertical-align: middle;" type="checkbox" value="-1" name="groups_allowed[-1]" ', in_array(-1, $id_array2) == 1 ? 'checked="checked"' : '', ' /> ' . $txt['adkmodules_guests'] . '<br />'; //mmm if (!(in_array(-1, $id_array2) == 1)) { $context['all_checked'] = false; } foreach ($groups as $id_group => $g) { echo '<input style="vertical-align: middle;" type="checkbox" value="', $id_group, '" name="groups_allowed[', $id_group, ']" ', in_array($id_group, $id_array2) ? 'checked="checked"' : '', ' /> ' . $g['name'] . '<br />'; if (!in_array($id_group, $id_array2)) { $context['all_checked'] = false; } } }
function AdkDownloadEditCategory() { global $smcFunc, $txt, $context, $scripturl, $boarddir, $adkFolder; checkSession('get'); //Set the initial context $context['sub_template'] = 'add_category'; $context['save_action'] = 'saveeditcategory'; //Check id_category if (!empty($_REQUEST['id']) && is_numeric($_REQUEST['id'])) { $id_cat = (int) $_REQUEST['id']; } else { fatal_lang_error('adkfatal_invalid_id_category', false); } //Load boards getBoardsAdminDownload(); //Load Cats getCatAdminDownload('id_parent = {int:parent} AND id_cat <> {int:cat}', array('parent' => 0, 'cat' => $id_cat)); //Load this category $context['adk_cat'] = array(); $sql = $smcFunc['db_query']('', ' SELECT title,description,id_board,id_parent,locktopic,sortby,orderby,image, groups_can_view, groups_can_add, roworder FROM {db_prefix}adk_down_cat WHERE id_cat = {int:cat} LIMIT 1', array('cat' => $id_cat)); //Invalid category? if ($smcFunc['db_num_rows']($sql) == 0) { fatal_lang_error('adkfatal_invalid_id_category', false); } $new = $smcFunc['db_fetch_assoc']($sql); //Set the array $context['adk_cat'] = array('id_cat' => $id_cat, 'id_board' => $new['id_board'], 'title' => $new['title'], 'description' => $new['description'], 'id_parent' => $new['id_parent'], 'locktopic' => $new['locktopic'], 'sortby' => $new['sortby'], 'orderby' => $new['orderby'], 'image2' => $new['image'], 'roworder' => $new['roworder']); //Compatibility $context['cat_parent'] = $context['adk_cat']['id_parent']; //Cant view. cant add $context['groups_can_view'] = !empty($new['groups_can_view']) || $new['groups_can_view'] == "0" ? explode(',', $new['groups_can_view']) : array(); $context['groups_can_add'] = !empty($new['groups_can_add']) || $new['groups_can_add'] == "0" ? explode(',', $new['groups_can_add']) : array(); //Set memberGroups $context['memberGroups_view'] = loadAdkGroups('min_posts = {int:min} AND id_group NOT IN ({array_int:group})', array('min' => -1, 'group' => array(1, 3))); $context['memberGroups_add'] = loadAdkGroups('min_posts = {int:min} AND id_group NOT IN ({array_int:group})', array('min' => -1, 'group' => array(1, 3))); $context['memberGroups_view'] += array(0 => array('name' => $txt['adkeds_regulars_users']), -1 => array('name' => $txt['adkeds_guests'])); $context['memberGroups_add'] += array(0 => array('name' => $txt['adkeds_regulars_users'])); $smcFunc['db_free_result']($sql); //Get previos permissions $context['groups_can_view_parent'] = array(); $context['groups_can_add_parent'] = array(); if ($context['cat_parent'] != 0) { $sql = $smcFunc['db_query']('', 'SELECT groups_can_view AS cant_view, groups_can_add AS cant_add FROM {db_prefix}adk_down_cat WHERE id_cat = {int:parent}', array('parent' => $context['cat_parent'])); list($cant_view, $cant_add) = $smcFunc['db_fetch_row']($sql); $smcFunc['db_free_result']($sql); $context['groups_can_view_parent'] = !empty($cant_view) || $cant_view == "0" ? explode(',', $cant_view) : array(); $context['groups_can_add_parent'] = !empty($cant_add) || $cant_add == "0" ? explode(',', $cant_add) : array(); } //Directory is writable $context['is_not_writable_download_path'] = !is_writable($adkFolder['eds'] . '/catimgs'); //Set the page_title $context['page_title'] = $txt['adkeds_edit_cat_title'] . ' (' . $context['adk_cat']['title'] . ')'; }