]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - scripts/importtwitteratom.php
Quote URL on dupe search and better logging on upgrade
[quix0rs-gnu-social.git] / scripts / importtwitteratom.php
old mode 100644 (file)
new mode 100755 (executable)
index 261dfb1..2a4cb7f
@@ -34,7 +34,6 @@ import an Atom feed from Twitter as notices by a user
 END_OF_IMPORTTWITTERATOM_HELP;
 
 require_once INSTALLDIR.'/scripts/commandline.inc';
-require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php';
 
 function getAtomFeedDocument()
 {
@@ -82,14 +81,9 @@ function importActivityStream($user, $doc)
         if (!have_option('q', 'quiet')) {
             print $activity->content . "\n";
         }
-        $html = getTweetHtml($object->link);
+        $html = common_purify(getTweetHtml($object->link));
 
-        $config = array('safe' => 1,
-                        'deny_attribute' => 'class,rel,id,style,on*');
-
-        $html = htmLawed($html, $config);
-
-        $content = html_entity_decode(strip_tags($html));
+        $content = html_entity_decode(strip_tags($html), ENT_QUOTES, 'UTF-8');
 
         $notice = Notice::saveNew($user->id,
                                   $content,
@@ -108,7 +102,7 @@ function getTweetHtml($url)
     try {
         $client = new HTTPClient();
         $response = $client->get($url);
-    } catch (HTTP_Request2_Exception $e) {
+    } catch (Exception $e) {
         print "ERROR: HTTP response " . $e->getMessage() . "\n";
         return false;
     }