[prev in list] [next in list] [prev in thread] [next in thread] 

List:       twig-devel
Subject:    [twig-devel] patch for multilanguage composing etc.
From:       Alan Knowles <alan_k () hklc ! com>
Date:       2000-06-26 9:18:46
[Download RAW message or body]

Hopefully attached is a working patch against the current CVS of the
modification required to correctly get the multilanguage posting on mail etc.

I have missed where we are on release cycles - eg. If this goes into CVS now I
think it needs a few eyes just to double check before it goes out on a
release..

regards

alan
-- 
Technical Director
Linux Center (HK) Ltd.
www.hklc.com



["test.diff" (application/octet-stream)]

diff -u -r -P --exclude=CVS --exclude=.* twig2/features/common.inc.php3 \
                twig_multilanguage/features/common.inc.php3
--- twig2/features/common.inc.php3	Mon May 29 09:04:41 2000
+++ twig_multilanguage/features/common.inc.php3	Fri Jun 23 12:02:34 2000
@@ -100,7 +100,8 @@
 
  	Function massage( $str ) 
 		{ // Fixes fu for things like NetPositive
-  		return htmlspecialchars( str_replace( "\r", "", $str ) );
+  		//return htmlspecialchars( str_replace( "\r", "", $str ) );
+		return  str_replace( "\r", "", $str ) ;
  		} 
 
 	Function FindHtml( $string = "" ) 
@@ -457,13 +458,13 @@
 	// Unabashedly ripped from imp - anoah
 	Function TWIG_decode_mime_string( $string ) 
 		{
- 		GLOBAL $config;
+ 		GLOBAL $config, $charset_in_mime;
 
 		TWIGDebug( "TWIG_decode_mime_string( \"" . $string . "\" );", 30 );
 
   		$pos = strpos( $string, "=?" );
 
-  		if( !is_int( $pos ) ) {	return $string;	}
+  		if( !is_int( $pos ) ) {	return htmlspecialchars($string); }
   
   		$preceding = substr( $string, 0, $pos ); // save any preceding text
   
@@ -471,19 +472,19 @@
    		$search = substr( $string, $pos+2, $end - $pos - 2 ); // the mime header spec \
says this is the longest a single encoded word can be  
   		$d1 = strpos( $search, "?" );
-  		if( !is_int( $d1 ) ) { return $string; }
+  		if( !is_int( $d1 ) ) { return htmlspecialchars($string); }
   
    		$charset = strtolower(substr( $string, $pos+2, $d1 ));
   		$search = substr( $search, $d1+1 );
   
   		$d2 = strpos( $search, "?" );
-  		if( !is_int( $d2 ) ) { return $string; }
+  		if( !is_int( $d2 ) ) { return htmlspecialchars($string); }
   
   		$encoding = substr( $search, 0, $d2 );
   		$search = substr( $search, $d2+1 );
   
   		$end = strpos( $search, "?=" );
-  		if( !is_int( $end ) ) { return $string; }
+  		if( !is_int( $end ) ) { return htmlspecialchars($string); }
   
   		$encoded_text = substr( $search, 0, $end );
   		$rest = substr( $string, ( strlen( $preceding . $charset . $encoding . \
$encoded_text ) + 6 ) ); @@ -518,12 +519,12 @@
 				{
  				$from = $config["charactersets"][$charset];
 				$to =  $config["charactersets"][$config["globalcharset"]];
-
-  				if( $from && $to ) { $decoded = convert_cyr_string( $decoded, $from, $to ); }	
+                                $decoded = htmlspecialchars($decoded);
+          			if( $from && $to ) { $decoded = convert_cyr_string( $decoded, $from, \
$to ); }	  }
   			}
-  
-  		return $preceding . $decoded . TWIG_decode_mime_string($rest);
+                if ( $charset )  { $charset_in_mime[$charset] = "YES"; }
+  		return htmlspecialchars($preceding ). $decoded . TWIG_decode_mime_string($rest);
 		}
 
 	Function TWIGProcessGPCString( $string )
diff -u -r -P --exclude=CVS --exclude=.* twig2/features/mail/mail.compose.inc.php3 \
                twig_multilanguage/features/mail/mail.compose.inc.php3
--- twig2/features/mail/mail.compose.inc.php3	Sun Jun 11 02:27:10 2000
+++ twig_multilanguage/features/mail/mail.compose.inc.php3	Fri Jun 23 16:07:09 2000
@@ -18,14 +18,15 @@
 
  if( $action == "forward_inline" ) 
 	{
-	$form["subject"] = "Fwd: " . TWIG_decode_mime_string( $headers->Subject ); 
+	$form["subject"] = "Fwd: " . TWIG_decode_mime_string( $headers->Subject ) . "\n"; 
  	$msginfo = TWIGGetMsgInfo( TWIGMailFetchStructure($mbox,$path) );
    	$body = TWIGDecodeBody( $body, $msginfo["1"] );
 	$form["body"] = $TWIGphrase["Forwarded From:"] . " " . TWIG_decode_mime_string( \
$headers->fromaddress ) . "\r\n\r\n";  $form["body"] .= "> " . str_replace( \
"\r\n","\r\n> ", $body ) . "\r\n\r\n";  }
-
- $form["body"] = massage( $form["body"] );
+ if ($msginfo["charset"] != $config["globalcharset"]) {
+     $form["body"] = massage( $form["body"] );
+ }
 ?>
 <table width=100% cellpadding=0 cellspacing=0 border=0>
  <tr>
