*** kernel/common/ezurloperator.php	2005-04-06 04:19:45.000000000 -0700
--- kernel/common/ezurloperator.php.apache2.from.ezsystems	2005-05-23 03:03:46.000000000 -0700
***************
*** 4,10 ****
  //
  // Created on: <18-Apr-2002 12:15:07 amos>
  //
! // Copyright (C) 1999-2005 eZ systems as. All rights reserved.
  //
  // This source file is part of the eZ publish (tm) Open Source Content
  // Management System.
--- 4,10 ----
  //
  // Created on: <18-Apr-2002 12:15:07 amos>
  //
! // Copyright (C) 1999-2004 eZ systems as. All rights reserved.
  //
  // This source file is part of the eZ publish (tm) Open Source Content
  // Management System.
***************
*** 33,38 ****
--- 33,39 ----
  //
  // Contact licence@ez.no if any conditions of this licencing isn't clear to
  // you.
+ 
  //
  
  
***************
*** 121,127 ****
                                                 'parameters' => true,
                                                 'element-transformation' => true,
                                                 'transform-parameters' => true,
!                                                'input-as-parameter' => true,
                                                 'element-transformation-func' => 'iniTrans')
                        );
      }
--- 122,128 ----
                                                 'parameters' => true,
                                                 'element-transformation' => true,
                                                 'transform-parameters' => true,
!                                                'input-as-parameter' => false,
                                                 'element-transformation-func' => 'iniTrans')
                        );
      }
***************
*** 139,190 ****
              $iniVariable = eZTemplateNodeTool::elementStaticValue( $parameters[1] );
  
              $iniName = false;
-             $iniPath = false;
- 
              if ( count( $parameters ) > 2 )
              {
                  $iniName = eZTemplateNodeTool::elementStaticValue( $parameters[2] );
              }
              
-             if ( count( $parameters ) > 3 )
-                 $iniPath = eZTemplateNodeTool::elementStaticValue( $parameters[3] );
- 
-             if ( count( $parameters ) > 4 )
-                 if ( eZTemplateNodeTool::elementStaticValue( $parameters[4] ) == 'true' )
-                 {
-                     $values = array();
-                     $values[] = $parameters[0];
-                     $values[] = $parameters[1];
- 
-                     $code = "include_once( 'lib/ezutils/classes/ezini.php' );\n";
- 
-                     if ( $iniPath !== false )
-                     {
-                         $values[] = $parameters[2];
-                         $values[] = $parameters[3];
-                         $code .= '%tmp1% =& eZINI::instance( %3%, %4%, null, null, null, true );' . "\n";
-                     }
-                     elseif ( $iniName !== false )
-                     {
-                         $values[] = $parameters[2];
-                         $code .= '%tmp1% =& eZINI::instance( %3% );' . "\n";
-                     }
-                     else
-                         $code .= '%tmp1% =& eZINI::instance();' . "\n";
- 
-                     $code .= 'if ( %tmp1%->hasVariable( %1%, %2% ) )' . "\n" .
-                         '    %output% = %tmp1%->variable( %1%, %2% );' . "\n" .
-                         "else\n" .
-                         "    %output% = '';\n";
-                         
-                     return array( eZTemplateNodeTool::createCodePieceElement( $code, $values, false, 1 ) );
-                 }
- 
              include_once( 'lib/ezutils/classes/ezini.php' );
! 
!             if ( $iniPath !== false )
!                 $ini =& eZINI::instance( $iniName, $iniPath, null, null, null, true );
!             elseif ( $iniName !== false )
                  $ini =& eZINI::instance( $iniName );
              else
                  $ini =& eZINI::instance();
--- 140,152 ----
              $iniVariable = eZTemplateNodeTool::elementStaticValue( $parameters[1] );
  
              $iniName = false;
              if ( count( $parameters ) > 2 )
              {
                  $iniName = eZTemplateNodeTool::elementStaticValue( $parameters[2] );
              }
  
              include_once( 'lib/ezutils/classes/ezini.php' );
!             if ( $iniName !== false )
                  $ini =& eZINI::instance( $iniName );
              else
                  $ini =& eZINI::instance();
