Coding style

This commit is contained in:
Visman 2020-07-03 15:28:10 +07:00
parent 700435010a
commit 0799853a93
83 changed files with 365 additions and 42 deletions

View file

@ -61,6 +61,7 @@ class Install
$page = $this->c->Redirect->page('Install')->message('Redirect to install');
break;
}
return $page;
}
}

View file

@ -40,6 +40,7 @@ class Primary
if (! $this->c->isInit('user')) {
$this->c->user = $this->c->users->create(['id' => 1, 'group_id' => $this->c->GROUP_GUEST]);
}
return $this->c->Maintenance;
}
}

View file

@ -625,6 +625,7 @@ class Routing
$page = $this->c->Message->message('Bad request', true, 501);
break;
}
return $page;
}
}

View file

@ -63,6 +63,7 @@ class FileCache implements ProviderCacheInterface
return $data;
}
}
return $default;
}
@ -86,6 +87,7 @@ class FileCache implements ProviderCacheInterface
throw new RuntimeException("The key '$key' can not be saved");
} else {
$this->invalidate($file);
return true;
}
}
@ -105,6 +107,7 @@ class FileCache implements ProviderCacheInterface
if (\is_file($file)) {
if (\unlink($file)) {
$this->invalidate($file);
return true;
} else {
throw new RuntimeException("The key `$key` could not be removed");
@ -129,6 +132,7 @@ class FileCache implements ProviderCacheInterface
foreach ($files as $file) {
$result = \unlink($file->getPathname()) && $result;
}
return $result;
}

View file

@ -109,6 +109,7 @@ class Container
if ($toShare) {
$this->instances[$id] = $service;
}
return $service;
}
@ -146,6 +147,7 @@ class Container
return null;
}
}
return $ptr;
}
@ -210,6 +212,7 @@ class Container
}
unset($v);
}
return $value;
}

View file

@ -46,6 +46,7 @@ class Csrf
$marker .= $key . '|' . (string) $value . '|';
}
$time = $time ?: \time();
return $this->secury->hmac($marker, $time . $this->key) . 'f' . $time;
}

View file

@ -95,6 +95,7 @@ class DB extends PDO
$drv = 'ForkBB\\Core\\DB\\' . \ucfirst($this->dbType);
$this->dbDrv = new $drv($this, $this->dbPrefix);
}
return $this->dbDrv->$name(...$args);
}
@ -117,6 +118,7 @@ class DB extends PDO
return false;
}
}
return true;
}
@ -178,10 +180,12 @@ class DB extends PDO
$res[] = $name;
$map[$key][] = $name;
}
return \implode(',', $res);
},
$query
);
return $map;
}
@ -267,6 +271,7 @@ class DB extends PDO
$start = \microtime(true);
$result = parent::exec($query);
$this->saveQuery($query, \microtime(true) - $start);
return $result;
}
@ -346,6 +351,7 @@ class DB extends PDO
$start = \microtime(true);
$result = parent::query($query, ...$args);
$this->saveQuery($query, \microtime(true) - $start);
return $result;
}
@ -374,6 +380,7 @@ class DB extends PDO
$start = \microtime(true);
$result = parent::beginTransaction();
$this->saveQuery('beginTransaction()', \microtime(true) - $start, false);
return $result;
}
@ -385,6 +392,7 @@ class DB extends PDO
$start = \microtime(true);
$result = parent::commit();
$this->saveQuery('commit()', \microtime(true) - $start, false);
return $result;
}
@ -396,6 +404,7 @@ class DB extends PDO
$start = \microtime(true);
$result = parent::rollback();
$this->saveQuery('rollback()', \microtime(true) - $start, false);
return $result;
}
}

View file

@ -108,6 +108,7 @@ class Mysql
}
unset($value);
}
return \implode(',', $arr);
}
@ -170,6 +171,7 @@ class Mysql
} catch (PDOException $e) {
return false;
}
return ! empty($result);
}
@ -200,6 +202,7 @@ class Mysql
} catch (PDOException $e) {
return false;
}
return ! empty($result);
}
@ -231,6 +234,7 @@ class Mysql
} catch (PDOException $e) {
return false;
}
return ! empty($result);
}
@ -316,6 +320,7 @@ class Mysql
}
$this->testStr($engine);
$query = \rtrim($query, ', ') . ") ENGINE={$engine} CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci";
return false !== $this->db->exec($query);
}
@ -331,6 +336,7 @@ class Mysql
{
$table = ($noPrefix ? '' : $this->dbPrefix) . $table;
$this->testStr($table);
return false !== $this->db->exec("DROP TABLE IF EXISTS `{$table}`");
}
@ -355,6 +361,7 @@ class Mysql
$this->testStr($old);
$new = ($noPrefix ? '' : $this->dbPrefix) . $new;
$this->testStr($new);
return false !== $this->db->exec("ALTER TABLE `{$old}` RENAME TO `{$new}`");
}
@ -390,6 +397,7 @@ class Mysql
$this->testStr($after);
$query .= " AFTER `{$after}`";
}
return false !== $this->db->exec($query);
}
@ -422,6 +430,7 @@ class Mysql
$this->testStr($after);
$query .= " AFTER `{$after}`";
}
return false !== $this->db->exec($query);
}
@ -442,6 +451,7 @@ class Mysql
$table = ($noPrefix ? '' : $this->dbPrefix) . $table;
$this->testStr($table);
$this->testStr($field);
return false !== $this->db->exec("ALTER TABLE `{$table}` DROP COLUMN `{$field}`");
}
@ -476,6 +486,7 @@ class Mysql
}
}
$query .= ' (' . $this->replIdxs($fields) . ')';
return false !== $this->db->exec($query);
}
@ -503,6 +514,7 @@ class Mysql
$this->testStr($index);
$query .= "DROP INDEX `{$index}`";
}
return false !== $this->db->exec($query);
}
@ -518,6 +530,7 @@ class Mysql
{
$table = ($noPrefix ? '' : $this->dbPrefix) . $table;
$this->testStr($table);
return false !== $this->db->exec("TRUNCATE TABLE `{$table}`");
}
@ -588,6 +601,7 @@ class Mysql
$type = \strtolower($row['DATA_TYPE']);
$result[$tableNoPref][$row['COLUMN_NAME']] = $this->types[$type] ?? 's';
}
return $result;
}
}

View file

@ -101,6 +101,7 @@ class DBStatement extends PDOStatement
$start = \microtime(true);
$result = parent::execute();
$this->db->saveQuery($this->queryString, \microtime(true) - $start);
return $result;
}
}

