コード例 #1
0
ファイル: contact.php プロジェクト: Rhenan/intranet-1
		c.title,
		c.address_1,
		c.address_2,
		RIGHT("00000" + RTRIM(c.zip), 5) zip,
		c.phone,
		c.fax,
		c.mobile_phone,
		c.email,
		z.city,
		z.state,
		c.notes
	FROM contacts c
	LEFT JOIN zip_codes z ON c.zip = z.zip
	WHERE c.id = ' . $_GET['id']);
$d = new display();
$d->row('Name', $r['salutation'] . ' ' . $r['firstname'] . ' ' . $r['lastname'] . ($r['suffix'] ? ', ' . $r['suffix'] : ''));
$d->row('Company', $r['organization']);
$d->row('Job Title', $r['title']);
$d->row('Address', $r['address_1'] . ($r['address_2'] ? BR . $r['address_2'] : false) . BR . $r['city'] . ', ' . $r['state'] . ' ' . $r['zip']);
$d->row('Phone', $r['phone']);
$d->row('Fax', $r['fax']);
$d->row('Mobile', $r['mobile_phone']);
$d->row('Email', draw_link('mailto:' . $r['email']));
$d->row('Notes', nl2br($r['notes']));
echo $d->draw();
$result = db_table('SELECT t.id, t.tag, y.title "group" FROM contacts_to_tags c2t JOIN contacts_tags t ON c2t.tag_id = t.id JOIN contacts_tags_types y ON t.type_id = y.id WHERE c2t.contact_id = ' . $_GET['id']);
$t = new table('contacts_tags');
$t->set_column('tag');
foreach ($result as &$r) {
    $r['tag'] = draw_link('value.php?id=' . $r['id'], $r['tag']);
}
コード例 #2
0
ファイル: include.php プロジェクト: Rhenan/intranet-1
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__);
    }
}
コード例 #3
0
ファイル: include.php プロジェクト: Rhenan/intranet-1
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;
}