[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 | |
---|
| 13 | class FileDefine |
---|
| 14 | { |
---|
| 15 | |
---|
[551] | 16 | public final function getParams($pParam) |
---|
[439] | 17 | { |
---|
| 18 | $array_values = explode("\n", $pParam['val']); |
---|
| 19 | $infoServer = array(); |
---|
| 20 | |
---|
| 21 | foreach($array_values as $tmp ) |
---|
| 22 | { |
---|
| 23 | $nvalue = explode(";", $tmp); |
---|
| 24 | |
---|
| 25 | switch(trim($nvalue[0])) |
---|
| 26 | { |
---|
| 27 | case "JETTI_SERVER_LDAP_JABBERIT" : |
---|
| 28 | $infoServer['host'] = $nvalue[1]; |
---|
| 29 | break; |
---|
| 30 | |
---|
| 31 | case "JETTI_CONTEXT_LDAP_JABBERIT" : |
---|
| 32 | $infoServer['context'] = $nvalue[1]; |
---|
| 33 | break; |
---|
| 34 | |
---|
| 35 | case "JETTI_USER_LDAP_JABBERIT" : |
---|
| 36 | $infoServer['dn'] = $nvalue[1]; |
---|
| 37 | break; |
---|
| 38 | |
---|
| 39 | case "JETTI_PASSWORD_LDAP_JABBERIT" : |
---|
| 40 | $infoServer['passwd'] = $nvalue[1]; |
---|
| 41 | break; |
---|
| 42 | } |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | $this->writeFile($infoServer); |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | private final function writeFile($pContent) |
---|
| 49 | { |
---|
| 50 | |
---|
| 51 | $filename = dirname(__FILE__).'/conf_Ldap_Photos.php'; |
---|
| 52 | $caracter = "$"; |
---|
| 53 | $content = "<?php ".$caracter."CONF_SERVER="."\"" . base64_encode(serialize($pContent)) ."\""." ?>"; |
---|
| 54 | |
---|
| 55 | if (!$handle = fopen($filename, 'w')) |
---|
| 56 | { |
---|
| 57 | echo "Não foi possível abrir o arquivo : \n($filename)"; |
---|
| 58 | exit; |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | if (fwrite($handle, $content) === FALSE) |
---|
| 62 | { |
---|
| 63 | echo "Não foi possível escrever no arquivo : \n($filename)"; |
---|
| 64 | exit; |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | echo "Arquivo : \n $filename \ncriado com sucesso !!"; |
---|
| 68 | fclose($handle); |
---|
| 69 | } |
---|
| 70 | } |
---|
| 71 | ?> |
---|