function getWorkspacesAvailable() { G::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); $dir = PATH_DB; $filesArray = array(); if (file_exists($dir)) { if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (file_exists(PATH_DB . $file . '/db.php')) { if (!$oServerConf->isWSDisabled($file)) { $filesArray[] = $file; } } } } closedir($handle); } } sort($filesArray, SORT_STRING); return $filesArray; }
/** */ public static function auditLog($actionToLog, $valueToLog = "") { $workspace = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined'; $oServerConf =& serverConf::getSingleton(); $sflagAudit = $oServerConf->getAuditLogProperty('AL_OPTION', $workspace); $ipClient = G::getIpAddress(); /*----------------------------------********---------------------------------*/ $licensedFeatures = PMLicensedFeatures::getSingleton(); if ($sflagAudit && $licensedFeatures->verifyfeature('vtSeHNhT0JnSmo1bTluUVlTYUxUbUFSVStEeXVqc1pEUG5EeXc0MGd2Q3ErYz0=')) { $username = isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '' ? $_SESSION['USER_LOGGED'] : 'Unknow User'; $fullname = isset($_SESSION['USR_FULLNAME']) && $_SESSION['USR_FULLNAME'] != '' ? $_SESSION['USR_FULLNAME'] : '-'; G::log("|" . $workspace . "|" . $ipClient . "|" . $username . "|" . $fullname . "|" . $actionToLog . "|" . $valueToLog, PATH_DATA, "audit.log"); } /*----------------------------------********---------------------------------*/ }
}else{ $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/login', '', $aFields, SYS_URI . 'login/authentication.php'); } G::LoadClass('serverConfiguration'); //Bootstrap::LoadClass('serverConfiguration'); //get the serverconf singleton, and check if we can send the heartbeat $oServerConf = & serverConf::getSingleton(); $partnerFlag = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : false; if (!$partnerFlag) { $sflag = $oServerConf->getHeartbeatProperty('HB_OPTION', 'HEART_BEAT_CONF'); $sflag = (trim($sflag) != '') ? $sflag : '1'; //get date of next beat $nextBeatDate = $oServerConf->getHeartbeatProperty('HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF');
public function generateTcpdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $aProperties = array()) { require_once PATH_THIRDPARTY . "tcpdf" . PATH_SEP . "config" . PATH_SEP . "lang" . PATH_SEP . "eng.php"; require_once PATH_THIRDPARTY . "tcpdf" . PATH_SEP . "tcpdf.php"; $nrt = array("\n", "\r", "\t"); $nrthtml = array("(n /)", "(r /)", "(t /)"); $strContentAux = str_replace($nrt, $nrthtml, $sContent); $sContent = null; while (preg_match("/^(.*)<font([^>]*)>(.*)\$/i", $strContentAux, $arrayMatch)) { $str = trim($arrayMatch[2]); $strAttribute = null; if (!empty($str)) { $strAux = $str; $str = null; while (preg_match("/^(.*)([\"'].*[\"'])(.*)\$/", $strAux, $arrayMatch2)) { $strAux = $arrayMatch2[1]; $str = str_replace(" ", "__SPACE__", $arrayMatch2[2]) . $arrayMatch2[3] . $str; } $str = $strAux . $str; //Get attributes $strStyle = null; $array = explode(" ", $str); foreach ($array as $value) { $arrayAux = explode("=", $value); if (isset($arrayAux[1])) { $a = trim($arrayAux[0]); $v = trim(str_replace(array("__SPACE__", "\"", "'"), array(" ", null, null), $arrayAux[1])); switch (strtolower($a)) { case "color": $strStyle = $strStyle . "color: {$v};"; break; case "face": $strStyle = $strStyle . "font-family: {$v};"; break; case "size": $arrayPt = array(0, 8, 10, 12, 14, 18, 24, 36); $strStyle = $strStyle . "font-size: " . $arrayPt[intval($v)] . "pt;"; break; case "style": $strStyle = $strStyle . "{$v};"; break; default: $strAttribute = $strAttribute . " {$a}=\"{$v}\""; break; } } } if ($strStyle != null) { $strAttribute = $strAttribute . " style=\"{$strStyle}\""; } } $strContentAux = $arrayMatch[1]; $sContent = "<span" . $strAttribute . ">" . $arrayMatch[3] . $sContent; } $sContent = $strContentAux . $sContent; $sContent = str_ireplace("</font>", "</span>", $sContent); $sContent = str_replace($nrthtml, $nrt, $sContent); // define Save file $sOutput = 2; $sOrientation = $sLandscape == false ? PDF_PAGE_ORIENTATION : 'L'; $sMedia = isset($aProperties['media']) ? $aProperties['media'] : PDF_PAGE_FORMAT; $sLang = defined('SYS_LANG') ? SYS_LANG : 'en'; // create new PDF document $pdf = new TCPDF($sOrientation, PDF_UNIT, $sMedia, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor($aFields['USR_USERNAME']); $pdf->SetTitle('Processmaker'); $pdf->SetSubject($sFilename); $pdf->SetCompression(true); $margins = $aProperties['margins']; $margins["left"] = $margins["left"] >= 0 ? $margins["left"] : PDF_MARGIN_LEFT; $margins["top"] = $margins["top"] >= 0 ? $margins["top"] : PDF_MARGIN_TOP; $margins["right"] = $margins["right"] >= 0 ? $margins["right"] : PDF_MARGIN_RIGHT; $margins["bottom"] = $margins["bottom"] >= 0 ? $margins["bottom"] : PDF_MARGIN_BOTTOM; $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetLeftMargin($margins['left']); $pdf->SetTopMargin($margins['top']); $pdf->SetRightMargin($margins['right']); $pdf->SetAutoPageBreak(true, $margins['bottom']); $oServerConf =& serverConf::getSingleton(); // set some language dependent data: $lg = array(); $lg['a_meta_charset'] = 'UTF-8'; $lg['a_meta_dir'] = $oServerConf->isRtl($sLang) ? 'rtl' : 'ltr'; $lg['a_meta_language'] = $sLang; $lg['w_page'] = 'page'; //set some language-dependent strings $pdf->setLanguageArray($lg); if (isset($aProperties['pdfSecurity'])) { $pdfSecurity = $aProperties['pdfSecurity']; $userPass = G::decrypt($pdfSecurity['openPassword'], $sUID); $ownerPass = $pdfSecurity['ownerPassword'] != '' ? G::decrypt($pdfSecurity['ownerPassword'], $sUID) : null; $permissions = explode("|", $pdfSecurity['permissions']); $pdf->SetProtection($permissions, $userPass, $ownerPass); } // --------------------------------------------------------- // set default font subsetting mode $pdf->setFontSubsetting(true); // Set font // dejavusans is a UTF-8 Unicode font, if you only need to // print standard ASCII chars, you can use core fonts like // helvetica or times to reduce file size. //$pdf->SetFont('dejavusans', '', 14, '', true); // Detect chinese, japanese, thai if (preg_match('/[\\x{30FF}\\x{3040}-\\x{309F}\\x{4E00}-\\x{9FFF}\\x{0E00}-\\x{0E7F}]/u', $sContent, $matches)) { $pdf->SetFont('kozminproregular'); } // Add a page // This method has several options, check the source code documentation for more information. $pdf->AddPage(); // set text shadow effect //$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal')); // Print text using writeHTMLCell() // $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true); if (mb_detect_encoding($sContent) == 'UTF-8') { $sContent = mb_convert_encoding($sContent, 'HTML-ENTITIES', 'UTF-8'); } $doc = new DOMDocument('1.0', 'UTF-8'); $doc->loadHtml($sContent); $pdf->writeHTML($doc->saveXML(), false, false, false, false, ''); // --------------------------------------------------------- // Close and output PDF document // This method has several options, check the source code documentation for more information. //$pdf->Output('example_00.pdf', 'I'); //$pdf->Output('/home/hector/processmaker/example_00.pdf', 'D'); switch ($sOutput) { case 0: // Vrew browser $pdf->Output($sPath . $sFilename . '.pdf', 'I'); break; case 1: // Donwnload $pdf->Output($sPath . $sFilename . '.pdf', 'D'); break; case 2: // Save file $pdf->Output($sPath . $sFilename . '.pdf', 'F'); break; } }
/** * get setup Plugins * * @param unknown_type $default * @return void */ public function setupPlugins () { try { require_once(PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP . "enterprise.php"); require_once("class.serverConfiguration.php"); $iPlugins = 0; $oServerConf = & serverConf::getSingleton(); $oServerConf->addPlugin( SYS_SYS, $this->_aPluginDetails ); foreach ($this->_aPluginDetails as $namespace => $detail) { if (isset( $detail->enabled ) && $detail->enabled) { if (! empty( $detail->sFilename ) && file_exists( $detail->sFilename )) { $arrayFileInfo = pathinfo($detail->sFilename); $sFilename = (($detail->sNamespace == "enterprise")? PATH_CORE. "methods" . PATH_SEP . "enterprise" . PATH_SEP : PATH_PLUGINS) . $arrayFileInfo["basename"]; if (! file_exists( $sFilename )) { continue; } require_once $sFilename; if (class_exists( $detail->sClassName )) { $oPlugin = new $detail->sClassName( $detail->sNamespace, $detail->sFilename ); $this->_aPlugins[$detail->sNamespace] = $oPlugin; $iPlugins ++; $oPlugin->setup(); } } } } $this->eevalidate(); return $iPlugins; } catch (Exception $e) { global $G_PUBLISH; $aMessage['MESSAGE'] = $e->getMessage(); $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); G::RenderPage( 'publish' ); die(); } }
/** * streaming a big JS file with small js files * * @author Fernando Ontiveros Lira <*****@*****.**> * @access public * @param string $file * @return string */ public function streamCSSBigFile($filename) { header('Content-Type: text/css'); //First get Skin info $filenameParts = explode("-", $filename); $skinName = $filenameParts[0]; $skinVariant = "skin"; if (isset($filenameParts[1])) { $skinVariant = strtolower($filenameParts[1]); } $configurationFile = ''; if ($skinName == "jscolors") { $skinName = "classic"; } if ($skinName == "xmlcolors") { $skinName = "classic"; } if ($skinName == "classic") { $configurationFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'config.xml'; } else { $configurationFile = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml'; if (!is_file($configurationFile)) { $configurationFile = G::ExpandPath("skinEngine") . $skinName . PATH_SEP . 'config.xml'; } } //Read Configuration File $xmlConfiguration = file_get_contents($configurationFile); $xmlConfigurationObj = G::xmlParser($xmlConfiguration); $baseSkinDirectory = dirname($configurationFile); $directorySize = G::getDirectorySize($baseSkinDirectory); $mtime = $directorySize['maxmtime']; $outputHeader = "/* Autogenerated CSS file by gulliver framework \n"; $outputHeader .= " Skin: {$filename}\n"; $outputHeader .= " Configuration: {$configurationFile}\n"; $mtimeNow = date('U'); $gmt_mtimeNow = gmdate("D, d M Y H:i:s", $mtimeNow) . " GMT"; $outputHeader .= " Date: {$gmt_mtimeNow}*/\n"; $output = ""; //Base files switch (strtolower($skinVariant)) { case "extjs": //Base $baseCSSPath = PATH_SKIN_ENGINE . "base" . PATH_SEP . "baseCss" . PATH_SEP; $output .= file_get_contents($baseCSSPath . 'ext-all-notheme.css'); //Classic Skin $extJsSkin = 'xtheme-gray'; break; default: break; } //Get Browser Info $infoBrowser = G::browser_detection('full_assoc'); $browserName = $infoBrowser['browser_working']; if (isset($infoBrowser[$browserName . '_data'])) { if ($infoBrowser[$browserName . '_data'][0] != "") { $browserName = $infoBrowser[$browserName . '_data'][0]; } } //Read Configuration File $xmlConfiguration = file_get_contents($configurationFile); $xmlConfigurationObj = G::xmlParser($xmlConfiguration); $skinFilesArray = $xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['cssFiles']['__CONTENT__'][$skinVariant]['__CONTENT__']['cssFile']; foreach ($skinFilesArray as $keyFile => $cssFileInfo) { $enabledBrowsers = explode(",", $cssFileInfo['__ATTRIBUTES__']['enabledBrowsers']); $disabledBrowsers = explode(",", $cssFileInfo['__ATTRIBUTES__']['disabledBrowsers']); if ((in_array($browserName, $enabledBrowsers) || in_array('ALL', $enabledBrowsers)) && !in_array($browserName, $disabledBrowsers)) { if ($cssFileInfo['__ATTRIBUTES__']['file'] == 'rtl.css') { G::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); if (!defined('SYS_LANG')) { if (isset($_SERVER['HTTP_REFERER'])) { $syss = explode('://', $_SERVER['HTTP_REFERER']); $sysObjets = explode('/', $syss['1']); $sysLang = $sysObjets['2']; } else { $sysLang = 'en'; } } else { $sysLang = SYS_LANG; } if ($oServerConf->isRtl($sysLang)) { $output .= file_get_contents($baseSkinDirectory . PATH_SEP . 'css' . PATH_SEP . $cssFileInfo['__ATTRIBUTES__']['file']); } } else { $output .= file_get_contents($baseSkinDirectory . PATH_SEP . 'css' . PATH_SEP . $cssFileInfo['__ATTRIBUTES__']['file']); } } } //Remove comments.. $regex = array("`^([\t\\s]+)`ism" => '', "`^\\/\\*(.+?)\\*\\/`ism" => "", "`([\n\\A;]+)\\/\\*(.+?)\\*\\/`ism" => "\$1", "`([\n\\A;\\s]+)//(.+?)[\n\r]`ism" => "\$1\n", "`(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+`ism" => "\n"); $output = preg_replace(array_keys($regex), $regex, $output); $output = $outputHeader . $output; return $output; }
/** * streaming a big JS file with small js files * * @author Fernando Ontiveros Lira <*****@*****.**> * @access public * @param string $file * @return string */ public function streamCSSBigFile($filename) { header('Content-Type: text/css'); //First get Skin info $filenameParts = explode("-", $filename); $skinName = $filenameParts[0]; $skinVariant = "skin"; if (isset($filenameParts[1])) { $skinVariant = strtolower($filenameParts[1]); } $configurationFile = ''; if ($skinName == "jscolors") { $skinName = "classic"; } if ($skinName == "xmlcolors") { $skinName = "classic"; } if ($skinName == "classic") { $configurationFile = Bootstrap::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'config.xml'; } else { $configurationFile = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml'; if (!is_file($configurationFile)) { $configurationFile = Bootstrap::ExpandPath("skinEngine") . $skinName . PATH_SEP . 'config.xml'; } } $mtime = date('U'); $gmt_mtime = gmdate("D, d M Y H:i:s", $mtime) . " GMT"; header('Pragma: cache'); header('ETag: "' . md5($mtime . $filename) . '"'); header("Last-Modified: " . $gmt_mtime); header('Cache-Control: public'); header("Expires: " . gmdate("D, d M Y H:i:s", time() + 30 * 60 * 60 * 24) . " GMT"); //1 month //header("Expires: " . gmdate("D, d M Y H:i:s", time () + 60*60*24 ) . " GMT"); //1 day - tempor if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $gmt_mtime) { header('HTTP/1.1 304 Not Modified'); exit; } } if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) { if (str_replace('"', '', stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])) == md5($mtime . $filename)) { header("HTTP/1.1 304 Not Modified"); exit; } } //Read Configuration File $xmlConfiguration = file_get_contents($configurationFile); $xmlConfigurationObj = Bootstrap::xmlParser($xmlConfiguration); $baseSkinDirectory = dirname($configurationFile); $directorySize = Bootstrap::getDirectorySize($baseSkinDirectory); $mtime = $directorySize['maxmtime']; //if userAgent (BROWSER) is MSIE we need special headers to avoid MSIE behaivor. //$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']); $outputHeader = "/* Autogenerated CSS file by gulliver framework \n"; $outputHeader .= " Skin: {$filename}\n"; $outputHeader .= " Configuration: {$configurationFile}\n"; $mtimeNow = date('U'); $gmt_mtimeNow = gmdate("D, d M Y H:i:s", $mtimeNow) . " GMT"; $outputHeader .= " Date: {$gmt_mtimeNow}*/\n"; $output = ""; //Base files switch (strtolower($skinVariant)) { case "extjs": //Base $baseCSSPath = PATH_SKIN_ENGINE . "base" . PATH_SEP . "baseCss" . PATH_SEP; $output .= file_get_contents($baseCSSPath . 'ext-all-notheme.css'); //$output .= file_get_contents ( $publicExtPath . 'ext-all.css' ); //Classic Skin $extJsSkin = 'xtheme-gray'; break; default: break; } //Get Browser Info $infoBrowser = Bootstrap::get_current_browser(); $browserName = $infoBrowser['browser_working']; if (isset($infoBrowser[$browserName . '_data'])) { if ($infoBrowser[$browserName . '_data'][0] != "") { $browserName = $infoBrowser[$browserName . '_data'][0]; } } //Read Configuration File $xmlConfiguration = file_get_contents($configurationFile); $xmlConfigurationObj = Bootstrap::xmlParser($xmlConfiguration); $skinFilesArray = $xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['cssFiles']['__CONTENT__'][$skinVariant]['__CONTENT__']['cssFile']; foreach ($skinFilesArray as $keyFile => $cssFileInfo) { $enabledBrowsers = explode(",", $cssFileInfo['__ATTRIBUTES__']['enabledBrowsers']); $disabledBrowsers = explode(",", $cssFileInfo['__ATTRIBUTES__']['disabledBrowsers']); if ((in_array($browserName, $enabledBrowsers) || in_array('ALL', $enabledBrowsers)) && !in_array($browserName, $disabledBrowsers)) { if ($cssFileInfo['__ATTRIBUTES__']['file'] == 'rtl.css') { Bootstrap::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); if (!defined('SYS_LANG')) { if (isset($_SERVER['HTTP_REFERER'])) { $syss = explode('://', $_SERVER['HTTP_REFERER']); $sysObjets = explode('/', $syss['1']); $sysLang = $sysObjets['2']; } else { $sysLang = 'en'; } } else { $sysLang = SYS_LANG; } if ($oServerConf->isRtl($sysLang)) { $output .= file_get_contents($baseSkinDirectory . PATH_SEP . 'css' . PATH_SEP . $cssFileInfo['__ATTRIBUTES__']['file']); } } else { $output .= file_get_contents($baseSkinDirectory . PATH_SEP . 'css' . PATH_SEP . $cssFileInfo['__ATTRIBUTES__']['file']); } } } //Remove comments.. $regex = array("`^([\t\\s]+)`ism" => '', "`^\\/\\*(.+?)\\*\\/`ism" => "", "`([\n\\A;]+)\\/\\*(.+?)\\*\\/`ism" => "\$1", "`([\n\\A;\\s]+)//(.+?)[\n\r]`ism" => "\$1\n", "`(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+`ism" => "\n"); $output = preg_replace(array_keys($regex), $regex, $output); $output = $outputHeader . $output; return $output; }
public function generateTcpdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $aProperties = array()) { require_once PATH_THIRDPARTY . 'tcpdf/config/lang/eng.php'; require_once PATH_THIRDPARTY . 'tcpdf/tcpdf.php'; // define Save file $sOutput = 2; $sOrientation = $sLandscape == false ? PDF_PAGE_ORIENTATION : 'L'; $sMedia = isset($aProperties['media']) ? $aProperties['media'] : PDF_PAGE_FORMAT; $sLang = defined('SYS_LANG') ? SYS_LANG : 'en'; // create new PDF document $pdf = new TCPDF($sOrientation, PDF_UNIT, $sMedia, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor($aFields['USR_USERNAME']); $pdf->SetTitle('Processmaker'); $pdf->SetSubject($sFilename); $margins = $aProperties['margins']; $margins['left'] = $margins['left'] > 0 ? $margins['left'] : PDF_MARGIN_LEFT; $margins['top'] = $margins['top'] > 0 ? $margins['top'] : PDF_MARGIN_TOP; $margins['right'] = $margins['right'] > 0 ? $margins['right'] : PDF_MARGIN_RIGHT; $margins['bottom'] = $margins['bottom'] > 0 ? $margins['bottom'] : PDF_MARGIN_BOTTOM; $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetLeftMargin($margins['left']); $pdf->SetTopMargin($margins['top']); $pdf->SetRightMargin($margins['right']); $pdf->SetAutoPageBreak(true, $margins['bottom']); $oServerConf =& serverConf::getSingleton(); // set some language dependent data: $lg = array(); $lg['a_meta_charset'] = 'UTF-8'; $lg['a_meta_dir'] = $oServerConf->isRtl($sLang) ? 'rtl' : 'ltr'; $lg['a_meta_language'] = $sLang; $lg['w_page'] = 'page'; //set some language-dependent strings $pdf->setLanguageArray($lg); if (isset($aProperties['pdfSecurity'])) { $pdfSecurity = $aProperties['pdfSecurity']; $userPass = G::decrypt($pdfSecurity['openPassword'], $sUID); $ownerPass = $pdfSecurity['ownerPassword'] != '' ? G::decrypt($pdfSecurity['ownerPassword'], $sUID) : null; $permissions = explode("|", $pdfSecurity['permissions']); $pdf->SetProtection($permissions, $userPass, $ownerPass); } // --------------------------------------------------------- // set default font subsetting mode $pdf->setFontSubsetting(true); // Set font // dejavusans is a UTF-8 Unicode font, if you only need to // print standard ASCII chars, you can use core fonts like // helvetica or times to reduce file size. $pdf->SetFont('dejavusans', '', 14, '', true); // Add a page // This method has several options, check the source code documentation for more information. $pdf->AddPage(); // set text shadow effect //$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal')); // Print text using writeHTMLCell() // $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true); $pdf->writeHTML($sContent); // --------------------------------------------------------- // Close and output PDF document // This method has several options, check the source code documentation for more information. //$pdf->Output('example_00.pdf', 'I'); //$pdf->Output('/home/hector/processmaker/example_00.pdf', 'D'); switch ($sOutput) { case 0: // Vrew browser $pdf->Output($sPath . $sFilename . '.pdf', 'I'); break; case 1: // Donwnload $pdf->Output($sPath . $sFilename . '.pdf', 'D'); break; case 2: // Save file $pdf->Output($sPath . $sFilename . '.pdf', 'F'); break; } }
/** * attachEvents method returns some javascript code in order to initialize * the Dynaform Field configuration, attributes, and additional stuff. * * @author * @access public * @param string $element * @return string * */ public function attachEvents($element) { $editorDefinition = 'tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; '; $editorDefinition .= 'var domainURL = "/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/"'; $serverConf =& serverConf::getSingleton(); switch ($this->editorType) { case 'EMAIL_TEMPLATE': $editorDefinition .= ' // is necessary the process uid variable in order to load the picker correctly var actualCaretPositionBookmark; var formProcessID = document.getElementById("form[pro_uid]").value; tinyMCE.init({ theme: "advanced", plugins: "advhr,advimage,advlink,advlist,autolink,autoresize,contextmenu,directionality,emotions,example,example_dependency,fullpage,fullscreen,iespell,inlinepopups,insertdatetime,layer,legacyoutput,lists,media,nonbreaking,noneditable,pagebreak,paste,preview,print,save,searchreplace,style,tabfocus,table,template,visualblocks,visualchars,wordcount,xhtmlxtras,pmSimpleUploader,pmVariablePicker,pmGrids,style", mode: "specific_textareas", editor_selector: "tmceEditor", width: "770", height: "' . $this->height . '", directionality: "' . ($serverConf->isRtl(SYS_LANG) ? 'rtl' : 'ltr') . '", verify_html: false, theme_advanced_buttons1: "pmSimpleUploader,|,pmVariablePicker,|,pmGrids,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,|,cut,copy,paste,|,bullist,numlist,|,outdent,indent,blockquote", theme_advanced_buttons2: "tablecontrols,|,undo,redo,|,link,unlink,image,|,forecolor,backcolor,styleprops,|,hr,removeformat,visualaid,|,sub,sup,|,ltr,rtl,|,code", popup_css : "/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialog.css", skin : "o2k7", skin_variant : "silver", oninit: function (){ tinyMCE.activeEditor.processID = formProcessID; tinyMCE.activeEditor.domainURL = domainURL; }, onchange_callback: function(inst) { if(inst.isDirty()) { inst.save(); } return true; }, handle_event_callback : function(e) { if(this.isDirty()) { this.save(); } return true; } }); '; break; case 'OUTPUT_DOCUMENT': $editorDefinition .= ' // is necessary the process uid variable in order to load the picker correctly var formProcessID = document.getElementById("form[PRO_UID]").value; tinyMCE.init({ theme: "advanced", plugins: "advhr,advimage,advlink,advlist,autolink,autoresize,contextmenu,directionality,emotions,example,example_dependency,fullpage,fullscreen,iespell,inlinepopups,insertdatetime,layer,legacyoutput,lists,media,nonbreaking,noneditable,pagebreak,paste,preview,print,save,searchreplace,style,tabfocus,table,template,visualblocks,visualchars,wordcount,xhtmlxtras,pmSimpleUploader,pmVariablePicker,pmGrids,style", mode: "specific_textareas", editor_selector: "tmceEditor", width: "770", height: "305", directionality: "' . ($serverConf->isRtl(SYS_LANG) ? 'rtl' : 'ltr') . '", verify_html: false, theme_advanced_buttons1: "pmSimpleUploader,|,pmVariablePicker,|,pmGrids,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,|,cut,copy,paste,|,bullist,numlist,|,outdent,indent,blockquote", theme_advanced_buttons2: "tablecontrols,|,undo,redo,|,link,unlink,image,|,forecolor,backcolor,styleprops,|,hr,removeformat,visualaid,|,sub,sup,|,ltr,rtl,|,code", popup_css : "/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialog.css", skin : "o2k7", skin_variant : "silver", oninit: function () { tinyMCE.activeEditor.processID = formProcessID; tinyMCE.activeEditor.domainURL = domainURL; }, onchange_callback: function(inst) { if(inst.isDirty()) { inst.save(); } return true; }, handle_event_callback : function(e) { if(this.isDirty()) { this.save(); } return true; } }); '; break; case 'DYNAFORM_TEMPLATE': $editorDefinition .= ' var formProcessID = document.getElementById("form[PRO_UID]").value; var formDynaformID = document.getElementById("form[DYN_UID]").value; var actualCaretPositionBookmark; if (tinyMCE.activeEditor == null){ tinyMCE.activeEditor="created"; tinyMCE.init({ theme : "advanced", plugins : "advhr,advimage,advlink,advlist,autolink,autoresize,contextmenu,directionality,emotions,example,example_dependency,fullpage,fullscreen,iespell,inlinepopups,insertdatetime,layer,legacyoutput,lists,media,nonbreaking,noneditable,pagebreak,paste,preview,print,save,searchreplace,style,tabfocus,table,template,visualblocks,visualchars,wordcount,xhtmlxtras,style,table,noneditable,pmFieldPicker", mode : "specific_textareas", //apply_source_formatting : true, //remove_linebreaks: false, editor_selector : "tmceEditor", width : \'100%\', height : \'300\', directionality: "' . ($serverConf->isRtl(SYS_LANG) ? 'rtl' : 'ltr') . '", theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,|,cut,copy,paste,|,bullist,numlist,|,pmFieldPicker", theme_advanced_buttons2 : "tablecontrols,|outdent,indent,blockquote,|,undo,redo,|,link,unlink,image,|,forecolor,backcolor,styleprops,|,hr,removeformat,visualaid,|,sub,sup,|,ltr,rtl,|,code", popup_css : "/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialog.css", skin : "o2k7", skin_variant : "silver", content_css : "/css/' . SYS_SKIN . '.css", template_external_list_url : "js/template_list.js", external_link_list_url : "js/link_list.js", external_image_list_url : "js/image_list.js", media_external_list_url : "js/media_list.js", extended_valid_elements : "div[*],script[language|type|src]", valid_children : "+body[style],+form[style],+div[style],+td[style],+table[style],+tbody[style],+tr[style],+span[style],+p[style]", // noneditable_regexp: /[^"|^:|^\']{(.*?)}/g, template_replace_values : { username : "******", staffid : "991234" }, oninit: function () { tinyMCE.activeEditor.domainURL = domainURL; tinyMCE.activeEditor.dynUID = formDynaformID; tinyMCE.activeEditor.proUID = formProcessID; }, handle_event_callback : function(e) { if(this.isDirty()) { this.save(); } return true; } }); } '; break; default: $editorDefinition .= ' tinyMCE.init({ // General options mode : "textareas", theme : "advanced", valid_children : "+body[style],+form[style],+div[style],+td[style],+table[style],+tbody[style],+tr[style],+span[style],+p[style]", plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager", // Theme options theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, width: "100%", height: "400", directionality: "' . ($serverConf->isRtl(SYS_LANG) ? 'rtl' : 'ltr') . '" }); '; break; } return $editorDefinition; }
public function installLicense($path, $redirect = true, $includeExpired = true) { $application = new license_application($path, false, true, false, true, true); $results = $application->validate(false, false, "", "", "80", true); //if the result is ok then it is saved into DB $res = $results['RESULT']; if ($res == 'EMPTY') { return false; } if (!$includeExpired) { if ($res == 'EXPIRED') { return false; } } if ($res != 'OK' && $res != 'EXPIRED' && $res != 'TMINUS') { G::SendTemporalMessage('ID_ISNT_LICENSE', 'tmp-info', 'labels'); return false; } else { G::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); $oServerConf->setProperty('ACTIVE_LICENSE', array(SYS_SYS => $path)); $this->saveDataLicense($results, $path, $redirect); if ($redirect) { G::Header('location: ../enterprise/addonsStore'); } else { return true; } } }
/** * 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, null, null, false, true ); $processList = $case->getStartCasesPerType( $_SESSION['USER_LOGGED'], 'category' ); unset( $processList[0] ); $processesList = array (); foreach ($processList as $key => $valueProcess) { foreach ($proData as $keyPro => $valuePro) { if ($valueProcess['pro_uid'] == $valuePro['PRO_UID']) { $processesList[] = $valueProcess; } } } $switchLink = $userProperty->getUserLocation( $_SESSION['USER_LOGGED'], SYS_LANG ); 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'; } } $oServerConf = & serverConf::getSingleton(); if ($oServerConf->isRtl( SYS_LANG )) { $swRtl = 1; } else { $swRtl = 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', $processesList ); $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->setVar( 'rtl', $swRtl ); $this->render(); }
function postHeartBeat($params) { if (is_array($params)) { //No matter what happens with the result let's set the nextBeat to 2 hours from now G::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); $oServerConf->setHeartbeatProperty('HB_NEXT_BEAT_DATE', strtotime("+2 hour"), 'HEART_BEAT_CONF'); $nextBeatDate = $oServerConf->getHeartbeatProperty('HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF'); $heartBeatUrl = $oServerConf->getHeartbeatProperty('HB_BEAT_URL', 'HEART_BEAT_CONF'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $heartBeatUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($ch, CURLOPT_AUTOREFERER, true); //To avoid SSL error curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); //To avoid timeouts curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_TIMEOUT, 20); $response = curl_exec($ch); $curl_session = curl_getinfo($ch, CURLINFO_HTTP_CODE); $headers = curl_getinfo($ch); $header = substr($response, 0, $headers['header_size']); $content = substr($response, $headers['header_size']); curl_close($ch); if ($headers['http_code'] == 200) { $oServerConf->setHeartbeatProperty('HB_BEAT_TYPE', 'beat', 'HEART_BEAT_CONF'); $oServerConf->resetLogins(); $oServerConf->setHeartbeatProperty('HB_NEXT_BEAT_DATE', strtotime("+7 day"), 'HEART_BEAT_CONF'); //Reset Errors } else { //Catch the error $oServerConf->setHeartbeatProperty('HB_NEXT_BEAT_DATE', strtotime("+1 day"), 'HEART_BEAT_CONF'); } } /* $ch = curl_init (); curl_setopt ( $ch, CURLOPT_URL, $heartBeatUrl ); curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt ( $ch, CURLOPT_HEADER, true ); curl_setopt ( $ch, CURLOPT_FOLLOWLOCATION, false ); curl_setopt ( $ch, CURLOPT_AUTOREFERER, true ); //To avoid SSL error curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); curl_setopt ( $ch, CURLOPT_POST, 1 ); curl_setopt ( $ch, CURLOPT_POSTFIELDS, $params ); //To avoid timeouts curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, 10 ); curl_setopt ( $ch, CURLOPT_TIMEOUT, 20 ); $response = curl_exec ( $ch ); $curl_session = curl_getinfo($ch, CURLINFO_HTTP_CODE); $headers = curl_getinfo ( $ch ); $header = substr ( $response, 0, $headers ['header_size'] ); $content = substr ( $response, $headers ['header_size'] ); curl_close ( $ch ); if ($headers ['http_code'] == 200) { $this->beatType = 'beat'; $this->resetLogins (); $this->nextBeatDate = strtotime ( "+7 day" ); //next beat in 7 days //Reset Errors $this->errors=array(); } else { //Catch the error $this->errors[]=$curl_session; $this->nextBeatDate = strtotime ( "+1 day" ); //retry in 30 mins } $this->saveSingleton (); */ }
public function enterpriseLimitCreateUser() { G::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); $infoLicense = $oServerConf->getProperty('LICENSE_INFO'); if (isset($infoLicense[SYS_SYS]['LIMIT_USERS'])) { $criteria = new Criteria('workflow'); $criteria->add(UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL); $count = UsersPeer::doCount($criteria); if ($count >= $infoLicense[SYS_SYS]['LIMIT_USERS']) { throw new Exception("You can\\'t add more users to the System, this reach the limit of allowed users by license that it has installed now"); } } }
/** * get setup Plugins * * @param unknown_type $default * @return void */ function setupPlugins() { try { $iPlugins = 0; G::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); $oServerConf->addPlugin(SYS_SYS, $this->_aPluginDetails); foreach ($this->_aPluginDetails as $namespace => $detail) { if (isset($detail->enabled) && $detail->enabled) { if (!empty($detail->sFilename) && file_exists($detail->sFilename)) { if (strpos($detail->sFilename, PATH_SEP) !== false) { $aux = explode(PATH_SEP, $detail->sFilename); } else { $aux = explode(chr(92), $detail->sFilename); } $sFilename = PATH_PLUGINS . $aux[count($aux) - 1]; if (!file_exists($sFilename)) { continue; } require_once $sFilename; if (class_exists($detail->sClassName)) { $oPlugin = new $detail->sClassName($detail->sNamespace, $detail->sFilename); $this->_aPlugins[$detail->sNamespace] = $oPlugin; $iPlugins++; $oPlugin->setup(); } } } } $this->eevalidate(); return $iPlugins; } catch (Exception $e) { global $G_PUBLISH; $aMessage['MESSAGE'] = $e->getMessage(); $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); G::RenderPage('publish'); die; } }
/** * Function includeExtJs * with this function we are using the ExtJs library, this library is not compatible with * previous libraries, for that reason oHeadPublisher will clear previous libraries like maborak * we need to check if we need the language file * this function returns the header needed to render a page using ExtJs * * @author Fernando Ontiveros <*****@*****.**> * @access public * @return string */ public function includeExtJs() { $this->clearScripts(); $head = ''; $head .= " <script type='text/javascript' src='/js/ext/ext-base.js'></script>\n"; $head .= " <script type='text/javascript' src='/js/ext/ext-all.js'></script>\n"; $aux = explode('-', strtolower(SYS_LANG)); if ($aux[0] != 'en' && file_exists(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'ext' . PATH_SEP . 'locale' . PATH_SEP . 'ext-lang-' . $aux[0] . '.js')) { $head .= " <script type='text/javascript' src='/js/ext/locale/ext-lang-" . $aux[0] . ".js'></script>\n"; } // enabled for particular use $head .= $this->getExtJsLibraries(); // $head .= " <script type='text/javascript' src='/js/ext/draw2d.js'></script>\n"; // $head .= " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl("/js/ext/translation." . SYS_LANG . ".js") . "\"></script>\n"; if (!isset($this->extJsSkin) || $this->extJsSkin == '') { $this->extJsSkin = 'xtheme-gray'; //$this->extJsSkin = 'gtheme'; } //$head .= $this->getExtJsStylesheets(); $head .= $this->getExtJsScripts(); $head .= $this->getExtJsVariablesScript(); $oServerConf =& serverConf::getSingleton(); if ($oServerConf->isRtl(SYS_LANG)) { $head .= " <script type='text/javascript' src='/js/ext/extjs_rtl.js'></script>\n"; } return $head; }
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']); } }
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); }