Verzeichnisstruktur phpBB-2.0.0
- Veröffentlicht
- 03.04.2002
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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
convert_privmsgs.php
001 <?php
002
003 //
004 // Security message:
005 //
006 // This script is potentially dangerous.
007 // Remove or comment the next line (die(".... ) to enable this script.
008 // Do NOT FORGET to either remove this script or disable it after you have used it.
009 //
010 die("Please read the first lines of this script for instructions on how to enable it");
011
012 //
013 // Do not change anything below this line.
014 //
015
016
017 $phpbb_root_path = "../";
018
019 include($phpbb_root_path . 'extension.inc');
020 include($phpbb_root_path . 'config.'.$phpEx);
021 include($phpbb_root_path . 'includes/constants.'.$phpEx);
022 include($phpbb_root_path . 'includes/db.'.$phpEx);
023
024 //
025 // Alter table ...
026 //
027 echo "Alter tables ... ";
028
029 echo $sql = "ALTER TABLE " . PRIVMSGS_TABLE . "
030 ADD privmsgs_enable_bbcode TINYINT(1) DEFAULT '1' NOT NULL,
031 ADD privmsgs_enable_html TINYINT(1) DEFAULT '0' NOT NULL,
032 ADD privmsgs_enable_smilies TINYINT(1) DEFAULT '1' NOT NULL,
033 ADD privmsgs_attach_sig TINYINT(1) DEFAULT '1' NOT NULL";
034 if( !$result = $db->sql_query($sql) )
035 {
036 die("Couldn't alter privmsgs table");
037 }
038 echo $sql = "ALTER TABLE " . PRIVMSGS_TEXT_TABLE . "
039 ADD privmsgs_bbcode_uid CHAR(10) AFTER privmsgs_text_id";
040 if( !$result = $db->sql_query($sql) )
041 {
042 die("Couldn't alter privmsgs text table");
043 }
044 echo "COMPLETE<BR>";
045
046 //
047 // Move bbcode ...
048 //
049 echo "Move bbcode uid's ... ";
050
051 $sql = "SELECT privmsgs_id, privmsgs_bbcode_uid
052 FROM " . PRIVMSGS_TABLE;
053 if( $result = $db->sql_query($sql) )
054 {
055 $rowset = $db->sql_fetchrowset($result);
056
057 for($i = 0; $i < count($rowset); $i++)
058 {
059 $sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . "
060 SET privmsgs_bbcode_uid = '" . $rowset[$i]['privmsgs_bbcode_uid'] . "'
061 WHERE privmsgs_text_id = " . $rowset[$i]['privmsgs_id'];
062 if( !$result = $db->sql_query($sql) )
063 {
064 die("Couldn't update privmsgs text bbcode - " . $i);
065 }
066 }
067
068 $sql = "ALTER TABLE " . PRIVMSGS_TABLE . "
069 DROP privmsgs_bbcode_uid";
070 if( !$result = $db->sql_query($sql) )
071 {
072 die("Couldn't alter privmsgs table - drop privmsgs_bbcode_uid");
073 }
074 }
075
076 echo "COMPLETE<BR>";
077
078 //
079 // Stripslashes from titles
080 //
081 echo "Strip subject slashes ... ";
082
083 $sql = "SELECT privmsgs_subject , privmsgs_id, privmsgs_to_userid, privmsgs_from_userid
084 FROM " . PRIVMSGS_TABLE;
085 if( $result = $db->sql_query($sql) )
086 {
087 $rowset = $db->sql_fetchrowset($result);
088
089 for($i = 0; $i < count($rowset); $i++)
090 {
091 $sql = "UPDATE " . PRIVMSGS_TABLE . "
092 SET privmsgs_subject = '" . addslashes(stripslashes($rowset[$i]['privmsgs_subject'])) . "'
093 WHERE privmsgs_id = " . $rowset[$i]['privmsgs_id'];
094 if( !$result = $db->sql_query($sql) )
095 {
096 die("Couldn't update subjects - $i");
097 }
098 }
099 }
100 echo "COMPLETE<BR>";
101
102 //
103 // Update sigs
104 //
105 echo "Remove [addsig], stripslashes and update privmsgs table sig enable ...";
106
107 $sql = "SELECT privmsgs_text_id , privmsgs_text
108 FROM " . PRIVMSGS_TEXT_TABLE;
109 if( $result = $db->sql_query($sql) )
110 {
111 $rowset = $db->sql_fetchrowset($result);
112
113 $attach_sql = "";
114 $non_attach_sql = "";
115
116 for($i = 0; $i < count($rowset); $i++)
117 {
118 if( ereg("\[addsig]$", $rowset[$i]['privmsgs_text']))
119 {
120 if( $attach_sql != "" )
121 {
122 $attach_sql .= ", ";
123 }
124 $attach_sql .= $rowset[$i]['privmsgs_text_id'];
125
126 $sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . "
127 SET privmsgs_text = '" . addslashes(preg_replace("/\[addsig\]/is", "", stripslashes($rowset[$i]['privmsgs_text']))) . "'
128 WHERE privmsgs_text_id = " . $rowset[$i]['privmsgs_text_id'];
129 if( !$result = $db->sql_query($sql) )
130 {
131 die("Couldn't update privmsgs text - " . $i);
132 }
133
134 }
135 else
136 {
137 $sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . "
138 SET privmsgs_text = '" . addslashes(stripslashes($rowset[$i]['privmsgs_text'])) . "'
139 WHERE privmsgs_text_id = " . $rowset[$i]['privmsgs_text_id'];
140 if( !$result = $db->sql_query($sql) )
141 {
142 die("Couldn't update privmsgs text - " . $i);
143 }
144
145 if( $non_attach_sql != "" )
146 {
147 $non_attach_sql .= ", ";
148 }
149 $non_attach_sql .= $rowset[$i]['privmsgs_text_id'];
150 }
151 }
152
153 if( $attach_sql != "" )
154 {
155 $sql = "UPDATE " . PRIVMSGS_TABLE . "
156 SET privmsgs_attach_sig = 1
157 WHERE privmsgs_id IN ($attach_sql)";
158 if( !$result = $db->sql_query($sql) )
159 {
160 die("Couldn't update privmsgs table attach_sig - ");
161 }
162 }
163
164 if( $non_attach_sql != "" )
165 {
166 $sql = "UPDATE " . PRIVMSGS_TABLE . "
167 SET privmsgs_attach_sig = 0
168 WHERE privmsgs_id IN ($non_attach_sql)";
169 if( !$result = $db->sql_query($sql) )
170 {
171 die("Couldn't update privmsgs table non_attach_sig - ");
172 }
173 }
174
175 }
176
177 echo "COMPLETE<BR>";
178
179 $db->sql_close();
180
181 ?>
182