Skip to content

Commit

Permalink
Fixes time issue
Browse files Browse the repository at this point in the history
Not sure why that worked for me, maybe my server's time is GMT?
  • Loading branch information
clonemeagain committed Nov 10, 2017
1 parent fb84fc6 commit 691c680
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions slack.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function sendToSlack(Ticket $ticket, $heading, $body, $colour = 'good') {
'color' => $colour,
'title' => $ticket->getSubject(),
'title_link' => $cfg->getBaseUrl() . 'scp/tickets.php?id=' . $ticket->getId(),
'ts' => Misc::gmtime(),
'ts' => time(),
'footer' => 'via osTicket Slack Plugin',
'footer_icon' => 'https://platform.slack-edge.com/img/default_application_icon.png',
'text' => $body,
Expand Down Expand Up @@ -190,7 +190,6 @@ function sendToSlack(Ticket $ticket, $heading, $body, $colour = 'good') {
];
}


// Format the payload:
$data_string = utf8_encode(json_encode($payload));

Expand Down Expand Up @@ -267,4 +266,29 @@ function format_text($text) {
return substr(str_replace(array_keys($moreformatter), array_values($moreformatter), $formatted_text), 0, 500);
}

/**
* Get either a Gravatar URL or complete image tag for a specified email address.
*
* @param string $email The email address
* @param string $s Size in pixels, defaults to 80px [ 1 - 2048 ]
* @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
* @param string $r Maximum rating (inclusive) [ g | pg | r | x ]
* @param boole $img True to return a complete IMG tag False for just the URL
* @param array $atts Optional, additional key/value attributes to include in the IMG tag
* @return String containing either just a URL or a complete image tag
* @source https://gravatar.com/site/implement/images/php/
*/
function get_gravatar($email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array()) {
$url = 'https://www.gravatar.com/avatar/';
$url .= md5(strtolower(trim($email)));
$url .= "?s=$s&d=$d&r=$r";
if ($img) {
$url = '<img src="' . $url . '"';
foreach ($atts as $key => $val)
$url .= ' ' . $key . '="' . $val . '"';
$url .= ' />';
}
return $url;
}

}

0 comments on commit 691c680

Please sign in to comment.