Esempio n. 1
0
     $asearchhtml && ($asearchhtml .= '</span>');
     if (strpos($searchhtml, '</span></span>') !== false) {
         $searchhtml = str_replace('</span></span>', '</span>', $searchhtml);
     }
     if (strpos($asearchhtml, '</span></span>') !== false) {
         $asearchhtml = str_replace('</span></span>', '</span>', $asearchhtml);
     }
     $tablename = GetTopcitable($modelid);
 }
 if ($step == 'search') {
     L::loadClass('posttopic', 'forum', false);
     $searchTopic = new postTopic($field);
     if (!$newfield) {
         $newfield = StrCode(serialize($field));
     }
     list($count, $tiddb, $alltiddb) = $searchTopic->getSearchvalue($newfield, 'one', true, true);
     is_array($tiddb) && ($sql .= " AND tv.tid IN(" . S::sqlImplode($tiddb) . ")");
     is_array($alltiddb) && ($alltids = implode(',', $alltiddb));
 }
 if ($step != 'search' || !$count) {
     $alltiddb = $threadb = $newtiddb = array();
     $query = $db->query("SELECT tid FROM {$tablename} WHERE ifrecycle=0");
     while ($rt = $db->fetch_array($query)) {
         $alltiddb[] = $rt['tid'];
     }
     if ($alltiddb) {
         $query = $db->query("SELECT tid FROM pw_threads WHERE tid IN(" . S::sqlImplode($alltiddb) . ")");
         while ($rt = $db->fetch_array($query)) {
             $threadb[$rt['tid']] = $rt['tid'];
         }
     }
Esempio n. 2
0
         unset($toptids, $L, $limit, $toppeddb);
     } else {
         list($st, $lt, $asc, $R) = getstart($start_limit - $rows, $asc, $count);
         $limit2 = S::sqlLimit($st, $lt);
     }
     unset($rows);
 } else {
     list($st, $lt, $asc, $R) = getstart($start_limit, $asc, $count);
     $limit2 = S::sqlLimit($st, $lt);
 }
 if ($limit2) {
     if ($topicsearch == 1) {
         S::gp(array('searchname', 'new_searchname'));
         $searchname && ($new_searchname = StrCode(serialize($searchname)));
         if ($modelid > 0) {
             list($count, $tiddb, $alltiddb) = $postTopic->getSearchvalue($new_searchname, 'one', true);
         } elseif ($pcid > 0) {
             list($count, $tiddb, $alltiddb) = $postCate->getSearchvalue($new_searchname, 'one', true);
         }
         if ($tiddb) {
             $query = $db->query("SELECT * FROM pw_threads WHERE tid IN (" . S::sqlImplode($tiddb) . ")");
             $urladd = "&topicsearch=1&new_searchname={$new_searchname}";
             while ($thread = $db->fetch_array($query)) {
                 $tpcdb[] = $thread;
             }
             $db->free_result($query);
         }
     } else {
         $topadd && ($topadd .= $R ? ' ASC,' : ' DESC,');
         $query = $db->query("SELECT * FROM pw_threads WHERE {$sql} {$searchadd} ORDER BY {$topadd} {$orderway} {$asc} {$limit2}");
         while ($thread = $db->fetch_array($query)) {