1 | <?php |
---|
2 | |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | function plugin_install() |
---|
6 | { |
---|
7 | global $prefixeTable; |
---|
8 | |
---|
9 | $q = 'CREATE TABLE ' . $prefixeTable . 'title( |
---|
10 | id SMALLINT( 5 ) UNSIGNED NOT NULL , |
---|
11 | page VARCHAR( 255 ) NOT NULL , |
---|
12 | title lONGTEXT NOT NULL , |
---|
13 | PRIMARY KEY (id))DEFAULT CHARSET=utf8;'; |
---|
14 | pwg_query($q); |
---|
15 | |
---|
16 | $q = ' |
---|
17 | INSERT INTO ' . $prefixeTable . 'title(id,page,title)VALUES (1,"home","");'; |
---|
18 | pwg_query($q); |
---|
19 | $q = ' |
---|
20 | INSERT INTO ' . $prefixeTable . 'title(id,page,title)VALUES (2,"best_rated","");'; |
---|
21 | pwg_query($q); |
---|
22 | $q = ' |
---|
23 | INSERT INTO ' . $prefixeTable . 'title(id,page,title)VALUES (3,"most_visited","");'; |
---|
24 | pwg_query($q); |
---|
25 | $q = ' |
---|
26 | INSERT INTO ' . $prefixeTable . 'title(id,page,title)VALUES (4,"recent_pics","");'; |
---|
27 | pwg_query($q); |
---|
28 | $q = ' |
---|
29 | INSERT INTO ' . $prefixeTable . 'title(id,page,title)VALUES (5,"recent_cats","");'; |
---|
30 | pwg_query($q); |
---|
31 | $q = ' |
---|
32 | INSERT INTO ' . $prefixeTable . 'title(id,page,title)VALUES (6,"favorites","");'; |
---|
33 | pwg_query($q); |
---|
34 | $q = ' |
---|
35 | INSERT INTO ' . $prefixeTable . 'title(id,page,title)VALUES (7,"tags","");'; |
---|
36 | pwg_query($q); |
---|
37 | $q = ' |
---|
38 | INSERT INTO ' . $prefixeTable . 'title(id,page,title)VALUES (8,"comments","");'; |
---|
39 | pwg_query($q); |
---|
40 | $q = ' |
---|
41 | INSERT INTO ' . $prefixeTable . 'title(id,page,title)VALUES (9,"about","");'; |
---|
42 | pwg_query($q); |
---|
43 | $q = ' |
---|
44 | INSERT INTO ' . $prefixeTable . 'title(id,page,title)VALUES (10,"search","");'; |
---|
45 | pwg_query($q); |
---|
46 | $q = ' |
---|
47 | INSERT INTO ' . $prefixeTable . 'title(id,page,title)VALUES (11,"random","");'; |
---|
48 | pwg_query($q); |
---|
49 | $q = ' |
---|
50 | INSERT INTO ' . $prefixeTable . 'title(id,page,title)VALUES (12,"notification","");'; |
---|
51 | pwg_query($q); |
---|
52 | |
---|
53 | if (!defined('TITLE_PHOTO_TABLE')) define('TITLE_PHOTO_TABLE', $prefixeTable.'title_photo'); |
---|
54 | $query = "CREATE TABLE IF NOT EXISTS ". TITLE_PHOTO_TABLE ." ( |
---|
55 | id SMALLINT( 5 ) UNSIGNED NOT NULL , |
---|
56 | title VARCHAR( 255 ) NOT NULL , |
---|
57 | PRIMARY KEY (id))DEFAULT CHARSET=utf8;"; |
---|
58 | $result = pwg_query($query); |
---|
59 | |
---|
60 | if (!defined('TITLE_ALBUM_TABLE')) define('TITLE_ALBUM_TABLE', $prefixeTable.'title_album'); |
---|
61 | $query = "CREATE TABLE IF NOT EXISTS ". TITLE_ALBUM_TABLE ." ( |
---|
62 | id SMALLINT( 5 ) UNSIGNED NOT NULL , |
---|
63 | title VARCHAR( 255 ) NOT NULL , |
---|
64 | PRIMARY KEY (id))DEFAULT CHARSET=utf8;"; |
---|
65 | $result = pwg_query($query); |
---|
66 | |
---|
67 | } |
---|
68 | |
---|
69 | function plugin_uninstall() |
---|
70 | { |
---|
71 | |
---|
72 | global $prefixeTable; |
---|
73 | |
---|
74 | $q = 'DROP TABLE ' . $prefixeTable . 'title;'; |
---|
75 | pwg_query($q); |
---|
76 | |
---|
77 | $q = 'DROP TABLE ' . $prefixeTable . 'title_photo;'; |
---|
78 | pwg_query($q); |
---|
79 | |
---|
80 | $q = 'DROP TABLE ' . $prefixeTable . 'title_album;'; |
---|
81 | pwg_query($q); |
---|
82 | } |
---|
83 | |
---|
84 | |
---|
85 | ?> |
---|