~ubuntu-branches/ubuntu/breezy/moodle/breezy

« back to all changes in this revision

Viewing changes to lib/smarty/plugins/function.config_load.php

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Mitchell
  • Date: 2005-10-13 02:00:59 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051013020059-y2qcyo41t7nqppcg
Tags: 1.5.2-1ubuntu1
* Resync with debian (security update)
* changed dependencys to php5
* changed apache dependency to apache2 
* References
  CAN-2005-2247

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
{
27
27
        if ($smarty->debugging) {
28
28
            $_params = array();
29
 
            require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');
 
29
            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
30
30
            $_debug_start_time = smarty_core_get_microtime($_params, $smarty);
31
31
        }
32
32
 
53
53
            }
54
54
        }
55
55
 
56
 
        $_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir);
 
56
        $_params = array('resource_name' => $_file,
 
57
                         'resource_base_path' => $smarty->config_dir,
 
58
                         'get_source' => false);
57
59
        $smarty->_parse_resource_name($_params);
58
60
        $_file_path = $_params['resource_type'] . ':' . $_params['resource_name'];
59
61
        if (isset($_section))
61
63
        else
62
64
            $_compile_file = $smarty->_get_compile_path($_file_path);
63
65
 
64
 
        if($smarty->force_compile
65
 
                || !file_exists($_compile_file)
66
 
                || ($smarty->compile_check
67
 
                    && !$smarty->_is_compiled($_file_path, $_compile_file))) {
 
66
        if($smarty->force_compile || !file_exists($_compile_file)) {
 
67
            $_compile = true;
 
68
        } elseif ($smarty->compile_check) {
 
69
            $_params = array('resource_name' => $_file,
 
70
                             'resource_base_path' => $smarty->config_dir,
 
71
                             'get_source' => false);
 
72
            $_compile = $smarty->_fetch_resource_info($_params) &&
 
73
                $_params['resource_timestamp'] > filemtime($_compile_file);
 
74
        } else {
 
75
            $_compile = false;
 
76
        }
 
77
 
 
78
        if($_compile) {
68
79
            // compile config file
69
80
            if(!is_object($smarty->_conf_obj)) {
70
81
                require_once SMARTY_DIR . $smarty->config_class . '.class.php';
74
85
                $smarty->_conf_obj->read_hidden = $smarty->config_read_hidden;
75
86
                $smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines;
76
87
            }
77
 
            $_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir);
 
88
 
 
89
            $_params = array('resource_name' => $_file,
 
90
                             'resource_base_path' => $smarty->config_dir,
 
91
                             $_params['get_source'] = true);
78
92
            if (!$smarty->_fetch_resource_info($_params)) {
79
93
                return;
80
94
            }
87
101
                $_output = '<?php $_config_vars = unserialize(\'' . strtr(serialize($_config_vars),array('\''=>'\\\'', '\\'=>'\\\\')) . '\'); ?>';
88
102
            }
89
103
            $_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => $_params['resource_timestamp']));
90
 
            require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_compiled_resource.php');
 
104
            require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php');
91
105
            smarty_core_write_compiled_resource($_params, $smarty);
92
106
        } else {
93
107
            include($_compile_file);
112
126
 
113
127
        if ($smarty->debugging) {
114
128
            $_params = array();
115
 
            require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');
 
129
            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
116
130
            $smarty->_smarty_debug_info[] = array('type'      => 'config',
117
131
                                                'filename'  => $_file.' ['.$_section.'] '.$_scope,
118
132
                                                'depth'     => $smarty->_inclusion_depth,