<?php

switch ($_GET['MAIN_DIRECTORY']) {
    case 'mailTemplates':
        $sDirectory = PATH_DATA_MAILTEMPLATES . $_GET['PRO_UID'] . PATH_SEP . ($_GET['CURRENT_DIRECTORY'] != '' ? $_GET['CURRENT_DIRECTORY'] . PATH_SEP : '');
        break;
    case 'public':
        $sDirectory = PATH_DATA_PUBLIC . $_GET['PRO_UID'] . PATH_SEP . ($_GET['CURRENT_DIRECTORY'] != '' ? $_GET['CURRENT_DIRECTORY'] . PATH_SEP : '');
        break;
    default:
        die;
        break;
}
//fixed: added a file extension when is a javascript file by krlos
$_GET['FILE'] .= $_GET['sFilextension'] != '' && $_GET['sFilextension'] == 'javascript' ? '.js' : '';
if (file_exists($sDirectory . $_GET['FILE'])) {
    G::streamFile($sDirectory . $_GET['FILE'], true);
}
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd., 
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 * 
 */
/*
 * Created on 13-02-2008
 *
 * @author David Callizaya <*****@*****.**>
 */
if (!isset($_SESSION['PROCESS'])) {
    G::header('location: login');
}
require_once "classes/model/AppDocumentPeer.php";
$oAppDocument = new AppDocument();
$oAppDocument->Fields = $oAppDocument->load($_GET['a']);
$sAppDocUid = $oAppDocument->getAppDocUid();
$info = pathinfo($oAppDocument->getAppDocFilename());
if (!isset($_GET['ext'])) {
    $ext = $info['extension'];
} else {
    if ($_GET['ext'] != '') {
        $ext = $_GET['ext'];
    } else {
        $ext = $info['extension'];
    }
}
$realPath = PATH_DOCUMENT . $_SESSION['APPLICATION'] . '/outdocs/' . $info['basename'] . '.' . $ext;
G::streamFile($realPath, true);
Exemple #3
0
function streamSkin()
{
    $skinTar = $_REQUEST['file'];
    $bDownload = true;
    G::streamFile($skinTar, $bDownload, basename($skinTar));
    @unlink($fileTar);
}
 public function downloadFile($sProcessUID, $sMainDirectory, $sCurrentDirectory, $sFile)
 {
     switch ($sMainDirectory) {
         case 'mailTemplates':
             $sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . ($sCurrentDirectory != '' ? $sCurrentDirectory . PATH_SEP : '');
             break;
         case 'public':
             $sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . ($sCurrentDirectory != '' ? $sCurrentDirectory . PATH_SEP : '');
             break;
         default:
             die;
             break;
     }
     if (file_exists($sDirectory . $sFile)) {
         G::streamFile($sDirectory . $sFile, true);
     }
 }
