2011-06-22 15:13:21 -04:00
|
|
|
<?php
|
2012-10-18 15:22:01 -04:00
|
|
|
|
2011-06-22 15:13:21 -04:00
|
|
|
/**
|
|
|
|
|
* new Site create v1.1
|
|
|
|
|
* Jan 15th, 2011
|
2012-10-18 15:22:01 -04:00
|
|
|
*
|
2011-06-22 15:13:21 -04:00
|
|
|
* @author krlos P.C <carlos@colosa.com>
|
|
|
|
|
*/
|
|
|
|
|
class newSiteProxy extends HttpProxyController
|
|
|
|
|
{
|
|
|
|
|
|
2012-11-29 14:25:06 -04:00
|
|
|
public function testingNW ($params) {
|
2012-10-18 15:22:01 -04:00
|
|
|
if (isset( $_POST['NW_TITLE'] )) {
|
|
|
|
|
$action = (isset( $_POST['action'] )) ? trim( $_POST['action'] ) : 'test';
|
2015-04-21 12:16:13 -04:00
|
|
|
$ao_db_drop = (isset( $_POST['AO_DB_DROP'] )) ? true : false;
|
2012-10-18 15:22:01 -04:00
|
|
|
|
|
|
|
|
$name = trim( $_POST['NW_TITLE'] );
|
2017-08-04 18:44:16 -04:00
|
|
|
$inst = new PmInstaller();
|
2016-04-20 15:18:23 -04:00
|
|
|
if ($inst->isset_site($name)) {
|
|
|
|
|
if($ao_db_drop === true){
|
|
|
|
|
if(!file_exists(PATH_DATA . "sites/" . $name)){
|
|
|
|
|
$this->error = true;
|
|
|
|
|
$this->message = 'We can not overwrite this workspace because the workspace '.$name.' does not exist please check the lower case and upper case.';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$this->error = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-02-18 17:50:22 -04:00
|
|
|
}
|
2017-04-05 13:54:06 -04:00
|
|
|
$user = (isset($_POST['NW_USERNAME'])) ? trim($_POST['NW_USERNAME']) : 'admin';
|
|
|
|
|
$pass = (isset($_POST['NW_PASSWORD'])) ? trim($_POST['NW_PASSWORD']) : 'admin';
|
|
|
|
|
$pass1 = (isset($_POST['NW_PASSWORD2'])) ? trim($_POST['NW_PASSWORD2']) : 'admin';
|
2012-10-18 15:22:01 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
$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;
|
2015-03-09 10:00:07 -04:00
|
|
|
$_SESSION['NW_PASSWORD'] = $pass;
|
|
|
|
|
$_SESSION['NW_PASSWORD2'] = $pass1;
|
2012-11-29 14:25:06 -04:00
|
|
|
//$json = new Services_JSON();
|
2012-10-18 15:22:01 -04:00
|
|
|
//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;
|
2014-10-31 16:37:50 -04:00
|
|
|
if ($dbWf && $action) {
|
2012-10-18 15:22:01 -04:00
|
|
|
$this->success = true;
|
|
|
|
|
//echo $json->encode($result);
|
|
|
|
|
} else {
|
|
|
|
|
//the site does not available
|
|
|
|
|
$this->error = true;
|
2014-05-07 14:53:05 -04:00
|
|
|
$this->message = $result['result']['database']['ao']['ao_db_wf']['message'];
|
2014-10-30 12:49:53 -04:00
|
|
|
//$this->message .= ', ' . $result['result']['database']['ao']['ao_db_rb']['message'];
|
|
|
|
|
//$this->message .= ', ' . $result['result']['database']['ao']['ao_db_rp']['message'];
|
2012-10-18 15:22:01 -04:00
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$this->error = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-06-22 15:13:21 -04:00
|
|
|
|
2012-11-29 14:25:06 -04:00
|
|
|
/* public function creatingNW ($params)
|
2012-10-18 15:22:01 -04:00
|
|
|
{
|
|
|
|
|
G::pr( $_POST );
|
|
|
|
|
G::pr( "krlossss" );
|
2012-11-29 14:25:06 -04:00
|
|
|
}*/
|
2012-10-18 15:22:01 -04:00
|
|
|
}
|
2011-06-22 15:13:21 -04:00
|
|
|
|