This commit is contained in:
nobody 2022-02-21 15:17:20 +11:00
commit d9ca4a59b1
19 changed files with 4139 additions and 4178 deletions

View file

@ -39,7 +39,7 @@ class PermissionRoles
$ret['directory_publish'] = true;
$ret['online'] = true;
$ret['perms_connect'] = [
'view_stream', 'view_profile', 'view_contacts', 'view_storage',
'view_stream', 'deliver_stream', 'view_profile', 'view_contacts', 'view_storage',
'view_pages', 'send_stream', 'post_mail', 'post_wall', 'post_comments'
];
$ret['limits'] = PermissionLimits::Std_Limits();
@ -51,7 +51,7 @@ class PermissionRoles
$ret['directory_publish'] = true;
$ret['online'] = false;
$ret['perms_connect'] = [
'view_stream', 'view_profile', 'view_storage',
'view_stream', 'deliver_stream', 'view_profile', 'view_storage',
'view_pages', 'send_stream', 'post_mail', 'post_wall', 'post_comments'
];
$ret['limits'] = PermissionLimits::Std_Limits();
@ -64,7 +64,7 @@ class PermissionRoles
$ret['directory_publish'] = true;
$ret['online'] = false;
$ret['perms_connect'] = [
'view_stream', 'view_profile', 'view_contacts', 'view_storage', 'write_storage',
'view_stream', 'deliver_stream', 'view_profile', 'view_contacts', 'view_storage', 'write_storage',
'view_pages', 'post_mail', 'post_wall', 'post_comments'
];
$ret['limits'] = PermissionLimits::Std_Limits();
@ -79,7 +79,7 @@ class PermissionRoles
$ret['directory_publish'] = true;
$ret['online'] = false;
$ret['perms_connect'] = [
'view_stream', 'view_profile', 'view_contacts', 'view_storage',
'view_stream', 'deliver_stream', 'view_profile', 'view_contacts', 'view_storage',
'view_pages', 'post_mail', 'post_wall', 'post_comments', 'moderated'
];
$ret['limits'] = PermissionLimits::Std_Limits();
@ -93,7 +93,7 @@ class PermissionRoles
$ret['directory_publish'] = true;
$ret['online'] = false;
$ret['perms_connect'] = [
'view_stream', 'view_profile', 'view_contacts', 'view_storage', 'write_storage',
'view_stream', 'deliver_stream', 'view_profile', 'view_contacts', 'view_storage', 'write_storage',
'view_pages', 'post_mail', 'post_wall', 'post_comments'
];
$ret['limits'] = PermissionLimits::Std_Limits();

View file

@ -58,18 +58,19 @@ class Permissions
{
$perms = [
'view_stream' => t('Grant viewing access to and delivery of your channel stream and posts'),
'view_profile' => t('Grant viewing access to your default channel profile'),
'view_contacts' => t('Grant viewing access to your address book (connections)'),
'view_storage' => t('Grant viewing access to your file storage and photos'),
'post_wall' => t('Grant permission to post on your channel (wall) page'),
'post_mail' => t('Accept delivery of direct messages and personal mail'),
'send_stream' => t('Accept delivery of their posts and all comments to their posts'),
'post_comments' => t('Accept delivery of their comments and likes on your posts'),
'write_storage' => t('Grant upload permissions to your file storage and photos'),
'republish' => t('Grant permission to republish/mirror your posts'),
'moderated' => t('Accept comments and wall posts only after approval (moderation)'),
'delegate' => t('Grant channel administration (delegation) permission')
'view_stream' => t('Grant viewing access to your channel stream and posts'),
'deliver_stream' => t('Permit delivery of your channel stream and posts'),
'view_profile' => t('Grant viewing access to your default channel profile'),
'view_contacts' => t('Grant viewing access to your address book (connections)'),
'view_storage' => t('Grant viewing access to your file storage and photos'),
'post_wall' => t('Grant permission to post on your channel (wall) page'),
'post_mail' => t('Accept delivery of direct messages and personal mail'),
'send_stream' => t('Accept delivery of their posts and all comments to their posts'),
'post_comments' => t('Accept delivery of their comments and likes on your posts'),
'write_storage' => t('Grant upload permissions to your file storage and photos'),
'republish' => t('Grant permission to republish/mirror your posts'),
'moderated' => t('Accept comments and wall posts only after approval (moderation)'),
'delegate' => t('Grant channel administration (delegation) permission')
];
$x = [

View file

@ -1779,7 +1779,6 @@ class Activity
];
}
$ret['summary'] = bbcode(get_config('system', 'siteinfo', ''), ['export' => true]);
$ret['source'] = [
'mediaType' => 'text/x-multicode',
'summary' => get_config('system', 'siteinfo', '')

View file

@ -13,6 +13,7 @@ use Code\Lib\Libsync;
use Code\Lib\AccessList;
use Code\Lib\Crypto;
use Code\Lib\Connect;
use Code\Lib\ABConfig;
use Code\Access\PermissionRoles;
use Code\Access\PermissionLimits;
use Code\Access\Permissions;
@ -89,20 +90,43 @@ class Channel
$sys = self::get_system();
if ($sys) {
// upgrade the default network drivers if this looks like an upgraded zot6-based platform.
// upgrade the default network drivers and permissions if this looks like an upgraded zot6-based platform.
if ($sys['xchan_network'] !== 'nomad') {
$chans = q("select * from channel where true");
if ($chans) {
foreach ($chans as $chan) {
q("update hubloc set hubloc_network = 'nomad' where xchan_hash = '%s'",
q("update hubloc set hubloc_network = 'nomad' where hubloc_hash = '%s'",
dbesc($chan['channel_hash'])
);
q("update hubloc set xchan_network = 'nomad' where xchan_hash = '%s'",
q("update xchan set xchan_network = 'nomad' where xchan_hash = '%s'",
dbesc($chan['channel_hash'])
);
}
}
q("update xchan set xchan_type = %d where xchan_hash = '%s'",
intval(XCHAN_TYPE_ORGANIZATION),
dbesc($sys['xchan_hash'])
);
// Add the new "deliver_stream" permission
$c = q("select * from channel where true");
if ($c) {
foreach ($c as $cv) {
PConfig::Set($cv['channel_id'],'perm_limits','deliver_stream', PERMS_SPECIFIC);
}
}
$ab = q("SELECT * from abook where abook_self = 0");
if ($ab) {
foreach ($ab as $abv) {
$p = explode(',', ABConfig::Get($abv['abook_channel'], $abv['abook_xchan'], 'system', 'my_perms', EMPTY_STR));
if (! in_array('deliver_stream', $p)) {
$p[] = 'deliver_stream';
}
ABConfig::Set($abv['abook_channel'], $abv['abook_xchan'], 'system', 'my_perms', implode(',', $p));
}
}
}
// fix lost system keys, since we cannot communicate without them
@ -323,6 +347,14 @@ class Channel
$publish = intval($role_permissions['directory_publish']);
}
$xchannel_type = XCHAN_TYPE_PERSON ;
if (strpos($arr['permissions_role'], 'forum') !== false || strpos($arr['permissions_role'], 'group') !== false) {
$xchannel_type = XCHAN_TYPE_GROUP ;
}
if ($system) {
$xchannel_type = XCHAN_TYPE_ORGANIZATION ;
}
$primary = true;
if (array_key_exists('primary', $arr)) {
@ -452,6 +484,7 @@ class Channel
'xchan_connurl' => z_root() . '/poco/' . $ret['channel']['channel_address'],
'xchan_name' => $ret['channel']['channel_name'],
'xchan_network' => 'nomad',
'xchan_type' => $xchannel_type,
'xchan_updated' => datetime_convert(),
'xchan_photo_date' => datetime_convert(),
'xchan_name_date' => datetime_convert(),

View file

@ -290,7 +290,7 @@ class Libprofile
$xchan = q("SELECT * from xchan where xchan_hash = '%s'",
dbesc($profile['channel_hash'])
}
);
$is_group = ($xchan && intval($xchan[0]['xchan_type']) === XCHAN_TYPE_GROUP);
$can_dm = perm_is_allowed($profile['uid'], (is_array($observer)) ? $observer['xchan_hash'] : EMPTY_STR, 'post_mail') && $is_group ;

View file

@ -1075,25 +1075,8 @@ class Libzot
$address = $ud_arr['ud_addr'];
}
// Are we a directory server of some kind?
$other_realm = false;
// $realm = get_directory_realm();
// if (array_key_exists('site',$arr)
// && array_key_exists('realm',$arr['site'])
// && (strpos($arr['site']['realm'],$realm) === false))
// $other_realm = true;
// if ($dirmode != DIRECTORY_MODE_NORMAL) {
// We're some kind of directory server. However we can only add directory information
// if the entry is in the same realm (or is a sub-realm). Sub-realms are denoted by
// including the parent realm in the name. e.g. 'RED_GLOBAL:foo' would allow an entry to
// be in directories for the local realm (foo) and also the RED_GLOBAL realm.
if (array_key_exists('profile', $arr) && is_array($arr['profile']) && (!$other_realm)) {
if (array_key_exists('profile', $arr) && is_array($arr['profile'])) {
$profile_changed = Libzotdir::import_directory_profile($xchan_hash, $arr['profile'], $address, $ud_flags, 1);
if ($profile_changed) {
$what .= 'profile ';
@ -1111,7 +1094,7 @@ class Libzot
dbesc($xchan_hash)
);
}
// }
if (array_key_exists('site', $arr) && is_array($arr['site'])) {
$profile_changed = self::import_site($arr['site']);
@ -2870,12 +2853,6 @@ class Libzot
if ($arr['directory_mode'] == 'normal') {
$site_directory = DIRECTORY_MODE_NORMAL;
}
if ($arr['directory_mode'] == 'primary') {
$site_directory = DIRECTORY_MODE_PRIMARY;
}
if ($arr['directory_mode'] == 'secondary') {
$site_directory = DIRECTORY_MODE_SECONDARY;
}
if ($arr['directory_mode'] == 'standalone') {
$site_directory = DIRECTORY_MODE_STANDALONE;
}
@ -2924,11 +2901,9 @@ class Libzot
$site_logo = EMPTY_STR;
$sitename = EMPTY_STR;
$directory_url = htmlspecialchars(isset($arr['directory_url']) ? $arr['directory_url'] : EMPTY_STR, ENT_COMPAT, 'UTF-8', false);
$url = htmlspecialchars(strtolower($arr['url']), ENT_COMPAT, 'UTF-8', false);
$sellpage = htmlspecialchars($arr['sellpage'], ENT_COMPAT, 'UTF-8', false);
$site_location = htmlspecialchars($arr['location'], ENT_COMPAT, 'UTF-8', false);
$site_realm = htmlspecialchars($arr['realm'], ENT_COMPAT, 'UTF-8', false);
$sitename = htmlspecialchars($arr['sitename'], ENT_COMPAT, 'UTF-8', false);
$site_project = htmlspecialchars($arr['project'], ENT_COMPAT, 'UTF-8', false);
$site_crypto = ((array_key_exists('encryption', $arr) && is_array($arr['encryption'])) ? htmlspecialchars(implode(',', $arr['encryption']), ENT_COMPAT, 'UTF-8', false) : '');
@ -2958,12 +2933,10 @@ class Libzot
if (
($siterecord['site_flags'] != $site_flags)
|| ($siterecord['site_access'] != $access_policy)
|| ($siterecord['site_directory'] != $directory_url)
|| ($siterecord['site_sellpage'] != $sellpage)
|| ($siterecord['site_location'] != $site_location)
|| ($siterecord['site_register'] != $register_policy)
|| ($siterecord['site_project'] != $site_project)
|| ($siterecord['site_realm'] != $site_realm)
|| ($siterecord['site_crypto'] != $site_crypto)
|| ($siterecord['site_version'] != $site_version)
) {
@ -2973,16 +2946,14 @@ class Libzot
// logger('import_site: stored: ' . print_r($siterecord,true));
$r = q(
"update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s', site_type = %d, site_project = '%s', site_version = '%s', site_crypto = '%s'
"update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_register = %d, site_update = '%s', site_sellpage = '%s', site_type = %d, site_project = '%s', site_version = '%s', site_crypto = '%s'
where site_url = '%s'",
dbesc($site_location),
intval($site_flags),
intval($access_policy),
dbesc($directory_url),
intval($register_policy),
dbesc(datetime_convert()),
dbesc($sellpage),
dbesc($site_realm),
intval(SITE_TYPE_ZOT),
dbesc($site_project),
dbesc($site_version),
@ -3010,10 +2981,8 @@ class Libzot
'site_access' => intval($access_policy),
'site_flags' => intval($site_flags),
'site_update' => datetime_convert(),
'site_directory' => $directory_url,
'site_register' => intval($register_policy),
'site_sellpage' => $sellpage,
'site_realm' => $site_realm,
'site_type' => intval(SITE_TYPE_ZOT),
'site_project' => $site_project,
'site_version' => $site_version,
@ -3488,7 +3457,6 @@ class Libzot
$ret['site']['sitehash'] = get_config('system', 'location_hash');
$ret['site']['sellpage'] = get_config('system', 'sellpage');
$ret['site']['location'] = get_config('system', 'site_location');
$ret['site']['realm'] = get_directory_realm();
$ret['site']['sitename'] = System::get_site_name();
$ret['site']['logo'] = System::get_site_icon();
$ret['site']['project'] = System::get_project_name();

View file

@ -59,14 +59,12 @@ class Site
}
$tos_required = ((x($_POST, 'tos_required')) ? intval(trim($_POST['tos_required'])) : 0);
$mirror_frontpage = ((x($_POST, 'mirror_frontpage')) ? intval(trim($_POST['mirror_frontpage'])) : 0);
$directory_server = ((x($_POST, 'directory_server')) ? trim($_POST['directory_server']) : '');
$force_publish = ((x($_POST, 'publish_all')) ? true : false);
$open_pubstream = ((x($_POST, 'open_pubstream')) ? true : false);
$public_stream_mode = ((x($_POST, 'public_stream_mode')) ? intval($_POST['public_stream_mode']) : PUBLIC_STREAM_NONE);
$animations = ((x($_POST, 'animations')) ? true : false);
$login_on_homepage = ((x($_POST, 'login_on_homepage')) ? true : false);
$enable_context_help = ((x($_POST, 'enable_context_help')) ? true : false);
$global_directory = ((x($_POST, 'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
$no_community_page = !((x($_POST, 'no_community_page')) ? true : false);
$default_expire_days = ((array_key_exists('default_expire_days', $_POST)) ? intval($_POST['default_expire_days']) : 0);
$active_expire_days = ((array_key_exists('active_expire_days', $_POST)) ? intval($_POST['active_expire_days']) : 7);
@ -127,10 +125,6 @@ class Site
set_config('system', 'animated_avatars', $animations);
set_config('system', 'tos_required', $tos_required);
if ($directory_server) {
set_config('system', 'directory_server', $directory_server);
}
if ($admininfo == '') {
del_config('system', 'admininfo');
} else {
@ -179,12 +173,6 @@ class Site
set_config('system', 'public_stream_mode', $public_stream_mode);
set_config('system', 'open_pubstream', $open_pubstream);
set_config('system', 'force_queue_threshold', $force_queue);
if ($global_directory == '') {
del_config('system', 'directory_submit_url');
} else {
set_config('system', 'directory_submit_url', $global_directory);
}
set_config('system', 'no_community_page', $no_community_page);
set_config('system', 'no_utf', $no_utf);
set_config('system', 'verifyssl', $verifyssl);
@ -259,29 +247,6 @@ class Site
}
}
$dir_choices = null;
$dirmode = get_config('system', 'directory_mode');
$realm = get_directory_realm();
// directory server should not be set or settable unless we are a directory client
// avoid older redmatrix servers which don't have modern encryption
if ($dirmode == DIRECTORY_MODE_NORMAL) {
$x = q(
"select site_url from site where site_flags in (%d,%d) and site_realm = '%s' and site_dead = 0",
intval(DIRECTORY_MODE_SECONDARY),
intval(DIRECTORY_MODE_PRIMARY),
dbesc($realm)
);
if ($x) {
$dir_choices = [];
foreach ($x as $xx) {
$dir_choices[$xx['site_url']] = $xx['site_url'];
}
}
}
/* Admin Info */
$admininfo = get_config('system', 'admininfo');
@ -362,7 +327,6 @@ class Site
'$reply_address' => ['reply_address', t('Reply-to email address for system generated email.'), get_config('system', 'reply_address', 'noreply@' . App::get_hostname()), ''],
'$from_email' => ['from_email', t('Sender (From) email address for system generated email.'), get_config('system', 'from_email', 'Administrator@' . App::get_hostname()), ''],
'$from_email_name' => ['from_email_name', t('Display name of email sender for system generated email.'), get_config('system', 'from_email_name', System::get_site_name()), ''],
'$directory_server' => (($dir_choices) ? ['directory_server', t("Directory Server URL"), get_config('system', 'directory_server'), t("Default directory server"), $dir_choices] : null),
'$proxyuser' => ['proxyuser', t("Proxy user"), get_config('system', 'proxyuser'), ""],
'$proxy' => ['proxy', t("Proxy URL"), get_config('system', 'proxy'), ""],
'$timeout' => ['timeout', t("Network fetch timeout"), (x(get_config('system', 'curl_timeout')) ? get_config('system', 'curl_timeout') : 60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")],

View file

@ -414,7 +414,7 @@ class Connedit extends Controller
if ($cmd === 'resetphoto') {
q(
"update xchan set xchan_photo_date = '2001-01-01 00:00:00' where xchan_hash = '%s'",
"update xchan set xchan_photo_date = '2001-01-01 00:00:00', xchan_name_date = '2001-01-01 00:00:00' where xchan_hash = '%s'",
dbesc($orig_record['xchan_hash'])
);
$cmd = 'refresh';

View file

@ -426,7 +426,6 @@ class Dirsearch extends Controller
{
$rand = db_getfunc('rand');
$realm = get_directory_realm();
$r = q(
"select * from site where site_type = %d and site_dead = 0",

View file

@ -288,7 +288,6 @@ class Display extends Controller
if ($noscript_content || $this->loading) {
$r = null;
require_once('include/channel.php');
$sys = Channel::get_system();
$sysid = $sys['channel_id'];
@ -312,7 +311,6 @@ class Display extends Controller
} elseif ($this->updating && !$this->loading) {
$r = null;
require_once('include/channel.php');
$sys = Channel::get_system();
$sysid = $sys['channel_id'];

25
Code/Update/_1255.php Normal file
View file

@ -0,0 +1,25 @@
<?php
namespace Code\Update;
use Code\Lib\PConfig;
class _1255
{
public function run()
{
$r = q("SELECT * from channel where true");
if ($r) {
foreach ($r as $rv) {
PConfig::Set($rv['channel_id'], 'perm_limits', 'deliver_stream', PERMS_SPECIFIC);
}
}
return UPDATE_SUCCESS;
}
public function verify()
{
return true;
}
}

View file

@ -435,7 +435,7 @@ class HTTPSig
if (!$force) {
$x = q(
"select * from xchan left join hubloc on xchan_hash = hubloc_hash where ( hubloc_addr = '%s' or hubloc_id_url = '%s' ) and and hubloc_network in ('nomad','zot6') order by hubloc_id desc",
"select * from xchan left join hubloc on xchan_hash = hubloc_hash where ( hubloc_addr = '%s' or hubloc_id_url = '%s' ) and hubloc_network in ('nomad','zot6') order by hubloc_id desc",
dbesc(str_replace('acct:', '', $id)),
dbesc($id)
);

View file

@ -27,7 +27,7 @@ require_once('version.php');
define ( 'PLATFORM_NAME', 'streams' );
define ( 'DB_UPDATE_VERSION', 1254 );
define ( 'DB_UPDATE_VERSION', 1255 );
define ( 'ZOT_REVISION', '11.0' );
define ( 'PLATFORM_ARCHITECTURE', 'zap' );
@ -85,14 +85,6 @@ define ( 'DIRECTORY_MODE_PRIMARY', 0x0001); // There can only be *one* prima
define ( 'DIRECTORY_MODE_SECONDARY', 0x0002); // All other mirror directory servers
define ( 'DIRECTORY_MODE_STANDALONE', 0x0100); // A detached (off the grid) hub with itself as directory server.
// We will look for upstream directories whenever we make contact
// with other sites, but if this is a new installation and isn't
// a standalone hub, we need to seed the service with a starting
// point to go out and find the rest of the world.
define ( 'DIRECTORY_REALM', 'ZAP');
// Types of xchan records. These are a superset of ActivityStreams Actor types
define ('XCHAN_TYPE_PERSON', 0);
@ -2467,18 +2459,6 @@ function head_get_icon() {
return $icon;
}
/**
* @brief Return the Realm of the directory.
*
* @return string
*/
function get_directory_realm() {
if($x = get_config('system', 'directory_realm'))
return $x;
return DIRECTORY_REALM;
}
/**
* @brief Return relative date of last completed poller execution.
*

View file

@ -170,10 +170,9 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) {
}
// This is a somewhat expensive operation but important.
// Don't send this item to anybody who isn't allowed to see it
// Don't send this item to anybody who doesn't have the deliver_stream permission
// Note: commented out - no longer needed in zap and later projects because we do not allow this permission to be changed.
// $recipients = check_list_permissions($item['uid'],$recipients,'view_stream');
$recipients = check_list_permissions($item['uid'],$recipients,'deliver_stream');
// remove any upstream recipients from our list.
// If it is ourself we'll add it back in a second.

View file

@ -9,7 +9,7 @@ require_once('include/security.php');
/**
* @file include/permissions.php
*
* This file conntains functions to check and work with permissions.
* This file contains functions to check and work with permissions.
*
*/

File diff suppressed because it is too large Load diff

View file

@ -1,2 +1,2 @@
<?php
define ( 'STD_VERSION', '22.02.17' );
define ( 'STD_VERSION', '22.02.19' );

View file

@ -1,9 +1,9 @@
<script language="javascript" type="text/javascript">
var editor = false;
var plaintext = '{{$editselect}}';
var pretext = '{{$pretext}}';
let editor = false;
let plaintext = '{{$editselect}}';
let pretext = '{{$pretext}}';
function initEditor(cb){
if(editor == false){
@ -54,8 +54,8 @@ function enableOnUser(){
<script src="vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js"></script>
<script>
var activeCommentID = 0;
var activeCommentText = '';
let activeCommentID = 0;
let activeCommentText = '';
$(document).ready(function() {
@ -72,7 +72,7 @@ var activeCommentText = '';
{{/if}}
$("input[name='link_style']").change(function() {
var radioValue = $("input[name='link_style']:checked"). val();
let radioValue = $("input[name='link_style']:checked"). val();
if(radioValue == '0') {
$("#linkmodaldiscover").hide();
}
@ -85,7 +85,7 @@ var activeCommentText = '';
$(document).on('click', '.poll-option-close', jotRemoveOption);
function jotSetMime() {
var mtype = $('#id_mimetype').val();
let mtype = $('#id_mimetype').val();
if(mtype == 'text/bbcode' || mtype == 'text/x-multicode')
$('#profile-jot-submit-left').show();
else
@ -129,7 +129,7 @@ var activeCommentText = '';
maxChunkSize: 2 * 1024 * 1024,
add: function(e,data) {
var tmpStr = $("#comment-edit-text-" + activeCommentID).val();
let tmpStr = $("#comment-edit-text-" + activeCommentID).val();
if(tmpStr == activeCommentText) {
tmpStr = "";
$("#comment-edit-text-" + activeCommentID).addClass("comment-edit-text-full");
@ -156,7 +156,7 @@ var activeCommentText = '';
});
function deleteCheckedItems() {
var checkedstr = '';
let checkedstr = '';
$('.item-select').each( function() {
if($(this).is(':checked')) {
@ -176,10 +176,10 @@ var activeCommentText = '';
function jotGetLink() {
textarea = document.getElementById('profile-jot-text');
if (textarea.selectionStart || textarea.selectionStart == "0") {
var start = textarea.selectionStart;
var end = textarea.selectionEnd;
let start = textarea.selectionStart;
let end = textarea.selectionEnd;
if (end > start) {
var reply = prompt("{{$linkurl}}");
let reply = prompt("{{$linkurl}}");
if(reply && reply.length) {
textarea.value = textarea.value.substring(0, start) + "[url=" + reply + "]" + textarea.value.substring(start, end) + "[/url]" + textarea.value.substring(end, textarea.value.length);
}
@ -199,19 +199,19 @@ var activeCommentText = '';
}
function jotgetlinkmodal() {
var reply = $('#id_link_url').val();
let reply = $('#id_link_url').val();
if(reply && reply.length) {
var radioValue = $("input[name='link_style']:checked"). val();
let radioValue = $("input[name='link_style']:checked"). val();
if(radioValue == '0') {
reply = '!' + reply;
}
var optstr = '';
var opts = $("input[name='oembed']:checked"). val();
let optstr = '';
let opts = $("input[name='oembed']:checked"). val();
if(opts) {
optstr = optstr + '&oembed=1';
}
var opts = $("input[name='zotobj']:checked"). val();
opts = $("input[name='zotobj']:checked"). val();
if(opts) {
optstr = optstr + '&zotobj=1';
}
@ -276,7 +276,7 @@ var activeCommentText = '';
$('#commModal').modal('show');
$('#comm-modal-OKButton').on('click', function() {
var comment_state = $("input[name='comments_allowed']:checked").val();
let comment_state = $("input[name='comments_allowed']:checked").val();
if (comment_state && comment_state.length) {
$('#jot-commentstate').val(comment_state);
}
@ -284,11 +284,11 @@ var activeCommentText = '';
$('#jot-commentstate').val(0);
}
var post_comments = $('#id_post_comments').val();
let post_comments = $('#id_post_comments').val();
if (post_comments && post_comments.length) {
$('#jot-commfrom').val(post_comments);
}
var reply=$('#commclose-date').val();
let reply=$('#commclose-date').val();
if(reply && reply.length) {
$('#jot-commclosed').val(reply);
}
@ -334,15 +334,15 @@ var activeCommentText = '';
}
function linkdropper(event) {
var linkFound = ((event.dataTransfer.types.indexOf("text/uri-list") > -1) ? true : false);
let linkFound = ((event.dataTransfer.types.indexOf("text/uri-list") > -1) ? true : false);
if(linkFound) {
event.preventDefault();
var editwin = '#' + event.target.id;
var commentwin = false;
let editwin = '#' + event.target.id;
let commentwin = false;
if(editwin) {
commentwin = ((editwin.indexOf('comment') >= 0) ? true : false);
if(commentwin) {
var commentid = editwin.substring(editwin.lastIndexOf('-') + 1);
let commentid = editwin.substring(editwin.lastIndexOf('-') + 1);
$('#comment-edit-text-' + commentid).addClass('hover');
}
}
@ -350,27 +350,27 @@ var activeCommentText = '';
}
function linkdropexit(event) {
var editwin = '#' + event.target.id;
var commentwin = false;
let editwin = '#' + event.target.id;
let commentwin = false;
if(editwin) {
commentwin = ((editwin.indexOf('comment') >= 0) ? true : false);
if(commentwin) {
var commentid = editwin.substring(editwin.lastIndexOf('-') + 1);
let commentid = editwin.substring(editwin.lastIndexOf('-') + 1);
$('#comment-edit-text-' + commentid).removeClass('hover');
}
}
}
function linkdrop(event) {
var reply = event.dataTransfer.getData("text/uri-list");
let reply = event.dataTransfer.getData("text/uri-list");
if(reply) {
event.preventDefault();
var editwin = '#' + event.target.id;
var commentwin = false;
let editwin = '#' + event.target.id;
let commentwin = false;
if(editwin) {
commentwin = ((editwin.indexOf('comment') >= 0) ? true : false);
if(commentwin) {
var commentid = editwin.substring(editwin.lastIndexOf('-') + 1);
let commentid = editwin.substring(editwin.lastIndexOf('-') + 1);
$("#comment-edit-text-" + commentid).addClass("expanded");
}
}
@ -493,7 +493,7 @@ var activeCommentText = '';
}
var initializeEmbedPhotoDialog = function () {
let initializeEmbedPhotoDialog = function () {
$('.embed-photo-selected-photo').each(function (index) {
$(this).removeClass('embed-photo-selected-photo');
});
@ -502,7 +502,7 @@ var activeCommentText = '';
$('#embedPhotoModal').modal('show');
};
var choosePhotoFromAlbum = function (album) {
let choosePhotoFromAlbum = function (album) {
$.post("embedphotos/album", {name: album},
function(data) {
if (data['status']) {
@ -518,11 +518,11 @@ var activeCommentText = '';
$('#embedPhotoModalBodyAlbumDialog').append(data['content']);
$('#embedPhotoModalBodyAlbumDialog').click(function (evt) {
evt.preventDefault();
var image = document.getElementById(evt.target.id);
let image = document.getElementById(evt.target.id);
if (typeof($(image).parent()[0]) !== 'undefined') {
var imageparent = document.getElementById($(image).parent()[0].id);
let imageparent = document.getElementById($(image).parent()[0].id);
$(imageparent).toggleClass('embed-photo-selected-photo');
var href = $(imageparent).attr('href');
let href = $(imageparent).attr('href');
$.post("embedphotos/photolink", {href: href},
function(ddata) {
if (ddata['status']) {
@ -549,17 +549,17 @@ var activeCommentText = '';
'json');
};
var getPhotoAlbumList = function () {
let getPhotoAlbumList = function () {
$.post("embedphotos/albumlist", {},
function(data) {
if (data['status']) {
var albums = data['albumlist']; //JSON.parse(data['albumlist']);
let albums = data['albumlist']; //JSON.parse(data['albumlist']);
$('#embedPhotoModalLabel').html("{{$modalchoosealbum}}");
$('#embedPhotoModalBodyAlbumList').html('<ul class="nav nav-pills flex-column"></ul>');
for(var i=0; i<albums.length; i++) {
var albumName = albums[i].text;
var jsAlbumName = albums[i].jstext;
var albumLink = '<li class="nav-item">';
for(let i=0; i<albums.length; i++) {
let albumName = albums[i].text;
let jsAlbumName = albums[i].jstext;
let albumLink = '<li class="nav-item">';
albumLink += '<a class="nav-link" href="#" onclick="choosePhotoFromAlbum(\'' + jsAlbumName + '\'); return false;">' + albumName + '</a>';
albumLink += '</li>';
$('#embedPhotoModalBodyAlbumList').find('ul').append(albumLink);
@ -578,7 +578,7 @@ var activeCommentText = '';
// initialize drag-drop
function DragDropUploadInit() {
var filedrag = $("#profile-jot-text");
let filedrag = $("#profile-jot-text");
// file drop
filedrag.on("dragover", DragDropUploadFileHover);
@ -613,7 +613,7 @@ var activeCommentText = '';
}
function jotAddOption() {
var option = '<div class="jot-poll-option form-group"><input class="w-100 border-0" name="poll_answers[]" type="text" value="" placeholder="Option"><div class="poll-option-close"><i class="fa fa-close"></i></div></div>';
let option = '<div class="jot-poll-option form-group"><input class="w-100 border-0" name="poll_answers[]" type="text" value="" placeholder="Option"><div class="poll-option-close"><i class="fa fa-close"></i></div></div>';
$('#jot-poll-options').append(option);
}
@ -625,7 +625,7 @@ var activeCommentText = '';
<script>
$( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-delete-link,.block-delete-link", function(e) {
var link = $(this).attr("href"); // "get" the intended link in a var
let link = $(this).attr("href"); // "get" the intended link in a let
if (typeof(eval($.fn.modal)) === 'function'){
e.preventDefault();
@ -642,13 +642,13 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del
<script>
var postSaveTimer = null;
let postSaveTimer = null;
function postSaveChanges(action) {
if({{$auto_save_draft}}) {
var doctype = $('#jot-webpage').val();
var postid = '-' + doctype + '-' + $('#jot-postid').val();
let doctype = $('#jot-webpage').val();
let postid = '-' + doctype + '-' + $('#jot-postid').val();
if(action != 'clean') {
localStorage.setItem("post_title" + postid, $("#jot-title").val());
@ -681,15 +681,15 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del
$(document).ready(function() {
var cleaned = false;
let cleaned = false;
if({{$auto_save_draft}}) {
var doctype = $('#jot-webpage').val();
var postid = '-' + doctype + '-' + $('#jot-postid').val();
var postTitle = localStorage.getItem("post_title" + postid);
var postBody = localStorage.getItem("post_body" + postid);
var postCategory = (($("#jot-category").length) ? localStorage.getItem("post_category" + postid) : '');
var openEditor = false;
let doctype = $('#jot-webpage').val();
let postid = '-' + doctype + '-' + $('#jot-postid').val();
let postTitle = localStorage.getItem("post_title" + postid);
let postBody = localStorage.getItem("post_body" + postid);
let postCategory = (($("#jot-category").length) ? localStorage.getItem("post_category" + postid) : '');
let openEditor = false;
if(postTitle) {
$('#jot-title').val(postTitle);
@ -700,7 +700,7 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del
openEditor = true;
}
if(postCategory) {
var categories = postCategory.split(',');
let categories = postCategory.split(',');
categories.forEach(function(cat) {
$('#jot-category').tagsinput('add', cat);
});

View file

@ -35,7 +35,7 @@
{{/if}}
{{if $nav.channels}}
{{foreach $nav.channels as $chan}}
<a class="dropdown-item" href="manage/{{$chan.channel_id}}" title="{{$chan.channel_name}}" role="menuitem"><i class="fa fa-circle{{if $localuser == $chan.channel_id}} text-success{{else}} invisible{{/if}}"></i> {{$chan.channel_name}}</a>
<a class="dropdown-item" href="manage/{{$chan.channel_id}}" title="{{$chan.channel_name}}" role="menuitem"><i class="fa fa-circle{{if $localuser == $chan.channel_id}} text-success{{else}} invisible{{/if}}"></i> {{if $chan.channel_system}}<strong>{{$chan.channel_name}}</strong>{{else}}{{$chan.channel_name}}{{/if}}</a>
{{/foreach}}
{{/if}}
{{if $nav.profiles}}