Exemple #5
0
 public function export()
 {
     G::LoadSystem('i18n_po');
     G::LoadClass("system");
     //get labels MichelangeloFE
     try {
         $oTranslation = new Translation();
         $MichelangeloFE = PATH_HOME . "../workflow/public_html/lib/js";
         if (file_exists($MichelangeloFE)) {
             $labels = self::readLabelsDirectory($MichelangeloFE, true);
             foreach ($labels as $label) {
                 $oTranslation->addTranslation('LABEL', 'ID_MAFE_' . G::encryptOld($label), 'en', $label);
             }
         }
     } catch (Exception $e) {
         error_log($e->getMessage());
     }
     //creating the .po file
     $sPOFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . MAIN_POFILE . '.' . $_GET['LOCALE'] . '.po';
     $poFile = new i18n_PO($sPOFile);
     $poFile->buildInit();
     $language = new Language();
     $locale = $_GET['LOCALE'];
     $_TARGET_LANG = $_GET['LOCALE'];
     $_BASE_LANG = 'en';
     if (strpos($locale, Translation::$localeSeparator) !== false) {
         list($LAN_ID, $IC_UID) = explode(Translation::$localeSeparator, $_GET['LOCALE']);
         $iCountry = new IsoCountry();
         $iCountryRecord = $iCountry->findById($IC_UID);
         if (!isset($iCountryRecord['IC_UID'])) {
             throw new Exception("Country Target ID '{$_GET['LAN_ID']}' doesn't exist!");
         }
         $sCountry = $iCountryRecord['IC_NAME'];
     } else {
         $LAN_ID = $locale;
         $sCountry = $IC_UID = '';
     }
     $langRecord = $language->findById($LAN_ID);
     if (!isset($langRecord['LAN_NAME'])) {
         throw new Exception("Language Target ID \"{$LAN_ID}\" doesn't exist!");
     }
     $sLanguage = $langRecord['LAN_NAME'];
     //setting headers
     $poFile->addHeader('Project-Id-Version', 'ProcessMaker ' . System::getVersion());
     $poFile->addHeader('POT-Creation-Date', '');
     $poFile->addHeader('PO-Revision-Date', date('Y-m-d H:i:s'));
     $poFile->addHeader('Last-Translator', '');
     $poFile->addHeader('Language-Team', 'Colosa Developers Team <*****@*****.**>');
     $poFile->addHeader('MIME-Version', '1.0');
     $poFile->addHeader('Content-Type', 'text/plain; charset=utf-8');
     $poFile->addHeader('Content-Transfer_Encoding', '8bit');
     $poFile->addHeader('X-Poedit-Language', ucwords($sLanguage));
     $poFile->addHeader('X-Poedit-Country', ucwords($sCountry));
     $poFile->addHeader('X-Poedit-SourceCharset', 'utf-8');
     $poFile->addHeader('Content-Transfer-Encoding', '8bit');
     $aLabels = array();
     $aMsgids = array('' => true);
     // selecting all translations records of base language 'en' on TRANSLATIONS table
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(TranslationPeer::TRN_CATEGORY);
     $oCriteria->addSelectColumn(TranslationPeer::TRN_ID);
     $oCriteria->addSelectColumn(TranslationPeer::TRN_VALUE);
     $oCriteria->add(TranslationPeer::TRN_LANG, 'en');
     $oDataset = TranslationPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $targetLangRecords = array();
     // retrieve the translation for the target language
     if ($LAN_ID != 'en') {
         // only if it is different language than base language 'en'
         $c = new Criteria('workflow');
         $c->addSelectColumn(TranslationPeer::TRN_CATEGORY);
         $c->addSelectColumn(TranslationPeer::TRN_ID);
         $c->addSelectColumn(TranslationPeer::TRN_VALUE);
         $c->add(TranslationPeer::TRN_LANG, $_GET['LOCALE']);
         $ds = TranslationPeer::doSelectRS($c);
         $ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         while ($ds->next()) {
             $row = $ds->getRow();
             $targetLangRecords[$row['TRN_CATEGORY'] . '/' . $row['TRN_ID']] = $row['TRN_VALUE'];
         }
     }
     // get the respective translation for each english label
     while ($oDataset->next()) {
         $aRow1 = $oDataset->getRow();
         $trnCategory = trim($aRow1['TRN_CATEGORY']);
         # Validation, validate that the TRN_CATEGORY contains valid characteres
         preg_match("/^[0-9a-zA-Z_-]+/", $trnCategory, $sTestResult);
         // IF the translations id "TRN_ID" has invalid characteres or has not accepted categories
         if ($sTestResult[0] !== $trnCategory || $trnCategory != 'LABEL' && $trnCategory != 'JAVASCRIPT') {
             $oTranslation = new Translation();
             $oTranslation->remove($aRow1['TRN_CATEGORY'], $aRow1['TRN_ID'], 'en');
             //remove not accepted translations
             continue;
             //jump to next iteration
         }
         // retrieve the translation for the target language
         if ($LAN_ID != 'en') {
             // only if it is different language than base language 'en'
             if (isset($targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']])) {
                 $msgstr = $targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']] != '' ? $targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']] : $aRow1['TRN_VALUE'];
             } else {
                 $msgstr = $aRow1['TRN_VALUE'];
             }
         } else {
             //if not just copy the same
             $msgstr = $aRow1['TRN_VALUE'];
         }
         $msgid = trim($aRow1['TRN_VALUE']);
         $msgstr = trim($msgstr);
         if (isset($aMsgids[$msgid])) {
             $msgid = '[' . $aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID'] . '] ' . $msgid;
         }
         $poFile->addTranslatorComment('TRANSLATION');
         $poFile->addTranslatorComment($aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']);
         $poFile->addReference($aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']);
         $poFile->addTranslation(stripcslashes($msgid), stripcslashes($msgstr));
         $aMsgids[$msgid] = true;
     }
     //$timer->setMarker('end making 1th .po from db');
     //find all xml files into PATH_XMLFORM
     $aXMLForms = glob(PATH_XMLFORM . '*/*.xml');
     //from a sublevel to
     $aXMLForms2 = glob(PATH_XMLFORM . '*/*/*.xml');
     $aXMLForms = array_merge($aXMLForms, $aXMLForms2);
     $aEnglishLabel = array();
     $aOptions = array();
     $nodesNames = array();
     G::loadSystem('dynaformhandler');
     foreach ($aXMLForms as $xmlFormPath) {
         $xmlFormFile = str_replace(chr(92), '/', $xmlFormPath);
         $xmlFormFile = str_replace(PATH_XMLFORM, '', $xmlFormPath);
         $dynaForm = new dynaFormHandler($xmlFormPath);
         $dynaNodes = $dynaForm->getFields();
         //get all fields of each xmlform
         foreach ($dynaNodes as $oNode) {
             $sNodeName = $oNode->nodeName;
             //$arrayNode = $dynaForm->getArray($oNode, Array('type', $_BASE_LANG, $_BASE_LANG));
             $arrayNode = $dynaForm->getArray($oNode);
             //if has not native language translation
             if (!isset($arrayNode[$_BASE_LANG]) || !isset($arrayNode['type']) || isset($arrayNode['type']) && in_array($arrayNode['type'], $this->exceptionFields)) {
                 continue;
                 //just continue with the next node
             }
             // Getting the Base Origin Text
             if (!is_array($arrayNode[$_BASE_LANG])) {
                 $originNodeText = trim($arrayNode[$_BASE_LANG]);
             } else {
                 $langNode = $arrayNode[$_BASE_LANG][0];
                 $originNodeText = $langNode['__nodeText__'];
             }
             // Getting the Base Target Text
             if (isset($arrayNode[$_TARGET_LANG])) {
                 if (!is_array($arrayNode[$_TARGET_LANG])) {
                     $targetNodeText = trim($arrayNode[$_TARGET_LANG]);
                 } else {
                     $langNode = $arrayNode[$_TARGET_LANG][0];
                     $targetNodeText = $langNode['__nodeText__'];
                 }
             } else {
                 $targetNodeText = $originNodeText;
             }
             $nodeName = $arrayNode['__nodeName__'];
             $nodeType = $arrayNode['type'];
             $msgid = $originNodeText;
             // if the nodeName already exists in the po file, we need to create other msgid
             if (isset($aMsgids[$msgid])) {
                 $msgid = '[' . $xmlFormFile . '?' . $nodeName . '] ' . $originNodeText;
             }
             $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName);
             $poFile->addTranslatorComment($xmlFormFile);
             $poFile->addReference($nodeType . ' - ' . $nodeName);
             $poFile->addTranslation(stripslashes($msgid), stripslashes($targetNodeText));
             $aMsgids[$msgid] = true;
             //if this node has options child nodes
             if (isset($arrayNode[$_BASE_LANG]) && isset($arrayNode[$_BASE_LANG][0]) && isset($arrayNode[$_BASE_LANG][0]['option'])) {
                 $originOptionNode = $arrayNode[$_BASE_LANG][0]['option'];
                 //get the options
                 $targetOptionExists = false;
                 if (isset($arrayNode[$_TARGET_LANG]) && isset($arrayNode[$_TARGET_LANG][0]) && isset($arrayNode[$_TARGET_LANG][0]['option'])) {
                     $targetOptionNode = $arrayNode[$_TARGET_LANG][0]['option'];
                     $targetOptionExists = true;
                 }
                 if (!is_array($originOptionNode)) {
                     if (is_string($originOptionNode)) {
                         $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName . '-' . $originOptionNode);
                         $poFile->addTranslatorComment($xmlFormFile);
                         $poFile->addReference($nodeType . ' - ' . $nodeName . ' - ' . $originOptionNode);
                         $poFile->addTranslation(stripslashes($msgid), stripslashes($originOptionNode));
                     }
                 } else {
                     foreach ($originOptionNode as $optionNode) {
                         $optionName = $optionNode['name'];
                         $originOptionValue = $optionNode['__nodeText__'];
                         if ($targetOptionExists) {
                             $targetOptionValue = getMatchDropdownOptionValue($optionName, $targetOptionNode);
                             if ($targetOptionValue === false) {
                                 $targetOptionValue = $originOptionValue;
                             }
                         } else {
                             $targetOptionValue = $originOptionValue;
                         }
                         $msgid = '[' . $xmlFormFile . '?' . $nodeName . '-' . $optionName . ']';
                         $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName . '-' . $optionName);
                         $poFile->addTranslatorComment($xmlFormFile);
                         $poFile->addReference($nodeType . ' - ' . $nodeName . ' - ' . $optionName);
                         $poFile->addTranslation($msgid, stripslashes($targetOptionValue));
                     }
                 }
             }
         }
         //end foreach
     }
     G::auditLog("ExportLanguage", "Language: " . $_GET['LOCALE']);
     G::streamFile($sPOFile, true);
 }
 public function dispatchResource()
 {
     $realPath = $this->matchRoute['path'];
     switch ($this->matchRoute['type']) {
         case 'sysUnnamed':
             require_once 'sysUnnamed.php';
             die;
             break;
         case 'sysNamed':
             header('location : ' . $_SERVER['REQUEST_URI'] . '/' . SYS_LANG . '/classic/login/login');
             die;
             break;
         case 'jsMethod':
             G::parseURI(getenv("REQUEST_URI"));
             $filename = PATH_METHODS . SYS_COLLECTION . '/' . SYS_TARGET . '.js';
             G::streamFile($filename);
             die;
             break;
         case 'errorFile':
             header("location: /errors/error404.php?url=" . urlencode($_SERVER['REQUEST_URI']));
             if (DEBUG_TIME_LOG) {
                 G::logTimeByPage();
             }
             //log this page
             die;
             break;
         case 'plugin':
             //Get the Plugin Folder, always the first element
             $pluginFolder = array_shift($realPath);
             //The other parts are the realpath into public_html (no matter how many elements)
             $filePath = implode(PATH_SEP, $realPath);
             $pluginFilename = PATH_PLUGINS . $pluginFolder . PATH_SEP . 'public_html' . PATH_SEP . $filePath;
             if (file_exists($pluginFilename)) {
                 G::streamFile($pluginFilename);
             }
             die;
             break;
         case 'skin':
             $fileToBeStreamed = str_replace("/skin/", PATH_CUSTOM_SKINS, $_SERVER['REQUEST_URI']);
             if (file_exists($fileToBeStreamed)) {
                 G::streamFile($fileToBeStreamed);
             }
             die;
             break;
         default:
             $realPath .= strpos(basename($realPath), '.') === false ? '.php' : '';
             G::streamFile($realPath);
             die;
     }
 }
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd., 
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 * 
 */
