예제 #1
0
파일: submit.php 프로젝트: sany217/WeiXin
        $log_data = array("to_id" => td_trim(getusernamebyid($TO_ID_STR)), "to_wid" => td_trim($TO_WEBMAIL), "subject" => $SUBJECT, "content" => $CONTENT, "select" => $SECRET_LEVEL_DESC, "auitstr" => td_trim(getusernamebyid($Audit_STR)), "attachmentname" => $ATTACHMENT_NAME, "body_id" => $BODY_ID);
        $AuditLog = 80;
        if ($free_falg) {
            $AuditLog = 81;
        }
        addemailauditlog($AuditLog, $_SESSION['LOGIN_UID'], $log_data);
    }
    $query = "SELECT UID,EMAIL_RECENT_LINKMAN from USER_EXT where UID='" . $_SESSION['LOGIN_UID'] . "'";
    $cursor = exequery(TD::conn(), $query);
    if ($ROW = mysql_fetch_array($cursor)) {
        $UID_EXT = $ROW['UID'];
        $RECENT_LINKMAN = $ROW['EMAIL_RECENT_LINKMAN'];
    }
    $TO_ID_STR_ADD = "";
    $TO_ID_STR_RECENT = $TO_ID_STR . td_trim($RECENT_LINKMAN);
    $TO_ID_STR_RECENT_ARRAY = explode(",", td_trim($TO_ID_STR_RECENT));
    $TO_ID_STR_RECENT_COUNT = count($TO_ID_STR_RECENT_ARRAY);
    $I = 0;
    for (; $I < $TO_ID_STR_RECENT_COUNT; ++$I) {
        if (!find_id($TO_ID_STR_ADD, $TO_ID_STR_RECENT_ARRAY[$I])) {
            $TO_ID_STR_ADD .= $TO_ID_STR_RECENT_ARRAY[$I] . ",";
        }
    }
    if (isset($UID_EXT)) {
        $query = "update USER_EXT  set EMAIL_RECENT_LINKMAN='" . $TO_ID_STR_ADD . "' where UID='" . $_SESSION['LOGIN_UID'] . "'";
    } else {
        $query = "insert into USER_EXT  (UID,USER_ID,EMAIL_RECENT_LINKMAN) values ('" . $_SESSION['LOGIN_UID'] . "','" . $_SESSION['LOGIN_USER_ID'] . ("','" . $TO_ID_STR_ADD . "')");
    }
    exequery(TD::conn(), $query);
    echo $NEW_SMS_HTML;
}
예제 #2
0
파일: itask.php 프로젝트: sany217/WeiXin
function mobile_push_notification($uid_sent, $content, $module, $options = NULL)
{
    $org_content = $content;
    $PARA_ARRAY = get_sys_para("MOBILE_PUSH_OPTION,PCONLINE_MOBILE_PUSH", FALSE);
    while (list($PARA_NAME, $PARA_VALUE) = each(&$PARA_ARRAY)) {
        ${$PARA_NAME} = $PARA_VALUE;
    }
    if ($MOBILE_PUSH_OPTION == "1") {
        if ($uid_sent == "") {
            return;
        }
        if (substr($uid_sent, -1) != ",") {
            $uid_sent .= ",";
        }
        $module = strtolower($module);
        $mp_to_uids = td_trim($uid_sent);
        $a_uid_sent = $a_unpush_uid = array();
        $a_uid_sent = explode(",", $mp_to_uids);
        if ($PCONLINE_MOBILE_PUSH == "0") {
            $query = "select DISTINCT(UID) from user_online where UID in(" . $mp_to_uids . ") and CLIENT!=5 and CLIENT!=6";
            $cursor = exequery(TD::conn(), $query);
            while ($ROW = mysql_fetch_array($cursor)) {
                $a_unpush_uid[] = $ROW['UID'];
            }
            foreach ($a_uid_sent as $k => $v) {
                if (!($PCONLINE_MOBILE_PUSH == "0") && !is_array($a_unpush_uid) && !in_array($v, $a_unpush_uid)) {
                    unset($a_uid_sent[$k]);
                }
            }
            $a_uid_sent = array_filter($a_uid_sent);
            $uid_sent = implode(",", $a_uid_sent);
            $uid_sent .= ",";
        }
        if ($module == "message") {
            include_once "task/message_push/funcs.php";
            $C_MOBILE_DEVICES = TD::get_cache("C_MOBILE_DEVICES");
            if ($C_MOBILE_DEVICES === FALSE) {
                rebuildmobilecache();
                $C_MOBILE_DEVICES = TD::get_cache("C_MOBILE_DEVICES");
            }
            if ($C_MOBILE_DEVICES && 0 < count($C_MOBILE_DEVICES)) {
                $M_STA = $M_ENT = array();
                foreach ($a_uid_sent as $k => $v) {
                    if ($C_MOBILE_DEVICES[$v]) {
                        if ($C_MOBILE_DEVICES[$v]['client_ver'] == 1) {
                            $M_STA[$v][] = array("content" => $content, "module" => "message");
                        } else {
                            if ($C_MOBILE_DEVICES[$v]['client_ver'] == 2) {
                                $M_ENT[$v][] = array("content" => $content, "module" => "message");
                            }
                        }
                    }
                }
            }
            tdmobilepush(array("sta" => $M_STA, "ent" => $M_ENT));
        }
        $content = $org_content = strip_tags($content);
        if (strtolower(MYOA_CHARSET) != "utf-8") {
            $content = td_iconv($content, MYOA_CHARSET, "UTF-8");
        }
        imtask("C^m^n^" . $uid_sent . "^" . $module . "^" . $content);
        if (!$MYOA_WEIXINQY_PUSH_ACTIVE) {
            $useble_module = array("email", "news", "notify");
            if (!in_array($module, $useble_module)) {
                $uid_sents = td_trim($uid_sent);
                $query = "SELECT USER_ID FROM USER WHERE UID IN (" . $uid_sents . ")";
                $cursor = exequery(TD::conn(), $query);
                while ($ROW = mysql_fetch_array($cursor)) {
                    $user_id_arr[] = $ROW['USER_ID'];
                }
                wxqy_sms(array("user" => $user_id_arr, "module" => $module, "content" => $org_content));
            }
        }
    }
}