1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 04:38:27 +01:00

Code cleanup and error fixes.

This commit is contained in:
Cameron 2021-03-03 12:06:24 -08:00
parent 561327f818
commit d7e4b4a665
4 changed files with 178 additions and 217 deletions

View File

@ -0,0 +1,126 @@
<?php
if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
if(!isset($SEARCH_SHORTCODE))
{
//
$SEARCH_SHORTCODE = "<input class='tbox form-control search' type='text' name='q' size='20' value='' maxlength='50' />
<input class='btn btn-default btn-secondary button search' type='submit' name='s' value=\"".LAN_SEARCH."\" />";
/* // Image Version Example
$SEARCH_SHORTCODE = "<input class='tbox search' type='text' name='q' size='20' value='Default Value' maxlength='50' onclick=\"this.value=''\" />
<input type='image' name='s' src='".e_PLUGIN_ABS."search_menu/images/search.png' value='".LAN_SEARCH."' style='width: 16px; height: 16px; border: 0px; vertical-align: middle' />";
*/
}
if(!isset($SEARCH_TOP_TABLE))
{
$SEARCH_TOP_TABLE = "<div>
<form id='searchform' method='get' action='{SEARCH_FORM_URL}'>
<table style='".USER_WIDTH."' class='table fborder'><tr>
<td class='forumheader3' style='width: 40%'>".LAN_199."</td>
<td class='forumheader3' style='width: 60%; white-space: nowrap'>
{SEARCH_MAIN_SEARCHFIELD}&nbsp;{SEARCH_MAIN_SUBMIT}&nbsp;{ENHANCED_ICON}
</td>
</tr>";
}
if(!isset($SEARCH_ENHANCED))
{
$SEARCH_ENHANCED = "<tr id='{ENHANCED_DISPLAY_ID}' {ENHANCED_DISPLAY}>
<td class='forumheader3' style='width: 40%; white-space: nowrap'>{ENHANCED_TEXT}</td>
<td class='forumheader3' style='width: 60%; white-space: nowrap'>
{ENHANCED_FIELD}
</td>
</tr>";
}
if(!isset($SEARCH_CATS))
{
$SEARCH_CATS = "<tr>
<td style='width:30%' class='forumheader3'>".LAN_SEARCH_19."<br />
{SEARCH_MAIN_CHECKALL} {SEARCH_MAIN_UNCHECKALL}
</td>
<td style='width:70%' class='forumheader3'>
{SEARCH_MAIN_CHECKBOXES}{SEARCH_DROPDOWN}&nbsp;<table>{SEARCH_ADVANCED}</table>
<br />
</td>
</tr>";
}
if(!isset($SEARCH_TYPE))
{
$SEARCH_TYPE = "<tr id='advanced_type' {SEARCH_TYPE_DISPLAY}>
<td style='width:30%' class='forumheader3'>".LAN_SEARCH_75.":</td>
<td style='width:70%' class='forumheader3'>
{SEARCH_TYPE_SEL}
<br />
</td>
</tr>";
}
if(!isset($SEARCH_ADV))
{
$SEARCH_ADV = "<tr>
<td class='forumheader3'>
{SEARCH_ADV_A}
</td>
<td class='forumheader3'>
{SEARCH_ADV_B}
</td>
</tr>";
}
if(!isset($SEARCH_ADV_COMBO))
{
$SEARCH_ADV_COMBO = "<tr>
<td class='forumheader3' colspan='2'>
{SEARCH_ADV_TEXT}
</td>
</tr>";
}
if(!isset($SEARCH_TABLE_MSG))
{
$SEARCH_TABLE_MSG = "<tr>
<td class='forumheader3' style='text-align: center' colspan='2'>
{SEARCH_MESSAGE}
</td>
</tr>";
}
if(!isset($SEARCH_BOT_TABLE))
{
$SEARCH_BOT_TABLE = "<tr style='display: none !important; display: visible'>
<td style='display: none' colspan='2'></td>
</tr></table>
</form>
</div>";
}
if(!isset($PRE_CHECKBOXES))
{
$PRE_CHECKBOXES = "<span style='white-space: nowrap; padding-bottom: 7px; padding-top: 7px'>"; /* string thats printed before each category checkbox */
}
if(!isset($POST_CHECKBOXES))
{
$POST_CHECKBOXES = "</span>"; /* string thats printed after each category checkbox */
}

