Exemplo n.º 1
0
/**
 * Updates the like value for a post/member combo if there are no problems with
 * the request, such as being a narcissist
 *
 * @package Likes
 * @param int $id_liker - user_id of the liker/disliker
 * @param mixed[] $liked_message - message array that is being worked on
 * @param string $direction - + for like - for unlike a previous liked one
 */
function likePost($id_liker, $liked_message, $direction)
{
    global $txt, $modSettings;
    // If we have a message, then we have passed all checks ...
    if (!empty($liked_message)) {
        // You can't like your own stuff, no matter how brilliant you think you are
        if ($liked_message['id_member'] == $id_liker && empty($modSettings['likeAllowSelf'])) {
            return $txt['cant_like_yourself'];
        } else {
            updateLike($id_liker, $liked_message, $direction);
            return true;
        }
    }
}
Exemplo n.º 2
0
        if (C::t('count')->update_viewnum_by_type($id, $type)) {
            dsetcookie('view_' . $type . '_' . $id, 1, 86400);
        }
    }
    exit;
} elseif ($_GET['do'] == 'updateAppView') {
    $appid = intval($_GET['appid']);
    C::t('app_user')->update_lasttime($_G['uid'], $appid, $_G['timestamp']);
    exit;
} elseif ($_GET['do'] == 'updatelike') {
    if (!$_G['uid']) {
        exit;
    }
    $icoid = intval($_GET['icoid']);
    $val = intval($_GET['val']);
    updateLike($icoid, $val);
    exit;
} elseif ($do == 'newdoc' || $do == 'newtxt') {
    $path = $_GET['path'];
    if (!submitcheck('newdocsubmit')) {
        if ($do == 'newdoc') {
            $ext = 'dzzdoc';
        } else {
            $ext = 'txt';
        }
        $name = lang('message', 'new_' . $ext);
    } else {
        $filename = $_GET['filename'] . '.' . $_GET['ext'];
        if ($arr = IO::upload_by_content(' ', $path, $filename)) {
            if ($arr['error']) {
                showmessage($arr['error']);