Zobrazeni informaci o PHP
356327
public function renderPhp(): void
	{
		$this->addBreadcrumbLink('dockbar.info.php');
		$this->template->php = $this->app->info->phpInfo;
	}
340200
public function connect()
    {
        //pdo do zapisu
        $this->_upstreamPdo = new \PDO(
            $this->_config->driver . ':' . $this->_config->host, null, null, [\PDO::ATTR_PERSISTENT => $this->_config->persistent]
        );
        //odczyt identycznie
        $this->_downstreamPdo = $this->_upstreamPdo;
        //połączono
        $this->_connected = true;
        //włączenie funkcjonalności kluczy obcych - domyślnie
        $this->query('PRAGMA foreign_keys = ON');
    }
159245
protected function createComponentUrlForm() : Form
    {
        $form = new Form;

        $form->addText('url')
            ->setRequired('URL stránky je povinná.')
            ->addRule(Form::PATTERN, 'Povolené znaky pro URL: a-z, 0-9, lomítko, pomlčka.', PageRepository::URL_REGEX)
            ->addRule(Form::MIN_LENGTH, 'Minimální délka url je %d znaky.', 2)
            ->addRule(Form::MAX_LENGTH, 'Maximální délka url je %d znaků.', 255)
            ->addFilter(function ($value) {
                return $this->pageManager->webalizeUrl($value);
            });

        $form->addSubmit('save');

        $form->setDefaults([
            'url' => $this->activePage->getPageUrl()->getUrl()
        ]);


        $form->onValidate[] = function (Form $form) { $this->validate($form); };
        $form->onSuccess[] = function (Form $form) { $this->success($form); };


        if (!$this->presenter->user->isAllowed(PageAuthorizator::RES_URL_MODAL))
        {
            $this->setDisabledForm($form, TRUE);
        }

        return $form;
    }
856070
protected function _bufferingAllowed()
    {
        //jeśli zdefiniowano własny obiekt sprawdzający, czy można buforować
        if (\App\Registry::$config->category instanceof \Cms\Config\CategoryConfig && \App\Registry::$config->category->bufferingAllowedClass) {
            $class = \App\Registry::$config->category->bufferingAllowedClass;
            $buffering = new $class($this->_request);
        } else {
            //domyślny cmsowy obiekt sprawdzający, czy można buforować
            $buffering = new \Cms\Model\CategoryBuffering($this->_request);
        }
        return $buffering->isAllowed();
    }
1140261
protected function _setupDatabase()
    {
        //brak konfiguracji bazy
        if (!\App\Registry::$config->db || !\App\Registry::$config->db->driver) {
            return $this;
        }
        //obliczanie nazwy drivera
        $driver = '\\Mmi\\Db\\Adapter\\Pdo' . ucfirst(\App\Registry::$config->db->driver);
        //próba powołania drivera
        \App\Registry::$db = new $driver(\App\Registry::$config->db);
        //jeśli aplikacja w trybie debug
        if (\App\Registry::$config->debug) {
            //wstrzyknięcie profilera do adaptera bazodanowego
            \App\Registry::$db->setProfiler(new \Mmi\Db\DbProfiler);
        }
        //wstrzyknięcie do ORM
        \Mmi\Orm\DbConnector::setAdapter(\App\Registry::$db);
        return $this;
    }
105839
public function indexAction()
    {
        $this->view->roles = (new \Cms\Orm\CmsRoleQuery)->find();
        //jeśli niewybrana rola - przekierowanie na pierwszą istniejącą
        if (!$this->roleId && count($this->view->roles)) {
            $this->getResponse()->redirect('cmsAdmin', 'categoryAcl', 'index', ['roleId' => $this->view->roles[0]->id]);
        }
        //formularz edycji uprawnień
        $form = new Form\CategoryAclForm(null, ['roleId' => $this->roleId]);
        //po zapisie
        if ($form->isSaved()) {
            $this->getMessenger()->addMessage('messenger.categoryAcl.permissions.saved', true);
            //przekierowanie na zapisaną stronę
            $this->getResponse()->redirect('cmsAdmin', 'categoryAcl', 'index', ['roleId' => $this->roleId]);
        }
        $this->view->categoryAclForm = $form;
    }
