$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']); $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'], "\\")) { $_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']); $newid = $oDBSource->create($aData); $sDelimiter = DBAdapter::getStringDelimiter(); $oContent->addContent('DBS_DESCRIPTION', '', $newid, SYS_LANG, $_POST['desc']); break; case 'deleteDbConnection': try { $oDBSource = new DbSource(); $oContent = new Content(); $DBS_UID = $_POST['dbs_uid']; $PRO_UID = $_SESSION['PROCESS']; $oDBSource->remove($DBS_UID, $PRO_UID); $oContent->removeContent('DBS_DESCRIPTION', "", $DBS_UID); $result->success = true; $result->msg = G::LoadTranslation('ID_DBCONNECTION_REMOVED'); } catch (Exception $e) { $result->success = false;
/** * Create DB Connections rows from an array of data * * @param array $aConnections * @return void */ public function createDBConnectionsRows ($aConnections) { foreach ($aConnections as $sKey => $aRow) { $oConnection = new DbSource(); if ($oConnection->Exists( $aRow['DBS_UID'], $aRow['PRO_UID'] )) { $oConnection->remove( $aRow['DBS_UID'], $aRow['PRO_UID'] ); } $oConnection->create( $aRow ); // Update information in the table of contents $oContent = new Content(); $ConCategory = 'DBS_DESCRIPTION'; $ConParent = ''; $ConId = $aRow['DBS_UID']; $ConLang = SYS_LANG; if ($oContent->Exists( $ConCategory, $ConParent, $ConId, $ConLang )) { $oContent->removeContent( $ConCategory, $ConParent, $ConId ); } $oContent->addContent( $ConCategory, $ConParent, $ConId, $ConLang, $aRow['DBS_DESCRIPTION'] ); } } #@!neyek