Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

include_php and trusted_dir in smarty3 has an error

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
vvviop
Smarty n00b


Joined: 20 Oct 2010
Posts: 1

PostPosted: Wed Oct 20, 2010 4:10 am    Post subject: include_php and trusted_dir in smarty3 has an error Reply with quote

index.php
Code:

<?php
$smarty = new Smarty();
$smarty->template_dir =  'template_dir' ;      
$smarty->compile_dir  = 'compile_dir' ;
$smarty->trusted_dir = 'trusted_dir' ;
$smarty->display ( 'index.tpl' );


template_dir/index.tpl
Code:

hello smarty!
{include_php file='a.php'}


trusted_dir/a.php
Code:

<?php
print 'im a.php' ;



Fatal error:
include_php: file "'a.php'" is not readable'
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Oct 20, 2010 1:51 pm    Post subject: Reply with quote

is it readable? can PHP access the file? Check perms on the file and the trusted_dir. See that the $smarty->trusted_dir is the setting you expect. you might try a test from PHP:

file_get_contents($smarty->trusted_dir .'/a.php');

see if that errors.
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Oct 20, 2010 7:26 pm    Post subject: Reply with quote

This is a backward compatibillity problem to Smarty2 because of some changes in Smarty3 security.

$smarty->trusted_dir is not used as in Smarty2 for {include_php}

For the moment use in {include_php } an absolute filepath or a path relative to your script should also work.

I must take a more detailed look into it for a general solution.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3 All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP