version 0.1.2
[fms.git] / admin / identitytrust.php
index 51803f0..6c4663b 100644 (file)
@@ -9,10 +9,29 @@ function content()
        global $dblocation;\r
        \r
        $db=new PDO('sqlite:'.$dblocation);\r
-       $st=$db->prepare("SELECT IdentityID,Name,LocalMessageTrust,PeerMessageTrust,LocalTrustListTrust,PeerTrustListTrust FROM tblIdentity ORDER BY Name;");\r
+       \r
+       if(isset($_REQUEST['formaction']) && $_REQUEST['formaction']=='updatetrust')\r
+       {\r
+               $st=$db->prepare("UPDATE tblIdentity SET LocalMessageTrust=?, LocalTrustListTrust=? WHERE IdentityID=?;");\r
+               for($i=0; $i<count($_REQUEST['identityid']); $i++)\r
+               {\r
+                       if($_REQUEST['oldlocalmessagetrust'][$i]!=$_REQUEST['newlocalmessagetrust'][$i] || $_REQUEST['oldlocaltrustlisttrust']!=$_REQUEST['newlocaltrustlisttrust'])\r
+                       {\r
+                               $st->bindParam(1,$_REQUEST['newlocalmessagetrust'][$i]);\r
+                               $st->bindParam(2,$_REQUEST['newlocaltrustlisttrust'][$i]);\r
+                               $st->bindParam(3,$_REQUEST['identityid'][$i]);\r
+                               $rval=$st->execute();\r
+                       }\r
+               }\r
+       }\r
+       \r
+       $st=$db->prepare("SELECT IdentityID,Name,LocalMessageTrust,PeerMessageTrust,LocalTrustListTrust,PeerTrustListTrust,PublicKey FROM tblIdentity ORDER BY Name;");\r
        $st->execute();\r
        ?>\r
        <h2>Identity Trust</h2>\r
+       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
+       <form name="frmtrust" method="post">\r
+       <input type="hidden" name="formaction" value="updatetrust">\r
        <table>\r
                <tr>\r
                        <th>Peer</th>\r
@@ -26,16 +45,31 @@ function content()
                {\r
                ?>\r
                <tr>\r
-                       <td><?php print($record[1]) ?></td>\r
-                       <td><?php print($record[2]) ?></td>\r
-                       <td><?php print($record[3]) ?></td>\r
-                       <td><?php print($record[4]) ?></td>\r
+                       <td title="<?php print($record[6]); ?>">\r
+                               <?php print($record[1]); ?>\r
+                               <input type="hidden" name="identityid[]" value="<?php print($record[0]); ?>">\r
+                       </td>\r
+                       <td>\r
+                               <input type="hidden" name="oldlocalmessagetrust[]" value="<?php print($record[2]); ?>">\r
+                               <input type="text" name="newlocalmessagetrust[]" size="2" maxlength="3" value="<?php print($record[2]); ?>">\r
+                       </td>\r
+                       <td><?php print($record[3]); ?></td>\r
+                       <td>\r
+                               <input type="hidden" name="oldlocaltrustlisttrust[]" value="<?php print($record[4]); ?>">\r
+                               <input type="text" name="newlocaltrustlisttrust[]" size="2" maxlength="3" value="<?php print($record[4]); ?>">\r
+                       </td>\r
                        <td><?php print($record[5]) ?></td>\r
                </tr>\r
                <?php   \r
                }\r
                ?>\r
+               <tr>\r
+                       <td colspan="5">\r
+                               <input type="submit" value="Update Trust">\r
+                       </td>\r
+               </tr>\r
        </table>\r
+       </form>\r
        <?php\r
 }\r
        \r