home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / admin / tool.php < prev    next >
Encoding:
PHP Script  |  2003-06-29  |  5.3 KB  |  137 lines

  1. <?php
  2. /////////////////////////////////////////////////////////
  3. //    
  4. //    source/tool.php
  5. //
  6. //    (C)Copyright 2000-2002 Ryo Chijiiwa <Ryo@IlohaMail.org>
  7. //
  8. //        This file is part of IlohaMail.
  9. //        IlohaMail is free software released under the GPL 
  10. //        license.  See enclosed file COPYING for details,
  11. //        or see http://www.fsf.org/copyleft/gpl.html
  12. //
  13. /////////////////////////////////////////////////////////
  14.  
  15. /********************************************************
  16.  
  17.     AUTHOR: Ryo Chijiiwa <ryo@ilohamail.org>
  18.     FILE: tool.php
  19.     PURPOSE:
  20.         This is the tool bar.  Provides global access to main functionality, including:
  21.         1. Access to folder list, or folder contents (including INBOX)
  22.         2. Access to message composition page (link to "source/compose.php")
  23.         3. Access to search form (link to "source/search_form.php")
  24.         4. Access to contacts list (link to "source/contacts.php")
  25.         5. Access to preferences (link to "source/prefs.php")
  26.         6. Logout
  27.     PRE-CONDITIONS:
  28.         $user - Session ID
  29.     COMMENTS:
  30.         Depending on whether or not "list_folders" preferences is enabled or not, this page
  31.         may display a pop-up menu of all folders, or a link to source/folders.php.
  32.         If the protocol does not support a given feature, it will not be displayed (e.g. "Folders"
  33.         and "Search" links will not be shown for POP3 accounts).
  34.         
  35. ********************************************************/
  36.  
  37. include("../include/super2global.inc");
  38. include("../include/nocache.inc");
  39.  
  40. function showLink($a){
  41.     echo $a[3]."<a href=\"".$a[0]."\" target=\"".$a[1]."\" class=\"menuText\">".$a[2]."</a>\n";
  42. }
  43.  
  44. if (isset($user)){
  45.     include_once("../include/ryosimap.inc");
  46.     include_once("../include/encryption.inc");
  47.     include_once("../include/session_auth.inc");
  48.     include_once("../include/icl.inc");
  49.     include_once("../lang/".$my_prefs["lang"]."tool.inc");
  50.     
  51.     $linkc=$my_colors["tool_link"];
  52.     $bgc=$my_colors["tool_bg"];
  53.     $font_size = $my_colors["menu_font_size"];
  54.     $bodyString='<BODY  LEFTMARGIN=0 RIGHTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 TOPMARGIN=0 BGCOLOR="'.$bgc.'" TEXT="'.$linkc.'" LINK="'.$linkc.'" ALINK="'.$linkc.'" VLINK="'.$linkc.'">';
  55. }else{
  56.     echo "User not specified.";
  57.     exit;
  58. }
  59. ?>
  60. <HTML>
  61. <HEAD>
  62. <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=<?php echo $my_prefs["charset"]; ?>">
  63. <?php
  64. /*** include CSS ***/
  65. include("../include/css.inc");
  66. ?>
  67. </HEAD>
  68. <?php 
  69. echo $bodyString; 
  70.  
  71. $div = "<span class=\"menuText\">  |  </span>";
  72.  
  73. if (($my_prefs["list_folders"])||(!$ICL_CAPABILITY["folders"])){
  74.     $links[] = array("main.php?folder=INBOX&user=$user", "list2", $toolStrings["inbox"], "    ");
  75.     //if ($ICL_CAPABILITY["folders"])
  76.     //$links[] = array("folders.php?user=$user", "list1", $toolStrings["folders"], $div);
  77. }
  78. $target = ($my_prefs["compose_inside"]?"list2":"_blank");
  79. $links[] = array("compose2.php?user=$user", $target, $toolStrings["compose"], $div);
  80. if (($ICL_CAPABILITY["calendar"]) && (!$DISABLE_CALENDAR))
  81.     $links[] = array("calendar.php?user=$user", "list2", $toolStrings["calendar"], $div);
  82. $links[] = array("contacts.php?user=$user", "list2", $toolStrings["contacts"], $div);
  83. if (!$DISABLE_BOOKMARKS)
  84.     $links[] = array("bookmarks.php?user=$user", "list2", $toolStrings["bookmarks"], $div);
  85. if ($ICL_CAPABILITY["search"])
  86.     $links[] = array("search_form.php?user=$user", "list2", $toolStrings["search"], $div);
  87. $links[] = array("prefs.php?user=$user", "list2", $toolStrings["prefs"], $div);
  88.  
  89. echo "\n<form method=POST action=\"main.php\" target=\"list2\">\n";
  90. ?>
  91. <table width="100%"><tr class="menuText"><td valign="bottom">
  92. <?php
  93. if ((!$my_prefs["list_folders"]) && ($ICL_CAPABILITY["folders"])){
  94.     echo "<input type=hidden name=\"sort_field\" value=\"".$my_prefs["sort_field"]."\">\n";
  95.     echo "<input type=hidden name=\"sort_order\" value=\"".$my_prefs["sort_order"]."\">\n";
  96.     echo "<input type=hidden name=\"user\" value=\"".$user."\">\n";
  97.     
  98.     $conn = iil_Connect($host, $loginID, $password, $AUTH_MODE);
  99.     if ($conn){
  100.         include_once("../include/cache.inc");
  101.         $cached_folders = cache_read($loginID, $host, "folders");
  102.         if (is_array($cached_folders)){
  103.             echo "<!-- Read cache! //-->\n";
  104.             $folderlist = $cached_folders;
  105.         }else{
  106.             echo "<!-- No cache...";
  107.             if ($my_prefs["hideUnsubscribed"]) $folderlist = iil_C_ListSubscribed($conn, $my_prefs["rootdir"], "*");
  108.             else $folderlist = iil_C_ListMailboxes($conn, $my_prefs["rootdir"], "*");
  109.             $cache_result = cache_write($loginID, $host, "folders", $folderlist);
  110.             echo "write: $cache_result //-->\n";
  111.         }
  112.         //$folderlist=iil_C_ListMailboxes($conn, $my_prefs["rootdir"], "*");
  113.         iil_Close($conn);
  114.     }
  115.     if ($my_prefs["list_folders"]!=1){
  116.         include("../lang/".$my_prefs["lang"]."defaultFolders.inc");
  117.         echo "<select name=folder>\n";
  118.         RootedFolderOptions($folderlist, $defaults, $my_prefs["rootdir"]);
  119.         echo "</select>";
  120.         echo "<input type=submit value=\"".$toolStrings["go"]."\">";
  121.     }
  122.     $link = array("edit_folders.php?user=$user", "list2", $toolStrings["folders"]);
  123.     showLink($link);
  124. }
  125. while ( list($k,$v) = each($links) ){
  126.     //echo "<span class=\"menuText\">  |  </span>";
  127.     showLink($links[$k]);
  128. }
  129. //echo "<span class=\"menuText\">  |  </span>";
  130. ?>
  131. </td><td align="right" valign="bottom">
  132.     <A HREF="login.php?logout=1&user=<?php echo $user?>" target="_top" class="menuText"><?php echo $toolStrings["logout"]?></A>
  133. </td></tr></table>
  134. </form>
  135. </BODY>
  136. </HTML>
  137.