Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/group.php.tar
Назад
home/wuectly/www/administrator/components/com_fields/models/group.php 0000604 00000022410 15245662307 0022322 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_fields * * @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Registry\Registry; /** * Group Model * * @since 3.7.0 */ class FieldsModelGroup extends JModelAdmin { /** * @var null|string * * @since 3.7.0 */ public $typeAlias = null; /** * Allowed batch commands * * @var array */ protected $batch_commands = array( 'assetgroup_id' => 'batchAccess', 'language_id' => 'batchLanguage' ); /** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success, False on error. * * @since 3.7.0 */ public function save($data) { // Alter the title for save as copy $input = JFactory::getApplication()->input; // Save new group as unpublished if ($input->get('task') == 'save2copy') { $data['state'] = 0; } return parent::save($data); } /** * Method to get a table object, load it if necessary. * * @param string $name The table name. Optional. * @param string $prefix The class prefix. Optional. * @param array $options Configuration array for model. Optional. * * @return JTable A JTable object * * @since 3.7.0 * @throws Exception */ public function getTable($name = 'Group', $prefix = 'FieldsTable', $options = array()) { $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_fields/tables'); return JTable::getInstance($name, $prefix, $options); } /** * Abstract method for getting the form from the model. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return mixed A JForm object on success, false on failure * * @since 3.7.0 */ public function getForm($data = array(), $loadData = true) { $context = $this->getState('filter.context'); $jinput = JFactory::getApplication()->input; if (empty($context) && isset($data['context'])) { $context = $data['context']; $this->setState('filter.context', $context); } // Get the form. $form = $this->loadForm( 'com_fields.group.' . $context, 'group', array( 'control' => 'jform', 'load_data' => $loadData, ) ); if (empty($form)) { return false; } // Modify the form based on Edit State access controls. if (empty($data['context'])) { $data['context'] = $context; } if (!JFactory::getUser()->authorise('core.edit.state', $context . '.fieldgroup.' . $jinput->get('id'))) { // Disable fields for display. $form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('state', 'disabled', 'true'); // Disable fields while saving. The controller has already verified this is a record you can edit. $form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('state', 'filter', 'unset'); } return $form; } /** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission for the component. * * @since 3.7.0 */ protected function canDelete($record) { if (empty($record->id) || $record->state != -2) { return false; } return JFactory::getUser()->authorise('core.delete', $record->context . '.fieldgroup.' . (int) $record->id); } /** * Method to test whether a record can have its state changed. * * @param object $record A record object. * * @return boolean True if allowed to change the state of the record. Defaults to the permission for the * component. * * @since 3.7.0 */ protected function canEditState($record) { $user = JFactory::getUser(); // Check for existing fieldgroup. if (!empty($record->id)) { return $user->authorise('core.edit.state', $record->context . '.fieldgroup.' . (int) $record->id); } // Default to component settings. return $user->authorise('core.edit.state', $record->context); } /** * Auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * * @since 3.7.0 */ protected function populateState() { parent::populateState(); $context = JFactory::getApplication()->getUserStateFromRequest('com_fields.groups.context', 'context', 'com_fields', 'CMD'); $this->setState('filter.context', $context); } /** * A protected method to get a set of ordering conditions. * * @param JTable $table A JTable object. * * @return array An array of conditions to add to ordering queries. * * @since 3.7.0 */ protected function getReorderConditions($table) { return 'context = ' . $this->_db->quote($table->context); } /** * Method to preprocess the form. * * @param JForm $form A JForm object. * @param mixed $data The data expected for the form. * @param string $group The name of the plugin group to import (defaults to "content"). * * @return void * * @see JFormField * @since 3.7.0 * @throws Exception if there is an error in the form event. */ protected function preprocessForm(JForm $form, $data, $group = 'content') { parent::preprocessForm($form, $data, $group); $parts = FieldsHelper::extract($this->state->get('filter.context')); // Extract the component name $component = $parts[0]; // Extract the optional section name $section = (count($parts) > 1) ? $parts[1] : null; if ($parts) { // Set the access control rules field component value. $form->setFieldAttribute('rules', 'component', $component); } if ($section !== null) { // Looking first in the component models/forms folder $path = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/models/forms/fieldgroup/' . $section . '.xml'); if (file_exists($path)) { $lang = JFactory::getLanguage(); $lang->load($component, JPATH_BASE, null, false, true); $lang->load($component, JPATH_BASE . '/components/' . $component, null, false, true); if (!$form->loadFile($path, false)) { throw new Exception(JText::_('JERROR_LOADFILE_FAILED')); } } } } /** * Method to validate the form data. * * @param JForm $form The form to validate against. * @param array $data The data to validate. * @param string $group The name of the field group to validate. * * @return array|boolean Array of filtered data if valid, false otherwise. * * @see JFormRule * @see JFilterInput * @since 3.9.23 */ public function validate($form, $data, $group = null) { // Don't allow to change the users if not allowed to access com_users. if (!JFactory::getUser()->authorise('core.manage', 'com_users')) { if (isset($data['created_by'])) { unset($data['created_by']); } } if (!JFactory::getUser()->authorise('core.admin', 'com_fields')) { if (isset($data['rules'])) { unset($data['rules']); } } return parent::validate($form, $data, $group); } /** * Method to get the data that should be injected in the form. * * @return array The default data is an empty array. * * @since 3.7.0 */ protected function loadFormData() { // Check the session for previously entered form data. $app = JFactory::getApplication(); $data = $app->getUserState('com_fields.edit.group.data', array()); if (empty($data)) { $data = $this->getItem(); // Pre-select some filters (Status, Language, Access) in edit form if those have been selected in Field Group Manager if (!$data->id) { // Check for which context the Field Group Manager is used and get selected fields $context = substr($app->getUserState('com_fields.groups.filter.context'), 4); $filters = (array) $app->getUserState('com_fields.groups.' . $context . '.filter'); $data->set( 'state', $app->input->getInt('state', (!empty($filters['state']) ? $filters['state'] : null)) ); $data->set( 'language', $app->input->getString('language', (!empty($filters['language']) ? $filters['language'] : null)) ); $data->set( 'access', $app->input->getInt('access', (!empty($filters['access']) ? $filters['access'] : JFactory::getConfig()->get('access'))) ); } } $this->preprocessData('com_fields.group', $data); return $data; } /** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 3.7.0 */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { // Prime required properties. if (empty($item->id)) { $item->context = $this->getState('filter.context'); } if (property_exists($item, 'params')) { $item->params = new Registry($item->params); } } return $item; } /** * Clean the cache * * @param string $group The cache group * @param integer $clientId The ID of the client * * @return void * * @since 3.7.0 */ protected function cleanCache($group = null, $clientId = 0) { $context = JFactory::getApplication()->input->get('context'); parent::cleanCache($context); } } home/wuectly/www/administrator/components/com_users/models/group.php 0000604 00000021014 15245670137 0022214 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; /** * User group model. * * @since 1.6 */ class UsersModelGroup extends JModelAdmin { /** * Constructor * * @param array $config An optional associative array of configuration settings. */ public function __construct($config = array()) { $config = array_merge( array( 'event_after_delete' => 'onUserAfterDeleteGroup', 'event_after_save' => 'onUserAfterSaveGroup', 'event_before_delete' => 'onUserBeforeDeleteGroup', 'event_before_save' => 'onUserBeforeSaveGroup', 'events_map' => array('delete' => 'user', 'save' => 'user') ), $config ); parent::__construct($config); } /** * Returns a reference to the a Table object, always creating it. * * @param string $type The table type to instantiate * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * * @return JTable A database object * * @since 1.6 */ public function getTable($type = 'Usergroup', $prefix = 'JTable', $config = array()) { $return = JTable::getInstance($type, $prefix, $config); return $return; } /** * Method to get the record form. * * @param array $data An optional array of data for the form to interrogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return JForm A JForm object on success, false on failure * * @since 1.6 */ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_users.group', 'group', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) { return false; } return $form; } /** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * * @since 1.6 */ protected function loadFormData() { // Check the session for previously entered form data. $data = JFactory::getApplication()->getUserState('com_users.edit.group.data', array()); if (empty($data)) { $data = $this->getItem(); } $this->preprocessData('com_users.group', $data); return $data; } /** * Override preprocessForm to load the user plugin group instead of content. * * @param JForm $form A form object. * @param mixed $data The data expected for the form. * @param string $group The name of the plugin group to import (defaults to "content"). * * @return void * * @since 1.6 * @throws Exception if there is an error loading the form. */ protected function preprocessForm(JForm $form, $data, $group = '') { $obj = is_array($data) ? ArrayHelper::toObject($data, 'JObject') : $data; if (isset($obj->parent_id) && $obj->parent_id == 0 && $obj->id > 0) { $form->setFieldAttribute('parent_id', 'type', 'hidden'); $form->setFieldAttribute('parent_id', 'hidden', 'true'); } parent::preprocessForm($form, $data, 'user'); } /** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { // Include the user plugins for events. JPluginHelper::importPlugin($this->events_map['save']); /** * Check the super admin permissions for group * We get the parent group permissions and then check the group permissions manually * We have to calculate the group permissions manually because we haven't saved the group yet */ $parentSuperAdmin = JAccess::checkGroup($data['parent_id'], 'core.admin'); // Get core.admin rules from the root asset $rules = JAccess::getAssetRules('root.1')->getData('core.admin'); // Get the value for the current group (will be true (allowed), false (denied), or null (inherit) $groupSuperAdmin = $rules['core.admin']->allow($data['id']); // We only need to change the $groupSuperAdmin if the parent is true or false. Otherwise, the value set in the rule takes effect. if ($parentSuperAdmin === false) { // If parent is false (Denied), effective value will always be false $groupSuperAdmin = false; } elseif ($parentSuperAdmin === true) { // If parent is true (allowed), group is true unless explicitly set to false $groupSuperAdmin = ($groupSuperAdmin === false) ? false : true; } // Check for non-super admin trying to save with super admin group $iAmSuperAdmin = JFactory::getUser()->authorise('core.admin'); if (!$iAmSuperAdmin && $groupSuperAdmin) { $this->setError(JText::_('JLIB_USER_ERROR_NOT_SUPERADMIN')); return false; } /** * Check for super-admin changing self to be non-super-admin * First, are we a super admin */ if ($iAmSuperAdmin) { // Next, are we a member of the current group? $myGroups = JAccess::getGroupsByUser(JFactory::getUser()->get('id'), false); if (in_array($data['id'], $myGroups)) { // Now, would we have super admin permissions without the current group? $otherGroups = array_diff($myGroups, array($data['id'])); $otherSuperAdmin = false; foreach ($otherGroups as $otherGroup) { $otherSuperAdmin = $otherSuperAdmin ?: JAccess::checkGroup($otherGroup, 'core.admin'); } /** * If we would not otherwise have super admin permissions * and the current group does not have super admin permissions, throw an exception */ if ((!$otherSuperAdmin) && (!$groupSuperAdmin)) { $this->setError(JText::_('JLIB_USER_ERROR_CANNOT_DEMOTE_SELF')); return false; } } } if (JFactory::getApplication()->input->get('task') == 'save2copy') { $data['title'] = $this->generateGroupTitle($data['parent_id'], $data['title']); } // Proceed with the save return parent::save($data); } /** * Method to delete rows. * * @param array &$pks An array of item ids. * * @return boolean Returns true on success, false on failure. * * @since 1.6 * @throws Exception */ public function delete(&$pks) { // Typecast variable. $pks = (array) $pks; $user = JFactory::getUser(); $groups = JAccess::getGroupsByUser($user->get('id')); // Get a row instance. $table = $this->getTable(); // Load plugins. JPluginHelper::importPlugin($this->events_map['delete']); $dispatcher = JEventDispatcher::getInstance(); // Check if I am a Super Admin $iAmSuperAdmin = $user->authorise('core.admin'); foreach ($pks as $pk) { // Do not allow to delete groups to which the current user belongs if (in_array($pk, $groups)) { JError::raiseWarning(403, JText::_('COM_USERS_DELETE_ERROR_INVALID_GROUP')); return false; } // Check if the item exists. elseif (!$table->load($pk)) { $this->setError($table->getError()); return false; } } // Iterate the items to delete each one. foreach ($pks as $i => $pk) { if ($table->load($pk)) { // Access checks. $allow = $user->authorise('core.edit.state', 'com_users'); // Don't allow non-super-admin to delete a super admin $allow = (!$iAmSuperAdmin && JAccess::checkGroup($pk, 'core.admin')) ? false : $allow; if ($allow) { // Fire the before delete event. $dispatcher->trigger($this->event_before_delete, array($table->getProperties())); if (!$table->delete($pk)) { $this->setError($table->getError()); return false; } else { // Trigger the after delete event. $dispatcher->trigger($this->event_after_delete, array($table->getProperties(), true, $this->getError())); } } else { // Prune items that you can't change. unset($pks[$i]); JError::raiseWarning(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); } } } return true; } /** * Method to generate the title of group on Save as Copy action * * @param integer $parentId The id of the parent. * @param string $title The title of group * * @return string Contains the modified title. * * @since 3.3.7 */ protected function generateGroupTitle($parentId, $title) { // Alter the title & alias $table = $this->getTable(); while ($table->load(array('title' => $title, 'parent_id' => $parentId))) { if ($title == $table->title) { $title = StringHelper::increment($title); } } return $title; } } home/wuectly/www/libraries/joomla/facebook/group.php 0000604 00000016154 15245727236 0016707 0 ustar 00 <?php /** * @package Joomla.Platform * @subpackage Facebook * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die(); /** * Facebook API Group class for the Joomla Platform. * * @link http://developers.facebook.com/docs/reference/api/group/ * @since 3.2.0 * @deprecated 4.0 Use the `joomla/facebook` package via Composer instead */ class JFacebookGroup extends JFacebookObject { /** * Method to read a group. Requires authentication and user_groups or friends_groups permission for non-public groups. * * @param string $group The group id. * * @return mixed The decoded JSON response or false if the client is not authenticated. * * @since 3.2.0 */ public function getGroup($group) { return $this->get($group); } /** * Method to get the group's wall. Requires authentication and user_groups or friends_groups permission for non-public groups. * * @param string $group The group id. * @param integer $limit The number of objects per page. * @param integer $offset The object's number on the page. * @param string $until A unix timestamp or any date accepted by strtotime. * @param string $since A unix timestamp or any date accepted by strtotime. * * @return mixed The decoded JSON response or false if the client is not authenticated. * * @since 3.2.0 */ public function getFeed($group, $limit = 0, $offset = 0, $until = null, $since = null) { return $this->getConnection($group, 'feed', '', $limit, $offset, $until, $since); } /** * Method to get the group's members. Requires authentication and user_groups or friends_groups permission for non-public groups. * * @param string $group The group id. * @param integer $limit The number of objects per page. * @param integer $offset The object's number on the page. * * @return mixed The decoded JSON response or false if the client is not authenticated. * * @since 3.2.0 */ public function getMembers($group, $limit = 0, $offset = 0) { return $this->getConnection($group, 'members', '', $limit, $offset); } /** * Method to get the group's docs. Requires authentication and user_groups or friends_groups permission for non-public groups. * * @param string $group The group id. * @param integer $limit The number of objects per page. * @param integer $offset The object's number on the page. * @param string $until A unix timestamp or any date accepted by strtotime. * @param string $since A unix timestamp or any date accepted by strtotime. * * @return mixed The decoded JSON response or false if the client is not authenticated. * * @since 3.2.0 */ public function getDocs($group, $limit = 0, $offset = 0, $until = null, $since = null) { return $this->getConnection($group, 'docs', '', $limit, $offset, $until, $since); } /** * Method to get the groups's picture. Requires authentication and user_groups or friends_groups permission. * * @param string $group The group id. * @param string $type To request a different photo use square | small | normal | large. * * @return string The URL to the group's picture. * * @since 3.2.0 */ public function getPicture($group, $type = null) { if ($type) { $type = '?type=' . $type; } return $this->getConnection($group, 'picture', $type); } /** * Method to post a link on group's wall. Requires authentication and publish_stream permission. * * @param string $group The group id. * @param string $link Link URL. * @param string $message Link message. * * @return mixed The decoded JSON response or false if the client is not authenticated. * * @since 3.2.0 */ public function createLink($group, $link, $message = null) { // Set POST request parameters. $data = array(); $data['link'] = $link; if ($message) { $data['message'] = $message; } return $this->createConnection($group, 'feed', $data); } /** * Method to delete a link. Requires authentication. * * @param mixed $link The Link ID. * * @return boolean Returns true if successful, and false otherwise. * * @since 3.2.0 */ public function deleteLink($link) { return $this->deleteConnection($link); } /** * Method to post on group's wall. Message or link parameter is required. Requires authentication and publish_stream permission. * * @param string $group The group id. * @param string $message Post message. * @param string $link Post URL. * @param string $picture Post thumbnail image (can only be used if link is specified) * @param string $name Post name (can only be used if link is specified). * @param string $caption Post caption (can only be used if link is specified). * @param string $description Post description (can only be used if link is specified). * @param array $actions Post actions array of objects containing name and link. * * @return mixed The decoded JSON response or false if the client is not authenticated. * * @since 3.2.0 */ public function createPost($group, $message = null, $link = null, $picture = null, $name = null, $caption = null, $description = null, $actions = null) { // Set POST request parameters. if ($message) { $data['message'] = $message; } if ($link) { $data['link'] = $link; } if ($name) { $data['name'] = $name; } if ($caption) { $data['caption'] = $caption; } if ($description) { $data['description'] = $description; } if ($actions) { $data['actions'] = $actions; } if ($picture) { $data['picture'] = $picture; } return $this->createConnection($group, 'feed', $data); } /** * Method to delete a post. Note: you can only delete the post if it was created by the current user. Requires authentication. * * @param string $post The Post ID. * * @return boolean Returns true if successful, and false otherwise. * * @since 3.2.0 */ public function deletePost($post) { return $this->deleteConnection($post); } /** * Method to post a status message on behalf of the user on the group's wall. Requires authentication and publish_stream permission. * * @param string $group The group id. * @param string $message Status message content. * * @return mixed The decoded JSON response or false if the client is not authenticated. * * @since 3.2.0 */ public function createStatus($group, $message) { // Set POST request parameters. $data = array(); $data['message'] = $message; return $this->createConnection($group, 'feed', $data); } /** * Method to delete a status. Note: you can only delete the status if it was created by the current user. Requires authentication. * * @param string $status The Status ID. * * @return boolean Returns true if successful, and false otherwise. * * @since 3.2.0 */ public function deleteStatus($status) { return $this->deleteConnection($status); } } home/wuectly/www/administrator/components/com_fields/tables/group.php 0000604 00000010704 15245741121 0022304 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_fields * * @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Registry\Registry; /** * Groups Table * * @since 3.7.0 */ class FieldsTableGroup extends JTable { /** * Class constructor. * * @param JDatabaseDriver $db JDatabaseDriver object. * * @since 3.7.0 */ public function __construct($db = null) { parent::__construct('#__fields_groups', 'id', $db); $this->setColumnAlias('published', 'state'); } /** * Method to bind an associative array or object to the JTable instance.This * method only binds properties that are publicly accessible and optionally * takes an array of properties to ignore when binding. * * @param mixed $src An associative array or object to bind to the JTable instance. * @param mixed $ignore An optional array or space separated list of properties to ignore while binding. * * @return boolean True on success. * * @since 3.7.0 * @throws InvalidArgumentException */ public function bind($src, $ignore = '') { if (isset($src['params']) && is_array($src['params'])) { $registry = new Registry; $registry->loadArray($src['params']); $src['params'] = (string) $registry; } // Bind the rules. if (isset($src['rules']) && is_array($src['rules'])) { $rules = new JAccessRules($src['rules']); $this->setRules($rules); } return parent::bind($src, $ignore); } /** * Method to perform sanity checks on the JTable instance properties to ensure * they are safe to store in the database. Child classes should override this * method to make sure the data they are storing in the database is safe and * as expected before storage. * * @return boolean True if the instance is sane and able to be stored in the database. * * @link https://docs.joomla.org/Special:MyLanguage/JTable/check * @since 3.7.0 */ public function check() { // Check for a title. if (trim($this->title) == '') { $this->setError(JText::_('COM_FIELDS_MUSTCONTAIN_A_TITLE_GROUP')); return false; } $date = JFactory::getDate(); $user = JFactory::getUser(); if ($this->id) { $this->modified = $date->toSql(); $this->modified_by = $user->get('id'); } else { if (!(int) $this->created) { $this->created = $date->toSql(); } if (empty($this->created_by)) { $this->created_by = $user->get('id'); } } return true; } /** * Method to compute the default name of the asset. * The default name is in the form table_name.id * where id is the value of the primary key of the table. * * @return string * * @since 3.7.0 */ protected function _getAssetName() { $component = explode('.', $this->context); return $component[0] . '.fieldgroup.' . (int) $this->id; } /** * Method to return the title to use for the asset table. In * tracking the assets a title is kept for each asset so that there is some * context available in a unified access manager. Usually this would just * return $this->title or $this->name or whatever is being used for the * primary name of the row. If this method is not overridden, the asset name is used. * * @return string The string to use as the title in the asset table. * * @link https://docs.joomla.org/Special:MyLanguage/JTable/getAssetTitle * @since 3.7.0 */ protected function _getAssetTitle() { return $this->title; } /** * Method to get the parent asset under which to register this one. * By default, all assets are registered to the ROOT node with ID, * which will default to 1 if none exists. * The extended class can define a table and id to lookup. If the * asset does not exist it will be created. * * @param JTable $table A JTable object for the asset parent. * @param integer $id Id to look up * * @return integer * * @since 3.7.0 */ protected function _getAssetParentId(JTable $table = null, $id = null) { $component = explode('.', $this->context); $db = $this->getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) ->where($db->quoteName('name') . ' = ' . $db->quote($component[0])); $db->setQuery($query); if ($assetId = (int) $db->loadResult()) { return $assetId; } return parent::_getAssetParentId($table, $id); } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка