Merge branch 'dev'

This commit is contained in:
zotlabs 2018-10-04 19:20:10 -07:00
commit 3a0a611f15
144 changed files with 1362 additions and 910 deletions

View File

@ -271,6 +271,10 @@ class Apps {
if(! can_view_public_stream())
unset($ret);
break;
case 'custom_role':
if(get_pconfig(local_channel(),'system','permissions_role') != 'custom')
unset($ret);
break;
case 'observer':
if(! $observer)
unset($ret);
@ -337,7 +341,20 @@ class Apps {
'Profiles' => t('Profiles'),
'Privacy Groups' => t('Privacy Groups'),
'Notifications' => t('Notifications'),
'Order Apps' => t('Order Apps')
'Order Apps' => t('Order Apps'),
'CalDAV' => t('CalDAV'),
'CardDAV' => t('CardDAV'),
'Channel Sources' => t('Channel Sources'),
'Gallery' => t('Gallery'),
'Guest Access' => t('Guest Access'),
'Notes' => t('Notes'),
'OAuth Apps Manager' => t('OAuth Apps Manager'),
'OAuth2 Apps Manager' => t('OAuth2 Apps Manager'),
'PDL Editor' => t('PDL Editor'),
'Permission Categories' => t('Permission Categories'),
'Premium Channel' => t('Premium Channel'),
'Public Stream' => t('Public Stream'),
'My Chatrooms' => t('My Chatrooms')
);
if(array_key_exists('name',$arr)) {
@ -349,6 +366,9 @@ class Apps {
for($x = 0; $x < count($arr); $x++) {
if(array_key_exists($arr[$x]['name'],$apps)) {
$arr[$x]['name'] = $apps[$arr[$x]['name']];
} else {
// Try to guess by app name if not in list
$arr[$x]['name'] = t(trim($arr[$x]['name']));
}
}
}
@ -452,6 +472,10 @@ class Apps {
if(! can_view_public_stream())
return '';
break;
case 'custom_role':
if(get_pconfig(local_channel(),'system','permissions_role') != 'custom')
return '';
break;
case 'observer':
$observer = \App::get_observer();
if(! $observer)
@ -530,9 +554,20 @@ class Apps {
}
static public function app_install($uid,$app) {
if(! is_array($app)) {
$r = q("select * from app where app_name = '%s' and app_channel = 0",
dbesc($app)
);
if(! $r)
return false;
$app = self::app_encode($r[0]);
}
$app['uid'] = $uid;
if(self::app_installed($uid,$app))
if(self::app_installed($uid,$app,true))
$x = self::app_update($app);
else
$x = self::app_store($app);
@ -596,6 +631,7 @@ class Apps {
intval(TERM_OBJ_APP),
intval($x[0]['id'])
);
call_hooks('app_destroy', $x[0]);
}
else {
$r = q("update app set app_deleted = 1 where app_id = '%s' and app_channel = %d",
@ -660,33 +696,60 @@ class Apps {
}
}
static public function app_installed($uid,$app) {
static public function app_installed($uid,$app,$bypass_filter=false) {
$r = q("select id from app where app_id = '%s' and app_channel = %d limit 1",
dbesc((array_key_exists('guid',$app)) ? $app['guid'] : ''),
intval($uid)
);
if (!$bypass_filter) {
$filter_arr = [
'uid'=>$uid,
'app'=>$app,
'installed'=>$r
];
call_hooks('app_installed_filter',$filter_arr);
$r = $filter_arr['installed'];
}
return(($r) ? true : false);
}
static public function addon_app_installed($uid,$app) {
static public function addon_app_installed($uid,$app,$bypass_filter=false) {
$r = q("select id from app where app_plugin = '%s' and app_channel = %d limit 1",
dbesc($app),
intval($uid)
);
if (!$bypass_filter) {
$filter_arr = [
'uid'=>$uid,
'app'=>$app,
'installed'=>$r
];
call_hooks('addon_app_installed_filter',$filter_arr);
$r = $filter_arr['installed'];
}
return(($r) ? true : false);
}
static public function system_app_installed($uid,$app) {
static public function system_app_installed($uid,$app,$bypass_filter=false) {
$r = q("select id from app where app_id = '%s' and app_channel = %d limit 1",
dbesc(hash('whirlpool',$app)),
intval($uid)
);
if (!$bypass_filter) {
$filter_arr = [
'uid'=>$uid,
'app'=>$app,
'installed'=>$r
];
call_hooks('system_app_installed_filter',$filter_arr);
$r = $filter_arr['installed'];
}
return(($r) ? true : false);
}

View File

@ -20,11 +20,11 @@ class Group {
// access lists. What we're doing here is reviving the dead group, but old content which
// was restricted to this group may now be seen by the new group members.
$z = q("SELECT * FROM groups WHERE id = %d LIMIT 1",
$z = q("SELECT * FROM pgrp WHERE id = %d LIMIT 1",
intval($r)
);
if(($z) && $z[0]['deleted']) {
q('UPDATE groups SET deleted = 0 WHERE id = %d', intval($z[0]['id']));
q('UPDATE pgrp SET deleted = 0 WHERE id = %d', intval($z[0]['id']));
notice( t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
}
return true;
@ -34,13 +34,13 @@ class Group {
$dups = false;
$hash = random_string(32) . str_replace(['<','>'],['.','.'], $name);
$r = q("SELECT id FROM groups WHERE hash = '%s' LIMIT 1", dbesc($hash));
$r = q("SELECT id FROM pgrp WHERE hash = '%s' LIMIT 1", dbesc($hash));
if($r)
$dups = true;
} while($dups == true);
$r = q("INSERT INTO groups ( hash, uid, visible, gname )
$r = q("INSERT INTO pgrp ( hash, uid, visible, gname )
VALUES( '%s', %d, %d, '%s' ) ",
dbesc($hash),
intval($uid),
@ -58,7 +58,7 @@ class Group {
static function remove($uid,$name) {
$ret = false;
if(x($uid) && x($name)) {
$r = q("SELECT id, hash FROM groups WHERE uid = %d AND gname = '%s' LIMIT 1",
$r = q("SELECT id, hash FROM pgrp WHERE uid = %d AND gname = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);
@ -103,13 +103,13 @@ class Group {
}
// remove all members
$r = q("DELETE FROM group_member WHERE uid = %d AND gid = %d ",
$r = q("DELETE FROM pgrp_member WHERE uid = %d AND gid = %d ",
intval($uid),
intval($group_id)
);
// remove group
$r = q("UPDATE groups SET deleted = 1 WHERE uid = %d AND gname = '%s'",
$r = q("UPDATE pgrp SET deleted = 1 WHERE uid = %d AND gname = '%s'",
intval($uid),
dbesc($name)
);
@ -127,7 +127,7 @@ class Group {
static function byname($uid,$name) {
if((! $uid) || (! strlen($name)))
return false;
$r = q("SELECT * FROM groups WHERE uid = %d AND gname = '%s' LIMIT 1",
$r = q("SELECT * FROM pgrp WHERE uid = %d AND gname = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);
@ -140,7 +140,7 @@ class Group {
static function rec_byhash($uid,$hash) {
if((! $uid) || (! strlen($hash)))
return false;
$r = q("SELECT * FROM groups WHERE uid = %d AND hash = '%s' LIMIT 1",
$r = q("SELECT * FROM pgrp WHERE uid = %d AND hash = '%s' LIMIT 1",
intval($uid),
dbesc($hash)
);
@ -156,7 +156,7 @@ class Group {
return false;
if(! ( $uid && $gid && $member))
return false;
$r = q("DELETE FROM group_member WHERE uid = %d AND gid = %d AND xchan = '%s' ",
$r = q("DELETE FROM pgrp_member WHERE uid = %d AND gid = %d AND xchan = '%s' ",
intval($uid),
intval($gid),
dbesc($member)
@ -174,7 +174,7 @@ class Group {
if((! $gid) || (! $uid) || (! $member))
return false;
$r = q("SELECT * FROM group_member WHERE uid = %d AND gid = %d AND xchan = '%s' LIMIT 1",
$r = q("SELECT * FROM pgrp_member WHERE uid = %d AND gid = %d AND xchan = '%s' LIMIT 1",
intval($uid),
intval($gid),
dbesc($member)
@ -184,7 +184,7 @@ class Group {
// we indicate success because the group member was in fact created
// -- It was just created at another time
if(! $r)
$r = q("INSERT INTO group_member (uid, gid, xchan)
$r = q("INSERT INTO pgrp_member (uid, gid, xchan)
VALUES( %d, %d, '%s' ) ",
intval($uid),
intval($gid),
@ -200,9 +200,9 @@ class Group {
static function members($gid) {
$ret = array();
if(intval($gid)) {
$r = q("SELECT * FROM group_member
LEFT JOIN abook ON abook_xchan = group_member.xchan left join xchan on xchan_hash = abook_xchan
WHERE gid = %d AND abook_channel = %d and group_member.uid = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 ORDER BY xchan_name ASC ",
$r = q("SELECT * FROM pgrp_member
LEFT JOIN abook ON abook_xchan = pgrp_member.xchan left join xchan on xchan_hash = abook_xchan
WHERE gid = %d AND abook_channel = %d and pgrp_member.uid = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 ORDER BY xchan_name ASC ",
intval($gid),
intval(local_channel()),
intval(local_channel())
@ -216,7 +216,7 @@ class Group {
static function members_xchan($gid) {
$ret = [];
if(intval($gid)) {
$r = q("SELECT xchan FROM group_member WHERE gid = %d AND uid = %d",
$r = q("SELECT xchan FROM pgrp_member WHERE gid = %d AND uid = %d",
intval($gid),
intval(local_channel())
);
@ -254,7 +254,7 @@ class Group {
$grps = [];
$o = '';
$r = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
$r = q("SELECT * FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
intval($uid)
);
$grps[] = array('name' => '', 'hash' => '0', 'selected' => '');
@ -286,7 +286,7 @@ class Group {
$groups = array();
$r = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
$r = q("SELECT * FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
intval($_SESSION['uid'])
);
$member_of = array();
@ -366,7 +366,7 @@ class Group {
stringify_array_elms($x,true);
$groups = implode(',', $x);
if($groups) {
$r = q("SELECT xchan FROM group_member WHERE gid IN ( select id from groups where hash in ( $groups ))");
$r = q("SELECT xchan FROM pgrp_member WHERE gid IN ( select id from pgrp where hash in ( $groups ))");
if($r) {
foreach($r as $rr) {
$ret[] = $rr['xchan'];
@ -379,7 +379,7 @@ class Group {
static function member_of($c) {
$r = q("SELECT groups.gname, groups.id FROM groups LEFT JOIN group_member ON group_member.gid = groups.id WHERE group_member.xchan = '%s' AND groups.deleted = 0 ORDER BY groups.gname ASC ",
$r = q("SELECT pgrp.gname, pgrp.id FROM pgrp LEFT JOIN pgrp_member ON pgrp_member.gid = pgrp.id WHERE pgrp_member.xchan = '%s' AND pgrp.deleted = 0 ORDER BY pgrp.gname ASC ",
dbesc($c)
);
@ -389,7 +389,7 @@ class Group {
static function containing($uid,$c) {
$r = q("SELECT gid FROM group_member WHERE uid = %d AND group_member.xchan = '%s' ",
$r = q("SELECT gid FROM pgrp_member WHERE uid = %d AND pgrp_member.xchan = '%s' ",
intval($uid),
dbesc($c)
);

View File

@ -122,13 +122,13 @@ class Libsync {
}
if($groups_changed) {
$r = q("select hash as collection, visible, deleted, gname as name from groups where uid = %d",
$r = q("select hash as collection, visible, deleted, gname as name from pgrp where uid = %d",
intval($uid)
);
if($r)
$info['collections'] = $r;
$r = q("select groups.hash as collection, group_member.xchan as member from groups left join group_member on groups.id = group_member.gid where group_member.uid = %d",
$r = q("select pgrp.hash as collection, pgrp_member.xchan as member from pgrp left join pgrp_member on pgrp.id = pgrp_member.gid where pgrp_member.uid = %d",
intval($uid)
);
if($r)
@ -464,7 +464,7 @@ class Libsync {
// sync collections (privacy groups) oh joy...
if(array_key_exists('collections',$arr) && is_array($arr['collections']) && count($arr['collections'])) {
$x = q("select * from groups where uid = %d",
$x = q("select * from pgrp where uid = %d",
intval($channel['channel_id'])
);
foreach($arr['collections'] as $cl) {
@ -480,7 +480,7 @@ class Libsync {
if(($y['gname'] != $cl['name'])
|| ($y['visible'] != $cl['visible'])
|| ($y['deleted'] != $cl['deleted'])) {
q("update groups set gname = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d",
q("update pgrp set gname = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d",
dbesc($cl['name']),
intval($cl['visible']),
intval($cl['deleted']),
@ -489,14 +489,14 @@ class Libsync {
);
}
if(intval($cl['deleted']) && (! intval($y['deleted']))) {
q("delete from group_member where gid = %d",
q("delete from pgrp_member where gid = %d",
intval($y['id'])
);
}
}
}
if(! $found) {
$r = q("INSERT INTO groups ( hash, uid, visible, deleted, gname )
$r = q("INSERT INTO pgrp ( hash, uid, visible, deleted, gname )
VALUES( '%s', %d, %d, %d, '%s' ) ",
dbesc($cl['collection']),
intval($channel['channel_id']),
@ -520,10 +520,10 @@ class Libsync {
}
}
if(! $found_local) {
q("delete from group_member where gid = %d",
q("delete from pgrp_member where gid = %d",
intval($y['id'])
);
q("update groups set deleted = 1 where id = %d and uid = %d",
q("update pgrp set deleted = 1 where id = %d and uid = %d",
intval($y['id']),
intval($channel['channel_id'])
);
@ -533,7 +533,7 @@ class Libsync {
}
// reload the group list with any updates
$x = q("select * from groups where uid = %d",
$x = q("select * from pgrp where uid = %d",
intval($channel['channel_id'])
);
@ -560,7 +560,7 @@ class Libsync {
if(isset($y['hash']) && isset($members[$y['hash']])) {
foreach($members[$y['hash']] as $member) {
$found = false;
$z = q("select xchan from group_member where gid = %d and uid = %d and xchan = '%s' limit 1",
$z = q("select xchan from pgrp_member where gid = %d and uid = %d and xchan = '%s' limit 1",
intval($y['id']),
intval($channel['channel_id']),
dbesc($member)
@ -571,7 +571,7 @@ class Libsync {
// if somebody is in the group that wasn't before - add them
if(! $found) {
q("INSERT INTO group_member (uid, gid, xchan)
q("INSERT INTO pgrp_member (uid, gid, xchan)
VALUES( %d, %d, '%s' ) ",
intval($channel['channel_id']),
intval($y['id']),
@ -582,7 +582,7 @@ class Libsync {
}
// now retrieve a list of members we have on this site
$m = q("select xchan from group_member where gid = %d and uid = %d",
$m = q("select xchan from pgrp_member where gid = %d and uid = %d",
intval($y['id']),
intval($channel['channel_id'])
);
@ -590,7 +590,7 @@ class Libsync {
foreach($m as $mm) {
// if the local existing member isn't in the list we just received - remove them
if(! in_array($mm['xchan'],$members[$y['hash']])) {
q("delete from group_member where xchan = '%s' and gid = %d and uid = %d",
q("delete from pgrp_member where xchan = '%s' and gid = %d and uid = %d",
dbesc($mm['xchan']),
intval($y['id']),
intval($channel['channel_id'])

View File

@ -259,7 +259,7 @@ class ThreadItem {
$forged = ((($item['sig']) && (! intval($item['item_verified']))) ? t('Message signature incorrect') : '');
$unverified = '' ; // (($this->is_wall_to_wall() && (! intval($item['item_verified']))) ? t('Message cannot be verified') : '');
$settings = '';
// FIXME - check this permission
if($conv->get_profile_owner() == local_channel()) {
@ -267,12 +267,14 @@ class ThreadItem {
'tagit' => t("Add Tag"),
'classtagger' => "",
);
$settings = t('Conversation Tools');
}
$has_bookmarks = false;
if(is_array($item['term'])) {
foreach($item['term'] as $t) {
if((get_account_techlevel() > 0) && ($t['ttype'] == TERM_BOOKMARK))
if(($t['ttype'] == TERM_BOOKMARK))
$has_bookmarks = true;
}
}
@ -436,7 +438,8 @@ class ThreadItem {
'preview_lbl' => t('This is an unsaved preview'),
'wait' => t('Please wait'),
'submid' => str_replace(['+','='], ['',''], base64_encode($item['mid'])),
'thread_level' => $thread_level
'thread_level' => $thread_level,
'settings' => $settings
);
$arr = array('item' => $item, 'output' => $tmp_item);

View File

@ -81,7 +81,7 @@ class Acl extends \Zotlabs\Web\Controller {
if($search) {
$sql_extra = " AND groups.gname LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " ";
$sql_extra = " AND pgrp.gname LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " ";
$sql_extra2 = "AND ( xchan_name LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " OR xchan_addr LIKE " . protect_sprintf( "'%" . dbesc(punify($search)) . ((strpos($search,'@') === false) ? "%@%'" : "%'")) . ") ";
// This horrible mess is needed because position also returns 0 if nothing is found.
@ -128,13 +128,13 @@ class Acl extends \Zotlabs\Web\Controller {
// Normal privacy groups
$r = q("SELECT groups.id, groups.hash, groups.gname
FROM groups, group_member
WHERE groups.deleted = 0 AND groups.uid = %d
AND group_member.gid = groups.id
$r = q("SELECT pgrp.id, pgrp.hash, pgrp.gname
FROM pgrp, pgrp_member
WHERE pgrp.deleted = 0 AND pgrp.uid = %d
AND pgrp_member.gid = pgrp.id
$sql_extra
GROUP BY groups.id
ORDER BY groups.gname
GROUP BY pgrp.id
ORDER BY pgrp.gname
LIMIT %d OFFSET %d",
intval(local_channel()),
intval($count),

View File

@ -31,7 +31,7 @@ class Account_edit {
}
$service_class = trim($_REQUEST['service_class']);
$account_level = intval(trim($_REQUEST['account_level']));
$account_level = 5;
$account_language = trim($_REQUEST['account_language']);
$r = q("update account set account_service_class = '%s', account_level = %d, account_language = '%s'
@ -68,7 +68,6 @@ class Account_edit {
'$title' => t('Account Edit'),
'$pass1' => [ 'pass1', t('New Password'), ' ','' ],
'$pass2' => [ 'pass2', t('New Password again'), ' ','' ],
'$account_level' => [ 'account_level', t('Technical skill level'), $x[0]['account_level'], '', \Zotlabs\Lib\Techlevels::levels() ],
'$account_language' => [ 'account_language' , t('Account language (for emails)'), $x[0]['account_language'], '', language_list() ],
'$service_class' => [ 'service_class', t('Service class'), $x[0]['account_service_class'], '' ],
'$submit' => t('Submit'),
@ -81,4 +80,4 @@ class Account_edit {
}
}
}

View File

@ -72,7 +72,6 @@ class Site {
$maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50);
$feed_contacts = ((x($_POST,'feed_contacts')) ? intval($_POST['feed_contacts']) : 0);
$verify_email = ((x($_POST,'verify_email')) ? 1 : 0);
$techlevel_lock = ((x($_POST,'techlock')) ? intval($_POST['techlock']) : 0);
$imagick_path = ((x($_POST,'imagick_path')) ? trim($_POST['imagick_path']) : '');
$thumbnail_security = ((x($_POST,'thumbnail_security')) ? intval($_POST['thumbnail_security']) : 0);
$force_queue = ((intval($_POST['force_queue']) > 0) ? intval($_POST['force_queue']) : 3000);
@ -81,10 +80,6 @@ class Site {
$permissions_role = escape_tags(trim($_POST['permissions_role']));
$techlevel = null;
if(array_key_exists('techlevel', $_POST))
$techlevel = intval($_POST['techlevel']);
set_config('system', 'feed_contacts', $feed_contacts);
set_config('system', 'delivery_interval', $delivery_interval);
set_config('system', 'delivery_batch_count', $delivery_batch_count);
@ -110,12 +105,6 @@ class Site {
set_config('system', 'pubstream_incl',$pub_incl);
set_config('system', 'pubstream_excl',$pub_excl);
set_config('system', 'techlevel_lock', $techlevel_lock);
if(! is_null($techlevel))
set_config('system', 'techlevel', $techlevel);
if($directory_server)
set_config('system','directory_server',$directory_server);
@ -284,15 +273,6 @@ class Site {
// now invert the logic for the setting.
$discover_tab = (1 - $discover_tab);
$techlevels = [
'0' => t('Beginner/Basic'),
'1' => t('Novice - not skilled but willing to learn'),
'2' => t('Intermediate - somewhat comfortable'),
'3' => t('Advanced - very comfortable'),
'4' => t('Expert - I can write computer code'),
'5' => t('Wizard - I probably know more than you do')
];
$perm_roles = \Zotlabs\Access\PermissionRoles::roles();
$default_role = get_config('system','default_permissions_role','social');
@ -316,10 +296,6 @@ class Site {
// name, label, value, help string, extra data...
'$sitename' => array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''),
'$techlevel' => [ 'techlevel', t('Site default technical skill level'), get_config('system','techlevel'), t('Used to provide a member experience matched to technical comfort level'), $techlevels ],
'$techlock' => [ 'techlock', t('Lock the technical skill level setting'), get_config('system','techlevel_lock'), t('Members can set their own technical comfort level by default') ],
'$banner' => array('banner', t("Banner/Logo"), $banner, t('Unfiltered HTML/CSS/JS is allowed')),
'$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")),
'$siteinfo' => array('siteinfo', t('Site Information'), get_config('system','siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. BBCode can be used here")),

View File

@ -113,10 +113,12 @@ class Appman extends \Zotlabs\Web\Controller {
if($r) {
$app = $r[0];
$term = q("select * from term where otype = %d and oid = %d",
$term = q("select * from term where otype = %d and oid = %d and uid = %d",
intval(TERM_OBJ_APP),
intval($r[0]['id'])
intval($r[0]['id']),
intval(local_channel())
);
if($term) {
$app['categories'] = '';
foreach($term as $t) {

View File

@ -122,7 +122,7 @@ class Article_edit extends \Zotlabs\Web\Controller {
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
);
$editor = status_editor($a, $x);
$editor = status_editor($a, $x, false, 'Article_edit');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Article'),

View File

@ -40,7 +40,7 @@ class Articles extends Controller {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>Articles App (Not Installed):</b><br>';
$o = '<b>' . t('Articles App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Create interactive articles');
return $o;
}
@ -132,7 +132,7 @@ class Articles extends Controller {
$x['title'] = $_REQUEST['title'];
if($_REQUEST['body'])
$x['body'] = $_REQUEST['body'];
$editor = status_editor($a,$x);
$editor = status_editor($a,$x,false,'Articles');
}
else {

View File

@ -109,7 +109,7 @@ class Blocks extends \Zotlabs\Web\Controller {
if($_REQUEST['pagetitle'])
$x['pagetitle'] = $_REQUEST['pagetitle'];
$editor = status_editor($a,$x);
$editor = status_editor($a,$x,false,'Blocks');
$r = q("select iconfig.iid, iconfig.k, iconfig.v, mid, title, body, mimetype, created, edited from iconfig

View File

@ -122,7 +122,7 @@ class Card_edit extends \Zotlabs\Web\Controller {
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
);
$editor = status_editor($a, $x);
$editor = status_editor($a, $x, false, 'Card_edit');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Card'),

View File

@ -43,7 +43,7 @@ class Cards extends Controller {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>Cards App (Not Installed):</b><br>';
$o = '<b>' . t('Cards App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Create personal planning cards');
return $o;
}
@ -133,7 +133,7 @@ class Cards extends Controller {
if($_REQUEST['body'])
$x['body'] = $_REQUEST['body'];
$editor = status_editor($a, $x);
$editor = status_editor($a, $x, false, 'Cards');
}
else {
$editor = '';

View File

@ -836,7 +836,7 @@ class Cdav extends Controller {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>CalDAV App (Not Installed):</b><br>';
$o = '<b>' . t('CalDAV App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('CalDAV capable calendar');
return $o;
}
@ -845,7 +845,7 @@ class Cdav extends Controller {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>CardDAV App (Not Installed):</b><br>';
$o = '<b>' . t('CardDAV App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('CalDAV capable addressbook');
return $o;
}

View File

@ -168,7 +168,7 @@ class Channel extends Controller {
'reset' => t('Reset form')
);
$o .= status_editor($a,$x);
$o .= status_editor($a,$x,false,'Channel');
}
}
@ -182,7 +182,7 @@ class Channel extends Controller {
$item_normal_update = item_normal_update();
$sql_extra = item_permissions_sql(App::$profile['profile_uid']);
if(get_pconfig(App::$profile['profile_uid'],'system','channel_list_mode') && (! $mid))
if(feature_enabled(App::$profile['profile_uid'], 'channel_list_mode') && (! $mid))
$page_mode = 'list';
else
$page_mode = 'client';

View File

@ -99,7 +99,7 @@ class Chat extends Controller {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>Chatrooms App (Not Installed):</b><br>';
$o = '<b>' . t('Chatrooms App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Access Controlled Chatrooms');
return $o;
}

View File

@ -1,21 +1,21 @@
<?php
namespace Zotlabs\Module; /** @file */
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Apps;
require_once('include/contact_widgets.php');
require_once('include/items.php');
class Connect extends \Zotlabs\Web\Controller {
class Connect extends Controller {
function init() {
if(argc() > 1)
$which = argv(1);
else {
notice( t('Requested profile is not available.') . EOL );
\App::$error = 404;
App::$error = 404;
return;
}
@ -24,20 +24,32 @@ class Connect extends \Zotlabs\Web\Controller {
);
if($r)
\App::$data['channel'] = $r[0];
App::$data['channel'] = $r[0];
$channel_id = App::$data['channel']['channel_id'];
if(! Apps::system_app_installed($channel_id, 'Premium Channel')) {
return;
}
profile_load($which,'');
}
function post() {
if(! array_key_exists('channel', \App::$data))
if(! array_key_exists('channel', App::$data))
return;
$channel_id = App::$data['channel']['channel_id'];
if(! Apps::system_app_installed($channel_id, 'Premium Channel')) {
return;
}
$edit = ((local_channel() && (local_channel() == \App::$data['channel']['channel_id'])) ? true : false);
$edit = ((local_channel() && (local_channel() == $channel_id)) ? true : false);
if($edit) {
$has_premium = ((\App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? 1 : 0);
$has_premium = ((App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? 1 : 0);
$premium = (($_POST['premium']) ? intval($_POST['premium']) : 0);
$text = escape_tags($_POST['text']);
@ -48,25 +60,25 @@ class Connect extends \Zotlabs\Web\Controller {
intval(local_channel())
);
\Zotlabs\Daemon\Master::Summon(array('Notifier','refresh_all',\App::$data['channel']['channel_id']));
\Zotlabs\Daemon\Master::Summon(array('Notifier','refresh_all',$channel_id));
}
set_pconfig(\App::$data['channel']['channel_id'],'system','selltext',$text);
set_pconfig($channel_id,'system','selltext',$text);
// reload the page completely to get fresh data
goaway(z_root() . '/' . \App::$query_string);
goaway(z_root() . '/' . App::$query_string);
}
$url = '';
$observer = \App::get_observer();
$observer = App::get_observer();
if(($observer) && ($_POST['submit'] === t('Continue'))) {
if($observer['xchan_follow'])
$url = sprintf($observer['xchan_follow'],urlencode(channel_reddress(\App::$data['channel'])));
$url = sprintf($observer['xchan_follow'],urlencode(channel_reddress(App::$data['channel'])));
if(! $url) {
$r = q("select * from hubloc where hubloc_hash = '%s' order by hubloc_id desc limit 1",
dbesc($observer['xchan_hash'])
);
if($r)
$url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode(channel_reddress(\App::$data['channel']));
$url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode(channel_reddress(App::$data['channel']));
}
}
if($url)
@ -79,17 +91,31 @@ class Connect extends \Zotlabs\Web\Controller {
function get() {
if(! array_key_exists('channel', App::$data))
return;
$channel_id = App::$data['channel']['channel_id'];
if(! Apps::system_app_installed($channel_id, 'Premium Channel')) {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>' . t('Premium Channel App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Allows you to set restrictions and terms on those that connect with your channel');
return $o;
}
$edit = ((local_channel() && (local_channel() == \App::$data['channel']['channel_id'])) ? true : false);
$edit = ((local_channel() && (local_channel() == $channel_id)) ? true : false);
$text = get_pconfig(\App::$data['channel']['channel_id'],'system','selltext');
$text = get_pconfig($channel_id,'system','selltext');
if($edit) {
$o = replace_macros(get_markup_template('sellpage_edit.tpl'),array(
'$header' => t('Premium Channel Setup'),
'$address' => \App::$data['channel']['channel_address'],
'$premium' => array('premium', t('Enable premium channel connection restrictions'),((\App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? '1' : ''),''),
'$address' => App::$data['channel']['channel_address'],
'$premium' => array('premium', t('Enable premium channel connection restrictions'),((App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? '1' : ''),''),
'$lbl_about' => t('Please enter your restrictions or conditions, such as paypal receipt, usage guidelines, etc.'),
'$text' => $text,
'$desc' => t('This channel may require additional steps or acknowledgement of the following conditions prior to connecting:'),
@ -107,7 +133,7 @@ class Connect extends \Zotlabs\Web\Controller {
$submit = replace_macros(get_markup_template('sellpage_submit.tpl'), array(
'$continue' => t('Continue'),
'$address' => \App::$data['channel']['channel_address']
'$address' => App::$data['channel']['channel_address']
));
$o = replace_macros(get_markup_template('sellpage_view.tpl'),array(
@ -120,7 +146,7 @@ class Connect extends \Zotlabs\Web\Controller {
));
$arr = array('channel' => \App::$data['channel'],'observer' => \App::get_observer(), 'sellpage' => $o, 'submit' => $submit);
$arr = array('channel' => App::$data['channel'],'observer' => App::get_observer(), 'sellpage' => $o, 'submit' => $submit);
call_hooks('connect_premium', $arr);
$o = $arr['sellpage'];

View File

@ -220,7 +220,7 @@ class Connections extends \Zotlabs\Web\Controller {
$sql_extra .= (($searching) ? protect_sprintf(" AND xchan_name like '%$search_txt%' ") : "");
if($_REQUEST['gid']) {
$sql_extra .= " and xchan_hash in ( select xchan from group_member where gid = " . intval($_REQUEST['gid']) . " and uid = " . intval(local_channel()) . " ) ";
$sql_extra .= " and xchan_hash in ( select xchan from pgrp_member where gid = " . intval($_REQUEST['gid']) . " and uid = " . intval(local_channel()) . " ) ";
}
$r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash

View File

@ -7,6 +7,7 @@ namespace Zotlabs\Module;
*
*/
use Zotlabs\Lib\Apps;
require_once('include/socgraph.php');
require_once('include/selectors.php');
@ -851,7 +852,7 @@ class Connedit extends \Zotlabs\Web\Controller {
'$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), t('Connection requests will be approved without your interaction'), $yes_no),
'$permcat' => [ 'permcat', t('Permission role'), '', '<span class="loading invisible">' . t('Loading') . '<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span></span>',$permcats ],
'$permcat_new' => t('Add permission role'),
'$permcat_enable' => feature_enabled(local_channel(),'permcats'),
'$permcat_enable' => Apps::system_app_installed(local_channel(), 'Permission Categories'),
'$addr' => unpunify($contact['xchan_addr']),
'$primeurl' => unpunify($contact['xchan_url']),
'$section' => $section,

View File

@ -23,7 +23,7 @@ class Contactgroup extends \Zotlabs\Web\Controller {
if((argc() > 1) && (intval(argv(1)))) {
$r = q("SELECT * FROM groups WHERE id = %d AND uid = %d AND deleted = 0 LIMIT 1",
$r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d AND deleted = 0 LIMIT 1",
intval(argv(1)),
intval(local_channel())
);

View File

@ -1,14 +1,16 @@
<?php
namespace Zotlabs\Module;
use App;
use Zotlabs\Lib\Apps;
use Zotlabs\Web\Controller;
require_once('include/socgraph.php');
require_once('include/selectors.php');
require_once('include/group.php');
require_once('include/photos.php');
class Defperms extends \Zotlabs\Web\Controller {
class Defperms extends Controller {
/* @brief Initialize the connection-editor
*
@ -19,6 +21,9 @@ class Defperms extends \Zotlabs\Web\Controller {
if(! local_channel())
return;
if(! Apps::system_app_installed(local_channel(), 'Default Permissions'))
return;
$r = q("SELECT abook.*, xchan.*
FROM abook left join xchan on abook_xchan = xchan_hash
@ -26,10 +31,10 @@ class Defperms extends \Zotlabs\Web\Controller {
intval(local_channel())
);
if($r) {
\App::$poi = $r[0];
App::$poi = $r[0];
}
$channel = \App::get_channel();
$channel = App::get_channel();
if($channel)
head_set_icon($channel['xchan_photo_s']);
}
@ -43,12 +48,15 @@ class Defperms extends \Zotlabs\Web\Controller {
if(! local_channel())
return;
if(! Apps::system_app_installed(local_channel(), 'Default Permissions'))
return;
$contact_id = intval(argv(1));
if(! $contact_id)
return;
$channel = \App::get_channel();
$channel = App::get_channel();
$orig_record = q("SELECT * FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1",
intval($contact_id),
@ -112,7 +120,7 @@ class Defperms extends \Zotlabs\Web\Controller {
intval($contact_id)
);
if($r) {
\App::$poi = $r[0];
App::$poi = $r[0];
}
@ -131,22 +139,22 @@ class Defperms extends \Zotlabs\Web\Controller {
function defperms_clone(&$a) {
if(! \App::$poi)
if(! App::$poi)
return;
$channel = \App::get_channel();
$channel = App::get_channel();
$r = q("SELECT abook.*, xchan.*
FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d and abook_id = %d LIMIT 1",
intval(local_channel()),
intval(\App::$poi['abook_id'])
intval(App::$poi['abook_id'])
);
if($r) {
\App::$poi = array_shift($r);
App::$poi = array_shift($r);
}
$clone = \App::$poi;
$clone = App::$poi;
unset($clone['abook_id']);
unset($clone['abook_account']);
@ -173,9 +181,18 @@ class Defperms extends \Zotlabs\Web\Controller {
notice( t('Permission denied.') . EOL);
return login();
}
if(! Apps::system_app_installed(local_channel(), 'Default Permissions')) {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>' . t('Default Permissions App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Set custom default permissions for new connections');
return $o;
}
$section = ((array_key_exists('section',$_REQUEST)) ? $_REQUEST['section'] : '');
$channel = \App::get_channel();
$channel = App::get_channel();
$yes_no = array(t('No'),t('Yes'));
@ -193,7 +210,7 @@ class Defperms extends \Zotlabs\Web\Controller {
}
$o .= " }\n</script>\n";
if(\App::$poi) {
if(App::$poi) {
$sections = [];
@ -203,9 +220,9 @@ class Defperms extends \Zotlabs\Web\Controller {
$perms = array();
$channel = \App::get_channel();
$channel = App::get_channel();
$contact = \App::$poi;
$contact = App::$poi;
$global_perms = \Zotlabs\Access\Permissions::Perms();
@ -238,7 +255,7 @@ class Defperms extends \Zotlabs\Web\Controller {
'$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), t('If enabled, connection requests will be approved without your interaction'), $yes_no),
'$permcat' => [ 'permcat', t('Permission role'), '', '<span class="loading invisible">' . t('Loading') . '<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span></span>',$permcats ],
'$permcat_new' => t('Add permission role'),
'$permcat_enable' => feature_enabled(local_channel(),'permcats'),
'$permcat_enable' => Apps::system_app_installed(local_channel(), 'Permission Categories'),
'$section' => $section,
'$sections' => $sections,
'$autolbl' => t('The permissions indicated on this page will be applied to all new connections.'),

View File

@ -12,13 +12,16 @@ class Directory extends \Zotlabs\Web\Controller {
function init() {
\App::set_pager_itemspage(60);
if(x($_GET,'ignore')) {
if(local_channel() && x($_GET,'ignore')) {
q("insert into xign ( uid, xchan ) values ( %d, '%s' ) ",
intval(local_channel()),
dbesc($_GET['ignore'])
);
goaway(z_root() . '/directory?f=&suggest=1');
}
if(local_channel())
\App::$profile_uid = local_channel();
$observer = get_observer_hash();
$global_changed = false;
@ -55,6 +58,7 @@ class Directory extends \Zotlabs\Web\Controller {
if($observer)
set_xconfig($observer,'directory','pubforums',$pubforums);
}
}
function get() {

View File

@ -81,7 +81,7 @@ class Display extends \Zotlabs\Web\Controller {
);
$o = '<div id="jot-popup">';
$o .= status_editor($a,$x);
$o .= status_editor($a,$x,false,'Display');
$o .= '</div>';
}

View File

@ -132,7 +132,7 @@ class Editblock extends \Zotlabs\Web\Controller {
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
);
$editor = status_editor($a, $x);
$editor = status_editor($a, $x, false, 'Editblock');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Block'),

View File

@ -131,7 +131,7 @@ class Editlayout extends \Zotlabs\Web\Controller {
'profile_uid' => intval($owner),
);
$editor = status_editor($a, $x);
$editor = status_editor($a, $x, false, 'Editlayout');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Layout'),

View File

@ -102,7 +102,7 @@ class Editpost extends \Zotlabs\Web\Controller {
'bbcode' => true
);
$editor = status_editor($a, $x);
$editor = status_editor($a, $x, false, 'Editpost');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit post'),

View File

@ -160,7 +160,7 @@ class Editwebpage extends \Zotlabs\Web\Controller {
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
);
$editor = status_editor($a, $x);
$editor = status_editor($a, $x, false, 'Editwebpage');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Webpage'),

View File

@ -1,11 +1,13 @@
<?php
namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Apps;
require_once('include/group.php');
class Group extends \Zotlabs\Web\Controller {
class Group extends Controller {
function init() {
if(! local_channel()) {
@ -13,7 +15,11 @@ class Group extends \Zotlabs\Web\Controller {
return;
}
\App::$profile_uid = local_channel();
if(! Apps::system_app_installed(local_channel(), 'Privacy Groups')) {
return;
}
App::$profile_uid = local_channel();
nav_set_selected('Privacy Groups');
}
@ -24,6 +30,10 @@ class Group extends \Zotlabs\Web\Controller {
notice( t('Permission denied.') . EOL);
return;
}
if(! Apps::system_app_installed(local_channel(), 'Privacy Groups')) {
return;
}
if((argc() == 2) && (argv(1) === 'new')) {
check_form_security_token_redirectOnErr('/group/new', 'group_edit');
@ -43,7 +53,7 @@ class Group extends \Zotlabs\Web\Controller {
if((argc() == 2) && (intval(argv(1)))) {
check_form_security_token_redirectOnErr('/group', 'group_edit');
$r = q("SELECT * FROM groups WHERE id = %d AND uid = %d LIMIT 1",
$r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d LIMIT 1",
intval(argv(1)),
intval(local_channel())
);
@ -57,7 +67,7 @@ class Group extends \Zotlabs\Web\Controller {
$public = intval($_POST['public']);
if((strlen($groupname)) && (($groupname != $group['gname']) || ($public != $group['visible']))) {
$r = q("UPDATE groups SET gname = '%s', visible = %d WHERE uid = %d AND id = %d",
$r = q("UPDATE pgrp SET gname = '%s', visible = %d WHERE uid = %d AND id = %d",
dbesc($groupname),
intval($public),
intval(local_channel()),
@ -77,13 +87,22 @@ class Group extends \Zotlabs\Web\Controller {
$change = false;
logger('mod_group: ' . \App::$cmd,LOGGER_DEBUG);
logger('mod_group: ' . App::$cmd,LOGGER_DEBUG);
if(! local_channel()) {
notice( t('Permission denied') . EOL);
return;
}
if(! Apps::system_app_installed(local_channel(), 'Privacy Groups')) {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>' . t('Privacy Groups App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Management of privacy groups');
return $o;
}
// Switch to text mode interface if we have more than 'n' contacts or group members
$switchtotext = get_pconfig(local_channel(),'system','groupedit_image_limit');
if($switchtotext === false)
@ -96,7 +115,7 @@ class Group extends \Zotlabs\Web\Controller {
$new = (((argc() == 2) && (argv(1) === 'new')) ? true : false);
$groups = q("SELECT id, gname FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
$groups = q("SELECT id, gname FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
intval(local_channel())
);
@ -141,7 +160,7 @@ class Group extends \Zotlabs\Web\Controller {
check_form_security_token_redirectOnErr('/group', 'group_drop', 't');
if(intval(argv(2))) {
$r = q("SELECT gname FROM groups WHERE id = %d AND uid = %d LIMIT 1",
$r = q("SELECT gname FROM pgrp WHERE id = %d AND uid = %d LIMIT 1",
intval(argv(2)),
intval(local_channel())
);
@ -173,7 +192,7 @@ class Group extends \Zotlabs\Web\Controller {
if((argc() > 1) && (intval(argv(1)))) {
require_once('include/acl_selectors.php');
$r = q("SELECT * FROM groups WHERE id = %d AND uid = %d AND deleted = 0 LIMIT 1",
$r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d AND deleted = 0 LIMIT 1",
intval(argv(1)),
intval(local_channel())
);

View File

@ -13,14 +13,12 @@ class Home extends \Zotlabs\Web\Controller {
$ret = array();
call_hooks('home_init',$ret);
$splash = ((argc() > 1 && argv(1) === 'splash') ? true : false);
$channel = \App::get_channel();
if(local_channel() && $channel && $channel['xchan_url'] && ! $splash) {
$dest = $channel['channel_startpage'];
if(! $dest)
$dest = get_pconfig(local_channel(),'system','startpage');
$dest = (($ret['startpage']) ? $ret['startpage'] : '');
if(! $dest)
$dest = get_config('system','startpage');
if(! $dest)

View File

@ -138,7 +138,7 @@ class Hq extends \Zotlabs\Web\Controller {
[
'$no_messages' => (($target_item) ? false : true),
'$no_messages_label' => [ t('Welcome to Hubzilla!'), t('You have got no unseen posts...') ],
'$editor' => status_editor($a,$x)
'$editor' => status_editor($a,$x,false,'Hq')
]
);

View File

@ -428,7 +428,7 @@ class Import extends \Zotlabs\Web\Controller {
create_table_from_array('groups', $group);
}
$r = q("select * from groups where uid = %d",
$r = q("select * from pgrp where uid = %d",
intval($channel['channel_id'])
);
if($r) {

View File

@ -107,7 +107,7 @@ class Invite extends Controller {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>Invite App (Not Installed):</b><br>';
$o = '<b>' . t('Invite App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Send email invitations to join this network');
return $o;
}

View File

@ -1165,28 +1165,6 @@ class Item extends \Zotlabs\Web\Controller {
return $ret;
}
// auto-upgrade beginner (techlevel 0) accounts - if they have at least two friends and ten posts
// and have uploaded something (like a profile photo), promote them to level 1.
$a = q("select account_id, account_level from account where account_id = (select channel_account_id from channel where channel_id = %d limit 1)",
intval($channel_id)
);
if((! intval($a[0]['account_level'])) && intval($r[0]['total']) > 10) {
$x = q("select count(abook_id) as total from abook where abook_channel = %d",
intval($channel_id)
);
if($x && intval($x[0]['total']) > 2) {
$y = q("select count(id) as total from attach where uid = %d",
intval($channel_id)
);
if($y && intval($y[0]['total']) > 1) {
q("update account set account_level = 1 where account_id = %d limit 1",
intval($a[0]['account_id'])
);
}
}
}
if (!$iswebpage) {
$max = engr_units_to_bytes(service_class_fetch($channel_id,'total_items'));
if(! service_class_allows($channel_id,'total_items',$r[0]['total'])) {

View File

@ -14,7 +14,7 @@ class Lang extends Controller {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>Language App (Not Installed):</b><br>';
$o = '<b>' . t('Language App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Change UI language');
return $o;
}

View File

@ -141,7 +141,7 @@ class Layouts extends \Zotlabs\Web\Controller {
if($_REQUEST['pagetitle'])
$x['pagetitle'] = $_REQUEST['pagetitle'];
$editor = status_editor($a,$x);
$editor = status_editor($a,$x,false,'Layouts');
$r = q("select iconfig.iid, iconfig.v, mid, title, body, mimetype, created, edited, item_type from iconfig
left join item on iconfig.iid = item.id

View File

@ -118,7 +118,7 @@ class Lockview extends \Zotlabs\Web\Controller {
}
if(count($allowed_groups)) {
$r = q("SELECT gname FROM groups WHERE hash IN ( " . implode(', ', $allowed_groups) . " )");
$r = q("SELECT gname FROM pgrp WHERE hash IN ( " . implode(', ', $allowed_groups) . " )");
if($r)
foreach($r as $rr)
$l[] = '<div class="dropdown-item"><b>' . $rr['gname'] . '</b></div>';
@ -156,7 +156,7 @@ class Lockview extends \Zotlabs\Web\Controller {
if(count($deny_groups)) {
$r = q("SELECT gname FROM groups WHERE hash IN ( " . implode(', ', $deny_groups) . " )");
$r = q("SELECT gname FROM pgrp WHERE hash IN ( " . implode(', ', $deny_groups) . " )");
if($r)
foreach($r as $rr)
$l[] = '<div class="dropdown-item"><b><strike>' . $rr['gname'] . '</strike></b></div>';

View File

@ -393,7 +393,7 @@ class Mail extends \Zotlabs\Web\Controller {
'delete' => t('Delete message'),
'dreport' => t('Delivery report'),
'recall' => t('Recall message'),
'can_recall' => (($channel['channel_hash'] == $message['from_xchan'] && get_account_techlevel() > 0) ? true : false),
'can_recall' => ($channel['channel_hash'] == $message['from_xchan']),
'is_recalled' => (intval($message['mail_recalled']) ? t('Message has been recalled.') : ''),
'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'], 'c'),
);

View File

@ -129,7 +129,7 @@ class Manage extends \Zotlabs\Web\Controller {
}
}
$r = q("select count(channel_id) as total from channel where channel_account_id = %d and channel_removed = 0",
intval(get_account_id())
);
@ -170,7 +170,7 @@ class Manage extends \Zotlabs\Web\Controller {
'$header' => t('Channel Manager'),
'$msg_selected' => t('Current Channel'),
'$selected' => local_channel(),
'$desc' => t('Switch to one of your channels by selecting it.'),
'$desc' => ((count($channels) > 1 || $delegates) ? t('Switch to one of your channels by selecting it.') : ''),
'$msg_default' => t('Default Channel'),
'$msg_make_default' => t('Make Default'),
'$create' => $create,

View File

@ -129,7 +129,7 @@ class Mood extends Controller {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>Mood App (Not Installed):</b><br>';
$o = '<b>' . t('Mood App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Set your current mood and tell your friends');
return $o;
}

View File

@ -84,20 +84,9 @@ class Network extends \Zotlabs\Web\Controller {
$search = (($_GET['search']) ? $_GET['search'] : '');
if($search) {
$_GET['netsearch'] = escape_tags($search);
if(strpos($search,'@') === 0) {
$r = q("select abook_id from abook left join xchan on abook_xchan = xchan_hash where xchan_name = '%s' and abook_channel = %d limit 1",
dbesc(substr($search,1)),
intval(local_channel())
);
if($r) {
$_GET['cid'] = $r[0]['abook_id'];
$search = $_GET['search'] = '';
}
}
elseif(strpos($search,'#') === 0) {
if(strpos($search,'#') === 0) {
$hashtags = substr($search,1);
$search = $_GET['search'] = '';
$search = '';
}
}
@ -108,7 +97,7 @@ class Network extends \Zotlabs\Web\Controller {
// filter by collection (e.g. group)
if($gid) {
$r = q("SELECT * FROM groups WHERE id = %d AND uid = %d LIMIT 1",
$r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d LIMIT 1",
intval($gid),
intval(local_channel())
);
@ -143,7 +132,7 @@ class Network extends \Zotlabs\Web\Controller {
$deftag = '';
if(x($_GET,'search') || $file || (!$pf && $cid))
if(x($_GET,'search') || $file || (!$pf && $cid) || $hashtags || $verb || $category)
$nouveau = true;
if($cid) {
@ -169,9 +158,9 @@ class Network extends \Zotlabs\Web\Controller {
if(! $update) {
// search terms header
if($search) {
if($search || $hashtags) {
$o .= replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => t('Search Results For:') . ' ' . htmlspecialchars($search, ENT_COMPAT,'UTF-8')
'$title' => t('Search Results For:') . ' ' . (($search) ? htmlspecialchars($search, ENT_COMPAT,'UTF-8') : '#' . htmlspecialchars($hashtags, ENT_COMPAT,'UTF-8'))
));
}
@ -207,7 +196,7 @@ class Network extends \Zotlabs\Web\Controller {
$x['pretext'] = $deftag;
$status_editor = status_editor($a,$x);
$status_editor = status_editor($a,$x,false,'Network');
$o .= $status_editor;
$static = channel_manual_conv_update(local_channel());
@ -448,7 +437,7 @@ class Network extends \Zotlabs\Web\Controller {
$abook_uids = " and abook.abook_channel = " . local_channel() . " ";
$uids = " and item.uid = " . local_channel() . " ";
if(get_pconfig(local_channel(),'system','network_list_mode'))
if(feature_enabled(local_channel(), 'network_list_mode'))
$page_mode = 'list';
else
$page_mode = 'client';

View File

@ -142,9 +142,12 @@ class New_channel extends \Zotlabs\Web\Controller {
}
$limit = account_service_class_fetch(get_account_id(),'total_identities');
$canadd = true;
if($r && ($limit !== false)) {
$channel_usage_message = sprintf( t("You have created %1$.0f of %2$.0f allowed channels."), $r[0]['total'], $limit);
if ($r[0]['total'] >= $limit) {
$canadd = false;
}
}
else {
$channel_usage_message = '';
@ -168,8 +171,6 @@ class New_channel extends \Zotlabs\Web\Controller {
$privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" );
$perm_roles = \Zotlabs\Access\PermissionRoles::roles();
if((get_account_techlevel() < 4) && $privacy_role !== 'custom')
unset($perm_roles[t('Other')]);
$name = array('name', t('Channel name'), ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), $name_help, "*");
$nickhub = '@' . \App::get_hostname();
@ -186,7 +187,8 @@ class New_channel extends \Zotlabs\Web\Controller {
'$nickname' => $nickname,
'$validate' => t('Validate'),
'$submit' => t('Create'),
'$channel_usage_message' => $channel_usage_message
'$channel_usage_message' => $channel_usage_message,
'$canadd' => $canadd
));
return $o;

View File

@ -1,13 +1,19 @@
<?php
namespace Zotlabs\Module; /** @file */
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Apps;
class Notes extends \Zotlabs\Web\Controller {
class Notes extends Controller {
function init() {
function post() {
if(! local_channel())
return;
return EMPTY_STR;
if(! Apps::system_app_installed(local_channel(), 'Notes'))
return EMPTY_STR;
$ret = array('success' => true);
if(array_key_exists('note_text',$_REQUEST)) {
@ -24,17 +30,38 @@ class Notes extends \Zotlabs\Web\Controller {
}
set_pconfig(local_channel(),'notes','text',$body);
}
// push updates to channel clones
if((argc() > 1) && (argv(1) === 'sync')) {
require_once('include/zot.php');
build_sync_packet();
}
logger('notes saved.', LOGGER_DEBUG);
json_return_and_die($ret);
}
function get() {
if(! local_channel())
return EMPTY_STR;
if(! Apps::system_app_installed(local_channel(), 'Notes')) {
//Do not display any associated widgets at this point
App::$pdl = EMPTY_STR;
$o = '<b>' . t('Notes App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('A simple notes app with a widget (note: notes are not encrypted)');
return $o;
}
$w = new \Zotlabs\Widget\Notes;
$arr = ['app' => true];
return $w->widget($arr);
}
}

View File

@ -1,27 +1,37 @@
<?php
namespace Zotlabs\Module\Settings;
namespace Zotlabs\Module;
use App;
use Zotlabs\Lib\Apps;
use Zotlabs\Web\Controller;
class Oauth {
class Oauth extends Controller {
function post() {
if(! local_channel())
return;
if(! Apps::system_app_installed(local_channel(), 'OAuth Apps Manager'))
return;
if(x($_POST,'remove')){
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
check_form_security_token_redirectOnErr('/oauth', 'oauth');
$key = $_POST['remove'];
q("DELETE FROM tokens WHERE id='%s' AND uid=%d",
dbesc($key),
local_channel());
goaway(z_root()."/settings/oauth/");
goaway(z_root()."/oauth");
return;
}
if((argc() > 2) && (argv(2) === 'edit' || argv(2) === 'add') && x($_POST,'submit')) {
if((argc() > 1) && (argv(1) === 'edit' || argv(1) === 'add') && x($_POST,'submit')) {
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
check_form_security_token_redirectOnErr('oauth', 'oauth');
$name = ((x($_POST,'name')) ? escape_tags($_POST['name']) : '');
$key = ((x($_POST,'key')) ? escape_tags($_POST['key']) : '');
@ -73,17 +83,30 @@ class Oauth {
);
}
}
goaway(z_root()."/settings/oauth/");
goaway(z_root()."/oauth");
return;
}
}
function get() {
if(! local_channel())
return;
if(! Apps::system_app_installed(local_channel(), 'OAuth Apps Manager')) {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>' . t('OAuth Apps Manager App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('OAuth authentication tokens for mobile and remote apps');
return $o;
}
if((argc() > 2) && (argv(2) === 'add')) {
$tpl = get_markup_template("settings_oauth_edit.tpl");
if((argc() > 1) && (argv(1) === 'add')) {
$tpl = get_markup_template("oauth_edit.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_oauth"),
'$form_security_token' => get_form_security_token("oauth"),
'$title' => t('Add application'),
'$submit' => t('Submit'),
'$cancel' => t('Cancel'),
@ -96,9 +119,9 @@ class Oauth {
return $o;
}
if((argc() > 3) && (argv(2) === 'edit')) {
if((argc() > 2) && (argv(1) === 'edit')) {
$r = q("SELECT * FROM clients WHERE client_id='%s' AND uid=%d",
dbesc(argv(3)),
dbesc(argv(2)),
local_channel());
if (!count($r)){
@ -107,9 +130,9 @@ class Oauth {
}
$app = $r[0];
$tpl = get_markup_template("settings_oauth_edit.tpl");
$tpl = get_markup_template("oauth_edit.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_oauth"),
'$form_security_token' => get_form_security_token("oauth"),
'$title' => t('Add application'),
'$submit' => t('Update'),
'$cancel' => t('Cancel'),
@ -122,13 +145,13 @@ class Oauth {
return $o;
}
if((argc() > 3) && (argv(2) === 'delete')) {
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth', 't');
if((argc() > 2) && (argv(1) === 'delete')) {
check_form_security_token_redirectOnErr('/oauth', 'oauth', 't');
$r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d",
dbesc(argv(3)),
dbesc(argv(2)),
local_channel());
goaway(z_root()."/settings/oauth/");
goaway(z_root()."/oauth");
return;
}
@ -141,11 +164,11 @@ class Oauth {
local_channel());
$tpl = get_markup_template("settings_oauth.tpl");
$tpl = get_markup_template("oauth.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_oauth"),
'$form_security_token' => get_form_security_token("oauth"),
'$baseurl' => z_root(),
'$title' => t('Connected Apps'),
'$title' => t('Connected OAuth Apps'),
'$add' => t('Add application'),
'$edit' => t('Edit'),
'$delete' => t('Delete'),
@ -158,4 +181,4 @@ class Oauth {
}
}
}

View File

@ -1,15 +1,24 @@
<?php
namespace Zotlabs\Module\Settings;
namespace Zotlabs\Module;
use App;
use Zotlabs\Lib\Apps;
use Zotlabs\Web\Controller;
class Oauth2 {
class Oauth2 extends Controller {
function post() {
if(! local_channel())
return;
if(! Apps::system_app_installed(local_channel(), 'OAuth2 Apps Manager'))
return;
if(x($_POST,'remove')){
check_form_security_token_redirectOnErr('/settings/oauth2', 'settings_oauth2');
check_form_security_token_redirectOnErr('oauth2', 'oauth2');
$name = ((x($_POST,'name')) ? escape_tags(trim($_POST['name'])) : '');
logger("REMOVE! ".$name." uid: ".local_channel());
$key = $_POST['remove'];
@ -25,13 +34,13 @@ class Oauth2 {
dbesc($name),
intval(local_channel())
);
goaway(z_root()."/settings/oauth2/");
goaway(z_root()."/oauth2");
return;
}
if((argc() > 2) && (argv(2) === 'edit' || argv(2) === 'add') && x($_POST,'submit')) {
if((argc() > 1) && (argv(1) === 'edit' || argv(1) === 'add') && x($_POST,'submit')) {
check_form_security_token_redirectOnErr('/settings/oauth2', 'settings_oauth2');
check_form_security_token_redirectOnErr('oauth2', 'oauth2');
$name = ((x($_POST,'name')) ? escape_tags(trim($_POST['name'])) : '');
$secret = ((x($_POST,'secret')) ? escape_tags(trim($_POST['secret'])) : '');
@ -80,17 +89,29 @@ class Oauth2 {
);
}
}
goaway(z_root()."/settings/oauth2/");
goaway(z_root()."/oauth2");
return;
}
}
function get() {
if(! local_channel())
return;
if(! Apps::system_app_installed(local_channel(), 'OAuth2 Apps Manager')) {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>' . t('OAuth2 Apps Manager App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('OAuth2 authenticatication tokens for mobile and remote apps');
return $o;
}
if((argc() > 2) && (argv(2) === 'add')) {
$tpl = get_markup_template("settings_oauth2_edit.tpl");
if((argc() > 1) && (argv(1) === 'add')) {
$tpl = get_markup_template("oauth2_edit.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_oauth2"),
'$form_security_token' => get_form_security_token("oauth2"),
'$title' => t('Add OAuth2 application'),
'$submit' => t('Submit'),
'$cancel' => t('Cancel'),
@ -103,9 +124,9 @@ class Oauth2 {
return $o;
}
if((argc() > 3) && (argv(2) === 'edit')) {
if((argc() > 2) && (argv(1) === 'edit')) {
$r = q("SELECT * FROM oauth_clients WHERE client_id='%s' AND user_id= %d",
dbesc(argv(3)),
dbesc(argv(2)),
intval(local_channel())
);
@ -116,9 +137,9 @@ class Oauth2 {
$app = $r[0];
$tpl = get_markup_template("settings_oauth2_edit.tpl");
$tpl = get_markup_template("oauth2_edit.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_oauth2"),
'$form_security_token' => get_form_security_token("oauth2"),
'$title' => t('Add application'),
'$submit' => t('Update'),
'$cancel' => t('Cancel'),
@ -131,26 +152,26 @@ class Oauth2 {
return $o;
}
if((argc() > 3) && (argv(2) === 'delete')) {
check_form_security_token_redirectOnErr('/settings/oauth2', 'settings_oauth2', 't');
if((argc() > 2) && (argv(1) === 'delete')) {
check_form_security_token_redirectOnErr('oauth2', 'oauth2', 't');
$r = q("DELETE FROM oauth_clients WHERE client_id = '%s' AND user_id = %d",
dbesc(argv(3)),
dbesc(argv(2)),
intval(local_channel())
);
$r = q("DELETE FROM oauth_access_tokens WHERE client_id = '%s' AND user_id = %d",
dbesc(argv(3)),
dbesc(argv(2)),
intval(local_channel())
);
$r = q("DELETE FROM oauth_authorization_codes WHERE client_id = '%s' AND user_id = %d",
dbesc(argv(3)),
dbesc(argv(2)),
intval(local_channel())
);
$r = q("DELETE FROM oauth_refresh_tokens WHERE client_id = '%s' AND user_id = %d",
dbesc(argv(3)),
dbesc(argv(2)),
intval(local_channel())
);
goaway(z_root()."/settings/oauth2/");
goaway(z_root()."/oauth2");
return;
}
@ -164,9 +185,9 @@ class Oauth2 {
intval(local_channel())
);
$tpl = get_markup_template("settings_oauth2.tpl");
$tpl = get_markup_template("oauth2.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_oauth2"),
'$form_security_token' => get_form_security_token("oauth2"),
'$baseurl' => z_root(),
'$title' => t('Connected OAuth2 Apps'),
'$add' => t('Add application'),

View File

@ -1,15 +1,20 @@
<?php
namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Apps;
class Pdledit extends \Zotlabs\Web\Controller {
class Pdledit extends Controller {
function post() {
if(! local_channel())
return;
if(! $_REQUEST['module'])
if(! Apps::system_app_installed(local_channel(), 'PDL Editor'))
return;
if(! feature_enabled(local_channel(),'advanced_theming'))
if(! $_REQUEST['module'])
return;
if(! trim($_REQUEST['content'])) {
@ -30,9 +35,13 @@ class Pdledit extends \Zotlabs\Web\Controller {
return;
}
if(! feature_enabled(local_channel(),'advanced_theming')) {
notice( t('Feature disabled.') . EOL);
return;
if(! Apps::system_app_installed(local_channel(), 'PDL Editor')) {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>' . t('PDL Editor App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Provides the ability to edit system page layouts');
return $o;
}
if(argc() > 2 && argv(2) === 'reset') {

View File

@ -1,26 +1,31 @@
<?php
namespace Zotlabs\Module\Settings;
namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Apps;
class Permcats {
class Permcats extends Controller {
function post() {
if(! local_channel())
return;
$channel = \App::get_channel();
if(! Apps::system_app_installed(local_channel(), 'Permission Categories'))
return;
check_form_security_token_redirectOnErr('/settings/permcats', 'settings_permcats');
$channel = App::get_channel();
check_form_security_token_redirectOnErr('/permcats', 'permcats');
$all_perms = \Zotlabs\Access\Permissions::Perms();
$name = escape_tags(trim($_POST['name']));
if(! $name) {
notice( t('Permission Name is required.') . EOL);
notice( t('Permission category name is required.') . EOL);
return;
}
@ -50,13 +55,21 @@ class Permcats {
if(! local_channel())
return;
$channel = \App::get_channel();
if(! Apps::system_app_installed(local_channel(), 'Permission Categories')) {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>' . t('Permission Categories App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Create custom connection permission limits');
return $o;
}
if(argc() > 2)
$name = hex2bin(argv(2));
$channel = App::get_channel();
if(argc() > 3 && argv(3) === 'drop') {
if(argc() > 1)
$name = hex2bin(argv(1));
if(argc() > 2 && argv(2) === 'drop') {
\Zotlabs\Lib\Permcat::delete(local_channel(),$name);
build_sync_packet();
json_return_and_die([ 'success' => true ]);
@ -93,9 +106,9 @@ class Permcats {
$tpl = get_markup_template("settings_permcats.tpl");
$tpl = get_markup_template("permcats.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_permcats"),
'$form_security_token' => get_form_security_token("permcats"),
'$title' => t('Permission Categories'),
'$desc' => $desc,
'$desc2' => $desc2,
@ -104,7 +117,7 @@ class Permcats {
'$atoken' => $atoken,
'$url1' => z_root() . '/channel/' . $channel['channel_address'],
'$url2' => z_root() . '/photos/' . $channel['channel_address'],
'$name' => array('name', t('Permission Name') . ' <span class="required">*</span>', (($name) ? $name : ''), ''),
'$name' => array('name', t('Permission category name') . ' <span class="required">*</span>', (($name) ? $name : ''), ''),
'$me' => t('My Settings'),
'$perms' => $perms,
'$inherited' => t('inherited'),

View File

@ -162,7 +162,7 @@ class Poke extends Controller {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>Poke App (Not Installed):</b><br>';
$o = '<b>' . t('Poke App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Poke somebody in your addressbook');
return $o;
}

View File

@ -81,7 +81,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
);
$o = '<div id="jot-popup">';
$o .= status_editor($a,$x);
$o .= status_editor($a,$x,false,'Pubstream');
$o .= '</div>';
}

View File

@ -227,11 +227,6 @@ class Register extends \Zotlabs\Web\Controller {
$perm_roles = \Zotlabs\Access\PermissionRoles::roles();
// A new account will not have a techlevel, but accounts can also be created by the administrator.
if((get_account_techlevel() < 4) && $privacy_role !== 'custom')
unset($perm_roles[t('Other')]);
// Configurable terms of service link
$tosurl = get_config('system','tos_url');

View File

@ -138,7 +138,7 @@ class Rpost extends \Zotlabs\Web\Controller {
'jotnets' => true
);
$editor = status_editor($a,$x);
$editor = status_editor($a,$x,false,'Rpost');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit post'),

View File

@ -12,7 +12,6 @@ class Account {
$errs = array();
$email = ((x($_POST,'email')) ? trim(notags($_POST['email'])) : '');
$techlevel = ((array_key_exists('techlevel',$_POST)) ? intval($_POST['techlevel']) : 0);
$account = \App::get_account();
if($email != $account['account_email']) {
@ -32,13 +31,6 @@ class Account {
$errs[] = t('System failure storing new email. Please try again.');
}
}
if($techlevel != $account['account_level']) {
$r = q("update account set account_level = %d where account_id = %d",
intval($techlevel),
intval($account['account_id'])
);
info( t('Technical skill level updated') . EOL);
}
if($errs) {
foreach($errs as $err)
@ -101,11 +93,6 @@ class Account {
$email = \App::$account['account_email'];
$techlevels = \Zotlabs\Lib\Techlevels::levels();
$def_techlevel = \App::$account['account_level'];
$techlock = get_config('system','techlevel_lock');
$tpl = get_markup_template("settings_account.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_account"),
@ -113,8 +100,6 @@ class Account {
'$origpass' => array('origpass', t('Current Password'), ' ',''),
'$password1'=> array('npassword', t('Enter New Password'), '', ''),
'$password2'=> array('confirm', t('Confirm New Password'), '', t('Leave password fields blank unless changing')),
'$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience and additional features consistent with your comfort level'), $techlevels ],
'$techlock' => $techlock,
'$submit' => t('Submit'),
'$email' => array('email', t('Email Address:'), $email, ''),
'$removeme' => t('Remove Account'),

View File

@ -16,6 +16,10 @@ class Calendar {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -2,6 +2,8 @@
namespace Zotlabs\Module\Settings;
use Zotlabs\Lib\Apps;
require_once('include/selectors.php');
@ -63,7 +65,7 @@ class Channel {
}
$hide_presence = 1 - (intval($role_permissions['online']));
if($role_permissions['default_collection']) {
$r = q("select hash from groups where uid = %d and gname = '%s' limit 1",
$r = q("select hash from pgrp where uid = %d and gname = '%s' limit 1",
intval(local_channel()),
dbesc( t('Friends') )
);
@ -71,7 +73,7 @@ class Channel {
require_once('include/group.php');
group_add(local_channel(), t('Friends'));
group_add_member(local_channel(),t('Friends'),$channel['channel_hash']);
$r = q("select hash from groups where uid = %d and gname = '%s' limit 1",
$r = q("select hash from pgrp where uid = %d and gname = '%s' limit 1",
intval(local_channel()),
dbesc( t('Friends') )
);
@ -432,7 +434,7 @@ class Channel {
'$nickname' => (($intl_nickname === $webbie) ? $webbie : $intl_nickname . '&nbsp;(' . $webbie . ')'),
'$subdir' => $subdir,
'$davdesc' => t('Your files/photos are accessible via WebDAV at'),
'$davpath' => ((get_account_techlevel() > 3) ? z_root() . '/dav/' . $nickname : ''),
'$davpath' => z_root() . '/dav/' . $nickname,
'$basepath' => \App::get_hostname()
));
@ -490,11 +492,6 @@ class Channel {
$permissions_set = (($permissions_role != 'custom') ? true : false);
$perm_roles = \Zotlabs\Access\PermissionRoles::roles();
if((get_account_techlevel() < 4) && $permissions_role !== 'custom')
unset($perm_roles[t('Other')]);
$vnotify = get_pconfig(local_channel(),'system','vnotify');
$always_show_in_notices = get_pconfig(local_channel(),'system','always_show_in_notices');
@ -556,8 +553,8 @@ class Channel {
'$suggestme' => $suggestme,
'$group_select' => $group_select,
'$role' => array('permissions_role' , t('Channel role and privacy'), $permissions_role, '', $perm_roles),
'$defpermcat' => [ 'defpermcat', t('Default Permissions Group'), $default_permcat, '', $permcats ],
'$permcat_enable' => feature_enabled(local_channel(),'permcats'),
'$defpermcat' => [ 'defpermcat', t('Default permissions category'), $default_permcat, '', $permcats ],
'$permcat_enable' => Apps::system_app_installed(local_channel(), 'Permission Categories'),
'$profile_in_dir' => $profile_in_dir,
'$hide_friends' => $hide_friends,
'$hide_wall' => $hide_wall,

View File

@ -0,0 +1,67 @@
<?php
namespace Zotlabs\Module\Settings;
class Channel_home {
function post() {
$module = substr(strrchr(strtolower(static::class), '\\'), 1);
check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
$features = get_module_features($module);
process_module_features_post(local_channel(), $features, $_POST);
$channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400);
if($channel_divmore_height < 50)
$channel_divmore_height = 50;
set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}
function get() {
$module = substr(strrchr(strtolower(static::class), '\\'), 1);
$features = get_module_features($module);
$rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
$channel_divmore_height = [
'channel_divmore_height',
t('Max height of content (in pixels)'),
((get_pconfig(local_channel(),'system','channel_divmore_height')) ? get_pconfig(local_channel(),'system','channel_divmore_height') : 400),
t('Click to expand content exceeding this height')
];
$extra_settings_html = replace_macros(get_markup_template('field_input.tpl'),
[
'$field' => $channel_divmore_height
]
);
$tpl = get_markup_template("settings_module.tpl");
$o .= replace_macros($tpl, array(
'$rpath' => $rpath,
'$action_url' => 'settings/' . $module,
'$form_security_token' => get_form_security_token('settings_' . $module),
'$title' => t('Channel Home Settings'),
'$features' => process_module_features_get(local_channel(), $features),
'$extra_settings_html' => $extra_settings_html,
'$submit' => t('Submit')
));
return $o;
}
}

View File

@ -16,6 +16,10 @@ class Connections {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -0,0 +1,60 @@
<?php
namespace Zotlabs\Module\Settings;
class Conversation {
function post() {
$module = substr(strrchr(strtolower(static::class), '\\'), 1);
check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
$features = get_module_features($module);
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['aj']) {
if($_POST['auto_update'] == 1)
info(t('Settings saved.') . EOL);
else
info(t('Settings saved. Reload page please.') . EOL);
killme();
}
else {
return;
}
}
function get() {
$aj = ((isset($_GET['aj'])) ? true : false);
$module = substr(strrchr(strtolower(static::class), '\\'), 1);
$features = get_module_features($module);
$tpl = (($aj) ? get_markup_template("settings_module_ajax.tpl") : get_markup_template("settings_module.tpl"));
$o .= replace_macros($tpl, array(
'$action_url' => 'settings/' . $module,
'$form_security_token' => get_form_security_token('settings_' . $module),
'$title' => t('Conversation Settings'),
'$features' => process_module_features_get(local_channel(), $features),
'$submit' => t('Submit')
));
if($aj) {
echo $o;
killme();
}
else {
return $o;
}
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace Zotlabs\Module\Settings;
class Directory {
function post() {
$module = substr(strrchr(strtolower(static::class), '\\'), 1);
check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
$features = get_module_features($module);
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}
function get() {
$module = substr(strrchr(strtolower(static::class), '\\'), 1);
$features = get_module_features($module);
$rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
$tpl = get_markup_template("settings_module.tpl");
$o .= replace_macros($tpl, array(
'$rpath' => $rpath,
'$action_url' => 'settings/' . $module,
'$form_security_token' => get_form_security_token('settings_' . $module),
'$title' => t('Directory Settings'),
'$features' => process_module_features_get(local_channel(), $features),
'$submit' => t('Submit')
));
return $o;
}
}

View File

@ -27,16 +27,8 @@ class Display {
$user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0);
$nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0);
$title_tosource = ((x($_POST,'title_tosource')) ? intval($_POST['title_tosource']) : 0);
$channel_list_mode = ((x($_POST,'channel_list_mode')) ? intval($_POST['channel_list_mode']) : 0);
$network_list_mode = ((x($_POST,'network_list_mode')) ? intval($_POST['network_list_mode']) : 0);
$manual_update = ((array_key_exists('manual_update',$_POST)) ? intval($_POST['manual_update']) : 0);
$channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400);
if($channel_divmore_height < 50)
$channel_divmore_height = 50;
$network_divmore_height = ((x($_POST,'network_divmore_height')) ? intval($_POST['network_divmore_height']) : 400);
if($network_divmore_height < 50)
$network_divmore_height = 50;
$start_menu = ((x($_POST,'start_menu')) ? intval($_POST['start_menu']) : 0);
$browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0);
$browser_update = $browser_update * 1000;
@ -54,12 +46,9 @@ class Display {
set_pconfig(local_channel(),'system','itemspage', $itemspage);
set_pconfig(local_channel(),'system','no_smilies',1-intval($nosmile));
set_pconfig(local_channel(),'system','title_tosource',$title_tosource);
set_pconfig(local_channel(),'system','channel_list_mode', $channel_list_mode);
set_pconfig(local_channel(),'system','network_list_mode', $network_list_mode);
set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height);
set_pconfig(local_channel(),'system','network_divmore_height', $network_divmore_height);
set_pconfig(local_channel(),'system','manual_conversation_update', $manual_update);
set_pconfig(local_channel(),'system','channel_menu', $channel_menu);
set_pconfig(local_channel(),'system','start_menu', $start_menu);
$newschema = '';
if($theme){
@ -150,6 +139,14 @@ class Display {
$theme_selected = explode(':', $theme_selected)[0];
}
$account = \App::get_account();
if($account['account_created'] > datetime_convert('','','now - 60 days')) {
$start_menu = get_pconfig(local_channel(), 'system', 'start_menu', 1);
}
else {
$start_menu = get_pconfig(local_channel(), 'system', 'start_menu', 0);
}
$preload_images = get_pconfig(local_channel(),'system','preload_images');
$preload_images = (($preload_images===false)? '0': $preload_images); // default if not set: 0
@ -204,15 +201,8 @@ class Display {
'$channel_menu' => [ 'channel_menu', t('Provide channel menu in navigation bar'), get_pconfig(local_channel(),'system','channel_menu',get_config('system','channel_menu',0)), t('Default: channel menu located in app menu'),$yes_no ],
'$manual_update' => array('manual_update', t('Manual conversation updates'), channel_manual_conv_update(local_channel()), t('Default is on, turning this off may increase screen jumping'), $yes_no),
'$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, '', $yes_no),
'$layout_editor' => t('System Page Layout Editor - (advanced)'),
'$theme_config' => $theme_config,
'$expert' => feature_enabled(local_channel(),'advanced_theming'),
'$channel_list_mode' => array('channel_list_mode', t('Use blog/list mode on channel page'), get_pconfig(local_channel(),'system','channel_list_mode'), t('(comments displayed separately)'), $yes_no),
'$network_list_mode' => array('network_list_mode', t('Use blog/list mode on grid page'), get_pconfig(local_channel(),'system','network_list_mode'), t('(comments displayed separately)'), $yes_no),
'$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','channel_divmore_height')) ? get_pconfig(local_channel(),'system','channel_divmore_height') : 400), t('click to expand content exceeding this height')),
'$network_divmore_height' => array('network_divmore_height', t('Grid page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','network_divmore_height')) ? get_pconfig(local_channel(),'system','network_divmore_height') : 400) , t('click to expand content exceeding this height')),
'$start_menu' => ['start_menu', t('New Member Links'), $start_menu, t('Display new member quick links menu'), $yes_no]
));
call_hooks('display_settings',$o);

View File

@ -16,6 +16,10 @@ class Editor {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -16,6 +16,10 @@ class Events {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -26,44 +26,14 @@ class Features {
function get() {
$arr = [];
$harr = [];
if(intval($_REQUEST['techlevel']))
$level = intval($_REQUEST['techlevel']);
else {
$level = get_account_techlevel();
}
if(! intval($level)) {
notice( t('Permission denied.') . EOL);
return;
}
$techlevels = \Zotlabs\Lib\Techlevels::levels();
// This page isn't accessible at techlevel 0
unset($techlevels[0]);
$def_techlevel = (($level > 0) ? $level : 1);
$techlock = get_config('system','techlevel_lock');
$all_features_raw = get_features(false);
foreach($all_features_raw as $fname => $fdata) {
foreach(array_slice($fdata,1) as $f) {
$harr[$f[0]] = ((intval(feature_enabled(local_channel(),$f[0]))) ? "1" : '');
}
}
$features = get_features(true,$level);
$features = get_features(false);
foreach($features as $fname => $fdata) {
$arr[$fname] = array();
$arr[$fname][0] = $fdata[0];
foreach(array_slice($fdata,1) as $f) {
$arr[$fname][1][] = array('feature_' . $f[0],$f[1],((intval(feature_enabled(local_channel(),$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
unset($harr[$f[0]]);
}
}
@ -71,10 +41,7 @@ class Features {
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_features"),
'$title' => t('Additional Features'),
'$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience and additional features consistent with your comfort level'), $techlevels ],
'$techlock' => $techlock,
'$features' => $arr,
'$hiddens' => $harr,
'$baseurl' => z_root(),
'$submit' => t('Submit'),
));

View File

@ -16,6 +16,10 @@ class Manage {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -14,8 +14,18 @@ class Network {
$features = get_module_features($module);
process_module_features_post(local_channel(), $features, $_POST);
$network_divmore_height = ((x($_POST,'network_divmore_height')) ? intval($_POST['network_divmore_height']) : 400);
if($network_divmore_height < 50)
$network_divmore_height = 50;
set_pconfig(local_channel(),'system','network_divmore_height', $network_divmore_height);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}
@ -26,6 +36,19 @@ class Network {
$features = get_module_features($module);
$rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
$network_divmore_height = [
'network_divmore_height',
t('Max height of content (in pixels)'),
((get_pconfig(local_channel(),'system','network_divmore_height')) ? get_pconfig(local_channel(),'system','network_divmore_height') : 400),
t('Click to expand content exceeding this height')
];
$extra_settings_html = replace_macros(get_markup_template('field_input.tpl'),
[
'$field' => $network_divmore_height
]
);
$tpl = get_markup_template("settings_module.tpl");
$o .= replace_macros($tpl, array(
@ -33,8 +56,9 @@ class Network {
'$action_url' => 'settings/' . $module,
'$form_security_token' => get_form_security_token('settings_' . $module),
'$title' => t('Activity Settings'),
'$features' => process_module_features_get(local_channel(), $features),
'$submit' => t('Submit')
'$features' => process_module_features_get(local_channel(), $features),
'$extra_settings_html' => $extra_settings_html,
'$submit' => t('Submit')
));
return $o;

View File

@ -16,6 +16,10 @@ class Photos {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -16,6 +16,10 @@ class Profiles {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -85,7 +85,7 @@ class Sources extends Controller {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>Sources App (Not Installed):</b><br>';
$o = '<b>' . t('Sources App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Automatically import channel content from other channels or feeds');
return $o;
}

View File

@ -1,16 +1,24 @@
<?php
namespace Zotlabs\Module\Settings;
namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Apps;
class Tokens {
class Tokens extends Controller {
function post() {
$channel = \App::get_channel();
if(! local_channel())
return;
check_form_security_token_redirectOnErr('/settings/tokens', 'settings_tokens');
if(! Apps::system_app_installed(local_channel(), 'Guest Access'))
return;
$channel = App::get_channel();
check_form_security_token_redirectOnErr('tokens', 'tokens');
$token_errs = 0;
if(array_key_exists('token',$_POST)) {
$atoken_id = (($_POST['atoken_id']) ? intval($_POST['atoken_id']) : 0);
@ -81,13 +89,25 @@ class Tokens {
function get() {
$channel = \App::get_channel();
if(! local_channel())
return;
if(! Apps::system_app_installed(local_channel(), 'Guest Access')) {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>' . t('Guest Access App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Create access tokens so that non-members can access private content');
return $o;
}
$channel = App::get_channel();
$atoken = null;
$atoken_xchan = '';
if(argc() > 2) {
$id = argv(2);
if(argc() > 1) {
$id = argv(1);
$atoken = q("select * from atoken where atoken_id = %d and atoken_uid = %d",
intval($id),
@ -99,7 +119,7 @@ class Tokens {
$atoken_xchan = substr($channel['channel_hash'],0,16) . '.' . $atoken['atoken_name'];
}
if($atoken && argc() > 3 && argv(3) === 'drop') {
if($atoken && argc() > 2 && argv(2) === 'drop') {
atoken_delete($id);
$atoken = null;
$atoken_xchan = '';
@ -144,9 +164,9 @@ class Tokens {
$tpl = get_markup_template("settings_tokens.tpl");
$tpl = get_markup_template("tokens.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_tokens"),
'$form_security_token' => get_form_security_token("tokens"),
'$title' => t('Guest Access Tokens'),
'$desc' => $desc,
'$desc2' => $desc2,

View File

@ -1,18 +1,24 @@
<?php
namespace Zotlabs\Module;
use App;
use Zotlabs\Lib\Apps;
use Zotlabs\Web\Controller;
class Uexport extends \Zotlabs\Web\Controller {
class Uexport extends Controller {
function init() {
if(! local_channel())
killme();
if(! Apps::system_app_installed(local_channel(), 'Channel Export'))
return;
if(argc() > 1) {
$sections = (($_REQUEST['sections']) ? explode(',',$_REQUEST['sections']) : '');
$channel = \App::get_channel();
$channel = App::get_channel();
if(argc() > 1 && intval(argv(1)) > 1900) {
$year = intval(argv(1));
@ -47,6 +53,15 @@ class Uexport extends \Zotlabs\Web\Controller {
}
function get() {
if(! Apps::system_app_installed(local_channel(), 'Channel Export')) {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>' . t('Channel Export App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Export your channel');
return $o;
}
$y = datetime_convert('UTC',date_default_timezone_get(),'now','Y');

View File

@ -45,7 +45,7 @@ class Webpages extends Controller {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>Webpages App (Not Installed):</b><br>';
$o = '<b>' . t('Webpages App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Provide managed web pages on your channel');
return $o;
}
@ -208,7 +208,7 @@ class Webpages extends Controller {
if(! $r)
$x['pagetitle'] = 'home';
$editor = status_editor($a,$x);
$editor = status_editor($a,$x,false,'Webpages');
$pages = null;

View File

@ -49,7 +49,7 @@ class Wiki extends Controller {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>Wiki App (Not Installed):</b><br>';
$o = '<b>' . t('Wiki App') . ' (' . t('Not Installed') . '):</b><br>';
$o .= t('Provide a wiki for your channel');
return $o;
}

25
Zotlabs/Update/_1221.php Normal file
View File

@ -0,0 +1,25 @@
<?php
namespace Zotlabs\Update;
class _1221 {
function run() {
q("START TRANSACTION");
$r1 = q("ALTER table " . TQUOT . 'groups' . TQUOT . " rename to pgrp ");
$r2 = q("ALTER table " . TQUOT . 'group_member' . TQUOT . " rename to pgrp_member ");
if($r1 && $r2) {
q("COMMIT");
return UPDATE_SUCCESS;
}
q("ROLLBACK");
return UPDATE_FAILED;
}
}

View File

@ -2,6 +2,8 @@
namespace Zotlabs\Widget;
use Zotlabs\Lib\Apps;
class Activity_filter {
function widget($arr) {
@ -44,8 +46,8 @@ class Activity_filter {
];
}
if(feature_enabled(local_channel(),'groups')) {
$groups = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
if(Apps::system_app_installed(local_channel(), 'Privacy Groups')) {
$groups = q("SELECT * FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
intval(local_channel())
);

View File

@ -55,7 +55,7 @@ class Activity_order {
}
// override order for search, filer and cid results
if(x($_GET,'search') || x($_GET,'file') || (! x($_GET,'pf') && x($_GET,'cid'))) {
if(x($_GET,'search') || x($_GET,'file') || (! x($_GET,'pf') && x($_GET,'cid')) || x($_GET,'verb') || x($_GET,'tag') || x($_GET,'cat')) {
$unthreaded_active = 'active';
$commentord_active = $postord_active = 'disabled';
}

View File

@ -17,7 +17,14 @@ class Newmember {
if(! $a)
return EMPTY_STR;
if(! feature_enabled(local_channel(),'start_menu'))
if($a['account_created'] > datetime_convert('','','now - 60 days')) {
$enabled = get_pconfig(local_channel(), 'system', 'start_menu', 1);
}
else {
$enabled = get_pconfig(local_channel(), 'system', 'start_menu', 0);
}
if(! $enabled)
return EMPTY_STR;
$options = [

View File

@ -2,20 +2,26 @@
namespace Zotlabs\Widget;
use Zotlabs\Lib\Apps;
class Notes {
function widget($arr) {
if(! local_channel())
return '';
if(! feature_enabled(local_channel(),'private_notes'))
return '';
return EMPTY_STR;
if(! Apps::system_app_installed(local_channel(), 'Notes'))
return EMPTY_STR;
$text = get_pconfig(local_channel(),'notes','text');
$o = replace_macros(get_markup_template('notes.tpl'), array(
$tpl = get_markup_template('notes.tpl');
$o = replace_macros($tpl, array(
'$banner' => t('Notes'),
'$text' => $text,
'$save' => t('Save'),
'$app' => ((isset($arr['app'])) ? true : false)
));
return $o;

View File

@ -160,7 +160,7 @@ class Notifications {
'$notifications' => $notifications,
'$no_notifications' => t('Sorry, you have got no notifications at the moment'),
'$loading' => t('Loading'),
'$startpage' => get_pconfig(local_channel(), 'system', 'startpage')
'$startpage' => $channel['channel_startpage']
));
return $o;

View File

@ -9,15 +9,12 @@ class Settings_menu {
if(! local_channel())
return;
$channel = \App::get_channel();
$abook_self_id = 0;
// Retrieve the 'self' address book entry for use in the auto-permissions link
$role = get_pconfig(local_channel(),'system','permissions_role');
$abk = q("select abook_id from abook where abook_channel = %d and abook_self = 1 limit 1",
intval(local_channel())
);
@ -45,19 +42,6 @@ class Settings_menu {
);
if(get_account_techlevel() > 0 && get_features()) {
$tabs[] = array(
'label' => t('Additional features'),
'url' => z_root().'/settings/features',
'selected' => ((argv(1) === 'features') ? 'active' : ''),
);
}
$tabs[] = array(
'label' => t('Addon settings'),
'url' => z_root().'/settings/featured',
'selected' => ((argv(1) === 'featured') ? 'active' : ''),
);
$tabs[] = array(
'label' => t('Display settings'),
@ -65,6 +49,12 @@ class Settings_menu {
'selected' => ((argv(1) === 'display') ? 'active' : ''),
);
$tabs[] = array(
'label' => t('Addon settings'),
'url' => z_root().'/settings/featured',
'selected' => ((argv(1) === 'featured') ? 'active' : ''),
);
if($hublocs) {
$tabs[] = array(
'label' => t('Manage locations'),
@ -73,69 +63,6 @@ class Settings_menu {
);
}
$tabs[] = array(
'label' => t('Export channel'),
'url' => z_root() . '/uexport',
'selected' => ''
);
if(feature_enabled(local_channel(),'oauth_clients')) {
$tabs[] = array(
'label' => t('OAuth1 apps'),
'url' => z_root() . '/settings/oauth',
'selected' => ((argv(1) === 'oauth') ? 'active' : ''),
);
}
if(feature_enabled(local_channel(),'oauth2_clients')) {
$tabs[] = array(
'label' => t('OAuth2 apps'),
'url' => z_root() . '/settings/oauth2',
'selected' => ((argv(1) === 'oauth2') ? 'active' : ''),
);
}
if(feature_enabled(local_channel(),'access_tokens')) {
$tabs[] = array(
'label' => t('Guest Access Tokens'),
'url' => z_root() . '/settings/tokens',
'selected' => ((argv(1) === 'tokens') ? 'active' : ''),
);
}
if(feature_enabled(local_channel(),'permcats')) {
$tabs[] = array(
'label' => t('Permission Categories'),
'url' => z_root() . '/settings/permcats',
'selected' => ((argv(1) === 'permcats') ? 'active' : ''),
);
}
if($role === false || $role === 'custom') {
$tabs[] = array(
'label' => t('Connection Default Permissions'),
'url' => z_root() . '/defperms',
'selected' => ''
);
}
if(feature_enabled(local_channel(),'premium_channel')) {
$tabs[] = array(
'label' => t('Premium Channel Settings'),
'url' => z_root() . '/connect/' . $channel['channel_address'],
'selected' => ''
);
}
if(feature_enabled(local_channel(),'channel_sources')) {
$tabs[] = array(
'label' => t('Channel Sources'),
'url' => z_root() . '/sources',
'selected' => ''
);
}
$tabtpl = get_markup_template("generic_links_widget.tpl");
return replace_macros($tabtpl, array(
'$title' => t('Settings'),
@ -144,4 +71,4 @@ class Settings_menu {
));
}
}
}

View File

@ -1,5 +1,5 @@
version: 1
url: $baseurl/channel/$nick
version: 1.1
url: $baseurl/channel/$nick, $baseurl/settings/channel_home
requires: local_channel
name: Channel Home
photo: icon:home

6
app/defperm.apd Normal file
View File

@ -0,0 +1,6 @@
version: 1
url: $baseurl/defperms
requires: local_channel, custom_role
name: Default Permissions
photo: icon:unlock-alt
categories: Access Control

View File

@ -1,5 +1,5 @@
version: 1
url: $baseurl/directory
version: 1.1
url: $baseurl/directory, $baseurl/settings/directory
name: Directory
photo: icon:sitemap
categories: nav_featured_app, Networking

View File

@ -1,4 +1,4 @@
version: 1.1
version: 1.2
url: $baseurl/network, $baseurl/settings/network
requires: local_channel
name: Grid

6
app/notes.apd Normal file
View File

@ -0,0 +1,6 @@
version: 1
url: $baseurl/notes
requires: local_channel
name: Notes
photo: icon:sticky-note-o
categories: Personal, Productivity

6
app/oauth.apd Normal file
View File

@ -0,0 +1,6 @@
version: 1
url: $baseurl/oauth
requires: local_channel
name: OAuth Apps Manager
photo: icon:chevron-circle-up
categories: Access Control

6
app/oauth2.apd Normal file
View File

@ -0,0 +1,6 @@
version: 1
url: $baseurl/oauth2
requires: local_channel
name: OAuth2 Apps Manager
photo: icon:chevron-circle-up
categories: Access Control

6
app/pdledit.apd Normal file
View File

@ -0,0 +1,6 @@
version: 1
url: $baseurl/pdledit
requires: local_channel
name: PDL Editor
photo: icon:object-group
categories: Appearance

6
app/permcats.apd Normal file
View File

@ -0,0 +1,6 @@
version: 1
url: $baseurl/permcats
requires: local_channel
name: Permission Categories
photo: icon:unlock-alt
categories: Access Control

6
app/premium_channel.apd Normal file
View File

@ -0,0 +1,6 @@
version: 1
url: $baseurl/connect/$nick
requires: local_channel
name: Premium Channel
photo: icon:check-circle-o
categories: Networking

6
app/tokens.apd Normal file
View File

@ -0,0 +1,6 @@
version: 1
url: $baseurl/tokens
requires: local_channel
name: Guest Access
photo: icon:user-secret
categories: Access Control

6
app/uexport.apd Normal file
View File

@ -0,0 +1,6 @@
version: 1
url: $baseurl/uexport
requires: local_channel
name: Channel Export
photo: icon:download
categories: Personal, System

View File

@ -50,11 +50,11 @@ require_once('include/attach.php');
require_once('include/bbcode.php');
define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '3.7.3' );
define ( 'STD_VERSION', '3.7.4' );
define ( 'ZOT_REVISION', '6.0a' );
define ( 'DB_UPDATE_VERSION', 1220 );
define ( 'DB_UPDATE_VERSION', 1221 );
define ( 'PROJECT_BASE', __DIR__ );

View File

@ -0,0 +1,18 @@
[h2]addon_app_installed_filter[/h2]
Allow plugins to filter the result of addon_app_installed.
Code excerpt:
[code]
$filter_arr = [
'uid'=>$uid,
'app'=>$app,
'installed'=>$r
];
call_hooks('addon_app_installed_filter',$filter_arr);
$r = $filter_arr['installed'];
[/code]
cxref: Zotlabs/Lib/Apps.php

4
doc/hook/app_destroy.bb Normal file
View File

@ -0,0 +1,4 @@
[h2]app_destroy[/h2]
Allows addons to perform some post delete actions.

View File

@ -0,0 +1,17 @@
[h2]app_installed_filter[/h2]
Allow plugins to filter the result of app_installed.
Code excerpt:
[code]
$filter_arr = [
'uid'=>$uid,
'app'=>$app,
'installed'=>$r
];
call_hooks('app_installed_filter',$filter_arr);
$r = $filter_arr['installed'];
[/code]
cxref: Zotlabs/Lib/Apps.php

31
doc/hook/status_editor.bb Normal file
View File

@ -0,0 +1,31 @@
[h2]status_editor[/h2]
Replace the default status_editor (jot).
Allow plugins to replace the default status editor in a context dependent manner.
It is fed an array of ['editor_html' => '', 'x' => $x, 'popup' => $popup, 'module' => $module].
All calls to the status_editor at the time of the creation of this hook have been updated
to set $module at invocation. This allows addon developers to have a context dependent editor
based on the Hubzilla module/addon.
Calls to status_editor() are in the form of:
status_editor($a, $x, $popup, $module).
Future module/addon developers are encouraged to set $popup and $module when invoking the
status_editor.
[code]
$hook_info = ['editor_html' => '', 'x' => $x, 'popup' => $popup, 'module' => $module];
call_hooks('status_editor',$hook_info);
if ($hook_info['editor_html'] == '') {
return hz_status_editor($a, $x, $popup);
} else {
return $hook_info['editor_html'];
}
[/code]
see: include/conversation.php

View File

@ -0,0 +1,18 @@
[h2]system_app_installed_filter[/h2]
Allow plugins to filter the result of system_app_installed.
Code excerpt:
[code]
$filter_arr = [
'uid'=>$uid,
'app'=>$app,
'installed'=>$r
];
call_hooks('system_app_installed_filter',$filter_arr);
$r = $filter_arr['installed'];
[/code]
cxref: Zotlabs/Lib/Apps.php

View File

@ -37,6 +37,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
[zrl=[baseurl]/help/hook/activity_order]activity_order[/zrl]
Called when generating the list of order options for the network page
[zrl=[baseurl]/help/hook/addon_app_installed_filter]addon_app_installed_filter[/zrl]
Called when determining whether an addon_app is installed
[zrl=[baseurl]/help/hook/activity_received]activity_received[/zrl]
Called when an activity (post, comment, like, etc.) has been received from a zot source
@ -49,6 +52,12 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
[zrl=[baseurl]/help/hook/api_perm_is_allowed]api_perm_is_allowed[/zrl]
Called when perm_is_allowed() is executed from an API call.
[zrl=[baseurl]/help/hook/app_destroy]app_destroy[/zrl]
Called when an app is deleted
[zrl=[baseurl]/help/hook/app_installed_filter]app_installed_filter[/zrl]
Called when determining whether an app is installed
[zrl=[baseurl]/help/hook/app_menu]app_menu[/zrl]
Called when generating the app_menu dropdown (may be obsolete)
@ -589,9 +598,15 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
[zrl=[baseurl]/help/hook/smilie]smilie[/zrl]
Called when translating emoticons
[zrl=[baseurl]/help/hook/status_editor]status_editor[/zrl]
Called when generating the status_editor.
[zrl=[baseurl]/help/hook/stream_item]stream_item[/zrl]
Called for each item which is rendered for viewing via conversation()
[zrl=[baseurl]/help/hook/system_app_installed_filter]system_app_installed_filter[/zrl]
Called when determining whether a system app is installed
[zrl=[baseurl]/help/hook/tagged]tagged[/zrl]
Called when a delivery is processed which results in you being tagged

View File

@ -124,7 +124,7 @@ function account_store_lowlevel($arr) {
'account_expires' => ((array_key_exists('account_expires',$arr)) ? $arr['account_expires'] : '0001-01-01 00:00:00'),
'account_expire_notified' => ((array_key_exists('account_expire_notified',$arr)) ? $arr['account_expire_notified'] : '0001-01-01 00:00:00'),
'account_service_class' => ((array_key_exists('account_service_class',$arr)) ? $arr['account_service_class'] : ''),
'account_level' => ((array_key_exists('account_level',$arr)) ? $arr['account_level'] : '0'),
'account_level' => '5',
'account_password_changed' => ((array_key_exists('account_password_changed',$arr)) ? $arr['account_password_changed'] : '0001-01-01 00:00:00')
];
@ -215,7 +215,7 @@ function create_account($arr) {
'account_created' => datetime_convert(),
'account_flags' => intval($flags),
'account_roles' => intval($roles),
'account_level' => intval($techlevel),
'account_level' => 5,
'account_expires' => $expires,
'account_service_class' => $default_service_class
]
@ -821,13 +821,6 @@ function upgrade_bool_message($bbcode = false) {
function get_account_techlevel($account_id = 0) {
if(! $account_id) {
$x = \App::get_account();
}
else {
$x = get_account_by_id($account_id);
}
return (($x) ? intval($x['account_level']) : 0);
return (5);
}

View File

@ -89,7 +89,7 @@ function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_descripti
}
}
$r = q("SELECT id, hash, gname FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
$r = q("SELECT id, hash, gname FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
intval(local_channel())
);

View File

@ -350,20 +350,20 @@
$r = null;
if($_REQUEST['group_id']) {
$r = q("select * from groups where uid = %d and id = %d limit 1",
$r = q("select * from pgrp where uid = %d and id = %d limit 1",
intval(api_user()),
intval($_REQUEST['group_id'])
);
}
elseif($_REQUEST['group_name']) {
$r = q("select * from groups where uid = %d and gname = '%s' limit 1",
$r = q("select * from pgrp where uid = %d and gname = '%s' limit 1",
intval(api_user()),
dbesc($_REQUEST['group_name'])
);
}
if($r) {
$x = q("select * from group_member left join abook on abook_xchan = xchan and abook_channel = group_member.uid left join xchan on group_member.xchan = xchan.xchan_hash
$x = q("select * from pgrp_member left join abook on abook_xchan = xchan and abook_channel = pgrp_member.uid left join xchan on pgrp_member.xchan = xchan.xchan_hash
where gid = %d",
intval($r[0]['id'])
);
@ -376,7 +376,7 @@
if(api_user() === false)
return false;
$r = q("select * from groups where uid = %d",
$r = q("select * from pgrp where uid = %d",
intval(api_user())
);
json_return_and_die($r);

View File

@ -968,9 +968,6 @@ function bbcode($Text, $options = []) {
$Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '<a class="zrl" href="$1" ' . $target . ' rel="nofollow noopener" >$2</a>', $Text);
}
if (get_account_techlevel() < 2)
$Text = str_replace('<span class="bookmark-identifier">#^</span>', '', $Text);
// Perform MAIL Search
if (strpos($Text,'[/mail]') !== false) {
$Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '<a href="mailto:$1" ' . $target . ' rel="nofollow noopener" >$1</a>', $Text);

Some files were not shown because too many files have changed in this diff Show More