Pobiera sformatowaną wiadomość
@return string
173386
public function getExtendedMessage()
    {
        $info = '';
        foreach ($this->getTrace() as $position) {
            if (isset($position['file'])) {
                $info .= ' ' . $position['file'] . '(' . $position['line'] . '): ' . $position['function'];
            }
        }
        $requestUri = \Mmi\App\FrontController::getInstance()->getEnvironment()->requestUri;
        return $requestUri . ' ' . strip_tags(parent::getMessage() . ': ' . $this->getFile() . '(' . $this->getLine() . ')' . $info);
    }
1129372
public function dispatchAction()
    {
        //pobranie kategorii
        $category = $this->_getPublishedCategoryByUri($this->uri);
        //wpięcie kategorii do głównego widoku aplikacji
        FrontController::getInstance()->getView()->category = $category;
        //klucz bufora
        $cacheKey = 'category-html-' . $category->id;
        //buforowanie dozwolone
        $bufferingAllowed = $this->_bufferingAllowed();
        //wczytanie zbuforowanej strony (dla niezalogowanych i z pustym requestem)
        if ($bufferingAllowed && (null !== $html = \App\Registry::$cache->load($cacheKey))) {
            //wysyłanie nagłówka o buforowaniu strony
            $this->getResponse()->setHeader('X-Cache', 'HIT');
            //zwrot html
            return $this->_decorateHtmlWithEditButton($html, $category);
        }
        //wysyłanie nagłówka o braku buforowaniu strony
        $this->getResponse()->setHeader('X-Cache', 'MISS');
        //przekazanie rekordu kategorii do widoku
        $this->view->category = $category;
        //renderowanie docelowej akcji
        $html = \Mmi\Mvc\ActionHelper::getInstance()->forward($this->_prepareForwardRequest($category));
        //buforowanie niedozwolone
        if (!$bufferingAllowed || 0 == $cacheLifetime = $this->_getCategoryCacheLifetime($category)) {
            //zwrot html
            return $this->_decorateHtmlWithEditButton($html, $category);
        }
        //zapis html kategorii do cache
        \App\Registry::$cache->save($html, $cacheKey, $cacheLifetime);
        //zwrot html
        return $this->_decorateHtmlWithEditButton($html, $category);
    }
845964
public function delete()
    {
        //zablokowane kasowanie admina i guesta
        if ($this->name == 'admin' || $this->name == 'guest') {
            return false;
        }
        \Mmi\Orm\DbConnector::getAdapter()->beginTransaction();
        //usuwanie uprawnień ról
        (new CmsAclQuery)->whereCmsRoleId()->equals($this->id)
            ->find()->delete();
        try {
            $result = parent::delete();
        } catch (Mmi\Db\DbException $e) {
            \Mmi\Orm\DbConnector::getAdapter()->rollBack();
            return false;
        }
        \Mmi\Orm\DbConnector::getAdapter()->commit();
        return $result;
    }
1038610
public function connect()
    {
        $this->_config->port = $this->_config->port ? $this->_config->port : 3306;
        //nowy obiekt PDO do odczytu danych
        $this->_downstreamPdo = new \PDO(
            $this->_config->driver . ':host=' . $this->_config->host . ';port=' . $this->_config->port . ';dbname=' . $this->_config->name . ';charset=utf8', $this->_config->user, $this->_config->password, [\PDO::ATTR_PERSISTENT => $this->_config->persistent]
        );
        //nowy obiekt pdo do zapisu danych
        $this->_upstreamPdo = new \PDO(
            $this->_config->driver . ':host=' . ($this->_config->upstreamHost ? $this->_config->upstreamHost : $this->_config->host) . ';port=' . ($this->_config->upstreamPort ? $this->_config->upstreamPort : $this->_config->port) . ';dbname=' . $this->_config->name . ';charset=utf8', $this->_config->user, $this->_config->password, [\PDO::ATTR_PERSISTENT => $this->_config->persistent]
        );
        //zmiana stanu na połączony
        $this->_connected = true;
        return $this;
    }
1151724
public final function find()
    {
        //ustalenie klasy rekordu
        $recordName = $this->_query->getRecordName();
        //ustalenie klasy kolekcji rekordów
        $collectionName = $this->_query->getCollectionName();
        //tworznie pustej kolekcji
        $collection = new $collectionName();
        //iteracja po danych z bazy
        foreach (DbConnector::getAdapter()->select($this->_prepareFields(), $this->_prepareFrom(), $this->_query->getQueryCompile()->where, $this->_query->getQueryCompile()->groupBy, $this->_query->getQueryCompile()->order, $this->_query->getQueryCompile()->limit, $this->_query->getQueryCompile()->offset, $this->_query->getQueryCompile()->bind) as $row) {
            //tworzenie i dodawanie rekordu
            $collection->append((new $recordName)->setFromArray($row)->clearModified());
        }
        //zwrot kolekcji
        return $collection;
    }
