/** * Exécute la recherche */ function execute_search($search, &$search_modules, &$modules_args, &$results) { $requests = array(); $config = SearchConfig::load(); foreach ($search_modules as $module_id => $module) { if (!$search->is_in_cache($module_id)) { $modules_args[$module_id]['weight'] = $config->get_weightings()->get_module_weighting($module_id); // On rajoute l'identifiant de recherche comme parametre pour faciliter la requete $modules_args[$module_id]['id_search'] = !empty($search->id_search[$module_id]) ? $search->id_search[$module_id] : 0; $requests[$module_id] = $module->get_search_request($modules_args[$module_id]); } } $search->insert_results($requests); }
private function get_authorizations($bit) { return AppContext::get_current_user()->check_auth(SearchConfig::load()->get_authorizations(), $bit); }
if ($search_in !== 'all') { $selected_modules = array($search_in); } else { if (count($selected_modules) == 1) { $module = $selected_modules['0']; $search_in = $module; } } //--------------------------------------------------------------------- Header define('TITLE', $LANG['title_search']); require_once '../kernel/header.php'; $tpl->assign_vars(array('L_TITLE_SEARCH' => TITLE, 'L_SEARCH' => $LANG['title_search'], 'TEXT_SEARCHED' => $unsecure_search, 'L_SEARCH_ALL' => $LANG['search_all'], 'L_SEARCH_KEYWORDS' => $LANG['search_keywords'], 'L_SEARCH_MIN_LENGTH' => $LANG['search_min_length'], 'L_SEARCH_IN_MODULES' => $LANG['search_in_modules'], 'L_SEARCH_IN_MODULES_EXPLAIN' => $LANG['search_in_modules_explain'], 'L_SEARCH_SPECIALIZED_FORM' => $LANG['search_specialized_form'], 'L_SEARCH_SPECIALIZED_FORM_EXPLAIN' => $LANG['search_specialized_form_explain'], 'L_WARNING_LENGTH_STRING_SEARCH' => TextHelper::to_js_string($LANG['warning_length_string_searched']), 'L_FORMS' => $LANG['forms'], 'L_ADVANCED_SEARCH' => $LANG['advanced_search'], 'L_SIMPLE_SEARCH' => $LANG['simple_search'], 'U_FORM_VALID' => url('../search/search.php#results'), 'C_SIMPLE_SEARCH' => $search_in == 'all' ? true : false, 'SEARCH_MODE_MODULE' => $search_in)); //------------------------------------------------------------- Other includes require_once '../search/search.inc.php'; //----------------------------------------------------------------------- Main $config = SearchConfig::load(); $modules_args = array(); $used_modules = array(); // Génération des formulaires précomplétés et passage aux templates $provider_service = AppContext::get_extension_provider_service(); $search_extensions_point_modules = array_keys($provider_service->get_extension_point(SearchableExtensionPoint::EXTENSION_POINT)); $search_extensions_point = $provider_service->get_extension_point(SearchableExtensionPoint::EXTENSION_POINT); foreach (ModulesManager::get_installed_modules_map_sorted_by_localized_name() as $id => $module) { if (in_array($module->get_id(), $search_extensions_point_modules)) { $module_configuration = $module->get_configuration(); if (!in_array($module->get_id(), $config->get_all_unauthorized_providers())) { // Ajout du paramètre search à tous les modules $modules_args[$module->get_id()]['search'] = $search; if ($search_extensions_point[$module->get_id()]->has_search_options()) { // Récupération de la liste des paramètres $form_module_args = $search_extensions_point[$module->get_id()]->get_search_args();
* it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ###################################################*/ define('CACHE_TIME', SearchConfig::load()->get_cache_lifetime()); define('CACHE_TIMES_USED', SearchConfig::load()->get_cache_max_uses()); /** * @author Loic Rouchon <*****@*****.**> * @desc * @package {@package} */ class Search { public $id_search = array(); private $search; private $modules; private $modules_conditions; private $id_user; private $errors; private $db_querier; //----------------------------------------------------------------- PUBLIC