Пример #1
0
     foreach ($resultset as $res) {
         echo "<tr><td><a href='?p=contentedit&amp;id={$res->id}' class='aButton' style='width:50px; margin:0 auto; display:block;'>Editera</a></td><td>{$res->id}</td><td>{$res->title}</td></tr>";
     }
     echo "</table>";
 } else {
     if ($uppdate) {
         // Get parameters
         $id = isset($_POST['id']) ? strip_tags($_POST['id']) : (isset($_GET['id']) ? strip_tags($_GET['id']) : null);
         $title = isset($_POST['title']) ? $_POST['title'] : null;
         $slug = isset($_POST['slug']) ? $_POST['slug'] : null;
         $url = isset($_POST['url']) ? strip_tags($_POST['url']) : null;
         $data = isset($_POST['data']) ? $_POST['data'] : array();
         $type = isset($_POST['type']) ? strip_tags($_POST['type']) : array();
         $filter = isset($_POST['filter']) ? $_POST['filter'] : array();
         $published = isset($_POST['published']) ? strip_tags($_POST['published']) : array();
         if ($updatedId = $cont->update($slug, $url, $type, $title, $data, $filter, $published, $id)) {
             echo "Innehåll uppdaterat.<p> <a href='?p=contentedit&amp;id={$updatedId}' class='aButton'>Editera mer</a>";
         }
     } else {
         //get values
         $post = $cont->getContent($id);
         $title = $post[0]->title;
         $slug = $post[0]->slug;
         $url = $post[0]->url;
         $data = $post[0]->data;
         $filter = $post[0]->filter;
         $published = $post[0]->published;
         // Sanitize content before using it.
         $title = htmlentities($title, null, 'UTF-8');
         $slug = htmlentities($slug, null, 'UTF-8');
         $url = htmlentities($url, null, 'UTF-8');
Пример #2
0
<?php

/**
 * This is a Branax pagecontroller.
 *
 */
// Include the essential config-file which also creates the $branax variable with its defaults.
include __DIR__ . '/config.php';
$user = new CUser($branax['database']);
$user->isAuthenticated() or die('Check: You must login to edit.');
$content = new CContent($branax['database']);
// Do it and store it all in variables in the Branax container.
$branax['title'] = "Edit";
$branax['main'] = <<<EOD
<h1>Editera innehåll</h1>
{$content->update()}
EOD;
// Finally, leave it all to the rendering phase of Branax.
include BRANAX_THEME_PATH;