Thread erledigt/unerledigt

Reenmeister
Hab mal nen bissle rumgespielt, aber ich bekomms nicht vernünftig mit 3 Optionen umgeschrieben, da fast der ganze Code verändert werden müsste. Wäre also sehr Dankbar wenn sich dem jemand annehmen könnte, der es ohne größere Probleme hinbekommt.
Nicky75
Ich habe folgendes Problem..bei mir kommt diese Meldung wenn ich den Thread als Markiert machen will

Parse error: syntax error, unexpected T_BOOLEAN_OR in /www/htdocs/w00af59d/copyworld/modcp.php on line 29


code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
577:
578:
579:
580:
581:
582:
583:
584:
585:
586:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
<?php
// ************************************************************************************//
// * WoltLab Burning Board 2
// ************************************************************************************//
// * Copyright (c) 2001-2004 WoltLab GmbH
// * Web           http://www.woltlab.de/
// * License       http://www.woltlab.de/products/burning_board/license_en.php
// *               http://www.woltlab.de/products/burning_board/license.php
// ************************************************************************************//
// * WoltLab Burning Board 2 is NOT free software.
// * You may not redistribute this package or any of it's files.
// ************************************************************************************//
// * $Date: 2006-09-25 12:41:52 +0200 (Mo, 25 Sep 2006) $
// * $Author: Burntime $
// * $Rev: 1716 $
// ************************************************************************************//


$filename = 'modcp.php';

require('./global.php');
require('./acp/lib/mod_functions.php');
$lang->load('MODCP');

$m_is_mod = 0;
$isuser = 0;
if (isset($threadid)) {
        if (checkmodpermissions()) $m_is_mod = 1;
        if ($wbbuserdata['userid'] && $wbbuserdata['userid'] == $thread['starterid'] && (checkpermissions('can_close_own_topic') == 1 || checkpermissions('can_del_own_topic') == 1 || checkpermissions('can_edit_own_topic') == 1 || checkpermissions('can_move_own_topic') == 1)) $isuser = 1;|| checkpermissions('can_settle_own_topic') == 1
}

if (isset($_REQUEST['action'])) $action = $_REQUEST['action'];
else $action = '';
if ($action == '' || $action == -1) error($lang->get("LANG_GLOBAL_ERROR_FALSELINK", array('$adminmail' => $adminmail)));





/** delete posts **/
if ($action == 'post_del') {
        if (!checkmodpermissions('m_can_post_del')) access_error();
        if (isset($_POST['send'])) {
                if (is_array($_POST['postids']) && count($_POST['postids'])) $postids = implode(',', intval_array($_POST['postids']));
                else $postids = '';
                if (!$postids) {
                        header("Location: thread.php?threadid=$threadid" . $SID_ARG_2ND_UN);
                        exit();
                }
                list($postcount) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_posts WHERE threadid='$threadid' AND postid IN ($postids)");
                list($totalposts) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_posts WHERE threadid = '".$threadid."'");
                if ($postcount == $totalposts) {
                        deletethread($threadid);
                        header("Location: board.php?boardid=$boardid" . $SID_ARG_2ND_UN);
                        exit();
                }
                else {
                        deleteposts($postids, $threadid, $postcount);
                        header("Location: thread.php?threadid=$threadid" . $SID_ARG_2ND_UN);
                        exit();
                }
        }

        list($postcount) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_posts WHERE threadid='$threadid'");
        if ($wbbuserdata['umaxposts']) $postsperpage = $wbbuserdata['umaxposts'];
        elseif ($board['postsperpage']) $postsperpage = $board['postsperpage'];
        else $postsperpage = $default_postsperpage;
        $postorder = $board['postorder'];

        if (isset($_GET['page'])) {
                $page = intval($_GET['page']);
                if ($page < 1) $page = 1;
        }
        else $page = 1;
        $pages = ceil($postcount / $postsperpage);
        if ($pages > 1) $pagelink = makepagelink("modcp.php?action=post_del&amp;threadid=$threadid".$SID_ARG_2ND, $page, $pages, $showpagelinks - 1);
        $navbar = getNavbar($board['parentlist']);
        eval("\$navbar .= \"".$tpl->get("navbar_board")."\";");

        $postbit = '';
        $count = 0;
        $result = $db->query("SELECT postid, username, posttime, message FROM bb".$n."_posts WHERE threadid='$threadid' ORDER BY posttime ".(($postorder) ? ("DESC") : ("ASC")), $postsperpage, $postsperpage * ($page - 1));
        while ($row = $db->fetch_array($result)) {
                $tdclass = getone($count, 'tableb', 'tablea');

                $postdate = formatdate($wbbuserdata['dateformat'], $row['posttime']);
                $posttime = formatdate($wbbuserdata['timeformat'], $row['posttime']);
                if (wbb_strlen($row['message']) > 100) $row['message'] = wbb_substr($row['message'], 0, 100).'...';
                $row['message'] = htmlconverter($row['message']);
                $row['username'] = htmlconverter($row['username']);
                $LANG_MODCP_BY = $lang->get("LANG_MODCP_BY", array('$username' => $row['username'], '$postdate' => $postdate, '$posttime' => $posttime));
                eval("\$postbit .= \"".$tpl->get("modcp_postbit")."\";");
                $count++;
        }

        $thread['topic'] = htmlconverter(textwrap($thread['topic']));
        eval("\$tpl->output(\"".$tpl->get("modcp_post_del")."\");");
}




