Ejemplo n.º 1
0
        if ($inputData['posturl']) {
            $threadId = extract_threadid_from_url($inputData['posturl']);
            $threadInfo = fetch_threadinfo($threadId);
            if ($threadInfo['forumid'] == $manga->getForumId()) {
                $manga->setThreadId($threadInfo['threadid'])->setPostId($threadInfo['firstpostid'])->setPosterId($threadInfo['postuserid']);
            } elseif ($threadInfo['forumid'] == $manga->getOnlineForumId()) {
                $manga->setPosterId($threadInfo['postuserid']);
            }
        }
        $manga->save();
        $messagetype = "success";
        switch ($currentAction) {
            case 'add':
                $posterId = $manga->getPosterId();
                $posterInfo = fetch_userinfo($posterId);
                $message = construct_phrase($vbphrase['yrms_msg_success_newmanga'], $posterInfo['username'], $manga->getMangaTitle(), $vbulletin->options['yrms_vietsubmanga_yun_newproject'], $manga->getMangaId());
                break;
            case 'edit':
                $message = construct_phrase($vbphrase['yrms_msg_success_general'], $vbphrase['yrms_edit'], $vbphrase['yrms_manga'], $manga->getMangaTitle());
                break;
            case 'reward':
                $message = construct_phrase($vbphrase['yrms_msg_success_general'], $vbphrase['yrms_reward'], $vbphrase['yrms_manga'], $manga->getMangaTitle());
                break;
        }
        $contenttemplatename = 'yrms_message';
    } else {
        $messagetype = "error";
        $message = nl2br(construct_phrase($vbphrase['yrms_msg_error_head'], $vbphrase['yrms_mangaadd']) . "\n" . $error);
    }
}
if (!isset($contenttemplatename)) {
Ejemplo n.º 2
0
    $error = findInputError($inputData);
    if (!$error) {
        $manga->setData($inputData);
        if ($inputData['posturl']) {
            $threadId = extract_threadid_from_url($inputData['posturl']);
            $threadInfo = fetch_threadinfo($threadId);
            if ($threadInfo['forumid'] == $manga->getForumId()) {
                $manga->setThreadId($threadInfo['threadid'])->setPostId($threadInfo['firstpostid'])->setPosterId($threadInfo['postuserid']);
            } elseif ($threadInfo['forumid'] == $manga->getOnlineForumId()) {
                $manga->setPosterId($threadInfo['postuserid']);
            }
        }
        $manga->save();
        $posterId = $manga->getPosterId();
        $award = new Award();
        $award->setPostId($manga->getPostId())->setAwardContent(array("{$posterId}" => $vbulletin->options['yrms_vietsubmanga_yun_newproject']))->setResourceType(Manga::RESOURCE_TYPE)->setResourceId($manga->getMangaId())->save();
        $messagetype = "success";
        $posterInfo = fetch_userinfo($posterId);
        $message = construct_phrase($vbphrase['yrms_msg_success_newmanga'], $posterInfo['username'], $manga->getMangaTitle(), $vbulletin->options['yrms_vietsubmanga_yun_newproject'], $manga->getMangaId());
        $contenttemplatename = 'yrms_message';
    } else {
        $messagetype = "error";
        $message = nl2br(construct_phrase($vbphrase['yrms_msg_error_head'], $vbphrase['yrms_mangaadd']) . "\n" . $error);
    }
}
if (!isset($contenttemplatename)) {
    $contenttemplatename = 'yrms_vietsubmanga_manga_save';
}
if ($inputData['fansubname'] == '') {
    $inputData['fansubname'] = "Yurivn";
}