This commit is contained in:
friendica 2015-01-18 19:25:10 -08:00
commit 21da3443f3
4 changed files with 23 additions and 8 deletions

View File

@ -49,7 +49,7 @@ define ( 'RED_PLATFORM', 'redmatrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1132 );
define ( 'DB_UPDATE_VERSION', 1133 );
/**
* Constant with a HTML line break.

View File

@ -96,7 +96,7 @@ class RedFile extends DAV\Node implements DAV\IFile {
$size = 0;
// @todo only 3 values are needed
$c = q("SELECT * FROM channel WHERE channel_id = %d AND NOT (channel_pageflags & %d)>0 LIMIT 1",
$c = q("SELECT * FROM channel WHERE channel_id = %d AND (channel_pageflags & %d) = 0 LIMIT 1",
intval($this->auth->owner_id),
intval(PAGE_REMOVED)
);
@ -107,14 +107,15 @@ class RedFile extends DAV\Node implements DAV\IFile {
);
if ($r) {
if ($r[0]['flags'] & ATTACH_FLAG_OS) {
$f = 'store/' . $this->auth->owner_nick . '/' . (($r[0]['data']) ? $r[0]['data'] : '');
$fname = dbunescbin($r[0]['data']);
$f = 'store/' . $this->auth->owner_nick . '/' . (($fname) ? $fname : '');
// @todo check return value and set $size directly
@file_put_contents($f, $data);
$size = @filesize($f);
logger('filename: ' . $f . ' size: ' . $size, LOGGER_DEBUG);
} else {
$r = q("UPDATE attach SET data = '%s' WHERE hash = '%s' AND uid = %d",
dbesc(stream_get_contents($data)),
dbescbin(stream_get_contents($data)),
dbesc($this->data['hash']),
intval($this->data['uid'])
);
@ -191,10 +192,10 @@ class RedFile extends DAV\Node implements DAV\IFile {
}
if ($r[0]['flags'] & ATTACH_FLAG_OS ) {
$f = 'store/' . $this->auth->owner_nick . '/' . (($this->os_path) ? $this->os_path . '/' : '') . $r[0]['data'];
$f = 'store/' . $this->auth->owner_nick . '/' . (($this->os_path) ? $this->os_path . '/' : '') . dbunescbin($r[0]['data']);
return fopen($f, 'rb');
}
return $r[0]['data'];
return dbunescbin($r[0]['data']);
}
}

View File

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1132 );
define( 'UPDATE_VERSION' , 1133 );
/**
*
@ -1486,6 +1486,9 @@ function update_r1130() {
}
function update_r1131() {
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) // make sure this gets skipped for anyone who hasn't run it yet, it will fail on pg
return UPDATE_SUCCESS;
$r1 = q("ALTER TABLE `abook` ADD `abook_rating_text` TEXT NOT NULL DEFAULT '' AFTER `abook_rating` ");
$r2 = q("ALTER TABLE `xlink` ADD `xlink_rating_text` TEXT NOT NULL DEFAULT '' AFTER `xlink_rating` ");
@ -1493,4 +1496,14 @@ function update_r1131() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1132() {
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { // correct previous failed update
$r1 = q("ALTER TABLE abook ADD abook_rating_text TEXT NOT NULL DEFAULT '' ");
$r2 = q("ALTER TABLE xlink ADD xlink_rating_text TEXT NOT NULL DEFAULT '' ");
if(!$r1 || !$r2)
return UPDATE_FAILED;
}
return UPDATE_SUCCESS;
}

View File

@ -7,7 +7,8 @@
*/
/* Load OAuth lib. You can find it at http://oauth.net */
require_once('library/OAuth1.php');
if(!class_exists('OAuthException'))
require_once('library/OAuth1.php');
/**
* Twitter OAuth class