Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
89c65de863
@ -9,6 +9,7 @@ require_once('include/security.php');
|
|||||||
require_once('include/conversation.php');
|
require_once('include/conversation.php');
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
require_once('include/permissions.php');
|
require_once('include/permissions.php');
|
||||||
|
require_once('include/PermissionDescription.php');
|
||||||
|
|
||||||
class Channel extends \Zotlabs\Web\Controller {
|
class Channel extends \Zotlabs\Web\Controller {
|
||||||
|
|
||||||
@ -126,21 +127,13 @@ function get($update = 0, $load = false) {
|
|||||||
|
|
||||||
if($perms['post_wall']) {
|
if($perms['post_wall']) {
|
||||||
|
|
||||||
// I'm trying to make two points in this description text - warn about finality of wall
|
|
||||||
// post permissions, and try to clear up confusion that these permissions set who is
|
|
||||||
// *shown* the post, istead of who is able to see the post, i.e. make it clear that clicking
|
|
||||||
// the "Show" button on a group does not post it to the feed of people in that group, it
|
|
||||||
// mearly allows those people to view the post if they are viewing/following this channel.
|
|
||||||
$aclDesc = t('Post permissions <b>cannot be changed</b> after a post is sent.</br />These permissions set who is allowed to view the post.');
|
|
||||||
$aclContextHelpCmd = 'acl_dialog_post';
|
|
||||||
|
|
||||||
$x = array(
|
$x = array(
|
||||||
'is_owner' => $is_owner,
|
'is_owner' => $is_owner,
|
||||||
'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(\App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false),
|
'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(\App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false),
|
||||||
'default_location' => (($is_owner) ? \App::$profile['channel_location'] : ''),
|
'default_location' => (($is_owner) ? \App::$profile['channel_location'] : ''),
|
||||||
'nickname' => \App::$profile['channel_address'],
|
'nickname' => \App::$profile['channel_address'],
|
||||||
'lockstate' => (((strlen(\App::$profile['channel_allow_cid'])) || (strlen(\App::$profile['channel_allow_gid'])) || (strlen(\App::$profile['channel_deny_cid'])) || (strlen(\App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'),
|
'lockstate' => (((strlen(\App::$profile['channel_allow_cid'])) || (strlen(\App::$profile['channel_allow_gid'])) || (strlen(\App::$profile['channel_deny_cid'])) || (strlen(\App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'),
|
||||||
'acl' => (($is_owner) ? populate_acl($channel_acl,true,((\App::$profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : ''), $aclDesc, $aclContextHelpCmd) : ''),
|
'acl' => (($is_owner) ? populate_acl($channel_acl,true, \PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post') : ''),
|
||||||
'showacl' => (($is_owner) ? 'yes' : ''),
|
'showacl' => (($is_owner) ? 'yes' : ''),
|
||||||
'bang' => '',
|
'bang' => '',
|
||||||
'visitor' => (($is_owner || $observer) ? true : false),
|
'visitor' => (($is_owner || $observer) ? true : false),
|
||||||
|
@ -91,10 +91,10 @@ class Dav extends \Zotlabs\Web\Controller {
|
|||||||
$rootDirectory = new \Zotlabs\Storage\Directory('/', $auth);
|
$rootDirectory = new \Zotlabs\Storage\Directory('/', $auth);
|
||||||
|
|
||||||
// A SabreDAV server-object
|
// A SabreDAV server-object
|
||||||
$server = new \SDAV\Server($rootDirectory);
|
$server = new SDAV\Server($rootDirectory);
|
||||||
// prevent overwriting changes each other with a lock backend
|
// prevent overwriting changes each other with a lock backend
|
||||||
$lockBackend = new \SDAV\Locks\Backend\File('store/[data]/locks');
|
$lockBackend = new SDAV\Locks\Backend\File('store/[data]/locks');
|
||||||
$lockPlugin = new \SDAV\Locks\Plugin($lockBackend);
|
$lockPlugin = new SDAV\Locks\Plugin($lockBackend);
|
||||||
|
|
||||||
$server->addPlugin($lockPlugin);
|
$server->addPlugin($lockPlugin);
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ namespace Zotlabs\Module;
|
|||||||
|
|
||||||
require_once('include/identity.php');
|
require_once('include/identity.php');
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
|
require_once('include/PermissionDescription.php');
|
||||||
|
|
||||||
|
|
||||||
class Editwebpage extends \Zotlabs\Web\Controller {
|
class Editwebpage extends \Zotlabs\Web\Controller {
|
||||||
@ -195,7 +196,7 @@ class Editwebpage extends \Zotlabs\Web\Controller {
|
|||||||
'$baseurl' => z_root(),
|
'$baseurl' => z_root(),
|
||||||
'$defloc' => $itm[0]['location'],
|
'$defloc' => $itm[0]['location'],
|
||||||
'$visitor' => ($is_owner) ? true : false,
|
'$visitor' => ($is_owner) ? true : false,
|
||||||
'$acl' => populate_acl($itm[0],false),
|
'$acl' => populate_acl($itm[0],false,\PermissionDescription::fromGlobalPermission('view_pages')),
|
||||||
'$showacl' => ($is_owner) ? true : false,
|
'$showacl' => ($is_owner) ? true : false,
|
||||||
'$public' => t('Public post'),
|
'$public' => t('Public post'),
|
||||||
'$jotnets' => $jotnets,
|
'$jotnets' => $jotnets,
|
||||||
|
@ -6,6 +6,7 @@ require_once('include/bbcode.php');
|
|||||||
require_once('include/datetime.php');
|
require_once('include/datetime.php');
|
||||||
require_once('include/event.php');
|
require_once('include/event.php');
|
||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
|
require_once('include/PermissionDescription.php');
|
||||||
|
|
||||||
|
|
||||||
class Events extends \Zotlabs\Web\Controller {
|
class Events extends \Zotlabs\Web\Controller {
|
||||||
@ -237,7 +238,7 @@ class Events extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function get() {
|
function get() {
|
||||||
|
|
||||||
if(argc() > 2 && argv(1) == 'ical') {
|
if(argc() > 2 && argv(1) == 'ical') {
|
||||||
$event_id = argv(2);
|
$event_id = argv(2);
|
||||||
@ -468,7 +469,9 @@ class Events extends \Zotlabs\Web\Controller {
|
|||||||
'$share' => array('share', t('Share this event'), $sh_checked, '', array(t('No'),t('Yes'))),
|
'$share' => array('share', t('Share this event'), $sh_checked, '', array(t('No'),t('Yes'))),
|
||||||
'$preview' => t('Preview'),
|
'$preview' => t('Preview'),
|
||||||
'$permissions' => t('Permission settings'),
|
'$permissions' => t('Permission settings'),
|
||||||
'$acl' => (($orig_event['event_xchan']) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $perm_defaults),false)),
|
// populating the acl dialog was a permission description from view_stream because Cal.php, which
|
||||||
|
// displays events, says "since we don't currently have an event permission - use the stream permission"
|
||||||
|
'$acl' => (($orig_event['event_xchan']) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $perm_defaults), false, \PermissionDescription::fromGlobalPermission('view_stream'))),
|
||||||
'$submit' => t('Submit'),
|
'$submit' => t('Submit'),
|
||||||
'$advanced' => t('Advanced Options')
|
'$advanced' => t('Advanced Options')
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ namespace Zotlabs\Module;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require_once('include/attach.php');
|
require_once('include/attach.php');
|
||||||
|
require_once('include/PermissionDescription.php');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -132,7 +134,7 @@ class Filestorage extends \Zotlabs\Web\Controller {
|
|||||||
$cloudpath = get_cloudpath($f) . (intval($f['is_dir']) ? '?f=&davguest=1' : '');
|
$cloudpath = get_cloudpath($f) . (intval($f['is_dir']) ? '?f=&davguest=1' : '');
|
||||||
$parentpath = get_parent_cloudpath($channel['channel_id'], $channel['channel_address'], $f['hash']);
|
$parentpath = get_parent_cloudpath($channel['channel_id'], $channel['channel_address'], $f['hash']);
|
||||||
|
|
||||||
$aclselect_e = populate_acl($f, false);
|
$aclselect_e = populate_acl($f, false, \PermissionDescription::fromGlobalPermission('view_storage'));
|
||||||
$is_a_dir = (intval($f['is_dir']) ? true : false);
|
$is_a_dir = (intval($f['is_dir']) ? true : false);
|
||||||
|
|
||||||
$lockstate = (($f['allow_cid'] || $f['allow_gid'] || $f['deny_cid'] || $f['deny_gid']) ? 'lock' : 'unlock');
|
$lockstate = (($f['allow_cid'] || $f['allow_gid'] || $f['deny_cid'] || $f['deny_gid']) ? 'lock' : 'unlock');
|
||||||
|
@ -6,6 +6,7 @@ require_once('include/group.php');
|
|||||||
require_once('include/contact_widgets.php');
|
require_once('include/contact_widgets.php');
|
||||||
require_once('include/conversation.php');
|
require_once('include/conversation.php');
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
|
require_once('include/PermissionDescription.php');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -155,14 +156,6 @@ class Network extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
nav_set_selected('network');
|
nav_set_selected('network');
|
||||||
|
|
||||||
// I'm trying to make two points in this description text - warn about finality of wall
|
|
||||||
// post permissions, and try to clear up confusion that these permissions set who is
|
|
||||||
// *shown* the post, istead of who is able to see the post, i.e. make it clear that clicking
|
|
||||||
// the "Show" button on a group does not post it to the feed of people in that group, it
|
|
||||||
// mearly allows those people to view the post if they are viewing/following this channel.
|
|
||||||
$aclDesc = t('Post permissions <b>cannot be changed</b> after a post is sent.</br />These permissions set who is allowed to view the post.');
|
|
||||||
$aclContextHelpCmd = 'acl_dialog_post';
|
|
||||||
|
|
||||||
$channel_acl = array(
|
$channel_acl = array(
|
||||||
'allow_cid' => $channel['channel_allow_cid'],
|
'allow_cid' => $channel['channel_allow_cid'],
|
||||||
'allow_gid' => $channel['channel_allow_gid'],
|
'allow_gid' => $channel['channel_allow_gid'],
|
||||||
@ -178,7 +171,7 @@ class Network extends \Zotlabs\Web\Controller {
|
|||||||
'default_location' => $channel['channel_location'],
|
'default_location' => $channel['channel_location'],
|
||||||
'nickname' => $channel['channel_address'],
|
'nickname' => $channel['channel_address'],
|
||||||
'lockstate' => (($private_editing || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
'lockstate' => (($private_editing || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
||||||
'acl' => populate_acl((($private_editing) ? $def_acl : $channel_acl), true, (($channel['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : ''), $aclDesc, $aclContextHelpCmd),
|
'acl' => populate_acl((($private_editing) ? $def_acl : $channel_acl), true, \PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
|
||||||
'bang' => (($private_editing) ? '!' : ''),
|
'bang' => (($private_editing) ? '!' : ''),
|
||||||
'visitor' => true,
|
'visitor' => true,
|
||||||
'profile_uid' => local_channel(),
|
'profile_uid' => local_channel(),
|
||||||
|
@ -99,9 +99,9 @@ class Page extends \Zotlabs\Web\Controller {
|
|||||||
\App::$page['title'] = escape_tags($r[0]['title']);
|
\App::$page['title'] = escape_tags($r[0]['title']);
|
||||||
|
|
||||||
if($r[0]['item_type'] == ITEM_TYPE_PDL) {
|
if($r[0]['item_type'] == ITEM_TYPE_PDL) {
|
||||||
require_once('include/comanche.php');
|
\App::$comanche = new \Zotlabs\Render\Comanche();
|
||||||
comanche_parser(get_app(),$r[0]['body']);
|
\App::$comanche->parse($r[0]['body']);
|
||||||
\App::$pdl = $r[0]['body'];
|
\App::$pdl = $r[0]['body'];
|
||||||
}
|
}
|
||||||
elseif($r[0]['layout_mid']) {
|
elseif($r[0]['layout_mid']) {
|
||||||
$l = q("select body from item where mid = '%s' and uid = %d limit 1",
|
$l = q("select body from item where mid = '%s' and uid = %d limit 1",
|
||||||
@ -110,8 +110,8 @@ class Page extends \Zotlabs\Web\Controller {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if($l) {
|
if($l) {
|
||||||
require_once('include/comanche.php');
|
\App::$comanche = new \Zotlabs\Render\Comanche();
|
||||||
comanche_parser(get_app(),$l[0]['body']);
|
\App::$comanche->parse($l[0]['body']);
|
||||||
\App::$pdl = $l[0]['body'];
|
\App::$pdl = $l[0]['body'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ require_once('include/security.php');
|
|||||||
require_once('include/Contact.php');
|
require_once('include/Contact.php');
|
||||||
require_once('include/attach.php');
|
require_once('include/attach.php');
|
||||||
require_once('include/text.php');
|
require_once('include/text.php');
|
||||||
|
require_once('include/PermissionDescription.php');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -632,7 +633,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||||||
$lockstate = (($acl->is_private()) ? 'lock' : 'unlock');
|
$lockstate = (($acl->is_private()) ? 'lock' : 'unlock');
|
||||||
}
|
}
|
||||||
|
|
||||||
$aclselect = (($_is_owner) ? populate_acl($channel_acl,false) : '');
|
$aclselect = (($_is_owner) ? populate_acl($channel_acl,false, \PermissionDescription::fromGlobalPermission('view_storage')) : '');
|
||||||
|
|
||||||
// this is wrong but is to work around an issue with js_upload wherein it chokes if these variables
|
// this is wrong but is to work around an issue with js_upload wherein it chokes if these variables
|
||||||
// don't exist. They really should be set to a parseable representation of the channel's default permissions
|
// don't exist. They really should be set to a parseable representation of the channel's default permissions
|
||||||
@ -1022,7 +1023,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||||||
if($can_post) {
|
if($can_post) {
|
||||||
$album_e = $ph[0]['album'];
|
$album_e = $ph[0]['album'];
|
||||||
$caption_e = $ph[0]['description'];
|
$caption_e = $ph[0]['description'];
|
||||||
$aclselect_e = (($_is_owner) ? populate_acl($ph[0]) : '');
|
$aclselect_e = (($_is_owner) ? populate_acl($ph[0], true, \PermissionDescription::fromGlobalPermission('view_storage')) : '');
|
||||||
$albums = ((array_key_exists('albums', \App::$data)) ? \App::$data['albums'] : photos_albums_list(\App::$data['channel'],\App::$data['observer']));
|
$albums = ((array_key_exists('albums', \App::$data)) ? \App::$data['albums'] : photos_albums_list(\App::$data['channel'],\App::$data['observer']));
|
||||||
|
|
||||||
$_SESSION['album_return'] = bin2hex($ph[0]['album']);
|
$_SESSION['album_return'] = bin2hex($ph[0]['album']);
|
||||||
|
@ -7,6 +7,7 @@ require_once('include/items.php');
|
|||||||
require_once('include/taxonomy.php');
|
require_once('include/taxonomy.php');
|
||||||
require_once('include/conversation.php');
|
require_once('include/conversation.php');
|
||||||
require_once('include/zot.php');
|
require_once('include/zot.php');
|
||||||
|
require_once('include/PermissionDescription.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* remote post
|
* remote post
|
||||||
@ -115,7 +116,7 @@ class Rpost extends \Zotlabs\Web\Controller {
|
|||||||
'default_location' => $channel['channel_location'],
|
'default_location' => $channel['channel_location'],
|
||||||
'nickname' => $channel['channel_address'],
|
'nickname' => $channel['channel_address'],
|
||||||
'lockstate' => (($acl->is_private()) ? 'lock' : 'unlock'),
|
'lockstate' => (($acl->is_private()) ? 'lock' : 'unlock'),
|
||||||
'acl' => populate_acl($channel_acl,true,(($channel['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')),
|
'acl' => populate_acl($channel_acl, true, \PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
|
||||||
'bang' => '',
|
'bang' => '',
|
||||||
'visitor' => true,
|
'visitor' => true,
|
||||||
'profile_uid' => local_channel(),
|
'profile_uid' => local_channel(),
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
namespace Zotlabs\Module; /** @file */
|
namespace Zotlabs\Module; /** @file */
|
||||||
|
|
||||||
require_once('include/zot.php');
|
require_once('include/zot.php');
|
||||||
|
require_once('include/PermissionDescription.php');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Settings extends \Zotlabs\Web\Controller {
|
class Settings extends \Zotlabs\Web\Controller {
|
||||||
@ -1064,7 +1066,7 @@ class Settings extends \Zotlabs\Web\Controller {
|
|||||||
'$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']) , t('May reduce spam activity')),
|
'$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']) , t('May reduce spam activity')),
|
||||||
'$permissions' => t('Default Post Permissions'),
|
'$permissions' => t('Default Post Permissions'),
|
||||||
'$permdesc' => t("\x28click to open/close\x29"),
|
'$permdesc' => t("\x28click to open/close\x29"),
|
||||||
'$aclselect' => populate_acl($perm_defaults,false),
|
'$aclselect' => populate_acl($perm_defaults, false, \PermissionDescription::fromDescription(t('Use my default audience setting for the type of channel'))),
|
||||||
'$suggestme' => $suggestme,
|
'$suggestme' => $suggestme,
|
||||||
'$group_select' => $group_select,
|
'$group_select' => $group_select,
|
||||||
'$role' => array('permissions_role' , t('Channel permissions category:'), $permissions_role, '', get_roles()),
|
'$role' => array('permissions_role' , t('Channel permissions category:'), $permissions_role, '', get_roles()),
|
||||||
|
@ -407,6 +407,11 @@ class Setup extends \Zotlabs\Web\Controller {
|
|||||||
function check_php(&$phpath, &$checks) {
|
function check_php(&$phpath, &$checks) {
|
||||||
$help = '';
|
$help = '';
|
||||||
|
|
||||||
|
if(version_compare(PHP_VERSION, '5.4') < 0) {
|
||||||
|
$help .= t('PHP version 5.4 or greater is required.');
|
||||||
|
$this->check_add($checks, t('PHP version'), false, false, $help);
|
||||||
|
}
|
||||||
|
|
||||||
if (strlen($phpath)) {
|
if (strlen($phpath)) {
|
||||||
$passed = file_exists($phpath);
|
$passed = file_exists($phpath);
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,6 +4,7 @@ namespace Zotlabs\Module;
|
|||||||
require_once('include/identity.php');
|
require_once('include/identity.php');
|
||||||
require_once('include/conversation.php');
|
require_once('include/conversation.php');
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
|
require_once('include/PermissionDescription.php');
|
||||||
|
|
||||||
|
|
||||||
class Webpages extends \Zotlabs\Web\Controller {
|
class Webpages extends \Zotlabs\Web\Controller {
|
||||||
@ -111,7 +112,7 @@ class Webpages extends \Zotlabs\Web\Controller {
|
|||||||
'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'),
|
||||||
'bang' => '',
|
'bang' => '',
|
||||||
'acl' => (($is_owner) ? populate_acl($channel_acl,false) : ''),
|
'acl' => (($is_owner) ? populate_acl($channel_acl,false, \PermissionDescription::fromGlobalPermission('view_pages')) : ''),
|
||||||
'showacl' => (($is_owner) ? true : false),
|
'showacl' => (($is_owner) ? true : false),
|
||||||
'visitor' => true,
|
'visitor' => true,
|
||||||
'profile_uid' => intval($owner),
|
'profile_uid' => intval($owner),
|
||||||
|
404
Zotlabs/Render/Comanche.php
Normal file
404
Zotlabs/Render/Comanche.php
Normal file
@ -0,0 +1,404 @@
|
|||||||
|
<?php /** @file */
|
||||||
|
|
||||||
|
namespace Zotlabs\Render;
|
||||||
|
|
||||||
|
require_once('include/security.php');
|
||||||
|
require_once('include/menu.php');
|
||||||
|
require_once('include/widgets.php');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Comanche {
|
||||||
|
|
||||||
|
|
||||||
|
function parse($s, $pass = 0) {
|
||||||
|
$matches = array();
|
||||||
|
|
||||||
|
$cnt = preg_match_all("/\[comment\](.*?)\[\/comment\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$s = str_replace($mtch[0], '', $s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cnt = preg_match_all("/\[if (.*?)\](.*?)\[else\](.*?)\[\/if\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
if($this->test_condition($mtch[1])) {
|
||||||
|
$s = str_replace($mtch[0], $mtch[2], $s);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$s = str_replace($mtch[0], $mtch[3], $s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$cnt = preg_match_all("/\[if (.*?)\](.*?)\[\/if\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
if($this->test_condition($mtch[1])) {
|
||||||
|
$s = str_replace($mtch[0], $mtch[2], $s);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$s = str_replace($mtch[0], '', $s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($pass == 0)
|
||||||
|
$this->parse_pass0($s);
|
||||||
|
else
|
||||||
|
$this->parse_pass1($s);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function parse_pass0($s) {
|
||||||
|
|
||||||
|
$matches = null;
|
||||||
|
|
||||||
|
$cnt = preg_match("/\[layout\](.*?)\[\/layout\]/ism", $s, $matches);
|
||||||
|
if($cnt)
|
||||||
|
\App::$page['template'] = trim($matches[1]);
|
||||||
|
|
||||||
|
$cnt = preg_match("/\[template=(.*?)\](.*?)\[\/template\]/ism", $s, $matches);
|
||||||
|
if($cnt) {
|
||||||
|
\App::$page['template'] = trim($matches[2]);
|
||||||
|
\App::$page['template_style'] = trim($matches[2]) . '_' . $matches[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
$cnt = preg_match("/\[template\](.*?)\[\/template\]/ism", $s, $matches);
|
||||||
|
if($cnt) {
|
||||||
|
\App::$page['template'] = trim($matches[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$cnt = preg_match("/\[theme=(.*?)\](.*?)\[\/theme\]/ism", $s, $matches);
|
||||||
|
if($cnt) {
|
||||||
|
\App::$layout['schema'] = trim($matches[1]);
|
||||||
|
\App::$layout['theme'] = trim($matches[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$cnt = preg_match("/\[theme\](.*?)\[\/theme\]/ism", $s, $matches);
|
||||||
|
if($cnt)
|
||||||
|
\App::$layout['theme'] = trim($matches[1]);
|
||||||
|
|
||||||
|
$cnt = preg_match_all("/\[webpage\](.*?)\[\/webpage\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
// only the last webpage definition is used if there is more than one
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
\App::$layout['webpage'] = $this->webpage($a,$mtch[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parse_pass1($s) {
|
||||||
|
$cnt = preg_match_all("/\[region=(.*?)\](.*?)\[\/region\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
\App::$layout['region_' . $mtch[1]] = $this->region($mtch[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function test_condition($s) {
|
||||||
|
|
||||||
|
// This is extensible. The first version of variable testing supports tests of the form
|
||||||
|
// [if $config.system.foo] which will check for a return of a true condition for get_config('system','foo');
|
||||||
|
// The values 0, '', an empty array, and an unset value will all evaluate to false.
|
||||||
|
|
||||||
|
if(preg_match("/[\$]config[\.](.*?)/",$s,$matches)) {
|
||||||
|
$x = explode('.',$s);
|
||||||
|
if(get_config($x[1],$x[2]))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function menu($s, $class = '') {
|
||||||
|
|
||||||
|
$channel_id = $this->get_channel_id();
|
||||||
|
$name = $s;
|
||||||
|
|
||||||
|
$cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$var[$mtch[1]] = $mtch[2];
|
||||||
|
$name = str_replace($mtch[0], '', $name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($channel_id) {
|
||||||
|
$m = menu_fetch($name,$channel_id, get_observer_hash());
|
||||||
|
return menu_render($m, $class, $edit = false, $var);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function replace_region($match) {
|
||||||
|
if (array_key_exists($match[1], \App::$page)) {
|
||||||
|
return \App::$page[$match[1]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the channel_id of the profile owner of the page.
|
||||||
|
*
|
||||||
|
* Returns the channel_id of the profile owner of the page, or the local_channel
|
||||||
|
* if there is no profile owner. Otherwise returns 0.
|
||||||
|
*
|
||||||
|
* @return channel_id
|
||||||
|
*/
|
||||||
|
|
||||||
|
function get_channel_id() {
|
||||||
|
$channel_id = ((is_array(\App::$profile)) ? \App::$profile['profile_uid'] : 0);
|
||||||
|
|
||||||
|
if ((! $channel_id) && (local_channel()))
|
||||||
|
$channel_id = local_channel();
|
||||||
|
|
||||||
|
return $channel_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
function block($s, $class = '') {
|
||||||
|
$var = array();
|
||||||
|
$matches = array();
|
||||||
|
$name = $s;
|
||||||
|
$class = (($class) ? $class : 'bblock widget');
|
||||||
|
|
||||||
|
$cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$var[$mtch[1]] = $mtch[2];
|
||||||
|
$name = str_replace($mtch[0], '', $name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$o = '';
|
||||||
|
$channel_id = $this->get_channel_id();
|
||||||
|
|
||||||
|
if($channel_id) {
|
||||||
|
$r = q("select * from item inner join item_id on iid = item.id and item_id.uid = item.uid and item.uid = %d and service = 'BUILDBLOCK' and sid = '%s' limit 1",
|
||||||
|
intval($channel_id),
|
||||||
|
dbesc($name)
|
||||||
|
);
|
||||||
|
|
||||||
|
if($r) {
|
||||||
|
//check for eventual menus in the block and parse them
|
||||||
|
$cnt = preg_match_all("/\[menu\](.*?)\[\/menu\]/ism", $r[0]['body'], $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$r[0]['body'] = str_replace($mtch[0], $this->menu(trim($mtch[1])), $r[0]['body']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$cnt = preg_match_all("/\[menu=(.*?)\](.*?)\[\/menu\]/ism", $r[0]['body'], $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$r[0]['body'] = str_replace($mtch[0],$this->menu(trim($mtch[2]),$mtch[1]),$r[0]['body']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//emit the block
|
||||||
|
$o .= (($var['wrap'] == 'none') ? '' : '<div class="' . $class . '">');
|
||||||
|
|
||||||
|
if($r[0]['title'] && trim($r[0]['body']) != '$content') {
|
||||||
|
$o .= '<h3>' . $r[0]['title'] . '</h3>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(trim($r[0]['body']) === '$content') {
|
||||||
|
$o .= \App::$page['content'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$o .= prepare_text($r[0]['body'], $r[0]['mimetype']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$o .= (($var['wrap'] == 'none') ? '' : '</div>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
function js($s) {
|
||||||
|
|
||||||
|
switch($s) {
|
||||||
|
case 'jquery':
|
||||||
|
$path = 'view/js/jquery.js';
|
||||||
|
break;
|
||||||
|
case 'bootstrap':
|
||||||
|
$path = 'library/bootstrap/js/bootstrap.min.js';
|
||||||
|
break;
|
||||||
|
case 'foundation':
|
||||||
|
$path = 'library/foundation/js/foundation.min.js';
|
||||||
|
$init = "\r\n" . '<script>$(document).ready(function() { $(document).foundation(); });</script>';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret = '<script src="' . z_root() . '/' . $path . '" ></script>';
|
||||||
|
if($init)
|
||||||
|
$ret .= $init;
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function css($s) {
|
||||||
|
|
||||||
|
switch($s) {
|
||||||
|
case 'bootstrap':
|
||||||
|
$path = 'library/bootstrap/css/bootstrap.min.css';
|
||||||
|
break;
|
||||||
|
case 'foundation':
|
||||||
|
$path = 'library/foundation/css/foundation.min.css';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret = '<link rel="stylesheet" href="' . z_root() . '/' . $path . '" type="text/css" media="screen">';
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// This doesn't really belong in Comanche, but it could also be argued that it is the perfect place.
|
||||||
|
// We need to be able to select what kind of template and decoration to use for the webpage at the heart of our content.
|
||||||
|
// For now we'll allow an '[authored]' element which defaults to name and date, or 'none' to remove these, and perhaps
|
||||||
|
// 'full' to provide a social network style profile photo.
|
||||||
|
// But leave it open to have richer templating options and perhaps ultimately discard this one, once we have a better idea
|
||||||
|
// of what template and webpage options we might desire.
|
||||||
|
|
||||||
|
function webpage(&$a,$s) {
|
||||||
|
$ret = array();
|
||||||
|
$matches = array();
|
||||||
|
|
||||||
|
$cnt = preg_match_all("/\[authored\](.*?)\[\/authored\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$ret['authored'] = $mtch[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Widgets will have to get any operational arguments from the session, the
|
||||||
|
* global app environment, or config storage until we implement argument passing
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @param string $text
|
||||||
|
*/
|
||||||
|
function widget($name, $text) {
|
||||||
|
$vars = array();
|
||||||
|
$matches = array();
|
||||||
|
|
||||||
|
|
||||||
|
$cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $text, $matches, PREG_SET_ORDER);
|
||||||
|
if ($cnt) {
|
||||||
|
foreach ($matches as $mtch) {
|
||||||
|
$vars[$mtch[1]] = $mtch[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$func = 'widget_' . trim($name);
|
||||||
|
|
||||||
|
if(! function_exists($func)) {
|
||||||
|
if(file_exists('widget/' . trim($name) . '.php'))
|
||||||
|
require_once('widget/' . trim($name) . '.php');
|
||||||
|
elseif(file_exists('widget/' . trim($name) . '/' . trim($name) . '.php'))
|
||||||
|
require_once('widget/' . trim($name) . '/' . trim($name) . '.php');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$theme_widget = $func . '.php';
|
||||||
|
if((! function_exists($func)) && theme_include($theme_widget))
|
||||||
|
require_once(theme_include($theme_widget));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (function_exists($func))
|
||||||
|
return $func($vars);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function region($s) {
|
||||||
|
|
||||||
|
$matches = array();
|
||||||
|
|
||||||
|
$cnt = preg_match_all("/\[menu\](.*?)\[\/menu\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$s = str_replace($mtch[0], $this->menu(trim($mtch[1])), $s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// menu class e.g. [menu=horizontal]my_menu[/menu] or [menu=tabbed]my_menu[/menu]
|
||||||
|
// allows different menu renderings to be applied
|
||||||
|
|
||||||
|
$cnt = preg_match_all("/\[menu=(.*?)\](.*?)\[\/menu\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$s = str_replace($mtch[0],$this->menu(trim($mtch[2]),$mtch[1]),$s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$cnt = preg_match_all("/\[block\](.*?)\[\/block\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$s = str_replace($mtch[0],$this->block(trim($mtch[1])),$s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cnt = preg_match_all("/\[block=(.*?)\](.*?)\[\/block\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$s = str_replace($mtch[0],$this->block(trim($mtch[2]),trim($mtch[1])),$s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cnt = preg_match_all("/\[js\](.*?)\[\/js\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$s = str_replace($mtch[0],$this->js(trim($mtch[1])),$s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cnt = preg_match_all("/\[css\](.*?)\[\/css\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$s = str_replace($mtch[0],$this->css(trim($mtch[1])),$s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// need to modify this to accept parameters
|
||||||
|
|
||||||
|
$cnt = preg_match_all("/\[widget=(.*?)\](.*?)\[\/widget\]/ism", $s, $matches, PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$s = str_replace($mtch[0],$this->widget(trim($mtch[1]),$mtch[2]),$s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @function register_page_template($arr)
|
||||||
|
* Registers a page template/variant for use by Comanche selectors
|
||||||
|
* @param array $arr
|
||||||
|
* 'template' => template name
|
||||||
|
* 'variant' => array(
|
||||||
|
* 'name' => variant name
|
||||||
|
* 'desc' => text description
|
||||||
|
* 'regions' => array(
|
||||||
|
* 'name' => name
|
||||||
|
* 'desc' => text description
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function register_page_template($arr) {
|
||||||
|
\App::$page_layouts[$arr['template']] = array($arr['variant']);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
35
boot.php
35
boot.php
@ -313,15 +313,14 @@ define ( 'PERMS_A_REPUBLISH', 0x10000);
|
|||||||
define ( 'PERMS_W_LIKE', 0x20000);
|
define ( 'PERMS_W_LIKE', 0x20000);
|
||||||
|
|
||||||
// General channel permissions
|
// General channel permissions
|
||||||
|
// 0 = Only you
|
||||||
define ( 'PERMS_PUBLIC' , 0x0001 );
|
define ( 'PERMS_PUBLIC' , 0x0001 ); // anybody
|
||||||
define ( 'PERMS_NETWORK' , 0x0002 );
|
define ( 'PERMS_NETWORK' , 0x0002 ); // anybody in this network
|
||||||
define ( 'PERMS_SITE' , 0x0004 );
|
define ( 'PERMS_SITE' , 0x0004 ); // anybody on this site
|
||||||
define ( 'PERMS_CONTACTS' , 0x0008 );
|
define ( 'PERMS_CONTACTS' , 0x0008 ); // any of my connections
|
||||||
define ( 'PERMS_SPECIFIC' , 0x0080 );
|
define ( 'PERMS_SPECIFIC' , 0x0080 ); // only specific connections
|
||||||
define ( 'PERMS_AUTHED' , 0x0100 );
|
define ( 'PERMS_AUTHED' , 0x0100 ); // anybody authenticated (could include visitors from other networks)
|
||||||
define ( 'PERMS_PENDING' , 0x0200 );
|
define ( 'PERMS_PENDING' , 0x0200 ); // any connections including those who haven't yet been approved
|
||||||
|
|
||||||
|
|
||||||
// Address book flags
|
// Address book flags
|
||||||
|
|
||||||
@ -724,6 +723,7 @@ class App {
|
|||||||
public static $nav_sel;
|
public static $nav_sel;
|
||||||
public static $is_mobile = false;
|
public static $is_mobile = false;
|
||||||
public static $is_tablet = false;
|
public static $is_tablet = false;
|
||||||
|
public static $comanche;
|
||||||
|
|
||||||
public static $category;
|
public static $category;
|
||||||
|
|
||||||
@ -2111,7 +2111,10 @@ function get_custom_nav(&$a, $navname) {
|
|||||||
* @param App &$a global application object
|
* @param App &$a global application object
|
||||||
*/
|
*/
|
||||||
function load_pdl(&$a) {
|
function load_pdl(&$a) {
|
||||||
require_once('include/comanche.php');
|
|
||||||
|
App::$comanche = new Zotlabs\Render\Comanche();
|
||||||
|
|
||||||
|
// require_once('include/comanche.php');
|
||||||
|
|
||||||
if (! count(App::$layout)) {
|
if (! count(App::$layout)) {
|
||||||
|
|
||||||
@ -2120,7 +2123,7 @@ function load_pdl(&$a) {
|
|||||||
$layout = $arr['layout'];
|
$layout = $arr['layout'];
|
||||||
|
|
||||||
$n = 'mod_' . App::$module . '.pdl' ;
|
$n = 'mod_' . App::$module . '.pdl' ;
|
||||||
$u = comanche_get_channel_id();
|
$u = App::$comanche->get_channel_id();
|
||||||
if($u)
|
if($u)
|
||||||
$s = get_pconfig($u, 'system', $n);
|
$s = get_pconfig($u, 'system', $n);
|
||||||
if(! $s)
|
if(! $s)
|
||||||
@ -2129,7 +2132,7 @@ function load_pdl(&$a) {
|
|||||||
if((! $s) && (($p = theme_include($n)) != ''))
|
if((! $s) && (($p = theme_include($n)) != ''))
|
||||||
$s = @file_get_contents($p);
|
$s = @file_get_contents($p);
|
||||||
if($s) {
|
if($s) {
|
||||||
comanche_parser($a, $s);
|
App::$comanche->parse($s);
|
||||||
App::$pdl = $s;
|
App::$pdl = $s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2138,10 +2141,10 @@ function load_pdl(&$a) {
|
|||||||
|
|
||||||
|
|
||||||
function exec_pdl(&$a) {
|
function exec_pdl(&$a) {
|
||||||
require_once('include/comanche.php');
|
// require_once('include/comanche.php');
|
||||||
|
|
||||||
if(App::$pdl) {
|
if(App::$pdl) {
|
||||||
comanche_parser($a, App::$pdl,1);
|
App::$comanche->parse(App::$pdl,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2196,7 +2199,7 @@ function construct_page(&$a) {
|
|||||||
App::build_pagehead();
|
App::build_pagehead();
|
||||||
|
|
||||||
if(App::$page['pdl_content']) {
|
if(App::$page['pdl_content']) {
|
||||||
App::$page['content'] = comanche_region($a,App::$page['content']);
|
App::$page['content'] = App::$comanche->region(App::$page['content']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's say we have a comanche declaration '[region=nav][/region][region=content]$nav $content[/region]'.
|
// Let's say we have a comanche declaration '[region=nav][/region][region=content]$nav $content[/region]'.
|
||||||
@ -2217,7 +2220,7 @@ function construct_page(&$a) {
|
|||||||
foreach(App::$layout as $k => $v) {
|
foreach(App::$layout as $k => $v) {
|
||||||
if((strpos($k, 'region_') === 0) && strlen($v)) {
|
if((strpos($k, 'region_') === 0) && strlen($v)) {
|
||||||
if(strpos($v, '$region_') !== false) {
|
if(strpos($v, '$region_') !== false) {
|
||||||
$v = preg_replace_callback('/\$region_([a-zA-Z0-9]+)/ism', 'comanche_replace_region', $v);
|
$v = preg_replace_callback('/\$region_([a-zA-Z0-9]+)/ism', array(App::$comanche,'replace_region'), $v);
|
||||||
}
|
}
|
||||||
|
|
||||||
// And a couple of convenience macros
|
// And a couple of convenience macros
|
||||||
|
@ -5,7 +5,12 @@
|
|||||||
|
|
||||||
<p>Sometimes called Access Control List, or ACL, the permissions set who is able to see your new post.</p>
|
<p>Sometimes called Access Control List, or ACL, the permissions set who is able to see your new post.</p>
|
||||||
|
|
||||||
<p>Pressing the ACL button (<i class="fa fa-lock"></i> or <i class="fa fa-unlock"></i>) beside the Submit button will display a dialog in which you can select what channels and/or privacy groups can see the post. You can also select who is explicitly denied access. For example, say you are planning a surprise party for a friend. You can send an invitation post to everyone in your <b>Friends</b> group <i>except</i> the friend you are surprising. In this case you "Show" the <b>Friends</b> group but "Don't show" that one person.
|
<p>Pressing the ACL button (<i class="fa fa-lock"></i> or <i class="fa fa-unlock"></i>) beside the Submit button will display a dialog in which you can select what channels and/or privacy groups can see the post. You can also select who is explicitly denied access. For example, say you are planning a surprise party for a friend. You can send an invitation post to everyone in your <b>Friends</b> group <i>except</i> the friend you are surprising. In this case you "Show" the <b>Friends</b> group but "Don't show" that one person.</p>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt>Tip:</dt>
|
||||||
|
<dd>The border color of each channel indicates whether that channel — or one of the groups it belongs to — has access to the post. The border color will also indicate when a channel [or group it belongs to] has been expliciyly set to "Don't show".</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
<h3>Why can't I edit a post's permissions after I saved it?</h3>
|
<h3>Why can't I edit a post's permissions after I saved it?</h3>
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Red development - some useful basic functions
|
$Projectname development - some useful basic functions
|
||||||
=============================================
|
======================================================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -17,11 +17,11 @@ Returns authenticated string hash of Red global identifier, if authenticated via
|
|||||||
|
|
||||||
* get_app()
|
* get_app()
|
||||||
|
|
||||||
Returns the global app structure ($a).
|
Returns the global app structure ($a). No longer used as App is a static class
|
||||||
|
|
||||||
* App::get_observer()
|
* App::get_observer()
|
||||||
|
|
||||||
(App:: is usually assigned to the global $a), so App::get_observer() or App::get_observer() - returns an xchan structure representing the current viewer if authenticated (locally or remotely).
|
returns an xchan structure representing the current viewer if authenticated (locally or remotely).
|
||||||
|
|
||||||
* get_config($family,$key), get_pconfig($uid,$family,$key)
|
* get_config($family,$key), get_pconfig($uid,$family,$key)
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[b]Red development - some useful basic functions[/b]
|
[b]$Projectname development - some useful basic functions[/b]
|
||||||
|
|
||||||
[b]get_account_id()[/b]
|
[b]get_account_id()[/b]
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ Returns the global app structure ($a).
|
|||||||
|
|
||||||
[b]App::get_observer()[/b]
|
[b]App::get_observer()[/b]
|
||||||
|
|
||||||
(App:: is usually assigned to the global $a), so $a->get_observer() or get_app()->get_observer() - returns an xchan structure representing the current viewer if authenticated (locally or remotely).
|
returns an xchan structure representing the current viewer if authenticated (locally or remotely).
|
||||||
|
|
||||||
[b]get_config($family,$key), get_pconfig($uid,$family,$key), get_xconfig($xchan_hash,$family,$key)[/b]
|
[b]get_config($family,$key), get_pconfig($uid,$family,$key), get_xconfig($xchan_hash,$family,$key)[/b]
|
||||||
|
|
||||||
|
@ -70,6 +70,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
|
|||||||
[zrl=[baseurl]/help/hook/bbcode]bbcode[/zrl]
|
[zrl=[baseurl]/help/hook/bbcode]bbcode[/zrl]
|
||||||
Called when converting bbcode to HTML
|
Called when converting bbcode to HTML
|
||||||
|
|
||||||
|
[zrl=[baseurl]/help/hook/bb_translate_video]bb_translate_video[/zrl]
|
||||||
|
Called when extracting embedded services from bbcode video elements (rarely used)
|
||||||
|
|
||||||
[zrl=[baseurl]/help/hook/channel_remove]channel_remove[/zrl]
|
[zrl=[baseurl]/help/hook/channel_remove]channel_remove[/zrl]
|
||||||
Called when removing a channel
|
Called when removing a channel
|
||||||
|
|
||||||
@ -242,8 +245,11 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
|
|||||||
[zrl=[baseurl]/help/hook/hostxrd]hostxrd[/zrl]
|
[zrl=[baseurl]/help/hook/hostxrd]hostxrd[/zrl]
|
||||||
Called when generating .well-known/hosts-meta for "old webfinger" (used by Diaspora protocol)
|
Called when generating .well-known/hosts-meta for "old webfinger" (used by Diaspora protocol)
|
||||||
|
|
||||||
|
[zrl=[baseurl]/help/hook/html2bb_video]html2bb_video[/zrl]
|
||||||
|
Called when using the html2bbcode translation to handle embedded media
|
||||||
|
|
||||||
[zrl=[baseurl]/help/hook/html2bbcode]html2bbcode[/zrl]
|
[zrl=[baseurl]/help/hook/html2bbcode]html2bbcode[/zrl]
|
||||||
Called when using the html2bbcode tranlsation
|
Called when using the html2bbcode translation
|
||||||
|
|
||||||
[zrl=[baseurl]/help/hook/identity_basic_export]identity_basic_export[/zrl]
|
[zrl=[baseurl]/help/hook/identity_basic_export]identity_basic_export[/zrl]
|
||||||
Called when exporting a channel's basic information for backup or transfer
|
Called when exporting a channel's basic information for backup or transfer
|
||||||
|
167
include/PermissionDescription.php
Normal file
167
include/PermissionDescription.php
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if(class_exists('PermissionDescription')) return;
|
||||||
|
|
||||||
|
require_once("include/permissions.php");
|
||||||
|
require_once("include/language.php");
|
||||||
|
require_once("include/text.php");
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encapsulates information the ACL dialog requires to describe
|
||||||
|
* permission settings for an item with an empty ACL.
|
||||||
|
* i.e the caption, icon, and tooltip for the no-ACL option in the ACL dialog.
|
||||||
|
*/
|
||||||
|
class PermissionDescription {
|
||||||
|
|
||||||
|
private $global_perm;
|
||||||
|
private $channel_perm;
|
||||||
|
private $fallback_description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor is private.
|
||||||
|
* Use static methods fromGlobalPermission(), fromStandalonePermission(), or fromDescription()
|
||||||
|
* to create instances.
|
||||||
|
*/
|
||||||
|
private function __construct($global_perm, $channel_perm, $description = '') {
|
||||||
|
|
||||||
|
$this->global_perm = $global_perm;
|
||||||
|
$this->channel_perm = $channel_perm;
|
||||||
|
|
||||||
|
$this->fallback_description = ($description == '') ? t('Visible to your default audience') : $description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the interpretation of an empty ACL can't be summarised with a global default permission
|
||||||
|
* or a specific permission setting then use this method and describe what it means instead.
|
||||||
|
*
|
||||||
|
* @param string $description - the caption for the no-ACL option in the ACL dialog.
|
||||||
|
* @return a new instance of PermissionDescription
|
||||||
|
*/
|
||||||
|
public static function fromDescription($description) {
|
||||||
|
return new PermissionDescription('', 0x80000, $description);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this method only if the interpretation of an empty ACL doesn't fall back to a global
|
||||||
|
* default permission. You should pass one of the constants from boot.php - PERMS_PUBLIC, PERMS_NETWORK etc.
|
||||||
|
*
|
||||||
|
* @param integer $perm - a single enumerated constant permission - PERMS_PUBLIC, PERMS_NETWORK etc.
|
||||||
|
* @return a new instance of PermissionDescription
|
||||||
|
*/
|
||||||
|
public static function fromStandalonePermission($perm) {
|
||||||
|
|
||||||
|
$result = new PermissionDescription('', $perm);
|
||||||
|
|
||||||
|
$checkPerm = $this->get_permission_description();
|
||||||
|
if ($checkPerm == $this->fallback_description) {
|
||||||
|
$result = null;
|
||||||
|
logger('null PermissionDescription from unknown standalone permission: ' . $perm ,LOGGER_DEBUG, LOG_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the preferred way to create a PermissionDescription, as it provides the most details.
|
||||||
|
* Use this method if you know an empty ACL will result in one of the global default permissions
|
||||||
|
* being used, such as channel_r_stream (for which you would pass 'view_stream').
|
||||||
|
*
|
||||||
|
* @param string $permname - a key for the global perms array from get_perms() in permissions.php,
|
||||||
|
* e.g. 'view_stream', 'view_profile', etc.
|
||||||
|
* @return a new instance of PermissionDescription
|
||||||
|
*/
|
||||||
|
public static function fromGlobalPermission($permname) {
|
||||||
|
|
||||||
|
$result = null;
|
||||||
|
|
||||||
|
$global_perms = get_perms();
|
||||||
|
|
||||||
|
if (array_key_exists($permname, $global_perms)) {
|
||||||
|
|
||||||
|
$permDetails = $global_perms[$permname];
|
||||||
|
$channelPerm = \App::$channel[$permDetails[0]];
|
||||||
|
$result = new PermissionDescription($permDetails[1], $channelPerm);
|
||||||
|
} else {
|
||||||
|
// The acl dialog can handle null arguments, but it shouldn't happen
|
||||||
|
logger('null PermissionDescription from unknown global permission: ' . $permname ,LOGGER_DEBUG, LOG_ERROR);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a localized description of the permission, or a generic message if the permission
|
||||||
|
* is unknown.
|
||||||
|
*
|
||||||
|
* @return string description
|
||||||
|
*/
|
||||||
|
public function get_permission_description() {
|
||||||
|
|
||||||
|
switch($this->channel_perm) {
|
||||||
|
|
||||||
|
case 0: return t('Only me');
|
||||||
|
case PERMS_PUBLIC: return t('Public');
|
||||||
|
case PERMS_NETWORK: return t('Anybody in the $Projectname network');
|
||||||
|
case PERMS_SITE: return sprintf(t('Any account on %s'), \App::get_hostname());
|
||||||
|
case PERMS_CONTACTS: return t('Any of my connections');
|
||||||
|
case PERMS_SPECIFIC:
|
||||||
|
// Because we're describing the permissions of an item with an empty ACL,
|
||||||
|
// the owner will be the only person able to see it if the permissions are
|
||||||
|
// set to "only specified connections".
|
||||||
|
return t('Only me (only specified contacts and me)');
|
||||||
|
case PERMS_AUTHED: return t('Anybody authenticated (could include visitors from other networks)');
|
||||||
|
case PERMS_PENDING: return t('Any connections including those who haven\'t yet been approved');
|
||||||
|
default: return $this->fallback_description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an icon css class name if an appropriate one is available, e.g. "fa-globe" for Public,
|
||||||
|
* otherwise returns empty string.
|
||||||
|
*
|
||||||
|
* @return string icon css class name (often FontAwesome)
|
||||||
|
*/
|
||||||
|
public function get_permission_icon() {
|
||||||
|
|
||||||
|
switch($this->channel_perm) {
|
||||||
|
|
||||||
|
case 0:/* only me */ return 'fa-eye-slash';
|
||||||
|
case PERMS_PUBLIC: return 'fa-globe';
|
||||||
|
case PERMS_NETWORK: return 'fa-share-alt-square'; // fa-share-alt-square is very similiar to the hubzilla logo, but we should create our own logo class to use
|
||||||
|
case PERMS_SITE: return 'fa-sitemap';
|
||||||
|
case PERMS_CONTACTS: return 'fa-group';
|
||||||
|
case PERMS_SPECIFIC:
|
||||||
|
// Because we're describing the permissions of an item with an empty ACL,
|
||||||
|
// the owner will be the only person able to see it if the permissions are
|
||||||
|
// set to "only specified connections".
|
||||||
|
return 'fa-eye-slash';
|
||||||
|
case PERMS_AUTHED: return '';
|
||||||
|
case PERMS_PENDING: return '';
|
||||||
|
default: return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a localized description of where the permission came from, if this is known.
|
||||||
|
* If it's not know, or if the permission is standalone and didn't come from a default
|
||||||
|
* permission setting, then empty string is returned.
|
||||||
|
*
|
||||||
|
* @return string description or empty string
|
||||||
|
*/
|
||||||
|
public function get_permission_origin_description() {
|
||||||
|
|
||||||
|
switch($this->global_perm) {
|
||||||
|
|
||||||
|
case PERMS_R_STREAM: return t('This is your default setting for the audience of your normal stream, and posts.');
|
||||||
|
case PERMS_R_PROFILE: return t('This is your default setting for who can view your default channel profile');
|
||||||
|
case PERMS_R_ABOOK: return t('This is your default setting for who can view your connections');
|
||||||
|
case PERMS_R_STORAGE: return t('This is your default setting for who can view your file storage and photos');
|
||||||
|
case PERMS_R_PAGES: return t('This is your default setting for the audience of your webpages');
|
||||||
|
default: return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -6,6 +6,9 @@
|
|||||||
/**
|
/**
|
||||||
* @package acl_selectors
|
* @package acl_selectors
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
require_once("include/PermissionDescription.php");
|
||||||
|
|
||||||
function group_select($selname,$selclass,$preselected = false,$size = 4) {
|
function group_select($selname,$selclass,$preselected = false,$size = 4) {
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
@ -213,22 +216,36 @@ function fixacl(&$item) {
|
|||||||
/**
|
/**
|
||||||
* Builds a modal dialog for editing permissions, using acl_selector.tpl as the template.
|
* Builds a modal dialog for editing permissions, using acl_selector.tpl as the template.
|
||||||
*
|
*
|
||||||
* @param array $default Optional access control list for the initial state of the dialog.
|
* @param array $default Optional access control list for the initial state of the dialog.
|
||||||
* @param boolean $show_jotnets Whether plugins for federated networks should be included in the permissions dialog
|
* @param boolean $show_jotnets Whether plugins for federated networks should be included in the permissions dialog
|
||||||
* @param string $showall_caption An optional caption to describe the scope of an unrestricted post. e.g. "Public"
|
* @param PermissionDescription $emptyACL_description - An optional description for the permission implied by selecting an empty ACL. Preferably an instance of PermissionDescription.
|
||||||
* @param string $dialog_description Optional message to include at the top of the dialog. E.g. "Warning: Post permissions cannot be changed once sent".
|
* @param string $dialog_description Optional message to include at the top of the dialog. E.g. "Warning: Post permissions cannot be changed once sent".
|
||||||
* @param string $context_help Allows the dialog to present a help icon. E.g. "acl_dialog_post"
|
* @param string $context_help Allows the dialog to present a help icon. E.g. "acl_dialog_post"
|
||||||
* @param boolean $readonly Not implemented yet. When implemented, the dialog will use acl_readonly.tpl instead, so that permissions may be viewed for posts that can no longer have their permissions changed.
|
* @param boolean $readonly Not implemented yet. When implemented, the dialog will use acl_readonly.tpl instead, so that permissions may be viewed for posts that can no longer have their permissions changed.
|
||||||
*
|
*
|
||||||
* @return string html modal dialog build from acl_selector.tpl
|
* @return string html modal dialog built from acl_selector.tpl
|
||||||
*/
|
*/
|
||||||
function populate_acl($defaults = null,$show_jotnets = true, $showall_caption = '', $dialog_description = '', $context_help = '', $readonly = false) {
|
function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_description = '', $dialog_description = '', $context_help = '', $readonly = false) {
|
||||||
|
|
||||||
$allow_cid = $allow_gid = $deny_cid = $deny_gid = false;
|
$allow_cid = $allow_gid = $deny_cid = $deny_gid = false;
|
||||||
|
$showall_origin = '';
|
||||||
|
$showall_icon = 'fa-globe';
|
||||||
|
|
||||||
if(! $showall_caption)
|
|
||||||
|
if(! $emptyACL_description) {
|
||||||
$showall_caption = t('Visible to your default audience');
|
$showall_caption = t('Visible to your default audience');
|
||||||
|
|
||||||
|
} else if (is_a($emptyACL_description, 'PermissionDescription')) {
|
||||||
|
$showall_caption = $emptyACL_description->get_permission_description();
|
||||||
|
$showall_origin = $emptyACL_description->get_permission_origin_description();
|
||||||
|
$showall_icon = $emptyACL_description->get_permission_icon();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// For backwards compatibility we still accept a string... for now!
|
||||||
|
$showall_caption = $emptyACL_description;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(is_array($defaults)) {
|
if(is_array($defaults)) {
|
||||||
$allow_cid = ((strlen($defaults['allow_cid']))
|
$allow_cid = ((strlen($defaults['allow_cid']))
|
||||||
? explode('><', $defaults['allow_cid']) : array() );
|
? explode('><', $defaults['allow_cid']) : array() );
|
||||||
@ -252,6 +269,8 @@ function populate_acl($defaults = null,$show_jotnets = true, $showall_caption =
|
|||||||
$tpl = get_markup_template("acl_selector.tpl");
|
$tpl = get_markup_template("acl_selector.tpl");
|
||||||
$o = replace_macros($tpl, array(
|
$o = replace_macros($tpl, array(
|
||||||
'$showall' => $showall_caption,
|
'$showall' => $showall_caption,
|
||||||
|
'$showallOrigin' => $showall_origin,
|
||||||
|
'$showallIcon' => $showall_icon,
|
||||||
'$showlimited' => t("Limit access:"),
|
'$showlimited' => t("Limit access:"),
|
||||||
'$showlimitedDesc' => t('Select "Show" to allow viewing. "Don\'t show" lets you override and limit the scope of "Show".'),
|
'$showlimitedDesc' => t('Select "Show" to allow viewing. "Don\'t show" lets you override and limit the scope of "Show".'),
|
||||||
'$show' => t("Show"),
|
'$show' => t("Show"),
|
||||||
@ -273,3 +292,30 @@ function populate_acl($defaults = null,$show_jotnets = true, $showall_caption =
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string that's suitable for passing as the $dialog_description argument to a
|
||||||
|
* populate_acl() call for wall posts or network posts.
|
||||||
|
*
|
||||||
|
* This string is needed in 3 different files, and our .po translation system currently
|
||||||
|
* cannot be used as a string table (because the value is always the key in english) so
|
||||||
|
* I've centralized the value here (making this function name the "key") until we have a
|
||||||
|
* better way.
|
||||||
|
*
|
||||||
|
* @return string Description to present to user in modal permissions dialog
|
||||||
|
*/
|
||||||
|
function get_post_aclDialogDescription() {
|
||||||
|
|
||||||
|
// I'm trying to make two points in this description text - warn about finality of wall
|
||||||
|
// post permissions, and try to clear up confusion that these permissions set who is
|
||||||
|
// *shown* the post, istead of who is able to see the post, i.e. make it clear that clicking
|
||||||
|
// the "Show" button on a group does not post it to the feed of people in that group, it
|
||||||
|
// mearly allows those people to view the post if they are viewing/following this channel.
|
||||||
|
$description = t('Post permissions %s cannot be changed %s after a post is shared.</br />These permissions set who is allowed to view the post.');
|
||||||
|
|
||||||
|
// Lets keep the emphasis styling seperate from the translation. It may change.
|
||||||
|
$emphasisOpen = '<b><a href="' . z_root() . '/help/acl_dialog_post" target="hubzilla-help">';
|
||||||
|
$emphasisClose = '</a></b>';
|
||||||
|
|
||||||
|
return sprintf($description, $emphasisOpen, $emphasisClose);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -492,18 +492,6 @@ function bb_observer($Text) {
|
|||||||
|
|
||||||
function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) {
|
function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) {
|
||||||
|
|
||||||
$a = get_app();
|
|
||||||
|
|
||||||
// Move all spaces out of the tags
|
|
||||||
// ....Uhm why?
|
|
||||||
// This is basically doing a trim() on the stuff in between tags, but it messes up
|
|
||||||
// carefully crafted bbcode and especially other pre-formatted code.
|
|
||||||
// Commenting out until we come up with a use case where it's needed. Then let's try and
|
|
||||||
// special case rather than a heavy-handed approach like this.
|
|
||||||
|
|
||||||
// $Text = preg_replace("/\[(\w*)\](\s*)/ism", '$2[$1]', $Text);
|
|
||||||
// $Text = preg_replace("/(\s*)\[\/(\w*)\]/ism", '[/$2]$1', $Text);
|
|
||||||
|
|
||||||
// Hide all [noparse] contained bbtags by spacefying them
|
// Hide all [noparse] contained bbtags by spacefying them
|
||||||
if (strpos($Text,'[noparse]') !== false) {
|
if (strpos($Text,'[noparse]') !== false) {
|
||||||
$Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_spacefy',$Text);
|
$Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_spacefy',$Text);
|
||||||
@ -834,9 +822,6 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Declare the format for [quote] layout
|
// Declare the format for [quote] layout
|
||||||
$QuoteLayout = '<blockquote>$1</blockquote>';
|
$QuoteLayout = '<blockquote>$1</blockquote>';
|
||||||
|
|
||||||
@ -978,37 +963,6 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Youtube extensions
|
|
||||||
// if (strpos($Text,'[youtube]') !== false) {
|
|
||||||
// if ($tryoembed) {
|
|
||||||
// $Text = preg_replace_callback("/\[youtube\](https?:\/\/www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text);
|
|
||||||
// $Text = preg_replace_callback("/\[youtube\](www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text);
|
|
||||||
// $Text = preg_replace_callback("/\[youtube\](https?:\/\/youtu.be\/.*?)\[\/youtube\]/ism", 'tryoembed', $Text);
|
|
||||||
// }
|
|
||||||
// $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/ism", '[youtube]$1[/youtube]', $Text);
|
|
||||||
// $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/embed\/(.*?)\[\/youtube\]/ism", '[youtube]$1[/youtube]', $Text);
|
|
||||||
// $Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism", '[youtube]$1[/youtube]', $Text);
|
|
||||||
|
|
||||||
// if ($tryoembed)
|
|
||||||
// $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '<iframe width="' . App::$videowidth . '" height="' . App::$videoheight . '" src="http://www.youtube.com/embed/$1" frameborder="0"></iframe>', $Text);
|
|
||||||
// else
|
|
||||||
// $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", "http://www.youtube.com/watch?v=$1", $Text);
|
|
||||||
// }
|
|
||||||
// if (strpos($Text,'[vimeo]') !== false) {
|
|
||||||
// if ($tryoembed) {
|
|
||||||
// $Text = preg_replace_callback("/\[vimeo\](https?:\/\/player.vimeo.com\/video\/[0-9]+).*?\[\/vimeo\]/ism", 'tryoembed', $Text);
|
|
||||||
// $Text = preg_replace_callback("/\[vimeo\](https?:\/\/vimeo.com\/[0-9]+).*?\[\/vimeo\]/ism", 'tryoembed', $Text);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $Text = preg_replace("/\[vimeo\]https?:\/\/player.vimeo.com\/video\/([0-9]+)(.*?)\[\/vimeo\]/ism", '[vimeo]$1[/vimeo]', $Text);
|
|
||||||
// $Text = preg_replace("/\[vimeo\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/vimeo\]/ism", '[vimeo]$1[/vimeo]', $Text);
|
|
||||||
|
|
||||||
// if ($tryoembed)
|
|
||||||
// $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", '<iframe width="' . App::$videowidth . '" height="' . App::$videoheight . '" src="http://player.vimeo.com/video/$1" frameborder="0" ></iframe>', $Text);
|
|
||||||
// else
|
|
||||||
// $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", "http://vimeo.com/$1", $Text);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// oembed tag
|
// oembed tag
|
||||||
$Text = oembed_bbcode2html($Text);
|
$Text = oembed_bbcode2html($Text);
|
||||||
|
|
||||||
|
@ -1,383 +0,0 @@
|
|||||||
<?php /** @file */
|
|
||||||
|
|
||||||
require_once('include/security.php');
|
|
||||||
require_once('include/menu.php');
|
|
||||||
require_once('include/widgets.php');
|
|
||||||
|
|
||||||
// When editing a webpage - a dropdown is needed to select a page layout
|
|
||||||
// On submit, the pdl_select value (which is the mid of an item with item_type = ITEM_TYPE_PDL) is stored in
|
|
||||||
// the webpage's resource_id, with resource_type 'pdl'.
|
|
||||||
|
|
||||||
// Then when displaying a webpage, we can see if it has a pdl attached. If not we'll
|
|
||||||
// use the default site/page layout.
|
|
||||||
|
|
||||||
// If it has a pdl we'll load it as we know the mid and pass the body through comanche_parser() which will generate the
|
|
||||||
// page layout from the given description
|
|
||||||
|
|
||||||
|
|
||||||
function pdl_selector($uid, $current="") {
|
|
||||||
$o = '';
|
|
||||||
|
|
||||||
$sql_extra = item_permissions_sql($uid);
|
|
||||||
|
|
||||||
$r = q("select item_id.*, mid from item_id left join item on iid = item.id where item_id.uid = %d and item_id.uid = item.uid and service = 'PDL' $sql_extra order by sid asc",
|
|
||||||
intval($uid)
|
|
||||||
);
|
|
||||||
|
|
||||||
$arr = array('channel_id' => $uid, 'current' => $current, 'entries' => $r);
|
|
||||||
call_hooks('pdl_selector',$arr);
|
|
||||||
|
|
||||||
$entries = $arr['entries'];
|
|
||||||
$current = $arr['current'];
|
|
||||||
|
|
||||||
$o .= '<select name="pdl_select" id="pdl_select" size="1">';
|
|
||||||
$entries[] = array('title' => t('Default'), 'mid' => '');
|
|
||||||
foreach($entries as $selection) {
|
|
||||||
$selected = (($selection == $current) ? ' selected="selected" ' : '');
|
|
||||||
$o .= "<option value=\"{$selection['mid']}\" $selected >{$selection['sid']}</option>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$o .= '</select>';
|
|
||||||
return $o;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function comanche_parser(&$a, $s, $pass = 0) {
|
|
||||||
$matches = array();
|
|
||||||
|
|
||||||
$cnt = preg_match_all("/\[comment\](.*?)\[\/comment\]/ism", $s, $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
$s = str_replace($mtch[0], '', $s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($pass == 0) {
|
|
||||||
$cnt = preg_match("/\[layout\](.*?)\[\/layout\]/ism", $s, $matches);
|
|
||||||
if($cnt)
|
|
||||||
App::$page['template'] = trim($matches[1]);
|
|
||||||
|
|
||||||
$cnt = preg_match("/\[template=(.*?)\](.*?)\[\/template\]/ism", $s, $matches);
|
|
||||||
if($cnt) {
|
|
||||||
App::$page['template'] = trim($matches[2]);
|
|
||||||
App::$page['template_style'] = trim($matches[2]) . '_' . $matches[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
$cnt = preg_match("/\[template\](.*?)\[\/template\]/ism", $s, $matches);
|
|
||||||
if($cnt) {
|
|
||||||
App::$page['template'] = trim($matches[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$cnt = preg_match("/\[theme=(.*?)\](.*?)\[\/theme\]/ism", $s, $matches);
|
|
||||||
if($cnt) {
|
|
||||||
App::$layout['schema'] = trim($matches[1]);
|
|
||||||
App::$layout['theme'] = trim($matches[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$cnt = preg_match("/\[theme\](.*?)\[\/theme\]/ism", $s, $matches);
|
|
||||||
if($cnt)
|
|
||||||
App::$layout['theme'] = trim($matches[1]);
|
|
||||||
|
|
||||||
$cnt = preg_match_all("/\[webpage\](.*?)\[\/webpage\]/ism", $s, $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
// only the last webpage definition is used if there is more than one
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
App::$layout['webpage'] = comanche_webpage($a,$mtch[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$cnt = preg_match_all("/\[region=(.*?)\](.*?)\[\/region\]/ism", $s, $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
App::$layout['region_' . $mtch[1]] = comanche_region($a,$mtch[2]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function comanche_menu($s, $class = '') {
|
|
||||||
|
|
||||||
$channel_id = comanche_get_channel_id();
|
|
||||||
$name = $s;
|
|
||||||
|
|
||||||
$cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $s, $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
$var[$mtch[1]] = $mtch[2];
|
|
||||||
$name = str_replace($mtch[0], '', $name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($channel_id) {
|
|
||||||
$m = menu_fetch($name,$channel_id, get_observer_hash());
|
|
||||||
return menu_render($m, $class, $edit = false, $var);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function comanche_replace_region($match) {
|
|
||||||
$a = get_app();
|
|
||||||
if (array_key_exists($match[1], App::$page)) {
|
|
||||||
return App::$page[$match[1]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the channel_id of the profile owner of the page.
|
|
||||||
*
|
|
||||||
* Returns the channel_id of the profile owner of the page, or the local_channel
|
|
||||||
* if there is no profile owner. Otherwise returns 0.
|
|
||||||
*
|
|
||||||
* @return channel_id
|
|
||||||
*/
|
|
||||||
function comanche_get_channel_id() {
|
|
||||||
$channel_id = ((is_array(App::$profile)) ? App::$profile['profile_uid'] : 0);
|
|
||||||
|
|
||||||
if ((! $channel_id) && (local_channel()))
|
|
||||||
$channel_id = local_channel();
|
|
||||||
|
|
||||||
return $channel_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function comanche_block($s, $class = '') {
|
|
||||||
$var = array();
|
|
||||||
$matches = array();
|
|
||||||
$name = $s;
|
|
||||||
$class = (($class) ? $class : 'bblock widget');
|
|
||||||
|
|
||||||
$cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $s, $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
$var[$mtch[1]] = $mtch[2];
|
|
||||||
$name = str_replace($mtch[0], '', $name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$o = '';
|
|
||||||
$channel_id = comanche_get_channel_id();
|
|
||||||
|
|
||||||
if($channel_id) {
|
|
||||||
$r = q("select * from item inner join item_id on iid = item.id and item_id.uid = item.uid and item.uid = %d and service = 'BUILDBLOCK' and sid = '%s' limit 1",
|
|
||||||
intval($channel_id),
|
|
||||||
dbesc($name)
|
|
||||||
);
|
|
||||||
|
|
||||||
if($r) {
|
|
||||||
//check for eventual menus in the block and parse them
|
|
||||||
$cnt = preg_match_all("/\[menu\](.*?)\[\/menu\]/ism", $r[0]['body'], $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
$r[0]['body'] = str_replace($mtch[0], comanche_menu(trim($mtch[1])), $r[0]['body']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$cnt = preg_match_all("/\[menu=(.*?)\](.*?)\[\/menu\]/ism", $r[0]['body'], $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
$r[0]['body'] = str_replace($mtch[0],comanche_menu(trim($mtch[2]),$mtch[1]),$r[0]['body']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//emit the block
|
|
||||||
$o .= (($var['wrap'] == 'none') ? '' : '<div class="' . $class . '">');
|
|
||||||
|
|
||||||
if($r[0]['title'] && trim($r[0]['body']) != '$content') {
|
|
||||||
$o .= '<h3>' . $r[0]['title'] . '</h3>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(trim($r[0]['body']) === '$content') {
|
|
||||||
$o .= App::$page['content'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$o .= prepare_text($r[0]['body'], $r[0]['mimetype']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$o .= (($var['wrap'] == 'none') ? '' : '</div>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $o;
|
|
||||||
}
|
|
||||||
|
|
||||||
function comanche_js($s) {
|
|
||||||
|
|
||||||
switch($s) {
|
|
||||||
case 'jquery':
|
|
||||||
$path = 'view/js/jquery.js';
|
|
||||||
break;
|
|
||||||
case 'bootstrap':
|
|
||||||
$path = 'library/bootstrap/js/bootstrap.min.js';
|
|
||||||
break;
|
|
||||||
case 'foundation':
|
|
||||||
$path = 'library/foundation/js/foundation.min.js';
|
|
||||||
$init = "\r\n" . '<script>$(document).ready(function() { $(document).foundation(); });</script>';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ret = '<script src="' . z_root() . '/' . $path . '" ></script>';
|
|
||||||
if($init)
|
|
||||||
$ret .= $init;
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function comanche_css($s) {
|
|
||||||
|
|
||||||
switch($s) {
|
|
||||||
case 'bootstrap':
|
|
||||||
$path = 'library/bootstrap/css/bootstrap.min.css';
|
|
||||||
break;
|
|
||||||
case 'foundation':
|
|
||||||
$path = 'library/foundation/css/foundation.min.css';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ret = '<link rel="stylesheet" href="' . z_root() . '/' . $path . '" type="text/css" media="screen">';
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// This doesn't really belong in Comanche, but it could also be argued that it is the perfect place.
|
|
||||||
// We need to be able to select what kind of template and decoration to use for the webpage at the heart of our content.
|
|
||||||
// For now we'll allow an '[authored]' element which defaults to name and date, or 'none' to remove these, and perhaps
|
|
||||||
// 'full' to provide a social network style profile photo.
|
|
||||||
// But leave it open to have richer templating options and perhaps ultimately discard this one, once we have a better idea
|
|
||||||
// of what template and webpage options we might desire.
|
|
||||||
|
|
||||||
function comanche_webpage(&$a,$s) {
|
|
||||||
$ret = array();
|
|
||||||
$matches = array();
|
|
||||||
|
|
||||||
$cnt = preg_match_all("/\[authored\](.*?)\[\/authored\]/ism", $s, $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
$ret['authored'] = $mtch[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Widgets will have to get any operational arguments from the session, the
|
|
||||||
* global app environment, or config storage until we implement argument passing
|
|
||||||
*
|
|
||||||
* @param string $name
|
|
||||||
* @param string $text
|
|
||||||
*/
|
|
||||||
function comanche_widget($name, $text) {
|
|
||||||
$vars = array();
|
|
||||||
$matches = array();
|
|
||||||
|
|
||||||
|
|
||||||
$cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $text, $matches, PREG_SET_ORDER);
|
|
||||||
if ($cnt) {
|
|
||||||
foreach ($matches as $mtch) {
|
|
||||||
$vars[$mtch[1]] = $mtch[2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$func = 'widget_' . trim($name);
|
|
||||||
|
|
||||||
if(! function_exists($func)) {
|
|
||||||
if(file_exists('widget/' . trim($name) . '.php'))
|
|
||||||
require_once('widget/' . trim($name) . '.php');
|
|
||||||
elseif(file_exists('widget/' . trim($name) . '/' . trim($name) . '.php'))
|
|
||||||
require_once('widget/' . trim($name) . '/' . trim($name) . '.php');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$theme_widget = $func . '.php';
|
|
||||||
if((! function_exists($func)) && theme_include($theme_widget))
|
|
||||||
require_once(theme_include($theme_widget));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (function_exists($func))
|
|
||||||
return $func($vars);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function comanche_region(&$a, $s) {
|
|
||||||
$matches = array();
|
|
||||||
|
|
||||||
$cnt = preg_match_all("/\[menu\](.*?)\[\/menu\]/ism", $s, $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
$s = str_replace($mtch[0], comanche_menu(trim($mtch[1])), $s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// menu class e.g. [menu=horizontal]my_menu[/menu] or [menu=tabbed]my_menu[/menu]
|
|
||||||
// allows different menu renderings to be applied
|
|
||||||
|
|
||||||
$cnt = preg_match_all("/\[menu=(.*?)\](.*?)\[\/menu\]/ism", $s, $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
$s = str_replace($mtch[0],comanche_menu(trim($mtch[2]),$mtch[1]),$s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$cnt = preg_match_all("/\[block\](.*?)\[\/block\]/ism", $s, $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
$s = str_replace($mtch[0],comanche_block(trim($mtch[1])),$s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$cnt = preg_match_all("/\[block=(.*?)\](.*?)\[\/block\]/ism", $s, $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
$s = str_replace($mtch[0],comanche_block(trim($mtch[2]),trim($mtch[1])),$s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$cnt = preg_match_all("/\[js\](.*?)\[\/js\]/ism", $s, $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
$s = str_replace($mtch[0],comanche_js(trim($mtch[1])),$s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$cnt = preg_match_all("/\[css\](.*?)\[\/css\]/ism", $s, $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
$s = str_replace($mtch[0],comanche_css(trim($mtch[1])),$s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// need to modify this to accept parameters
|
|
||||||
|
|
||||||
$cnt = preg_match_all("/\[widget=(.*?)\](.*?)\[\/widget\]/ism", $s, $matches, PREG_SET_ORDER);
|
|
||||||
if($cnt) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
$s = str_replace($mtch[0],comanche_widget(trim($mtch[1]),$mtch[2]),$s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $s;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @function register_page_template($arr)
|
|
||||||
* Registers a page template/variant for use by Comanche selectors
|
|
||||||
* @param array $arr
|
|
||||||
* 'template' => template name
|
|
||||||
* 'variant' => array(
|
|
||||||
* 'name' => variant name
|
|
||||||
* 'desc' => text description
|
|
||||||
* 'regions' => array(
|
|
||||||
* 'name' => name
|
|
||||||
* 'desc' => text description
|
|
||||||
* )
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function register_page_template($arr) {
|
|
||||||
App::$page_layouts[$arr['template']] = array($arr['variant']);
|
|
||||||
return;
|
|
||||||
}
|
|
@ -1070,8 +1070,8 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
|
|||||||
}
|
}
|
||||||
$menublock = get_pconfig($profile['uid'],'system','channel_menublock');
|
$menublock = get_pconfig($profile['uid'],'system','channel_menublock');
|
||||||
if ($menublock && (! $block)) {
|
if ($menublock && (! $block)) {
|
||||||
require_once('include/comanche.php');
|
$comanche = new Zotlabs\Render\Comanche();
|
||||||
$channel_menu .= comanche_block($menublock);
|
$channel_menu .= $comanche->block($menublock);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($zcard)
|
if($zcard)
|
||||||
|
@ -1895,32 +1895,15 @@ function cleardiv() {
|
|||||||
|
|
||||||
|
|
||||||
function bb_translate_video($s) {
|
function bb_translate_video($s) {
|
||||||
|
$arr = array('string' => $s);
|
||||||
$matches = null;
|
call_hooks('bb_translate_video',$arr);
|
||||||
$r = preg_match_all("/\[video\](.*?)\[\/video\]/ism",$s,$matches,PREG_SET_ORDER);
|
return $arr['string'];
|
||||||
if($r) {
|
|
||||||
foreach($matches as $mtch) {
|
|
||||||
if((stristr($mtch[1],'youtube')) || (stristr($mtch[1],'youtu.be')))
|
|
||||||
$s = str_replace($mtch[0],'[youtube]' . $mtch[1] . '[/youtube]',$s);
|
|
||||||
elseif(stristr($mtch[1],'vimeo'))
|
|
||||||
$s = str_replace($mtch[0],'[vimeo]' . $mtch[1] . '[/vimeo]',$s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function html2bb_video($s) {
|
function html2bb_video($s) {
|
||||||
|
$arr = array('string' => $s);
|
||||||
$s = preg_replace('#<object[^>]+>(.*?)https?://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+)(.*?)</object>#ism',
|
call_hooks('html2bb_video',$arr);
|
||||||
'[youtube]$2[/youtube]', $s);
|
return $arr['string'];
|
||||||
|
|
||||||
$s = preg_replace('#<iframe[^>](.*?)https?://www.youtube.com/embed/([A-Za-z0-9\-_=]+)(.*?)</iframe>#ism',
|
|
||||||
'[youtube]$2[/youtube]', $s);
|
|
||||||
|
|
||||||
$s = preg_replace('#<iframe[^>](.*?)https?://player.vimeo.com/video/([0-9]+)(.*?)</iframe>#ism',
|
|
||||||
'[vimeo]$2[/vimeo]', $s);
|
|
||||||
|
|
||||||
return $s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2824,3 +2807,42 @@ function expand_acl($s) {
|
|||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// When editing a webpage - a dropdown is needed to select a page layout
|
||||||
|
// On submit, the pdl_select value (which is the mid of an item with item_type = ITEM_TYPE_PDL) is stored in
|
||||||
|
// the webpage's resource_id, with resource_type 'pdl'.
|
||||||
|
|
||||||
|
// Then when displaying a webpage, we can see if it has a pdl attached. If not we'll
|
||||||
|
// use the default site/page layout.
|
||||||
|
|
||||||
|
// If it has a pdl we'll load it as we know the mid and pass the body through comanche_parser() which will generate the
|
||||||
|
// page layout from the given description
|
||||||
|
|
||||||
|
|
||||||
|
function pdl_selector($uid, $current="") {
|
||||||
|
$o = '';
|
||||||
|
|
||||||
|
$sql_extra = item_permissions_sql($uid);
|
||||||
|
|
||||||
|
$r = q("select item_id.*, mid from item_id left join item on iid = item.id where item_id.uid = %d and item_id.uid = item.uid and service = 'PDL' $sql_extra order by sid asc",
|
||||||
|
intval($uid)
|
||||||
|
);
|
||||||
|
|
||||||
|
$arr = array('channel_id' => $uid, 'current' => $current, 'entries' => $r);
|
||||||
|
call_hooks('pdl_selector',$arr);
|
||||||
|
|
||||||
|
$entries = $arr['entries'];
|
||||||
|
$current = $arr['current'];
|
||||||
|
|
||||||
|
$o .= '<select name="pdl_select" id="pdl_select" size="1">';
|
||||||
|
$entries[] = array('title' => t('Default'), 'mid' => '');
|
||||||
|
foreach($entries as $selection) {
|
||||||
|
$selected = (($selection == $current) ? ' selected="selected" ' : '');
|
||||||
|
$o .= "<option value=\"{$selection['mid']}\" $selected >{$selection['sid']}</option>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$o .= '</select>';
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
3224
util/hmessages.po
3224
util/hmessages.po
File diff suppressed because it is too large
Load Diff
@ -925,9 +925,7 @@ a.rconnect:hover, a.rateme:hover, div.rateme:hover {
|
|||||||
#acl-search {
|
#acl-search {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
width: 90%; /* fallback if browser does not support calc() */
|
width: 100%;
|
||||||
width: calc(100% - 10px);
|
|
||||||
margin: 0px 0px 10px 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#acl-search::-webkit-input-placeholder {
|
#acl-search::-webkit-input-placeholder {
|
||||||
@ -944,15 +942,6 @@ a.rconnect:hover, a.rateme:hover, div.rateme:hover {
|
|||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#acl-dialog-description {
|
|
||||||
font-size: 90%;
|
|
||||||
color: #888;
|
|
||||||
padding-bottom: 4px;
|
|
||||||
}
|
|
||||||
#acl-dialog-description b {
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
#acl-showlimited-description {
|
#acl-showlimited-description {
|
||||||
font-size: 90%;
|
font-size: 90%;
|
||||||
color: #888;
|
color: #888;
|
||||||
@ -961,16 +950,27 @@ a.rconnect:hover, a.rateme:hover, div.rateme:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#acl-list {
|
#acl-list {
|
||||||
display: block;
|
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
|
-webkit-border-radius: $radiuspx ;
|
||||||
|
-moz-border-radius: $radiuspx;
|
||||||
|
border-radius: $radiuspx;
|
||||||
|
}
|
||||||
|
|
||||||
|
#acl-search-wrapper {
|
||||||
|
padding: 7px 10px;
|
||||||
|
background-color: $item_colour;
|
||||||
|
border-top-left-radius: $radiuspx;
|
||||||
|
border-top-right-radius: $radiuspx;
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#acl-list-content-wrapper {
|
||||||
|
display: block;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
clear: both;
|
clear: both;
|
||||||
min-height: 62px;
|
min-height: 62px;
|
||||||
padding: 10px 10px 0px 0px;
|
padding: 10px 10px 0px 0px;
|
||||||
-webkit-border-radius: $radiuspx ;
|
|
||||||
-moz-border-radius: $radiuspx;
|
|
||||||
border-radius: $radiuspx;
|
|
||||||
background-color: rgb(238,238,238);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#jotnets-wrapper, #jotnets-collapse {
|
#jotnets-wrapper, #jotnets-collapse {
|
||||||
@ -1046,6 +1046,13 @@ a.rconnect:hover, a.rateme:hover, div.rateme:hover {
|
|||||||
font-size: 140%;
|
font-size: 140%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#acl-info-icon,
|
||||||
|
#acl-info-icon:active {
|
||||||
|
font-size: 110%;
|
||||||
|
color: $link_colour;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
#acl-showall-caption {
|
#acl-showall-caption {
|
||||||
margin-left: 0.35em;
|
margin-left: 0.35em;
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
<h4 class="modal-title"><i id="dialog-perms-icon" class="fa fa-fw"></i> {{$aclModalTitle}}</h4>
|
<h4 class="modal-title"><i id="dialog-perms-icon" class="fa fa-fw"></i> {{$aclModalTitle}}</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="section-content-wrapper">
|
||||||
{{if $aclModalDesc}}
|
{{if $aclModalDesc}}
|
||||||
<div id="acl-dialog-description">{{$aclModalDesc}}</div>
|
<div id="acl-dialog-description" class="section-content-info-wrapper">{{$aclModalDesc}}</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $jotnets}}
|
{{if $jotnets}}
|
||||||
<div class="jotnets-wrapper" role="tab" id="jotnets-wrapper">
|
<div class="jotnets-wrapper" role="tab" id="jotnets-wrapper">
|
||||||
@ -25,8 +25,12 @@
|
|||||||
<div id="acl-radiowrapper-showall" class="radio">
|
<div id="acl-radiowrapper-showall" class="radio">
|
||||||
<label>
|
<label>
|
||||||
<input id="acl-showall" type="radio" name="optionsRadios" value="option1" checked>
|
<input id="acl-showall" type="radio" name="optionsRadios" value="option1" checked>
|
||||||
<i class="fa fa-globe"></i><span id=acl-showall-caption>{{$showall}}</span>
|
{{if $showallIcon}}<i class="fa {{$showallIcon}}"></i>{{/if}}
|
||||||
|
<span id="acl-showall-caption">{{$showall}}</span>
|
||||||
</label>
|
</label>
|
||||||
|
{{if $showallOrigin}}
|
||||||
|
<a id="acl-info-icon" role="button" tabindex="0" class="fa fa-info-circle" data-trigger="focus" data-toggle="popover" data-placement="top" data-content="{{$showallOrigin}}"></a>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div id="acl-radiowrapper-showlimited" class="radio">
|
<div id="acl-radiowrapper-showlimited" class="radio">
|
||||||
<label>
|
<label>
|
||||||
@ -34,9 +38,13 @@
|
|||||||
<span id=acl-showlimited-caption>{{$showlimited}}</span>
|
<span id=acl-showlimited-caption>{{$showlimited}}</span>
|
||||||
</label>
|
</label>
|
||||||
<div id="acl-list">
|
<div id="acl-list">
|
||||||
<input type="text" id="acl-search" placeholder=" {{$search}}">
|
<div id="acl-search-wrapper">
|
||||||
<div id=acl-showlimited-description>{{$showlimitedDesc}}</div>
|
<input type="text" id="acl-search" placeholder=" {{$search}}">
|
||||||
<div id="acl-list-content"></div>
|
</div>
|
||||||
|
<div id="acl-list-content-wrapper">
|
||||||
|
<div id=acl-showlimited-description>{{$showlimitedDesc}}</div>
|
||||||
|
<div id="acl-list-content"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -57,6 +65,8 @@
|
|||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$('[data-toggle="popover"]').popover(); // Init the popover, if present
|
||||||
|
|
||||||
if(typeof acl=="undefined"){
|
if(typeof acl=="undefined"){
|
||||||
acl = new ACL(
|
acl = new ACL(
|
||||||
baseurl+"/acl",
|
baseurl+"/acl",
|
||||||
|
@ -116,7 +116,7 @@
|
|||||||
<div class="btn-group pull-right">
|
<div class="btn-group pull-right">
|
||||||
<button id="event-edit-preview-btn" class="btn btn-default" type="button" title="{{$preview}}" onclick="doEventPreview();"><i class="fa fa-eye" ></i></button>
|
<button id="event-edit-preview-btn" class="btn btn-default" type="button" title="{{$preview}}" onclick="doEventPreview();"><i class="fa fa-eye" ></i></button>
|
||||||
{{if ! $eid}}
|
{{if ! $eid}}
|
||||||
<button id="dbtn-acl" class="btn btn-default" type="button" data-toggle="modal" data-target="#aclModal" title="{{$permissions}}"><i id="jot-perms-icon"></i></button>
|
<button id="dbtn-acl" class="btn btn-default" type="button" data-toggle="modal" data-target="#aclModal" title="{{$permissions}}"><i id="jot-perms-icon" class="fa"></i></button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<button id="event-submit" class="btn btn-primary" type="submit" name="submit">{{$submit}}</button>
|
<button id="event-submit" class="btn btn-primary" type="submit" name="submit">{{$submit}}</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,10 +2,6 @@
|
|||||||
<base href="{{$baseurl}}/" />
|
<base href="{{$baseurl}}/" />
|
||||||
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable={{$user_scalable}}" />
|
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable={{$user_scalable}}" />
|
||||||
{{$metas}}
|
{{$metas}}
|
||||||
<!--[if IE]>
|
|
||||||
<script src="{{$baseurl}}/library/html5.js"></script>
|
|
||||||
<![endif]-->
|
|
||||||
|
|
||||||
{{$head_css}}
|
{{$head_css}}
|
||||||
{{$js_strings}}
|
{{$js_strings}}
|
||||||
{{$head_js}}
|
{{$head_js}}
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div id="settings-default-perms" class="form-group" >
|
<div id="settings-default-perms" class="form-group" >
|
||||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#aclModal"><i id="jot-perms-icon"></i> {{$permissions}}</button>
|
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#aclModal"><i id="jot-perms-icon" class="fa"></i> {{$permissions}}</button>
|
||||||
{{$aclselect}}
|
{{$aclselect}}
|
||||||
</div>
|
</div>
|
||||||
{{$group_select}}
|
{{$group_select}}
|
||||||
|
Reference in New Issue
Block a user