1207365
public function init()
    {
        //wczytywanie sesji
        $session = new \Mmi\Session\SessionSpace(\Cms\Model\ConnectorModel::SESSION_SPACE);
        try {
            $data = (new \Cms\Model\ConnectorModel)->getData($session->url, 'exportFileObject', [], $session->identity, $session->credential);
        } catch (\Cms\Exception\ConnectorException $e) {
            //rollback - puste dane
            $data = [];
        }

        //obiekty do przesłania
        if (!empty($data)) {
            //lista obiektów
            $this->addElement((new Element\MultiCheckbox('fileObjects'))
                ->setLabel('form.connectorImportFilesForm.fileObjects.label')
                ->setMultioptions($data)
                ->setValue($data));

            //submit
            $this->addElement((new Element\Submit('submit'))
                ->setLabel('form.connectorImportFilesForm.submit.label'));
        }
    }
997218
public function getParentRecord()
    {
        //brak parenta
        if (!$this->parentId) {
            return;
        }
        //próba pobrania rodzica z cache
        if (null === $parent = \App\Registry::$cache->load($cacheKey = 'category-' . $this->parentId)) {
            //pobieranie rodzica
            \App\Registry::$cache->save($parent = (new \Cms\Orm\CmsCategoryQuery)
                ->withType()
                ->findPk($this->parentId), $cacheKey, 0);
        }
        //zwrot rodzica
        return $parent;
    }
468708
function html()
	{
		$params = $this->params();

		if(!empty($params['property']))
			$params['name'] = $params['property'];

		$form = $this->form();

		extract($params);

		$obj = $form->object();
		if(!$obj)
			$obj = $form->call('calling_object');

		$el_params = "";
		foreach(explode(' ', 'size style') as $p)
			if(!empty($$p))
				$el_params .= " $p=\"{$$p}\"";

		if(!empty($xref))
		{
			// Задан класс m2m связей
			if(is_object($xref))
				$xref_obj = $xref;
			else
				$xref_obj = bors_foo($xref);

			$list = $xref_obj->named_list($obj);
			$name = $xref_obj->name($obj, $xref_obj->class_name());
		}

		// http://admin2.aviaport.wrk.ru/newses/256783/form2/
		if(!empty($named_list))
			$list = bors_foo($named_list)->named_list();

		if(!is_array($list))
		{
			if(preg_match("!^(\w+)\->(\w+)$!", $list, $m))
			{
				if($m[1] == 'this')
					$list = call_user_func([$obj, $m[2]]);
				else
					$list = call_user_func([bors_foo($m[1]), $m[2]]);
			}
			elseif(preg_match("!^(\w+)\->(\w+)\('(.+)'\)!", $list, $m))
			{
				if($m[1] == 'this')
					$list = call_user_func([$obj, $m[2]], $m[3]);
				else
					$list = call_user_func([bors_foo($m[1]), $m[2]], $m[3]);
			}
			elseif(preg_match("!^\w+$!", $list))
			{
				$list_class = $list;
				$list = new $list_class(@$args);
				$list = $list->get('named_list');
				if(!$list)
					$list = base_list::make($list_class, array(), $params + array('non_empty' => true));
			}
			else
			{
				eval('$list='.$list);
			}
		}

		if(!$current && !empty($list['default']))
			$current = $list['default'];

		if(empty($delim))
			$delim = "<br />";

		$ids = array();

		$values = $value;

		if(empty($values))
		{
			if(empty($get))
				$current = preg_match('!^\w+$!', $name) ? (isset($value)?$value:($obj?$obj->get($name):0)) : 0;
			else
				$current = $obj->$get();

			if(!$current && !empty($list['default']))
				$current = $list['default'];

			if(!is_array($current))
				$current = array($current);
		}
		else
			$current = $values;

		$class = explode(' ', defval($params, 'class'));

		if(in_array($name, explode(',', session_var('error_fields'))))
			$class[] = "error";

		if($class)
			$class = ' class="'.join(' ', $class).'"';
		else
			$class = '';

		$label_css = explode(' ', defval($params, 'label_css', ''));

		if(in_array($name, explode(',', session_var('error_fields'))))
			$label_css[] = "error";

		if(!empty($label_css))
			$label_css = " class=\"".join(" ", $label_css)."\"";
		else
			$label_css = "";

		if($input_data_toggle = defval($params, 'input_data_toggle', ''))
			$input_data_toggle = " data-toggle=\"$input_data_toggle\"";

		$html = '';

		// Если нужно, добавляем заголовок поля
		$html .= $this->label_html();

		// Если отдельный блок, то на всю ширину.
		if($this->label() && empty($style))
			$style = "width: 99%";

		$labels_html = array();

		if($columns)
		{
			$labels_html[] = "<table><tr><td style=\"padding: 0 10px 0 0\">";
			$per_column = ceil(count($list) / $columns);
		}

		$pos = 0;

		foreach($list as $id => $iname)
		{
			if($columns && $pos && $pos % $per_column == 0)
				$labels_html[] = "</td><td>";

			$ids[] = $id;
			$checked = in_array($id, $current);
			$labels_html[] = "<label{$label_css}><input type=\"checkbox\" name=\"".addslashes($name)."[]\" value=\"$id\"".($checked ? " checked=\"checked\"" : "")."$el_params$class$input_data_toggle />".($checked?'<b>':'')."&nbsp;$iname".($checked?'</b>':'')."</label>$delim\n";
			$pos++;

		}

		if($columns)
			$labels_html[] = "</td></tr></table>";

		$labels_html = join("", $labels_html);

		if($container = defval($params, 'label_container'))
			$labels_html = sprintf($container, $labels_html);

		$html .= $labels_html;

		$form->append_attr('checkboxes_list', $name);

		if($form->get('has_form_table'))
			$html .= "</td></tr>\n";

		return $html;
	}
