+<?php\r
+ \r
+ include_once('config.php');\r
+ include_once('linkbar.php');\r
+\r
+function truefalsedropdown($name,$currentval)\r
+{\r
+ ?>\r
+ <select name="<?php print($name); ?>">\r
+ <option value="true" <?php if($currentval=="true") print("SELECTED"); ?>>true</option>\r
+ <option value="false" <?php if($currentval=="false") print("SELECTED"); ?>>false</option>\r
+ </select>\r
+ <?php\r
+}\r
+\r
+function content()\r
+{\r
+ global $dblocation;\r
+ $db=new PDO('sqlite:'.$dblocation);\r
+ \r
+ if(isset($_REQUEST['formaction']))\r
+ {\r
+ if($_REQUEST['formaction']=='update' && isset($_REQUEST['update']))\r
+ {\r
+ $st=$db->prepare("UPDATE tblLocalIdentity SET SingleUse=?, PublishTrustList=? WHERE LocalIdentityID=?;");\r
+ for($i=0; $i<count($_REQUEST['update']); $i++)\r
+ {\r
+ if($_REQUEST['update'][$i]!='')\r
+ {\r
+ $st->bindParam(1,$_REQUEST['singleuse'][$_REQUEST['update'][$i]]);\r
+ $st->bindParam(2,$_REQUEST['publishtrustlist'][$_REQUEST['update'][$i]]);\r
+ $st->bindParam(3,$_REQUEST['localidentityid'][$_REQUEST['update'][$i]]);\r
+ $st->execute();\r
+ }\r
+ }\r
+ }\r
+ if($_REQUEST['formaction']=='delete' && isset($_REQUEST['update']))\r
+ {\r
+ $st=$db->prepare("DELETE FROM tblLocalIdentity WHERE LocalIdentityID=?;");\r
+\r
+ for($i=0; $i<count($_REQUEST['update']); $i++)\r
+ {\r
+ if($_REQUEST['update'][$i]!='')\r
+ {\r
+ $st->bindParam(1,$_REQUEST['localidentityid'][$_REQUEST['update'][$i]]);\r
+ $st->execute();\r
+ } \r
+ } \r
+ }\r
+ }\r
+ \r
+ $st=$db->prepare("SELECT LocalIdentityID,Name,PublicKey,PublishTrustList,SingleUse,PublishBoardList FROM tblLocalIdentity ORDER BY Name;");\r
+ $st->execute();\r
+ ?>\r
+ <h2>Local Identities</h2>\r
+ <form name="frmlocalidentity" method="post">\r
+ <input type="hidden" name="formaction" value="update">\r
+ <table>\r
+ <tr>\r
+ <td></td>\r
+ <th>Name</th>\r
+ <th>Single Use</th>\r
+ <th>Publish Trust List</th>\r
+ </tr>\r
+ <?php\r
+ $row=0;\r
+ while($record=$st->fetch())\r
+ {\r
+ ?>\r
+ <tr>\r
+ <td>\r
+ <input type="checkbox" name="update[]" value="<?php print($row); ?>">\r
+ </td>\r
+ <td title="<?php print($record[2]); ?>">\r
+ <input type="hidden" name="localidentityid[]" value="<?php print($record[0]); ?>">\r
+ <?php print($record[1]); ?>\r
+ </td>\r
+ <td>\r
+ <?php\r
+ truefalsedropdown("singleuse[]",$record[4]);\r
+ ?>\r
+ </td>\r
+ <td>\r
+ <?php\r
+ truefalsedropdown("publishtrustlist[]",$record[3]);\r
+ ?>\r
+ </td>\r
+ </tr>\r
+ <?php\r
+ $row++;\r
+ }\r
+ ?>\r
+ </table>\r
+ <input type="submit" value="Update Selected">\r
+ <input type="submit" value="Delete Selected" onClick="if(confirm('Delete Selected Identities?')){frmlocalidentity.formaction.value='delete';}else{return false;}">\r
+ </form>\r
+ <?php\r
+}\r
+\r
+ include_once('template.php');\r
+\r
+?>
\ No newline at end of file