Server : Apache System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : palandch ( 1163) PHP Version : 7.1.33 Disable Function : NONE Directory : /home/palandch/www/core/model/modx/processors/security/user/setting/ |
<?php /** * Updates a setting from a grid * * @param integer $user The user to create the setting for * @param string $key The setting key * @param string $value The setting value * * @package modx * @subpackage processors.security.user.setting */ if (!$modx->hasPermission(array('save_user' => true, 'settings' => true))) { return $modx->error->failure($modx->lexicon('permission_denied')); } $modx->lexicon->load('setting'); $_DATA = $modx->fromJSON($scriptProperties['data']); /* get setting */ if (empty($_DATA['user'])) return $modx->error->failure($modx->lexicon('user_err_ns')); if (empty($_DATA['key'])) return $modx->error->failure($modx->lexicon('setting_err_ns')); $setting = $modx->getObject('modUserSetting',array( 'key' => $_DATA['key'], 'user' => $_DATA['user'], )); if (empty($setting)) return $modx->error->failure($modx->lexicon('setting_err_nf')); $setting->set('key',$_DATA['key']); $setting->fromArray($_DATA); /* save setting */ if ($setting->save() == false) { return $modx->error->failure($modx->lexicon('setting_err_save')); } $modx->reloadConfig(); return $modx->error->success();