/** divide/seperate thread **/
if ($action == 'thread_cut') {
        if (!checkmodpermissions('m_can_thread_cut')) access_error();
        if (isset($_POST['send'])) {
                if (is_array($_POST['postids']) && count($_POST['postids'])) $postids = implode(',', intval_array($_POST['postids']));
                $newboardid = intval($_POST['newboardid']);
                if (!$postids) {
                        header("Location: thread.php?threadid=$threadid" . $SID_ARG_2ND_UN);
                        exit();
                }
                list($postcount) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_posts WHERE threadid='$threadid' AND postid IN ($postids)");
                if ($postcount == $thread['replycount'] + 1) error($lang->get("LANG_MODCP_ERROR_CANTCUT"));
                else {
                        $topic = wbb_trim($_POST['topic']);
                        if (!$topic || $newboardid == -1) error($lang->get("LANG_GLOBAL_ERROR1"));
                        $newboard = getBoardAccessData($newboardid);
                        if (!$newboard['boardid']) error($lang->get("LANG_GLOBAL_ERROR1"));
                        if (!checkpermissions("can_enter_board", $newboard) || $newboard['isboard'] == 0 || $newboard['externalurl'] != '') access_error();

                        $firstpost = $db->query_first("SELECT userid, username, posttime FROM bb".$n."_posts WHERE postid IN ($postids) ORDER BY posttime ASC", 1);
                        $lastpost = $db->query_first("SELECT userid, username, posttime FROM bb".$n."_posts WHERE postid IN ($postids) ORDER BY posttime DESC", 1);

                        $db->query("INSERT INTO bb".$n."_threads (boardid,topic,starttime,starterid,starter,lastposttime,lastposterid,lastposter,replycount,visible) VALUES ('$newboardid','".addslashes($topic)."','$firstpost[posttime]','$firstpost[userid]','".addslashes($firstpost['username'])."','$lastpost[posttime]','$lastpost[userid]','".addslashes($lastpost['username'])."','".($postcount - 1)."',1)");
                        $newthreadid = $db->insert_id();

                        $db->query("UPDATE bb".$n."_posts SET threadid='$newthreadid' WHERE postid IN ($postids)");
                        $db->query("UPDATE bb".$n."_postcache SET threadid='$newthreadid' WHERE postid IN ($postids)");
                        $db->unbuffered_query("UPDATE bb".$n."_posts SET parentpostid=0 WHERE threadid='$newthreadid' AND postid IN ($postids) AND parentpostid NOT IN ($postids)", 1);
                        $db->unbuffered_query("UPDATE bb".$n."_posts SET parentpostid=0 WHERE threadid='$threadid' AND postid NOT IN ($postids) AND parentpostid IN ($postids)", 1);

                        $result = $db->query_first("SELECT userid, username, posttime FROM bb".$n."_posts WHERE threadid='$threadid' ORDER BY posttime DESC", 1);
                        $db->query("UPDATE bb".$n."_threads SET replycount=replycount-'$postcount', lastposttime='$result[posttime]', lastposterid='$result[userid]', lastposter='".addslashes($result['username'])."'".(($post['attachmentid']) ? (", attachments=attachments-1") : (""))." WHERE threadid='$threadid'");

                        $db->query("UPDATE bb".$n."_boards SET postcount=postcount-'$postcount' WHERE boardid IN ($boardid,$board[parentlist])");
                        $db->query("UPDATE bb".$n."_boards SET postcount=postcount+'$postcount', threadcount=threadcount+1 WHERE boardid IN ($newboardid,$newboard[parentlist])");

                        if ($board['lastthreadid'] == $threadid) updateBoardInfo("$boardid,$board[parentlist]", 0, $threadid);
                        if ($newboard['lastposttime'] <= $lastpost['posttime']) updateBoardInfo("$newboardid,$newboard[parentlist]", $lastpost['posttime']);

                        if ($board['countuserposts'] == 1 && $newboard['countuserposts'] == 0) {
                                $result = $db->query("SELECT COUNT(postid) AS posts, userid FROM bb".$n."_posts WHERE postid IN ($postids) AND visible = 1 AND userid>0 GROUP BY userid");
                                while ($row = $db->fetch_array($result)) $db->query("UPDATE bb".$n."_users SET userposts=userposts-'$row[posts]' WHERE userid='$row[userid]'");
                        }
                        if ($board['countuserposts'] == 0 && $newboard['countuserposts'] == 1) {
                                $result = $db->query("SELECT COUNT(postid) AS posts, userid FROM bb".$n."_posts WHERE postid IN ($postids) AND visible = 1 AND userid>0 GROUP BY userid");
                                while ($row = $db->fetch_array($result)) $db->query("UPDATE bb".$n."_users SET userposts=userposts+'$row[posts]' WHERE userid='$row[userid]'");
                        }

                        /* update global threadcount */
                        $db->unbuffered_query("UPDATE bb".$n."_stats SET threadcount=threadcount+1", 1);

                        header("Location: thread.php?threadid=$threadid" . $SID_ARG_2ND_UN);
                        exit();
                }
        }

        list($postcount) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_posts WHERE threadid='$threadid'");
        if ($wbbuserdata['umaxposts']) $postsperpage = $wbbuserdata['umaxposts'];
        elseif ($board['postsperpage']) $postsperpage = $board['postsperpage'];
        else $postsperpage = $default_postsperpage;
        $postorder = $board['postorder'];

        if (isset($_GET['page'])) {
                $page = intval($_GET['page']);
                if ($page < 1) $page = 1;
        }
        else $page = 1;
        $pages = ceil($postcount / $postsperpage);
        if ($pages > 1) $pagelink = makepagelink("modcp.php?action=thread_cut&amp;threadid=$threadid".$SID_ARG_2ND, $page, $pages, $showpagelinks - 1);
        $navbar = getNavbar($board['parentlist']);
        eval("\$navbar .= \"".$tpl->get("navbar_board")."\";");

        $postbit = '';
        $count = 0;
        $result = $db->query("SELECT postid, username, posttime, message FROM bb".$n."_posts WHERE threadid='$threadid' ORDER BY posttime ".(($postorder) ? ("DESC") : ("ASC")), $postsperpage, $postsperpage * ($page - 1));
        while ($row = $db->fetch_array($result)) {
                $tdclass = getone($count, 'tableb', 'tablea');

                $postdate = formatdate($wbbuserdata['dateformat'], $row['posttime']);
                $posttime = formatdate($wbbuserdata['timeformat'], $row['posttime']);
                if (wbb_strlen($row['message']) > 100) $row['message'] = wbb_substr($row['message'], 0, 100).'...';
                $row['message'] = htmlconverter($row['message']);
                $row['username'] = htmlconverter($row['username']);
                $LANG_MODCP_BY = $lang->get("LANG_MODCP_BY", array('$username' => $row['username'], '$postdate' => $postdate, '$posttime' => $posttime));
                eval("\$postbit .= \"".$tpl->get("modcp_postbit2")."\";");
                $count++;
        }

        $result = $db->query("SELECT boardid, parentid, boardorder, title, invisible, isboard FROM bb".$n."_boards ORDER by parentid ASC, boardorder ASC");
        while ($row = $db->fetch_array($result)) $boardcache[$row['parentid']][$row['boardorder']][$row['boardid']] = $row;

        $permissioncache = getPermissions();
        $board_options = makeboardselect(0, 1, 0, "%s *");

        $thread['topic'] = htmlconverter(textwrap($thread['topic']));
        eval("\$tpl->output(\"".$tpl->get("modcp_thread_cut")."\");");
}