View File

@ -1,138 +1,8 @@
<?php
if (!defined('e107_INIT')) { exit; }
if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
/*
if (!defined('SEARCH_SHORTCODE_REF')) {
define('SEARCH_SHORTCODE_REF',"");
}
*/
if(!isset($SEARCH_SHORTCODE))
{
//
$SEARCH_SHORTCODE = "<input class='tbox form-control search' type='text' name='q' size='20' value='' maxlength='50' />
<input class='btn btn-default btn-secondary button search' type='submit' name='s' value=\"".LAN_SEARCH."\" />";
/* // Image Version Example
$SEARCH_SHORTCODE = "<input class='tbox search' type='text' name='q' size='20' value='Default Value' maxlength='50' onclick=\"this.value=''\" />
<input type='image' name='s' src='".e_PLUGIN_ABS."search_menu/images/search.png' value='".LAN_SEARCH."' style='width: 16px; height: 16px; border: 0px; vertical-align: middle' />";
*/
}
if(!isset($SEARCH_TOP_TABLE))
{
$SEARCH_TOP_TABLE = "<div>
<form id='searchform' method='get' action='{SEARCH_FORM_URL}'>
<table style='".USER_WIDTH."' class='table fborder'><tr>
<td class='forumheader3' style='width: 40%'>".LAN_199."</td>
<td class='forumheader3' style='width: 60%; white-space: nowrap'>
{SEARCH_MAIN_SEARCHFIELD}&nbsp;{SEARCH_MAIN_SUBMIT}&nbsp;{ENHANCED_ICON}
</td>
</tr>";
}
if(!isset($SEARCH_ENHANCED))
{
$SEARCH_ENHANCED = "<tr id='{ENHANCED_DISPLAY_ID}' {ENHANCED_DISPLAY}>
<td class='forumheader3' style='width: 40%; white-space: nowrap'>{ENHANCED_TEXT}</td>
<td class='forumheader3' style='width: 60%; white-space: nowrap'>
{ENHANCED_FIELD}
</td>
</tr>";
}
if(!isset($SEARCH_CATS))
{
$SEARCH_CATS = "<tr>
<td style='width:30%' class='forumheader3'>".LAN_SEARCH_19."<br />
{SEARCH_MAIN_CHECKALL} {SEARCH_MAIN_UNCHECKALL}
</td>
<td style='width:70%' class='forumheader3'>
{SEARCH_MAIN_CHECKBOXES}{SEARCH_DROPDOWN}&nbsp;<table>{SEARCH_ADVANCED}</table>
<br />
</td>
</tr>";
}
if(!isset($SEARCH_TYPE))
{
$SEARCH_TYPE = "<tr id='advanced_type' {SEARCH_TYPE_DISPLAY}>
<td style='width:30%' class='forumheader3'>".LAN_SEARCH_75.":</td>
<td style='width:70%' class='forumheader3'>
{SEARCH_TYPE_SEL}
<br />
</td>
</tr>";
}
if(!isset($SEARCH_ADV))
{
$SEARCH_ADV = "<tr>
<td class='forumheader3'>
{SEARCH_ADV_A}
</td>
<td class='forumheader3'>
{SEARCH_ADV_B}
</td>
</tr>";
}
if(!isset($SEARCH_ADV_COMBO))
{
$SEARCH_ADV_COMBO = "<tr>
<td class='forumheader3' colspan='2'>
{SEARCH_ADV_TEXT}
</td>
</tr>";
}
if(!isset($SEARCH_TABLE_MSG))
{
$SEARCH_TABLE_MSG = "<tr>
<td class='forumheader3' style='text-align: center' colspan='2'>
{SEARCH_MESSAGE}
</td>
</tr>";
}
if(!isset($SEARCH_BOT_TABLE))
{
$SEARCH_BOT_TABLE = "<tr style='display: none !important; display: visible'>
<td style='display: none' colspan='2'></td>
</tr></table>
</form>
</div>";
}
if(!isset($PRE_CHECKBOXES))
{
$PRE_CHECKBOXES = "<span style='white-space: nowrap; padding-bottom: 7px; padding-top: 7px'>"; /* string thats printed before each category checkbox */
}
if(!isset($POST_CHECKBOXES))
{
$POST_CHECKBOXES = "</span>"; /* string thats printed after each category checkbox */
}
// Bootstrap v2.
// Bootstrap
$SEARCH_TEMPLATE['form']['start'] = '
<form class="form-horizontal" role="form" id="searchform" method="get" action="{SEARCH_FORM_URL}">
@ -193,6 +63,7 @@ $SEARCH_TEMPLATE['form']['end'] = "
$SEARCH_TEMPLATE['form']['advanced-combo'] = '<div>{SEARCH_ADV_TEXT}</div>';
$SEARCH_TEMPLATE['form']['message'] = '<div>{SEARCH_MESSAGE}</div>';
$SEARCH_TEMPLATE['shortcode'] = "<!-- start-search-shortcode-template -->
@ -200,4 +71,3 @@ $SEARCH_TEMPLATE['shortcode'] = "<!-- start-search-shortcode-template -->
{SEARCH_BUTTON}
<!-- end-search-shortcode-template -->";

