Zapnuti debug modu pomoci cookie
438616
public function enable(): void
	{
		$this->response->setCookie(Configurator::COOKIE_SECRET, $this->cookie, strtotime('1 years'), '/', '', '', true);
		$this->enable = true;
	}
16061
public function boot()
    {
        $configPath = __DIR__ . '/../config/debugbar.php';
        $this->publishes([$configPath => $this->getConfigPath()], 'config');

        $routeConfig = [
            'namespace' => 'Barryvdh\Debugbar\Controllers',
            'prefix' => $this->app['config']->get('debugbar.route_prefix'),
            'domain' => $this->app['config']->get('debugbar.route_domain'),
            'middleware' => [DebugbarEnabled::class],
        ];

        $this->getRouter()->group($routeConfig, function($router) {
            $router->get('open', [
                'uses' => 'OpenHandlerController@handle',
                'as' => 'debugbar.openhandler',
            ]);

            $router->get('clockwork/{id}', [
                'uses' => 'OpenHandlerController@clockwork',
                'as' => 'debugbar.clockwork',
            ]);

            $router->get('telescope/{id}', [
                'uses' => 'TelescopeController@show',
                'as' => 'debugbar.telescope',
            ]);
            
            $router->get('assets/stylesheets', [
                'uses' => 'AssetController@css',
                'as' => 'debugbar.assets.css',
            ]);

            $router->get('assets/javascript', [
                'uses' => 'AssetController@js',
                'as' => 'debugbar.assets.js',
            ]);

            $router->delete('cache/{key}/{tags?}', [
                'uses' => 'CacheController@delete',
                'as' => 'debugbar.cache.delete',
            ]);
        });

        $this->registerMiddleware(InjectDebugbar::class);
    }
1055803
public static function postUpdate(Event $event) 
    { 
        //inicjalizacja autoloadera 
        self::_initAutoload($event); 
        //linkowanie zasobów web 
        self::_linkModuleWebResources(); 
        //kopiowanie binariów z modułów 
        self::_copyModuleBinaries(); 
    }
151459
def hook(self, debug, pid):
        
        label = "%s!%s" % (self.__modName, self.__procName)
        try:
            hook = self.__hook[pid]
        except KeyError:
            try:
                aProcess = debug.system.get_process(pid)
            except KeyError:
                aProcess = Process(pid)
            hook = Hook(self.__preCB, self.__postCB,
                        self.__paramCount, self.__signature,
                        aProcess.get_arch() )
            self.__hook[pid] = hook
        hook.hook(debug, pid, label)
187745
public static function register()
	{
		Form::extensionMethod('addAntispam', function(Form $form, $name = 'spam', $label = 'Toto pole vymažte', $msg = 'Bol odhalený pokus o zaslanie spamu.')
		{
			// "All filled" protection
			$form[$name] = new AntispamControl($label, NULL, NULL, $msg);

			// "Send delay" protection
			$form->addHidden('form_created', strtr(time(), '0123456789', 'jihgfedcba'))
				->addRule(
					function($item)
				{
					if (AntispamControl::$minDelay <= 0)
						return TRUE;  // turn off "Send delay protection"

					$value = (int) strtr($item->value, 'jihgfedcba', '0123456789');
					return $value <= (time() - AntispamControl::$minDelay);
				}, $msg
			);

			return $form;
		});
	}
1129122
public function init()
	{
		if ($this->conf['timezone'])
		{
			date_default_timezone_set($this->conf['timezone']);
		}
		# Определение путей
		$this->init_resolve();
		# Инициализация сессии
		$this->init_session();
		# Изменяем путь поиска подключаемых файлов
		set_include_path(dirname(__FILE__) . '/lib' . PATH_SEPARATOR . get_include_path());
		# Читаем настройки
		$this->initSettings();
		# Первичный разбор запроса
		$this->init_request();
		# Настройка локали
		$this->initLocale();
		# Подключение базовых классов
		$this->initClasses();
		# Инициализация расширений
		$this->init_extensions();
		# Подключение к источнику данных
		$this->initDataSource();
        $this->plugins = Eresus_Plugin_Registry::getInstance();
        $this->plugins->init();
		# Проверка сессии
		$this->check_session();
		# Проверка логина/логаута
		$this->check_loginout();
		# Попытка cookie-логина
		$this->check_cookies();
		# Обновление данных о пользователе
		$this->reset_login();
		$this->sections = new Sections;
		$GLOBALS['KERNEL']['loaded'] = true; # Флаг загрузки ядра
	}
