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

RevLine 
[260]1<?php
2
[287]3$size_of_acl = sizeof($GLOBALS['phpgw_info']['user']['acl']);
[260]4
[305]5# percorre a ACL até o fim ou até encontrar a entrada para o módulo de mensagem instantânea
[287]6for ( $i = 0; $i < $size_of_acl && $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] != 'instant_messenger'; $i++ );
7
[305]8# verifica se foi encontrada a permissão para o módulo de mensagem instantânea
[287]9if ( $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] == 'instant_messenger' )
[262]10{
[305]11        $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
12        $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
[287]13
[305]14        if ( strrpos($webserver_url, '/') === false || strrpos($webserver_url, '/') != (strlen($webserver_url) - 1) )
15                $webserver_url .= '/';
[287]16
[305]17        $webserver_url = $webserver_url . 'instant_messenger/';
[287]18
19        require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/im_sessions.inc.php';
[305]20        //require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/load_lang.php';
[287]21
22        $js = array(
23                'connector',
[305]24                'xtools',
25                'windows',
[287]26                'jabber',
27                'client',
[305]28                /*'images',
[287]29                'dragdrop',
[305]30                'templates',*/
31                #'fcommon',
32                /*'menu_action',
[287]33                'functions',
34                'images',
35                'cookies_im',
[305]36                'load',*/
[287]37        );
38
[305]39        print '<script type="text/javascript">var path_im = "'.$webserver_url.'";</script>';
[287]40
[305]41        #require_once dirname(__FILE__) . '/Controller.class.php';
[287]42
[305]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        #}
[287]50
[305]51        //printf("<script type=\"text/javascript\">%s</script>", $script);
[287]52
[305]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">';
[287]56
[305]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>';
[262]78}
[260]79?>
Note: See TracBrowser for help on using the repository browser.