当前位置: 首页>>代码示例>>PHP>>正文


PHP Util::emitHook方法代码示例

本文整理汇总了PHP中OCP\Util::emitHook方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::emitHook方法的具体用法?PHP Util::emitHook怎么用?PHP Util::emitHook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\Util的用法示例。


在下文中一共展示了Util::emitHook方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleKnownGroups

    /**
     * @param string[] $groups
     */
    private static function handleKnownGroups($groups)
    {
        \OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – Dealing with known Groups.', \OCP\Util::DEBUG);
        $query = \OCP\DB::prepare('
			UPDATE `*PREFIX*ldap_group_members`
			SET `owncloudusers` = ?
			WHERE `owncloudname` = ?
		');
        foreach ($groups as $group) {
            //we assume, that self::$groupsFromDB has been retrieved already
            $knownUsers = unserialize(self::$groupsFromDB[$group]['owncloudusers']);
            $actualUsers = self::getGroupBE()->usersInGroup($group);
            $hasChanged = false;
            foreach (array_diff($knownUsers, $actualUsers) as $removedUser) {
                \OCP\Util::emitHook('OC_User', 'post_removeFromGroup', array('uid' => $removedUser, 'gid' => $group));
                \OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – "' . $removedUser . '" removed from "' . $group . '".', \OCP\Util::INFO);
                $hasChanged = true;
            }
            foreach (array_diff($actualUsers, $knownUsers) as $addedUser) {
                \OCP\Util::emitHook('OC_User', 'post_addToGroup', array('uid' => $addedUser, 'gid' => $group));
                \OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – "' . $addedUser . '" added to "' . $group . '".', \OCP\Util::INFO);
                $hasChanged = true;
            }
            if ($hasChanged) {
                $query->execute(array(serialize($actualUsers), $group));
            }
        }
        \OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – FINISHED dealing with known Groups.', \OCP\Util::DEBUG);
    }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:32,代码来源:jobs.php

示例2: createShare

 /**
  * 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.');
         }
         // FIXME this should be a method in the user management instead
         \OCP\Util::writeLog('files_sharing', 'shareWith before, ' . $shareWith, \OCP\Util::DEBUG);
         \OCP\Util::emitHook('\\OCA\\Files_Sharing\\API\\Server2Server', 'preLoginNameUsedAsUserName', array('uid' => &$shareWith));
         \OCP\Util::writeLog('files_sharing', 'shareWith after, ' . $shareWith, \OCP\Util::DEBUG);
         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(), \OC::$server->getNotificationManager(), $shareWith);
         try {
             $externalManager->addShare($remote, $token, '', $name, $owner, false, $shareWith, $remoteId);
             $user = $owner . '@' . $this->cleanupRemote($remote);
             \OC::$server->getActivityManager()->publishActivity(Activity::FILES_SHARING_APP, Activity::SUBJECT_REMOTE_SHARE_RECEIVED, array($user, trim($name, '/')), '', array(), '', '', $shareWith, Activity::TYPE_REMOTE_SHARE, Activity::PRIORITY_LOW);
             /**
             * FIXME
             				$urlGenerator = \OC::$server->getURLGenerator();
             
             				$notificationManager = \OC::$server->getNotificationManager();
             				$notification = $notificationManager->createNotification();
             				$notification->setApp('files_sharing')
             					->setUser($shareWith)
             					->setTimestamp(time())
             					->setObject('remote_share', $remoteId)
             					->setSubject('remote_share', [$user, trim($name, '/')]);
             
             				$declineAction = $notification->createAction();
             				$declineAction->setLabel('decline')
             					->setLink($urlGenerator->getAbsoluteURL('/ocs/v1.php/apps/files_sharing/api/v1/remote_shares/' . $remoteId), 'DELETE');
             				$notification->addAction($declineAction);
             
             				$acceptAction = $notification->createAction();
             				$acceptAction->setLabel('accept')
             					->setLink($urlGenerator->getAbsoluteURL('/ocs/v1.php/apps/files_sharing/api/v1/remote_shares/' . $remoteId), 'POST');
             				$notification->addAction($acceptAction);
             
             				$notificationManager->notify($notification);
             */
             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');
 }
开发者ID:evanjt,项目名称:core,代码行数:66,代码来源:server2server.php

