/**
 * @method
 *
 * Executes a Talend Web Service..
 *
 * @name executeTalendWebservice
 * @label Executes a Talend Web Service.
 *
 * @param string | $wsdl | Talend Web Service (including ?WSDL)
 * @param array(array(n1 v1) array(n2 v2) array(nN vN)) | $params | Array of params. Pairs of param Name Value
 * @param string | $message | Message to be displayed
 * @return array | $return | Talend Array
 *
 */
function executeTalendWebservice($wsdl, $params = array(), $message)
{
    $client = new SoapClient($wsdl, array('trace' => 1));
    $params[0] = "";
    foreach ($params as $paramO) {
        $params[] = "--context_param" . $paramO[0] . "=" . $paramO[1];
    }
    $result = $client->__SoapCall('runJob', array($params));
    /*
    $params[1]="--context_param nb_line=".@=Quantity;
    
    $result = $client->__SoapCall('runJob', array($params));
    foreach ($result->item as $keyItem => $item){
    $gridRow=$keyItem+1;
    @=USERSINFO[$gridRow]['NAME']=$item->item[1];
    @=USERSINFO[$gridRow]['LASTNAME']=$item->item[2];
    @=USERSINFO[$gridRow]['DATE']=$item->item[0];
    @=USERSINFO[$gridRow]['STREET']=$item->item[3];
    @=USERSINFO[$gridRow]['CITY']=$item->item[4];
    @=USERSINFO[$gridRow]['STATE']=$item->item[5];
    @=USERSINFO[$gridRow]['STATEID']=$item->item[6];
    
    }
    */
    G::SendMessageText("<font color='blue'>Information from Talend ETL webservice</font><font color='darkgray'><br>" . $wsdl . "</font>", "INFO");
}
/**
 *
 * @method Executes a Talend Web Service..
 *
 * @name executeTalendWebservice
 * @label Executes a Talend Web Service.
 *
 * @param string | $wsdl | Talend Web Service (including ?WSDL)
 * @param array(array(n1 v1) array(n2 v2) array(nN vN)) | $params | Array of params. Pairs of param Name Value
 * @param string | $message | Message to be displayed
 * @return array | $return | Talend Array
 *
 */
