2016-01-10 11:01:49 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class main_manual_getPageId {
|
|
|
|
|
2024-12-31 00:25:05 +01:00
|
|
|
public function __construct($lib) {
|
2016-01-10 11:01:49 +01:00
|
|
|
$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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|