Advertisement:

Author Topic: No attachment limit for admins  (Read 37885 times)

Offline bodyboard_jerez

  • Jr. Member
  • **
  • Posts: 135
Re: No attachment limit for admins
« Reply #20 on: May 28, 2007, 11:04:29 AM »
Hi, I have the 1.1.2 version and this Tips and Tricks doesn't runs for me...

Please, could you help me? Thanks a lot "!"
Thank you to everybody of the SMF forum !!! Great help and free service !!

Offline bodyboard_jerez

  • Jr. Member
  • **
  • Posts: 135
Re: No attachment limit for admins
« Reply #21 on: June 08, 2007, 08:09:59 AM »
Hi, I have the 1.1.2 version and this Tips and Tricks doesn't runs for me...

Please, could you help me? Thanks a lot "!"

Somebody does this trick runs on 1.1.2 version? How please?
Thank you to everybody of the SMF forum !!! Great help and free service !!

Offline Kolya

  • Jr. Member
  • **
  • Posts: 366
Re: No attachment limit for admins
« Reply #22 on: January 21, 2012, 10:44:37 AM »
For SMF 2.02 to exempt the admin from upload size limits and file extension checks: Basically just add !$user_info['is_admin'] && to all these checks...

In Sources/Post.php:
FIND:
Code: [Select]
if (!empty($modSettings['attachmentSizeLimit']) && $_FILES['attachment']['size'][$n] > $modSettings['attachmentSizeLimit'] * 1024)
fatal_lang_error('file_too_big', false, array($modSettings['attachmentSizeLimit']));

$quantity++;
if (!empty($modSettings['attachmentNumPerPostLimit']) && $quantity > $modSettings['attachmentNumPerPostLimit'])
fatal_lang_error('attachments_limit_per_post', false, array($modSettings['attachmentNumPerPostLimit']));

$total_size += $_FILES['attachment']['size'][$n];
if (!empty($modSettings['attachmentPostLimit']) && $total_size > $modSettings['attachmentPostLimit'] * 1024)
fatal_lang_error('file_too_big', false, array($modSettings['attachmentPostLimit']));

if (!empty($modSettings['attachmentCheckExtensions']))
{
if (!in_array(strtolower(substr(strrchr($_FILES['attachment']['name'][$n], '.'), 1)), explode(',', strtolower($modSettings['attachmentExtensions']))))
fatal_error($_FILES['attachment']['name'][$n] . '.<br />' . $txt['cant_upload_type'] . ' ' . $modSettings['attachmentExtensions'] . '.', false);
}


REPLACE with:
Code: [Select]
if (!$user_info['is_admin'] && !empty($modSettings['attachmentSizeLimit']) && $_FILES['attachment']['size'][$n] > $modSettings['attachmentSizeLimit'] * 1024)
fatal_lang_error('file_too_big', false, array($modSettings['attachmentSizeLimit']));

$quantity++;
if (!$user_info['is_admin'] && !empty($modSettings['attachmentNumPerPostLimit']) && $quantity > $modSettings['attachmentNumPerPostLimit'])
fatal_lang_error('attachments_limit_per_post', false, array($modSettings['attachmentNumPerPostLimit']));

$total_size += $_FILES['attachment']['size'][$n];
if (!$user_info['is_admin'] && !empty($modSettings['attachmentPostLimit']) && $total_size > $modSettings['attachmentPostLimit'] * 1024)
fatal_lang_error('file_too_big', false, array($modSettings['attachmentPostLimit']));

if (!$user_info['is_admin'] && !empty($modSettings['attachmentCheckExtensions']))
{
if (!in_array(strtolower(substr(strrchr($_FILES['attachment']['name'][$n], '.'), 1)), explode(',', strtolower($modSettings['attachmentExtensions']))))
fatal_error($_FILES['attachment']['name'][$n] . '.<br />' . $txt['cant_upload_type'] . ' ' . $modSettings['attachmentExtensions'] . '.', false);
}

FIND:
Code: [Select]
// Check the total upload size for this post...
$total_size += $_FILES['attachment']['size'][$n];
if (!empty($modSettings['attachmentPostLimit']) && $total_size > $modSettings['attachmentPostLimit'] * 1024)
{
checkSubmitOnce('free');
fatal_lang_error('file_too_big', false, array($modSettings['attachmentPostLimit']));
}

REPLACE with:
Code: [Select]
// Check the total upload size for this post...
$total_size += $_FILES['attachment']['size'][$n];
if (!$user_info['is_admin'] && !empty($modSettings['attachmentPostLimit']) && $total_size > $modSettings['attachmentPostLimit'] * 1024)
{
checkSubmitOnce('free');
fatal_lang_error('file_too_big', false, array($modSettings['attachmentPostLimit']));
}

Offline michaeloeser

  • Semi-Newbie
  • *
  • Posts: 30
Re: No attachment limit for admins
« Reply #23 on: March 02, 2012, 04:19:05 AM »
Doesn´t seem to work for me. I´m the main and only administrator of my forum and although I made the changes to Post.php I´m not able to upload more and bigger files as defined in the attachment settings. Using SMF 2.0.2.

Any ideas?

Offline Chalky

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 3,310
  • Gender: Female
  • If in doubt, give me beer...
    • ChalkCat
Re: No attachment limit for admins
« Reply #24 on: March 17, 2012, 10:48:23 AM »
Doesn´t seem to work for me. I´m the main and only administrator of my forum and although I made the changes to Post.php I´m not able to upload more and bigger files as defined in the attachment settings. Using SMF 2.0.2.

Any ideas?

For me neither.  I'm using 2.0.2, just made exactly the edits shown above, but nothing happened...

Offline searchgr

  • Sophist Member
  • *****
  • Posts: 1,244
Re: No attachment limit for admins
« Reply #25 on: May 09, 2012, 11:36:39 AM »
Any update here?

Offline mybiafraland

  • Jr. Member
  • **
  • Posts: 109
  • Gender: Male
  • I desinged my first blog @ 16 now at 18 which way?
    • Dating Site
Re: No attachment limit for admins
« Reply #26 on: June 20, 2012, 08:49:42 AM »
waiting for update as well
"I don't know the key to success, but the key to failure is trying to please everybody." - Bill Cosby
on another note==>> Before sex.. you help each other get na'ked, after
sex you only dress yourself.... Moral of the story:
in life no one helps you once you're fuc'ked
My mentor's Blog hoping  my site beats nairaland someday

Offline Kays

  • Customizer
  • SMF Hero
  • *
  • Posts: 8,973
  • Gender: Male
    • Kayssplace
Re: No attachment limit for admins
« Reply #27 on: June 20, 2012, 10:36:40 AM »
Hi, look in Subs-Post.php for the same set of checks and make the recommended change to those also.
Except, instead of !$user_info['is_admin'] use !$context['user']['is_admin']

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,247
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: No attachment limit for admins
« Reply #28 on: June 21, 2012, 04:50:59 AM »
« Last Edit: June 21, 2012, 10:51:23 AM by Elmacik »
Home of Elmacik