/**
  * create_site
  *
  * @param array $config
  * @param boolean $confirmed
  * @return void
  */
 public function create_site($config = array(), $confirmed = false)
 {
     $this->options = G::array_concat(array('isset' => false, 'password' => G::generate_password(12), 'path_data' => @PATH_DATA, 'path_compiled' => @PATH_C, 'name' => $config['name'], 'database' => array(), 'admin' => array('username' => 'admin', 'password' => 'admin'), 'advanced' => array('ao_db_wf' => 'wf_' . $config['name'], 'ao_db_rb' => 'rb_' . $config['name'], 'ao_db_rp' => 'rp_' . $config['name'], 'ao_db_drop' => false)), $config);
     $a = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
     $this->options['database'] = G::array_concat(array('username' => @$a[1], 'password' => @$a[2], 'hostname' => @$a[0]), $this->options['database']);
     return $confirmed === true ? $this->make_site() : $this->create_site_test();
 }
Exemple #2
0
 /**
  * @covers G::generate_password
  * @todo   Implement testGenerate_password().
  */
 public function testGenerate_password()
 {
     // $length = ''
     $responsePass = G::generate_password();
     $this->assertEquals(strlen($responsePass), 8);
     // $length = '32'
     $responsePass = G::generate_password(10);
     $this->assertEquals(strlen($responsePass), 10);
 }
    public function createMSSQLWorkspace ()

    {

        G::LoadSystem('inputfilter');

        $filter = new InputFilter();

        ini_set( 'max_execution_time', '0' );



        $info = new stdClass();

        $info->result = false;

        $info->message = '';



        $db_hostname = trim( $_REQUEST['db_hostname'] );

        $db_hostname = $filter->validateInput($db_hostname);

        $db_port = trim( $_REQUEST['db_port'] );

        $db_port = $filter->validateInput($db_port);

        $db_username = trim( $_REQUEST['db_username'] );

        $db_username = $filter->validateInput($db_username);

        $db_password = trim( $_REQUEST['db_password'] );

        $db_password = $filter->validateInput($db_password);

        $wf = trim( $_REQUEST['wfDatabase'] );

        $rb = trim( $_REQUEST['wfDatabase'] );

        $rp = trim( $_REQUEST['wfDatabase'] );

        $workspace = trim( $_REQUEST['workspace'] );

        $pathConfig = trim( $_REQUEST['pathConfig'] );

        $pathLanguages = trim( $_REQUEST['pathLanguages'] );

        $pathPlugins = trim( $_REQUEST['pathPlugins'] );

        $pathShared = trim( $_REQUEST['pathShared'] );

        $pathXmlforms = trim( $_REQUEST['pathXmlforms'] );

        $adminPassword = trim( $_REQUEST['adminPassword'] );

        $adminUsername = trim( $_REQUEST['adminUsername'] );

        $deleteDB = ($_REQUEST['deleteDB'] == 'true');



        if (substr( $pathShared, - 1 ) != '/') {

            $pathShared .= '/';

        }



        $this->installLog( '-------------------------------------------' );

        $this->installLog( G::LoadTranslation('ID_CREATING_WORKSPACE', SYS_LANG, Array($workspace) ) );



        try {

            $db_host = ($db_port != '' && $db_port != 1433) ? $db_hostname . ':' . $db_port : $db_hostname;

            $db_host = $filter->validateInput($db_host);

            $db_username = $filter->validateInput($db_username);

            $db_password = $filter->validateInput($db_password);

            $this->link = @mssql_connect( $db_host, $db_username, $db_password );

            $this->installLog( G::LoadTranslation('ID_CONNECT_TO_SERVER', SYS_LANG, Array( $db_hostname, $db_port, $db_username )) );



            $this->mssqlQuery( 'USE [master]' );



            // DROP databases wf_workflow, rb_workflow and rp_workflow

            if ($deleteDB) {

                $q = sprintf( "IF EXISTS (SELECT name FROM sys.databases WHERE name='%s' ) DROP DATABASE %s", $wf, $wf );

                $this->mssqlQuery( $q );

            }



            // CREATE databases wf_workflow, rb_workflow and rp_workflow

            $q = sprintf( "IF NOT EXISTS (SELECT * FROM sys.databases WHERE name='%s' ) CREATE DATABASE %s", $wf, $wf );

            $this->mssqlQuery( $q );



            //CREATE users and GRANT Privileges

            $wfPass = G::generate_password( 12 );

            $this->setGrantPrivilegesMSSQL( $wf, $wfPass, $wf );



            //Generate the db.php file and folders

            $path_site = $pathShared . "/sites/" . $workspace . "/";

            $db_file = $path_site . "db.php";

            mkdir( $path_site, 0777, true );

            @mkdir( $path_site . "files/", 0777, true );

            @mkdir( $path_site . "mailTemplates/", 0777, true );

            @mkdir( $path_site . "public/", 0777, true );

            @mkdir( $path_site . "reports/", 0777, true );

            @mkdir( $path_site . "xmlForms", 0777, true );



            $dbText = "<?php\n";

            $dbText .= sprintf( "// Processmaker configuration\n" );

            $dbText .= sprintf( "  define ('DB_ADAPTER',     '%s' );\n", 'mssql' );

            $dbText .= sprintf( "  define ('DB_HOST',        '%s' );\n", $db_host );

            $dbText .= sprintf( "  define ('DB_NAME',        '%s' );\n", $wf );

            $dbText .= sprintf( "  define ('DB_USER',        '%s' );\n", $wf );

            $dbText .= sprintf( "  define ('DB_PASS',        '%s' );\n", $wfPass );

            $dbText .= sprintf( "  define ('DB_RBAC_HOST',   '%s' );\n", $db_host );

            $dbText .= sprintf( "  define ('DB_RBAC_NAME',   '%s' );\n", $wf );

            $dbText .= sprintf( "  define ('DB_RBAC_USER',   '%s' );\n", $wf );

            $dbText .= sprintf( "  define ('DB_RBAC_PASS',   '%s' );\n", $wfPass );

            $dbText .= sprintf( "  define ('DB_REPORT_HOST', '%s' );\n", $db_host );

            $dbText .= sprintf( "  define ('DB_REPORT_NAME', '%s' );\n", $wf );

            $dbText .= sprintf( "  define ('DB_REPORT_USER', '%s' );\n", $wf );

            $dbText .= sprintf( "  define ('DB_REPORT_PASS', '%s' );\n", $wfPass );

            if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) {

                $dbText .= "\n";

                $dbText .= "  define ('PARTNER_FLAG', " . ((defined('PARTNER_FLAG')) ? PARTNER_FLAG : ((isset($_REQUEST['PARTNER_FLAG'])) ? $_REQUEST['PARTNER_FLAG']:'false')) . ");\n";

                if ($this->systemName != '') {

                    $dbText .= "  define ('SYSTEM_NAME', '" . $this->systemName . "');\n";

                }

            }



            $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($db_file) ));

            file_put_contents( $db_file, $dbText );



            // Generate the databases.php file

            $databases_file = $path_site . 'databases.php';

            $dbData = sprintf( "\$dbAdapter    = '%s';\n", 'mssql' );

            $dbData .= sprintf( "\$dbHost       = '%s';\n", $db_host );

            $dbData .= sprintf( "\$dbName       = '%s';\n", $wf );

            $dbData .= sprintf( "\$dbUser       = '******';\n", $wf );

            $dbData .= sprintf( "\$dbPass       = '******';\n", $wfPass );

            $dbData .= sprintf( "\$dbRbacHost   = '%s';\n", $db_host );

            $dbData .= sprintf( "\$dbRbacName   = '%s';\n", $wf );

            $dbData .= sprintf( "\$dbRbacUser   = '******';\n", $wf );

            $dbData .= sprintf( "\$dbRbacPass   = '******';\n", $wfPass );

            $dbData .= sprintf( "\$dbReportHost = '%s';\n", $db_host );

            $dbData .= sprintf( "\$dbReportName = '%s';\n", $wf );

            $dbData .= sprintf( "\$dbReportUser = '******';\n", $wf );

            $dbData .= sprintf( "\$dbReportPass = '******';\n", $wfPass );

            $databasesText = str_replace( '{dbData}', $dbData, @file_get_contents( PATH_HOME . 'engine/templates/installer/databases.tpl' ) );



            $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($databases_file) ));

            file_put_contents( $databases_file, $databasesText );



            //execute scripts to create and populates databases

            $query = sprintf( "USE %s;", $wf );

            $this->mssqlQuery( $query );



            $this->mssqlFileQuery( PATH_RBAC_HOME . 'engine/data/mssql/schema.sql' );

            $this->mssqlFileQuery( PATH_RBAC_HOME . 'engine/data/mssql/insert.sql' );



            $query = sprintf( "USE %s;", $wf );

            $this->mssqlQuery( $query );

            $this->mssqlFileQuery( PATH_HOME . 'engine/data/mssql/schema.sql' );

            $this->mssqlFileQuery( PATH_HOME . 'engine/data/mssql/insert.sql' );



            // Create the triggers

            if (file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerContentUpdate.sql' )) {

                $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql' ) );

                $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql' ) );

                $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql' ) );

                $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql' ) );

                $this->mysqlQuery(@file_get_contents(PATH_HOME . "engine/methods/setup/setupSchemas/triggerSubApplicationInsert.sql"));

                $this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerContentUpdate.sql' ) );

                $this->mssqlQuery( "INSERT INTO CONFIGURATION (

                            CFG_UID,

                            CFG_VALUE

                           )

                           VALUES (

                             'APP_CACHE_VIEW_ENGINE',

                             '" . addslashes( serialize( array ('LANG' => 'en','STATUS' => 'active'

                ) ) ) . "'

                           )" );



                $this->mssqlQuery("INSERT INTO EMAIL_SERVER(MESS_UID, MESS_ENGINE) VALUES('" . \ProcessMaker\Util\Common::generateUID() . "','MAIL')");

            }



            //change admin user

            $query = sprintf( "USE %s;", $wf );

            $this->mssqlQuery( $query );



            $query = sprintf( "UPDATE USERS SET USR_USERNAME = '******', USR_PASSWORD = '******' WHERE USR_UID = '00000000000000000000000000000001' ", $adminUsername, G::encryptOld( $adminPassword ) );

            $this->mssqlQuery( $query );



            $query = sprintf( "USE %s;", $wf );

            $this->mssqlQuery( $query );



            $query = sprintf( "UPDATE RBAC_USERS SET USR_USERNAME = '******', USR_PASSWORD = '******' WHERE USR_UID = '00000000000000000000000000000001' ", $adminUsername, G::encryptOld( $adminPassword ) );

            $this->mssqlQuery( $query );



            // Write the paths_installed.php file (contains all the information configured so far)

            if (! file_exists( FILE_PATHS_INSTALLED )) {

                $sh = G::encryptOld( filemtime( PATH_GULLIVER . '/class.g.php' ) );

                $h = G::encrypt( $db_hostname . $sh . $db_username . $sh . $db_password . '1', $sh );

                $dbText = "<?php\n";

                $dbText .= sprintf( "  define ('PATH_DATA',        '%s' );\n", $pathShared );

                $dbText .= sprintf( "  define ('PATH_C',           '%s' );\n", $pathShared . 'compiled/' );

                $dbText .= sprintf( "  define ('HASH_INSTALLATION', '%s' );\n", $h );

                $dbText .= sprintf( "  define ('SYSTEM_HASH',       '%s' );\n", $sh );

                $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array(FILE_PATHS_INSTALLED) ));

                file_put_contents( FILE_PATHS_INSTALLED, $dbText );

            }

            $this->installLog( G::LoadTranslation('ID_INSTALL_SUCESS') );

            $info->result = true;

            $info->message = G::LoadTranslation('ID_INSTALL_SUCESS');

            $info->url = '/sys' . $_REQUEST['workspace'] . '/en/neoclassic/login/login';

            $info->messageFinish = G::LoadTranslation('ID_PROCESSMAKER_SUCCESS_INSTALLED', SYS_LANG, Array($workspace));;

        } catch (Exception $e) {

            $info->result = false;

            $info->message = $e->getMessage();

        }

        return $info;

    }
