summaryrefslogtreecommitdiffstats
path: root/ajax
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2012-07-30 02:24:38 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2012-07-30 02:24:38 -0400
commita5438863a4e88fb5c9e166e8810f493a1feb2cf0 (patch)
tree5239bdede220fdd4a74f988fa3493cc86b0f33c7 /ajax
parent0812aadc7b1eaf45afd8a56640cc5de84d0e3dd7 (diff)
parses opml file to get the title
Diffstat (limited to 'ajax')
-rw-r--r--ajax/importopml.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/ajax/importopml.php b/ajax/importopml.php
index 3b66bb8e7..5a93567f9 100644
--- a/ajax/importopml.php
+++ b/ajax/importopml.php
@@ -22,17 +22,25 @@ function bailOut($msg) {
OCP\Util::writeLog('news','ajax/importopml.php: '.$msg, OCP\Util::ERROR);
exit();
}
+
function debug($msg) {
OCP\Util::writeLog('news','ajax/importopml.php: '.$msg, OCP\Util::DEBUG);
}
if(!isset($_GET['path'])) {
bailOut($l->t('No file path was submitted.'));
-}
+}
require_once('news/opmlparser.php');
-$parser = new OPMLParser();
+$raw = file_get_contents($_GET['path']);
+
+$parser = new OPMLParser($raw);
+$title = $parser->getTitle();
+$count = 0; //number of feeds imported
+
+OCP\JSON::success(array('data' => array('title'=>$title, 'count'=>$count)));
+
/*
$localpath = OC_Filesystem::getLocalFile($_GET['path']);
$tmpfname = tempnam(get_temp_dir(), "occOrig");