/*
 * Created on 13-02-2008
 *
 * @author David Callizaya <*****@*****.**>
 */
if (!isset($_SESSION['PROCESS'])) {
    G::header('location: login');
}
require_once "classes/model/AppDocumentPeer.php";
$oAppDocument = new AppDocument();
$oAppDocument->Fields = $oAppDocument->load($_GET['a']);
$sAppDocUid = $oAppDocument->getAppDocUid();
$info = pathinfo($oAppDocument->getAppDocFilename());
$ext = $info['extension'];
$realPath = PATH_DOCUMENT . $_SESSION['APPLICATION'] . '/' . $sAppDocUid . '.' . $ext;
G::streamFile($realPath, true, $oAppDocument->Fields['APP_DOC_FILENAME']);
Exemple #8
0
<?php

require_once 'classes/model/OutputDocument.php';
$uid = $_SERVER['QUERY_STRING'];
$oOutputDocument = new OutputDocument();
$aFields = $oOutputDocument->load($uid);
$type = $aFields['OUT_DOC_TYPE'];
if ($type == 'JRXML') {
    $extension = 'jrxml';
}
if ($type == 'ACROFORM') {
    $extension = 'pdf';
}
$fileJrxml = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension;
$bDownload = true;
// The ereg_replace function has been DEPRECATED as of PHP 5.3.0.
// $downFileName = ereg_replace('[^A-Za-z0-9_]', '_', $aFields['OUT_DOC_TITLE'] ) . '.' . $extension;
$downFileName = preg_replace('/[^A-Za-z0-9_]/i', '_', $aFields['OUT_DOC_TITLE']) . '.' . $extension;
G::streamFile($fileJrxml, $bDownload, $downFileName);
} elseif (file_exists($realPath2)) {
    $sw_file_exists = true;
    $realPath = $realPath2;
}
if (!$sw_file_exists) {
    $oPluginRegistry =& PMPluginRegistry::getSingleton();
    if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT)) {
        $error_message = G::LoadTranslation('ID_ERROR_FILE_NOT_EXIST', SYS_LANG, array('filename' => $info['basename'] . $ver . '.' . $ext)) . ' ' . G::LoadTranslation('ID_CONTACT_ADMIN');
    } else {
        $error_message = "'" . $info['basename'] . $ver . '.' . $ext . "' " . G::LoadTranslation('ID_ERROR_STREAMING_FILE');
    }
    if (isset($_POST['request']) && $_POST['request'] == true) {
        $res['success'] = 'failure';
        $res['message'] = $error_message;
        print G::json_encode($res);
    } else {
        G::SendMessageText($error_message, "ERROR");
        $backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
        G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
        die;
    }
} else {
    if (isset($_POST['request']) && $_POST['request'] == true) {
        $res['success'] = 'success';
        $res['message'] = $info['basename'] . $ver . '.' . $ext;
        print G::json_encode($res);
    } else {
        G::streamFile($realPath, $download, $info['basename'] . $ver . '.' . $ext);
    }
}
//G::streamFile ( $realPath, true);
Exemple #10
0
 public function streamExported($httpData)
 {
     $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP;
     $sFileName = $httpData->f;
     $realPath = $PUBLIC_ROOT_PATH . $sFileName;
     G::streamFile($realPath, true);
     unlink($realPath);
 }
