aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/admin.php21
-rw-r--r--mod/profiles.php40
-rw-r--r--mod/profperm.php63
-rw-r--r--mod/siteinfo.php4
4 files changed, 66 insertions, 62 deletions
diff --git a/mod/admin.php b/mod/admin.php
index 749b94de2..70a753c46 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -215,13 +215,14 @@ function admin_page_site_post(&$a){
check_form_security_token_redirectOnErr('/admin/site', 'admin_site');
$sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : '');
- $banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
+ $banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
+ $admininfo = ((x($_POST,'admininfo')) ? trim($_POST['admininfo']) : false);
$language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
$theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : '');
- $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
- $theme_accessibility = ((x($_POST,'theme_accessibility')) ? notags(trim($_POST['theme_accessibility'])) : '');
- $site_channel = ((x($_POST,'site_channel')) ? notags(trim($_POST['site_channel'])) : '');
- $maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
+ $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
+ $theme_accessibility = ((x($_POST,'theme_accessibility')) ? notags(trim($_POST['theme_accessibility'])) : '');
+ $site_channel = ((x($_POST,'site_channel')) ? notags(trim($_POST['site_channel'])) : '');
+ $maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
$register_policy = ((x($_POST,'register_policy')) ? intval(trim($_POST['register_policy'])) : 0);
@@ -301,6 +302,12 @@ function admin_page_site_post(&$a){
set_config('system','banner', $banner);
}
+ if ($admininfo==''){
+ del_config('system','admininfo');
+ }
+ else {
+ set_config('system','admininfo', $admininfo);
+ }
set_config('system','language', $language);
set_config('system','theme', $theme);
if ( $theme_mobile === '---' ) {
@@ -393,6 +400,9 @@ function admin_page_site(&$a) {
$banner = 'red';
$banner = htmlspecialchars($banner);
+ /* Admin Info */
+ $admininfo = get_config('system','admininfo');
+
/* Register policy */
$register_choices = Array(
REGISTER_CLOSED => t("Closed"),
@@ -427,6 +437,7 @@ function admin_page_site(&$a) {
// name, label, value, help string, extra data...
'$sitename' => array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''),
'$banner' => array('banner', t("Banner/Logo"), $banner, ""),
+ '$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")),
'$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
'$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
'$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
diff --git a/mod/profiles.php b/mod/profiles.php
index b94e4bf03..c71ad9733 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -256,35 +256,23 @@ function profiles_post(&$a) {
if(strpos($lookup,'@') === 0)
$lookup = substr($lookup,1);
$lookup = str_replace('_',' ', $lookup);
- if(strpos($lookup,'@') || (strpos($lookup,'http://'))) {
- $newname = $lookup;
- $links = @lrdd($lookup);
- if(count($links)) {
- foreach($links as $link) {
- if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') {
- $prf = $link['@attributes']['href'];
- }
- }
- }
- }
- else {
- $newname = $lookup;
-
- $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
- dbesc($newname),
+ $newname = $lookup;
+
+ $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash WHERE xchan_name = '%s' AND abook_channel = %d LIMIT 1",
+ dbesc($newname),
+ intval(local_user())
+ );
+ if(! $r) {
+ $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash WHERE xchan_addr = '%s' AND abook_channel = %d LIMIT 1",
+ dbesc($lookup . '@%'),
intval(local_user())
);
- if(! $r) {
- $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
- dbesc($lookup),
- intval(local_user())
- );
- }
- if(count($r)) {
- $prf = $r[0]['url'];
- $newname = $r[0]['name'];
- }
}
+ if($r) {
+ $prf = $r[0]['xchan_url'];
+ $newname = $r[0]['xchan_name'];
+ }
+
if($prf) {
$with = str_replace($lookup,'<a href="' . $prf . '">' . $newname . '</a>', $with);
diff --git a/mod/profperm.php b/mod/profperm.php
index b31dfc128..08838831b 100644
--- a/mod/profperm.php
+++ b/mod/profperm.php
@@ -1,11 +1,15 @@
<?php
+require_once('include/Contact.php');
+
function profperm_init(&$a) {
if(! local_user())
return;
- $which = $a->user['nickname'];
+ $channel = $a->get_channel();
+ $which = $channel['channel_address'];
+
$profile = $a->argv[1];
profile_load($a,$which,$profile);
@@ -21,7 +25,7 @@ function profperm_content(&$a) {
}
- if($a->argc < 2) {
+ if(argc() < 2) {
notice( t('Invalid profile identifier.') . EOL );
return;
}
@@ -35,59 +39,59 @@ function profperm_content(&$a) {
$switchtotext = 400;
- if(($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) {
- $r = q("SELECT `id` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `self` = 0
- AND `network` = 'dfrn' AND `id` = %d AND `uid` = %d LIMIT 1",
- intval($a->argv[2]),
+ if((argc() > 2) && intval(argv(1)) && intval(argv(2))) {
+ $r = q("SELECT abook_id FROM abook WHERE abook_id = %d and abook_channel = %d limit 1",
+ intval(argv(2)),
intval(local_user())
);
- if(count($r))
- $change = intval($a->argv[2]);
+ if($r)
+ $change = intval(argv(2));
}
- if(($a->argc > 1) && (intval($a->argv[1]))) {
+ if((argc() > 1) && (intval(argv(1)))) {
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is_default` = 0 LIMIT 1",
- intval($a->argv[1]),
+ intval(argv(1)),
intval(local_user())
);
- if(! count($r)) {
+ if(! $r) {
notice( t('Invalid profile identifier.') . EOL );
return;
}
+
$profile = $r[0];
- $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `profile_id` = %d",
+ $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d AND abook_profile = %d",
intval(local_user()),
- intval($a->argv[1])
+ intval(argv(1))
);
$ingroup = array();
- if(count($r))
+ if($r)
foreach($r as $member)
- $ingroup[] = $member['id'];
+ $ingroup[] = $member['abook_id'];
$members = $r;
if($change) {
if(in_array($change,$ingroup)) {
- q("UPDATE `contact` SET `profile_id` = 0 WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ q("UPDATE abook SET abook_profile = 0 WHERE abook_id = %d AND abook_channel = %d LIMIT 1",
intval($change),
intval(local_user())
);
}
else {
- q("UPDATE `contact` SET `profile_id` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($a->argv[1]),
+ q("UPDATE abook SET abook_profile = %d WHERE abook_id = %d AND abook_channel = %d LIMIT 1",
+ intval(argv(1)),
intval($change),
intval(local_user())
);
}
- $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `profile_id` = %d",
+ $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d AND abook_profile = %d",
intval(local_user()),
- intval($a->argv[1])
+ intval(argv(1))
);
$members = $r;
@@ -95,7 +99,7 @@ function profperm_content(&$a) {
$ingroup = array();
if(count($r))
foreach($r as $member)
- $ingroup[] = $member['id'];
+ $ingroup[] = $member['abook_id'];
}
$o .= '<h2>' . t('Profile Visibility Editor') . '</h2>';
@@ -118,8 +122,8 @@ function profperm_content(&$a) {
$textmode = (($switchtotext && (count($members) > $switchtotext)) ? true : false);
foreach($members as $member) {
- if($member['url']) {
- $member['click'] = 'profChangeMember(' . $profile['id'] . ',' . $member['id'] . '); return true;';
+ if($member['xchan_url']) {
+ $member['click'] = 'profChangeMember(' . $profile['id'] . ',' . $member['abook_id'] . '); return false;';
$o .= micropro($member,true,'mpprof', $textmode);
}
}
@@ -127,20 +131,17 @@ function profperm_content(&$a) {
$o .= '<hr id="prof-separator" />';
$o .= '<div id="prof-all-contcts-title">';
- $o .= '<h3>' . t("All Contacts \x28with secure profile access\x29") . '</h3>';
+ $o .= '<h3>' . t("All Connections") . '</h3>';
$o .= '</div>';
$o .= '<div id="prof-all-contacts">';
- $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 and `pending` = 0 and `self` = 0
- AND `network` = 'dfrn' ORDER BY `name` ASC",
- intval(local_user())
- );
+ $r = abook_connections(local_user());
- if(count($r)) {
+ if($r) {
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
foreach($r as $member) {
- if(! in_array($member['id'],$ingroup)) {
- $member['click'] = 'profChangeMember(' . $profile['id'] . ',' . $member['id'] . '); return true;';
+ if(! in_array($member['abook_id'],$ingroup)) {
+ $member['click'] = 'profChangeMember(' . $profile['id'] . ',' . $member['abook_id'] . '); return false;';
$o .= micropro($member,true,'mpprof',$textmode);
}
}
diff --git a/mod/siteinfo.php b/mod/siteinfo.php
index 9f65f59e4..37cba02ec 100644
--- a/mod/siteinfo.php
+++ b/mod/siteinfo.php
@@ -88,6 +88,8 @@ function siteinfo_content(&$a) {
else
$plugins_text = t('No installed plugins/addons/apps');
+ $admininfo = bbcode(get_config('system','admininfo'));
+
$o = replace_macros(get_markup_template('siteinfo.tpl'), array(
'$title' => t('Red'),
'$description' => t('This is a hub of the Red Matrix - a global cooperative network of decentralised privacy enhanced websites.'),
@@ -99,6 +101,8 @@ function siteinfo_content(&$a) {
'$bug_link_url' => 'https://github.com/friendica/red/issues',
'$bug_link_text' => 'redmatrix issues',
'$contact' => t('Suggestions, praise, donations, etc. - please email "redmatrix" at librelist - dot com'),
+ '$adminlabel' => t('Site Administrators'),
+ '$admininfo' => $admininfo,
'$plugins_text' => $plugins_text,
'$plugins_list' => $plugins_list
));