Standard text message charges may apply

    Text alerts by Moms Rising. 4 messages/month. Msg & Data Rates May Apply. Text STOP to quit. For help text HELP or contact txt@mcommons.com.

    Chapter Download Center

    NULL)); $output = 'The file count has been reset.'; drupal_set_message($output); } if ($user->uid) { $user = user_load(array('uid' => $user->uid)); if ($_GET['file']) { $file = $_GET['file']; if ($file == 'clear') { user_save($user, array('chapters' => NULL)); } $path = file_create_path('files/private/'.$file); if (file_exists($path)) { $size = filesize($path); if ($size > 0) { $chapters = $user->chapters ? $user->chapters : array(); if (!in_array($file, $chapters)) { if (count($chapters) >= $LIMIT) { $error = 'You have already downloaded the maximum number of chapters. Sorry!'; } else { $chapters[] = $file; $user = user_save($user, array('chapters' => $chapters)); } } if ($error == FALSE) { $headers = array('Content-Type: application/pdf', 'Content-Length: '. $size, 'Content-Disposition: attachment; filename="'.$file.'"'); file_transfer($path, $headers); } else { drupal_set_message($error); } } } else { echo "

    Error: file not found

    "; } } } else { $output = '

    You must be logged in to download chapters.

    '; $output .= '

    '.l('Log in here', 'user/login'). ' or ' .l('register for an account', 'user/register').'. It\'s quick and easy!

    '; drupal_set_message($output); } if (user_access('access administration pages')) { ?> Your private download center... chapters) > 0) { $reset_msg = 'Click '.l("here","node/97",array(),"reset").' to reset the download count.'; drupal_set_message($reset_msg); } $priv_dir = file_create_path('private'); $priv_regexp = "([A-Za-z0-9._-]+[pdf])"; $priv_files = file_scan_directory($priv_dir,$priv_regexp); asort($priv_files); $output = "

      "; foreach ($priv_files as $file) { $output .= "
    • ".l($file->basename,'download/private',array(),'file='.$file->basename)."
    • "; } $output .= "
    "; print $output; } ?>