diff --git a/e107_handlers/search/comments_download.php b/e107_handlers/search/comments_download.php index 99c4d244d..4e7e0765f 100644 --- a/e107_handlers/search/comments_download.php +++ b/e107_handlers/search/comments_download.php @@ -8,25 +8,33 @@ * */ -if (!defined('e107_INIT')) { exit; } +if(!defined('e107_INIT')) +{ + exit; +} -$comments_title = LAN_PLUGIN_DOWNLOAD_NAME; +//TODO Rework to v2 standards into e107_plugins/download/e_search.php + +$comments_title = defset('LAN_PLUGIN_DOWNLOAD_NAME'); $comments_type_id = '2'; $comments_return['download'] = "d.download_id, d.download_name"; $comments_table['download'] = "LEFT JOIN #download AS d ON c.comment_type=2 AND d.download_id = c.comment_item_id"; - /** - * @param $row - * @return array - */ - function com_search_2($row) { - global $con; - $datestamp = $con -> convert_date($row['comment_datestamp'], "long"); - $res['link'] = "download.php?view.".$row['download_id']; - $res['pre_title'] = $row['download_name'] ? LAN_SEARCH_70.": " : ""; - $res['title'] = $row['download_name'] ? $row['download_name'] : LAN_SEARCH_9; + +/** + * @param $row + * @return array + */ +function com_search_2($row) +{ + + $datestamp = e107::getParser()->toDate($row['comment_datestamp'], "long"); + $res['link'] = "download.php?view." . $row['download_id']; + $res['pre_title'] = !empty($row['download_name']) ? defset('LAN_SEARCH_70') . ": " : ""; + $res['title'] = !empty($row['download_name']) ? $row['download_name'] : defset('LAN_SEARCH_9'); $res['summary'] = $row['comment_comment']; preg_match("/([0-9]+)\.(.*)/", $row['comment_author'], $user); - $res['detail'] = LAN_SEARCH_7."".$user[2]."".LAN_SEARCH_8.$datestamp; + $res['detail'] = defset('LAN_SEARCH_7') . "" . $user[2] . "" . defset('LAN_SEARCH_8') . $datestamp; + return $res; } diff --git a/e107_handlers/search/comments_news.php b/e107_handlers/search/comments_news.php index 002cf170f..74b63cf9c 100644 --- a/e107_handlers/search/comments_news.php +++ b/e107_handlers/search/comments_news.php @@ -10,7 +10,9 @@ if (!defined('e107_INIT')) { exit; } -$comments_title = ADLAN_0; +//TODO Rework to v2 standards into e107_plugins/news/e_search.php + +$comments_title = defset('ADLAN_0'); $comments_type_id = 0; $comments_return['news'] = "n.news_title"; $comments_table['news'] = "LEFT JOIN #news AS n ON c.comment_type=0 AND n.news_id = c.comment_item_id"; @@ -22,11 +24,11 @@ $comments_table['news'] = "LEFT JOIN #news AS n ON c.comment_type=0 AND n.news_i global $con; $datestamp = $con -> convert_date($row['comment_datestamp'], "long"); $res['link'] = "comment.php?comment.news.".$row['comment_item_id']; - $res['pre_title'] = $row['news_title'] ? LAN_SEARCH_71.": " : ""; - $res['title'] = $row['news_title'] ? $row['news_title'] : LAN_SEARCH_9; + $res['pre_title'] = $row['news_title'] ? defset('LAN_SEARCH_71').": " : ""; + $res['title'] = $row['news_title'] ? $row['news_title'] : defset('LAN_SEARCH_9'); $res['summary'] = $row['comment_comment']; preg_match("/([0-9]+)\.(.*)/", $row['comment_author'], $user); - $res['detail'] = LAN_SEARCH_7."".$user[2]."".LAN_SEARCH_8.$datestamp; + $res['detail'] = defset('LAN_SEARCH_7')."".$user[2]."".defset('LAN_SEARCH_8').$datestamp; return $res; } diff --git a/e107_handlers/search/search_comment.php b/e107_handlers/search/search_comment.php index e07234a0f..3a42ec7f5 100644 --- a/e107_handlers/search/search_comment.php +++ b/e107_handlers/search/search_comment.php @@ -16,6 +16,8 @@ if (!defined('e107_INIT')) { exit; } +// TODO Rework all of this to v2 standards while maintaining BC. + // advanced $advanced_where = ""; if (isset($_GET['type']) && $_GET['type'] != 'all') { @@ -33,16 +35,32 @@ if (isset($_GET['author']) && $_GET['author'] != '') { //basic $return_fields = 'c.comment_item_id, c.comment_author_id, comment_author_name, c.comment_datestamp, c.comment_comment, c.comment_type'; -foreach ($search_prefs['comments_handlers'] as $h_key => $value) { - if (check_class($value['class'])) { - $path = ($value['dir'] == 'core') ? e_HANDLER.'search/comments_'.$h_key.'.php' : e_PLUGIN.$value['dir'].'/search/search_comments.php'; - if (is_readable($path)) { - require_once($path); - $in[] = "'".$value['id']."'"; - $join[] = $comments_table[$h_key]; - $return_fields .= ', '.$comments_return[$h_key]; +foreach($search_prefs['comments_handlers'] as $h_key => $value) +{ + if(check_class($value['class'])) + { + if($value['dir'] == 'core') + { + $path = e_HANDLER . 'search/comments_' . $h_key . '.php'; } - + else + { + if(!e107::isInstalled($value['dir'])) + { + continue; + } + + $path = e_PLUGIN . $value['dir'] . '/search/search_comments.php'; + } + $path = ($value['dir'] == 'core') ? e_HANDLER . 'search/comments_' . $h_key . '.php' : e_PLUGIN . $value['dir'] . '/search/search_comments.php'; + if(is_readable($path)) // TODO Rework this to use e_search.php + { + require_once($path); + $in[] = "'" . $value['id'] . "'"; + $join[] = $comments_table[$h_key]; + $return_fields .= ', ' . $comments_return[$h_key]; + } + } }