Редакция 2 | Только различия | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 2 | Редакция 94 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | /**
|
2 | /**
|
3 | * Smarty plugin
|
3 | * Smarty plugin
|
4 | * @package Smarty
|
4 | * @package Smarty
|
5 | * @subpackage plugins
|
5 | * @subpackage plugins
|
6 | */
|
6 | */
|
7 | 7 | ||
8 | /**
|
8 | /**
|
9 | * write the compiled resource
|
9 | * write the compiled resource
|
10 | *
|
10 | *
|
11 | * @param string $compile_path
|
11 | * @param string $compile_path
|
12 | * @param string $compiled_content
|
12 | * @param string $compiled_content
|
13 | * @return true
|
13 | * @return true
|
14 | */
|
14 | */
|
15 | function smarty_core_write_compiled_resource($params, &$smarty) |
15 | function smarty_core_write_compiled_resource($params, &$smarty) |
16 | {
|
16 | {
|
17 | if(!@is_writable($smarty->compile_dir)) { |
17 | if(!@is_writable($smarty->compile_dir)) { |
18 | // compile_dir not writable, see if it exists
|
18 | // compile_dir not writable, see if it exists
|
19 | if(!@is_dir($smarty->compile_dir)) { |
19 | if(!@is_dir($smarty->compile_dir)) { |
20 | $smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR); |
20 | $smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR); |
21 | return false; |
21 | return false; |
22 | }
|
22 | }
|
23 | $smarty->trigger_error('unable to write to $compile_dir \'' . realpath($smarty->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR); |
23 | $smarty->trigger_error('unable to write to $compile_dir \'' . realpath($smarty->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR); |
24 | return false; |
24 | return false; |
25 | }
|
25 | }
|
26 | 26 | ||
27 | $_params = array('filename' => $params['compile_path'], 'contents' => $params['compiled_content'], 'create_dirs' => true); |
27 | $_params = array('filename' => $params['compile_path'], 'contents' => $params['compiled_content'], 'create_dirs' => true); |
28 | require_once(SMARTY_CORE_DIR . 'core.write_file.php'); |
28 | require_once(SMARTY_CORE_DIR . 'core.write_file.php'); |
29 | smarty_core_write_file($_params, $smarty); |
29 | smarty_core_write_file($_params, $smarty); |
30 | return true; |
30 | return true; |
31 | }
|
31 | }
|
32 | 32 | ||
33 | /* vim: set expandtab: */
|
33 | /* vim: set expandtab: */
|
34 | 34 | ||
35 | ?>
|
35 | ?>
|
36 | 36 |