X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=lib%2Fhtml.php;h=3ba8c3fc4c1486aa2d277eb27399464dc1be5557;hb=83a95d80e0fc3d8bdccf79fb1106a04903685090;hp=7558da408729203e88bb569e86cae426c33d05f4;hpb=0d6b4a4a79e9c2ad92f2ac0acf185d39fcdaf163;p=pukiwiki%2Fpukiwiki.git
diff --git a/lib/html.php b/lib/html.php
index 7558da4..3ba8c3f 100644
--- a/lib/html.php
+++ b/lib/html.php
@@ -1,8 +1,8 @@
; rel=\"canonical\"");
+ }
+
// Search words
if ($search_word_color && isset($vars['word'])) {
- $body = '
' . $_msg_word . htmlspecialchars($vars['word']) .
+ $body = '
' . $_msg_word . htmlsc($vars['word']) .
'
' . $hr . "\n" . $body;
- $words = array_flip(array_splice(
- preg_split('/\s+/', $vars['word'], -1, PREG_SPLIT_NO_EMPTY),
- 0, 10));
+
+ // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5
+ // with array_splice(), array_flip()
+ $words = preg_split('/\s+/', $vars['word'], -1, PREG_SPLIT_NO_EMPTY);
+ $words = array_splice($words, 0, 10); // Max: 10 words
+ $words = array_flip($words);
+
$keys = array();
foreach ($words as $word=>$id) $keys[$word] = strlen($word);
arsort($keys, SORT_NUMERIC);
$keys = get_search_words(array_keys($keys), TRUE);
$id = 0;
+ $patterns = '';
foreach ($keys as $key=>$pattern) {
- $s_key = htmlspecialchars($key);
- $pattern = '/<[^>]*>|(' . $pattern . ')|&[^;]+;/';
- $callback = create_function(
- '$arr',
- 'return (count($arr) > 1) ? \'
\' . $arr[1] . \'\' : $arr[0];'
- );
- $body = preg_replace_callback($pattern, $callback, $body);
- $notes = preg_replace_callback($pattern, $callback, $notes);
+ if (strlen($patterns) > 0) {
+ $patterns .= '|';
+ }
+ $patterns .= '(' . $pattern . ')';
+ }
+ if ($pattern) {
+ $whole_pattern = '/' .
+ '
+EOS;
+ return $empty_data;
+ }
+ // Site basic Properties
+ $props = array(
+ 'is_utf8' => $is_utf8,
+ 'json_enabled' => $json_enabled,
+ 'base_uri_pathname' => get_base_uri(PKWK_URI_ROOT),
+ 'base_uri_absolute' => get_base_uri(PKWK_URI_ABSOLUTE)
+ );
+ $h_props = htmlsc_json($props);
+ $site_props = <<