function index($httpData) { global $RBAC; $RBAC->requirePermissions('PM_LOGIN'); $meta = new stdClass(); $showSystemInfo = $RBAC->userCanAccess('PM_SETUP') == 1; // setting variables for template $this->setVar('logo_company', $this->getCompanyLogo()); $this->setVar('userfullname', htmlentities($this->getUserFullName(), ENT_QUOTES, 'UTF-8')); $this->setVar('user', isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : ''); $this->setVar('pipe', isset($_SESSION['USR_USERNAME']) ? ' | ' : ''); $this->setVar('rolename', $this->getUserRole()); $this->setVar('logout', G::LoadTranslation('ID_LOGOUT')); $this->setVar('workspace', defined('SYS_SYS') ? ucfirst(SYS_SYS) : ''); $this->setVar('user_avatar', 'users/users_ViewPhotoGrid?pUID=' . $_SESSION['USER_LOGGED'] . '&h=' . rand()); $this->setVar('udate', G::getformatedDate(date('Y-m-d'), 'M d, yyyy', SYS_LANG)); // license notification $expireInLabel = ''; if (class_exists('pmLicenseManager')) { $pmLicenseManager =& pmLicenseManager::getSingleton(); $expireIn = $pmLicenseManager->getExpireIn(); $expireInLabel = $pmLicenseManager->getExpireInLabel(); } $this->setVar('licenseNotification', $expireInLabel); // setting variables on javascript env. $this->setJSVar('meta', array('menu' => $this->getMenu())); $activeTab = 0; if (isset($_SESSION['_defaultUserLocation'])) { $activeTab = $this->resolveUrlToTabIndex($_SESSION['_defaultUserLocation']); } if (isset($_GET['st'])) { $activeTab = $this->getActiveTab($_GET['st']); unset($_GET['st']); } $this->setJSVar('activeTab', $activeTab); $this->setJSVar('urlAddGetParams', $this->getUrlGetParams()); $this->setJSVar('showSystemInfo', $showSystemInfo); $switchInterface = isset($_SESSION['user_experience']) && $_SESSION['user_experience'] == 'SWITCHABLE'; if (($flyNotify = $this->getFlyNotify()) !== false) { $this->setJSVar('flyNotify', $flyNotify); } $this->setJSVar('switchInterface', $switchInterface); $this->includeExtJSLib('ux/ux.menu'); $this->includeExtJS('main/index'); $this->setLayout('pm-modern'); $this->afterLoad($httpData); $this->render(); }
private function _default() { require_once PATH_THIRDPARTY . 'smarty/libs/Smarty.class.php'; // put full path to Smarty.class.php global $G_ENABLE_BLANK_SKIN; //menu global $G_PUBLISH; global $G_MAIN_MENU; global $G_SUB_MENU; global $G_MENU_SELECTED; global $G_SUB_MENU_SELECTED; global $G_ID_MENU_SELECTED; global $G_ID_SUB_MENU_SELECTED; G::verifyPath(PATH_SMARTY_C, true); G::verifyPath(PATH_SMARTY_CACHE, true); $smarty = new Smarty(); $oHeadPublisher =& headPublisher::getSingleton(); $smarty->compile_dir = PATH_SMARTY_C; $smarty->cache_dir = PATH_SMARTY_CACHE; $smarty->config_dir = PATH_THIRDPARTY . 'smarty/configs'; //To setup en extJS Theme for this Skin G::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); $extSkin = $oServerConf->getProperty("extSkin"); if (!$extSkin) { $extSkin = array(); } $extSkin[SYS_SKIN] = "xtheme-gray"; $oServerConf->setProperty("extSkin", $extSkin); //End of extJS Theme setup if (isset($G_ENABLE_BLANK_SKIN) && $G_ENABLE_BLANK_SKIN) { $smarty->template_dir = $this->layoutFileBlank['dirname']; $smarty->force_compile = $this->forceTemplateCompile; $smarty->display($layoutFileBlank['basename']); } else { $smarty->template_dir = $this->layoutFile['dirname']; $meta = null; $header = null; if (preg_match("/^.*\\(.*MSIE (\\d+)\\..+\\).*\$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch)) { $ie = intval($arrayMatch[1]); if ($ie == 10) { $ie = 8; $meta = "<meta http-equiv=\"X-UA-Compatible\" content=\"IE={$ie}\" />"; } } if (isset($oHeadPublisher)) { if (defined('SYS_SYS')) { $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . SYS_SYS . ')' : ''; } $header = $oHeadPublisher->printHeader(); $header .= $oHeadPublisher->getExtJsStylesheets($this->cssFileName); } $smarty->assign("meta", $meta); $smarty->assign("header", $header); $footer = ''; if (strpos($_SERVER['REQUEST_URI'], '/login/login') !== false) { $freeOfChargeText = ""; if (!defined('SKIP_FREE_OF_CHARGE_TEXT')) { $freeOfChargeText = "Supplied free of charge with no support, certification, warranty, <br>maintenance nor indemnity by Colosa and its Certified Partners."; } if (class_exists('pmLicenseManager')) { $freeOfChargeText = ""; } $fileFooter = PATH_SKINS . SYS_SKIN . PATH_SEP . 'footer.html'; if (file_exists($fileFooter)) { $footer .= file_get_contents($fileFooter); } else { $fileFooter = PATH_SKIN_ENGINE . SYS_SKIN . PATH_SEP . 'footer.html'; if (file_exists($fileFooter)) { $footer .= file_get_contents($fileFooter); } else { $fileFooter = PATH_CUSTOM_SKINS . SYS_SKIN . PATH_SEP . 'footer.html'; if (file_exists($fileFooter)) { $footer .= file_get_contents($fileFooter); } else { $footer .= "<br />Copyright © 2003-" . date('Y') . " <a href=\"http://www.colosa.com\" alt=\"Colosa, Inc.\" target=\"_blank\">Colosa, Inc.</a> All rights reserved.<br /> {$freeOfChargeText} " . "<br><br/><a href=\"http://www.processmaker.com\" alt=\"Powered by ProcessMaker - Open Source Workflow & Business Process Management (BPM) Management Software\" title=\"Powered by ProcessMaker\" target=\"_blank\"></a>"; } } } } $oMenu = new Menu(); $menus = $oMenu->generateArrayForTemplate($G_MAIN_MENU, 'SelectedMenu', 'mainMenu', $G_MENU_SELECTED, $G_ID_MENU_SELECTED); $smarty->assign('menus', $menus); $oSubMenu = new Menu(); $subMenus = $oSubMenu->generateArrayForTemplate($G_SUB_MENU, 'selectedSubMenu', 'subMenu', $G_SUB_MENU_SELECTED, $G_ID_SUB_MENU_SELECTED); $smarty->assign('subMenus', $subMenus); if (!defined('NO_DISPLAY_USERNAME')) { define('NO_DISPLAY_USERNAME', 0); } if (NO_DISPLAY_USERNAME == 0) { $switch_interface = isset($_SESSION['user_experience']) && $_SESSION['user_experience'] == 'SWITCHABLE'; $smarty->assign('user_logged', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ''); $smarty->assign('tracker', SYS_COLLECTION == 'tracker' ? $G_PUBLISH->Parts[0]['File'] != 'tracker/login' ? true : '' : ''); $smarty->assign('switch_interface', $switch_interface); $smarty->assign('switch_interface_label', G::LoadTranslation('ID_SWITCH_INTERFACE')); $smarty->assign('rolename', isset($_SESSION['USR_ROLENAME']) ? $_SESSION['USR_ROLENAME'] . '' : ''); $smarty->assign('pipe', isset($_SESSION['USR_USERNAME']) ? ' | ' : ''); $smarty->assign('logout', G::LoadTranslation('ID_LOGOUT')); $smarty->assign('workspace', defined('SYS_SYS') ? SYS_SYS : ''); $uws = isset($_SESSION['USR_ROLENAME']) && $_SESSION['USR_ROLENAME'] != '' ? strtolower(G::LoadTranslation('ID_WORKSPACE_USING')) : G::LoadTranslation('ID_WORKSPACE_USING'); $smarty->assign('workspace_label', $uws); G::LoadClass("configuration"); $conf = new Configurations(); $conf->getFormats(); if (defined('SYS_SYS')) { $smarty->assign('udate', $conf->getSystemDate(date('Y-m-d H:i:s'))); } else { $smarty->assign('udate', G::getformatedDate(date('Y-m-d H:i:s'), 'M d, yyyy', SYS_LANG)); } $name = $conf->userNameFormat(isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '', isset($_SESSION['USR_FULLNAME']) ? htmlentities($_SESSION['USR_FULLNAME'], ENT_QUOTES, 'UTF-8') : '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ''); $smarty->assign('user', $name); } if (class_exists('pmLicenseManager')) { $pmLicenseManagerO =& pmLicenseManager::getSingleton(); $expireIn = $pmLicenseManagerO->getExpireIn(); $expireInLabel = $pmLicenseManagerO->getExpireInLabel(); //if($expireIn<=30){ if ($expireInLabel != "") { $smarty->assign('msgVer', '<label class="textBlack">' . $expireInLabel . '</label> '); } //} } if (defined('SYS_SYS')) { $logout = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/login/login'; } else { $logout = '/sys/' . SYS_LANG . '/' . SYS_SKIN . '/login/login'; } $smarty->assign('linklogout', $logout); $smarty->assign('footer', $footer); $smarty->assign('tpl_menu', PATH_TEMPLATE . 'menu.html'); $smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html'); G::LoadClass('replacementLogo'); $oLogoR = new replacementLogo(); if (defined("SYS_SYS")) { $aFotoSelect = $oLogoR->getNameLogo(isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ''); if (is_array($aFotoSelect)) { $sFotoSelect = trim($aFotoSelect['DEFAULT_LOGO_NAME']); $sWspaceSelect = trim($aFotoSelect['WORKSPACE_LOGO_NAME']); } } if (class_exists('PMPluginRegistry')) { $oPluginRegistry =& PMPluginRegistry::getSingleton(); if (isset($sFotoSelect) && $sFotoSelect != '' && !strcmp($sWspaceSelect, SYS_SYS)) { $sCompanyLogo = $oPluginRegistry->getCompanyLogo($sFotoSelect); $sCompanyLogo = "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/showLogoFile.php?id=" . base64_encode($sCompanyLogo); } else { $sCompanyLogo = $oPluginRegistry->getCompanyLogo('/images/processmaker.logo.jpg'); } } else { $sCompanyLogo = '/images/processmaker.logo.jpg'; } $smarty->assign('logo_company', $sCompanyLogo); $smarty->force_compile = $this->forceTemplateCompile; $smarty->display($this->layoutFile['basename']); } }
function eevalidate() { $fileL = PATH_DATA_SITE . 'license.dat'; $fileS = PATH_DATA . 'license.dat'; if (file_exists($fileL) || file_exists($fileS)) { //Found a License if (class_exists('pmLicenseManager')) { $sSerializedFile = PATH_DATA_SITE . 'lmn.singleton'; $pmLicenseManagerO =& pmLicenseManager::getSingleton(); if (file_exists($sSerializedFile)) { $pmLicenseManagerO->unSerializeInstance(file_get_contents($sSerializedFile)); } } } }
$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"; ///////
/** * 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; }
public function unSerializeInstance($serialized) { if (self::$instance == null) { self::$instance = new PMPluginRegistry(); } $instance = unserialize($serialized); self::$instance = $instance; }
function buildData() { require_once "classes/model/Users.php"; G::LoadClass("serverConfiguration"); G::LoadClass("system"); $oServerConf =& serverConf::getSingleton(); $os = ''; if (file_exists('/etc/redhat-release')) { $fnewsize = filesize('/etc/redhat-release'); $fp = fopen('/etc/redhat-release', 'r'); $os = trim(fread($fp, $fnewsize)); fclose($fp); } $os .= " (" . PHP_OS . ")"; $params = array(); $params['ip'] = getenv('SERVER_ADDR'); $oServerConf->setHeartbeatProperty('HB_BEAT_INDEX', intval($oServerConf->getHeartbeatProperty('HB_BEAT_INDEX', 'HEART_BEAT_CONF')) + 1, 'HEART_BEAT_CONF'); $params['index'] = $oServerConf->getHeartbeatProperty('HB_BEAT_INDEX', 'HEART_BEAT_CONF'); //$this->index; $params['beatType'] = is_null($oServerConf->getHeartbeatProperty('HB_BEAT_TYPE', 'HEART_BEAT_CONF')) ? "starting" : $oServerConf->getHeartbeatProperty('HB_BEAT_TYPE', 'HEART_BEAT_CONF'); //1;//$this->beatType; $params['date'] = date('Y-m-d H:i:s'); $params['host'] = getenv('SERVER_NAME'); $params['os'] = $os; $params['webserver'] = getenv('SERVER_SOFTWARE'); $params['php'] = phpversion(); $params['pmVersion'] = System::getVersion(); if (class_exists('pmLicenseManager')) { $params['pmProduct'] = 'PMEE'; } else { $params['pmProduct'] = 'PMCE'; } $params['logins'] = $oServerConf->logins; $params['workspaces'] = serialize($oServerConf->getWSList()); $params['plugins'] = serialize($oServerConf->getPluginsList()); $params['dbVersion'] = $oServerConf->getDBVersion(); //$params ['errors'] = serialize( $oServerConf->errors ); if ($licInfo = $oServerConf->getProperty('LICENSE_INFO')) { $params['license'] = serialize($licInfo); } /////// $criteria = new Criteria("workflow"); $criteria->addSelectColumn("COUNT(USERS.USR_UID) AS USERS_NUMBER"); $criteria->add(UsersPeer::USR_UID, null, Criteria::ISNOTNULL); $rs = UsersPeer::doSelectRS($criteria); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $row = $rs->getRow(); $params["users"] = $row["USERS_NUMBER"]; /////// $ee = null; if (file_exists(PATH_PLUGINS . "enterprise" . PATH_SEP . "VERSION")) { $ee = trim(file_get_contents(PATH_PLUGINS . "enterprise" . PATH_SEP . "VERSION")); } else { $pluginRegistry =& PMPluginRegistry::getSingleton(); $details = $pluginRegistry->getPluginDetails("enterprise.php"); $ee = !($details == null) ? $details->iVersion : null; } $params["ee"] = $ee; /////// $addonNumber = 0; $addonEnabledNumber = 0; $pluginRegistry =& PMPluginRegistry::getSingleton(); $arrayAddon = array(); if (file_exists(PATH_DATA_SITE . "ee")) { $arrayAddon = unserialize(trim(file_get_contents(PATH_DATA_SITE . "ee"))); $arrayAddon["enterprise"] = array("sFilename" => "enterprise-1.tar"); } foreach ($arrayAddon as $addon) { $sFileName = substr($addon["sFilename"], 0, strpos($addon["sFilename"], "-")); if (file_exists(PATH_PLUGINS . $sFileName . ".php")) { $addonDetails = $pluginRegistry->getPluginDetails($sFileName . ".php"); $enabled = 0; if ($addonDetails) { $enabled = $addonDetails->enabled ? 1 : 0; } if ($enabled == 1) { $addonEnabledNumber = $addonEnabledNumber + 1; } $addonNumber = $addonNumber + 1; } } $params["addonNumber"] = $addonNumber; $params["addonEnabledNumber"] = $addonEnabledNumber; /////// $licenseID = null; $licenseType = null; $licenseDomainWorkspace = null; $licenseNumber = 0; if (file_exists(PATH_PLUGINS . "enterprise" . PATH_SEP . "class.pmLicenseManager.php")) { $licenseManager =& pmLicenseManager::getSingleton(); preg_match("/^license_(.*).dat\$/", $licenseManager->file, $matches); $licenseID = $matches[1]; $licenseType = $licenseManager->type; $licenseDomainWorkspace = $licenseManager->info["DOMAIN_WORKSPACE"]; /////// $criteria = new Criteria("workflow"); $criteria->addSelectColumn("COUNT(LICENSE_MANAGER.LICENSE_UID) AS LICENSE_NUMBER"); $criteria->add(LicenseManagerPeer::LICENSE_UID, null, Criteria::ISNOTNULL); $rs = LicenseManagerPeer::doSelectRS($criteria); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $row = $rs->getRow(); /////// $licenseNumber = $row["LICENSE_NUMBER"] > 0 ? $row["LICENSE_NUMBER"] : count(glob(PATH_DATA_SITE . "licenses" . PATH_SEP . "*.dat")); } $params["licenseID"] = $licenseID; $params["licenseType"] = $licenseType; $params["licenseDomainWorkspace"] = $licenseDomainWorkspace; $params["licenseNumber"] = $licenseNumber; /////// return $params; }
public function logout($oauthAccessTokenId, $refresh) { $aFields = array(); if (!isset($_GET['u'])) { $aFields['URL'] = ''; } else { $aFields['URL'] = htmlspecialchars(addslashes(stripslashes(strip_tags(trim(urldecode($_GET['u'])))))); } if (!isset($_SESSION['G_MESSAGE'])) { $_SESSION['G_MESSAGE'] = ''; } if (!isset($_SESSION['G_MESSAGE_TYPE'])) { $_SESSION['G_MESSAGE_TYPE'] = ''; } $msg = $_SESSION['G_MESSAGE']; $msgType = $_SESSION['G_MESSAGE_TYPE']; if (!isset($_SESSION['FAILED_LOGINS'])) { $_SESSION['FAILED_LOGINS'] = 0; $_SESSION["USERNAME_PREVIOUS1"] = ""; $_SESSION["USERNAME_PREVIOUS2"] = ""; } $sFailedLogins = $_SESSION['FAILED_LOGINS']; $usernamePrevious1 = $_SESSION["USERNAME_PREVIOUS1"]; $usernamePrevious2 = $_SESSION["USERNAME_PREVIOUS2"]; $aFields['LOGIN_VERIFY_MSG'] = G::loadTranslation('LOGIN_VERIFY_MSG'); //start new session @session_destroy(); session_start(); session_regenerate_id(); setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . SYS_SYS, null, false, true); if (strlen($msg) > 0) { $_SESSION['G_MESSAGE'] = $msg; } if (strlen($msgType) > 0) { $_SESSION['G_MESSAGE_TYPE'] = $msgType; } $_SESSION['FAILED_LOGINS'] = $sFailedLogins; $_SESSION["USERNAME_PREVIOUS1"] = $usernamePrevious1; $_SESSION["USERNAME_PREVIOUS2"] = $usernamePrevious2; /*----------------------------------********---------------------------------*/ if (!class_exists('pmLicenseManager')) { G::LoadClass('pmLicenseManager'); } $licenseManager =& \pmLicenseManager::getSingleton(); if (in_array(md5($licenseManager->result), array('38afd7ae34bd5e3e6fc170d8b09178a3', 'ba2b45bdc11e2a4a6e86aab2ac693cbb'))) { $G_PUBLISH = new \Publisher(); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/licenseExpired', '', array(), 'licenseUpdate'); G::RenderPage('publish'); die(); } /*----------------------------------********---------------------------------*/ try { $oatoken = new \OauthAccessTokens(); $result = $oatoken->remove($oauthAccessTokenId); $response["status"] = "OK"; } catch (Exception $e) { $response["status"] = "ERROR"; $response["message"] = $e->getMessage(); } return $response; }
public function enable() { $this->setConfiguration(); require_once PATH_CORE . 'classes/model/AddonsStore.php'; AddonsStore::checkLicenseStore(); $licenseManager =& pmLicenseManager::getSingleton(); AddonsStore::updateAll(false); }
public function generateInfoSupport() { require_once PATH_CONTROLLERS . "installer.php"; $params = array(); $oServerConf =& serverConf::getSingleton(); $pluginRegistry =& PMPluginRegistry::getSingleton(); $licenseManager =& pmLicenseManager::getSingleton(); //License Information: $activeLicense = $licenseManager->getActiveLicense(); $licenseInfo = array(); $noInclude = array('licensedfeaturesList', 'result', 'serial'); foreach ($licenseManager as $index => $value) { if (!in_array($index, $noInclude)) { $licenseInfo[$index] = G::sanitizeInput($value); } } $params['l'] = $licenseInfo; //Operative System version (Linux, Windows) try { $os = ''; if (file_exists('/etc/redhat-release')) { $fnewsize = filesize('/etc/redhat-release'); $fp = fopen('/etc/redhat-release', 'r'); $os = trim(fread($fp, $fnewsize)); fclose($fp); } $os .= " (" . PHP_OS . ")"; } catch (Exception $e) { } $params['s'] = $os; //On premise or cloud $licInfo = $oServerConf->getProperty('LICENSE_INFO'); $params['lt'] = isset($licInfo[SYS_SYS]) ? isset($licInfo[SYS_SYS]['TYPE']) ? $licInfo[SYS_SYS]['TYPE'] : '' : ''; //ProcessMaker Version $params['v'] = System::getVersion(); if (file_exists(PATH_DATA . 'log/upgrades.log')) { $params['pmu'] = serialize(file_get_contents(PATH_DATA . 'log/upgrades.log', 'r')); } else { $params['pmu'] = serialize(G::LoadTranslation('ID_UPGRADE_NEVER_UPGRADE')); } //Database server Version (MySQL version) $installer = new Installer(); $systemInfo = $installer->getSystemInfo(); try { $params['mysql'] = mysql_get_server_info(); } catch (Exception $e) { $params['mysql'] = ''; } //PHP Version $params['php'] = $systemInfo->php->version; //Apache - IIS Version try { $params['apache'] = apache_get_version(); } catch (Exception $e) { $params['apache'] = ''; } //Installed Plugins (license info?) $arrayAddon = array(); if (file_exists(PATH_DATA_SITE . "ee")) { $arrayAddon = unserialize(trim(file_get_contents(PATH_DATA_SITE . "ee"))); } $plugins = array(); foreach ($arrayAddon as $addon) { $sFileName = substr($addon["sFilename"], 0, strpos($addon["sFilename"], "-")); if (file_exists(PATH_PLUGINS . $sFileName . ".php")) { $plugin = array(); $addonDetails = $pluginRegistry->getPluginDetails($sFileName . ".php"); $plugin['name'] = $addonDetails->sNamespace; $plugin['description'] = $addonDetails->sDescription; $plugin['version'] = $addonDetails->iVersion; $plugin['enable'] = $addonDetails->enabled; $plugins[] = $plugin; } } $params['pl'] = $plugins; //Number of Users registered in PM. Including LDAP users and PM users. require_once "classes/model/RbacUsers.php"; $criteria = new Criteria("rbac"); $criteria->addSelectColumn(RbacUsersPeer::USR_AUTH_TYPE); $criteria->addSelectColumn("COUNT(" . RbacUsersPeer::USR_UID . ") AS USERS_NUMBER"); $criteria->add(RbacUsersPeer::USR_UID, null, Criteria::ISNOTNULL); $criteria->addGroupByColumn(RbacUsersPeer::USR_AUTH_TYPE); $rs = RbacUsersPeer::doSelectRS($criteria); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $users = array('local' => 0); while ($rs->next()) { $row = $rs->getRow(); if ($row['USR_AUTH_TYPE'] == '' || $row['USR_AUTH_TYPE'] == 'MYSQL') { $users['local'] = (int) $users['local'] + (int) $row['USERS_NUMBER']; } else { $users['USR_AUTH_TYPE'] = $row['USERS_NUMBER']; } } $params['u'] = $users; //Number of cases. $oSequences = new Sequences(); $maxNumber = $oSequences->getSequeceNumber("APP_NUMBER"); $params['c'] = $maxNumber - 1; //Number of active processes. $criteria = new Criteria("workflow"); $criteria->addSelectColumn(ProcessPeer::PRO_STATUS); $criteria->addSelectColumn("COUNT(PROCESS.PRO_UID) AS NUMBER_PROCESS"); $criteria->addGroupByColumn(ProcessPeer::PRO_STATUS); $rs = UsersPeer::doSelectRS($criteria); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $process = array(); while ($rs->next()) { $row = $rs->getRow(); $process[$row['PRO_STATUS']] = $row['NUMBER_PROCESS']; } $params['p'] = $process; //Country/city (Timezone) $params['t'] = defined('TIME_ZONE') && TIME_ZONE != "Unknown" ? TIME_ZONE : date_default_timezone_get(); $params['w'] = count(System::listWorkspaces()); $support = PATH_DATA_SITE . G::sanitizeString($licenseManager->info['FIRST_NAME'] . '-' . $licenseManager->info['LAST_NAME'] . '-' . SYS_SYS . '-' . date('YmdHis'), false, false) . '.spm'; file_put_contents($support, serialize($params)); G::streamFile($support, true); G::rm_dir($support); }
/** * Download this addon from the download url. * * @return bool true on success, false otherwise. */ public function download() { require_once PATH_CORE . 'classes' . PATH_SEP . 'class.pmLicenseManager.php'; $this->setState("download"); /////// $aux = explode("?", $this->getAddonDownloadUrl()); $url = $aux[0]; $var = explode("&", $aux[1]); /////// $boundary = "---------------------" . substr(G::encryptOld(rand(0, 32000)), 0, 10); $data = null; for ($i = 0; $i <= count($var) - 1; $i++) { $aux = explode("=", $var[$i]); $data = $data . "--{$boundary}\n"; $data = $data . "Content-Disposition: form-data; name=\"" . $aux[0] . "\"\n\n" . $aux[1] . "\n"; } if (count($var) > 0) { $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-Type: image/jpeg\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); /////// $handle = fopen($url, "rb", false, $context); if ($handle === false) { throw new Exception("Could not open download url."); } $this->setAddonDownloadFilename(null); //Try to get the download size and filename (ok if it fails) $meta = stream_get_meta_data($handle); $totalSize = 0; if ($meta["wrapper_type"] == "http") { foreach ($meta["wrapper_data"] as $info) { $info = explode(":", $info); if (strcasecmp(trim($info[0]), "Content-Length") == 0) { $totalSize = intval(trim($info[1])); } if (strcasecmp(trim($info[0]), "Content-Disposition") == 0) { foreach (explode(";", $info[1]) as $params) { $params = explode("=", $params); if (count($params) <= 1) { continue; } if (strcasecmp(trim($params[0]), "filename") == 0) { $this->setAddonDownloadFilename(trim($params[1], "\" ")); } } } } } //Save the filename $this->save(); $units = array(" B", " KB", " MB", " GB", " TB"); //if ($totalSize) { // $bytes = $totalSize; // for ($i = 0; $bytes >= 1024 && $i < 4; $i++) $bytes /= 1024; // printf("Download size: %.2f%s\n", round($bytes, 2), $units[$i]); //} $downloadFile = $this->getDownloadFilename(); $file = @fopen($downloadFile, "wb"); if ($file === false) { throw new Exception("Could not open destination file."); } $start = microtime(true); while (!feof($handle)) { $this->refresh(); /* Check if download was cancelled from the ui */ if ($this->getAddonState() == "cancel" || $this->getAddonState() == "") { $this->setState(); break; } /* Update the database information to show we are still alive */ $this->setState("download"); $data = fread($handle, BUFSIZE); //TODO: We should use these values for something $elapsed = microtime(true) - $start; $position = ftell($handle); $rate = $position / $elapsed; if ($totalSize) { $progress = 100 * ($position / $totalSize); $this->setAddonDownloadProgress($progress); $this->save(); } /* Just to be safe, check all error conditions */ if ($data === "" or $data === false) { break; } if (fwrite($file, $data) === false) { break; } } fclose($handle); fclose($file); if ($elapsed > 60) { $time = sprintf("%.0f minutes and %.0f seconds", round($elapsed / 60), round($elapsed) % 60); } else { $time = sprintf("%.0f seconds", round($elapsed)); } for ($i = 0; $position >= 1024 && $i < 4; $i++) { $position /= 1024; } for ($j = 0; $rate >= 1024 && $j < 4; $j++) { $rate /= 1024; } //printf("Downloaded %.2f%s in %s (rate: %.2f%s/s)\n", $position, $units[$i], $time, $rate, $units[$j]); return $this->checkDownload(); }