1 | <?php |
---|
2 | |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | function plugin_install() |
---|
6 | { |
---|
7 | global $conf, $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 | if (empty($conf['contacttitle'])) |
---|
68 | { |
---|
69 | conf_update_param('contacttitle', ''); |
---|
70 | } |
---|
71 | |
---|
72 | |
---|
73 | if (!defined('TITLE_AP_TABLE')) define('TITLE_AP_TABLE', $prefixeTable.'title_ap'); |
---|
74 | $query = "CREATE TABLE IF NOT EXISTS ". TITLE_AP_TABLE ." ( |
---|
75 | id SMALLINT( 5 ) UNSIGNED NOT NULL , |
---|
76 | title VARCHAR( 255 ) NOT NULL , |
---|
77 | PRIMARY KEY (id))DEFAULT CHARSET=utf8;"; |
---|
78 | $result = pwg_query($query); |
---|
79 | |
---|
80 | } |
---|
81 | |
---|
82 | function plugin_activate() |
---|
83 | { |
---|
84 | global $conf, $prefixeTable; |
---|
85 | if (!isset($conf['contacttitle'])) |
---|
86 | { |
---|
87 | conf_update_param('contacttitle', ''); |
---|
88 | } |
---|
89 | |
---|
90 | if (!defined('TITLE_AP_TABLE')) define('TITLE_AP_TABLE', $prefixeTable.'title_ap'); |
---|
91 | $query = "CREATE TABLE IF NOT EXISTS ". TITLE_AP_TABLE ." ( |
---|
92 | id SMALLINT( 5 ) UNSIGNED NOT NULL , |
---|
93 | title VARCHAR( 255 ) NOT NULL , |
---|
94 | PRIMARY KEY (id))DEFAULT CHARSET=utf8;"; |
---|
95 | $result = pwg_query($query); |
---|
96 | |
---|
97 | } |
---|
98 | |
---|
99 | function plugin_uninstall() |
---|
100 | { |
---|
101 | |
---|
102 | global $prefixeTable; |
---|
103 | |
---|
104 | $q = 'DROP TABLE ' . $prefixeTable . 'title;'; |
---|
105 | pwg_query($q); |
---|
106 | |
---|
107 | $q = 'DROP TABLE ' . $prefixeTable . 'title_photo;'; |
---|
108 | pwg_query($q); |
---|
109 | |
---|
110 | $q = 'DROP TABLE ' . $prefixeTable . 'title_album;'; |
---|
111 | pwg_query($q); |
---|
112 | |
---|
113 | $q = 'DROP TABLE ' . $prefixeTable . 'title_ap;'; |
---|
114 | pwg_query($q); |
---|
115 | |
---|
116 | conf_delete_param('contacttitle'); |
---|
117 | |
---|
118 | } |
---|
119 | |
---|
120 | |
---|
121 | ?> |
---|