/** close/open thread **/
if ($action == 'thread_close') {
        if (!isset($threadid)) error($lang->get("LANG_GLOBAL_ERROR_FALSELINK", array('$adminmail' => $adminmail)));

        if (!checkmodpermissions('m_can_thread_close') && (!$isuser || checkpermissions('can_close_own_topic') == 0)) access_error();
        $db->query("UPDATE bb".$n."_threads SET closed=1-'$thread[closed]' WHERE threadid='$threadid'");
        header("Location: thread.php?threadid=$threadid" . $SID_ARG_2ND_UN);
        exit();
}
/** settle/unsettle thread **/
if ($action == 'thread_settle') {
        if (!isset($threadid)) error($lang->get("LANG_GLOBAL_ERROR_FALSELINK", array('$adminmail' => $adminmail)));

        if (!checkmodpermissions('m_can_thread_settle') && (!$isuser || checkpermissions('can_settle_own_topic') == 0)) access_error();
        $db->query("UPDATE bb".$n."_threads SET settled=1-'$thread[settled]' WHERE threadid='$threadid'");
        header("Location: thread.php?threadid=$threadid" . $SID_ARG_2ND_UN);
        exit();
}







/** top/untop thread **/
if ($action == 'thread_top') {
        if (!isset($threadid)) error($lang->get("LANG_GLOBAL_ERROR_FALSELINK", array('$adminmail' => $adminmail)));

        if (!checkmodpermissions('m_can_thread_top')) access_error();
        if ($thread['important'] == 2) {
                $db->query("DELETE FROM bb".$n."_announcements WHERE threadid='$threadid'");
                $thread['important'] = 1;
        }
        $db->query("UPDATE bb".$n."_threads SET important=1-'$thread[important]' WHERE threadid='$threadid'");
        header("Location: thread.php?threadid=$threadid" . $SID_ARG_2ND_UN);
        exit();
}










/** delete thread **/
if ($action == 'thread_del') {
        if (!isset($threadid)) error($lang->get("LANG_GLOBAL_ERROR_FALSELINK", array('$adminmail' => $adminmail)));

        if (!checkmodpermissions('m_can_thread_del') && (!$isuser || checkpermissions('can_del_own_topic') == 0)) access_error();
        if (isset($_POST['send'])) {
                deletethread($threadid);
                header("Location: board.php?boardid=$boardid".$SID_ARG_2ND_UN);
                exit();
        }
        else {
                $navbar = getNavbar($board['parentlist']);
                eval("\$navbar .= \"".$tpl->get("navbar_board")."\";");

                $thread['topic'] = htmlconverter(textwrap($thread['topic']));
                eval("\$tpl->output(\"".$tpl->get("modcp_thread_del")."\");");
        }
}