283529
private function init_request()
	{
		global $request;

		# Значения по умолчанию
		$request = array(
			'method' => $_SERVER['REQUEST_METHOD'],
			'scheme' => isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) ? 'https' : 'http',
			'host' => strtolower($_SERVER['HTTP_HOST']),
			'port' => '',
			'user' => isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : '',
			'pass' => isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : '',
			'path' => '',
			'query' => '',
			'fragment' => '',
			'referer' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '',
		);

		$request['url'] = $request['scheme'] . '://' . $request['host'] . $_SERVER['REQUEST_URI'];

		$request = array_merge($request, parse_url($request['url']));
		$request['file'] = substr($request['path'], strrpos($request['path'], '/')+1);
		if ($request['file'])
		{
			$request['path'] = substr($request['path'], 0, -strlen($request['file']));
		}

		# Создаем заготовку URL для GET-запросов с параметрами
		$request['link'] = $request['url'];
		if (substr($request['link'], -1) == '/')
		{
			$request['link'] .= '?';
		}
		elseif (strpos($request['link'], '?') === false)
		{
			$request['link'] .= '?';
		}
		else
		{
			$request['link'] .= '&';
		}

		if (is_null($this->path))
		{
			$s = $this->froot;
			$s = substr($s,
				strlen(realpath($_SERVER['DOCUMENT_ROOT'])) - (Eresus_Kernel::isWindows() ? 2 : 0));
			if (!strlen($s) || substr($s, -1) != '/')
			{
				$s .= '/';
			}
			$this->path = (substr($s, 0, 1) != '/' ? '/' : '').$s;
		}

		/*
		 * Установка свойств объекта $Eresus
		 * Должна выполняться ДО вызова __clearargs
		 */
		$root = $request['scheme'] . '://' . $request['host'] .
			($request['port'] ? ':'.$request['port'] : '');
		$this->root = $root.$this->path;
		$this->data = $this->root.'data/';
		$this->style = $this->root.'style/';


		# Сбор аргументов вызова
		$request['arg'] = __clearargs(array_merge($_GET, $_POST));
		# Разбивка параметров вызова скрипта
		$s = substr($request['path'], strlen($this->path));
		$request['params'] = $s ? explode('/', substr($s, 0, -1)) : array();

		$request['path'] = $root.$request['path'];

		# Обратная совместимость
		# <= 2.9
		$this->request = &$request;
        /**
         * @deprecated с 3.01
         */
		define('httpPath', $this->path);
        /**
         * @deprecated с 3.01
         */
		define('httpHost', $this->request['host']);
        /**
         * @deprecated с 3.01
         */
        define('httpRoot', $this->root);
        /**
         * @deprecated с 3.01
         */
		define('styleRoot', $this->style);
        /**
         * @deprecated с 3.01
         */
		define('dataRoot', $this->data);
        /**
         * @deprecated с 3.01
         */
		define('cookieHost', $this->request['host']);
        /**
         * @deprecated с 3.01
         */
		define('cookiePath', $this->path);
	}
