/** * Print all XHTML headers * This function prints the HTML header code, CSS link, and JavaScript link * * DOCTYPE is XHTML 1.0 Transitional * @param none */ function printHTMLHeader() { global $conf; global $languages; global $lang; global $charset; $path = $this->dir_path; echo "<?xml version=\"1.0\" encoding=\"{$charset}\"?" . ">\n"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $languages[$lang][2]; ?> " lang="<?php echo $languages[$lang][2]; ?> "> <head> <title> Room Reservation System </title> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?> " /> <?php if ((bool) $conf['app']['allowRss'] && Auth::is_logged_in()) { echo '<link rel="alternate" type="application/rss+xml" title="phpScheduleIt" href=" ' . CmnFns::getScriptURL() . '/rss.php?id=' . Auth::getCurrentID() . "\"/>\n"; } ?> <link rel="shortcut icon" href="favicon.ico"/> <link rel="icon" href="favicon.ico"/> <style type="text/css"> @import url(<?php echo $path; ?> jscalendar/calendar-blue-custom.css); @import url(<?php echo $path; ?> css.css); </style> </head> <body> <?php }
/** * Send an email informing the users they have been dropped from the reservation * @param array $emails array of email addresses * @param array $dates that have been dropped */ function remove_users_email($emails, $dates) { global $conf; $mailer = new PHPMailer(); $mailer->From = $this->user->get_email(); $mailer->FromName = $this->user->get_name(); $mailer->Subject = $conf['app']['title'] . ' ' . translate('Reservation Participation Change'); $mailer->IsHTML(false); $url = CmnFns::getScriptURL(); // Format dates $start_date = Time::formatDate($this->start_date); $end_date = Time::formatDate($this->end_date); $start = Time::formatTime($this->get_start()); $end = Time::formatTime($this->get_end()); $dates_text = ''; for ($d = 1; $d < count($dates); $d++) { $dates_text .= Time::formatDate($dates) . ","; } foreach ($emails as $email) { $mailer->ClearAllRecipients(); $mailer->AddAddress($email); $mailer->Body = translate_email('reservation_removal', $this->resource->properties['name'], $start_date, $start, $end_date, $end, $this->summary, $dates_text); $mailer->Send(); } }
/** * Change user password * This function creates a new random 8 character password, * sets it in the database and emails it to the user * @return boolean true or false on success of function * @see make_seed() */ function changePassword() { global $conf; $adminemail = $conf['app']['adminEmail']; $title = $conf['app']['title']; $use_logon_name = (bool) $conf['app']['useLogonName']; // Check if user exists $email = stripslashes(trim($_POST['email_address'])); // Connect to database $AuthDB = new AuthDB(); $id = $AuthDB->userExists($email); if (empty($id)) { CmnFns::do_error_box(translate('Sorry, we could not find that user in the database.'), '', false); return false; } else { $user = new User($id); $result = $user->get_user_data(); } // Generate new 8 character password by choosing random // ASCII characters between 48 and 122 // (valid password characters) $pwd = ''; $num = 0; for ($i = 0; $i < 8; $i++) { // Seed random for older versions of PHP mt_srand(make_seed()); if ($i % 2 == 0) { $num = mt_rand(97, 122); } else { if ($i % 3 == 0) { $num = mt_rand(48, 58); } else { $num = mt_rand(63, 90); } } // Uppercase letters and '@ ?' // Put password together $pwd .= chr($num); } // Set password in database $user->set_password($pwd); // Send email to user $sub = translate('Your New Password', array($title)); $msg = translate_email('new_password', $result['fname'], $conf['app']['title'], $pwd, CmnFns::getScriptURL(), $adminemail); $msg .= $use_logon_name ? "\r\n" . translate('Your logon name is', array($result['logon_name'])) : ''; // Send email $mailer = new PHPMailer(); $mailer->AddAddress($result['email'], $result['fname']); $mailer->FromName = $conf['app']['title']; $mailer->From = $adminemail; $mailer->Subject = $sub; $mailer->Body = $msg; $mailer->Send(); return true; }
/** * Send a notification email that the password has been reset * @param string $memberid id of member * @param string $password new password for user */ function send_pwdreset_email($memberid, $password) { global $conf; $adminemail = $conf['app']['adminEmail']; $appTitle = $conf['app']['title']; $user = new User($memberid); $subject = $appTitle . ' ' . translate('Password Reset'); $msg = $user->get_fname() . ",\r\n" . translate_email('password_reset', $appTitle, $password, $appTitle, CmnFns::getScriptURL(), $adminemail); $mailer = new PHPMailer(); $mailer->AddAddress($user->get_email(), $user->get_name()); $mailer->From = $adminemail; $mailer->FromName = $conf['app']['title']; $mailer->Subject = $subject; $mailer->Body = $msg; $mailer->Send(); }
/** * Prints a message telling the user to log in * @param boolean $kill whether to end the program or not */ function print_login_msg($kill = true) { CmnFns::redirect(CmnFns::getScriptURL() . '/index.php?auth=no&resume=' . urlencode($_SERVER['PHP_SELF']) . '?' . urlencode($_SERVER['QUERY_STRING'])); }
* @package phpScheduleIt * * Copyright (C) 2003 - 2007 phpScheduleIt * License: GPL, see LICENSE */ include_once 'lib/DBEngine.class.php'; if (!(bool) $conf['app']['allowRss'] || (bool) $conf['app']['allowRss'] && !isset($_GET['id'])) { die; } $db = new DBEngine(); $res = $db->get_user_reservations($_GET['id'], 'res.start_date', 'DESC', true); global $charset; header('Content-Type: text/xml'); echo "<?xml version=\"1.0\" encoding=\"{$charset}\"?" . ">\n<rss version=\"2.0\">\n"; echo "<channel>\n<title>{$conf['app']['title']} Reservations</title>\n"; if (!$res) { echo "<item>\n"; echo '<title>' . $db->err_msg . "</title>\n"; echo '<link>' . CmnFns::getScriptURL() . "</link>\n"; echo '<description>' . $db->err_msg . "</description>\n"; echo "</item>\n"; } for ($i = 0; $i < count($res) && $res != false; $i++) { $cur = $res[$i]; echo "<item>\n"; echo '<title>' . $cur['name'] . ' [' . Time::formatDate($cur['start_date']) . ' @ ' . Time::formatTime($cur['starttime']) . "]</title>\n"; echo '<link>' . CmnFns::getScriptURL() . "/reserve.php?type=m&resid={$cur['resid']}&scheduleid={$cur['scheduleid']}" . "</link>\n"; echo '<description>' . "</description>\n"; echo "</item>\n"; } echo "</channel>\n</rss>";