title = $_G['cache']['plugin']['myapp']['showtitle']; $this->num = intval($_G['cache']['plugin']['myapp']['shownum']); $this->myapp = intval($_G['cache']['plugin']['myapp']['showmyapp']); } } class plugin_myapp_forum extends plugin_myapp { function viewthread_sidebottom_output() { global $_G, $postlist; if(IS_ROBOT) { return array(); } if(!$_G['forum_firstpid']) { return array(); } loadcache('myapp'); $thisApp = ''; $poster = reset($postlist); $userapp = C::t('home_userapp_plying')->fetch($poster['authorid']); if(!empty($userapp['appid'])) { $applist = explode(',', $userapp['appid']); $i = 0; foreach($applist as $appid) { if(!empty($_G['cache']['myapp'][$appid])) { if($i < $this->num) { $thisApp .= ''. ''; $i++; } else { break; } } } } $thisApp = $thisApp ? '

'.$this->title.'

'.$thisApp.'

' : ''; return array($thisApp); } function viewthread_postsightmlafter_output() { global $_G, $postlist; if(IS_ROBOT || !$this->myapp) { return array(); } $myappdiv = $myapp = $uids = array(); foreach($postlist as $post) { $uids[$post['authorid']] = $post['authorid']; } require_once libfile('function/feed'); foreach(C::t('common_member')->fetch_all($uids) as $uid) { $list = array(); foreach(C::t('home_feed_app')->fetch_all_by_uid_icon($uid['uid'], '', 0, 1) as $feed) { $list[$feed['icon']][] = mkfeed($feed); } $myapp[$uid['uid']] = $this->getmyapplist($list); } foreach($postlist as $post) { $myappdiv[] = $myapp[$post['authorid']]; } return $myappdiv; } function getmyapplist($list) { if(!$list) { return ''; } $myapp = '
'; foreach($list as $appicon => $values) { $myapp .= '
'; $myapp .= ''; $myapp .= '
    '; foreach($values as $value) { $myapp .= '
  • '; $myapp .= ''; $myapp .= ''.$value[title_template].''.dgmdate($value[dateline], 'n-j H:i').'
    '; if($value['image_1']) { $myapp .= ''; } if($value['image_2']) { $myapp .= ''; } if($value['image_3']) { $myapp .= ''; } if($value['image_4']) { $myapp .= ''; } if($value['body_template']) { $myapp .= '
    '; $myapp .= $value[body_template].'
    '; } if($value['body_general']) { $myapp .= '
    '.$value[body_general].'
    '; } $myapp .= '
  • '; } $myapp .= '
'; } return $myapp; } } class plugin_myapp_userapp extends plugin_myapp { function userapp_update() { global $_G; if(!empty($_GET['id']) && is_numeric($_GET['id'])) { $applist = array(); $userapp = C::t('home_userapp_plying')->fetch($_G['uid']); if(!empty($userapp['appid'])) { $applist = explode(',', $userapp['appid']); if(!empty($applist)) { $applist = array_diff($applist, array('')); $key = array_search($_GET['id'], $applist); if($key !== false) { unset($applist[$key]); } array_unshift($applist, $_GET['id']); while(count($applist) > $this->num) { array_pop($applist); } } } if(empty($applist)) { $applist = array($_GET['id']); } if(!empty($applist)) { $appstr = implode(',', $applist); C::t('home_userapp_plying')->insert(array('uid' => $_G['uid'], 'appid' => daddslashes($appstr)), false, true); } } } }