diff -u -r -P --exclude=CVS --exclude=.* twig2/features/mail/mail.forward.inc.php3 \
                twig_multilanguage/features/mail/mail.forward.inc.php3
--- twig2/features/mail/mail.forward.inc.php3	Fri Mar 31 12:28:04 2000
+++ twig_multilanguage/features/mail/mail.forward.inc.php3	Fri Jun 23 11:43:35 2000
@@ -3,7 +3,7 @@
 
     	$check = TWIGMailBoxCheck( $mbox );
  	$headers = @TWIGMailHeader( $mbox, $path, 0, 0, $config["fromdomain"] );
-	$headers->Subject = massage( TWIG_decode_mime_string( $headers->Subject ) );
+	//$headers->Subject = massage( TWIG_decode_mime_string( $headers->Subject ) );
  	$body = TWIGMailFetchBody( $mbox, $path, 1 );
 
    	$form["body"] = TWIG_decode_mime_string( $headers->fromaddress ) . " " . \
                $TWIGphrase["said:"] . "\r\n\r\n";
diff -u -r -P --exclude=CVS --exclude=.* twig2/features/mail/mail.inc.php3 \
                twig_multilanguage/features/mail/mail.inc.php3
--- twig2/features/mail/mail.inc.php3	Thu Jun  8 02:35:29 2000
+++ twig_multilanguage/features/mail/mail.inc.php3	Fri Jun 23 16:09:49 2000
@@ -170,7 +170,7 @@
 // places. function includes logic to determine if file should/can be inline
 // this function is copyright allan noah <anoah@pfeiffer.edu> and licensed under the \
GPL.  Function TWIGGetSectionInfo($structure,$nullok=0){
-   GLOBAL $mime, $encoding;
+   GLOBAL $mime, $encoding,$charset_in_mime;
 
    if( isset($structure->encoding) ) {
      $enctype=$encoding["$structure->encoding"];
@@ -218,6 +218,7 @@
         }
         if (strtoupper($val->attribute) == "CHARSET"){
          $charset=$val->value;
+	 $charset_in_mime[$charset] = "YES";
         }
        }
    }
@@ -228,6 +229,7 @@
         }
         if (empty($charset) && strtoupper( $val->attribute ) == "CHARSET"){
          $charset=$val->value;
+	 $charset_in_mime[$charset] = "YES";
         }
        }
    }
@@ -374,18 +376,18 @@
 
         echo TWIGPrintMailHeaderLine( $TWIGphrase[From], $temp );
 
