本文整理汇总了PHP中OC_Appconfig::deleteKey方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Appconfig::deleteKey方法的具体用法?PHP OC_Appconfig::deleteKey怎么用?PHP OC_Appconfig::deleteKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Appconfig
的用法示例。
在下文中一共展示了OC_Appconfig::deleteKey方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trim
if ($param === 'rcHost') {
if ($_POST[$param] == '' || strlen($_POST[$param]) > 3) {
OCP\Config::setAppValue('roundcube', $param, $_POST[$param]);
}
} 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 {
示例2: array
<?php
/**
* Copyright (c) 2011, Frank Karlitschek <karlitschek@kde.org>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/
OCP\User::checkAdminUser();
OCP\JSON::callCheck();
$sites = array();
for ($i = 0; $i < sizeof($_POST['site_name']); $i++) {
if (!empty($_POST['site_name'][$i]) && !empty($_POST['site_url'][$i])) {
array_push($sites, array(strip_tags($_POST['site_name'][$i]), strip_tags($_POST['site_url'][$i])));
}
}
if (sizeof($sites) == 0) {
OC_Appconfig::deleteKey('external', 'sites');
} else {
OCP\Config::setAppValue('external', 'sites', json_encode($sites));
}
echo 'true';
示例3: array
// This change is due the fact that an admin may not be expected
// to execute arbitrary code in every environment.
if ($app === 'core' && isset($_POST['key']) && (substr($_POST['key'], 0, 7) === 'remote_' || substr($_POST['key'], 0, 7) === 'public_')) {
OC_JSON::error(array('data' => array('message' => 'Unexpected error!')));
return;
}
$result = false;
switch ($action) {
case 'getValue':
$result = OC_Appconfig::getValue($app, $_GET['key'], $_GET['defaultValue']);
break;
case 'setValue':
$result = OC_Appconfig::setValue($app, $_POST['key'], $_POST['value']);
break;
case 'getApps':
$result = OC_Appconfig::getApps();
break;
case 'getKeys':
$result = OC_Appconfig::getKeys($app);
break;
case 'hasKey':
$result = OC_Appconfig::hasKey($app, $_GET['key']);
break;
case 'deleteKey':
$result = OC_Appconfig::deleteKey($app, $_POST['key']);
break;
case 'deleteApp':
$result = OC_Appconfig::deleteApp($app);
break;
}
OC_JSON::success(array('data' => $result));
示例4: delAssociation
/**
* Removes information about association identified by $handle
*
* @param string $handle assiciation handle
* @return bool
*/
public function delAssociation($handle)
{
$name = 'assoc_' . md5($handle);
OC_Appconfig::deleteKey('user_openid_provider', $name);
return true;
}
示例5: testDeleteKey
public function testDeleteKey()
{
\OC_Appconfig::deleteKey('testapp', 'deletethis');
$query = \OC_DB::prepare('SELECT `configvalue` FROM `*PREFIX*appconfig` WHERE `appid` = ? AND `configkey` = ?');
$query->execute(array('testapp', 'deletethis'));
$result = (bool) $query->fetchRow();
$this->assertFalse($result);
}
示例6: updateApp
/**
* update the database for the app and call the update script
*
* @param string $appId
* @return bool
*/
public static function updateApp($appId)
{
if (file_exists(self::getAppPath($appId) . '/appinfo/database.xml')) {
OC_DB::updateDbFromStructure(self::getAppPath($appId) . '/appinfo/database.xml');
}
unset(self::$appVersion[$appId]);
// run upgrade code
if (file_exists(self::getAppPath($appId) . '/appinfo/update.php')) {
self::loadApp($appId, false);
include self::getAppPath($appId) . '/appinfo/update.php';
}
//set remote/public handlers
$appData = self::getAppInfo($appId);
if (array_key_exists('ocsid', $appData)) {
OC_Appconfig::setValue($appId, 'ocsid', $appData['ocsid']);
} elseif (OC_Appconfig::getValue($appId, 'ocsid', null) !== null) {
OC_Appconfig::deleteKey($appId, 'ocsid');
}
foreach ($appData['remote'] as $name => $path) {
OCP\CONFIG::setAppValue('core', 'remote_' . $name, $appId . '/' . $path);
}
foreach ($appData['public'] as $name => $path) {
OCP\CONFIG::setAppValue('core', 'public_' . $name, $appId . '/' . $path);
}
self::setAppTypes($appId);
$version = \OC_App::getAppVersion($appId);
\OC_Appconfig::setValue($appId, 'installed_version', $version);
return true;
}
示例7: base64_encode
<?php
//from version 0.1 to 0.2
//ATTENTION
//Upgrade from ownCloud 3 (LDAP backend 0.1) to ownCloud 4.5 (LDAP backend 0.3) is not supported!!
//You must do upgrade to ownCloud 4.0 first!
//The upgrade stuff in the section from 0.1 to 0.2 is just to minimize the bad efffects.
//settings
$pw = OCP\Config::getAppValue('user_ldap', 'ldap_password');
if (!is_null($pw)) {
$pwEnc = base64_encode($pw);
OCP\Config::setAppValue('user_ldap', 'ldap_agent_password', $pwEnc);
OC_Appconfig::deleteKey('user_ldap', 'ldap_password');
}
//detect if we can switch on naming guidelines. We won't do it on conflicts.
//it's a bit spaghetti, but hey.
$state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'unset');
if ($state == 'unset') {
OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
}
// ### SUPPORTED upgrade path starts here ###
//from version 0.2 to 0.3 (0.2.0.x dev version)
$objects = array('user', 'group');
$connector = new \OCA\user_ldap\lib\Connection('user_ldap');
$userBE = new \OCA\user_ldap\USER_LDAP();
$userBE->setConnector($connector);
$groupBE = new \OCA\user_ldap\GROUP_LDAP();
$groupBE->setConnector($connector);
foreach ($objects as $object) {
$fetchDNSql = 'SELECT `ldap_dn`, `owncloud_name` FROM `*PREFIX*ldap_' . $object . '_mapping` WHERE `directory_uuid` = ""';
$updateSql = 'UPDATE `*PREFIX*ldap_' . $object . '_mapping` SET `ldap_DN` = ?, `directory_uuid` = ? WHERE `ldap_dn` = ?';
示例8: testShareItemWithLinkAndDefaultExpireDate
public function testShareItemWithLinkAndDefaultExpireDate()
{
OC_User::setUserId($this->user1);
\OC_Appconfig::setValue('core', 'shareapi_default_expire_date', 'yes');
\OC_Appconfig::setValue('core', 'shareapi_expire_after_n_days', '2');
$token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
$this->assertInternalType('string', $token, 'Failed asserting that user 1 successfully shared text.txt as link with token.');
// share should have default expire date
$row = $this->getShareByValidToken($token);
$this->assertNotEmpty($row['expiration'], 'Failed asserting that the returned row has an default expiration date.');
\OC_Appconfig::deleteKey('core', 'shareapi_default_expire_date');
\OC_Appconfig::deleteKey('core', 'shareapi_expire_after_n_days');
}
示例9: deleteAppValue
/**
* Delete an app wide defined value
*
* @param string $appName the appName that we stored the value under
* @param string $key the key of the value, under which it was saved
*/
public function deleteAppValue($appName, $key)
{
\OC_Appconfig::deleteKey($appName, $key);
}
示例10: testClearExpireDateWhileEnforced
/**
* Ensure that we do not allow removing a an expiration date from a link share if this
* is enforced by the settings.
*/
public function testClearExpireDateWhileEnforced()
{
OC_User::setUserId($this->user1);
\OC_Appconfig::setValue('core', 'shareapi_default_expire_date', 'yes');
\OC_Appconfig::setValue('core', 'shareapi_expire_after_n_days', '2');
\OC_Appconfig::setValue('core', 'shareapi_enforce_expire_date', 'yes');
$token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
$this->assertInternalType('string', $token, 'Failed asserting that user 1 successfully shared text.txt as link with token.');
$setExpireDateFailed = false;
try {
$this->assertTrue(OCP\Share::setExpirationDate('test', 'test.txt', '', ''), 'Failed asserting that user 1 successfully set an expiration date for the test.txt share.');
} catch (\Exception $e) {
$setExpireDateFailed = true;
}
$this->assertTrue($setExpireDateFailed);
\OC_Appconfig::deleteKey('core', 'shareapi_default_expire_date');
\OC_Appconfig::deleteKey('core', 'shareapi_expire_after_n_days');
\OC_Appconfig::deleteKey('core', 'shareapi_enforce_expire_date');
}