| 1 |
<?php |
<?php |
| 2 |
|
/** |
| 3 |
|
* Language Class for Mambo |
| 4 |
|
* @package Mambo |
| 5 |
|
* @copyright (C) 2006 - 2007 Mambo Foundation Inc. |
| 6 |
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL |
| 7 |
|
* @author Mambo Foundation Inc see README.php |
| 8 |
|
*/ |
| 9 |
|
|
| 10 |
class mamboLanguage { |
class mamboLanguage { |
| 11 |
var $name = ''; |
var $name = ''; |
| 57 |
global $page_,$task; |
global $page_,$task; |
| 58 |
$this->updateFiles(); |
$this->updateFiles(); |
| 59 |
$xml = $this->toXML(); |
$xml = $this->toXML(); |
| 60 |
if( ($page_=="addpage") && ($task=="save") ){ |
if( (($page_=="addpage") && ($task=="save")) || ($task=="convert") ){ |
| 61 |
if (strtolower($this->charset) != 'utf-8') { |
if (strtolower($this->charset) != 'utf-8') { |
| 62 |
if(trim($this->wincodepage)!="") |
if(trim($this->wincodepage)!="") |
| 63 |
$xml = $this->iconvert("utf-8",$this->wincodepage,$xml); |
$xml = $this->iconvert("utf-8",$this->wincodepage,$xml); |
| 191 |
} |
} |
| 192 |
} |
} |
| 193 |
$this->codesets = array_unique($this->codesets); |
$this->codesets = array_unique($this->codesets); |
| 194 |
global $mosConfig_absolute_path; |
if( class_exists('ConvertCharset') || function_exists('iconv') ) |
| 195 |
$cvfile = $mosConfig_absolute_path."/includes/ConvertCharset.class.php"; |
{ |
| 196 |
if(file_exists($cvfile) || function_exists('iconv')) |
if(strtolower($encoding)!="utf-8") |
| 197 |
{ |
{ |
| 198 |
$attrs = get_object_vars($this); |
$attrs = get_object_vars($this); |
| 199 |
if(trim($this->wincodepage)!="") |
if(trim($this->wincodepage)!="") |
| 202 |
$this->bindAttributes($attrs); |
$this->bindAttributes($attrs); |
| 203 |
|
|
| 204 |
}else{ |
}else{ |
|
if(strtolower($encoding)!="utf-8") |
|
|
{ |
|
| 205 |
$this->arrayEncoding($attrs,$encoding,TRUE); |
$this->arrayEncoding($attrs,$encoding,TRUE); |
| 206 |
$this->bindAttributes($attrs); |
$this->bindAttributes($attrs); |
| 207 |
} |
} |
| 223 |
return FALSE; |
return FALSE; |
| 224 |
} |
} |
| 225 |
} |
} |
|
global $mosConfig_absolute_path; |
|
|
$cvfile = $mosConfig_absolute_path."/includes/ConvertCharset.class.php"; |
|
|
if(file_exists($cvfile)) |
|
|
{ |
|
|
include_once($cvfile); |
|
| 226 |
$NewEncoding = new ConvertCharset(); |
$NewEncoding = new ConvertCharset(); |
| 227 |
return $NewEncoding->Convert($source,$fromcharset,$tocharset,false); |
return $NewEncoding->Convert($source,$fromcharset,$tocharset,false); |
|
}else if(function_exists('iconv')) |
|
|
{ |
|
|
return iconv($fromcharset,$tocharset,$source); |
|
|
}else |
|
|
return FALSE; |
|
| 228 |
} |
} |
| 229 |
function bindAttributes($attrs) |
function bindAttributes($attrs) |
| 230 |
{ |
{ |