/** * @return void */ public function show() { $editing = false; if (Team::isSuperAdmin()) { $editing = HTMLResponse::fromGET('edit', ''); if (!$editing) { ?> <a href="<?=HTMLResponse::getRoute()?>?edit=1"> Editar página </a> <? } else { ?> <a href="<?=HTMLResponse::getRoute()?>" onclick="return confirm('Quieres descartar los cambios?')"> Descartar y volver a la página </a> <? } ?> <div style="height: 6px"></div> <? } $content = Setting::getKey('rules_content'); if (!$editing) { ?><div class="inblock" style="margin: 0 auto; max-width: 90%; text-align: justify"> <?=$content?> </div><? } else { if (!$csrf = $_SESSION['csrf']) { $_SESSION['csrf'] = $csrf = rand(1, 1000000); } if (HTMLResponse::fromGETorPOST('csrf', '') == $csrf) { $content = HTMLResponse::fromPOST('content'); Setting::setKey('rules_content', $content); HTMLResponse::exitWithRoute(HTMLResponse::getRoute()); } $this->design->addJavaScript('//cdn.ckeditor.com/4.5.7/full/ckeditor.js'); $this->design->addJavaScript(" CKEDITOR.replace( 'editor' ) ", false); ?> <form action="<?=HTMLResponse::getRoute()?>?edit=1" method="post"> <div style="width:90%; margin: 0 auto"> <textarea name="content" id="editor"><?=htmlentities($content)?></textarea> </div> <br> <input type="hidden" name="csrf" value="<?=$csrf?>"> <button type="submit">Guardar cambios</button> </form> <? } }
public function setDesign(PublicDesign $response) { $response->setSeason($this->season); }
$router->addRoute("/", array('Index')); $router->addRoute("/batch/", array('Batch')); $router->addRoute("/{$rDir}/jornadas/{$rNum}/", array('Season_Index')); $router->addRoute("/{$rDir}/equipos/", array('Teams')); $router->addRoute("/{$rDir}/equipos/{$rDir}/", array('Team_Index')); $router->addRoute("/{$rDir}/clasificacion/", array('Ranking')); $router->addRoute("/{$rDir}/quiniela/", array('BetsRanking')); $router->addRoute("/{$rDir}/calendario/", array('Calendar')); $router->addRoute("/{$rDir}/", array('Season_Index')); $router->addRoute(".*", array('Error_404')); $route = HTMLResponse::getRoute(); $indent = $router->process($route); if ($indent) { $indentClass = $indent[0]; $indentDir = dirname(str_replace("_", "/", $indentClass)); $indentFile = str_replace("//", "", "pages/{$indentDir}/{$indentClass}.php"); $indentParams = array_slice($indent, 1); if (file_exists("pages/{$indentDir}/{$indentDir}.php")) { require_once "pages/{$indentDir}/{$indentDir}.php"; } if (file_exists($indentFile)) { require_once $indentFile; } $r = new ReflectionClass($indentClass); /** * @var $section PublicSection */ $section = $r->newInstanceArgs($indentParams); $response = new PublicDesign($section); $response->show(); }