source: trunk/phpgwapi/inc/class.expressolivre.inc.php @ 2712

Revision 2712, 1.4 KB checked in by rodsouza, 14 years ago (diff)

Ticket #1058 - Adaptando todo o expressoAdmin1_2 para não realizar reload.

Line 
1<?php
2
3class ExpressoLivre
4{
5        function __construct( )
6        {
7        }
8
9        function configuration( )
10        {
11                $webserver_url = ( ! empty( $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'webserver_url' ] ) ) ?
12                        $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'webserver_url' ] : '/';
13
14                if ( strpos( $webserver_url, '/' ) != ( strlen( $webserver_url ) - 1 ) )
15                        $webserver_url .= '/';
16
17                return str_replace(
18                        array( '{', '}' ),
19                        array( '{ ', ' }' ),
20                        json_encode(
21                                array(
22                                        'url' => $webserver_url,
23                                        'template' => $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'template_set' ],
24                                        'theme' => $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'theme' ]
25                                )
26                        )
27                );
28        }
29
30        function lang( $param )
31        {
32                $lang = ( array_key_exists( 'lang', $param ) ) ? $param[ 'lang' ] : false;
33                $module = ( array_key_exists( 'module', $param ) ) ? $param[ 'module' ] : false;
34
35                if ( ! ( $lang && $module ) )
36                        return '{}';
37
38                $array_keys = array( );
39                $fn = dirname( __FILE__ ) . "/../../{$module}/setup/phpgw_{$lang}.lang";
40                $lang = array( );
41
42                if ( file_exists( $fn ) )
43                {
44                        $fp = fopen( $fn, 'r' );
45                        while ( $data = fgets( $fp, 16000 ) )
46                        {
47                                list( $message_id, $app_name, $null, $content ) = explode( "\t", substr( $data, 0, -1 ) );
48                                $lang[ ] = '"' . str_replace( '"', '\"', strtolower( $message_id ) ) . '" : "' . str_replace( '"', '\"', $content ) . '"';
49                        }
50                        fclose( $fp );
51                }
52
53                return '{' . implode( ",\n", $lang ) . '}';
54        }
55}
56
57?>
Note: See TracBrowser for help on using the repository browser.