View file

@ -106,6 +106,7 @@ class ErrorHandler
}
$this->logged = false;
return true;
}
@ -290,6 +291,7 @@ EOT;
{
$type = $this->type[$error['type']] ?? $this->type[0];
$file = \str_replace($this->hidePath, '...', $error['file']);
return "PHP {$type}: \"{$error['message']}\" in {$file}:[{$error['line']}]";
}

View file

@ -146,6 +146,7 @@ class File
{
if (! \preg_match($this->pattern, $path, $matches)) {
$this->error = 'The path/name format is broken';
return null;
}
@ -213,11 +214,13 @@ class File
if (! \is_dir($dirname)) {
if (! @\mkdir($dirname, 0755)) {
$this->error = 'Can not create directory';
return false;
}
}
if (! \is_writable($dirname)) {
$this->error = 'No write access for directory';
return false;
}
@ -236,11 +239,13 @@ class File
if (\is_string($this->data)) {
if (! \file_put_contents($this->path, $path)) {
$this->error = 'Error writing file';
return false;
}
} else {
if (! \copy($this->path, $path)) {
$this->error = 'Error copying file';
return false;
}
}
@ -279,6 +284,7 @@ class File
&& \file_exists($info['dirname'] . $info['filename'] . '.' . $info['extension'])
) {
$this->error = 'Such file already exists';
return false;
}
@ -289,6 +295,7 @@ class File
$this->name = $info['filename'];
$this->ext = $info['extension'];
$this->size = \filesize($path);
return true;
} else {
return false;

View file

@ -187,6 +187,7 @@ class Files
} else {
$type = 0;
}
return $this->imageType[$type] ?? null;
}
@ -206,6 +207,7 @@ class Files
if (! isset($file['tmp_name'], $file['name'], $file['type'], $file['error'], $file['size'])) {
$this->error = 'Expected file description array';
return false;
}
@ -234,6 +236,7 @@ class Files
$result[] = $cur;
}
return empty($result) ? null : $result;
} else {
return '' === $file['name'] && empty($file['size']) ? null : $this->uploadOneFile($file);
@ -276,11 +279,13 @@ class Files
$this->error = 'Unknown upload error';
break;
}
return false;
}
if (! \is_uploaded_file($file['tmp_name'])) {
$this->error = 'The specified file was not uploaded';
return false;
}
@ -302,11 +307,13 @@ class Files
if ($isImage) {
if ($file['size'] > $this->maxImgSize) {
$this->error = 'The image too large';
return false;
}
} else {
if ($file['size'] > $this->maxFileSize) {
$this->error = 'The file too large';
return false;
}
}
@ -327,6 +334,7 @@ class Files
}
} catch (FileException $e) {
$this->error = $e->getMessage();
return false;
}
}

View file

@ -51,6 +51,7 @@ class Func
if (! \is_array($this->styles)) {
$this->styles = $this->getFoldersWithFile($this->c->DIR_PUBLIC . '/style', 'style.css');
}
return $this->styles;
}
@ -64,6 +65,7 @@ class Func
if (! \is_array($this->langs)) {
$this->langs = $this->getFoldersWithFile($this->c->DIR_LANG, 'common.po');
}
return $this->langs;
}
@ -114,6 +116,7 @@ class Func
\closedir($dh);
\asort($result, \SORT_NATURAL);
}
return $result;
}
@ -201,6 +204,7 @@ class Func
];
}
}
return $pages;
}

View file

@ -157,11 +157,13 @@ class Image extends File
break;
default:
$this->error = 'File type not supported';
return false;
}
if (! $result) {
$this->error = 'Error writing file';
return false;
}
@\chmod($path, 0644);

View file

@ -268,6 +268,7 @@ class Lang
) {
$line = \substr($line, 1, -1);
}
return \str_replace(
['\\n', '\\t', '\\"', '\\\\'],
["\n", "\t", '"', '\\'],

View file

@ -174,6 +174,7 @@ class Mail
$this->to = [];
$this->headers = [];
$this->message = null;
return $this;
}
@ -187,6 +188,7 @@ class Mail
public function setSubject(string $subject): self
{
$this->headers['Subject'] = $this->encodeText(\preg_replace('%[\x00-\x1F]%', '', \trim($subject)));
return $this;
}
@ -209,6 +211,7 @@ class Mail
$this->to[] = $this->formatAddress($cur, $name);
}
}
return $this;
}
@ -223,6 +226,7 @@ class Mail
public function setTo($email, string $name = null): self
{
$this->to = [];
return $this->addTo($email, $name);
}
@ -240,6 +244,7 @@ class Mail
if (false !== $email) {
$this->headers['From'] = $this->formatAddress($email, $name);
}
return $this;
}
@ -257,6 +262,7 @@ class Mail
if (false !== $email) {
$this->headers['Reply-To'] = $this->formatAddress($email, $name);
}
return $this;
}
@ -277,6 +283,7 @@ class Mail
return $email;
} else {
$name = $this->encodeText($this->filterName($name));
return \sprintf('"%s" <%s>', $name, $email);
}
}
@ -319,6 +326,7 @@ class Mail
public function setFolder(string $folder): self
{
$this->folder = $folder;
return $this;
}
@ -332,6 +340,7 @@ class Mail
public function setLanguage(string $language): self
{
$this->language = $language;
return $this;
}
@ -360,6 +369,7 @@ class Mail
throw new MailException('The template is empty (' . $file . ').');
}
$this->setSubject(\substr($subject, 8));
return $this->setMessage($tpl);
}
@ -376,6 +386,7 @@ class Mail
\str_replace(["\r\n", "\n", "\r"], "\0",
\str_replace("\0", '', \trim($message))));
// $this->message = wordwrap ($this->message, 75, $this->EOL, false);
return $this;
}
@ -428,6 +439,7 @@ class Mail
$headers = $this->headers;
unset($headers['Subject']);
$headers = $this->strHeaders($headers);
return @\mail($to, $subject, $this->message, $headers);
}
@ -444,6 +456,7 @@ class Mail
$value = $key . ': ' . $value;
}
unset($value);
return \implode($this->EOL, $headers);
}
@ -478,6 +491,7 @@ class Mail
$this->smtpData('To: ' . $to . $this->EOL . $headers . $message, '250');
$this->smtpData('NOOP', '250');
}
return true;
}
@ -549,6 +563,7 @@ class Mail
) {
throw new SmtpException('Unable to send email. Response of mail server: "' . $get . '"');
}
return $return;
}

