本文整理汇总了PHP中app\Posts::validateReservedAt方法的典型用法代码示例。如果您正苦于以下问题:PHP Posts::validateReservedAt方法的具体用法?PHP Posts::validateReservedAt怎么用?PHP Posts::validateReservedAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Posts
的用法示例。
在下文中一共展示了Posts::validateReservedAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
if (Permission::sufficient('developer')) {
$reserve_as = Posts::validatePostAs();
if (isset($reserve_as)) {
$User = Users::get($reserve_as, 'name');
if (empty($User)) {
Response::fail('User does not exist');
}
if (!Permission::sufficient('member', $User->role) && !isset($_POST['screwit'])) {
Response::fail('User does not have permission to reserve posts, continue anyway?', array('retry' => true));
}
$update['reserved_by'] = $User->id;
}
}
$update['reserved_at'] = date('c');
if (Permission::sufficient('developer')) {
$reserved_at = Posts::validateReservedAt();
if (isset($reserved_at)) {
$update['reserved_at'] = date('c', $reserved_at);
}
}
}
if (empty($update) || !$Database->where('id', $Post->id)->update("{$type}s", $update)) {
Response::fail('Nothing has been changed<br>If you tried to do something, then this is actually an error, which you should <a class="send-feedback">tell us</a> about.');
}
if (!empty($overdue)) {
Logs::action('res_overtake', array_merge(array('id' => $Post->id, 'type' => $type), $overdue));
}
if (!empty($update['reserved_by'])) {
Posts::clearTransferAttempts($Post, $type, 'snatch');
} else {
if (!empty($Post->reserved_by)) {