source: extensions/manage_properties_photos/maintain.class.php @ 30702

Last change on this file since 30702 was 30702, checked in by ddtddt, 10 years ago

[extensions] - manage_properties_photos -beta 4

File size: 3.2 KB
Line 
1<?php
2defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
3
4class manage_properties_photos_maintain extends PluginMaintain
5{
6  private $installed = false;
7
8  function __construct($plugin_id){
9    parent::__construct($plugin_id);
10  }
11
12  function install($plugin_version, &$errors=array()){
13       global $prefixeTable;
14
15if (!defined('ADD_PROP_PHOTO_TABLE')) define('ADD_PROP_PHOTO_TABLE', $prefixeTable.'add_properties_photos');
16        $query = "CREATE TABLE IF NOT EXISTS ". ADD_PROP_PHOTO_TABLE ." (
17id_prop_pho SMALLINT(5) UNSIGNED NOT NULL auto_increment,
18wording VARCHAR(255) NOT NULL ,
19orderprop SMALLINT(5) UNSIGNED NOT NULL ,
20active SMALLINT(5) UNSIGNED NOT NULL ,
21edit SMALLINT(5) UNSIGNED NOT NULL ,
22PRIMARY KEY (id_prop_pho))DEFAULT CHARSET=utf8;";
23        $result = pwg_query($query);
24
25if (!defined('ADD_PROP_PHOTO_DATA_TABLE')) define('ADD_PROP_PHOTO_DATA_TABLE', $prefixeTable.'add_properties_photos_data');
26        $query = "CREATE TABLE IF NOT EXISTS ". ADD_PROP_PHOTO_DATA_TABLE ." (
27id_img SMALLINT(5) UNSIGNED NOT NULL ,
28id_prop_pho SMALLINT(5) UNSIGNED NOT NULL ,
29data VARCHAR(255) NOT NULL ,
30PRIMARY KEY (id_img,id_prop_pho))DEFAULT CHARSET=utf8;";
31        $result = pwg_query($query);
32       
33$q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (1,"author",1,0,0);';
34    pwg_query($q);
35$q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (2,"Created on",2,0,0);';
36    pwg_query($q);
37$q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (3,"Posted on",3,0,0);';
38    pwg_query($q);
39$q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (4,"Dimensions",4,0,0);';
40    pwg_query($q);   
41$q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (5,"File",5,0,0);';
42    pwg_query($q);         
43$q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (6,"Filesize",6,0,0);';
44    pwg_query($q);
45$q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (7,"Tags",7,0,0);';
46    pwg_query($q);   
47$q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (8,"Albums",8,0,0);';
48    pwg_query($q);     
49$q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (9,"Visits",9,0,0);';
50    pwg_query($q);       
51$q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (10,"Average",10,0,0);';
52    pwg_query($q);
53$q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (11,"Who can see this photo?",11,0,0);';
54    pwg_query($q); 
55   
56  }
57
58  function activate($plugin_version, &$errors=array()){
59 
60  }
61
62  function update($old_version, $new_version, &$errors=array()){
63
64  }
65 
66  function deactivate(){
67  }
68
69  function uninstall(){
70    $q = 'DROP TABLE ' . $prefixeTable . 'add_properties_photos;';
71    pwg_query($q);
72    $q = 'DROP TABLE ' . $prefixeTable . 'add_properties_photos_data;';
73    pwg_query($q);
74  }
75}
76?>
Note: See TracBrowser for help on using the repository browser.