aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-12-06 14:29:36 -0800
committerzotlabs <mike@macgirvin.com>2017-12-06 14:29:36 -0800
commite5653945d35e00ae1821fa93e502cc4555519735 (patch)
tree05c1a273a378ccf02bc19cfb32c8f5be7391abff
parent0a55d6d51143acbf1084104d1626c7a4b88e6c15 (diff)
parenta604236d89a843a10af1a87f5e9a5cdac153b3ab (diff)
downloadvolse-hubzilla-e5653945d35e00ae1821fa93e502cc4555519735.tar.gz
volse-hubzilla-e5653945d35e00ae1821fa93e502cc4555519735.tar.bz2
volse-hubzilla-e5653945d35e00ae1821fa93e502cc4555519735.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
-rw-r--r--Zotlabs/Lib/NativeWikiPage.php4
-rw-r--r--Zotlabs/Module/Cloud.php24
-rw-r--r--Zotlabs/Module/Display.php7
-rw-r--r--Zotlabs/Module/Update.php43
-rw-r--r--Zotlabs/Module/Update_articles.php39
-rw-r--r--Zotlabs/Module/Update_cards.php39
-rw-r--r--Zotlabs/Module/Update_channel.php70
-rw-r--r--Zotlabs/Module/Update_display.php32
-rw-r--r--Zotlabs/Module/Update_home.php42
-rw-r--r--Zotlabs/Module/Update_hq.php31
-rw-r--r--Zotlabs/Module/Update_network.php44
-rw-r--r--Zotlabs/Module/Update_pubstream.php26
-rw-r--r--Zotlabs/Module/Update_search.php69
-rw-r--r--Zotlabs/Module/Wiki.php81
-rw-r--r--Zotlabs/Storage/Browser.php2
-rw-r--r--Zotlabs/Widget/Wiki_pages.php36
-rw-r--r--view/theme/redbasic/css/style.css17
-rwxr-xr-xview/tpl/build_query.tpl2
-rw-r--r--view/tpl/wiki_page_not_found.tpl34
19 files changed, 206 insertions, 436 deletions
diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php
index 209a5ef3c..919c51276 100644
--- a/Zotlabs/Lib/NativeWikiPage.php
+++ b/Zotlabs/Lib/NativeWikiPage.php
@@ -68,6 +68,9 @@ class NativeWikiPage {
return array('content' => null, 'message' => 'Error reading wiki', 'success' => false);
}
+ // backslashes won't work well in the javascript functions
+ $name = str_replace('\\','',$name);
+
// create an empty activity
$arr = [];
@@ -351,6 +354,7 @@ class NativeWikiPage {
// fetch the most recently saved revision.
$item = self::load_page($arr);
+
if(! $item) {
return array('message' => t('Page not found'), 'success' => false);
}
diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php
index 0f7f9c47a..2215507ca 100644
--- a/Zotlabs/Module/Cloud.php
+++ b/Zotlabs/Module/Cloud.php
@@ -87,6 +87,10 @@ class Cloud extends \Zotlabs\Web\Controller {
// $server->addPlugin(new \Zotlabs\Storage\\QuotaPlugin($auth));
+ // over-ride the default XML output on thrown exceptions
+
+ $server->on('exception', [ $this, 'DAVException' ]);
+
// All we need to do now, is to fire up the server
$server->exec();
@@ -97,4 +101,24 @@ class Cloud extends \Zotlabs\Web\Controller {
killme();
}
+
+ function DAVException($err) {
+
+ if($err instanceof \Sabre\DAV\Exception\NotFound) {
+ notice( t('Not found') . EOL);
+ }
+ elseif($err instanceof \Sabre\DAV\Exception\Forbidden) {
+ notice( t('Permission denied') . EOL);
+ }
+ else {
+ notice( t('Unknown error') . EOL);
+ }
+
+ construct_page();
+
+ killme();
+ }
+
}
+
+
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 266a5b6bf..6d895feb5 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -14,6 +14,7 @@ class Display extends \Zotlabs\Web\Controller {
$module_format = 'html';
+
if(argc() > 1) {
$module_format = substr(argv(1),strrpos(argv(1),'.') + 1);
if(! in_array($module_format,['atom','zot','json']))
@@ -30,7 +31,7 @@ class Display extends \Zotlabs\Web\Controller {
return;
}
- if(argc() > 1 && argv(1) !== 'load') {
+ if(argc() > 1) {
$item_hash = argv(1);
if($module_format !== 'html') {
$item_hash = substr($item_hash,0,strrpos($item_hash,'.'));
@@ -260,7 +261,7 @@ class Display extends \Zotlabs\Web\Controller {
elseif($update && !$load) {
$r = null;
-
+
require_once('include/channel.php');
$sys = get_sys_channel();
$sysid = $sys['channel_id'];
@@ -285,7 +286,6 @@ class Display extends \Zotlabs\Web\Controller {
// make that content unsearchable by ensuring the owner_xchan can't match
if(! perm_is_allowed($sysid,$observer_hash,'view_stream'))
$sysid = 0;
-
$r = q("SELECT item.parent AS item_id from item
WHERE parent_mid = '%s'
AND (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = ''
@@ -315,7 +315,6 @@ class Display extends \Zotlabs\Web\Controller {
WHERE parent in ( %s ) $item_normal ",
dbesc($parents_str)
);
-
xchan_query($items);
$items = fetch_post_tags($items,true);
$items = conv_sort($items,'created');
diff --git a/Zotlabs/Module/Update.php b/Zotlabs/Module/Update.php
new file mode 100644
index 000000000..b3252f8b9
--- /dev/null
+++ b/Zotlabs/Module/Update.php
@@ -0,0 +1,43 @@
+<?php
+namespace Zotlabs\Module;
+
+
+class Update extends \Zotlabs\Web\Controller {
+
+ function get() {
+
+ $profile_uid = intval($_GET['p']);
+
+ // it's probably safe to do this for all modules and not just a limited subset,
+ // but it needs to be verified.
+
+ if((! $profile_uid) && in_array(argv(1),['display','search','pubstream','home']))
+ $profile_uid = (-1);
+
+ if(argc() < 2) {
+ killme();
+ }
+
+ // These modules don't have a completely working liveUpdate implementation currently
+
+ if(in_array(strtolower(argv(1)),['articles','cards']))
+ killme();
+
+ $module = "\\Zotlabs\\Module\\" . ucfirst(argv(1));
+ $load = (((argc() > 2) && (argv(2) == 'load')) ? 1 : 0);
+
+ $mod = new $module;
+
+ header("Content-type: text/html");
+
+ \App::$argv = [ argv(1) ];
+ \App::$argc = 1;
+
+ echo "<!DOCTYPE html><html><body><section>\r\n";
+ echo $mod->get($profile_uid, $load);
+ echo "</section></body></html>\r\n";
+
+ killme();
+
+ }
+}
diff --git a/Zotlabs/Module/Update_articles.php b/Zotlabs/Module/Update_articles.php
deleted file mode 100644
index 280904f67..000000000
--- a/Zotlabs/Module/Update_articles.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-namespace Zotlabs\Module;
-
-/**
- * Module: update_profile
- * Purpose: AJAX synchronisation of profile page
- *
- */
-
-
-class Update_articles extends \Zotlabs\Web\Controller {
-
-function get() {
-
- $profile_uid = intval($_GET['p']);
- $load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0);
-
- header("Content-type: text/html");
- echo "<!DOCTYPE html><html><body><section></section></body></html>\r\n";
-
- killme();
-
-
- $mod = new Articles();
-
- $text = $mod->get($profile_uid,$load);
-
- /**
- * reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
- */
-
- echo str_replace("\t",' ',$text);
- echo (($_GET['msie'] == 1) ? '</div>' : '</section>');
- echo "</body></html>\r\n";
- killme();
-
-}
-}
diff --git a/Zotlabs/Module/Update_cards.php b/Zotlabs/Module/Update_cards.php
deleted file mode 100644
index bb87357e8..000000000
--- a/Zotlabs/Module/Update_cards.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-namespace Zotlabs\Module;
-
-/**
- * Module: update_profile
- * Purpose: AJAX synchronisation of profile page
- *
- */
-
-
-class Update_cards extends \Zotlabs\Web\Controller {
-
-function get() {
-
- $profile_uid = intval($_GET['p']);
- $load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0);
-
- header("Content-type: text/html");
- echo "<!DOCTYPE html><html><body><section></section></body></html>\r\n";
-
- killme();
-
-
- $mod = new Cards();
-
- $text = $mod->get($profile_uid,$load);
-
- /**
- * reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
- */
-
- echo str_replace("\t",' ',$text);
- echo (($_GET['msie'] == 1) ? '</div>' : '</section>');
- echo "</body></html>\r\n";
- killme();
-
-}
-}
diff --git a/Zotlabs/Module/Update_channel.php b/Zotlabs/Module/Update_channel.php
deleted file mode 100644
index 46ad19805..000000000
--- a/Zotlabs/Module/Update_channel.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-namespace Zotlabs\Module;
-
-/**
- * Module: update_profile
- * Purpose: AJAX synchronisation of profile page
- *
- */
-
-
-class Update_channel extends \Zotlabs\Web\Controller {
-
-function get() {
-
- $profile_uid = intval($_GET['p']);
- $load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0);
-
- header("Content-type: text/html");
- echo "<!DOCTYPE html><html><body>\r\n";
-
- /**
- * We can remove this hack once Internet Explorer recognises HTML5 natively
- */
-
- echo (($_GET['msie'] == 1) ? '<div>' : '<section>');
-
- /**
- *
- * Grab the page inner contents by calling the content function from the profile module directly,
- * but move any image src attributes to another attribute name. This is because
- * some browsers will prefetch all the images for the page even if we don't need them.
- * The only ones we need to fetch are those for new page additions, which we'll discover
- * on the client side and then swap the image back.
- *
- */
-
- $mod = new Channel();
-
- $text = $mod->get($profile_uid,$load);
-
- $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
- $replace = "<img\${1} dst=\"\${2}\"";
-// $text = preg_replace($pattern, $replace, $text);
-
-/*
- if(! $load) {
- $replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
- $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
- $text = preg_replace($pattern, $replace, $text);
- $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
- $text = preg_replace($pattern, $replace, $text);
- $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
- $text = preg_replace($pattern, $replace, $text);
- $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
- $text = preg_replace($pattern, $replace, $text);
- }
-*/
-
- /**
- * reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
- */
-
- echo str_replace("\t",' ',$text);
- echo (($_GET['msie'] == 1) ? '</div>' : '</section>');
- echo "</body></html>\r\n";
- killme();
-
-}
-}
diff --git a/Zotlabs/Module/Update_display.php b/Zotlabs/Module/Update_display.php
deleted file mode 100644
index b2c6a56f5..000000000
--- a/Zotlabs/Module/Update_display.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-namespace Zotlabs\Module;
-
-// See update_profile.php for documentation
-
-require_once('include/group.php');
-
-
-class Update_display extends \Zotlabs\Web\Controller {
-
- function get() {
-
- $profile_uid = intval($_GET['p']);
- if(! $profile_uid)
- $profile_uid = (-1);
- $load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0);
- header("Content-type: text/html");
- echo "<!DOCTYPE html><html><body>\r\n";
- echo (($_GET['msie'] == 1) ? '<div>' : '<section>');
-
- $mod = new Display();
- $text = $mod->get($profile_uid, $load);
-
- echo str_replace("\t",' ',$text);
- echo (($_GET['msie'] == 1) ? '</div>' : '</section>');
- echo "</body></html>\r\n";
-
- killme();
-
- }
-
-}
diff --git a/Zotlabs/Module/Update_home.php b/Zotlabs/Module/Update_home.php
deleted file mode 100644
index 0f699482e..000000000
--- a/Zotlabs/Module/Update_home.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-namespace Zotlabs\Module;
-
-// See update_profile.php for documentation
-
-class Update_home extends \Zotlabs\Web\Controller {
-
- function get() {
-
- $profile_uid = ((intval($_GET['p'])) ? intval($_GET['p']) : (-1));
- $load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0);
- header("Content-type: text/html");
- echo "<!DOCTYPE html><html><body>\r\n";
- echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '<div>' : '<section>');
-
- $mod = new Home();
- $text = $mod->get($profile_uid, $load);
-
- $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
- $replace = "<img\${1} dst=\"\${2}\"";
- // $text = preg_replace($pattern, $replace, $text);
- /*
- if(! $load) {
- $replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
- $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
- $text = preg_replace($pattern, $replace, $text);
- $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
- $text = preg_replace($pattern, $replace, $text);
- $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
- $text = preg_replace($pattern, $replace, $text);
- $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
- $text = preg_replace($pattern, $replace, $text);
- }
- */
- echo str_replace("\t",' ',$text);
- echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '</div>' : '</section>');
- echo "</body></html>\r\n";
- // logger('update_home: ' . $text);
- killme();
-
- }
-}
diff --git a/Zotlabs/Module/Update_hq.php b/Zotlabs/Module/Update_hq.php
deleted file mode 100644
index bb1495c64..000000000
--- a/Zotlabs/Module/Update_hq.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-namespace Zotlabs\Module;
-
-// See update_profile.php for documentation
-
-require_once('include/group.php');
-
-
-class Update_hq extends \Zotlabs\Web\Controller {
-
- function get() {
-
- $profile_uid = intval($_GET['p']);
-
- $load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0);
- header("Content-type: text/html");
- echo "<!DOCTYPE html><html><body>\r\n";
- echo (($_GET['msie'] == 1) ? '<div>' : '<section>');
-
- $mod = new Hq();
- $text = $mod->get($profile_uid, $load);
-
- echo str_replace("\t",' ',$text);
- echo (($_GET['msie'] == 1) ? '</div>' : '</section>');
- echo "</body></html>\r\n";
-
- killme();
-
- }
-
-}
diff --git a/Zotlabs/Module/Update_network.php b/Zotlabs/Module/Update_network.php
deleted file mode 100644
index c27b7614a..000000000
--- a/Zotlabs/Module/Update_network.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-namespace Zotlabs\Module;
-
-// See update_profile.php for documentation
-
-require_once('include/group.php');
-
-class Update_network extends \Zotlabs\Web\Controller {
-
- function get() {
-
- $profile_uid = intval($_GET['p']);
- $load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0);
- header("Content-type: text/html");
- echo "<!DOCTYPE html><html><body>\r\n";
- echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '<div>' : '<section>');
-
- $mod = new Network();
- $text = $mod->get($profile_uid, $load);
-
- $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
- $replace = "<img\${1} dst=\"\${2}\"";
- // $text = preg_replace($pattern, $replace, $text);
- /*
- if(! $load) {
- $replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
- $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
- $text = preg_replace($pattern, $replace, $text);
- $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
- $text = preg_replace($pattern, $replace, $text);
- $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
- $text = preg_replace($pattern, $replace, $text);
- $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
- $text = preg_replace($pattern, $replace, $text);
- }
- */
- echo str_replace("\t",' ',$text);
- echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '</div>' : '</section>');
- echo "</body></html>\r\n";
- // logger('update_network: ' . $text);
- killme();
-
- }
-}
diff --git a/Zotlabs/Module/Update_pubstream.php b/Zotlabs/Module/Update_pubstream.php
deleted file mode 100644
index 8bb5ebfe7..000000000
--- a/Zotlabs/Module/Update_pubstream.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-namespace Zotlabs\Module;
-
-// See update_profile.php for documentation
-
-
-class Update_pubstream extends \Zotlabs\Web\Controller {
-
- function get() {
-
- $profile_uid = ((intval($_GET['p'])) ? intval($_GET['p']) : (-1));
- $load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0);
- header("Content-type: text/html");
- echo "<!DOCTYPE html><html><body>\r\n";
- echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '<div>' : '<section>');
-
- $mod = new Pubstream();
- $text = $mod->get($profile_uid, $load);
-
- echo str_replace("\t",' ',$text);
- echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '</div>' : '</section>');
- echo "</body></html>\r\n";
- killme();
-
- }
-}
diff --git a/Zotlabs/Module/Update_search.php b/Zotlabs/Module/Update_search.php
deleted file mode 100644
index 4491f40f4..000000000
--- a/Zotlabs/Module/Update_search.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-namespace Zotlabs\Module;
-
-/**
- * Module: update_profile
- * Purpose: AJAX synchronisation of search page
- *
- */
-
-
-class Update_search extends \Zotlabs\Web\Controller {
-
- function get() {
-
- $profile_uid = intval($_GET['p']);
- if(! $profile_uid)
- $profile_uid = (-1);
-
- $load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0);
-
- header("Content-type: text/html");
- echo "<!DOCTYPE html><html><body>\r\n";
-
- /**
- * We can remove this hack once Internet Explorer recognises HTML5 natively
- */
-
- echo (($_GET['msie'] == 1) ? '<div>' : '<section>');
-
- /**
- *
- * Grab the page inner contents by calling the content function from the profile module directly,
- * but move any image src attributes to another attribute name. This is because
- * some browsers will prefetch all the images for the page even if we don't need them.
- * The only ones we need to fetch are those for new page additions, which we'll discover
- * on the client side and then swap the image back.
- *
- */
-
- $mod = new Search();
- $text = $mod->get($profile_uid,$load);
-
- $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
- $replace = "<img\${1} dst=\"\${2}\"";
- // $text = preg_replace($pattern, $replace, $text);
- /*
- if(! $load) {
- $replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
- $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
- $text = preg_replace($pattern, $replace, $text);
- $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
- $text = preg_replace($pattern, $replace, $text);
- $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
- $text = preg_replace($pattern, $replace, $text);
- $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
- $text = preg_replace($pattern, $replace, $text);
- }
- */
- /**
- * reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
- */
-
- echo str_replace("\t",' ',$text);
- echo (($_GET['msie'] == 1) ? '</div>' : '</section>');
- echo "</body></html>\r\n";
- killme();
-
- }
-}
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index 2d2d8e2b7..ae543eb98 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -293,31 +293,43 @@ class Wiki extends \Zotlabs\Web\Controller {
$p = Zlib\NativeWikiPage::get_page_content(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName));
}
if(! ($p && $p['success'])) {
+ $x = new \Zotlabs\Widget\Wiki_pages();
+
+ $html = $x->create_missing_page([
+ 'resource_id' => $resource_id,
+ 'channel_id' => $owner['channel_id'],
+ 'channel_address' => $owner['channel_address'],
+ 'refresh' => true
+ ]);
+ //json_return_and_die(array('pages' => $page_list_html, 'message' => '', 'success' => true));
notice( t('Error retrieving page content') . EOL);
- goaway(z_root() . '/' . argv(0) . '/' . argv(1) );
+ //goaway(z_root() . '/' . argv(0) . '/' . argv(1) );
+ $renderedContent = Zlib\NativeWikiPage::convert_links($html, argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
+ $showPageControls = $wiki_editor;
}
-
- $mimeType = $p['pageMimeType'];
-
- $sampleContent = (($mimeType == 'text/bbcode') ? '[h3]' . t('New page') . '[/h3]' : '### ' . t('New page'));
- if($mimeType === 'text/plain')
- $sampleContent = t('New page');
-
- $content = (($p['content'] == '') ? $sampleContent : $p['content']);
-
- // Render the Markdown-formatted page content in HTML
- if($mimeType == 'text/bbcode') {
- $renderedContent = Zlib\NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))), argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
- }
- elseif($mimeType === 'text/plain') {
- $renderedContent = str_replace(["\n",' ',"\t"],[EOL,'&nbsp;','&nbsp;&nbsp;&nbsp;&nbsp;'],htmlentities($content,ENT_COMPAT,'UTF-8',false));
- }
- elseif($mimeType === 'text/markdown') {
- $content = Zlib\MarkdownSoap::unescape($content);
- $html = Zlib\NativeWikiPage::generate_toc(zidify_text(MarkdownExtra::defaultTransform(Zlib\NativeWikiPage::bbcode($content))));
- $renderedContent = Zlib\NativeWikiPage::convert_links($html, argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
- }
- $showPageControls = $wiki_editor;
+ else {
+ $mimeType = $p['pageMimeType'];
+
+ $sampleContent = (($mimeType == 'text/bbcode') ? '[h3]' . t('New page') . '[/h3]' : '### ' . t('New page'));
+ if($mimeType === 'text/plain')
+ $sampleContent = t('New page');
+
+ $content = (($p['content'] == '') ? $sampleContent : $p['content']);
+
+ // Render the Markdown-formatted page content in HTML
+ if($mimeType == 'text/bbcode') {
+ $renderedContent = Zlib\NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))), argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
+ }
+ elseif($mimeType === 'text/plain') {
+ $renderedContent = str_replace(["\n",' ',"\t"],[EOL,'&nbsp;','&nbsp;&nbsp;&nbsp;&nbsp;'],htmlentities($content,ENT_COMPAT,'UTF-8',false));
+ }
+ elseif($mimeType === 'text/markdown') {
+ $content = Zlib\MarkdownSoap::unescape($content);
+ $html = Zlib\NativeWikiPage::generate_toc(zidify_text(MarkdownExtra::defaultTransform(Zlib\NativeWikiPage::bbcode($content))));
+ $renderedContent = Zlib\NativeWikiPage::convert_links($html, argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
+ }
+ $showPageControls = $wiki_editor;
+ }
break;
// default: // Strip the extraneous URL components
// goaway('/' . argv(0) . '/' . argv(1) . '/' . $wikiUrlName . '/' . $pageUrlName);
@@ -430,11 +442,15 @@ class Wiki extends \Zotlabs\Web\Controller {
goaway('/' . argv(0) . '/' . $nick . '/');
}
$wiki = array();
+
+ // backslashes won't work well in the javascript functions
+ $name = str_replace('\\','',$_POST['wikiName']);
+
// Generate new wiki info from input name
$wiki['postVisible'] = ((intval($_POST['postVisible'])) ? 1 : 0);
- $wiki['rawName'] = $_POST['wikiName'];
- $wiki['htmlName'] = escape_tags($_POST['wikiName']);
- $wiki['urlName'] = urlencode(urlencode($_POST['wikiName']));
+ $wiki['rawName'] = $name;
+ $wiki['htmlName'] = escape_tags($name);
+ $wiki['urlName'] = urlencode(urlencode($name));
$wiki['mimeType'] = $_POST['mimeType'];
$wiki['typelock'] = $_POST['typelock'];
@@ -555,9 +571,14 @@ class Wiki extends \Zotlabs\Web\Controller {
}
$name = $_POST['pageName']; //Get new page name
- if(urlencode(escape_tags($_POST['pageName'])) === '') {
- json_return_and_die(array('message' => 'Error creating page. Invalid name.', 'success' => false));
+
+ // backslashes won't work well in the javascript functions
+ $name = str_replace('\\','',$name);
+
+ if(urlencode(escape_tags($name)) === '') {
+ json_return_and_die(array('message' => 'Error creating page. Invalid name (' . print_r($_POST,true) . ').', 'success' => false));
}
+
$page = Zlib\NativeWikiPage::create_page($owner['channel_id'],$observer_hash, $name, $resource_id, $mimetype);
if($page['item_id']) {
@@ -626,7 +647,7 @@ class Wiki extends \Zotlabs\Web\Controller {
logger('Wiki write permission denied. ' . EOL);
json_return_and_die(array('success' => false));
}
-
+
$saved = Zlib\NativeWikiPage::save_page(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName, 'content' => $content));
if($saved['success']) {
@@ -758,7 +779,7 @@ class Wiki extends \Zotlabs\Web\Controller {
if ((argc() === 4) && (argv(2) === 'rename') && (argv(3) === 'page')) {
$resource_id = $_POST['resource_id'];
$pageUrlName = $_POST['oldName'];
- $pageNewName = $_POST['newName'];
+ $pageNewName = str_replace('\\','',$_POST['newName']);
if ($pageUrlName === 'Home') {
json_return_and_die(array('message' => 'Cannot rename Home','success' => false));
}
diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php
index 26abf27b5..c21b68971 100644
--- a/Zotlabs/Storage/Browser.php
+++ b/Zotlabs/Storage/Browser.php
@@ -12,7 +12,7 @@ use Sabre\DAV;
*
* @extends \\Sabre\\DAV\\Browser\\Plugin
*
- * @link http://github.com/friendica/red
+ * @link http://github.com/redmatrix/hubzilla
* @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
*/
class Browser extends DAV\Browser\Plugin {
diff --git a/Zotlabs/Widget/Wiki_pages.php b/Zotlabs/Widget/Wiki_pages.php
index 39d4b1717..46f12f092 100644
--- a/Zotlabs/Widget/Wiki_pages.php
+++ b/Zotlabs/Widget/Wiki_pages.php
@@ -5,6 +5,42 @@ namespace Zotlabs\Widget;
class Wiki_pages {
+ function create_missing_page($arr) {
+ if(argc() < 4)
+ return;
+
+ $c = channelx_by_nick(argv(1));
+ $w = \Zotlabs\Lib\NativeWiki::exists_by_name($c['channel_id'],urldecode(argv(2)));
+ $arr = array(
+ 'resource_id' => $w['resource_id'],
+ 'channel_id' => $c['channel_id'],
+ 'channel_address' => $c['channel_address'],
+ 'refresh' => false
+ );
+
+ $can_create = perm_is_allowed(\App::$profile['uid'],get_observer_hash(),'write_wiki');
+
+ $can_delete = ((local_channel() && (local_channel() == \App::$profile['uid'])) ? true : false);
+ $pageName = urlencode(escape_tags(urldecode(argv(3))));
+
+ return replace_macros(get_markup_template('wiki_page_not_found.tpl'), array(
+ '$resource_id' => $arr['resource_id'],
+ '$channel_address' => $arr['channel_address'],
+ '$wikiname' => $wikiname,
+ '$canadd' => $can_create,
+ '$candel' => $can_delete,
+ '$addnew' => t('Add new page'),
+ '$typelock' => $typelock,
+ '$lockedtype' => $w['mimeType'],
+ '$mimetype' => mimetype_select(0,$w['mimeType'],
+ [ 'text/markdown' => t('Markdown'), 'text/bbcode' => t('BBcode'), 'text/plain' => t('Text') ]),
+ '$pageName' => array('missingPageName', 'Create Page' , $pageName),
+ '$refresh' => $arr['refresh'],
+ '$options' => t('Options'),
+ '$submit' => t('Submit')
+ ));
+ }
+
function widget($arr) {
if(argc() < 3)
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index 33536dee4..5728d7948 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -1728,32 +1728,33 @@ dl.bb-dl > dd > li {
.cloud-container {
float: left;
- width: 80px;
- height: 80px;
+ width: 100px;
+ height: 110px;
margin: 5px;
}
.cloud-icon-container {
- width: 48px;
- height: 48px;
+ width: 64px;
+ height: 64px;
border: 1px solid #eee;
border-radius: $radius;
}
.cloud-icon i {
- font-size: 32px;
+ font-size: 42px;
color: #888;
margin-top: 8px;
+ margin-left: 6px;
}
.cloud-icon img {
- width: 48px;
- height: 48px;
+ max-width: 64px;
+ max-height: 64px;
border-radius: $radius;
}
.cloud-title {
- width: 78px;
+ width: 98px;
height: 36px;
overflow: hidden;
}
diff --git a/view/tpl/build_query.tpl b/view/tpl/build_query.tpl
index bfe5c8a08..1d938d395 100755
--- a/view/tpl/build_query.tpl
+++ b/view/tpl/build_query.tpl
@@ -1,6 +1,6 @@
<script>
- var bParam_cmd = "{{$baseurl}}/update_{{$pgtype}}";
+ var bParam_cmd = "{{$baseurl}}/update/{{$pgtype}}";
var bParam_uid = {{$uid}};
diff --git a/view/tpl/wiki_page_not_found.tpl b/view/tpl/wiki_page_not_found.tpl
new file mode 100644
index 000000000..de98efdf8
--- /dev/null
+++ b/view/tpl/wiki_page_not_found.tpl
@@ -0,0 +1,34 @@
+ <h3>Page does not exist</h3>
+ <br /><br /><br />
+ {{if $canadd}}
+ <form id="new-page-form" action="wiki/{{$channel_address}}/create/page" method="post" >
+ <input type="hidden" name="resource_id" value="{{$resource_id}}">
+ {{include file="field_input.tpl" field=$pageName}}
+ {{if $typelock}}
+ <input id="id_mimetype" type="hidden" name="mimetype" value="{{$lockedtype}}">
+ {{else}}
+ <div id="wiki_missing_page_options" style="display: none">
+ {{$mimetype}}
+ </div>
+ <div class="float-right fakelink" onClick="openClose('wiki_missing_page_options')">
+ {{$options}}
+ </div>
+ {{/if}}
+ <button id="create-missing-page-submit" class="btn btn-primary" type="submit" name="submit" >{{$submit}}</button>
+ </form>
+
+<script>
+ $('#create-missing-page-submit').click(function (ev) {
+ $.post("wiki/{{$channel_address}}/create/page", {pageName: $('#id_missingPageName').val(), resource_id: window.wiki_resource_id, mimetype: $('#id_mimetype').val() },
+ function(data) {
+ if(data.success) {
+ window.location = data.url;
+ } else {
+ window.console.log('Error creating page. ('+data.message+')');
+ }
+ }, 'json');
+ ev.preventDefault();
+ });
+
+</script>
+{{/if}}