Refactor method and remove unused code
This commit is contained in:
parent
e6a18fd529
commit
ff987ebb1b
@ -119,21 +119,18 @@ class ProviderController extends Controller
|
|||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
*/
|
*/
|
||||||
// public function getProviders()
|
public function getProviders()
|
||||||
// {
|
{
|
||||||
// $providers = $this->providerService->getProvidersAsArray();
|
$providers = $this->providerService->getProvidersAsArray();
|
||||||
// return json_encode($providers);
|
return json_encode($providers);
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
*/
|
*/
|
||||||
public function getProviders() {
|
public function getProvidersTest() {
|
||||||
// $providers = $this->providerService->getProvidersAsArray();
|
|
||||||
// http://127.0.0.1:8585/ocs/v2.php/apps/files_sharing/api/v1/shares
|
|
||||||
|
|
||||||
|
|
||||||
$client = \OC::$server->getHTTPClientService()->newClient();
|
$client = \OC::$server->getHTTPClientService()->newClient();
|
||||||
$token = file_get_contents('http://127.0.0.1/ocs/v2.php/core/getcsrftoken', false, stream_context_create([
|
$token = file_get_contents('http://127.0.0.1/ocs/v2.php/core/getcsrftoken', false, stream_context_create([
|
||||||
@ -142,7 +139,6 @@ class ProviderController extends Controller
|
|||||||
]
|
]
|
||||||
]));
|
]));
|
||||||
$response = $client->post('http://127.0.0.1/ocs/v2.php/apps/files_sharing/api/v1/shares', [
|
$response = $client->post('http://127.0.0.1/ocs/v2.php/apps/files_sharing/api/v1/shares', [
|
||||||
//not verifier ssl
|
|
||||||
'body' => [
|
'body' => [
|
||||||
"path" => "//Talk/narindra-dev.png",
|
"path" => "//Talk/narindra-dev.png",
|
||||||
"referenceId" => "dkzcesdsdhae",
|
"referenceId" => "dkzcesdsdhae",
|
||||||
@ -160,13 +156,7 @@ class ProviderController extends Controller
|
|||||||
var_dump($response);die;
|
var_dump($response);die;
|
||||||
return json_encode($providers);
|
return json_encode($providers);
|
||||||
}
|
}
|
||||||
// json_encode([
|
|
||||||
// "path" => "//Talk/logo (2).png",
|
|
||||||
// "referenceId" => "90b2ef6f74ab9f5a5cb0f240d4552798780352ffd276717f54de9f4098e4ceab",
|
|
||||||
// "shareType" => 10,
|
|
||||||
// "shareWith" => "dkzcehae",
|
|
||||||
// "talkMetaData" => "{\"messageType\":\"\"}"
|
|
||||||
// ]));
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
@ -194,75 +184,8 @@ class ProviderController extends Controller
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @NoAdminRequired
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*/
|
|
||||||
public function moveAttachmentFile()
|
|
||||||
{
|
|
||||||
$tex = "BEGIN:VCALENDAR
|
|
||||||
PRODID:-//IDN nextcloud.com//Calendar app 4.7.16//EN
|
|
||||||
CALSCALE:GREGORIAN
|
|
||||||
VERSION:2.0
|
|
||||||
BEGIN:VEVENT
|
|
||||||
CREATED:20250319T070401Z
|
|
||||||
DTSTAMP:20250319T070538Z
|
|
||||||
LAST-MODIFIED:20250319T070538Z
|
|
||||||
SEQUENCE:2
|
|
||||||
UID:dc3ebd49-74c6-490a-afd2-2b61ef47c6f3
|
|
||||||
DTSTART;TZID=Africa/Nairobi:20250319T110001
|
|
||||||
DTEND;TZID=Africa/Nairobi:20250319T120001
|
|
||||||
STATUS:CONFIRMED
|
|
||||||
SUMMARY:test 5
|
|
||||||
LOCATION:2
|
|
||||||
DESCRIPTION:SOINS
|
|
||||||
TRANSP:TRANSPARENT
|
|
||||||
ATTACH;FMTTYPE=image/png;FILENAME=/sign.png;X-NC-FILE-ID=1426;X-NC-HAS-PREV
|
|
||||||
IEW=true:/f/1426
|
|
||||||
CLIENT:1
|
|
||||||
EMBALMER:
|
|
||||||
END:VEVENT
|
|
||||||
BEGIN:VTIMEZONE
|
|
||||||
TZID:Africa/Nairobi
|
|
||||||
BEGIN:STANDARD
|
|
||||||
TZOFFSETFROM:+0300
|
|
||||||
TZOFFSETTO:+0300
|
|
||||||
TZNAME:EAT
|
|
||||||
DTSTART:19700101T000000
|
|
||||||
END:STANDARD
|
|
||||||
END:VTIMEZONE
|
|
||||||
END:VCALENDAR";
|
|
||||||
$this->gestionService->moveCalendarAttachmentFile($tex, '/f');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @NoAdminRequired
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function sendEmailAttachment()
|
|
||||||
{
|
|
||||||
$this->storage->getFullPath("/");
|
|
||||||
$attachments = [
|
|
||||||
['file_id' => 1518, 'name' => 'Capture.JPG']
|
|
||||||
];
|
|
||||||
$to = "jonathan.goulet@nextcloud.com";
|
|
||||||
$subject = "Piece jointe";
|
|
||||||
$body = "<p>Bonjour.</p> <p>Vous trouverez en pièce jointe les fichiers votre défunt.</p>";
|
|
||||||
|
|
||||||
$message = $this->mailer->createMessage();
|
|
||||||
$message->setSubject($subject);
|
|
||||||
$message->setTo(recipients: [$to]);
|
|
||||||
|
|
||||||
foreach ($attachments as $attachment) {
|
|
||||||
$path = Filesystem::getPath($attachment['file_id']);
|
|
||||||
$content = $this->mailer->createAttachment(Filesystem::file_get_contents($path), $attachment['name'], 'image/png');
|
|
||||||
$message->attach($content);
|
|
||||||
}
|
|
||||||
$message->setHtmlBody($body);
|
|
||||||
|
|
||||||
$this->mailer->send($message);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user