Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/Sources/ShowAttachments.php ~ compatibility fix #3382

Closed
wants to merge 10 commits into from
2 changes: 1 addition & 1 deletion Sources/Load.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ function loadUserSettings()
{
// This is what a guest's variables should be.
$username = '';
$user_info = array('groups' => array(-1));
$user_info = array('groups' => array(-1), 'permissions' => array());
$user_settings = array();

if (isset($_COOKIE[$cookiename]) && empty($context['tfa_member']))
Expand Down
3 changes: 2 additions & 1 deletion Sources/ShowAttachments.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function showAttachment()
$smcFunc['db_free_result']($request);

$file['filePath'] = getAttachmentFilename($file['filename'], $attachId, $file['id_folder'], false, $file['file_hash']);
$file['filePath'] = !file_exists($file['filePath']) ? substr($file['filePath'], 0, -(strlen(pathinfo($file['filePath'])['extension'])+1)) : $file['filePath'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pathinfo($file['filePath'])['extension']

This will generate a parse error on PHP < 5.5.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot about that change to PHP.
I'm glad they changed it because 2 lines of code to do one small task seems superfluous.


// ETag time.
$file['etag'] = '"'. md5_file($file['filePath']) .'"';
Expand Down Expand Up @@ -290,4 +291,4 @@ function showAttachment()

die();
}
?>
?>