1 | <?php |
---|
2 | /**************************************************************************\ |
---|
3 | * eGroupWare - News * |
---|
4 | * http://www.egroupware.org * |
---|
5 | * -------------------------------------------- * |
---|
6 | * This program is free software; you can redistribute it and/or modify it * |
---|
7 | * under the terms of the GNU General Public License as published by the * |
---|
8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
9 | * option) any later version. * |
---|
10 | * -------------------------------------------- * |
---|
11 | \**************************************************************************/ |
---|
12 | |
---|
13 | |
---|
14 | class soexport |
---|
15 | { |
---|
16 | var $db; |
---|
17 | |
---|
18 | function soexport() |
---|
19 | { |
---|
20 | $this->db = $GLOBALS['phpgw']->db; |
---|
21 | } |
---|
22 | |
---|
23 | function readconfig($cat_id) |
---|
24 | { |
---|
25 | $sql = "SELECT * FROM phpgw_news_export where cat_id = $cat_id"; |
---|
26 | $this->db->query($sql,__LINE__,__FILE__); |
---|
27 | if ($this->db->next_record()) |
---|
28 | { |
---|
29 | $result = array(); |
---|
30 | foreach (array('type','itemsyntax','title','link','description','img_title','img_url','img_link') as $config) |
---|
31 | { |
---|
32 | $result[$config] = $this->db->f('export_'.$config); |
---|
33 | } |
---|
34 | return $result; |
---|
35 | } |
---|
36 | else |
---|
37 | { |
---|
38 | return false; |
---|
39 | } |
---|
40 | } |
---|
41 | |
---|
42 | function saveconfig($cat_id,$config) |
---|
43 | { |
---|
44 | $sql = "DELETE FROM phpgw_news_export where cat_id = $cat_id"; |
---|
45 | $this->db->query($sql,__LINE__,__FILE__); |
---|
46 | $sql = "INSERT INTO phpgw_news_export " . |
---|
47 | "(cat_id,export_type,export_itemsyntax,export_title,export_link,export_description,export_img_title,export_img_url,export_img_link) " . |
---|
48 | "VALUES ($cat_id,'" . $config['type'] . "','" . $config['itemsyntax'] . "','" . $config['title'] . |
---|
49 | "','" . $config['link'] . "','" . $config['description'] . "','" . $config['img_title'] . |
---|
50 | "','" . $config['img_url'] . "','" . $config['img_link'] . "')"; |
---|
51 | $this->db->query($sql,__LINE__,__FILE__); |
---|
52 | } |
---|
53 | |
---|
54 | } |
---|