View file

@ -75,6 +75,7 @@ class Parser extends Parserus
if ('quote' == $bb['tag']) {
$bb['self nesting'] = (int) $this->c->config->o_quote_depth;
}
return parent::addBBCode($bb);
}

View file

@ -190,14 +190,18 @@ class Router
|| empty($this->methods['GET'])
)
) {
return [self::NOT_IMPLEMENTED];
return [
self::NOT_IMPLEMENTED,
];
}
if ($this->length) {
if (0 === \strpos($uri, $this->prefix)) {
$uri = \substr($uri, $this->length);
} else {
return [self::NOT_FOUND];
return [
self::NOT_FOUND,
];
}
}
@ -206,13 +210,25 @@ class Router
if (isset($this->statical[$uri])) {
if (isset($this->statical[$uri][$method])) {
list($handler, $marker) = $this->statical[$uri][$method];
return [self::OK, $handler, [], $marker];
return [
self::OK,
$handler,
[],
$marker,
];
} elseif (
$head
&& isset($this->statical[$uri]['GET'])
) {
list($handler, $marker) = $this->statical[$uri]['GET'];
return [self::OK, $handler, [], $marker];
return [
self::OK,
$handler,
[],
$marker,
];
} else {
$allowed = \array_keys($this->statical[$uri]);
}
@ -247,13 +263,24 @@ class Router
: null;
}
}
return [self::OK, $handler, $args, $marker];
return [
self::OK,
$handler,
$args,
$marker,
];
}
}
if (empty($allowed)) {
return [self::NOT_FOUND];
return [
self::NOT_FOUND,
];
} else {
return [self::METHOD_NOT_ALLOWED, $allowed];
return [
self::METHOD_NOT_ALLOWED,
$allowed,
];
}
}
@ -422,6 +449,13 @@ class Router
return null;
}
$pattern .= '$%D';
return [$base, $pattern, $args, $temp, $argsReq];
return [
$base,
$pattern,
$args,
$temp,
$argsReq,
];
}
}

View file

@ -63,6 +63,7 @@ class Secury
if (empty($key)) {
throw new InvalidArgumentException('Key can not be empty');
}
return \hash_hmac($this->hmac['algo'], $data, $key . $this->hmac['salt']);
}
@ -94,6 +95,7 @@ class Secury
for ($i = 0; $i < $len; ++$i) {
$result .= $chars[\ord($key[$i]) % 64];
}
return $result;
}

View file

@ -136,6 +136,7 @@ class Validator
$this->errors = [];
$this->fields = [];
$this->status = [];
return $this;
}
@ -149,6 +150,7 @@ class Validator
public function addValidators(array $validators): self
{
$this->validators = \array_replace($this->validators, $validators);
return $this;
}
@ -200,6 +202,7 @@ class Validator
}
$this->fields[$field] = $field;
}
return $this;
}
@ -213,6 +216,7 @@ class Validator
public function addArguments(array $arguments): self
{
$this->arguments = \array_replace($this->arguments, $arguments);
return $this;
}
@ -226,6 +230,7 @@ class Validator
public function addMessages(array $messages): self
{
$this->messages = \array_replace($this->messages, $messages);
return $this;
}
@ -239,6 +244,7 @@ class Validator
public function addAliases(array $aliases): self
{
$this->aliases = \array_replace($this->aliases, $aliases);
return $this;
}
@ -264,6 +270,7 @@ class Validator
$this->__get($field);
}
$this->raw = null;
return empty($this->errors);
}
@ -359,6 +366,7 @@ class Validator
break;
}
}
return $value;
}
@ -379,6 +387,7 @@ class Validator
// нет ошибки, для выхода из цикла проверки правил
if (true === $error) {
$this->error = false;
return;
}
@ -432,6 +441,7 @@ class Validator
if (! isset($this->status[$field])) {
$this->__get($field);
}
return $this->status[$field];
}
@ -506,6 +516,7 @@ class Validator
return $value;
}
$this->addError('The :alias is required');
return null;
}
@ -519,14 +530,8 @@ class Validator
if (null === $value) { // если данное поле отсутствует,
$this->addError(true); // то прерываем его проверку
}
return $value;
# list(, $error) = $this->vRequired($v, $value);
# if (false === $error) {
# return [null, 'The :alias is not required'];
# } else {
# return [$value, true];
# }
return $value;
}
protected function vString(Validator $v, $value, $attr)
@ -558,6 +563,7 @@ class Validator
return $value;
} else {
$this->addError('The :alias must be string');
return null;
}
}
@ -570,6 +576,7 @@ class Validator
return 0.0 + $value;
} else {
$this->addError('The :alias must be numeric');
return null;
}
}
@ -585,6 +592,7 @@ class Validator
return (int) $value;
} else {
$this->addError('The :alias must be integer');
return null;
}
}
@ -596,6 +604,7 @@ class Validator
&& ! \is_array($value)
) {
$this->addError('The :alias must be array');
return null;
} elseif (! $attr) {
return $value;
@ -609,6 +618,7 @@ class Validator
foreach ($attr as $name => $rules) {
$this->recArray($value, $result, $name, $rules, $vars['field'] . '.' . $name);
}
return $result;
}
@ -669,8 +679,10 @@ class Validator
}
} elseif (null !== $value) {
$this->addError('The :alias minimum is :attr');
return null;
}
return $value;
}
@ -700,6 +712,7 @@ class Validator
foreach ($value as $file) {
if ($file->size() > $attr) {
$this->addError('The :alias contains too large a file');
return null;
}
}
@ -709,12 +722,15 @@ class Validator
} elseif ($value instanceof File) {
if ($value->size() > $attr * 1024) {
$this->addError('The :alias contains too large a file');
return null;
}
} elseif (null !== $value) {
$this->addError('The :alias maximum is :attr'); //????
return null;
}
return $value;
}
@ -744,6 +760,7 @@ class Validator
if (! \is_array($args)) {
$args = [];
}
return $this->c->Router->validate($value, $attr, $args);
}
@ -756,6 +773,7 @@ class Validator
return $value;
} else {
$this->addError('The :alias must be same with original');
return null;
}
}
@ -770,6 +788,7 @@ class Validator
)
) {
$this->addError('The :alias is not valid format');
return null;
} else {
return $value;
@ -789,6 +808,7 @@ class Validator
) {
$this->addError('The :alias contains an invalid value');
}
return $value;
}
@ -811,6 +831,7 @@ class Validator
}
if (! \is_array($value)) {
$this->addError('The :alias not contains file');
return null;
}
$value = $this->c->Files->upload($value);
@ -818,6 +839,7 @@ class Validator
return null;
} elseif (false === $value) {
$this->addError($this->c->Files->error());
return null;
} elseif ('multiple' === $attr) {
if (! \is_array($value)) {
@ -825,8 +847,10 @@ class Validator
}
} elseif (\is_array($value)) {
$this->addError('The :alias contains more than one file');
return null;
}
return $value;
}
@ -838,6 +862,7 @@ class Validator
foreach ($value as $file) {
if (null === $this->c->Files->isImage($file)) {
$this->addError('The :alias not contains image');
return null;
}
}
@ -846,8 +871,10 @@ class Validator
&& null === $this->c->Files->isImage($value)
) {
$this->addError('The :alias not contains image');
return null;
}
return $value;
}
@ -860,8 +887,10 @@ class Validator
|| false === \strtotime($value . ' UTC')
) {
$v->addError('The :alias does not contain a date');
return \is_string($value) ? $value : null;
}
return $value;
}
}