-        echo TWIGPrintMailHeaderLine( $TWIGphrase["To"], FindHTML( HTMLSpecialChars( \
TWIG_decode_mime_string($headers->toaddress) ) ) ); +        echo \
TWIGPrintMailHeaderLine( $TWIGphrase["To"], FindHTML(  \
TWIG_decode_mime_string($headers->toaddress) ) );  
         if($headers->ccaddress){
-            echo TWIGPrintMailHeaderLine( $TWIGphrase["CC"], \
FindHTML(HTMLSpecialChars( TWIG_decode_mime_string($headers->ccaddress) ) ) ); +      \
echo TWIGPrintMailHeaderLine( $TWIGphrase["CC"], \
FindHTML(TWIG_decode_mime_string($headers->ccaddress) ) );  }
 
         if($headers->reply_toaddress && $headers->reply_toaddress != $headers->from) \
                {
-            echo TWIGPrintMailHeaderLine( $TWIGphrase["Reply-To"], \
FindHTML(HTMLSpecialChars( TWIG_decode_mime_string($headers->reply_toaddress) ) ) ); \
+            echo TWIGPrintMailHeaderLine( $TWIGphrase["Reply-To"], \
FindHTML(TWIG_decode_mime_string($headers->reply_toaddress) ) );  }
 
         if($headers->Subject) {
-            echo TWIGPrintMailHeaderLine( $TWIGphrase["Subject"], HTMLSpecialChars( \
TWIG_decode_mime_string($headers->Subject) ) ); +            echo \
TWIGPrintMailHeaderLine( $TWIGphrase["Subject"], \
TWIG_decode_mime_string($headers->Subject) . "\n" );  }
         else {
             echo TWIGPrintMailHeaderLine( $TWIGphrase["Subject"], $TWIGphrase["[no \
subject]"] ); @@ -519,7 +521,11 @@
                   while ($li<count($alllines)) {
                       if ($linewrap) { $thisline = \
textwrap($alllines[$li],$linewrap,"\n"); }  else { $thisline = $alllines[$li]; }  
-                      $thisline = FindHTML(HTMLSpecialChars($thisline));
+                      if (($config["globalcharset"]) && ($info["charset"] != \
$config["globalcharset"])) { +		       $thisline = FindHTML($thisline);
+ 		      } else {
+		       $thisline = FindHTML(HTMLSpecialChars($thisline));
+		      } 
                       echo $thisline . "\n";
                       $li++;
                   }
diff -u -r -P --exclude=CVS --exclude=.* twig2/features/mail/mail.main.inc.php3 \
                twig_multilanguage/features/mail/mail.main.inc.php3
--- twig2/features/mail/mail.main.inc.php3	Sun Jun 11 07:29:38 2000
+++ twig_multilanguage/features/mail/mail.main.inc.php3	Fri Jun 23 11:56:34 2000
@@ -146,11 +146,11 @@
 
    			if( $session["mailbox"] == $config["imap_path"] . $config["imap_sentfolder"] \
&& $headers->toaddress != "" )  {
-     				$ftemp = HTMLSpecialChars( TWIG_decode_mime_string( TWIGGetMailDisplayName( \
$headers->toaddress ) ) ); +     				$ftemp =  TWIG_decode_mime_string( \
TWIGGetMailDisplayName( $headers->toaddress ) );  }
 			elseif( $headers->fromaddress != "" ) 
 				{
-     				$ftemp = HTMLSpecialChars( TWIG_decode_mime_string( TWIGGetMailDisplayName( \
$headers->fromaddress ) ) ); +     				$ftemp = TWIG_decode_mime_string( \
TWIGGetMailDisplayName( $headers->fromaddress ) );  }
    			else 
 				{
@@ -170,7 +170,7 @@
 							"&nbsp;",
 							$ftemp,
 							"&nbsp;",
-							twigLink( HTMLSpecialChars( TWIG_decode_mime_string($headers->Subject) ), \
"mail", "msgview", "path=" . $sorted[$i-1], $nwtemp ), +							twigLink( \
TWIG_decode_mime_string($headers->Subject). "\n" , "mail", "msgview", "path=" . \
$sorted[$i-1], $nwtemp ),  "&nbsp;",
 							array( "contents"=>TWIGBytesToText( $headers->Size ) . "&nbsp;", \
                "align"=>"right" ),
 							array( "contents"=>"<font size=-2><input type=checkbox name=delete[" . \
$sorted[$i-1] . "]" . $marked . "></font>", "valign"=>"middle", "align"=>"center" ) \
@@ -179,17 +179,35 @@  
 		}
 ?>
-
+<form action=<?php echo $config["baseurl"]?> METHOD=POST>
+ <?php echo TWIGSession( "put" );?>
+ <?php echo TWIGContext( "put", "mail", "delete" );?>
+ <input type=hidden name=startmsg value="<?php echo $startmsg?>">
+ 
 <table width=100% border=0 cellspacing=0 cellpadding=0>
  <tr>
   <td align=right>
    <?php echo $tabbuffer?>
   </td>
  </tr>
- <form action=<?php echo $config["baseurl"]?> METHOD=POST>
- <?php echo TWIGSession( "put" );?>
- <?php echo TWIGContext( "put", "mail", "delete" );?>
- <input type=hidden name=startmsg value="<?php echo $startmsg?>">
+ <?php  	     // now if languages where different!
+ 	      if ((( $charset_in_mime ) &&
+ 		   (!($charset_in_mime[$config["globalcharset"]]) &&
+ 		   (count($charset_in_mime) == 1))) ||
+ 		   ($session["displaylanguagebox"]))
+ 			{
+   ?>
+  <tr>
+   <td valign=top bgcolor=<?php echo $config["cellcolor"]?> colspan=2>
+    <?php 
+         $session["displaylanguagebox"] = "yes"; 
+         unset($prefs_language);
+         include("features/shared/languagechange.inc.php3");  
+   ?></td>
+  </tr>
+ <?php
+ 			}
+ ?>
  <tr>
   <td>
    <?php TWIGGenerateTable( $tableheaders, $tablecontents, 12 ); ?>
diff -u -r -P --exclude=CVS --exclude=.* twig2/features/mail/mail.msgview.inc.php3 \
                twig_multilanguage/features/mail/mail.msgview.inc.php3
--- twig2/features/mail/mail.msgview.inc.php3	Tue Jun  6 09:11:51 2000
+++ twig_multilanguage/features/mail/mail.msgview.inc.php3	Fri Jun 23 15:58:01 2000
@@ -59,9 +59,25 @@
 echo "$buffer";
  
 echo "<table width=100% border=0 cellspacing=0>";
-
 $msginfo=TWIGGetMsgInfo( $structure );
 TWIGAttachMailHeaders( $msginfo, FALSE );
+if ((( $charset_in_mime ) && 
+   (!($charset_in_mime[$config["globalcharset"]]) && 
+   (count($charset_in_mime) == 1))) ||
+   ($session["displaylanguagebox"]))
+	{ 
+ ?>
+  <tr>
+   <td valign=top bgcolor=<?php echo $config["cellcolor"]?> colspan=2>
+    <?php 
+        $session["displaylanguagebox"] = "yes"; 
+        unset($prefs_language);
+        include("features/shared/languagechange.inc.php3"); ?>    
+   </td>
+  </tr>   
+ <?php
+}	       
+ 
 TWIGAttachedDLBar( $msginfo );
 TWIGAttachedBody($msginfo);
 TWIGMailSetMessageFlag( $mbox, $path, "\\Seen" );
diff -u -r -P --exclude=CVS --exclude=.* twig2/features/mail/mail.reply.inc.php3 \
                twig_multilanguage/features/mail/mail.reply.inc.php3
--- twig2/features/mail/mail.reply.inc.php3	Fri Mar 31 12:28:04 2000
+++ twig_multilanguage/features/mail/mail.reply.inc.php3	Fri Jun 23 12:03:27 2000
@@ -2,25 +2,25 @@
 <?php
     	$check = TWIGMailBoxCheck( $mbox );
  	$headers = @TWIGMailHeader( $mbox, $path, 0, 0, $config["fromdomain"] );
-	$headers->Subject = massage( TWIG_decode_mime_string( $headers->Subject ) );
+	$headers->Subject = TWIG_decode_mime_string( $headers->Subject ) ;
  	$body = TWIGMailFetchBody( $mbox, $path, 1 );
 
-	$form["to"] = massage( TWIG_decode_mime_string( $headers->reply_toaddress ) );
+	$form["to"] = massage( TWIG_decode_mime_string( $headers->reply_toaddress ) ). \
"\n";  
 	if( $action == "replytoall" ) 
 		{
-		if( $headers->fromaddress != $headers->reply_toaddress ) { $form["to"] .= ", " . \
                massage( TWIG_decode_mime_string( $headers->fromaddress ) ); }
-		if( $headers->toaddress != $headers->reply_toaddress ) { $form["to"] .= ", " . \
                massage( TWIG_decode_mime_string( $headers->toaddress ) ); }
-		$form["cc"] .= massage( TWIG_decode_mime_string( $headers->ccaddress ) );
+		if( $headers->fromaddress != $headers->reply_toaddress ) { $form["to"] .= ", " . \
massage( TWIG_decode_mime_string( $headers->fromaddress ) ) . "\n"; } +		if( \
$headers->toaddress != $headers->reply_toaddress ) { $form["to"] .= ", " . massage( \
TWIG_decode_mime_string( $headers->toaddress ) ) . "\n"; } +		$form["cc"] .= massage( \
TWIG_decode_mime_string( $headers->ccaddress ) ) . "\n";  }
 
 	if( !eregi( "^Re:", $headers->Subject ) ) 
 		{
-    		$form["subject"] = "Re: " . $headers->Subject; 
+    		$form["subject"] = "Re: " . $headers->Subject . "\n"; ; 
 		}
 	else 
 		{
-		$form["subject"] = $headers->Subject;
+		$form["subject"] = $headers->Subject . "\n";
 		}
 
    	$form["body"] = TWIG_decode_mime_string( $headers->fromaddress ) . " " . \
                $TWIGphrase["said:"] . "\r\n\r\n";
diff -u -r -P --exclude=CVS --exclude=.* twig2/features/mail/mail.submit.inc.php3 \
                twig_multilanguage/features/mail/mail.submit.inc.php3
--- twig2/features/mail/mail.submit.inc.php3	Sun Jun 11 02:27:10 2000
+++ twig_multilanguage/features/mail/mail.submit.inc.php3	Fri Jun 23 12:06:44 2000
@@ -82,6 +82,43 @@
   	$form["bcc"] =  str_replace( "\n", "", $form["bcc"] );
   	$form["subject"] = TWIGProcessGPCString( $form["subject"] );
   	$form["subject"] =  str_replace( "\n", "", $form["subject"] );
+	 if ($config["globalcharset"]) {
+	   // has it got any strange characters in it!!!
+	 // this is not a great check, but it will do!!!
+	 if (eregi("[^a-z0-9 :-]", $form["subject"])) {
+	    $temp_words = explode(" ", $form["subject"]);
+	    $formsubjectresult = ""; 
+	    for ($i = 0;$i < count($temp_words); $i++) {
+	      if (eregi("[^a-z0-9 :-]", $temp_words[$i])) {
+		  if (strlen($temp_words[$i]) > 40) {
+		      // trim it so I am doing double bytes!!!
+		      $temp_words[$i] =  trim($temp_words[$i]);
+		      // then break the line up!!
+		      for ($j =0; $j <  strlen($temp_words[$i]); $j=$j+39) {
+			if ($formsubjectresult != "") { $formsubjectresult .= "\n   "; }
+			$formsubjectresult .=  "=?" . $config["globalcharset"] . "?b?" .
+			  base64_encode(substr($temp_words[$i], $j, 40)). "?=";  
+		      }
+		} else {
+		if ($formsubjectresult != "") { $formsubjectresult .= "\n   "; }
+		   $formsubjectresult .=  "=?" . $config["globalcharset"] . "?b?" .
+			  base64_encode($temp_words[$i]). "?=";
+		}
+	      } else {
+		$formsubjectresult .= " " . $temp_words[$i];
+	      }
+	      }
+	    $form["subject"] =  $formsubjectresult;
+  
+	  }
+	$sendcharset = $config["globalcharset"];
+	$sendbits = 8;
+       } else {
+	$sendcharset = "iso-8859-1";
+	$sendbits = 7;
+       }
+  
+
   	$form["replyto"] = stripslashes( GetPref( "replyto", $dbconfig["prefs_table"], \
$config["defaults"]["mail"]["replyto"] ) );  $form["replyto"] =  str_replace( "\n", \
"", $form["replyto"] );  $form["body"] = TWIGProcessGPCString( $form["body"] );
@@ -132,9 +169,9 @@
  
  		$bodytext  = "This is a multi-part message in MIME format.\r\n\r\n";
    		$bodytext .= "--$boundary\r\n";
- 		$bodytext .= "Content-Type: text/plain; charset=us-ascii\r\n";
- 		$bodytext .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
-    		$bodytext .= $form["body"] . "\r\n\r\n";
+      	 	$bodytext .= "Content-Type: text/plain; charset=$sendcharset\r\n";
+    		$bodytext .= "Content-Transfer-Encoding: $sendbits" . "bit\r\n\r\n";
+ 	      	$bodytext .= $form["body"] . "\r\n\r\n";
  
  		for( $i = 1; $i < $numfiles + 1; $i++ )
  			{
@@ -164,6 +201,10 @@
  		}
   	else 
 		{
+	      	$mailheaders .= "MIME-Version: 1.0\r\n";
+	        $mailheaders .= "Content-Type: text/plain; charset=$sendcharset\r\n";
+	        $bodytext .= "Content-Transfer-Encoding: $sendbits" . "bit\r\n\r\n";
+
    		$bodytext = $form["body"];
   		}
 
diff -u -r -P --exclude=CVS --exclude=.* twig2/features/main/main.feature.php3 \
                twig_multilanguage/features/main/main.feature.php3
--- twig2/features/main/main.feature.php3	Mon May 22 04:06:57 2000
+++ twig_multilanguage/features/main/main.feature.php3	Fri Jun 23 12:09:58 2000
@@ -52,8 +52,8 @@
 				if( !$headers->Subject ) { $headers->Subject = $TWIGphrase["[no subject]"]; }
 
 				$tablecontents[$i] = array( 	TWIGdate( $config["shortdateformat"] . " " . \
                TWIGGetTimeFormat(), $headers->udate ),
-								HTMLSpecialChars(TWIG_decode_mime_string(ereg_replace("<.*>","",$headers->fromaddress))),
                
-                                                                twigLink( \
HTMLSpecialChars( TWIG_decode_mime_string($headers->Subject) ), "mail", "msgview", \
"path=" . $ii ) +								 \
TWIG_decode_mime_string(ereg_replace("<.*>","",$headers->fromaddress)), +             \
twigLink(   TWIG_decode_mime_string($headers->Subject) , "mail", "msgview", "path=" . \
$ii )  );
 				$i++;
         			} 
