use DOMDocument;
use DOMXPath;
use Exception;
-use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\Network\HTTPException\InternalServerErrorException;
-use Monolog;
+use Psr\Log\LoggerInterface;
/**
*
public $mobileDetect;
/**
- * @var Monolog\Logger The current logger of this App
+ * @var LoggerInterface The current logger of this App
*/
private $logger;
* @see initHead()
*
* @param string $path
+ * @throws InternalServerErrorException
*/
public function registerStylesheet($path)
{
* @see initFooter()
*
* @param string $path
+ * @throws InternalServerErrorException
*/
public function registerFooterScript($path)
{
/**
* @brief App constructor.
*
- * @param string $basePath Path to the app base folder
- * @param Monolog\Logger Logger of this application
- * @param bool $isBackend Whether it is used for backend or frontend (Default true=backend)
+ * @param string $basePath Path to the app base folder
+ * @param LoggerInterface $logger Logger of this application
+ * @param bool $isBackend Whether it is used for backend or frontend (Default true=backend)
*
* @throws Exception if the Basepath is not usable
*/
- public function __construct($basePath, $logger, $isBackend = true)
+ public function __construct($basePath, LoggerInterface $logger, $isBackend = true)
{
$this->logger = $logger;
/**
* Returns the Logger of the Application
*
- * @return Monolog\Logger The Logger
+ * @return LoggerInterface The Logger
* @throws InternalServerErrorException when the logger isn't created
*/
public function getLogger()
$this->process_id = Core\System::processID('log');
- Logger::loadDefaultHandler($this->logger, $this);
+ Core\Logger::setLogger($this->logger);
}
/**
* finally for PWD
*
* @return string
+ * @throws InternalServerErrorException
*/
public function getBasePath()
{
*
* @param bool $ssl Whether to append http or https under SSL_POLICY_SELFSIGN
* @return string Friendica server base URL
+ * @throws InternalServerErrorException
*/
public function getBaseURL($ssl = false)
{
* Clears the baseurl cache to prevent inconsistencies
*
* @param string $url
+ * @throws InternalServerErrorException
*/
public function setBaseURL($url)
{
* @param string $origURL
*
* @return string The cleaned url
+ * @throws InternalServerErrorException
*/
public function removeBaseURL($origURL)
{
* Returns the current UserAgent as a String
*
* @return string the UserAgent as a String
+ * @throws InternalServerErrorException
*/
public function getUserAgent()
{
* @brief Checks if the minimal memory is reached
*
* @return bool Is the memory limit reached?
+ * @throws InternalServerErrorException
*/
public function isMinMemoryReached()
{
* @brief Checks if the maximum load is reached
*
* @return bool Is the load reached?
+ * @throws InternalServerErrorException
*/
public function isMaxLoadReached()
{
*
* @param string $command The command to execute
* @param array $args Arguments to pass to the command ( [ 'key' => value, 'key2' => value2, ... ]
+ * @throws InternalServerErrorException
*/
public function proc_run($command, $args)
{
/**
* @brief Checks if a given directory is usable for the system
*
+ * @param $directory
+ * @param bool $check_writable
* @return boolean the directory is usable
+ * @throws Exception
*/
public static function isDirectoryUsable($directory, $check_writable = true)
{
* Generates the site's default sender email address
*
* @return string
+ * @throws InternalServerErrorException
*/
public function getSenderEmailAddress()
{
* Returns the current theme name.
*
* @return string the name of the current theme
+ * @throws InternalServerErrorException
*/
public function getCurrentTheme()
{
* Provide a sane default if nothing is chosen or the specified theme does not exist.
*
* @return string
+ * @throws InternalServerErrorException
*/
public function getCurrentThemeStylesheetPath()
{
// And then append it to the target
$target->documentElement->appendChild($item);
}
- }
- if (isset($_GET["mode"]) && ($_GET["mode"] == "raw")) {
- header("Content-type: text/html; charset=utf-8");
+ if ($_GET["mode"] == "raw") {
+ header("Content-type: text/html; charset=utf-8");
- echo substr($target->saveHTML(), 6, -8);
+ echo substr($target->saveHTML(), 6, -8);
- exit();
+ exit();
+ }
}
$page = $this->page;
* Should only be used if it isn't clear if the URL is either internal or external
*
* @param string $toUrl The target URL
- *
+ * @throws InternalServerErrorException
*/
public function redirect($toUrl)
{