Example #1
0
     $bwzt['related'] = array();
 }
 if ($bwzt['tag'] && empty($bwzt['related'])) {
     @(include_once S_ROOT . './data/data_tagtpl.php');
     $b_tagids = $b_tags = $bwzt['related'] = array();
     $tag_count = -1;
     foreach ($bwzt['tag'] as $key => $value) {
         $b_tags[] = $value;
         $b_tagids[] = $key;
         $tag_count++;
     }
     if (!empty($_SCONFIG['uc_tagrelated']) && $_SCONFIG['uc_status']) {
         if (!empty($_SGLOBAL['tagtpl']['limit'])) {
             include_once S_ROOT . './uc_client/client.php';
             $tag_index = mt_rand(0, $tag_count);
             $bwzt['related'] = uc_tag_get($b_tags[$tag_index], $_SGLOBAL['tagtpl']['limit']);
         }
     } else {
         //自身TAG
         $tag_bwztids = array();
         $query = $_SGLOBAL['db']->query("SELECT DISTINCT bwztid FROM " . tname('tagbwzt') . " WHERE tagid IN (" . simplode($b_tagids) . ") AND bwztid<>'{$bwzt['bwztid']}' ORDER BY bwztid DESC LIMIT 0,10");
         while ($value = $_SGLOBAL['db']->fetch_array($query)) {
             $tag_bwztids[] = $value['bwztid'];
         }
         if ($tag_bwztids) {
             $query = $_SGLOBAL['db']->query("SELECT uid,username,subject,bwztid FROM " . tname('bwzt') . " WHERE bwztid IN (" . simplode($tag_bwztids) . ")");
             while ($value = $_SGLOBAL['db']->fetch_array($query)) {
                 realname_set($value['uid'], $value['username']);
                 //实名
                 $value['url'] = "space.php?uid={$value['uid']}&do=bwzt&id={$value['bwztid']}";
                 $bwzt['related'][UC_APPID]['data'][] = $value;
Example #2
0
 $query = $db->query("SELECT tagname FROM {$tablepre}threadtags WHERE tid='{$rtid}'");
 while ($tags = $db->fetch_array($query)) {
     $threadtag[] = $tags['tagname'];
 }
 if ($threadtag) {
     $requesttag = $threadtag[array_rand($threadtag)];
 } else {
     @(include_once DISCUZ_ROOT . './forumdata/cache/cache_viewthread.php');
     $requesttag = $db->result_first("SELECT tagname FROM {$tablepre}tags LIMIT " . rand(0, $_DCACHE['tags'][2] - 1) . ", 1", 0);
 }
 if (empty($requesttag)) {
     exit;
 }
 include_once DISCUZ_ROOT . './uc_client/client.php';
 include_once template('relatetag');
 $datalist = uc_tag_get($requesttag, $relatedtag['limit']);
 $write = '';
 if (is_array($datalist)) {
     if (empty($datalist)) {
         @(include_once DISCUZ_ROOT . './uc_client/data/cache/apps.php');
         if (is_array($_CACHE['apps'])) {
             foreach ($_CACHE['apps'] as $app) {
                 if (array_key_exists($app['appid'], $relatedtag['limit'])) {
                     $datalist[$app['appid']] = array('data' => array(), 'type' => $app['type']);
                 }
             }
         }
     }
     $count = 0;
     foreach ($datalist as $appid => $data) {
         $tagdata = '';