本文整理汇总了PHP中JSON::Warning方法的典型用法代码示例。如果您正苦于以下问题:PHP JSON::Warning方法的具体用法?PHP JSON::Warning怎么用?PHP JSON::Warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSON
的用法示例。
在下文中一共展示了JSON::Warning方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _xChangeLogin
function _xChangeLogin()
{
$v =& Validator::Get();
list($username, $password) = explode('|', file_first_line(FILE_CP_USER));
$v->Register($_REQUEST['username'], VT_NOT_EMPTY, 'The Username field is required');
$v->Register($_REQUEST['password'], VT_NOT_EMPTY, 'The Password field is required');
$v->Register(sha1($_REQUEST['old_password']), VT_EQUALS, 'The Old Password is invalid', $password);
$v->Register($_REQUEST['username'] . $_REQUEST['password'], VT_NOT_CONTAINS, 'The | character is not allowed in your username or password', '|');
$v->Register(FILE_CP_USER, VT_FILE_IS_WRITEABLE, 'The ' . FILE_CP_USER . ' file has incorrect permissions; change them to 666');
if (!$v->Validate()) {
return JSON::Warning(array(JSON_KEY_MESSAGE => 'Login information could not be updated; please fix the following items', JSON_KEY_WARNINGS => $v->GetErrors()));
}
file_write(FILE_CP_USER, $_REQUEST['username'] . '|' . sha1($_REQUEST['password']));
JSON::Success(array(JSON_KEY_MESSAGE => 'Control panel login has been successfully updated', JSON_KEY_DIALOG => _xIncludeCapture('change-login.php')));
}