From 2a7abf2d7fee6a2d6418e5ad4b79e37e6049bd92 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Wed, 31 Jul 2013 18:14:26 +0200 Subject: FS#2751 - self deletion of user account --- inc/html.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index fb39fcb3c..5e3388a52 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1381,6 +1381,23 @@ function html_updateprofile(){ $form->addElement(form_makeButton('reset', '', $lang['btn_reset'])); $form->endFieldset(); html_form('updateprofile', $form); + + if ($auth->canDo('delUser') && actionOK('profile_delete')) { + $form_profiledelete = new Doku_Form(array('id' => 'dw__profiledelete')); + $form_profiledelete->startFieldset($lang['profdeleteuser']); + $form_profiledelete->addHidden('do', 'profile_delete'); + $form_profiledelete->addHidden('delete', '1'); + $form_profiledelete->addElement(form_makeCheckboxField('confirm_delete', '1', $lang['profconfdelete'],'dw__confirmdelete','', array('required' => 'required'))); + if ($conf['profileconfirm']) { + $form_profiledelete->addElement(form_makeTag('br')); + $form_profiledelete->addElement(form_makePasswordField('oldpass', $lang['oldpass'], '', 'block', array('size'=>'50', 'required' => 'required'))); + } + $form_profiledelete->addElement(form_makeButton('submit', '', $lang['btn_deleteuser'])); + $form_profiledelete->endFieldset(); + + html_form('profiledelete', $form_profiledelete); + } + print ''.NL; } -- cgit v1.2.3 From a669bfe08c4c0ef180e38dd3189eaf81c0029f1c Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Wed, 31 Jul 2013 18:38:02 +0200 Subject: add html5 attributes to register form --- inc/html.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index fb39fcb3c..d94291090 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1318,19 +1318,22 @@ function html_register(){ global $conf; global $INPUT; + $base_attrs = array('size'=>50,'required'=>'required'); + $email_attrs = $base_attrs + array('type'=>'email','class'=>'edit'); + print p_locale_xhtml('register'); print '
'.NL; $form = new Doku_Form(array('id' => 'dw__register')); $form->startFieldset($lang['btn_register']); $form->addHidden('do', 'register'); $form->addHidden('save', '1'); - $form->addElement(form_makeTextField('login', $INPUT->post->str('login'), $lang['user'], '', 'block', array('size'=>'50'))); + $form->addElement(form_makeTextField('login', $INPUT->post->str('login'), $lang['user'], '', 'block', $base_attrs)); 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_makePasswordField('pass', $lang['pass'], '', 'block', $base_attrs)); + $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', $base_attrs)); } - $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_makeTextField('fullname', $INPUT->post->str('fullname'), $lang['fullname'], '', 'block', $base_attrs)); + $form->addElement(form_makeField('email','email', $INPUT->post->str('email'), $lang['email'], '', 'block', $email_attrs)); $form->addElement(form_makeButton('submit', '', $lang['btn_register'])); $form->endFieldset(); html_form('register', $form); -- cgit v1.2.3 From 3b1338fffdb38ad47f7d814bc8d61b2f06305d69 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Wed, 31 Jul 2013 18:38:31 +0200 Subject: add html5 attributes to update profile form --- inc/html.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index d94291090..53f4c45ff 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1356,10 +1356,10 @@ function html_updateprofile(){ global $auth; print p_locale_xhtml('updateprofile'); + print '
'.NL; $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'); @@ -1368,9 +1368,9 @@ function html_updateprofile(){ $attr = array('size'=>'50'); if (!$auth->canDo('modName')) $attr['disabled'] = 'disabled'; $form->addElement(form_makeTextField('fullname', $fullname, $lang['fullname'], '', 'block', $attr)); - $attr = array('size'=>'50'); + $attr = array('size'=>'50', 'class'=>'edit'); if (!$auth->canDo('modMail')) $attr['disabled'] = 'disabled'; - $form->addElement(form_makeTextField('email', $email, $lang['email'], '', 'block', $attr)); + $form->addElement(form_makeField('email','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'))); @@ -1378,10 +1378,11 @@ function html_updateprofile(){ } if ($conf['profileconfirm']) { $form->addElement(form_makeTag('br')); - $form->addElement(form_makePasswordField('oldpass', $lang['oldpass'], '', 'block', array('size'=>'50'))); + $form->addElement(form_makePasswordField('oldpass', $lang['oldpass'], '', 'block', array('size'=>'50', 'required' => 'required'))); } $form->addElement(form_makeButton('submit', '', $lang['btn_save'])); $form->addElement(form_makeButton('reset', '', $lang['btn_reset'])); + $form->endFieldset(); html_form('updateprofile', $form); print '
'.NL; -- cgit v1.2.3 From b1af90141d42f8844159ff4fad76968a8ee78687 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Thu, 1 Aug 2013 16:32:28 +0200 Subject: Improve nofollow behaviour for ?do=index In response to FS#2766 - make namespace links in the browser sitemap nofollow - remove nofollow from browser sitemap link on the wiki start page when sitemap.xml generation is disabled --- 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 53f4c45ff..53a100ec7 100644 --- a/inc/html.php +++ b/inc/html.php @@ -859,7 +859,8 @@ function html_list_index($item){ $base = ':'.$item['id']; $base = substr($base,strrpos($base,':')+1); if($item['type']=='d'){ - $ret .= ''; + // FS#2766, no need for search bots to follow namespace links in the index + $ret .= ''; $ret .= $base; $ret .= ''; }else{ -- cgit v1.2.3 From 5a99d25b24f7e14f137084100f40325b7a2a71b4 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Thu, 1 Aug 2013 16:38:02 +0100 Subject: added aria attributes to edit mode --- 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 fb39fcb3c..9c69c9845 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1488,7 +1488,7 @@ function html_edit(){ echo 'textChanged = ' . ($mod ? 'true' : 'false'); echo '/*!]]>*/' . NL; } ?> -
+
-- cgit v1.2.3 From 74ef17786eb9ce751a8dd7c66ab7523efa92c79f Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Thu, 1 Aug 2013 22:46:16 +0200 Subject: include namespace links when index access from the wiki start page and no automatic sitemap.xml is being generated. --- inc/html.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 53a100ec7..5f94d7dce 100644 --- a/inc/html.php +++ b/inc/html.php @@ -854,13 +854,17 @@ function html_index($ns){ * @author Andreas Gohr */ function html_list_index($item){ - global $ID; + global $ID, $conf; + + // prevent searchbots needlessly following links - only necessary when accessed from the homepage and no sitemap.xml is being generated + $nofollow = ($ID != $conf['start'] || $conf['sitemap']) ? ' rel="nofollow"' : ''; + $ret = ''; $base = ':'.$item['id']; $base = substr($base,strrpos($base,':')+1); if($item['type']=='d'){ // FS#2766, no need for search bots to follow namespace links in the index - $ret .= ''; + $ret .= ''; $ret .= $base; $ret .= ''; }else{ -- cgit v1.2.3 From b8bc53ce8da2f0fb9cfedb01df6507b29f32daaa Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Thu, 1 Aug 2013 23:06:57 +0200 Subject: simplify comment --- 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 5f94d7dce..d43611940 100644 --- a/inc/html.php +++ b/inc/html.php @@ -856,7 +856,7 @@ function html_index($ns){ function html_list_index($item){ global $ID, $conf; - // prevent searchbots needlessly following links - only necessary when accessed from the homepage and no sitemap.xml is being generated + // prevent searchbots needlessly following links $nofollow = ($ID != $conf['start'] || $conf['sitemap']) ? ' rel="nofollow"' : ''; $ret = ''; -- cgit v1.2.3 From d317fb5d70f8903dc518943c731202869d450d68 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Fri, 2 Aug 2013 14:04:04 +0100 Subject: fixed some bi-directionality issues Fixed some issues which occur whenever RTL and LTR languages could potentially be mixed, using the HTML5 `` element. This element is currently only supported by Chrome and Firefox. The old and only partially working fix for tpl_breadcrumbs() was removed in favour of this solution. --- inc/html.php | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 614cf172c..2d2bb8a7c 100644 --- a/inc/html.php +++ b/inc/html.php @@ -575,18 +575,18 @@ function html_revisions($first=0, $media_id = false){ if ($info['sum']) { $form->addElement(form_makeOpenTag('span', array('class' => 'sum'))); if (!$media_id) $form->addElement(' – '); - $form->addElement(htmlspecialchars($info['sum'])); + $form->addElement(''.htmlspecialchars($info['sum']).''); $form->addElement(form_makeCloseTag('span')); } $form->addElement(form_makeOpenTag('span', array('class' => 'user'))); if($info['user']){ - $form->addElement(editorinfo($info['user'])); + $form->addElement(''.editorinfo($info['user']).''); if(auth_ismanager()){ - $form->addElement(' ('.$info['ip'].')'); + $form->addElement(' ('.$info['ip'].')'); } }else{ - $form->addElement($info['ip']); + $form->addElement(''.$info['ip'].''); } $form->addElement(form_makeCloseTag('span')); @@ -774,12 +774,12 @@ function html_recent($first=0, $show_changes='both'){ $form->addElement(form_makeOpenTag('span', array('class' => 'user'))); if($recent['user']){ - $form->addElement(editorinfo($recent['user'])); + $form->addElement(''.editorinfo($recent['user']).''); if(auth_ismanager()){ - $form->addElement(' ('.$recent['ip'].')'); + $form->addElement(' ('.$recent['ip'].')'); } }else{ - $form->addElement($recent['ip']); + $form->addElement(''.$recent['ip'].''); } $form->addElement(form_makeCloseTag('span')); @@ -1027,52 +1027,52 @@ function html_diff_head($l_rev, $r_rev, $id = null, $media = false, $inline = fa }else{ $l_info = getRevisionInfo($id,$l_rev,true, $media); if($l_info['user']){ - $l_user = editorinfo($l_info['user']); - if(auth_ismanager()) $l_user .= ' ('.$l_info['ip'].')'; + $l_user = ''.editorinfo($l_info['user']).''; + if(auth_ismanager()) $l_user .= ' ('.$l_info['ip'].')'; } else { - $l_user = $l_info['ip']; + $l_user = ''.$l_info['ip'].''; } $l_user = ''.$l_user.''; - $l_sum = ($l_info['sum']) ? ''.hsc($l_info['sum']).'' : ''; + $l_sum = ($l_info['sum']) ? ''.hsc($l_info['sum']).'' : ''; if ($l_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $l_minor = 'class="minor"'; $l_head_title = ($media) ? dformat($l_rev) : $id.' ['.dformat($l_rev).']'; - $l_head = ''. - $l_head_title.''. + $l_head = ''. + $l_head_title.''. $head_separator.$l_user.' '.$l_sum; } if($r_rev){ $r_info = getRevisionInfo($id,$r_rev,true, $media); if($r_info['user']){ - $r_user = editorinfo($r_info['user']); - if(auth_ismanager()) $r_user .= ' ('.$r_info['ip'].')'; + $r_user = ''.editorinfo($r_info['user']).''; + if(auth_ismanager()) $r_user .= ' ('.$r_info['ip'].')'; } else { - $r_user = $r_info['ip']; + $r_user = ''.$r_info['ip'].''; } $r_user = ''.$r_user.''; - $r_sum = ($r_info['sum']) ? ''.hsc($r_info['sum']).'' : ''; + $r_sum = ($r_info['sum']) ? ''.hsc($r_info['sum']).'' : ''; if ($r_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"'; $r_head_title = ($media) ? dformat($r_rev) : $id.' ['.dformat($r_rev).']'; - $r_head = ''. - $r_head_title.''. + $r_head = ''. + $r_head_title.''. $head_separator.$r_user.' '.$r_sum; }elseif($_rev = @filemtime($media_or_wikiFN($id))){ $_info = getRevisionInfo($id,$_rev,true, $media); if($_info['user']){ - $_user = editorinfo($_info['user']); - if(auth_ismanager()) $_user .= ' ('.$_info['ip'].')'; + $_user = ''.editorinfo($_info['user']).''; + if(auth_ismanager()) $_user .= ' ('.$_info['ip'].')'; } else { - $_user = $_info['ip']; + $_user = ''.$_info['ip'].''; } $_user = ''.$_user.''; - $_sum = ($_info['sum']) ? ''.hsc($_info['sum']).'' : ''; + $_sum = ($_info['sum']) ? ''.hsc($_info['sum']).'' : ''; if ($_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"'; $r_head_title = ($media) ? dformat($_rev) : $id.' ['.dformat($_rev).']'; - $r_head = ''. - $r_head_title.' '. + $r_head = ''. + $r_head_title.' '. '('.$lang['current'].')'. $head_separator.$_user.' '.$_sum; }else{ -- cgit v1.2.3 From 2f46ade0bbc43b599bedf620e2514171cce072df Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sun, 4 Aug 2013 10:58:52 +0200 Subject: FS#2806 - fix auth capability listing in html_debug() --- inc/html.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 96c4eaa1a..a2a726406 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1629,7 +1629,9 @@ function html_debug(){ if($auth){ print 'Auth backend capabilities:
';
-        print_r($auth->cando);
+        foreach ($auth->getCapabilities() as $cando){
+            print '   '.str_pad($cando,16) . ' => ' . (int)$auth->canDo($cando) . NL;
+        }
         print '
'; } -- cgit v1.2.3 From 7ef8e99fe605c5da36ab6b5d317b22fcd17f665b Mon Sep 17 00:00:00 2001 From: Matt Perry Date: Thu, 22 Aug 2013 01:01:41 -0700 Subject: Fix CodeSniffer violations Change indentation to ensure code confirms to CodeSniffer rules. --- inc/html.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index a2a726406..03e9dc751 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1240,20 +1240,20 @@ function html_diff($text='',$intro=true,$type=null){ } function html_insert_softbreaks($diffhtml) { - // search the diff html string for both: - // - html tags, so these can be ignored - // - long strings of characters without breaking characters - return preg_replace_callback('/<[^>]*>|[^<> ]{12,}/','html_softbreak_callback',$diffhtml); + // search the diff html string for both: + // - html tags, so these can be ignored + // - long strings of characters without breaking characters + return preg_replace_callback('/<[^>]*>|[^<> ]{12,}/','html_softbreak_callback',$diffhtml); } function html_softbreak_callback($match){ - // if match is an html tag, return it intact - if ($match[0]{0} == '<') return $match[0]; + // if match is an html tag, return it intact + if ($match[0]{0} == '<') return $match[0]; - // its a long string without a breaking character, - // make certain characters into breaking characters by inserting a - // breaking character (zero length space, U+200B / #8203) in front them. - $regex = <<< REGEX + // its a long string without a breaking character, + // make certain characters into breaking characters by inserting a + // breaking character (zero length space, U+200B / #8203) in front them. + $regex = <<< REGEX (?(?= # start a conditional expression with a positive look ahead ... &\#?\\w{1,6};) # ... for html entities - we don't want to split them (ok to catch some invalid combinations) &\#?\\w{1,6}; # yes pattern - a quicker match for the html entity, since we know we have one @@ -1262,7 +1262,7 @@ function html_softbreak_callback($match){ )+ # end conditional expression REGEX; - return preg_replace('<'.$regex.'>xu','\0​',$match[0]); + return preg_replace('<'.$regex.'>xu','\0​',$match[0]); } /** -- cgit v1.2.3 From a04f2bd5a2eae55dbbdbbcffbe7b500b689138e7 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Tue, 15 Oct 2013 16:08:45 +0200 Subject: not assign object from plugin_load by reference --- 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 03e9dc751..68ca364f1 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1669,7 +1669,7 @@ function html_admin(){ $menu = array(); foreach ($pluginlist as $p) { /** @var DokuWiki_Admin_Plugin $obj */ - if($obj =& plugin_load('admin',$p) === null) continue; + if($obj = plugin_load('admin',$p) === null) continue; // check permissions if($obj->forAdminOnly() && !$INFO['isadmin']) continue; -- cgit v1.2.3 From 5da403f17a007f1b202f1c5ea2dbc80ab19d26e8 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Tue, 15 Oct 2013 16:26:25 +0200 Subject: fix signatures and old by references --- 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 68ca364f1..2d7216a45 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1661,7 +1661,7 @@ function html_admin(){ global $ID; global $INFO; global $conf; - /** @var auth_basic $auth */ + /** @var DokuWiki_Auth_Plugin $auth */ global $auth; // build menu of admin functions from the plugins that handle them @@ -1669,7 +1669,7 @@ function html_admin(){ $menu = array(); foreach ($pluginlist as $p) { /** @var DokuWiki_Admin_Plugin $obj */ - if($obj = plugin_load('admin',$p) === null) continue; + if(($obj = plugin_load('admin',$p)) === null) continue; // check permissions if($obj->forAdminOnly() && !$INFO['isadmin']) continue; -- cgit v1.2.3 From 61e0b2f8bbbac3ec582aa287e110b304a3986229 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Fri, 18 Oct 2013 12:47:55 +0100 Subject: comment improvements --- 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 03e9dc751..a13c9e58c 100644 --- a/inc/html.php +++ b/inc/html.php @@ -428,7 +428,7 @@ function html_revisions($first=0, $media_id = false){ global $conf; global $lang; $id = $ID; - /* we need to get one additionally log entry to be able to + /* we need to get one additional log entry to be able to * decide if this is the last page or is there another one. * see html_recent() */ -- cgit v1.2.3 From b1f535eb5e822dc2e16f687bb0a69c8643224d87 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Mon, 4 Nov 2013 01:24:22 +0000 Subject: removed deprecated html_attbuild() --- inc/html.php | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index bbe29e371..7f473cdb6 100644 --- a/inc/html.php +++ b/inc/html.php @@ -27,20 +27,6 @@ function html_wikilink($id,$name=null,$search=''){ return $xhtml_renderer->internallink($id,$name,$search,true,'navigation'); } -/** - * Helps building long attribute lists - * - * @deprecated Use buildAttributes instead - * @author Andreas Gohr - */ -function html_attbuild($attributes){ - $ret = ''; - foreach ( $attributes as $key => $value ) { - $ret .= $key.'="'.formText($value).'" '; - } - return trim($ret); -} - /** * The loginform * -- cgit v1.2.3