@@ -62,7 +62,23 @@
 	$tableheaders = array( $TWIGphrase["date"], $TWIGphrase["from"], \
$TWIGphrase["subject"] );  if ($i>0)	// Only display this block if there are any \
messages  {
-?>
+ 		 // now if languages where different!
+ 		  if ((( $charset_in_mime ) &&
+ 		    (!($charset_in_mime[$config["globalcharset"]]) &&
+ 		    (count($charset_in_mime) == 1))) ||
+ 		    ($session["displaylanguagebox"]))
+ 			 {
+  ?>
+   <tr>
+    <td valign=top bgcolor=<?php echo $config["cellcolor"]?> colspan=2>
+     <?php $session["displaylanguagebox"] = "yes"; unset($prefs_language);
+  include("features/shared/languagechange.inc.php3"); ?>
+    </td>
+   </tr>
+  <?php
+ 			 }
+ 
+  ?>
  <tr>
   <td valign=top bgcolor="<?php echo $config["cellheadcolor"]?>" colspan=2>
    <font face="<?php echo $config["cellfont"]?>">
@@ -74,10 +90,9 @@
   <td valign=top bgcolor=<?php echo $config["cellcolor"]?> colspan=2>
     <?php echo TWIGGenerateTable( $tableheaders, $tablecontents );?>
   </td>
- </tr>
-<?php
-		}
-	}
+ </tr><?php
+  		}
+ 	}
 ?>
 
 <?php if( TWIGCheckACL( $login["username"], 2004, TWIGConvertAccess( "read" ) ) && \
TWIGCheckACL( $login["username"], 3002, TWIGConvertAccess( "read" ) ) && !GetPref( \
"schedule", $dbconfig["main_prefs_table"], $config["defaults"]["main"]["schedule"] ) \
                ):?>