示例3: createCollection

 /**
  * Creates new objects from import
  *
  * @param \OCA\Calendar\IObjectCollection $collection
  * @throws \OCA\Calendar\BusinessLayer\Exception
  * @return \OCA\Calendar\IObjectCollection
  */
 public function createCollection(IObjectCollection $collection)
 {
     $className = get_class($collection);
     /** @var IObjectCollection $createdObjects */
     $createdObjects = new $className();
     $this->checkCalendarSupports(Permissions::CREATE);
     if (!$this->api instanceof BackendUtils\IObjectAPICreate) {
         throw new Exception('Backend does not support creating objects');
     }
     foreach ($collection as $object) {
         try {
             if ($object->getUri() === null) {
                 $randomURI = ObjectUtility::randomURI();
                 $object->setUri($randomURI);
             }
             $object->setCalendar($this->calendar);
             $object->getEtag(true);
             $this->checkObjectIsValid($object);
             Util::emitHook('\\OCA\\Calendar', 'preCreateObject', array($object));
             $object = $this->api->create($object);
             Util::emitHook('\\OCA\\Calendar', 'postCreateObject', array($object));
             $createdObjects[] = $object;
         } catch (BackendUtils\Exception $ex) {
             $this->logger->debug($ex->getMessage());
         } catch (Exception $ex) {
             $this->logger->debug($ex->getMessage());
         } catch (CorruptDataException $ex) {
             $this->logger->debug($ex->getMessage());
         }
     }
     if ($this->isCachingEnabled) {
         $this->calendar->checkUpdate();
     }
     return $createdObjects;
 }
开发者ID:amin-hedayati,项目名称:calendar-rework,代码行数:42,代码来源:objectrequestmanager.php