View file

@ -64,6 +64,7 @@ EOD;
if (false === \strpos($value, '<!-- inline -->')) {
return $perfix . $value;
}
return $perfix . \preg_replace_callback(
'%<!-- inline -->([^<]*(?:<(?!!-- endinline -->)[^<]*)*+)(?:<!-- endinline -->)?%',
function ($matches) {
@ -105,6 +106,7 @@ EOD;
require($this->prepare($_name));
$this->endBlock(true);
}
return $this->block('content');
}

View file

@ -39,6 +39,7 @@ class Action
public function setManager(ManagerModel $manager): self
{
$this->manager = $manager;
return $this;
}
}

View file

@ -19,6 +19,7 @@ class Model extends ParentModel
$this->list = \array_flip($this->c->users->adminsIds());
$this->c->Cache->set('admins', $this->list);
}
return $this;
}
@ -30,6 +31,7 @@ class Model extends ParentModel
public function reset(): self
{
$this->c->Cache->delete('admins');
return $this;
}
}

View file

@ -109,8 +109,6 @@ class Filter extends Method
ORDER BY {$orderBy}";
}
$ids = $this->c->DB->query($query, $vars)->fetchAll(PDO::FETCH_COLUMN);
return $ids;
return $this->c->DB->query($query, $vars)->fetchAll(PDO::FETCH_COLUMN);
}
}

View file

@ -83,6 +83,7 @@ class Load extends Method
'emailList' => $emailList,
'ipList' => $ipList,
]);
return $this->model;
}
}

View file

@ -22,6 +22,7 @@ class Model extends ParentModel
$this->refresh();
}
}
return $this;
}

View file

@ -30,6 +30,7 @@ class Refresh extends Method
'searchList' => $search,
'replaceList' => $replace,
]);
return $this->model;
}
}

View file

@ -15,6 +15,7 @@ class Install extends Method
public function install(): Config
{
$this->model->setAttrs($this->c->forConfig);
return $this->model;
}
}

View file

@ -19,6 +19,7 @@ class Load extends Method
$config = $this->c->DB->query('SELECT cf.conf_name, cf.conf_value FROM ::config AS cf')->fetchAll(PDO::FETCH_KEY_PAIR);
$this->model->setAttrs($config);
$this->c->Cache->set('config', $config);
return $this->model;
}
}

View file

@ -18,6 +18,7 @@ class Model extends DataModel
} else {
$this->load();
}
return $this;
}
}

View file

@ -52,6 +52,7 @@ class Save extends Method
}
}
$this->c->Cache->delete('config');
return $this->model;
}
}

View file

@ -67,6 +67,7 @@ class Model extends ParentModel
if ($result) {
$_COOKIE[$this->prefix . $name] = $value;
}
return $result;
}
@ -81,6 +82,7 @@ class Model extends ParentModel
public function get(string $name, $default = null)
{
$name = $this->prefix . $name;
return isset($_COOKIE[$name])
? $this->c->Secury->replInvalidChars($_COOKIE[$name])
: $default;
@ -101,6 +103,7 @@ class Model extends ParentModel
if ($result) {
unset($_COOKIE[$this->prefix . $name]);
}
return $result;
}

View file

@ -20,6 +20,7 @@ class Model extends ParentModel
$this->c->Cache->set('db_map', $map);
$this->setAttrs($map);
}
return $this;
}
@ -31,6 +32,7 @@ class Model extends ParentModel
public function reset(): self
{
$this->c->Cache->delete('db_map');
return $this;
}
}

View file

@ -59,6 +59,7 @@ class Manager extends ManagerModel
}
$this->forumList = $list;
return $this;
}
@ -107,6 +108,7 @@ class Manager extends ManagerModel
{
$id = $this->Save->insert($forum);
$this->set($id, $forum);
return $id;
}
@ -128,6 +130,7 @@ class Manager extends ManagerModel
$list = $this->depthList($sub, $depth, $list);
}
return $list;
}
}

View file

@ -38,6 +38,7 @@ class Model extends DataModel
protected function getcanCreateTopic(): bool
{
$user = $this->c->user;
return 1 == $this->post_topics
|| (
null === $this->post_topics
@ -212,10 +213,13 @@ class Model extends DataModel
if ('1' == $this->c->user->g_view_users) {
foreach($attr as $id => &$cur) {
$cur = [
$this->c->Router->link('User', [
'id' => $id,
'name' => $cur,
]),
$this->c->Router->link(
'User',
[
'id' => $id,
'name' => $cur,
]
),
$cur,
];
}
@ -319,6 +323,7 @@ class Model extends DataModel
$this->setAttr('tree', $attr);
}
return $attr;
}
@ -349,7 +354,10 @@ class Model extends DataModel
$this->numPages,
$this->page,
'Forum',
['id' => $this->id, 'name' => $this->forum_name]
[
'id' => $this->id,
'name' => $this->forum_name,
]
);
}

View file

@ -58,6 +58,7 @@ class Refresh extends Action
'time' => \time(),
'list' => $this->list,
]);
return $this->list;
}
@ -71,6 +72,7 @@ class Refresh extends Action
protected function formatModers(string $str): ?array
{
$moderators = \json_decode($str, true);
return $moderators ?: null;
}
@ -110,6 +112,7 @@ class Refresh extends Action
$this->list[$parent] = \array_filter($list[$parent], function($val) {
return null !== $val;
});
return $all;
}
}

View file

