~ubuntu-branches/ubuntu/feisty/smarty/feisty-security

« back to all changes in this revision

Viewing changes to libs/core/core.write_compiled_resource.php

  • Committer: Bazaar Package Importer
  • Author(s): Dimitri Fontaine
  • Date: 2004-04-16 17:41:20 UTC
  • Revision ID: james.westby@ubuntu.com-20040416174120-qb9ma0g419hkd25g
Tags: 2.6.2-2
* Adapted dependencies to allow running smarty with apache 2 (Closes: #241147)
* Prepared the template for i18n (Closes: #233098)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Smarty plugin
 
4
 * @package Smarty
 
5
 * @subpackage plugins
 
6
 */
 
7
 
 
8
/**
 
9
 * write the compiled resource
 
10
 *
 
11
 * @param string $compile_path
 
12
 * @param string $compiled_content
 
13
 * @param integer $resource_timestamp
 
14
 * @return true
 
15
 */
 
16
function smarty_core_write_compiled_resource($params, &$smarty)
 
17
{
 
18
    if(!@is_writable($smarty->compile_dir)) {
 
19
        // compile_dir not writable, see if it exists
 
20
        if(!@is_dir($smarty->compile_dir)) {
 
21
            $smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
 
22
            return false;
 
23
        }
 
24
        $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);
 
25
        return false;
 
26
    }
 
27
 
 
28
    $_params = array('filename' => $params['compile_path'], 'timestamp'=>$params['resource_timestamp'], 'contents' => $params['compiled_content'], 'create_dirs' => true);
 
29
    require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_file.php');
 
30
    smarty_core_write_file($_params, $smarty);
 
31
    return true;
 
32
}
 
33
 
 
34
/* vim: set expandtab: */
 
35
 
 
36
?>