function drawJumpToStaff($selectedID = false) { global $page; $nullable = $selectedID === false; $return = drawPanel(getString('jump_to') . ' ' . drawSelectUser('', $selectedID, $nullable, 0, true, true, 'Staff Member:')); if ($page['is_admin'] && db_grab('SELECT COUNT(*) FROM users_requests WHERE is_active = 1')) { $return = drawMessage('There are pending <a href="requests.php">account requests</a> for you to review.') . $return; } return $return; }
<?php $pageIsPublic = true; include "../include.php"; echo drawSimpleTop(getString('password_reset')); echo drawMessage(getString('password_confirm')); echo drawSimpleBottom();
<?php include "include.php"; if ($posting) { $user_id = $page['is_admin'] ? $_POST["user_id"] : $_SESSION["user_id"]; format_post_nulls("type_id"); $id = db_query("INSERT INTO helpdesk_tickets (\r\n \tcreated_user,\r\n \ttype_id,\r\n\t\tpriorityID,\r\n\t\tdepartmentID,\r\n\t\tdescription,\r\n\t\tstatusID,\r\n\t\tipAddress,\r\n\t\tcreated_date,\r\n\t\tupdated_date,\r\n\t\ttitle\r\n\t) VALUES (\r\n\t\t" . $user_id . ",\r\n\t\t" . $_POST["type_id"] . ",\r\n\t\t'" . $_POST["priorityID"] . "',\r\n\t\t'" . $_POST["departmentID"] . "',\r\n\t\t'" . $_POST["description"] . "',\r\n\t\t1,\r\n\t\t'{$_SERVER["REMOTE_ADDR"]}',\r\n\t\tGETDATE(),\r\n\t\tGETDATE(),\r\n\t\t'" . $_POST["title"] . "'\r\n );"); //$r = db_grab("SELECT MAX(id) id FROM helpdesk_tickets"); //todo - email mohammed for critical emailITTicket($id, 'new'); //special for carla url_change('ticket.php?id=' . $id); } echo drawTop(); echo drawMessage($helpdeskStatus, "center"); ?> <script language="javascript"> <!-- function updateTypes(departmentID) { var types = new Array(3, 8); <?php $types = db_query("SELECT id, departmentID, description FROM helpdesk_tickets_types ORDER BY departmentID, description"); $options = array(); while ($t = db_fetch($types)) { $options[$t["departmentID"]][] = '"' . $t["id"] . '|' . $t["description"] . '"'; } while (list($key, $value) = each($options)) { ?> types[<?php echo $key;
<?php $pageIsPublic = true; include "../include.php"; echo drawSimpleTop(getString('login_account_exists')); echo drawMessage(getString('login_account_exists_msg')); echo drawSimpleBottom();
$target = "/staff/changes.php"; } elseif (stristr($req, "/departments/administration")) { $target = str_replace("/departments/administration", "/openings", $req); } elseif (stristr($req, "/departments/earnfair")) { $target = str_replace("/departments/earnfair", "/queries", $req); } elseif (stristr($req, "/departments/resource_development")) { $target = str_replace("/departments/resource_development", "/funders", $req); } elseif (stristr($req, "/docs")) { $target = str_replace("/docs", "/docs", $req); } elseif (stristr($req, "/btw")) { //back to work application ~ used to have the intranet domain $target = "http://btw.seedco.org" . $req; } elseif (stristr($req, "msoffice/cltreq.asp")) { //m$ft internet explorer discussion bar, no redirect } elseif (stristr($req, "favicon.ico")) { //site favorite icon, no redirect } elseif (stristr($req, "_vti_")) { //looking for m$ft front page extensions, no redirect } elseif ($_SESSION["user_id"] != 1) { //user is admin, send email $msg = $_SESSION["full_name"] . " couldn't find " . url_base() . $req; if ($referrer) { $msg .= "<br><br>Referred by " . $referrer; } } if ($target) { url_change($target, true); } echo drawTop(); echo drawMessage("<b>Error: Page Not Found</b><br>\nSorry, the page you're looking for isn't here! If you feel you reached this page in error, please contact \n<a href='mailto:josh@joshreisner.com'>Josh Reisner</a> so it can be fixed."); echo drawBottom();
function emailITticket($id, $scenario, $admin = false, $debug = false) { global $_josh, $page; $ticket = db_grab('SELECT u.id, (SELECT COUNT(*) FROM users_to_modules a WHERE a.user_id = u.id AND a.module_id = 3) isUserAdmin, t.title, t.created_user, t.description, t.departmentID, ISNULL(u.nickname, u.firstname) first, u.lastname last, u.email, ' . db_updated('u') . ', t.created_date, t.priorityID, t.statusID, d.shortName department, t.type_id, y.description type, u2.email as ownerEmail, t.ownerID, ISNULL(u2.nickname, u2.firstname) as ownerName FROM helpdesk_tickets t LEFT JOIN helpdesk_tickets_types y ON t.type_id = y.id JOIN users u ON t.created_user = u.id JOIN departments d ON t.departmentID = d.departmentID LEFT JOIN users u2 ON t.ownerID = u2.id WHERE t.id = ' . $id); //yellow box if ($scenario == "followup") { $subject = "Followup On Your Helpdesk Ticket"; $message = drawMessage('There\'s been followup on your Helpdesk ticket - please see below. <b>Don\'t reply to this email!</b> Instead, please ' . draw_link('/helpdesk/ticket.php?id=' . $id, 'view your ticket') . ' in the intranet ticketing system.<br><br><b>Note:</b> if you add this sender to your "safe senders list," pictures will always download.'); } elseif ($scenario == "followupadmin") { $subject = "Admin Followup on Helpdesk Ticket"; $message = drawMessage(draw_link('/staff/view.php?id=' . user(), $_SESSION['full_name']) . ' just made an administrative followup on this Helpdesk ticket. Regular staff were not copied on this message.'); } elseif ($scenario == "closed") { $subject = "Your Ticket Has Been Closed"; $message = drawMessage('This is to let you know that your ticket has been closed. <b>Don\'t reply to this email!</b> You can still followup on this thread by ' . draw_link('/helpdesk/ticket.php?id=' . $id, 'viewing your ticket') . ' in the intranet ticketing system.<br><br><b>Note:</b> if you add this sender to your "safe senders list," pictures will always download.'); } elseif ($scenario == "assign") { $subject = "Your Ticket Has Been Assigned"; $message = drawMessage(draw_link('/staff/view.php?id=' . user(), $_SESSION["full_name"]) . ' has assigned this ticket to ' . draw_link('/staff/view.php?id=' . $ticket['ownerID'], $ticket["ownerName"]) . '<b>Don\'t reply to this email!</b> Instead, please ' . draw_link('/helpdesk/ticket.php?id=' . $id, 'view your ticket') . ' in the intranet ticketing system.<br><br><b>Note:</b> if you add this sender to your "safe senders list," pictures will always download.'); } elseif ($scenario == "new") { $subject = "New " . $ticket["department"] . " Ticket Posted"; $message = drawMessage('This is to let you know that a new ticket has just been posted to the Helpdesk. You can ' . draw_link('/helpdesk/ticket.php?id=' . $id, 'view the ticket') . ' in the intranet ticketing system.'); } elseif ($scenario == "critical") { $subject = "Critical " . $ticket["department"] . " Ticket Still Open"; $message = drawMessage('A ticket flagged "Critical" is open on the Helpdesk. You can ' . draw_link('/helpdesk/ticket.php?id=' . $id, 'view the ticket') . ' in the intranet ticketing system.'); } //$message .= drawtableStart() . drawHeaderRow(false, 2); //recipients arrays $users = array(); $admins = array(); if ($ticket["isUserAdmin"]) { $admins[] = $ticket["email"]; } else { $users[] = $ticket["email"]; } if ($page['is_admin']) { $admins[] = $_SESSION["email"]; } else { $users[] = $_SESSION["email"]; } //add owner if ticket is assigned if ($ticket["ownerEmail"]) { $admins[] = $ticket["ownerEmail"]; } //owner logically has to be admin $d_user = new display($page['breadcrumbs'] . $ticket['title'], false, false, 'thread'); $d_admin = new display($page['breadcrumbs'] . $ticket['title'], false, false, 'thread'); $d_user->row(drawName($ticket['created_user'], $ticket['first'] . ' ' . $ticket['last'], $ticket['created_date'], true, BR, $ticket['updated']), draw_h1($ticket['title']) . $ticket['description']); $d_admin->row(drawName($ticket['created_user'], $ticket['first'] . ' ' . $ticket['last'], $ticket['created_date'], true, BR, $ticket['updated']), draw_h1($ticket['title']) . $ticket['description']); //get followups $followups = db_query('SELECT u.id, f.message, (SELECT COUNT(*) FROM users_to_modules u2m WHERE u2m.user_id = u.id AND u2m.module_id = 3 AND u2m.is_admin = 1) isUserAdmin, ISNULL(u.nickname, u.firstname) firstname, u.lastname, u.email, f.created_date, f.is_admin, f.created_user, ' . db_updated('u') . ' FROM helpdesk_tickets_followups f INNER JOIN users u ON f.created_user = u.id WHERE f.ticketID = ' . $id . ' ORDER BY f.created_date'); while ($f = db_fetch($followups)) { $d_admin->row(drawName($f['created_user'], $f['firstname'] . ' ' . $f['lastname'], $f['created_date'], true, BR, $f['updated']), $f['message']); if (!$f['is_admin']) { $d_user->row(drawName($f['created_user'], $f['firstname'] . ' ' . $f['lastname'], $f['created_date'], true, BR, $f['updated']), $f['message']); } if ($f['isUserAdmin']) { $admins[] = $f['email']; } else { $users[] = $f['email']; } } $admins = array_remove($_SESSION['email'], array_unique($admins)); $users = array_remove($_SESSION['email'], array_unique($users)); if ($debug) { die(drawEmail($message . $d_admin->draw())); } //special codes for email //todo: put this in db, possibly by adding something to the users table or something if ($scenario == "new" && $ticket["departmentID"] == 3) { $admins = array('*****@*****.**', '*****@*****.**', '*****@*****.**'); } if ($scenario == "new" && $ticket["departmentID"] == 13) { $admins = array('*****@*****.**', '*****@*****.**'); } if ($scenario == "new" && $ticket["departmentID"] == 2) { $admins = array('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**'); } if ($scenario == "critical" && $ticket["departmentID"] == 8) { $admins = array('*****@*****.**'); } if (count($admins)) { //$admins = join(", ", $admins); email($admins, drawEmail($message . $d_admin->draw()), $subject); error_debug('admin message emailed to ' . implode(', ', $admins) . ' admins', __FILE__, __LINE__); } if (count($users) && $scenario != "followupadmin" && !$admin) { //$users = join(", ", $users); email($users, drawEmail($message . $d_user->draw()), $subject); error_debug('user message emailed to ' . implode(', ', $users) . ' users', __FILE__, __LINE__); } }
<?php $pageIsPublic = true; include "../include.php"; echo drawSimpleTop(getString('legal_title')); echo drawMessage(draw_container('h1', getString('legal_title')) . getString('legal_message')); echo drawSimpleBottom();
$r['nickname'] = trim($r['nickname']); $r['organization'] = empty($r['organization']) ? '<a href="organizations.php?id=0">' . getString('shared') . '</a>' : '<a href="organizations.php?id=' . $r['organization_id'] . '">' . $r['organization'] . '</a>'; //if (!isset($r['is_active'])) url_change("./"); if (!($img = draw_img(file_dynamic('users', 'image_large', $_GET['id'], 'jpg', $r['updated'])))) { $img = draw_img(DIRECTORY_WRITE . "/images/to-be-taken.png"); } file_dynamic('users', 'image_medium', $_GET['id'], 'jpg', $r['updated']); file_dynamic('users', 'image_small', $_GET['id'], 'jpg', $r['updated']); echo drawJumpToStaff($_GET['id']); if (!$r['is_active']) { $msg = "This is a former staff member. "; if ($r['endDate']) { $msg .= $r['nickname'] ? $r['nickname'] : $r['firstname']; $msg .= "'s last day was " . format_date($r['endDate']) . "."; } echo drawMessage($msg, "center"); } ?> <table class="left" cellspacing="1"> <?php if ($page['is_admin']) { if ($r['is_active']) { echo drawHeaderRow($page['breadcrumbs'] . $page['title'], 3, getString('edit'), "add_edit.php?id=" . $_GET['id'], getString('delete'), drawDeleteLink("Deactivate this staff member?")); } else { echo drawHeaderRow($page['breadcrumbs'] . $page['title'], 3, getString('edit'), "add_edit.php?id=" . $_GET['id'], "re-activate", drawDeleteLink("Re-activate this staff member?", false, "undelete")); } } elseif ($_GET['id'] == $_SESSION['user_id']) { echo drawHeaderRow($page['title'], 3, getString('edit'), "add_edit.php?id=" . $_GET['id']); } else { echo drawHeaderRow($page['title'], 3); }
<?php include "../../include.php"; echo drawTop(); if ($_josh["db"]["language"] == "mssql") { db_switch("trackit"); $l = db_grab("SELECT MAX(loadDate) loadDate FROM _josh_loads"); echo drawMessage("These database indexes were loaded: " . format_date($l["loadDate"], true, " at ")); db_switch($_josh["db"]["database"]); } ?> <table class="left" cellspacing="1"> <?php echo drawHeaderRow("Reports", 1); ?> <tr><td><a href="totals.php">Totals</a></td></tr> <tr><td><a href="percentages.php">Percentages (without Vacation)</a></td></tr> </table> <?php echo drawBottom();
foreach ($searchTerms as $searchTerm) { $searchTerm = format_quotes($searchTerm); if (in_array($searchTerm, $ignored_words)) { $skips[] = $searchTerm; } else { $terms[] = $searchTerm; $where[] = 'w' . $counter . '.word = "' . $searchTerm . '"'; $joins[] = 'INNER JOIN contacts_instances_to_words i2w' . $counter . ' ON i.id = i2w' . $counter . '.instanceID INNER JOIN words w' . $counter . ' ON i2w' . $counter . '.wordID = w' . $counter . '.id'; $counter++; } } if (count($skips)) { if (count($skips) == 1) { echo drawMessage('<b>Note:</b> The word ' . $skips[0] . ' was ignored in your search.'); } else { echo drawMessage('<b>Note:</b> The words ' . formatArrayForText($skips) . ' were ignored in your search.'); } } if (count($where)) { $where = implode(' AND ', $where); $joins = implode(' ', $joins); $needle = join('|', $searchTerms); $result = db_query('SELECT o.id, o.is_active, i.varchar_01 firstname, i.varchar_02 lastname, i.varchar_04 organization, i.varchar_08 phone, i.created_date last_updated, i.created_user user_id
<?php include "include.php"; //deactivate laptop if (isset($_GET["deactivate"])) { db_query("UPDATE it_laptops SET is_active = 0 WHERE laptopID = " . $_GET["deactivate"]); url_drop(); } //handle laptop checkin if (isset($_GET["checkin"])) { db_query("UPDATE it_laptops SET checkoutID = NULL, laptopStatusID = 2 WHERE laptopID = " . $_GET["checkin"]); url_drop(); } echo drawTop(); if ($_SESSION["departmentID"] != 8) { echo drawMessage("This page is specific to IT."); drawBottom(); exit; } ?> <table class="left" cellspacing="1"> <?php echo drawHeaderRow("Laptop Requests", 5); $result = db_query('SELECT t.title, t.statusID, (SELECT count(*) FROM helpdesk_tickets_followups f WHERE f.ticketID = t.id) ticketfollowups, t.created_user, t.updated_date, ' . db_updated('t') . ', t.id,
$value = db_grab('SELECT name FROM offices WHERE id = ' . $value); } elseif ($key == 'organization_id' && $value) { $value = db_grab('SELECT title from organizations WHERE id = ' . $value); } elseif ($key == 'Additional Info') { $value = nl2br($value); } $message .= '<tr><td class="left">' . $key . '</td><td>' . $value . '</td></tr>'; } $message .= '<tr><td colspan="2" class="bottom">' . draw_link($link, 'click here') . '</td></tr>'; $message = '<table border="1">' . $message . '</table>'; emailAdmins($message, $subject); } url_change('account_confirm.php'); } echo drawSimpleTop(getString('login_account_request')); echo drawMessage(getString('login_account_request_msg')); $f = new form('users_requests', false, getString('login_account_request')); $f->set_field(array('type' => 'select', 'sql' => 'SELECT id, title' . langExt() . ' title FROM organizations WHERE is_active = 1 ORDER BY precedence', 'name' => 'organization_id', 'label' => getString('organization'), 'required' => true, 'null_value' => getString('please_select'))); $f->set_field(array('type' => 'text', 'name' => 'firstname', 'label' => getString('name_first'))); $f->set_field(array('type' => 'text', 'name' => 'nickname', 'label' => getString('nickname'))); $f->set_field(array('type' => 'text', 'name' => 'lastname', 'label' => getString('name_last'))); $f->set_field(array('type' => 'text', 'name' => 'title', 'label' => getString('staff_title'))); $f->set_field(array('type' => 'text', 'name' => 'phone', 'label' => getString('telephone'))); $f->set_field(array('type' => 'text', 'name' => 'email', 'label' => getString('email'))); if (getOption('staff_showoffice')) { $f->set_field(array('type' => 'select', 'name' => 'officeID', 'label' => getString('location'), 'sql' => 'SELECT id, name FROM offices ORDER BY precedence', 'required' => true)); } else { $f->unset_fields('officeID'); } if (getOption('staff_showdept')) { $f->set_field(array('type' => 'select', 'name' => 'departmentID', 'label' => getString('department'), 'sql' => 'SELECT departmentID, departmentName FROM departments WHERE is_active = 1 ORDER BY precedence'));
if ($posting) { if ($r = db_grab('SELECT id FROM users WHERE email = "' . $_POST['email'] . '" AND is_active = 1')) { emailPassword($r); url_change('password_confirm.php'); } else { url_query_add(array('msg' => 'email-not-found', 'email' => $_POST['email'])); //bad email } } elseif (url_id()) { $_SESSION['user_id'] = false; db_query('UPDATE users SET password = NULL WHERE id = ' . $_GET['id'] . ' AND is_active = 1'); if ($email = db_grab('SELECT email FROM users WHERE id = ' . $_GET['id'] . ' AND is_active = 1')) { login($email, '', true); url_change($_SESSION['homepage']); } else { url_change(false); } } else { cookie('last_login'); $_SESSION['user_id'] = false; } echo drawSimpleTop(getString('password_reset')); if (@$_GET['msg'] == 'email-not-found') { echo drawMessage(getString('login_password_reset_msg_email_not_found')); } else { echo drawMessage(getString('login_password_reset_msg')); } $form = new form('login', false, getString('password_reset')); $form->set_field(array('name' => 'email', 'label' => getString('email'), 'type' => 'text', 'value' => @$_GET['email'])); echo $form->draw(); echo drawSimpleBottom();
<?php $pageIsPublic = true; include "../include.php"; echo drawSimpleTop(getString('login_account_confirm')); echo drawMessage(getString('login_account_confirm_msg')); echo drawSimpleBottom();
function bbDrawTopic($id, $email = false) { global $_josh, $page; if (!($r = db_grab('SELECT t.title' . langExt() . ' title, t.description' . langExt() . ' description, t.created_date, t.is_admin, t.type_id, y.title' . langExt() . ' type, u.id created_user, ISNULL(u.nickname, u.firstname) firstname, u.lastname, ' . db_updated('u') . ' FROM bb_topics t JOIN users u ON t.created_user = u.id LEFT JOIN bb_topics_types y ON t.type_id = y.id WHERE t.id = ' . $id))) { return false; } $return = ''; if ($r['is_admin'] == 1) { $return .= drawMessage(getString('topic_admin')); } $options = ($page['is_admin'] || user() == $r['created_user']) && !$email ? array('edit.php?id=' . $id => getString('edit'), 'javascript:checkDelete();' => getString('delete')) : false; //display topic thread $d = new display($page['breadcrumbs'] . $r['title'], false, $options, 'thread'); //if categories if (getOption('bb_types') && $r['type']) { $r['description'] .= draw_div_class('light', getString('category') . ': ' . draw_link('category.php?id=' . $r['type_id'], $r['type'])); } //channels if (getOption('channels') && ($channels = db_array('SELECT c.title' . langExt() . ' title FROM channels c JOIN bb_topics_to_channels t2c ON c.id = t2c.channel_id WHERE t2c.topic_id = ' . $id . ' ORDER BY title' . langExt()))) { $r['description'] .= draw_div_class('light', 'Networks: ' . implode(', ', $channels)); } $d->row(drawName($r['created_user'], $r['firstname'] . ' ' . $r['lastname'], $r['created_date'], true, BR, $r['updated']), '<h1>' . $r['title'] . '</h1>' . $r['description']); //append followups if ($r['is_admin']) { $return .= $d->draw(); } else { $followups = db_table('SELECT f.description' . langExt() . ' description, ISNULL(u.nickname, u.firstname) firstname, u.lastname, f.created_date, f.created_user, ' . db_updated('u') . ' FROM bb_followups f JOIN users u ON u.id = f.created_user WHERE f.is_active = 1 AND f.topic_id = ' . $id . ' ORDER BY f.created_date'); foreach ($followups as $f) { $d->row(drawName($f['created_user'], $f['firstname'] . ' ' . $f['lastname'], $f['created_date'], true, BR, $f['updated']), $f['description']); } $return .= $d->draw(); if (!$email) { //add a followup form $f = new form('bb_followups', false, getString('add_followup')); $f->unset_fields('topic_id'); langUnsetFields($f, 'description'); $return .= $f->draw(false, false); } } return $return; }