Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

acp_modules.php

Zuletzt modifiziert: 01.05.2026, 11:25 - Dateigröße: 21.08 KiB


 001  <?php
 002  /**
 003  *
 004  * This file is part of the phpBB Forum Software package.
 005  *
 006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 007  * @license GNU General Public License, version 2 (GPL-2.0)
 008  *
 009  * For full copyright and license information, please see
 010  * the docs/CREDITS.txt file.
 011  *
 012  */
 013   
 014  /**
 015  * @ignore
 016  */
 017  if (!defined('IN_PHPBB'))
 018  {
 019      exit;
 020  }
 021   
 022  use phpbb\module\exception\module_exception;
 023   
 024  /**
 025  * - Able to check for new module versions (modes changed/adjusted/added/removed)
 026  * Icons for:
 027  * - module enabled and displayed (common)
 028  * - module enabled and not displayed
 029  * - module deactivated
 030  * - category (enabled)
 031  * - category disabled
 032  */
 033   
 034  class acp_modules
 035  {
 036      var $module_class = '';
 037      var $parent_id;
 038      var $u_action;
 039   
 040      function main($id, $mode)
 041      {
 042          global $db, $user, $template, $module, $request, $phpbb_log, $phpbb_container;
 043   
 044          /** @var \phpbb\module\module_manager $module_manager */
 045          $module_manager = $phpbb_container->get('module.manager');
 046   
 047          // Set a global define for modules we might include (the author is able to prevent execution of code by checking this constant)
 048          define('MODULE_INCLUDE', true);
 049   
 050          $user->add_lang('acp/modules');
 051          $this->tpl_name = 'acp_modules';
 052   
 053          $form_key = 'acp_modules';
 054          add_form_key($form_key);
 055   
 056          // module class
 057          $this->module_class = $mode;
 058   
 059          if ($this->module_class == 'ucp')
 060          {
 061              $user->add_lang('ucp');
 062          }
 063          else if ($this->module_class == 'mcp')
 064          {
 065              $user->add_lang('mcp');
 066          }
 067   
 068          if ($module->p_class != $this->module_class)
 069          {
 070              $module->add_mod_info($this->module_class);
 071          }
 072   
 073          $this->page_title = strtoupper($this->module_class);
 074   
 075          $this->parent_id = $request->variable('parent_id', 0);
 076          $module_id = $request->variable('m', 0);
 077          $action = $request->variable('action', '');
 078          $errors = array();
 079   
 080          switch ($action)
 081          {
 082              case 'delete':
 083                  if (!$module_id)
 084                  {
 085                      trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 086                  }
 087   
 088                  if (confirm_box(true))
 089                  {
 090                      // Make sure we are not directly within a module
 091                      if ($module_id == $this->parent_id)
 092                      {
 093                          $sql = 'SELECT parent_id
 094                              FROM ' . MODULES_TABLE . '
 095                              WHERE module_id = ' . $module_id;
 096                          $result = $db->sql_query($sql);
 097                          $this->parent_id = (int) $db->sql_fetchfield('parent_id');
 098                          $db->sql_freeresult($result);
 099                      }
 100   
 101                      try
 102                      {
 103                          $row = $module_manager->get_module_row($module_id, $this->module_class);
 104                          $module_manager->delete_module($module_id, $this->module_class);
 105                          $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MODULE_REMOVED', false, array($user->lang($row['module_langname'])));
 106                      }
 107                      catch (module_exception $e)
 108                      {
 109                          $msg = $user->lang($e->getMessage());
 110                          trigger_error($msg . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 111                      }
 112   
 113                      $module_manager->remove_cache_file($this->module_class);
 114                      trigger_error($user->lang['MODULE_DELETED'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
 115                  }
 116                  else
 117                  {
 118                      confirm_box(false, 'DELETE_MODULE', build_hidden_fields(array(
 119                          'i'            => $id,
 120                          'mode'        => $mode,
 121                          'parent_id'    => $this->parent_id,
 122                          'module_id'    => $module_id,
 123                          'action'    => $action,
 124                      )));
 125                  }
 126   
 127              break;
 128   
 129              case 'enable':
 130              case 'disable':
 131                  if (!$module_id)
 132                  {
 133                      trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 134                  }
 135   
 136                  if (!check_link_hash($request->variable('hash', ''), 'acp_modules'))
 137                  {
 138                      trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 139                  }
 140   
 141                  $sql = 'SELECT *
 142                      FROM ' . MODULES_TABLE . "
 143                      WHERE module_class = '" . $db->sql_escape($this->module_class) . "'
 144                          AND module_id = $module_id";
 145                  $result = $db->sql_query($sql);
 146                  $row = $db->sql_fetchrow($result);
 147                  $db->sql_freeresult($result);
 148   
 149                  if (!$row)
 150                  {
 151                      trigger_error($user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 152                  }
 153   
 154                  $sql = 'UPDATE ' . MODULES_TABLE . '
 155                      SET module_enabled = ' . (($action == 'enable') ? 1 : 0) . "
 156                      WHERE module_class = '" . $db->sql_escape($this->module_class) . "'
 157                          AND module_id = $module_id";
 158                  $db->sql_query($sql);
 159   
 160                  $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MODULE_' . strtoupper($action), false, array($user->lang($row['module_langname'])));
 161                  $module_manager->remove_cache_file($this->module_class);
 162   
 163              break;
 164   
 165              case 'move_up':
 166              case 'move_down':
 167                  if (!$module_id)
 168                  {
 169                      trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 170                  }
 171   
 172                  if (!check_link_hash($request->variable('hash', ''), 'acp_modules'))
 173                  {
 174                      trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 175                  }
 176   
 177                  $sql = 'SELECT *
 178                      FROM ' . MODULES_TABLE . "
 179                      WHERE module_class = '" . $db->sql_escape($this->module_class) . "'
 180                          AND module_id = $module_id";
 181                  $result = $db->sql_query($sql);
 182                  $row = $db->sql_fetchrow($result);
 183                  $db->sql_freeresult($result);
 184   
 185                  if (!$row)
 186                  {
 187                      trigger_error($user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 188                  }
 189   
 190                  try
 191                  {
 192                      $move_module_name = $module_manager->move_module_by($row, $this->module_class, $action, 1);
 193   
 194                      $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MODULE_' . strtoupper($action), false, array($user->lang($row['module_langname']), $move_module_name));
 195                      $module_manager->remove_cache_file($this->module_class);
 196                  }
 197                  catch (module_exception $e)
 198                  {
 199                      // Do nothing
 200                  }
 201   
 202                  if ($request->is_ajax())
 203                  {
 204                      $json_response = new \phpbb\json_response;
 205                      $json_response->send(array(
 206                          'success'    => ($move_module_name !== false),
 207                      ));
 208                  }
 209   
 210              break;
 211   
 212              case 'quickadd':
 213                  $quick_install = $request->variable('quick_install', '');
 214   
 215                  if (confirm_box(true))
 216                  {
 217                      if (!$quick_install || strpos($quick_install, '::') === false)
 218                      {
 219                          break;
 220                      }
 221   
 222                      list($module_basename, $module_mode) = explode('::', $quick_install);
 223   
 224                      // Check if module name and mode exist...
 225                      $fileinfo = $module_manager->get_module_infos($this->module_class, $module_basename);
 226                      $fileinfo = $fileinfo[$module_basename];
 227   
 228                      if (isset($fileinfo['modes'][$module_mode]))
 229                      {
 230                          $module_data = array(
 231                              'module_basename'    => $module_basename,
 232                              'module_enabled'    => 0,
 233                              'module_display'    => (isset($fileinfo['modes'][$module_mode]['display'])) ? $fileinfo['modes'][$module_mode]['display'] : 1,
 234                              'parent_id'            => $this->parent_id,
 235                              'module_class'        => $this->module_class,
 236                              'module_langname'    => $fileinfo['modes'][$module_mode]['title'],
 237                              'module_mode'        => $module_mode,
 238                              'module_auth'        => $fileinfo['modes'][$module_mode]['auth'],
 239                          );
 240   
 241                          try
 242                          {
 243                              $module_manager->update_module_data($module_data);
 244                              $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MODULE_ADD', false, array($user->lang($module_data['module_langname'])));
 245                          }
 246                          catch (\phpbb\module\exception\module_exception $e)
 247                          {
 248                              $msg = $user->lang($e->getMessage());
 249                              trigger_error($msg . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 250                          }
 251   
 252                          if (!count($errors))
 253                          {
 254                              $module_manager->remove_cache_file($this->module_class);
 255   
 256                              trigger_error($user->lang['MODULE_ADDED'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
 257                          }
 258                      }
 259                  }
 260                  else
 261                  {
 262                      confirm_box(false, 'ADD_MODULE', build_hidden_fields(array(
 263                          'i'            => $id,
 264                          'mode'        => $mode,
 265                          'parent_id'    => $this->parent_id,
 266                          'action'    => 'quickadd',
 267                          'quick_install'    => $quick_install,
 268                      )));
 269                  }
 270   
 271              break;
 272   
 273              case 'edit':
 274   
 275                  if (!$module_id)
 276                  {
 277                      trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 278                  }
 279   
 280                  try
 281                  {
 282                      $module_row = $module_manager->get_module_row($module_id, $this->module_class);
 283                  }
 284                  catch (\phpbb\module\exception\module_not_found_exception $e)
 285                  {
 286                      $msg = $user->lang($e->getMessage());
 287                      trigger_error($msg . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 288                  }
 289   
 290              // no break
 291   
 292              case 'add':
 293   
 294                  if ($action == 'add')
 295                  {
 296                      $module_row = array(
 297                          'module_basename'    => '',
 298                          'module_enabled'    => 0,
 299                          'module_display'    => 1,
 300                          'parent_id'            => 0,
 301                          'module_langname'    => $request->variable('module_langname', '', true),
 302                          'module_mode'        => '',
 303                          'module_auth'        => '',
 304                      );
 305                  }
 306   
 307                  $module_data = array();
 308   
 309                  $module_data['module_basename'] = $request->variable('module_basename', (string) $module_row['module_basename']);
 310                  $module_data['module_enabled'] = $request->variable('module_enabled', (int) $module_row['module_enabled']);
 311                  $module_data['module_display'] = $request->variable('module_display', (int) $module_row['module_display']);
 312                  $module_data['parent_id'] = $request->variable('module_parent_id', (int) $module_row['parent_id']);
 313                  $module_data['module_class'] = $this->module_class;
 314                  $module_data['module_langname'] = $request->variable('module_langname', (string) $module_row['module_langname'], true);
 315                  $module_data['module_mode'] = $request->variable('module_mode', (string) $module_row['module_mode']);
 316   
 317                  $submit = (isset($_POST['submit'])) ? true : false;
 318   
 319                  if ($submit)
 320                  {
 321                      if (!check_form_key($form_key))
 322                      {
 323                          trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 324                      }
 325   
 326                      if (!$module_data['module_langname'])
 327                      {
 328                          trigger_error($user->lang['NO_MODULE_LANGNAME'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 329                      }
 330   
 331                      $module_type = $request->variable('module_type', 'category');
 332   
 333                      if ($module_type == 'category')
 334                      {
 335                          $module_data['module_basename'] = $module_data['module_mode'] = $module_data['module_auth'] = '';
 336                          $module_data['module_display'] = 1;
 337                      }
 338   
 339                      if ($action == 'edit')
 340                      {
 341                          $module_data['module_id'] = $module_id;
 342                      }
 343   
 344                      // Adjust auth row
 345                      if ($module_data['module_basename'] && $module_data['module_mode'])
 346                      {
 347                          $fileinfo = $module_manager->get_module_infos($this->module_class, $module_data['module_basename']);
 348                          $module_data['module_auth'] = $fileinfo[$module_data['module_basename']]['modes'][$module_data['module_mode']]['auth'];
 349                      }
 350   
 351                      try
 352                      {
 353                          $module_manager->update_module_data($module_data);
 354                          $phpbb_log->add('admin',
 355                              $user->data['user_id'],
 356                              $user->ip,
 357                              ($action === 'edit') ? 'LOG_MODULE_EDIT' : 'LOG_MODULE_ADD',
 358                              false,
 359                              array($user->lang($module_data['module_langname']))
 360                          );                    }
 361                      catch (\phpbb\module\exception\module_exception $e)
 362                      {
 363                          $msg = $user->lang($e->getMessage());
 364                          trigger_error($msg . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 365                      }
 366   
 367                      if (!count($errors))
 368                      {
 369                          $module_manager->remove_cache_file($this->module_class);
 370   
 371                          trigger_error((($action == 'add') ? $user->lang['MODULE_ADDED'] : $user->lang['MODULE_EDITED']) . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
 372                      }
 373                  }
 374   
 375                  // Category/not category?
 376                  $is_cat = (!$module_data['module_basename']) ? true : false;
 377   
 378                  // Get module information
 379                  $module_infos = $module_manager->get_module_infos($this->module_class);
 380   
 381                  // Build name options
 382                  $s_name_options = $s_mode_options = '';
 383                  foreach ($module_infos as $option => $values)
 384                  {
 385                      if (!$module_data['module_basename'])
 386                      {
 387                          $module_data['module_basename'] = $option;
 388                      }
 389   
 390                      // Name options
 391                      $s_name_options .= '<option value="' . $option . '"' . (($option == $module_data['module_basename']) ? ' selected="selected"' : '') . '>' . $user->lang($values['title']) . ' [' . $option . ']</option>';
 392   
 393                      $template->assign_block_vars('m_names', array('NAME' => $option, 'A_NAME' => addslashes($option)));
 394   
 395                      // Build module modes
 396                      foreach ($values['modes'] as $m_mode => $m_values)
 397                      {
 398                          if ($option == $module_data['module_basename'])
 399                          {
 400                              $s_mode_options .= '<option value="' . $m_mode . '"' . (($m_mode == $module_data['module_mode']) ? ' selected="selected"' : '') . '>' . $user->lang($m_values['title']) . '</option>';
 401                          }
 402   
 403                          $template->assign_block_vars('m_names.modes', array(
 404                              'OPTION'        => $m_mode,
 405                              'VALUE'            => $user->lang($m_values['title']),
 406                              'A_OPTION'        => addslashes($m_mode),
 407                              'A_VALUE'        => addslashes($user->lang($m_values['title'])))
 408                          );
 409                      }
 410                  }
 411   
 412                  $s_cat_option = '<option value="0"' . (($module_data['parent_id'] == 0) ? ' selected="selected"' : '') . '>' . $user->lang['NO_PARENT'] . '</option>';
 413   
 414                  $template->assign_vars(array_merge(array(
 415                      'S_EDIT_MODULE'        => true,
 416                      'S_IS_CAT'            => $is_cat,
 417                      'S_CAT_OPTIONS'        => $s_cat_option . $this->make_module_select($module_data['parent_id'], ($action == 'edit') ? $module_row['module_id'] : false, false, false, false, true),
 418                      'S_MODULE_NAMES'    => $s_name_options,
 419                      'S_MODULE_MODES'    => $s_mode_options,
 420                      'U_BACK'            => $this->u_action . '&amp;parent_id=' . $this->parent_id,
 421                      'U_EDIT_ACTION'        => $this->u_action . '&amp;parent_id=' . $this->parent_id,
 422   
 423                      'L_TITLE'            => $user->lang[strtoupper($action) . '_MODULE'],
 424   
 425                      'MODULENAME'        => $user->lang($module_data['module_langname']),
 426                      'ACTION'            => $action,
 427                      'MODULE_ID'            => $module_id,
 428   
 429                  ),
 430                      array_change_key_case($module_data, CASE_UPPER))
 431                  );
 432   
 433                  if (count($errors))
 434                  {
 435                      $template->assign_vars(array(
 436                          'S_ERROR'    => true,
 437                          'ERROR_MSG'    => implode('<br />', $errors))
 438                      );
 439                  }
 440   
 441                  return;
 442   
 443              break;
 444          }
 445   
 446          // Default management page
 447          if (count($errors))
 448          {
 449              if ($request->is_ajax())
 450              {
 451                  $json_response = new \phpbb\json_response;
 452                  $json_response->send(array(
 453                      'MESSAGE_TITLE'    => $user->lang('ERROR'),
 454                      'MESSAGE_TEXT'    => implode('<br />', $errors),
 455                      'SUCCESS'    => false,
 456                  ));
 457              }
 458   
 459              $template->assign_vars(array(
 460                  'S_ERROR'    => true,
 461                  'ERROR_MSG'    => implode('<br />', $errors))
 462              );
 463          }
 464   
 465          if (!$this->parent_id)
 466          {
 467              $navigation = strtoupper($this->module_class);
 468          }
 469          else
 470          {
 471              $navigation = '<a href="' . $this->u_action . '">' . strtoupper($this->module_class) . '</a>';
 472   
 473              $modules_nav = $module_manager->get_module_branch($this->parent_id, $this->module_class, 'parents');
 474   
 475              foreach ($modules_nav as $row)
 476              {
 477                  $langname = $user->lang($row['module_langname']);
 478   
 479                  if ($row['module_id'] == $this->parent_id)
 480                  {
 481                      $navigation .= ' -&gt; ' . $langname;
 482                  }
 483                  else
 484                  {
 485                      $navigation .= ' -&gt; <a href="' . $this->u_action . '&amp;parent_id=' . $row['module_id'] . '">' . $langname . '</a>';
 486                  }
 487              }
 488          }
 489   
 490          // Jumpbox
 491          $module_box = $this->make_module_select($this->parent_id, false, false, false, false);
 492   
 493          $sql = 'SELECT *
 494              FROM ' . MODULES_TABLE . "
 495              WHERE parent_id = {$this->parent_id}
 496                  AND module_class = '" . $db->sql_escape($this->module_class) . "'
 497              ORDER BY left_id";
 498          $result = $db->sql_query($sql);
 499   
 500          if ($row = $db->sql_fetchrow($result))
 501          {
 502              do
 503              {
 504                  $langname = $user->lang($row['module_langname']);
 505   
 506                  if (!$row['module_enabled'])
 507                  {
 508                      $module_image = '<img src="images/icon_folder_lock.gif" alt="' . $user->lang['DEACTIVATED_MODULE'] .'" />';
 509                  }
 510                  else
 511                  {
 512                      $module_image = (!$row['module_basename'] || $row['left_id'] + 1 != $row['right_id']) ? '<img src="images/icon_subfolder.gif" alt="' . $user->lang['CATEGORY'] . '" />' : '<img src="images/icon_folder.gif" alt="' . $user->lang['MODULE'] . '" />';
 513                  }
 514   
 515                  $url = $this->u_action . '&amp;parent_id=' . $this->parent_id . '&amp;m=' . $row['module_id'];
 516   
 517                  $template->assign_block_vars('modules', array(
 518                      'MODULE_IMAGE'        => $module_image,
 519                      'MODULE_TITLE'        => $langname,
 520                      'MODULE_ENABLED'    => ($row['module_enabled']) ? true : false,
 521                      'MODULE_DISPLAYED'    => ($row['module_display']) ? true : false,
 522   
 523                      'S_ACP_CAT_SYSTEM'            => ($this->module_class == 'acp' && $row['module_langname'] == 'ACP_CAT_SYSTEM') ? true : false,
 524                      'S_ACP_MODULE_MANAGEMENT'    => ($this->module_class == 'acp' && ($row['module_basename'] == 'modules' || $row['module_langname'] == 'ACP_MODULE_MANAGEMENT')) ? true : false,
 525   
 526                      'U_MODULE'            => $this->u_action . '&amp;parent_id=' . $row['module_id'],
 527                      'U_MOVE_UP'            => $url . '&amp;action=move_up&amp;hash=' . generate_link_hash('acp_modules'),
 528                      'U_MOVE_DOWN'        => $url . '&amp;action=move_down&amp;hash=' . generate_link_hash('acp_modules'),
 529                      'U_EDIT'            => $url . '&amp;action=edit',
 530                      'U_DELETE'            => $url . '&amp;action=delete',
 531                      'U_ENABLE'            => $url . '&amp;action=enable&amp;hash=' . generate_link_hash('acp_modules'),
 532                      'U_DISABLE'            => $url . '&amp;action=disable&amp;hash=' . generate_link_hash('acp_modules'))
 533                  );
 534              }
 535              while ($row = $db->sql_fetchrow($result));
 536          }
 537          else if ($this->parent_id)
 538          {
 539              try
 540              {
 541                  $row = $module_manager->get_module_row($this->parent_id, $this->module_class);
 542              }
 543              catch (\phpbb\module\exception\module_not_found_exception $e)
 544              {
 545                  $msg = $user->lang($e->getMessage());
 546                  trigger_error($msg . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 547              }
 548   
 549              $url = $this->u_action . '&amp;parent_id=' . $this->parent_id . '&amp;m=' . $row['module_id'];
 550   
 551              $template->assign_vars(array(
 552                  'S_NO_MODULES'        => true,
 553                  'MODULE_TITLE'        => $langname,
 554                  'MODULE_ENABLED'    => ($row['module_enabled']) ? true : false,
 555                  'MODULE_DISPLAYED'    => ($row['module_display']) ? true : false,
 556   
 557                  'U_EDIT'            => $url . '&amp;action=edit',
 558                  'U_DELETE'            => $url . '&amp;action=delete',
 559                  'U_ENABLE'            => $url . '&amp;action=enable&amp;hash=' . generate_link_hash('acp_modules'),
 560                  'U_DISABLE'            => $url . '&amp;action=disable&amp;hash=' . generate_link_hash('acp_modules'))
 561              );
 562          }
 563          $db->sql_freeresult($result);
 564   
 565          // Quick adding module
 566          $module_infos = $module_manager->get_module_infos($this->module_class);
 567   
 568          // Build quick options
 569          $s_install_options = '';
 570          foreach ($module_infos as $option => $values)
 571          {
 572              // Name options
 573              $s_install_options .= '<optgroup label="' . $user->lang($values['title']) . ' [' . $option . ']">';
 574   
 575              // Build module modes
 576              foreach ($values['modes'] as $m_mode => $m_values)
 577              {
 578                  $s_install_options .= '<option value="' . $option . '::' . $m_mode . '">&nbsp; &nbsp;' . $user->lang($m_values['title']) . '</option>';
 579              }
 580   
 581              $s_install_options .= '</optgroup>';
 582          }
 583   
 584          $template->assign_vars(array(
 585              'U_SEL_ACTION'        => $this->u_action,
 586              'U_ACTION'            => $this->u_action . '&amp;parent_id=' . $this->parent_id,
 587              'NAVIGATION'        => $navigation,
 588              'MODULE_BOX'        => $module_box,
 589              'PARENT_ID'            => $this->parent_id,
 590              'S_INSTALL_OPTIONS'    => $s_install_options,
 591              )
 592          );
 593      }
 594   
 595      /**
 596      * Simple version of jumpbox, just lists modules
 597      */
 598      function make_module_select($select_id = false, $ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true, $ignore_noncat = false)
 599      {
 600          global $db, $user;
 601   
 602          $sql = 'SELECT module_id, module_enabled, module_basename, parent_id, module_langname, left_id, right_id, module_auth
 603              FROM ' . MODULES_TABLE . "
 604              WHERE module_class = '" . $db->sql_escape($this->module_class) . "'
 605              ORDER BY left_id ASC";
 606          $result = $db->sql_query($sql);
 607   
 608          $right = $iteration = 0;
 609          $padding_store = array('0' => '');
 610          $module_list = $padding = '';
 611   
 612          while ($row = $db->sql_fetchrow($result))
 613          {
 614              if ($row['left_id'] < $right)
 615              {
 616                  $padding .= '&nbsp; &nbsp;';
 617                  $padding_store[$row['parent_id']] = $padding;
 618              }
 619              else if ($row['left_id'] > $right + 1)
 620              {
 621                  $padding = (isset($padding_store[$row['parent_id']])) ? $padding_store[$row['parent_id']] : '';
 622              }
 623   
 624              $right = $row['right_id'];
 625   
 626              if (!$ignore_acl && $row['module_auth'])
 627              {
 628                  // We use zero as the forum id to check - global setting.
 629                  if (!p_master::module_auth($row['module_auth'], 0))
 630                  {
 631                      continue;
 632                  }
 633              }
 634   
 635              // ignore this module?
 636              if ((is_array($ignore_id) && in_array($row['module_id'], $ignore_id)) || $row['module_id'] == $ignore_id)
 637              {
 638                  continue;
 639              }
 640   
 641              // empty category
 642              if (!$row['module_basename'] && ($row['left_id'] + 1 == $row['right_id']) && $ignore_emptycat)
 643              {
 644                  continue;
 645              }
 646   
 647              // ignore non-category?
 648              if ($row['module_basename'] && $ignore_noncat)
 649              {
 650                  continue;
 651              }
 652   
 653              $selected = (is_array($select_id)) ? ((in_array($row['module_id'], $select_id)) ? ' selected="selected"' : '') : (($row['module_id'] == $select_id) ? ' selected="selected"' : '');
 654   
 655              $langname = $user->lang($row['module_langname']);
 656              $module_list .= '<option value="' . $row['module_id'] . '"' . $selected . ((!$row['module_enabled']) ? ' class="disabled"' : '') . '>' . $padding . $langname . '</option>';
 657   
 658              $iteration++;
 659          }
 660          $db->sql_freeresult($result);
 661   
 662          unset($padding_store);
 663   
 664          return $module_list;
 665      }
 666  }
 667