[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Librefm-commits] [1405] Fixed group ownership.
From: |
Toby Inkster |
Subject: |
[Librefm-commits] [1405] Fixed group ownership. |
Date: |
Fri, 08 May 2009 10:10:42 +0000 |
Revision: 1405
http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1405
Author: tobyink
Date: 2009-05-08 10:10:41 +0000 (Fri, 08 May 2009)
Log Message:
-----------
Fixed group ownership.
Modified Paths:
--------------
trunk/nixtape/data/Group.php
trunk/nixtape/data/User.php
Modified: trunk/nixtape/data/Group.php
===================================================================
--- trunk/nixtape/data/Group.php 2009-05-08 09:09:16 UTC (rev 1404)
+++ trunk/nixtape/data/Group.php 2009-05-08 10:10:41 UTC (rev 1405)
@@ -71,7 +71,7 @@
$this->homepage = $row['homepage'];
$this->bio = $row['bio'];
$this->avatar_uri = $row["avatar_uri"];
- $this->owner = new User($row['owner']);
+ $this->owner =
User::new_from_uniqueid_number($row['owner']);
$this->count = -1;
$this->users = array();
if (! preg_match('/\:/', $this->id))
@@ -172,13 +172,18 @@
return $res;
}
+ // Get ID number for group
$q = sprintf('SELECT id FROM Groups WHERE lower(groupname) =
lower(%s)', $mdb2->quote($name, 'text'));
$res = $mdb2->query($q);
if (PEAR::isError($res))
{
return $res;
}
- $grp = $result->fetchOne(0);
+ elseif (!$res->numRows())
+ {
+ return (new PEAR_Error("Something has gone horribly,
horribly wrong!"));
+ }
+ $grp = $res->fetchOne(0);
// Group owner must be a member of the group
$q = sprintf('INSERT INTO Group_Members (grp, member, joined)
VALUES (%s, %s, %d)'
Modified: trunk/nixtape/data/User.php
===================================================================
--- trunk/nixtape/data/User.php 2009-05-08 09:09:16 UTC (rev 1404)
+++ trunk/nixtape/data/User.php 2009-05-08 10:10:41 UTC (rev 1405)
@@ -34,7 +34,7 @@
public $name, $email, $fullname, $bio, $location, $homepage, $error,
$userlevel;
public $id, $acctid, $avatar_uri, $location_uri, $webid_uri,
$laconica_profile, $journal_rss;
- public $password, $has_identica, $created, $modified;
+ public $password, $has_identica, $created, $modified, $uniqueid;
/**
* User constructor
@@ -84,6 +84,17 @@
}
}
+
+ public static function new_from_uniqueid_number ($uid)
+ {
+ global $mdb2;
+ $res = $mdb2->query(sprintf('SELECT * FROM Users WHERE uniqueid
= %d', (int)$uid));
+ if($res->numRows()) {
+ $row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);
+ return new User($row['username'], $row);
+ }
+ }
+
function save ()
{
global $mdb2;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Librefm-commits] [1405] Fixed group ownership.,
Toby Inkster <=