fix argv stuff

This commit is contained in:
Matthew Exon 2022-05-07 19:32:24 +02:00
parent 71e9d28d48
commit 55d6d5aec2

View file

@ -830,7 +830,7 @@ function retriever_content($a) {
$a->page['content'] .= "<p>Please log in</p>"; $a->page['content'] .= "<p>Please log in</p>";
return; return;
} }
if ($a->argv[1] === 'help') { if (isset(DI::args()->getArgv()[1]) and DI::args()->getArgv()[1] === 'help') {
$feeds = DBA::selectToArray('contact', ['id', 'name', 'thumb'], ['uid' => local_user(), 'network' => 'feed']); $feeds = DBA::selectToArray('contact', ['id', 'name', 'thumb'], ['uid' => local_user(), 'network' => 'feed']);
for ($i = 0; $i < count($feeds); ++$i) { for ($i = 0; $i < count($feeds); ++$i) {
$feeds[$i]['url'] = DI::baseUrl()->get(true) . '/retriever/' . $feeds[$i]['id']; $feeds[$i]['url'] = DI::baseUrl()->get(true) . '/retriever/' . $feeds[$i]['id'];
@ -842,14 +842,15 @@ function retriever_content($a) {
'$feeds' => $feeds)); '$feeds' => $feeds));
return; return;
} }
if ($a->argv[1]) { if (isset(DI::args()->getArgv()[1])) {
$retriever_rule = get_retriever_rule($a->argv[1], local_user(), false); $arg1 = DI::args()->getArgv()[1]
$retriever_rule = get_retriever_rule($arg1, local_user(), false);
if (!$retriever_rule) { if (!$retriever_rule) {
$retriever_rule = ['id' => 0, 'data' => ['enable' => 0, 'modurl' => '', 'pattern' => '', 'replace' => '', 'images' => 0, 'storecookies' => 0, 'cookiedata' => '', 'customxslt' => '', 'include' => '', 'exclude' => '']]; $retriever_rule = ['id' => 0, 'data' => ['enable' => 0, 'modurl' => '', 'pattern' => '', 'replace' => '', 'images' => 0, 'storecookies' => 0, 'cookiedata' => '', 'customxslt' => '', 'include' => '', 'exclude' => '']];
} }
if (!empty($_POST["id"])) { if (!empty($_POST["id"])) {
$retriever_rule = get_retriever_rule($a->argv[1], local_user(), true); $retriever_rule = get_retriever_rule($arg1, local_user(), true);
$retriever_rule['data'] = array(); $retriever_rule['data'] = array();
foreach (array('modurl', 'pattern', 'replace', 'enable', 'images', 'customxslt', 'storecookies', 'cookiedata') as $setting) { foreach (array('modurl', 'pattern', 'replace', 'enable', 'images', 'customxslt', 'storecookies', 'cookiedata') as $setting) {
if (empty($_POST['retriever_' . $setting])) { if (empty($_POST['retriever_' . $setting])) {