Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • tedomum/ttrss
  • mickge/ttrss
2 results
Show changes
Showing
with 5066 additions and 0 deletions
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
class Handler implements IHandler {
protected PDO $pdo;
/** @var array<int|string, mixed> */
protected array $args;
/**
* @param array<int|string, mixed> $args
*/
function __construct(array $args) {
$this->pdo = Db::pdo();
$this->args = $args;
}
function csrf_ignore(string $method): bool {
return false;
}
function before(string $method): bool {
return true;
}
function after(): bool {
return true;
}
/**
* @param mixed $p
*/
public static function _param_to_bool($p): bool {
$p = clean($p);
return $p && ($p !== "f" && $p !== "false");
}
}
<?php
class Handler_Administrative extends Handler_Protected {
function before(string $method): bool {
if (parent::before($method)) {
if (($_SESSION["access_level"] ?? 0) >= UserHelper::ACCESS_LEVEL_ADMIN) {
return true;
}
}
return false;
}
}
<?php
class Handler_Protected extends Handler {
function before(string $method): bool {
return parent::before($method) && !empty($_SESSION['uid']);
}
}
This diff is collapsed.
<?php
interface IAuthModule {
/**
* @param string $login
* @param string $password
* @param string $service
* @return int|false user_id
*/
function authenticate($login, $password, $service = '');
/** this is a pluginhost compatibility wrapper that invokes $this->authenticate(...$args) (Auth_Base)
* @param string $login
* @param string $password
* @param string $service
* @return int|false user_id
*/
function hook_auth_user($login, $password, $service = '');
}
<?php
interface IAuthModule2 extends IAuthModule {
function change_password(int $owner_uid, string $old_password, string $new_password) : string;
}
<?php
interface ICatchall {
function catchall(string $method): void;
}
<?php
interface IHandler {
function csrf_ignore(string $method): bool;
function before(string $method): bool;
function after(): bool;
}
<?php
interface IVirtualFeed {
function get_unread(int $feed_id) : int;
function get_total(int $feed_id) : int;
/**
* @param int $feed_id
* @param array<string,int|string|bool> $options
* @return array<int,int|string>
*/
function get_headlines(int $feed_id, array $options) : array;
}
This diff is collapsed.
This diff is collapsed.
<?php
interface Logger_Adapter {
function log_error(int $errno, string $errstr, string $file, int $line, string $context): bool;
}
This diff is collapsed.
<?php
class Logger_Stdout implements Logger_Adapter {
function log_error(int $errno, string $errstr, string $file, int $line, string $context): bool {
switch ($errno) {
case E_ERROR:
case E_PARSE:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
case E_USER_ERROR:
$priority = LOG_ERR;
break;
case E_WARNING:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
case E_USER_WARNING:
$priority = LOG_WARNING;
break;
default:
$priority = LOG_INFO;
}
$errname = Logger::ERROR_NAMES[$errno] . " ($errno)";
print "[EEE] $priority $errname ($file:$line) $errstr\n";
return true;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.