Exemplo n.º 1
0
function item_topic_from($topic)
{
    $topic['item_id'] = (int) $topic['item_id'];
    if ($topic['item_id'] > 0) {
        #if NEDU
        if (defined('NEDU_MOYO')) {
            $r = nlogic('feeds.app.jsg')->topic_from($topic['item'], $topic['item_id']);
            if ($r && is_array($r)) {
                return array_merge($topic, $r);
            }
        }
        #endif
        $func = "_item_topic_from_{$topic['item']}";
        if (function_exists($func)) {
            return $func($topic);
        }
    }
    return $topic;
}
Exemplo n.º 2
0
    }
    ?>
 <?php 
    if ($__my['fenlei_post_new'] > 0) {
        ?>
 <li>分类新增<?php 
        echo $__my['fenlei_post_new'];
        ?>
个信息,<a href="index.php?mod=topic&code=other&view=fenlei">查看</a></li> <?php 
    }
    ?>
 <?php 
    if (defined('NEDU_MOYO')) {
        ?>
 <?php 
        echo nlogic('notify')->ups_tips_html();
        ?>
 <?php 
    }
    ?>
 </ul> </div> <div class="tagBox_del"><a href="javascript:tagBox_close();" title="关闭" javascript:void(0)><img src="static/image/imgdel.gif" /></a></div> </div> <?php 
}
?>
 <div class="changeTheme"><a href="index.php?mod=skin" title="更换皮肤" javascript:void(0)></a></div> </div> </div> <?php 
