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

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

Ticket #541 - O arquivo confLDAPInternal.php não é criado, gera um erro no applet java.

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