diff -u -r -P --exclude=CVS --exclude=.* twig2/features/news/~news.main.inc.php3 \
                twig_multilanguage/features/news/~news.main.inc.php3
--- twig2/features/news/~news.main.inc.php3	Thu Jan  1 08:00:00 1970
+++ twig_multilanguage/features/news/~news.main.inc.php3	Fri Oct 22 07:22:03 1999
@@ -0,0 +1,72 @@
+<?php	// TWIG		News Server Feature Module ?>
+
+<?php 
+  $temp = GetPref( "pagesize", $dbconfig["news_prefs_table"], "owner" );
+  if( $temp > 0 ) { $config[news_articles] = $temp; }
+  $news_newwindow = GetPref( "newwindow", $dbconfig["news_prefs_table"], "owner" );
+?>
+
+<table border=0 width=100%>
+ <tr>
+   <form action=<?php echo $config["baseurl"]?> METHOD=POST>
+   <td valign=centre>
+    <?php echo $TWIGphrase["News Groups"] ?>: <?php echo TWIGBuildNewsSelect(); ?>
+   <input type=submit value="<?php echo $TWIGphrase["Go"];?>">
+   <?php echo TWIGSession( "put" )?>
+   <?php echo TWIGContext( "put" )?>
+  </td>
+  </form>
+  <td align=right valign=top>
+<?php
+      $i = 0;
+
+      if( TWIGCheckACL( $login["username"], 5002, TWIGConvertAccess( "read" ) ) ) { \
$newsmenu[$i] = array( "command" => "news", "desc" => $TWIGphrase["New&nbsp;post"], \
"action" => "post", "options" => "", "target" => "", "image" => "" ); $i++; } +      \
if( TWIGCheckACL( $login["username"], 5001, TWIGConvertAccess( "read" ) ) ) { \
$newsmenu[$i] = array( "command" => "news", "desc" => $TWIGphrase["Prefs"], "action" \
=> "prefs", "options" => "", "target" => "", "image" => "" ); $i++; } +      if( \
TWIGCheckACL( $login["username"], 5000, TWIGConvertAccess( "read" ) ) ) { \
$newsmenu[$i] = array( "command" => "news", "desc" => $TWIGphrase["News group \
management"], "action" => "folders", "options" => "", "target" => "", "image" => "" \
); $i++; } +
+      echo TWIGGenerateMenu( $newsmenu, $config["SubMenuType"] );
+?>
+  </td>
+ </tr>
+</table>
+<hr>
+
+<?php
+  $tableheaders = array( 	"<b>" . $TWIGphrase["Date"] . "</b>",
+				"<b>" . $TWIGphrase["From"] . "</b>",
+				"<b>" . $TWIGphrase["Subject"] . "</b>" );
+
+  if( $newmailbox ) { $session["mailbox"] = MailboxEncode( $newmailbox ); }
+
+  if( CheckMBType( MailboxDecode( $session["mailbox"] ) ) == 1 ) 
+	{
+    	$sinfo = TWIGSplitName( MailboxDecode( $session["mailbox"] ) );
+    	$subscribed = dbQuery( "SELECT username,password FROM " . \
$dbconfig["folders_table"] . " WHERE server = '$sinfo[server]' AND servertype = \
'/nntp' AND port = '$sinfo[port]' AND groupname = '$sinfo[groupname]' ORDER BY owner \
DESC" ); +    	$ThisRow = dbResultArray( $subscribed, 0 );
+$subscribed = dbQuery( "SELECT * FROM " . $dbconfig["folders_table"] . " WHERE owner \
= '" . $config[loginname] . "';" ); +    	
+	if( $news_newwindow ) { $str = "_blank"; } else { $str = ""; }
+
+	$headers = TWIGGetNewsList( $sinfo["server"], $sinfo["port"], $ThisRow[0], \
$ThisRow[1], $sinfo["groupname"], $startmsg, $config["news_articles"] ); +	$headers = \
TWIGGetNewsList( $ThisRow[server], $ThisRow[port], $ThisRow[username], $ThisRow[p], \
$sinfo["groupname"], $startmsg, $config["news_articles"] ); +
+	TWIGDebug( "Message Count: " . $headers["MessageCount"] );
+	for( $i = 0, $j = $headers["MessageCount"]; $i < $j; $i++ )
+		{
+		$tablecontents[$i] = array( 	$headers[$i]["Date"],
+						$headers[$i]["From"],
+						twigLink( $headers[$i]["Subject"], "news", "view", "path=" . \
$headers[$i]["SequenceID"], $str ) ); +		TWIGDebug( "ArticleID: " . \
$headers[$i]["ArticleID"] ); +		TWIGDebug( "header: " . serialize( $headers[$i] ) );
+    		}
+
+  	$acount = $headers["LastInGroup"] - $headers["FirstInGroup"];
+	}
+
+  if( $startmsg == 0 ) { $startmsg = 1; }
+
+  echo "<div align=right>" . TWIGPrevNext( $startmsg, $acount, \
$config["news_articles"], $context, $config["PrevNextType"] ); +  echo "<table \
border=0 cellspacing=0 width=100%><tr><td>"; +  echo TWIGGenerateTable( \
$tableheaders, $tablecontents ); +  echo "</td></tr></table>";
+?>
diff -u -r -P --exclude=CVS --exclude=.* \
twig2/features/shared/languagechange.inc.php3 \
                twig_multilanguage/features/shared/languagechange.inc.php3