@ -44,6 +44,7 @@ class Manager extends ManagerModel
}
$this->flag = true;
}
return $this;
}
@ -84,6 +85,7 @@ class Manager extends ManagerModel
{
$id = $this->Save->insert($group);
$this->set($id, $group);
return $id;
}
}

View file

@ -24,6 +24,7 @@ class Model extends DataModel
$this->c->GROUP_GUEST,
$this->c->GROUP_MEMBER
];
return ! \in_array($this->g_id, $notDeleted) && $this->g_id != $this->c->config->o_default_user_group;
}

View file

@ -39,6 +39,7 @@ class Method
public function setModel(Model $model): self
{
$this->model = $model;
return $this;
}
}

View file

@ -177,6 +177,7 @@ abstract class Page extends Model
}
}
}
return $nav;
}
@ -214,6 +215,7 @@ abstract class Page extends Model
$titles = $this->titles;
}
$titles[] = $this->c->config->o_board_title;
return \implode(__('Title separator'), $titles);
}
@ -242,6 +244,7 @@ abstract class Page extends Model
$headers[] = ['style', $style];
}
}
return $headers;
}
@ -258,6 +261,7 @@ abstract class Page extends Model
$attr = $this->getAttr('pageHeaders', []);
$attr['style'][$name] = $value;
$this->setAttr('pageHeaders', $attr);
return $this;
}
@ -284,6 +288,7 @@ abstract class Page extends Model
$attr = $this->getAttr('httpHeaders', []);
$attr[] = ["{$key} {$value}", $replace];
$this->setAttr('httpHeaders', $attr);
return $this;
}
@ -326,6 +331,7 @@ abstract class Page extends Model
if (isset($list[$this->httpStatus])) {
$this->header('HTTP/1.0', $list[$this->httpStatus]);
}
return $this;
}

View file

@ -38,6 +38,7 @@ class Bans extends Admin
unset($data['token']);
$data = \base64_encode(\json_encode($data));
$hash = $this->c->Secury->hash($data);
return "{$data}:{$hash}";
}
@ -401,6 +402,7 @@ class Bans extends Admin
$number = \count($idsN);
if (0 == $number) {
$this->fIswev = ['i', __('No bans found')];
return $this->view([], 'GET', $data);
}
@ -427,7 +429,14 @@ class Bans extends Admin
__('Results head'),
];
$this->formResult = $this->form($banList, $startNum, $args);
$this->pagination = $this->c->Func->paginate($pages, $page, 'AdminBansResult', ['data' => $args['data']]);
$this->pagination = $this->c->Func->paginate(
$pages,
$page,
'AdminBansResult',
[
'data' => $args['data'],
]
);
return $this;
}

View file

@ -80,6 +80,7 @@ class Forums extends Admin
$max = $f->disp_position;
}
}
return $max + 1;
}

View file

@ -152,10 +152,12 @@ class Groups extends Admin
if (! $v->validation($_POST)) {
$this->fIswev = $v->getErrors();
return $this->view();
}
$this->c->config->o_default_user_group = $v->defaultgroup;
$this->c->config->save();
return $this->c->Redirect->page('AdminGroups')->message('Default group redirect');
}
@ -186,6 +188,7 @@ class Groups extends Admin
if (! $v->validation($_POST)) {
$this->fIswev = $v->getErrors();
return $this->view();
}
@ -424,6 +427,7 @@ class Groups extends Admin
$form['sets']['group-data'] = [
'fields' => $fieldset,
];
return $form;
}

View file

@ -187,6 +187,7 @@ class Maintenance extends Admin
) {
$value = __('Default maintenance message');
}
return $value;
}
@ -226,6 +227,7 @@ class Maintenance extends Admin
)
) {
$this->fIswev = $v->getErrors();
return $this->view([], 'GET');
}
@ -247,7 +249,10 @@ class Maintenance extends Admin
'start' => $last + 1,
'clear' => $v->clear ? '1' : '0',
];
$args['token'] = $this->c->Csrf->create('AdminRebuildIndex', $args);
$args['token'] = $this->c->Csrf->create(
'AdminRebuildIndex',
$args
);
return $this->c->Redirect->page('AdminRebuildIndex', $args)->message(__('Processed posts', $v->start, $last));
} else {

View file

@ -139,6 +139,7 @@ class Options extends Admin
if ($timeout >= $v->o_timeout_visit) {
$v->addError('Timeout error message');
}
return $timeout;
}
@ -174,6 +175,7 @@ class Options extends Admin
) {
$value = 0;
}
return $value;
}

View file

@ -33,10 +33,12 @@ class Statistics extends Admin
$result = \array_map(
function($val) {
$val = \str_replace('body', '#id-phpinfo-div', $val, $count);
return $count ? $val : '#id-phpinfo-div ' . $val;
},
\explode(',', $match[1])
);
return \implode(', ', $result) . $match[2];
},
$matches[1]
@ -49,8 +51,14 @@ class Statistics extends Admin
$this->nameTpl = 'admin/phpinfo';
$this->mainSuffix = '-one-column';
$this->aCrumbs[] = [$this->c->Router->link('AdminInfo'), 'phpinfo()'];
$this->aCrumbs[] = [$this->c->Router->link('AdminStatistics'), __('Server statistics')];
$this->aCrumbs[] = [
$this->c->Router->link('AdminInfo'),
'phpinfo()',
];
$this->aCrumbs[] = [
$this->c->Router->link('AdminStatistics'),
__('Server statistics'),
];
$this->phpinfo = $phpinfo;
return $this;
@ -66,7 +74,10 @@ class Statistics extends Admin
$this->c->Lang->load('admin_index');
$this->nameTpl = 'admin/statistics';
$this->aCrumbs[] = [$this->c->Router->link('AdminStatistics'), __('Server statistics')];
$this->aCrumbs[] = [
$this->c->Router->link('AdminStatistics'),
__('Server statistics'),
];
$this->linkInfo = $this->c->Router->link('AdminInfo');
// Get the server load averages (if possible)

View file

