version 0.1.2
[fms.git] / admin / identitytrust.php
1 <?php\r
2 \r
3         include_once('config.php');\r
4         include_once('linkbar.php');\r
5         \r
6 function content()\r
7 {\r
8         \r
9         global $dblocation;\r
10         \r
11         $db=new PDO('sqlite:'.$dblocation);\r
12         \r
13         if(isset($_REQUEST['formaction']) && $_REQUEST['formaction']=='updatetrust')\r
14         {\r
15                 $st=$db->prepare("UPDATE tblIdentity SET LocalMessageTrust=?, LocalTrustListTrust=? WHERE IdentityID=?;");\r
16                 for($i=0; $i<count($_REQUEST['identityid']); $i++)\r
17                 {\r
18                         if($_REQUEST['oldlocalmessagetrust'][$i]!=$_REQUEST['newlocalmessagetrust'][$i] || $_REQUEST['oldlocaltrustlisttrust']!=$_REQUEST['newlocaltrustlisttrust'])\r
19                         {\r
20                                 $st->bindParam(1,$_REQUEST['newlocalmessagetrust'][$i]);\r
21                                 $st->bindParam(2,$_REQUEST['newlocaltrustlisttrust'][$i]);\r
22                                 $st->bindParam(3,$_REQUEST['identityid'][$i]);\r
23                                 $rval=$st->execute();\r
24                         }\r
25                 }\r
26         }\r
27         \r
28         $st=$db->prepare("SELECT IdentityID,Name,LocalMessageTrust,PeerMessageTrust,LocalTrustListTrust,PeerTrustListTrust,PublicKey FROM tblIdentity ORDER BY Name;");\r
29         $st->execute();\r
30         ?>\r
31         <h2>Identity Trust</h2>\r
32         Message Trust is how much you trust the identity to post good messages.  Trust List Trust is how much weight you want the trust list of that identity to have when calculating the total.  The local trust levels are set by you, and the peer trust levels are calculated by a weighted average using other identities trust lists.\r
33         <form name="frmtrust" method="post">\r
34         <input type="hidden" name="formaction" value="updatetrust">\r
35         <table>\r
36                 <tr>\r
37                         <th>Peer</th>\r
38                         <th>Local Message Trust</th>\r
39                         <th>Peer Message Trust</th>\r
40                         <th>Local Trust List Trust</th>\r
41                         <th>Peer Trust List Trust</th>\r
42                 </tr>\r
43                 <?php\r
44                 while($record=$st->fetch())\r
45                 {\r
46                 ?>\r
47                 <tr>\r
48                         <td title="<?php print($record[6]); ?>">\r
49                                 <?php print($record[1]); ?>\r
50                                 <input type="hidden" name="identityid[]" value="<?php print($record[0]); ?>">\r
51                         </td>\r
52                         <td>\r
53                                 <input type="hidden" name="oldlocalmessagetrust[]" value="<?php print($record[2]); ?>">\r
54                                 <input type="text" name="newlocalmessagetrust[]" size="2" maxlength="3" value="<?php print($record[2]); ?>">\r
55                         </td>\r
56                         <td><?php print($record[3]); ?></td>\r
57                         <td>\r
58                                 <input type="hidden" name="oldlocaltrustlisttrust[]" value="<?php print($record[4]); ?>">\r
59                                 <input type="text" name="newlocaltrustlisttrust[]" size="2" maxlength="3" value="<?php print($record[4]); ?>">\r
60                         </td>\r
61                         <td><?php print($record[5]) ?></td>\r
62                 </tr>\r
63                 <?php   \r
64                 }\r
65                 ?>\r
66                 <tr>\r
67                         <td colspan="5">\r
68                                 <input type="submit" value="Update Trust">\r
69                         </td>\r
70                 </tr>\r
71         </table>\r
72         </form>\r
73         <?php\r
74 }\r
75         \r
76         include_once('template.php');\r
77 \r
78 ?>