aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-02 20:57:51 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-02 20:57:51 +0100
commit986c7297e71d926afa584c6de293794a49f69adf (patch)
tree3215140d47d5db2cdad0c30c03ccadf9fc181ede
parent56b269cef6bc54fa8d8fc69ff0f0e8b2ffb36afb (diff)
OPML import plus tolérant
Plus correction bug checkUrl()
-rw-r--r--app/views/index/logs.phtml2
-rw-r--r--lib/lib_rss.php17
2 files changed, 13 insertions, 6 deletions
diff --git a/app/views/index/logs.phtml b/app/views/index/logs.phtml
index 5a0b03b98..178ff8ad3 100644
--- a/app/views/index/logs.phtml
+++ b/app/views/index/logs.phtml
@@ -14,7 +14,7 @@
<?php $this->logsPaginator->render ('logs_pagination.phtml', 'page'); ?>
<?php foreach ($items as $log) { ?>
- <div class="log <?php echo $log->level (); ?>"><span class="date"><?php echo @date ('Y-m-d H:i:s', strtotime ($log->date ())); ?></span><?php echo htmlspecialchars ($log->info (), ENT_NOQUOTES, 'UTF-8'); ?></div>
+ <div class="log <?php echo $log->level (); ?>"><span class="date"><?php echo @date ('Y-m-d H:i:s', @strtotime ($log->date ())); ?></span><?php echo htmlspecialchars ($log->info (), ENT_NOQUOTES, 'UTF-8'); ?></div>
<?php } ?>
<?php $this->logsPaginator->render ('logs_pagination.phtml','page'); ?>
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 22e50a424..ae140827c 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -19,13 +19,13 @@ function checkUrl($url) {
if (empty ($url)) {
return '';
}
- if (!preg_match ('#^https?://#i', $value)) {
+ if (!preg_match ('#^https?://#i', $url)) {
$url = 'http://' . $url;
}
if (filter_var($url, FILTER_VALIDATE_URL) ||
- (version_compare(PHP_VERSION, '5.3.3', '<') && (strpos($value, '-') > 0) && //PHP bug #51192
- ($value === filter_var($value, FILTER_SANITIZE_URL)))) {
- return url;
+ (version_compare(PHP_VERSION, '5.3.3', '<') && (strpos($url, '-') > 0) && //PHP bug #51192
+ ($url === filter_var($url, FILTER_SANITIZE_URL)))) {
+ return $url;
} else {
return false;
}
@@ -113,7 +113,14 @@ function html_only_entity_decode($text) {
function opml_import ($xml) {
$xml = html_only_entity_decode($xml); //!\ Assume UTF-8
- $opml = simplexml_load_string ($xml);
+
+ $dom = new DOMDocument();
+ $dom->recover = true;
+ $dom->strictErrorChecking = false;
+ $dom->loadXML($xml);
+ $this->encoding = 'UTF-8';
+
+ $opml = simplexml_import_dom($dom);
if (!$opml) {
throw new OpmlException ();