From cc204bbd1f1625352ddd0edaacdd297fe022881c Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 31 Oct 2011 15:41:53 +0100 Subject: honor autopasswd setting for resend password When autopasswd is disabled, the resend password option now asks for a new password instead of autogenerating a new one and sending it by mail. Note to translators: the wording for btn_resendpwd and resendpwd changed to be more universal. English and German language files where updated - other languages need to be adjusted. Conflicts: inc/lang/en/lang.php --- inc/html.php | 51 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 14 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 1a2d7daef..dea9ac6ab 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1661,26 +1661,49 @@ function html_admin(){ * Form to request a new password for an existing account * * @author Benoit Chesneau + * @author Andreas Gohr */ function html_resendpwd() { global $lang; global $conf; global $ID; - print p_locale_xhtml('resendpwd'); - print '
'.NL; - $form = new Doku_Form(array('id' => 'dw__resendpwd')); - $form->startFieldset($lang['resendpwd']); - $form->addHidden('do', 'resendpwd'); - $form->addHidden('save', '1'); - $form->addElement(form_makeTag('br')); - $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], '', 'block')); - $form->addElement(form_makeTag('br')); - $form->addElement(form_makeTag('br')); - $form->addElement(form_makeButton('submit', '', $lang['btn_resendpwd'])); - $form->endFieldset(); - html_form('resendpwd', $form); - print '
'.NL; + $token = preg_replace('/[^a-f0-9]+/','',$_REQUEST['pwauth']); + + if(!$conf['autopasswd'] && $token){ + print p_locale_xhtml('resetpwd'); + print '
'.NL; + $form = new Doku_Form(array('id' => 'dw__resendpwd')); + $form->startFieldset($lang['btn_resendpwd']); + $form->addHidden('token', $token); + $form->addHidden('do', 'resendpwd'); + //$form->addElement(form_makeTag('br')); + + $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', array('size'=>'50'))); + $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size'=>'50'))); + + $form->addElement(form_makeButton('submit', '', $lang['btn_resendpwd'])); + $form->endFieldset(); + html_form('resendpwd', $form); + print '
'.NL; + }else{ + print p_locale_xhtml('resendpwd'); + print '
'.NL; + $form = new Doku_Form(array('id' => 'dw__resendpwd')); + $form->startFieldset($lang['resendpwd']); + $form->addHidden('do', 'resendpwd'); + $form->addHidden('save', '1'); + $form->addElement(form_makeTag('br')); + $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], '', 'block')); + $form->addElement(form_makeTag('br')); + $form->addElement(form_makeTag('br')); + $form->addElement(form_makeButton('submit', '', $lang['btn_resendpwd'])); + $form->endFieldset(); + html_form('resendpwd', $form); + print '
'.NL; + } + + } /** -- cgit v1.2.3 From c7b28ffda48d3e6e225940a74b00ee5011f45b4b Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sat, 4 Feb 2012 13:26:50 +0000 Subject: added div.table around non-editable content as well (FS#1980) --- inc/html.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 1a2d7daef..ece26d136 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1176,6 +1176,7 @@ function html_diff($text='',$intro=true,$type=null){ ptln(''); } ?> +
format($df)?>
> @@ -1187,6 +1188,7 @@ function html_diff($text='',$intro=true,$type=null){
+
Date: Fri, 17 Feb 2012 21:48:02 +0100 Subject: removed commented line --- inc/html.php | 1 - 1 file changed, 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index dea9ac6ab..50989f236 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1677,7 +1677,6 @@ function html_resendpwd() { $form->startFieldset($lang['btn_resendpwd']); $form->addHidden('token', $token); $form->addHidden('do', 'resendpwd'); - //$form->addElement(form_makeTag('br')); $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', array('size'=>'50'))); $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size'=>'50'))); -- cgit v1.2.3 From 63703ba5bd81f50c43bc45f8bf79c514afa3ee49 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 16 Mar 2012 12:09:30 +0100 Subject: coding style updates --- inc/html.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index ef95aa11f..b233e1d92 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1141,8 +1141,6 @@ function html_diff($text='',$intro=true,$type=null){ $tdf = new TableDiffFormatter(); } - - if($intro) print p_locale_xhtml('diff'); if (!$text) { @@ -1165,7 +1163,6 @@ function html_diff($text='',$intro=true,$type=null){ $form->addElement(form_makeButton('submit', 'diff','Go')); $form->printForm(); - $diffurl = wl($ID, array( 'do' => 'diff', 'rev2[0]' => $l_rev, @@ -1703,8 +1700,6 @@ function html_resendpwd() { html_form('resendpwd', $form); print ''.NL; } - - } /** -- cgit v1.2.3 From 0607bfee2c4334d31415541abb89026e77c7628a Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sun, 8 Apr 2012 20:01:24 +0100 Subject: added some wanting classes --- inc/html.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index b233e1d92..f3f042ea1 100644 --- a/inc/html.php +++ b/inc/html.php @@ -449,7 +449,7 @@ function html_revisions($first=0, $media_id = false){ if (!$media_id) print p_locale_xhtml('revisions'); - $params = array('id' => 'page__revisions'); + $params = array('id' => 'page__revisions', 'class' => 'changes'); if ($media_id) $params['action'] = media_managerURL(array('image' => $media_id), '&'); $form = new Doku_Form($params); @@ -664,12 +664,13 @@ function html_recent($first=0, $show_changes='both'){ if (getNS($ID) != '') print '

' . sprintf($lang['recent_global'], getNS($ID), wl('', 'do=recent')) . '

'; - $form = new Doku_Form(array('id' => 'dw__recent', 'method' => 'GET')); + $form = new Doku_Form(array('id' => 'dw__recent', 'method' => 'GET', 'class' => 'changes')); $form->addHidden('sectok', null); $form->addHidden('do', 'recent'); $form->addHidden('id', $ID); if ($conf['mediarevisions']) { + $form->addElement('
'); $form->addElement(form_makeListboxField( 'show_changes', array( @@ -682,6 +683,7 @@ function html_recent($first=0, $show_changes='both'){ array('class'=>'quickselect'))); $form->addElement(form_makeButton('submit', 'recent', $lang['btn_apply'])); + $form->addElement('
'); } $form->addElement(form_makeOpenTag('ul')); @@ -1381,7 +1383,7 @@ function html_edit(){ } $form->addHidden('target', $data['target']); - $form->addElement(form_makeOpenTag('div', array('id'=>'wiki__editbar'))); + $form->addElement(form_makeOpenTag('div', array('id'=>'wiki__editbar', 'class'=>'editBar'))); $form->addElement(form_makeOpenTag('div', array('id'=>'size__ctl'))); $form->addElement(form_makeCloseTag('div')); if ($wr) { @@ -1413,13 +1415,12 @@ function html_edit(){ echo 'textChanged = ' . ($mod ? 'true' : 'false'); echo '//-->' . NL; } ?> -
+
-
-
- +
+
Date: Mon, 9 Apr 2012 17:36:33 +0100 Subject: rewrote and improved HTML for TOC Attention: Template authors need to adjust their CSS! Original structure: div.toc > div#toc__header.tocheader.toctoggle > span#toc__toggle.toc_close|toc_open > span div#toc__inside > ul.toc > li.level1 > div.li > span.li > a.toc New structure: div#dw__toc.open|close > h3 > strong > span ul.toc > li.toc > div.li > a --- inc/html.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index f3f042ea1..787f96caa 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1712,11 +1712,11 @@ function html_TOC($toc){ if(!count($toc)) return ''; global $lang; $out = ''.DOKU_LF; - $out .= '
'.DOKU_LF; - $out .= '
'; + $out .= '
'.DOKU_LF; + $out .= '

'; $out .= $lang['toc']; - $out .= '

'.DOKU_LF; - $out .= '
'.DOKU_LF; + $out .= ''.DOKU_LF; + $out .= '
'.DOKU_LF; $out .= html_buildlist($toc,'toc','html_list_toc','html_li_default',true); $out .= '
'.DOKU_LF.'
'.DOKU_LF; $out .= ''.DOKU_LF; @@ -1733,8 +1733,7 @@ function html_list_toc($item){ $link = $item['link']; } - return ''. - hsc($item['title']).''; + return ''.hsc($item['title']).''; } /** -- cgit v1.2.3 From 91b05b6bf9cb9fd3aeced777159422f4e8114a9c Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Mon, 9 Apr 2012 19:06:15 +0100 Subject: improved HTML for search results Attention: Template authors need to adjust their CSS! Original structure: div.search_result > a.wikilink1 > span.search_cnt br div.search_snippet New structure: dl.search_results > dt > a.wikilink1 dd --- inc/html.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 787f96caa..c3e345cb0 100644 --- a/inc/html.php +++ b/inc/html.php @@ -323,11 +323,11 @@ function html_search(){ flush(); //show progressbar - print '
'.NL; + print '
'.NL; print ''.NL; - print '
'.NL; + print '
'.NL; flush(); //do quick pagesearch @@ -363,20 +363,24 @@ function html_search(){ //do fulltext search $data = ft_pageSearch($QUERY,$regex); if(count($data)){ + print '
'; $num = 1; foreach($data as $id => $cnt){ - print '
'; + print '
'; print html_wikilink(':'.$id,useHeading('navigation')?null:$id,$regex); if($cnt !== 0){ - print ': '.$cnt.' '.$lang['hits'].'
'; + print ': '.$cnt.' '.$lang['hits'].''; + } + print '
'; + if($cnt !== 0){ if($num < FT_SNIPPET_NUMBER){ // create snippets for the first number of matches only - print '
'.ft_snippet($id,$regex).'
'; + print '
'.ft_snippet($id,$regex).'
'; } $num++; } - print '
'; flush(); } + print '
'; }else{ print '
'.$lang['nothingfound'].'
'; } -- cgit v1.2.3 From ff71173477e54774b5571015d49d944f51cb8a26 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 19 Apr 2012 11:26:46 +0200 Subject: escape target error message (SECURITY) FS#2487 FS#2488 The error message when a non-existant editor was tried to load wasn't escaped correctly, allowing to introduce arbitrary JavaScript to the output, leading to a XSS vulnerability. Note: the reported second XCRF vulnerability is the same bug, the xploit code simply uses JavaScript to extract a valid CSRF token from the site --- 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 b233e1d92..022cd792a 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1436,7 +1436,7 @@ function html_edit_form($param) { global $TEXT; if ($param['target'] !== 'section') { - msg('No editor for edit target ' . $param['target'] . ' found.', -1); + msg('No editor for edit target ' . hsc($param['target']) . ' found.', -1); } $attr = array('tabindex'=>'1'); -- cgit v1.2.3 From 8a803cae76e430dc0f358986db3420ef45049370 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 20 Apr 2012 21:42:53 +0200 Subject: some edge case checking in search result highlighting --- inc/html.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 022cd792a..be5666353 100644 --- a/inc/html.php +++ b/inc/html.php @@ -280,8 +280,11 @@ function html_draft(){ * @author Harry Fuecks */ function html_hilight($html,$phrases){ - $phrases = array_filter((array) $phrases); - $regex = join('|',array_map('ft_snippet_re_preprocess', array_map('preg_quote_cb',$phrases))); + $phrases = (array) $phrases; + $phrases = array_map('preg_quote_cb', $phrases); + $phrases = array_map('ft_snippet_re_preprocess', $phrases); + $phrases = array_filter($phrases); + $regex = join('|',$phrases); if ($regex === '') return $html; if (!utf8_check($regex)) return $html; -- cgit v1.2.3 From 48722ac855c79944285cbe8958fe5ed03bd835ed Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sun, 22 Apr 2012 21:19:59 +0100 Subject: improved toc changes and sidebar toggling --- 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 c3e345cb0..0b297a347 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1717,7 +1717,7 @@ function html_TOC($toc){ global $lang; $out = ''.DOKU_LF; $out .= '
'.DOKU_LF; - $out .= '

'; + $out .= '

'; $out .= $lang['toc']; $out .= '

'.DOKU_LF; $out .= '
'.DOKU_LF; -- cgit v1.2.3 From f0859d4bbcf66e7ac5c42aae828058a98fa6355e Mon Sep 17 00:00:00 2001 From: Tom N Harris Date: Thu, 28 Jun 2012 23:31:31 -0400 Subject: Input wrapper for html forms --- inc/html.php | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index be5666353..08b051f40 100644 --- a/inc/html.php +++ b/inc/html.php @@ -46,6 +46,7 @@ function html_login(){ global $lang; global $conf; global $ID; + global $INPUT; print p_locale_xhtml('login'); print '
'.NL; @@ -53,7 +54,7 @@ function html_login(){ $form->startFieldset($lang['btn_login']); $form->addHidden('id', $ID); $form->addHidden('do', 'login'); - $form->addElement(form_makeTextField('u', ((!$_REQUEST['http_credentials']) ? $_REQUEST['u'] : ''), $lang['user'], 'focus__this', 'block')); + $form->addElement(form_makeTextField('u', ((!$INPUT->bool('http_credentials')) ? $INPUT->str('u') : ''), $lang['user'], 'focus__this', 'block')); $form->addElement(form_makePasswordField('p', $lang['pass'], '', 'block')); if($conf['rememberme']) { $form->addElement(form_makeCheckboxField('r', '1', $lang['remember'], 'remember__me', 'simple')); @@ -1070,8 +1071,9 @@ function html_diff($text='',$intro=true,$type=null){ global $REV; global $lang; global $conf; + global $INPUT; - if(!$type) $type = $_REQUEST['difftype']; + if(!$type) $type = $INPUT->str('difftype'); if($type != 'inline') $type = 'sidebyside'; // we're trying to be clever here, revisions to compare can be either @@ -1079,16 +1081,16 @@ function html_diff($text='',$intro=true,$type=null){ // array in rev2. $rev1 = $REV; - if(is_array($_REQUEST['rev2'])){ - $rev1 = (int) $_REQUEST['rev2'][0]; - $rev2 = (int) $_REQUEST['rev2'][1]; + if(is_array($INPUT->ref('rev2'))){ + $rev1 = (int) $INPUT->int('rev2')[0]; + $rev2 = (int) $INPUT->int('rev2')[1]; if(!$rev1){ $rev1 = $rev2; unset($rev2); } }else{ - $rev2 = (int) $_REQUEST['rev2']; + $rev2 = $INPUT->int('rev2'); } $r_minor = ''; @@ -1246,6 +1248,7 @@ function html_register(){ global $lang; global $conf; global $ID; + global $INPUT; print p_locale_xhtml('register'); print '
'.NL; @@ -1253,13 +1256,13 @@ function html_register(){ $form->startFieldset($lang['btn_register']); $form->addHidden('do', 'register'); $form->addHidden('save', '1'); - $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], '', 'block', array('size'=>'50'))); + $form->addElement(form_makeTextField('login', $INPUT->post->str('login'), $lang['user'], '', 'block', array('size'=>'50'))); if (!$conf['autopasswd']) { $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', array('size'=>'50'))); $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size'=>'50'))); } - $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_makeTextField('fullname', $INPUT->post->str('fullname'), $lang['fullname'], '', 'block', array('size'=>'50'))); + $form->addElement(form_makeTextField('email', $INPUT->post->str('email'), $lang['email'], '', 'block', array('size'=>'50'))); $form->addElement(form_makeButton('submit', '', $lang['btn_register'])); $form->endFieldset(); html_form('register', $form); @@ -1276,26 +1279,27 @@ function html_register(){ function html_updateprofile(){ global $lang; global $conf; + global $INPUT; global $ID; global $INFO; global $auth; print p_locale_xhtml('updateprofile'); - if (empty($_POST['fullname'])) $_POST['fullname'] = $INFO['userinfo']['name']; - if (empty($_POST['email'])) $_POST['email'] = $INFO['userinfo']['mail']; + $fullname = $INPUT->post->str('fullname', $INFO['userinfo']['name'], true); + $email = $INPUT->post->str('email', $INFO['userinfo']['mail'], true); print '
'.NL; $form = new Doku_Form(array('id' => 'dw__register')); $form->startFieldset($lang['profile']); $form->addHidden('do', 'profile'); $form->addHidden('save', '1'); - $form->addElement(form_makeTextField('fullname', $_SERVER['REMOTE_USER'], $lang['user'], '', 'block', array('size'=>'50', 'disabled'=>'disabled'))); + $form->addElement(form_makeTextField('login', $_SERVER['REMOTE_USER'], $lang['user'], '', 'block', array('size'=>'50', 'disabled'=>'disabled'))); $attr = array('size'=>'50'); if (!$auth->canDo('modName')) $attr['disabled'] = 'disabled'; - $form->addElement(form_makeTextField('fullname', $_POST['fullname'], $lang['fullname'], '', 'block', $attr)); + $form->addElement(form_makeTextField('fullname', $fullname, $lang['fullname'], '', 'block', $attr)); $attr = array('size'=>'50'); if (!$auth->canDo('modMail')) $attr['disabled'] = 'disabled'; - $form->addElement(form_makeTextField('email', $_POST['email'], $lang['email'], '', 'block', $attr)); + $form->addElement(form_makeTextField('email', $email, $lang['email'], '', 'block', $attr)); $form->addElement(form_makeTag('br')); if ($auth->canDo('modPass')) { $form->addElement(form_makePasswordField('newpass', $lang['newpass'], '', 'block', array('size'=>'50'))); @@ -1320,6 +1324,7 @@ function html_updateprofile(){ * @triggers HTML_EDITFORM_OUTPUT */ function html_edit(){ + global $INPUT; global $ID; global $REV; global $DATE; @@ -1332,8 +1337,8 @@ function html_edit(){ global $TEXT; global $RANGE; - if (isset($_REQUEST['changecheck'])) { - $check = $_REQUEST['changecheck']; + if ($INPUT->has('changecheck')) { + $check = $INPUT->str('changecheck'); } elseif(!$INFO['exists']){ // $TEXT has been loaded from page template $check = md5(''); @@ -1368,8 +1373,8 @@ function html_edit(){ $data = array('form' => $form, 'wr' => $wr, 'media_manager' => true, - 'target' => (isset($_REQUEST['target']) && $wr && - $RANGE !== '') ? $_REQUEST['target'] : 'section', + 'target' => ($INPUT->has('target') && $wr && + $RANGE !== '') ? $INPUT->str('target') : 'section', 'intro_locale' => $include); if ($data['target'] !== 'section') { @@ -1456,6 +1461,7 @@ function html_edit_form($param) { function html_minoredit(){ global $conf; global $lang; + global $INPUT; // minor edits are for logged in users only if(!$conf['useacl'] || !$_SERVER['REMOTE_USER']){ return false; @@ -1463,7 +1469,7 @@ function html_minoredit(){ $p = array(); $p['tabindex'] = 3; - if(!empty($_REQUEST['minor'])) $p['checked']='checked'; + if($INPUT->bool('minor')) $p['checked']='checked'; return form_makeCheckboxField('minor', '1', $lang['minoredit'], 'minoredit', 'nowrap', $p); } @@ -1669,8 +1675,9 @@ function html_resendpwd() { global $lang; global $conf; global $ID; + global $INPUT; - $token = preg_replace('/[^a-f0-9]+/','',$_REQUEST['pwauth']); + $token = preg_replace('/[^a-f0-9]+/','',$INPUT->str('pwauth')); if(!$conf['autopasswd'] && $token){ print p_locale_xhtml('resetpwd'); @@ -1695,7 +1702,7 @@ function html_resendpwd() { $form->addHidden('do', 'resendpwd'); $form->addHidden('save', '1'); $form->addElement(form_makeTag('br')); - $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], '', 'block')); + $form->addElement(form_makeTextField('login', $INPUT->post->str('login'), $lang['user'], '', 'block')); $form->addElement(form_makeTag('br')); $form->addElement(form_makeTag('br')); $form->addElement(form_makeButton('submit', '', $lang['btn_resendpwd'])); -- cgit v1.2.3 From fc8dc8221b129775d2778687772469c083a67fbe Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sun, 1 Jul 2012 14:48:01 +0100 Subject: improved preview to have same width as resulting page if it would have a sidebar --- 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 a20ee5c39..738b1f1b4 100644 --- a/inc/html.php +++ b/inc/html.php @@ -229,12 +229,12 @@ function html_show($txt=null){ //PreviewHeader echo '
'; echo p_locale_xhtml('preview'); - echo '
'; + echo '
'; $html = html_secedit(p_render('xhtml',p_get_instructions($txt),$info),$secedit); if($INFO['prependTOC']) $html = tpl_toc(true).$html; echo $html; echo '
'; - echo '
'; + echo '
'; }else{ if ($REV) print p_locale_xhtml('showrev'); -- cgit v1.2.3 From e260f93b6cea05bc39bbd77b9db5bdc0c2c424bf Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Thu, 5 Jul 2012 22:58:24 +0100 Subject: xml compatibility fixes (mainly entities to unicode conversions) --- inc/html.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 738b1f1b4..f9712d975 100644 --- a/inc/html.php +++ b/inc/html.php @@ -327,7 +327,7 @@ function html_search(){ //show progressbar print '
'.NL; - print ''.NL; print '
'.NL; @@ -389,7 +389,7 @@ function html_search(){ } //hide progressbar - print ''.NL; flush(); @@ -494,7 +494,7 @@ function html_revisions($first=0, $media_id = false){ if (!$media_id) { $form->addElement(form_makeOpenTag('span', array('class' => 'sum'))); - $form->addElement(' – '); + $form->addElement(' – '); $form->addElement(htmlspecialchars($INFO['sum'])); $form->addElement(form_makeCloseTag('span')); } @@ -573,7 +573,7 @@ function html_revisions($first=0, $media_id = false){ if ($info['sum']) { $form->addElement(form_makeOpenTag('span', array('class' => 'sum'))); - if (!$media_id) $form->addElement(' – '); + if (!$media_id) $form->addElement(' – '); $form->addElement(htmlspecialchars($info['sum'])); $form->addElement(form_makeCloseTag('span')); } @@ -765,7 +765,7 @@ function html_recent($first=0, $show_changes='both'){ $form->addElement(html_wikilink(':'.$recent['id'],useHeading('navigation')?null:$recent['id'])); } $form->addElement(form_makeOpenTag('span', array('class' => 'sum'))); - $form->addElement(' – '.htmlspecialchars($recent['sum'])); + $form->addElement(' – '.htmlspecialchars($recent['sum'])); $form->addElement(form_makeCloseTag('span')); $form->addElement(form_makeOpenTag('span', array('class' => 'user'))); @@ -1418,7 +1418,7 @@ function html_edit(){ if ($wr) { // sets changed to true when previewed - echo '' . NL; } ?> -- cgit v1.2.3 From f1d7655b8b6288d5b3d63a44412a69c0aa012ed8 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 6 Jul 2012 11:44:22 +0200 Subject: fixed error in html_diff() The used syntax was invalid in PHP < 3.4 and seemed to be wrong logical as well. --- inc/html.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 505474e0d..0afdb1820 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1087,9 +1087,10 @@ function html_diff($text='',$intro=true,$type=null){ // array in rev2. $rev1 = $REV; - if(is_array($INPUT->ref('rev2'))){ - $rev1 = (int) $INPUT->int('rev2')[0]; - $rev2 = (int) $INPUT->int('rev2')[1]; + $rev2 = $INPUT->ref('rev2'); + if(is_array($rev2)){ + $rev1 = (int) $rev2[0]; + $rev2 = (int) $rev2[1]; if(!$rev1){ $rev1 = $rev2; -- cgit v1.2.3 From 0686da461503e8b1161e3aaedbb8a42795e1f095 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Wed, 25 Jul 2012 17:40:34 +0200 Subject: Fix icon alt text for page changes The alt text is now the page id as it is the media id for media changes, previously it was empty as $filename is undefined in that 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 0afdb1820..83e1f3643 100644 --- a/inc/html.php +++ b/inc/html.php @@ -709,7 +709,7 @@ function html_recent($first=0, $show_changes='both'){ $form->addElement(media_printicon($recent['id'])); } else { $icon = DOKU_BASE.'lib/images/fileicons/file.png'; - $form->addElement(''.$filename.''); + $form->addElement(''.$recent['id'].''); } $form->addElement(form_makeOpenTag('span', array('class' => 'date'))); -- cgit v1.2.3 From b3d1090ed94469e7a1f38c0352a8a4184a6ac846 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Wed, 25 Jul 2012 18:25:04 +0200 Subject: Fix type declarations in some PHPDoc comments --- 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 83e1f3643..410b59e49 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1810,7 +1810,7 @@ function html_form_output($data) { * @param array $flashvars - parameters to be passed in the flashvar parameter * @param array $atts - additional attributes for the tag * @param string $alt - alternative content (is NOT automatically escaped!) - * @returns string - the XHTML markup + * @return string - the XHTML markup */ function html_flashobject($swf,$width,$height,$params=null,$flashvars=null,$atts=null,$alt=''){ global $lang; -- cgit v1.2.3 From 677d27850f5ab9d4f761a87f37314d54e923f24f Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sat, 28 Jul 2012 14:03:49 +0200 Subject: fixed script blocks CDATA for ie on TPL_METAHEADER_OUTPUT FS#2563 --- inc/html.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 410b59e49..708461c6a 100644 --- a/inc/html.php +++ b/inc/html.php @@ -328,9 +328,9 @@ function html_search(){ //show progressbar print '
'.NL; - print ''.NL; + print '/*!]]>*/'.NL; print '
'.NL; flush(); @@ -390,9 +390,9 @@ function html_search(){ } //hide progressbar - print ''.NL; + print '/*!]]>*/'.NL; flush(); } @@ -1424,9 +1424,9 @@ function html_edit(){ if ($wr) { // sets changed to true when previewed - echo '' . NL; + echo '/*!]]>*/' . NL; } ?>
-- cgit v1.2.3 From 90658f383dc174c5e6c715c3bf676dda5ee70ce7 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sat, 28 Jul 2012 14:21:45 +0200 Subject: Respect useheading setting on revisions page FS#2139 --- inc/html.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 708461c6a..af047a107 100644 --- a/inc/html.php +++ b/inc/html.php @@ -466,6 +466,8 @@ function html_revisions($first=0, $media_id = false){ if (!$media_id) $exists = $INFO['exists']; else $exists = @file_exists(mediaFN($id)); + $display_name = (!$media_id && useHeading('navigation')) ? hsc(p_get_first_heading($id)) : $id; + if($exists && $first==0){ if (!$media_id && isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $form->addElement(form_makeOpenTag('li', array('class' => 'minor'))); @@ -488,7 +490,7 @@ function html_revisions($first=0, $media_id = false){ $form->addElement(form_makeOpenTag('a', array( 'class' => 'wikilink1', 'href' => $href))); - $form->addElement($id); + $form->addElement($display_name); $form->addElement(form_makeCloseTag('a')); if ($media_id) $form->addElement(form_makeOpenTag('div')); @@ -563,11 +565,11 @@ function html_revisions($first=0, $media_id = false){ if (!$media_id) $href = wl($id,"rev=$rev",false,'&'); else $href = media_managerURL(array('image' => $id, 'tab_details' => 'view', 'rev' => $rev), '&'); $form->addElement(form_makeOpenTag('a', array('href' => $href, 'class' => 'wikilink1'))); - $form->addElement($id); + $form->addElement($display_name); $form->addElement(form_makeCloseTag('a')); }else{ $form->addElement(''); - $form->addElement($id); + $form->addElement($display_name); } if ($media_id) $form->addElement(form_makeOpenTag('div')); -- cgit v1.2.3 From 6d9eab4daacb2af47b0d8c19af63f9420d4c1ee1 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Fri, 24 Aug 2012 14:44:32 +0200 Subject: Prevent access to undefined variables and make returns consistent in html.php --- inc/html.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index af047a107..0a976e562 100644 --- a/inc/html.php +++ b/inc/html.php @@ -121,7 +121,7 @@ function html_secedit_get_button($data) { global $ID; global $INFO; - if (!isset($data['name']) || $data['name'] === '') return; + if (!isset($data['name']) || $data['name'] === '') return ''; $name = $data['name']; unset($data['name']); @@ -718,6 +718,9 @@ function html_recent($first=0, $show_changes='both'){ $form->addElement($date); $form->addElement(form_makeCloseTag('span')); + $diff = false; + $href = ''; + if ($recent['media']) { $diff = (count(getRevisions($recent['id'], 0, 1, 8192, true)) && @file_exists(mediaFN($recent['id']))); if ($diff) { @@ -1116,7 +1119,7 @@ function html_diff($text='',$intro=true,$type=null){ $r_text = cleanText($text); $r_head = $lang['yours']; }else{ - if($rev1 && $rev2){ // two specific revisions wanted + if($rev1 && isset($rev2) && $rev2){ // two specific revisions wanted // make sure order is correct (older on the left) if($rev1 < $rev2){ $l_rev = $rev1; -- cgit v1.2.3 From 8d5e837e4415e24f64439be7c9ecc15f402560a9 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Fri, 24 Aug 2012 14:52:00 +0200 Subject: Fix/add some PHPDoc comments in inc/html.php --- inc/html.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 0a976e562..d2c82becf 100644 --- a/inc/html.php +++ b/inc/html.php @@ -13,6 +13,10 @@ if(!defined('NL')) define('NL',"\n"); * Convenience function to quickly build a wikilink * * @author Andreas Gohr + * @param string $id id of the target page + * @param string $name the name of the link, i.e. the text that is displayed + * @param string|array $search search string(s) that shall be highlighted in the target page + * @return string the HTML code of the link */ function html_wikilink($id,$name=null,$search=''){ static $xhtml_renderer = null; @@ -1000,6 +1004,14 @@ function html_backlinks(){ } } +/** + * Get header of diff HTML + * @param string $l_rev Left revisions + * @param string $r_rev Right revision + * @param string $id Page id, if null $ID is used + * @param bool $media If it is for media files + * @return array HTML snippets for diff header + */ function html_diff_head($l_rev, $r_rev, $id = null, $media = false) { global $lang; if ($id === null) { @@ -1075,7 +1087,8 @@ function html_diff_head($l_rev, $r_rev, $id = null, $media = false) { * * @author Andreas Gohr * @param string $text - compare with this text with most current version - * @param bool $intr - display the intro text + * @param bool $intro - display the intro text + * @param string $type type of the diff (inline or sidebyside) */ function html_diff($text='',$intro=true,$type=null){ global $ID; @@ -1233,6 +1246,7 @@ function html_conflict($text,$summary){ */ function html_msgarea(){ global $MSG, $MSG_shown; + /** @var array $MSG */ // store if the global $MSG has already been shown and thus HTML output has been started $MSG_shown = true; @@ -1294,6 +1308,7 @@ function html_updateprofile(){ global $INPUT; global $ID; global $INFO; + /** @var auth_basic $auth */ global $auth; print p_locale_xhtml('updateprofile'); @@ -1492,6 +1507,7 @@ function html_minoredit(){ function html_debug(){ global $conf; global $lang; + /** @var auth_basic $auth */ global $auth; global $INFO; @@ -1578,12 +1594,14 @@ function html_admin(){ global $INFO; global $lang; global $conf; + /** @var auth_basic $auth */ global $auth; // build menu of admin functions from the plugins that handle them $pluginlist = plugin_list('admin'); $menu = array(); foreach ($pluginlist as $p) { + /** @var DokuWiki_Admin_Plugin $obj */ if($obj =& plugin_load('admin',$p) === null) continue; // check permissions @@ -1765,6 +1783,7 @@ function html_list_toc($item){ * @param string $text - what to display in the TOC * @param int $level - nesting level * @param string $hash - is prepended to the given $link, set blank if you want full links + * @return array the toc item */ function html_mktocitem($link, $text, $level, $hash='#'){ global $conf; @@ -1779,6 +1798,8 @@ function html_mktocitem($link, $text, $level, $hash='#'){ * Triggers an event with the form name: HTML_{$name}FORM_OUTPUT * * @author Tom N Harris + * @param string $name The name of the form + * @param Doku_Form $form The form */ function html_form($name, &$form) { // Safety check in case the caller forgets. @@ -1789,6 +1810,7 @@ function html_form($name, &$form) { /** * Form print function. * Just calls printForm() on the data object. + * @param Doku_Form $data The form */ function html_form_output($data) { $data->printForm(); @@ -1871,6 +1893,12 @@ function html_flashobject($swf,$width,$height,$params=null,$flashvars=null,$atts return $out; } +/** + * Prints HTML code for the given tab structure + * + * @param array $tabs tab structure + * @param string $current_tab the current tab id + */ function html_tabs($tabs, $current_tab = null) { echo '
    '.NL; -- cgit v1.2.3 From c0f0f1f84f62ba4ddd9175b1768d22b2d2fbacc0 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Fri, 24 Aug 2012 14:57:38 +0200 Subject: Remove unused/directly overwritten variable declarations in inc/html.php --- inc/html.php | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index d2c82becf..da89d60ed 100644 --- a/inc/html.php +++ b/inc/html.php @@ -150,7 +150,6 @@ function html_secedit_get_button($data) { function html_topbtn(){ global $lang; - $ret = ''; $ret = ''; return $ret; @@ -170,7 +169,6 @@ function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false $label = $lang['btn_'.$name]; $ret = ''; - $tip = ''; //filter id (without urlencoding) $id = idfilter($id,false); @@ -260,7 +258,6 @@ function html_draft(){ global $INFO; global $ID; global $lang; - global $conf; $draft = unserialize(io_readFile($INFO['draft'],false)); $text = cleanText(con($draft['prefix'],$draft['text'],$draft['suffix'],true)); @@ -316,9 +313,7 @@ function html_hilight_callback($m) { * @author Andreas Gohr */ function html_search(){ - global $conf; global $QUERY; - global $ID; global $lang; $intro = p_locale_xhtml('searchpage'); @@ -339,8 +334,6 @@ function html_search(){ flush(); //do quick pagesearch - $data = array(); - $data = ft_pageLookup($QUERY,true,useHeading('navigation')); if(count($data)){ print '
    '; @@ -834,7 +827,6 @@ function html_recent($first=0, $show_changes='both'){ function html_index($ns){ global $conf; global $ID; - $dir = $conf['datadir']; $ns = cleanID($ns); #fixme use appropriate function if(empty($ns)){ @@ -984,7 +976,6 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default',$forcewrapp */ function html_backlinks(){ global $ID; - global $conf; global $lang; print p_locale_xhtml('backlinks'); @@ -1094,7 +1085,6 @@ function html_diff($text='',$intro=true,$type=null){ global $ID; global $REV; global $lang; - global $conf; global $INPUT; if(!$type) $type = $INPUT->str('difftype'); @@ -1273,7 +1263,6 @@ function html_msgarea(){ function html_register(){ global $lang; global $conf; - global $ID; global $INPUT; print p_locale_xhtml('register'); @@ -1306,7 +1295,6 @@ function html_updateprofile(){ global $lang; global $conf; global $INPUT; - global $ID; global $INFO; /** @var auth_basic $auth */ global $auth; @@ -1592,7 +1580,6 @@ function html_debug(){ function html_admin(){ global $ID; global $INFO; - global $lang; global $conf; /** @var auth_basic $auth */ global $auth; @@ -1703,7 +1690,6 @@ function html_admin(){ function html_resendpwd() { global $lang; global $conf; - global $ID; global $INPUT; $token = preg_replace('/[^a-f0-9]+/','',$INPUT->str('pwauth')); @@ -1786,7 +1772,6 @@ function html_list_toc($item){ * @return array the toc item */ function html_mktocitem($link, $text, $level, $hash='#'){ - global $conf; return array( 'link' => $hash.$link, 'title' => $text, 'type' => 'ul', -- cgit v1.2.3