• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

blogger


Commit MetaInfo

Revisión93795e62c389822fda2aaa15d63d1c236f4fa456 (tree)
Tiempo2017-09-09 22:22:55
Autorumorigu <umorigu@gmai...>
Commiterumorigu

Log Message

BugTrack/2430 Remove author line from text-search target

Cambiar Resumen

Diferencia incremental

--- a/lib/file.php
+++ b/lib/file.php
@@ -204,6 +204,18 @@ function remove_author_info($wikitext)
204204 return preg_replace('/^\s*#author\([^\n]*(\n|$)/m', '', $wikitext);
205205 }
206206
207+function remove_author_lines($lines)
208+{
209+ $author_head = '#author(';
210+ $len = strlen($author_head);
211+ for ($i = 0; $i < 5; $i++) {
212+ if (substr($lines[$i], 0, $len) === $author_head) {
213+ unset($lines[$i]);
214+ }
215+ }
216+ return $lines;
217+}
218+
207219 function get_date_atom($timestamp)
208220 {
209221 // Compatible with DATE_ATOM format
--- a/lib/func.php
+++ b/lib/func.php
@@ -345,7 +345,8 @@ function do_search($word, $type = 'AND', $non_format = FALSE, $base = '')
345345
346346 // Search for page contents
347347 foreach ($keys as $key) {
348- $b_match = preg_match($key, get_source($page, TRUE, TRUE));
348+ $lines = remove_author_lines(get_source($page, TRUE, FALSE));
349+ $b_match = preg_match($key, join('', $lines));
349350 if ($b_type xor $b_match) break; // OR
350351 }
351352 if ($b_match) continue;