Location: PHPKode > projects > Toutateam Groupware > toutateam-v1.56/info/info.php
<?php

// info.php - PHProjekt Version 3.3
// copyright  ©  2000-2002 Albrecht Guenther  hide@address.com
// www.phprojekt.com
// Author: Albrecht Guenther

error_reporting(0);
//Bookmark - Redirect
$lesezeichen = $HTTP_POST_VARS["lesezeichen"];
if ($lesezeichen) header("Location: $lesezeichen");

$path_pre="../";
$include_path = $path_pre."lib/lib.inc.php";
include_once $include_path;

echo "<html><head>"; getGeneralHeaders();  echo "<link rel=stylesheet type='text/css' href='$css_style'>$lang_cfg</head><body $backgroundimageflag  bgcolor=\"$bgcolor3\">\n";

// check whether variable $hits exists
if (!$maxhits) { $maxhits = 50; }

// check whether a keyword has been entered
if (!$wort) { die("$info_text16"); }

// events
if ($gebiet == "termine" or $gebiet == "all") {
  $hits = 0;
  echo "<h5>$o_calendar</h5>\n";
  $result = db_query("select * from termine where an = '$user_ID' and (event like '%$wort%' or note like '%$wort%' or note2 like '%$wort%')") or db_die();
  echo "<table border=1 rules=none cellspacing=1 cellpadding=2 bgcolor=$bgcolor2>";
  echo "<tr bgcolor=$bgcolor1><td>$info_text2:</td><td>$info_text3:</td></tr>\n";
  while ($row = db_fetch_row($result)) {
    if ($hits <= $maxhits) {
      $event = html_out($row[3]);
      if (($b/2) == round($b/2)) { $color = "#E5E5E5";$b++; } else { $color = "#D8D8D8";$b++; } // change colour for each entry
      echo "<tr bgcolor=$color><td width=80>$row[7]</td>\n";
      echo "<td width=80><a href='../calendar/m2.php?PHPSESSID=$PHPSESSID&mode=view&event_ID=$row[0]' target=_blank>$event</a></td></tr>\n";
    }
    $hits++;
  }
  echo "</table>\n";
  if ($hits == 0) { echo "$wort: $info_text4!\n"; }
  elseif ($hits > $maxhits) { echo "$maxhits $votum_text5 $hits $info_text1:\n"; }
  else { echo "$hits $info_text1\n"; }
  echo "<br><br><img src='$img_path/s.gif' width=500 height=1><br><br>";
}

// Forum
if ($gebiet == "forum" or ($gebiet == "all" and $forum)) {
  $hits = 0;
  echo "<h5>$o_forum</h5>\n";
  $result = db_query("select * from forum where (titel like '%$wort%' or remark like '%$wort%') and $sql_user_group") or db_die();
  echo "<table border=1 rules=none cellspacing=1 cellpadding=2 bgcolor=$bgcolor2><tr>";
  echo "<tr bgcolor=$bgcolor1><td>$info_text5:</td><td>$info_text3:</td><td>$info_text2:</td></tr>";
  while ($row = db_fetch_row($result)) {
    if ($hits <= $maxhits) {
      if (($b/2) == round($b/2)) { $color = "#E5E5E5";$b++; } else { $color = "#D8D8D8";$b++; } // change colour for each entry
      $datum = substr($row[6],6,2)."-".substr($row[6],4,2)."-".substr($row[6],0,4)." ".substr($row[6],8,2).":".substr($row[6],10,2);
      $remark = nl2br(html_out(substr($row[4],0,300)));
      if(strlen($remark) > 300) { $remark = $remark."..."; }
      echo "<tr bgcolor=$color><td width=80><a href='../forum/forum.php?mode=forms&ID=$row[0]&action=writetext$sid' target=_blank>$row[3]</a></td>\n";
      echo "<td width=300>$remark</td><td>$datum</td></tr>";
    }
    $hits++;
  }
  echo "</table>\n";
  if ($hits == 0) { echo "$wort: $info_text4!"; }
  elseif ($hits > $maxhits) { echo "$maxhits $votum_text5 $hits $info_text1:\n"; }
  else { echo "$hits $info_text1:\n"; }
  echo "<br><br><img src='$img_path/s.gif' width=500 height=1><br><br>";
}

// file module
if ($gebiet =="files" or ($gebiet == "all" and $dateien)) {
  $hits = 0;
  echo "<h5>$o_files</h5>\n";
  $result = db_query("select * from dateien where (filename like '%$wort%' or remark like '%$wort%' or kat like '%$wort%') and (von = $user_ID or acc = 'group' or acc like '%\"$user_kurz\"%') and $sql_user_group order by filename") or db_die();
  echo "<table border=1 rules=none cellspacing=1 cellpadding=2 bgcolor=$bgcolor2><tr bgcolor=$bgcolor1>\n";
  echo "<td>$datei_text3</a></td>\n";
  echo "<td>$datei_text6</a></td>\n";
  echo "<td>Byte</a></td>\n";
  echo "<td>&nbsp;</td>\n"; // table cell for buttons
  echo "<td>$datei_text5</a></td>\n";   // category
  echo "<td>$datei_text4</a></td></tr>\n"; // remark
  while ($row = db_fetch_row($result)) { include('../filemanager/filemanager_list.php'); }
  echo "</table>\n";
  if (!$treffer) $treffer = "0";
  if (!$total_size) $total_size = "0";
  echo " &nbsp;<i>$sum: $treffer $datei_text22, $total_size Byte</i>\n";
  echo "<br><br><img src='$img_path/s.gif' width=500 height=1><br><br>";
}

// result for contacts
if ($gebiet == "contacts" or ($gebiet == "all" and $adressen)) {
  $hits = 0;
  echo "<h5>$o_adresses</h5>\n";
  $result = db_query("select * from contacts where (vorname like '%$wort%' or nachname like '%$wort%' or firma like '%$wort%' or gruppe like '%$wort%' or email like '%$wort%' or strasse like '%$wort%' or stadt like '%$wort%' or land like '%$wort%' or bemerkung like '%$wort%') and (von = '$user_ID' or acc like 'a' or (acc like 'g' and gruppe=".$user_group.")) ") or db_die();
  echo "<table border=1 rules=none cellspacing=1 cellpadding=2 bgcolor=$bgcolor2><tr bgcolor=$bgcolor1>\n";
  echo "<td width=80>$info_text9:</td><td width=80>$info_text10:</td>";
  echo "<td width=80>$info_text11</td><td width=80>$info_text12</td>";
  echo "<td width=80>$info_text13</td><td width=80>$info_text14</td></tr>\n";
  while ($row = db_fetch_row($result)) {
    if ($hits <= $maxhits) {
      if (($b/2) == round($b/2)) { $color = "#E5E5E5";$b++; } else { $color = "#D8D8D8";$b++; } // change colour for each entry
      echo "<tr bgcolor=$color><td>&nbsp;$row[1]</td>\n";
      echo "<td>&nbsp;<a href='../contacts/contacts.php?pers_ID=$row[0]&mode=forms&modify=1&import=&PHPSESSID=$PHPSESSID' target='_blank'>$row[2]</a></td>\n";
      echo "<td>&nbsp;$row[4]</td><td>&nbsp;$row[9]</td><td>&nbsp;$row[11] $row[10]</td><td>&nbsp;$row[12]</td></tr>\n";
    }
    $hits++;
  }
  echo "</table>\n";
  if ($hits == 0) { echo "$wort: $info_text4!"; }
  elseif ($hits > $maxhits) { echo "$maxhits $votum_text5 $hits $info_text1:\n"; }
  else { echo "$hits $info_text1:\n"; }
  echo "<br><br><img src='$img_path/s.gif' width=500 height=1><br><br>";
}

// results for notes
if ($gebiet == "notes" or ($gebiet == "all" and $notes)) {
  $hits = 0;
  echo "<h5>$o_notes</h5>\n";
  $result = db_query("select * from notes where (name like '%$wort%' or remark like '%$wort%') and von = $user_ID") or db_die();
  echo "<table border=1  rules=none cellspacing=1 cellpadding=2 bgcolor=$bgcolor2><tr bgcolor=$bgcolor1>";
  echo "<td width=80>$forum_text5</td><td width=80>$forum_text6</td></tr>\n";
  while ($row = db_fetch_row($result)) {
    if ($hits <= $maxhits) {
      if (($b/2) == round($b/2)) { $color = "#E5E5E5";$b++; } else { $color = "#D8D8D8";$b++; } // change colour for each entry
      $remark = nl2br(html_out(substr($row[3],0,300)));
      if(strlen($remark) > 300) { $remark = $remark."..."; }
      echo "<tr bgcolor=$color><td><a href='../notes/notes.php?PHPSESSID=$PHPSESSID&mode=view&ID=$row[0]' target='_blank'>$row[2]</a></td>\n";
      echo "<td>$remark</td></tr>\n";  // text
    }
    $hits++;
  }
  echo "</table>\n";
  if ($hits == 0) { echo "$wort: $info_text4!"; }
  elseif ($hits > $maxhits) { echo "$maxhits $votum_text5 $hits $info_text1:\n"; }
  else { echo "$hits $info_text1:\n"; }
  echo "<br><br><img src='$img_path/s.gif' width=500 height=1><br><br>";
}

// results for mails
if ($gebiet == "mails" or ($gebiet == "all" and $quickmail == 2)) {
  $hits = 0;
  echo "<h5>$o_mail</h5>\n";
  $result = db_query("select * from mail_client where (subject like '%$wort%' or body like '%$wort%' or sender like '%$wort%' or recipient like '%$wort%' or remark like '%$wort%' or header like '%$wort%') and von = $user_ID") or db_die();
  echo "<table border=1 rules=none cellspacing=1 cellpadding=2 bgcolor=$bgcolor2>";
  // subject, body, sender, recipient, remark
  echo "<tr bgcolor=$bgcolor1><td width=80>$mail_text1</td><td width=80>$forum_text6</td>\n";
  echo "<td width=80>$mail_text24</td></tr>\n";
  while ($row = db_fetch_row($result)) {
    if ($hits < $maxhits) {
      // change colour for each entry
      if (($b/2) == round($b/2)) { $color = "#E5E5E5";$b++; } else { $color = "#D8D8D8";$b++; }
      echo "<tr bgcolor=$color>\n";
      // subject with link
      echo "<td><a href='../mail/mail.php?mail=view&action=form&PHPSESSID=$PHPSESSID&ID=$row[0]' target='_blank'>$row[2]&nbsp;</a></td>\n";
      $remark = nl2br(html_out(substr($row[3],0,300)));
      if(strlen($remark) > 300) { $remark = $remark."..."; }
      echo "<td>$remark </td><td>$row[4]&nbsp;</td></tr>\n";
    }
    $hits++;
  }
  echo "</table>\n";
  if ($hits == 0) { echo "$wort: $info_text4!"; }
  elseif ($hits > $maxhits) { echo "$maxhits $votum_text5 $hits $info_text1:\n"; }
  else { echo "$hits $info_text1:\n"; }
  echo "<br><br><img src='$img_path/s.gif' width=500 height=1><br><br>";
}

// results for helpdesk
if ($gebiet == "rts" or ($gebiet == "all" and $rts)) {
  $hits = 0;
  echo "<h5>$o_rts</h5>\n";

  // filter on all fields
  $where = " where (contact like '%$wort%' or email like '%$wort%' or name like '%$wort%' or note like '%$wort%' or remark like '%$wort%' or solution like '%$wort%')";

  // additional limitation for normal users: only those requests which are assigned to you or your group
  if (!ereg("c",$user_access)) {
    $where .= " and (assigned = '$user_kurz'";
    // group system? fetch short name of the group
    if ($groups) {
      $result = db_query("select kurz from gruppen where ID = '$user_group'") or db_die();
      $row = db_fetch_row($result);
      $where .= " or assigned = '$row[0]'";
    }
    $where .= ")";
  }

  $result = db_query("select ID, name, note from rts $where") or db_die();
  echo "<table border=1 rules=none cellspacing=1 cellpadding=2 bgcolor=$bgcolor2>";
  // sender, title
  echo "<tr bgcolor=$bgcolor1><td width=80>$rts_24</td><td width=80>$rts_25</td></tr>\n";
  while ($row = db_fetch_row($result)) {
    if ($hits < $maxhits) {
      // change colour for each entry
      if (($b/2) == round($b/2)) { $color = "#E5E5E5";$b++; } else { $color = "#D8D8D8";$b++; }
      echo "<tr bgcolor=$color>\n";
      // subject with link
      echo "<td><a href='../helpdesk/helpdesk.php?mode=forms&PHPSESSID=$PHPSESSID&ID=$row[0]' target='_blank'>$row[1]&nbsp;</a></td>\n";
      $remark = nl2br(html_out(substr($row[2],0,300)));
      if(strlen($remark) > 300) { $remark = $remark."..."; }
      echo "<td>$remark </td></tr>\n";
    }
    $hits++;
  }
  echo "</table>\n";
  if ($hits == 0) { echo "$wort: $info_text4!"; }
  elseif ($hits > $maxhits) { echo "$maxhits $votum_text5 $hits $info_text1:\n"; }
  else { echo "$hits $info_text1:\n"; }
  echo "<br><br><img src='$img_path/s.gif' width=500 height=1><br><br>";
}


echo "</body></html>";
?>
Return current item: Toutateam Groupware