@ -40,6 +40,7 @@ abstract class Users extends Admin
unset($data['token']);
$data = \base64_encode(\json_encode($data));
$hash = $this->c->Secury->hash($data);
return "{$data}:{$hash}";
} else {
return "ip:{$data}";
@ -63,6 +64,7 @@ abstract class Users extends Admin
if ('ip' === $data[0]) {
$ip = \filter_var($data[1], \FILTER_VALIDATE_IP);
return false === $ip ? false : ['ip' => $ip];
}
@ -96,6 +98,7 @@ abstract class Users extends Admin
if (! empty($bad)) {
$this->fIswev = ['v', __('Action not available')];
return false;
}
@ -110,6 +113,7 @@ abstract class Users extends Admin
case self::ACTION_BAN:
if ($this->c->bans->isBanned($user)) {
$this->fIswev = ['i', __('User is ban', $user->username)];
return false;
}
if (! $this->c->userRules->canBanUser($user)) {
@ -117,6 +121,7 @@ abstract class Users extends Admin
if ($user->isAdmMod) {
$this->fIswev = ['i', __('No ban admins message')];
}
return false;
}
break;
@ -126,6 +131,7 @@ abstract class Users extends Admin
if ($user->isAdmMod) {
$this->fIswev = ['i', __('No delete admins message')];
}
return false;
}
break;
@ -135,11 +141,13 @@ abstract class Users extends Admin
if ($user->isAdmin) {
$this->fIswev = ['i', __('No move admins message')];
}
return false;
}
break;
default:
$this->fIswev = ['v', __('Action not available')];
return false;
}
@ -151,6 +159,7 @@ abstract class Users extends Admin
if (empty($result)) {
$this->fIswev = ['v', __('No users selected')];
return false;
}

View file

@ -24,6 +24,7 @@ class Action extends Users
$result[] = $user->username;
}
\sort($result, \SORT_STRING | \SORT_FLAG_CASE);
return $result;
}
@ -87,6 +88,7 @@ class Action extends Users
if (false === $ids) {
$message = $this->c->Message->message('Action not available');
$message->fIswev = $this->fIswev; //????
return $message;
}
@ -248,6 +250,7 @@ class Action extends Users
} elseif (! $this->user->isAdmin) {
$list = [$this->c->GROUP_MEMBER => $list[$this->c->GROUP_MEMBER]];
}
return $list;
}
@ -318,6 +321,7 @@ class Action extends Users
} else {
$redirect->page('AdminUsers');
}
return $redirect->message('Users move redirect');
}

View file

@ -73,8 +73,10 @@ class NewUser extends Users
$this->nameTpl = 'admin/users';
$this->formNew = $this->formNew($data);
$this->aCrumbs[] = [$this->c->Router->link('AdminUsersNew'), __('Add user')];
$this->aCrumbs[] = [
$this->c->Router->link('AdminUsersNew'),
__('Add user'),
];
return $this;
}

View file

@ -143,7 +143,14 @@ class Result extends Users
$crName,
];
$this->formResult = $this->form($userList, $startNum, $args);
$this->pagination = $this->c->Func->paginate($pages, $page, 'AdminUsersResult', ['data' => $args['data']]);
$this->pagination = $this->c->Func->paginate(
$pages,
$page,
'AdminUsersResult',
[
'data' => $args['data'],
]
);
return $this;
}
@ -170,6 +177,7 @@ class Result extends Users
}
$ids = \array_flip($ids);
return \array_merge($fromPosts, $ids);
}

View file

@ -50,7 +50,14 @@ class Stat extends Users
$user->username,
];
$this->formResult = $this->form($stat, $startNum);
$this->pagination = $this->c->Func->paginate($pages, $page, 'AdminUserStat', ['id' => $args['id']]);
$this->pagination = $this->c->Func->paginate(
$pages,
$page,
'AdminUserStat',
[
'id' => $args['id'],
]
);
return $this;
}

View file

@ -28,6 +28,7 @@ class Auth extends Page
$this->c->users->updateLastVisit($this->user);
$this->c->Lang->load('auth');
return $this->c->Redirect->page('Index')->message('Logout redirect');
}
@ -357,6 +358,7 @@ class Auth extends Page
$this->c->users->update($user);
$this->fIswev = ['s', __('Pass updated')];
return $this->login([], 'GET');
}

View file