示例4: createShare

 /**
  * 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.');
         }
         \OCP\Util::writeLog('files_sharing', 'shareWith before, ' . $shareWith, \OCP\Util::DEBUG);
         \OCP\Util::emitHook('\\OCA\\Files_Sharing\\API\\Server2Server', 'preLoginNameUsedAsUserName', array('uid' => &$shareWith));
         \OCP\Util::writeLog('files_sharing', 'shareWith after, ' . $shareWith, \OCP\Util::DEBUG);
         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(Activity::FILES_SHARING_APP, Activity::SUBJECT_REMOTE_SHARE_RECEIVED, array($user, trim($name, '/')), '', array(), '', '', $shareWith, Activity::TYPE_REMOTE_SHARE, 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');
 }
开发者ID:rosarion,项目名称:core,代码行数:41,代码来源:server2server.php

示例5: send

 /**
  * @brief Send an event into the activity stream
  * @param string $app The app where this event is associated with
  * @param string $subject A short description of the event
  * @param string $message A longer description of the event
  * @param string $file The file including path where this event is associated with. (optional)
  * @param string $link A link where this event is associated with (optional)
  * @return boolean
  */
 public static function send($app, $subject, $subjectparams = array(), $message = '', $messageparams = array(), $file = '', $link = '', $affecteduser = '', $type = 0, $prio = Data::PRIORITY_MEDIUM)
 {
     $timestamp = time();
     $user = \OCP\User::getUser();
     if ($affecteduser === '') {
         $auser = \OCP\User::getUser();
     } else {
         $auser = $affecteduser;
     }
     // store in DB
     $query = \OCP\DB::prepare('INSERT INTO `*PREFIX*activity`(`app`, `subject`, `subjectparams`, `message`, `messageparams`, `file`, `link`, `user`, `affecteduser`, `timestamp`, `priority`, `type`)' . ' VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )');
     $query->execute(array($app, $subject, serialize($subjectparams), $message, serialize($messageparams), $file, $link, $user, $auser, $timestamp, $prio, $type));
     // call the expire function only every 1000x time to preserve performance.
     if (rand(0, 1000) == 0) {
         Data::expire();
     }
     // fire a hook so that other apps like notification systems can connect
     // todo translations
     \OCP\Util::emitHook('OC_Activity', 'post_event', array('app' => $app, 'subject' => $subject, 'user' => $user, 'affecteduser' => $affecteduser, 'message' => $message, 'file' => $file, 'link' => $link, 'prio' => $prio, 'type' => $type));
     return true;
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:30,代码来源:data.php

示例6: compareAddresses

 /**
  * check if two federated cloud IDs refer to the same user
  *
  * @param string $user1
  * @param string $server1
  * @param string $user2
  * @param string $server2
  * @return bool true if both users and servers are the same
  */
 public function compareAddresses($user1, $server1, $user2, $server2)
 {
     $normalizedServer1 = strtolower($this->removeProtocolFromUrl($server1));
     $normalizedServer2 = strtolower($this->removeProtocolFromUrl($server2));
     if (rtrim($normalizedServer1, '/') === rtrim($normalizedServer2, '/')) {
         // FIXME this should be a method in the user management instead
         \OCP\Util::emitHook('\\OCA\\Files_Sharing\\API\\Server2Server', 'preLoginNameUsedAsUserName', array('uid' => &$user1));
         \OCP\Util::emitHook('\\OCA\\Files_Sharing\\API\\Server2Server', 'preLoginNameUsedAsUserName', array('uid' => &$user2));
         if ($user1 === $user2) {
             return true;
         }
     }
     return false;
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:23,代码来源:AddressHandler.php

示例7: emitHook

 /**
  * @deprecated implement the emitter interface instead
  * Emits a signal. To get data from the slot use references!
  * @param string $signalClass class name of emitter
  * @param string $signalName name of signal
  * @param array $params default: array() array with additional data
  * @return bool true if slots exists or false if not
  */
 public function emitHook($signalClass, $signalName, $params = array())
 {
     return \OCP\Util::emitHook($signalClass, $signalName, $params);
 }
开发者ID:loulancn,项目名称:core,代码行数:12,代码来源:api.php

示例8: getrequestedEvents

 /**
  * @brief analyses the parameter for calendar parameter and returns the objects
  * @param (string) $calendarid - calendarid
  * @param (int) $start - unixtimestamp of start
  * @param (int) $end - unixtimestamp of end
  * @return (array) $events
  */
 public static function getrequestedEvents($calendarid, $start, $end)
 {
     $events = array();
     if ($calendarid === 'shared_events') {
         $checkStart = $start->format('U');
         $singleevents = \OCP\Share::getItemsSharedWith(self::SHAREEVENT, ShareEvent::FORMAT_EVENT);
         foreach ($singleevents as $singleevent) {
             $startCheck_dt = new \DateTime($singleevent['startdate'], new \DateTimeZone('UTC'));
             $checkStartSE = $startCheck_dt->format('U');
             //   \OCP\Util::writeLog('calendar','STARTDATE'.$checkStart.' -> '.$checkStartSE, \OCP\Util::DEBUG);
             if ($checkStartSE > $checkStart) {
                 $singleevent['summary'] .= ' (' . (string) self::$l10n->t('by') . ' ' . Object::getowner($singleevent['id']) . ')';
                 $events[] = $singleevent;
             }
         }
     } else {
         if (is_numeric($calendarid)) {
             $calendar = self::getCalendar($calendarid);
             \OCP\Response::enableCaching(0);
             \OCP\Response::setETagHeader($calendar['ctag']);
             $events = Object::allInPeriod($calendarid, $start, $end, $calendar['userid'] !== \OCP\User::getUser());
         } else {
             \OCP\Util::emitHook('OCA\\CalendarPlus', 'getEvents', array('calendar_id' => $calendarid, 'events' => &$events));
         }
     }
     return $events;
 }
开发者ID:Bullnados,项目名称:calendarplus,代码行数:34,代码来源:app.php

示例9: Dispatcher

    \OC::$session->close();
    $dispatcher = new Dispatcher($params);
    $dispatcher->dispatch('GroupController', 'deleteGroup');
});
$this->create('contacts_categories_rename', 'groups/rename')->post()->action(function ($params) {
    \OC::$session->close();
    $dispatcher = new Dispatcher($params);
    $dispatcher->dispatch('GroupController', 'renameGroup');
});
$this->create('contacts_categories_addto', 'groups/addto/{categoryId}')->post()->action(function ($params) {
    \OC::$session->close();
    $dispatcher = new Dispatcher($params);
    $dispatcher->dispatch('GroupController', 'addToGroup');
});
$this->create('contacts_categories_removefrom', 'groups/removefrom/{categoryId}')->post()->action(function ($params) {
    \OC::$session->close();
    $dispatcher = new Dispatcher($params);
    $dispatcher->dispatch('GroupController', 'removeFromGroup');
})->requirements(array('categoryId'));
$this->create('contacts_setpreference', 'preference/set')->post()->action(function ($params) {
    \OC::$session->close();
    $dispatcher = new Dispatcher($params);
    $dispatcher->dispatch('SettingsController', 'set');
});
$this->create('contacts_index_properties', 'indexproperties/{user}/')->post()->action(function ($params) {
    \OC::$session->close();
    // TODO: Add BackgroundJob for this.
    \OCP\Util::emitHook('OCA\\Contacts', 'indexProperties', array());
    \OCP\Config::setUserValue($params['user'], 'contacts', 'contacts_properties_indexed', 'yes');
    \OCP\JSON::success(array('isIndexed' => true));
})->requirements(array('user'))->defaults(array('user' => \OCP\User::getUser()));
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:31,代码来源:routes.php

