Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
This commit is contained in:
commit
e5653945d3
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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');
|
||||
|
43
Zotlabs/Module/Update.php
Normal file
43
Zotlabs/Module/Update.php
Normal file
@ -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();
|
||||
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
else {
|
||||
$mimeType = $p['pageMimeType'];
|
||||
|
||||
$mimeType = $p['pageMimeType'];
|
||||
$sampleContent = (($mimeType == 'text/bbcode') ? '[h3]' . t('New page') . '[/h3]' : '### ' . t('New page'));
|
||||
if($mimeType === 'text/plain')
|
||||
$sampleContent = t('New page');
|
||||
|
||||
$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,' ',' '],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;
|
||||
$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,' ',' '],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));
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script>
|
||||
|
||||
var bParam_cmd = "{{$baseurl}}/update_{{$pgtype}}";
|
||||
var bParam_cmd = "{{$baseurl}}/update/{{$pgtype}}";
|
||||
|
||||
|
||||
var bParam_uid = {{$uid}};
|
||||
|
34
view/tpl/wiki_page_not_found.tpl
Normal file
34
view/tpl/wiki_page_not_found.tpl
Normal file
@ -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}}
|
Reference in New Issue
Block a user