Doc = &$Doc; $this->DBObj = SiteMap::getObj('Sponsor/Sponsor.php', @$_REQUEST['id']); $this->DBObj->filter = array('active'=>'y', 'id_type' => 1); if (isset($_REQUEST['id']) && intval($_REQUEST['id'])) { $this->doClick(); } else { $this->doList(); } } function doList() { require_once('class/DB/List/List.php'); $DB_List = new DB_List($this->Doc, $this->DBObj, $this->functionalFields); $DB_List->ipp = 999999999; $DB_List->def_order_by = 'sorter'; $DB_List->tpl = SiteMap::getPath('Sponsor/tpl/List/list.tpl'); $DB_List->exec(); } function doClick() { $this->DBObj->initFromDB(); $data = $this->DBObj->getData(); if (empty($data['url'])) { $this->Doc->addContent(array('tpl'=>'msg_error.tpl', 'text'=>'Invalid request')); return; } $this->DBObj->click(); if (!$data['isUrl']) { die(); } require_once('class/HTTP.php'); skHTTP::redirect($data['url']); } }