本文整理汇总了PHP中OCP\Config::setUserValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::setUserValue方法的具体用法?PHP Config::setUserValue怎么用?PHP Config::setUserValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\Config
的用法示例。
在下文中一共展示了Config::setUserValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
/**
* @NoAdminRequired
*/
public function set()
{
\OCP\Config::setUserValue($this->api->getUserId(), 'tasks_enhanced', $this->params('type') . '_' . $this->params('setting'), $this->params('value'));
$response = new JSONResponse();
$response->setData();
return $response;
}
示例2: updateEmail
private function updateEmail($dn)
{
$email = null;
$emailAttribute = $this->connection->ldapEmailAttribute;
if (!empty($emailAttribute)) {
$aEmail = $this->readAttribute($dn, $emailAttribute);
if ($aEmail && count($aEmail) > 0) {
$email = $aEmail[0];
}
if (!is_null($email)) {
\OCP\Config::setUserValue($this->dn2username($dn), 'settings', 'email', $email);
}
}
}
示例3: set
/**
* @NoAdminRequired
*/
public function set()
{
$request = $this->request;
//$request = json_decode(file_get_contents('php://input'), true);
$key = $request->post['key'];
$value = $request->post['value'];
$response = new JSONResponse();
if (is_null($key) || $key === "") {
$response->bailOut(App::$l10n->t('No key is given.'));
}
if (is_null($value) || $value === "") {
$response->bailOut(App::$l10n->t('No value is given.'));
}
if (\OCP\Config::setUserValue(\OCP\User::getUser(), 'contacts', $key, $value)) {
$response->setParams(array('key' => $key, 'value' => $value));
return $response;
} else {
$response->bailOut(App::$l10n->t('Could not set preference: ' . $key . ':' . $value));
}
}
示例4: update_quota
private static function update_quota($uid, $quota)
{
if (!empty($quota)) {
\OCP\Config::setUserValue($uid, 'files', 'quota', \OCP\Util::computerFileSize($quota));
}
}
示例5: 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()));
示例6: setAddressbookList
/**
* @brief sets the list of ldap addressbooks in the preferences
* with the list given in parameter
* @param the new list
* @returns result|false
*/
protected function setAddressbookList(array $addressbookList)
{
$key = $this->name . "_list";
$data = json_encode($addressbookList);
return $data ? \OCP\Config::setUserValue($this->userid, 'contacts', $key, $data) : false;
}
示例7: disablefirstrun
/**
* @NoAdminRequired
*/
public function disablefirstrun()
{
\OCP\Config::setUserValue(\OCP\User::getUser(), 'firstpassmanrun', 'show', 0);
echo "Succes!";
}
示例8: setUserValue
/**
* Set a user defined value
*
* @param string $userId the userId of the user that we want to store the value under
* @param string $appName the appName that we want to store the value under
* @param string $key the key under which the value is being stored
* @param string $value the value that you want to store
*/
public function setUserValue($userId, $appName, $key, $value) {
\OCP\Config::setUserValue($userId, $appName, $key, $value);
}
示例9: while
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 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/>.
*
*/
\OCP\JSON::checkLoggedIn();
\OCP\JSON::checkAppEnabled('activity');
\OCP\JSON::callCheck();
$l = \OCP\Util::getL10N('activity');
$token = $tokenUrl = '';
if ($_POST['enable'] === 'true') {
// Check for collisions
$token = \OCP\Util::generateRandomBytes();
$preferences = new \OC\Preferences(\OC_DB::getConnection());
$conflicts = $preferences->getUsersForValue('activity', 'rsstoken', $token);
while (!empty($conflicts)) {
$token = \OCP\Util::generateRandomBytes();
$conflicts = $preferences->getUsersForValue('activity', 'rsstoken', $token);
}
$tokenUrl = \OC::$server->getURLGenerator()->getAbsoluteURL(\OC::$server->getURLGenerator()->linkToRoute('activity.rss', array('token' => $token)));
}
\OCP\Config::setUserValue(\OCP\User::getUser(), 'activity', 'rsstoken', $token);
\OCP\JSON::success(array('data' => array('message' => $l->t('Your settings have been updated.'), 'rsslink' => $tokenUrl)));
示例10: isset
<?php
/**
* ownCloud - Documents App
*
* @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
namespace OCA\Documents;
\OCP\JSON::callCheck();
\OCP\JSON::checkLoggedIn();
$l = \OC_L10N::get('documents');
$savePath = isset($_POST['savePath']) ? $_POST['savePath'] : null;
if (!is_null($savePath)) {
if (\OC\Files\Filesystem::file_exists($savePath) === false) {
if (!\OC\Files\Filesystem::mkdir($savePath)) {
\OCP\JSON::error(array('data' => array('message' => $l->t('An error occurred while changing directory.'))));
}
}
\OCP\Config::setUserValue(\OCP\User::getUser(), 'documents', 'save_path', $savePath);
\OCP\JSON::success(array('data' => array('message' => $l->t('Directory saved successfully.'))));
exit;
}
exit;
示例11: array
*
* This library 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 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/>.
*
*/
\OCP\JSON::checkLoggedIn();
\OCP\JSON::checkAppEnabled('activity');
\OCP\JSON::callCheck();
$notify_email = $notify_stream = array();
$l = \OCP\Util::getL10N('activity');
$data = new \OCA\Activity\Data(\OC::$server->getActivityManager());
$types = $data->getNotificationTypes($l);
foreach ($types as $type => $desc) {
\OCP\Config::setUserValue(\OCP\User::getUser(), 'activity', 'notify_email_' . $type, !empty($_POST[$type . '_email']));
\OCP\Config::setUserValue(\OCP\User::getUser(), 'activity', 'notify_stream_' . $type, !empty($_POST[$type . '_stream']));
}
$email_batch_time = 3600;
if ($_POST['notify_setting_batchtime'] == \OCA\Activity\UserSettings::EMAIL_SEND_DAILY) {
$email_batch_time = 3600 * 24;
}
if ($_POST['notify_setting_batchtime'] == \OCA\Activity\UserSettings::EMAIL_SEND_WEEKLY) {
$email_batch_time = 3600 * 24 * 7;
}
\OCP\Config::setUserValue(\OCP\User::getUser(), 'activity', 'notify_setting_batchtime', $email_batch_time);
\OCP\Config::setUserValue(\OCP\User::getUser(), 'activity', 'notify_setting_self', !empty($_POST['notify_setting_self']));
\OCP\JSON::success(array("data" => array("message" => $l->t('Your settings have been updated.'))));
示例12: put
/**
* store meta data for a file or folder
*
* @param string $file
* @param array $data
*
* @return int file id
*/
public function put($file, array $data)
{
if ($file === '' && isset($data['etag'])) {
return \OCP\Config::setUserValue(\OCP\User::getUser(), 'files_sharing', 'etag', $data['etag']);
} else {
if ($cache = $this->getSourceCache($file)) {
return $cache->put($this->files[$file], $data);
}
}
return false;
}
示例13: setCalendarActive
/**
* @brief Sets a calendar (in)active
* @param integer $id
* @param boolean $active
* @return boolean
*/
public static function setCalendarActive($id, $active)
{
$userid = \OCP\User::getUser();
$calendar = self::find($id);
if ($calendar['userid'] !== $userid) {
$sharedCalendar = \OCP\Share::getItemSharedWithBySource(App::SHARECALENDAR, App::SHARECALENDARPREFIX . $id);
if ($sharedCalendar) {
\OCP\Config::setUserValue($userid, App::$appname, 'calendar_' . $id, $active);
}
} else {
$dbObject = \OC::$server->getDb();
$calendarDB = new CalendarDAO($dbObject, $userid);
$bUpdateCalendar = $calendarDB->activate($active, $id);
return $bUpdateCalendar;
}
return true;
}
示例14: scanCategories
/**
* scan vcards for categories.
* @param $vccontacts VCards to scan. null to check all vcards for the current user.
*/
public static function scanCategories($vccontacts = null)
{
if (\OCP\Config::getUserValue(\OCP\User::getUser(), 'contacts', 'categories_scanned', 'no') === 'yes') {
return;
}
if (is_null($vccontacts)) {
$vcaddressbooks = Addressbook::all(\OCP\USER::getUser());
if (count($vcaddressbooks) > 0) {
$vcaddressbookids = array();
foreach ($vcaddressbooks as $vcaddressbook) {
if ($vcaddressbook['userid'] === \OCP\User::getUser()) {
$vcaddressbookids[] = $vcaddressbook['id'];
}
}
$start = 0;
$batchsize = 10;
$categories = new \OC_VCategories('contact');
while ($vccontacts = VCard::all($vcaddressbookids, $start, $batchsize)) {
$cards = array();
foreach ($vccontacts as $vccontact) {
$cards[] = array($vccontact['id'], $vccontact['carddata']);
}
\OCP\Util::writeLog('contacts', __CLASS__ . '::' . __METHOD__ . ', scanning: ' . $batchsize . ' starting from ' . $start, \OCP\Util::DEBUG);
// only reset on first batch.
$categories->rescan($cards, true, $start == 0 ? true : false);
$start += $batchsize;
}
}
}
\OCP\Config::setUserValue(\OCP\User::getUser(), 'contacts', 'categories_scanned', 'yes');
}
示例15: set
/**
* @brief set user config value
*
* @param string $key key for value to change
* @param string $value value to use
* @return bool success
*/
public static function set($key, $value)
{
return \OCP\Config::setUserValue(\OCP\User::getUser(), 'files_opds', $key, $value);
}