function executeTalendWebservice($wsdl, $message, $params = array())
{
    $client = new SoapClient($wsdl, array('trace' => 1));
    //Apply proxy settings
    $sysConf = System::getSystemConfiguration();
    if ($sysConf['proxy_host'] != '') {
        curl_setopt($client, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
        if ($sysConf['proxy_port'] != '') {
            curl_setopt($client, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
        }
        if ($sysConf['proxy_user'] != '') {
            curl_setopt($client, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
        }
        curl_setopt($client, CURLOPT_HTTPHEADER, array('Expect:'));
    }
    $params[0] = "";
    foreach ($params as $paramO) {
        $params[] = "--context_param" . $paramO[0] . "=" . $paramO[1];
    }
    $result = $client->__SoapCall('runJob', array($params));
    /*
     $params[1]="--context_param nb_line=".@=Quantity;
    
     $result = $client->__SoapCall('runJob', array($params));
     foreach ($result->item as $keyItem => $item){
     $gridRow=$keyItem+1;
     @=USERSINFO[$gridRow]['NAME']=$item->item[1];
     @=USERSINFO[$gridRow]['LASTNAME']=$item->item[2];
     @=USERSINFO[$gridRow]['DATE']=$item->item[0];
     @=USERSINFO[$gridRow]['STREET']=$item->item[3];
     @=USERSINFO[$gridRow]['CITY']=$item->item[4];
     @=USERSINFO[$gridRow]['STATE']=$item->item[5];
     @=USERSINFO[$gridRow]['STATEID']=$item->item[6];
    
     }
    */
    G::SendMessageText("<font color='blue'>Information from Talend ETL webservice</font><font color='darkgray'><br>" . $wsdl . "</font>", "INFO");
}
Пример #3
0
function handleFatalErrors($buffer)
{
    G::LoadClass('case');
    $oCase = new Cases();
    if (preg_match('/(error<\\/b>:)(.+)(<br)/', $buffer, $regs)) {
        $err = preg_replace('/<.*?>/', '', $regs[2]);
        $aAux = explode(' in ', $err);
        $sCode = $_SESSION['_CODE_'];
        unset($_SESSION['_CODE_']);
        registerError(2, $aAux[0], 0, $sCode);
        if (strpos($_SERVER['REQUEST_URI'], '/cases/cases_Step') !== false) {
            if (strpos($_SERVER['REQUEST_URI'], '&ACTION=GENERATE') !== false) {
                $aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']);
                if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
                    $_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER';
                    $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
                    $aNextStep['PAGE'] = $aNextStep['PAGE'] . '&breakpoint=triggerdebug';
                }
                global $oPMScript;
                if (isset($oPMScript) && isset($_SESSION['APPLICATION'])) {
                    $oPMScript->aFields['__ERROR__'] = $aAux[0];
                    $oCase->updateCase($_SESSION['APPLICATION'], array('APP_DATA' => $oPMScript->aFields));
                }
                G::header('Location: ' . $aNextStep['PAGE']);
                die;
            }
            $_SESSION['_NO_EXECUTE_TRIGGERS_'] = 1;
            global $oPMScript;
            if (isset($oPMScript) && isset($_SESSION['APPLICATION'])) {
                $oPMScript->aFields['__ERROR__'] = $aAux[0];
                $oCase->updateCase($_SESSION['APPLICATION'], array('APP_DATA' => $oPMScript->aFields));
            }
            G::header('Location: ' . $_SERVER['REQUEST_URI']);
            die;
        } else {
            $aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']);
            if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
                $_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER';
                $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
                $aNextStep['PAGE'] = $aNextStep['PAGE'] . '&breakpoint=triggerdebug';
            }
            if (strpos($aNextStep['PAGE'], 'TYPE=ASSIGN_TASK&UID=-1') !== false) {
                G::SendMessageText('Fatal error in trigger', 'error');
            }
            global $oPMScript;
            if (isset($oPMScript) && isset($_SESSION['APPLICATION'])) {
                $oPMScript->aFields['__ERROR__'] = $aAux[0];
                $oCase->updateCase($_SESSION['APPLICATION'], array('APP_DATA' => $oPMScript->aFields));
            }
            G::header('Location: ' . $aNextStep['PAGE']);
            die;
        }
    }
    return $buffer;
}
Пример #4
0
 }
 if (PPP_FAILED_LOGINS > 0) {
     if ($_SESSION['FAILED_LOGINS'] >= PPP_FAILED_LOGINS) {
         $oConnection = Propel::getConnection('rbac');
         $oStatement = $oConnection->prepareStatement("SELECT USR_UID FROM USERS WHERE USR_USERNAME = '******'");
         $oDataset = $oStatement->executeQuery();
         if ($oDataset->next()) {
             $sUserUID = $oDataset->getString('USR_UID');
             $oConnection = Propel::getConnection('rbac');
             $oStatement = $oConnection->prepareStatement("UPDATE USERS SET USR_STATUS = 0 WHERE USR_UID = '" . $sUserUID . "'");
             $oStatement->executeQuery();
             $oConnection = Propel::getConnection('workflow');
             $oStatement = $oConnection->prepareStatement("UPDATE USERS SET USR_STATUS = 'INACTIVE' WHERE USR_UID = '" . $sUserUID . "'");
             $oStatement->executeQuery();
             unset($_SESSION['FAILED_LOGINS']);
             G::SendMessageText(G::LoadTranslation('ID_ACCOUNT') . ' "' . $usr . '" ' . G::LoadTranslation('ID_ACCOUNT_DISABLED_CONTACT_ADMIN'), 'warning');
         }
     }
 }
 if (strpos($_SERVER['HTTP_REFERER'], 'home/login') !== false) {
     $d = serialize(array('u' => $usr, 'p' => $pwd, 'm' => G::LoadTranslation($errLabel)));
     $loginUrl = '../home/login?d=' . base64_encode($d);
 } else {
     G::SendTemporalMessage($errLabel, "warning");
     if (substr(SYS_SKIN, 0, 2) !== 'ux') {
         $loginUrl = 'login';
     } else {
         $loginUrl = '../main/login';
     }
 }
 G::header("location: {$loginUrl}");
