function AddPictureComment()
{
    global $txt, $context, $smcFunc, $sourcedir, $scripturl, $modSettings, $language;
    $memID = $context['member']['id'];
    // Guests are not allowed to comment.
    is_not_guest();
    if (empty($_POST['comment'])) {
        fatal_error($txt['Maximum_comment_field'], false);
    }
    // Integration with AEVA mod (Thanks Nao 尚 ;))
    if (isset($modSettings['aeva_enable']) && file_exists($sourcedir . '/Subs-Aeva.php')) {
        @(include_once $sourcedir . '/Subs-Aeva.php');
        if (function_exists('aeva_onposting')) {
            $_POST['comment'] = aeva_onposting($_POST['comment']);
        }
    }
    checkSession('post');
    // Only buddies can post comments?
    if (isset($context['member']['options']['comments_budd_only']) && $context['member']['options']['comments_budd_only'] == 1) {
        if (!is_buddy($memID, $context['user']['id']) && !allowedTo('edit_Maximum_Maximum_any')) {
            fatal_error($txt['Maximum_comments_buddies_only'], false);
        }
    }
    $request = $smcFunc['db_insert']('normal', '{db_prefix}picture_comments', array('id_member' => 'int', 'comment' => 'text', 'time' => 'int', 'comment_picture_id' => 'int'), array('id_member' => $context['user']['id'], 'title' => htmlspecialchars($_POST['comment']), 'time' => time(), 'comment_picture_id' => (int) $_GET['comment']), array('id_comment'));
    // Should we notify the user?
    if (@$context['member']['options']['comments_notif_disable'] != 1 && $context['user']['id'] != $memID) {
        $request = $smcFunc['db_query']('', '
			SELECT lngfile 
			FROM {db_prefix}members 
			WHERE id_member = {int:id_member}', array('id_member' => $memID));
        list($user_language) = $smcFunc['db_fetch_row']($request);
        loadLanguage('Maximumprofile', empty($user_language) || empty($modSettings['userLanguage']) ? $language : $user_language, false);
        require_once $sourcedir . '/Subs-Post.php';
        sendpm(array('to' => array($memID), 'bcc' => array()), sprintf($txt['Maximum_notif_piccom_subject'], $context['user']['name']), sprintf($txt['Maximum_notif_piccom_body'], $context['user']['name'], $scripturl . '?action=profile;area=pictures;view=' . (int) $_GET['comment']), false, array('id' => 0, 'name' => $txt['Maximum_notif_com_user'], 'username' => $txt['Maximum_notif_com_user']));
    }
    redirectexit('action=profile;area=pictures;u=' . $memID . ';view=' . (int) $_GET['comment']);
}
Esempio n. 2
0
function remove_buddy_from_list()
{
    global $uid;
    global $fuid;
    if (is_buddy($uid, $fuid)) {
        del_buddy($uid, $fuid);
        del_buddy($fuid, $uid);
        del_buddy_invite($fuid, $uid);
        send_ticker_from_to($uid, $fuid, "w", "removed you from his/her buddylist");
    } else {
        echo "<center>User's not your buddy!</center>";
    }
}