Пример #1
0
 public function formatDateSpanData()
 {
     $time = 1416916800;
     // Use a fixed timestamp so we don't switch days/years with the getTimestampAgo
     $deL10N = new \OC_L10N('lib', 'de');
     return array(array('today', $this->getTimestampAgo($time, 30, 15), $time), array('yesterday', $this->getTimestampAgo($time, 0, 0, 0, 1), $time), array('4 days ago', $this->getTimestampAgo($time, 0, 0, 0, 4), $time), array('5 months ago', $this->getTimestampAgo($time, 0, 0, 0, 155), $time), array('2 years ago', $this->getTimestampAgo($time, 0, 0, 0, 0, 2), $time), array('today', $this->getTimestampAgo($time, 0, 0, 0, 0, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), array('yesterday', $this->getTimestampAgo($time, 30, 15, 3, 1, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), array('4 days ago', $this->getTimestampAgo($time, 30, 15, 3, 4, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), array('5 months ago', $this->getTimestampAgo($time, 30, 15, 3, 155, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), array('2 years ago', $this->getTimestampAgo($time, 30, 15, 3, 35, 3), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), array($deL10N->t('today'), new \DateTime('Wed, 02 Oct 2013 12:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), array($deL10N->t('yesterday'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), $deL10N), array($deL10N->n('%n day ago', '%n days ago', 2), new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), $deL10N), array($deL10N->n('%n month ago', '%n months ago', 9), new \DateTime('Tue, 31 Dec 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000'), $deL10N), array($deL10N->n('%n year ago', '%n years ago', 2), new \DateTime('Sun, 01 Jan 2012 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000'), $deL10N), array('today', new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), array('today', new \DateTime('Wed, 02 Oct 2013 12:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), array('today', new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), array('yesterday', new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')), array('yesterday', new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), array('yesterday', new \DateTime('Tue, 01 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')), array('yesterday', new \DateTime('Tue, 01 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), array('yesterday', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000')), array('yesterday', new \DateTime('Mon, 31 Dec 2012 00:00:00 +0000'), new \DateTime('Tue, 01 Jan 2013 00:00:00 +0000')), array('2 days ago', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')), array('last month', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 31 Oct 2013 00:00:00 +0000')), array('last month', new \DateTime('Sun, 01 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000')), array('last month', new \DateTime('Sun, 01 Sep 2013 00:00:00 +0000'), new \DateTime('Thu, 31 Oct 2013 00:00:00 +0000')), array('9 months ago', new \DateTime('Tue, 31 Dec 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), array('11 months ago', new \DateTime('Thu, 03 Oct 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), array('last year', new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), array('last year', new \DateTime('Tue, 01 Jan 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), array('2 years ago', new \DateTime('Sun, 01 Jan 2012 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')));
 }
Пример #2
0
 /**
  * rename a file
  *
  * @param string $dir
  * @param string $oldname
  * @param string $newname
  * @return array
  */
 public function rename($dir, $oldname, $newname)
 {
     $result = array('success' => false, 'data' => NULL);
     // rename to "/Shared" is denied
     if ($dir === '/' and $newname === 'Shared') {
         $result['data'] = array('message' => $this->l10n->t("Invalid folder name. Usage of 'Shared' is reserved."));
         // rename to existing file is denied
     } else {
         if ($this->view->file_exists($dir . '/' . $newname)) {
             $result['data'] = array('message' => $this->l10n->t("The name %s is already used in the folder %s. Please choose a different name.", array($newname, $dir)));
         } else {
             if ($newname !== '.' and !($dir === '/' and $oldname === 'Shared') and $this->view->rename($dir . '/' . $oldname, $dir . '/' . $newname)) {
                 // successful rename
                 $meta = $this->view->getFileInfo($dir . '/' . $newname);
                 if ($meta['mimetype'] === 'httpd/unix-directory') {
                     $meta['type'] = 'dir';
                 } else {
                     $meta['type'] = 'file';
                 }
                 $fileinfo = array('id' => $meta['fileid'], 'mime' => $meta['mimetype'], 'size' => $meta['size'], 'etag' => $meta['etag'], 'directory' => $dir, 'name' => $newname, 'isPreviewAvailable' => \OC::$server->getPreviewManager()->isMimeSupported($meta['mimetype']), 'icon' => \OCA\Files\Helper::determineIcon($meta));
                 $result['success'] = true;
                 $result['data'] = $fileinfo;
             } else {
                 // rename failed
                 $result['data'] = array('message' => $this->l10n->t('%s could not be renamed', array($oldname)));
             }
         }
     }
     return $result;
 }
Пример #3
0
 /**
  * rename a file
  *
  * @param string $dir
  * @param string $oldname
  * @param string $newname
  * @return array
  */
 public function rename($dir, $oldname, $newname)
 {
     $result = array('success' => false, 'data' => NULL);
     $normalizedOldPath = \OC\Files\Filesystem::normalizePath($dir . '/' . $oldname);
     $normalizedNewPath = \OC\Files\Filesystem::normalizePath($dir . '/' . $newname);
     // rename to non-existing folder is denied
     if (!$this->view->file_exists($normalizedOldPath)) {
         $result['data'] = array('message' => $this->l10n->t('%s could not be renamed as it has been deleted', array($oldname)), 'code' => 'sourcenotfound', 'oldname' => $oldname, 'newname' => $newname);
     } else {
         if (!$this->view->file_exists($dir)) {
             $result['data'] = array('message' => (string) $this->l10n->t('The target folder has been moved or deleted.', array($dir)), 'code' => 'targetnotfound');
             // rename to existing file is denied
         } else {
             if ($this->view->file_exists($normalizedNewPath)) {
                 $result['data'] = array('message' => $this->l10n->t("The name %s is already used in the folder %s. Please choose a different name.", array($newname, $dir)));
             } else {
                 if ($newname !== '.' and $this->view->rename($normalizedOldPath, $normalizedNewPath)) {
                     // successful rename
                     $meta = $this->view->getFileInfo($normalizedNewPath);
                     $meta = \OCA\Files\Helper::populateTags(array($meta));
                     $fileInfo = \OCA\Files\Helper::formatFileInfo(current($meta));
                     $fileInfo['path'] = dirname($normalizedNewPath);
                     $result['success'] = true;
                     $result['data'] = $fileInfo;
                 } else {
                     // rename failed
                     $result['data'] = array('message' => $this->l10n->t('%s could not be renamed', array($oldname)));
                 }
             }
         }
     }
     return $result;
 }
Пример #4
0
 /**
  * Get all items for the users we want to send an email to
  *
  * @return array Notification data (user => array of rows from the table)
  */
 public function getLinkList()
 {
     $topEntries = [['id' => 'all', 'name' => (string) $this->l->t('All Activities'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList')]];
     if ($this->user && $this->userSettings->getUserSetting($this->user, 'setting', 'self')) {
         $topEntries[] = ['id' => 'self', 'name' => (string) $this->l->t('Activities by you'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => 'self'))];
         $topEntries[] = ['id' => 'by', 'name' => (string) $this->l->t('Activities by others'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => 'by'))];
     }
     $additionalEntries = $this->activityManager->getNavigation();
     $topEntries = array_merge($topEntries, $additionalEntries['top']);
     return array('top' => $topEntries, 'apps' => $additionalEntries['apps']);
 }
Пример #5
0
 /**
  * @param \OC_L10N $l
  * @return array Array "stringID of the type" => "translated string description for the setting"
  */
 public function getNotificationTypes(\OC_L10N $l)
 {
     if (isset($this->notificationTypes[$l->getLanguageCode()])) {
         return $this->notificationTypes[$l->getLanguageCode()];
     }
     $notificationTypes = array(self::TYPE_SHARED => $l->t('A file or folder has been <strong>shared</strong>'), self::TYPE_SHARE_CREATED => $l->t('A new file or folder has been <strong>created</strong>'), self::TYPE_SHARE_CHANGED => $l->t('A file or folder has been <strong>changed</strong>'), self::TYPE_SHARE_DELETED => $l->t('A file or folder has been <strong>deleted</strong>'), self::TYPE_SHARE_RESTORED => $l->t('A file or folder has been <strong>restored</strong>'));
     // Allow other apps to add new notification types
     $additionalNotificationTypes = $this->activityManager->getNotificationTypes($l->getLanguageCode());
     $notificationTypes = array_merge($notificationTypes, $additionalNotificationTypes);
     $this->notificationTypes[$l->getLanguageCode()] = $notificationTypes;
     return $notificationTypes;
 }
Пример #6
0
 /**
  * @brief Startup encryption backend upon user login
  * @note This method should never be called for users using client side encryption
  */
 public static function login($params)
 {
     $l = new \OC_L10N('files_encryption');
     //check if all requirements are met
     if (!Helper::checkRequirements()) {
         $error_msg = $l->t("Missing requirements.");
         $hint = $l->t('Please make sure that PHP 5.3.3 or newer is installed and that the OpenSSL PHP extension is enabled and configured properly. For now, the encryption app has been disabled.');
         \OC_App::disable('files_encryption');
         \OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);
         \OCP\Template::printErrorPage($error_msg, $hint);
     }
     $view = new \OC_FilesystemView('/');
     // ensure filesystem is loaded
     if (!\OC\Files\Filesystem::$loaded) {
         \OC_Util::setupFS($params['uid']);
     }
     $util = new Util($view, $params['uid']);
     // setup user, if user not ready force relogin
     if (Helper::setupUser($util, $params['password']) === false) {
         return false;
     }
     $encryptedKey = Keymanager::getPrivateKey($view, $params['uid']);
     $privateKey = Crypt::decryptPrivateKey($encryptedKey, $params['password']);
     if ($privateKey === false) {
         \OCP\Util::writeLog('Encryption library', 'Private key for user "' . $params['uid'] . '" is not valid! Maybe the user password was changed from outside if so please change it back to gain access', \OCP\Util::ERROR);
     }
     $session = new \OCA\Encryption\Session($view);
     $session->setPrivateKey($privateKey);
     // Check if first-run file migration has already been performed
     $ready = false;
     if ($util->getMigrationStatus() === Util::MIGRATION_OPEN) {
         $ready = $util->beginMigration();
     }
     // If migration not yet done
     if ($ready) {
         $userView = new \OC_FilesystemView('/' . $params['uid']);
         // Set legacy encryption key if it exists, to support
         // depreciated encryption system
         if ($userView->file_exists('encryption.key') && ($encLegacyKey = $userView->file_get_contents('encryption.key'))) {
             $plainLegacyKey = Crypt::legacyDecrypt($encLegacyKey, $params['password']);
             $session->setLegacyKey($plainLegacyKey);
         }
         // Encrypt existing user files:
         // This serves to upgrade old versions of the encryption
         // app (see appinfo/spec.txt)
         if ($util->encryptAll('/' . $params['uid'] . '/' . 'files', $session->getLegacyKey(), $params['password'])) {
             \OC_Log::write('Encryption library', 'Encryption of existing files belonging to "' . $params['uid'] . '" completed', \OC_Log::INFO);
         }
         // Register successful migration in DB
         $util->finishMigration();
     }
     return true;
 }
Пример #7
0
 public function validate($config)
 {
     $errors = array();
     if (empty($config['dbuser'])) {
         $errors[] = $this->trans->t("%s enter the database username.", array($this->dbprettyname));
     }
     if (empty($config['dbname'])) {
         $errors[] = $this->trans->t("%s enter the database name.", array($this->dbprettyname));
     }
     if (substr_count($config['dbname'], '.') >= 1) {
         $errors[] = $this->trans->t("%s you may not use dots in the database name", array($this->dbprettyname));
     }
     return $errors;
 }
Пример #8
0
 /**
  * Delete the address book from backend
  *
  * @return bool
  */
 public function delete()
 {
     if (!$this->hasPermission(\OCP\PERMISSION_DELETE)) {
         throw new Exception(self::$l10n->t('You don\'t have permissions to delete the address book.'), Http::STATUS_FORBIDDEN);
     }
     return $this->backend->deleteAddressBook($this->getId());
 }
Пример #9
0
 /**
  * Returns a list of grouped parameters
  *
  * 2 parameters are joined by "and":
  * => A and B
  * Up to 5 parameters are joined by "," and "and":
  * => A, B, C, D and E
  * More than 5 parameters are joined by "," and trimmed:
  * => A, B, C and #n more
  *
  * @param array $parameterList
  * @param array $plainParameterList
  * @param bool $highlightParams
  * @return string
  */
 protected function joinParameterList($parameterList, $plainParameterList, $highlightParams)
 {
     if (empty($parameterList)) {
         return '';
     }
     $count = sizeof($parameterList);
     $lastItem = array_pop($parameterList);
     if ($count == 1) {
         return $lastItem;
     } else {
         if ($count == 2) {
             $firstItem = array_pop($parameterList);
             return $this->l->t('%s and %s', array($firstItem, $lastItem));
         } else {
             if ($count <= 5) {
                 $list = implode($this->l->t(', '), $parameterList);
                 return $this->l->t('%s and %s', array($list, $lastItem));
             }
         }
     }
     $firstParams = array_slice($parameterList, 0, 3);
     $firstList = implode($this->l->t(', '), $firstParams);
     $trimmedParams = array_slice($plainParameterList, 3);
     $trimmedList = implode($this->l->t(', '), $trimmedParams);
     if ($highlightParams) {
         return $this->l->n('%s and <strong class="tooltip" title="%s">%n more</strong>', '%s and <strong class="tooltip" title="%s">%n more</strong>', $count - 3, array($firstList, $trimmedList));
     }
     return $this->l->n('%s and %n more', '%s and %n more', $count - 3, array($firstList));
 }
Пример #10
0
 /**
  * Generate an event to show in the calendar
  *
  * @return \Sabre\VObject\Component\VCalendar|null
  */
 public function getBirthdayEvent()
 {
     if (!isset($this->BDAY)) {
         return;
     }
     $birthday = $this->BDAY;
     if ((string) $birthday) {
         $title = str_replace('{name}', strtr((string) $this->FN, array('\\,' => ',', '\\;' => ';')), App::$l10n->t('{name}\'s Birthday'));
         try {
             $date = new \DateTime($birthday);
         } catch (\Exception $e) {
             continue;
         }
         $vevent = \Sabre\VObject\Component::create('VEVENT');
         $vevent->add('DTSTART');
         $vevent->DTSTART->setDateTime($date, \Sabre\VObject\Property\DateTime::DATE);
         $vevent->add('DURATION', 'P1D');
         $vevent->{'UID'} = $this->UID;
         $vevent->{'RRULE'} = 'FREQ=YEARLY';
         $vevent->{'SUMMARY'} = $title;
         $vcal = \Sabre\VObject\Component::create('VCALENDAR');
         $vcal->VERSION = '2.0';
         $appinfo = \OCP\App::getAppInfo('contacts');
         $appversion = \OCP\App::getAppVersion('contacts');
         $vcal->PRODID = '-//ownCloud//NONSGML ' . $appinfo['name'] . ' ' . $appversion . '//EN';
         $vcal->add($vevent);
         return $vcal;
     }
 }
 /**
  * Check if the user is a admin, send json error msg if not
  */
 public static function checkAdminUser()
 {
     self::checkLoggedIn();
     if (!OC_Group::inGroup(OC_User::getUser(), 'admin')) {
         $l = new OC_L10N('core');
         self::error(array('data' => array('message' => $l->t('Authentication error'))));
         exit;
     }
 }
Пример #12
0
 /**
  * Get all items for the users we want to send an email to
  *
  * @return array Notification data (user => array of rows from the table)
  */
 public function getLinkList()
 {
     $topEntries = array(array('id' => 'all', 'name' => (string) $this->l->t('All Activities'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList')), array('id' => 'self', 'name' => (string) $this->l->t('Activities by you'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => 'self'))), array('id' => 'by', 'name' => (string) $this->l->t('Activities by others'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => 'by'))), array('id' => 'shares', 'name' => (string) $this->l->t('Shares'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => 'shares'))));
     $appFilterEntries = array(array('id' => 'files', 'name' => (string) $this->l->t('Files'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => 'files'))));
     $additionalEntries = $this->activityManager->getNavigation();
     $topEntries = array_merge($topEntries, $additionalEntries['top']);
     $appFilterEntries = array_merge($appFilterEntries, $additionalEntries['apps']);
     return array('top' => $topEntries, 'apps' => $appFilterEntries);
 }
Пример #13
0
 public static function buildFileStorageStatistics($dir)
 {
     // information about storage capacities
     $storageInfo = \OC_Helper::getStorageInfo($dir);
     $l = new \OC_L10N('files');
     $maxUploadFileSize = \OCP\Util::maxUploadFilesize($dir, $storageInfo['free']);
     $maxHumanFileSize = \OCP\Util::humanFileSize($maxUploadFileSize);
     $maxHumanFileSize = $l->t('Upload (max. %s)', array($maxHumanFileSize));
     return array('uploadMaxFilesize' => $maxUploadFileSize, 'maxHumanFilesize' => $maxHumanFileSize, 'freeSpace' => $storageInfo['free'], 'usedSpacePercent' => (int) $storageInfo['relative']);
 }
	/**
	 * inform recipient about public link share
	 *
	 * @param string $recipient recipient email address
	 * @param string $filename the shared file
	 * @param string $link the public link
	 * @param int $expiration expiration date (timestamp)
	 * @return array $result of failed recipients
	 */
	public function sendLinkShareMail($recipient, $filename, $link, $expiration) {
		$subject = (string)$this->l->t('%s shared »%s« with you', array($this->senderDisplayName, $filename));
		list($htmlMail, $alttextMail) = $this->createMailBody($filename, $link, $expiration);
		$rs = explode(' ', $recipient);
		$failed = array();
		foreach ($rs as $r) {
			try {
				\OCP\Util::sendMail($r, $r, $subject, $htmlMail, $this->from, $this->senderDisplayName, 1, $alttextMail);
			} catch (\Exception $e) {
				\OCP\Util::writeLog('sharing', "Can't send mail with public link to $r: " . $e->getMessage(), \OCP\Util::ERROR);
				$failed[] = $r;
			}
		}
		return $failed;
	}
Пример #15
0
 /**
  * Get an address book from a specific backend.
  *
  * @param string $backendName
  * @param string $addressbookid
  * @return AddressBook|null
  */
 public function getAddressBook($backendName, $addressbookid)
 {
     //\OCP\Util::writeLog('contacts', __METHOD__ . ': '. $backendName . ', ' . $addressbookid, \OCP\Util::DEBUG);
     foreach (self::$addressBooks as $addressBook) {
         if ($addressBook->getBackend()->name === $backendName && $addressBook->getId() === $addressbookid) {
             return $addressBook;
         }
     }
     $backend = self::getBackend($backendName, $this->user);
     $info = $backend->getAddressBook($addressbookid);
     if (!$info) {
         throw new \Exception(self::$l10n->t('Address book not found'), 404);
     }
     $addressBook = new AddressBook($backend, $info);
     self::$addressBooks[] = $addressBook;
     return $addressBook;
 }
<?php

// Init owncloud
require_once '../../lib/base.php';
OC_JSON::checkLoggedIn();
$l = new OC_L10N('core');
// Get data
if (isset($_POST['email'])) {
    $email = trim($_POST['email']);
    OC_Preferences::setValue(OC_User::getUser(), 'settings', 'email', $email);
    OC_JSON::success(array("data" => array("message" => $l->t("email Changed"))));
} else {
    OC_JSON::error(array("data" => array("message" => $l->t("Invalid request"))));
}
<?php

$l = new OC_L10N('calendar');
OC::$CLASSPATH['OC_Calendar_Calendar'] = 'apps/calendar/lib/calendar.php';
OC::$CLASSPATH['OC_Calendar_Object'] = 'apps/calendar/lib/object.php';
OC::$CLASSPATH['OC_Calendar_Hooks'] = 'apps/calendar/lib/hooks.php';
OC::$CLASSPATH['OC_Connector_Sabre_CalDAV'] = 'apps/calendar/lib/connector_sabre.php';
OC_HOOK::connect('OC_User', 'post_createUser', 'OC_Calendar_Hooks', 'deleteUser');
OC_Util::addScript('calendar', 'loader');
OC_App::register(array('order' => 10, 'id' => 'calendar', 'name' => 'Calendar'));
OC_App::addNavigationEntry(array('id' => 'calendar_index', 'order' => 10, 'href' => OC_Helper::linkTo('calendar', 'index.php'), 'icon' => OC_Helper::imagePath('calendar', 'icon.png'), 'name' => $l->t('Calendar')));
OC_App::registerPersonal('calendar', 'settings');
Пример #18
0
 /**
  * Returns a dependency missing message
  * @param OC_L10N $l
  * @param string $module
  * @param string $backend
  * @return string
  */
 private static function getSingleDependencyMessage(OC_L10N $l, $module, $backend)
 {
     switch (strtolower($module)) {
         case 'curl':
             return $l->t('<b>Note:</b> The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
         case 'ftp':
             return $l->t('<b>Note:</b> The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
         default:
             return $l->t('<b>Note:</b> "%s" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it.', array($module, $backend));
     }
 }
Пример #19
0
	// avoid side effects
	\OC_User::setIncognitoMode(true);

	$l = new \OC_L10N('core');
	$eventSource = \OC::$server->createEventSource();
	$logger = \OC::$server->getLogger();
	$updater = new \OC\Updater(
			\OC::$server->getHTTPHelper(),
			\OC::$server->getConfig(),
			$logger
	);
	$incompatibleApps = [];
	$disabledThirdPartyApps = [];

	$updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Turned on maintenance mode'));
	});
	$updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Turned off maintenance mode'));
	});
	$updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Maintenance mode is kept active'));
	});
	$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Updated database'));
	});
	$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'));
Пример #20
0
 /**
  * check dependencies
  */
 public static function checkDependencies()
 {
     $l = new OC_L10N('files_external');
     $txt = '';
     if (!OC_Util::runningOnWindows()) {
         if (!OC_Mount_Config::checksmbclient()) {
             $txt .= $l->t('<b>Warning:</b> "smbclient" is not installed. Mounting of CIFS/SMB shares is not possible. Please ask your system administrator to install it.') . '<br />';
         }
     }
     if (!OC_Mount_Config::checkphpftp()) {
         $txt .= $l->t('<b>Warning:</b> The FTP support in PHP is not enabled or installed. Mounting of FTP shares is not possible. Please ask your system administrator to install it.') . '<br />';
     }
     if (!OC_Mount_Config::checkcurl()) {
         $txt .= $l->t('<b>Warning:</b> The Curl support in PHP is not enabled or installed. Mounting of ownCloud / WebDAV or GoogleDrive is not possible. Please ask your system administrator to install it.') . '<br />';
     }
     return $txt;
 }
Пример #21
0
 /**
  * @param $params
  */
 public static function preShared($params)
 {
     if (\OCP\App::isEnabled('files_encryption') === false) {
         return true;
     }
     $l = new \OC_L10N('files_encryption');
     $users = array();
     $view = new \OC\Files\View('/public-keys/');
     switch ($params['shareType']) {
         case \OCP\Share::SHARE_TYPE_USER:
             $users[] = $params['shareWith'];
             break;
         case \OCP\Share::SHARE_TYPE_GROUP:
             $users = \OC_Group::usersInGroup($params['shareWith']);
             break;
     }
     $notConfigured = array();
     foreach ($users as $user) {
         if (!$view->file_exists($user . '.public.key')) {
             $notConfigured[] = $user;
         }
     }
     if (count($notConfigured) > 0) {
         $params['run'] = false;
         $params['error'] = $l->t('Following users are not set up for encryption:') . ' ' . join(', ', $notConfigured);
     }
 }
Пример #22
0
             }
         } else {
             if ($param === 'maildir') {
                 $maildir = $_POST[$param];
                 if (substr($maildir, -1) != '/') {
                     $maildir .= '/';
                 }
                 OCP\Config::setAppValue('roundcube', $param, $maildir);
             } else {
                 if ($param == 'rcRefreshInterval') {
                     $refresh = trim($_POST[$param]);
                     if ($refresh == '') {
                         OC_Appconfig::deleteKey('roundcube', $param);
                     } else {
                         if (!is_numeric($refresh)) {
                             OC_JSON::error(array("data" => array("message" => $l->t("Refresh interval '%s' is not a number.", array($refresh)))));
                             return false;
                         } else {
                             OCP\Config::setAppValue('roundcube', $param, $refresh);
                         }
                     }
                 } else {
                     OCP\Config::setAppValue('roundcube', $param, $_POST[$param]);
                 }
             }
         }
     }
 } else {
     if ($param === 'removeHeaderNav') {
         OCP\Config::setAppValue('roundcube', 'removeHeaderNav', false);
     }
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
// Init owncloud
require_once '../../lib/base.php';
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('contacts');
$id = $_GET['id'];
$l10n = new OC_L10N('contacts');
$card = OC_Contacts_VCard::find($id);
if ($card === false) {
    echo $l10n->t('Contact could not be found.');
    exit;
}
$addressbook = OC_Contacts_Addressbook::find($card['addressbookid']);
if ($addressbook === false || $addressbook['userid'] != OC_USER::getUser()) {
    echo $l10n->t('This is not your contact.');
    // This is a weird error, why would it come up? (Better feedback for users?)
    exit;
}
$content = OC_Contacts_VCard::parse($card['carddata']);
// invalid vcard
if (is_null($content)) {
    echo $l10n->t('This card is not RFC compatible.');
    exit;
}
// Photo :-)
Пример #24
0
<?php

set_time_limit(0);
$RUNTIME_NOAPPS = true;
require_once '../../lib/base.php';
if (OC::checkUpgrade(false)) {
    $l = new \OC_L10N('core');
    $eventSource = new OC_EventSource();
    $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'));
    });
    $updater->listen('\\OC\\Updater', 'maintenanceEnd', function () use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('Turned off maintenance mode'));
    });
    $updater->listen('\\OC\\Updater', 'dbUpgrade', function () use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('Updated database'));
    });
    $updater->listen('\\OC\\Updater', 'filecacheStart', function () use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('Updating filecache, this may take really long...'));
    });
    $updater->listen('\\OC\\Updater', 'filecacheDone', function () use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('Updated filecache'));
    });
    $updater->listen('\\OC\\Updater', 'filecacheProgress', function ($out) use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('... %d%% done ...', array('percent' => $out)));
    });
    $updater->listen('\\OC\\Updater', 'failure', function ($message) use($eventSource) {
        $eventSource->send('failure', $message);
        $eventSource->close();
        OC_Config::setValue('maintenance', false);
Пример #25
0
 /**
  * @brief Translate an event string with the translations from the app where it was send from
  * @param string $app The app where this event comes from
  * @param string $text The text including placeholders
  * @param array $params The parameter for the placeholder
  * @param bool $stripPath Shall we strip the path from file names?
  * @param bool $highlightParams Shall we highlight the parameters in the string?
  *             They will be highlighted with `<strong>`, all data will be passed through
  *             \OCP\Util::sanitizeHTML() before, so no XSS is possible.
  * @return string translated
  */
 public function translation($app, $text, $params, $stripPath = false, $highlightParams = false)
 {
     if (!$text) {
         return '';
     }
     $preparedParams = $this->parameterHelper->prepareParameters($params, $this->parameterHelper->getSpecialParameterList($app, $text), $stripPath, $highlightParams);
     if ($app === 'files') {
         switch ($text) {
             case 'created_self':
                 return $this->l->t('You created %1$s', $preparedParams);
             case 'created_by':
                 return $this->l->t('%2$s created %1$s', $preparedParams);
             case 'created_public':
                 return $this->l->t('%1$s was created in a public folder', $preparedParams);
             case 'changed_self':
                 return $this->l->t('You changed %1$s', $preparedParams);
             case 'changed_by':
                 return $this->l->t('%2$s changed %1$s', $preparedParams);
             case 'deleted_self':
                 return $this->l->t('You deleted %1$s', $preparedParams);
             case 'deleted_by':
                 return $this->l->t('%2$s deleted %1$s', $preparedParams);
             case 'restored_self':
                 return $this->l->t('You restored %1$s', $preparedParams);
             case 'restored_by':
                 return $this->l->t('%2$s restored %1$s', $preparedParams);
             case 'shared_user_self':
                 return $this->l->t('You shared %1$s with %2$s', $preparedParams);
             case 'shared_group_self':
                 return $this->l->t('You shared %1$s with group %2$s', $preparedParams);
             case 'shared_with_by':
                 return $this->l->t('%2$s shared %1$s with you', $preparedParams);
             case 'shared_link_self':
                 return $this->l->t('You shared %1$s via link', $preparedParams);
         }
     }
     // Allow other apps to correctly translate their activities
     $translation = $this->activityManager->translate($app, $text, $preparedParams, $stripPath, $highlightParams, $this->l->getLanguageCode());
     if ($translation !== false) {
         return $translation;
     }
     $l = Util::getL10N($app);
     return $l->t($text, $preparedParams);
 }
Пример #26
0
<?php
set_time_limit(0);
require_once '../../lib/base.php';

if (OC::checkUpgrade(false)) {
	$l = new \OC_L10N('core');
	$eventSource = new OC_EventSource();
	$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'));
	});
	$updater->listen('\OC\Updater', 'maintenanceEnd', function () use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Turned off maintenance mode'));
	});
	$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Updated database'));
	});
	$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) {
			$info = OC_App::getAppInfo($appId);
			$list[] = $info['name'] . ' (' . $info['id'] . ')';
Пример #27
0
<?php

/**
 * ownCloud - Files_Opds App
 *
 * @author Frank de Lange
 * @copyright 2014 Frank de Lange
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 */
namespace OCA\Files_Opds;

$l = new \OC_L10N('files_opds');
\OCP\JSON::checkLoggedIn();
\OCP\JSON::callCheck();
Bookshelf::clear();
\OCP\JSON::success(array("data" => array("message" => $l->t("Bookshelf cleared"))));
Пример #28
0
/*
 * Copyright 2014 by Francesco PIRANEO G. (fpiraneo@gmail.com)
 * 
 * This file is part of oclife.
 * 
 * oclife is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * oclife is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with oclife.  If not, see <http://www.gnu.org/licenses/>.
 */
OCP\User::checkAdminUser();
// Handle translations
$l = new \OC_L10N('oclife');
OCP\Util::addscript('oclife', 'oclife/oclife_admin');
$useImageMagick = intval(OCP\Config::getAppValue('oclife', 'useImageMagick'));
$tmpl = new \OCP\Template('oclife', 'settings');
$tmpl->assign('useImageMagick', $useImageMagick === 1 ? 'CHECKED' : '');
$imagick = extension_loaded('imagick');
$imagickEnabled = $imagick ? $l->t('ImageMagick is loaded and ready to be used') : $l->t('ImageMagick is not loaded: Please refers to php manual.');
$tmpl->assign('imagickEnabled', $imagickEnabled);
$tmpl->assign('enImageMagick', $imagick ? '' : 'disabled="DISABLED"');
$tmpl->assign('imagickMessageColor', $imagick ? 'green' : 'red');
return $tmpl->fetchPage();
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
// Init owncloud
require_once '../../../lib/base.php';
$id = $_GET['id'];
$l10n = new OC_L10N('contacts');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$card = OC_Contacts_VCard::find($id);
if ($card === false) {
    OC_JSON::error(array('data' => array('message' => $l10n->t('Contact could not be found.'))));
    exit;
}
$addressbook = OC_Contacts_Addressbook::find($card['addressbookid']);
if ($addressbook === false || $addressbook['userid'] != OC_USER::getUser()) {
    OC_JSON::error(array('data' => array('message' => $l10n->t('This is not your contact.'))));
    exit;
}
$vcard = OC_Contacts_VCard::parse($card['carddata']);
// Check if the card is valid
if (is_null($vcard)) {
    OC_JSON::error(array('data' => array('message' => $l10n->t('vCard could not be read.'))));
    exit;
}
$details = OC_Contacts_VCard::structureContact($vcard);
$tmpl = new OC_Template('contacts', 'part.details');
Пример #30
0
 public static function saveUserSettings($appName, $ocUser, $rcUser, $rcPassword)
 {
     $l = new OC_L10N('roundcube');
     if (isset($appName) && $appName == "roundcube") {
         $result = self::cryptEmailIdentity($ocUser, $rcUser, $rcPassword, true);
         OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->saveUserSettings(): Starting saving new users data for ' . $ocUser . ' as roundcube user ' . $rcUser, OCP\Util::DEBUG);
         if ($result) {
             // update login credentials
             $rcMaildir = OCP\Config::getAppValue('roundcube', 'maildir', '');
             $rcHost = OCP\Config::getAppValue('roundcube', 'rcHost', '');
             $rcPort = OCP\Config::getAppValue('roundcube', 'rcPort', '');
             if ($rcHost == '') {
                 $rc_host = OCP\Util::getServerHost();
             }
             // login again
             if (self::login($rcHost, $rcPort, $rcMaildir, $rcUser, $rcPassword)) {
                 OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->saveUserSettings(): Saved user settings successfull.', OCP\Util::DEBUG);
                 OCP\JSON::success(array('data' => array('message' => $l->t('Email-user credentials successfully stored. Please login again to OwnCloud for applying the new settings.'))));
                 return true;
             } else {
                 OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->saveUserSettings(): Login errors', OCP\Util::DEBUG);
                 OC_JSON::error(array("data" => array("message" => $l->t("Unable to login into roundcube. There are login errors."))));
                 return false;
             }
         } else {
             OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->saveUserSettings(): Unable to save email credentials.', OCP\Util::DEBUG);
             OC_JSON::error(array("data" => array("message" => $l->t("Unable to store email credentials in the data-base."))));
             return false;
         }
     } else {
         OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->saveUserSettings(): Not for roundcube app.', OCP\Util::DEBUG);
         OC_JSON::error(array("data" => array("message" => $l->t("Not submitted for us."))));
         return false;
     }
 }