FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
phpbb/phpBB/develop/adjust_sizes.php at develop · phpbb-es/phpbb · GitHub
phpbb-es
/
phpbb
Public
forked from
phpbb/phpbb
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
phpbb
/
phpBB
/
develop
/
adjust_sizes.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
130 lines (102 loc) · 3.31 KB
Breadcrumbs
phpbb
/
phpBB
/
develop
/
adjust_sizes.php
Copy path
File metadata and controls
130 lines (102 loc) · 3.31 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
/**
* Only adjust the [size] bbcode tag from pc to percent.
*
* You should make a backup from your users, posts and privmsgs table in case something goes wrong
* Forum descriptions and rules need to be re-submitted manually if they use the [size] tag.
*
* Since we limit the match to the sizes from 0 to 29 no newly applied sizes should be affected...
*/
die
(
"
Please read the first lines of this script for instructions on how to enable it
"
);
set_time_limit
(
0
);
@
ini_set
(
'
memory_limit
'
,
'
128M
'
);
define
(
'
IN_PHPBB
'
,
true
);
$
phpbb_root_path
=
'
./../
'
;
$
phpEx
=
substr
(
strrchr
(
__FILE__
,
'
.
'
),
1
);
include
(
$
phpbb_root_path
.
'
common.
'
.
$
phpEx
);
// Start session management
$
user
->
session_begin
();
$
auth
->
acl
(
$
user
->
data
);
$
user
->
setup
();
$
echos
=
0
;
function
replace_size
(
$
matches
)
{
return
'
[size=
'
.
ceil
(
100.0
* (((
double
)
$
matches
[
1
])/
12.0
)) .
'
:
'
.
$
matches
[
2
] .
'
]
'
;
}
// Adjust user signatures
$
sql
=
'
SELECT user_id, user_sig, user_sig_bbcode_uid
FROM
'
.
USERS_TABLE
;
$
result
=
$
db
->
sql_query
(
$
sql
);
while
(
$
row
=
$
db
->
sql_fetchrow
(
$
result
))
{
$
bbcode_uid
=
$
row
[
'
user_sig_bbcode_uid
'
];
// Only if a bbcode uid is present, the signature present and a size tag used...
if
(
$
bbcode_uid
&&
$
row
[
'
user_sig
'
] &&
strpos
(
$
row
[
'
user_sig
'
],
'
[size=
'
) !==
false
)
{
$
row
[
'
user_sig
'
] =
preg_replace_callback
(
'
/\[size=(\d*):(
'
.
$
bbcode_uid
.
'
)\]/
'
,
'
replace_size
'
,
$
row
[
'
user_sig
'
]);
$
sql
=
'
UPDATE
'
.
USERS_TABLE
.
"
SET user_sig = '
"
.
$
db
->
sql_escape
(
$
row
[
'
user_sig
'
]) .
"
'
WHERE user_id =
"
.
$
row
[
'
user_id
'
];
$
db
->
sql_query
(
$
sql
);
if
(
$
echos
>
200
)
{
echo
'
<br />
'
.
"\n"
;
$
echos
=
0
;
}
echo
'
.
'
;
$
echos
++;
flush
();
}
}
$
db
->
sql_freeresult
(
$
result
);
// Now adjust posts
$
sql
=
'
SELECT post_id, post_text, bbcode_uid, enable_bbcode
FROM
'
.
POSTS_TABLE
;
$
result
=
$
db
->
sql_query
(
$
sql
);
while
(
$
row
=
$
db
->
sql_fetchrow
(
$
result
))
{
$
bbcode_uid
=
$
row
[
'
bbcode_uid
'
];
// Only if a bbcode uid is present, bbcode enabled and a size tag used...
if
(
$
row
[
'
enable_bbcode
'
] &&
$
bbcode_uid
&&
strpos
(
$
row
[
'
post_text
'
],
'
[size=
'
) !==
false
)
{
$
row
[
'
post_text
'
] =
preg_replace_callback
(
'
/\[size=(\d*):
'
.
$
bbcode_uid
.
'
\]/
'
,
'
replace_size
'
,
$
row
[
'
post_text
'
]);
$
sql
=
'
UPDATE
'
.
POSTS_TABLE
.
"
SET post_text = '
"
.
$
db
->
sql_escape
(
$
row
[
'
post_text
'
]) .
"
'
WHERE post_id =
"
.
$
row
[
'
post_id
'
];
$
db
->
sql_query
(
$
sql
);
if
(
$
echos
>
200
)
{
echo
'
<br />
'
.
"\n"
;
$
echos
=
0
;
}
echo
'
.
'
;
$
echos
++;
flush
();
}
}
$
db
->
sql_freeresult
(
$
result
);
// Now to the private messages
$
sql
=
'
SELECT msg_id, message_text, bbcode_uid, enable_bbcode
FROM
'
.
PRIVMSGS_TABLE
;
$
result
=
$
db
->
sql_query
(
$
sql
);
while
(
$
row
=
$
db
->
sql_fetchrow
(
$
result
))
{
$
bbcode_uid
=
$
row
[
'
bbcode_uid
'
];
// Only if a bbcode uid is present, bbcode enabled and a size tag used...
if
(
$
row
[
'
enable_bbcode
'
] &&
$
bbcode_uid
&&
strpos
(
$
row
[
'
message_text
'
],
'
[size=
'
) !==
false
)
{
$
row
[
'
message_text
'
] =
preg_replace_callback
(
'
/\[size=(\d*):
'
.
$
bbcode_uid
.
'
\]/
'
,
'
replace_size
'
,
$
row
[
'
message_text
'
]);
$
sql
=
'
UPDATE
'
.
PRIVMSGS_TABLE
.
"
SET message_text = '
"
.
$
db
->
sql_escape
(
$
row
[
'
message_text
'
]) .
"
'
WHERE msg_id =
"
.
$
row
[
'
msg_id
'
];
$
db
->
sql_query
(
$
sql
);
if
(
$
echos
>
200
)
{
echo
'
<br />
'
.
"\n"
;
$
echos
=
0
;
}
echo
'
.
'
;
$
echos
++;
flush
();
}
}
$
db
->
sql_freeresult
(
$
result
);
// Done
$
db
->
sql_close
();
Back
|
FazBrowse Home
|
New Git URL