Ticket #1891: contact_us.php

File contact_us.php, 3.9 KB (added by Volker Strähle, 5 years ago)
Line 
1<?php
2/* -----------------------------------------------------------------------------------------
3 $Id: contact_us.php 11599 2019-03-21 16:05:39Z GTB $
4
5 modified eCommerce Shopsoftware
6 http://www.modified-shop.org
7
8 Copyright (c) 2009 - 2013 [www.modified-shop.org]
9 -----------------------------------------------------------------------------------------
10 Released under the GNU General Public License
11 ---------------------------------------------------------------------------------------*/
12
13defined( '_VALID_XTC' ) or die( 'Direct Access to this location is not allowed.' );
14
15class contact_us
16{
17 var $code, $title, $description, $enabled;
18
19 function __construct()
20 {
21 $this->code = 'contact_us';
22 $this->title = MODULE_CONTACT_US_TEXT_TITLE;
23 $this->description = MODULE_CONTACT_US_TEXT_DESCRIPTION;
24 $this->sort_order = ((defined('MODULE_CONTACT_US_SORT_ORDER')) ? MODULE_CONTACT_US_SORT_ORDER : '');
25 $this->enabled = ((defined('MODULE_CONTACT_US_STATUS') && MODULE_CONTACT_US_STATUS == 'true') ? true : false);
26
27 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
28 $this->deleteData = false; // set default for uninstall. true will delete data by default
29 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
30 }
31
32 function process($file)
33 {
34 //do nothing
35 }
36
37 function display()
38 {
39 return array('text' => '<br>' . xtc_button(BUTTON_SAVE) . '&nbsp;' .
40 xtc_button_link(BUTTON_CANCEL, xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $_GET['set'] . '&module='.$this->code))
41 );
42 }
43
44 function check()
45 {
46 if(!isset($this->_check)) {
47 $check_query = xtc_db_query("SELECT configuration_value FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_CONTACT_US_STATUS'");
48 $this->_check = xtc_db_num_rows($check_query);
49 }
50 return $this->_check;
51 }
52
53 function install()
54 {
55 xtc_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_CONTACT_US_STATUS', 'false', '6', '1', 'xtc_cfg_select_option(array(\'true\', \'false\'), ', now())");
56 xtc_db_query("CREATE TABLE IF NOT EXISTS `contact_us_log` (
57 `customers_id` int(11) NOT NULL,
58 `customers_name` varchar(128) NOT NULL,
59 `customers_email_address` varchar(255) NOT NULL,
60 `customers_ip` varchar(50) NOT NULL,
61 `date_added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
62 KEY `idx_customers_id` (`customers_id`)
63 );");
64 }
65
66
67 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
68 function remove()
69 {
70 if (property_exists ($this, 'deleteData'))
71 {
72 if ((isset($_POST['deleteData'])) && ($_POST['deleteData'] == 'deleteData'))
73 {
74 // drop tables, delete columns, delete configuations
75 xtc_db_query("DROP TABLE contact_us_log");
76 xtc_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key LIKE 'MODULE_CONTACT_US_%'");
77 }else{
78 // keep data, remove only module and unecessary things
79 xtc_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key LIKE 'MODULE_CONTACT_US_%'");
80 }
81
82 }else{
83 // keep data, remove only module and unecessary things
84 xtc_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key LIKE 'MODULE_CONTACT_US_%'");
85 }
86
87 }
88 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
89
90 function keys()
91 {
92 return array('MODULE_CONTACT_US_STATUS');
93 }
94}
95?>