Commit 70d07a1efbafbb1dbe308794ea7a521f16af8712
1 parent
8643595f
Exists in
master
and in
7 other branches
Compatibilização com PHP 5.3
Showing
1 changed file
with
76 additions
and
73 deletions
Show diff stats
classesphp/carrega_ext.php
| ... | ... | @@ -43,99 +43,102 @@ Array com a lista de extensoes que devem ser carregadas pelo i3geo. |
| 43 | 43 | |
| 44 | 44 | Outras extensoes exigidas pelo i3geo também são verificadas, como mapscript e gd. |
| 45 | 45 | */ |
| 46 | -$extensoes = array("zlib","libxml","SimpleXML","dom","xml","simplexml","mbstring"); | |
| 47 | -if (isset($ler_extensoes)) | |
| 48 | -{ | |
| 49 | - $extensoes = explode(",",$ler_extensoes); | |
| 50 | - $temp1 = array(); | |
| 51 | -} | |
| 52 | -else | |
| 53 | -{ | |
| 54 | - $temp1 = get_loaded_extensions(); | |
| 55 | -} | |
| 56 | 46 | $ler_extensoes = array(); |
| 57 | -if (count($extensoes) > 0) | |
| 58 | -{ | |
| 59 | - $s = PHP_SHLIB_SUFFIX; | |
| 60 | - foreach ($extensoes as $templ) | |
| 47 | +if(function_exists("dl")){ | |
| 48 | + $extensoes = array("zlib","libxml","SimpleXML","dom","xml","simplexml","mbstring"); | |
| 49 | + if (isset($ler_extensoes)) | |
| 50 | + { | |
| 51 | + $extensoes = explode(",",$ler_extensoes); | |
| 52 | + $temp1 = array(); | |
| 53 | + } | |
| 54 | + else | |
| 55 | + { | |
| 56 | + $temp1 = get_loaded_extensions(); | |
| 57 | + } | |
| 58 | + $ler_extensoes = array(); | |
| 59 | + if (count($extensoes) > 0) | |
| 61 | 60 | { |
| 62 | - if (in_array( $templ, $temp1) != TRUE) | |
| 61 | + $s = PHP_SHLIB_SUFFIX; | |
| 62 | + foreach ($extensoes as $templ) | |
| 63 | 63 | { |
| 64 | - @dl( 'php_'.$templ.".".$s ); | |
| 65 | - $ler_extensoes[] = $templ; | |
| 64 | + if (in_array( $templ, $temp1) != TRUE) | |
| 65 | + { | |
| 66 | + @dl( 'php_'.$templ.".".$s ); | |
| 67 | + $ler_extensoes[] = $templ; | |
| 68 | + /* | |
| 69 | + if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) | |
| 70 | + { | |
| 71 | + @dl('php_'.$templ.'.dll'); | |
| 72 | + $ler_extensoes[] = $templ; | |
| 73 | + } | |
| 74 | + else | |
| 75 | + { | |
| 76 | + @dl('php_'.$templ.'.so'); | |
| 77 | + $ler_extensoes[] = $templ; | |
| 78 | + } | |
| 79 | + */ | |
| 80 | + } | |
| 81 | + } | |
| 82 | + //verifica se carregou a gd se não, tenta carregar a gd2 | |
| 83 | + if (!function_exists('imagecreate')) | |
| 84 | + { | |
| 85 | + @dl( 'php_gd.'.$s ); | |
| 86 | + $ler_extensoes[] = 'gd'; | |
| 66 | 87 | /* |
| 67 | 88 | if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) |
| 68 | 89 | { |
| 69 | - @dl('php_'.$templ.'.dll'); | |
| 70 | - $ler_extensoes[] = $templ; | |
| 90 | + @dl('php_gd.dll'); | |
| 91 | + $ler_extensoes[] = 'gd'; | |
| 71 | 92 | } |
| 72 | 93 | else |
| 73 | 94 | { |
| 74 | - @dl('php_'.$templ.'.so'); | |
| 75 | - $ler_extensoes[] = $templ; | |
| 95 | + @dl('php_gd.so'); | |
| 96 | + $ler_extensoes[] = 'gd'; | |
| 76 | 97 | } |
| 77 | 98 | */ |
| 78 | 99 | } |
| 79 | - } | |
| 80 | - //verifica se carregou a gd se não, tenta carregar a gd2 | |
| 81 | - if (!function_exists('imagecreate')) | |
| 82 | - { | |
| 83 | - @dl( 'php_gd.'.$s ); | |
| 84 | - $ler_extensoes[] = 'gd'; | |
| 85 | - /* | |
| 86 | - if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) | |
| 87 | - { | |
| 88 | - @dl('php_gd.dll'); | |
| 89 | - $ler_extensoes[] = 'gd'; | |
| 90 | - } | |
| 91 | - else | |
| 92 | - { | |
| 93 | - @dl('php_gd.so'); | |
| 94 | - $ler_extensoes[] = 'gd'; | |
| 95 | - } | |
| 96 | - */ | |
| 97 | - } | |
| 98 | - if (!function_exists('imagecreate')) | |
| 99 | - { | |
| 100 | - @dl( 'php_gd2.'.$s ); | |
| 101 | - $ler_extensoes[] = 'gd2'; | |
| 102 | - /* | |
| 103 | - if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) | |
| 104 | - { | |
| 105 | - @dl('php_gd2.dll'); | |
| 106 | - $ler_extensoes[] = 'gd2'; | |
| 107 | - } | |
| 108 | - else | |
| 100 | + if (!function_exists('imagecreate')) | |
| 109 | 101 | { |
| 110 | - @dl('php_gd2.so'); | |
| 102 | + @dl( 'php_gd2.'.$s ); | |
| 111 | 103 | $ler_extensoes[] = 'gd2'; |
| 112 | - } | |
| 113 | - */ | |
| 114 | - } | |
| 115 | - //verifica se carregou o mapscript | |
| 116 | - if (!function_exists('ms_GetVersion')) | |
| 117 | - { | |
| 118 | - @dl( 'php_mapscript.'.$s ); | |
| 119 | - $ler_extensoes[] = 'php_mapscript'; | |
| 120 | - /* | |
| 121 | - if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) | |
| 122 | - { | |
| 123 | - if(!@dl('php_mapscript_48.dll')) | |
| 104 | + /* | |
| 105 | + if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) | |
| 124 | 106 | { |
| 125 | - @dl('php_mapscript.dll'); | |
| 126 | - $ler_extensoes[] = 'mapscript'; | |
| 107 | + @dl('php_gd2.dll'); | |
| 108 | + $ler_extensoes[] = 'gd2'; | |
| 127 | 109 | } |
| 128 | 110 | else |
| 129 | - {$ler_extensoes[] = 'mapscript_48';} | |
| 111 | + { | |
| 112 | + @dl('php_gd2.so'); | |
| 113 | + $ler_extensoes[] = 'gd2'; | |
| 114 | + } | |
| 115 | + */ | |
| 130 | 116 | } |
| 131 | - else | |
| 117 | + //verifica se carregou o mapscript | |
| 118 | + if (!function_exists('ms_GetVersion')) | |
| 132 | 119 | { |
| 133 | - dl('php_mapscript.so'); | |
| 134 | - $ler_extensoes[] = 'mapscript'; | |
| 120 | + @dl( 'php_mapscript.'.$s ); | |
| 121 | + $ler_extensoes[] = 'php_mapscript'; | |
| 122 | + /* | |
| 123 | + if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) | |
| 124 | + { | |
| 125 | + if(!@dl('php_mapscript_48.dll')) | |
| 126 | + { | |
| 127 | + @dl('php_mapscript.dll'); | |
| 128 | + $ler_extensoes[] = 'mapscript'; | |
| 129 | + } | |
| 130 | + else | |
| 131 | + {$ler_extensoes[] = 'mapscript_48';} | |
| 132 | + } | |
| 133 | + else | |
| 134 | + { | |
| 135 | + dl('php_mapscript.so'); | |
| 136 | + $ler_extensoes[] = 'mapscript'; | |
| 137 | + } | |
| 138 | + */ | |
| 135 | 139 | } |
| 136 | - */ | |
| 137 | 140 | } |
| 141 | + if((is_array($ler_extensoes)) && (count($ler_extensoes) > 0)) | |
| 142 | + $ler_extensoes = implode(",",(array_unique($ler_extensoes))); | |
| 138 | 143 | } |
| 139 | -if((is_array($ler_extensoes)) && (count($ler_extensoes) > 0)) | |
| 140 | -$ler_extensoes = implode(",",(array_unique($ler_extensoes))); | |
| 141 | 144 | ?> |
| 142 | 145 | \ No newline at end of file | ... | ... |