-<?php\r
-\r
-namespace Friendica\Module\Admin\Item;\r
-\r
-use Friendica\Core\L10n;\r
-use Friendica\Core\Renderer;\r
-use Friendica\Model\Item;\r
-use Friendica\Module\BaseAdminModule;\r
-use Friendica\Util\Strings;\r
-\r
-class Delete extends BaseAdminModule\r
-{\r
- public static function post()\r
- {\r
- parent::post();\r
-\r
- if (empty($_POST['page_deleteitem_submit'])) {\r
- return;\r
- }\r
-\r
- parent::checkFormSecurityTokenRedirectOnError('/admin/item/delete', 'admin_deleteitem');\r
-\r
- if (!empty($_POST['page_deleteitem_submit'])) {\r
- $guid = trim(Strings::escapeTags($_POST['deleteitemguid']));\r
- // The GUID should not include a "/", so if there is one, we got an URL\r
- // and the last part of it is most likely the GUID.\r
- if (strpos($guid, '/')) {\r
- $guid = substr($guid, strrpos($guid, '/') + 1);\r
- }\r
- // Now that we have the GUID, drop those items, which will also delete the\r
- // associated threads.\r
- Item::delete(['guid' => $guid]);\r
- }\r
-\r
- info(L10n::t('Item marked for deletion.') . EOL);\r
- self::getApp()->internalRedirect('admin/item/delete');\r
- }\r
-\r
- public static function content()\r
- {\r
- parent::content();\r
-\r
- $t = Renderer::getMarkupTemplate('admin/item/delete.tpl');\r
-\r
- return Renderer::replaceMacros($t, [\r
- '$title' => L10n::t('Administration'),\r
- '$page' => L10n::t('Delete Item'),\r
- '$submit' => L10n::t('Delete this Item'),\r
- '$intro1' => L10n::t('On this page you can delete an item from your node. If the item is a top level posting, the entire thread will be deleted.'),\r
- '$intro2' => L10n::t('You need to know the GUID of the item. You can find it e.g. by looking at the display URL. The last part of http://example.com/display/123456 is the GUID, here 123456.'),\r
- '$deleteitemguid' => ['deleteitemguid', L10n::t("GUID"), '', L10n::t("The GUID of the item you want to delete."), 'required', 'autofocus'],\r
- '$form_security_token' => parent::getFormSecurityToken("admin_deleteitem")\r
- ]);\r
- }\r
-}
\ No newline at end of file
+<?php
+
+namespace Friendica\Module\Admin\Item;
+
+use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
+use Friendica\Model\Item;
+use Friendica\Module\BaseAdminModule;
+use Friendica\Util\Strings;
+
+class Delete extends BaseAdminModule
+{
+ public static function post()
+ {
+ parent::post();
+
+ if (empty($_POST['page_deleteitem_submit'])) {
+ return;
+ }
+
+ parent::checkFormSecurityTokenRedirectOnError('/admin/item/delete', 'admin_deleteitem');
+
+ if (!empty($_POST['page_deleteitem_submit'])) {
+ $guid = trim(Strings::escapeTags($_POST['deleteitemguid']));
+ // The GUID should not include a "/", so if there is one, we got an URL
+ // and the last part of it is most likely the GUID.
+ if (strpos($guid, '/')) {
+ $guid = substr($guid, strrpos($guid, '/') + 1);
+ }
+ // Now that we have the GUID, drop those items, which will also delete the
+ // associated threads.
+ Item::delete(['guid' => $guid]);
+ }
+
+ info(L10n::t('Item marked for deletion.') . EOL);
+ self::getApp()->internalRedirect('admin/item/delete');
+ }
+
+ public static function content()
+ {
+ parent::content();
+
+ $t = Renderer::getMarkupTemplate('admin/item/delete.tpl');
+
+ return Renderer::replaceMacros($t, [
+ '$title' => L10n::t('Administration'),
+ '$page' => L10n::t('Delete Item'),
+ '$submit' => L10n::t('Delete this Item'),
+ '$intro1' => L10n::t('On this page you can delete an item from your node. If the item is a top level posting, the entire thread will be deleted.'),
+ '$intro2' => L10n::t('You need to know the GUID of the item. You can find it e.g. by looking at the display URL. The last part of http://example.com/display/123456 is the GUID, here 123456.'),
+ '$deleteitemguid' => ['deleteitemguid', L10n::t("GUID"), '', L10n::t("The GUID of the item you want to delete."), 'required', 'autofocus'],
+ '$form_security_token' => parent::getFormSecurityToken("admin_deleteitem")
+ ]);
+ }
+}