/** move thread **/
if ($action == 'thread_move') {
        if (!checkmodpermissions('m_can_thread_move') && (!$isuser || checkpermissions('can_move_own_topic') == 0)) access_error();
        if (isset($_POST['send'])) {
                $newboardid = intval($_POST['newboardid']);
                $mode = $_POST['mode'];
                if (!$newboardid || $newboardid == -1 || $newboardid == $boardid) error($lang->get("LANG_MODCP_ERROR_CANTMOVE"));
                $newboard = getBoardAccessData($newboardid);
                if (!checkpermissions('can_enter_board', $newboard) || $newboard['isboard'] == 0 || $newboard['externalurl'] != '') error($lang->get("LANG_MODCP_ERROR_CANTMOVE"));

                movethread($threadid, $mode, $newboardid);

                header("Location: thread.php?threadid=$threadid" . $SID_ARG_2ND_UN);
                exit();
        }
        else {
                $navbar = getNavbar($board['parentlist']);
                eval("\$navbar .= \"".$tpl->get("navbar_board")."\";");

                $result = $db->query("SELECT boardid, parentid, boardorder, title, invisible, isboard, externalurl FROM bb".$n."_boards ORDER by parentid ASC, boardorder ASC");
                while ($row = $db->fetch_array($result)) $boardcache[$row['parentid']][$row['boardorder']][$row['boardid']] = $row;

                $permissioncache = getPermissions();
                $newboard_options = makeboardselect(0, 1, 0, "%s *");

                $thread['topic'] = htmlconverter(textwrap($thread['topic']));
                eval("\$tpl->output(\"".$tpl->get("modcp_thread_move")."\");");
        }
}







/** merge thread **/
if ($action == 'thread_merge') {
        if (!isset($threadid)) error($lang->get("LANG_GLOBAL_ERROR_FALSELINK", array('$adminmail' => $adminmail)));

        if (!checkmodpermissions('m_can_thread_merge')) access_error();
        if (isset($_POST['send'])) {
                $merge_threadid = 0;
                $merge_postid = 0;
                $mergeurl = $_POST['mergeurl'];
                list ($script, $query) = split ('[?]', $mergeurl);
                $values = explode('&', $query);
                while (list($key, $val) = each($values)) {
                        list ($varname, $value) = explode('=', $val);
                        if ($varname == 'threadid') {
                                $merge_threadid = intval($value);
                                break;
                        }
                        if ($varname == 'postid') {
                                $merge_postid = intval($value);
                                break;
                        }
                }

                if ((!$merge_postid && !$merge_threadid) || $merge_threadid == $threadid) error($lang->get("LANG_MODCP_ERROR_CANTMERGE"));

                if ($merge_postid) $merge_thread = $db->query_first("SELECT t.* FROM bb".$n."_posts p, bb".$n."_threads t WHERE p.threadid=t.threadid AND p.postid='$merge_postid'");
                if ($merge_threadid) $merge_thread = $db->query_first("SELECT * FROM bb".$n."_threads WHERE threadid='$merge_threadid'");

                if (!$merge_thread['threadid'] || $merge_thread['threadid'] == $threadid) error($lang->get("LANG_MODCP_ERROR_CANTMERGE"));

                if ($merge_thread['lastposttime'] > $thread['lastposttime']) $db->query("UPDATE bb".$n."_threads SET replycount=replycount+'".($merge_thread['replycount'] + 1)."', lastposttime='$merge_thread[lastposttime]', lastposterid='$merge_thread[lastposterid]', lastposter='".addslashes($merge_thread['lastposter'])."' WHERE threadid='$threadid'");
                else $db->query("UPDATE bb".$n."_threads SET replycount=replycount+'".($merge_thread['replycount'] + 1)."' WHERE threadid='$threadid'");

                $db->query("DELETE FROM bb".$n."_threads WHERE threadid = '$merge_threadid'");
                $db->query("DELETE FROM bb".$n."_threads WHERE pollid = '$merge_threadid' AND closed=3");
                if ($merge_thread['important'] == 2) $db->unbuffered_query("DELETE FROM bb".$n."_announcements WHERE threadid = '$merge_threadid'", 1);
                $db->query("DELETE FROM bb".$n."_subscribethreads WHERE threadid = '$merge_threadid'");
                if ($thread['pollid']) {
                        $db->query("DELETE FROM bb".$n."_polls WHERE pollid = '$merge_thread[pollid]'");
                        $pollvotes = " OR (id = '$merge_thread[pollid]' AND votemode=1)";
                        $db->query("DELETE FROM bb".$n."_polloptions WHERE pollid = '$merge_thread[pollid]'");
                }
                else $pollvotes = '';
                $db->query("DELETE FROM bb".$n."_votes WHERE (id = '$merge_threadid' AND votemode=2)$pollvotes");

                if ($merge_thread['boardid'] == $boardid) {
                        $db->query("UPDATE bb".$n."_boards SET threadcount=threadcount-1 WHERE boardid IN ($boardid,$board[parentlist])");
                        if ($board['lastthreadid'] == $merge_threadid) $db->query("UPDATE bb".$n."_boards SET lastthreadid='$threadid' WHERE boardid IN ($boardid,$board[parentlist]) AND lastthreadid='$merge_threadid'");
                        $db->query("UPDATE bb".$n."_posts SET threadid='$threadid', parentpostid=0 WHERE threadid='$merge_threadid'");
                        $db->query("UPDATE bb".$n."_postcache SET threadid='$threadid' WHERE threadid='$merge_threadid'");
                }
                else {
                        $oldboard = $db->query_first("SELECT * FROM bb".$n."_boards WHERE boardid='$merge_thread[boardid]'");
                        $merge_thread['replycount'] += 1;
                        $db->query("UPDATE bb".$n."_boards SET threadcount=threadcount-1, postcount=postcount-'$merge_thread[replycount]' WHERE boardid IN ($oldboard[boardid],$oldboard[parentlist])");
                        $db->query("UPDATE bb".$n."_boards SET threadcount=threadcount+1, postcount=postcount+'$merge_thread[replycount]' WHERE boardid IN ($boardid,$board[parentlist])");

                        if ($oldboard['countuserposts'] == 1 && $board['countuserposts'] == 0) {
                                $result = $db->query("SELECT COUNT(postid) AS posts, userid FROM bb".$n."_posts WHERE threadid='$merge_threadid' AND visible = 1 AND userid>0 GROUP BY userid");
                                while ($row = $db->fetch_array($result)) $db->query("UPDATE bb".$n."_users SET userposts=userposts-'$row[posts]' WHERE userid='$row[userid]'");
                        }
                        if ($oldboard['countuserposts'] == 0 && $board['countuserposts'] == 1) {
                                $result = $db->query("SELECT COUNT(postid) AS posts, userid FROM bb".$n."_posts WHERE threadid='$merge_threadid' AND visible = 1 AND userid>0 GROUP BY userid");
                                while ($row = $db->fetch_array($result)) $db->query("UPDATE bb".$n."_users SET userposts=userposts+'$row[posts]' WHERE userid='$row[userid]'");
                        }

                        $db->query("UPDATE bb".$n."_posts SET threadid='$threadid' WHERE threadid='$merge_threadid'");
                        $db->query("UPDATE bb".$n."_postcache SET threadid='$threadid' WHERE threadid='$merge_threadid'");

                        if ($oldboard['lastthreadid'] == $merge_threadid) updateBoardInfo("$oldboard[boardid],$oldboard[parentlist]", 0, $merge_threadid);
                        if ($board['lastposttime'] <= $merge_thread['lastposttime']) updateBoardInfo("$boardid,$board[parentlist]", $merge_thread['lastposttime']);
                }

                /* update global threadcount */
                $db->unbuffered_query("UPDATE bb".$n."_stats SET threadcount=threadcount-1", 1);

                header("Location: thread.php?threadid=$threadid" . $SID_ARG_2ND_UN);
                exit();
        }

        $navbar = getNavbar($board['parentlist']);
        eval("\$navbar .= \"".$tpl->get("navbar_board")."\";");

        $thread['topic'] = htmlconverter(textwrap($thread['topic']));

        $lang->items['LANG_MODCP_THREAD_MERGE_INFO1'] = $lang->get("LANG_MODCP_THREAD_MERGE_INFO1", array('$topic' => $thread['topic']));
        eval("\$tpl->output(\"".$tpl->get("modcp_thread_merge")."\");");
}









