Dotclear

source: plugins/carnaval/edit.php @ 556

Revision 556, 3.2 KB checked in by Osku, 15 years ago (diff)

Carnaval 1.2RC - finally blowup friendly

Line 
1<?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
2/***************************************************************\
3 *  This is 'Carnaval', a plugin for Dotclear 2                *
4 *                                                             *
5 *  Copyright (c) 2007-2008                                    *
6 *  Osku and contributors.                                     *
7 *                                                             *
8 *  This is an open source software, distributed under the GNU *
9 *  General Public License (version 2) terms and  conditions.  *
10 *                                                             *
11 *  You should have received a copy of the GNU General Public  *
12 *  License along with 'Carnaval' (see COPYING.txt);           *
13 *  if not, write to the Free Software Foundation, Inc.,       *
14 *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    *
15\***************************************************************/
16if (!defined('DC_CONTEXT_ADMIN')) { return; }
17
18$id = $_REQUEST['id'];
19$can_write_images = carnavalConfig::canWriteImages();
20
21try {
22     $rs = dcCarnaval::getClass($id);
23} catch (Exception $e) {
24     $core->error->add($e->getMessage());
25}
26
27if ($core->error->flag() || $rs->isEmpty()) {
28     $core->error->add(__('No such Class'));
29} else {
30     $comment_author = $rs->comment_author;
31     $comment_author_mail = $rs->comment_author_mail;
32     $comment_author_site = $rs->comment_author_site;
33     $comment_class = $rs->comment_class;
34     $comment_text_color = $rs->comment_text_color;
35     $comment_background_color = $rs->comment_background_color;
36}
37
38# Update a link
39if (isset($rs) && !empty($_POST['edit_class']))
40{
41     $comment_author = $_POST['comment_author'];
42     $comment_author_mail = $_POST['comment_author_mail'];
43     $comment_author_site = $_POST['comment_author_site'];
44     $comment_class = $_POST['comment_class'];
45     $comment_text_color = carnavalConfig::adjustColor($_POST['comment_text_color']);
46     $comment_background_color = carnavalConfig::adjustColor($_POST['comment_background_color']);
47     
48     try {
49          dcCarnaval::updateClass($id,$comment_author,$comment_author_mail,$comment_author_site,$comment_text_color,$comment_background_color,$comment_class);
50          if ($can_write_images)
51          {
52               carnavalConfig::createImages($comment_background_color,$comment_class);
53          }
54          http::redirect($p_url.'&edit=1&id='.$id.'&upd=1');
55     } catch (Exception $e) {
56          $core->error->add($e->getMessage());
57     }
58}
59
60?>
61<html><head>
62  <title>Carnaval</title>
63  <?php echo dcPage::jsColorPicker(); ?>
64</head><body>
65<?php
66require dirname(__FILE__).'/forms.php';
67echo '<p><a class="back" href="'.$p_url.'">'.__('Return to Carnaval').'</a></p>';
68
69if (isset($rs))
70{
71     if (!empty($_GET['upd'])) {
72          echo '<p class="message">'.__('CSS Class has been successfully updated').'</p>';
73     }
74     
75     echo
76     '<form action="plugin.php" method="post">'.
77     '<fieldset class="two-cols"><legend>'.__('Edit Class').'</legend>'.
78     $forms['form_fields'].
79     '<p>'.form::hidden('edit',1).form::hidden('id',$id).
80     form::hidden('p','carnaval').$core->formNonce().
81     '<input type="submit" accesskey="s" name="edit_class" class="submit" value="'.__('save').' (s)"/></p>'.
82     '</fieldset>'.
83     '</form>';
84}
85?>
86
87<?php dcPage::helpBlock('carnaval');?>
88</body>
89</html>
Note: See TracBrowser for help on using the repository browser.

Sites map