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