00001 <?php 00002 /* 00003 * Copyright (C) 2003-2004 Polytechnique.org 00004 * http://opensource.polytechnique.org/ 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00021 00031 class Diogenes_Barrel_Options 00032 { 00034 var $barrel; 00035 00037 var $table_option = 'diogenes_option'; 00038 00040 var $title = ""; 00041 00043 var $description = ""; 00044 00046 var $favicon = ""; 00047 00049 var $keywords = ""; 00050 00052 var $menu_hide_diogenes = 0; 00053 00055 var $menu_min_level = 0; 00056 00058 var $menu_style = 0; 00059 00061 var $menu_theme = "gorilla"; 00062 00064 var $template = ""; 00065 00067 var $template_dir = ""; 00068 00070 var $feed_enable = 0; 00071 00074 function Diogenes_Barrel_Options($alias) 00075 { 00076 $this->barrel = $alias; 00077 $this->readOptions(); 00078 } 00079 00080 00083 function readOptions() { 00084 global $globals; 00085 00086 // we only accept options which already exist in this class 00087 $res = $globals->db->query("select name,value from {$this->table_option} where barrel='{$this->barrel}'"); 00088 while (list($key,$value) = mysql_fetch_row($res)) { 00089 if (isset($this->$key) && ($key != "table_option")) 00090 $this->$key = $value; 00091 } 00092 mysql_free_result($res); 00093 00094 } 00095 00096 00099 function updateOption($name, $value) { 00100 global $globals; 00101 00102 $this->$name = stripslashes($value); 00103 $globals->db->query("replace into {$this->table_option} set barrel='{$this->barrel}',name='$name',value='$value'"); 00104 } 00105 00106 } 00107 00108 ?>
1.5.1