1313415
public function getMvcParamsAsRequest()
    {
        $mvcParams = [];
        //parsowanie ciągu
        parse_str($this->mvcParams, $mvcParams);
        return new \Mmi\Http\Request($mvcParams);
    }
417186
protected final function _prepareFields()
    {
        //jeśli pusty schemat połączeń
        if (empty($this->_query->getQueryCompile()->joinSchema)) {
            return '*';
        }
        $fields = '';
        //pobranie struktury tabeli
        $mainStructure = DbConnector::getTableStructure($this->_query->getTableName());
        //przygotowanie tabeli
        $table = DbConnector::getAdapter()->prepareTable($this->_query->getTableName());
        //iteracja po polach tabeli głównej
        foreach ($mainStructure as $fieldName => $info) {
            //dodawanie pola
            $fields .= $table . '.' . DbConnector::getAdapter()->prepareField($fieldName) . ', ';
        }
        //pola z tabel dołączonych
        foreach ($this->_query->getQueryCompile()->joinSchema as $schema) {
            //pobranie struktury tabeli dołączonej
            $structure = DbConnector::getTableStructure($schema[0]);
            //alias połączenia
            $joinAlias = isset($schema[5]) ? $schema[5] : $schema[0];
            //pola tabeli dołączonej
            foreach ($structure as $fieldName => $info) {
                $fields .= DbConnector::getAdapter()->prepareTable($joinAlias) . '.' . DbConnector::getAdapter()->prepareField($fieldName) . ' AS ' . DbConnector::getAdapter()->prepareField($joinAlias . '__' . $schema[0] . '__' . $fieldName) . ', ';
            }
        }
        return rtrim($fields, ', ');
    }
1334054
public function wsdlAction()
    {
        try {
            $apiModel = $this->_getModelName($this->obj);
            $serverParams = [
                'module' => 'cms',
                'controller' => 'api',
                'action' => 'soapServer',
                'obj' => $this->obj,
            ];
            //serwer z autoryzacją (WSDL jest publiczny)
            if ($this->type == 'private' || \Mmi\App\FrontController::getInstance()->getEnvironment()->authUser) {
                $apiModel .= 'Private';
            }
            //link do serwera SOAP
            $url = $this->view->url($serverParams, true, true, $this->_isSsl());
            //typ odpowiedzi application/xml
            $this->getResponse()->setTypeXml();
            //@TODO: przepisać do ZF2
            require_once BASE_PATH . '/vendors/Zend/Soap/AutoDiscover.php';
            //rozpoznanie usługi (klasy)
            $autodiscover = new \Zend_Soap_AutoDiscover;
            $autodiscover->setClass($apiModel);
            $autodiscover->setUri($url);
            //obsługa żądania
            $autodiscover->handle();
            return '';
        } catch (\Exception $e) {
            //internal server error
            $this->_internalError($e);
        }
    }
786602
public function getExposureTime()
    {
        //brak exposure
        if (!isset($this->_exif['ExposureTime'])) {
            return;
        }
        //obliczenia czasu ekspozycji do eleganckiej postaci
        $arr = explode('/', $this->_exif['ExposureTime']);
        if (count($arr) == 2 && $arr[0] > 1 && $arr[1] > $arr[0]) {
            return '1/' . round($arr[1] / $arr[0]);
        }
        if (count($arr) == 2 && $arr[0] > 1 && $arr[1] > 0) {
            return round($arr[0] / $arr[1]);
        }
        return $this->_exif['ExposureTime'];
    }
837815
public function detailsAction()
    {
        if (!$this->getPost()->cmsFileId) {
            return $this->_jsonError(185);
        }
        //szukamy rekordu pliku
        if (null == $record = (new CmsFileQuery)->findPk($this->getPost()->cmsFileId)) {
            return $this->_jsonError(185);
        }
        //wycinamy rozszerzenie z nazwy oryginalnego pliku do edycji
        //pozycja ostatniej kropki w nazwie
        $pointPosition = strrpos($record->original, '.');
        if ($pointPosition !== false) {
            $record->original = substr($record->original, 0, $pointPosition);
        }
        $data = [];
        if ($record->data instanceof \Mmi\DataObject) {
            //parametry
            $data = $record->data->toArray();
        }
        $data['urlFile'] = ((\App\Registry::$config->cdn) ? : $record->getUrl());
        if ($record->data->posterFileName) {
            $data['poster'] = $record->getPosterUrl();
        }    
        return json_encode(['result' => 'OK', 'record' => $record, 'data' => $data]);
    }
