| [ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Created on: <17-Jan-2004 12:41:17 oh> 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 include_once ( "lib/ezutils/classes/ezhttptool.php" ); 27 include_once ( "kernel/classes/datatypes/ezuser/ezuser.php" ); 28 include_once ( "kernel/common/template.php" ); 29 30 $tpl =& templateInit(); 31 $http =& eZHTTPTool::instance(); 32 $ini =& eZINI::instance(); 33 $siteAccessList = $ini->variable( 'SiteAccessSettings', 'AvailableSiteAccessList' ); 34 35 if ( $Params['INIFile'] ) 36 $settingFile = $Params['INIFile']; 37 38 if ( $http->hasPostVariable( 'selectedINIFile' ) ) 39 $settingFile = $http->variable( "selectedINIFile" ); 40 41 if ( $Params['SiteAccess'] ) 42 $currentSiteAccess = $Params['SiteAccess']; 43 44 if ( $http->hasPostVariable( 'CurrentSiteAccess' ) ) 45 $currentSiteAccess = $http->postVariable( 'CurrentSiteAccess' ); 46 47 if ( !isset( $currentSiteAccess ) ) 48 $currentSiteAccess = $siteAccessList[0]; 49 50 unset( $ini ); 51 52 if ( $http->hasPostVariable( 'RemoveButton' ) ) 53 { 54 if ( isset( $settingFile ) ) 55 { 56 $ini = eZINI::instance( $settingFile, 'settings', null, null, false ); 57 $ini->prependOverrideDir( "siteaccess/$currentSiteAccess", false, 'siteaccess' ); 58 $ini->loadCache(); 59 } 60 61 $placements = $ini->groupPlacements(); 62 if ( $http->hasPostVariable( 'RemoveSettingsArray' ) ) 63 { 64 $deletedSettingArray = $http->postVariable( 'RemoveSettingsArray' ); 65 foreach ( $deletedSettingArray as $deletedSetting ) 66 { 67 list( $block, $setting ) = split( ':', $deletedSetting ); 68 69 if ( is_array( $placements[$block][$setting] ) ) 70 { 71 foreach ( $placements[$block][$setting] as $settingElementKey=>$key ) 72 { 73 $placement = $ini->findSettingPlacement( $placements[$block][$setting][$settingElementKey] ); 74 break; 75 } 76 } 77 else 78 { 79 $placement = $ini->findSettingPlacement( $placements[$block][$setting] ); 80 } 81 // Get extension name if exists, $placement might be "extension:ezdhtml" 82 $exploded = explode( ':', $placement ); 83 $extension = $exploded[0] == 'extension' 84 ? $exploded[1] 85 : false; 86 87 $path = 'settings/override'; 88 if ( $placement == 'siteaccess' ) 89 $path = "settings/siteaccess/$currentSiteAccess"; 90 elseif ( $placement != 'override' and $extension !== false ) 91 $path = "extension/$extension/settings"; 92 93 // We should use "reference" if multiply removing of ini setting. 94 // if eZINI::instance() is called twice instance will be fetched from GLOBAL variable. 95 // Without reference there will be a inconsistency with GLOBAL instance and stored ini file. 96 $iniTemp =& eZINI::instance( $settingFile . '.append.php', $path, null, null, null, true ); 97 $iniTemp->removeSetting( $block, $setting ); 98 $iniTemp->save(); 99 unset( $iniTemp ); 100 } 101 } 102 } 103 104 105 if ( $http->hasPostVariable( 'ChangeINIFile' ) or 106 ( $Params['SiteAccess'] and $Params['INIFile'] ) ) 107 { 108 $ini = eZINI::instance( $settingFile, 'settings', null, null, false ); 109 $ini->prependOverrideDir( "siteaccess/$currentSiteAccess", false, 'siteaccess' ); 110 $ini->loadCache(); 111 112 $blocks = $ini->groups(); 113 $placements = $ini->groupPlacements(); 114 $settings = array(); 115 $blockCount = 0; 116 $totalSettingCount = 0; 117 118 foreach( $blocks as $block=>$key ) 119 { 120 $settingsCount = 0; 121 $blockRemoveable = false; 122 $blockEditable = true; 123 foreach( $key as $setting=>$settingKey ) 124 { 125 $hasSetPlacement = false; 126 $type = $ini->settingType( $settingKey ); 127 $removeable = false; 128 129 switch ( $type ) 130 { 131 case 'array': 132 if ( count( $settingKey ) == 0 ) 133 $settings[$block]['content'][$setting]['content'] = array(); 134 135 foreach( $settingKey as $settingElementKey=>$settingElementValue ) 136 { 137 $settingPlacement = $ini->findSettingPlacement( $placements[$block][$setting][$settingElementKey] ); 138 if ( $settingElementValue != null ) 139 { 140 // Make a space after the ';' to make it possible for 141 // the browser to break long lines 142 $settings[$block]['content'][$setting]['content'][$settingElementKey]['content'] = str_replace( ';', "; ", $settingElementValue ); 143 } 144 else 145 { 146 $settings[$block]['content'][$setting]['content'][$settingElementKey]['content'] = ""; 147 } 148 $settings[$block]['content'][$setting]['content'][$settingElementKey]['placement'] = $settingPlacement; 149 $hasSetPlacement = true; 150 if ( $settingPlacement != 'default' ) 151 { 152 $removeable = true; 153 $blockRemoveable = true; 154 } 155 } 156 break; 157 case 'string': 158 if( strpos( $settingKey, ';' ) ) 159 { 160 // Make a space after the ';' to make it possible for 161 // the browser to break long lines 162 $settingArray = str_replace( ';', "; ", $settingKey ); 163 $settings[$block]['content'][$setting]['content'] = $settingArray; 164 } 165 else 166 { 167 $settings[$block]['content'][$setting]['content'] = $settingKey; 168 } 169 break; 170 default: 171 $settings[$block]['content'][$setting]['content'] = $settingKey; 172 } 173 $settings[$block]['content'][$setting]['type'] = $type; 174 $settings[$block]['content'][$setting]['placement'] = ""; 175 176 if ( !$hasSetPlacement ) 177 { 178 $placement = $ini->findSettingPlacement( $placements[$block][$setting] ); 179 $settings[$block]['content'][$setting]['placement'] = $placement; 180 if ( $placement != 'default' ) 181 { 182 $removeable = true; 183 $blockRemoveable = true; 184 } 185 } 186 $editable = $ini->isSettingReadOnly( $settingFile, $block, $setting ); 187 $removeable = $editable === false ? false : $removeable; 188 $settings[$block]['content'][$setting]['editable'] = $editable; 189 $settings[$block]['content'][$setting]['removeable'] = $removeable; 190 ++$settingsCount; 191 } 192 $blockEditable = $ini->isSettingReadOnly( $settingFile, $block ); 193 $settings[$block]['count'] = $settingsCount; 194 $settings[$block]['removeable'] = $blockRemoveable; 195 $settings[$block]['editable'] = $blockEditable; 196 $totalSettingCount += $settingsCount; 197 ++$blockCount; 198 } 199 ksort( $settings ); 200 $tpl->setVariable( 'settings', $settings ); 201 $tpl->setVariable( 'block_count', $blockCount ); 202 $tpl->setVariable( 'setting_count', $totalSettingCount ); 203 $tpl->setVariable( 'ini_file', $settingFile ); 204 } 205 else 206 { 207 $tpl->setVariable( 'settings', false ); 208 $tpl->setVariable( 'block_count', false ); 209 $tpl->setVariable( 'setting_count', false ); 210 $tpl->setVariable( 'ini_file', false ); 211 } 212 213 $rootDir = 'settings'; 214 215 $iniFiles = eZDir::recursiveFindRelative( $rootDir, '', '.ini' ); 216 $iniFiles = str_replace('/', '', $iniFiles ); 217 sort( $iniFiles ); 218 219 $tpl->setVariable( 'ini_files', $iniFiles ); 220 $tpl->setVariable( 'siteaccess_list', $siteAccessList ); 221 $tpl->setVariable( 'current_siteaccess', $currentSiteAccess ); 222 223 $Result = array(); 224 $Result['content'] =& $tpl->fetch( 'design:settings/view.tpl' ); 225 $Result['path'] = array( array( 'text' => ezi18n( 'settings/view', 'Settings' ), 226 'url' => false ), 227 array( 'text' => ezi18n( 'settings/view', 'View' ), 228 'url' => false ) ); 229 230 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |