Location: PHPKode > projects > Dogfood-A Complete Groupware/CRM System > dogfood/info/info.php
<?php
/* TODO Discover Usage and update for current mail and helpdesk mod support.  Add client support. */
// info.php - PHProjekt Version 3.3
// copyright  ©  2000-2002 Albrecht Guenther  hide@address.com
// www.phprojekt.com
// Author: Albrecht Guenther

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

// 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 ".$DB['current'].".termine where an = '$user_ID' and (event like '%$wort%' or note like '%$wort%' or note2 like '%$wort%')");
  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='".href("index.php?sys_module=calendar&mode=view&event_ID=$row[0]")."'>$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/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 ".$DB['current'].".forum where (titel like '%$wort%' or remark like '%$wort%') and $sql_user_group");
  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='".href("index.php?sys_module=forum&mode=forms&ID=$row[0]&action=writetext")."'>$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/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 ".$DB['current'].".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");
  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/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 ".$DB['current'].".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 = 'a') and $sql_user_group");
  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='".href("index.php?sys_module=contacts&pers_ID=$row[0]&mode=forms&modify=1&import=")."'>$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/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 ".$DB['current'].".notes where (name like '%$wort%' or remark like '%$wort%') and von = $user_ID");
  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='".href("index.php?sys_module=notes&mode=view&ID=$row[0]")."'>$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/s.gif' width=500 height=1><br><br>";
}

// results for mails
if ($gebiet == "mails" or ($gebiet == "all" and $quickmail == 2)) {
/* TODO Fix new table format
  $hits = 0;
  echo "<h5>$o_mail</h5>\n";
  $result = db_query("select * from ".$DB['current'].".msgs_messages where (subject like '%$wort%' or msg like '%$wort%' or who like '%$wort%' or rcpt like '%$wort%' or client like '%$wort%' or fullheaders like '%$wort%') and von = $user_ID");
  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='".href("index.php?sys_module=mail&mode=readmail&action=form&ID=$row[0]")."'>$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/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
    $where .= ")";
  }

  $result = db_query("select ID, name, note from rts $where");
  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='".href("index.php?sys_module=helpdesk&mode=formsID=$row[0]")."'>$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/s.gif' width=500 height=1><br><br>";
}


echo "</body></html>";
?>
Return current item: Dogfood-A Complete Groupware/CRM System