mpre feature to app transition
This commit is contained in:
parent
28e4977c33
commit
2651eae663
@ -1,12 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Zotlabs\Module;
|
namespace Zotlabs\Module;
|
||||||
|
|
||||||
|
use App;
|
||||||
|
use Zotlabs\Lib\Apps;
|
||||||
|
use Zotlabs\Web\Controller;
|
||||||
|
use Zotlabs\Lib\PermissionDescription;
|
||||||
|
|
||||||
require_once('include/channel.php');
|
require_once('include/channel.php');
|
||||||
require_once('include/conversation.php');
|
require_once('include/conversation.php');
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
|
|
||||||
|
|
||||||
class Articles extends \Zotlabs\Web\Controller {
|
class Articles extends Controller {
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
|
||||||
@ -25,14 +30,19 @@ class Articles extends \Zotlabs\Web\Controller {
|
|||||||
return login();
|
return login();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! \App::$profile) {
|
if(! App::$profile) {
|
||||||
notice( t('Requested profile is not available.') . EOL );
|
notice( t('Requested profile is not available.') . EOL );
|
||||||
\App::$error = 404;
|
App::$error = 404;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! feature_enabled(\App::$profile_uid,'articles')) {
|
if(! Apps::system_app_installed(App::$profile_uid, 'Articles')) {
|
||||||
return;
|
//Do not display any associated widgets at this point
|
||||||
|
App::$pdl = '';
|
||||||
|
|
||||||
|
$o = '<b>Articles App (Not Installed):</b><br>';
|
||||||
|
$o .= t('Create interactive articles');
|
||||||
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav_set_selected(t('Articles'));
|
nav_set_selected(t('Articles'));
|
||||||
@ -40,7 +50,7 @@ class Articles extends \Zotlabs\Web\Controller {
|
|||||||
head_add_link([
|
head_add_link([
|
||||||
'rel' => 'alternate',
|
'rel' => 'alternate',
|
||||||
'type' => 'application/json+oembed',
|
'type' => 'application/json+oembed',
|
||||||
'href' => z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string),
|
'href' => z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . App::$query_string),
|
||||||
'title' => 'oembed'
|
'title' => 'oembed'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -48,7 +58,7 @@ class Articles extends \Zotlabs\Web\Controller {
|
|||||||
$category = (($_REQUEST['cat']) ? escape_tags(trim($_REQUEST['cat'])) : '');
|
$category = (($_REQUEST['cat']) ? escape_tags(trim($_REQUEST['cat'])) : '');
|
||||||
|
|
||||||
if($category) {
|
if($category) {
|
||||||
$sql_extra2 .= protect_sprintf(term_item_parent_query(\App::$profile['profile_uid'],'item', $category, TERM_CATEGORY));
|
$sql_extra2 .= protect_sprintf(term_item_parent_query(App::$profile['profile_uid'],'item', $category, TERM_CATEGORY));
|
||||||
}
|
}
|
||||||
|
|
||||||
$datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
|
$datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
|
||||||
@ -58,11 +68,11 @@ class Articles extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
$selected_card = ((argc() > 2) ? argv(2) : '');
|
$selected_card = ((argc() > 2) ? argv(2) : '');
|
||||||
|
|
||||||
$_SESSION['return_url'] = \App::$query_string;
|
$_SESSION['return_url'] = App::$query_string;
|
||||||
|
|
||||||
$uid = local_channel();
|
$uid = local_channel();
|
||||||
$owner = \App::$profile_uid;
|
$owner = App::$profile_uid;
|
||||||
$observer = \App::get_observer();
|
$observer = App::get_observer();
|
||||||
|
|
||||||
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
|
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
|
||||||
|
|
||||||
@ -100,7 +110,7 @@ class Articles extends \Zotlabs\Web\Controller {
|
|||||||
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid']
|
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid']
|
||||||
|| $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
|| $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
||||||
'acl' => (($is_owner) ? populate_acl($channel_acl, false,
|
'acl' => (($is_owner) ? populate_acl($channel_acl, false,
|
||||||
\Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')) : ''),
|
PermissionDescription::fromGlobalPermission('view_pages')) : ''),
|
||||||
'permissions' => $channel_acl,
|
'permissions' => $channel_acl,
|
||||||
'showacl' => (($is_owner) ? true : false),
|
'showacl' => (($is_owner) ? true : false),
|
||||||
'visitor' => true,
|
'visitor' => true,
|
||||||
@ -130,8 +140,8 @@ class Articles extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$itemspage = get_pconfig(local_channel(),'system','itemspage');
|
$itemspage = get_pconfig(local_channel(),'system','itemspage');
|
||||||
\App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
|
App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
|
||||||
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
|
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
|
||||||
|
|
||||||
|
|
||||||
$sql_extra = item_permissions_sql($owner);
|
$sql_extra = item_permissions_sql($owner);
|
||||||
@ -179,7 +189,7 @@ class Articles extends \Zotlabs\Web\Controller {
|
|||||||
WHERE item.uid = %d $item_normal
|
WHERE item.uid = %d $item_normal
|
||||||
AND item.parent IN ( %s )
|
AND item.parent IN ( %s )
|
||||||
$sql_extra $sql_extra2 ",
|
$sql_extra $sql_extra2 ",
|
||||||
intval(\App::$profile['profile_uid']),
|
intval(App::$profile['profile_uid']),
|
||||||
dbesc($parents_str)
|
dbesc($parents_str)
|
||||||
);
|
);
|
||||||
if($items) {
|
if($items) {
|
||||||
|
@ -40,8 +40,11 @@ class Cards extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(! Apps::system_app_installed(App::$profile_uid, 'Cards')) {
|
if(! Apps::system_app_installed(App::$profile_uid, 'Cards')) {
|
||||||
$o = '<b>Cards App - Not Installed:</b><br>';
|
//Do not display any associated widgets at this point
|
||||||
$o .= 'Create personal planning cards';
|
App::$pdl = '';
|
||||||
|
|
||||||
|
$o = '<b>Cards App (Not Installed):</b><br>';
|
||||||
|
$o .= t('Create personal planning cards');
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Zotlabs\Module;
|
namespace Zotlabs\Module;
|
||||||
|
|
||||||
|
use App;
|
||||||
|
use Zotlabs\Web\Controller;
|
||||||
|
use Zotlabs\Lib\Apps;
|
||||||
|
use Zotlabs\Lib\PermissionDescription;
|
||||||
|
use Zotlabs\Lib\ExtendedZip;
|
||||||
|
use ZipArchive;
|
||||||
|
|
||||||
require_once('include/channel.php');
|
require_once('include/channel.php');
|
||||||
require_once('include/conversation.php');
|
require_once('include/conversation.php');
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
|
|
||||||
|
class Webpages extends Controller {
|
||||||
class Webpages extends \Zotlabs\Web\Controller {
|
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
|
||||||
if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
|
if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
|
||||||
$sys = get_sys_channel();
|
$sys = get_sys_channel();
|
||||||
if($sys && intval($sys['channel_id'])) {
|
if($sys && intval($sys['channel_id'])) {
|
||||||
\App::$is_sys = true;
|
App::$is_sys = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,23 +35,32 @@ class Webpages extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
function get() {
|
function get() {
|
||||||
|
|
||||||
if(! \App::$profile) {
|
if(! App::$profile) {
|
||||||
notice( t('Requested profile is not available.') . EOL );
|
notice( t('Requested profile is not available.') . EOL );
|
||||||
\App::$error = 404;
|
App::$error = 404;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(! Apps::system_app_installed(App::$profile_uid, 'Webpages')) {
|
||||||
|
//Do not display any associated widgets at this point
|
||||||
|
App::$pdl = '';
|
||||||
|
|
||||||
|
$o = '<b>Webpages App (Not Installed):</b><br>';
|
||||||
|
$o .= t('Provide managed web pages on your channel');
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
nav_set_selected('Webpages');
|
nav_set_selected('Webpages');
|
||||||
|
|
||||||
$which = argv(1);
|
$which = argv(1);
|
||||||
|
|
||||||
$_SESSION['return_url'] = \App::$query_string;
|
$_SESSION['return_url'] = App::$query_string;
|
||||||
|
|
||||||
$uid = local_channel();
|
$uid = local_channel();
|
||||||
$owner = 0;
|
$owner = 0;
|
||||||
$observer = \App::get_observer();
|
$observer = App::get_observer();
|
||||||
|
|
||||||
$channel = \App::get_channel();
|
$channel = App::get_channel();
|
||||||
|
|
||||||
switch ($_SESSION['action']) {
|
switch ($_SESSION['action']) {
|
||||||
case 'import':
|
case 'import':
|
||||||
@ -91,7 +106,7 @@ class Webpages extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(\App::$is_sys && is_site_admin()) {
|
if(App::$is_sys && is_site_admin()) {
|
||||||
$sys = get_sys_channel();
|
$sys = get_sys_channel();
|
||||||
if($sys && intval($sys['channel_id'])) {
|
if($sys && intval($sys['channel_id'])) {
|
||||||
$uid = $owner = intval($sys['channel_id']);
|
$uid = $owner = intval($sys['channel_id']);
|
||||||
@ -127,8 +142,8 @@ class Webpages extends \Zotlabs\Web\Controller {
|
|||||||
// Nickname is set to the observers xchan, and profile_uid to the owner's.
|
// Nickname is set to the observers xchan, and profile_uid to the owner's.
|
||||||
// This lets you post pages at other people's channels.
|
// This lets you post pages at other people's channels.
|
||||||
|
|
||||||
if((! $channel) && ($uid) && ($uid == \App::$profile_uid)) {
|
if((! $channel) && ($uid) && ($uid == App::$profile_uid)) {
|
||||||
$channel = \App::get_channel();
|
$channel = App::get_channel();
|
||||||
}
|
}
|
||||||
if($channel) {
|
if($channel) {
|
||||||
$channel_acl = array(
|
$channel_acl = array(
|
||||||
@ -144,15 +159,15 @@ class Webpages extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
|
|
||||||
$is_owner = ($uid && $uid == $owner);
|
$is_owner = ($uid && $uid == $owner);
|
||||||
//$o = profile_tabs($a, $is_owner, \App::$profile['channel_address']);
|
//$o = profile_tabs($a, $is_owner, App::$profile['channel_address']);
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
$x = array(
|
$x = array(
|
||||||
'webpage' => ITEM_TYPE_WEBPAGE,
|
'webpage' => ITEM_TYPE_WEBPAGE,
|
||||||
'is_owner' => true,
|
'is_owner' => true,
|
||||||
'nickname' => \App::$profile['channel_address'],
|
'nickname' => App::$profile['channel_address'],
|
||||||
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
||||||
'acl' => (($is_owner) ? populate_acl($channel_acl,false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')) : ''),
|
'acl' => (($is_owner) ? populate_acl($channel_acl,false, PermissionDescription::fromGlobalPermission('view_pages')) : ''),
|
||||||
'permissions' => $channel_acl,
|
'permissions' => $channel_acl,
|
||||||
'showacl' => (($is_owner) ? true : false),
|
'showacl' => (($is_owner) ? true : false),
|
||||||
'visitor' => true,
|
'visitor' => true,
|
||||||
@ -280,7 +295,7 @@ class Webpages extends \Zotlabs\Web\Controller {
|
|||||||
notice( t('Invalid file type.') . EOL);
|
notice( t('Invalid file type.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$zip = new \ZipArchive();
|
$zip = new ZipArchive();
|
||||||
if ($zip->open($source) === true) {
|
if ($zip->open($source) === true) {
|
||||||
$tmp_folder_name = random_string(5);
|
$tmp_folder_name = random_string(5);
|
||||||
$website = dirname($source) . '/' . $tmp_folder_name;
|
$website = dirname($source) . '/' . $tmp_folder_name;
|
||||||
@ -297,7 +312,7 @@ class Webpages extends \Zotlabs\Web\Controller {
|
|||||||
// Website files are to be imported from the channel cloud files
|
// Website files are to be imported from the channel cloud files
|
||||||
if (($_POST) && array_key_exists('path',$_POST) && isset($_POST['cloudsubmit'])) {
|
if (($_POST) && array_key_exists('path',$_POST) && isset($_POST['cloudsubmit'])) {
|
||||||
|
|
||||||
$channel = \App::get_channel();
|
$channel = App::get_channel();
|
||||||
$dirpath = get_dirpath_by_cloudpath($channel, $_POST['path']);
|
$dirpath = get_dirpath_by_cloudpath($channel, $_POST['path']);
|
||||||
if(!$dirpath) {
|
if(!$dirpath) {
|
||||||
notice( t('Invalid folder path.') . EOL);
|
notice( t('Invalid folder path.') . EOL);
|
||||||
@ -343,7 +358,7 @@ class Webpages extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
case 'importselected':
|
case 'importselected':
|
||||||
require_once('include/import.php');
|
require_once('include/import.php');
|
||||||
$channel = \App::get_channel();
|
$channel = App::get_channel();
|
||||||
|
|
||||||
// Import layout first so that pages that reference new layouts will find
|
// Import layout first so that pages that reference new layouts will find
|
||||||
// the mid of layout items in the database
|
// the mid of layout items in the database
|
||||||
@ -438,7 +453,7 @@ class Webpages extends \Zotlabs\Web\Controller {
|
|||||||
case 'cloud':
|
case 'cloud':
|
||||||
case 'zipfile':
|
case 'zipfile':
|
||||||
|
|
||||||
$channel = \App::get_channel();
|
$channel = App::get_channel();
|
||||||
|
|
||||||
$tmp_folder_name = random_string(10);
|
$tmp_folder_name = random_string(10);
|
||||||
$zip_folder_name = random_string(10);
|
$zip_folder_name = random_string(10);
|
||||||
@ -657,7 +672,7 @@ class Webpages extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
if($action === 'zipfile') {
|
if($action === 'zipfile') {
|
||||||
// Generate the zip file
|
// Generate the zip file
|
||||||
\Zotlabs\Lib\ExtendedZip::zipTree($tmp_folderpath, $zip_filepath, \ZipArchive::CREATE);
|
ExtendedZip::zipTree($tmp_folderpath, $zip_filepath, ZipArchive::CREATE);
|
||||||
// Output the file for download
|
// Output the file for download
|
||||||
header('Content-disposition: attachment; filename="' . $zip_filename . '"');
|
header('Content-disposition: attachment; filename="' . $zip_filename . '"');
|
||||||
header("Content-Type: application/zip");
|
header("Content-Type: application/zip");
|
||||||
@ -666,7 +681,7 @@ class Webpages extends \Zotlabs\Web\Controller {
|
|||||||
if(isset($_SESSION['exportcloudpath'])) {
|
if(isset($_SESSION['exportcloudpath'])) {
|
||||||
require_once('include/attach.php');
|
require_once('include/attach.php');
|
||||||
$cloudpath = urldecode($_SESSION['exportcloudpath']);
|
$cloudpath = urldecode($_SESSION['exportcloudpath']);
|
||||||
$channel = \App::get_channel();
|
$channel = App::get_channel();
|
||||||
$dirpath = get_dirpath_by_cloudpath($channel, $cloudpath);
|
$dirpath = get_dirpath_by_cloudpath($channel, $cloudpath);
|
||||||
if(!$dirpath) {
|
if(!$dirpath) {
|
||||||
$x = attach_mkdirp($channel, $channel['channel_hash'], array('pathname' => $cloudpath));
|
$x = attach_mkdirp($channel, $channel['channel_hash'], array('pathname' => $cloudpath));
|
||||||
|
@ -2,15 +2,20 @@
|
|||||||
|
|
||||||
namespace Zotlabs\Module;
|
namespace Zotlabs\Module;
|
||||||
|
|
||||||
use \Zotlabs\Lib as Zlib;
|
use App;
|
||||||
use \Michelf\MarkdownExtra;
|
use Zotlabs\Web\Controller;
|
||||||
|
use Zotlabs\Lib\Apps;
|
||||||
|
use Zotlabs\Lib\PermissionDescription;
|
||||||
|
use Zotlabs\Lib\NativeWiki;
|
||||||
|
use Zotlabs\Lib\NativeWikiPage;
|
||||||
|
use Zotlabs\Lib\MarkdownSoap;
|
||||||
|
use Michelf\MarkdownExtra;
|
||||||
|
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
require_once('include/conversation.php');
|
require_once('include/conversation.php');
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
|
|
||||||
|
class Wiki extends Controller {
|
||||||
class Wiki extends \Zotlabs\Web\Controller {
|
|
||||||
|
|
||||||
private $wiki = null;
|
private $wiki = null;
|
||||||
|
|
||||||
@ -40,10 +45,14 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
return login();
|
return login();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! feature_enabled(\App::$profile_uid,'wiki')) {
|
if(! Apps::system_app_installed(App::$profile_uid, 'Wiki')) {
|
||||||
notice( t('Not found') . EOL);
|
//Do not display any associated widgets at this point
|
||||||
return;
|
App::$pdl = '';
|
||||||
}
|
|
||||||
|
$o = '<b>Wiki App (Not Installed):</b><br>';
|
||||||
|
$o .= t('Provide a wiki for your channel');
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(! perm_is_allowed(\App::$profile_uid,get_observer_hash(),'view_wiki')) {
|
if(! perm_is_allowed(\App::$profile_uid,get_observer_hash(),'view_wiki')) {
|
||||||
@ -95,7 +104,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
$owner['channel_deny_gid'])
|
$owner['channel_deny_gid'])
|
||||||
? 'lock' : 'unlock'
|
? 'lock' : 'unlock'
|
||||||
),
|
),
|
||||||
'acl' => populate_acl($owner_acl, false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_wiki')),
|
'acl' => populate_acl($owner_acl, false, PermissionDescription::fromGlobalPermission('view_wiki')),
|
||||||
'allow_cid' => acl2json($owner_acl['allow_cid']),
|
'allow_cid' => acl2json($owner_acl['allow_cid']),
|
||||||
'allow_gid' => acl2json($owner_acl['allow_gid']),
|
'allow_gid' => acl2json($owner_acl['allow_gid']),
|
||||||
'deny_cid' => acl2json($owner_acl['deny_cid']),
|
'deny_cid' => acl2json($owner_acl['deny_cid']),
|
||||||
@ -117,9 +126,9 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
if((argc() > 3) && (argv(2) === 'download') && (argv(3) === 'wiki')) {
|
if((argc() > 3) && (argv(2) === 'download') && (argv(3) === 'wiki')) {
|
||||||
|
|
||||||
$resource_id = argv(4);
|
$resource_id = argv(4);
|
||||||
$w = Zlib\NativeWiki::get_wiki($owner['channel_id'],$observer_hash,$resource_id);
|
$w = NativeWiki::get_wiki($owner['channel_id'],$observer_hash,$resource_id);
|
||||||
|
|
||||||
// $w = Zlib\NativeWiki::get_wiki($owner,$observer_hash,$resource_id);
|
// $w = NativeWiki::get_wiki($owner,$observer_hash,$resource_id);
|
||||||
if(! $w['htmlName']) {
|
if(! $w['htmlName']) {
|
||||||
notice(t('Error retrieving wiki') . EOL);
|
notice(t('Error retrieving wiki') . EOL);
|
||||||
}
|
}
|
||||||
@ -157,9 +166,9 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
$content = html_entity_decode($iv['body'],ENT_COMPAT,'UTF-8');
|
$content = html_entity_decode($iv['body'],ENT_COMPAT,'UTF-8');
|
||||||
}
|
}
|
||||||
elseif($iv['mimetype'] === 'text/markdown') {
|
elseif($iv['mimetype'] === 'text/markdown') {
|
||||||
$content = html_entity_decode(Zlib\MarkdownSoap::unescape($iv['body']),ENT_COMPAT,'UTF-8');
|
$content = html_entity_decode(MarkdownSoap::unescape($iv['body']),ENT_COMPAT,'UTF-8');
|
||||||
}
|
}
|
||||||
$fname = get_iconfig($iv['id'],'nwikipage','pagetitle') . Zlib\NativeWikiPage::get_file_ext($iv);
|
$fname = get_iconfig($iv['id'],'nwikipage','pagetitle') . NativeWikiPage::get_file_ext($iv);
|
||||||
$zip->addFromString($fname,$content);
|
$zip->addFromString($fname,$content);
|
||||||
$pages[] = $iv['mid'];
|
$pages[] = $iv['mid'];
|
||||||
}
|
}
|
||||||
@ -190,7 +199,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
switch(argc()) {
|
switch(argc()) {
|
||||||
case 2:
|
case 2:
|
||||||
$wikis = Zlib\NativeWiki::listwikis($owner, get_observer_hash());
|
$wikis = NativeWiki::listwikis($owner, get_observer_hash());
|
||||||
|
|
||||||
if($wikis) {
|
if($wikis) {
|
||||||
$o .= replace_macros(get_markup_template('wikilist.tpl'), array(
|
$o .= replace_macros(get_markup_template('wikilist.tpl'), array(
|
||||||
@ -256,7 +265,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
$pageUrlName = urldecode($page_name);
|
$pageUrlName = urldecode($page_name);
|
||||||
$langPageUrlName = urldecode(\App::$language . '/' . $page_name);
|
$langPageUrlName = urldecode(\App::$language . '/' . $page_name);
|
||||||
|
|
||||||
$w = Zlib\NativeWiki::exists_by_name($owner['channel_id'], $wikiUrlName);
|
$w = NativeWiki::exists_by_name($owner['channel_id'], $wikiUrlName);
|
||||||
|
|
||||||
if(! $w['resource_id']) {
|
if(! $w['resource_id']) {
|
||||||
notice(t('Wiki not found') . EOL);
|
notice(t('Wiki not found') . EOL);
|
||||||
@ -268,7 +277,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
if(! $wiki_owner) {
|
if(! $wiki_owner) {
|
||||||
// Check for observer permissions
|
// Check for observer permissions
|
||||||
$observer_hash = get_observer_hash();
|
$observer_hash = get_observer_hash();
|
||||||
$perms = Zlib\NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
$perms = NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
||||||
if(! $perms['read']) {
|
if(! $perms['read']) {
|
||||||
notice(t('Permission denied.') . EOL);
|
notice(t('Permission denied.') . EOL);
|
||||||
goaway(z_root() . '/' . argv(0) . '/' . argv(1));
|
goaway(z_root() . '/' . argv(0) . '/' . argv(1));
|
||||||
@ -289,10 +298,10 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
$p = [];
|
$p = [];
|
||||||
|
|
||||||
if(! $ignore_language) {
|
if(! $ignore_language) {
|
||||||
$p = Zlib\NativeWikiPage::get_page_content(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $langPageUrlName));
|
$p = NativeWikiPage::get_page_content(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $langPageUrlName));
|
||||||
}
|
}
|
||||||
if(! ($p && $p['success'])) {
|
if(! ($p && $p['success'])) {
|
||||||
$p = Zlib\NativeWikiPage::get_page_content(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName));
|
$p = NativeWikiPage::get_page_content(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName));
|
||||||
}
|
}
|
||||||
if(! ($p && $p['success'])) {
|
if(! ($p && $p['success'])) {
|
||||||
$x = new \Zotlabs\Widget\Wiki_pages();
|
$x = new \Zotlabs\Widget\Wiki_pages();
|
||||||
@ -306,7 +315,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
//json_return_and_die(array('pages' => $page_list_html, 'message' => '', 'success' => true));
|
//json_return_and_die(array('pages' => $page_list_html, 'message' => '', 'success' => true));
|
||||||
notice( t('Error retrieving page content') . EOL);
|
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);
|
$renderedContent = NativeWikiPage::convert_links($html, argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
|
||||||
$showPageControls = $wiki_editor;
|
$showPageControls = $wiki_editor;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -320,15 +329,15 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
// Render the Markdown-formatted page content in HTML
|
// Render the Markdown-formatted page content in HTML
|
||||||
if($mimeType == 'text/bbcode') {
|
if($mimeType == 'text/bbcode') {
|
||||||
$renderedContent = Zlib\NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))), argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
|
$renderedContent = NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))), argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
|
||||||
}
|
}
|
||||||
elseif($mimeType === 'text/plain') {
|
elseif($mimeType === 'text/plain') {
|
||||||
$renderedContent = str_replace(["\n",' ',"\t"],[EOL,' ',' '],htmlentities($content,ENT_COMPAT,'UTF-8',false));
|
$renderedContent = str_replace(["\n",' ',"\t"],[EOL,' ',' '],htmlentities($content,ENT_COMPAT,'UTF-8',false));
|
||||||
}
|
}
|
||||||
elseif($mimeType === 'text/markdown') {
|
elseif($mimeType === 'text/markdown') {
|
||||||
$content = Zlib\MarkdownSoap::unescape($content);
|
$content = MarkdownSoap::unescape($content);
|
||||||
$html = Zlib\NativeWikiPage::generate_toc(zidify_text(MarkdownExtra::defaultTransform(Zlib\NativeWikiPage::bbcode($content))));
|
$html = NativeWikiPage::generate_toc(zidify_text(MarkdownExtra::defaultTransform(NativeWikiPage::bbcode($content))));
|
||||||
$renderedContent = Zlib\NativeWikiPage::convert_links($html, argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
|
$renderedContent = NativeWikiPage::convert_links($html, argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
|
||||||
}
|
}
|
||||||
$showPageControls = $wiki_editor;
|
$showPageControls = $wiki_editor;
|
||||||
}
|
}
|
||||||
@ -413,23 +422,23 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
$content = $_POST['content'];
|
$content = $_POST['content'];
|
||||||
$resource_id = $_POST['resource_id'];
|
$resource_id = $_POST['resource_id'];
|
||||||
|
|
||||||
$w = Zlib\NativeWiki::get_wiki($owner['channel_id'],$observer_hash,$resource_id);
|
$w = NativeWiki::get_wiki($owner['channel_id'],$observer_hash,$resource_id);
|
||||||
|
|
||||||
$wikiURL = argv(0) . '/' . argv(1) . '/' . $w['urlName'];
|
$wikiURL = argv(0) . '/' . argv(1) . '/' . $w['urlName'];
|
||||||
|
|
||||||
$mimeType = $_POST['mimetype'];
|
$mimeType = $_POST['mimetype'];
|
||||||
|
|
||||||
if($mimeType === 'text/bbcode') {
|
if($mimeType === 'text/bbcode') {
|
||||||
$html = Zlib\NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))),$wikiURL);
|
$html = NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))),$wikiURL);
|
||||||
}
|
}
|
||||||
elseif($mimeType === 'text/markdown') {
|
elseif($mimeType === 'text/markdown') {
|
||||||
$bb = Zlib\NativeWikiPage::bbcode($content);
|
$bb = NativeWikiPage::bbcode($content);
|
||||||
$x = new ZLib\MarkdownSoap($bb);
|
$x = new MarkdownSoap($bb);
|
||||||
$md = $x->clean();
|
$md = $x->clean();
|
||||||
$md = ZLib\MarkdownSoap::unescape($md);
|
$md = MarkdownSoap::unescape($md);
|
||||||
$html = MarkdownExtra::defaultTransform($md);
|
$html = MarkdownExtra::defaultTransform($md);
|
||||||
$html = Zlib\NativeWikiPage::generate_toc(zidify_text($html));
|
$html = NativeWikiPage::generate_toc(zidify_text($html));
|
||||||
$html = Zlib\NativeWikiPage::convert_links($html,$wikiURL);
|
$html = NativeWikiPage::convert_links($html,$wikiURL);
|
||||||
}
|
}
|
||||||
elseif($mimeType === 'text/plain') {
|
elseif($mimeType === 'text/plain') {
|
||||||
$html = str_replace(["\n",' ',"\t"],[EOL,' ',' '],htmlentities($content,ENT_COMPAT,'UTF-8',false));
|
$html = str_replace(["\n",' ',"\t"],[EOL,' ',' '],htmlentities($content,ENT_COMPAT,'UTF-8',false));
|
||||||
@ -466,7 +475,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
return; //not reached
|
return; //not reached
|
||||||
}
|
}
|
||||||
|
|
||||||
$exists = Zlib\NativeWiki::exists_by_name($owner['channel_id'], $wiki['urlName']);
|
$exists = NativeWiki::exists_by_name($owner['channel_id'], $wiki['urlName']);
|
||||||
if($exists['id']) {
|
if($exists['id']) {
|
||||||
notice( t('A wiki with this name already exists.') . EOL);
|
notice( t('A wiki with this name already exists.') . EOL);
|
||||||
goaway('/wiki');
|
goaway('/wiki');
|
||||||
@ -476,15 +485,15 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
// Get ACL for permissions
|
// Get ACL for permissions
|
||||||
$acl = new \Zotlabs\Access\AccessList($owner);
|
$acl = new \Zotlabs\Access\AccessList($owner);
|
||||||
$acl->set_from_array($_POST);
|
$acl->set_from_array($_POST);
|
||||||
$r = Zlib\NativeWiki::create_wiki($owner, $observer_hash, $wiki, $acl);
|
$r = NativeWiki::create_wiki($owner, $observer_hash, $wiki, $acl);
|
||||||
if($r['success']) {
|
if($r['success']) {
|
||||||
Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$r['item_id'],$r['item']['resource_id']);
|
NativeWiki::sync_a_wiki_item($owner['channel_id'],$r['item_id'],$r['item']['resource_id']);
|
||||||
$homePage = Zlib\NativeWikiPage::create_page($owner['channel_id'],$observer_hash,'Home', $r['item']['resource_id'], $wiki['mimeType']);
|
$homePage = NativeWikiPage::create_page($owner['channel_id'],$observer_hash,'Home', $r['item']['resource_id'], $wiki['mimeType']);
|
||||||
if(! $homePage['success']) {
|
if(! $homePage['success']) {
|
||||||
notice( t('Wiki created, but error creating Home page.'));
|
notice( t('Wiki created, but error creating Home page.'));
|
||||||
goaway(z_root() . '/wiki/' . $nick . '/' . $wiki['urlName']);
|
goaway(z_root() . '/wiki/' . $nick . '/' . $wiki['urlName']);
|
||||||
}
|
}
|
||||||
Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$homePage['item_id'],$r['item']['resource_id']);
|
NativeWiki::sync_a_wiki_item($owner['channel_id'],$homePage['item_id'],$r['item']['resource_id']);
|
||||||
goaway(z_root() . '/wiki/' . $nick . '/' . $wiki['urlName'] . '/' . $homePage['page']['urlName']);
|
goaway(z_root() . '/wiki/' . $nick . '/' . $wiki['urlName'] . '/' . $homePage['page']['urlName']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -516,7 +525,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
return; //not reached
|
return; //not reached
|
||||||
}
|
}
|
||||||
|
|
||||||
$wiki = Zlib\NativeWiki::exists_by_name($owner['channel_id'], urldecode($arr['urlName']));
|
$wiki = NativeWiki::exists_by_name($owner['channel_id'], urldecode($arr['urlName']));
|
||||||
|
|
||||||
if($wiki['resource_id']) {
|
if($wiki['resource_id']) {
|
||||||
|
|
||||||
@ -525,9 +534,9 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
$acl = new \Zotlabs\Access\AccessList($owner);
|
$acl = new \Zotlabs\Access\AccessList($owner);
|
||||||
$acl->set_from_array($_POST);
|
$acl->set_from_array($_POST);
|
||||||
|
|
||||||
$r = Zlib\NativeWiki::update_wiki($owner['channel_id'], $observer_hash, $arr, $acl);
|
$r = NativeWiki::update_wiki($owner['channel_id'], $observer_hash, $arr, $acl);
|
||||||
if($r['success']) {
|
if($r['success']) {
|
||||||
Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$r['item_id'],$r['item']['resource_id']);
|
NativeWiki::sync_a_wiki_item($owner['channel_id'],$r['item_id'],$r['item']['resource_id']);
|
||||||
goaway(z_root() . '/wiki/' . $nick);
|
goaway(z_root() . '/wiki/' . $nick);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -549,9 +558,9 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
json_return_and_die(array('message' => t('Wiki delete permission denied.'), 'success' => false));
|
json_return_and_die(array('message' => t('Wiki delete permission denied.'), 'success' => false));
|
||||||
}
|
}
|
||||||
$resource_id = $_POST['resource_id'];
|
$resource_id = $_POST['resource_id'];
|
||||||
$deleted = Zlib\NativeWiki::delete_wiki($owner['channel_id'],$observer_hash,$resource_id);
|
$deleted = NativeWiki::delete_wiki($owner['channel_id'],$observer_hash,$resource_id);
|
||||||
if ($deleted['success']) {
|
if ($deleted['success']) {
|
||||||
Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$deleted['item_id'],$resource_id);
|
NativeWiki::sync_a_wiki_item($owner['channel_id'],$deleted['item_id'],$resource_id);
|
||||||
json_return_and_die(array('message' => '', 'success' => true));
|
json_return_and_die(array('message' => '', 'success' => true));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -570,7 +579,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
// Determine if observer has permission to create a page
|
// Determine if observer has permission to create a page
|
||||||
|
|
||||||
|
|
||||||
$perms = Zlib\NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash, $mimetype);
|
$perms = NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash, $mimetype);
|
||||||
if(! $perms['write']) {
|
if(! $perms['write']) {
|
||||||
logger('Wiki write permission denied. ' . EOL);
|
logger('Wiki write permission denied. ' . EOL);
|
||||||
json_return_and_die(array('success' => false));
|
json_return_and_die(array('success' => false));
|
||||||
@ -585,10 +594,10 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
json_return_and_die(array('message' => 'Error creating page. Invalid name (' . print_r($_POST,true) . ').', 'success' => false));
|
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);
|
$page = NativeWikiPage::create_page($owner['channel_id'],$observer_hash, $name, $resource_id, $mimetype);
|
||||||
|
|
||||||
if($page['item_id']) {
|
if($page['item_id']) {
|
||||||
$commit = Zlib\NativeWikiPage::commit(array(
|
$commit = NativeWikiPage::commit(array(
|
||||||
'commit_msg' => t('New page created'),
|
'commit_msg' => t('New page created'),
|
||||||
'resource_id' => $resource_id,
|
'resource_id' => $resource_id,
|
||||||
'channel_id' => $owner['channel_id'],
|
'channel_id' => $owner['channel_id'],
|
||||||
@ -597,7 +606,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
));
|
));
|
||||||
|
|
||||||
if($commit['success']) {
|
if($commit['success']) {
|
||||||
Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id'],$resource_id);
|
NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id'],$resource_id);
|
||||||
json_return_and_die(array('url' => '/' . argv(0) . '/' . argv(1) . '/' . urlencode($page['wiki']['urlName']) . '/' . urlencode($page['page']['urlName']), 'success' => true));
|
json_return_and_die(array('url' => '/' . argv(0) . '/' . argv(1) . '/' . urlencode($page['wiki']['urlName']) . '/' . urlencode($page['page']['urlName']), 'success' => true));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -616,7 +625,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
if((argc() === 5) && (argv(2) === 'get') && (argv(3) === 'page') && (argv(4) === 'list')) {
|
if((argc() === 5) && (argv(2) === 'get') && (argv(3) === 'page') && (argv(4) === 'list')) {
|
||||||
$resource_id = $_POST['resource_id']; // resource_id for wiki in db
|
$resource_id = $_POST['resource_id']; // resource_id for wiki in db
|
||||||
|
|
||||||
$perms = Zlib\NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
$perms = NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
||||||
if(!$perms['read']) {
|
if(!$perms['read']) {
|
||||||
logger('Wiki read permission denied.' . EOL);
|
logger('Wiki read permission denied.' . EOL);
|
||||||
json_return_and_die(array('pages' => null, 'message' => 'Permission denied.', 'success' => false));
|
json_return_and_die(array('pages' => null, 'message' => 'Permission denied.', 'success' => false));
|
||||||
@ -648,16 +657,16 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determine if observer has permission to save content
|
// Determine if observer has permission to save content
|
||||||
$perms = Zlib\NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
$perms = NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
||||||
if(! $perms['write']) {
|
if(! $perms['write']) {
|
||||||
logger('Wiki write permission denied. ' . EOL);
|
logger('Wiki write permission denied. ' . EOL);
|
||||||
json_return_and_die(array('success' => false));
|
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));
|
$saved = NativeWikiPage::save_page(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName, 'content' => $content));
|
||||||
|
|
||||||
if($saved['success']) {
|
if($saved['success']) {
|
||||||
$commit = Zlib\NativeWikiPage::commit(array(
|
$commit = NativeWikiPage::commit(array(
|
||||||
'commit_msg' => $commitMsg,
|
'commit_msg' => $commitMsg,
|
||||||
'pageUrlName' => $pageUrlName,
|
'pageUrlName' => $pageUrlName,
|
||||||
'resource_id' => $resource_id,
|
'resource_id' => $resource_id,
|
||||||
@ -667,7 +676,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
));
|
));
|
||||||
|
|
||||||
if($commit['success']) {
|
if($commit['success']) {
|
||||||
Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id'],$resource_id);
|
NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id'],$resource_id);
|
||||||
json_return_and_die(array('message' => 'Wiki git repo commit made', 'success' => true));
|
json_return_and_die(array('message' => 'Wiki git repo commit made', 'success' => true));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -688,7 +697,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
// Determine if observer has permission to read content
|
// Determine if observer has permission to read content
|
||||||
|
|
||||||
$perms = Zlib\NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
$perms = NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
||||||
if(! $perms['read']) {
|
if(! $perms['read']) {
|
||||||
logger('Wiki read permission denied.' . EOL);
|
logger('Wiki read permission denied.' . EOL);
|
||||||
json_return_and_die(array('historyHTML' => '', 'message' => 'Permission denied.', 'success' => false));
|
json_return_and_die(array('historyHTML' => '', 'message' => 'Permission denied.', 'success' => false));
|
||||||
@ -720,15 +729,15 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
json_return_and_die(array('success' => false));
|
json_return_and_die(array('success' => false));
|
||||||
}
|
}
|
||||||
|
|
||||||
$perms = Zlib\NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
$perms = NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
||||||
if(! $perms['write']) {
|
if(! $perms['write']) {
|
||||||
logger('Wiki write permission denied. ' . EOL);
|
logger('Wiki write permission denied. ' . EOL);
|
||||||
json_return_and_die(array('success' => false));
|
json_return_and_die(array('success' => false));
|
||||||
}
|
}
|
||||||
|
|
||||||
$deleted = Zlib\NativeWikiPage::delete_page(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName));
|
$deleted = NativeWikiPage::delete_page(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName));
|
||||||
if($deleted['success']) {
|
if($deleted['success']) {
|
||||||
Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id'],$resource_id);
|
NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id'],$resource_id);
|
||||||
json_return_and_die(array('message' => 'Wiki git repo commit made', 'success' => true));
|
json_return_and_die(array('message' => 'Wiki git repo commit made', 'success' => true));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -744,13 +753,13 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
$commitHash = $_POST['commitHash'];
|
$commitHash = $_POST['commitHash'];
|
||||||
// Determine if observer has permission to revert pages
|
// Determine if observer has permission to revert pages
|
||||||
|
|
||||||
$perms = Zlib\NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
$perms = NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
||||||
if(! $perms['write']) {
|
if(! $perms['write']) {
|
||||||
logger('Wiki write permission denied.' . EOL);
|
logger('Wiki write permission denied.' . EOL);
|
||||||
json_return_and_die(array('success' => false));
|
json_return_and_die(array('success' => false));
|
||||||
}
|
}
|
||||||
|
|
||||||
$reverted = Zlib\NativeWikiPage::revert_page(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'commitHash' => $commitHash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName));
|
$reverted = NativeWikiPage::revert_page(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'commitHash' => $commitHash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName));
|
||||||
if($reverted['success']) {
|
if($reverted['success']) {
|
||||||
json_return_and_die(array('content' => $reverted['content'], 'message' => '', 'success' => true));
|
json_return_and_die(array('content' => $reverted['content'], 'message' => '', 'success' => true));
|
||||||
} else {
|
} else {
|
||||||
@ -766,13 +775,13 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
$currentCommit = $_POST['currentCommit'];
|
$currentCommit = $_POST['currentCommit'];
|
||||||
// Determine if observer has permission to revert pages
|
// Determine if observer has permission to revert pages
|
||||||
|
|
||||||
$perms = Zlib\NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
$perms = NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
||||||
if(!$perms['read']) {
|
if(!$perms['read']) {
|
||||||
logger('Wiki read permission denied.' . EOL);
|
logger('Wiki read permission denied.' . EOL);
|
||||||
json_return_and_die(array('success' => false));
|
json_return_and_die(array('success' => false));
|
||||||
}
|
}
|
||||||
|
|
||||||
$compare = Zlib\NativeWikiPage::compare_page(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'currentCommit' => $currentCommit, 'compareCommit' => $compareCommit, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName));
|
$compare = NativeWikiPage::compare_page(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'currentCommit' => $currentCommit, 'compareCommit' => $compareCommit, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName));
|
||||||
if($compare['success']) {
|
if($compare['success']) {
|
||||||
$diffHTML = '<table class="text-center" width="100%"><tr><td class="lead" width="50%">' . t('Current Revision') . '</td><td class="lead" width="50%">' . t('Selected Revision') . '</td></tr></table>' . $compare['diff'];
|
$diffHTML = '<table class="text-center" width="100%"><tr><td class="lead" width="50%">' . t('Current Revision') . '</td><td class="lead" width="50%">' . t('Selected Revision') . '</td></tr></table>' . $compare['diff'];
|
||||||
json_return_and_die(array('diff' => $diffHTML, 'message' => '', 'success' => true));
|
json_return_and_die(array('diff' => $diffHTML, 'message' => '', 'success' => true));
|
||||||
@ -794,16 +803,16 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
// Determine if observer has permission to rename pages
|
// Determine if observer has permission to rename pages
|
||||||
|
|
||||||
$perms = Zlib\NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
$perms = NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash);
|
||||||
if(! $perms['write']) {
|
if(! $perms['write']) {
|
||||||
logger('Wiki write permission denied. ' . EOL);
|
logger('Wiki write permission denied. ' . EOL);
|
||||||
json_return_and_die(array('success' => false));
|
json_return_and_die(array('success' => false));
|
||||||
}
|
}
|
||||||
|
|
||||||
$renamed = Zlib\NativeWikiPage::rename_page(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName, 'pageNewName' => $pageNewName));
|
$renamed = NativeWikiPage::rename_page(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName, 'pageNewName' => $pageNewName));
|
||||||
|
|
||||||
if($renamed['success']) {
|
if($renamed['success']) {
|
||||||
$commit = Zlib\NativeWikiPage::commit(array(
|
$commit = NativeWikiPage::commit(array(
|
||||||
'channel_id' => $owner['channel_id'],
|
'channel_id' => $owner['channel_id'],
|
||||||
'commit_msg' => 'Renamed ' . urldecode($pageUrlName) . ' to ' . $renamed['page']['htmlName'],
|
'commit_msg' => 'Renamed ' . urldecode($pageUrlName) . ' to ' . $renamed['page']['htmlName'],
|
||||||
'resource_id' => $resource_id,
|
'resource_id' => $resource_id,
|
||||||
@ -811,7 +820,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
'pageUrlName' => $pageNewName
|
'pageUrlName' => $pageNewName
|
||||||
));
|
));
|
||||||
if($commit['success']) {
|
if($commit['success']) {
|
||||||
Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id'],$resource_id);
|
NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id'],$resource_id);
|
||||||
json_return_and_die(array('name' => $renamed['page'], 'message' => 'Wiki git repo commit made', 'success' => true));
|
json_return_and_die(array('name' => $renamed['page'], 'message' => 'Wiki git repo commit made', 'success' => true));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -10,9 +10,9 @@ class Appstore {
|
|||||||
return replace_macros(get_markup_template('appstore.tpl'), [
|
return replace_macros(get_markup_template('appstore.tpl'), [
|
||||||
'$title' => t('App Collections'),
|
'$title' => t('App Collections'),
|
||||||
'$options' => [
|
'$options' => [
|
||||||
[ z_root() . '/apps/available', t('Available Apps'), $store ],
|
[ z_root() . '/apps', t('Installed apps'), 1 - $store ],
|
||||||
[ z_root() . '/apps', t('Installed apps'), 1 - $store ]
|
[ z_root() . '/apps/available', t('Available Apps'), $store ]
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,24 +81,6 @@ function get_features($filtered = true, $level = (-1)) {
|
|||||||
get_config('feature_lock','profile_export'),
|
get_config('feature_lock','profile_export'),
|
||||||
feature_level('profile_export',3),
|
feature_level('profile_export',3),
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
|
||||||
'webpages',
|
|
||||||
t('Web Pages'),
|
|
||||||
t('Provide managed web pages on your channel'),
|
|
||||||
false,
|
|
||||||
get_config('feature_lock','webpages'),
|
|
||||||
feature_level('webpages',3),
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
'wiki',
|
|
||||||
t('Wiki'),
|
|
||||||
t('Provide a wiki for your channel'),
|
|
||||||
false,
|
|
||||||
get_config('feature_lock','wiki'),
|
|
||||||
feature_level('wiki',2),
|
|
||||||
],
|
|
||||||
/*
|
/*
|
||||||
[
|
[
|
||||||
'hide_rating',
|
'hide_rating',
|
||||||
@ -118,15 +100,6 @@ function get_features($filtered = true, $level = (-1)) {
|
|||||||
feature_level('private_notes',1),
|
feature_level('private_notes',1),
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
|
||||||
'articles',
|
|
||||||
t('Articles'),
|
|
||||||
t('Create interactive articles'),
|
|
||||||
false,
|
|
||||||
get_config('feature_lock','articles'),
|
|
||||||
feature_level('articles',1),
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
[
|
||||||
'nav_channel_select',
|
'nav_channel_select',
|
||||||
t('Navigation Channel Select'),
|
t('Navigation Channel Select'),
|
||||||
|
Reference in New Issue
Block a user