1 | <?php |
---|
2 | |
---|
3 | /***************************************************************************\ |
---|
4 | * Expresso - ReadRSS * |
---|
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 | class uiconfigRss |
---|
13 | { |
---|
14 | private $dao; |
---|
15 | |
---|
16 | public $public_functions = array( |
---|
17 | 'editRss' => True, |
---|
18 | 'saveRss' => True, |
---|
19 | ); |
---|
20 | |
---|
21 | function __construct() |
---|
22 | { |
---|
23 | $this->dao = CreateObject('phpgwapi.config',$GLOBALS['phpgw_info']['flags']['currentapp']); |
---|
24 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
25 | $this->dao->read_repository(); |
---|
26 | } |
---|
27 | |
---|
28 | public final function editRss() |
---|
29 | { |
---|
30 | if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') ) |
---|
31 | { |
---|
32 | $GLOBALS['phpgw']->redirect_link('/admin/index.php'); |
---|
33 | } |
---|
34 | |
---|
35 | $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url']; |
---|
36 | $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/'; |
---|
37 | |
---|
38 | $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . lang('RSS Reader'); |
---|
39 | echo parse_navbar(); |
---|
40 | |
---|
41 | $path_expressoMail = $webserver_url . "/". $GLOBALS['phpgw_info']['flags']['currentapp']; |
---|
42 | |
---|
43 | if ($this->dao->config_data ) |
---|
44 | { |
---|
45 | $current_config = $this->dao->config_data; |
---|
46 | } |
---|
47 | |
---|
48 | $selected_true = ""; |
---|
49 | |
---|
50 | if( $current_config['expressoMail_enabled_read_rss'] === 'true' ) |
---|
51 | { |
---|
52 | $selected_true = 'selected'; |
---|
53 | } |
---|
54 | |
---|
55 | //Option True / False |
---|
56 | $selected_false = ""; |
---|
57 | |
---|
58 | if( $current_config['expressoMail_enabled_read_rss'] === 'false' ) |
---|
59 | { |
---|
60 | $selected_false = 'selected'; |
---|
61 | } |
---|
62 | |
---|
63 | // Options |
---|
64 | $option = ""; |
---|
65 | |
---|
66 | if( $current_config['expressoMail_list_rss'] ) |
---|
67 | { |
---|
68 | foreach($current_config['expressoMail_list_rss'] as $config) |
---|
69 | { |
---|
70 | $item = explode("|", $config); |
---|
71 | $option .= "<option value='{$config}'>".$item[1]."</option>"; |
---|
72 | } |
---|
73 | } |
---|
74 | |
---|
75 | $GLOBALS['phpgw']->template->set_file(array('readRSS' => 'readRss.tpl')); |
---|
76 | $GLOBALS['phpgw']->template->set_block('readRSS','bodyRSS'); |
---|
77 | $GLOBALS['phpgw']->template->set_var(array( |
---|
78 | 'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoMail1_2.uiconfigRSS.saveRss'), |
---|
79 | 'lang_add' => lang('Add'), |
---|
80 | 'lang_cancel' => lang('Cancel'), |
---|
81 | 'lang_enable_RSS' => lang('Enable RSS reader'), |
---|
82 | 'lang_enter_Rss' => lang('Enter the URL of the RSS service'), |
---|
83 | 'lang_list_rss' => lang('List of registered RSS'), |
---|
84 | 'lang_submit' => lang('Save'), |
---|
85 | 'lang_remove' => lang('remove'), |
---|
86 | 'lang_RSS_Manager' => lang('RSS Manager'), |
---|
87 | 'lang_No' => lang('No'), |
---|
88 | 'lang_Yes' => lang('Yes'), |
---|
89 | 'lang_can_not_access_this_rss' => lang('Can not access this RSS'), |
---|
90 | 'selected_expressoMail_enabled_read_rss_true' => $selected_true, |
---|
91 | 'selected_expressoMail_enabled_read_rss_false' => $selected_false, |
---|
92 | 'options_list_rss' => $option, |
---|
93 | 'path_expressoMail' => $path_expressoMail |
---|
94 | )); |
---|
95 | |
---|
96 | $GLOBALS['phpgw']->template->pparse('out','bodyRSS'); |
---|
97 | } |
---|
98 | |
---|
99 | public final function saveRss() |
---|
100 | { |
---|
101 | if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') ) |
---|
102 | { |
---|
103 | $GLOBALS['phpgw']->redirect_link('/admin/index.php'); |
---|
104 | } |
---|
105 | else |
---|
106 | { |
---|
107 | if ( $_POST['save'] ) |
---|
108 | { |
---|
109 | $listRss = ( $_POST['newsettings_expressoMail_list_rss'] ) ? serialize($_POST['newsettings_expressoMail_list_rss']) : "" ; |
---|
110 | |
---|
111 | $this->dao->config_data['expressoMail_list_rss'] = $listRss; |
---|
112 | |
---|
113 | foreach($_POST['newsettings'] as $key => $config) |
---|
114 | { |
---|
115 | $this->dao->config_data[$key] = $config; |
---|
116 | } |
---|
117 | |
---|
118 | $this->dao->save_repository(); |
---|
119 | } |
---|
120 | |
---|
121 | $GLOBALS['phpgw']->redirect_link('/admin/index.php'); |
---|
122 | } |
---|
123 | } |
---|
124 | } |
---|
125 | |
---|
126 | ?> |
---|