[ Index ]
 

Code source de Plume CMS 1.2.2

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/manager/tools/link/ -> edit_link.php (source)

   1  <?php
   2  /*

   3  # ***** BEGIN LICENSE BLOCK *****

   4  # This file is part of Plume CMS, a website management application.

   5  # Copyright (C) 2001-2005 Loic d'Anterroches and contributors.

   6  #

   7  # Plume CMS is free software; you can redistribute it and/or modify

   8  # it under the terms of the GNU General Public License as published by

   9  # the Free Software Foundation; either version 2 of the License, or

  10  # (at your option) any later version.

  11  #

  12  # Plume CMS is distributed in the hope that it will be useful,

  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of

  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

  15  # GNU General Public License for more details.

  16  #

  17  # The Initial Developer of the Original Code is

  18  # Olivier Meunier.

  19  # Portions created by the Initial Developer are Copyright (C) 2003

  20  # the Initial Developer. All Rights Reserved.

  21  #

  22  # Contributor(s):

  23  # - Sebastien Fievet

  24  #

  25  # You should have received a copy of the GNU General Public License

  26  # along with this program; if not, write to the Free Software

  27  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

  28  #

  29  # ***** END LICENSE BLOCK ***** */

  30  

  31  $id = $_REQUEST['id'];

  32  

  33  $rs =& $link->getEntry($id);

  34  

  35  $l_label = $rs->f('label');

  36  $l_href = $rs->f('href');

  37  $l_title = $rs->f('title');

  38  $l_lang = $rs->f('lang');

  39  $l_rel = $rs->f('rel');

  40  $l_position = $rs->f('position');

  41  

  42  if (!$rs->isEmpty() && $action == 'edit_link')

  43  {

  44      $l_label = trim($_POST['l_label']);

  45      $l_title = trim($_POST['l_title']);

  46      $l_href = trim($_POST['l_href']);

  47      $l_lang = trim($_POST['l_lang']);

  48      $l_cat = isset($_POST['l_cat']) ? trim($_POST['l_cat']) : '-1';

  49      $old_cat = isset($_POST['old_cat']) ? trim($_POST['old_cat']) : '-1';

  50      

  51      if (!$l_label || !$l_href)

  52      {

  53          $err = __('You must provide at least a label and an URL');

  54      }

  55      elseif (!$link->isURI($l_href, array('domain_check' => false, 'allowed_schemes' => $link->protocols))) {

  56          $err = __('You must provide a valid URL');

  57      }

  58      else

  59      {

  60  

  61          $rel = '';

  62          

  63          if (isset($_POST['identity'])) {

  64              $rel .= $_POST['identity'];

  65          } else {

  66              if(isset($_POST['friendship']))        $rel .= ' '.$_POST['friendship'];

  67              if(isset($_POST['physical']))        $rel .= ' met';

  68              if(isset($_POST['professional']))    $rel .= ' '.implode(' ',$_POST['professional']);

  69              if(isset($_POST['geographical']))    $rel .= ' '.$_POST['geographical'];

  70              if(isset($_POST['family']))            $rel .= ' '.$_POST['family'];

  71              if(isset($_POST['romantic']))        $rel .= ' '.implode(' ',$_POST['romantic']);

  72          }

  73  

  74          if ($link->updLink($id,$l_label,$l_href,$l_title,$l_lang, $rel, $l_cat, $old_cat) == false) {

  75              $err = $link->con->error();

  76          } else {

  77              header('Location: '.$url);

  78              exit;

  79          }

  80      }

  81  }

  82  

  83  # Affichage

  84  $px_submenu->addItem(

  85      '<strong>'.__('Back').'</strong>',array($url),$icon,false);

  86  

  87  echo('<h2>'.__('Edit link').'</h2>');

  88  

  89  if ($err != '') {

  90      echo(

  91      '<div class="erreur"><p><strong>'.__('Error(s)').' :</strong></p>'.

  92      '<p>'.$err.'</p>'.

  93      '</div>'

  94      );

  95  }

  96  

  97  if ($rs->isEmpty())

  98  {

  99      echo('<p>'.__('No link').'</p>');

 100  }

 101  else

 102  {

 103      # Affichage du formulaire

 104      echo (

 105      '<form action="'.$url.'" method="post">'.

 106      '<fieldset><legend>'.__('Edit link').'</legend>'.

 107      '<p class="field"><strong>'.

 108      '<label for="l_label" class="float">'.__('Label').' : </label></strong>'.

 109      form::textField('l_label',40,255,htmlspecialchars($l_label)).'</p>'.

 110      

 111      '<p class="field"><strong>'.

 112      '<label for="l_href" class="float">'.__('URL').' : </label></strong>'.

 113      form::textField('l_href',40,255,htmlspecialchars($l_href)).'</p>'.

 114      

 115      '<p class="field">'.

 116      '<label for="l_title" class="float">'.__('Description').' ('.__('optional').') : </label>'.

 117      form::textField('l_title',40,255,htmlspecialchars($l_title)).'</p>'.

 118      

 119      '<p class="field">'.

 120      '<label for="l_lang" class="float">'.__('Language').' ('.__('optional').') : </label>'.

 121      form::textField('l_lang',2,2,htmlspecialchars($l_lang)) . '</p>'.

 122      

 123      '<p>'.form::hidden('action','edit_link').

 124      form::hidden('page','edit_link').

 125      form::hidden('id',$id).

 126      '<input type="submit" class="submit" value="'.__('save').'"/></p>'.

 127      '</fieldset>'.

 128  

 129      '<fieldset><legend>'.__('XFN').'</legend>'.

 130  

 131      '<p class="field">'.

 132      '<label class="float">'.__('Me').'</label>'.

 133      form::checkbox('identity', 'me', ($l_rel == 'me')).__('Another link for myself').'</p>'.

 134      

 135      '<p class="field">'.

 136      '<label class="float">'.__('Friendship').'</label>'.

 137      form::radio('friendship', 'contact', (strpos($l_rel, 'contact'))).__('Contact').

 138      form::radio('friendship', 'acquaintance', (strpos($l_rel, 'acquaintance'))).__('Acquaintance').

 139      form::radio('friendship', 'friend', (strpos($l_rel, 'friend'))).__('Friend').

 140      form::radio('friendship', '').__('None').

 141      '</p>'.

 142  

 143      '<p class="field">'.

 144      '<label class="float">'.__('Physical').'</label>'.

 145      form::checkbox('physical', 'met', (strpos($l_rel, 'met'))).__('Met').

 146      '</p>'.

 147  

 148      '<p class="field">'.

 149      '<label class="float">'.__('Professional').'</label>'.

 150      form::checkbox('professional[1]', 'co-worker', (strpos($l_rel, 'co-worker'))).__('Co-worker').

 151      form::checkbox('professional[2]', 'colleague', (strpos($l_rel, 'colleague'))).__('Colleague').

 152      '</p>'.

 153  

 154      '<p class="field">'.

 155      '<label class="float">'.__('Geographical').'</label>'.

 156      form::radio('geographical', 'co-resident', (strpos($l_rel, 'co-resident'))).__('Co-resident').

 157      form::radio('geographical', 'neighbor', (strpos($l_rel, 'neighbor'))).__('Neighbor').

 158      form::radio('geographical', '').__('None').

 159      '</p>'.

 160  

 161      '<p class="field">'.

 162      '<label class="float">'.__('Family').'</label>'.

 163      form::radio('family', 'child', (strpos($l_rel, 'child'))).__('Child').

 164      form::radio('family', 'parent', (strpos($l_rel, 'parent'))).__('Parent').

 165      form::radio('family', 'sibling', (strpos($l_rel, 'sibling'))).__('Sibling').

 166      form::radio('family', 'spouse', (strpos($l_rel, 'spouse'))).__('Spouse').

 167      form::radio('family', 'kin', (strpos($l_rel, 'kin'))).__('Kin').

 168      form::radio('family', '').__('None').

 169      '</p>'.

 170  

 171      '<p class="field">'.

 172      '<label class="float">'.__('Romantic').'</label>'.

 173      form::checkbox('romantic[1]', 'muse', (strpos($l_rel, 'muse'))).__('Muse').

 174      form::checkbox('romantic[2]', 'crush', (strpos($l_rel, 'crush'))).__('Crush').

 175      form::checkbox('romantic[3]', 'date', (strpos($l_rel, 'date'))).__('Date').

 176      form::checkbox('romantic[4]', 'sweetheart', (strpos($l_rel, 'sweetheart'))).__('Sweetheart').

 177      '</p>'.

 178      '</fieldset>'.

 179  

 180      '</form>'

 181      );

 182  }

 183  ?>



Généré le : Mon Nov 26 11:57:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics