Пример #1
0
 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');
     $data = htmlentities($data, null, 'UTF-8');
     $filter = htmlentities($filter, null, 'UTF-8');
     $published = htmlentities($published, null, 'UTF-8');
     if ($post[0]->type == "post") {
         $options = '<option value="post" selected="selected">post</option><option value="page">page</option>';