86030
protected function _setupCache()
    {
        //brak konfiguracji cache
        if (!\App\Registry::$config->cache) {
            return $this;
        }
        //cache użytkownika
        \App\Registry::$cache = new \Mmi\Cache\Cache(\App\Registry::$config->cache);
        return $this;
    }
506398
function neoDebug (prefix, options)
{
	var copy = {};
	if (options)
	{
		for (var i in options)
			copy[i] = options[i];
	}

	copy.prefix = prefix;

	var index = String(_options.push(copy) - 1);
	_prevTimes.push(0);
	updateDebugFunction(index);
	function debug ()
	{
		var f = _functions[index];
		if (f !== disabled)
			f(arguments);
	}

	debug.update = function (options)
	{
		if (!options)
			return;

		var orig = _options[index];
		for (var i in options)
			orig[i] = options[i];

		updateDebugFunction(index);
	};

	return debug;
}
689882
function _debugActions($response, $mode, $order_time= '', $sessID = '') {
    global $db, $messageStack, $insert_id;
    if ($order_time == '') $order_time = date("F j, Y, g:i a");
    $response['url'] = $this->form_action_url;
    $this->reportable_submit_data['url'] = $this->form_action_url;

    $errorMessage = date('M-d-Y h:i:s') .
                    "\n=================================\n\n";
    if ($mode == 'Submit-Data') $errorMessage .=
                    'Sent to Authorizenet: ' . print_r($this->reportable_submit_data, true) . "\n\n";
    if ($mode == 'Response-Data') $errorMessage .=
                    'Response Code: ' . $response['x_response_code'] . ".\nResponse Text: " . $response['x_response_reason_text'] . "\n\n" .
                    ($response['x_response_code'] == 2 && $response['x_response_reason_code'] == 4 ? ' NOTICE: Card should be picked up - possibly stolen ' : '') .
                    ($response['x_response_code'] == 3 && $response['x_response_reason_code'] == 11 ? ' DUPLICATE TRANSACTION ATTEMPT ' : '') .
                    'Results Received back from Authorizenet: ' . print_r($response, true) . "\n\n";
    // store log file if log mode enabled
    if (stristr(MODULE_PAYMENT_AUTHORIZENET_DEBUGGING, 'Log') || strstr(MODULE_PAYMENT_AUTHORIZENET_DEBUGGING, 'All') || (defined('AUTHORIZENET_DEVELOPER_MODE') && in_array(AUTHORIZENET_DEVELOPER_MODE, array('on', 'certify')))) {
      $key = ($response['x_trans_id'] != '' ? $response['x_trans_id'] . '_' : '') . time() . '_' . zen_create_random_value(4);
      $file = $this->_logDir . '/' . 'SIM_Debug_' . $key . '.log';
      $fp = @fopen($file, 'a');
      @fwrite($fp, $errorMessage);
      @fclose($fp);
    }
    // send email alerts only if in alert mode or if email specifically requested as logging mode
    if ((isset($response['x_response_code']) && $response['x_response_code'] != '1' && stristr(MODULE_PAYMENT_AUTHORIZENET_DEBUGGING, 'Alerts')) || stristr(MODULE_PAYMENT_AUTHORIZENET_DEBUGGING, 'Email')) {
      zen_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, 'Authorizenet-SIM Alert ' . $response['x_invoice_num'] . ' ' . date('M-d-Y h:i:s') . ' ' . $response['x_trans_id'], $errorMessage, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML'=>nl2br($errorMessage)), 'debug');
    }

    // DATABASE SECTION
    // Insert the send and receive response data into the database.
    // This can be used for testing or for implementation in other applications
    // This can be turned on and off if the Admin Section
    if (MODULE_PAYMENT_AUTHORIZENET_STORE_DATA == 'True' && $mode == 'Response-Data'){
      $db_response_text = $response['x_response_reason_text'];
      $db_response_text .= ($response['x_response_code'] == 2 && $response['x_response_reason_code'] == 4) ? ' NOTICE: Card should be picked up - possibly stolen ' : '';
      $db_response_text .= ($response['x_response_code'] == 3 && $response['x_response_reason_code'] == 11) ? ' DUPLICATE TRANSACTION ATTEMPT ' : '';

      // Insert the data into the database
      $sql = "insert into " . TABLE_AUTHORIZENET . "  (id, customer_id, order_id, response_code, response_text, authorization_type, transaction_id, sent, received, time, session_id) values (NULL, :custID, :orderID, :respCode, :respText, :authType, :transID, :sentData, :recvData, :orderTime, :sessID )";
      $sql = $db->bindVars($sql, ':custID', $_SESSION['customer_id'], 'integer');
      $sql = $db->bindVars($sql, ':orderID', preg_replace('/[^0-9]/', '', $insert_id), 'integer');
      $sql = $db->bindVars($sql, ':respCode', $response['x_response_code'], 'integer');
      $sql = $db->bindVars($sql, ':respText', $db_response_text, 'string');
      $sql = $db->bindVars($sql, ':authType', $response['x_type'], 'string');
      $sql = $db->bindVars($sql, ':transID', $response['x_trans_id'], 'string');
      $sql = $db->bindVars($sql, ':sentData', print_r($this->reportable_submit_data, true), 'string');
      $sql = $db->bindVars($sql, ':recvData', print_r($response, true), 'string');
      $sql = $db->bindVars($sql, ':orderTime', $order_time, 'string');
      $sql = $db->bindVars($sql, ':sessID', $sessID, 'string');
      $db->Execute($sql);
    }
  }
