function hikashopSubscriptionType() { if (!HIKASHOP_PHP5) { $acl =& JFactory::getACL(); } else { $acl = JFactory::getACL(); } if (!HIKASHOP_J16) { $this->groups = $acl->get_group_children_tree(null, 'USERS', false); } else { $db = JFactory::getDBO(); $db->setQuery('SELECT a.*, a.title as text, a.id as value FROM #__usergroups AS a ORDER BY a.lft ASC'); $this->groups = $db->loadObjectList('id'); foreach ($this->groups as $id => $group) { if (isset($this->groups[$group->parent_id])) { $this->groups[$id]->level = intval(@$this->groups[$group->parent_id]->level) + 1; $this->groups[$id]->text = str_repeat('- - ', $this->groups[$id]->level) . $this->groups[$id]->text; } } } $this->choice = array(); $this->choice[] = JHTML::_('select.option', 'none', JText::_('HIKA_NONE')); $this->choice[] = JHTML::_('select.option', 'special', JText::_('HIKA_CUSTOM')); $js = "function updateSubscription(map){\r\n\t\t\tchoice = document.adminForm['choice_'+map];\r\n\t\t\tchoiceValue = 'special';\r\n\t\t\tfor (var i=0; i < choice.length; i++){\r\n\t\t\t\tif (choice[i].checked){\r\n\t\t\t\t\tchoiceValue = choice[i].value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\thiddenVar = document.getElementById('hidden_'+map);\r\n\t\t\tif(choiceValue != 'special'){\r\n\t\t\t\thiddenVar.value = choiceValue;\r\n\t\t\t\tif(hiddenVar.value == 'none') hiddenVar.value = '';\r\n\t\t\t\tdocument.getElementById('div_'+map).style.display = 'none';\r\n\t\t\t}else{\r\n\t\t\t\tdocument.getElementById('div_'+map).style.display = '';\r\n\t\t\t\tspecialVar = eval('document.adminForm.special_'+map);\r\n\t\t\t\tfinalValue = '';\r\n\t\t\t\tfor (var i=0; i < specialVar.length; i++){\r\n\t\t\t\t\tif (specialVar[i].checked){\r\n\t\t\t\t\t\tfinalValue += specialVar[i].value;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\thiddenVar.value = finalValue;\r\n\t\t\t}\r\n\t\t}"; if (!HIKASHOP_PHP5) { $doc =& JFactory::getDocument(); } else { $doc = JFactory::getDocument(); } $doc->addScriptDeclaration($js); }
function getInput15($name, $id, $value, $params, $children) { $this->params = $params; $root = $this->def('root', 'USERS'); $showroot = $this->def('showroot'); if (strtoupper($root) == 'USERS' && $showroot == '') { $showroot = 0; } $multiple = $this->def('multiple'); $notregistered = $this->def('notregistered'); $control = $name . ''; $acl =& JFactory::getACL(); $options = $acl->get_group_children_tree(null, $root, $showroot); if ($notregistered) { $option = new stdClass(); $option->value = 0; $option->text = JText::_('NN_NOT_LOGGED_IN'); $option->disable = ''; array_unshift($options, $option); } foreach ($options as $i => $option) { $item_name = $option->text; $padding = 0; if (strpos($item_name, ' ') === 0 || strpos($item_name, '- ') === 0) { $item_name = preg_replace('#^-? #', '', $item_name); } else { if (strpos($item_name, '. ') === 0 || strpos($item_name, ' ') === 0) { $item_name = preg_replace('#^\\. #', ' ', $item_name); while (strpos($item_name, ' ') === 0) { $padding++; $item_name = substr($item_name, 36); } $item_name = preg_replace('#^- #', '', $item_name); } } for ($p = 0; $p < $padding; $p++) { $item_name = ' ' . $item_name; } $options[$i]->text = $item_name; } if ($multiple) { $control .= '[]'; if (!is_array($value)) { $value = explode(',', $value); } if (in_array(29, $value)) { $value[] = 18; $value[] = 19; $value[] = 20; $value[] = 21; } if (in_array(30, $value)) { $value[] = 23; $value[] = 24; $value[] = 25; } } require_once JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'helpers' . DS . 'html.php'; return nnHTML::selectlist($options, $control, $value, $id, 5, $multiple, 0, 1); }
function display($tpl = null) { $mainframe = JFactory::getApplication('site'); $acl = JFactory::getACL(); $task = $mainframe->input->get('task', 'contests'); $this->task = $task; $filter_order = $mainframe->getUserStateFromRequest('com_jvarcade.contests.filter_order', 'filter_order', 'startdatetime', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest('com_jvarcade.contests.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_order_Dir = $filter_order_Dir ? $filter_order_Dir : 'DESC'; // ensure filter_order has a valid value. if (!in_array($filter_order, array('id', 'name', 'startdatetime', 'enddatetime', 'maxplaycount', 'published'))) { $filter_order = 'startdatetime'; } $model = $this->getModel(); $model->setOrderBy($filter_order); $model->setOrderDir($filter_order_Dir); $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $this->lists = $lists; $contests = $model->getContests(); $pagination = $model->getPagination(); $this->pagination = $pagination; $this->contests = $contests; //~ $this->permnames = $model->getAcl(); JToolBarHelper::title(JText::_('COM_JVARCADE_CONTESTS'), 'jvacontests'); JToolBarHelper::editList('editcontest', JText::_('COM_JVARCADE_CONTESTS_EDIT')); JToolBarHelper::addNew('addcontest', JText::_('COM_JVARCADE_CONTESTS_ADD')); JToolBarHelper::deleteList(JText::_('COM_JVARCADE_CONTESTS_ASK_DELETE'), 'deleteContest', JText::_('COM_JVARCADE_CONTESTS_DELETE')); JToolBarHelper::publishList('contestPublish', JText::_('COM_JVARCADE_CONTESTS_PUBLISH')); JToolBarHelper::unpublishList('contestUnpublish', JText::_('COM_JVARCADE_CONTESTS_UNPUBLISH')); jvarcadeToolbarHelper::addSubmenu($this->getName()); $this->addSidebar('contests'); parent::display($tpl); }
function display($tpl = null) { $model = $this->getModel(); $this->acl = JFactory::getACL(); $this->gtree = array(); $app = JFactory::getApplication(); $task = $app->input->getCmd('task', 'settings'); $this->task = $this->get($task); $confdb = $model->getConf(); $conf = array('general' => array(), 'integration' => array(), 'frontend' => array()); foreach ($confdb as $obj) { $conf[$obj['group']][] = array('optname' => $obj['optname'], 'value' => $obj['value'], 'description' => $obj['description'], 'type' => $obj['type']); } $this->conf = $conf; $editor = JFactory::getEditor(); $this->editor = $editor; $editor_params = array('mode' => 'advanced'); $this->editor_params = $editor_params; JToolBarHelper::title(JText::_('COM_JVARCADE_SETTINGS'), 'jvasettings'); JToolBarHelper::custom('settings', 'save.png', 'save.png', JText::_('COM_JVARCADE_SAVE_SETTINGS'), false, false); jvarcadeToolbarHelper::addSubmenu($this->getName()); $this->addSidebar('settings'); // Comments $db = JFactory::getDbo(); $db->setQuery("SELECT element as `option`, enabled FROM #__extensions WHERE `type` = 'component' AND element IN ('com_comment', 'com_jcomments', 'com_jacomment')"); $this->comment_data = $db->loadAssocList('option'); parent::display($tpl); }
function fetchElement($name, $value, &$node, $control_name) { // Must load admin language files $lang =& JFactory::getLanguage(); $lang->load("com_jevents", JPATH_ADMINISTRATOR); // TODO 1.6 ACL VERSION OF THIS if (JVersion::isCompatible("1.6.0")) { return ""; } $acl =& JFactory::getACL(); $gtree = $acl->get_group_children_tree(null, 'USERS', false); foreach ($gtree as &$item) { if ($item->value > 25) { $item->disable = true; } } unset($item); $ctrl = $control_name . '[' . $name . ']'; $attribs = ' '; if ($v = $node->attributes('size')) { $attribs .= 'size="' . $v . '"'; } if ($v = $node->attributes('class')) { $attribs .= 'class="' . $v . '"'; } else { $attribs .= 'class="inputbox"'; } if ($m = $node->attributes('multiple')) { $attribs .= 'multiple="multiple"'; $ctrl .= '[]'; //$value = implode( '|', ) } //array_unshift( $editors, JHTML::_('select.option', '', '- '. JText::_( 'SELECT_EDITOR' ) .' -' ) ); return JHTML::_('select.genericlist', $gtree, $ctrl, $attribs, 'value', 'text', $value, $control_name . $name); }
/** * add points to user based on the action. */ function assignPoint($action, $userId = null) { //get the rule points //must use the JFactory::getUser to get the aid $juser =& JFactory::getUser($userId); if ($juser->id != 0) { $aid = $juser->aid; // if the aid is null, means this is not the current logged-in user. // so we need to manually get this aid for this user. if (is_null($aid)) { $aid = 0; //defautl to 0 // Get an ACL object $acl =& JFactory::getACL(); $grp = $acl->getAroGroup($juser->id); $group = 'USERS'; if ($acl->is_group_child_of($grp->name, $group)) { $aid = 1; // Fudge Authors, Editors, Publishers and Super Administrators into the special access group if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) { $aid = 2; } } } $points = CUserPoints::_getActionPoint($action, $aid); $user = CFactory::getUser($userId); $points += $user->getKarmaPoint(); $user->_points = $points; $user->save(); } }
public function display() { // Display the toolbar $toolbar = $this->_createToolbar()->reset(); $this->toolbar = KFactory::get($this->getToolbar(), array('isGrid' => false))->append(KFactory::get('admin::com.ninja.toolbar.button.apply', array('isGrid' => false))); KFactory::get('admin::com.ninja.helper.default')->css('/' . $this->getIdentifier()->application . '.' . $this->getName() . '.css'); KFactory::get('admin::com.ninja.helper.default')->js('/raphael.js'); KFactory::get('admin::com.ninja.helper.default')->js('/Mapper.js'); $acl = JFactory::getACL(); //die('<pre>'.print_r(get_class_methods($acl), true).'</pre>'); $acltree = (array) $acl->get_group_children_tree(null, 'USERS', false); array_unshift($acltree, (object) array('value' => 0, 'text' => 'Unregistered', 'disabled' => false)); $this->acltree = $acltree; $this->usergroups = KFactory::tmp('admin::com.ninjaboard.model.usergroups')->limit(0)->getList(); $maps = array(); foreach (KFactory::tmp($this->getModel()->getIdentifier())->limit(0)->getList() as $map) { $maps[$map->id] = $map->ninjaboard_gid; } $this->maps = $maps; $display = parent::display(); if (KRequest::type() == 'AJAX') { echo '<script type="text/javascript"> ' . $this->_document->_script['text/javascript'] . ' </script>'; } return $display; }
function display($tpl = null) { $cid = JRequest::getVar('cid', array(0), 'get', 'array'); $edit = JRequest::getVar('edit', true); $me = JFactory::getUser(); JArrayHelper::toInteger($cid, array(0)); $db = JFactory::getDBO(); $user = JTable::getInstance('ExtUser', 'KunenaImporterTable'); $user->load($cid[0]); $importer = $this->getModel('import'); $items = $importer->findPotentialUsers($user, true); $myuser = JFactory::getUser(); $acl = JFactory::getACL(); // Check for post data in the event that we are returning // from a unsuccessful attempt to save data /* $post = JRequest::get('post'); if ( $post ) { $user->bind($post); }*/ // build the html select list $lists['block'] = JHTML::_('select.booleanlist', 'block', 'class="inputbox" size="1"', $user->get('block')); // build the html select list $lists['sendEmail'] = JHTML::_('select.booleanlist', 'sendEmail', 'class="inputbox" size="1"', $user->get('sendEmail')); $this->assignRef('me', $me); $this->assignRef('lists', $lists); $this->assignRef('user', $user); $this->assignRef('items', $items); JToolBarHelper::makeDefault('select', 'Select'); JToolBarHelper::back(); parent::display($tpl); }
/** * Sets the parent groups with the same acl * * @param $location * @param $toplevel * @return true */ function eb_acl($location, $lowerlevel) { // set it once so that we dont have to keep doing this static $acl = null; if (is_null($acl)) { $acl =& JFactory::getACL(); } //set acl for public access if ($lowerlevel == 'Public') { $acl->_mos_add_acl(EBOOK_COMPONENT, $location, 'users', 'Public'); } //we set all of the parent groups to this same value $AROs = array_reverse($acl->get_group_children_tree()); //looping through all of the group types foreach ($AROs as $ARO) { //getting the group names $gname = $acl->get_group_name($ARO->value); //some groups dont count if ($gname == 'ROOT' || $gname == 'USERS' || $gname == 'Public Frontend' || $gname == 'Public Backend') { continue; } //setting it as an acl $acl->_mos_add_acl(EBOOK_COMPONENT, $location, 'users', $gname); //quit if we're at the highest that we want to go if ($lowerlevel == $gname) { break; } } return true; }
function display($tpl = null) { $cid = JRequest::getVar('cid', array(0), '', 'array'); $id = intval($cid[0]); $db =& JFactory::getDBO(); $acl = JFactory::getACL(); $query = "SELECT id, name FROM #__groups WHERE id = {$id}"; $db->setQuery($query); $row = $db->loadObject(); $query = "SELECT id_group FROM #__noixacl_groups_level WHERE id_levels like '%{$id}%'"; $db->setQuery($query); $rowGroups = $db->loadObjectList(); $levelGroups = JArrayHelper::getColumn($rowGroups, 'id_group'); /** * get groups */ $aclGroups = $acl->sort_groups(); /** * format groups */ $groups = $acl->format_groups($aclGroups, 'html', 28); $this->assignRef('accesslevel', $row); $this->assignRef('levelGroups', $levelGroups); $this->assignRef('groups', $groups); $text = !$cid[0] ? JText::_('NOIXACL_VIEW_ACCESSLEVEL_TEXT_EDIT') : JText::_('NOIXACL_VIEW_ACCESSLEVEL_TEXT_NEW'); JToolBarHelper::title(JText::_('NOIXACL_VIEW_ACCESSLEVEL_TEXT_GROUP') . ': <small><small>[ ' . $text . ' ]</small></small>', 'user.png'); JToolBarHelper::save(); JToolBarHelper::apply(); JToolBarHelper::cancel(); parent::display($tpl); }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { $input = JFactory::getApplication()->input; $task = $input->getString('task', ''); if (($task == 'save' || $task == 'apply') && (!JFactory::getUser()->authorise('core.edit.state', 'com_dzproduct') && $array['state'] == 1)) { $array['state'] = 0; } //Support for multiple or not foreign key field: itemid if (isset($array['itemid'])) { if (is_array($array['itemid'])) { $array['itemid'] = implode(',', $array['itemid']); } else { if (strrpos($array['itemid'], ',') != false) { $array['itemid'] = explode(',', $array['itemid']); } else { if (empty($array['itemid'])) { $array['itemid'] = ''; } } } } //Support for multiple or not foreign key field: fieldid if (isset($array['fieldid'])) { if (is_array($array['fieldid'])) { $array['fieldid'] = implode(',', $array['fieldid']); } else { if (strrpos($array['fieldid'], ',') != false) { $array['fieldid'] = explode(',', $array['fieldid']); } else { if (empty($array['fieldid'])) { $array['fieldid'] = ''; } } } } if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!JFactory::getUser()->authorise('core.admin', 'com_dzproduct.fielddata.' . $array['id'])) { $actions = JFactory::getACL()->getActions('com_dzproduct', 'fielddata'); $default_actions = JFactory::getACL()->getAssetRules('com_dzproduct.fielddata.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) { $array_jaccess[$action->name] = $default_actions[$action->name]; } $array['rules'] = $this->JAccessRulestoArray($array_jaccess); } //Bind the rules for ACL where supported. if (isset($array['rules']) && is_array($array['rules'])) { $this->setRules($array['rules']); } return parent::bind($array, $ignore); }
function display($tpl = null) { $mainframe = JFactory::getApplication('site'); $acl = JFactory::getACL(); $task = $mainframe->input->get('task', 'manage_folders'); $this->task = $task; $filter_order = $mainframe->getUserStateFromRequest('com_jvarcade.manage_folders.filter_order', 'filter_order', 'f.name', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest('com_jvarcade.manage_folders.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_order_Dir = $filter_order_Dir ? $filter_order_Dir : 'DESC'; // ensure filter_order has a valid value. if (!in_array($filter_order, array('f.name', 'f.viewpermissions', 'parentname', 'f.published'))) { $filter_order = 'f.name'; } $model = $this->getModel(); $model->setOrderBy($filter_order); $model->setOrderDir($filter_order_Dir); $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $this->lists = $lists; $folders = $model->getFolders(); $pagination = $model->getPagination(); $this->pagination = $pagination; $this->folders = $folders; $this->permnames = $model->getAcl(); JToolBarHelper::title(JText::_('COM_JVARCADE_MANAGE_FOLDERS'), 'jvafolders'); JToolBarHelper::editList('editfolder', JText::_('COM_JVARCADE_FOLDERS_EDIT')); JToolBarHelper::addNew('addfolder', JText::_('COM_JVARCADE_FOLDERS_ADD')); JToolBarHelper::deleteList(JText::_('COM_JVARCADE_FOLDERS_ASK_DELETE'), 'deletefolder', JText::_('COM_JVARCADE_FOLDERS_DELETE')); JToolBarHelper::publishList('folderPublish', JText::_('COM_JVARCADE_FOLDERS_PUBLISH')); JToolBarHelper::unpublishList('folderUnPublish', JText::_('COM_JVARCADE_FOLDERS_UNPUBLISH')); jvarcadeToolbarHelper::addSubmenu($this->getName()); $this->addSidebar('manage_folders'); parent::display($tpl); }
static function create_joomla_user($user_info) { $usersConfig = JComponentHelper::getParams('com_users'); $authorize = JFactory::getACL(); $user = new JUser(); // Initialize new usertype setting $newUsertype = $usersConfig->get('new_usertype'); if (!$newUsertype) { $newUsertype = 'Registered'; } // Bind the user_info array to the user object if (!$user->bind($user_info)) { JError::raiseError(500, $user->getError()); } // Set some initial user values $user->set('id', 0); $user->set('usertype', $newUsertype); $system = 2; // ID of Registered $user->groups = array(); $user->groups[] = $system; $date = JFactory::getDate(); $user->set('registerDate', $date->toSql()); $parent = JFactory::getUser(); $user->setParam('u' . $parent->id . '_parent_id', $parent->id); if ($user_info['block']) { $user->set('block', '1'); } // If there was an error with registration if (!$user->save()) { return false; } /* Update profile additional data */ return JoomdleHelperMappings::save_user_info($user_info); }
/** * The default method that will display the output of this view which is called by * Joomla * * @param string template Template file name **/ public function display($tpl = null) { global $option; $mainframe =& JFactory::getApplication(); $userpoints = $this->get('UserPoints'); $pagination = $this->get('Pagination'); $ordering = $this->get('Ordering'); // Load tooltips JHTML::_('behavior.tooltip', '.hasTip'); $acl =& JFactory::getACL(); // $gtree = $acl->get_group_children_tree( null, 'USERS', false ); // echo '<pre>'; // var_dump($gtree); // echo '</pre>'; //$group = JHTML::_('select.genericlist', $gtree, 'gid', 'size="10"', 'value', 'text', 0 ); //var_dump($group); //$myGroups = $acl->get_object_groups( 18, 'ARO' ); //$myGroupName = $acl->get_group_name( 18, 'ARO' ); //echo $myGroupName; $this->assignRef('userpoints', $userpoints); $this->assignRef('pagination', $pagination); $this->assignRef('lists', $ordering); $this->assignRef('acl', $acl); parent::display($tpl); }
protected function parentGids() { // $hold = array(); if (count($this->gid)) { foreach ($this->gid as $gid) { if ($gid >= 5000) { $gids = array(); while ($gid > 5000) { try { $gid = SPFactory::db()->select('pid', 'spdb_user_group', array('gid' => $gid, 'enabled' => 1))->loadResult(); $gids[] = $gid; } catch (SPException $x) { Sobi::Error('permissions', SPLang::e('Cannot load additional gids. %s', $x->getMessage()), SPC::WARNING, 0, __LINE__, __CLASS__); } } $cgids = JFactory::getACL()->get_group_parents($gid, 'ARO', 'RECURSE'); $gids = array_merge($gids, $cgids); } else { $gids = JFactory::getACL()->get_group_parents($gid, 'ARO', 'RECURSE'); } if (is_array($gids) && count($gids)) { $this->gid = array_merge($gids, $this->gid); } } } // PHP 5.2.9 bug work-around if (defined('PHP_VERSION_ID') && version_compare(PHP_VERSION, '5.2.9') < 0) { $this->gid = array_unique($this->gid, SORT_STRING); } else { $this->gid = array_unique($this->gid); } }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { $input = JFactory::getApplication()->input; $task = $input->getString('task', ''); if (($task == 'save' || $task == 'apply') && (!JFactory::getUser()->authorise('core.edit.state', 'com_somosmaestros') && $array['state'] == 1)) { $array['state'] = 0; } if ($array['id'] == 0) { $array['created_by'] = JFactory::getUser()->id; } if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!JFactory::getUser()->authorise('core.admin', 'com_somosmaestros.video.' . $array['id'])) { $actions = JFactory::getACL()->getActions('com_somosmaestros', 'video'); $default_actions = JFactory::getACL()->getAssetRules('com_somosmaestros.video.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) { $array_jaccess[$action->name] = $default_actions[$action->name]; } $array['rules'] = $this->JAccessRulestoArray($array_jaccess); } //Bind the rules for ACL where supported. if (isset($array['rules']) && is_array($array['rules'])) { $this->setRules($array['rules']); } return parent::bind($array, $ignore); }
public function image($value = null, $name = 'image', $title = 'Image') { $doc =& JFactory::getDocument(); $script = "\t" . 'function jInsertEditorText( image, e_name ) { document.getElementById(e_name).value = image; document.getElementById(e_name+\'preview\').innerHTML = image; if(!image.test(\'http\')) { var el = $(e_name+\'preview\').getChildren().getLast(); var src = el.getProperty(\'src\'); el.setProperty(\'src\', \'' . JURI::root(true) . '/\'+src); document.getElementById(e_name).value = document.getElementById(e_name+\'preview\').innerHTML; } }'; if (!defined('JELEMENT_IMAGE')) { $doc->addScriptDeclaration($script); define('JELEMENT_IMAGE', true); } $media =& JComponentHelper::getParams('com_media'); $ranks = array('publisher', 'editor', 'author', 'registered'); $acl =& JFactory::getACL(); for ($i = 0; $i < $media->get('allowed_media_usergroup', 3); $i++) { $acl->addACL('com_media', 'popup', 'users', $ranks[$i]); } //Make sure the user is authorized to view this page $user =& JFactory::getUser(); if (!$user->authorize('com_media', 'popup')) { return JText::_('You\'re not authorized to access the media manager'); } //Create the modal window link. &e_name let us have multiple instances of the modal window. $link = 'index.php?option=com_media&view=images&tmpl=component&e_name=' . $name; JHTML::_('behavior.modal'); return ' <input type="hidden" name="' . $name . '" id="' . $name . '" value="' . htmlspecialchars($value, ENT_QUOTES, 'UTF-8') . '" /><div class="button2-left"><div class="image"><a class="modal" title="' . JText::_($title) . '" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 570, y: 400}}">' . JText::_($title) . '</a></div></div><br /><div id="' . $name . 'preview" class="image-preview">' . $value . '</div>'; }
/** * Overloaded bind function * * @param array $array Named array to bind * @param mixed $ignore An optional array or space separated list of properties to ignore while binding. * * @return mixed Null if operation was satisfactory, otherwise returns an error * * @since 1.5 */ public function bind($array, $ignore = '') { if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!JFactory::getUser()->authorise('core.admin', 'com_quick2cart.region.' . $array['id'])) { $actions = JFactory::getACL()->getActions('com_quick2cart', 'region'); $default_actions = JFactory::getACL()->getAssetRules('com_quick2cart.region.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) { $array_jaccess[$action->name] = $default_actions[$action->name]; } $array['rules'] = $this->JAccessRulestoArray($array_jaccess); } // Bind the rules for ACL where supported. if (isset($array['rules']) && is_array($array['rules'])) { $this->setRules($array['rules']); } return parent::bind($array, $ignore); }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { if (!JFactory::getUser()->authorise('core.edit.state', 'com_einsatzkomponente.einsatzbilderbearbeiten.' . $array['id']) && $array['state'] == 1) { $array['state'] = 0; } if (!isset($array['created_by']) || $array['created_by'] == 0) { $array['created_by'] = JFactory::getUser()->id; } if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!JFactory::getUser()->authorise('core.admin', 'com_einsatzkomponente.einsatzbilderbearbeiten.' . $array['id'])) { $actions = JFactory::getACL()->getActions('com_einsatzkomponente', 'einsatzbilderbearbeiten'); $default_actions = JFactory::getACL()->getAssetRules('com_einsatzkomponente.einsatzbilderbearbeiten.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) { $array_jaccess[$action->name] = $default_actions[$action->name]; } $array['rules'] = $this->JAccessRulestoArray($array_jaccess); } //Bind the rules for ACL where supported. if (isset($array['rules']) && is_array($array['rules'])) { $this->setRules($array['rules']); } return parent::bind($array, $ignore); }
/** * Display the button * * @return array A two element array of (imageName, textToInsert) */ function onDisplay($name) { $app =& JFactory::getApplication(); $params =& JComponentHelper::getParams('com_media'); $ranks = array('publisher', 'editor', 'author', 'registered'); $acl =& JFactory::getACL(); // TODO: Fix this ACL call //for($i = 0; $i < $params->get('allowed_media_usergroup', 3); $i++) //{ // $acl->addACL('com_media', 'popup', 'users', $ranks[$i]); //} // TODO: Fix this ACL call //Make sure the user is authorized to view this page $user =& JFactory::getUser(); if (!$user->authorize('com_media.popup')) { //return; } $doc =& JFactory::getDocument(); $template = $app->getTemplate(); $link = 'index.php?option=com_media&view=images&tmpl=component&e_name=' . $name; JHtml::_('behavior.modal'); $button = new JObject(); $button->set('modal', true); $button->set('link', $link); $button->set('text', JText::_('Image')); $button->set('name', 'image'); $button->set('options', "{handler: 'iframe', size: {x: 570, y: 400}}"); return $button; }
function fetchElement($name, $value, &$node, $control_name) { $access = JFactory::getACL(); // Include user in groups that have access to edit their articles, other articles, or manage content. $action = array('com_content.article.edit_own', 'com_content.article.edit_article', 'com_content.manage'); $groups = $access->getAuthorisedUsergroups($action, true); // Check the results of the access check. if (!$groups) { return false; } // Clean up and serialize. JArrayHelper::toInteger($groups); $groups = implode(',', $groups); // Build the query to get the users. $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('u.id AS value'); $query->select('u.name AS text'); $query->from('#__users AS u'); $query->join('INNER', '#__user_usergroup_map AS m ON m.user_id = u.id'); $query->where('u.block = 0'); $query->where('m.group_id IN (' . $groups . ')'); // Get the users. $db->setQuery((string) $query); $users = $db->loadObjectList(); // Check for a database error. if ($db->getErrorNum()) { JError::raiseNotice(500, $db->getErrorMsg()); return false; } return JHtml::_('select.genericlist', $users, $name, 'class="inputbox" size="1"', 'value', 'text', $value); }
function hikashopAcltableType() { if (version_compare(JVERSION, '1.6.0', '<')) { $acl =& JFactory::getACL(); $this->groups = $acl->get_group_children_tree(null, 'USERS', false); } else { $db = JFactory::getDBO(); $db->setQuery('SELECT a.*, a.title as text, a.id as value FROM #__usergroups AS a ORDER BY a.lft ASC'); $this->groups = $db->loadObjectList('id'); foreach ($this->groups as $id => $group) { if (isset($this->groups[$group->parent_id])) { $this->groups[$id]->level = intval(@$this->groups[$group->parent_id]->level) + 1; $this->groups[$id]->text = str_repeat('- - ', $this->groups[$id]->level) . $this->groups[$id]->text; } } } $this->choice = array(); $this->choice[] = JHTML::_('select.option', 'all', JText::_('HIKA_ALL')); $this->choice[] = JHTML::_('select.option', 'special', JText::_('HIKA_CUSTOM')); $this->config =& hikashop_config(); $js = "function updateACLTable(cat, action) {\r\n\t\t\tchoice = document['adminForm']['acl_'+cat];\r\n\t\t\tchoiceValue = 'special';\r\n\t\t\tfor (var i=0; i < choice.length; i++){\r\n\t\t\t\t if (choice[i].checked){\r\n\t\t\t\t\t choiceValue = choice[i].value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(choiceValue == 'all'){\r\n\t\t\t\tdocument.getElementById('div_acl_'+cat).style.display = 'none';\r\n\t\t\t}else{\r\n\t\t\t\tdocument.getElementById('div_acl_'+cat).style.display = 'block';\r\n\t\t\t\tfinalValue = '';\r\n\t\t\t\tfor(i=0;i<allGroups.length;i++){\r\n\t\t\t\t\tvar myvar = document.getElementById('acl_'+cat+'_'+allGroups[i]+'_'+action);\r\n\t\t\t\t\tif(myvar && myvar.checked){\r\n\t\t\t\t\t\t\t finalValue += myvar.value+',';\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tdocument.getElementById('acl_'+cat+'_'+action).value = finalValue;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfunction updateGroup(cat,groupid,actions){\r\n\t\t\tfor(i=0;i<actions.length;i++){\r\n\t\t\t\tvar myvar = document.getElementById('acl_'+cat+'_'+groupid+'_'+actions[i]);\r\n\t\t\t\tif(!myvar) return;\r\n\t\t\t\tmyvar.checked = 1 - myvar.checked;\r\n\t\t\t\tupdateACLTable(cat,actions[i]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tfunction updateAction(cat,action){\r\n\t\t\tfor(i=0;i<allGroups.length;i++){\r\n\t\t\t\tvar myvar = document.getElementById('acl_'+cat+'_'+allGroups[i]+'_'+action);\r\n\t\t\t\tif(myvar) myvar.checked = 1 - myvar.checked;\r\n\t\t\t}\r\n\t\t\tupdateACLTable(cat,action);\r\n\t\t}\r\n\t\tvar allGroups = new Array("; foreach ($this->groups as $oneGroup) { $js .= "'" . $oneGroup->value . "',"; } $js = rtrim($js, ',') . ");"; if (!HIKASHOP_PHP5) { $doc =& JFactory::getDocument(); } else { $doc = JFactory::getDocument(); } $doc->addScriptDeclaration($js); }
function createUser($username) { $new_user = new JUser(); $this->db->setQuery("SELECT email, isAdm FROM #__user WHERE name = " . $this->db->Quote($username)); $r = $this->db->loadRow(); $email = $r[0]; $isAdm = $r[1]; jimport('joomla.application.component.helper'); $config =& JComponentHelper::getParams('com_users'); if ($isAdm) { $usertype = 'Super Administrator'; } else { $usertype = $config->get('new_usertype', 'Registered'); } $acl =& JFactory::getACL(); $new_user->set('id', 0); $new_user->set('name', $username); $new_user->set('username', $username); $new_user->set('email', $email); $new_user->set('gid', $acl->get_group_id('', $usertype)); $new_user->set('usertype', $usertype); $new_user->set('registeredDate', date('Y-m-d H:i:s')); $new_user->set('lastVisitDate', date('Y-m-d H:i:s')); $table =& $new_user->getTable(); $new_user->params = $new_user->_params->toString(); $table->bind($new_user->getProperties()); // $new_user->save(); if ($table->store()) { return $table->get('id'); } }
function deleteuser($data) { jimport('joomla.user.helper'); require_once JPATH_SITE . '/components/com_community/libraries/core.php'; require_once JPATH_SITE . '/libraries/joomla/filesystem/folder.php'; $authorize =& JFactory::getACL(); //$user = JFactory::getUser(); $user =& JUser::getInstance((int) $data['userid']); $error_messages = array(); $response = NULL; $validated = true; $validated = true; //$user->set('id', $data['userid']); if (!$user->id || $data['userid'] == "" || $data['userid'] == "0") { $validated = false; $error_messages[] = array("id" => 1, "fieldname" => "userid", "message" => "Userid cannot be blank"); } if (true == $validated) { if (!$user->delete()) { $error_messages[] = array("id" => 1, "fieldname" => "userid", "message" => "userid not exist modify the field userid"); } } if (true == isset($error_messages) && 0 < sizeof($error_messages)) { $res = array(); foreach ($error_messages as $key => $error_message) { $res[] = $error_message; } $response = array("id" => 0, 'errors' => $res); } else { $response = array('id' => $user->id); } return $response; }
function init(&$object) { global $mainframe; $object->_db =& JFactory::getDBO(); $object->_mainframe = $mainframe; $object->_user =& JFactory::getUser(); $object->_acl =& JFactory::getACL(); }
public static function init() { // Joomla! 1.5 ACLs if (MageBridgeHelper::isJoomla15() == true) { $auth = JFactory::getACL(); $auth->addACL('com_magebridge', 'manage', 'users', 'super administrator'); $auth->addACL('com_magebridge', 'manage', 'users', 'administrator'); } }
public static function init() { // Joomla! 1.5 ACLs if (YireoHelper::isJoomla15()) { $auth =& JFactory::getACL(); $auth->addACL('com_simplelists', 'manage', 'users', 'super administrator'); $auth->addACL('com_simplelists', 'manage', 'users', 'administrator'); $auth->addACL('com_simplelists', 'manage', 'users', 'manager'); } }
public function getFormField($value = null) { if (MageBridgeHelper::isJoomla15()) { $acl = JFactory::getACL(); $gtree = $acl->get_group_children_tree(null, 'USERS', false); return JHTML::_('select.genericlist', $gtree, 'usergroup_id', null, 'value', 'text', $value); } else { return JHTML::_('access.usergroup', 'usergroup_id', $value, null, null, null); } }
function init(&$object) { global $mainframe; $object->_db =& JFactory::getDBO(); $object->_mainframe = $mainframe; $object->_user =& JFactory::getUser(); $object->_user->group_ids = implode(',', array_keys($object->_user->groups)); /* J16 make group ids easier to compare */ $object->_acl =& JFactory::getACL(); }
function site() { $mainframe = JFactory::getApplication(); $acl = JFactory::getACL(); $user = JFactory::getUser(); $option = JRequest::getCMD('option'); if ($acl->acl_check($option, 'site.block', 'users', $user->get('usertype'))) { $mainframe->redirect('index.php', JText::_('You dont have permission to access')); } }