Index: /extensions/User_Info_Tracking/admin.php
===================================================================
--- /extensions/User_Info_Tracking/admin.php	(revision 19700)
+++ /extensions/User_Info_Tracking/admin.php	(revision 19700)
@@ -0,0 +1,42 @@
+<?php
+/**
+ * This is the main administration page, if you have only one admin page you can put 
+ * directly its code here or using the tabsheet system like bellow
+ */
+
+defined('USER_INFO_TRACKING_PATH') or die('Hacking attempt!');
+ 
+global $template, $page, $conf;
+
+
+// get current tab
+$page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'home';
+
+// plugin tabsheet is not present on photo page
+if ($page['tab'] != 'photo')
+{
+  // tabsheet
+  include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+  $tabsheet = new tabsheet();
+  $tabsheet->set_id('skeleton');
+  
+  $tabsheet->add('home', l10n('Data'), USER_INFO_TRACKING_ADMIN . '-home');
+  $tabsheet->add('config', l10n('Configuration'), USER_INFO_TRACKING_ADMIN . '-config');
+  $tabsheet->select($page['tab']);
+  $tabsheet->assign();
+}
+
+// include page
+include(USER_INFO_TRACKING_PATH . 'admin/' . $page['tab'] . '.php');
+
+// template vars
+$template->assign(array(
+  'USER_INFO_TRACKING_PATH'=> get_root_url() . USER_INFO_TRACKING_PATH, // used for images, scripts, ... access
+  'USER_INFO_TRACKING_ABS_PATH'=> realpath(USER_INFO_TRACKING_PATH),    // used for template inclusion (Smarty needs a real path)
+  'USER_INFO_TRACKING_ADMIN' => USER_INFO_TRACKING_ADMIN,
+  ));
+  
+// send page content
+$template->assign_var_from_handle('ADMIN_CONTENT', 'user_info_tracking_content');
+
+?>
Index: /extensions/User_Info_Tracking/index.php
===================================================================
--- /extensions/User_Info_Tracking/index.php	(revision 19700)
+++ /extensions/User_Info_Tracking/index.php	(revision 19700)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/User_Info_Tracking/main.inc.php
===================================================================
--- /extensions/User_Info_Tracking/main.inc.php	(revision 19700)
+++ /extensions/User_Info_Tracking/main.inc.php	(revision 19700)
@@ -0,0 +1,130 @@
+<?php 
+/*
+Plugin Name: User Info Tracking
+Version: 1.0.0
+Description: Tracks when a person logs in, either failed or successful.
+Plugin URI: http://piwigo.org/ext/extension_view.php?eid=659
+Author: Charles2012
+Author URI: http://piwigo.org/forum/profile.php?id=17745
+*/
+
+/**
+ * This is the main file of the plugin, called by Piwigo in "include/common.inc.php" line 137.
+ * At this point of the code, Piwigo is not completely initialized, so nothing should be done directly
+ * except define constants and event handlers (see http://piwigo.org/doc/doku.php?id=dev:plugins)
+ */
+
+defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
+
+global $prefixeTable;
+
+// +-----------------------------------------------------------------------+
+// | Define plugin constants                                               |
+// +-----------------------------------------------------------------------+
+defined('USER_INFO_TRACKING_ID') or define('USER_INFO_TRACKING_ID', basename(dirname(__FILE__)));
+define('USER_INFO_TRACKING_PATH' ,   PHPWG_PLUGINS_PATH . USER_INFO_TRACKING_ID . '/');
+define('USER_INFO_TRACKING_TABLE',   $prefixeTable . 'user_info_tracking');
+
+define('USER_INFO_TRACKING_TABLE2',   $prefixeTable . 'user_info_tracking');
+define('USER_INFO_TRACKING_TABLE3',   $prefixeTable . 'users');
+
+define('USER_INFO_TRACKING_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . USER_INFO_TRACKING_ID);
+define('USER_INFO_TRACKING_PUBLIC',  get_absolute_root_url() . make_index_url(array('section' => 'user_info_tracking')) . '/');
+define('USER_INFO_TRACKING_DIR',     PWG_LOCAL_DIR . 'user_info_tracking/');
+define('USER_INFO_TRACKING_VERSION', '1.0.0');
+// this is automatically updated by PEM if you publish your plugin with SVN, otherwise you musn't forget to change it, as well as "Version" in the plugin header
+
+
+// +-----------------------------------------------------------------------+
+// | Add event handlers                                                    |
+// +-----------------------------------------------------------------------+
+// init the plugin
+add_event_handler('init', 'user_info_tracking_init');
+
+if (defined('IN_ADMIN'))
+{
+  // admin plugins menu link
+  add_event_handler('get_admin_plugin_menu_links', 'user_info_tracking_admin_plugin_menu_links');
+  
+  // new tab on photo page
+//  add_event_handler('tabsheet_before_select', 'user_info_tracking_tabsheet_before_select', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
+  
+  // file containing all previous handlers functions
+  include_once(USER_INFO_TRACKING_PATH . 'include/admin_events.inc.php');
+}
+else
+{
+  
+  // file containing all previous handlers functions Look at the skeleton plugin for an example
+//  include_once(USER_INFO_TRACKING_PATH . 'include/public_events.inc.php');
+}
+
+
+// Successful Login - Logs Data into the Table
+// ---------------------------
+add_event_handler('login_success', 'ui_successfulLogin');
+
+// Failed Login - Logs Data into the Table
+// ---------------------------
+add_event_handler('login_failure', 'ui_failedLogin');
+
+// Logout - Logs Data into the Table
+// ---------------------------
+add_event_handler('logout', 'ui_logout');
+
+
+// add API function
+add_event_handler('ws_add_methods', 'skeleton_ws_add_methods');
+
+
+// files containing specific plugin functions
+include_once(USER_INFO_TRACKING_PATH . 'include/functions.inc.php');
+
+
+/**
+ * plugin initialization
+ *   - check for upgrades
+ *   - unserialize configuration
+ *   - load language
+ */
+function user_info_tracking_init()
+{
+  global $conf, $pwg_loaded_plugins;
+  
+  // apply upgrade if needed
+  if (
+    USER_INFO_TRACKING_VERSION == 'auto' or
+    $pwg_loaded_plugins[USER_INFO_TRACKING_ID]['version'] == 'auto' or
+    version_compare($pwg_loaded_plugins[USER_INFO_TRACKING_ID]['version'], USER_INFO_TRACKING_VERSION, '<')
+  )
+  {
+    // call install function
+    include_once(USER_INFO_TRACKING_PATH . 'include/install.inc.php');
+    user_info_tracking_install();
+    
+    // update plugin version in database
+    if ( $pwg_loaded_plugins[USER_INFO_TRACKING_ID]['version'] != 'auto' and USER_INFO_TRACKING_VERSION != 'auto' )
+    {
+      $query = '
+UPDATE '. PLUGINS_TABLE .'
+SET version = "'. USER_INFO_TRACKING_VERSION .'"
+WHERE id = "'. USER_INFO_TRACKING_ID .'"';
+      pwg_query($query);
+      
+      $pwg_loaded_plugins[USER_INFO_TRACKING_ID]['version'] = USER_INFO_TRACKING_VERSION;
+      
+      if (defined('IN_ADMIN'))
+      {
+        $_SESSION['page_infos'][] = 'User Info Tracking updated to version '. USER_INFO_TRACKING_VERSION;
+      }
+    }
+  }
+  
+  // load plugin language file
+  load_language('plugin.lang', USER_INFO_TRACKING_PATH);
+  
+  // prepare plugin configuration
+//  $conf['user_info_tracking'] = unserialize($conf['user_info_tracking']);
+}
+
+?>
Index: /extensions/User_Info_Tracking/maintain.inc.php
===================================================================
--- /extensions/User_Info_Tracking/maintain.inc.php	(revision 19700)
+++ /extensions/User_Info_Tracking/maintain.inc.php	(revision 19700)
@@ -0,0 +1,88 @@
+<?php
+defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
+
+defined('USER_INFO_TRACKING_ID') or define('USER_INFO_TRACKING_ID', basename(dirname(__FILE__)));
+include_once(PHPWG_PLUGINS_PATH . USER_INFO_TRACKING_ID . '/include/install.inc.php');
+
+/**
+ * plugin installation
+ *
+ * perform here all needed step for the plugin installation
+ * such as create default config, add database tables, 
+ * add fields to existing tables, create local folders...
+ */
+function plugin_install() 
+{
+  user_info_tracking_install();
+  define('user_info_tracking_installed', true);
+}
+
+/**
+ * plugin activation
+ *
+ * this function is triggered adter installation, by manual activation
+ * or after a plugin update
+ * for this last case you must manage updates tasks of your plugin in this function
+ */
+function plugin_activate()
+{
+  if (!defined('user_info_tracking_installed')) // a plugin is activated just after its installation
+  {
+    user_info_tracking_install();
+
+ 
+//This is in here just for now.  When I am done coding I will remove it.  
+     $user_info_tracking_default_config = serialize(array(
+      'uiPerPage' => 25,
+      'uiDefaultSortColumn' => timeStamp,
+      'uiDefaultSortOrder' => ASC,
+      'uiDateFormat' => '%c',
+      ));
+  
+    conf_update_param('user_info_tracking', $user_info_tracking_default_config);
+    $conf['user_info_tracking'] = $user_info_tracking_default_config;
+// End of Additional Code
+
+
+  }
+}
+
+/**
+ * plugin unactivation
+ *
+ * triggered before uninstallation or by manual unactivation
+ */
+function plugin_unactivate()
+{
+}
+
+/**
+ * plugin uninstallation
+ *
+ * perform here all cleaning tasks when the plugin is removed
+ * you should revert all changes made by plugin_install()
+ */
+function plugin_uninstall() 
+{
+  global $prefixeTable;
+  
+  // delete configuration
+  pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "user_info_tracking" LIMIT 1;');
+  
+  // delete table
+  pwg_query('DROP TABLE `'. $prefixeTable .'user_info_tracking`;');
+  
+  // delete field
+  pwg_query('ALTER `'. IMAGES_TABLE .'` DROP "user_info_tracking";');
+  
+  // delete local folder
+  $dir = PWG_LOCAL_DIR . 'user_info_tracking/';
+  foreach (scandir($dir) as $file)
+  {
+    if ($file == '.' or $file == '..') continue;
+    unlink($dir.$file);
+  }
+  rmdir($dir);
+}
+
+?>
