Merge lp:~vierbergenlars/remotecp-panel/plugins_api into lp:remotecp-panel/1.x
- plugins_api
- Merge into 1.x
Proposed by
Lars Vierbergen
Status: | Superseded |
---|---|
Proposed branch: | lp:~vierbergenlars/remotecp-panel/plugins_api |
Merge into: | lp:remotecp-panel/1.x |
Diff against target: |
297 lines (+134/-74) 4 files modified
cpanel-incs/plugins/col1/api.php (+53/-0) cpanel-incs/plugins/col1/default.php (+14/-37) cpanel-incs/plugins/col3/api.php (+53/-0) cpanel-incs/plugins/col3/default.php (+14/-37) |
To merge this branch: | bzr merge lp:~vierbergenlars/remotecp-panel/plugins_api |
Related bugs: | |
Related blueprints: |
Add plugin API support
(High)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lars Vierbergen | Needs Fixing | ||
Review via email: mp+47047@code.launchpad.net |
This proposal supersedes a proposal from 2011-01-21.
This proposal has been superseded by a proposal from 2011-01-21.
Commit message
Description of the change
Add the addons api support, also the other modules
To post a comment you must log in.
Revision history for this message
Lars Vierbergen (vierbergenlars) : Posted in a previous version of this proposal | # |
review:
Approve
Revision history for this message
Lars Vierbergen (vierbergenlars) : | # |
review:
Approve
- 47. By Lars Vierbergen
-
Add API for col1 & col3 + Update the default.php
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'cpanel-incs/plugins/col1/api.php' |
2 | --- cpanel-incs/plugins/col1/api.php 1970-01-01 00:00:00 +0000 |
3 | +++ cpanel-incs/plugins/col1/api.php 2011-01-21 16:18:12 +0000 |
4 | @@ -0,0 +1,53 @@ |
5 | +<?php |
6 | +class col1 { |
7 | + function gets() { |
8 | + global $remote_connection; |
9 | + $query = $remote_connection->query('SELECT * FROM `'.SITE.'_a_col1` ORDER BY `order` ASC'); |
10 | + $SECTIONS=array(); |
11 | + while($section=$query->fetch_assoc()) { |
12 | + $SECTIONS[]=$section; |
13 | + } |
14 | + return $SECTIONS; |
15 | + } |
16 | + function get($id) { |
17 | + global $remote_connection; |
18 | + return $remote_connection->query('SELECT * FROM `'.SITE.'_a_col1` WHERE `id`='.$id)->fetch_assoc(); |
19 | + } |
20 | + function delete($id) { |
21 | + global $remote_connection; |
22 | + return $remote_connection->query('DELETE FROM `'.SITE.'_a_col1` WHERE `id`='.$id); |
23 | + } |
24 | + function add($props) { |
25 | + global $remote_connection; |
26 | + $defaults=array('title'=>'API_added_block','content'=>'','plugin-reference'=>0,'access'=>0); |
27 | + $props=array_merge($default,$props); |
28 | + $order=$remote_connection->query('SELECT * FROM `'.SITE.'_a_col1` ORDER BY `order` DESC')->fetch_assoc(); |
29 | + $order=$order['order']+1; |
30 | + $remote_connection->query('INSERT INTO `'.SITE.'_a_col1` VALUES(NULL,'.$order.',\''.$props['title'].'\',\''.$props['content'].'\',\''.$props['plugin-reference'].'\''.$props['access'].')'); |
31 | + return $remote_connection->insert_id; |
32 | + } |
33 | + function move($id,$where) { |
34 | + // $where > 0 : UP |
35 | + // $where < 0 : DOWN |
36 | + global $remote_connection; |
37 | + $q0=$remote_connection->query('SELECT * FROM `'.SITE.'_col1` WHERE `id`='.$id); |
38 | + $q1=$remote_connection->query('SELECT * FROM `'.SITE.'_col1` ORDER BY `order` DESC'); |
39 | + if(!$q0||!$q1) return false; |
40 | + $r0=$q0->fetch_assoc(); |
41 | + $r1=$q1->fetch_assoc(); |
42 | + $old_pos=$r0['order']; |
43 | + $max_pos=$r1['order']; |
44 | + $new_pos=$old_pos-$where; |
45 | + if($new_pos<1||$new_pos>$max_pos) return false; |
46 | + return $remote_connection->query('UPDATE `'.SITE.'_col1` SET `order` = IF( `order` ='.$old_pos.', '.$new_pos.', '.$old_pos.' ) WHERE `order` IN ( '.$old_pos.', '.$new_pos.' )'); |
47 | + } |
48 | + function edit($id,$new_props) { |
49 | + global $remote_connection; |
50 | + $sets=''; |
51 | + foreach($new_props as $col=>$prop) { |
52 | + $sets.='`'.$col.'`=\''.$prop.'\', '; |
53 | + } |
54 | + $sets=substr($sets,0,-2); |
55 | + return $remote_connection->query('UPDATE `'.SITE.'_col1` SET '.$sets.' WHERE `id`='.$id); |
56 | + } |
57 | +} |
58 | \ No newline at end of file |
59 | |
60 | === modified file 'cpanel-incs/plugins/col1/default.php' |
61 | --- cpanel-incs/plugins/col1/default.php 2011-01-21 08:42:04 +0000 |
62 | +++ cpanel-incs/plugins/col1/default.php 2011-01-21 16:18:12 +0000 |
63 | @@ -13,51 +13,29 @@ |
64 | if(!hasSiteAddonLevel()) {$session->log('403','Site access denied ('.$site.')'); exit;} //Kill & log non-siteadmins (ze zouden hier nooit mogen geweest zijn :) |
65 | if(!isset($_GET['function'])) {$_GET['function']="list"; } |
66 | if($_GET['function']=="list") { |
67 | - $query = $remote_connection->query('SELECT * FROM `'.$site.'_a_col1` ORDER BY `order` ASC'); ?> |
68 | + $query = col1::gets(); ?> |
69 | <table><tr><th></th><th><?php echo $t->_('Title'); ?></th><th><?php echo $t->_('Actions'); ?></th></tr> |
70 | - <?php while($section=$query->fetch_assoc()) {?> |
71 | + <?php foreach($query as $section) {?> |
72 | <tr><td<?php if($section['plugin-reference']==NULL) { ?> ondblclick="col1.edit_rights.expand('<?php echo $site; ?>','<?php echo $section['id']; ?>',this,'<?php echo $section['access']; ?>')"><img src="<?php echo URL_IMG; ?>/Silk/bullet_<?php if($section['access']==0) { ?>green<?php } else if($section['access']==1) { ?>orange<?php } else if($section['access']==2) { ?>red<?php } ?>.png"> <?php } else { ?>><img src="<?php echo URL_IMG; ?>/Silk/bullet_black.png" alt=""><?php } ?></td><td ondblclick="col1.edit_title.expand('<?php echo $site; ?>','<?php echo $section['id']; ?>',this)"><?php echo $section['title']; ?></td><td><?php if($section['plugin-reference']==NULL) { ?><a onclick="col1.delete('<?php echo $site; ?>','<?php echo $section['id'] ?>');"><img src="<?php echo URL_IMG; ?>/Silk/delete.png" alt="<?php echo $t->_('Delete'); ?>" title="<?php echo $t->_('Delete section'); ?>"></a> <?php } ?><a onclick="col1.edit_order.down('<?php echo $site; ?>','<?php echo $section['id'];?>',this);"><img src="<?php echo URL_IMG ?>/Silk/arrow_down.png" alt="<?php echo $t->_('Down'); ?>" title="<?php echo $t->_('Move section down'); ?>"></a> <a onclick="col1.edit_order.up('<?php echo $site; ?>','<?php echo $section['id']; ?>');"><img src="<?php echo URL_IMG ?>/Silk/arrow_up.png" alt="<?php echo $t->_('Up'); ?>" title="<?php echo $t->_('Move section up'); ?>"></a><?php if($section['plugin-reference']==NULL) { ?> <a onclick="col1.open_mce('<?php echo $site; ?>','<?php echo $section['id']; ?>');"><img src="<?php echo URL_IMG; ?>/Silk/pencil.png" alt="<?php echo $t->_('Edit'); ?>" title="<?php echo $t->_('Edit section content'); ?>"></a><?php } ?></td></tr> |
73 | <?php } ?> |
74 | <tr onclick="col1.add('<?php echo $site; ?>')"><td><img src="<?php echo URL_IMG; ?>/Silk/bullet_add.png" alt=""></td><td colspan="2"><?php echo $t->_('Add section'); ?></td></tr> |
75 | </table> |
76 | <?php } |
77 | else if($_GET['function']=="delete") { |
78 | - $q= $remote_connection->query('DELETE FROM `'.$site.'_a_col1` WHERE `id`='.$_GET['id']); |
79 | - if($q) { echo "true"; } else { echo "false"; } |
80 | + if(col1::delete($_GET['id'])) echo "true"; |
81 | + else echo "false"; |
82 | } |
83 | else if($_GET['function']=="edit_title") { |
84 | - $q= $remote_connection->query('UPDATE `'.$site.'_a_col1` SET `title`="'.$_GET['title'].'" WHERE `id`='.$_GET['id']); |
85 | - if($q) { echo "true"; } else { echo "false"; } |
86 | + if(col1::edit($_GET['id'],array('title'=>$_GET['title']))) echo "true"; |
87 | + else echo "false"; |
88 | } |
89 | else if($_GET['function']=="move") { |
90 | - $query0=$remote_connection->query('SELECT * FROM `'.$site.'_a_col1` WHERE `id`='.$_GET['id']); |
91 | - if(!$query0) { echo "false"; exit; } //KILL bij query fout (vermijd foute update) |
92 | - $res0=$query0->fetch_assoc(); |
93 | - $old_pos=$res0['order']; |
94 | - if($_GET['move']=="up") { |
95 | - $new_pos=$old_pos-1; |
96 | - } |
97 | - else if($_GET['move']=="down") { |
98 | - $new_pos=$old_pos+1; |
99 | - } |
100 | - if(!isset($new_pos)||$new_pos<1) { |
101 | - echo "false"; |
102 | - exit; //DO NOT execute query |
103 | - } |
104 | - $query1=$remote_connection->query('UPDATE `'.$site.'_a_col1` SET `order` = IF( `order` ='.$old_pos.', '.$new_pos.', '.$old_pos.' ) WHERE `order` IN ( '.$old_pos.', '.$new_pos.' )'); |
105 | - if($query1) { echo "true"; } else { echo "false"; } |
106 | + if($_GET['move']=="up") $q=col1::move($_GET['id'],1); |
107 | + else if($_GET['move']=="down") $q=col1::move($_GET['id'],-1); |
108 | } |
109 | else if($_GET['function']=="new") { |
110 | - $query0=$remote_connection->query('SELECT * FROM `'.$site.'_a_col1` ORDER BY `order` DESC'); |
111 | - if(!$query0) { |
112 | - echo "false"; |
113 | - exit; //DO NOT execute query, error with first request. |
114 | - } |
115 | - $res0=$query0->fetch_assoc(); |
116 | - $order_last=$res0['order']; |
117 | - $new_order_last=$order_last+1; |
118 | - $q=$remote_connection->query('INSERT INTO `'.$site.'_a_col1` VALUES(NULL,'.$new_order_last.',"Nieuwe sectie","",NULL,0)'); |
119 | - if($q) { echo "true"; } else { echo "false"; } |
120 | + if(col1::add(array('title'=>$t->_('New section'))) echo "true"; |
121 | + else echo "false"; |
122 | } |
123 | else if($_GET['function']=="edit_rights") { |
124 | $query=$remote_connection->query('UPDATE `'.$site.'_a_col1` SET `access`='.$_GET['rights'].' WHERE `id`='.$_GET['id']); |
125 | @@ -66,11 +44,10 @@ |
126 | } |
127 | else if($_GET['function']=="mce") { |
128 | if(isset($_GET['save'])) { |
129 | - if($remote_connection->query('UPDATE `'.$site.'_a_col1` SET `content`="'.str_replace('"','\'',$_POST['section_main']).'" WHERE `id`='.$_GET['id'])) |
130 | - { echo '<script language="JavaScript">alert("'.$t->_('Saved').'");</script>'; } |
131 | - else { echo '<script language="JavaScript">alert("'.$t->_('Error while saving').'");</script>'; } |
132 | + if(cms::edit($_GET['id'],array('content'=>$remote_connection->escape($_POST['section_main'])))) echo '<script language="JavaScript">alert("'.$t->_('Saved').'");</script>'; |
133 | + else echo '<script language="JavaScript">alert("'.$t->_('Error while saving').'");</script>'; |
134 | } |
135 | - $edit_data=$remote_connection->query('SELECT * FROM `'.$site.'_a_col1` WHERE `id`='.$_GET['id'])->fetch_assoc();?> |
136 | + $edit_data=cms::get($_GET['id']);?> |
137 | <script language="JavaScript" src="<?php echo URL_TINYMCE; ?>/tiny_mce/tiny_mce.js"></script> |
138 | <script type="text/javascript"> |
139 | |
140 | @@ -85,7 +62,7 @@ |
141 | // Theme options |
142 | theme_advanced_buttons1 : "save,tinyautosave,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", |
143 | theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", |
144 | -theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visuala`id`,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,fullscreen", |
145 | +theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,fullscreen", |
146 | theme_advanced_buttons4 : "styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking", |
147 | theme_advanced_toolbar_location : "top", |
148 | theme_advanced_toolbar_align : "left", |
149 | |
150 | === added file 'cpanel-incs/plugins/col3/api.php' |
151 | --- cpanel-incs/plugins/col3/api.php 1970-01-01 00:00:00 +0000 |
152 | +++ cpanel-incs/plugins/col3/api.php 2011-01-21 16:18:12 +0000 |
153 | @@ -0,0 +1,53 @@ |
154 | +<?php |
155 | +class col3 { |
156 | + function gets() { |
157 | + global $remote_connection; |
158 | + $query = $remote_connection->query('SELECT * FROM `'.SITE.'_a_col3` ORDER BY `order` ASC'); |
159 | + $SECTIONS=array(); |
160 | + while($section=$query->fetch_assoc()) { |
161 | + $SECTIONS[]=$section; |
162 | + } |
163 | + return $SECTIONS; |
164 | + } |
165 | + function get($id) { |
166 | + global $remote_connection; |
167 | + return $remote_connection->query('SELECT * FROM `'.SITE.'_a_col3` WHERE `id`='.$id)->fetch_assoc(); |
168 | + } |
169 | + function delete($id) { |
170 | + global $remote_connection; |
171 | + return $remote_connection->query('DELETE FROM `'.SITE.'_a_col3` WHERE `id`='.$id); |
172 | + } |
173 | + function add($props) { |
174 | + global $remote_connection; |
175 | + $defaults=array('title'=>'API_added_block','content'=>'','plugin-reference'=>0,'access'=>0); |
176 | + $props=array_merge($default,$props); |
177 | + $order=$remote_connection->query('SELECT * FROM `'.SITE.'_a_col3` ORDER BY `order` DESC')->fetch_assoc(); |
178 | + $order=$order['order']+1; |
179 | + $remote_connection->query('INSERT INTO `'.SITE.'_a_col3` VALUES(NULL,'.$order.',\''.$props['title'].'\',\''.$props['content'].'\',\''.$props['plugin-reference'].'\''.$props['access'].')'); |
180 | + return $remote_connection->insert_id; |
181 | + } |
182 | + function move($id,$where) { |
183 | + // $where > 0 : UP |
184 | + // $where < 0 : DOWN |
185 | + global $remote_connection; |
186 | + $q0=$remote_connection->query('SELECT * FROM `'.SITE.'_col3` WHERE `id`='.$id); |
187 | + $q1=$remote_connection->query('SELECT * FROM `'.SITE.'_col3` ORDER BY `order` DESC'); |
188 | + if(!$q0||!$q1) return false; |
189 | + $r0=$q0->fetch_assoc(); |
190 | + $r1=$q1->fetch_assoc(); |
191 | + $old_pos=$r0['order']; |
192 | + $max_pos=$r1['order']; |
193 | + $new_pos=$old_pos-$where; |
194 | + if($new_pos<1||$new_pos>$max_pos) return false; |
195 | + return $remote_connection->query('UPDATE `'.SITE.'_col3` SET `order` = IF( `order` ='.$old_pos.', '.$new_pos.', '.$old_pos.' ) WHERE `order` IN ( '.$old_pos.', '.$new_pos.' )'); |
196 | + } |
197 | + function edit($id,$new_props) { |
198 | + global $remote_connection; |
199 | + $sets=''; |
200 | + foreach($new_props as $col=>$prop) { |
201 | + $sets.='`'.$col.'`=\''.$prop.'\', '; |
202 | + } |
203 | + $sets=substr($sets,0,-2); |
204 | + return $remote_connection->query('UPDATE `'.SITE.'_col3` SET '.$sets.' WHERE `id`='.$id); |
205 | + } |
206 | +} |
207 | \ No newline at end of file |
208 | |
209 | === modified file 'cpanel-incs/plugins/col3/default.php' |
210 | --- cpanel-incs/plugins/col3/default.php 2011-01-21 08:42:04 +0000 |
211 | +++ cpanel-incs/plugins/col3/default.php 2011-01-21 16:18:12 +0000 |
212 | @@ -13,51 +13,29 @@ |
213 | if(!hasSiteAddonLevel()) {$session->log('403','Site access denied ('.$site.')'); exit;} //Kill & log non-siteadmins (ze zouden hier nooit mogen geweest zijn :) |
214 | if(!isset($_GET['function'])) {$_GET['function']="list"; } |
215 | if($_GET['function']=="list") { |
216 | - $query = $remote_connection->query('SELECT * FROM `'.$site.'_a_col3` ORDER BY `order` ASC'); ?> |
217 | + $query = col3::gets(); ?> |
218 | <table><tr><th></th><th><?php echo $t->_('Title'); ?></th><th><?php echo $t->_('Actions'); ?></th></tr> |
219 | - <?php while($section=$query->fetch_assoc()) {?> |
220 | + <?php foreach($query as $section) {?> |
221 | <tr><td<?php if($section['plugin-reference']==NULL) { ?> ondblclick="col3.edit_rights.expand('<?php echo $site; ?>','<?php echo $section['id']; ?>',this,'<?php echo $section['access']; ?>')"><img src="<?php echo URL_IMG; ?>/Silk/bullet_<?php if($section['access']==0) { ?>green<?php } else if($section['access']==1) { ?>orange<?php } else if($section['access']==2) { ?>red<?php } ?>.png"> <?php } else { ?>><img src="<?php echo URL_IMG; ?>/Silk/bullet_black.png" alt=""><?php } ?></td><td ondblclick="col3.edit_title.expand('<?php echo $site; ?>','<?php echo $section['id']; ?>',this)"><?php echo $section['title']; ?></td><td><?php if($section['plugin-reference']==NULL) { ?><a onclick="col3.delete('<?php echo $site; ?>','<?php echo $section['id'] ?>');"><img src="<?php echo URL_IMG; ?>/Silk/delete.png" alt="<?php echo $t->_('Delete'); ?>" title="<?php echo $t->_('Delete section'); ?>"></a> <?php } ?><a onclick="col3.edit_order.down('<?php echo $site; ?>','<?php echo $section['id'];?>',this);"><img src="<?php echo URL_IMG ?>/Silk/arrow_down.png" alt="<?php echo $t->_('Down'); ?>" title="<?php echo $t->_('Move section down'); ?>"></a> <a onclick="col3.edit_order.up('<?php echo $site; ?>','<?php echo $section['id']; ?>');"><img src="<?php echo URL_IMG ?>/Silk/arrow_up.png" alt="<?php echo $t->_('Up'); ?>" title="<?php echo $t->_('Move section up'); ?>"></a><?php if($section['plugin-reference']==NULL) { ?> <a onclick="col3.open_mce('<?php echo $site; ?>','<?php echo $section['id']; ?>');"><img src="<?php echo URL_IMG; ?>/Silk/pencil.png" alt="<?php echo $t->_('Edit'); ?>" title="<?php echo $t->_('Edit section content'); ?>"></a><?php } ?></td></tr> |
222 | <?php } ?> |
223 | <tr onclick="col3.add('<?php echo $site; ?>')"><td><img src="<?php echo URL_IMG; ?>/Silk/bullet_add.png" alt=""></td><td colspan="2"><?php echo $t->_('Add section'); ?></td></tr> |
224 | </table> |
225 | <?php } |
226 | else if($_GET['function']=="delete") { |
227 | - $q= $remote_connection->query('DELETE FROM `'.$site.'_a_col3` WHERE `id`='.$_GET['id']); |
228 | - if($q) { echo "true"; } else { echo "false"; } |
229 | + if(col3::delete($_GET['id'])) echo "true"; |
230 | + else echo "false"; |
231 | } |
232 | else if($_GET['function']=="edit_title") { |
233 | - $q= $remote_connection->query('UPDATE `'.$site.'_a_col3` SET `title`="'.$_GET['title'].'" WHERE `id`='.$_GET['id']); |
234 | - if($q) { echo "true"; } else { echo "false"; } |
235 | + if(col3::edit($_GET['id'],array('title'=>$_GET['title']))) echo "true"; |
236 | + else echo "false"; |
237 | } |
238 | else if($_GET['function']=="move") { |
239 | - $query0=$remote_connection->query('SELECT * FROM `'.$site.'_a_col3` WHERE `id`='.$_GET['id']); |
240 | - if(!$query0) { echo "false"; exit; } //KILL bij query fout (vermijd foute update) |
241 | - $res0=$query0->fetch_assoc(); |
242 | - $old_pos=$res0['order']; |
243 | - if($_GET['move']=="up") { |
244 | - $new_pos=$old_pos-1; |
245 | - } |
246 | - else if($_GET['move']=="down") { |
247 | - $new_pos=$old_pos+1; |
248 | - } |
249 | - if(!isset($new_pos)||$new_pos<1) { |
250 | - echo "false"; |
251 | - exit; //DO NOT execute query |
252 | - } |
253 | - $query1=$remote_connection->query('UPDATE `'.$site.'_a_col3` SET `order` = IF( `order` ='.$old_pos.', '.$new_pos.', '.$old_pos.' ) WHERE `order` IN ( '.$old_pos.', '.$new_pos.' )'); |
254 | - if($query1) { echo "true"; } else { echo "false"; } |
255 | + if($_GET['move']=="up") $q=col3::move($_GET['id'],1); |
256 | + else if($_GET['move']=="down") $q=col3::move($_GET['id'],-1); |
257 | } |
258 | else if($_GET['function']=="new") { |
259 | - $query0=$remote_connection->query('SELECT * FROM `'.$site.'_a_col3` ORDER BY `order` DESC'); |
260 | - if(!$query0) { |
261 | - echo "false"; |
262 | - exit; //DO NOT execute query, error with first request. |
263 | - } |
264 | - $res0=$query0->fetch_assoc(); |
265 | - $order_last=$res0['order']; |
266 | - $new_order_last=$order_last+1; |
267 | - $q=$remote_connection->query('INSERT INTO `'.$site.'_a_col3` VALUES(NULL,'.$new_order_last.',"Nieuwe sectie","",NULL,0)'); |
268 | - if($q) { echo "true"; } else { echo "false"; } |
269 | + if(col3::add(array('title'=>$t->_('New section'))) echo "true"; |
270 | + else echo "false"; |
271 | } |
272 | else if($_GET['function']=="edit_rights") { |
273 | $query=$remote_connection->query('UPDATE `'.$site.'_a_col3` SET `access`='.$_GET['rights'].' WHERE `id`='.$_GET['id']); |
274 | @@ -66,11 +44,10 @@ |
275 | } |
276 | else if($_GET['function']=="mce") { |
277 | if(isset($_GET['save'])) { |
278 | - if($remote_connection->query('UPDATE `'.$site.'_a_col3` SET `content`="'.str_replace('"','\'',$_POST['section_main']).'" WHERE `id`='.$_GET['id'])) |
279 | - { echo '<script language="JavaScript">alert("'.$t->_('Saved').'");</script>'; } |
280 | - else { echo '<script language="JavaScript">alert("'.$t->_('Error while saving').'");</script>'; } |
281 | + if(cms::edit($_GET['id'],array('content'=>$remote_connection->escape($_POST['section_main'])))) echo '<script language="JavaScript">alert("'.$t->_('Saved').'");</script>'; |
282 | + else echo '<script language="JavaScript">alert("'.$t->_('Error while saving').'");</script>'; |
283 | } |
284 | - $edit_data=$remote_connection->query('SELECT * FROM `'.$site.'_a_col3` WHERE `id`='.$_GET['id'])->fetch_assoc();?> |
285 | + $edit_data=cms::get($_GET['id']);?> |
286 | <script language="JavaScript" src="<?php echo URL_TINYMCE; ?>/tiny_mce/tiny_mce.js"></script> |
287 | <script type="text/javascript"> |
288 | |
289 | @@ -85,7 +62,7 @@ |
290 | // Theme options |
291 | theme_advanced_buttons1 : "save,tinyautosave,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", |
292 | theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", |
293 | -theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visuala`id`,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,fullscreen", |
294 | +theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,fullscreen", |
295 | theme_advanced_buttons4 : "styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking", |
296 | theme_advanced_toolbar_location : "top", |
297 | theme_advanced_toolbar_align : "left", |
There is a file header wrong (check cpanel- incs/plugins/ col3/default. php)