plugins/polls/sql/mysql_install.php
author Dirk Haun <dirk@haun-online.de>
Sat, 07 Nov 2009 18:45:37 +0100
branchHEAD
changeset 7454 b52c72b9844c
parent 7325 27d076900eaf
child 7556 3487f2c6465b
permissions -rw-r--r--
Set the default blockorder in steps of 10 and ensure that the blocks provided by the Calendar and Polls plugins are the last block on either side
     1 <?php
     2 
     3 /* Reminder: always indent with 4 spaces (no tabs). */
     4 // +---------------------------------------------------------------------------+
     5 // | Polls Plugin 2.1                                                          |
     6 // +---------------------------------------------------------------------------+
     7 // | mysql_install.php                                                         |
     8 // +---------------------------------------------------------------------------+
     9 // | Copyright (C) 2000-2009 by the following authors:                         |
    10 // |                                                                           |
    11 // | Authors: Tony Bibbs        - tony AT tonybibbs DOT com                    |
    12 // |          Mark Limburg      - mlimburg AT users DOT sourceforge DOT net    |
    13 // |          Jason Whittenburg - jwhitten AT securitygeeks DOT com            |
    14 // |          Dirk Haun         - dirk AT haun-online DOT de                   |
    15 // |          Trinity Bays      - trinity93 AT gmail DOT com                   |
    16 // +---------------------------------------------------------------------------+
    17 // |                                                                           |
    18 // | This program is licensed under the terms of the GNU General Public License|
    19 // | as published by the Free Software Foundation; either version 2            |
    20 // | of the License, or (at your option) any later version.                    |
    21 // |                                                                           |
    22 // | This program is distributed in the hope that it will be useful,           |
    23 // | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
    24 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                      |
    25 // | See the GNU General Public License for more details.                      |
    26 // |                                                                           |
    27 // | You should have received a copy of the GNU General Public License         |
    28 // | along with this program; if not, write to the Free Software Foundation,   |
    29 // | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
    30 // |                                                                           |
    31 // +---------------------------------------------------------------------------+
    32 
    33 /**
    34 * MySQL install data and tables
    35 *
    36 * @package Polls
    37 */
    38 
    39 $_SQL[] = "
    40 CREATE TABLE {$_TABLES['pollanswers']} (
    41   pid varchar(40) NOT NULL default '',
    42   qid mediumint(9) NOT NULL default 0,
    43   aid tinyint(3) unsigned NOT NULL default '0',
    44   answer varchar(255) default NULL,
    45   votes mediumint(8) unsigned default NULL,
    46   remark varchar(255) NULL,
    47   PRIMARY KEY (pid, qid, aid)
    48 ) TYPE=MyISAM
    49 ";
    50 
    51 $_SQL[] = "
    52 CREATE TABLE {$_TABLES['pollquestions']} (
    53   qid mediumint(9) NOT NULL DEFAULT '0',
    54   pid varchar(40) NOT NULL default '',
    55   question varchar(255) NOT NULL,
    56   PRIMARY KEY (qid, pid)
    57 ) TYPE=MyISAM
    58 ";
    59 
    60 $_SQL[] = "
    61 CREATE TABLE {$_TABLES['polltopics']} (
    62   pid varchar(40) NOT NULL default '',
    63   topic varchar(255) default NULL,
    64   meta_description TEXT NULL,
    65   meta_keywords TEXT NULL,    
    66   voters mediumint(8) unsigned default NULL,
    67   questions int(11) NOT NULL default '0',
    68   date datetime default NULL,
    69   display tinyint(4) NOT NULL default '0',
    70   is_open tinyint(1) NOT NULL default '1',
    71   hideresults tinyint(1) NOT NULL default '0',
    72   commentcode tinyint(4) NOT NULL default '0',
    73   statuscode tinyint(4) NOT NULL default '0',
    74   owner_id mediumint(8) unsigned NOT NULL default '1',
    75   group_id mediumint(8) unsigned NOT NULL default '1',
    76   perm_owner tinyint(1) unsigned NOT NULL default '3',
    77   perm_group tinyint(1) unsigned NOT NULL default '2',
    78   perm_members tinyint(1) unsigned NOT NULL default '2',
    79   perm_anon tinyint(1) unsigned NOT NULL default '2',
    80   INDEX pollquestions_qid(pid),
    81   INDEX pollquestions_date(date),
    82   INDEX pollquestions_display(display),
    83   INDEX pollquestions_commentcode(commentcode),
    84   INDEX pollquestions_statuscode(statuscode),
    85   PRIMARY KEY  (pid)
    86 ) TYPE=MyISAM
    87 ";
    88 
    89 $_SQL[] = "
    90 CREATE TABLE {$_TABLES['pollvoters']} (
    91   id int(10) unsigned NOT NULL auto_increment,
    92   pid varchar(20) NOT NULL,
    93   ipaddress varchar(15) NOT NULL default '',
    94   date int(10) unsigned default NULL,
    95   PRIMARY KEY  (id)
    96 ) TYPE=MyISAM
    97 ";
    98 
    99 $_SQL[] = "INSERT INTO {$_TABLES['blocks']} (is_enabled, name, type, title, tid, blockorder, content, onleft, phpblockfn, owner_id, group_id, perm_owner, perm_group) VALUES (1,'polls_block','phpblock','Poll','all',100,'',0,'phpblock_polls',{$_USER['uid']},#group#,3,3)";
   100 
   101 
   102 // default poll
   103 
   104 $DEFVALUES[] = "INSERT INTO {$_TABLES['polltopics']} (pid, topic, meta_description, meta_keywords, voters, questions, date, display, is_open, hideresults, commentcode, statuscode, owner_id, group_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('geeklogfeaturepoll', 'Tell us your opinion about Geeklog', 'A poll about users opinions of Geeklog.', 'Poll, Geeklog, Opinion', 0, 2, NOW(), 1, 1, 1, 0, 0, {$_USER['uid']}, #group#, 3, 2, 2, 2);";
   105 
   106 $DEFVALUES[] = "INSERT INTO {$_TABLES['pollquestions']} (qid, pid, question) VALUES (0, 'geeklogfeaturepoll', 'What is the best new feature of Geeklog?');";
   107 $DEFVALUES[] = "INSERT INTO {$_TABLES['pollquestions']} (qid, pid, question) VALUES (1, 'geeklogfeaturepoll', 'What is the all-time best feature of Geeklog?');";
   108 
   109 $DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 1, 'Improved Search', 0, '');";
   110 $DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 2, 'Comment Improvements', 0, '');";
   111 $DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 3, 'Site Migration', 0, '');";
   112 $DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 4, 'Plugin Upload', 0, '');";
   113 $DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 5, 'XMLSitemap Plugin', 0, '');";
   114 $DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 6, 'Other', 0, '');";
   115 
   116 $DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 1, 'Permissions Handling', 0, '');";
   117 $DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 2, 'Spam Protection', 0, '');";
   118 $DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 3, 'Focus on Security', 0, '');";
   119 $DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 4, 'Plugin Availability', 0, '');";
   120 $DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 5, 'The Community', 0, '');";
   121 
   122 ?>