310072
public function handleRequest()
    {
        //obsługa danych z POST
        $post = FrontController::getInstance()->getRequest()->getPost();
        //brak posta
        if ($post->isEmpty()) {
            return;
        }
        //niedozwolone na ACL (w edycji na polu operacje)
        if ($this->_checkbox->getGrid()->getColumn('_operation_') && !(new AclAllowed)->aclAllowed($this->_checkbox->getGrid()->getColumn('_operation_')->getOption('editParams'))) {
            return;
        }
        if ($this->_changeRecord($post)) {
            exit;
        }
    }
682009
public function _info()
    {
        $inf = array();
        $ar  = array();
        foreach ($this->attribs as $i => $a) {
            $ar[$i] = self::html_attr2str($a);
        }

        $inf['attribs']   = $ar;
        $inf['attrs']     = $this->attrs;
        $inf['idx_attr']  = $this->idx_attr;
        $inf['tag_idx']   = $this->tag_idx;
        $inf['attr_idx']  = $this->attr_idx;
        $inf['class_idx'] = $this->class_idx;

        $lev = array();
        $nm  = array();
        $st  = array();
        $pb  = -1;
        $pe  = PHP_INT_MAX;
        $l   = 0;
        foreach ($this->ids as $b => $e) {
            if ($pb < $b && $b < $pe) {
                $st[]          = array($pb, $pe);
                list($pb, $pe) = array($b, $e);
            } else {
                while ($pe < $b && $st) {
                    list($pb, $pe) = array_pop($st);
                }
            }

            $nm[$b]  = $this->tags[$b];
            $lev[$b] = count($st);
        }
        foreach ($nm as $b => &$n) {
            $n = str_repeat(' -', $lev[$b]) . ' < ' . $n . ' ' . $this->get_attr_byId($b, null, true) . ' >';
        }
        $nm           = implode("\n", $nm);
        $inf['struc'] = $nm;
        unset($lev, $st, $nm);
        return $inf;
    }
506668
protected function _insert()
    {
        //data dodania
        if (!$this->dateAdd) {
            $this->dateAdd = date('Y-m-d H:i:s');
        }
        //właściciel pliku
        if (!$this->cmsAuthId) {
            $this->cmsAuthId = \App\Registry::$auth ? \App\Registry::$auth->getId() : null;
        }
        return parent::_insert();
    }
138286
public function editAction()
    {
        $this->getResponse()->setTypeJson();
        $error = json_encode(['error' => 'Edycja nie powiodła się, brak pliku']);
        //brak id
        if (!$this->id) {
            return $error;
        }
        //brak pliku
        if (null === ($file = (new CmsFileQuery)->findPk($this->id))) {
            return $error;
        }
        //błędny plik
        if ($this->hash != $file->getHashName()) {
            return $error;
        }
        //zapis
        $postData = $this->getPost()->toArray();
        if (!empty($postData)) {
            $file->setFromArray($postData)
                ->save();
        }
        //json na potrzeby wyświetlenia formularza
        return $file->toJson();
    }
1301635
public function createComponentLoginForm() : Form
    {
        $form = new Form;

        $form->addText('email')
            ->setRequired('E-mail je povinný.')
            ->addRule(Form::EMAIL, 'E-mail není ve správném formátu.');

        $form->addPassword('password')
            ->setRequired('Heslo je povinné.');

        $form->addSubmit('login');

        $form->onValidate[] = function (Form $form) { $this->validate($form); };
        $form->onSuccess[] = function (Form $form) { $this->success($form); };

        return $form;
    }
1221674
private function _getHtmlTree()
    {
        //pobranie struktury
        $structure = $this->getOption('structure');
        //bez struktury zwraca pusty string
        if (!is_array($structure) || empty($structure)) {
            return '';
        }
        //bez dzieci rowniez zwraca pusty string
        if (!isset($structure['children'])) {
            return '';
        }
        //skladam identyfikator galezi
        $treeId = $this->getOption('id') . '_tree';
        //zidentyfikowana gałąź drzewa
        $html = '<div class="tree_structure" id="' . $treeId . '">';
        $html .= $this->_generateTree($structure, '');
        $html .= '</div>';
        $html .= '<button type="button" id="' . $treeId . '_clear" class="tree_clear btn" /> Wyczyść wybór </button>';

        $this->_generateJs($treeId);

        return $html;
    }
1199595
protected function _renderImprintElements()
    {
        //pusta metryczka
        if (!is_array($this->getImprint())) {
            return;
        }
        $html = '';
        //iteracja po elementach
        foreach ($this->getImprint() as $element) {
            $html .= $this->_renderImprintElement($element);
        }
        return $html;
    }