if ($this->Config['company_enable']) {
    ?>
 <?php 
    $d_c_name = $this->Config['default_company'] ? $this->Config['default_company'] : '单位';
    $d_d_name = $this->Config['default_department'] ? $this->Config['default_department'] : '部门';
    $d_j_name = $this->Config['default_job'] ? $this->Config['default_job'] : '岗位';
    ?>
Exemplo n.º 3
0
 function eventDetail()
 {
     $id = intval($this->Get['id']);
     load::logic('event');
     $EventLogic = new EventLogic();
     $param = array('where' => " a.id = '{$id}' ");
     $return = $EventLogic->getEventInfo($param);
     $rs = $return['event_list'][$id];
     if (!$rs) {
         $this->Messager("活动不存在或已删除", -1);
     }
     if (!$rs['verify'] || $rs['verify'] == 0) {
         if ($rs['postman'] != MEMBER_ID) {
             $this->Messager("活动还在审核中", -1);
         }
     }
     $from = array();
     if ($rs['item'] == 'qun' && $rs['item_id'] > 0) {
         load::logic('qun');
         $qun_logic = new QunLogic();
         $qunInfo = $qun_logic->get_qun_info($rs['item_id']);
         $rs['qunname'] = $qunInfo['name'];
         $from['name'] = $this->Config[changeword][weiqun] . '--' . $rs['qunname'];
         $from['url'] = get_full_url('', 'index.php?mod=qun&qid=' . $rs['item_id']);
     } else {
         #if NEDU
         if (defined('NEDU_MOYO')) {
             if ($rs['item'] && $rs['item_id']) {
                 $app = nlogic('com.object')->get_info($rs['item'], $rs['item_id']);
                 if ($app) {
                     $from = array('name' => $app['object_name'], 'url' => $app['object_url']);
                 }
             }
         }
         #endif
     }
     $app_member_arr = $EventLogic->getAllUser(array('where' => " a.id = '{$id}' and a.app = 1 and a.play = 0 ", 'order' => " order by a.app_time ", 'limit' => " limit 6 "), 'app');
     $app_count = $app_member_arr['count'];
     $app_member = $app_member_arr['member'];
     $play_member_arr = $EventLogic->getAllUser(array('where' => " a.id = '{$id}' and a.play = 1  ", 'order' => " order by a.play_time ", 'limit' => " limit 6 "), 'play');
     $play_count = $play_member_arr['count'];
     $play_member = $play_member_arr['member'];
     $member = $this->Member;
     if ($member['medal_id']) {
         $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']);
     }
     jfunc('app');
     $gets = array('mod' => 'event', 'code' => "detail", 'id' => $id);
     $page_url = 'index.php?' . url_implode($gets);
     $options = array('page' => true, 'perpage' => 5, 'page_url' => $page_url);
     $topic_info = app_get_topic_list('event', $id, $options);
     $topic_list = array();
     if (!empty($topic_info)) {
         $topic_list = $topic_info['list'];
         $page_arr['html'] = $topic_info['page']['html'];
         $no_from = true;
     }
     $this->item = 'event';
     $this->item_id = $id;
     $set_qun_closed = 1;
     $set_event_closed = 1;
     $set_fenlei_closed = 1;
     $this->Title = $rs['title'];
     include template('event/event_dateil');
 }
Exemplo n.º 4
0
function app_add_relation($param)
{
    $item = $param['item'];
    #if NEDU
    if (defined('NEDU_MOYO')) {
        $r = nlogic('feeds.app.jsg')->make_relation($item, $param);
        if ($r) {
            return;
        }
    }
    #endif
    $table_name = app_table($item);
    if (!$table_name) {
        return;
    }
    $data = array('item_id' => $param['item_id'], 'tid' => $param['tid'], 'uid' => $param['uid']);
    if ($item == 'talk') {
        $data['totid'] = $param['totid'];
        $data['touid'] = $param['touid'];
    }
    DB::insert($table_name, $data);
    if ($item == 'qun') {
        DB::query("UPDATE " . DB::table('qun') . " SET thread_num=thread_num+1,lastactivity = '" . time() . "' WHERE qid='{$param['item_id']}'");
    }
    if ($item == 'talk') {
        if (!$data['totid'] && !$data['touid']) {
            DB::query("UPDATE " . DB::table($table_name) . " SET istop=1 WHERE tid='{$param['tid']}'");
        }
        if ($data['totid'] > 0 && $data['touid'] > 0) {
            DB::query("UPDATE " . DB::table($table_name) . " SET istop=1 WHERE tid='{$param['totid']}'");
            DB::query("UPDATE " . DB::table('topic') . " SET lastupdate=" . time() . " WHERE tid='{$param['totid']}'");
        }
    }
    if ($item == 'channel') {
        DB::query("UPDATE " . DB::table('channel') . " SET topic_num=topic_num+1,total_topic_num=total_topic_num+1 WHERE ch_id='{$param['item_id']}'");
        $p_id = DB::result_first("SELECT parent_id FROM " . DB::table('channel') . " WHERE ch_id='{$param['item_id']}'");
        if ($p_id > 0) {
            DB::query("UPDATE " . DB::table('channel') . " SET total_topic_num=total_topic_num+1 WHERE ch_id='{$p_id}'");
        }
    }
}
Exemplo n.º 5
0
    function Add($datas, $totid = 0, $imageid = 0, $attachid = 0, $from = 'web', $type = "first", $uid = 0, $item = '', $item_id = 0, $from_queue = false)
    {
        if ($GLOBALS['_J']['config']['wqueue_enabled'] && !$from_queue) {
            isset($datas['content']) && ($datas['content'] = base64_encode($datas['content']));
            $wq_data = array('datas' => $datas, 'totid' => $totid, 'imageid' => $imageid, 'attachid' => $attachid, 'from' => $from, 'type' => $type, 'uid' => $uid ? $uid : (isset($datas['uid']) ? $datas['uid'] : MEMBER_ID), 'item' => $item ? $item : (isset($datas['item']) ? $datas['item'] : ''), 'item_id' => $item_id ? $item_id : (isset($datas['item_id']) ? $datas['item_id'] : 0));
            $wq_ds = base64_encode(serialize($wq_data));
            $wq_url = 'http:/' . '/' . $GLOBALS['_J']['config']['wqueue']['host'] . '/?name=' . $GLOBALS['_J']['config']['wqueue']['name'] . '&opt=put&auth=' . $GLOBALS['_J']['config']['wqueue']['auth'] . '&data=' . $wq_ds;
            $wq_r = dfopen($wq_url);
            if (strstr($wq_r, 'HTTPSQS_PUT_OK')) {
                return array();
            }
        } elseif ($from_queue) {
        }
        if (is_array($datas) && count($datas)) {
            $ks = array('tid' => 1, 'uid' => 1, 'content' => 1, 'imageid' => 1, 'attachid' => 1, 'videoid' => 1, 'musicid' => 1, 'longtextid' => 1, 'totid' => 1, 'touid' => 1, 'dateline' => 1, 'from' => 1, 'type' => 1, 'item_id' => 1, 'item' => 1, 'postip' => 1, 'timestamp' => 1, 'managetype' => 1, 'checkfilter' => 1, 'verify' => 1, 'design' => 1, 'xiami_id' => 1, 'is_reward' => 1);
            foreach ($datas as $k => $v) {
                if (isset($ks[$k])) {
                    ${$k} = $v;
                }
            }
            $pverify = $datas['pverify'];
        } else {
            $content = $datas;
        }
        $is_verify = $pverify || $GLOBALS['_J']['config']['verify'] ? true : false;
        $content = $this->_content_strip($content);
        $content_length = strlen($content);
        if ($content_length < 2) {
            return "内容不允许为空";
        }
        if ($this->_len2 > 0 && $content_length > $this->_len2) {
            $content = cut_str($content, $this->_len2, '');
        }
        if (!$checkfilter) {
            $f_rets = filter($content);
            if ($f_rets) {
                if ($f_rets['verify']) {
                    $is_verify = true;
                } elseif ($f_rets['error']) {
                    return $f_rets['msg'];
                }
            }
        } else {
            if ($is_verify && 'verify' == $verify && true === IN_JISHIGOU_ADMIN) {
                $is_verify = false;
            }
        }
        $totid = max(0, (int) $totid);
        $data = array();
        if ($managetype) {
            $data['managetype'] = $managetype;
        }
        $is_new = 1;
        if ($tid) {
            $is_new = 0;
            $data['tid'] = $tid;
        }
        $parents = '';
        $_froms = array('web' => 1, 'wap' => 1, 'mobile' => 1, 'sms' => 1, 'qq' => 1, 'msn' => 1, 'api' => 1, 'sina' => 1, 'qqwb' => 1, 'vote' => 1, 'qun' => 1, 'wechat' => 1, 'fenlei' => 1, 'event' => 1, 'android' => 1, 'iphone' => 1, 'ipad' => 1, 'pad' => 1, 'androidpad' => 1, 'reward' => 1);
        $from = $from && $_froms[$from] ? $from : 'web';
        if (empty($item) || $item_id < 0) {
            if (!is_numeric($type)) {
                $_types = array('first' => 1, 'forward' => 1, 'reply' => 1, 'both' => 1);
                $type = $totid < 1 && $type && isset($_types[$type]) ? 'first' : $type;
                if (empty($type)) {
                    $type = 'first';
                }
            }
        }
        $data['from'] = $from;
        if (($type == 'forward' || $type == 'both') && $item == 'qun') {
            $data['type'] = $item;
        } else {
            $data['type'] = $type;
        }
        if ($item == 'channel' && $item_id > 0) {
            $channeldata = jlogic('channel')->id2category($item_id);
            if ($channeldata) {
                if ($channeldata['purpostview']) {
                    $data['type'] = 'channel';
                }
                if ($channeldata['topictype']) {
                    $data['managetype'] = $channeldata['topictype'];
                }
                unset($channeldata);
            }
        }
        $data['uid'] = $uid = max(0, (int) ($uid ? $uid : MEMBER_ID));
        $data['videoid'] = $videoid = max(0, (int) $videoid);
        $data['longtextid'] = $longtextid = max(0, (int) $longtextid);
        $timestamp = (int) ($timestamp ? $timestamp : $dateline);
        $data['dateline'] = $data['lastupdate'] = $timestamp = $dateline = $timestamp > 0 ? $timestamp : TIMESTAMP;
        $data['totid'] = $totid;
        $data['touid'] = $touid;
        $data['anonymous'] = $GLOBALS['_J']['config']['anonymous_enable'] ? $datas['anonymous'] : 0;
        $data['item'] = $item;
        $data['item_id'] = $item_id;
        $member = $this->GetMember($data['uid']);
        if (!$member) {
            return "用户不存在";
        }
        if ($item == 'qun' && $item_id > 0) {
            $qun_closed = DB::result_first("SELECT closed FROM " . DB::table('qun') . " WHERE qid='{$item_id}'");
            if ($qun_closed) {
                return "当前" . $GLOBALS['_J']['config']['changeword']['weiqun'] . "已经关闭,你无法发布内容";
            }
            $r = $this->is_qun_member($item_id, $uid);
            if (!$r) {
                return "你没有权限进行当前操作";
            }
        }
        if ($item == 'channel' && $item_id > 0) {
            $can_pub_topic = jlogic('channel')->can_pub_topic($item_id);
            if (!$can_pub_topic) {
                return "你没有权限进行当前操作";
            }
        }
        if ($item == 'company' && $item_id > 0) {
            if ($GLOBALS['_J']['config']['company_enable']) {
                $my_companyid = $GLOBALS['_J']['member']['companyid'];
                $can_pub_cp_topic = false;
                if ($item_id == $my_companyid) {
                    $can_pub_cp_topic = true;
                } elseif (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $member['companyid'] > 0) {
                    $is_my_cpid = jlogic('cp')->is_cp_company($item_id);
                    if ($is_my_cpid) {
                        $can_pub_cp_topic = true;
                    }
                }
                if (!$can_pub_cp_topic) {
                    return "你没有权限进行当前操作";
                }
            } else {
                $item = '';
                $item_id = 0;
                $data['type'] = 'first';
            }
        }
        if ($GLOBALS['_J']['config']['add_topic_need_face'] && !$member['__face__']) {
            return "本站需上传头像才可互动。";
        }
        $MemberHandler =& Obj::registry('MemberHandler');
        if ($MemberHandler) {
            if (!in_array($type, array('both', 'reply', 'forward'))) {
                if (!$MemberHandler->HasPermission('topic', 'add', 0, $member)) {
                    if (true !== IN_JISHIGOU_SMS) {
                        return $MemberHandler->GetError();
                    }
                }
            } else {
                if (('reply' == $type || 'both' == $type) && !$MemberHandler->HasPermission('topic', 'reply', 0, $member)) {
                    return $MemberHandler->GetError();
                } elseif (('forward' == $type || 'both' == $type) && !$MemberHandler->HasPermission('topic', 'forward', 0, $member)) {
                    return $MemberHandler->GetError();
                }
            }
        }
        if (MEMBER_ROLE_TYPE != 'admin') {
            if ($GLOBALS['_J']['config']['topic_vip'] == 1) {
                if (!$member['validate']) {
                    return "非V认证用户无法发布信息";
                }
            } elseif ($GLOBALS['_J']['config']['topic_vip'] == 2) {
                $to_verify = 1;
                if (!$member['validate']) {
                    $f_rets['vip'] = 1;
                    $f_rets['msg'] = '非V认证用户发言内容进入<a href="index.php?mod=' . $member['uid'] . '&type=my_verify" target="_blank">待审核</a>,
									<a href="' . $GLOBALS['_J']['config']['site_url'] . '/index.php?mod=other&code=vip_intro" target="_blank">点击申请认证</a>';
                    $is_verify = true;
                }
            }
        }
        $data['username'] = $username = $member['username'];
        $topic_content_id = abs(crc32(md5($content)));
        if (!$verify) {
            if ($GLOBALS['_J']['config']['lastpost_time'] > 0 && !in_array($data['from'], array('sina', 'qqwb')) && $timestamp - $member['lastpost'] < $GLOBALS['_J']['config']['lastpost_time']) {
                return "您发布的太快了,请在<b>{$GLOBALS['_J']['config']['lastpost_time']}</b>秒后再发布";
            }
        }
        #if NEDU
        if (defined('NEDU_MOYO')) {
            if (false != ($deny = nlogic('feeds.app.jsg')->topic_publish_denied($data))) {
                return $deny;
            }
        }
        #endif
        if ($imageid) {
            if ($verify) {
                $data['imageid'] = $imageid;
            } else {
                $data['imageid'] = $imageid = jlogic('image')->get_ids($imageid, $data['uid']);
            }
        }
        if ($attachid) {
            if ($verify) {
                $data['attachid'] = $attachid;
            } else {
                $data['attachid'] = $attachid = jlogic('attach')->get_ids($attachid, $data['uid']);
            }
        }
        $data['musicid'] = $musicid;
        if ($xiami_id > 0) {
            $musicid = $data['musicid'] = jtable('topic_music')->insert(array('uid' => $data['uid'], 'username' => $data['username'], 'dateline' => $timestamp, 'xiami_id' => $xiami_id), true);
        }
        $topic_more = array();
        $parents = '';
        $data['roottid'] = 0;
        if ($totid > 0) {
            $content = $this->GetForwardContent($content);
            $_type_names = array('both' => '转发和评论', 'forward' => '转发', 'reply' => '评论');
            $_type_name = $_type_names[$type];
            $to_topic = $row = $this->Get($totid);
            if (!$to_topic) {
                return "对不起,由于原微博已删除,不能{$_type_name}";
            }
            if (('reply' == $type || 'both' == $type) && ($rets = jsg_role_check_allow('topic_reply', $row['uid'], $data['uid']))) {
                return $rets['error'];
            } elseif (('forward' == $type || 'both' == $type) && ($rets = jsg_role_check_allow('topic_forward', $row['uid'], $data['uid']))) {
                return $rets['error'];
            }
            $topic_more = $this->GetMore($totid);
            $data['totid'] = $row['tid'];
            $data['touid'] = $row['uid'];
            $data['tousername'] = $row['nickname'];
            $parents = $topic_more['parents'] ? $topic_more['parents'] . ',' . $totid : $totid;
            $data['roottid'] = $topic_more['parents'] ? substr($parents, 0, strpos($parents, ',')) : $totid;
            $root_topic = $this->Get($data['roottid']);
            if ($root_topic['item'] == 'qun' && $root_topic['item_id'] > 0) {
                $qun_closed = DB::result_first("SELECT closed FROM " . DB::table('qun') . " WHERE qid='{$root_topic['item_id']}'");
                if ($qun_closed) {
                    return "当前" . $GLOBALS['_J']['config'][changeword][weiqun] . "已经关闭,你无法发布内容";
                }
            }
            if ($data['totid'] != $data['roottid']) {
                $rrow = $this->Get($data['roottid']);
                if (!$rrow) {
                    return "对不起,由于原始微博已删除,不能{$_type_name}";
                }
                if (('reply' == $type || 'both' == $type) && ($rets = jsg_role_check_allow('topic_reply', $rrow['uid'], $data['uid']))) {
                    return $rets['error'];
                } elseif (('forward' == $type || 'both' == $type) && ($rets = jsg_role_check_allow('topic_forward', $rrow['uid'], $data['uid']))) {
                    return $rets['error'];
                }
                if ('forward' == $type || 'both' == $type) {
                    $content .= $this->ForwardSeprator . "{$row['nickname']} : " . addslashes($this->_content_strip($row['raw_content']));
                }
            }
        }
        $_process_result = $this->_process_content($content, $data);
        $longtext = $_content = $_process_result['content'];
        $at_uids = $_process_result['at_uids'];
        $tags = $_process_result['tags'];
        $urls = $_process_result['urls'];
        unset($data['longtextid']);
        if (jstrlen($_content) > $this->_len) {
            $_content = cut_str($_content, $this->_len, '');
            $_content = $this->_content_end($_content);
            if (strlen($longtext) > strlen($_content)) {
                $longtextid = 0;
                if ($is_verify) {
                    $longtextid = jlogic('longtext')->Add($longtext, $data['uid']);
                }
                $longtextid = $longtextid > 0 ? $longtextid : TIMESTAMP;
                $data['longtextid'] = $longtextid;
            }
        }
        if (!$GLOBALS['_J']['config']['clear_format_open']) {
            $_content = $this->clearFormat($_content);
        } else {
            $_content = preg_replace('/\\n{3,}/', '\\n\\n', $_content);
            $_content = nl2br($_content);
        }
        if (strlen($_content) > 255) {
            $_content = cut_str($_content, 254 * 2, '');
            $data['content'] = cut_str($_content, 255, '');
            $data['content2'] = substr($_content, strlen($data['content']));
        } else {
            $data['content'] = $_content;
        }
        $data['postip'] = $postip ? $postip : $GLOBALS['_J']['client_ip'];
        $data['post_ip_port'] = $GLOBALS['_J']['client_ip_port'];
        if ($is_verify) {
            $sql = "insert into `" . TABLE_PREFIX . "topic_verify` (`" . implode("`,`", array_keys($data)) . "`) values ('" . implode("','", $data) . "')";
            DB::query($sql);
            $topic_id = $data['tid'] = $tid = DB::insert_id();
            if ($imageid) {
                DB::query("update " . TABLE_PREFIX . "topic_image set `tid`='-1' where `id` in ({$imageid})");
            }
            if ($attachid) {
                DB::query("update " . TABLE_PREFIX . "topic_attach set `tid`='-1' where `id` in ({$attachid})");
            }
            if ($urls) {
                $date = $data;
                $date['id'] = $data['tid'];
                $date['tid'] = -1;
                $this->_process_urls($date, $urls, false, 'topic_verify');
            }
            if ($notice_to_admin = $GLOBALS['_J']['config']['notice_to_admin']) {
                $pm_post = array('message' => $member['nickname'] . "有一条微博进入待审核状态,<a href='admin.php?jump_url=admin.php?mod=topic&code=verify' target='_blank'>点击</a>进入审核。", 'to_user' => str_replace('|', ',', $notice_to_admin));
                $admin_info = DB::fetch_first('select `uid`,`username`,`nickname` from `' . TABLE_PREFIX . 'members` where `uid` = 1');
                load::logic('pm');
                $PmLogic = new PmLogic();
                $PmLogic->pmSend($pm_post, $admin_info['uid'], $admin_info['username'], $admin_info['nickname']);
            }
            if ($f_rets['verify'] || $f_rets['vip']) {
                return array($f_rets['msg']);
            }
        } else {
            $tid = jtable('topic')->insert($data, true);
            if ($tid < 1) {
                return "未知的错误";
            }
            $topic_id = $data['tid'] = $tid;
            if (is_array($datas) && isset($datas['relateid'])) {
                $relateid = $datas['relateid'] ? $datas['relateid'] : 0;
                $featureid = $datas['featureid'] ? $datas['featureid'] : 0;
                if ($relateid) {
                    DB::query("update `" . TABLE_PREFIX . "topic` set `relateid`='{$tid}',`featureid`='{$featureid}' where `tid`='{$relateid}'");
                    $pmtoinfo = jlogic('topic')->Get($relateid, '`uid`,`item_id`,`relateid`,`featureid`', '');
                    $ch_typeinfo = jlogic('channel')->get_channel_typeinfo_byid($pmtoinfo['item_id']);
                    $msg = '您提出的';
                    $msg .= $ch_typeinfo['channel_type'] == 'ask' ? '问题' : '建议';
                    $msg .= $pmtoinfo['relateid'] == 0 ? ',已经有了答复' : '重新给予了答复';
                    if ($featureid != $pmtoinfo['featureid']) {
                        $msg .= ',状态变更为“' . ($ch_typeinfo['feature'][$featureid] ? $ch_typeinfo['feature'][$featureid] : '等待处理') . '”';
                    }
                    postpmsms($pmtoinfo['uid'], $relateid, $msg);
                }
            }
            if ($is_new) {
                if (!empty($item) && $item_id > 0 && !($design == 'design' || $design == 'btn_wyfx')) {
                    jfunc('app');
                    $param = array('item' => $item, 'item_id' => $item_id, 'tid' => $tid, 'uid' => $data['uid']);
                    if ($item == 'talk') {
                        $param['touid'] = $touid;
                        $param['totid'] = $totid;
                    }
                    app_add_relation($param);
                    unset($param);
                }
                jtable('topic_more')->add($tid, $parents, $longtext);
            }
            jtable('member_topic')->add($tid);
            if ($parents && 'first' != $data['type']) {
                jtable('topic_relation')->add($tid, $parents);
            }
            $p = array('uid' => $data['uid'], 'lastactivity' => $data['lastupdate'], 'lastpost' => $data['lastupdate'], 'last_topic_content_id' => $topic_content_id);
            if ('reply' != $data['type']) {
                $p['+@topic_count'] = 1;
            }
            jtable('members')->update($p);
            if ($at_uids) {
                $this->_process_at_uids($data, $at_uids);
                ios_push_msg($at_uids, '你有新消息:1条@我');
            }
            if ($totid > 0 && $parents) {
                $this->_process_reply($data);
                ios_push_msg($totid, '你有新消息:1条评论');
            }
            if ($urls) {
                $this->_process_urls($data, $urls);
            }
            if ($imageid) {
                jlogic('image')->set_tid($imageid, $tid);
            }
            if ($attachid) {
                jlogic('attach')->set_tid($attachid, $tid);
            }
            if ($musicid) {
                $sql = "update `" . TABLE_PREFIX . "topic_music` set `tid` = '{$tid}' where `id` = '{$musicid}' ";
                DB::query($sql);
            }
            if ($data['videoid'] > 0) {
                $sql = "update `" . TABLE_PREFIX . "topic_video` set `tid`='{$tid}' where `id`='{$data['videoid']}'";
                DB::query($sql);
            }
            #有奖转发判断
            if ($is_reward) {
                $allowed_reward = 1;
                $reward_info = jlogic('reward')->getRewardInfo($is_reward);
                if ($reward_info['rules']) {
                    foreach ($reward_info['rules'] as $key => $val) {
                        if ($allowed_reward == 0) {
                            break;
                        }
                        switch ($key) {
                            case 'at_num':
                                if ($val > count($at_uids)) {
                                    $allowed_reward = 0;
                                }
                                break;
                            case 'user':
                                $my_buddyids = get_buddyids($data['uid']);
                                if (!$my_buddyids) {
                                    $allowed_reward = 0;
                                    break;
                                }
                                foreach ($val as $re_uid => $re_name) {
                                    if ($re_uid == $data['uid']) {
                                        continue;
                                    }
                                    if (!in_array($re_uid, $my_buddyids)) {
                                        $allowed_reward = 0;
                                        break;
                                    }
                                }
                                break;
                            case 'tag':
                                foreach ($val as $re_tag) {
                                    if (!$tags) {
                                        $allowed_reward = 0;
                                        break;
                                    }
                                    if (!in_array($re_tag, $tags)) {
                                        $allowed_reward = 0;
                                        break;
                                    }
                                }
                                break;
                            default:
                                break;
                        }
                    }
                }
                #超时转发也不可进入有奖转发名单
                if (TIMESTAMP > $reward_info['tot']) {
                    $allowed_reward = 0;
                }
                #记录有奖转发
                DB::query(" insert into `" . TABLE_PREFIX . "reward_user` (`uid`,`tid`,`rid`,`on`,`dateline`) values('{$data['uid']}','{$tid}','{$is_reward}','{$allowed_reward}','" . TIMESTAMP . "')");
                DB::query(" update `" . TABLE_PREFIX . "reward` set `f_num` = `f_num`+1,`a_num`=`a_num`+{$allowed_reward} where `id` = '{$is_reward}' ");
            }
            if ($item == 'qun' && ($data['type'] == 'qun' || $data['type'] == 'first')) {
                if (!empty($item_id)) {
                    $query = DB::query("SELECT uid FROM " . DB::table('qun_user') . " WHERE qid='{$item_id}'");
                    $uids = array();
                    while ($value = DB::fetch($query)) {
                        if ($value['uid'] != $uid) {
                            $uids[$value['uid']] = $value['uid'];
                        }
                    }
                    if (!empty($uids)) {
                        DB::query("UPDATE " . DB::table('members') . "\r\n\t        \t\t\t\t\t   SET qun_new=qun_new+1\r\n\t        \t\t\t\t\t   WHERE uid IN(" . jimplode($uids) . ")");
                    }
                }
            }
            if ($item == 'channel' && $item_id > 0 && ($data['type'] == 'first' || $data['type'] == 'channel')) {
                if (!empty($item_id)) {
                    $query = DB::query("SELECT uid FROM " . DB::table('buddy_channel') . " WHERE ch_id='{$item_id}'");
                    $uids = array();
                    while ($value = DB::fetch($query)) {
                        if ($value['uid'] != $uid) {
                            $uids[$value['uid']] = $value['uid'];
                        }
                    }
                    if (!empty($uids)) {
                        DB::query("UPDATE " . DB::table('members') . "\r\n\t        \t\t\t\t\t   SET channel_new=channel_new+1\r\n\t        \t\t\t\t\t   WHERE uid IN(" . jimplode($uids) . ")");
                    }
                }
                if ($GLOBALS['_J']['config']['extcredits_enable'] && $data['uid'] > 0) {
                    $credits_itemid = jlogic('channel')->is_update_credits_byid($item_id);
                    if ($credits_itemid) {
                        update_credits_by_action('_C' . crc32($credits_itemid), $data['uid']);
                    }
                }
            }
            if ($item == 'company' && $item_id > 0 && $data['type'] == 'company') {
                $query = DB::query("SELECT uid FROM " . DB::table('members') . " WHERE companyid='{$item_id}'");
                $uids = array();
                while ($value = DB::fetch($query)) {
                    if ($value['uid'] != $uid) {
                        $uids[$value['uid']] = $value['uid'];
                    }
                }
                $query = DB::query("SELECT uid FROM " . DB::table('cp_user') . " WHERE companyid='{$item_id}'");
                while ($value = DB::fetch($query)) {
                    if ($value['uid'] != $uid) {
                        $uids[$value['uid']] = $value['uid'];
                    }
                }
                if (!empty($uids)) {
                    DB::query("UPDATE " . DB::table('members') . " SET company_new=company_new+1 WHERE uid IN(" . jimplode($uids) . ")");
                }
            }
            $update_credits = false;
            if ($tags) {
                Load::logic('tag');
                $TagLogic = new TagLogic('topic');
                $TagLogic->Add(array('item_id' => $tid, 'tag' => $tags), false);
                if ($GLOBALS['_J']['config']['extcredits_enable'] && $data['uid'] > 0) {
                    if (is_array($tags) && count($tags)) {
                        if ($GLOBALS['_J']['config']['sign']['sign_enable'] && jtable('sign_tag')->is_sign_tag($tags)) {
                            $sign_credits = update_credits_by_action('_S', $data['uid']);
                        }
                        if (!$sign_credits['updatecredit']) {
                            foreach ($tags as $_t) {
                                if ($_t) {
                                    $update_credits = update_credits_by_action('_T' . crc32($_t), $data['uid']) || $update_credits;
                                }
                            }
                        }
                    }
                }
                jlogic('tag_favorite')->topic_new($tags, $data['uid']);
            }
            if ($GLOBALS['_J']['config']['extcredits_enable']) {
                if (!$update_credits && !$sign_credits && $data['uid'] > 0) {
                    if ($totid > 0) {
                        update_credits_by_action('reply', $data['uid']);
                    } else {
                        update_credits_by_action('topic', $data['uid']);
                    }
                }
            }
            if ($GLOBALS['_J']['config']['imjiqiren_enable'] && imjiqiren_init()) {
                $to_admin_robot = jconf::get('imjiqiren', 'admin_qq_robots');
                if ($to_admin_robot) {
                    imjiqiren_send_message($to_admin_robot, 'to_admin_robot', array('site_url' => $GLOBALS['_J']['config']['site_url'], 'username' => $data['username'], 'content' => $data['content'], 'topic_id' => $topic_id));
                }
            }
            if ($GLOBALS['_J']['config']['sms_enable'] && sms_init()) {
                $to_admin_mobile = jconf::get('sms', 'admin_mobile');
                if ($to_admin_mobile) {
                    sms_send_message($to_admin_mobile, 'to_admin_mobile', array('site_url' => $GLOBALS['_J']['config']['site_url'], 'username' => $data['username'], 'content' => $data['content'], 'topic_id' => $topic_id));
                }
            }
            if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $GLOBALS['_J']['config']['company_enable'] && $member['companyid'] > 0) {
                $CpLogic = jlogic('cp');
                $update_companyid = $member['companyid'];
                $update_departmentid = $member['departmentid'];
                if ($item = 'company' && $item_id > 0 && $update_companyid != $item_id) {
                    $cp_company_info = $CpLogic->get_cp_row_bycompany($item_id);
                    if ($cp_company_info) {
                        $update_companyid = $member['companyid'];
                        $update_departmentid = $member['departmentid'];
                    }
                }
                $CpLogic->update('company', $update_companyid, 0, 1);
                if ($update_departmentid > 0) {
                    $CpLogic->update('department', $update_departmentid, 0, 1);
                }
            }
            $feed_action = '';
            if (in_array($data['type'], array('first', 'reply', 'forward', 'both'))) {
                $feed_action = $data['type'];
                if ($feed_action == 'first') {
                    $feed_action = 'post';
                } elseif ($feed_action == 'both') {
                    $feed_action = 'reply';
                }
            }
            if ($feed_action) {
                $feed_msg = cut_str($data['content'], 30, '');
                feed_msg('channel', $feed_action, $tid, $feed_msg, $item_id, $data['anonymous']);
            }
            $this->_syn_to($data);
        }
        if ($GLOBALS['_J']['plugins']['func']['posttopic']) {
            hookscript('posttopic', 'funcs', array('param' => array($data['tid']), 'step' => 'post'), 'posttopic');
        }
        if ('reply' != $data['type']) {
            cache_db('rm', "{$data['uid']}-topic-%", 1);
            jtable('topic')->archive($data['tid']);
        }
        $this->cache_rm($data['tid']);
        #if NEDU
        defined('NEDU_MOYO') && nfevent('jsg.logic.topic.add', null, $data);
        #endif
        return $data;
    }
