[BUGFIX] Add stdWrap for excludeUidList for HMENU.
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / publish.php
old mode 100755 (executable)
new mode 100644 (file)
index 2b864c8..d821384
@@ -1,22 +1,22 @@
 <?php
 /***************************************************************
 *  Copyright notice
-*  
-*  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
+*
+*  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
-*  This script is part of the TYPO3 project. The TYPO3 project is 
+*  This script is part of the TYPO3 project. The TYPO3 project is
 *  free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
-* 
+*
 *  The GNU General Public License can be found at
 *  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license 
+*  A copy is found in the textfile GPL.txt and important notices to the license
 *  from the author is found in LICENSE.txt distributed with these scripts.
 *
-* 
+*
 *  This script is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
-/** 
+/**
  * Publishing pages to static
  *
  * Is included from index_ts.php
  * $Id$
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage tslib
  */
 
 
  /*
+
  TODO:
+
 - Show publish-dir in interface
 - enabled checkboxes to select pages / frames
 - which-frames selecteble by TS
 - remove published files option
 - enable writing of images
 - Policy: HTML-files overridden always, mediafiles are only overwritten if mtime is different.
+
  */
+
+
+
 if (!is_object($TSFE)) {die('You cannot execute this file directly. It\'s meant to be included from index_ts.php');}
 
 
        // Storing the TSFE object
 $temp_publish_TSFE = $TSFE;
 $TT->push('Publishing','');
-$temp_publish_pages = explode(',',$BE_USER->extPublishList);
+$temp_publish_pages = explode(',', $BE_USER->adminPanel->getExtPublishList());
 $temp_publish_imagesTotal = array();
 $temp_publish_array = array(); // Collects the rendered pages.
 
-while(list(,$temp_publish_id)=each($temp_publish_pages))       {
+foreach ($temp_publish_pages as $temp_publish_id) {
        $TT->push('Page '.$temp_publish_id,'');
-//debug($temp_publish_id,1);
-               $temp_TSFEclassName=t3lib_div::makeInstanceClassName('tslib_fe');
-               $TSFE = new $temp_TSFEclassName($TYPO3_CONF_VARS,$temp_publish_id,0);
-       
+//debug($temp_publish_id);
+               $TSFE = t3lib_div::makeInstance('tslib_fe', $TYPO3_CONF_VARS, $temp_publish_id, 0);
+
                $TSFE->initFEuser();
                $TSFE->clear_preview();
                $TSFE->determineId();
                $TSFE->initTemplate();
                $TSFE->getFromCache();
-               
+
                $TSFE->getConfigArray();
                $TSFE->setUrlIdToken();
                if ($TSFE->isGeneratePage())    {
@@ -82,42 +81,22 @@ while(list(,$temp_publish_id)=each($temp_publish_pages))    {
                                if ($temp_theScript)    {
                                        include($temp_theScript);
                                } else {
-                                       require_once (PATH_tslib.'class.tslib_pagegen.php');            // Just formal, this is already included from index_ts.php
                                        include(PATH_tslib.'pagegen.php');
                                }
                                $TSFE->generatePage_postProcessing();
                } elseif ($TSFE->isINTincScript())      {
-                       require_once (PATH_tslib.'class.tslib_pagegen.php');    // Just formal, this is already included from index_ts.php
-                       include(PATH_tslib.'pagegen.php');      
+                       include(PATH_tslib.'pagegen.php');
                }
-       
+
                // ********************************
-               // $GLOBALS['TSFE']->config['INTincScript'] 
+               // $GLOBALS['TSFE']->config['INTincScript']
                // *******************************
                if ($TSFE->isINTincScript())            {
                        $TT->push('Internal PHP-scripts','');
-                               $INTiS_config = $GLOBALS['TSFE']->config['INTincScript'];
-                                       
-                                       // Special feature: Include libraries
-                               $TT->push('Include libraries');
-                               reset($INTiS_config);
-                               while(list(,$INTiS_cPart)=each($INTiS_config))  {
-                                       if ($INTiS_cPart['conf']['includeLibs'])        {
-                                               $INTiS_resourceList = t3lib_div::trimExplode(',',$INTiS_cPart['conf']['includeLibs'],1);
-                                               reset($INTiS_resourceList);
-                                               while(list(,$INTiS_theLib)=each($INTiS_resourceList))   {
-                                                       $INTiS_incFile=$GLOBALS['TSFE']->tmpl->getFileName($INTiS_theLib);
-                                                       if ($INTiS_incFile)     {
-                                                               include_once('./'.$INTiS_incFile);
-                                                       }
-                                               }
-                                       }
-                               }
-                               $TT->pull();
                                $TSFE->INTincScript();
                        $TT->pull();
-               }  
-               
+               }
+
                        // Get filename
                $temp_fileName = $TSFE->getSimulFileName();
 
@@ -140,13 +119,12 @@ while(list(,$temp_publish_id)=each($temp_publish_pages))  {
 // ***************************
 $publishDir = $TYPO3_CONF_VARS['FE']['publish_dir'];
 if ($publishDir && @is_dir($publishDir))       {
-       $publishDir = ereg_replace('/*$','',$publishDir).'/';
-       debug('Publishing in: '.$publishDir,1);
-       reset($temp_publish_array);
-       while(list($key,$val)=each($temp_publish_array))        {
+       $publishDir = rtrim($publishDir, '/').'/';
+       debug('Publishing in: '.$publishDir, 'Publish');
+       foreach ($temp_publish_array as $key => $val) {
                $file = $publishDir.$key;
                t3lib_div::writeFile($file,$val[2]);
-               debug('Writing: '.$file,1);
+               debug('Writing: '.$file, 'Publish');
        }
 //     debug($temp_publish_array);
 } else {