/** * Make a thumb image. * * @internal */ public function thumb() { $this->width = Request::getIntParam('width', 100); $this->height = Request::getIntParam('height', 100); $this->cropimage = Request::getBoolParam('cropimage', false); $this->processing = true; $this->stats_disable = true; $this->path_sendfile = sprintf(Application::$CACHE_ROOT . 'thumb/%s/%s_%sx%s.thumb', $this->sid[0], $this->sid, $this->width, $this->height); $this->download(); }
/** * Builds transactions about command executions and catches \Exceptions, set error messages and redirects to * bypass form re-submit of data. Specific actions are defined in handleCommand. Use class property 'atomic' to * disable cmd wide transactions * * @internal * * @param string $cmd * * @throws exception\ControllerException|\Exception|exception\NotAuthorizedException */ protected final function executeCommand($cmd) { $this->command = $cmd; if ($this->isJSON && Request::getBoolParam('json_blacklist')) { self::sendInternalError(); } try { if ($this->atomic) { DBConnection::getInstance()->beginTransaction(); } // call command if (method_exists($this, $cmd) === false) { Logger::getInstance()->error(_s('method %s::%s does not exist.', get_class($this), $cmd)); throw new exception\ControllerException(_s('Die Aktion konnte nicht ausgeführt werden.')); } $this->{$cmd}(); if ($this->atomic) { DBConnection::getInstance()->commit(); } } catch (exception\InvalidParameterException $e) { $this->error(_s('Die folgenden Angaben sind unvollständig:')); foreach ($e->getParameters() as $param) { $this->error($param['description'], $param['name']); } } catch (exception\ControllerException $e) { $this->error($e->getMessage()); } catch (exception\NotAuthorizedException $e) { if (DBConnection::getInstance()->inTransaction()) { DBConnection::getInstance()->rollBack(); } throw $e; } catch (exception\UnexpectedIntegrityConstraintViolationException $e) { $this->error(_s('Integritätsprüfung fehlgeschlagen.')); } catch (\Exception $e) { Logger::getInstance()->exception($e); $this->error(_s('Fehler beim ausführen der Aktion.: ') . $e->getMessage()); } // by default, guess it failed and roll back the queries if (DBConnection::getInstance()->inTransaction()) { DBConnection::getInstance()->rollBack(); } }