HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


File downloads: An error has occurred

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#48186 (In Topic #10543)
Avatar

Community saint

Error comes up when trying to download a file from the downloads page:

Expand: Stack Stack


www.precorp.fr

Last one to leave the country, please turn off the lights.
Back to the top
 
Posted
Rating:
#48196
Avatar

Hi,

I think you cut out a bit of code which was:

Code

   // Cost?
   $got_before=$GLOBALS['SITE_DB']->query_value_null_ok('download_logging','the_user',array('the_user'=>get_member(),'id'=>$id));
   if (addon_installed('points'))
   {
      if ($myrow['download_cost']>0)
      {
         require_code('points');
   
         $member=get_member();
         if ($member==$GLOBALS['FORUM_DRIVER']->get_guest_id())
            access_denied('NOT_AS_GUEST');
   
         // Check they haven't downloaded this before (they only get charged once - maybe they are resuming)
         if (is_null($got_before))
         {
            $cost=$myrow['download_cost'];
         
            $member=get_member();
            if ($member==$GLOBALS['FORUM_DRIVER']->get_guest_id())
               access_denied('NOT_AS_GUEST');

            $dif=$cost-available_points($member);
            if (($dif>0) && (!has_specific_permission(get_member(),'have_negative_gift_points')))
               warn_exit(do_lang_tempcode('LACKING_POINTS',number_format($dif)));
            charge_member($member,$cost,do_lang('DOWNLOADED_THIS',get_translated_text($myrow['name'])));
         
            if ($myrow['download_submitter_gets_points']==1)
            {
               system_gift_transfer(do_lang('THEY_DOWNLOADED_THIS',get_translated_text($myrow['name'])),$cost,$myrow['submitter']);
            }
         }
      }
   }


$got_before is defined at the top of there. It's used to stop points being double-charged, but it's also used later in the file to stop full-filesize-bandwidth being double logged for throttled websites (for people resuming a download).


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#48204
Avatar

Community saint

 :$
You're right, I did delete this chunk.
Guess in the other post  I should have listed exactly what I had deleted, probably would have made your life easier finding it…
Sorry for that.

Pasted it back where it belongs, works fine.
 :thumbs:

www.precorp.fr

Last one to leave the country, please turn off the lights.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: