예제 #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');
 }