From b529217621fbe81c7c1db69292cf4382c9417d29 Mon Sep 17 00:00:00 2001 From: sebastian Date: Thu, 24 Mar 2005 20:43:04 +0000 Subject: [PATCH] really close to 0.9 --- .../htmlUI/var/formmask/generic.inc.php | 8 +- .../modules/htmlUI/var/html/ui_handler.php | 6 +- .../localizer/.icons/button_arrow_down.gif | Bin 0 -> 70 bytes .../var/localizer/.icons/button_arrow_up.gif | Bin 0 -> 70 bytes .../var/localizer/.icons/button_delete.gif | Bin 0 -> 64 bytes .../htmlUI/var/localizer/.icons/delete.jpg | Bin 0 -> 561 bytes .../htmlUI/var/localizer/.icons/down.jpg | Bin 0 -> 554 bytes .../htmlUI/var/localizer/.icons/up.jpg | Bin 0 -> 548 bytes .../modules/htmlUI/var/localizer/data.inc.php | 588 ++++++++++++++++++ .../htmlUI/var/localizer/display.inc.php | 453 ++++++++++++++ .../modules/htmlUI/var/localizer/header.html | 13 + .../htmlUI/var/localizer/helpfunctions.php | 142 +++++ .../modules/htmlUI/var/localizer/index.php | 15 + .../htmlUI/var/localizer/langCodex.xml | 571 +++++++++++++++++ .../modules/htmlUI/var/localizer/langConv.php | 7 + .../htmlUI/var/localizer/languages.txt | 142 +++++ .../htmlUI/var/localizer/languages.xml | 28 + .../htmlUI/var/localizer/localizer.css | 47 ++ .../htmlUI/var/localizer/locals.cz.Czech.xml | 122 ++++ .../htmlUI/var/localizer/locals.de.German.xml | 161 +++++ .../var/localizer/locals.en.English.xml | 161 +++++ .../var/localizer/locals.hu.Hungarian.xml | 122 ++++ .../htmlUI/var/localizer/locals.nl.Dutch.xml | 122 ++++ .../modules/htmlUI/var/localizer/main.php | 179 ++++++ .../modules/htmlUI/var/localizer/menu.php | 21 + .../htmlUI/var/localizer/menu_static.php | 21 + .../htmlUI/var/localizer/require.inc.php | 33 + .../modules/htmlUI/var/ui_base.inc.php | 22 +- .../modules/htmlUI/var/ui_handler.class.php | 2 +- .../modules/htmlUI/var/ui_scheduler.class.php | 3 +- 30 files changed, 2978 insertions(+), 11 deletions(-) create mode 100755 livesupport/modules/htmlUI/var/localizer/.icons/button_arrow_down.gif create mode 100755 livesupport/modules/htmlUI/var/localizer/.icons/button_arrow_up.gif create mode 100755 livesupport/modules/htmlUI/var/localizer/.icons/button_delete.gif create mode 100755 livesupport/modules/htmlUI/var/localizer/.icons/delete.jpg create mode 100755 livesupport/modules/htmlUI/var/localizer/.icons/down.jpg create mode 100755 livesupport/modules/htmlUI/var/localizer/.icons/up.jpg create mode 100755 livesupport/modules/htmlUI/var/localizer/data.inc.php create mode 100755 livesupport/modules/htmlUI/var/localizer/display.inc.php create mode 100755 livesupport/modules/htmlUI/var/localizer/header.html create mode 100755 livesupport/modules/htmlUI/var/localizer/helpfunctions.php create mode 100755 livesupport/modules/htmlUI/var/localizer/index.php create mode 100755 livesupport/modules/htmlUI/var/localizer/langCodex.xml create mode 100755 livesupport/modules/htmlUI/var/localizer/langConv.php create mode 100755 livesupport/modules/htmlUI/var/localizer/languages.txt create mode 100755 livesupport/modules/htmlUI/var/localizer/languages.xml create mode 100755 livesupport/modules/htmlUI/var/localizer/localizer.css create mode 100644 livesupport/modules/htmlUI/var/localizer/locals.cz.Czech.xml create mode 100755 livesupport/modules/htmlUI/var/localizer/locals.de.German.xml create mode 100755 livesupport/modules/htmlUI/var/localizer/locals.en.English.xml create mode 100644 livesupport/modules/htmlUI/var/localizer/locals.hu.Hungarian.xml create mode 100644 livesupport/modules/htmlUI/var/localizer/locals.nl.Dutch.xml create mode 100755 livesupport/modules/htmlUI/var/localizer/main.php create mode 100755 livesupport/modules/htmlUI/var/localizer/menu.php create mode 100755 livesupport/modules/htmlUI/var/localizer/menu_static.php create mode 100755 livesupport/modules/htmlUI/var/localizer/require.inc.php diff --git a/livesupport/modules/htmlUI/var/formmask/generic.inc.php b/livesupport/modules/htmlUI/var/formmask/generic.inc.php index ee56e6305..de65a2f6f 100755 --- a/livesupport/modules/htmlUI/var/formmask/generic.inc.php +++ b/livesupport/modules/htmlUI/var/formmask/generic.inc.php @@ -458,10 +458,10 @@ $ui_fmask = array( 'type' => 'select', 'label' => 'Language', 'options' => array( - 'en' => 'English', - 'cz' => 'Czech', - 'de' => 'German', - 'hu' => 'Hungarian', + 'en.English' => 'English', + 'cz.Czech' => 'Czech', + 'de.German' => 'German', + 'hu.Hungarian' => 'Hungarian', ) ) ), diff --git a/livesupport/modules/htmlUI/var/html/ui_handler.php b/livesupport/modules/htmlUI/var/html/ui_handler.php index b57a3a67f..c23bfb000 100644 --- a/livesupport/modules/htmlUI/var/html/ui_handler.php +++ b/livesupport/modules/htmlUI/var/html/ui_handler.php @@ -184,12 +184,14 @@ switch($_REQUEST['act']){ case "PL.create": if (($ui_tmpid = $uiHandler->PLAYLIST->create($_REQUEST['id'])) !== FALSE) + $uiHandler->SCRATCHPAD->addItem($_REQUEST['id']); $uiHandler->SCRATCHPAD->addItem($ui_tmpid); $uiHandler->PLAYLIST->setRedirect(); break; case "PL.addItem": - $uiHandler->PLAYLIST->addItem($_REQUEST['id']); + if ($uiHandler->PLAYLIST->addItem($_REQUEST['id']) !== FALSE) + $uiHandler->SCRATCHPAD->addItem($_REQUEST['id']); $uiHandler->PLAYLIST->setReload(); break; @@ -266,7 +268,7 @@ if ($uiHandler->alertMsg) $_SESSION['alertMsg'] = $uiHandler->alertMsg; #header('Location: '.$uiHandler->redirUrl); if (ob_get_contents()) { $ui_wait = 5; -} +} ob_end_clean; ?> diff --git a/livesupport/modules/htmlUI/var/localizer/.icons/button_arrow_down.gif b/livesupport/modules/htmlUI/var/localizer/.icons/button_arrow_down.gif new file mode 100755 index 0000000000000000000000000000000000000000..031d4a2a79fa476b1bbe5f7bd3e192590896e22d GIT binary patch literal 70 zcmZ?wbhEHbXRN-iZNIN01~?vn*aa+ literal 0 HcmV?d00001 diff --git a/livesupport/modules/htmlUI/var/localizer/.icons/button_arrow_up.gif b/livesupport/modules/htmlUI/var/localizer/.icons/button_arrow_up.gif new file mode 100755 index 0000000000000000000000000000000000000000..3401061709f4ee5d42419df55d712cc4144f5dd4 GIT binary patch literal 70 zcmZ?wbhEHbe+RU{N{sV#HPZmZ724)5w1|R^*GcbwI>9<^@en*Vq W?O7}RO_rT^WDk0F8P&X#k|GS&01{{s=l}o! literal 0 HcmV?d00001 diff --git a/livesupport/modules/htmlUI/var/localizer/.icons/delete.jpg b/livesupport/modules/htmlUI/var/localizer/.icons/delete.jpg new file mode 100755 index 0000000000000000000000000000000000000000..20ef9dad3bd43c79ba872f2da79ca91c02c85782 GIT binary patch literal 561 zcmex=O1eh6>7?=bZ znFSgDA7Ky$I*tJau(1P$A)A+*b@_5zb ztV3%QR4&g5REsaSocJhxBZv0E6OXqzhPt0^U*Ym~D(jPpAGNQ0CM{Va+1{zeRw=o; zPux9F`CQV)qP3yXYw!H(e7!U!VE&SJ-c{=#@0HD8_C@FH*8=}VQ~om?JuofV+*ZXT zs`u#xlboY>_xhIRhtFHeC$>GLE4lWO1eh6>7?=bZ znFSgDA7Ky!JCy+ma51p~#T5k@n3x$Em_P&su&^?-aj-KoaSAaAii!i3hyeYF20)^M zn4-5BctB!yt*3i(TDR(K&2)1!YvDc5Pt4v{@N~bz@~s&c zH@lTQx-su$H?z9Irrvo@XS6(1XT@)SfBb3w9nt2j8^M{8SvNMTDsH-7l-9FBv8>s$ z@XLFl?f%E#`G{^0yC79@e09Q(hYw7c52+-(Dbzc$%)aEY?;hW~M<;d|KM{UxFLI}H z+K~KD)IBH3)@F6*4zm|WYm#+9<2=`g|YMbJQu$e0#_Z5ZPeby~} z{&SL-#?3p1y&snG{kVQ}uKBk2HA`=OcaJ|7Wh$ZJaAnW7x9mnA(;k;yXn8j0jrO1eh6>7?=bZ znFSgDA7Ky!JCy+murYH1#bpE-n3zG@;4&<%%xoO&j7*$BSrH_0r~;6vAVM`v^cDjT zGb7MCW`8iWEJ+%+{rwjV&sMNZDe!{x!NY!V?{QnGRc^3x0s*u(yxO@J%VO!IN ziCTa5o_hJA#6NpZ)-8{@(bKp8Sg1YMv_Z|O>*CkK#D6Ah3_qD=E}xpe&(E&I!0h`W z(;oeCu?t0v9z~bT+{lj_lalB(z5yeA&eOtFFk&jG*4L7t;g%JlSN?%&%tM6 z6^p0Y*V!!ldtbupbj!B6d7HO>a_u{waB`NR64xhP`QvwXSG`>>x07Y5RjXp`Nz2J< a>1Qk)8U#LzB?ccc_~@y#-(If$|4jgbA(!L; literal 0 HcmV?d00001 diff --git a/livesupport/modules/htmlUI/var/localizer/data.inc.php b/livesupport/modules/htmlUI/var/localizer/data.inc.php new file mode 100755 index 000000000..a421eeb2a --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/data.inc.php @@ -0,0 +1,588 @@ + "\t", // indent with tabs + "rootName" => "language", // root tag + "defaultTagName" => "item", // tag for values with numeric keys + #"typeHints" => true, + "keyAttribute" => "position", + "addDecl" => true, + "encoding" => _ENCODING_, + "indentAttributes" => true, + "mode" => 'simplexml' + ); + + var $unserializeoptions = array(); + + var $_gs; + + function &getInstance() + { + static $instance; + + if (!$instance) { + $instance = new Data(); + } + + return $instance; + } + + function _realTransPath($file, $Id, $type='xml') + { + $s = '/'; + return $_SERVER[DOCUMENT_ROOT].$s.dirname($_SERVER[SCRIPT_NAME]).$s.Data::langPath($file, $Id, $type); + } + + function langPath($file, $Id, $type) + { + // $file[path] = path + // $file[base] = name + // $Id = language-Id, e.g. en-gb.english + // $type = [xml | php] + $d = '.'; + $s = '/'; + + return $file[dir].$s.$file[base].$d.$Id.$d.$type; + } + + function readTransXML2Arr($file, $Id) // read language-xml-file, return array + { + $realpath = Data::_realTransPath($file, $Id, 'xml'); + + if ($arr = Data::readXML2Arr($realpath)) { // read file & convert it + if (!is_array($arr[item][0]) && $arr[item]) { + // was there an item? + $arr[item][0][key] = $arr[item][key]; + $arr[item][0][value] = $arr[item][value]; + unset($arr[item][key]); + unset($arr[item][value]); + } + return $arr; + } else { + // seems missing|empty file -> create array with Id only + $arr = Data::convTransArr2XML(array(), $Id); + return Data::_convTransXML2Arr($arr); + } + } + + function readXML2Arr($path) // read some xml-file + { + if (file_exists($path)) { + $xml = File::readAll($path); + File::rewind($path, FILE_MODE_READ); // needet if same file should be read second time + + return Data::convXML2Arr($xml); + } + + Error (getGS('cannot read $1', $path)); + return false; + } + + function writeTransXML2File($file, $xml) // write language-xml-file + { + $arr = Data::_convTransXML2Arr($xml); // get the langId from XML-data for file-naming + $Id = $arr['Id']; + + $realpath = Data::_realTransPath($file, $Id, 'xml'); + Data::writeXML2File($realpath, $xml); // write data to file + } + + function writeXML2File($path, $xml) // write some xml-data to file + { + File::write($path, $xml, FILE_MODE_WRITE); + } + + function readGSFile2Arr($file, $Id) + { + unset ($this->_gs); + + $realpath = Data::_realTransPath($file, $Id, 'php'); + $data = File::readAll($realpath); + + $data = preg_replace('/regGS/', '$this->_regGS', $data); + + eval ('?>'.$data); + + return $this->_gs; + } + + function _regGS($key, $value) + { + $l = count($this->_gs); + + if (substr($value,strlen($value)-3)==":en"){ + $value=substr($value,0,strlen($value)-3); + } + + $this->_gs[$l][key] = $key; + $this->_gs[$l][value] = $value; + } + + function convTransArr2XML($arr, $Id) + { + $target['Id'] = $Id; // add the Id + if ($arr[status] == 'on') { + $target[status] = 'checked'; + } + + if (count($arr)>1) { + foreach($arr as $key=>$val) { + if (!is_int($key)) { // clean array: + unset($arr[$key]); // delete all non-numeric keys (maybee transmitted from form) + } + } + } + + $target = array_merge($target, $arr); + + return Data::convArr2XML($target); + } + + function convArr2XML($arr) // serialize some array to xml + { + $handle = new XML_Serializer($this->serializeoptions); + $handle->serialize($arr); + + return $handle->getSerializedData(); + } + + function convXML2Arr($xml) + { + $handle = new XML_Unserializer($this->unserializeoptions); + $handle->unserialize($xml); + $arr = $handle->getUnserializedData(); + + return $arr; + } + + function _convTransXML2Arr($xml) + { + $arr = Data::convXML2Arr($xml); + + if (is_array($arr[item][0])) { // more than one items => done + return $arr; + } else { //else convert structure of array + $conv['Id'] = $arr['Id']; + if (is_array($arr[item])) { // was there one item => change structure + $conv[item][0][key] = $arr[item][key]; + $conv[item][0][value] = $arr[item][value]; + } + + return $conv; + } + } + + function convArr2GS($arr) + { + if (is_array($arr[item])) { + foreach ($arr[item] as $key=>$val) { + $gs[$val['key']] = $val['value']; + } + return $gs; + } + return false; + } + + function checkKeys($file, $data) + { + // check if new key doesnīt already exists in local and global file + + $testGS = array_flip(Data::convCharsArr($data, 1, 0, _DENY_HTML_)); + + $localdata = Data::readTransXML2Arr(array('base'=>_PREFIX_, 'dir'=>$file[dir]), _DEFAULT_LANG_); + $localGS = Data::convArr2GS($localdata); + + $globaldata = Data::readTransXML2Arr(array('base'=>_PREFIX_GLOBAL_, 'dir'=>'..'), _DEFAULT_LANG_); + $globalGS = Data::convArr2GS($globaldata); + + foreach($testGS as $key=>$val) { + if (isset($globalGS[$key])) { + $msg[err][$key] .= getGS('key "$1" already exists in $2-file', $key, 'global'); + } + } + reset($testGS); + + foreach($testGS as $key=>$val) { + if (isset($localGS[$key])) { + $msg[err][$key] .= getGS('key "$1" already exists in $2-file', $key, 'local'); + } + } + + return $msg; + } + + function convStr ($str, $rmShlash, $chQuot, $html) + { + if ($rmShlash) { + $str = stripslashes($str); + } + + if ($chQuot) { + $str = str_replace('"', '"', $str); + } + + if ($html) { + $str = htmlspecialchars($str); + } + + return $str; + } + + + function convCharsArr ($input, $rmShlash, $chQuot, $html) + { + if (is_array ($input)) { + foreach ($input as $key=>$val) { + if (is_array ($val)) { + $arr[$key] = Data::convCharsArr ($val, $rmShlash, $chQuot, $html); + } else { + $arr[$key] = Data::convStr ($val, $rmShlash, $chQuot, $html); + } + } + return ($arr); + } + + return Data::convStr ($input, $rmShlash, $chQuot, $html); + } + + function saveTrans2XML($file, $data) + { + $data = Data::convCharsArr($data, 1, 0, _DENY_HTML_); // do some cleanup + + $xml = Data::convTransArr2XML($data, $file['Id']); + Data::writeTransXML2File($file, $xml); + } + + function addEntry2XML($file, $pos, $newKey) + { + // go throught all files matching $file[base] in $file[dir] and add entry(s) + + $newKey = Data::convCharsArr($newKey, 1, 0,_DENY_HTML_); // do some cleanup + $Ids = Data::_findLangFilesIds($file); + + if (!is_array($Ids)) { // no file there + $Ids[] = _DEFAULT_LANG_; + } + + foreach($Ids as $lost=>$Id) { + $source = Data::readTransXML2Arr($file, $Id); + unset($target); + unset($before); + unset($after); + + // split source in 2 parts + if ($pos == 'begin') { + $before = array(); + $after = $source[item]; + } elseif ($pos == 'end') { + $before = $source[item]; + $after = array(); + } elseif ($pos == 'new') { + $before = array(); + $after = array(); + } else { + $before = array_splice($source[item], 0, $pos+1); + $after = $source[item]; + } + + // build the new array + $target[status] = false; + $target['Id'] = $source['Id']; + $n = 0; + + foreach($before as $nr=>$key) { // add first entrys + $target[$n]['key'] = $before[$nr]['key']; + $target[$n]['value'] = $before[$nr]['value']; + $n++; + } + + foreach($newKey as $nr=>$key) { // add new entrys + if ($key<>'') { + $target[$n]['key'] = $key; + + /* + if ($Id == _DEFAULT_LANG_) { + // value=key only in default language + $target[$n]['value'] = $key; + } else { + */ + $target[$n]['value'] = ''; + /* + } + */ + $n++; + } + } + + if (is_array($after)) { + foreach($after as $nr=>$key) { // add first entrys + $target[$n][key] = $after[$nr][key]; + $target[$n][value] = $after[$nr][value]; + $n++; + } + } + + $xml = Data::convArr2XML($target); + $realpath = Data::_realTransPath($file, $Id, 'xml'); + Data::writeXML2File($realpath, $xml); + } + echo ''; + } + + function _findLangFilesIds($file) + { + $files = File_Find::mapTreeMultiple($file[dir], 1); + foreach($files as $key=>$filename) { + if (preg_match("/$file[base]\.[^.]*\.[^.]*\.xml/", $filename)) { + list($lost, $code, $name, $lost) = explode('.', $filename); + $langIds[] = $code.'.'.$name; + } + } + + return $langIds; + } + + function removeEntryFromXML($file, $pos) + { + // go throught all files matching $file[base] in $file[dir] and remove selected entry + + $Ids = Data::_findLangFilesIds($file); + foreach($Ids as $lost=>$Id) { + $target = Data::readTransXML2Arr($file, $Id); + unset($target[item][$pos]); // remove selected entry + + $xml = Data::convArr2XML($target); + $realpath = Data::_realTransPath($file, $Id, 'xml'); + Data::writeXML2File($realpath, $xml); + } + } + + function swapEntrysOnXML($file, $pos1, $pos2) + { + // go throught all files matching $file[base] in $file[dir] and swap selected entrys + + $Ids = Data::_findLangFilesIds($file); + foreach($Ids as $lost=>$Id) { + $target = Data::readTransXML2Arr($file, $Id); + + $swap[item][$pos1] = $target[item][$pos2]; // swap 2 entrys + $swap[item][$pos2] = $target[item][$pos1]; + + $target[item][$pos1] = $swap[item][$pos1]; // build target array + $target[item][$pos2] = $swap[item][$pos2]; + + $xml = Data::convArr2XML($target); + $realpath = Data::_realTransPath($file, $Id, 'xml'); + Data::writeXML2File($realpath, $xml); + } + } + + function searchFilesRec($startdir, $pattern, $sep) + { + $structure = File_Find::mapTreeMultiple($startdir); + + foreach($structure as $dir=>$file) { + if (is_array($file)) { // itīs a directory + $filelist .= Data::searchFilesRec($startdir.'/'.$dir, $pattern, $sep); + } else { // itīs a file + if (preg_match($pattern, $file)) { + $filelist .= $sep.$startdir.'/'.$file; + } + } + } + + return $filelist; + + } + + function createLangFilesRec($Id) + { + // go through subdirectorys and create language files for given Id + + $search = '/('._PREFIX_.'|'._PREFIX_GLOBAL_.').'._DEFAULT_LANG_.'.xml/'; ## grad geändert + $sep = '|'; + + $replace = '/'._DEFAULT_LANG_.'.xml/'; + $replacement = $Id.'.xml'; + + $files = Data::searchFilesRec(_START_DIR_, $search, $sep); + $files = explode($sep, $files); + + foreach ($files as $pathname) { + if ($pathname) { + $base = explode('.', basename($pathname)); + $file = array('base' => $base[0], + 'dir' => dirname($pathname)); + $arr = Data::readTransXML2Arr($file, _DEFAULT_LANG_, 0); // read the default file + $arr['Id'] = $Id; + if (is_array($arr['item'])) { + foreach($arr[item] as $key=>$val) { + unset($arr[item][$key][value]); + } + } + $handle =& Data::getInstance(); + $xml = $handle->convArr2XML($arr); + $newpathname = preg_replace($replace, $replacement, $pathname); + + if (!file_exists($newpathname)) { + $handle->writeXML2File($newpathname, $xml); // if file already exists -> skip + } + } + } + } + + function langId2Name($id, $type='xml') + { + + if ($arr = Data::readXML2Arr('./languages.xml')) { + $languages = $arr[language]; + unset($arr); + }else { + return 'cannot open languages.xml
'; + } + + foreach($languages as $nr=>$lang) { + if ($lang['Id'] == $id) { + return $lang[Name]; + } + } + } + + function langName2Id($name, $type='xml') + { + if ($arr = Data::readXML2Arr('./languages.xml')) { + $languages = $arr[language]; + unset($arr); + }else { + return 'cannot open languages.xml
'; + } + + foreach($languages as $nr=>$lang) { + if ($lang[Name] == $name) { + return $lang['Id']; + } + } + } + + function getLanguages() + { + switch (_LANG_BASE_) { + case 'xml': + if ($arr = Data::readXML2Arr('./languages.xml')) { + $languages = $arr[language]; + unset($arr); + }else { + return getGS('cannot read $1', 'languages.xml').'
'; + } + break; + + case 'campsite': + if ($languages = DB_Handle::readCSLang2Arr()) { + // do nothing + } else { + return getGS('cannot read $1', 'campsite.Languages').'
'; + } + break; + } + + return $languages; + } + + + function collectExprTPL($file) + { + $n = 0; + + $filePattern = '/(.*).tpl/'; // all .php files + $functPattern1 = '/##([^#]+)##/iU'; // like getGS('edit "$1"', ...); + + $sep = '|'; + $filelist = explode($sep, Data::searchFilesRec($file[dir], $filePattern, $sep)); + #print_r($filelist); + + if (count($filelist)==0) + return FALSE; + + foreach ($filelist as $name) { // read in all the files + $data = array_merge($data, file($name)); + } + #print_r($data); + + if (count($data)==0) + return FALSE; + + foreach ($data as $line) { + if (preg_match_all($functPattern1, $line, $m)) { // collact all matches + foreach ($m[1] as $match) { + $n++; + $matches[$match] = $n; + } + } + } + + if (is_array($matches)==FALSE) + return FALSE; + + $matches = array_flip($matches); + asort($matches); + + return $matches; + + } + + + function collectExprPHP($file) + { + $n = 0; + + $filePattern = '/(.*).php/'; // all .php files + $functPattern1 = '/tra( )*\(( )*\'([^\']*)\'/iU'; // like tra('edit "$1"', ...); ' + $functPattern2 = '/tra( )*\(( )*"([^"]*)"/iU'; // like tra("edit '$1'", ...); " + + $files = File_Find::mapTreeMultiple($file['dir'], 1); + + foreach ($files as $name) { + if (preg_match($filePattern, $name)) { + $filelist[] = $name; // list of .php-scripts in this folder + } + } + + if (count($filelist)==0) + return FALSE; + + foreach ($filelist as $name) { // read in all the files + $data = array_merge($data, file($file[dir].'/'.$name)); + } + + if (count($data)==0) + return FALSE; + + foreach ($data as $line) { + if (preg_match_all($functPattern1, $line, $m)) { // collact all matches + foreach ($m[3] as $match) { + $n++; + $matches[$match] = $n; + } + } + + if (preg_match_all($functPattern2, $line, $m)) { // collact all matches + foreach ($m[3] as $match) { + $n++; + $matches[$match] = $n; + + } + } + } + + if (is_array($matches)==FALSE) + return FALSE; + + $matches = array_flip($matches); + asort($matches); + + return $matches; + + } +} +?> \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/localizer/display.inc.php b/livesupport/modules/htmlUI/var/localizer/display.inc.php new file mode 100755 index 000000000..3dd40e702 --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/display.inc.php @@ -0,0 +1,453 @@ + + + + + '; + + + if ($file[Id] != _DEFAULT_LANG_) { + + /* + if ($onlyUntranslated=='on') { + $checker = ' checked'; + } + */ + if (!$file['sourceId']) { + $file['sourceId'] = _DEFAULT_LANG_; + } + + $html .= ' + + + + + + '; + } + + $s = Data::convArr2GS($source); + $t = Data::convArr2GS($target); + $nr = 0; + + if (is_array($s)) { + while (list($key, $value) = each($s)) { + + if (!$value) { // item in default-lang-file was not translated + $value = $key; + } + + if (isset($t[$key]) && (trim($t[$key])!='')) { + $insval = Data::convStr($t[$key], 0, 1, 0); + $pre = ''; + $post = ''; + } else { + $insval = ''; + $pre = ''; + $post = ''; + } + + $displKey = Data::convStr($key, 0, 0, !_DENY_HTML_); + + if ($onlyUntranslated && !empty($t[$key])) { + $html .= " + "; + } else { + $html .= ''; + $html .= ''; + } + $nr++; + } + } + + $html .= ' + + + + +
+ '.getGS('source:').' '.Data::langPath($file, $source[Id], 'xml').'
+ '.getGS('target:').' '.Data::langPath($file, $target[Id], 'xml').'
+ + + + + +

'. + Display::sourceLangMenu($file[sourceId], $file).' + +

+ +

'; + + if ($target[Id] == _DEFAULT_LANG_) { + $html .= "".getGS('key:')." $pre$displKey$post
\n"; + } else { + if ($source[item][$nr][from]) { + $html .= "$source[Id]: $pre".$source[item][$nr][from]."$post
\n"; + } else { + $html .= ""._DEFAULT_LANG_.": $pre$value$post
\n"; + } + } + + $html .= ""; + $html .= ""; + $html .= "
\n"; + + if ($target[Id] == _DEFAULT_LANG_) { // default language => can change keys + $fileparms = "Id=$source[Id]&base=$file[base]&dir=$file[dir]"; + + if ($nr==0) { // swap last and first entry + $prev = count($s)-1; + $next = $nr+1; + } elseif ($nr == count($s)-1) { // swap last and first entry + $prev = $nr-1; + $next = 0; + } else { // swap entrys linear + $prev = $nr-1; + $next = $nr+1; + } + + + $rem_href = _PANEL_SCRIPT_."?action=removeEntryFromXML&pos=$nr&$fileparms"; + $mv_up_href = _PANEL_SCRIPT_."?action=swapEntrysOnXML&pos1=$nr&pos2=$prev&$fileparms"; + $mv_down_href = _PANEL_SCRIPT_."?action=swapEntrysOnXML&pos1=$nr&pos2=$next&$fileparms"; + + $html .= '
'. + "
". + ''; + } + + $html .= '

+ '.getGS('fully translated').' +      + +
'; + + return $html; + } + + function sourceLangMenu ($currId, $file) + { + switch (_LANG_BASE_) { + case 'xml': + if ($arr = Data::readXML2Arr('./languages.xml')) { + $languages = $arr[language]; + unset($arr); + }else { + return getGS('cannot read $1', 'languages.xml').'
'; + } + break; + + case 'campsite': + if ($languages = DB_Handle::readCSLang2Arr()) { + + } else { + return getGS('cannot read $1', 'campsite.Languages').'
'; + } + break; + } + + foreach ($languages as $key=>$val) { + if (!(file_exists("$file[dir]/$file[base].$val[Id].xml") && ($file[Id] != $val[Id]))) { + unset($languages[$key]); + } + } + + $menu .= + getGS('translate from:').' +   + '; + + return $menu; + } + + function _langMenuOptions ($languages, $currId) + { + foreach($languages as $key=>$val) { + + if ($currId == $val[Id]) { + $curr = 'selected'; + } else { + unset($curr); + } + + $options .= "\n"; + } + + return $options; + } + + function createLangMenu ($currId) + { + $languages = Data::getLanguages(); + + $menu .= ' +
+ + +
+ +
'; + + return $menu; + } + + function createTOLLangMenu ($currId) + { + $languages = Data::getLanguages(); + + $menu .= ' +
+ +
+ +
'; + + return $menu; + } + + function manageLangButton() + { + $html = ' +
+ + +
'; + + return $html; + } + + function manageLangForm() + { + $languages = Data::getLanguages(); + + $html .= ' + + + + + + + + + '; + + foreach($languages as $nr=>$l) { + $editLink = ''.getGS('edit').''; + $delLink = ''.getGS('delete').''; + $html .= ""; + } + + + return $html; + } + + function parseFolder($dirname, $depth=0) + { + $space = 2; + + $structure = File_Find::mapTreeMultiple($dirname); + ksort($structure, SORT_STRING); + #print_r($structure); + + if ($depth == 0) { + $html .= str_repeat(' ',$depth * $space).''.strtoupper(' / ')."\n"; + } + + foreach($structure as $dir=>$file) { + if (is_array($file)) { // itīs a directory + unset($base); + unset($baseadd); + + if (!(substr($dir, 0, strlen(_PREFIX_HIDE_)) == _PREFIX_HIDE_)) { // hide special dirs + $html .= str_repeat(' ', ($depth+1) * $space).''.strtoupper($dir)."\n"; + $html .= Display::parseFolder($dirname.'/'.$dir, $depth+1); + } + } else { // itīs a file + if (((strpos(' '.$file, _PREFIX_) == 1) || (strpos(' '.$file, _PREFIX_GLOBAL_) == 1)) + && + (substr($file, strlen($file) - 4) == '.xml')) { + + if (!_MAINTAINANCE_ && preg_match("/[^.]*\."._DEFAULT_LANG_."\.xml/", $file)) { + // skip default language if not maintainance mode + } else { + $Id = explode('.', $file); + $html .= str_repeat(' ', ($depth+1) * $space).''.$file."\n"; + } + } + } + + } + + if ($depth == 0) { + return "
$html
"; + } else { + return $html; + } + } + + function addEntrySelection($arr, $file) + { + $html = ' +
+ + + + + + '.getGS('add new fields:').' + + + + '; + + if (_MAINTAINANCE_) + $html .= ' + + '; + + return $html; + } + + function addEntry2XML($file, $pos, $amount) + { + // check input + if (!isInt($amount)) { + return getGS('go').' '.getGS('back').' '.getGS('and enter a positive integer value'); + } + + $html .= ' + +
'.getGS('name').''.getGS('native name').''.getGS('code').''.getGS('edit').''.getGS('delete').'
$l[Name]$l[NativeName]$l[Code]$editLink$delLink
+ + + + + '; + + for($n=1; $n<=$amount; $n++) { + $html .= ""; + } + + $html .= + ' +
+ '; + return $html; + } + + function newLangFilePref($dir) + { + // at first check if default files already exists + $handle = opendir ($dir); + while (false !== ($file = readdir ($handle))) { + $exists[$file] = true; + } + closedir($handle); + + $html .= ' + '.getGS('create new language file in').' '.strtoupper($dir).' +
+ + '; + + if ($dir == _START_DIR_.'/') { + if ($exists[_PREFIX_.'.'._DEFAULT_LANG_.'.xml'] && $exists[_PREFIX_GLOBAL_.'.'._DEFAULT_LANG_.'.xml']) { + return getGS('$1 and $2 files already exist in $3', _PREFIX_, _PREFIX_GLOBAL_, strtoupper($dir)); + } else { + if ($exists[_PREFIX_GLOBAL_.'.'._DEFAULT_LANG_.'.xml']) { + $globals .= ' disabled'; + $locals .= ' checked'; + } + if ($exists[_PREFIX_.'.'._DEFAULT_LANG_.'.xml']) { + $locals .= ' disabled'; + $globals .= ' checked'; + } + + $html .= ' + Type:
+ '._PREFIX_.' + '._PREFIX_GLOBAL_; + } + } else { + if ($exists[_PREFIX_.'.'._DEFAULT_LANG_.'.xml']) { + return getGS('$1 file already exist in $2', _PREFIX_, strtoupper($dir)); + } else { + $html .= ''; + } + } + + $html .= ' +
+ '.getGS('entrys:').'
+ + + +
'; + + return $html; + } + + function newLangFileForm($amount, $base, $dir) + { + // check input + if (!$base) { + return getGS('go').' '.getGS('back').' '.getGS('and select file type'); + } + if (!isInt($amount)) { + return getGS('go').' '.getGS('back').' '.getGS('and enter a positive integer value'); + } + + $html .= ' + '.getGS('create new language file $1', strtoupper($dir).'/'.$base.'.'._DEFAULT_LANG_.'.xml').' +
+ + + + '; + + for($n=1; $n<=$amount; $n++) { + $html .= ""; + } + + $html .= + ' +
+
'; + return $html; + } +} +?> \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/localizer/header.html b/livesupport/modules/htmlUI/var/localizer/header.html new file mode 100755 index 000000000..e42a79376 --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/header.html @@ -0,0 +1,13 @@ + + + + + + + + + + + + diff --git a/livesupport/modules/htmlUI/var/localizer/helpfunctions.php b/livesupport/modules/htmlUI/var/localizer/helpfunctions.php new file mode 100755 index 000000000..b57b4dead --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/helpfunctions.php @@ -0,0 +1,142 @@ +".nl2br(str_replace( "\t", '    ', htmlentities($input)))."

"; +} + + +function ArrayToHTML($input) +{ + return "

".nl2br(str_replace(" ", " ", print_r($input, true)))."

"; +} + + +function pl($input) +{ + echo "

$input

"; +} + +if (!function_exists('cropstr')) { + function cropStr ($input, $length, $char='') + { + if (is_numeric($length)) { + if ($char) { + if (strpos ($input, $char)) { + $len = strrpos(substr($input, 0, $length), $char); + } + } else { + $len = $length; + } + $output = substr ($input, 0, $len); + if (strlen ($input)>$len) { + $output .= "..."; + } + } else { + return $input; + } + + return $output; + } +} + +function isInt ($in, $noZero = true) +{ + if ($noZero && !($in>0)) { + return false; + } + if (preg_match('/^[0-9]*$/', $in)) { + return true; + } + + return false; +} + +function Error($msg) +{ + $GLOBALS[error][msg] .= "
$msg
"; +} + +if (!function_exists('putGS')) { + function putGS($s) + { + global $gs, $TOL_Language; + $nr=func_num_args(); + if (!isset($gs[$s]) || ($gs[$s]=='')) + $my="$s (not translated)"; + else + $my= $gs[$s]; + if ($nr>1) + for ($i=1;$i<$nr;$i++){ + $name='$'.$i; + $val=func_get_arg($i); + $my=str_replace($name,$val,$my); + } + echo $my; + } +} + +if (!function_exists('getGS')) { + function getGS($s) + { + global $gs, $TOL_Language; + $nr=func_num_args(); + if (!isset($gs[$s]) || ($gs[$s]=='') ) + $my="$s (not translated)"; + else + $my= $gs[$s]; + if ($nr>1) + for ($i=1;$i<$nr;$i++){ + $name='$'.$i; + $val=func_get_arg($i); + $my=str_replace($name,$val,$my); + } + return $my; + } +} + +function loadLanguageFiles($path, $base) +{ + global $gs; + + if (!isset($_COOKIE['TOL_Language'])){ + $_COOKIE['TOL_Language'] = Data::langName2Id(_DEFAULT_LANG_); + } + + $languages = Data::getLanguages(); + + foreach($languages as $lang) { + if($lang['Code'] == $_COOKIE['TOL_Language']) { + $Id = $lang['Id']; + break; + } + } + + + $langfile[dir] = $path; + $langfile[base] = $base; + $defG = Data::readTransXML2Arr($langfile, _DEFAULT_LANG_); + $defG = Data::convArr2GS($defG); + $usrG = Data::readTransXML2Arr($langfile, $Id); + $usrG = Data::convArr2GS($usrG); + $gs = array_merge($gs, $defG, $usrG); + +} + + +function &loadTranslations($langId) +{ + ## use this to load the translations for livesupport ######################## + + $langfile=array('dir' => '..', + 'base' => 'locals'); + + $defG = Data::readTransXML2Arr($langfile, $langId); + $defG = Data::convArr2GS($defG); + $usrG = Data::readTransXML2Arr($langfile, $langId); + $usrG = Data::convArr2GS($usrG); + $gs = array_merge($gs, $defG, $usrG); + + return $gs; +} +?> \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/localizer/index.php b/livesupport/modules/htmlUI/var/localizer/index.php new file mode 100755 index 000000000..0efa55354 --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/index.php @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/livesupport/modules/htmlUI/var/localizer/langCodex.xml b/livesupport/modules/htmlUI/var/localizer/langCodex.xml new file mode 100755 index 000000000..ba56bd236 --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/langCodex.xml @@ -0,0 +1,571 @@ + + + + aa + Afar + + + ab + Abkhazian + + + af + Afrikaans + + + am + Amharic + + + ar + Arabic + + + as + Assamese + + + ay + Aymara + + + az + Azerbaijani + + + ba + Bashkir + + + be + Byelorussian + + + bg + Bulgarian + + + bh + Bihari + + + bi + Bislama + + + bn + Bengali; Bangla + + + bo + Tibetan + + + br + Breton + + + ca + Catalan + + + co + Corsican + + + cs + Czech + + + cy + Welsh + + + da + Danish + + + de + German + + + dz + Bhutani + + + el + Greek + + + en + English + + + eo + Esperanto + + + es + Spanish + + + et + Estonian + + + eu + Basque + + + fa + Persian + + + fi + Finnish + + + fj + Fiji + + + fo + Faeroese + + + fr + French + + + fy + Frisian + + + ga + Irish + + + gd + Scots, Gaelic + + + gl + Galician + + + gn + Guarani + + + gu + Gujarati + + + he + Hebrew + + + ha + Hausa + + + hi + Hindi + + + hr + Croatian + + + hu + Hungarian + + + hy + Armenian + + + ia + Interlingua + + + id + Indonesian + + + ie + Interlingue + + + ik + Inupiak + + + in + Indonesian + + + is + Icelandic + + + it + Italian + + + iu + Inuktitut + + + iw + Hebrew (obsolete) + + + ja + Japanese + + + ji + Yiddish (obsolete) + + + jw + Javanese + + + ka + Georgian + + + kk + Kazakh + + + kl + Greenlandic + + + km + Cambodian + + + kn + Kannada + + + ko + Korean + + + ks + Kashmiri + + + ku + Kurdish + + + ky + Kirghiz + + + la + Latin + + + ln + Lingala + + + lo + Laothian + + + lt + Lithuanian + + + lv + Latvian, Lettish + + + mg + Malagasy + + + mi + Maori + + + mk + Macedonian + + + ml + Malayalam + + + mn + Mongolian + + + mo + Moldavian + + + mr + Marathi + + + ms + Malay + + + mt + Maltese + + + my + Burmese + + + na + Nauru + + + ne + Nepali + + + nl + Dutch + + + no + Norwegian + + + oc + Occitan + + + om + (Afan), Oromo + + + or + Oriya + + + pa + Punjabi + + + pl + Polish + + + ps + Pashto, Pushto + + + pt + Portuguese + + + qu + Quechua + + + rm + Rhaeto-Romance + + + rn + Kirundi + + + ro + Romanian + + + ru + Russian + + + rw + Kinyarwanda + + + sa + Sanskrit + + + sd + Sindhi + + + sg + Sangro + + + sh + Serbo-Croatian + + + si + Singhalese + + + sk + Slovak + + + sl + Slovenian + + + sm + Samoan + + + sn + Shona + + + so + Somali + + + sq + Albanian + + + sr + Serbian + + + ss + Siswati + + + st + Sesotho + + + su + Sundanese + + + sv + Swedish + + + sw + Swahili + + + ta + Tamil + + + te + Tegulu + + + tg + Tajik + + + th + Thai + + + ti + Tigrinya + + + tk + Turkmen + + + tl + Tagalog + + + tn + Setswana + + + to + Tonga + + + tr + Turkish + + + ts + Tsonga + + + tt + Tatar + + + tw + Twi + + + ug + Uigur + + + uk + Ukrainian + + + ur + Urdu + + + uz + Uzbek + + + vi + Vietnamese + + + vo + Volapuk + + + wo + Wolof + + + xh + Xhosa + + + y + Yiddish + + + yo + Yoruba + + + za + Zuang + + + zh + Chinese + + + zu + Zulu + + diff --git a/livesupport/modules/htmlUI/var/localizer/langConv.php b/livesupport/modules/htmlUI/var/localizer/langConv.php new file mode 100755 index 000000000..4ee126a4b --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/langConv.php @@ -0,0 +1,7 @@ +$text) { + list($code, $name) = explode(' ', $text); + echo "\n\t".trim($code)."\n\t".trim($name)."\n\n"; +} +?> \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/localizer/languages.txt b/livesupport/modules/htmlUI/var/localizer/languages.txt new file mode 100755 index 000000000..93e13f353 --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/languages.txt @@ -0,0 +1,142 @@ +aa Afar +ab Abkhazian +af Afrikaans +am Amharic +ar Arabic +as Assamese +ay Aymara +az Azerbaijani +ba Bashkir +be Byelorussian +bg Bulgarian +bh Bihari +bi Bislama +bn Bengali; Bangla +bo Tibetan +br Breton +ca Catalan +co Corsican +cs Czech +cy Welsh +da Danish +de German +dz Bhutani +el Greek +en English +eo Esperanto +es Spanish +et Estonian +eu Basque +fa Persian +fi Finnish +fj Fiji +fo Faeroese +fr French +fy Frisian +ga Irish +gd Scots, Gaelic +gl Galician +gn Guarani +gu Gujarati +he Hebrew +ha Hausa +hi Hindi +hr Croatian +hu Hungarian +hy Armenian +ia Interlingua +id Indonesian +ie Interlingue +ik Inupiak +in Indonesian +is Icelandic +it Italian +iu Inuktitut +iw Hebrew (obsolete) +ja Japanese +ji Yiddish (obsolete) +jw Javanese +ka Georgian +kk Kazakh +kl Greenlandic +km Cambodian +kn Kannada +ko Korean +ks Kashmiri +ku Kurdish +ky Kirghiz +la Latin +ln Lingala +lo Laothian +lt Lithuanian +lv Latvian, Lettish +mg Malagasy +mi Maori +mk Macedonian +ml Malayalam +mn Mongolian +mo Moldavian +mr Marathi +ms Malay +mt Maltese +my Burmese +na Nauru +ne Nepali +nl Dutch +no Norwegian +oc Occitan +om (Afan), Oromo +or Oriya +pa Punjabi +pl Polish +ps Pashto, Pushto +pt Portuguese +qu Quechua +rm Rhaeto-Romance +rn Kirundi +ro Romanian +ru Russian +rw Kinyarwanda +sa Sanskrit +sd Sindhi +sg Sangro +sh Serbo-Croatian +si Singhalese +sk Slovak +sl Slovenian +sm Samoan +sn Shona +so Somali +sq Albanian +sr Serbian +ss Siswati +st Sesotho +su Sundanese +sv Swedish +sw Swahili +ta Tamil +te Tegulu +tg Tajik +th Thai +ti Tigrinya +tk Turkmen +tl Tagalog +tn Setswana +to Tonga +tr Turkish +ts Tsonga +tt Tatar +tw Twi +ug Uigur +uk Ukrainian +ur Urdu +uz Uzbek +vi Vietnamese +vo Volapuk +wo Wolof +xh Xhosa +y Yiddish +yo Yoruba +za Zuang +zh Chinese +zu Zulu diff --git a/livesupport/modules/htmlUI/var/localizer/languages.xml b/livesupport/modules/htmlUI/var/localizer/languages.xml new file mode 100755 index 000000000..3ea845e74 --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/languages.xml @@ -0,0 +1,28 @@ + + + + en.English + English(GB) + English + + + cz.Czech + Czech(CZ) + Czech + + + nl.Dutch + Dutch(NL) + Dutch + + + de.German + Deutsch(DE) + Deutsch + + + hu.Hungarian + Hungarian(HU) + Hungarian + + diff --git a/livesupport/modules/htmlUI/var/localizer/localizer.css b/livesupport/modules/htmlUI/var/localizer/localizer.css new file mode 100755 index 000000000..ae9af9c19 --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/localizer.css @@ -0,0 +1,47 @@ +/* Body */ +BODY { + margin: 10px 10px 10px 10px; + background-color : #FFFFFF ; + color : #000000; + font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; + font-size: 12px; + color: #333333; + } + +td,tr,p,div,input,select { + font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; + font-size: 12px; + } + +a { + color : #FF6600; + font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; + font-weight : normal; + text-decoration : none; +} + +a:hover { + color : #808080; + font-size : 12px; + font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; + font-weight : normal; + text-decoration : underline; +} + +a:active { + color : #FFFFFF; + background-color : #FF6600; + font-size : 12px; + font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; + font-weight : normal; + text-decoration : underline; +} + +.error { + color : red; + font-size : 12px; + font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; + font-weight : normal; +} + +} \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/localizer/locals.cz.Czech.xml b/livesupport/modules/htmlUI/var/localizer/locals.cz.Czech.xml new file mode 100644 index 000000000..328c9de5e --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/locals.cz.Czech.xml @@ -0,0 +1,122 @@ + + + cz.Czech + checked + + collect expressions + + + localizer + + + $1 file already exist in $2 + + + edit "$1" + + + edit '$1' + + + create new language file $1 + + + create new language file in + + + delete + + + edit + + + entrys: + + + $1 and $2 files already exist in $3 + + + ok + + + add new fields: + + + name + + + native name + + + code + + + source: + + + target: + + + manage languages + + + choose language + + + key: + + + cannot open $1 + + + key "$1" already exists in $2-file + + + show only untranslated + + + cannot read $1 + + + translate from: + + + really delete this entry? + + + fully translated + + + after + + + go + + + back + + + and select file type + + + and enter a positive integer value + + + save to file + + + add new language + + + create language files + + + at begin + + + at end + + + key + + \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/localizer/locals.de.German.xml b/livesupport/modules/htmlUI/var/localizer/locals.de.German.xml new file mode 100755 index 000000000..f41f8c7e4 --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/locals.de.German.xml @@ -0,0 +1,161 @@ + + + + en.English + + collect expressions + + + + localizer + localizer + + + $1 file already exist in $2 + $1 file already exist in $2 + + + edit "$1" + edit "$1" + + + edit '$1' + edit '$1' + + + create new language file $1 + create new language file $1 + + + create new language file in + create new language file in + + + delete + delete + + + edit + edit + + + entrys: + entrys: + + + $1 and $2 files already exist in $3 + $1 and $2 files already exist in $3 + + + ok + ok + + + add new fields: + add new fields: + + + name + name + + + native name + native name + + + code + code + + + source: + source: + + + target: + target: + + + manage languages + manage languages + + + choose language + choose language + + + key: + key: + + + cannot open $1 + cannot open $1 + + + key "$1" already exists in $2-file + key "$1" already exists in $2-file + + + show only untranslated + show only untranslated + + + cannot read $1 + cannot read $1 + + + translate from: + translate from: + + + really delete this entry? + really delete this entry? + + + fully translated + completely processed + + + after + after + + + go + go + + + back + back + + + and select file type + and select file type + + + and enter a positive integer value + and enter a positive integer value + + + save to file + save to file + + + add new language + add new language + + + create language files + create language files + + + at begin + at begin + + + at end + at end + + + key + key + + \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/localizer/locals.en.English.xml b/livesupport/modules/htmlUI/var/localizer/locals.en.English.xml new file mode 100755 index 000000000..44b26e908 --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/locals.en.English.xml @@ -0,0 +1,161 @@ + + + en.English + checked + + collect expressions + collect expressions + + + localizer + localizer + + + $1 file already exist in $2 + $1 file already exist in $2 + + + edit "$1" + edit "$1" + + + edit '$1' + edit '$1' + + + create new language file $1 + create new language file $1 + + + create new language file in + create new language file in + + + delete + delete + + + edit + edit + + + entrys: + entrys: + + + $1 and $2 files already exist in $3 + $1 and $2 files already exist in $3 + + + ok + ok + + + add new fields: + add new fields: + + + name + name + + + native name + native name + + + code + code + + + source: + source: + + + target: + target: + + + manage languages + manage languages + + + choose language + choose language + + + key: + key: + + + cannot open $1 + cannot open $1 + + + key "$1" already exists in $2-file + key "$1" already exists in $2-file + + + show only untranslated + show only untranslated + + + cannot read $1 + cannot read $1 + + + translate from: + translate from: + + + really delete this entry? + really delete this entry? + + + fully translated + completely processed + + + after + after + + + go + go + + + back + back + + + and select file type + and select file type + + + and enter a positive integer value + and enter a positive integer value + + + save to file + save to file + + + add new language + add new language + + + create language files + create language files + + + at begin + at begin + + + at end + at end + + + key + key + + \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/localizer/locals.hu.Hungarian.xml b/livesupport/modules/htmlUI/var/localizer/locals.hu.Hungarian.xml new file mode 100644 index 000000000..a66e78abf --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/locals.hu.Hungarian.xml @@ -0,0 +1,122 @@ + + + hu.Hungarian + checked + + collect expressions + + + localizer + + + $1 file already exist in $2 + + + edit "$1" + + + edit '$1' + + + create new language file $1 + + + create new language file in + + + delete + + + edit + + + entrys: + + + $1 and $2 files already exist in $3 + + + ok + + + add new fields: + + + name + + + native name + + + code + + + source: + + + target: + + + manage languages + + + choose language + + + key: + + + cannot open $1 + + + key "$1" already exists in $2-file + + + show only untranslated + + + cannot read $1 + + + translate from: + + + really delete this entry? + + + fully translated + + + after + + + go + + + back + + + and select file type + + + and enter a positive integer value + + + save to file + + + add new language + + + create language files + + + at begin + + + at end + + + key + + \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/localizer/locals.nl.Dutch.xml b/livesupport/modules/htmlUI/var/localizer/locals.nl.Dutch.xml new file mode 100644 index 000000000..8415f6d0d --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/locals.nl.Dutch.xml @@ -0,0 +1,122 @@ + + + nl.Dutch + checked + + collect expressions + + + localizer + + + $1 file already exist in $2 + + + edit "$1" + + + edit '$1' + + + create new language file $1 + + + create new language file in + + + delete + + + edit + + + entrys: + + + $1 and $2 files already exist in $3 + + + ok + + + add new fields: + + + name + + + native name + + + code + + + source: + + + target: + + + manage languages + + + choose language + + + key: + + + cannot open $1 + + + key "$1" already exists in $2-file + + + show only untranslated + + + cannot read $1 + + + translate from: + + + really delete this entry? + + + fully translated + + + after + + + go + + + back + + + and select file type + + + and enter a positive integer value + + + save to file + + + add new language + + + create language files + + + at begin + + + at end + + + key + + \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/localizer/main.php b/livesupport/modules/htmlUI/var/localizer/main.php new file mode 100755 index 000000000..87a7b5604 --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/main.php @@ -0,0 +1,179 @@ +readTransXML2Arr($file, _DEFAULT_LANG_); + $gs = $data->convArr2GS($arr); + print_r($gs); + + break; + + case 'translate': // translate an xml-file + case 'save_translation': + + $file = array('dir' => $_REQUEST['dir'], + 'base' => $_REQUEST['base'], + 'Id' => $_REQUEST['Id'], + 'sourceId' => $_REQUEST[sourceId]); + + if ($_REQUEST[action] == "save_translation") { + $data->saveTrans2XML($file, $_REQUEST[data]); + loadLanguageFiles('..', 'globals'); // maybee localizers expressions are changed->reload + loadLanguageFiles('', 'locals'); + } + + $source = $data->readTransXML2Arr($file, _DEFAULT_LANG_); + $target = $data->readTransXML2Arr($file, $_REQUEST['Id']); + + if ($_REQUEST[sourceId]) { // translate from + $from = $data->readTransXML2Arr($file, $_REQUEST[sourceId]); + $source['Id'] = $from['Id']; + foreach($from[item] as $nr=>$item) { + if($item[value]) { + $source[item][$nr][from] = $item[value]; + } + } + } + + $output .= Display::transForm($source, $target, $file, $_REQUEST[onlyUntranslated]); + + if ($_REQUEST['Id'] == _DEFAULT_LANG_) { + $output .= Display::addEntrySelection($source, $file); + } + + break; + + + case 'addEntryForm': + $file = array('dir' => $_REQUEST['dir'], + 'base' => $_REQUEST['base'], + 'Id' => $_REQUEST['Id']); + + $output .= Display::addEntry2XML($file, $_REQUEST['pos'], $_REQUEST['amount']); + + break; + + + case 'addEntry2XML': + $file = array('dir' => $_REQUEST['dir'], + 'base' => $_REQUEST['base'], + 'Id' => _DEFAULT_LANG_); + + $msg = Data::checkKeys($file, $_REQUEST[newKey]); + if ($msg[err]) { + foreach ($msg[err] as $val=>$err) { + Error($err); + while ($key = array_search($val, $_REQUEST[newKey])) { + unset($_REQUEST[newKey][$key]); + } + } + } + + if (count($_REQUEST[newKey])) { // skip if all was unset above + $data->addEntry2XML($file, $_REQUEST[pos], $_REQUEST[newKey]); + } + + $source = $data->readTransXML2Arr($file, _DEFAULT_LANG_); + $target = $data->readTransXML2Arr($file, $_REQUEST['Id']); + + $output .= Display::transForm($source, $target, $file); + $output .= Display::addEntrySelection($source, $file); + + break; + + case 'removeEntryFromXML': + $file = array('dir' => $_REQUEST['dir'], + 'base' => $_REQUEST['base'], + 'Id' => _DEFAULT_LANG_); + + $data->removeEntryFromXML($file, $_REQUEST[pos]); + + $source = $data->readTransXML2Arr($file, _DEFAULT_LANG_); + $target = $data->readTransXML2Arr($file, $_REQUEST['Id']); + + $output .= Display::transForm($source, $target, $file); + $output .= Display::addEntrySelection($source, $file); + + break; + + case 'swapEntrysOnXML': + $file = array('dir' => $_REQUEST['dir'], + 'base' => $_REQUEST['base'], + 'Id' => _DEFAULT_LANG_); + + $data->swapEntrysOnXML($file, $_REQUEST[pos1], $_REQUEST[pos2]); + + $source = $data->readTransXML2Arr($file, _DEFAULT_LANG_); + $target = $data->readTransXML2Arr($file, $_REQUEST['Id']); + + $output .= Display::transForm($source, $target, $file); + $output .= Display::addEntrySelection($source, $file); + + break; + + case 'newLangFilePref': + $output .= Display::newLangFilePref($_REQUEST['dir'], $_REQUEST[denied]); + + break; + + case 'newLangFileForm': + $output .= Display::newLangFileForm($_REQUEST[amount], $_REQUEST['base'], $_REQUEST['dir']); + + break; + + case 'storeNewLangFile': + $file = array('dir' => $_REQUEST['dir'], + 'base' => $_REQUEST['base'], + 'Id' => _DEFAULT_LANG_); + + $data->addEntry2XML($file, 'new', $_REQUEST[newKey]); + + break; + + case 'manageLanguages': + $output .= Display::manageLangForm(); + + break; + + case 'collectExpr': + $file = array('dir' => $_REQUEST['dir'], + 'base' => $_REQUEST['base'], + 'Id' => _DEFAULT_LANG_); + + #$newKeys = Data::collectExprPHP($file); + $newKeys = Data::collectExprTPL($file); + + $msg = Data::checkKeys($file, $newKeys); + + if ($msg[err]) { + foreach ($msg[err] as $val=>$err) { + #Error($err); + while ($key = array_search($val, $newKeys)) { + unset($newKeys[$key]); + } + } + } + + if (count($newKeys)) { // skip if all was unset above + $data->addEntry2XML($file, 'begin', $newKeys); + } + + $source = $data->readTransXML2Arr($file, _DEFAULT_LANG_); + $output .= Display::transForm($source, $source, $file); + $output .= Display::addEntrySelection($source, $file); + break; +} + +echo '

'.getGS('localizer').'

'.$error[msg].$output; +?> + + \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/localizer/menu.php b/livesupport/modules/htmlUI/var/localizer/menu.php new file mode 100755 index 000000000..d9544a1dc --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/menu.php @@ -0,0 +1,21 @@ + + + \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/localizer/menu_static.php b/livesupport/modules/htmlUI/var/localizer/menu_static.php new file mode 100755 index 000000000..692468294 --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/menu_static.php @@ -0,0 +1,21 @@ + + + + + + + + + + + + + +
 / 
+  locals.en.English.xml
+  locals.de.German.xml
+
+ + + diff --git a/livesupport/modules/htmlUI/var/localizer/require.inc.php b/livesupport/modules/htmlUI/var/localizer/require.inc.php new file mode 100755 index 000000000..bc1a1aa44 --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/require.inc.php @@ -0,0 +1,33 @@ + diff --git a/livesupport/modules/htmlUI/var/ui_base.inc.php b/livesupport/modules/htmlUI/var/ui_base.inc.php index f123de58f..822671ced 100644 --- a/livesupport/modules/htmlUI/var/ui_base.inc.php +++ b/livesupport/modules/htmlUI/var/ui_base.inc.php @@ -19,7 +19,23 @@ function errCallBack($err) */ function tra($input) { - // just a dummy function yet + ## initialize at first call of this function ### + + #$GS =& $_SESSION['GS']; + static $GS; + global $uiBase; + + if ($uiBase->langid && !is_array($GS)) { + #echo "load translation"; + include_once dirname(__FILE__).'/localizer/require.inc.php'; + + $GS = loadTranslations($uiBase->langid); + } + ## end init #################################### + + if ($GS[$input]) + $input = $GS[$input]; + $nr = func_num_args(); if ($nr > 1) for ($i = 1; $i < $nr; $i++){ @@ -97,7 +113,7 @@ class uiBase $this->sessid = $_REQUEST[$config['authCookieName']]; $this->userid = $this->gb->getSessUserId($this->sessid); $this->login = $this->gb->getSessLogin($this->sessid); - $this->langid =& $_SESSION['lanid']; + $this->langid =& $_SESSION['langid']; $this->id = $_REQUEST['id'] ? $_REQUEST['id'] : $this->gb->getObjId($this->login, $this->gb->storId); $this->pid = $this->gb->getparent($this->id) != 1 ? $this->gb->getparent($this->id) : FALSE; @@ -350,7 +366,7 @@ class uiBase function _setMDataValue($id, $key, $value, $langid=UI_DEFAULT_LANGID) - { + { if ($this->gb->setMDataValue($id, $key, $this->sessid, $value, $langid)) { return TRUE; } diff --git a/livesupport/modules/htmlUI/var/ui_handler.class.php b/livesupport/modules/htmlUI/var/ui_handler.class.php index 366b308e8..b420da128 100644 --- a/livesupport/modules/htmlUI/var/ui_handler.class.php +++ b/livesupport/modules/htmlUI/var/ui_handler.class.php @@ -37,7 +37,7 @@ class uiHandler extends uiBase { * @param pass string, password */ function login(&$formdata, &$mask) - { + { #$this->_cleanArray($_SESSION); if (!$this->_validateForm($formdata, $mask)) { diff --git a/livesupport/modules/htmlUI/var/ui_scheduler.class.php b/livesupport/modules/htmlUI/var/ui_scheduler.class.php index d51bab5cc..13e261cc6 100755 --- a/livesupport/modules/htmlUI/var/ui_scheduler.class.php +++ b/livesupport/modules/htmlUI/var/ui_scheduler.class.php @@ -264,8 +264,9 @@ class uiScheduler extends uiCalendar $datetime = strftime('%Y-%m-%dT%H:%M:%S'); $xmldatetime = str_replace('-', '', $datetime); $pl = $this->displayScheduleMethod($xmldatetime, $xmldatetime); - if(count($pl) == 0) + if(!is_array($pl) || !count($pl)) return FALSE; + $pl = current($pl); $offset = strftime('%H:%M:%S', $this->_strtotime($datetime) - $this->_datetime2timestamp($pl['start']) - UI_TIMEZONEOFFSET); $clip = $this->Base->gb->displayPlaylistClipAtOffset($this->Base->sessid, $pl['playlistId'], $offset, $distance);