mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-05 08:17:47 +02:00
Merge branch 'ticket/igorw/9556' into develop
* ticket/igorw/9556: [ticket/9556] Drop php closing tags, add trailing newline Conflicts: phpBB/includes/constants.php
This commit is contained in:
@@ -413,5 +413,3 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
|
||||
unset($sql_ary);
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -143,5 +143,3 @@ function adjust_avatar($old_name, $midfix)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
@@ -170,5 +170,3 @@ $db->sql_freeresult($result);
|
||||
|
||||
// Done
|
||||
$db->sql_close();
|
||||
|
||||
?>
|
@@ -122,5 +122,3 @@ $db->sql_freeresult($result);
|
||||
|
||||
// Done
|
||||
$db->sql_close();
|
||||
|
||||
?>
|
@@ -128,5 +128,3 @@ $db->sql_freeresult($result);
|
||||
|
||||
// Done
|
||||
$db->sql_close();
|
||||
|
||||
?>
|
@@ -126,5 +126,3 @@ $db->sql_freeresult($result);
|
||||
|
||||
// Done
|
||||
$db->sql_close();
|
||||
|
||||
?>
|
@@ -126,4 +126,3 @@ $db->sql_freeresult($result);
|
||||
// Done
|
||||
$db->sql_close();
|
||||
echo 'done';
|
||||
?>
|
@@ -48,5 +48,3 @@ echo 'FINISHED';
|
||||
|
||||
// Done
|
||||
$db->sql_close();
|
||||
|
||||
?>
|
@@ -458,5 +458,3 @@ function make_user($username)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -72,5 +72,3 @@ do
|
||||
while ($start);
|
||||
|
||||
echo "<p><b>Done</b></p>\n";
|
||||
|
||||
?>
|
@@ -58,5 +58,3 @@ while ($row = $db->sql_fetchrow($result))
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
echo "<p><b>Done</b></p>\n";
|
||||
|
||||
?>
|
@@ -2047,5 +2047,3 @@ EOF;
|
||||
}
|
||||
|
||||
echo 'done';
|
||||
|
||||
?>
|
@@ -543,5 +543,3 @@ fclose($fp);
|
||||
|
||||
echo '<br>Finished!';
|
||||
flush();
|
||||
|
||||
?>
|
@@ -186,5 +186,3 @@ function rndm_username()
|
||||
|
||||
return $usernames[array_rand($usernames)];
|
||||
}
|
||||
|
||||
?>
|
@@ -152,5 +152,3 @@ function download($url)
|
||||
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
?>
|
@@ -240,5 +240,3 @@ function download($url)
|
||||
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
?>
|
@@ -569,4 +569,4 @@ function cp_to_utf($cp)
|
||||
{
|
||||
return chr($cp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -137,4 +137,4 @@ function find_modules($dirname)
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
@@ -76,5 +76,3 @@ $db->sql_query($sql);
|
||||
//$db->sql_query("DROP TABLE {$table_prefix}attach_temp");
|
||||
|
||||
echo "<p><b>Done</b></p>\n";
|
||||
|
||||
?>
|
@@ -205,5 +205,3 @@ foreach ($sql_ary as $sql)
|
||||
}
|
||||
|
||||
echo "<p><b>Done</b></p>\n";
|
||||
|
||||
?>
|
@@ -1398,5 +1398,3 @@ function get_schema_struct()
|
||||
|
||||
return $schema_data;
|
||||
}
|
||||
|
||||
?>
|
@@ -54,5 +54,3 @@ else
|
||||
flush();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
@@ -80,5 +80,3 @@ echo 'www.URL: ' . $www_url . "<br />\n";
|
||||
// no schema and no authority
|
||||
$relative_url = "$segment$path_abempty(?:\?$query)?(?:\#$fragment)?";
|
||||
echo 'relative URL: ' . $relative_url . "<br />\n";
|
||||
|
||||
?>
|
65
phpBB/develop/remove-php-end-tags.py
Executable file
65
phpBB/develop/remove-php-end-tags.py
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env python
|
||||
# Remove ending PHP tags '?>'
|
||||
# @author Oleg Pudeyev
|
||||
# @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
|
||||
import sys, os, os.path, optparse
|
||||
|
||||
def error(message, code):
|
||||
print >>sys.stderr, message
|
||||
exit(code)
|
||||
|
||||
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option('-a', '--aggressive', help='Remove ending tags when they are followed by whitespace', action='store_true')
|
||||
options, args = parser.parse_args()
|
||||
|
||||
if len(args) != 1:
|
||||
parser.usage()
|
||||
error("Usage: remove-php-end-tags path", 2)
|
||||
|
||||
path = args[0]
|
||||
|
||||
if not os.path.exists(path):
|
||||
error("Path does not exist: %s" % path, 3)
|
||||
|
||||
if options.aggressive:
|
||||
import re
|
||||
|
||||
fix_re = re.compile(r'\s*\?>\s*$')
|
||||
def fix_content(content):
|
||||
content = fix_re.sub(r'\n', content)
|
||||
return content
|
||||
else:
|
||||
def fix_content(content):
|
||||
if content.endswith('?>'):
|
||||
content = content[:-2].strip() + "\n"
|
||||
return content
|
||||
|
||||
def process_file(path):
|
||||
f = open(path)
|
||||
try:
|
||||
content = f.read()
|
||||
finally:
|
||||
f.close()
|
||||
fixed_content = fix_content(content)
|
||||
if content != fixed_content:
|
||||
f = open(path, 'w')
|
||||
try:
|
||||
f.write(fixed_content)
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
def process_dir(path):
|
||||
for root, dirs, files in os.walk(path):
|
||||
if '.svn' in dirs:
|
||||
dirs.remove('.svn')
|
||||
for file in files:
|
||||
if file.endswith('.php'):
|
||||
path = os.path.join(root, file)
|
||||
process_file(path)
|
||||
|
||||
if os.path.isdir(path):
|
||||
process_dir(path)
|
||||
else:
|
||||
process_file(path)
|
@@ -147,5 +147,3 @@ function add_bots($bots)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -116,5 +116,3 @@ function utf8_normalize_nfkc($strings)
|
||||
|
||||
return $strings;
|
||||
}
|
||||
|
||||
?>
|
@@ -54,4 +54,3 @@ echo 'FINISHED';
|
||||
|
||||
// Done
|
||||
$db->sql_close();
|
||||
?>
|
@@ -388,4 +388,4 @@ function cp_to_utf($cp)
|
||||
{
|
||||
return chr($cp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user