]> git.mxchange.org Git - friendica-addons.git/commitdiff
Replace `DBA:p` with `Contact:selectToArray`
authorfabrixxm <fabrix.xm@gmail.com>
Tue, 27 Apr 2021 19:08:42 +0000 (21:08 +0200)
committerfabrixxm <fabrix.xm@gmail.com>
Tue, 27 Apr 2021 19:08:42 +0000 (21:08 +0200)
opmlexport/opmlexport.php

index 5714d83dc3f12d4dd8ed6f60315bebe5ab40bb9f..4e49562d3e83fd10f51f236dff1f277180961edf 100644 (file)
@@ -25,19 +25,18 @@ function opmlexport_install()
 }
 
 
-    $stmt = DBA::p("SELECT *
-            FROM `contact`
-            WHERE `uid` = ?
-                AND `self` = 0
-                AND NOT `deleted`
-                AND NOT `archive` AND NOT `blocked` AND NOT `pending`
-                AND network = ?
-            ORDER BY `name` ASC",
-            [local_user(), "feed"]
-    );
-
 function opmlexport(App $a)
 {
+    $condition = [
+        'uid' => local_user(),
+        'self' => false,
+        'deleted' => false,
+        'archive' => false,
+        'blocked' => false,
+        'pending' => false,
+        'network' => Protocol::FEED
+    ];
+    $data = Contact::selectToArray([], $condition, ['order' => ['name']]);
 
     $xml = new \DOMDocument( '1.0', 'utf-8' );
     $opml = $xml->createElement('opml');
@@ -47,14 +46,13 @@ function opmlexport(App $a)
     $outline->setAttribute('title', $a->user['username'] . '\'s RSS/Atom contacts');
     $outline->setAttribute('text', $a->user['username'] . '\'s RSS/Atom contacts');
 
-    while ($c = DBA::fetch($stmt)) {
+    foreach($data as $c) {
         $entry = $xml->createElement('outline');
         $entry->setAttribute('title',  $c['name']);
         $entry->setAttribute('text',   $c['name']);
         $entry->setAttribute('xmlUrl', $c['url']);
         $outline->appendChild($entry);
     }
-    DBA::close($stmt);
 
     $body->appendChild($outline);
     $opml->appendChild($head);