summaryrefslogtreecommitdiffstats
path: root/core/ajax
diff options
context:
space:
mode:
Diffstat (limited to 'core/ajax')
-rw-r--r--core/ajax/preview.php7
-rw-r--r--core/ajax/share.php27
-rw-r--r--core/ajax/translations.php2
-rw-r--r--core/ajax/update.php12
4 files changed, 25 insertions, 23 deletions
diff --git a/core/ajax/preview.php b/core/ajax/preview.php
index d38043707ac..d2811f39dd6 100644
--- a/core/ajax/preview.php
+++ b/core/ajax/preview.php
@@ -21,10 +21,6 @@ if ($file === '') {
exit;
}
-if ($keepAspect === true) {
- $maxY = $maxX;
-}
-
if ($maxX === 0 || $maxY === 0) {
//400 Bad Request
\OC_Response::setStatus(400);
@@ -34,7 +30,8 @@ if ($maxX === 0 || $maxY === 0) {
try {
$preview = new \OC\Preview(\OC_User::getUser(), 'files');
- if (!$always and !$preview->isMimeSupported(\OC\Files\Filesystem::getMimeType($file))) {
+ $info = \OC\Files\Filesystem::getFileInfo($file);
+ if (!$always and !$preview->isAvailable($info)) {
\OC_Response::setStatus(404);
} else {
$preview->setFile($file);
diff --git a/core/ajax/share.php b/core/ajax/share.php
index 98e5a05b272..9f758b4e44e 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -31,6 +31,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
try {
$shareType = (int)$_POST['shareType'];
$shareWith = $_POST['shareWith'];
+ $itemSourceName = isset($_POST['itemSourceName']) ? $_POST['itemSourceName'] : null;
if ($shareType === OCP\Share::SHARE_TYPE_LINK && $shareWith == '') {
$shareWith = null;
}
@@ -81,22 +82,16 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
break;
case 'setExpirationDate':
if (isset($_POST['date'])) {
- $l = OC_L10N::get('core');
- $date = new \DateTime($_POST['date']);
- $today = new \DateTime('now');
-
-
-
- if ($date < $today) {
- OC_JSON::error(array('data' => array('message' => $l->t('Expiration date is in the past.'))));
- return;
+ try {
+ $return = OCP\Share::setExpirationDate($_POST['itemType'], $_POST['itemSource'], $_POST['date']);
+ ($return) ? OC_JSON::success() : OC_JSON::error();
+ } catch (\Exception $e) {
+ OC_JSON::error(array('data' => array('message' => $e->getMessage())));
}
- $return = OCP\Share::setExpirationDate($_POST['itemType'], $_POST['itemSource'], $_POST['date']);
- ($return) ? OC_JSON::success() : OC_JSON::error();
}
break;
case 'informRecipients':
- $l = OC_L10N::get('core');
+ $l = \OC::$server->getL10N('core');
$shareType = (int) $_POST['shareType'];
$itemType = $_POST['itemType'];
$itemSource = $_POST['itemSource'];
@@ -113,7 +108,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$mailNotification = new OC\Share\MailNotifications();
$result = $mailNotification->sendInternalShareMail($recipientList, $itemSource, $itemType);
- \OCP\Share::setSendMailStatus($itemType, $itemSource, $shareType, true);
+ \OCP\Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, true);
if (empty($result)) {
OCP\JSON::success();
@@ -132,7 +127,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$shareType = $_POST['shareType'];
$itemType = $_POST['itemType'];
$recipient = $_POST['recipient'];
- \OCP\Share::setSendMailStatus($itemType, $itemSource, $shareType, false);
+ \OCP\Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, false);
OCP\JSON::success();
break;
@@ -159,7 +154,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
if(empty($result)) {
\OCP\JSON::success();
} else {
- $l = OC_L10N::get('core');
+ $l = \OC::$server->getL10N('core');
OCP\JSON::error(array(
'data' => array(
'message' => $l->t("Couldn't send mail to following users: %s ",
@@ -293,7 +288,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$count = 0;
// enable l10n support
- $l = OC_L10N::get('core');
+ $l = \OC::$server->getL10N('core');
foreach ($groups as $group) {
if ($count < 15) {
diff --git a/core/ajax/translations.php b/core/ajax/translations.php
index e829453dbcc..c296cea572a 100644
--- a/core/ajax/translations.php
+++ b/core/ajax/translations.php
@@ -25,6 +25,6 @@ $app = isset($_POST["app"]) ? $_POST["app"] : "";
$app = OC_App::cleanAppId($app);
-$l = OC_L10N::get( $app );
+$l = \OC::$server->getL10N($app);
OC_JSON::success(array('data' => $l->getTranslations(), 'plural_form' => $l->getPluralFormString()));
diff --git a/core/ajax/update.php b/core/ajax/update.php
index 698614c975f..419992c9891 100644
--- a/core/ajax/update.php
+++ b/core/ajax/update.php
@@ -3,8 +3,12 @@ set_time_limit(0);
require_once '../../lib/base.php';
if (OC::checkUpgrade(false)) {
+ // if a user is currently logged in, their session must be ignored to
+ // avoid side effects
+ \OC_User::setIncognitoMode(true);
+
$l = new \OC_L10N('core');
- $eventSource = new OC_EventSource();
+ $eventSource = \OC::$server->createEventSource();
$updater = new \OC\Updater(\OC_Log::$object);
$updater->listen('\OC\Updater', 'maintenanceStart', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Turned on maintenance mode'));
@@ -18,6 +22,12 @@ if (OC::checkUpgrade(false)) {
$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checked database schema update'));
});
+ $updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($eventSource, $l) {
+ $eventSource->send('success', (string)$l->t('Checked database schema update for apps'));
+ });
+ $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) {
+ $eventSource->send('success', (string)$l->t('Updated "%s" to %s', array($app, $version)));
+ });
$updater->listen('\OC\Updater', 'disabledApps', function ($appList) use ($eventSource, $l) {
$list = array();
foreach ($appList as $appId) {