/** edit thread **/
if ($action == 'thread_edit') {
        if (!isset($threadid)) error($lang->get("LANG_GLOBAL_ERROR_FALSELINK", array('$adminmail' => $adminmail)));

        if (!checkmodpermissions('m_can_thread_edit') && (!$isuser || checkpermissions('can_edit_own_topic') == 0)) access_error();
        if (isset($_POST['send'])) {
                $topic = wbb_trim($_POST['topic']);

                if (isset($_POST['iconid']) && checkpermissions("can_use_post_icons") == 1) $iconid = intval($_POST['iconid']);
                else $iconid = 0;

                if ($dostopshooting == 1) $topic = stopShooting($topic);
                if (!$topic) error($lang->get("LANG_GLOBAL_ERROR1"));
                if ($m_is_mod == 1) $important = intval($_POST['important']);
                else $important = $thread['important'];
                if ($important == 2 && $thread['important'] != 2) $db->unbuffered_query("INSERT IGNORE INTO bb".$n."_announcements (boardid,threadid) VALUES ($boardid,$threadid)");
                if ($important != 2 && $thread['important'] == 2) $db->unbuffered_query("DELETE FROM bb".$n."_announcements WHERE threadid = '$threadid'", 1);

                // remove redirect(s)
                if ($m_is_mod == 1 && isset($_POST['rm_redirect']) && $_POST['rm_redirect'] == 1) $db->unbuffered_query("DELETE FROM bb".$n."_threads WHERE pollid='$threadid' AND closed=3", 1);

                // verify prefix
                unset($prefix);
                if (isset($_POST['prefix']) && $board['prefixuse'] > 0 && checkpermissions('can_use_prefix')) {
                        if ($board['prefixuse'] == 1) $ch_prefix = $default_prefix;
                        if ($board['prefixuse'] == 2) $ch_prefix = $default_prefix."\n".$board['prefix'];
                        if ($board['prefixuse'] == 3) $ch_prefix = $board['prefix'];
                        $ch_prefix = preg_replace("/\s*\n\s*/", "\n", wbb_trim($ch_prefix));
                        $ch_prefix = explode("\n", $ch_prefix);
                        if (in_array($_POST['prefix'], $ch_prefix)) $prefix = $_POST['prefix'];
                        else $prefix = '';
                }

                $db->unbuffered_query("UPDATE bb".$n."_threads SET topic='".addslashes($topic)."', iconid='$iconid', ".((checkmodpermissions("m_can_thread_close") || ($isuser && $wbbuserdata['can_close_own_topic'] == 1)) ? ("closed='".intval($_POST['closed'])."',") : (""))."important='$important'".((isset($prefix)) ? (", prefix='".addslashes($prefix)."'") : (""))." WHERE threadid='$threadid'", 1);
                $db->unbuffered_query("UPDATE bb".$n."_posts SET posttopic='".addslashes($topic)."', iconid='$iconid' WHERE threadid='$threadid' AND posttime = '$thread[starttime]'", 1);

                if (isset($_POST['submitbutton']) || (!isset($_POST['announce']) || !$_POST['announce'])) header("Location: thread.php?threadid=$threadid" . $SID_ARG_2ND_UN);
                else header("Location: modcp.php?action=announce&threadid=$threadid".$SID_ARG_2ND_UN);
                exit();
        }

        $lang->load('POSTINGS');
        if (checkpermissions("can_use_post_icons") == 1) $newthread_icons = getIcons($thread['iconid']);
        if ($thread['closed'] == 1) $checked = " checked=\"checked\"";

        $navbar = getNavbar($board['parentlist']);
        eval("\$navbar .= \"".$tpl->get("navbar_board")."\";");

        if ($m_is_mod == 1) {
                $imp_checked[$thread['important']] = " checked=\"checked\"";
                eval("\$change_important = \"".$tpl->get("modcp_thread_edit_important")."\";");

                list($redirectlink) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_threads WHERE pollid='$threadid' AND closed=3");
                if ($redirectlink > 0) eval("\$remove_redirect = \"".$tpl->get("modcp_thread_remove_redirect")."\";");
        }

        if ($board['prefixuse'] > 0 && checkpermissions('can_use_prefix')) {
                if ($board['prefixuse'] == 1) $ch_prefix = $default_prefix;
                if ($board['prefixuse'] == 2) $ch_prefix = $default_prefix."\n".$board['prefix'];
                if ($board['prefixuse'] == 3) $ch_prefix = $board['prefix'];

                $ch_prefix = preg_replace("/\s*\n\s*/", "\n", wbb_trim($ch_prefix));
                $ch_prefix = explode("\n", $ch_prefix);
                sort($ch_prefix);

                $thread['prefix'] = htmlconverter($thread['prefix']);
                $prefix_options = '';
                for ($i = 0; $i < count($ch_prefix); $i++) {
                        $ch_prefix[$i] = htmlconverter($ch_prefix[$i]);
                        $prefix_options .= makeoption($ch_prefix[$i], $ch_prefix[$i], $thread['prefix'], 1);
                }
                if ($prefix_options != '') eval("\$select_prefix = \"".$tpl->get("newthread_prefix")."\";");
        }

        $thread['topic'] = htmlconverter($thread['topic']);
        eval("\$tpl->output(\"".$tpl->get("modcp_thread_edit")."\");");
}








