| 1 |
<?php
|
| 2 |
// $Id: loginticket.install,v 1.1.2.3 2007/11/08 04:08:28 jpetso Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Login Ticket API: Provides functions for generating login tickets.
|
| 7 |
*
|
| 8 |
* A login ticket consists of an automatically generated pass code,
|
| 9 |
* an expiration date, and a user who may log in with the pass code.
|
| 10 |
* This module provides functions for generating, retrieving and
|
| 11 |
* deleting login tickets, as well as checking validness of a given
|
| 12 |
* pass code and, given a valid code (while not requiring username
|
| 13 |
* and password), logging the concerned user in.
|
| 14 |
*/
|
| 15 |
|
| 16 |
/**
|
| 17 |
* Implementation of hook_schema().
|
| 18 |
*/
|
| 19 |
function loginticket_schema() {
|
| 20 |
$schema['loginticket'] = array(
|
| 21 |
'description' => t('TODO'),
|
| 22 |
'fields' => array(
|
| 23 |
'ticket_id' => array(
|
| 24 |
'description' => t('TODO'),
|
| 25 |
'type' => 'serial',
|
| 26 |
'unsigned' => 1,
|
| 27 |
'not null' => TRUE,
|
| 28 |
),
|
| 29 |
'passcode_md5' => array(
|
| 30 |
'description' => t('TODO'),
|
| 31 |
'type' => 'char',
|
| 32 |
'length' => '32',
|
| 33 |
'not null' => TRUE,
|
| 34 |
),
|
| 35 |
'purpose' => array(
|
| 36 |
'description' => t('TODO'),
|
| 37 |
'type' => 'varchar',
|
| 38 |
'length' => 32,
|
| 39 |
'not null' => TRUE,
|
| 40 |
'default' => '',
|
| 41 |
),
|
| 42 |
'expires' => array(
|
| 43 |
'description' => t('TODO'),
|
| 44 |
'type' => 'int',
|
| 45 |
'not null' => TRUE,
|
| 46 |
'default' => 0,
|
| 47 |
),
|
| 48 |
'uid' => array(
|
| 49 |
'description' => t('TODO'),
|
| 50 |
'type' => 'int',
|
| 51 |
'unsigned' => 1,
|
| 52 |
'not null' => TRUE,
|
| 53 |
'default' => 0,
|
| 54 |
),
|
| 55 |
),
|
| 56 |
'indexes' => array(
|
| 57 |
'uid' => array('uid'),
|
| 58 |
),
|
| 59 |
'unique keys' => array(
|
| 60 |
'passcode_md5' => array('passcode_md5'),
|
| 61 |
),
|
| 62 |
'primary key' => array('ticket_id'),
|
| 63 |
);
|
| 64 |
|
| 65 |
return $schema;
|
| 66 |
}
|
| 67 |
|
| 68 |
/**
|
| 69 |
* Login Ticket API - Facilities for other modules to let people log in
|
| 70 |
* as Drupal user as long as their login ticket is valid.
|
| 71 |
*
|
| 72 |
* Copyright 2006 by D R Pratten <http://www.davidpratten.com>
|
| 73 |
* Copyright 2007 by Jakob Petsovits <jpetso@gmx.at>
|
| 74 |
* Distributed under the GNU General Public Licence version 2 or higher,
|
| 75 |
* as published by the FSF on http://www.gnu.org/copyleft/gpl.html
|
| 76 |
*/
|
| 77 |
|
| 78 |
/**
|
| 79 |
* Implementation of hook_install().
|
| 80 |
*/
|
| 81 |
function loginticket_install() {
|
| 82 |
// Create tables.
|
| 83 |
drupal_install_schema('loginticket');
|
| 84 |
}
|
| 85 |
|
| 86 |
function loginticket_uninstall() {
|
| 87 |
include_once(drupal_get_filename('module', 'loginticket'));
|
| 88 |
|
| 89 |
// delete each ticket seperately in order to call the delete hooks
|
| 90 |
$tickets = loginticket_load_array('<all>', array(), TRUE);
|
| 91 |
if ($tickets) {
|
| 92 |
loginticket_delete($tickets);
|
| 93 |
}
|
| 94 |
|
| 95 |
// Remove tables.
|
| 96 |
drupal_uninstall_schema('loginticket');
|
| 97 |
}
|
| 98 |
|
| 99 |
|
| 100 |
/**
|
| 101 |
* Implementation of hook_update_1().
|
| 102 |
*/
|