mirror of
https://github.com/e107inc/e107.git
synced 2025-07-25 00:41:52 +02:00
More BC Fixes. Search, and News Category titles.
This commit is contained in:
@@ -34,15 +34,20 @@ $query = explode('.', e_QUERY);
|
||||
|
||||
$search_prefs = $sysprefs -> getArray('search_prefs');
|
||||
|
||||
$search_handlers['news'] = ADLAN_0;
|
||||
//$search_handlers['news'] = ADLAN_0;
|
||||
$search_handlers['comments'] = ADLAN_114;
|
||||
$search_handlers['users'] = SEALAN_7;
|
||||
$search_handlers['downloads'] = ADLAN_24;
|
||||
//$search_handlers['downloads'] = ADLAN_24;
|
||||
$search_handlers['pages'] = SEALAN_39;
|
||||
|
||||
|
||||
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);
|
||||
@@ -80,16 +85,17 @@ if (vartrue($save_search))
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['update_main']))
|
||||
{ // Update all the basic handler info
|
||||
if (isset($_POST['update_main'])) // Update all the basic handler info
|
||||
{
|
||||
|
||||
foreach($search_handlers as $s_key => $s_value)
|
||||
|
||||
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 ($search_prefs['plug_handlers'] as $plug_dir => $active)
|
||||
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'];
|
||||
@@ -97,32 +103,14 @@ if (isset($_POST['update_main']))
|
||||
|
||||
$search_prefs['google'] = $_POST['google'];
|
||||
|
||||
foreach ($search_prefs['comments_handlers'] as $key => $value)
|
||||
foreach ($_POST['comments_handlers'] as $key => $value)
|
||||
{
|
||||
$search_prefs['comments_handlers'][$key]['class'] = $_POST['comments_handlers'][$key]['class'];
|
||||
}
|
||||
|
||||
// $tmp = addslashes(serialize($search_prefs));
|
||||
// $tmp = e107::getArrayStorage()->writeArray($search_prefs, true);
|
||||
|
||||
// e107::getAdminLog()->logM
|
||||
// e107::getMessage()->addAto
|
||||
e107::getConfig('search')->removePref('plug_handlers')->save(false,true,false);
|
||||
e107::getConfig('search')->setPref($search_prefs)->save(true,true);
|
||||
/*
|
||||
$check = $sql -> db_Update("core", "e107_value='".$tmp."' WHERE e107_name='search_prefs'");
|
||||
if($check)
|
||||
{
|
||||
$mes->addSuccess(LAN_UPDATED);
|
||||
$admin_log->log_event('SEARCH_04','',E_LOG_INFORMATIVE,'');
|
||||
}
|
||||
elseif(0 === $check) $mes->addInfo(LAN_NO_CHANGE);
|
||||
else
|
||||
{
|
||||
$mes->addError(LAN_UPDATED_FAILED);
|
||||
$mes->addError(LAN_ERROR." ".$sql->getLastErrorNumber().': '.$sql->getLastErrorText());
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +137,7 @@ if (isset($_POST['update_handler']))
|
||||
|
||||
// $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)
|
||||
{
|
||||
@@ -406,20 +395,38 @@ else
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
$searchConfigs = e107::getAddonConfig('e_search');
|
||||
|
||||
foreach ($search_prefs['plug_handlers'] as $plug_dir => $active)
|
||||
{
|
||||
if(is_readable(e_PLUGIN.$plug_dir."/e_search.php"))
|
||||
|
||||
if(varset($searchConfigs[$plug_dir]))
|
||||
{
|
||||
require_once(e_PLUGIN.$plug_dir."/e_search.php");
|
||||
$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"))
|
||||
{
|
||||
e107::getMessage()->addDebug("Including: ".$plug_dir."/e_search.php");
|
||||
require(e_PLUGIN.$plug_dir."/e_search.php");
|
||||
}
|
||||
else // workaround for a 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 .= "
|
||||
<tr>
|
||||
@@ -428,7 +435,8 @@ else
|
||||
<td class='center'>
|
||||
<select name='plug_handlers[".$plug_dir."][order]' class='tbox order'>
|
||||
";
|
||||
for($a = 1; $a <= $handlers_total; $a++) {
|
||||
for($a = 1; $a <= $handlers_total; $a++)
|
||||
{
|
||||
$text .= (vartrue($search_prefs['plug_handlers'][$plug_dir]['order']) == $a) ? "<option value='".$a."' selected='selected'>".$a."</option>" : "<option value='".$a."'>".$a."</option>";
|
||||
}
|
||||
$text .= "
|
||||
|
@@ -1352,12 +1352,9 @@ function update_706_to_800($type='')
|
||||
{
|
||||
if ($just_check) return update_needed('Download Plugin needs to be installed.');
|
||||
e107::getSingleton('e107plugin')->install('download',array('nolinks'=>true));
|
||||
// e107::getSingleton('e107plugin')->save_addon_prefs(); //XXX Needed? Uncomment if SQL update does not occur.
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------
|
||||
|
||||
|
||||
|
@@ -121,6 +121,10 @@ class e_parse extends e_parser
|
||||
array(
|
||||
'nobreak'=>TRUE, 'retain_nl'=>TRUE, 'link_click' => FALSE, 'emotes'=>FALSE, 'defs'=>TRUE, 'parse_sc'=>TRUE
|
||||
),
|
||||
'TITLE_PLAIN' =>
|
||||
array(
|
||||
'nobreak'=>TRUE, 'retain_nl'=>TRUE, 'link_click' => FALSE, 'emotes'=>FALSE, 'defs'=>TRUE, 'parse_sc'=>TRUE, 'no_tags' => TRUE
|
||||
),
|
||||
//text is user-entered (i.e. untrusted) and part of a title (e.g. forum title)
|
||||
'USER_TITLE' =>
|
||||
array(
|
||||
@@ -1361,7 +1365,7 @@ class e_parse extends e_parser
|
||||
// Convert defines(constants) within text. eg. Lan_XXXX - must be the entire text string (i.e. not embedded)
|
||||
// The check for '::' is a workaround for a bug in the Zend Optimiser 3.3.0 and PHP 5.2.4 combination
|
||||
// - causes crashes if '::' in site name
|
||||
//TODO - marj - find a way to use language method here XOR remove the limit of 24 characters.
|
||||
|
||||
if($opts['defs'] && (strlen($text) < 35) && ((strpos($text, '::') === FALSE) && defined(trim($text))))
|
||||
{
|
||||
return constant(trim($text));
|
||||
|
@@ -73,7 +73,7 @@ class news_search extends e_search // include plugin-folder in the name.
|
||||
$res = array();
|
||||
|
||||
$res['link'] = e107::getUrl()->create('news/view/item', $row);//$row['news_allow_comments'] ? "news.php?item.".$row['news_id'] : "comment.php?comment.news.".$row['news_id'];
|
||||
$res['pre_title'] = $row['category_name']." | ";
|
||||
$res['pre_title'] = $tp->toHtml($row['category_name'],false,'TITLE')." | ";
|
||||
$res['title'] = $row['news_title'];
|
||||
$res['summary'] = $row['news_body'].' '.$row['news_extended'];
|
||||
$res['detail'] = LAN_SEARCH_3.$tp->toDate($row['news_datestamp'], "long");
|
||||
|
10
news.php
10
news.php
@@ -1000,8 +1000,12 @@ function renderCache($cache, $nfp = FALSE){
|
||||
}
|
||||
|
||||
function render_newscats(){ // -- CNN Style Categories. ----
|
||||
global $pref,$ns,$tp;
|
||||
if (isset($pref['news_cats']) && $pref['news_cats'] == '1') {
|
||||
$tp = e107::getParser();
|
||||
$ns = e107::getRender();
|
||||
$pref = e107::getPref();
|
||||
|
||||
if (isset($pref['news_cats']) && $pref['news_cats'] == '1')
|
||||
{
|
||||
$text3 = $tp->toHTML("{NEWS_CATEGORIES}", TRUE, 'TITLE');
|
||||
$ns->tablerender(LAN_NEWS_23, $text3, 'news_cat');
|
||||
}
|
||||
@@ -1083,7 +1087,7 @@ function setNewsFrontMeta($news, $type='news')
|
||||
|
||||
if($news['category_name'] && !defined('e_PAGETITLE'))
|
||||
{
|
||||
define('e_PAGETITLE', $news['category_name']);
|
||||
define('e_PAGETITLE', $tp->toHtml($news['category_name'],false,'TITLE_PLAIN'));
|
||||
}
|
||||
|
||||
if($news['category_meta_keywords'] && !defined('META_KEYWORDS'))
|
||||
|
Reference in New Issue
Block a user