public function testingNW($params) { if (isset($_POST['NW_TITLE'])) { $action = isset($_POST['action']) ? trim($_POST['action']) : 'test'; $ao_db_drop = isset($_POST['AO_DB_DROP']) ? true : false; G::LoadClass('Installer'); //G::LoadClass( 'json' ); $name = trim($_POST['NW_TITLE']); $inst = new Installer(); if ($inst->isset_site($name) && $ao_db_drop !== true) { $this->error = true; return; } $user = isset($_POST['NW_USERNAME']) ? trim($_POST['NW_USERNAME']) : 'admin'; $pass = isset($_POST['NW_PASSWORD']) ? $_POST['NW_PASSWORD'] : '******'; $pass1 = isset($_POST['NW_PASSWORD2']) ? $_POST['NW_PASSWORD2'] : 'admin'; $ao_db_wf = isset($_POST['AO_DB_WF']) ? $_POST['AO_DB_WF'] : false; $ao_db_rb = isset($_POST['AO_DB_RB']) ? $_POST['AO_DB_RB'] : false; $ao_db_rp = isset($_POST['AO_DB_RP']) ? $_POST['AO_DB_RP'] : false; $result = $inst->create_site(array('isset' => true, 'name' => $name, 'admin' => array('username' => $user, 'password' => $pass), 'advanced' => array('ao_db_drop' => $ao_db_drop, 'ao_db_wf' => $ao_db_wf, 'ao_db_rb' => $ao_db_rb, 'ao_db_rp' => $ao_db_rp)), $action === 'create' ? true : false); $result['result']['admin']['password'] = $pass === $pass1 ? true : false; $result['result']['action'] = $action; $_SESSION['NW_PASSWORD'] = $pass; $_SESSION['NW_PASSWORD2'] = $pass1; //$json = new Services_JSON(); //G::pr($result['result']['database']);G::pr($action); $dbWf = $result['result']['database']['ao']['ao_db_wf']['status']; $dbRb = $result['result']['database']['ao']['ao_db_rb']['status']; $dbRp = $result['result']['database']['ao']['ao_db_rp']['status']; $wsAction = $action != '' ? 1 : 0; if ($dbWf && $action) { $this->success = true; //echo $json->encode($result); } else { //the site does not available $this->error = true; $this->message = $result['result']['database']['ao']['ao_db_wf']['message']; //$this->message .= ', ' . $result['result']['database']['ao']['ao_db_rb']['message']; //$this->message .= ', ' . $result['result']['database']['ao']['ao_db_rp']['message']; } } else { $this->error = true; } }
if (isset($_POST['form']['NW_TITLE'])) { $action = isset($_POST['form']['ACTION']) ? trim($_POST['form']['ACTION']) : 'test'; G::LoadClass('Installer'); G::LoadClass('json'); $name = trim($_POST['form']['NW_TITLE']); $inst = new Installer(); $isset = $inst->isset_site($name); $new = !$isset ? true : false; $user = isset($_POST['form']['NW_USERNAME']) ? trim($_POST['form']['NW_USERNAME']) : 'admin'; $pass = isset($_POST['form']['NW_PASSWORD']) ? $_POST['form']['NW_PASSWORD'] : '******'; $pass1 = isset($_POST['form']['NW_PASSWORD2']) ? $_POST['form']['NW_PASSWORD2'] : 'admin'; $ao_db_drop = isset($_POST['form']['AO_DB_DROP']) ? true : false; $ao_db_wf = isset($_POST['form']['AO_DB_WF']) ? $_POST['form']['AO_DB_WF'] : false; $ao_db_rb = isset($_POST['form']['AO_DB_WF']) ? $_POST['form']['AO_DB_WF'] : false; $ao_db_rp = isset($_POST['form']['AO_DB_WF']) ? $_POST['form']['AO_DB_WF'] : false; $result = $inst->create_site(array('isset' => true, 'name' => $name, 'admin' => array('username' => $user, 'password' => $pass), 'advanced' => array('ao_db_drop' => $ao_db_drop, 'ao_db_wf' => $ao_db_wf, 'ao_db_rb' => $ao_db_rb, 'ao_db_rp' => $ao_db_rp)), $action === 'create' ? true : false); $result['result']['admin']['password'] = $pass === $pass1 ? true : false; $result['result']['action'] = $action; //$json = new Services_JSON(); /*$ec; $ec->created=($new)?true:false; $ec->name=$name; $ec->message=($new)?"Workspace created":"Workspace already exists or Name invalid";*/ echo Bootstrap::json_encode($result); } else { global $RBAC; switch ($RBAC->userCanAccess('PM_SETUP_ADVANCE')) { case -2: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header('location: ../login/login'); die;
@mkdir($dir_log, 0777, true); $logFilename = "{$dir_log}install.log"; $displayLog = Log::singleton('display', '', 'INSTALLER', array('lineFormat' => "%{message}")); $fileLog = Log::singleton('file', $logFilename, 'INSTALLER'); global $logger; $logger = Log::singleton('composite'); $logger->addChild($displayLog); $create_db = "create-db.sql"; $schema = "schema.sql"; G::LoadClass('Installer'); /* Create default workspace called workflow */ $inst = new Installer(); $siteName = "workflow"; $p1 = isset($dataClient->ao_admin_pass1) ? $dataClient->ao_admin_pass1 : 'admin'; $p2 = isset($dataClient->ao_admin_pass2) ? $dataClient->ao_admin_pass2 : 'admin'; $s = $inst->create_site(array('name' => 'workflow', 'path_data' => $dataClient->path_data, 'path_compiled' => $dataClient->path_compiled, 'admin' => array('username' => isset($dataClient->ao_admin) ? $dataClient->ao_admin : 'admin', 'password' => $p1), 'advanced' => array('ao_db' => isset($dataClient->ao_db) && $dataClient->ao_db === 2 ? false : true, 'ao_db_drop' => isset($dataClient->ao_db_drop) && $dataClient->ao_db_drop === true ? true : false, 'ao_db_wf' => isset($dataClient->ao_db_wf) ? $dataClient->ao_db_wf : 'wf_' . $siteName, 'ao_db_rb' => isset($dataClient->ao_db_rb) ? $dataClient->ao_db_rb : 'rb_' . $siteName, 'ao_db_rp' => isset($dataClient->ao_db_rp) ? $dataClient->ao_db_rp : 'rp_' . $siteName), 'database' => array('hostname' => $dataClient->mysqlH, 'username' => $dataClient->mysqlU, 'password' => $dataClient->mysqlP)), true); if ($s['created']) { $report = $inst->report; } else { /* On a failed install, $inst->report is blank because the * installation didnt occured at all. So we use the test report * instead. */ $report = $s['result']; } $installError = !$s['created']; } catch (Exception $e) { $installError = $e->getMessage() ? $e->getMessage() : true; } if ($installError) { header('HTTP', true, 500);