From b174aeae6cff69a7877494b3731c849f09b3a24a Mon Sep 17 00:00:00 2001
From: chris <chris@jalakai.co.uk>
Date: Tue, 31 Jan 2006 00:28:18 +0100
Subject: [PATCH] update wl,ml,buildURLParams with optional separator string,
 update config plugin redirect with new wl(), add meta & lang details for
 $conf['resendpasswd']

darcs-hash:20060130232818-9b6ab-2f395bc25c536b06bb5ade616a8252060ecb5278.gz
---
 inc/common.php                                | 22 +++++++++----------
 lib/plugins/config/admin.php                  |  2 +-
 lib/plugins/config/lang/en/lang.php           |  1 +
 .../config/settings/config.metadata.php       |  1 +
 4 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/inc/common.php b/inc/common.php
index dbd2ed451..7e0ecf625 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -94,11 +94,11 @@ function pageinfo(){
  *
  * @author Andreas Gohr
  */
-function buildURLparams($params){
+function buildURLparams($params, $sep='&amp;'){
   $url = '';
   $amp = false;
   foreach($params as $key => $val){
-    if($amp) $url .= '&amp;';
+    if($amp) $url .= $sep;
 
     $url .= $key.'=';
     $url .= rawurlencode($val);
@@ -247,12 +247,12 @@ function idfilter($id,$ue=true){
  *
  * @author Andreas Gohr <andi@splitbrain.org>
  */
-function wl($id='',$more='',$abs=false){
+function wl($id='',$more='',$abs=false,$sep='&amp;'){
   global $conf;
   if(is_array($more)){
-    $more = buildURLparams($more);
+    $more = buildURLparams($more,$sep);
   }else{
-    $more = str_replace(',','&amp;',$more);
+    $more = str_replace(',',$sep,$more);
   }
 
   $id    = idfilter($id);
@@ -270,7 +270,7 @@ function wl($id='',$more='',$abs=false){
     if($more) $xlink .= '?'.$more;
   }else{
     $xlink .= DOKU_SCRIPT.'?id='.$id;
-    if($more) $xlink .= '&amp;'.$more;
+    if($more) $xlink .= $sep.$more;
   }
   
   return $xlink;
@@ -281,12 +281,12 @@ function wl($id='',$more='',$abs=false){
  *
  * Will return a link to the detail page if $direct is false
  */
-function ml($id='',$more='',$direct=true){
+function ml($id='',$more='',$direct=true,$sep='&amp;'){
   global $conf;
   if(is_array($more)){
-    $more = buildURLparams($more);
+    $more = buildURLparams($more,$sep);
   }else{
-    $more = str_replace(',','&amp;',$more);
+    $more = str_replace(',',$sep,$more);
   }
 
   $xlink = DOKU_BASE;
@@ -296,7 +296,7 @@ function ml($id='',$more='',$direct=true){
     $xlink .= 'lib/exe/fetch.php';
     if($more){
       $xlink .= '?'.$more;
-      $xlink .= '&amp;media='.rawurlencode($id);
+      $xlink .= $sep.'media='.rawurlencode($id);
     }else{
       $xlink .= '?media='.rawurlencode($id);
     }
@@ -327,7 +327,7 @@ function ml($id='',$more='',$direct=true){
    }else{
      if($more){
        $xlink .= $script.'?'.$more;
-       $xlink .= '&amp;media='.$id;
+       $xlink .= $sep.'media='.$id;
      }else{
        $xlink .= $script.'?media='.$id;
      }
diff --git a/lib/plugins/config/admin.php b/lib/plugins/config/admin.php
index bd579423b..5f628e687 100644
--- a/lib/plugins/config/admin.php
+++ b/lib/plugins/config/admin.php
@@ -79,7 +79,7 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin {
         // save state & force a page reload to get the new settings to take effect
         $_SESSION['PLUGIN_CONFIG'] = array('state' => 'updated', 'time' => time());
         $this->_close_session();
-        header("Location: ".str_replace('&amp;','&',wl($ID,'do=admin&page=config')));
+        header("Location: ".wl($ID,array('do'=>'admin','page'=>'config'),true,'&'));
         exit();
       }
       
diff --git a/lib/plugins/config/lang/en/lang.php b/lib/plugins/config/lang/en/lang.php
index 736e4f048..c79c09381 100644
--- a/lib/plugins/config/lang/en/lang.php
+++ b/lib/plugins/config/lang/en/lang.php
@@ -54,6 +54,7 @@ $lang['mailguard']   = 'obfuscate email addresses';  //obfuscate email addresses
 $lang['useacl']      = 'use ACL';                //Use Access Control Lists to restrict access?
 $lang['openregister']= 'open register';          //Should users to be allowed to register?
 $lang['autopasswd']  = 'autogenerate passwords'; //autogenerate passwords and email them to user
+$lang['resendpasswd']= 'allow resend password';  //allow resend password function?
 $lang['authtype']    = 'authentication backend'; //which authentication backend should be used
 $lang['passcrypt']   = 'password encryption';    //Used crypt method (smd5,md5,sha1,ssha,crypt,mysql,my411)
 $lang['defaultgroup']= 'default group';          //Default groups new Users are added to
diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php
index c69bb8f36..48ce2db6a 100644
--- a/lib/plugins/config/settings/config.metadata.php
+++ b/lib/plugins/config/settings/config.metadata.php
@@ -103,6 +103,7 @@ $meta['mailguard']   = array('multichoice','_choices' => array('visible','hex','
 $meta['useacl']      = array('onoff');
 $meta['openregister']= array('onoff');
 $meta['autopasswd']  = array('onoff');
+$meta['resendpasswd'] = array('onoff');
 $meta['authtype']    = array('authtype');
 $meta['passcrypt']   = array('multichoice','_choices' => array('smd5','md5','sha1','ssha','crypt','mysql','my411'));
 $meta['defaultgroup']= array('');
-- 
GitLab