Пример #5
0
            $message = G::LoadTranslation('ID_UPLOAD_ERR_NO_FILE');
            break;
        case UPLOAD_ERR_NO_TMP_DIR:
            $message = G::LoadTranslation('ID_UPLOAD_ERR_NO_TMP_DIR');
            break;
        case UPLOAD_ERR_CANT_WRITE:
            $message = G::LoadTranslation('ID_UPLOAD_ERR_CANT_WRITE');
            break;
        case UPLOAD_ERR_EXTENSION:
            $message = G::LoadTranslation('ID_UPLOAD_ERR_EXTENSION');
            break;
        default:
            $message = G::LoadTranslation('ID_UPLOAD_ERR_UNKNOWN');
            break;
    }
    G::SendMessageText($message, "ERROR");
    $backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
    G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
    die;
}
G::LoadClass("case");
$inputDocumentUid = $_GET["UID"];
//$_POST["form"]["DOC_UID"]
$appDocUid = $_POST["form"]["APP_DOC_UID"];
$docVersion = intval($_POST["form"]["docVersion"]);
$appDocType = $_POST["form"]["APP_DOC_TYPE"];
$appDocComment = isset($_POST["form"]["APP_DOC_COMMENT"]) ? $_POST["form"]["APP_DOC_COMMENT"] : "";
$actionType = $_POST["form"]["actionType"];
$case = new Cases();
$case->thisIsTheCurrentUser($_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["USER_LOGGED"], "REDIRECT", "casesListExtJs");
//Load the fields
Пример #6
0
    /**

     * Jump to the determinated case by its Application number

     *

     * @param interger $APP_NUMBER

     */

    public function jumpToCase($APP_NUMBER)

    {

        $_GET['APP_UID'] = $oCase->getApplicationUIDByNumber($_GET['APP_NUMBER']);

        $_GET['DEL_INDEX'] = $oCase->getCurrentDelegation($_GET['APP_UID'], $_SESSION['USER_LOGGED']);

        if (is_null($_GET['DEL_INDEX'])) {

            $participated = $oCase->userParticipatedInCase($_GET['APP_UID'], $_SESSION['USER_LOGGED']);

            if ($participated == 0) {

                if (is_null($_GET['APP_UID'])) {

                    G::SendMessageText(G::LoadTranslation('ID_CASE_DOES_NOT_EXISTS'), 'info');

                } else {

                    G::SendMessageText(G::LoadTranslation('ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER'), 'info');

                }

                G::header('location: cases_List');

            }

        }

    }
Пример #7
0
 /**
  * get a value from a PM Table
  *
  * @param <Object> $oOwner
  * @return <String> $sValue
  */
 public function getPMTableValue($oOwner)
 {
     $sValue = '';
     if (isset($oOwner->fields[$this->pmconnection])) {
         if (defined('PATH_CORE')) {
             if (file_exists(PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AdditionalTables.php')) {
                 require_once PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AdditionalTables.php';
                 $oAdditionalTables = new AdditionalTables();
                 try {
                     $aData = $oAdditionalTables->load($oOwner->fields[$this->pmconnection]->pmtable, true);
                 } catch (Exception $oError) {
                     $aData = array('FIELDS' => array());
                 }
                 $aKeys = array();
                 $aValues = explode('|', $oOwner->fields[$this->pmconnection]->keys);
                 $i = 0;
                 if ($aData == "" || count($aData['FIELDS']) < 1) {
                     $message = G::LoadTranslation('ID_PMTABLE_NOT_FOUND');
                     G::SendMessageText($message, "WARNING");
                     $sValue = "";
                 } else {
                     foreach ($aData['FIELDS'] as $aField) {
                         if ($aField['FLD_KEY'] == '1') {
                             // note added by gustavo cruz gustavo[at]colosa[dot]com
                             // this additional [if] checks if a case variable has been set
                             // in the keys attribute, so it can be parsed and replaced for
                             // their respective value.
                             if (preg_match("/@#/", $aValues[$i])) {
                                 // check if a case are running in order to prevent that preview is
                                 // erroneous rendered.
                                 if (isset($_SESSION['APPLICATION'])) {
                                     G::LoadClass('case');
                                     $oApp = new Cases();
                                     if ($oApp->loadCase($_SESSION['APPLICATION']) != null) {
                                         $aFields = $oApp->loadCase($_SESSION['APPLICATION']);
                                         $formVariable = substr($aValues[$i], 2);
                                         if (isset($aFields['APP_DATA'][$formVariable])) {
                                             $formVariableValue = $aFields['APP_DATA'][$formVariable];
                                             $aKeys[$aField['FLD_NAME']] = isset($formVariableValue) ? G::replaceDataField($formVariableValue, $oOwner->values) : '';
                                         } else {
                                             $aKeys[$aField['FLD_NAME']] = '';
                                         }
                                     } else {
                                         $aKeys[$aField['FLD_NAME']] = '';
                                     }
                                 } else {
                                     $aKeys[$aField['FLD_NAME']] = '';
                                 }
                             } else {
                                 $aKeys[$aField['FLD_NAME']] = isset($aValues[$i]) ? G::replaceDataField($aValues[$i], $oOwner->values) : '';
                             }
                             $i++;
                         }
                     }
                     try {
                         $aData = $oAdditionalTables->getDataTable($oOwner->fields[$this->pmconnection]->pmtable, $aKeys);
                     } catch (Exception $oError) {
                         $aData = array();
                     }
                     if (isset($aData[$this->pmfield])) {
                         $sValue = $aData[$this->pmfield];
                     }
                 }
             }
         }
     }
     return $sValue;
 }
Пример #8
0
    case -1:
        G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
        G::header('location: ../login/login');
        die;
        break;
}
if (isset($_POST['form']['BTN_CANCEL'])) {
    header("Location: ../cases/main");
    die;
}
/* Includes */
G::LoadClass('case');
$oCase = new Cases();
$sAppUid = $_SESSION['APPLICATION'];
$iDelIndex = $_SESSION['INDEX'];
$oAppDelegation = new AppDelegation();
$aDelegation = $oAppDelegation->load($sAppUid, $iDelIndex);
//if there are no user in the delegation row, this case is still in selfservice
if ($aDelegation['USR_UID'] == "") {
    $oCase->setCatchUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED']);
} else {
    G::SendMessageText(G::LoadTranslation('ID_CASE_ALREADY_DERIVATED'), 'error');
}
die('<script type="text/javascript">
      if (window.parent.frames.length != 0) {
        parent.location = "open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=unassigned";
      }
      else {
        window.location = "../cases/cases_Open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=unassigned";
      }
      </script>');
Пример #9
0
             $pluginRegistry->installPlugin($pluginDetail->sNamespace);
             //error
         }
         file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
         $licfile = glob(PATH_PLUGINS . "*.dat");
         if (isset($licfile[0]) && is_file($licfile[0])) {
             $licfilename = basename($licfile[0]);
             @copy($licfile[0], PATH_DATA_SITE . $licfilename);
             @unlink($licfile[0]);
         }
         require_once 'classes/model/AddonsStore.php';
         AddonsStore::checkLicenseStore();
         $licenseManager =& pmLicenseManager::getSingleton();
         AddonsStore::updateAll(false);
         $message = G::loadTranslation('ID_ENTERPRISE_INSTALLED') . ' ' . G::loadTranslation('ID_LOG_AGAIN');
         G::SendMessageText($message, "INFO");
         $licenseManager =& pmLicenseManager::getSingleton();
         die('<script type="text/javascript">parent.parent.location = "../login/login";</script>');
     }
 }
 if (!$_FILES['form']['type']['PLUGIN_FILENAME'] == 'application/octet-stream') {
     $pluginFilename = $_FILES['form']['type']['PLUGIN_FILENAME'];
     throw new Exception(G::loadTranslation('ID_FILES_INVALID_PLUGIN_FILENAME', SYS_LANG, array("pluginFilename" => $pluginFilename)));
 }
 G::LoadThirdParty('pear/Archive', 'Tar');
 $tar = new Archive_Tar($path . $filename);
 $sFileName = substr($filename, 0, strrpos($filename, '.'));
 $sClassName = substr($filename, 0, strpos($filename, '-'));
 $sClassName = !empty($sClassName) ? $sClassName : $sFileName;
 $aFiles = $tar->listContent();
 $bMainFile = false;
