Example #1
0
 function pmSend($post, $suid = MEMBER_ID, $susername = MEMBER_NAME, $snickname = MEMBER_NICKNAME)
 {
     if (jaccess('pm', 'send', $suid) == false) {
         return 6;
     }
     $to_user_list = array();
     $f_rets = filter($post['message']);
     if ($f_rets) {
         if ($f_rets['error']) {
             return $f_rets['msg'];
         }
     }
     $post['subject'] = jhtmlspecialchars(trim($post['subject']));
     $p_to_user = $post['to_user'];
     if (empty($p_to_user)) {
         return 2;
     }
     $this->_process_content($post['message']);
     if ($post['message'] == '') {
         return 1;
     }
     $p_to_user = (array) $p_to_user;
     $nks = array();
     foreach ($p_to_user as $tmps) {
         $tmps = (string) $tmps;
         if (false !== strpos($tmps, ',')) {
             $_tmps = explode(',', $tmps);
             foreach ($_tmps as $_tmp) {
                 $nk = addslashes($_tmp);
                 $nks[$nk] = $nk;
             }
         } else {
             $nk = addslashes($tmps);
             $nks[$nk] = $nk;
         }
     }
     $sql = "\r\n\t\tSELECT\r\n\t\t\t`uid`,`username`,`nickname`,`notice_pm`,`email`,`email_checked`,`newpm`,`at_new`,`event_new`,`fans_new`,`vote_new`,`qun_new`,`dig_new`,`channel_new`,`company_new`,`comment_new`,`user_notice_time`,`lastactivity`\r\n\t\tFROM\r\n\t\t\t" . TABLE_PREFIX . 'members' . "\r\n\t\tWHERE `nickname` IN (" . jimplode($nks) . ") ORDER BY `uid` limit 100";
     $query = $this->DatabaseHandler->Query($sql);
     $to_uids = array();
     while ($row = $query->GetRow()) {
         if ($suid == MEMBER_ID) {
             if (is_blacklist($suid, $row['uid'])) {
                 return '你在' . $row['nickname'] . '的黑名单中,不被允许发私信';
             }
         }
         $rets = jsg_role_check_allow('sendpm', $row['uid'], $suid);
         if ($rets && $rets['error']) {
             return $rets['error'];
         } else {
             $to_user_list[$row['uid']] = $row;
             $to_uids[$row['uid']] = $row['uid'];
         }
     }
     ios_push_msg($to_uids, '你有新消息:1条私信');
     if ($to_user_list == false) {
         return 3;
     }
     $time = time();
     foreach ($to_user_list as $to_user_id => $to_user_name) {
         $data = array("msgfrom" => $susername, "msgnickname" => $snickname, "msgfromid" => $suid, "msgto" => $to_user_name['username'], "tonickname" => $to_user_name['nickname'], "msgtoid" => $to_user_id, 'imageids' => $post['imageids'], 'attachids' => $post['attachids'], "subject" => $post['subject'], "message" => $post['message'], "new" => '1', "dateline" => $time);
         if ($post["save_to_outbox"]) {
             $data['folder'] = "outbox";
             $msg = "消息已经保存草稿箱";
         }
         $uids = '';
         if ($suid > $to_user_id) {
             $uids = $to_user_id . "," . $suid;
         } else {
             $uids = $suid . "," . $to_user_id;
         }
         $plid = 0;
         if (!$msg) {
             $lastmessage = addslashes(serialize($data));
             $plid = DB::result_first("select plid from " . TABLE_PREFIX . "pms_index where uids = '{$uids}'");
             if ($plid == 0) {
                 DB::query("insert into " . TABLE_PREFIX . "pms_index (uids) values('{$uids}')");
                 $plid = $this->DatabaseHandler->Insert_ID();
                 if (0 != $plid) {
                     DB::query("insert into " . TABLE_PREFIX . "pms_list (plid,uid,pmnum,dateline,lastmessage) values('{$plid}','" . $suid . "',1,'{$time}','{$lastmessage}')");
                     if ($suid != $to_user_id) {
                         DB::query("insert into " . TABLE_PREFIX . "pms_list (plid,uid,pmnum,dateline,lastmessage,is_new) values('{$plid}','{$to_user_id}',1,'{$time}','{$lastmessage}',1)");
                     }
                 }
             } else {
                 DB::query("update " . TABLE_PREFIX . "pms_list set pmnum = pmnum + 1,dateline = '{$time}',lastmessage = '{$lastmessage}',is_new = 1 where plid = '{$plid}' and uid = '{$to_user_id}' ");
                 if ($suid != $to_user_id) {
                     DB::query("update " . TABLE_PREFIX . "pms_list set pmnum = pmnum + 1,dateline = '{$time}',lastmessage = '{$lastmessage}',is_new = 0 where plid = '{$plid}'  and uid = '{$suid}' ");
                 }
             }
         }
         $data['plid'] = $plid;
         DB::insert('pms', $data);
     }
     #标记音乐和附件,使清缓存的时候不会把附件删除
     if ($data['imageids']) {
         DB::query("update `" . TABLE_PREFIX . "topic_image` set `tid` = -1 where `id` in ({$data['imageids']})");
     }
     if ($data['attachids']) {
         DB::query("update `" . TABLE_PREFIX . "topic_attach` set `tid` = -1 where `id` in ({$data['attachids']})");
     }
     $num = $post["save_to_outbox"] ? 0 : 1;
     if ($num > 0) {
         $_tmps = array_keys($to_user_list);
         $to_user_id_list = array();
         foreach ($_tmps as $_tmp) {
             $_tmp = (int) $_tmp;
             if ($_tmp > 0) {
                 $to_user_id_list[$_tmp] = $_tmp;
             }
         }
         $this->UpdateNewMsgCount($num, $to_user_id_list);
         foreach ($to_user_list as $user_notice) {
             if ($GLOBALS['_J']['config']['sendmailday'] > 0) {
                 jtable('mailqueue')->add($user_notice, 'notice_pm');
             }
             if ($GLOBALS['_J']['config']['imjiqiren_enable'] && imjiqiren_init()) {
                 imjiqiren_send_message($user_notice, 'm', $GLOBALS['_J']['config']);
             }
             if ($GLOBALS['_J']['config']['sms_enable'] && sms_init()) {
                 sms_send_message($user_notice, 'm', $GLOBALS['_J']['config']);
             }
         }
         if ($GLOBALS['_J']['config']['extcredits_enable'] && $suid > 0) {
             update_credits_by_action('pm', $suid, count($to_user_list));
         }
     }
     if (!$post['is_pm_to_admin_notice']) {
         $this->to_admin_notice($to_uids);
     }
     return 0;
 }
                echo $eid;
                ?>