516057
function readStrucPerm(on, req, res, next) {
	//console.log('readStrucPerm: req.session.user_id = ' + req.session.user_id);
	//solo nel caso di favicon.ico non ha le session impostate, non so perchè,
	//quindi bypasso il controllo, perchè su favicon non ho nessuna restrizione
	if ( !req.session )
	{
		next();
	}
	else
	{
		//azzero i permessi
		req.session.loggedIn = false;
		req.session.canCreate = false;
		req.session.canModify = false;
		req.session.canModifyMyself = false; //questo è un permesso che vale solo per l'elemento "users"
		//controllo se sono loggato
		if (req.session.user_id) {
			//l'utente risulta loggato
			//controllo se i suoi dati di login sono validi
			//(questo controllo va fatto ogni volta, perchè se dall'ultimo conrollo l'utente fosse stato cancellato, non me ne accorgerei senza controllo
			req.app.jsl.sess.checkValidUser(req, function(result, user_id) { 
				if ( result )
				{
					//i dati di login sono validi
					req.session.loggedIn = true;
					if ( user_id == 'superadmin' )
					{
						//se sono super admin, ho sempre permesso di modify su tutti i contenuti, ma non ho il create (a parte sugli users)
						//questo perchè quando si crea un contenuto, questo è strettamente legato all'utente che lo crea, e il superadmin
						//non è un utente vero è proprio (non è presente nel db, non ha id). il super admin serve solo per poter vedere e modificare tutto, ma non può creare nulla
						req.session.canModify = true;
						req.session.canModifyMyself = true; //questo serve per permettere al super admin di modificare gli utenti (il form di modifica lo richiede)
						//solo nel caso degli users, il superadmin ha il create, anche se usersCanRegister = false
						if ( on == 'user' )
						{
							req.session.canCreate = true;
						}
						//la request puo essere processata
						next();
					}
					else
					{
						//non sono superadmin
						//siccome si tratta di permessi su elementi della struttura, chiunque (loggato) ha sempre il permesso di create nuovi elementi
						//(tranne per il caso degli "user" in cui si creano altri utenti con il bottone "registrati", che però non prevede di essere loggati)
						if ( on != 'user' )
						{
							req.session.canCreate = true;
						}
						//differenzio i permessi di modify in base all'oggetto trattato
						switch (on)
						{
							case 'user':
								//user è un elemento della struttura particolare, perchè, a differenza di tutti gli altri elementi di struttura, ogni utente può solo modificare
								//se stesso. inoltre user non ha un "author" poichè un utente è creato da se stesso tramite il bottone "register"
								//nel caso di modifica di users, ho modify solo per modificare me stesso
								if ( req.params.id == req.session.user_id ) //controllo se l'id dell'utente da modificare è quello dell'utente loggato, cioè se modifico me stesso
								{
									//lo user id nella route richiesta corrisponde al mio, quindi posso modificare me stesso (il mio profilo)
									req.session.canModifyMyself = true; 
								}
								break;
							default:
								//ora come ora per tutti gli altri elementi della struttura chiunque ha permesso di modify, ma solo sui propri elementi
								req.session.canModify = true; 
								break;
						}
						//continuo
						next();
						
					}
				}
				else
				{
					//i dati di login non sono validi
					//console.log('readStrucPerm: login NON valido');
					//forzo un logout (potrebbe verificarsi il caso in cui un utente è loggato, e viene cancellato dal db. in quel caso deve avvenire anche il suo logout)
					setSignedOut(req);
					//vengo mandato in home
					res.redirect('/');
				}
			});
			
		} else {
			//console.log('readStrucPerm: utente non loggato');			
			//non sono loggato. l'unica cosa che posso fare è di registrarmi, ovvero creare un nuovo user
			//ma solo se è stato previsto nel config
			if ( on == 'user' && req.app.jsl.config.usersCanRegister )
			{
				req.session.canCreate = true;
			}
			//non ho nessun permesso, continuo
			next();
		}
	}
}
633327
public function indexAction()
    {
        //formularz
        $form = new Form\ConnectorImportContentForm;
        //formularz zapisany + przejście do importu plików
        if ($form->isSaved() && $form->getElement('file')) {
            $this->getMessenger()->addMessage('messenger.connector.import.success', true);
            $this->getResponse()->redirect('cmsAdmin', 'connector', 'files');
        }
        //form zapisany bez importu plików
        if ($form->isSaved()) {
            $this->getMessenger()->addMessage('messenger.connector.import.ended', true);
            $this->getResponse()->redirect('cmsAdmin', 'index', 'index');
        }
        //form do widoku
        $this->view->form = $form;
    }
