This commit is contained in:
Roly Rudy Gutierrez Pinto
2018-10-19 17:01:49 -04:00
parent 0e84876ee3
commit af2ec6e71c
23 changed files with 171 additions and 280 deletions

View File

@@ -1,6 +1,7 @@
<?php
namespace ProcessMaker\BusinessModel\Cases;
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry;
class OutputDocument
@@ -932,7 +933,7 @@ class OutputDocument
}
copy($sPath . $sFilename . '.html', PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');
try {
$status = $pipeline->process((\G::is_https() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/files/' . $sApplication . '/outdocs/' . $sFilename . '.html', $g_media);
$status = $pipeline->process(System::getServerProtocolHost() . '/files/' . $sApplication . '/outdocs/' . $sFilename . '.html', $g_media);
copy(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf', $sPath . $sFilename . '.pdf');
unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf');
unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');

View File

@@ -1,7 +1,9 @@
<?php
namespace ProcessMaker\BusinessModel;
use \G;
use ProcessMaker\Core\System;
class ProjectUser
{
@@ -222,12 +224,8 @@ class ProjectUser
$sTASKS = $sActivityUID;
$sWS_USER = trim( $oData['username'] );
$sWS_PASS = trim( $oData['password'] );
if (\G::is_https()) {
$http = 'https://';
} else {
$http = 'http://';
}
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2';
$endpoint = System::getServerMainPath() . '/services/wsdl2';
@$client = new \SoapClient( $endpoint );
$user = $sWS_USER;
$pass = $sWS_PASS;
@@ -323,9 +321,7 @@ class ProjectUser
public function userLogin($username, $password)
{
try {
$http = (\G::is_https())? "https://" : "http://";
$client = new \SoapClient($http . $_SERVER["HTTP_HOST"] . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/wsdl2");
$client = new \SoapClient(System::getServerMainPath() . "/services/wsdl2");
$params = array(
"userid" => $username,

View File

@@ -42,7 +42,7 @@ class WebEntry
public function __construct()
{
$this->pathDataPublic = defined("PATH_DATA_PUBLIC") ? PATH_DATA_PUBLIC : \G::$pathDataPublic;
$this->httpHost = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : \G::$httpHost;
$this->httpHost = System::getServerHost();
$this->sysSys = !empty(config("system.workspace")) ? config("system.workspace") : \G::$sysSys;
$this->sysSkin = defined("SYS_SKIN") ? SYS_SKIN : \G::$sysSkin;
try {
@@ -848,9 +848,7 @@ class WebEntry
{
try {
if ((!isset($record['WE_LINK_GENERATION']) || $record['WE_LINK_GENERATION']==='DEFAULT') && $record["WE_METHOD"] == "WS") {
$http = (\G::is_https())? "https://" : "http://";
$url = $http . $_SERVER["HTTP_HOST"] . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $record["PRO_UID"];
$url = System::getServerMainPath() . "/" . $record["PRO_UID"];
$record["WE_DATA"] = $url . "/" . $record["WE_DATA"];
}

View File

@@ -2,30 +2,30 @@
namespace ProcessMaker\BusinessModel;
use WebEntryEventPeer;
use ProcessPeer;
use BasePeer;
use BpmnFlowPeer;
use Content;
use Criteria;
use WebEntryPeer;
use Exception;
use G;
use BpmnFlowPeer;
use ProcessMaker\BusinessModel\Process as BusinessModelProcess;
use ProcessMaker\BusinessModel\Validator as BusinessModelValidator;
use ProcessMaker\Core\System;
use ProcessMaker\Project\Workflow;
use WebEntryEvent as ModelWebEntryEvent;
use ProcessMaker\Util\Common;
use Task as ModelTask;
use ProcessPeer;
use Propel;
use BasePeer;
use Content;
use Tasks;
use Step;
use TaskPeer;
use StepPeer;
use ResultSet;
use Step;
use StepPeer;
use Task as ModelTask;
use TaskPeer;
use Tasks;
use TaskUser;
use TaskUserPeer;
use WebEntryEvent as ModelWebEntryEvent;
use WebEntryEventPeer;
use WebEntryPeer;
class WebEntryEvent
{
@@ -1394,8 +1394,7 @@ class WebEntryEvent
return $url . "/" . $weData;
} else {
$url = $http . $_SERVER["HTTP_HOST"] . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $prj_uid;
$url = System::getServerMainPath() . "/" . $prj_uid;
return $url . "/" . $weData;
}
}

View File

@@ -1321,7 +1321,7 @@ class System
$serverProtocol = ($serverProtocol != '') ? $serverProtocol : ((G::is_https()) ? 'https' : 'http');
$serverHostname = $arraySystemConfiguration['server_hostname_requests_frontend'];
$serverHostname = ($serverHostname != '') ? $serverHostname : $_SERVER['HTTP_HOST'];
$serverHostname = ($serverHostname != '') ? $serverHostname : System::getServerHost();
//Return
return $serverProtocol . '://' . $serverHostname;
@@ -1523,5 +1523,93 @@ class System
config(['connections.report.username' => $dbReportUser]);
config(['connections.report.password' => $dbReportPass]);
}
/**
* Get current server protocol.
*
* @return string
*/
public static function getServerProtocol()
{
return G::is_https() ? "https://" : "http://";
}
/**
* Get current server host
*
* @return string
*/
public static function getServerHostname()
{
$host = "";
if (!empty($_SERVER['SERVER_NAME'])) {
$host = $_SERVER['SERVER_NAME'];
} else if (defined('SERVER_NAME')) {
$host = SERVER_NAME;
}
return $host;
}
/**
* Get current server port.
*
* @return string
*/
public static function getServerPort()
{
$port = "";
if (isset($_SERVER['SERVER_PORT'])) {
$port = $_SERVER['SERVER_PORT'];
} else if (defined('SERVER_PORT')) {
$port = SERVER_PORT;
}
return $port;
}
/**
* Get current host (hostname + port).
*
* @return string
*/
public static function getServerHost()
{
$port = self::getServerPort();
if (!empty($port) && $port != '80') {
$port = ':' . $port;
}
return self::getServerHostname() . $port;
}
/**
* Get current server protocol and host.
*
* @return string
*/
public static function getServerProtocolHost()
{
return self::getServerProtocol() . self::getServerHost();
}
/**
* Get server main path (protocol + host + port + workspace + lang + skin).
*
* @return string
*/
public static function getServerMainPath()
{
$conf = new Configurations();
$skin = defined("SYS_SKIN") ? SYS_SKIN : $conf->getConfiguration('SKIN_CRON', '');
return self::getServerProtocolHost() . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . $skin;
}
/**
* Get default domain mail.
*
* @return string
*/
public static function getDefaultMailDomain()
{
return !empty(self::getServerHostname()) ? self::getServerHostname() : 'processmaker.com';
}
}
// end System class