aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Dav.php4
-rw-r--r--Zotlabs/Module/Events.php6
-rw-r--r--Zotlabs/Module/Photo.php23
-rw-r--r--Zotlabs/Module/Profile_photo.php44
4 files changed, 48 insertions, 29 deletions
diff --git a/Zotlabs/Module/Dav.php b/Zotlabs/Module/Dav.php
index 4ab101780..8ae2e8991 100644
--- a/Zotlabs/Module/Dav.php
+++ b/Zotlabs/Module/Dav.php
@@ -11,9 +11,6 @@ namespace Zotlabs\Module;
use \Sabre\DAV as SDAV;
use \Zotlabs\Storage;
-// composer autoloader for SabreDAV
-require_once('vendor/autoload.php');
-
require_once('include/attach.php');
class Dav extends \Zotlabs\Web\Controller {
@@ -74,7 +71,6 @@ class Dav extends \Zotlabs\Web\Controller {
$auth->setBrowserPlugin($browser);
// Experimental QuotaPlugin
- // require_once('Zotlabs/Storage/QuotaPlugin.php');
// $server->addPlugin(new \Zotlabs\Storage\QuotaPlugin($auth));
// All we need to do now, is to fire up the server
diff --git a/Zotlabs/Module/Events.php b/Zotlabs/Module/Events.php
index b709cd1f4..a5cc868be 100644
--- a/Zotlabs/Module/Events.php
+++ b/Zotlabs/Module/Events.php
@@ -118,8 +118,10 @@ class Events extends \Zotlabs\Web\Controller {
goaway($onerror_url);
}
- $share = ((intval($_POST['distr'])) ? intval($_POST['distr']) : 0);
-
+ // $share = ((intval($_POST['distr'])) ? intval($_POST['distr']) : 0);
+
+ $share = 1;
+
$channel = \App::get_channel();
$acl = new \Zotlabs\Access\AccessList(false);
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php
index 1134f4275..256a51e71 100644
--- a/Zotlabs/Module/Photo.php
+++ b/Zotlabs/Module/Photo.php
@@ -127,17 +127,7 @@ class Photo extends \Zotlabs\Web\Controller {
}
}
- // If using resolution 1, make sure it exists before proceeding:
- if($resolution == 1) {
- $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1",
- dbesc($photo),
- intval($resolution)
- );
- if(! $r) {
- $resolution = 2;
- }
- }
-
+
$r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1",
dbesc($photo),
intval($resolution)
@@ -166,6 +156,14 @@ class Photo extends \Zotlabs\Web\Controller {
intval($resolution)
);
+ $d = [ 'imgscale' => $resolution, 'resource_id' => $photo, 'photo' => $r, 'allowed' => $allowed ];
+ call_hooks('get_photo',$d);
+
+ $resolution = $d['imgscale'];
+ $photo = $d['resource_id'];
+ $r = $d['photo'];
+ $allowed = $d['allowed'];
+
if($r && $allowed) {
$data = dbunescbin($r[0]['content']);
$mimetype = $r[0]['mimetype'];
@@ -200,6 +198,9 @@ class Photo extends \Zotlabs\Web\Controller {
}
}
+
+
+
if(! isset($data)) {
if(isset($resolution)) {
switch($resolution) {
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php
index 1ae3a0a75..8a12e3799 100644
--- a/Zotlabs/Module/Profile_photo.php
+++ b/Zotlabs/Module/Profile_photo.php
@@ -205,15 +205,23 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$hash = photo_new_resource();
+ $importing = false;
$smallest = 0;
- require_once('include/attach.php');
+
+ if($_REQUEST['importfile']) {
+ $hash = $_REQUEST['importfile'];
+ $importing = true;
+ }
+ else {
+ require_once('include/attach.php');
- $res = attach_store(\App::get_channel(), get_observer_hash(), '', array('album' => t('Profile Photos'), 'hash' => $hash));
+ $res = attach_store(\App::get_channel(), get_observer_hash(), '', array('album' => t('Profile Photos'), 'hash' => $hash));
- logger('attach_store: ' . print_r($res,true));
+ logger('attach_store: ' . print_r($res,true));
+ }
- if($res && intval($res['data']['is_photo'])) {
+ if(($res && intval($res['data']['is_photo'])) || $importing) {
$i = q("select * from photo where resource_id = '%s' and uid = %d order by imgscale",
dbesc($hash),
intval(local_channel())
@@ -284,14 +292,17 @@ class Profile_photo extends \Zotlabs\Web\Controller {
// When using an existing photo, we don't have a dialogue to offer a choice of profiles,
// so it gets attached to the default
- $p = q("select id from profile where is_default = 1 and uid = %d",
+ $c = q("select id, is_default from profile where uid = %d",
intval(local_channel())
);
- if($p) {
- $_REQUEST['profile'] = $p[0]['id'];
+
+ $multi_profiles = true;
+
+ if(($c) && (count($c) === 1) && (intval($c[0]['is_default']))) {
+ $_REQUEST['profile'] = $c[0]['id'];
+ $multi_profiles = false;
}
-
$r = q("SELECT id, album, imgscale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY imgscale ASC",
intval(local_channel()),
dbesc($resource_id)
@@ -308,7 +319,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
// set an already loaded and cropped photo as profile photo
- if(($r[0]['album'] == t('Profile Photos')) && ($havescale)) {
+ if($havescale) {
// unset any existing profile photos
$r = q("UPDATE photo SET photo_usage = %d WHERE photo_usage = %d AND uid = %d",
intval(PHOTO_NORMAL),
@@ -366,9 +377,15 @@ class Profile_photo extends \Zotlabs\Web\Controller {
}
}
- $this->profile_photo_crop_ui_head($a, $ph, $hash, $smallest);
+ if($multi_profiles) {
+ \App::$data['importfile'] = $resource_id;
+ }
+ else {
+ $this->profile_photo_crop_ui_head($a, $ph, $hash, $smallest);
+ }
// falls through with App::$data['imagecrop'] set so we go straight to the cropping section
+
}
@@ -377,6 +394,8 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$profiles = q("select id, profile_name as name, is_default from profile where uid = %d order by id asc",
intval(local_channel())
);
+
+ $importing = ((array_key_exists('importfile',\App::$data)) ? true : false);
if(! x(\App::$data,'imagecrop')) {
@@ -384,10 +403,11 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$o .= replace_macros($tpl,array(
'$user' => \App::$channel['channel_address'],
+ '$importfile' => (($importing) ? \App::$data['importfile'] : ''),
'$lbl_upfile' => t('Upload File:'),
'$lbl_profiles' => t('Select a profile:'),
- '$title' => t('Upload Profile Photo'),
- '$submit' => t('Upload'),
+ '$title' => (($importing) ? t('Use Photo for Profile') : t('Upload Profile Photo')),
+ '$submit' => (($importing) ? t('Use') : t('Upload')),
'$profiles' => $profiles,
'$single' => ((count($profiles) == 1) ? true : false),
'$profile0' => $profiles[0],