edit_link.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?php
  2. # ***** BEGIN LICENSE BLOCK *****
  3. # This file is part of DotClear.
  4. # Copyright (c) 2004 Olivier Meunier and contributors. All rights
  5. # reserved.
  6. #
  7. # DotClear 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. # DotClear 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. # You should have received a copy of the GNU General Public License
  18. # along with DotClear; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. #
  21. # ***** END LICENSE BLOCK *****
  22. $id = $_REQUEST['id'];
  23. $strReq = 'SELECT link_id, label, href, title, lang, rel '.
  24. 'FROM '.$blogroll->table.' '.
  25. 'WHERE link_id = '.$id;
  26. $rs = $con->select($strReq);
  27. $l_label = $rs->f('label');
  28. $l_href = $rs->f('href');
  29. $l_title = $rs->f('title');
  30. $l_lang = $rs->f('lang');
  31. $l_rel = $rs->f('rel');
  32. if (!$rs->isEmpty() && $action == 'edit_link')
  33. {
  34. $l_label = trim($_POST['l_label']);
  35. $l_title = trim($_POST['l_title']);
  36. $l_href = trim($_POST['l_href']);
  37. $l_lang = trim($_POST['l_lang']);
  38. if (!$l_label || !$l_href)
  39. {
  40. $err = __('You must provide at least a label and an URL');
  41. }
  42. else
  43. {
  44. $rel = '';
  45. if (isSet($_POST['identity']))
  46. $rel .= $_POST['identity'];
  47. else {
  48. if(isSet($_POST['friendship'])) $rel .= ' '.$_POST['friendship'];
  49. if(isSet($_POST['physical'])) $rel .= ' met';
  50. if(isSet($_POST['professional'])) $rel .= ' '.implode(' ',$_POST['professional']);
  51. if(isSet($_POST['geographical'])) $rel .= ' '.$_POST['geographical'];
  52. if(isSet($_POST['family'])) $rel .= ' '.$_POST['family'];
  53. if(isSet($_POST['romantic'])) $rel .= ' '.implode(' ',$_POST['romantic']);
  54. }
  55. if ($blogroll->updLink($id,$l_label,$l_href,$l_title,$l_lang, $rel) == false) {
  56. $err = $blogroll->con->error();
  57. } else {
  58. header('Location: '.$url);
  59. exit;
  60. }
  61. }
  62. }
  63. # Affichage
  64. $mySubMenu->addItem(
  65. '<strong>'.__('Back').'</strong>',array($url),$icon,false);
  66. buffer::str('<h2>'.__('Edit link').'</h2>');
  67. if ($err != '') {
  68. buffer::str(
  69. '<div class="erreur"><p><strong>'.__('Error(s)').' :</strong></p>'.
  70. '<p>'.$err.'</p>'.
  71. '</div>'
  72. );
  73. }
  74. if ($rs->isEmpty())
  75. {
  76. buffer::str('<p>'.__('No link').'</p>');
  77. }
  78. else
  79. {
  80. buffer::str(
  81. '<form action="'.$url.'" method="post">'.
  82. '<fieldset><legend>'.__('Edit link').'</legend>'.
  83. '<p class="field"><strong>'.
  84. '<label for="l_label" class="float">'.__('Label').' : </label></strong>'.
  85. form::field('l_label',40,255,htmlspecialchars($l_label)).'</p>'.
  86. '<p class="field"><strong>'.
  87. '<label for="l_href" class="float">'.__('URL').' : </label></strong>'.
  88. form::field('l_href',40,255,htmlspecialchars($l_href)).'</p>'.
  89. '<p class="field">'.
  90. '<label for="l_title" class="float">'.__('Description').' ('.__('optional').') : </label>'.
  91. form::field('l_title',40,255,htmlspecialchars($l_title)).'</p>'.
  92. '<p class="field">'.
  93. '<label for="l_lang" class="float">'.__('Language').' ('.__('optional').') : </label>'.
  94. form::field('l_lang',2,2,htmlspecialchars($l_lang)) . '</p>'.
  95. '<p>'.form::hidden('action','edit_link').
  96. form::hidden('page','edit_link').
  97. form::hidden('id',$id).
  98. '<input type="submit" class="submit" value="'.__('save').'"/></p>'.
  99. '</fieldset>'.
  100. '<fieldset><legend>'.__('XFN').'</legend>'.
  101. '<p class="field">'.
  102. '<label class="float">'.__('Me').'</label>'.
  103. form::checkbox('identity', 'me', ($l_rel == 'me')).__('Another link for myself').'</p>'.
  104. '<p class="field">'.
  105. '<label class="float">'.__('Friendship').'</label>'.
  106. form::radio('friendship', 'contact', (strpos($l_rel, 'contact'))).__('Contact').
  107. form::radio('friendship', 'acquaintance', (strpos($l_rel, 'acquaintance'))).__('Acquaintance').
  108. form::radio('friendship', 'friend', (strpos($l_rel, 'friend'))).__('Friend').
  109. form::radio('friendship', '').__('None').
  110. '</p>'.
  111. '<p class="field">'.
  112. '<label class="float">'.__('Physical').'</label>'.
  113. form::checkbox('physical', 'met', (strpos($l_rel, 'met'))).__('Met').
  114. '</p>'.
  115. '<p class="field">'.
  116. '<label class="float">'.__('Professional').'</label>'.
  117. form::checkbox('professional[1]', 'co-worker', (strpos($l_rel, 'co-worker'))).__('Co-worker').
  118. form::checkbox('professional[2]', 'colleague', (strpos($l_rel, 'colleague'))).__('Colleague').
  119. '</p>'.
  120. '<p class="field">'.
  121. '<label class="float">'.__('Geographical').'</label>'.
  122. form::radio('geographical', 'co-resident', (strpos($l_rel, 'co-resident'))).__('Co-resident').
  123. form::radio('geographical', 'neighbor', (strpos($l_rel, 'neighbor'))).__('Neighbor').
  124. form::radio('geographical', '').__('None').
  125. '</p>'.
  126. '<p class="field">'.
  127. '<label class="float">'.__('Family').'</label>'.
  128. form::radio('family', 'child', (strpos($l_rel, 'child'))).__('Child').
  129. form::radio('family', 'parent', (strpos($l_rel, 'parent'))).__('Parent').
  130. form::radio('family', 'sibling', (strpos($l_rel, 'sibling'))).__('Sibling').
  131. form::radio('family', 'spouse', (strpos($l_rel, 'spouse'))).__('Spouse').
  132. form::radio('family', 'kin', (strpos($l_rel, 'kin'))).__('Kin').
  133. form::radio('family', '').__('None').
  134. '</p>'.
  135. '<p class="field">'.
  136. '<label class="float">'.__('Romantic').'</label>'.
  137. form::checkbox('romantic[1]', 'muse', (strpos($l_rel, 'muse'))).__('Muse').
  138. form::checkbox('romantic[2]', 'crush', (strpos($l_rel, 'crush'))).__('Crush').
  139. form::checkbox('romantic[3]', 'date', (strpos($l_rel, 'date'))).__('Date').
  140. form::checkbox('romantic[4]', 'sweetheart', (strpos($l_rel, 'sweetheart'))).__('Sweetheart').
  141. '</p>'.
  142. '</fieldset>'.
  143. '</form>'
  144. );
  145. }
  146. ?>