global $RBAC;
require_once PATH_RBAC . "model/RbacUsers.php";
G::LoadClass('pmFunctions');
require_once 'classes/model/Users.php';
G::LoadClass("system");
$rbacUser = new RbacUsers();
$user = new Users();
$userData = $rbacUser->getByUsername($data['USR_USERNAME']);
if ($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL']) {
    $aSetup = getEmailConfiguration();
    if (count($aSetup) == 0 || !isset($aSetup['MESS_ENGINE'])) {
        G::SendTemporalMessage('ID_EMAIL_ENGINE_IS_NOT_ENABLED', "warning");
        G::header('location: forgotPassword');
        die;
    }
    $newPass = G::generate_password();
    $aData['USR_UID'] = $userData['USR_UID'];
    $aData['USR_PASSWORD'] = md5($newPass);
    /* **Save after sending the mail
         $rbacUser->update($aData);
         $user->update($aData);
       */
    $sFrom = ($aSetup['MESS_ACCOUNT'] != '' ? $aSetup['MESS_ACCOUNT'] . ' ' : '') . '<' . $aSetup['MESS_ACCOUNT'] . '>';
    $sSubject = G::LoadTranslation('ID_RESET_PASSWORD') . ' - ProcessMaker';
    $msg = '<h3>ProcessMaker Forgot password Service</h3>';
    $msg .= '<p>' . G::LoadTranslation('ID_YOUR_USERMANE_IS') . ' :  <strong>' . $userData['USR_USERNAME'] . '</strong></p>';
    $msg .= '<p>' . G::LoadTranslation('ID_YOUR_PASSWORD_IS') . ' :  <strong>' . $newPass . '</strong></p>';
    switch ($aSetup['MESS_ENGINE']) {
        case 'MAIL':
            $engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1');
            break;
Exemple #5
0
 public function forgotPassword($httpData)
 {
     $this->setResponseType('json');
     global $RBAC;
     require_once PATH_RBAC . "model/RbacUsers.php";
     require_once 'classes/model/Users.php';
     G::LoadClass("system");
     $rbacUser = new RbacUsers();
     $user = new Users();
     try {
         $userData = $rbacUser->getByUsername($httpData->username);
         if (!$userData) {
             $msg = G::LoadTranslation('ID_USER') . ' <b>' . $httpData->username . '</b> ' . G::LoadTranslation('ID_IS_NOT_REGISTERED');
             throw new Exception($msg);
         }
         if (trim($userData['USR_EMAIL']) != trim($httpData->email)) {
             $msg = G::LoadTranslation('ID_EMAIL_DOES_NOT_MATCH_FOR_USER') . ' <b>' . $httpData->username . '</b>';
             throw new Exception($msg);
         }
         $newPass = G::generate_password();
         $aData['USR_UID'] = $userData['USR_UID'];
         $aData['USR_PASSWORD'] = md5($newPass);
         $rbacUser->update($aData);
         $user->update($aData);
         $subject = G::loadTranslation('ID_PROCESSMAKER_FORGOT_PASSWORD_SERVICE');
         $template = new TemplatePower(PATH_TPL . 'main/forgotPassword.tpl');
         $template->prepare();
         $template->assign('server', $_SERVER['SERVER_NAME']);
         $template->assign('serviceMsg', G::loadTranslation('ID_PROCESSMAKER_FORGOT_PASSWORD_SERVICE'));
         $template->assign('content', G::loadTranslation('ID_PASSWORD_CHANGED_SUCCESSFULLY'));
         $template->assign('passwd', $newPass);
         $template->assign('poweredBy', G::loadTranslation('ID_PROCESSMAKER_SLOGAN1'));
         $template->assign('versionLabel', G::loadTranslation('ID_VERSION'));
         $template->assign('version', System::getVersion());
         $template->assign('visit', G::loadTranslation('ID_VISIT'));
         $template->assign('footer', '');
         $body = $template->getOutputContent();
         G::sendMail('', 'ProcessMaker Service', $httpData->email, $subject, $body);
         $result->success = true;
         $result->message = G::LoadTranslation('ID_NEW_PASSWORD_SENT');
     } catch (Exception $e) {
         $result->success = false;
         $result->message = $e->getMessage();
     }
     return $result;
 }
Exemple #6
0
 public function createMSSQLWorkspace()
 {
     ini_set('max_execution_time', '0');
     $info->result = false;
     $info->message = '';
     $db_hostname = trim($_REQUEST['db_hostname']);
     $db_port = trim($_REQUEST['db_port']);
     $db_username = trim($_REQUEST['db_username']);
     $db_password = trim($_REQUEST['db_password']);
     $wf = trim($_REQUEST['wfDatabase']);
     $rb = trim($_REQUEST['rbDatabase']);
     $rp = trim($_REQUEST['rpDatabase']);
     $workspace = trim($_REQUEST['workspace']);
     $pathConfig = trim($_REQUEST['pathConfig']);
     $pathLanguages = trim($_REQUEST['pathLanguages']);
     $pathPlugins = trim($_REQUEST['pathPlugins']);
     $pathShared = trim($_REQUEST['pathShared']);
     $pathXmlforms = trim($_REQUEST['pathXmlforms']);
     $adminPassword = trim($_REQUEST['adminPassword']);
     $adminUsername = trim($_REQUEST['adminUsername']);
     $deleteDB = $_REQUEST['deleteDB'] == 'true';
     if (substr($pathShared, -1) != '/') {
         $pathShared .= '/';
     }
     $this->installLog('-------------------------------------------');
     $this->installLog(sprintf("Creating workspace '%s' ", $workspace));
     try {
         $db_host = $db_port != '' && $db_port != 1433 ? $db_hostname . ':' . $db_port : $db_hostname;
         $this->link = @mssql_connect($db_host, $db_username, $db_password);
         $this->installLog(sprintf("Connected to server %s:%d using user: '******' ", $db_hostname, $db_port, $db_username));
         $this->mssqlQuery('USE [master]');
         // DROP databases wf_workflow, rb_workflow and rp_workflow
         if ($deleteDB) {
             $q = sprintf("IF EXISTS (SELECT name FROM sys.databases WHERE name='%s' ) DROP DATABASE %s", $wf, $wf);
             $this->mssqlQuery($q);
             $q = sprintf("IF EXISTS (SELECT name FROM sys.databases WHERE name='%s' ) DROP DATABASE %s", $rb, $rb);
             $this->mssqlQuery($q);
             $q = sprintf("IF EXISTS (SELECT name FROM sys.databases WHERE name='%s' ) DROP DATABASE %s", $rp, $rp);
             $this->mssqlQuery($q);
         }
         // CREATE databases wf_workflow, rb_workflow and rp_workflow
         $q = sprintf("IF NOT EXISTS (SELECT * FROM sys.databases WHERE name='%s' ) CREATE DATABASE %s", $wf, $wf);
         $this->mssqlQuery($q);
         $q = sprintf("IF NOT EXISTS (SELECT * FROM sys.databases WHERE name='%s' ) CREATE DATABASE %s", $rb, $rb);
         $this->mssqlQuery($q);
         $q = sprintf("IF NOT EXISTS (SELECT * FROM sys.databases WHERE name='%s' ) CREATE DATABASE %s", $rp, $rp);
         $this->mssqlQuery($q);
         //CREATE users and GRANT Privileges
         $wfPass = G::generate_password(12);
         $rbPass = G::generate_password(12);
         $rpPass = G::generate_password(12);
         $this->setGrantPrivilegesMSSQL($wf, $wfPass, $wf);
         $this->setGrantPrivilegesMSSQL($rb, $rbPass, $rb);
         $this->setGrantPrivilegesMSSQL($rp, $rpPass, $rp);
         //Generate the db.php file and folders
         $path_site = $pathShared . "/sites/" . $workspace . "/";
         $db_file = $path_site . "db.php";
         mkdir($path_site, 0777, true);
         @mkdir($path_site . "files/", 0777, true);
         @mkdir($path_site . "mailTemplates/", 0777, true);
         @mkdir($path_site . "public/", 0777, true);
         @mkdir($path_site . "reports/", 0777, true);
         @mkdir($path_site . "xmlForms", 0777, true);
         $dbText = "<?php\n";
         $dbText .= sprintf("// Processmaker configuration\n");
         $dbText .= sprintf("  define ('DB_ADAPTER',     '%s' );\n", 'mssql');
         $dbText .= sprintf("  define ('DB_HOST',        '%s' );\n", $db_host);
         $dbText .= sprintf("  define ('DB_NAME',        '%s' );\n", $wf);
         $dbText .= sprintf("  define ('DB_USER',        '%s' );\n", $wf);
         $dbText .= sprintf("  define ('DB_PASS',        '%s' );\n", $wfPass);
         $dbText .= sprintf("  define ('DB_RBAC_HOST',   '%s' );\n", $db_host);
         $dbText .= sprintf("  define ('DB_RBAC_NAME',   '%s' );\n", $rb);
         $dbText .= sprintf("  define ('DB_RBAC_USER',   '%s' );\n", $rb);
         $dbText .= sprintf("  define ('DB_RBAC_PASS',   '%s' );\n", $rbPass);
         $dbText .= sprintf("  define ('DB_REPORT_HOST', '%s' );\n", $db_host);
         $dbText .= sprintf("  define ('DB_REPORT_NAME', '%s' );\n", $rp);
         $dbText .= sprintf("  define ('DB_REPORT_USER', '%s' );\n", $rp);
         $dbText .= sprintf("  define ('DB_REPORT_PASS', '%s' );\n", $rpPass);
         $this->installLog("Creating: " . $db_file);
         file_put_contents($db_file, $dbText);
         // Generate the databases.php file
         $databases_file = $path_site . 'databases.php';
         $dbData = sprintf("\$dbAdapter    = '%s';\n", 'mssql');
         $dbData .= sprintf("\$dbHost       = '%s';\n", $db_host);
         $dbData .= sprintf("\$dbName       = '%s';\n", $wf);
         $dbData .= sprintf("\$dbUser       = '******';\n", $wf);
         $dbData .= sprintf("\$dbPass       = '******';\n", $wfPass);
         $dbData .= sprintf("\$dbRbacHost   = '%s';\n", $db_host);
         $dbData .= sprintf("\$dbRbacName   = '%s';\n", $rb);
         $dbData .= sprintf("\$dbRbacUser   = '******';\n", $rb);
         $dbData .= sprintf("\$dbRbacPass   = '******';\n", $rbPass);
         $dbData .= sprintf("\$dbReportHost = '%s';\n", $db_host);
         $dbData .= sprintf("\$dbReportName = '%s';\n", $rp);
         $dbData .= sprintf("\$dbReportUser = '******';\n", $rp);
         $dbData .= sprintf("\$dbReportPass = '******';\n", $rpPass);
         $databasesText = str_replace('{dbData}', $dbData, @file_get_contents(PATH_HOME . 'engine/templates/installer/databases.tpl'));
         $this->installLog('Creating: ' . $databases_file);
         file_put_contents($databases_file, $databasesText);
         //execute scripts to create and populates databases
         $query = sprintf("USE %s;", $rb);
         $this->mssqlQuery($query);
         $this->mssqlFileQuery(PATH_RBAC_HOME . 'engine/data/mssql/schema.sql');
         $this->mssqlFileQuery(PATH_RBAC_HOME . 'engine/data/mssql/insert.sql');
         $query = sprintf("USE %s;", $wf);
         $this->mssqlQuery($query);
         $this->mssqlFileQuery(PATH_HOME . 'engine/data/mssql/schema.sql');
         $this->mssqlFileQuery(PATH_HOME . 'engine/data/mssql/insert.sql');
         // Create the triggers
         if (file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql') && file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql') && file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql') && file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql') && file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerContentUpdate.sql')) {
             $this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql'));
             $this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql'));
             $this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql'));
             $this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql'));
             $this->mssqlQuery(@file_get_contents(PATH_HOME . 'engine/plugins/enterprise/data/triggerContentUpdate.sql'));
             $this->mssqlQuery("INSERT INTO CONFIGURATION (\n                            CFG_UID,\n                            CFG_VALUE\n                           )\n                           VALUES (\n                             'APP_CACHE_VIEW_ENGINE',\n                             '" . addslashes(serialize(array('LANG' => 'en', 'STATUS' => 'active'))) . "'\n                           )");
         }
         //change admin user
         $query = sprintf("USE %s;", $wf);
         $this->mssqlQuery($query);
         $query = sprintf("UPDATE USERS SET USR_USERNAME = '******', USR_PASSWORD = '******' WHERE USR_UID = '00000000000000000000000000000001' ", $adminUsername, md5($adminPassword));
         $this->mssqlQuery($query);
         $query = sprintf("USE %s;", $rb);
         $this->mssqlQuery($query);
         $query = sprintf("UPDATE USERS SET USR_USERNAME = '******', USR_PASSWORD = '******' WHERE USR_UID = '00000000000000000000000000000001' ", $adminUsername, md5($adminPassword));
         $this->mssqlQuery($query);
         // Write the paths_installed.php file (contains all the information configured so far)
         if (!file_exists(FILE_PATHS_INSTALLED)) {
             $sh = md5(filemtime(PATH_GULLIVER . '/class.g.php'));
             $h = G::encrypt($db_hostname . $sh . $db_username . $sh . $db_password . '1', $sh);
             $dbText = "<?php\n";
             $dbText .= sprintf("  define ('PATH_DATA',        '%s' );\n", $pathShared);
             $dbText .= sprintf("  define ('PATH_C',           '%s' );\n", $pathShared . 'compiled/');
             $dbText .= sprintf("  define ('HASH_INSTALLATION', '%s' );\n", $h);
             $dbText .= sprintf("  define ('SYSTEM_HASH',       '%s' );\n", $sh);
             $this->installLog("Creating: " . FILE_PATHS_INSTALLED);
             file_put_contents(FILE_PATHS_INSTALLED, $dbText);
         }
         $this->installLog("Install completed Succesfully");
         $info->result = true;
         $info->message = 'Succesfully';
         $info->url = '/sys' . $_REQUEST['workspace'] . '/en/classic/main/login';
     } catch (Exception $e) {
         $info->result = false;
         $info->message = $e->getMessage();
     }
     return $info;
 }