Example #1
0
         if (mb_strlen($p_title, 'utf-8') <= $options['article_title_max_len'] && mb_strlen($p_content, 'utf-8') <= $options['article_content_max_len']) {
             $p_title = htmlspecialchars($p_title);
             $p_content = htmlspecialchars($p_content);
             $DBS->query("INSERT INTO yunbbs_articles (id,cid,uid,title,content,addtime,edittime) VALUES (null,{$cid},{$cur_uid}, '{$p_title}', '{$p_content}', {$timestamp}, {$timestamp})");
             $new_aid = $DBS->insert_id();
             $DBS->unbuffered_query("UPDATE yunbbs_categories SET articles=articles+1 WHERE id='{$cid}'");
             $DBS->unbuffered_query("UPDATE yunbbs_users SET articles=articles+1, lastposttime={$timestamp} WHERE id='{$cur_uid}'");
             // 更新u_code
             $cur_user['lastposttime'] = $timestamp;
             //
             $new_ucode = md5($cur_uid . $cur_user['password'] . $cur_user['regtime'] . $cur_user['lastposttime'] . $cur_user['lastreplytime']);
             setcookie("cur_uid", $cur_uid, $timestamp + 86400 * 365, '/');
             setcookie("cur_uname", $cur_uname, $timestamp + 86400 * 365, '/');
             setcookie("cur_ucode", $new_ucode, $timestamp + 86400 * 365, '/');
             // mentions 没有提醒用户的id
             $mentions = find_mentions(' ' . $p_title . ' ' . $p_content, $cur_uname);
             if ($mentions && count($mentions) <= 10) {
                 foreach ($mentions as $m_name) {
                     $DBS->unbuffered_query("UPDATE yunbbs_users SET notic =  concat('{$new_aid},', notic) WHERE name='{$m_name}'");
                 }
             }
             $p_title = $p_content = '';
             header('location: /t-' . $new_aid);
             exit;
         } else {
             $tip = '标题' . mb_strlen($p_title, 'utf-8') . ' 或 内容' . mb_strlen($p_content, 'utf-8') . ' 太长了';
         }
     } else {
         $tip = '标题 不能留空';
     }
 } else {
Example #2
0
             exit('403: dont post any spam.');
         }
     }
 }
 $c_content = htmlspecialchars($c_content);
 $DBS->query("INSERT INTO yunbbs_comments (id,articleid,uid,addtime,content) VALUES (null,{$tid}, {$cur_uid}, {$timestamp}, '{$c_content}')");
 $DBS->unbuffered_query("UPDATE yunbbs_articles SET ruid='{$cur_uid}',edittime='{$timestamp}',comments=comments+1 WHERE id='{$tid}'");
 $DBS->unbuffered_query("UPDATE yunbbs_users SET replies=replies+1,lastreplytime='{$timestamp}' WHERE id='{$cur_uid}'");
 // 更新u_code
 $new_ucode = md5($cur_uid . $cur_user['password'] . $cur_user['regtime'] . $cur_user['lastposttime'] . $timestamp);
 setcookie("cur_uid", $cur_uid, $timestamp + 86400 * 365, '/');
 setcookie("cur_uname", $cur_uname, $timestamp + 86400 * 365, '/');
 setcookie("cur_ucode", $new_ucode, $timestamp + 86400 * 365, '/');
 $new_taltol_page = ceil(($t_obj['comments'] + 1) / $options['commentlist_num']);
 // mentions 没有提醒用户的id,等缓存自动过期,提醒有点延迟
 $mentions = find_mentions($c_content . ' @' . $t_obj['author'], $cur_uname);
 if ($mentions && count($mentions) <= 10) {
     foreach ($mentions as $m_name) {
         $DBS->unbuffered_query("UPDATE yunbbs_users SET notic =  concat('{$tid},', notic) WHERE name='{$m_name}'");
     }
 }
 // cache
 $cache->mdel(array('home_articledb', 'site_infos'));
 // 跳到评论最后一页
 if ($page < $new_taltol_page) {
     $c_content = '';
     header('location: /topics/' . $tid . '/' . $new_taltol_page);
     exit;
 } else {
     $cur_ucode = $new_ucode;
     $formhash = formhash();