--- twig2/features/shared/languagechange.inc.php3	Thu Jan  1 08:00:00 1970
+++ twig_multilanguage/features/shared/languagechange.inc.php3	Fri Jun 23 12:11:05 \
2000 @@ -0,0 +1,36 @@
+<? //shared languagechange.inc.php3
+    //for changing the viewing language depending on if an unusual mail
+    //was recieved line for changing language
+    
+    
+    // based on the global preferences file!!!
+    // post to the same page
+ 
+ if  (!$prefs_language) {
+ ?>   
+ <form action=<?php echo $config["baseurl"]?> method=POST>
+ <?php
+ echo TWIGSession( "put" );
+ echo TWIGContext( "put" );
+  
+  $languages  = array (        "chinesebig5", "chinesegb", "czech", "danish", 
+		       "english", "estonian", "finnish", "french", 
+		       "german", "italian", "japanese", "portuguese", "russian", 
+		       "russianwin", "spanish", "swedish" );
+ 
+ $temp = "Change language to match message : <select name=prefs_language>\n";
+ while(list($index, $lang) = each($languages) ) 
+       {
+       if( GetPref( "language", $dbconfig["global_prefs_table"], \
$config["defaults"]["global"]["language"] ) == $lang ) { $selected = "SELECTED"; } \
else { $selected = ""; } +	       
+       $temp .= "<option $selected value=$lang>" . $TWIGphrase[$lang]. \
"</option>\n"; +       }
+ 
+ print "$temp</select>
+ <input type=submit name=update value=\"" . $TWIGphrase["Update Preferences"] . "\">
+ ";
+ 
+ } else {
+       PutPref( "language", TWIGProcessGPCtoSQL( $prefs_language ), \
$dbconfig["global_prefs_table"] ); + }
+?>
diff -u -r -P --exclude=CVS --exclude=.* twig2/index.php3 \
                twig_multilanguage/index.php3
