|
|
@ -237,13 +237,37 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false) |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ($magnetCommentId = $db->addMagnetComment($magnet->magnetId, |
|
|
|
if ($magnetCommentId = $db->addMagnetComment($magnet->magnetId, |
|
|
|
$user->userId, |
|
|
|
$user->userId, |
|
|
|
null, // @TODO implement threads |
|
|
|
null, // @TODO implement threads |
|
|
|
trim($_POST['comment']), |
|
|
|
trim($_POST['comment']), |
|
|
|
$user->approved || in_array($user->address, MODERATOR_IP_LIST) ? true : MAGNET_COMMENT_DEFAULT_APPROVED, |
|
|
|
$user->approved || in_array($user->address, MODERATOR_IP_LIST) ? true : MAGNET_COMMENT_DEFAULT_APPROVED, |
|
|
|
MAGNET_COMMENT_DEFAULT_PUBLIC, |
|
|
|
MAGNET_COMMENT_DEFAULT_PUBLIC, |
|
|
|
time())) |
|
|
|
time())) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Push event to other nodes |
|
|
|
|
|
|
|
if (API_EXPORT_ENABLED && |
|
|
|
|
|
|
|
API_EXPORT_PUSH_ENABLED && |
|
|
|
|
|
|
|
API_EXPORT_USERS_ENABLED && |
|
|
|
|
|
|
|
API_EXPORT_MAGNETS_ENABLED && |
|
|
|
|
|
|
|
API_EXPORT_MAGNET_COMMENTS_ENABLED) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!$memoryApiExportPush = $memory->get('api.export.push')) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$memoryApiExportPush = []; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$memoryApiExportPush[] = (object) |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'time' => time(), |
|
|
|
|
|
|
|
'userId' => $user->userId, |
|
|
|
|
|
|
|
'magnetId' => $magnet->magnetId, |
|
|
|
|
|
|
|
'magnetCommentId' => $magnetCommentId |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$memory->set('api.export.push', $memoryApiExportPush, 3600); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Redirect to referrer page |
|
|
|
// Redirect to referrer page |
|
|
|
header( |
|
|
|
header( |
|
|
|
sprintf('Location: %s#comment-%s', $callback, $magnetCommentId) |
|
|
|
sprintf('Location: %s#comment-%s', $callback, $magnetCommentId) |
|
|
@ -328,18 +352,40 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false) |
|
|
|
// Request valid |
|
|
|
// Request valid |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Save value |
|
|
|
// Save star |
|
|
|
$db->addMagnetStar( |
|
|
|
if ($magnetStarId = $db->addMagnetStar( $magnet->magnetId, |
|
|
|
$magnet->magnetId, |
|
|
|
$user->userId, |
|
|
|
$userId, |
|
|
|
!$db->findLastMagnetStarValue($magnet->magnetId, $user->userId), |
|
|
|
!$db->findLastMagnetStarValue($magnet->magnetId, $userId), |
|
|
|
time())) |
|
|
|
time() |
|
|
|
{ |
|
|
|
); |
|
|
|
// Push event to other nodes |
|
|
|
|
|
|
|
if (API_EXPORT_ENABLED && |
|
|
|
|
|
|
|
API_EXPORT_PUSH_ENABLED && |
|
|
|
|
|
|
|
API_EXPORT_USERS_ENABLED && |
|
|
|
|
|
|
|
API_EXPORT_MAGNETS_ENABLED && |
|
|
|
|
|
|
|
API_EXPORT_MAGNET_STARS_ENABLED) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!$memoryApiExportPush = $memory->get('api.export.push')) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$memoryApiExportPush = []; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Redirect to edit page |
|
|
|
$memoryApiExportPush[] = (object) |
|
|
|
header( |
|
|
|
[ |
|
|
|
sprintf('Location: %s', $callback) |
|
|
|
'time' => time(), |
|
|
|
); |
|
|
|
'userId' => $user->userId, |
|
|
|
|
|
|
|
'magnetId' => $magnet->magnetId, |
|
|
|
|
|
|
|
'magnetStarId' => $magnetStarId |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$memory->set('api.export.push', $memoryApiExportPush, 3600); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Redirect to edit page |
|
|
|
|
|
|
|
header( |
|
|
|
|
|
|
|
sprintf('Location: %s', $callback) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|