[ Index ] |
PHP Cross Reference of MyBB 1.8.38 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MyBB 1.8 4 * Copyright 2014 MyBB Group, All Rights Reserved 5 * 6 * Website: http://www.mybb.com 7 * License: http://www.mybb.com/about/license 8 * 9 */ 10 11 // Disallow direct access to this file for security reasons 12 if(!defined("IN_MYBB")) 13 { 14 die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined."); 15 } 16 17 $page->add_breadcrumb_item($lang->smilies, "index.php?module=config-smilies"); 18 19 $plugins->run_hooks("admin_config_smilies_begin"); 20 21 if($mybb->input['action'] == "add") 22 { 23 $plugins->run_hooks("admin_config_smilies_add"); 24 25 if($mybb->request_method == "post") 26 { 27 if(!trim($mybb->input['name'])) 28 { 29 $errors[] = $lang->error_missing_name; 30 } 31 32 if(!trim($mybb->input['find'])) 33 { 34 $errors[] = $lang->error_missing_text_replacement; 35 } 36 37 if(!trim($mybb->input['image'])) 38 { 39 $errors[] = $lang->error_missing_path; 40 } 41 42 if(!trim($mybb->input['disporder'])) 43 { 44 $errors[] = $lang->error_missing_order; 45 } 46 else 47 { 48 $mybb->input['disporder'] = $mybb->get_input('disporder', MyBB::INPUT_INT); 49 $query = $db->simple_select('smilies', 'sid', 'disporder=\''.$mybb->input['disporder'].'\''); 50 $duplicate_disporder = $db->fetch_field($query, 'sid'); 51 52 if($duplicate_disporder) 53 { 54 $errors[] = $lang->error_duplicate_order; 55 } 56 } 57 58 if(!$errors) 59 { 60 $mybb->input['find'] = str_replace("\r\n", "\n", $mybb->input['find']); 61 $mybb->input['find'] = str_replace("\r", "\n", $mybb->input['find']); 62 $mybb->input['find'] = explode("\n", $mybb->input['find']); 63 foreach(array_merge(array_keys($mybb->input['find'], ""), array_keys($mybb->input['find'], " ")) as $key) 64 { 65 unset($mybb->input['find'][$key]); 66 } 67 $mybb->input['find'] = implode("\n", $mybb->input['find']); 68 69 $new_smilie = array( 70 "name" => $db->escape_string($mybb->input['name']), 71 "find" => $db->escape_string($mybb->input['find']), 72 "image" => $db->escape_string($mybb->input['image']), 73 "disporder" => $mybb->get_input('disporder', MyBB::INPUT_INT), 74 "showclickable" => $mybb->get_input('showclickable', MyBB::INPUT_INT) 75 ); 76 77 $sid = $db->insert_query("smilies", $new_smilie); 78 79 $plugins->run_hooks("admin_config_smilies_add_commit"); 80 81 $cache->update_smilies(); 82 83 // Log admin action 84 log_admin_action($sid, $mybb->input['name']); 85 86 flash_message($lang->success_smilie_added, 'success'); 87 admin_redirect("index.php?module=config-smilies"); 88 } 89 } 90 91 $page->add_breadcrumb_item($lang->add_smilie); 92 $page->output_header($lang->smilies." - ".$lang->add_smilie); 93 94 $sub_tabs['manage_smilies'] = array( 95 'title' => $lang->manage_smilies, 96 'link' => "index.php?module=config-smilies", 97 ); 98 $sub_tabs['add_smilie'] = array( 99 'title' => $lang->add_smilie, 100 'link' => "index.php?module=config-smilies&action=add", 101 'description' => $lang->add_smilie_desc 102 ); 103 $sub_tabs['add_multiple_smilies'] = array( 104 'title' => $lang->add_multiple_smilies, 105 'link' => "index.php?module=config-smilies&action=add_multiple", 106 ); 107 $sub_tabs['mass_edit'] = array( 108 'title' => $lang->mass_edit, 109 'link' => "index.php?module=config-smilies&action=mass_edit" 110 ); 111 112 $page->output_nav_tabs($sub_tabs, 'add_smilie'); 113 $form = new Form("index.php?module=config-smilies&action=add", "post", "add"); 114 115 if($errors) 116 { 117 $page->output_inline_error($errors); 118 } 119 else 120 { 121 $mybb->input['image'] = 'images/smilies/'; 122 $mybb->input['showclickable'] = 1; 123 } 124 125 if(!$mybb->get_input('disporder')) 126 { 127 $query = $db->simple_select("smilies", "max(disporder) as dispordermax"); 128 $mybb->input['disporder'] = $db->fetch_field($query, "dispordermax")+1; 129 } 130 131 $form_container = new FormContainer($lang->add_smilie); 132 $form_container->output_row($lang->name." <em>*</em>", "", $form->generate_text_box('name', $mybb->get_input('name'), array('id' => 'name')), 'name'); 133 $form_container->output_row($lang->text_replace." <em>*</em>", $lang->text_replace_desc, $form->generate_text_area('find', $mybb->get_input('find'), array('id' => 'find')), 'find'); 134 $form_container->output_row($lang->image_path." <em>*</em>", $lang->image_path_desc, $form->generate_text_box('image', $mybb->get_input('image'), array('id' => 'image')), 'image'); 135 $form_container->output_row($lang->display_order." <em>*</em>", $lang->display_order_desc, $form->generate_numeric_field('disporder', $mybb->get_input('disporder'), array('id' => 'disporder', 'min' => 0)), 'disporder'); 136 $form_container->output_row($lang->show_clickable." <em>*</em>", $lang->show_clickable_desc, $form->generate_yes_no_radio('showclickable', $mybb->get_input('showclickable'))); 137 $form_container->end(); 138 139 $buttons[] = $form->generate_submit_button($lang->save_smilie); 140 141 $form->output_submit_wrapper($buttons); 142 $form->end(); 143 144 $page->output_footer(); 145 } 146 147 if($mybb->input['action'] == "edit") 148 { 149 $query = $db->simple_select("smilies", "*", "sid='".$mybb->get_input('sid', MyBB::INPUT_INT)."'"); 150 $smilie = $db->fetch_array($query); 151 152 // Does the smilie not exist? 153 if(!$smilie) 154 { 155 flash_message($lang->error_invalid_smilie, 'error'); 156 admin_redirect("index.php?module=config-smilies"); 157 } 158 159 $plugins->run_hooks("admin_config_smilies_edit"); 160 161 if($mybb->request_method == "post") 162 { 163 if(!trim($mybb->input['name'])) 164 { 165 $errors[] = $lang->error_missing_name; 166 } 167 168 if(!trim($mybb->input['find'])) 169 { 170 $errors[] = $lang->error_missing_text_replacement; 171 } 172 173 if(!trim($mybb->input['image'])) 174 { 175 $errors[] = $lang->error_missing_path; 176 } 177 178 if(!trim($mybb->input['disporder'])) 179 { 180 $errors[] = $lang->error_missing_order; 181 } 182 else 183 { 184 $mybb->input['disporder'] = $mybb->get_input('disporder', MyBB::INPUT_INT); 185 $query = $db->simple_select("smilies", "sid", "disporder= '".$mybb->input['disporder']."' AND sid != '".$smilie['sid']."'"); 186 $duplicate_disporder = $db->fetch_field($query, 'sid'); 187 188 if($duplicate_disporder) 189 { 190 $errors[] = $lang->error_duplicate_order; 191 } 192 } 193 194 if(!$errors) 195 { 196 $mybb->input['find'] = str_replace("\r\n", "\n", $mybb->input['find']); 197 $mybb->input['find'] = str_replace("\r", "\n", $mybb->input['find']); 198 $mybb->input['find'] = explode("\n", $mybb->input['find']); 199 foreach(array_merge(array_keys($mybb->input['find'], ""), array_keys($mybb->input['find'], " ")) as $key) 200 { 201 unset($mybb->input['find'][$key]); 202 } 203 $mybb->input['find'] = implode("\n", $mybb->input['find']); 204 205 $updated_smilie = array( 206 "name" => $db->escape_string($mybb->input['name']), 207 "find" => $db->escape_string($mybb->input['find']), 208 "image" => $db->escape_string($mybb->input['image']), 209 "disporder" => $mybb->get_input('disporder', MyBB::INPUT_INT), 210 "showclickable" => $mybb->get_input('showclickable', MyBB::INPUT_INT) 211 ); 212 213 $plugins->run_hooks("admin_config_smilies_edit_commit"); 214 215 $db->update_query("smilies", $updated_smilie, "sid = '{$smilie['sid']}'"); 216 217 $cache->update_smilies(); 218 219 // Log admin action 220 log_admin_action($smilie['sid'], $mybb->input['name']); 221 222 flash_message($lang->success_smilie_updated, 'success'); 223 admin_redirect("index.php?module=config-smilies"); 224 } 225 } 226 227 $page->add_breadcrumb_item($lang->edit_smilie); 228 $page->output_header($lang->smilies." - ".$lang->edit_smilie); 229 230 $sub_tabs['edit_smilie'] = array( 231 'title' => $lang->edit_smilie, 232 'link' => "index.php?module=config-smilies&action=edit", 233 'description' => $lang->edit_smilie_desc 234 ); 235 $sub_tabs['mass_edit'] = array( 236 'title' => $lang->mass_edit, 237 'link' => "index.php?module=config-smilies&action=mass_edit", 238 ); 239 240 $page->output_nav_tabs($sub_tabs, 'edit_smilie'); 241 $form = new Form("index.php?module=config-smilies&action=edit", "post", "edit"); 242 243 echo $form->generate_hidden_field("sid", $smilie['sid']); 244 245 if($errors) 246 { 247 $page->output_inline_error($errors); 248 } 249 else 250 { 251 $mybb->input = array_merge($mybb->input, $smilie); 252 } 253 254 $form_container = new FormContainer($lang->edit_smilie); 255 $form_container->output_row($lang->name." <em>*</em>", "", $form->generate_text_box('name', $mybb->input['name'], array('id' => 'name')), 'name'); 256 $form_container->output_row($lang->text_replace." <em>*</em>", $lang->text_replace_desc, $form->generate_text_area('find', $mybb->input['find'], array('id' => 'find')), 'find'); 257 $form_container->output_row($lang->image_path." <em>*</em>", $lang->image_path_desc, $form->generate_text_box('image', $mybb->input['image'], array('id' => 'image')), 'image'); 258 $form_container->output_row($lang->display_order." <em>*</em>", $lang->display_order_desc, $form->generate_numeric_field('disporder', $mybb->input['disporder'], array('id' => 'disporder', 'min' => 0)), 'disporder'); 259 $form_container->output_row($lang->show_clickable." <em>*</em>", $lang->show_clickable_desc, $form->generate_yes_no_radio('showclickable', $mybb->input['showclickable'])); 260 $form_container->end(); 261 262 $buttons[] = $form->generate_submit_button($lang->save_smilie); 263 $buttons[] = $form->generate_reset_button($lang->reset); 264 265 $form->output_submit_wrapper($buttons); 266 $form->end(); 267 268 $page->output_footer(); 269 } 270 271 if($mybb->input['action'] == "delete") 272 { 273 $query = $db->simple_select("smilies", "*", "sid='".$mybb->get_input('sid', MyBB::INPUT_INT)."'"); 274 $smilie = $db->fetch_array($query); 275 276 // Does the smilie not exist? 277 if(!$smilie) 278 { 279 flash_message($lang->error_invalid_smilie, 'error'); 280 admin_redirect("index.php?module=config-smilies"); 281 } 282 283 // User clicked no 284 if($mybb->get_input('no')) 285 { 286 admin_redirect("index.php?module=config-smilies"); 287 } 288 289 $plugins->run_hooks("admin_config_smilies_delete"); 290 291 if($mybb->request_method == "post") 292 { 293 // Delete the smilie 294 $db->delete_query("smilies", "sid='{$smilie['sid']}'"); 295 296 $plugins->run_hooks("admin_config_smilies_delete_commit"); 297 298 $cache->update_smilies(); 299 300 // Log admin action 301 log_admin_action($smilie['sid'], $smilie['name']); 302 303 flash_message($lang->success_smilie_updated, 'success'); 304 admin_redirect("index.php?module=config-smilies"); 305 } 306 else 307 { 308 $page->output_confirm_action("index.php?module=config-smilies&action=delete&sid={$smilie['sid']}", $lang->confirm_smilie_deletion); 309 }} 310 311 if($mybb->input['action'] == "add_multiple") 312 { 313 $plugins->run_hooks("admin_config_smilies_add_multiple"); 314 315 if($mybb->request_method == "post") 316 { 317 if($mybb->input['step'] == 1) 318 { 319 $plugins->run_hooks("admin_config_smilies_add_multiple_step1"); 320 321 if(!trim($mybb->input['pathfolder'])) 322 { 323 $errors[] = $lang->error_missing_path_multiple; 324 } 325 326 $path = $mybb->input['pathfolder']; 327 $dir = @opendir(MYBB_ROOT.$path); 328 329 if(!$dir) 330 { 331 $errors[] = $lang->error_invalid_path; 332 } 333 334 if($path && !is_array($errors)) 335 { 336 if(substr($path, -1, 1) !== "/") 337 { 338 $path .= "/"; 339 } 340 341 $query = $db->simple_select("smilies"); 342 343 $asmilies = array(); 344 while($smilie = $db->fetch_array($query)) 345 { 346 $asmilies[$smilie['image']] = 1; 347 } 348 349 $smilies = array(); 350 while($file = readdir($dir)) 351 { 352 if($file != ".." && $file != ".") 353 { 354 $ext = get_extension($file); 355 if($ext == "gif" || $ext == "jpg" || $ext == "jpeg" || $ext == "png" || $ext == "bmp") 356 { 357 if(!$asmilies[$path.$file]) 358 { 359 $smilies[] = $file; 360 } 361 } 362 } 363 } 364 closedir($dir); 365 366 if(count($smilies) == 0) 367 { 368 $errors[] = $lang->error_no_smilies; 369 } 370 } 371 372 if(!$errors) 373 { 374 $page->add_breadcrumb_item($lang->add_multiple_smilies); 375 $page->output_header($lang->smilies." - ".$lang->add_multiple_smilies); 376 377 $sub_tabs['manage_smilies'] = array( 378 'title' => $lang->manage_smilies, 379 'link' => "index.php?module=config-smilies", 380 ); 381 $sub_tabs['add_smilie'] = array( 382 'title' => $lang->add_smilie, 383 'link' => "index.php?module=config-smilies&action=add" 384 ); 385 $sub_tabs['add_multiple_smilies'] = array( 386 'title' => $lang->add_multiple_smilies, 387 'link' => "index.php?module=config-smilies&action=add_multiple", 388 'description' => $lang->add_multiple_smilies_desc 389 ); 390 $sub_tabs['mass_edit'] = array( 391 'title' => $lang->mass_edit, 392 'link' => "index.php?module=config-smilies&action=mass_edit" 393 ); 394 395 $page->output_nav_tabs($sub_tabs, 'add_multiple_smilies'); 396 $form = new Form("index.php?module=config-smilies&action=add_multiple", "post", "add_multiple"); 397 echo $form->generate_hidden_field("step", "2"); 398 echo $form->generate_hidden_field("pathfolder", $path); 399 400 $form_container = new FormContainer($lang->add_multiple_smilies); 401 $form_container->output_row_header($lang->image, array("class" => "align_center", 'width' => '10%')); 402 $form_container->output_row_header($lang->name); 403 $form_container->output_row_header($lang->text_replace, array('width' => '20%')); 404 $form_container->output_row_header($lang->include, array("class" => "align_center", 'width' => '5%')); 405 406 foreach($smilies as $key => $file) 407 { 408 $ext = get_extension($file); 409 $find = str_replace(".".$ext, "", $file); 410 $name = ucfirst($find); 411 412 $file = htmlspecialchars_uni($file); 413 414 $form_container->output_cell("<img src=\"../".htmlspecialchars_uni($path).$file."\" alt=\"\" /><br /><small>{$file}</small>", array("class" => "align_center", "width" => 1)); 415 $form_container->output_cell($form->generate_text_box("name[{$file}]", htmlspecialchars_uni($name), array('id' => 'name', 'style' => 'width: 98%'))); 416 $form_container->output_cell($form->generate_text_box("find[{$file}]", ":".$find.":", array('id' => 'find', 'style' => 'width: 95%'))); 417 $form_container->output_cell($form->generate_check_box("include[{$file}]", 1, "", array('checked' => 1)), array("class" => "align_center")); 418 $form_container->construct_row(); 419 } 420 421 if($form_container->num_rows() == 0) 422 { 423 flash_message($lang->error_no_images, 'error'); 424 admin_redirect("index.php?module=config-smilies&action=add_multiple"); 425 } 426 427 $form_container->end(); 428 429 $buttons[] = $form->generate_submit_button($lang->save_smilies); 430 431 $form->output_submit_wrapper($buttons); 432 $form->end(); 433 434 $page->output_footer(); 435 exit; 436 } 437 } 438 else 439 { 440 $plugins->run_hooks("admin_config_smilies_add_multiple_step2"); 441 442 $path = $mybb->input['pathfolder']; 443 reset($mybb->input['include']); 444 $find = $mybb->input['find']; 445 $name = $mybb->input['name']; 446 447 if(empty($mybb->input['include'])) 448 { 449 flash_message($lang->error_none_included, 'error'); 450 admin_redirect("index.php?module=config-smilies&action=add_multiple"); 451 } 452 453 $query = $db->simple_select('smilies', 'MAX(disporder) as max_disporder'); 454 $disporder = $db->fetch_field($query, 'max_disporder'); 455 456 foreach($mybb->input['include'] as $image => $insert) 457 { 458 $find[$image] = str_replace("\r\n", "\n", $find[$image]); 459 $find[$image] = str_replace("\r", "\n", $find[$image]); 460 $find[$image] = explode("\n", $find[$image]); 461 foreach(array_merge(array_keys($find[$image], ""), array_keys($find[$image], " ")) as $key) 462 { 463 unset($find[$image][$key]); 464 } 465 $find[$image] = implode("\n", $find[$image]); 466 467 if($insert) 468 { 469 $new_smilie = array( 470 "name" => $db->escape_string($name[$image]), 471 "find" => $db->escape_string($find[$image]), 472 "image" => $db->escape_string($path.$image), 473 "disporder" => ++$disporder, 474 "showclickable" => 1 475 ); 476 477 $db->insert_query("smilies", $new_smilie); 478 } 479 } 480 481 $plugins->run_hooks("admin_config_smilies_add_multiple_commit"); 482 483 $cache->update_smilies(); 484 485 // Log admin action 486 log_admin_action(); 487 488 flash_message($lang->success_multiple_smilies_added, 'success'); 489 admin_redirect("index.php?module=config-smilies"); 490 } 491 } 492 493 $page->add_breadcrumb_item($lang->add_multiple_smilies); 494 $page->output_header($lang->smilies." - ".$lang->add_multiple_smilies); 495 496 $sub_tabs['manage_smilies'] = array( 497 'title' => $lang->manage_smilies, 498 'link' => "index.php?module=config-smilies", 499 ); 500 $sub_tabs['add_smilie'] = array( 501 'title' => $lang->add_smilie, 502 'link' => "index.php?module=config-smilies&action=add" 503 ); 504 $sub_tabs['add_multiple_smilies'] = array( 505 'title' => $lang->add_multiple_smilies, 506 'link' => "index.php?module=config-smilies&action=add_multiple", 507 'description' => $lang->add_multiple_smilies_desc 508 ); 509 $sub_tabs['mass_edit'] = array( 510 'title' => $lang->mass_edit, 511 'link' => "index.php?module=config-smilies&action=mass_edit" 512 ); 513 514 $page->output_nav_tabs($sub_tabs, 'add_multiple_smilies'); 515 $form = new Form("index.php?module=config-smilies&action=add_multiple", "post", "add_multiple"); 516 echo $form->generate_hidden_field("step", "1"); 517 518 if($errors) 519 { 520 $page->output_inline_error($errors); 521 } 522 523 $form_container = new FormContainer($lang->add_multiple_smilies); 524 $form_container->output_row($lang->path_to_images, $lang->path_to_images_desc, $form->generate_text_box('pathfolder', $mybb->get_input('pathfolder'), array('id' => 'pathfolder')), 'pathfolder'); 525 $form_container->end(); 526 527 $buttons[] = $form->generate_submit_button($lang->show_smilies); 528 529 $form->output_submit_wrapper($buttons); 530 $form->end(); 531 532 $page->output_footer(); 533 } 534 535 if($mybb->input['action'] == "mass_edit") 536 { 537 $plugins->run_hooks("admin_config_smilies_mass_edit"); 538 539 if($mybb->request_method == "post") 540 { 541 foreach($mybb->input['name'] as $sid => $name) 542 { 543 $disporder = (int)$mybb->input['disporder'][$sid]; 544 545 $sid = (int)$sid; 546 if(!empty($mybb->input['delete'][$sid])) 547 { 548 // Dirty hack to get the disporder working. Note: this doesn't work in every case 549 unset($mybb->input['disporder'][$sid]); 550 551 $db->delete_query("smilies", "sid = '{$sid}'", 1); 552 } 553 else 554 { 555 $mybb->input['find'][$sid] = str_replace("\r\n", "\n", $mybb->input['find'][$sid]); 556 $mybb->input['find'][$sid] = str_replace("\r", "\n", $mybb->input['find'][$sid]); 557 $mybb->input['find'][$sid] = explode("\n", $mybb->input['find'][$sid]); 558 foreach(array_merge(array_keys($mybb->input['find'][$sid], ""), array_keys($mybb->input['find'][$sid], " ")) as $key) 559 { 560 unset($mybb->input['find'][$sid][$key]); 561 } 562 $mybb->input['find'][$sid] = implode("\n", $mybb->input['find'][$sid]); 563 564 $smilie = array( 565 "name" => $db->escape_string($mybb->input['name'][$sid]), 566 "find" => $db->escape_string($mybb->input['find'][$sid]), 567 "showclickable" => $db->escape_string($mybb->input['showclickable'][$sid]) 568 ); 569 570 // $test contains all disporders except the actual one so we can check whether we have multiple disporders 571 $test = $mybb->input['disporder']; 572 unset($test[$sid]); 573 if(!in_array($disporder, $test)) 574 { 575 $smilie['disporder'] = $disporder; 576 } 577 578 $db->update_query("smilies", $smilie, "sid = '{$sid}'"); 579 } 580 581 $disporder_list[$disporder] = $disporder; 582 } 583 584 $plugins->run_hooks("admin_config_smilies_mass_edit_commit"); 585 586 $cache->update_smilies(); 587 588 // Log admin action 589 log_admin_action(); 590 591 flash_message($lang->success_multiple_smilies_updated, 'success'); 592 admin_redirect("index.php?module=config-smilies"); 593 } 594 595 $page->add_breadcrumb_item($lang->mass_edit); 596 $page->output_header($lang->smilies." - ".$lang->mass_edit); 597 598 $sub_tabs['manage_smilies'] = array( 599 'title' => $lang->manage_smilies, 600 'link' => "index.php?module=config-smilies", 601 ); 602 $sub_tabs['add_smilie'] = array( 603 'title' => $lang->add_smilie, 604 'link' => "index.php?module=config-smilies&action=add", 605 ); 606 $sub_tabs['add_multiple_smilies'] = array( 607 'title' => $lang->add_multiple_smilies, 608 'link' => "index.php?module=config-smilies&action=add_multiple", 609 ); 610 $sub_tabs['mass_edit'] = array( 611 'title' => $lang->mass_edit, 612 'link' => "index.php?module=config-smilies&action=mass_edit", 613 'description' => $lang->mass_edit_desc 614 ); 615 616 $page->output_nav_tabs($sub_tabs, 'mass_edit'); 617 618 $form = new Form("index.php?module=config-smilies&action=mass_edit", "post", "mass_edit"); 619 620 if($errors) 621 { 622 $page->output_inline_error($errors); 623 } 624 else 625 { 626 $mybb->input['path'] = 'images/smilies/'; 627 $mybb->input['showclickable'] = 1; 628 } 629 630 if(!$mybb->get_input('disporder')) 631 { 632 $query = $db->simple_select("smilies", "max(disporder) as dispordermax"); 633 $mybb->input['disporder'] = $db->fetch_field($query, "dispordermax")+1; 634 } 635 636 $form_container = new FormContainer($lang->manage_smilies); 637 $form_container->output_row_header($lang->image, array("class" => "align_center", 'width' => '1')); 638 $form_container->output_row_header($lang->name); 639 $form_container->output_row_header($lang->text_replace, array('width' => '20%')); 640 $form_container->output_row_header($lang->order, array('width' => '5%')); 641 $form_container->output_row_header($lang->mass_edit_show_clickable, array("width" => 165)); 642 $form_container->output_row_header($lang->smilie_delete, array("class" => "align_center", 'width' => '5%')); 643 644 $query = $db->simple_select("smilies", "*", "", array('order_by' => 'disporder')); 645 while($smilie = $db->fetch_array($query)) 646 { 647 $smilie['image'] = str_replace("{theme}", "images", $smilie['image']); 648 if(my_validate_url($smilie['image'], true)) 649 { 650 $image = htmlspecialchars_uni($smilie['image']); 651 } 652 else 653 { 654 $image = "../".htmlspecialchars_uni($smilie['image']); 655 } 656 657 $form_container->output_cell("<img src=\"{$image}\" alt=\"\" />", array("class" => "align_center", "width" => 1)); 658 $form_container->output_cell($form->generate_text_box("name[{$smilie['sid']}]", $smilie['name'], array('id' => 'name', 'style' => 'width: 98%'))); 659 $form_container->output_cell($form->generate_text_area("find[{$smilie['sid']}]", $smilie['find'], array('id' => 'find', 'style' => 'width: 95%'))); 660 $form_container->output_cell($form->generate_numeric_field("disporder[{$smilie['sid']}]", $smilie['disporder'], array('id' => 'disporder', 'style' => 'width: 80%', 'min' => 0))); 661 $form_container->output_cell($form->generate_yes_no_radio("showclickable[{$smilie['sid']}]", $smilie['showclickable']), array("class" => "align_center")); 662 $form_container->output_cell($form->generate_check_box("delete[{$smilie['sid']}]", 1, $mybb->get_input('delete')), array("class" => "align_center")); 663 $form_container->construct_row(); 664 } 665 666 if($form_container->num_rows() == 0) 667 { 668 $form_container->output_cell($lang->no_smilies, array('colspan' => 6)); 669 $form_container->construct_row(); 670 } 671 672 $form_container->end(); 673 674 $buttons[] = $form->generate_submit_button($lang->save_smilies); 675 $buttons[] = $form->generate_reset_button($lang->reset); 676 677 $form->output_submit_wrapper($buttons); 678 $form->end(); 679 680 $page->output_footer(); 681 } 682 683 if(!$mybb->input['action']) 684 { 685 $plugins->run_hooks("admin_config_smilies_start"); 686 687 $page->output_header($lang->manage_smilies); 688 689 $sub_tabs['manage_smilies'] = array( 690 'title' => $lang->manage_smilies, 691 'link' => "index.php?module=config-smilies", 692 'description' => $lang->manage_smilies_desc 693 ); 694 $sub_tabs['add_smilie'] = array( 695 'title' => $lang->add_smilie, 696 'link' => "index.php?module=config-smilies&action=add", 697 ); 698 $sub_tabs['add_multiple_smilies'] = array( 699 'title' => $lang->add_multiple_smilies, 700 'link' => "index.php?module=config-smilies&action=add_multiple", 701 ); 702 $sub_tabs['mass_edit'] = array( 703 'title' => $lang->mass_edit, 704 'link' => "index.php?module=config-smilies&action=mass_edit", 705 ); 706 707 $page->output_nav_tabs($sub_tabs, 'manage_smilies'); 708 709 $query = $db->simple_select("smilies", "COUNT(sid) as smilies"); 710 $total_rows = $db->fetch_field($query, "smilies"); 711 712 $pagenum = $mybb->get_input('page', MyBB::INPUT_INT); 713 if($pagenum) 714 { 715 $start = ($pagenum-1) * 20; 716 $pages = ceil($total_rows / 20); 717 if($pagenum > $pages) 718 { 719 $start = 0; 720 $pagenum = 1; 721 } 722 } 723 else 724 { 725 $start = 0; 726 $pagenum = 1; 727 } 728 729 730 $table = new Table; 731 $table->construct_header($lang->image, array("class" => "align_center", "width" => 1)); 732 $table->construct_header($lang->name, array("width" => "35%")); 733 $table->construct_header($lang->text_replace, array("width" => "35%")); 734 $table->construct_header($lang->controls, array("class" => "align_center", "colspan" => 2)); 735 736 $query = $db->simple_select("smilies", "*", "", array('limit_start' => $start, 'limit' => 20, 'order_by' => 'disporder')); 737 while($smilie = $db->fetch_array($query)) 738 { 739 $smilie['image'] = str_replace("{theme}", "images", $smilie['image']); 740 if(my_validate_url($smilie['image'], true)) 741 { 742 $image = htmlspecialchars_uni($smilie['image']); 743 } 744 else 745 { 746 $image = "../".htmlspecialchars_uni($smilie['image']); 747 } 748 749 $table->construct_cell("<img src=\"{$image}\" alt=\"\" class=\"smilie smilie_{$smilie['sid']}\" />", array("class" => "align_center")); 750 $table->construct_cell(htmlspecialchars_uni($smilie['name'])); 751 $table->construct_cell(nl2br(htmlspecialchars_uni($smilie['find']))); 752 753 $table->construct_cell("<a href=\"index.php?module=config-smilies&action=edit&sid={$smilie['sid']}\">{$lang->edit}</a>", array("class" => "align_center")); 754 $table->construct_cell("<a href=\"index.php?module=config-smilies&action=delete&sid={$smilie['sid']}&my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_smilie_deletion}')\">{$lang->delete}</a>", array("class" => "align_center")); 755 $table->construct_row(); 756 } 757 758 if($table->num_rows() == 0) 759 { 760 $table->construct_cell($lang->no_smilies, array('colspan' => 5)); 761 $table->construct_row(); 762 } 763 764 $table->output($lang->manage_smilies); 765 766 echo "<br />".draw_admin_pagination($pagenum, "20", $total_rows, "index.php?module=config-smilies&page={page}"); 767 768 $page->output_footer(); 769 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup | Cross-referenced by PHPXref |