975078
public function updateDebugSettings()
    {
        $ini = eZINI::instance();
        $debugSettings = array();
        $debugSettings['debug-enabled'] = ( $ini->variable( 'DebugSettings', 'DebugOutput' ) == 'enabled' and
                                            $this->restINI->variable( 'DebugSettings', 'Debug' ) == 'enabled' );
        $debugSettings['debug-by-ip'] = $ini->variable( 'DebugSettings', 'DebugByIP' ) == 'enabled';
        $debugSettings['debug-ip-list'] = $ini->variable( 'DebugSettings', 'DebugIPList' );

        $logList = $ini->variable( 'DebugSettings', 'AlwaysLog' );
        $logMap = array( 'notice' => eZDebug::LEVEL_NOTICE,
                         'warning' => eZDebug::LEVEL_WARNING,
                         'error' => eZDebug::LEVEL_ERROR,
                         'debug' => eZDebug::LEVEL_DEBUG,
                         'strict' => eZDebug::LEVEL_STRICT );
        $debugSettings['always-log'] = array();
        foreach ( $logMap as $name => $level )
        {
            $debugSettings['always-log'][$level] = in_array( $name, $logList );
        }
        eZDebug::updateSettings( $debugSettings );
    }
591785
public function beforeSave()
    {
        //brak loginu lub hasła
        if (!$this->getElement('username')->getValue() || !$this->getElement('password')->getValue()) {
            return false;
        }
        //autoryzacja
        $auth = \App\Registry::$auth;
        \App\Registry::$auth->setIdentity($this->getElement('username')->getValue());
        \App\Registry::$auth->setCredential($this->getElement('password')->getValue());
        //autoryzacja
        if (!\App\Registry::$auth->authenticate()) {
            return false;
        }
        //zapamiętanie jeśli zaznaczona opcja
        if ($this->getElement('remember')) {
            \App\Registry::$auth->rememberMe(\App\Registry::$config->session->authRemember);
        }
        return true;
    }
530586
private static function _configureLogger()
    {
        //brak konfiguracji
        if (!self::$_config) {
            //tworzy pustą konfigurację
            return new \Psr\Log\NullLogger;
        }
        //nowy obiekt loggera
        $logger = new Logger(self::$_config->getName());
        //iteracja po konfiguracjach instancji
        foreach (self::$_config as $config) {
            self::_configureInstance($config, $logger);
        }
        return $logger;
    }
