core

Changeset 24893

Show
Ignore:
Timestamp:
11/20/08 20:29:20 (7 weeks ago)
Author:
Landseer
Message:

added InterCom? detection, this fixes #397 (part one for 1.1.0)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • development/zikula-1/system/Theme/plugins/function.pncountnewmessages.php

    r24342 r24893  
    3232    unset($params); 
    3333 
    34     $newmessages = 0; 
     34    $unread = 0; 
    3535    if (pnUserLoggedIn()) { 
    36         if (pnModAvailable('Messages'))    { 
    37             $dbconn = pnDBGetConn(true); 
    38             $pntable = pnDBGetTables(); 
    39             $column = &$pntable['priv_msgs_column']; 
    40             // get unread messages 
    41             $result = $dbconn->Execute("SELECT count(*) FROM $pntable[priv_msgs] WHERE $column[to_userid]='" . DataUtil::formatForStore(pnUserGetVar('uid')) . "' AND $column[read_msg]='0'"); 
    42             list($newmessages) = $result->fields;  // new messages 
    43             $result->Close(); 
     36        if (pnModAvailable('pnMessages')) { 
     37            $messages = pnModAPIFunc('pnMessages', 'user', 'getmessagecount'); 
     38            $unread = $messages['unread']; 
     39        } else if (pnModAvailable('InterCom')) { 
     40            $messages = pnModAPIFunc('InterCom', 'user', 'getmessagecount'); 
     41            $unread = $messages['unread']; 
    4442        } 
    4543    } 
    4644 
    4745    if (isset($assign)) { 
    48         $smarty->assign($assign, $newmessages); 
     46        $smarty->assign($assign, $unread); 
    4947    } else { 
    50         return $newmessages; 
     48        return $unread; 
    5149    } 
    5250} 
 
 
Powered by Trac
Design by Arcsin