Exemplo n.º 6
0
                                echo $val['tid'];
                                ?>
,'add');return false;">收藏</a> </span> <?php 
                            }
                            ?>
 </li> <li class="o_line_l">|</li> <li> <?php 
                            if (!$val['reply_disable'] && !($val['managetype'] == 2 || $val['managetype'] == 9)) {
                                ?>
 <span> <?php 
                                $opstring = !$topic_view && ($val['ismanager'] || 'admin' == MEMBER_ROLE_TYPE) && in_array($val['channel_type'], array('ask', 'idea')) ? chr(123) . 'relate:1,itemid:' . $val['item_id'] . ',featureid:' . $val['featureid'] . chr(125) : chr(123) . chr(125);
                                ?>
 <?php 
                                if (defined('NEDU_MOYO')) {
                                    ?>
 <?php 
                                    $opstring = nlogic('feeds.app.jsg')->topic_comment_ajax_options($options, $val);
                                    ?>
 <?php 
                                }
                                ?>
 <?php 
                                $__rts = $reply_list_ajax_disable ? 0 : $val['replys'];
                                ?>
 <a id="topic_list_reply_<?php 
                                echo $val['tid'];
                                ?>
_aid" href="javascript:;" 
<?php 
                                if (MEMBER_ID < 1) {
                                    ?>
onclick="ShowLoginDialog();" 
Exemplo n.º 7
0
 public function run($type = '')
 {
     $types = array('index' => array('mod_default' => $this->var['config']['default_module'] ? $this->var['config']['default_module'] : 'topic'), 'admin' => array('mod_exit' => 1, 'tpl_default' => 'admin/'), 'ajax' => array('mod_default' => 'topic', 'tpl_default' => 'ajax/'), 'api' => array('mod_default' => 'test', 'mod_exit' => 1, 'tpl_default' => 'api/'), 'imjiqiren' => array('mod_default' => 'imjiqiren', 'mod_exit' => 1, 'tpl_default' => 'imjiqiren/'), 'sms' => array('mod_default' => 'sms', 'mod_exit' => 1, 'tpl_default' => 'sms/'), 'widget' => array('mod_default' => 'qun', 'mod_exit' => 1, 'tpl_default' => 'widget/'), 'wap' => array('mod_default' => 'topic', 'mod_path' => 'wap/modules/'), 'mobile' => array('mod_default' => 'topic', 'mod_path' => 'mobile/modules/'), 'mobile_ajax' => array('mod_default' => 'topic', 'mod_path' => 'mobile/modules/ajax/'));
     if (!isset($types[$type])) {
         if (empty($type)) {
             $type = 'index';
         } else {
             $types[$type] = array('mod_default' => 'index', 'mod_exit' => 1, 'tpl_default' => $type . '/');
         }
     }
     $types[$type]['modules_path'] = $modules_path = ROOT_PATH . ($types[$type]['mod_path'] ? $types[$type]['mod_path'] : 'modules/' . ('index' == $type ? '' : $type . '/'));
     $this->var['config']['jishigou_run_type'] = $type;
     $this->var['config']['jishigou_run_tpl_default'] = $types[$type]['tpl_default'];
     define('IN_JISHIGOU_' . strtoupper($type), true);
     if ($this->var['config']['upgrade_lock_time'] > 0 && true !== IN_JISHIGOU_UPGRADE && true !== IN_JISHIGOU_ADMIN) {
         if ($this->var['config']['upgrade_lock_time'] + 6000 > TIMESTAMP || is_file(ROOT_PATH . './data/cache/upgrade.lock') && @filemtime(ROOT_PATH . './data/cache/upgrade.lock') + 6000 > TIMESTAMP) {
             die('System upgrade. Please wait...');
         }
     }
     if ($this->var['config']['site_closed'] && true !== IN_JISHIGOU_ADMIN) {
         if ('login' != $this->var['mod'] && ($site_closed_msg = file_get_contents(ROOT_PATH . 'data/cache/site_enable.txt'))) {
             exit($site_closed_msg);
         }
     }
     if ($this->var['config']['ipbanned_enable']) {
         if (false != ($ipbanned = jconf::get('access', 'ipbanned'))) {
             if (preg_match("~^({$ipbanned})~", $this->var['client_ip'])) {
                 exit('Your IP has been banned access and registration.');
             }
             unset($ipbanned);
         }
     }
     if ($this->var['config']['rewrite_enable'] && (true === IN_JISHIGOU_INDEX || true === IN_JISHIGOU_AJAX || true === IN_JISHIGOU_ADMIN)) {
         include ROOT_PATH . 'include/rewrite.php';
     }
     $allow_gzip = 0;
     $un_gzip_mods = array('share' => 1, 'output' => 1, 'download' => 1, 'attachment' => 1, 'attach' => 1);
     if (true === GZIP && true === IN_JISHIGOU_INDEX && !isset($un_gzip_mods[$this->var['mod']]) && substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
         $allow_gzip = 1;
     }
     ob_start($allow_gzip ? 'ob_gzhandler' : null);
     #if NEDU
     if (defined('NEDU_MOYO')) {
         nlogic('load/cooks')->gateway($type);
     }
     #endif
     $this->init();
     if (defined('APP_ROOT')) {
         $this->_init_user(1);
         $c = $this->_g('c', 'index');
         $a = $this->_g('a', 'index');
         $controller = $c . '_controller';
         $action = $a . '_action';
         Load::file('controller');
         if (!@(include_once APP_ROOT . 'controller/' . $c . '.class.php') && !class_exists($controller)) {
             error_404('controller ' . $c . ' is not exists');
         }
         $app_object = new $controller();
         if (method_exists($app_object, $action)) {
             jdefine('APP_ID', $c . '_' . $a);
             $app_object->{$action}();
         } else {
             error_404('action ' . $a . ' is not exists');
         }
     } else {
         if (!@(include_once $modules_path . 'master.mod.php') && !class_exists('MasterObject')) {
             error_404('modules path is invalid');
         }
         if (!(include $modules_path . $this->_init_mod($types[$type]) . '.mod.php') && !class_exists('ModuleObject')) {
             error_404('mod is invalid');
         }
         $ModuleObject = new ModuleObject($this->var['config']);
     }
 }
Exemplo n.º 8
0
    }
    ?>
 <?php 
    if (in_array($this->Get['mod'], array('qun', 'live', 'talk', 'event', 'vote', 'fenlei', 'reward', 'album', 'mall')) || $this->Get['type'] == 'ask' || !$topic_allow_syncd) {
        ?>
 <?php 
        $topic_type_value = $this->Get['type'] == 'ask' ? $this->Get['item'] : $this->Get['mod'];
        ?>
 <?php 
        $topic_allow_forward = true;
        ?>
 <?php 
        if (defined('NEDU_MOYO')) {
            ?>
 <?php 
            nlogic('feeds.app.jsg')->topic_publish_action_allowed('forward', $topic_allow_forward);
            ?>
 <?php 
        }
        ?>
 <?php 
        if ($topic_allow_forward) {
            ?>
 <div class="send_share_box"> <b class="box_4_open_span menu_title" style="padding:0;"> <label><input id="chk_toweibo<?php 
            echo $h_key;
            ?>
" type="checkbox" checked="checked" onclick="selectAppTopicType(this.id, {toid:'topic_type<?php 
            echo $h_key;
            ?>
', defTopicType:'<?php 
            echo $topic_type_value;
Exemplo n.º 9
0
 function publishSuccess()
 {
     echo $this->js_show_msg();
     #if NEDU
     defined('NEDU_MOYO') && nlogic('feeds.app.jsg')->on_ajax_topic_published();
     #endif
 }
Exemplo n.º 10
0
 function Menu()
 {
     global $jishigou_rewrite, $config;
     $default_open = true;
     $open_onlyone = false;
     $open_list = explode('_', $this->Get['open']);
     require ROOT_PATH . 'setting/admin_left_menu.php';
     #if NEDU
     if (defined('NEDU_MOYO')) {
         $menu_list = nlogic('admin.menu')->hooks_nav($menu_list);
     }
     #endif
     foreach ($menu_list as $_key => $_menu) {
         if ($_menu['sub_menu_list']) {
             foreach ($_menu['sub_menu_list'] as $_sub_key => $_sub_menu) {
                 if (strpos($_sub_menu['link'], ":\\/\\/") !== false) {
                     continue;
                 }
                 preg_match("~mod=([^&#]+)&?(code=([^&#]*))?~", $_sub_menu['link'], $match);
                 list(, $_mod, , $_code) = $match;
                 if (!empty($_mod) && $this->MemberHandler->HasPermission($_mod, $_code, 1) == false) {
                     unset($menu_list[$_key]['sub_menu_list'][$_sub_key]);
                 }
             }
         }
     }
     $all_open_list = array_keys($menu_list);
     if ($default_open && isset($this->Get['open']) == false) {
         $open_list = $all_open_list;
     }
     foreach ($menu_list as $key => $menu) {
         if ($key == 1) {
             foreach ($menu_list as $_menu_list_s) {
                 foreach ((array) $_menu_list_s['sub_menu_list'] as $menu_s) {
                     if ($menu_s['shortcut']) {
                         $menu['sub_menu_list'][] = $menu_s;
                     }
                 }
             }
             if ($this->Config['tongji_admin_url'] && $this->Config['tongji']) {
                 $menu['sub_menu_list'][] = array('title' => '访问统计报表', 'link' => 'admin.php?mod=index&code=iframe&url=' . urlencode($this->Config['tongji_admin_url']));
             }
         }
         if (empty($menu['sub_menu_list'])) {
             continue;
         }
         $menu_tmp_list[$key] = $menu;
         if (in_array($key, $open_list) != false) {
             $menu_tmp_list[$key]['img'] = 'minus';
             $open_list_tmp = $open_list;
             unset($open_list_tmp[array_search($key, $open_list_tmp)]);
         } else {
             $menu_tmp_list[$key]['img'] = 'plus';
             $menu_tmp_list[$key]['sub_menu_list'] = array();
         }
         if (isset($menu['sub_menu_list'])) {
             $menu_tmp_list[$key]['link'] = "?mod=index&code=menu";
             $menu_tmp_list[$key]['target'] = "";
         } else {
             $menu_tmp_list[$key]['target'] = 'target="main"';
         }
     }
     $menu_list = $menu_tmp_list;
     return $menu_list;
 }
Exemplo n.º 11
0
 function DoCheckUser()
 {
     $ret = false;
     $username = trim(jget('username'));
     if (!$username) {
         json_error('请输入帐号');
     }
     #if NEDU
     if (defined('NEDU_MOYO')) {
         nlogic('user/passport')->onlogin($username);
     }
     #endif
     if ($this->Config['ldap_enable']) {
         if ($this->_is_email($username)) {
             $uid = DB::result_first(" select `uid` from `" . TABLE_PREFIX . "members` where `email` = '{$username}' ");
             $uid = $uid ? $uid : 0;
             $face = face_get($uid);
             json_result($face);
         }
         json_error('域帐号不存在');
     } else {
         $uid = jsg_member_uid($username);
         if ($uid > 0) {
             $face = face_get($uid);
             json_result($face);
         } elseif (true === UCENTER) {
             include_once ROOT_PATH . 'api/uc_client/client.php';
             if ($this->_is_email($username)) {
                 $return = uc_user_checkemail($username);
             } else {
                 $return = uc_user_checkname($username);
             }
             if ($return == '-3' || $return == '-6') {
                 json_result(face_get(0));
             }
         }
         json_error('帐号不存在');
     }
 }
Exemplo n.º 12
0
 function login_check($nickname, $password, $is = '', $checkip = 1)
 {
     $timestamp = TIMESTAMP;
     $ip = $GLOBALS['_J']['client_ip'];
     if ($checkip && $ip) {
         $fls = $this->_failedlogins_config();
         if ($fls['white_list'] && in_array($ip, $fls['white_list'])) {
         } else {
             $failed = DB::fetch_first("SELECT * FROM " . TABLE_PREFIX . 'failedlogins' . " WHERE ip='{$ip}'");
             if ($failed) {
                 if ($failed['lastupdate'] + $fls['time'] > $timestamp) {
                     if ($failed['count'] > $fls['limit']) {
                         return array('uid' => -3);
                     }
                 } else {
                     DB::query("DELETE FROM " . TABLE_PREFIX . 'failedlogins' . " WHERE `lastupdate`<'" . ($timestamp - $fls['time'] - 1) . "'", 'UNBUFFERED');
                 }
             }
         }
     }
     $rets = array();
     if ('' == trim($nickname)) {
         $rets = array('uid' => -1);
     }
     if ('' == trim($password)) {
         $rets = array('uid' => -2);
     }
     if (!$rets) {
         #if NEDU
         if (defined('NEDU_MOYO')) {
             nlogic('user/passport')->onlogin($nickname);
         }
         #endif
         $member = jsg_get_member($nickname, $is, 0);
         if (!$member || $member['uid'] < 1) {
             $rets = array('uid' => -1);
         } else {
             $update = 0;
             if (jsg_member_password($password, $member['salt']) != $member['password']) {
                 if (md5($password) != $member['password']) {
                     $rets = array('uid' => -2);
                 } else {
                     if (!$member['salt']) {
                         $update = 1;
                     }
                 }
             } else {
                 if (!$member['salt']) {
                     $update = 1;
                 }
             }
             if (!$rets && $update) {
                 $member['salt'] = $member['salt'] ? $member['salt'] : jsg_member_salt();
                 $member['password'] = jsg_member_password($password, $member['salt']);
                 jtable('members')->update(array('password' => $member['password'], 'salt' => $member['salt']), array('uid' => $member['uid']));
             }
         }
     }
     if ($rets) {
         if ($checkip && $ip) {
             if ($failed) {
                 DB::query("UPDATE " . TABLE_PREFIX . 'failedlogins' . " SET count=count+1, lastupdate='{$timestamp}' WHERE ip='{$ip}'");
             } else {
                 DB::query("REPLACE INTO " . TABLE_PREFIX . 'failedlogins' . " (ip, count, lastupdate) VALUES ('{$ip}', '1', '{$timestamp}')");
             }
         }
         return $rets;
     }
     return $member;
 }