[ Index ]

PHP Cross Reference of MyBB 1.6.7

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


Generated: Sat Mar 31 17:55:03 2012 Cross-referenced by PHPXref 0.7.1