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_words.php

Zuletzt modifiziert: 01.05.2026, 11:25 - Dateigröße: 4.83 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  /**
 023    * @todo {words} check regular expressions for special char replacements (stored specialchared in db)
 024    */
 025  class acp_words
 026  {
 027      var $u_action;
 028   
 029      function main($id, $mode)
 030      {
 031          global $db, $user, $template, $cache, $phpbb_log, $request, $phpbb_container;
 032   
 033          $user->add_lang('acp/posting');
 034   
 035          // Set up general vars
 036          $action = $request->variable('action', '');
 037          $action = (isset($_POST['add'])) ? 'add' : ((isset($_POST['save'])) ? 'save' : $action);
 038   
 039          $s_hidden_fields = '';
 040          $word_info = array();
 041   
 042          $this->tpl_name = 'acp_words';
 043          $this->page_title = 'ACP_WORDS';
 044   
 045          $form_name = 'acp_words';
 046          add_form_key($form_name);
 047   
 048          switch ($action)
 049          {
 050              case 'edit':
 051   
 052                  $word_id = $request->variable('id', 0);
 053   
 054                  if (!$word_id)
 055                  {
 056                      trigger_error($user->lang['NO_WORD'] . adm_back_link($this->u_action), E_USER_WARNING);
 057                  }
 058   
 059                  $sql = 'SELECT *
 060                      FROM ' . WORDS_TABLE . "
 061                      WHERE word_id = $word_id";
 062                  $result = $db->sql_query($sql);
 063                  $word_info = $db->sql_fetchrow($result);
 064                  $db->sql_freeresult($result);
 065   
 066                  $s_hidden_fields .= '<input type="hidden" name="id" value="' . $word_id . '" />';
 067   
 068              case 'add':
 069   
 070                  $template->assign_vars(array(
 071                      'S_EDIT_WORD'        => true,
 072                      'U_ACTION'            => $this->u_action,
 073                      'U_BACK'            => $this->u_action,
 074                      'WORD'                => (isset($word_info['word'])) ? $word_info['word'] : '',
 075                      'REPLACEMENT'        => (isset($word_info['replacement'])) ? $word_info['replacement'] : '',
 076                      'S_HIDDEN_FIELDS'    => $s_hidden_fields)
 077                  );
 078   
 079                  return;
 080   
 081              break;
 082   
 083              case 'save':
 084   
 085                  if (!check_form_key($form_name))
 086                  {
 087                      trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);
 088                  }
 089   
 090                  $word_id        = $request->variable('id', 0);
 091                  $word            = $request->variable('word', '', true);
 092                  $replacement    = $request->variable('replacement', '', true);
 093   
 094                  if ($word === '' || $replacement === '')
 095                  {
 096                      trigger_error($user->lang['ENTER_WORD'] . adm_back_link($this->u_action), E_USER_WARNING);
 097                  }
 098   
 099                  // Replace multiple consecutive asterisks with single one as those are not needed
 100                  $word = preg_replace('#\*{2,}#', '*', $word);
 101   
 102                  $sql_ary = array(
 103                      'word'            => $word,
 104                      'replacement'    => $replacement
 105                  );
 106   
 107                  if ($word_id)
 108                  {
 109                      $db->sql_query('UPDATE ' . WORDS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE word_id = ' . $word_id);
 110                  }
 111                  else
 112                  {
 113                      $db->sql_query('INSERT INTO ' . WORDS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
 114                  }
 115   
 116                  $cache->destroy('_word_censors');
 117                  $phpbb_container->get('text_formatter.cache')->invalidate();
 118   
 119                  $log_action = ($word_id) ? 'LOG_WORD_EDIT' : 'LOG_WORD_ADD';
 120   
 121                  $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_action, false, array($word));
 122   
 123                  $message = ($word_id) ? $user->lang['WORD_UPDATED'] : $user->lang['WORD_ADDED'];
 124                  trigger_error($message . adm_back_link($this->u_action));
 125   
 126              break;
 127   
 128              case 'delete':
 129   
 130                  $word_id = $request->variable('id', 0);
 131   
 132                  if (!$word_id)
 133                  {
 134                      trigger_error($user->lang['NO_WORD'] . adm_back_link($this->u_action), E_USER_WARNING);
 135                  }
 136   
 137                  if (confirm_box(true))
 138                  {
 139                      $sql = 'SELECT word
 140                          FROM ' . WORDS_TABLE . "
 141                          WHERE word_id = $word_id";
 142                      $result = $db->sql_query($sql);
 143                      $deleted_word = $db->sql_fetchfield('word');
 144                      $db->sql_freeresult($result);
 145   
 146                      $sql = 'DELETE FROM ' . WORDS_TABLE . "
 147                          WHERE word_id = $word_id";
 148                      $db->sql_query($sql);
 149   
 150                      $cache->destroy('_word_censors');
 151                      $phpbb_container->get('text_formatter.cache')->invalidate();
 152   
 153                      $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_WORD_DELETE', false, array($deleted_word));
 154   
 155                      trigger_error($user->lang['WORD_REMOVED'] . adm_back_link($this->u_action));
 156                  }
 157                  else
 158                  {
 159                      confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
 160                          'i'            => $id,
 161                          'mode'        => $mode,
 162                          'id'        => $word_id,
 163                          'action'    => 'delete',
 164                      )));
 165                  }
 166   
 167              break;
 168          }
 169   
 170          $template->assign_vars(array(
 171              'U_ACTION'            => $this->u_action,
 172              'S_HIDDEN_FIELDS'    => $s_hidden_fields)
 173          );
 174   
 175          $sql = 'SELECT *
 176              FROM ' . WORDS_TABLE . '
 177              ORDER BY word';
 178          $result = $db->sql_query($sql);
 179   
 180          while ($row = $db->sql_fetchrow($result))
 181          {
 182              $template->assign_block_vars('words', array(
 183                  'WORD'            => $row['word'],
 184                  'REPLACEMENT'    => $row['replacement'],
 185                  'U_EDIT'        => $this->u_action . '&amp;action=edit&amp;id=' . $row['word_id'],
 186                  'U_DELETE'        => $this->u_action . '&amp;action=delete&amp;id=' . $row['word_id'])
 187              );
 188          }
 189          $db->sql_freeresult($result);
 190      }
 191  }
 192