GMail本身是以UTF-8的形式存储数据的,因此可以非常方便地让G-Share 1.5beta3也支持UTF-8,下面就介绍下如何通过简单修改index.php达到目的。
打开index.php:
1.找到
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
替换为
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
2.找到utf8_decode函数,去除之。

懒得改?那copy下面的代码覆盖你的index.php好了。
你也可以到http://www.steedsoft.com/download/ 去下载(这个下载系统就是G-Share 1.5beta3做得)。
之前对G-Share 1.5beta3的介绍。
G-Share 1.5beta3:一个php脚本的程序,可以把你gmail做为文档共享系统(下载系统)

<?php
//Change Log:
//2006-03-15:modified to support UTF-8;


session_start();
require_once("config.php");

//set variables for every action
$th = (isset($_REQUEST["th"]))? $_REQUEST["th": 0;
$mg = (isset($_REQUEST["mg"]))? $_REQUEST["mg": 0;
$label = (isset($_REQUEST["label"]))? $_REQUEST["label": 0;
$sum = (isset($_REQUEST["sum"]))? $_REQUEST["sum": 0;
$pos = (isset($_REQUEST["pos"]))? $_REQUEST["pos": 0;
$query = stripslashes((isset($_REQUEST["query"]))? $_REQUEST["query": 0);
$std = (isset($_REQUEST["std"]))? $_REQUEST["std": 0;
$unread = (isset($_REQUEST["unread"]))? $_REQUEST["unread": 0;
$pos = (isset($_REQUEST["pos"]))? $_REQUEST["pos": 0;
$id = (isset($_REQUEST["id"]))? $_REQUEST["id": 0;

//check if an account is specified
if ($id){
  
//set the right query for the requested action
   if ($sum) {
      
$q = "search=cat&cat=dummyjusttoretrievesummary&view=tl&start=0&init=1";
   }
   
else {
         
if ($th) {
            
if ($mg)
               
$q = "search=inbox&view=cv&th=".$th."&msgs=".$mg;
            
else
               
$q = "search=inbox&view=cv&th=".$th;
         } 
elseif ($query) {
               
$q = "search=query&q=".urlencode($query)."&view=tl&start=".$pos;
            } 
elseif ($label) {
              
if (!is_public($label))
                {
                  
die('Are you trying to hack something? Find another way, you know that there is a hole, don´t you?');
                }
               
$q = "search=cat&cat=".$label."&view=tl&start=".$pos;
            } 
else {
                    
$q = "search=cat&cat=dummyjusttoretrievesummary&view=tl&start=0&init=1";
                    
$sum = 1;
               }
   }

//Get gmail account info for the requested ID
$act = getGmailAccount($id);
///create a gmailer instance for the account
$gm = init_gmailer($act);
//execute query to gmail and get the snapshot
$gm->fetch($q);
$snapshot = $gm->getSnapshot(GM_STANDARD|GM_LABEL|GM_QUERY|GM_CONVERSATION);

if (!isset($snapshot->label_list)) //check if we have a managed to get the snapshot, else die hard
    fatal_error('Storage server offline at this moment, try again later');

//set the page title tag to the selected account title
$site_name = $act['title'];

}
else $sum = 2;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" />
<title><?=$site_name?></title>
</head>
<body>
<?php
include('header.php'); //start output of body HTML with the header

if ($sum == 0){ //if we are not displaying the categories list then show navigation bar
?>
   
<table class="border" width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
   
<TR>
   
<TD width="14%" height="31" valign="middle"><a href="javascript:history.back()">&nbsp;<img alt="back" src="images/back.gif" border="0" /></a></TD>
   
<TD width="86%" valign="middle">
   
<form action="index.php" method="post">
        
<div align="right">
        
<select name="label">
             
<?php
      
//print combobox with label names available
      for ($i = 0$i < count($snapshot->label_list); $i++) {
          
if (is_public($snapshot->label_list[$i])) {
              
?>
             
<option value="<?=$snapshot->label_list[$i]?>">
             
<?=substr($snapshot->label_list[$i],2)?>
             
</option>
             
<?php
      }
   }
   
?>
          
</select>
          
<input name="submit" type="submit" value="GO" />
          
<input name="id" type="hidden" value="<?=$act['id']?>" />
          
&nbsp;

        
</div>
   
</form></TD>
   
</TR>
</table>
   
<table class="border" width="80%" border="0" align="center" cellpadding="8" cellspacing="0">
   
<tr>
   
<td>
   
<table class="border" width="100%" cellpadding="4" cellspacing="0" border="0">
<?php
   
if (!$th) {//show the topics list for selected label
      ?>
          
<tr><td><b><i> Topics </i></b></td></tr>
          
<?php

      
// mailbox view
      if ($query){
         
?>
                 
<tr><td colspan='3'>Search : <b style="color:brown"><?=htmlentities($query)?></b></td></tr>
                 
<?php }
                 
?>
         
<tr>
        
<?php
      
if ($pos >= 10) {
         
$p = $pos-10;
         
?>
                 
<td align="left" width="50"><a href="index.php?id=<?=$act['id']?>&amp;query=<?=urlencode($query)?>&amp;std=<?=$std?>&amp;label=<?=$label?>&amp;unread=<?=$unread?>&amp;pos=<?=$p?>">&nbsp;<img alt="previous" src="images/previous.gif" border="0" /></a></td>
                 
<?php
      } 
else {
          
?>
         
<td>&nbsp;</td>
        
<?php
      }
      
?>
          
<td>&nbsp;</td>
          
<?php
      
if ($pos < $snapshot->box_total-10) {
         
$p = $pos+10;
         
?>
                 
<td align="right"><a href="index.php?id=<?=$act['id']?>&amp;query=<?=urlencode($query)?>&amp;std=<?=$std?>&amp;label=<?=$label?>&amp;unread=<?=$unread?>&amp;pos=<?=$p?>"><img alt="next" src="images/next.gif" border="0" />&nbsp;</a></td>
                 
<?php
      } 
else {
         
?>
                 
<td>&nbsp;</td>
                 
<?php
      }
      
?>
     
</tr>
          
<?php
      
for ($i = 0$i < count($snapshot->box) && $i<10$i++) {
             
$ok = 0;
             
if ($snapshot->box[$i]["labels"]) {
                 
foreach ($snapshot->box[$i]["labels"as $chklabel) {
                    
if (is_public($chklabel)) {
                            
$ok = 1;
                            
break;
                    }
                 }
         }
             
if ($ok ==1) {
                 
if ($i % 2 == 0 || $query){
                    
?><tr bgcolor="white"><?php }
                 
else?><tr bgcolor="#EAEAEA"><?php }
                 
if ($show_sender){
                         
if ($snapshot->box[$i]["sender"== "me") { ?><td class="bottomup">Admin</td><?php }
                         
elseif (substr($snapshot->box[$i]["sender"],0,4== "me, ") {?><td class="bottomup">Admin</td><?php }
                         
elseif (substr($snapshot->box[$i]["sender"],0,7== "<b>me, ") {?><td class="bottomup"><b>Admin</b></td><?php }
                         
elseif ($snapshot->box[$i]["sender"== "<b>me</b>") {?><td class="bottomup"><b>Admin</b></td><?php }
                         
else ?> <td class="bottomup" ><?$snapshot->box[$i]["sender"]?></td> <?php
                      } 
else {
                              
?> <td class="bottomup" width="50" align="center">-</td><?php
                      }

                 
?><td class="bottomup" valign="middle" height="25"><a href="index.php?id=<?=$act['id']?>&amp;th=<?=$snapshot->box[$i]["id"]?>"><?php
                 
if ($snapshot->box[$i]["is_starred"== 1){
                    
?> <img alt="starred" src="images/star.gif" border="0" />  <?php } ?>  <?$snapshot->box[$i]["subj"]?></a>
                                        
<?php
                 
for ($jj = 0$jj < count($snapshot->box[$i]["attachment"]); $jj++) {
                   
?> + <?php
                 }
                 
?></td><?php
                 
?><td class="bottomup" align="center"><?=$snapshot->box[$i]["date"]?></td></tr><?php
                 
if ($query){
                    
?> <tr><td colspan="3"><?$snapshot->box[$i]["snippet"]?></td></tr> <?php }
         }

      }
      
?> <tr> <?php
      
if ($pos >= 10) {
         
$p = $pos-10;
         
?> <td valign="bottom" align="left" width="50"><a href="index.php?id=<?=$act['id']?>&amp;query=<?=urlencode($query)?>&amp;std=<?=$std?>&amp;label=<?=$label?>&amp;unread=<?=$unread?>&amp;pos=<?=$p?>">&nbsp;<img alt="previous" src="images/previous.gif" border="0" /></a></td><?php
      } 
else {
         
?><td>&nbsp;</td><?php
      }
      
?><td>&nbsp;</td><?php
      
if ($pos < $snapshot->box_total-10) {
         
$p = $pos+10;
         
?><td align="right"><a href="index.php?id=<?=$act['id']?>&amp;query=<?=urlencode($query)?>&amp;std=<?=$std?>&amp;label=<?=$label?>&amp;unread=<?=$unread?>&amp;pos=<?=$p?>"><img alt="next" src="images/next.gif" border="0" />&nbsp;</a></td><?php
      } 
else {
         
?><td>&nbsp;</td><?php
      }
      
?></tr><?php

   } 
//end of displaying contents of a label
 else { //show a single message

      
?><tr bgcolor="#ffde91"><td height="21"><?php
      
if ($snapshot->conv_starred){
         
?><img alt="starred" src="images/star.gif" border="0" />  <?php }
      
?><b><?$snapshot->conv_title?></b></td></tr></table><?php
      
foreach ($snapshot->conv as $mg) {
         
if ($show_sender) {
                 
?><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr bgcolor="#EAEAEA"><td align="left"><?=$mg["dt_easy"]?></td><td align="right"><?=$mg["sender"]?></td></tr><?php
         } 
else {
                   
?> <table width="100%" cellpadding="0" cellspacing="0" border="0"><tr bgcolor="#EAEAEA"><?php
                                   
if (strlen($mg["body"]) == 0){
                                   
?><td align="right">&nbsp;</td><?php }
                                   
else
                                   {
?><td align="right"><em><?=$mg["dt_easy"]?></em></td><?php } ?>
                                   
</tr><?php
              }
         
if (strlen($mg["body"]) == 0) {
            
?><tr><td align="right"><a href="index.php?id=<?=$act['id']?>&th=<?=$snapshot->conv_id?>&mg=<?=$mg["id"]?>"><?=$mg["subj"]?></a><?php
            
$natt = count($mg["attachment"]);
            
if ($natt > 0) {
               
?> - <em><?=$mg["dt_easy"]?></em> - [Contains <b><?=$natt?></b> files]</td></tr><?php
            } 
else {
               
?> ]</td></tr> <?php
            }
         } 
else {
            
?> <tr bgcolor="#EAEAEA"><td class="border" align="left" colspan="0"> <?php
            
$att_html = "";
            
for ($i = 0$i < count($mg["attachment"]); $i++) {
                             
// Get the download count from MySQL database
              $att_down_count = getAttCount($mg["attachment"][$i]["id"],$mg["id"]);

                        
//build the download link that calls dl.php
              $att_html .= "&nbsp;<img alt=\"clip\" src=\"images/clip.gif\" border=\"0\" />&nbsp;<a href=\"dl.php?id=".$act['id']."&amp;a=".$mg["attachment"][$i]["id"]."&amp;m=".$mg["id"]."&amp;f=".urlencode($mg["attachment"][$i]["filename"])."\"><b style=\"font-size:12px\">".$mg["attachment"][$i]["filename"]."</b></a>";
              
$att_html .= " (".human_size(($mg["attachment"][$i]["size"])).") - downloaded <b>".$att_down_count."</b> times.)<br /> ";
                        }
                        
//build the mail body text stripping html tags
            $body_tmp = strip_tags($mg["body"],"<br>");
                        
echo $body_tmp."<br /></td>";
                        
?><tr bgcolor="#CCCCCC"><td height="25" class="border2" valign="middle"><?php
            
if (count($mg["attachment"])>0){ ?><?=substr($att_html,0,-1)?><?php }
            
?></td></tr><?php
         }
      }
   }
?>
   
</table>
      
</td></tr>
</table>
<?php
   }
elseif ($sum == 1) { //show the public categories list without Z. of course
?>
          
<table class="border" width="30%" border="0" align="center" cellpadding="0" cellspacing="0">
             
<tr>
               
<td height="21" bgcolor="#CCCCCC"><div align="center" class="style6"><strong>Categories of <?=$act['title']?></strong></div></td>
             
</tr>
             
<?php
   
for ($i = 0; ($i < count($snapshot->label_list)); $i++) {
      
if ($i < count($snapshot->label_list)) {
            
if (is_public($snapshot->label_list[$i],0,2)) {
             
?>
                     
<tr bgcolor="white" align="center">
               
<td height="21" class="list" onmouseover="this.style.backgroundColor='#999966';" onmouseout="this.style.backgroundColor='#FFFFFF';" onclick="window.location='index.php?id=<?=$act['id']?>&amp;label=<?=urlencode($snapshot->label_list[$i])?>'"><a href="index.php?id=<?=$act['id']?>&amp;label=<?=urlencode($snapshot->label_list[$i])?>"><?=htmlspecialchars(substr($snapshot->label_list[$i],2))?></a></td></tr>
               
<?php } //end of if is_public
       }//end of if count 

   } 
//end of for

//end table of categories and show account statistics

?>
           
</table>
<?php           
}
//end of $sum=1
elseif ($sum == 2) { //show account list here
   ?>
          
<table class="border" width="30%" border="0" align="center" cellpadding="0" cellspacing="0">
             
<tr>
               
<td height="21" bgcolor="#CCCCCC"><div align="center" class="style6"><strong>Accounts</strong></div></td>
             
</tr>
             
<?php
             
$accounts = getGmailAccounts();
             
if (count($accounts== 0){
             
?>
               
<tr bgcolor="white" align="center">
               
<td height="21" class="list" onmouseover="this.style.backgroundColor='#999966';" onmouseout="this.style.backgroundColor='#FFFFFF';" onclick="window.location='admin.php'"><a href="admin.php">No accounts created, go to administration panel.</td></tr>
             
<?php
             }
             
else
             
foreach ($accounts as $act){
             
?>             
               
<tr bgcolor="white" align="center">
               
<td height="21" class="list" onmouseover="this.style.backgroundColor='#999966';" onmouseout="this.style.backgroundColor='#FFFFFF';" onclick="window.location='index.php?id=<?=$act['id']?>'"><a href="index.php?id=<?=$act['id']?>"><?=$act['title']?></a></td></tr>
               
<?php   } //end of foreach

?>
</table>
           
<br />
<?php
}
if ($sum != 2){
?>
<br />
<div align="center" class="style7">Using <b><?=$snapshot->quota_mb?>
</b> of space (<b><?=$snapshot->quota_per?>
</b> full).<br /></div>
<?php
}
//include page footer
include('footer.php');
?>
<p>&nbsp;</p>
</body>
</html>



posted on 2006-03-30 11:40  RubyPDF  阅读(1026)  评论(0编辑  收藏  举报