***************
*** 228,243 ****
                      }
                      else
                      {
-                         if ( strlen( $url ) > 0 && $url[0] == '#' )
-                         {
-                             $url = htmlspecialchars( $url );
-                         }
-                         else
-                         {
                              if ( strlen( $url ) == 0 )
                              {
                                  $url = '/';
                              }
                              else if ( $url[0] != '/' )
                              {
                                  $url = '/' . $url;
--- 190,203 ----
                      }
                      else
                      {
                          if ( strlen( $url ) == 0 )
                          {
                              $url = '/';
                          }
+                         else if ( $url[0] == '#' )
+                         {
+                             $url = htmlspecialchars( $url );
+                         }
                          else if ( $url[0] != '/' )
                          {
                              $url = '/' . $url;
***************
*** 246,253 ****
                              $url = $this->Sys->indexDir() . $url;
                              $url = preg_replace( "#(//)#", "/", $url );
                              $url = preg_replace( "#^(.+)(/+)$#", '$1', $url );
!                             $url = htmlspecialchars( $url );
!                         }
                      }
                      $url = $this->applyQuotes( $url, $parameters[1] );
  
--- 206,212 ----
                          $url = $this->Sys->indexDir() . $url;
                          $url = preg_replace( "#(//)#", "/", $url );
                          $url = preg_replace( "#^(.+)(/+)$#", '$1', $url );
!                         $url = htmlspecialchars( $url ) . "/";
                      }
                      $url = $this->applyQuotes( $url, $parameters[1] );
  
***************
*** 263,278 ****
  }
  else
  {
-     if ( strlen( %1% ) > 0 && %1%[0] == '#' )
-     {
-         %1% = htmlspecialchars( %1% );
-     }
-     else
-     {
          if ( strlen( %1% ) == 0 )
          {
              %1% = '/';
          }
          else if ( %1%[0] != '/' )
          {
              %1% = '/' . %1%;
--- 222,235 ----
  }
  else
  {
      if ( strlen( %1% ) == 0 )
      {
        %1% = '/';
      }
+     else if ( %1%[0] == '#' )
+     {
+         %1% = htmlspecialchars( %1% );
+     }
      else if ( %1%[0] != '/' )
      {
          %1% = '/' . %1%;
***************
*** 281,287 ****
          %1% = preg_replace( "#(//)#", "/", %1% );
          %1% = preg_replace( "#^(.+)(/+)$#", "\$1", %1% );
          %1% = htmlspecialchars( %1% );
-     }
  }
  if ( %1% == "" )
      %1% = "/";
--- 238,243 ----
***************
*** 367,386 ****
                      return array( eZTemplateNodeTool::createStringElement( $path ) );
                  }
  
!                 $code = ( '%tmp1% =& eZTemplateDesignResource::instance();' . "\n" .
                            'include_once( \'kernel/common/ezoverride.php\' );' . "\n" .
                            '%tmp2% = array();' . "\n" .
!                           '%tmp1% =& eZOverride::selectFile( eZTemplateDesignResource::fileMatchingRules( false, %1% ), %tmp1%->keys(), %tmp2%, "#^(.+)/(.+)(\.[a-zA-Z0-9]+)$#" );' . "\n" .
                            'if ( %tmp1% === null )' . "\n" .
                            '{' . "\n" .
                            '    %tmp1% = array();' . "\n" .
                            '}' . "\n" .
!                           'else' . "\n" .
!                           '{' . "\n" .
!                           '    %1% = %tmp1%["file"];' . "\n" .
!                           '    %1% = %2% . "/" . %1%;' . "\n" .
!                           '    %1% = htmlspecialchars( %1% );' . "\n" .
!                           '}' . "\n" );
  
                  $values[] = $parameters[0];
                  $values[] = array( eZTemplateNodeTool::createStringElement( $this->Sys->wwwDir() ) );
--- 323,339 ----
                      return array( eZTemplateNodeTool::createStringElement( $path ) );
                  }
  
!                 $code = '%tmp1% =& eZTemplateDesignResource::instance();' . "\n" .
                           'include_once( \'kernel/common/ezoverride.php\' );' . "\n" .
                           '%tmp2% = array();' . "\n" .
!                          '%tmp1% = eZOverride::selectFile( eZTemplateDesignResource::fileMatchingRules( false, %1% ), %tmp1%->keys(), %tmp2%, "#^(.+)/(.+)(\.[a-zA-Z0-9]+)$#" );' . "\n" .
                           'if ( %tmp1% === null )' . "\n" .
                           '{' . "\n" .
                           '  %tmp1% = array();' . "\n" .
                           '}' . "\n" .
