[ Index ]

PHP Cross Reference of MyBB 1.8.30

title

Body

[close]

/admin/modules/config/ -> help_documents.php (source)

   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->help_documents, "index.php?module=config-help_documents");
  18  
  19  $plugins->run_hooks("admin_config_help_documents_begin");
  20  
  21  // Add something
  22  if($mybb->input['action'] == "add")
  23  {
  24      $plugins->run_hooks("admin_config_help_documents_add");
  25  
  26      // Add section
  27      if($mybb->input['type'] == "section")
  28      {
  29          $plugins->run_hooks("admin_config_help_documents_add_section");
  30  
  31          // Do add?
  32          if($mybb->request_method == "post")
  33          {
  34              if(empty($mybb->input['name']))
  35              {
  36                  $errors[] = $lang->error_section_missing_name;
  37              }
  38  
  39              if(empty($mybb->input['description']))
  40              {
  41                  $errors[] = $lang->error_section_missing_description;
  42              }
  43  
  44              if(!isset($mybb->input['enabled']))
  45              {
  46                  $errors[] = $lang->error_section_missing_enabled;
  47              }
  48  
  49              if($mybb->input['enabled'] != 1)
  50              {
  51                  $mybb->input['enabled'] = 0;
  52              }
  53  
  54              if(!is_array($errors))
  55              {
  56                  $sql_array = array(
  57                      "name" => $db->escape_string($mybb->input['name']),
  58                      "description" => $db->escape_string($mybb->input['description']),
  59                      "usetranslation" => $mybb->get_input('usetranslation', MyBB::INPUT_INT),
  60                      "enabled" => $mybb->get_input('enabled', MyBB::INPUT_INT),
  61                      "disporder" => $mybb->get_input('disporder', MyBB::INPUT_INT)
  62                  );
  63  
  64                  $sid = $db->insert_query("helpsections", $sql_array);
  65  
  66                  $plugins->run_hooks("admin_config_help_documents_add_section_commit");
  67  
  68                  // Log admin action
  69                  log_admin_action($sid, $mybb->input['name'], 'section');
  70  
  71                  flash_message($lang->success_help_section_added, 'success');
  72                  admin_redirect('index.php?module=config-help_documents');
  73              }
  74          }
  75  
  76          $page->add_breadcrumb_item($lang->add_new_section);
  77          $page->output_header($lang->help_documents." - ".$lang->add_new_section);
  78  
  79          $sub_tabs['manage_help_documents'] = array(
  80              'title'    => $lang->manage_help_documents,
  81              'link'    => "index.php?module=config-help_documents"
  82          );
  83  
  84          $sub_tabs['add_help_document'] = array(
  85              'title'    => $lang->add_new_document,
  86              'link'    => "index.php?module=config-help_documents&amp;action=add&amp;type=document"
  87          );
  88  
  89          $sub_tabs['add_help_section'] = array(
  90              'title'    => $lang->add_new_section,
  91              'link'    => "index.php?module=config-help_documents&amp;action=add&amp;type=section",
  92              'description' => $lang->add_new_section_desc
  93          );
  94  
  95          $page->output_nav_tabs($sub_tabs, 'add_help_section');
  96  
  97          if($errors)
  98          {
  99              $page->output_inline_error($errors);
 100          }
 101          else
 102          {
 103              $query = $db->simple_select("helpsections", "MAX(disporder) as maxdisp");
 104              $mybb->input['disporder'] = $db->fetch_field($query, "maxdisp")+1;
 105              $mybb->input['enabled'] = 1;
 106              $mybb->input['usetranslation'] = 1;
 107          }
 108  
 109          $form = new Form("index.php?module=config-help_documents&amp;action=add&amp;type=section", "post", "add");
 110          echo $form->generate_hidden_field("usetranslation", $mybb->input['usetranslation']);
 111  
 112          $form_container = new FormContainer($lang->add_new_section);
 113          $form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('name', $mybb->get_input('name'), array('id' => 'name')), 'name');
 114          $form_container->output_row($lang->short_description." <em>*</em>", "", $form->generate_text_box('description', $mybb->get_input('description'), array('id' => 'description')), 'description');
 115          $form_container->output_row($lang->display_order, "", $form->generate_numeric_field('disporder', $mybb->get_input('disporder'), array('id' => 'disporder', 'min' => 0)), 'disporder');
 116          $form_container->output_row($lang->enabled." <em>*</em>", "", $form->generate_yes_no_radio('enabled', $mybb->get_input('enabled')));
 117          $form_container->end();
 118  
 119          $buttons[] = $form->generate_submit_button($lang->save_section);
 120  
 121          $form->output_submit_wrapper($buttons);
 122          $form->end();
 123      }
 124  
 125      // Add page
 126      else
 127      {
 128          $plugins->run_hooks("admin_config_help_documents_add_page");
 129  
 130          // Do add?
 131          if($mybb->request_method == "post")
 132          {
 133              if(empty($mybb->input['sid']))
 134              {
 135                  $errors[] = $lang->error_missing_sid;
 136              }
 137  
 138              if(empty($mybb->input['name']))
 139              {
 140                  $errors[] = $lang->error_document_missing_name;
 141              }
 142  
 143              if(empty($mybb->input['description']))
 144              {
 145                  $errors[] = $lang->error_document_missing_description;
 146              }
 147  
 148              if(empty($mybb->input['document']))
 149              {
 150                  $errors[] = $lang->error_document_missing_document;
 151              }
 152  
 153              if(!isset($mybb->input['enabled']))
 154              {
 155                  $errors[] = $lang->error_document_missing_enabled;
 156              }
 157  
 158              if($mybb->input['enabled'] != 1)
 159              {
 160                  $mybb->input['enabled'] = 0;
 161              }
 162  
 163              if(!is_array($errors))
 164              {
 165                  $sql_array = array(
 166                      "sid" => $mybb->get_input('sid', MyBB::INPUT_INT),
 167                      "name" => $db->escape_string($mybb->input['name']),
 168                      "description" => $db->escape_string($mybb->input['description']),
 169                      "document" => $db->escape_string($mybb->input['document']),
 170                      "usetranslation" => $mybb->get_input('usetranslation', MyBB::INPUT_INT),
 171                      "enabled" => $mybb->get_input('enabled', MyBB::INPUT_INT),
 172                      "disporder" => $mybb->get_input('disporder', MyBB::INPUT_INT)
 173                  );
 174  
 175                  $hid = $db->insert_query("helpdocs", $sql_array);
 176  
 177                  $plugins->run_hooks("admin_config_help_documents_add_page_commit");
 178  
 179                  // Log admin action
 180                  log_admin_action($hid, $mybb->input['name'], 'document');
 181  
 182                  flash_message($lang->success_help_document_added, 'success');
 183                  admin_redirect('index.php?module=config-help_documents');
 184              }
 185          }
 186  
 187          $page->add_breadcrumb_item($lang->add_new_document);
 188          $page->output_header($lang->help_documents." - ".$lang->add_new_document);
 189  
 190          $sub_tabs['manage_help_documents'] = array(
 191              'title'    => $lang->manage_help_documents,
 192              'link'    => "index.php?module=config-help_documents"
 193          );
 194  
 195          $sub_tabs['add_help_document'] = array(
 196              'title'    => $lang->add_new_document,
 197              'link'    => "index.php?module=config-help_documents&amp;action=add&amp;type=document",
 198              'description' => $lang->add_new_document_desc
 199          );
 200  
 201          $sub_tabs['add_help_section'] = array(
 202              'title'    => $lang->add_new_section,
 203              'link'    => "index.php?module=config-help_documents&amp;action=add&amp;type=section"
 204          );
 205  
 206          $page->output_nav_tabs($sub_tabs, 'add_help_document');
 207  
 208          if($errors)
 209          {
 210              $page->output_inline_error($errors);
 211          }
 212          else
 213          {
 214              // Select the largest existing display order
 215              $query = $db->simple_select("helpdocs", "MAX(disporder) as maxdisp");
 216              $mybb->input['disporder'] = $db->fetch_field($query, "maxdisp")+1;
 217              $mybb->input['enabled'] = 1;
 218              $mybb->input['usetranslation'] = 1;
 219          }
 220  
 221          $form = new Form("index.php?module=config-help_documents&amp;action=add&amp;type=document", "post", "add");
 222          echo $form->generate_hidden_field("usetranslation", $mybb->input['usetranslation']);
 223  
 224          $form_container = new FormContainer($lang->add_new_document);
 225          $query = $db->simple_select("helpsections", "sid, name");
 226  
 227          $sections = array();
 228          while($section = $db->fetch_array($query))
 229          {
 230              $sections[$section['sid']] = $section['name'];
 231          }
 232          $form_container->output_row($lang->section." <em>*</em>", "", $form->generate_select_box("sid", $sections, $mybb->get_input('sid'), array('id' => 'sid')), 'sid');
 233          $form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('name', $mybb->get_input('name'), array('id' => 'name')), 'name');
 234          $form_container->output_row($lang->short_description." <em>*</em>", "", $form->generate_text_box('description', $mybb->get_input('description'), array('id' => 'description')), 'description');
 235          $form_container->output_row($lang->document." <em>*</em>", "", $form->generate_text_area('document', $mybb->get_input('document'), array('id' => 'document')), 'document');
 236          $form_container->output_row($lang->display_order, "", $form->generate_numeric_field('disporder', $mybb->get_input('disporder'), array('id' => 'disporder', 'min' => 0)), 'disporder');
 237          $form_container->output_row($lang->enabled." <em>*</em>", "", $form->generate_yes_no_radio('enabled', $mybb->get_input('enabled')));
 238          $form_container->end();
 239  
 240          $buttons[] = $form->generate_submit_button($lang->save_document);
 241  
 242          $form->output_submit_wrapper($buttons);
 243          $form->end();
 244      }
 245  
 246      $page->output_footer();
 247  }
 248  
 249  // Edit something
 250  if($mybb->input['action'] == "edit")
 251  {
 252      $plugins->run_hooks("admin_config_help_documents_edit");
 253  
 254      // Edit a section
 255      if(isset($mybb->input['sid']) && !$mybb->get_input('hid'))
 256      {
 257          $query = $db->simple_select("helpsections", "*", "sid = '".$mybb->get_input('sid', MyBB::INPUT_INT)."'");
 258          $section = $db->fetch_array($query);
 259  
 260          if(!$section['sid'])
 261          {
 262              flash_message($lang->error_missing_section_id, 'error');
 263              admin_redirect("index.php?module=config-help_documents");
 264          }
 265  
 266          $plugins->run_hooks("admin_config_help_documents_edit_section");
 267  
 268          // Do edit?
 269          if($mybb->request_method == "post")
 270          {
 271              $sid = $mybb->get_input('sid', MyBB::INPUT_INT);
 272  
 273              if(empty($sid))
 274              {
 275                  $errors[] = $lang->error_invalid_sid;
 276              }
 277  
 278              if(empty($mybb->input['name']))
 279              {
 280                  $errors[] = $lang->error_section_missing_name;
 281              }
 282  
 283              if(empty($mybb->input['description']))
 284              {
 285                  $errors[] = $lang->error_section_missing_description;
 286              }
 287  
 288              if(!isset($mybb->input['enabled']))
 289              {
 290                  $errors[] = $lang->error_section_missing_enabled;
 291              }
 292  
 293              if($mybb->input['enabled'] != 1)
 294              {
 295                  $mybb->input['enabled'] = 0;
 296              }
 297  
 298              if(!is_array($errors))
 299              {
 300                  $sql_array = array(
 301                      "name" => $db->escape_string($mybb->input['name']),
 302                      "description" => $db->escape_string($mybb->input['description']),
 303                      "usetranslation" => $mybb->get_input('usetranslation', MyBB::INPUT_INT),
 304                      "enabled" => $mybb->get_input('enabled', MyBB::INPUT_INT),
 305                      "disporder" => $mybb->get_input('disporder', MyBB::INPUT_INT)
 306                  );
 307  
 308                  $plugins->run_hooks("admin_config_help_documents_edit_section_commit");
 309  
 310                  $db->update_query("helpsections", $sql_array, "sid = '{$sid}'");
 311  
 312                  // Log admin action
 313                  log_admin_action($sid, $mybb->input['name'], 'section');
 314  
 315                  flash_message($lang->success_help_section_updated, 'success');
 316                  admin_redirect('index.php?module=config-help_documents');
 317              }
 318          }
 319  
 320          $page->add_breadcrumb_item($lang->edit_section);
 321          $page->output_header($lang->help_documents." - ".$lang->edit_section);
 322  
 323  
 324          $sub_tabs['edit_help_section'] = array(
 325              'title'    => $lang->edit_section,
 326              'link'    => "index.php?module=config-help_documents&amp;action=edit&amp;sid=".$section['sid'],
 327              'description' => $lang->edit_section_desc
 328          );
 329  
 330          $page->output_nav_tabs($sub_tabs, 'edit_help_section');
 331  
 332          if($errors)
 333          {
 334              $page->output_inline_error($errors);
 335          }
 336          else
 337          {
 338              $mybb->input['sid'] = $section['sid'];
 339              $mybb->input['name'] = $section['name'];
 340              $mybb->input['description'] = $section['description'];
 341              $mybb->input['disporder'] = $section['disporder'];
 342              $mybb->input['enabled'] = $section['enabled'];
 343              $mybb->input['usetranslation'] = $section['usetranslation'];
 344          }
 345  
 346          $form = new Form("index.php?module=config-help_documents&amp;action=edit", "post", "edit");
 347  
 348          echo $form->generate_hidden_field("sid", $section['sid']);
 349          echo $form->generate_hidden_field("usetranslation", $mybb->input['usetranslation']);
 350  
 351          $form_container = new FormContainer($lang->edit_section." ({$lang->id} ".$section['sid'].")");
 352          $form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('name', $mybb->input['name'], array('id' => 'name')), 'name');
 353          $form_container->output_row($lang->short_description." <em>*</em>", "", $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description');
 354          $form_container->output_row($lang->display_order, "", $form->generate_numeric_field('disporder', $mybb->input['disporder'], array('id' => 'disporder', 'min' => 0)), 'disporder');
 355          $form_container->output_row($lang->enabled." <em>*</em>", "", $form->generate_yes_no_radio('enabled', $mybb->input['enabled']));
 356          $form_container->end();
 357  
 358          $buttons[] = $form->generate_submit_button($lang->edit_section);
 359  
 360          $form->output_submit_wrapper($buttons);
 361          $form->end();
 362      }
 363  
 364      // Edit document
 365      else
 366      {
 367          $query = $db->simple_select("helpdocs", "*", "hid = '".$mybb->get_input('hid', MyBB::INPUT_INT)."'");
 368          $doc = $db->fetch_array($query);
 369  
 370          // Invalid document?
 371          if(!$doc['hid'])
 372          {
 373              flash_message($lang->error_missing_hid, 'error');
 374              admin_redirect("index.php?module=config-help_documents");
 375          }
 376  
 377          $plugins->run_hooks("admin_config_help_documents_edit_page");
 378  
 379          // Do edit?
 380          $hid = $mybb->get_input('hid', MyBB::INPUT_INT);
 381  
 382          if($mybb->request_method == "post")
 383          {
 384              if(empty($hid))
 385              {
 386                  $errors[] = $lang->error_invalid_sid;
 387              }
 388  
 389              if(empty($mybb->input['name']))
 390              {
 391                  $errors[] = $lang->error_document_missing_name;
 392              }
 393  
 394              if(empty($mybb->input['description']))
 395              {
 396                  $errors[] = $lang->error_document_missing_description;
 397              }
 398  
 399              if(empty($mybb->input['document']))
 400              {
 401                  $errors[] = $lang->error_document_missing_document;
 402              }
 403  
 404              if(!isset($mybb->input['enabled']))
 405              {
 406                  $errors[] = $lang->error_document_missing_enabled;
 407              }
 408  
 409              if($mybb->input['enabled'] != 1)
 410              {
 411                  $mybb->input['enabled'] = 0;
 412              }
 413  
 414              if(!is_array($errors))
 415              {
 416                  $sql_array = array(
 417                      "sid" => $mybb->get_input('sid', MyBB::INPUT_INT),
 418                      "name" => $db->escape_string($mybb->input['name']),
 419                      "description" => $db->escape_string($mybb->input['description']),
 420                      "document" => $db->escape_string($mybb->input['document']),
 421                      "usetranslation" => $mybb->get_input('usetranslation', MyBB::INPUT_INT),
 422                      "enabled" => $mybb->get_input('enabled', MyBB::INPUT_INT),
 423                      "disporder" => $mybb->get_input('disporder', MyBB::INPUT_INT)
 424                  );
 425  
 426                  $plugins->run_hooks("admin_config_help_documents_edit_page_commit");
 427  
 428                  $db->update_query("helpdocs", $sql_array, "hid = '{$hid}'");
 429  
 430                  // Log admin action
 431                  log_admin_action($hid, $mybb->input['name'], 'document');
 432  
 433                  flash_message($lang->success_help_document_updated, 'success');
 434                  admin_redirect('index.php?module=config-help_documents');
 435              }
 436          }
 437  
 438          $page->add_breadcrumb_item($lang->edit_document);
 439          $page->output_header($lang->help_documents." - ".$lang->edit_document);
 440  
 441  
 442          $sub_tabs['edit_help_document'] = array(
 443              'title'    => $lang->edit_document,
 444              'link'    => "index.php?module=config-help_documents&amp;action=edit&amp;hid=".$doc['hid'],
 445              'description' => $lang->edit_document_desc
 446          );
 447  
 448          $page->output_nav_tabs($sub_tabs, 'edit_help_document');
 449  
 450          if($errors)
 451          {
 452              $page->output_inline_error($errors);
 453          }
 454          else
 455          {
 456              $mybb->input['hid'] = $doc['hid'];
 457              $mybb->input['sid'] = $doc['sid'];
 458              $mybb->input['name'] = $doc['name'];
 459              $mybb->input['description'] = $doc['description'];
 460              $mybb->input['document'] = $doc['document'];
 461              $mybb->input['disporder'] = $doc['disporder'];
 462              $mybb->input['enabled'] = $doc['enabled'];
 463              $mybb->input['usetranslation'] = $doc['usetranslation'];
 464          }
 465  
 466          $form = new Form("index.php?module=config-help_documents&amp;action=edit", "post", "edit");
 467  
 468          echo $form->generate_hidden_field("hid", $doc['hid']);
 469          echo $form->generate_hidden_field("usetranslation", $mybb->input['usetranslation']);
 470  
 471          $form_container = new FormContainer($lang->edit_document." ({$lang->id} ".$doc['hid'].")");
 472  
 473          $sections = array();
 474          $query = $db->simple_select("helpsections", "sid, name");
 475          while($section = $db->fetch_array($query))
 476          {
 477              $sections[$section['sid']] = $section['name'];
 478          }
 479          $form_container->output_row($lang->section." <em>*</em>", "", $form->generate_select_box("sid", $sections, $mybb->input['sid']), 'sid');
 480          $form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('name', $mybb->input['name'], array('id' => 'name')), 'name');
 481          $form_container->output_row($lang->short_description." <em>*</em>", "", $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description');
 482          $form_container->output_row($lang->document." <em>*</em>", "", $form->generate_text_area('document', $mybb->input['document'], array('id' => 'document')), 'document');
 483          $form_container->output_row($lang->display_order, "", $form->generate_numeric_field('disporder', $mybb->input['disporder'], array('id' => 'disporder', 'min' => 0)), 'disporder');
 484          $form_container->output_row($lang->enabled." <em>*</em>", "", $form->generate_yes_no_radio('enabled', $mybb->input['enabled']));
 485          $form_container->end();
 486  
 487          $buttons[] = $form->generate_submit_button($lang->edit_document);
 488  
 489          $form->output_submit_wrapper($buttons);
 490          $form->end();
 491      }
 492  
 493      $page->output_footer();
 494  }
 495  
 496  // Delete something
 497  if($mybb->input['action'] == "delete")
 498  {
 499      // User clicked no
 500      if($mybb->get_input('no'))
 501      {
 502          admin_redirect("index.php?module=config-help_documents");
 503      }
 504  
 505      $plugins->run_hooks("admin_config_help_documents_delete");
 506  
 507      // Do delete something?
 508      if($mybb->request_method == "post")
 509      {
 510          // Delete section
 511          if(isset($mybb->input['sid']))
 512          {
 513              $sid = $mybb->get_input('sid', MyBB::INPUT_INT);
 514  
 515              $query = $db->simple_select("helpsections", "*", "sid='{$sid}'");
 516              $section = $db->fetch_array($query);
 517  
 518              // Invalid section?
 519              if(!$section['sid'])
 520              {
 521                  flash_message($lang->error_missing_section_id, 'error');
 522                  admin_redirect("index.php?module=config-help_documents");
 523              }
 524  
 525              // Delete section and its documents
 526              $db->delete_query("helpsections", "sid = '{$section['sid']}'", 1);
 527              $db->delete_query("helpdocs", "sid = '{$section['sid']}'");
 528  
 529              $plugins->run_hooks("admin_config_help_documents_delete_section_commit");
 530  
 531              // Log admin action
 532              log_admin_action($section['sid'], $section['name'], 'section');
 533  
 534              flash_message($lang->success_section_deleted, 'success');
 535              admin_redirect("index.php?module=config-help_documents");
 536          }
 537  
 538          // Delete document
 539          else
 540          {
 541              $hid = $mybb->get_input('hid', MyBB::INPUT_INT);
 542  
 543              $query = $db->simple_select("helpdocs", "*", "hid='{$hid}'");
 544              $doc = $db->fetch_array($query);
 545  
 546              // Invalid document?
 547              if(!$doc['hid'])
 548              {
 549                  flash_message($lang->error_missing_hid, 'error');
 550                  admin_redirect("index.php?module=config-help_documents");
 551              }
 552  
 553              $db->delete_query("helpdocs", "hid = '{$doc['hid']}'", 1);
 554  
 555              $plugins->run_hooks("admin_config_help_documents_delete_page_commit");
 556  
 557              // Log admin action
 558              log_admin_action($doc['hid'], $doc['name'], 'document');
 559  
 560              flash_message($lang->success_document_deleted, 'success');
 561              admin_redirect("index.php?module=config-help_documents");
 562          }
 563      }
 564      // Show form for deletion
 565      else
 566      {
 567          // Section
 568          if(isset($mybb->input['sid']))
 569          {
 570              $sid = $mybb->get_input('sid', MyBB::INPUT_INT);
 571              $page->output_confirm_action("index.php?module=config-help_documents&amp;action=delete&amp;sid={$sid}", $lang->confirm_section_deletion);
 572          }
 573          // Document
 574          else
 575          {
 576              $hid = $mybb->get_input('hid', MyBB::INPUT_INT);
 577              $page->output_confirm_action("index.php?module=config-help_documents&amp;action=delete&amp;hid={$hid}", $lang->confirm_document_deletion);
 578          }
 579      }
 580  }
 581  
 582  // List document and sections
 583  if(!$mybb->input['action'])
 584  {
 585      $page->output_header($lang->help_documents);
 586  
 587      $sub_tabs['manage_help_documents'] = array(
 588          'title'    => $lang->manage_help_documents,
 589          'link'    => "index.php?module=config-help_documents",
 590          'description'=> $lang->manage_help_documents_desc
 591      );
 592  
 593      $sub_tabs['add_help_document'] = array(
 594          'title'    => $lang->add_new_document,
 595          'link'    => "index.php?module=config-help_documents&amp;action=add&amp;type=document"
 596      );
 597  
 598      $sub_tabs['add_help_section'] = array(
 599          'title'    => $lang->add_new_section,
 600          'link'    => "index.php?module=config-help_documents&amp;action=add&amp;type=section"
 601      );
 602  
 603      $plugins->run_hooks("admin_config_help_documents_start");
 604  
 605      $page->output_nav_tabs($sub_tabs, 'manage_help_documents');
 606  
 607      $table = new Table;
 608      $table->construct_header($lang->section_document);
 609      $table->construct_header($lang->controls, array('class' => "align_center", 'colspan' => 2, "width" => "150"));
 610  
 611      $query = $db->simple_select("helpsections", "*", "", array('order_by' => "disporder"));
 612      while($section = $db->fetch_array($query))
 613      {
 614          $table->construct_cell("<div><strong><a href=\"index.php?module=config-help_documents&amp;action=edit&amp;sid={$section['sid']}\">{$section['name']}</a></strong><br /><small>{$section['description']}</small></div>");
 615          $table->construct_cell("<a href=\"index.php?module=config-help_documents&amp;action=edit&amp;sid={$section['sid']}\">{$lang->edit}</a>", array("class" => "align_center", "width" => '60'));
 616          $table->construct_cell("<a href=\"index.php?module=config-help_documents&amp;action=delete&amp;sid={$section['sid']}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_section_deletion}')\">{$lang->delete}</a>", array("class" => "align_center", "width" => '90'));
 617          $table->construct_row();
 618  
 619          $query2 = $db->simple_select("helpdocs", "*", "sid='{$section['sid']}'", array('order_by' => "disporder"));
 620          while($doc = $db->fetch_array($query2))
 621          {
 622              $table->construct_cell("<div style=\"padding-left: 40px;\"><div><strong><a href=\"index.php?module=config-help_documents&amp;action=edit&amp;hid={$doc['hid']}\">{$doc['name']}</a></strong><br /><small>{$doc['description']}</small></div></div>");
 623              $table->construct_cell("<a href=\"index.php?module=config-help_documents&amp;action=edit&amp;hid={$doc['hid']}\">{$lang->edit}</a>", array("class" => "align_center", "width" => '60'));
 624              $table->construct_cell("<a href=\"index.php?module=config-help_documents&amp;action=delete&amp;hid={$doc['hid']}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_document_deletion}')\">{$lang->delete}</a>", array("class" => "align_center", "width" => '90'));
 625              $table->construct_row();
 626          }
 627      }
 628  
 629      // No documents message
 630      if($table->num_rows()  == 0)
 631      {
 632          $table->construct_cell($lang->no_help_documents, array('colspan' => 3));
 633          $table->construct_row();
 634      }
 635  
 636      $table->output($lang->help_documents);
 637      $page->output_footer();
 638  }


2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup Cross-referenced by PHPXref