'EUR', ) ); } pwg_query(' CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'mps_product` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `order` int(20), `product` varchar(100) NOT NULL, `noteAdmin` varchar(255), `price` float NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;'); pwg_query(' CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'mps_prod_img` ( `image_id` MEDIUMINT (20) UNSIGNED NOT NULL, `product_id` MEDIUMINT (20) UNSIGNED NOT NULL, PRIMARY KEY (`product_id`,`image_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;'); pwg_query(' CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'mps_option` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(250) NOT NULL, `type` varchar(100) NOT NULL, `titre` varchar(200), `requi` int(10), `order` int(20), PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;'); pwg_query(' CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'mps_opt_val` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `val` varchar(100) NOT NULL, `select_id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;'); pwg_query(' CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'mps_prod_opt` ( `opt_id` MEDIUMINT (20) UNSIGNED NOT NULL, `product_id` MEDIUMINT (20) UNSIGNED NOT NULL, PRIMARY KEY (`product_id`,`opt_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;'); $this->installed = true; } /** * plugin activation */ function activate($plugin_version, &$errors=array()) { if (!$this->installed) { $this->install($plugin_version, $errors); } } /** * plugin deactivation */ function deactivate() { } /** * plugin uninstallation */ function uninstall() { global $prefixeTable; // delete table pwg_query('DROP TABLE `'. $prefixeTable .'mps_conf`;'); pwg_query('DROP TABLE `'. $prefixeTable .'mps_product`;'); pwg_query('DROP TABLE `'. $prefixeTable .'mps_prod_img`;'); pwg_query('DROP TABLE `'. $prefixeTable .'mps_option`;'); pwg_query('DROP TABLE `'. $prefixeTable .'mps_opt_val`;'); pwg_query('DROP TABLE `'. $prefixeTable .'mps_prod_opt`;'); } } function mps_get_tables() { global $prefixeTable; $tables = array(); $query = ' SHOW TABLES ;'; $result = pwg_query($query); while ($row = pwg_db_fetch_row($result)) { if (preg_match('/^'.$prefixeTable.'/', $row[0])) { array_push($tables, $row[0]); } } return $tables; }