~ubuntu-branches/ubuntu/dapper/smarty/dapper-updates

« back to all changes in this revision

Viewing changes to libs/core/core.assign_smarty_interface.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
 * Smarty assign_smarty_interface core plugin
 
10
 *
 
11
 * Type:     core<br>
 
12
 * Name:     assign_smarty_interface<br>
 
13
 * Purpose:  assign the $smarty interface variable
 
14
 * @param array Format: null
 
15
 * @param Smarty
 
16
 */
 
17
function smarty_core_assign_smarty_interface($params, &$smarty)
 
18
{
 
19
        if (isset($smarty->_smarty_vars) && isset($smarty->_smarty_vars['request'])) {
 
20
            return;
 
21
        }
 
22
 
 
23
        $_globals_map = array('g'  => 'HTTP_GET_VARS',
 
24
                             'p'  => 'HTTP_POST_VARS',
 
25
                             'c'  => 'HTTP_COOKIE_VARS',
 
26
                             's'  => 'HTTP_SERVER_VARS',
 
27
                             'e'  => 'HTTP_ENV_VARS');
 
28
 
 
29
        $_smarty_vars_request  = array();
 
30
 
 
31
        foreach (preg_split('!!', strtolower($smarty->request_vars_order)) as $_c) {
 
32
            if (isset($_globals_map[$_c])) {
 
33
                $_smarty_vars_request = array_merge($_smarty_vars_request, $GLOBALS[$_globals_map[$_c]]);
 
34
            }
 
35
        }
 
36
        $_smarty_vars_request = @array_merge($_smarty_vars_request, $GLOBALS['HTTP_SESSION_VARS']);
 
37
 
 
38
        $smarty->_smarty_vars['request'] = $_smarty_vars_request;
 
39
}
 
40
 
 
41
/* vim: set expandtab: */
 
42
 
 
43
?>