Update get_lang calls using full string, remove global.inc in class def

pull/3016/head
Julio Montoya 6 years ago
parent 7e8e04235f
commit cabb8c29ce
  1. 6
      main/inc/lib/search/ChamiloIndexer.class.php
  2. 30
      main/inc/lib/search/search_widget.php
  3. 16
      main/inc/lib/search/xapian/XapianQuery.php

@ -1,15 +1,9 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/**
* @package chamilo.include.search
*/
require_once __DIR__.'/../../global.inc.php';
/** /**
* Class wrapper. * Class wrapper.
*
* @package chamilo.include.search
*/ */
class ChamiloIndexer extends XapianIndexer class ChamiloIndexer extends XapianIndexer
{ {

@ -113,10 +113,10 @@ function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix = '')
*/ */
function search_widget_normal_form($action, $show_thesaurus, $sf_terms, $op) function search_widget_normal_form($action, $show_thesaurus, $sf_terms, $op)
{ {
$thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), ['id' => 'thesaurus-icon']); $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('Advanced search options'), ['id' => 'thesaurus-icon']);
$advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>'; $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('Advanced search options').'</a>';
$display_thesaurus = ($show_thesaurus == true ? 'block' : 'none'); $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none');
$help = '<h3>'.get_lang('SearchKeywordsHelpTitle').'</h3>'.get_lang('SearchKeywordsHelpComment'); $help = '<h3>'.get_lang('Keywords search help').'</h3>'.get_lang('Select keywords in one or more fields and click the search button.<br /><br />To select more than one keyword in a field, use Ctrl+click.');
$mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery'); $mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery');
$type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal'); $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal');
@ -133,11 +133,11 @@ function search_widget_normal_form($action, $show_thesaurus, $sf_terms, $op)
if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') { if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
$submit_button1 = '<input type="submit" id="submit" value="'.get_lang('Search').'" />'; $submit_button1 = '<input type="submit" id="submit" value="'.get_lang('Search').'" />';
$submit_button2 = '<input class="lower-submit" type="submit" value="'.get_lang('Search').'" />'; $submit_button2 = '<input class="lower-submit" type="submit" value="'.get_lang('Search').'" />';
$reset_button = '<input type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" />'; $reset_button = '<input type="submit" id="tags-clean" value="'.get_lang('Reset keywords').'" />';
} else { } else {
$submit_button1 = '<button class="search" type="submit" id="submit" value="'.get_lang("Search").'" /> '.get_lang('Search').'</button>'; $submit_button1 = '<button class="search" type="submit" id="submit" value="'.get_lang("Search").'" /> '.get_lang('Search').'</button>';
$submit_button2 = '<button class="search" type="submit" value="'.get_lang('Search').'" />'.get_lang('Search').'</button>'; $submit_button2 = '<button class="search" type="submit" value="'.get_lang('Search').'" />'.get_lang('Search').'</button>';
$reset_button = '<button class="save" type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" />'.get_lang('SearchResetKeywords').'</button> '; $reset_button = '<button class="save" type="submit" id="tags-clean" value="'.get_lang('Reset keywords').'" />'.get_lang('Reset keywords').'</button> ';
} }
$query = isset($_REQUEST['query']) ? Security::remove_XSS($_REQUEST['query']) : null; $query = isset($_REQUEST['query']) ? Security::remove_XSS($_REQUEST['query']) : null;
@ -168,9 +168,9 @@ function search_widget_normal_form($action, $show_thesaurus, $sf_terms, $op)
$form .= '</tr> $form .= '</tr>
<tr> <tr>
<td id="operator-select"> <td id="operator-select">
'.get_lang('SearchCombineSearchWith').':<br /> '.get_lang('Combine keywords with').':<br />
<input type="radio" class="search-operator" name="operator" value="or" '.$or_checked.'>'.api_strtoupper(get_lang('Or')).'</input> <input type="radio" class="search-operator" name="operator" value="or" '.$or_checked.'>'.api_strtoupper(get_lang('or')).'</input>
<input type="radio" class="search-operator" name="operator" value="and" '.$and_checked.'>'.api_strtoupper(get_lang('And')).'</input> <input type="radio" class="search-operator" name="operator" value="and" '.$and_checked.'>'.api_strtoupper(get_lang('and')).'</input>
</td> </td>
<td></td> <td></td>
<td> <td>
@ -200,10 +200,10 @@ function search_widget_prefilter_form(
$op, $op,
$prefilter_prefix = null $prefilter_prefix = null
) { ) {
$thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), ['id' => 'thesaurus-icon']); $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('Advanced search options'), ['id' => 'thesaurus-icon']);
$advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>'; $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('Advanced search options').'</a>';
$display_thesaurus = ($show_thesaurus == true ? 'block' : 'none'); $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none');
$help = '<h3>'.get_lang('SearchKeywordsHelpTitle').'</h3>'.get_lang('SearchKeywordsHelpComment'); $help = '<h3>'.get_lang('Keywords search help').'</h3>'.get_lang('Select keywords in one or more fields and click the search button.<br /><br />To select more than one keyword in a field, use Ctrl+click.');
$mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery'); $mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery');
$type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal'); $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal');
@ -263,15 +263,15 @@ function search_widget_prefilter_form(
</tr> </tr>
<tr> <tr>
<td id="operator-select"> <td id="operator-select">
'.get_lang('SearchCombineSearchWith').':<br /> '.get_lang('Combine keywords with').':<br />
<input type="radio" class="search-operator" name="operator" value="or" '.$or_checked.'>'.api_strtoupper(get_lang('Or')).'</input> <input type="radio" class="search-operator" name="operator" value="or" '.$or_checked.'>'.api_strtoupper(get_lang('or')).'</input>
<input type="radio" class="search-operator" name="operator" value="and" '.$and_checked.'>'.api_strtoupper(get_lang('And')).'</input> <input type="radio" class="search-operator" name="operator" value="and" '.$and_checked.'>'.api_strtoupper(get_lang('and')).'</input>
</td> </td>
<td></td> <td></td>
<td> <td>
<br /> <br />
<input class="lower-submit" type="submit" value="'.get_lang('Search').'" /> <input class="lower-submit" type="submit" value="'.get_lang('Search').'" />
<input type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" /> <input type="submit" id="tags-clean" value="'.get_lang('Reset keywords').'" />
</td> </td>
</tr> </tr>
</table> </table>

@ -253,21 +253,21 @@ function display_xapian_error($xapian_error_message)
$message = explode(':', $xapian_error_message); $message = explode(':', $xapian_error_message);
$type_error_message = $message[0]; $type_error_message = $message[0];
if ($type_error_message == 'DatabaseOpeningError') { if ($type_error_message == 'DatabaseOpeningError') {
$message_error = get_lang('SearchDatabaseOpeningError'); $message_error = get_lang('Failed to open the search database');
} elseif ($type_error_message == 'DatabaseVersionError') { } elseif ($type_error_message == 'DatabaseVersionError') {
$message_error = get_lang('SearchDatabaseVersionError'); $message_error = get_lang('The search database uses an unsupported format');
} elseif ($type_error_message == 'DatabaseModifiedError') { } elseif ($type_error_message == 'DatabaseModifiedError') {
$message_error = get_lang('SearchDatabaseModifiedError'); $message_error = get_lang('The search database has been modified/broken');
} elseif ($type_error_message == 'DatabaseLockError') { } elseif ($type_error_message == 'DatabaseLockError') {
$message_error = get_lang('SearchDatabaseLockError'); $message_error = get_lang('Failed to lock the search database');
} elseif ($type_error_message == 'DatabaseCreateError') { } elseif ($type_error_message == 'DatabaseCreateError') {
$message_error = get_lang('SearchDatabaseCreateError'); $message_error = get_lang('Failed to create the search database');
} elseif ($type_error_message == 'DatabaseCorruptError') { } elseif ($type_error_message == 'DatabaseCorruptError') {
$message_error = get_lang('SearchDatabaseCorruptError'); $message_error = get_lang('The search database has suffered corruption');
} elseif ($type_error_message == 'NetworkTimeoutError') { } elseif ($type_error_message == 'NetworkTimeoutError') {
$message_error = get_lang('SearchNetworkTimeoutError'); $message_error = get_lang('Connection timed out while communicating with the remote search database');
} else { } else {
$message_error = get_lang('SearchOtherXapianError'); $message_error = get_lang('Error in search engine');
} }
$display_message = get_lang('Error').' : '.$message_error; $display_message = get_lang('Error').' : '.$message_error;
echo Display::return_message($display_message, 'error'); echo Display::return_message($display_message, 'error');

Loading…
Cancel
Save