示例10: fopen

 public function fopen($path, $mode)
 {
     if ($source = $this->getSourcePath($path)) {
         switch ($mode) {
             case 'r+':
             case 'rb+':
             case 'w+':
             case 'wb+':
             case 'x+':
             case 'xb+':
             case 'a+':
             case 'ab+':
             case 'w':
             case 'wb':
             case 'x':
             case 'xb':
             case 'a':
             case 'ab':
                 $exists = $this->file_exists($path);
                 if ($exists && !$this->isUpdatable($path)) {
                     return false;
                 }
                 if (!$exists && !$this->isCreatable(dirname($path))) {
                     return false;
                 }
         }
         $info = array('target' => $this->getMountPoint() . $path, 'source' => $source, 'mode' => $mode);
         \OCP\Util::emitHook('\\OC\\Files\\Storage\\Shared', 'fopen', $info);
         list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
         return $storage->fopen($internalPath, $mode);
     }
     return false;
 }
开发者ID:ArcherSys,项目名称:ArcherSysOSCloud7,代码行数:33,代码来源:sharedstorage.php

示例11: verifyPassword

 /**
  * @param string $password
  * @throws \Exception
  */
 private static function verifyPassword($password)
 {
     $accepted = true;
     $message = '';
     \OCP\Util::emitHook('\\OC\\Share', 'verifyPassword', ['password' => $password, 'accepted' => &$accepted, 'message' => &$message]);
     if (!$accepted) {
         throw new \Exception($message);
     }
 }
开发者ID:evanjt,项目名称:core,代码行数:13,代码来源:share.php

示例12: deleteContact

 /**
  * Deletes a contact
  *
  * @param string $addressBookId
  * @param string|array $id
  * @param array $options - Optional (backend specific options)
  * @see getContact
  * @return bool
  */
 public function deleteContact($addressBookId, $id, array $options = array())
 {
     // TODO: pass the uri in $options instead.
     $noCollection = isset($options['noCollection']) ? $options['noCollection'] : false;
     $isBatch = isset($options['isBatch']) ? $options['isBatch'] : false;
     if (is_array($id)) {
         if (isset($id['id'])) {
             $id = $id['id'];
         } elseif (isset($id['uri'])) {
             $id = $this->getIdFromUri($id['uri']);
             if (is_null($id)) {
                 \OCP\Util::writeLog('contacts', __METHOD__ . ' Couldn\'t find contact', \OCP\Util::ERROR);
                 return false;
             }
         } else {
             throw new \Exception(__METHOD__ . ' If second argument is an array, either \'id\' or \'uri\' has to be set.');
         }
     }
     if (!$isBatch) {
         \OCP\Util::emitHook('OCA\\Contacts', 'pre_deleteContact', array('id' => $id));
     }
     if ($noCollection) {
         $me = $this->getContact(null, $id, $options);
         $addressBookId = $me['parent'];
     }
     try {
         $result = $this->getPreparedQuery('deletecontact')->execute(array($id, $addressBookId));
         if (\OCP\DB::isError($result)) {
             \OCP\Util::writeLog('contacts', __METHOD__ . 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
             return false;
         }
     } catch (\Exception $e) {
         \OCP\Util::writeLog('contacts', __METHOD__ . ', exception: ' . $e->getMessage(), \OCP\Util::ERROR);
         \OCP\Util::writeLog('contacts', __METHOD__ . ', id: ' . $id, \OCP\Util::DEBUG);
         return false;
     }
     $this->setModifiedAddressBook($addressBookId);
     return true;
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:48,代码来源:database.php

示例13: restore

 /**
  * restore files from trash bin
  *
  * @param string $file path to the deleted file
  * @param string $filename name of the file
  * @param int $timestamp time when the file was deleted
  *
  * @return bool
  */
 public static function restore($file, $filename, $timestamp)
 {
     $user = \OCP\User::getUser();
     $view = new \OC\Files\View('/' . $user);
     $location = '';
     if ($timestamp) {
         $query = \OC_DB::prepare('SELECT `location` FROM `*PREFIX*files_trash`' . ' WHERE `user`=? AND `id`=? AND `timestamp`=?');
         $result = $query->execute(array($user, $filename, $timestamp))->fetchAll();
         if (count($result) !== 1) {
             \OC_Log::write('files_trashbin', 'trash bin database inconsistent!', \OC_Log::ERROR);
         } else {
             $location = $result[0]['location'];
             // if location no longer exists, restore file in the root directory
             if ($location !== '/' && (!$view->is_dir('files' . $location) || !$view->isUpdatable('files' . $location))) {
                 $location = '';
             }
         }
     }
     // we need a  extension in case a file/dir with the same name already exists
     $uniqueFilename = self::getUniqueFilename($location, $filename, $view);
     $source = \OC\Files\Filesystem::normalizePath('files_trashbin/files/' . $file);
     $target = \OC\Files\Filesystem::normalizePath('files/' . $location . '/' . $uniqueFilename);
     $mtime = $view->filemtime($source);
     // disable proxy to prevent recursive calls
     $proxyStatus = \OC_FileProxy::$enabled;
     \OC_FileProxy::$enabled = false;
     // restore file
     $restoreResult = $view->rename($source, $target);
     // handle the restore result
     if ($restoreResult) {
         $fakeRoot = $view->getRoot();
         $view->chroot('/' . $user . '/files');
         $view->touch('/' . $location . '/' . $uniqueFilename, $mtime);
         $view->chroot($fakeRoot);
         \OCP\Util::emitHook('\\OCA\\Files_Trashbin\\Trashbin', 'post_restore', array('filePath' => \OC\Files\Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename), 'trashPath' => \OC\Files\Filesystem::normalizePath($file)));
         self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp);
         self::restoreEncryptionKeys($view, $file, $filename, $uniqueFilename, $location, $timestamp);
         if ($timestamp) {
             $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=? AND `id`=? AND `timestamp`=?');
             $query->execute(array($user, $filename, $timestamp));
         }
         // enable proxy
         \OC_FileProxy::$enabled = $proxyStatus;
         return true;
     }
     // enable proxy
     \OC_FileProxy::$enabled = $proxyStatus;
     return false;
 }
