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