From: <be...@us...> - 2015-10-08 04:01:16
|
Revision: 13160 http://sourceforge.net/p/xoops/svn/13160 Author: beckmi Date: 2015-10-08 04:01:14 +0000 (Thu, 08 Oct 2015) Log Message: ----------- 1.20 Added Paths: ----------- XoopsModules/xtransam/trunk/xtransam/admin/ XoopsModules/xtransam/trunk/xtransam/admin/about.php XoopsModules/xtransam/trunk/xtransam/admin/admin_footer.php XoopsModules/xtransam/trunk/xtransam/admin/admin_header.php XoopsModules/xtransam/trunk/xtransam/admin/index.html XoopsModules/xtransam/trunk/xtransam/admin/index.php XoopsModules/xtransam/trunk/xtransam/admin/menu.php XoopsModules/xtransam/trunk/xtransam/class/ XoopsModules/xtransam/trunk/xtransam/class/files.php XoopsModules/xtransam/trunk/xtransam/class/index.html XoopsModules/xtransam/trunk/xtransam/class/iobase.php XoopsModules/xtransam/trunk/xtransam/class/languages.php XoopsModules/xtransam/trunk/xtransam/class/provider.php XoopsModules/xtransam/trunk/xtransam/class/translator.php XoopsModules/xtransam/trunk/xtransam/docs/ XoopsModules/xtransam/trunk/xtransam/docs/changelog.txt XoopsModules/xtransam/trunk/xtransam/docs/credits.txt XoopsModules/xtransam/trunk/xtransam/docs/index.html XoopsModules/xtransam/trunk/xtransam/docs/install.txt XoopsModules/xtransam/trunk/xtransam/docs/lang_diff.txt XoopsModules/xtransam/trunk/xtransam/docs/licence.txt XoopsModules/xtransam/trunk/xtransam/docs/readme.txt XoopsModules/xtransam/trunk/xtransam/images/ XoopsModules/xtransam/trunk/xtransam/images/index.html XoopsModules/xtransam/trunk/xtransam/images/left_both.gif XoopsModules/xtransam/trunk/xtransam/images/right_both.gif XoopsModules/xtransam/trunk/xtransam/images/xtransam_slogo.png XoopsModules/xtransam/trunk/xtransam/include/ XoopsModules/xtransam/trunk/xtransam/include/JSON.php XoopsModules/xtransam/trunk/xtransam/include/charset_utf-8.php XoopsModules/xtransam/trunk/xtransam/include/forms.php XoopsModules/xtransam/trunk/xtransam/include/functions.php XoopsModules/xtransam/trunk/xtransam/include/index.html XoopsModules/xtransam/trunk/xtransam/include/update.php XoopsModules/xtransam/trunk/xtransam/language/ XoopsModules/xtransam/trunk/xtransam/language/english/ XoopsModules/xtransam/trunk/xtransam/language/english/admin.php XoopsModules/xtransam/trunk/xtransam/language/english/google.php XoopsModules/xtransam/trunk/xtransam/language/english/help/ XoopsModules/xtransam/trunk/xtransam/language/english/help/help.html XoopsModules/xtransam/trunk/xtransam/language/english/help/index.html XoopsModules/xtransam/trunk/xtransam/language/english/index.html XoopsModules/xtransam/trunk/xtransam/language/english/modinfo.php XoopsModules/xtransam/trunk/xtransam/language/index.html XoopsModules/xtransam/trunk/xtransam/language/italian/ XoopsModules/xtransam/trunk/xtransam/language/italian/admin.php XoopsModules/xtransam/trunk/xtransam/language/italian/google.php XoopsModules/xtransam/trunk/xtransam/language/italian/help/ XoopsModules/xtransam/trunk/xtransam/language/italian/help/help.html XoopsModules/xtransam/trunk/xtransam/language/italian/help/index.html XoopsModules/xtransam/trunk/xtransam/language/italian/index.html XoopsModules/xtransam/trunk/xtransam/language/italian/modinfo.php XoopsModules/xtransam/trunk/xtransam/providers/ XoopsModules/xtransam/trunk/xtransam/providers/bing.php XoopsModules/xtransam/trunk/xtransam/providers/google.php XoopsModules/xtransam/trunk/xtransam/providers/index.html XoopsModules/xtransam/trunk/xtransam/providers/mymemory.php XoopsModules/xtransam/trunk/xtransam/sql/ XoopsModules/xtransam/trunk/xtransam/sql/index.html XoopsModules/xtransam/trunk/xtransam/sql/mysql.sql XoopsModules/xtransam/trunk/xtransam/xoops_version.php Added: XoopsModules/xtransam/trunk/xtransam/admin/about.php =================================================================== --- XoopsModules/xtransam/trunk/xtransam/admin/about.php (rev 0) +++ XoopsModules/xtransam/trunk/xtransam/admin/about.php 2015-10-08 04:01:14 UTC (rev 13160) @@ -0,0 +1,28 @@ +<?php +/** + * XTransam module + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project (http://www.xoops.org) + * @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html/) + * @package Contact + * @since 2.5.0 + * @author Mage, Mamba, Timgno + * @version $Id $ + **/ + +include 'admin_header.php'; +xoops_cp_header(); + +$aboutAdmin = new ModuleAdmin(); +echo $aboutAdmin->addNavigation('about.php'); +echo $aboutAdmin->renderabout('6KJ7RW5DR3VTJ', false); + +include 'admin_footer.php'; +?> \ No newline at end of file Added: XoopsModules/xtransam/trunk/xtransam/admin/admin_footer.php =================================================================== --- XoopsModules/xtransam/trunk/xtransam/admin/admin_footer.php (rev 0) +++ XoopsModules/xtransam/trunk/xtransam/admin/admin_footer.php 2015-10-08 04:01:14 UTC (rev 13160) @@ -0,0 +1,23 @@ +<?php +/** + * XoopsPoll module + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package XoopsPoll + * @since 2.5.0 + * @author Mamba (www.xoops.org) + * @version $Id $ +**/ + +echo "<div align=\"center\"><a href=\"http://www.xoops.org\" target=\"_blank\"><img src=" . XOOPS_URL .'/' . $GLOBALS['xtransamImageAdmin'].'/xoopsmicrobutton.gif'.' '." alt='XOOPS' title='XOOPS'></a></div>"; +echo "<div class='center smallsmall italic pad5'><strong>" . $GLOBALS['xtransamModule']->getVar("name") . "</strong> is maintained by the <a class='tooltip' rel='external' href='http://www.xoops.org/' title='Visit XOOPS Community'>XOOPS Community</a></div>"; + +xoops_cp_footer(); \ No newline at end of file Added: XoopsModules/xtransam/trunk/xtransam/admin/admin_header.php =================================================================== --- XoopsModules/xtransam/trunk/xtransam/admin/admin_header.php (rev 0) +++ XoopsModules/xtransam/trunk/xtransam/admin/admin_header.php 2015-10-08 04:01:14 UTC (rev 13160) @@ -0,0 +1,101 @@ +<?php +// $Autho: wishcraft $ +// ------------------------------------------------------------------------ // +// XOOPS - PHP Content Management System // +// Copyright (c) 2009 XOOPS.org // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // +// -- Author: Simon Roberts (si...@ch...) -- // +// ------------------------------------------------------------------------ // + +include_once(dirname(dirname(dirname(dirname(__FILE__)))).DIRECTORY_SEPARATOR.'mainfile.php'); +include_once(dirname(dirname(dirname(dirname(__FILE__)))).DS.'include'.DS.'cp_header.php'); + +if (!defined('_CHARSET')) + define("_CHARSET","UTF-8"); +if (!defined('_CHARSET_ISO')) + define("_CHARSET_ISO","ISO-8859-1"); + +$GLOBALS['myts'] = MyTextSanitizer::getInstance(); + +$module_handler = xoops_gethandler('module'); +$config_handler = xoops_gethandler('config'); +$GLOBALS['xtransamModule'] = $module_handler->getByDirname('xtransam'); +$GLOBALS['xtransamModuleConfig'] = $config_handler->getConfigList($GLOBALS['xtransamModule']->getVar('mid')); + +set_time_limit($GLOBALS['xtransamModuleConfig']['php_execute_for']); + +xoops_load('pagenav'); +xoops_load('xoopslists'); +xoops_load('xoopsformloader'); + +include_once $GLOBALS['xoops']->path('class'.DS.'xoopsmailer.php'); +include_once $GLOBALS['xoops']->path('class'.DS.'xoopstree.php'); +include_once $GLOBALS['xoops']->path('modules'.DS.'xtransam'.DS.'include'.DS.'functions.php'); +include_once $GLOBALS['xoops']->path('modules'.DS.'xtransam'.DS.'include'.DS.'forms.php'); + +if ( file_exists($GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))){ + include_once $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'); + //return true; + }else{ + echo xoops_error("Error: You don't use the Frameworks \"admin module\". Please install this Frameworks"); + //return false; + } +$pathImageIcon = XOOPS_URL .'/'. $GLOBALS['xtransamModule']->getInfo('icons16'); +$pathImageAdmin = XOOPS_URL .'/'. $GLOBALS['xtransamModule']->getInfo('icons32'); + +$myts =& MyTextSanitizer::getInstance(); + +if ($xoopsUser) { + $moduleperm_handler =& xoops_gethandler('groupperm'); + if (!$moduleperm_handler->checkRight('module_admin', $GLOBALS['xtransamModule']->getVar( 'mid' ), $xoopsUser->getGroups())) { + redirect_header(XOOPS_URL, 1, _NOPERM); + exit(); + } +} else { + redirect_header(XOOPS_URL . "/user.php", 1, _NOPERM); + exit(); +} + +if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { + include_once(XOOPS_ROOT_PATH."/class/template.php"); + $xoopsTpl = new XoopsTpl(); +} + +$xoopsTpl->assign('pathImageIcon', $pathImageIcon); +//xoops_cp_header(); + +$traslactionsHandler =& xoops_getModuleHandler('iobase', 'xtransam'); + +if (isset($_GET)) { + foreach ($_GET as $k => $v) { + ${$k} = $v; + } +} + +if (isset($_POST)) { + foreach ($_POST as $k => $v) { + ${$k} = $v; + } +} + +?> \ No newline at end of file Added: XoopsModules/xtransam/trunk/xtransam/admin/index.html =================================================================== --- XoopsModules/xtransam/trunk/xtransam/admin/index.html (rev 0) +++ XoopsModules/xtransam/trunk/xtransam/admin/index.html 2015-10-08 04:01:14 UTC (rev 13160) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/xtransam/trunk/xtransam/admin/index.php =================================================================== --- XoopsModules/xtransam/trunk/xtransam/admin/index.php (rev 0) +++ XoopsModules/xtransam/trunk/xtransam/admin/index.php 2015-10-08 04:01:14 UTC (rev 13160) @@ -0,0 +1,277 @@ +<?php +// $Autho: wishcraft $ +// ------------------------------------------------------------------------ // +// XOOPS - PHP Content Management System // +// Copyright (c) 2009 XOOPS.org // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // +// -- Author: Simon Roberts (si...@ch...) -- // +// ------------------------------------------------------------------------ // +include 'admin_header.php'; + +error_reporting(E_ALL); +global $xoopsDB, $xoopsModuleConfig; + +$op = isset($_REQUEST['op'])?$_REQUEST['op']:'dashboard'; + +switch ($op){ +case "deletebuffer": + $sql[0] = "DELETE FROM ".$xoopsDB->prefix('xtransam_files')." WHERE ioid = $id"; + $sql[1] = "DELETE FROM ".$xoopsDB->prefix('xtransam_translator')." WHERE ioid = $id"; + $sql[2] = "DELETE FROM ".$xoopsDB->prefix('xtransam_iobase')." WHERE id = $id"; + + foreach($sql as $fquestion) + $xoopsDB->queryF($fquestion); + + redirect_header("index.php", 4, _AM_XTRANSAM_IODELETED); + break; +case "save-languages": + $lang_handler = xoops_getmodulehandler('languages', 'xtransam'); + foreach($id as $key => $value) + { + switch($value){ + case "new": + $lang = $lang_handler->create(); + break; + default: + $lang = $lang_handler->get($value); + } + + if (!empty($name[$key])&&!empty($code[$key])) { + $lang->setVar('name', $name[$key]); + $lang->setVar('code', $code[$key]); + $lang->setVar('foldername', $folder[$key]); + $lang->setVar('providers', $providers[$key]); + @$lang_handler->insert($lang); + } + } + redirect_header("index.php?op=languages",2,_AM_XTRANSAM_LANGSAVEOK); + break; +case "languages": + xoops_cp_header(); + $indexAdmin = new ModuleAdmin(); + echo $indexAdmin->addNavigation('index.php?op=languages'); + languagesForm_display(); + include "admin_footer.php"; + + break; +case "export": + global $xoopsUser; + + $io_handler = xoops_getmodulehandler('iobase', 'xtransam'); + $io = $io_handler->get($id); + $trans_handler = xoops_getmodulehandler('translator', 'xtransam'); + $lang_handler = xoops_getmodulehandler('languages', 'xtransam'); + $files_handler = xoops_getmodulehandler('files', 'xtransam'); + $criteria = new CriteriaCompo(new Criteria('ioid', $io->getVar('id'))); + $files = $files_handler->getObjects($criteria); + + $from_folder = $lang_handler->folder($io->getvar('languagefrom')); + $to_folder = $lang_handler->folder($io->getvar('languageto')); + + // Changed by Chronolabs - Removed Code by Timgo - ansi conversion - 08/11/2011 + //include($GLOBALS['xoops']->path('modules'.DS.'xtransam'.DS.'include'.DS.'charset_utf-8.php')); + + foreach($files as $file) { + $path = array(); + foreach(explode('\\', $file->getVar('path')) as $nodea) + foreach(explode('/', $nodea) as $nodeb) + $path[] = $nodeb; + foreach($path as $key => $value) { + if (strtolower($value) == strtolower($from_folder)) { + $path[$key] = $to_folder; + } + $pdir = DS.$path[$key]; + mkdir($pdir, 0777); + } + $wpath = implode(DS, $path); + if($wpath!=$file->getVar('path')){ + $bfile = file($file->getVar('path').$file->getVar('filename')); + $criteria = new CriteriaCompo(new Criteria('ioid', $io->getVar('id'))); + $criteria->add(new Criteria('fileid', $file->getVar('id'))); + $trans = $trans_handler->getObjects($criteria); + foreach($trans as $tran) { + $search = xtransam_convert_decode($tran->getVar('replacestr'), $tran->getVar('sm')); + $name = xtransam_convert_decode($tran->getVar('name'), $tran->getVar('sm')); + $translation = xtransam_convert_decode($tran->getVar('translation'), $tran->getVar('sm')); + // Changed by Chronolabs - Removed Code by Timgo - ansi conversion - 08/11/2011 + // foreach($GLOBALS['charset_utf8'] as $search => $replace) + // $translation = str_replace($search, $replace, $translation); + $replace = 'define("'.$name.'", "'.$translation.'");'."\n"; + $bfile[$tran->getVar('line')] = $replace; + } + // Changed by Chronolabs back to Footer + $bfile[] = "<?php\n\n// Translation done by XTransam & ".$GLOBALS['xoopsUser']->getVar('uname')." (".$GLOBALS['xoopsUser']->getVar('email').")\n// XTransam ".($GLOBALS['xtransamModule']->getVar('version')/100)." is written by Chronolabs Co-op & The XOOPS Project - File Dumped on ".date('Y-m-d H:i')."\n\n?>"; + @makeWritable($wpath, true); + if (file_exists($wpath.$file->getVar('filename'))) + unlink($wpath.$file->getVar('filename')); + $file = @fopen($wpath.$file->getVar('filename'), 'w'); + $buffer = implode("", $bfile); + fwrite($file, $buffer, strlen($buffer)); + fclose($file); + } + // Changed by Chronolabs to be recursive + if (file_exists($indexFile = XOOPS_ROOT_PATH."modules".DS."xtransam".DS."language".DS."index.html")) + copy($indexFile, $wpath.DS."index.html"); + } + redirect_header("index.php?op=bbs",2,_AM_XTRANSAM_EXPORTCOMPLETE); + break; +case "save": + $trans_handler = xoops_getmodulehandler('translator', 'xtransam'); + foreach($trans as $key => $value) { + $tran = $trans_handler->get($key); + $tran->setVar('translation', xtransam_convert_encode($value, $tran->getVar('sm'))); + $trans_handler->insert($tran); + } + redirect_header("index.php?op=manage&id=$id&fileid=$fileid",2,_AM_XTRANSAM_SAVECOMPLETE); + break; +case "manage": + + xoops_cp_header(); + $indexAdmin = new ModuleAdmin(); + + echo $indexAdmin->addNavigation('index.php?op=manage'); + //echo $indexAdmin->renderIndex(); + managerForm_display($id, $fileid); + + include "admin_footer.php"; + break; + +case "analysis": + $io_handler = xoops_getmodulehandler('iobase', 'xtransam'); + $files_handler = xoops_getmodulehandler('files', 'xtransam'); + $io = $io_handler->get($id); + @$files_handler->analysepath($io); + redirect_header("index.php?op=bbs",2,_AM_XTRANSAM_ANLYSISCOMPLETE); + break; + +case "import": + $io_handler = xoops_getmodulehandler('iobase', 'xtransam'); + $files_handler = xoops_getmodulehandler('files', 'xtransam'); + $io = $io_handler->get($id); + @$files_handler->importfiles($io); + redirect_header("index.php?op=bbs",2,_AM_XTRANSAM_IMPORTCOMPLETE); + break; + +case "translate": + xoops_cp_header(); + echo sprintf(_AM_XTRANSAM_TRANSLATION_IN_PROCESS, $GLOBALS['xtransamModuleConfig']['php_execute_for'], isset($restart)?$restart:1); + include "admin_footer.php"; + $io_handler = xoops_getmodulehandler('iobase', 'xtransam'); + $io = $io_handler->get($id); + $trans_handler = xoops_getmodulehandler('translator', 'xtransam'); + $lang_handler = xoops_getmodulehandler('languages', 'xtransam'); + $criteria = new CriteriaCompo(new Criteria('ioid', $io->getVar('id'))); + if ($trans_handler->getCount($criteria)>0) { + $trans = $trans_handler->getObjects($criteria); + $start = time(); + foreach($trans as $tran) { + if ($tran->isempty()){ + $from = $lang_handler->code($io->getVar('languagefrom')); + $to = $lang_handler->code($io->getVar('languageto')); + $GLOBALS['provider'] = $lang_handler->provider($tran->getVar('toid')); + if (strlen($GLOBALS['provider'])>0) { + $provider_handler = xoops_getmodulehandler('provider', 'xtransam'); + $translation = $provider_handler->provider->translate($from,$to, xtransam_convert_decode($tran->getVar('orginal'), $tran->getVar('sm'))); + $tran->setVar('translation', xtransam_convert_encode($translation, $tran->getVar('sm'))); + if (strlen($translation)>0) + $tran->setVar('auto', 1); + else + $tran->setVar('auto', 0); + + $trans_handler->insert($tran); + } + if ($start+$GLOBALS['xtransamModuleConfig']['php_execute_for']-3<time()) + { + $restart++; + redirect_header("index.php?op=translate&id=$id&restart=$restart"); + exit(0); + } + } + } + } + redirect_header("index.php?op=bbs",2,_AM_XTRANSAM_TRANSLATIONCOMPLETE); + break; + +case "bbs": + + xoops_cp_header(); + $indexAdmin = new ModuleAdmin(); + + echo $indexAdmin->addNavigation('index.php?op=bbs'); + //echo $indexAdmin->renderIndex(); + translationForm_display(false); + include "admin_footer.php"; + + break; + +case "wizard": + xoops_cp_header(); + $indexAdmin = new ModuleAdmin(); + echo $indexAdmin->addNavigation('index.php?op=wizard'); + //echo $indexAdmin->renderIndex(); + wizardForm_display($step); + translationForm_display(true); + include "admin_footer.php"; + break; +case "dashboard": +default: + + xoops_cp_header(); + + $trans_handler = xoops_getmodulehandler('translator', 'xtransam'); + $lang_handler = xoops_getmodulehandler('languages', 'xtransam'); + $files_handler = xoops_getmodulehandler('files', 'xtransam'); + $iobase_handler = xoops_getmodulehandler('iobase', 'xtransam'); + + $indexAdmin = new ModuleAdmin(); + + $indexAdmin->addInfoBox(_AM_XTRANSAM_ADMIN_NUMTRASL); + $indexAdmin->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_NUMFILES."</label>", $files_handler->getCount(NULL), 'Green'); + $indexAdmin->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_NUMLINES."</label>", $trans_handler->getCount(NULL), 'Green'); + $indexAdmin->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_NUMPROJECTS."</label>", $iobase_handler->getCount(NULL), 'Green'); + $indexAdmin->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_NUMLANG."</label>", $lang_handler->getCount(NULL), 'Green'); + + xoops_load('xoopscache'); + if (!class_exists('XoopsCache')) { + // XOOPS 2.4 Compliance + xoops_load('cache'); + if (!class_exists('XoopsCache')) { + include_once XOOPS_ROOT_PATH.DS.'class'.DS.'cache'.DS.'xoopscache.php'; + } + } + + if ($googlecodes = XoopsCache::read('xtransam_google_pause')) { + $indexAdmin->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_GOOGLEAVAILABLE."</label>", _YES, 'Green'); + $indexAdmin->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>".sprintf(_AM_XTRANSAM_THEREARE_GOOGLEERROR, $googlecodes['code'], $googlecodes['message'])."</label>", '', 'Green'); + } else { + $indexAdmin->addInfoBoxLine(_AM_XTRANSAM_ADMIN_NUMTRASL, "<label>"._AM_XTRANSAM_THEREARE_GOOGLEAVAILABLE."</label>", _NO, 'Green'); + } + + echo $indexAdmin->addNavigation("index.php") ; + echo $indexAdmin->renderIndex(); + + include "admin_footer.php"; + + break; +} +?> \ No newline at end of file Added: XoopsModules/xtransam/trunk/xtransam/admin/menu.php =================================================================== --- XoopsModules/xtransam/trunk/xtransam/admin/menu.php (rev 0) +++ XoopsModules/xtransam/trunk/xtransam/admin/menu.php 2015-10-08 04:01:14 UTC (rev 13160) @@ -0,0 +1,58 @@ +<?php +// $Autho: wishcraft $ +// ------------------------------------------------------------------------ // +// XOOPS - PHP Content Management System // +// Copyright (c) 2009 XOOPS.org // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // +// -- Author: Simon Roberts (si...@ch...) -- // +// ------------------------------------------------------------------------ // +$module_handler =& xoops_gethandler('module'); +$GLOBALS['xtransamModule'] =& XoopsModule::getByDirname('xtransam'); +$moduleInfo =& $module_handler->get($GLOBALS['xtransamModule']->getVar('mid')); +//$GLOBALS['xtransamImageAdmin'] = XOOPS_URL .'/'. $moduleInfo->getInfo('icons32'); +$GLOBALS['xtransamImageAdmin'] = $moduleInfo->getInfo('icons32'); + +$adminmenu = array(); + +$i = 1; +$adminmenu[$i]["title"] = _MI_XTRANSAM_ADMENU1; +$adminmenu[$i]["link"] = 'admin/index.php'; +$adminmenu[$i]["icon"] = '../../'.$GLOBALS['xtransamImageAdmin'].'/home.png'; +$i++; +$adminmenu[$i]["title"] = _MI_XTRANSAM_ADMENU2; +$adminmenu[$i]["link"] = 'admin/index.php?op=wizard'; +$adminmenu[$i]["icon"] = '../../'.$GLOBALS['xtransamImageAdmin'].'/wizard.png'; +$i++; +$adminmenu[$i]["title"] = _MI_XTRANSAM_ADMENU3; +$adminmenu[$i]["link"] = 'admin/index.php?op=bbs'; +$adminmenu[$i]["icon"] = '../../'.$GLOBALS['xtransamImageAdmin'].'/translations.png'; +$i++; +$adminmenu[$i]["title"] = _MI_XTRANSAM_ADMENU4; +$adminmenu[$i]["link"] = 'admin/index.php?op=languages'; +$adminmenu[$i]["icon"] = '../../'.$GLOBALS['xtransamImageAdmin'].'/languages.png'; +$i++; +$adminmenu[$i]["title"] = _MI_XTRANSAM_ADMENU5; +$adminmenu[$i]["link"] = 'admin/about.php'; +$adminmenu[$i]["icon"] = '../../'.$GLOBALS['xtransamImageAdmin'].'/about.png'; + +?> \ No newline at end of file Added: XoopsModules/xtransam/trunk/xtransam/class/files.php =================================================================== --- XoopsModules/xtransam/trunk/xtransam/class/files.php (rev 0) +++ XoopsModules/xtransam/trunk/xtransam/class/files.php 2015-10-08 04:01:14 UTC (rev 13160) @@ -0,0 +1,210 @@ +<?php +// $Autho: wishcraft $ +// ------------------------------------------------------------------------ // +// XOOPS - PHP Content Management System // +// Copyright (c) 2009 XOOPS.org // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // +// -- Author: Simon Roberts (si...@ch...) -- // +// ------------------------------------------------------------------------ // + +if (!defined('XOOPS_ROOT_PATH')) { + exit(); +} +/** + * Class for policies + * @author Simon Roberts <on...@xo...> + * @copyright copyright (c) 2009-2003 XOOPS.org + * @package kernel + */ +class XtransamFiles extends XoopsObject +{ + + function XtransamFiles($id = null) + { + $this->initVar('id', XOBJ_DTYPE_INT, null, false); + $this->initVar('ioid', XOBJ_DTYPE_INT); + $this->initVar('filename', XOBJ_DTYPE_TXTBOX, null, true, 255); + $this->initVar('path', XOBJ_DTYPE_TXTBOX, null, true, 255); + $this->initVar('imported', XOBJ_DTYPE_INT, 0); + } + +} + + +/** +* XOOPS policies handler class. +* This class is responsible for providing data access mechanisms to the data source +* of XOOPS user class objects. +* +* @author Simon Roberts <si...@ch...> +* @package kernel +*/ +class XtransamFilesHandler extends XoopsPersistableObjectHandler +{ + + var $db; + var $regex = '/define\((.*) \);|define \((.*) \);|define \((.*) \);|define \( ([\"\', \ta-zA-Z0-9_]+)\);|define\( (.*) \);|define\((.*)\);|define \((.*)\);|define \((.*)\);|define \( ([\"\', \ta-zA-Z0-9_]+)\);|define\( (.*)\);|define\((.*) \);|define \((.*) \);|define \((.*) \);|define \( (.*) \);|define\( (.*) \);/'; + var $seperator = array('", "', '","', '" , "', '" , "', '", "', '" , "', + '", \'', '",\'', '" , \'', '" , \'', '", \'', '" , \'' , + '\', \'', '\',\'', '\' , \'', '\' , \'', '\', \'', '\' , \'', + '\', "', '\',"', '\' , "', '\' , "', '\', "', '\' , "'); + + function __construct(&$db) + { + $this->db = $db; + parent::__construct($db, "xtransam_files", 'XtransamFiles', "id", "path"); + } + + function importfiles($io) + { + if (!is_a($io, 'XtransamIobase')) + return false; + + global $xoopsModuleConfig; + + $trans_handler = xoops_getmodulehandler('translator', 'xtransam'); + + $criteria = new CriteriaCompo(new Criteria('`ioid`', $io->getVar('id')), 'AND'); + $criteria->add(new Criteria('`imported`', 0), 'AND'); + $files = $this->getObjects($criteria); + + foreach ($files as $file) { + $content = file_get_contents($file->getVar('path').DS.$file->getVar('filename')); + $lines = explode("\n", $content); + foreach($lines as $key => $line) { + if (strpos(' '.$line,'define')>0) { + @preg_match_all($this->regex, $line, $matches); + + $def = array(); + foreach($matches as $match) + foreach($match as $result) { + if (!empty($result)&&substr($result,0,6)!='define') { + foreach($this->seperator as $sep) + if (strpos($result, $sep)>0) + if (count(explode($sep, $result))==2) + $result = explode($sep, $result); + + $def[0] = substr(trim($result[0]),1); + $def[1] = substr(trim($result[1]),0, strlen(trim($result[1]))-1); + } elseif (substr($result,0,6)=='define') { + $def[3] = $result; + } + } + + + if (!empty($def[0])&&!empty($def[1])) { + $trans = $trans_handler->create(); + $trans->setVar('ioid',$io->getVar('id')); + $trans->setVar('fromid',$io->getVar('languagefrom')); + $trans->setVar('toid',$io->getVar('languageto')); + $trans->setVar('fileid',$file->getVar('id')); + $trans->setVar('linetype','define'); + $trans->setVar('line', $key); + $trans->setVar('name',xtransam_convert_encode($def[0], $xoopsModuleConfig['store_method'])); + $trans->setVar('orginal',xtransam_convert_encode($def[1], $xoopsModuleConfig['store_method'])); + $trans->setVar('replacestr',xtransam_convert_encode($def[3], $xoopsModuleConfig['store_method'])); + $trans->setVar('sm', $xoopsModuleConfig['store_method']); + if (!$trans_handler->exists($trans)) + $trans_handler->insert($trans); + } + } + } + + $file->setVar('imported', '1'); + $this->insert($file); + + } + } + + + function analysepath($io) + { + if (!is_a($io, 'XtransamIobase')) + return false; + + switch ($io->getVar('point')) + { + case "core": + $files = $this->dirToArray(XOOPS_ROOT_PATH.DS.'language'.DS.$io->getVar('path'), true); + $path = XOOPS_ROOT_PATH.DS.'language'.DS.$io->getVar('path'); + break; + case "module": + $files = $this->dirToArray(XOOPS_ROOT_PATH.DS.'modules'.DS.$io->getVar('path'), true); + $path = XOOPS_ROOT_PATH.DS.'modules'.DS.$io->getVar('path'); + break; + } + + foreach($files as $key => $file) + { + if (file_exists($file)) { + $tfile = $this->create(); + $tfile->setVar('filename', basename($file)); + $tfile->setVar('path', str_replace(basename($file),'',$file)); + $tfile->setVar('ioid', $io->getVar('id')); + if (!$this->exists($tfile)) + @$this->insert($tfile); + } + } + + } + + private function dirToArray($directory, $recursive, $fileext = 'php') { + $array_items = array(); + if ($handle = opendir($directory)) { + while (false !== ($file = readdir($handle))) { + $filecomp = explode('.', $file); + if ($file != "." && $file != "..") { + if (is_dir($directory. "/" . $file)) { + if($recursive) { + $array_items = array_merge($array_items, $this->dirToArray($directory. "/" . $file, $recursive)); + } + $file = $directory . "/" . $file; + if (in_array($fileext, $filecomp)) + $array_items[] = preg_replace("/\/\//si", "/", $file); + } else { + $file = $directory . "/" . $file; + if (in_array($fileext, $filecomp)) + $array_items[] = preg_replace("/\/\//si", "/", $file); + } + } + } + closedir($handle); + } + return $array_items; + } + + function exists($file) + { + if (!is_a($file, 'XtransamFiles')) + return true; + + $criteria = new CriteriaCompo(new Criteria('`ioid`', $file->getVar('ioid')), 'AND'); + $criteria->add(new Criteria('`path`', $file->getVar('path')), 'AND'); + $criteria->add(new Criteria('`filename`', $file->getVar('filename')), 'AND'); + if ($this->getCount($criteria)>0) + return true; + else + return false; + } +} +?> \ No newline at end of file Added: XoopsModules/xtransam/trunk/xtransam/class/index.html =================================================================== --- XoopsModules/xtransam/trunk/xtransam/class/index.html (rev 0) +++ XoopsModules/xtransam/trunk/xtransam/class/index.html 2015-10-08 04:01:14 UTC (rev 13160) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/xtransam/trunk/xtransam/class/iobase.php =================================================================== --- XoopsModules/xtransam/trunk/xtransam/class/iobase.php (rev 0) +++ XoopsModules/xtransam/trunk/xtransam/class/iobase.php 2015-10-08 04:01:14 UTC (rev 13160) @@ -0,0 +1,155 @@ +<?php +// $Autho: wishcraft $ +// ------------------------------------------------------------------------ // +// XOOPS - PHP Content Management System // +// Copyright (c) 2009 XOOPS.org // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // + +if (!defined('XOOPS_ROOT_PATH')) { + exit(); +} +/** + * Class for policies + * @author Simon Roberts <on...@xo...> + * @copyright copyright (c) 2009-2003 XOOPS.org + * @package kernel + */ +class XtransamIobase extends XoopsObject +{ + + function XtransamIobase($id = null) + { + $this->initVar('id', XOBJ_DTYPE_INT, null, false); + $this->initVar('point', XOBJ_DTYPE_OTHER, null, false, 20); + $this->initVar('path', XOBJ_DTYPE_TXTBOX, null, true, 255); + $this->initVar('languagefrom', XOBJ_DTYPE_INT, null); + $this->initVar('languageto', XOBJ_DTYPE_INT, null); + $this->initVar('done', XOBJ_DTYPE_INT, null); + } + +} + + +/** +* XOOPS policies handler class. +* This class is responsible for providing data access mechanisms to the data source +* of XOOPS user class objects. +* +* @author Simon Roberts <si...@ch...> +* @package kernel +*/ +class XtransamIobaseHandler extends XoopsPersistableObjectHandler +{ + + var $db; + + function __construct(&$db) + { + $this->db = $db; + parent::__construct($db, "xtransam_iobase", 'XtransamIobase', "id", "path"); + } + + function insert($io) + { + if (!is_a($io, 'XtransamIobase')) + return false; + + if (!$this->exists($io)) + $sql = "INSERT INTO ".$this->db->prefix('xtransam_iobase')." (`point`, `path`, `languagefrom`, `languageto`) VALUES ('".$io->getVar('point')."', '".$io->getVar('path')."', '".$io->getVar('languagefrom')."', '".$io->getVar('languageto')."')"; + else + $sql = "UPDATE ".$this->db->prefix('xtransam_iobase')." SET `point` = '".$io->getVar('point')."', `path` = '".$io->getVar('path')."', `languagefrom` = '".$io->getVar('languagefrom')."', `languageto` = '".$io->getVar('languageto')."', `total` = '".$io->getVar('total')."', `done` = '".$io->getVar('done')."' where `id` = ".$io->getVar('id'); + + return $this->db->queryF($sql); + + } + + function &getObjects($criteria = null, $fields = null, $asObject = true, $id_as_key = true) + { + if (is_array($fields) && count($fields) > 0) { + if (! in_array($this->handler->keyName, $fields)) { + $fields[] = $this->handler->keyName; + } + $select = "`" . implode("`, `", $fields) . "`"; + } else { + $select = "*"; + } + $limit = null; + $start = null; + $sql = "SELECT {$select} FROM `".$this->db->prefix('xtransam_iobase')."`"; + if (isset($criteria) && is_subclass_of($criteria, "criteriaelement")) { + $sql .= " " . $criteria->renderWhere(); + if ($sort = $criteria->getSort()) { + $sql .= " ORDER BY {$sort} " . $criteria->getOrder(); + $orderSet = true; + } + $limit = $criteria->getLimit(); + $start = $criteria->getStart(); + } + if (empty($orderSet)) { + // $sql .= " ORDER BY `{$this->handler->keyName}` DESC"; + } + $result = $this->db->query($sql, $limit, $start); + $ret = array(); + if ($asObject) { + while ($myrow = $this->db->fetchArray($result)) { + $object = &$this->create(false); + $object->assignVars($myrow); + if ($id_as_key) { + $ret[$myrow['id']] = $object; + } else { + $ret[] = $object; + } + unset($object); + } + } else { + $object = &$this->create(false); + while ($myrow = $this->db->fetchArray($result)) { + $object->assignVars($myrow); + if ($id_as_key) { + $ret[$myrow['id']] = $object->getValues(array_keys($myrow)); + } else { + $ret[] = $object->getValues(array_keys($myrow)); + } + } + unset($object); + } + return $ret; + } + + function exists($io) + { + if (!is_a($io, 'XtransamIobase')) + return true; + + include_once(XOOPS_ROOT_PATH.'/class/criteria.php'); + $criteria = new CriteriaCompo(new Criteria('`point`', $io->getVar('point')), 'AND'); + $criteria->add(new Criteria('`path`', $io->getVar('path')), 'AND'); + $criteria->add(new Criteria('`languagefrom`', $io->getVar('languagefrom')), 'AND'); + $criteria->add(new Criteria('`languageto`', $io->getVar('languageto')), 'AND'); + if ($this->getCount($criteria)>0) + return true; + else + return false; + } +} +?> \ No newline at end of file Added: XoopsModules/xtransam/trunk/xtransam/class/languages.php =================================================================== --- XoopsModules/xtransam/trunk/xtransam/class/languages.php (rev 0) +++ XoopsModules/xtransam/trunk/xtransam/class/languages.php 2015-10-08 04:01:14 UTC (rev 13160) @@ -0,0 +1,143 @@ +<?php +// $Autho: wishcraft $ +// ------------------------------------------------------------------------ // +// XOOPS - PHP Content Management System // +// Copyright (c) 2009 XOOPS.org // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // + +if (!defined('XOOPS_ROOT_PATH')) { + exit(); +} +/** + * Class for policies + * @author Simon Roberts <on...@xo...> + * @copyright copyright (c) 2009-2003 XOOPS.org + * @package kernel + */ +class XtransamLanguages extends XoopsObject +{ + + function XtransamLanguages($id = null) + { + $this->initVar('lang_id', XOBJ_DTYPE_INT, null, false); + $this->initVar('providers', XOBJ_DTYPE_ARRAY, null, false, 255); + $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 255); + $this->initVar('code', XOBJ_DTYPE_TXTBOX, null, true, 6); + $this->initVar('foldername', XOBJ_DTYPE_TXTBOX, null, false, 255); + + } + +} + + +/** +* XOOPS policies handler class. +* This class is responsible for providing data access mechanisms to the data source +* of XOOPS user class objects. +* +* @author Simon Roberts <si...@ch...> +* @package kernel +*/ +class XtransamLanguagesHandler extends XoopsPersistableObjectHandler +{ + function __construct(&$db) + { + parent::__construct($db, "xtransam_languages", 'XtransamLanguages', "lang_id", "name"); + } + + function name($id) + { + if ($this->getCount(new Criteria('lang_id', $id))>0) + { + $objs = $this->getObjects(new Criteria('lang_id', $id), false, false ); + return $objs[0]['name']; + } else { + return false; + } + } + + function provider($id) + { + if ($this->getCount(new Criteria('lang_id', $id))>0) + { + $objs = $this->getObjects(new Criteria('lang_id', $id), false, false ); + if (in_array($GLOBALS['xoopsModuleConfig']['provider'], $objs[0]['providers'])) { + return $GLOBALS['xoopsModuleConfig']['provider']; + } + switch ($GLOBALS['xoopsModuleConfig']['provider']) { + case 'google': + return 'bing'; + break; + case 'mymemory': + return 'google'; + break; + case 'bing': + return 'google'; + break; + } + } else { + return array($GLOBALS['xoopsModuleConfig']['provider']); + } + } + + function folder($id) + { + if ($this->getCount(new Criteria('lang_id', $id))>0) + { + $objs = $this->getObjects(new Criteria('lang_id', $id), false, false ); + if (empty($objs[0]['foldername'])) + return strtolower($objs[0]['name']); + else + return strtolower($objs[0]['foldername']); + + } else { + return false; + } + } + + function code($id) + { + if ($this->getCount(new Criteria('lang_id', $id))>0) + { + $objs = $this->getObjects(new Criteria('lang_id', $id), false, false); + return $objs[0]['code']; + } else { + return false; + } + } + + function validlanguage($name) + { + include_once(XOOPS_ROOT_PATH.'/class/criteria.php'); + $criteria = new CriteriaCompo(new Criteria('`name`', $name, 'LIKE'), 'OR'); + $criteria->add(new Criteria('`foldername`', $name, 'LIKE'), 'OR'); + if ($this->getCount($criteria)>0) + { + $objs = $this->getObjects($criteria); + return $objs[0]->getVar('lang_id'); + } else { + return false; + } + } +} +?> \ No newline at end of file Added: XoopsModules/xtransam/trunk/xtransam/class/provider.php =================================================================== --- XoopsModules/xtransam/trunk/xtransam/class/provider.php (rev 0) +++ XoopsModules/xtransam/trunk/xtransam/class/provider.php 2015-10-08 04:01:14 UTC (rev 13160) @@ -0,0 +1,90 @@ +<?php +// $Autho: wishcraft $ +// ------------------------------------------------------------------------ // +// XOOPS - PHP Content Management System // +// Copyright (c) 2009 XOOPS.org // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // +// -- Author: Simon Roberts (si...@ch...) -- // +// ------------------------------------------------------------------------ // + +if (!defined('XOOPS_ROOT_PATH')) { + exit(); +} + +include_once $GLOBALS['xoops']->path('modules'.DS.'xtransam'.DS.'include'.DS.'functions.php'); + +/** +* XOOPS translation provider master class. +* This class is responsible for providing data access mechanisms to the data source +* of Translation API not based in user class objects. +* +* @author Simon Roberts <si...@ch...> +* @package xtransam +*/ +class XtransamProviderHandler extends XoopsPersistableObjectHandler { + + var $db = ''; + var $provider = ''; + + function __construct(&$db) { + if (is_object($db)) + $this->db = $db; + else + $this->db = $GLOBALS['xoopsDB']; + if (isset($GLOBALS['provider'])) + $this->provider = $this->createInstance($GLOBALS['provider']); + else + $this->provider = $this->createInstance($GLOBALS['xoopsModuleConfig']['provider']); + } + + function createInstance($provider = '') { + if (empty($provider)) + $provider = $GLOBALS['xoopsModuleConfig']['provider']; + include_once $GLOBALS['xoops']->path('modules'.DS.'xtransam'.DS.'providers'.DS.$provider.'.php'); + $class = 'Xtransam'.ucfirst($provider).'Provider'; + if (class_exists($class)) + return new $class($this->db); + return false; + } + + function json_decode($data) { + if (!function_exists('json_decode')) { + if (!class_exists('Services_JSON')) + include_once $GLOBALS['xoops']->path('modules'.DS.'xtransam'.DS.'include'.DS.'JSON.php'); + $json = new Services_JSON(); + return xtransam_obj2array($json->decode($data)); + } else { + return xtransam_obj2array(json_decode($data)); + } + } + + function _unescapeUTF8EscapeSeq($str) { + return preg_replace_callback("/\\\u([0-9a-f]{4})/i", create_function('$matches', 'return html_entity_decode(\'&#x\'.$matches[1].\';\', ENT_NOQUOTES, \'UTF-8\');'), $str); + } + + function clean($var) + { + $var = htmlspecialchars_decode($var); + return $var; + } +} \ No newline at end of file Added: XoopsModules/xtransam/trunk/xtransam/class/translator.php =================================================================== --- XoopsModules/xtransam/trunk/xtransam/class/translator.php (rev 0) +++ XoopsModules/xtransam/trunk/xtransam/class/translator.php 2015-10-08 04:01:14 UTC (rev 13160) @@ -0,0 +1,128 @@ +<?php +// $Autho: wishcraft $ +// ------------------------------------------------------------------------ // +// XOOPS - PHP Content Management System // +// Copyright (c) 2009 XOOPS.org // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // + +if (!defined('XOOPS_ROOT_PATH')) { + exit(); +} +/** + * Class for policies + * @author Simon Roberts <on...@xo...> + * @copyright copyright (c) 2009-2003 XOOPS.org + * @package kernel + */ +class XtransamTranslator extends XoopsObject +{ + + function XtransamTranslator($id = null) + { + $this->initVar('id', XOBJ_DTYPE_INT, null, false); + $this->initVar('ioid', XOBJ_DTYPE_INT, null, false); + $this->initVar('fromid', XOBJ_DTYPE_INT, null, false); + $this->initVar('toid', XOBJ_DTYPE_INT, null, false); + $this->initVar('fileid', XOBJ_DTYPE_INT, null, false); + $this->initVar('linetype', XOBJ_DTYPE_OTHER, null, false, 20); + $this->initVar('name', XOBJ_DTYPE_OTHER); + $this->initVar('orginal', XOBJ_DTYPE_OTHER); + $this->initVar('translation', XOBJ_DTYPE_OTHER); + $this->initVar('replacestr', XOBJ_DTYPE_OTHER, null); + $this->initVar('out', XOBJ_DTYPE_INT, null, false); + $this->initVar('line', XOBJ_DTYPE_INT, null, false); + $this->initVar('auto', XOBJ_DTYPE_INT, null, false); + $this->initVar('sm', XOBJ_DTYPE_OTHER, 'urlcode', false); + } + + function isempty() + { + $translation = $this->getVar('translation'); + return empty($translation); + } +} + + +/** +* XOOPS policies handler class. +* This class is responsible for providing data access mechanisms to the data source +* of XOOPS user class objects. +* +* @author Simon Roberts <si...@ch...> +* @package kernel +*/ +class XtransamTranslatorHandler extends XoopsPersistableObjectHandler +{ + + var $db; + + function __construct(&$db) + { + $this->db = $db; + parent::__construct($db, "xtransam_translator", 'XtransamTranslator', "id", "name"); + } + + function change_charset($text, $charset_output = 'UTF-8', $charset_input = 'ISO-8859-1') + { + // Values can be : UTF-8 ; ASCII + //$detected_encoding = mb_detect_encoding($text); + // if ($charset_output == $detected_encoding) { + if ($charset_output == $charset_input) { + // Encoding is already good + return $text; + } elseif ($charset_output == 'UTF-8' && $charset_input == 'ISO-8859-1') { + // ISO-8859-1 -> UTF8 + return utf8_encode($text); + } elseif ($charset_output == 'ISO-8859-1' && $charset_input == 'UTF-8') { + // UTF8 -> ISO-8859-1 + return utf8_decode($text); + } else { + // * -> UTF8 + if (function_exists("mb_convert_encoding")) { + return mb_convert_encoding($text, $charset_output, $charset_input); + }else{ + return $text; + } + + } + } + + function exists($trans) + { + if (!is_a($trans, 'XtransamTranslator')) + return true; + + $criteria = new CriteriaCompo(new Criteria('`ioid`', $trans->getVar('ioid')), 'AND'); + $criteria->add(new Criteria('`fromid`', $trans->getVar('fromid')), 'AND'); + $criteria->add(new Criteria('`toid`', $trans->getVar('toid')), 'AND'); + $criteria->add(new Criteria('`fileid`', $trans->getVar('fileid')), 'AND'); + $criteria->add(new Criteria('`linetype`', $trans->getVar('linetype')), 'AND'); + $criteria->add(new Criteria('`name`', $trans->getVar('name')), 'AND'); + + if ($this->getCount($criteria)>0) + return true; + else + return false; + } +} +?> \ No newline at end of file Added: XoopsModules/xtransam/trunk/xtransam/docs/changelog.txt =================================================================== --- XoopsModules/xtransam/trunk/xtransam/docs/changelog.txt (rev 0) +++ XoopsModules/xtransam/trunk/xtransam/docs/changelog.txt 2015-10-08 04:01:14 UTC (rev 13160) @@ -0,0 +1,74 @@ +======================================== + 2011/11/08 03:50:00 Version 1.20 STABLE +======================================== + - Changed $pathImageAdmin renamed to $GLOBALS['xtransamImageAdmin'] (Wishcraft) + - Changed $GLOBALS['xoopsModule'] in module renamed to $GLOBALS['xtransamModule'] (Wishcraft) + - Changed $GLOBALS['xoopsModuleConfig'] in module renamed to $GLOBALS['xtransamModuleConfig'] (Wishcraft) + - Changed timgo ansi converterter line 91 and 151-152 remmed out admin/index.php (Wishcraft) + +======================================== + 2011/11/03 07:20:00 Version 1.19 STABLE +======================... [truncated message content] |