@ -53,6 +53,7 @@ class Install extends Page
}
}
}
return $dbTypes;
}
@ -417,6 +418,7 @@ class Install extends Page
$v->addError('Prefix reserved');
}
}
return $prefix;
}
@ -468,6 +470,7 @@ class Install extends Page
$stat = $this->c->DB->statistics();
} catch (PDOException $e) {
$v->addError($e->getMessage());
return $dbhost;
}
@ -476,6 +479,7 @@ class Install extends Page
$stmt = $this->c->DB->query('SELECT 1 FROM ::users LIMIT 1');
if (! empty($stmt->fetch())) {
$v->addError(__('Existing table error', $v->dbprefix, $v->dbname));
return $dbhost;
}
} catch (PDOException $e) {

View file

@ -196,6 +196,7 @@ class Moderate extends Page
if (! $v->validation($_POST)) {
$message = $this->c->Message->message('Bad request');
$message->fIswev = $v->getErrors();
return $message;
}
@ -292,12 +293,14 @@ class Moderate extends Page
$this->buttonValue = __('Open');
$this->crumbs = $this->crumbs($this->formTitle, __('Moderate'), $v->topic ? $this->curTopic : $this->curForum);
$this->form = $this->formConfirm($topics, $v);
return $this;
case 2:
if (1 === $v->confirm) {
$this->c->topics->access(true, ...$topics);
$message = 1 === \count($topics) ? 'Open topic redirect' : 'Open topics redirect';
return $this->c->Redirect->url($this->backLink)->message($message);
} else {
return $this->actionCancel($topics, $v);
@ -315,12 +318,14 @@ class Moderate extends Page
$this->buttonValue = __('Close');
$this->crumbs = $this->crumbs($this->formTitle, __('Moderate'), $v->topic ? $this->curTopic : $this->curForum);
$this->form = $this->formConfirm($topics, $v);
return $this;
case 2:
if (1 === $v->confirm) {
$this->c->topics->access(false, ...$topics);
$message = 1 === \count($topics) ? 'Close topic redirect' : 'Close topics redirect';
return $this->c->Redirect->url($this->backLink)->message($message);
} else {
return $this->actionCancel($topics, $v);
@ -355,6 +360,7 @@ class Moderate extends Page
$this->buttonValue = __('Delete');
$this->crumbs = $this->crumbs($this->formTitle, __('Moderate'), $v->topic ? $this->curTopic : $this->curForum);
$this->form = $this->formConfirm($objects, $v);
return $this;
case 2:
if (1 === $v->confirm) {
@ -384,6 +390,7 @@ class Moderate extends Page
$this->crumbs = $this->crumbs($this->formTitle, __('Moderate'), $v->topic ? $this->curTopic : $this->curForum);
$this->chkRedirect = true;
$this->form = $this->formConfirm($topics, $v);
return $this;
case 2:
if (1 === $v->confirm) {
@ -391,6 +398,7 @@ class Moderate extends Page
$this->c->topics->move(1 === $v->redirect, $forum, ...$topics);
$message = 1 === \count($topics) ? 'Move topic redirect' : 'Move topics redirect';
return $this->c->Redirect->url($this->curForum->link)->message($message);
} else {
return $this->actionCancel($topics, $v);
@ -421,6 +429,7 @@ class Moderate extends Page
$this->crumbs = $this->crumbs($this->formTitle, __('Moderate'), $this->curForum);
$this->chkRedirect = true;
$this->form = $this->formConfirm($topics, $v);
return $this;
case 2:
if (1 === $v->confirm) {
@ -443,6 +452,7 @@ class Moderate extends Page
$this->buttonValue = __('Unstick');
$this->crumbs = $this->crumbs($this->formTitle, __('Moderate'), $v->topic ? $this->curTopic : $this->curForum);
$this->form = $this->formConfirm($topics, $v);
return $this;
case 2:
if (1 === $v->confirm) {
@ -452,6 +462,7 @@ class Moderate extends Page
}
$message = 1 === \count($topics) ? 'Unstick topic redirect' : 'Unstick topics redirect';
return $this->c->Redirect->url($this->backLink)->message($message);
} else {
return $this->actionCancel($topics, $v);
@ -469,6 +480,7 @@ class Moderate extends Page
$this->buttonValue = __('Stick');
$this->crumbs = $this->crumbs($this->formTitle, __('Moderate'), $v->topic ? $this->curTopic : $this->curForum);
$this->form = $this->formConfirm($topics, $v);
return $this;
case 2:
if (1 === $v->confirm) {
@ -478,6 +490,7 @@ class Moderate extends Page
}
$message = 1 === \count($topics) ? 'Stick topic redirect' : 'Stick topics redirect';
return $this->c->Redirect->url($this->backLink)->message($message);
} else {
return $this->actionCancel($topics, $v);
@ -496,6 +509,7 @@ class Moderate extends Page
$this->needSubject = true;
$this->crumbs = $this->crumbs($this->formTitle, __('Moderate'), $this->curTopic);
$this->form = $this->formConfirm($posts, $v);
return $this;
case 2:
if (1 === $v->confirm) {

View file

@ -30,6 +30,7 @@ trait PostValidatorTrait
) {
$v->addError('All caps subject');
}
return $subject;
}

View file

@ -174,6 +174,7 @@ abstract class Profile extends Page
__('Configure '),
];
}
return $btns;
}

View file

@ -128,7 +128,7 @@ class Config extends Profile
'token' => $this->c->Csrf->create(
'EditUserBoardConfig',
[
'id' => $this->curUser->id
'id' => $this->curUser->id,
]
),
],

View file

@ -31,6 +31,7 @@ class Redirect extends Page
$marker,
$args
);
return $this;
}
@ -44,6 +45,7 @@ class Redirect extends Page
public function url(string $url): Page
{
$this->link = $url;
return $this;
}
@ -81,6 +83,7 @@ class Redirect extends Page
if (null === $this->nameTpl) {
$this->header('Location', $this->link);
}
return parent::getHttpHeaders();
}

View file

@ -236,12 +236,14 @@ class Register extends Page
} else {
$auth = $this->c->Auth;
$auth->fIswev = ['w', __('Error welcom mail', $this->c->config->o_admin_email)];
return $auth->forget(['_email' => $v->email], 'GET');
}
// форма логина
} else {
$auth = $this->c->Auth;
$auth->fIswev = ['s', __('Reg complete')];
return $auth->login(['_username' => $v->username], 'GET');
}
}
@ -275,6 +277,7 @@ class Register extends Page
$auth = $this->c->Auth;
$auth->fIswev = ['s', __('Reg complete')];
return $auth->login(['_username' => $user->username], 'GET');
}
}

View file

@ -19,7 +19,12 @@ class Rules extends Page
$this->onlinePos = 'rules';
$this->canonical = $this->c->Router->link('Rules');
$this->title = __('Forum rules');
$this->crumbs = $this->crumbs([$this->c->Router->link('Rules'), __('Forum rules')]);
$this->crumbs = $this->crumbs(
[
$this->c->Router->link('Rules'),
__('Forum rules'),
]
);
$this->rules = $this->c->config->o_rules_message;
return $this;
@ -39,7 +44,13 @@ class Rules extends Page
$this->onlinePos = 'rules';
$this->robots = 'noindex';
$this->title = __('Forum rules');
$this->crumbs = $this->crumbs(__('Forum rules'), [$this->c->Router->link('Register'), __('Register')]);
$this->crumbs = $this->crumbs(
__('Forum rules'),
[
$this->c->Router->link('Register'),
__('Register'),
]
);
$this->rules = '1' == $this->c->config->o_rules ? $this->c->config->o_rules_message : __('If no rules');
$this->form = $this->formAgree();

View file

@ -533,6 +533,7 @@ class Search extends Page
return $this->c->Message->message('Bad request');
} elseif (empty($list)) {
$this->fIswev = ['i', __('No hits')];
return $this->view([], 'GET', true);
}
@ -569,6 +570,7 @@ class Search extends Page
protected function crumbs(...$crumbs): array
{
$crumbs[] = [$this->c->Router->link('Search'), __('Search')];
return parent::crumbs(...$crumbs);
}
}

View file

@ -146,7 +146,12 @@ class Userlist extends Page
$args
);
$this->robots = 'noindex';
$this->crumbs = $this->crumbs([$this->c->Router->link('Userlist'), __('User list')]);
$this->crumbs = $this->crumbs(
[
$this->c->Router->link('Userlist'),
__('User list'),
]
);
$this->pagination = $this->c->Func->paginate($pages, $page, 'Userlist', $args);
$this->form = $this->formUserlist($v);

View file

@ -103,6 +103,7 @@ class Manager extends ManagerModel
{
$id = $this->Save->insert($post);
$this->set($id, $post);
return $id;
}
}

View file

@ -35,6 +35,7 @@ class Manager extends ManagerModel
} else {
$report = $this->Load->load($id);
$this->set($id, $report);
return $report;
}
}
@ -57,6 +58,7 @@ class Manager extends ManagerModel
$this->set($report->id, $report);
}
}
return $result;
}
@ -83,6 +85,7 @@ class Manager extends ManagerModel
{
$id = $this->Save->insert($report);
$this->set($id, $report);
return $id;
}

