source: companies/celepar/jabberit_messenger/inc/jabberit_acl.inc.php @ 763

Revision 763, 3.5 KB checked in by niltonneto, 15 years ago (diff)

Importação inicial do Expresso da Celepar

Line 
1<?php
2  /***************************************************************************\
3  *  Expresso - Expresso Messenger                                            *
4  *     - Alexandre Correia / Rodrigo Souza                                                               *
5  *     - JETI - http://jeti-im.org/                                                                              *
6  * ------------------------------------------------------------------------- *
7  *  This program is free software; you can redistribute it and/or modify it  *
8  *  under the terms of the GNU General Public License as published by the    *
9  *  Free Software Foundation; either version 2 of the License, or (at your   *
10  *  option) any later version.                                               *
11  \***************************************************************************/
12
13$size_of_acl = sizeof($GLOBALS['phpgw_info']['user']['acl']);
14
15for( $i = 0; $i < $size_of_acl && $GLOBALS['phpgw_info']['user']['acl'] != "jabberit_messenger"; $i++ )
16{
17        $apps = unserialize($GLOBALS['phpgw_info']['server']['apps_jabberit']);
18        $flag = false;
19
20        if( is_array($apps) )
21        {
22                foreach($apps as $tmp)
23                {
24                        $app_enabled = substr($tmp,0,strpos($tmp,";"));
25                        if( $GLOBALS['phpgw_info']['flags']['currentapp'] == $app_enabled )
26                                $flag = true;
27                }       
28        }
29       
30        if ( $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] == 'jabberit_messenger' && ( $flag || $GLOBALS['phpgw_info']['flags']['currentapp'] == 'jabberit_messenger' ))
31        {
32
33                $ldapManager = CreateObject('contactcenter.bo_ldap_manager');
34                $_SESSION['phpgw_info']['jabberit_messenger']['ldapManager'] = $ldapManager->srcs[1];
35               
36                $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
37                $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
38
39                if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1))
40                        $webserver_url .= '/';
41
42                $webserver_url = $webserver_url . 'jabberit_messenger/';
43               
44                require_once PHPGW_SERVER_ROOT . '/jabberit_messenger/inc/jabberit_sessions.inc.php';
45               
46                $_SESSION['phpgw_info']['jabberit_messenger']['webserver_url'] = $webserver_url;
47               
48                $ExternalParticipants = "";
49                if(isset($_SESSION['phpgw_info']['jabberit_messenger']['conf_organization_jabberit']))
50                        $ExternalParticipants = explode(",",$_SESSION['phpgw_info']['jabberit_messenger']['conf_organization_jabberit']);
51               
52                if(is_array($ExternalParticipants))     
53                {
54                        natcasesort($ExternalParticipants);
55                        $ExternalParticipants = implode(",", $ExternalParticipants);
56                }
57               
58                require_once dirname(__FILE__) . '/load_lang.php';
59               
60                $var_js  = "var path_jabberit='".$webserver_url."';";
61                $var_js .= "var externalParticipantsJabberit='".$ExternalParticipants."';";
62
63                echo "<script type=\"text/javascript\">".$var_js."</script>";
64
65                $js = array(
66                                'connector',
67                                'xtools',
68                                'dragdrop',
69                                'windows',     
70                                'ldap',
71                                'images',
72                                'show_hidden',
73                                'load',
74                                'editSelect'
75                                );
76
77                require_once dirname(__FILE__) . '/Controller.class.php';
78
79                $controller = new Controller;
80                $script = '';
81                foreach( $js as $key => $val )
82                {
83                        $val = array('act' => 'j.' . $val );
84                        $script .= $controller->exec($val);
85                }       
86               
87                printf("<script type=\"text/javascript\">%s</script>", $script);
88               
89                print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/window.css">';
90                print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/common.css">';
91                print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/selectEditStyle.css">';         
92
93                break;
94        }
95       
96}
97?>
Note: See TracBrowser for help on using the repository browser.