- fix deprecation notices in php 8.2

(cherry picked from commit 8833e7c417)
This commit is contained in:
maxpozdeev 2023-03-23 22:28:00 +03:00
parent 8da989ed51
commit 3a68339cb9
2 changed files with 16 additions and 16 deletions

View file

@ -42,15 +42,15 @@ if($format == 'ical') printICal($listData, $data);
else printCSV($listData, $data);
function printCSV($listData, $data)
function printCSV(array $listData, array $data)
{
$s = "\xEF\xBB\xBF". "Completed;Priority;Task;Notes;Tags;Due;DateCreated;DateCompleted\n";
foreach($data as $r)
{
$s .= ($r['compl']?'1':'0'). ';'.
$r['prio']. ';'. escape_csv($r['title']). ';'.
escape_csv($r['note']). ';'.
escape_csv($r['tags']). ';'.
$r['prio']. ';'. escape_csv($r['title'] ?? ''). ';'.
escape_csv($r['note'] ?? ''). ';'.
escape_csv($r['tags'] ?? ''). ';'.
$r['duedate']. ';'.
date('Y-m-d H:i:s O',$r['d_created']). ';'.
($r['d_completed'] ? date('Y-m-d H:i:s O',$r['d_completed']) :''). "\n";
@ -60,7 +60,7 @@ function printCSV($listData, $data)
print $s;
}
function escape_csv($v)
function escape_csv(string $v)
{
//escape formulas
$nf = '';
@ -71,7 +71,7 @@ function escape_csv($v)
return '"'. $nf. str_replace('"', '""', $v). '"';
}
function printICal($listData, $data)
function printICal(array $listData, array $data)
{
$mttToIcalPrio = array("1" => 5, "2" => 1);
$s = "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nMETHOD:PUBLISH\r\nCALSCALE:GREGORIAN\r\nPRODID:-//myTinyTodo//iCalendar Export v1.4//EN\r\n".

View file

@ -62,7 +62,7 @@ htmlarray_ref($listData);
printRss($data, $listData);
function fillData(&$data, $listId, $field, $sqlWhere )
function fillData(array &$data, int $listId, string $field, string $sqlWhere )
{
$lang = Lang::instance();
$db = DBConnection::instance();
@ -97,7 +97,7 @@ function fillData(&$data, $listId, $field, $sqlWhere )
}
}
function printRss($data, $listData)
function printRss(array $data, array $listData)
{
$lang = Lang::instance();
$link = get_mttinfo('url'). "?list=". (int)$listData['id'];
@ -108,7 +108,7 @@ function printRss($data, $listData)
"<channel>\n".
"<title>$listData[_feed_title]</title>\n".
"<link>$link</link>\n".
"<atom:link href=\"${listData['_feed_link']}\" rel=\"self\" type=\"application/rss+xml\"/>\n".
"<atom:link href=\"{$listData['_feed_link']}\" rel=\"self\" type=\"application/rss+xml\"/>\n".
"<description>$listData[_feed_descr]</description>\n".
"<lastBuildDate>$buildDate</lastBuildDate>\n\n";
@ -131,13 +131,13 @@ function printRss($data, $listData)
}
if ( $status !='' ) $status = "[$status] ";
$s .= "<item>\n".
"<title>". $status. $v['title']. "</title>\n".
"<link>". $itemLink. "</link>\n".
"<pubDate>". $v['_d']. "</pubDate>\n".
"<description><![CDATA[". $v['_descr']. "]]></description>\n".
"<guid isPermaLink=\"false\">$guid</guid>\n".
"</item>\n\n";
$s .= "\t<item>\n".
"\t\t<title>". $status. $v['title']. "</title>\n".
"\t\t<link>". $itemLink. "</link>\n".
"\t\t<pubDate>". $v['_d']. "</pubDate>\n".
"\t\t<description><![CDATA[". $v['_descr']. "]]></description>\n".
"\t\t<guid isPermaLink=\"false\">$guid</guid>\n".
"\t</item>\n\n";
}
$s .= "</channel>\n</rss>";