예제 #1
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');
 }
예제 #2
0
 function View()
 {
     $view_rets = jlogic('topic')->check_view($this->ID);
     if ($view_rets['error']) {
         $this->Messager($view_rets['result'], null);
     }
     $per_page_num = 20;
     $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}" : "");
     $topic_info = jlogic('longtext')->get_info($this->ID, array('type' => 'artZoom2'));
     if ($topic_info['longtextid'] > 0) {
         $topic_info['content'] = nl2br($topic_info['content']);
     }
     $allow_op = 1;
     if ($topic_info['item'] == 'qun' && !empty($topic_info['item_id'])) {
         Load::logic('qun');
         $QunLogic = new QunLogic();
         $qun_info = $QunLogic->get_qun_info($topic_info['item_id']);
         if (!empty($qun_info)) {
             $qun_info['icon'] = $QunLogic->qun_avatar($qun_info['qid'], 's');
             $allow_op = $is_qun_member = $QunLogic->is_qun_member($topic_info['item_id'], MEMBER_ID);
         }
     } else {
         if ($topic_info['type'] == 'reply') {
             $roottid = $topic_info['roottid'];
             if (empty($roottid)) {
                 $root_type = 'reply';
             } else {
                 $root_type = DB::result_first("SELECT type FROM " . DB::table('topic') . " WHERE tid='{$roottid}'");
             }
         } else {
             $root_type = $topic_info['type'];
         }
     }
     $parent_list = $t_parent_list = $t_relate_list = array();
     if ($topic_info['parent_id']) {
         $parent_id_list = array($topic_info['parent_id'], $topic_info['top_parent_id']);
         if ($parent_id_list) {
             $t_parent_list[$topic_info['top_parent_id']] = jlogic('longtext')->get_info($topic_info['top_parent_id'], array('type' => 'artZoom2'));
         }
     }
     if ($topic_info['relateid'] > 0) {
         $t_relate_list = jlogic('longtext')->get_info($topic_info['relateid']);
     }
     if ($topic_info['digcounts'] > 0) {
         $dig_users = array();
         $user = $this->TopicLogic->GetDigUids($topic_info['tid']);
         if (!$user || count($user) != $topic_info['digcounts']) {
             $query = DB::query("SELECT uid FROM `" . TABLE_PREFIX . "topic_dig`\tWHERE tid = '" . $topic_info['tid'] . "' ORDER BY id DESC");
             while ($rs = DB::fetch($query)) {
                 $user[$rs['uid']] = $rs['uid'];
             }
         }
         $dig_users = $this->TopicLogic->GetMember($user, "`uid`,`username`,`nickname`,`face`");
         foreach ($dig_users as $k => $v) {
             array_splice($dig_users[$k], 4, 3);
         }
         $listotherdig = true;
     }
     if ($topic_info['replys'] > 0) {
         $total_record = $topic_info['replys'];
         $p = array('perpage' => $per_page_num, 'result_count' => $total_record);
         $orderby = jget('orderby');
         if ('dig' == $orderby) {
             $p['sql_order'] = ' `digcounts` DESC, `lastdigtime` DESC ';
         } elseif ('post' == $orderby) {
             $p['sql_order'] = ' `dateline` DESC ';
         } else {
             $p['sql_order'] = ' `dateline` ASC ';
         }
         $reply_list_ajax_disable = 1;
         $rets = jtable('topic_relation')->get_list($topic_info['tid'], $p);
         $page_arr = $reply_list = array();
         if ($rets) {
             $page_arr = $rets['page'];
             $reply_list = $rets['list'];
             $total_record = $rets['count'];
             $parent_list = $rets['parent_list'];
         }
         $relate_reply = array();
         if ($reply_list) {
             if ($topic_info['relateid'] > 0) {
                 if ($reply_list[$topic_info['relateid']]) {
                     $relate_reply[$topic_info['relateid']] = $reply_list[$topic_info['relateid']];
                     unset($reply_list[$topic_info['relateid']]);
                 } else {
                     $relate_reply[$topic_info['relateid']] = jlogic('longtext')->get_info($topic_info['relateid']);
                 }
                 if (in_array($topic_info['channel_type'], array('ask', 'idea'))) {
                     $relate_reply[$topic_info['relateid']]['ch_ty_css'] = ($topic_info['channel_type'] ? $topic_info['channel_type'] : 'default') . '_relate_mark';
                 }
             }
             $ajaxkey = array();
             $ajaxnum = 10;
             if (count($reply_list) > $ajaxnum) {
                 $topic_keys = array_keys($reply_list);
                 $reply_list = array_slice($reply_list, 0, $ajaxnum);
                 array_splice($topic_keys, 0, $ajaxnum);
                 $num = ceil(count($topic_keys) / $ajaxnum);
                 for ($i = 0; $i < $num; $i++) {
                     if (count($topic_keys) > $ajaxnum) {
                         $topic_key = array_splice($topic_keys, 0, $ajaxnum);
                     } else {
                         $topic_key = $topic_keys;
                     }
                     $ajaxkey[] = base64_encode(serialize($topic_key));
                 }
                 $isloading = true;
             }
             if ($relate_reply) {
                 $reply_list = array_merge($relate_reply, $reply_list);
             }
         }
     }
     if ($t_parent_list) {
         foreach ($t_parent_list as $k => $v) {
             if (!isset($parent_list[$k])) {
                 $parent_list[$k] = $v;
             }
         }
     }
     if (MEMBER_ID > 0) {
         $sql = "select * from `" . TABLE_PREFIX . "topic_favorite` where `uid`='" . MEMBER_ID . "' and `tid`='{$topic_info['tid']}'";
         $query = $this->DatabaseHandler->Query($sql);
         $is_favorite = $query->GetRow();
     }
     $member = $this->_member($topic_info['uid']);
     $member_medal = $member;
     if ($member_medal['medal_id']) {
         $medal_list = $this->_Medal($member_medal['medal_id'], $member_medal['uid']);
     }
     $titletopicname = $topic_info['anonymous'] ? '匿名发布' : $member['nickname'];
     $this->Title = cut_str(strip_tags($topic_info['content']), 50) . " - {$titletopicname}的微博";
     $Keywords = array();
     if (strpos($topic_info['content'], '#')) {
         preg_match_all('~\\#([^\\#\\s\'\\"\\/\\<\\>\\?\\\\]+?)\\#~', strip_tags($topic_info['content']), $Keywords);
     }
     if (is_array($Keywords[1]) && count($Keywords[1])) {
         $this->MetaKeywords = implode(',', $Keywords[1]);
     }
     $this->MetaDescription = cutstr(strip_tags($topic_info['content']), 140);
     if (MEMBER_ID != $member['uid']) {
         $this->_initTheme($member);
     }
     $topic_view = 1;
     $this->item = $topic_info['item'];
     $this->item_id = $topic_info['item_id'];
     include template('topic_view');
 }
