function saveAuthSources($params)
 {
     global $RBAC;
     if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) {
         G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
         G::header('location: ../login/login');
         die;
     }
     $aCommonFields = array('AUTH_SOURCE_UID', 'AUTH_SOURCE_NAME', 'AUTH_SOURCE_PROVIDER', 'AUTH_SOURCE_SERVER_NAME', 'AUTH_SOURCE_PORT', 'AUTH_SOURCE_ENABLED_TLS', 'AUTH_ANONYMOUS', 'AUTH_SOURCE_SEARCH_USER', 'AUTH_SOURCE_PASSWORD', 'AUTH_SOURCE_VERSION', 'AUTH_SOURCE_BASE_DN', 'AUTH_SOURCE_OBJECT_CLASSES', 'AUTH_SOURCE_ATTRIBUTES');
     $aFields = $aData = array();
     unset($params->PHPSESSID);
     foreach ($params as $sField => $sValue) {
         if (in_array($sField, $aCommonFields)) {
             $aFields[$sField] = $sField == 'AUTH_SOURCE_ENABLED_TLS' || $sField == 'AUTH_ANONYMOUS' ? $sValue == 'yes' ? 1 : 0 : $sValue;
         } else {
             $aData[$sField] = $sValue;
         }
     }
     $aFields['AUTH_SOURCE_DATA'] = $aData;
     if ($aFields['AUTH_SOURCE_UID'] == '') {
         $RBAC->createAuthSource($aFields);
     } else {
         $RBAC->updateAuthSource($aFields);
     }
     $data = array();
     $data['success'] = true;
     return $data;
 }
 public function __construct()
 {
     $licensedFeatures =& PMLicensedFeatures::getSingleton();
     if (!$licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
         G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
         G::header('location: ../login/login');
         die;
     }
     $this->loadSettings();
 }
 public function __construct()
 {
     global $RBAC;
     if ($RBAC->userCanAccess('PM_DASHBOARD') != 1) {
         G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
         G::header('location: login/login');
         exit(0);
     }
     G::LoadClass('pmDashlet');
     $this->pmDashlet = new PMDashlet();
 }
                 * Description: this was added for the additional database connections */
                G::LoadClass('dbConnections');
                $oDbConnections = new dbConnections($_SESSION['PROCESS']);
                $oDbConnections->loadAdditionalConnections();
                $stepFilename = "{$sNamespace}/{$sStepName}";
                G::evalJScript("\n        if (parent.setCurrent) {\n          parent.setCurrent('" . $_GET['UID'] . "');\n        }");
                $G_PUBLISH->AddContent('content', $stepFilename);
            } else {
                $aMessage['MESSAGE'] = G::loadTranslation('ID_EXTERNAL_STEP_MISSING', SYS_LANG, array("plugin" => $sNamespace));
                $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
            }
            break;
    }
    //Add content content step - End
} catch (Exception $e) {
    G::SendTemporalMessage(G::LoadTranslation('ID_PROCESS_DEF_PROBLEM'), 'error', 'string', 3, 100);
    $aMessage = array();
    $aMessage['MESSAGE'] = $e->getMessage();
    $G_PUBLISH = new Publisher();
    $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
    G::RenderPage('publish', 'blank');
    die;
}
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptFile("/jscore/cases/core/cases_Step.js");
$oHeadPublisher->addScriptCode("\n  if (typeof parent != 'undefined') {\n    if (parent.showCaseNavigatorPanel) {\n      parent.showCaseNavigatorPanel('{$sStatus}');\n    }\n\n    if (parent.setCurrent) {\n      parent.setCurrent('" . $_GET['UID'] . "');\n    }\n  }");
G::RenderPage('publish', 'blank');
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
    G::evalJScript('
    if (typeof showdebug != \'undefined\') {
      showdebug();
        $controllerAction = SYS_TARGET != '' ? SYS_TARGET : 'index';
        //if the method exists
        if (is_callable(array($controllerClass, $controllerAction))) {
            $isControllerCall = true;
        }
    }
    if (!$isControllerCall && !file_exists($phpFile)) {
        $_SESSION['phpFileNotFound'] = $_SERVER['REQUEST_URI'];
        header("location: /errors/error404.php?url=" . urlencode($_SERVER['REQUEST_URI']));
        die;
    }
}
//redirect to login, if user changed the workspace in the URL
if (!$avoidChangedWorkspaceValidation && isset($_SESSION['WORKSPACE']) && $_SESSION['WORKSPACE'] != SYS_SYS) {
    $_SESSION['WORKSPACE'] = SYS_SYS;
    G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', "error");
    // verify if the current skin is a 'ux' variant
    $urlPart = substr(SYS_SKIN, 0, 2) == 'ux' && SYS_SKIN != 'uxs' ? '/main/login' : '/login/login';
    header('Location: /sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . $urlPart);
    die;
}
// enable rbac
$RBAC =& RBAC::getSingleton(PATH_DATA, session_id());
$RBAC->sSystem = 'PROCESSMAKER';
// define and send Headers for all pages
if (!defined('EXECUTE_BY_CRON')) {
    header("Expires: " . gmdate("D, d M Y H:i:s", mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'))) . " GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
 /**
  * Evaluate the current script
  *
  * @return void
  */
 public function evaluate()
 {
     $bResult = null;
     $sScript = '';
     $iAux = 0;
     $bEqual = false;
     $variableIsDefined = true;
     $iOcurrences = preg_match_all('/\\@(?:([\\@\\%\\#\\?\\$\\=])([a-zA-Z\\_]\\w*)|([a-zA-Z\\_][\\w\\-\\>\\:]*)\\(((?:[^\\\\\\)]' . '*(?:[\\\\][\\w\\W])?)*)\\))((?:\\s*\\[[\'"]?\\w+[\'"]?\\])+)?/', $this->sScript, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
     if ($iOcurrences) {
         for ($i = 0; $i < $iOcurrences; $i++) {
             // if the variables for that condition has not been previously defined then $variableIsDefined
             // is set to false
             if (!isset($this->aFields[$aMatch[2][$i][0]]) && !isset($aMatch[5][$i][0])) {
                 $this->aFields[$aMatch[2][$i][0]] = '';
             } else {
                 if (!isset($this->aFields[$aMatch[2][$i][0]])) {
                     eval("\$this->aFields['" . $aMatch[2][$i][0] . "']" . $aMatch[5][$i][0] . " = '';");
                 } else {
                     if (isset($aMatch[5][$i][0])) {
                         eval("if (!isset(\$this->aFields['" . $aMatch[2][$i][0] . "']" . $aMatch[5][$i][0] . ")) {\$this->aFields['" . $aMatch[2][$i][0] . "']" . $aMatch[5][$i][0] . " = '';}");
                     } else {
                         eval("if (!isset(\$this->aFields['" . $aMatch[2][$i][0] . "'])) {\$this->aFields['" . $aMatch[2][$i][0] . "'] = '';}");
                     }
                 }
             }
             $sAux = substr($this->sScript, $iAux, $aMatch[0][$i][1] - $iAux);
             if (!$bEqual) {
                 if (strpos($sAux, '=') !== false) {
                     $bEqual = true;
                 }
             }
             if ($bEqual) {
                 if (strpos($sAux, ';') !== false) {
                     $bEqual = false;
                 }
             }
             $sScript .= $sAux;
             $iAux = $aMatch[0][$i][1] + strlen($aMatch[0][$i][0]);
             switch ($aMatch[1][$i][0]) {
                 case '@':
                     if ($bEqual) {
                         if (!isset($aMatch[5][$i][0])) {
                             $sScript .= "pmToString(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
                         } else {
                             $sScript .= "pmToString(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
                         }
                     } else {
                         if (!isset($aMatch[5][$i][0])) {
                             $sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
                         } else {
                             $sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
                         }
                     }
                     break;
                 case '%':
                     if ($bEqual) {
                         if (!isset($aMatch[5][$i][0])) {
                             $sScript .= "pmToInteger(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
                         } else {
                             $sScript .= "pmToInteger(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
                         }
                     } else {
                         if (!isset($aMatch[5][$i][0])) {
                             $sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
                         } else {
                             $sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
                         }
                     }
                     break;
                 case '#':
                     if ($bEqual) {
                         if (!isset($aMatch[5][$i][0])) {
                             $sScript .= "pmToFloat(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
                         } else {
                             $sScript .= "pmToFloat(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
                         }
                     } else {
                         if (!isset($aMatch[5][$i][0])) {
                             $sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
                         } else {
                             $sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
                         }
                     }
                     break;
                 case '?':
                     if ($bEqual) {
                         if (!isset($aMatch[5][$i][0])) {
                             $sScript .= "pmToUrl(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
                         } else {
                             $sScript .= "pmToUrl(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
                         }
                     } else {
                         if (!isset($aMatch[5][$i][0])) {
                             $sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
                         } else {
                             $sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
                         }
                     }
                     break;
                 case '$':
                     if ($bEqual) {
                         if (!isset($aMatch[5][$i][0])) {
                             $sScript .= "pmSqlEscape(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
                         } else {
                             $sScript .= "pmSqlEscape(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
                         }
                     } else {
                         if (!isset($aMatch[5][$i][0])) {
                             $sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
                         } else {
                             $sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
                         }
                     }
                     break;
                 case '=':
                     if ($bEqual) {
                         if (!isset($aMatch[5][$i][0])) {
                             $sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
                         } else {
                             $sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
                         }
                     } else {
                         if (!isset($aMatch[5][$i][0])) {
                             $sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
                         } else {
                             $sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
                         }
                     }
                     break;
             }
         }
     }
     $sScript .= substr($this->sScript, $iAux);
     $sScript = '$bResult = ' . $sScript . ';';
     // checks if the syntax is valid or if the variables in that condition has been previously defined
     if ($this->validSyntax($sScript) && $variableIsDefined) {
         $this->bError = false;
         eval($sScript);
     } else {
         // echo "<script> alert('".G::loadTranslation('MSG_CONDITION_NOT_DEFINED')."'); </script>";
         G::SendTemporalMessage('MSG_CONDITION_NOT_DEFINED', 'error', 'labels');
         $this->bError = true;
     }
     return $bResult;
 }
    /**

     * download a File

     *

     * @param $file file to download

     * @param $local_path path of the file

     * @param $newfilename

     * @return $errorMsg process list.

     */

    public function downloadFile ($file, $local_path, $newfilename)

    {

        $err_msg = '';

        $out = fopen( $local_path . $newfilename, 'wb' );

        if ($out == false) {

            throw (new Exception( "File $newfilename not opened" ));

        }



        if (! function_exists( 'curl_init' )) {

            G::SendTemporalMessage( 'ID_CURLFUN_ISUNDEFINED', "warning", 'LABEL', '', '100%', '' );

            G::header( 'location: ../processes/processes_Library' );

            die();

        }

        $ch = curl_init();



        curl_setopt( $ch, CURLOPT_FILE, $out );

        curl_setopt( $ch, CURLOPT_HEADER, 0 );

        curl_setopt( $ch, CURLOPT_URL, $file );



        curl_exec( $ch );

        $errorMsg = curl_error( $ch );

        fclose( $out );



        curl_close( $ch );

        return $errorMsg;



    } //end function
 * 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.
 */
//validate the data post
if (!isset($_SESSION['USER_LOGGED'])) {
    G::SendTemporalMessage('ID_LOGIN_AGAIN', 'warning', 'labels');
    die('<script type="text/javascript">
                    parent.location = "../cases/casesStartPage?action=startCase";
                    </script>');
}
try {
    if ($_GET['APP_UID'] !== $_SESSION['APPLICATION']) {
        throw new Exception(G::LoadTranslation('ID_INVALID_APPLICATION_ID_MSG', array('<a href=\'' . $_SERVER['HTTP_REFERER'] . '\'>{1}</a>', G::LoadTranslation('ID_REOPEN'))));
    }
    $oForm = new Form($_SESSION["PROCESS"] . "/" . $_GET["UID"], PATH_DYNAFORM);
    $oForm->validatePost();
    //Includes
    G::LoadClass("case");
    //Load the variables
    $oCase = new Cases();
    $oCase->thisIsTheCurrentUser($_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["USER_LOGGED"], "REDIRECT", "casesListExtJs");
     }
     if ($_FILES['form']['error']['USR_PHOTO'] != 1) {
         if ($_FILES['form']['tmp_name']['USR_PHOTO'] != '') {
             $aAux = explode('.', $_FILES['form']['name']['USR_PHOTO']);
             G::uploadFile($_FILES['form']['tmp_name']['USR_PHOTO'], PATH_IMAGES_ENVIRONMENT_USERS, $aData['USR_UID'] . '.' . $aAux[1]);
             G::resizeImage(PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.' . $aAux[1], 96, 96, PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.gif');
         }
     } else {
         G::SendTemporalMessage('ID_FILE_TOO_BIG', 'error');
     }
     if ($_FILES['form']['error']['USR_RESUME'] != 1) {
         if ($_FILES['form']['tmp_name']['USR_RESUME'] != '') {
             G::uploadFile($_FILES['form']['tmp_name']['USR_RESUME'], PATH_IMAGES_ENVIRONMENT_FILES . $aData['USR_UID'] . '/', $_FILES['form']['name']['USR_RESUME']);
         }
     } else {
         G::SendTemporalMessage('ID_FILE_TOO_BIG', 'error');
     }
 }
 if ($_SESSION['USER_LOGGED'] == $form['USR_UID']) {
     /*UPDATING SESSION VARIABLES*/
     $aUser = $RBAC->userObj->load($_SESSION['USER_LOGGED']);
     $_SESSION['USR_FULLNAME'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
 }
 //Save Calendar assigment
 if (isset($form['USR_CALENDAR'])) {
     //Save Calendar ID for this user
     G::LoadClass("calendar");
     $calendarObj = new Calendar();
     $calendarObj->assignCalendarTo($aData['USR_UID'], $form['USR_CALENDAR'], 'USER');
 }
 G::header('location: users_List');
Exemple #10
0
    if ($_POST['form']['USR_RESUME'] != '') {
        $aData['USR_RESUME'] = $_POST['form']['USR_RESUME'];
    }
    require_once 'classes/model/Users.php';
    $oUser = new Users();
    $oUser->update($aData);
    if ($_FILES['form']['tmp_name']['USR_PHOTO'] != '') {
        $aAux = explode('.', $_FILES['form']['name']['USR_PHOTO']);
        G::uploadFile($_FILES['form']['tmp_name']['USR_PHOTO'], PATH_IMAGES_ENVIRONMENT_USERS, $aData['USR_UID'] . '.' . $aAux[1]);
        G::resizeImage(PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.' . $aAux[1], 96, 96, PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.gif');
    }
    if ($_FILES['form']['tmp_name']['USR_RESUME'] != '') {
        G::uploadFile($_FILES['form']['tmp_name']['USR_RESUME'], PATH_IMAGES_ENVIRONMENT_FILES . $aData['USR_UID'] . '/', $_FILES['form']['name']['USR_RESUME']);
    }
    /* Saving preferences */
    $def_lang = $_POST['form']['PREF_DEFAULT_LANG'];
    $def_menu = $_POST['form']['PREF_DEFAULT_MENUSELECTED'];
    $def_cases_menu = $_POST['form']['PREF_DEFAULT_CASES_MENUSELECTED'];
    G::loadClass('configuration');
    $oConf = new Configurations();
    $aConf = array('DEFAULT_LANG' => $def_lang, 'DEFAULT_MENU' => $def_menu, 'DEFAULT_CASES_MENU' => $def_cases_menu);
    /*UPDATING SESSION VARIABLES*/
    $aUser = $RBAC->userObj->load($_SESSION['USER_LOGGED']);
    $_SESSION['USR_FULLNAME'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
    $oConf->aConfig = $aConf;
    $oConf->saveConfig('USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED']);
    G::SendTemporalMessage('ID_CHANGES_SAVED', 'info', 'labels');
    G::header('location: myInfo');
} catch (Exception $oException) {
    die($oException->getMessage());
}
 function saveCalendarBusinessHours($aData)
 {
     $CalendarUid = $aData['CALENDAR_UID'];
     $CalendarBusinessDay = $aData['CALENDAR_BUSINESS_DAY'];
     $CalendarBusinessStart = $aData['CALENDAR_BUSINESS_START'];
     $CalendarBusinessEnd = $aData['CALENDAR_BUSINESS_END'];
     //if exists the row in the database propel will update it, otherwise will insert.
     $tr = CalendarBusinessHoursPeer::retrieveByPK($CalendarUid, $CalendarBusinessDay, $CalendarBusinessStart, $CalendarBusinessEnd);
     if (!(is_object($tr) && get_class($tr) == 'CalendarBusinessHours')) {
         $tr = new CalendarBusinessHours();
     }
     $tr->setCalendarUid($CalendarUid);
     $tr->setCalendarBusinessDay($CalendarBusinessDay);
     $tr->setCalendarBusinessStart($CalendarBusinessStart);
     $tr->setCalendarBusinessEnd($CalendarBusinessEnd);
     if ($tr->validate()) {
         // we save it, since we get no validation errors, or do whatever else you like.
         $res = $tr->save();
     } else {
         // Something went wrong. We can now get the validationFailures and handle them.
         $msg = $CalendarBusinessDay . '<hr/>';
         $validationFailuresArray = $tr->getValidationFailures();
         foreach ($validationFailuresArray as $objValidationFailure) {
             $msg .= $objValidationFailure->getMessage() . "<br/>";
         }
         //return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
         G::SendTemporalMessage($msg);
     }
     //return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => '');
     //to do: uniform  coderror structures for all classes
     //if ( $res['codError'] < 0 ) {
     //  G::SendMessageText ( $res['message'] , 'error' );
     //}
 }
/**
 *
 * @method
 *
 * Routes (derivates) a case and then displays the case list.
 *
 * @name jumping
 * @label jumping
 * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#jumping.28.29
 *
 * @param string(32) | $caseId | Case ID | The unique ID for the case to be routed (derivated).
 * @param int | $delIndex | delegation Index of case | The delegation index of the task to be routed (derivated). Counting starts from 1.
 * @return none | $none | None | None
 *
 */
function jumping($caseId, $delIndex)
{
    try {
        $x = PMFDerivateCase($caseId, $delIndex);
        if ($x == 0) {
            G::SendTemporalMessage('ID_NOT_DERIVATED', 'error', 'labels');
        }
    } catch (Exception $oException) {
        G::SendTemporalMessage('ID_NOT_DERIVATED', 'error', 'labels');
    }
    G::header('Location: casesListExtJs');
}
        $snameLogo = str_replace("[Ñ]", "N", $snameLogo);
        return $snameLogo;
    }
    $sfunction = $_GET['function'];
    switch ($sfunction) {
        case 'replacementLogo':
            $snameLogo = urldecode($_GET['NAMELOGO']);
            $snameLogo = trim($snameLogo);
            $snameLogo = changeNamelogo($snameLogo);
            G::loadClass('configuration');
            $oConf = new Configurations();
            $aConf = array('WORKSPACE_LOGO_NAME' => SYS_SYS, 'DEFAULT_LOGO_NAME' => $snameLogo);
            $oConf->aConfig = $aConf;
            $oConf->saveConfig('USER_LOGO_REPLACEMENT', '', '', '');
            G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels');
            //header('location: uplogo.php');
            //G::header('location: uplogo');
            break;
        case 'restoreLogo':
            $snameLogo = $_GET['NAMELOGO'];
            G::loadClass('configuration');
            $oConf = new Configurations();
            $aConf = array('WORKSPACE_LOGO_NAME' => '', 'DEFAULT_LOGO_NAME' => '');
            $oConf->aConfig = $aConf;
            $oConf->saveConfig('USER_LOGO_REPLACEMENT', '', '', '');
            G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels');
            break;
    }
} catch (Exception $oException) {
    die($oException->getMessage());
}
 *
 * 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.
 */
$pluginFile = $_GET['id'];
G::LoadClass('plugin');
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$details = $oPluginRegistry->getPluginDetails($pluginFile);
try {
    $Fields = $oPluginRegistry->updateFieldsForPageSetup($details->sNamespace, $_POST);
    $str = "{$Fields} fields saved successfully!";
    G::SendTemporalMessage($str, 'info', 'string', 3, 100);
    G::Header("location: pluginsSetup?id={$pluginFile}");
} catch (Exception $e) {
    $G_MAIN_MENU = 'processmaker';
    $G_ID_MENU_SELECTED = 'SETUP';
    $G_SUB_MENU = 'setup';
    $G_ID_SUB_MENU_SELECTED = 'PLUGINS';
    $G_PUBLISH = new Publisher();
    $aMessage['MESSAGE'] = $e->getMessage();
    $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
    G::RenderPage('publish');
}
 /**
  * Replacement Logo
  * @global type $_REQUEST
  * @global type $RBAC
  */
 public function replacementLogo()
 {
     global $_REQUEST;
     $sfunction = $_REQUEST['nameFunction'];
     $_GET['NAMELOGO'] = $_REQUEST['NAMELOGO'];
     try {
         global $RBAC;
         switch ($RBAC->userCanAccess('PM_LOGIN')) {
             case -2:
                 G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
                 G::header('location: ../login/login');
                 die;
                 break;
             case -1:
                 G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
                 G::header('location: ../login/login');
                 die;
                 break;
         }
         switch ($sfunction) {
             case 'replacementLogo':
                 $snameLogo = urldecode($_GET['NAMELOGO']);
                 $snameLogo = trim($snameLogo);
                 $snameLogo = self::changeNamelogo($snameLogo);
                 G::loadClass('configuration');
                 $oConf = new Configurations();
                 $aConf = array('WORKSPACE_LOGO_NAME' => SYS_SYS, 'DEFAULT_LOGO_NAME' => $snameLogo);
                 $oConf->aConfig = $aConf;
                 $oConf->saveConfig('USER_LOGO_REPLACEMENT', '', '', '');
                 G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels');
                 break;
             case 'restoreLogo':
                 $snameLogo = $_GET['NAMELOGO'];
                 G::loadClass('configuration');
                 $oConf = new Configurations();
                 $aConf = array('WORKSPACE_LOGO_NAME' => '', 'DEFAULT_LOGO_NAME' => '');
                 $oConf->aConfig = $aConf;
                 $oConf->saveConfig('USER_LOGO_REPLACEMENT', '', '', '');
                 G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels');
                 break;
         }
     } catch (Exception $oException) {
         die($oException->getMessage());
     }
     exit;
 }
        if (CaseTrackerPeer::doCount($criteria) === 0) {
            $permissionsCaseTracker = array('PRO_UID' => $_SESSION['PROCESS'], 'CT_MAP_TYPE' => 'PROCESSMAP', 'CT_DERIVATION_HISTORY' => 1, 'CT_MESSAGE_HISTORY' => 1);
            $caseTracker->create($permissionsCaseTracker);
        }
        $caseTracker = $cases->caseTrackerPermissions($_SESSION['PROCESS']);
        if ($caseTracker['CT_MAP_TYPE']) {
            G::header('location: tracker_ViewMap');
        } else {
            if ($caseTracker['DYNADOC']) {
                G::header("location: tracker_DynaDocs");
            } else {
                if ($caseTracker['CT_DERIVATION_HISTORY']) {
                    G::header("location: tracker_History");
                } else {
                    if ($caseTracker['CT_MESSAGE_HISTORY']) {
                        G::header("location: tracker_No");
                    } else {
                        G::header("location: login.php");
                        G::SendTemporalMessage('ID_ACCOUNT_DISABLED_CONTACT_ADMIN', "error");
                    }
                }
            }
        }
    }
} catch (Exception $e) {
    $aMessage['MESSAGE'] = $e->getMessage();
    $G_PUBLISH = new Publisher();
    $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
    G::RenderPage('publish');
    die;
}
    $passwd = $oSpool->config['MESS_PASSWORD'];
    $passwdDec = G::decrypt($passwd, 'EMAILENCRYPT');
    $auxPass = explode('hash:', $passwdDec);
    if (count($auxPass) > 1) {
        if (count($auxPass) == 2) {
            $passwd = $auxPass[1];
        } else {
            array_shift($auxPass);
            $passwd = implode('', $auxPass);
        }
    }
    $oSpool->config['MESS_PASSWORD'] = $passwd;
    $oSpool->create(array('msg_uid' => '', 'app_uid' => '', 'del_index' => 0, 'app_msg_type' => 'TEST', 'app_msg_subject' => $sSubject, 'app_msg_from' => $sFrom, 'app_msg_to' => $data['USR_EMAIL'], 'app_msg_body' => $sBody, 'app_msg_cc' => '', 'app_msg_bcc' => '', 'app_msg_attach' => '', 'app_msg_template' => '', 'app_msg_status' => 'pending', 'app_msg_attach' => ''));
    try {
        $oSpool->sendMail();
        $rbacUser->update($aData);
        $user->update($aData);
        G::header("location: login.html");
        G::SendTemporalMessage('ID_NEW_PASSWORD_SENT', "info");
    } catch (phpmailerException $e) {
        G::header("location: login.html");
        G::SendTemporalMessage(G::LoadTranslation('MISSING_OR_NOT_CONFIGURED_SMTP'), "warning", 'string');
    } catch (Exception $e) {
        G::header("location: login.html");
        G::SendTemporalMessage($e->getMessage(), "warning", 'string');
    }
} else {
    $msg = G::LoadTranslation('ID_USER') . ' ' . htmlentities($data['USR_USERNAME'], ENT_QUOTES, 'UTF-8') . ' ' . G::LoadTranslation('ID_IS_NOT_REGISTERED');
    G::SendTemporalMessage($msg, "warning", 'string');
    G::header('location: forgotPassword');
}
$kk = new Criteria();
$kk->add(ContentPeer::CON_LANG, $_GET['LAN_ID']);
$oDataset = ContentPeer::doSelectRS($kk);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow1 = $oDataset->getRow();
if (is_array($aRow1)) {
    $G_PUBLISH = new Publisher();
    $G_MAIN_MENU = 'processmaker';
    $G_ID_MENU_SELECTED = 'SETUP';
    $G_SUB_MENU = 'setup';
    $G_ID_SUB_MENU_SELECTED = 'LANGUAGES';
    //$aMessage['MESSAGE'] = G::LoadTranslation('CANT_DEL_LANGUAGE');//"you can't delete this language is in use";
    //$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/showMessage', '', $aMessage );
    //G::RenderPage('publishBlank', 'blank');
    G::SendTemporalMessage('CANT_DEL_LANGUAGE', 'error', 'labels');
    G::header('location: languages');
} else {
    /*the reason why comment it was because when delete some language,we're losing some labels about this language*/
    $oCriteria = new Criteria('workflow');
    $oCriteria->add(ContentPeer::CON_LANG, $_GET['LAN_ID']);
    ContentPeer::doDelete($oCriteria);
    /*
     $oCriteria1 = new Criteria('workflow');
     $oCriteria1->add(LanguagePeer::LAN_ENABLED, 0);
     $oCriteria2 = new Criteria('workflow');
     $oCriteria2->add(LanguagePeer::LAN_ID, $_GET['LAN_ID']);
     LanguagePeer::doUpdate($oCriteria2, $oCriteria1, Propel::getConnection('workflow'));
    */
    $aLanguage['LAN_ID'] = $_GET['LAN_ID'];
    $aLanguage['LAN_ENABLED'] = 0;
 function verifyIsCaseChild($sApplicationUID)
 {
     //Obtain the related row in the table SUB_APPLICATION
     $oCriteria = new Criteria('workflow');
     $oCriteria->add(SubApplicationPeer::APP_UID, $sApplicationUID);
     $oDataset = SubApplicationPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aSA = $oDataset->getRow();
     if ($aSA) {
         //Obtain the related row in the table SUB_PROCESS
         $oCase = new Cases();
         $aParentCase = $oCase->loadCase($aSA['APP_PARENT'], $aSA['DEL_INDEX_PARENT']);
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(SubProcessPeer::PRO_PARENT, $aParentCase['PRO_UID']);
         $oCriteria->add(SubProcessPeer::TAS_PARENT, $aParentCase['TAS_UID']);
         $oDataset = SubProcessPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         $aSP = $oDataset->getRow();
         if ($aSP['SP_SYNCHRONOUS'] == 1) {
             $appFields = $oCase->loadCase($sApplicationUID);
             //Copy case variables to parent case
             $aFields = unserialize($aSP['SP_VARIABLES_IN']);
             $aNewFields = array();
             foreach ($aFields as $sOriginField => $sTargetField) {
                 $sOriginField = str_replace('@', '', $sOriginField);
                 $sOriginField = str_replace('#', '', $sOriginField);
                 $sTargetField = str_replace('@', '', $sTargetField);
                 $sTargetField = str_replace('#', '', $sTargetField);
                 $aNewFields[$sTargetField] = isset($appFields['APP_DATA'][$sOriginField]) ? $appFields['APP_DATA'][$sOriginField] : '';
             }
             $aParentCase['APP_DATA'] = array_merge($aParentCase['APP_DATA'], $aNewFields);
             $oCase->updateCase($aSA['APP_PARENT'], $aParentCase);
             //Update table SUB_APPLICATION
             $oSubApplication = new SubApplication();
             $oSubApplication->update(array('APP_UID' => $sApplicationUID, 'APP_PARENT' => $aSA['APP_PARENT'], 'DEL_INDEX_PARENT' => $aSA['DEL_INDEX_PARENT'], 'DEL_THREAD_PARENT' => $aSA['DEL_THREAD_PARENT'], 'SA_STATUS' => 'FINISHED', 'SA_VALUES_IN' => serialize($aNewFields), 'SA_FINISH_DATE' => date('Y-m-d H:i:s')));
             //Derive the parent case
             $aDeriveTasks = $this->prepareInformation(array('USER_UID' => -1, 'APP_UID' => $aSA['APP_PARENT'], 'DEL_INDEX' => $aSA['DEL_INDEX_PARENT']));
             if (isset($aDeriveTasks[1])) {
                 if ($aDeriveTasks[1]['ROU_TYPE'] != 'SELECT') {
                     $nextDelegations2 = array();
                     foreach ($aDeriveTasks as $aDeriveTask) {
                         if (!isset($aDeriveTask['NEXT_TASK']['USER_ASSIGNED']['USR_UID'])) {
                             $selectedUser = $aDeriveTask['NEXT_TASK']['USER_ASSIGNED'][0];
                             unset($aDeriveTask['NEXT_TASK']['USER_ASSIGNED']);
                             $aDeriveTask['NEXT_TASK']['USER_ASSIGNED'] = $selectedUser;
                             $myLabels = array($aDeriveTask['NEXT_TASK']['TAS_TITLE'], $aParentCase['APP_NUMBER'], $selectedUser['USR_USERNAME'], $selectedUser['USR_FIRSTNAME'], $selectedUser['USR_LASTNAME']);
                             G::SendTemporalMessage('ID_TASK_WAS_ASSIGNED_TO_USER', 'warning', 'labels', 10, null, $myLabels);
                         }
                         $nextDelegations2[] = array('TAS_UID' => $aDeriveTask['NEXT_TASK']['TAS_UID'], 'USR_UID' => $aDeriveTask['NEXT_TASK']['USER_ASSIGNED']['USR_UID'], 'TAS_ASSIGN_TYPE' => $aDeriveTask['NEXT_TASK']['TAS_ASSIGN_TYPE'], 'TAS_DEF_PROC_CODE' => $aDeriveTask['NEXT_TASK']['TAS_DEF_PROC_CODE'], 'DEL_PRIORITY' => 3, 'TAS_PARENT' => $aDeriveTask['NEXT_TASK']['TAS_PARENT']);
                     }
                     $currentDelegation2 = array('APP_UID' => $aSA['APP_PARENT'], 'DEL_INDEX' => $aSA['DEL_INDEX_PARENT'], 'APP_STATUS' => 'TO_DO', 'TAS_UID' => $aParentCase['TAS_UID'], 'ROU_TYPE' => $aDeriveTasks[1]['ROU_TYPE']);
                     $this->derivate($currentDelegation2, $nextDelegations2);
                 }
             }
         }
     }
 }
     $_SESSION['TRIGGER_DEBUG']['info'][1]['TIME'] = 'AFTER';
     $_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_NAMES'] = $oCase->getTriggerNames($triggers);
     $_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_VALUES'] = $triggers;
 }
 $oCase->updateCase($_SESSION['APPLICATION'], $appFields);
 // Send notifications - Start
 $oUser = new Users();
 $aUser = $oUser->load($_SESSION['USER_LOGGED']);
 if (trim($aUser['USR_EMAIL']) == '') {
     $aUser['USR_EMAIL'] = 'info@' . $_SERVER['HTTP_HOST'];
 }
 $sFromName = '"' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . '" <' . $aUser['USR_EMAIL'] . '>';
 try {
     $oCase->sendNotifications($_SESSION['TASK'], $_POST['form']['TASKS'], $appFields['APP_DATA'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $sFromName);
 } catch (Exception $e) {
     G::SendTemporalMessage(G::loadTranslation('ID_NOTIFICATION_ERROR') . ' - ' . $e->getMessage(), 'warning', 'string', null, '100%');
 }
 // Send notifications - End
 // Events - Start
 $oEvent = new Event();
 $oEvent->closeAppEvents($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK']);
 $oCurrentAppDel = AppDelegationPeer::retrieveByPk($_SESSION['APPLICATION'], $_SESSION['INDEX'] + 1);
 $multipleDelegation = false;
 // check if there are multiple derivations
 if (count($_POST['form']['TASKS']) > 1) {
     $multipleDelegation = true;
 }
 // If the case has been delegated
 if (isset($oCurrentAppDel)) {
     // if there is just a single derivation the TASK_UID can be set by the delegation data
     if (!$multipleDelegation) {
 public function generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $aProperties = array())
 {
     define("MAX_FREE_FRACTION", 1);
     define('PATH_OUTPUT_FILE_DIRECTORY', PATH_HTML . 'files/' . $_SESSION['APPLICATION'] . '/outdocs/');
     G::verifyPath(PATH_OUTPUT_FILE_DIRECTORY, true);
     require_once PATH_THIRDPARTY . 'html2ps_pdf/config.inc.php';
     require_once PATH_THIRDPARTY . 'html2ps_pdf/pipeline.factory.class.php';
     parse_config_file(PATH_THIRDPARTY . 'html2ps_pdf/html2ps.config');
     $GLOBALS['g_config'] = array('cssmedia' => 'screen', 'media' => 'Letter', 'scalepoints' => false, 'renderimages' => true, 'renderfields' => true, 'renderforms' => false, 'pslevel' => 3, 'renderlinks' => true, 'pagewidth' => 800, 'landscape' => $sLandscape, 'method' => 'fpdf', 'margins' => array('left' => 15, 'right' => 15, 'top' => 15, 'bottom' => 15), 'encoding' => '', 'ps2pdf' => false, 'compress' => true, 'output' => 2, 'pdfversion' => '1.3', 'transparency_workaround' => false, 'imagequality_workaround' => false, 'draw_page_border' => isset($_REQUEST['pageborder']), 'debugbox' => false, 'html2xhtml' => true, 'mode' => 'html', 'smartpagebreak' => true);
     $GLOBALS['g_config'] = array_merge($GLOBALS['g_config'], $aProperties);
     $g_media = Media::predefined($GLOBALS['g_config']['media']);
     $g_media->set_landscape($GLOBALS['g_config']['landscape']);
     $g_media->set_margins($GLOBALS['g_config']['margins']);
     $g_media->set_pixels($GLOBALS['g_config']['pagewidth']);
     if (isset($GLOBALS['g_config']['pdfSecurity'])) {
         if (isset($GLOBALS['g_config']['pdfSecurity']['openPassword']) && $GLOBALS['g_config']['pdfSecurity']['openPassword'] != "") {
             $GLOBALS['g_config']['pdfSecurity']['openPassword'] = G::decrypt($GLOBALS['g_config']['pdfSecurity']['openPassword'], $sUID);
         }
         if (isset($GLOBALS['g_config']['pdfSecurity']['ownerPassword']) && $GLOBALS['g_config']['pdfSecurity']['ownerPassword'] != "") {
             $GLOBALS['g_config']['pdfSecurity']['ownerPassword'] = G::decrypt($GLOBALS['g_config']['pdfSecurity']['ownerPassword'], $sUID);
         }
         $g_media->set_security($GLOBALS['g_config']['pdfSecurity']);
         require_once HTML2PS_DIR . 'pdf.fpdf.encryption.php';
     }
     $pipeline = new Pipeline();
     if (extension_loaded('curl')) {
         require_once HTML2PS_DIR . 'fetcher.url.curl.class.php';
         $pipeline->fetchers = array(new FetcherURLCurl());
         if (isset($proxy)) {
             if ($proxy != '') {
                 $pipeline->fetchers[0]->set_proxy($proxy);
             }
         }
     } else {
         require_once HTML2PS_DIR . 'fetcher.url.class.php';
         $pipeline->fetchers[] = new FetcherURL();
     }
     $pipeline->data_filters[] = new DataFilterDoctype();
     $pipeline->data_filters[] = new DataFilterUTF8($GLOBALS['g_config']['encoding']);
     if ($GLOBALS['g_config']['html2xhtml']) {
         $pipeline->data_filters[] = new DataFilterHTML2XHTML();
     } else {
         $pipeline->data_filters[] = new DataFilterXHTML2XHTML();
     }
     $pipeline->parser = new ParserXHTML();
     $pipeline->pre_tree_filters = array();
     $header_html = '';
     $footer_html = '';
     $filter = new PreTreeFilterHeaderFooter($header_html, $footer_html);
     $pipeline->pre_tree_filters[] = $filter;
     if ($GLOBALS['g_config']['renderfields']) {
         $pipeline->pre_tree_filters[] = new PreTreeFilterHTML2PSFields();
     }
     if ($GLOBALS['g_config']['method'] === 'ps') {
         $pipeline->layout_engine = new LayoutEnginePS();
     } else {
         $pipeline->layout_engine = new LayoutEngineDefault();
     }
     $pipeline->post_tree_filters = array();
     if ($GLOBALS['g_config']['pslevel'] == 3) {
         $image_encoder = new PSL3ImageEncoderStream();
     } else {
         $image_encoder = new PSL2ImageEncoderStream();
     }
     switch ($GLOBALS['g_config']['method']) {
         case 'fastps':
             if ($GLOBALS['g_config']['pslevel'] == 3) {
                 $pipeline->output_driver = new OutputDriverFastPS($image_encoder);
             } else {
                 $pipeline->output_driver = new OutputDriverFastPSLevel2($image_encoder);
             }
             break;
         case 'pdflib':
             $pipeline->output_driver = new OutputDriverPDFLIB16($GLOBALS['g_config']['pdfversion']);
             break;
         case 'fpdf':
             $pipeline->output_driver = new OutputDriverFPDF();
             break;
         case 'png':
             $pipeline->output_driver = new OutputDriverPNG();
             break;
         case 'pcl':
             $pipeline->output_driver = new OutputDriverPCL();
             break;
         default:
             die('Unknown output method');
     }
     if (isset($GLOBALS['g_config']['watermarkhtml'])) {
         $watermark_text = $GLOBALS['g_config']['watermarkhtml'];
     } else {
         $watermark_text = '';
     }
     $pipeline->output_driver->set_watermark($watermark_text);
     if ($watermark_text != '') {
         $dispatcher =& $pipeline->getDispatcher();
     }
     if ($GLOBALS['g_config']['debugbox']) {
         $pipeline->output_driver->set_debug_boxes(true);
     }
     if ($GLOBALS['g_config']['draw_page_border']) {
         $pipeline->output_driver->set_show_page_border(true);
     }
     if ($GLOBALS['g_config']['ps2pdf']) {
         $pipeline->output_filters[] = new OutputFilterPS2PDF($GLOBALS['g_config']['pdfversion']);
     }
     if ($GLOBALS['g_config']['compress'] && $GLOBALS['g_config']['method'] == 'fastps') {
         $pipeline->output_filters[] = new OutputFilterGZip();
     }
     if (!isset($GLOBALS['g_config']['process_mode'])) {
         $GLOBALS['g_config']['process_mode'] = '';
     }
     if ($GLOBALS['g_config']['process_mode'] == 'batch') {
         $filename = 'batch';
     } else {
         $filename = $sFilename;
     }
     switch ($GLOBALS['g_config']['output']) {
         case 0:
             $pipeline->destination = new DestinationBrowser($filename);
             break;
         case 1:
             $pipeline->destination = new DestinationDownload($filename);
             break;
         case 2:
             $pipeline->destination = new DestinationFile($filename);
             break;
     }
     copy($sPath . $sFilename . '.html', PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');
     try {
         $status = $pipeline->process((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/files/' . $_SESSION['APPLICATION'] . '/outdocs/' . $sFilename . '.html', $g_media);
         copy(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf', $sPath . $sFilename . '.pdf');
         unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf');
         unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');
     } catch (Exception $e) {
         if ($e->getMessage() == 'ID_OUTPUT_NOT_GENERATE') {
             include_once 'classes/model/AppDocument.php';
             $dataDocument = explode('_', $sFilename);
             if (!isset($dataDocument[1])) {
                 $dataDocument[1] = 1;
             }
             $oAppDocument = new AppDocument();
             $oAppDocument->remove($dataDocument[0], $dataDocument[1]);
             G::SendTemporalMessage(G::LoadTranslation('ID_OUTPUT_NOT_GENERATE'), 'Error');
         }
     }
 }
<?php

global $RBAC;
if ($RBAC->userCanAccess("PM_SETUP") != 1 || $RBAC->userCanAccess("PM_SETUP_ADVANCE") != 1) {
    G::SendTemporalMessage("ID_USER_HAVENT_RIGHTS_PAGE", "error", "labels");
    exit(0);
}
$availableFields = array();
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('cases/casesListSetup', false);
//adding a javascript file .js
$oHeadPublisher->addContent('cases/casesListSetup');
//adding a html file  .html.
$oHeadPublisher->assignNumber("pageSize", 20);
//sending the page size
$oHeadPublisher->assignNumber("availableFields", G::json_encode($availableFields));
G::RenderPage("publish", "extJs");
 //$rol = $RBAC->rolesObj->load($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_UID']);
 $_SESSION['USR_FULLNAME'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
 //$_SESSION['USR_ROLENAME'] = $rol['ROL_NAME'];
 unset($_SESSION['FAILED_LOGINS']);
 // increment logins in heartbeat
 G::LoadClass('serverConfiguration');
 $oServerConf =& serverConf::getSingleton();
 $oServerConf->sucessfulLogin();
 // Assign the uid of user to userloggedobj
 $RBAC->loadUserRolePermission($RBAC->sSystem, $uid);
 $res = $RBAC->userCanAccess('PM_LOGIN');
 if ($res != 1) {
     if ($res == -2) {
         G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', "error");
     } else {
         G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', "error");
     }
     G::header("location: login.html");
     die;
 }
 if (isset($frm['USER_LANG'])) {
     if ($frm['USER_LANG'] != '') {
         $lang = $frm['USER_LANG'];
     }
 } else {
     if (defined('SYS_LANG')) {
         $lang = SYS_LANG;
     } else {
         $lang = 'en';
     }
 }
}
if (!isset($_GET['position'])) {
    $_GET['position'] = 1;
}
$_SESSION['STEP_POSITION'] = (int) $_GET['position'];
//Obtain previous and next step - Start
if (isset($_GET['type'])) {
    $sType = $_GET['type'];
} else {
    $sType = '';
}
try {
    $aNextStep = $oCase->getNextSupervisorStep($_SESSION['PROCESS'], $_SESSION['STEP_POSITION'], $sType);
    $aPreviousStep = $oCase->getPreviousSupervisorStep($_SESSION['PROCESS'], $_SESSION['STEP_POSITION'], $sType);
} catch (exception $e) {
    G::SendTemporalMessage($e->getMessage(), 'error', 'string');
}
if (!$aPreviousStep) {
    $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = '';
} else {
    $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP'] = 'cases_StepToRevise?type=DYNAFORM&DYN_UID=' . $aPreviousStep['UID'] . '&position=' . $aPreviousStep['POSITION'] . '&APP_UID=' . $_GET['APP_UID'] . '&DEL_INDEX=' . $_GET['DEL_INDEX'];
    $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = G::loadTranslation("ID_PREVIOUS_STEP");
}
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = 'cases_StepToRevise?type=DYNAFORM&DYN_UID=' . $aNextStep['UID'] . '&position=' . $aNextStep['POSITION'] . '&APP_UID=' . $_GET['APP_UID'] . '&DEL_INDEX=' . $_GET['DEL_INDEX'];
/** Added By erik
 * date: 16-05-08
 * Description: this was added for the additional database connections */
G::LoadClass('dbConnections');
$oDbConnections = new dbConnections($_SESSION['PROCESS']);
$oDbConnections->loadAdditionalConnections();
$G_PUBLISH = new Publisher();
Exemple #25
0
 public function requirePermissions($permissions)
 {
     $numPerms = func_num_args();
     $permissions = func_get_args();
     $access = -1;
     if ($numPerms == 1) {
         $access = $this->userCanAccess($permissions[0]);
     } elseif ($numPerms > 0) {
         foreach ($permissions as $perm) {
             $access = $this->userCanAccess($perm);
             if ($access == 1) {
                 $access = 1;
                 break;
             }
         }
     } else {
         throw new Exception('function requirePermissions() ->ERROR: Parameters missing!');
     }
     if ($access == 1) {
         return true;
     } else {
         switch ($access) {
             case -2:
                 G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
                 G::header('location: ../login/login');
                 break;
             case -1:
             default:
                 G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
                 G::header('location: ../login/login');
                 break;
         }
         exit(0);
     }
 }
 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;
         }
     }
 }
    function verifyIsCaseChild ($sApplicationUID, $delIndex = 0)

    {

        //Obtain the related row in the table SUB_APPLICATION

        $oCriteria = new Criteria( 'workflow' );

        $oCriteria->add( SubApplicationPeer::APP_UID, $sApplicationUID );

        $oDataset = SubApplicationPeer::doSelectRS( $oCriteria );

        $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

        $oDataset->next();

        $aSA = $oDataset->getRow();

        if ($aSA) {

            //Obtain the related row in the table SUB_PROCESS

            $oCase = new Cases();

            $aParentCase = $oCase->loadCase( $aSA['APP_PARENT'], $aSA['DEL_INDEX_PARENT'] );

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( SubProcessPeer::PRO_PARENT, $aParentCase['PRO_UID'] );

            $oCriteria->add( SubProcessPeer::TAS_PARENT, $aParentCase['TAS_UID'] );

            $oDataset = SubProcessPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            $aSP = $oDataset->getRow();

            if ($aSP['SP_SYNCHRONOUS'] == 1) {

                $appFields = $oCase->loadCase($sApplicationUID, $delIndex);

                //Copy case variables to parent case

                $aFields = unserialize( $aSP['SP_VARIABLES_IN'] );

                $aNewFields = array ();

                foreach ($aFields as $sOriginField => $sTargetField) {

                    $sOriginField = str_replace( '@', '', $sOriginField );

                    $sOriginField = str_replace( '#', '', $sOriginField );

                    $sOriginField = str_replace( '%', '', $sOriginField );

                    $sOriginField = str_replace( '?', '', $sOriginField );

                    $sOriginField = str_replace( '$', '', $sOriginField );

                    $sOriginField = str_replace( '=', '', $sOriginField );

                    $sTargetField = str_replace( '@', '', $sTargetField );

                    $sTargetField = str_replace( '#', '', $sTargetField );

                    $sTargetField = str_replace( '%', '', $sTargetField );

                    $sTargetField = str_replace( '?', '', $sTargetField );

                    $sTargetField = str_replace( '$', '', $sTargetField );

                    $sTargetField = str_replace( '=', '', $sTargetField );

                    $aNewFields[$sTargetField] = isset( $appFields['APP_DATA'][$sOriginField] ) ? $appFields['APP_DATA'][$sOriginField] : '';

                    if(isset($aParentCase['APP_DATA'][$sTargetField.'_label'])){

                        $aNewFields[$sTargetField.'_label'] = isset( $appFields['APP_DATA'][$sOriginField.'_label'] ) ? $appFields['APP_DATA'][$sOriginField.'_label'] : '';

                    }

                }

                $aParentCase['APP_DATA'] = array_merge( $aParentCase['APP_DATA'], $aNewFields );

                $oCase->updateCase( $aSA['APP_PARENT'], $aParentCase );

                /*----------------------------------********---------------------------------*/



                //Update table SUB_APPLICATION

                $oSubApplication = new SubApplication();

                $oSubApplication->update( array ('APP_UID' => $sApplicationUID,'APP_PARENT' => $aSA['APP_PARENT'],'DEL_INDEX_PARENT' => $aSA['DEL_INDEX_PARENT'],'DEL_THREAD_PARENT' => $aSA['DEL_THREAD_PARENT'],'SA_STATUS' => 'FINISHED','SA_VALUES_IN' => serialize( $aNewFields ),'SA_FINISH_DATE' => date( 'Y-m-d H:i:s' )

                ) );



                //Derive the parent case

                $aDeriveTasks = $this->prepareInformation( array ('USER_UID' => - 1,'APP_UID' => $aSA['APP_PARENT'],'DEL_INDEX' => $aSA['DEL_INDEX_PARENT']

                ) );

                if (isset( $aDeriveTasks[1] )) {

                    if ($aDeriveTasks[1]['ROU_TYPE'] != 'SELECT') {

                        $nextDelegations2 = array ();

                        foreach ($aDeriveTasks as $aDeriveTask) {

                            if (! isset( $aDeriveTask['NEXT_TASK']['USER_ASSIGNED']['USR_UID'] )) {

                                $selectedUser = $aDeriveTask['NEXT_TASK']['USER_ASSIGNED'][0];

                                unset( $aDeriveTask['NEXT_TASK']['USER_ASSIGNED'] );

                                $aDeriveTask['NEXT_TASK']['USER_ASSIGNED'] = $selectedUser;

                                $myLabels = array ($aDeriveTask['NEXT_TASK']['TAS_TITLE'],$aParentCase['APP_NUMBER'],$selectedUser['USR_USERNAME'],$selectedUser['USR_FIRSTNAME'],$selectedUser['USR_LASTNAME']

                                );

                                G::SendTemporalMessage( 'ID_TASK_WAS_ASSIGNED_TO_USER', 'warning', 'labels', 10, null, $myLabels );



                            }

                            $nextDelegations2[] = array ('TAS_UID' => $aDeriveTask['NEXT_TASK']['TAS_UID'],'USR_UID' => $aDeriveTask['NEXT_TASK']['USER_ASSIGNED']['USR_UID'],'TAS_ASSIGN_TYPE' => $aDeriveTask['NEXT_TASK']['TAS_ASSIGN_TYPE'],'TAS_DEF_PROC_CODE' => $aDeriveTask['NEXT_TASK']['TAS_DEF_PROC_CODE'],'DEL_PRIORITY' => 3,'TAS_PARENT' => $aDeriveTask['NEXT_TASK']['TAS_PARENT']

                            );

                        }

                        $currentDelegation2 = array ('APP_UID' => $aSA['APP_PARENT'],'DEL_INDEX' => $aSA['DEL_INDEX_PARENT'],'APP_STATUS' => 'TO_DO','TAS_UID' => $aParentCase['TAS_UID'],'ROU_TYPE' => $aDeriveTasks[1]['ROU_TYPE']

                        );

                        $this->derivate( $currentDelegation2, $nextDelegations2 );



                        if($delIndex > 0 ) {

                            // Send notifications - Start

                            $oUser = new Users();

                            $aUser = $oUser->load($appFields["CURRENT_USER_UID"]);



                            $sFromName = $aUser["USR_FIRSTNAME"] . " " . $aUser["USR_LASTNAME"] . ($aUser["USR_EMAIL"] != "" ? " <" . $aUser["USR_EMAIL"] . ">" : "");



                            try {

                                $oCase->sendNotifications($appFields["TAS_UID"],

                                                          $nextDelegations2,

                                                          $appFields["APP_DATA"],

                                                          $sApplicationUID,

                                                          $delIndex,

                                                          $sFromName);



                            } catch (Exception $e) {

                                G::SendTemporalMessage(G::loadTranslation("ID_NOTIFICATION_ERROR") . " - " . $e->getMessage(), "warning", "string", null, "100%");

                            }

                            // Send notifications - End

                        }

                    }

                }

            }

        }

    }
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 *
 */
global $RBAC;
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) {
    G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
    G::header('location: ../login/login');
    die;
}
if (!isset($_GET['sUID'])) {
    G::SendTemporalMessage('ID_ERROR_OBJECT_NOT_EXISTS', 'error', 'labels');
    G::header('location: authSources_List');
    die;
}
if ($_GET['sUID'] == '') {
    G::SendTemporalMessage('ID_ERROR_OBJECT_NOT_EXISTS', 'error', 'labels');
    G::header('location: authSources_List');
    die;
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'users';
$G_ID_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES';
$fields = $RBAC->getAuthSource($_GET['sUID']);
if (is_array($fields['AUTH_SOURCE_DATA'])) {
    foreach ($fields['AUTH_SOURCE_DATA'] as $field => $value) {
        $fields[$field] = $value;
    }
}
unset($fields['AUTH_SOURCE_DATA']);
//fixing a problem with dropdown with int values,
 * 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.
 */
try {
    global $RBAC;
    switch ($RBAC->userCanAccess('PM_FACTORY')) {
        case -2:
            G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
            G::header('location: ../login/login');
            die;
            break;
        case -1:
            G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
            G::header('location: ../login/login');
            die;
            break;
    }
    //srequire_once 'classes/model/StepTrigger.php';
    G::LoadClass('processMap');
    $oProcessMap = new ProcessMap();
    switch ($_POST['action']) {
        case 'availableSupervisorDynaforms':
            $oProcessMap->availableSupervisorDynaforms($_POST['PRO_UID']);
            break;
        case 'assignSupervisorDynaform':
            $oProcessMap->assignSupervisorStep($_POST['PRO_UID'], 'DYNAFORM', $_POST['DYN_UID']);
            break;
        case 'removeSupervisorDynaform':
Exemple #30
0
        $formf = $_FILES['form'];
        $namefile = $formf['name']['LOGO_FILENAME'];
        $typefile = $formf['type']['LOGO_FILENAME'];
        $errorfile = $formf['error']['LOGO_FILENAME'];
        $tpnfile = $formf['tmp_name']['LOGO_FILENAME'];
        $aMessage1 = array();
        $fileName = trim(str_replace(' ', '_', $namefile));
        $fileName = changeNamelogo($fileName);
        G::uploadFile($tpnfile, $dir . '/', 'tmp' . $fileName);
        $error = false;
        try {
            G::resizeImage($dir . '/tmp' . $fileName, 250, 60, $dir . '/' . $fileName);
        } catch (Exception $e) {
            $error = $e->getMessage();
        }
        unlink($dir . '/tmp' . $fileName);
        if ($error === false) {
            header('location: uplogo.php');
        } else {
            G::SendTemporalMessage($error, 'error', 'string');
        }
    }
    $content = $template->getOutputContent();
    print $content;
} catch (Exception $e) {
    $G_PUBLISH = new Publisher();
    $aMessage['MESSAGE'] = $e->getMessage();
    $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
    G::RenderPage('publishBlank', 'blank');
    die;
}