Bootswatch, Summernote, and Captcheck mods for Mods for HESK (mods-for-hesk.com). In use at support.netsyms.com.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.0KB

  1. <?php
  2. function mfh_get_mail_headers_for_dropdown($user_id, $hesk_settings, $hesklang) {
  3. $deleted_user_text = hesk_dbEscape($hesklang['deleted_user_title_case']);
  4. $sql = "SELECT `mail`.`id` AS `id`, `mail`.`subject` AS `subject`,
  5. `users`.`name` AS `from`, `mail`.`dt` AS `date`, `mail`.`from` AS `from_id`
  6. FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mail` AS `mail`
  7. LEFT JOIN `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` AS `users`
  8. ON `mail`.`from` = `users`.`id`
  9. WHERE `to` = " . hesk_dbEscape($user_id) . "
  10. AND `read` = '0'
  11. ORDER BY `mail`.`dt` DESC";
  12. $rs = hesk_dbQuery($sql);
  13. $mails = array();
  14. while ($row = hesk_dbFetchAssoc($rs)) {
  15. if ($row['from'] == null) {
  16. if ($row['from_id'] == 9999) {
  17. $row['from'] = 'HESK.com';
  18. } else {
  19. $row['from'] = $deleted_user_text;
  20. }
  21. }
  22. $mails[] = $row;
  23. }
  24. return $mails;
  25. }