/[drupal]/contributions/modules/nf_handshake/nf_handshake.install
ViewVC logotype

Contents of /contributions/modules/nf_handshake/nf_handshake.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (show annotations) (download) (as text)
Thu Nov 29 07:21:32 2007 UTC (23 months, 4 weeks ago) by rconstantine
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +0 -0 lines
File MIME type: text/x-php
#193325 fixed it so user 1 and other admins can engage in handshakes - i.e. the checkboxes work correctly now

also we now react to user deletion and remove handshakes from our tables - you may need to clean your tables by hand as I didn't include a retroactive cleaning function

added css IDs to inbox and outbox and included a css file

added ability to include email address and picture from standard user profile as exchangable data - this was a pain in the butt! so if anyone wants to add other items from the users table, be my guest to roll a patch.
1 <?php
2 /**
3 * $Id$
4 * @package Handshake
5 * @category NeighborForge
6 */
7
8 /**
9 * Implementation of hook_install().
10 */
11 function nf_handshake_install() {
12 switch ($GLOBALS['db_type']) {
13 case 'mysql':
14 case 'mysqli':
15 $query1 = db_query("CREATE TABLE {nf_handshake} (
16 iuid int(10) unsigned NOT NULL default '0',
17 auid int(10) unsigned NOT NULL default '0',
18 hstatus varchar(8) NOT NULL default '',
19 hfields longtext NOT NULL default '',
20 datestamp int(11) default NULL,
21 duration int(11) default NULL,
22 flags int(3) NOT NULL default '0',
23 PRIMARY KEY (iuid, auid)
24 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
25 $query2 = db_query("CREATE TABLE {nf_handshake_manage} (
26 iuid int(10) unsigned NOT NULL default '0',
27 auid int(10) unsigned NOT NULL default '0',
28 purpose longtext NOT NULL default '',
29 userflag int(3) NOT NULL default '0',
30 adminflag int(3) NOT NULL default '0',
31 initialdate int(11) default NULL,
32 userflagexplain varchar(255) NOT NULL default '',
33 adminnotes longtext NOT NULL default '',
34 iuidmessages longtext NOT NULL default '',
35 auidmessages longtext NOT NULL default '',
36 PRIMARY KEY (iuid, auid)
37 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
38 break;
39 case 'pgsql':
40 //I don't really know what I'm doing here, so if I screwed up the pgsql, let me know how to fix it.
41 $query1 = db_query("CREATE TABLE {nf_handshake} (
42 iuid int(10) unsigned NOT NULL default '0',
43 auid int(10) unsigned NOT NULL default '0',
44 hstatus varchar(8) NOT NULL default '',
45 hfields longtext NOT NULL default '',
46 datestamp int(11) default NULL,
47 duration int(11) default NULL,
48 flags int(3) NOT NULL default '0',
49 PRIMARY KEY (iuid, auid)
50 )");
51 $query2 = db_query("CREATE TABLE {nf_handshake_manage} (
52 iuid int(10) unsigned NOT NULL default '0',
53 auid int(10) unsigned NOT NULL default '0',
54 purpose longtext NOT NULL default '',
55 userflag int(3) NOT NULL default '0',
56 adminflag int(3) NOT NULL default '0',
57 initialdate int(11) default NULL,
58 userflagexplain varchar(255) NOT NULL default '',
59 adminnotes longtext NOT NULL default '',
60 iuidmessages longtext NOT NULL default '',
61 auidmessages longtext NOT NULL default '',
62 PRIMARY KEY (iuid, auid)
63 )");
64 break;
65 }
66
67 if ($query1 && $query2) {
68 drupal_set_message('The Handshake module was installed successfully. Tables were added to the database.');
69 }
70 else {
71 drupal_set_message('There was an error installing the Handshake database tables.', 'error');
72 }
73 } // function nf_handshake_install()
74
75 /**
76 * Implementation of hook_uninstall().
77 */
78 function nf_handshake_uninstall() {
79 $query1 = db_query('DROP TABLE {nf_handshake}');
80 $query2 = db_query('DROP TABLE {nf_handshake_manage}');
81 $vardel1 = FALSE;
82 $vardel2 = FALSE;
83 $vardel3 = FALSE;
84 if(variable_del('nf_handshake_cckfieldnames')) {
85 $vardel1 = TRUE;
86 }
87 if(variable_del('nf_handshake_groupnames')) {
88 $vardel2 = TRUE;
89 }
90 if(variable_del('nf_handshake_settings')) {
91 $vardel3 = TRUE;
92 }
93 if ($query1 && $query2 && $vardel1 && $vardel2 && $vardel3) {
94 drupal_set_message('The Handshake module was uninstalled successfully.');
95 }
96 elseif (!$query1 || !$query2) {
97 drupal_set_message('There was an error removing the Handshake database tables.', 'error');
98 }
99 elseif (!$vardel1) {
100 drupal_set_message('There was an error removing the Handshake variable: nf_handshake_cckfieldnames.', 'error');
101 }
102 elseif (!$vardel2) {
103 drupal_set_message('There was an error removing the Handshake variable: nf_handshake_groupnames.', 'error');
104 }
105 elseif (!$vardel3) {
106 drupal_set_message('There was an error removing the Handshake variable: nf_handshake_settings.', 'error');
107 }
108
109 } // function nf_handshake_uninstall()

  ViewVC Help
Powered by ViewVC 1.1.2