Merge lp:~vierbergenlars/remotecp-panel/edit-database-details into lp:remotecp-panel/1.x

Proposed by Lars Vierbergen
Status: Superseded
Proposed branch: lp:~vierbergenlars/remotecp-panel/edit-database-details
Merge into: lp:remotecp-panel/1.x
Diff against target: 109 lines (+78/-0) (has conflicts)
2 files modified
inc/remote_session/session.php (+36/-0)
system/database.php (+42/-0)
Text conflict in inc/remote_session/session.php
Text conflict in system/database.php
To merge this branch: bzr merge lp:~vierbergenlars/remotecp-panel/edit-database-details
Reviewer Review Type Date Requested Status
Lars Vierbergen Approve
Review via email: mp+48231@code.launchpad.net

This proposal has been superseded by a proposal from 2011-02-02.

To post a comment you must log in.
Revision history for this message
Lars Vierbergen (vierbergenlars) :
review: Approve
Revision history for this message
Lars Vierbergen (vierbergenlars) wrote :

The module throws a notice about Notice: Undefined index: function in G:\Apache\xampp\htdocs\dev\remotecp-panel_edit-database-details\system\database.php on line 78

review: Needs Fixing
Revision history for this message
Lars Vierbergen (vierbergenlars) wrote :

Is ok now. (Changed function order)

review: Approve
67. By Lars Vierbergen

Undefined index notice fixed (changed order)

68. By Lars Vierbergen

Remove a left-behind var_dump

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'inc/remote_session/session.php'
2--- inc/remote_session/session.php 2011-01-31 16:01:17 +0000
3+++ inc/remote_session/session.php 2011-02-01 19:36:30 +0000
4@@ -1,4 +1,5 @@
5 <?php //@./inc/remote_session/session.php ?>
6+<<<<<<< TREE
7 <?php
8 class remote_session {
9 private $database;
10@@ -33,4 +34,39 @@
11 }
12 }
13
14+=======
15+<?php
16+class remote_session {
17+ private $database;
18+ public $userlevel;
19+ public $dbkey=substr($_SERVER['PATH_INFO'],1,32); //Set the database key
20+ private $username;
21+ private $authenticated
22+
23+ function __construct() {
24+ global $local_connection,$session;
25+ $this->database=$local_connection;
26+ $this->username=$session->username;
27+ if($this->init()) $this->authenticated=true;
28+ else $this->authenticated=false;
29+ }
30+ private function init() {
31+ $q0=$this->database->query('SELECT * FROM `remote_databases_assignments` WHERE `key`='$\''.$this->dbkey.'\' AND `username`=\''.$this->username.'\'');
32+ if($q0->num_rows!=1) return false;
33+ $r0=$q0->fetch_assoc();
34+ $this->userlevel=$r0['level'];
35+ return true;
36+ }
37+ function isAdmin() {
38+ return ($this->userlevel==9);
39+ }
40+ function isSiteCreator() {
41+ return ($this->userlevel>=2);
42+ }
43+ function authenticated() {
44+ return $this->authenticated;
45+ }
46+}
47+
48+>>>>>>> MERGE-SOURCE
49 $remote_session=new remote_session;
50\ No newline at end of file
51
52=== modified file 'system/database.php'
53--- system/database.php 2011-01-31 16:29:47 +0000
54+++ system/database.php 2011-02-01 19:36:30 +0000
55@@ -111,6 +111,7 @@
56 }
57
58 }
59+<<<<<<< TREE
60 else if(RDB&&$_GET['control']=='admin'&&$remote_session->isAdmin()) {
61 if(!isset($_GET['function'])) {
62 $q=$local_connection->query('SELECT * FROM `remote_databases_assignments` WHERE `key`="'.$remote_session->dbkey.'"') ?>
63@@ -150,4 +151,45 @@
64 echo "false";
65 }
66 }
67+=======
68+else if(RDB&&$_GET['control']=='admin'&&$remote_session->isAdmin()) {
69+ if(!isset($_GET['function'])) {
70+ $q=$remote_connection->query('SELECT * FROM `remote_databases_assignments` WHERE `key`="'.$remote_session->dbkey.'"') ?>
71+ <table><tr><th><?php echo $t->_('User'); ?></th><th><?php echo $t->_('Lv.'); ?></th><th><?php echo $t->_('Delete'); ?></th></tr>
72+ <?php while($users=$q->fetch_assoc()) { ?>
73+ <tr><td><img src="<?php echo URL_IMG; ?>/Silk/user.png"> <?php echo $users['username']; ?></td><td<?php if($users['username']!=$session->username) {?> ondblclick='db.admin.user.editlvl.expand("<?php echo $users['username']; ?>",this)'<?php } ?>><?php echo $users['userlevel'] ?></td><td><?php if($users['username']!=$session->username) {?><a onclick='db.admin.user.delete("<?php echo $users['username']; ?>")'><img src="<?php echo URL_IMG; ?>/Silk/delete.png" alt="<?php echo $t->_('Delete'); ?>" title="<?php echo $t->_('Revoke user privileges'); ?>"></a><?php } ?></td></tr>
74+ <?php } ?>
75+ <tr><td colspan='3'><img src="<?php echo URL_IMG; ?>/Silk/user_add.png" alt="+" title="<?php echo $t->_('Add user'); ?>"> <input type='text' onclick='openusers(this)'></td><td><a onclick='db.admin.user.add(this);'><img src="<?php echo URL_IMG; ?>/Silk/add.png" alt="<?php echo $t->_('Add'); ?>" title="<?php echo $t->_('Add new user'); ?>"></a></td></tr>
76+ </table>
77+ <?php
78+}
79+ else if($_GET['function']=='editlvl') {
80+ if($remote_connection->query('UPDATE `remote_databases_assignments` SET `level`='.$_GET['lvl'].' WHERE `username`=\''.$_GET['user'].'\' AND `key`=\''.$remote_session->dbkey.'\'')) {
81+ echo "true";
82+ }
83+ else {
84+ echo "false";
85+ }
86+ }
87+ else if($_GET['function']=='deleteuser') {
88+ if($remote_connection->query('DELETE FROM `remote_databases_assignments` WHERE `username`=\''.$_POST['username'].'\' AND `key`=\''.$remote_session->dbkey.'\'')) {
89+ echo "true";
90+ }
91+ else {
92+ echo "false";
93+ }
94+ }
95+ else if($_GET['function']=="adduser") {
96+ if(!$database->usernameTaken($_POST['username'])) {
97+ echo "false";
98+ exit;
99+ }
100+ if($remote_connection->query('INSERT INTO `remote_databases_assignments` VALUES(\''.$remote_session->dbkey.'\',\''.$_POST['username'].'\',1)')) {
101+ echo "true";
102+ }
103+ else {
104+ echo "false";
105+ }
106+ }
107+>>>>>>> MERGE-SOURCE
108 }
109\ No newline at end of file

Subscribers

People subscribed via source and target branches

to all changes: