This repository has been archived on 2024-07-18. You can view files and clone it, but cannot push or open issues or pull requests.
lwb5/scripts/game/main/manual/library/getPageId.inc

32 lines
691 B
PHP
Raw Permalink Normal View History

2016-01-10 11:01:49 +01:00
<?php
class main_manual_getPageId {
function main_manual_getPageId($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
function run($secId) {
// Find the section itself
$q = $this->db->query("SELECT is_page,in_section FROM man_section WHERE id=$secId");
if (!($q && dbCount($q) == 1)) {
return null;
}
list($isPage, $parentId) = dbFetchArray($q);
// Find the page in which the section is
while ($isPage != 't') {
$q = $this->db->query("SELECT id,is_page,in_section FROM man_section WHERE id=$parentId");
if (!($q && dbCount($q) == 1)) {
return null;
}
list($secId, $isPage, $parentId) = dbFetchArray($q);
}
return $secId;
}
}
?>