summaryrefslogtreecommitdiffstats
path: root/ajax
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2012-07-30 14:08:36 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2012-07-30 14:08:36 -0400
commitfd5b815e587ccc3642995346cd03eca4e0a0707f (patch)
tree2cc9bdf3de5e45b8f23e96673f4d8625651f81df /ajax
parenta5438863a4e88fb5c9e166e8810f493a1feb2cf0 (diff)
opml parser completed; still needs testing
Diffstat (limited to 'ajax')
-rw-r--r--ajax/createfolder.php5
-rw-r--r--ajax/importopml.php18
2 files changed, 6 insertions, 17 deletions
diff --git a/ajax/createfolder.php b/ajax/createfolder.php
index b5f624604..6d3c62411 100644
--- a/ajax/createfolder.php
+++ b/ajax/createfolder.php
@@ -22,10 +22,11 @@ $parentid = trim($_POST['parentid']);
$foldermapper = new OC_News_FolderMapper($userid);
-if($parentid != 0)
+if($parentid != 0) {
$folder = new OC_News_Folder($name, NULL, $foldermapper->find($parentid));
-else
+} else {
$folder = new OC_News_Folder($name);
+}
$folderid = $foldermapper->save($folder);
diff --git a/ajax/importopml.php b/ajax/importopml.php
index 5a93567f9..89e2a52f0 100644
--- a/ajax/importopml.php
+++ b/ajax/importopml.php
@@ -27,30 +27,18 @@ function debug($msg) {
OCP\Util::writeLog('news','ajax/importopml.php: '.$msg, OCP\Util::DEBUG);
}
-if(!isset($_GET['path'])) {
+if(!isset($_POST['path'])) {
bailOut($l->t('No file path was submitted.'));
}
require_once('news/opmlparser.php');
-$raw = file_get_contents($_GET['path']);
+$raw = file_get_contents($_POST['path']);
$parser = new OPMLParser($raw);
$title = $parser->getTitle();
+$data = $parser->parse();
$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");
-
-if(!file_exists($localpath)) {
- bailOut($l->t('File doesn\'t exist:').$localpath);
-}
-
-if (file_put_contents($tmpfname, file_get_contents($localpath))) {
- OCP\JSON::success(array('data' => array('tmp'=>$tmpfname, 'path'=>$localpath)));
-} else {
- bailOut(bailOut('Couldn\'t save temporary image: '.$tmpfname));
-}*/