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