[ Index ] |
|
Code source de Dotclear 1.2.5 |
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 23 class blogroll 24 { 25 var $con; 26 var $blog; 27 var $table; 28 29 function blogroll(&$blog,$prefix) 30 { 31 $this->con = $blog->con; 32 $this->blog = $blog; 33 $this->table = $prefix.'link'; 34 } 35 36 function addLink($label,$href,$title='',$lang='') 37 { 38 $strReq = 'SELECT MAX(position) '. 39 'FROM '.$this->table; 40 41 if (($rs = $this->con->select($strReq)) === false) { 42 return false; 43 } 44 45 $position = $rs->f(0); 46 47 $insReq = 'INSERT INTO '.$this->table.' '. 48 '(label, href, title, lang, position) VALUES '. 49 '(\''.$this->con->escapeStr($label).'\', '. 50 '\''.$this->con->escapeStr($href).'\', '. 51 '\''.$this->con->escapeStr($title).'\', '. 52 '\''.$this->con->escapeStr($lang).'\', '. 53 '\''.(integer) $position.'\')'; 54 55 if ($this->con->execute($insReq) === false) { 56 return false; 57 } 58 59 $this->blog->triggerMassUpd(); 60 return true; 61 } 62 63 function updLink($link_id,$label,$href,$title='',$lang='', $rel='') 64 { 65 $updReq = 'UPDATE '.$this->table.' SET '. 66 'label = \''.$this->con->escapeStr($label).'\','. 67 'href = \''.$this->con->escapeStr($href).'\','. 68 'title = \''.$this->con->escapeStr($title).'\','. 69 'lang = \'' . $this->con->escapeStr($lang).'\','. 70 'rel = \'' . $this->con->escapeStr($rel).'\''. 71 'WHERE link_id = '.$link_id; 72 73 if ($this->con->execute($updReq) === false) { 74 return false; 75 } 76 77 $this->blog->triggerMassUpd(); 78 return true; 79 } 80 81 # Suppression (lien ou catégorie) 82 function delEntry($link_id) 83 { 84 $delReq = 'DELETE FROM '.$this->table.' '. 85 'WHERE link_id = '.$link_id; 86 87 if ($this->con->execute($delReq) === false) { 88 return false; 89 } 90 91 $this->blog->triggerMassUpd(); 92 return true; 93 } 94 95 # Création de catégorie 96 function addCat($title) 97 { 98 return $this->addLink('','',$title,''); 99 } 100 101 # Modification de catégories 102 function updCat($id,$title) 103 { 104 return $this->updLink($id,'','',$title,''); 105 } 106 107 # Ordonner les entrées 108 function ordEntries($ord) 109 { 110 if (!is_array($ord)) { 111 return false; 112 } 113 114 foreach ($ord as $k => $v) 115 { 116 $updReq = 'UPDATE '.$this->table.' SET '. 117 'position = '.(integer) $v.' '. 118 'WHERE link_id = '.(integer) $k; 119 120 if (!$this->con->execute($updReq)) { 121 return false; 122 } 123 } 124 125 $this->blog->triggerMassUpd(); 126 return true; 127 } 128 } 129 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Feb 23 21:40:15 2007 | par Balluche grâce à PHPXref 0.7 |