Re: [SMARTY] Problems with using smarty on my hosting

From: Date: Tue, 13 Aug 2002 12:56:11 +0000
Subject: Re: [SMARTY] Problems with using smarty on my hosting
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5664@lists.php.net to get a copy of this message
Hi Peter, Once i got the same error that you get, but then someone sent me a patch which will fix that problem. You only have to extend the Smarty class with this class: /** * This class extends the smarty template engine. * All configuration and returning of smarty objects * is done by this class * * @author lukas pitschl <l.pitschl@peer.biz> * @copyright peer internet solutions * @package base * @version $Id: ecSmarty.class.php,v 1.2 2002/08/07 15:02:17 lukas Exp $ */ class PatchedSmarty extends Smarty { /*======================================================================*\ Function: _get_auto_base Purpose: Get a base name for automatic files creation \*======================================================================*/ function _get_auto_base($auto_base, $auto_source) { $source_md5 = md5($auto_source); $res = $auto_base . DIR_SEP . $source_md5; return $res; } /*======================================================================*\ Function: _get_auto_filename Purpose: get a concrete filename for automagically created content \*======================================================================*/ function _get_auto_filename($auto_base, $auto_source, $auto_id = null) { $res = $this->_get_auto_base($auto_base, $auto_source) . '-' . md5($auto_id) . '.php'; return $res; } /*======================================================================*\ Function: _rm_auto Purpose: delete an automagically created file by name and id \*======================================================================*/ function _rm_auto($auto_base, $auto_source = null, $auto_id = null) { if (!is_dir($auto_base)) return false; if (!isset($auto_source)) { $res = $this->_rmdir($auto_base, 0); } else { if (isset($auto_id)) { $tname = $this->_get_auto_filename($auto_base, $auto_source, $auto_id); $res = is_file($tname) && unlink( $tname); } else { $tname = $this->_get_auto_base($auto_base, $auto_source); $tdir = dirname( $tname ); $tbase = basename( $tname ); $dh = opendir( $tdir ); while( $entry = readdir( $dh ) ) { if( substr( $entry, 0, strlen( $tbase ) ) == $tbase ) unlink( $tdir . DIR_SEP . $entry ); } $res = true; } } return $res; } } It worked for me hope it works for you! Am Die, 2002-08-13 um 14.47 schrieb Peter Billen: > Hi all, > > My hosting runs on SAFE MODE, so now I get the following errors: > > Warning: SAFE MODE Restriction in effect. The script whose uid is 490 is > not allowed to access templates_c/%%705 owned by uid 15 in > /home/sites/site69/users/test/web/Smarty.class.php on line 1604 > > Warning: Smarty error: problem creating directory > "templates_c/%%705/%%705129116" in > /home/sites/site69/users/test/web/Smarty.class.php on line 589 > > Warning: Smarty error: problem writing > 'templates_c/%%705/%%705129116/site.html.php.' in > /home/sites/site69/users/test/web/Smarty.class.php on line 589 > > Warning: Failed opening 'templates_c/%%705/%%705129116/site.html.php' > for inclusion (include_path='.:/usr/local/lib/php') in > /home/sites/site69/users/test/web/Smarty.class.php on line 686 > > My templates_c has chmod 777 and I'm not using any kind of caching. My > scripts are running on error_reporting(E_ALL); > > What is wrong? > > Thanks, > > Peter

« previous php.smarty.general (#5664) next »