View file

@ -72,6 +72,7 @@ class Execute extends Method
$result = \explode("\n", $row['search_data']);
$this->model->queryIds = '' == $result[0] ? [] : \array_map('\\intval', \explode(',', $result[0]));
$this->model->queryNoCache = false;
return true;
} elseif ($flood) {
return false;

View file

@ -147,6 +147,7 @@ class Index extends Method
$words[] = $word;
}
}
return $words;
}
}

View file

@ -19,6 +19,7 @@ class Prepare extends Method
$this->model->queryError = 'Odd number of quotes: \'%s\'';
$this->model->queryWords = [];
$this->model->queryText = $query;
return false;
}
@ -194,6 +195,7 @@ class Prepare extends Method
$result .= $space . $word;
$space = ' ';
}
return $result;
}
}

View file

@ -19,6 +19,7 @@ class Load extends Method
$list = $this->c->DB->query('SELECT sm.text, sm.image FROM ::smilies AS sm ORDER BY sm.disp_position')->fetchAll(PDO::FETCH_KEY_PAIR); //???? text уникальное?
$this->model->list = $list;
$this->c->Cache->set('smilies', $list);
return $this->model;
}
}

View file

@ -18,6 +18,7 @@ class Model extends ParentModel
} else {
$this->load();
}
return $this;
}
}

View file

@ -36,6 +36,7 @@ class Model extends ParentModel
public function reset(): self
{
$this->c->Cache->delete('stats');
return $this;
}
}

View file

@ -22,6 +22,7 @@ class Model extends ParentModel
} else {
$this->load();
}
return $this;
}
@ -63,6 +64,7 @@ class Model extends ParentModel
if (! \is_array($this->files)) {
$this->list = [];
return $this;
}
@ -78,6 +80,7 @@ class Model extends ParentModel
$this->c->Cache->set('stopwords', ['id' => $id, 'stopwords' => $stopwords]);
$this->list = $stopwords;
return $this;
}
}

View file

@ -68,6 +68,7 @@ class Load extends Action
if ($forum instanceof Forum) {
$forum->__mf_mark_all_read = $topic->mf_mark_all_read;
return $topic;
} else {
return null;
@ -112,6 +113,7 @@ class Load extends Action
}
}
}
return $result;
}
}

View file

@ -33,6 +33,7 @@ class Manager extends ManagerModel
} else {
$topic = $this->Load->load($id);
$this->set($id, $topic);
return $topic;
}
}
@ -92,6 +93,7 @@ class Manager extends ManagerModel
{
$id = $this->Save->insert($topic);
$this->set($id, $topic);
return $id;
}
}

View file

@ -267,7 +267,15 @@ class Model extends DataModel
// 1 страницу в списке тем раздела не отображаем
return [];
} else { //????
return $this->c->Func->paginate($this->numPages, $page, 'Topic', ['id' => $this->id, 'name' => \ForkBB\cens($this->subject)]);
return $this->c->Func->paginate(
$this->numPages,
$page,
'Topic',
[
'id' => $this->id,
'name' => \ForkBB\cens($this->subject),
]
);
}
}

View file

@ -80,6 +80,7 @@ class Current extends Action
$user = $this->manager->create($data);
$user->__ip = $ip;
$user->__userAgent = $this->getUserAgent();
return $user;
}
@ -144,6 +145,7 @@ class Current extends Action
) {
return false;
}
return $this->nameBot($agent, $agentL);
}
@ -240,6 +242,7 @@ class Current extends Action
} elseif (\strlen($agent) > 25) {
$agent = 'Unknown';
}
return $agent;
}
@ -272,6 +275,7 @@ class Current extends Action
}
}
}
return $this->c->config->o_default_lang;
}
}

View file

@ -103,8 +103,6 @@ class Filter extends Action
WHERE {$where}
ORDER BY {$orderBy}";
$ids = $this->c->DB->query($query, $vars)->fetchAll(PDO::FETCH_COLUMN);
return $ids;
return $this->c->DB->query($query, $vars)->fetchAll(PDO::FETCH_COLUMN);
}
}

View file

@ -22,6 +22,7 @@ class IsUniqueName extends Action
':other' => \preg_replace('%[^\p{L}\p{N}]%u', '', $user->username), //???? что за бред :)
];
$result = $this->c->DB->query('SELECT u.username FROM ::users AS u WHERE (LOWER(u.username)=LOWER(?s:name) OR LOWER(u.username)=LOWER(?s:other)) AND u.id!=?i:id', $vars)->fetchAll();
return ! \count($result);
}
}

View file

@ -66,6 +66,7 @@ class Load extends Action
foreach ($data as $row) {
$result[] = $this->manager->create($row);
}
return $result;
}

View file

@ -29,6 +29,7 @@ class Manager extends ManagerModel
} else {
$user = $this->Load->load($id);
$this->set($id, $user);
return $user;
}
}
@ -123,6 +124,7 @@ class Manager extends ManagerModel
{
$id = $this->Save->insert($user);
$this->set($id, $user);
return $id;
}
}

View file

@ -100,6 +100,7 @@ class Model extends DataModel
throw new RuntimeException('Moderator\'s rights can not be found');
}
}
return isset($model->moderators[$this->id]);
}

View file

@ -29,10 +29,12 @@ class Email extends Validators
// проверка длины email
} elseif (\mb_strlen($email, 'UTF-8') > $this->c->MAX_EMAIL_LENGTH) {
$v->addError('Long email');
return $email;
// это не email
} elseif (false === ($result = $this->c->Mail->valid($email, true))) {
$v->addError('The :alias is not valid email');
return $email;
// есть другие ошибки
} elseif (! empty($v->getErrors())) {

View file

@ -27,6 +27,7 @@ class NoURL extends Validators
) {
$v->addError('The :alias contains a link');
}
return $value;
}
}

View file

@ -236,10 +236,10 @@ return [
$arr[] = $hours . __('After time H');
}
if ($min > 0) {
$arr[] = (($min < 10) ? '0' . $min : $min) . __('After time i');
$arr[] = ($min < 10 ? '0' . $min : $min) . __('After time i');
}
if ($sec > 0) {
$arr[] = (($sec < 10) ? '0' . $sec : $sec) . __('After time s');
$arr[] = ($sec < 10 ? '0' . $sec : $sec) . __('After time s');
}
$attr = __('After time') . ' ' . implode(' ', $arr);