source: extensions/Download_Multi/maintain.inc.php @ 4974

Last change on this file since 4974 was 3986, checked in by flipflip, 15 years ago

Initial Import

File size: 3.6 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Mod Name : Download_multi                                             |
4// | Mod Version : 0.9-1                                                   |
5// | Mod Orignal author: Tboris                                            |
6// | Mod Second author : Cestlodovic                                       |
7// | Mod Version author : FlipFlip <flipflip@free.fr>                      |
8// | Mod description :                                                     |
9// | Ce module est base sur le module existant pour le telechargement,     |
10// | cette version permet le telechargement sur plusieurs pages.           |
11// +-----------------------------------------------------------------------+
12// | This program is free software; you can redistribute it and/or modify  |
13// | it under the terms of the GNU General Public License as published by  |
14// | the Free Software Foundation                                          |
15// |                                                                       |
16// | This program is distributed in the hope that it will be useful, but   |
17// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
18// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
19// | General Public License for more details.                              |
20// |                                                                       |
21// | You should have received a copy of the GNU General Public License     |
22// | along with this program; if not, write to the Free Software           |
23// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
24// | USA.                                                                  |
25// +-----------------------------------------------------------------------+
26
27
28if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
29defined('DM_DIR') || define('DM_DIR' , basename(dirname(__FILE__)));
30defined('DM_PATH') || define('DM_PATH' , PHPWG_PLUGINS_PATH . DM_DIR . '/');
31
32global $lang;
33
34load_language('plugin.lang', DM_PATH);
35
36function plugin_install($plugin_id, $plugin_version, &$errors) {
37  global $prefixeTable;
38
39  if(!class_exists('zipArchive')) {
40        array_push($errors, l10n('dl_class_exist'));
41  }
42 
43  list($mysql_version) = mysql_fetch_row(pwg_query('SELECT VERSION();'));
44
45  if (version_compare($mysql_version, '4.1', '<')) {
46    array_push($errors, l10n('dl_mysql_version'));
47  } else if (version_compare(phpversion(), '5.0.0', '<')) {
48        array_push($errors, l10n('dl_php_version'));
49  } else {
50    $query = '
51      CREATE TABLE IF NOT EXISTS `'.$prefixeTable.'download_multi` (
52        `id_image` mediumint(8) NOT NULL default \'0\',
53        `id_user` smallint(5) NOT NULL default \'0\',
54        `type` enum(\'t\',\'n\',\'h\') NOT NULL default \'t\',
55        `filesize` int(10) unsigned NOT NULL default \'0\',
56        UNIQUE KEY Index_1 (`id_image`,`id_user`,`type`)
57      ) ENGINE=MyISAM COMMENT=\'Gestion des telechargement sur plusieurs pages\';
58    ';
59    pwg_query($query);
60  }
61}
62
63function plugin_activate($plugin_id, $plugin_version, &$errors) {
64}
65
66function plugin_deactivate($plugin_id) {
67  global $prefixeTable;
68 
69  $query = '
70    DELETE FROM '.CONFIG_TABLE.'
71    WHERE param=\'downloadmulti_config\'';
72
73  pwg_query($query);
74}
75
76function plugin_uninstall($plugin_id) {
77  global $prefixeTable;
78
79  $query = '
80    DELETE FROM '.CONFIG_TABLE.'
81    WHERE param=\'downloadmulti_config\'';
82
83  pwg_query($query);
84
85  $query = 'DROP TABLE IF EXISTS `'.$prefixeTable.'download_multi`;';
86  pwg_query($query);
87}
88?>
Note: See TracBrowser for help on using the repository browser.