Merge lp:~vierbergenlars/remotecp-panel/all-in-one into lp:remotecp-panel/1.x
- all-in-one
- Merge into 1.x
Proposed by
Lars Vierbergen
Status: | Merged |
---|---|
Approved by: | Lars Vierbergen |
Approved revision: | 97 |
Merged at revision: | 92 |
Proposed branch: | lp:~vierbergenlars/remotecp-panel/all-in-one |
Merge into: | lp:remotecp-panel/1.x |
Diff against target: |
417 lines (+254/-83) 5 files modified
iframe_test.php (+214/-0) inc/controllers.php (+34/-0) inc/sitemgmt/constants.php (+1/-1) panel.php (+4/-81) system/desktop.php (+1/-1) |
To merge this branch: | bzr merge lp:~vierbergenlars/remotecp-panel/all-in-one |
Related bugs: | |
Related blueprints: |
All panels in one
(Low)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lars Vierbergen | Approve | ||
Review via email: mp+52298@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'iframe_test.php' |
2 | --- iframe_test.php 1970-01-01 00:00:00 +0000 |
3 | +++ iframe_test.php 2011-03-11 19:32:59 +0000 |
4 | @@ -0,0 +1,214 @@ |
5 | +<?php |
6 | +require('inc/controllers.php'); |
7 | +?> |
8 | +<!DOCTYPE> |
9 | +<html> |
10 | +<head> |
11 | +<title>RemoteCP</title> |
12 | +<style> |
13 | +iframe,body { |
14 | + border: 0px; |
15 | + margin: 0px; |
16 | + // margin: 0 50px; |
17 | +} |
18 | +iframe { |
19 | + width: 100%; |
20 | + height: 90%; |
21 | + display:none; |
22 | + margin:0; |
23 | +} |
24 | +html {width: 100%; height: 100%; left:0; right: 0; top:0; bottom:0;} |
25 | +body{ font-family: Trebuchet MS,Tahoma,Verdana,Arial,sans-serif; font: 62.5% "Trebuchet MS", sans-serif;} |
26 | +#login-container { |
27 | + margin: 50px 50px 0 50px; |
28 | +} |
29 | +#frame-selector { |
30 | + display: inline; |
31 | +} |
32 | +</style> |
33 | +<link type="text/css" href="<?php echo URL_JQUERY; ?>/css/jquery-ui.css" rel="stylesheet"> |
34 | +<script language='JavaScript' src='<?php echo DOMAIN; ?>/scripts.js'></script> |
35 | +<script language="JavaScript" type="application/javascript"> |
36 | +var URL_SCRIPTS="<?php echo URL_SCRIPTS; ?>"; //PHP Constant URL_SCRIPTS |
37 | +var loaded_scripts=new Array('NULL'); |
38 | +</script> |
39 | +<script language='JavaScript'> |
40 | +var recalcFrames_offset=10; |
41 | +var frames = { |
42 | + resize_frames: function(new_height) { |
43 | + frms=document.getElementsByTagName('iframe'); |
44 | + for(i=0;i<frms.length;i++) { |
45 | + frm=frms[i]; |
46 | + frm.style.height=new_height; |
47 | + } |
48 | + }, |
49 | + getFrameTitle: function(id) { |
50 | + if(frd=document.getElementById(id).contentDocument) { |
51 | + return frd.title; |
52 | + } |
53 | + return document.getElementById(id).contentWindow.document.title; |
54 | + }, |
55 | + makeSelector: function() { |
56 | + html=''; |
57 | + frms=document.getElementsByTagName('iframe'); |
58 | + activefrmid=this.activeFrame().id; |
59 | + for(i=0;i<frms.length;i++) { |
60 | + frm=frms[i]; |
61 | + fid=frm.id; |
62 | + title=this.getFrameTitle(fid); |
63 | + if(fid==activefrmid) active='checked'; |
64 | + else active='' |
65 | + html+='<input type=\'radio\' name=\'frame-select-but\' id=\'frame-select-but_'+fid+'\' value=\''+fid+'\' '+active+' onclick=\'frames.change(this.value)\'><label for=\'frame-select-but_'+fid+'\'>'+title+'<\/label>'; |
66 | + } |
67 | + document.getElementById('frame-selector').innerHTML=html; |
68 | + $('#frame-selector').buttonset(); |
69 | + }, |
70 | + addFrame: function(link) { |
71 | + frm=document.createElement('iframe'); |
72 | + frm.setAttribute('src',link); |
73 | + fid=Math.round(Math.random()*10E16); |
74 | + frm.setAttribute('id',fid); |
75 | + document.getElementById('frames').appendChild(frm); |
76 | + this.change(fid); |
77 | + frm.focus(); |
78 | + recalcFrames(); |
79 | + setTimeout('frames.makeSelector();',2000); |
80 | + }, |
81 | + change: function(id) { |
82 | + this.hideFrames(); |
83 | + $('iframe#'+id).show(); |
84 | + document.title=this.getFrameTitle(id); |
85 | + }, |
86 | + hideFrames: function() { |
87 | + $('iframe').hide(); |
88 | + }, |
89 | + activeFrame: function() { |
90 | + frms=document.getElementsByTagName('iframe'); |
91 | + for(i=0;i<frms.length;i++) { |
92 | + frm=frms[i]; |
93 | + if(frm.style.display=='block') |
94 | + return frm; |
95 | + } |
96 | + } |
97 | + |
98 | +}; |
99 | +function recalcFrames () { |
100 | + // From http://www.webdeveloper.com/forum/showthread.php?t=161412 |
101 | + var scnWid,scnHei; |
102 | + if (self.innerHeight) // all except Explorer |
103 | + { |
104 | + scnHei = self.innerHeight; |
105 | + } |
106 | + else if (document.documentElement && document.documentElement.clientHeight) |
107 | + // Explorer 6 Strict Mode |
108 | + { |
109 | + scnHei = document.documentElement.clientHeight; |
110 | + } |
111 | + else if (document.body) // other Explorers |
112 | + { |
113 | + scnHei = document.body.clientHeight; |
114 | + } |
115 | + // End from http://www.webdeveloper.com/forum/showthread.php?t=161412 |
116 | + frames.resize_frames(scnHei-recalcFrames_offset); |
117 | +} |
118 | +window.onresize=recalcFrames; |
119 | +function initFrames() { |
120 | + frms=document.getElementsByTagName('iframe'); |
121 | + for(i=0;i<frms.length;i++) { |
122 | + frm=frms[i]; |
123 | + frm.id=Math.round(Math.random()*10E16); |
124 | + |
125 | + } |
126 | +} |
127 | +function refreshFrames() { |
128 | + frms=document.getElementsByTagName('iframe'); |
129 | + for(i=0;i<frms.length;i++) { |
130 | + frm=frms[i]; |
131 | + frm.src=frm.src; |
132 | + |
133 | + } |
134 | +} |
135 | + |
136 | +</script> |
137 | +<script language='JavaScript'> |
138 | +$(function(){ |
139 | + // GUI classes |
140 | + $('.gui-dlg').dialog({ |
141 | + autoOpen: false, |
142 | + width: 600, |
143 | + show: 'puff', |
144 | + hide: 'fold' |
145 | + }); |
146 | + |
147 | + $('.gui-dlg-alert').dialog({ |
148 | + resizable: false, |
149 | + draggable: false, |
150 | + buttons: { |
151 | + "Ok": function() { |
152 | + $(this).dialog("close"); |
153 | + } |
154 | + } |
155 | + }); |
156 | + $('.gui-dlg-fs').dialog({ modal: true}); |
157 | + $('.gui-dlg-noresize').dialog({ resizable: false}); |
158 | + |
159 | + $('.gui-button').button(); |
160 | + // GUI specifieke opties |
161 | + $('#button_log-off').button({ |
162 | + icons: { |
163 | + primary: 'ui-icon-key' |
164 | + } |
165 | + }); |
166 | + $('#button_register').button({ |
167 | + icons: { |
168 | + primary: 'ui-icon-person' |
169 | + } |
170 | + }); |
171 | + $('#dlg_log-in').dialog({ |
172 | + buttons: { |
173 | + "Inloggen": function() { |
174 | + logged_in=ajax.post('panel.php?control=login','user='+document.login.user.value+'&pass='+document.login.pass.value); |
175 | + if(logged_in=="true") { |
176 | + refreshFrames(); |
177 | + $(this).dialog('close'); |
178 | + } |
179 | + else if(logged_in=="false") { |
180 | + $(this).prepend('<div id="dlg_log-in-error" class="ui-state-error ui-corner-all" style="padding: 0 .7em;"><p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span><?php echo $t->_('Login failed. Try again'); ?></p></div>'); |
181 | + setTimeout('$("#dlg_log-in-error").hide("clip","slow")',2000); |
182 | + } |
183 | + else { |
184 | + $(this).prepend(logged_in); |
185 | + } |
186 | + } |
187 | + }, |
188 | + close: function() { |
189 | + document.login.reset(); |
190 | + } |
191 | + } |
192 | + ); |
193 | + |
194 | + <?php if(!$session->logged_in) { echo "$('#dlg_log-in').dialog('open');" ;}?> |
195 | + }); |
196 | +</script> |
197 | +</head> |
198 | +<body onload='initFrames(); recalcFrames()' onresize='recalcFrames()'> |
199 | +<div id='login-container'> |
200 | + <span class="gui-button" id="button_log-off" onclick="$.ajax({async:false,url:'panel.php?control=logoff'});refreshFrames(); $('#dlg_log-in').dialog('open'); return false;"><?php echo $t->_('Log off'); ?></span> |
201 | + <span class="gui-button" id="button_register" onclick="$('#dlg_register').empty().append(ajax.get('panel.php?control=register')).dialog('open');return false;"><?php echo $t->_('Register'); ?></span> |
202 | + <div id='frame-selector'></div> |
203 | + <div id="dlg_log-in" title="<?php echo $t->_('Log in'); ?>" class="gui-dlg gui-dlg-fs gui-dlg-noresize"> |
204 | + <form name="login"> |
205 | + <?php echo $t->_('Username'); ?>: <input type="text" name="user" id="login-user"><br> |
206 | + <?php echo $t->_('Password'); ?>: <input type="password" name="pass" id="login-pass"> |
207 | + </form> |
208 | + </div> |
209 | + <div id="dlg_register" title="<?php echo $t->_('Register'); ?>" class="gui-dlg gui-dlg-fs gui-dlg-noresize"> |
210 | + </div> |
211 | +</div> |
212 | +<div id='frames'> |
213 | +</div> |
214 | +<script language='JavaScript'> |
215 | +frames.addFrame('panel.php'); |
216 | +</script> |
217 | +</body> |
218 | +</html> |
219 | \ No newline at end of file |
220 | |
221 | === added file 'inc/controllers.php' |
222 | --- inc/controllers.php 1970-01-01 00:00:00 +0000 |
223 | +++ inc/controllers.php 2011-03-11 19:32:59 +0000 |
224 | @@ -0,0 +1,34 @@ |
225 | +<?php |
226 | +if (get_magic_quotes_gpc()) { //Disable & remove magic quotes ! (http://www.php.net/manual/en/security.magicquotes.disabling.php: example 2) |
227 | + $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); |
228 | + while (list($key, $val) = each($process)) { |
229 | + foreach ($val as $k => $v) { |
230 | + unset($process[$key][$k]); |
231 | + if (is_array($v)) { |
232 | + $process[$key][stripslashes($k)] = $v; |
233 | + $process[] = &$process[$key][stripslashes($k)]; |
234 | + } else { |
235 | + $process[$key][stripslashes($k)] = stripslashes($v); |
236 | + } |
237 | + } |
238 | + } |
239 | + unset($process); |
240 | +} |
241 | + |
242 | +ob_start('ob_gzhandler'); |
243 | +header('Cache-Control: private'); |
244 | +// session_cache_limiter('private'); |
245 | +require_once('inc/errorhandler.php'); |
246 | +require_once('inc/sitemgmt/constants.php'); |
247 | +require_once('inc/sqlsess/sqlsess.php'); |
248 | +// Register sqlsess variables |
249 | +$sess=new SQLSESS($local_connection,'sessions'); |
250 | +#$sess->session_id(); |
251 | +$sess->session_start(); |
252 | +unset($_SESSION); |
253 | +$_SESSION=$sess->session_get_contents(); |
254 | +// End sqlsess |
255 | +require_once('inc/sitemgmt/session.php'); |
256 | +require_once('trans/trans.php'); |
257 | +require_once('inc/remotedbauth.php'); |
258 | +require_once('inc/accountlevels.php'); |
259 | \ No newline at end of file |
260 | |
261 | === modified file 'inc/sitemgmt/constants.php' |
262 | --- inc/sitemgmt/constants.php 2011-02-22 19:58:54 +0000 |
263 | +++ inc/sitemgmt/constants.php 2011-03-11 19:32:59 +0000 |
264 | @@ -17,7 +17,7 @@ |
265 | * If these locations are incorrect, there won't |
266 | * be any lay-out, images, site title or correct RSS. |
267 | */ |
268 | -define("DOMAIN","http://account.loop.remotecp.co.cc"); |
269 | +define("DOMAIN","http://localhost/dev/rcp_all-in-one"); |
270 | define("URL_STATIC",DOMAIN."/static/"); |
271 | define("URL_IMG", URL_STATIC."/images/icons/"); //Images location |
272 | #define("URL_CSS", URL_STATIC."/css/chromz/"); //CSS location |
273 | |
274 | === modified file 'panel.php' |
275 | --- panel.php 2011-03-11 16:42:13 +0000 |
276 | +++ panel.php 2011-03-11 19:32:59 +0000 |
277 | @@ -5,40 +5,8 @@ |
278 | * panel.php - Main script |
279 | * This file is called from the webbrowser when using RemoteCP |
280 | */ |
281 | -if (get_magic_quotes_gpc()) { //Disable & remove magic quotes ! (http://www.php.net/manual/en/security.magicquotes.disabling.php: example 2) |
282 | - $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); |
283 | - while (list($key, $val) = each($process)) { |
284 | - foreach ($val as $k => $v) { |
285 | - unset($process[$key][$k]); |
286 | - if (is_array($v)) { |
287 | - $process[$key][stripslashes($k)] = $v; |
288 | - $process[] = &$process[$key][stripslashes($k)]; |
289 | - } else { |
290 | - $process[$key][stripslashes($k)] = stripslashes($v); |
291 | - } |
292 | - } |
293 | - } |
294 | - unset($process); |
295 | -} |
296 | - |
297 | -ob_start('ob_gzhandler'); |
298 | -header('Cache-Control: private'); |
299 | -// session_cache_limiter('private'); |
300 | -require_once('inc/errorhandler.php'); |
301 | -require_once('inc/sitemgmt/constants.php'); |
302 | -require_once('inc/sqlsess/sqlsess.php'); |
303 | -// Register sqlsess variables |
304 | -$sess=new SQLSESS($local_connection,'sessions'); |
305 | -#$sess->session_id(); |
306 | -$sess->session_start(); |
307 | -unset($_SESSION); |
308 | -$_SESSION=$sess->session_get_contents(); |
309 | -// End sqlsess |
310 | -require_once('inc/sitemgmt/session.php'); |
311 | -require_once('trans/trans.php'); |
312 | +require('inc/controllers.php'); |
313 | $t->addFile(__FILE__); |
314 | -require_once('inc/remotedbauth.php'); |
315 | -require_once('inc/accountlevels.php'); |
316 | //Basic HTML start |
317 | ?> |
318 | <!DOCTYPE html> |
319 | @@ -64,7 +32,7 @@ |
320 | |
321 | if(!isset($_GET['control'])) { ?> |
322 | <style type="text/css"> |
323 | - body{ font: 62.5% "Trebuchet MS", sans-serif; margin: 50px;} |
324 | + body{ font: 62.5% "Trebuchet MS", sans-serif; margin: 0 50px;} |
325 | #tabs li .ui-icon-close { float: left; margin: 0.4em 0.2em 0 0; cursor: pointer; } |
326 | #tabs div a {cursor: pointer; text-decoration: underline; color: blue;} |
327 | .ui-progressbar-value { background-image: url(<?php echo URL_JQUERY; ?>/images/pbar-ani.gif); } |
328 | @@ -105,42 +73,7 @@ |
329 | $('.gui-dlg-noresize').dialog({ resizable: false}); |
330 | |
331 | $('.gui-button').button(); |
332 | - // GUI specifieke opties |
333 | - $('#button_log-off').button({ |
334 | - icons: { |
335 | - primary: 'ui-icon-key' |
336 | - } |
337 | - }); |
338 | - $('#button_register').button({ |
339 | - icons: { |
340 | - primary: 'ui-icon-person' |
341 | - } |
342 | - }); |
343 | - $('#dlg_log-in').dialog({ |
344 | - buttons: { |
345 | - "Inloggen": function() { |
346 | - logged_in=ajax.post('?control=login','user='+document.login.user.value+'&pass='+document.login.pass.value); |
347 | - if(logged_in=="true") { |
348 | - refreshLoc(); |
349 | - $(this).dialog('close'); |
350 | - } |
351 | - else if(logged_in=="false") { |
352 | - $(this).prepend('<div id="dlg_log-in-error" class="ui-state-error ui-corner-all" style="padding: 0 .7em;"><p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span><?php echo $t->_('Login failed. Try again'); ?></p></div>'); |
353 | - setTimeout('$("#dlg_log-in-error").hide("clip","slow")',2000); |
354 | - } |
355 | - else { |
356 | - $(this).prepend(logged_in); |
357 | - } |
358 | - } |
359 | - }, |
360 | - close: function() { |
361 | - document.login.reset(); |
362 | - } |
363 | - } |
364 | - ); |
365 | - |
366 | - <?php if(!$session->logged_in) { echo "$('#dlg_log-in').dialog('open');" ;}?> |
367 | - |
368 | + |
369 | |
370 | |
371 | // Tab templates... DO NOT EDIT |
372 | @@ -208,8 +141,6 @@ |
373 | |
374 | </head> |
375 | <body> |
376 | - <p class="gui-button" id="button_log-off" onclick="$.ajax({async:false,url:'?control=logoff'});refreshLoc(); $('#dlg_log-in').dialog('open'); return false;"><?php echo $t->_('Log off'); ?></p> |
377 | - <p class="gui-button" id="button_register" onclick="$('#dlg_register').empty().append(ajax.get('?control=register')).dialog('open');return false;"><?php echo $t->_('Register'); ?></p> |
378 | <div id="tabs"> |
379 | <ul> |
380 | |
381 | @@ -222,14 +153,6 @@ |
382 | <div id="dlg_js-e" title="JavaScript ERROR" class="gui-dlg gui-dlg-fs gui-dlg-alert"> |
383 | <div class="ui-state-error ui-corner-all" style="padding: 0 .7em;"><p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span><?php echo $t->_('An error occured in your browser\'s JavaScript interpreter.</p><p>Probably the page doesn\'t work anymore.'); ?></p></div> |
384 | </div> |
385 | - <div id="dlg_log-in" title="<?php echo $t->_('Log in'); ?>" class="gui-dlg gui-dlg-fs gui-dlg-noresize"> |
386 | - <form name="login"> |
387 | - <?php echo $t->_('Username'); ?>: <input type="text" name="user" id="login-user"><br> |
388 | - <?php echo $t->_('Password'); ?>: <input type="password" name="pass" id="login-pass"> |
389 | - </form> |
390 | - </div> |
391 | - <div id="dlg_register" title="<?php echo $t->_('Register'); ?>" class="gui-dlg gui-dlg-fs gui-dlg-noresize"> |
392 | - </div> |
393 | <script language="JavaScript"> |
394 | //Initialize desktop |
395 | document.getElementById('tabs-desktop').innerHTML=ajax.get('?control=desktop'); |
396 | @@ -245,7 +168,7 @@ |
397 | <AJAX_SCRIPTEVAL>NULL</AJAX_SCRIPTEVAL> |
398 | < HEADERS --> |
399 | <div class="ui-state-highlight ui-corner-all" style="padding: 0 .7em;"><p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span> |
400 | -<?php echo $t->_('<strong>Authentication expired</strong> You were too long inactive. Your session has expired.'); ?></p><p><span aria-disabled="false" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="$('#dlg_log-in').dialog('open');"><span class="ui-button-text"><?php echo $t->_('Relogin'); ?></span></span> |
401 | +<?php echo $t->_('<strong>Authentication expired</strong> You were too long inactive. Your session has expired.'); ?></p><p><span aria-disabled="false" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="parent.$('#dlg_log-in').dialog('open');"><span class="ui-button-text"><?php echo $t->_('Relogin'); ?></span></span> |
402 | </p></div> |
403 | <!-- AJAX_STOP --><?php |
404 | exit; |
405 | |
406 | === modified file 'system/desktop.php' |
407 | --- system/desktop.php 2011-01-30 17:23:45 +0000 |
408 | +++ system/desktop.php 2011-03-11 19:32:59 +0000 |
409 | @@ -14,7 +14,7 @@ |
410 | <?php |
411 | $q=$local_connection->query("SELECT * FROM `remote_databases_assignments` WHERE `username`='$session->username'"); |
412 | while($databases=$q->fetch_assoc()) { |
413 | - $db=$local_connection->query("SELECT * FROM `remote_databases` WHERE `key`='$databases[key]'"); $dbinfo=$db->fetch_assoc(); ?>| <a onclick="window.open('panel.php/<?php echo $databases['key']; ?>/');"><?php echo $dbinfo['user'].'@'.$dbinfo['host'].'/'.$dbinfo['database']; ?></a> |<?php |
414 | + $db=$local_connection->query("SELECT * FROM `remote_databases` WHERE `key`='$databases[key]'"); $dbinfo=$db->fetch_assoc(); ?>| <a onclick="parent.frames.addFrame('panel.php/<?php echo $databases['key']; ?>/');"><?php echo $dbinfo['user'].'@'.$dbinfo['host'].'/'.$dbinfo['database']; ?></a> |<?php |
415 | } |
416 | echo '| <a onclick="openLoc(\''.$t->_('Add database').'\',\'?control=database\',\'add_db\');">'.$t->_('Add database').'</a> |'; |
417 | } |
Looks okay.