本文整理汇总了PHP中DatabaseManager::insertOrUpdateValue方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseManager::insertOrUpdateValue方法的具体用法?PHP DatabaseManager::insertOrUpdateValue怎么用?PHP DatabaseManager::insertOrUpdateValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager::insertOrUpdateValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setSimpleStorage
function setSimpleStorage($name, $value, $device = TRUE, $timestamp = FALSE)
{
global $loginManager;
$databaseManager = new DatabaseManager();
$databaseManager->openTable("plugin_settings", DatabaseManager::$table8);
$pluginId = $this->getPluginName();
$authtoken = $loginManager->getAuthtoken();
$insert = array("name" => array("value" => $name), "value" => array("value" => $value), "plugin" => array("value" => $pluginId));
if ($timestamp) {
$insert["timestamp"] = array("value" => time());
} else {
$insert["timestamp"] = array("value" => "");
}
if ($device) {
$insert["authtoken"] = array("value" => $authtoken);
}
$where = array("name" => array("value" => $name), "plugin" => array("value" => $pluginId));
if ($device) {
$where["authtoken"] = array("value" => $authtoken);
}
$databaseManager->insertOrUpdateValue($insert, $where);
}
示例2: setUserPreference
function setUserPreference($name, $value)
{
if (is_string($name)) {
$databasePreferences = new DatabaseManager();
$json = json_decode(DatabaseManager::$table6);
$databasePreferences->openTable("user_preferences", $json);
$result = $databasePreferences->insertOrUpdateValue(array("value" => array("value" => $value, "type" => "s")), array("name" => array("value" => $name, "type" => "s", "operator" => "=")));
}
}
示例3: setPermission
function setPermission($pUserid, $pPermission, $pBool, $autosync = TRUE)
{
global $loginManager;
if (!$loginManager->isAllowed(LoginManager::MODIFY_USERS)) {
die('[{"type":"heading","value":' . json_encode('Sie dürfen diese Aktion nicht ausführen, da die Rechte welche sie besitzen für diese Aktion nicht ausreichen. Bitte wenden sie sich an den Administrator.') . '}]');
}
$pInput = 0;
if ($pBool) {
$pInput = 1;
}
$database = new DatabaseManager();
if ($pPermission == LoginManager::STOP_SERVER || $pPermission == LoginManager::MODIFY_USERS || $pPermission == LoginManager::FILE_ACCESS || $pPermission == LoginManager::LOG_ACCESS || $pPermission == LoginManager::SERVER_NOTIFY || $pPermission == LoginManager::START_SERVER || $pPermission == LoginManager::SERVER_CONFIG) {
$json = json_decode(DatabaseManager::$table3);
$database->openTable("user_permissions", $json);
if ($pPermission == LoginManager::STOP_SERVER) {
if ($database->setValue(array("stop_server" => array("value" => $pInput, "type" => "i")), array("userid" => array("value" => $pUserid, "type" => "i")))) {
return true;
}
} else {
if ($pPermission == LoginManager::MODIFY_USERS) {
if ($database->setValue(array("modify_users" => array("value" => $pInput)), array("userid" => array("value" => $pUserid)))) {
return true;
}
} else {
if ($pPermission == LoginManager::FILE_ACCESS) {
if ($database->setValue(array("access_files" => array("value" => $pInput, "type" => "i")), array("userid" => array("value" => $pUserid, "type" => "i")))) {
return true;
}
} else {
if ($pPermission == LoginManager::LOG_ACCESS) {
if ($database->setValue(array("log_access" => array("value" => $pInput, "type" => "i")), array("userid" => array("value" => $pUserid, "type" => "i")))) {
return true;
}
} else {
if ($pPermission == LoginManager::SERVER_NOTIFY) {
if ($database->setValue(array("server_notify" => array("value" => $pInput, "type" => "i")), array("userid" => array("value" => $pUserid, "type" => "i")))) {
return true;
}
} else {
if ($pPermission == LoginManager::START_SERVER) {
if ($database->setValue(array("start_server" => array("value" => $pInput, "type" => "i")), array("userid" => array("value" => $pUserid, "type" => "i")))) {
return true;
}
} else {
if ($pPermission == LoginManager::SERVER_CONFIG) {
if ($database->setValue(array("server_config" => array("value" => $pInput, "type" => "i")), array("userid" => array("value" => $pUserid, "type" => "i")))) {
return true;
}
}
}
}
}
}
}
}
if ($autosync) {
sync(USER_PERMISSIONS);
}
} else {
if (!empty($pPermission)) {
$json = DatabaseManager::$table4;
$json = json_decode($json);
$database->openTable("custom_user_permissions", $json);
if ($database->insertOrUpdateValue(array("value" => array("value" => $pInput, "type" => "i")), array("user" => array("value" => $pUserid, "type" => "i"), "permission_name" => array("value" => $pPermission, "type" => "s")))) {
return true;
}
}
}
return false;
}