/** announce **/
if ($action == 'announce') {
        if (!isset($threadid) || $thread['important'] != 2) error($lang->get("LANG_GLOBAL_ERROR_FALSELINK", array('$adminmail' => $adminmail)));
        if (!checkmodpermissions('m_can_announce')) access_error();


        if (isset($_POST['send'])) {
                $db->query("DELETE FROM bb".$n."_announcements WHERE boardid<>'$boardid' AND threadid='$threadid'");
                $boardids = $_POST['boardids'];
                if (count($boardids)) {
                        $boardids = implode("','$threadid'),('", $boardids);
                        $db->query("INSERT IGNORE INTO bb".$n."_announcements (boardid,threadid) VALUES ('$boardids','$threadid')");
                }

                header("Location: thread.php?threadid=$threadid" . $SID_ARG_2ND_UN);
                exit();
        }

        $result = $db->query("SELECT boardid, parentid, boardorder, title, invisible FROM bb".$n."_boards ORDER by parentid ASC, boardorder ASC");
        while ($row = $db->fetch_array($result)) $boardcache[$row['parentid']][$row['boardorder']][$row['boardid']] = $row;

        $permissioncache = getPermissions();

        $boardids = array();
        $result = $db->query("SELECT boardid FROM bb".$n."_announcements WHERE threadid='$threadid'");
        while ($row = $db->fetch_array($result)) $boardids[] = $row['boardid'];

        $board_options = makeboardselect(0, 1, $boardids);

        $navbar = getNavbar($board['parentlist']);
        eval("\$navbar .= \"".$tpl->get("navbar_board")."\";");

        $thread['topic'] = htmlconverter(textwrap($thread['topic']));
        eval("\$tpl->output(\"".$tpl->get("modcp_announce")."\");");
}














