public function login() { if (isset($_SESSION['userid'])) { Functions::redirect(Settings::cloutURL() . '/home'); } View::Render('login', $this->data, Settings::viewFolder()); }
public function store($section) { $section = Section::find($section, 'slug'); $slug = Functions::urlSafe($_POST['f' . $section->slugfield()->id]); $unique_slug = false; while (!$unique_slug) { if ($section->checkslug($slug)) { $unique_slug = true; } else { $slug .= '-'; } } $record = new Record(); $record->section = $section->id; $record->slug = $slug; $record->save(); $this->store_data($section, $record); Functions::redirect(Settings::cloutURL() . '/sections/' . $section->slug); }
echo \GraftPHP\Clout\Settings::cloutURL(); ?> /_/style.css" rel="stylesheet"> {css} </head> <body class="uk-height-1-1"> <div class="uk-grid uk-height-1-1"> <div class="uk-width-1-5 uk-height-1-1"> <?php require 'components/nav.php'; ?> </div> <div class="uk-width-4-5"> <div class="uk-container uk-container-center"> {body} </div> </div> </div> <script src="<?php echo \GraftPHP\Clout\Settings::cloutURL(); ?> /_/script.js"></script> {script} </body> </html>
public function update($section_id) { $section = Section::find($section_id, 'id'); $section->name = $_POST['name']; $section->slug = Functions::URLSafe($_POST['name']); $section->save(); // delete fields not in the POST data foreach ($section->fields() as $field) { $del = true; if (isset($_POST['field-id'])) { for ($f = 1; $f < count($_POST['field-id']); $f++) { if (intval($field->id) == intval($_POST['field-id'][$f])) { $del = false; } } } if ($del) { $field->delete(); } } // add/update fields in the POST data if (count($_POST['field-name']) > 1) { for ($f = 0; $f < count($_POST['field-id']); $f++) { $field = new Field(); $field->id = $_POST['field-id'][$f] != '' ? $_POST['field-id'][$f] : null; $field->section = $section->id; $field->name = $_POST['field-name'][$f]; $field->type = $_POST['field-type'][$f]; $field->order = $_POST['field-order'][$f]; $field->list = $_POST['field-list'][$f]; $field->slug = $_POST['field-slug'][$f]; $field->save(); } } Functions::redirect(Settings::cloutURL() . '/settings/sections/' . $section->id); }
public function delete() { session_destroy(); Functions::redirect(Settings::cloutURL()); }