diff options
author | friendica <info@friendica.com> | 2015-01-18 19:25:10 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2015-01-18 19:25:10 -0800 |
commit | 21da3443f30ba35225bef7e1a84fbf0ee8750b25 (patch) | |
tree | 140040569c6cd070decfad305cf03d7fb906876a | |
parent | 4c45068d70c086fc1417ab95f632a560a31efca2 (diff) | |
parent | 7420896693589f1a4a5e91cef5c13852599464fd (diff) | |
download | volse-hubzilla-21da3443f30ba35225bef7e1a84fbf0ee8750b25.tar.gz volse-hubzilla-21da3443f30ba35225bef7e1a84fbf0ee8750b25.tar.bz2 volse-hubzilla-21da3443f30ba35225bef7e1a84fbf0ee8750b25.zip |
Merge https://github.com/friendica/red into pending_merge
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/RedDAV/RedFile.php | 11 | ||||
-rw-r--r-- | install/update.php | 15 | ||||
-rw-r--r-- | library/twitteroauth.php | 3 |
4 files changed, 23 insertions, 8 deletions
@@ -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. diff --git a/include/RedDAV/RedFile.php b/include/RedDAV/RedFile.php index f2ee071b8..9ce6490a7 100644 --- a/include/RedDAV/RedFile.php +++ b/include/RedDAV/RedFile.php @@ -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']); } } diff --git a/install/update.php b/install/update.php index f7ccb8210..381ea0828 100644 --- a/install/update.php +++ b/install/update.php @@ -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; }
\ No newline at end of file diff --git a/library/twitteroauth.php b/library/twitteroauth.php index 009ad56bd..a40949534 100644 --- a/library/twitteroauth.php +++ b/library/twitteroauth.php @@ -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 |