[ Index ]

PHP Cross Reference of MyBB

title

Body

[close]

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

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


Generated: Tue Oct 8 19:19:50 2013 Cross-referenced by PHPXref 0.7.1