public function vxPostCreate() { if ($this->User->vxIsLogin()) { if (isset($_GET['topic_id'])) { $topic_id = intval($_GET['topic_id']); if ($this->Validator->vxExistTopic($topic_id)) { $rt = $this->Validator->vxPostCreateMobileCheck($topic_id, $this->User); if ($rt['errors'] == 0) { $this->Validator->vxPostCreateInsert($rt['topic_id'], $this->User->usr_id, '', $rt['reply_value'], $rt['exp_amount']); $Topic = new Topic($rt['topic_id'], $this->db); $Topic->vxTouch(); $Topic->vxUpdatePosts(); $this->URL->vxToRedirect($this->URL->vxGetTopicViewMobile($topic_id, $_SESSION['babel_page_topic_last_mobile'])); } else { $Topic = new Topic($rt['topic_id'], $this->db); $Node = new Node($Topic->tpc_pid, $this->db); $Section = $Node->vxGetNodeInfo($Node->nod_pid); $this->vxHeader(make_plaintext($Topic->tpc_title) . ' - 回复出错'); $this->vxBodyStart(); $this->vxH1(); echo '<div class="content"><small><a href="/' . $_SESSION['babel_page_home_mobile'] . '">V2EX</a> > ' . make_plaintext($Section->nod_title) . ' > ' . make_plaintext($Node->nod_title) . ' > <a href="/t/' . $Topic->tpc_id . '/' . $_SESSION['babel_page_topic_mobile'] . '">' . make_plaintext($Topic->tpc_title) . '</a> > 回复出错</small></div>'; echo '<div class="content"><form action="/post/create/mobile/' . $Topic->tpc_id . '.vx" method="post"><small class="error">' . $rt['reply_error_msg'][$rt['reply_error']] . '</small><br /><textarea name="reply" class="textbox" cols="30" rows="4" maxlength="1000">' . make_multi_return($rt['reply_value']) . '</textarea><br /><input type="submit" value="回 复" class="go" /> <input type="button" value="取 消" class="go" onclick="location.href=' . "'/t/{$Topic->tpc_id}/{$_SESSION['babel_page_topic_mobile']}';" . '" /></form></div>'; $this->vxBottom(); $this->vxBodyEnd(); $this->vxHTMLEnd(); } } else { $this->URL->vxToRedirect($this->vxURL->vxGetHome()); } } else { $this->URL->vxToRedirect($this->vxURL->vxGetHome()); } } else { if (isset($_GET['topic_id'])) { $topic_id = intval($_GET['topic_id']); $this->URL->vxToRedirect($this->URL->vxGetLogin($this->URL->vxGetTopicViewMoblie($topic_id))); } else { $this->URL->vxToRedirect($this->URL->vxGetLogin($this->URL->vxGetHome())); } } }
} } if ($rt['out_of_money']) { $p->vxHead($msgSiteTitle = Vocabulary::term_out_of_money); $p->vxBodyStart(); $p->vxTop(); $p->vxContainer('out_of_money'); } else { if ($rt['errors'] == 0) { $p->Validator->vxPostCreateInsert($rt['topic_id'], $p->User->usr_id, $rt['pst_title_value'], $rt['pst_content_value'], $rt['exp_amount']); if (!isset($_SESSION['babel_page_topic'])) { $_SESSION['babel_page_topic'] = 1; } // $p->vxHead($msgSiteTitle = Vocabulary::action_replytopic, $return = '/topic/view/' . $topic_id . '/' . $_SESSION['babel_page_topic'] . '.html'); $Topic->vxTouch(); $Topic->vxUpdatePosts(); $_pst_content_plain = htmlspecialchars_decode(strip_tags(format_ubb($rt['pst_content_value']))); // Start: Send a mail to topic owner if ($Topic->usr_sw_notify_reply == 1 && $Topic->tpc_uid != $p->User->usr_id) { $mail = array(); $mail['subject'] = '[' . Vocabulary::site_name . ' 新回复] - ' . make_plaintext($Topic->tpc_title); $mail['body'] = "{$Topic->usr_nick},你好!\n\n你发表在 " . Vocabulary::site_name . " 的讨论主题 [ {$Topic->tpc_title} ] 被会员 {$p->User->usr_nick} 在北京时间 " . date('Y-n-j G:i:s', time()) . " 回复了,因此我们发送此邮件给你。\n\n-----------------------------------------------\n" . $_pst_content_plain . "\n-----------------------------------------------\n\n你可以点击下面的地址查看这篇新回复。\n\nhttp://" . BABEL_DNS_NAME . $p->URL->vxGetTopicView($rt['topic_id'], $_SESSION['babel_page_topic']) . "\n\n如果你不想再收到此类邮件,你可以在个人设置中关闭 [ 邮件通知自己的主题的新回复 ] 功能。" . BABEL_AM_SIGNATURE; if ($Topic->usr_email_notify != '') { $_receiver = $Topic->usr_email_notify; } else { $_receiver = $Topic->usr_email; } $am = new Airmail($_receiver, $mail['subject'], $mail['body'], $p->db); $am->vxSend(); $am = null; if (BABEL_DEBUG) {
public function vxPostCreate($rt) { $Topic = new Topic($rt['topic_id'], $this->db); $Node = new Node($Topic->tpc_pid, $this->db); $Section = $Node->vxGetNodeInfo($Node->nod_sid); echo '<div id="main">'; echo '<div class="blank" align="left">'; _v_ico_map(); echo ' <a href="/">' . Vocabulary::site_name . '</a> > <a href="/section/view/' . $Section->nod_id . '.html" target="_self">' . $Section->nod_title . '</a> > <a href="/board/view/' . $Node->nod_id . '.html">' . $Node->nod_title . '</a> > <a href="/topic/view/' . $Topic->tpc_id . '.html">' . make_plaintext($Topic->tpc_title) . '</a> > ' . Vocabulary::action_replytopic . '</div>'; if ($rt['errors'] > 0) { echo '<div class="blank" align="left">'; _v_ico_silk('exclamation'); echo ' ' . Vocabulary::msg_submitwrong; _v_hr(); if ($rt['autistic']) { echo '<div class="notify">你正在回复的主题位于自闭模式的讨论区中,你只能回复自闭模式的讨论区中你自己创建的主题。</div>'; } echo '<table cellpadding="5" cellspacing="0" border="0" class="form">'; echo '<form action="/post/create/' . $Topic->tpc_id . '.vx" method="post" id="form_post_create">'; if ($rt['pst_title_error'] > 0) { echo '<tr><td width="100" align="right">回复标题</td><td width="400" align="left"><div class="error" style="width: 308px;"><input type="text" class="sll" name="pst_title" value="' . make_single_return($rt['pst_title_value']) . '" /><br />'; _v_ico_silk('exclamation'); echo ' ' . $rt['pst_title_error_msg'][$rt['pst_title_error']] . '</div></td></tr>'; } else { echo '<tr><td width="100" align="right">回复标题</td><td width="400" align="left"><input type="text" class="sll" name="pst_title" value="' . make_single_return($rt['pst_title_value']) . '" /></td></tr>'; } if ($rt['pst_content_error'] > 0) { echo '<tr><td width="100" align="right" valign="top">回复内容</td><td width="400" align="left"><div class="error"><textarea rows="15" class="ml" name="pst_content">' . $rt['pst_content_value'] . '</textarea><br />'; _v_ico_silk('exclamation'); echo ' ' . make_multi_return($rt['pst_content_error_msg'][$rt['pst_content_error']]) . '</div></td></tr>'; } else { echo '<tr><td width="100" align="right" valign="top">回复内容</td><td width="400" align="left"><textarea rows="15" class="ml" name="pst_content">' . make_multi_return($rt['pst_content_value']) . '</textarea></td></tr>'; } echo '<td width="500" colspan="3" valign="middle" align="right"><span class="tip">'; _v_btn_f('立即回复', 'form_post_create'); echo '</span></td></tr>'; echo '</form>'; echo '</table>'; _v_hr(); echo '<span class="tip"><img src="/img/pico_left.gif" align="absmiddle" /> <a href="/topic/view/' . $Topic->tpc_id . '.html">返回主题 / ' . make_plaintext($Topic->tpc_title) . '</a></span>'; echo '</div>'; } else { $usr_money_a = $this->User->vxParseMoney(abs($rt['exp_amount'])); $Topic->vxTouch(); $Topic->vxUpdatePosts(); echo '<div class="blank"><span class="text_large"><img src="/img/ico_smile.gif" align="absmiddle" class="home" />主题回复成功</span><br />你已经成功回复了一篇主题,<strong>回复该主题花费了' . $usr_money_a['str'] . '</strong>,将在 3 秒内自动返回到主题<br /><br /><img src="/img/pico_right.gif" align="absmiddle" /> <a href="/topic/view/' . $Topic->tpc_id . '/' . $rt['p_cur'] . '.html" target="_self">转到刚才回复的主题 / ' . make_plaintext($Topic->tpc_title) . '</a><br /><br />'; echo '<img src="/img/pico_right.gif" align="absmiddle" /> <a href="/go/' . $Node->nod_name . '">转到主题所在讨论区 / ' . make_plaintext($Node->nod_title) . '</a><br /><br />'; echo '<img src="/img/pico_right.gif" align="absmiddle" /> <a href="/go/' . $Section->nod_name . '">转到主题所在区域 / ' . make_plaintext($Section->nod_title) . '</a><br /><br />'; echo '<span class="tip">主题 [ <a href="/topic/view/' . $Topic->tpc_id . '/' . $rt['p_cur'] . '.html" class="t">' . make_plaintext($Topic->tpc_title) . '</a> ] 现在有 ' . ($Topic->tpc_posts + 1) . ' 篇回复,感谢你的参与!</span>'; echo '</div>'; } echo '</div>'; }