开发者ID:Combustible,项目名称:core,代码行数:58,代码来源:trashbin.php

示例14: storeMail

 /**
  * @brief Send an event into the activity stream
  *
  * @param string $app The app where this event is associated with
  * @param string $subject A short description of the event
  * @param array  $subjectParams Array of parameters that are filled in the placeholders
  * @param string $affectedUser Name of the user we are sending the activity to
  * @param string $type Type of notification
  * @param int $latestSendTime Activity time() + batch setting of $affectedUser
  * @return bool
  */
 public static function storeMail($app, $subject, array $subjectParams, $affectedUser, $type, $latestSendTime)
 {
     $timestamp = time();
     // store in DB
     $query = DB::prepare('INSERT INTO `*PREFIX*activity_mq` ' . ' (`amq_appid`, `amq_subject`, `amq_subjectparams`, `amq_affecteduser`, `amq_timestamp`, `amq_type`, `amq_latest_send`) ' . ' VALUES(?, ?, ?, ?, ?, ?, ?)');
     $query->execute(array($app, $subject, json_encode($subjectParams), $affectedUser, $timestamp, $type, $latestSendTime));
     // fire a hook so that other apps like notification systems can connect
     Util::emitHook('OC_Activity', 'post_email', array('app' => $app, 'subject' => $subject, 'subjectparams' => $subjectParams, 'affecteduser' => $affectedUser, 'timestamp' => $timestamp, 'type' => $type, 'latest_send' => $latestSendTime));
     return true;
 }
开发者ID:samj1912,项目名称:repo,代码行数:21,代码来源:data.php

示例15: all

 /**
  * @brief Returns the list of calendars for a specific user.
  * @param string $uid User ID
  * @param boolean $active Only return calendars with this $active state, default(=false) is don't care
  * @param boolean $bSubscribe  return calendars with this $issubscribe state, default(=true) is don't care
  * @return array
  */
 public function all($active = false, $bSubscribe = true)
 {
     $calendarDB = new CalendarDAO($this->db, $this->userId);
     $calendars = $calendarDB->all($active, $bSubscribe);
     $calendars = array_merge($calendars, $this->shareConnector->getItemsSharedWithCalendar());
     \OCP\Util::emitHook('OCA\\CalendarPlus', 'getCalendars', array('calendar' => &$calendars));
     return $calendars;
 }
开发者ID:sahne123,项目名称:calendarplus,代码行数:15,代码来源:calendarconnector.php


注:本文中的OCP\Util::emitHook方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。