function checkForHeadTopic($toptype, $fid, $selForums) { require_once R_P . 'require/updateforum.php'; list($catedbs, $top_1, $top_2, $top_3) = getForumListForHeadTopic($fid); $topAll = ''; if ($toptype == 0) { return true; } if ($toptype == 1) { $topAll = ',' . implode(',', array_keys((array) $top_1)) . ','; } elseif ($toptype == 2) { $topAll = ',' . implode(',', array_keys((array) $top_2)) . ','; } elseif ($toptype == 3) { $topAll = ',' . implode(',', array_keys((array) $top_3)) . ','; } foreach ((array) $selForums as $key => $value) { if (strpos($topAll, ',' . $value . ',') !== false) { return true; } } return false; }
function setForumsTopped($tid, $fid, $topped, $t = 0) { if ($tid && $fid && $topped > 0) { global $db; list($catedbs, $top_1, $top_2, $top_3) = getForumListForHeadTopic($fid); $topAll = array(); if ($topped == 1) { $topAll = array_keys((array) $top_1); } elseif ($topped == 2) { $topAll = array_keys((array) $top_2); } elseif ($topped == 3) { $topAll = array_keys((array) $top_3); } $_topped = array(); foreach ($topAll as $key => $value) { $_topped[] = array('fid' => $value, 'tid' => $tid, 'pid' => '0', 'floor' => $topped, 'uptime' => $fid, 'overtime' => $t); } !empty($_topped) && $db->update("REPLACE INTO pw_poststopped (fid,tid,pid,floor,uptime,overtime) values " . S::sqlMulti($_topped)); } return $topAll; }