Пример #10
0
         }
         if (PPP_PASSWORD_HISTORY > 0) {
             //it's looking a password igual into aHistory array that was send for post in md5 way
             $c = 0;
             $sw = 1;
             while (count($aHistory) >= 1 && count($aHistory) > $c && $sw) {
                 if (strcmp(trim($aHistory[$c]), trim($form['USR_PASSWORD'])) == 0) {
                     $sw = 0;
                 }
                 $c++;
             }
             if ($sw == 0) {
                 $sDescription = G::LoadTranslation('ID_POLICY_ALERT') . ':<br /><br />';
                 $sDescription .= ' - ' . G::LoadTranslation('PASSWORD_HISTORY') . ': ' . PPP_PASSWORD_HISTORY . '<br />';
                 $sDescription .= '<br />' . G::LoadTranslation('ID_PLEASE_CHANGE_PASSWORD_POLICY') . '';
                 G::SendMessageText($sDescription, 'warning');
                 G::header('Location: ' . $_SERVER['HTTP_REFERER']);
                 die;
             }
             if (count($aHistory) >= PPP_PASSWORD_HISTORY) {
                 $sLastPassw = array_shift($aHistory);
             }
             $aHistory[] = $form['USR_PASSWORD'];
         }
         $aUserProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s');
         $aUserProperty['USR_LOGGED_NEXT_TIME'] = 1;
         $aUserProperty['USR_PASSWORD_HISTORY'] = serialize($aHistory);
         $oUserProperty->update($aUserProperty);
     }
 }
 $aData['USR_FIRSTNAME'] = $form['USR_FIRSTNAME'];
 public function activateFeatures()
 {
     //Get a list of all Enterprise plugins and active/inactive them
     if (file_exists(PATH_PLUGINS . 'enterprise/data/default')) {
         if ($this->result == "OK") {
             //Disable
             if (file_exists(PATH_PLUGINS . 'enterprise/data/data')) {
                 $oPluginRegistry =& PMPluginRegistry::getSingleton();
                 $aPlugins = unserialize(trim(file_get_contents(PATH_PLUGINS . 'enterprise/data/data')));
                 foreach ($aPlugins as $aPlugin) {
                     $sClassName = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-'));
                     require_once PATH_PLUGINS . $sClassName . '.php';
                     $oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
                     $oPluginRegistry->disablePlugin($oDetails->sNamespace);
                     file_put_contents(PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance());
                 }
                 unlink(PATH_PLUGINS . 'enterprise/data/data');
             }
             //Enable
             $oPluginRegistry =& PMPluginRegistry::getSingleton();
             $aPlugins = unserialize(trim(file_get_contents(PATH_PLUGINS . "enterprise/data/default")));
             foreach ($aPlugins as $aPlugin) {
                 if ($aPlugin["bActive"]) {
                     $sClassName = substr($aPlugin["sFilename"], 0, strpos($aPlugin["sFilename"], "-"));
                     require_once PATH_PLUGINS . $sClassName . ".php";
                     $oDetails = $oPluginRegistry->getPluginDetails($sClassName . ".php");
                     $oPluginRegistry->enablePlugin($oDetails->sNamespace);
                     file_put_contents(PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance());
                 }
             }
             if (file_exists(PATH_DATA_SITE . "ee")) {
                 $aPlugins = unserialize(trim(file_get_contents(PATH_DATA_SITE . 'ee')));
                 $aDenied = array();
                 foreach ($aPlugins as $aPlugin) {
                     $sClassName = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-'));
                     if (!in_array($sClassName, $this->features)) {
                         if (file_exists(PATH_PLUGINS . $sClassName . '.php')) {
                             require_once PATH_PLUGINS . $sClassName . '.php';
                             $oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
                             $oPluginRegistry->disablePlugin($oDetails->sNamespace);
                             file_put_contents(PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance());
                             $aDenied[] = $oDetails->sNamespace;
                         }
                     }
                 }
                 if (!empty($aDenied)) {
                     if (SYS_COLLECTION == "enterprise" && SYS_TARGET == "pluginsList") {
                         G::SendMessageText("The following plugins were restricted due to your enterprise license: " . implode(", ", $aDenied), "INFO");
                     }
                 }
             }
         } else {
             //Disable
             $oPluginRegistry =& PMPluginRegistry::getSingleton();
             $aPlugins = unserialize(trim(file_get_contents(PATH_PLUGINS . 'enterprise/data/default')));
             foreach ($aPlugins as $aPlugin) {
                 $sClassName = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-'));
                 //To avoid self disable
                 if ($sClassName != "pmLicenseManager" && $sClassName != "pmTrial" && $sClassName != "enterprise") {
                     require_once PATH_PLUGINS . $sClassName . '.php';
                     $oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
                     $oPluginRegistry->disablePlugin($oDetails->sNamespace);
                 } else {
                     //Enable default and required plugins
                     require_once PATH_PLUGINS . $sClassName . '.php';
                     $oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
                     $oPluginRegistry->enablePlugin($oDetails->sNamespace);
                 }
             }
             if (file_exists(PATH_DATA_SITE . 'ee')) {
                 $aPlugins = unserialize(trim(file_get_contents(PATH_DATA_SITE . 'ee')));
                 foreach ($aPlugins as $aPlugin) {
                     $sClassName = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-'));
                     if (strlen($sClassName) > 0) {
                         if (!class_exists($sClassName)) {
                             require_once PATH_PLUGINS . $sClassName . '.php';
                         }
                         $oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
                         if ($oDetails) {
                             $oPluginRegistry->disablePlugin($oDetails->sNamespace);
                         }
                     }
                 }
             }
             file_put_contents(PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance());
         }
     }
 }
