aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Wiki.php18
-rw-r--r--include/import.php38
-rw-r--r--include/wiki.php2
3 files changed, 30 insertions, 28 deletions
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index fbf751ddf..1e6446904 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -167,7 +167,7 @@ class Wiki extends \Zotlabs\Web\Controller {
if((argc() > 2) && (argv(2) === 'preview')) {
$content = $_POST['content'];
require_once('library/markdown.php');
- $html = Markdown($content);
+ $html = purify_html(Markdown($content));
json_return_and_die(array('html' => $html, 'success' => true));
}
@@ -182,19 +182,7 @@ class Wiki extends \Zotlabs\Web\Controller {
// more detail permissions framework
if (local_channel() !== intval($channel['channel_id'])) {
goaway('/'.argv(0).'/'.$nick.'/');
- } else {
- /*
- $channel = get_channel_by_nick($nick);
- // Figure out who the page owner is.
- $perms = get_all_perms(intval($channel['channel_id']), $observer_hash);
- // TODO: Create a new permission setting for wiki analogous to webpages. Until
- // then, use webpage permissions
- if (!$perms['write_pages']) {
- notice(t('Permission denied.') . EOL);
- goaway('/'.argv(0).'/'.argv(1).'/');
- }
- */
- }
+ }
$wiki = array();
// Generate new wiki info from input name
$wiki['rawName'] = $_POST['wikiName'];
@@ -306,7 +294,7 @@ class Wiki extends \Zotlabs\Web\Controller {
$resource_id = $_POST['resource_id'];
$pageUrlName = $_POST['name'];
$pageHtmlName = escape_tags($_POST['name']);
- $content = escape_tags($_POST['content']); //Get new content
+ $content = $_POST['content']; //Get new content
$commitMsg = $_POST['commitMsg'];
if ($commitMsg === '') {
$commitMsg = 'Updated ' . $pageHtmlName;
diff --git a/include/import.php b/include/import.php
index 6fcb08416..be456bfa9 100644
--- a/include/import.php
+++ b/include/import.php
@@ -122,6 +122,11 @@ function import_profiles($channel,$profiles) {
$profile['aid'] = get_account_id();
$profile['uid'] = $channel['channel_id'];
+ convert_oldfields($profile,'name','fullname');
+ convert_oldfields($profile,'with','partner');
+ convert_oldfields($profile,'work','employment');
+
+
// we are going to reset all profile photos to the original
// somebody will have to fix this later and put all the applicable photos into the export
@@ -644,6 +649,10 @@ function import_events($channel,$events) {
unset($event['id']);
$event['aid'] = $channel['channel_account_id'];
$event['uid'] = $channel['channel_id'];
+ convert_oldfields($event,'start','dtstart');
+ convert_oldfields($event,'finish','dtend');
+ convert_oldfields($event,'type','etype');
+ convert_oldfields($event,'ignore','dismissed');
dbesc_array($event);
$r = dbq("INSERT INTO event (`"
@@ -677,6 +686,12 @@ function sync_events($channel,$events) {
$event['aid'] = $channel['channel_account_id'];
$event['uid'] = $channel['channel_id'];
+ convert_oldfields($event,'start','dtstart');
+ convert_oldfields($event,'finish','dtend');
+ convert_oldfields($event,'type','etype');
+ convert_oldfields($event,'ignore','dismissed');
+
+
$exists = false;
$x = q("select * from event where event_hash = '%s' and uid = %d limit 1",
@@ -974,10 +989,7 @@ function sync_files($channel,$files) {
$attachment_stored = false;
foreach($f['attach'] as $att) {
- if(array_key_exists('data',$att)) {
- $att['content'] = $att['data'];
- unset($att['data']);
- }
+ convert_oldfields($att,'data','content');
if($att['deleted']) {
attach_delete($channel,$att['hash']);
@@ -1130,14 +1142,10 @@ function sync_files($channel,$files) {
$p['aid'] = $channel['channel_account_id'];
$p['uid'] = $channel['channel_id'];
- if(array_key_exists('data',$p)) {
- $p['content'] = $p['data'];
- unset($p['data']);
- }
- if(array_key_exists('scale',$p)) {
- $p['imgscale'] = $p['scale'];
- unset($p['scale']);
- }
+ convert_oldfields($p,'data','content');
+ convert_oldfields($p,'scale','imgscale');
+ convert_oldfields($p,'size','filesize');
+ convert_oldfields($p,'type','mimetype');
// if this is a profile photo, undo the profile photo bit
// for any other photo which previously held it.
@@ -1228,3 +1236,9 @@ function sync_files($channel,$files) {
}
+function convert_oldfields(&$arr,$old,$new) {
+ if(array_key_exists($old,$arr)) {
+ $arr[$new] = $arr[$old];
+ unset($arr[$old]);
+ }
+}
diff --git a/include/wiki.php b/include/wiki.php
index f0785d549..4aa3fc1b4 100644
--- a/include/wiki.php
+++ b/include/wiki.php
@@ -279,7 +279,7 @@ function wiki_page_history($arr) {
function wiki_save_page($arr) {
$pageUrlName = ((array_key_exists('pageUrlName',$arr)) ? $arr['pageUrlName'] : '');
- $content = ((array_key_exists('content',$arr)) ? $arr['content'] : '');
+ $content = ((array_key_exists('content',$arr)) ? purify_html($arr['content']) : '');
$resource_id = ((array_key_exists('resource_id',$arr)) ? $arr['resource_id'] : '');
$w = wiki_get_wiki($resource_id);
if (!$w['path']) {