summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/Avatar.php2
-rw-r--r--classes/Notice.php13
-rw-r--r--classes/Plugin_DataObject.php195
-rw-r--r--classes/Remote_profile.php10
-rw-r--r--classes/statusnet.ini24
-rw-r--r--classes/statusnet.links.ini3
6 files changed, 43 insertions, 204 deletions
diff --git a/classes/Avatar.php b/classes/Avatar.php
index cc7a6b647..8d6424e8b 100644
--- a/classes/Avatar.php
+++ b/classes/Avatar.php
@@ -81,7 +81,7 @@ class Avatar extends Memcached_DataObject
if (empty($server)) {
$server = common_config('site', 'server');
}
- common_debug('path = ' . $path);
+
// XXX: protocol
return 'http://'.$server.$path.$filename;
diff --git a/classes/Notice.php b/classes/Notice.php
index ebb5022b9..661072156 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -922,13 +922,14 @@ class Notice extends Memcached_DataObject
}
$groups = $this->saveGroups();
+ $profile = $this->getProfile();
foreach ($groups as $group) {
$users = $group->getUserMembers();
foreach ($users as $id) {
if (!array_key_exists($id, $ni)) {
$user = User::staticGet('id', $id);
- if (!$user->hasBlocked($notice->profile_id)) {
+ if (!$user->hasBlocked($profile)) {
$ni[$id] = NOTICE_INBOX_SOURCE_GROUP;
}
}
@@ -964,7 +965,10 @@ class Notice extends Memcached_DataObject
}
if ($cnt >= MAX_BOXCARS) {
$inbox = new Notice_inbox();
- $inbox->query($qry);
+ $result = $inbox->query($qry);
+ if (PEAR::isError($result)) {
+ common_log_db_error($inbox, $qry);
+ }
$qry = $qryhdr;
$cnt = 0;
}
@@ -972,7 +976,10 @@ class Notice extends Memcached_DataObject
if ($cnt > 0) {
$inbox = new Notice_inbox();
- $inbox->query($qry);
+ $result = $inbox->query($qry);
+ if (PEAR::isError($result)) {
+ common_log_db_error($inbox, $qry);
+ }
}
return;
diff --git a/classes/Plugin_DataObject.php b/classes/Plugin_DataObject.php
deleted file mode 100644
index d5cecf0f7..000000000
--- a/classes/Plugin_DataObject.php
+++ /dev/null
@@ -1,195 +0,0 @@
-<?php
-/*
- * StatusNet - the distributed open-source microblogging tool
- * Copyright (C) 2008, 2009, StatusNet, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
-
-require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
-
-abstract class Plugin_DataObject extends Memcached_DataObject
-{
- function table() {
- static $table = null;
- if($table == null) {
- $table = array();
- $DB = $this->getDatabaseConnection();
- $dbtype = $DB->phptype;
- $tableDef = $this->tableDef();
- foreach($tableDef->columns as $columnDef){
- switch(strtoupper($columnDef->type)) {
- /*shamelessly copied from DB_DataObject_Generator*/
- case 'INT':
- case 'INT2': // postgres
- case 'INT4': // postgres
- case 'INT8': // postgres
- case 'SERIAL4': // postgres
- case 'SERIAL8': // postgres
- case 'INTEGER':
- case 'TINYINT':
- case 'SMALLINT':
- case 'MEDIUMINT':
- case 'BIGINT':
- $type = DB_DATAOBJECT_INT;
- if ($columnDef->size == 1) {
- $type += DB_DATAOBJECT_BOOL;
- }
- break;
-
- case 'REAL':
- case 'DOUBLE':
- case 'DOUBLE PRECISION': // double precision (firebird)
- case 'FLOAT':
- case 'FLOAT4': // real (postgres)
- case 'FLOAT8': // double precision (postgres)
- case 'DECIMAL':
- case 'MONEY': // mssql and maybe others
- case 'NUMERIC':
- case 'NUMBER': // oci8
- $type = DB_DATAOBJECT_INT; // should really by FLOAT!!! / MONEY...
- break;
-
- case 'YEAR':
- $type = DB_DATAOBJECT_INT;
- break;
-
- case 'BIT':
- case 'BOOL':
- case 'BOOLEAN':
-
- $type = DB_DATAOBJECT_BOOL;
- // postgres needs to quote '0'
- if ($dbtype == 'pgsql') {
- $type += DB_DATAOBJECT_STR;
- }
- break;
-
- case 'STRING':
- case 'CHAR':
- case 'VARCHAR':
- case 'VARCHAR2':
- case 'TINYTEXT':
-
- case 'ENUM':
- case 'SET': // not really but oh well
-
- case 'POINT': // mysql geometry stuff - not really string - but will do..
-
- case 'TIMESTAMPTZ': // postgres
- case 'BPCHAR': // postgres
- case 'INTERVAL': // postgres (eg. '12 days')
-
- case 'CIDR': // postgres IP net spec
- case 'INET': // postgres IP
- case 'MACADDR': // postgress network Mac address.
-
- case 'INTEGER[]': // postgres type
- case 'BOOLEAN[]': // postgres type
-
- $type = DB_DATAOBJECT_STR;
- break;
-
- case 'TEXT':
- case 'MEDIUMTEXT':
- case 'LONGTEXT':
-
- $type = DB_DATAOBJECT_STR + DB_DATAOBJECT_TXT;
- break;
-
-
- case 'DATE':
- $type = DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE;
- break;
-
- case 'TIME':
- $type = DB_DATAOBJECT_STR + DB_DATAOBJECT_TIME;
- break;
-
-
- case 'DATETIME':
-
- $type = DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME;
- break;
-
- case 'TIMESTAMP': // do other databases use this???
-
- $type = ($dbtype == 'mysql') ?
- DB_DATAOBJECT_MYSQLTIMESTAMP :
- DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME;
- break;
-
-
- case 'BLOB': /// these should really be ignored!!!???
- case 'TINYBLOB':
- case 'MEDIUMBLOB':
- case 'LONGBLOB':
-
- case 'CLOB': // oracle character lob support
-
- case 'BYTEA': // postgres blob support..
- $type = DB_DATAOBJECT_STR + DB_DATAOBJECT_BLOB;
- break;
-
- default:
- throw new Exception("Cannot handle datatype: $columnDef->type");
- }
- if(! $columnDef->nullable) {
- $type+=DB_DATAOBJECT_NOTNULL;
- }
- $table[$columnDef->name]=$type;
- }
- }
- return $table;
- }
-
- function keys() {
- static $keys = null;
- if($keys == null) {
- $keys = array();
- $tableDef = $this->tableDef();
- foreach($tableDef->columns as $columnDef){
- if($columnDef->key != null){
- $keys[] = $columnDef->name;
- }
- }
- }
- return $keys;
- }
-
- function sequenceKey() {
- static $sequenceKey = null;
- if($sequenceKey == null) {
- $sequenceKey = array(false,false);
- $tableDef = $this->tableDef();
- foreach($tableDef->columns as $columnDef){
- if($columnDef->key == 'PRI' && $columnDef->auto_increment){
- $sequenceKey=array($columnDef->name,true);
- }
- }
- }
- return $sequenceKey;
- }
-
- /**
- * Get the TableDef object that represents the table backing this class
- * Ideally, this function would a static function, but PHP doesn't allow
- * abstract static functions
- * @return TableDef TableDef instance
- */
- abstract function tableDef();
-}
-
diff --git a/classes/Remote_profile.php b/classes/Remote_profile.php
index 9f7bfeadc..0a1676a6a 100644
--- a/classes/Remote_profile.php
+++ b/classes/Remote_profile.php
@@ -43,4 +43,14 @@ class Remote_profile extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
+
+ function hasRight($right)
+ {
+ $profile = Profile::staticGet($this->id);
+ if ($profile) {
+ return $profile->hasright($right);
+ } else {
+ throw new Exception("Missing profile");
+ }
+ }
}
diff --git a/classes/statusnet.ini b/classes/statusnet.ini
index b2509dac5..f12707ba1 100644
--- a/classes/statusnet.ini
+++ b/classes/statusnet.ini
@@ -1,4 +1,3 @@
-
[avatar]
profile_id = 129
original = 17
@@ -542,4 +541,25 @@ created = 142
modified = 384
[user_group__keys]
-id = N \ No newline at end of file
+id = N
+
+[user_openid]
+canonical = 130
+display = 130
+user_id = 129
+created = 142
+modified = 384
+
+[user_openid__keys]
+canonical = K
+display = U
+
+[user_openid_trustroot]
+trustroot = 130
+user_id = 129
+created = 142
+modified = 384
+
+[user_openid__keys]
+trustroot = K
+user_id = K \ No newline at end of file
diff --git a/classes/statusnet.links.ini b/classes/statusnet.links.ini
index 95c63f3c0..7f233e676 100644
--- a/classes/statusnet.links.ini
+++ b/classes/statusnet.links.ini
@@ -22,9 +22,6 @@ consumer_key = consumer:consumer_key
[nonce]
consumer_key,token = token:consumer_key,token
-[user_openid]
-user_id = user:id
-
[confirm_address]
user_id = user:id