Пример #12
0
/**
 * translationsSave.php
 *
 * ProcessMaker Open Source Edition
 * Copyright (C) 2004 - 2008 Colosa Inc.23
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
$form = $_POST['form'];
require_once "classes/model/Translation.php";
$form['trn_value'] = preg_replace("[\n|\r|\n\r]", ' ', $form['trn_value']);
//$t = new Translation;
$res = Translation::addTranslation($form['trn_category'], $form['trn_id'], 'en', $form['trn_value']);
if ($res['codError'] < 0) {
    G::SendMessageText($res['message'], 'error');
}
G::Header('location: translations');
Пример #13
0
    $res->status = false;
    $res->message = G::LoadTranslation('ID_UPLOAD_ERR_INI_SIZE');
}
if ($res->status == 0) {
    $message = $res->message;
    G::SendMessageText($message, "ERROR");
    $backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
    G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
    die;
}
//Add Input Document
if (isset($_FILES) && isset($_FILES["form"]) && count($_FILES["form"]) > 0) {
    try {
        $appDocUid = $case->addInputDocument($inputDocumentUid, $appDocUid, $docVersion, $appDocType, $appDocComment, $actionType, $_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["TASK"], $_SESSION["USER_LOGGED"], "xmlform", $_FILES["form"]["name"]["APP_DOC_FILENAME"], $_FILES["form"]["error"]["APP_DOC_FILENAME"], $_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"], $_FILES["form"]["size"]["APP_DOC_FILENAME"]);
    } catch (Exception $e) {
        G::SendMessageText($e->getMessage(), "ERROR");
        $arrayAux = explode("sys" . SYS_SYS, $_SERVER["HTTP_REFERER"]);
        G::header("location: /sys" . SYS_SYS . $arrayAux[1]);
        exit(0);
    }
}
if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) {
    //Trigger - Execute after - Start
    $arrayField["APP_DATA"] = $case->executeTriggers($_SESSION["TASK"], "INPUT_DOCUMENT", $inputDocumentUid, "AFTER", $arrayField["APP_DATA"]);
    //Trigger - Execute after - End
}
//Save data
$arrayData = array();
$arrayData["APP_NUMBER"] = $arrayField["APP_NUMBER"];
//$arrayData["APP_PROC_STATUS"] = $arrayField["APP_PROC_STATUS"];
$arrayData["APP_DATA"] = $arrayField["APP_DATA"];
Пример #14
0
 /**
  * Get data of Cases InputDocument
  *
  * @param string $applicationUid
  * @param string $taskUid
  * @param string $appDocComment
  * @param string $inputDocumentUid
  * @param string $userUid
  *
  * return array Return an array with data of an InputDocument
  */
 public function addCasesInputDocument($applicationUid, $taskUid, $appDocComment, $inputDocumentUid, $userUid)
 {
     try {
         if ((isset( $_FILES['form'] )) && ($_FILES['form']['error'] != 0)) {
             $code = $_FILES['form']['error'];
             switch ($code) {
                 case UPLOAD_ERR_INI_SIZE:
                     $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_INI_SIZE' );
                     break;
                 case UPLOAD_ERR_FORM_SIZE:
                     $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_FORM_SIZE' );
                     break;
                 case UPLOAD_ERR_PARTIAL:
                     $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_PARTIAL' );
                     break;
                 case UPLOAD_ERR_NO_FILE:
                     $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_NO_FILE' );
                     break;
                 case UPLOAD_ERR_NO_TMP_DIR:
                     $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_NO_TMP_DIR' );
                     break;
                 case UPLOAD_ERR_CANT_WRITE:
                     $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_CANT_WRITE' );
                     break;
                 case UPLOAD_ERR_EXTENSION:
                     $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_EXTENSION' );
                     break;
                 default:
                     $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_UNKNOWN' );
                     break;
             }
             \G::SendMessageText( $message, "ERROR" );
             $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] );
             \G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] );
             die();
         }
         \G::LoadClass("case");
         $appDocUid = \G::generateUniqueID();
         $docVersion = '';
         $appDocType = 'INPUT';
         $case = new \Cases();
         $delIndex = \AppDelegation::getCurrentIndex($applicationUid);
         $case->thisIsTheCurrentUser($applicationUid, $delIndex, $userUid, "REDIRECT", "casesListExtJs");
         //Load the fields
         $arrayField = $case->loadCase($applicationUid);
         $arrayField["APP_DATA"] = array_merge($arrayField["APP_DATA"], \G::getSystemConstants());
         //Triggers
         $arrayTrigger = $case->loadTriggers($taskUid, "INPUT_DOCUMENT", $inputDocumentUid, "AFTER");
         //Add Input Document
         if (empty($_FILES)) {
             throw new \Exception(\G::LoadTranslation("ID_CASES_INPUT_FILENAME_DOES_NOT_EXIST"));
         }
         if (!$_FILES["form"]["error"]) {
             $_FILES["form"]["error"] = 0;
         }
         if (isset($_FILES) && isset($_FILES["form"]) && count($_FILES["form"]) > 0) {
             $appDocUid = $case->addInputDocument($inputDocumentUid,
                 $appDocUid,
                 $docVersion,
                 $appDocType,
                 $appDocComment,
                 '',
                 $applicationUid,
                 $delIndex,
                 $taskUid,
                 $userUid,
                 "xmlform",
                 $_FILES["form"]["name"],
                 $_FILES["form"]["error"],
                 $_FILES["form"]["tmp_name"]);
         }
         //Trigger - Execute after - Start
         $arrayField["APP_DATA"] = $case->executeTriggers ($taskUid,
             "INPUT_DOCUMENT",
             $inputDocumentUid,
             "AFTER",
             $arrayField["APP_DATA"]);
         //Trigger - Execute after - End
         //Save data
         $arrayData = array();
         $arrayData["APP_NUMBER"] = $arrayField["APP_NUMBER"];
         //$arrayData["APP_PROC_STATUS"] = $arrayField["APP_PROC_STATUS"];
         $arrayData["APP_DATA"]  = $arrayField["APP_DATA"];
         $arrayData["DEL_INDEX"] = $delIndex;
         $arrayData["TAS_UID"]   = $taskUid;
         $case->updateCase($applicationUid, $arrayData);
         return($this->getCasesInputDocument($applicationUid, $userUid, $appDocUid));
     } catch (\Exception $e) {
         throw $e;
     }
 }
