function init() { require 'lib.searchengine.php'; $oPlugin = new PPluginDir(dirname(__FILE__)); $oConfigFile =& $oPlugin->oConfig; $bActivate = $oConfigFile->getDirectParam('ACTIVATE'); if ($bActivate !== "true") { return setError(_('Please check your configuration. You must activate it befor try to index the content')); } if (!createBase()) { return false; } if (!synchroBase()) { return false; } echo gettext('Data base has been populated successfully'); return true; }
exSQL($sql, $mysqli); } function calendarCreateTable($mysqli) { $sql = "CREATE TABLE IF NOT EXISTS calendars (\r\n calendar_id int(11) NOT NULL AUTO_INCREMENT,\r\n user_id int(11) NOT NULL,\r\n client_id int(11),\r\n case_id int(11),\r\n calendar_type int(11) NOT NULL,\r\n calendar_name varchar(64) CHARACTER SET utf8 NOT NULL,\r\n calendar_startDate timestamp NOT NULL,\r\n calendar_endDate timestamp,\r\n calendar_comment varchar(1024) CHARACTER SET utf8,\r\n calendar_delete int(11) DEFAULT 0,\r\n PRIMARY KEY (calendar_id)\r\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; exSQL($sql, $mysqli); } /* ====================================================== FUNCTIONS FOR DATABASE PREPOPULATION ======================================================= */ function userPrepopulate($mysqli) { $sql = "INSERT INTO Users (user_name, user_surname, user_address, user_city, user_state, user_phone, user_email, user_accountNumber, user_username, user_password, user_passwordSalt, user_createdDate, user_accountType, user_activationCode, user_status)\r\n VALUES ('Nemanja', 'Pavlović', 'Generala Štefanika 20', 'Beograd', 'Srbija', '+381 63 715 65 05', '*****@*****.**', '', 'nemanja.pavlovic', '011cec9b2e604fcfa2af9c0d0ad27cd30b88ab371dd1db13a3d60bb88441912d3ce06223f50cd5d736fed3881254060fd9ce11eecdb76f7b5d0831963663eb76', 'f9aab579fc1b41ed0c44fe4ecdbfcdb4cb99b9023abb241a6db833288f4eea3c02f76e0d35204a8695077dcf81932aa59006423976224be0390395bae152d4ef', '{{registration-date}}', 'superuserr', '', '1')"; exSQL($sql, $mysqli); } function clientPrepopulate($mysqli) { $sql = "INSERT INTO Clients (client_name, client_surname, client_address, client_city, client_state, client_citizenship, client_phone, client_email, client_socialNumber, client_idNumber, client_accountNumber, client_comment)\r\n VALUES ('Nemanja', 'Pavlović', 'Generala Štefanika 20', 'Beograd', 'Srbija', 'Srpsko', '+381 63 715 65 05', '*****@*****.**', '0911992740046', '', '160-5400100716409-92', '')"; exSQL($sql, $mysqli); } function createBase($mysqli) { usersCreateTable($mysqli); loginAttemptsCreateTable($mysqli); clientCreateTable($mysqli); caseCreateTable($mysqli); calendarCreateTable($mysqli); userPrepopulate($mysqli); } createBase($mysqli);