aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Defperms.php112
-rw-r--r--Zotlabs/Module/Invite.php5
-rw-r--r--Zotlabs/Module/Lang.php16
-rw-r--r--Zotlabs/Module/Mood.php86
-rw-r--r--Zotlabs/Module/Notes.php8
-rw-r--r--Zotlabs/Module/Tokens.php16
6 files changed, 116 insertions, 127 deletions
diff --git a/Zotlabs/Module/Defperms.php b/Zotlabs/Module/Defperms.php
index f2f7c10e5..309a5a65a 100644
--- a/Zotlabs/Module/Defperms.php
+++ b/Zotlabs/Module/Defperms.php
@@ -19,13 +19,13 @@ class Defperms extends Controller {
*/
function init() {
-
+
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
WHERE abook_self = 1 and abook_channel = %d LIMIT 1",
@@ -37,39 +37,39 @@ class Defperms extends Controller {
$channel = App::get_channel();
if($channel)
- head_set_icon($channel['xchan_photo_s']);
+ head_set_icon($channel['xchan_photo_s']);
}
-
+
/* @brief Evaluate posted values and set changes
*
*/
-
+
function post() {
-
+
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();
-
+
$orig_record = q("SELECT * FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1",
intval($contact_id),
intval(local_channel())
);
-
+
if(! $orig_record) {
notice( t('Could not access contact record.') . EOL);
goaway(z_root() . '/connections');
return; // NOTREACHED
}
-
+
if(intval($orig_record[0]['abook_self'])) {
$autoperms = intval($_POST['autoperms']);
@@ -79,8 +79,8 @@ class Defperms extends Controller {
$autoperms = null;
$is_self = false;
}
-
-
+
+
$all_perms = \Zotlabs\Access\Permissions::Perms();
if($all_perms) {
@@ -105,15 +105,15 @@ class Defperms extends Controller {
}
}
- if(! is_null($autoperms))
+ if(! is_null($autoperms))
set_pconfig($channel['channel_id'],'system','autoperms',$autoperms);
-
-
+
+
notice( t('Settings updated.') . EOL);
-
+
// Refresh the structure in memory with the new data
-
+
$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",
@@ -123,28 +123,28 @@ class Defperms extends Controller {
if($r) {
App::$poi = $r[0];
}
-
-
+
+
$this->defperms_clone($a);
-
+
goaway(z_root() . '/defperms');
-
+
return;
-
+
}
-
+
/* @brief Clone connection
*
*
*/
-
+
function defperms_clone(&$a) {
-
+
if(! App::$poi)
return;
-
+
$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",
@@ -154,30 +154,30 @@ class Defperms extends Controller {
if($r) {
App::$poi = array_shift($r);
}
-
+
$clone = App::$poi;
-
+
unset($clone['abook_id']);
unset($clone['abook_account']);
unset($clone['abook_channel']);
-
+
$abconfig = load_abconfig($channel['channel_id'],$clone['abook_xchan']);
if($abconfig)
$clone['abconfig'] = $abconfig;
-
+
Libsync::build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone)));
}
-
+
/* @brief Generate content of connection default permissions page
*
*
*/
-
+
function get() {
-
+
$sort_type = 0;
$o = '';
-
+
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return login();
@@ -186,17 +186,15 @@ class Defperms extends Controller {
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;
+ $papp = Apps::get_papp('Default Permissions');
+ return Apps::app_render($papp, 'module');
}
-
+
$section = ((array_key_exists('section',$_REQUEST)) ? $_REQUEST['section'] : '');
$channel = App::get_channel();
-
+
$yes_no = array(t('No'),t('Yes'));
-
+
$connect_perms = \Zotlabs\Access\Permissions::connect_perms(local_channel());
$o .= "<script>function connectDefaultShare() {
@@ -210,28 +208,28 @@ class Defperms extends Controller {
}
}
$o .= " }\n</script>\n";
-
+
if(App::$poi) {
-
+
$sections = [];
$self = false;
-
+
$tpl = get_markup_template('defperms.tpl');
-
-
+
+
$perms = array();
$channel = App::get_channel();
$contact = App::$poi;
-
+
$global_perms = \Zotlabs\Access\Permissions::Perms();
$hidden_perms = [];
-
+
foreach($global_perms as $k => $v) {
$thisperm = get_abconfig(local_channel(),$contact['abook_xchan'],'my_perms',$k);
-
+
$checkinherited = \Zotlabs\Access\PermissionLimits::Get(local_channel(),$k);
$inherited = (($checkinherited & PERMS_SPECIFIC) ? false : true);
@@ -241,7 +239,7 @@ class Defperms extends Controller {
$hidden_perms[] = [ 'perms_' . $k, intval($thisperm) ];
}
}
-
+
$pcat = new \Zotlabs\Lib\Permcat(local_channel());
$pcatlist = $pcat->listing();
$permcats = [];
@@ -272,13 +270,13 @@ class Defperms extends Controller {
'$contact_id' => $contact['abook_id'],
'$name' => $contact['xchan_name'],
]);
-
+
$arr = array('contact' => $contact,'output' => $o);
-
+
call_hooks('contact_edit', $arr);
-
+
return $arr['output'];
-
- }
+
+ }
}
}
diff --git a/Zotlabs/Module/Invite.php b/Zotlabs/Module/Invite.php
index 34f1858fd..40f972385 100644
--- a/Zotlabs/Module/Invite.php
+++ b/Zotlabs/Module/Invite.php
@@ -306,9 +306,8 @@ class Invite extends Controller {
if(! Apps::system_app_installed(local_channel(), 'Invite')) {
//Do not display any associated widgets at this point
App::$pdl = '';
-
- $o = 'ZAI0102E,' . t('Invite App') . ' (' . t('Not Installed') . ')' . EOL;
- return $o;
+ $papp = Apps::get_papp('Invite');
+ return Apps::app_render($papp, 'module');
}
if (! (get_config('system','invitation_also') || get_config('system','invitation_only')) ) {
diff --git a/Zotlabs/Module/Lang.php b/Zotlabs/Module/Lang.php
index 1a2f1664e..fe185ebea 100644
--- a/Zotlabs/Module/Lang.php
+++ b/Zotlabs/Module/Lang.php
@@ -28,9 +28,9 @@ class Lang extends Controller {
}
}
- $lc = x($_POST['zinlc']) && preg_match('/^\?\?|[a-z]{2,2}[x_\-]{0,1}[a-zA-Z]{0,2}$/', $_POST['zinlc'])
+ $lc = x($_POST['zinlc']) && preg_match('/^\?\?|[a-z]{2,2}[x_\-]{0,1}[a-zA-Z]{0,2}$/', $_POST['zinlc'])
? $_POST['zinlc'] : '';
- $lcs= x($_POST['zinlcs']) && preg_match('/^[a-z,_\-]{0,191}$/', $_POST['zinlcs'])
+ $lcs= x($_POST['zinlcs']) && preg_match('/^[a-z,_\-]{0,191}$/', $_POST['zinlcs'])
? $_POST['zinlcs'] : '';
if ($isajax) {
@@ -57,12 +57,10 @@ class Lang extends Controller {
if(local_channel()) {
if(! Apps::system_app_installed(local_channel(), 'Language')) {
- //Do not display any associated widgets at this point
- App::$pdl = '';
-
- $o = '<b>' . t('Language App') . ' (' . t('Not Installed') . '):</b><br>';
- $o .= t('Change UI language');
- return $o;
+ //Do not display any associated widgets at this point
+ App::$pdl = '';
+ $papp = Apps::get_papp('Language');
+ return Apps::app_render($papp, 'module');
}
}
@@ -70,5 +68,5 @@ class Lang extends Controller {
return lang_selector();
}
-
+
}
diff --git a/Zotlabs/Module/Mood.php b/Zotlabs/Module/Mood.php
index 453f08f9f..cb2ca566b 100644
--- a/Zotlabs/Module/Mood.php
+++ b/Zotlabs/Module/Mood.php
@@ -14,36 +14,36 @@ require_once('include/items.php');
class Mood extends Controller {
function init() {
-
+
if(! local_channel())
return;
if(! Apps::system_app_installed(local_channel(), 'Mood')) {
return;
}
-
+
$uid = local_channel();
$channel = App::get_channel();
$verb = notags(trim($_GET['verb']));
-
- if(! $verb)
+
+ if(! $verb)
return;
-
+
$verbs = get_mood_verbs();
-
+
if(! array_key_exists($verb,$verbs))
return;
-
+
$activity = ACTIVITY_MOOD . '#' . urlencode($verb);
-
+
$parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : 0);
-
-
+
+
logger('mood: verb ' . $verb, LOGGER_DEBUG);
-
-
+
+
if($parent) {
- $r = q("select mid, owner_xchan, private, allow_cid, allow_gid, deny_cid, deny_gid
+ $r = q("select mid, owner_xchan, private, allow_cid, allow_gid, deny_cid, deny_gid
from item where id = %d and parent = %d and uid = %d limit 1",
intval($parent),
intval($parent),
@@ -59,24 +59,24 @@ class Mood extends Controller {
}
}
else {
-
+
$private = 0;
-
+
$allow_cid = $channel['channel_allow_cid'];
$allow_gid = $channel['channel_allow_gid'];
$deny_cid = $channel['channel_deny_cid'];
$deny_gid = $channel['channel_deny_gid'];
}
-
+
$poster = App::get_observer();
-
+
$uuid = item_message_id();
$mid = z_root() . '/item/' . $uuid;
-
- $action = sprintf( t('%1$s is %2$s','mood'), '[zrl=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/zrl]' , $verbs[$verb]);
-
+
+ $action = sprintf( t('%1$s is %2$s','mood'), '[zrl=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/zrl]' , $verbs[$verb]);
+
$arr = array();
-
+
$arr['aid'] = get_account_id();
$arr['uid'] = $uid;
$arr['uuid'] = $uuid;
@@ -97,31 +97,31 @@ class Mood extends Controller {
$arr['item_unseen'] = 1;
if(! $parent_mid)
$item['item_thread_top'] = 1;
-
+
if ((! $arr['plink']) && intval($arr['item_thread_top'])) {
$arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . urlencode($arr['mid']);
}
-
-
+
+
$post = item_store($arr);
$item_id = $post['item_id'];
-
+
if($item_id) {
\Zotlabs\Daemon\Master::Summon(array('Notifier','activity', $item_id));
}
-
+
call_hooks('post_local_end', $arr);
-
+
if($_SESSION['return_url'])
goaway(z_root() . '/' . $_SESSION['return_url']);
-
+
return;
}
-
-
-
+
+
+
function get() {
-
+
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
@@ -130,26 +130,24 @@ class Mood extends Controller {
if(! Apps::system_app_installed(local_channel(), 'Mood')) {
//Do not display any associated widgets at this point
App::$pdl = '';
-
- $o = '<b>' . t('Mood App') . ' (' . t('Not Installed') . '):</b><br>';
- $o .= t('Set your current mood and tell your friends');
- return $o;
+ $papp = Apps::get_papp('Mood');
+ return Apps::app_render($papp, 'module');
}
nav_set_selected('Mood');
$parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : '0');
-
+
$verbs = get_mood_verbs();
-
+
$shortlist = array();
foreach($verbs as $k => $v)
if($v !== 'NOTRANSLATION')
$shortlist[] = array($k,$v);
-
-
+
+
$tpl = get_markup_template('mood_content.tpl');
-
+
$o = replace_macros($tpl,array(
'$title' => t('Mood'),
'$desc' => t('Set your current mood and tell your friends'),
@@ -157,9 +155,9 @@ class Mood extends Controller {
'$parent' => $parent,
'$submit' => t('Submit'),
));
-
+
return $o;
-
+
}
-
+
}
diff --git a/Zotlabs/Module/Notes.php b/Zotlabs/Module/Notes.php
index 452e3df60..6e8e03f20 100644
--- a/Zotlabs/Module/Notes.php
+++ b/Zotlabs/Module/Notes.php
@@ -51,11 +51,9 @@ class Notes extends Controller {
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;
+ App::$pdl = '';
+ $papp = Apps::get_papp('Notes');
+ return Apps::app_render($papp, 'module');
}
$w = new \Zotlabs\Widget\Notes;
diff --git a/Zotlabs/Module/Tokens.php b/Zotlabs/Module/Tokens.php
index 1ba41dcc5..31b219019 100644
--- a/Zotlabs/Module/Tokens.php
+++ b/Zotlabs/Module/Tokens.php
@@ -46,7 +46,7 @@ class Tokens extends Controller {
return;
}
if($atoken_id) {
- $r = q("update atoken set atoken_name = '%s', atoken_token = '%s', atoken_expires = '%s'
+ $r = q("update atoken set atoken_name = '%s', atoken_token = '%s', atoken_expires = '%s'
where atoken_id = %d and atoken_uid = %d",
dbesc($name),
dbesc($token),
@@ -80,12 +80,12 @@ class Tokens extends Controller {
}
}
}
-
+
info( t('Token saved.') . EOL);
return;
}
-
+
function get() {
@@ -95,10 +95,8 @@ class Tokens extends Controller {
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;
+ $papp = Apps::get_papp('Guest Access');
+ return Apps::app_render($papp, 'module');
}
$channel = App::get_channel();
@@ -128,7 +126,7 @@ class Tokens extends Controller {
$t = q("select * from atoken where atoken_uid = %d",
intval(local_channel())
- );
+ );
$desc = t('Use this form to create temporary access identifiers to share things with non-members. These identities may be used in Access Control Lists and visitors may login using these credentials to access private content.');
@@ -189,5 +187,5 @@ class Tokens extends Controller {
));
return $o;
}
-
+
}