aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Connections.php8
-rw-r--r--Zotlabs/Module/Profile_photo.php30
-rw-r--r--Zotlabs/Module/Profiles.php38
-rw-r--r--Zotlabs/Module/Settings/Profiles.php8
4 files changed, 29 insertions, 55 deletions
diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php
index b77e5d06d..0f674965d 100644
--- a/Zotlabs/Module/Connections.php
+++ b/Zotlabs/Module/Connections.php
@@ -332,9 +332,6 @@ class Connections extends \Zotlabs\Web\Controller {
'thumb' => $rr['xchan_photo_m'],
'name' => $rr['xchan_name'],
'classes' => ((intval($rr['abook_archived']) || intval($rr['abook_not_here'])) ? 'archived' : ''),
- 'link' => z_root() . '/connedit/' . $rr['abook_id'],
- 'deletelink' => z_root() . '/connedit/' . intval($rr['abook_id']) . '/drop',
- 'delete' => t('Delete'),
'url' => chanlink_hash($rr['xchan_hash']),
'webbie_label' => t('Channel address'),
'webbie' => $rr['xchan_addr'],
@@ -345,6 +342,7 @@ class Connections extends \Zotlabs\Web\Controller {
'phone' => $phone,
'status_label' => t('Status'),
'status' => $status_str,
+ 'states' => $status,
'connected_label' => t('Connected'),
'connected' => datetime_convert('UTC',date_default_timezone_get(),$rr['abook_created'], 'c'),
'approve_hover' => t('Approve connection'),
@@ -358,7 +356,8 @@ class Connections extends \Zotlabs\Web\Controller {
'connect' => (intval($rr['abook_not_here']) ? t('Connect') : ''),
'follow' => z_root() . '/follow/?f=&url=' . urlencode($rr['xchan_hash']) . '&interactive=0',
'connect_hover' => t('Connect at this location'),
- 'role' => $roles_dict[$rr['abook_role']]
+ 'role' => $roles_dict[$rr['abook_role']],
+ 'pending' => intval($rr['abook_pending'])
);
}
}
@@ -398,6 +397,7 @@ class Connections extends \Zotlabs\Web\Controller {
'$finding' => (($searching) ? t('Contact search') . ": '" . $search . "'" : ""),
'$submit' => t('Find'),
'$edit' => t('Edit'),
+ '$approve' => t('Approve'),
'$cmd' => App::$cmd,
'$contacts' => $contacts,
'$paginate' => paginate($a),
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php
index 57b491801..661694d18 100644
--- a/Zotlabs/Module/Profile_photo.php
+++ b/Zotlabs/Module/Profile_photo.php
@@ -56,7 +56,6 @@ class Profile_photo extends Controller {
check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
-
$r = q("select id, profile_guid, is_default, gender from profile where uid = %d",
intval(local_channel())
);
@@ -99,7 +98,6 @@ class Profile_photo extends Controller {
dbesc(z_root() . '/photo/profile/m/' . local_channel()),
intval(local_channel())
);
-
}
}
else {
@@ -211,14 +209,12 @@ class Profile_photo extends Controller {
// If setting for the default profile, unset the profile photo flag from any other photos I own
if ($is_default_profile) {
-
q("update profile set photo = '%s', thumb = '%s' where is_default = 1 and uid = %d",
dbesc(z_root() . '/photo/profile/l/' . local_channel()),
dbesc(z_root() . '/photo/profile/m/' . local_channel()),
intval(local_channel())
);
-
q("UPDATE photo SET photo_usage = %d WHERE photo_usage = %d
AND resource_id != '%s' AND uid = %d",
intval(PHOTO_NORMAL),
@@ -227,9 +223,7 @@ class Profile_photo extends Controller {
intval(local_channel())
);
-
send_profile_photo_activity($channel, $base_image, $profile);
-
}
else {
q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
@@ -288,12 +282,10 @@ class Profile_photo extends Controller {
// A new photo was uploaded. Store it and save some important details
// in App::$data for use in the cropping function
-
$hash = photo_new_resource();
$importing = false;
$smallest = 0;
-
if ($_REQUEST['importfile']) {
$hash = $_REQUEST['importfile'];
$importing = true;
@@ -358,6 +350,7 @@ class Profile_photo extends Controller {
notice(t('Image upload failed.') . EOL);
return;
}
+
$os_storage = false;
foreach ($i as $ii) {
@@ -501,14 +494,16 @@ class Profile_photo extends Controller {
return;
}
- if (intval($r[0]['os_storage']))
+ if (intval($r[0]['os_storage'])) {
$data = @file_get_contents($r[0]['content']);
- else
+ }
+ else {
$data = dbunescbin($r[0]['content']);
-
+ }
$ph = photo_factory($data, $r[0]['mimetype']);
$smallest = 0;
+
if ($ph->is_valid()) {
// go ahead as if we have just uploaded a new photo to crop
@@ -573,7 +568,8 @@ class Profile_photo extends Controller {
$filename = App::$data['imagecrop'] . '-' . App::$data['imagecrop_resolution'];
$tpl = get_markup_template("cropbody.tpl");
- $o = replace_macros($tpl, [
+
+ $o = replace_macros($tpl, [
'$filename' => $filename,
'$profile' => $profile_id,
'$resource' => App::$data['imagecrop'] . '-' . App::$data['imagecrop_resolution'],
@@ -583,6 +579,7 @@ class Profile_photo extends Controller {
'$form_security_token' => get_form_security_token("profile_photo"),
'$done' => t('Done editing')
]);
+
return $o;
}
@@ -601,10 +598,13 @@ class Profile_photo extends Controller {
function profile_photo_crop_ui_head($ph, $hash, $smallest) {
$max_length = get_config('system', 'max_image_length');
- if (!$max_length)
+
+ if (!$max_length) {
$max_length = MAX_IMAGE_LENGTH;
- if ($max_length > 0)
+ }
+ if ($max_length > 0) {
$ph->scaleImage($max_length);
+ }
App::$data['width'] = $ph->getWidth();
App::$data['height'] = $ph->getHeight();
@@ -615,10 +615,10 @@ class Profile_photo extends Controller {
App::$data['height'] = $ph->getHeight();
}
-
App::$data['imagecrop'] = $hash;
App::$data['imagecrop_resolution'] = $smallest;
App::$page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), []);
+
return;
}
diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php
index ca0ca4f1a..70f6b1125 100644
--- a/Zotlabs/Module/Profiles.php
+++ b/Zotlabs/Module/Profiles.php
@@ -163,34 +163,6 @@ class Profiles extends \Zotlabs\Web\Controller {
killme();
}
-
-
-
- // Run profile_load() here to make sure the theme is set before
- // we start loading content
- if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_channel(),'multi_profiles')) {
- if(feature_enabled(local_channel(),'multi_profiles'))
- $id = \App::$argv[1];
- else {
- $x = q("select id from profile where uid = %d and is_default = 1",
- intval(local_channel())
- );
- if($x)
- $id = $x[0]['id'];
- }
- $r = q("SELECT * FROM profile WHERE id = %d AND uid = %d LIMIT 1",
- intval($id),
- intval(local_channel())
- );
- if(! count($r)) {
- notice( t('Profile not found.') . EOL);
- \App::$error = 404;
- return;
- }
-
- $chan = \App::get_channel();
- profile_load($chan['channel_address'],$r[0]['id']);
- }
}
function post() {
@@ -628,8 +600,6 @@ class Profiles extends \Zotlabs\Web\Controller {
}
if($is_default) {
- // reload the info for the sidebar widget
- profile_load($channel['channel_address']);
\Zotlabs\Daemon\Master::Summon(array('Directory',local_channel()));
}
}
@@ -640,13 +610,13 @@ class Profiles extends \Zotlabs\Web\Controller {
$o = '';
- $channel = \App::get_channel();
-
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
+ $channel = \App::get_channel();
+
require_once('include/channel.php');
$profile_fields_basic = get_profile_fields_basic();
@@ -662,6 +632,7 @@ class Profiles extends \Zotlabs\Web\Controller {
if($x)
$id = $x[0]['id'];
}
+
$r = q("SELECT * FROM profile WHERE id = %d AND uid = %d LIMIT 1",
intval($id),
intval(local_channel())
@@ -672,6 +643,9 @@ class Profiles extends \Zotlabs\Web\Controller {
return;
}
+ // make sure we got uptodate data
+ profile_load($channel['channel_address'], $id);
+
$editselect = 'none';
\App::$page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
diff --git a/Zotlabs/Module/Settings/Profiles.php b/Zotlabs/Module/Settings/Profiles.php
index 67b03e04f..a1a1b8d96 100644
--- a/Zotlabs/Module/Settings/Profiles.php
+++ b/Zotlabs/Module/Settings/Profiles.php
@@ -13,14 +13,14 @@ class Profiles {
$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);
$profile_assign = ((x($_POST,'profile_assign')) ? notags(trim($_POST['profile_assign'])) : '');
set_pconfig(local_channel(),'system','profile_assign',$profile_assign);
-
+
Libsync::build_sync_packet();
if($_POST['rpath'])
@@ -38,7 +38,7 @@ class Profiles {
$extra_settings_html = '';
if(feature_enabled(local_channel(),'multi_profiles'))
- $extra_settings_html = contact_profile_assign(get_pconfig(local_channel(),'system','profile_assign',''));
+ $extra_settings_html = contact_profile_assign(get_pconfig(local_channel(),'system','profile_assign',''), t('Default profile for new contacts'));
$tpl = get_markup_template("settings_module.tpl");
@@ -51,7 +51,7 @@ class Profiles {
'$extra_settings_html' => $extra_settings_html,
'$submit' => t('Submit')
));
-
+
return $o;
}