Changeset 735

Show
Ignore:
Timestamp:
09/27/2007 06:19:45 AM (22 months ago)
Author:
JavaWoman
Message:

Wakka.class.php

  • Some changes in (advanced) FormOpen() to handle GET parameters when rewrite_mode is off (to be extended later)
  • minor cleanup


wikka.css

  • added rule for class="hidden" (primarily intended for a fieldset wrapper for hidden fields, but more generally usable)


Fixes #563

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/css/wikka.css

    r730 r735  
    77/* global styling */ 
    88 
    9 p, td, li, input, select, textarea { 
     9body { 
    1010        font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif; 
    11         line-height: 20px; 
    1211        font-size: 13px; 
    13 } 
    14  
    15 form, h1, h2, h3, h4, h5 { 
    16         margin: 0px; 
    17         padding: 0px; 
    18 } 
    19  
    20 /* page layout */ 
    21  
    22 body { 
    23         font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;     font-size: 13px; 
    2412/*      text-align: justify; */                 /* comment out this line if you really need justified text */ 
    2513        line-height: 20px; 
     
    2816        margin: 0; 
    2917} 
     18 
     19p, td, li, input, select, textarea { 
     20        font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif; 
     21        line-height: 20px; 
     22        font-size: 13px; 
     23} 
     24 
     25form, h1, h2, h3, h4, h5 { 
     26        margin: 0px; 
     27        padding: 0px; 
     28} 
     29 
     30/* page layout */ 
    3031 
    3132.header { 
     
    236237        color: #393; 
    237238        background-color: #EFE; 
     239} 
     240 
     241.hidden { 
     242        display: none; 
    238243} 
    239244 
  • trunk/libs/Wakka.class.php

    r727 r735  
    466466 
    467467                $errors = array(); 
    468                 $result = getMysqlVersion($errors); 
     468                $mysql_version = getMysqlVersion($errors); 
    469469 
    470470                // report any error encountered retrieving version (like in Query()) 
     
    10151015         * @return      string  converted string 
    10161016         */ 
    1017          function hsc_secure($string, $quote_style=ENT_COMPAT) 
    1018          { 
    1019                 // init 
    1020                 $aTransSpecchar = array('&' => '&', 
    1021                                                                 '"' => '"', 
    1022                                                                 '<' => '&lt;', 
     1017        function hsc_secure($string, $quote_style=ENT_COMPAT) 
     1018        { 
     1019                // init 
     1020                $aTransSpecchar = array('&' => '&amp;', 
     1021                                                                '"' => '&quot;', 
     1022                                                                '<' => '&lt;', 
    10231023                                                                '>' => '&gt;' 
    10241024                                                                );                      // ENT_COMPAT set 
     
    10351035                $result = strtr($string,$aTransSpecchar); 
    10361036                return $result; 
    1037          } 
     1037        } 
    10381038 
    10391039        /** 
     
    22722272                                if ($debug) 
    22732273                                { 
    2274                                         print($response); 
     2274                                        print $response; 
    22752275                                } 
    22762276                        } 
     
    22882288         * @param       string  $user   mandatory: 
    22892289         * @param       string  $changelog      optional: 
    2290          * @return      mixed   either an array with the WikiPing-params or FALSE if there was an error 
     2290         * @return      mixed   either an array with the WikiPing-params or FALSE 
     2291         *                                      if retrieving one of the required parameters failed 
    22912292         * @todo        move to a dedicated class (plugin) 
    22922293         */ 
     
    29392940         *                      or without rewrite mode, and without this hidden field! 
    29402941         */ 
    2941         /* 
     2942        /* replaced by http://wikkawiki.org/AdvancedFormOpen 
    29422943        function FormOpen($handler='', $tag='', $formMethod='post') 
    29432944        { 
     
    29922993        function FormOpen($handler='', $tag='', $formMethod='post', $id='', $class='', $file=FALSE) 
    29932994        { 
     2995                // init 
    29942996                $attrMethod = '';                                                                       // no method for HTML default 'get' 
    29952997                $attrClass = ''; 
    29962998                $attrEnctype = '';                                                                      // default no enctype -> HTML default application/x-www-form-urlencoded 
    2997                 #$hiddenval = ''; 
     2999                $hidden = array(); 
    29983000                // derivations 
    29993001                $handler = trim($handler); 
     
    30043006                #$validHandler = $this->existsHandler($handler); 
    30053007                #$validPage = $this->existsPage($tag); 
     3008                // validation needed only if parameters are actually specified 
    30063009                #$handler = ($validHandler) ? $handler : ''; 
    30073010                if (!empty($handler) && !$this->existsHandler($handler)) 
     
    30103013                } 
    30113014                #$tag = ($validPage) ? $tag : ''; 
    3012                 // @@@ handle complete URL instead of page name here (or as separate param) 
    30133015                if (!empty($tag) && !$this->existspage($tag)) 
    30143016                { 
     
    30173019                 
    30183020                // form action (action is a required attribute!) 
    3019                 // @@@ handle complete URL instead of handler/pagename here 
    3020                 $attrAction = ' action="'.$this->Href($handler, $tag).'"'; 
     3021                // !!! If rewrite mode is off, "tag" has to be passed as a hidden field 
     3022                // rather than part of the URL (where it gets ignored on submit!) 
     3023                if ($this->GetConfigValue('rewrite_mode')) 
     3024                { 
     3025                        // @@@ add passed extra GET params here by passing them as extra 
     3026                        // parameter to Href() 
     3027                        $attrAction = ' action="'.$this->Href($handler, $tag).'"'; 
     3028                } 
     3029                else 
     3030                { 
     3031                        $attrAction = ' action="'.$this->Href($handler).'"'; 
     3032                        $hidden['wakka'] = ('' != $tag) ? $tag : $this->tag; 
     3033                        // @@@ add passed extra GET params here by adding them as extra 
     3034                        // entries to $hidden (probably not by adding them to Href() 
     3035                        // but that needs to be tested when we get to it!) 
     3036                } 
    30213037                // form method (ignore anything but post) and enctype 
    30223038                if (TRUE === $file) 
     
    30423058 
    30433059                // build HTML fragment 
    3044                 $result = '<form'.$attrAction.$attrMethod.$attrEnctype.$attrId.$attrClass.'>'."\n"; 
    3045                 #if (!$this->config['rewrite_mode'])                                    # is this bit really necessary? 
    3046                 #{ 
    3047                 #       $hiddenval = $this->MiniHref($method, $page); 
    3048                 #       $result .= '<fieldset class="hidden"><input type="hidden" name="wakka" value="'.$hiddenval.'" /></fieldset>'."\n"; 
    3049                 #} 
    3050  
    3051                 return $result; 
     3060                $fragment = '<form'.$attrAction.$attrMethod.$attrEnctype.$attrId.$attrClass.'>'."\n"; 
     3061                // construct and add hidden fields (necessary if we are NOT using rewrite mode) 
     3062                if (count($hidden) > 0) 
     3063                { 
     3064                        $fragment .= '<fieldset class="hidden">'."\n"; 
     3065                        foreach ($hidden as $name => $value) 
     3066                        { 
     3067                                $fragment .= '  <input type="hidden" name="'.$name.'" value="'.$value.'" />'."\n"; 
     3068                        } 
     3069                        $fragment .= '</fieldset>'."\n"; 
     3070                } 
     3071 
     3072                // return resulting HTML fragment 
     3073                return $fragment; 
    30523074        } 
    30533075        /** 
     
    31033125         * Return the full URL of an interwiki for a given shortcut, if in the list. 
    31043126         * 
    3105          * @param  string $name mandatory: the shortcut for the interWiki 
     3127         * @param  string $name mandatory: the shortcut for the interWiki 
    31063128         * @param  string $tag  mandatory: name of a page in the other wiki 
    31073129         * @return string the full URL for $tag or an empty string 
     
    31313153                if (!$tag = trim($tag)) 
    31323154                { 
    3133                         $tag = $this->GetPageTag(); 
     3155                        #$tag = $this->GetPageTag(); 
     3156                        $tag = $this->tag; 
    31343157                } 
    31353158                if (!$referrer = trim($referrer)) 
     
    33893412                return $out; 
    33903413        } 
     3414 
    33913415        /** 
    33923416         * Add a custom header(s) to be inserted inside the <head> section. 
     
    43874411         * 
    43884412         * @uses        Wakka::GetConfigValue() 
    4389          * @uses        Wakka::GetConfigValue() 
    43904413         * @uses        Wakka::LoadSingle() 
    43914414         * 
     
    45904613 
    45914614        /** 
    4592          * Determine if the current user has specified access for the specified page. 
     4615         * Determine if the (current) user has specified access for the specified page. 
    45934616         * 
    45944617         * Returns true if $username (defaults to current user) has $privilege