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 = "
".SEALAN_20."
".SEALAN_15.": ".$e_userclass->uc_dropdown('search_restrict', $pref['search_restrict'], 'public,guest,nobody,member,admin,classes', "tabindex='".$frm->getNext()."'")."
".SEALAN_30." ".$frm->radio_switch('search_highlight', $pref['search_highlight'])."
".SEALAN_10." ".$frm->radio_switch('relevance', $search_prefs['relevance'])."
".SEALAN_11." ".$frm->radio_switch('user_select', $search_prefs['user_select'])."
".SEALAN_19." ".$frm->radio_switch('multisearch', $search_prefs['multisearch'])."
".SEALAN_35." ".$frm->radio('selector', array(2 => SEALAN_36, 1 => SEALAN_37, 0 => SEALAN_38), $search_prefs['selector'])."
".SEALAN_12." ".$frm->radio('time_restrict', array(0 => LAN_DISABLED, 1 => SEALAN_13), $search_prefs['time_restrict'])."  ".$frm->text('time_secs', $tp -> toForm($search_prefs['time_secs']), 3, 'class=tbox&size=mini')." ".SEALAN_14."
".SEALAN_3." ".$frm->radio_switch('search_sort', $search_prefs['mysql_sort'], 'MySQL', SEALAN_31)."  ".$frm->text('php_limit', $tp -> toForm($search_prefs['php_limit']), 5, 'class=tbox&size=mini')." ".SEALAN_32." ".SEALAN_49."
".SEALAN_47." ".$frm->radio_switch('boundary', $search_prefs['boundary'])." ".SEALAN_48."
".$frm->admin_button('update_prefs', LAN_UPDATE, 'update')."
"; $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 = "
{$caption}
".SEALAN_44.": ".r_userclass("class", $search_prefs[$handler_type][$query[2]]['class'], "off", "public,guest,nobody,member,admin,classes")."
".SEALAN_45.":
".SEALAN_46.":
".SEALAN_26.":

".$frm->admin_button('update_handler', 'no-value', 'update', LAN_UPDATE)."
"; $ns->tablerender($caption, $mes->render().$text); } else { // Default front page $text = "
".SEALAN_1." "; foreach($search_handlers as $key => $value) { $text .= " "; } $searchConfigs = e107::getAddonConfig('e_search'); foreach ($search_prefs['plug_handlers'] as $plug_dir => $active) { if(varset($searchConfigs[$plug_dir])) // v2.x { $search_handlers[] = $searchConfigs[$plug_dir]; $search_info[0]['qtype'] = $searchConfigs[$plug_dir]['name']; } elseif(e107::isInstalled($plug_dir) && is_readable(e_PLUGIN.$plug_dir."/e_search.php")) // v1.x { e107::getMessage()->addDebug("Including: ".$plug_dir."/e_search.php"); require(e_PLUGIN.$plug_dir."/e_search.php"); } else // workaround for messy pref data. Missing a plugin or file. { continue; } /* if($obj = e107::getAddon($plug_dir,'e_search')) { $search_handlers[] = $obj->config(); $ret = $obj->config(); $search_info[0]['qtype'] = $ret['name']; } */ $text .= " "; unset($search_info); } //$sel = (isset($search_prefs['google']) && $search_prefs['google']) ? " checked='checked'" : ""; $text .= "
".SEALAN_21." ".SEALAN_25." ".LAN_ORDER." ".LAN_EDIT."
".$value." ".r_userclass("core_handlers[".$key."][class]", $search_prefs['core_handlers'][$key]['class'], "off", "public,guest,nobody,member,admin,classes")." ".ADMIN_EDIT_ICON."
".$search_info[0]['qtype'] . " ".r_userclass("plug_handlers[".$plug_dir."][class]", $search_prefs['plug_handlers'][$plug_dir]['class'], "off", "public,guest,nobody,member,admin,classes")." ".ADMIN_EDIT_ICON."
Google ".r_userclass("google", $search_prefs['google'], "off", "public,guest,nobody,member,admin,classes")."
"; $text .= "
".SEALAN_1." "; foreach ($search_prefs['comments_handlers'] as $key => $value) { $path = ($value['dir'] == 'core') ? e_HANDLER.'search/comments_'.$key.'.php' : e_PLUGIN.$value['dir'].'/search/search_comments.php'; if(($value['dir'] == 'download' || $key == 'download') && !e107::isInstalled('download')) { continue; } if(is_readable($path)) { require_once($path); } $text .= " "; unset($comments_title); } $text .= "
".SEALAN_18." ".SEALAN_25."
".vartrue($comments_title)." ".r_userclass("comments_handlers[".$key."][class]", $search_prefs['comments_handlers'][$key]['class'], "off", "public,guest,nobody,member,admin,classes")."
".$frm->admin_button('update_main','no-value','update',LAN_UPDATE)."
"; $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); }