Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/behavior.zip
Назад
PK P�!]¦=� � language.phpnu &1i� <?php /** * @package FrameworkOnFramework * @subpackage model * @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // Protect from unauthorized access defined('F0F_INCLUDED') or die; /** * FrameworkOnFramework model behavior class to filter front-end access to items * based on the language. * * @package FrameworkOnFramework * @since 2.1 */ class F0FModelBehaviorLanguage extends F0FModelBehavior { /** * This event runs before we have built the query used to fetch a record * list in a model. It is used to blacklist the language filter * * @param F0FModel &$model The model which calls this event * @param F0FDatabaseQuery &$query The model which calls this event * * @return void */ public function onBeforeBuildQuery(&$model, &$query) { if (F0FPlatform::getInstance()->isFrontend()) { $model->blacklistFilters('language'); } } /** * This event runs after we have built the query used to fetch a record * list in a model. It is used to apply automatic query filters. * * @param F0FModel &$model The model which calls this event * @param F0FDatabaseQuery &$query The model which calls this event * * @return void */ public function onAfterBuildQuery(&$model, &$query) { // This behavior only applies to the front-end. if (!F0FPlatform::getInstance()->isFrontend()) { return; } // Get the name of the language field $table = $model->getTable(); $languageField = $table->getColumnAlias('language'); // Make sure the access field actually exists if (!in_array($languageField, $table->getKnownFields())) { return; } // Make sure it is a multilingual site and get a list of languages $app = JFactory::getApplication(); $hasLanguageFilter = method_exists($app, 'getLanguageFilter'); if ($hasLanguageFilter) { $hasLanguageFilter = $app->getLanguageFilter(); } if (!$hasLanguageFilter) { return; } $lang_filter_plugin = JPluginHelper::getPlugin('system', 'languagefilter'); $lang_filter_params = new JRegistry($lang_filter_plugin->params); $languages = array('*'); if ($lang_filter_params->get('remove_default_prefix')) { // Get default site language $lg = F0FPlatform::getInstance()->getLanguage(); $languages[] = $lg->getTag(); } else { $languages[] = JFactory::getApplication()->input->getCmd('language', '*'); } // Filter out double languages $languages = array_unique($languages); // And filter the query output by these languages $db = F0FPlatform::getInstance()->getDbo(); // Alias $alias = $model->getTableAlias(); $alias = $alias ? $db->qn($alias) . '.' : ''; $languages = array_map(array($db, 'quote'), $languages); $query->where($alias . $db->qn($languageField) . ' IN (' . implode(',', $languages) . ')'); } /** * The event runs after F0FModel has called F0FTable and retrieved a single * item from the database. It is used to apply automatic filters. * * @param F0FModel &$model The model which was called * @param F0FTable &$record The record loaded from the databae * * @return void */ public function onAfterGetItem(&$model, &$record) { if ($record instanceof F0FTable) { $fieldName = $record->getColumnAlias('language'); // Make sure the field actually exists if (!in_array($fieldName, $record->getKnownFields())) { return; } // Make sure it is a multilingual site and get a list of languages $app = JFactory::getApplication(); $hasLanguageFilter = method_exists($app, 'getLanguageFilter'); if ($hasLanguageFilter) { $hasLanguageFilter = $app->getLanguageFilter(); } if (!$hasLanguageFilter) { return; } $lang_filter_plugin = JPluginHelper::getPlugin('system', 'languagefilter'); $lang_filter_params = new JRegistry($lang_filter_plugin->params); $languages = array('*'); if ($lang_filter_params->get('remove_default_prefix')) { // Get default site language $lg = F0FPlatform::getInstance()->getLanguage(); $languages[] = $lg->getTag(); } else { $languages[] = JFactory::getApplication()->input->getCmd('language', '*'); } // Filter out double languages $languages = array_unique($languages); if (!in_array($record->$fieldName, $languages)) { $record = null; } } } } PK P�!]�:\� � private.phpnu &1i� <?php /** * @package FrameworkOnFramework * @subpackage model * @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // Protect from unauthorized access defined('F0F_INCLUDED') or die; /** * FrameworkOnFramework model behavior class to filter front-end access to items * craeted by the currently logged in user only. * * @package FrameworkOnFramework * @since 2.1 */ class F0FModelBehaviorPrivate extends F0FModelBehavior { /** * This event runs after we have built the query used to fetch a record * list in a model. It is used to apply automatic query filters. * * @param F0FModel &$model The model which calls this event * @param F0FDatabaseQuery &$query The model which calls this event * * @return void */ public function onAfterBuildQuery(&$model, &$query) { // This behavior only applies to the front-end. if (!F0FPlatform::getInstance()->isFrontend()) { return; } // Get the name of the access field $table = $model->getTable(); $createdField = $table->getColumnAlias('created_by'); // Make sure the access field actually exists if (!in_array($createdField, $table->getKnownFields())) { return; } // Get the current user's id $user_id = F0FPlatform::getInstance()->getUser()->id; // And filter the query output by the user id $db = F0FPlatform::getInstance()->getDbo(); $alias = $model->getTableAlias(); $alias = $alias ? $db->qn($alias) . '.' : ''; $query->where($alias . $db->qn($createdField) . ' = ' . $db->q($user_id)); } /** * The event runs after F0FModel has called F0FTable and retrieved a single * item from the database. It is used to apply automatic filters. * * @param F0FModel &$model The model which was called * @param F0FTable &$record The record loaded from the databae * * @return void */ public function onAfterGetItem(&$model, &$record) { if ($record instanceof F0FTable) { $keyName = $record->getKeyName(); if ($record->$keyName === null) { return; } $fieldName = $record->getColumnAlias('created_by'); // Make sure the field actually exists if (!in_array($fieldName, $record->getKnownFields())) { return; } $user_id = F0FPlatform::getInstance()->getUser()->id; if ($record->$fieldName != $user_id) { $record = null; } } } } PK P�!]�E��[ [ access.phpnu &1i� <?php /** * @package FrameworkOnFramework * @subpackage model * @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // Protect from unauthorized access defined('F0F_INCLUDED') or die; /** * FrameworkOnFramework model behavior class to filter front-end access to items * based on the viewing access levels. * * @package FrameworkOnFramework * @since 2.1 */ class F0FModelBehaviorAccess extends F0FModelBehavior { /** * This event runs after we have built the query used to fetch a record * list in a model. It is used to apply automatic query filters. * * @param F0FModel &$model The model which calls this event * @param F0FDatabaseQuery &$query The model which calls this event * * @return void */ public function onAfterBuildQuery(&$model, &$query) { // This behavior only applies to the front-end. if (!F0FPlatform::getInstance()->isFrontend()) { return; } // Get the name of the access field $table = $model->getTable(); $accessField = $table->getColumnAlias('access'); // Make sure the field actually exists if (!in_array($accessField, $table->getKnownFields())) { return; } $model->applyAccessFiltering(null); } /** * The event runs after F0FModel has called F0FTable and retrieved a single * item from the database. It is used to apply automatic filters. * * @param F0FModel &$model The model which was called * @param F0FTable &$record The record loaded from the databae * * @return void */ public function onAfterGetItem(&$model, &$record) { if ($record instanceof F0FTable) { $fieldName = $record->getColumnAlias('access'); // Make sure the field actually exists if (!in_array($fieldName, $record->getKnownFields())) { return; } // Get the user $user = F0FPlatform::getInstance()->getUser(); // Filter by authorised access levels if (!in_array($record->$fieldName, $user->getAuthorisedViewLevels())) { $record = null; } } } } PK P�!]�vE�e e filters.phpnu &1i� <?php /** * @package FrameworkOnFramework * @subpackage model * @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // Protect from unauthorized access defined('F0F_INCLUDED') or die; /** * FrameworkOnFramework model behavior class * * @package FrameworkOnFramework * @since 2.1 */ class F0FModelBehaviorFilters extends F0FModelBehavior { /** * This event runs after we have built the query used to fetch a record * list in a model. It is used to apply automatic query filters. * * @param F0FModel &$model The model which calls this event * @param F0FDatabaseQuery &$query The model which calls this event * * @return void */ public function onAfterBuildQuery(&$model, &$query) { $table = $model->getTable(); $tableName = $table->getTableName(); $tableKey = $table->getKeyName(); $db = $model->getDBO(); $filterzero = $model->getState('_emptynonzero', null); $fields = $model->getTableFields(); $backlist = $model->blacklistFilters(); foreach ($fields as $fieldname => $fieldtype) { if (in_array($fieldname, $backlist)) { continue; } $field = new stdClass; $field->name = $fieldname; $field->type = $fieldtype; $field->filterzero = $filterzero; $filterName = ($field->name == $tableKey) ? 'id' : $field->name; $filterState = $model->getState($filterName, null); $field = F0FModelField::getField($field, array('dbo' => $db, 'table_alias' => $model->getTableAlias())); if ((is_array($filterState) && ( array_key_exists('value', $filterState) || array_key_exists('from', $filterState) || array_key_exists('to', $filterState) )) || is_object($filterState)) { $options = new JRegistry($filterState); } else { $options = new JRegistry; $options->set('value', $filterState); } $methods = $field->getSearchMethods(); $method = $options->get('method', $field->getDefaultSearchMethod()); if (!in_array($method, $methods)) { $method = 'exact'; } switch ($method) { case 'between': case 'outside': case 'range' : $sql = $field->$method($options->get('from', null), $options->get('to')); break; case 'interval': case 'modulo': $sql = $field->$method($options->get('value', null), $options->get('interval')); break; case 'exact': case 'partial': case 'search': default: $sql = $field->$method($options->get('value', null)); break; } if ($sql) { $query->where($sql); } } } } PK P�!]�Njn� � enabled.phpnu &1i� <?php /** * @package FrameworkOnFramework * @subpackage model * @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // Protect from unauthorized access defined('F0F_INCLUDED') or die; /** * FrameworkOnFramework model behavior class to filter front-end access to items * that are enabled. * * @package FrameworkOnFramework * @since 2.1 */ class F0FModelBehaviorEnabled extends F0FModelBehavior { /** * This event runs after we have built the query used to fetch a record * list in a model. It is used to apply automatic query filters. * * @param F0FModel &$model The model which calls this event * @param F0FDatabaseQuery &$query The model which calls this event * * @return void */ public function onAfterBuildQuery(&$model, &$query) { // This behavior only applies to the front-end. if (!F0FPlatform::getInstance()->isFrontend()) { return; } // Get the name of the enabled field $table = $model->getTable(); $enabledField = $table->getColumnAlias('enabled'); // Make sure the field actually exists if (!in_array($enabledField, $table->getKnownFields())) { return; } // Filter by enabled fields only $db = F0FPlatform::getInstance()->getDbo(); // Alias $alias = $model->getTableAlias(); $alias = $alias ? $db->qn($alias) . '.' : ''; $query->where($alias . $db->qn($enabledField) . ' = ' . $db->q(1)); } /** * The event runs after F0FModel has called F0FTable and retrieved a single * item from the database. It is used to apply automatic filters. * * @param F0FModel &$model The model which was called * @param F0FTable &$record The record loaded from the databae * * @return void */ public function onAfterGetItem(&$model, &$record) { if ($record instanceof F0FTable) { $fieldName = $record->getColumnAlias('enabled'); // Make sure the field actually exists if (!in_array($fieldName, $record->getKnownFields())) { return; } if ($record->$fieldName != 1) { $record = null; } } } } PK P�!]�C��Z Z emptynonzero.phpnu &1i� <?php /** * @package FrameworkOnFramework * @subpackage model * @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // Protect from unauthorized access defined('F0F_INCLUDED') or die; /** * FrameworkOnFramework model behavior class * * @package FrameworkOnFramework * @since 2.1 */ class F0FModelBehaviorEmptynonzero extends F0FModelBehavior { /** * This event runs when we are building the query used to fetch a record * list in a model * * @param F0FModel &$model The model which calls this event * @param F0FDatabaseQuery &$query The query being built * * @return void */ public function onBeforeBuildQuery(&$model, &$query) { $model->setState('_emptynonzero', '1'); } } PK P�!]¦=� � language.phpnu &1i� PK P�!]�:\� � � private.phpnu &1i� PK P�!]�E��[ [ � access.phpnu &1i� PK P�!]�vE�e e =$ filters.phpnu &1i� PK P�!]�Njn� � �. enabled.phpnu &1i� PK P�!]�C��Z Z �7 emptynonzero.phpnu &1i� PK � 6;
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка