Ejemplo n.º 1
0
}
// end include class.secure.php
define('KIT_INSTALL_RUNNING', true);
require_once WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/initialize.php';
require_once WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/class.mail.php';
require_once WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/class.newsletter.php';
require_once WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/class.cronjob.php';
global $admin;
global $database;
$error = '';
// first install configuration table!
$dbConfig = new dbKITcfg(true);
if ($dbConfig->isError()) {
    $error .= sprintf('<p>[Installation] %s</p>', $dbConfig->getError());
}
$dbKITcontact = new dbKITcontact(true);
if ($dbKITcontact->isError()) {
    $error .= sprintf('<p>[Installation] %s</p>', $dbKITcontact->getError());
}
$dbKITcontactAddress = new dbKITcontactAddress(true);
if ($dbKITcontactAddress->isError()) {
    $error .= sprintf('<p>[Installation] %s</p>', $dbKITcontactAddress->getError());
}
$dbKITprovider = new dbKITprovider(true);
if ($dbKITprovider->isError()) {
    $error .= sprintf('<p>[Installation] %s</p>', $dbKITprovider->getError());
}
$dbKITmail = new dbKITmail(true);
if ($dbKITmail->isError()) {
    $error .= sprintf('<p>[Installation] %s</p>', $dbKITmail->getError());
}
 /**
  * Constructor for dbContact
  * @param bool $create_tables
  */
 public function __construct($create_tables = false)
 {
     $this->create_tables = $create_tables;
     // use another table prefix?
     if (file_exists(WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/config.json')) {
         $config = json_decode(file_get_contents(WB_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_contact');
     $this->addFieldDefinition(self::field_id, "INT NOT NULL AUTO_INCREMENT", true);
     $this->addFieldDefinition(self::field_type, "VARCHAR(30) NOT NULL DEFAULT '" . self::type_person . "'");
     $this->addFieldDefinition(self::field_access, "VARCHAR(30) NOT NULL DEFAULT '" . self::access_internal . "'");
     $this->addFieldDefinition(self::field_status, "VARCHAR(30) NOT NULL DEFAULT '" . self::status_active . "'");
     $this->addFieldDefinition(self::field_contact_identifier, "VARCHAR(50) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_company_title, "VARCHAR(30) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_company_name, "VARCHAR(50) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_company_department, "VARCHAR(50) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_company_additional, "VARCHAR(50) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_person_title, "VARCHAR(30) NOT NULL DEFAULT '0'");
     $this->addFieldDefinition(self::field_person_title_academic, "VARCHAR(30) NOT NULL DEFAULT '0'");
     $this->addFieldDefinition(self::field_person_first_name, "VARCHAR(50) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_person_last_name, "VARCHAR(50) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_person_function, "VARCHAR(50) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_address, "VARCHAR(20) NOT NULL DEFAULT '-1'");
     $this->addFieldDefinition(self::field_address_standard, "INT NOT NULL DEFAULT '-1'");
     $this->addFieldDefinition(self::field_category, "VARCHAR(255) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_newsletter, "VARCHAR(255) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_distribution, "VARCHAR(255) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_internet, "TEXT NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_phone, "TEXT NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_phone_standard, "INT NOT NULL DEFAULT '-1'");
     $this->addFieldDefinition(self::field_email, "TEXT NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_email_standard, "INT NOT NULL DEFAULT '-1'");
     $this->addFieldDefinition(self::field_birthday, "VARCHAR(20) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_contact_since, "VARCHAR(20) NOT NULL DEFAULT ''");
     $this->addFieldDefinition(self::field_contact_note, "INT NOT NULL DEFAULT '-1'");
     $this->addFieldDefinition(self::field_contact_language, "VARCHAR(2) NOT NULL DEFAULT 'en'");
     $this->addFieldDefinition(self::field_free_1, "INT NOT NULL DEFAULT '-1'");
     $this->addFieldDefinition(self::field_free_2, "INT NOT NULL DEFAULT '-1'");
     $this->addFieldDefinition(self::field_free_3, "INT NOT NULL DEFAULT '-1'");
     $this->addFieldDefinition(self::field_free_4, "INT NOT NULL DEFAULT '-1'");
     $this->addFieldDefinition(self::field_free_5, "INT NOT NULL DEFAULT '-1'");
     $this->addFieldDefinition(self::field_free_note_1, "INT NOT NULL DEFAULT '-1'");
     $this->addFieldDefinition(self::field_free_note_2, "INT NOT NULL DEFAULT '-1'");
     $this->addFieldDefinition(self::field_picture_id, "INT NOT NULL DEFAULT '-1'");
     $this->addFieldDefinition(self::field_update_by, "VARCHAR(30) NOT NULL DEFAULT 'SYSTEM'");
     $this->addFieldDefinition(self::field_update_when, "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'");
     // check field definitions
     $this->checkFieldDefinitions();
     // set default timezone
     date_default_timezone_set(CFG_TIME_ZONE);
     // create tables
     if ($this->create_tables) {
         $this->initTables();
     }
     if (!defined('KIT_INSTALL_RUNNING')) {
         // init arrays
         $this->initArrays();
         // balance WB users...
         $this->checkWBusers();
     }
 }
Ejemplo n.º 3
0
global $database;
global $admin;
$error = '';
$dbKITregister = new dbKITregister();
if (!$dbKITregister->sqlTableExists()) {
    if (!$dbKITregister->sqlCreateTable()) {
        $error .= sprintf('<p>[Upgrade] %s </p>', $dbKITregister->getError());
    }
}
$dbKITprovider = new dbKITprovider();
if (!$dbKITprovider->sqlFieldExists(dbKITprovider::field_identifier)) {
    if (!$dbKITprovider->sqlAlterTableAddField(dbKITprovider::field_identifier, "VARCHAR (50) NOT NULL DEFAULT ''", dbKITprovider::field_name)) {
        $error .= sprintf('<p>[Upgrade] %s </p>', $dbKITprovider->getError());
    }
}
$dbKITcontact = new dbKITcontact();
if (!$dbKITcontact->sqlFieldExists(dbKITcontact::field_newsletter)) {
    if (!$dbKITcontact->sqlAlterTableAddField(dbKITcontact::field_newsletter, "VARCHAR (255) NOT NULL DEFAULT ''", dbKITcontact::field_category)) {
        $error .= sprintf('<p>[Upgrade] %s </p>', $dbKITcontact->getError());
    }
}
// check field_distribution --> #0.29
if (!$dbKITcontact->sqlFieldExists(dbKITcontact::field_distribution)) {
    if (!$dbKITcontact->sqlAlterTableAddField(dbKITcontact::field_distribution, "VARCHAR(255) NOT NULL DEFAULT ''", dbKITcontact::field_newsletter)) {
        $error .= sprintf('<p>[Upgrade] %s </p>', $dbKITcontact->getError());
    }
}
// install tables for newsletter module
$dbKITnewsletterTemplates = new dbKITnewsletterTemplates();
if (!$dbKITnewsletterTemplates->sqlTableExists()) {
    if (!$dbKITnewsletterTemplates->sqlCreateTable()) {
Ejemplo n.º 4
0
}
// end include class.secure.php
define('KIT_INSTALL_RUNNING', true);
require_once WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/initialize.php';
require_once WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/class.mail.php';
require_once WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/class.newsletter.php';
require_once WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/class.cronjob.php';
global $admin;
$error = '';
$dbConfig = new dbKITcfg();
if ($dbConfig->sqlTableExists()) {
    if (!$dbConfig->sqlDeleteTable()) {
        $error .= sprintf('<p>[Delete Table] %s</p>', $dbConfig->getError());
    }
}
$dbContact = new dbKITcontact();
if ($dbContact->sqlTableExists()) {
    if (!$dbContact->sqlDeleteTable()) {
        $error .= sprintf('<p>[Delete Table] %s</p>', $dbContact->getError());
    }
}
$dbContactArray = new dbKITcontactArrayCfg();
if ($dbContactArray->sqlTableExists()) {
    if (!$dbContactArray->sqlDeleteTable()) {
        $error .= sprintf('<p>[Delete Table] %s</p>', $dbContactArray->getError());
    }
}
$dbContactAddress = new dbKITcontactAddress();
if ($dbContactAddress->sqlTableExists()) {
    if (!$dbContactAddress->sqlDeleteTable()) {
        $error .= sprintf('<p>[Delete Table] %s</p>', $dbContactAddress->getError());