diff --git a/Admin/Install/Messages.php b/Admin/Install/Messages.php index a994310..beeccb8 100755 --- a/Admin/Install/Messages.php +++ b/Admin/Install/Messages.php @@ -49,10 +49,10 @@ class Messages $settings = [ [ - 'id' => null, - 'name' => SettingsEnum::LOGIN_MAIL_REGISTRATION_TEMPLATE, + 'id' => null, + 'name' => SettingsEnum::LOGIN_MAIL_REGISTRATION_TEMPLATE, 'content' => (string) $messages['email_template'][0]['id'], - 'module' => 'OnlineResourceWatcher', + 'module' => 'OnlineResourceWatcher', ], ]; diff --git a/Admin/Installer.php b/Admin/Installer.php index a2fe34d..e3af607 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -49,7 +49,7 @@ final class Installer extends InstallerAbstract 'Directory /var/www is not writable. Please allow the apache user (www-data) to write to this directory.' ); - var_dump('NOT WRITABLE'); + \var_dump('NOT WRITABLE'); return; } @@ -57,7 +57,7 @@ final class Installer extends InstallerAbstract parent::install($app, $info, $cfgHandler); if (!\is_dir(__DIR__ . '/../Files')) { - mkdir(__DIR__ . '/../Files'); + \mkdir(__DIR__ . '/../Files'); } } } diff --git a/Admin/Routes/Cli.php b/Admin/Routes/Cli.php index 233741e..d8a1cd4 100755 --- a/Admin/Routes/Cli.php +++ b/Admin/Routes/Cli.php @@ -15,7 +15,6 @@ declare(strict_types=1); use Modules\OnlineResourceWatcher\Controller\ApiController; use Modules\OnlineResourceWatcher\Models\PermissionCategory; use phpOMS\Account\PermissionType; -use phpOMS\Router\RouteVerb; return [ '^.*/orw/check -i all*$' => [ @@ -27,5 +26,5 @@ return [ 'state' => PermissionCategory::RESOURCE, ], ], - ] -]; \ No newline at end of file + ], +]; diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 87275f9..e2b2a2e 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -15,7 +15,10 @@ declare(strict_types=1); namespace Modules\OnlineResourceWatcher\Controller; use Modules\Admin\Models\NullAccount; +use Modules\Admin\Models\SettingsEnum; +use Modules\Messages\Models\EmailMapper; use Modules\OnlineResourceWatcher\Models\Inform; +use Modules\OnlineResourceWatcher\Models\InformBlacklistMapper; use Modules\OnlineResourceWatcher\Models\InformMapper; use Modules\OnlineResourceWatcher\Models\Report; use Modules\OnlineResourceWatcher\Models\ReportMapper; @@ -23,6 +26,7 @@ use Modules\OnlineResourceWatcher\Models\ReportStatus; use Modules\OnlineResourceWatcher\Models\Resource; use Modules\OnlineResourceWatcher\Models\ResourceMapper; use Modules\OnlineResourceWatcher\Models\ResourceStatus; +use Modules\OnlineResourceWatcher\Models\SettingsEnum as OrwSettingsEnum; use phpOMS\Message\Http\HttpRequest; use phpOMS\Message\Http\RequestStatusCode; use phpOMS\Message\NotificationLevel; @@ -30,14 +34,10 @@ use phpOMS\Message\RequestAbstract; use phpOMS\Message\ResponseAbstract; use phpOMS\Model\Message\FormValidation; use phpOMS\System\File\Local\Directory; -use phpOMS\System\SystemUtils; -use phpOMS\Utils\StringUtils; -use Modules\Admin\Models\SettingsEnum; -use Modules\OnlineResourceWatcher\Models\SettingsEnum as OrwSettingsEnum; -use Modules\Messages\Models\EmailMapper; -use Modules\OnlineResourceWatcher\Models\InformBlacklistMapper; use phpOMS\System\OperatingSystem; use phpOMS\System\SystemType; +use phpOMS\System\SystemUtils; +use phpOMS\Utils\StringUtils; /** * OnlineResourceWatcher controller class. @@ -69,7 +69,7 @@ final class ApiController extends Controller ->where('id', (int) $request->getData('id')) ->execute(); - $path = ''; + $path = ''; $basePath = __DIR__ . '/../Files/' . $resource->path . '/' . $resource->lastVersionPath; if (\is_file($basePath . '/index.htm')) { @@ -268,11 +268,11 @@ final class ApiController extends Controller $path .= 'temp/' . $resource->id . '/' . $timestamp; $toCheck[] = [ - 'resource' => $resource, + 'resource' => $resource, 'timestamp' => $timestamp, - 'path' => $path, - 'handled' => false, - 'loop' => 0, + 'path' => $path, + 'handled' => false, + 'loop' => 0, ]; try { @@ -333,7 +333,7 @@ final class ApiController extends Controller $report->status = ReportStatus::DOWNLOAD_ERROR; $this->createModel($request->header->account, $report, ReportMapper::class, 'report', $request->getOrigin()); - $old = clone $resource; + $old = clone $resource; $resource->checkedAt = $report->createdAt; $this->updateModel($request->header->account, $old, $resource, ResourceMapper::class, 'resource', $request->getOrigin()); @@ -370,8 +370,8 @@ final class ApiController extends Controller \rename($path . '/index.html', $path . '/index.htm'); } - $extension = 'htm'; - $fileName = 'index.htm'; + $extension = 'htm'; + $fileName = 'index.htm'; $toCheck[$index]['handled'] = true; } else { foreach ($filesNew as $file) { @@ -387,8 +387,8 @@ final class ApiController extends Controller || StringUtils::endsWith($file, '.md') || StringUtils::endsWith($file, '.txt') ) { - $fileName = $file; - $extension = \substr($file, \strripos($file, '.') + 1); + $fileName = $file; + $extension = \substr($file, \strripos($file, '.') + 1); $toCheck[$index]['handled'] = true; break; @@ -411,7 +411,7 @@ final class ApiController extends Controller } $this->createModel($request->header->account, $report, ReportMapper::class, 'report', $request->getOrigin()); - $old = clone $resource; + $old = clone $resource; $resource->path = (string) $resource->id; $resource->lastVersionPath = (string) $check['timestamp']; $resource->lastVersionDate = $report->createdAt; @@ -454,8 +454,8 @@ final class ApiController extends Controller } } - $lastVersionPath = $basePath . '/' . $id . '/' . $lastVersionTimestamp; - $oldPath = $lastVersionPath . '/' . $fileName; + $lastVersionPath = $basePath . '/' . $id . '/' . $lastVersionTimestamp; + $oldPath = $lastVersionPath . '/' . $fileName; $newPath = $path . '/' . $fileName; if (!\is_file($newPath) || !$toCheck[$index]['handled']) { @@ -552,8 +552,8 @@ final class ApiController extends Controller } // @todo: move to informUsers function - $owner = new Inform(); - $owner->email = $resource->owner->getEmail(); + $owner = new Inform(); + $owner->email = $resource->owner->getEmail(); $resource->inform[] = $owner; foreach ($resource->inform as $inform) { @@ -588,7 +588,7 @@ final class ApiController extends Controller $resource->id, $inform->email, $resource->uri, - $resource->owner->getEmail() + $resource->owner->getEmail(), ], $mailL11n->body ); @@ -605,7 +605,7 @@ final class ApiController extends Controller $resource->id, $inform->email, $resource->uri, - $resource->owner->getEmail() + $resource->owner->getEmail(), ], $mailL11n->bodyAlt ); @@ -862,9 +862,9 @@ final class ApiController extends Controller */ private function createInformFromRequest(RequestAbstract $request) : Inform { - $inform = new Inform(); - $inform->account = $request->getDataInt('account'); - $inform->email = $request->getDataString('email'); + $inform = new Inform(); + $inform->account = $request->getDataInt('account'); + $inform->email = $request->getDataString('email'); $inform->resource = $request->getDataInt('resource'); return $inform; diff --git a/Models/InformBlacklistMapper.php b/Models/InformBlacklistMapper.php index 17ec56a..161c6a0 100644 --- a/Models/InformBlacklistMapper.php +++ b/Models/InformBlacklistMapper.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Modules\OnlineResourceWatcher\Models; -use Modules\Admin\Models\AccountMapper; use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; /** @@ -38,7 +37,7 @@ final class InformBlacklistMapper extends DataMapperFactory */ public const COLUMNS = [ 'orw_resource_blacklist_id' => ['name' => 'orw_resource_blacklist_id', 'type' => 'int', 'internal' => 'id'], - 'orw_resource_blacklist_mail' => ['name' => 'orw_resource_blacklist_mail', 'type' => 'string', 'internal' => 'email',], + 'orw_resource_blacklist_mail' => ['name' => 'orw_resource_blacklist_mail', 'type' => 'string', 'internal' => 'email',], ]; /** diff --git a/Models/InformMapper.php b/Models/InformMapper.php index 46ce530..ecadd4a 100644 --- a/Models/InformMapper.php +++ b/Models/InformMapper.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Modules\OnlineResourceWatcher\Models; -use Modules\Admin\Models\AccountMapper; use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; /** @@ -37,9 +36,9 @@ final class InformMapper extends DataMapperFactory * @since 1.0.0 */ public const COLUMNS = [ - 'orw_resource_info_id' => ['name' => 'orw_resource_info_id', 'type' => 'int', 'internal' => 'id'], - 'orw_resource_info_mail' => ['name' => 'orw_resource_info_mail', 'type' => 'string', 'internal' => 'email',], - 'orw_resource_info_account' => ['name' => 'orw_resource_info_account', 'type' => 'int', 'internal' => 'account',], + 'orw_resource_info_id' => ['name' => 'orw_resource_info_id', 'type' => 'int', 'internal' => 'id'], + 'orw_resource_info_mail' => ['name' => 'orw_resource_info_mail', 'type' => 'string', 'internal' => 'email',], + 'orw_resource_info_account' => ['name' => 'orw_resource_info_account', 'type' => 'int', 'internal' => 'account',], 'orw_resource_info_resource' => ['name' => 'orw_resource_info_resource', 'type' => 'int', 'internal' => 'resource',], ]; diff --git a/Models/Report.php b/Models/Report.php index 0781027..eee01db 100755 --- a/Models/Report.php +++ b/Models/Report.php @@ -14,9 +14,6 @@ declare(strict_types=1); namespace Modules\OnlineResourceWatcher\Models; -use Modules\Admin\Models\Account; -use Modules\Admin\Models\NullAccount; - /** * Report class. * @@ -69,10 +66,10 @@ class Report implements \JsonSerializable public function toArray() : array { return [ - 'id' => $this->id, - 'createdAt' => $this->createdAt, - 'resource' => $this->resource, - 'status' => $this->status, + 'id' => $this->id, + 'createdAt' => $this->createdAt, + 'resource' => $this->resource, + 'status' => $this->status, 'changemetric' => $this->changeMetric, ]; } diff --git a/Models/ReportMapper.php b/Models/ReportMapper.php index 2e016ff..4803d2c 100755 --- a/Models/ReportMapper.php +++ b/Models/ReportMapper.php @@ -36,13 +36,13 @@ final class ReportMapper extends DataMapperFactory * @since 1.0.0 */ public const COLUMNS = [ - 'orw_resource_report_id' => ['name' => 'orw_resource_report_id', 'type' => 'int', 'internal' => 'id'], - 'orw_resource_report_status' => ['name' => 'orw_resource_report_status', 'type' => 'int', 'internal' => 'status',], + 'orw_resource_report_id' => ['name' => 'orw_resource_report_id', 'type' => 'int', 'internal' => 'id'], + 'orw_resource_report_status' => ['name' => 'orw_resource_report_status', 'type' => 'int', 'internal' => 'status',], 'orw_resource_report_metric' => ['name' => 'orw_resource_report_metric', 'type' => 'int', 'internal' => 'changeMetric',], - 'orw_resource_report_path' => ['name' => 'orw_resource_report_path', 'type' => 'string', 'internal' => 'versionPath',], + 'orw_resource_report_path' => ['name' => 'orw_resource_report_path', 'type' => 'string', 'internal' => 'versionPath',], 'orw_resource_report_change' => ['name' => 'orw_resource_report_change', 'type' => 'string', 'internal' => 'change',], - 'orw_resource_report_resource' => ['name' => 'orw_resource_report_resource', 'type' => 'int', 'internal' => 'resource',], - 'orw_resource_report_created_at' => ['name' => 'orw_resource_report_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt',], + 'orw_resource_report_resource' => ['name' => 'orw_resource_report_resource', 'type' => 'int', 'internal' => 'resource',], + 'orw_resource_report_created_at' => ['name' => 'orw_resource_report_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt',], ]; /** diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php index 8562a03..abbfb4b 100755 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -13,74 +13,74 @@ declare(strict_types=1); return ['OnlineResourceWatcher' => [ - 'Action' => 'Action', - 'Add' => 'Add', - 'Admin' => 'Admin', - 'Back' => 'Back', - 'Bills' => 'Bills', - 'By' => 'By', - 'Cancel' => 'Cancel', - 'Checked' => 'Checked', - 'Dashboard' => 'Dashboard', - 'Date' => 'Date', - 'Filter' => 'Filter', - 'ForgotPassword' => 'Forgot Password', - 'Home' => 'Home', - 'ID' => 'ID', - 'Imprint' => 'Imprint', - 'Legal' => 'Legal', - 'Log' => 'Log', - 'Logo' => 'Logo', - 'SignOut' => 'Sign Out', - 'Logs' => 'Logs', - 'Organization' => 'Organization', - 'Organizations' => 'Organizations', - 'Password' => 'Password', - 'PrivacyPolicy' => 'Privacy Policy', - 'Ref' => 'Ref', - 'Report' => 'Report', - 'Reports' => 'Reports', - 'Reset' => 'Reset', - 'Resource' => 'Resource', - 'Resources' => 'Resources', - 'Create' => 'Create', - 'Delete' => 'Delete', - 'Suspend' => 'Suspend', - 'Send' => 'Send', - 'Save' => 'Save', - 'Search' => 'Search', - 'Settings' => 'Settings', - 'SignIn' => 'Sign In', - 'Status' => 'Status', - 'Submit' => 'Submit', - 'Terms' => 'Terms', - 'Trigger' => 'Trigger', - 'Type' => 'Type', - 'User' => 'User', - 'Username' => 'Username', - 'Users' => 'Users', - 'New' => 'New', - 'Number' => 'Number', - 'CustomerNo' => 'Customer No.', - 'CustomerName' => 'Customer Name', - 'Amount' => 'Amount', - 'Members' => 'Members', - 'Name' => 'Name', - 'Active' => 'Active', - 'Address' => 'Address', - 'Postal' => 'Postal', - 'City' => 'City', - 'BillingEmail' => 'Billing Email', - 'Statistics' => 'Statistics', - 'PlanSettings' => 'Plan Settings', + 'Action' => 'Action', + 'Add' => 'Add', + 'Admin' => 'Admin', + 'Back' => 'Back', + 'Bills' => 'Bills', + 'By' => 'By', + 'Cancel' => 'Cancel', + 'Checked' => 'Checked', + 'Dashboard' => 'Dashboard', + 'Date' => 'Date', + 'Filter' => 'Filter', + 'ForgotPassword' => 'Forgot Password', + 'Home' => 'Home', + 'ID' => 'ID', + 'Imprint' => 'Imprint', + 'Legal' => 'Legal', + 'Log' => 'Log', + 'Logo' => 'Logo', + 'SignOut' => 'Sign Out', + 'Logs' => 'Logs', + 'Organization' => 'Organization', + 'Organizations' => 'Organizations', + 'Password' => 'Password', + 'PrivacyPolicy' => 'Privacy Policy', + 'Ref' => 'Ref', + 'Report' => 'Report', + 'Reports' => 'Reports', + 'Reset' => 'Reset', + 'Resource' => 'Resource', + 'Resources' => 'Resources', + 'Create' => 'Create', + 'Delete' => 'Delete', + 'Suspend' => 'Suspend', + 'Send' => 'Send', + 'Save' => 'Save', + 'Search' => 'Search', + 'Settings' => 'Settings', + 'SignIn' => 'Sign In', + 'Status' => 'Status', + 'Submit' => 'Submit', + 'Terms' => 'Terms', + 'Trigger' => 'Trigger', + 'Type' => 'Type', + 'User' => 'User', + 'Username' => 'Username', + 'Users' => 'Users', + 'New' => 'New', + 'Number' => 'Number', + 'CustomerNo' => 'Customer No.', + 'CustomerName' => 'Customer Name', + 'Amount' => 'Amount', + 'Members' => 'Members', + 'Name' => 'Name', + 'Active' => 'Active', + 'Address' => 'Address', + 'Postal' => 'Postal', + 'City' => 'City', + 'BillingEmail' => 'Billing Email', + 'Statistics' => 'Statistics', + 'PlanSettings' => 'Plan Settings', 'BillingSettings' => 'Billing Settings', - 'UserSettings' => 'User Settings', - 'Login' => 'Login', - 'Email' => 'Email', - 'NewPassword' => 'New Password', - 'CreateResource' => 'Create Resource', - 'Inform' => 'Inform', - 'Element' => 'Element', - 'Exit' => 'Exit', - 'Url' => 'Url', + 'UserSettings' => 'User Settings', + 'Login' => 'Login', + 'Email' => 'Email', + 'NewPassword' => 'New Password', + 'CreateResource' => 'Create Resource', + 'Inform' => 'Inform', + 'Element' => 'Element', + 'Exit' => 'Exit', + 'Url' => 'Url', ]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 68853c9..256537f 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -13,82 +13,82 @@ declare(strict_types=1); return ['OnlineResourceWatcher' => [ - 'Action' => 'Action', - 'Add' => 'Add', - 'Admin' => 'Admin', - 'Back' => 'Back', - 'Bills' => 'Bills', - 'By' => 'By', - 'Cancel' => 'Cancel', - 'Checked' => 'Checked', - 'Dashboard' => 'Dashboard', - 'Date' => 'Date', - 'Filter' => 'Filter', - 'ForgotPassword' => 'Forgot Password', - 'Home' => 'Home', - 'ID' => 'ID', - 'Imprint' => 'Imprint', - 'Legal' => 'Legal', - 'Log' => 'Log', - 'Logo' => 'Logo', - 'SignOut' => 'Sign Out', - 'Logs' => 'Logs', - 'Organization' => 'Organization', - 'Organizations' => 'Organizations', - 'Password' => 'Password', - 'PrivacyPolicy' => 'Privacy Policy', - 'Ref' => 'Ref', - 'Report' => 'Report', - 'Reports' => 'Reports', - 'Reset' => 'Reset', - 'Resource' => 'Resource', - 'Resources' => 'Resources', - 'Create' => 'Create', - 'Delete' => 'Delete', - 'Suspend' => 'Suspend', - 'Send' => 'Send', - 'Save' => 'Save', - 'Search' => 'Search', - 'Settings' => 'Settings', - 'SignIn' => 'Sign In', - 'Status' => 'Status', - 'Submit' => 'Submit', - 'Terms' => 'Terms', - 'Trigger' => 'Trigger', - 'Type' => 'Type', - 'User' => 'User', - 'Username' => 'Username', - 'Users' => 'Users', - 'New' => 'New', - 'Number' => 'Number', - 'CustomerNo' => 'Customer No.', - 'CustomerName' => 'Customer Name', - 'Amount' => 'Amount', - 'Members' => 'Members', - 'Name' => 'Name', - 'Active' => 'Active', - 'Address' => 'Address', - 'Postal' => 'Postal', - 'City' => 'City', - 'BillingEmail' => 'Billing Email', - 'Statistics' => 'Statistics', - 'PlanSettings' => 'Plan Settings', + 'Action' => 'Action', + 'Add' => 'Add', + 'Admin' => 'Admin', + 'Back' => 'Back', + 'Bills' => 'Bills', + 'By' => 'By', + 'Cancel' => 'Cancel', + 'Checked' => 'Checked', + 'Dashboard' => 'Dashboard', + 'Date' => 'Date', + 'Filter' => 'Filter', + 'ForgotPassword' => 'Forgot Password', + 'Home' => 'Home', + 'ID' => 'ID', + 'Imprint' => 'Imprint', + 'Legal' => 'Legal', + 'Log' => 'Log', + 'Logo' => 'Logo', + 'SignOut' => 'Sign Out', + 'Logs' => 'Logs', + 'Organization' => 'Organization', + 'Organizations' => 'Organizations', + 'Password' => 'Password', + 'PrivacyPolicy' => 'Privacy Policy', + 'Ref' => 'Ref', + 'Report' => 'Report', + 'Reports' => 'Reports', + 'Reset' => 'Reset', + 'Resource' => 'Resource', + 'Resources' => 'Resources', + 'Create' => 'Create', + 'Delete' => 'Delete', + 'Suspend' => 'Suspend', + 'Send' => 'Send', + 'Save' => 'Save', + 'Search' => 'Search', + 'Settings' => 'Settings', + 'SignIn' => 'Sign In', + 'Status' => 'Status', + 'Submit' => 'Submit', + 'Terms' => 'Terms', + 'Trigger' => 'Trigger', + 'Type' => 'Type', + 'User' => 'User', + 'Username' => 'Username', + 'Users' => 'Users', + 'New' => 'New', + 'Number' => 'Number', + 'CustomerNo' => 'Customer No.', + 'CustomerName' => 'Customer Name', + 'Amount' => 'Amount', + 'Members' => 'Members', + 'Name' => 'Name', + 'Active' => 'Active', + 'Address' => 'Address', + 'Postal' => 'Postal', + 'City' => 'City', + 'BillingEmail' => 'Billing Email', + 'Statistics' => 'Statistics', + 'PlanSettings' => 'Plan Settings', 'BillingSettings' => 'Billing Settings', - 'UserSettings' => 'User Settings', - 'Login' => 'Login', - 'Email' => 'Email', - 'NewPassword' => 'New Password', - 'CreateResource' => 'Create Resource', - 'Inform' => 'Inform', - 'Element' => 'Element', - 'Exit' => 'Exit', - 'Url' => 'Url', - 'Preview' => 'Preview', - 'XPath' => 'XPath', - 'Comparison' => 'Comparison', - 'History' => 'History', - 'rstatus-1' => 'Resource added', - 'rstatus-2' => 'No change', - 'rstatus-3' => 'Changed', - 'rstatus--1' => 'Download error', + 'UserSettings' => 'User Settings', + 'Login' => 'Login', + 'Email' => 'Email', + 'NewPassword' => 'New Password', + 'CreateResource' => 'Create Resource', + 'Inform' => 'Inform', + 'Element' => 'Element', + 'Exit' => 'Exit', + 'Url' => 'Url', + 'Preview' => 'Preview', + 'XPath' => 'XPath', + 'Comparison' => 'Comparison', + 'History' => 'History', + 'rstatus-1' => 'Resource added', + 'rstatus-2' => 'No change', + 'rstatus-3' => 'Changed', + 'rstatus--1' => 'Download error', ]]; diff --git a/Theme/Backend/resource-create.tpl.php b/Theme/Backend/resource-create.tpl.php index dd139df..07f8bf5 100755 --- a/Theme/Backend/resource-create.tpl.php +++ b/Theme/Backend/resource-create.tpl.php @@ -13,6 +13,7 @@ declare(strict_types=1); use phpOMS\Uri\UriFactory; + ?>