<?php include_once '../doc-typo3-funcs.php'; $doxygen_vars = array( "title" => "TYPO3 4.0.1: typo3_src-4.0.1/t3lib/class.t3lib_exec.php Source File", "datetime" => "Sat Dec 2 19:22:17 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?> <!-- Generated by Doxygen 1.4.6 --> <div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li id="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> <li> <form action="search.php" method="get"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td><label> <u>S</u>earch for </label></td> <td><input type="text" name="query" value="" size="20" accesskey="s"/></td> </tr> </table> </form> </li> </ul></div> <div class="nav"> <a class="el" href="dir_c8daf1ad746050abf985cc546c89e248.html">typo3_src-4.0.1</a> » <a class="el" href="dir_9d0e5c424a38b69aeeedc616a9634e5f.html">t3lib</a></div> <h1>class.t3lib_exec.php</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <?php <a name="l00002"></a>00002 <span class="comment">/***************************************************************</span> <a name="l00003"></a>00003 <span class="comment">* Copyright notice</span> <a name="l00004"></a>00004 <span class="comment">*</span> <a name="l00005"></a>00005 <span class="comment">* (c) 2002-2006 RenĂ© Fritz (r.fritz@colorcube.de)</span> <a name="l00006"></a>00006 <span class="comment">* All rights reserved</span> <a name="l00007"></a>00007 <span class="comment">*</span> <a name="l00008"></a>00008 <span class="comment">* This script is part of the Typo3 project. The Typo3 project is</span> <a name="l00009"></a>00009 <span class="comment">* free software; you can redistribute it and/or modify</span> <a name="l00010"></a>00010 <span class="comment">* it under the terms of the GNU General Public License as published by</span> <a name="l00011"></a>00011 <span class="comment">* the Free Software Foundation; either version 2 of the License, or</span> <a name="l00012"></a>00012 <span class="comment">* (at your option) any later version.</span> <a name="l00013"></a>00013 <span class="comment">*</span> <a name="l00014"></a>00014 <span class="comment">* The GNU General Public License can be found at</span> <a name="l00015"></a>00015 <span class="comment">* http://www.gnu.org/copyleft/gpl.html.</span> <a name="l00016"></a>00016 <span class="comment">*</span> <a name="l00017"></a>00017 <span class="comment">* This script is distributed in the hope that it will be useful,</span> <a name="l00018"></a>00018 <span class="comment">* but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00019"></a>00019 <span class="comment">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00020"></a>00020 <span class="comment">* GNU General Public License for more details.</span> <a name="l00021"></a>00021 <span class="comment">*</span> <a name="l00022"></a>00022 <span class="comment">* This copyright notice MUST APPEAR in all copies of the script!</span> <a name="l00023"></a>00023 <span class="comment">***************************************************************/</span> <a name="l00085"></a><a class="code" href="classt3lib__exec.html">00085</a> <span class="keyword">class </span><a class="code" href="classt3lib__exec.html">t3lib_exec</a> { <a name="l00086"></a>00086 <a name="l00095"></a><a class="code" href="classt3lib__exec.html#473c0ccab889c416ca5ba8f96a0c021d">00095</a> function <a class="code" href="classt3lib__exec.html#473c0ccab889c416ca5ba8f96a0c021d">checkCommand</a>($cmd, $handler='') { <a name="l00096"></a>00096 global $T3_VAR; <a name="l00097"></a>00097 <a name="l00098"></a>00098 <span class="keywordflow">if</span> (!<a class="code" href="classt3lib__exec.html#30915d7411da4a350809152ac7a21ee3">t3lib_exec::_init</a>()) { <a name="l00099"></a>00099 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00100"></a>00100 } <a name="l00101"></a>00101 <a name="l00102"></a>00102 <a name="l00103"></a>00103 <span class="keywordflow">if</span> ($handler && !<a class="code" href="classt3lib__exec.html#473c0ccab889c416ca5ba8f96a0c021d">t3lib_exec::checkCommand</a>($handler)) { <a name="l00104"></a>00104 <span class="keywordflow">return</span> -1; <a name="l00105"></a>00105 } <a name="l00106"></a>00106 <span class="comment">// already checked and valid</span> <a name="l00107"></a>00107 <span class="keywordflow">if</span> ($T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['valid']) { <a name="l00108"></a>00108 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00109"></a>00109 } <a name="l00110"></a>00110 <span class="comment">// is set but was (above) not true</span> <a name="l00111"></a>00111 <span class="keywordflow">if</span> (isset($T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['valid'])) { <a name="l00112"></a>00112 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00113"></a>00113 } <a name="l00114"></a>00114 <a name="l00115"></a>00115 foreach($T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['paths'] as $path => $validPath) { <a name="l00116"></a>00116 <span class="comment">// ignore invalid (false) paths</span> <a name="l00117"></a>00117 <span class="keywordflow">if</span> ($validPath) { <a name="l00118"></a>00118 <span class="keywordflow">if</span> (TYPO3_OS=='WIN') { <a name="l00119"></a>00119 <span class="keywordflow">if</span> (@is_file($path.$cmd)) { <a name="l00120"></a>00120 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['app'] = $cmd; <a name="l00121"></a>00121 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['path'] = $path; <a name="l00122"></a>00122 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['valid'] = <span class="keyword">true</span>; <a name="l00123"></a>00123 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00124"></a>00124 } <a name="l00125"></a>00125 <span class="keywordflow">if</span> (@is_file($path.$cmd.'.exe')) { <a name="l00126"></a>00126 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['app'] = $cmd.'.exe'; <a name="l00127"></a>00127 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['path'] = $path; <a name="l00128"></a>00128 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['valid'] = <span class="keyword">true</span>; <a name="l00129"></a>00129 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00130"></a>00130 } <a name="l00131"></a>00131 } <span class="keywordflow">else</span> { <span class="comment">// UNIX</span> <a name="l00132"></a>00132 <span class="keywordflow">if</span> (@is_executable($path.$cmd)) { <a name="l00133"></a>00133 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['app'] = $cmd; <a name="l00134"></a>00134 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['path'] = $path; <a name="l00135"></a>00135 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['valid'] = <span class="keyword">true</span>; <a name="l00136"></a>00136 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00137"></a>00137 } <a name="l00138"></a>00138 } <a name="l00139"></a>00139 } <a name="l00140"></a>00140 } <a name="l00141"></a>00141 <a name="l00142"></a>00142 <span class="comment">// try to get the executable with the command 'which'. It do the same like already done, but maybe on other paths??</span> <a name="l00143"></a>00143 <span class="keywordflow">if</span> (TYPO3_OS!='WIN') { <a name="l00144"></a>00144 $cmd = @exec ('which '.$cmd); <a name="l00145"></a>00145 <a name="l00146"></a>00146 <span class="keywordflow">if</span> (@is_executable($cmd)) { <a name="l00147"></a>00147 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['app'] = $cmd; <a name="l00148"></a>00148 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['path'] = dirname($cmd).<span class="charliteral">'/'</span>; <a name="l00149"></a>00149 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['valid'] = <span class="keyword">true</span>; <a name="l00150"></a>00150 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00151"></a>00151 } <a name="l00152"></a>00152 } <a name="l00153"></a>00153 <a name="l00154"></a>00154 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00155"></a>00155 } <a name="l00156"></a>00156 <a name="l00157"></a>00157 <a name="l00166"></a><a class="code" href="classt3lib__exec.html#42608e9b288525d8588f95e4d0758b1b">00166</a> function <a class="code" href="classt3lib__exec.html#42608e9b288525d8588f95e4d0758b1b">getCommand</a>($cmd, $handler='', $handlerOpt='') { <a name="l00167"></a>00167 global $T3_VAR; <a name="l00168"></a>00168 <a name="l00169"></a>00169 <span class="keywordflow">if</span> (!<a class="code" href="classt3lib__exec.html#30915d7411da4a350809152ac7a21ee3">t3lib_exec::_init</a>()) { <a name="l00170"></a>00170 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00171"></a>00171 } <a name="l00172"></a>00172 <a name="l00173"></a>00173 <span class="comment">// handler</span> <a name="l00174"></a>00174 <span class="keywordflow">if</span> ($handler) { <a name="l00175"></a>00175 $handler = <a class="code" href="classt3lib__exec.html#42608e9b288525d8588f95e4d0758b1b">t3lib_exec::getCommand</a>($handler); <a name="l00176"></a>00176 <a name="l00177"></a>00177 <span class="keywordflow">if</span> (!$handler) { <a name="l00178"></a>00178 <span class="keywordflow">return</span> -1; <a name="l00179"></a>00179 } <a name="l00180"></a>00180 $handler .= <span class="charliteral">' '</span>.$handlerOpt.<span class="charliteral">' '</span>; <a name="l00181"></a>00181 } <a name="l00182"></a>00182 <a name="l00183"></a>00183 <span class="comment">// command</span> <a name="l00184"></a>00184 <span class="keywordflow">if</span> (!<a class="code" href="classt3lib__exec.html#473c0ccab889c416ca5ba8f96a0c021d">t3lib_exec::checkCommand</a>($cmd)) { <a name="l00185"></a>00185 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00186"></a>00186 } <a name="l00187"></a>00187 $cmd = $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['path'].$T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'][$cmd]['app'].<span class="charliteral">' '</span>; <a name="l00188"></a>00188 <a name="l00189"></a>00189 <span class="keywordflow">return</span> trim($handler.$cmd); <a name="l00190"></a>00190 } <a name="l00191"></a>00191 <a name="l00192"></a>00192 <a name="l00199"></a><a class="code" href="classt3lib__exec.html#b464818c19cd117ad87165efa6f9033a">00199</a> function <a class="code" href="classt3lib__exec.html#b464818c19cd117ad87165efa6f9033a">addPaths</a>($paths) { <a name="l00200"></a>00200 <a class="code" href="classt3lib__exec.html#d7eb6b778b868d5e2c987b4f02fa1033">t3lib_exec::_initPaths</a>($paths); <a name="l00201"></a>00201 } <a name="l00202"></a>00202 <a name="l00203"></a>00203 <a name="l00204"></a>00204 <a name="l00211"></a><a class="code" href="classt3lib__exec.html#7a99f841bab1fc9dc52028c6a4a89e89">00211</a> function <a class="code" href="classt3lib__exec.html#7a99f841bab1fc9dc52028c6a4a89e89">getPaths</a>($addInvalid=<span class="keyword">false</span>) { <a name="l00212"></a>00212 global $T3_VAR; <a name="l00213"></a>00213 <a name="l00214"></a>00214 <span class="keywordflow">if</span> (!<a class="code" href="classt3lib__exec.html#30915d7411da4a350809152ac7a21ee3">t3lib_exec::_init</a>()) { <a name="l00215"></a>00215 <span class="keywordflow">return</span> array(); <a name="l00216"></a>00216 } <a name="l00217"></a>00217 <a name="l00218"></a>00218 $paths = $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['paths']; <a name="l00219"></a>00219 <span class="keywordflow">if</span>(!$addInvalid) { <a name="l00220"></a>00220 <a name="l00221"></a>00221 foreach($paths as $path => $validPath) { <a name="l00222"></a>00222 <span class="keywordflow">if</span>(!$validPath) { <a name="l00223"></a>00223 unset($paths); <a name="l00224"></a>00224 } <a name="l00225"></a>00225 } <a name="l00226"></a>00226 } <a name="l00227"></a>00227 <span class="keywordflow">return</span> $paths; <a name="l00228"></a>00228 } <a name="l00229"></a>00229 <a name="l00230"></a>00230 <a name="l00237"></a><a class="code" href="classt3lib__exec.html#30915d7411da4a350809152ac7a21ee3">00237</a> function <a class="code" href="classt3lib__exec.html#30915d7411da4a350809152ac7a21ee3">_init</a>() { <a name="l00238"></a>00238 global $T3_VAR, $TYPO3_CONF_VARS; <a name="l00239"></a>00239 <a name="l00240"></a>00240 <span class="keywordflow">if</span> ($TYPO3_CONF_VARS['BE']['disable_exec_function']) { <a name="l00241"></a>00241 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00242"></a>00242 } <a name="l00243"></a>00243 <span class="keywordflow">if</span> (!$T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['init']) { <a name="l00244"></a>00244 <a class="code" href="classt3lib__exec.html#d7eb6b778b868d5e2c987b4f02fa1033">t3lib_exec::_initPaths</a>(); <a name="l00245"></a>00245 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['apps'] = <a class="code" href="classt3lib__exec.html#fb71c1afbc43219bc76dbbb7748a7349">t3lib_exec::_getConfiguredApps</a>();; <a name="l00246"></a>00246 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['init'] = <span class="keyword">true</span>; <a name="l00247"></a>00247 } <a name="l00248"></a>00248 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00249"></a>00249 } <a name="l00250"></a>00250 <a name="l00251"></a>00251 <a name="l00259"></a><a class="code" href="classt3lib__exec.html#d7eb6b778b868d5e2c987b4f02fa1033">00259</a> function <a class="code" href="classt3lib__exec.html#d7eb6b778b868d5e2c987b4f02fa1033">_initPaths</a>($paths='') { <a name="l00260"></a>00260 global $T3_VAR; <a name="l00261"></a>00261 <a name="l00262"></a>00262 $doCeck=<span class="keyword">false</span>; <a name="l00263"></a>00263 <a name="l00264"></a>00264 <span class="comment">// init global paths array if not already done</span> <a name="l00265"></a>00265 <span class="keywordflow">if</span> (!is_array($T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['paths'])) { <a name="l00266"></a>00266 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['paths'] = <a class="code" href="classt3lib__exec.html#b950defbfc5e76db43a3deeb61938f31">t3lib_exec::_getPaths</a>(); <a name="l00267"></a>00267 $doCeck=<span class="keyword">true</span>; <a name="l00268"></a>00268 } <a name="l00269"></a>00269 <span class="comment">// merge the submitted paths array to the global</span> <a name="l00270"></a>00270 <span class="keywordflow">if</span> ($paths) { <a name="l00271"></a>00271 $paths = <a class="code" href="classt3lib__div.html#cfb87d585b85e9b32841bde40beaa96c">t3lib_div::trimExplode</a>(<span class="charliteral">','</span>,$paths,1); <a name="l00272"></a>00272 <span class="keywordflow">if</span> (is_array($paths)) { <a name="l00273"></a>00273 foreach($paths as $path) { <a name="l00274"></a>00274 <span class="comment">// make absolute path of relative</span> <a name="l00275"></a>00275 <span class="keywordflow">if</span> (!preg_match('#^/#',$path)) { <a name="l00276"></a>00276 $path = PATH_site.$path; <a name="l00277"></a>00277 } <a name="l00278"></a>00278 <span class="keywordflow">if</span> (!isset($T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['paths'][$path])) { <a name="l00279"></a>00279 <span class="keywordflow">if</span> (@is_dir($path)) { <a name="l00280"></a>00280 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['paths'][$path] = $path; <a name="l00281"></a>00281 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['allPaths'].=<span class="charliteral">','</span>.$path; <a name="l00282"></a>00282 <span class="comment">// $doCeck=true; just done</span> <a name="l00283"></a>00283 } <span class="keywordflow">else</span> { <a name="l00284"></a>00284 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['paths'][$path] = <span class="keyword">false</span>; <a name="l00285"></a>00285 } <a name="l00286"></a>00286 } <a name="l00287"></a>00287 } <a name="l00288"></a>00288 } <a name="l00289"></a>00289 } <a name="l00290"></a>00290 <span class="comment">// check if new paths are invalid</span> <a name="l00291"></a>00291 <span class="keywordflow">if</span> ($doCeck) { <a name="l00292"></a>00292 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['allPaths']=''; <a name="l00293"></a>00293 foreach($T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['paths'] as $path => $valid) { <a name="l00294"></a>00294 <span class="comment">// ignore invalid (false) paths</span> <a name="l00295"></a>00295 <span class="keywordflow">if</span> ($valid AND !@is_dir($path)) { <a name="l00296"></a>00296 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['paths'][$path] = <span class="keyword">false</span>; <a name="l00297"></a>00297 } <a name="l00298"></a>00298 <span class="keywordflow">if</span> ($path = $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['paths'][$path]) { <a name="l00299"></a>00299 $T3_VAR['<a class="code" href="classt3lib__exec.html">t3lib_exec</a>']['allPaths'].=<span class="charliteral">','</span>.$path; <a name="l00300"></a>00300 } <a name="l00301"></a>00301 } <a name="l00302"></a>00302 } <a name="l00303"></a>00303 } <a name="l00304"></a>00304 <a name="l00305"></a>00305 <a name="l00312"></a><a class="code" href="classt3lib__exec.html#fb71c1afbc43219bc76dbbb7748a7349">00312</a> function <a class="code" href="classt3lib__exec.html#fb71c1afbc43219bc76dbbb7748a7349">_getConfiguredApps</a>() { <a name="l00313"></a>00313 global $TYPO3_CONF_VARS; <a name="l00314"></a>00314 <a name="l00315"></a>00315 $cmdArr = array(); <a name="l00316"></a>00316 <a name="l00317"></a>00317 <span class="keywordflow">if</span> ($TYPO3_CONF_VARS['SYS']['binSetup']) { <a name="l00318"></a>00318 $pathSetup = implode(<span class="stringliteral">"\n"</span>, <a class="code" href="classt3lib__div.html#cfb87d585b85e9b32841bde40beaa96c">t3lib_div::trimExplode</a>(<span class="charliteral">','</span>,$TYPO3_CONF_VARS['SYS']['binSetup'],1)); <a name="l00319"></a>00319 $pathSetup = <a class="code" href="classt3lib__div.html#cfb87d585b85e9b32841bde40beaa96c">t3lib_div::trimExplode</a>(<span class="stringliteral">"\n"</span>,$pathSetup,1); <a name="l00320"></a>00320 foreach($pathSetup as $val) { <a name="l00321"></a>00321 list($cmd, $cmdPath) = <a class="code" href="classt3lib__div.html#cfb87d585b85e9b32841bde40beaa96c">t3lib_div::trimExplode</a>(<span class="charliteral">'='</span>,$val,1); <a name="l00322"></a>00322 <a name="l00323"></a>00323 $cmdArr[$cmd]['app'] = basename($cmdPath); <a name="l00324"></a>00324 $cmdArr[$cmd]['path'] = dirname($cmdPath).<span class="charliteral">'/'</span>; <a name="l00325"></a>00325 $cmdArr[$cmd]['valid'] = <span class="keyword">true</span>; <a name="l00326"></a>00326 } <a name="l00327"></a>00327 } <a name="l00328"></a>00328 <a name="l00329"></a>00329 <span class="keywordflow">return</span> $cmdArr; <a name="l00330"></a>00330 } <a name="l00331"></a>00331 <a name="l00332"></a>00332 <a name="l00339"></a><a class="code" href="classt3lib__exec.html#b950defbfc5e76db43a3deeb61938f31">00339</a> function <a class="code" href="classt3lib__exec.html#b950defbfc5e76db43a3deeb61938f31">_getPaths</a>() { <a name="l00340"></a>00340 global $T3_VAR, $TYPO3_CONF_VARS; <a name="l00341"></a>00341 <a name="l00342"></a>00342 $pathsArr = array(); <a name="l00343"></a>00343 $sysPathArr = array(); <a name="l00344"></a>00344 <a name="l00345"></a>00345 <span class="comment">// image magick paths first</span> <a name="l00346"></a>00346 <span class="comment">// im_path_lzw take precedence over im_path</span> <a name="l00347"></a>00347 <span class="keywordflow">if</span> ($imPath = ($TYPO3_CONF_VARS['GFX']['im_path_lzw'] ? $TYPO3_CONF_VARS['GFX']['im_path_lzw'] : $TYPO3_CONF_VARS['GFX']['im_path'])) { <a name="l00348"></a>00348 $imPath = <a class="code" href="classt3lib__exec.html#176739bbc5a0d69b1809c09461d177e5">t3lib_exec::_fixPath</a>($imPath); <a name="l00349"></a>00349 $pathsArr[$imPath] = $imPath; <a name="l00350"></a>00350 } <a name="l00351"></a>00351 <a name="l00352"></a>00352 <span class="comment">// add configured paths</span> <a name="l00353"></a>00353 <span class="keywordflow">if</span> ($TYPO3_CONF_VARS['SYS']['binPath']) { <a name="l00354"></a>00354 $sysPath = <a class="code" href="classt3lib__div.html#cfb87d585b85e9b32841bde40beaa96c">t3lib_div::trimExplode</a>(<span class="charliteral">','</span>,$TYPO3_CONF_VARS['SYS']['binPath'],1); <a name="l00355"></a>00355 foreach($sysPath as $val) { <a name="l00356"></a>00356 $val = <a class="code" href="classt3lib__exec.html#176739bbc5a0d69b1809c09461d177e5">t3lib_exec::_fixPath</a>($val); <a name="l00357"></a>00357 $sysPathArr[$val]=$val; <a name="l00358"></a>00358 } <a name="l00359"></a>00359 } <a name="l00360"></a>00360 <a name="l00361"></a>00361 <a name="l00362"></a>00362 <span class="comment">// add path from environment</span> <a name="l00363"></a>00363 <span class="comment">// TODO: how does this work for WIN</span> <a name="l00364"></a>00364 <span class="keywordflow">if</span> ($GLOBALS['_SERVER']['PATH']) { <a name="l00365"></a>00365 $sep = (TYPO3_OS=='WIN') ? <span class="charliteral">';'</span> : <span class="charliteral">':'</span>; <a name="l00366"></a>00366 $envPath = <a class="code" href="classt3lib__div.html#cfb87d585b85e9b32841bde40beaa96c">t3lib_div::trimExplode</a>($sep,$GLOBALS['_SERVER']['PATH'],1); <a name="l00367"></a>00367 foreach($envPath as $val) { <a name="l00368"></a>00368 $val = <a class="code" href="classt3lib__exec.html#176739bbc5a0d69b1809c09461d177e5">t3lib_exec::_fixPath</a>($val); <a name="l00369"></a>00369 $sysPathArr[$val]=$val; <a name="l00370"></a>00370 } <a name="l00371"></a>00371 } <a name="l00372"></a>00372 <a name="l00373"></a>00373 <span class="keywordflow">if</span> (TYPO3_OS=='WIN') { <a name="l00374"></a>00374 <span class="comment">// TODO: add the most common paths for WIN</span> <a name="l00375"></a>00375 $sysPathArr = array_merge($sysPathArr, array ( <a name="l00376"></a>00376 '/usr/bin/' => '/usr/bin/', <a name="l00377"></a>00377 '/perl/bin/' => '/perl/bin/', <a name="l00378"></a>00378 )); <a name="l00379"></a>00379 } <span class="keywordflow">else</span> { <span class="comment">// UNIX</span> <a name="l00380"></a>00380 $sysPathArr = array_merge($sysPathArr, array ( <a name="l00381"></a>00381 '/usr/bin/' => '/usr/bin/', <a name="l00382"></a>00382 '/usr/local/bin/' => '/usr/local/bin/', <a name="l00383"></a>00383 )); <a name="l00384"></a>00384 } <a name="l00385"></a>00385 <a name="l00386"></a>00386 <a name="l00387"></a>00387 $pathsArr = array_merge($pathsArr, $sysPathArr); <a name="l00388"></a>00388 <a name="l00389"></a>00389 <span class="keywordflow">return</span> $pathsArr; <a name="l00390"></a>00390 } <a name="l00391"></a>00391 <a name="l00392"></a>00392 <a name="l00400"></a><a class="code" href="classt3lib__exec.html#176739bbc5a0d69b1809c09461d177e5">00400</a> function <a class="code" href="classt3lib__exec.html#176739bbc5a0d69b1809c09461d177e5">_fixPath</a>($path) { <a name="l00401"></a>00401 <span class="keywordflow">return</span> str_replace ('<span class="comment">//','/',$path.'/');</span> <a name="l00402"></a>00402 } <a name="l00403"></a>00403 } <a name="l00404"></a>00404 <a name="l00405"></a>00405 <span class="keywordflow">if</span> (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/<span class="keyword">class</span>.<a class="code" href="classt3lib__exec.html">t3lib_exec</a>.php']) { <a name="l00406"></a>00406 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/<span class="keyword">class</span>.<a class="code" href="classt3lib__exec.html">t3lib_exec</a>.php']); <a name="l00407"></a>00407 } <a name="l00408"></a>00408 ?> </pre></div><?php include_once '../doc-typo3-funcs.php'; get_footer(); ?>