/** add poll **/
if ($action == 'polladd') {
        if (!isset($threadid)) error($lang->get("LANG_GLOBAL_ERROR_FALSELINK", array('$adminmail' => $adminmail)));

        if (!checkmodpermissions('m_can_add_poll')) access_error();

        $pollinfo = $db->query_first("SELECT pollid FROM bb".$n."_polls WHERE threadid='$threadid'");

        if ($pollinfo['pollid'] > 0 || $thread['closed'] == 1 || !checkpermissions('can_post_poll')) access_error();

        if ($_POST['send']) {
                if (isset($_POST['polloptions'])) $options = explode("\n", $_POST['polloptions']);
                else $options = array();
                if (isset($_POST['question'])) $question = wbb_trim($_POST['question']);
                else $question = '';

                if (!$question || !count($options)) error($lang->get("LANG_GLOBAL_ERROR1"));
                else {
                        $db->query("INSERT INTO bb".$n."_polls (threadid,question,starttime,choicecount,timeout) VALUES ('".intval($threadid)."' ,'".addslashes($question)."','".time()."','".intval($_POST['choicecount'])."','".intval($_POST['timeout'])."')");
                        $pollid = $db->insert_id();

                        $count = 1;
                        $polloptions_insert = "";
                        for ($i = 0; $i < count($options); $i++) {
                                $options[$i] = wbb_trim($options[$i]);
                                if (!$options[$i]) continue;
                                $polloptions_insert .= ",('$pollid','".addslashes($options[$i])."','$count')";
                                $count++;
                        }
                        if ($polloptions_insert) $db->query("INSERT INTO bb".$n."_polloptions (pollid,polloption,showorder) VALUES ".wbb_substr($polloptions_insert, 1));

                        $db->unbuffered_query("UPDATE bb".$n."_threads SET pollid='$pollid' WHERE threadid='$threadid'");
                        header("Location: thread.php?threadid=$threadid" . $SID_ARG_2ND_UN);
                        exit();
                }
        }
        else {
                $lang->load('POLL');

                $navbar = getNavbar($board['parentlist']);
                eval("\$navbar .= \"".$tpl->get("navbar_board")."\";");

                $thread['topic'] = htmlconverter(textwrap($thread['topic']));
                eval("\$tpl->output(\"".$tpl->get("polladd")."\");");
        }
}
?>
janolaf
der abschnitt in der modcp.php sollte nach dem bearbeiten doch schon so aussehen:
php:
1:
2:
3:
4:
if (isset($threadid)) {
    if (checkmodpermissions()) $m_is_mod 1;
    if ($wbbuserdata['userid'] && $wbbuserdata['userid'] == $thread['starterid'] && (checkpermissions('can_close_own_topic') == || checkpermissions('can_del_own_topic') == || checkpermissions('can_edit_own_topic') == || checkpermissions('can_move_own_topic') == || checkpermissions('can_settle_own_topic') == 1)) $isuser 1;
}


dann klappt das nämlich auch ohne fehler Belehr
Nicky75
Peinlich danke
Hamsterinfos
huhu,

bei den normalen Usern wird unten nix angezeigt


forne wo das rote X steht da können die es als erledigt makieren

habe ich da was falsch eingestellt?
Ghostmaster
Hast du die Gruppenrechte auch gesetzt?
Hamsterinfos
alles gemacht

//edit: wenn ich Gruppenrechte wegnehme, ist es als User weg
BL4CK_D3V!L
Problembeschreibung:

Gestern hatte ich nach diesem Hack gefragt SIEHE HIER.
Einbau wie in der Anleitung gemacht, jetzt kommt im ACP bei "Foren bearbeiten" allerdings eine Fehlermeldung

Fehlermeldung:

Parse error: syntax error, unexpected '"' in /daten/hfcr/www/hfcrssl/tbb/acp/board.php on line 345

Link zum Forum oder Screenshot:

---

Was wurde zuletzt geändert oder eingebaut?

s.o.

Edit: Ok, gerade den Fehler entdeckt Irre Aber könnte mir vielleicht irgend jemand sagen wie man nun mit dem Hack umgeht? Ich sehe da keinerlei Einstellungsmöglichkeiten verwirrt Steht auch nix in der Anleitung
DrPCox
häng mal deine acp/board.php hier an bitte.
BL4CK_D3V!L
Ahhh warst du jetzt schnell DrPCox fröhlich Hab´s grad editiert oben, das ich den Fehler gefunden habe.

Wüsste jetzt nur noch gerne wie man mit dem Hack umgeht
Bräke
@BL4CK_D3V!L
Pass doch bitte auf wo du Themen erstellst, im 3.0 Bereich hats nix verloren und wenns um nen Hack geht immer im Supportthread posten.


Kenn den Hack nur hier von y******, kA ob der noch n bissel verbessert wurd.
Gruppenrechte einstellen, wer was darf bei dem Hack im ACP.
Foren einstellen wo der erscheinen soll.

Dann hat man im Thread unten bei Administrative Optionen eine weitere Option.
Oder auf die Erledigt/Unerledigt Grafik klicken.
BL4CK_D3V!L
Zitat:
Original von Bräke
@BL4CK_D3V!L
Pass doch bitte auf wo du Themen erstellst, im 3.0 Bereich hats nix verloren und wenns um nen Hack geht immer im Supportthread posten.


