} $pageTitle = $vbphrase['yrms_edit']; $messagetype = "info"; $message = $vbphrase['yrms_inputtip']; $inputData = $manga->getData(); //unset($inputData['vbphrase']); //unset($inputData['db']); //unset($inputData['vbulletin']); //print_pre($inputData); if (isPost()) { $inputData = getPost(); $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(); $messagetype = "success"; $message = construct_phrase($vbphrase['yrms_msg_success_general'], $vbphrase['yrms_edit'], $vbphrase['yrms_manga'], $manga->getMangaTitle()); $contenttemplatename = 'yrms_message'; } else { $messagetype = "error"; $message = nl2br(construct_phrase($vbphrase['yrms_msg_error_head'], $vbphrase['yrms_mangaadd']) . "\n" . $error); }
if (!$destforuminfo['cancontainthreads'] OR $destforuminfo['link']) { eval(standard_error(fetch_error('moveillegalforum'))); } // check destination forum permissions $forumperms = fetch_permissions($destforuminfo['forumid']); if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])) { print_no_permission(); } } else { // Validate destination thread $destthreadid = extract_threadid_from_url($vbulletin->GPC['mergethreadurl']); if (!$destthreadid) { // Invalid URL eval(standard_error(fetch_error('mergebadurl'))); } $destthreadid = verify_id('thread', $destthreadid); $destthreadinfo = fetch_threadinfo($destthreadid); $destforuminfo = fetch_foruminfo($destthreadinfo['forumid']); if (($destthreadinfo['isdeleted'] AND !can_moderate($destthreadinfo['forumid'], 'candeleteposts')) OR (!$destthreadinfo['visible'] AND !can_moderate($destthreadinfo['forumid'], 'canmoderateposts'))) { if (can_moderate($destthreadinfo['forumid'])) { print_no_permission();
function findInputError($inputData, $currentAction) { global $vbphrase, $manga; $error = ""; //check post url if ($currentAction == 'reward') { if (strpos($inputData['posturl'], "http://") === false && strpos($inputData['posturl'], "https://") === false) { $error .= construct_phrase($vbphrase['yrms_msg_error_invalidlink'], $vbphrase['yrms_posturl']) . "\n"; } else { $threadId = extract_threadid_from_url($inputData['posturl']); $threadInfo = fetch_threadinfo($threadId); if (!$threadInfo || $threadInfo['forumid'] != $manga->getForumId()) { $error .= construct_phrase($vbphrase['yrms_msg_error_postid'], $vbphrase['yrms_posturl'], $vbphrase['yrms_vietsubmanga']) . "\n"; } } } //check illustration if (strpos($inputData['illustration'], "http://") === false && strpos($inputData['illustration'], "https://") === false) { $error .= construct_phrase($vbphrase['yrms_msg_error_invalidlink'], $vbphrase['yrms_illustration']) . "\n"; } //check mangatitle if ($inputData['mangatitle'] == "") { $error .= construct_phrase($vbphrase['yrms_msg_error_blankfield'], $vbphrase['yrms_mangatitle']) . "\n"; } //check othername if ($inputData['othertitle'] != "") { $othertitles = explode(',', $inputData['othertitle']); foreach ($othertitles as $othertitle) { if ($othertitle == $inputData['mangatitle']) { $error .= construct_phrase($vbphrase['yrms_msg_error_othertitle'], $vbphrase['yrms_othertitle'], $vbphrase['yrms_mangatitle']) . "\n"; break; } } } //check author if ($inputData['author'] == '' && $currentAction == 'add') { $error .= construct_phrase($vbphrase['yrms_msg_error_blankfield'], $vbphrase['yrms_author']) . "\n"; } //check type if ($inputData['type'] == '') { $error .= construct_phrase($vbphrase['yrms_msg_error_blankselect'], $vbphrase['yrms_type']) . "\n"; } //check original composition if ($inputData['type'] == 3 && $inputData['originalcomposition'] == '') { $error .= construct_phrase($vbphrase['yrms_msg_error_blankfield'], $vbphrase['yrms_originalcomposition']) . "\n"; } //check genre if ($inputData['genre'] == '') { $error .= construct_phrase($vbphrase['yrms_msg_error_blankfield'], $vbphrase['yrms_genre']) . "\n"; } //check summary if ($inputData['summary'] == '') { $error .= construct_phrase($vbphrase['yrms_msg_error_blankfield'], $vbphrase['yrms_summary']) . "\n"; } return $error; }
public function buildpost($type) { global $vbulletin, $vbphrase; //set id if ($type == 'download') { $post['forumid'] = $vbulletin->options['yrms_vietsubmanga_id_truyendich']; $post['parentid'] = $this->manga->postid; $post['threadid'] = $this->manga->threadid; $post['postid'] = $this->postid; } else { if ($type == 'online') { $post['forumid'] = $vbulletin->options['yrms_vietsubmanga_id_doconline']; $post['threadid'] = extract_threadid_from_url(fetch_seo_url('post', fetch_postinfo($this->readonlinepostid))); $post['postid'] = $this->readonlinepostid; } } //title if ($this->manga->type == 2 && $this->type == 1) { $post['title'] = "{$this->manga->mangatitle}"; } else { $post['title'] = "{$this->manga->mangatitle} {$vbphrase["yrms_chaptertype{$this->type}"]} {$this->chapternumber}"; } if (!empty($this->chaptertitle)) { $post['title'] .= "- {$this->chaptertitle}"; } //other setting $post['allowsmilie'] = 1; $post['visible'] = 1; $post['parseurl'] = 1; if ($type == 'download') { if ($this->rate == 1) { $post['pagetext'] = construct_phrase($vbphrase['yrms_postformat_updatehide'], $post['title'], $vbphrase['yrms_fansub_note'] . ": " . $this->fansubnote, $this->build_linkformat()); } else { $post['pagetext'] = construct_phrase($vbphrase['yrms_postformat_update'], $post['title'], $vbphrase['yrms_fansub_note'] . ": " . $this->fansubnote); } } else { if ($type == 'online') { if ($this->rate == 1) { $post['pagetext'] = construct_phrase($vbphrase['yrms_postformat_readonlinehide'], $post['title'], $vbphrase['yrms_fansub_note'] . ": " . $this->fansubnote, $this->onlinelink); } else { $post['pagetext'] = construct_phrase($vbphrase['yrms_postformat_readonline'], $post['title'], $vbphrase['yrms_fansub_note'] . ": " . $this->fansubnote, $this->onlinelink); } } } return $post; }