Changeset 629
- Timestamp:
- Dec 2, 2004, 1:45:57 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/search.php
r593 r629 40 40 'L_SEARCH_USERNAME'=>$lang['Find_username'], 41 41 'L_SEARCH'=>$lang['search'], 42 'L_SEARCH_EXPLAIN'=>$lang[' Search_author_explain'],42 'L_SEARCH_EXPLAIN'=>$lang['search_explain'], 43 43 'L_SELECT'=>$lang['Select'], 44 44 'L_UPDATE_USERNAME'=>$lang['Look_up_user'], -
trunk/admin/user_perm.php
r593 r629 87 87 'L_SELECT' => $lang['Select'], 88 88 'L_SEARCH' => $lang['Search'], 89 'L_SEARCH_EXPLAIN' => $lang[' Search_author_explain'],89 'L_SEARCH_EXPLAIN' => $lang['search_explain'], 90 90 'L_CLOSE_WINDOW' => $lang['Close_window'], 91 91 -
trunk/include/functions_category.inc.php
r621 r629 417 417 // construction 418 418 $clauses = $temp_clauses = array(); 419 if (isset($search['fields'][' keywords']))420 419 if (isset($search['fields']['allwords'])) 420 { 421 421 $textfields = array('file', 'name', 'comment', 'keywords', 'author'); 422 422 foreach ($textfields as $textfield) 423 423 { 424 424 $local_clauses = array(); 425 foreach ($search['fields'][' keywords']['words'] as $word)425 foreach ($search['fields']['allwords']['words'] as $word) 426 426 { 427 427 array_push($local_clauses, $textfield." LIKE '%".$word."%'"); … … 430 430 array_walk($local_clauses,create_function('&$s','$s="(".$s.")";')); 431 431 array_push($temp_clauses, 432 implode(' '.$search['fields'][' keywords']['mode'].' ',432 implode(' '.$search['fields']['allwords']['mode'].' ', 433 433 $local_clauses)); 434 434 } 435 436 } 437 438 439 435 array_push($clauses, implode(' OR ', $temp_clauses)); 436 } 437 438 if (isset($search['fields']['author'])) 439 { 440 440 array_push($clauses, "author LIKE '%".$search['fields']['author']['words'][0]."%'"); 441 441 } 442 442 443 443 $datefields = array('date_available', 'date_creation'); … … 448 448 { 449 449 $local_clause = $datefield." "; 450 451 452 453 454 455 450 if (isset($search['fields'][$key]['mode'])) 451 { 452 $local_clause .=">"; 453 } 454 $local_clause .="= '"; 455 $local_clause.= str_replace('.', '-', 456 456 $search['fields'][$key]['words'][0]); 457 $local_clause.= "'"; 458 array_push($clauses, $local_clause); 459 460 if (isset($search['fields'][$key]['mode'])) 461 { 462 $search_tokens = explode('.', $search['fields'][$key]['words'][0]); 463 $start_time = mktime(0, 0, 0, $search_tokens[1], $search_tokens[2],$search_tokens[0]); 464 $search_duration = intval($search['fields'][$key]['mode']) * 86400; 465 $end_time = $start_time + $search_duration; 466 $end_sql_date = date('Y-m-d',$end_time); 467 $local_clause = $datefield." <= '".$end_sql_date."'"; 468 array_push($clauses, $local_clause); 469 } 470 } 471 } 457 $local_clause.= "'"; 458 array_push($clauses, $local_clause); 459 460 if (isset($search['fields'][$key]['mode'])) 461 { 462 $end_sql_date = str_replace('.', '-', 463 $search['fields'][$key]['mode']); 464 $local_clause = $datefield." <= '".$end_sql_date."'"; 465 array_push($clauses, $local_clause); 466 } 467 } 468 } 472 469 473 470 if (isset($search['fields']['cat'])) -
trunk/language/en_UK.iso-8859-1/common.lang.php
r621 r629 142 142 $lang['search_title'] = 'Search'; 143 143 $lang['search_options'] = 'Search Options'; 144 $lang['search_keywords'] = 'Search for Keywords';145 $lang['search_keywords_hint'] = ' Use + for words which must be found, - for words which must not be found and | for words which may or may not be found. Use * as a wildcard for partial matches';144 $lang['search_keywords'] = 'Search for words'; 145 $lang['search_keywords_hint'] = 'Search for entered words in all the attributes related to the pictures displayed in the gallery. Use * as a wildcard for partial matches'; 146 146 $lang['search_mode_or'] = 'Search for any terms'; 147 147 $lang['search_mode_and'] = 'Search for all terms '; … … 152 152 $lang['search_explain'] = 'Use * as a wildcard for partial matches'; 153 153 $lang['search_date'] = 'Search by Date'; 154 $lang['search_date_hint'] = 'Select a date and a duration for your query. The date is inclusive.'; 155 $lang['search_date_from'] = 'From'; 156 $lang['search_duration'] = 'During'; 154 $lang['search_date_hint'] = 'Select a date and/or an ending date for your query.<br /> 155 Leave date empty if you want to make a "before" query.<br /> 156 The year must be entered in the last field in the following format : 0000 (i.e. 2004)'; 157 $lang['search_date_from'] = 'Date'; 158 $lang['search_date_to'] = 'End-Date'; 157 159 $lang['search_date_type'] = 'Kind of date'; 158 160 $lang['search_date_available'] = 'Availability'; … … 164 166 $lang['search_result'] = 'Search results'; 165 167 166 $lang['Search_author_explain'] = 'Use * as a wildcard for partial matches';167 168 $lang['Look_up_user'] = 'Seek user'; 168 169 $lang['Find_username'] = 'Find a username'; -
trunk/language/fr_FR.iso-8859-1/common.lang.php
r623 r629 144 144 $lang['search_title'] = 'Rechercher'; 145 145 $lang['search_options'] = 'Options de recherche'; 146 $lang['search_keywords'] = 'Recherche par mots -clés';147 $lang['search_keywords_hint'] = ' Vous pouvez utiliser <u>AND</u> pour déterminer les mots qui doivent être présents dans les résultats, <u>OR</u> pour déterminer les mots qui peuvent être présents dans les résultats et <u>NOT</u> pour déterminer les mots qui ne devraient pas être présents dans les résultats. Utilisez * comme un joker pour des recherches partielles';146 $lang['search_keywords'] = 'Recherche par mots'; 147 $lang['search_keywords_hint'] = 'Effectuez une recherche sur tous les champs des images présentes dans la galerie. Utilisez * comme un joker pour des recherches partielles'; 148 148 $lang['search_mode_or'] = 'Rechercher n\'importe quel de ces termes'; 149 149 $lang['search_mode_and'] = 'Rechercher tous les termes'; … … 154 154 $lang['search_explain'] = 'Utilisez * comme un joker pour des recherches partielles'; 155 155 $lang['search_date'] = 'Rechercher par date'; 156 $lang['search_date_hint'] = 'Sélectionnez une date de début et une période pour vos recherches'; 157 $lang['search_date_from'] = 'A partir du'; 158 $lang['search_duration'] = 'Sur une période de'; 156 $lang['search_date_hint'] = 'Sélectionnez une date et une date de fin pour vos recherches.<br /> 157 Ne remplissez que la date de fin pour faire une recherche de type "avant".<br /> 158 L\'année doit être rentrée dans le dernier champ sous la forme 0000 (par exemple 2004).'; 159 $lang['search_date_from'] = 'Date'; 160 $lang['search_date_to'] = 'Date de fin'; 159 161 $lang['search_date_type'] = 'Type de date'; 160 162 $lang['search_date_available'] = 'Mise à disposition'; … … 167 169 $lang['invalid_search'] = 'Les mots recherchés doivent comporter plus de 3 caractères et ne doivent pas inclure de caractères de ponctuation'; 168 170 169 $lang['search_field_search'] = 'Rechercher';170 $lang['Search_author_explain'] = 'Utilisez * comme un joker pour des recherches partielles';171 171 $lang['Look_up_user'] = 'Rechercher l\'utilisateur'; 172 172 $lang['Find_username'] = 'Trouver un nom d\'utilisateur'; -
trunk/search.php
r621 r629 36 36 if (isset($_POST['submit'])) 37 37 { 38 if ($_POST['search_ keywords'] &&39 !preg_match('/^\s*$/', $_POST['search_ keywords']))38 if ($_POST['search_allwords'] && 39 !preg_match('/^\s*$/', $_POST['search_allwords'])) 40 40 { 41 41 $local_search = array(); 42 $search_keywords = $_POST['search_ keywords'];42 $search_keywords = $_POST['search_allwords']; 43 43 $drop_char_match = array('-', '^', '$', ';', '#', '&', '(', ')', '<', '>', 44 44 '`', '\'', '"', '|', ',', '@', '_', '?', '%', '~', '.', '[', ']', '{', '}', … … 52 52 $words = preg_split('#\s+#', $search_keywords); 53 53 $words = array_unique($words); 54 $search['fields'][' keywords'] = array();55 $search['fields'][' keywords']['words'] =$words;56 $search['fields'][' keywords']['mode']= $_POST['mode'];54 $search['fields']['allwords'] = array(); 55 $search['fields']['allwords']['words'] =$words; 56 $search['fields']['allwords']['mode']= $_POST['mode']; 57 57 } 58 58 … … 83 83 // duration 84 84 $search_duration = 0; 85 if ( !empty($date) && !empty( $_POST['duration_day']) ) 86 { 87 $search['fields'][$type_date]['mode'] = $_POST['duration_day']; 85 if ( !empty($date) && !empty( $_POST['end_year']) ) 86 { 87 $end_date = $_POST['end_year'].'.'.$_POST['end_month'].'.'.$_POST['end_day']; 88 $search['fields'][$type_date]['mode'] = $end_date; 88 89 } 89 90 } … … 140 141 $start_month .= '</select>'; 141 142 142 // year list 143 $start_year = '<select name="start_year">'; 144 $start_year .= '<option value="0"> ---- </option>'; 145 $begin_year = date('Y', time())-10; 146 for ($i = $begin_year; $i <= date('Y', time()); $i++) 147 { 148 $start_year .= '<option value="' . $i . '">' . $i . '</option>'; 149 } 150 $start_year .= '</select>'; 151 143 // day list 144 $end_day = '<select name="end_day">'; 145 for ($i=0; $i <= 31; $i++) 146 { 147 $end_day .= '<option value="' . $i . '" >' . ( ($i == 0) ? ' -- ' : str_pad($i, 2, '0', STR_PAD_LEFT) ) . '</option>'; 148 } 149 $end_day .= '</select>'; 150 151 // month list 152 $end_month = '<select name="end_month">'; 153 $end_month .= '<option value="0"> ------------ </option>'; 154 for ($i=1; $i <= 12; $i++) 155 { 156 $end_month .= '<option value="' . $i . '">' . $lang['month'][$i] . '</option>'; 157 } 158 $end_month .= '</select>'; 152 159 153 160 // … … 179 186 'L_TODAY' => $lang['today'], 180 187 'L_SEARCH_DATE_FROM'=>$lang['search_date_from'], 181 'L_SEARCH_D URATION'=>$lang['search_duration'],188 'L_SEARCH_DATE_TO'=>$lang['search_date_to'], 182 189 'L_DAYS'=>$lang['days'], 183 190 'L_MONTH'=>$lang['w_month'], … … 192 199 'TODAY_MONTH' => date('m', time()), 193 200 'TODAY_YEAR' => date('Y', time()), 194 'S_CALENDAR_YEAR' => $start_year, 201 'E_CALENDAR_MONTH' => $end_month, 202 'E_CALENDAR_DAY' => $end_day, 195 203 'S_CALENDAR_MONTH' => $start_month, 196 204 'S_CALENDAR_DAY' => $start_day, -
trunk/template/default/search.tpl
r621 r629 18 18 <td width="50%" colspan="2"><b>{L_SEARCH_KEYWORDS} : </b><br /><span class="small">{L_SEARCH_KEYWORDS_HINT}</span></td> 19 19 <td colspan="2" valign="top"> 20 <input type="text" style="width: 300px" name="search_ keywords" size="30" />20 <input type="text" style="width: 300px" name="search_allwords" size="30" /> 21 21 <br /> 22 22 <input type="radio" name="mode" value="AND" checked="checked" /> {L_SEARCH_ALL_TERMS}<br /> … … 35 35 <table><tr><td> 36 36 {L_SEARCH_DATE_FROM} :</td><td> 37 {S_CALENDAR_DAY} {S_CALENDAR_MONTH}{S_CALENDAR_YEAR} 37 {S_CALENDAR_DAY} {S_CALENDAR_MONTH} <input name="start_year" type="text" size="4" maxlength="4"> 38 38 <a href="#" name="#" onClick="document.post.start_day.value={TODAY_DAY};document.post.start_month.value={TODAY_MONTH};document.post.start_year.value={TODAY_YEAR};" />{L_TODAY}</a> 39 39 </tr><tr><td> 40 {L_SEARCH_DURATION} : </td><td> 41 <input name="duration_day" type="post" maxlength="5" size="3" value="{DURATION_DAY}" /> {L_DAYS} 40 {L_SEARCH_DATE_TO} :</td><td> 41 {E_CALENDAR_DAY} {E_CALENDAR_MONTH} <input name="end_year" type="text" size="4" maxlength="4"> 42 <a href="#" name="#" onClick="document.post.end_day.value={TODAY_DAY};document.post.end_month.value={TODAY_MONTH};document.post.end_year.value={TODAY_YEAR};" />{L_TODAY}</a> 42 43 </td></tr></table> 43 44 </td> … … 64 65 <td width="25%" nowrap="nowrap"><b>{L_SEARCH_DATE_TYPE} : </b></td> 65 66 <td width="25%" nowrap="nowrap"> 66 <input type="radio" name="date_type" value="date_creation" />{L_SEARCH_CREATION}<br />67 <input type="radio" name="date_type" value="date_available" checked="checked"/>{L_SEARCH_AVAILABILITY}67 <input type="radio" name="date_type" value="date_creation" checked="checked" />{L_SEARCH_CREATION}<br /> 68 <input type="radio" name="date_type" value="date_available" />{L_SEARCH_AVAILABILITY} 68 69 </td> 69 70 <td><b>{L_RESULT_SORT} : </b></td>
Note: See TracChangeset
for help on using the changeset viewer.