2011-10-23 13:40:40 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Init owncloud
|
|
|
|
require_once('../../lib/base.php');
|
|
|
|
|
|
|
|
OC_JSON::checkLoggedIn();
|
|
|
|
|
|
|
|
// Get the params
|
2012-01-15 23:48:38 +04:00
|
|
|
$dir = isset( $_GET['dir'] ) ? stripslashes($_GET['dir']) : '';
|
|
|
|
$filename = isset( $_GET['filename'] ) ? stripslashes($_GET['filename']) : '';
|
2011-10-23 13:40:40 +04:00
|
|
|
$content = isset( $_GET['content'] ) ? $_GET['content'] : '';
|
|
|
|
|
|
|
|
if($filename == '') {
|
|
|
|
OC_JSON::error(array("data" => array( "message" => "Empty Filename" )));
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(OC_Files::newFile($dir, $filename, 'file')) {
|
|
|
|
if($content){
|
|
|
|
OC_Filesystem::file_put_contents($dir.'/'.$filename,$content);
|
|
|
|
}
|
|
|
|
OC_JSON::success(array("data" => array('content'=>$content)));
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-01-15 23:48:38 +04:00
|
|
|
OC_JSON::error(array("data" => array( "message" => "Error when creating the file" )));
|