--- twig2/index.php3	Fri Jun 23 12:18:08 2000
+++ twig_multilanguage/index.php3	Fri Jun 23 13:30:57 2000
@@ -71,6 +71,11 @@
  if( $vhosts[$SERVER_NAME] ) { include( $config_dir . "/defaults.inc.php3" ); }
  require( "features/shared/prefs.inc.php3" );
 
+ // check to see if language has changed!  
+ if ($prefs_language) {
+    include("features/shared/languagechange.inc.php3");
+ }
+ 
  // language code - turn into function to load feature/language.string.php3
  $config["language"] = GetPref( "language", $dbconfig["global_prefs_table"], \
$config["defaults"]["global"]["language"] );  
@@ -88,10 +93,12 @@
  $config["MenuType"] = GetPref( "mstyle1", $dbconfig["global_prefs_table"], \
$config["defaults"]["global"]["mstyle1"] );  $config["SubMenuType"] = GetPref( \
"mstyle2", $dbconfig["global_prefs_table"], $config["defaults"]["global"]["mstyle2"] \
);  $config["PrevNextType"] = GetPref( "prevnext", $dbconfig["global_prefs_table"], \
                $config["defaults"]["global"]["prevnext"] );
-?>
 
-<html><?php if( $config["metaheaders"] ) { echo $config["metaheaders"]; }
+ if( $config["globalcharset"] && !$attachment) {
+   header("Content-Type: text/html;charset=" . $config["globalcharset"]); 
+ }  
 ?>
+<html>
 <head>
 <title><?php echo $pagetitle;?></title>
 </head>
diff -u -r -P --exclude=CVS --exclude=.* twig2/lib/strings/chinesebig5.strings.php3 \
                twig_multilanguage/lib/strings/chinesebig5.strings.php3
--- twig2/lib/strings/chinesebig5.strings.php3	Wed Jun 14 20:37:51 2000
+++ twig_multilanguage/lib/strings/chinesebig5.strings.php3	Fri Jun 23 11:29:55 2000
@@ -10,7 +10,7 @@
   //--------------------------------------------------------
   // global stuff
   $config["charactersets"] = array();
-  $config["globalcharset"] = "";
+  $config["globalcharset"] = "big5";
   $config["metaheaders"] = "<META HTTP-EQUIV=\"Content-Type\" \
CONTENT=\"text/html;charset=big5\">";  
   $TWIGphrase["Preferences"]   		= "設定"; 
diff -u -r -P --exclude=CVS --exclude=.* twig2/lib/strings/chinesegb.strings.php3 \
                twig_multilanguage/lib/strings/chinesegb.strings.php3
--- twig2/lib/strings/chinesegb.strings.php3	Wed Jun 14 20:37:51 2000
+++ twig_multilanguage/lib/strings/chinesegb.strings.php3	Fri Jun 23 11:30:18 2000
@@ -10,7 +10,7 @@
   //--------------------------------------------------------
   // global stuff
   $config["charactersets"] = array();
-  $config["globalcharset"] = "";
+  $config["globalcharset"] = "gb";
   $config["metaheaders"] = "<META HTTP-EQUIV=\"Content-Type\" \
CONTENT=\"text/html;charset=gb\">";  
   $TWIGphrase["Preferences"]   		= "扢隅"; 
diff -u -r -P --exclude=CVS --exclude=.* \
twig2/lib/strings/tempchinesebig5.strings.php3 \
                twig_multilanguage/lib/strings/tempchinesebig5.strings.php3