Пример #15
0
     $res = G::verifyInputDocExtension($aID['INP_DOC_TYPE_FILE'], $arrayFileName[$i], $arrayFileTmpName[$i]);
     if ($res->status == 0) {
         $message = $res->message;
         G::SendMessageText($message, "ERROR");
         $backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
         G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
         die;
     }
     //--- Validate Filesize of $_FILE
     $inpDocMaxFilesize = $aID["INP_DOC_MAX_FILESIZE"];
     $inpDocMaxFilesizeUnit = $aID["INP_DOC_MAX_FILESIZE_UNIT"];
     $inpDocMaxFilesize = $inpDocMaxFilesize * ($inpDocMaxFilesizeUnit == "MB" ? 1024 * 1024 : 1024);
     //Bytes
     if ($inpDocMaxFilesize > 0 && $fileSizeByField > 0) {
         if ($fileSizeByField > $inpDocMaxFilesize) {
             G::SendMessageText(G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"), "ERROR");
             $arrayAux1 = explode("sys" . SYS_SYS, $_SERVER["HTTP_REFERER"]);
             G::header("location: /sys" . SYS_SYS . $arrayAux1[1]);
             exit(0);
         }
     }
     $aFields = array("APP_UID" => $_SESSION["APPLICATION"], "DEL_INDEX" => $_SESSION["INDEX"], "USR_UID" => $_SESSION["USER_LOGGED"], "DOC_UID" => $indocUid, "APP_DOC_TYPE" => "INPUT", "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), "APP_DOC_COMMENT" => "", "APP_DOC_TITLE" => "", "APP_DOC_FILENAME" => $arrayFileName[$i], "FOLDER_UID" => $oFolder->createFromPath($aID["INP_DOC_DESTINATION_PATH"]), "APP_DOC_TAGS" => $oFolder->parseTags($aID["INP_DOC_TAGS"]), "APP_DOC_FIELDNAME" => $fieldName);
 } else {
     $aFields = array("APP_UID" => $_SESSION["APPLICATION"], "DEL_INDEX" => $_SESSION["INDEX"], "USR_UID" => $_SESSION["USER_LOGGED"], "DOC_UID" => -1, "APP_DOC_TYPE" => "ATTACHED", "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), "APP_DOC_COMMENT" => "", "APP_DOC_TITLE" => "", "APP_DOC_FILENAME" => $arrayFileName[$i], "APP_DOC_FIELDNAME" => $fieldName);
 }
 $oAppDocument = new AppDocument();
 $oAppDocument->create($aFields);
 $iDocVersion = $oAppDocument->getDocVersion();
 $sAppDocUid = $oAppDocument->getAppDocUid();
 $aInfo = pathinfo($oAppDocument->getAppDocFilename());
 $sExtension = isset($aInfo["extension"]) ? $aInfo["extension"] : "";
}
$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']);
    }
}
Пример #17
0
            case -1:

                $errLabel = 'WRONG_LOGIN_CREDENTIALS';

                break;

            //The password is incorrect

            case -2:

                $errLabel = 'WRONG_LOGIN_CREDENTIALS';

                if (isset($_SESSION['__AUTH_ERROR__'])) {

                    G::SendMessageText($_SESSION['__AUTH_ERROR__'], "warning");

                    unset($_SESSION['__AUTH_ERROR__']);

                }

                break;

            //The user is inactive

            case -3:

                require_once 'classes/model/Users.php';

                $user = new Users();
