public function execute() { $back = ''; $write = false; if (true === isset($_GET['delete'])) { $write = true; if (false === GWF_PageLinks::deleteLink($_GET['delete'])) { $back .= $this->module->error('err_deleting_failed'); } } if (true === isset($_POST['add'])) { $url = Common::getPostString('url'); $href = Common::getPostString('href'); if ('' !== $url && '' !== $href) { if ($url[0] === '/') { $url = substr($url, 1); } if (true === GWF_PB_Rewrites::matchURL(Common::substrUntil(GWF_PB_Rewrites::replaceRewriteURL($url), '/'))) { $back .= $this->module->error('err_url_exists'); } else { $write = true; GWF_PageLinks::insertLink($url, $href); } } else { $back .= $this->module->error('err_parame'); } } if (true === $write && false === $this->module->writeHTA()) { $back .= $this->module->error('err_htaccess_writing'); } return $back . $this->templateLinks(); }
public function getHTAccess() { require_once GWF_CORE_PATH . 'module/PageBuilder/GWF_Page.php'; require_once GWF_CORE_PATH . 'module/PageBuilder/GWF_PB_Rewrites.php'; $pages = GDO::table('GWF_Page')->selectAll('page_id, page_url', 'page_options&1', '', NULL, -1, -1, GDO::ARRAY_N); $back = ''; if (0 !== ($hpid = $this->module->cfgHomePage())) { $back .= "RewriteRule ^\$ index.php?mo=PageBuilder&me=Show&pageid={$hpid}" . PHP_EOL; } foreach ($pages as $page) { $url = GWF_PB_Rewrites::replaceRewriteURL($page[1]); $back .= "RewriteRule ^{$url}/?\$ index.php?mo=PageBuilder&me=Show&pageid={$page[0]}" . PHP_EOL; } return $back; }