diff --git a/src/export.php b/src/export.php index 8a3b9bf..4ff7d04 100644 --- a/src/export.php +++ b/src/export.php @@ -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". diff --git a/src/feed.php b/src/feed.php index 2f9d896..0475fb1 100644 --- a/src/feed.php +++ b/src/feed.php @@ -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) "\n". "$listData[_feed_title]\n". "$link\n". - "\n". + "\n". "$listData[_feed_descr]\n". "$buildDate\n\n"; @@ -131,13 +131,13 @@ function printRss($data, $listData) } if ( $status !='' ) $status = "[$status] "; - $s .= "\n". - "". $status. $v['title']. "\n". - "". $itemLink. "\n". - "". $v['_d']. "\n". - "\n". - "$guid\n". - "\n\n"; + $s .= "\t\n". + "\t\t". $status. $v['title']. "\n". + "\t\t". $itemLink. "\n". + "\t\t". $v['_d']. "\n". + "\t\t\n". + "\t\t$guid\n". + "\t\n\n"; } $s .= "\n";