',<?php 
                echo $allow_attach;
                ?>
);return false;" style="cursor:pointer;">编辑</a> <?php 
            }
            ?>
 <?php 
        }
        ?>
 <?php 
    }
    ?>
 <?php 
    if (true === jaccess('topic', 'do_recd')) {
        ?>
 <a href="javascript:void(0)" onclick="showTopicRecdDialog({'tid':'<?php 
        echo $val['tid'];
        ?>
'});return false;">推荐</a> <?php 
    }
    ?>
 <span 
<?php 
    if (MEMBER_ID < 1) {
        ?>
onclick="ShowLoginDialog();" 
<?php 
    }
    ?>
 checked="checked" <?php 
    }
    ?>
 />是</label> &nbsp; <label for="tojishigou_0"><input name="tojishigou" id="tojishigou_0" type="radio" value="0" <?php 
    if ($tojishigou == 0) {
        ?>
 checked="checked" <?php 
    }
    ?>
 />否</label></div>
        </div>
        <?php 
}
?>
        <?php 
if (XWB_plugin::pCfg('is_syncreply_tojishigou') && jaccess('xwb', '__syncreply')) {
    ?>
        <h3>读取新浪微博的评论内容到本站?</h3>
        <div class="radio-box">
        <div class="radio"><label for="reply_tojishigou_1"><input name="reply_tojishigou" id="reply_tojishigou_1" type="radio" value="1" <?php 
    if ($reply_tojishigou == 1) {
        ?>
 checked="checked" <?php 
    }
    ?>
 />是</label> &nbsp; <label for="reply_tojishigou_0"><input name="reply_tojishigou" id="reply_tojishigou_0" type="radio" value="0" <?php 
    if ($reply_tojishigou == 0) {
        ?>
 checked="checked" <?php 
    }
    ?>
Example #4
0
                                        echo $eid;
                                        ?>
',<?php 
                                        echo $allow_attach;
                                        ?>
);return false;" style="cursor:pointer;">编辑</a> <?php 
                                    }
                                    ?>
 <?php 
                                }
                                ?>
 <?php 
                            }
                            ?>
 <?php 
                            if (true === jaccess('topic', 'do_recd') || $val['ismanager']) {
                                ?>
 <a href="javascript:;" onclick="showTopicRecdDialog({'tid':'<?php 
                                echo $val['tid'];
                                ?>
','tag_id':'<?php 
                                echo $tag_id;
                                ?>
'});return false;">推荐</a> <?php 
                            }
                            ?>
 <?php 
                            if ('admin' == MEMBER_ROLE_TYPE) {
                                ?>
 <a onclick="force_out(<?php 
                                echo $val['uid'];
Example #5
0
function sina_weibo_bind_icon($uid = 0)
{
    $return = '';
    $uid = max(0, (int) ($uid ? $uid : MEMBER_ID));
    if ($uid > 0 && ($sys_config = sina_weibo_enable())) {
        $return = "<img src='{$sys_config['site_url']}/images/xwb/bgimg/sinawebo_off.gif' alt='未绑定新浪微博' />";
        if (sina_weibo_bind($uid, !rand(0, 10))) {
            $return = "<img src='{$sys_config['site_url']}/images/xwb/bgimg/sinawebo_on.gif' alt='已经绑定新浪微博' />";
            if ($sys_config['sina']['is_synctopic_tojishigou'] && sina_weibo_synctopic_tojishigou($uid)) {
                $_read_now = true;
                if ($sys_config['sina']['syncweibo_tojishigou_time'] > 0) {
                    $xwb_bind_info = sina_weibo_bind_info($uid);
                    if ($xwb_bind_info['last_read_time'] + $sys_config['sina']['syncweibo_tojishigou_time'] > time()) {
                        $_read_now = false;
                    }
                }
                if ($_read_now && !jaccess('xwb', '__synctopic', $uid)) {
                    $_read_now = false;
                }
                if ($_read_now) {
                    $return .= "<img src='{$sys_config['site_url']}/index.php?mod=xwb&code=synctopic&uid={$uid}' width='0' height='0' style='display:none' />";
                }
            }
            if ($sys_config['sina']['is_syncreply_tojishigou'] && is_numeric($_GET['code']) && sina_weibo_syncreply_tojishigou($uid) && ($xwb_bind_topic = sina_weibo_bind_topic($_GET['code'])) && ($topic_info = DB::fetch_first("select * from " . TABLE_PREFIX . "topic where `tid`='{$_GET['code']}'"))) {
                $_read_now = true;
                if ($sys_config['sina']['syncweibo_tojishigou_time'] > 0) {
                    if ($xwb_bind_topic['last_read_time'] + $sys_config['sina']['syncweibo_tojishigou_time'] > time()) {
                        $_read_now = false;
                    }
                }
                if ($_read_now && !jaccess('xwb', '__syncreply', $topic_info['uid'])) {
                    $_read_now = false;
                }
                if ($_read_now) {
                    $return .= "<img src='{$sys_config['site_url']}/index.php?mod=xwb&code=syncreply&tid={$_GET['code']}' width='0' height='0' style='display:none' />";
                }
            }
        }
        if (MEMBER_ID > 0) {
            $return = "<a href='#' title='新浪微博绑定设置' onclick=\"window.location.href='{$sys_config['site_url']}/index.php?mod=account&code=sina';return false;\">{$return}</a>";
        }
    }
    return $return;
}