$mainframe->redirect('index.php?option=com_community_acl&task=config', $msg); //$mainframe->redirect( 'index.php?option=com_community_acl&task='. $redirect, $msg ); break; } } function showConfig() { $db =& JFactory::getDBO(); $config = new CACL_config($db); $config->load(); $lists = array(); $query = 'SELECT id AS value, name AS text' . ' FROM `#__community_acl_groups`' . ' ORDER BY name'; $db->setQuery($query); //$groups = $db->loadObjectList(); $groups[] = JHTML::_('select.option', '0', JText::_('None'), 'value', 'text'); $groups = @array_merge($groups, $db->loadObjectList()); $javascript = "onchange=\"changeDynaList( 'public_role', grouproles, document.adminForm.public_group.options[document.adminForm.public_group.selectedIndex].value, 0, 0);\""; $lists['cacl_gid_pub'] = JHTML::_('select.genericlist', $groups, 'public_group', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', $config->public_group); $javascript = "onchange=\"changeDynaList( 'registered_role', grouproles, document.adminForm.registered_group.options[document.adminForm.registered_group.selectedIndex].value, 0, 0); if (document.adminForm.registered_group.options[document.adminForm.registered_group.selectedIndex].value == 0){document.adminForm.registered_role.options[document.adminForm.registered_role.selectedIndex].text = 'None';}\""; $lists['cacl_gid_reg'] = JHTML::_('select.genericlist', $groups, 'registered_group', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', $config->registered_group); $javascript = "onchange=\"changeDynaList( 'author_role', grouproles, document.adminForm.author_group.options[document.adminForm.author_group.selectedIndex].value, 0, 0);\""; $lists['cacl_gid_ath'] = JHTML::_('select.genericlist', $groups, 'author_group', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', $config->author_group); $javascript = "onchange=\"changeDynaList( 'editor_role', grouproles, document.adminForm.editor_group.options[document.adminForm.editor_group.selectedIndex].value, 0, 0);\""; $lists['cacl_gid_edt'] = JHTML::_('select.genericlist', $groups, 'editor_group', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', $config->editor_group); $javascript = "onchange=\"changeDynaList( 'publisher_role', grouproles, document.adminForm.publisher_group.options[document.adminForm.publisher_group.selectedIndex].value, 0, 0);\""; $lists['cacl_gid_pbl'] = JHTML::_('select.genericlist', $groups, 'publisher_group', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', $config->publisher_group); $javascript = "onchange=\"changeDynaList( 'manager_role', grouproles, document.adminForm.manager_group.options[document.adminForm.manager_group.selectedIndex].value, 0, 0);\""; $lists['cacl_gid_man'] = JHTML::_('select.genericlist', $groups, 'manager_group', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', $config->manager_group); $javascript = "onchange=\"changeDynaList( 'administrator_role', grouproles, document.adminForm.administrator_group.options[document.adminForm.administrator_group.selectedIndex].value, 0, 0);\""; $lists['cacl_gid_adm'] = JHTML::_('select.genericlist', $groups, 'administrator_group', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', $config->administrator_group); $query = 'SELECT id AS value, name AS text, group_id' . ' FROM `#__community_acl_roles`' . ' ORDER BY group_id, name'; $db->setQuery($query); $roles = $db->loadObjectList(); $tmp_arr = array(); if (is_array($roles) && count($roles)) { $tmp_arr = array(array('group' => '0', 'value' => '0', 'text' => JText::_('None'))); foreach ($roles as $i => $role) { $tmp_arr[] = array('group' => $role->group_id, 'value' => $role->value, 'text' => $role->text); } } $lists['cacl_rid_arr'] = $tmp_arr; $tmp[] = JHTML::_('select.option', '0', JText::_('None'), 'value', 'text'); $roles = @array_merge($tmp, $roles); $lists['cacl_rid_pub'] = JHTML::_('select.genericlist', $roles, 'public_role', ' class="inputbox" size="1" ', 'value', 'text', $config->public_role); $lists['cacl_rid_reg'] = JHTML::_('select.genericlist', $roles, 'registered_role', ' class="inputbox" size="1" ', 'value', 'text', $config->registered_role); $lists['cacl_rid_ath'] = JHTML::_('select.genericlist', $roles, 'author_role', ' class="inputbox" size="1" ', 'value', 'text', $config->author_role); $lists['cacl_rid_edt'] = JHTML::_('select.genericlist', $roles, 'editor_role', ' class="inputbox" size="1" ', 'value', 'text', $config->editor_role); $lists['cacl_rid_pbl'] = JHTML::_('select.genericlist', $roles, 'publisher_role', ' class="inputbox" size="1" ', 'value', 'text', $config->publisher_role); $lists['cacl_rid_man'] = JHTML::_('select.genericlist', $roles, 'manager_role', ' class="inputbox" size="1" ', 'value', 'text', $config->manager_role); $lists['cacl_rid_adm'] = JHTML::_('select.genericlist', $roles, 'administrator_role', ' class="inputbox" size="1" ', 'value', 'text', $config->administrator_role); $query = 'SELECT id AS value, name AS text' . ' FROM `#__community_acl_functions`' . ' ORDER BY name'; $db->setQuery($query); //$functions = $db->loadObjectList(); $functions[] = JHTML::_('select.option', '0', JText::_('None'), 'value', 'text'); $functions = @array_merge($functions, $db->loadObjectList()); $lists['cacl_fid_pub'] = JHTML::_('select.genericlist', $functions, 'public_function', ' class="inputbox" size="1" ', 'value', 'text', $config->public_function); $lists['cacl_fid_reg'] = JHTML::_('select.genericlist', $functions, 'registered_function', ' class="inputbox" size="1" ', 'value', 'text', $config->registered_function); $lists['cacl_fid_ath'] = JHTML::_('select.genericlist', $functions, 'author_function', ' class="inputbox" size="1" ', 'value', 'text', $config->author_function); $lists['cacl_fid_edt'] = JHTML::_('select.genericlist', $functions, 'editor_function', ' class="inputbox" size="1" ', 'value', 'text', $config->editor_function); $lists['cacl_fid_pbl'] = JHTML::_('select.genericlist', $functions, 'publisher_function', ' class="inputbox" size="1" ', 'value', 'text', $config->publisher_function); $lists['cacl_fid_man'] = JHTML::_('select.genericlist', $functions, 'manager_function', ' class="inputbox" size="1" ', 'value', 'text', $config->manager_function); $lists['cacl_fid_adm'] = JHTML::_('select.genericlist', $functions, 'administrator_function', ' class="inputbox" size="1" ', 'value', 'text', $config->administrator_function); $options = array(); $options[] = JHTML::_('select.option', '0', JText::_('Show only title'), 'value', 'text'); $options[] = JHTML::_('select.option', '1', JText::_('Show title with `no access` message'), 'value', 'text'); $options[] = JHTML::_('select.option', '2', JText::_('Show title and introtext'), 'value', 'text'); $options[] = JHTML::_('select.option', '3', JText::_('Show title and introtext with appended `no access` message'), 'value', 'text'); $lists['forbidden_content'] = JHTML::_('select.genericlist', $options, 'forbidden_content', ' class="inputbox" size="1" ', 'value', 'text', $config->forbidden_content); # - Modified by Kobby $cb_acl_groups = $db->loadObjectList(); $query = 'SELECT a.user_id AS id, a.id, a.group_id, a.role_id, a.function_id, a.redirect_FRONT, a.redirect_ADMIN, a.cb_member_type AS member_id, e.name AS g_name, f.name AS r_name, g.name AS f_name, h.name AS member_type, h.id AS member_id FROM `#__community_acl_users` AS a LEFT JOIN `#__community_acl_cb_groups` AS b ON a.group_id = b.id LEFT JOIN `#__community_acl_cb_roles` AS c ON a.role_id = c.id LEFT JOIN `#__community_acl_cb_functions` AS d ON a.role_id = d.id LEFT JOIN `#__community_acl_groups` AS e ON a.group_id = e.id LEFT JOIN `#__community_acl_roles` AS f ON a.role_id = f.id LEFT JOIN `#__community_acl_functions` AS g ON a.function_id = g.id LEFT JOIN `#__community_acl_membership_types` AS h ON a.cb_member_type = h.id WHERE a.user_id >0 AND a.user_id <62 AND a.group_id = e.id AND a.role_id = f.id ORDER BY f.name ASC'; $db->setQuery($query); $lists['cacl_cb_users'] = $db->loadObjectList(); //print_r($query); if (!$lists['cacl_cb_users']) { $query = 'SELECT DISTINCT a.id, a.*, e.name AS g_name, f.name AS r_name, g.name AS f_name' . ' FROM `#__community_acl_users` AS a' . ' LEFT JOIN `#__community_acl_cb_groups` AS b ON a.group_id = b.id ' . ' LEFT JOIN `#__community_acl_cb_roles` AS c ON a.role_id = c.id ' . ' LEFT JOIN `#__community_acl_cb_functions` AS d ON a.role_id = d.id ' . ' LEFT JOIN `#__community_acl_groups` AS e ON a.group_id = e.id ' . ' LEFT JOIN `#__community_acl_roles` AS f ON a.role_id = f.id ' . ' LEFT JOIN `#__community_acl_functions` AS g ON a.function_id = g.id ' . " WHERE a.user_id = '1'" . ' AND a.group_id = e.id ' . ' AND a.role_id = f.id ' . ' ORDER BY a.id'; $db->setQuery($query); $lists['cacl_cb_users'] = $db->loadObjectList(); } $query = 'SELECT id AS value, name AS text' . ' FROM `#__community_acl_groups`' . ' ORDER BY name'; $db->setQuery($query); $groups = $db->loadObjectList(); $javascript = "onchange=\"changeDynaList( 'cacl_role_list', grouproles, document.adminForm.cacl_group_list.options[document.adminForm.cacl_group_list.selectedIndex].value, 0, 0);\""; $lists['cacl_gid'] = JHTML::_('select.genericlist', $groups, 'cacl_group_list', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', null); if (count($groups) < 1) { $lists['cacl_gid'] = JText::_('There is no groups'); } $query = 'SELECT id ' . ' FROM `#__community_acl_groups`' . ' ORDER BY name'; $db->setQuery($query); $groups = $db->loadObjectList(); $query = 'SELECT id AS value, name AS text, group_id' . ' FROM `#__community_acl_roles`' . ' ORDER BY group_id, name'; $db->setQuery($query); $roles = $db->loadObjectList(); //Kobby customization $query = 'SELECT id AS value, name AS text' . ' FROM `#__community_acl_membership_types`' . ' ORDER BY id'; $db->setQuery($query); $cb_members = $db->loadObjectList(); $lists['membership'] = $cb_members; if ($lists['membership']) { $lists['member_list'] = JHTML::_('select.genericlist', $cb_members, 'member_list', ' class="inputbox" size="1" ', 'value', 'text', null); } if (count($cb_members) < 1) { $lists['member_list'] = JText::_('Belongs to no membership type'); } $query = 'SELECT choices as choice ' . ' FROM `#__community_acl_article_submission`' . ' ORDER BY id'; $db->setQuery($query); $article_submission = $db->loadResultArray(); $lists['article_submissions'] = $article_submission; $tmp_arr = array(); if (is_array($roles) && count($roles)) { $tmp_arr = array(); foreach ($groups as $group) { $z = 0; foreach ($roles as $i => $role) { if ($role->group_id != $group->id) { continue; } $tmp_arr[] = array('group' => $role->group_id, 'value' => $role->value, 'text' => $role->text); $z++; } if ($z == 0) { $tmp_arr[] = array('group' => $group->id, 'value' => 0, 'text' => JText::_('None')); } } } $lists['cacl_rid_arr'] = $tmp_arr; $lists['cacl_rid'] = JHTML::_('select.genericlist', $roles, 'cacl_role_list', ' class="inputbox" size="1" ', 'value', 'text', null); if (count($roles) < 1) { $lists['cacl_rid'] = JText::_('There is no roles'); } $lists['cacl_fid'] = JHTML::_('select.genericlist', $functions, 'cacl_func_list', ' class="inputbox" size="1" ', 'value', 'text', null); if (count($functions) < 1) { $lists['cacl_fid'] = JText::_('There is no functions'); } $query = "SELECT `template` FROM `#__templates_menu` LIMIT 1"; $db->setQuery($query); $template_name = $db->loadResult(); $templateDir = JPATH_ROOT . DS . 'templates/' . $template_name . '/html/com_user/register/default.php'; $show_membership_tab = 'false'; if (file_exists($templateDir)) { $section_ex = file_get_contents($templateDir); preg_match('/(?P<name>\\w+): (?P<digit>\\d+)/', $section_ex, $matches); if (count($matches) > 0) { $show_membership_tab = 'true';
function showConfig() { $db =& JFactory::getDBO(); $config = new CACL_config($db); $config->load(); $lists = array(); $query = 'SELECT id AS value, name AS text' . ' FROM `#__community_acl_groups`' . ' ORDER BY name'; $db->setQuery($query); //$groups = $db->loadObjectList(); $groups[] = JHTML::_('select.option', '0', JText::_('None'), 'value', 'text'); $groups = @array_merge($groups, $db->loadObjectList()); $javascript = "onchange=\"changeDynaList( 'public_role', grouproles, document.adminForm.public_group.options[document.adminForm.public_group.selectedIndex].value, 0, 0);\""; $lists['cacl_gid_pub'] = JHTML::_('select.genericlist', $groups, 'public_group', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', $config->public_group); $javascript = "onchange=\"changeDynaList( 'registered_role', grouproles, document.adminForm.registered_group.options[document.adminForm.registered_group.selectedIndex].value, 0, 0);\""; $lists['cacl_gid_reg'] = JHTML::_('select.genericlist', $groups, 'registered_group', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', $config->registered_group); $javascript = "onchange=\"changeDynaList( 'author_role', grouproles, document.adminForm.author_group.options[document.adminForm.author_group.selectedIndex].value, 0, 0);\""; $lists['cacl_gid_ath'] = JHTML::_('select.genericlist', $groups, 'author_group', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', $config->author_group); $javascript = "onchange=\"changeDynaList( 'editor_role', grouproles, document.adminForm.editor_group.options[document.adminForm.editor_group.selectedIndex].value, 0, 0);\""; $lists['cacl_gid_edt'] = JHTML::_('select.genericlist', $groups, 'editor_group', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', $config->editor_group); $javascript = "onchange=\"changeDynaList( 'publisher_role', grouproles, document.adminForm.publisher_group.options[document.adminForm.publisher_group.selectedIndex].value, 0, 0);\""; $lists['cacl_gid_pbl'] = JHTML::_('select.genericlist', $groups, 'publisher_group', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', $config->publisher_group); $javascript = "onchange=\"changeDynaList( 'manager_role', grouproles, document.adminForm.manager_group.options[document.adminForm.manager_group.selectedIndex].value, 0, 0);\""; $lists['cacl_gid_man'] = JHTML::_('select.genericlist', $groups, 'manager_group', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', $config->manager_group); $javascript = "onchange=\"changeDynaList( 'administrator_role', grouproles, document.adminForm.administrator_group.options[document.adminForm.administrator_group.selectedIndex].value, 0, 0);\""; $lists['cacl_gid_adm'] = JHTML::_('select.genericlist', $groups, 'administrator_group', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', $config->administrator_group); $query = 'SELECT id AS value, name AS text, group_id' . ' FROM `#__community_acl_roles`' . ' ORDER BY group_id, name'; $db->setQuery($query); $roles = $db->loadObjectList(); $tmp_arr = array(); if (is_array($roles) && count($roles)) { $tmp_arr = array(array('group' => '0', 'value' => '0', 'text' => JText::_('None'))); foreach ($roles as $i => $role) { $tmp_arr[] = array('group' => $role->group_id, 'value' => $role->value, 'text' => $role->text); } } $lists['cacl_rid_arr'] = $tmp_arr; $tmp[] = JHTML::_('select.option', '0', JText::_('None'), 'value', 'text'); $roles = @array_merge($tmp, $roles); $lists['cacl_rid_pub'] = JHTML::_('select.genericlist', $roles, 'public_role', ' class="inputbox" size="1" ', 'value', 'text', $config->public_role); $lists['cacl_rid_reg'] = JHTML::_('select.genericlist', $roles, 'registered_role', ' class="inputbox" size="1" ', 'value', 'text', $config->registered_role); $lists['cacl_rid_ath'] = JHTML::_('select.genericlist', $roles, 'author_role', ' class="inputbox" size="1" ', 'value', 'text', $config->author_role); $lists['cacl_rid_edt'] = JHTML::_('select.genericlist', $roles, 'editor_role', ' class="inputbox" size="1" ', 'value', 'text', $config->editor_role); $lists['cacl_rid_pbl'] = JHTML::_('select.genericlist', $roles, 'publisher_role', ' class="inputbox" size="1" ', 'value', 'text', $config->publisher_role); $lists['cacl_rid_man'] = JHTML::_('select.genericlist', $roles, 'manager_role', ' class="inputbox" size="1" ', 'value', 'text', $config->manager_role); $lists['cacl_rid_adm'] = JHTML::_('select.genericlist', $roles, 'administrator_role', ' class="inputbox" size="1" ', 'value', 'text', $config->administrator_role); $query = 'SELECT id AS value, name AS text' . ' FROM `#__community_acl_functions`' . ' ORDER BY name'; $db->setQuery($query); //$functions = $db->loadObjectList(); $functions[] = JHTML::_('select.option', '0', JText::_('None'), 'value', 'text'); $functions = @array_merge($functions, $db->loadObjectList()); $lists['cacl_fid_pub'] = JHTML::_('select.genericlist', $functions, 'public_function', ' class="inputbox" size="1" ', 'value', 'text', $config->public_function); $lists['cacl_fid_reg'] = JHTML::_('select.genericlist', $functions, 'registered_function', ' class="inputbox" size="1" ', 'value', 'text', $config->registered_function); $lists['cacl_fid_ath'] = JHTML::_('select.genericlist', $functions, 'author_function', ' class="inputbox" size="1" ', 'value', 'text', $config->author_function); $lists['cacl_fid_edt'] = JHTML::_('select.genericlist', $functions, 'editor_function', ' class="inputbox" size="1" ', 'value', 'text', $config->editor_function); $lists['cacl_fid_pbl'] = JHTML::_('select.genericlist', $functions, 'publisher_function', ' class="inputbox" size="1" ', 'value', 'text', $config->publisher_function); $lists['cacl_fid_man'] = JHTML::_('select.genericlist', $functions, 'manager_function', ' class="inputbox" size="1" ', 'value', 'text', $config->manager_function); $lists['cacl_fid_adm'] = JHTML::_('select.genericlist', $functions, 'administrator_function', ' class="inputbox" size="1" ', 'value', 'text', $config->administrator_function); $options = array(); $options[] = JHTML::_('select.option', '0', JText::_('Show only title'), 'value', 'text'); $options[] = JHTML::_('select.option', '1', JText::_('Show title with `no access` message'), 'value', 'text'); $options[] = JHTML::_('select.option', '2', JText::_('Show title and introtext'), 'value', 'text'); $options[] = JHTML::_('select.option', '3', JText::_('Show title and introtext with appended `no access` message'), 'value', 'text'); $lists['forbidden_content'] = JHTML::_('select.genericlist', $options, 'forbidden_content', ' class="inputbox" size="1" ', 'value', 'text', $config->forbidden_content); # - Modified by Kobby $cb_acl_groups = $db->loadObjectList(); $query = 'SELECT DISTINCT a.id, a.*, e.name AS g_name, f.name AS r_name, g.name AS f_name' . ' FROM `#__community_acl_users` AS a' . ' LEFT JOIN `#__community_acl_cb_groups` AS b ON a.group_id = b.id ' . ' LEFT JOIN `#__community_acl_cb_roles` AS c ON a.role_id = c.id ' . ' LEFT JOIN `#__community_acl_cb_functions` AS d ON a.role_id = d.id ' . ' LEFT JOIN `#__community_acl_groups` AS e ON a.group_id = e.id ' . ' LEFT JOIN `#__community_acl_roles` AS f ON a.role_id = f.id ' . ' LEFT JOIN `#__community_acl_functions` AS g ON a.function_id = g.id ' . " WHERE a.user_id = '1'" . ' AND a.group_id = e.id ' . ' AND a.role_id = f.id ' . ' ORDER BY a.id'; $db->setQuery($query); $lists['cacl_cb_users'] = $db->loadObjectList(); $query = 'SELECT id AS value, name AS text' . ' FROM `#__community_acl_groups`' . ' ORDER BY name'; $db->setQuery($query); $groups = $db->loadObjectList(); $javascript = "onchange=\"changeDynaList( 'cacl_role_list', grouproles, document.adminForm.cacl_group_list.options[document.adminForm.cacl_group_list.selectedIndex].value, 0, 0);\""; $lists['cacl_gid'] = JHTML::_('select.genericlist', $groups, 'cacl_group_list', ' class="inputbox" size="1" ' . $javascript, 'value', 'text', null); if (count($groups) < 1) { $lists['cacl_gid'] = JText::_('There is no groups'); } $query = 'SELECT id ' . ' FROM `#__community_acl_groups`' . ' ORDER BY name'; $db->setQuery($query); $groups = $db->loadObjectList(); $query = 'SELECT id AS value, name AS text, group_id' . ' FROM `#__community_acl_roles`' . ' ORDER BY group_id, name'; $db->setQuery($query); $roles = $db->loadObjectList(); $tmp_arr = array(); if (is_array($roles) && count($roles)) { $tmp_arr = array(); foreach ($groups as $group) { $z = 0; foreach ($roles as $i => $role) { if ($role->group_id != $group->id) { continue; } $tmp_arr[] = array('group' => $role->group_id, 'value' => $role->value, 'text' => $role->text); $z++; } if ($z == 0) { $tmp_arr[] = array('group' => $group->id, 'value' => 0, 'text' => JText::_('None')); } } } $lists['cacl_rid_arr'] = $tmp_arr; $lists['cacl_rid'] = JHTML::_('select.genericlist', $roles, 'cacl_role_list', ' class="inputbox" size="1" ', 'value', 'text', null); if (count($roles) < 1) { $lists['cacl_rid'] = JText::_('There is no roles'); } $lists['cacl_fid'] = JHTML::_('select.genericlist', $functions, 'cacl_func_list', ' class="inputbox" size="1" ', 'value', 'text', null); if (count($functions) < 1) { $lists['cacl_fid'] = JText::_('There is no functions'); } cacl_html::show_config($config, $lists); }