source: trunk/instant_messenger/inc/im_acl.inc.php @ 305

Revision 305, 2.9 KB checked in by niltonneto, 16 years ago (diff)

Correçoes

Line 
1<?php
2
3$size_of_acl = sizeof($GLOBALS['phpgw_info']['user']['acl']);
4
5# percorre a ACL até o fim ou até encontrar a entrada para o módulo de mensagem instantânea
6for ( $i = 0; $i < $size_of_acl && $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] != 'instant_messenger'; $i++ );
7
8# verifica se foi encontrada a permissão para o módulo de mensagem instantânea
9if ( $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] == 'instant_messenger' )
10{
11        $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
12        $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
13
14        if ( strrpos($webserver_url, '/') === false || strrpos($webserver_url, '/') != (strlen($webserver_url) - 1) )
15                $webserver_url .= '/';
16
17        $webserver_url = $webserver_url . 'instant_messenger/';
18
19        require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/im_sessions.inc.php';
20        //require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/load_lang.php';
21
22        $js = array(
23                'connector',
24                'xtools',
25                'windows',
26                'jabber',
27                'client',
28                /*'images',
29                'dragdrop',
30                'templates',*/
31                #'fcommon',
32                /*'menu_action',
33                'functions',
34                'images',
35                'cookies_im',
36                'load',*/
37        );
38
39        print '<script type="text/javascript">var path_im = "'.$webserver_url.'";</script>';
40
41        #require_once dirname(__FILE__) . '/Controller.class.php';
42
43        #$controller = new Controller;
44        #$script = '';
45        #foreach ( $js as $key => $val )
46        #{
47        #       $val = array('act' => 'j.' . $val);
48        #       $script .= $controller->exec($val);
49        #}
50
51        //printf("<script type=\"text/javascript\">%s</script>", $script);
52
53        print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/window.css">';
54        print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/chat.css">';
55        print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/common.css">';
56
57        # trecho de código javascript utilizado para
58        # controle de possível erro no load do script
59        # feito acima e está sendo inserido via PHP
60        # pois é um complemento do procedimento acima
61        #$init_client  = '<script type="text/javascript">';
62        #$init_client .= '      function im_init(pTimes)';
63        #$init_client .= '      {';
64        #$init_client .= '              if ( !pTimes )';
65        #$init_client .= '                      pTimes = 0;';
66        #$init_client .= '              if ( pTimes == 5 )';
67        #$init_client .= '                      return false;';
68        #$init_client .= '              if ( window.InstantMessengerClient )';
69        #$init_client .= '                      InstantMessengerClient();';
70        #$init_client .= '              else';
71        #$init_client .= '                      setTimeout("im_init("+(++pTimes)+")", (pTimes + 1) * 2000);';
72        #$init_client .= '      }';
73        #$init_client .= '      var bkp_onload = window.onload;';
74        #$init_client .= '      window.onload = function(){if (typeof bkp_onload == "function") bkp_onload();setTimeout("im_init()",10000);};';
75        #$init_client .= '</script>';
76        //printf("%s", $init_client);
77        echo '<iframe style="display:none" height="100%" !width="100%" src="'.$webserver_url.'client.php"></iframe>';
78}
79?>
Note: See TracBrowser for help on using the repository browser.