public function system() { require_once PATH_CONTROLLERS . 'main.php'; G::loadClass('system'); $skinsList = System::getSkingList(); foreach ($skinsList['skins'] as $key => $value) { if ($value['SKIN_WORKSPACE'] != 'Global') { unset($skinsList['skins'][$key]); } } $skins = array(); $timeZonesList = System::getAllTimeZones(); $timeZonesList = array_keys($timeZonesList); $mainController = new Main(); $languagesList = $mainController->getLanguagesList(); $sysConf = System::getSystemConfiguration(PATH_CONFIG . 'env.ini'); foreach ($skinsList['skins'] as $skin) { $skins[] = array($skin['SKIN_FOLDER_ID'], $skin['SKIN_NAME']); } foreach ($timeZonesList as $tz) { $timeZones[] = array($tz, $tz); } $this->includeExtJS('admin/system'); //G::LoadClass('configuration'); // $c = new Configurations(); // $configPage = $c->getConfiguration('usersList', 'pageSize','',$_SESSION['USER_LOGGED']); // $Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20; $this->setJSVar('skinsList', $skins); $this->setJSVar('languagesList', $languagesList); $this->setJSVar('timeZonesList', $timeZones); $this->setJSVar('sysConf', $sysConf); G::RenderPage('publish', 'extJs'); }
public function configure() { parent::configure(); $this->pmConfig = System::getSystemConfiguration(); $e_all = defined('E_DEPRECATED') ? E_ALL & ~E_DEPRECATED : E_ALL; $e_all = defined('E_STRICT') ? $e_all & ~E_STRICT : $e_all; $e_all = $this->pmConfig['debug'] ? $e_all : $e_all & ~E_NOTICE; // Do not change any of these settings directly, use env.ini instead ini_set('display_errors', $this->pmConfig['debug']); ini_set('error_reporting', $e_all); ini_set('short_open_tag', 'On'); ini_set('default_charset', "UTF-8"); ini_set('memory_limit', $this->pmConfig['memory_limit']); ini_set('soap.wsdl_cache_enabled', $this->pmConfig['wsdl_cache']); ini_set('date.timezone', $this->pmConfig['time_zone']); define ('DEBUG_SQL_LOG', $this->pmConfig['debug_sql']); define ('DEBUG_TIME_LOG', $this->pmConfig['debug_time']); define ('DEBUG_CALENDAR_LOG', $this->pmConfig['debug_calendar']); define ('MEMCACHED_ENABLED', $this->pmConfig['memcached']); define ('MEMCACHED_SERVER', $this->pmConfig['memcached_server']); define ('TIME_ZONE', $this->pmConfig['time_zone']); // enable ERROR_SHOW_SOURCE_CODE to display the source code for any WARNING OR NOTICE define ('ERROR_SHOW_SOURCE_CODE', true); }
public function saveSystemConf($httpData) { G::loadClass('system'); $envFile = PATH_CONFIG . 'env.ini'; $updateRedirector = false; $restart = false; if (!file_exists($envFile)) { // if ini file doesn't exists if (!is_writable(PATH_CONFIG)) { throw new Exception('The enviroment config directory is not writable. <br/>Please give write permission to directory: /workflow/engine/config'); } $content = ";\r\n"; $content .= "; ProcessMaker System Bootstrap Configuration\r\n"; $content .= ";\r\n"; file_put_contents($envFile, $content); //@chmod($envFile, 0777); } else { if (!is_writable($envFile)) { throw new Exception('The enviroment ini file file is not writable. <br/>Please give write permission to file: /workflow/engine/config/env.ini'); } } $sysConf = System::getSystemConfiguration($envFile); $updatedConf = array(); if ($sysConf['default_lang'] != $httpData->default_lang) { $updatedConf['default_lang'] = $sysConf['default_lang'] = $httpData->default_lang; $updateRedirector = true; } if ($sysConf['default_skin'] != $httpData->default_skin) { $updatedConf['default_skin'] = $sysConf['default_skin'] = $httpData->default_skin; $updateRedirector = true; } if ($sysConf['time_zone'] != $httpData->time_zone) { $updatedConf['time_zone'] = $httpData->time_zone; } $httpData->memory_limit .= 'M'; if ($sysConf['memory_limit'] != $httpData->memory_limit) { $updatedConf['memory_limit'] = $httpData->memory_limit; } if ($updateRedirector) { if (!file_exists(PATH_HTML . 'index.html')) { throw new Exception('The index.html file is not writable on workflow/public_html directory.'); } else { if (!is_writable(PATH_HTML . 'index.html')) { throw new Exception(G::LoadTranslation('ID_INDEX_NOT_WRITEABLE') . ' /workflow/public_html/index.html'); } } System::updateIndexFile(array('lang' => $sysConf['default_lang'], 'skin' => $sysConf['default_skin'])); $restart = true; } G::update_php_ini($envFile, $updatedConf); if (substr($sysConf['default_skin'], 0, 2) == 'ux') { $urlPart = '/main/login'; } else { $urlPart = '/login/login'; } $this->success = true; $this->restart = $restart; $this->url = '/sys' . SYS_SYS . '/' . $sysConf['default_lang'] . '/' . $sysConf['default_skin'] . $urlPart; $this->message = 'Saved Successfully'; }
function install($file) { G::LoadThirdParty("pear/Archive", "Tar"); $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" . SYS_SYS . "/" . 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; }
/** * Get Time Zone * * @return string Return Time Zone */ public static function getTimeZone() { try { $arraySystemConfiguration = \System::getSystemConfiguration('', '', SYS_SYS); //Return return $arraySystemConfiguration['time_zone']; } catch (\Exception $e) { throw $e; } }
/** * getting default list * * @param string $httpData (opional) */ public function index($httpData) { if ($this->userUxType == 'SINGLE') { $this->indexSingle($httpData); return; } require_once 'classes/model/UsersProperties.php'; G::LoadClass('process'); G::LoadClass('case'); $userProperty = new UsersProperties(); $process = new Process(); $case = new Cases(); G::loadClass('system'); $sysConf = System::getSystemConfiguration(PATH_CONFIG . 'env.ini'); //Get ProcessStatistics Info $start = 0; $limit = ''; $proData = $process->getAllProcesses($start, $limit); $processList = $case->getStartCasesPerType($_SESSION['USER_LOGGED'], 'category'); $switchLink = $userProperty->getUserLocation($_SESSION['USER_LOGGED']); if (!isset($_COOKIE['workspaceSkin'])) { if (substr($sysConf['default_skin'], 0, 2) == 'ux') { $_SESSION['_defaultUserLocation'] = $switchLink; $switchLink = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . $sysConf['default_skin'] . '/main'; } } unset($processList[0]); //Get simplified options global $G_TMP_MENU; $mnu = new Menu(); $mnu->load('simplified'); $arrayMnuOption = array(); $mnuNewCase = array(); if (!empty($mnu->Options)) { foreach ($mnu->Options as $index => $value) { $option = array('id' => $mnu->Id[$index], 'url' => $mnu->Options[$index], 'label' => $mnu->Labels[$index], 'icon' => $mnu->Icons[$index], 'class' => $mnu->ElementClass[$index]); if ($mnu->Id[$index] != 'S_NEW_CASE') { $arrayMnuOption[] = $option; } else { $mnuNewCase = $option; } } } $this->setView($this->userUxBaseTemplate . PATH_SEP . 'index'); $this->setVar('usrUid', $this->userID); $this->setVar('userName', $this->userName); $this->setVar('processList', $processList); $this->setVar('canStartCase', $case->canStartCase($_SESSION['USER_LOGGED'])); $this->setVar('userUxType', $this->userUxType); $this->setVar('clientBrowser', $this->clientBrowser['name']); $this->setVar('switchLink', $switchLink); $this->setVar('arrayMnuOption', $arrayMnuOption); $this->setVar('mnuNewCase', $mnuNewCase); $this->render(); }
public function __construct($template, $skin, $content) { $this->template = $template; $this->skin = $skin; $this->content = $content; $this->skinVariants = array('blank', 'extjs', 'raw', 'tracker', 'submenu'); $this->skinsBasePath = G::ExpandPath("skinEngine"); $sysConf = System::getSystemConfiguration(PATH_CONFIG . 'env.ini'); $this->skinDefault = isset($sysConf['default_skin']) && $sysConf['default_skin'] != '' ? $sysConf['default_skin'] : 'classic'; $this->_init(); }
/** * Get User by usrGmail * * @param string $usr_gmail Unique id of User * * return uid * */ public function getUserByEmail($usr_gmail) { //getting the user data require_once PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Users.php"; $oUsers = new \Users(); $response['user'] = $oUsers->loadByUserEmailInArray($usr_gmail); //getting the skin require_once PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.system.php"; $sysConf = new \System(); $responseSysConfig = $sysConf->getSystemConfiguration(PATH_CONFIG . 'env.ini'); $response['enviroment'] = $responseSysConfig['default_skin']; return $response; }
public static function checkConnectivity($url) { try { if (extension_loaded('curl')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch, CURLOPT_VERBOSE, true); //Apply proxy settings $sysConf = System::getSystemConfiguration(); if (isset($sysConf['proxy_host'])) { if ($sysConf['proxy_host'] != '') { curl_setopt($ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); if ($sysConf['proxy_port'] != '') { curl_setopt($ch, CURLOPT_PROXYPORT, $sysConf['proxy_port']); } if ($sysConf['proxy_user'] != '') { curl_setopt($ch, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); } curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); } } $content = curl_exec($ch); $headers = curl_getinfo($ch); $content = substr($content, $headers['header_size']); if ($headers['http_code'] === 200) { return $content; } } else { throw new Exception('The "CURL" extension not loaded.'); } } catch (Exception $e) { //Log the error } return false; }
function getSoapClientOptions() { $options = array('trace' => 1); //Apply proxy settings $sysConf = System::getSystemConfiguration(); if ($sysConf['proxy_host'] != '') { $options['proxy_host'] = $sysConf['proxy_host']; if ($sysConf['proxy_port'] != '') { $options['proxy_port'] = $sysConf['proxy_port']; } if ($sysConf['proxy_user'] != '') { $options['proxy_login'] = $sysConf['proxy_user']; } if ($sysConf['proxy_pass'] != '') { $options['proxy_password'] = $sysConf['proxy_pass']; } } return $options; }
public function system() { global $RBAC; $RBAC->requirePermissions('PM_SETUP'); require_once PATH_CONTROLLERS . 'main.php'; G::loadClass('system'); $skinsList = System::getSkingList(); foreach ($skinsList['skins'] as $key => $value) { if ($value['SKIN_WORKSPACE'] != 'Global') { unset($skinsList['skins'][$key]); } } $skins = array(); $mainController = new Main(); $languagesList = $mainController->getLanguagesList(); $languagesList[] = array("", G::LoadTranslation("ID_USE_LANGUAGE_URL")); $sysConf = System::getSystemConfiguration(PATH_CONFIG . 'env.ini'); foreach ($skinsList['skins'] as $skin) { $skins[] = array($skin['SKIN_FOLDER_ID'], $skin['SKIN_NAME']); } $this->includeExtJS('admin/system'); //G::LoadClass('configuration'); // $c = new Configurations(); // $configPage = $c->getConfiguration('usersList', 'pageSize','',$_SESSION['USER_LOGGED']); // $Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20; if (isset($sysConf["session.gc_maxlifetime"])) { $sysConf["session_gc_maxlifetime"] = $sysConf["session.gc_maxlifetime"]; } else { $sysConf["session_gc_maxlifetime"] = ini_get('session.gc_maxlifetime'); } $this->setJSVar('skinsList', $skins); $this->setJSVar('languagesList', $languagesList); $this->setJSVar('timeZonesList', array_map(function ($value) { return [$value, $value]; }, DateTimeZone::listIdentifiers())); $this->setJSVar('sysConf', $sysConf); G::RenderPage('publish', 'extJs'); }
/** * * @method Executes a Talend Web Service.. * * @name executeTalendWebservice * @label Executes a Talend Web Service. * * @param string | $wsdl | Talend Web Service (including ?WSDL) * @param array(array(n1 v1) array(n2 v2) array(nN vN)) | $params | Array of params. Pairs of param Name Value * @param string | $message | Message to be displayed * @return array | $return | Talend Array * */ function executeTalendWebservice($wsdl, $message, $params = array()) { $client = new SoapClient($wsdl, array('trace' => 1)); //Apply proxy settings $sysConf = System::getSystemConfiguration(); if ($sysConf['proxy_host'] != '') { curl_setopt($client, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); if ($sysConf['proxy_port'] != '') { curl_setopt($client, CURLOPT_PROXYPORT, $sysConf['proxy_port']); } if ($sysConf['proxy_user'] != '') { curl_setopt($client, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); } curl_setopt($client, CURLOPT_HTTPHEADER, array('Expect:')); } $params[0] = ""; foreach ($params as $paramO) { $params[] = "--context_param" . $paramO[0] . "=" . $paramO[1]; } $result = $client->__SoapCall('runJob', array($params)); /* $params[1]="--context_param nb_line=".@=Quantity; $result = $client->__SoapCall('runJob', array($params)); foreach ($result->item as $keyItem => $item){ $gridRow=$keyItem+1; @=USERSINFO[$gridRow]['NAME']=$item->item[1]; @=USERSINFO[$gridRow]['LASTNAME']=$item->item[2]; @=USERSINFO[$gridRow]['DATE']=$item->item[0]; @=USERSINFO[$gridRow]['STREET']=$item->item[3]; @=USERSINFO[$gridRow]['CITY']=$item->item[4]; @=USERSINFO[$gridRow]['STATE']=$item->item[5]; @=USERSINFO[$gridRow]['STATEID']=$item->item[6]; } */ G::SendMessageText("<font color='blue'>Information from Talend ETL webservice</font><font color='darkgray'><br>" . $wsdl . "</font>", "INFO"); }
$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); ///////
$sObject = $workspaceName; $sNow = ''; // $argv[2]; $sFilter = ''; for ($i = 3; $i < count($argv); $i++) { $sFilter .= ' ' . $argv[$i]; } $oDirectory = dir(PATH_DB); if (is_dir(PATH_DB . $sObject)) { saveLog('main', 'action', "checking folder " . PATH_DB . $sObject); if (file_exists(PATH_DB . $sObject . PATH_SEP . 'db.php')) { define('SYS_SYS', $sObject); // **************************************** // read initialize file require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php'; $config = System::getSystemConfiguration('', '', SYS_SYS); define('MEMCACHED_ENABLED', $config['memcached']); define('MEMCACHED_SERVER', $config['memcached_server']); define('TIME_ZONE', $config['time_zone']); date_default_timezone_set(TIME_ZONE); print "TIME_ZONE: " . TIME_ZONE . "\n"; print "MEMCACHED_ENABLED: " . MEMCACHED_ENABLED . "\n"; print "MEMCACHED_SERVER: " . MEMCACHED_SERVER . "\n"; // **************************************** include_once PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php'; include_once PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'; // ***************** PM Paths DATA ************************** define('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/'); define('PATH_DOCUMENT', PATH_DATA_SITE . 'files/'); define('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/'); define('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/');
public function parseNormalUri($aRequestUri) { if (substr($aRequestUri[1], 0, 3) == 'sys') { define('SYS_TEMP', substr($aRequestUri[1], 3)); } else { define("ENABLE_ENCRYPT", 'yes'); define('SYS_TEMP', $aRequestUri[1]); $plain = '/sys' . SYS_TEMP; for ($i = 2; $i < count($aRequestUri); $i++) { $decoded = G::decrypt(urldecode($aRequestUri[$i]), URL_KEY); if ($decoded == 'sWì›') { $decoded = $VARS[$i]; //this is for the string "../" } $plain .= '/' . $decoded; } $_SERVER["REQUEST_URI"] = $plain; } $work = explode('?', $_SERVER["REQUEST_URI"]); if (count($work) > 1) { define('SYS_CURRENT_PARMS', $work[1]); } else { define('SYS_CURRENT_PARMS', ''); } define('SYS_CURRENT_URI', $work[0]); if (!defined('SYS_CURRENT_PARMS')) { define('SYS_CURRENT_PARMS', $work[1]); } $preArray = explode('&', SYS_CURRENT_PARMS); $buffer = explode('.', $work[0]); if (count($buffer) == 1) { $buffer[1] = ''; } //request type define('REQUEST_TYPE', $buffer[1] != "" ? $buffer[1] : 'html'); $toparse = substr($buffer[0], 1, strlen($buffer[0]) - 1); $uriVars = explode('/', $toparse); unset($work); unset($buffer); unset($toparse); array_shift($uriVars); $args = array(); $args['SYS_LANG'] = array_shift($uriVars); $args['SYS_SKIN'] = array_shift($uriVars); $args['SYS_COLLECTION'] = array_shift($uriVars); $args['SYS_TARGET'] = array_shift($uriVars); //to enable more than 2 directories...in the methods structure while (count($uriVars) > 0) { $args['SYS_TARGET'] .= '/' . array_shift($uriVars); } /* Fix to prevent use uxs skin outside siplified interface, because that skin is not compatible with others interfaces*/ if ($args['SYS_SKIN'] == 'uxs' && $args['SYS_COLLECTION'] != 'home' && $args['SYS_COLLECTION'] != 'cases') { $config = System::getSystemConfiguration(); $args['SYS_SKIN'] = $config['default_skin']; } return $args; }
/** * connect * * connect to the Zimbra SOAP service * * @since version 1.0 * @access public * @return array associative array of account information */ public function connect() { if ($this->_connected) { return $this->_account_info; } $completeurl = $this->_protocol . $this->_server . $this->_path; $this->_curl = curl_init(); curl_setopt($this->_curl, CURLOPT_URL, $this->_protocol . $this->_server . $this->_path); curl_setopt($this->_curl, CURLOPT_POST, true); curl_setopt($this->_curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($this->_curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($this->_curl, CURLOPT_SSL_VERIFYHOST, false); //Apply proxy settings $sysConf = System::getSystemConfiguration(); if ($sysConf['proxy_host'] != '') { curl_setopt($this->_curl, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); if ($sysConf['proxy_port'] != '') { curl_setopt($this->_curl, CURLOPT_PROXYPORT, $sysConf['proxy_port']); } if ($sysConf['proxy_user'] != '') { curl_setopt($this->_curl, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); } curl_setopt($this->_curl, CURLOPT_HTTPHEADER, array('Expect:')); } $preauth = $this->getPreAuth($this->_username); $header = '<context xmlns="urn:zimbraAccount' . ($this->_admin ? 'Admin' : '') . '"><session/></context>'; if ($this->_admin) { $body = '<AuthRequest xmlns="urn:zimbraAdmin"> <name>' . $this->_admin_username . '</name> <password>' . $this->_admin_password . '</password> </AuthRequest>'; } else { $body = '<AuthRequest xmlns="urn:zimbraAccount"> <account by="name">' . $this->_username . '@' . $this->_server1 . '</account> <preauth timestamp="' . $this->_timestamp . '" expires="' . $this->_preauth_expiration . '">' . $preauth . '</preauth> </AuthRequest>'; } $response = $this->soapRequest($body, $header, true); if ($response) { $tmp = $this->makeXMLTree($response); $this->_account_info = $tmp['soap:Envelope'][0]['soap:Header'][0]['context'][0]['refresh'][0]['folder'][0]; $this->session_id = $this->extractSessionID($response); $this->auth_token = $this->extractAuthToken($response); $this->_connected = true; //return $this->_account_info; return $this->_connected; } else { $this->_connected = false; return false; } }
/** * Update this store information from the store location. * * @return bool true if updated, false otherwise */ public function update($force = false, $type = 'plugin') { require_once PATH_CORE . 'classes' . PATH_SEP . 'class.pmLicenseManager.php'; if (!class_exists('AddonsManagerPeer')) { require_once 'classes/model/AddonsManager.php'; } //If we have any addon that is installing or updating, don't update store $criteria = new Criteria(AddonsManagerPeer::DATABASE_NAME); $criteria->add(AddonsManagerPeer::ADDON_STATE, '', Criteria::NOT_EQUAL); $criteria->add(AddonsManagerPeer::ADDON_TYPE, $type); if (AddonsManagerPeer::doCount($criteria) > 0) { return false; } $this->clear($type); //Fill with local information //List all plugins installed $oPluginRegistry =& PMPluginRegistry::getSingleton(); $aPluginsPP = array(); if (file_exists(PATH_DATA_SITE . 'ee')) { $aPluginsPP = unserialize(trim(file_get_contents(PATH_DATA_SITE . 'ee'))); } $pmLicenseManagerO =& pmLicenseManager::getSingleton(); $localPlugins = array(); if ($type == 'plugin') { foreach ($aPluginsPP as $aPlugin) { $sClassName = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-')); if (file_exists(PATH_PLUGINS . $sClassName . '.php')) { require_once PATH_PLUGINS . $sClassName . '.php'; $oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php'); if ($oDetails) { $sStatus = $oDetails->enabled ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED'); if (isset($oDetails->aWorkspaces)) { if (!in_array(SYS_SYS, $oDetails->aWorkspaces)) { continue; } } if ($sClassName == "pmLicenseManager" || $sClassName == "pmTrial") { continue; } $sEdit = $oDetails->sSetupPage != '' && $oDetails->enabled ? G::LoadTranslation('ID_SETUP') : ' '; $aPlugin = array(); $aPluginId = $sClassName; $aPluginTitle = $oDetails->sFriendlyName; $aPluginDescription = $oDetails->sDescription; $aPluginVersion = $oDetails->iVersion; if (@in_array($sClassName, $pmLicenseManagerO->features)) { $aPluginStatus = $sStatus; $aPluginLinkStatus = 'pluginsChange?id=' . $sClassName . '.php&status=' . $oDetails->enabled; $aPluginEdit = $sEdit; $aPluginLinkEdit = 'pluginsSetup?id=' . $sClassName . '.php'; $aPluginStatusA = $sStatus == "Enabled" ? "installed" : 'disabled'; $enabledStatus = true; } else { $aPluginStatus = ""; $aPluginLinkStatus = ''; $aPluginEdit = ''; $aPluginLinkEdit = ''; $aPluginStatusA = 'minus-circle'; $enabledStatus = false; } $addon = new AddonsManager(); //G::pr($addon); $addon->setAddonId($aPluginId); $addon->setStoreId($this->getStoreId()); //Don't trust external data $addon->setAddonName($aPluginId); $addon->setAddonDescription($aPluginDescription); $addon->setAddonNick($aPluginTitle); $addon->setAddonVersion(""); $addon->setAddonStatus($aPluginStatusA); $addon->setAddonType("plugin"); $addon->setAddonPublisher("Colosa"); $addon->setAddonDownloadUrl(""); $addon->setAddonDownloadMd5(""); $addon->setAddonReleaseDate(null); $addon->setAddonReleaseType('localRegistry'); $addon->setAddonReleaseNotes(""); $addon->setAddonState(""); $addon->save(); $localPlugins[$aPluginId] = $addon; } } } } else { $list = unserialize($pmLicenseManagerO->licensedfeaturesList); if (is_array($list)) { foreach ($list['addons'] as $key => $feature) { $addon = new AddonsManager(); $addon->setAddonId($feature['name']); $addon->setStoreId($feature['guid']); $addon->setAddonName($feature['name']); $addon->setAddonDescription($feature['description']); $addon->setAddonNick($feature['nick']); $addon->setAddonVersion(""); $addon->setAddonStatus($feature['status']); $addon->setAddonType("features"); $addon->setAddonPublisher("Colosa"); $addon->setAddonDownloadUrl(""); $addon->setAddonDownloadMd5(""); $addon->setAddonReleaseDate(null); $addon->setAddonReleaseType('localRegistry'); $addon->setAddonReleaseNotes(""); $addon->setAddonState(""); $addon->save(); } } } $this->setStoreLastUpdated(time()); $this->save(); $url = $this->getStoreLocation(); //Validate url $licenseInfo = $pmLicenseManagerO->getActiveLicense(); $licenseId = str_replace('.dat', '', str_replace('license_', '', basename($licenseInfo['LICENSE_PATH']))); $url = explode('&', $url); $url[count($url) - 1] = 'licId=' . urlencode($licenseId); $url = implode('&', $url); if (EnterpriseUtils::getInternetConnection() == 1 && EnterpriseUtils::checkConnectivity($url) == true) { $option = array("http" => array("method" => "POST", "header" => "Content-type: application/x-www-form-urlencoded\r\n", "content" => http_build_query(array("pmVersion" => System::getVersion(), "version" => STORE_VERSION)))); // 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); //This may block for a while, always use AJAX to call this method $url = $url . '&type=' . strtoupper($type); $data = file_get_contents($url, false, $context); if ($data === false) { throw new Exception("Could not contact store"); } $serverData = G::json_decode($data); //Don't trust external data if (empty($serverData)) { throw new Exception("Store data invalid ('{$data}')"); } if (isset($serverData->error)) { throw new Exception("Store sent us an error: {$serverData->error}"); } if (!isset($serverData->version)) { throw new Exception("Store version not found"); } if ($serverData->version != STORE_VERSION) { throw new Exception("Store version '{$serverData->version}' unsupported"); } if (!isset($serverData->addons)) { throw new Exception("Addons not found on store data"); } $this->clear($type); try { //Add each item to this stores addons $addons = @get_object_vars($serverData->addons); if (!empty($addons)) { foreach (get_object_vars($serverData->addons) as $addonId => $addonInfo) { $addon = new AddonsManager(); $addon->setAddonId($addonId); $addon->setStoreId($this->getStoreId()); //Don't trust external data $addon->setAddonName(isset($addonInfo->name) ? $addonInfo->name : $addonId); $addon->setAddonDescription(isset($addonInfo->description) ? $addonInfo->description : ""); $addon->setAddonNick(isset($addonInfo->nick) ? $addonInfo->nick : ""); $addon->setAddonVersion(isset($addonInfo->version) ? $addonInfo->version : ""); $addon->setAddonStatus(isset($addonInfo->status) ? $addonInfo->status : ""); $addon->setAddonType(isset($addonInfo->type) ? $addonInfo->type : ""); $addon->setAddonPublisher(isset($addonInfo->publisher) ? $addonInfo->publisher : ""); $workspace = isset($pmLicenseManagerO->workspace) ? $pmLicenseManagerO->workspace : 'pmLicenseSrv'; $addon->setAddonDownloadUrl(isset($addonInfo->download_url) ? $addonInfo->download_url : "http://" . $pmLicenseManagerO->server . "/sys" . $workspace . "/en/green/services/rest?action=getPlugin&OBJ_UID=" . $addonInfo->guid); $addon->setAddonDownloadMd5(isset($addonInfo->download_md5) ? $addonInfo->download_md5 : ""); $addon->setAddonReleaseDate(isset($addonInfo->release_date) ? $addonInfo->release_date : ""); $addon->setAddonReleaseType(isset($addonInfo->release_type) ? $addonInfo->release_type : ''); $addon->setAddonReleaseNotes(isset($addonInfo->release_notes) ? $addonInfo->release_notes : ""); $addon->setAddonState(""); $addon->save(); if (isset($localPlugins[$addonId])) { unset($localPlugins[$addonId]); } } foreach ($localPlugins as $keyPlugin => $addonA) { //G::pr($addonA ); //$addonA->save(); $addon = new AddonsManager(); //G::pr($addon); $addon->setAddonId($addonA->getAddonId()); $addon->setStoreId($addonA->getStoreId()); //Don't trust external data $addon->setAddonName($addonA->getAddonName()); $addon->setAddonDescription($addonA->getAddonDescription()); $addon->setAddonNick($addonA->getAddonNick()); $addon->setAddonVersion(""); $addon->setAddonStatus($addonA->getAddonStatus()); $addon->setAddonType($addonA->getAddonType()); $addon->setAddonPublisher($addonA->getAddonPublisher()); $addon->setAddonDownloadUrl($addonA->getAddonDownloadUrl()); $addon->setAddonDownloadMd5($addonA->getAddonDownloadMd5()); $addon->setAddonReleaseDate(null); $addon->setAddonReleaseType('localRegistry'); $addon->setAddonReleaseNotes(""); $addon->setAddonState(""); $addon->save(); } } $this->setStoreLastUpdated(time()); $this->save(); } catch (Exception $e) { //If we had issues, don't keep only a part of the items $this->clear($type); throw $e; } } return true; }
$pathhome = implode(PATH_SEP, $docuroot) . PATH_SEP; // try to find automatically the trunk directory where are placed the RBAC and Gulliver directories // in a normal installation you don't need to change it. array_pop($docuroot); $pathTrunk = implode(PATH_SEP, $docuroot) . PATH_SEP; array_pop($docuroot); $pathOutTrunk = implode(PATH_SEP, $docuroot) . PATH_SEP; define('PATH_HOME', $pathhome); define('PATH_TRUNK', $pathTrunk); define('PATH_OUTTRUNK', $pathOutTrunk); // Including these files we get the PM paths and definitions (that should be just one file. require_once $pathhome . PATH_SEP . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'; require_once PATH_CORE . 'classes' . PATH_SEP . 'class.system.php'; // starting session session_start(); $config = System::getSystemConfiguration(); $e_all = defined('E_DEPRECATED') ? E_ALL & ~E_DEPRECATED : E_ALL; $e_all = defined('E_STRICT') ? $e_all & ~E_STRICT : $e_all; $e_all = $config['debug'] ? $e_all : $e_all & ~E_NOTICE; // Do not change any of these settings directly, use env.ini instead ini_set('display_errors', $config['debug']); ini_set('error_reporting', $e_all); ini_set('short_open_tag', 'On'); ini_set('default_charset', "UTF-8"); ini_set('memory_limit', $config['memory_limit']); ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']); ini_set('date.timezone', $config['time_zone']); define('DEBUG_SQL_LOG', $config['debug_sql']); define('DEBUG_TIME_LOG', $config['debug_time']); define('DEBUG_CALENDAR_LOG', $config['debug_calendar']); define('MEMCACHED_ENABLED', $config['memcached']);
public function solrEnv($sysName = '') { if (empty($sysName)) { $conf = System::getSystemConfiguration(); } else { $conf = System::getSystemConfiguration('', '', $sysName); } if (!isset($conf['solr_enabled']) || !isset($conf['solr_host']) || !isset($conf['solr_instance'])) { return false; } if ($conf['solr_enabled']) { return array('solr_enabled' => $conf['solr_enabled'], 'solr_host' => $conf['solr_host'], 'solr_instance' => $conf['solr_instance']); } return false; }
define('PATH_SEP', '/'); define('PATH_HOME', WORKFLOW_PATH); define('PATH_TRUNK', PROCESSMAKER_PATH); define('PATH_OUTTRUNK', realpath(PROCESSMAKER_PATH . '/..')); /* Most definitions (including the G class) is done in paths.php * This mostly simulates a sysGeneric.php call. */ if (file_exists(PATH_HOME . 'engine/config/paths_installed.php')) { require_once PATH_HOME . 'engine/config/paths_installed.php'; } require_once PATH_HOME . 'engine/config/paths.php'; require_once PATH_THIRDPARTY . 'pake/pakeFunction.php'; require_once PATH_THIRDPARTY . 'pake/pakeGetopt.class.php'; require_once PATH_CORE . 'config/environments.php'; require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php'; $config = System::getSystemConfiguration(PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'env.ini'); $e_all = defined('E_DEPRECATED') ? E_ALL & ~E_DEPRECATED : E_ALL; $e_all = defined('E_STRICT') ? E_ALL & ~E_STRICT : $e_all; $e_all = $e_all & ~E_NOTICE; // don't notices // Do not change any of these settings directly, use env.ini instead ini_set('display_errors', $config['debug']); ini_set('error_reporting', $e_all); ini_set('short_open_tag', 'On'); ini_set('default_charset', "UTF-8"); ini_set('memory_limit', $config['memory_limit']); ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']); ini_set('date.timezone', $config['time_zone']); define('DEBUG_SQL_LOG', $config['debug_sql']); define('DEBUG_TIME_LOG', $config['debug_time']); define('DEBUG_CALENDAR_LOG', $config['debug_calendar']);
public function checkMafeRequirements ($workspace,$lang) { $this->initPropel(true); $pmRestClient = OauthClientsPeer::retrieveByPK('x-pm-local-client'); if (empty($pmRestClient)) { if (!is_file(PATH_DATA . 'sites/' . $workspace . '/' . '.server_info')) { $_CSERVER = $_SERVER; unset($_CSERVER['REQUEST_TIME']); unset($_CSERVER['REMOTE_PORT']); $cput = serialize($_CSERVER); file_put_contents(PATH_DATA . 'sites/' . $workspace . '/' . '.server_info', $cput); } if (is_file(PATH_DATA . 'sites/' . $workspace . '/' . '.server_info')) { $SERVER_INFO = file_get_contents(PATH_DATA . 'sites/' . $workspace . '/'.'.server_info'); $SERVER_INFO = unserialize($SERVER_INFO); $envFile = PATH_CONFIG . 'env.ini'; $skin ='neoclassic'; if (file_exists($envFile) ) { $sysConf = System::getSystemConfiguration($envFile); $lang = $sysConf['default_lang']; $skin = $sysConf['default_skin']; } $endpoint = sprintf( '%s/sys%s/%s/%s/oauth2/grant', isset($SERVER_INFO['HTTP_ORIGIN']) ? $SERVER_INFO['HTTP_ORIGIN'] : '', $workspace, $lang, $skin ); $oauthClients = new OauthClients(); $oauthClients->setClientId('x-pm-local-client'); $oauthClients->setClientSecret('179ad45c6ce2cb97cf1029e212046e81'); $oauthClients->setClientName('PM Web Designer'); $oauthClients->setClientDescription('ProcessMaker Web Designer App'); $oauthClients->setClientWebsite('www.processmaker.com'); $oauthClients->setRedirectUri($endpoint); $oauthClients->save(); } else { eprintln("WARNING! No server info found!", 'red'); } } }
public function do_post_request($url, $data, $optional_headers = null) { $params = array('http' => array('method' => 'POST', 'content' => $data)); if ($optional_headers !== null) { $params['http']['header'] = $optional_headers; } // Proxy settings $sysConf = System::getSystemConfiguration(); if ($sysConf['proxy_host'] != '') { if (!is_array($params['http'])) { $params['http'] = array(); } $params['http']['request_fulluri'] = true; $params['http']['proxy'] = 'tcp://' . $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''); if ($sysConf['proxy_user'] != '') { if (!isset($params['http']['header'])) { $params['http']['header'] = ''; } $params['http']['header'] .= 'Proxy-Authorization: Basic ' . base64_encode($sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); } } $ctx = stream_context_create($params); //G::pr($ctx); $fp = @fopen($url, 'rb', false, $ctx); //G::pr($fp); if (!$fp) { throw new Exception("Problem with {$url}, {$php_errormsg}"); } $response = @stream_get_contents($fp); if ($response === false) { throw new Exception("Problem reading data from {$url}, {$php_errormsg}"); } return $response; }
public function createMySQLWorkspace () { G::LoadSystem('inputfilter'); $filter = new InputFilter(); ini_set( 'max_execution_time', '0' ); $info = new StdClass(); $info->result = false; $info->message = ''; $info->canRedirect = true; $db_hostname = trim( $_REQUEST['db_hostname'] ); $db_port = trim( $_REQUEST['db_port'] ); $db_port = $filter->validateInput($db_port); $db_username = trim( $_REQUEST['db_username'] ); $db_username = $filter->validateInput($db_username); $db_password = trim( $_REQUEST['db_password'] ); $db_password = $filter->validateInput($db_password); $wf = trim( $_REQUEST['wfDatabase'] ); $rb = trim( $_REQUEST['wfDatabase'] ); $rp = trim( $_REQUEST['wfDatabase'] ); $workspace = trim( $_REQUEST['workspace'] ); $pathConfig = trim( $_REQUEST['pathConfig'] ); $pathLanguages = trim( $_REQUEST['pathLanguages'] ); $pathPlugins = trim( $_REQUEST['pathPlugins'] ); $pathShared = trim( $_REQUEST['pathShared'] ); $pathXmlforms = trim( $_REQUEST['pathXmlforms'] ); $adminPassword = trim( $_REQUEST['adminPassword'] ); $adminPassword = $filter->validateInput($adminPassword); $adminUsername = trim( $_REQUEST['adminUsername'] ); $adminUsername = $filter->validateInput($adminUsername); $deleteDB = ($_REQUEST['deleteDB'] == 'true'); $userLogged = (isset($_REQUEST['userLogged']) ? ($_REQUEST['userLogged'] == 'true') : false); $userLogged = $filter->validateInput($userLogged); if (substr( $pathShared, - 1 ) != '/') { $pathShared .= '/'; } $this->installLog( '-------------------------------------------' ); $this->installLog( G::LoadTranslation('ID_CREATING_WORKSPACE', SYS_LANG, Array($workspace))); try { $db_host = ($db_port != '' && $db_port != 3306) ? $db_hostname . ':' . $db_port : $db_hostname; $db_host = $filter->validateInput($db_host); $db_username = $filter->validateInput($db_username); $db_password = $filter->validateInput($db_password); $this->link = @mysql_connect( $db_host, $db_username, $db_password ); $this->installLog( G::LoadTranslation('ID_CONNECT_TO_SERVER', SYS_LANG, Array($db_hostname, $db_port, $db_username ) )); if ($deleteDB) { $q = sprintf( 'DROP DATABASE IF EXISTS %s;', $wf, $wf ); $this->mysqlQuery( $q ); } // CREATE databases wf_workflow, rb_workflow and rp_workflow $q = sprintf( 'CREATE DATABASE IF NOT EXISTS %s;', $wf, $wf ); $this->mysqlQuery( $q ); // CREATE users and GRANT Privileges $wf_workpace = $wf; $rb_workpace = $wf; $rp_workpace = $wf; if (!$userLogged) { $wfPass = G::generate_password( 12 ); $this->setGrantPrivilegesMySQL( $wf, $wfPass, $wf, $db_hostname ); $this->setGrantPrivilegesMySQL( $rb, $wfPass, $wf, $db_hostname ); $this->setGrantPrivilegesMySQL( $rp, $wfPass, $wf, $db_hostname ); } else { $wfPass = $db_password; $rbPass = $db_password; $rpPass = $db_password; $wf = $db_username; $rb = $db_username; $rp = $db_username; } // Generate the db.php file and folders $pathSharedSites = $pathShared; $path_site = $pathShared . "/sites/" . $workspace . "/"; $db_file = $path_site . "db.php"; @mkdir( $path_site, 0777, true ); @mkdir( $path_site . "files/", 0777, true ); @mkdir( $path_site . "mailTemplates/", 0777, true ); @mkdir( $path_site . "public/", 0777, true ); @mkdir( $path_site . "reports/", 0777, true ); @mkdir( $path_site . "xmlForms", 0777, true ); $dbText = "<?php\n"; $dbText .= sprintf( "// Processmaker configuration\n" ); $dbText .= sprintf( " define ('DB_ADAPTER', '%s' );\n", 'mysql' ); $dbText .= sprintf( " define ('DB_HOST', '%s' );\n", $db_host ); $dbText .= sprintf( " define ('DB_NAME', '%s' );\n", $wf_workpace ); $dbText .= sprintf( " define ('DB_USER', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_PASS', '%s' );\n", $wfPass ); $dbText .= sprintf( " define ('DB_RBAC_HOST', '%s' );\n", $db_host ); $dbText .= sprintf( " define ('DB_RBAC_NAME', '%s' );\n", $wf_workpace ); $dbText .= sprintf( " define ('DB_RBAC_USER', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_RBAC_PASS', '%s' );\n", $wfPass ); $dbText .= sprintf( " define ('DB_REPORT_HOST', '%s' );\n", $db_host ); $dbText .= sprintf( " define ('DB_REPORT_NAME', '%s' );\n", $wf_workpace ); $dbText .= sprintf( " define ('DB_REPORT_USER', '%s' );\n", $wf ); $dbText .= sprintf( " define ('DB_REPORT_PASS', '%s' );\n", $wfPass ); if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) { $dbText .= "\n"; $dbText .= " define ('PARTNER_FLAG', " . ((defined('PARTNER_FLAG')) ? PARTNER_FLAG : ((isset($_REQUEST['PARTNER_FLAG'])) ? $_REQUEST['PARTNER_FLAG']:'false')) . ");\n"; if ($this->systemName != '') { $dbText .= " define ('SYSTEM_NAME', '" . $this->systemName . "');\n"; } } $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($db_file) )); file_put_contents( $db_file, $dbText ); // Generate the databases.php file $databases_file = $path_site . 'databases.php'; $dbData = sprintf( "\$dbAdapter = '%s';\n", 'mysql' ); $dbData .= sprintf( "\$dbHost = '%s';\n", $db_host ); $dbData .= sprintf( "\$dbName = '%s';\n", $wf_workpace ); $dbData .= sprintf( "\$dbUser = '******';\n", $wf ); $dbData .= sprintf( "\$dbPass = '******';\n", $wfPass ); $dbData .= sprintf( "\$dbRbacHost = '%s';\n", $db_host ); $dbData .= sprintf( "\$dbRbacName = '%s';\n", $wf_workpace ); $dbData .= sprintf( "\$dbRbacUser = '******';\n", $wf ); $dbData .= sprintf( "\$dbRbacPass = '******';\n", $wfPass ); $dbData .= sprintf( "\$dbReportHost = '%s';\n", $db_host ); $dbData .= sprintf( "\$dbReportName = '%s';\n", $wf_workpace ); $dbData .= sprintf( "\$dbReportUser = '******';\n", $wf ); $dbData .= sprintf( "\$dbReportPass = '******';\n", $wfPass ); $databasesText = str_replace( '{dbData}', $dbData, @file_get_contents( PATH_HOME . 'engine/templates/installer/databases.tpl' ) ); $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($databases_file) )); file_put_contents( $databases_file, $databasesText ); // Execute scripts to create and populates databases $query = sprintf( "USE %s;", $wf_workpace ); $this->mysqlQuery( $query ); $this->mysqlFileQuery( PATH_RBAC_HOME . 'engine/data/mysql/schema.sql' ); $this->mysqlFileQuery( PATH_RBAC_HOME . 'engine/data/mysql/insert.sql' ); $query = sprintf( "USE %s;", $wf_workpace ); $this->mysqlQuery( $query ); $this->mysqlFileQuery( PATH_HOME . 'engine/data/mysql/schema.sql' ); $this->mysqlFileQuery( PATH_HOME . 'engine/data/mysql/insert.sql' ); if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) { $this->setPartner(); //$this->setConfiguration(); } // Create the triggers if (file_exists( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationInsert.sql' ) && file_exists( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationUpdate.sql' ) && file_exists( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationUpdate.sql' ) && file_exists( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationDelete.sql' ) && file_exists( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerContentUpdate.sql' )) { $this->mysqlQuery( @file_get_contents( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationInsert.sql' ) ); $this->mysqlQuery( @file_get_contents( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationUpdate.sql' ) ); $this->mysqlQuery( @file_get_contents( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationUpdate.sql' ) ); $this->mysqlQuery( @file_get_contents( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationDelete.sql' ) ); $this->mysqlQuery(@file_get_contents(PATH_HOME . "engine/methods/setup/setupSchemas/triggerSubApplicationInsert.sql")); $this->mysqlQuery( @file_get_contents( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerContentUpdate.sql' ) ); $this->mysqlQuery( "INSERT INTO `CONFIGURATION` ( `CFG_UID`, `CFG_VALUE` ) VALUES ( 'APP_CACHE_VIEW_ENGINE', '" . mysql_real_escape_string( serialize( array ('LANG' => 'en','STATUS' => 'active' ) ) ) . "' )" ); $this->mysqlQuery("INSERT INTO EMAIL_SERVER(MESS_UID, MESS_ENGINE) VALUES('" . \ProcessMaker\Util\Common::generateUID() . "', 'MAIL')"); } // Change admin user $query = sprintf( "USE %s;", $wf_workpace ); $this->mysqlQuery( $query ); $query = sprintf( "UPDATE USERS SET USR_USERNAME = '******', USR_LASTNAME = '%s', USR_PASSWORD = '******' WHERE USR_UID = '00000000000000000000000000000001' ", $adminUsername, $adminUsername, G::encryptOld( $adminPassword ) ); $this->mysqlQuery( $query ); $query = sprintf( "UPDATE RBAC_USERS SET USR_USERNAME = '******', USR_LASTNAME = '%s', USR_PASSWORD = '******' WHERE USR_UID = '00000000000000000000000000000001' ", $adminUsername, $adminUsername, G::encryptOld( $adminPassword ) ); $this->mysqlQuery( $query ); // Write the paths_installed.php file (contains all the information configured so far) if (! file_exists( FILE_PATHS_INSTALLED )) { $sh = G::encryptOld( filemtime( PATH_GULLIVER . '/class.g.php' ) ); $h = G::encrypt( $db_hostname . $sh . $db_username . $sh . $db_password, $sh ); $dbText = "<?php\n"; $dbText .= sprintf( " define('PATH_DATA', '%s');\n", $pathShared ); $dbText .= sprintf( " define('PATH_C', '%s');\n", $pathShared . 'compiled/' ); $dbText .= sprintf( " define('HASH_INSTALLATION', '%s');\n", $h ); $dbText .= sprintf( " define('SYSTEM_HASH', '%s');\n", $sh ); $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array(FILE_PATHS_INSTALLED) )); file_put_contents( FILE_PATHS_INSTALLED, $dbText ); } /** * AppCacheView Build */ define( 'HASH_INSTALLATION', $h ); define( 'SYSTEM_HASH', $sh ); define( 'PATH_DB', $pathShared . 'sites' . PATH_SEP ); define( 'SYS_SYS', $workspace ); require_once ("propel/Propel.php"); Propel::init( PATH_CORE . "config/databases.php" ); $con = Propel::getConnection( 'workflow' ); require_once ('classes/model/AppCacheView.php'); $lang = 'en'; //setup the appcacheview object, and the path for the sql files $appCache = new AppCacheView(); $appCache->setPathToAppCacheFiles( PATH_METHODS . 'setup' . PATH_SEP . 'setupSchemas' . PATH_SEP ); //Update APP_DELEGATION.DEL_LAST_INDEX data $res = $appCache->updateAppDelegationDelLastIndex($lang, true); //APP_DELEGATION INSERT $res = $appCache->triggerAppDelegationInsert( $lang, true ); //APP_DELEGATION Update $res = $appCache->triggerAppDelegationUpdate( $lang, true ); //APPLICATION UPDATE $res = $appCache->triggerApplicationUpdate( $lang, true ); //APPLICATION DELETE $res = $appCache->triggerApplicationDelete( $lang, true ); //SUB_APPLICATION INSERT $res = $appCache->triggerSubApplicationInsert($lang, false); //CONTENT UPDATE $res = $appCache->triggerContentUpdate( $lang, true ); //build using the method in AppCacheView Class $res = $appCache->fillAppCacheView( $lang ); //end AppCacheView Build //erik: for new env conf handling G::loadClass( 'system' ); $envFile = PATH_CONFIG . 'env.ini'; // getting configuration from env.ini $sysConf = System::getSystemConfiguration( $envFile ); $langUri = 'en'; if (isset($sysConf['default_lang'])) { $langUri = $sysConf['default_lang']; } $skinUri = 'neoclassic'; if (isset($sysConf['default_skin'])) { $skinUri = $sysConf['default_skin']; } $updatedConf['default_lang'] = $langUri; $updatedConf['default_skin'] = $skinUri; $info->uri = PATH_SEP . 'sys' . $_REQUEST['workspace'] . PATH_SEP . $langUri . PATH_SEP . $skinUri . PATH_SEP . 'login' . PATH_SEP . 'login'; //register PMDesigner Client $http = (G::is_https() == true) ? 'https' : 'http'; $host = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : ''); $endpoint = sprintf( '%s://%s/sys%s/%s/%s/oauth2/grant', $http, $host, $workspace, $langUri, $skinUri ); // inserting the outh_client if (!$userLogged) { $query = sprintf( "USE %s;", $wf ); } else { $query = sprintf( "USE %s;", trim( $_REQUEST['wfDatabase']) ); } $this->mysqlQuery( $query ); $query = ( "INSERT INTO OAUTH_CLIENTS (CLIENT_ID,CLIENT_SECRET,CLIENT_NAME,CLIENT_DESCRIPTION,CLIENT_WEBSITE,REDIRECT_URI,USR_UID ) VALUES ('x-pm-local-client','179ad45c6ce2cb97cf1029e212046e81','PM Web Designer','ProcessMaker Web Designer App','www.processmaker.com','" . $endpoint . "','00000000000000000000000000000001' )"); $this->mysqlQuery( $query ); $indexFileUpdated = true; if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) { $this->buildParternExtras($adminUsername, $adminPassword, $_REQUEST['workspace'], $langUri, $skinUri); } else { try { G::update_php_ini( $envFile, $updatedConf ); } catch (Exception $e) { $info->result = false; $info->message = G::LoadTranslation('ID_PROCESSMAKER_WRITE_CONFIG_INDEX', SYS_LANG, Array($envFile)); $info->message .= G::LoadTranslation('ID_PROCESSMAKER_UI_NOT_INSTALL'); $this->installLog( G::LoadTranslation('ID_INSTALL_BUT_ERROR', SYS_LANG, Array('env.ini'))); return $info; } try { // update the main index file $indexFileUpdated = System::updateIndexFile(array('lang' => 'en','skin' => $updatedConf['default_skin'])); } catch (Exception $e) { $info->result = false; $info->message = G::LoadTranslation('ID_PROCESSMAKER_WRITE_CONFIG_INDEX', SYS_LANG, Array(PATH_HTML . "index.html.")); $info->message .= G::LoadTranslation('ID_PROCESSMAKER_UI_NOT_INSTALL'); $this->installLog( G::LoadTranslation('ID_INSTALL_BUT_ERROR', SYS_LANG, Array('index.html'))); return $info; } } $this->installLog( G::LoadTranslation('ID_INDEX_FILE_UPDATED', SYS_LANG, Array($indexFileUpdated, $sysConf['default_lang'],$sysConf['default_skin']))); $this->installLog( G::LoadTranslation('ID_INSTALL_SUCESS') ); $info->result = true; $info->message = G::LoadTranslation('ID_INSTALL_SUCESS'); $info->messageFinish = G::LoadTranslation('ID_PROCESSMAKER_SUCCESS_INSTALLED', SYS_LANG, Array($workspace));; } catch (Exception $e) { $info->canRedirect = false; $info->result = false; $info->message = $e->getMessage(); } return $info; }
public function render($width = 300) { $pCurl = curl_init(); curl_setopt($pCurl, CURLOPT_URL, $this->urlFrom); curl_setopt($pCurl, CURLOPT_RETURNTRANSFER, true); curl_setopt($pCurl, CURLOPT_FOLLOWLOCATION, false); curl_setopt($pCurl, CURLOPT_AUTOREFERER, true); //To avoid SSL error curl_setopt($pCurl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($pCurl, CURLOPT_SSL_VERIFYPEER, 0); //To avoid timeouts curl_setopt($pCurl, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($pCurl, CURLOPT_TIMEOUT, 20); curl_setopt($pCurl, CURLOPT_NOPROGRESS, true); curl_setopt($pCurl, CURLOPT_VERBOSE, false); //Apply proxy settings $sysConf = System::getSystemConfiguration(); if ($sysConf['proxy_host'] != '') { curl_setopt($pCurl, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); if ($sysConf['proxy_port'] != '') { curl_setopt($pCurl, CURLOPT_PROXYPORT, $sysConf['proxy_port']); } if ($sysConf['proxy_user'] != '') { curl_setopt($pCurl, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); } curl_setopt($pCurl, CURLOPT_HTTPHEADER, array('Expect:')); } $self = new stdclass(); $self->rss = @simplexml_load_string(curl_exec($pCurl)); if ($self->rss) { $index = 0; $render = ''; $self->items = $self->rss->channel->item; if (count($self->rss->channel) != 0) { $status = 'true'; foreach ($self->items as $self->item) { $self->title = $self->item->title; $self->link = $self->item->link; $self->des = $self->item->description; $render[] = array('link' => '<a href="' . $self->link . '" target="_blank">' . $self->title . '</a><br/>', 'description' => $self->des . '<br/><hr>'); $index++; } } else { $status = 'Error'; $render[] = array('link' => 'Error', 'description' => "Unable to parse XML"); } } else { $status = 'Error'; $render[] = array('link' => 'Error', 'description' => "Unable to parse XML"); } G::verifyPath(PATH_SMARTY_C, true); $smarty = new Smarty(); $smarty->template_dir = PATH_CORE . 'templates/dashboard/'; $smarty->compile_dir = PATH_SMARTY_C; try { $smarty->assign('url', $this->urlFrom); $smarty->assign('render', $render); $smarty->assign('status', $status); } catch (Exception $ex) { print $item->key; } $smarty->display('dashletRssReaderTemplate.html', null, null); }
/** * get the process Data from a process * * @param $proId process Uid * @return $result */ public function ws_processGetData ($proId) { global $sessionId; global $client; $endpoint = PML_WSDL_URL; $proxy = array (); $sysConf = System::getSystemConfiguration(); if ($sysConf['proxy_host'] != '') { $proxy['proxy_host'] = $sysConf['proxy_host']; if ($sysConf['proxy_port'] != '') { $proxy['proxy_port'] = $sysConf['proxy_port']; } if ($sysConf['proxy_user'] != '') { $proxy['proxy_login'] = $sysConf['proxy_user']; } if ($sysConf['proxy_pass'] != '') { $proxy['proxy_password'] = $sysConf['proxy_pass']; } } $client = new SoapClient( $endpoint, $proxy ); $sessionId = ''; $params = array ('sessionId' => $sessionId,'processId' => $proId ); $result = $client->__SoapCall( 'processGetData', array ($params ) ); if ($result->status_code == 0) { return $result; } throw (new Exception( $result->message )); }
public function executeTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType, $aFields = array()) { /*----------------------------------********---------------------------------*/ $aTriggers = $this->loadTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType); if (count($aTriggers) > 0) { global $oPMScript; $oPMScript = new PMScript(); $oPMScript->setFields($aFields); $arraySystemConfiguration = System::getSystemConfiguration(PATH_CONFIG . "env.ini"); /*----------------------------------********---------------------------------*/ foreach ($aTriggers as $aTrigger) { /*----------------------------------********---------------------------------*/ //Execute $bExecute = true; if ($aTrigger['ST_CONDITION'] !== '') { $oPMScript->setScript($aTrigger['ST_CONDITION']); $bExecute = $oPMScript->evaluate(); } if ($bExecute) { $oPMScript->setScript($aTrigger['TRI_WEBBOT']); $oPMScript->execute(); } } /*----------------------------------********---------------------------------*/ return $oPMScript->aFields; } else { return $aFields; } }
/** * Stores a message in the log file, if the file size exceeds * specified log file is renamed and a new one is created. * * @param type $message * @param type $pathData * @param type $file */ public static function log($message, $pathData = PATH_DATA, $file = 'cron.log') { $config = System::getSystemConfiguration(); G::LoadSystem('logger'); $oLogger = Logger::getSingleton($pathData, PATH_SEP, $file); $oLogger->limitFile = $config['number_log_file']; $oLogger->limitSize = $config['size_log_file']; $oLogger->write($message); }
function __doRequest($request, $location, $action, $version) { $headers = array('Method: POST', 'Connection: Keep-Alive', 'User-Agent: PHP-SOAP-CURL', 'Content-Type: text/xml; charset=utf-8', 'SOAPAction: "' . $action . '"'); $this->__last_request_headers = $headers; $ch = curl_init($location); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM); //curl_setopt($ch, CURLOPT_USERPWD, $this->options['auth']); //Hugo's Code curl_setopt($ch, CURLOPT_USERPWD, $this->user . ':' . $this->password); //Ankit's Code //Apply proxy settings if (class_exists('System')) { $sysConf = System::getSystemConfiguration(); if ($sysConf['proxy_host'] != '') { curl_setopt($ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); if ($sysConf['proxy_port'] != '') { curl_setopt($ch, CURLOPT_PROXYPORT, $sysConf['proxy_port']); } if ($sysConf['proxy_user'] != '') { curl_setopt($ch, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); } curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); } } $response = curl_exec($ch); return $response; }
global $RBAC; $RBAC->requirePermissions('PM_USERS'); //calculating the max upload file size; $POST_MAX_SIZE = ini_get('post_max_size'); $mul = substr($POST_MAX_SIZE, -1); $mul = $mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)); $postMaxSize = (int) $POST_MAX_SIZE * $mul; $UPLOAD_MAX_SIZE = ini_get('upload_max_filesize'); $mul = substr($UPLOAD_MAX_SIZE, -1); $mul = $mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)); $uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul; if ($postMaxSize < $uploadMaxSize) { $uploadMaxSize = $postMaxSize; } $languageManagement = 0; /*----------------------------------********---------------------------------*/ $arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS); $oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->addExtJsScript('users/users', true); //adding a javascript file .js $oHeadPublisher->assign('USR_UID', ''); $oHeadPublisher->assign('MODE', $_GET['MODE']); $oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') '); $oHeadPublisher->assign('SYSTEM_TIME_ZONE', $arraySystemConfiguration['time_zone']); $oHeadPublisher->assign('TIME_ZONE_DATA', array_map(function ($value) { return [$value, $value]; }, DateTimeZone::listIdentifiers())); $oHeadPublisher->assign('__SYSTEM_UTC_TIME_ZONE__', isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'] ? 1 : 0); $oHeadPublisher->assign('LANGUAGE_MANAGEMENT', $languageManagement); G::RenderPage('publish', 'extJs');
/** * @method * * Upload File/Document to Zimbra Server * * @name uploadZimbraFile * @label Upload File/Document to Zimbra Server * * @param string | $ServerUrl | Server name and port where Zimbra exists | zimbra.server:port * @param string | $username | Valid username to connect to Zimbra server * @param string | $preAuthKey | Server Key for SSO authentication * @param string | $folderName | Folder Name * @param string | $fileLocation | Absolute path of the File to be uploaded. * * @return string | $result | Response * */ function uploadZimbraFile($ServerUrl, $username, $preAuthKey, $folderName, $fileLocation) { $header_array = array("ENCTYPE" => "multipart/form-data"); $file = $fileLocation; $oZimbraObj = new Zimbra($username, $ServerUrl, $preAuthKey); $connectResult = $oZimbraObj->connect(); $sAuthToken = $oZimbraObj->auth_token; $cookie = array('ZM_AUTH_TOKEN' => $sAuthToken, 'ZM_TEST' => true); $cookie = 'ZM_AUTH_TOKEN=' . $sAuthToken . '; ZM_TEST=' . true; $url = "http://{$ServerUrl}/service/upload?fmt=raw"; $params = array('uploadFile' => "@{$file}"); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); //curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_COOKIE, $cookie); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($ch, CURLOPT_COOKIESESSION, true); curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_NOPROGRESS, false); curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $header_array); //Apply proxy settings $sysConf = System::getSystemConfiguration(); if ($sysConf['proxy_host'] != '') { curl_setopt($ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); if ($sysConf['proxy_port'] != '') { curl_setopt($ch, CURLOPT_PROXYPORT, $sysConf['proxy_port']); } if ($sysConf['proxy_user'] != '') { curl_setopt($ch, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); } curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); } if (!($response = curl_exec($ch))) { return "Upload error. Connection Error"; } //G::pr($response); $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $result['header'] = substr($response, 0, $header_size); $result['body'] = substr($response, $header_size); $result['http_code'] = curl_getinfo($ch, CURLINFO_HTTP_CODE); $result['last_url'] = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); $aString = array(); $aExplode = explode(",", $result['body']); $uploadID = substr($aExplode[2], 1, -2); curl_close($ch); // gettin FOlder ID $FolderResult = $oZimbraObj->getFolder($folderName); if (isset($FolderResult['id'])) { $sFolderID = $FolderResult['id']; } else { $sFolderID = $FolderResult['folder_attribute_id']['0']; } $fileNamePath = $fileLocation; $fileName = basename($fileNamePath); $docDetails = $oZimbraObj->getDocId($sFolderID, $fileName); if ($docDetails) { $docId = $docDetails['doc_attribute_id'][0]; $docVersion = $docDetails['doc_attribute_ver'][0]; } $uploadResult = $oZimbraObj->upload($sFolderID, $uploadID, $docVersion, $docId); if (isset($uploadResult['error'])) { return $uploadResult['error']; } else { return "The file has been uploaded Successfully"; } }