Kenn den Hack nur hier von y******, kA ob der noch n bissel verbessert wurd.
Gruppenrechte einstellen, wer was darf bei dem Hack im ACP.
Foren einstellen wo der erscheinen soll.

Dann hat man im Thread unten bei Administrative Optionen eine weitere Option.
Oder auf die Erledigt/Unerledigt Grafik klicken.


I´m so sorry wenn ich in der falschen Ecke gelandet bin unglücklich

Auf jeden Fall danke für deine Antwort zu meiner Frage!
Kim79
huhuhuhu

also es wird alles angezeigt und so wieter nur wenn ich auch adminoption unten gehe und den tread als erledigt/unerledigt makieren will kommt nur ne weisse Seite verwirrt verwirrt verwirrt verwirrt verwirrt verwirrt verwirrt verwirrt
Bräke
Die modcp.php vergessen zu ändern oder hochzuladen. Prüf nochmal nach bitte.


PS: Ein bis zwei verwirrt reichen aus Augenzwinkern
rene1986
super hack!
Highländer
Besten Dank für diesen tollen Hack!

Eine kleine Frage hätte ich aber noch.

Wenn ich einen Thread verschiebe und folgendes anklicke...

"Thema verschieben und einen Verweis im ursprünglichen Forum lassen", dann ist auch das rote Kreuz im ersten Forum zu sehen. Kann man dieses nicht auch noch ändern, dass es dann in dem Bereich nicht angezeigt wird, wo der Bereich dazu frei geschaltet wurde, also so wie bei den Themen "Wichtig und Ankündigungen"?

In der Anleitung ist ein kleiner Fehler bei "Suche in acp/board_edit.htm
Suche in acp/board_add.htm"

Hinter acp fehlt dort noch templates/

Mfg
Highländer
Zitat:
Original von Highländer
Wenn ich einen Thread verschiebe und folgendes anklicke...

"Thema verschieben und einen Verweis im ursprünglichen Forum lassen", dann ist auch das rote Kreuz im ersten Forum zu sehen. Kann man dieses nicht auch noch ändern, dass es dann in dem Bereich nicht angezeigt wird, wo der Bereich dazu frei geschaltet wurde, also so wie bei den Themen "Wichtig und Ankündigungen"?

Ich habe mir es mal angeschaut und gesehen, dass die bb1_announcements dazu abgefragt wird.

Bei "Wichtig" ist dort eine 1 und bei "Ankündigung" eine 2 eingetragen. Bei allen anderen Threads, wie auch bei verschobenen Threads, ist dort eine 0 eingetragen.

Müsste doch eigentlich möglich sein, dass man zusätzlich noch eine Abfrage macht, ob ein Thema verschoben wurde und dann kein Zeichen von den beiden stehen bleibt.

Oder... ?

Mfg
Highländer
Nur mal so zur Info.

Der Fehler ist auch hier im Forum.
Link

Obwohl es im oberen Bereich ist, wird es als unerledigt markiert.

Das gleiche wäre dann auch, wenn man ein Thema verschiebt, zum anderen Bereich. Wird deswegen noch etwas geändert? Ansonsten baue ich den Hack lieber wieder aus.

Mfg
Bräke
board_threadbit.tpl

suche:
code:
1:
$threads['important'] == 1 || $threads['important'] == 2
füge dahinter
code:
1:
 || $threads['closed'] == 3
Bräke
Noch ein kleiner Fix hinterher, kannst ja mit in die Anleitung nehmen Ghosti. smile

Damit beim Verschieben mit Verweiß auch der Status Thread erledigt/unerledigt mit in den "Verschoben"-Link genommen wird, suche in:
acp/lib/mod_functions.php Abschnitt: function movethread

code:
1:
    if ($mode=="movewithredirect") $db->query("INSERT INTO bb".$n."_threads (boardid,prefix,topic,iconid,starttime,starterid,starter,lastposttime,lastposterid,lastposter,replycount,views,closed,voted,votepoints,pollid,visible) VALUES ('$boardid','".addslashes($prefix)."','".addslashes($thread['topic'])."','$thread[iconid]','$thread[starttime]','$thread[starterid]','".addslashes($thread['starter'])."','$thread[lastposttime]','$thread[lastposterid]','".addslashes($thread['lastposter'])."','$thread[replycount]','$thread[views]','3','$thread[voted]','$thread[votepoints]','$threadid','$thread[visible]')");

ersetze durch:
code:
1:
    if ($mode=="movewithredirect") $db->query("INSERT INTO bb".$n."_threads (boardid,prefix,topic,iconid,starttime,starterid,starter,lastposttime,lastposterid,lastposter,replycount,views,closed,settled,voted,votepoints,pollid,visible) VALUES ('$boardid','".addslashes($prefix)."','".addslashes($thread['topic'])."','$thread[iconid]','$thread[starttime]','$thread[starterid]','".addslashes($thread['starter'])."','$thread[lastposttime]','$thread[lastposterid]','".addslashes($thread['lastposter'])."','$thread[replycount]','$thread[views]','3','$thread[settled]','$thread[voted]','$thread[votepoints]','$threadid','$thread[visible]')");