From: <be...@us...> - 2015-09-25 09:26:25
|
Revision: 13152 http://sourceforge.net/p/xoops/svn/13152 Author: beckmi Date: 2015-09-25 09:26:23 +0000 (Fri, 25 Sep 2015) Log Message: ----------- synch with Git Modified Paths: -------------- XoopsModules/xlanguage/trunk/xlanguage/admin/about.php XoopsModules/xlanguage/trunk/xlanguage/admin/about2.php XoopsModules/xlanguage/trunk/xlanguage/admin/admin_footer.php XoopsModules/xlanguage/trunk/xlanguage/admin/admin_header.php XoopsModules/xlanguage/trunk/xlanguage/admin/index.php XoopsModules/xlanguage/trunk/xlanguage/admin/langform.inc.php XoopsModules/xlanguage/trunk/xlanguage/admin/main.php XoopsModules/xlanguage/trunk/xlanguage/api.php XoopsModules/xlanguage/trunk/xlanguage/blocks/xlanguage_blocks.php XoopsModules/xlanguage/trunk/xlanguage/class/language.php XoopsModules/xlanguage/trunk/xlanguage/docs/changelog.txt XoopsModules/xlanguage/trunk/xlanguage/language/english/blocks.php XoopsModules/xlanguage/trunk/xlanguage/language/english/modinfo.php XoopsModules/xlanguage/trunk/xlanguage/preloads/core.php XoopsModules/xlanguage/trunk/xlanguage/xoops_version.php Added Paths: ----------- XoopsModules/xlanguage/trunk/xlanguage/images/croatia.png Modified: XoopsModules/xlanguage/trunk/xlanguage/admin/about.php =================================================================== --- XoopsModules/xlanguage/trunk/xlanguage/admin/about.php 2015-09-22 13:04:40 UTC (rev 13151) +++ XoopsModules/xlanguage/trunk/xlanguage/admin/about.php 2015-09-25 09:26:23 UTC (rev 13152) @@ -26,4 +26,4 @@ echo $aboutAdmin->addNavigation('about.php'); echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false); -include 'admin_footer.php'; \ No newline at end of file +include 'admin_footer.php'; Modified: XoopsModules/xlanguage/trunk/xlanguage/admin/about2.php =================================================================== --- XoopsModules/xlanguage/trunk/xlanguage/admin/about2.php 2015-09-22 13:04:40 UTC (rev 13151) +++ XoopsModules/xlanguage/trunk/xlanguage/admin/about2.php 2015-09-25 09:26:23 UTC (rev 13152) @@ -1,84 +1,83 @@ -<?php -// $Id: about2.php 8203 2011-11-07 03:55:46Z beckmi $ -// ------------------------------------------------------------------------ // -// Xlanguage: eXtensible Language Management For Xoops // -// Copyright (c) 2004 Xoops China Community // -// <http://www.xoops.org.cn/> // -// ------------------------------------------------------------------------ // -// 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: D.J.(phppp) ph...@ho... // -// URL: http://www.xoops.org.cn // -// ------------------------------------------------------------------------- // -include '../../../include/cp_header.php'; -include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; -xoops_cp_header(); -$myts = &MyTextSanitizer::getInstance(); - -$module_handler =& xoops_gethandler('module'); -$versioninfo =& $module_handler->get($xoopsModule->getVar('mid')); - -// Left headings... -echo "<a href='index.php'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule -> dirname() . "/" . $versioninfo -> getInfo('image') . "' alt='' hspace='10' vspace='0' align='left'></a>"; -echo "<div style='margin-top: 10px; color: #33538e; margin-bottom: 4px; font-size: 18px; line-height: 18px; font-weight: bold; display: block;'>" . $versioninfo->getInfo('name') . " ver " . $versioninfo->getInfo('version') . "</div>"; -echo "</div>"; -echo "<div>" . _MI_XLANG_RELEASE . ": " . $versioninfo -> getInfo('releasedate') . "</div>"; - -// Author Information -$sform = new XoopsThemeForm(_MI_XLANG_AUTHOR_INFO, "", ""); -if ( $versioninfo->getInfo('author_realname')) - $author_name = $versioninfo->getInfo('author') . " (" . $versioninfo->getInfo('author_realname') . ")"; -else - $author_name = $versioninfo->getInfo('author'); -$sform -> addElement(new XoopsFormLabel(_MI_XLANG_AUTHOR_NAME, $author_name)); -$author_sites = $versioninfo -> getInfo('author_website'); -$author_site_info = ""; -foreach($author_sites as $site){ - $author_site_info .= "<a href='" . $site['url'] . "' target='blank'>" . $site['name'] . "</a>; "; -} -$sform -> addElement(new XoopsFormLabel(_MI_XLANG_AUTHOR_WEBSITE, $author_site_info)); -$sform -> addElement(new XoopsFormLabel(_MI_XLANG_AUTHOR_EMAIL, "<a href='mailto:" . $versioninfo -> getInfo('author_email') . "'>" . $versioninfo -> getInfo('author_email') . "</a>")); -$sform -> addElement(new XoopsFormLabel(_MI_XLANG_AUTHOR_CREDITS, $versioninfo -> getInfo('credits'))); -$sform -> display(); - -$sform = new XoopsThemeForm(_MI_XLANG_MODULE_INFO, "", ""); -$sform -> addElement(new XoopsFormLabel(_MI_XLANG_MODULE_STATUS, $versioninfo -> getInfo('status'))); -$sform -> addElement(new XoopsFormLabel(_MI_XLANG_MODULE_XOOPSVERSION, $versioninfo -> getInfo('xoopsversion'))); -$sform -> addElement(new XoopsFormLabel(_MI_XLANG_MODULE_DEMO, "<a href='" . $versioninfo -> getInfo('demo_site_url') . "' target='blank'>" . $versioninfo -> getInfo('demo_site_name') . "</a>")); -$sform -> addElement(new XoopsFormLabel(_MI_XLANG_MODULE_SUPPORT, "<a href='" . $versioninfo -> getInfo('support_site_url') . "' target='blank'>" . $versioninfo -> getInfo('support_site_name') . "</a>")); -$sform -> display(); - -$file = "../bugfixlist.txt"; -if (@file_exists($file)) -{ - $fp = @fopen($file, "r"); - $bugtext = @fread($fp, filesize($file)); - @fclose($file); - $sform = new XoopsThemeForm(_MI_XLANG_AUTHOR_BUGFIXES, "", ""); - ob_start(); - echo "<div class='even' align='left'>".$myts->displayTarea($bugtext)."</div>"; - $sform -> addElement(new XoopsFormLabel('', ob_get_contents(), 0)); - ob_end_clean(); - $sform -> display(); - unset($file); -} - -xoops_cp_footer(); -?> \ No newline at end of file +<?php +// $Id: about2.php 8203 2011-11-07 03:55:46Z beckmi $ +// ------------------------------------------------------------------------ // +// Xlanguage: eXtensible Language Management For Xoops // +// Copyright (c) 2004 Xoops China Community // +// <http://www.xoops.org.cn/> // +// ------------------------------------------------------------------------ // +// 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: D.J.(phppp) ph...@ho... // +// URL: http://www.xoops.org.cn // +// ------------------------------------------------------------------------- // +include '../../../include/cp_header.php'; +include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; +xoops_cp_header(); +$myts = &MyTextSanitizer::getInstance(); + +$module_handler =& xoops_gethandler('module'); +$versioninfo =& $module_handler->get($xoopsModule->getVar('mid')); + +// Left headings... +echo "<a href='index.php'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule -> dirname() . "/" . $versioninfo -> getInfo('image') . "' alt='' hspace='10' vspace='0' align='left'></a>"; +echo "<div style='margin-top: 10px; color: #33538e; margin-bottom: 4px; font-size: 18px; line-height: 18px; font-weight: bold; display: block;'>" . $versioninfo->getInfo('name') . " ver " . $versioninfo->getInfo('version') . "</div>"; +echo "</div>"; +echo "<div>" . _MI_XLANG_RELEASE . ": " . $versioninfo -> getInfo('releasedate') . "</div>"; + +// Author Information +$sform = new XoopsThemeForm(_MI_XLANG_AUTHOR_INFO, "", ""); +if ( $versioninfo->getInfo('author_realname')) + $author_name = $versioninfo->getInfo('author') . " (" . $versioninfo->getInfo('author_realname') . ")"; +else + $author_name = $versioninfo->getInfo('author'); +$sform -> addElement(new XoopsFormLabel(_MI_XLANG_AUTHOR_NAME, $author_name)); +$author_sites = $versioninfo -> getInfo('author_website'); +$author_site_info = ""; +foreach($author_sites as $site){ + $author_site_info .= "<a href='" . $site['url'] . "' target='blank'>" . $site['name'] . "</a>; "; +} +$sform -> addElement(new XoopsFormLabel(_MI_XLANG_AUTHOR_WEBSITE, $author_site_info)); +$sform -> addElement(new XoopsFormLabel(_MI_XLANG_AUTHOR_EMAIL, "<a href='mailto:" . $versioninfo -> getInfo('author_email') . "'>" . $versioninfo -> getInfo('author_email') . "</a>")); +$sform -> addElement(new XoopsFormLabel(_MI_XLANG_AUTHOR_CREDITS, $versioninfo -> getInfo('credits'))); +$sform -> display(); + +$sform = new XoopsThemeForm(_MI_XLANG_MODULE_INFO, "", ""); +$sform -> addElement(new XoopsFormLabel(_MI_XLANG_MODULE_STATUS, $versioninfo -> getInfo('status'))); +$sform -> addElement(new XoopsFormLabel(_MI_XLANG_MODULE_XOOPSVERSION, $versioninfo -> getInfo('xoopsversion'))); +$sform -> addElement(new XoopsFormLabel(_MI_XLANG_MODULE_DEMO, "<a href='" . $versioninfo -> getInfo('demo_site_url') . "' target='blank'>" . $versioninfo -> getInfo('demo_site_name') . "</a>")); +$sform -> addElement(new XoopsFormLabel(_MI_XLANG_MODULE_SUPPORT, "<a href='" . $versioninfo -> getInfo('support_site_url') . "' target='blank'>" . $versioninfo -> getInfo('support_site_name') . "</a>")); +$sform -> display(); + +$file = "../bugfixlist.txt"; +if (@file_exists($file)) +{ + $fp = @fopen($file, "r"); + $bugtext = @fread($fp, filesize($file)); + @fclose($file); + $sform = new XoopsThemeForm(_MI_XLANG_AUTHOR_BUGFIXES, "", ""); + ob_start(); + echo "<div class='even' align='left'>".$myts->displayTarea($bugtext)."</div>"; + $sform -> addElement(new XoopsFormLabel('', ob_get_contents(), 0)); + ob_end_clean(); + $sform -> display(); + unset($file); +} + +xoops_cp_footer(); Modified: XoopsModules/xlanguage/trunk/xlanguage/admin/admin_footer.php =================================================================== --- XoopsModules/xlanguage/trunk/xlanguage/admin/admin_footer.php 2015-09-22 13:04:40 UTC (rev 13151) +++ XoopsModules/xlanguage/trunk/xlanguage/admin/admin_footer.php 2015-09-25 09:26:23 UTC (rev 13152) @@ -7,4 +7,4 @@ ." " . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" ."</div>"; -xoops_cp_footer(); \ No newline at end of file +xoops_cp_footer(); Modified: XoopsModules/xlanguage/trunk/xlanguage/admin/admin_header.php =================================================================== --- XoopsModules/xlanguage/trunk/xlanguage/admin/admin_header.php 2015-09-22 13:04:40 UTC (rev 13151) +++ XoopsModules/xlanguage/trunk/xlanguage/admin/admin_header.php 2015-09-25 09:26:23 UTC (rev 13152) @@ -43,4 +43,4 @@ include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'); }else{ redirect_header("../../../admin.php", 5, _AM_XLANG_MODULEADMIN_MISSING, false); - } \ No newline at end of file + } Modified: XoopsModules/xlanguage/trunk/xlanguage/admin/index.php =================================================================== --- XoopsModules/xlanguage/trunk/xlanguage/admin/index.php 2015-09-22 13:04:40 UTC (rev 13151) +++ XoopsModules/xlanguage/trunk/xlanguage/admin/index.php 2015-09-25 09:26:23 UTC (rev 13152) @@ -1,37 +1,37 @@ -<?php -// $Id$ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2000 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 // -// ------------------------------------------------------------------------ // -include '../../../include/cp_header.php'; - -include 'admin_header.php'; -xoops_cp_header(); - -$indexAdmin = new ModuleAdmin(); - - echo $indexAdmin->addNavigation('index.php'); - echo $indexAdmin->renderIndex(); - -include "admin_footer.php"; \ No newline at end of file +<?php +// $Id$ +// ------------------------------------------------------------------------ // +// XOOPS - PHP Content Management System // +// Copyright (c) 2000 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 // +// ------------------------------------------------------------------------ // +include '../../../include/cp_header.php'; + +include 'admin_header.php'; +xoops_cp_header(); + +$indexAdmin = new ModuleAdmin(); + + echo $indexAdmin->addNavigation('index.php'); + echo $indexAdmin->renderIndex(); + +include "admin_footer.php"; Modified: XoopsModules/xlanguage/trunk/xlanguage/admin/langform.inc.php =================================================================== --- XoopsModules/xlanguage/trunk/xlanguage/admin/langform.inc.php 2015-09-22 13:04:40 UTC (rev 13151) +++ XoopsModules/xlanguage/trunk/xlanguage/admin/langform.inc.php 2015-09-25 09:26:23 UTC (rev 13152) @@ -32,11 +32,11 @@ $sform = new XoopsThemeForm(_AM_XLANG_EDITLANG, "langform", xoops_getenv('PHP_SELF')); if($isBase){ - $lang_select = new XoopsFormSelect(_AM_XLANG_NAME, 'lang_name', $lang_name); - $lang_select->addOptionArray($xlanguage_handler->getXoopsLangList()); - $sform->addElement($lang_select, true); + $lang_select = new XoopsFormSelect(_AM_XLANG_NAME, 'lang_name', $lang_name); + $lang_select->addOptionArray($xlanguage_handler->getXoopsLangList()); + $sform->addElement($lang_select, true); }else{ - $sform->addElement(new XoopsFormText(_AM_XLANG_NAME, 'lang_name', 50, 255, $lang_name), true); + $sform->addElement(new XoopsFormText(_AM_XLANG_NAME, 'lang_name', 50, 255, $lang_name), true); } $sform->addElement(new XoopsFormText(_AM_XLANG_DESC, 'lang_desc', 50, 255, $lang_desc)); @@ -46,23 +46,21 @@ $lang_code->setDescription(_AM_XLANG_CODE_DESC); $sform->addElement($lang_code, true); - //$sform->addElement(new XoopsFormText(_AM_XLANG_CHARSET, 'lang_charset', 50, 255, $lang_charset), true); $lang_charset = new XoopsFormText(_AM_XLANG_CHARSET, 'lang_charset', 50, 255, $lang_charset); $lang_charset->setDescription(_AM_XLANG_CHARSET_DESC); $sform->addElement($lang_charset, true); - if(!$isBase){ - $baseList =& $xlanguage_handler->getAll(); - $base_list = array(); - foreach($baseList as $base => $baselang){ - $base_list[$base] = $base; - } - - $base_select = new XoopsFormSelect(_AM_XLANG_BASE, 'lang_base', $lang_base); - $base_select->addOptionArray($base_list); - $sform->addElement($base_select, true); + $baseList =& $xlanguage_handler->getAll(); + $base_list = array(); + foreach($baseList as $base => $baselang){ + $base_list[$base] = $base; + } + + $base_select = new XoopsFormSelect(_AM_XLANG_BASE, 'lang_base', $lang_base); + $base_select->addOptionArray($base_list); + $sform->addElement($base_select, true); } $sform->addElement(new XoopsFormText(_AM_XLANG_WEIGHT, 'weight', 10, 10, $weight)); @@ -91,4 +89,4 @@ $button_tray->addElement(new XoopsFormButton('', '', _CANCEL, 'submit')); $sform->addElement($button_tray); -$sform->display(); \ No newline at end of file +$sform->display(); Modified: XoopsModules/xlanguage/trunk/xlanguage/admin/main.php =================================================================== --- XoopsModules/xlanguage/trunk/xlanguage/admin/main.php 2015-09-22 13:04:40 UTC (rev 13151) +++ XoopsModules/xlanguage/trunk/xlanguage/admin/main.php 2015-09-25 09:26:23 UTC (rev 13152) @@ -1,4 +1,4 @@ -<?php +<?php // $Id: main.php 8586 2011-12-27 12:03:19Z beckmi $ // ------------------------------------------------------------------------ // // Xlanguage: eXtensible Language Management For Xoops // @@ -37,13 +37,13 @@ if ( isset( $_POST ) ){ foreach ( $_POST as $k => $v ) { ${$k} = $v; - } -} + } +} if ( isset( $_GET ) ){ foreach ( $_GET as $k => $v ) { ${$k} = $v; - } -} + } +} define("XLANG_CONFIG_LINK","<a href='main.php' target='_self'>"._AM_XLANG_CONFIG."</a>"); @@ -53,108 +53,107 @@ switch ( $op ) { case "del": - if (!isset($_POST['ok']) || $_POST['ok'] != 1 ){ - xoops_cp_header(); + if (!isset($_POST['ok']) || $_POST['ok'] != 1 ){ + xoops_cp_header(); $aboutAdmin = new ModuleAdmin(); -echo $aboutAdmin->addNavigation('main.php'); +echo $aboutAdmin->addNavigation('main.php'); // echo "<h4>" . XLANG_CONFIG_LINK . "</h4>"; - xoops_confirm( array( 'op' => 'del', 'type' => $_GET['type'], 'lang_id' => intval( $_GET['lang_id'] ), 'ok' => 1 ), 'main.php', _AM_XLANG_DELETE_CFM ); - }else{ - if(isset($type)&&$type=='ext') $isBase = false; - else $isBase = true; - $lang =& $xlanguage_handler->get($lang_id, $isBase); - $xlanguage_handler->delete($lang); - redirect_header("main.php",2,_AM_XLANG_DELETED); - } + xoops_confirm( array( 'op' => 'del', 'type' => $_GET['type'], 'lang_id' => intval( $_GET['lang_id'] ), 'ok' => 1 ), 'main.php', _AM_XLANG_DELETE_CFM ); + }else{ + if(isset($type)&&$type=='ext') $isBase = false; + else $isBase = true; + $lang =& $xlanguage_handler->get($lang_id, $isBase); + $xlanguage_handler->delete($lang); + redirect_header("main.php",2,_AM_XLANG_DELETED); + } break; case "save": - if(isset($type)&&$type=='ext') $isBase = false; - else $isBase = true; - if(isset($lang_id)&&$lang_id>0){ - $lang =& $xlanguage_handler->get($lang_id, $isBase); - }else{ - $lang =& $xlanguage_handler->create(true, $isBase); - } - $lang_name = preg_replace("/[^a-zA-Z0-9\_\-]/", "", $lang_name); - - $lang->setVar('lang_name',$lang_name); - $lang->setVar('lang_desc',$lang_desc); - $lang->setVar('lang_code',$lang_code); - $lang->setVar('lang_charset',$lang_charset); - $lang->setVar('lang_image',$lang_image); - if(!$isBase){ - $lang->setVar('lang_base',$lang_base); - } - $lang->setVar('weight',$weight); - $xlanguage_handler->insert($lang); - redirect_header("main.php",2,_AM_XLANG_SAVED); + if(isset($type)&&$type=='ext') $isBase = false; + else $isBase = true; + if(isset($lang_id)&&$lang_id>0){ + $lang =& $xlanguage_handler->get($lang_id, $isBase); + }else{ + $lang =& $xlanguage_handler->create(true, $isBase); + } + $lang_name = preg_replace("/[^a-zA-Z0-9\_\-]/", "", $lang_name); + + $lang->setVar('lang_name',$lang_name); + $lang->setVar('lang_desc',$lang_desc); + $lang->setVar('lang_code',$lang_code); + $lang->setVar('lang_charset',$lang_charset); + $lang->setVar('lang_image',$lang_image); + if(!$isBase){ + $lang->setVar('lang_base',$lang_base); + } + $lang->setVar('weight',$weight); + $xlanguage_handler->insert($lang); + redirect_header("main.php",2,_AM_XLANG_SAVED); break; case "edit": xoops_cp_header(); $aboutAdmin = new ModuleAdmin(); -echo $aboutAdmin->addNavigation('main.php'); - // echo "<h4>" . XLANG_CONFIG_LINK . "</h4>"; +echo $aboutAdmin->addNavigation('main.php'); + // echo "<h4>" . XLANG_CONFIG_LINK . "</h4>"; // echo "<br />"; echo "<h4>" . _AM_XLANG_EDITLANG . "</h4>"; - if(isset($type)&&$type=='ext') $isBase = false; - else $isBase = true; - if(isset($lang_id)&&$lang_id>0){ - $lang =& $xlanguage_handler->get($lang_id, $isBase); - }elseif(isset($lang_name)){ - $lang =& $xlanguage_handler->getByName($lang_name, $isBase); - }else{ - $lang =& $xlanguage_handler->create(true, $isBase); - } - $lang_name = $lang->getVar('lang_name'); - $lang_desc = $lang->getVar('lang_desc'); - $lang_code = $lang->getVar('lang_code'); - $lang_charset = $lang->getVar('lang_charset'); - $lang_image = $lang->getVar('lang_image'); - $weight = $lang->getVar('weight'); - if(!$isBase){ - $lang_base = $lang->getVar('lang_base'); - } + if(isset($type)&&$type=='ext') $isBase = false; + else $isBase = true; + if(isset($lang_id)&&$lang_id>0){ + $lang =& $xlanguage_handler->get($lang_id, $isBase); + }elseif(isset($lang_name)){ + $lang =& $xlanguage_handler->getByName($lang_name, $isBase); + }else{ + $lang =& $xlanguage_handler->create(true, $isBase); + } + $lang_name = $lang->getVar('lang_name'); + $lang_desc = $lang->getVar('lang_desc'); + $lang_code = $lang->getVar('lang_code'); + $lang_charset = $lang->getVar('lang_charset'); + $lang_image = $lang->getVar('lang_image'); + $weight = $lang->getVar('weight'); + if(!$isBase){ + $lang_base = $lang->getVar('lang_base'); + } include "langform.inc.php"; break; case "add": xoops_cp_header(); -$aboutAdmin = new ModuleAdmin(); -// echo "<h4>" . XLANG_CONFIG_LINK . "</h4>"; +$aboutAdmin = new ModuleAdmin(); +// echo "<h4>" . XLANG_CONFIG_LINK . "</h4>"; // echo "<br />"; // echo "<h4>" . _AM_XLANG_ADDLANG . "</h4>"; - if(isset($type)&&$type=='ext') { - $isBase = false; - echo $aboutAdmin->addNavigation('main.php?op=add&type=ext'); } - else { - $isBase = true; - echo $aboutAdmin->addNavigation('main.php?op=add&type=base'); - } - $lang_name = ''; - $lang_desc = ''; - $lang_code = ''; - $lang_charset = ''; - $lang_image = ''; - $weight = 1; - $lang_base = ''; + if(isset($type)&&$type=='ext') { + $isBase = false; + echo $aboutAdmin->addNavigation('main.php?op=add&type=ext'); } + else { + $isBase = true; + echo $aboutAdmin->addNavigation('main.php?op=add&type=base'); + } + $lang_name = ''; + $lang_desc = ''; + $lang_code = ''; + $lang_charset = ''; + $lang_image = ''; + $weight = 1; + $lang_base = ''; include "langform.inc.php"; break; - case 'createconfig': + case 'createconfig': xlanguage_createConfig(); redirect_header( 'main.php', 1, _AM_XLANG_CREATED ); exit(); break; case "default": - default: + default: xoops_cp_header(); $mainAdmin = new ModuleAdmin(); -echo $mainAdmin->addNavigation('main.php'); +echo $mainAdmin->addNavigation('main.php'); - // if (TDMDownloads_checkModuleAdmin()){ // $mainAdmin = new ModuleAdmin(); // echo $mainAdmin->addNavigation('downloads.php'); @@ -163,7 +162,7 @@ echo $mainAdmin->renderButton(); // } - + // echo "<h4>" . XLANG_CONFIG_LINK . "</h4>"; languageList(); $configfile_status = (@is_readable(XLANGUAGE_CONFIG_FILE))?_AM_XLANG_CONFIGOK:_AM_XLANG_CONFIGNOTOK; @@ -174,67 +173,66 @@ // echo " - <b><a href='about.php'>" . _AM_XLANG_ABOUT . "</a></b>"; echo"</td></tr></table>"; break; -} +} xoops_cp_footer(); - function languageList() { global $xlanguage_handler, $xoopsModule; global $pathIcon16; - + $lang_list =& $xlanguage_handler->getAllList(); if ( is_array($lang_list)&&count( $lang_list ) > 0 ){ echo"<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\">"; echo "<div style='text-align: center;'><b><h4>" . _AM_XLANG_LANGLIST . "</h4></b><br />"; echo "<table class='outer' width='100%' border='0' cellpadding='0' cellspacing='0' ><tr class='bg2'><th align='center'>" . _AM_XLANG_DESC . "</th><th align='center'>" . _AM_XLANG_NAME . "</th><th align='center'>" . _AM_XLANG_CHARSET . "</th><th align='center'>" . _AM_XLANG_CODE . "</th><th align='center'>" . _AM_XLANG_IMAGE . "</th><th align='center'>" . _AM_XLANG_WEIGHT . "</th><th align='center'>" . _AM_XLANG_BASE . "</th><th align='center'>" . _AM_XLANG_ACTION . "</th></tr>\n"; - $class = 'even'; + $class = 'even'; foreach( array_keys($lang_list) as $lang_name ) { - $lang =& $lang_list[$lang_name]; - $isOrphan = true; - if(isset($lang['base'])){ - echo "<tr>\n"; - echo "<td class='$class' >" . $lang['base'] -> getVar('lang_desc') . "</td>\n"; - echo "<td class='$class' ><b>" . $lang['base'] -> getVar('lang_name') . "</b></td>\n"; - echo "<td class='$class' ><b>" . $lang['base'] -> getVar('lang_charset') . "</b></td>\n"; - echo "<td class='$class' >" . $lang['base'] -> getVar('lang_code') . "</td>\n"; - if(is_readable(XOOPS_ROOT_PATH.'/modules/xlanguage/images/'.$lang['base'] -> getVar('lang_image'))){ - $lang_image = $lang['base'] -> getVar('lang_image'); - }else{ - $lang_image = 'noflag.gif'; - } - echo "<td class='$class' ><img src='" . XOOPS_URL.'/modules/xlanguage/images/'.$lang_image . "' alt='".$lang['base'] -> getVar('lang_desc')."' /></td>\n"; - echo "<td class='$class' >" . $lang['base'] -> getVar('weight') . "</td>\n"; - echo "<td class='$class' >Ø</td>\n"; - echo "<td class='$class' ><a href='main.php?op=edit&type=base&lang_id=" . $lang['base'] -> getVar('lang_id') . "'><img src=".$pathIcon16.'/edit.png title=' . _EDIT . "></a>\n". - "<a href='main.php?op=del&type=base&lang_id=" . $lang['base'] -> getVar('lang_id') . "'><img src=".$pathIcon16.'/delete.png title=' . _DELETE ."></td>\n"; - echo "</tr>\n"; - $isOrphan = false; - $class = ($class == 'odd') ? 'even' : 'odd'; + $lang =& $lang_list[$lang_name]; + $isOrphan = true; + if(isset($lang['base'])){ + echo "<tr>\n"; + echo "<td class='$class' >" . $lang['base'] -> getVar('lang_desc') . "</td>\n"; + echo "<td class='$class' ><b>" . $lang['base'] -> getVar('lang_name') . "</b></td>\n"; + echo "<td class='$class' ><b>" . $lang['base'] -> getVar('lang_charset') . "</b></td>\n"; + echo "<td class='$class' >" . $lang['base'] -> getVar('lang_code') . "</td>\n"; + if(is_readable(XOOPS_ROOT_PATH.'/modules/xlanguage/images/'.$lang['base'] -> getVar('lang_image'))){ + $lang_image = $lang['base'] -> getVar('lang_image'); + }else{ + $lang_image = 'noflag.gif'; + } + echo "<td class='$class' ><img src='" . XOOPS_URL.'/modules/xlanguage/images/'.$lang_image . "' alt='".$lang['base'] -> getVar('lang_desc')."' /></td>\n"; + echo "<td class='$class' >" . $lang['base'] -> getVar('weight') . "</td>\n"; + echo "<td class='$class' >Ø</td>\n"; + echo "<td class='$class' ><a href='main.php?op=edit&type=base&lang_id=" . $lang['base'] -> getVar('lang_id') . "'><img src=".$pathIcon16.'/edit.png title=' . _EDIT . "></a>\n". + "<a href='main.php?op=del&type=base&lang_id=" . $lang['base'] -> getVar('lang_id') . "'><img src=".$pathIcon16.'/delete.png title=' . _DELETE ."></td>\n"; + echo "</tr>\n"; + $isOrphan = false; + $class = ($class == 'odd') ? 'even' : 'odd'; } if(!isset($lang['ext'])||count($lang['ext'])<1) continue; foreach($lang['ext'] as $ext){ - echo "<tr>\n"; - echo "<td class='$class' >" . $ext -> getVar('lang_desc') . "</td>\n"; - echo "<td class='$class' >" . $ext -> getVar('lang_name') . "</td>\n"; - echo "<td class='$class' ><b>" . $ext -> getVar('lang_charset') . "</b></td>\n"; - echo "<td class='$class' >" . $ext -> getVar('lang_code') . "</td>\n"; - if(is_readable(XOOPS_ROOT_PATH.'/modules/xlanguage/images/'.$ext -> getVar('lang_image'))){ - $lang_image = $ext -> getVar('lang_image'); - }else{ - $lang_image = 'noflag.gif'; - } - echo "<td class='$class' ><img src='" . XOOPS_URL.'/modules/xlanguage/images/'.$lang_image . "' alt='".$ext -> getVar('lang_desc')."' /></td>\n"; - echo "<td class='$class' >" . $ext -> getVar('weight') . "</td>\n"; - $lang_base = ($isOrphan)?"<font color='red'>".$ext -> getVar('lang_base')."</font>":$ext -> getVar('lang_base'); - echo "<td class='$class' ><b>" . $lang_base . "</b></td>\n"; - echo "<td class='$class' ><a href='main.php?op=edit&type=ext&lang_id=" . $ext -> getVar('lang_id') . "'><img src=".$pathIcon16.'/edit.png title=' . _EDIT . "></a>\n". - "<a href='main.php?op=del&type=ext&lang_id=" . $ext -> getVar('lang_id') . "'><img src=".$pathIcon16.'/delete.png title=' . _DELETE ."></td>\n"; - echo "</tr>\n"; + echo "<tr>\n"; + echo "<td class='$class' >" . $ext -> getVar('lang_desc') . "</td>\n"; + echo "<td class='$class' >" . $ext -> getVar('lang_name') . "</td>\n"; + echo "<td class='$class' ><b>" . $ext -> getVar('lang_charset') . "</b></td>\n"; + echo "<td class='$class' >" . $ext -> getVar('lang_code') . "</td>\n"; + if(is_readable(XOOPS_ROOT_PATH.'/modules/xlanguage/images/'.$ext -> getVar('lang_image'))){ + $lang_image = $ext -> getVar('lang_image'); + }else{ + $lang_image = 'noflag.gif'; + } + echo "<td class='$class' ><img src='" . XOOPS_URL.'/modules/xlanguage/images/'.$lang_image . "' alt='".$ext -> getVar('lang_desc')."' /></td>\n"; + echo "<td class='$class' >" . $ext -> getVar('weight') . "</td>\n"; + $lang_base = ($isOrphan)?"<font color='red'>".$ext -> getVar('lang_base')."</font>":$ext -> getVar('lang_base'); + echo "<td class='$class' ><b>" . $lang_base . "</b></td>\n"; + echo "<td class='$class' ><a href='main.php?op=edit&type=ext&lang_id=" . $ext -> getVar('lang_id') . "'><img src=".$pathIcon16.'/edit.png title=' . _EDIT . "></a>\n". + "<a href='main.php?op=del&type=ext&lang_id=" . $ext -> getVar('lang_id') . "'><img src=".$pathIcon16.'/delete.png title=' . _DELETE ."></td>\n"; + echo "</tr>\n"; } - echo "<tr><td colspan='9' ></td></tr>\n"; - $class = ($class == 'odd') ? 'even' : 'odd'; + echo "<tr><td colspan='9' ></td></tr>\n"; + $class = ($class == 'odd') ? 'even' : 'odd'; } echo "</table></div>\n"; @@ -242,4 +240,3 @@ echo "<br />"; } } -?> Modified: XoopsModules/xlanguage/trunk/xlanguage/api.php =================================================================== --- XoopsModules/xlanguage/trunk/xlanguage/api.php 2015-09-22 13:04:40 UTC (rev 13151) +++ XoopsModules/xlanguage/trunk/xlanguage/api.php 2015-09-25 09:26:23 UTC (rev 13152) @@ -36,43 +36,43 @@ $xlanguage["action"] = false; if (!empty($_GET[XLANGUAGE_LANG_TAG])) { - $cookie_path = "/"; - setcookie($cookie_var, $_GET[XLANGUAGE_LANG_TAG], time()+3600*24*30, $cookie_path, '', 0); - $xlanguage["lang"] = $_GET[XLANGUAGE_LANG_TAG]; + $cookie_path = "/"; + setcookie($cookie_var, $_GET[XLANGUAGE_LANG_TAG], time()+3600*24*30, $cookie_path, '', 0); + $xlanguage["lang"] = $_GET[XLANGUAGE_LANG_TAG]; }elseif (!empty($_COOKIE[$cookie_var])) { - $xlanguage["lang"] = $_COOKIE[$cookie_var]; - /* FIXME: shall we remove it? */ - /* - if(preg_match("/[&|\?]\b".XLANGUAGE_LANG_TAG."\b=/i",$_SERVER['REQUEST_URI'])){ - }elseif (strpos($_SERVER['REQUEST_URI'], "?")) { - $_SERVER['REQUEST_URI'] .= "&".XLANGUAGE_LANG_TAG."=".$xlanguage["lang"]; + $xlanguage["lang"] = $_COOKIE[$cookie_var]; + /* FIXME: shall we remove it? */ + /* + if(preg_match("/[&|\?]\b".XLANGUAGE_LANG_TAG."\b=/i",$_SERVER['REQUEST_URI'])){ + }elseif (strpos($_SERVER['REQUEST_URI'], "?")) { + $_SERVER['REQUEST_URI'] .= "&".XLANGUAGE_LANG_TAG."=".$xlanguage["lang"]; }else{ - $_SERVER['REQUEST_URI'] .= "?".XLANGUAGE_LANG_TAG."=".$xlanguage["lang"]; + $_SERVER['REQUEST_URI'] .= "?".XLANGUAGE_LANG_TAG."=".$xlanguage["lang"]; } */ -}elseif($lang = xlanguage_detectLang()) { - $xlanguage["lang"] = $lang; +}elseif($lang = xlanguage_detectLang()) { + $xlanguage["lang"] = $lang; }else{ - $xlanguage["lang"] = $xoopsConfig['language']; + $xlanguage["lang"] = $xoopsConfig['language']; } $xlanguage_handler=& xoops_getmodulehandler('language', 'xlanguage'); $xlanguage_handler->loadConfig(); $lang = $xlanguage_handler->getByName($xlanguage["lang"]); if(is_object($lang) && strcasecmp($lang->getVar('lang_name'),$xoopsConfig['language'])){ - if($lang->isBase()){ - $xoopsConfig['language'] = $lang->getVar('lang_name'); - }else{ - $lang_base = $xlanguage_handler->getByName($lang->getVar('lang_base')); - if(is_object($lang_base)){ - $xlanguage['charset_base'] = $lang_base->getVar('lang_charset'); - $xlanguage["action"] = true; - $xoopsConfig['language'] = $lang_base->getVar('lang_name'); - unset($lang_base); - } - } - if($lang->getVar('lang_charset')) $xlanguage['charset'] = $lang->getVar('lang_charset'); - if($lang->getVar('lang_code')) $xlanguage['code'] = $lang->getVar('lang_code'); + if($lang->isBase()){ + $xoopsConfig['language'] = $lang->getVar('lang_name'); + }else{ + $lang_base = $xlanguage_handler->getByName($lang->getVar('lang_base')); + if(is_object($lang_base)){ + $xlanguage['charset_base'] = $lang_base->getVar('lang_charset'); + $xlanguage["action"] = true; + $xoopsConfig['language'] = $lang_base->getVar('lang_name'); + unset($lang_base); + } + } + if($lang->getVar('lang_charset')) $xlanguage['charset'] = $lang->getVar('lang_charset'); + if($lang->getVar('lang_code')) $xlanguage['code'] = $lang->getVar('lang_code'); } unset($lang); @@ -84,22 +84,21 @@ $in_charset = $xlanguage["charset"]; $out_charset = $xlanguage["charset_base"]; - //$CONV_REQUEST_array=array("_GET", "_POST"); - $CONV_REQUEST_array=array("_POST"); - foreach ($CONV_REQUEST_array as $HV){ - if(!empty(${$HV})) { - ${$HV} = xlanguage_convert_encoding(${$HV}, $out_charset, $in_charset); - } - $GLOBALS["HTTP".$HV."_VARS"] = ${$HV}; - } - } - ob_start("xlanguage_encoding"); + //$CONV_REQUEST_array=array("_GET", "_POST"); + $CONV_REQUEST_array=array("_POST"); + foreach ($CONV_REQUEST_array as $HV){ + if(!empty(${$HV})) { + ${$HV} = xlanguage_convert_encoding(${$HV}, $out_charset, $in_charset); + } + $GLOBALS["HTTP".$HV."_VARS"] = ${$HV}; + } + } + ob_start("xlanguage_encoding"); }else{ - ob_start("xlanguage_ml"); + ob_start("xlanguage_ml"); } - -/* +/* * hardcoded scripts for language switching in theme html files * * To use it: @@ -107,9 +106,8 @@ * 2 config options "$options = array("images", " ", 5); // display mode, delimitor, number per line"; Options for display mode: image - flag; text - text; dropdown - dropdown selection box with text * 3 insert "<{$smarty.const.XLANGUAGE_SWITCH_CODE}>" into your theme html anywhere you would like to see it present */ -$xlanguage_theme_enable = true; +$xlanguage_theme_enable = true; if(!empty($xlanguage_theme_enable)){ - $options = array("dropdown", " ", 5); // display mode, delimitor, number per line - xlanguage_select_show($options); -} -?> + $options = array("dropdown", " ", 5); // display mode, delimitor, number per line + xlanguage_select_show($options); +} Modified: XoopsModules/xlanguage/trunk/xlanguage/blocks/xlanguage_blocks.php =================================================================== --- XoopsModules/xlanguage/trunk/xlanguage/blocks/xlanguage_blocks.php 2015-09-22 13:04:40 UTC (rev 13151) +++ XoopsModules/xlanguage/trunk/xlanguage/blocks/xlanguage_blocks.php 2015-09-25 09:26:23 UTC (rev 13152) @@ -1,108 +1,108 @@ -<?php -// $Id$ -// ------------------------------------------------------------------------ // -// Xlanguage: eXtensible Language Management For Xoops // -// Copyright (c) 2004 Xoops China Community // -// <http://www.xoops.org.cn/> // -// ------------------------------------------------------------------------ // -// 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: D.J.(phppp) ph...@ho... // -// URL: http://www.xoops.org.cn // -// ------------------------------------------------------------------------- // - -function b_xlanguage_select_show($options) -{ - global $xlanguage; - - $block = array(); - - $xlanguage_handler =& xoops_getmodulehandler('language', 'xlanguage'); - $xlanguage_handler->loadConfig(); - $lang_list = $xlanguage_handler->getAllList(); - if ( !is_array($lang_list) || count($lang_list)<1 ) return $block; - - $languages = array(); - foreach( $lang_list as $lang_name => $lang ) { - if(!isset($lang['base'])) continue; - $languages[$lang_name]['name'] = $lang_name; - $languages[$lang_name]['desc'] = $lang['base']->getVar('lang_desc'); - $languages[$lang_name]['image'] = XOOPS_URL."/modules/xlanguage/images/".$lang['base']->getVar('lang_image'); - if( !isset($lang['ext']) || count($lang['ext']) < 1 ) continue; - foreach($lang['ext'] as $ext){ - $languages[$ext->getVar('lang_name')]['name'] = $ext->getVar('lang_name'); - $languages[$ext->getVar('lang_name')]['desc'] = $ext->getVar('lang_desc'); - $languages[$ext->getVar('lang_name')]['image'] = XOOPS_URL."/modules/xlanguage/images/".$ext->getVar('lang_image'); - } - } - - $QUERY_STRING_array = array_filter(explode("&",xoops_getenv('QUERY_STRING'))); - $QUERY_STRING_new = array(); - foreach ($QUERY_STRING_array as $QUERY){ - if(substr($QUERY, 0, (strlen(XLANGUAGE_LANG_TAG)+1)) != XLANGUAGE_LANG_TAG."=") { - $vals = explode("=", $QUERY); - foreach(array_keys($vals) as $key){ - if(preg_match("/^a-z0-9$/i", $vals[$key])) $vals[$key] = urlencode($vals[$key]); - } - $QUERY_STRING_new[] = implode("=", $vals); - } - } - - $block["display"] = $options[0]; - $block["delimitor"] = $options[1]; - $block["number"] = $options[2]; - $block["selected"] = $xlanguage["lang"]; - if ( $options[0] == "images" || $options[0] == "text" ) { - $query_string = htmlSpecialChars(implode("&", $QUERY_STRING_new)); - $query_string .= empty($query_string)? "" : "&"; - }else{ - $query_string = implode("&", array_map("htmlspecialchars", $QUERY_STRING_new)); - $query_string .= empty($query_string)? "" : "&"; - } - $block["url"] = xoops_getenv('PHP_SELF')."?".$query_string.XLANGUAGE_LANG_TAG."="; - $block["languages"] =& $languages; - - return $block; -} - -function b_xlanguage_select_edit($options) -{ - $form = _MB_XLANGUAGE_DISPLAY_METHOD." <select name='options[]'>"; - $form .= "<option value='images'"; - if ( $options[0] == "images" ) { - $form .= " selected='selected'"; - } - $form .= ">"._MB_XLANGUAGE_DISPLAY_FLAGLIST."</option>\n"; - $form .= "<option value='text'"; - if($options[0] == "text"){ - $form .= " selected='selected'"; - } - $form .= ">"._MB_XLANGUAGE_DISPLAY_TEXTLIST."</option>\n"; - $form .= "<option value='dropdown'"; - if($options[0] == "dropdown"){ - $form .= " selected='selected'"; - } - $form .= ">"._MB_XLANGUAGE_DISPLAY_DROPDOWNLIST."</option>\n"; - $form .= "</select>\n"; - $form .= "<br />"._MB_XLANGUAGE_IMAGE_SEPARATOR." ("._MB_XLANGUAGE_OPTIONAL."): <input type='text' name='options[]' value='".$options[1]."' />"; - $form .= "<br />"._MB_XLANGUAGE_IMAGE_PERROW." ("._MB_XLANGUAGE_OPTIONAL."): <input type='text' name='options[]' value='".$options[2]."' />"; - return $form; -} -?> \ No newline at end of file +<?php +// $Id$ +// ------------------------------------------------------------------------ // +// Xlanguage: eXtensible Language Management For Xoops // +// Copyright (c) 2004 Xoops China Community // +// <http://www.xoops.org.cn/> // +// ------------------------------------------------------------------------ // +// 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: D.J.(phppp) ph...@ho... // +// URL: http://www.xoops.org.cn // +// ------------------------------------------------------------------------- // + +function b_xlanguage_select_show($options) +{ + global $xlanguage; + + $block = array(); + + $xlanguage_handler =& xoops_getmodulehandler('language', 'xlanguage'); + $xlanguage_handler->loadConfig(); + $lang_list = $xlanguage_handler->getAllList(); + if ( !is_array($lang_list) || count($lang_list)<1 ) return $block; + + $languages = array(); + foreach( $lang_list as $lang_name => $lang ) { + if(!isset($lang['base'])) continue; + $languages[$lang_name]['name'] = $lang_name; + $languages[$lang_name]['desc'] = $lang['base']->getVar('lang_desc'); + $languages[$lang_name]['image'] = XOOPS_URL."/modules/xlanguage/images/".$lang['base']->getVar('lang_image'); + if( !isset($lang['ext']) || count($lang['ext']) < 1 ) continue; + foreach($lang['ext'] as $ext){ + $languages[$ext->getVar('lang_name')]['name'] = $ext->getVar('lang_name'); + $languages[$ext->getVar('lang_name')]['desc'] = $ext->getVar('lang_desc'); + $languages[$ext->getVar('lang_name')]['image'] = XOOPS_URL."/modules/xlanguage/images/".$ext->getVar('lang_image'); + } + } + + $QUERY_STRING_array = array_filter(explode("&",xoops_getenv('QUERY_STRING'))); + $QUERY_STRING_new = array(); + foreach ($QUERY_STRING_array as $QUERY){ + if(substr($QUERY, 0, (strlen(XLANGUAGE_LANG_TAG)+1)) != XLANGUAGE_LANG_TAG."=") { + $vals = explode("=", $QUERY); + foreach(array_keys($vals) as $key){ + if(preg_match("/^a-z0-9$/i", $vals[$key])) $vals[$key] = urlencode($vals[$key]); + } + $QUERY_STRING_new[] = implode("=", $vals); + } + } + + $block["display"] = $options[0]; + $block["delimitor"] = $options[1]; + $block["number"] = $options[2]; + $block["selected"] = $xlanguage["lang"]; + if ( $options[0] == "images" || $options[0] == "text" ) { + $query_string = htmlSpecialChars(implode("&", $QUERY_STRING_new)); + $query_string .= empty($query_string)? "" : "&"; + }else{ + $query_string = implode("&", array_map("htmlspecialchars", $QUERY_STRING_new)); + $query_string .= empty($query_string)? "" : "&"; + } + $block["url"] = xoops_getenv('PHP_SELF')."?".$query_string.XLANGUAGE_LANG_TAG."="; + $block["languages"] =& $languages; + + return $block; +} + +function b_xlanguage_select_edit($options) +{ + $form = _MB_XLANGUAGE_DISPLAY_METHOD." <select name='options[]'>"; + $form .= "<option value='images'"; + if ( $options[0] == "images" ) { + $form .= " selected='selected'"; + } + $form .= ">"._MB_XLANGUAGE_DISPLAY_FLAGLIST."</option>\n"; + $form .= "<option value='text'"; + if($options[0] == "text"){ + $form .= " selected='selected'"; + } + $form .= ">"._MB_XLANGUAGE_DISPLAY_TEXTLIST."</option>\n"; + $form .= "<option value='dropdown'"; + if($options[0] == "dropdown"){ + $form .= " selected='selected'"; + } + $form .= ">"._MB_XLANGUAGE_DISPLAY_DROPDOWNLIST."</option>\n"; + $form .= "</select>\n"; + $form .= "<br />"._MB_XLANGUAGE_IMAGE_SEPARATOR." ("._MB_XLANGUAGE_OPTIONAL."): <input type='text' name='options[]' value='".$options[1]."' />"; + $form .= "<br />"._MB_XLANGUAGE_IMAGE_PERROW." ("._MB_XLANGUAGE_OPTIONAL."): <input type='text' name='options[]' value='".$options[2]."' />"; + + return $form; +} Modified: XoopsModules/xlanguage/trunk/xlanguage/class/language.php =================================================================== --- XoopsModules/xlanguage/trunk/xlanguage/class/language.php 2015-09-22 13:04:40 UTC (rev 13151) +++ XoopsModules/xlanguage/trunk/xlanguage/class/language.php 2015-09-25 09:26:23 UTC (rev 13152) @@ -33,7 +33,7 @@ class Blanguage extends XoopsObject { - var $isBase; + var $isBase; function Blanguage() { $this -> db = & XoopsDatabaseFactory::getDatabaseConnection(); @@ -50,7 +50,7 @@ function prepareVars() { foreach ($this->vars as $k => $v) { - $cleanv = $this->cleanVars[$k]; + $cleanv = $this->cleanVars[$k]; switch ($v['data_type']) { case XOBJ_DTYPE_TXTBOX: case XOBJ_DTYPE_TXTAREA: @@ -63,7 +63,7 @@ break; case XOBJ_DTYPE_INT: $cleanv = ($v['changed'])?intval($cleanv):0; - break; + break; case XOBJ_DTYPE_ARRAY: $cleanv = ($v['changed'])?$cleanv:serialize(array()); break; @@ -79,25 +79,25 @@ $this->cleanVars[$k] =& $cleanv; unset($cleanv); } + return true; } function setBase() { - $this->isBase = true; + $this->isBase = true; } function isBase() { - return $this->isBase; + return $this->isBase; } } - class Xlanguage extends Blanguage { function Xlanguage() { - $this->Blanguage(); + $this->Blanguage(); $this->table = $this -> db -> prefix( "xlanguage_ext" ); $this->initVar('lang_base', XOBJ_DTYPE_TXTBOX); $this->isBase = false; @@ -106,126 +106,131 @@ class XlanguageLanguageHandler extends XoopsObjectHandler { - var $cached_config; + var $cached_config; - function loadConfig() - { - $this->cached_config =& $this->loadFileConfig(); - } + function loadConfig() + { + $this->cached_config =& $this->loadFileConfig(); + } function &get($id, $isBase =true) { - $lang = null; - $id = intval($id); - if(!$id) { - return $lang; - } - $prefix = ($isBase) ? "xlanguage_base" : "xlanguage_ext"; - if(isset($this->cached_config[$prefix][$id])) { - $array = $this->cached_config[$prefix][$id]; - }else{ - $sql = 'SELECT * FROM '.$this->db->prefix($prefix).' WHERE lang_id='.$id; - $array = $this->db->fetchArray($this->db->query($sql)); + $lang = null; + $id = intval($id); + if(!$id) { + return $lang; } + $prefix = ($isBase) ? "xlanguage_base" : "xlanguage_ext"; + if(isset($this->cached_config[$prefix][$id])) { + $array = $this->cached_config[$prefix][$id]; + }else{ + $sql = 'SELECT * FROM '.$this->db->prefix($prefix).' WHERE lang_id='.$id; + $array = $this->db->fetchArray($this->db->query($sql)); + } if(!is_array($array) || count($array)==0){ - return $lang; - } + return $lang; + } $lang =& $this->create(false, $isBase); $lang->assignVars($array); if($isBase) $lang->isBase = true; + return $lang; } function &getByName($name) { - $lang = null; - if(empty($name) || preg_match("/[^a-zA-Z0-9\_\-]/", $name)) { - return $lang; - } - $isBase = false; - if(isset($this->cached_config['xlanguage_base'][$name])) { - $array = $this->cached_config['xlanguage_base'][$name]; - $isBase = true; - }elseif(isset($this->cached_config['xlanguage_ext'][$name])) { - $array = $this->cached_config['xlanguage_ext'][$name]; - }elseif(!isset($this->cached_config)){ - $sql = 'SELECT * FROM '.$this->db->prefix('xlanguage_base').' WHERE lang_name=\''.$name.'\''; - $result=$this->db->query($sql); - $array = $this->db->fetchArray($result); - if(!is_array($array) || count($array)==0){ - $sql = 'SELECT * FROM '.$this->db->prefix('xlanguage_ext').' WHERE lang_name=\''.$name.'\''; - $result=$this->db->query($sql); - $array = $this->db->fetchArray($result); - if(!is_array($array) || count($array)==0){ - return $lang; - } - }else{ - $isBase = true; - } + $lang = null; + if(empty($name) || preg_match("/[^a-zA-Z0-9\_\-]/", $name)) { + return $lang; } + $isBase = false; + if(isset($this->cached_config['xlanguage_base'][$name])) { + $array = $this->cached_config['xlanguage_base'][$name]; + $isBase = true; + }elseif(isset($this->cached_config['xlanguage_ext'][$name])) { + $array = $this->cached_config['xlanguage_ext'][$name]; + }elseif(!isset($this->cached_config)){ + $sql = 'SELECT * FROM '.$this->db->prefix('xlanguage_base').' WHERE lang_name=\''.$name.'\''; + $result=$this->db->query($sql); + $array = $this->db->fetchArray($result); + if(!is_array($array) || count($array)==0){ + $sql = 'SELECT * FROM '.$this->db->prefix('xlanguage_ext').' WHERE lang_name=\''.$name.'\''; + $result=$this->db->query($sql); + $array = $this->db->fetchArray($result); + if(!is_array($array) || count($array)==0){ + return $lang; + } + }else{ + $isBase = true; + } + } if(empty($array)) { - return $lang; + return $lang; } $lang =& $this->create(false, $isBase); $lang->assignVars($array); if(!isset($array['lang_base'])) $lang->isBase = true; + return $lang; } function &getAll($isBase = true) { - $prefix = ($isBase) ? "xlanguage_base" : "xlanguage_ext"; + $prefix = ($isBase) ? "xlanguage_base" : "xlanguage_ext"; $ret = array(); - if(isset($this->cached_config[$prefix])) { - $array = $this->cached_config[$prefix]; - foreach($array as $lang_name=>$myrow){ - $lang =& $this->create(false,$isBase); - $lang->assignVars($myrow); - $ret[$myrow['lang_name']] = $lang; - unset($lang); - } - }elseif(!isset($this->cached_config)){ - $sql = 'SELECT * FROM '.$this->db->prefix($prefix); - $result = $this->db->query($sql); - while ($myrow = $this->db->fetchArray($result)) { - $lang =& $this->create(false,$isBase); - $lang->assignVars($myrow); - $ret[$myrow['lang_name']] = $lang; - unset($lang); - } + if(isset($this->cached_config[$prefix])) { + $array = $this->cached_config[$prefix]; + foreach($array as $lang_name=>$myrow){ + $lang =& $this->create(false,$isBase); + $lang->assignVars($myrow); + $ret[$myrow['lang_name']] = $lang; + unset($lang); + } + }elseif(!isset($this->cached_config)){ + $sql = 'SELECT * FROM '.$this->db->prefix($prefix); + $result = $this->db->que... [truncated message content] |