}
     $_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');
     foreach ($dbServices as $srv) {
         $rows[] = array('uid' => $srv['id'], 'name' => $srv['name']);
     }
     $_DBArray['BDCONNECTIONS'] = $rows;
     $_SESSION['_DBArray'] = $_DBArray;
     $o = new DbSource();
     $aFields = $o->load($_POST['DBS_UID'], $_SESSION['PROCESS']);
     if ($aFields['DBS_PORT'] == '0') {
         $aFields['DBS_PORT'] = '';
     }
     $aFields['DBS_PASSWORD'] = $dbs->getPassWithoutEncrypt($aFields);
     $aFields['DBS_PASSWORD'] = $aFields['DBS_PASSWORD'] == 'none' ? "" : $aFields['DBS_PASSWORD'];
     $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'], "\\")) {
         $_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']);
Beispiel #2
0
 /**
  * Set a data source
  *
  * @param string $dbsUid DBS_UID to relate the pmTable to phisical table
  */
 public function setDataSource($dbsUid)
 {
     $this->dataSource = self::resolveDbSource($dbsUid);
     switch ($this->dataSource) {
         case 'workflow':
             $this->dbConfig->adapter = DB_ADAPTER;
             $this->dbConfig->host = DB_HOST;
             $this->dbConfig->name = DB_NAME;
             $this->dbConfig->user = DB_USER;
             $this->dbConfig->passwd = DB_PASS;
             $this->dbConfig->port = 3306;
             //FIXME update this when port for workflow dsn will be available
             break;
         case 'rp':
             $this->dbConfig->adapter = DB_ADAPTER;
             $this->dbConfig->host = DB_REPORT_HOST;
             $this->dbConfig->name = DB_REPORT_NAME;
             $this->dbConfig->user = DB_REPORT_USER;
             $this->dbConfig->passwd = DB_REPORT_PASS;
             $this->dbConfig->port = 3306;
             //FIXME update this when port for rp dsn will be available
             break;
         default:
             require_once 'classes/model/DbSource.php';
             $oDBSource = new DbSource();
             $proUid = $oDBSource->getValProUid($this->dataSource);
             $dbSource = $oDBSource->load($this->dataSource, $proUid);
             if (is_object($dbSource)) {
                 $this->dbConfig->adapter = $dbSource->getDbsType();
                 $this->dbConfig->host = $dbSource->getDbsServer();
                 $this->dbConfig->name = $dbSource->getDbsDatabaseName();
                 $this->dbConfig->user = $dbSource->getDbsUsername();
                 $this->dbConfig->passwd = $dbSource->getDbsPassword();
                 $this->dbConfig->port = $dbSource->getDbsPort();
             }
             if (is_array($dbSource)) {
                 $this->dbConfig->adapter = $dbSource['DBS_TYPE'];
                 $this->dbConfig->host = $dbSource['DBS_SERVER'];
                 $this->dbConfig->name = $dbSource['DBS_DATABASE_NAME'];
                 $this->dbConfig->user = $dbSource['DBS_USERNAME'];
                 $this->dbConfig->passwd = $dbSource['DBS_PASSWORD'];
                 $this->dbConfig->port = $dbSource['DBS_PORT'];
             } else {
                 throw new Exception("Db source with id {$dbsUid} does not exist!");
             }
     }
 }
Beispiel #3
0
         }
     }
     $result['totalCount'] = count($rows);
     $result['data'] = $rows;
     print G::json_encode($result);
     break;
 case 'getDatabaseConnectionList':
     $rows = $oProcessMap->getExtCriteriaDBSList($start, $limit, $_GET['pid']);
     $result['totalCount'] = $oProcessMap->getAllDbSourceCount();
     $result['data'] = $rows;
     print G::json_encode($result);
     break;
 case 'editDatabaseConnection':
     require_once 'classes/model/DbSource.php';
     $o = new DbSource();
     $rows = $o->load($_GET['dbs_uid'], $_GET['pid']);
     $tmpData = G::json_encode($rows);
     $tmpData = str_replace("\\/", "/", '{success:true,data:' . $tmpData . '}');
     // unescape the slashes
     $result = $tmpData;
     echo $result;
     break;
 case 'process_Supervisors':
     $rows = $oProcessMap->listExtProcessesSupervisors($start, $limit, $_GET['pid']);
     $result['totalCount'] = $oProcessMap->getAllProcessSupervisorsCount();
     $result['data'] = $rows;
     print G::json_encode($result);
     break;
 case 'availableProcessesSupervisors':
     $rows = $oProcessMap->listExtNoProcessesUser($_GET['pid']);
     $result['totalCount'] = count($rows);
<?php

try {
    G::LoadClass('processMap');
    $oProcessMap = new processMap(new DBConnection());
    if (isset($_GET['pid'])) {
        $rows = $oProcessMap->getExtCriteriaDBSList($_GET['pid']);
    }
    if (isset($_GET['tid'])) {
        require_once 'classes/model/DbSource.php';
        $o = new DbSource();
        $rows = $o->load($_GET['tid']);
    }
    $tmpData = G::json_encode($rows);
    $tmpData = str_replace("\\/", "/", '{success:true,data:' . $tmpData . '}');
    // unescape the slashes
    $result = $tmpData;
    echo $result;
} catch (Exception $e) {
    print G::json_encode($e->getMessage());
}