Few tweaks to the plugins system
Few tweaks to the plugins system

--- a/lib/db/Credentials.php
+++ b/lib/db/Credentials.php
@@ -250,7 +250,7 @@
     if ($id){
       $log = new Logging;
       $log->logEntry($id,7);
-      return true;
+      return $id;
       }else{
       return false;
       }

--- a/plugins/Blargle/AutoAuth/README.html
+++ b/plugins/Blargle/AutoAuth/README.html
@@ -47,6 +47,7 @@
 <li><b><i>Additional address path: </b></i> Specifies any additional URL params that need to be specified to enable login</li>
 <li><b><i>User Field:</b></i> The field name used by the login form of the linked system</li>
 <li><b><i>Password Field:</b></i> The field name use by the login form of the linked system</li>
+<li><b><i>Requires Cookies:</b></i> Some systems require a specific cookie to exist. If this is checked, the target page will be loaded as part of the form (the user won't see it) to ensure all relevant cookies are set. </li>
 <li><b><i>Additional Fields:</b></i> Some systems require additional hidden fields to be submitted. This field allows you to specify names and values in CSV format using key=value (i.e. <i>page=home,action=login</i>)
 </ul>
 <br />
@@ -63,6 +64,8 @@
 <tr class='confVal'><th>User Field</th><td>user</td><td>user</td><td>log</td></tr>
 
 <tr class='confVal'><th>Password Field</th><td>pass</td><td>pass</td><td>pwd</td></tr>
+
+<tr class='confVal'><th>Requires Cookie</th><td>No</td><td>Yes</td><td>Yes</td></tr>
 
 <tr class='confVal'><th>Additional Fields</th><td>none</td><td>page=/,</td><td></td></tr>
 </table>

--- a/views/Creds/add.php
+++ b/views/Creds/add.php
@@ -13,6 +13,7 @@
 $creds = new CredDB;
 global $notifications;
 $notifications->setPageTitle("Add ". Lang::_('Credential'));
+$plg = new Plugins;
 
 if (BTMain::getVar('addCredSubmitted')){
 
@@ -29,11 +30,19 @@
 	 }
 
 
-
+  $newcred = $creds->addCred(BTMain::getVar('cust'),BTMain::getVar('FrmCredType'),$cred,BTMain::getVar('frmClicky'),BTMain::getVar('frmGroup'),$addr,$user);
   // Add the cred to the db
-  if ($creds->addCred(BTMain::getVar('cust'),BTMain::getVar('FrmCredType'),$cred,BTMain::getVar('frmClicky'),BTMain::getVar('frmGroup'),$addr,$user)){
+  if ($newcred){
   // Success
   $notifications->setNotification("addCredSuccess");
+
+     $data->cred->id = $newcred;
+     $data->action = 'edit';
+
+    
+    echo $plg->loadPlugins("Creds",$data)->plgOutput;
+
+
   }else{
   $notifications->setNotification("addCredFail");
   }
@@ -118,5 +127,18 @@
 
 <?php include 'lib/includes/groupSelection.php'; ?>
 
+
+<?php
+
+    // Call any configured plugins
+         
+     $data->action = 'editfrmnew';
+
+    
+    echo $plg->loadPlugins("Creds",$data)->plgOutput;
+
+
+?>
+
 <input type="submit" class="btn btn-primary" value="Add <?php echo Lang::_("Credential");?>">
 </form>

--- a/views/Creds/edit.php
+++ b/views/Creds/edit.php
@@ -13,6 +13,7 @@
 global $notifications;
 $creds = new CredDB;
 $id = BTMain::getVar('id');
+$plg = new Plugins;
 
 
 
@@ -53,6 +54,10 @@
   if ($creds->editCred($id,$credtype,$cred,$clicky,$group,$address,$uname)){
   // Success
   $notifications->setNotification("addCredSuccess");
+      $data->cred->id = $id;
+      $data->action = 'edit';
+      echo $plg->loadPlugins("Creds",$data)->plgOutput;
+
   }else{
   $notifications->setNotification("addCredFail");
   }
@@ -135,6 +140,15 @@
 <a href="javascript: genPwd('frmCredential',10);">Generate Password</a>
 <label for="frmAddress"><?php echo Lang::_("Address");?></label><input type="text" name="frmAddress" id="frmAddress" value="NOCHANGE">
 
+<?php
+
+    // Call any configured plugins
+         
+     $data->action = 'editfrmnew';
+     $data->cred->id = $id;    
+     echo $plg->loadPlugins("Creds",$data)->plgOutput;
+
+?>
 
 
 <?php include 'lib/includes/groupSelection.php'; ?>