View File

@ -278,7 +278,7 @@ class e_menuManager
$HEADER = $HEADER[$this->curLayout];
$FOOTER = $FOOTER[$this->curLayout];
}
elseif($this->curLayout && ($this->curLayout !== 'legacyDefault') && (e_MENUMANAGER_ACTIVE === true))
elseif($this->curLayout && ($this->curLayout !== 'legacyDefault') && (deftrue('e_MENUMANAGER_ACTIVE')))
{
if(!empty($HEADER) && is_string($HEADER) && 'legacyDefault')
{
@ -2081,14 +2081,14 @@ class e_mm_layout
if(vartrue($_GET['parmsId']))
{
$text = $this->renderInstanceParameters();
// $text = $this->renderInstanceParameters();
}
if(vartrue($_POST['mode']))
{
// print_r($_POST);
// $men->setMenuId($this->menuId);
$text = $this->menuSaveAjax($_POST['mode']);
// $text = $this->menuSaveAjax($_POST['mode']);
}
@ -2158,11 +2158,11 @@ class e_mm_layout
$this->HEADER = $HEADER;
$this->FOOTER = $FOOTER;
$this->CUSTOMHEADER = $CUSTOMHEADER;
$this->CUSTOMFOOTER = $CUSTOMFOOTER;
$this->style = $style;
$this->HEADER = varset($HEADER);
$this->FOOTER = varset($FOOTER);
$this->CUSTOMHEADER = varset($CUSTOMHEADER);
$this->CUSTOMFOOTER = varset($CUSTOMFOOTER);
$this->style = varset($style);
// XXX HELP _ i don't work with iFrames.
// $("#sortable")
@ -2636,7 +2636,7 @@ class e_mm_layout
foreach($this->menuData[THEME_LAYOUT][$area] as $val)
{
$text .= $this->renderMenu($val, THEME_LAYOUT, $area,$count);
$text .= $this->renderMenu($val, THEME_LAYOUT, $area);
$this->cnt++;
}
@ -2657,16 +2657,13 @@ class e_mm_layout
private function renderMenu($row, $layout, $area, $count)
private function renderMenu($row, $layout, $area)
{
// return print_a($row,true);
$frm = e107::getForm();
$uniqueId = "menu_".$frm->name2id($row['path']).'_'.$this->cnt;
$TEMPLATE = '<li class="regularMenu" id="'.$uniqueId.'"> '.$this->renderMenuOptions($row, $layout, $area, $this->cnt, $uniqueId).' </li>
'; // TODO perhaps a simple counter for the id
return $TEMPLATE;
return '<li class="regularMenu" id="'.$uniqueId.'"> '.$this->renderMenuOptions($row, $layout, $area, $this->cnt, $uniqueId)." </li>\n";
}
@ -3056,7 +3053,7 @@ class e_mm_layout
// 0.6 / 0.7-1.x
if(isset($this->CUSTOMHEADER) && isset($this->CUSTOMHEADER))
if(!empty($this->CUSTOMHEADER))
{
if(!is_array($this->CUSTOMHEADER))
{

View File

@ -15,7 +15,7 @@ e107::coreLan('search');
if (!check_class($pref['search_restrict']))
{
require_once(HEADERF);
$ns->tablerender(LAN_SEARCH_20, "<div style='text-align: center'>".LAN_SEARCH_21."</div>");
e107::getRender()->tablerender(LAN_SEARCH_20, "<div style='text-align: center'>".LAN_SEARCH_21."</div>");
require_once(FOOTERF);
exit;
}
@ -68,10 +68,10 @@ class search_front extends e_shortcode
$this->search_prefs = e107::getConfig('search')->getPref();
$this->search_info = $this->searchConfig();
if(deftrue('BOOTSTRAP'))
if(THEME_LEGACY === false)
{
$tmp = e107::getCoreTemplate('search','form');
$SEARCH_TOP_TABLE = $tmp['start'];
$SEARCH_BOT_TABLE = $tmp['end'];
$SEARCH_CATS = $tmp['category'];
@ -82,20 +82,10 @@ class search_front extends e_shortcode
$this->template = $tmp;
unset($tmp);
}
else
{
$SEARCH_TOP_TABLE = '';
$SEARCH_BOT_TABLE = '';
$SEARCH_CATS = '';
$SEARCH_TYPE = '';
$SEARCH_ADV = '';
$SEARCH_ENHANCED = '';
$SEARCH_ADV_COMBO = '';
if (file_exists(THEME."templates/search_template.php"))
{
require(THEME."templates/search_template.php");
@ -106,28 +96,31 @@ class search_front extends e_shortcode
}
else
{
require(e_CORE."templates/search_template.php");
require(e_CORE."templates/legacy/search_template.php");
}
if(!isset($SEARCH_TOP_TABLE))
{
$SEARCH_TOP_TABLE = '';
}
$SEARCH_TOP_TABLE .= "{SEARCH_ENHANCED}";
$tmp = array();
$tmp['start'] = $SEARCH_TOP_TABLE ;
$tmp['end'] = $SEARCH_BOT_TABLE ;
$tmp['category'] = $SEARCH_CATS;
$tmp['type'] = $SEARCH_TYPE;
$tmp['advanced'] = $SEARCH_ADV;
$tmp['enhanced'] = $SEARCH_ENHANCED;
$tmp['advanced-combo'] = $SEARCH_ADV_COMBO;
$tmp['start'] = varset($SEARCH_TOP_TABLE);
$tmp['end'] = varset($SEARCH_BOT_TABLE);
$tmp['category'] = varset($SEARCH_CATS);
$tmp['type'] = varset($SEARCH_TYPE);
$tmp['advanced'] = varset($SEARCH_ADV);
$tmp['enhanced'] = varset($SEARCH_ENHANCED);
$tmp['advanced-combo'] = varset($SEARCH_ADV_COMBO);
$tmp['message'] = varset($SEARCH_TABLE_MSG);
$this->template = $tmp;
}
if(e_AJAX_REQUEST)
{
if(vartrue($_POST['t']))
@ -140,13 +133,18 @@ class search_front extends e_shortcode
}
function getPrefs()
public function getPrefs()
{
return $this->search_prefs;
}
public function getTemplate()
{
return $this->template;
}
function getConfig()
public function getConfig()
{
return $this->search_info;
}
@ -571,7 +569,7 @@ class search_front extends e_shortcode
unset($search_info['news']);
}
*/
if(e107::getConfig('core')->get('comments_disabled')!=1) // Only when comments are enabled.
if(e107::getConfig()->get('comments_disabled')!=1) // Only when comments are enabled.
{
if ($search_info['comments'] = $this->search_info('comments', 'core', false, array('sfile' => e_HANDLER.'search/search_comment.php', 'qtype' => LAN_COMMENTS, 'refpage' => 'comment.php', 'advanced' => e_HANDLER.'search/advanced_comment.php', 'id' => 'comment'))) {
// $search_id++;
@ -601,7 +599,7 @@ class search_front extends e_shortcode
unset($search_info['pages']);
}
*/
$e_searchList = e107::getConfig('core')->get('e_search_list');
$e_searchList = e107::getConfig()->get('e_search_list');
if(empty($this->search_prefs['plug_handlers']))
{
@ -762,7 +760,7 @@ class search_front extends e_shortcode
$tp = e107::getParser();
$con = e107::getDateConvert(); // BC Fix
$con = e107::getDate(); // BC Fix
$sch = e107::getSearch(); // new e_search; // BC Fix
@ -837,7 +835,7 @@ class search_front extends e_shortcode
'tmpl_prefix' =>'default'
);
$npParms = http_build_query($nextprev,false,'&');
$npParms = http_build_query($nextprev,false);
$core_parms = array('r' => '', 'q' => '', 't' => '', 's' => '');
foreach ($_GET as $pparm_key => $pparm_value)
@ -958,7 +956,7 @@ class search_front extends e_shortcode
{
$time = time() - $this->search_prefs['time_secs'];
$query_check = $tp->toDB($full_query);
$ip = e107::getIPHandler()->getIP(FALSE);
$ip = e107::getIPHandler()->getIP();
if ($sql->select("tmp", "tmp_ip, tmp_time, tmp_info", "tmp_info LIKE 'type_search%' AND tmp_ip='".$ip."'"))
{
@ -1127,45 +1125,15 @@ require_once(HEADERF);
// render search config
if(deftrue('BOOTSTRAP'))
{
$tmp = e107::getCoreTemplate('search','form');
$SEARCH_TOP_TABLE = $tmp['start'];
$SEARCH_BOT_TABLE = $tmp['end'];
$SEARCH_CATS = $tmp['category'];
$SEARCH_TYPE = varset($tmp['type']);
$SEARCH_ADV = $tmp['advanced'];
$SEARCH_ENHANCED = $tmp['enhanced'];
$SEARCH_ADV_COMBO = $tmp['advanced-combo'];
$srchObj->template = $tmp;
unset($tmp);
}
else
{
if (file_exists(THEME."templates/search_template.php"))
{
require(THEME."templates/search_template.php");
}
elseif (file_exists(THEME."search_template.php"))
{
require(THEME."search_template.php");
}
else
{
require(e_CORE."templates/search_template.php");
}
$SEARCH_TOP_TABLE .= "{SEARCH_ENHANCED}";
}
$template = $srchObj->getTemplate();
$tp = e107::getParser();
$text = $tp->parseTemplate($SEARCH_TOP_TABLE,true,$srchObj);
$text = $tp->parseTemplate($template['start'], true, $srchObj);
if ($search_prefs['user_select'])
{
$text .= $tp->parseTemplate($SEARCH_CATS,true, $srchObj);
$text .= $tp->parseTemplate($template['category'], true, $srchObj);
}
// $text .= $tp->parseTemplate($SEARCH_TYPE,true, $srchObj);
@ -1179,9 +1147,9 @@ $text .= "</div>";*/
//$
// $text .= $SEARCH_MESSAGE ? preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_TABLE_MSG) : "";
$text .= $SEARCH_VARS->SEARCH_MESSAGE ? $tp->simpleParse($SEARCH_TABLE_MSG, $SEARCH_VARS) : "";
$text .= $SEARCH_VARS->SEARCH_MESSAGE ? $tp->simpleParse(varset($template['message']), $SEARCH_VARS) : "";
//$text .= preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_BOT_TABLE);
$text .= $tp->simpleParse($SEARCH_BOT_TABLE, $SEARCH_VARS);
$text .= $tp->simpleParse($template['end'], $SEARCH_VARS);
if(!isset($_GET['nf'])) // no form flag.
{