--- twig2/lib/strings/tempchinesebig5.strings.php3	Thu Jan  1 08:00:00 1970
+++ twig_multilanguage/lib/strings/tempchinesebig5.strings.php3	Thu Aug 19 19:30:05 \
1999 @@ -0,0 +1,173 @@
+<?php
+  // this is a sample file, for the chinese version.
+  // this file should contain the translations for twig into other languages.
+  // if a translation of an element does not exist here, the default english will be \
used +  // the translation may include <img src=\"" . $config[imgdir] . "/todo.gif" \
alt=\"Todo"> +  // or just a simple text translation.
+  // this is just for the 'main' twig features, all additional ones, should use a \
file  +  // language.string.php3 in the feature directory.
+  // stuff for the standard menu.
+
+  // note all the left string ($textstr["lowercase"]) should be lower case, 
+  
+  $config[metaheaders] = "<META HTTP-EQUIV=\"Content-Type\" \
CONTENT=\"text/html;charset=big5\">"; +
+// main menu items
+  $textstr["main"] = "主頁";
+  $textstr["mail"] = "郵件";
+  $textstr["news"] = "新聞";
+  $textstr["contacts"] = "聯絡人";
+  $textstr["contact"] = "聯絡人";
+  $textstr["schedule"] = "議事日程";
+  $textstr["todo"] = "工作序";
+  $textstr["bookmarks"] = "書簽";
+  $textstr["logout"] = "登出";
+ 
+// stuff from main page
+  $textstr["groups"] = "組別"; 
+  $textstr["group"] = "組別";  
+  $textstr["prefs"] = "設定"; 
+  $textstr["recent mail"] = "郵件";
+  $textstr["announcements"] = "公布";
+  $textstr["options"] = "選項";
+
+  //calendar
+  
+  $textstr["go&nbsp;to&nbsp;today"] = "今天議程";
+  $textstr["monthly&nbsp;view"] = "查看本月議程";
+  $textstr["add&nbsp;item"] = "加項目";   //strange querk in code
+  $textstr["daily&nbsp;view"] = "每日議程";
+  $textstr["schedule"] = "議事日程"; 
+  $textstr["today"] = "今天";
+  $textstr["tomorrow"] = "明天";
+  $textstr["time"] = "時間";
+ 
+ //time 
+  $textstr["am"] = "早上";
+  $textstr["pm"] = "下午";
+  $textstr["time"] = "時間";
+  $textstr["today is"] = "今天是";
+  $textstr["monday"] = "星期一";
+  $textstr["tuesday"] = "星期二";
+  $textstr["wednesday"] = "星期三";
+  $textstr["thursday"] = "星期四";
+  $textstr["friday"] = "星期五";
+  $textstr["saturday"] = "星期六";
+  $textstr["sunday"] = "星期日";
+ 
+  $textstr["jan"] = "一月";
+  $textstr["january"] = "一月";
+  $textstr["feb"] = "二月";
+  $textstr["february"] = "二月";
+  $textstr["mar"] = "三月";
+  $textstr["march"] = "三月";
+  $textstr["apr"] = "四月";
+  $textstr["april"] = "四月";
+  $textstr["may"] = "五月";
+  $textstr["jun"] = "六月";
+  $textstr["june"] = "六月";
+  $textstr["jul"] = "七月";
+  $textstr["july"] = "七月";
+  $textstr["aug"] = "八月";
+  $textstr["august"] = "八月";
+  $textstr["sep"] = "九月";    
+  $textstr["september"] = "九月";    
+  $textstr["oct"] = "十月";
+  $textstr["october"] = "十月";
+  $textstr["nov"] = "十一月";
+  $textstr["november"] = "十一月";
+  $textstr["dec"] = "十二月";
+  $textstr["december"] = "十二月";
+
+  // login or on..
+  $textstr["username"] =  "用戶名";
+  $textstr["password"] = "密碼輸入";
+  
+ // contacts
+  $textstr["back&nbsp;to&nbsp;contacts"] =  "返回聯絡人";
+  $textstr["nickname"] =  "綽號"; 
+  $textstr["name"] =  "姓名"; 
+  $textstr["company"] =  "公司";
+  $textstr["e-mail"] =  "電子郵件";
+  $textstr["email"] = "電子郵件";
+  $textstr["url"] = "綱址";
+  $textstr["first name"] = "姓氏";
+  $textstr["last name"] = "名字";
+  $textstr["Company"] = "公司";
+  $textstr["home phone"] = "住宅電話";
+  $textstr["work phone"] = "商務電話";
+  $textstr["fax"] = "住宅電話";
+  $textstr["mobile / pager"] = "商務電話";
+  $textstr["address"] = "地址";
+  $textstr["city"] = "城市";
+  $textstr["state / zip code"] = "州/郵政編碼";
+  $textstr["country"] = "國家";
+  $textstr["description"] = "說明";
+
+   
+ // folder management
+   $textstr["folder management"]   = "郵件夾管理";
+   $textstr["back&nbsp;to&nbsp;inbox"]   = "返回收件箱";
+   $textstr["inbox"] = "收件箱";
+ 
+  $textstr["unsubscribed"]  = "取消訂閱\";
+  $textstr["subscribed"] = "訂閱\";
+ 
+  //groups  
+  $textstr["group description/notes"] = "組  別  說明/註釋";
+  $textstr["back to groups"] = "返回組別";
+  $textstr["add&nbsp;group"] = "加入組別";
+  $textstr["member of"] = "所屬組別";
+  $textstr["owner of"] = "所屬個別";
+  $textstr["unfiled"] = "未分類";
+  $textstr["all"] =  "全體";
+   
+  //Go to 
+  $textstr["go to"] = "登入綱頁";
+  
+  //bookmarks
+  $textstr["bookmark"] = "書簽"; 
+  $textstr["item"] = "項目";
+  $textstr["url"] = "綱址"; 
+  
+  // todo
+  $textstr["priority"] = "優先權";
+  $textstr["status"] = "狀態";
+  
+  // mail and compose  
+  $textstr["new mail message"] = "新郵件";
+  $textstr["new&nbsp;message"] = "新郵件";
+  $textstr["new message"] = "新郵件";
+  $textstr["to"] = "收件人";
+  $textstr["cc"] = "副本";
+  $textstr["bcc"] = "密件副本";
+  $textstr["subject"] = "主題";
+  $textstr["attachment"] = "附件";
+  $textstr["folders"] = "文件夾";
+  $textstr["delete selected"] = "刪除選項";
+  $textstr["date"] = "日期";
+  $textstr["empty&nbsp;trash"] = "清理刪除郵件";
+  $textstr["from"] = "寄件者";               //  (the mail sender)
+  $textstr["move selected"] = "換置選項";
+  $textstr["refresh"] = "更新";
+  $textstr["select none"] = "取消選擇";
+  $textstr["select all"] = "全部選擇";
+  $textstr["sent-mail"] = "已寄郵件";
+
+
+  //newsgroup
+ // $textstr["from (news group)"] = "發件者";
+  $textstr["newsgroup"] = "新聞組";
+  $textstr["news groups"] = "新聞組";
+  $textstr["new post"] = "新公布";
+  $textstr["news group management"] = "新聞組管理";
+  $textstr["next >>"] = "下一個 &gt;&gt;";
+  $textstr["<< prev"] = "&lt;&lt; 上一個";
+ 
+
+
+  // other words that I can not remember where they were from.
+  $textstr["go"] = "到";
+  $textstr["status"] = "階段";
+
+ ?>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic