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