Template/Endpoints (Prep)

* modernize DB-Types
   - long term: should be split in class that describes the DB-Type and container class that handles multiples
 * make unchanging filter props static, allow lookup of criteria indizes through filter
 * move username/mail/password checks to util and make them usable as input filter
This commit is contained in:
Sarjuuk
2025-08-06 20:47:20 +02:00
parent 8cf0b6243d
commit aeb84327d6
47 changed files with 1163 additions and 1082 deletions

View File

@@ -151,7 +151,7 @@ class CLISetup
// link SubScipts back to UtilityScript after all UtilityScripts have been loaded
foreach (self::$utilScriptRefs as $name => $us)
if (in_array(__NAMESPACE__.'\TrSubScripts', class_uses($us)))
if (in_array(TrSubScripts::class, class_uses($us)))
$us->assignGenerators($name);
self::evalOpts();

View File

@@ -46,12 +46,12 @@ CLISetup::registerUtility(new class extends UtilityScript
$passw = $args[1] ?? '';
$email = $args[2];
if ($name && User::isValidName($name))
if (Util::validateUsername($name))
unset($this->fields['name']);
else
$name = '';
if ($passw && User::isValidPass($passw))
if (Util::validatePassword($passw))
{
unset($this->fields['pass1']);
unset($this->fields['pass2']);
@@ -59,7 +59,7 @@ CLISetup::registerUtility(new class extends UtilityScript
else
$passw = '';
if (is_string($email) && (!strlen($email) || Util::isValidEmail($email)))
if (Util::validateEmail($email))
unset($this->fields['email']);
else
$email = '';
@@ -68,19 +68,19 @@ CLISetup::registerUtility(new class extends UtilityScript
{
CLI::write();
if (!$name && !User::isValidName($uiAccount['name'] ?? '', $e))
if (!$name && !Util::validateUsername($uiAccount['name'], $e))
CLI::write(Lang::account($e == 1 ? 'errNameLength' : 'errNameChars'), CLI::LOG_ERROR);
else if (!$name)
$name = $uiAccount['name'];
if (!$passw && !User::isValidPass($uiAccount['pass1'] ?? '', $e))
if (!$passw && !Util::validatePassword($uiAccount['pass1'], $e))
CLI::write(Lang::account($e == 1 ? 'errPassLength' : 'errPassChars'), CLI::LOG_ERROR);
else if (!$passw && $uiAccount['pass1'] != $uiAccount['pass2'])
CLI::write(Lang::account('passMismatch'), CLI::LOG_ERROR);
else if (!$passw)
$passw = $uiAccount['pass1'];
if (!$email && Util::isValidEmail($uiAccount['email'] ?? ''))
if (!$email && Util::validateEmail($uiAccount['email']))
$email = $uiAccount['email'];
else if (!$email && $uiAccount && $uiAccount['email'])
CLI::write('[account] email invalid ... using default: ' . Cfg::get('CONTACT_EMAIL'), CLI::LOG_INFO);

View File

@@ -489,7 +489,7 @@ abstract class SetupScript
CLI::write('[build] created '.$newDirs.' extra paths');
// load DBC files
if (!in_array(__NAMESPACE__.'\TrDBCcopy', class_uses($this)))
if (!in_array(TrDBCcopy::class, class_uses($this)))
{
foreach ($this->getRequiredDBCs() as $req)
{