56 if (isset(self::$global_mail_services_cache[self::CACHE_TYPE_REF_ID]) &&
57 null !== self::$global_mail_services_cache[self::CACHE_TYPE_REF_ID]) {
58 return self::$global_mail_services_cache[self::CACHE_TYPE_REF_ID];
62 if (!MAIL_SETTINGS_ID) {
63 $res = $DIC->database()->queryF(
65 SELECT object_reference.ref_id FROM object_reference, tree, object_data 66 WHERE tree.parent = %s 67 AND object_data.type = %s 68 AND object_reference.ref_id = tree.child 69 AND object_reference.obj_id = object_data.obj_id',
70 array(
'integer',
'text'),
71 array(SYSTEM_FOLDER_ID,
'mail')
74 while (
$row = $DIC->database()->fetchAssoc(
$res)) {
75 self::$global_mail_services_cache[self::CACHE_TYPE_REF_ID] =
$row[
'ref_id'];
78 self::$global_mail_services_cache[self::CACHE_TYPE_REF_ID] = MAIL_SETTINGS_ID;
81 return self::$global_mail_services_cache[self::CACHE_TYPE_REF_ID];
103 isset(self::$global_mail_services_cache[self::CACHE_TYPE_NEW_MAILS][$usr_id]) &&
104 null !== self::$global_mail_services_cache[self::CACHE_TYPE_NEW_MAILS][$usr_id]) {
105 return self::$global_mail_services_cache[self::CACHE_TYPE_NEW_MAILS][$usr_id];
108 $res = $DIC->database()->queryF(
110 SELECT COUNT(mail_id) cnt FROM mail 114 array(
'integer',
'integer',
'text'),
115 array(
'0', $usr_id,
'unread')
118 $row = $DIC->database()->fetchAssoc(
$res);
120 $res = $DIC->database()->queryF(
122 SELECT COUNT(mail_id) cnt FROM mail m,mail_obj_data mo 123 WHERE m.user_id = mo.user_id 124 AND m.folder_id = mo.obj_id 127 AND m.m_status = %s',
128 array(
'text',
'integer',
'text'),
129 array(
'inbox', $usr_id,
'unread')
132 $row2 = $DIC->database()->fetchAssoc(
$res);
134 self::$global_mail_services_cache[self::CACHE_TYPE_NEW_MAILS][$usr_id] =
$row[
'cnt'] + $row2[
'cnt'];
135 return self::$global_mail_services_cache[self::CACHE_TYPE_NEW_MAILS][$usr_id];
Class for global mail information (e.g.
static $global_mail_services_cache
foreach($_POST as $key=> $value) $res
const CACHE_TYPE_NEW_MAILS
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable...
static getNumberOfNewMailsByUserId($usr_id)
Determines the number of new mails for the passed user id and stores this information in a local cach...