From: <txm...@us...> - 2012-03-28 22:00:05
|
Revision: 9212 http://xoops.svn.sourceforge.net/xoops/?rev=9212&view=rev Author: txmodxoops Date: 2012-03-28 21:59:55 +0000 (Wed, 28 Mar 2012) Log Message: ----------- Updated GUI 2.5 - completed Moved icons 32 in module images folder Added Paths: ----------- XoopsModules/xtransam/branches/ XoopsModules/xtransam/branches/timgno/ XoopsModules/xtransam/branches/timgno/xtransam/ XoopsModules/xtransam/branches/timgno/xtransam/admin/ XoopsModules/xtransam/branches/timgno/xtransam/admin/about.php XoopsModules/xtransam/branches/timgno/xtransam/admin/admin_footer.php XoopsModules/xtransam/branches/timgno/xtransam/admin/admin_header.php XoopsModules/xtransam/branches/timgno/xtransam/admin/bbs.php XoopsModules/xtransam/branches/timgno/xtransam/admin/index.html XoopsModules/xtransam/branches/timgno/xtransam/admin/index.php XoopsModules/xtransam/branches/timgno/xtransam/admin/languages.php XoopsModules/xtransam/branches/timgno/xtransam/admin/menu.php XoopsModules/xtransam/branches/timgno/xtransam/admin/wizard.php XoopsModules/xtransam/branches/timgno/xtransam/blocks/ XoopsModules/xtransam/branches/timgno/xtransam/blocks/index.html XoopsModules/xtransam/branches/timgno/xtransam/class/ XoopsModules/xtransam/branches/timgno/xtransam/class/files.php XoopsModules/xtransam/branches/timgno/xtransam/class/googleprovider.php XoopsModules/xtransam/branches/timgno/xtransam/class/index.html XoopsModules/xtransam/branches/timgno/xtransam/class/iobase.php XoopsModules/xtransam/branches/timgno/xtransam/class/languages.php XoopsModules/xtransam/branches/timgno/xtransam/class/provider.php XoopsModules/xtransam/branches/timgno/xtransam/class/translator.php XoopsModules/xtransam/branches/timgno/xtransam/css/ XoopsModules/xtransam/branches/timgno/xtransam/css/index.html XoopsModules/xtransam/branches/timgno/xtransam/docs/ XoopsModules/xtransam/branches/timgno/xtransam/docs/changelog.txt XoopsModules/xtransam/branches/timgno/xtransam/docs/credits.txt XoopsModules/xtransam/branches/timgno/xtransam/docs/index.html XoopsModules/xtransam/branches/timgno/xtransam/docs/install.txt XoopsModules/xtransam/branches/timgno/xtransam/docs/lang_diff.txt XoopsModules/xtransam/branches/timgno/xtransam/docs/licence.txt XoopsModules/xtransam/branches/timgno/xtransam/docs/readme.txt XoopsModules/xtransam/branches/timgno/xtransam/images/ XoopsModules/xtransam/branches/timgno/xtransam/images/16/ XoopsModules/xtransam/branches/timgno/xtransam/images/16/analysis.png XoopsModules/xtransam/branches/timgno/xtransam/images/16/edit.png XoopsModules/xtransam/branches/timgno/xtransam/images/16/export.png XoopsModules/xtransam/branches/timgno/xtransam/images/16/import.png XoopsModules/xtransam/branches/timgno/xtransam/images/16/index.html XoopsModules/xtransam/branches/timgno/xtransam/images/16/traslate.png XoopsModules/xtransam/branches/timgno/xtransam/images/32/ XoopsModules/xtransam/branches/timgno/xtransam/images/32/dashboard.png XoopsModules/xtransam/branches/timgno/xtransam/images/32/index.html XoopsModules/xtransam/branches/timgno/xtransam/images/32/languages.png XoopsModules/xtransam/branches/timgno/xtransam/images/32/translations.png XoopsModules/xtransam/branches/timgno/xtransam/images/32/wizard.png XoopsModules/xtransam/branches/timgno/xtransam/images/deco/ XoopsModules/xtransam/branches/timgno/xtransam/images/deco/arrow.gif XoopsModules/xtransam/branches/timgno/xtransam/images/deco/index.html XoopsModules/xtransam/branches/timgno/xtransam/images/icons/ XoopsModules/xtransam/branches/timgno/xtransam/images/icons/index.html XoopsModules/xtransam/branches/timgno/xtransam/images/icons/off.png XoopsModules/xtransam/branches/timgno/xtransam/images/icons/on.png XoopsModules/xtransam/branches/timgno/xtransam/images/index.html XoopsModules/xtransam/branches/timgno/xtransam/images/languages.png XoopsModules/xtransam/branches/timgno/xtransam/images/left_both.gif XoopsModules/xtransam/branches/timgno/xtransam/images/menu/ XoopsModules/xtransam/branches/timgno/xtransam/images/menu/bg.png XoopsModules/xtransam/branches/timgno/xtransam/images/menu/index.html XoopsModules/xtransam/branches/timgno/xtransam/images/menu/left_both.png XoopsModules/xtransam/branches/timgno/xtransam/images/menu/right_both.png XoopsModules/xtransam/branches/timgno/xtransam/images/right_both.gif XoopsModules/xtransam/branches/timgno/xtransam/images/translations.png XoopsModules/xtransam/branches/timgno/xtransam/images/wizard.png XoopsModules/xtransam/branches/timgno/xtransam/images/xtransam_slogo.png XoopsModules/xtransam/branches/timgno/xtransam/include/ XoopsModules/xtransam/branches/timgno/xtransam/include/JSON.php XoopsModules/xtransam/branches/timgno/xtransam/include/charset_utf-8.php XoopsModules/xtransam/branches/timgno/xtransam/include/forms.php XoopsModules/xtransam/branches/timgno/xtransam/include/functions.php XoopsModules/xtransam/branches/timgno/xtransam/include/index.html XoopsModules/xtransam/branches/timgno/xtransam/include/install.php XoopsModules/xtransam/branches/timgno/xtransam/include/update.php XoopsModules/xtransam/branches/timgno/xtransam/language/ XoopsModules/xtransam/branches/timgno/xtransam/language/english/ XoopsModules/xtransam/branches/timgno/xtransam/language/english/admin.php XoopsModules/xtransam/branches/timgno/xtransam/language/english/google.php XoopsModules/xtransam/branches/timgno/xtransam/language/english/help/ XoopsModules/xtransam/branches/timgno/xtransam/language/english/help/help.html XoopsModules/xtransam/branches/timgno/xtransam/language/english/help/index.html XoopsModules/xtransam/branches/timgno/xtransam/language/english/index.html XoopsModules/xtransam/branches/timgno/xtransam/language/english/modinfo.php XoopsModules/xtransam/branches/timgno/xtransam/language/index.html XoopsModules/xtransam/branches/timgno/xtransam/language/italian/ XoopsModules/xtransam/branches/timgno/xtransam/language/italian/admin.php XoopsModules/xtransam/branches/timgno/xtransam/language/italian/google.php XoopsModules/xtransam/branches/timgno/xtransam/language/italian/help/ XoopsModules/xtransam/branches/timgno/xtransam/language/italian/help/help.html XoopsModules/xtransam/branches/timgno/xtransam/language/italian/help/index.html XoopsModules/xtransam/branches/timgno/xtransam/language/italian/index.html XoopsModules/xtransam/branches/timgno/xtransam/language/italian/modinfo.php XoopsModules/xtransam/branches/timgno/xtransam/providers/ XoopsModules/xtransam/branches/timgno/xtransam/providers/bing.php XoopsModules/xtransam/branches/timgno/xtransam/providers/google.php XoopsModules/xtransam/branches/timgno/xtransam/providers/index.html XoopsModules/xtransam/branches/timgno/xtransam/providers/mymemory.php XoopsModules/xtransam/branches/timgno/xtransam/sql/ XoopsModules/xtransam/branches/timgno/xtransam/sql/index.html XoopsModules/xtransam/branches/timgno/xtransam/sql/mysql.sql XoopsModules/xtransam/branches/timgno/xtransam/sql/mysql.sql.bak XoopsModules/xtransam/branches/timgno/xtransam/templates/ XoopsModules/xtransam/branches/timgno/xtransam/templates/admin/ XoopsModules/xtransam/branches/timgno/xtransam/templates/admin/index.html XoopsModules/xtransam/branches/timgno/xtransam/templates/admin/xtransam_about.html XoopsModules/xtransam/branches/timgno/xtransam/templates/admin/xtransam_help.html XoopsModules/xtransam/branches/timgno/xtransam/templates/blocks/ XoopsModules/xtransam/branches/timgno/xtransam/templates/blocks/index.html XoopsModules/xtransam/branches/timgno/xtransam/templates/index.html XoopsModules/xtransam/branches/timgno/xtransam/xoops_version.php Added: XoopsModules/xtransam/branches/timgno/xtransam/admin/about.php =================================================================== --- XoopsModules/xtransam/branches/timgno/xtransam/admin/about.php (rev 0) +++ XoopsModules/xtransam/branches/timgno/xtransam/admin/about.php 2012-03-28 21:59:55 UTC (rev 9212) @@ -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/branches/timgno/xtransam/admin/admin_footer.php =================================================================== --- XoopsModules/xtransam/branches/timgno/xtransam/admin/admin_footer.php (rev 0) +++ XoopsModules/xtransam/branches/timgno/xtransam/admin/admin_footer.php 2012-03-28 21:59:55 UTC (rev 9212) @@ -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/branches/timgno/xtransam/admin/admin_header.php =================================================================== --- XoopsModules/xtransam/branches/timgno/xtransam/admin/admin_header.php (rev 0) +++ XoopsModules/xtransam/branches/timgno/xtransam/admin/admin_header.php 2012-03-28 21:59:55 UTC (rev 9212) @@ -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/branches/timgno/xtransam/admin/bbs.php =================================================================== --- XoopsModules/xtransam/branches/timgno/xtransam/admin/bbs.php (rev 0) +++ XoopsModules/xtransam/branches/timgno/xtransam/admin/bbs.php 2012-03-28 21:59:55 UTC (rev 9212) @@ -0,0 +1,264 @@ +<?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...) -- // +// ------------------------------------------------------------------------ // +define ("_CHARSET","UTF-8"); +define ("_CHARSET_ISO","ISO-8859-1"); + +include 'admin_header.php'; +include_once '../include/forms.php'; + +error_reporting(E_ALL); +global $xoopsDB, $xoopsModuleConfig; + + if (isset($_GET)) { + foreach ($_GET as $k => $v) { + ${$k} = $v; + } + } + + if (isset($_POST)) { + foreach ($_POST as $k => $v) { + ${$k} = $v; + } + } + + +ini_set("max_execution_time", "300"); + +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, _XT_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('provider', $provider[$key]); + @$lang_handler->insert($lang); + } + } + redirect_header("index.php?op=languages",2,_XT_LANGSAVEOK); + break; +case "languages": + xoops_cp_header(); + adminMenu(3); + languagesForm_display(); + footer_adminMenu(); + xoops_cp_footer(); + + 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')); + + foreach($files as $file) { + $path = explode('/', $file->getVar('path')); + + foreach($path as $key => $value) + if (strtolower($value) == strtolower($from_folder)) { + $path[$key] = $to_folder; + } + + //$wpath = implode('/', $path).'/'; + $wpath = implode(DIRECTORY_SEPARATOR, $path); + mkdir($wpath, 0777); + + 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); + // Changed & Added by TXMod Xoops + $bfile[1] = "\n// Translation done by xtransam & ".$xoopsUser->uname()." TXMod Xoops - ".date('Y-m-d H:i')."\n\n"; + + 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 & Added by TXMod Xoops + //include_once '../include/charset_utf-8.php'; + //$translation = preg_replace($search, $replace, $translation); + $translation = str_replace('"', '\"', $translation); + $translation = str_replace('\"', "'", $translation); + $translation = str_replace('="', "='", $translation); + $translation = str_replace('">', "'>", $translation); + $translation = str_replace('È', 'E'', $translation); + $translation = str_replace('ì', 'ì', $translation); + $translation = str_replace('ò', 'ò', $translation); + $translation = str_replace('è', 'è', $translation); + $translation = str_replace('ù', 'ù', $translation); + $translation = str_replace('à', 'à', $translation); + $translation = str_replace('% S', '%s', $translation); + $translation = str_replace('%s ', '%s ', $translation); + $translation = str_replace('%s "', '%s"', $translation); + $translation = str_replace(' / ', '/', $translation); + + $replace = 'define("'.$name.'", "'.$translation.'");'; + $bfile[$tran->getVar('line')] = str_replace($search, $replace, $bfile[$tran->getVar('line')]); + } + @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); + } + } + // Added by TXMod Xoops + if (file_exists($indexFile = XOOPS_ROOT_PATH."/modules/xtransam/language/index.html")) + copy($indexFile, $wpath."index.html"); + + redirect_header("index.php?op=bbs",2,_XT_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,_XT_SAVECOMPLETE); + break; +case "manage": + xoops_cp_header(); + adminMenu(2); + managerForm_display($id, $fileid); + footer_adminMenu(); + xoops_cp_footer(); + + 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,_XT_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,_XT_IMPORTCOMPLETE); + break; + +case "translate": + $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')); + $provider = $lang_handler->provider($tran->getVar('toid')); + if (strlen($provider)>0) { + $provider_handler = xoops_getmodulehandler($provider.'provider', 'xtransam'); + $translation = $provider_handler->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+28<time()) + { + $restart++; + redirect_header("index.php?op=translate&id=$id&restart=$restart",2,sprintf(_XT_30SECONDSCONTINUING, $restart)); + } + } + } + } + redirect_header("index.php?op=bbs",2,_XT_TRANSLATIONCOMPLETE); + break; + +case "languages": + + break; +case "bbs": + + xoops_cp_header(); + adminMenu(2); + translationForm_display(false); + footer_adminMenu(); + xoops_cp_footer(); + + break; + +case "wizard": +default: + + xoops_cp_header(); + adminMenu(1); + wizardForm_display($step); + translationForm_display(true); + footer_adminMenu(); + xoops_cp_footer(); + break; + +} +?> \ No newline at end of file Added: XoopsModules/xtransam/branches/timgno/xtransam/admin/index.html =================================================================== --- XoopsModules/xtransam/branches/timgno/xtransam/admin/index.html (rev 0) +++ XoopsModules/xtransam/branches/timgno/xtransam/admin/index.html 2012-03-28 21:59:55 UTC (rev 9212) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/xtransam/branches/timgno/xtransam/admin/index.php =================================================================== --- XoopsModules/xtransam/branches/timgno/xtransam/admin/index.php (rev 0) +++ XoopsModules/xtransam/branches/timgno/xtransam/admin/index.php 2012-03-28 21:59:55 UTC (rev 9212) @@ -0,0 +1,278 @@ +<?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')); + // Changed by TXMod Xoops back to Header + $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?>"; + $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')); + /*foreach($GLOBALS['charset_utf8'] as $search => $replace) + $translation = str_replace($search, $replace, $translation); + $translation = htmlspecialchars($translation, ENT_QUOTES); */ + $trans = get_html_translation_table(HTML_ENTITIES); + $str = $translation; + $encoded = strtr($str, $trans); + //$translation = htmlentities($translation, ENT_COMPAT, "UTF-8"); + $replace = 'define("'.$name.'", "'.$encoded.'");'."\n"; + $bfile[$tran->getVar('line')] = $replace; + } + @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/xtransam/language/index.html")) + copy($indexFile, $wpath."/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/branches/timgno/xtransam/admin/languages.php =================================================================== --- XoopsModules/xtransam/branches/timgno/xtransam/admin/languages.php (rev 0) +++ XoopsModules/xtransam/branches/timgno/xtransam/admin/languages.php 2012-03-28 21:59:55 UTC (rev 9212) @@ -0,0 +1,95 @@ +<?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...) -- // +// ------------------------------------------------------------------------ // +define ("_CHARSET","UTF-8"); +define ("_CHARSET_ISO","ISO-8859-1"); + +include 'admin_header.php'; +include_once '../include/forms.php'; + +error_reporting(E_ALL); +global $xoopsDB, $xoopsModuleConfig; + + if (isset($_GET)) { + foreach ($_GET as $k => $v) { + ${$k} = $v; + } + } + + if (isset($_POST)) { + foreach ($_POST as $k => $v) { + ${$k} = $v; + } + } + + +ini_set("max_execution_time", "300"); + +switch ($op){ +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('provider', $provider[$key]); + @$lang_handler->insert($lang); + } + } + redirect_header("index.php?op=languages",2,_XT_LANGSAVEOK); + 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,_XT_SAVECOMPLETE); + break; +case "languages": +default: + xoops_cp_header(); + adminMenu(3); + languagesForm_display(); + footer_adminMenu(); + xoops_cp_footer(); + break; +} +?> \ No newline at end of file Added: XoopsModules/xtransam/branches/timgno/xtransam/admin/menu.php =================================================================== --- XoopsModules/xtransam/branches/timgno/xtransam/admin/menu.php (rev 0) +++ XoopsModules/xtransam/branches/timgno/xtransam/admin/menu.php 2012-03-28 21:59:55 UTC (rev 9212) @@ -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"] = 'images/32/dashboard.png'; +$i++; +$adminmenu[$i]["title"] = _MI_XTRANSAM_ADMENU2; +$adminmenu[$i]["link"] = 'admin/index.php?op=wizard'; +$adminmenu[$i]["icon"] = 'images/32/wizard.png'; +$i++; +$adminmenu[$i]["title"] = _MI_XTRANSAM_ADMENU3; +$adminmenu[$i]["link"] = 'admin/index.php?op=bbs'; +$adminmenu[$i]["icon"] = 'images/32/translations.png'; +$i++; +$adminmenu[$i]["title"] = _MI_XTRANSAM_ADMENU4; +$adminmenu[$i]["link"] = 'admin/index.php?op=languages'; +$adminmenu[$i]["icon"] = 'images/32/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/branches/timgno/xtransam/admin/wizard.php =================================================================== --- XoopsModules/xtransam/branches/timgno/xtransam/admin/wizard.php (rev 0) +++ XoopsModules/xtransam/branches/timgno/xtransam/admin/wizard.php 2012-03-28 21:59:55 UTC (rev 9212) @@ -0,0 +1,264 @@ +<?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...) -- // +// ------------------------------------------------------------------------ // +define ("_CHARSET","UTF-8"); +define ("_CHARSET_ISO","ISO-8859-1"); + +include 'admin_header.php'; +include_once '../include/forms.php'; + +error_reporting(E_ALL); +global $xoopsDB, $xoopsModuleConfig; + + if (isset($_GET)) { + foreach ($_GET as $k => $v) { + ${$k} = $v; + } + } + + if (isset($_POST)) { + foreach ($_POST as $k => $v) { + ${$k} = $v; + } + } + + +ini_set("max_execution_time", "300"); + +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, _XT_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('provider', $provider[$key]); + @$lang_handler->insert($lang); + } + } + redirect_header("index.php?op=languages",2,_XT_LANGSAVEOK); + break; +case "languages": + xoops_cp_header(); + adminMenu(3); + languagesForm_display(); + footer_adminMenu(); + xoops_cp_footer(); + + 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')); + + foreach($files as $file) { + $path = explode('/', $file->getVar('path')); + + foreach($path as $key => $value) + if (strtolower($value) == strtolower($from_folder)) { + $path[$key] = $to_folder; + } + + //$wpath = implode('/', $path).'/'; + $wpath = implode(DIRECTORY_SEPARATOR, $path); + mkdir($wpath, 0777); + + 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); + // Changed & Added by TXMod Xoops + $bfile[1] = "\n// Translation done by xtransam & ".$xoopsUser->uname()." TXMod Xoops - ".date('Y-m-d H:i')."\n\n"; + + 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 & Added by TXMod Xoops + //include_once '../include/charset_utf-8.php'; + //$translation = preg_replace($search, $replace, $translation); + $translation = str_replace('"', '\"', $translation); + $translation = str_replace('\"', "'", $translation); + $translation = str_replace('="', "='", $translation); + $translation = str_replace('">', "'>", $translation); + $translation = str_replace('È', 'E'', $translation); + $translation = str_replace('ì', 'ì', $translation); + $translation = str_replace('ò', 'ò', $translation); + $translation = str_replace('è', 'è', $translation); + $translation = str_replace('ù', 'ù', $translation); + $translation = str_replace('à', 'à', $translation); + $translation = str_replace('% S', '%s', $translation); + $translation = str_replace('%s ', '%s ', $translation); + $translation = str_replace('%s "', '%s"', $translation); + $translation = str_replace(' / ', '/', $translation); + + $replace = 'define("'.$name.'", "'.$translation.'");'; + $bfile[$tran->getVar('line')] = str_replace($search, $replace, $bfile[$tran->getVar('line')]); + } + @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); + } + } + // Added by TXMod Xoops + if (file_exists($indexFile = XOOPS_ROOT_PATH."/modules/xtransam/language/index.html")) + copy($indexFile, $wpath."index.html"); + + redirect_header("index.php?op=bbs",2,_XT_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,_XT_SAVECOMPLETE); + break; +case "manage": + xoops_cp_header(); + adminMenu(2); + managerForm_display($id, $fileid); + footer_adminMenu(); + xoops_cp_footer(); + + 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,_XT_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,_XT_IMPORTCOMPLETE); + break; + +case "translate": + $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')); + $provider = $lang_handler->provider($tran->getVar('toid')); + if (strlen($provider)>0) { + $provider_handler = xoops_getmodulehandler($provider.'provider', 'xtransam'); + $translation = $provider_handler->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+28<time()) + { + $restart++; + redirect_header("index.php?op=translate&id=$id&restart=$restart",2,sprintf(_XT_30SECONDSCONTINUING, $restart)); + } + } + } + } + redirect_header("index.php?op=bbs",2,_XT_TRANSLATIONCOMPLETE); + break; + +case "languages": + + break; +case "bbs": + + xoops_cp_header(); + adminMenu(2); + translationForm_display(false); + footer_adminMenu(); + xoops_cp_footer(); + + break; + +case "wizard": +default: + + xoops_cp_header(); + adminMenu(1); + wizardForm_display($step); + translationForm_display(true); + footer_adminMenu(); + xoops_cp_footer(); + break; + +} +?> \ No newline at end of file Added: XoopsModules/xtransam/branches/timgno/xtransam/blocks/index.html =================================================================== --- XoopsModules/xtransam/branches/timgno/xtransam/blocks/index.html (rev 0) +++ XoopsModules/xtransam/branches/timgno/xtransam/blocks/index.html 2012-03-28 21:59:55 UTC (rev 9212) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/xtransam/branches/timgno/xtransam/class/files.php =================================================================== --- XoopsModules/xtransam/branches/timgno/xtransam/class/files.php (rev 0) +++ XoopsModules/xtransam/branches/timgno/xtransam/class/files.php 2012-03-28 21:59:55 UTC (rev 9212) @@ -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 PURP... [truncated message content] |