source: trunk/jabberit_messenger/inc/class.fileDefine.inc.php @ 946

Revision 946, 2.2 KB checked in by alexandrecorreia, 15 years ago (diff)

Ticket #505 - Arquivos modificados para a administração de hosts virtuais no servidor Jabber.

  • Property svn:executable set to *
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
13class fileDefine
14{
15        public final function ldapExternal($pConfLdap)
16        {
17                $file = "confLDAPExternal.php";
18                $writeFile = "<?php $"."LDAP_EXTERNAL="."\"".base64_encode(serialize($pConfLdap))."\""." ?>";
19                $this->writeFile($writeFile, $file);
20        }
21
22        public final function ldapInternal($pParam)
23        {
24                $array_values = explode("\n", $pParam['val']); 
25                $file = "confLDAPInternal.php";
26                $infoServer = array();
27               
28                foreach($array_values as $tmp )
29                {
30                        $nvalue = explode(";", $tmp);
31                       
32                        switch(trim($nvalue[0]))
33                        {
34                                case "JETTI_NAME_JABBERIT" :
35                                                $infoServer['jabberName'] = $nvalue[1];                         
36                                                break;
37                                               
38                                case "JETTI_SERVER_LDAP_JABBERIT" :
39                                                $infoServer['serverLdap'] = $nvalue[1];                                                 
40                                                break;                 
41                       
42                                case "JETTI_CONTEXT_LDAP_JABBERIT" :   
43                                                $infoServer['contextLdap'] = $nvalue[1];
44                                                break;
45                       
46                                case "JETTI_USER_LDAP_JABBERIT" :
47                                                $infoServer['user'] = $nvalue[1];
48                                                break;
49                       
50                                case "JETTI_PASSWORD_LDAP_JABBERIT" :
51                                                $infoServer['password'] = $nvalue[1];                           
52                                                break;
53                        }
54                }
55               
56                $writeFile = "<?php $"."LDAP_INTERNAL="."\"".base64_encode(serialize($infoServer))."\""." ?>";
57                $this->writeFile( $writeFile, $file );
58        }
59
60        private final function writeFile($pContent, $pfile)
61    {
62                $filename = dirname(__FILE__).'/'.$pfile;
63                $content = $pContent;
64                       
65                if ( !$handle = fopen($filename, 'w') )
66                        exit;
67               
68                if (fwrite($handle, $content) === FALSE)
69                        exit;
70
71                fclose($handle);
72    }
73}
74?>
Note: See TracBrowser for help on using the repository browser.