예제 #3
0
 function do_recd()
 {
     Load::logic('topic_recommend');
     $TopicRecommendLogic = new TopicRecommendLogic();
     $tid = intval($this->Post['tid']);
     $topic = DB::fetch_first("SELECT * FROM " . DB::table("topic") . " WHERE tid='{$tid}'");
     if (empty($topic)) {
         json_error("当前微博不存在或者已经被删除了");
     }
     if ($topic['item'] == 'channel' && $topic['item_id'] > 0) {
         if (!function_exists('item_topic_from')) {
             jfunc('item');
         }
         $topic = item_topic_from($topic);
     }
     if (!($this->MemberHandler->HasPermission('topic', 'do_recd') || $topic['ismanager'])) {
         json_error("您的角色没有推荐微博的权限!");
     }
     $recd = intval($this->Post['recd'][0]);
     if ($recd > 4 || $recd < 0) {
         json_error("推荐类型错误");
     }
     if ($topic['item'] == 'qun' && $topic['item_id'] > 0) {
         Load::logic('qun');
         $QunLogic = new QunLogic();
         $tmp_perm = $QunLogic->chk_perm($topic['item_id'], MEMBER_ID);
         if (!('admin' == MEMBER_ROLE_TYPE || in_array($tmp_perm, array(1, 2)))) {
             json_error("你没有权限推荐群内微博");
         }
     }
     if ($recd == 0) {
         $topic_recd = $TopicRecommendLogic->delete(array($tid));
         json_result("0|||取消推荐成功!");
     } else {
         $expiration = jstrtotime(trim($this->Post['expiration']));
         $tag_id = intval($this->Post['tag_id']);
         $r_title = strip_tags(trim($this->Post['r_title']));
         if (!empty($tag_id)) {
             $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('topic_tag') . " WHERE item_id='{$tid}' AND tag_id='{$tag_id}' ");
             if (!empty($count)) {
                 $topic['item'] = 'tag';
                 $topic['item_id'] = $tag_id;
             }
         }
         $item = $this->Post['item_id'] ? 'channel' : $topic['item'];
         $item_id = $this->Post['item_id'] ? intval($this->Post['item_id']) : $topic['item_id'];
         if (empty($r_title)) {
             json_error("推荐标题为空或内容不合法");
         }
         if ($expiration && $expiration < time()) {
             json_error("时间设置无效,请重新设置");
         }
         $data = array('expiration' => $expiration, 'item' => $item, 'item_id' => $item_id, 'tid' => $tid, 'recd' => $recd, 'dateline' => TIMESTAMP, 'r_uid' => MEMBER_ID, 'r_nickname' => MEMBER_NICKNAME, 'r_title' => $r_title);
         if ($TopicRecommendLogic->is_exists($tid)) {
             unset($data['tid']);
             $TopicRecommendLogic->modify($data, array('tid' => $tid));
             json_result("2|||重新推荐成功!");
         } else {
             $TopicRecommendLogic->add($data);
             feed_msg('recommend', 'recommend', $tid, $r_title, $item_id);
             if ($recd == 4) {
                 $iphone_msg = cut_str($topic['content'], 30, '');
                 ios_push_msg('all', $r_title . ':' . $iphone_msg);
             }
             $credits = jconf::get('credits');
             update_credits_by_action('recommend', $topic['uid']);
             json_result("1|||推荐成功!被推荐者因:" . $this->js_show_msg(1));
         }
     }
 }
예제 #4
0
 function add()
 {
     $catselect = $this->QunLogic->get_catselect();
     $checked = array();
     $checked['gview_perm'][0] = 'checked="checked"';
     $checked['join_type'][0] = 'checked="checked"';
     $actions = "admin.php?mod=qun&code=do_add";
     $u_tips = $this->QunLogic->upload_tips();
     $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "common_district where `upid` = '0' order by list");
     while ($rsdb = $query->GetRow()) {
         $province[$rsdb['id']]['value'] = $rsdb['id'];
         $province[$rsdb['id']]['name'] = $rsdb['name'];
     }
     $province_list = $this->jishigou_form->Select("province", $province, $province_id, "onchange=\"changeProvince();\"");
     Load::logic("qun");
     $qunLogic = new QunLogic();
     $themelist = $qunLogic->getQunThemeList();
     include template('admin/qun_edit');
 }