772714
public function get()
    {
        $elapsed = $this->elapsed();
        //iteracja po danych
        foreach ($this->_data as $key => $item) {
            if ($elapsed == 0) {
                $this->_data[$key]['percent'] = 0;
                continue;
            }
            $this->_data[$key]['percent'] = 100 * $item['elapsed'] / $elapsed;
        }
        return $this->_data;
    }
1272788
public function uploadAction()
    {
        $files = $this->getFiles()->toArray();
        //brak plików lub klasy
        $error = null;
        if (empty($files) || !isset($files['file']) || empty($files['file']) || !$this->class) {
            $error = 'Błąd: nie przesłano pliku';
        }
        //nieprawidłowy hash zabezpieczający
        if ($this->hash != md5($this->t . '+' . \Mmi\Session\Session::getId() . '+' . $this->class)) {
            $error = 'Błąd: nieprawidłowy hash';
        }
        //jeśli nie było błędu
        if ($error === null) {
            //dołączanie plików
            if (!\Cms\Model\File::appendFiles($this->object, $this->objectId, $files, $this->types ? $this->types : [])) {
                $error = 'Nieprawidłowy typ pliku';
            }
        }
        //rendering widgeta uploadera
        return $this->view->widget('cms', 'file', 'uploader', [
                'object' => $this->object,
                'objectId' => $this->objectId,
                'types' => $this->types,
                'error' => $error
        ]);
    }
201756
public function fetchField()
    {
        $value = $this->getValue();
        if ($this->issetOption('multiple')) {
            $this->setName($this->getName() . '[]');
        }
        unset($this->_options['value']);
        //nagłówek selecta
        $html = '<select ' . $this->_getHtmlOptions() . '>';
        //generowanie opcji
        foreach (($this->getMultioptions() ? $this->getMultioptions() : []) as $key => $caption) {
            $disabled = '';
            //disabled
            if (strpos($key, ':disabled') !== false && !is_array($caption)) {
                $key = '';
                $disabled = ' disabled="disabled"';
            }
            //jeśli wystąpi zagnieżdżenie - generowanie grupy opcji
            if (is_array($caption)) {
                $html .= '<optgroup label="' . $key . '">';
                foreach ($caption as $k => $c) {
                    $html .= '<option value="' . $k . '" ' . $this->_calculateSelected($k, $value) . $disabled . '>' . \App\Registry::$translate->_($c) . '</option>';
                }
                $html .= '</optgroup>';
                continue;
            }
            //dodawanie pojedynczej opcji
            $html .= '<option value="' . $key . '"' . $this->_calculateSelected($key, $value) . $disabled . '>' . \App\Registry::$translate->_($caption) . '</option>';
        }
        $html .= '</select>';
        return $html;
    }
102318
public function indexAction()
    {
        $config = clone (\App\Registry::$config);
        //za długie dane do wyświetlenia
        $config->navigation = self::THREE_DOTS;
        $config->router = self::THREE_DOTS;
        $this->view->config = \Mmi\Http\ResponseDebugger\Colorify::colorify(print_r($config, true));
        $this->view->server = \Mmi\Http\ResponseDebugger\Colorify::colorify(print_r($_SERVER, true));
    }
1305512
public function sortAction()
    {
        $this->getResponse()->setTypePlain();
        if (!$this->getPost()->__get('item-file')) {
            return $this->view->getTranslate()->_('Przenoszenie nie powiodło się');
        }
        \Cms\Model\File::sortBySerial($this->getPost()->__get('item-file'));
        return '';
    }
81164
public function getFileObjects()
    {
        $fileObjects = [];
        //iteracja po unikalnych obiektach
        foreach ((new \Cms\Orm\CmsFileQuery)->findUnique('object') as $object) {
            //pominięcie plików tymczasowych
            if ('tmp-' == substr($object, 0, 4)) {
                continue;
            }
            //dodanie pliku
            $fileObjects[$object] = $object;
        }
        return $fileObjects;
    }
117252
public function navigation()
    {
        //brak wygenerowanych breadcrumbów
        if (null === $this->_breadcrumbs) {
            return $this->_buildBreadcrumbs();
        }
        //ustawienia domyślne
        return $this->setMaxDepth()
                ->setMinDepth()
                ->setActiveBranchOnly(false)
                ->setAllowedOnly(true);
    }