1164514
function __Cookies(_cookies) {
  this.cookies = {};
  if (!_cookies || typeof _cookies !== 'string') {
    _cookies = '';
  }

  if (_cookies && _cookies.length) {
    var self = this;
    var i;
    var key;
    var val;

    _cookies.split(/;\ */).forEach(function (pair) {
      i = pair.indexOf('=');
      if (i < 0) {
        return;
      }

      key = unescape(pair.substr(0, i).trim());
      val = pair.substr(++i, pair.length).trim();

      if (val[0] === '"') {
        val = val.slice(1, -1);
      }

      if (self.cookies[key] === void 0) {
        try {
          self.cookies[key] = unescape(val);
        } catch (e) {
          self.cookies[key] = val;
        }
      }
    });
  }
}
518412
public function previewAction()
    {
        //wyszukiwanie wiadomości
        if (null === $mail = (new \Cms\Orm\CmsMailQuery)->findPk($this->id)) {
            $this->getResponse()->redirect('cmsAdmin', 'mail', 'index');
        }
        $this->view->message = $mail->message;
    }
61097
public function run()
    {
        // For developers: WordPress debugging mode.
        $debug = env('WP_DEBUG', false);
        define('WP_DEBUG', $debug);
        define('WP_DEBUG_LOG', env('WP_DEBUG_LOG', false));
        define('WP_DEBUG_DISPLAY', env('WP_DEBUG_DISPLAY', $debug));
        define('SCRIPT_DEBUG', env('SCRIPT_DEBUG', $debug));

        // The database configuration with database name, username, password,
        // hostname charset and database collae type.
        define('DB_NAME', env('DB_NAME'));
        define('DB_USER', env('DB_USER'));
        define('DB_PASSWORD', env('DB_PASSWORD'));
        define('DB_HOST', env('DB_HOST'));
        define('DB_CHARSET', env('DB_CHARSET', 'utf8mb4'));
        define('DB_COLLATE', env('DB_COLLATE', 'utf8mb4_unicode_ci'));

        // Set the unique authentication keys and salts.
        define('AUTH_KEY', env('AUTH_KEY'));
        define('SECURE_AUTH_KEY', env('SECURE_AUTH_KEY'));
        define('LOGGED_IN_KEY', env('LOGGED_IN_KEY'));
        define('NONCE_KEY', env('NONCE_KEY'));
        define('AUTH_SALT', env('AUTH_SALT'));
        define('SECURE_AUTH_SALT', env('SECURE_AUTH_SALT'));
        define('LOGGED_IN_SALT', env('LOGGED_IN_SALT'));
        define('NONCE_SALT', env('NONCE_SALT'));

        // Set the home url to the current domain.
        $request = Request::createFromGlobals();
        define('WP_HOME', env('WP_URL', $request->getSchemeAndHttpHost()));

        // Set the WordPress directory path.
        define('WP_SITEURL', env('WP_SITEURL', sprintf('%s/%s', WP_HOME, env('WP_DIR', 'wordpress'))));

        // Set the WordPress content directory path.
        define('WP_CONTENT_DIR', env('WP_CONTENT_DIR', $this->getPublicPath()));
        define('WP_CONTENT_URL', env('WP_CONTENT_URL', WP_HOME));

        // Set the trash to less days to optimize WordPress.
        define('EMPTY_TRASH_DAYS', env('EMPTY_TRASH_DAYS', 7));

        // Set the default WordPress theme.
        define('WP_DEFAULT_THEME', env('WP_THEME', 'wordplate'));

        // Constant to configure core updates.
        define('WP_AUTO_UPDATE_CORE', env('WP_AUTO_UPDATE_CORE', 'minor'));

        // Specify the number of post revisions.
        define('WP_POST_REVISIONS', env('WP_POST_REVISIONS', 2));

        // Cleanup WordPress image edits.
        define('IMAGE_EDIT_OVERWRITE', env('IMAGE_EDIT_OVERWRITE', true));

        // Prevent file edititing from the dashboard.
        define('DISALLOW_FILE_EDIT', env('DISALLOW_FILE_EDIT', true));

        // Set the absolute path to the WordPress directory.
        if (!defined('ABSPATH')) {
            define('ABSPATH', sprintf('%s/%s/', $this->getPublicPath(), env('WP_DIR', 'wordpress')));
        }

        // Load the must-use plugins.
        $pluginLoader = new PluginLoader();
        $pluginLoader->load();
    }