|
eZ Publish
[4.0]
|
00001 <?php 00002 // 00003 // Definition of eZSiteAccess class 00004 // 00005 // Created on: <22-���-2003 16:23:14 sp> 00006 // 00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00008 // SOFTWARE NAME: eZ Publish 00009 // SOFTWARE RELEASE: 4.0.x 00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS 00011 // SOFTWARE LICENSE: GNU General Public License v2.0 00012 // NOTICE: > 00013 // This program is free software; you can redistribute it and/or 00014 // modify it under the terms of version 2.0 of the GNU General 00015 // Public License as published by the Free Software Foundation. 00016 // 00017 // This program is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU General Public License for more details. 00021 // 00022 // You should have received a copy of version 2.0 of the GNU General 00023 // Public License along with this program; if not, write to the Free 00024 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00025 // MA 02110-1301, USA. 00026 // 00027 // 00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00029 // 00030 00031 /*! \file ezsiteaccess.php 00032 */ 00033 00034 /*! 00035 \class eZSiteAccess ezsiteaccess.php 00036 \brief The class eZSiteAccess does 00037 00038 */ 00039 00040 //include_once( 'lib/ezutils/classes/ezsys.php' ); 00041 00042 class eZSiteAccess 00043 { 00044 /*! 00045 Constructor 00046 */ 00047 function eZSiteAccess() 00048 { 00049 } 00050 00051 static function siteAccessList() 00052 { 00053 //include_once( 'lib/ezutils/classes/ezsys.php' ); 00054 $siteAccessList = array(); 00055 $ini = eZINI::instance(); 00056 $availableSiteAccessList = $ini->variable( 'SiteAccessSettings', 'AvailableSiteAccessList' ); 00057 if ( !is_array( $availableSiteAccessList ) ) 00058 $availableSiteAccessList = array(); 00059 00060 $serverSiteAccess = eZSys::serverVariable( $ini->variable( 'SiteAccessSettings', 'ServerVariableName' ), true ); 00061 if ( $serverSiteAccess ) 00062 $availableSiteAccessList[] = $serverSiteAccess; 00063 00064 $availableSiteAccessList = array_unique( $availableSiteAccessList ); 00065 foreach ( $availableSiteAccessList as $siteAccessName ) 00066 { 00067 $siteAccessItem = array(); 00068 $siteAccessItem['name'] = $siteAccessName; 00069 $siteAccessItem['id'] = eZSys::ezcrc32( $siteAccessName ); 00070 $siteAccessList[] = $siteAccessItem; 00071 } 00072 return $siteAccessList; 00073 } 00074 00075 /*! 00076 Returns path to \a $siteAccess site access 00077 */ 00078 static function findPathToSiteAccess( $siteAccess ) 00079 { 00080 //include_once( 'lib/ezutils/classes/ezini.php' ); 00081 $ini = eZINI::instance(); 00082 $siteAccessList = $ini->variable( 'SiteAccessSettings', 'AvailableSiteAccessList' ); 00083 if ( !in_array( $siteAccess, $siteAccessList ) ) 00084 return false; 00085 00086 $currentPath = 'settings/siteaccess/' . $siteAccess; 00087 if ( file_exists( $currentPath ) ) 00088 return $currentPath; 00089 00090 //include_once( 'lib/ezutils/classes/ezextension.php' ); 00091 $activeExtensions = eZExtension::activeExtensions(); 00092 $baseDir = eZExtension::baseDirectory(); 00093 foreach ( $activeExtensions as $extension ) 00094 { 00095 $currentPath = $baseDir . '/' . $extension . '/settings/siteaccess/' . $siteAccess; 00096 if ( file_exists( $currentPath ) ) 00097 return $currentPath; 00098 } 00099 00100 return 'settings/siteaccess/' . $siteAccess; 00101 } 00102 00103 } 00104 00105 ?>