Exemple #11
0
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 *
 */
//  if (($RBAC_Response = $RBAC->userCanAccess("PM_CASES"))!=1) return $RBAC_Response;
$idDecode64 = base64_decode($_GET['id']);
$idExploded = explode('/', $idDecode64);
if ($idExploded[0] == '') {
    array_shift($idExploded);
}
if ($idExploded[0] == 'plugin') {
    //Get the Plugin Folder, always the first element
    $pluginFolder = $idExploded[1];
    $pluginFilename = PATH_PLUGINS . $pluginFolder . PATH_SEP . 'public_html' . PATH_SEP . $idExploded[2];
    if (file_exists($pluginFilename)) {
        G::streamFile($pluginFilename);
    }
    die;
}
$ainfoSite = explode("/", $_SERVER["REQUEST_URI"]);
//it was added to show the logo into management plugin add by krlos
if (isset($_GET['wsName']) && $_GET['wsName'] != '') {
    $ainfoSite[1] = $_GET['wsName'];
}
//end add
$dir = PATH_DATA . "sites" . PATH_SEP . str_replace("sys", "", $ainfoSite[1]) . PATH_SEP . "files/logos";
$imagen = $dir . PATH_SEP . $idDecode64;
if (is_file($imagen)) {
    showLogo($imagen);
} else {
    $newDir = PATH_DATA . "sites" . PATH_SEP . str_replace("sys", "", $ainfoSite[1]) . PATH_SEP . "files/logos";
if (file_exists($realPath)) {
    $sw_file_exists = true;
} elseif (file_exists($realPath1)) {
    $sw_file_exists = true;
    $realPath = $realPath1;
} elseif (file_exists($realPath2)) {
    $sw_file_exists = true;
    $realPath = $realPath2;
}
if (!$sw_file_exists) {
    $error_message = "'" . $info['basename'] . $ver . '.' . $ext . "' " . G::LoadTranslation('ID_ERROR_STREAMING_FILE');
    if (isset($_POST['request']) && $_POST['request'] == true) {
        $res['success'] = 'failure';
        $res['message'] = $error_message;
        print G::json_encode($res);
    } else {
        G::SendMessageText($error_message, "ERROR");
        $backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
        G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
        die;
    }
} else {
    if (isset($_POST['request']) && $_POST['request'] == true) {
        $res['success'] = 'success';
        $res['message'] = $info['basename'] . $ver . '.' . $ext;
        print G::json_encode($res);
    } else {
        G::streamFile($realPath, true, $info['basename'] . $ver . '.' . $ext);
    }
}
//G::streamFile ( $realPath, true);
Exemple #13
0
 function screamFileUpgrades()
 {
     G::streamFile(PATH_DATA . 'log/upgrades.log', true);
 }
Exemple #14
0
G::mk_dir($pathPublic);
G::mk_dir($pathPublic . 'images');
//  file_put_contents ( PATH_DATA . 'skins' . PATH_SEP . $id  , "hello world" );
$fields['className'] = $id;
$fields['version'] = $oConf->version;
$fields['description'] = $oConf->description;
$fields['PMversion'] = System::getVersion();
savePluginFile('skinPluginMainClass', $pathHome . $id . '.php', $fields);
savePluginFile('skinPluginClass', $pathBase . 'class.' . $id . '.php', $fields);
copyFile(PATH_SKINS . $id . '.php', $pathBase . 'data');
copyFile(PATH_SKINS . $id . '.html', $pathBase . 'data');
copyFile(PATH_SKINS . $id . '.cnf', $pathBase . 'data');
copyFile(PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'iepngfix.htc', $pathPublic);
copyFile(PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'style.css', $pathPublic);
$aFiles = array();
if ($handle = opendir($pathImages)) {
    while (false !== ($file = readdir($handle))) {
        if (substr($file, 0, 1) != '.') {
            if (isset($aFiles[$file])) {
                $aFiles[$file] = 0;
            }
            copyFile($pathImages . $file, $pathPublic . 'images' . PATH_SEP);
        }
    }
    closedir($handle);
}
$fileTar = packPlugin($id, $oConf->version);
$bDownload = true;
G::streamFile($fileTar, $bDownload, basename($fileTar));
@G::rm_dir($pathHome);
@unlink($fileTar);
    $phpFile = PATH_GULLIVER_HOME . 'methods/' . substr(SYS_COLLECTION, 8) . SYS_TARGET . '.php';
} else {
    //when the file is part of the public directory of any PROCESS, this a ProcessMaker feature
    if (preg_match('/^[0-9][[:alnum:]]+$/', SYS_COLLECTION) == 1) {
        //the pattern is /sysSYS/LANG/SKIN/PRO_UID/file
        $auxPart = explode('/', $_SERVER['REQUEST_URI']);
        $aAux = explode('?', $auxPart[count($auxPart) - 1]);
        //$extPart = explode ( '.' , $auxPart[ count($auxPart)-1] );
        $extPart = explode('.', $aAux[0]);
        $queryPart = isset($aAux[1]) ? $aAux[1] : "";
        $extension = $extPart[count($extPart) - 1];
        $phpFile = PATH_DATA_SITE . 'public' . PATH_SEP . SYS_COLLECTION . PATH_SEP . urldecode($auxPart[count($auxPart) - 1]);
        $aAux = explode('?', $phpFile);
        $phpFile = $aAux[0];
        if ($extension != 'php') {
            G::streamFile($phpFile);
            die;
        }
        $avoidChangedWorkspaceValidation = true;
        $bWE = true;
        //$phpFile = PATH_DATA_SITE . 'public' . PATH_SEP .  SYS_COLLECTION . PATH_SEP . $auxPart[ count($auxPart)-1];
    }
    //erik: verify if it is a Controller Class or httpProxyController Class
    if (is_file(PATH_CONTROLLERS . SYS_COLLECTION . '.php')) {
        require_once PATH_CONTROLLERS . SYS_COLLECTION . '.php';
        $controllerClass = SYS_COLLECTION;
        //if the method name is empty set default to index method
        $controllerAction = SYS_TARGET != '' ? SYS_TARGET : 'index';
        //if the method exists
        if (is_callable(array($controllerClass, $controllerAction))) {
            $isControllerCall = true;
Exemple #16
0
ini_set('display_errors', 'On');
/*** enable ERROR_SHOW_SOURCE_CODE to display the source code for any WARNING OR NOTICE ***/
define('ERROR_SHOW_SOURCE_CODE', true);
/*** enable ERROR_LOG_NOTICE_ERROR to log Notices messages in default apache log ***/
//  define ( 'ERROR_LOG_NOTICE_ERROR', true );
/* Virtual URLs */
$virtualURITable = array();
$virtualURITable['/js/(*)'] = PATH_GULLIVER_HOME . 'js/';
$virtualURITable['/jsform/(*.js)'] = PATH_DATA . 'xmlform/';
$virtualURITable['/(sys*)'] = FALSE;
//$virtualURITable['/jsprocessform/(*.js)'] = 'PROCESSFORMS';
/*To sysUnnamed*/
$virtualURITable['/[a-zA-Z][a-zA-Z0-9]{0,}()'] = 'sysUnnamed';
$virtualURITable['/(*)'] = PATH_HTML;
//************** verify if we need to redirect or stream the file **************
if (G::virtualURI($_SERVER["REQUEST_URI"], $virtualURITable, $realPath)) {
    if ($realPath === 'sysUnnamed') {
        require_once 'sysUnnamed.php';
        die;
    } else {
        $realPath = explode('?', $realPath);
        G::streamFile($realPath[0]);
        die;
    }
}
//************** verify if the URI is encrypted or not **************
G::parseURI(getenv("REQUEST_URI"));
//print '-' . SYS_TEMP .'-' . SYS_LANG. '-' . SYS_SKIN.'-' . SYS_COLLECTION.'-' . SYS_TARGET.'<br>';
ini_alter("include_path", ".");
ini_set("include_path", PATH_GULLIVER_HOME . 'thirdparty/pear');
require_once "../engine/pre_processor.php";
}
$realPath = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/' . $sAppDocUid . '_' . $iDocVersion . '.' . $ext;
$realPath1 = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/' . $sAppDocUid . '.' . $ext;
$sw_file_exists = false;
if (file_exists($realPath)) {
    $sw_file_exists = true;
} elseif (file_exists($realPath1)) {
    $sw_file_exists = true;
    $realPath = $realPath1;
}
if (!$sw_file_exists) {
    $error_message = "'" . $oAppDocument->Fields['APP_DOC_FILENAME'] . "' " . G::LoadTranslation('ID_ERROR_STREAMING_FILE');
    if (isset($_POST['request']) && $_POST['request'] == true) {
        $res['success'] = 'failure';
        $res['message'] = $error_message;
        print G::json_encode($res);
    } else {
        G::SendMessageText($error_message, "ERROR");
        $backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
        G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
        die;
    }
} else {
    if (isset($_POST['request']) && $_POST['request'] == true) {
        $res['success'] = 'success';
        $res['message'] = $oAppDocument->Fields['APP_DOC_FILENAME'];
        print G::json_encode($res);
    } else {
        G::streamFile($realPath, $bDownload, $oAppDocument->Fields['APP_DOC_FILENAME']);
    }
}
Exemple #18
0
 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);
 }