/usr/share/IlohaMail/source/contacts.php is in ilohamail 0.8.14-0rc3sid6.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | <?php
/////////////////////////////////////////////////////////
//
// source/contacts.php
//
// (C)Copyright 2001-2002 Ryo Chijiiwa <Ryo@IlohaMail.org>
//
// This file is part of IlohaMail.
// IlohaMail is free software released under the GPL
// license. See enclosed file COPYING for details,
// or see http://www.fsf.org/copyleft/gpl.html
//
/////////////////////////////////////////////////////////
/********************************************************
AUTHOR: Ryo Chijiiwa <ryo@ilohamail.org>
FILE: source/contacts.php
PURPOSE:
List basic information of all contacts.
Offer links to
-view/edit contact
-send email to contact
-add new contact
Process posted data to edit/add/remove contacts information
PRE-CONDITIONS:
Required:
$user-Session ID for session validation and user prefernce retreaval
Optional:
POST'd data for add/remove/edit entries. See source/edit_contact.php
POST-CONDITIONS:
COMMENTS:
********************************************************/
function FormatHeaderLink($user, $label, $color, $new_sort_field, $sort_field, $sort_order){
if (strcasecmp($new_sort_field, $sort_field)==0){
if (strcasecmp($sort_order, "ASC")==0) $sort_order="DESC";
else $sort_order = "ASC";
}
$link = "<a href=\"contacts.php?user=$user&sort_field=$new_sort_field&sort_order=$sort_order\" class=\"mainHeading\">";
$link .= "<b>".$label."</b></a>";
return $link;
}
include("../include/super2global.inc");
include("../include/contacts_commons.inc");
include_once("../include/data_manager.inc");
if (isset($user)){
include("../include/header_main.inc");
include("../lang/".$my_prefs["lang"]."/contacts.inc");
include("../lang/".$my_prefs["lang"]."/compose.inc");
//authenticate
include_once("../include/icl.inc");
$conn=iil_Connect($host, $loginID, $password, $AUTH_MODE);
if ($conn){
iil_Close($conn);
}else{
echo "Authentication failed.";
echo "</html>\n";
exit;
}
echo "\n<table width=\"100%\" cellpadding=2 cellspacing=0><tr bgcolor=\"".$my_colors["main_head_bg"]."\">\n";
echo "<td align=left valign=bottom>\n";
echo "<span class=\"bigTitle\">".$cStrings[0]."</span>\n";
echo "</td></tr></table>\n";
//initialize source name
$source_name = $DB_CONTACTS_TABLE;
if (empty($source_name)) $source_name = "contacts";
//open data manager connection
$dm = new DataManager_obj;
if ($dm->initialize($loginID, $host, $source_name, $backend)){
}else{
echo "Data Manager initialization failed:<br>\n";
$dm->showError();
}
//do add
if (isset($add)){
//set group if "other"
if (strcmp($group,"_otr_")==0) $group=$other_group;
//create data array
$new_contact_array = array(
"owner" => $session_dataID,
"name" => $name,
"email" => $email,
"email2" => $email2,
"grp" => $group,
"aim" => $aim,
"icq" => $icq,
"yahoo" => $yahoo,
"msn" => $msn,
"jabber" => $jabber,
"phone" => $phone,
"work" => $work,
"cell" => $cell,
"address" => $address,
"url" => $url,
"comments" => $comments
);
if ($edit<=0){ //if not edit (i.e. new), do an insert
if (!$dm->insert($new_contact_array)){
echo "Insert failed<br>";
$dm->showError();
}
}else{ //is edit, do an update
if (!$dm->update($edit, $new_contact_array)){
echo "update failed<br>";
$dm->showError();
}
}
}else if (isset($delete)){ //delete entry
$dm->delete($delete_item);
}else if (isset($remove)){ //confirm removal of entry
include("../lang/".$my_prefs["lang"]."/edit_contact.inc");
echo "<font color=red>".$errors[6].$name.$errors[7]."</font>\n";
echo "[<a href=\"contacts.php?user=$sid&delete=1&delete_item=$delete_item\" class=\"mainLight\">".$ecStrings[13]."</a>]\n";
echo "[<a href=\"contacts.php?user=$sid\" class=\"mainLight\">Cancel</a>]\n";
}
//initialize sort fields and order
if (empty($sort_field)) $sort_field = "grp,name";
if (empty($sort_order)) $sort_order = "ASC";
//fetch and sort
$contacts = $dm->sort($sort_field, $sort_order);
$numContacts = count($contacts);
//show error, if any
if (!empty($error)) echo "<p>".$error."<br>\n";
$groups = GetGroups($contacts);
echo '<p><a href="edit_contact.php?user='.$sid.'&edit=-1" class="mainLight">'.$cStrings[1].'</a><br>';
echo "\n";
//show contacts
if ( is_array($contacts) && count($contacts) > 0){
reset($contacts);
$target = ($my_prefs["compose_inside"]?"list2":"_blank");
echo "<form method=\"POST\" action=\"compose2.php\" target=\"$target\">\n";
echo "<input type=\"hidden\" name=\"user\" value=\"$user\">\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\" bgcolor=\"".$my_colors["main_hilite"]."\">\n";
//echo "<table border=1>\n";
echo "<tr bgcolor=\"".$my_colors["main_head_bg"]."\">";
echo "<td class=\"mainHeading\"><b>".$composeHStrings[2]."</b></td>";
echo "<td class=\"mainHeading\"><b>".$composeHStrings[3]."</b></td>";
echo "<td class=\"mainHeading\"><b>".$composeHStrings[4]."</b></td>";
echo "<td>".FormatHeaderLink($user, $cStrings[3], $textc, "name", $sort_field, $sort_order)."</td>";
echo "<td>".FormatHeaderLink($user, $cStrings[4], $textc, "email", $sort_field, $sort_order)."</td>";
echo "<td>".FormatHeaderLink($user, $cStrings[6], $textc, "grp,name", $sort_field, $sort_order)."</td>";
echo "</tr>";
while( list($k1, $foobar) = each($contacts) ){
echo "<tr bgcolor=\"".$my_colors["main_bg"]."\">\n";
$a=$contacts[$k1];
$id=$a["id"];
$toString=(!empty($a["name"])?"\"".$a["name"]."\" ":"")."<".$a["email"].">";
$toString=urlencode($toString);
if (empty($a["name"])) $a["name"]="--";
echo "<td><input type=\"checkbox\" name=\"contact_to[]\" value=\"$toString\"></td>";
echo "<td><input type=\"checkbox\" name=\"contact_cc[]\" value=\"$toString\"></td>";
echo "<td><input type=\"checkbox\" name=\"contact_bcc[]\" value=\"$toString\"></td>";
echo "<td><a href=\"edit_contact.php?user=$sid&k=$k1&edit=$id\">".$a["name"]."</a></td>";
echo "<td><a href=\"compose2.php?user=$sid&to=$toString\" target=$target>".$a["email"]."</a></td>";
echo "<td>".$a["grp"]."</td>";
echo "</tr>\n";
}
echo "</table>\n";
echo "<input type=\"submit\" name=\"contacts_submit\" value=\"".$cStrings[10]."\">\n";
}else{
echo "<p>".$cErrors[0];
}
}
?>
</BODY></HTML>
|