copy($_FILES['file']['tmp_name'], $GLOBALS['CONFIG']['dataDir'] . $newFileName); AccessLog::addLogEntry($id, 'I'); /** * Send out email notifications to reviewers */ $file_obj = new FileData($id, $GLOBALS['connection'], DB_NAME); $get_full_name = $user_obj->getFullName(); $full_name = $get_full_name[0] . ' ' . $get_full_name[1]; $department = $file_obj->getDepartment(); $reviewer_obj = new Reviewer($id, $GLOBALS['connection'], DB_NAME); $reviewer_list = $reviewer_obj->getReviewersForDepartment($department); $date = date('Y-m-d H:i:s T'); // Build email for general notices $mail_subject = msg('checkinpage_file_was_checked_in'); $mail_body2 = msg('checkinpage_file_was_checked_in') . "\n\n"; $mail_body2 .= msg('label_filename') . ': ' . $file_obj->getName() . "\n\n"; $mail_body2 .= msg('label_status') . ': ' . msg('addpage_new') . "\n\n"; $mail_body2 .= msg('date') . ': ' . $date . "\n\n"; $mail_body2 .= msg('addpage_uploader') . ': ' . $full_name . "\n\n"; $mail_body2 .= msg('email_thank_you') . ',' . "\n\n"; $mail_body2 .= msg('email_automated_document_messenger') . "\n\n"; $mail_body2 .= $GLOBALS['CONFIG']['base_url'] . "\n\n"; $email_obj = new Email(); $email_obj->setFullName($full_name); $email_obj->setSubject($mail_subject); $email_obj->setFrom($full_name . ' <' . $user_obj->getEmailAddress() . '>'); $email_obj->setRecipients($reviewer_list); $email_obj->setBody($mail_body2); $email_obj->sendEmail(); // clean up and back to main page $last_message = msg('message_document_checked_in');
exit; } else { // all checks completed /* to avoid problems with some browsers, download script should not include parameters on the URL so let's use a form and pass the parameters via POST */ // form not yet submitted // display information on how to initiate download if (!isset($submit)) { draw_header('View File', $last_message); $GLOBALS['smarty']->assign('file_id', $filedata->getId()); display_smarty_template('view.tpl'); draw_footer(); } else { $id = $filedata->getId(); $realname = $filedata->getName(); // get the filename $filename = $GLOBALS['CONFIG']['dataDir'] . $_POST['id'] . '.dat'; if (file_exists($filename)) { // send headers to browser to initiate file download header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . rawurlencode($realname)); readfile($filename); // Call the plugin API callPluginMethod('onViewFile'); } else { echo 'File not readable...'; } } }
$date = date("D F d Y"); $time = date("h:i A"); $get_full_name = $user_obj->getFullName(); $full_name = $get_full_name[0] . ' ' . $get_full_name[1]; $mail_from = $full_name . ' <' . $user_obj->getEmailAddress() . '>'; $mail_headers = "From: {$mail_from}"; $mail_subject = msg('email_subject_review_status'); $mail_greeting = msg('email_greeting') . ":\n\r\t" . msg('email_i_would_like_to_inform'); $mail_body = msg('email_was_declined_for_publishing_at') . ' ' . $time . ' on ' . $date . ' ' . msg('email_because_you_did_not_revise') . ' ' . $GLOBALS['CONFIG']['revision_expiration'] . ' ' . msg('days'); $mail_salute = "\n\r\n\r" . msg('email_salute') . ",\n\r{$full_name}"; foreach ($data_result as $row) { $file_obj = new FileData($row['id'], $pdo); $user_obj = new User($file_obj->getOwner(), $pdo); $mail_to = $user_obj->getEmailAddress(); if ($GLOBALS['CONFIG']['demo'] == 'False') { mail($mail_to, $mail_subject . $file_obj->getName(), $mail_greeting . $file_obj->getName() . ' ' . $mail_body . $mail_salute, $mail_headers); } } } //do not show file if ($GLOBALS['CONFIG']['file_expired_action'] == 1) { $reviewer_comments = 'To=' . msg('author') . ';Subject=' . msg('message_file_expired') . ';Comments=' . msg('email_file_was_rejected_because') . ' ' . $GLOBALS['CONFIG']['revision_expiration'] . ' ' . msg('days'); foreach ($data_result as $row) { $file_obj = new FileData($row['id'], $pdo); $file_obj->Publishable(-1); $file_obj->setReviewerComments($reviewer_comments); } } //lock file, not check-outable if ($GLOBALS['CONFIG']['file_expired_action'] == 2) { foreach ($data_result as $row) {
if (!isset($_SESSION['uid'])) { redirect_visitor(); } require_once "AccessLog_class.php"; $last_message = isset($_REQUEST['last_message']) ? $_REQUEST['last_message'] : ''; $secureurl_obj = new phpsecureurl(); $lrequest_id = $_REQUEST['id']; //save an original copy of id if (strchr($_REQUEST['id'], '_')) { list($_REQUEST['id'], $lrevision_id) = explode('_', $_REQUEST['id']); $lrevision_dir = $GLOBALS['CONFIG']['revisionDir'] . '/' . $_REQUEST['id'] . '/'; } if (!isset($_GET['submit'])) { draw_header(msg('view') . ' ' . msg('file'), $last_message); $file_obj = new FileData($_REQUEST['id'], $GLOBALS['connection'], DB_NAME); $file_name = $file_obj->getName(); $file_id = $file_obj->getId(); $realname = $file_obj->getName(); // Get the suffix of the file so we can look it up // in the $mimetypes array $suffix = ''; if (strchr($realname, '.')) { // Fix by blackwes $prefix = substr($realname, 0, strrpos($realname, ".")); $suffix = strtolower(substr($realname, strrpos($realname, ".") + 1)); } $lmimetype = File::mime_by_ext($suffix); //echo "Realname is $realname<br>"; //echo "prefix = $prefix<br>"; //echo "suffix = $suffix<br>"; //echo "mime:$lmimetype";
$message = urlencode(msg('message_document_added')); /** * Send out email notifications to reviewers */ $file_obj = new FileData($fileId, $pdo); $get_full_name = $user_obj->getFullName(); $full_name = $get_full_name[0] . ' ' . $get_full_name[1]; $from = $user_obj->getEmailAddress(); $department = $file_obj->getDepartment(); $reviewer_obj = new Reviewer($fileId, $pdo); $reviewer_list = $reviewer_obj->getReviewersForDepartment($department); $date = date('Y-m-d H:i:s T'); // Build email for general notices $mail_subject = msg('addpage_new_file_added'); $mail_body2 = msg('email_a_new_file_has_been_added') . PHP_EOL . PHP_EOL; $mail_body2 .= msg('label_filename') . ': ' . $file_obj->getName() . PHP_EOL . PHP_EOL; $mail_body2 .= msg('label_status') . ': ' . msg('addpage_new') . PHP_EOL . PHP_EOL; $mail_body2 .= msg('date') . ': ' . $date . PHP_EOL . PHP_EOL; $mail_body2 .= msg('addpage_uploader') . ': ' . $full_name . PHP_EOL . PHP_EOL; $mail_body2 .= msg('email_thank_you') . ',' . PHP_EOL . PHP_EOL; $mail_body2 .= msg('email_automated_document_messenger') . PHP_EOL . PHP_EOL; $mail_body2 .= $GLOBALS['CONFIG']['base_url'] . PHP_EOL . PHP_EOL; $email_obj = new Email(); $email_obj->setFullName($full_name); $email_obj->setSubject($mail_subject); $email_obj->setFrom($from); $email_obj->setRecipients($reviewer_list); $email_obj->setBody($mail_body2); $email_obj->sendEmail(); //email_users_id($mail_from, $reviewer_list, $mail_subject, $mail_body2, $mail_headers); // Call the plugin API
$id_field = explode(' ', trim($checkbox)); foreach ($id_field as $key => $value) { // Check to make sure the current file_id is in their list of reviewable ID's if (in_array($value, $id_array)) { $fileid = $value; $file_obj = new FileData($fileid, $pdo); $user_obj = new User($file_obj->getOwner(), $pdo); $mail_to = $user_obj->getEmailAddress(); $dept_id = $file_obj->getDepartment(); // Build email for author notification if (isset($_POST['send_to_users'][0]) && in_array('owner', $_POST['send_to_users'])) { // Lets unset this now so the new array will just be user_id's $_POST['send_to_users'] = array_slice($_POST['send_to_users'], 1); $mail_body1 = $comments . PHP_EOL . PHP_EOL; $mail_body1 .= msg('email_your_file_has_been_authorized') . PHP_EOL . PHP_EOL; $mail_body1 .= msg('label_filename') . ': ' . $file_obj->getName() . PHP_EOL . PHP_EOL; $mail_body1 .= msg('label_status') . ': ' . msg('message_authorized') . PHP_EOL . PHP_EOL; $mail_body1 .= msg('date') . ': ' . $date . PHP_EOL . PHP_EOL; $mail_body1 .= msg('label_reviewer') . ': ' . $full_name . PHP_EOL . PHP_EOL; $mail_body1 .= msg('email_thank_you') . ',' . PHP_EOL . PHP_EOL; $mail_body1 .= msg('email_automated_document_messenger') . PHP_EOL . PHP_EOL; $mail_body1 .= $GLOBALS['CONFIG']['base_url'] . PHP_EOL . PHP_EOL; if ($GLOBALS['CONFIG']['demo'] == 'False') { mail($mail_to, $mail_subject . " " . $file_obj->getName(), $mail_body1, $mail_headers); } } $file_obj->Publishable(1); $file_obj->setReviewerComments($reviewer_comments); AccessLog::addLogEntry($fileid, 'Y', $pdo); // Build email for general notices $mail_subject = !empty($_REQUEST['subject']) ? stripslashes($_REQUEST['subject']) : $file_obj->getName() . ' ' . msg('email_added_to_repository');