getPref(); //$search_handlers['news'] = ADLAN_0; // Moved to Plugin $search_handlers['comments'] = LAN_COMMENTS; $search_handlers['users'] = SEALAN_7; //$search_handlers['downloads'] = ADLAN_24; // Moved to Plugin // $search_handlers['pages'] = SEALAN_39; // Moved to Plugin foreach($pref['e_search_list'] as $file) { if(!e107::isInstalled($file)) { continue; } if (is_readable(e_PLUGIN.$file."/e_search.php") && !isset($search_prefs['plug_handlers'][$file])) { $search_prefs['plug_handlers'][$file] = array('class' => 0, 'pre_title' => 1, 'pre_title_alt' => '', 'chars' => 150, 'results' => 10); $save_search = TRUE; } if (is_readable(e_PLUGIN.$file.'/search/search_comments.php') && !isset($search_prefs['comments_handlers'][$file])) { include_once(e_PLUGIN.$file.'/search/search_comments.php'); $search_prefs['comments_handlers'][$file] = array('id' => $comments_type_id, 'class' => '0', 'dir' => $file); unset($comments_type_id); $save_search = TRUE; } } if (!isset($search_prefs['boundary'])) { $search_prefs['boundary'] = 1; $save_search = TRUE; } if (vartrue($save_search)) { // $serialpref = addslashes(serialize($search_prefs)); // $serialpref = e107::getArrayStorage()->writeArray($search_prefs, true); // $sql -> db_Update("core", "e107_value='".$serialpref."' WHERE e107_name='search_prefs'"); e107::getConfig('search')->setPref($search_prefs)->save(false,true,false); e107::getLog()->add('SEARCH_03','',E_LOG_INFORMATIVE,''); } if (isset($_POST['update_main'])) // Update all the basic handler info { foreach($_POST['core_handlers'] as $s_key => $s_value) { $search_prefs['core_handlers'][$s_key]['class'] = $_POST['core_handlers'][$s_key]['class']; $search_prefs['core_handlers'][$s_key]['order'] = $_POST['core_handlers'][$s_key]['order']; } foreach ($_POST['plug_handlers'] as $plug_dir => $active) { $search_prefs['plug_handlers'][$plug_dir]['class'] = $_POST['plug_handlers'][$plug_dir]['class']; $search_prefs['plug_handlers'][$plug_dir]['order'] = $_POST['plug_handlers'][$plug_dir]['order']; } $search_prefs['google'] = $_POST['google']; foreach ($_POST['comments_handlers'] as $key => $value) { $search_prefs['comments_handlers'][$key]['class'] = $_POST['comments_handlers'][$key]['class']; } e107::getConfig('search')->removePref('plug_handlers')->save(false,true,false); e107::getConfig('search')->setPref($search_prefs)->save(true,true); } if (isset($_POST['update_handler'])) { // Update a specific handler if ($query[1] == 'c') { $handler_type = 'core_handlers'; } else if ($query[1] == 'p') { $handler_type = 'plug_handlers'; } else { exit; // Illegal value } $query[2] = $tp->toDB($query[2]); $search_prefs[$handler_type][$query[2]]['class'] = intval($_POST['class']); $search_prefs[$handler_type][$query[2]]['chars'] = $tp -> toDB($_POST['chars']); $search_prefs[$handler_type][$query[2]]['results'] = $tp -> toDB($_POST['results']); $search_prefs[$handler_type][$query[2]]['pre_title'] = intval($_POST['pre_title']); $search_prefs[$handler_type][$query[2]]['pre_title_alt'] = $tp -> toDB($_POST['pre_title_alt']); // $tmp = addslashes(serialize($search_prefs)); $tmp = e107::serialize($search_prefs, true); $check = $sql ->update("core", "e107_value='".$tmp."' WHERE e107_name='search_prefs'"); if($check) { $mes->addSuccess(LAN_UPDATED); e107::getLog()->add('SEARCH_05', $handler_type.', '.$query[2], E_LOG_INFORMATIVE, ''); } elseif(0 === $check) $mes->addInfo(LAN_NO_CHANGE); else { $mes->addError(LAN_UPDATED_FAILED, E_MESSAGE_ERROR); $mes->addError(LAN_ERROR." ".$sql->getLastErrorNumber().': '.$sql->getLastErrorText()); } } if (isset($_POST['update_prefs'])) { unset($temp); $temp['relevance'] = intval($_POST['relevance']); $temp['user_select'] = intval($_POST['user_select']); $temp['multisearch'] = intval($_POST['multisearch']); $temp['selector'] = intval($_POST['selector']); $temp['time_restrict'] = intval($_POST['time_restrict']); $temp['time_secs'] = min(intval($_POST['time_secs']), 300); $temp['mysql_sort'] = $_POST['search_sort'] ? 1 : 0; $temp['php_limit'] = intval($_POST['php_limit']); $temp['boundary'] = intval($_POST['boundary']); e107::getConfig('search')->updatePref($temp)->save(false,true,false); /* if ($admin_log->logArrayDiffs($temp, $search_prefs, 'SEARCH_01')) { e107::getConfig('search')->setPref($temp)->save(false,true); // $tmp = addslashes(serialize($search_prefs)); $tmp = e107::getArrayStorage()->writeArray($search_prefs, true); $check = $sql -> db_Update("core", "e107_value='".$tmp."' WHERE e107_name='search_prefs'"); if($check) { $mes->addSuccess(LAN_UPDATED); e107::getLog()->add('SEARCH_05', $handler_type.', '.$query[2], E_LOG_INFORMATIVE, ''); } else //it's an error { $mes->addError(LAN_UPDATED_FAILED); $mes->addError(LAN_ERROR." ".$sql->getLastErrorNumber().': '.$sql->getLastErrorText()); } } else $mes->addInfo(LAN_NO_CHANGE);*/ unset($temp); $temp['search_restrict'] = intval($_POST['search_restrict']); $temp['search_highlight'] = intval($_POST['search_highlight']); e107::getConfig()->setPref($temp)->save(false,true,true); } $handlers_total = count($search_prefs['core_handlers']) + count($search_prefs['plug_handlers']); if ($query[0] == 'settings') { $text = "
"; $ns->tablerender(SEALAN_20, $mes->render().$text); } elseif ($query[0] == 'edit') { if ($query[1] == 'c') { $handlers = $search_handlers; $handler_type = 'core_handlers'; } elseif ($query[1] == 'p') { $handlers = $search_prefs['plug_handlers']; $handler_type = 'plug_handlers'; } else { exit; } $caption = SEALAN_43.": ".$query[2]; $text = " "; $ns->tablerender($caption, $mes->render().$text); } else { // Default front page $text = " "; $ns->tablerender(SEALAN_1, $mes->render().$text); } require_once("footer.php"); function search_adminmenu() { $query = e_QUERY; $action = vartrue($query,'main'); $var['main']['text'] = SEALAN_41; $var['main']['link'] = e_SELF; $var['settings']['text'] = LAN_PREFS; $var['settings']['link'] = e_SELF."?settings"; $caption ="".SEALAN_40.""; $var['_extras_']['icon'] = e107::getParser()->toIcon('e-search-24'); e107::getNav()->admin($caption, $action, $var); }