Merge pull request #806 from ralpheav/master

Code Style change  workflow/engine/methods/dbConnections
This commit is contained in:
ferOnti
2012-10-18 06:56:46 -07:00
4 changed files with 285 additions and 306 deletions

View File

@@ -1,4 +1,5 @@
<?php
/**
* upgrade.php
*
@@ -20,7 +21,6 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/*
global $RBAC;
@@ -44,7 +44,7 @@ $G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'DB_CONNECTIONS';
*/
$G_PUBLISH = new Publisher;
$G_PUBLISH = new Publisher();
G::LoadClass( 'processMap' );
$oProcess = new processMap();
@@ -75,3 +75,4 @@ if (ProcessPeer::doCount($oCriteria) > 0) {
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/noProcesses' );
}
G::RenderPage( 'publish' );

View File

@@ -1,4 +1,5 @@
<?php
/**
* upgrade.php
*
@@ -20,7 +21,6 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/*
@@ -36,33 +36,32 @@ if( isset($_POST['action']) || isset($_POST['function']) ){
throw new Exception( 'dbconnections Fatal error, No action defined!...' );
}
if(isset($_POST['PROCESS']))
if (isset( $_POST['PROCESS'] )) {
$_SESSION['PROCESS'] = $_POST['PROCESS'];
}
#Global Definitions
require_once 'classes/model/DbSource.php';
require_once 'classes/model/Content.php';
$G_PUBLISH = new Publisher;
$G_PUBLISH = new Publisher();
G::LoadClass( 'processMap' );
G::LoadClass( 'ArrayPeer' );
G::LoadClass( 'dbConnections' );
global $_DBArray;
switch ($action) {
case 'loadInfoAssigConnecctionDB':
$oStep = new Step();
return print ($oStep->loadInfoAssigConnecctionDB( $_POST['PRO_UID'], $_POST['DBS_UID'] )) ;
break;
case 'showDbConnectionsList':
$oProcess = new processMap();
$oCriteria = $oProcess->getConditionProcessList();
if (ProcessPeer::doCount( $oCriteria ) > 0) {
$aProcesses = array ();
$aProcesses[] = array('PRO_UID' => 'char', 'PRO_TITLE' => 'char');
$aProcesses[] = array ('PRO_UID' => 'char','PRO_TITLE' => 'char'
);
$oDataset = ArrayBasePeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
@@ -71,7 +70,8 @@ switch ( $action ){
if ($sProcessUID == '') {
$sProcessUID = $aRow['PRO_UID'];
}
$aProcesses[] = array('PRO_UID' => (isset($aRow['PRO_UID']) ? $aRow['PRO_UID'] : ''), 'PRO_TITLE' => (isset($aRow['PRO_TITLE']) ? $aRow['PRO_TITLE'] : ''));
$aProcesses[] = array ('PRO_UID' => (isset( $aRow['PRO_UID'] ) ? $aRow['PRO_UID'] : ''),'PRO_TITLE' => (isset( $aRow['PRO_TITLE'] ) ? $aRow['PRO_TITLE'] : '')
);
$oDataset->next();
}
@@ -85,19 +85,14 @@ switch ( $action ){
}
G::RenderPage( 'publish', 'raw' );
break;
case 'showConnections':
$oDBSource = new DbSource();
$oCriteria = $oDBSource->getCriteriaDBSList( $_SESSION['PROCESS'] );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'dbConnections/dbConnections', $oCriteria );
G::RenderPage( 'publish', 'raw' );
break;
case 'newDdConnection':
$dbs = new dbConnections( $_SESSION['PROCESS'] );
$dbServices = $dbs->getDbServicesAvailables();
$dbService = $dbs->getEncondeList();
@@ -106,27 +101,28 @@ switch ( $action ){
$dbs->encryptThepassw( $_SESSION['PROCESS'] );
//end updating
$rows[] = array('uid' => 'char', 'name' => 'char');
$rows[] = array ('uid' => 'char','name' => 'char'
);
foreach ($dbServices as $srv) {
$rows[] = array('uid' => $srv['id'], 'name' => $srv['name']);
$rows[] = array ('uid' => $srv['id'],'name' => $srv['name']
);
}
$_DBArray['BDCONNECTIONS'] = $rows;
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dbConnections/dbConnections_New', '', '' );
G::RenderPage( 'publish', 'raw' );
break;
case 'editDdConnection':
$dbs = new dbConnections( $_SESSION['PROCESS'] );
$dbServices = $dbs->getDbServicesAvailables();
$rows[] = array('uid' => 'char', 'name' => 'char');
$rows[] = array ('uid' => 'char','name' => 'char'
);
foreach ($dbServices as $srv) {
$rows[] = array('uid' => $srv['id'], 'name' => $srv['name']);
$rows[] = array ('uid' => $srv['id'],'name' => $srv['name']
);
}
$_DBArray['BDCONNECTIONS'] = $rows;
@@ -142,52 +138,30 @@ switch ( $action ){
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dbConnections/dbConnections_Edit', '', $aFields );
G::RenderPage( 'publish', 'raw' );
break;
case 'saveEditConnection':
$oDBSource = new DbSource();
$oContent = new Content();
if(strpos($_POST['server'], "\\"))
if (strpos( $_POST['server'], "\\" )) {
$_POST['port'] = 'none';
$aData = Array(
'DBS_UID' => $_POST['dbs_uid'],
'PRO_UID' => $_SESSION['PROCESS'],
'DBS_TYPE' => $_POST['type'],
'DBS_SERVER' => $_POST['server'],
'DBS_DATABASE_NAME' => $_POST['db_name'],
'DBS_USERNAME' => $_POST['user'],
'DBS_PASSWORD' => (($_POST['passwd'] == 'none') ? "": G::encrypt($_POST['passwd'], $_POST['db_name']))."_2NnV3ujj3w",
'DBS_PORT' => (($_POST['port'] == 'none') ? "": $_POST['port']),
'DBS_ENCODE' => $_POST['enc']
}
$aData = Array ('DBS_UID' => $_POST['dbs_uid'],'PRO_UID' => $_SESSION['PROCESS'],'DBS_TYPE' => $_POST['type'],'DBS_SERVER' => $_POST['server'],'DBS_DATABASE_NAME' => $_POST['db_name'],'DBS_USERNAME' => $_POST['user'],'DBS_PASSWORD' => (($_POST['passwd'] == 'none') ? "" : G::encrypt( $_POST['passwd'], $_POST['db_name'] )) . "_2NnV3ujj3w",'DBS_PORT' => (($_POST['port'] == 'none') ? "" : $_POST['port']),'DBS_ENCODE' => $_POST['enc']
);
$oDBSource->update( $aData );
$oContent->addContent( 'DBS_DESCRIPTION', '', $_POST['dbs_uid'], SYS_LANG, $_POST['desc'] );
break;
case 'saveConnection':
$oDBSource = new DbSource();
$oContent = new Content();
if(strpos($_POST['server'], "\\"))
if (strpos( $_POST['server'], "\\" )) {
$_POST['port'] = 'none';
$aData = Array(
'PRO_UID' => $_SESSION['PROCESS'],
'DBS_TYPE' => $_POST['type'],
'DBS_SERVER' => $_POST['server'],
'DBS_DATABASE_NAME' => $_POST['db_name'],
'DBS_USERNAME' => $_POST['user'],
'DBS_PASSWORD' => (($_POST['passwd'] == 'none') ? "": G::encrypt($_POST['passwd'], $_POST['db_name']))."_2NnV3ujj3w",
'DBS_PORT' => (($_POST['port'] == 'none') ? "": $_POST['port']),
'DBS_ENCODE' => $_POST['enc']
}
$aData = Array ('PRO_UID' => $_SESSION['PROCESS'],'DBS_TYPE' => $_POST['type'],'DBS_SERVER' => $_POST['server'],'DBS_DATABASE_NAME' => $_POST['db_name'],'DBS_USERNAME' => $_POST['user'],'DBS_PASSWORD' => (($_POST['passwd'] == 'none') ? "" : G::encrypt( $_POST['passwd'], $_POST['db_name'] )) . "_2NnV3ujj3w",'DBS_PORT' => (($_POST['port'] == 'none') ? "" : $_POST['port']),'DBS_ENCODE' => $_POST['enc']
);
$newid = $oDBSource->create( $aData );
$sDelimiter = DBAdapter::getStringDelimiter();
$oContent->addContent( 'DBS_DESCRIPTION', '', $newid, SYS_LANG, $_POST['desc'] );
break;
case 'deleteDbConnection':
try {
$oDBSource = new DbSource();
@@ -205,14 +179,11 @@ switch ( $action ){
}
print G::json_encode( $result );
break;
case 'showTestConnection':
$G_PUBLISH = new Publisher;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'dbConnections/dbConnections' );
G::RenderPage( 'publish', 'raw' );
break;
case 'testConnection':
sleep( 0 );
$step = $_POST['step'];
@@ -226,10 +197,18 @@ switch ( $action ){
if (($port == 'none') || ($port == 0)) {
//setting defaults ports
switch ($type) {
case 'mysql': $port = 3306; break;
case 'pgsql': $port = 5432; break;
case 'mssql': $port = 1433; break;
case 'oracle': $port = 1521; break;
case 'mysql':
$port = 3306;
break;
case 'pgsql':
$port = 5432;
break;
case 'mssql':
$port = 1433;
break;
case 'oracle':
$port = 1521;
break;
}
}
@@ -247,7 +226,6 @@ switch ( $action ){
print (FAILED . ',' . $Server->error) ;
}
break;
case 2:
$Server->scannPort( $port );
if ($Server->getErrno() == 0) {
@@ -256,7 +234,6 @@ switch ( $action ){
print (FAILED . ',' . $Server->error) ;
}
break;
case 3:
$Server->loginDbServer( $user, $passwd );
$Server->setDataBase( $db_name, $port );
@@ -272,7 +249,6 @@ switch ( $action ){
print (FAILED . ',' . $Server->error) ;
}
break;
case 4:
$Server->loginDbServer( $user, $passwd );
$Server->setDataBase( $db_name, $port );
@@ -292,12 +268,10 @@ switch ( $action ){
print (FAILED . ',' . $Server->error) ;
}
break;
default:
print ('finished') ;
}
break;
case 'showEncodes':
G::LoadThirdParty( 'pear/json', 'class.json' );
$oJSON = new Services_JSON();
@@ -312,3 +286,4 @@ switch ( $action ){
}
break;
}

View File

@@ -1,8 +1,10 @@
<?php
/**
* @Author: Erik Amaru Ortiz <erik@colosa.com>
* @Description:This is a additional configuration for load all connections; if exist in a particular proccess
* Description: This is a additional configuration for load all connections; if exist in a particular proccess
* @Date: 15-05-2008
*
* @author : Erik Amaru Ortiz <erik@colosa.com>
*/
if (isset( $_SESSION['PROCESS'] )) {
$pro = include (PATH_CORE . "config/databases.php");
@@ -23,4 +25,3 @@ if( isset($_SESSION['PROCESS']) ){
return $pro;
}
?>

View File

@@ -1,8 +1,9 @@
<?php
/**
* @Author: Erik Amaru Ortiz <erik@colosa.com>
* @Description:This is a additional configuration for load all connections; if exist in a particular proccess
* ription:This is a additional configuration for load all connections; if exist in a particular proccess
* @Date: 15-05-2008
*
* @author : Erik Amaru Ortiz <erik@colosa.com>
*/
$dbHash = @explode( SYSTEM_HASH, G::decrypt( HASH_INSTALLATION, SYSTEM_HASH ) );
@@ -19,3 +20,4 @@
$pro['datasources']['root']['adapter'] = "mysql";
return $pro;