!                          '%1% = %tmp1%["file"];' . "\n" .
!                          '%1% = %2% . "/" . %1%;' . "\n" .
!                          '%1% = htmlspecialchars( %1% );' . "\n";
  
                  $values[] = $parameters[0];
                  $values[] = array( eZTemplateNodeTool::createStringElement( $this->Sys->wwwDir() ) );
***************
*** 602,644 ****
                      {
                          $iniVariable = $tpl->elementValue( $operatorParameters[1], $rootNamespace, $currentNamespace );
                          $iniName = false;
-                         $iniPath = false;
                          if ( count( $operatorParameters ) > 2 )
                          {
                              $iniName = $tpl->elementValue( $operatorParameters[2], $rootNamespace, $currentNamespace );
                          }
-                         if ( count( $operatorParameters ) > 3 )
-                         {
-                             $iniPath = $tpl->elementValue( $operatorParameters[3], $rootNamespace, $currentNamespace );
-                         }
- 
                          include_once( 'lib/ezutils/classes/ezini.php' );
!             
!                         if ( $iniPath !== false )
!                             $ini =& eZINI::instance( $iniName, $iniPath, null, null, null, true );
!                         elseif ( $iniName !== false )
                              $ini =& eZINI::instance( $iniName );
                          else
                              $ini =& eZINI::instance();
-             
                          if ( $ini->hasVariable( $iniGroup, $iniVariable ) )
                          {
                              $operatorValue = $ini->variable( $iniGroup, $iniVariable );
                          }
                          else
                          {
-                             if ( $iniPath !== false )
-                             {
-                                 // Return empty string instead of displaying error when using 'path' parameter
-                                 // and DirectAccess mode for ezini.
-                                 $operatorValue = '';
-                             }
-                             else
-                             {
                                  if ( $iniName === false )
                                      $iniName = 'site.ini';
!                                 $tpl->error( $operatorName, "!!!No such variable '$iniVariable' in group '$iniGroup' for $iniName" );
!                             }
                          }
                          return;
                      }
--- 555,578 ----
                      {
                          $iniVariable = $tpl->elementValue( $operatorParameters[1], $rootNamespace, $currentNamespace );
                          $iniName = false;
                          if ( count( $operatorParameters ) > 2 )
                          {
                              $iniName = $tpl->elementValue( $operatorParameters[2], $rootNamespace, $currentNamespace );
                          }
                          include_once( 'lib/ezutils/classes/ezini.php' );
!                         if ( $iniName !== false )
                              $ini =& eZINI::instance( $iniName );
                          else
                              $ini =& eZINI::instance();
                          if ( $ini->hasVariable( $iniGroup, $iniVariable ) )
                          {
                              $operatorValue = $ini->variable( $iniGroup, $iniVariable );
                          }
                          else
                          {
                              if ( $iniName === false )
                                  $iniName = 'site.ini';
!                             $tpl->error( $operatorValue, "No such variable '$iniVariable' in group '$iniGroup' for $iniName" );
                          }
                          return;
                      }
***************
*** 703,710 ****
  
              case $this->URLName:
              {
!                 include_once( 'lib/ezutils/classes/ezuri.php' );
!                 eZURI::transformURI( $operatorValue );
  
                  if ( $operatorValue == "" )
                      $operatorValue = "/";
--- 637,660 ----
  
              case $this->URLName:
              {
!                 if ( preg_match( "#^[a-zA-Z0-9]+:#", $operatorValue ) or
!                      substr( $operatorValue, 0, 2 ) == '//' )
!                      break;
!                 if ( strlen( $operatorValue ) == 0 )
!                     $operatorValue = '/';
!                 else if ( $operatorValue[0] == '#' )
!                 {
!                     $operatorValue = htmlspecialchars( $operatorValue );
!                     break;
!                 }
!                 else if ( $operatorValue[0] != '/' )
!                 {
!                     $operatorValue = '/' . $operatorValue;
!                 }
!                 $operatorValue = $this->Sys->indexDir() . $operatorValue;
!                 $operatorValue = preg_replace( "#^(//)#", "/", $operatorValue );
!                 $operatorValue = preg_replace( "#(^.*)(/+)$#", "\$1", $operatorValue );
!                 $operatorValue = htmlspecialchars( $operatorValue );
  
                  if ( $operatorValue == "" )
                      $operatorValue = "/";
