Files
luos/workflow/engine/methods/install/newSite.php

70 lines
2.9 KiB
PHP
Raw Normal View History

2010-12-02 23:34:41 +00:00
<?php
2017-08-05 12:35:14 -04:00
2017-08-15 09:02:35 -04:00
use ProcessMaker\Core\Installer;
2017-08-15 08:06:44 -04:00
2017-08-05 12:35:14 -04:00
global $RBAC;
2017-08-15 08:06:44 -04:00
2017-08-05 12:35:14 -04:00
$RBAC->allows(basename(__FILE__), basename(__FILE__));
2010-12-02 23:34:41 +00:00
2017-12-04 13:25:35 +00:00
if (isset($_POST['form']['NW_TITLE'])) {
$action = (isset($_POST['form']['ACTION'])) ? trim($_POST['form']['ACTION']) : 'test';
$name = trim($_POST['form']['NW_TITLE']);
2017-08-15 08:06:44 -04:00
$inst = new Installer();
2010-12-02 23:34:41 +00:00
2017-12-04 13:25:35 +00:00
$isset = $inst->isset_site($name);
2010-12-02 23:34:41 +00:00
$new = ((! $isset)) ? true : false;
2017-12-04 13:25:35 +00:00
$user = (isset($_POST['form']['NW_USERNAME'])) ? trim($_POST['form']['NW_USERNAME']) : 'admin';
$pass = (isset($_POST['form']['NW_PASSWORD'])) ? $_POST['form']['NW_PASSWORD'] : 'admin';
$pass1 = (isset($_POST['form']['NW_PASSWORD2'])) ? $_POST['form']['NW_PASSWORD2'] : 'admin';
2010-12-02 23:34:41 +00:00
2017-12-04 13:25:35 +00:00
$ao_db_drop = (isset($_POST['form']['AO_DB_DROP'])) ? true : false;
2010-12-02 23:34:41 +00:00
2017-12-04 13:25:35 +00:00
$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;
2010-12-02 23:34:41 +00:00
2017-12-04 13:25:35 +00:00
$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
)
2017-12-04 13:25:35 +00:00
), ($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";*/
2017-12-04 13:25:35 +00:00
echo Bootstrap::json_encode($result);
} else {
global $RBAC;
2017-12-04 13:25:35 +00:00
switch ($RBAC->userCanAccess('PM_SETUP_ADVANCE')) {
case - 2:
2017-12-04 13:25:35 +00:00
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die();
break;
case - 3:
case - 1:
2017-12-04 13:25:35 +00:00
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die();
break;
}
$G_PUBLISH = new Publisher();
$c = new Configurations();
2017-12-04 13:25:35 +00:00
$configPage = $c->getConfiguration('usersList', 'pageSize', '', $_SESSION['USER_LOGGED']);
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
2017-12-04 13:25:35 +00:00
$oHeadPublisher = headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('setup/newSite', false); //adding a javascript file .js
$oHeadPublisher->addContent('setup/newSite'); //adding a html file .html.
// $oHeadPublisher->assign('CONFIG', $Config);
// $oHeadPublisher->assign('FORMATS',$c->getFormats());
2017-12-04 13:25:35 +00:00
$oHeadPublisher->assign("SYS_LANG", SYS_LANG);
$oHeadPublisher->assign("SYS_SKIN", SYS_SKIN);
2017-12-04 13:25:35 +00:00
G::RenderPage('publish', 'extJs');
2010-12-02 23:34:41 +00:00
}