From 02cf7274d28d093094067114d208537cf135266b Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Sat, 22 Oct 2016 08:52:26 -0400 Subject: Add wiki download button to export the selected wiki repo to a zip file --- Zotlabs/Module/Wiki.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index bb4e9179c..8cf106b33 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -90,6 +90,35 @@ class Wiki extends \Zotlabs\Web\Controller { // Not the channel owner $channel_acl = $x = array(); } + + // Download a wiki + if ((argc() > 3) && (argv(2) === 'download') && (argv(3) === 'wiki')) { + $resource_id = argv(4); + $w = wiki_get_wiki($resource_id); + if (!$w['path']) { + notice('Error retrieving wiki' . EOL); + } + $zip_folder_name = random_string(10); + $zip_folderpath = '/tmp/' . $zip_folder_name; + if (!mkdir($zip_folderpath, 0770, false)) { + logger('Error creating zip file export folder: ' . $zip_folderpath, LOGGER_NORMAL); + notice('Error creating zip file export folder' . EOL); + } + $zip_filename = $w['urlName']; + $zip_filepath = '/tmp/' . $zip_folder_name . '/' . $zip_filename; + // Generate the zip file + \Zotlabs\Lib\ExtendedZip::zipTree($w['path'], $zip_filepath, \ZipArchive::CREATE); + // Output the file for download + header('Content-disposition: attachment; filename="' . $zip_filename . '.zip"'); + header("Content-Type: application/zip"); + $success = readfile($zip_filepath); + if ($success) { + rrmdir($zip_folderpath); // delete temporary files + } else { + rrmdir($zip_folderpath); // delete temporary files + logger('Error downloading wiki: ' . $resource_id); + } + } switch (argc()) { case 2: @@ -297,6 +326,7 @@ class Wiki extends \Zotlabs\Web\Controller { } } + // Create a page if ((argc() === 4) && (argv(2) === 'create') && (argv(3) === 'page')) { $nick = argv(1); -- cgit v1.2.3 From 74947d1c1cb7c669ef2a167990066b34d89b5b07 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 8 Nov 2016 18:15:57 -0800 Subject: deprecate/remove get_channel_by_nick() which is just a less generalised variant of channelx_by_nick() --- Zotlabs/Module/Wiki.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 8cf106b33..aaa1f1e3d 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -54,7 +54,7 @@ class Wiki extends \Zotlabs\Web\Controller { // init() should have forced the URL to redirect to /wiki/channel so assume argc() > 1 $nick = argv(1); - $channel = get_channel_by_nick($nick); // The channel who owns the wikis being viewed + $channel = channelx_by_nick($nick); // The channel who owns the wikis being viewed if(! $channel) { notice('Invalid channel' . EOL); goaway('/' . argv(0)); @@ -271,7 +271,7 @@ class Wiki extends \Zotlabs\Web\Controller { // /wiki/channel/create/wiki if ((argc() > 3) && (argv(2) === 'create') && (argv(3) === 'wiki')) { $nick = argv(1); - $channel = get_channel_by_nick($nick); + $channel = channelx_by_nick($nick); // Determine if observer has permission to create wiki $observer_hash = get_observer_hash(); // Only the channel owner can create a wiki, at least until we create a @@ -309,7 +309,7 @@ class Wiki extends \Zotlabs\Web\Controller { // Delete a wiki if ((argc() > 3) && (argv(2) === 'delete') && (argv(3) === 'wiki')) { $nick = argv(1); - $channel = get_channel_by_nick($nick); + $channel = channelx_by_nick($nick); // Only the channel owner can delete a wiki, at least until we create a // more detail permissions framework if (local_channel() !== intval($channel['channel_id'])) { @@ -332,7 +332,7 @@ class Wiki extends \Zotlabs\Web\Controller { $nick = argv(1); $resource_id = $_POST['resource_id']; // Determine if observer has permission to create a page - $channel = get_channel_by_nick($nick); + $channel = channelx_by_nick($nick); if (local_channel() !== intval($channel['channel_id'])) { $observer_hash = get_observer_hash(); $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); @@ -357,7 +357,7 @@ class Wiki extends \Zotlabs\Web\Controller { // Fetch page list for a wiki if ((argc() === 5) && (argv(2) === 'get') && (argv(3) === 'page') && (argv(4) === 'list')) { $resource_id = $_POST['resource_id']; // resource_id for wiki in db - $channel = get_channel_by_nick(argv(1)); + $channel = channelx_by_nick(argv(1)); $observer_hash = get_observer_hash(); if (local_channel() !== intval($channel['channel_id'])) { $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); @@ -385,7 +385,7 @@ class Wiki extends \Zotlabs\Web\Controller { $commitMsg = 'Updated ' . $pageHtmlName; } $nick = argv(1); - $channel = get_channel_by_nick($nick); + $channel = channelx_by_nick($nick); // Determine if observer has permission to save content if (local_channel() !== intval($channel['channel_id'])) { $observer_hash = get_observer_hash(); @@ -423,7 +423,7 @@ class Wiki extends \Zotlabs\Web\Controller { $pageUrlName = $_POST['name']; $nick = argv(1); - $channel = get_channel_by_nick($nick); + $channel = channelx_by_nick($nick); // Determine if observer has permission to read content if (local_channel() !== intval($channel['channel_id'])) { $observer_hash = get_observer_hash(); @@ -449,7 +449,7 @@ class Wiki extends \Zotlabs\Web\Controller { } // Determine if observer has permission to delete pages $nick = argv(1); - $channel = get_channel_by_nick($nick); + $channel = channelx_by_nick($nick); if (local_channel() !== intval($channel['channel_id'])) { $observer_hash = get_observer_hash(); $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); @@ -484,7 +484,7 @@ class Wiki extends \Zotlabs\Web\Controller { $commitHash = $_POST['commitHash']; // Determine if observer has permission to revert pages $nick = argv(1); - $channel = get_channel_by_nick($nick); + $channel = channelx_by_nick($nick); if (local_channel() !== intval($channel['channel_id'])) { $observer_hash = get_observer_hash(); $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); @@ -509,7 +509,7 @@ class Wiki extends \Zotlabs\Web\Controller { $currentCommit = $_POST['currentCommit']; // Determine if observer has permission to revert pages $nick = argv(1); - $channel = get_channel_by_nick($nick); + $channel = channelx_by_nick($nick); if (local_channel() !== intval($channel['channel_id'])) { $observer_hash = get_observer_hash(); $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); @@ -540,7 +540,7 @@ class Wiki extends \Zotlabs\Web\Controller { } // Determine if observer has permission to rename pages $nick = argv(1); - $channel = get_channel_by_nick($nick); + $channel = channelx_by_nick($nick); if (local_channel() !== intval($channel['channel_id'])) { $observer_hash = get_observer_hash(); $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); -- cgit v1.2.3 From af11525338d185fcbb586d8cb8ef0028946c8230 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Sat, 12 Nov 2016 14:42:21 -0500 Subject: Moved save to bottom. Created Wiki Tools dropdown to be consistent, moved page tools in there as well as new page and new wiki --- Zotlabs/Module/Wiki.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index aaa1f1e3d..b73244a1c 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -211,6 +211,8 @@ class Wiki extends \Zotlabs\Web\Controller { '$wikiheaderPage' => $wikiheaderPage, '$hideEditor' => $hide_editor, '$showPageControls' => $showPageControls, + '$tools_label' => 'Wiki Tools', + '$showTools' => $showNewWikiButton || $showNewPageButton, '$showNewWikiButton'=> $showNewWikiButton, '$showNewPageButton'=> $showNewPageButton, '$hidePageHistory' => $hidePageHistory, -- cgit v1.2.3 From 7763643f2e55c82af97d5db5315f051ed9cc6090 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 13 Nov 2016 15:06:16 -0800 Subject: zidify wiki content --- Zotlabs/Module/Wiki.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index b73244a1c..68731e852 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -177,7 +177,7 @@ class Wiki extends \Zotlabs\Web\Controller { $content = ($p['content'] !== '' ? htmlspecialchars_decode($p['content'],ENT_COMPAT) : '"# New page\n"'); // Render the Markdown-formatted page content in HTML require_once('library/markdown.php'); - $html = wiki_generate_toc(purify_html(Markdown(wiki_bbcode(json_decode($content))))); + $html = wiki_generate_toc(zidify_text(purify_html(Markdown(wiki_bbcode(json_decode($content)))))); $renderedContent = wiki_convert_links($html,argv(0).'/'.argv(1).'/'.$wikiUrlName); $hide_editor = false; $showPageControls = $wiki_editor; @@ -262,7 +262,7 @@ class Wiki extends \Zotlabs\Web\Controller { $resource_id = $_POST['resource_id']; require_once('library/markdown.php'); $content = wiki_bbcode($content); - $html = wiki_generate_toc(purify_html(Markdown($content))); + $html = wiki_generate_toc(zidify_text(purify_html(Markdown($content)))); $w = wiki_get_wiki($resource_id); $wikiURL = argv(0).'/'.argv(1).'/'.$w['urlName']; $html = wiki_convert_links($html,$wikiURL); -- cgit v1.2.3 From c3e3c32bdcdbcafef33f32118fe95da1fa4cd92e Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Mon, 14 Nov 2016 20:45:04 -0500 Subject: Moved delete wiki button into new edit wiki form, opened by edit wiki icon in wiki list --- Zotlabs/Module/Wiki.php | 1 - 1 file changed, 1 deletion(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 68731e852..9fd1234e3 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -212,7 +212,6 @@ class Wiki extends \Zotlabs\Web\Controller { '$hideEditor' => $hide_editor, '$showPageControls' => $showPageControls, '$tools_label' => 'Wiki Tools', - '$showTools' => $showNewWikiButton || $showNewPageButton, '$showNewWikiButton'=> $showNewWikiButton, '$showNewPageButton'=> $showNewPageButton, '$hidePageHistory' => $hidePageHistory, -- cgit v1.2.3 From 501bd814c3a057684b102bc4c6cb8e0b7403debd Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 15 Nov 2016 18:43:26 -0800 Subject: wiki: simplify permission model, reduce duplicate calls to get the same channel info and permissions, return the owner permissions with the normal permission check (keeping all permission fetching in one place), rename the 'channel' variable to 'owner' in several places to identify this channel role more clearly as to the way it is being used in this module, update the deprecated call to proc_run (include/notifier) and make several notice messages translatable. --- Zotlabs/Module/Wiki.php | 217 +++++++++++++++++++++++------------------------- 1 file changed, 102 insertions(+), 115 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 9fd1234e3..edcd6ec58 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -54,41 +54,41 @@ class Wiki extends \Zotlabs\Web\Controller { // init() should have forced the URL to redirect to /wiki/channel so assume argc() > 1 $nick = argv(1); - $channel = channelx_by_nick($nick); // The channel who owns the wikis being viewed - if(! $channel) { - notice('Invalid channel' . EOL); + $owner = channelx_by_nick($nick); // The channel who owns the wikis being viewed + if(! $owner) { + notice( t('Invalid channel') . EOL); goaway('/' . argv(0)); } // Determine if the observer is the channel owner so the ACL dialog can be populated - if (local_channel() === intval($channel['channel_id'])) { - $local_observer = \App::get_channel(); + if (local_channel() === intval($owner['channel_id'])) { + $wiki_owner = true; // Obtain the default permission settings of the channel - $channel_acl = array( - 'allow_cid' => $local_observer['channel_allow_cid'], - 'allow_gid' => $local_observer['channel_allow_gid'], - 'deny_cid' => $local_observer['channel_deny_cid'], - 'deny_gid' => $local_observer['channel_deny_gid'] + $owner_acl = array( + 'allow_cid' => $owner['channel_allow_cid'], + 'allow_gid' => $owner['channel_allow_gid'], + 'deny_cid' => $owner['channel_deny_cid'], + 'deny_gid' => $owner['channel_deny_gid'] ); // Initialize the ACL to the channel default permissions $x = array( - 'lockstate' => (( $local_observer['channel_allow_cid'] || - $local_observer['channel_allow_gid'] || - $local_observer['channel_deny_cid'] || - $local_observer['channel_deny_gid']) + 'lockstate' => (( $owner['channel_allow_cid'] || + $owner['channel_allow_gid'] || + $owner['channel_deny_cid'] || + $owner['channel_deny_gid']) ? 'lock' : 'unlock' ), - 'acl' => populate_acl($channel_acl), - 'allow_cid' => acl2json($channel_acl['allow_cid']), - 'allow_gid' => acl2json($channel_acl['allow_gid']), - 'deny_cid' => acl2json($channel_acl['deny_cid']), - 'deny_gid' => acl2json($channel_acl['deny_gid']), + 'acl' => populate_acl($owner_acl), + 'allow_cid' => acl2json($owner_acl['allow_cid']), + 'allow_gid' => acl2json($owner_acl['allow_gid']), + 'deny_cid' => acl2json($owner_acl['deny_cid']), + 'deny_gid' => acl2json($owner_acl['deny_gid']), 'bang' => '' ); } else { // Not the channel owner - $channel_acl = $x = array(); + $owner_acl = $x = array(); } // Download a wiki @@ -96,13 +96,13 @@ class Wiki extends \Zotlabs\Web\Controller { $resource_id = argv(4); $w = wiki_get_wiki($resource_id); if (!$w['path']) { - notice('Error retrieving wiki' . EOL); + notice(t('Error retrieving wiki') . EOL); } $zip_folder_name = random_string(10); $zip_folderpath = '/tmp/' . $zip_folder_name; if (!mkdir($zip_folderpath, 0770, false)) { logger('Error creating zip file export folder: ' . $zip_folderpath, LOGGER_NORMAL); - notice('Error creating zip file export folder' . EOL); + notice(t('Error creating zip file export folder') . EOL); } $zip_filename = $w['urlName']; $zip_filepath = '/tmp/' . $zip_folder_name . '/' . $zip_filename; @@ -144,9 +144,9 @@ class Wiki extends \Zotlabs\Web\Controller { // Fetch the wiki info and determine observer permissions $wikiUrlName = urlencode(argv(2)); $pageUrlName = urlencode(argv(3)); - $w = wiki_exists_by_name($channel['channel_id'], $wikiUrlName); + $w = wiki_exists_by_name($owner['channel_id'], $wikiUrlName); if(!$w['resource_id']) { - notice('Wiki not found' . EOL); + notice(t('Wiki not found') . EOL); goaway('/'.argv(0).'/'.argv(1)); } $resource_id = $w['resource_id']; @@ -154,9 +154,9 @@ class Wiki extends \Zotlabs\Web\Controller { if (!$wiki_owner) { // Check for observer permissions $observer_hash = get_observer_hash(); - $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); + $perms = wiki_get_permissions($resource_id, intval($owner['channel_id']), $observer_hash); if(!$perms['read']) { - notice('Permission denied.' . EOL); + notice(t('Permission denied.') . EOL); goaway('/'.argv(0).'/'.argv(1)); } if($perms['write']) { @@ -171,7 +171,7 @@ class Wiki extends \Zotlabs\Web\Controller { $wikiheaderPage = urldecode($pageUrlName); $p = wiki_get_page_content(array('resource_id' => $resource_id, 'pageUrlName' => $pageUrlName)); if(!$p['success']) { - notice('Error retrieving page content' . EOL); + notice(t('Error retrieving page content') . EOL); goaway('/'.argv(0).'/'.argv(1).'/'.$wikiUrlName); } $content = ($p['content'] !== '' ? htmlspecialchars_decode($p['content'],ENT_COMPAT) : '"# New page\n"'); @@ -216,7 +216,7 @@ class Wiki extends \Zotlabs\Web\Controller { '$showNewPageButton'=> $showNewPageButton, '$hidePageHistory' => $hidePageHistory, '$showCommitMsg' => $showCommitMsg, - '$channel' => $channel['channel_address'], + '$channel' => $owner['channel_address'], '$resource_id' => $resource_id, '$page' => $pageUrlName, '$lockstate' => $x['lockstate'], @@ -253,6 +253,16 @@ class Wiki extends \Zotlabs\Web\Controller { function post() { require_once('include/wiki.php'); + + $nick = argv(1); + $owner = channelx_by_nick($nick); + $observer_hash = get_observer_hash(); + + if(! $owner) { + notice( t('Permission denied.') . EOL); + return; + } + // /wiki/channel/preview // Render mardown-formatted text in HTML for preview @@ -271,15 +281,14 @@ class Wiki extends \Zotlabs\Web\Controller { // Create a new wiki // /wiki/channel/create/wiki if ((argc() > 3) && (argv(2) === 'create') && (argv(3) === 'wiki')) { - $nick = argv(1); - $channel = channelx_by_nick($nick); - // Determine if observer has permission to create wiki - $observer_hash = get_observer_hash(); + // Only the channel owner can create a wiki, at least until we create a // more detail permissions framework - if (local_channel() !== intval($channel['channel_id'])) { - goaway('/'.argv(0).'/'.$nick.'/'); + + if (local_channel() !== intval($owner['channel_id'])) { + goaway('/' . argv(0) . '/' . $nick . '/'); } + $wiki = array(); // Generate new wiki info from input name $wiki['postVisible'] = ((intval($_POST['postVisible']) === 0) ? 0 : 1); @@ -287,34 +296,33 @@ class Wiki extends \Zotlabs\Web\Controller { $wiki['htmlName'] = escape_tags($_POST['wikiName']); $wiki['urlName'] = urlencode($_POST['wikiName']); if($wiki['urlName'] === '') { - notice('Error creating wiki. Invalid name.'); + notice( t('Error creating wiki. Invalid name.') . EOL); goaway('/wiki'); } // Get ACL for permissions - $acl = new \Zotlabs\Access\AccessList($channel); + $acl = new \Zotlabs\Access\AccessList($owner); $acl->set_from_array($_POST); - $r = wiki_create_wiki($channel, $observer_hash, $wiki, $acl); + $r = wiki_create_wiki($owner, $observer_hash, $wiki, $acl); if ($r['success']) { $homePage = wiki_create_page('Home', $r['item']['resource_id']); if(!$homePage['success']) { - notice('Wiki created, but error creating Home page.'); + notice( t('Wiki created, but error creating Home page.')); goaway('/wiki/'.$nick.'/'.$wiki['urlName']); } goaway('/wiki/'.$nick.'/'.$wiki['urlName'].'/'.$homePage['page']['urlName']); } else { - notice('Error creating wiki'); + notice(t('Error creating wiki')); goaway('/wiki'); } } // Delete a wiki if ((argc() > 3) && (argv(2) === 'delete') && (argv(3) === 'wiki')) { - $nick = argv(1); - $channel = channelx_by_nick($nick); + // Only the channel owner can delete a wiki, at least until we create a // more detail permissions framework - if (local_channel() !== intval($channel['channel_id'])) { - logger('Wiki delete permission denied.' . EOL); + if (local_channel() !== intval($owner['channel_id'])) { + logger('Wiki delete permission denied.'); json_return_and_die(array('message' => 'Wiki delete permission denied.', 'success' => false)); } $resource_id = $_POST['resource_id']; @@ -330,18 +338,17 @@ class Wiki extends \Zotlabs\Web\Controller { // Create a page if ((argc() === 4) && (argv(2) === 'create') && (argv(3) === 'page')) { - $nick = argv(1); + $resource_id = $_POST['resource_id']; // Determine if observer has permission to create a page - $channel = channelx_by_nick($nick); - if (local_channel() !== intval($channel['channel_id'])) { - $observer_hash = get_observer_hash(); - $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); - if(!$perms['write']) { - logger('Wiki write permission denied. ' . EOL); - json_return_and_die(array('success' => false)); - } + + + $perms = wiki_get_permissions($resource_id, intval($owner['channel_id']), $observer_hash); + if(!$perms['write']) { + logger('Wiki write permission denied. ' . EOL); + json_return_and_die(array('success' => false)); } + $name = $_POST['name']; //Get new page name if(urlencode(escape_tags($_POST['name'])) === '') { json_return_and_die(array('message' => 'Error creating page. Invalid name.', 'success' => false)); @@ -358,15 +365,13 @@ class Wiki extends \Zotlabs\Web\Controller { // Fetch page list for a wiki if ((argc() === 5) && (argv(2) === 'get') && (argv(3) === 'page') && (argv(4) === 'list')) { $resource_id = $_POST['resource_id']; // resource_id for wiki in db - $channel = channelx_by_nick(argv(1)); - $observer_hash = get_observer_hash(); - if (local_channel() !== intval($channel['channel_id'])) { - $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); - if(!$perms['read']) { - logger('Wiki read permission denied.' . EOL); - json_return_and_die(array('pages' => null, 'message' => 'Permission denied.', 'success' => false)); - } + + $perms = wiki_get_permissions($resource_id, intval($owner['channel_id']), $observer_hash); + if(!$perms['read']) { + logger('Wiki read permission denied.' . EOL); + json_return_and_die(array('pages' => null, 'message' => 'Permission denied.', 'success' => false)); } + $page_list_html = widget_wiki_pages(array( 'resource_id' => $resource_id, 'refresh' => true, @@ -385,16 +390,12 @@ class Wiki extends \Zotlabs\Web\Controller { if ($commitMsg === '') { $commitMsg = 'Updated ' . $pageHtmlName; } - $nick = argv(1); - $channel = channelx_by_nick($nick); + // Determine if observer has permission to save content - if (local_channel() !== intval($channel['channel_id'])) { - $observer_hash = get_observer_hash(); - $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); - if(!$perms['write']) { - logger('Wiki write permission denied. ' . EOL); - json_return_and_die(array('success' => false)); - } + $perms = wiki_get_permissions($resource_id, intval($owner['channel_id']), $observer_hash); + if(!$perms['write']) { + logger('Wiki write permission denied. ' . EOL); + json_return_and_die(array('success' => false)); } $saved = wiki_save_page(array('resource_id' => $resource_id, 'pageUrlName' => $pageUrlName, 'content' => $content)); @@ -423,17 +424,15 @@ class Wiki extends \Zotlabs\Web\Controller { $resource_id = $_POST['resource_id']; $pageUrlName = $_POST['name']; - $nick = argv(1); - $channel = channelx_by_nick($nick); + // Determine if observer has permission to read content - if (local_channel() !== intval($channel['channel_id'])) { - $observer_hash = get_observer_hash(); - $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); - if(!$perms['read']) { - logger('Wiki read permission denied.' . EOL); - json_return_and_die(array('historyHTML' => '', 'message' => 'Permission denied.', 'success' => false)); - } + + $perms = wiki_get_permissions($resource_id, intval($owner['channel_id']), $observer_hash); + if(!$perms['read']) { + logger('Wiki read permission denied.' . EOL); + json_return_and_die(array('historyHTML' => '', 'message' => 'Permission denied.', 'success' => false)); } + $historyHTML = widget_wiki_page_history(array( 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName @@ -449,16 +448,13 @@ class Wiki extends \Zotlabs\Web\Controller { json_return_and_die(array('message' => 'Cannot delete Home','success' => false)); } // Determine if observer has permission to delete pages - $nick = argv(1); - $channel = channelx_by_nick($nick); - if (local_channel() !== intval($channel['channel_id'])) { - $observer_hash = get_observer_hash(); - $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); - if(!$perms['write']) { - logger('Wiki write permission denied. ' . EOL); - json_return_and_die(array('success' => false)); - } + + $perms = wiki_get_permissions($resource_id, intval($owner['channel_id']), $observer_hash); + if(!$perms['write']) { + logger('Wiki write permission denied. ' . EOL); + json_return_and_die(array('success' => false)); } + $deleted = wiki_delete_page(array('resource_id' => $resource_id, 'pageUrlName' => $pageUrlName)); if($deleted['success']) { $ob = \App::get_observer(); @@ -484,16 +480,13 @@ class Wiki extends \Zotlabs\Web\Controller { $pageUrlName = $_POST['name']; $commitHash = $_POST['commitHash']; // Determine if observer has permission to revert pages - $nick = argv(1); - $channel = channelx_by_nick($nick); - if (local_channel() !== intval($channel['channel_id'])) { - $observer_hash = get_observer_hash(); - $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); - if(!$perms['write']) { - logger('Wiki write permission denied.' . EOL); - json_return_and_die(array('success' => false)); - } + + $perms = wiki_get_permissions($resource_id, intval($owner['channel_id']), $observer_hash); + if(!$perms['write']) { + logger('Wiki write permission denied.' . EOL); + json_return_and_die(array('success' => false)); } + $reverted = wiki_revert_page(array('commitHash' => $commitHash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName)); if($reverted['success']) { json_return_and_die(array('content' => $reverted['content'], 'message' => '', 'success' => true)); @@ -509,16 +502,13 @@ class Wiki extends \Zotlabs\Web\Controller { $compareCommit = $_POST['compareCommit']; $currentCommit = $_POST['currentCommit']; // Determine if observer has permission to revert pages - $nick = argv(1); - $channel = channelx_by_nick($nick); - if (local_channel() !== intval($channel['channel_id'])) { - $observer_hash = get_observer_hash(); - $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); - if(!$perms['read']) { - logger('Wiki read permission denied.' . EOL); - json_return_and_die(array('success' => false)); - } + + $perms = wiki_get_permissions($resource_id, intval($owner['channel_id']), $observer_hash); + if(!$perms['read']) { + logger('Wiki read permission denied.' . EOL); + json_return_and_die(array('success' => false)); } + $compare = wiki_compare_page(array('currentCommit' => $currentCommit, 'compareCommit' => $compareCommit, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName)); if($compare['success']) { $diffHTML = '
Current RevisionSelected Revision
' . $compare['diff']; @@ -540,16 +530,13 @@ class Wiki extends \Zotlabs\Web\Controller { json_return_and_die(array('message' => 'Error renaming page. Invalid name.', 'success' => false)); } // Determine if observer has permission to rename pages - $nick = argv(1); - $channel = channelx_by_nick($nick); - if (local_channel() !== intval($channel['channel_id'])) { - $observer_hash = get_observer_hash(); - $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash); - if(!$perms['write']) { - logger('Wiki write permission denied. ' . EOL); - json_return_and_die(array('success' => false)); - } + + $perms = wiki_get_permissions($resource_id, intval($owner['channel_id']), $observer_hash); + if(!$perms['write']) { + logger('Wiki write permission denied. ' . EOL); + json_return_and_die(array('success' => false)); } + $renamed = wiki_rename_page(array('resource_id' => $resource_id, 'pageUrlName' => $pageUrlName, 'pageNewName' => $pageNewName)); if($renamed['success']) { $ob = \App::get_observer(); @@ -570,7 +557,7 @@ class Wiki extends \Zotlabs\Web\Controller { } } - //notice('You must be authenticated.'); + //notice( t('You must be authenticated.')); json_return_and_die(array('message' => 'You must be authenticated.', 'success' => false)); } -- cgit v1.2.3 From d24e867603fd253ea42050057896422beeba59db Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Fri, 18 Nov 2016 21:55:29 -0500 Subject: Move page list back out to the side menu, but with the new page form below the new page button like the new wiki form. Disable text editing if viewer lacks edit permission, and change the tab label to Source instead of Edit in that case. --- Zotlabs/Module/Wiki.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index edcd6ec58..45a0ab4d6 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -211,6 +211,7 @@ class Wiki extends \Zotlabs\Web\Controller { '$wikiheaderPage' => $wikiheaderPage, '$hideEditor' => $hide_editor, '$showPageControls' => $showPageControls, + '$editOrSourceLabel' => (($showPageControls) ? t('Edit') : t('Source')), '$tools_label' => 'Wiki Tools', '$showNewWikiButton'=> $showNewWikiButton, '$showNewPageButton'=> $showNewPageButton, -- cgit v1.2.3 From 16281c626b7db96e5af3e05179315b4f0dc33d1c Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Fri, 18 Nov 2016 22:10:55 -0500 Subject: Hide all content if no wiki is selected except for a message saying to choose one. --- Zotlabs/Module/Wiki.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 45a0ab4d6..c4fa63673 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -128,7 +128,7 @@ class Wiki extends \Zotlabs\Web\Controller { require_once('library/markdown.php'); $content = t('"# Wiki Sandbox\n\nContent you **edit** and **preview** here *will not be saved*."'); $renderedContent = Markdown(json_decode($content)); - $hide_editor = false; + $hide_editor = true; $showPageControls = false; $showNewWikiButton = $wiki_owner; $showNewPageButton = false; @@ -209,7 +209,8 @@ class Wiki extends \Zotlabs\Web\Controller { $o .= replace_macros(get_markup_template('wiki.tpl'),array( '$wikiheaderName' => $wikiheaderName, '$wikiheaderPage' => $wikiheaderPage, - '$hideEditor' => $hide_editor, + '$hideEditor' => $hide_editor, // True will completely hide the content section and is used for the case of no wiki selected + '$chooseWikiMessage' => t('Choose an available wiki from the list on the left.'), '$showPageControls' => $showPageControls, '$editOrSourceLabel' => (($showPageControls) ? t('Edit') : t('Source')), '$tools_label' => 'Wiki Tools', -- cgit v1.2.3 From 060982adb426e629747d16410d554e0da333172d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 22 Nov 2016 11:30:04 +0100 Subject: display wiki list on wiki landing page. --- Zotlabs/Module/Wiki.php | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index c4fa63673..65d694b12 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -90,7 +90,10 @@ class Wiki extends \Zotlabs\Web\Controller { // Not the channel owner $owner_acl = $x = array(); } - + + $is_owner = ((local_channel()) && (local_channel() == \App::$profile['profile_uid']) ? true : false); + $o = profile_tabs($a, $is_owner, \App::$profile['channel_address']); + // Download a wiki if ((argc() > 3) && (argv(2) === 'download') && (argv(3) === 'wiki')) { $resource_id = argv(4); @@ -122,18 +125,33 @@ class Wiki extends \Zotlabs\Web\Controller { switch (argc()) { case 2: - // Configure page template - $wikiheaderName = t('Wiki'); - $wikiheaderPage = t('Sandbox'); - require_once('library/markdown.php'); - $content = t('"# Wiki Sandbox\n\nContent you **edit** and **preview** here *will not be saved*."'); - $renderedContent = Markdown(json_decode($content)); - $hide_editor = true; - $showPageControls = false; - $showNewWikiButton = $wiki_owner; - $showNewPageButton = false; - $hidePageHistory = true; - $showCommitMsg = false; + $wikis = wiki_list($owner, get_observer_hash()); + if ($wikis) { + $o .= replace_macros(get_markup_template('wikilist.tpl'), array( + '$header' => t('Wikis'), + '$channel' => $owner['channel_address'], + '$wikis' => $wikis['wikis'], + // If the observer is the local channel owner, show the wiki controls + '$owner' => ((local_channel() && local_channel() === intval(\App::$profile['uid'])) ? true : false), + '$edit' => t('Edit'), + '$download' => t('Download'), + '$view' => t('View'), + '$create' => t('Create New'), + '$submit' => t('Submit'), + '$wikiName' => array('wikiName', t('Wiki name')), + '$name' => t('Name'), + '$lockstate' => $x['lockstate'], + '$acl' => $x['acl'], + '$allow_cid' => $x['allow_cid'], + '$allow_gid' => $x['allow_gid'], + '$deny_cid' => $x['deny_cid'], + '$deny_gid' => $x['deny_gid'], + '$notify' => array('postVisible', t('Create a status post for this wiki'), '', '', array(t('No'), t('Yes'))) + )); + + return $o; + } + break; case 3: // /wiki/channel/wiki -> No page was specified, so redirect to Home.md @@ -201,11 +219,6 @@ class Wiki extends \Zotlabs\Web\Controller { ) ); - $is_owner = ((local_channel()) && (local_channel() == \App::$profile['profile_uid']) ? true : false); - - $o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']); - - $o .= replace_macros(get_markup_template('wiki.tpl'),array( '$wikiheaderName' => $wikiheaderName, '$wikiheaderPage' => $wikiheaderPage, -- cgit v1.2.3 From 2fce010f305a8c86581a51445529267e0bac11ad Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 23 Nov 2016 09:41:10 +0100 Subject: whitespace cleanup --- Zotlabs/Module/Wiki.php | 50 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 65d694b12..ed9f7ad06 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -96,31 +96,31 @@ class Wiki extends \Zotlabs\Web\Controller { // Download a wiki if ((argc() > 3) && (argv(2) === 'download') && (argv(3) === 'wiki')) { - $resource_id = argv(4); - $w = wiki_get_wiki($resource_id); - if (!$w['path']) { - notice(t('Error retrieving wiki') . EOL); - } - $zip_folder_name = random_string(10); - $zip_folderpath = '/tmp/' . $zip_folder_name; - if (!mkdir($zip_folderpath, 0770, false)) { - logger('Error creating zip file export folder: ' . $zip_folderpath, LOGGER_NORMAL); - notice(t('Error creating zip file export folder') . EOL); - } - $zip_filename = $w['urlName']; - $zip_filepath = '/tmp/' . $zip_folder_name . '/' . $zip_filename; - // Generate the zip file - \Zotlabs\Lib\ExtendedZip::zipTree($w['path'], $zip_filepath, \ZipArchive::CREATE); - // Output the file for download - header('Content-disposition: attachment; filename="' . $zip_filename . '.zip"'); - header("Content-Type: application/zip"); - $success = readfile($zip_filepath); - if ($success) { - rrmdir($zip_folderpath); // delete temporary files - } else { - rrmdir($zip_folderpath); // delete temporary files - logger('Error downloading wiki: ' . $resource_id); - } + $resource_id = argv(4); + $w = wiki_get_wiki($resource_id); + if (!$w['path']) { + notice(t('Error retrieving wiki') . EOL); + } + $zip_folder_name = random_string(10); + $zip_folderpath = '/tmp/' . $zip_folder_name; + if (!mkdir($zip_folderpath, 0770, false)) { + logger('Error creating zip file export folder: ' . $zip_folderpath, LOGGER_NORMAL); + notice(t('Error creating zip file export folder') . EOL); + } + $zip_filename = $w['urlName']; + $zip_filepath = '/tmp/' . $zip_folder_name . '/' . $zip_filename; + // Generate the zip file + \Zotlabs\Lib\ExtendedZip::zipTree($w['path'], $zip_filepath, \ZipArchive::CREATE); + // Output the file for download + header('Content-disposition: attachment; filename="' . $zip_filename . '.zip"'); + header("Content-Type: application/zip"); + $success = readfile($zip_filepath); + if ($success) { + rrmdir($zip_folderpath); // delete temporary files + } else { + rrmdir($zip_folderpath); // delete temporary files + logger('Error downloading wiki: ' . $resource_id); + } } switch (argc()) { -- cgit v1.2.3 From 69e1f6e4ba9b3f33ab9b93541fdd68d0f5d6d01a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 23 Nov 2016 09:47:10 +0100 Subject: whitespace and coding style --- Zotlabs/Module/Wiki.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index ed9f7ad06..53c267a93 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -95,30 +95,39 @@ class Wiki extends \Zotlabs\Web\Controller { $o = profile_tabs($a, $is_owner, \App::$profile['channel_address']); // Download a wiki - if ((argc() > 3) && (argv(2) === 'download') && (argv(3) === 'wiki')) { + if((argc() > 3) && (argv(2) === 'download') && (argv(3) === 'wiki')) { + $resource_id = argv(4); + $w = wiki_get_wiki($resource_id); - if (!$w['path']) { - notice(t('Error retrieving wiki') . EOL); + if(!$w['path']) { + notice(t('Error retrieving wiki') . EOL); } + $zip_folder_name = random_string(10); $zip_folderpath = '/tmp/' . $zip_folder_name; - if (!mkdir($zip_folderpath, 0770, false)) { + if(!mkdir($zip_folderpath, 0770, false)) { logger('Error creating zip file export folder: ' . $zip_folderpath, LOGGER_NORMAL); notice(t('Error creating zip file export folder') . EOL); } + $zip_filename = $w['urlName']; $zip_filepath = '/tmp/' . $zip_folder_name . '/' . $zip_filename; + // Generate the zip file \Zotlabs\Lib\ExtendedZip::zipTree($w['path'], $zip_filepath, \ZipArchive::CREATE); + // Output the file for download header('Content-disposition: attachment; filename="' . $zip_filename . '.zip"'); header("Content-Type: application/zip"); + $success = readfile($zip_filepath); - if ($success) { - rrmdir($zip_folderpath); // delete temporary files - } else { - rrmdir($zip_folderpath); // delete temporary files + + if($success) { + rrmdir($zip_folderpath); // delete temporary files + } + else { + rrmdir($zip_folderpath); // delete temporary files logger('Error downloading wiki: ' . $resource_id); } } -- cgit v1.2.3 From f76046b6120aec97f96eef8e83b603cc0a54438e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 23 Nov 2016 10:28:37 +0100 Subject: silence headers already sent warning. issue #596 --- Zotlabs/Module/Wiki.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 53c267a93..a73364b06 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -118,18 +118,21 @@ class Wiki extends \Zotlabs\Web\Controller { \Zotlabs\Lib\ExtendedZip::zipTree($w['path'], $zip_filepath, \ZipArchive::CREATE); // Output the file for download + header('Content-disposition: attachment; filename="' . $zip_filename . '.zip"'); - header("Content-Type: application/zip"); + header('Content-Type: application/zip'); $success = readfile($zip_filepath); - if($success) { - rrmdir($zip_folderpath); // delete temporary files - } - else { - rrmdir($zip_folderpath); // delete temporary files + if(!$success) { logger('Error downloading wiki: ' . $resource_id); + notice(t('Error downloading wiki: ' . $resource_id) . EOL); } + + // delete temporary files + rrmdir($zip_folderpath); + killme(); + } switch (argc()) { -- cgit v1.2.3 From 6cf8ca5e43a693b6e0d7d2c410037505dc4cb6cf Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 23 Nov 2016 13:38:27 +0100 Subject: whitespace and minor fixes --- Zotlabs/Module/Wiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index a73364b06..0c848bc7c 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -258,7 +258,7 @@ class Wiki extends \Zotlabs\Web\Controller { '$wikiName' => array('wikiName', t('Enter the name of your new wiki:'), '', ''), '$pageName' => array('pageName', t('Enter the name of the new page:'), '', ''), '$pageRename' => array('pageRename', t('Enter the new name:'), '', ''), - '$commitMsg' => array('commitMsg', '', '', '', '', 'placeholder="(optional) Enter a custom message when saving the page..."'), + '$commitMsg' => array('commitMsg', '', '', '', '', 'placeholder="Short description of your changes (optional)"'), '$pageHistory' => $pageHistory['history'], '$wikiModal' => $wikiModal, '$wikiModalID' => $wikiModalID, -- cgit v1.2.3 From 86002a2f7b51b08880629166c9836b18f7eecf98 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Thu, 24 Nov 2016 18:24:15 -0500 Subject: Make a git commit when a new page is created, recording who created the page. --- Zotlabs/Module/Wiki.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 0c848bc7c..8069afc7c 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -382,7 +382,18 @@ class Wiki extends \Zotlabs\Web\Controller { } $page = wiki_create_page($name, $resource_id); if ($page['success']) { - json_return_and_die(array('url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki']['urlName'].'/'.urlencode($page['page']['urlName']), 'success' => true)); + $ob = \App::get_observer(); + $commit = wiki_git_commit(array( + 'commit_msg' => t('New page created'), + 'resource_id' => $resource_id, + 'observer' => $ob, + 'files' => array($page['page']['urlName'].'.md') + )); + if($commit['success']) { + json_return_and_die(array('url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki']['urlName'].'/'.urlencode($page['page']['urlName']), 'success' => true)); + } else { + json_return_and_die(array('message' => 'Error making git commit','url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki']['urlName'].'/'.urlencode($page['page']['urlName']),'success' => false)); + } } else { logger('Error creating page'); json_return_and_die(array('message' => 'Error creating page.', 'success' => false)); -- cgit v1.2.3 From d8774cda8ed0bec9dbbe8638fd7af5307d569805 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 28 Nov 2016 11:54:36 +0100 Subject: minor cleanup and remove more double encoding --- Zotlabs/Module/Wiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 8069afc7c..37ebe2a38 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -390,7 +390,7 @@ class Wiki extends \Zotlabs\Web\Controller { 'files' => array($page['page']['urlName'].'.md') )); if($commit['success']) { - json_return_and_die(array('url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki']['urlName'].'/'.urlencode($page['page']['urlName']), 'success' => true)); + json_return_and_die(array('url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki']['urlName'].'/'.$page['page']['urlName'], 'success' => true)); } else { json_return_and_die(array('message' => 'Error making git commit','url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki']['urlName'].'/'.urlencode($page['page']['urlName']),'success' => false)); } -- cgit v1.2.3 From f9b732482d1776ba0c8cad593157589189f6bedd Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 28 Nov 2016 15:24:49 +0100 Subject: some basic work for implementing mimetypes for wikis --- Zotlabs/Module/Wiki.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 37ebe2a38..d43b71f92 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -34,10 +34,7 @@ class Wiki extends \Zotlabs\Web\Controller { notice( t('Not found') . EOL); return; } - - $tab = 'wiki'; - - + require_once('include/wiki.php'); require_once('include/acl_selectors.php'); require_once('include/conversation.php'); @@ -151,6 +148,7 @@ class Wiki extends \Zotlabs\Web\Controller { '$create' => t('Create New'), '$submit' => t('Submit'), '$wikiName' => array('wikiName', t('Wiki name')), + '$mimeType' => array('mimeType', t('Content type'), '', '', ['text/markdown' => 'Markdown', 'text/bbcode' => 'BB Code']), '$name' => t('Name'), '$lockstate' => $x['lockstate'], '$acl' => $x['acl'], @@ -322,6 +320,7 @@ class Wiki extends \Zotlabs\Web\Controller { $wiki['rawName'] = $_POST['wikiName']; $wiki['htmlName'] = escape_tags($_POST['wikiName']); $wiki['urlName'] = urlencode($_POST['wikiName']); + $wiki['mimeType'] = $_POST['mimeType']; if($wiki['urlName'] === '') { notice( t('Error creating wiki. Invalid name.') . EOL); goaway('/wiki'); -- cgit v1.2.3 From d184b3fa8674a349b274b69655b8e8c38dab064b Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 29 Nov 2016 10:33:46 +0100 Subject: more work on wiki mimetypes --- Zotlabs/Module/Wiki.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index d43b71f92..edd783a62 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -313,7 +313,6 @@ class Wiki extends \Zotlabs\Web\Controller { if (local_channel() !== intval($owner['channel_id'])) { goaway('/' . argv(0) . '/' . $nick . '/'); } - $wiki = array(); // Generate new wiki info from input name $wiki['postVisible'] = ((intval($_POST['postVisible']) === 0) ? 0 : 1); @@ -321,10 +320,12 @@ class Wiki extends \Zotlabs\Web\Controller { $wiki['htmlName'] = escape_tags($_POST['wikiName']); $wiki['urlName'] = urlencode($_POST['wikiName']); $wiki['mimeType'] = $_POST['mimeType']; + if($wiki['urlName'] === '') { notice( t('Error creating wiki. Invalid name.') . EOL); goaway('/wiki'); } + // Get ACL for permissions $acl = new \Zotlabs\Access\AccessList($owner); $acl->set_from_array($_POST); @@ -386,7 +387,7 @@ class Wiki extends \Zotlabs\Web\Controller { 'commit_msg' => t('New page created'), 'resource_id' => $resource_id, 'observer' => $ob, - 'files' => array($page['page']['urlName'].'.md') + 'files' => array($page['page']['fileName']) )); if($commit['success']) { json_return_and_die(array('url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki']['urlName'].'/'.$page['page']['urlName'], 'success' => true)); @@ -442,7 +443,7 @@ class Wiki extends \Zotlabs\Web\Controller { 'commit_msg' => $commitMsg, 'resource_id' => $resource_id, 'observer' => $ob, - 'files' => array($pageUrlName.'.md') + 'files' => array($saved['fileName']) )); if($commit['success']) { json_return_and_die(array('message' => 'Wiki git repo commit made', 'success' => true)); @@ -581,7 +582,7 @@ class Wiki extends \Zotlabs\Web\Controller { 'commit_msg' => 'Renamed ' . urldecode($pageUrlName) . ' to ' . $renamed['page']['htmlName'], 'resource_id' => $resource_id, 'observer' => $ob, - 'files' => array($pageUrlName . '.md', $renamed['page']['fileName']), + 'files' => array($pageUrlName . substr($renamed['page']['fileName'], -3), $renamed['page']['fileName']), 'all' => true )); if($commit['success']) { -- cgit v1.2.3 From afffbb6487d8dc1806767ed2b2728ab56bf06669 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 30 Nov 2016 13:30:50 +0100 Subject: go live with wiki mimetypes - you can now choose if a wiki will contain markdown or bb-code markup --- Zotlabs/Module/Wiki.php | 51 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index edd783a62..c4cc72ae8 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -202,11 +202,20 @@ class Wiki extends \Zotlabs\Web\Controller { notice(t('Error retrieving page content') . EOL); goaway('/'.argv(0).'/'.argv(1).'/'.$wikiUrlName); } - $content = ($p['content'] !== '' ? htmlspecialchars_decode($p['content'],ENT_COMPAT) : '"# New page\n"'); + + $mimeType = $p['mimeType']; + + $rawContent = $p['mimeType'] == 'text/bbcode' ? htmlspecialchars_decode(json_decode($p['content']),ENT_COMPAT) : htmlspecialchars_decode($p['content'],ENT_COMPAT); + $content = ($p['content'] !== '' ? $rawContent : '"# New page\n"'); // Render the Markdown-formatted page content in HTML - require_once('library/markdown.php'); - $html = wiki_generate_toc(zidify_text(purify_html(Markdown(wiki_bbcode(json_decode($content)))))); - $renderedContent = wiki_convert_links($html,argv(0).'/'.argv(1).'/'.$wikiUrlName); + if($mimeType == 'text/bbcode') { + $renderedContent = purify_html(bbcode($content)); + } + else { + require_once('library/markdown.php'); + $html = wiki_generate_toc(zidify_text(purify_html(Markdown(wiki_bbcode(json_decode($content)))))); + $renderedContent = wiki_convert_links($html,argv(0).'/'.argv(1).'/'.$wikiUrlName); + } $hide_editor = false; $showPageControls = $wiki_editor; $showNewWikiButton = $wiki_owner; @@ -220,14 +229,13 @@ class Wiki extends \Zotlabs\Web\Controller { } $wikiModalID = random_string(3); - $wikiModal = replace_macros( - get_markup_template('generic_modal.tpl'), array( - '$id' => $wikiModalID, - '$title' => t('Revision Comparison'), - '$ok' => t('Revert'), - '$cancel' => t('Cancel') - ) - ); + + $wikiModal = replace_macros(get_markup_template('generic_modal.tpl'), array( + '$id' => $wikiModalID, + '$title' => t('Revision Comparison'), + '$ok' => t('Revert'), + '$cancel' => t('Cancel') + )); $o .= replace_macros(get_markup_template('wiki.tpl'),array( '$wikiheaderName' => $wikiheaderName, @@ -251,6 +259,7 @@ class Wiki extends \Zotlabs\Web\Controller { '$deny_cid' => $x['deny_cid'], '$deny_gid' => $x['deny_gid'], '$bang' => $x['bang'], + '$mimeType' => $mimeType, '$content' => $content, '$renderedContent' => $renderedContent, '$wikiName' => array('wikiName', t('Enter the name of your new wiki:'), '', ''), @@ -293,13 +302,21 @@ class Wiki extends \Zotlabs\Web\Controller { // Render mardown-formatted text in HTML for preview if((argc() > 2) && (argv(2) === 'preview')) { $content = $_POST['content']; - $resource_id = $_POST['resource_id']; - require_once('library/markdown.php'); - $content = wiki_bbcode($content); - $html = wiki_generate_toc(zidify_text(purify_html(Markdown($content)))); + $resource_id = $_POST['resource_id']; $w = wiki_get_wiki($resource_id); $wikiURL = argv(0).'/'.argv(1).'/'.$w['urlName']; - $html = wiki_convert_links($html,$wikiURL); + + $mimeType = $w['mimeType']; + + if($mimeType == 'text/bbcode') { + $html = purify_html(bbcode($content)); + } + else { + require_once('library/markdown.php'); + $content = wiki_bbcode($content); + $html = wiki_generate_toc(zidify_text(purify_html(Markdown($content)))); + $html = wiki_convert_links($html,$wikiURL); + } json_return_and_die(array('html' => $html, 'success' => true)); } -- cgit v1.2.3 From 1fe1194ef42026b70e62a678133d025dd0553756 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 30 Nov 2016 15:13:06 +0100 Subject: do not call purify_html() at this place --- Zotlabs/Module/Wiki.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index c4cc72ae8..5cf62d2fb 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -38,6 +38,7 @@ class Wiki extends \Zotlabs\Web\Controller { require_once('include/wiki.php'); require_once('include/acl_selectors.php'); require_once('include/conversation.php'); + require_once('include/bbcode.php'); // TODO: Combine the interface configuration into a unified object // Something like $interface = array('new_page_button' => false, 'new_wiki_button' => false, ...) @@ -209,7 +210,7 @@ class Wiki extends \Zotlabs\Web\Controller { $content = ($p['content'] !== '' ? $rawContent : '"# New page\n"'); // Render the Markdown-formatted page content in HTML if($mimeType == 'text/bbcode') { - $renderedContent = purify_html(bbcode($content)); + $renderedContent = bbcode($content); } else { require_once('library/markdown.php'); @@ -287,6 +288,7 @@ class Wiki extends \Zotlabs\Web\Controller { function post() { require_once('include/wiki.php'); + require_once('include/bbcode.php'); $nick = argv(1); $owner = channelx_by_nick($nick); @@ -309,7 +311,7 @@ class Wiki extends \Zotlabs\Web\Controller { $mimeType = $w['mimeType']; if($mimeType == 'text/bbcode') { - $html = purify_html(bbcode($content)); + $html = bbcode($content); } else { require_once('library/markdown.php'); -- cgit v1.2.3 From d7f655dfc5b56601a79999cf8ae8bbc05d0f0259 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 1 Dec 2016 11:24:35 +0100 Subject: wiki cleanup - wip. please watch out for eventual regressions --- Zotlabs/Module/Wiki.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 5cf62d2fb..82f4ab5ce 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -44,8 +44,6 @@ class Wiki extends \Zotlabs\Web\Controller { // Something like $interface = array('new_page_button' => false, 'new_wiki_button' => false, ...) $wiki_owner = false; $showNewWikiButton = false; - $showCommitMsg = false; - $hidePageHistory = false; $pageHistory = array(); $local_observer = null; $resource_id = ''; @@ -173,10 +171,12 @@ class Wiki extends \Zotlabs\Web\Controller { // Fetch the wiki info and determine observer permissions $wikiUrlName = urlencode(argv(2)); $pageUrlName = urlencode(argv(3)); + $w = wiki_exists_by_name($owner['channel_id'], $wikiUrlName); if(!$w['resource_id']) { notice(t('Wiki not found') . EOL); goaway('/'.argv(0).'/'.argv(1)); + return; //not reached } $resource_id = $w['resource_id']; @@ -187,6 +187,7 @@ class Wiki extends \Zotlabs\Web\Controller { if(!$perms['read']) { notice(t('Permission denied.') . EOL); goaway('/'.argv(0).'/'.argv(1)); + return; //not reached } if($perms['write']) { $wiki_editor = true; @@ -198,15 +199,18 @@ class Wiki extends \Zotlabs\Web\Controller { } $wikiheaderName = urldecode($wikiUrlName); $wikiheaderPage = urldecode($pageUrlName); + $renamePage = (($wikiheaderPage === 'Home') ? '' : t('Rename page')); + $p = wiki_get_page_content(array('resource_id' => $resource_id, 'pageUrlName' => $pageUrlName)); if(!$p['success']) { notice(t('Error retrieving page content') . EOL); goaway('/'.argv(0).'/'.argv(1).'/'.$wikiUrlName); + return; //not reached } $mimeType = $p['mimeType']; - $rawContent = $p['mimeType'] == 'text/bbcode' ? htmlspecialchars_decode(json_decode($p['content']),ENT_COMPAT) : htmlspecialchars_decode($p['content'],ENT_COMPAT); + $rawContent = (($p['mimeType'] == 'text/bbcode') ? htmlspecialchars_decode(json_decode($p['content']),ENT_COMPAT) : htmlspecialchars_decode($p['content'],ENT_COMPAT)); $content = ($p['content'] !== '' ? $rawContent : '"# New page\n"'); // Render the Markdown-formatted page content in HTML if($mimeType == 'text/bbcode') { @@ -221,12 +225,11 @@ class Wiki extends \Zotlabs\Web\Controller { $showPageControls = $wiki_editor; $showNewWikiButton = $wiki_owner; $showNewPageButton = $wiki_editor; - $hidePageHistory = false; - $showCommitMsg = true; $pageHistory = wiki_page_history(array('resource_id' => $resource_id, 'pageUrlName' => $pageUrlName)); break; default: // Strip the extraneous URL components - goaway('/'.argv(0).'/'.argv(1).'/'.$wikiUrlName.'/'.$pageUrlName); + goaway('/' . argv(0) . '/' . argv(1) . '/' . $wikiUrlName . '/' . $pageUrlName); + return; //not reached } $wikiModalID = random_string(3); @@ -241,6 +244,7 @@ class Wiki extends \Zotlabs\Web\Controller { $o .= replace_macros(get_markup_template('wiki.tpl'),array( '$wikiheaderName' => $wikiheaderName, '$wikiheaderPage' => $wikiheaderPage, + '$renamePage' => $renamePage, '$hideEditor' => $hide_editor, // True will completely hide the content section and is used for the case of no wiki selected '$chooseWikiMessage' => t('Choose an available wiki from the list on the left.'), '$showPageControls' => $showPageControls, @@ -248,8 +252,6 @@ class Wiki extends \Zotlabs\Web\Controller { '$tools_label' => 'Wiki Tools', '$showNewWikiButton'=> $showNewWikiButton, '$showNewPageButton'=> $showNewPageButton, - '$hidePageHistory' => $hidePageHistory, - '$showCommitMsg' => $showCommitMsg, '$channel' => $owner['channel_address'], '$resource_id' => $resource_id, '$page' => $pageUrlName, @@ -265,7 +267,7 @@ class Wiki extends \Zotlabs\Web\Controller { '$renderedContent' => $renderedContent, '$wikiName' => array('wikiName', t('Enter the name of your new wiki:'), '', ''), '$pageName' => array('pageName', t('Enter the name of the new page:'), '', ''), - '$pageRename' => array('pageRename', t('Enter the new name:'), '', ''), + '$pageRename' => array('pageRename', t('New page name'), '', ''), '$commitMsg' => array('commitMsg', '', '', '', '', 'placeholder="Short description of your changes (optional)"'), '$pageHistory' => $pageHistory['history'], '$wikiModal' => $wikiModal, @@ -282,7 +284,10 @@ class Wiki extends \Zotlabs\Web\Controller { '$modalerrorlink' => t('Error getting photo link'), '$modalerroralbum' => t('Error getting album'), )); - head_add_js('library/ace/ace.js'); // Ace Code Editor + + if($p['mimeType'] != 'text/bbcode') + head_add_js('library/ace/ace.js'); // Ace Code Editor + return $o; } -- cgit v1.2.3 From adb9f318038f4e0f54c8b3aacb2ed821b251500a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 1 Dec 2016 11:38:49 +0100 Subject: more wiki cleanup --- Zotlabs/Module/Wiki.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 82f4ab5ce..5b3c4c1d8 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -249,7 +249,7 @@ class Wiki extends \Zotlabs\Web\Controller { '$chooseWikiMessage' => t('Choose an available wiki from the list on the left.'), '$showPageControls' => $showPageControls, '$editOrSourceLabel' => (($showPageControls) ? t('Edit') : t('Source')), - '$tools_label' => 'Wiki Tools', + '$tools_label' => 'Page Tools', '$showNewWikiButton'=> $showNewWikiButton, '$showNewPageButton'=> $showNewPageButton, '$channel' => $owner['channel_address'], @@ -265,8 +265,6 @@ class Wiki extends \Zotlabs\Web\Controller { '$mimeType' => $mimeType, '$content' => $content, '$renderedContent' => $renderedContent, - '$wikiName' => array('wikiName', t('Enter the name of your new wiki:'), '', ''), - '$pageName' => array('pageName', t('Enter the name of the new page:'), '', ''), '$pageRename' => array('pageRename', t('New page name'), '', ''), '$commitMsg' => array('commitMsg', '', '', '', '', 'placeholder="Short description of your changes (optional)"'), '$pageHistory' => $pageHistory['history'], -- cgit v1.2.3 From b12d4c03cbc2627774b279f17a413860d868e854 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 4 Dec 2016 12:51:23 +0100 Subject: fixes for toc bbcode and bbcode wiki toc --- Zotlabs/Module/Wiki.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 5b3c4c1d8..da23d67a2 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -214,7 +214,7 @@ class Wiki extends \Zotlabs\Web\Controller { $content = ($p['content'] !== '' ? $rawContent : '"# New page\n"'); // Render the Markdown-formatted page content in HTML if($mimeType == 'text/bbcode') { - $renderedContent = bbcode($content); + $renderedContent = wiki_convert_links(bbcode($content),argv(0).'/'.argv(1).'/'.$wikiUrlName); } else { require_once('library/markdown.php'); @@ -314,7 +314,7 @@ class Wiki extends \Zotlabs\Web\Controller { $mimeType = $w['mimeType']; if($mimeType == 'text/bbcode') { - $html = bbcode($content); + $html = wiki_convert_links(bbcode($content),$wikiURL); } else { require_once('library/markdown.php'); -- cgit v1.2.3 From 3f6fe4f2be18dd99f30a2cd5e47fb3aaeee4b0b7 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 4 Dec 2016 15:10:54 +0100 Subject: translateable string --- Zotlabs/Module/Wiki.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index da23d67a2..01a1bdc41 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -149,6 +149,7 @@ class Wiki extends \Zotlabs\Web\Controller { '$wikiName' => array('wikiName', t('Wiki name')), '$mimeType' => array('mimeType', t('Content type'), '', '', ['text/markdown' => 'Markdown', 'text/bbcode' => 'BB Code']), '$name' => t('Name'), + '$type' => t('Type'), '$lockstate' => $x['lockstate'], '$acl' => $x['acl'], '$allow_cid' => $x['allow_cid'], -- cgit v1.2.3 From f79c6190654ec3912abc34eb0568331983a968a3 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 14 Dec 2016 11:55:52 +0100 Subject: wiki: do not show revert buttons if we do not have write perms and minor cleanup --- Zotlabs/Module/Wiki.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 01a1bdc41..06a4d0f24 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -222,11 +222,7 @@ class Wiki extends \Zotlabs\Web\Controller { $html = wiki_generate_toc(zidify_text(purify_html(Markdown(wiki_bbcode(json_decode($content)))))); $renderedContent = wiki_convert_links($html,argv(0).'/'.argv(1).'/'.$wikiUrlName); } - $hide_editor = false; $showPageControls = $wiki_editor; - $showNewWikiButton = $wiki_owner; - $showNewPageButton = $wiki_editor; - $pageHistory = wiki_page_history(array('resource_id' => $resource_id, 'pageUrlName' => $pageUrlName)); break; default: // Strip the extraneous URL components goaway('/' . argv(0) . '/' . argv(1) . '/' . $wikiUrlName . '/' . $pageUrlName); @@ -238,7 +234,7 @@ class Wiki extends \Zotlabs\Web\Controller { $wikiModal = replace_macros(get_markup_template('generic_modal.tpl'), array( '$id' => $wikiModalID, '$title' => t('Revision Comparison'), - '$ok' => t('Revert'), + '$ok' => (($showPageControls) ? t('Revert') : ''), '$cancel' => t('Cancel') )); @@ -246,13 +242,10 @@ class Wiki extends \Zotlabs\Web\Controller { '$wikiheaderName' => $wikiheaderName, '$wikiheaderPage' => $wikiheaderPage, '$renamePage' => $renamePage, - '$hideEditor' => $hide_editor, // True will completely hide the content section and is used for the case of no wiki selected '$chooseWikiMessage' => t('Choose an available wiki from the list on the left.'), '$showPageControls' => $showPageControls, '$editOrSourceLabel' => (($showPageControls) ? t('Edit') : t('Source')), '$tools_label' => 'Page Tools', - '$showNewWikiButton'=> $showNewWikiButton, - '$showNewPageButton'=> $showNewPageButton, '$channel' => $owner['channel_address'], '$resource_id' => $resource_id, '$page' => $pageUrlName, @@ -268,7 +261,6 @@ class Wiki extends \Zotlabs\Web\Controller { '$renderedContent' => $renderedContent, '$pageRename' => array('pageRename', t('New page name'), '', ''), '$commitMsg' => array('commitMsg', '', '', '', '', 'placeholder="Short description of your changes (optional)"'), - '$pageHistory' => $pageHistory['history'], '$wikiModal' => $wikiModal, '$wikiModalID' => $wikiModalID, '$commit' => 'HEAD', @@ -495,8 +487,9 @@ class Wiki extends \Zotlabs\Web\Controller { } $historyHTML = widget_wiki_page_history(array( - 'resource_id' => $resource_id, - 'pageUrlName' => $pageUrlName + 'resource_id' => $resource_id, + 'pageUrlName' => $pageUrlName, + 'permsWrite' => $perms['write'] )); json_return_and_die(array('historyHTML' => $historyHTML, 'message' => '', 'success' => true)); } -- cgit v1.2.3 From 1d3af68f298d89b94eb1faa61794cf4ee20cff15 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 15 Dec 2016 10:56:16 +0100 Subject: more wiki cleanup --- Zotlabs/Module/Wiki.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'Zotlabs/Module/Wiki.php') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 06a4d0f24..7b0ec9d83 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -242,20 +242,12 @@ class Wiki extends \Zotlabs\Web\Controller { '$wikiheaderName' => $wikiheaderName, '$wikiheaderPage' => $wikiheaderPage, '$renamePage' => $renamePage, - '$chooseWikiMessage' => t('Choose an available wiki from the list on the left.'), '$showPageControls' => $showPageControls, '$editOrSourceLabel' => (($showPageControls) ? t('Edit') : t('Source')), '$tools_label' => 'Page Tools', '$channel' => $owner['channel_address'], '$resource_id' => $resource_id, '$page' => $pageUrlName, - '$lockstate' => $x['lockstate'], - '$acl' => $x['acl'], - '$allow_cid' => $x['allow_cid'], - '$allow_gid' => $x['allow_gid'], - '$deny_cid' => $x['deny_cid'], - '$deny_gid' => $x['deny_gid'], - '$bang' => $x['bang'], '$mimeType' => $mimeType, '$content' => $content, '$renderedContent' => $renderedContent, @@ -270,7 +262,7 @@ class Wiki extends \Zotlabs\Web\Controller { '$embedPhotosModalOK' => t('OK'), '$modalchooseimages' => t('Choose images to embed'), '$modalchoosealbum' => t('Choose an album'), - '$modaldiffalbum' => t('Choose a different album...'), + '$modaldiffalbum' => t('Choose a different album'), '$modalerrorlist' => t('Error getting album list'), '$modalerrorlink' => t('Error getting photo link'), '$modalerroralbum' => t('Error getting album'), -- cgit v1.2.3