Пример #18
0
try {
    //Loading data for a Jump request
    if (! isset( $_GET['APP_UID'] ) && isset( $_GET['APP_NUMBER'] )) {
        $_GET['APP_UID'] = $oCase->getApplicationUIDByNumber( $_GET['APP_NUMBER'] );
        $_GET['DEL_INDEX'] = $oCase->getCurrentDelegation( $_GET['APP_UID'], $_SESSION['USER_LOGGED'] );

        //if the application doesn't exist
        if (is_null( $_GET['APP_UID'] )) {
            G::SendMessageText( G::LoadTranslation( 'ID_CASE_DOES_NOT_EXISTS' ), 'info' );
            G::header( 'location: casesListExtJs' );
            exit();
        }

        //if the application exists but the
        if (is_null( $_GET['DEL_INDEX'] )) {
            G::SendMessageText( G::LoadTranslation( 'ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER' ), 'info' );
            G::header( 'location: casesListExtJs' );
            exit();
        }
        //wrong implemented, need refactored
        //$participated = $oCase->userParticipatedInCase($_GET['APP_UID'], $_SESSION['USER_LOGGED']); ???????
    }

    $sAppUid = $_GET['APP_UID'];
    $iDelIndex = $_GET['DEL_INDEX'];
    $_action = isset( $_GET['action'] ) ? $_GET['action'] : '';

    //loading application data
    $aFields = $oCase->loadCase( $sAppUid, $iDelIndex );
    //  g::pr($aFields);
    //  die;
Пример #19
0
 public function enterprisePlugin($sNamespace, $sFilename = null)
 {
     $pathPluginTrunk = PATH_CORE . "enterprise";
     $VERSION = System::getVersion();
     $res = parent::PMPlugin($sNamespace, $sFilename);
     $this->sFriendlyName = "ProcessMaker Enterprise Core Edition";
     $this->sDescription = "ProcessMaker Enterprise Core Edition {$VERSION}";
     $this->sPluginFolder = "enterprise";
     $this->sSetupPage = "../enterprise/addonsStore.php";
     $this->iVersion = $VERSION;
     $this->iPMVersion = "2.0.31";
     $this->aDependences = null;
     $this->aWorkspaces = null;
     $this->database = "workflow";
     $this->table = array("ADDONS_STORE", "ADDONS_MANAGER", "LICENSE_MANAGER");
     if (!isset($_SESSION["__EE_INSTALLATION__"])) {
         $_SESSION["__EE_INSTALLATION__"] = 0;
     }
     if (!isset($_SESSION["__EE_SW_PMLICENSEMANAGER__"])) {
         $_SESSION["__EE_SW_PMLICENSEMANAGER__"] = 1;
     }
     $sw = 1;
     $msgf = null;
     $msgd = null;
     if (file_exists(PATH_CORE . "plugins" . PATH_SEP . "pmLicenseManager.php")) {
         $_SESSION["__EE_INSTALLATION__"] = 1;
         $_SESSION["__EE_SW_PMLICENSEMANAGER__"] = 0;
         $plugin = "pmLicenseManager";
         $this->pluginUninstall($plugin);
         if (file_exists(PATH_CORE . "plugins" . PATH_SEP . $plugin . ".php") || file_exists(PATH_CORE . "plugins" . PATH_SEP . $plugin)) {
             $msgf = $msgf . ($msgf != null ? ", " : null) . $plugin . ".php";
             $msgd = $msgd . ($msgd != null ? ", " : null) . $plugin;
             $sw = 0;
         }
         $plugin = "enterprise";
         $this->pluginUninstall($plugin);
         if (file_exists(PATH_CORE . "plugins" . PATH_SEP . $plugin . ".php") || file_exists(PATH_CORE . "plugins" . PATH_SEP . $plugin)) {
             $msgf = $msgf . ($msgf != null ? ", " : null) . $plugin . ".php";
             $msgd = $msgd . ($msgd != null ? ", " : null) . $plugin;
             $sw = 0;
         }
         $this->uninstall();
     } else {
         $_SESSION["__EE_INSTALLATION__"] = $_SESSION["__EE_INSTALLATION__"] + 1;
     }
     if ($sw == 0) {
         unset($_SESSION["__EE_INSTALLATION__"]);
         unset($_SESSION["__EE_SW_PMLICENSEMANAGER__"]);
         ///////
         $js = "window.open(\"/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main?s=PLUGINS\", \"_top\", \"\");";
         if (substr(SYS_SKIN, 0, 2) == "ux" && SYS_SKIN != "uxs") {
             //$js = "parent.window.location.href = \"/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main_init?s=PLUGINS\";";
             //$js = "window.location.href = \"/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/pluginsImport\";";
             $js = "window.open(\"/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/main\", \"_top\", \"\");";
         }
         ///////
         G::SendMessageText("ProcessMaker Enterprise plug-in can't delete the files \"{$msgf}\" and directories \"{$msgd}\" of \"" . (PATH_CORE . "plugins") . "\". Before proceeding with the installation of the plug-in must remove them.", "INFO");
         echo "<script type=\"text/javascript\">" . $js . "</script>";
         exit(0);
     }
     if ($_SESSION["__EE_SW_PMLICENSEMANAGER__"] == 0 && $_SESSION["__EE_INSTALLATION__"] == 2) {
         unset($_SESSION["__EE_INSTALLATION__"]);
         unset($_SESSION["__EE_SW_PMLICENSEMANAGER__"]);
         $this->install();
     }
     ///////
     return $res;
 }