From c277a6bdf6a2286eadaba9b8ad5c638b9d50922b Mon Sep 17 00:00:00 2001 From: Tom N Harris Date: Thu, 21 Oct 2010 13:20:08 -0400 Subject: Deprecate html_attbuild in favor of buildAttributes --- inc/html.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 02afa00e9..a02cc020d 100644 --- a/inc/html.php +++ b/inc/html.php @@ -26,6 +26,7 @@ function html_wikilink($id,$name=null,$search=''){ /** * Helps building long attribute lists * + * @deprecated Use buildAttributes instead * @author Andreas Gohr */ function html_attbuild($attributes){ -- cgit v1.2.3 From f5baf821ee5f6ab5b009bb94aff6f43f686d3329 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sun, 7 Nov 2010 09:54:40 +0000 Subject: make custom buttons possible with html_btn() without the need of global $lang (more consistent with tpl_pagelink()) --- inc/html.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 02afa00e9..7f502afa5 100644 --- a/inc/html.php +++ b/inc/html.php @@ -162,11 +162,12 @@ function html_topbtn(){ * * @author Andreas Gohr */ -function html_btn($name,$id,$akey,$params,$method='get',$tooltip=''){ +function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false){ global $conf; global $lang; - $label = $lang['btn_'.$name]; + if (!$label) + $label = $lang['btn_'.$name]; $ret = ''; $tip = ''; -- cgit v1.2.3 From 3733161e2de6b5a7092884f4e39ce8c846ae8f8c Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Wed, 8 Dec 2010 08:51:32 +0100 Subject: Add missing variable declaration --- inc/html.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 9d3c92707..1e02ac9ce 100644 --- a/inc/html.php +++ b/inc/html.php @@ -888,6 +888,9 @@ function html_diff($text='',$intro=true){ $rev2 = (int) $_REQUEST['rev2']; } + $r_minor = ''; + $l_minor = ''; + if($text){ // compare text to the most current revision $l_rev = ''; $l_text = rawWiki($ID,''); -- cgit v1.2.3 From fa7c70ff4d7f9999466436e7d559eb0c81571779 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Wed, 8 Dec 2010 17:17:40 +0100 Subject: tmp --- inc/html.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 1e02ac9ce..98ee8a496 100644 --- a/inc/html.php +++ b/inc/html.php @@ -876,7 +876,7 @@ function html_diff($text='',$intro=true){ // array in rev2. $rev1 = $REV; - if(is_array($_REQUEST['rev2'])){ + if (is_array($_REQUEST['rev2'])){ $rev1 = (int) $_REQUEST['rev2'][0]; $rev2 = (int) $_REQUEST['rev2'][1]; @@ -948,8 +948,12 @@ function html_diff($text='',$intro=true){ '
'.$l_user.' '.$l_sum; } - if($r_rev){ - $r_info = getRevisionInfo($ID,$r_rev,true); + $_r_rev = $r_rev; + if (!$_r_rev) { + $_r_rev = @filemtime(wikiFN($ID)); + } + if($_r_rev){ + $r_info = getRevisionInfo($ID,$_r_rev,true); if($r_info['user']){ $r_user = editorinfo($r_info['user']); if(auth_ismanager()) $r_user .= ' ('.$r_info['ip'].')'; -- cgit v1.2.3 From ddcde0004fc886990df5b7029e93bb345d7e09b4 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sun, 2 Jan 2011 20:45:16 +0000 Subject: added space between license text and link --- inc/html.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 9d3c92707..4e3744fd1 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1214,9 +1214,9 @@ function html_edit(){ if($wr && $conf['license']){ $form->addElement(form_makeOpenTag('div', array('class'=>'license'))); $out = $lang['licenseok']; - $out .= ''; + $out .= '>'.$license[$conf['license']]['name'].''; $form->addElement($out); $form->addElement(form_makeCloseTag('div')); } -- cgit v1.2.3 From cc58224cff540373081dcde9c64d00efbf0fbddc Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Mon, 10 Jan 2011 21:54:58 +0100 Subject: Fix msg() calls when messages have already been printed This commit fixes two bugs that occurred when msg() was called after html_msgarea() had already been called. - the $MSG array is now cleared when it has been printed (otherwise $MSG has been printed again when another msg() call was done) - headers_sent() didn't work for me, it always reported false although html_msgarea() had already been called which might be explainable with output buffering. This makes msg() now depend on the first call of html_msgarea() or headers_sent() in order to not to break msg() in ajax requests etc. --- inc/html.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 4e3744fd1..b6c5cc7ba 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1034,7 +1034,10 @@ function html_conflict($text,$summary){ * @author Andreas Gohr */ function html_msgarea(){ - global $MSG; + global $MSG, $MSG_shown; + // store if the global $MSG has already been shown and thus HTML output has been started + $MSG_shown = true; + if(!isset($MSG)) return; $shown = array(); @@ -1046,6 +1049,8 @@ function html_msgarea(){ print ''; $shown[$hash] = 1; } + + unset($GLOBALS['MSG']); } /** -- cgit v1.2.3 From 820923f1328bcfe6002831570eb65238411c5b70 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Tue, 18 Jan 2011 00:04:41 +0100 Subject: Revert "tmp" for inc/html.php as it breaks the diff output This reverts commit fa7c70ff4d7f9999466436e7d559eb0c81571779. --- inc/html.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 67b1c10b7..bd87ee7a1 100644 --- a/inc/html.php +++ b/inc/html.php @@ -876,7 +876,7 @@ function html_diff($text='',$intro=true){ // array in rev2. $rev1 = $REV; - if (is_array($_REQUEST['rev2'])){ + if(is_array($_REQUEST['rev2'])){ $rev1 = (int) $_REQUEST['rev2'][0]; $rev2 = (int) $_REQUEST['rev2'][1]; @@ -948,12 +948,8 @@ function html_diff($text='',$intro=true){ '
'.$l_user.' '.$l_sum; } - $_r_rev = $r_rev; - if (!$_r_rev) { - $_r_rev = @filemtime(wikiFN($ID)); - } - if($_r_rev){ - $r_info = getRevisionInfo($ID,$_r_rev,true); + if($r_rev){ + $r_info = getRevisionInfo($ID,$r_rev,true); if($r_info['user']){ $r_user = editorinfo($r_info['user']); if(auth_ismanager()) $r_user .= ' ('.$r_info['ip'].')'; -- cgit v1.2.3 From 06756ad2b150ae2ce564043d0e7f02de5fa22b59 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 27 Jan 2011 15:17:39 +0100 Subject: allow placeholders in search intro text This patch allows to use the placeholders in the search intro message that will be replaced with the search term. @SEARCH@ will be replaced with the search query @QUERY@ will be replaced with the URL encoded search query for use in URL parameters Please note that the replacement is don't on the XHTML *after* parsing and rendering the intro wiki text. This means you can not use the query where an ID would be expected. Examples: This will work: [[http://www.google.com/search?q=@QUERY@|Google for @SEARCH@]]. This will not work and will link to the page "search" instead: [[@SEARCH@|Your page]]. You could use this instead: [[this>doku.php?id=@QUERY@|Your page]]. --- inc/html.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index bd87ee7a1..b962c6075 100644 --- a/inc/html.php +++ b/inc/html.php @@ -318,7 +318,13 @@ function html_search(){ global $ID; global $lang; - print p_locale_xhtml('searchpage'); + $intro = p_locale_xhtml('searchpage'); + // allow use of placeholder in search intro + $intro = str_replace( + array('@QUERY@','@SEARCH@'), + array(hsc(rawurlencode($QUERY)),hsc($QUERY)), + $intro); + echo $intro; flush(); //show progressbar -- cgit v1.2.3 From 7216538165621816dc3f751adc0746bf66805421 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 31 Jan 2011 14:00:32 +0100 Subject: Make diff type selectable --- inc/html.php | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index b962c6075..7abb05d2e 100644 --- a/inc/html.php +++ b/inc/html.php @@ -870,13 +870,18 @@ function html_backlinks(){ * show diff * * @author Andreas Gohr + * @param string $text - compare with this text with most current version + * @param bool $intr - display the intro text */ -function html_diff($text='',$intro=true){ +function html_diff($text='',$intro=true,$type=null){ global $ID; global $REV; global $lang; global $conf; + if(!$type) $type = $_REQUEST['difftype']; + if($type != 'inline') $type = 'sidebyside'; + // we're trying to be clever here, revisions to compare can be either // given as rev and rev2 parameters, with rev2 being optional. Or in an // array in rev2. @@ -993,17 +998,48 @@ function html_diff($text='',$intro=true){ $df = new Diff(explode("\n",htmlspecialchars($l_text)), explode("\n",htmlspecialchars($r_text))); - $tdf = new TableDiffFormatter(); + if($type == 'inline'){ + $tdf = new InlineDiffFormatter(); + } else { + $tdf = new TableDiffFormatter(); + } + + + if($intro) print p_locale_xhtml('diff'); if (!$text) { - $diffurl = wl($ID, array('do'=>'diff', 'rev2[0]'=>$l_rev, 'rev2[1]'=>$r_rev)); ptln(''); } ?> - +
> -- cgit v1.2.3 From 1b885c58f9e8294f0b866e2c327942ce3ab9de3f Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 5 Feb 2011 13:26:08 +0100 Subject: fixed inline diff selector loosing page context --- inc/html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 7abb05d2e..4d5d557af 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1012,7 +1012,7 @@ function html_diff($text='',$intro=true,$type=null){ ptln('

' - . $lang['reghere'] - . ': '.$lang['register'].'' - . '

'); + $form->addElement('

'.$lang['reghere'].': '.tpl_actionlink('register','','','',true).'

'); } if (actionOK('resendpwd')) { - $form->addElement('

' - . $lang['pwdforget'] - . ': '.$lang['btn_resendpwd'].'' - . '

'); + $form->addElement('

'.$lang['pwdforget'].': '.tpl_actionlink('resendpwd','','','',true).'

'); } html_form('login', $form); @@ -1111,7 +1105,7 @@ function html_register(){ print p_locale_xhtml('register'); print '
'.NL; $form = new Doku_Form(array('id' => 'dw__register')); - $form->startFieldset($lang['register']); + $form->startFieldset($lang['btn_register']); $form->addHidden('do', 'register'); $form->addHidden('save', '1'); $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], null, 'block', array('size'=>'50'))); @@ -1121,7 +1115,7 @@ function html_register(){ } $form->addElement(form_makeTextField('fullname', $_POST['fullname'], $lang['fullname'], '', 'block', array('size'=>'50'))); $form->addElement(form_makeTextField('email', $_POST['email'], $lang['email'], '', 'block', array('size'=>'50'))); - $form->addElement(form_makeButton('submit', '', $lang['register'])); + $form->addElement(form_makeButton('submit', '', $lang['btn_register'])); $form->endFieldset(); html_form('register', $form); -- cgit v1.2.3 From 24a6c2354089305a4146c7f8802887aa895c2bd3 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 5 Mar 2011 16:20:05 +0100 Subject: avoid broken page on bad non-UTF8 highlight string --- inc/html.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 080beb01a..fcfa54b6c 100644 --- a/inc/html.php +++ b/inc/html.php @@ -284,7 +284,8 @@ function html_hilight($html,$phrases){ $regex = join('|',array_map('ft_snippet_re_preprocess', array_map('preg_quote_cb',$phrases))); if ($regex === '') return $html; - $html = preg_replace_callback("/((<[^>]*)|$regex)/ui",'html_hilight_callback',$html); + if (!utf8_check($regex)) return $html; + $html = @preg_replace_callback("/((<[^>]*)|$regex)/ui",'html_hilight_callback',$html); return $html; } -- cgit v1.2.3