PageRenderTime 46ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/administrator/components/com_joomfish/previewtranslation.php

https://bitbucket.org/dgough/annamaria-daneswood-25102012
PHP | 172 lines | 115 code | 19 blank | 38 comment | 19 complexity | b5ec5f20e688cbb861b7499fba715c69 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Joom!Fish - Multi Lingual extention and translation manager for Joomla!
  4. * Copyright (C) 2003-2007 Think Network GmbH, Munich
  5. *
  6. * All rights reserved. The Joom!Fish project is a set of extentions for
  7. * the content management system Joomla!. It enables Joomla!
  8. * to manage multi lingual sites especially in all dynamic information
  9. * which are stored in the database.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version 2
  14. * of the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
  24. *
  25. * The "GNU General Public License" (GPL) is available at
  26. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  27. * -----------------------------------------------------------------------------
  28. * $Id: joomfish.class.php 541 2007-06-21 15:43:05Z akede $
  29. *
  30. */
  31. // Set flag that this is a parent file
  32. define( "_VALID_MOS", 1 );
  33. require_once( '../../includes/auth.php' );
  34. /** required standard extentions **/
  35. require_once( mosMainFrame::getBasePath() .'/components/com_joomfish/includes/defines.php' );
  36. require_once( JOOMFISH_LIBPATH .DS. 'joomla' .DS. 'language.php' );
  37. // limit access to functionality
  38. $option = strval( mosGetParam( $_SESSION, 'option', '' ) );
  39. $task = strval( mosGetParam( $_SESSION, 'task', '' ) );
  40. switch ($option) {
  41. case 'com_joomfish':
  42. if ( $task != 'edit' ) {
  43. echo _NOT_AUTH;
  44. return;
  45. }
  46. break;
  47. default:
  48. echo _NOT_AUTH;
  49. return;
  50. break;
  51. }
  52. $css = mosGetParam( $_REQUEST, 't', '' );
  53. // css file handling
  54. // check to see if template exists
  55. if ( $css != '' && is_dir($mosConfig_absolute_path .'/templates/'. $css .'/css/template_css.css' )) {
  56. $css = $css;
  57. } else if ( $css == '' ) {
  58. $css = 'rhuk_solarflare_ii';
  59. }
  60. include_once ( $mosConfig_absolute_path . '/language/' . $mosConfig_lang . '.php' );
  61. $iso = split( '=', _ISO );
  62. // xml prolog
  63. echo '<?xml version="1.0" encoding="'. $iso[1] .'"?' .'>';
  64. ?>
  65. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  66. <html xmlns="http://www.w3.org/1999/xhtml">
  67. <base href="<?php echo($mosConfig_live_site); ?>/" />
  68. <head>
  69. <title>Content Translation Preview</title>
  70. <script language="Javascript" type="text/javascript">
  71. window.resizeTo(800,600);
  72. </script>
  73. <link rel="stylesheet" href="templates/<?php echo $css;?>/css/template_css.css" type="text/css" />
  74. <script>
  75. var form = window.opener.document.adminForm ;
  76. var title = form.refField_title.value;
  77. var title_orig = form.origText_title.value;
  78. var alltext = form.refField_introtext.value;
  79. var alltext_orig = window.opener.document.getElementById("original_value_introtext").innerHTML;
  80. if (form.refField_fulltext) {
  81. alltext += form.refField_fulltext.value;
  82. alltext_orig += window.opener.document.getElementById("original_value_fulltext").innerHTML;
  83. }
  84. // can't do the images
  85. images = window.opener.document.getElementById("original_value_images");
  86. images = images.innerHTML;
  87. imagelist = images.split( '\n' );
  88. var temp = new Array();
  89. img=0
  90. for (var i=0, n=imagelist.length; i < n; i++) {
  91. value = imagelist[i];
  92. // trim leading spaces
  93. value = value.replace(/^\s*/g,'')
  94. if (value){
  95. parts = value.split( '|' );
  96. temp[img] = '<img src="<?php echo $mosConfig_live_site;?>/images/stories/' + parts[0] + '" align="' + parts[1] + '" border="' + parts[3] + '" alt="' + parts[2] + '" hspace="6" />';
  97. img++;
  98. }
  99. }
  100. var temp2 = alltext_orig.split( '{mosimage}' );
  101. var alltext_orig = temp2[0];
  102. for (var i=0, n=temp2.length-1; i < n; i++) {
  103. alltext_orig += temp[i] + temp2[i+1];
  104. }
  105. if (form.refField_images && form.refField_images.value.legth>0){
  106. images = form.refField_images.value;
  107. }
  108. else {
  109. images = window.opener.document.getElementById("original_value_images");
  110. images = images.innerHTML;
  111. }
  112. imagelist = images.split( '\n' );
  113. var temp = new Array();
  114. img=0
  115. for (var i=0, n=imagelist.length; i < n; i++) {
  116. value = imagelist[i];
  117. // trim leading spaces
  118. value = value.replace(/^\s*/g,'')
  119. if (value){
  120. parts = value.split( '|' );
  121. temp[img] = '<img src="<?php echo $mosConfig_live_site;?>/images/stories/' + parts[0] + '" align="' + parts[1] + '" border="' + parts[3] + '" alt="' + parts[2] + '" hspace="6" />';
  122. img++;
  123. }
  124. }
  125. var temp2 = alltext.split( '{mosimage}' );
  126. var alltext = temp2[0];
  127. for (var i=0, n=temp2.length-1; i < n; i++) {
  128. alltext += temp[i] + temp2[i+1];
  129. }
  130. </script>
  131. <meta http-equiv="Content-Type" content="text/html; <?php echo _ISO; ?>" />
  132. </head>
  133. <body style="background-color:#FFFFFF;margin:0px;">
  134. <table align="center" width="100%" cellspacing="2" cellpadding="2" border="0">
  135. <tr>
  136. <th ><h2><?php echo JText::_("Original");?></h2></th>
  137. <th ><h2><?php echo JText::_("Translation");?></h2></th>
  138. </tr>
  139. <tr>
  140. <td class="contentheading" style="width:50%!important"><script>document.write(title_orig);</script></td>
  141. <td class="contentheading" ><script>document.write(title);</script></td>
  142. </tr>
  143. <tr>
  144. <script>document.write("<td valign=\"top\" >" + alltext_orig + "</td>");</script>
  145. <script>document.write("<td valign=\"top\" >" + alltext + "</td>");</script>
  146. </tr>
  147. <tr>
  148. <td align="right"><a href="#" onClick="window.close()"><?php echo JText::_("Close");?></a></td>
  149. <td align="left"><a href="javascript:;" onClick="window.print(); return false"><?php echo JText::_("Print");?></a></td>
  150. </tr>
  151. </table>
  152. </body>
  153. </html>