header('Location:error.php?ec=14'); exit; //non-unique error } $filedata = new FileData($data_id, $pdo); // error check if (!$filedata->exists()) { header('Location:error.php?ec=2'); exit; } else { $category = $filedata->getCategory(); $realname = $filedata->getName(); $description = $filedata->getDescription(); $comment = $filedata->getComment(); $owner_id = $filedata->getOwner(); $department = $filedata->getDepartment(); //CHM $table_name_query = "SELECT table_name FROM {$GLOBALS['CONFIG']['db_prefix']}udf WHERE field_type = '4'"; $table_name_stmt = $pdo->prepare($table_name_query); $table_name_stmt->execute(); $result = $table_name_stmt->fetchAll(); $num_rows = $table_name_stmt->rowCount(); $t_name = array(); $i = 0; foreach ($result as $data) { $explode_v = explode('_', $data['table_name']); $t_name = $explode_v[2]; $i++; } // For the User dropdown $avail_users = $user_perms_obj->user_obj->getAllUsers($pdo);
$query = "INSERT INTO {$GLOBALS['CONFIG']['db_prefix']}log (id, modified_on, modified_by, note, revision) VALUES('{$id}', NOW(), '" . addslashes($username) . "', '" . addslashes($_POST['note']) . "', 'current')"; $result = mysql_query($query, $GLOBALS['connection']) or die("Error in query: {$query}. " . mysql_error()); // update file status $query = "UPDATE {$GLOBALS['CONFIG']['db_prefix']}data SET status = '0', publishable='{$lpublishable}', realname='{$filename}' WHERE id='{$id}'"; $result = mysql_query($query, $GLOBALS['connection']) or die("Error in query: {$query}. " . mysql_error()); // rename and save file $newFileName = $id . '.dat'; 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);
$mail_headers = "From: " . $mail_from . PHP_EOL . PHP_EOL; $mail_headers .= "Content-Type: text/plain; charset=UTF-8" . PHP_EOL . PHP_EOL; if ($user_obj->isAdmin()) { $id_array = $user_obj->getAllRevieweeIds(); } else { $id_array = $user_obj->getRevieweeIds(); } $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);