Removing deprecated references and files
This commit is contained in:
@@ -834,7 +834,6 @@ class Ajax
|
||||
$appUid = $idHistoryArray[1];
|
||||
$tasUid = $idHistoryArray[2];
|
||||
|
||||
//In enterprise version this snippet of code should be always be executed
|
||||
//In community version this snippet of code is deleted and is executed the next snippet of code
|
||||
$changeLog = new ChangeLogResult();
|
||||
$result = $changeLog->setAppUid($appUid)
|
||||
|
||||
@@ -137,11 +137,6 @@ $category = getCategoryArray();
|
||||
$columnToSearch = getColumnsSearchArray();
|
||||
$headPublisher->assign('reassignReaderFields', $reassignReaderFields); //sending the fields to get from proxy
|
||||
$headPublisher->addExtJsScript('cases/reassignList', false);
|
||||
$enableEnterprise = false;
|
||||
if (class_exists('enterprisePlugin')) {
|
||||
$enableEnterprise = true;
|
||||
$headPublisher->addExtJsScript(PATH_PLUGINS . "enterprise" . PATH_SEP . "advancedTools" . PATH_SEP, false, true);
|
||||
}
|
||||
|
||||
//Get user preferences
|
||||
$filters = $conf->getUserPreferences('FILTERS', $userUid);
|
||||
@@ -157,7 +152,6 @@ $headPublisher->assign('statusValues', $status); //Sending the listing of status
|
||||
$headPublisher->assign('processValues', $processes); //Sending the listing of processes
|
||||
$headPublisher->assign('categoryValues', $category); //Sending the listing of categories
|
||||
$headPublisher->assign('solrEnabled', $solrEnabled); //Sending the status of solar
|
||||
$headPublisher->assign('enableEnterprise', $enableEnterprise); //sending the page size
|
||||
$headPublisher->assign('columnSearchValues', $columnToSearch); //Sending the list of column for search: caseTitle, caseNumber, tasTitle
|
||||
$headPublisher->assign('filtersValues', $filters); //Sending filters defined
|
||||
$headPublisher->assign('workspace', config('system.workspace'));
|
||||
@@ -421,7 +415,6 @@ function getAdditionalFields($action, $confCasesList = [])
|
||||
$arrayConfig = $config->casesListDefaultFieldsAndConfig($action);
|
||||
|
||||
if (is_array($confCasesList) && count($confCasesList) > 0 && isset($confCasesList["second"]) && count($confCasesList["second"]["data"]) > 0) {
|
||||
//For the case list builder in the enterprise plugin
|
||||
$caseColumns = [];
|
||||
$caseReaderFields = [];
|
||||
$caseReaderFieldsAux = [];
|
||||
|
||||
@@ -7,8 +7,8 @@ switch ($action) {
|
||||
case 'getAllCounters':
|
||||
getAllCounters();
|
||||
break;
|
||||
case 'getAllCountersEnterprise':
|
||||
getAllCountersEnterprise();
|
||||
case 'getAllCountersE':
|
||||
getAllCountersE();
|
||||
break;
|
||||
default: //this is the starting call
|
||||
getLoadTreeMenuData();
|
||||
@@ -32,11 +32,8 @@ function getLoadTreeMenuData()
|
||||
$typesId['CASES_SELFSERVICE'] = 'selfservice';
|
||||
}
|
||||
|
||||
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
||||
if ($licensedFeatures->verifyfeature('7TTeDBQeWRoZTZKYjh4eFpYUlRDUUEyVERPU3FxellWank=')) {
|
||||
$typesId['CONSOLIDATED_CASES'] = 'batch_routing';
|
||||
$types[] = 'batch_routing';
|
||||
}
|
||||
$typesId['CONSOLIDATED_CASES'] = 'batch_routing';
|
||||
$types[] = 'batch_routing';
|
||||
|
||||
$list = [];
|
||||
$list['count'] = ' ';
|
||||
@@ -180,7 +177,7 @@ function getLoadTreeMenuData()
|
||||
die;
|
||||
}
|
||||
|
||||
function getAllCountersEnterprise()
|
||||
function getAllCountersE()
|
||||
{
|
||||
try {
|
||||
$userUid = (isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null;
|
||||
|
||||
@@ -106,7 +106,6 @@ if (!$sw_file_exists) {
|
||||
print G::json_encode($res);
|
||||
} else {
|
||||
$nameFile = $oAppDocument->Fields['APP_DOC_FILENAME'];
|
||||
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
||||
$downloadStatus = false;
|
||||
|
||||
$drive = new AppDocumentDrive();
|
||||
|
||||
@@ -116,7 +116,6 @@ if (!$sw_file_exists) {
|
||||
print G::json_encode($res);
|
||||
} else {
|
||||
$nameFile = $info['basename'] . $ver . '.' . $ext;
|
||||
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
||||
$downloadStatus = false;
|
||||
|
||||
$drive = new AppDocumentDrive();
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
<?php
|
||||
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
||||
if (!$licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
|
||||
$caseId = $_SESSION['APPLICATION'];
|
||||
$usrUid = $_SESSION['USER_LOGGED'];
|
||||
$usrName = $_SESSION['USR_FULLNAME'];
|
||||
|
||||
@@ -113,7 +113,7 @@ if ($oServerConf->isRtl(SYS_LANG)) {
|
||||
$regionDebug = 'east';
|
||||
}
|
||||
|
||||
$urlProxy = 'casesMenuLoader?action=getAllCountersEnterprise&r=';
|
||||
$urlProxy = 'casesMenuLoader?action=getAllCountersE&r=';
|
||||
|
||||
$oHeadPublisher->assign('regionTreePanel', $regionTreePanel);
|
||||
$oHeadPublisher->assign('regionDebug', $regionDebug);
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
* @see cases/cases_CatchExecute.php
|
||||
* @see cases/main_init.php
|
||||
*
|
||||
* @see dataReportingTools/public_html/js/reportViewer.js
|
||||
* @see EnterpriseSearch/dynaform_view.js
|
||||
*
|
||||
* @link https://wiki.processmaker.com/3.2/Cases/Cases#Search_Criteria
|
||||
* @link https://wiki.processmaker.com/3.2/Cases/Cases#Inbox
|
||||
* @link https://wiki.processmaker.com/3.2/Cases/Cases#New_Case
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Exception\RBACException;
|
||||
|
||||
// Include global object RBAC
|
||||
global $RBAC;
|
||||
|
||||
// Check if the current user have the correct permissions to access to this resource, if not throws a RBAC Exception with code 403
|
||||
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') !== 1 || $RBAC->userCanAccess('PM_SETUP_PLUGINS') !== 1) {
|
||||
throw new RBACException('ID_ACCESS_DENIED', 403);
|
||||
}
|
||||
|
||||
AddonsStore::checkLicenseStore();
|
||||
|
||||
$licenseManager = PmLicenseManager::getSingleton();
|
||||
$oHeadPublisher = headPublisher::getSingleton();
|
||||
|
||||
if (isset($licenseManager->date) && is_array($licenseManager->date)) {
|
||||
$conf = new Configurations();
|
||||
if (!empty(config("system.workspace")) && $conf->exists("ENVIRONMENT_SETTINGS")) {
|
||||
$licenseManager->date['START'] = date("Y-m-d H:i:s", strtotime($licenseManager->date['HUMAN']['START']));
|
||||
$licenseManager->date['END'] = date("Y-m-d H:i:s", strtotime($licenseManager->date['HUMAN']['END']));
|
||||
$licenseManager->date['START'] = $conf->getSystemDate($licenseManager->date['START']);
|
||||
$licenseManager->date['END'] = $conf->getSystemDate($licenseManager->date['END']);
|
||||
} else {
|
||||
$licenseManager->date['START'] = date("Y-m-d H:i:s", strtotime($licenseManager->date['HUMAN']['START']));
|
||||
$licenseManager->date['END'] = date("Y-m-d H:i:s", strtotime($licenseManager->date['HUMAN']['END']));
|
||||
$licenseManager->date['START'] = G::getformatedDate($licenseManager->date['START'], 'M d, yyyy', SYS_LANG);
|
||||
$licenseManager->date['END'] = G::getformatedDate($licenseManager->date['END'], 'M d, yyyy', SYS_LANG);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($licenseManager->result) && $licenseManager->result == "OK") {
|
||||
$oHeadPublisher->assign("license_start_date", $licenseManager->date["START"]);
|
||||
$oHeadPublisher->assign("license_end_date",
|
||||
$licenseManager->expireIn != "NEVER" ? $licenseManager->date["END"] : "NA");
|
||||
$oHeadPublisher->assign("license_user",
|
||||
$licenseManager->info["FIRST_NAME"] . " " . $licenseManager->info["LAST_NAME"] . " (" . $licenseManager->info["DOMAIN_WORKSPACE"] . ")");
|
||||
$oHeadPublisher->assign("license_span",
|
||||
$licenseManager->expireIn != "NEVER" ? ceil($licenseManager->date["SPAN"] / 60 / 60 / 24) : "~");
|
||||
$oHeadPublisher->assign("license_name", $licenseManager->type);
|
||||
$oHeadPublisher->assign("license_server", $licenseManager->server);
|
||||
$oHeadPublisher->assign("license_expires", $licenseManager->expireIn);
|
||||
$oHeadPublisher->assign("license_message", $licenseManager->status["message"]);
|
||||
$oHeadPublisher->assign("licensed", true);
|
||||
} elseif (isset($licenseManager->info)) {
|
||||
$oHeadPublisher->assign("license_start_date", $licenseManager->date["START"]);
|
||||
$oHeadPublisher->assign("license_end_date", $licenseManager->date["END"]);
|
||||
$oHeadPublisher->assign("license_span",
|
||||
$licenseManager->expireIn != "NEVER" ? ceil($licenseManager->date["SPAN"] / 60 / 60 / 24) : "~");
|
||||
$oHeadPublisher->assign("license_user",
|
||||
$licenseManager->info["FIRST_NAME"] . " " . $licenseManager->info["LAST_NAME"] . " (" . $licenseManager->info["DOMAIN_WORKSPACE"] . ")");
|
||||
$oHeadPublisher->assign("license_name", $licenseManager->type);
|
||||
$oHeadPublisher->assign("license_server", $licenseManager->server);
|
||||
$oHeadPublisher->assign("license_expires", $licenseManager->expireIn);
|
||||
$oHeadPublisher->assign("license_message", $licenseManager->status["message"]);
|
||||
$oHeadPublisher->assign("licensed", false);
|
||||
} else {
|
||||
$oHeadPublisher->assign("license_user", "");
|
||||
$oHeadPublisher->assign("license_name", "<b>Unlicensed</b>");
|
||||
$oHeadPublisher->assign("license_server", "<b>no server</b>");
|
||||
$oHeadPublisher->assign("license_expires", "");
|
||||
|
||||
$currentLicenseStatus = $licenseManager->getCurrentLicenseStatus();
|
||||
|
||||
$oHeadPublisher->assign("license_message", $currentLicenseStatus["message"]);
|
||||
$oHeadPublisher->assign("license_start_date", "");
|
||||
$oHeadPublisher->assign("license_end_date", "");
|
||||
$oHeadPublisher->assign("license_span", "");
|
||||
$oHeadPublisher->assign("licensed", false);
|
||||
}
|
||||
$oHeadPublisher->assign("license_serial",
|
||||
(isset($licenseManager->licenseSerial)) ? $licenseManager->licenseSerial : '');
|
||||
$oHeadPublisher->assign("SUPPORT_FLAG",
|
||||
((isset($licenseManager->supportStartDate) && $licenseManager->supportStartDate == '') || !isset($licenseManager->supportStartDate)) ? true : false);
|
||||
$oHeadPublisher->assign("supportStartDate",
|
||||
(isset($licenseManager->supportStartDate)) ? $licenseManager->supportStartDate : '');
|
||||
$oHeadPublisher->assign("supportEndDate",
|
||||
(isset($licenseManager->supportEndDate)) ? $licenseManager->supportEndDate : '');
|
||||
|
||||
$oHeadPublisher->assign("PROCESSMAKER_VERSION", System::getVersion());
|
||||
$oHeadPublisher->assign("PROCESSMAKER_URL", "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN);
|
||||
$oHeadPublisher->assign("SYS_SKIN", SYS_SKIN);
|
||||
$oHeadPublisher->assign("URL_PART_LOGIN",
|
||||
((substr(SYS_SKIN, 0, 2) == "ux" && SYS_SKIN != "uxs") ? "main/login" : "login/login"));
|
||||
$oHeadPublisher->assign("URL_PART_SETUP", EnterpriseUtils::getUrlPartSetup());
|
||||
$oHeadPublisher->assign("PATH_PLUGINS_WRITABLE", ((is_writable(PATH_PLUGINS)) ? 1 : 0));
|
||||
$oHeadPublisher->assign("PATH_PLUGINS_WRITABLE_MESSAGE", "The directory " . PATH_PLUGINS . " have not writable.");
|
||||
$oHeadPublisher->assign("SKIN_IS_UX", EnterpriseUtils::skinIsUx());
|
||||
$oHeadPublisher->assign("INTERNET_CONNECTION", EnterpriseUtils::getInternetConnection());
|
||||
|
||||
$oHeadPublisher->addExtJsScript("enterprise/addonsStore", true);
|
||||
G::RenderPage("publish", "extJs");
|
||||
@@ -1,347 +0,0 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Exception\RBACException;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use ProcessMaker\Validation\ExceptionRestApi;
|
||||
use ProcessMaker\Validation\ValidationUploadedFiles;
|
||||
|
||||
// Include global object RBAC
|
||||
global $RBAC;
|
||||
|
||||
// Check if the current user have the correct permissions to access to this resource, if not throws a RBAC Exception with code 403
|
||||
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') !== 1 || $RBAC->userCanAccess('PM_SETUP_PLUGINS') !== 1) {
|
||||
throw new RBACException('ID_ACCESS_DENIED', 403);
|
||||
}
|
||||
|
||||
function runBgProcessmaker($task, $log)
|
||||
{
|
||||
require_once(PATH_CORE . "bin/tasks/cliAddons.php");
|
||||
|
||||
$task = str_replace("\"", null, $task);
|
||||
$data = explode(" ", $task);
|
||||
|
||||
$elem = array_shift($data); //delete first element
|
||||
|
||||
run_addon_core_install($data);
|
||||
}
|
||||
|
||||
try {
|
||||
ValidationUploadedFiles::getValidationUploadedFiles()->dispatch(function($validator) {
|
||||
throw new ExceptionRestApi($validator->getMessage());
|
||||
});
|
||||
if (isset($_REQUEST["action"])) {
|
||||
$action = $_REQUEST["action"];
|
||||
} else {
|
||||
throw (new Exception("Action undefined"));
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['addon']) && isset($_REQUEST['store'])) {
|
||||
require_once(PATH_CORE . 'classes/model/AddonsManagerPeer.php');
|
||||
|
||||
$addon = AddonsManagerPeer::retrieveByPK($_REQUEST['addon'], $_REQUEST['store']);
|
||||
$addonId = $_REQUEST['addon'];
|
||||
$storeId = $_REQUEST['store'];
|
||||
|
||||
if ($addon === null) {
|
||||
throw (new Exception("Unable to find addon (id: '{$_REQUEST['addon']}', store: '{$_REQUEST['store']}')"));
|
||||
}
|
||||
} else {
|
||||
$addon = null;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
|
||||
switch (strtolower($action)) {
|
||||
case "importlicense":
|
||||
if (sizeof($_FILES) > 0) {
|
||||
$aInfoLoadFile = $_FILES["upLicense"];
|
||||
$aExtentionFile = explode(".", $aInfoLoadFile["name"]);
|
||||
|
||||
//validating the extention before to upload it
|
||||
if (trim($aExtentionFile[sizeof($aExtentionFile) - 1]) != "dat") {
|
||||
//G::SendTemporalMessage("ID_ISNT_LICENSE", "tmp-info", "labels");
|
||||
$result["errors"] = "Filename does not end with .dat";
|
||||
$result["success"] = false;
|
||||
} else {
|
||||
$dir = PATH_DATA_SITE;
|
||||
G::uploadFile($aInfoLoadFile["tmp_name"], $dir, $aInfoLoadFile["name"]);
|
||||
//reading the file that was uploaded
|
||||
$oPmLicenseManager = PmLicenseManager::getSingleton();
|
||||
$response = $oPmLicenseManager->installLicense($dir . $aInfoLoadFile["name"]);
|
||||
|
||||
///////
|
||||
//This command also find the following file "AddonsStore.php"
|
||||
$licenseManager = PmLicenseManager::getSingleton();
|
||||
|
||||
preg_match("/^license_(.*).dat$/", $licenseManager->file, $matches);
|
||||
$realId = urlencode($matches[1]);
|
||||
|
||||
$workspace = (isset($licenseManager->workspace)) ? $licenseManager->workspace : 'pmLicenseSrv';
|
||||
$addonLocation = "http://{$licenseManager->server}/sys".$workspace."/en/green/services/addonsStore?action=getInfo&licId=$realId";
|
||||
|
||||
///////
|
||||
$cnn = Propel::getConnection("workflow");
|
||||
|
||||
$oCriteriaSelect = new Criteria("workflow");
|
||||
$oCriteriaSelect->add(AddonsStorePeer::STORE_ID, $licenseManager->id);
|
||||
|
||||
$oCriteriaUpdate = new Criteria("workflow");
|
||||
$oCriteriaUpdate->add(AddonsStorePeer::STORE_ID, $licenseManager->id);
|
||||
$oCriteriaUpdate->add(AddonsStorePeer::STORE_LOCATION, $addonLocation);
|
||||
|
||||
BasePeer::doUpdate($oCriteriaSelect, $oCriteriaUpdate, $cnn);
|
||||
|
||||
//are all the plugins that are enabled in the workspace
|
||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||
/** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $plugin */
|
||||
foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) {
|
||||
if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) {
|
||||
$pluginRegistry->disablePlugin($plugin->getNamespace());
|
||||
// In order to keep the custom plugins state, it is required to set the attribute before saving the info
|
||||
$plugin->setEnabled(true);
|
||||
$pluginRegistry->savePlugin($plugin->getNamespace());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "cancel":
|
||||
if ($addon === null) {
|
||||
throw new Exception("No addon specified to $action");
|
||||
}
|
||||
if ($addon->getAddonState() == "download") {
|
||||
$addon->setState("cancel");
|
||||
}
|
||||
break;
|
||||
case "uninstall":
|
||||
$status = 1;
|
||||
|
||||
try {
|
||||
if ($addon === null) {
|
||||
throw new Exception("No addon specified to $action");
|
||||
}
|
||||
|
||||
$r = $addon->uninstall();
|
||||
|
||||
$result["status"] = "OK";
|
||||
} catch (Exception $e) {
|
||||
$result["message"] = $e->getMessage();
|
||||
$status = 0;
|
||||
}
|
||||
|
||||
if ($status == 0) {
|
||||
$result["status"] = "ERROR";
|
||||
}
|
||||
break;
|
||||
case "finish":
|
||||
if ($addon === null) {
|
||||
throw new Exception("No addon specified to $action");
|
||||
}
|
||||
$addon->setState();
|
||||
break;
|
||||
case "disable":
|
||||
case "enable":
|
||||
if ($addon === null) {
|
||||
throw new Exception("No addon specified to $action");
|
||||
}
|
||||
|
||||
$result["success"] = $addon->setEnabled(($action == "enable"));
|
||||
|
||||
if ($action == "enable") {
|
||||
G::auditLog("EnablePlugin", "Plugin Name: ".$_REQUEST['addon']);
|
||||
} else {
|
||||
G::auditLog("DisablePlugin", "Plugin Name: ".$_REQUEST['addon']);
|
||||
}
|
||||
|
||||
break;
|
||||
case "install":
|
||||
$status = 1;
|
||||
|
||||
try {
|
||||
if (EnterpriseUtils::getInternetConnection() == 0) {
|
||||
throw (new Exception("Enterprise Plugins Manager no connected to internet."));
|
||||
}
|
||||
|
||||
///////
|
||||
$aux = explode("?", $addon->getAddonDownloadUrl());
|
||||
$url = $aux[0];
|
||||
|
||||
if (EnterpriseUtils::checkConnectivity($url) == false) {
|
||||
throw (new Exception("Server $url not available."));
|
||||
}
|
||||
|
||||
if ($addon === null) {
|
||||
throw new Exception("No addon specified to $action");
|
||||
}
|
||||
|
||||
///////
|
||||
$workspace = config("system.workspace");
|
||||
$dbAdapter = DB_ADAPTER;
|
||||
|
||||
$addon->setAddonState("download-start");
|
||||
$addon->save();
|
||||
|
||||
$log = $addon->getDownloadDirectory() . "/download";
|
||||
runBgProcessmaker("addon-install \"$workspace\" \"$storeId\" \"$addonId\" \"$dbAdapter\"", $log);
|
||||
|
||||
//Check if the background process started successfully.
|
||||
$failed = false;
|
||||
$max_retries = 15;
|
||||
$retries = 0;
|
||||
|
||||
while (true) {
|
||||
sleep(1);
|
||||
$addon->refresh();
|
||||
|
||||
if ($addon->getAddonState() != "download-start") {
|
||||
break;
|
||||
}
|
||||
|
||||
$retries += 1;
|
||||
|
||||
if ($retries > $max_retries) {
|
||||
$failed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$result["status"] = "OK";
|
||||
} catch (Exception $e) {
|
||||
$result["message"] = $e->getMessage();
|
||||
$status = 0;
|
||||
}
|
||||
|
||||
if ($status == 0) {
|
||||
$result["status"] = "ERROR";
|
||||
}
|
||||
break;
|
||||
case "available":
|
||||
$addonId = $_POST["addonId"];
|
||||
|
||||
$response = array();
|
||||
$status = 1;
|
||||
|
||||
try {
|
||||
if (EnterpriseUtils::getInternetConnection() == 0) {
|
||||
throw (new Exception("Enterprise Plugins Manager no connected to internet."));
|
||||
}
|
||||
|
||||
///////
|
||||
$licenseManager = PmLicenseManager::getSingleton();
|
||||
$server = $licenseManager->server;
|
||||
$workspace = (isset($licenseManager->workspace)) ? $licenseManager->workspace : 'pmLicenseSrv';
|
||||
$url = "http://$server/sys".$workspace."/en/green/services/rest";
|
||||
|
||||
if (EnterpriseUtils::checkConnectivity($url) == false) {
|
||||
throw (new Exception("Server \"$server\" not available."));
|
||||
}
|
||||
|
||||
///////
|
||||
$boundary = "---------------------" . substr(G::encryptOld(rand(0, 32000)), 0, 10);
|
||||
$data = null;
|
||||
|
||||
$data = $data . "--$boundary\n";
|
||||
$data = $data . "Content-Disposition: form-data; name=\"action\"\n\n" . "requestToSales" . "\n";
|
||||
$data = $data . "--$boundary\n";
|
||||
$data = $data . "Content-Disposition: form-data; name=\"OBJ_NAME\"\n\n" . $addonId . "\n";
|
||||
$data = $data . "--$boundary\n";
|
||||
|
||||
///////
|
||||
//$licenseManager = PmLicenseManager::getSingleton();
|
||||
$activeLicense = $licenseManager->getActiveLicense();
|
||||
|
||||
$data = $data . "Content-Disposition: form-data; name=\"licenseFile\"; filename=\"" . $licenseManager->file . "\"\n";
|
||||
$data = $data . "Content-Type: text/plain\n";
|
||||
$data = $data . "Content-Transfer-Encoding: binary\n\n";
|
||||
$data = $data . file_get_contents($activeLicense["LICENSE_PATH"]) . "\n";
|
||||
$data = $data . "--$boundary\n";
|
||||
|
||||
///////
|
||||
$option = array(
|
||||
"http" => array(
|
||||
"method" => "POST",
|
||||
"header" => "Content-Type: multipart/form-data; boundary=" . $boundary,
|
||||
"content" => $data
|
||||
)
|
||||
);
|
||||
|
||||
// Proxy settings
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
if (!is_array($option['http'])) {
|
||||
$option['http'] = array();
|
||||
}
|
||||
$option['http']['request_fulluri'] = true;
|
||||
$option['http']['proxy'] = 'tcp://' . $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '');
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
if (!isset($option['http']['header'])) {
|
||||
$option['http']['header'] = '';
|
||||
}
|
||||
$option['http']['header'] .= 'Proxy-Authorization: Basic ' . base64_encode($sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
|
||||
}
|
||||
}
|
||||
|
||||
$context = stream_context_create($option);
|
||||
|
||||
///////
|
||||
$fileData = file_get_contents($url, false, $context);
|
||||
|
||||
//////////
|
||||
$r = G::json_decode($fileData);
|
||||
|
||||
if ($r->status == "OK") {
|
||||
$response["status"] = $r->status; //OK
|
||||
} else {
|
||||
throw (new Exception($r->message));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$response["message"] = $e->getMessage();
|
||||
$status = 0;
|
||||
}
|
||||
|
||||
if ($status == 0) {
|
||||
$response["status"] = "ERROR";
|
||||
}
|
||||
|
||||
echo G::json_encode($response);
|
||||
exit(0);
|
||||
break;
|
||||
case "addonslist":
|
||||
$type = (isset($_REQUEST['type'])) ? $_REQUEST['type']: 'plugin';
|
||||
$result = AddonsStore::addonList($type);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
throw (new Exception("Action \"$action\" is not valid"));
|
||||
}
|
||||
|
||||
if (!isset($result["success"])) {
|
||||
$result["success"] = true;
|
||||
}
|
||||
|
||||
if (isset($result["addons"])) {
|
||||
$result["addons"] = array_values($result["addons"]);
|
||||
} else {
|
||||
$result["addons"] = array();
|
||||
}
|
||||
G::outRes(G::json_encode($result));
|
||||
} catch (ExceptionRestApi $e) {
|
||||
$token = strtotime("now");
|
||||
PMException::registerErrorLog($e, $token);
|
||||
G::outRes(
|
||||
G::json_encode(array(
|
||||
"success" => false,
|
||||
"errors" => $e->getMessage()
|
||||
))
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$token = strtotime("now");
|
||||
PMException::registerErrorLog($e, $token);
|
||||
G::outRes(
|
||||
G::json_encode(array(
|
||||
"success" => false,
|
||||
"errors" => G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token))
|
||||
))
|
||||
);
|
||||
}
|
||||
@@ -1,371 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
if (!defined("PATH_PM_ENTERPRISE")) {
|
||||
define("PATH_PM_ENTERPRISE", PATH_CORE . "enterprise/");
|
||||
}
|
||||
|
||||
if (!defined("PATH_DATA_SITE")) {
|
||||
define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("system.workspace") . "/");
|
||||
}
|
||||
|
||||
set_include_path(PATH_PM_ENTERPRISE . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
class enterprisePlugin extends PMPlugin
|
||||
{
|
||||
public function __construct($sNamespace, $sFilename = null)
|
||||
{
|
||||
$pathPluginTrunk = PATH_CORE . "enterprise";
|
||||
|
||||
$VERSION = System::getVersion();
|
||||
|
||||
$res = parent::PMPlugin($sNamespace, $sFilename);
|
||||
$this->sFriendlyName = "ProcessMaker Enterprise Core Edition";
|
||||
$this->sDescription = "ProcessMaker Enterprise Core Edition $VERSION";
|
||||
$this->sPluginFolder = "enterprise";
|
||||
$this->sSetupPage = "../enterprise/addonsStore.php";
|
||||
$this->iVersion = $VERSION;
|
||||
$this->iPMVersion = "2.0.31";
|
||||
$this->aDependences = null;
|
||||
$this->aWorkspaces = null;
|
||||
|
||||
$this->database = "workflow";
|
||||
$this->table = array("ADDONS_STORE", "ADDONS_MANAGER", "LICENSE_MANAGER");
|
||||
|
||||
if (!isset($_SESSION["__EE_INSTALLATION__"])) {
|
||||
$_SESSION["__EE_INSTALLATION__"] = 0;
|
||||
}
|
||||
|
||||
if (!isset($_SESSION["__EE_SW_PMLICENSEMANAGER__"])) {
|
||||
$_SESSION["__EE_SW_PMLICENSEMANAGER__"] = 1;
|
||||
}
|
||||
|
||||
$sw = 1;
|
||||
$msgf = null;
|
||||
$msgd = null;
|
||||
|
||||
if (file_exists(PATH_CORE . "plugins" . PATH_SEP . "pmLicenseManager.php")) {
|
||||
$_SESSION["__EE_INSTALLATION__"] = 1;
|
||||
$_SESSION["__EE_SW_PMLICENSEMANAGER__"] = 0;
|
||||
|
||||
$plugin = "pmLicenseManager";
|
||||
$this->pluginUninstall($plugin);
|
||||
|
||||
if (file_exists(PATH_CORE . "plugins" . PATH_SEP . $plugin . ".php") || file_exists(PATH_CORE . "plugins" . PATH_SEP . $plugin)) {
|
||||
$msgf = $msgf . (($msgf != null)? ", " : null) . $plugin . ".php";
|
||||
$msgd = $msgd . (($msgd != null)? ", " : null) . $plugin;
|
||||
$sw = 0;
|
||||
}
|
||||
|
||||
$plugin = "enterprise";
|
||||
$this->pluginUninstall($plugin);
|
||||
|
||||
if (file_exists(PATH_CORE . "plugins" . PATH_SEP . $plugin . ".php") || file_exists(PATH_CORE . "plugins" . PATH_SEP . $plugin)) {
|
||||
$msgf = $msgf . (($msgf != null)? ", " : null) . $plugin . ".php";
|
||||
$msgd = $msgd . (($msgd != null)? ", " : null) . $plugin;
|
||||
$sw = 0;
|
||||
}
|
||||
|
||||
$this->uninstall();
|
||||
} else {
|
||||
$_SESSION["__EE_INSTALLATION__"] = $_SESSION["__EE_INSTALLATION__"] + 1;
|
||||
}
|
||||
|
||||
if ($sw == 0) {
|
||||
unset($_SESSION["__EE_INSTALLATION__"]);
|
||||
unset($_SESSION["__EE_SW_PMLICENSEMANAGER__"]);
|
||||
|
||||
///////
|
||||
$js = "window.open(\"/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main?s=PLUGINS\", \"_top\", \"\");";
|
||||
|
||||
if (substr(SYS_SKIN, 0, 2) == "ux" && SYS_SKIN != "uxs") {
|
||||
$js = "window.open(\"/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/main\", \"_top\", \"\");";
|
||||
}
|
||||
|
||||
///////
|
||||
G::SendMessageText("ProcessMaker Enterprise plug-in can't delete the files \"$msgf\" and directories \"$msgd\" of \"" . (PATH_CORE . "plugins") . "\". Before proceeding with the installation of the plug-in must remove them.", "INFO");
|
||||
|
||||
echo "<script type=\"text/javascript\">" . $js . "</script>";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ($_SESSION["__EE_SW_PMLICENSEMANAGER__"] == 0 && $_SESSION["__EE_INSTALLATION__"] == 2) {
|
||||
unset($_SESSION["__EE_INSTALLATION__"]);
|
||||
unset($_SESSION["__EE_SW_PMLICENSEMANAGER__"]);
|
||||
|
||||
$this->install();
|
||||
}
|
||||
|
||||
///////
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||
|
||||
$pluginDetail = $pluginRegistry->getPluginDetails("enterprise.php");
|
||||
$pluginRegistry->enablePlugin($pluginDetail->getNamespace());
|
||||
|
||||
file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
}
|
||||
|
||||
public function setup()
|
||||
{
|
||||
if (!PluginsRegistryPeer::retrieveByPK(md5('enterprise'))) {
|
||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||
$pluginDetail = $pluginRegistry->getPluginDetails("enterprise.php");
|
||||
$pluginRegistry->enablePlugin($pluginDetail->getNamespace());
|
||||
$pluginRegistry->savePlugin($pluginDetail->getNamespace());
|
||||
}
|
||||
}
|
||||
|
||||
public function enable()
|
||||
{
|
||||
$this->setConfiguration();
|
||||
|
||||
require_once(PATH_CORE . 'classes/model/AddonsStore.php');
|
||||
AddonsStore::checkLicenseStore();
|
||||
$licenseManager = PmLicenseManager::getSingleton();
|
||||
AddonsStore::updateAll(false);
|
||||
}
|
||||
|
||||
public function disable()
|
||||
{
|
||||
}
|
||||
|
||||
public function setConfiguration()
|
||||
{
|
||||
$confEeUid = "enterpriseConfiguration";
|
||||
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(ConfigurationPeer::CFG_VALUE);
|
||||
$criteria->add(ConfigurationPeer::CFG_UID, "EE");
|
||||
$criteria->add(ConfigurationPeer::OBJ_UID, $confEeUid);
|
||||
|
||||
$rsCriteria = ConfigurationPeer::doSelectRS($criteria);
|
||||
|
||||
if (!$rsCriteria->next()) {
|
||||
$conf = new Configuration();
|
||||
|
||||
$data = array("internetConnection" => 1);
|
||||
|
||||
$conf->create(
|
||||
array(
|
||||
"CFG_UID" => "EE",
|
||||
"OBJ_UID" => $confEeUid,
|
||||
"CFG_VALUE" => serialize($data),
|
||||
"PRO_UID" => "",
|
||||
"USR_UID" => "",
|
||||
"APP_UID" => ""
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function pluginUninstall($pluginName)
|
||||
{
|
||||
//define("PATH_PLUGINS", PATH_CORE . "plugins" . PATH_SEP);
|
||||
|
||||
if (file_exists(PATH_CORE . "plugins" . PATH_SEP . $pluginName . ".php")) {
|
||||
require_once(PATH_CORE . "plugins" . PATH_SEP . $pluginName . ".php");
|
||||
|
||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||
|
||||
$pluginDetail = $pluginRegistry->getPluginDetails($pluginName . ".php");
|
||||
|
||||
if ($pluginDetail) {
|
||||
$pluginRegistry->enablePlugin($pluginDetail->getNamespace());
|
||||
$pluginRegistry->disablePlugin($pluginDetail->getNamespace());
|
||||
|
||||
///////
|
||||
$className = $pluginDetail->getClassName();
|
||||
$plugin = new $className($pluginDetail->getNamespace(), $pluginDetail->getFile());
|
||||
//$this->_aPlugins[$pluginDetail->sNamespace] = $plugin;
|
||||
|
||||
if (method_exists($plugin, "uninstall")) {
|
||||
$plugin->uninstall();
|
||||
}
|
||||
|
||||
///////
|
||||
$pluginRegistry->savePlugin($pluginDetail->getNamespace());
|
||||
}
|
||||
|
||||
///////
|
||||
unlink(PATH_CORE . "plugins" . PATH_SEP . $pluginName . ".php");
|
||||
|
||||
if (file_exists(PATH_CORE . "plugins" . PATH_SEP . $pluginName)) {
|
||||
G::rm_dir(PATH_CORE . "plugins" . PATH_SEP . $pluginName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registeres the plugin in the enterprise data
|
||||
* Note, this utilizes caching to reduce the burden of the file I/O on the ee file. However, this does
|
||||
* require caching to be enabled.
|
||||
*/
|
||||
public function registerEE($pluginFile, $pluginVersion)
|
||||
{
|
||||
$cacheKey = config('system.workspace') . 'enterprise.ee';
|
||||
// Fetch the value from cache. If not present, fetch from the filesystem.
|
||||
$value = Cache::get($cacheKey, function () use($cacheKey) {
|
||||
if (file_exists(PATH_DATA_SITE . "ee")) {
|
||||
$contents = trim(file_get_contents(PATH_DATA_SITE . "ee"));
|
||||
// Store it in cache so it can be used in the future
|
||||
Cache::forever($cacheKey, $contents);
|
||||
return $contents;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
if ($value) {
|
||||
$this->systemAvailable = unserialize($value);
|
||||
} else {
|
||||
// Handle potential no value
|
||||
$this->systemAvailable = [];
|
||||
}
|
||||
|
||||
$filename = $pluginFile . '-' . $pluginVersion . '.tar';
|
||||
|
||||
// Check to see if update is required
|
||||
if (
|
||||
!isset($this->systemAvailable[$pluginFile]) ||
|
||||
!isset($this->systemAvailable[$pluginFile]['sFilename']) ||
|
||||
$this->systemAvailable[$pluginFile]['sFilename'] != $filename
|
||||
) {
|
||||
// Update required
|
||||
$this->systemAvailable[$pluginFile]["sFilename"] = $filename;
|
||||
file_put_contents(PATH_DATA_SITE . "ee", serialize($this->systemAvailable));
|
||||
// Put in cache as well
|
||||
Cache::forever($cacheKey, serialize($this->systemAvailable));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkDependencies()
|
||||
{
|
||||
}
|
||||
|
||||
public function tableBackup($tableBackup, $backupPrefix = "_", $backupSuffix = "_TEMP")
|
||||
{
|
||||
//Database Connections
|
||||
$cnn = Propel::getConnection($this->database);
|
||||
$stmt = $cnn->createStatement();
|
||||
|
||||
foreach ($tableBackup as $key => $table) {
|
||||
$tablebak = $backupPrefix . $table . $backupSuffix;
|
||||
|
||||
//First Search if the Table exists
|
||||
$sqlTable = "SHOW TABLES LIKE '$table'";
|
||||
$rsTable = $stmt->executeQuery($sqlTable, ResultSet::FETCHMODE_ASSOC);
|
||||
if ($rsTable->getRecordCount() > 0) {
|
||||
//Table $table exists, so we can Backup
|
||||
//If there are records in $table Backup
|
||||
$sqlSelectTable = "SELECT * FROM $table";
|
||||
$rsSelectTable = $stmt->executeQuery($sqlSelectTable, ResultSet::FETCHMODE_ASSOC);
|
||||
if ($rsSelectTable->getRecordCount() > 0) {
|
||||
//There are records in $table!! Backup!
|
||||
//Delete a previous Backup if exists
|
||||
$sql = "DROP TABLE IF EXISTS $tablebak;";
|
||||
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
//Create a COPY of $table in $tablebak :: Backup
|
||||
$sql = "CREATE TABLE $tablebak SELECT * FROM $table";
|
||||
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
//Delete a previous $table if exists
|
||||
$sql = "DROP TABLE IF EXISTS $table;";
|
||||
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function tableBackupRestore($tableBackup, $backupPrefix = "_", $backupSuffix = "_TEMP")
|
||||
{
|
||||
//Database Connections
|
||||
$cnn = Propel::getConnection($this->database);
|
||||
$stmt = $cnn->createStatement();
|
||||
|
||||
foreach ($tableBackup as $key => $table) {
|
||||
$tablebak = $backupPrefix . $table . $backupSuffix;
|
||||
|
||||
//First Search if the $tablebak exists
|
||||
$sqlTablebak = "SHOW TABLES LIKE '$tablebak'";
|
||||
$rsTablebak = $stmt->executeQuery($sqlTablebak, ResultSet::FETCHMODE_ASSOC);
|
||||
if ($rsTablebak->getRecordCount() > 0) {
|
||||
//Table $tablebak exists, so we can Restore
|
||||
$sqlSelectTablebak = "SELECT * FROM $tablebak";
|
||||
$rsSelectTablebak = $stmt->executeQuery($sqlSelectTablebak, ResultSet::FETCHMODE_ASSOC);
|
||||
if ($rsSelectTablebak->getRecordCount() > 0) {
|
||||
$strTable = str_replace("_", " ", strtolower($table));
|
||||
$strTable = str_replace(" ", null, ucwords($strTable));
|
||||
|
||||
require_once(PATH_PLUGINS . "enterprise" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "$strTable.php");
|
||||
|
||||
while ($rsSelectTablebak->next()) {
|
||||
$row = $rsSelectTablebak->getRow();
|
||||
|
||||
//INSERT INTO TABLEN(FIELD1, FIELD2) VALUES('VALUE1', 'VALUE2')
|
||||
$oTable = new $strTable();
|
||||
$oTable->fromArray($row, BasePeer::TYPE_FIELDNAME); //Fill an object from of the array //Fill attributes
|
||||
$oTable->save();
|
||||
}
|
||||
}
|
||||
|
||||
//Delete Backup
|
||||
$sql = "DROP TABLE IF EXISTS $tablebak;";
|
||||
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function sqlExecute($sqlFile)
|
||||
{
|
||||
$file = fopen($sqlFile, "r");
|
||||
|
||||
if ($file) {
|
||||
$line = null;
|
||||
|
||||
while (!feof($file)) {
|
||||
$buffer = trim(fgets($file, 4096)); //Read a line.
|
||||
|
||||
if (strlen($buffer) > 0 && $buffer[0] != "#") {
|
||||
//Check for valid lines
|
||||
$line = $line . $buffer;
|
||||
|
||||
if ($buffer[strlen($buffer) - 1] == ";") {
|
||||
$cnn = Propel::getConnection($this->database);
|
||||
$stmt = $cnn->createStatement();
|
||||
$rs = $stmt->executeQuery($line, ResultSet::FETCHMODE_NUM);
|
||||
$line = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||
$oPluginRegistry->registerPlugin('enterprise', __FILE__); //<- enterprise string must be in single quote, otherwise generate error
|
||||
|
||||
//since we are placing pmLicenseManager and EE together.. after register EE, we need to require_once the pmLicenseManager
|
||||
//if( !defined("PATH_PM_LICENSE_MANAGER") ) {
|
||||
// define("PATH_PM_LICENSE_MANAGER", PATH_CORE . "/plugins/pmLicenseManager/");
|
||||
//}
|
||||
//set_include_path(
|
||||
// PATH_PM_LICENSE_MANAGER.PATH_SEPARATOR.
|
||||
// get_include_path()
|
||||
//);
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
require_once ("classes/model/Configuration.php");
|
||||
|
||||
$option = (isset($_POST["option"]))? $_POST["option"] : null;
|
||||
$response = array();
|
||||
|
||||
switch ($option) {
|
||||
case "SETUP":
|
||||
$swInternetConnection = intval($_POST["internetConnection"]);
|
||||
|
||||
$status = 1;
|
||||
|
||||
try {
|
||||
$confEeUid = "enterpriseConfiguration";
|
||||
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(ConfigurationPeer::CFG_VALUE);
|
||||
$criteria->add(ConfigurationPeer::CFG_UID, "EE");
|
||||
$criteria->add(ConfigurationPeer::OBJ_UID, $confEeUid);
|
||||
|
||||
$rsCriteria = ConfigurationPeer::doSelectRS($criteria);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$data = unserialize($row[0]);
|
||||
|
||||
$data["internetConnection"] = $swInternetConnection;
|
||||
|
||||
//Update values
|
||||
$criteria1 = new Criteria("workflow");
|
||||
|
||||
$criteria1->add(ConfigurationPeer::CFG_UID, "EE");
|
||||
$criteria1->add(ConfigurationPeer::OBJ_UID, $confEeUid);
|
||||
|
||||
//Update set
|
||||
$criteria2 = new Criteria("workflow");
|
||||
|
||||
$criteria2->add(ConfigurationPeer::CFG_VALUE, serialize($data));
|
||||
|
||||
BasePeer::doUpdate($criteria1, $criteria2, Propel::getConnection("workflow"));
|
||||
} else {
|
||||
$conf = new Configuration();
|
||||
$data = array("internetConnection" => $swInternetConnection);
|
||||
$conf->create(
|
||||
array(
|
||||
"CFG_UID" => "EE",
|
||||
"OBJ_UID" => $confEeUid,
|
||||
"CFG_VALUE" => serialize($data),
|
||||
"PRO_UID" => "",
|
||||
"USR_UID" => "",
|
||||
"APP_UID" => ""
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$response["status"] = "OK";
|
||||
} catch (Exception $e) {
|
||||
$response["message"] = $e->getMessage();
|
||||
$status = 0;
|
||||
}
|
||||
|
||||
if ($status == 0) {
|
||||
$response["status"] = "ERROR";
|
||||
}
|
||||
break;
|
||||
}
|
||||
echo G::json_encode($response);
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* processes_ImportFile.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.
|
||||
*
|
||||
*/
|
||||
|
||||
global $RBAC;
|
||||
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use ProcessMaker\Validation\ValidationUploadedFiles;
|
||||
|
||||
$RBAC->requirePermissions("PM_SETUP_ADVANCE");
|
||||
require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php';
|
||||
|
||||
$response = array();
|
||||
$status = 1;
|
||||
|
||||
try {
|
||||
ValidationUploadedFiles::getValidationUploadedFiles()->dispatch(function($validator) {
|
||||
throw new Exception($validator->getMessage());
|
||||
});
|
||||
|
||||
if (!isset($_FILES["form"]["error"]["PLUGIN_FILENAME"]) || $_FILES["form"]["error"]["PLUGIN_FILENAME"] == 1) {
|
||||
$str = "There was an error uploading the file, probably the file size if greater than upload_max_filesize parameter in php.ini, please check this parameter and try again.";
|
||||
throw (new Exception($str));
|
||||
}
|
||||
|
||||
//save the file
|
||||
if ($_FILES["form"]["error"]["PLUGIN_FILENAME"] == 0) {
|
||||
$filename = $_FILES["form"]["name"]["PLUGIN_FILENAME"];
|
||||
$path = PATH_DOCUMENT . "input" . PATH_SEP ;
|
||||
$tempName = $_FILES["form"]["tmp_name"]["PLUGIN_FILENAME"];
|
||||
G::uploadFile($tempName, $path, $filename );
|
||||
}
|
||||
|
||||
if (!$_FILES["form"]["type"]["PLUGIN_FILENAME"] == "application/octet-stream") {
|
||||
$str = "the uploaded files are invalid, expected \"application/octect-stream\" mime type file (". $_FILES["form"]["type"]["PLUGIN_FILENAME"] . ")";
|
||||
throw (new Exception($str));
|
||||
}
|
||||
|
||||
|
||||
$tar = new Archive_Tar($path. $filename);
|
||||
$sFileName = substr($filename, 0, strrpos($filename, "."));
|
||||
$sClassName = substr($filename, 0, strpos($filename, "-"));
|
||||
|
||||
$aFiles = $tar->listContent();
|
||||
$bMainFile = false;
|
||||
$bClassFile = false;
|
||||
|
||||
if (is_array($aFiles)) {
|
||||
foreach ($aFiles as $key => $val) {
|
||||
if ($val["filename"] == $sClassName . ".php") {
|
||||
$bMainFile = true;
|
||||
}
|
||||
if ($val["filename"] == $sClassName . PATH_SEP . "class." . $sClassName . ".php") {
|
||||
$bClassFile = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$str = "Failed to import the file default by doesn't a plugin or invalid file.";
|
||||
throw (new Exception($str));
|
||||
}
|
||||
|
||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||
$pluginFile = $sClassName . '.php';
|
||||
|
||||
if ($bMainFile && $bClassFile) {
|
||||
$sAux = $sClassName . 'Plugin';
|
||||
$fVersionOld = 0.0;
|
||||
if (file_exists(PATH_PLUGINS . $pluginFile)) {
|
||||
if (!class_exists($sAux) && !class_exists($sClassName . 'plugin')) {
|
||||
include PATH_PLUGINS . $pluginFile;
|
||||
}
|
||||
if (!class_exists($sAux)) {
|
||||
$sAux = $sClassName . 'plugin';
|
||||
}
|
||||
$oClass = new $sAux($sClassName);
|
||||
$fVersionOld = $oClass->iVersion;
|
||||
unset($oClass);
|
||||
}
|
||||
|
||||
$res = $tar->extract($path);
|
||||
|
||||
//Verify if not is Enterprise Plugin
|
||||
if (!$oPluginRegistry->isEnterprisePlugin($sClassName, $path)) {
|
||||
throw new Exception(G::LoadTranslation('ID_EEPLUGIN_IMPORT_PLUGIN_NOT_IS_ENTERPRISE', [$filename]));
|
||||
}
|
||||
|
||||
$res = $tar->extract(PATH_PLUGINS);
|
||||
} else {
|
||||
$str = "The file $filename doesn't contain class: $sClassName ";
|
||||
throw (new Exception($str));
|
||||
}
|
||||
|
||||
if (! file_exists(PATH_PLUGINS . $sClassName . '.php')) {
|
||||
$str = "File '$pluginFile' doesn't exists ";
|
||||
throw (new Exception($str));
|
||||
}
|
||||
|
||||
require_once (PATH_PLUGINS . $pluginFile);
|
||||
|
||||
$oPluginRegistry->registerPlugin($sClassName, PATH_PLUGINS . $sClassName . ".php");
|
||||
|
||||
$details = $oPluginRegistry->getPluginDetails($pluginFile);
|
||||
|
||||
$oPluginRegistry->installPlugin($details->getNamespace());
|
||||
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
|
||||
$oPluginRegistry->savePlugin($details->getNamespace());
|
||||
|
||||
//G::header("Location: pluginsList");
|
||||
//die;
|
||||
|
||||
$response["success"] = true;
|
||||
} catch (Exception $e) {
|
||||
$response["message"] = $e->getMessage();
|
||||
$status = 0;
|
||||
}
|
||||
|
||||
if ($status == 0) {
|
||||
$response["success"] = false;
|
||||
}
|
||||
|
||||
G::outRes( G::json_encode($response) );
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
$pluginFile = $_GET['id'];
|
||||
|
||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||
|
||||
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
|
||||
$folder = $details->getFolder();
|
||||
$xmlform = (isset($folder)) ? $folder . '/' . $details->getSetupPage() : '';
|
||||
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_ID_MENU_SELECTED = 'SETUP';
|
||||
$G_SUB_MENU = 'setup';
|
||||
$G_ID_SUB_MENU_SELECTED = 'PLUGINS';
|
||||
$G_PUBLISH = new Publisher;
|
||||
try {
|
||||
//the setup page is a special page
|
||||
if (substr($xmlform,-4) == '.php' && file_exists(PATH_PLUGINS . $xmlform)) {
|
||||
require_once ( PATH_PLUGINS . $xmlform );
|
||||
die;
|
||||
}
|
||||
//the setup page is a xmlform and using the default showform and saveform function to serialize data
|
||||
if (!file_exists(PATH_PLUGINS.$xmlform.'.xml')) {
|
||||
throw ( new Exception ('setup .xml file is not defined for this plugin') );
|
||||
}
|
||||
|
||||
$Fields = $oPluginRegistry->getFieldsForPageSetup( $details->getNamespace() );
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '',$Fields ,'pluginsSetupSave?id='.$pluginFile );
|
||||
} catch (Exception $e) {
|
||||
$aMessage['MESSAGE'] = $e->getMessage();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
|
||||
}
|
||||
G::RenderPage('publishBlank', 'blank');
|
||||
|
||||
@@ -1,380 +0,0 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Exception\RBACException;
|
||||
|
||||
// Include global object RBAC
|
||||
global $RBAC;
|
||||
|
||||
// Check if the current user have the correct permissions to access to this resource, if not throws a RBAC Exception with code 403
|
||||
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') !== 1) {
|
||||
throw new RBACException('ID_ACCESS_DENIED', 403);
|
||||
}
|
||||
|
||||
ini_set("max_execution_time", 0);
|
||||
|
||||
if (!defined("PM_VERSION")) {
|
||||
if (file_exists(PATH_METHODS . "login/version-pmos.php")) {
|
||||
include(PATH_METHODS . "login/version-pmos.php");
|
||||
} else {
|
||||
define("PM_VERSION", "2.0.0");
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined("BUFSIZE")) {
|
||||
define("BUFSIZE", 16384);
|
||||
}
|
||||
|
||||
|
||||
function install($file)
|
||||
{
|
||||
$result = array();
|
||||
$status = 1;
|
||||
|
||||
try {
|
||||
//Extract
|
||||
$tar = new Archive_Tar($file);
|
||||
|
||||
$swTar = $tar->extract(PATH_OUTTRUNK); //true on success, false on error. //directory for extract
|
||||
//$swTar = $tar->extract(PATH_PLUGINS);
|
||||
|
||||
if (!$swTar) {
|
||||
throw (new Exception("Could not extract file."));
|
||||
}
|
||||
|
||||
//Upgrade
|
||||
$option = array(
|
||||
"http" => array(
|
||||
"method" => "POST"
|
||||
)
|
||||
);
|
||||
|
||||
// Proxy settings
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if (isset($sysConf['proxy_host'])) {
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
if (!is_array($option['http'])) {
|
||||
$option['http'] = array();
|
||||
}
|
||||
$option['http']['request_fulluri'] = true;
|
||||
$option['http']['proxy'] = 'tcp://' . $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '');
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
if (!isset($option['http']['header'])) {
|
||||
$option['http']['header'] = '';
|
||||
}
|
||||
$option['http']['header'] .= 'Proxy-Authorization: Basic ' . base64_encode($sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$context = stream_context_create($option);
|
||||
|
||||
///////
|
||||
$fileData = @fopen(EnterpriseUtils::getUrlServerName() . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/enterprise/services/processMakerUpgrade", "rb", false, $context);
|
||||
|
||||
if ($fileData === false) {
|
||||
throw (new Exception("Could not open services url."));
|
||||
}
|
||||
|
||||
$resultAux = G::json_decode(stream_get_contents($fileData));
|
||||
|
||||
if ($resultAux->status == "OK") {
|
||||
$result["status"] = $resultAux->status; //OK
|
||||
$result["message"] = $resultAux->message;
|
||||
} else {
|
||||
throw (new Exception($resultAux->message));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$result["message"] = $e->getMessage();
|
||||
$status = 0;
|
||||
}
|
||||
|
||||
if ($status == 0) {
|
||||
$result["status"] = "ERROR";
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$option = (isset($_POST["option"]))? $_POST["option"] : null;
|
||||
|
||||
switch ($option) {
|
||||
case "install":
|
||||
$uid = $_POST["uid"];
|
||||
$version = $_POST["version"];
|
||||
$versionName = $_POST["versionName"];
|
||||
$processMakerVersion = $_POST["processMakerVersion"];
|
||||
|
||||
$response = array();
|
||||
$status = 1;
|
||||
|
||||
try {
|
||||
if (EnterpriseUtils::getInternetConnection() == 0) {
|
||||
throw (new Exception("Enterprise Plugins Manager no connected to internet."));
|
||||
}
|
||||
|
||||
///////
|
||||
$versionName = EnterpriseUtils::pmVersion($versionName);
|
||||
$processMakerVersion = EnterpriseUtils::pmVersion($processMakerVersion);
|
||||
|
||||
if (!version_compare($processMakerVersion . "", $versionName . "", "<")) {
|
||||
throw (new Exception("The system can't be upgraded to a previous version."));
|
||||
}
|
||||
|
||||
///////
|
||||
$licenseManager = PmLicenseManager::getSingleton();
|
||||
$server = isset($licenseManager->server) ? $licenseManager->server : '';
|
||||
$workspace = (isset($licenseManager->workspace)) ? $licenseManager->workspace : 'pmLicenseSrv';
|
||||
|
||||
$url = "http://$server/sys".$workspace."/en/green/services/rest";
|
||||
|
||||
if (EnterpriseUtils::checkConnectivity($url) == false) {
|
||||
throw (new Exception("Server '$server' not available."));
|
||||
}
|
||||
|
||||
///////
|
||||
$boundary = "---------------------" . substr(G::encryptOld(rand(0, 32000)), 0, 10);
|
||||
$data = null;
|
||||
|
||||
$data = $data . "--$boundary\n";
|
||||
$data = $data . "Content-Disposition: form-data; name=\"action\"\n\n" . "getPM" . "\n";
|
||||
$data = $data . "--$boundary\n";
|
||||
$data = $data . "Content-Disposition: form-data; name=\"OBJ_UID\"\n\n" . $uid . "\n";
|
||||
$data = $data . "--$boundary\n";
|
||||
$data = $data . "Content-Disposition: form-data; name=\"OBJ_VERSION\"\n\n" . $version . "\n";
|
||||
$data = $data . "--$boundary\n";
|
||||
|
||||
$option = array(
|
||||
"http" => array(
|
||||
"method" => "POST",
|
||||
"header" => "Content-Type: multipart/form-data; boundary=" . $boundary,
|
||||
"content" => $data
|
||||
)
|
||||
);
|
||||
|
||||
// Proxy settings
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if (isset($sysConf['proxy_host'])) {
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
if (!is_array($option['http'])) {
|
||||
$option['http'] = array();
|
||||
}
|
||||
$option['http']['request_fulluri'] = true;
|
||||
$option['http']['proxy'] = 'tcp://' . $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '');
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
if (!isset($option['http']['header'])) {
|
||||
$option['http']['header'] = '';
|
||||
}
|
||||
$option['http']['header'] .= 'Proxy-Authorization: Basic ' . base64_encode($sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$context = stream_context_create($option);
|
||||
|
||||
///////
|
||||
$fileData = @fopen($url, "rb", false, $context);
|
||||
|
||||
if ($fileData === false) {
|
||||
throw (new Exception("Could not open download url."));
|
||||
}
|
||||
|
||||
//Try to get the download size and filename (ok if it fails)
|
||||
$meta = stream_get_meta_data($fileData);
|
||||
|
||||
$fileName = null;
|
||||
$fileContentType = null;
|
||||
$fileLength = 0;
|
||||
|
||||
if ($meta["wrapper_type"] == "http") {
|
||||
foreach ($meta["wrapper_data"] as $info) {
|
||||
$info = explode(":", $info);
|
||||
$infoVariable = (isset($info[0]))? trim($info[0]) : null;
|
||||
$infoValue = (isset($info[1]))? trim($info[1]) : null;
|
||||
|
||||
if (preg_match("/^.*Content-Type.*$/", $infoVariable)) {
|
||||
$fileContentType = $infoValue;
|
||||
}
|
||||
|
||||
if (strcasecmp($infoVariable, "Content-Length") == 0) {
|
||||
$fileLength = intval($infoValue);
|
||||
}
|
||||
|
||||
if (strcasecmp($infoVariable, "Content-Disposition") == 0) {
|
||||
foreach (explode(";", $infoValue) as $params) {
|
||||
$params = explode("=", $params);
|
||||
|
||||
if (count($params) <= 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(trim($params[0]), "filename") == 0) {
|
||||
$fileName = trim($params[1], "\" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match("/^.*json.*$/i", $fileContentType)) {
|
||||
$r = G::json_decode(stream_get_contents($fileData));
|
||||
|
||||
if ($r->status == "ERROR") {
|
||||
throw (new Exception($r->message));
|
||||
}
|
||||
}
|
||||
|
||||
///////
|
||||
$dir = PATH_DATA . "upgrade" . PATH_SEP . "processmaker";
|
||||
|
||||
G::rm_dir($dir);
|
||||
G::mk_dir($dir);
|
||||
|
||||
if (!file_exists($dir)) {
|
||||
throw (new Exception("Could not create destination directory."));
|
||||
}
|
||||
|
||||
///////
|
||||
$fileName = $dir . PATH_SEP . $fileName;
|
||||
|
||||
$file = @fopen($fileName, "wb");
|
||||
|
||||
if ($file === false) {
|
||||
throw (new Exception("Could not open destination file."));
|
||||
}
|
||||
|
||||
while (!feof($fileData)) {
|
||||
$data = fread($fileData, BUFSIZE);
|
||||
|
||||
//Just to be safe, check all error conditions
|
||||
if ($data === "" || $data === false) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (fwrite($file, $data) === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose($file);
|
||||
fclose($fileData);
|
||||
|
||||
///////
|
||||
$path = PATH_TRUNK;
|
||||
//$path = PATH_OUTTRUNK;
|
||||
|
||||
if (EnterpriseUtils::checkFolderPermissions($path, true) == false) {
|
||||
$str = $path . " " . "directory, its sub-directories or file is not writable. Read the wiki for <a href=\"http://wiki.processmaker.com/index.php/Upgrading_ProcessMaker\" onclick=\"window.open(this.href, \'_blank\'); return (false);\">Upgrading ProcessMaker</a>.<br /> The file is downloaded in " . $fileName . "<br />";
|
||||
throw (new Exception($str));
|
||||
}
|
||||
|
||||
///////
|
||||
$result = install($fileName);
|
||||
|
||||
if ($result["status"] == "OK") {
|
||||
$response["status"] = $result["status"]; //OK
|
||||
$response["message"] = $result["message"];
|
||||
G::auditLog("InstallPlugin", "Plugin Name: ".$file);
|
||||
} else {
|
||||
throw (new Exception($result["message"]));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$response["message"] = $e->getMessage();
|
||||
$status = 0;
|
||||
}
|
||||
|
||||
if ($status == 0) {
|
||||
$response["status"] = "ERROR";
|
||||
}
|
||||
echo G::json_encode($response);
|
||||
break;
|
||||
case "list":
|
||||
$status = 1;
|
||||
$response = new stdclass();
|
||||
$response->status = 'OK';
|
||||
try {
|
||||
if (EnterpriseUtils::getInternetConnection() == 0) {
|
||||
throw (new Exception("Enterprise Plugins Manager no connected to internet."));
|
||||
}
|
||||
|
||||
///////
|
||||
$licenseManager = PmLicenseManager::getSingleton();
|
||||
$server = (isset($licenseManager->server)) ? $licenseManager->server : '';
|
||||
$workspace = (isset($licenseManager->workspace)) ? $licenseManager->workspace : 'pmLicenseSrv';
|
||||
|
||||
$url = "http://$server/sys".$workspace."/en/green/services/rest";
|
||||
|
||||
if (EnterpriseUtils::checkConnectivity($url) == false) {
|
||||
throw (new Exception("Server '$server' not available."));
|
||||
}
|
||||
|
||||
///////
|
||||
$option = array(
|
||||
"http" => array(
|
||||
"method" => "POST",
|
||||
"header" => "Content-type: application/x-www-form-urlencoded\r\n",
|
||||
"content" => http_build_query(
|
||||
array(
|
||||
"action" => "getPMList"
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Proxy settings
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if (isset($sysConf['proxy_host'])) {
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
if (!is_array($option['http'])) {
|
||||
$option['http'] = array();
|
||||
}
|
||||
$option['http']['request_fulluri'] = true;
|
||||
$option['http']['proxy'] = 'tcp://' . $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '');
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
if (!isset($option['http']['header'])) {
|
||||
$option['http']['header'] = '';
|
||||
}
|
||||
$option['http']['header'] .= 'Proxy-Authorization: Basic ' . base64_encode($sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$context = stream_context_create($option);
|
||||
|
||||
$results = file_get_contents($url, false, $context);
|
||||
$results = G::json_decode($results);
|
||||
$results = isset($results[0]) ? $results[0] :array();
|
||||
|
||||
$pmVersion = EnterpriseUtils::pmVersion(PM_VERSION);
|
||||
$versions = array();
|
||||
|
||||
foreach ($results as $key => $result) {
|
||||
$version = EnterpriseUtils::pmVersion($result->OBJ_VERSION_NAME);
|
||||
|
||||
if (version_compare($pmVersion . "", $version . "", "<")) {
|
||||
$versions[] = $result;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($results[0])) {
|
||||
$results[0]->OBJ_VERSION_NAME .= " (Stable)";
|
||||
}
|
||||
|
||||
$response->status = "OK";
|
||||
$response->results = $versions;
|
||||
} catch (Exception $e) {
|
||||
$response->message = $e->getMessage();
|
||||
$status = 0;
|
||||
}
|
||||
|
||||
if ($status == 0) {
|
||||
$response->status = "ERROR";
|
||||
}
|
||||
|
||||
echo G::json_encode($response);
|
||||
break;
|
||||
}
|
||||
@@ -45,14 +45,6 @@ try {
|
||||
$pwd = rtrim($frm['USR_PASSWORD']);
|
||||
}
|
||||
|
||||
require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php';
|
||||
|
||||
if (!file_exists(PATH_DATA_SITE . "plugin.singleton")) {
|
||||
$enterprise = new enterprisePlugin('enterprise');
|
||||
$enterprise->enable();
|
||||
$enterprise->setup();
|
||||
}
|
||||
|
||||
Cache::put('ldapMessageError', '', 120); //laravel 8.x the time parameter is in seconds.
|
||||
$uid = $RBAC->VerifyLogin($usr, $pwd);
|
||||
$ldapMessageError = Cache::pull('ldapMessageError');
|
||||
@@ -182,7 +174,6 @@ try {
|
||||
if ($oPluginRegistry->existsTrigger ( PM_LOGIN )) {
|
||||
$oPluginRegistry->executeTriggers ( PM_LOGIN , $loginInfo );
|
||||
}
|
||||
EnterpriseClass::enterpriseSystemUpdate($loginInfo);
|
||||
initUserSession($uid, $usr);
|
||||
} else {
|
||||
setcookie('singleSignOn', '1', $cookieOptions);
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
$aInfoLoadFile = array();
|
||||
$aInfoLoadFile['name'] = $_FILES['form']['name']['licenseFile'];
|
||||
$aInfoLoadFile['tmp_name'] = $_FILES['form']['tmp_name']['licenseFile'];
|
||||
$aux = pathinfo($aInfoLoadFile['name']);
|
||||
|
||||
//validating the extention before to upload it
|
||||
if ($aux['extension'] != 'dat') {
|
||||
G::SendTemporalMessage('ID_WARNING_ENTERPRISE_LICENSE_MSG_DAT', 'warning');
|
||||
} else {
|
||||
$dir = PATH_DATA_SITE;
|
||||
G::uploadFile($aInfoLoadFile["tmp_name"], $dir, $aInfoLoadFile["name"]);
|
||||
//reading the file that was uploaded
|
||||
|
||||
$licenseManager = PmLicenseManager::getSingleton();
|
||||
$response = $licenseManager->installLicense($dir . $aInfoLoadFile["name"], false, false);
|
||||
|
||||
if ($response) {
|
||||
$licenseManager = new PmLicenseManager();
|
||||
preg_match("/^license_(.*).dat$/", $licenseManager->file, $matches);
|
||||
$realId = urlencode($matches[1]);
|
||||
$workspace = (isset($licenseManager->workspace)) ? $licenseManager->workspace : 'pmLicenseSrv';
|
||||
|
||||
$addonLocation = "http://{$licenseManager->server}/sys".$workspace."/en/green/services/addonsStore?action=getInfo&licId=$realId";
|
||||
|
||||
///////
|
||||
$cnn = Propel::getConnection("workflow");
|
||||
|
||||
$oCriteriaSelect = new Criteria("workflow");
|
||||
$oCriteriaSelect->add(AddonsStorePeer::STORE_ID, $licenseManager->id);
|
||||
|
||||
$oCriteriaUpdate = new Criteria("workflow");
|
||||
$oCriteriaUpdate->add(AddonsStorePeer::STORE_ID, $licenseManager->id);
|
||||
$oCriteriaUpdate->add(AddonsStorePeer::STORE_LOCATION, $addonLocation);
|
||||
|
||||
BasePeer::doUpdate($oCriteriaSelect, $oCriteriaUpdate, $cnn);
|
||||
|
||||
//are all the plugins that are enabled in the workspace
|
||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||
/** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $plugin */
|
||||
foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) {
|
||||
if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) {
|
||||
$pluginRegistry->disablePlugin($plugin->getNamespace());
|
||||
// In order to keep the custom plugins state, it is required to set the attribute before saving the info
|
||||
$plugin->setEnabled(true);
|
||||
$pluginRegistry->savePlugin($plugin->getNamespace());
|
||||
}
|
||||
}
|
||||
|
||||
G::SendTemporalMessage('ID_NLIC', 'info');
|
||||
} else {
|
||||
G::SendTemporalMessage('ID_WARNING_ENTERPRISE_LICENSE_MSG', 'warning');
|
||||
}
|
||||
}
|
||||
|
||||
G::header('Location: ../login/login');
|
||||
die();
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Update the selected timezone for the user
|
||||
if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
|
||||
// Update User Time Zone
|
||||
if (isset($_POST['form']['BROWSER_TIME_ZONE'])) {
|
||||
$user = new Users();
|
||||
@@ -12,4 +11,3 @@ if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qen
|
||||
|
||||
// Redirect to origin page
|
||||
G::header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
use ProcessMaker\ChangeLog\ChangeLog;
|
||||
|
||||
if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
|
||||
if (PMLicensedFeatures::getSingleton()->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
||||
// since all the request parameters using this script are encrypted
|
||||
// using the URL_KEY the probability of injecting any kind of code using
|
||||
// this entry point are only possible knowing the aforementioned key.
|
||||
@@ -139,7 +138,6 @@ if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
|
||||
G::RenderPage('publish', 'blank');
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<html>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
|
||||
if (PMLicensedFeatures::getSingleton()->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
||||
global $G_PUBLISH;
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
@@ -101,7 +100,6 @@ if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
|
||||
}
|
||||
|
||||
G::RenderPage('publish', 'blank');
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<html>
|
||||
|
||||
@@ -9,10 +9,6 @@ use ProcessMaker\BusinessModel\Cases as BmCases;
|
||||
use ProcessMaker\Core\JobsManager;
|
||||
use ProcessMaker\Validation\ValidationUploadedFiles;
|
||||
|
||||
$featureEnable = PMLicensedFeatures::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=');
|
||||
if ($featureEnable) {
|
||||
|
||||
/**
|
||||
* To do: The following evaluation must be moved after saving the data (so as not to lose the data entered in the form).
|
||||
* It only remains because it is an old behavior, which must be defined by "Product Owner".
|
||||
@@ -87,5 +83,4 @@ if ($featureEnable) {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', ['MESSAGE' => $error->getMessage() . ' Please contact to your system administrator.']);
|
||||
}
|
||||
$_SESSION = unserialize($backupSession);
|
||||
G::RenderPage('publish', 'blank');
|
||||
}
|
||||
G::RenderPage('publish', 'blank');
|
||||
@@ -51,13 +51,6 @@ switch ($request) {
|
||||
if ($_GET["menu"] == "plugins") {
|
||||
$i = 0;
|
||||
|
||||
foreach ($items as $index => $value) {
|
||||
if ($items[$index]["id"] == "PMENTERPRISE") {
|
||||
$i = $index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$itemAux = $items[$i];
|
||||
|
||||
array_splice( $items, $i, 1 );
|
||||
|
||||
@@ -34,28 +34,6 @@ if ($handle = opendir(PATH_PLUGINS)) {
|
||||
$pluginName = str_replace(".php", "", $pluginFile);
|
||||
|
||||
if (is_file(PATH_PLUGINS . $pluginName . ".php") && is_dir(PATH_PLUGINS . $pluginName)) {
|
||||
|
||||
if (!$oPluginRegistry->isEnterprisePlugin($pluginName)) {
|
||||
//Check disabled code
|
||||
$arrayFoundDisabledCode = [];
|
||||
$cs = new CodeScanner(config("system.workspace"));
|
||||
if (in_array('enable_plugin', $cs->getScope())) {
|
||||
$arrayFoundDisabledCode = array_merge(
|
||||
$cs->checkDisabledCode("FILE", PATH_PLUGINS . $pluginName . ".php"),
|
||||
$cs->checkDisabledCode("PATH", PATH_PLUGINS . $pluginName)
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($arrayFoundDisabledCode)) {
|
||||
$response = array();
|
||||
$response["status"] = "DISABLED-CODE";
|
||||
$response["message"] = G::LoadTranslation("ID_DISABLED_CODE_PLUGIN");
|
||||
|
||||
echo G::json_encode($response);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
// change to ENABLED
|
||||
require_once($path);
|
||||
$details = $oPluginRegistry->getPluginDetails($pluginFile);
|
||||
|
||||
@@ -33,148 +33,6 @@ try {
|
||||
G::uploadFile($tempName, $path, $filename);
|
||||
}
|
||||
|
||||
//save the files Enterprise
|
||||
if ($_FILES['form']['error']['PLUGIN_FILENAME'] == 0) {
|
||||
$filename = $_FILES['form']['name']['PLUGIN_FILENAME'];
|
||||
$path = PATH_DOCUMENT . 'input' . PATH_SEP;
|
||||
if (strpos($filename, 'enterprise') !== false) {
|
||||
$tar = new Archive_Tar($path . $filename);
|
||||
$sFileName = substr($filename, 0, strrpos($filename, '.'));
|
||||
$sClassName = substr($filename, 0, strpos($filename, '-'));
|
||||
$sClassName = !empty($sClassName) ? $sClassName : $sFileName;
|
||||
|
||||
$files = $tar->listContent();
|
||||
$licenseName = '';
|
||||
$listFiles = array();
|
||||
foreach ($files as $key => $val) {
|
||||
if (strpos(trim($val['filename']), 'enterprise/data/') !== false) {
|
||||
$listFiles[] = trim($val['filename']);
|
||||
}
|
||||
if (strpos(trim($val['filename']), 'license_') !== false) {
|
||||
$licenseName = trim($val['filename']);
|
||||
}
|
||||
}
|
||||
$tar->extractList($listFiles, PATH_PLUGINS . 'data');
|
||||
$tar->extractList($licenseName, PATH_PLUGINS);
|
||||
|
||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||
$autoPlugins = glob(PATH_PLUGINS . "data/enterprise/data/*.tar");
|
||||
$autoPluginsA = array();
|
||||
|
||||
foreach ($autoPlugins as $filePath) {
|
||||
$plName = basename($filePath);
|
||||
//if (!(in_array($plName, $def))) {
|
||||
if (strpos($plName, 'enterprise') === false) {
|
||||
$autoPluginsA[]["sFilename"] = $plName;
|
||||
}
|
||||
}
|
||||
|
||||
$aPlugins = $autoPluginsA;
|
||||
foreach ($aPlugins as $key => $aPlugin) {
|
||||
$sClassName = substr($aPlugin["sFilename"], 0, strpos($aPlugin["sFilename"], "-"));
|
||||
|
||||
$oTar = new Archive_Tar(PATH_PLUGINS . "data/enterprise/data/" . $aPlugin["sFilename"]);
|
||||
$oTar->extract(PATH_PLUGINS);
|
||||
|
||||
if (!(class_exists($sClassName))) {
|
||||
require_once(PATH_PLUGINS . $sClassName . ".php");
|
||||
}
|
||||
|
||||
$pluginDetail = $pluginRegistry->getPluginDetails($sClassName . ".php");
|
||||
$pluginRegistry->installPlugin($pluginDetail->getNamespace()); //error
|
||||
$pluginRegistry->savePlugin($pluginDetail->getNamespace());
|
||||
}
|
||||
$licfile = glob(PATH_PLUGINS . "*.dat");
|
||||
|
||||
if ((isset($licfile[0])) && (is_file($licfile[0]))) {
|
||||
$licfilename = basename($licfile[0]);
|
||||
@copy($licfile[0], PATH_DATA_SITE . $licfilename);
|
||||
@unlink($licfile[0]);
|
||||
}
|
||||
|
||||
require_once('classes/model/AddonsStore.php');
|
||||
AddonsStore::checkLicenseStore();
|
||||
$licenseManager = PmLicenseManager::getSingleton();
|
||||
AddonsStore::updateAll(false);
|
||||
|
||||
$message = G::loadTranslation('ID_ENTERPRISE_INSTALLED') . ' ' . G::loadTranslation('ID_LOG_AGAIN');
|
||||
G::SendMessageText($message, "INFO");
|
||||
$licenseManager = PmLicenseManager::getSingleton();
|
||||
die('<script type="text/javascript">parent.parent.location = "../login/login";</script>');
|
||||
}
|
||||
}
|
||||
|
||||
//save the packages plugins
|
||||
if ($_FILES['form']['error']['PLUGIN_FILENAME'] == 0) {
|
||||
$filename = $_FILES['form']['name']['PLUGIN_FILENAME'];
|
||||
$path = PATH_DOCUMENT . 'input' . PATH_SEP;
|
||||
if (strpos($filename, 'plugins-') !== false) {
|
||||
$tar = new Archive_Tar($path . $filename);
|
||||
$sFileName = substr($filename, 0, strrpos($filename, '.'));
|
||||
$sClassName = substr($filename, 0, strpos($filename, '-'));
|
||||
$sClassName = !empty($sClassName) ? $sClassName : $sFileName;
|
||||
|
||||
$files = $tar->listContent();
|
||||
$licenseName = '';
|
||||
$listFiles = array();
|
||||
foreach ($files as $key => $val) {
|
||||
if (strpos(trim($val['filename']), 'plugins/') !== false) {
|
||||
$listFiles[] = trim($val['filename']);
|
||||
}
|
||||
if (strpos(trim($val['filename']), 'license_') !== false) {
|
||||
$licenseName = trim($val['filename']);
|
||||
}
|
||||
}
|
||||
$tar->extractList($listFiles, PATH_PLUGINS . 'data');
|
||||
$tar->extractList($licenseName, PATH_PLUGINS);
|
||||
|
||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||
$autoPlugins = glob(PATH_PLUGINS . "data/plugins/*.tar");
|
||||
$autoPluginsA = array();
|
||||
|
||||
foreach ($autoPlugins as $filePath) {
|
||||
$plName = basename($filePath);
|
||||
if (strpos($plName, 'enterprise') === false) {
|
||||
$autoPluginsA[]["sFilename"] = $plName;
|
||||
}
|
||||
}
|
||||
|
||||
$aPlugins = $autoPluginsA;
|
||||
foreach ($aPlugins as $key => $aPlugin) {
|
||||
$sClassName = substr($aPlugin["sFilename"], 0, strpos($aPlugin["sFilename"], "-"));
|
||||
|
||||
$oTar = new Archive_Tar(PATH_PLUGINS . "data/plugins/" . $aPlugin["sFilename"]);
|
||||
$oTar->extract(PATH_PLUGINS);
|
||||
|
||||
if (!(class_exists($sClassName))) {
|
||||
require_once(PATH_PLUGINS . $sClassName . ".php");
|
||||
}
|
||||
|
||||
$pluginDetail = $pluginRegistry->getPluginDetails($sClassName . ".php");
|
||||
$pluginRegistry->installPlugin($pluginDetail->getNamespace()); //error
|
||||
$pluginRegistry->savePlugin($pluginDetail->getNamespace());
|
||||
}
|
||||
|
||||
$licfile = glob(PATH_PLUGINS . "*.dat");
|
||||
|
||||
if ((isset($licfile[0])) && (is_file($licfile[0]))) {
|
||||
$licfilename = basename($licfile[0]);
|
||||
@copy($licfile[0], PATH_DATA_SITE . $licfilename);
|
||||
@unlink($licfile[0]);
|
||||
}
|
||||
|
||||
require_once('classes/model/AddonsStore.php');
|
||||
AddonsStore::checkLicenseStore();
|
||||
$licenseManager = PmLicenseManager::getSingleton();
|
||||
AddonsStore::updateAll(false);
|
||||
|
||||
$message = G::loadTranslation('ID_ENTERPRISE_INSTALLED') . ' ' . G::loadTranslation('ID_LOG_AGAIN');
|
||||
G::SendMessageText($message, "INFO");
|
||||
$licenseManager = PmLicenseManager::getSingleton();
|
||||
die('<script type="text/javascript">parent.parent.location = "../login/login";</script>');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$_FILES['form']['type']['PLUGIN_FILENAME'] == 'application/octet-stream') {
|
||||
$pluginFilename = $_FILES['form']['type']['PLUGIN_FILENAME'];
|
||||
throw new Exception(G::loadTranslation('ID_FILES_INVALID_PLUGIN_FILENAME', SYS_LANG, array("pluginFilename" => $pluginFilename
|
||||
@@ -203,12 +61,6 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
$partnerFlag = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : false;
|
||||
if (($sClassName == 'enterprise') && ($partnerFlag)) {
|
||||
$pathFileFlag = PATH_DATA . 'flagNewLicence';
|
||||
file_put_contents($pathFileFlag, 'New Enterprise');
|
||||
}
|
||||
|
||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||
$pluginFile = $sClassName . '.php';
|
||||
|
||||
@@ -228,11 +80,6 @@ try {
|
||||
}
|
||||
$res = $tar->extract($path);
|
||||
|
||||
//Check if is enterprise plugin
|
||||
if ($oPluginRegistry->isEnterprisePlugin($sClassName, $path)) {
|
||||
throw new Exception(G::LoadTranslation('ID_PMPLUGIN_IMPORT_PLUGIN_IS_ENTERPRISE', [$filename]));
|
||||
}
|
||||
|
||||
//Check disabled code
|
||||
$arrayFoundDisabledCode = [];
|
||||
$cs = new CodeScanner(config("system.workspace"));
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
<?php
|
||||
$RBAC->requirePermissions('PM_DASHBOARD');
|
||||
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
||||
|
||||
if (!$licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=')) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_ID_MENU_SELECTED = 'DASHBOARD+';
|
||||
|
||||
Reference in New Issue
Block a user