/** * @CORS * @NoAdminRequired * @NoCSRFRequired * @PublicPage */ public function returnAsJson($user, $password = null, $tags = array(), $conjunction = "or", $select = null, $sortby = "") { if ($user == null || $this->userManager->userExists($user) == false) { return $this->newJsonErrorMessage("User could not be identified"); } if ($tags[0] == "") { $tags = array(); } $public = true; if ($password != null) { $public = false; } if (!$public && !$this->userManager->checkPassword($user, $password)) { $msg = 'REST API accessed with wrong password'; \OCP\Util::writeLog('bookmarks', $msg, \OCP\Util::WARN); return $this->newJsonErrorMessage("Wrong password for user " . $user); } $attributesToSelect = array('url', 'title'); if ($select != null) { $attributesToSelect = array_merge($attributesToSelect, $select); $attributesToSelect = array_unique($attributesToSelect); } $output = Bookmarks::findBookmarks($user, $this->db, 0, $sortby, $tags, true, -1, $public, $attributesToSelect, $conjunction); if (count($output) == 0) { $output["status"] = 'error'; $output["message"] = "No results from this query"; return new JSONResponse($output); } return new JSONResponse($output); }
/** * Guess the DateTimeZone for a given offset * * We first try to find a Etc/GMT* timezone, if that does not exist, * we try to find it manually, before falling back to UTC. * * @param mixed $offset * @param bool|int $timestamp * @return \DateTimeZone */ protected function guessTimeZoneFromOffset($offset, $timestamp) { try { // Note: the timeZone name is the inverse to the offset, // so a positive offset means negative timeZone // and the other way around. if ($offset > 0) { $timeZone = 'Etc/GMT-' . $offset; } else { $timeZone = 'Etc/GMT+' . abs($offset); } return new \DateTimeZone($timeZone); } catch (\Exception $e) { // If the offset has no Etc/GMT* timezone, // we try to guess one timezone that has the same offset foreach (\DateTimeZone::listIdentifiers() as $timeZone) { $dtz = new \DateTimeZone($timeZone); $dateTime = new \DateTime(); if ($timestamp !== false) { $dateTime->setTimestamp($timestamp); } $dtOffset = $dtz->getOffset($dateTime); if ($dtOffset == 3600 * $offset) { return $dtz; } } // No timezone found, fallback to UTC \OCP\Util::writeLog('datetimezone', 'Failed to find DateTimeZone for offset "' . $offset . "'", \OCP\Util::DEBUG); return new \DateTimeZone($this->getDefaultTimeZone()); } }
/** * Move files from User before account deletion * @param \OC\User\User $user */ public function saveUserFiles(\OC\User\User $user) { // mv the files (<datadir>/uid) // TODO: quid du cas où un gros fichier est en train d'être uploadé / downloadé au moment du move ? if ($this->isUserBackupEnabled()) { // user ID (and name of user dir on owncloud) $uid = $user->getUID(); // backup dir to store user's files before user deletion $userBackupDir = $this->getUserBackupDir(); if (!file_exists($userBackupDir)) { mkdir($userBackupDir, 0700, true); } // owncloud data dir $OCDataDir = $this->getOCDataDir(); $moveFrom = $OCDataDir . '/' . $uid; $moveTo = $userBackupDir . '/' . $uid . date('Ymd_His'); if (file_exists($moveFrom) and !file_exists($moveTo)) { // $this->logger->info("Files backup before deletion for user $uid is done into $moveTo", array('app' => $this->appName)); \OCP\Util::writeLog($this->appName, "Files backup before deletion for user {$uid} is done into {$moveTo}", \OCP\Util::INFO); rename($moveFrom, $moveTo); } // then re-create the 'uid' dir to no interfere with normal deletion process if (!file_exists($moveFrom)) { mkdir($moveFrom); } } else { $this->logger->error("Files backup before deletion has failed for user {$uid}", array('app' => $this->appName)); } }
/** * Object constructor * * @param string $data * @param boolean $storeContent */ private function __construct($data, $storeContent) { try { $zendpdf = \Zend_Pdf::parse($data); // Store meta data properties if (isset($zendpdf->properties['Title'])) { $this->addField(\Zend_Search_Lucene_Field::UnStored('title', $zendpdf->properties['Title'])); } if (isset($zendpdf->properties['Author'])) { $this->addField(\Zend_Search_Lucene_Field::UnStored('author', $zendpdf->properties['Author'])); } if (isset($zendpdf->properties['Subject'])) { $this->addField(\Zend_Search_Lucene_Field::UnStored('subject', $zendpdf->properties['Subject'])); } if (isset($zendpdf->properties['Keywords'])) { $this->addField(\Zend_Search_Lucene_Field::UnStored('keywords', $zendpdf->properties['Keywords'])); } //TODO handle PDF 1.6 metadata Zend_Pdf::getMetadata() //do the content extraction $pdfParse = new \App_Search_Helper_PdfParser(); $body = $pdfParse->pdf2txt($zendpdf->render()); if ($body != '') { // Store contents if ($storeContent) { $this->addField(\Zend_Search_Lucene_Field::Text('body', $body, 'UTF-8')); } else { $this->addField(\Zend_Search_Lucene_Field::UnStored('body', $body, 'UTF-8')); } } } catch (\Exception $e) { Util::writeLog('search_lucene', $e->getMessage() . ' Trace:\\n' . $e->getTraceAsString(), Util::ERROR); } }
public static function get_url() { $appConfig = \OC::$server->getAppConfig(); $result = $appConfig->getValue('privacyIDEA', 'privacyidea_url', 'https://localhost'); \OCP\Util::writeLog('user_privacyidea', "Gettting result: {$result}", \OCP\Util::DEBUG); return $result; }
public function register() { $loginRecord = function ($user) { \OCP\Util::writeLog('core', "user:"******" action:login success", \OCP\Util::INFO); }; $logoutRecord = function () { \OCP\Util::writeLog('core', "user:"******" action:logout success", \OCP\Util::INFO); }; $createRecord = function ($node) { \OCP\Util::writeLog('activity', "user:"******" action:cretes " . $node->getName() . " sucess", \OCP\Util::INFO); }; $deleteRecord = function ($node) { \OCP\Util::writeLog('activity', "user:"******" action:deletes " . $node->getName() . " sucess", \OCP\Util::INFO); }; $renameRecord = function ($node) { \OCP\Util::writeLog('activity', "user:"******" action:renames " . $node->getName() . " sucess", \OCP\Util::INFO); }; $touchRecord = function ($node) { \OCP\Util::writeLog('activity', "user:"******" action:touches " . $node->getName() . " sucess", \OCP\Util::INFO); }; $this->userManager->listen('\\OC\\User', 'postLogin', $loginRecord); $this->userManager->listen('\\OC\\User', 'logout', $logoutRecord); $this->UserFolder->listen('\\OC\\Files', 'postCreate', $createRecord); $this->UserFolder->listen('\\OC\\Files', 'postDelete', $deleteRecord); $this->UserFolder->listen('\\OC\\Files', 'postRename', $renameRecord); }
public static function scan($id, $path, $storage) { $file = $storage->getLocalFile($path); $result = OC_Files_Antivirus::clamav_scan($file); switch ($result) { case CLAMAV_SCANRESULT_UNCHECKED: \OCP\Util::writeLog('files_antivirus', 'File "' . $path . '" from user "' . $user . '": is not checked', \OCP\Util::ERROR); break; case CLAMAV_SCANRESULT_INFECTED: $infected_action = \OCP\Config::getAppValue('files_antivirus', 'infected_action', 'only_log'); if ($infected_action == 'delete') { \OCP\Util::writeLog('files_antivirus', 'File "' . $path . '" from user "' . $user . '": is infected, file deleted', \OCP\Util::ERROR); unlink($file); } else { \OCP\Util::writeLog('files_antivirus', 'File "' . $path . '" from user "' . $user . '": is infected', \OCP\Util::ERROR); } break; case CLAMAV_SCANRESULT_CLEAN: $stmt = OCP\DB::prepare('INSERT INTO `*PREFIX*files_antivirus` (`fileid`, `check_time`) VALUES (?, ?)'); try { $result = $stmt->execute(array($id, time())); if (\OC_DB::isError($result)) { \OC_Log::write('files_antivirus', __METHOD__ . ', DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); return; } } catch (\Exception $e) { \OCP\Util::writeLog('files_antivirus', __METHOD__ . ', exception: ' . $e->getMessage(), \OCP\Util::ERROR); } break; } }
protected function rotate($logfile) { $rotatedLogfile = $logfile . '.1'; rename($logfile, $rotatedLogfile); $msg = 'Log file "' . $logfile . '" was over ' . $this->max_log_size . ' bytes, moved to "' . $rotatedLogfile . '"'; \OCP\Util::writeLog('OC\\Log\\Rotate', $msg, \OCP\Util::WARN); }
/** * {@inheritDoc} */ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { try { $svg = new \Imagick(); $svg->setBackgroundColor(new \ImagickPixel('transparent')); $content = stream_get_contents($fileview->fopen($path, 'r')); if (substr($content, 0, 5) !== '<?xml') { $content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $content; } // Do not parse SVG files with references if (stripos($content, 'xlink:href') !== false) { return false; } $svg->readImageBlob($content); $svg->setImageFormat('png32'); } catch (\Exception $e) { \OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR); return false; } //new image object $image = new \OC_Image(); $image->loadFromData($svg); //check if image object is valid if ($image->valid()) { $image->scaleDownToFit($maxX, $maxY); return $image; } return false; }
/** * {@inheritDoc} */ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { $this->initCmd(); if (is_null($this->cmd)) { return false; } $absPath = $fileview->toTmpFile($path); $tmpDir = \OC::$server->getTempManager()->getTempBaseDir(); $defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir '; $clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters); $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath); shell_exec($exec); //create imagick object from pdf $pdfPreview = null; try { list($dirname, , , $filename) = array_values(pathinfo($absPath)); $pdfPreview = $dirname . '/' . $filename . '.pdf'; $pdf = new \imagick($pdfPreview . '[0]'); $pdf->setImageFormat('jpg'); } catch (\Exception $e) { unlink($absPath); unlink($pdfPreview); \OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR); return false; } $image = new \OC_Image(); $image->loadFromData($pdf); unlink($absPath); unlink($pdfPreview); if ($image->valid()) { $image->scaleDownToFit($maxX, $maxY); return $image; } return false; }
protected function scan($fileView, $filepath) { $this->status = new Status(); $fhandler = $this->getFileHandle($fileView, $filepath); \OCP\Util::writeLog('files_antivirus', 'Exec scan: ' . $filepath, \OCP\Util::DEBUG); // using 2>&1 to grab the full command-line output. $cmd = escapeshellcmd($this->avPath) . " - 2>&1"; $descriptorSpec = array(0 => array("pipe", "r"), 1 => array("pipe", "w")); $pipes = array(); $process = proc_open($cmd, $descriptorSpec, $pipes); if (!is_resource($process)) { fclose($fhandler); throw new \RuntimeException('Error starting process'); } // write to stdin $shandler = $pipes[0]; while (!feof($fhandler)) { $chunk = fread($fhandler, $this->chunkSize); fwrite($shandler, $chunk); } fclose($shandler); fclose($fhandler); $output = stream_get_contents($pipes[1]); fclose($pipes[1]); $result = proc_close($process); $this->status->parseResponse($output, $result); return $this->status->getNumericStatus(); }
public function register() { $loginRecord = function ($user) { $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined"); Util::writeLog('core', "user:"******" role:" . $UserRole . " action:login success", Util::INFO); }; $logoutRecord = function () { $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined"); Util::writeLog('core', "user:"******" role:" . $this->UserRole . " action:logout success", Util::INFO); }; $createRecord = function ($node) { $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined"); Util::writeLog('activity', "user:"******" role:" . $UserRole . " action:creates " . $node->getName() . " success", Util::INFO); }; $deleteRecord = function ($node) { $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined"); Util::writeLog('activity', "user:"******" role:" . $UserRole . " action:deletes " . $node->getName() . " success", Util::INFO); }; $renameRecord = function ($node) { $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined"); Util::writeLog('activity', "user:"******" role:" . $UserRole . " action:renames " . $node->getName() . " success", Util::INFO); }; $touchRecord = function ($node) { $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined"); Util::writeLog('activity', "user:"******" role:" . $UserRole . " action:touches " . $node->getName() . " success", Util::INFO); }; Util::connectHook('OCP\\Share', 'post_shared', 'OCA\\Activity_Logging\\UserHooks', 'share'); $this->userManager->listen('\\OC\\User', 'postLogin', $loginRecord); $this->userManager->listen('\\OC\\User', 'logout', $logoutRecord); $this->UserFolder->listen('\\OC\\Files', 'postCreate', $createRecord); $this->UserFolder->listen('\\OC\\Files', 'postDelete', $deleteRecord); $this->UserFolder->listen('\\OC\\Files', 'postRename', $renameRecord); }
public static function get_realm() { $appConfig = \OC::$server->getAppConfig(); $result = $appConfig->getValue('privacyIDEA', 'realm', ''); \OCP\Util::writeLog('user_privacyidea', "Getting result for realm: {$result}", \OCP\Util::DEBUG); return $result; }
public static function sendMail($path) { if (!\OCP\User::isLoggedIn()) { return; } $config = \OC::$server->getConfig(); $user = \OC::$server->getUserSession()->getUser(); $email = $user->getEMailAddress(); $displayName = $user->getDisplayName(); if (strval($displayName) === '') { $displayName = $user->getUID(); } \OCP\Util::writeLog('files_antivirus', 'Email: ' . $email, \OCP\Util::DEBUG); if (!empty($email)) { try { $tmpl = new \OCP\Template('files_antivirus', 'notification'); $tmpl->assign('file', $path); $tmpl->assign('host', \OC::$server->getRequest()->getServerHost()); $tmpl->assign('user', $displayName); $msg = $tmpl->fetchPage(); $from = \OCP\Util::getDefaultEmailAddress('security-noreply'); $mailer = \OC::$server->getMailer(); $message = $mailer->createMessage(); $message->setSubject(\OCP\Util::getL10N('files_antivirus')->t('Malware detected')); $message->setFrom([$from => 'ownCloud Notifier']); $message->setTo([$email => $displayName]); $message->setPlainBody($msg); $message->setHtmlBody($msg); $mailer->send($message); } catch (\Exception $e) { \OC::$server->getLogger()->error(__METHOD__ . ', exception: ' . $e->getMessage(), ['app' => 'files_antivirus']); } } }
/** * if session is started, check if ownCloud key pair is set up, if not create it * @param \OC\Files\View $view * * @note The ownCloud key pair is used to allow public link sharing even if encryption is enabled */ public function __construct($view) { $this->view = $view; if (!$this->view->is_dir('files_encryption')) { $this->view->mkdir('files_encryption'); } $appConfig = \OC::$server->getAppConfig(); $publicShareKeyId = Helper::getPublicShareKeyId(); if ($publicShareKeyId === false) { $publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8); $appConfig->setValue('files_encryption', 'publicShareKeyId', $publicShareKeyId); } if (!Keymanager::publicShareKeyExists($view)) { $keypair = Crypt::createKeypair(); // Save public key Keymanager::setPublicKey($keypair['publicKey'], $publicShareKeyId); // Encrypt private key empty passphrase $cipher = Helper::getCipher(); $encryptedKey = Crypt::symmetricEncryptFileContent($keypair['privateKey'], '', $cipher); if ($encryptedKey) { Keymanager::setPrivateSystemKey($encryptedKey, $publicShareKeyId); } else { \OCP\Util::writeLog('files_encryption', 'Could not create public share keys', \OCP\Util::ERROR); } } if (Helper::isPublicAccess() && !self::getPublicSharePrivateKey()) { // Disable encryption proxy to prevent recursive calls $proxyStatus = \OC_FileProxy::$enabled; \OC_FileProxy::$enabled = false; $encryptedKey = Keymanager::getPrivateSystemKey($publicShareKeyId); $privateKey = Crypt::decryptPrivateKey($encryptedKey, ''); self::setPublicSharePrivateKey($privateKey); \OC_FileProxy::$enabled = $proxyStatus; } }
/** * @NoAdminRequired */ public function getTasks() { $calendars = \OC_Calendar_Calendar::allCalendars($this->userId, true); $user_timezone = \OC_Calendar_App::getTimezone(); $tasks = array(); foreach ($calendars as $calendar) { $calendar_tasks = \OC_Calendar_Object::all($calendar['id']); foreach ($calendar_tasks as $task) { if ($task['objecttype'] != 'VTODO') { continue; } if (is_null($task['summary'])) { continue; } $vtodo = Helper::parseVTODO($task['calendardata']); try { $task_data = Helper::arrayForJSON($task['id'], $vtodo, $user_timezone); $task_data['calendarid'] = $calendar['id']; $task_data['calendarcolor'] = $calendar['calendarcolor']; $tasks[] = $task_data; } catch (\Exception $e) { \OCP\Util::writeLog('tasks', $e->getMessage(), \OCP\Util::ERROR); } } } $result = array('data' => array('tasks' => $tasks)); $response = new JSONResponse(); $response->setData($result); return $response; }
protected function scan($fileView, $filepath) { $this->status = new Status(); if ($this->useSocket) { $av_socket = \OCP\Config::getAppValue('files_antivirus', 'av_socket', ''); $shandler = stream_socket_client('unix://' . $av_socket, $errno, $errstr, 5); if (!$shandler) { throw new \RuntimeException('Cannot connect to "' . $av_socket . '": ' . $errstr . ' (code ' . $errno . ')'); } } else { $av_host = \OCP\Config::getAppValue('files_antivirus', 'av_host', ''); $av_port = \OCP\Config::getAppValue('files_antivirus', 'av_port', ''); $shandler = $av_host && $av_port ? @fsockopen($av_host, $av_port) : false; if (!$shandler) { throw new \RuntimeException('The clamav module is not configured for daemon mode.'); } } $fhandler = $this->getFileHandle($fileView, $filepath); \OCP\Util::writeLog('files_antivirus', 'Exec scan: ' . $filepath, \OCP\Util::DEBUG); // request scan from the daemon fwrite($shandler, "nINSTREAM\n"); while (!feof($fhandler)) { $chunk = fread($fhandler, $this->chunkSize); $chunk_len = pack('N', strlen($chunk)); fwrite($shandler, $chunk_len . $chunk); } fwrite($shandler, pack('N', 0)); $response = fgets($shandler); \OCP\Util::writeLog('files_antivirus', 'Response :: ' . $response, \OCP\Util::DEBUG); fclose($shandler); fclose($fhandler); $this->status->parseResponse($response); return $this->status->getNumericStatus(); }
/** * create a new share * * @param array $params * @return \OC_OCS_Result */ public function createShare($params) { if (!$this->isS2SEnabled(true)) { return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing'); } $remote = isset($_POST['remote']) ? $_POST['remote'] : null; $token = isset($_POST['token']) ? $_POST['token'] : null; $name = isset($_POST['name']) ? $_POST['name'] : null; $owner = isset($_POST['owner']) ? $_POST['owner'] : null; $shareWith = isset($_POST['shareWith']) ? $_POST['shareWith'] : null; $remoteId = isset($_POST['remoteId']) ? (int) $_POST['remoteId'] : null; if ($remote && $token && $name && $owner && $remoteId && $shareWith) { if (!\OCP\Util::isValidFileName($name)) { return new \OC_OCS_Result(null, 400, 'The mountpoint name contains invalid characters.'); } if (!\OCP\User::userExists($shareWith)) { return new \OC_OCS_Result(null, 400, 'User does not exists'); } \OC_Util::setupFS($shareWith); $externalManager = new \OCA\Files_Sharing\External\Manager(\OC::$server->getDatabaseConnection(), \OC\Files\Filesystem::getMountManager(), \OC\Files\Filesystem::getLoader(), \OC::$server->getHTTPHelper(), $shareWith); try { $externalManager->addShare($remote, $token, '', $name, $owner, false, $shareWith, $remoteId); $user = $owner . '@' . $this->cleanupRemote($remote); \OC::$server->getActivityManager()->publishActivity('files_sharing', \OCA\Files_Sharing\Activity::SUBJECT_REMOTE_SHARE_RECEIVED, array($user), '', array(), '', '', $shareWith, \OCA\Files_Sharing\Activity::TYPE_REMOTE_SHARE, \OCA\Files_Sharing\Activity::PRIORITY_LOW); return new \OC_OCS_Result(); } catch (\Exception $e) { \OCP\Util::writeLog('files_sharing', 'server can not add remote share, ' . $e->getMessage(), \OCP\Util::ERROR); return new \OC_OCS_Result(null, 500, 'internal server error, was not able to add share from ' . $remote); } } return new \OC_OCS_Result(null, 400, 'server can not add remote share, missing parameter'); }
/** * listen to write event. */ public static function write_hook($params) { if (\OCP\App::isEnabled('files_versions')) { $path = $params[\OC\Files\Filesystem::signal_param_path]; $user = \OCP\User::getUser(); $excluded = false; $excludes = \OCP\Config::getSystemValue('files_versions_excludes', NULL); if (isset($excludes) && array_key_exists($user, $excludes)) { $user_excludes = $excludes[$user]; foreach ($user_excludes as &$pat) { if (fnmatch($pat, $path)) { // TODO: Not certain if logging of the files names and patters is allowed. \OCP\Util::writeLog('files_versions', "write_hook: user='******', path='" . $path . "' matched to '" . $pat . "', excluding!", \OCP\Util::INFO); $excluded = true; break; } } unset($pat); } if ($excluded) { return; } if ($path != '') { Storage::store($path); } } }
/** * @brief Data structure of vCard * @param VObject\VCard $contact * @return associative array|null */ public static function serializeContact(Contact $contact) { if (!$contact->retrieve()) { \OCP\Util::writeLog('contacts', __METHOD__ . ' error reading: ' . print_r($contact, true), \OCP\Util::DEBUG); return null; } $details = array(); if (isset($contact->PHOTO) || isset($contact->LOGO)) { $details['thumbnail'] = Properties::cacheThumbnail($contact->getBackend()->name, $contact->getParent()->getId(), $contact->getId(), null, $contact); } foreach ($contact->children as $property) { $pname = $property->name; $temp = self::serializeProperty($property); if (!is_null($temp)) { // Get Apple X-ABLabels if (isset($contact->{$property->group . '.X-ABLABEL'})) { $temp['label'] = $contact->{$property->group . '.X-ABLABEL'}->value; if ($temp['label'] == '_$!<Other>!$_') { $temp['label'] = Properties::$l10n->t('Other'); } if ($temp['label'] == '_$!<HomePage>!$_') { $temp['label'] = Properties::$l10n->t('HomePage'); } } if (array_key_exists($pname, $details)) { $details[$pname][] = $temp; } else { $details[$pname] = array($temp); } } } return array('data' => $details, 'metadata' => $contact->getMetaData()); }
/** * parse task * * @param mixed $vtodo * @param string $calendarID * @return string */ public function parseTask($vtodo, $calendarID) { $task = array('id' => (string) $vtodo->ID); $task['calendarid'] = (string) $calendarID; $task['type'] = 'task'; $task['name'] = (string) $vtodo->SUMMARY; $task['created'] = (string) $vtodo->CREATED; $task['note'] = (string) $vtodo->DESCRIPTION; $task['location'] = (string) $vtodo->LOCATION; $task['categories'] = $this->parseCategories($vtodo->CATEGORIES); $task['start'] = $this->helper->parseDateObject($vtodo->DTSTART); $task['due'] = $this->helper->parseDateObject($vtodo->DUE); $task['completed_date'] = $this->helper->parseDateObject($vtodo->COMPLETED); $task['completed'] = (bool) $task['completed_date']; try { $task['reminder'] = $this->reminderService->parseReminder($vtodo->VALARM, $vtodo->DTSTART, $vtodo->DUE); } catch (\Exception $e) { \OCP\Util::writeLog('tasks', 'TaskID ' . $vtodo->ID . ': ' . $e->getMessage(), \OCP\Util::DEBUG); $task['reminder'] = false; } $task['uid'] = (string) $vtodo->UID; $task['related'] = (string) $vtodo->{'RELATED-TO'}; $task['hidesubtasks'] = $this->parseHideSubtasks((string) $vtodo->{'X-OC-HIDESUBTASKS'}); $task['priority'] = $this->parsePriority($vtodo->PRIORITY); $task['starred'] = $this->parseStarred($task['priority']); $task['complete'] = $this->parsePercentCompleted($vtodo->{'PERCENT-COMPLETE'}); $task['comments'] = $this->parseComments($vtodo->COMMENT); return $task; }
/** * Instantiate a new \OC\NaturalSort instance. * @param object $injectedCollator */ public function __construct($injectedCollator = null) { // inject an instance of \Collator('en_US') to force using the php5-intl Collator // or inject an instance of \OC\NaturalSort_DefaultCollator to force using Owncloud's default collator if (isset($injectedCollator)) { $this->collator = $injectedCollator; \OCP\Util::writeLog('core', 'forced use of '.get_class($injectedCollator), \OCP\Util::DEBUG); } }
public function sendMail($subject, $conf) { try { $this->mailer->sendMail($conf->toaddress, $conf->toaddress, $subject, '', $conf->fromaddress, ''); } catch (\Exception $e) { \OCP\Util::writeLog('user_account_actions', "Can't send mail for user creation: " . $e->getMessage(), \OCP\Util::ERROR); } }
/** * get all the metadata of a file or folder * * * * @param string $path * @return array an array of metadata of the file */ public function getData($path) { $data = $this->storage->getMetaData($path); if (is_null($data)) { \OCP\Util::writeLog('OC\\Files\\Cache\\Scanner', "!!! Path '{$path}' is not accessible or present !!!", \OCP\Util::DEBUG); } return $data; }
public static function readdir($path) { $result = parent::readdir($path); if ($result === false) { \OCP\Util::writeLog('activity', "user:"******" action:read fail", \OCP\Util::WARN); } return $result; }
protected function shutdownScanner() { fwrite($this->writeHandle, pack('N', 0)); $response = fgets($this->writeHandle); \OCP\Util::writeLog('files_antivirus', 'Response :: ' . $response, \OCP\Util::DEBUG); fclose($this->writeHandle); $this->status->parseResponse($response); }
public function __construct($xml_config) { try { //OCP\Util::writeLog('ldap_vcard_connector', __METHOD__.', setting xml config', \OCP\Util::DEBUG); $this->config_content = new \SimpleXMLElement($xml_config); } catch (Exception $e) { \OCP\Util::writeLog('ldap_vcard_connector', __METHOD__ . ', error in setting xml config', \OCP\Util::DEBUG); } }
/** * @param string $source */ function __construct($source) { $this->path = $source; $this->zip = new \ZipArchive(); if ($this->zip->open($source, \ZipArchive::CREATE)) { } else { \OCP\Util::writeLog('files_archive', 'Error while opening archive ' . $source, \OCP\Util::WARN); } }
public function __construct(ISession $session, $timeFactory) { $this->session = $session; $this->passphrase = \OC::$server->getRequest()->getCookie(self::COOKIE_NAME); \OCP\Util::writeLog('ssm_testMC', 'NEW SESSION SERVICE' . print_r(get_object_vars($session), true), \OCP\Util::DEBUG); if ($session->exists(self::ENCRYPTED_SESSION_KEY)) { $this->data = $this->decryptSession(\OC::$server->getCrypto()); } }
protected function shutdownScanner() { fclose($this->pipes[0]); $output = stream_get_contents($this->pipes[1]); fclose($this->pipes[1]); $result = proc_close($this->process); \OCP\Util::writeLog('files_antivirus', 'Exit code :: ' . $result . ' Response :: ' . $output, \OCP\Util::DEBUG); $this->status->parseResponse($output, $result); }