[ Index ] |
PHP Cross Reference of MyBB |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MyBB 1.6 4 * Copyright 2010 MyBB Group, All Rights Reserved 5 * 6 * Website: http://mybb.com 7 * License: http://mybb.com/about/license 8 * 9 * $Id$ 10 */ 11 12 // Disallow direct access to this file for security reasons 13 if(!defined("IN_MYBB")) 14 { 15 die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined."); 16 } 17 18 $page->add_breadcrumb_item($lang->mod_tools, "index.php?module=config-mod_tools"); 19 20 $plugins->run_hooks("admin_config_mod_tools_begin"); 21 22 if($mybb->input['action'] == "delete_post_tool") 23 { 24 $plugins->run_hooks("admin_config_mod_tools_delete_post_tool"); 25 26 $query = $db->simple_select("modtools", "*", "tid='{$mybb->input['tid']}'"); 27 $tool = $db->fetch_array($query); 28 29 // Does the post tool not exist? 30 if(!$tool['tid']) 31 { 32 flash_message($lang->error_invalid_post_tool, 'error'); 33 admin_redirect("index.php?module=config-mod_tools&action=post_tools"); 34 } 35 36 // User clicked no 37 if($mybb->input['no']) 38 { 39 admin_redirect("index.php?module=config-mod_tools&action=post_tools"); 40 } 41 42 if($mybb->request_method == 'post') 43 { 44 // Delete the type 45 $db->delete_query('modtools', "tid='{$tool['tid']}'"); 46 47 $plugins->run_hooks("admin_config_mod_tools_delete_post_tool_commit"); 48 49 // Log admin action 50 log_admin_action($tool['tid'], $tool['name']); 51 $cache->update_forumsdisplay(); 52 53 flash_message($lang->success_post_tool_deleted, 'success'); 54 admin_redirect("index.php?module=config-mod_tools&action=post_tools"); 55 } 56 else 57 { 58 $page->output_confirm_action("index.php?module=config-mod_tools&action=post_tools&tid={$type['tid']}", $lang->confirm_post_tool_deletion); 59 } 60 } 61 62 if($mybb->input['action'] == "delete_thread_tool") 63 { 64 $plugins->run_hooks("admin_config_mod_tools_delete_thread_tool"); 65 66 $query = $db->simple_select("modtools", "*", "tid='{$mybb->input['tid']}'"); 67 $tool = $db->fetch_array($query); 68 69 // Does the post tool not exist? 70 if(!$tool['tid']) 71 { 72 flash_message($lang->error_invalid_thread_tool, 'error'); 73 admin_redirect("index.php?module=config-mod_tools"); 74 } 75 76 // User clicked no 77 if($mybb->input['no']) 78 { 79 admin_redirect("index.php?module=config-mod_tools"); 80 } 81 82 if($mybb->request_method == 'post') 83 { 84 // Delete the type 85 $db->delete_query('modtools', "tid='{$tool['tid']}'"); 86 87 $plugins->run_hooks("admin_config_mod_tools_delete_thread_tool_commit"); 88 89 // Log admin action 90 log_admin_action($tool['tid'], $tool['name']); 91 $cache->update_forumsdisplay(); 92 93 flash_message($lang->success_thread_tool_deleted, 'success'); 94 admin_redirect("index.php?module=config-mod_tools"); 95 } 96 else 97 { 98 $page->output_confirm_action("index.php?module=config-mod_tools&action=delete_thread_tool&tid={$tool['tid']}", $lang->confirm_thread_tool_deletion); 99 } 100 } 101 102 103 if($mybb->input['action'] == "post_tools") 104 { 105 $plugins->run_hooks("admin_config_mod_tools_post_tools"); 106 107 $page->add_breadcrumb_item($lang->post_tools); 108 $page->output_header($lang->mod_tools." - ".$lang->post_tools); 109 110 $sub_tabs['thread_tools'] = array( 111 'title' => $lang->thread_tools, 112 'link' => "index.php?module=config-mod_tools" 113 ); 114 $sub_tabs['add_thread_tool'] = array( 115 'title'=> $lang->add_thread_tool, 116 'link' => "index.php?module=config-mod_tools&action=add_thread_tool" 117 ); 118 $sub_tabs['post_tools'] = array( 119 'title' => $lang->post_tools, 120 'link' => "index.php?module=config-mod_tools&action=post_tools", 121 'description' => $lang->post_tools_desc 122 ); 123 $sub_tabs['add_post_tool'] = array( 124 'title'=> $lang->add_post_tool, 125 'link' => "index.php?module=config-mod_tools&action=add_post_tool" 126 ); 127 128 $page->output_nav_tabs($sub_tabs, 'post_tools'); 129 130 $table = new Table; 131 $table->construct_header($lang->title); 132 $table->construct_header($lang->controls, array('class' => "align_center", 'colspan' => 2)); 133 134 $query = $db->simple_select('modtools', 'tid, name, description, type', "type='p'", array('order_by' => 'name')); 135 while($tool = $db->fetch_array($query)) 136 { 137 $table->construct_cell("<a href=\"index.php?module=config-mod_tools&action=edit_post_tool&tid={$tool['tid']}\"><strong>".htmlspecialchars_uni($tool['name'])."</strong></a><br /><small>".htmlspecialchars_uni($tool['description'])."</small>"); 138 $table->construct_cell("<a href=\"index.php?module=config-mod_tools&action=edit_post_tool&tid={$tool['tid']}\">{$lang->edit}</a>", array('width' => 100, 'class' => "align_center")); 139 $table->construct_cell("<a href=\"index.php?module=config-mod_tools&action=delete_post_tool&tid={$tool['tid']}&my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_post_tool_deletion}')\">{$lang->delete}</a>", array('width' => 100, 'class' => "align_center")); 140 $table->construct_row(); 141 } 142 143 if($table->num_rows() == 0) 144 { 145 $table->construct_cell($lang->no_post_tools, array('colspan' => 3)); 146 $table->construct_row(); 147 } 148 149 $table->output($lang->post_tools); 150 151 $page->output_footer(); 152 } 153 154 if($mybb->input['action'] == "edit_thread_tool") 155 { 156 $plugins->run_hooks("admin_config_mod_tools_edit_thread_tool"); 157 158 $query = $db->simple_select("modtools", "COUNT(tid) as tools", "tid = '{$mybb->input['tid']}' AND type='t'"); 159 if($db->fetch_field($query, "tools") < 1) 160 { 161 flash_message($lang->error_invalid_thread_tool, 'error'); 162 admin_redirect("index.php?module=config-mod_tools"); 163 } 164 165 if($mybb->request_method == 'post') 166 { 167 if(trim($mybb->input['title']) == "") 168 { 169 $errors[] = $lang->error_missing_title; 170 } 171 172 if(trim($mybb->input['description']) == "") 173 { 174 $errors[] = $lang->error_missing_description; 175 } 176 177 if($mybb->input['forum_type'] == 2) 178 { 179 $forum_checked[1] = ''; 180 $forum_checked[2] = "checked=\"checked\""; 181 182 if(count($mybb->input['forum_1_forums']) < 1) 183 { 184 $errors[] = $lang->error_no_forums_selected; 185 } 186 } 187 else 188 { 189 $forum_checked[1] = "checked=\"checked\""; 190 $forum_checked[2] = ''; 191 192 $mybb->input['forum_1_forums'] = ''; 193 } 194 195 196 if($mybb->input['approvethread'] != '' && $mybb->input['approvethread'] != 'approve' && $mybb->input['approvethread'] != 'unapprove' && $mybb->input['approvethread'] != 'toggle') 197 { 198 $mybb->input['approvethread'] = ''; 199 } 200 201 if($mybb->input['openthread'] != '' && $mybb->input['openthread'] != 'open' && $mybb->input['openthread'] != 'close' && $mybb->input['openthread'] != 'toggle') 202 { 203 $mybb->input['openthread'] = ''; 204 } 205 206 if($mybb->input['move_type'] == 2) 207 { 208 $move_checked[1] = ''; 209 $move_checked[2] = "checked=\"checked\""; 210 211 if(!$mybb->input['move_1_forum']) 212 { 213 $errors[] = $lang->error_no_move_forum_selected; 214 } 215 else 216 { 217 // Check that the destination forum is not a category 218 $query = $db->simple_select("forums", "type", "fid = '".intval($mybb->input['move_1_forum'])."'"); 219 if($db->fetch_field($query, "type") == "c") 220 { 221 $errors[] = $lang->error_forum_is_category; 222 } 223 } 224 225 if($mybb->input['move_2_redirect'] != 1 && $mybb->input['move_2_redirect'] != 0) 226 { 227 $mybb->input['move_2_redirect'] = 0; 228 } 229 230 if(!isset($mybb->input['move_3_redirecttime'])) 231 { 232 $mybb->input['move_3_redirecttime'] = ''; 233 } 234 } 235 else 236 { 237 $move_checked[1] = "checked=\"checked\""; 238 $move_checked[2] = ''; 239 240 $mybb->input['move_1_forum'] = ''; 241 $mybb->input['move_2_redirect'] = 0; 242 $mybb->input['move_3_redirecttime'] = ''; 243 } 244 245 if($mybb->input['copy_type'] == 2) 246 { 247 $copy_checked[1] = ''; 248 $copy_checked[2] = "checked=\"checked\""; 249 250 if(!$mybb->input['copy_1_forum']) 251 { 252 $errors[] = $lang->error_no_copy_forum_selected; 253 } 254 else 255 { 256 $query = $db->simple_select("forums", "type", "fid = '".intval($mybb->input['copy_1_forum'])."'"); 257 if($db->fetch_field($query, "type") == "c") 258 { 259 $errors[] = $lang->error_forum_is_category; 260 } 261 } 262 } 263 else 264 { 265 $copy_checked[1] = "checked=\"checked\""; 266 $copy_checked[2] = ''; 267 268 $mybb->input['copy_1_forum'] = ''; 269 } 270 271 if(!$errors) 272 { 273 $thread_options = array( 274 'deletethread' => $mybb->input['deletethread'], 275 'mergethreads' => $mybb->input['mergethreads'], 276 'deletepoll' => $mybb->input['deletepoll'], 277 'removeredirects' => $mybb->input['removeredirects'], 278 'approvethread' => $mybb->input['approvethread'], 279 'openthread' => $mybb->input['openthread'], 280 'movethread' => intval($mybb->input['move_1_forum']), 281 'movethreadredirect' => $mybb->input['move_2_redirect'], 282 'movethreadredirectexpire' => intval($mybb->input['move_3_redirecttime']), 283 'copythread' => intval($mybb->input['copy_1_forum']), 284 'newsubject' => $mybb->input['newsubject'], 285 'addreply' => $mybb->input['newreply'], 286 'replysubject' => $mybb->input['newreplysubject'], 287 'threadprefix' => intval($mybb->input['threadprefix']) 288 ); 289 290 $update_tool['type'] = 't'; 291 $update_tool['threadoptions'] = $db->escape_string(serialize($thread_options)); 292 $update_tool['name'] = $db->escape_string($mybb->input['title']); 293 $update_tool['description'] = $db->escape_string($mybb->input['description']); 294 $update_tool['forums'] = ''; 295 296 if(is_array($mybb->input['forum_1_forums'])) 297 { 298 foreach($mybb->input['forum_1_forums'] as $fid) 299 { 300 $checked[] = intval($fid); 301 } 302 $update_tool['forums'] = implode(',', $checked); 303 } 304 305 $db->update_query("modtools", $update_tool, "tid='{$mybb->input['tid']}'"); 306 307 $plugins->run_hooks("admin_config_mod_tools_edit_thread_tool_commit"); 308 309 // Log admin action 310 log_admin_action($mybb->input['tid'], $mybb->input['title']); 311 $cache->update_forumsdisplay(); 312 313 flash_message($lang->success_mod_tool_updated, 'success'); 314 admin_redirect("index.php?module=config-mod_tools"); 315 } 316 } 317 318 $page->add_breadcrumb_item($lang->edit_thread_tool); 319 $page->output_header($lang->mod_tools." - ".$lang->edit_thread_tool); 320 321 $sub_tabs['edit_thread_tool'] = array( 322 "title" => $lang->edit_thread_tool, 323 "description" => $lang->edit_thread_tool_desc, 324 "link" => "index.php?module=config-mod_tools" 325 ); 326 327 $page->output_nav_tabs($sub_tabs, 'edit_thread_tool'); 328 329 $form = new Form("index.php?module=config-mod_tools&action=edit_thread_tool", 'post'); 330 echo $form->generate_hidden_field("tid", $mybb->input['tid']); 331 332 if($errors) 333 { 334 $page->output_inline_error($errors); 335 } 336 else 337 { 338 $query = $db->simple_select("modtools", "*", "tid = '{$mybb->input['tid']}'"); 339 $modtool = $db->fetch_array($query); 340 $thread_options = unserialize($modtool['threadoptions']); 341 342 $mybb->input['title'] = $modtool['name']; 343 $mybb->input['description'] = $modtool['description']; 344 $mybb->input['forum_1_forums'] = explode(",", $modtool['forums']); 345 346 if(!$modtool['forums'] || $modtool['forums'] == -1) 347 { 348 $forum_checked[1] = "checked=\"checked\""; 349 $forum_checked[2] = ''; 350 } 351 else 352 { 353 $forum_checked[1] = ''; 354 $forum_checked[2] = "checked=\"checked\""; 355 } 356 357 $mybb->input['approvethread'] = $thread_options['approvethread']; 358 $mybb->input['openthread'] = $thread_options['openthread']; 359 $mybb->input['move_1_forum'] = $thread_options['movethread']; 360 $mybb->input['move_2_redirect'] = $thread_options['movethreadredirect']; 361 $mybb->input['move_3_redirecttime'] = $thread_options['movethreadredirectexpire']; 362 363 if(!$thread_options['movethread']) 364 { 365 $move_checked[1] = "checked=\"checked\""; 366 $move_checked[2] = ''; 367 } 368 else 369 { 370 $move_checked[1] = ''; 371 $move_checked[2] = "checked=\"checked\""; 372 } 373 374 if(!$thread_options['copythread']) 375 { 376 $copy_checked[1] = "checked=\"checked\""; 377 $copy_checked[2] = ''; 378 } 379 else 380 { 381 $copy_checked[1] = ''; 382 $copy_checked[2] = "checked=\"checked\""; 383 } 384 385 $mybb->input['copy_1_forum'] = $thread_options['copythread']; 386 $mybb->input['deletethread'] = $thread_options['deletethread']; 387 $mybb->input['mergethreads'] = $thread_options['mergethreads']; 388 $mybb->input['deletepoll'] = $thread_options['deletepoll']; 389 $mybb->input['removeredirects'] = $thread_options['removeredirects']; 390 $mybb->input['threadprefix'] = $thread_options['threadprefix']; 391 $mybb->input['newsubject'] = $thread_options['newsubject']; 392 $mybb->input['newreply'] = $thread_options['addreply']; 393 $mybb->input['newreplysubject'] = $thread_options['replysubject']; 394 } 395 396 $form_container = new FormContainer($lang->general_options); 397 $form_container->output_row($lang->name." <em>*</em>", '', $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title'); 398 $form_container->output_row($lang->short_description." <em>*</em>", '', $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description'); 399 400 401 $actions = "<script type=\"text/javascript\"> 402 function checkAction(id) 403 { 404 var checked = ''; 405 406 $$('.'+id+'s_check').each(function(e) 407 { 408 if(e.checked == true) 409 { 410 checked = e.value; 411 } 412 }); 413 $$('.'+id+'s').each(function(e) 414 { 415 Element.hide(e); 416 }); 417 if($(id+'_'+checked)) 418 { 419 Element.show(id+'_'+checked); 420 } 421 } 422 </script> 423 <dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\"> 424 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"forum_type\" value=\"1\" {$forum_checked[1]} class=\"forums_check\" onclick=\"checkAction('forum');\" style=\"vertical-align: middle;\" /> <strong>{$lang->all_forums}</strong></label></dt> 425 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"forum_type\" value=\"2\" {$forum_checked[2]} class=\"forums_check\" onclick=\"checkAction('forum');\" style=\"vertical-align: middle;\" /> <strong>{$lang->select_forums}</strong></label></dt> 426 <dd style=\"margin-top: 4px;\" id=\"forum_2\" class=\"forums\"> 427 <table cellpadding=\"4\"> 428 <tr> 429 <td valign=\"top\"><small>{$lang->forums_colon}</small></td> 430 <td>".$form->generate_forum_select('forum_1_forums[]', $mybb->input['forum_1_forums'], array('multiple' => true, 'size' => 5))."</td> 431 </tr> 432 </table> 433 </dd> 434 </dl> 435 <script type=\"text/javascript\"> 436 checkAction('forum'); 437 </script>"; 438 $form_container->output_row($lang->available_in_forums." <em>*</em>", '', $actions); 439 $form_container->end(); 440 441 $approve_unapprove = array( 442 '' => $lang->no_change, 443 'approve' => $lang->approve, 444 'unapprove' => $lang->unapprove, 445 'toggle' => $lang->toggle 446 ); 447 448 $open_close = array( 449 '' => $lang->no_change, 450 'open' => $lang->open, 451 'close' => $lang->close, 452 'toggle' => $lang->toggle 453 ); 454 455 $form_container = new FormContainer($lang->thread_moderation); 456 $form_container->output_row($lang->approve_unapprove." <em>*</em>", '', $form->generate_select_box('approvethread', $approve_unapprove, $mybb->input['approvethread'], array('id' => 'approvethread')), 'approvethread'); 457 $form_container->output_row($lang->open_close_thread." <em>*</em>", '', $form->generate_select_box('openthread', $open_close, $mybb->input['openthread'], array('id' => 'openthread')), 'openthread'); 458 459 460 $actions = " 461 <dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\"> 462 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"move_type\" value=\"1\" {$move_checked[1]} class=\"moves_check\" onclick=\"checkAction('move');\" style=\"vertical-align: middle;\" /> <strong>{$lang->do_not_move_thread}</strong></label></dt> 463 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"move_type\" value=\"2\" {$move_checked[2]} class=\"moves_check\" onclick=\"checkAction('move');\" style=\"vertical-align: middle;\" /> <strong>{$lang->move_thread}</strong></label></dt> 464 <dd style=\"margin-top: 4px;\" id=\"move_2\" class=\"moves\"> 465 <table cellpadding=\"4\"> 466 <tr> 467 <td><small>{$lang->forum_to_move_to}</small></td> 468 <td>".$form->generate_forum_select('move_1_forum', $mybb->input['move_1_forum'])."</td> 469 </tr> 470 <tr> 471 <td><small>{$lang->leave_redirect}</small></td> 472 <td>".$form->generate_yes_no_radio('move_2_redirect', $mybb->input['move_2_redirect'], array('style' => 'width: 2em;'))."</td> 473 </tr> 474 <tr> 475 <td><small>{$lang->delete_redirect_after}</small></td> 476 <td>".$form->generate_text_box('move_3_redirecttime', $mybb->input['move_3_redirecttime'], array('style' => 'width: 2em;'))." {$lang->days}</td> 477 </tr> 478 </table> 479 </dd> 480 </dl> 481 <script type=\"text/javascript\"> 482 checkAction('move'); 483 </script>"; 484 $form_container->output_row($lang->move_thread." <em>*</em>", $lang->move_thread_desc, $actions); 485 486 $actions = " 487 <dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\"> 488 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"copy_type\" value=\"1\" {$copy_checked[1]} class=\"copys_check\" onclick=\"checkAction('copy');\" style=\"vertical-align: middle;\" /> <strong>{$lang->do_not_copy_thread}</strong></label></dt> 489 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"copy_type\" value=\"2\" {$copy_checked[2]} class=\"copys_check\" onclick=\"checkAction('copy');\" style=\"vertical-align: middle;\" /> <strong>{$lang->copy_thread}</strong></label></dt> 490 <dd style=\"margin-top: 4px;\" id=\"copy_2\" class=\"copys\"> 491 <table cellpadding=\"4\"> 492 <tr> 493 <td><small>{$lang->forum_to_copy_to}</small></td> 494 <td>".$form->generate_forum_select('copy_1_forum', $mybb->input['copy_1_forum'])."</td> 495 </tr> 496 </table> 497 </dd> 498 </dl> 499 <script type=\"text/javascript\"> 500 checkAction('copy'); 501 </script>"; 502 $form_container->output_row($lang->copy_thread." <em>*</em>", '', $actions); 503 $form_container->output_row($lang->delete_thread." <em>*</em>", '', $form->generate_yes_no_radio('deletethread', $mybb->input['deletethread'], array('style' => 'width: 2em;'))); 504 $form_container->output_row($lang->merge_thread." <em>*</em>", $lang->merge_thread_desc, $form->generate_yes_no_radio('mergethreads', $mybb->input['mergethreads'], array('style' => 'width: 2em;'))); 505 $form_container->output_row($lang->delete_poll." <em>*</em>", '', $form->generate_yes_no_radio('deletepoll', $mybb->input['deletepoll'], array('style' => 'width: 2em;'))); 506 $form_container->output_row($lang->delete_redirects." <em>*</em>", '', $form->generate_yes_no_radio('removeredirects', $mybb->input['removeredirects'], array('style' => 'width: 2em;'))); 507 508 $query = $db->simple_select('threadprefixes', 'pid, prefix'); 509 if($db->num_rows($query) > 0) 510 { 511 $thread_prefixes = array( 512 '-1' => $lang->no_change, 513 '0' => $lang->no_prefix 514 ); 515 516 while($prefix = $db->fetch_array($query)) 517 { 518 $thread_prefixes[$prefix['pid']] = $prefix['prefix']; 519 } 520 521 $form_container->output_row($lang->apply_thread_prefix." <em>*</em>", '', $form->generate_select_box('threadprefix', $thread_prefixes, array(intval($mybb->input['threadprefix'])), array('id' => 'threadprefix')), 'threadprefix'); 522 } 523 524 $form_container->output_row($lang->new_subject." <em>*</em>", $lang->new_subject_desc, $form->generate_text_box('newsubject', $mybb->input['newsubject'], array('id' => 'newsubject'))); 525 $form_container->end(); 526 527 $form_container = new FormContainer($lang->add_new_reply); 528 $form_container->output_row($lang->add_new_reply, $lang->add_new_reply_desc, $form->generate_text_area('newreply', $mybb->input['newreply'], array('id' => 'newreply')), 'newreply'); 529 $form_container->output_row($lang->reply_subject, $lang->reply_subject_desc, $form->generate_text_box('newreplysubject', $mybb->input['newreplysubject'], array('id' => 'newreplysubject')), 'newreplysubject'); 530 $form_container->end(); 531 532 $buttons[] = $form->generate_submit_button($lang->save_thread_tool); 533 534 $form->output_submit_wrapper($buttons); 535 $form->end(); 536 537 $page->output_footer(); 538 } 539 540 if($mybb->input['action'] == "add_thread_tool") 541 { 542 $plugins->run_hooks("admin_config_mod_tools_add_thread_tool"); 543 544 if($mybb->request_method == 'post') 545 { 546 if(trim($mybb->input['title']) == "") 547 { 548 $errors[] = $lang->error_missing_title; 549 } 550 551 if(trim($mybb->input['description']) == "") 552 { 553 $errors[] = $lang->error_missing_description; 554 } 555 556 if($mybb->input['forum_type'] == 2) 557 { 558 $forum_checked[1] = ''; 559 $forum_checked[2] = "checked=\"checked\""; 560 561 if(count($mybb->input['forum_1_forums']) < 1) 562 { 563 $errors[] = $lang->error_no_forums_selected; 564 } 565 } 566 else 567 { 568 $forum_checked[1] = "checked=\"checked\""; 569 $forum_checked[2] = ''; 570 571 $mybb->input['forum_1_forums'] = ''; 572 } 573 574 575 if($mybb->input['approvethread'] != '' && $mybb->input['approvethread'] != 'approve' && $mybb->input['approvethread'] != 'unapprove' && $mybb->input['approvethread'] != 'toggle') 576 { 577 $mybb->input['approvethread'] = ''; 578 } 579 580 if($mybb->input['openthread'] != '' && $mybb->input['openthread'] != 'open' && $mybb->input['openthread'] != 'close' && $mybb->input['openthread'] != 'toggle') 581 { 582 $mybb->input['openthread'] = ''; 583 } 584 585 if(!intval($mybb->input['threadprefix'])) 586 { 587 $mybb->input['threadprefix'] = ''; 588 } 589 590 if($mybb->input['move_type'] == 2) 591 { 592 $move_checked[1] = ''; 593 $move_checked[2] = "checked=\"checked\""; 594 595 if(!$mybb->input['move_1_forum']) 596 { 597 $errors[] = $lang->error_no_move_forum_selected; 598 } 599 else 600 { 601 // Check that the destination forum is not a category 602 $query = $db->simple_select("forums", "type", "fid = '".intval($mybb->input['move_1_forum'])."'"); 603 if($db->fetch_field($query, "type") == "c") 604 { 605 $errors[] = $lang->error_forum_is_category; 606 } 607 } 608 } 609 else 610 { 611 $move_checked[1] = "checked=\"checked\""; 612 $move_checked[2] = ''; 613 614 $mybb->input['move_1_forum'] = ''; 615 $mybb->input['move_2_redirect'] = 0; 616 $mybb->input['move_3_redirecttime'] = ''; 617 } 618 619 if($mybb->input['copy_type'] == 2) 620 { 621 $copy_checked[1] = ''; 622 $copy_checked[2] = "checked=\"checked\""; 623 624 if(!$mybb->input['copy_1_forum']) 625 { 626 $errors[] = $lang->error_no_copy_forum_selected; 627 } 628 else 629 { 630 $query = $db->simple_select("forums", "type", "fid = '".intval($mybb->input['copy_1_forum'])."'"); 631 if($db->fetch_field($query, "type") == "c") 632 { 633 $errors[] = $lang->error_forum_is_category; 634 } 635 } 636 } 637 else 638 { 639 $copy_checked[1] = "checked=\"checked\""; 640 $copy_checked[2] = ''; 641 642 $mybb->input['copy_1_forum'] = ''; 643 } 644 645 if(!$errors) 646 { 647 $thread_options = array( 648 'deletethread' => $mybb->input['deletethread'], 649 'mergethreads' => $mybb->input['mergethreads'], 650 'deletepoll' => $mybb->input['deletepoll'], 651 'removeredirects' => $mybb->input['removeredirects'], 652 'approvethread' => $mybb->input['approvethread'], 653 'openthread' => $mybb->input['openthread'], 654 'movethread' => intval($mybb->input['move_1_forum']), 655 'movethreadredirect' => $mybb->input['move_2_redirect'], 656 'movethreadredirectexpire' => intval($mybb->input['move_3_redirecttime']), 657 'copythread' => intval($mybb->input['copy_1_forum']), 658 'newsubject' => $mybb->input['newsubject'], 659 'addreply' => $mybb->input['newreply'], 660 'replysubject' => $mybb->input['newreplysubject'], 661 'threadprefix' => $mybb->input['threadprefix'], 662 ); 663 664 $new_tool['type'] = 't'; 665 $new_tool['threadoptions'] = $db->escape_string(serialize($thread_options)); 666 $new_tool['name'] = $db->escape_string($mybb->input['title']); 667 $new_tool['description'] = $db->escape_string($mybb->input['description']); 668 $new_tool['forums'] = ''; 669 $new_tool['postoptions'] = ''; 670 671 if($mybb->input['forum_type'] == 2) 672 { 673 if(is_array($mybb->input['forum_1_forums'])) 674 { 675 foreach($mybb->input['forum_1_forums'] as $fid) 676 { 677 $checked[] = intval($fid); 678 } 679 $new_tool['forums'] = implode(',', $checked); 680 } 681 } 682 else 683 { 684 $new_tool['forums'] = "-1"; 685 } 686 687 if(intval($mybb->input['threadprefix']) >= 0) 688 { 689 $thread_options['threadprefix'] = intval($mybb->input['threadprefix']); 690 } 691 692 $tid = $db->insert_query("modtools", $new_tool); 693 694 $plugins->run_hooks("admin_config_mod_tools_add_thread_tool_commit"); 695 696 // Log admin action 697 log_admin_action($tid, $mybb->input['title']); 698 $cache->update_forumsdisplay(); 699 700 flash_message($lang->success_mod_tool_created, 'success'); 701 admin_redirect("index.php?module=config-mod_tools"); 702 } 703 } 704 705 $page->add_breadcrumb_item($lang->add_new_thread_tool); 706 $page->output_header($lang->mod_tools." - ".$lang->add_new_thread_tool); 707 708 $sub_tabs['thread_tools'] = array( 709 'title' => $lang->thread_tools, 710 'link' => "index.php?module=config-mod_tools" 711 ); 712 $sub_tabs['add_thread_tool'] = array( 713 'title'=> $lang->add_new_thread_tool, 714 'link' => "index.php?module=config-mod_tools&action=add_thread_tool", 715 'description' => $lang->add_thread_tool_desc 716 ); 717 $sub_tabs['post_tools'] = array( 718 'title' => $lang->post_tools, 719 'link' => "index.php?module=config-mod_tools&action=post_tools", 720 ); 721 $sub_tabs['add_post_tool'] = array( 722 'title'=> $lang->add_new_post_tool, 723 'link' => "index.php?module=config-mod_tools&action=add_post_tool" 724 ); 725 726 $page->output_nav_tabs($sub_tabs, 'add_thread_tool'); 727 728 $form = new Form("index.php?module=config-mod_tools&action=add_thread_tool", 'post'); 729 730 if($errors) 731 { 732 $page->output_inline_error($errors); 733 } 734 else 735 { 736 $mybb->input['title'] = ''; 737 $mybb->input['description'] = ''; 738 $mybb->input['forum_1_forums'] = ''; 739 $forum_checked[1] = "checked=\"checked\""; 740 $forum_checked[2] = ''; 741 $mybb->input['approvethread'] = ''; 742 $mybb->input['openthread'] = ''; 743 $mybb->input['move_1_forum'] = ''; 744 $mybb->input['move_2_redirect'] = '0'; 745 $mybb->input['move_3_redirecttime'] = ''; 746 $move_checked[1] = "checked=\"checked\""; 747 $move_checked[2] = ''; 748 $copy_checked[1] = "checked=\"checked\""; 749 $copy_checked[2] = ''; 750 $mybb->input['copy_1_forum'] = ''; 751 $mybb->input['deletethread'] = '0'; 752 $mybb->input['mergethreads'] = '0'; 753 $mybb->input['deletepoll'] = '0'; 754 $mybb->input['removeredirects'] = '0'; 755 $mybb->input['threadprefix'] = '-1'; 756 $mybb->input['newsubject'] = '{subject}'; 757 $mybb->input['newreply'] = ''; 758 $mybb->input['newreplysubject'] = '{subject}'; 759 } 760 761 $form_container = new FormContainer($lang->general_options); 762 $form_container->output_row($lang->name." <em>*</em>", '', $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title'); 763 $form_container->output_row($lang->short_description." <em>*</em>", '', $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description'); 764 765 766 $actions = "<script type=\"text/javascript\"> 767 function checkAction(id) 768 { 769 var checked = ''; 770 771 $$('.'+id+'s_check').each(function(e) 772 { 773 if(e.checked == true) 774 { 775 checked = e.value; 776 } 777 }); 778 $$('.'+id+'s').each(function(e) 779 { 780 Element.hide(e); 781 }); 782 if($(id+'_'+checked)) 783 { 784 Element.show(id+'_'+checked); 785 } 786 } 787 </script> 788 <dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\"> 789 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"forum_type\" value=\"1\" {$forum_checked[1]} class=\"forums_check\" onclick=\"checkAction('forum');\" style=\"vertical-align: middle;\" /> <strong>{$lang->all_forums}</strong></label></dt> 790 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"forum_type\" value=\"2\" {$forum_checked[2]} class=\"forums_check\" onclick=\"checkAction('forum');\" style=\"vertical-align: middle;\" /> <strong>{$lang->select_forums}</strong></label></dt> 791 <dd style=\"margin-top: 4px;\" id=\"forum_2\" class=\"forums\"> 792 <table cellpadding=\"4\"> 793 <tr> 794 <td valign=\"top\"><small>{$lang->forums_colon}</small></td> 795 <td>".$form->generate_forum_select('forum_1_forums[]', $mybb->input['forum_1_forums'], array('multiple' => true, 'size' => 5))."</td> 796 </tr> 797 </table> 798 </dd> 799 </dl> 800 <script type=\"text/javascript\"> 801 checkAction('forum'); 802 </script>"; 803 $form_container->output_row($lang->available_in_forums." <em>*</em>", '', $actions); 804 $form_container->end(); 805 806 $approve_unapprove = array( 807 '' => $lang->no_change, 808 'approve' => $lang->approve, 809 'unapprove' => $lang->unapprove, 810 'toggle' => $lang->toggle 811 ); 812 813 $open_close = array( 814 '' => $lang->no_change, 815 'open' => $lang->open, 816 'close' => $lang->close, 817 'toggle' => $lang->toggle 818 ); 819 820 $form_container = new FormContainer($lang->thread_moderation); 821 $form_container->output_row($lang->approve_unapprove." <em>*</em>", '', $form->generate_select_box('approvethread', $approve_unapprove, $mybb->input['approvethread'], array('id' => 'approvethread')), 'approvethread'); 822 $form_container->output_row($lang->open_close_thread." <em>*</em>", '', $form->generate_select_box('openthread', $open_close, $mybb->input['openthread'], array('id' => 'openthread')), 'openthread'); 823 824 825 $actions = " 826 <dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\"> 827 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"move_type\" value=\"1\" {$move_checked[1]} class=\"moves_check\" onclick=\"checkAction('move');\" style=\"vertical-align: middle;\" /> <strong>{$lang->do_not_move_thread}</strong></label></dt> 828 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"move_type\" value=\"2\" {$move_checked[2]} class=\"moves_check\" onclick=\"checkAction('move');\" style=\"vertical-align: middle;\" /> <strong>{$lang->move_thread}</strong></label></dt> 829 <dd style=\"margin-top: 4px;\" id=\"move_2\" class=\"moves\"> 830 <table cellpadding=\"4\"> 831 <tr> 832 <td><small>{$lang->forum_to_move_to}</small></td> 833 <td>".$form->generate_forum_select('move_1_forum', $mybb->input['move_1_forum'])."</td> 834 </tr> 835 <tr> 836 <td><small>{$lang->leave_redirect}</small></td> 837 <td>".$form->generate_yes_no_radio('move_2_redirect', $mybb->input['move_2_redirect'], array('style' => 'width: 2em;'))."</td> 838 </tr> 839 <tr> 840 <td><small>{$lang->delete_redirect_after}</small></td> 841 <td>".$form->generate_text_box('move_3_redirecttime', $mybb->input['move_3_redirecttime'], array('style' => 'width: 2em;'))." {$lang->days}</td> 842 </tr> 843 </table> 844 </dd> 845 </dl> 846 <script type=\"text/javascript\"> 847 checkAction('move'); 848 </script>"; 849 $form_container->output_row($lang->move_thread." <em>*</em>", $lang->move_thread_desc, $actions); 850 851 $actions = " 852 <dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\"> 853 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"copy_type\" value=\"1\" {$copy_checked[1]} class=\"copys_check\" onclick=\"checkAction('copy');\" style=\"vertical-align: middle;\" /> <strong>{$lang->do_not_copy_thread}</strong></label></dt> 854 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"copy_type\" value=\"2\" {$copy_checked[2]} class=\"copys_check\" onclick=\"checkAction('copy');\" style=\"vertical-align: middle;\" /> <strong>{$lang->copy_thread}</strong></label></dt> 855 <dd style=\"margin-top: 4px;\" id=\"copy_2\" class=\"copys\"> 856 <table cellpadding=\"4\"> 857 <tr> 858 <td><small>{$lang->forum_to_copy_to}</small></td> 859 <td>".$form->generate_forum_select('copy_1_forum', $mybb->input['copy_1_forum'])."</td> 860 </tr> 861 </table> 862 </dd> 863 </dl> 864 <script type=\"text/javascript\"> 865 checkAction('copy'); 866 </script>"; 867 $form_container->output_row($lang->copy_thread." <em>*</em>", '', $actions); 868 $form_container->output_row($lang->delete_thread." <em>*</em>", '', $form->generate_yes_no_radio('deletethread', $mybb->input['deletethread'], array('style' => 'width: 2em;'))); 869 $form_container->output_row($lang->merge_thread." <em>*</em>", $lang->merge_thread_desc, $form->generate_yes_no_radio('mergethreads', $mybb->input['mergethreads'], array('style' => 'width: 2em;'))); 870 $form_container->output_row($lang->delete_poll." <em>*</em>", '', $form->generate_yes_no_radio('deletepoll', $mybb->input['deletepoll'], array('style' => 'width: 2em;'))); 871 $form_container->output_row($lang->delete_redirects." <em>*</em>", '', $form->generate_yes_no_radio('removeredirects', $mybb->input['removeredirects'], array('style' => 'width: 2em;'))); 872 873 $query = $db->simple_select('threadprefixes', 'pid, prefix'); 874 if($db->num_rows($query) > 0) 875 { 876 $thread_prefixes = array( 877 '-1' => $lang->no_change, 878 '0' => $lang->no_prefix 879 ); 880 881 while($prefix = $db->fetch_array($query)) 882 { 883 $thread_prefixes[$prefix['pid']] = $prefix['prefix']; 884 } 885 886 $form_container->output_row($lang->apply_thread_prefix." <em>*</em>", '', $form->generate_select_box('threadprefix', $thread_prefixes, $mybb->input['threadprefix'], array('id' => 'threadprefix')), 'threadprefix'); 887 } 888 889 $form_container->output_row($lang->new_subject." <em>*</em>", $lang->new_subject_desc, $form->generate_text_box('newsubject', $mybb->input['newsubject'], array('id' => 'newsubject'))); 890 $form_container->end(); 891 892 $form_container = new FormContainer($lang->add_new_reply); 893 $form_container->output_row($lang->add_new_reply, $lang->add_new_reply_desc, $form->generate_text_area('newreply', $mybb->input['newreply'], array('id' => 'newreply')), 'newreply'); 894 $form_container->output_row($lang->reply_subject, $lang->reply_subject_desc, $form->generate_text_box('newreplysubject', $mybb->input['newreplysubject'], array('id' => 'newreplysubject')), 'newreplysubject'); 895 $form_container->end(); 896 897 $buttons[] = $form->generate_submit_button($lang->save_thread_tool); 898 899 $form->output_submit_wrapper($buttons); 900 $form->end(); 901 902 $page->output_footer(); 903 } 904 905 if($mybb->input['action'] == "edit_post_tool") 906 { 907 $plugins->run_hooks("admin_config_mod_tools_edit_post_tool"); 908 909 $query = $db->simple_select("modtools", "COUNT(tid) as tools", "tid = '{$mybb->input['tid']}' AND type='p'"); 910 if($db->fetch_field($query, "tools") < 1) 911 { 912 flash_message($lang->error_invalid_post_tool, 'error'); 913 admin_redirect("index.php?module=config-mod_tools&action=post_tools"); 914 } 915 916 if($mybb->request_method == 'post') 917 { 918 if(trim($mybb->input['title']) == "") 919 { 920 $errors[] = $lang->error_missing_title; 921 } 922 923 if(trim($mybb->input['description']) == "") 924 { 925 $errors[] = $lang->error_missing_description; 926 } 927 928 if($mybb->input['forum_type'] == 2) 929 { 930 if(count($mybb->input['forum_1_forums']) < 1) 931 { 932 $errors[] = $lang->error_no_forums_selected; 933 } 934 } 935 else 936 { 937 $mybb->input['forum_1_forums'] = ''; 938 } 939 940 if($mybb->input['approvethread'] != '' && $mybb->input['approvethread'] != 'approve' && $mybb->input['approvethread'] != 'unapprove' && $mybb->input['approvethread'] != 'toggle') 941 { 942 $mybb->input['approvethread'] = ''; 943 } 944 945 if($mybb->input['openthread'] != '' && $mybb->input['openthread'] != 'open' && $mybb->input['openthread'] != 'close' && $mybb->input['openthread'] != 'toggle') 946 { 947 $mybb->input['openthread'] = ''; 948 } 949 950 if($mybb->input['move_type'] == 2) 951 { 952 if(!$mybb->input['move_1_forum']) 953 { 954 $errors[] = $lang->error_no_move_forum_selected; 955 } 956 else 957 { 958 // Check that the destination forum is not a category 959 $query = $db->simple_select("forums", "type", "fid = '".intval($mybb->input['move_1_forum'])."'"); 960 if($db->fetch_field($query, "type") == "c") 961 { 962 $errors[] = $lang->error_forum_is_category; 963 } 964 } 965 } 966 else 967 { 968 $mybb->input['move_1_forum'] = ''; 969 $mybb->input['move_2_redirect'] = 0; 970 $mybb->input['move_3_redirecttime'] = ''; 971 } 972 973 if($mybb->input['copy_type'] == 2) 974 { 975 if(!$mybb->input['copy_1_forum']) 976 { 977 $errors[] = $lang->error_no_copy_forum_selected; 978 } 979 else 980 { 981 $query = $db->simple_select("forums", "type", "fid = '".intval($mybb->input['copy_1_forum'])."'"); 982 if($db->fetch_field($query, "type") == "c") 983 { 984 $errors[] = $lang->error_forum_is_category; 985 } 986 } 987 } 988 else 989 { 990 $mybb->input['copy_1_forum'] = ''; 991 } 992 993 if($mybb->input['approveposts'] != '' && $mybb->input['approveposts'] != 'approve' && $mybb->input['approveposts'] != 'unapprove' && $mybb->input['approveposts'] != 'toggle') 994 { 995 $mybb->input['approveposts'] = ''; 996 } 997 998 if($mybb->input['splitposts'] < -2) 999 { 1000 $mybb->input['splitposts'] = -1; 1001 } 1002 1003 if($mybb->input['splitpostsclose'] == 1) 1004 { 1005 $mybb->input['splitpostsclose'] = 'close'; 1006 } 1007 else 1008 { 1009 $mybb->input['splitpostsclose'] = ''; 1010 } 1011 1012 if($mybb->input['splitpostsstick'] == 1) 1013 { 1014 $mybb->input['splitpostsstick'] = 'stick'; 1015 } 1016 else 1017 { 1018 $mybb->input['splitpostsstick'] = ''; 1019 } 1020 1021 if($mybb->input['splitpostsunapprove'] == 1) 1022 { 1023 $mybb->input['splitpostsunapprove'] = 'unapprove'; 1024 } 1025 else 1026 { 1027 $mybb->input['splitpostsunapprove'] = ''; 1028 } 1029 1030 if(!$errors) 1031 { 1032 $thread_options = array( 1033 'deletethread' => $mybb->input['deletethread'], 1034 'approvethread' => $mybb->input['approvethread'], 1035 'openthread' => $mybb->input['openthread'], 1036 'movethread' => intval($mybb->input['move_1_forum']), 1037 'movethreadredirect' => $mybb->input['move_2_redirect'], 1038 'movethreadredirectexpire' => intval($mybb->input['move_3_redirecttime']), 1039 'copythread' => intval($mybb->input['copy_1_forum']), 1040 'newsubject' => $mybb->input['newsubject'], 1041 'addreply' => $mybb->input['newreply'], 1042 'replysubject' => $mybb->input['newreplysubject'] 1043 ); 1044 1045 if(stripos($mybb->input['splitpostsnewsubject'], '{subject}') === false) 1046 { 1047 $mybb->input['splitpostsnewsubject'] = '{subject}'.$mybb->input['splitpostsnewsubject']; 1048 } 1049 1050 $post_options = array( 1051 'deleteposts' => $mybb->input['deleteposts'], 1052 'mergeposts' => $mybb->input['mergeposts'], 1053 'approveposts' => $mybb->input['approveposts'], 1054 'splitposts' => intval($mybb->input['splitposts']), 1055 'splitpostsclose' => $mybb->input['splitpostsclose'], 1056 'splitpostsstick' => $mybb->input['splitpostsstick'], 1057 'splitpostsunapprove' => $mybb->input['splitpostsunapprove'], 1058 'splitpostsnewsubject' => $mybb->input['splitpostsnewsubject'], 1059 'splitpostsaddreply' => $mybb->input['splitpostsaddreply'], 1060 'splitpostsreplysubject' => $mybb->input['splitpostsreplysubject'] 1061 ); 1062 1063 $update_tool['type'] = 'p'; 1064 $update_tool['threadoptions'] = $db->escape_string(serialize($thread_options)); 1065 $update_tool['postoptions'] = $db->escape_string(serialize($post_options)); 1066 $update_tool['name'] = $db->escape_string($mybb->input['title']); 1067 $update_tool['description'] = $db->escape_string($mybb->input['description']); 1068 $update_tool['forums'] = ''; 1069 1070 if(is_array($mybb->input['forum_1_forums'])) 1071 { 1072 foreach($mybb->input['forum_1_forums'] as $fid) 1073 { 1074 $checked[] = intval($fid); 1075 } 1076 $update_tool['forums'] = implode(',', $checked); 1077 } 1078 1079 $db->update_query("modtools", $update_tool, "tid = '{$mybb->input['tid']}'"); 1080 1081 $plugins->run_hooks("admin_config_mod_tools_edit_post_tool_commit"); 1082 1083 // Log admin action 1084 log_admin_action($mybb->input['tid'], $mybb->input['title']); 1085 $cache->update_forumsdisplay(); 1086 1087 flash_message($lang->success_mod_tool_updated, 'success'); 1088 admin_redirect("index.php?module=config-mod_tools&action=post_tools"); 1089 } 1090 } 1091 1092 $page->add_breadcrumb_item($lang->edit_post_tool); 1093 $page->output_header($lang->mod_tools." - ".$lang->edit_post_tool); 1094 1095 $sub_tabs['edit_post_tool'] = array( 1096 "title" => $lang->edit_post_tool, 1097 "description" => $lang->edit_post_tool_desc, 1098 "link" => "index.php?module=config-mod_tools" 1099 ); 1100 1101 $page->output_nav_tabs($sub_tabs, 'edit_post_tool'); 1102 1103 $form = new Form("index.php?module=config-mod_tools&action=edit_post_tool", 'post'); 1104 echo $form->generate_hidden_field("tid", $mybb->input['tid']); 1105 1106 if($errors) 1107 { 1108 $page->output_inline_error($errors); 1109 } 1110 else 1111 { 1112 $query = $db->simple_select("modtools", "*", "tid = '{$mybb->input['tid']}'"); 1113 $modtool = $db->fetch_array($query); 1114 $thread_options = unserialize($modtool['threadoptions']); 1115 $post_options = unserialize($modtool['postoptions']); 1116 1117 $mybb->input['title'] = $modtool['name']; 1118 $mybb->input['description'] = $modtool['description']; 1119 $mybb->input['forum_1_forums'] = explode(",", $modtool['forums']); 1120 1121 if(!$modtool['forums'] || $modtool['forums'] == -1) 1122 { 1123 $forum_checked[1] = "checked=\"checked\""; 1124 $forum_checked[2] = ''; 1125 } 1126 else 1127 { 1128 $forum_checked[1] = ''; 1129 $forum_checked[2] = "checked=\"checked\""; 1130 } 1131 1132 $mybb->input['approvethread'] = $thread_options['approvethread']; 1133 $mybb->input['openthread'] = $thread_options['openthread']; 1134 $mybb->input['move_1_forum'] = $thread_options['movethread']; 1135 $mybb->input['move_2_redirect'] = $thread_options['movethreadredirect']; 1136 $mybb->input['move_3_redirecttime'] = $thread_options['movethreadredirectexpire']; 1137 1138 if(!$thread_options['movethread']) 1139 { 1140 $move_checked[1] = "checked=\"checked\""; 1141 $move_checked[2] = ''; 1142 } 1143 else 1144 { 1145 $move_checked[1] = ''; 1146 $move_checked[2] = "checked=\"checked\""; 1147 } 1148 1149 if(!$thread_options['copythread']) 1150 { 1151 $copy_checked[1] = "checked=\"checked\""; 1152 $copy_checked[2] = ''; 1153 } 1154 else 1155 { 1156 $copy_checked[1] = ''; 1157 $copy_checked[2] = "checked=\"checked\""; 1158 } 1159 1160 $mybb->input['copy_1_forum'] = $thread_options['copythread']; 1161 $mybb->input['deletethread'] = $thread_options['deletethread']; 1162 $mybb->input['newsubject'] = $thread_options['newsubject']; 1163 $mybb->input['newreply'] = $thread_options['addreply']; 1164 $mybb->input['newreplysubject'] = $thread_options['replysubject']; 1165 1166 if($post_options['splitposts'] == '-1') 1167 { 1168 $do_not_split_checked = ' selected="selected"'; 1169 $split_same_checked = ''; 1170 } 1171 else if($post_options['splitposts'] == '-2') 1172 { 1173 $do_not_split_checked = ''; 1174 $split_same_checked = ' selected="selected"'; 1175 } 1176 1177 $mybb->input['deleteposts'] = $post_options['deleteposts']; 1178 $mybb->input['mergeposts'] = $post_options['mergeposts']; 1179 $mybb->input['approveposts'] = $post_options['approveposts']; 1180 1181 if($post_options['splitpostsclose'] == 'close') 1182 { 1183 $mybb->input['splitpostsclose'] = '1'; 1184 } 1185 else 1186 { 1187 $mybb->input['splitpostsclose'] = '0'; 1188 } 1189 1190 if($post_options['splitpostsstick'] == 'stick') 1191 { 1192 $mybb->input['splitpostsstick'] = '1'; 1193 } 1194 else 1195 { 1196 $mybb->input['splitpostsstick'] = '0'; 1197 } 1198 1199 if($post_options['splitpostsunapprove'] == 'unapprove') 1200 { 1201 $mybb->input['splitpostsunapprove'] = '1'; 1202 } 1203 else 1204 { 1205 $mybb->input['splitpostsunapprove'] = '0'; 1206 } 1207 1208 $mybb->input['splitposts'] = $post_options['splitposts']; 1209 1210 $mybb->input['splitpostsnewsubject'] = $post_options['splitpostsnewsubject']; 1211 $mybb->input['splitpostsaddreply'] = $post_options['splitpostsaddreply']; 1212 $mybb->input['splitpostsreplysubject'] = $post_options['splitpostsreplysubject']; 1213 } 1214 1215 $form_container = new FormContainer($lang->general_options); 1216 $form_container->output_row($lang->name." <em>*</em>", '', $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title'); 1217 $form_container->output_row($lang->short_description." <em>*</em>", '', $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description'); 1218 1219 1220 $actions = "<script type=\"text/javascript\"> 1221 function checkAction(id) 1222 { 1223 var checked = ''; 1224 1225 $$('.'+id+'s_check').each(function(e) 1226 { 1227 if(e.checked == true) 1228 { 1229 checked = e.value; 1230 } 1231 }); 1232 $$('.'+id+'s').each(function(e) 1233 { 1234 Element.hide(e); 1235 }); 1236 if($(id+'_'+checked)) 1237 { 1238 Element.show(id+'_'+checked); 1239 } 1240 } 1241 </script> 1242 <dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\"> 1243 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"forum_type\" value=\"1\" {$forum_checked[1]} class=\"forums_check\" onclick=\"checkAction('forum');\" style=\"vertical-align: middle;\" /> <strong>{$lang->all_forums}</strong></label></dt> 1244 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"forum_type\" value=\"2\" {$forum_checked[2]} class=\"forums_check\" onclick=\"checkAction('forum');\" style=\"vertical-align: middle;\" /> <strong>{$lang->select_forums}</strong></label></dt> 1245 <dd style=\"margin-top: 4px;\" id=\"forum_2\" class=\"forums\"> 1246 <table cellpadding=\"4\"> 1247 <tr> 1248 <td valign=\"top\"><small>{$lang->forums_colon}</small></td> 1249 <td>".$form->generate_forum_select('forum_1_forums[]', $mybb->input['forum_1_forums'], array('multiple' => true, 'size' => 5))."</td> 1250 </tr> 1251 </table> 1252 </dd> 1253 </dl> 1254 <script type=\"text/javascript\"> 1255 checkAction('forum'); 1256 </script>"; 1257 $form_container->output_row($lang->available_in_forums." <em>*</em>", '', $actions); 1258 $form_container->end(); 1259 1260 $approve_unapprove = array( 1261 '' => $lang->no_change, 1262 'approve' => $lang->approve, 1263 'unapprove' => $lang->unapprove, 1264 'toggle' => $lang->toggle 1265 ); 1266 1267 $form_container = new FormContainer($lang->inline_post_moderation); 1268 $form_container->output_row($lang->delete_posts." <em>*</em>", '', $form->generate_yes_no_radio('deleteposts', $mybb->input['deleteposts'])); 1269 $form_container->output_row($lang->merge_posts." <em>*</em>", $lang->merge_posts_desc, $form->generate_yes_no_radio('mergeposts', $mybb->input['mergeposts'])); 1270 $form_container->output_row($lang->approve_unapprove_posts." <em>*</em>", '', $form->generate_select_box('approveposts', $approve_unapprove, $mybb->input['approveposts'], array('id' => 'approveposts')), 'approveposts'); 1271 $form_container->end(); 1272 1273 $selectoptions = "<option value=\"-1\"{$do_not_split_checked}>{$lang->do_not_split}</option>\n"; 1274 $selectoptions .= "<option value=\"-2\"{$split_same_checked} style=\"border-bottom: 1px solid #000;\">{$lang->split_to_same_forum}</option>\n"; 1275 1276 $form_container = new FormContainer($lang->split_posts); 1277 $form_container->output_row($lang->split_posts2." <em>*</em>", '', $form->generate_forum_select('splitposts', $mybb->input['splitposts'])); 1278 $form_container->output_row($lang->close_split_thread." <em>*</em>", '', $form->generate_yes_no_radio('splitpostsclose', $mybb->input['splitpostsclose'])); 1279 $form_container->output_row($lang->stick_split_thread." <em>*</em>", '', $form->generate_yes_no_radio('splitpostsstick', $mybb->input['splitpostsstick'])); 1280 $form_container->output_row($lang->unapprove_split_thread." <em>*</em>", '', $form->generate_yes_no_radio('splitpostsunapprove', $mybb->input['splitpostsunapprove'])); 1281 $form_container->output_row($lang->split_thread_subject, $lang->split_thread_subject_desc, $form->generate_text_box('splitpostsnewsubject', $mybb->input['splitpostsnewsubject'], array('id' => 'splitpostsnewsubject ')), 'newreplysubject'); 1282 $form_container->output_row($lang->add_new_split_reply, $lang->add_new_split_reply_desc, $form->generate_text_area('splitpostsaddreply', $mybb->input['splitpostsaddreply'], array('id' => 'splitpostsaddreply')), 'splitpostsaddreply'); 1283 $form_container->output_row($lang->split_reply_subject, $lang->split_reply_subject_desc, $form->generate_text_box('splitpostsreplysubject', $mybb->input['splitpostsreplysubject'], array('id' => 'splitpostsreplysubject')), 'splitpostsreplysubject'); 1284 $form_container->end(); 1285 1286 $open_close = array( 1287 '' => $lang->no_change, 1288 'open' => $lang->open, 1289 'close' => $lang->close, 1290 'toggle' => $lang->toggle 1291 ); 1292 1293 $form_container = new FormContainer($lang->thread_moderation); 1294 $form_container->output_row($lang->approve_unapprove." <em>*</em>", '', $form->generate_select_box('approvethread', $approve_unapprove, $mybb->input['approvethread'], array('id' => 'approvethread')), 'approvethread'); 1295 $form_container->output_row($lang->open_close_thread." <em>*</em>", '', $form->generate_select_box('openthread', $open_close, $mybb->input['openthread'], array('id' => 'openthread')), 'openthread'); 1296 1297 1298 $actions = " 1299 <dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\"> 1300 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"move_type\" value=\"1\" {$move_checked[1]} class=\"moves_check\" onclick=\"checkAction('move');\" style=\"vertical-align: middle;\" /> <strong>{$lang->do_not_move_thread}</strong></label></dt> 1301 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"move_type\" value=\"2\" {$move_checked[2]} class=\"moves_check\" onclick=\"checkAction('move');\" style=\"vertical-align: middle;\" /> <strong>{$lang->move_thread}</strong></label></dt> 1302 <dd style=\"margin-top: 4px;\" id=\"move_2\" class=\"moves\"> 1303 <table cellpadding=\"4\"> 1304 <tr> 1305 <td><small>{$lang->forum_to_move_to}</small></td> 1306 <td>".$form->generate_forum_select('move_1_forum', $mybb->input['move_1_forum'])."</td> 1307 </tr> 1308 <tr> 1309 <td><small>{$lang->leave_redirect}</small></td> 1310 <td>".$form->generate_yes_no_radio('move_2_redirect', $mybb->input['move_2_redirect'])."</td> 1311 </tr> 1312 <tr> 1313 <td><small>{$lang->delete_redirect_after}</small></td> 1314 <td>".$form->generate_text_box('move_3_redirecttime', $mybb->input['move_3_redirecttime'], array('style' => 'width: 2em;'))." {$lang->days}</td> 1315 </tr> 1316 </table> 1317 </dd> 1318 </dl> 1319 <script type=\"text/javascript\"> 1320 checkAction('move'); 1321 </script>"; 1322 $form_container->output_row($lang->move_thread." <em>*</em>", $lang->move_thread_desc, $actions); 1323 1324 $actions = " 1325 <dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\"> 1326 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"copy_type\" value=\"1\" {$copy_checked[1]} class=\"copys_check\" onclick=\"checkAction('copy');\" style=\"vertical-align: middle;\" /> <strong>{$lang->do_not_copy_thread}</strong></label></dt> 1327 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"copy_type\" value=\"2\" {$copy_checked[2]} class=\"copys_check\" onclick=\"checkAction('copy');\" style=\"vertical-align: middle;\" /> <strong>{$lang->copy_thread}</strong></label></dt> 1328 <dd style=\"margin-top: 4px;\" id=\"copy_2\" class=\"copys\"> 1329 <table cellpadding=\"4\"> 1330 <tr> 1331 <td><small>{$lang->forum_to_copy_to}</small></td> 1332 <td>".$form->generate_forum_select('copy_1_forum', $mybb->input['copy_1_forum'])."</td> 1333 </tr> 1334 </table> 1335 </dd> 1336 </dl> 1337 <script type=\"text/javascript\"> 1338 checkAction('copy'); 1339 </script>"; 1340 $form_container->output_row($lang->copy_thread." <em>*</em>", '', $actions); 1341 $form_container->output_row($lang->delete_thread." <em>*</em>", '', $form->generate_yes_no_radio('deletethread', $mybb->input['deletethread'])); 1342 $form_container->output_row($lang->new_subject." <em>*</em>", $lang->new_subject_desc, $form->generate_text_box('newsubject', $mybb->input['newsubject'])); 1343 $form_container->end(); 1344 1345 $form_container = new FormContainer($lang->add_new_reply); 1346 $form_container->output_row($lang->add_new_reply, $lang->add_new_reply_desc, $form->generate_text_area('newreply', $mybb->input['newreply']), 'newreply'); 1347 $form_container->output_row($lang->reply_subject, $lang->reply_subject_desc, $form->generate_text_box('newreplysubject', $mybb->input['newreplysubject'], array('id' => 'newreplysubject')), 'newreplysubject'); 1348 $form_container->end(); 1349 1350 $buttons[] = $form->generate_submit_button($lang->save_post_tool); 1351 1352 $form->output_submit_wrapper($buttons); 1353 $form->end(); 1354 1355 $page->output_footer(); 1356 } 1357 1358 if($mybb->input['action'] == "add_post_tool") 1359 { 1360 $plugins->run_hooks("admin_config_mod_tools_add_post_tool"); 1361 1362 if($mybb->request_method == 'post') 1363 { 1364 if(trim($mybb->input['title']) == "") 1365 { 1366 $errors[] = $lang->error_missing_title; 1367 } 1368 1369 if(trim($mybb->input['description']) == "") 1370 { 1371 $errors[] = $lang->error_missing_description; 1372 } 1373 1374 if($mybb->input['forum_type'] == 2) 1375 { 1376 $forum_checked[1] = ''; 1377 $forum_checked[2] = "checked=\"checked\""; 1378 1379 if(count($mybb->input['forum_1_forums']) < 1) 1380 { 1381 $errors[] = $lang->error_no_forums_selected; 1382 } 1383 } 1384 else 1385 { 1386 $forum_checked[1] = "checked=\"checked\""; 1387 $forum_checked[2] = ''; 1388 1389 $mybb->input['forum_1_forums'] = ''; 1390 } 1391 1392 1393 if($mybb->input['approvethread'] != '' && $mybb->input['approvethread'] != 'approve' && $mybb->input['approvethread'] != 'unapprove' && $mybb->input['approvethread'] != 'toggle') 1394 { 1395 $mybb->input['approvethread'] = ''; 1396 } 1397 1398 if($mybb->input['openthread'] != '' && $mybb->input['openthread'] != 'open' && $mybb->input['openthread'] != 'close' && $mybb->input['openthread'] != 'toggle') 1399 { 1400 $mybb->input['openthread'] = ''; 1401 } 1402 1403 if($mybb->input['move_type'] == 2) 1404 { 1405 $move_checked[1] = ''; 1406 $move_checked[2] = "checked=\"checked\""; 1407 1408 if(!$mybb->input['move_1_forum']) 1409 { 1410 $errors[] = $lang->error_no_move_forum_selected; 1411 } 1412 else 1413 { 1414 // Check that the destination forum is not a category 1415 $query = $db->simple_select("forums", "type", "fid = '".intval($mybb->input['move_1_forum'])."'"); 1416 if($db->fetch_field($query, "type") == "c") 1417 { 1418 $errors[] = $lang->error_forum_is_category; 1419 } 1420 } 1421 } 1422 else 1423 { 1424 $move_checked[1] = "checked=\"checked\""; 1425 $move_checked[2] = ''; 1426 1427 $mybb->input['move_1_forum'] = ''; 1428 $mybb->input['move_2_redirect'] = 0; 1429 $mybb->input['move_3_redirecttime'] = ''; 1430 } 1431 1432 if($mybb->input['copy_type'] == 2) 1433 { 1434 $copy_checked[1] = ''; 1435 $copy_checked[2] = "checked=\"checked\""; 1436 1437 if(!$mybb->input['copy_1_forum']) 1438 { 1439 $errors[] = $lang->error_no_copy_forum_selected; 1440 } 1441 else 1442 { 1443 $query = $db->simple_select("forums", "type", "fid = '".intval($mybb->input['copy_1_forum'])."'"); 1444 if($db->fetch_field($query, "type") == "c") 1445 { 1446 $errors[] = $lang->error_forum_is_category; 1447 } 1448 } 1449 } 1450 else 1451 { 1452 $copy_checked[1] = 'checked=\"checked\"'; 1453 $copy_checked[2] = ''; 1454 1455 $mybb->input['copy_1_forum'] = ''; 1456 } 1457 1458 if($mybb->input['approveposts'] != '' && $mybb->input['approveposts'] != 'approve' && $mybb->input['approveposts'] != 'unapprove' && $mybb->input['approveposts'] != 'toggle') 1459 { 1460 $mybb->input['approveposts'] = ''; 1461 } 1462 1463 if($mybb->input['splitposts'] < -2) 1464 { 1465 $mybb->input['splitposts'] = -1; 1466 } 1467 1468 if($mybb->input['splitpostsclose'] == 1) 1469 { 1470 $mybb->input['splitpostsclose'] = 'close'; 1471 } 1472 else 1473 { 1474 $mybb->input['splitpostsclose'] = ''; 1475 } 1476 1477 if($mybb->input['splitpostsstick'] == 1) 1478 { 1479 $mybb->input['splitpostsstick'] = 'stick'; 1480 } 1481 else 1482 { 1483 $mybb->input['splitpostsstick'] = ''; 1484 } 1485 1486 if($mybb->input['splitpostsunapprove'] == 1) 1487 { 1488 $mybb->input['splitpostsunapprove'] = 'unapprove'; 1489 } 1490 else 1491 { 1492 $mybb->input['splitpostsunapprove'] = ''; 1493 } 1494 1495 if(!$errors) 1496 { 1497 $thread_options = array( 1498 'deletethread' => $mybb->input['deletethread'], 1499 'approvethread' => $mybb->input['approvethread'], 1500 'openthread' => $mybb->input['openthread'], 1501 'movethread' => intval($mybb->input['move_1_forum']), 1502 'movethreadredirect' => $mybb->input['move_2_redirect'], 1503 'movethreadredirectexpire' => intval($mybb->input['move_3_redirecttime']), 1504 'copythread' => intval($mybb->input['copy_1_forum']), 1505 'newsubject' => $mybb->input['newsubject'], 1506 'addreply' => $mybb->input['newreply'], 1507 'replysubject' => $mybb->input['newreplysubject'] 1508 ); 1509 1510 if(stripos($mybb->input['splitpostsnewsubject'], '{subject}') === false) 1511 { 1512 $mybb->input['splitpostsnewsubject'] = '{subject}'.$mybb->input['splitpostsnewsubject']; 1513 } 1514 1515 $post_options = array( 1516 'deleteposts' => $mybb->input['deleteposts'], 1517 'mergeposts' => $mybb->input['mergeposts'], 1518 'approveposts' => $mybb->input['approveposts'], 1519 'splitposts' => intval($mybb->input['splitposts']), 1520 'splitpostsclose' => $mybb->input['splitpostsclose'], 1521 'splitpostsstick' => $mybb->input['splitpostsstick'], 1522 'splitpostsunapprove' => $mybb->input['splitpostsunapprove'], 1523 'splitpostsnewsubject' => $mybb->input['splitpostsnewsubject'], 1524 'splitpostsaddreply' => $mybb->input['splitpostsaddreply'], 1525 'splitpostsreplysubject' => $mybb->input['splitpostsreplysubject'] 1526 ); 1527 1528 $new_tool['type'] = 'p'; 1529 $new_tool['threadoptions'] = $db->escape_string(serialize($thread_options)); 1530 $new_tool['postoptions'] = $db->escape_string(serialize($post_options)); 1531 $new_tool['name'] = $db->escape_string($mybb->input['title']); 1532 $new_tool['description'] = $db->escape_string($mybb->input['description']); 1533 $new_tool['forums'] = ''; 1534 1535 if(is_array($mybb->input['forum_1_forums'])) 1536 { 1537 foreach($mybb->input['forum_1_forums'] as $fid) 1538 { 1539 $checked[] = intval($fid); 1540 } 1541 $new_tool['forums'] = implode(',', $checked); 1542 } 1543 1544 $tid = $db->insert_query("modtools", $new_tool); 1545 1546 $plugins->run_hooks("admin_config_mod_tools_add_post_tool_commit"); 1547 1548 // Log admin action 1549 log_admin_action($tid, $mybb->input['title']); 1550 $cache->update_forumsdisplay(); 1551 1552 flash_message($lang->success_mod_tool_created, 'success'); 1553 admin_redirect("index.php?module=config-mod_tools&action=post_tools"); 1554 } 1555 } 1556 1557 $page->add_breadcrumb_item($lang->add_new_post_tool); 1558 $page->output_header($lang->mod_tools." - ".$lang->add_new_post_tool); 1559 1560 $sub_tabs['thread_tools'] = array( 1561 'title' => $lang->thread_tools, 1562 'link' => "index.php?module=config-mod_tools" 1563 ); 1564 $sub_tabs['add_thread_tool'] = array( 1565 'title'=> $lang->add_new_thread_tool, 1566 'link' => "index.php?module=config-mod_tools&action=add_thread_tool" 1567 ); 1568 $sub_tabs['post_tools'] = array( 1569 'title' => $lang->post_tools, 1570 'link' => "index.php?module=config-mod_tools&action=post_tools", 1571 ); 1572 $sub_tabs['add_post_tool'] = array( 1573 'title'=> $lang->add_new_post_tool, 1574 'link' => "index.php?module=config-mod_tools&action=add_post_tool", 1575 'description' => $lang->add_post_tool_desc 1576 ); 1577 1578 $page->output_nav_tabs($sub_tabs, 'add_post_tool'); 1579 1580 $form = new Form("index.php?module=config-mod_tools&action=add_post_tool", 'post'); 1581 1582 if($errors) 1583 { 1584 $page->output_inline_error($errors); 1585 } 1586 else 1587 { 1588 $mybb->input['title'] = ''; 1589 $mybb->input['description'] = ''; 1590 $mybb->input['forum_1_forums'] = ''; 1591 $forum_checked[1] = "checked=\"checked\""; 1592 $forum_checked[2] = ''; 1593 $mybb->input['approvethread'] = ''; 1594 $mybb->input['openthread'] = ''; 1595 $mybb->input['move_1_forum'] = ''; 1596 $mybb->input['move_2_redirect'] = '0'; 1597 $mybb->input['move_3_redirecttime'] = ''; 1598 $move_checked[1] = "checked=\"checked\""; 1599 $move_checked[2] = ''; 1600 $copy_checked[1] = "checked=\"checked\""; 1601 $copy_checked[2] = ''; 1602 $mybb->input['copy_1_forum'] = ''; 1603 $mybb->input['deletethread'] = '0'; 1604 $mybb->input['newsubject'] = '{subject}'; 1605 $mybb->input['newreply'] = ''; 1606 $mybb->input['newreplysubject'] = '{subject}'; 1607 $do_not_split_checked = ' selected="selected"'; 1608 $split_same_checked = ''; 1609 $mybb->input['deleteposts'] = '0'; 1610 $mybb->input['mergeposts'] = '0'; 1611 $mybb->input['approveposts'] = ''; 1612 $mybb->input['splitposts'] = '-1'; 1613 $mybb->input['splitpostsclose'] = '0'; 1614 $mybb->input['splitpostsstick'] = '0'; 1615 $mybb->input['splitpostsunapprove'] = '0'; 1616 $mybb->input['splitpostsnewsubject'] = '{subject}'; 1617 $mybb->input['splitpostsaddreply'] = ''; 1618 $mybb->input['splitpostsreplysubject'] = '{subject}'; 1619 } 1620 1621 $form_container = new FormContainer($lang->general_options); 1622 $form_container->output_row($lang->name." <em>*</em>", '', $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title'); 1623 $form_container->output_row($lang->short_description." <em>*</em>", '', $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description'); 1624 1625 1626 $actions = "<script type=\"text/javascript\"> 1627 function checkAction(id) 1628 { 1629 var checked = ''; 1630 1631 $$('.'+id+'s_check').each(function(e) 1632 { 1633 if(e.checked == true) 1634 { 1635 checked = e.value; 1636 } 1637 }); 1638 $$('.'+id+'s').each(function(e) 1639 { 1640 Element.hide(e); 1641 }); 1642 if($(id+'_'+checked)) 1643 { 1644 Element.show(id+'_'+checked); 1645 } 1646 } 1647 </script> 1648 <dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\"> 1649 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"forum_type\" value=\"1\" {$forum_checked[1]} class=\"forums_check\" onclick=\"checkAction('forum');\" style=\"vertical-align: middle;\" /> <strong>{$lang->all_forums}</strong></label></dt> 1650 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"forum_type\" value=\"2\" {$forum_checked[2]} class=\"forums_check\" onclick=\"checkAction('forum');\" style=\"vertical-align: middle;\" /> <strong>{$lang->select_forums}</strong></label></dt> 1651 <dd style=\"margin-top: 4px;\" id=\"forum_2\" class=\"forums\"> 1652 <table cellpadding=\"4\"> 1653 <tr> 1654 <td valign=\"top\"><small>{$lang->forums_colon}</small></td> 1655 <td>".$form->generate_forum_select('forum_1_forums[]', $mybb->input['forum_1_forums'], array('multiple' => true, 'size' => 5))."</td> 1656 </tr> 1657 </table> 1658 </dd> 1659 </dl> 1660 <script type=\"text/javascript\"> 1661 checkAction('forum'); 1662 </script>"; 1663 $form_container->output_row($lang->available_in_forums." <em>*</em>", '', $actions); 1664 $form_container->end(); 1665 1666 $approve_unapprove = array( 1667 '' => $lang->no_change, 1668 'approve' => $lang->approve, 1669 'unapprove' => $lang->unapprove, 1670 'toggle' => $lang->toggle 1671 ); 1672 1673 $form_container = new FormContainer($lang->inline_post_moderation); 1674 $form_container->output_row($lang->delete_posts." <em>*</em>", '', $form->generate_yes_no_radio('deleteposts', $mybb->input['deleteposts'])); 1675 $form_container->output_row($lang->merge_posts." <em>*</em>", $lang->merge_posts_desc, $form->generate_yes_no_radio('mergeposts', $mybb->input['mergeposts'])); 1676 $form_container->output_row($lang->approve_unapprove_posts." <em>*</em>", '', $form->generate_select_box('approveposts', $approve_unapprove, $mybb->input['approveposts'], array('id' => 'approveposts')), 'approveposts'); 1677 $form_container->end(); 1678 1679 $selectoptions = "<option value=\"-1\"{$do_not_split_checked}>{$lang->do_not_split}</option>\n"; 1680 $selectoptions .= "<option value=\"-2\"{$split_same_checked} style=\"border-bottom: 1px solid #000;\">{$lang->split_to_same_forum}</option>\n"; 1681 1682 $form_container = new FormContainer($lang->split_posts); 1683 $form_container->output_row($lang->split_posts2." <em>*</em>", '', $form->generate_forum_select('splitposts', $mybb->input['splitposts'])); 1684 $form_container->output_row($lang->close_split_thread." <em>*</em>", '', $form->generate_yes_no_radio('splitpostsclose', $mybb->input['splitpostsclose'])); 1685 $form_container->output_row($lang->stick_split_thread." <em>*</em>", '', $form->generate_yes_no_radio('splitpostsstick', $mybb->input['splitpostsstick'])); 1686 $form_container->output_row($lang->unapprove_split_thread." <em>*</em>", '', $form->generate_yes_no_radio('splitpostsunapprove', $mybb->input['splitpostsunapprove'])); 1687 $form_container->output_row($lang->split_thread_subject, $lang->split_thread_subject_desc, $form->generate_text_box('splitpostsnewsubject', $mybb->input['splitpostsnewsubject'], array('id' => 'splitpostsnewsubject ')), 'newreplysubject'); 1688 $form_container->output_row($lang->add_new_split_reply, $lang->add_new_split_reply_desc, $form->generate_text_area('splitpostsaddreply', $mybb->input['splitpostsaddreply'], array('id' => 'splitpostsaddreply')), 'splitpostsaddreply'); 1689 $form_container->output_row($lang->split_reply_subject, $lang->split_reply_subject_desc, $form->generate_text_box('splitpostsreplysubject', $mybb->input['splitpostsreplysubject'], array('id' => 'splitpostsreplysubject')), 'splitpostsreplysubject'); 1690 $form_container->end(); 1691 1692 $open_close = array( 1693 '' => $lang->no_change, 1694 'open' => $lang->open, 1695 'close' => $lang->close, 1696 'toggle' => $lang->toggle 1697 ); 1698 1699 $form_container = new FormContainer($lang->thread_moderation); 1700 $form_container->output_row($lang->approve_unapprove." <em>*</em>", '', $form->generate_select_box('approvethread', $approve_unapprove, $mybb->input['approvethread'], array('id' => 'approvethread')), 'approvethread'); 1701 $form_container->output_row($lang->open_close_thread." <em>*</em>", '', $form->generate_select_box('openthread', $open_close, $mybb->input['openthread'], array('id' => 'openthread')), 'openthread'); 1702 1703 1704 $actions = " 1705 <dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\"> 1706 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"move_type\" value=\"1\" {$move_checked[1]} class=\"moves_check\" onclick=\"checkAction('move');\" style=\"vertical-align: middle;\" /> <strong>{$lang->do_not_move_thread}</strong></label></dt> 1707 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"move_type\" value=\"2\" {$move_checked[2]} class=\"moves_check\" onclick=\"checkAction('move');\" style=\"vertical-align: middle;\" /> <strong>{$lang->move_thread}</strong></label></dt> 1708 <dd style=\"margin-top: 4px;\" id=\"move_2\" class=\"moves\"> 1709 <table cellpadding=\"4\"> 1710 <tr> 1711 <td><small>{$lang->forum_to_move_to}</small></td> 1712 <td>".$form->generate_forum_select('move_1_forum', $mybb->input['move_1_forum'])."</td> 1713 </tr> 1714 <tr> 1715 <td><small>{$lang->leave_redirect}</small></td> 1716 <td>".$form->generate_yes_no_radio('move_2_redirect', $mybb->input['move_2_redirect'])."</td> 1717 </tr> 1718 <tr> 1719 <td><small>{$lang->delete_redirect_after}</small></td> 1720 <td>".$form->generate_text_box('move_3_redirecttime', $mybb->input['move_3_redirecttime'], array('style' => 'width: 2em;'))." {$lang->days}</td> 1721 </tr> 1722 </table> 1723 </dd> 1724 </dl> 1725 <script type=\"text/javascript\"> 1726 checkAction('move'); 1727 </script>"; 1728 $form_container->output_row($lang->move_thread." <em>*</em>", $lang->move_thread_desc, $actions); 1729 1730 $actions = " 1731 <dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\"> 1732 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"copy_type\" value=\"1\" {$copy_checked[1]} class=\"copys_check\" onclick=\"checkAction('copy');\" style=\"vertical-align: middle;\" /> <strong>{$lang->do_not_copy_thread}</strong></label></dt> 1733 <dt><label style=\"display: block;\"><input type=\"radio\" name=\"copy_type\" value=\"2\" {$copy_checked[2]} class=\"copys_check\" onclick=\"checkAction('copy');\" style=\"vertical-align: middle;\" /> <strong>{$lang->copy_thread}</strong></label></dt> 1734 <dd style=\"margin-top: 4px;\" id=\"copy_2\" class=\"copys\"> 1735 <table cellpadding=\"4\"> 1736 <tr> 1737 <td><small>{$lang->forum_to_copy_to}</small></td> 1738 <td>".$form->generate_forum_select('copy_1_forum', $mybb->input['copy_1_forum'])."</td> 1739 </tr> 1740 </table> 1741 </dd> 1742 </dl> 1743 <script type=\"text/javascript\"> 1744 checkAction('copy'); 1745 </script>"; 1746 $form_container->output_row($lang->copy_thread." <em>*</em>", '', $actions); 1747 $form_container->output_row($lang->delete_thread." <em>*</em>", '', $form->generate_yes_no_radio('deletethread', $mybb->input['deletethread'])); 1748 $form_container->output_row($lang->new_subject." <em>*</em>", $lang->new_subject_desc, $form->generate_text_box('newsubject', $mybb->input['newsubject'])); 1749 $form_container->end(); 1750 1751 $form_container = new FormContainer($lang->add_new_reply); 1752 $form_container->output_row($lang->add_new_reply, $lang->add_new_reply_desc, $form->generate_text_area('newreply', $mybb->input['newreply'], array('id' => 'newreply')), 'newreply'); 1753 $form_container->output_row($lang->reply_subject, $lang->reply_subject_desc, $form->generate_text_box('newreplysubject', $mybb->input['newreplysubject'], array('id' => 'newreplysubject')), 'newreplysubject'); 1754 $form_container->end(); 1755 1756 $buttons[] = $form->generate_submit_button($lang->save_post_tool); 1757 1758 $form->output_submit_wrapper($buttons); 1759 $form->end(); 1760 1761 $page->output_footer(); 1762 } 1763 1764 if(!$mybb->input['action']) 1765 { 1766 $plugins->run_hooks("admin_config_mod_tools_start"); 1767 1768 $page->output_header($lang->mod_tools." - ".$lang->thread_tools); 1769 1770 $sub_tabs['thread_tools'] = array( 1771 'title' => $lang->thread_tools, 1772 'link' => "index.php?module=config-mod_tools", 1773 'description' => $lang->thread_tools_desc 1774 ); 1775 $sub_tabs['add_thread_tool'] = array( 1776 'title'=> $lang->add_new_thread_tool, 1777 'link' => "index.php?module=config-mod_tools&action=add_thread_tool" 1778 ); 1779 $sub_tabs['post_tools'] = array( 1780 'title' => $lang->post_tools, 1781 'link' => "index.php?module=config-mod_tools&action=post_tools", 1782 ); 1783 $sub_tabs['add_post_tool'] = array( 1784 'title'=> $lang->add_new_post_tool, 1785 'link' => "index.php?module=config-mod_tools&action=add_post_tool" 1786 ); 1787 1788 $page->output_nav_tabs($sub_tabs, 'thread_tools'); 1789 1790 $table = new Table; 1791 $table->construct_header($lang->title); 1792 $table->construct_header($lang->controls, array('class' => "align_center", 'colspan' => 2)); 1793 1794 $query = $db->simple_select('modtools', 'tid, name, description, type', "type='t'", array('order_by' => 'name')); 1795 while($tool = $db->fetch_array($query)) 1796 { 1797 $table->construct_cell("<a href=\"index.php?module=config-mod_tools&action=edit_thread_tool&tid={$tool['tid']}\"><strong>".htmlspecialchars_uni($tool['name'])."</strong></a><br /><small>".htmlspecialchars_uni($tool['description'])."</small>"); 1798 $table->construct_cell("<a href=\"index.php?module=config-mod_tools&action=edit_thread_tool&tid={$tool['tid']}\">{$lang->edit}</a>", array('width' => 100, 'class' => "align_center")); 1799 $table->construct_cell("<a href=\"index.php?module=config-mod_tools&action=delete_thread_tool&tid={$tool['tid']}&my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_thread_tool_deletion}')\">{$lang->delete}</a>", array('width' => 100, 'class' => "align_center")); 1800 $table->construct_row(); 1801 } 1802 1803 if($table->num_rows() == 0) 1804 { 1805 $table->construct_cell($lang->no_thread_tools, array('colspan' => 3)); 1806 $table->construct_row(); 1807 } 1808 1809 $table->output($lang->thread_tools); 1810 1811 $page->output_footer(); 1812 } 1813 1814 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Oct 8 19:19:50 2013 | Cross-referenced by PHPXref 0.7.1 |