Ejemplo n.º 1
0
 public static function set($prop, &$val)
 {
     switch ($prop) {
         case 'cx':
             // set is only used for installerCx. Normal cx class will load with \Env::get('cx')
             self::$props[$prop] = $val;
             \DBG::msg(__METHOD__ . ": Setting '{$prop}' is deprecated. Use only for installer, otherwise use \\Env::('{$prop}')");
             \DBG::stack();
             break;
         case 'em':
             self::$props[$prop] = $val;
             \DBG::msg(__METHOD__ . ": Setting '{$prop}' is deprecated. Env::get({$prop}) always returns the active/preferred instance of {$prop}.");
             \DBG::stack();
             break;
         default:
             self::$props[$prop] = $val;
             break;
     }
 }
Ejemplo n.º 2
0
function checkTimeoutLimit()
{
    global $_CORELANG;
    $timeoutTime = UPDATE_TIMEOUT_TIME;
    if (!empty($_SESSION['contrexx_update']['max_execution_time'])) {
        $timeoutTime = UPDATE_TIME + $_SESSION['contrexx_update']['max_execution_time'];
    }
    if ($timeoutTime > time()) {
        return true;
    }
    \DBG::msg('Timeout of ' . $timeoutTime . 's reached!');
    \DBG::stack();
    setUpdateMsg($_CORELANG['TXT_UPDATE_PROCESS_HALTED'], 'title');
    setUpdateMsg($_CORELANG['TXT_UPDATE_PROCESS_HALTED_TIME_MSG'] . '<br /><br />', 'msg');
    setUpdateMsg('<input type="submit" value="' . $_CORELANG['TXT_CONTINUE_UPDATE'] . '" name="updateNext" /><input type="hidden" name="processUpdate" id="processUpdate" />', 'button');
    return false;
}
Ejemplo n.º 3
0
 /**
  * Adds a placeholder for the CSRF code to the given template.
  * This is so you can easily patch javascript code that handles
  * URLs, as this cannot be done by add_code().
  * @param   \Cx\Core\Html\Sigma     $tpl    Template object
  */
 public static function add_placeholder($tpl)
 {
     if (!self::__is_logged_in()) {
         return true;
     }
     // do not add placeholder in case current request is an AJAX request.  They're secure
     // by definition and also, they're much more delicate in
     // what can be returned - and they usually exceed the
     // request amount limit pretty quickly (see active_decrease etc)
     if (self::__is_ajax()) {
         return;
     }
     if (!is_object($tpl)) {
         \DBG::msg("self::add_placeholder(): fix this call, that ain't a template object! (Stack follows)");
         \DBG::stack();
     }
     $code = self::__get_code();
     $tpl->setGlobalVariable(array("CSRF_PARAM" => self::param(), "CSRF_KEY" => "{$code}"));
     return true;
 }
Ejemplo n.º 4
0
 /**
  * Returns a textual error message for an error code
  *
  * @access public
  * @param  integer  error code
  * @param  string   additional data to insert into message
  * @return string   error message
  */
 function errorMessage($code, $data = null)
 {
     static $errorMessages;
     \DBG::stack();
     if (!isset($errorMessages)) {
         $errorMessages = array(SIGMA_ERROR => 'unknown error', SIGMA_OK => '', SIGMA_TPL_NOT_FOUND => 'Cannot read the template file \'%s\'', SIGMA_BLOCK_NOT_FOUND => 'Cannot find block \'%s\'', SIGMA_BLOCK_DUPLICATE => 'The name of a block must be unique within a template. Block \'%s\' found twice.', SIGMA_CACHE_ERROR => 'Cannot save template file \'%s\'', SIGMA_UNKNOWN_OPTION => 'Unknown option \'%s\'', SIGMA_PLACEHOLDER_NOT_FOUND => 'Variable placeholder \'%s\' not found', SIGMA_PLACEHOLDER_DUPLICATE => 'Placeholder \'%s\' should be unique, found in multiple blocks', SIGMA_BLOCK_EXISTS => 'Block \'%s\' already exists', SIGMA_INVALID_CALLBACK => 'Callback does not exist');
     }
     if (PEAR::isError($code)) {
         $code = $code->getCode();
     }
     if (!isset($errorMessages[$code])) {
         return $errorMessages[SIGMA_ERROR];
     } else {
         return null === $data ? $errorMessages[$code] : sprintf($errorMessages[$code], $data);
     }
 }