コード例 #1
0
 public function __construct($createTables = false)
 {
     // create table?
     $this->createTables = $createTables;
     // 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');
     $this->addFieldDefinition(self::field_id, "INT(11) NOT NULL AUTO_INCREMENT", true);
     $this->addFieldDefinition(self::field_name, "VARCHAR(80) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_title, "VARCHAR(80) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_description, "TEXT NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_fields, "TEXT NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_must_fields, "TEXT NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_action, "VARCHAR(30) NOT NULL DEFAULT '" . self::action_none . "'");
     $this->addFieldDefinition(self::field_links, "VARCHAR(255) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_captcha, "TINYINT NOT NULL DEFAULT '" . self::captcha_on . "'");
     $this->addFieldDefinition(self::field_provider_id, "INT(11) NOT NULL DEFAULT '-1'");
     $this->addFieldDefinition(self::field_email_cc, "TEXT NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_email_html, "TINYINT NOT NULL DEFAULT '" . self::html_off . "'");
     $this->addFieldDefinition(self::field_status, "TINYINT NOT NULL DEFAULT '" . self::status_active . "'");
     $this->addFieldDefinition(self::field_timestamp, "TIMESTAMP");
     $this->setIndexFields(array(self::field_name));
     $this->checkFieldDefinitions();
     // Tabelle erstellen
     if ($this->createTables) {
         if (!$this->sqlTableExists()) {
             if (!$this->sqlCreateTable()) {
                 $this->setError(sprintf('[%s - %s] %s', __METHOD__, __LINE__, $this->getError()));
             }
         }
     }
     date_default_timezone_set(cfg_time_zone);
     if (class_exists('CAT_Helper_I18n')) {
         $lang = new CAT_Helper_I18n();
     } else {
         $lang = new LEPTON_Helper_I18n();
     }
     $this->action_array = array(self::action_login => $lang->translate('Login'), self::action_register => $lang->translate('Register'), self::action_send_password => $lang->translate('Forgotten password'), self::action_newsletter => $lang->translate('Subscribe/unsubribe Newsletter'), self::action_account => $lang->translate('Account'), self::action_logout => $lang->translate('Logout'), self::action_change_password => $lang->translate('Change password'));
     $this->status_array = array(self::status_active => $lang->translate('Active'), self::status_locked => $lang->translate('Locked'), self::status_deleted => $lang->translate('Deleted'));
     $this->captcha_array = array(self::captcha_on => $lang->translate('On'), self::captcha_off => $lang->translate('Off'));
     $this->html_array = array(self::html_on => $lang->translate('HTML Format'), self::html_off => $lang->translate('TEXT Format'));
 }
コード例 #2
0
        define('KIT_FORM_LANGUAGE', LANGUAGE);
    }
}
// load language depending onfiguration
if (!file_exists(WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/languages/' . LANGUAGE . '.cfg.php')) {
    require_once WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/languages/DE.cfg.php';
} else {
    require_once WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/languages/' . LANGUAGE . '.cfg.php';
}
require_once WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/class.form.php';
require_once WB_PATH . '/modules/kit_tools/class.droplets.php';
global $admin;
$error = '';
global $dbKITform;
if (!is_object($dbKITform)) {
    $dbKITform = new dbKITform();
}
if (!$dbKITform->sqlFieldExists(dbKITform::field_action)) {
    if (!$dbKITform->sqlAlterTableAddField(dbKITform::field_action, "VARCHAR(30) NOT NULL DEFAULT '" . dbKITform::action_none . "'")) {
        $error .= sprintf('[UPGRADE] %s', $dbKITform->getError());
    }
}
if (!$dbKITform->sqlFieldExists(dbKITform::field_links)) {
    if (!$dbKITform->sqlAlterTableAddField(dbKITform::field_links, "VARCHAR(255) NOT NULL DEFAULT ''")) {
        $error .= sprintf('[UPGRADE] %s', $dbKITform->getError());
    }
}
// Release 0.15 - add service provider and email cc
if (!$dbKITform->sqlFieldExists(dbKITform::field_provider_id)) {
    if (!$dbKITform->sqlAlterTableAddField(dbKITform::field_provider_id, "INT(11) NOT NULL DEFAULT '-1'", dbKITform::field_captcha)) {
        $error .= sprintf('[UPGRADE] %s', $dbKITform->getError());
コード例 #3
0
$tables = array('dbKITform', 'dbKITformData', 'dbKITformFields', 'dbKITformTableSort', 'dbKITformCommands');
$error = '';
foreach ($tables as $table) {
    $create = null;
    $create = new $table();
    if (!$create->sqlTableExists()) {
        if (!$create->sqlCreateTable()) {
            $error .= sprintf('[INSTALLATION %s] %s', $table, $create->getError());
        }
    }
}
// Standardformulare installieren
$message = '';
global $dbKITform;
if (!is_object($dbKITform)) {
    $dbKITform = new dbKITform();
}
if (!$dbKITform->installStandardForms($message)) {
    if ($dbKITform->isError()) {
        $error .= sprintf('[UPGRADE] %s', $dbKITform->getError());
    }
}
$message = strip_tags($message);
// Install Droplets
$droplets = new checkDroplets();
$droplets->droplet_path = WB_PATH . '/modules/kit_form/droplets/';
if ($droplets->insertDropletsIntoTable()) {
    $message .= $I18n->translate('The droplets for kitForm were successfully installed.\\n');
} else {
    $message .= $I18n->translate('Error installing the Droplets for kitForm:\\n{{ error }}\\n', array('error' => $droplets->getError()));
}