static function __init($id = false) { global $globals, $db; self::$info = false; if ($id > 0) { self::$id = $id; } elseif (!isset($globals['site_id'])) { if (empty($globals['site_shortname'])) { echo "Error, site_shortname not found, check your global['site_shortname']: " . $globals['site_shortname']; } self::$info = $db->get_row("select * from subs where name = '" . $globals['site_shortname'] . "'"); if (self::$info) { self::$id = self::$info->id; } else { self::$id = 0; return; } } else { self::$id = $globals['site_id']; } if (self::$info == false) { self::$info = $db->get_row("select * from subs where id = " . self::$id); } self::$parent = self::$info->created_from; if (self::$id > 0) { $db->query('set @site_id = ' . self::$id); } }