2014-08-01 13:06:51 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* class.pmDynaform.php
|
|
|
|
|
* Implementing pmDynaform library in the running case.
|
|
|
|
|
*
|
|
|
|
|
* @author Roly Rudy Gutierrez Pinto
|
|
|
|
|
* @package engine.classes
|
|
|
|
|
*/
|
|
|
|
|
class pmDynaform
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public static $instance = null;
|
|
|
|
|
public $dyn_uid = null;
|
|
|
|
|
public $record = null;
|
|
|
|
|
public $app_data = null;
|
2015-02-03 14:40:33 -04:00
|
|
|
public $items = array();
|
|
|
|
|
public $data = array();
|
|
|
|
|
public $variables = array();
|
2015-02-18 15:36:20 -04:00
|
|
|
public $arrayFieldRequired = array();
|
2014-08-01 13:06:51 -04:00
|
|
|
|
2015-02-18 15:36:20 -04:00
|
|
|
public function __construct($dyn_uid, $app_data = array())
|
2015-02-18 09:50:29 -04:00
|
|
|
{
|
2014-08-01 13:06:51 -04:00
|
|
|
$this->dyn_uid = $dyn_uid;
|
|
|
|
|
$this->app_data = $app_data;
|
|
|
|
|
$this->getDynaform();
|
2015-02-18 09:50:29 -04:00
|
|
|
|
2015-02-03 14:40:33 -04:00
|
|
|
//items
|
|
|
|
|
$dynContent = G::json_decode($this->record["DYN_CONTENT"]);
|
|
|
|
|
if (isset($dynContent->items)) {
|
2015-02-25 11:13:30 -04:00
|
|
|
$this->items = $dynContent->items[0]->items;
|
|
|
|
|
$n = count($this->items);
|
|
|
|
|
for ($i = 0; $i < $n; $i++) {
|
|
|
|
|
$m = count($this->items[$i]);
|
|
|
|
|
for ($j = 0; $j < $m; $j++) {
|
|
|
|
|
if (isset($this->items[$i][$j]->required) && $this->items[$i][$j]->required == 1) {
|
2015-02-18 15:36:20 -04:00
|
|
|
array_push($this->arrayFieldRequired, $this->items[$i][$j]->name);
|
2015-02-25 11:13:30 -04:00
|
|
|
}
|
2015-02-18 15:36:20 -04:00
|
|
|
}
|
2015-02-25 11:13:30 -04:00
|
|
|
}
|
2015-02-03 14:40:33 -04:00
|
|
|
}
|
2015-02-25 11:13:30 -04:00
|
|
|
|
2015-02-19 15:08:29 -04:00
|
|
|
if(!empty($app_data) && isset($app_data["APPLICATION"])){
|
2015-02-18 09:50:29 -04:00
|
|
|
//data
|
|
|
|
|
$cases = new \ProcessMaker\BusinessModel\Cases();
|
|
|
|
|
$this->data = $cases->getCaseVariables($app_data["APPLICATION"]);
|
|
|
|
|
|
|
|
|
|
//variables
|
|
|
|
|
$this->variables = array();
|
|
|
|
|
|
|
|
|
|
$a = new Criteria("workflow");
|
|
|
|
|
$a->addSelectColumn(ProcessVariablesPeer::VAR_NAME);
|
|
|
|
|
$a->addSelectColumn(ProcessVariablesPeer::VAR_SQL);
|
|
|
|
|
$a->addSelectColumn(ProcessVariablesPeer::VAR_ACCEPTED_VALUES);
|
|
|
|
|
$a->addSelectColumn(ProcessVariablesPeer::VAR_DBCONNECTION);
|
2015-02-03 14:40:33 -04:00
|
|
|
|
2015-02-18 09:50:29 -04:00
|
|
|
$c3 = $a->getNewCriterion(ProcessVariablesPeer::VAR_ACCEPTED_VALUES, "", Criteria::ALT_NOT_EQUAL);
|
|
|
|
|
$c2 = $a->getNewCriterion(ProcessVariablesPeer::VAR_ACCEPTED_VALUES, "[]", Criteria::ALT_NOT_EQUAL);
|
|
|
|
|
$c2->addAnd($c3);
|
2015-02-03 14:40:33 -04:00
|
|
|
|
2015-02-18 09:50:29 -04:00
|
|
|
$c4 = $a->getNewCriterion(ProcessVariablesPeer::PRJ_UID, $this->app_data["PROCESS"], Criteria::EQUAL);
|
2015-02-03 14:40:33 -04:00
|
|
|
|
2015-02-18 09:50:29 -04:00
|
|
|
$c1 = $a->getNewCriterion(ProcessVariablesPeer::VAR_SQL, "", Criteria::ALT_NOT_EQUAL);
|
|
|
|
|
$c1->addOr($c2);
|
|
|
|
|
$c1->addAnd($c4);
|
2015-02-03 14:40:33 -04:00
|
|
|
|
2015-02-18 09:50:29 -04:00
|
|
|
$a->add($c1);
|
2015-02-03 14:40:33 -04:00
|
|
|
|
2015-02-18 09:50:29 -04:00
|
|
|
$ds = ProcessPeer::doSelectRS($a);
|
|
|
|
|
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
2015-02-03 14:40:33 -04:00
|
|
|
|
2015-02-18 09:50:29 -04:00
|
|
|
while ($ds->next()) {
|
|
|
|
|
$row = $ds->getRow();
|
|
|
|
|
//options
|
2015-02-18 15:36:20 -04:00
|
|
|
$rows2 = G::json_decode($row["VAR_ACCEPTED_VALUES"]);
|
2015-02-18 09:50:29 -04:00
|
|
|
$n = count($rows2);
|
|
|
|
|
for ($i = 0; $i < $n; $i++) {
|
|
|
|
|
$rows2[$i] = array($rows2[$i]->keyValue, $rows2[$i]->value);
|
|
|
|
|
}
|
|
|
|
|
//query
|
|
|
|
|
$arrayVariable = array();
|
2015-02-25 11:13:30 -04:00
|
|
|
if ($row["VAR_DBCONNECTION"] !== "none" && $row["VAR_SQL"] !== "") {
|
2015-02-18 09:50:29 -04:00
|
|
|
$cnn = Propel::getConnection($row["VAR_DBCONNECTION"]);
|
|
|
|
|
$stmt = $cnn->createStatement();
|
|
|
|
|
$rs = $stmt->executeQuery(\G::replaceDataField($row["VAR_SQL"], $arrayVariable), \ResultSet::FETCHMODE_NUM);
|
|
|
|
|
while ($rs->next()) {
|
|
|
|
|
array_push($rows2, $rs->getRow());
|
|
|
|
|
}
|
2015-02-03 14:40:33 -04:00
|
|
|
}
|
2015-02-18 09:50:29 -04:00
|
|
|
$this->variables[$row["VAR_NAME"]] = $rows2;
|
2015-02-03 14:40:33 -04:00
|
|
|
}
|
|
|
|
|
}
|
2015-02-18 09:50:29 -04:00
|
|
|
|
2014-08-01 13:06:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getDynaform()
|
|
|
|
|
{
|
|
|
|
|
if ($this->record != null) {
|
|
|
|
|
return $this->record;
|
|
|
|
|
}
|
|
|
|
|
$a = new Criteria("workflow");
|
|
|
|
|
$a->addSelectColumn(DynaformPeer::DYN_VERSION);
|
|
|
|
|
$a->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
|
|
|
|
$a->addSelectColumn(DynaformPeer::PRO_UID);
|
|
|
|
|
$a->addSelectColumn(DynaformPeer::DYN_UID);
|
|
|
|
|
$a->add(DynaformPeer::DYN_UID, $this->dyn_uid, Criteria::EQUAL);
|
|
|
|
|
$ds = ProcessPeer::doSelectRS($a);
|
|
|
|
|
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
|
|
|
$ds->next();
|
2015-02-18 09:50:29 -04:00
|
|
|
$row = $ds->getRow();
|
2014-08-01 13:06:51 -04:00
|
|
|
$this->record = isset($row) ? $row : null;
|
|
|
|
|
|
|
|
|
|
return $this->record;
|
|
|
|
|
}
|
2015-02-03 14:40:33 -04:00
|
|
|
|
|
|
|
|
private function searchValues($varName, $value)
|
|
|
|
|
{
|
|
|
|
|
if (!$varName || !isset($this->variables[$varName])) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
$options = $this->variables[$varName];
|
|
|
|
|
foreach ($options as $valueOptions) {
|
|
|
|
|
if ($valueOptions[0] === $value) {
|
|
|
|
|
return $valueOptions[1];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function mergeAppData($app_uid, &$items)
|
|
|
|
|
{
|
|
|
|
|
foreach ($items as $key => $value) {
|
|
|
|
|
if (is_array($items[$key])) {
|
|
|
|
|
$this->mergeAppData($app_uid, $items[$key]);
|
|
|
|
|
} else {
|
2015-02-06 14:08:46 -04:00
|
|
|
if (isset($items[$key]->name) && isset($this->data[$items[$key]->name])) {
|
2015-02-03 14:40:33 -04:00
|
|
|
if ($items[$key]->type === "grid") {
|
|
|
|
|
$rows = $this->data[$items[$key]->name];
|
|
|
|
|
foreach ($rows as $keyRow => $row) {
|
|
|
|
|
$newRow = array();
|
|
|
|
|
foreach ($row as $keyCelda => $celda) {
|
|
|
|
|
array_push($newRow, array(
|
|
|
|
|
"value" => $celda,
|
|
|
|
|
"label" => $this->searchValues($keyCelda, $celda)
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
$rows[$keyRow] = $newRow;
|
|
|
|
|
}
|
|
|
|
|
$items[$key]->rows = count($rows);
|
|
|
|
|
$items[$key]->data = $rows;
|
|
|
|
|
}
|
|
|
|
|
if ($items[$key]->type !== "grid") {
|
2015-02-20 14:45:45 -04:00
|
|
|
$value = $this->data[$items[$key]->name];
|
2015-02-20 12:35:32 -04:00
|
|
|
$label = "";
|
|
|
|
|
if (isset($this->data[$items[$key]->name . "_label"])) {
|
|
|
|
|
$value = $this->data[$items[$key]->name];
|
|
|
|
|
$label = $this->data[$items[$key]->name . "_label"];
|
|
|
|
|
}
|
|
|
|
|
if (isset($this->data[$items[$key]->name . "_value"])) {
|
|
|
|
|
$value = $this->data[$items[$key]->name . "_value"];
|
|
|
|
|
$label = $this->data[$items[$key]->name];
|
|
|
|
|
}
|
2015-02-03 14:40:33 -04:00
|
|
|
$items[$key]->data = array(
|
2015-02-20 12:35:32 -04:00
|
|
|
"value" => $value,
|
|
|
|
|
"label" => $label
|
2015-02-03 14:40:33 -04:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (isset($items[$key]->options) && isset($this->variables[$items[$key]->name])) {
|
|
|
|
|
$options = $this->variables[$items[$key]->name];
|
|
|
|
|
$n = count($options);
|
|
|
|
|
for ($i = 0; $i < $n; $i++) {
|
|
|
|
|
$options[$i] = array(
|
|
|
|
|
"value" => $options[$i][0],
|
|
|
|
|
"label" => $options[$i][1]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
$items[$key]->options = $options;
|
|
|
|
|
}
|
2015-02-06 11:11:59 -04:00
|
|
|
if (isset($items[$key]->columns)) {
|
|
|
|
|
$this->mergeAppData($app_uid, $items[$key]->columns);
|
|
|
|
|
}
|
2015-02-03 14:40:33 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-06 11:11:59 -04:00
|
|
|
public function mergeDynContentAppData($app_uid, &$items)
|
2015-02-03 14:40:33 -04:00
|
|
|
{
|
|
|
|
|
$dynContent = G::json_decode($this->record["DYN_CONTENT"]);
|
|
|
|
|
if (isset($dynContent->items)) {
|
|
|
|
|
$this->items = $dynContent->items[0]->items;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-05 12:25:05 -04:00
|
|
|
$this->mergeAppData($app_uid, $items);
|
2015-02-03 14:40:33 -04:00
|
|
|
$dynContent->items[0]->items = $this->items;
|
|
|
|
|
|
|
|
|
|
$a = G::json_encode($dynContent);
|
|
|
|
|
$a = str_replace("\/", "/", $a);
|
|
|
|
|
$this->record["DYN_CONTENT"] = $a;
|
|
|
|
|
}
|
2014-08-01 13:06:51 -04:00
|
|
|
|
|
|
|
|
public function isResponsive()
|
|
|
|
|
{
|
|
|
|
|
return $this->record != null && $this->record["DYN_VERSION"] == 2 ? true : false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function printView($pm_run_outside_main_app, $application)
|
|
|
|
|
{
|
|
|
|
|
ob_clean();
|
2015-02-03 14:40:33 -04:00
|
|
|
$this->mergeDynContentAppData($application, $this->items);
|
|
|
|
|
|
2015-01-13 15:17:51 -04:00
|
|
|
$a = $this->clientToken();
|
|
|
|
|
$clientToken = array(
|
|
|
|
|
"accessToken" => $a["access_token"],
|
|
|
|
|
"expiresIn" => $a["expires_in"],
|
|
|
|
|
"tokenType" => $a["token_type"],
|
|
|
|
|
"scope" => $a["scope"],
|
|
|
|
|
"refreshToken" => $a["refresh_token"],
|
|
|
|
|
"clientId" => $a["client_id"],
|
|
|
|
|
"clientSecret" => $a["client_secret"]
|
|
|
|
|
);
|
|
|
|
|
|
2014-08-01 13:06:51 -04:00
|
|
|
$file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform_View.html');
|
|
|
|
|
$file = str_replace("{JSON_DATA}", $this->record["DYN_CONTENT"], $file);
|
|
|
|
|
$file = str_replace("{PM_RUN_OUTSIDE_MAIN_APP}", $pm_run_outside_main_app, $file);
|
|
|
|
|
$file = str_replace("{DYN_UID}", $this->dyn_uid, $file);
|
|
|
|
|
$file = str_replace("{DYNAFORMNAME}", $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"], $file);
|
|
|
|
|
$file = str_replace("{APP_UID}", $application, $file);
|
2015-01-13 15:17:51 -04:00
|
|
|
$file = str_replace("{PRJ_UID}", $this->app_data["PROCESS"], $file);
|
|
|
|
|
$file = str_replace("{WORKSPACE}", $this->app_data["SYS_SYS"], $file);
|
|
|
|
|
$file = str_replace("{credentials}", json_encode($clientToken), $file);
|
2014-08-01 13:06:51 -04:00
|
|
|
echo $file;
|
|
|
|
|
exit();
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-23 11:54:59 -04:00
|
|
|
public function printEdit($pm_run_outside_main_app, $application, $headData, $step_mode = 'EDIT')
|
2014-08-01 13:06:51 -04:00
|
|
|
{
|
|
|
|
|
ob_clean();
|
2015-02-03 14:40:33 -04:00
|
|
|
$this->mergeDynContentAppData($application, $this->items);
|
|
|
|
|
|
2014-08-29 11:19:14 -04:00
|
|
|
$a = $this->clientToken();
|
|
|
|
|
$clientToken = array(
|
|
|
|
|
"accessToken" => $a["access_token"],
|
|
|
|
|
"expiresIn" => $a["expires_in"],
|
|
|
|
|
"tokenType" => $a["token_type"],
|
|
|
|
|
"scope" => $a["scope"],
|
|
|
|
|
"refreshToken" => $a["refresh_token"],
|
|
|
|
|
"clientId" => $a["client_id"],
|
|
|
|
|
"clientSecret" => $a["client_secret"]
|
|
|
|
|
);
|
|
|
|
|
|
2014-08-01 13:06:51 -04:00
|
|
|
$file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform.html');
|
|
|
|
|
$file = str_replace("{JSON_DATA}", $this->record["DYN_CONTENT"], $file);
|
|
|
|
|
$file = str_replace("{CASE}", $headData["CASE"], $file);
|
|
|
|
|
$file = str_replace("{APP_NUMBER}", $headData["APP_NUMBER"], $file);
|
|
|
|
|
$file = str_replace("{TITLE}", $headData["TITLE"], $file);
|
|
|
|
|
$file = str_replace("{APP_TITLE}", $headData["APP_TITLE"], $file);
|
|
|
|
|
$file = str_replace("{PM_RUN_OUTSIDE_MAIN_APP}", $pm_run_outside_main_app, $file);
|
|
|
|
|
$file = str_replace("{DYN_UID}", $this->dyn_uid, $file);
|
|
|
|
|
$file = str_replace("{DYNAFORMNAME}", $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"], $file);
|
|
|
|
|
$file = str_replace("{APP_UID}", $application, $file);
|
2014-08-29 11:19:14 -04:00
|
|
|
$file = str_replace("{PRJ_UID}", $this->app_data["PROCESS"], $file);
|
2015-01-23 11:54:59 -04:00
|
|
|
$file = str_replace("{STEP_MODE}", $step_mode, $file);
|
2014-08-29 11:19:14 -04:00
|
|
|
$file = str_replace("{WORKSPACE}", $this->app_data["SYS_SYS"], $file);
|
2015-02-18 15:36:20 -04:00
|
|
|
$file = str_replace("{PORT}", $_SERVER["SERVER_PORT"] , $file);
|
|
|
|
|
$file = str_replace("{credentials}", G::json_encode($clientToken), $file);
|
2014-08-01 13:06:51 -04:00
|
|
|
echo $file;
|
|
|
|
|
exit();
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-18 15:36:20 -04:00
|
|
|
public function printWebEntry($filename)
|
2015-02-18 09:50:29 -04:00
|
|
|
{
|
|
|
|
|
ob_clean();
|
|
|
|
|
$a = $this->clientToken();
|
|
|
|
|
$clientToken = array(
|
|
|
|
|
"accessToken" => $a["access_token"],
|
|
|
|
|
"expiresIn" => $a["expires_in"],
|
|
|
|
|
"tokenType" => $a["token_type"],
|
|
|
|
|
"scope" => $a["scope"],
|
|
|
|
|
"refreshToken" => $a["refresh_token"],
|
|
|
|
|
"clientId" => $a["client_id"],
|
|
|
|
|
"clientSecret" => $a["client_secret"]
|
|
|
|
|
);
|
|
|
|
|
$file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/WebEntry_Pmdynaform.html');
|
|
|
|
|
$file = str_replace("{JSON_DATA}", $this->record["DYN_CONTENT"], $file);
|
|
|
|
|
$file = str_replace("{DYN_UID}", $this->dyn_uid, $file);
|
|
|
|
|
$file = str_replace("{PRJ_UID}",$this->record["PRO_UID"], $file);
|
|
|
|
|
$file = str_replace("{WORKSPACE}", SYS_SYS, $file);
|
2015-02-18 15:36:20 -04:00
|
|
|
$file = str_replace("{FILEPOST}", $filename, $file);
|
|
|
|
|
$file = str_replace("{PORT}", $_SERVER["SERVER_PORT"] , $file);
|
|
|
|
|
$file = str_replace("{credentials}", G::json_encode($clientToken), $file);
|
|
|
|
|
$file = str_replace("{FIELDSREQUIRED}", G::json_encode($this->arrayFieldRequired), $file);
|
|
|
|
|
echo $file;
|
2015-02-18 09:50:29 -04:00
|
|
|
exit();
|
|
|
|
|
}
|
2015-02-18 15:36:20 -04:00
|
|
|
|
2014-08-29 11:19:14 -04:00
|
|
|
private function clientToken()
|
|
|
|
|
{
|
|
|
|
|
$client = $this->getClientCredentials();
|
|
|
|
|
$authCode = $this->getAuthorizationCode($client);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$request = array(
|
|
|
|
|
'grant_type' => 'authorization_code',
|
|
|
|
|
'code' => $authCode
|
|
|
|
|
);
|
|
|
|
|
$server = array(
|
|
|
|
|
'REQUEST_METHOD' => 'POST'
|
|
|
|
|
);
|
|
|
|
|
$headers = array(
|
|
|
|
|
"PHP_AUTH_USER" => $client['CLIENT_ID'],
|
|
|
|
|
"PHP_AUTH_PW" => $client['CLIENT_SECRET'],
|
|
|
|
|
"Content-Type" => "multipart/form-data;",
|
|
|
|
|
"Authorization" => "Basic " . base64_encode($client['CLIENT_ID'] . ":" . $client['CLIENT_SECRET'])
|
|
|
|
|
);
|
2014-08-01 13:06:51 -04:00
|
|
|
|
2014-08-29 11:19:14 -04:00
|
|
|
$request = new \OAuth2\Request(array(), $request, array(), array(), array(), $server, null, $headers);
|
|
|
|
|
$oauthServer = new \ProcessMaker\Services\OAuth2\Server();
|
|
|
|
|
$response = $oauthServer->getServer()->handleTokenRequest($request);
|
|
|
|
|
$clientToken = $response->getParameters();
|
|
|
|
|
$clientToken["client_id"] = $client['CLIENT_ID'];
|
|
|
|
|
$clientToken["client_secret"] = $client['CLIENT_SECRET'];
|
|
|
|
|
|
|
|
|
|
return $clientToken;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected $clientId = 'x-pm-local-client';
|
|
|
|
|
|
|
|
|
|
protected function getClientCredentials()
|
|
|
|
|
{
|
|
|
|
|
$oauthQuery = new ProcessMaker\Services\OAuth2\PmPdo($this->getDsn());
|
|
|
|
|
return $oauthQuery->getClientDetails($this->clientId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function getAuthorizationCode($client)
|
|
|
|
|
{
|
|
|
|
|
\ProcessMaker\Services\OAuth2\Server::setDatabaseSource($this->getDsn());
|
|
|
|
|
\ProcessMaker\Services\OAuth2\Server::setPmClientId($client['CLIENT_ID']);
|
|
|
|
|
|
|
|
|
|
$oauthServer = new \ProcessMaker\Services\OAuth2\Server();
|
|
|
|
|
$userId = $_SESSION['USER_LOGGED'];
|
|
|
|
|
$authorize = true;
|
|
|
|
|
$_GET = array_merge($_GET, array(
|
|
|
|
|
'response_type' => 'code',
|
|
|
|
|
'client_id' => $client['CLIENT_ID'],
|
|
|
|
|
'scope' => implode(' ', $oauthServer->getScope())
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$response = $oauthServer->postAuthorize($authorize, $userId, true);
|
|
|
|
|
$code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=') + 5, 40);
|
|
|
|
|
|
|
|
|
|
return $code;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getDsn()
|
|
|
|
|
{
|
|
|
|
|
list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
|
|
|
|
|
$port = empty($port) ? '' : ";port=$port";
|
|
|
|
|
$dsn = DB_ADAPTER . ':host=' . $host . ';dbname=' . DB_NAME . $port;
|
|
|
|
|
|
|
|
|
|
return array('dsn' => $dsn, 'username' => DB_USER, 'password' => DB_PASS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|