function sendMail($receipient, $fileName, $conf, $lang) { // ************************************************* // function sendMail // Parameters: // $receipient: e-mail adress of receipient // $fileName: name of file to send the link of // $conf: the general configuration of SiFiEx // $lang: to be used language // Return value: TRUE if mail was send, otherwise FALSE // // Sends an e-mail to the named e-mail-adress to notify // someone of a file on the SiFiEx-server // ************************************************* $header = ""; $header .= "From: " . $conf['mailSenderName'] . " <" . $conf['mailSenderEmail'] . ">\r\n"; ini_set("sendmail_from", $conf['mailSenderEmail']); $body = ""; $body .= $lang['mailStart'] . " "; $pathFull = explode("/", $_SERVER['PHP_SELF']); array_pop($pathFull); $pathToScript = implode("/", $pathFull); $body .= detectSSL() . "://" . $_SERVER['HTTP_HOST'] . $pathToScript . $fileName . "\n\n"; if ($conf['mailInfoPassword']) { $body .= $lang['mailPassword'] . "\n\n"; } $body .= "\n\n" . $lang['mailEnd']; if (!mail($receipient, $lang['mailSubject'], $body, $header)) { showNotification("Mail send error", $config['appName'], $lang['mailError'], $iconPath); writeWarning($lang['mailError']); return FALSE; } else { showNotification("Mail has been sent", $config['appName'], $lang['mailSuccess'] . $receipient, $iconPath); writeSuccess($lang['mailSuccess'] . $receipient); return TRUE; } if ($conf['debug']) { echo "<pre>" . $header . "\n\n" . $body . "</pre>\n"; } }
<html> <head lang="en"> <meta charset="UTF-8"> <title>Users</title> <link rel="stylesheet" type="text/css" href="public/css/bootstrap/css/bootstrap.css"/> </head> <body> <div class="container" style="padding-top: 100px;"> <?php showNotification(); ?> <div class="row"> <?php include_once 'routes.php'; ?> </div> </div> </body> </html>
} if ($HTTP_POST_VARS['remail'] != "") { sendMail($HTTP_POST_VARS['mailAdresses'], "/" . $config['fileDir'] . $HTTP_POST_VARS['name'], $config, $lang); } if ($HTTP_POST_VARS['delete'] == $lang['yes']) { writeOngoing($lang['deleting']); # first we have to be aware that some evil guy trys to delete files # outside of our directory by deleting ".." and "/" in filename $deleteFile = $HTTP_POST_VARS['name']; //$deleteFile=ereg_replace("\/","",$HTTP_POST_VARS['name']); //$deleteFile=(ereg_replace("\.\.","",$deleteFile)); if (@unlink($config['fileDir'] . $deleteFile)) { showNotification("File has been deleted", $config['appName'], $lang['deleteSuccess'], $iconPath); writeSuccess($lang['deleteSuccess']); } else { showNotification("Delete failed", $config['appName'], $lang['deleteError'], $iconPath); writeWarning($lang['deleteError']); } } ?> </div> <?php if ($HTTP_POST_VARS['expandUploadSubmit']) { ?> <div id="uploadForm"> <h2><?php echo $lang['uploadHeading']; ?> </h2> <form method="post" action="index.php" enctype="multipart/form-data">
$pursuing_course = $_SESSION['pursuing_course']; $department_id = $_SESSION['department_id']; $faculty_id = $_SESSION['faculty_id']; $campus_id = $_SESSION['campus_id']; $adm_yr = $_SESSION['adm_yr']; $query .= "`notifications`.`school_course` = 'ALL_CRS' OR `notifications`.`school_course` = '{$pursuing_course}'\n\t\t\t\t\t\tAND `notifications`.`department_id` = 'ALL_DEP' OR `notifications`.`department_id` = '{$department_id}' \n\t\t\t\t\t\tAND `notifications`.`faculty_id` = 'ALL_FAC' OR `notifications`.`faculty_id` = '{$faculty_id}' \n\t\t\t\t\t\tAND `notifications`.`campus_id` = 'ALL_CAM' OR `notifications`.`campus_id` = '{$campus_id}'\n\t\t\t\t\t\tAND `notifications`.`student_adm_yr`= '0000' OR `notifications`.`student_adm_yr`= '{$adm_yr}'"; } if ($result = mysqli_query($conn, $query)) { while ($notifications = mysqli_fetch_assoc($result)) { $n_id = $notifications['notification_id']; $n_title = $notifications['notification_title']; $n_desc = $notifications['notification_message']; $n_sender = $notifications['notification_sender']; $n_send_time = $notifications['notification_send_time']; if ($_POST['client'] == 'desktop') { showNotification($n_id, $n_title, $n_desc, $n_sender, $n_send_time); } else { echo json_encode(array_map("utf8_encode", $notifications)) . ","; } } } else { echo "Error " . mysqli_error($conn) . " <br />"; } function showNotification($n_id, $n_title, $n_desc, $n_sender, $n_send_time) { echo '<div style=" box-shadow:rgb(200,200,200) 3px 4px; border-radius:10px; width: 350px; margin:5px; background-color:#eee; z-index:10;"> <p style="font-family: verdana; padding:5px;"> <label style="font-size:12px; float:right; color:#aaa;">' . date("D M Y H:i", $n_send_time) . '</label> <label style="font-size:12px; float:left; color:#afafaf;">' . $n_sender . '</label><br /> <label style="font-size:16px; float:left; color:#378de5;">' . $n_title . '</label><br /> <label style="font-size:13px; color:#aabbcc;"> ' . $n_desc . '</label><br />