Пример #1
0
function removeContact($from, $network = 1)
{
    global $aNotifyUser;
    if (is_array($aNotifyUser) && count($aNotifyUser) > 0) {
        $nw_name = getNetworkName($network);
        $now = strftime('%D %T');
        $fname = dirname($_SERVER['argv'][0]) . DIRECTORY_SEPARATOR . 'spool' . DIRECTORY_SEPARATOR . 'msn_' . getpid() . '_' . md5('delete' . rand(1, 1000) . $now) . '.msn';
        $fp = fopen($fname, 'wt');
        if ($fp) {
            $list = '';
            foreach ($aNotifyUser as $user) {
                if ($list === '') {
                    $list = $user;
                } else {
                    $list .= ',' . $user;
                }
            }
            fputs($fp, "TO: {$list}\n");
            fputs($fp, "Now: {$now}\n{$from} (network: {$nw_name}) remove me from his contact list!");
            fclose($fp);
            chmod($fname, 0666);
        }
    }
    return;
}
Пример #2
0
function getUserNetwork($userId)
{
    $dao = D("UserWorks");
    $list = $dao->find("userId='{$userId}'", 'networkId');
    $networkId = getNetworkName($list->networkId);
    return $networkId;
}