Merged in release/3.2.2 (pull request #6059)
Updating branch release/3.2.3 with the last changes made on branch release/3.2.2 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -748,6 +748,7 @@ class headPublisher
|
||||
*/
|
||||
public function getExtJsViewState()
|
||||
{
|
||||
$json = new stdClass();
|
||||
$views = array();
|
||||
$keyState = "extJsViewState";
|
||||
$prefixExtJs = "ys-";
|
||||
@@ -772,7 +773,9 @@ class headPublisher
|
||||
$views[$key] = $value[1];
|
||||
}
|
||||
}
|
||||
if ((array)$json != $views) {
|
||||
$oServerConf->setProperty($keyState, G::json_encode($views));
|
||||
}
|
||||
return $views;
|
||||
}
|
||||
|
||||
|
||||
@@ -389,6 +389,8 @@ class RBAC
|
||||
"PER_NAME" => "Edit User profile Default Cases Menu Options"
|
||||
), array("PER_UID" => "00000000000000000000000000000064", "PER_CODE" => "PM_REASSIGNCASE_SUPERVISOR",
|
||||
"PER_NAME" => "Reassign case supervisor"
|
||||
), array("PER_UID" => "00000000000000000000000000000065", "PER_CODE" => "PM_SETUP_CUSTOM_CASES_LIST",
|
||||
"PER_NAME" => "Setup Custom Cases List"
|
||||
)
|
||||
);
|
||||
return $permissionsAdmin;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\BusinessModel\DynaForm\SuggestTrait;
|
||||
|
||||
/**
|
||||
* Implementing pmDynaform library in the running case.
|
||||
@@ -9,6 +10,7 @@ use ProcessMaker\Core\System;
|
||||
*/
|
||||
class PmDynaform
|
||||
{
|
||||
use SuggestTrait;
|
||||
|
||||
public static $instance = null;
|
||||
public $fields = null;
|
||||
@@ -256,66 +258,7 @@ class PmDynaform
|
||||
}
|
||||
$sql = G::replaceDataField($json->sql, $dtFields);
|
||||
if ($value === "suggest") {
|
||||
$sql = $this->sqlParse($sql, function($parsed, &$select, &$from, &$where, &$groupBy, &$having, &$orderBy, &$limit) use ($json) {
|
||||
$dt = $parsed["SELECT"];
|
||||
|
||||
$isWhere = empty($where);
|
||||
if ($isWhere === false) {
|
||||
$where = substr_replace($where, " (", 5, 0) . ")";
|
||||
}
|
||||
if (!isset($json->queryField) && isset($dt[0]["base_expr"])) {
|
||||
$col = $dt[0]["base_expr"];
|
||||
$dv = str_replace("'", "''", $json->defaultValue);
|
||||
if ($dv !== "") {
|
||||
$where = $isWhere ? "WHERE " . $col . "='" . $dv . "'" : $where . " AND " . $col . "='" . $dv . "'";
|
||||
}
|
||||
}
|
||||
if (isset($json->queryField) && isset($dt[0]["base_expr"])) {
|
||||
$col = isset($dt[1]["base_expr"]) ? $dt[1]["base_expr"] : $dt[0]["base_expr"];
|
||||
$qf = str_replace("'", "''", $json->queryFilter);
|
||||
$where = $isWhere ? "WHERE " . $col . " LIKE '%" . $qf . "%'" : $where . " AND " . $col . " LIKE '%" . $qf . "%'";
|
||||
}
|
||||
|
||||
$provider = $this->getDatabaseProvider($json->dbConnection);
|
||||
$start = 0;
|
||||
$end = 10;
|
||||
if (isset($json->queryStart)) {
|
||||
$start = $json->queryStart;
|
||||
}
|
||||
if (isset($json->queryLimit)) {
|
||||
$end = $json->queryLimit;
|
||||
}
|
||||
if (empty($limit) && $provider === "mysql") {
|
||||
$limit = "LIMIT " . $start . "," . $end . "";
|
||||
}
|
||||
if (empty($limit) && $provider === "pgsql") {
|
||||
$limit = "OFFSET " . $start . " LIMIT " . $end . "";
|
||||
}
|
||||
if ($provider === "mssql") {
|
||||
$limit = "";
|
||||
if (strpos(strtoupper($select), "TOP") === false) {
|
||||
$isDistinct = strpos(strtoupper($select), "DISTINCT");
|
||||
$isAll = strpos(strtoupper($select), "ALL");
|
||||
if ($isDistinct === false && $isAll === false) {
|
||||
$select = preg_replace("/SELECT/", "SELECT TOP(" . $end . ")", strtoupper($select), 1);
|
||||
}
|
||||
if ($isDistinct !== false) {
|
||||
$select = preg_replace("/DISTINCT/", "DISTINCT TOP(" . $end . ")", strtoupper($select), 1);
|
||||
}
|
||||
if ($isAll !== false) {
|
||||
$select = preg_replace("/DISTINCT/", "DISTINCT TOP(" . $end . ")", strtoupper($select), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($provider === "oracle") {
|
||||
$limit = "";
|
||||
$rowNumber = "";
|
||||
if (strpos(strtoupper($where), "ROWNUM") === false) {
|
||||
$rowNumber = " AND " . $start . " <= ROWNUM AND ROWNUM <= " . $end;
|
||||
}
|
||||
$where = empty($where) ? "WHERE " . $start . " <= ROWNUM AND ROWNUM <= " . $end : $where . $rowNumber;
|
||||
}
|
||||
});
|
||||
$sql = $this->prepareSuggestSql($sql, $json);
|
||||
}
|
||||
$dt = $this->getCacheQueryData($json->dbConnection, $sql, $json->type);
|
||||
foreach ($dt as $row) {
|
||||
|
||||
@@ -7,7 +7,6 @@ use Illuminate\Support\Facades\Cache;
|
||||
* class.pmLicenseManager.php
|
||||
*
|
||||
*/
|
||||
|
||||
class PmLicenseManager
|
||||
{
|
||||
const CACHE_KEY = 'license';
|
||||
@@ -17,20 +16,13 @@ class PmLicenseManager
|
||||
public function __construct($flagActivatePlugins = true)
|
||||
{
|
||||
$oServerConf = &ServerConf::getSingleton();
|
||||
|
||||
if ($oServerConf->getProperty('LOGIN_NO_WS') === null || $oServerConf->getProperty('LOGIN_NO_WS') === false) {
|
||||
$oServerConf->setProperty('LOGIN_NO_WS', true);
|
||||
|
||||
//to do: this files probably needs to be in core, since they are GPL2
|
||||
//include_once (PATH_PLUGINS . 'enterprise' . PATH_SEP . 'classes' . PATH_SEP . 'class.license.lib.php');
|
||||
//include_once (PATH_PLUGINS . 'enterprise' . PATH_SEP . 'classes' . PATH_SEP . 'class.license.app.php');
|
||||
|
||||
}
|
||||
|
||||
//searching .dat files in workspace folder
|
||||
$server_array = $_SERVER;
|
||||
$licfile = glob(PATH_DATA_SITE . "*.dat");
|
||||
|
||||
if (count($licfile) > 0 && is_file($licfile[0])) {
|
||||
$oServerConf->setProperty('ACTIVE_LICENSE', array(SYS_SYS => ""));
|
||||
}
|
||||
|
||||
$activeLicenseSetting = $oServerConf->getProperty('ACTIVE_LICENSE');
|
||||
|
||||
@@ -38,7 +30,7 @@ class PmLicenseManager
|
||||
$licenseFile = $activeLicenseSetting[SYS_SYS];
|
||||
} else {
|
||||
$activeLicense = $this->getActiveLicense();
|
||||
$oServerConf->setProperty('ACTIVE_LICENSE', array(SYS_SYS => $activeLicense ['LICENSE_PATH']));
|
||||
$oServerConf->setProperty('ACTIVE_LICENSE', [SYS_SYS => $activeLicense['LICENSE_PATH']]);
|
||||
$licenseFile = $activeLicense['LICENSE_PATH'];
|
||||
}
|
||||
|
||||
@@ -46,33 +38,34 @@ class PmLicenseManager
|
||||
$application->set_server_vars($server_array);
|
||||
$application->DATE_STRING = 'Y-m-d H:i:s';
|
||||
$results = $application->validate();
|
||||
$validStatus = array(
|
||||
$validStatus = [
|
||||
'OK',
|
||||
'EXPIRED',
|
||||
'TMINUS'
|
||||
);
|
||||
];
|
||||
|
||||
$this->result = $results['RESULT'];
|
||||
$this->features = array();
|
||||
$this->licensedfeatures = array();
|
||||
$this->licensedfeaturesList = array();
|
||||
$this->features = [];
|
||||
$this->licensedfeatures = [];
|
||||
$this->licensedfeaturesList = [];
|
||||
if (in_array($this->result, $validStatus)) {
|
||||
$this->serial="3ptta7Xko2prrptrZnSd356aqmPXvMrayNPFj6CLdaR1pWtrW6qPw9jV0OHjxrDGu8LVxtmSm9nP5kR23HRpdZWccpeui+bKkK°DoqCt2Kqgpq6Vg37s";
|
||||
$this->serial = "3ptta7Xko2prrptrZnSd356aqmPXvMrayNPFj6CLdaR1pWtrW6qPw9jV0OHjxrDGu8LVxtmSm9nP5kR23HRpdZWccpeui+bKkK°DoqCt2Kqgpq6Vg37s";
|
||||
$info = [];
|
||||
$info['FIRST_NAME'] = $results['DATA']['FIRST_NAME'];
|
||||
$info['LAST_NAME'] = $results['DATA']['LAST_NAME'];
|
||||
$info['DOMAIN_WORKSPACE'] = $results['DATA']['DOMAIN_WORKSPACE'];
|
||||
$this->date = $results ['DATE'];
|
||||
$this->info = $info;
|
||||
$this->type = $results ['DATA']['TYPE'];
|
||||
$this->plan = isset($results ['DATA']['PLAN'])?$results ['DATA']['PLAN']:"";
|
||||
$this->plan = isset($results ['DATA']['PLAN']) ? $results ['DATA']['PLAN'] : "";
|
||||
$this->id = $results ['ID'];
|
||||
$this->expireIn = $this->getExpireIn ();
|
||||
$this->features = $this->result!='TMINUS'?isset($results ['DATA']['CUSTOMER_PLUGIN'])? $results ['DATA']['CUSTOMER_PLUGIN'] : $this->getActiveFeatures() : array();
|
||||
$this->licensedfeatures = $this->result != 'TMINUS' ? (isset($results ['DATA']['CUSTOMER_LICENSED_FEATURES']) && is_array($results ['DATA']['CUSTOMER_LICENSED_FEATURES'])) ? $results ['DATA']['CUSTOMER_LICENSED_FEATURES'] : array() : array();
|
||||
$this->licensedfeaturesList = isset($results ['DATA']['LICENSED_FEATURES_LIST'])? $results ['DATA']['LICENSED_FEATURES_LIST'] : null;
|
||||
$this->status = $this->getCurrentLicenseStatus ();
|
||||
$this->expireIn = $this->getExpireIn();
|
||||
$this->features = $this->result != 'TMINUS' ? isset($results ['DATA']['CUSTOMER_PLUGIN']) ? $results ['DATA']['CUSTOMER_PLUGIN'] : $this->getActiveFeatures() : [];
|
||||
$this->licensedfeatures = $this->result != 'TMINUS' ? (isset($results ['DATA']['CUSTOMER_LICENSED_FEATURES']) && is_array($results ['DATA']['CUSTOMER_LICENSED_FEATURES'])) ? $results ['DATA']['CUSTOMER_LICENSED_FEATURES'] : [] : [];
|
||||
$this->licensedfeaturesList = isset($results ['DATA']['LICENSED_FEATURES_LIST']) ? $results ['DATA']['LICENSED_FEATURES_LIST'] : null;
|
||||
$this->status = $this->getCurrentLicenseStatus();
|
||||
|
||||
if (isset ( $results ['LIC'] )) {
|
||||
if (isset ($results ['LIC'])) {
|
||||
$resultsRegister = $results['LIC'];
|
||||
$this->server = $results['LIC']['SRV'];
|
||||
$this->file = $results['LIC']['FILE'];
|
||||
@@ -84,7 +77,7 @@ class PmLicenseManager
|
||||
$this->supportEndDate = date("Y-m-d H:i:s", strtotime($this->supportEndDate));
|
||||
|
||||
$conf = new Configurations();
|
||||
if ( defined('SYS_SYS') && $conf->exists("ENVIRONMENT_SETTINGS")) {
|
||||
if (defined('SYS_SYS') && $conf->exists("ENVIRONMENT_SETTINGS")) {
|
||||
$this->supportStartDate = $conf->getSystemDate($this->supportStartDate);
|
||||
$this->supportEndDate = $conf->getSystemDate($this->supportEndDate);
|
||||
} else {
|
||||
@@ -92,22 +85,34 @@ class PmLicenseManager
|
||||
$this->supportEndDate = G::getformatedDate($this->supportEndDate, 'M d, yyyy', SYS_LANG);
|
||||
}
|
||||
} else {
|
||||
$resultsRegister=array();
|
||||
$resultsRegister['ID']=$results ['DATA'] ['DOMAIN_WORKSPACE'];
|
||||
$resultsRegister = [];
|
||||
$resultsRegister['ID'] = $results['DATA']['DOMAIN_WORKSPACE'];
|
||||
$this->server = null;
|
||||
$this->file = null;
|
||||
}
|
||||
|
||||
// The HUMAN attribute varies according to the timezone configured in the server, therefore it does not need
|
||||
// to be considered in the comparison if the value was changed or not, it is only comparing with te "timestamp"
|
||||
if (isset($results['DATE']['HUMAN'])) {
|
||||
unset($results['DATE']['HUMAN']);
|
||||
}
|
||||
$resultsRegister['date'] = $results ['DATE'];
|
||||
$resultsRegister['info'] = $info;
|
||||
$resultsRegister['type'] = $results ['DATA'] ['TYPE'];
|
||||
if ($oServerConf->getProperty ( 'LICENSE_INFO')) {
|
||||
$licInfoA = $oServerConf->getProperty ( 'LICENSE_INFO');
|
||||
} else {
|
||||
$licInfoA = array();
|
||||
if ($oServerConf->getProperty('LICENSE_INFO')) {
|
||||
$licInfoA = $oServerConf->getProperty('LICENSE_INFO');
|
||||
// The HUMAN attribute varies according to the timezone configured in the server, therefore it does not need
|
||||
// to be considered in the comparison if the value was changed or not, it is only comparing with te "timestamp"
|
||||
if (isset($licInfoA[SYS_SYS]['date']['HUMAN'])) {
|
||||
unset($licInfoA[SYS_SYS]['date']['HUMAN']);
|
||||
}
|
||||
} else {
|
||||
$licInfoA = [];
|
||||
}
|
||||
if (empty($licInfoA[SYS_SYS]) || ($licInfoA[SYS_SYS] != $resultsRegister)) {
|
||||
$licInfoA[SYS_SYS] = $resultsRegister;
|
||||
$oServerConf->setProperty('LICENSE_INFO', $licInfoA);
|
||||
}
|
||||
$licInfoA[SYS_SYS]=$resultsRegister;
|
||||
$oServerConf->setProperty ( 'LICENSE_INFO', $licInfoA );
|
||||
}
|
||||
|
||||
if ($flagActivatePlugins) {
|
||||
@@ -125,23 +130,23 @@ class PmLicenseManager
|
||||
|
||||
public function serializeInstance()
|
||||
{
|
||||
return serialize ( self::$instance );
|
||||
return serialize(self::$instance);
|
||||
}
|
||||
|
||||
public function activateFeatures()
|
||||
{
|
||||
//Get a list of all Enterprise plugins and active/inactive them
|
||||
if (file_exists ( PATH_PLUGINS . 'enterprise/data/default' )) {
|
||||
if ($this->result=="OK") {
|
||||
if (file_exists(PATH_PLUGINS . 'enterprise/data/default')) {
|
||||
if ($this->result == "OK") {
|
||||
//Disable
|
||||
if (file_exists ( PATH_PLUGINS . 'enterprise/data/data' )) {
|
||||
if (file_exists(PATH_PLUGINS . 'enterprise/data/data')) {
|
||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||
$aPlugins = unserialize ( trim ( file_get_contents ( PATH_PLUGINS . 'enterprise/data/data' ) ) );
|
||||
$aPlugins = unserialize(trim(file_get_contents(PATH_PLUGINS . 'enterprise/data/data')));
|
||||
foreach ($aPlugins as $aPlugin) {
|
||||
$sClassName = substr ( $aPlugin ['sFilename'], 0, strpos ( $aPlugin ['sFilename'], '-' ) );
|
||||
$sClassName = substr($aPlugin ['sFilename'], 0, strpos($aPlugin ['sFilename'], '-'));
|
||||
require_once PATH_PLUGINS . $sClassName . '.php';
|
||||
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
|
||||
$oPluginRegistry->disablePlugin ( $oDetails->getNamespace() );
|
||||
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
|
||||
$oPluginRegistry->disablePlugin($oDetails->getNamespace());
|
||||
$oPluginRegistry->savePlugin($oDetails->getNamespace());
|
||||
}
|
||||
unlink(PATH_PLUGINS . 'enterprise/data/data');
|
||||
@@ -154,7 +159,7 @@ class PmLicenseManager
|
||||
foreach ($aPlugins as $aPlugin) {
|
||||
if ($aPlugin ["bActive"]) {
|
||||
$sClassName = substr($aPlugin["sFilename"], 0, strpos($aPlugin["sFilename"], "-"));
|
||||
require_once (PATH_PLUGINS . $sClassName . ".php");
|
||||
require_once(PATH_PLUGINS . $sClassName . ".php");
|
||||
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . ".php");
|
||||
$oPluginRegistry->enablePlugin($oDetails->getNamespace());
|
||||
$oPluginRegistry->savePlugin($oDetails->getNamespace());
|
||||
@@ -162,56 +167,57 @@ class PmLicenseManager
|
||||
}
|
||||
|
||||
if (file_exists(PATH_DATA_SITE . "ee")) {
|
||||
$aPlugins = unserialize ( trim ( file_get_contents ( PATH_DATA_SITE.'ee' ) ) );
|
||||
$aDenied=array();
|
||||
$aPlugins = unserialize(trim(file_get_contents(PATH_DATA_SITE . 'ee')));
|
||||
$aDenied = [];
|
||||
foreach ($aPlugins as $aPlugin) {
|
||||
$sClassName = substr ( $aPlugin ['sFilename'], 0, strpos ( $aPlugin ['sFilename'], '-' ) );
|
||||
if (!(in_array($sClassName,$this->features))) {
|
||||
$sClassName = substr($aPlugin ['sFilename'], 0, strpos($aPlugin ['sFilename'], '-'));
|
||||
if (!(in_array($sClassName, $this->features))) {
|
||||
if (file_exists(PATH_PLUGINS . $sClassName . '.php')) {
|
||||
require_once PATH_PLUGINS . $sClassName . '.php';
|
||||
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
|
||||
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
|
||||
$oPluginRegistry->disablePlugin($oDetails->getNamespace());
|
||||
$oPluginRegistry->savePlugin($oDetails->getNamespace());
|
||||
$aDenied[]=$oDetails->getNamespace();
|
||||
$aDenied[] = $oDetails->getNamespace();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(empty($aDenied))) {
|
||||
if ((SYS_COLLECTION=="enterprise")&&(SYS_TARGET=="pluginsList")) {
|
||||
G::SendMessageText("The following plugins were restricted due to your enterprise license: ".implode(", ",$aDenied),"INFO");
|
||||
if ((SYS_COLLECTION == "enterprise") && (SYS_TARGET == "pluginsList")) {
|
||||
G::SendMessageText("The following plugins were restricted due to your enterprise license: " . implode(", ",
|
||||
$aDenied), "INFO");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//Disable
|
||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||
$aPlugins = unserialize ( trim ( file_get_contents ( PATH_PLUGINS . 'enterprise/data/default' ) ) );
|
||||
$aPlugins = unserialize(trim(file_get_contents(PATH_PLUGINS . 'enterprise/data/default')));
|
||||
foreach ($aPlugins as $aPlugin) {
|
||||
$sClassName = substr ( $aPlugin ['sFilename'], 0, strpos ( $aPlugin ['sFilename'], '-' ) );
|
||||
$sClassName = substr($aPlugin ['sFilename'], 0, strpos($aPlugin ['sFilename'], '-'));
|
||||
//To avoid self disable
|
||||
if (($sClassName != "pmLicenseManager") && ($sClassName != "pmTrial") && ($sClassName != "enterprise")) {
|
||||
require_once PATH_PLUGINS . $sClassName . '.php';
|
||||
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
|
||||
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
|
||||
$oPluginRegistry->disablePlugin($oDetails->getNamespace());
|
||||
} else {
|
||||
//Enable default and required plugins
|
||||
require_once PATH_PLUGINS . $sClassName . '.php';
|
||||
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
|
||||
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
|
||||
$oPluginRegistry->enablePlugin($oDetails->getNamespace());
|
||||
}
|
||||
$oPluginRegistry->savePlugin($oDetails->getNamespace());
|
||||
}
|
||||
|
||||
if (file_exists(PATH_DATA_SITE.'ee')) {
|
||||
$aPlugins = unserialize ( trim ( file_get_contents ( PATH_DATA_SITE.'ee' ) ) );
|
||||
if (file_exists(PATH_DATA_SITE . 'ee')) {
|
||||
$aPlugins = unserialize(trim(file_get_contents(PATH_DATA_SITE . 'ee')));
|
||||
|
||||
foreach ($aPlugins as $aPlugin) {
|
||||
$sClassName = substr ( $aPlugin ['sFilename'], 0, strpos ( $aPlugin ['sFilename'], '-' ) );
|
||||
if ( strlen($sClassName) > 0 ) {
|
||||
$sClassName = substr($aPlugin ['sFilename'], 0, strpos($aPlugin ['sFilename'], '-'));
|
||||
if (strlen($sClassName) > 0) {
|
||||
if (!class_exists($sClassName)) {
|
||||
require_once PATH_PLUGINS . $sClassName . '.php';
|
||||
}
|
||||
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
|
||||
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
|
||||
if ($oDetails) {
|
||||
$oPluginRegistry->disablePlugin($oDetails->getNamespace());
|
||||
$oPluginRegistry->savePlugin($oDetails->getNamespace());
|
||||
@@ -225,7 +231,7 @@ class PmLicenseManager
|
||||
|
||||
public function getCurrentLicenseStatus()
|
||||
{
|
||||
$result = array ();
|
||||
$result = [];
|
||||
switch ($this->result) {
|
||||
case 'OK':
|
||||
$result ['result'] = 'ok';
|
||||
@@ -233,8 +239,8 @@ class PmLicenseManager
|
||||
break;
|
||||
case 'TMINUS':
|
||||
$result ['result'] = 'tminus';
|
||||
$startDateA=explode(" ",$this->date['HUMAN']['START']);
|
||||
$result ['message'] = "License will be active on ".$startDateA[0];
|
||||
$startDateA = explode(" ", $this->date['HUMAN']['START']);
|
||||
$result ['message'] = "License will be active on " . $startDateA[0];
|
||||
break;
|
||||
case 'EXPIRED':
|
||||
$result ['result'] = 'expired';
|
||||
@@ -255,7 +261,7 @@ class PmLicenseManager
|
||||
case 'EMPTY':
|
||||
$result ['result'] = 'empty';
|
||||
$result ['message'] = "Empty License";
|
||||
if (defined ( 'write_error' )) {
|
||||
if (defined('write_error')) {
|
||||
$result ['message'] = "Write error" . $result ['message'];
|
||||
}
|
||||
break;
|
||||
@@ -270,17 +276,17 @@ class PmLicenseManager
|
||||
if (self::$instance == null) {
|
||||
self::$instance = new PluginRegistry();
|
||||
}
|
||||
$instance = unserialize ( $serialized );
|
||||
$instance = unserialize($serialized);
|
||||
self::$instance = $instance;
|
||||
}
|
||||
|
||||
public function getExpireIn()
|
||||
{
|
||||
$status = $this->getCurrentLicenseStatus ();
|
||||
$status = $this->getCurrentLicenseStatus();
|
||||
$expireIn = 0;
|
||||
if ($status ['result'] == 'ok') {
|
||||
if ($this->date ['END']!="NEVER") {
|
||||
$expireIn = ceil ( ($this->date ['END'] - time ()) / 60 / 60 / 24 );
|
||||
if ($this->date ['END'] != "NEVER") {
|
||||
$expireIn = ceil(($this->date ['END'] - time()) / 60 / 60 / 24);
|
||||
} else {
|
||||
$expireIn = "NEVER";
|
||||
}
|
||||
@@ -290,17 +296,17 @@ class PmLicenseManager
|
||||
|
||||
public function getLicenseInfo()
|
||||
{
|
||||
$validStatus = array (
|
||||
$validStatus = [
|
||||
'ok',
|
||||
'expired'
|
||||
);
|
||||
$status = $this->getCurrentLicenseStatus ();
|
||||
];
|
||||
$status = $this->getCurrentLicenseStatus();
|
||||
$infoText = "";
|
||||
if (in_array ( $status ['result'], $validStatus )) {
|
||||
$start = explode ( " ", $this->date ['HUMAN'] ['START'] );
|
||||
$end = explode ( " ", $this->date ['HUMAN'] ['END'] );
|
||||
if (in_array($status ['result'], $validStatus)) {
|
||||
$start = explode(" ", $this->date ['HUMAN'] ['START']);
|
||||
$end = explode(" ", $this->date ['HUMAN'] ['END']);
|
||||
$infoText .= "<b>" . "Issued to" . ":</b> " . $this->info ['FIRST_NAME'] . " " . $this->info ['LAST_NAME'] . "<br>";
|
||||
$infoText .= "<b>" . G::LoadTranslation('ID_WORKSPACE') .":</b> " . $this->info ['DOMAIN_WORKSPACE'] . "<br>";
|
||||
$infoText .= "<b>" . G::LoadTranslation('ID_WORKSPACE') . ":</b> " . $this->info ['DOMAIN_WORKSPACE'] . "<br>";
|
||||
$infoText .= "<i>" . G::LoadTranslation('ID_VALID_FROM') . " " . $start [0] . " " . G::LoadTranslation('ID_TO') . " " . $end [0] . "</i>";
|
||||
}
|
||||
if ($status ['message'] != "") {
|
||||
@@ -318,14 +324,14 @@ class PmLicenseManager
|
||||
if ($this->getExpireIn() != "NEVER" && ((int)$this->getExpireIn() <= 30) && ((int)$this->getExpireIn() > 0)) {
|
||||
$infoO = $this->getLicenseInfo();
|
||||
$infoText = $infoO['infoText'];
|
||||
$js = (EnterpriseUtils::skinIsUx() == 1)? "Ext.MessageBox.show({title: '', msg: '$infoText', buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.INFO});" : "msgBox('$infoText');";
|
||||
$linkText = $linkText . "<span style=\"color: red;\">" . G::LoadTranslation('ID_EXPIRES_IN') . " " . $this->getExpireIn () . " " . G::LoadTranslation('ID_DAYS') . "</span>";
|
||||
$js = (EnterpriseUtils::skinIsUx() == 1) ? "Ext.MessageBox.show({title: '', msg: '$infoText', buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.INFO});" : "msgBox('$infoText');";
|
||||
$linkText = $linkText . "<span style=\"color: red;\">" . G::LoadTranslation('ID_EXPIRES_IN') . " " . $this->getExpireIn() . " " . G::LoadTranslation('ID_DAYS') . "</span>";
|
||||
} else {
|
||||
if ($this->getExpireIn() != "NEVER" && (int)$this->getExpireIn() <= 0) {
|
||||
$infoO = $this->getLicenseInfo();
|
||||
$infoText = $infoO['infoText'];
|
||||
$infoLabel = $infoO['infoLabel'];
|
||||
$js = (EnterpriseUtils::skinIsUx() == 1)? "Ext.MessageBox.show({title: '', msg: '$infoText', buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.INFO});" : "msgBox('$infoText');";
|
||||
$js = (EnterpriseUtils::skinIsUx() == 1) ? "Ext.MessageBox.show({title: '', msg: '$infoText', buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.INFO});" : "msgBox('$infoText');";
|
||||
$linkText = $linkText . "<a href=\"javascript:;\" onclick=\"$js return (false);\"><span style=\"color: red;\">" . $infoLabel . "</span></a>";
|
||||
}
|
||||
}
|
||||
@@ -339,16 +345,16 @@ class PmLicenseManager
|
||||
if (EnterpriseUtils::skinIsUx() == 1) {
|
||||
$aOnclick = "onclick=\"Ext.ComponentMgr.get('mainTabPanel').setActiveTab('pm-option-setup'); Ext.ComponentMgr.get('pm-option-setup').setLocation(Ext.ComponentMgr.get('pm-option-setup').defaultSrc + 's=PMENTERPRISE', true); return (false);\"";
|
||||
}
|
||||
$linkText = $linkText . (($linkText != null)? " | " : null) . "<a href=\"javascript:;\" $aOnclick style=\"color: #008000;\">" . G::LoadTranslation('ID_UPGRADE_SYSTEM') . "</a>";
|
||||
$linkText = $linkText . (($linkText != null) ? " | " : null) . "<a href=\"javascript:;\" $aOnclick style=\"color: #008000;\">" . G::LoadTranslation('ID_UPGRADE_SYSTEM') . "</a>";
|
||||
}
|
||||
$linkText = ($linkText != null)? $linkText . ((EnterpriseUtils::skinIsUx() == 1)? null : " |") : null;
|
||||
$linkText = ($linkText != null) ? $linkText . ((EnterpriseUtils::skinIsUx() == 1) ? null : " |") : null;
|
||||
return ($linkText);
|
||||
}
|
||||
|
||||
public function validateLicense($path)
|
||||
{
|
||||
$application = new license_application ( $path, false, true, false, true, true );
|
||||
$results = $application->validate ( false, false, "", "", "80", true );
|
||||
$application = new license_application ($path, false, true, false, true, true);
|
||||
$results = $application->validate(false, false, "", "", "80", true);
|
||||
|
||||
if ($results ['RESULT'] != 'OK') {
|
||||
return true;
|
||||
@@ -359,9 +365,9 @@ class PmLicenseManager
|
||||
|
||||
public function installLicense($path, $redirect = true, $includeExpired = true)
|
||||
{
|
||||
$application = new license_application ( $path, false, true, false, true, true );
|
||||
$application = new license_application ($path, false, true, false, true, true);
|
||||
|
||||
$results = $application->validate ( false, false, "", "", "80", true );
|
||||
$results = $application->validate(false, false, "", "", "80", true);
|
||||
|
||||
//if the result is ok then it is saved into DB
|
||||
$res = $results ['RESULT'];
|
||||
@@ -373,21 +379,22 @@ class PmLicenseManager
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (( $res != 'OK') && ($res != 'EXPIRED' ) && ($res != 'TMINUS') ) {
|
||||
G::SendTemporalMessage ( 'ID_ISNT_LICENSE', 'tmp-info', 'labels' );
|
||||
if (($res != 'OK') && ($res != 'EXPIRED') && ($res != 'TMINUS')) {
|
||||
G::SendTemporalMessage('ID_ISNT_LICENSE', 'tmp-info', 'labels');
|
||||
return false;
|
||||
} else {
|
||||
|
||||
$oServerConf = & ServerConf::getSingleton ();
|
||||
$oServerConf->setProperty ( 'ACTIVE_LICENSE',array(SYS_SYS => $path));
|
||||
$this->saveDataLicense( $results, $path, $redirect );
|
||||
$oServerConf = &ServerConf::getSingleton();
|
||||
$oServerConf->setProperty('ACTIVE_LICENSE', [SYS_SYS => $path]);
|
||||
$this->saveDataLicense($results, $path, $redirect);
|
||||
if ($redirect) {
|
||||
G::Header ( 'location: ../enterprise/addonsStore' );
|
||||
G::Header('location: ../enterprise/addonsStore');
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
get Active License
|
||||
*/
|
||||
@@ -395,8 +402,8 @@ class PmLicenseManager
|
||||
{
|
||||
//get license from database, table LICENSE_MANAGER
|
||||
try {
|
||||
$aRow = array();
|
||||
require_once ("classes/model/LicenseManager.php");
|
||||
$aRow = [];
|
||||
require_once("classes/model/LicenseManager.php");
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(LicenseManagerPeer::LICENSE_USER);
|
||||
$oCriteria->addSelectColumn(LicenseManagerPeer::LICENSE_START);
|
||||
@@ -408,27 +415,27 @@ class PmLicenseManager
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
} catch (Exception $e) {
|
||||
G::pr ($e);
|
||||
G::pr($e);
|
||||
}
|
||||
return $aRow;
|
||||
}
|
||||
|
||||
public function lookForStatusLicense()
|
||||
{
|
||||
require_once ("classes/model/LicenseManager.php");
|
||||
require_once("classes/model/LicenseManager.php");
|
||||
//obtening info in a row that has ACTIVE status
|
||||
$oCtia = new Criteria ( 'workflow' );
|
||||
$oCtia->add ( LicenseManagerPeer::LICENSE_STATUS, 'ACTIVE' );
|
||||
$oDataset = LicenseManagerPeer::doSelectRS ( $oCtia );
|
||||
$oDataset->next ();
|
||||
$aRow = $oDataset->getRow ();
|
||||
$oCtia = new Criteria ('workflow');
|
||||
$oCtia->add(LicenseManagerPeer::LICENSE_STATUS, 'ACTIVE');
|
||||
$oDataset = LicenseManagerPeer::doSelectRS($oCtia);
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
$oCtiaA = new Criteria ( 'workflow' );
|
||||
$oCtiaA->add ( LicenseManagerPeer::LICENSE_UID, $aRow [0] );
|
||||
$oCtiaA = new Criteria ('workflow');
|
||||
$oCtiaA->add(LicenseManagerPeer::LICENSE_UID, $aRow [0]);
|
||||
|
||||
$oCtiaB = new Criteria ( 'workflow' );
|
||||
$oCtiaB->add ( LicenseManagerPeer::LICENSE_STATUS, 'INACTIVE' );
|
||||
BasePeer::doUpdate ( $oCtiaA, $oCtiaB, Propel::getConnection ( 'workflow' ) );
|
||||
$oCtiaB = new Criteria ('workflow');
|
||||
$oCtiaB->add(LicenseManagerPeer::LICENSE_STATUS, 'INACTIVE');
|
||||
BasePeer::doUpdate($oCtiaA, $oCtiaB, Propel::getConnection('workflow'));
|
||||
return 'ACTIVE';
|
||||
}
|
||||
|
||||
@@ -436,7 +443,7 @@ class PmLicenseManager
|
||||
{
|
||||
try {
|
||||
//getting info about file
|
||||
$LicenseUid = G::generateUniqueID ();
|
||||
$LicenseUid = G::generateUniqueID();
|
||||
$LicenseUser = $results ['DATA'] ['FIRST_NAME'] . ' ' . $results ['DATA'] ['LAST_NAME'];
|
||||
$LicenseStart = $results ['DATE'] ['START'];
|
||||
$LicenseEnd = $results ['DATE'] ['END'];
|
||||
@@ -448,35 +455,35 @@ class PmLicenseManager
|
||||
$filter = new InputFilter();
|
||||
$path = $filter->xssFilterHard($path, 'path');
|
||||
|
||||
$handle = fopen ( $path, "r" );
|
||||
$contents = fread ( $handle, filesize ( $path ) );
|
||||
fclose ( $handle );
|
||||
$handle = fopen($path, "r");
|
||||
$contents = fread($handle, filesize($path));
|
||||
fclose($handle);
|
||||
$LicenseData = $contents;
|
||||
$LicensePath = $path;
|
||||
$LicenseWorkspace = isset($results['DATA']['DOMAIN_WORKSPACE']) ? $results['DATA']['DOMAIN_WORKSPACE'] : '';
|
||||
$LicenseType = $results['DATA']['TYPE'];
|
||||
|
||||
require_once ("classes/model/LicenseManager.php");
|
||||
require_once("classes/model/LicenseManager.php");
|
||||
|
||||
//if exists the row in the database propel will update it, otherwise will insert.
|
||||
$tr = LicenseManagerPeer::retrieveByPK ( $LicenseUid );
|
||||
if (! (is_object ( $tr ) && get_class ( $tr ) == 'LicenseManager')) {
|
||||
$tr = LicenseManagerPeer::retrieveByPK($LicenseUid);
|
||||
if (!(is_object($tr) && get_class($tr) == 'LicenseManager')) {
|
||||
$tr = new LicenseManager ();
|
||||
}
|
||||
$tr->setLicenseUid ( $LicenseUid );
|
||||
$tr->setLicenseUser ( $LicenseUser );
|
||||
$tr->setLicenseStart ( $LicenseStart );
|
||||
$tr->setLicenseEnd ( $LicenseEnd );
|
||||
$tr->setLicenseSpan ( $LicenseSpan );
|
||||
$tr->setLicenseStatus ( $LicenseStatus );
|
||||
$tr->setLicenseData ( $LicenseData );
|
||||
$tr->setLicensePath ( $LicensePath );
|
||||
$tr->setLicenseWorkspace ( $LicenseWorkspace );
|
||||
$tr->setLicenseType ( $LicenseType );
|
||||
$tr->setLicenseUid($LicenseUid);
|
||||
$tr->setLicenseUser($LicenseUser);
|
||||
$tr->setLicenseStart($LicenseStart);
|
||||
$tr->setLicenseEnd($LicenseEnd);
|
||||
$tr->setLicenseSpan($LicenseSpan);
|
||||
$tr->setLicenseStatus($LicenseStatus);
|
||||
$tr->setLicenseData($LicenseData);
|
||||
$tr->setLicensePath($LicensePath);
|
||||
$tr->setLicenseWorkspace($LicenseWorkspace);
|
||||
$tr->setLicenseType($LicenseType);
|
||||
|
||||
$res = $tr->save ();
|
||||
$res = $tr->save();
|
||||
Cache::forget(PmLicenseManager::CACHE_KEY . '.' . SYS_SYS);
|
||||
} catch ( Exception $e ) {
|
||||
} catch (Exception $e) {
|
||||
G::pr($e);
|
||||
}
|
||||
}
|
||||
@@ -484,28 +491,28 @@ class PmLicenseManager
|
||||
public function getResultQry($sNameTable, $sfield, $sCondition)
|
||||
{
|
||||
try {
|
||||
require_once ("classes/model/LicenseManager.php");
|
||||
$oCriteria = new Criteria ( 'workflow' );
|
||||
$oCriteria->addSelectColumn ( LicenseManagerPeer::LICENSE_USER );
|
||||
$oCriteria->addSelectColumn ( LicenseManagerPeer::LICENSE_START );
|
||||
$oCriteria->addSelectColumn ( LicenseManagerPeer::LICENSE_PATH );
|
||||
$oCriteria->addSelectColumn ( LicenseManagerPeer::LICENSE_DATA );
|
||||
$oCriteria->add ( LicenseManagerPeer::LICENSE_STATUS, 'ACTIVE' );
|
||||
$oDataset = LicenseManagerPeer::doSelectRS ( $oCriteria );
|
||||
$oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next ();
|
||||
$aRow = $oDataset->getRow ();
|
||||
require_once("classes/model/LicenseManager.php");
|
||||
$oCriteria = new Criteria ('workflow');
|
||||
$oCriteria->addSelectColumn(LicenseManagerPeer::LICENSE_USER);
|
||||
$oCriteria->addSelectColumn(LicenseManagerPeer::LICENSE_START);
|
||||
$oCriteria->addSelectColumn(LicenseManagerPeer::LICENSE_PATH);
|
||||
$oCriteria->addSelectColumn(LicenseManagerPeer::LICENSE_DATA);
|
||||
$oCriteria->add(LicenseManagerPeer::LICENSE_STATUS, 'ACTIVE');
|
||||
$oDataset = LicenseManagerPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
} catch (Exception $e) {
|
||||
G::pr ( $e );
|
||||
$aRow = array ();
|
||||
G::pr($e);
|
||||
$aRow = [];
|
||||
}
|
||||
return $aRow;
|
||||
}
|
||||
|
||||
public function getActiveFeatures()
|
||||
{
|
||||
if (file_exists ( PATH_PLUGINS . 'enterprise/data/default' )) {
|
||||
return array();
|
||||
if (file_exists(PATH_PLUGINS . 'enterprise/data/default')) {
|
||||
return [];
|
||||
}
|
||||
return unserialize(G::decrypt($this->serial, file_get_contents(PATH_PLUGINS . 'enterprise/data/default')));
|
||||
}
|
||||
|
||||
@@ -293,10 +293,6 @@ try {
|
||||
|
||||
unset($_SESSION['FAILED_LOGINS']);
|
||||
|
||||
// increment logins in heartbeat
|
||||
$oServerConf =& ServerConf::getSingleton();
|
||||
$oServerConf->sucessfulLogin();
|
||||
|
||||
// Assign the uid of user to userloggedobj
|
||||
$RBAC->loadUserRolePermission($RBAC->sSystem, $uid);
|
||||
$res = $RBAC->userCanAccess('PM_LOGIN');
|
||||
@@ -324,15 +320,6 @@ try {
|
||||
$weblog->create($aLog);
|
||||
/**end log**/
|
||||
|
||||
//************** background processes, here we are putting some back office routines **********
|
||||
$heartBeatNWIDate = $oServerConf->getHeartbeatProperty('HB_NEXT_GWI_DATE','HEART_BEAT_CONF');
|
||||
if (is_null($heartBeatNWIDate)) {
|
||||
$heartBeatNWIDate = time();
|
||||
}
|
||||
if (time() >= $heartBeatNWIDate) {
|
||||
$oServerConf->setHeartbeatProperty('HB_NEXT_GWI_DATE', strtotime('+1 day'), 'HEART_BEAT_CONF');
|
||||
}
|
||||
|
||||
//**** defining and saving server info, this file has the values of the global array $_SERVER ****
|
||||
//this file is useful for command line environment (no Browser), I mean for triggers, crons and other executed over command line
|
||||
|
||||
|
||||
@@ -1,128 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* language_Ajax.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
|
||||
try {
|
||||
|
||||
|
||||
$filter = new InputFilter();
|
||||
$_POST = $filter->xssFilterHard($_POST);
|
||||
|
||||
if (isset( $_POST['form'] )) {
|
||||
if (isset($_POST['form'])) {
|
||||
$_POST = $_POST['form'];
|
||||
}
|
||||
$_POST['function'] = get_ajax_value( 'function' );
|
||||
$_POST['function'] = get_ajax_value('function');
|
||||
$_POST['function'] = $filter->xssFilterHard($_POST['function']);
|
||||
switch ($_POST['function']) {
|
||||
case 'savePredetermined':
|
||||
$tranlationsList = Translation::getTranslationEnvironments();
|
||||
g::pr( $tranlationsList );
|
||||
die();
|
||||
if (isset( $meta['LAN_ID'] ) && $meta['LAN_ID'] == $_POST['lang']) {
|
||||
G::pr($tranlationsList);
|
||||
if (isset($meta['LAN_ID']) && $meta['LAN_ID'] == $_POST['lang']) {
|
||||
echo 'The Setting was saved successfully!';
|
||||
} else {
|
||||
echo 'Some error occured while the setting was being save, try later please.';
|
||||
}
|
||||
break;
|
||||
case 'languagesList':
|
||||
|
||||
$isoCountry = new IsoCountry();
|
||||
$translationRow = new Translation();
|
||||
$response = new stdClass();
|
||||
$translationsEnvList = $translationRow->getTranslationEnvironments();
|
||||
//print_r($translationsEnvList); die;
|
||||
$i = 0;
|
||||
foreach ($translationsEnvList as $locale => $translationRow) {
|
||||
|
||||
$COUNTRY_ID = $translationRow['IC_UID'];
|
||||
if ($COUNTRY_ID != '') {
|
||||
$isoCountryRecord = $isoCountry->findById( strtoupper( $COUNTRY_ID ) );
|
||||
$flag = strtolower( $isoCountryRecord['IC_UID'] );
|
||||
$countryId = $translationRow['IC_UID'];
|
||||
if ($countryId != '') {
|
||||
$isoCountryRecord = $isoCountry->findById(strtoupper($countryId));
|
||||
$flag = strtolower($isoCountryRecord['IC_UID']);
|
||||
$countryName = $translationRow['HEADERS']['X-Poedit-Country'];
|
||||
} else {
|
||||
$flag = 'international';
|
||||
$countryName = G::LoadTranslation( 'ID_INTERNATIONAL' );
|
||||
$countryName = G::LoadTranslation('ID_INTERNATIONAL');
|
||||
}
|
||||
|
||||
$conf = new Configurations();
|
||||
$confCasesList = $conf->getConfiguration( 'casesList', 'todo' );
|
||||
//echo date($confCasesList['dateformat'], '2010-01-01');
|
||||
$confCasesList = $conf->getConfiguration('casesList', 'todo');
|
||||
|
||||
|
||||
if (isset( $confCasesList['dateformat'] )) {
|
||||
$datetime = explode( ' ', $translationRow['DATE'] );
|
||||
|
||||
$date = explode( '-', $datetime[0] );
|
||||
if (count( $datetime ) == 2)
|
||||
$time = explode( ':', $datetime[1] );
|
||||
|
||||
if (count( $date ) == 3) {
|
||||
if (count( $time ) >= 2) {
|
||||
$DATE = date( $confCasesList['dateformat'], mktime( $time[0], $time[1], 0, $date[1], $date[2], $date[0] ) );
|
||||
} else {
|
||||
$DATE = date( $confCasesList['dateformat'], mktime( 0, 0, 0, $date[1], $date[2], $date[0] ) );
|
||||
}
|
||||
} else {
|
||||
$DATE = $translationRow['DATE'];
|
||||
if (isset($confCasesList['dateformat'])) {
|
||||
$datetime = explode(' ', $translationRow['DATE']);
|
||||
$date = explode('-', $datetime[0]);
|
||||
if (count($datetime) == 2) {
|
||||
$time = explode(':', $datetime[1]);
|
||||
}
|
||||
|
||||
$datetime = explode( ' ', $translationRow['HEADERS']['PO-Revision-Date'] );
|
||||
|
||||
$date = explode( '-', $datetime[0] );
|
||||
if (count( $datetime ) == 2)
|
||||
$time = explode( ':', $datetime[1] );
|
||||
|
||||
if (count( $date ) == 3) {
|
||||
if (count( $time ) >= 2) {
|
||||
$REV_DATE = date( $confCasesList['dateformat'], mktime( $time[0], substr( $time[1], 0, 2 ), 0, $date[1], $date[2], $date[0] ) );
|
||||
if (count($date) == 3) {
|
||||
if (count($time) >= 2) {
|
||||
$dateFormat = date($confCasesList['dateformat'],
|
||||
mktime($time[0], $time[1], 0, $date[1], $date[2], $date[0]));
|
||||
} else {
|
||||
$REV_DATE = date( $confCasesList['dateformat'], mktime( 0, 0, 0, $date[1], $date[2], $date[0] ) );
|
||||
$dateFormat = date($confCasesList['dateformat'], mktime(0, 0, 0, $date[1], $date[2], $date[0]));
|
||||
}
|
||||
} else {
|
||||
$REV_DATE = $translationRow['HEADERS']['PO-Revision-Date'];
|
||||
$dateFormat = $translationRow['DATE'];
|
||||
}
|
||||
|
||||
$datetime = explode(' ', $translationRow['HEADERS']['PO-Revision-Date']);
|
||||
|
||||
$date = explode('-', $datetime[0]);
|
||||
if (count($datetime) == 2) {
|
||||
$time = explode(':', $datetime[1]);
|
||||
}
|
||||
|
||||
if (count($date) == 3) {
|
||||
if (count($time) >= 2) {
|
||||
$revDate = date($confCasesList['dateformat'],
|
||||
mktime($time[0], substr($time[1], 0, 2), 0, $date[1], $date[2], $date[0]));
|
||||
} else {
|
||||
$revDate = date($confCasesList['dateformat'],
|
||||
mktime(0, 0, 0, $date[1], $date[2], $date[0]));
|
||||
}
|
||||
} else {
|
||||
$DATE = $translationRow['DATE'];
|
||||
$REV_DATE = $translationRow['HEADERS']['PO-Revision-Date'];
|
||||
$revDate = $translationRow['HEADERS']['PO-Revision-Date'];
|
||||
}
|
||||
} else {
|
||||
$dateFormat = $translationRow['DATE'];
|
||||
$revDate = $translationRow['HEADERS']['PO-Revision-Date'];
|
||||
}
|
||||
|
||||
$languagesList[$i]['LAN_ID'] = $translationRow['LAN_ID'];
|
||||
$languagesList[$i]['LOCALE'] = $translationRow['LOCALE'];
|
||||
$languagesList[$i]['LAN_FLAG'] = $flag;
|
||||
$languagesList[$i]['NUM_RECORDS'] = $translationRow['NUM_RECORDS'];
|
||||
$languagesList[$i]['DATE'] = $DATE;
|
||||
$languagesList[$i]['DATE'] = $dateFormat;
|
||||
$languagesList[$i]['LAN_NAME'] = $translationRow['HEADERS']['X-Poedit-Language'];
|
||||
$languagesList[$i]['COUNTRY_NAME'] = $countryName;
|
||||
$languagesList[$i]['TRANSLATOR'] = htmlentities( $translationRow['HEADERS']['Last-Translator'] );
|
||||
$languagesList[$i]['REV_DATE'] = $REV_DATE;
|
||||
$languagesList[$i]['TRANSLATOR'] = htmlentities($translationRow['HEADERS']['Last-Translator']);
|
||||
$languagesList[$i]['REV_DATE'] = $revDate;
|
||||
$languagesList[$i]['VERSION'] = $translationRow['HEADERS']['Project-Id-Version'];
|
||||
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
$translationRow = new Translation();
|
||||
|
||||
$response->data = $languagesList;
|
||||
|
||||
print (G::json_encode( $response )) ;
|
||||
print (G::json_encode($response));
|
||||
break;
|
||||
case 'delete':
|
||||
include_once 'classes/model/Translation.php';
|
||||
@@ -130,25 +103,14 @@ try {
|
||||
$locale = $_POST['LOCALE'];
|
||||
$trn = new Translation();
|
||||
|
||||
if (strpos( $locale, Translation::$localeSeparator ))
|
||||
list ($LAN_ID, $IC_UID) = explode( Translation::$localeSeparator, $locale );
|
||||
else {
|
||||
$LAN_ID = $locale;
|
||||
$LAN_ID = '';
|
||||
if (strpos($locale, Translation::$localeSeparator)) {
|
||||
list ($LAN_ID, $IC_UID) = explode(Translation::$localeSeparator, $locale);
|
||||
}
|
||||
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
//$oCriteria->addSelectColumn('COUNT('.ContentPeer::CON_CATEGORY.')');
|
||||
$oCriteria->addSelectColumn(ApplicationPeer::APP_TITLE);
|
||||
$oDataset = ApplicationPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
if ($locale != "en") { //Default Language 'en'
|
||||
if ($locale != SYS_LANG) { //Current Language
|
||||
//THERE IS NO ANY CASE STARTED FROM THIS LANGUAGE
|
||||
if (empty($aRow)) { //so we can delete this language
|
||||
//Verify if is the default language 'en'
|
||||
if ($locale != "en") {
|
||||
//Verify if is the current language
|
||||
if ($locale != SYS_LANG) {
|
||||
try {
|
||||
Content::removeLanguageContent($locale);
|
||||
$trn->removeTranslationEnvironment($locale);
|
||||
@@ -159,19 +121,16 @@ try {
|
||||
G::outRes(G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)));
|
||||
}
|
||||
} else {
|
||||
echo str_replace('{0}', $aRow['APP_TITLE'], G::LoadTranslation('ID_LANGUAGE_CANT_DELETE'));
|
||||
echo G::LoadTranslation('ID_LANGUAGE_CANT_DELETE_CURRENTLY');
|
||||
}
|
||||
} else {
|
||||
echo str_replace('{0}', $aRow['APP_TITLE'], G::LoadTranslation('ID_LANGUAGE_CANT_DELETE_CURRENTLY'));
|
||||
}
|
||||
} else {
|
||||
echo str_replace('{0}', $aRow['APP_TITLE'], G::LoadTranslation('ID_LANGUAGE_CANT_DELETE_DEFAULT'));
|
||||
echo G::LoadTranslation('ID_LANGUAGE_CANT_DELETE_DEFAULT');
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (Exception $oException) {
|
||||
$token = strtotime("now");
|
||||
PMException::registerErrorLog($oException, $token);
|
||||
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
|
||||
G::outRes(G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)));
|
||||
}
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ class SkinEngine
|
||||
$this->template = $template;
|
||||
$this->skin = $skin;
|
||||
$this->content = $content;
|
||||
$this->skinVariants = array('blank','extjs','raw','tracker','submenu');
|
||||
$this->skinVariants = array('blank', 'extjs', 'raw', 'tracker', 'submenu');
|
||||
$this->skinsBasePath = G::ExpandPath("skinEngine");
|
||||
$sysConf = System::getSystemConfiguration( PATH_CONFIG . 'env.ini' );
|
||||
$sysConf = System::getSystemConfiguration(PATH_CONFIG . 'env.ini');
|
||||
$this->skinDefault = (isset($sysConf['default_skin']) && $sysConf['default_skin'] != '') ? $sysConf['default_skin'] : 'classic';
|
||||
$this->_init();
|
||||
}
|
||||
@@ -69,8 +69,7 @@ class SkinEngine
|
||||
$this->forceTemplateCompile = true;
|
||||
}
|
||||
$_SESSION['currentSkin'] = SYS_SKIN;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$_SESSION['currentSkin'] = SYS_SKIN;
|
||||
$_SESSION['currentSkinVariant'] = $this->skin;
|
||||
}
|
||||
@@ -99,41 +98,43 @@ class SkinEngine
|
||||
if (strtolower($this->mainSkin) != "classic") {
|
||||
if (defined('PATH_CUSTOM_SKINS') && is_dir(PATH_CUSTOM_SKINS . $this->mainSkin)) { // check this skin on user skins path
|
||||
$skinObject = PATH_CUSTOM_SKINS . $this->mainSkin;
|
||||
}
|
||||
else if (is_dir($this->skinsBasePath . $this->mainSkin)) { // check this skin on core skins path
|
||||
} else {
|
||||
if (is_dir($this->skinsBasePath . $this->mainSkin)) { // check this skin on core skins path
|
||||
$skinObject = $this->skinsBasePath . $this->mainSkin;
|
||||
}
|
||||
else { //Skin doesn't exist
|
||||
} else { //Skin doesn't exist
|
||||
$this->mainSkin = $this->skinDefault;
|
||||
if (defined('PATH_CUSTOM_SKINS') && is_dir(PATH_CUSTOM_SKINS . $this->mainSkin)) { // check this skin on user skins path
|
||||
$skinObject = PATH_CUSTOM_SKINS . $this->mainSkin;
|
||||
}
|
||||
else if (is_dir($this->skinsBasePath . $this->mainSkin)) { // check this skin on core skins path
|
||||
} else {
|
||||
if (is_dir($this->skinsBasePath . $this->mainSkin)) { // check this skin on core skins path
|
||||
$skinObject = $this->skinsBasePath . $this->mainSkin;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//This should have an XML definition and a layout html
|
||||
if ($skinObject && file_exists($skinObject . PATH_SEP . 'config.xml')
|
||||
&& file_exists($skinObject . PATH_SEP . 'layout.html')) {
|
||||
&& file_exists($skinObject . PATH_SEP . 'layout.html')
|
||||
) {
|
||||
|
||||
$configurationFile = $skinObject . PATH_SEP . 'config.xml';
|
||||
$layoutFile = $skinObject . PATH_SEP . 'layout.html';
|
||||
|
||||
if (file_exists($skinObject . PATH_SEP . 'layout-blank.html')){
|
||||
if (file_exists($skinObject . PATH_SEP . 'layout-blank.html')) {
|
||||
$layoutFileBlank = $skinObject . PATH_SEP . 'layout-blank.html';
|
||||
}
|
||||
if (file_exists($skinObject . PATH_SEP . 'layout-extjs.html')){
|
||||
$layoutFileExtjs = $skinObject . PATH_SEP . 'layout-extjs.html' ;
|
||||
if (file_exists($skinObject . PATH_SEP . 'layout-extjs.html')) {
|
||||
$layoutFileExtjs = $skinObject . PATH_SEP . 'layout-extjs.html';
|
||||
}
|
||||
if (file_exists($skinObject . PATH_SEP . 'layout-raw.html')){
|
||||
if (file_exists($skinObject . PATH_SEP . 'layout-raw.html')) {
|
||||
$layoutFileRaw = $skinObject . PATH_SEP . 'layout-raw.html';
|
||||
}
|
||||
if (file_exists($skinObject . PATH_SEP . 'layout-tracker.html')){
|
||||
if (file_exists($skinObject . PATH_SEP . 'layout-tracker.html')) {
|
||||
$layoutFileTracker = $skinObject . PATH_SEP . 'layout-tracker.html';
|
||||
}
|
||||
if (file_exists($skinObject . PATH_SEP . 'layout-submenu.html')){
|
||||
if (file_exists($skinObject . PATH_SEP . 'layout-submenu.html')) {
|
||||
$layoutFileSubmenu = $skinObject . PATH_SEP . 'layout-submenu.html';
|
||||
}
|
||||
}
|
||||
@@ -167,8 +168,7 @@ class SkinEngine
|
||||
}
|
||||
|
||||
$this->$skinMethod();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
switch ($e->getCode()) {
|
||||
case SE_LAYOUT_NOT_FOUND:
|
||||
|
||||
@@ -178,14 +178,13 @@ class SkinEngine
|
||||
$data['exception_list'] = array();
|
||||
if (substr($this->mainSkin, 0, 2) != 'ux') {
|
||||
$url = '../login/login';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$url = '../main/login';
|
||||
}
|
||||
|
||||
$link = '<a href="'.$url.'">Try Now</a>';
|
||||
$link = '<a href="' . $url . '">Try Now</a>';
|
||||
|
||||
$data['exception_notes'][] = G::LoadTranslation('ID_REDIRECT_URL'). $link;
|
||||
$data['exception_notes'][] = G::LoadTranslation('ID_REDIRECT_URL') . $link;
|
||||
|
||||
G::renderTemplate(PATH_TPL . 'exception', $data);
|
||||
break;
|
||||
@@ -201,8 +200,8 @@ class SkinEngine
|
||||
|
||||
private function _raw()
|
||||
{
|
||||
G::verifyPath ( PATH_SMARTY_C, true );
|
||||
G::verifyPath ( PATH_SMARTY_CACHE, true );
|
||||
G::verifyPath(PATH_SMARTY_C, true);
|
||||
G::verifyPath(PATH_SMARTY_CACHE, true);
|
||||
|
||||
$smarty = new Smarty();
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
@@ -216,14 +215,14 @@ class SkinEngine
|
||||
$header = $oHeadPublisher->printRawHeader();
|
||||
}
|
||||
|
||||
$smarty->assign('header', $header );
|
||||
$smarty->assign('header', $header);
|
||||
$smarty->force_compile = $this->forceTemplateCompile;
|
||||
$smarty->display($this->layoutFileRaw['basename']);
|
||||
}
|
||||
|
||||
private function _plain()
|
||||
{
|
||||
$oHeadPublisher = & headPublisher::getSingleton();
|
||||
$oHeadPublisher = &headPublisher::getSingleton();
|
||||
echo $oHeadPublisher->renderExtJs();
|
||||
}
|
||||
|
||||
@@ -233,16 +232,16 @@ class SkinEngine
|
||||
$oServerConf =& ServerConf::getSingleton();
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
|
||||
if( $oHeadPublisher->extJsInit === true){
|
||||
if ($oHeadPublisher->extJsInit === true) {
|
||||
$header = $oHeadPublisher->getExtJsVariablesScript();
|
||||
$styles = $oHeadPublisher->getExtJsStylesheets($this->cssFileName);
|
||||
$body = $oHeadPublisher->getExtJsScripts();
|
||||
|
||||
//default
|
||||
$templateFile = G::ExpandPath( "skinEngine" ).'base'.PATH_SEP .'extJsInitLoad.html';
|
||||
$templateFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'extJsInitLoad.html';
|
||||
//Custom skins
|
||||
if (defined('PATH_CUSTOM_SKINS') && is_dir(PATH_CUSTOM_SKINS . $this->mainSkin)) {
|
||||
$templateFile = PATH_CUSTOM_SKINS . $this->mainSkin . PATH_SEP .'extJsInitLoad.html';
|
||||
$templateFile = PATH_CUSTOM_SKINS . $this->mainSkin . PATH_SEP . 'extJsInitLoad.html';
|
||||
}
|
||||
//Skin uxs - simplified
|
||||
if (!isset($_SESSION['user_experience'])) {
|
||||
@@ -251,8 +250,7 @@ class SkinEngine
|
||||
if ($_SESSION['user_experience'] != 'NORMAL') {
|
||||
$templateFile = (is_dir(PATH_CUSTOM_SKINS . 'uxs')) ? PATH_CUSTOM_SKINS . 'simplified' . PATH_SEP . 'extJsInitLoad.html' : $templateFile;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$styles = "";
|
||||
$header = $oHeadPublisher->getExtJsStylesheets($this->cssFileName);
|
||||
$header .= $oHeadPublisher->includeExtJs();
|
||||
@@ -271,15 +269,19 @@ class SkinEngine
|
||||
$meta = null;
|
||||
$dirBody = null;
|
||||
|
||||
if (isset($_SERVER["HTTP_USER_AGENT"]) && preg_match("/^.*\(.*Trident.(\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch)) {
|
||||
if (isset($_SERVER["HTTP_USER_AGENT"]) && preg_match("/^.*\(.*Trident.(\d+)\..+\).*$/",
|
||||
$_SERVER["HTTP_USER_AGENT"], $arrayMatch)
|
||||
) {
|
||||
|
||||
//Get the IE version
|
||||
if(preg_match("/^.*\(.*MSIE (\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch) || preg_match("/^.*\(.*rv.(\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch)){
|
||||
if (preg_match("/^.*\(.*MSIE (\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"],
|
||||
$arrayMatch) || preg_match("/^.*\(.*rv.(\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch)
|
||||
) {
|
||||
$ie = intval($arrayMatch[1]);
|
||||
}
|
||||
$isIE = Bootstrap::isIE();
|
||||
|
||||
$swTrident = (preg_match("/^.*Trident.*$/", $_SERVER["HTTP_USER_AGENT"]))? 1 : 0; //Trident only in IE8+
|
||||
$swTrident = (preg_match("/^.*Trident.*$/", $_SERVER["HTTP_USER_AGENT"])) ? 1 : 0; //Trident only in IE8+
|
||||
|
||||
$sw = 1;
|
||||
|
||||
@@ -289,7 +291,7 @@ class SkinEngine
|
||||
|
||||
|
||||
if ($sw == 1) {
|
||||
if ($ie == 10 || $ie == 11 ) {
|
||||
if ($ie == 10 || $ie == 11) {
|
||||
$ie = 8;
|
||||
}
|
||||
|
||||
@@ -297,7 +299,7 @@ class SkinEngine
|
||||
$meta = "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=$ie\" />";
|
||||
|
||||
if (SYS_COLLECTION == 'cases') {
|
||||
if($isIE) {
|
||||
if ($isIE) {
|
||||
$meta = "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />";
|
||||
}
|
||||
}
|
||||
@@ -339,8 +341,9 @@ class SkinEngine
|
||||
$header .= $oHeadPublisher->getExtJsStylesheets($this->cssFileName);
|
||||
}
|
||||
|
||||
$smarty->assign('username', (isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . SYS_SYS . ')' : '') );
|
||||
$smarty->assign('header', $header );
|
||||
$smarty->assign('username',
|
||||
(isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . SYS_SYS . ')' : ''));
|
||||
$smarty->assign('header', $header);
|
||||
$smarty->force_compile = $this->forceTemplateCompile;
|
||||
|
||||
// display
|
||||
@@ -362,7 +365,7 @@ class SkinEngine
|
||||
G::verifyPath(PATH_SMARTY_CACHE, true);
|
||||
|
||||
$smarty = new Smarty();
|
||||
$oHeadPublisher = & headPublisher::getSingleton();
|
||||
$oHeadPublisher = &headPublisher::getSingleton();
|
||||
|
||||
$smarty->template_dir = $this->layoutFileSubmenu['dirname'];
|
||||
$smarty->compile_dir = PATH_SMARTY_C;
|
||||
@@ -371,8 +374,7 @@ class SkinEngine
|
||||
|
||||
if (isset($G_ENABLE_BLANK_SKIN) && $G_ENABLE_BLANK_SKIN) {
|
||||
$smarty->display($layoutFileBlank['basename']);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$header = '';
|
||||
|
||||
if (isset($oHeadPublisher)) {
|
||||
@@ -385,9 +387,12 @@ class SkinEngine
|
||||
|
||||
if (strpos($_SERVER['REQUEST_URI'], '/login/login') !== false) {
|
||||
$freeOfChargeText = "";
|
||||
if (! defined('SKIP_FREE_OF_CHARGE_TEXT'))
|
||||
if (!defined('SKIP_FREE_OF_CHARGE_TEXT')) {
|
||||
$freeOfChargeText = "Supplied free of charge with no support, certification, warranty, <br>maintenance nor indemnity by Processmaker and its Certified Partners.";
|
||||
if(file_exists(PATH_CLASSES."class.pmLicenseManager.php")) $freeOfChargeText="";
|
||||
}
|
||||
if (file_exists(PATH_CLASSES . "class.pmLicenseManager.php")) {
|
||||
$freeOfChargeText = "";
|
||||
}
|
||||
|
||||
$fileFooter = PATH_SKINS . SYS_SKIN . PATH_SEP . 'footer.html';
|
||||
if (file_exists($fileFooter)) {
|
||||
@@ -408,7 +413,8 @@ class SkinEngine
|
||||
}
|
||||
|
||||
$oMenu = new Menu();
|
||||
$menus = $oMenu->generateArrayForTemplate($G_MAIN_MENU, 'SelectedMenu', 'mainMenu', $G_MENU_SELECTED, $G_ID_MENU_SELECTED);
|
||||
$menus = $oMenu->generateArrayForTemplate($G_MAIN_MENU, 'SelectedMenu', 'mainMenu', $G_MENU_SELECTED,
|
||||
$G_ID_MENU_SELECTED);
|
||||
$smarty->assign('menus', $menus);
|
||||
|
||||
if (substr(SYS_SKIN, 0, 2) == 'ux') {
|
||||
@@ -417,10 +423,11 @@ class SkinEngine
|
||||
}
|
||||
|
||||
$oSubMenu = new Menu();
|
||||
$subMenus = $oSubMenu->generateArrayForTemplate($G_SUB_MENU, 'selectedSubMenu', 'subMenu', $G_SUB_MENU_SELECTED, $G_ID_SUB_MENU_SELECTED);
|
||||
$subMenus = $oSubMenu->generateArrayForTemplate($G_SUB_MENU, 'selectedSubMenu', 'subMenu',
|
||||
$G_SUB_MENU_SELECTED, $G_ID_SUB_MENU_SELECTED);
|
||||
$smarty->assign('subMenus', $subMenus);
|
||||
|
||||
if (! defined('NO_DISPLAY_USERNAME')) {
|
||||
if (!defined('NO_DISPLAY_USERNAME')) {
|
||||
define('NO_DISPLAY_USERNAME', 0);
|
||||
}
|
||||
if (NO_DISPLAY_USERNAME == 0) {
|
||||
@@ -429,20 +436,21 @@ class SkinEngine
|
||||
$smarty->assign('rolename', isset($_SESSION['USR_ROLENAME']) ? $_SESSION['USR_ROLENAME'] . '' : '');
|
||||
$smarty->assign('pipe', isset($_SESSION['USR_USERNAME']) ? ' | ' : '');
|
||||
$smarty->assign('logout', G::LoadTranslation('ID_LOGOUT'));
|
||||
$smarty->assign('workspace', defined('SYS_SYS')?SYS_SYS: '');
|
||||
$uws = (isset($_SESSION['USR_ROLENAME']) && $_SESSION['USR_ROLENAME'] != '')? strtolower(G::LoadTranslation('ID_WORKSPACE_USING')): G::LoadTranslation('ID_WORKSPACE_USING');
|
||||
$smarty->assign('workspace', defined('SYS_SYS') ? SYS_SYS : '');
|
||||
$uws = (isset($_SESSION['USR_ROLENAME']) && $_SESSION['USR_ROLENAME'] != '') ? strtolower(G::LoadTranslation('ID_WORKSPACE_USING')) : G::LoadTranslation('ID_WORKSPACE_USING');
|
||||
$smarty->assign('workspace_label', $uws);
|
||||
|
||||
$conf = new Configurations();
|
||||
$conf->getFormats();
|
||||
$name = $conf->userNameFormat(isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME']: '', isset($_SESSION['USR_FULLNAME']) ? htmlentities($_SESSION['USR_FULLNAME'] , ENT_QUOTES, 'UTF-8'): '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '');
|
||||
$smarty->assign('user',$name);
|
||||
$name = $conf->userNameFormat(isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '',
|
||||
isset($_SESSION['USR_FULLNAME']) ? htmlentities($_SESSION['USR_FULLNAME'], ENT_QUOTES,
|
||||
'UTF-8') : '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '');
|
||||
$smarty->assign('user', $name);
|
||||
}
|
||||
|
||||
if (defined('SYS_SYS')) {
|
||||
$logout = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/login/login';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$logout = '/sys/' . SYS_LANG . '/' . SYS_SKIN . '/login/login';
|
||||
}
|
||||
|
||||
@@ -455,8 +463,7 @@ class SkinEngine
|
||||
if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
|
||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||
$sCompanyLogo = $oPluginRegistry->getCompanyLogo('/images/processmaker.logo.jpg');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sCompanyLogo = '/images/processmaker.logo.jpg';
|
||||
}
|
||||
|
||||
@@ -469,8 +476,8 @@ class SkinEngine
|
||||
{
|
||||
global $G_ENABLE_BLANK_SKIN;
|
||||
|
||||
G::verifyPath ( PATH_SMARTY_C, true );
|
||||
G::verifyPath ( PATH_SMARTY_CACHE, true );
|
||||
G::verifyPath(PATH_SMARTY_C, true);
|
||||
G::verifyPath(PATH_SMARTY_CACHE, true);
|
||||
|
||||
$smarty = new Smarty();
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
@@ -480,11 +487,10 @@ class SkinEngine
|
||||
$smarty->cache_dir = PATH_SMARTY_CACHE;
|
||||
$smarty->config_dir = PATH_THIRDPARTY . 'smarty/configs';
|
||||
|
||||
if ( isset($G_ENABLE_BLANK_SKIN) && $G_ENABLE_BLANK_SKIN ) {
|
||||
if (isset($G_ENABLE_BLANK_SKIN) && $G_ENABLE_BLANK_SKIN) {
|
||||
$smarty->force_compile = $this->forceTemplateCompile;
|
||||
$smarty->display($this->layoutFileBlank['basename']);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$header = '';
|
||||
|
||||
if (isset($oHeadPublisher)) {
|
||||
@@ -522,28 +528,30 @@ class SkinEngine
|
||||
global $G_ID_SUB_MENU_SELECTED;
|
||||
|
||||
$oMenu = new Menu();
|
||||
$menus = $oMenu->generateArrayForTemplate ( $G_MAIN_MENU,'SelectedMenu', 'mainMenu',$G_MENU_SELECTED, $G_ID_MENU_SELECTED );
|
||||
$smarty->assign('menus', $menus );
|
||||
$menus = $oMenu->generateArrayForTemplate($G_MAIN_MENU, 'SelectedMenu', 'mainMenu', $G_MENU_SELECTED,
|
||||
$G_ID_MENU_SELECTED);
|
||||
$smarty->assign('menus', $menus);
|
||||
|
||||
$oSubMenu = new Menu();
|
||||
$subMenus = $oSubMenu->generateArrayForTemplate ( $G_SUB_MENU,'selectedSubMenu', 'subMenu',$G_SUB_MENU_SELECTED, $G_ID_SUB_MENU_SELECTED );
|
||||
$smarty->assign('subMenus', $subMenus );
|
||||
$subMenus = $oSubMenu->generateArrayForTemplate($G_SUB_MENU, 'selectedSubMenu', 'subMenu',
|
||||
$G_SUB_MENU_SELECTED, $G_ID_SUB_MENU_SELECTED);
|
||||
$smarty->assign('subMenus', $subMenus);
|
||||
|
||||
$smarty->assign('user', isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '');
|
||||
$smarty->assign('pipe', isset($_SESSION['USR_USERNAME']) ? ' | ' : '');
|
||||
$smarty->assign('logout', G::LoadTranslation('ID_LOGOUT'));
|
||||
$smarty->assign('header', $header );
|
||||
$smarty->assign('tpl_menu', PATH_TEMPLATE . 'menu.html' );
|
||||
$smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html' );
|
||||
$smarty->assign('header', $header);
|
||||
$smarty->assign('tpl_menu', PATH_TEMPLATE . 'menu.html');
|
||||
$smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html');
|
||||
|
||||
if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
|
||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||
$sCompanyLogo = $oPluginRegistry->getCompanyLogo ( '/images/processmaker.logo.jpg' );
|
||||
}
|
||||
else
|
||||
$sCompanyLogo = $oPluginRegistry->getCompanyLogo('/images/processmaker.logo.jpg');
|
||||
} else {
|
||||
$sCompanyLogo = '/images/processmaker.logo.jpg';
|
||||
}
|
||||
|
||||
$smarty->assign('logo_company', $sCompanyLogo );
|
||||
$smarty->assign('logo_company', $sCompanyLogo);
|
||||
$smarty->force_compile = $this->forceTemplateCompile;
|
||||
$smarty->display($this->layoutFileTracker['basename']);
|
||||
}
|
||||
@@ -566,7 +574,7 @@ class SkinEngine
|
||||
|
||||
// verify if is using extJs engine
|
||||
if (count($oHeadPublisher->extJsScript) > 0) {
|
||||
$header = $oHeadPublisher->getExtJsStylesheets($this->cssFileName.'-extJs');
|
||||
$header = $oHeadPublisher->getExtJsStylesheets($this->cssFileName . '-extJs');
|
||||
$header .= $oHeadPublisher->includeExtJs();
|
||||
|
||||
$smarty->assign('_header', $header);
|
||||
@@ -578,10 +586,9 @@ class SkinEngine
|
||||
if (empty($this->layout)) {
|
||||
$smarty->template_dir = PATH_TPL;
|
||||
$tpl = $viewFile . '.html';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$smarty->template_dir = $this->layoutFile['dirname'];
|
||||
$tpl = 'layout-'.$this->layout.'.html';
|
||||
$tpl = 'layout-' . $this->layout . '.html';
|
||||
//die($smarty->template_dir.PATH_SEP.$tpl);
|
||||
|
||||
if (!file_exists($smarty->template_dir . PATH_SEP . $tpl)) {
|
||||
@@ -601,7 +608,7 @@ class SkinEngine
|
||||
$smarty->assign($key, $value);
|
||||
}
|
||||
|
||||
if (defined('DEBUG') && DEBUG ) {
|
||||
if (defined('DEBUG') && DEBUG) {
|
||||
$smarty->force_compile = true;
|
||||
}
|
||||
|
||||
@@ -620,7 +627,7 @@ class SkinEngine
|
||||
$this->_default($enableJavascript);
|
||||
}
|
||||
|
||||
private function _default($enableJsScript=true)
|
||||
private function _default($enableJsScript = true)
|
||||
{
|
||||
global $G_ENABLE_BLANK_SKIN;
|
||||
//menu
|
||||
@@ -637,7 +644,7 @@ class SkinEngine
|
||||
G::verifyPath(PATH_SMARTY_CACHE, true);
|
||||
|
||||
$smarty = new Smarty();
|
||||
$oHeadPublisher = & headPublisher::getSingleton();
|
||||
$oHeadPublisher = &headPublisher::getSingleton();
|
||||
|
||||
$smarty->compile_dir = PATH_SMARTY_C;
|
||||
$smarty->cache_dir = PATH_SMARTY_CACHE;
|
||||
@@ -648,12 +655,14 @@ class SkinEngine
|
||||
$oServerConf =& ServerConf::getSingleton();
|
||||
$extSkin = $oServerConf->getProperty("extSkin");
|
||||
|
||||
if(!$extSkin) {
|
||||
$extSkin = array();
|
||||
if (!$extSkin) {
|
||||
$extSkin = [SYS_SKIN => "xtheme-gray"];
|
||||
$oServerConf->setProperty("extSkin", $extSkin);
|
||||
} else if (empty($extSkin[SYS_SKIN])) {
|
||||
$extSkin[SYS_SKIN] = "xtheme-gray";
|
||||
$oServerConf->setProperty("extSkin", $extSkin);
|
||||
}
|
||||
|
||||
$extSkin[SYS_SKIN]="xtheme-gray";
|
||||
$oServerConf->setProperty("extSkin",$extSkin);
|
||||
//End of extJS Theme setup
|
||||
|
||||
if (isset($G_ENABLE_BLANK_SKIN) && $G_ENABLE_BLANK_SKIN) {
|
||||
@@ -661,8 +670,7 @@ class SkinEngine
|
||||
$smarty->force_compile = $this->forceTemplateCompile;
|
||||
|
||||
$smarty->display($layoutFileBlank['basename']);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$smarty->template_dir = $this->layoutFile['dirname'];
|
||||
|
||||
$meta = null;
|
||||
@@ -671,7 +679,10 @@ class SkinEngine
|
||||
if (preg_match("/^.*\(.*Trident.(\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch)) {
|
||||
|
||||
//Get the IE version
|
||||
if(preg_match("/^.*\(.*MSIE (\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch) || preg_match("/^.*\(.*rv.(\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch)){
|
||||
if (preg_match("/^.*\(.*MSIE (\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"],
|
||||
$arrayMatch) || preg_match("/^.*\(.*rv.(\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"],
|
||||
$arrayMatch)
|
||||
) {
|
||||
$ie = intval($arrayMatch[1]);
|
||||
}
|
||||
|
||||
@@ -700,9 +711,12 @@ class SkinEngine
|
||||
|
||||
if (strpos($_SERVER['REQUEST_URI'], '/login/login') !== false) {
|
||||
$freeOfChargeText = "";
|
||||
if (! defined('SKIP_FREE_OF_CHARGE_TEXT'))
|
||||
if (!defined('SKIP_FREE_OF_CHARGE_TEXT')) {
|
||||
$freeOfChargeText = "Supplied free of charge with no support, certification, warranty, maintenance nor indemnity by ProcessMaker and its Certified Partners.";
|
||||
if(file_exists(PATH_CLASSES."PmLicenseManager.php")) $freeOfChargeText="";
|
||||
}
|
||||
if (file_exists(PATH_CLASSES . "PmLicenseManager.php")) {
|
||||
$freeOfChargeText = "";
|
||||
}
|
||||
|
||||
$fileFooter = PATH_SKINS . SYS_SKIN . PATH_SEP . 'footer.html';
|
||||
if (file_exists($fileFooter)) {
|
||||
@@ -723,38 +737,44 @@ class SkinEngine
|
||||
}
|
||||
|
||||
$oMenu = new Menu();
|
||||
$menus = $oMenu->generateArrayForTemplate($G_MAIN_MENU, 'SelectedMenu', 'mainMenu', $G_MENU_SELECTED, $G_ID_MENU_SELECTED);
|
||||
$menus = $oMenu->generateArrayForTemplate($G_MAIN_MENU, 'SelectedMenu', 'mainMenu', $G_MENU_SELECTED,
|
||||
$G_ID_MENU_SELECTED);
|
||||
$smarty->assign('menus', $menus);
|
||||
|
||||
$oSubMenu = new Menu();
|
||||
$subMenus = $oSubMenu->generateArrayForTemplate($G_SUB_MENU, 'selectedSubMenu', 'subMenu', $G_SUB_MENU_SELECTED, $G_ID_SUB_MENU_SELECTED);
|
||||
$subMenus = $oSubMenu->generateArrayForTemplate($G_SUB_MENU, 'selectedSubMenu', 'subMenu',
|
||||
$G_SUB_MENU_SELECTED, $G_ID_SUB_MENU_SELECTED);
|
||||
$smarty->assign('subMenus', $subMenus);
|
||||
|
||||
if (! defined('NO_DISPLAY_USERNAME')) {
|
||||
if (!defined('NO_DISPLAY_USERNAME')) {
|
||||
define('NO_DISPLAY_USERNAME', 0);
|
||||
}
|
||||
if (NO_DISPLAY_USERNAME == 0) {
|
||||
$switch_interface = isset($_SESSION['user_experience']) && $_SESSION['user_experience'] == 'SWITCHABLE';
|
||||
|
||||
$smarty->assign('user_logged', (isset($_SESSION['USER_LOGGED'])? $_SESSION['USER_LOGGED'] : ''));
|
||||
if(SYS_SKIN == 'neoclassic'){
|
||||
$smarty->assign('tracker', (SYS_COLLECTION == 'tracker') ? ( ($G_PUBLISH->Parts[0]['File'] != 'tracker/loginpm3' ) ? true : '') : '');
|
||||
}else{
|
||||
$smarty->assign('tracker', (SYS_COLLECTION == 'tracker') ? ( ($G_PUBLISH->Parts[0]['File'] != 'tracker/login' ) ? true : '') : '');
|
||||
$smarty->assign('user_logged', (isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ''));
|
||||
if (SYS_SKIN == 'neoclassic') {
|
||||
$smarty->assign('tracker',
|
||||
(SYS_COLLECTION == 'tracker') ? (($G_PUBLISH->Parts[0]['File'] != 'tracker/loginpm3') ? true : '') : '');
|
||||
} else {
|
||||
$smarty->assign('tracker',
|
||||
(SYS_COLLECTION == 'tracker') ? (($G_PUBLISH->Parts[0]['File'] != 'tracker/login') ? true : '') : '');
|
||||
}
|
||||
$smarty->assign('switch_interface', $switch_interface);
|
||||
$smarty->assign('switch_interface_label', G::LoadTranslation('ID_SWITCH_INTERFACE'));
|
||||
$smarty->assign('rolename', isset($_SESSION['USR_ROLENAME']) ? $_SESSION['USR_ROLENAME'] . '' : '');
|
||||
$smarty->assign('pipe', isset($_SESSION['USR_USERNAME']) ? ' | ' : '');
|
||||
$smarty->assign('logout', G::LoadTranslation('ID_LOGOUT'));
|
||||
$smarty->assign('workspace', defined('SYS_SYS')?SYS_SYS: '');
|
||||
$uws = (isset($_SESSION['USR_ROLENAME']) && $_SESSION['USR_ROLENAME'] != '')? strtolower(G::LoadTranslation('ID_WORKSPACE_USING')): G::LoadTranslation('ID_WORKSPACE_USING');
|
||||
$smarty->assign('workspace', defined('SYS_SYS') ? SYS_SYS : '');
|
||||
$uws = (isset($_SESSION['USR_ROLENAME']) && $_SESSION['USR_ROLENAME'] != '') ? strtolower(G::LoadTranslation('ID_WORKSPACE_USING')) : G::LoadTranslation('ID_WORKSPACE_USING');
|
||||
$smarty->assign('workspace_label', $uws);
|
||||
|
||||
$conf = new Configurations();
|
||||
$conf->getFormats();
|
||||
$name = $conf->userNameFormat(isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME']: '', isset($_SESSION['USR_FULLNAME']) ? htmlentities($_SESSION['USR_FULLNAME'] , ENT_QUOTES, 'UTF-8'): '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '');
|
||||
$smarty->assign('user',$name);
|
||||
$name = $conf->userNameFormat(isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '',
|
||||
isset($_SESSION['USR_FULLNAME']) ? htmlentities($_SESSION['USR_FULLNAME'], ENT_QUOTES,
|
||||
'UTF-8') : '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '');
|
||||
$smarty->assign('user', $name);
|
||||
}
|
||||
|
||||
if (defined('SYS_SYS')) {
|
||||
@@ -767,13 +787,14 @@ class SkinEngine
|
||||
$RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'] == 'PROCESSMAKER_ADMIN'
|
||||
) {
|
||||
if ($expireInLabel != '') {
|
||||
$smarty->assign('msgVer', '<label class="textBlack">' . $expireInLabel . '</label> ');
|
||||
$smarty->assign('msgVer',
|
||||
'<label class="textBlack">' . $expireInLabel . '</label> ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (defined('SYS_SYS')) {
|
||||
$logout = "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . ((SYS_COLLECTION != "tracker")? "/login/login" : "/tracker/login");
|
||||
$logout = "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . ((SYS_COLLECTION != "tracker") ? "/login/login" : "/tracker/login");
|
||||
} else {
|
||||
$logout = '/sys/' . SYS_LANG . '/' . SYS_SKIN . '/login/login';
|
||||
}
|
||||
@@ -785,8 +806,8 @@ class SkinEngine
|
||||
|
||||
$oLogoR = new ReplacementLogo();
|
||||
|
||||
if(defined("SYS_SYS")){
|
||||
$aFotoSelect = $oLogoR->getNameLogo((isset($_SESSION['USER_LOGGED']))?$_SESSION['USER_LOGGED']:'');
|
||||
if (defined("SYS_SYS")) {
|
||||
$aFotoSelect = $oLogoR->getNameLogo((isset($_SESSION['USER_LOGGED'])) ? $_SESSION['USER_LOGGED'] : '');
|
||||
|
||||
if (is_array($aFotoSelect)) {
|
||||
$sFotoSelect = trim($aFotoSelect['DEFAULT_LOGO_NAME']);
|
||||
@@ -795,15 +816,13 @@ class SkinEngine
|
||||
}
|
||||
if (class_exists('ProcessMaker\Plugins\PluginRegistry') && defined("SYS_SYS")) {
|
||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||
if ( isset($sFotoSelect) && $sFotoSelect!='' && !(strcmp($sWspaceSelect, SYS_SYS)) ){
|
||||
if (isset($sFotoSelect) && $sFotoSelect != '' && !(strcmp($sWspaceSelect, SYS_SYS))) {
|
||||
$sCompanyLogo = $oPluginRegistry->getCompanyLogo($sFotoSelect);
|
||||
$sCompanyLogo = "/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."/setup/showLogoFile.php?id=".base64_encode($sCompanyLogo);
|
||||
}
|
||||
else {
|
||||
$sCompanyLogo = "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/showLogoFile.php?id=" . base64_encode($sCompanyLogo);
|
||||
} else {
|
||||
$sCompanyLogo = $oPluginRegistry->getCompanyLogo('/images/processmaker.logo.jpg');
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sCompanyLogo = '/images/processmaker.logo.jpg';
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\DynaForm;
|
||||
|
||||
/**
|
||||
* SuggestTrait
|
||||
* Methods required to prepare the query for the suggest fields.
|
||||
*/
|
||||
trait SuggestTrait
|
||||
{
|
||||
/**
|
||||
* Get field current value.
|
||||
*
|
||||
* @param type $json
|
||||
* @return type
|
||||
*/
|
||||
private function getSuggestValue($json)
|
||||
{
|
||||
$value = "";
|
||||
if ($json->defaultValue !== "") {
|
||||
$value = $json->defaultValue;
|
||||
}
|
||||
if (isset($this->fields["APP_DATA"][$json->name])) {
|
||||
$value = $this->fields["APP_DATA"][$json->name];
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the query for the suggest field.
|
||||
*
|
||||
* @param type $sql
|
||||
* @param type $json
|
||||
* @return type
|
||||
*/
|
||||
private function prepareSuggestSql($sql, $json)
|
||||
{
|
||||
//If 0 find an specific row by the first column.
|
||||
$optionsLimit = empty($json->queryLimit) ? 0 : $json->queryLimit;
|
||||
return $this->sqlParse(
|
||||
$sql,
|
||||
function ($parsed, &$select, &$from, &$where, &$groupBy, &$having, &$orderBy, &$limit) use ($json, $optionsLimit)
|
||||
{
|
||||
$dt = $parsed["SELECT"];
|
||||
|
||||
$isWhere = empty($where);
|
||||
if ($isWhere === false) {
|
||||
$where = substr_replace($where, " (", 5, 0) . ")";
|
||||
}
|
||||
if (!isset($json->queryField) && isset($dt[0]["base_expr"])) {
|
||||
$col = $dt[0]["base_expr"];
|
||||
$dv = str_replace("'", "''", $json->defaultValue);
|
||||
if ($dv !== "") {
|
||||
$where = $isWhere ? "WHERE " . $col . "='" . $dv . "'" : $where . " AND " . $col . "='" . $dv . "'";
|
||||
}
|
||||
}
|
||||
if (isset($json->queryField) && isset($dt[0]["base_expr"])) {
|
||||
$col = isset($dt[1]["base_expr"]) ? $dt[1]["base_expr"] : $dt[0]["base_expr"];
|
||||
$qf = str_replace("'", "''", $json->queryFilter);
|
||||
$where = $isWhere ? "WHERE " . $col . " LIKE '%" . $qf . "%'" : $where . " AND " . $col . " LIKE '%" . $qf . "%'";
|
||||
}
|
||||
|
||||
if ($optionsLimit > 0) {
|
||||
$this->addSuggestLimit($json, $select, $limit, $where);
|
||||
} else {
|
||||
$this->addSuggestWhere($json, $parsed, $select, $where, $having);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the limit sentence to the suggest query.
|
||||
*
|
||||
* @param type $json
|
||||
* @param type $select
|
||||
* @param type $limit
|
||||
* @param type $where
|
||||
*/
|
||||
private function addSuggestLimit($json, &$select, &$limit, &$where)
|
||||
{
|
||||
$start = 0;
|
||||
$end = 10;
|
||||
$provider = $this->getDatabaseProvider($json->dbConnection);
|
||||
if (isset($json->queryStart)) {
|
||||
$start = $json->queryStart;
|
||||
}
|
||||
if (isset($json->queryLimit)) {
|
||||
$end = $json->queryLimit;
|
||||
}
|
||||
if (empty($limit) && $provider === "mysql") {
|
||||
$limit = "LIMIT " . $start . "," . $end . "";
|
||||
}
|
||||
if (empty($limit) && $provider === "pgsql") {
|
||||
$limit = "OFFSET " . $start . " LIMIT " . $end . "";
|
||||
}
|
||||
if ($provider === "mssql") {
|
||||
$limit = "";
|
||||
if (strpos(strtoupper($select), "TOP") === false) {
|
||||
$isDistinct = strpos(strtoupper($select), "DISTINCT");
|
||||
$isAll = strpos(strtoupper($select), "ALL");
|
||||
if ($isDistinct === false && $isAll === false) {
|
||||
$select = preg_replace("/SELECT/",
|
||||
"SELECT TOP(" . $end . ")",
|
||||
strtoupper($select), 1);
|
||||
}
|
||||
if ($isDistinct !== false) {
|
||||
$select = preg_replace("/DISTINCT/",
|
||||
"DISTINCT TOP(" . $end . ")",
|
||||
strtoupper($select), 1);
|
||||
}
|
||||
if ($isAll !== false) {
|
||||
$select = preg_replace("/DISTINCT/",
|
||||
"DISTINCT TOP(" . $end . ")",
|
||||
strtoupper($select), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($provider === "oracle") {
|
||||
$limit = "";
|
||||
$rowNumber = "";
|
||||
if (strpos(strtoupper($where), "ROWNUM") === false) {
|
||||
$rowNumber = " AND " . $start . " <= ROWNUM AND ROWNUM <= " . $end;
|
||||
}
|
||||
$where = empty($where)
|
||||
? "WHERE " . $start . " <= ROWNUM AND ROWNUM <= " . $end
|
||||
: $where . $rowNumber;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If possible, add a where to get the current label.
|
||||
*
|
||||
* @param type $json
|
||||
* @param type $parsed
|
||||
* @param type $select
|
||||
* @param type $where
|
||||
* @param type $having
|
||||
* @return boolean
|
||||
*/
|
||||
private function addSuggestWhere($json, $parsed, &$select, &$where, &$having)
|
||||
{
|
||||
$value = $this->escapeQuote($this->getSuggestValue($json));
|
||||
switch ($parsed['SELECT'][0]['expr_type']) {
|
||||
case 'colref':
|
||||
case 'expression':
|
||||
if (
|
||||
is_array($parsed['SELECT'][0]['sub_tree'])
|
||||
&& $parsed['SELECT'][0]['sub_tree'][0]['expr_type']==='aggregate_function'
|
||||
) {
|
||||
return false;
|
||||
} else {
|
||||
$where = empty($where)
|
||||
? "WHERE (" . $parsed['SELECT'][0]['base_expr'] . "='$value')"
|
||||
: "$where and (" . $parsed['SELECT'][0]['base_expr'] . "='$value')";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape a sql string.
|
||||
*
|
||||
* @param type $text
|
||||
* @return type
|
||||
*/
|
||||
private function escapeQuote($text)
|
||||
{
|
||||
return str_replace("'", "''", $text);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user