Verzeichnisstruktur phpBB-3.0.0


Veröffentlicht
12.12.2007

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

adjust_magic_urls.php

Zuletzt modifiziert: 09.10.2024, 12:50 - Dateigröße: 2.50 KiB


 001  <?php
 002  /**
 003  * Adds class="postlink" to magic urls
 004  *
 005  * You should make a backup from your users, posts and privmsgs table in case something goes wrong
 006  * Forum descriptions and rules need to be re-submitted manually.
 007  */
 008  die("Please read the first lines of this script for instructions on how to enable it");
 009   
 010  set_time_limit(0);
 011   
 012  define('IN_PHPBB', true);
 013  $phpbb_root_path = './../';
 014  $phpEx = substr(strrchr(__FILE__, '.'), 1);
 015  include($phpbb_root_path . 'common.'.$phpEx);
 016   
 017  // Start session management
 018  $user->session_begin();
 019  $auth->acl($user->data);
 020  $user->setup();
 021   
 022  $echos = 0;
 023   
 024  $replace = array(
 025      '<!-- l --><a href="',
 026      '<!-- m --><a href="',
 027      '<!-- w --><a href="',
 028  );
 029  $with = array(
 030      '<!-- l --><a class="postlink-local" href="',
 031      '<!-- m --><a class="postlink" href="',
 032      '<!-- w --><a class="postlink" href="',
 033  );
 034   
 035  // Adjust user signatures
 036  $sql = 'SELECT user_id, user_sig
 037      FROM ' . USERS_TABLE;
 038  $result = $db->sql_query($sql);
 039   
 040  while ($row = $db->sql_fetchrow($result))
 041  {
 042      $new_content = str_replace($replace, $with, $row['user_sig']);
 043   
 044      if ($new_content != $row['user_sig'])
 045      {
 046          $sql = 'UPDATE ' . USERS_TABLE . " SET user_sig = '" . $db->sql_escape($new_content) . "'
 047              WHERE user_id = " . $row['user_id'];
 048          $db->sql_query($sql);
 049   
 050          if ($echos > 200)
 051          {
 052              echo '<br />' . "\n";
 053              $echos = 0;
 054          }
 055   
 056          echo '.';
 057          $echos++;
 058   
 059          flush();
 060      }
 061  }
 062  $db->sql_freeresult($result);
 063   
 064   
 065  // Now adjust posts
 066  $sql = 'SELECT post_id, post_text
 067      FROM ' . POSTS_TABLE;
 068  $result = $db->sql_query($sql);
 069   
 070  while ($row = $db->sql_fetchrow($result))
 071  {
 072      $new_content = str_replace($replace, $with, $row['post_text']);
 073   
 074      if ($row['post_text'] != $new_content)
 075      {
 076          $sql = 'UPDATE ' . POSTS_TABLE . " SET post_text = '" . $db->sql_escape($new_content) . "'
 077              WHERE post_id = " . $row['post_id'];
 078          $db->sql_query($sql);
 079   
 080          if ($echos > 200)
 081          {
 082              echo '<br />' . "\n";
 083              $echos = 0;
 084          }
 085   
 086          echo '.';
 087          $echos++;
 088   
 089          flush();
 090      }
 091  }
 092  $db->sql_freeresult($result);
 093   
 094  // Now to the private messages
 095  $sql = 'SELECT msg_id, message_text
 096      FROM ' . PRIVMSGS_TABLE;
 097  $result = $db->sql_query($sql);
 098   
 099  while ($row = $db->sql_fetchrow($result))
 100  {
 101      $new_content = str_replace($replace, $with, $row['message_text']);
 102   
 103      if ($row['message_text'] != $new_content)
 104      {
 105          $sql = 'UPDATE ' . PRIVMSGS_TABLE . " SET bbcode_bitfield = '" . $db->sql_escape($new_content) . "'
 106              WHERE msg_id = " . $row['msg_id'];
 107          $db->sql_query($sql);
 108   
 109          if ($echos > 200)
 110          {
 111              echo '<br />' . "\n";
 112              $echos = 0;
 113          }
 114   
 115          echo '.';
 116          $echos++;
 117   
 118          flush();
 119      }
 120  }
 121  $db->sql_freeresult($result);
 122   
 123  // Done
 124  $db->sql_close();
 125   
 126  ?>