public function __construct($create_tables = false) { $this->create_tables = $create_tables; // use another table prefix? if (file_exists(LEPTON_PATH . '/modules/' . basename(dirname(__FILE__)) . '/config.json')) { $config = json_decode(file_get_contents(LEPTON_PATH . '/modules/' . basename(dirname(__FILE__)) . '/config.json'), true); if (isset($config['table_prefix'])) { self::$table_prefix = $config['table_prefix']; } } parent::__construct(); $this->setTablePrefix(self::$table_prefix); $this->setTableName('mod_kit_form_data'); $this->addFieldDefinition(self::field_id, "INT(11) NOT NULL AUTO_INCREMENT", true); $this->addFieldDefinition(self::field_form_id, "INT(11) NOT NULL DEFAULT '-1'"); $this->addFieldDefinition(self::field_kit_id, "INT(11) NOT NULL DEFAULT '-1'"); $this->addFieldDefinition(self::field_date, "DATETIME"); $this->addFieldDefinition(self::field_fields, "TEXT NOT NULL DEFAULT ''"); $this->addFieldDefinition(self::field_values, "MEDIUMTEXT NOT NULL DEFAULT ''"); $this->addFieldDefinition(self::field_status, "TINYINT NOT NULL DEFAULT '" . self::status_active . "'"); $this->addFieldDefinition(self::field_timestamp, "TIMESTAMP"); $this->setIndexFields(array(self::field_form_id, self::field_kit_id)); $this->checkFieldDefinitions(); if ($this->create_tables) { if (!$this->sqlTableExists()) { if (!$this->sqlCreateTable()) { $this->setError(sprintf('[%s - %s] %s', __METHOD__, __LINE__, $this->getError())); return false; } } } date_default_timezone_set(cfg_time_zone); }
} } // Release 0.21 global $dbKITformCommands; if (!is_object($dbKITformCommands)) { $dbKITformCommands = new dbKITformCommands(); } if (!$dbKITformCommands->sqlTableExists()) { if (!$dbKITformCommands->sqlCreateTable()) { $error .= sprintf('[UPGRADE] %s', $dbKITformCommands->getError()); } } // Release 0.26 global $dbKITformData; if (!is_object($dbKITformData)) { $dbKITformData = new dbKITformData(); } if (!$dbKITformData->sqlFieldExists(dbKITformData::field_status)) { if (!$dbKITformData->sqlAlterTableAddField(dbKITformData::field_status, "TINYINT NOT NULL DEFAULT '" . dbKITformData::status_active . "'", dbKITformData::field_values)) { $error .= sprintf('[UPGRADE] %s', $dbKITformData->getError()); } } // Formulare installieren $message = ''; if (!$dbKITform->installStandardForms($message)) { if ($dbKITform->isError()) { $error .= sprintf('[UPGRADE] %s', $dbKITform->getError()); } } if (!empty($message)) { echo '<script language="javascript">alert ("' . $message . '");</script>';