[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/kernel/url/ -> view.php (source)

   1  <?php
   2  //
   3  // Created on: <23-Jan-2003 11:37:30 amos>
   4  //
   5  // SOFTWARE NAME: eZ publish
   6  // SOFTWARE RELEASE: 3.9.0
   7  // BUILD VERSION: 17785
   8  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
   9  // SOFTWARE LICENSE: GNU General Public License v2.0
  10  // NOTICE: >
  11  //   This program is free software; you can redistribute it and/or
  12  //   modify it under the terms of version 2.0  of the GNU General
  13  //   Public License as published by the Free Software Foundation.
  14  //
  15  //   This program is distributed in the hope that it will be useful,
  16  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  17  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18  //   GNU General Public License for more details.
  19  //
  20  //   You should have received a copy of version 2.0 of the GNU General
  21  //   Public License along with this program; if not, write to the Free
  22  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  23  //   MA 02110-1301, USA.
  24  //
  25  //
  26  
  27  /*! \file view.php
  28  */
  29  
  30  $Module =& $Params['Module'];
  31  $urlID =& $Params['ID'];
  32  
  33  include_once ( "lib/ezutils/classes/ezhttptool.php" );
  34  include_once ( 'kernel/classes/datatypes/ezurl/ezurl.php' );
  35  include_once ( 'kernel/classes/datatypes/ezurl/ezurlobjectlink.php' );
  36  include_once ( 'kernel/classes/ezpreferences.php' );
  37  
  38  if( eZPreferences::value( 'admin_url_view_limit' ) )
  39  {
  40      switch( eZPreferences::value( 'admin_url_view_limit' ) )
  41      {
  42          case '2': { $limit = 25; } break;
  43          case '3': { $limit = 50; } break;
  44          default:  { $limit = 10; } break;
  45      }
  46  }
  47  else
  48  {
  49      $limit = 10;
  50  }
  51  
  52  $offset = $Params['Offset'];
  53  if ( !is_numeric( $offset ) )
  54  {
  55      $offset = 0;
  56  }
  57  
  58  $url = eZURL::fetch( $urlID );
  59  if ( !$url )
  60      return $Module->handleError( EZ_ERROR_KERNEL_NOT_AVAILABLE, 'kernel' );
  61  
  62  $link = $url->attribute( 'url' );
  63  if ( preg_match("/^(http:)/i", $link ) or
  64       preg_match("/^(ftp:)/i", $link ) or
  65       preg_match("/^(https:)/i", $link ) or
  66       preg_match("/^(file:)/i", $link ) or
  67       preg_match("/^(mailto:)/i", $link ) )
  68  {
  69      // No changes
  70  }
  71  else
  72  {
  73      include_once ( "lib/ezutils/classes/ezini.php" );
  74      include_once ( "lib/ezutils/classes/ezsys.php" );
  75      $domain = getenv( 'HTTP_HOST' );
  76      $protocol = 'http';
  77  
  78      // Check if SSL port is defined in site.ini
  79      $ini =& eZINI::instance();
  80      $sslPort = 443;
  81      if ( $ini->hasVariable( 'SiteSettings', 'SSLPort' ) )
  82      {
  83          $sslPort = $ini->variable( 'SiteSettings', 'SSLPort' );
  84      }
  85  
  86      if ( eZSys::serverPort() == $sslPort )
  87      {
  88          $protocol = 'https';
  89      }
  90  
  91      $preFix = $protocol . "://" . $domain;
  92      $preFix .= eZSys::wwwDir();
  93  
  94      $link = preg_replace("/^\//e", "", $link );
  95      $link = $preFix . "/" . $link;
  96  }
  97  
  98  $viewParameters = array( 'offset' => $offset, 'limit'  => $limit );
  99  $http =& eZHttpTool::instance();
 100  $objectList =& eZURLObjectLink::fetchObjectVersionList( $urlID, $viewParameters );
 101  $urlViewCount= eZURLObjectLink::fetchObjectVersionCount( $urlID );
 102  
 103  if ( $Module->isCurrentAction( 'EditObject' ) )
 104  {
 105      if ( $http->hasPostVariable( 'ObjectList' ) )
 106      {
 107          $versionID = $http->postVariable( 'ObjectList' );
 108          $version = eZContentObjectVersion::fetch( $versionID );
 109          $contentObjectID = $version->attribute( 'contentobject_id' );
 110          $versionNr = $version->attribute( 'version' );
 111          $Module->redirect( 'content', 'edit', array( $contentObjectID, $versionNr ) );
 112      }
 113  }
 114  
 115  include_once ( 'kernel/common/template.php' );
 116  $tpl =& templateInit();
 117  
 118  $tpl->setVariable( 'Module', $Module );
 119  $tpl->setVariable( 'url_object', $url );
 120  $tpl->setVariable( 'full_url', $link );
 121  $tpl->setVariable( 'object_list', $objectList );
 122  $tpl->setVariable( 'view_parameters', $viewParameters );
 123  $tpl->setVariable( 'url_view_count', $urlViewCount );
 124  
 125  $Result = array();
 126  $Result['content'] = $tpl->fetch( 'design:url/view.tpl' );
 127  $Result['path'] = array( array( 'url' => false,
 128                                  'text' => ezi18n( 'kernel/url', 'URL' ) ),
 129                           array( 'url' => false,
 130                                  'text' => ezi18n( 'kernel/url', 'View' ) ) );
 131  
 132  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7