Пример #1
0
 /**
  * Return the System defined constants and Application variables
  *   Constants: SYS_*
  *   Sessions : USER_* , URS_*
  */
 public function getSystemConstants($params = null)
 {
     $t1 = Bootstrap::microtime_float();
     $sysCon = array();
     if (defined("SYS_LANG")) {
         $sysCon["SYS_LANG"] = SYS_LANG;
     }
     if (defined("SYS_SKIN")) {
         $sysCon["SYS_SKIN"] = SYS_SKIN;
     }
     if (defined("SYS_SYS")) {
         $sysCon["SYS_SYS"] = SYS_SYS;
     }
     $sysCon["APPLICATION"] = isset($_SESSION["APPLICATION"]) ? $_SESSION["APPLICATION"] : "";
     $sysCon["PROCESS"] = isset($_SESSION["PROCESS"]) ? $_SESSION["PROCESS"] : "";
     $sysCon["TASK"] = isset($_SESSION["TASK"]) ? $_SESSION["TASK"] : "";
     $sysCon["INDEX"] = isset($_SESSION["INDEX"]) ? $_SESSION["INDEX"] : "";
     $sysCon["USER_LOGGED"] = isset($_SESSION["USER_LOGGED"]) ? $_SESSION["USER_LOGGED"] : "";
     $sysCon["USR_USERNAME"] = isset($_SESSION["USR_USERNAME"]) ? $_SESSION["USR_USERNAME"] : "";
     //###############################################################################################
     // Added for compatibility betweek aplication called from web Entry that uses just WS functions
     //###############################################################################################
     if ($params != null) {
         if (isset($params->option)) {
             switch ($params->option) {
                 case "STORED SESSION":
                     if (isset($params->SID)) {
                         Bootstrap::LoadClass("sessions");
                         $oSessions = new Sessions($params->SID);
                         $sysCon = array_merge($sysCon, $oSessions->getGlobals());
                     }
                     break;
             }
         }
         if (isset($params->appData) && is_array($params->appData)) {
             $sysCon["APPLICATION"] = $params->appData["APPLICATION"];
             $sysCon["PROCESS"] = $params->appData["PROCESS"];
             $sysCon["TASK"] = $params->appData["TASK"];
             $sysCon["INDEX"] = $params->appData["INDEX"];
             if (empty($sysCon["USER_LOGGED"])) {
                 $sysCon["USER_LOGGED"] = $params->appData["USER_LOGGED"];
                 $sysCon["USR_USERNAME"] = $params->appData["USR_USERNAME"];
             }
         }
     }
     return $sysCon;
 }
Пример #2
0
        $noLoginFiles[] = 'cases_NextStep';
        $noLoginFiles[] = 'genericAjax';
        $noLoginFiles[] = 'casesSaveDataView';
        $noLoginFiles[] = 'propelTableAjax';
        $noLoginFiles[] = 'licenseUpdate';
        $noLoginFiles[] = 'casesStreamingFile';

        $noLoginFolders[] = 'services';
        $noLoginFolders[] = 'tracker';
        $noLoginFolders[] = 'installer';

        // This sentence is used when you lost the Session
        if (! in_array( SYS_TARGET, $noLoginFiles ) && ! in_array( SYS_COLLECTION, $noLoginFolders ) && $bWE != true && $collectionPlugin != 'services') {
            $bRedirect = true;
            if (isset( $_GET['sid'] )) {
                Bootstrap::LoadClass( 'sessions' );
                $oSessions = new Sessions();
                if ($aSession = $oSessions->verifySession( $_GET['sid'] )) {
                    $pathFile = $filter->validateInput('classes/model/Users.php','path');
                    require_once $pathFile;
                    $oUser = new Users();
                    $aUser = $oUser->load( $aSession['USR_UID'] );
                    $_SESSION['USER_LOGGED'] = $aUser['USR_UID'];
                    $_SESSION['USR_USERNAME'] = $aUser['USR_USERNAME'];
                    $bRedirect = false;
                    if ((preg_match("/msie/i", $_SERVER ['HTTP_USER_AGENT']) != 1 ||
                        $config['ie_cookie_lifetime'] == 1) &&
                        (!(preg_match("/safari/i", $_SERVER ['HTTP_USER_AGENT']) == 1 && preg_match("/chrome/i", $_SERVER ['HTTP_USER_AGENT']) == 0) ||
                        $config['safari_cookie_lifetime'] == 1)) {
                        if (PHP_VERSION < 5.2) {
                            setcookie(session_name(), session_id(), time() + $timelife, '/', '; HttpOnly');
Пример #3
0
function processWorkspace()

{

    try {

        Bootstrap::LoadClass("plugin");

        $oPluginRegistry =& PMPluginRegistry::getSingleton();

        if (file_exists(PATH_DATA_SITE . 'plugin.singleton')) {

            $oPluginRegistry->unSerializeInstance(file_get_contents(PATH_DATA_SITE . 'plugin.singleton'));

        }

        Bootstrap::LoadClass("case");



        global $sObject;

        global $sLastExecution;



        resendEmails();

        unpauseApplications();

        calculateDuration();

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

        executeEvents($sLastExecution);

        executeScheduledCases();

        executeUpdateAppTitle();

        executeCaseSelfService();

        executePlugins();

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

    } catch (Exception $oError) {

        saveLog("main", "error", "Error processing workspace : " . $oError->getMessage() . "\n");

    }

}
Пример #4
0
function executePlugins()
{
    global $sFilter;
    if ($sFilter != '' && strpos($sFilter, 'plugins') === false) {
        return false;
    }
    $pathCronPlugins = PATH_CORE . 'bin' . PATH_SEP . 'plugins' . PATH_SEP;
    // Executing cron files in bin/plugins directory
    if (!is_dir($pathCronPlugins)) {
        return false;
    }
    if ($handle = opendir($pathCronPlugins)) {
        setExecutionMessage('Executing cron files in bin/plugins directory in Workspace: ' . SYS_SYS);
        while (false !== ($file = readdir($handle))) {
            if (strpos($file, '.php', 1) && is_file($pathCronPlugins . $file)) {
                $filename = str_replace('.php', '', $file);
                $className = $filename . 'ClassCron';
                // Execute custom cron function
                executeCustomCronFunction($pathCronPlugins . $file, $className);
            }
        }
    }
    // Executing registered cron files
    // -> Get registered cron files
    Bootstrap::LoadClass('plugin');
    $oPluginRegistry =& PMPluginRegistry::getSingleton();
    if (file_exists(PATH_DATA_SITE . 'plugin.singleton')) {
        $oPluginRegistry->unSerializeInstance(file_get_contents(PATH_DATA_SITE . 'plugin.singleton'));
    }
    $cronFiles = $oPluginRegistry->getCronFiles();
    // -> Execute functions
    if (!empty($cronFiles)) {
        setExecutionMessage('Executing registered cron files for Workspace: ' . SYS_SYS);
        foreach ($cronFiles as $cronFile) {
            executeCustomCronFunction(PATH_PLUGINS . $cronFile->namespace . PATH_SEP . 'bin' . PATH_SEP . $cronFile->cronFile . '.php', $cronFile->cronFile);
        }
    }
}