aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2018-02-21 12:55:29 +0100
committerGitHub <noreply@github.com>2018-02-21 12:55:29 +0100
commit2d17e1c677cd981858a4080af98edb51bbb5d822 (patch)
tree54d5d148d368632158584ba7eec7872170524e00
parentd7ecaa8b23a36ea1e9a0f185017930b5552c00b5 (diff)
parenta829256bc4803731881a51bddd19ee59a5a234ff (diff)
downloadvolse-hubzilla-2d17e1c677cd981858a4080af98edb51bbb5d822.tar.gz
volse-hubzilla-2d17e1c677cd981858a4080af98edb51bbb5d822.tar.bz2
volse-hubzilla-2d17e1c677cd981858a4080af98edb51bbb5d822.zip
Merge pull request #15 from redmatrix/dev
Dev
-rw-r--r--Zotlabs/Access/PermissionLimits.php4
-rw-r--r--Zotlabs/Daemon/Notifier.php18
-rw-r--r--Zotlabs/Daemon/Queue.php6
-rw-r--r--Zotlabs/Identity/OAuth2Server.php34
-rw-r--r--Zotlabs/Identity/OAuth2Storage.php81
-rw-r--r--Zotlabs/Lib/Apps.php9
-rw-r--r--Zotlabs/Lib/DB_Upgrade.php134
-rw-r--r--Zotlabs/Lib/Enotify.php45
-rw-r--r--Zotlabs/Lib/Share.php141
-rw-r--r--Zotlabs/Module/Admin/Dbsync.php54
-rw-r--r--Zotlabs/Module/Admin/Security.php12
-rw-r--r--Zotlabs/Module/Admin/Site.php4
-rw-r--r--Zotlabs/Module/Authorize.php94
-rw-r--r--Zotlabs/Module/Cards.php2
-rw-r--r--Zotlabs/Module/Channel.php14
-rw-r--r--Zotlabs/Module/Connections.php2
-rw-r--r--Zotlabs/Module/Connedit.php1
-rw-r--r--Zotlabs/Module/Defperms.php2
-rw-r--r--Zotlabs/Module/Hq.php4
-rw-r--r--Zotlabs/Module/Item.php17
-rw-r--r--Zotlabs/Module/Network.php38
-rw-r--r--Zotlabs/Module/New_channel.php1
-rw-r--r--Zotlabs/Module/Ping.php54
-rw-r--r--Zotlabs/Module/Pubstream.php19
-rw-r--r--Zotlabs/Module/Search.php2
-rw-r--r--Zotlabs/Module/Settings/Channel.php9
-rw-r--r--Zotlabs/Module/Settings/Display.php26
-rw-r--r--Zotlabs/Module/Share.php4
-rw-r--r--Zotlabs/Module/Token.php49
-rw-r--r--Zotlabs/Render/Theme.php30
-rw-r--r--Zotlabs/Update/_1000.php15
-rw-r--r--Zotlabs/Update/_1001.php27
-rw-r--r--Zotlabs/Update/_1002.php20
-rw-r--r--Zotlabs/Update/_1003.php15
-rw-r--r--Zotlabs/Update/_1004.php24
-rw-r--r--Zotlabs/Update/_1005.php13
-rw-r--r--Zotlabs/Update/_1006.php45
-rw-r--r--Zotlabs/Update/_1007.php15
-rw-r--r--Zotlabs/Update/_1008.php15
-rw-r--r--Zotlabs/Update/_1009.php15
-rw-r--r--Zotlabs/Update/_1010.php18
-rw-r--r--Zotlabs/Update/_1011.php16
-rw-r--r--Zotlabs/Update/_1012.php16
-rw-r--r--Zotlabs/Update/_1013.php21
-rw-r--r--Zotlabs/Update/_1014.php14
-rw-r--r--Zotlabs/Update/_1015.php19
-rw-r--r--Zotlabs/Update/_1016.php39
-rw-r--r--Zotlabs/Update/_1017.php14
-rw-r--r--Zotlabs/Update/_1018.php16
-rw-r--r--Zotlabs/Update/_1019.php14
-rw-r--r--Zotlabs/Update/_1020.php14
-rw-r--r--Zotlabs/Update/_1021.php17
-rw-r--r--Zotlabs/Update/_1022.php14
-rw-r--r--Zotlabs/Update/_1023.php14
-rw-r--r--Zotlabs/Update/_1024.php15
-rw-r--r--Zotlabs/Update/_1025.php15
-rw-r--r--Zotlabs/Update/_1026.php16
-rw-r--r--Zotlabs/Update/_1027.php15
-rw-r--r--Zotlabs/Update/_1028.php15
-rw-r--r--Zotlabs/Update/_1029.php15
-rw-r--r--Zotlabs/Update/_1030.php29
-rw-r--r--Zotlabs/Update/_1031.php16
-rw-r--r--Zotlabs/Update/_1032.php21
-rw-r--r--Zotlabs/Update/_1033.php29
-rw-r--r--Zotlabs/Update/_1034.php20
-rw-r--r--Zotlabs/Update/_1035.php24
-rw-r--r--Zotlabs/Update/_1036.php16
-rw-r--r--Zotlabs/Update/_1037.php30
-rw-r--r--Zotlabs/Update/_1038.php17
-rw-r--r--Zotlabs/Update/_1039.php16
-rw-r--r--Zotlabs/Update/_1040.php16
-rw-r--r--Zotlabs/Update/_1041.php16
-rw-r--r--Zotlabs/Update/_1042.php16
-rw-r--r--Zotlabs/Update/_1043.php15
-rw-r--r--Zotlabs/Update/_1044.php15
-rw-r--r--Zotlabs/Update/_1045.php15
-rw-r--r--Zotlabs/Update/_1046.php15
-rw-r--r--Zotlabs/Update/_1047.php15
-rw-r--r--Zotlabs/Update/_1048.php29
-rw-r--r--Zotlabs/Update/_1049.php15
-rw-r--r--Zotlabs/Update/_1050.php15
-rw-r--r--Zotlabs/Update/_1051.php16
-rw-r--r--Zotlabs/Update/_1052.php14
-rw-r--r--Zotlabs/Update/_1053.php14
-rw-r--r--Zotlabs/Update/_1054.php14
-rw-r--r--Zotlabs/Update/_1055.php14
-rw-r--r--Zotlabs/Update/_1056.php15
-rw-r--r--Zotlabs/Update/_1057.php14
-rw-r--r--Zotlabs/Update/_1058.php19
-rw-r--r--Zotlabs/Update/_1059.php14
-rw-r--r--Zotlabs/Update/_1060.php24
-rw-r--r--Zotlabs/Update/_1061.php15
-rw-r--r--Zotlabs/Update/_1062.php34
-rw-r--r--Zotlabs/Update/_1063.php16
-rw-r--r--Zotlabs/Update/_1064.php15
-rw-r--r--Zotlabs/Update/_1065.php15
-rw-r--r--Zotlabs/Update/_1066.php15
-rw-r--r--Zotlabs/Update/_1067.php14
-rw-r--r--Zotlabs/Update/_1068.php14
-rw-r--r--Zotlabs/Update/_1069.php15
-rw-r--r--Zotlabs/Update/_1070.php15
-rw-r--r--Zotlabs/Update/_1071.php15
-rw-r--r--Zotlabs/Update/_1072.php17
-rw-r--r--Zotlabs/Update/_1073.php23
-rw-r--r--Zotlabs/Update/_1074.php19
-rw-r--r--Zotlabs/Update/_1075.php16
-rw-r--r--Zotlabs/Update/_1076.php14
-rw-r--r--Zotlabs/Update/_1077.php14
-rw-r--r--Zotlabs/Update/_1078.php15
-rw-r--r--Zotlabs/Update/_1079.php14
-rw-r--r--Zotlabs/Update/_1080.php15
-rw-r--r--Zotlabs/Update/_1081.php14
-rw-r--r--Zotlabs/Update/_1082.php14
-rw-r--r--Zotlabs/Update/_1083.php15
-rw-r--r--Zotlabs/Update/_1084.php24
-rw-r--r--Zotlabs/Update/_1085.php20
-rw-r--r--Zotlabs/Update/_1086.php15
-rw-r--r--Zotlabs/Update/_1087.php17
-rw-r--r--Zotlabs/Update/_1088.php17
-rw-r--r--Zotlabs/Update/_1089.php16
-rw-r--r--Zotlabs/Update/_1090.php15
-rw-r--r--Zotlabs/Update/_1091.php13
-rw-r--r--Zotlabs/Update/_1092.php61
-rw-r--r--Zotlabs/Update/_1093.php14
-rw-r--r--Zotlabs/Update/_1094.php15
-rw-r--r--Zotlabs/Update/_1095.php15
-rw-r--r--Zotlabs/Update/_1096.php14
-rw-r--r--Zotlabs/Update/_1097.php24
-rw-r--r--Zotlabs/Update/_1098.php25
-rw-r--r--Zotlabs/Update/_1099.php24
-rw-r--r--Zotlabs/Update/_1100.php16
-rw-r--r--Zotlabs/Update/_1101.php13
-rw-r--r--Zotlabs/Update/_1102.php16
-rw-r--r--Zotlabs/Update/_1103.php14
-rw-r--r--Zotlabs/Update/_1104.php14
-rw-r--r--Zotlabs/Update/_1105.php15
-rw-r--r--Zotlabs/Update/_1106.php14
-rw-r--r--Zotlabs/Update/_1107.php34
-rw-r--r--Zotlabs/Update/_1108.php17
-rw-r--r--Zotlabs/Update/_1109.php16
-rw-r--r--Zotlabs/Update/_1110.php17
-rw-r--r--Zotlabs/Update/_1111.php14
-rw-r--r--Zotlabs/Update/_1112.php29
-rw-r--r--Zotlabs/Update/_1113.php16
-rw-r--r--Zotlabs/Update/_1114.php15
-rw-r--r--Zotlabs/Update/_1115.php16
-rw-r--r--Zotlabs/Update/_1116.php12
-rw-r--r--Zotlabs/Update/_1117.php16
-rw-r--r--Zotlabs/Update/_1118.php16
-rw-r--r--Zotlabs/Update/_1119.php35
-rw-r--r--Zotlabs/Update/_1120.php16
-rw-r--r--Zotlabs/Update/_1121.php16
-rw-r--r--Zotlabs/Update/_1122.php16
-rw-r--r--Zotlabs/Update/_1123.php17
-rw-r--r--Zotlabs/Update/_1124.php41
-rw-r--r--Zotlabs/Update/_1125.php16
-rw-r--r--Zotlabs/Update/_1126.php16
-rw-r--r--Zotlabs/Update/_1127.php16
-rw-r--r--Zotlabs/Update/_1128.php15
-rw-r--r--Zotlabs/Update/_1129.php14
-rw-r--r--Zotlabs/Update/_1130.php28
-rw-r--r--Zotlabs/Update/_1131.php20
-rw-r--r--Zotlabs/Update/_1132.php17
-rw-r--r--Zotlabs/Update/_1133.php38
-rw-r--r--Zotlabs/Update/_1134.php20
-rw-r--r--Zotlabs/Update/_1135.php14
-rw-r--r--Zotlabs/Update/_1136.php17
-rw-r--r--Zotlabs/Update/_1137.php16
-rw-r--r--Zotlabs/Update/_1138.php15
-rw-r--r--Zotlabs/Update/_1139.php21
-rw-r--r--Zotlabs/Update/_1140.php27
-rw-r--r--Zotlabs/Update/_1141.php30
-rw-r--r--Zotlabs/Update/_1142.php18
-rw-r--r--Zotlabs/Update/_1143.php17
-rw-r--r--Zotlabs/Update/_1144.php27
-rw-r--r--Zotlabs/Update/_1145.php30
-rw-r--r--Zotlabs/Update/_1146.php16
-rw-r--r--Zotlabs/Update/_1147.php16
-rw-r--r--Zotlabs/Update/_1148.php17
-rw-r--r--Zotlabs/Update/_1149.php35
-rw-r--r--Zotlabs/Update/_1150.php28
-rw-r--r--Zotlabs/Update/_1151.php24
-rw-r--r--Zotlabs/Update/_1152.php57
-rw-r--r--Zotlabs/Update/_1153.php18
-rw-r--r--Zotlabs/Update/_1154.php17
-rw-r--r--Zotlabs/Update/_1155.php17
-rw-r--r--Zotlabs/Update/_1156.php28
-rw-r--r--Zotlabs/Update/_1157.php17
-rw-r--r--Zotlabs/Update/_1158.php22
-rw-r--r--Zotlabs/Update/_1159.php25
-rw-r--r--Zotlabs/Update/_1160.php14
-rw-r--r--Zotlabs/Update/_1161.php43
-rw-r--r--Zotlabs/Update/_1162.php19
-rw-r--r--Zotlabs/Update/_1163.php22
-rw-r--r--Zotlabs/Update/_1164.php45
-rw-r--r--Zotlabs/Update/_1165.php20
-rw-r--r--Zotlabs/Update/_1166.php15
-rw-r--r--Zotlabs/Update/_1167.php26
-rw-r--r--Zotlabs/Update/_1168.php23
-rw-r--r--Zotlabs/Update/_1169.php27
-rw-r--r--Zotlabs/Update/_1170.php21
-rw-r--r--Zotlabs/Update/_1171.php24
-rw-r--r--Zotlabs/Update/_1172.php29
-rw-r--r--Zotlabs/Update/_1173.php27
-rw-r--r--Zotlabs/Update/_1174.php32
-rw-r--r--Zotlabs/Update/_1175.php31
-rw-r--r--Zotlabs/Update/_1176.php19
-rw-r--r--Zotlabs/Update/_1177.php66
-rw-r--r--Zotlabs/Update/_1178.php42
-rw-r--r--Zotlabs/Update/_1179.php49
-rw-r--r--Zotlabs/Update/_1180.php32
-rw-r--r--Zotlabs/Update/_1181.php14
-rw-r--r--Zotlabs/Update/_1182.php17
-rw-r--r--Zotlabs/Update/_1183.php25
-rw-r--r--Zotlabs/Update/_1184.php16
-rw-r--r--Zotlabs/Update/_1185.php16
-rw-r--r--Zotlabs/Update/_1186.php18
-rw-r--r--Zotlabs/Update/_1187.php24
-rw-r--r--Zotlabs/Update/_1188.php18
-rw-r--r--Zotlabs/Update/_1189.php23
-rw-r--r--Zotlabs/Update/_1190.php17
-rw-r--r--Zotlabs/Update/_1191.php425
-rw-r--r--Zotlabs/Update/_1192.php21
-rw-r--r--Zotlabs/Update/_1193.php22
-rw-r--r--Zotlabs/Update/_1194.php22
-rw-r--r--Zotlabs/Update/_1195.php21
-rw-r--r--Zotlabs/Update/_1196.php45
-rw-r--r--Zotlabs/Update/_1197.php17
-rw-r--r--Zotlabs/Update/_1198.php24
-rw-r--r--Zotlabs/Update/_1199.php19
-rw-r--r--Zotlabs/Update/_1200.php24
-rw-r--r--Zotlabs/Update/_1201.php27
-rw-r--r--Zotlabs/Update/_1202.php15
-rw-r--r--Zotlabs/Update/_1203.php29
-rw-r--r--Zotlabs/Web/HTTPSig.php21
-rw-r--r--Zotlabs/Widget/Forums.php3
-rw-r--r--Zotlabs/Widget/Notifications.php2
-rw-r--r--app/pubstream.apd6
-rwxr-xr-xboot.php126
-rw-r--r--include/acl_selectors.php97
-rw-r--r--include/bbcode.php12
-rw-r--r--include/channel.php4
-rw-r--r--include/conversation.php2
-rw-r--r--include/crypto.php81
-rw-r--r--include/datetime.php97
-rwxr-xr-xinclude/dba/dba_driver.php82
-rwxr-xr-xinclude/dba/dba_mysql.php67
-rwxr-xr-xinclude/dba/dba_mysqli.php86
-rwxr-xr-xinclude/dba/dba_pdo.php43
-rw-r--r--include/dba/dba_postgres.php117
-rw-r--r--include/feedutils.php245
-rwxr-xr-xinclude/items.php18
-rw-r--r--include/js_strings.php14
-rw-r--r--include/nav.php4
-rw-r--r--include/network.php4
-rwxr-xr-xinclude/plugin.php72
-rw-r--r--include/queue_fn.php29
-rw-r--r--include/text.php55
-rw-r--r--include/zot.php199
-rw-r--r--install/schema_mysql.sql19
-rw-r--r--install/update.php3072
-rw-r--r--library/Mobile_Detect/Mobile_Detect.php221
-rw-r--r--tests/phpunit-pgsql.xml11
-rw-r--r--tests/phpunit.xml.dist11
-rwxr-xr-xtests/travis/prepare_mysql.sh12
-rwxr-xr-xtests/travis/prepare_pgsql.sh13
-rw-r--r--tests/unit/DatabaseTestCase.php68
-rw-r--r--tests/unit/includes/dba/DBATest.php67
-rw-r--r--tests/unit/includes/dba/_files/account.yml9
-rw-r--r--tests/unit/includes/dba/dba_pdoTest.php189
-rw-r--r--view/css/conversation.css10
-rw-r--r--view/css/mod_profile_photo.css10
-rw-r--r--view/css/mod_wiki.css21
-rw-r--r--view/de-de/hmessages.po30
-rw-r--r--view/de-de/hstrings.php30
-rw-r--r--view/js/main.js4
-rw-r--r--view/js/mod_new_channel.js35
-rw-r--r--view/theme/redbasic/css/style.css11
-rwxr-xr-xview/tpl/abook_edit.tpl2
-rwxr-xr-xview/tpl/admin_site.tpl1
-rwxr-xr-xview/tpl/cropbody.tpl25
-rwxr-xr-xview/tpl/cropcover.tpl23
-rwxr-xr-xview/tpl/new_channel.tpl4
-rwxr-xr-xview/tpl/settings_display.tpl9
284 files changed, 6296 insertions, 4563 deletions
diff --git a/Zotlabs/Access/PermissionLimits.php b/Zotlabs/Access/PermissionLimits.php
index 9ee0656b1..1d15098fc 100644
--- a/Zotlabs/Access/PermissionLimits.php
+++ b/Zotlabs/Access/PermissionLimits.php
@@ -41,8 +41,10 @@ class PermissionLimits {
$limits = [];
$perms = Permissions::Perms();
+ $anon_comments = get_config('system','anonymous_comments',true);
+
foreach($perms as $k => $v) {
- if(strstr($k, 'view') || $k === 'post_comments')
+ if(strstr($k, 'view') || ($k === 'post_comments' && $anon_comments))
$limits[$k] = PERMS_PUBLIC;
else
$limits[$k] = PERMS_SPECIFIC;
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index b168db5ae..fa2368a92 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -618,8 +618,8 @@ class Notifier {
$packet = zot_build_packet($channel,$packet_type,(($packet_recips) ? $packet_recips : null));
}
if($packet_type === 'keychange') {
- $packet = zot_build_packet($channel,$packet_type,(($packet_recips) ? $packet_recips : null));
$pmsg = get_pconfig($channel['channel_id'],'system','keychange');
+ $packet = zot_build_packet($channel,$packet_type,(($packet_recips) ? $packet_recips : null));
}
elseif($packet_type === 'request') {
$env = (($hub_env && $hub_env[$hub['hubloc_host'] . $hub['hubloc_sitekey']]) ? $hub_env[$hub['hubloc_host'] . $hub['hubloc_sitekey']] : '');
@@ -640,7 +640,21 @@ class Notifier {
}
else {
$env = (($hub_env && $hub_env[$hub['hubloc_host'] . $hub['hubloc_sitekey']]) ? $hub_env[$hub['hubloc_host'] . $hub['hubloc_sitekey']] : '');
- $packet = zot_build_packet($channel,'notify',$env,(($private) ? $hub['hubloc_sitekey'] : null), $hub['site_crypto'],$hash);
+
+ // currently zot6 delivery is only performed on normal items and not sync items or mail or anything else
+ // Eventually we will do this for all deliveries, but for now ensure this is precisely what we are dealing
+ // with before switching to zot6 as the primary zot6 handler checks for the existence of a message delivery report
+ // to trigger dequeue'ing
+
+ $z6 = (($encoded_item && $encoded_item['type'] === 'activity' && (! array_key_exists('allow_cid',$encoded_item))) ? true : false);
+ if($z6) {
+ $packet = zot6_build_packet($channel,'notify',$env, json_encode($encoded_item), (($private) ? $hub['hubloc_sitekey'] : null), $hub['site_crypto'],$hash);
+ }
+ else {
+ $packet = zot_build_packet($channel,'notify',$env, (($private) ? $hub['hubloc_sitekey'] : null), $hub['site_crypto'],$hash);
+
+ }
+
queue_insert(
[
'hash' => $hash,
diff --git a/Zotlabs/Daemon/Queue.php b/Zotlabs/Daemon/Queue.php
index 17d150250..8f529ff13 100644
--- a/Zotlabs/Daemon/Queue.php
+++ b/Zotlabs/Daemon/Queue.php
@@ -13,10 +13,10 @@ class Queue {
require_once('include/bbcode.php');
- if(argc() > 1)
- $queue_id = argv(1);
+ if($argc > 1)
+ $queue_id = $argv[1];
else
- $queue_id = 0;
+ $queue_id = EMPTY_STR;
logger('queue: start');
diff --git a/Zotlabs/Identity/OAuth2Server.php b/Zotlabs/Identity/OAuth2Server.php
new file mode 100644
index 000000000..cbb4748fe
--- /dev/null
+++ b/Zotlabs/Identity/OAuth2Server.php
@@ -0,0 +1,34 @@
+<?php
+
+namespace Zotlabs\Identity;
+
+class OAuth2Server extends \OAuth2\Server {
+
+ public function __construct(OAuth2Storage $storage, $config = []) {
+
+ if(! is_array($config)) {
+ $config = [
+ 'use_openid_connect' => true,
+ 'issuer' => \Zotlabs\Lib\System::get_site_name()
+ ];
+ }
+
+ parent::__construct($storage, $config);
+
+ // Add the "Client Credentials" grant type (it is the simplest of the grant types)
+ $this->addGrantType(new \OAuth2\GrantType\ClientCredentials($storage));
+
+ // Add the "Authorization Code" grant type (this is where the oauth magic happens)
+ $this->addGrantType(new \OAuth2\GrantType\AuthorizationCode($storage));
+
+ $keyStorage = new \OAuth2\Storage\Memory( [
+ 'keys' => [
+ 'public_key' => get_config('system', 'pubkey'),
+ 'private_key' => get_config('system', 'prvkey')
+ ]
+ ]);
+
+ $this->addStorage($keyStorage, 'public_key');
+ }
+
+}
diff --git a/Zotlabs/Identity/OAuth2Storage.php b/Zotlabs/Identity/OAuth2Storage.php
new file mode 100644
index 000000000..bc6db565c
--- /dev/null
+++ b/Zotlabs/Identity/OAuth2Storage.php
@@ -0,0 +1,81 @@
+<?php
+
+namespace Zotlabs\Identity;
+
+
+class OAuth2Storage extends \OAuth2\Storage\Pdo {
+
+ /**
+ * @param string $username
+ * @param string $password
+ * @return bool
+ */
+ public function checkUserCredentials($username, $password)
+ {
+ if ($user = $this->getUser($username)) {
+ return $this->checkPassword($user, $password);
+ }
+
+ return false;
+ }
+
+ /**
+ * @param string $username
+ * @return array|bool
+ */
+ public function getUserDetails($username)
+ {
+ return $this->getUser($username);
+ }
+
+
+ /**
+ *
+ * @param array $user
+ * @param string $password
+ * @return bool
+ */
+ protected function checkPassword($user, $password)
+ {
+
+ $x = account_verify_password($user,$password);
+ return((array_key_exists('channel',$x) && ! empty($x['channel'])) ? true : false);
+
+ }
+
+ /**
+ * @param string $username
+ * @return array|bool
+ */
+ public function getUser($username)
+ {
+
+ $x = channelx_by_nick($username);
+ if(! $x) {
+ return false;
+ }
+
+ return( [
+ 'username' => $x['channel_address'],
+ 'user_id' => $x['channel_id'],
+ 'firstName' => $x['channel_name'],
+ 'lastName' => '',
+ 'password' => 'NotARealPassword'
+ ] );
+ }
+
+ /**
+ * plaintext passwords are bad! Override this for your application
+ *
+ * @param string $username
+ * @param string $password
+ * @param string $firstName
+ * @param string $lastName
+ * @return bool
+ */
+ public function setUser($username, $password, $firstName = null, $lastName = null)
+ {
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index d2a307fd5..f91dc8e49 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -119,6 +119,7 @@ class Apps {
static public function parse_app_description($f,$translate = true) {
+
$ret = array();
$baseurl = z_root();
@@ -194,6 +195,10 @@ class Apps {
if(! is_public_profile())
unset($ret);
break;
+ case 'public_stream':
+ if(! can_view_public_stream())
+ unset($ret);
+ break;
case 'observer':
if(! $observer)
unset($ret);
@@ -346,6 +351,10 @@ class Apps {
if(! is_public_profile())
return '';
break;
+ case 'public_stream':
+ if(! can_view_public_stream())
+ return '';
+ break;
case 'observer':
$observer = \App::get_observer();
if(! $observer)
diff --git a/Zotlabs/Lib/DB_Upgrade.php b/Zotlabs/Lib/DB_Upgrade.php
index 8f0488f6f..4038a2d53 100644
--- a/Zotlabs/Lib/DB_Upgrade.php
+++ b/Zotlabs/Lib/DB_Upgrade.php
@@ -10,22 +10,12 @@ class DB_Upgrade {
function __construct($db_revision) {
- $platform_name = System::get_platform_name();
+ $this->config_name = 'db_version';
+ $this->func_prefix = '_';
- $update_file = 'install/' . $platform_name . '/update.php';
- if(! file_exists($update_file)) {
- $update_file = 'install/update.php';
- $this->config_name = 'db_version';
- $this->func_prefix = 'update_r';
- }
- else {
- $this->config_name = $platform_name . '_db_version';
- $this->func_prefix = $platform_name . '_update_';
- }
-
- $build = get_config('system', $this->config_name, 0);
+ $build = get_config('system', 'db_version', 0);
if(! intval($build))
- $build = set_config('system', $this->config_name, $db_revision);
+ $build = set_config('system', 'db_version', $db_revision);
if($build == $db_revision) {
// Nothing to be done.
@@ -40,82 +30,78 @@ class DB_Upgrade {
$current = intval($db_revision);
- if(($stored < $current) && file_exists($update_file)) {
+ if($stored < $current) {
- Config::Load('database');
+ // The last update we performed was $stored.
+ // Start at $stored + 1 and continue until we have completed $current
- // We're reporting a different version than what is currently installed.
- // Run any existing update scripts to bring the database up to current.
-
- require_once($update_file);
+ for($x = $stored + 1; $x <= $current; $x ++) {
+ $s = '_' . $x;
+ $cls = '\\Zotlabs\Update\\' . $s ;
+ if(! class_exists($cls)) {
+ return;
+ }
- // make sure that boot.php and update.php are the same release, we might be
- // updating from git right this very second and the correct version of the update.php
- // file may not be here yet. This can happen on a very busy site.
+ // There could be a lot of processes running or about to run.
+ // We want exactly one process to run the update command.
+ // So store the fact that we're taking responsibility
+ // after first checking to see if somebody else already has.
- if($db_revision == UPDATE_VERSION) {
- for($x = $stored; $x < $current; $x ++) {
- $func = $this->func_prefix . $x;
- if(function_exists($func)) {
- // There could be a lot of processes running or about to run.
- // We want exactly one process to run the update command.
- // So store the fact that we're taking responsibility
- // after first checking to see if somebody else already has.
+ // If the update fails or times-out completely you may need to
+ // delete the config entry to try again.
- // If the update fails or times-out completely you may need to
- // delete the config entry to try again.
+ Config::Load('database');
- if(get_config('database', $func))
- break;
- set_config('database',$func, '1');
- // call the specific update
+ if(get_config('database', $s))
+ break;
+ set_config('database',$s, '1');
+
- $retval = $func();
- if($retval) {
+ $c = new $cls();
+ $retval = $c->run();
- // Prevent sending hundreds of thousands of emails by creating
- // a lockfile.
+ if($retval != UPDATE_SUCCESS) {
- $lockfile = 'store/[data]/mailsent';
+ // Prevent sending hundreds of thousands of emails by creating
+ // a lockfile.
- if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 86400)))
- return;
- @unlink($lockfile);
- //send the administrator an e-mail
- file_put_contents($lockfile, $x);
-
- $r = q("select account_language from account where account_email = '%s' limit 1",
- dbesc(\App::$config['system']['admin_email'])
- );
- push_lang(($r) ? $r[0]['account_language'] : 'en');
+ $lockfile = 'store/[data]/mailsent';
- z_mail(
+ if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 86400)))
+ return;
+ @unlink($lockfile);
+ //send the administrator an e-mail
+ file_put_contents($lockfile, $x);
+
+ $r = q("select account_language from account where account_email = '%s' limit 1",
+ dbesc(\App::$config['system']['admin_email'])
+ );
+ push_lang(($r) ? $r[0]['account_language'] : 'en');
+ z_mail(
+ [
+ 'toEmail' => \App::$config['system']['admin_email'],
+ 'messageSubject' => sprintf( t('Update Error at %s'), z_root()),
+ 'textVersion' => replace_macros(get_intltext_template('update_fail_eml.tpl'),
[
- 'toEmail' => \App::$config['system']['admin_email'],
- 'messageSubject' => sprintf( t('Update Error at %s'), z_root()),
- 'textVersion' => replace_macros(get_intltext_template('update_fail_eml.tpl'),
- [
- '$sitename' => \App::$config['system']['sitename'],
- '$siteurl' => z_root(),
- '$update' => $x,
- '$error' => sprintf( t('Update %s failed. See error logs.'), $x)
- ]
- )
+ '$sitename' => \App::$config['system']['sitename'],
+ '$siteurl' => z_root(),
+ '$update' => $x,
+ '$error' => sprintf( t('Update %s failed. See error logs.'), $x)
]
- );
-
- //try the logger
- logger('CRITICAL: Update Failed: ' . $x);
- pop_lang();
- }
- else {
- set_config('database',$func, 'success');
- }
- }
+ )
+ ]
+ );
+
+ //try the logger
+ logger('CRITICAL: Update Failed: ' . $x);
+ pop_lang();
+ }
+ else {
+ set_config('database',$s, 'success');
}
- set_config('system', $this->config_name, $db_revision);
}
}
+ set_config('system', 'db_version', $db_revision);
}
}
} \ No newline at end of file
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 5cf4ec31d..c5bc706c2 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -112,6 +112,8 @@ class Enotify {
}
+ $always_show_in_notices = get_pconfig($recip['channel_id'],'system','always_show_in_notices');
+
// e.g. "your post", "David's photo", etc.
$possess_desc = t('%s <!item_type!>');
@@ -128,18 +130,28 @@ class Enotify {
}
if ($params['type'] == NOTIFY_COMMENT) {
-// logger("notification: params = " . print_r($params, true), LOGGER_DEBUG);
+ //logger("notification: params = " . print_r($params, true), LOGGER_DEBUG);
$moderated = (($params['item']['item_blocked'] == ITEM_MODERATED) ? true : false);
$itemlink = $params['link'];
- // ignore like/unlike activity on posts - they probably require a separate notification preference
+ $action = 'commented on';
+
+ if(array_key_exists('item',$params) && in_array($params['item']['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) {
+
+ if(! $always_show_in_notices) {
+ logger('notification: not a visible activity. Ignoring.');
+ pop_lang();
+ return;
+ }
+
+ if(activity_match($params['verb'], ACTIVITY_LIKE))
+ $action = 'liked';
+
+ if(activity_match($params['verb'], ACTIVITY_DISLIKE))
+ $action = 'disliked';
- if (array_key_exists('item',$params) && (! visible_activity($params['item']))) {
- logger('notification: not a visible activity. Ignoring.');
- pop_lang();
- return;
}
$parent_mid = $params['parent_mid'];
@@ -181,26 +193,29 @@ class Enotify {
//$possess_desc = str_replace('<!item_type!>',$possess_desc);
// "a post"
- $dest_str = sprintf(t('%1$s, %2$s commented on [zrl=%3$s]a %4$s[/zrl]'),
+ $dest_str = sprintf(t('%1$s, %2$s %3$s [zrl=%4$s]a %5$s[/zrl]'),
$recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
+ $action,
$itemlink,
$item_post_type);
// "George Bull's post"
if($p)
- $dest_str = sprintf(t('%1$s, %2$s commented on [zrl=%3$s]%4$s\'s %5$s[/zrl]'),
+ $dest_str = sprintf(t('%1$s, %2$s %3$s [zrl=%4$s]%5$s\'s %6$s[/zrl]'),
$recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
+ $action,
$itemlink,
$p[0]['author']['xchan_name'],
$item_post_type);
// "your post"
if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && intval($p[0]['item_wall']))
- $dest_str = sprintf(t('%1$s, %2$s commented on [zrl=%3$s]your %4$s[/zrl]'),
+ $dest_str = sprintf(t('%1$s, %2$s %3$s [zrl=%4$s]your %5$s[/zrl]'),
$recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
+ $action,
$itemlink,
$item_post_type);
@@ -231,12 +246,12 @@ class Enotify {
$itemlink = $params['link'];
- // ignore like/unlike activity on posts - they probably require a separate notification preference
-
if (array_key_exists('item',$params) && (! activity_match($params['item']['verb'],ACTIVITY_LIKE))) {
- logger('notification: not a like activity. Ignoring.');
- pop_lang();
- return;
+ if(! $always_show_in_notices) {
+ logger('notification: not a visible activity. Ignoring.');
+ pop_lang();
+ return;
+ }
}
$parent_mid = $params['parent_mid'];
@@ -496,8 +511,6 @@ class Enotify {
// Another option would be to not add them to the DB, and change how emails are handled
// (probably would be better that way)
- $always_show_in_notices = get_pconfig($recip['channel_id'],'system','always_show_in_notices');
-
if (!$always_show_in_notices) {
if (($params['type'] == NOTIFY_WALL) || ($params['type'] == NOTIFY_MAIL) || ($params['type'] == NOTIFY_INTRO)) {
$seen = 1;
diff --git a/Zotlabs/Lib/Share.php b/Zotlabs/Lib/Share.php
new file mode 100644
index 000000000..b5341e662
--- /dev/null
+++ b/Zotlabs/Lib/Share.php
@@ -0,0 +1,141 @@
+<?php
+
+namespace Zotlabs\Lib;
+
+
+class Share {
+
+ private $item = null;
+
+
+ public function __construct($post_id) {
+
+ if(! $post_id)
+ return;
+
+ if(! (local_channel() || remote_channel()))
+ return;
+
+ $r = q("SELECT * from item left join xchan on author_xchan = xchan_hash WHERE id = %d LIMIT 1",
+ intval($post_id)
+ );
+ if(! $r)
+ return;
+
+ if(($r[0]['item_private']) && ($r[0]['xchan_network'] !== 'rss'))
+ return;
+
+ $sql_extra = item_permissions_sql($r[0]['uid']);
+
+ $r = q("select * from item where id = %d $sql_extra",
+ intval($post_id)
+ );
+ if(! $r)
+ return;
+
+ if($r[0]['mimetype'] !== 'text/bbcode')
+ return;
+
+ /** @FIXME eventually we want to post remotely via rpost on your home site */
+ // When that works remove this next bit:
+
+ if(! local_channel())
+ return;
+
+ xchan_query($r);
+
+ $this->item = $r[0];
+ return;
+ }
+
+ public function obj() {
+ $obj = [];
+
+ if(! $this->item)
+ return $obj;
+
+ $obj['type'] = $this->item['obj_type'];
+ $obj['id'] = $this->item['mid'];
+ $obj['content'] = $this->item['body'];
+ $obj['content_type'] = $this->item['mimetype'];
+ $obj['title'] = $this->item['title'];
+ $obj['created'] = $this->item['created'];
+ $obj['edited'] = $this->item['edited'];
+ $obj['author'] = [
+ 'name' => $this->item['author']['xchan_name'],
+ 'address' => $this->item['author']['xchan_addr'],
+ 'network' => $this->item['author']['xchan_network'],
+ 'link' => [
+ [
+ 'rel' => 'alternate',
+ 'type' => 'text/html',
+ 'href' => $this->item['author']['xchan_url']
+ ],
+ [
+ 'rel' => 'photo',
+ 'type' => $this->item['author']['xchan_photo_mimetype'],
+ 'href' => $this->item['author']['xchan_photo_m']
+ ]
+ ]
+ ];
+
+ $obj['owner'] = [
+ 'name' => $this->item['owner']['xchan_name'],
+ 'address' => $this->item['owner']['xchan_addr'],
+ 'network' => $this->item['owner']['xchan_network'],
+ 'link' => [
+ [
+ 'rel' => 'alternate',
+ 'type' => 'text/html',
+ 'href' => $this->item['owner']['xchan_url']
+ ],
+ [
+ 'rel' => 'photo',
+ 'type' => $this->item['owner']['xchan_photo_mimetype'],
+ 'href' => $this->item['owner']['xchan_photo_m']
+ ]
+ ]
+ ];
+
+ $obj['link'] = [
+ 'rel' => 'alternate',
+ 'type' => 'text/html',
+ 'href' => $this->item['plink']
+ ];
+
+ return $obj;
+ }
+
+ public function bbcode() {
+ $bb = NULL_STR;
+
+ if(! $this->item)
+ return $bb;
+
+ $is_photo = (($this->item['obj_type'] === ACTIVITY_OBJ_PHOTO) ? true : false);
+ if($is_photo) {
+ $object = json_decode($this->item['obj'],true);
+ $photo_bb = $object['body'];
+ }
+
+ if (strpos($this->item['body'], "[/share]") !== false) {
+ $pos = strpos($this->item['body'], "[share");
+ $bb = substr($this->item['body'], $pos);
+ } else {
+ $bb = "[share author='".urlencode($this->item['author']['xchan_name']).
+ "' profile='".$this->item['author']['xchan_url'] .
+ "' avatar='".$this->item['author']['xchan_photo_s'].
+ "' link='".$this->item['plink'].
+ "' posted='".$this->item['created'].
+ "' message_id='".$this->item['mid']."']";
+ if($this->item['title'])
+ $bb .= '[b]'.$this->item['title'].'[/b]'."\r\n";
+ $bb .= (($is_photo) ? $photo_bb . "\r\n" . $this->item['body'] : $this->item['body']);
+ $bb .= "[/share]";
+ }
+
+ return $bb;
+
+ }
+
+} \ No newline at end of file
diff --git a/Zotlabs/Module/Admin/Dbsync.php b/Zotlabs/Module/Admin/Dbsync.php
index cff8a2484..469af2aa5 100644
--- a/Zotlabs/Module/Admin/Dbsync.php
+++ b/Zotlabs/Module/Admin/Dbsync.php
@@ -7,36 +7,38 @@ namespace Zotlabs\Module\Admin;
class Dbsync {
-
-
function get() {
$o = '';
if(argc() > 3 && intval(argv(3)) && argv(2) === 'mark') {
- set_config('database', 'update_r' . intval(argv(3)), 'success');
- if(intval(get_config('system','db_version')) <= intval(argv(3)))
- set_config('system','db_version',intval(argv(3)) + 1);
+ // remove the old style config if it exists
+ del_config('database', 'update_r' . intval(argv(3)));
+ set_config('database', '_' . intval(argv(3)), 'success');
+ if(intval(get_config('system','db_version')) < intval(argv(3)))
+ set_config('system','db_version',intval(argv(3)));
info( t('Update has been marked successful') . EOL);
goaway(z_root() . '/admin/dbsync');
}
if(argc() > 2 && intval(argv(2))) {
- require_once('install/update.php');
- $func = 'update_r' . intval(argv(2));
- if(function_exists($func)) {
- $retval = $func();
+ $x = intval(argv(2));
+ $s = '_' . $x;
+ $cls = '\\Zotlabs\Update\\' . $s ;
+ if(class_exists($cls)) {
+ $c = new $cls();
+ $retval = $c->run();
if($retval === UPDATE_FAILED) {
- $o .= sprintf( t('Executing %s failed. Check system logs.'), $func);
+ $o .= sprintf( t('Executing %s failed. Check system logs.'), $s);
}
elseif($retval === UPDATE_SUCCESS) {
- $o .= sprintf( t('Update %s was successfully applied.'), $func);
- set_config('database',$func, 'success');
+ $o .= sprintf( t('Update %s was successfully applied.'), $s);
+ set_config('database',$s, 'success');
}
else
- $o .= sprintf( t('Update %s did not return a status. Unknown if it succeeded.'), $func);
+ $o .= sprintf( t('Update %s did not return a status. Unknown if it succeeded.'), $s);
}
else
- $o .= sprintf( t('Update function %s could not be found.'), $func);
+ $o .= sprintf( t('Update function %s could not be found.'), $s);
return $o;
}
@@ -45,23 +47,25 @@ class Dbsync {
$r = q("select * from config where cat = 'database' ");
if(count($r)) {
foreach($r as $rr) {
- $upd = intval(substr($rr['k'],8));
+ $upd = intval(substr($rr['k'],-4));
if($rr['v'] === 'success')
continue;
$failed[] = $upd;
}
}
- if(! count($failed))
- return '<div class="generic-content-wrapper-styled"><h3>' . t('No failed updates.') . '</h3></div>';
-
- $o = replace_macros(get_markup_template('failed_updates.tpl'),array(
- '$base' => z_root(),
- '$banner' => t('Failed Updates'),
- '$desc' => '',
- '$mark' => t('Mark success (if update was manually applied)'),
- '$apply' => t('Attempt to execute this update step automatically'),
- '$failed' => $failed
+ if(count($failed)) {
+ $o = replace_macros(get_markup_template('failed_updates.tpl'),array(
+ '$base' => z_root(),
+ '$banner' => t('Failed Updates'),
+ '$desc' => '',
+ '$mark' => t('Mark success (if update was manually applied)'),
+ '$apply' => t('Attempt to execute this update step automatically'),
+ '$failed' => $failed
));
+ }
+ else {
+ return '<div class="generic-content-wrapper-styled"><h3>' . t('No failed updates.') . '</h3></div>';
+ }
return $o;
}
diff --git a/Zotlabs/Module/Admin/Security.php b/Zotlabs/Module/Admin/Security.php
index a1e4bf537..49e1ccf42 100644
--- a/Zotlabs/Module/Admin/Security.php
+++ b/Zotlabs/Module/Admin/Security.php
@@ -52,24 +52,24 @@ class Security {
function get() {
$whitesites = get_config('system','whitelisted_sites');
- $whitesites_str = ((is_array($whitesites)) ? implode($whitesites,"\n") : '');
+ $whitesites_str = ((is_array($whitesites)) ? implode("\n",$whitesites) : '');
$blacksites = get_config('system','blacklisted_sites');
- $blacksites_str = ((is_array($blacksites)) ? implode($blacksites,"\n") : '');
+ $blacksites_str = ((is_array($blacksites)) ? implode("\n",$blacksites) : '');
$whitechannels = get_config('system','whitelisted_channels');
- $whitechannels_str = ((is_array($whitechannels)) ? implode($whitechannels,"\n") : '');
+ $whitechannels_str = ((is_array($whitechannels)) ? implode("\n",$whitechannels) : '');
$blackchannels = get_config('system','blacklisted_channels');
- $blackchannels_str = ((is_array($blackchannels)) ? implode($blackchannels,"\n") : '');
+ $blackchannels_str = ((is_array($blackchannels)) ? implode("\n",$blackchannels) : '');
$whiteembeds = get_config('system','embed_allow');
- $whiteembeds_str = ((is_array($whiteembeds)) ? implode($whiteembeds,"\n") : '');
+ $whiteembeds_str = ((is_array($whiteembeds)) ? implode("\n",$whiteembeds) : '');
$blackembeds = get_config('system','embed_deny');
- $blackembeds_str = ((is_array($blackembeds)) ? implode($blackembeds,"\n") : '');
+ $blackembeds_str = ((is_array($blackembeds)) ? implode("\n",$blackembeds) : '');
$embed_coop = intval(get_config('system','embed_coop'));
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php
index 52b36e03e..ca181d5f8 100644
--- a/Zotlabs/Module/Admin/Site.php
+++ b/Zotlabs/Module/Admin/Site.php
@@ -45,6 +45,7 @@ class Site {
$force_publish = ((x($_POST,'publish_all')) ? True : False);
$disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True);
$site_firehose = ((x($_POST,'site_firehose')) ? True : False);
+ $open_pubstream = ((x($_POST,'open_pubstream')) ? True : False);
$login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False);
$enable_context_help = ((x($_POST,'enable_context_help')) ? True : False);
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
@@ -139,6 +140,7 @@ class Site {
set_config('system','publish_all', $force_publish);
set_config('system','disable_discover_tab', $disable_discover_tab);
set_config('system','site_firehose', $site_firehose);
+ set_config('system','open_pubstream', $open_pubstream);
set_config('system','force_queue_threshold', $force_queue);
if ($global_directory == '') {
del_config('system', 'directory_submit_url');
@@ -319,7 +321,7 @@ class Site {
'$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")),
'$disable_discover_tab' => array('disable_discover_tab', t('Import Public Streams'), $discover_tab, t('Import and allow access to public content pulled from other sites. Warning: this content is unmoderated.')),
'$site_firehose' => array('site_firehose', t('Site only Public Streams'), get_config('system','site_firehose'), t('Allow access to public content originating only from this site if Imported Public Streams are disabled.')),
-
+ '$open_pubstream' => array('open_pubstream', t('Allow anybody on the internet to access the Public streams'), get_config('system','open_pubstream',1), t('Disable to require authentication before viewing. Warning: this content is unmoderated.')),
'$login_on_homepage' => array('login_on_homepage', t("Login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")),
'$enable_context_help' => array('enable_context_help', t("Enable context help"),((intval($enable_context_help) === 1 || $enable_context_help === false) ? 1 : 0) , t("Display contextual help for the current page when the help button is pressed.")),
diff --git a/Zotlabs/Module/Authorize.php b/Zotlabs/Module/Authorize.php
index 06f66c456..254700b4e 100644
--- a/Zotlabs/Module/Authorize.php
+++ b/Zotlabs/Module/Authorize.php
@@ -2,70 +2,66 @@
namespace Zotlabs\Module;
-
-class Authorize extends \Zotlabs\Web\Controller {
+use Zotlabs\Identity\OAuth2Storage;
- function get() {
+class Authorize extends \Zotlabs\Web\Controller {
+ function init() {
- // workaround for HTTP-auth in CGI mode
- if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
- $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
- if(strlen($userpass)) {
- list($name, $password) = explode(':', $userpass);
- $_SERVER['PHP_AUTH_USER'] = $name;
- $_SERVER['PHP_AUTH_PW'] = $password;
- }
+ // workaround for HTTP-auth in CGI mode
+ if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
+ $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
+ if(strlen($userpass)) {
+ list($name, $password) = explode(':', $userpass);
+ $_SERVER['PHP_AUTH_USER'] = $name;
+ $_SERVER['PHP_AUTH_PW'] = $password;
}
-
- if (x($_SERVER, 'HTTP_AUTHORIZATION')) {
- $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ;
- if(strlen($userpass)) {
- list($name, $password) = explode(':', $userpass);
- $_SERVER['PHP_AUTH_USER'] = $name;
- $_SERVER['PHP_AUTH_PW'] = $password;
- }
+ }
+
+ if (x($_SERVER, 'HTTP_AUTHORIZATION')) {
+ $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ;
+ if(strlen($userpass)) {
+ list($name, $password) = explode(':', $userpass);
+ $_SERVER['PHP_AUTH_USER'] = $name;
+ $_SERVER['PHP_AUTH_PW'] = $password;
}
+ }
+ $s = new \Zotlabs\Identity\OAuth2Server(new OAuth2Storage(\DBA::$dba->db));
+ $request = \OAuth2\Request::createFromGlobals();
+ $response = new \OAuth2\Response();
+ // validate the authorize request
+ if (! $s->validateAuthorizeRequest($request, $response)) {
+ $response->send();
+ killme();
+ }
- require_once('include/oauth2.php');
-
- $request = \OAuth2\Request::createFromGlobals();
- $response = new \OAuth2\Response();
-
- // validate the authorize request
- if (! $oauth2_server->validateAuthorizeRequest($request, $response)) {
- $response->send();
- killme();
- }
-
- // display an authorization form
- if (empty($_POST)) {
+ // display an authorization form
+ if (empty($_POST)) {
- return '
+ return '
<form method="post">
<label>Do You Authorize TestClient?</label><br />
<input type="submit" name="authorized" value="yes">
<input type="submit" name="authorized" value="no">
</form>';
+ }
+
+ // print the authorization code if the user has authorized your client
+ $is_authorized = ($_POST['authorized'] === 'yes');
+ $s->handleAuthorizeRequest($request, $response, $is_authorized, local_channel());
+ if ($is_authorized) {
+ // this is only here so that you get to see your code in the cURL request. Otherwise,
+ // we'd redirect back to the client
+ $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40);
+ echo("SUCCESS! Authorization Code: $code");
+ }
+
+ $response->send();
+ killme();
}
- // print the authorization code if the user has authorized your client
- $is_authorized = ($_POST['authorized'] === 'yes');
- $oauth2_server->handleAuthorizeRequest($request, $response, $is_authorized);
- if ($is_authorized) {
- // this is only here so that you get to see your code in the cURL request. Otherwise,
- // we'd redirect back to the client
- $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40);
- echo("SUCCESS! Authorization Code: $code");
-
- }
-
- $response->send();
- killme();
- }
-
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php
index 8eff6c80d..f87988183 100644
--- a/Zotlabs/Module/Cards.php
+++ b/Zotlabs/Module/Cards.php
@@ -143,7 +143,7 @@ class Cards extends \Zotlabs\Web\Controller {
}
$r = q("select * from item
- where item.uid = %d and item_type = %d
+ where uid = %d and item_type = %d
$sql_extra order by item.created desc",
intval($owner),
intval(ITEM_TYPE_CARD)
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 7c4c900a1..231146999 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -204,7 +204,7 @@ class Channel extends \Zotlabs\Web\Controller {
$_SESSION['loadtime'] = datetime_convert();
}
else {
- $r = q("SELECT distinct parent AS item_id, created from item
+ $r = q("SELECT distinct parent AS item_id from item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
WHERE uid = %d $item_normal_update
AND item_wall = 1 $simple_update
@@ -239,7 +239,7 @@ class Channel extends \Zotlabs\Web\Controller {
if($load || ($checkjs->disabled())) {
if($mid) {
- $r = q("SELECT distinct parent AS item_id from item where mid like '%s' and uid = %d $item_normal
+ $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal
AND item_wall = 1 $sql_extra limit 1",
dbesc($mid . '%'),
intval(\App::$profile['profile_uid'])
@@ -249,11 +249,11 @@ class Channel extends \Zotlabs\Web\Controller {
}
}
else {
- $r = q("SELECT distinct id AS item_id, created FROM item
- left join abook on item.author_xchan = abook.abook_xchan
- WHERE uid = %d $item_normal
- AND item_wall = 1 and item_thread_top = 1
- AND (abook_blocked = 0 or abook.abook_flags is null)
+ $r = q("SELECT item.parent AS item_id FROM item
+ left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids )
+ WHERE true and item.uid = %d AND item.item_thread_top = 1 $item_normal
+ AND (abook.abook_blocked = 0 or abook.abook_flags is null)
+ AND item.item_wall = 1
$sql_extra $sql_extra2
ORDER BY created DESC $pager_sql ",
intval(\App::$profile['profile_uid'])
diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php
index f42ff9b84..255731c9c 100644
--- a/Zotlabs/Module/Connections.php
+++ b/Zotlabs/Module/Connections.php
@@ -232,7 +232,7 @@ class Connections extends \Zotlabs\Web\Controller {
if($rr['xchan_url']) {
if(($rr['vcard']) && is_array($rr['vcard']['tels']) && $rr['vcard']['tels'][0]['nr'])
- $phone = ((\App::$is_mobile || \App::$is_tablet) ? $rr['vcard']['tels'][0]['nr'] : '');
+ $phone = $rr['vcard']['tels'][0]['nr'];
else
$phone = '';
diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php
index e23a751d9..f359175c1 100644
--- a/Zotlabs/Module/Connedit.php
+++ b/Zotlabs/Module/Connedit.php
@@ -895,7 +895,6 @@ class Connedit extends \Zotlabs\Web\Controller {
'$permnote_self' => t('Some permissions may be inherited from your channel\'s <a href="settings"><strong>privacy settings</strong></a>, which have higher priority than individual settings. You can change those settings here but they wont have any impact unless the inherited setting changes.'),
'$lastupdtext' => t('Last update:'),
'$last_update' => relative_date($contact['abook_connected']),
- '$is_mobile' => ((\App::$is_mobile || \App::$is_tablet) ? true : false),
'$profile_select' => contact_profile_assign($contact['abook_profile']),
'$multiprofs' => $multiprofs,
'$contact_id' => $contact['abook_id'],
diff --git a/Zotlabs/Module/Defperms.php b/Zotlabs/Module/Defperms.php
index 422333a50..97d9cfd1d 100644
--- a/Zotlabs/Module/Defperms.php
+++ b/Zotlabs/Module/Defperms.php
@@ -22,7 +22,7 @@ class Defperms extends \Zotlabs\Web\Controller {
$r = q("SELECT abook.*, xchan.*
FROM abook left join xchan on abook_xchan = xchan_hash
- WHERE abook_self = 1 and abook_id = %d LIMIT 1",
+ WHERE abook_self = 1 and abook_channel = %d LIMIT 1",
intval(local_channel())
);
if($r) {
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index c46695b65..baeba82e8 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -51,10 +51,8 @@ class Hq extends \Zotlabs\Web\Controller {
$item_normal = item_normal();
$item_normal_update = item_normal_update();
- $use_index = db_use_index('created');
-
if(! $item_hash) {
- $r = q("SELECT mid FROM item $use_index
+ $r = q("SELECT mid FROM item
WHERE uid = %d $item_normal
AND mid = parent_mid
ORDER BY created DESC LIMIT 1",
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index db2d64d70..3f857030b 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -39,6 +39,7 @@ class Item extends \Zotlabs\Web\Controller {
$uid = local_channel();
$channel = null;
$observer = null;
+ $datarray = [];
/**
@@ -619,6 +620,21 @@ class Item extends \Zotlabs\Web\Controller {
$i++;
}
}
+
+
+ if(preg_match_all('/(\[share=(.*?)\](.*?)\[\/share\])/',$body,$match)) {
+ // process share by id
+
+ $verb = ACTIVITY_SHARE;
+ $i = 0;
+ foreach($match[2] as $mtch) {
+ $reshare = new \Zotlabs\Lib\Share($mtch);
+ $datarray['obj'] = $reshare->obj();
+ $datarray['obj_type'] = $datarray['obj']['type'];
+ $body = str_replace($match[1][$i],$reshare->bbcode(),$body);
+ $i++;
+ }
+ }
}
@@ -720,7 +736,6 @@ class Item extends \Zotlabs\Web\Controller {
if(!$thr_parent)
$thr_parent = $mid;
- $datarray = array();
$item_thread_top = ((! $parent) ? 1 : 0);
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php
index 551303984..6e961dc36 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -144,7 +144,7 @@ class Network extends \Zotlabs\Web\Controller {
// NOTREACHED
}
if($_GET['pf'] === '1')
- $deftag = '@' . t('forum') . '+' . intval($cid) . '+';
+ $deftag = '!' . t('forum') . '+' . intval($cid);
else
$def_acl = [ 'allow_cid' => '<' . $r[0]['abook_xchan'] . '>', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ];
}
@@ -209,8 +209,11 @@ class Network extends \Zotlabs\Web\Controller {
: '');
$sql_nets = '';
+
+ $distinct = '';
+ $item_thread_top = ' AND item_thread_top = 1 ';
- $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE item_thread_top = 1 $sql_options ) ";
+ $sql_extra = $sql_options;
if($group) {
$contact_str = '';
@@ -226,7 +229,8 @@ class Network extends \Zotlabs\Web\Controller {
$contact_str = ' 0 ';
info( t('Privacy group is empty'));
}
-
+ $distinct = ' distinct ';
+ $item_thread_top = '';
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str )) or allow_gid like '" . protect_sprintf('%<' . dbesc($group_hash) . '>%') . "' ) and id = parent $item_normal ) ";
$x = group_rec_byhash(local_channel(), $group_hash);
@@ -250,6 +254,8 @@ class Network extends \Zotlabs\Web\Controller {
intval(local_channel())
);
if($r) {
+ $distinct = ' distinct ';
+ $item_thread_top = '';
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($r[0]['abook_xchan']) . "' or owner_xchan = '" . dbesc($r[0]['abook_xchan']) . "' ) $item_normal ) ";
$title = replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => '<a href="' . zid($r[0]['xchan_url']) . '" ><img src="' . zid($r[0]['xchan_photo_s']) . '" alt="' . urlencode($r[0]['xchan_name']) . '" /></a> <a href="' . zid($r[0]['xchan_url']) . '" >' . $r[0]['xchan_name'] . '</a>'
@@ -264,13 +270,15 @@ class Network extends \Zotlabs\Web\Controller {
}
}
elseif($xchan) {
- $r = q("select * from xchan where xchan_hash = '%s'",
- dbesc($xchan)
- );
- if($r) {
- $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($xchan) . "' or owner_xchan = '" . dbesc($xchan) . "' ) $item_normal ) ";
- $title = replace_macros(get_markup_template("section_title.tpl"),array(
- '$title' => '<a href="' . zid($r[0]['xchan_url']) . '" ><img src="' . zid($r[0]['xchan_photo_s']) . '" alt="' . urlencode($r[0]['xchan_name']) . '" /></a> <a href="' . zid($r[0]['xchan_url']) . '" >' . $r[0]['xchan_name'] . '</a>'
+ $r = q("select * from xchan where xchan_hash = '%s'",
+ dbesc($xchan)
+ );
+ if($r) {
+ $distinct = ' distinct ';
+ $item_thread_top = '';
+ $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($xchan) . "' or owner_xchan = '" . dbesc($xchan) . "' ) $item_normal ) ";
+ $title = replace_macros(get_markup_template("section_title.tpl"),array(
+ '$title' => '<a href="' . zid($r[0]['xchan_url']) . '" ><img src="' . zid($r[0]['xchan_photo_s']) . '" alt="' . urlencode($r[0]['xchan_name']) . '" /></a> <a href="' . zid($r[0]['xchan_url']) . '" >' . $r[0]['xchan_name'] . '</a>'
));
$o = $tabs;
$o .= $title;
@@ -373,6 +381,8 @@ class Network extends \Zotlabs\Web\Controller {
}
if($conv) {
+ $distinct = ' distinct ';
+ $item_thread_top = '';
$sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan like '%s' or item_mentionsme = 1 )) ",
dbesc(protect_sprintf($channel['channel_hash']))
);
@@ -448,7 +458,7 @@ class Network extends \Zotlabs\Web\Controller {
if($nouveau && $load) {
// "New Item View" - show all items unthreaded in reverse created date order
- $items = q("SELECT item.*, item.id AS item_id, received FROM item
+ $items = q("SELECT item.*, item.id AS item_id, received FROM item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
$net_query
WHERE true $uids $item_normal
@@ -477,11 +487,11 @@ class Network extends \Zotlabs\Web\Controller {
if($load) {
// Fetch a page full of parent items for this page
- $r = q("SELECT distinct item.id AS item_id, $ordering FROM item
+ $r = q("SELECT $distinct item.parent AS item_id FROM item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
$net_query
- WHERE true $uids $item_normal
- AND item.parent = item.id
+ WHERE true $uids $item_thread_top $item_normal
+ AND item.mid = item.parent_mid
and (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_nets
$net_query2
diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php
index 9f2fea802..548f28c4f 100644
--- a/Zotlabs/Module/New_channel.php
+++ b/Zotlabs/Module/New_channel.php
@@ -142,6 +142,7 @@ class New_channel extends \Zotlabs\Web\Controller {
'$role' => $role,
'$default_role' => $default_role,
'$nickname' => $nickname,
+ '$validate' => t('Validate'),
'$submit' => t('Create'),
'$channel_usage_message' => $channel_usage_message
));
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index f8399d871..eab49d69e 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -148,14 +148,12 @@ class Ping extends \Zotlabs\Web\Controller {
$pubs = q("SELECT count(id) as total from item
WHERE uid = %d
- AND author_xchan != '%s'
- AND obj_type != '%s'
AND item_unseen = 1
+ AND author_xchan != '%s'
AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "'
$item_normal",
intval($sys['channel_id']),
- dbesc(get_observer_hash()),
- dbesc(ACTIVITY_OBJ_FILE)
+ dbesc(get_observer_hash())
);
if($pubs)
@@ -168,8 +166,8 @@ class Ping extends \Zotlabs\Web\Controller {
$r = q("SELECT * FROM item
WHERE uid = %d
- AND author_xchan != '%s'
AND item_unseen = 1
+ AND author_xchan != '%s'
AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "'
$item_normal
ORDER BY created DESC
@@ -210,22 +208,22 @@ class Ping extends \Zotlabs\Web\Controller {
if(x($_REQUEST, 'markRead') && local_channel()) {
switch($_REQUEST['markRead']) {
case 'network':
- $r = q("update item set item_unseen = 0 where item_unseen = 1 and uid = %d",
+ $r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND item_unseen = 1",
intval(local_channel())
);
break;
case 'home':
- $r = q("update item set item_unseen = 0 where item_unseen = 1 and item_wall = 1 and uid = %d",
+ $r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND item_unseen = 1 AND item_wall = 1",
intval(local_channel())
);
break;
case 'mail':
- $r = q("update mail set mail_seen = 1 where mail_seen = 0 and channel_id = %d ",
+ $r = q("UPDATE mail SET mail_seen = 1 WHERE channel_id = %d AND mail_seen = 0",
intval(local_channel())
);
break;
case 'all_events':
- $r = q("update event set dismissed = 1 where dismissed = 0 and uid = %d AND dtstart < '%s' AND dtstart > '%s' ",
+ $r = q("UPDATE event SET dismissed = 1 WHERE uid = %d AND dismissed = 0 AND dtstart < '%s' AND dtstart > '%s' ",
intval(local_channel()),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days'))
@@ -245,9 +243,9 @@ class Ping extends \Zotlabs\Web\Controller {
}
if(x($_REQUEST, 'markItemRead') && local_channel()) {
- $r = q("update item set item_unseen = 0 where parent = %d and uid = %d",
- intval($_REQUEST['markItemRead']),
- intval(local_channel())
+ $r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND parent = %d",
+ intval(local_channel()),
+ intval($_REQUEST['markItemRead'])
);
}
@@ -256,7 +254,7 @@ class Ping extends \Zotlabs\Web\Controller {
* dropdown menu.
*/
if(argc() > 1 && argv(1) === 'notify') {
- $t = q("select * from notify where uid = %d and seen = 0 order by created desc",
+ $t = q("SELECT * FROM notify WHERE uid = %d AND seen = 0 ORDER BY CREATED DESC",
intval(local_channel())
);
@@ -270,7 +268,18 @@ class Ping extends \Zotlabs\Web\Controller {
$mid = basename($tt['link']);
- $b64mid = ((strpos($mid, 'b64.' === 0)) ? $mid : 'b64.' . base64url_encode($mid));
+ if(in_array($tt['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) {
+ // we need the thread parent
+ $r = q("select thr_parent from item where mid = '%s' and uid = %d limit 1",
+ dbesc($mid),
+ intval(local_channel())
+ );
+
+ $b64mid = ((strpos($r[0]['thr_parent'], 'b64.' === 0)) ? $r[0]['thr_parent'] : 'b64.' . base64url_encode($r[0]['thr_parent']));
+ }
+ else {
+ $b64mid = ((strpos($mid, 'b64.' === 0)) ? $mid : 'b64.' . base64url_encode($mid));
+ }
$notifs[] = array(
'notify_link' => z_root() . '/notify/view/' . $tt['id'],
@@ -320,12 +329,13 @@ class Ping extends \Zotlabs\Web\Controller {
if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) {
$result = array();
- $use_index = db_use_index('uid_item_unseen');
-
- $r = q("SELECT * FROM item $use_index
- WHERE item_unseen = 1 and uid = %d $item_normal
+ $r = q("SELECT * FROM item
+ WHERE uid = %d
+ AND item_unseen = 1
AND author_xchan != '%s'
- ORDER BY created DESC limit 300",
+ $item_normal
+ ORDER BY created DESC
+ LIMIT 300",
intval(local_channel()),
dbesc($ob_hash)
);
@@ -495,10 +505,8 @@ class Ping extends \Zotlabs\Web\Controller {
if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) {
- $use_index = db_use_index('uid_item_unseen');
-
- $r = q("SELECT id, item_wall FROM item $use_index
- WHERE item_unseen = 1 and uid = %d
+ $r = q("SELECT id, item_wall FROM item
+ WHERE uid = %d and item_unseen = 1
$item_normal
AND author_xchan != '%s'",
intval(local_channel()),
diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php
index 2c25e2ce0..af7bc7658 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -12,11 +12,10 @@ class Pubstream extends \Zotlabs\Web\Controller {
if($load)
$_SESSION['loadtime'] = datetime_convert();
-
- if(observer_prohibited(true)) {
- return login();
+ if((observer_prohibited(true)) || (! (intval(get_config('system','open_pubstream',1))) && get_observer_hash())) {
+ return login();
}
-
+
$site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
$net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
@@ -167,7 +166,8 @@ class Pubstream extends \Zotlabs\Web\Controller {
$net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : '');
$net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : '');
-
+
+ $abook_uids = " and abook.abook_channel = " . intval(\App::$profile['profile_uid']) . " ";
$simple_update = (($_SESSION['loadtime']) ? " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' " : '');
@@ -186,7 +186,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
if($load) {
if($mid) {
$r = q("SELECT parent AS item_id FROM item
- left join abook on item.author_xchan = abook.abook_xchan
+ left join abook on item.author_xchan = abook.abook_xchan
$net_query
WHERE mid like '%s' $uids $item_normal
and (abook.abook_blocked = 0 or abook.abook_flags is null)
@@ -196,11 +196,10 @@ class Pubstream extends \Zotlabs\Web\Controller {
}
else {
// Fetch a page full of parent items for this page
- $r = q("SELECT distinct item.id AS item_id, $ordering FROM item
- left join abook on item.author_xchan = abook.abook_xchan
+ $r = q("SELECT item.id AS item_id FROM item
+ left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids )
$net_query
- WHERE true $uids $item_normal
- AND item.parent = item.id
+ WHERE true $uids and item.item_thread_top = 1 $item_normal
and (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_nets $net_query2
ORDER BY $ordering DESC $pager_sql "
diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php
index 4d35b59f3..55e0e746f 100644
--- a/Zotlabs/Module/Search.php
+++ b/Zotlabs/Module/Search.php
@@ -90,7 +90,7 @@ class Search extends \Zotlabs\Web\Controller {
}
else {
$regstr = db_getfunc('REGEXP');
- $sql_extra = sprintf(" AND item.body $regstr '%s' ", dbesc(protect_sprintf(preg_quote($search))));
+ $sql_extra = sprintf(" AND (item.title $regstr '%s' OR item.body $regstr '%s') ", dbesc(protect_sprintf(preg_quote($search))), dbesc(protect_sprintf(preg_quote($search))));
}
// Here is the way permissions work in the search module...
diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php
index 5e9e88a6d..fb8284d2e 100644
--- a/Zotlabs/Module/Settings/Channel.php
+++ b/Zotlabs/Module/Settings/Channel.php
@@ -331,22 +331,21 @@ class Channel {
);
$limits = \Zotlabs\Access\PermissionLimits::Get(local_channel());
+ $anon_comments = get_config('system','anonymous_comments',true);
foreach($global_perms as $k => $perm) {
$options = array();
+ $can_be_public = ((strstr($k,'view') || ($k === 'post_comments' && $anon_comments)) ? true : false);
foreach($perm_opts as $opt) {
- if(((! strstr($k,'view')) && $k !== 'post_comments') && $opt[1] == PERMS_PUBLIC)
+ if($opt[1] == PERMS_PUBLIC && (! $can_be_public))
continue;
$options[$opt[1]] = $opt[0];
}
$permiss[] = array($k,$perm,$limits[$k],'',$options);
}
-
-
+
// logger('permiss: ' . print_r($permiss,true));
-
-
$username = $channel['channel_name'];
$nickname = $channel['channel_address'];
$timezone = $channel['channel_timezone'];
diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php
index e1ea0e3e5..340b3c0bb 100644
--- a/Zotlabs/Module/Settings/Display.php
+++ b/Zotlabs/Module/Settings/Display.php
@@ -21,7 +21,7 @@ class Display {
if(! $theme)
$theme = 'redbasic';
- $mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : '');
+
$preload_images = ((x($_POST,'preload_images')) ? intval($_POST['preload_images']) : 0);
$channel_menu = ((x($_POST,'channel_menu')) ? intval($_POST['channel_menu']) : 0);
$user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0);
@@ -47,11 +47,6 @@ class Display {
if($itemspage > 100)
$itemspage = 100;
- if ($mobile_theme == "---")
- del_pconfig(local_channel(),'system','mobile_theme');
- else {
- set_pconfig(local_channel(),'system','mobile_theme',$mobile_theme);
- }
set_pconfig(local_channel(),'system','preload_images',$preload_images);
set_pconfig(local_channel(),'system','user_scalable',$user_scalable);
@@ -114,10 +109,6 @@ class Display {
$theme = (($existing_theme) ? $existing_theme : $default_theme);
- $default_mobile_theme = get_config('system','mobile_theme');
- if(! $mobile_default_theme)
- $mobile_default_theme = 'none';
-
$allowed_themes_str = get_config('system','allowed_themes');
$allowed_themes_raw = explode(',',$allowed_themes_str);
$allowed_themes = array();
@@ -135,26 +126,19 @@ class Display {
$info = get_theme_info($th);
$compatible = check_plugin_versions($info);
- if(!$compatible) {
- $mobile_themes[$f] = $themes[$f] = sprintf(t('%s - (Incompatible)'), $f);
+ if(! $compatible) {
+ $themes[$f] = sprintf(t('%s - (Incompatible)'), $f);
continue;
}
$is_experimental = file_exists('view/theme/' . $th . '/experimental');
$unsupported = file_exists('view/theme/' . $th . '/unsupported');
- $is_mobile = file_exists('view/theme/' . $th . '/mobile');
$is_library = file_exists('view/theme/'. $th . '/library');
- $mobile_themes['---'] = t("No special theme for mobile devices");
if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){
$theme_name = (($is_experimental) ? sprintf(t('%s - (Experimental)'), $f) : $f);
if (! $is_library) {
- if($is_mobile) {
- $mobile_themes[$f] = $themes[$f] = $theme_name . ' (' . t('mobile') . ')';
- }
- else {
- $mobile_themes[$f] = $themes[$f] = $theme_name;
- }
+ $themes[$f] = $theme_name;
}
}
}
@@ -166,7 +150,6 @@ class Display {
$theme_selected = explode(':', $theme_selected)[0];
}
- $mobile_theme_selected = (!x($_SESSION,'mobile_theme')? $default_mobile_theme : $_SESSION['mobile_theme']);
$preload_images = get_pconfig(local_channel(),'system','preload_images');
$preload_images = (($preload_images===false)? '0': $preload_images); // default if not set: 0
@@ -213,7 +196,6 @@ class Display {
'$theme' => (($themes) ? array('theme', t('Display Theme:'), $theme_selected, '', $themes, 'preview') : false),
'$schema' => array('schema', t('Select scheme'), $existing_schema, '' , $schemas),
- '$mobile_theme' => (($mobile_themes) ? array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, '') : false),
'$preload_images' => array('preload_images', t("Preload images before rendering the page"), $preload_images, t("The subjective page load time will be longer but the page will be ready when displayed"), $yes_no),
'$user_scalable' => array('user_scalable', t("Enable user zoom on mobile devices"), $user_scalable, '', $yes_no),
'$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')),
diff --git a/Zotlabs/Module/Share.php b/Zotlabs/Module/Share.php
index 5c4811c59..7f4d8b1eb 100644
--- a/Zotlabs/Module/Share.php
+++ b/Zotlabs/Module/Share.php
@@ -14,6 +14,10 @@ class Share extends \Zotlabs\Web\Controller {
if(! $post_id)
killme();
+
+ echo '[share=' . $post_id . '][/share]';
+ killme();
+
if(! (local_channel() || remote_channel()))
killme();
diff --git a/Zotlabs/Module/Token.php b/Zotlabs/Module/Token.php
index e0d9d74d7..f7c074233 100644
--- a/Zotlabs/Module/Token.php
+++ b/Zotlabs/Module/Token.php
@@ -2,39 +2,36 @@
namespace Zotlabs\Module;
-
-class Token extends \Zotlabs\Web\Controller {
+use Zotlabs\Identity\OAuth2Storage;
- function get() {
+class Token extends \Zotlabs\Web\Controller {
+ function init() {
- // workaround for HTTP-auth in CGI mode
- if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
- $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
- if(strlen($userpass)) {
- list($name, $password) = explode(':', $userpass);
- $_SERVER['PHP_AUTH_USER'] = $name;
- $_SERVER['PHP_AUTH_PW'] = $password;
- }
+ // workaround for HTTP-auth in CGI mode
+ if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
+ $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
+ if(strlen($userpass)) {
+ list($name, $password) = explode(':', $userpass);
+ $_SERVER['PHP_AUTH_USER'] = $name;
+ $_SERVER['PHP_AUTH_PW'] = $password;
}
-
- if (x($_SERVER, 'HTTP_AUTHORIZATION')) {
- $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ;
- if(strlen($userpass)) {
- list($name, $password) = explode(':', $userpass);
- $_SERVER['PHP_AUTH_USER'] = $name;
- $_SERVER['PHP_AUTH_PW'] = $password;
- }
+ }
+
+ if (x($_SERVER, 'HTTP_AUTHORIZATION')) {
+ $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ;
+ if(strlen($userpass)) {
+ list($name, $password) = explode(':', $userpass);
+ $_SERVER['PHP_AUTH_USER'] = $name;
+ $_SERVER['PHP_AUTH_PW'] = $password;
}
+ }
+ $s = new \Zotlabs\Identity\OAuth2Server(new OAuth2Storage(\DBA::$dba->db));
+ $s->handleTokenRequest(\OAuth2\Request::createFromGlobals())->send();
-
-
- require_once('include/oauth2.php');
- $oauth2_server->handleTokenRequest(\OAuth2\Request::createFromGlobals())->send();
-
- killme();
+ killme();
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Render/Theme.php b/Zotlabs/Render/Theme.php
index 09cc7a4d4..0eebba1ba 100644
--- a/Zotlabs/Render/Theme.php
+++ b/Zotlabs/Render/Theme.php
@@ -8,10 +8,8 @@ use App;
class Theme {
static $system_theme = null;
- static $system_mobile_theme = null;
static $session_theme = null;
- static $session_mobile_theme = null;
/**
* @brief Array with base or fallback themes.
@@ -32,10 +30,6 @@ class Theme {
? \App::$config['system']['theme'] : '');
self::$session_theme = ((isset($_SESSION) && x($_SESSION, 'theme'))
? $_SESSION['theme'] : self::$system_theme);
- self::$system_mobile_theme = ((isset(\App::$config['system']['mobile_theme']))
- ? \App::$config['system']['mobile_theme'] : '');
- self::$session_mobile_theme = ((isset($_SESSION) && x($_SESSION, 'mobile_theme'))
- ? $_SESSION['mobile_theme'] : self::$system_mobile_theme);
$page_theme = null;
@@ -55,30 +49,12 @@ class Theme {
if(array_key_exists('theme', \App::$layout) && \App::$layout['theme'])
$page_theme = \App::$layout['theme'];
- // If the viewer is on a mobile device, ensure that we're using a mobile
- // theme of some kind or whatever the viewer's preference is for mobile
- // viewing (if applicable)
+ $chosen_theme = self::$session_theme;
- if(\App::$is_mobile || \App::$is_tablet) {
- if(isset($_SESSION['show_mobile']) && (! $_SESSION['show_mobile'])) {
- $chosen_theme = self::$session_theme;
- }
- else {
- $chosen_theme = self::$session_mobile_theme;
-
- if($chosen_theme === '' || $chosen_theme === '---' ) {
- // user has selected to have the mobile theme be the same as the normal one
- $chosen_theme = self::$session_theme;
- }
- }
+ if($page_theme) {
+ $chosen_theme = $page_theme;
}
- else {
- $chosen_theme = self::$session_theme;
- if($page_theme) {
- $chosen_theme = $page_theme;
- }
- }
if(array_key_exists('theme_preview', $_GET))
$chosen_theme = $_GET['theme_preview'];
diff --git a/Zotlabs/Update/_1000.php b/Zotlabs/Update/_1000.php
new file mode 100644
index 000000000..02787db38
--- /dev/null
+++ b/Zotlabs/Update/_1000.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1000 {
+function run() {
+ $r = q("ALTER TABLE `channel` ADD `channel_a_delegate` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0', ADD INDEX ( `channel_a_delegate` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1001.php b/Zotlabs/Update/_1001.php
new file mode 100644
index 000000000..9acc96373
--- /dev/null
+++ b/Zotlabs/Update/_1001.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1001 {
+function run() {
+ $r = q("CREATE TABLE if not exists `verify` (
+ `id` INT(10) UNSIGNED NOT NULL ,
+ `channel` INT(10) UNSIGNED NOT NULL DEFAULT '0',
+ `type` CHAR( 32 ) NOT NULL DEFAULT '',
+ `token` CHAR( 255 ) NOT NULL DEFAULT '',
+ `meta` CHAR( 255 ) NOT NULL DEFAULT '',
+ `created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
+ PRIMARY KEY ( `id` )
+ ) ENGINE = MYISAM DEFAULT CHARSET=utf8");
+
+ $r2 = q("alter table `verify` add index (`channel`), add index (`type`), add index (`token`),
+ add index (`meta`), add index (`created`)");
+
+ if($r && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1002.php b/Zotlabs/Update/_1002.php
new file mode 100644
index 000000000..1f42449c6
--- /dev/null
+++ b/Zotlabs/Update/_1002.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1002 {
+function run() {
+ $r = q("ALTER TABLE `event` CHANGE `account` `aid` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ $r2 = q("alter table `event` drop index `account`, add index (`aid`)");
+
+ q("drop table contact");
+ q("drop table deliverq");
+
+ if($r && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1003.php b/Zotlabs/Update/_1003.php
new file mode 100644
index 000000000..18d99f985
--- /dev/null
+++ b/Zotlabs/Update/_1003.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1003 {
+function run() {
+ $r = q("ALTER TABLE `xchan` ADD `xchan_flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `xchan_network` ,
+ADD INDEX ( `xchan_flags` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1004.php b/Zotlabs/Update/_1004.php
new file mode 100644
index 000000000..a86f5d824
--- /dev/null
+++ b/Zotlabs/Update/_1004.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1004 {
+function run() {
+ $r = q("CREATE TABLE if not exists `site` (
+`site_url` CHAR( 255 ) NOT NULL ,
+`site_flags` INT NOT NULL DEFAULT '0',
+`site_update` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
+`site_directory` CHAR( 255 ) NOT NULL DEFAULT '',
+PRIMARY KEY ( `site_url` )
+) ENGINE = MYISAM DEFAULT CHARSET=utf8");
+
+ $r2 = q("alter table site add index (site_flags), add index (site_update), add index (site_directory) ");
+
+ if($r && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1005.php b/Zotlabs/Update/_1005.php
new file mode 100644
index 000000000..ee8621a8d
--- /dev/null
+++ b/Zotlabs/Update/_1005.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1005 {
+function run() {
+ q("drop table guid");
+ q("drop table `notify-threads`");
+ return UPDATE_SUCCESS;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1006.php b/Zotlabs/Update/_1006.php
new file mode 100644
index 000000000..43a2bb951
--- /dev/null
+++ b/Zotlabs/Update/_1006.php
@@ -0,0 +1,45 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1006 {
+function run() {
+
+ $r = q("CREATE TABLE IF NOT EXISTS `xprof` (
+ `xprof_hash` char(255) NOT NULL,
+ `xprof_desc` char(255) NOT NULL DEFAULT '',
+ `xprof_dob` char(12) NOT NULL DEFAULT '',
+ `xprof_gender` char(255) NOT NULL DEFAULT '',
+ `xprof_marital` char(255) NOT NULL DEFAULT '',
+ `xprof_sexual` char(255) NOT NULL DEFAULT '',
+ `xprof_locale` char(255) NOT NULL DEFAULT '',
+ `xprof_region` char(255) NOT NULL DEFAULT '',
+ `xprof_postcode` char(32) NOT NULL DEFAULT '',
+ `xprof_country` char(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (`xprof_hash`),
+ KEY `xprof_desc` (`xprof_desc`),
+ KEY `xprof_dob` (`xprof_dob`),
+ KEY `xprof_gender` (`xprof_gender`),
+ KEY `xprof_marital` (`xprof_marital`),
+ KEY `xprof_sexual` (`xprof_sexual`),
+ KEY `xprof_locale` (`xprof_locale`),
+ KEY `xprof_region` (`xprof_region`),
+ KEY `xprof_postcode` (`xprof_postcode`),
+ KEY `xprof_country` (`xprof_country`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+
+ $r2 = q("CREATE TABLE IF NOT EXISTS `xtag` (
+ `xtag_hash` char(255) NOT NULL,
+ `xtag_term` char(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (`xtag_hash`),
+ KEY `xtag_term` (`xtag_term`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+
+ if($r && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1007.php b/Zotlabs/Update/_1007.php
new file mode 100644
index 000000000..eb52c5bc5
--- /dev/null
+++ b/Zotlabs/Update/_1007.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1007 {
+function run() {
+ $r = q("ALTER TABLE `channel` ADD `channel_r_storage` INT UNSIGNED NOT NULL DEFAULT '128', ADD `channel_w_storage` INT UNSIGNED NOT NULL DEFAULT '128', add index ( channel_r_storage ), add index ( channel_w_storage )");
+
+ if($r && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1008.php b/Zotlabs/Update/_1008.php
new file mode 100644
index 000000000..d5db24bc0
--- /dev/null
+++ b/Zotlabs/Update/_1008.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1008 {
+function run() {
+ $r = q("alter table profile drop prv_keywords, CHANGE `pub_keywords` `keywords` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, drop index pub_keywords");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1009.php b/Zotlabs/Update/_1009.php
new file mode 100644
index 000000000..afb0d5e96
--- /dev/null
+++ b/Zotlabs/Update/_1009.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1009 {
+function run() {
+ $r = q("ALTER TABLE `xprof` ADD `xprof_keywords` TEXT NOT NULL");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1010.php b/Zotlabs/Update/_1010.php
new file mode 100644
index 000000000..92405cce4
--- /dev/null
+++ b/Zotlabs/Update/_1010.php
@@ -0,0 +1,18 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1010 {
+function run() {
+ $r = q("ALTER TABLE `abook` ADD `abook_dob` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `abook_connnected` ,
+ADD INDEX ( `abook_dob` )");
+
+ $r2 = q("ALTER TABLE `profile` ADD `dob_tz` CHAR( 255 ) NOT NULL DEFAULT 'UTC' AFTER `dob`");
+
+ if($r && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1011.php b/Zotlabs/Update/_1011.php
new file mode 100644
index 000000000..b6841a9fe
--- /dev/null
+++ b/Zotlabs/Update/_1011.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1011 {
+function run() {
+ $r = q("ALTER TABLE `item` ADD `expires` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `edited` ,
+ADD INDEX ( `expires` )");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1012.php b/Zotlabs/Update/_1012.php
new file mode 100644
index 000000000..3ae5caf65
--- /dev/null
+++ b/Zotlabs/Update/_1012.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1012 {
+function run() {
+ $r = q("ALTER TABLE `xchan` ADD `xchan_connurl` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_url` ,
+ADD INDEX ( `xchan_connurl` )");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1013.php b/Zotlabs/Update/_1013.php
new file mode 100644
index 000000000..68fc9071d
--- /dev/null
+++ b/Zotlabs/Update/_1013.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1013 {
+function run() {
+ $r = q("CREATE TABLE if not exists `xlink` (
+`xlink_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+`xlink_xchan` CHAR( 255 ) NOT NULL DEFAULT '',
+`xlink_link` CHAR( 255 ) NOT NULL DEFAULT '',
+`xlink_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00'
+) ENGINE = MYISAM DEFAULT CHARSET=utf8");
+
+ $r2 = q("alter table xlink add index ( xlink_xchan ), add index ( xlink_link ), add index ( xlink_updated ) ");
+ if($r && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1014.php b/Zotlabs/Update/_1014.php
new file mode 100644
index 000000000..e9b3a89e0
--- /dev/null
+++ b/Zotlabs/Update/_1014.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1014 {
+function run() {
+ $r = q("ALTER TABLE `verify` CHANGE `id` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1015.php b/Zotlabs/Update/_1015.php
new file mode 100644
index 000000000..d9d2d2f27
--- /dev/null
+++ b/Zotlabs/Update/_1015.php
@@ -0,0 +1,19 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1015 {
+function run() {
+ $r = q("ALTER TABLE `channel` ADD `channel_r_pages` INT UNSIGNED NOT NULL DEFAULT '128',
+ADD `channel_w_pages` INT UNSIGNED NOT NULL DEFAULT '128'");
+
+ $r2 = q("ALTER TABLE `channel` ADD INDEX ( `channel_r_pages` ) , ADD INDEX ( `channel_w_pages` ) ");
+
+ if($r && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1016.php b/Zotlabs/Update/_1016.php
new file mode 100644
index 000000000..93f71a474
--- /dev/null
+++ b/Zotlabs/Update/_1016.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1016 {
+function run() {
+
+ $r = q("CREATE TABLE IF NOT EXISTS `menu` (
+ `menu_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `menu_channel_id` int(10) unsigned NOT NULL DEFAULT '0',
+ `menu_desc` char(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (`menu_id`),
+ KEY `menu_channel_id` (`menu_channel_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ $r2 = q("CREATE TABLE IF NOT EXISTS `menu_item` (
+ `mitem_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `mitem_link` char(255) NOT NULL DEFAULT '',
+ `mitem_desc` char(255) NOT NULL DEFAULT '',
+ `allow_cid` mediumtext NOT NULL,
+ `allow_gid` mediumtext NOT NULL,
+ `deny_cid` mediumtext NOT NULL,
+ `deny_gid` mediumtext NOT NULL,
+ `mitem_channel_id` int(10) unsigned NOT NULL,
+ `mitem_menu_id` int(10) unsigned NOT NULL DEFAULT '0',
+ `mitem_order` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`mitem_id`),
+ KEY `mitem_channel_id` (`mitem_channel_id`),
+ KEY `mitem_menu_id` (`mitem_menu_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+
+ if($r && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1017.php b/Zotlabs/Update/_1017.php
new file mode 100644
index 000000000..429eda67b
--- /dev/null
+++ b/Zotlabs/Update/_1017.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1017 {
+function run() {
+ $r = q("ALTER TABLE `event` CHANGE `cid` `event_xchan` CHAR( 255 ) NOT NULL DEFAULT '', ADD INDEX ( `event_xchan` ), drop index cid ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1018.php b/Zotlabs/Update/_1018.php
new file mode 100644
index 000000000..546ebffca
--- /dev/null
+++ b/Zotlabs/Update/_1018.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1018 {
+function run() {
+ $r = q("ALTER TABLE `event` ADD `event_hash` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `event_xchan` ,
+ADD INDEX ( `event_hash` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1019.php b/Zotlabs/Update/_1019.php
new file mode 100644
index 000000000..a7103c98c
--- /dev/null
+++ b/Zotlabs/Update/_1019.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1019 {
+function run() {
+ $r = q("ALTER TABLE `event` DROP `message_id` ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1020.php b/Zotlabs/Update/_1020.php
new file mode 100644
index 000000000..c898f31c2
--- /dev/null
+++ b/Zotlabs/Update/_1020.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1020 {
+function run() {
+ $r = q("alter table photo drop `contact-id`, drop guid, drop index `resource-id`, add index ( `resource_id` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1021.php b/Zotlabs/Update/_1021.php
new file mode 100644
index 000000000..72203fadb
--- /dev/null
+++ b/Zotlabs/Update/_1021.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1021 {
+function run() {
+
+ $r = q("ALTER TABLE `abook` CHANGE `abook_connnected` `abook_connected` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
+ drop index `abook_connnected`, add index ( `abook_connected` ) ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1022.php b/Zotlabs/Update/_1022.php
new file mode 100644
index 000000000..7e13250c4
--- /dev/null
+++ b/Zotlabs/Update/_1022.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1022 {
+function run() {
+ $r = q("alter table attach add index ( filename ), add index ( filetype ), add index ( filesize ), add index ( created ), add index ( edited ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1023.php b/Zotlabs/Update/_1023.php
new file mode 100644
index 000000000..0a8dd2f00
--- /dev/null
+++ b/Zotlabs/Update/_1023.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1023 {
+function run() {
+ $r = q("ALTER TABLE `item` ADD `revision` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `lang` , add index ( revision ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1024.php b/Zotlabs/Update/_1024.php
new file mode 100644
index 000000000..004d8967a
--- /dev/null
+++ b/Zotlabs/Update/_1024.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1024 {
+function run() {
+ $r = q("ALTER TABLE `attach` ADD `revision` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `filesize` ,
+ADD INDEX ( `revision` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1025.php b/Zotlabs/Update/_1025.php
new file mode 100644
index 000000000..d498233b3
--- /dev/null
+++ b/Zotlabs/Update/_1025.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1025 {
+function run() {
+ $r = q("ALTER TABLE `attach` ADD `folder` CHAR( 64 ) NOT NULL DEFAULT '' AFTER `revision` ,
+ADD `flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `folder` , add index ( folder ), add index ( flags )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1026.php b/Zotlabs/Update/_1026.php
new file mode 100644
index 000000000..d57fdec37
--- /dev/null
+++ b/Zotlabs/Update/_1026.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1026 {
+function run() {
+ $r = q("ALTER TABLE `item` ADD `mimetype` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `author_xchan` ,
+ADD INDEX ( `mimetype` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1027.php b/Zotlabs/Update/_1027.php
new file mode 100644
index 000000000..04d09d202
--- /dev/null
+++ b/Zotlabs/Update/_1027.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1027 {
+function run() {
+ $r = q("ALTER TABLE `abook` ADD `abook_rating` INT NOT NULL DEFAULT '0' AFTER `abook_closeness` ,
+ADD INDEX ( `abook_rating` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1028.php b/Zotlabs/Update/_1028.php
new file mode 100644
index 000000000..a58784a01
--- /dev/null
+++ b/Zotlabs/Update/_1028.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1028 {
+function run() {
+ $r = q("ALTER TABLE `xlink` ADD `xlink_rating` INT NOT NULL DEFAULT '0' AFTER `xlink_link` ,
+ADD INDEX ( `xlink_rating` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1029.php b/Zotlabs/Update/_1029.php
new file mode 100644
index 000000000..7072647cb
--- /dev/null
+++ b/Zotlabs/Update/_1029.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1029 {
+function run() {
+ $r = q("ALTER TABLE `channel` ADD `channel_deleted` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_pageflags` ,
+ADD INDEX ( `channel_deleted` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1030.php b/Zotlabs/Update/_1030.php
new file mode 100644
index 000000000..7aebde49e
--- /dev/null
+++ b/Zotlabs/Update/_1030.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1030 {
+function run() {
+ $r = q("CREATE TABLE IF NOT EXISTS `issue` (
+`issue_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+`issue_created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
+`issue_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
+`issue_assigned` CHAR( 255 ) NOT NULL ,
+`issue_priority` INT NOT NULL ,
+`issue_status` INT NOT NULL ,
+`issue_component` CHAR( 255 ) NOT NULL,
+KEY `issue_created` (`issue_created`),
+KEY `issue_updated` (`issue_updated`),
+KEY `issue_assigned` (`issue_assigned`),
+KEY `issue_priority` (`issue_priority`),
+KEY `issue_status` (`issue_status`),
+KEY `issue_component` (`issue_component`)
+) ENGINE = MYISAM DEFAULT CHARSET=utf8");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1031.php b/Zotlabs/Update/_1031.php
new file mode 100644
index 000000000..4463c9e04
--- /dev/null
+++ b/Zotlabs/Update/_1031.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1031 {
+function run() {
+ $r = q("ALTER TABLE `account` ADD `account_external` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `account_email` ,
+ADD INDEX ( `account_external` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1032.php b/Zotlabs/Update/_1032.php
new file mode 100644
index 000000000..a9fbeca9e
--- /dev/null
+++ b/Zotlabs/Update/_1032.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1032 {
+function run() {
+ $r = q("CREATE TABLE if not exists `xign` (
+`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+`uid` INT NOT NULL DEFAULT '0',
+`xchan` CHAR( 255 ) NOT NULL DEFAULT '',
+KEY `uid` (`uid`),
+KEY `xchan` (`xchan`)
+) ENGINE = MYISAM DEFAULT CHARSET = utf8");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1033.php b/Zotlabs/Update/_1033.php
new file mode 100644
index 000000000..a201e1d1f
--- /dev/null
+++ b/Zotlabs/Update/_1033.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1033 {
+function run() {
+ $r = q("CREATE TABLE if not exists `shares` (
+`share_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+`share_type` INT NOT NULL DEFAULT '0',
+`share_target` INT UNSIGNED NOT NULL DEFAULT '0',
+`share_xchan` CHAR( 255 ) NOT NULL DEFAULT '',
+KEY `share_type` (`share_type`),
+KEY `share_target` (`share_target`),
+KEY `share_xchan` (`share_xchan`)
+) ENGINE = MYISAM DEFAULT CHARSET = utf8");
+
+ // if these fail don't bother reporting it
+
+ q("drop table gcign");
+ q("drop table gcontact");
+ q("drop table glink");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1034.php b/Zotlabs/Update/_1034.php
new file mode 100644
index 000000000..646182cc0
--- /dev/null
+++ b/Zotlabs/Update/_1034.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1034 {
+function run() {
+ $r = q("CREATE TABLE if not exists `updates` (
+`ud_hash` CHAR( 128 ) NOT NULL ,
+`ud_date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
+PRIMARY KEY ( `ud_hash` ),
+KEY `ud_date` ( `ud_date` )
+) ENGINE = MYISAM DEFAULT CHARSET = utf8");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1035.php b/Zotlabs/Update/_1035.php
new file mode 100644
index 000000000..44e95189d
--- /dev/null
+++ b/Zotlabs/Update/_1035.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1035 {
+function run() {
+ $r = q("CREATE TABLE if not exists `xconfig` (
+`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+`xchan` CHAR( 255 ) NOT NULL ,
+`cat` CHAR( 255 ) NOT NULL ,
+`k` CHAR( 255 ) NOT NULL ,
+`v` MEDIUMTEXT NOT NULL,
+KEY `xchan` ( `xchan` ),
+KEY `cat` ( `cat` ),
+KEY `k` ( `k` )
+) ENGINE = MYISAM DEFAULT CHARSET = utf8");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1036.php b/Zotlabs/Update/_1036.php
new file mode 100644
index 000000000..700a82e12
--- /dev/null
+++ b/Zotlabs/Update/_1036.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1036 {
+function run() {
+ $r = q("ALTER TABLE `profile` ADD `channels` TEXT NOT NULL AFTER `contact` ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1037.php b/Zotlabs/Update/_1037.php
new file mode 100644
index 000000000..a1ad20aa8
--- /dev/null
+++ b/Zotlabs/Update/_1037.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1037 {
+function run() {
+ $r1 = q("ALTER TABLE `item` CHANGE `uri` `mid` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
+CHANGE `parent_uri` `parent_mid` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
+ DROP INDEX `uri` ,
+ADD INDEX `mid` ( `mid` ),
+DROP INDEX `parent_uri` ,
+ADD INDEX `parent_mid` ( `parent_mid` ),
+ DROP INDEX `uid_uri` ,
+ADD INDEX `uid_mid` ( `mid` , `uid` ) ");
+
+ $r2 = q("ALTER TABLE `mail` CHANGE `uri` `mid` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
+CHANGE `parent_uri` `parent_mid` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
+DROP INDEX `uri` ,
+ADD INDEX `mid` ( `mid` ),
+ DROP INDEX `parent_uri` ,
+ADD INDEX `parent_mid` ( `parent_mid` ) ");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1038.php b/Zotlabs/Update/_1038.php
new file mode 100644
index 000000000..b4a86f41e
--- /dev/null
+++ b/Zotlabs/Update/_1038.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1038 {
+function run() {
+ $r = q("ALTER TABLE `manage` CHANGE `mid` `xchan` CHAR( 255 ) NOT NULL DEFAULT '', drop index `mid`, ADD INDEX ( `xchan` )");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1039.php b/Zotlabs/Update/_1039.php
new file mode 100644
index 000000000..9214cdc4a
--- /dev/null
+++ b/Zotlabs/Update/_1039.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1039 {
+function run() {
+ $r = q("ALTER TABLE `channel` CHANGE `channel_default_gid` `channel_default_group` CHAR( 255 ) NOT NULL DEFAULT ''");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1040.php b/Zotlabs/Update/_1040.php
new file mode 100644
index 000000000..77dc75a48
--- /dev/null
+++ b/Zotlabs/Update/_1040.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1040 {
+function run() {
+ $r1 = q("ALTER TABLE `session` CHANGE `expire` `expire` BIGINT UNSIGNED NOT NULL ");
+ $r2 = q("ALTER TABLE `tokens` CHANGE `expires` `expires` BIGINT UNSIGNED NOT NULL ");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1041.php b/Zotlabs/Update/_1041.php
new file mode 100644
index 000000000..4ed436e61
--- /dev/null
+++ b/Zotlabs/Update/_1041.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1041 {
+function run() {
+ $r = q("ALTER TABLE `outq` ADD `outq_driver` CHAR( 32 ) NOT NULL DEFAULT '' AFTER `outq_channel` ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1042.php b/Zotlabs/Update/_1042.php
new file mode 100644
index 000000000..56298b6a3
--- /dev/null
+++ b/Zotlabs/Update/_1042.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1042 {
+function run() {
+ $r = q("ALTER TABLE `hubloc` ADD `hubloc_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
+ADD `hubloc_connected` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( `hubloc_updated` ), ADD INDEX ( `hubloc_connected` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1043.php b/Zotlabs/Update/_1043.php
new file mode 100644
index 000000000..b28203731
--- /dev/null
+++ b/Zotlabs/Update/_1043.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1043 {
+function run() {
+ $r = q("ALTER TABLE `item` ADD `comment_policy` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `coord` ,
+ADD INDEX ( `comment_policy` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1044.php b/Zotlabs/Update/_1044.php
new file mode 100644
index 000000000..fc7e5438f
--- /dev/null
+++ b/Zotlabs/Update/_1044.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1044 {
+function run() {
+ $r = q("ALTER TABLE `term` ADD `imgurl` CHAR( 255 ) NOT NULL ,
+ADD INDEX ( `imgurl` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1045.php b/Zotlabs/Update/_1045.php
new file mode 100644
index 000000000..73570c316
--- /dev/null
+++ b/Zotlabs/Update/_1045.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1045 {
+function run() {
+ $r = q("ALTER TABLE `site` ADD `site_register` INT NOT NULL DEFAULT '0',
+ADD INDEX ( `site_register` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1046.php b/Zotlabs/Update/_1046.php
new file mode 100644
index 000000000..219d53e17
--- /dev/null
+++ b/Zotlabs/Update/_1046.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1046 {
+function run() {
+ $r = q("ALTER TABLE `term` ADD `term_hash` CHAR( 255 ) NOT NULL DEFAULT '',
+ADD INDEX ( `term_hash` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1047.php b/Zotlabs/Update/_1047.php
new file mode 100644
index 000000000..930c13eb8
--- /dev/null
+++ b/Zotlabs/Update/_1047.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1047 {
+function run() {
+ $r = q("ALTER TABLE `xprof` ADD `xprof_age` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `xprof_hash` ,
+ADD INDEX ( `xprof_age` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1048.php b/Zotlabs/Update/_1048.php
new file mode 100644
index 000000000..20c8931d7
--- /dev/null
+++ b/Zotlabs/Update/_1048.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1048 {
+function run() {
+ $r = q("CREATE TABLE IF NOT EXISTS `obj` (
+ `obj_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `obj_page` char(64) NOT NULL DEFAULT '',
+ `obj_verb` char(255) NOT NULL DEFAULT '',
+ `obj_type` int(10) unsigned NOT NULL DEFAULT '0',
+ `obj_obj` char(255) NOT NULL DEFAULT '',
+ `obj_channel` int(10) unsigned NOT NULL DEFAULT '0',
+ PRIMARY KEY (`obj_id`),
+ KEY `obj_verb` (`obj_verb`),
+ KEY `obj_page` (`obj_page`),
+ KEY `obj_type` (`obj_type`),
+ KEY `obj_channel` (`obj_channel`),
+ KEY `obj_obj` (`obj_obj`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1049.php b/Zotlabs/Update/_1049.php
new file mode 100644
index 000000000..622847727
--- /dev/null
+++ b/Zotlabs/Update/_1049.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1049 {
+function run() {
+ $r = q("ALTER TABLE `term` ADD `parent_hash` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `term_hash` , ADD INDEX ( `parent_hash` ) ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1050.php b/Zotlabs/Update/_1050.php
new file mode 100644
index 000000000..1939d346f
--- /dev/null
+++ b/Zotlabs/Update/_1050.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1050 {
+function run() {
+ $r = q("ALTER TABLE `xtag` DROP PRIMARY KEY , ADD `xtag_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST , ADD INDEX ( `xtag_hash` ) ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1051.php b/Zotlabs/Update/_1051.php
new file mode 100644
index 000000000..041b51f21
--- /dev/null
+++ b/Zotlabs/Update/_1051.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1051 {
+function run() {
+ $r = q("ALTER TABLE `photo` ADD `photo_flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `profile` , ADD INDEX ( `photo_flags` ) ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1052.php b/Zotlabs/Update/_1052.php
new file mode 100644
index 000000000..05addf21f
--- /dev/null
+++ b/Zotlabs/Update/_1052.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1052 {
+function run() {
+ $r = q("ALTER TABLE `channel` ADD UNIQUE (`channel_address`) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1053.php b/Zotlabs/Update/_1053.php
new file mode 100644
index 000000000..4752dca62
--- /dev/null
+++ b/Zotlabs/Update/_1053.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1053 {
+function run() {
+ $r = q("ALTER TABLE `profile` ADD `chandesc` TEXT NOT NULL DEFAULT '' AFTER `pdesc` ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1054.php b/Zotlabs/Update/_1054.php
new file mode 100644
index 000000000..f4fc2eb5b
--- /dev/null
+++ b/Zotlabs/Update/_1054.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1054 {
+function run() {
+ $r = q("ALTER TABLE `item` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1055.php b/Zotlabs/Update/_1055.php
new file mode 100644
index 000000000..6b3a4c1d9
--- /dev/null
+++ b/Zotlabs/Update/_1055.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1055 {
+function run() {
+ $r = q("ALTER TABLE `mail` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1056.php b/Zotlabs/Update/_1056.php
new file mode 100644
index 000000000..6c0510f88
--- /dev/null
+++ b/Zotlabs/Update/_1056.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1056 {
+function run() {
+ $r = q("ALTER TABLE `xchan` ADD `xchan_instance_url` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_network` ,
+ADD INDEX ( `xchan_instance_url` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1057.php b/Zotlabs/Update/_1057.php
new file mode 100644
index 000000000..081e82d1f
--- /dev/null
+++ b/Zotlabs/Update/_1057.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1057 {
+function run() {
+ $r = q("drop table intro");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1058.php b/Zotlabs/Update/_1058.php
new file mode 100644
index 000000000..8e3ffdd6a
--- /dev/null
+++ b/Zotlabs/Update/_1058.php
@@ -0,0 +1,19 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1058 {
+function run() {
+ $r1 = q("ALTER TABLE `menu` ADD `menu_name` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `menu_channel_id` ,
+ADD INDEX ( `menu_name` ) ");
+
+ $r2 = q("ALTER TABLE `menu_item` ADD `mitem_flags` INT NOT NULL DEFAULT '0' AFTER `mitem_desc` ,
+ADD INDEX ( `mitem_flags` ) ");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1059.php b/Zotlabs/Update/_1059.php
new file mode 100644
index 000000000..e035efb2c
--- /dev/null
+++ b/Zotlabs/Update/_1059.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1059 {
+function run() {
+ $r = q("ALTER TABLE `mail` ADD `attach` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `body` ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1060.php b/Zotlabs/Update/_1060.php
new file mode 100644
index 000000000..5182b803a
--- /dev/null
+++ b/Zotlabs/Update/_1060.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1060 {
+function run() {
+
+ $r = q("CREATE TABLE IF NOT EXISTS `vote` (
+ `vote_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `vote_poll` int(11) NOT NULL DEFAULT '0',
+ `vote_element` int(11) NOT NULL DEFAULT '0',
+ `vote_result` text NOT NULL,
+ `vote_xchan` char(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (`vote_id`),
+ UNIQUE KEY `vote_vote` (`vote_poll`,`vote_element`,`vote_xchan`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1061.php b/Zotlabs/Update/_1061.php
new file mode 100644
index 000000000..e7af5bcb1
--- /dev/null
+++ b/Zotlabs/Update/_1061.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1061 {
+function run() {
+ $r = q("ALTER TABLE `vote` ADD INDEX ( `vote_poll` ), ADD INDEX ( `vote_element` ) ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1062.php b/Zotlabs/Update/_1062.php
new file mode 100644
index 000000000..39aa80e8a
--- /dev/null
+++ b/Zotlabs/Update/_1062.php
@@ -0,0 +1,34 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1062 {
+function run() {
+ $r1 = q("CREATE TABLE IF NOT EXISTS `poll` (
+`poll_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+`poll_channel` INT UNSIGNED NOT NULL DEFAULT '0',
+`poll_desc` TEXT NOT NULL DEFAULT '',
+`poll_flags` INT NOT NULL DEFAULT '0',
+`poll_votes` INT NOT NULL DEFAULT '0',
+KEY `poll_channel` (`poll_channel`),
+KEY `poll_flags` (`poll_flags`),
+KEY `poll_votes` (`poll_votes`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ $r2 = q("CREATE TABLE IF NOT EXISTS `poll_elm` (
+`pelm_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+`pelm_poll` INT UNSIGNED NOT NULL DEFAULT '0',
+`pelm_desc` TEXT NOT NULL DEFAULT '',
+`pelm_flags` INT NOT NULL DEFAULT '0',
+`pelm_result` FLOAT NOT NULL DEFAULT '0',
+KEY `pelm_poll` (`pelm_poll`),
+KEY `pelm_result` (`pelm_result`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1063.php b/Zotlabs/Update/_1063.php
new file mode 100644
index 000000000..04d523df6
--- /dev/null
+++ b/Zotlabs/Update/_1063.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1063 {
+function run() {
+ $r = q("ALTER TABLE `xchan` ADD `xchan_follow` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_connurl` ,
+ADD `xchan_connpage` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_follow` ,
+ADD INDEX ( `xchan_follow` ), ADD INDEX ( `xchan_connpage`) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1064.php b/Zotlabs/Update/_1064.php
new file mode 100644
index 000000000..295dd96c5
--- /dev/null
+++ b/Zotlabs/Update/_1064.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1064 {
+function run() {
+ $r = q("ALTER TABLE `updates` ADD `ud_guid` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `ud_hash` ,
+ADD INDEX ( `ud_guid` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1065.php b/Zotlabs/Update/_1065.php
new file mode 100644
index 000000000..0a3e9082e
--- /dev/null
+++ b/Zotlabs/Update/_1065.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1065 {
+function run() {
+ $r = q("ALTER TABLE `item` DROP `wall`, ADD `layout_mid` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `target` ,
+ADD INDEX ( `layout_mid` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1066.php b/Zotlabs/Update/_1066.php
new file mode 100644
index 000000000..e7d3fbbb4
--- /dev/null
+++ b/Zotlabs/Update/_1066.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1066 {
+function run() {
+ $r = q("ALTER TABLE `site` ADD `site_access` INT NOT NULL DEFAULT '0' AFTER `site_url` ,
+ADD INDEX ( `site_access` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1067.php b/Zotlabs/Update/_1067.php
new file mode 100644
index 000000000..94782a15e
--- /dev/null
+++ b/Zotlabs/Update/_1067.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1067 {
+function run() {
+ $r = q("ALTER TABLE `updates` DROP PRIMARY KEY , ADD `ud_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST, ADD INDEX ( `ud_hash` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1068.php b/Zotlabs/Update/_1068.php
new file mode 100644
index 000000000..e2a70684f
--- /dev/null
+++ b/Zotlabs/Update/_1068.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1068 {
+function run(){
+ $r = q("ALTER TABLE `hubloc` ADD `hubloc_status` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `hubloc_flags` , ADD INDEX ( `hubloc_status` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1069.php b/Zotlabs/Update/_1069.php
new file mode 100644
index 000000000..437c7ffef
--- /dev/null
+++ b/Zotlabs/Update/_1069.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1069 {
+function run() {
+ $r = q("ALTER TABLE `site` ADD `site_sellpage` CHAR( 255 ) NOT NULL DEFAULT '',
+ADD INDEX ( `site_sellpage` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1070.php b/Zotlabs/Update/_1070.php
new file mode 100644
index 000000000..2ec03f752
--- /dev/null
+++ b/Zotlabs/Update/_1070.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1070 {
+function run() {
+ $r = q("ALTER TABLE `updates` ADD `ud_flags` INT NOT NULL DEFAULT '0',
+ADD INDEX ( `ud_flags` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1071.php b/Zotlabs/Update/_1071.php
new file mode 100644
index 000000000..f4e627e7f
--- /dev/null
+++ b/Zotlabs/Update/_1071.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1071 {
+function run() {
+ $r = q("ALTER TABLE `updates` ADD `ud_addr` CHAR( 255 ) NOT NULL DEFAULT '',
+ADD INDEX ( `ud_addr` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1072.php b/Zotlabs/Update/_1072.php
new file mode 100644
index 000000000..191893547
--- /dev/null
+++ b/Zotlabs/Update/_1072.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1072 {
+function run() {
+ $r = q("ALTER TABLE `xtag` ADD `xtag_flags` INT NOT NULL DEFAULT '0',
+ADD INDEX ( `xtag_flags` ) ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1073.php b/Zotlabs/Update/_1073.php
new file mode 100644
index 000000000..f238d7a36
--- /dev/null
+++ b/Zotlabs/Update/_1073.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1073 {
+function run() {
+ $r1 = q("CREATE TABLE IF NOT EXISTS `source` (
+`src_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+`src_channel_id` INT UNSIGNED NOT NULL DEFAULT '0',
+`src_channel_xchan` CHAR( 255 ) NOT NULL DEFAULT '',
+`src_xchan` CHAR( 255 ) NOT NULL DEFAULT '',
+`src_patt` MEDIUMTEXT NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ $r2 = q("ALTER TABLE `source` ADD INDEX ( `src_channel_id` ), ADD INDEX ( `src_channel_xchan` ), ADD INDEX ( `src_xchan` ) ");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1074.php b/Zotlabs/Update/_1074.php
new file mode 100644
index 000000000..d331b935a
--- /dev/null
+++ b/Zotlabs/Update/_1074.php
@@ -0,0 +1,19 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1074 {
+function run() {
+ $r1 = q("ALTER TABLE `site` ADD `site_sync` DATETIME NOT NULL AFTER `site_update` ");
+
+ $r2 = q("ALTER TABLE `updates` ADD `ud_last` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `ud_date` ,
+ADD INDEX ( `ud_last` ) ");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1075.php b/Zotlabs/Update/_1075.php
new file mode 100644
index 000000000..ac7c48f71
--- /dev/null
+++ b/Zotlabs/Update/_1075.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1075 {
+function run() {
+ $r = q("ALTER TABLE `channel` ADD `channel_a_republish` INT UNSIGNED NOT NULL DEFAULT '128',
+ADD INDEX ( `channel_a_republish` )");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1076.php b/Zotlabs/Update/_1076.php
new file mode 100644
index 000000000..c8c631822
--- /dev/null
+++ b/Zotlabs/Update/_1076.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1076 {
+function run() {
+ $r = q("ALTER TABLE `item` CHANGE `inform` `sig` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1077.php b/Zotlabs/Update/_1077.php
new file mode 100644
index 000000000..3c23affbc
--- /dev/null
+++ b/Zotlabs/Update/_1077.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1077 {
+function run() {
+ $r = q("ALTER TABLE `item` ADD `source_xchan` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `author_xchan` ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1078.php b/Zotlabs/Update/_1078.php
new file mode 100644
index 000000000..c832a1c2a
--- /dev/null
+++ b/Zotlabs/Update/_1078.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1078 {
+function run() {
+ $r = q("ALTER TABLE `channel` ADD `channel_dirdate` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_pageflags` , ADD INDEX ( `channel_dirdate` )");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1079.php b/Zotlabs/Update/_1079.php
new file mode 100644
index 000000000..b10e2e7ae
--- /dev/null
+++ b/Zotlabs/Update/_1079.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1079 {
+function run() {
+ $r = q("ALTER TABLE `site` ADD `site_location` CHAR( 255 ) NOT NULL DEFAULT ''");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1080.php b/Zotlabs/Update/_1080.php
new file mode 100644
index 000000000..ab9c4c2f8
--- /dev/null
+++ b/Zotlabs/Update/_1080.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1080 {
+function run() {
+ $r = q("ALTER TABLE `mail` ADD `expires` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
+ADD INDEX ( `expires` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1081.php b/Zotlabs/Update/_1081.php
new file mode 100644
index 000000000..521a39893
--- /dev/null
+++ b/Zotlabs/Update/_1081.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1081 {
+function run() {
+ $r = q("DROP TABLE `queue` ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1082.php b/Zotlabs/Update/_1082.php
new file mode 100644
index 000000000..8ce8d20c1
--- /dev/null
+++ b/Zotlabs/Update/_1082.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1082 {
+function run() {
+ $r = q("DROP TABLE `challenge` ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1083.php b/Zotlabs/Update/_1083.php
new file mode 100644
index 000000000..becb2b702
--- /dev/null
+++ b/Zotlabs/Update/_1083.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1083 {
+function run() {
+ $r = q("ALTER TABLE `notify` ADD `aid` INT NOT NULL AFTER `msg` ,
+ADD INDEX ( `aid` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1084.php b/Zotlabs/Update/_1084.php
new file mode 100644
index 000000000..621d0346d
--- /dev/null
+++ b/Zotlabs/Update/_1084.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1084 {
+function run() {
+
+
+ $r = q("CREATE TABLE if not exists `sys_perms` (
+ `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+ `cat` CHAR( 255 ) NOT NULL ,
+ `k` CHAR( 255 ) NOT NULL ,
+ `v` MEDIUMTEXT NOT NULL,
+ `public_perm` TINYINT( 1 ) UNSIGNED NOT NULL
+) ENGINE = MYISAM DEFAULT CHARSET = utf8");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1085.php b/Zotlabs/Update/_1085.php
new file mode 100644
index 000000000..f50e56319
--- /dev/null
+++ b/Zotlabs/Update/_1085.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1085 {
+function run() {
+ $r1 = q("ALTER TABLE `photo` CHANGE `desc` `description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ");
+
+ $r2 = q("RENAME TABLE `group` TO `groups`");
+
+ $r3 = q("ALTER TABLE `event` CHANGE `desc` `description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ");
+
+ if($r1 && $r2 && $r3)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1086.php b/Zotlabs/Update/_1086.php
new file mode 100644
index 000000000..1b034daac
--- /dev/null
+++ b/Zotlabs/Update/_1086.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1086 {
+function run() {
+ $r = q("ALTER TABLE `account` ADD `account_level` INT UNSIGNED NOT NULL DEFAULT '0',
+ADD INDEX ( `account_level` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1087.php b/Zotlabs/Update/_1087.php
new file mode 100644
index 000000000..839c16d91
--- /dev/null
+++ b/Zotlabs/Update/_1087.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1087 {
+function run() {
+ $r = q("ALTER TABLE `xprof` ADD `xprof_about` TEXT NOT NULL DEFAULT '',
+ADD `xprof_homepage` CHAR( 255 ) NOT NULL DEFAULT '',
+ADD `xprof_hometown` CHAR( 255 ) NOT NULL DEFAULT '',
+ADD INDEX ( `xprof_hometown` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1088.php b/Zotlabs/Update/_1088.php
new file mode 100644
index 000000000..5f478d0a1
--- /dev/null
+++ b/Zotlabs/Update/_1088.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1088 {
+function run() {
+ $r = q("ALTER TABLE `obj` ADD `allow_cid` MEDIUMTEXT NOT NULL DEFAULT '',
+ADD `allow_gid` MEDIUMTEXT NOT NULL DEFAULT '',
+ADD `deny_cid` MEDIUMTEXT NOT NULL DEFAULT '',
+ADD `deny_gid` MEDIUMTEXT NOT NULL DEFAULT ''");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1089.php b/Zotlabs/Update/_1089.php
new file mode 100644
index 000000000..0a8a1d55b
--- /dev/null
+++ b/Zotlabs/Update/_1089.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1089 {
+function run() {
+ $r = q("ALTER TABLE `attach` ADD `creator` CHAR( 128 ) NOT NULL DEFAULT '' AFTER `hash` ,
+ADD INDEX ( `creator` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1090.php b/Zotlabs/Update/_1090.php
new file mode 100644
index 000000000..efa7db7c2
--- /dev/null
+++ b/Zotlabs/Update/_1090.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1090 {
+function run() {
+ $r = q("ALTER TABLE `menu` ADD `menu_flags` INT NOT NULL DEFAULT '0',
+ADD INDEX ( `menu_flags` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1091.php b/Zotlabs/Update/_1091.php
new file mode 100644
index 000000000..ffb445c62
--- /dev/null
+++ b/Zotlabs/Update/_1091.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1091 {
+function run() {
+ @os_mkdir('store/[data]/smarty3',STORAGE_DEFAULT_PERMISSIONS,true);
+ @file_put_contents('store/[data]/locks','');
+ return UPDATE_SUCCESS;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1092.php b/Zotlabs/Update/_1092.php
new file mode 100644
index 000000000..897c0c20b
--- /dev/null
+++ b/Zotlabs/Update/_1092.php
@@ -0,0 +1,61 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1092 {
+function run() {
+ $r1 = q("CREATE TABLE IF NOT EXISTS `chat` (
+ `chat_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `chat_room` int(10) unsigned NOT NULL DEFAULT '0',
+ `chat_xchan` char(255) NOT NULL DEFAULT '',
+ `chat_text` mediumtext NOT NULL,
+ `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
+ PRIMARY KEY (`chat_id`),
+ KEY `chat_room` (`chat_room`),
+ KEY `chat_xchan` (`chat_xchan`),
+ KEY `created` (`created`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+
+ $r2 = q("CREATE TABLE IF NOT EXISTS `chatpresence` (
+ `cp_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `cp_room` int(10) unsigned NOT NULL DEFAULT '0',
+ `cp_xchan` char(255) NOT NULL DEFAULT '',
+ `cp_last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
+ `cp_status` char(255) NOT NULL,
+ PRIMARY KEY (`cp_id`),
+ KEY `cp_room` (`cp_room`),
+ KEY `cp_xchan` (`cp_xchan`),
+ KEY `cp_last` (`cp_last`),
+ KEY `cp_status` (`cp_status`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+
+ $r3 = q("CREATE TABLE IF NOT EXISTS `chatroom` (
+ `cr_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `cr_aid` int(10) unsigned NOT NULL DEFAULT '0',
+ `cr_uid` int(10) unsigned NOT NULL DEFAULT '0',
+ `cr_name` char(255) NOT NULL DEFAULT '',
+ `cr_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
+ `cr_edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
+ `allow_cid` mediumtext NOT NULL,
+ `allow_gid` mediumtext NOT NULL,
+ `deny_cid` mediumtext NOT NULL,
+ `deny_gid` mediumtext NOT NULL,
+ PRIMARY KEY (`cr_id`),
+ KEY `cr_aid` (`cr_aid`),
+ KEY `cr_uid` (`cr_uid`),
+ KEY `cr_name` (`cr_name`),
+ KEY `cr_created` (`cr_created`),
+ KEY `cr_edited` (`cr_edited`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+
+
+ if($r1 && $r2 && $r3)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1093.php b/Zotlabs/Update/_1093.php
new file mode 100644
index 000000000..eb692e0b7
--- /dev/null
+++ b/Zotlabs/Update/_1093.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1093 {
+function run() {
+ $r = q("ALTER TABLE `chatpresence` ADD `cp_client` CHAR( 128 ) NOT NULL DEFAULT ''");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1094.php b/Zotlabs/Update/_1094.php
new file mode 100644
index 000000000..c502c7a06
--- /dev/null
+++ b/Zotlabs/Update/_1094.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1094 {
+function run() {
+ $r = q("ALTER TABLE `chatroom` ADD `cr_expire` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `cr_edited` ,
+ADD INDEX ( `cr_expire` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1095.php b/Zotlabs/Update/_1095.php
new file mode 100644
index 000000000..0f11fda62
--- /dev/null
+++ b/Zotlabs/Update/_1095.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1095 {
+function run() {
+ $r = q("ALTER TABLE `channel` ADD `channel_a_bookmark` INT UNSIGNED NOT NULL DEFAULT '128',
+ADD INDEX ( `channel_a_bookmark` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1096.php b/Zotlabs/Update/_1096.php
new file mode 100644
index 000000000..67abb9ee2
--- /dev/null
+++ b/Zotlabs/Update/_1096.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1096 {
+function run() {
+ $r = q("ALTER TABLE `account` CHANGE `account_level` `account_level` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1097.php b/Zotlabs/Update/_1097.php
new file mode 100644
index 000000000..bfe04cf5f
--- /dev/null
+++ b/Zotlabs/Update/_1097.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1097 {
+function run() {
+
+ // fix some mangled hublocs from a bug long ago
+
+ $r = q("select hubloc_id, hubloc_addr from hubloc where hubloc_addr like '%%/%%'");
+ if($r) {
+ foreach($r as $rr) {
+ q("update hubloc set hubloc_addr = '%s' where hubloc_id = %d",
+ dbesc(substr($rr['hubloc_addr'],0,strpos($rr['hubloc_addr'],'/'))),
+ intval($rr['hubloc_id'])
+ );
+ }
+ }
+ return UPDATE_SUCCESS;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1098.php b/Zotlabs/Update/_1098.php
new file mode 100644
index 000000000..e74ba640c
--- /dev/null
+++ b/Zotlabs/Update/_1098.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1098 {
+function run() {
+ $r = q("ALTER TABLE `channel` CHANGE `channel_r_stream` `channel_r_stream` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ $r2 = q("ALTER TABLE `channel` CHANGE `channel_r_profile` `channel_r_profile` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ $r3 = q("ALTER TABLE `channel` CHANGE `channel_r_photos` `channel_r_photos` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ $r4 = q("ALTER TABLE `channel` CHANGE `channel_r_abook` `channel_r_abook` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ $r4 = q("ALTER TABLE `channel` CHANGE `channel_w_stream` `channel_w_stream` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ $r5 = q("ALTER TABLE `channel` CHANGE `channel_w_wall` `channel_w_wall` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ $r6 = q("ALTER TABLE `channel` CHANGE `channel_w_tagwall` `channel_w_tagwall` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ $r7 = q("ALTER TABLE `channel` CHANGE `channel_w_comment` `channel_w_comment` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ $r8 = q("ALTER TABLE `channel` CHANGE `channel_w_mail` `channel_w_mail` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ $r9 = q("ALTER TABLE `channel` CHANGE `channel_w_photos` `channel_w_photos` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ $r10 = q("ALTER TABLE `channel` CHANGE `channel_w_chat` `channel_w_chat` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ $r11 = q("ALTER TABLE `channel` CHANGE `channel_a_delegate` `channel_a_delegate` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ if($r && $r2 && $r3 && $r3 && $r5 && $r6 && $r7 && $r8 && $r9 && $r9 && $r10 && $r11)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1099.php b/Zotlabs/Update/_1099.php
new file mode 100644
index 000000000..a49e38c7c
--- /dev/null
+++ b/Zotlabs/Update/_1099.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1099 {
+function run() {
+ $r = q("CREATE TABLE IF NOT EXISTS `xchat` (
+ `xchat_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `xchat_url` char(255) NOT NULL DEFAULT '',
+ `xchat_desc` char(255) NOT NULL DEFAULT '',
+ `xchat_xchan` char(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (`xchat_id`),
+ KEY `xchat_url` (`xchat_url`),
+ KEY `xchat_desc` (`xchat_desc`),
+ KEY `xchat_xchan` (`xchat_xchan`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1100.php b/Zotlabs/Update/_1100.php
new file mode 100644
index 000000000..ffcd7dc1d
--- /dev/null
+++ b/Zotlabs/Update/_1100.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1100 {
+function run() {
+ $r = q("ALTER TABLE `xchat` ADD `xchat_edited` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
+ADD INDEX ( `xchat_edited` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1101.php b/Zotlabs/Update/_1101.php
new file mode 100644
index 000000000..709b6fa0a
--- /dev/null
+++ b/Zotlabs/Update/_1101.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1101 {
+function run() {
+ $r = q("update updates set ud_flags = 2 where ud_flags = (-1)");
+ $r = q("update updates set ud_flags = 0 where ud_flags = 4096");
+ return UPDATE_SUCCESS;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1102.php b/Zotlabs/Update/_1102.php
new file mode 100644
index 000000000..d25979b1f
--- /dev/null
+++ b/Zotlabs/Update/_1102.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1102 {
+function run() {
+ $r = q("update abook set abook_flags = (abook_flags - %d)
+ where ( abook_flags & %d)",
+ intval(ABOOK_FLAG_UNCONNECTED),
+ intval(ABOOK_FLAG_UNCONNECTED)
+ );
+ return UPDATE_SUCCESS;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1103.php b/Zotlabs/Update/_1103.php
new file mode 100644
index 000000000..3f9a9286c
--- /dev/null
+++ b/Zotlabs/Update/_1103.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1103 {
+function run() {
+ $x = curl_version();
+ if(stristr($x['ssl_version'],'openssl'))
+ set_config('system','curl_ssl_ciphers','ALL:!eNULL');
+ return UPDATE_SUCCESS;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1104.php b/Zotlabs/Update/_1104.php
new file mode 100644
index 000000000..0d299095b
--- /dev/null
+++ b/Zotlabs/Update/_1104.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1104 {
+function run() {
+ $r = q("ALTER TABLE `item` ADD `route` TEXT NOT NULL DEFAULT '' AFTER `postopts` ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1105.php b/Zotlabs/Update/_1105.php
new file mode 100644
index 000000000..a96600150
--- /dev/null
+++ b/Zotlabs/Update/_1105.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1105 {
+function run() {
+ $r = q("ALTER TABLE `site` ADD `site_pull` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `site_update` ,
+CHANGE `site_sync` `site_sync` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( `site_pull` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1106.php b/Zotlabs/Update/_1106.php
new file mode 100644
index 000000000..7e13d8993
--- /dev/null
+++ b/Zotlabs/Update/_1106.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1106 {
+function run() {
+ $r = q("ALTER TABLE `notify` CHANGE `parent` `parent` CHAR( 255 ) NOT NULL DEFAULT ''");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1107.php b/Zotlabs/Update/_1107.php
new file mode 100644
index 000000000..bcac6cf19
--- /dev/null
+++ b/Zotlabs/Update/_1107.php
@@ -0,0 +1,34 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1107 {
+function run() {
+ $r = q("CREATE TABLE IF NOT EXISTS `app` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `app_id` char(64) NOT NULL DEFAULT '',
+ `app_sig` char(255) NOT NULL DEFAULT '',
+ `app_author` char(255) NOT NULL DEFAULT '',
+ `app_name` char(255) NOT NULL DEFAULT '',
+ `app_desc` text NOT NULL,
+ `app_url` char(255) NOT NULL DEFAULT '',
+ `app_photo` char(255) NOT NULL DEFAULT '',
+ `app_version` char(255) NOT NULL DEFAULT '',
+ `app_channel` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`),
+ KEY `app_id` (`app_id`),
+ KEY `app_name` (`app_name`),
+ KEY `app_url` (`app_url`),
+ KEY `app_photo` (`app_photo`),
+ KEY `app_version` (`app_version`),
+ KEY `app_channel` (`app_channel`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1108.php b/Zotlabs/Update/_1108.php
new file mode 100644
index 000000000..d9d9b0c18
--- /dev/null
+++ b/Zotlabs/Update/_1108.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1108 {
+function run() {
+ $r = q("ALTER TABLE `app` ADD `app_addr` CHAR( 255 ) NOT NULL DEFAULT '',
+ADD `app_price` CHAR( 255 ) NOT NULL DEFAULT '',
+ADD `app_page` CHAR( 255 ) NOT NULL DEFAULT '',
+ADD INDEX ( `app_price` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1109.php b/Zotlabs/Update/_1109.php
new file mode 100644
index 000000000..6a0aed28f
--- /dev/null
+++ b/Zotlabs/Update/_1109.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1109 {
+function run() {
+ $r = q("ALTER TABLE `app` CHANGE `app_id` `app_id` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+// We ended up with an extra zero in the name for 1108, so do it over and ignore the result.
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1110.php b/Zotlabs/Update/_1110.php
new file mode 100644
index 000000000..62bcbd0c8
--- /dev/null
+++ b/Zotlabs/Update/_1110.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1110 {
+function run() {
+ $r = q("ALTER TABLE `app` ADD `app_addr` CHAR( 255 ) NOT NULL DEFAULT '',
+ADD `app_price` CHAR( 255 ) NOT NULL DEFAULT '',
+ADD `app_page` CHAR( 255 ) NOT NULL DEFAULT '',
+ADD INDEX ( `app_price` )");
+
+ return UPDATE_SUCCESS;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1111.php b/Zotlabs/Update/_1111.php
new file mode 100644
index 000000000..a3080b465
--- /dev/null
+++ b/Zotlabs/Update/_1111.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1111 {
+function run() {
+ $r = q("ALTER TABLE `app` ADD `app_requires` CHAR( 255 ) NOT NULL DEFAULT '' ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1112.php b/Zotlabs/Update/_1112.php
new file mode 100644
index 000000000..e81780519
--- /dev/null
+++ b/Zotlabs/Update/_1112.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1112 {
+function run() {
+ $r = q("CREATE TABLE IF NOT EXISTS `likes` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `liker` char(128) NOT NULL DEFAULT '',
+ `likee` char(128) NOT NULL DEFAULT '',
+ `iid` int(11) NOT NULL DEFAULT '0',
+ `verb` char(255) NOT NULL DEFAULT '',
+ `target_type` char(255) NOT NULL DEFAULT '',
+ `target` mediumtext NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `liker` (`liker`),
+ KEY `likee` (`likee`),
+ KEY `iid` (`iid`),
+ KEY `verb` (`verb`),
+ KEY `target_type` (`target_type`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1113.php b/Zotlabs/Update/_1113.php
new file mode 100644
index 000000000..0a726dcc3
--- /dev/null
+++ b/Zotlabs/Update/_1113.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1113 {
+function run() {
+ $r = q("ALTER TABLE `likes` ADD `channel_id` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `id` ,
+CHANGE `iid` `iid` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0',
+ADD INDEX ( `channel_id` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1114.php b/Zotlabs/Update/_1114.php
new file mode 100644
index 000000000..5b564d513
--- /dev/null
+++ b/Zotlabs/Update/_1114.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1114 {
+function run() {
+ $r = q("ALTER TABLE `likes` ADD `target_id` CHAR( 128 ) NOT NULL DEFAULT '' AFTER `target_type` ,
+ADD INDEX ( `target_id` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1115.php b/Zotlabs/Update/_1115.php
new file mode 100644
index 000000000..4edf63b85
--- /dev/null
+++ b/Zotlabs/Update/_1115.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1115 {
+function run() {
+
+ // Introducing email verification. Mark all existing accounts as verified or they
+ // won't be able to login.
+
+ $r = q("update account set account_flags = (account_flags ^ 1) where (account_flags & 1) ");
+ return UPDATE_SUCCESS;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1116.php b/Zotlabs/Update/_1116.php
new file mode 100644
index 000000000..9fa7270ea
--- /dev/null
+++ b/Zotlabs/Update/_1116.php
@@ -0,0 +1,12 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1116 {
+function run() {
+ @os_mkdir('store/[data]/smarty3',STORAGE_DEFAULT_PERMISSIONS,true);
+ return UPDATE_SUCCESS;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1117.php b/Zotlabs/Update/_1117.php
new file mode 100644
index 000000000..cc8edb3c9
--- /dev/null
+++ b/Zotlabs/Update/_1117.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1117 {
+function run() {
+ $r = q("ALTER TABLE `channel` CHANGE `channel_a_bookmark` `channel_w_like` INT( 10 ) UNSIGNED NOT NULL DEFAULT '128',
+DROP INDEX `channel_a_bookmark` , ADD INDEX `channel_w_like` ( `channel_w_like` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1118.php b/Zotlabs/Update/_1118.php
new file mode 100644
index 000000000..22cfc2357
--- /dev/null
+++ b/Zotlabs/Update/_1118.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1118 {
+function run() {
+ $r = q("ALTER TABLE `account` ADD `account_password_changed` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
+ADD INDEX ( `account_password_changed` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1119.php b/Zotlabs/Update/_1119.php
new file mode 100644
index 000000000..ccf03e45a
--- /dev/null
+++ b/Zotlabs/Update/_1119.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1119 {
+function run() {
+ $r1 = q("CREATE TABLE IF NOT EXISTS `profdef` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `field_name` char(255) NOT NULL DEFAULT '',
+ `field_type` char(16) NOT NULL DEFAULT '',
+ `field_desc` char(255) NOT NULL DEFAULT '',
+ `field_help` char(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (`id`),
+ KEY `field_name` (`field_name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+
+ $r2 = q("CREATE TABLE IF NOT EXISTS `profext` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `channel_id` int(10) unsigned NOT NULL DEFAULT '0',
+ `hash` char(255) NOT NULL DEFAULT '',
+ `k` char(255) NOT NULL DEFAULT '',
+ `v` mediumtext NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `channel_id` (`channel_id`),
+ KEY `hash` (`hash`),
+ KEY `k` (`k`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1120.php b/Zotlabs/Update/_1120.php
new file mode 100644
index 000000000..c1f7e98d7
--- /dev/null
+++ b/Zotlabs/Update/_1120.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1120 {
+function run() {
+ $r = q("ALTER TABLE `item` ADD `public_policy` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `coord` ,
+ADD INDEX ( `public_policy` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1121.php b/Zotlabs/Update/_1121.php
new file mode 100644
index 000000000..c5ff00694
--- /dev/null
+++ b/Zotlabs/Update/_1121.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1121 {
+function run() {
+ $r = q("ALTER TABLE `site` ADD `site_realm` CHAR( 255 ) NOT NULL DEFAULT '',
+ADD INDEX ( `site_realm` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1122.php b/Zotlabs/Update/_1122.php
new file mode 100644
index 000000000..903e3aaeb
--- /dev/null
+++ b/Zotlabs/Update/_1122.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1122 {
+function run() {
+ $r = q("update site set site_realm = '%s' where true",
+ dbesc(DIRECTORY_REALM)
+ );
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1123.php b/Zotlabs/Update/_1123.php
new file mode 100644
index 000000000..96096beac
--- /dev/null
+++ b/Zotlabs/Update/_1123.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1123 {
+function run() {
+ $r1 = q("ALTER TABLE `hubloc` ADD `hubloc_network` CHAR( 32 ) NOT NULL DEFAULT '' AFTER `hubloc_addr` ,
+ADD INDEX ( `hubloc_network` )");
+ $r2 = q("update hubloc set hubloc_network = 'zot' where true");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1124.php b/Zotlabs/Update/_1124.php
new file mode 100644
index 000000000..1320b8b55
--- /dev/null
+++ b/Zotlabs/Update/_1124.php
@@ -0,0 +1,41 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1124 {
+function run() {
+ $r1 = q("CREATE TABLE IF NOT EXISTS `sign` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `iid` int(10) unsigned NOT NULL DEFAULT '0',
+ `retract_iid` int(10) unsigned NOT NULL DEFAULT '0',
+ `signed_text` mediumtext NOT NULL,
+ `signature` text NOT NULL,
+ `signer` char(255) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `iid` (`iid`),
+ KEY `retract_iid` (`retract_iid`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ $r2 = q("CREATE TABLE IF NOT EXISTS `conv` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `guid` char(255) NOT NULL,
+ `recips` mediumtext NOT NULL,
+ `uid` int(11) NOT NULL,
+ `creator` char(255) NOT NULL,
+ `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
+ `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
+ `subject` mediumtext NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `created` (`created`),
+ KEY `updated` (`updated`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1125.php b/Zotlabs/Update/_1125.php
new file mode 100644
index 000000000..03f9640a4
--- /dev/null
+++ b/Zotlabs/Update/_1125.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1125 {
+function run() {
+ $r = q("ALTER TABLE `profdef` ADD `field_inputs` MEDIUMTEXT NOT NULL DEFAULT ''");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1126.php b/Zotlabs/Update/_1126.php
new file mode 100644
index 000000000..f657cc6b2
--- /dev/null
+++ b/Zotlabs/Update/_1126.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1126 {
+function run() {
+ $r = q("ALTER TABLE `mail` ADD `convid` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `id` ,
+ADD INDEX ( `convid` )");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1127.php b/Zotlabs/Update/_1127.php
new file mode 100644
index 000000000..8dec64ae4
--- /dev/null
+++ b/Zotlabs/Update/_1127.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1127 {
+function run() {
+ $r = q("ALTER TABLE `item` ADD `comments_closed` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `changed` ,
+ADD INDEX ( `comments_closed` ), ADD INDEX ( `changed` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1128.php b/Zotlabs/Update/_1128.php
new file mode 100644
index 000000000..8ee6d225e
--- /dev/null
+++ b/Zotlabs/Update/_1128.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1128 {
+function run() {
+ $r = q("ALTER TABLE `item` ADD `diaspora_meta` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `sig` ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1129.php b/Zotlabs/Update/_1129.php
new file mode 100644
index 000000000..76bd155ee
--- /dev/null
+++ b/Zotlabs/Update/_1129.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1129 {
+function run() {
+ $r = q("update hubloc set hubloc_network = 'zot' where hubloc_network = ''");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1130.php b/Zotlabs/Update/_1130.php
new file mode 100644
index 000000000..1322a0b13
--- /dev/null
+++ b/Zotlabs/Update/_1130.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1130 {
+function run() {
+ $myperms = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
+ |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE;
+
+ $r = q("select abook_channel, abook_my_perms from abook where (abook_flags & %d) and abook_my_perms != 0",
+ intval(ABOOK_FLAG_SELF)
+ );
+ if($r) {
+ foreach($r as $rr) {
+ set_pconfig($rr['abook_channel'],'system','autoperms',$rr['abook_my_perms']);
+ }
+ }
+ $r = q("update abook set abook_my_perms = %d where (abook_flags & %d) and abook_my_perms = 0",
+ intval($myperms),
+ intval(ABOOK_FLAG_SELF)
+ );
+
+ return UPDATE_SUCCESS;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1131.php b/Zotlabs/Update/_1131.php
new file mode 100644
index 000000000..72e968f67
--- /dev/null
+++ b/Zotlabs/Update/_1131.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1131 {
+function run() {
+ 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` ");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1132.php b/Zotlabs/Update/_1132.php
new file mode 100644
index 000000000..9e085a351
--- /dev/null
+++ b/Zotlabs/Update/_1132.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1132 {
+function run() {
+ 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/Zotlabs/Update/_1133.php b/Zotlabs/Update/_1133.php
new file mode 100644
index 000000000..3820ef1ee
--- /dev/null
+++ b/Zotlabs/Update/_1133.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1133 {
+function run() {
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("CREATE TABLE xperm (
+ xp_id serial NOT NULL,
+ xp_client varchar( 20 ) NOT NULL DEFAULT '',
+ xp_channel bigint NOT NULL DEFAULT '0',
+ xp_perm varchar( 64 ) NOT NULL DEFAULT '',
+ PRIMARY KEY (xp_id) )");
+ $r2 = 0;
+ foreach(array('xp_client', 'xp_channel', 'xp_perm') as $fld)
+ $r2 += ((q("create index $fld on xperm ($fld)") == false) ? 0 : 1);
+
+ $r = (($r1 && $r2) ? true : false);
+ }
+ else {
+ $r = q("CREATE TABLE IF NOT EXISTS `xperm` (
+ `xp_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+ `xp_client` VARCHAR( 20 ) NOT NULL DEFAULT '',
+ `xp_channel` INT UNSIGNED NOT NULL DEFAULT '0',
+ `xp_perm` VARCHAR( 64 ) NOT NULL DEFAULT '',
+ KEY `xp_client` (`xp_client`),
+ KEY `xp_channel` (`xp_channel`),
+ KEY `xp_perm` (`xp_perm`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+ }
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1134.php b/Zotlabs/Update/_1134.php
new file mode 100644
index 000000000..d52bab044
--- /dev/null
+++ b/Zotlabs/Update/_1134.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1134 {
+function run() {
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE xlink ADD xlink_static numeric(1) NOT NULL DEFAULT '0' ");
+ $r2 = q("create index xlink_static on xlink ( xlink_static ) ");
+ $r = $r1 && $r2;
+ }
+ else
+ $r = q("ALTER TABLE xlink ADD xlink_static TINYINT( 1 ) NOT NULL DEFAULT '0', ADD INDEX ( xlink_static ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1135.php b/Zotlabs/Update/_1135.php
new file mode 100644
index 000000000..92a3e04b6
--- /dev/null
+++ b/Zotlabs/Update/_1135.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1135 {
+function run() {
+ $r = q("ALTER TABLE xlink ADD xlink_sig TEXT NOT NULL DEFAULT ''");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1136.php b/Zotlabs/Update/_1136.php
new file mode 100644
index 000000000..0c1691fcb
--- /dev/null
+++ b/Zotlabs/Update/_1136.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1136 {
+function run() {
+ $r1 = q("alter table item add item_unseen smallint not null default '0' ");
+ $r2 = q("create index item_unseen on item ( item_unseen ) ");
+ $r3 = q("update item set item_unseen = 1 where ( item_flags & 2 ) > 0 ");
+
+ if($r1 && $r2 && $r3)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1137.php b/Zotlabs/Update/_1137.php
new file mode 100644
index 000000000..ab11fe3db
--- /dev/null
+++ b/Zotlabs/Update/_1137.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1137 {
+function run() {
+ $r1 = q("alter table site add site_valid smallint not null default '0' ");
+ $r2 = q("create index site_valid on site ( site_valid ) ");
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1138.php b/Zotlabs/Update/_1138.php
new file mode 100644
index 000000000..b2eac12af
--- /dev/null
+++ b/Zotlabs/Update/_1138.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1138 {
+function run() {
+ $r1 = q("alter table outq add outq_priority smallint not null default '0' ");
+ $r2 = q("create index outq_priority on outq ( outq_priority ) ");
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1139.php b/Zotlabs/Update/_1139.php
new file mode 100644
index 000000000..aa4863fc1
--- /dev/null
+++ b/Zotlabs/Update/_1139.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1139 {
+function run() {
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE channel ADD channel_lastpost timestamp NOT NULL DEFAULT '0001-01-01 00:00:00'");
+ $r2 = q("create index channel_lastpost on channel ( channel_lastpost ) ");
+ $r = $r1 && $r2;
+ }
+ else
+ $r = q("ALTER TABLE `channel` ADD `channel_lastpost` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_dirdate` , ADD INDEX ( `channel_lastpost` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1140.php b/Zotlabs/Update/_1140.php
new file mode 100644
index 000000000..5b4c8f801
--- /dev/null
+++ b/Zotlabs/Update/_1140.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1140 {
+function run() {
+ $r = q("select * from clients where true");
+ $x = false;
+ if($r) {
+ foreach($r as $rr) {
+ $m = q("INSERT INTO xperm (xp_client, xp_channel, xp_perm) VALUES ('%s', %d, '%s') ",
+ dbesc($rr['client_id']),
+ intval($rr['uid']),
+ dbesc('all')
+ );
+ if(! $m)
+ $x = true;
+ }
+ }
+ if($x)
+ return UPDATE_FAILED;
+ return UPDATE_SUCCESS;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1141.php b/Zotlabs/Update/_1141.php
new file mode 100644
index 000000000..e1f84f469
--- /dev/null
+++ b/Zotlabs/Update/_1141.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1141 {
+function run() {
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE menu ADD menu_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', ADD menu_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00'");
+ $r2 = q("create index menu_created on menu ( menu_created ) ");
+ $r3 = q("create index menu_edited on menu ( menu_edited ) ");
+ $r = $r1 && $r2;
+ }
+ else
+ $r = q("ALTER TABLE menu ADD menu_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD menu_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( menu_created ), ADD INDEX ( menu_edited ) ");
+
+ $t = datetime_convert();
+ q("update menu set menu_created = '%s', menu_edited = '%s' where true",
+ dbesc($t),
+ dbesc($t)
+ );
+
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1142.php b/Zotlabs/Update/_1142.php
new file mode 100644
index 000000000..a8ffcc182
--- /dev/null
+++ b/Zotlabs/Update/_1142.php
@@ -0,0 +1,18 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1142 {
+function run() {
+
+ $r1 = q("alter table site add site_dead smallint not null default '0' ");
+ $r2 = q("create index site_dead on site ( site_dead ) ");
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1143.php b/Zotlabs/Update/_1143.php
new file mode 100644
index 000000000..99f23af61
--- /dev/null
+++ b/Zotlabs/Update/_1143.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1143 {
+function run() {
+
+ $r1 = q("ALTER TABLE abook ADD abook_incl TEXT NOT NULL DEFAULT ''");
+ $r2 = q("ALTER TABLE abook ADD abook_excl TEXT NOT NULL DEFAULT '' ");
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1144.php b/Zotlabs/Update/_1144.php
new file mode 100644
index 000000000..848897de7
--- /dev/null
+++ b/Zotlabs/Update/_1144.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1144 {
+function run() {
+ $r = q("select flags, id from attach where flags != 0");
+ if($r) {
+ foreach($r as $rr) {
+ if($rr['flags'] & 1) {
+ q("update attach set is_dir = 1 where id = %d",
+ intval($rr['id'])
+ );
+ }
+ if($rr['flags'] & 2) {
+ q("update attach set os_storage = 1 where id = %d",
+ intval($rr['id'])
+ );
+ }
+ }
+ }
+
+ return UPDATE_SUCCESS;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1145.php b/Zotlabs/Update/_1145.php
new file mode 100644
index 000000000..5102acc8a
--- /dev/null
+++ b/Zotlabs/Update/_1145.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1145 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE event ADD event_status char(255) NOT NULL DEFAULT '',
+ ADD event_status_date timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
+ ADD event_percent SMALLINT NOT NULL DEFAULT '0',
+ ADD event_repeat TEXT NOT NULL DEFAULT '' ");
+ $r2 = q("create index event_status on event ( event_status )");
+ $r = $r1 && $r2;
+ }
+ else {
+ $r = q("ALTER TABLE `event` ADD `event_status` CHAR( 255 ) NOT NULL DEFAULT '',
+ ADD `event_status_date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
+ ADD `event_percent` SMALLINT NOT NULL DEFAULT '0',
+ ADD `event_repeat` TEXT NOT NULL DEFAULT '',
+ ADD INDEX ( `event_status` ) ");
+ }
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1146.php b/Zotlabs/Update/_1146.php
new file mode 100644
index 000000000..92a26adaf
--- /dev/null
+++ b/Zotlabs/Update/_1146.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1146 {
+function run() {
+
+ $r1 = q("alter table event add event_sequence smallint not null default '0' ");
+ $r2 = q("create index event_sequence on event ( event_sequence ) ");
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1147.php b/Zotlabs/Update/_1147.php
new file mode 100644
index 000000000..b8f6716f7
--- /dev/null
+++ b/Zotlabs/Update/_1147.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1147 {
+function run() {
+
+ $r1 = q("alter table event add event_priority smallint not null default '0' ");
+ $r2 = q("create index event_priority on event ( event_priority ) ");
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1148.php b/Zotlabs/Update/_1148.php
new file mode 100644
index 000000000..ed9a4d93a
--- /dev/null
+++ b/Zotlabs/Update/_1148.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1148 {
+function run() {
+ $r1 = q("alter table likes add i_mid char(255) not null default '' ");
+ $r2 = q("create index i_mid on likes ( i_mid ) ");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1149.php b/Zotlabs/Update/_1149.php
new file mode 100644
index 000000000..f45bd995b
--- /dev/null
+++ b/Zotlabs/Update/_1149.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1149 {
+function run() {
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '',
+ ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '',
+ ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '',
+ ADD obj_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
+ ADD obj_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ }
+ else {
+ $r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '',
+ ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '',
+ ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '',
+ ADD obj_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
+ ADD obj_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ }
+
+ $r2 = q("create index obj_term on obj ( obj_term ) ");
+ $r3 = q("create index obj_url on obj ( obj_url ) ");
+ $r4 = q("create index obj_imgurl on obj ( obj_imgurl ) ");
+ $r5 = q("create index obj_created on obj ( obj_created ) ");
+ $r6 = q("create index obj_edited on obj ( obj_edited ) ");
+ $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6;
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1150.php b/Zotlabs/Update/_1150.php
new file mode 100644
index 000000000..896fc75e3
--- /dev/null
+++ b/Zotlabs/Update/_1150.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1150 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE app ADD app_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
+ ADD app_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ }
+ else {
+ $r1 = q("ALTER TABLE app ADD app_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
+ ADD app_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ }
+
+ $r2 = q("create index app_created on app ( app_created ) ");
+ $r3 = q("create index app_edited on app ( app_edited ) ");
+
+ $r = $r1 && $r2 && $r3;
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1151.php b/Zotlabs/Update/_1151.php
new file mode 100644
index 000000000..d14baabb1
--- /dev/null
+++ b/Zotlabs/Update/_1151.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1151 {
+function run() {
+
+ $r3 = q("select likes.*, item.mid from likes left join item on likes.iid = item.id");
+ if($r3) {
+ foreach($r3 as $rr) {
+ q("update likes set i_mid = '%s' where id = $d",
+ dbesc($rr['mid']),
+ intval($rr['id'])
+ );
+ }
+ }
+
+
+ return UPDATE_SUCCESS;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1152.php b/Zotlabs/Update/_1152.php
new file mode 100644
index 000000000..54393d590
--- /dev/null
+++ b/Zotlabs/Update/_1152.php
@@ -0,0 +1,57 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1152 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+
+ $r1 = q("CREATE TABLE IF NOT EXISTS \"dreport\" (
+ \"dreport_id\" serial NOT NULL,
+ \"dreport_channel\" int(11) NOT NULL DEFAULT '0',
+ \"dreport_mid\" char(255) NOT NULL DEFAULT '',
+ \"dreport_site\" char(255) NOT NULL DEFAULT '',
+ \"dreport_recip\" char(255) NOT NULL DEFAULT '',
+ \"dreport_result\" char(255) NOT NULL DEFAULT '',
+ \"dreport_time\" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
+ \"dreport_xchan\" char(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (\"dreport_id\") ");
+
+ $r2 = q("create index \"dreport_mid\" on dreport (\"dreport_mid\") ");
+ $r3 = q("create index \"dreport_site\" on dreport (\"dreport_site\") ");
+ $r4 = q("create index \"dreport_time\" on dreport (\"dreport_time\") ");
+ $r5 = q("create index \"dreport_xchan\" on dreport (\"dreport_xchan\") ");
+ $r6 = q("create index \"dreport_channel\" on dreport (\"dreport_channel\") ");
+
+ $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6;
+
+ }
+ else {
+ $r = q("CREATE TABLE IF NOT EXISTS `dreport` (
+ `dreport_id` int(11) NOT NULL AUTO_INCREMENT,
+ `dreport_channel` int(11) NOT NULL DEFAULT '0',
+ `dreport_mid` char(255) NOT NULL DEFAULT '',
+ `dreport_site` char(255) NOT NULL DEFAULT '',
+ `dreport_recip` char(255) NOT NULL DEFAULT '',
+ `dreport_result` char(255) NOT NULL DEFAULT '',
+ `dreport_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
+ `dreport_xchan` char(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (`dreport_id`),
+ KEY `dreport_mid` (`dreport_mid`),
+ KEY `dreport_site` (`dreport_site`),
+ KEY `dreport_time` (`dreport_time`),
+ KEY `dreport_xchan` (`dreport_xchan`),
+ KEY `dreport_channel` (`dreport_channel`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ }
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1153.php b/Zotlabs/Update/_1153.php
new file mode 100644
index 000000000..cf8d451b4
--- /dev/null
+++ b/Zotlabs/Update/_1153.php
@@ -0,0 +1,18 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1153 {
+function run() {
+
+ $r1 = q("ALTER TABLE dreport ADD dreport_queue CHAR( 255 ) NOT NULL DEFAULT '' ");
+ $r2 = q("create index dreport_queue on dreport ( dreport_queue) ");
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1154.php b/Zotlabs/Update/_1154.php
new file mode 100644
index 000000000..6e92f525d
--- /dev/null
+++ b/Zotlabs/Update/_1154.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1154 {
+function run() {
+
+ $r = q("ALTER TABLE event ADD event_vdata text NOT NULL ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1155.php b/Zotlabs/Update/_1155.php
new file mode 100644
index 000000000..8f2553b3e
--- /dev/null
+++ b/Zotlabs/Update/_1155.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1155 {
+function run() {
+
+ $r1 = q("alter table site add site_type smallint not null default '0' ");
+ $r2 = q("create index site_type on site ( site_type ) ");
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1156.php b/Zotlabs/Update/_1156.php
new file mode 100644
index 000000000..536a219d8
--- /dev/null
+++ b/Zotlabs/Update/_1156.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1156 {
+function run() {
+ $r1 = q("ALTER TABLE mail ADD conv_guid CHAR( 255 ) NOT NULL DEFAULT '' ");
+ $r2 = q("create index conv_guid on mail ( conv_guid ) ");
+
+ $r3 = q("select mail.id, mail.convid, conv.guid from mail left join conv on mail.convid = conv.id where true");
+ if($r3) {
+ foreach($r3 as $rr) {
+ if($rr['convid']) {
+ q("update mail set conv_guid = '%s' where id = %d",
+ dbesc($rr['guid']),
+ intval($rr['id'])
+ );
+ }
+ }
+ }
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1157.php b/Zotlabs/Update/_1157.php
new file mode 100644
index 000000000..01f452f32
--- /dev/null
+++ b/Zotlabs/Update/_1157.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1157 {
+function run() {
+ $r1 = q("alter table site add site_project char(255) not null default '' ");
+ $r2 = q("create index site_project on site ( site_project ) ");
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1158.php b/Zotlabs/Update/_1158.php
new file mode 100644
index 000000000..89ac3daa1
--- /dev/null
+++ b/Zotlabs/Update/_1158.php
@@ -0,0 +1,22 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1158 {
+function run() {
+ $r = q("select attach.id, attach.data, channel_address from attach left join channel on attach.uid = channel_id where os_storage = 1 and not attach.data like '%%store%%' ");
+ if($r) {
+ foreach($r as $rr) {
+ $has_slash = ((substr($rr['data'],0,1) === '/') ? true : false);
+ q("update attach set data = '%s' where id = %d",
+ dbesc('store/' . $rr['channel_address']. (($has_slash) ? '' : '/' . $rr['data'])),
+ dbesc($rr['id'])
+ );
+ }
+ }
+ return UPDATE_SUCCESS;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1159.php b/Zotlabs/Update/_1159.php
new file mode 100644
index 000000000..1445092ad
--- /dev/null
+++ b/Zotlabs/Update/_1159.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1159 {
+function run() {
+ $r = q("select attach.id, attach.data, attach.hash, channel_address from attach left join channel on attach.uid = channel_id where os_storage = 1 ");
+ if($r) {
+ foreach($r as $rr) {
+ $x = dbunescbin($rr['data']);
+ $has_slash = (($x === 'store/' . $rr['channel_address'] . '/') ? true : false);
+ if(($x === 'store/' . $rr['channel_address']) || ($has_slash)) {
+ q("update attach set data = '%s' where id = %d",
+ dbesc('store/' . $rr['channel_address']. (($has_slash) ? '' : '/' . $rr['hash'])),
+ dbesc($rr['id'])
+ );
+ }
+ }
+ }
+ return UPDATE_SUCCESS;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1160.php b/Zotlabs/Update/_1160.php
new file mode 100644
index 000000000..b7b67076f
--- /dev/null
+++ b/Zotlabs/Update/_1160.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1160 {
+function run() {
+ $r = q("alter table abook add abook_instance text not null default '' ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1161.php b/Zotlabs/Update/_1161.php
new file mode 100644
index 000000000..870eb7ed6
--- /dev/null
+++ b/Zotlabs/Update/_1161.php
@@ -0,0 +1,43 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1161 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("CREATE TABLE \"iconfig\" (
+ \"id\" serial NOT NULL,
+ \"iid\" bigint NOT NULL DEFAULT '0',
+ \"cat\" text NOT NULL DEFAULT '',
+ \"k\" text NOT NULL DEFAULT '',
+ \"v\" text NOT NULL DEFAULT '',
+ PRIMARY_KEY(\"id\")
+) ");
+$r2 = q("create index \"iconfig_iid\" on iconfig (\"iid\") ");;
+$r3 = q("create index \"iconfig_cat\" on iconfig (\"cat\") ");
+$r4 = q("create index \"iconfig_k\" on iconfig (\"k\") ");
+ $r = $r1 && $r2 && $r3 && $r4;
+ }
+ else {
+ $r = q("CREATE TABLE IF NOT EXISTS `iconfig` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `iid` int(11) NOT NULL DEFAULT '0',
+ `cat` char(255) NOT NULL DEFAULT '',
+ `k` char(255) NOT NULL DEFAULT '',
+ `v` mediumtext NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `iid` (`iid`),
+ KEY `cat` (`cat`),
+ KEY `k` (`k`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ }
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1162.php b/Zotlabs/Update/_1162.php
new file mode 100644
index 000000000..683ea9802
--- /dev/null
+++ b/Zotlabs/Update/_1162.php
@@ -0,0 +1,19 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1162 {
+function run() {
+ $r1 = q("alter table iconfig add sharing int not null default '0' ");
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES)
+ $r2 = q("create index \"iconfig_sharing\" on iconfig (\"sharing\") ");
+ else
+ $r2 = q("alter table iconfig add index ( sharing ) ");
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1163.php b/Zotlabs/Update/_1163.php
new file mode 100644
index 000000000..376447aea
--- /dev/null
+++ b/Zotlabs/Update/_1163.php
@@ -0,0 +1,22 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1163 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("alter table channel add channel_moved text not null default '' ");
+ $r2 = q("create index \"channel_channel_moved\" on channel (\"channel_moved\") ");
+ }
+ else {
+ $r1 = q("alter table channel add channel_moved char(255) not null default '' ");
+ $r2 = q("alter table channel add index ( channel_moved ) ");
+ }
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1164.php b/Zotlabs/Update/_1164.php
new file mode 100644
index 000000000..bad9193d1
--- /dev/null
+++ b/Zotlabs/Update/_1164.php
@@ -0,0 +1,45 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1164 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("CREATE TABLE \"abconfig\" (
+ \"id\" serial NOT NULL,
+ \"chan\" text NOT NULL,
+ \"xchan\" text NOT NULL,
+ \"cat\" text NOT NULL,
+ \"k\" text NOT NULL,
+ \"v\" text NOT NULL,
+ PRIMARY KEY (\"id\") ");
+ $r2 = q("create index \"abconfig_chan\" on abconfig (\"chan\") ");
+ $r3 = q("create index \"abconfig_xchan\" on abconfig (\"xchan\") ");
+ $r4 = q("create index \"abconfig_cat\" on abconfig (\"cat\") ");
+ $r5 = q("create index \"abconfig_k\" on abconfig (\"k\") ");
+ $r = $r1 && $r2 && $r3 && $r4 && $r5;
+ }
+ else {
+ $r = q("CREATE TABLE IF NOT EXISTS `abconfig` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `chan` char(255) NOT NULL DEFAULT '',
+ `xchan` char(255) NOT NULL DEFAULT '',
+ `cat` char(255) NOT NULL DEFAULT '',
+ `k` char(255) NOT NULL DEFAULT '',
+ `v` mediumtext NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `chan` (`chan`),
+ KEY `xchan` (`xchan`),
+ KEY `cat` (`cat`),
+ KEY `k` (`k`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ }
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1165.php b/Zotlabs/Update/_1165.php
new file mode 100644
index 000000000..fcea38dc8
--- /dev/null
+++ b/Zotlabs/Update/_1165.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1165 {
+function run() {
+
+ $r1 = q("alter table hook add hook_version int not null default '0' ");
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES)
+ $r2 = q("create index \"hook_version_idx\" on hook (\"hook_version\") ");
+ else
+ $r2 = q("alter table hook add index ( hook_version ) ");
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1166.php b/Zotlabs/Update/_1166.php
new file mode 100644
index 000000000..e320d5bc0
--- /dev/null
+++ b/Zotlabs/Update/_1166.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1166 {
+function run() {
+
+ $r = q("alter table source add src_tag text not null default '' ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1167.php b/Zotlabs/Update/_1167.php
new file mode 100644
index 000000000..b5510a21f
--- /dev/null
+++ b/Zotlabs/Update/_1167.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1167 {
+function run() {
+
+ $r1 = q("alter table app add app_deleted int not null default '0' ");
+ $r2 = q("alter table app add app_system int not null default '0' ");
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r3 = q("create index \"app_deleted_idx\" on app (\"app_deleted\") ");
+ $r4 = q("create index \"app_system_idx\" on app (\"app_system\") ");
+ }
+ else {
+ $r3 = q("alter table app add index ( app_deleted ) ");
+ $r4 = q("alter table app add index ( app_system ) ");
+ }
+
+ if($r1 && $r2 && $r3 && $r4)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1168.php b/Zotlabs/Update/_1168.php
new file mode 100644
index 000000000..cf7d2689a
--- /dev/null
+++ b/Zotlabs/Update/_1168.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1168 {
+function run() {
+
+ $r1 = q("alter table obj add obj_quantity int not null default '0' ");
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r2 = q("create index \"obj_quantity_idx\" on obj (\"obj_quantity\") ");
+ }
+ else {
+ $r2 = q("alter table obj add index ( obj_quantity ) ");
+ }
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1169.php b/Zotlabs/Update/_1169.php
new file mode 100644
index 000000000..cfe4dbcd8
--- /dev/null
+++ b/Zotlabs/Update/_1169.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1169 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE `addon` CHANGE `timestamp` `tstamp` numeric( 20 ) UNSIGNED NOT NULL DEFAULT '0' ");
+ $r2 = q("ALTER TABLE `addon` CHANGE `name` `aname` text NOT NULL DEFAULT '' ");
+ $r3 = q("ALTER TABLE `hook` CHANGE `function` `fn` text NOT NULL DEFAULT '' ");
+
+ }
+ else {
+ $r1 = q("ALTER TABLE `addon` CHANGE `timestamp` `tstamp` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0' ");
+ $r2 = q("ALTER TABLE `addon` CHANGE `name` `aname` CHAR(255) NOT NULL DEFAULT '' ");
+ $r3 = q("ALTER TABLE `hook` CHANGE `function` `fn` CHAR(255) NOT NULL DEFAULT '' ");
+ }
+
+ if($r1 && $r2 && $r3)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1170.php b/Zotlabs/Update/_1170.php
new file mode 100644
index 000000000..215aeebc7
--- /dev/null
+++ b/Zotlabs/Update/_1170.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1170 {
+function run() {
+
+ $r1 = q("drop table fcontact");
+ $r2 = q("drop table ffinder");
+ $r3 = q("drop table fserver");
+ $r4 = q("drop table fsuggest");
+ $r5 = q("drop table spam");
+
+ if($r1 && $r2 && $r3 && $r4 && $r5)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1171.php b/Zotlabs/Update/_1171.php
new file mode 100644
index 000000000..5cbf0ca21
--- /dev/null
+++ b/Zotlabs/Update/_1171.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1171 {
+function run() {
+
+ $r1 = q("ALTER TABLE verify CHANGE `type` `vtype` varchar(32) NOT NULL DEFAULT '' ");
+ $r2 = q("ALTER TABLE tokens CHANGE `scope` `auth_scope` varchar(512) NOT NULL DEFAULT '' ");
+ $r3 = q("ALTER TABLE auth_codes CHANGE `scope` `auth_scope` varchar(512) NOT NULL DEFAULT '' ");
+ $r4 = q("ALTER TABLE clients CHANGE `name` `clname` TEXT ");
+ $r5 = q("ALTER TABLE session CHANGE `data` `sess_data` TEXT NOT NULL ");
+ $r6 = q("ALTER TABLE register CHANGE `language` `lang` varchar(16) NOT NULL DEFAULT '' ");
+
+ if($r1 && $r2 && $r3 && $r4 && $r5 && $r6)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1172.php b/Zotlabs/Update/_1172.php
new file mode 100644
index 000000000..117e87fa1
--- /dev/null
+++ b/Zotlabs/Update/_1172.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1172 {
+function run() {
+
+ $r1 = q("ALTER TABLE term CHANGE `type` `ttype` int(3) NOT NULL DEFAULT '0' ");
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r2 = q("ALTER TABLE groups CHANGE `name` `gname` TEXT NOT NULL ");
+ $r3 = q("ALTER TABLE profile CHANGE `name` `fullname` TEXT NOT NULL ");
+ $r4 = q("ALTER TABLE profile CHANGE `with` `partner` TEXT NOT NULL ");
+ $r5 = q("ALTER TABLE profile CHANGE `work` `employment` TEXT NOT NULL ");
+ }
+ else {
+ $r2 = q("ALTER TABLE groups CHANGE `name` `gname` char(255) NOT NULL DEFAULT '' ");
+ $r3 = q("ALTER TABLE profile CHANGE `name` `fullname` char(255) NOT NULL DEFAULT '' ");
+ $r4 = q("ALTER TABLE profile CHANGE `with` `partner` char(255) NOT NULL DEFAULT '' ");
+ $r5 = q("ALTER TABLE profile CHANGE `work` `employment` TEXT NOT NULL ");
+ }
+ if($r1 && $r2 && $r3 && $r4 && $r5)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1173.php b/Zotlabs/Update/_1173.php
new file mode 100644
index 000000000..7c0d76c73
--- /dev/null
+++ b/Zotlabs/Update/_1173.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1173 {
+function run() {
+
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE notify CHANGE `name` `xname` TEXT NOT NULL ");
+ $r2 = q("ALTER TABLE notify CHANGE `date` `created` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ $r3 = q("ALTER TABLE notify CHANGE `type` `ntype` numeric(3) NOT NULL DEFAULT '0' ");
+ }
+ else {
+ $r1 = q("ALTER TABLE notify CHANGE `name` `xname` char(255) NOT NULL DEFAULT '' ");
+ $r2 = q("ALTER TABLE notify CHANGE `date` `created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ $r3 = q("ALTER TABLE notify CHANGE `type` `ntype` smallint(3) NOT NULL DEFAULT '0' ");
+ }
+
+ if($r1 && $r2 && $r3)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1174.php b/Zotlabs/Update/_1174.php
new file mode 100644
index 000000000..0d68b2d65
--- /dev/null
+++ b/Zotlabs/Update/_1174.php
@@ -0,0 +1,32 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1174 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE event CHANGE `type` `etype` varchar(255) NOT NULL DEFAULT '' ");
+ $r2 = q("ALTER TABLE event CHANGE `start` `dtstart` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ $r3 = q("ALTER TABLE event CHANGE `finish` `dtend` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ $r4 = q("ALTER TABLE event CHANGE `ignore` `dismissed` numeric(1) NOT NULL DEFAULT '0' ");
+ $r5 = q("ALTER TABLE attach CHANGE `data` `content` bytea NOT NULL ");
+ $r6 = q("ALTER TABLE photo CHANGE `data` `content` bytea NOT NULL ");
+ }
+ else {
+ $r1 = q("ALTER TABLE event CHANGE `type` `etype` char(255) NOT NULL DEFAULT '' ");
+ $r2 = q("ALTER TABLE event CHANGE `start` `dtstart` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ $r3 = q("ALTER TABLE event CHANGE `finish` `dtend` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ $r4 = q("ALTER TABLE event CHANGE `ignore` `dismissed` tinyint(1) NOT NULL DEFAULT '0' ");
+ $r5 = q("ALTER TABLE attach CHANGE `data` `content` longblob NOT NULL ");
+ $r6 = q("ALTER TABLE photo CHANGE `data` `content` mediumblob NOT NULL ");
+ }
+
+ if($r1 && $r2 && $r3 && $r4 && $r5 && $r6)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1175.php b/Zotlabs/Update/_1175.php
new file mode 100644
index 000000000..188586084
--- /dev/null
+++ b/Zotlabs/Update/_1175.php
@@ -0,0 +1,31 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1175 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE item CHANGE `object` `obj` text NOT NULL");
+ $r2 = q("ALTER TABLE photo CHANGE `size` `filesize` bigint NOT NULL DEFAULT '0' ");
+ $r3 = q("ALTER TABLE photo CHANGE `scale` `imgscale` numeric(3) NOT NULL DEFAULT '0' ");
+ $r4 = q("ALTER TABLE photo CHANGE `type` `mimetype` varchar(128) NOT NULL DEFAULT 'image/jpeg' ");
+
+ }
+ else {
+ $r1 = q("ALTER TABLE item CHANGE `object` `obj` text NOT NULL");
+ $r2 = q("ALTER TABLE photo CHANGE `size` `filesize` int(10) unsigned NOT NULL DEFAULT '0' ");
+ $r3 = q("ALTER TABLE photo CHANGE `scale` `imgscale` tinyint(3) unsigned NOT NULL DEFAULT '0' ");
+ $r4 = q("ALTER TABLE photo CHANGE `type` `mimetype` char(128) NOT NULL DEFAULT 'image/jpeg' ");
+
+ }
+
+ if($r1 && $r2 && $r3 && $r4)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1176.php b/Zotlabs/Update/_1176.php
new file mode 100644
index 000000000..8c02ee436
--- /dev/null
+++ b/Zotlabs/Update/_1176.php
@@ -0,0 +1,19 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1176 {
+function run() {
+
+ $r = q("select * from item_id where true");
+ if($r) {
+ foreach($r as $rr) {
+ \Zotlabs\Lib\IConfig::Set($rr['iid'],'system',$rr['service'],$rr['sid'],true);
+ }
+ }
+ return UPDATE_SUCCESS;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1177.php b/Zotlabs/Update/_1177.php
new file mode 100644
index 000000000..119e48ee8
--- /dev/null
+++ b/Zotlabs/Update/_1177.php
@@ -0,0 +1,66 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1177 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("alter table event add cal_id bigint NOT NULL DEFAULT '0'");
+ $r2 = q("create index \"event_cal_idx\" on event (\"cal_id\") ");
+
+ $r3 = q("CREATE TABLE \"cal\" (
+ \"cal_id\" serial NOT NULL,
+ \"cal_aid\" bigint NOT NULL DEFAULT '0',
+ \"cal_uid\" bigint NOT NULL DEFAULT '0',
+ \"cal_hash\" text NOT NULL,
+ \"cal_name\" text NOT NULL,
+ \"uri\" text NOT NULL,
+ \"logname\" text NOT NULL,
+ \"pass\" text NOT NULL,
+ \"ctag\" text NOT NULL,
+ \"synctoken\" text NOT NULL,
+ \"cal_types\" text NOT NULL,
+ PRIMARY KEY (\"cal_id\") ");
+ $r4 = q("create index \"cal_hash_idx\" on cal (\"cal_hash\") ");
+ $r5 = q("create index \"cal_name_idx\" on cal (\"cal_name\") ");
+ $r6 = q("create index \"cal_types_idx\" on cal (\"cal_types\") ");
+ $r7 = q("create index \"cal_aid_idx\" on cal (\"cal_aid\") ");
+ $r8 = q("create index \"cal_uid_idx\" on cal (\"cal_uid\") ");
+ $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6 && $r7 && $r8;
+ }
+ else {
+ $r1 = q("alter table event add cal_id int(10) unsigned NOT NULL DEFAULT '0',
+ add index ( cal_id ) ");
+
+ $r2 = q("CREATE TABLE IF NOT EXISTS `cal` (
+ `cal_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `cal_aid` int(10) unsigned NOT NULL DEFAULT '0',
+ `cal_uid` int(10) unsigned NOT NULL DEFAULT '0',
+ `cal_hash` varchar(255) NOT NULL DEFAULT '',
+ `cal_name` varchar(255) NOT NULL DEFAULT '',
+ `uri` varchar(255) NOT NULL DEFAULT '',
+ `logname` varchar(255) NOT NULL DEFAULT '',
+ `pass` varchar(255) NOT NULL DEFAULT '',
+ `ctag` varchar(255) NOT NULL DEFAULT '',
+ `synctoken` varchar(255) NOT NULL DEFAULT '',
+ `cal_types` varchar(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (`cal_id`),
+ KEY `cal_aid` (`cal_aid`),
+ KEY `cal_uid` (`cal_uid`),
+ KEY `cal_hash` (`cal_hash`),
+ KEY `cal_name` (`cal_name`),
+ KEY `cal_types` (`cal_types`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ $r = $r1 && $r2;
+ }
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1178.php b/Zotlabs/Update/_1178.php
new file mode 100644
index 000000000..97c42a16d
--- /dev/null
+++ b/Zotlabs/Update/_1178.php
@@ -0,0 +1,42 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1178 {
+function run() {
+
+ $c2 = null;
+
+ $c1 = q("SELECT channel_id, channel_hash from channel where true");
+ if($c1) {
+ $c2 = q("SELECT id, chan from abconfig where true");
+ if($c2) {
+ for($x = 0; $x < count($c2); $x ++) {
+ foreach($c1 as $c) {
+ if($c['channel_hash'] == $c2[$x]['chan']) {
+ $c2[$x]['chan'] = $c['channel_id'];
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ $r1 = q("ALTER TABLE abconfig CHANGE chan chan int(10) unsigned NOT NULL DEFAULT '0' ");
+
+ if($c2) {
+ foreach($c2 as $c) {
+ q("UPDATE abconfig SET chan = %d where id = %d",
+ intval($c['chan']),
+ intval($c['id'])
+ );
+ }
+ }
+
+ if($r1)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1179.php b/Zotlabs/Update/_1179.php
new file mode 100644
index 000000000..44227c8d3
--- /dev/null
+++ b/Zotlabs/Update/_1179.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1179 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("CREATE TABLE atoken (
+ atoken_id serial NOT NULL,
+ atoken_aid bigint NOT NULL DEFAULT 0,
+ atoken_uid bigint NOT NULL DEFAULT 0,
+ atoken_name varchar(255) NOT NULL DEFAULT '',
+ atoken_token varchar(255) NOT NULL DEFAULT '',
+ atoken_expires timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
+ PRIMARY KEY (atoken_id)) ");
+ $r2 = q("create index atoken_aid on atoken (atoken_aid)");
+ $r3 = q("create index atoken_uid on atoken (atoken_uid)");
+ $r4 = q("create index atoken_name on atoken (atoken_name)");
+ $r5 = q("create index atoken_token on atoken (atoken_token)");
+ $r6 = q("create index atoken_expires on atoken (atoken_expires)");
+
+ $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6;
+
+ }
+ else {
+ $r = q("CREATE TABLE IF NOT EXISTS `atoken` (
+ `atoken_id` int(11) NOT NULL AUTO_INCREMENT,
+ `atoken_aid` int(11) NOT NULL DEFAULT 0,
+ `atoken_uid` int(11) NOT NULL DEFAULT 0,
+ `atoken_name` char(255) NOT NULL DEFAULT '',
+ `atoken_token` char(255) NOT NULL DEFAULT '',
+ `atoken_expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
+ PRIMARY KEY (`atoken_id`),
+ KEY `atoken_aid` (`atoken_aid`),
+ KEY `atoken_uid` (`atoken_uid`),
+ KEY `atoken_name` (`atoken_name`),
+ KEY `atoken_token` (`atoken_token`),
+ KEY `atoken_expires` (`atoken_expires`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+ }
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1180.php b/Zotlabs/Update/_1180.php
new file mode 100644
index 000000000..f02f46231
--- /dev/null
+++ b/Zotlabs/Update/_1180.php
@@ -0,0 +1,32 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1180 {
+function run() {
+
+ require_once('include/perm_upgrade.php');
+
+ $r1 = q("select * from channel where true");
+ if($r1) {
+ foreach($r1 as $rr) {
+ perm_limits_upgrade($rr);
+ autoperms_upgrade($rr);
+ }
+ }
+
+ $r2 = q("select * from abook where true");
+ if($r2) {
+ foreach($r2 as $rr) {
+ perm_abook_upgrade($rr);
+ }
+ }
+
+ $r = $r1 && $r2;
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1181.php b/Zotlabs/Update/_1181.php
new file mode 100644
index 000000000..fc2d94b6b
--- /dev/null
+++ b/Zotlabs/Update/_1181.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1181 {
+function run() {
+ if(\Zotlabs\Lib\System::get_server_role() == 'pro') {
+ q("update account set account_level = 5 where true");
+ }
+ return UPDATE_SUCCESS;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1182.php b/Zotlabs/Update/_1182.php
new file mode 100644
index 000000000..d652f432e
--- /dev/null
+++ b/Zotlabs/Update/_1182.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1182 {
+function run() {
+
+ $r1 = q("alter table site add site_version varchar(32) not null default '' ");
+
+ if($r1)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1183.php b/Zotlabs/Update/_1183.php
new file mode 100644
index 000000000..6e9f89271
--- /dev/null
+++ b/Zotlabs/Update/_1183.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1183 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("alter table hook ALTER COLUMN priority TYPE smallint");
+ $r2 = q("alter table hook ALTER COLUMN priority SET NOT NULL");
+ $r3 = q("alter table hook ALTER COLUMN priority SET DEFAULT '0'");
+ $r1 = $r1 && $r2 && $r3;
+ }
+ else {
+ $r1 = q("alter table hook CHANGE priority priority smallint NOT NULL DEFAULT '0' ");
+ }
+ $r2 = q("create index priority_idx on hook (priority)");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1184.php b/Zotlabs/Update/_1184.php
new file mode 100644
index 000000000..e8c37888c
--- /dev/null
+++ b/Zotlabs/Update/_1184.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1184 {
+function run() {
+
+ $r1 = q("alter table site add site_crypto text not null default '' ");
+
+ if($r1)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1185.php b/Zotlabs/Update/_1185.php
new file mode 100644
index 000000000..c7f4f1bd4
--- /dev/null
+++ b/Zotlabs/Update/_1185.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1185 {
+function run() {
+
+ $r1 = q("alter table app add app_plugin text not null default '' ");
+
+ if($r1)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1186.php b/Zotlabs/Update/_1186.php
new file mode 100644
index 000000000..a9c4f0e36
--- /dev/null
+++ b/Zotlabs/Update/_1186.php
@@ -0,0 +1,18 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1186 {
+function run() {
+
+ $r1 = q("alter table profile add profile_vcard text not null");
+
+ if($r1)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1187.php b/Zotlabs/Update/_1187.php
new file mode 100644
index 000000000..0fce5aa05
--- /dev/null
+++ b/Zotlabs/Update/_1187.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1187 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("alter table outq add outq_scheduled timestamp not null default '0001-01-01 00:00:00' ");
+ }
+ else {
+ $r1 = q("alter table outq add outq_scheduled datetime not null default '0001-01-01 00:00:00' ");
+ }
+ $r2 = q("create index outq_scheduled_idx on outq (outq_scheduled)");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1188.php b/Zotlabs/Update/_1188.php
new file mode 100644
index 000000000..eb0335aab
--- /dev/null
+++ b/Zotlabs/Update/_1188.php
@@ -0,0 +1,18 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1188 {
+function run() {
+
+ $r1 = q("alter table channel add channel_password varchar(255) not null default '' ");
+ $r2 = q("alter table channel add channel_salt varchar(255) not null default '' ");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1189.php b/Zotlabs/Update/_1189.php
new file mode 100644
index 000000000..5cd180fbd
--- /dev/null
+++ b/Zotlabs/Update/_1189.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1189 {
+function run() {
+
+ $r1 = q("alter table mail add mail_mimetype varchar(64) not null default 'text/bbcode' ");
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r2 = q("alter table mail add mail_raw smallint not null default 0 ");
+ }
+ else {
+ $r2 = q("alter table mail add mail_raw tinyint(4) not null default 0 ");
+ }
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1190.php b/Zotlabs/Update/_1190.php
new file mode 100644
index 000000000..9321b82b8
--- /dev/null
+++ b/Zotlabs/Update/_1190.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1190 {
+function run() {
+ $r1 = q("alter table abook add abook_not_here smallint not null default 0 ");
+
+ $r2 = q("create index abook_not_here on abook (abook_not_here)");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1191.php b/Zotlabs/Update/_1191.php
new file mode 100644
index 000000000..015b9a2ca
--- /dev/null
+++ b/Zotlabs/Update/_1191.php
@@ -0,0 +1,425 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1191 {
+function run() {
+
+ $r = q("SELECT 1 FROM principals LIMIT 1");
+
+ if($r !== false) {
+ return UPDATE_SUCCESS;
+ }
+ else {
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("CREATE TABLE addressbooks (
+ id SERIAL NOT NULL,
+ principaluri VARCHAR(255),
+ displayname VARCHAR(255),
+ uri VARCHAR(200),
+ description TEXT,
+ synctoken INTEGER NOT NULL DEFAULT 1
+ );"
+ );
+
+ $r2 = q("ALTER TABLE ONLY addressbooks ADD CONSTRAINT addressbooks_pkey PRIMARY KEY (id);");
+
+ $r3 = q("CREATE UNIQUE INDEX addressbooks_ukey ON addressbooks USING btree (principaluri, uri);");
+
+ $r4 = q("CREATE TABLE cards (
+ id SERIAL NOT NULL,
+ addressbookid INTEGER NOT NULL,
+ carddata BYTEA,
+ uri VARCHAR(200),
+ lastmodified INTEGER,
+ etag VARCHAR(32),
+ size INTEGER NOT NULL
+ );"
+ );
+
+ $r5 = q("ALTER TABLE ONLY cards ADD CONSTRAINT cards_pkey PRIMARY KEY (id);");
+
+ $r6 = q("CREATE UNIQUE INDEX cards_ukey ON cards USING btree (addressbookid, uri);");
+
+ $r7 = q("CREATE TABLE addressbookchanges (
+ id SERIAL NOT NULL,
+ uri VARCHAR(200) NOT NULL,
+ synctoken INTEGER NOT NULL,
+ addressbookid INTEGER NOT NULL,
+ operation SMALLINT NOT NULL
+ );"
+ );
+
+ $r8 = q("ALTER TABLE ONLY addressbookchanges ADD CONSTRAINT addressbookchanges_pkey PRIMARY KEY (id);");
+
+ $r9 = q("CREATE INDEX addressbookchanges_addressbookid_synctoken_ix ON addressbookchanges USING btree (addressbookid, synctoken);");
+
+ $r10 = q("CREATE TABLE calendarobjects (
+ id SERIAL NOT NULL,
+ calendardata BYTEA,
+ uri VARCHAR(200),
+ calendarid INTEGER NOT NULL,
+ lastmodified INTEGER,
+ etag VARCHAR(32),
+ size INTEGER NOT NULL,
+ componenttype VARCHAR(8),
+ firstoccurence INTEGER,
+ lastoccurence INTEGER,
+ uid VARCHAR(200)
+ );"
+ );
+
+ $r11 = q("ALTER TABLE ONLY calendarobjects ADD CONSTRAINT calendarobjects_pkey PRIMARY KEY (id);");
+
+ $r12 = q("CREATE UNIQUE INDEX calendarobjects_ukey ON calendarobjects USING btree (calendarid, uri);");
+
+ $r13 = q("CREATE TABLE calendars (
+ id SERIAL NOT NULL,
+ synctoken INTEGER NOT NULL DEFAULT 1,
+ components VARCHAR(21)
+ );"
+ );
+
+ $r14 = q("ALTER TABLE ONLY calendars ADD CONSTRAINT calendars_pkey PRIMARY KEY (id);");
+
+ $r15 = q("CREATE TABLE calendarinstances (
+ id SERIAL NOT NULL,
+ calendarid INTEGER NOT NULL,
+ principaluri VARCHAR(100),
+ access SMALLINT NOT NULL DEFAULT '1', -- '1 = owner, 2 = read, 3 = readwrite'
+ displayname VARCHAR(100),
+ uri VARCHAR(200),
+ description TEXT,
+ calendarorder INTEGER NOT NULL DEFAULT 0,
+ calendarcolor VARCHAR(10),
+ timezone TEXT,
+ transparent SMALLINT NOT NULL DEFAULT '0',
+ share_href VARCHAR(100),
+ share_displayname VARCHAR(100),
+ share_invitestatus SMALLINT NOT NULL DEFAULT '2' -- '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid'
+ );"
+ );
+
+ $r16 = q("ALTER TABLE ONLY calendarinstances ADD CONSTRAINT calendarinstances_pkey PRIMARY KEY (id);");
+
+ $r17 = q("CREATE UNIQUE INDEX calendarinstances_principaluri_uri ON calendarinstances USING btree (principaluri, uri);");
+
+ $r18 = q("CREATE UNIQUE INDEX calendarinstances_principaluri_calendarid ON calendarinstances USING btree (principaluri, calendarid);");
+
+ $r19 = q("CREATE UNIQUE INDEX calendarinstances_principaluri_share_href ON calendarinstances USING btree (principaluri, share_href);");
+
+ $r20 = q("CREATE TABLE calendarsubscriptions (
+ id SERIAL NOT NULL,
+ uri VARCHAR(200) NOT NULL,
+ principaluri VARCHAR(100) NOT NULL,
+ source TEXT,
+ displayname VARCHAR(100),
+ refreshrate VARCHAR(10),
+ calendarorder INTEGER NOT NULL DEFAULT 0,
+ calendarcolor VARCHAR(10),
+ striptodos SMALLINT NULL,
+ stripalarms SMALLINT NULL,
+ stripattachments SMALLINT NULL,
+ lastmodified INTEGER
+ );"
+ );
+
+ $r21 = q("ALTER TABLE ONLY calendarsubscriptions ADD CONSTRAINT calendarsubscriptions_pkey PRIMARY KEY (id);");
+
+ $r22 = q("CREATE UNIQUE INDEX calendarsubscriptions_ukey ON calendarsubscriptions USING btree (principaluri, uri);");
+
+ $r23 = q("CREATE TABLE calendarchanges (
+ id SERIAL NOT NULL,
+ uri VARCHAR(200) NOT NULL,
+ synctoken INTEGER NOT NULL,
+ calendarid INTEGER NOT NULL,
+ operation SMALLINT NOT NULL DEFAULT 0
+ );"
+ );
+
+ $r24 = q("ALTER TABLE ONLY calendarchanges ADD CONSTRAINT calendarchanges_pkey PRIMARY KEY (id);");
+
+ $r25 = q("CREATE INDEX calendarchanges_calendarid_synctoken_ix ON calendarchanges USING btree (calendarid, synctoken);");
+
+ $r26 = q("CREATE TABLE schedulingobjects (
+ id SERIAL NOT NULL,
+ principaluri VARCHAR(255),
+ calendardata BYTEA,
+ uri VARCHAR(200),
+ lastmodified INTEGER,
+ etag VARCHAR(32),
+ size INTEGER NOT NULL
+ );"
+ );
+
+ $r27 = q("CREATE TABLE locks (
+ id SERIAL NOT NULL,
+ owner VARCHAR(100),
+ timeout INTEGER,
+ created INTEGER,
+ token VARCHAR(100),
+ scope SMALLINT,
+ depth SMALLINT,
+ uri TEXT
+ );"
+ );
+
+ $r28 = q("ALTER TABLE ONLY locks ADD CONSTRAINT locks_pkey PRIMARY KEY (id);");
+
+ $r29 = q("CREATE INDEX locks_token_ix ON locks USING btree (token);");
+
+ $r30 = q("CREATE INDEX locks_uri_ix ON locks USING btree (uri);");
+
+ $r31 = q("CREATE TABLE principals (
+ id SERIAL NOT NULL,
+ uri VARCHAR(200) NOT NULL,
+ email VARCHAR(80),
+ displayname VARCHAR(80)
+ );"
+ );
+
+ $r32 = q("ALTER TABLE ONLY principals ADD CONSTRAINT principals_pkey PRIMARY KEY (id);");
+
+ $r33 = q("CREATE UNIQUE INDEX principals_ukey ON principals USING btree (uri);");
+
+ $r34 = q("CREATE TABLE groupmembers (
+ id SERIAL NOT NULL,
+ principal_id INTEGER NOT NULL,
+ member_id INTEGER NOT NULL
+ );"
+ );
+
+ $r35 = q("ALTER TABLE ONLY groupmembers ADD CONSTRAINT groupmembers_pkey PRIMARY KEY (id);");
+
+ $r36 = q("CREATE UNIQUE INDEX groupmembers_ukey ON groupmembers USING btree (principal_id, member_id);");
+
+ $r37 = q("CREATE TABLE propertystorage (
+ id SERIAL NOT NULL,
+ path VARCHAR(1024) NOT NULL,
+ name VARCHAR(100) NOT NULL,
+ valuetype INT,
+ value BYTEA
+ );"
+ );
+
+ $r38 = q("ALTER TABLE ONLY propertystorage ADD CONSTRAINT propertystorage_pkey PRIMARY KEY (id);");
+
+ $r39 = q("CREATE UNIQUE INDEX propertystorage_ukey ON propertystorage (path, name);");
+
+ $r40 = q("CREATE TABLE users (
+ id SERIAL NOT NULL,
+ username VARCHAR(50),
+ digesta1 VARCHAR(32)
+ );"
+ );
+
+ $r41 = q("ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY KEY (id);");
+
+ $r42 = q("CREATE UNIQUE INDEX users_ukey ON users USING btree (username);");
+
+ if(
+ $r1 && $r2 && $r3 && $r4 && $r5 && $r6 && $r7 && $r8 && $r9 && $r10
+ && $r11 && $r12 && $r13 && $r14 && $r15 && $r16 && $r17 && $r18 && $r19 && $r20
+ && $r21 && $r22 && $r23 && $r24 && $r25 && $r26 && $r27 && $r28 && $r29 && $r30
+ && $r31 && $r32 && $r33 && $r34 && $r35 && $r36 && $r37 && $r38 && $r39 && $r40
+ && $r41 && $r42
+ )
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+ }
+ else {
+ $r1 = q("CREATE TABLE if not exists addressbooks (
+ id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ principaluri VARBINARY(255),
+ displayname VARCHAR(255),
+ uri VARBINARY(200),
+ description TEXT,
+ synctoken INT(11) UNSIGNED NOT NULL DEFAULT '1',
+ UNIQUE(principaluri(100), uri(100))
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ $r2 = q("CREATE TABLE if not exists cards (
+ id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ addressbookid INT(11) UNSIGNED NOT NULL,
+ carddata MEDIUMBLOB,
+ uri VARBINARY(200),
+ lastmodified INT(11) UNSIGNED,
+ etag VARBINARY(32),
+ size INT(11) UNSIGNED NOT NULL
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ $r3 = q("CREATE TABLE if not exists addressbookchanges (
+ id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ uri VARBINARY(200) NOT NULL,
+ synctoken INT(11) UNSIGNED NOT NULL,
+ addressbookid INT(11) UNSIGNED NOT NULL,
+ operation TINYINT(1) NOT NULL,
+ INDEX addressbookid_synctoken (addressbookid, synctoken)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ $r4 = q("CREATE TABLE if not exists calendarobjects (
+ id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ calendardata MEDIUMBLOB,
+ uri VARBINARY(200),
+ calendarid INTEGER UNSIGNED NOT NULL,
+ lastmodified INT(11) UNSIGNED,
+ etag VARBINARY(32),
+ size INT(11) UNSIGNED NOT NULL,
+ componenttype VARBINARY(8),
+ firstoccurence INT(11) UNSIGNED,
+ lastoccurence INT(11) UNSIGNED,
+ uid VARBINARY(200),
+ UNIQUE(calendarid, uri),
+ INDEX calendarid_time (calendarid, firstoccurence)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ $r5 = q("CREATE TABLE if not exists calendars (
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ synctoken INTEGER UNSIGNED NOT NULL DEFAULT '1',
+ components VARBINARY(21)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ $r6 = q("CREATE TABLE if not exists calendarinstances (
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ calendarid INTEGER UNSIGNED NOT NULL,
+ principaluri VARBINARY(100),
+ access TINYINT(1) NOT NULL DEFAULT '1' COMMENT '1 = owner, 2 = read, 3 = readwrite',
+ displayname VARCHAR(100),
+ uri VARBINARY(200),
+ description TEXT,
+ calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ calendarcolor VARBINARY(10),
+ timezone TEXT,
+ transparent TINYINT(1) NOT NULL DEFAULT '0',
+ share_href VARBINARY(100),
+ share_displayname VARCHAR(100),
+ share_invitestatus TINYINT(1) NOT NULL DEFAULT '2' COMMENT '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid',
+ UNIQUE(principaluri, uri),
+ UNIQUE(calendarid, principaluri),
+ UNIQUE(calendarid, share_href)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ $r7 = q("CREATE TABLE if not exists calendarchanges (
+ id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ uri VARBINARY(200) NOT NULL,
+ synctoken INT(11) UNSIGNED NOT NULL,
+ calendarid INT(11) UNSIGNED NOT NULL,
+ operation TINYINT(1) NOT NULL,
+ INDEX calendarid_synctoken (calendarid, synctoken)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ $r8 = q("CREATE TABLE if not exists calendarsubscriptions (
+ id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ uri VARBINARY(200) NOT NULL,
+ principaluri VARBINARY(100) NOT NULL,
+ source TEXT,
+ displayname VARCHAR(100),
+ refreshrate VARCHAR(10),
+ calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ calendarcolor VARBINARY(10),
+ striptodos TINYINT(1) NULL,
+ stripalarms TINYINT(1) NULL,
+ stripattachments TINYINT(1) NULL,
+ lastmodified INT(11) UNSIGNED,
+ UNIQUE(principaluri, uri)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ $r9 = q("CREATE TABLE if not exists schedulingobjects (
+ id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ principaluri VARBINARY(255),
+ calendardata MEDIUMBLOB,
+ uri VARBINARY(200),
+ lastmodified INT(11) UNSIGNED,
+ etag VARBINARY(32),
+ size INT(11) UNSIGNED NOT NULL
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ $r10 = q("CREATE TABLE if not exists locks (
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ owner VARCHAR(100),
+ timeout INTEGER UNSIGNED,
+ created INTEGER,
+ token VARBINARY(100),
+ scope TINYINT,
+ depth TINYINT,
+ uri VARBINARY(1000),
+ INDEX(token),
+ INDEX(uri(100))
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ $r11 = q("CREATE TABLE if not exists principals (
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ uri VARBINARY(200) NOT NULL,
+ email VARBINARY(80),
+ displayname VARCHAR(80),
+ UNIQUE(uri)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ $r12 = q("CREATE TABLE if not exists groupmembers (
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ principal_id INTEGER UNSIGNED NOT NULL,
+ member_id INTEGER UNSIGNED NOT NULL,
+ UNIQUE(principal_id, member_id)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ $r13 = q("CREATE TABLE if not exists propertystorage (
+ id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ path VARBINARY(1024) NOT NULL,
+ name VARBINARY(100) NOT NULL,
+ valuetype INT UNSIGNED,
+ value MEDIUMBLOB
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ $r14 = q("CREATE UNIQUE INDEX path_property ON propertystorage (path(600), name(100));");
+
+ $r15 = q("CREATE TABLE if not exists users (
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ username VARBINARY(50),
+ digesta1 VARBINARY(32),
+ UNIQUE(username)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ $r16 = q("CREATE TABLE if not exists calendarinstances (
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ calendarid INTEGER UNSIGNED NOT NULL,
+ principaluri VARBINARY(100),
+ access TINYINT(1) NOT NULL DEFAULT '1' COMMENT '1 = owner, 2 = read, 3 = readwrite',
+ displayname VARCHAR(100),
+ uri VARBINARY(200),
+ description TEXT,
+ calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ calendarcolor VARBINARY(10),
+ timezone TEXT,
+ transparent TINYINT(1) NOT NULL DEFAULT '0',
+ share_href VARBINARY(100),
+ share_displayname VARCHAR(100),
+ share_invitestatus TINYINT(1) NOT NULL DEFAULT '2' COMMENT '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid',
+ UNIQUE(principaluri, uri),
+ UNIQUE(calendarid, principaluri),
+ UNIQUE(calendarid, share_href)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
+ );
+
+ if($r1 && $r2 && $r3 && $r4 && $r5 && $r6 && $r7 && $r8 && $r9 && $r10 && $r11 && $r12 && $r13 && $r14 && $r15 && $r16)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+ }
+ }
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1192.php b/Zotlabs/Update/_1192.php
new file mode 100644
index 000000000..f2445da05
--- /dev/null
+++ b/Zotlabs/Update/_1192.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1192 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("CREATE INDEX item_obj_type ON item (obj_type)");
+ }
+ else {
+ $r1 = q("ALTER TABLE item ADD INDEX (obj_type)");
+ }
+
+ if($r1)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1193.php b/Zotlabs/Update/_1193.php
new file mode 100644
index 000000000..267e16da1
--- /dev/null
+++ b/Zotlabs/Update/_1193.php
@@ -0,0 +1,22 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1193 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("CREATE INDEX item_uid_unseen ON item (uid, item_unseen)");
+ }
+ else {
+ $r1 = q("ALTER TABLE item ADD INDEX uid_item_unseen (uid, item_unseen)");
+ }
+
+ if($r1)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1194.php b/Zotlabs/Update/_1194.php
new file mode 100644
index 000000000..916723eaa
--- /dev/null
+++ b/Zotlabs/Update/_1194.php
@@ -0,0 +1,22 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1194 {
+function run() {
+ $r = q("select id, resource_id from item where resource_type = 'nwiki'");
+ if($r) {
+ foreach($r as $rv) {
+ $mimetype = get_iconfig($rv['id'],'wiki','mimeType');
+ q("update item set mimetype = '%s' where resource_type = 'nwikipage' and resource_id = '%s'",
+ dbesc($mimetype),
+ dbesc($rv['resource_id'])
+ );
+ }
+ }
+
+ return UPDATE_SUCCESS;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1195.php b/Zotlabs/Update/_1195.php
new file mode 100644
index 000000000..248e9a34a
--- /dev/null
+++ b/Zotlabs/Update/_1195.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1195 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("CREATE INDEX item_resource_id ON item (resource_id)");
+ }
+ else {
+ $r1 = q("ALTER TABLE item ADD INDEX (resource_id)");
+ }
+
+ if($r1)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1196.php b/Zotlabs/Update/_1196.php
new file mode 100644
index 000000000..720252bf8
--- /dev/null
+++ b/Zotlabs/Update/_1196.php
@@ -0,0 +1,45 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1196 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("CREATE TABLE \"pchan\" (
+ \"pchan_id\" serial NOT NULL,
+ \"pchan_guid\" text NOT NULL,
+ \"pchan_hash\" text NOT NULL,
+ \"pchan_pubkey\" text NOT NULL,
+ \"pchan_prvkey\" text NOT NULL,
+ PRIMARY KEY (\"pchan_id\")
+)");
+
+ $r2 = q("create index \"pchan_guid\" on pchan (\"pchan_guid\")");
+ $r3 = q("create index \"pchan_hash\" on pchan (\"pchan_hash\")");
+
+ if($r1 && $r2 && $r3) {
+ return UPDATE_SUCCESS;
+ }
+ }
+ else {
+ $r1 = q("CREATE TABLE IF NOT EXISTS pchan (
+ pchan_id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
+ pchan_guid char(191) NOT NULL DEFAULT '',
+ pchan_hash char(191) NOT NULL DEFAULT '',
+ pchan_pubkey text NOT NULL,
+ pchan_prvkey text NOT NULL,
+ PRIMARY KEY (pchan_id),
+ KEY pchan_guid (pchan_guid),
+ KEY pchan_hash (pchan_hash)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");
+ if($r1) {
+ return UPDATE_SUCCESS;
+ }
+ }
+
+ return UPDATE_FAILED;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1197.php b/Zotlabs/Update/_1197.php
new file mode 100644
index 000000000..72e4ca59d
--- /dev/null
+++ b/Zotlabs/Update/_1197.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1197 {
+function run() {
+
+ $r = q("select diaspora_meta from item where true limit 1");
+ if($r) {
+ $r = q("ALTER TABLE item DROP diaspora_meta");
+ }
+
+ return UPDATE_SUCCESS;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1198.php b/Zotlabs/Update/_1198.php
new file mode 100644
index 000000000..d188c94f6
--- /dev/null
+++ b/Zotlabs/Update/_1198.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1198 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
+ $r = q("ALTER TABLE item
+ DROP INDEX item_blocked,
+ DROP INDEX item_unpublished,
+ DROP INDEX item_deleted,
+ DROP INDEX item_delayed,
+ DROP INDEX item_hidden,
+ DROP INDEX item_pending_remove,
+ DROP INDEX item_type
+ ");
+ }
+
+ return UPDATE_SUCCESS;
+}
+
+
+}
diff --git a/Zotlabs/Update/_1199.php b/Zotlabs/Update/_1199.php
new file mode 100644
index 000000000..7ab03b073
--- /dev/null
+++ b/Zotlabs/Update/_1199.php
@@ -0,0 +1,19 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1199 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
+ $r = q("ALTER TABLE item
+ DROP INDEX uid,
+ ADD INDEX (item_type)
+ ");
+ }
+
+ return UPDATE_SUCCESS;
+}
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Update/_1200.php b/Zotlabs/Update/_1200.php
new file mode 100644
index 000000000..9f7bfb152
--- /dev/null
+++ b/Zotlabs/Update/_1200.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1200 {
+function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
+ $r = q("ALTER TABLE item
+ DROP INDEX item_type,
+ ADD INDEX uid_item_type (uid, item_type)
+ ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+ }
+ else {
+ return UPDATE_SUCCESS;
+ }
+
+}
+
+}
diff --git a/Zotlabs/Update/_1201.php b/Zotlabs/Update/_1201.php
new file mode 100644
index 000000000..920a7401e
--- /dev/null
+++ b/Zotlabs/Update/_1201.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1201 {
+
+ function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
+ $r = q("ALTER TABLE item
+ DROP INDEX item_thread_top,
+ ADD INDEX uid_item_thread_top (uid, item_thread_top),
+ ADD INDEX uid_item_blocked (uid, item_blocked),
+ ADD INDEX item_deleted_pending_remove_changed (item_deleted, item_pending_remove, changed)
+ ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+ }
+ else {
+ return UPDATE_SUCCESS;
+ }
+
+ }
+
+}
diff --git a/Zotlabs/Update/_1202.php b/Zotlabs/Update/_1202.php
new file mode 100644
index 000000000..c9ccd157b
--- /dev/null
+++ b/Zotlabs/Update/_1202.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1202 {
+
+ function run() {
+
+ // empty update in order to make the DB_UPDATE_VERSION equal to the current maximum update function
+ // rather than being one greater than the last known update
+
+ return UPDATE_SUCCESS;
+
+ }
+}
diff --git a/Zotlabs/Update/_1203.php b/Zotlabs/Update/_1203.php
new file mode 100644
index 000000000..2968d209d
--- /dev/null
+++ b/Zotlabs/Update/_1203.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1203 {
+
+ function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
+ $r = q("ALTER TABLE item
+ DROP INDEX item_wall,
+ DROP INDEX item_starred,
+ DROP INDEX item_retained,
+ ADD INDEX uid_item_wall (uid, item_wall),
+ ADD INDEX uid_item_starred (uid, item_starred),
+ ADD INDEX uid_item_retained (uid, item_retained)
+ ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+ }
+ else {
+ return UPDATE_SUCCESS;
+ }
+
+ }
+
+}
diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php
index 63033ce5e..a27edb73d 100644
--- a/Zotlabs/Web/HTTPSig.php
+++ b/Zotlabs/Web/HTTPSig.php
@@ -137,7 +137,22 @@ class HTTPSig {
}
}
- logger('Content_Valid: ' . $result['content_valid']);
+
+ if(in_array('x-zot-digest',$signed_headers)) {
+ $result['content_signed'] = true;
+ $digest = explode('=', $headers['x-zot-digest']);
+ if($digest[0] === 'SHA-256')
+ $hashalg = 'sha256';
+ if($digest[0] === 'SHA-512')
+ $hashalg = 'sha512';
+
+ // The explode operation will have stripped the '=' padding, so compare against unpadded base64
+ if(rtrim(base64_encode(hash($hashalg,$_POST['data'],true)),'=') === $digest[1]) {
+ $result['content_valid'] = true;
+ }
+ }
+
+ logger('Content_Valid: ' . (($result['content_valid']) ? 'true' : 'false'));
return $result;
@@ -194,8 +209,8 @@ class HTTPSig {
. '",headers="' . $x['headers'] . '",signature="' . $x['signature'] . '"';
if($crypt_key) {
- $x = crypto_encapsulate($headerval,$crypt_key,$crypt_alg);
- $headerval = 'iv="' . $x['iv'] . '",key="' . $x['key'] . '",alg="' . $x['alg'] . '",data="' . $x['data'];
+ $x = crypto_encapsulate($headerval,$crypt_key,$crypt_algo);
+ $headerval = 'iv="' . $x['iv'] . '",key="' . $x['key'] . '",alg="' . $x['alg'] . '",data="' . $x['data'] . '"';
}
if($auth) {
diff --git a/Zotlabs/Widget/Forums.php b/Zotlabs/Widget/Forums.php
index 44d95012f..f65a639ff 100644
--- a/Zotlabs/Widget/Forums.php
+++ b/Zotlabs/Widget/Forums.php
@@ -64,7 +64,8 @@ class Forums {
// There also should be a way to update this via ajax.
for($x = 0; $x < count($r1); $x ++) {
- $r = q("select sum(item_unseen) as unseen from item where owner_xchan = '%s' and uid = %d and item_unseen = 1 $perms_sql ",
+ $r = q("select sum(item_unseen) as unseen from item
+ where uid = %d and owner_xchan = '%s' and item_unseen = 1 $perms_sql ",
dbesc($r1[$x]['xchan_hash']),
intval(local_channel())
);
diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php
index 322a7b60a..d51cb0113 100644
--- a/Zotlabs/Widget/Notifications.php
+++ b/Zotlabs/Widget/Notifications.php
@@ -67,7 +67,7 @@ class Notifications {
'label' => t('New Events'),
'title' => t('New Events Notifications'),
'viewall' => [
- 'url' => 'mail/combined',
+ 'url' => 'events',
'label' => t('View events')
],
'markall' => [
diff --git a/app/pubstream.apd b/app/pubstream.apd
index ebfcf38b0..ce9997126 100644
--- a/app/pubstream.apd
+++ b/app/pubstream.apd
@@ -1,6 +1,6 @@
-version: 2
+version: 2.2
url: $baseurl/pubstream
-requires: config:disable_discover_tab=0
+requires: public_stream
name: Public Stream
photo: icon:globe
-categories: Social
+categories: Social, nav_featured_app
diff --git a/boot.php b/boot.php
index 57d1d18f9..307d0c888 100755
--- a/boot.php
+++ b/boot.php
@@ -38,7 +38,6 @@ require_once('include/datetime.php');
require_once('include/language.php');
require_once('include/nav.php');
require_once('include/permissions.php');
-require_once('library/Mobile_Detect/Mobile_Detect.php');
require_once('include/features.php');
require_once('include/taxonomy.php');
require_once('include/channel.php');
@@ -51,10 +50,10 @@ require_once('include/attach.php');
require_once('include/bbcode.php');
define ( 'PLATFORM_NAME', 'hubzilla' );
-define ( 'STD_VERSION', '3.1.5' );
+define ( 'STD_VERSION', '3.1.12' );
define ( 'ZOT_REVISION', '1.3' );
-define ( 'DB_UPDATE_VERSION', 1198 );
+define ( 'DB_UPDATE_VERSION', 1203 );
define ( 'PROJECT_BASE', __DIR__ );
@@ -662,13 +661,6 @@ function sys_boot() {
}
-/**
- * @brief Reverse the effect of magic_quotes_gpc if it is enabled.
- *
- * Please disable magic_quotes_gpc so we don't have to do this.
- * See http://php.net/manual/en/security.magicquotes.disabling.php
- *
- */
function startup() {
error_reporting(E_ERROR | E_WARNING | E_PARSE);
@@ -685,22 +677,6 @@ function startup() {
// Disable transparent Session ID support
@ini_set('session.use_trans_sid', 0);
}
-
- if (get_magic_quotes_gpc()) {
- $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
- while (list($key, $val) = each($process)) {
- foreach ($val as $k => $v) {
- unset($process[$key][$k]);
- if (is_array($v)) {
- $process[$key][stripslashes($k)] = $v;
- $process[] = &$process[$key][stripslashes($k)];
- } else {
- $process[$key][stripslashes($k)] = stripslashes($v);
- }
- }
- }
- unset($process);
- }
}
@@ -788,9 +764,7 @@ class App {
public static $theme_info = array();
public static $is_sys = false;
public static $nav_sel;
- public static $is_mobile = false;
- public static $is_tablet = false;
- public static $comanche;
+ public static $comanche;
public static $channel_links;
@@ -961,14 +935,6 @@ class App {
self::$pager['total'] = 0;
/*
- * Detect mobile devices
- */
-
- $mobile_detect = new Mobile_Detect();
- self::$is_mobile = $mobile_detect->isMobile();
- self::$is_tablet = $mobile_detect->isTablet();
-
- /*
* register template engines
*/
@@ -1450,58 +1416,10 @@ function check_config() {
$x = new \Zotlabs\Lib\DB_Upgrade(DB_UPDATE_VERSION);
- /**
- *
- * Synchronise plugins:
- *
- * App::$config['system']['addon'] contains a comma-separated list of names
- * of plugins/addons which are used on this system.
- * Go through the database list of already installed addons, and if we have
- * an entry, but it isn't in the config list, call the unload procedure
- * and mark it uninstalled in the database (for now we'll remove it).
- * Then go through the config list and if we have a plugin that isn't installed,
- * call the install procedure and add it to the database.
- *
- */
-
- $r = q("SELECT * FROM addon WHERE installed = 1");
- if($r)
- $installed = $r;
- else
- $installed = array();
-
- $plugins = get_config('system', 'addon');
- $plugins_arr = array();
-
- if($plugins)
- $plugins_arr = explode(',', str_replace(' ', '', $plugins));
-
- App::$plugins = $plugins_arr;
-
- $installed_arr = array();
-
- if(count($installed)) {
- foreach($installed as $i) {
- if(! in_array($i['aname'], $plugins_arr)) {
- unload_plugin($i['aname']);
- }
- else {
- $installed_arr[] = $i['aname'];
- }
- }
- }
-
- if(count($plugins_arr)) {
- foreach($plugins_arr as $p) {
- if(! in_array($p, $installed_arr)) {
- load_plugin($p);
- }
- }
- }
+ plugins_sync();
load_hooks();
-
check_for_new_perms();
check_cron_broken();
@@ -1767,6 +1685,26 @@ function remote_channel() {
return false;
}
+
+function can_view_public_stream() {
+
+ if((observer_prohibited(true))
+ || (! (intval(get_config('system','open_pubstream',1))) && get_observer_hash())) {
+ return false;
+ }
+
+ $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
+ $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
+
+ if(! ($site_firehose || $net_firehose)) {
+ return false;
+ }
+
+ return true;
+
+}
+
+
/**
* @brief Show an error or alert text on next page load.
*
@@ -2246,22 +2184,6 @@ function construct_page() {
}
}
- if(App::$is_mobile || App::$is_tablet) {
- if(isset($_SESSION['show_mobile']) && !$_SESSION['show_mobile']) {
- $link = z_root() . '/toggle_mobile?f=&address=' . curPageURL();
- }
- else {
- $link = z_root() . '/toggle_mobile?f=&off=1&address=' . curPageURL();
- }
- if ((isset($_SESSION) && $_SESSION['mobile_theme'] !='' && $_SESSION['mobile_theme'] !='---' ) ||
- (isset(App::$config['system']['mobile_theme']) && !isset($_SESSION['mobile_theme']))) {
- App::$page['footer'] .= replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array(
- '$toggle_link' => $link,
- '$toggle_text' => t('toggle mobile')
- ));
- }
- }
-
$page = App::$page;
$profile = App::$profile;
diff --git a/include/acl_selectors.php b/include/acl_selectors.php
index 4e203074b..bada3e528 100644
--- a/include/acl_selectors.php
+++ b/include/acl_selectors.php
@@ -5,104 +5,9 @@
* @package acl_selectors
*/
-/**
- * @brief
- *
- * @param string $selname
- * @param string $selclass
- * @param mixed $preselected
- * @param number $size
- * @return string
- */
-function group_select($selname, $selclass, $preselected = false, $size = 4) {
-
- $o = '';
-
- $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\">\r\n";
-
- $r = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
- intval(local_channel())
- );
-
-
- $arr = array('group' => $r, 'entry' => $o);
-
- // e.g. 'network_pre_group_deny', 'profile_pre_group_allow'
-
- call_hooks(App::$module . '_pre_' . $selname, $arr);
-
- if($r) {
- foreach($r as $rr) {
- if((is_array($preselected)) && in_array($rr['id'], $preselected))
- $selected = " selected=\"selected\" ";
- else
- $selected = '';
- $trimmed = mb_substr($rr['gname'],0,12);
-
- $o .= "<option value=\"{$rr['id']}\" $selected title=\"{$rr['name']}\" >$trimmed</option>\r\n";
- }
-
- }
- $o .= "</select>\r\n";
-
- call_hooks(App::$module . '_post_' . $selname, $o);
-
- return $o;
-}
-
-function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false, $tabindex = null) {
-
- $o = '';
-
- // When used for private messages, we limit correspondence to mutual DFRN/Friendica friends and the selector
- // to one recipient. By default our selector allows multiple selects amongst all contacts.
-
- $sql_extra = '';
-
- $tabindex = ($tabindex > 0 ? 'tabindex="$tabindex"' : '');
-
- if($privmail)
- $o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" $tabindex >\r\n";
- else
- $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" $tabindex>\r\n";
-
- $r = q("SELECT abook_id, xchan_name, xchan_url, xchan_photo_s from abook left join xchan on abook_xchan = xchan_hash
- where abook_self = 0 and abook_channel = %d
- $sql_extra
- ORDER BY xchan_name ASC",
- intval(local_channel())
- );
-
-
- $arr = array('contact' => $r, 'entry' => $o);
-
- // e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow'
-
- call_hooks(App::$module . '_pre_' . $selname, $arr);
-
- if($r) {
- foreach($r as $rr) {
- if((is_array($preselected)) && in_array($rr['id'], $preselected))
- $selected = ' selected="selected" ';
- else
- $selected = '';
-
- $trimmed = mb_substr($rr['xchan_name'], 0, 20);
-
- $o .= "<option value=\"{$rr['abook_id']}\" $selected title=\"{$rr['xchan_name']}|{$rr['xchan_url']}\" >$trimmed</option>\r\n";
- }
- }
-
- $o .= "</select>\r\n";
-
- call_hooks(App::$module . '_post_' . $selname, $o);
-
- return $o;
-}
-
function fixacl(&$item) {
- $item = str_replace(array('<', '>'), array('', ''), $item);
+ $item = str_replace( [ '<', '>' ], [ '', '' ], $item);
}
/**
diff --git a/include/bbcode.php b/include/bbcode.php
index 0c85a0a4e..03a46444b 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -438,7 +438,7 @@ function bb_summary($match) {
$rnd3 = mt_rand();
$rnd4 = mt_rand();
- return $match[1] . '<div style="display: block;" id="opendiv-' . $rnd2 . '">' . $match[2] . '</div><div style="display: block;" id="opendiv-' . $rnd3 . '" onclick="openClose(\'opendiv-' . $rnd1 . '\'); openClose(\'opendiv-' . $rnd2 . '\'); openClose(\'opendiv-' . $rnd3 . '\'); openClose(\'opendiv-' . $rnd4 . '\'); return false;" class="fakelink">' . t('View article') . '</div><div style="display: none;" id="opendiv-' . $rnd4 . '" onclick="openClose(\'opendiv-' . $rnd1 . '\'); openClose(\'opendiv-' . $rnd2 . '\'); openClose(\'opendiv-' . $rnd3 . '\'); openClose(\'opendiv-' . $rnd4 . '\'); return false;" class="fakelink">' . t('View summary') . '</div><div id="opendiv-' . $rnd1 . '" style="display: none;">' . $match[3] . '</div>';
+ return $match[1] . '<div style="display: block;" id="opendiv-' . $rnd2 . '">' . $match[2] . '</div><div style="display: block;" id="opendiv-' . $rnd3 . '" onclick="openClose(\'opendiv-' . $rnd1 . '\'); openClose(\'opendiv-' . $rnd2 . '\'); openClose(\'opendiv-' . $rnd3 . '\'); openClose(\'opendiv-' . $rnd4 . '\'); return false;" class="fakelink view-article">' . t('View article') . '</div><div style="display: none;" id="opendiv-' . $rnd4 . '" onclick="openClose(\'opendiv-' . $rnd1 . '\'); openClose(\'opendiv-' . $rnd2 . '\'); openClose(\'opendiv-' . $rnd3 . '\'); openClose(\'opendiv-' . $rnd4 . '\'); return false;" class="fakelink view-summary">' . t('View summary') . '</div><div id="opendiv-' . $rnd1 . '" style="display: none;">' . $match[3] . '</div>';
}
@@ -628,7 +628,7 @@ function bb_code_unprotect_sub($match) {
function bb_code($match) {
if(strpos($match[0], "<br />"))
- return '<code>' . bb_code_protect(trim($match[1])) . '</code>';
+ return '<pre><code>' . bb_code_protect(trim($match[1])) . '</code></pre>';
else
return '<code class="inline-code">' . bb_code_protect(trim($match[1])) . '</code>';
}
@@ -636,15 +636,21 @@ function bb_code($match) {
function bb_code_options($match) {
if(strpos($match[0], "<br />")) {
$class = "";
+ $pre = true;
} else {
$class = "inline-code";
+ $pre = false;
}
if(strpos($match[1], 'nowrap')) {
$style = "overflow-x: auto; white-space: pre;";
} else {
$style = "";
}
- return '<code class="'. $class .'" style="'. $style .'">' . bb_code_protect(trim($match[2])) . '</code>';
+ if($pre) {
+ return '<pre><code class="'. $class .'" style="'. $style .'">' . bb_code_protect(trim($match[2])) . '</code></pre>';
+ } else {
+ return '<code class="'. $class .'" style="'. $style .'">' . bb_code_protect(trim($match[2])) . '</code>';
+ }
}
function bb_highlight($match) {
diff --git a/include/channel.php b/include/channel.php
index b9adc588b..625ce16c8 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -2553,10 +2553,10 @@ function channel_remove($channel_id, $local = true, $unset_session = false) {
q("DELETE FROM profile WHERE uid = %d", intval($channel_id));
q("DELETE FROM src WHERE src_channel_id = %d", intval($channel_id));
- $r = q("select resource_id FROM attach WHERE uid = %d", intval($channel_id));
+ $r = q("select hash FROM attach WHERE uid = %d", intval($channel_id));
if($r) {
foreach($r as $rv) {
- attach_delete($channel_id,$rv['resource_id']);
+ attach_delete($channel_id,$rv['hash']);
}
}
diff --git a/include/conversation.php b/include/conversation.php
index 77694deb3..0bb9c769a 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -974,7 +974,7 @@ function author_is_pmable($xchan, $abook) {
if($x['result'] !== 'unset')
return $x['result'];
- if($xchan['xchan_network'] === 'zot')
+ if($xchan['xchan_network'] === 'zot' && get_observer_hash())
return true;
return false;
diff --git a/include/crypto.php b/include/crypto.php
index b990b18d9..ab33ba096 100644
--- a/include/crypto.php
+++ b/include/crypto.php
@@ -31,19 +31,6 @@ function rsa_verify($data,$sig,$key,$alg = 'sha256') {
return (($verify > 0) ? true : false);
}
-function pkcs5_pad ($text, $blocksize)
-{
- $pad = $blocksize - (strlen($text) % $blocksize);
- return $text . str_repeat(chr($pad), $pad);
-}
-
-function pkcs5_unpad($text)
-{
- $pad = ord($text{strlen($text)-1});
- if ($pad > strlen($text)) return false;
- if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) return false;
- return substr($text, 0, -1 * $pad);
-}
function AES256CBC_encrypt($data,$key,$iv) {
@@ -135,7 +122,18 @@ function other_encapsulate($data,$pubkey,$alg) {
if(! $pubkey)
logger('no key. data: ' . $data);
- $fn = strtoupper($alg) . '_encrypt';
+ $oaep = false;
+
+ if(strpos($alg,'.oaep')) {
+ $oaep = true;
+ $subalg = substr($alg,0,-5);
+ }
+ else {
+ $subalg = $alg;
+ }
+
+
+ $fn = strtoupper($subalg) . '_encrypt';
if(function_exists($fn)) {
// A bit hesitant to use openssl_random_pseudo_bytes() as we know
@@ -153,14 +151,14 @@ function other_encapsulate($data,$pubkey,$alg) {
$iv = openssl_random_pseudo_bytes(256);
$result['data'] = base64url_encode($fn($data,$key,$iv),true);
// log the offending call so we can track it down
- if(! openssl_public_encrypt($key,$k,$pubkey)) {
+ if(! openssl_public_encrypt($key,$k,$pubkey,(($oaep) ? OPENSSL_PKCS1_OAEP_PADDING : OPENSSL_PKCS1_PADDING))) {
$x = debug_backtrace();
logger('RSA failed. ' . print_r($x[0],true));
}
$result['alg'] = $alg;
$result['key'] = base64url_encode($k,true);
- openssl_public_encrypt($iv,$i,$pubkey);
+ openssl_public_encrypt($iv,$i,$pubkey,(($oaep) ? OPENSSL_PKCS1_OAEP_PADDING : OPENSSL_PKCS1_PADDING));
$result['iv'] = base64url_encode($i,true);
return $result;
}
@@ -179,7 +177,7 @@ function crypto_methods() {
// The actual methods are responsible for deriving the actual key/iv from the provided parameters;
// possibly by truncation or segmentation - though many other methods could be used.
- $r = [ 'aes256ctr', 'camellia256cfb', 'cast5cfb', 'aes256cbc', 'aes128cbc', 'cast5cbc' ];
+ $r = [ 'aes256ctr.oaep', 'camellia256cfb.oaep', 'cast5cfb.oaep', 'aes256ctr', 'camellia256cfb', 'cast5cfb', 'aes256cbc', 'aes128cbc', 'cast5cbc' ];
call_hooks('crypto_methods',$r);
return $r;
@@ -220,6 +218,7 @@ function aes_encapsulate($data,$pubkey) {
function crypto_unencapsulate($data,$prvkey) {
if(! $data)
return;
+
$alg = ((array_key_exists('alg',$data)) ? $data['alg'] : 'aes256cbc');
if($alg === 'aes256cbc')
return aes_unencapsulate($data,$prvkey);
@@ -229,10 +228,21 @@ function crypto_unencapsulate($data,$prvkey) {
}
function other_unencapsulate($data,$prvkey,$alg) {
- $fn = strtoupper($alg) . '_decrypt';
+
+ $oaep = false;
+
+ if(strpos($alg,'.oaep')) {
+ $oaep = true;
+ $subalg = substr($alg,0,-5);
+ }
+ else {
+ $subalg = $alg;
+ }
+
+ $fn = strtoupper($subalg) . '_decrypt';
if(function_exists($fn)) {
- openssl_private_decrypt(base64url_decode($data['key']),$k,$prvkey);
- openssl_private_decrypt(base64url_decode($data['iv']),$i,$prvkey);
+ openssl_private_decrypt(base64url_decode($data['key']),$k,$prvkey,(($oaep) ? OPENSSL_PKCS1_OAEP_PADDING : OPENSSL_PKCS1_PADDING));
+ openssl_private_decrypt(base64url_decode($data['iv']),$i,$prvkey,(($oaep) ? OPENSSL_PKCS1_OAEP_PADDING : OPENSSL_PKCS1_PADDING));
return $fn(base64url_decode($data['data']),$k,$i);
}
else {
@@ -282,37 +292,6 @@ function new_keypair($bits) {
}
-function pkcs1to8($oldkey,$len) {
-
- if($len == 4096)
- $c = 'g';
- if($len == 2048)
- $c = 'Q';
-
- if(strstr($oldkey,'BEGIN PUBLIC'))
- return $oldkey;
-
- $oldkey = str_replace('-----BEGIN RSA PUBLIC KEY-----', '', $oldkey);
- $oldkey = trim(str_replace('-----END RSA PUBLIC KEY-----', '', $oldkey));
- $key = 'MIICIjANBgkqhkiG9w0BAQEFAAOCA' . $c . '8A' . str_replace("\n", '', $oldkey);
- $key = "-----BEGIN PUBLIC KEY-----\n" . wordwrap($key, 64, "\n", true) . "\n-----END PUBLIC KEY-----";
- return $key;
-}
-
-function pkcs8to1($oldkey,$len) {
-
- if(strstr($oldkey,'BEGIN RSA'))
- return $oldkey;
-
- $oldkey = str_replace('-----BEGIN PUBLIC KEY-----', '', $oldkey);
- $oldkey = trim(str_replace('-----END PUBLIC KEY-----', '', $oldkey));
- $key = str_replace("\n",'',$oldkey);
- $key = substr($key,32);
- $key = "-----BEGIN RSA PUBLIC KEY-----\n" . wordwrap($key, 64, "\n", true) . "\n-----END RSA PUBLIC KEY-----";
- return $key;
-}
-
-
function DerToPem($Der, $Private=false)
{
//Encode:
diff --git a/include/datetime.php b/include/datetime.php
index 0fcd957be..1e9a1fa51 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -93,16 +93,6 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d
return $d->format($fmt);
}
- // Slight hackish adjustment so that 'zero' datetime actually returns what is intended
- // otherwise we end up with -0001-11-30 ...
- // add 32 days so that we at least get year 00, and then hack around the fact that
- // months and days always start with 1.
-
-// if(substr($s,0,10) == '0000-00-00') {
-// $d = new DateTime($s . ' + 32 days', new DateTimeZone('UTC'));
-// return str_replace('1', '0', $d->format($fmt));
-// }
-
try {
$from_obj = new DateTimeZone($from);
} catch(Exception $e) {
@@ -135,70 +125,20 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d
*/
function dob($dob) {
- list($year, $month, $day) = sscanf($dob, '%4d-%2d-%2d');
- $f = get_config('system', 'birthday_input_format');
- if (! $f)
- $f = 'ymd';
-
if ($dob === '0000-00-00')
$value = '';
else
$value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d'));
- $o = replace_macros(get_markup_template("field_input.tpl"), array('$field' => array(
- 'dob',
- t('Birthday'),
- $value,
- ((intval($value)) ? t('Age: ') . age($value,App::$user['timezone'],App::$user['timezone']) : ''),
- '',
- 'placeholder="' . t('YYYY-MM-DD or MM-DD') .'"'
- )));
-
+ $o = replace_macros(get_markup_template("field_input.tpl"), [
+ '$field' => [ 'dob', t('Birthday'), $value, ((intval($value)) ? t('Age: ') . age($value,App::$user['timezone'],App::$user['timezone']) : ''), '', 'placeholder="' . t('YYYY-MM-DD or MM-DD') .'"' ]
+ ]);
-// if ($dob && $dob != '0000-00-00')
-// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year),'dob');
-// else
-// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),false,'dob');
return $o;
}
/**
- * @brief Returns a date selector.
- *
- * @see datetimesel()
- * @param string $format
- * format string, e.g. 'ymd' or 'mdy'. Not currently supported
- * @param DateTime $min
- * unix timestamp of minimum date
- * @param DateTime $max
- * unix timestap of maximum date
- * @param DateTime $default
- * unix timestamp of default date
- * @param string $id
- * id and name of datetimepicker (defaults to "datetimepicker")
- */
-function datesel($format, $min, $max, $default, $id = 'datepicker') {
- return datetimesel($format, $min, $max, $default, '', $id, true, false, '', '');
-}
-
-/**
- * @brief Returns a time selector.
- *
- * @param string $format
- * format string, e.g. 'ymd' or 'mdy'. Not currently supported
- * @param string $h
- * already selected hour
- * @param string $m
- * already selected minute
- * @param string $id
- * id and name of datetimepicker (defaults to "timepicker")
- */
-function timesel($format, $h, $m, $id='timepicker') {
- return datetimesel($format, new DateTime(), new DateTime(), new DateTime("$h:$m"), '', $id, false, true);
-}
-
-/**
* @brief Returns a datetime selector.
*
* @param string $format
@@ -449,12 +389,7 @@ function cal($y = 0, $m = 0, $links = false, $class='') {
// month table - start at 1 to match human usage.
- $mtab = array(' ',
- 'January','February','March',
- 'April','May','June',
- 'July','August','September',
- 'October','November','December'
- );
+ $mtab = [ ' ', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
@@ -463,7 +398,7 @@ function cal($y = 0, $m = 0, $links = false, $class='') {
if (! $m)
$m = intval($thismonth);
- $dn = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
+ $dn = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ];
$f = get_first_dim($y, $m);
$l = get_dim($y, $m);
$d = 1;
@@ -569,17 +504,17 @@ function update_birthdays() {
if (! perm_is_allowed($rr['abook_channel'], $rr['xchan_hash'], 'send_stream'))
continue;
- $ev = array();
- $ev['uid'] = $rr['abook_channel'];
- $ev['account'] = $rr['abook_account'];
- $ev['event_xchan'] = $rr['xchan_hash'];
- $ev['dtstart'] = datetime_convert('UTC', 'UTC', $rr['abook_dob']);
- $ev['dtend'] = datetime_convert('UTC', 'UTC', $rr['abook_dob'] . ' + 1 day ');
- $ev['adjust'] = intval(feature_enabled($rr['abook_channel'],'smart_birthdays'));
- $ev['summary'] = sprintf( t('%1$s\'s birthday'), $rr['xchan_name']);
- $ev['description'] = sprintf( t('Happy Birthday %1$s'),
- '[zrl=' . $rr['xchan_url'] . ']' . $rr['xchan_name'] . '[/zrl]') ;
- $ev['etype'] = 'birthday';
+ $ev = [
+ 'uid' => $rr['abook_channel'],
+ 'account' => $rr['abook_account'],
+ 'event_xchan' => $rr['xchan_hash'],
+ 'dtstart' => datetime_convert('UTC', 'UTC', $rr['abook_dob']),
+ 'dtend' => datetime_convert('UTC', 'UTC', $rr['abook_dob'] . ' + 1 day '),
+ 'adjust' => intval(feature_enabled($rr['abook_channel'],'smart_birthdays')),
+ 'summary' => sprintf( t('%1$s\'s birthday'), $rr['xchan_name']),
+ 'description' => sprintf( t('Happy Birthday %1$s'), '[zrl=' . $rr['xchan_url'] . ']' . $rr['xchan_name'] . '[/zrl]'),
+ 'etype' => 'birthday',
+ ];
$z = event_store_event($ev);
if ($z) {
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index deec9adfd..b3298b673 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -1,15 +1,20 @@
<?php
+/**
+ * @file dba_driver.php
+ * @brief Some database related functions and database classes.
+ *
+ * This file contains the abstract database driver class dba_driver, the
+ * database class DBA and some functions for working with databases.
+ */
+/**
+ * @brief Database classs with database factory method.
+ *
+ * The factory will return a database driver which is an implementation of the
+ * abstract dba_driver class.
+ */
class DBA {
- /**
- * @file dba_driver.php
- * @brief some database related functions and abstract driver class.
- *
- * This file contains the abstract database driver class dba_driver and some
- * functions for working with databases.
- */
-
static public $dba = null;
static public $dbtype = null;
static public $scheme = 'mysql';
@@ -21,7 +26,6 @@ class DBA {
static public $tquot = "`";
-
/**
* @brief Returns the database driver object.
*
@@ -34,14 +38,11 @@ class DBA {
* @param bool $install Defaults to false
* @return null|dba_driver A database driver object (dba_pdo) or null if no driver found.
*/
-
static public function dba_factory($server,$port,$user,$pass,$db,$dbtype,$install = false) {
self::$dba = null;
-
self::$dbtype = intval($dbtype);
-
if(self::$dbtype == DBTYPE_POSTGRES) {
if(!($port))
$port = 5432;
@@ -50,7 +51,6 @@ class DBA {
self::$utc_now = "now() at time zone 'UTC'";
self::$tquot = '"';
self::$scheme = 'pgsql';
-
}
else {
@@ -66,40 +66,27 @@ class DBA {
require_once('include/dba/dba_pdo.php');
self::$dba = new dba_pdo($server,self::$scheme,$port,$user,$pass,$db,$install);
-
- if(is_object(self::$dba) && self::$dba->connected) {
-
- if(strpbrk($server,':;')) {
- $dsn = $server;
- }
- else {
- $dsn = self::$scheme . ':host=' . $server . (intval($port) ? '' : ';port=' . $port);
- }
- $dsn .= ';dbname=' . $db;
-
-
- self::$dba->pdo_set(array($dsn,$user,$pass));
- }
define('NULL_DATE', self::$null_date);
define('ACTIVE_DBTYPE', self::$dbtype);
define('TQUOT', self::$tquot);
+
return self::$dba;
}
}
/**
- * @brief abstract database driver class.
+ * @brief Abstract database driver class.
*
- * This class gets extended by the real database driver classes, e.g. dba_mysql,
- * dba_mysqli.
+ * This class gets extended by the real database driver class. We used to have
+ * dba_mysql, dba_mysqli or dba_postgres, but we moved to PDO and the only
+ * implemented driver is dba_pdo.
*/
abstract class dba_driver {
// legacy behavior
public $db;
- protected $pdo = array();
public $debug = 0;
public $connected = false;
@@ -111,6 +98,7 @@ abstract class dba_driver {
* This abstract function needs to be implemented in the real driver.
*
* @param string $server DB server name
+ * @param string $scheme DB scheme
* @param string $port DB port
* @param string $user DB username
* @param string $pass DB password
@@ -166,6 +154,7 @@ abstract class dba_driver {
$platform_name = \Zotlabs\Lib\System::get_platform_name();
if(file_exists('install/' . $platform_name . '/' . \DBA::$install_script))
return 'install/' . $platform_name . '/' . \DBA::$install_script;
+
return 'install/' . \DBA::$install_script;
}
@@ -173,7 +162,6 @@ abstract class dba_driver {
return \DBA::$tquot;
}
-
function utcnow() {
return \DBA::$utc_now;
}
@@ -232,19 +220,12 @@ abstract class dba_driver {
return $str;
}
- function pdo_set($x) {
- $this->pdo = $x;
- }
-
- function pdo_get() {
- return $this->pdo;
- }
-
} // end abstract dba_driver class
-
+//
// Procedural functions
+//
function printable($s) {
$s = preg_replace("~([\x01-\x08\x0E-\x0F\x10-\x1F\x7F-\xFF])~",".", $s);
@@ -275,7 +256,7 @@ function dbg($state) {
* wrapping with intval().
*
* @param string $str A string to pass to a DB query
- * @return Return an escaped string of the value to pass to a DB query.
+ * @return string Return an escaped string of the value to pass to a DB query.
*/
function dbesc($str) {
@@ -298,6 +279,7 @@ function dbunescbin($str) {
function dbescdate($date) {
if(is_null_date($date))
return \DBA::$dba->escape(NULL_DATE);
+
return \DBA::$dba->escape($date);
}
@@ -330,17 +312,17 @@ function db_use_index($str) {
*
* printf style arguments %s and %d are replaced with variable arguments, which
* should each be appropriately dbesc() or intval().
+ *
* SELECT queries return an array of results or false if SQL or DB error. Other
* queries return true if the command was successful or false if it wasn't.
*
* Example:
- * $r = q("SELECT * FROM %s WHERE `uid` = %d",
- * 'user', 1);
+ * @code{.php}$r = q("SELECT * FROM %s WHERE `uid` = %d",
+ * 'user', 1);@endcode
*
* @param string $sql The SQL query to execute
* @return bool|array
*/
-
function q($sql) {
$args = func_get_args();
@@ -359,8 +341,8 @@ function q($sql) {
}
/*
- * This will happen occasionally trying to store the
- * session data after abnormal program termination
+ * This will happen occasionally trying to store the
+ * session data after abnormal program termination
*/
db_logger('dba: no database: ' . print_r($args,true),LOGGER_NORMAL,LOG_CRIT);
@@ -389,8 +371,8 @@ function dbq($sql) {
// Caller is responsible for ensuring that any integer arguments to
// dbesc_array are actually integers and not malformed strings containing
-// SQL injection vectors. All integer array elements should be specifically
-// cast to int to avoid trouble.
+// SQL injection vectors. All integer array elements should be specifically
+// cast to int to avoid trouble.
function dbesc_array_cb(&$item, $key) {
if(is_string($item)) {
@@ -423,7 +405,7 @@ function dbesc_array(&$arr) {
function db_getfunc($f) {
$lookup = array(
'rand'=>array(
- DBTYPE_MYSQL=>'RAND()',
+ DBTYPE_MYSQL=>'RAND()',
DBTYPE_POSTGRES=>'RANDOM()'
),
'utc_timestamp'=>array(
diff --git a/include/dba/dba_mysql.php b/include/dba/dba_mysql.php
deleted file mode 100755
index 8b51cf578..000000000
--- a/include/dba/dba_mysql.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-require_once('include/dba/dba_driver.php');
-
-
-class dba_mysql extends dba_driver {
-
- function connect($server, $scheme, $port, $user,$pass,$db) {
- $this->db = mysql_connect($server.":".$port,$user,$pass);
- if($this->db && mysql_select_db($db,$this->db)) {
- $this->connected = true;
- }
- if($this->connected) {
- return true;
- }
- return false;
- }
-
-
- function q($sql) {
- if((! $this->db) || (! $this->connected))
- return false;
-
- $this->error = '';
- $result = @mysql_query($sql,$this->db);
-
-
- if(mysql_errno($this->db))
- $this->error = mysql_error($this->db);
-
- if($result === false || $this->error) {
- logger('dba_mysql: ' . printable($sql) . ' returned false.' . "\n" . $this->error);
- if(file_exists('dbfail.out'))
- file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . ' returned false' . "\n" . $this->error . "\n", FILE_APPEND);
- }
-
- if(($result === true) || ($result === false))
- return $result;
-
- $r = array();
- if(mysql_num_rows($result)) {
- while($x = mysql_fetch_array($result,MYSQL_ASSOC))
- $r[] = $x;
- mysql_free_result($result);
- if($this->debug)
- logger('dba_mysql: ' . printable(print_r($r,true)));
- }
- return $r;
- }
-
- function escape($str) {
- if($this->db && $this->connected) {
- return @mysql_real_escape_string($str,$this->db);
- }
- }
-
- function close() {
- if($this->db)
- mysql_close($this->db);
- $this->connected = false;
- }
-
- function getdriver() {
- return 'mysql';
- }
-
-}
diff --git a/include/dba/dba_mysqli.php b/include/dba/dba_mysqli.php
deleted file mode 100755
index 165c8e969..000000000
--- a/include/dba/dba_mysqli.php
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php /** @file */
-
-require_once('include/dba/dba_driver.php');
-
-class dba_mysqli extends dba_driver {
-
- function connect($server,$scheme,$port,$user,$pass,$db) {
- if($port)
- $this->db = new mysqli($server,$user,$pass,$db, $port);
- else
- $this->db = new mysqli($server,$user,$pass,$db);
-
- if($this->db->connect_error) {
- $this->connected = false;
- $this->error = $this->db->connect_error;
-
- if(file_exists('dbfail.out')) {
- file_put_contents('dbfail.out', datetime_convert() . "\nConnect: " . $this->error . "\n", FILE_APPEND);
- }
-
- return false;
- }
- else {
- $this->connected = true;
- return true;
- }
- }
-
- function q($sql) {
- if((! $this->db) || (! $this->connected))
- return false;
-
- $this->error = '';
- $result = $this->db->query($sql);
-
- if($this->db->errno)
- $this->error = $this->db->error;
-
-
- if($this->error) {
- db_logger('dba_mysqli: ERROR: ' . printable($sql) . "\n" . $this->error, LOGGER_NORMAL, LOG_ERR);
- if(file_exists('dbfail.out')) {
- file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . "\n" . $this->error . "\n", FILE_APPEND);
- }
- }
-
- if(($result === true) || ($result === false)) {
- if($this->debug) {
- db_logger('dba_mysqli: DEBUG: ' . printable($sql) . ' returns ' . (($result) ? 'true' : 'false'), LOGGER_NORMAL,(($result) ? LOG_INFO : LOG_ERR));
- }
- return $result;
- }
-
- if($this->debug) {
- db_logger('dba_mysqli: DEBUG: ' . printable($sql) . ' returned ' . $result->num_rows . ' results.', LOGGER_NORMAL, LOG_INFO);
- }
-
- $r = array();
- if($result->num_rows) {
- while($x = $result->fetch_array(MYSQLI_ASSOC))
- $r[] = $x;
- $result->free_result();
- if($this->debug) {
- db_logger('dba_mysqli: ' . printable(print_r($r,true)), LOGGER_NORMAL, LOG_INFO);
- }
- }
- return $r;
- }
-
- function escape($str) {
- if($this->db && $this->connected) {
- return @$this->db->real_escape_string($str);
- }
- }
-
- function close() {
- if($this->db)
- $this->db->close();
- $this->connected = false;
- }
-
- function getdriver() {
- return 'mysqli';
- }
-
-} \ No newline at end of file
diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php
index a9d824a50..f24c5381a 100755
--- a/include/dba/dba_pdo.php
+++ b/include/dba/dba_pdo.php
@@ -1,14 +1,21 @@
-<?php /** @file */
+<?php
-require_once('include/dba/dba_driver.php');
+require_once 'include/dba/dba_driver.php';
+/**
+ * @brief PDO based database driver.
+ *
+ */
class dba_pdo extends dba_driver {
-
public $driver_dbtype = null;
- function connect($server,$scheme,$port,$user,$pass,$db) {
-
+ /**
+ * {@inheritDoc}
+ * @see dba_driver::connect()
+ */
+ function connect($server, $scheme, $port, $user, $pass, $db) {
+
$this->driver_dbtype = $scheme;
if(strpbrk($server,':;')) {
@@ -17,7 +24,7 @@ class dba_pdo extends dba_driver {
else {
$dsn = $this->driver_dbtype . ':host=' . $server . (intval($port) ? ';port=' . $port : '');
}
-
+
$dsn .= ';dbname=' . $db;
try {
@@ -36,10 +43,19 @@ class dba_pdo extends dba_driver {
$this->q("SET standard_conforming_strings = 'off'; SET backslash_quote = 'on';");
$this->connected = true;
- return true;
+ return true;
}
+ /**
+ * {@inheritDoc}
+ * @see dba_driver::q()
+ *
+ * @return bool|array|PDOStatement
+ * - \b false if not connected or PDOException occured on query
+ * - \b array with results on a SELECT query
+ * - \b PDOStatement on a non SELECT SQL query
+ */
function q($sql) {
if((! $this->db) || (! $this->connected))
return false;
@@ -50,14 +66,15 @@ class dba_pdo extends dba_driver {
}
}
+ $result = null;
$this->error = '';
- $select = ((stripos($sql,'select') === 0) ? true : false);
+ $select = ((stripos($sql, 'select') === 0) ? true : false);
try {
$result = $this->db->query($sql, PDO::FETCH_ASSOC);
}
catch(PDOException $e) {
-
+
$this->error = $e->getMessage();
if($this->error) {
db_logger('dba_pdo: ERROR: ' . printable($sql) . "\n" . $this->error, LOGGER_NORMAL, LOG_ERR);
@@ -82,11 +99,10 @@ class dba_pdo extends dba_driver {
}
if($this->debug) {
- db_logger('dba_pdo: DEBUG: ' . printable($sql) . ' returned ' . count($r) . ' results.', LOGGER_NORMAL, LOG_INFO);
+ db_logger('dba_pdo: DEBUG: ' . printable($sql) . ' returned ' . count($r) . ' results.', LOGGER_NORMAL, LOG_INFO);
db_logger('dba_pdo: ' . printable(print_r($r,true)), LOGGER_NORMAL, LOG_INFO);
}
-
return (($this->error) ? false : $r);
}
@@ -99,9 +115,10 @@ class dba_pdo extends dba_driver {
function close() {
if($this->db)
$this->db = null;
+
$this->connected = false;
}
-
+
function concat($fld,$sep) {
if($this->driver_dbtype === 'pgsql') {
return 'string_agg(' . $fld . ',\'' . $sep . '\')';
@@ -140,7 +157,7 @@ class dba_pdo extends dba_driver {
return $this->escape($str);
}
}
-
+
function unescapebin($str) {
if($this->driver_dbtype === 'pgsql' && (! is_null($str))) {
$x = '';
diff --git a/include/dba/dba_postgres.php b/include/dba/dba_postgres.php
deleted file mode 100644
index 560d8da60..000000000
--- a/include/dba/dba_postgres.php
+++ /dev/null
@@ -1,117 +0,0 @@
-<?php
-
-require_once('include/dba/dba_driver.php');
-
-
-class dba_postgres extends dba_driver {
- const INSTALL_SCRIPT='install/schema_postgres.sql';
- const NULL_DATE = '0001-01-01 00:00:00';
- const UTC_NOW = "now() at time zone 'UTC'";
- const TQUOT = '"';
-
- function connect($server,$scheme,$port,$user,$pass,$db) {
- if(!$port) $port = 5432;
- $connstr = 'host=' . $server . ' port='.$port . ' user=' . $user . ' password=' . $pass . ' dbname='. $db;
- $this->db = pg_connect($connstr);
- if($this->db !== false) {
- $this->connected = true;
- } else {
- $this->connected = false;
- }
- $this->q("SET standard_conforming_strings = 'off'; SET backslash_quote = 'on';"); // emulate mysql string escaping to prevent massive code-clobber
- return $this->connected;
- }
-
- function q($sql) {
- if((! $this->db) || (! $this->connected))
- return false;
-
- if(!strpos($sql, ';'))
- $sql .= ';';
-
- if(strpos($sql, '`')) // this is a hack. quoted identifiers should be replaced everywhere in the code with dbesc_identifier(), remove this once it is
- $sql = str_replace('`', '"', $sql);
-
- $this->error = '';
- $result = @pg_query($this->db, $sql);
- if(file_exists('db-allqueries.out')) {
- $bt = debug_backtrace();
- $trace = array();
- foreach($bt as $frame) {
- if(!empty($frame['file']) && @strstr($frame['file'], $_SERVER['DOCUMENT_ROOT']))
- $frame['file'] = substr($frame['file'], strlen($_SERVER['DOCUMENT_ROOT'])+1);
-
- $trace[] = $frame['file'] . ':' . $frame['function'] . '():' . $frame['line'] ;
- }
- $compact = join(', ', $trace);
- file_put_contents('db-allqueries.out', datetime_convert() . ": " . $sql . ' is_resource: '.var_export(is_resource($result), true).', backtrace: '.$compact."\n\n", FILE_APPEND);
- }
-
- if($result === false)
- $this->error = pg_last_error($this->db);
-
- if($result === false || $this->error) {
- //db_logger('dba_postgres: ' . printable($sql) . ' returned false.' . "\n" . $this->error);
- if(file_exists('dbfail.out'))
- file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . ' returned false' . "\n" . $this->error . "\n", FILE_APPEND);
- }
-
- if(($result === true) || ($result === false))
- return $result;
-
- if(pg_result_status($result) == PGSQL_COMMAND_OK)
- return true;
-
- $r = array();
- if(pg_num_rows($result)) {
- while($x = pg_fetch_array($result, null, PGSQL_ASSOC))
- $r[] = $x;
- pg_free_result($result);
- if($this->debug)
- db_logger('dba_postgres: ' . printable(print_r($r,true)));
- }
- return $r;
- }
-
- function escape($str) {
- if($this->db && $this->connected) {
- $x = @pg_escape_string($this->db, $str);
- return $x;
- }
- }
-
- function escapebin($str) {
- return pg_escape_bytea($str);
- }
-
- function unescapebin($str) {
- return pg_unescape_bytea($str);
- }
-
- function close() {
- if($this->db)
- pg_close($this->db);
- $this->connected = false;
- }
-
- function quote_interval($txt) {
- return "'$txt'";
- }
-
- function escape_identifier($str) {
- return pg_escape_identifier($this->db, $str);
- }
-
- function optimize_table($table) {
- // perhaps do some equivalent thing here, vacuum, etc? I think this is the DBA's domain anyway. Applications should not need to muss with this.
- // for now do nothing without a compelling reason. function overrides default legacy mysql.
- }
-
- function concat($fld, $sep) {
- return 'string_agg(' . $fld . ',\'' . $sep . '\')';
- }
-
- function getdriver() {
- return 'pgsql';
- }
-} \ No newline at end of file
diff --git a/include/feedutils.php b/include/feedutils.php
index 5ef45a6cd..369193fce 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -253,19 +253,18 @@ function construct_activity_target($item) {
return '';
}
+
/**
- * @brief Return an array with a parsed atom item.
+ * @brief Return an array with a parsed atom author.
*
* @param SimplePie $feed
- * @param array $item
- * @param[out] array $author
- * @return array Associative array with the parsed item data
+ * @param SimplePie $item
+ * @return array $author
*/
-function get_atom_elements($feed, $item, &$author) {
- require_once('include/html2bbcode.php');
+function get_atom_author($feed, $item) {
- $res = array();
+ $author = [];
$found_author = $item->get_author();
if($found_author) {
@@ -290,52 +289,6 @@ function get_atom_elements($feed, $item, &$author) {
if(substr($author['author_link'],-1,1) == '/')
$author['author_link'] = substr($author['author_link'],0,-1);
- $res['mid'] = normalise_id(unxmlify($item->get_id()));
- $res['title'] = unxmlify($item->get_title());
- $res['body'] = unxmlify($item->get_content());
- $res['plink'] = unxmlify($item->get_link(0));
- $res['item_rss'] = 1;
-
-
- $summary = unxmlify($item->get_description(true));
-
- // removing the content of the title if its identically to the body
- // This helps with auto generated titles e.g. from tumblr
-
- if (title_is_body($res['title'], $res['body']))
- $res['title'] = "";
-
- if($res['plink'])
- $base_url = implode('/', array_slice(explode('/',$res['plink']),0,3));
- else
- $base_url = '';
-
-
- $rawcreated = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published');
- if($rawcreated)
- $res['created'] = unxmlify($rawcreated[0]['data']);
-
- $rawedited = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated');
- if($rawedited)
- $res['edited'] = unxmlify($rawedited[0]['data']);
-
- if((x($res,'edited')) && (! (x($res,'created'))))
- $res['created'] = $res['edited'];
-
- if(! $res['created'])
- $res['created'] = $item->get_date('c');
-
- if(! $res['edited'])
- $res['edited'] = $item->get_date('c');
-
- $rawverb = $item->get_item_tags(NAMESPACE_ACTIVITY, 'verb');
-
- // select between supported verbs
-
- if($rawverb) {
- $res['verb'] = unxmlify($rawverb[0]['data']);
- }
-
// look for a photo. We should check media size and find the best one,
// but for now let's just find any author photo
@@ -414,6 +367,122 @@ function get_atom_elements($feed, $item, &$author) {
}
}
+ $rawowner = $item->get_item_tags(NAMESPACE_DFRN, 'owner');
+ if(! $rawowner)
+ $rawowner = $item->get_item_tags(NAMESPACE_ZOT, 'owner');
+
+ if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])
+ $author['owner_name'] = unxmlify($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']);
+ elseif($rawowner[0]['child'][NAMESPACE_DFRN]['name'][0]['data'])
+ $author['owner_name'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['name'][0]['data']);
+ if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])
+ $author['owner_link'] = unxmlify($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']);
+ elseif($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data'])
+ $author['owner_link'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data']);
+
+ if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) {
+ $base = $rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'];
+
+ foreach($base as $link) {
+ if(!x($author, 'owner_photo') || ! $author['owner_photo']) {
+ if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar')
+ $author['owner_photo'] = unxmlify($link['attribs']['']['href']);
+ }
+ }
+ }
+
+ // build array to pass to hook
+ $arr = [
+ 'feed' => $feed,
+ 'item' => $item,
+ 'author' => $author
+ ];
+ /**
+ * @hooks parse_atom
+ * * \e SimplePie \b feed - The original SimplePie feed
+ * * \e SimplePie \b item
+ * * \e array \b result - the result array that will also get returned
+ */
+ call_hooks('parse_atom_author', $arr);
+
+ logger('author: ' . print_r($arr['author'], true), LOGGER_DATA);
+
+ return $arr['author'];
+}
+
+
+/**
+ * @brief Return an array with a parsed atom item.
+ *
+ * @param SimplePie $feed
+ * @param SimplePie $item
+ * @param[out] array $author
+ * @return array Associative array with the parsed item data
+ */
+
+function get_atom_elements($feed, $item) {
+
+ require_once('include/html2bbcode.php');
+
+ $res = array();
+
+
+ $res['mid'] = normalise_id(unxmlify($item->get_id()));
+ $res['title'] = unxmlify($item->get_title());
+ $res['body'] = unxmlify($item->get_content());
+ $res['plink'] = unxmlify($item->get_link(0));
+ $res['item_rss'] = 1;
+
+
+ $summary = unxmlify($item->get_description(true));
+
+ if($summary === $res['body'])
+ $summary = '';
+
+ if(($summary) && ((strpos($summary,'<') !== false) || (strpos($summary,'>') !== false))) {
+ $summary = purify_html($summary);
+ $summary = html2bbcode($summary);
+ }
+
+
+
+ // removing the content of the title if its identically to the body
+ // This helps with auto generated titles e.g. from tumblr
+
+ if (title_is_body($res['title'], $res['body']))
+ $res['title'] = "";
+
+ if($res['plink'])
+ $base_url = implode('/', array_slice(explode('/',$res['plink']),0,3));
+ else
+ $base_url = '';
+
+
+ $rawcreated = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published');
+ if($rawcreated)
+ $res['created'] = unxmlify($rawcreated[0]['data']);
+
+ $rawedited = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated');
+ if($rawedited)
+ $res['edited'] = unxmlify($rawedited[0]['data']);
+
+ if((x($res,'edited')) && (! (x($res,'created'))))
+ $res['created'] = $res['edited'];
+
+ if(! $res['created'])
+ $res['created'] = $item->get_date('c');
+
+ if(! $res['edited'])
+ $res['edited'] = $item->get_date('c');
+
+ $rawverb = $item->get_item_tags(NAMESPACE_ACTIVITY, 'verb');
+
+ // select between supported verbs
+
+ if($rawverb) {
+ $res['verb'] = unxmlify($rawverb[0]['data']);
+ }
+
$rawcnv = $item->get_item_tags(NAMESPACE_OSTATUS, 'conversation');
if($rawcnv) {
// new style
@@ -428,7 +497,7 @@ function get_atom_elements($feed, $item, &$author) {
}
}
- $ostatus_protocol = (($ostatus_conversation) ? true : false);
+ $ostatus_protocol = (($ostatus_conversation || $res['verb']) ? true : false);
$mastodon = (($item->get_item_tags('http://mastodon.social/schema/1.0','scope')) ? true : false);
if($mastodon) {
@@ -437,6 +506,8 @@ function get_atom_elements($feed, $item, &$author) {
$res['item_private'] = 1;
}
+ logger('ostatus_protocol: ' . intval($ostatus_protocol), LOGGER_DEBUG);
+
$apps = $item->get_item_tags(NAMESPACE_STATUSNET, 'notice_info');
if($apps && $apps[0]['attribs']['']['source']) {
$res['app'] = strip_tags(unxmlify($apps[0]['attribs']['']['source']));
@@ -540,9 +611,8 @@ function get_atom_elements($feed, $item, &$author) {
);
}
- // turn Mastodon content warning into a #nsfw hashtag
- if($mastodon && $summary) {
- $res['body'] = $summary . "\n\n" . $res['body'] . "\n\n#ContentWarning\n";
+ if($summary && $res['body']) {
+ $res['body'] = '[summary]' . $summary . '[/summary]' . $res['body'];
}
@@ -571,29 +641,6 @@ function get_atom_elements($feed, $item, &$author) {
$res['created'] = datetime_convert('UTC','UTC',$res['created']);
$res['edited'] = datetime_convert('UTC','UTC',$res['edited']);
- $rawowner = $item->get_item_tags(NAMESPACE_DFRN, 'owner');
- if(! $rawowner)
- $rawowner = $item->get_item_tags(NAMESPACE_ZOT, 'owner');
-
- if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])
- $author['owner_name'] = unxmlify($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']);
- elseif($rawowner[0]['child'][NAMESPACE_DFRN]['name'][0]['data'])
- $author['owner_name'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['name'][0]['data']);
- if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])
- $author['owner_link'] = unxmlify($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']);
- elseif($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data'])
- $author['owner_link'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data']);
-
- if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) {
- $base = $rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'];
-
- foreach($base as $link) {
- if(!x($author, 'owner_photo') || ! $author['owner_photo']) {
- if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar')
- $author['owner_photo'] = unxmlify($link['attribs']['']['href']);
- }
- }
- }
$rawgeo = $item->get_item_tags(NAMESPACE_GEORSS, 'point');
if($rawgeo)
@@ -756,20 +803,17 @@ function get_atom_elements($feed, $item, &$author) {
$arr = [
'feed' => $feed,
'item' => $item,
- 'author' => $author,
'result' => $res
];
/**
* @hooks parse_atom
* * \e SimplePie \b feed - The original SimplePie feed
- * * \e array \b item
- * * \e array \b author
+ * * \e SimplePie \b item
* * \e array \b result - the result array that will also get returned
*/
call_hooks('parse_atom', $arr);
- logger('author: ' .print_r($arr['author'], true), LOGGER_DATA);
- logger('result: ' .print_r($arr['result'], true), LOGGER_DATA);
+ logger('result: ' . print_r($arr['result'], true), LOGGER_DATA);
return $arr['result'];
}
@@ -968,9 +1012,9 @@ function process_feed_tombstones($feed,$importer,$contact,$pass) {
* @param string $xml
* The (atom) feed to consume - RSS isn't as fully supported but may work for simple feeds.
* @param array $importer
- * The contact_record (joined to user_record) of the local user who owns this
+ * The channel record of the local user who owns this
* relationship. It is this person's stuff that is going to be updated.
- * @param[in,out] array $contact
+ * @param[in,out] array $contact (abook record joined to xchan record)
* The person who is sending us stuff. If not set, we MAY be processing a "follow" activity
* from an external network and MAY create an appropriate contact record. Otherwise, we MUST
* have a contact record.
@@ -1057,8 +1101,8 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
// Have we seen it? If not, import it.
- $author = array();
- $datarray = get_atom_elements($feed,$item,$author);
+ $author = get_atom_author($feed,$item);
+ $datarray = get_atom_elements($feed,$item);
if(! $datarray['mid'])
continue;
@@ -1310,8 +1354,8 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
// Head post of a conversation. Have we seen it? If not, import it.
- $author = array();
- $datarray = get_atom_elements($feed,$item,$author);
+ $author = get_atom_author($feed,$item);
+ $datarray = get_atom_elements($feed,$item);
if(! $datarray['mid'])
continue;
@@ -1513,11 +1557,11 @@ function normalise_id($id) {
*/
function process_salmon_feed($xml, $importer) {
- $ret = array();
+ $ret = [];
if(! strlen($xml)) {
logger('process_feed: empty input');
- return;
+ return $ret;
}
$feed = new SimplePie();
@@ -1531,8 +1575,10 @@ function process_salmon_feed($xml, $importer) {
$feed->init();
- if($feed->error())
+ if($feed->error()) {
logger('Error parsing XML: ' . $feed->error());
+ return $ret;
+ }
$permalink = $feed->get_permalink();
@@ -1559,16 +1605,13 @@ function process_salmon_feed($xml, $importer) {
if($is_reply)
$ret['parent_mid'] = $parent_mid;
- $ret['author'] = array();
-
- $datarray = get_atom_elements($feed, $item, $ret['author']);
+ $ret['author'] = get_atom_author($feed,$item);
+ $ret['item'] = get_atom_elements($feed,$item);
// reset policies which are restricted by default for RSS connections
// This item is likely coming from GNU-social via salmon and allows public interaction
- $datarray['public_policy'] = '';
- $datarray['comment_policy'] = 'authenticated';
-
- $ret['item'] = $datarray;
+ $ret['item']['public_policy'] = '';
+ $ret['item']['comment_policy'] = 'authenticated';
}
}
diff --git a/include/items.php b/include/items.php
index c7206458e..68fa4c3b2 100755
--- a/include/items.php
+++ b/include/items.php
@@ -2327,6 +2327,16 @@ function send_status_notifications($post_id,$item) {
$parent = 0;
+ if(array_key_exists('verb',$item) && (activity_match($item['verb'], ACTIVITY_LIKE) || activity_match($item['verb'], ACTIVITY_DISLIKE))) {
+
+ $r = q("select id from item where mid = '%s' and uid = %d limit 1",
+ dbesc($item['thr_parent']),
+ intval($item['uid'])
+ );
+
+ $thr_parent_id = $r[0]['id'];
+ }
+
$r = q("select channel_hash from channel where channel_id = %d limit 1",
intval($item['uid'])
);
@@ -2392,10 +2402,10 @@ function send_status_notifications($post_id,$item) {
'to_xchan' => $r[0]['channel_hash'],
'item' => $item,
'link' => $link,
- 'verb' => ACTIVITY_POST,
+ 'verb' => $item['verb'],
'otype' => 'item',
- 'parent' => $parent,
- 'parent_mid' => $item['parent_mid']
+ 'parent' => $thr_parent_id ? $thr_parent_id : $parent,
+ 'parent_mid' => $thr_parent_id ? $item['thr_parent'] : $item['parent_mid']
));
}
@@ -3653,7 +3663,7 @@ function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL, $force = false) {
$linked_item = (($item['resource_id']) ? true : false);
- logger('item: ' . $item . ' stage: ' . $stage . ' force: ' . $force, LOGGER_DATA);
+ logger('item: ' . $item['id'] . ' stage: ' . $stage . ' force: ' . $force, LOGGER_DATA);
switch($stage) {
case DROPITEM_PHASE2:
diff --git a/include/js_strings.php b/include/js_strings.php
index 1b4668061..936594291 100644
--- a/include/js_strings.php
+++ b/include/js_strings.php
@@ -24,10 +24,16 @@ function js_strings() {
'$leavethispage' => t('Unsaved changes. Are you sure you wish to leave this page?'),
'$location' => t('Location'),
- '$t01' => ((t('timeago.prefixAgo') != 'timeago.prefixAgo') ? t('timeago.prefixAgo') : ''),
- '$t02' => ((t('timeago.prefixFromNow') != 'timeago.prefixFromNow') ? t('timeago.prefixFromNow') : ''),
- '$t03' => t('ago'),
- '$t04' => t('from now'),
+ // translatable prefix and suffix strings for jquery.timeago -
+ // using the defaults set below if left untranslated, empty strings if
+ // translated to "NONE" and the corresponding language strings
+ // if translated to anything else
+ '$t01' => ((t('timeago.prefixAgo') == 'timeago.prefixAgo') ? '' : ((t('timeago.prefixAgo') == 'NONE') ? '' : t('timeago.prefixAgo'))),
+ '$t02' => ((t('timeago.prefixFromNow') == 'timeago.prefixFromNow') ? '' : ((t('timeago.prefixFromNow') == 'NONE') ? '' : t('timeago.prefixFromNow'))),
+ '$t03' => ((t('timeago.suffixAgo') == 'timeago.suffixAgo') ? 'ago' : ((t('timeago.suffixAgo') == 'NONE') ? '' : t('timeago.suffixAgo'))),
+ '$t04' => ((t('timeago.suffixFromNow') == 'timeago.suffixFromNow') ? 'from now' : ((t('timeago.suffixFromNow') == 'NONE') ? '' : t('timeago.suffixFromNow'))),
+
+ // translatable main strings for jquery.timeago
'$t05' => t('less than a minute'),
'$t06' => t('about a minute'),
'$t07' => t('%d minutes'),
diff --git a/include/nav.php b/include/nav.php
index 9c88541d1..df58ee96f 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -73,9 +73,7 @@ EOT;
// nav links: array of array('href', 'text', 'extra css classes', 'title')
$nav = [];
- $disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false;
-
- if(! $disable_discover_tab)
+ if(can_view_public_stream())
$nav['pubs'] = true;
/**
diff --git a/include/network.php b/include/network.php
index 2ac430e82..0824183f7 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1605,10 +1605,10 @@ function get_site_info() {
'commit' => $commit,
'plugins' => $visible_plugins,
'register_policy' => $register_policy[get_config('system','register_policy')],
- 'invitation_only' => intval(get_config('system','invitation_only')),
+ 'invitation_only' => (bool) intval(get_config('system','invitation_only')),
'directory_mode' => $directory_mode[get_config('system','directory_mode')],
'language' => get_config('system','language'),
- 'rss_connections' => intval(get_config('system','feed_contacts')),
+ 'rss_connections' => (bool) intval(get_config('system','feed_contacts')),
'expiration' => $site_expire,
'default_service_restrictions' => $service_class,
'locked_features' => $locked_features,
diff --git a/include/plugin.php b/include/plugin.php
index 67157dee7..62d443ab8 100755
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -179,14 +179,84 @@ function reload_plugins() {
}
+function plugins_installed_list() {
+
+ $r = q("select * from addon where installed = 1 order by aname asc");
+ return(($r) ? ids_to_array($r,'aname') : []);
+}
+
+
+function plugins_sync() {
+
+ /**
+ *
+ * Synchronise plugins:
+ *
+ * App::$config['system']['addon'] contains a comma-separated list of names
+ * of plugins/addons which are used on this system.
+ * Go through the database list of already installed addons, and if we have
+ * an entry, but it isn't in the config list, call the unload procedure
+ * and mark it uninstalled in the database (for now we'll remove it).
+ * Then go through the config list and if we have a plugin that isn't installed,
+ * call the install procedure and add it to the database.
+ *
+ */
+
+ $installed = plugins_installed_list();
+
+ $plugins = get_config('system', 'addon', '');
+
+ $plugins_arr = explode(',', $plugins);
+
+ // array_trim is in include/text.php
+
+ if(! array_walk($plugins_arr,'array_trim'))
+ return;
+
+ App::$plugins = $plugins_arr;
+
+ $installed_arr = [];
+
+ if(count($installed)) {
+ foreach($installed as $i) {
+ if(! in_array($i, $plugins_arr)) {
+ unload_plugin($i);
+ }
+ else {
+ $installed_arr[] = $i;
+ }
+ }
+ }
+
+ if(count($plugins_arr)) {
+ foreach($plugins_arr as $p) {
+ if(! in_array($p, $installed_arr)) {
+ load_plugin($p);
+ }
+ }
+ }
+
+}
+
+
/**
* @brief Get a list of non hidden addons.
*
* @return array
*/
function visible_plugin_list() {
+
$r = q("select * from addon where hidden = 0 order by aname asc");
- return(($r) ? ids_to_array($r,'aname') : array());
+ $x = (($r) ? ids_to_array($r,'aname') : array());
+ $y = [];
+ if($x) {
+ foreach($x as $xv) {
+ if(is_dir('addon/' . $xv)) {
+ $y[] = $xv;
+ }
+ }
+ }
+ return $y;
}
diff --git a/include/queue_fn.php b/include/queue_fn.php
index 5fb0d5f1e..798ac36db 100644
--- a/include/queue_fn.php
+++ b/include/queue_fn.php
@@ -121,7 +121,7 @@ function queue_deliver($outq, $immediate = false) {
$base = null;
$h = parse_url($outq['outq_posturl']);
- if($h)
+ if($h !== false)
$base = $h['scheme'] . '://' . $h['host'] . (($h['port']) ? ':' . $h['port'] : '');
if(($base) && ($base !== z_root()) && ($immediate)) {
@@ -160,6 +160,9 @@ function queue_deliver($outq, $immediate = false) {
+
+
+
$arr = array('outq' => $outq, 'base' => $base, 'handled' => false, 'immediate' => $immediate);
call_hooks('queue_deliver',$arr);
if($arr['handled'])
@@ -216,7 +219,29 @@ function queue_deliver($outq, $immediate = false) {
// normal zot delivery
logger('deliver: dest: ' . $outq['outq_posturl'], LOGGER_DEBUG);
- $result = zot_zot($outq['outq_posturl'],$outq['outq_notify']);
+
+ $channel = null;
+
+ if($outq['outq_msg'] && $outq['outq_channel']) {
+ $channel = channelx_by_n($outq['outq_channel']);
+ }
+
+ $host_crypto = null;
+
+ if($channel && $base) {
+ $h = q("select hubloc_sitekey, site_crypto from hubloc left join site on hubloc_url = site_url where site_url = '%s' order by hubloc_id desc limit 1",
+ dbesc($base)
+ );
+ if($h) {
+ $host_crypto = $h[0];
+ }
+ }
+
+ $msg = $outq['outq_notify'];
+
+ $result = zot_zot($outq['outq_posturl'],$msg,$channel,$host_crypto);
+
+
if($result['success']) {
logger('deliver: remote zot delivery succeeded to ' . $outq['outq_posturl']);
zot_process_response($outq['outq_posturl'],$result, $outq);
diff --git a/include/text.php b/include/text.php
index 10bbc751a..35a367d43 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2160,6 +2160,35 @@ function ids_to_querystr($arr,$idx = 'id',$quote = false) {
}
/**
+ * @brief array_elm_to_str($arr,$elm,$delim = ',') extract unique individual elements from an array of arrays and return them as a string separated by a delimiter
+ * similar to ids_to_querystr, but allows a different delimiter instead of a db-quote option
+ * empty elements (evaluated after trim()) are ignored.
+ * @param $arr array
+ * @param $elm array key to extract from sub-array
+ * @param $delim string default ','
+ * @returns string
+ */
+
+function array_elm_to_str($arr,$elm,$delim = ',') {
+
+ $tmp = [];
+ if($arr && is_array($arr)) {
+ foreach($arr as $x) {
+ if(is_array($x) && array_key_exists($elm,$x)) {
+ $z = trim($x[$elm]);
+ if(($z) && (! in_array($z,$tmp))) {
+ $tmp[] = $z;
+ }
+ }
+ }
+ }
+ return implode($delim,$tmp);
+}
+
+
+
+
+/**
* @brief Fetches xchan and hubloc data for an array of items with only an
* author_xchan and owner_xchan.
*
@@ -3263,29 +3292,3 @@ function purify_filename($s) {
}
-/**
- * @brief array_elm_to_str($arr,$elm,$delim = ',') extract unique individual elements from an array of arrays and return them as a string separated by a delimiter
- *
- * empty elements (evaluated after trim()) are ignored.
- * @param $arr array
- * @param $elm array key to extract from sub-array
- * @param $delim string default ','
- * @returns string
- */
-
-function array_elm_to_str($arr,$elm,$delim = ',') {
-
- $tmp = [];
- if($arr && is_array($arr)) {
- foreach($arr as $x) {
- if(is_array($x) && array_key_exists($elm,$x)) {
- $z = trim($x[$elm]);
- if(($z) && (! in_array($z,$tmp))) {
- $tmp[] = $z;
- }
- }
- }
- }
- return implode($tmp,$delim);
-}
-
diff --git a/include/zot.php b/include/zot.php
index 8e3d03ad8..d28e584a1 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -158,6 +158,85 @@ function zot_build_packet($channel, $type = 'notify', $recipients = null, $remot
return json_encode($data);
}
+
+/**
+ * @brief Builds a zot6 notification packet.
+ *
+ * Builds a zot6 notification packet that you can either store in the queue with
+ * a message array or call zot_zot to immediately zot it to the other side.
+ *
+ * @param array $channel
+ * sender channel structure
+ * @param string $type
+ * packet type: one of 'ping', 'pickup', 'purge', 'refresh', 'keychange', 'force_refresh', 'notify', 'auth_check'
+ * @param array $recipients
+ * envelope information, array ( 'guid' => string, 'guid_sig' => string ); empty for public posts
+ * @param string $remote_key
+ * optional public site key of target hub used to encrypt entire packet
+ * NOTE: remote_key and encrypted packets are required for 'auth_check' packets, optional for all others
+ * @param string $methods
+ * optional comma separated list of encryption methods @ref zot_best_algorithm()
+ * @param string $secret
+ * random string, required for packets which require verification/callback
+ * e.g. 'pickup', 'purge', 'notify', 'auth_check'. Packet types 'ping', 'force_refresh', and 'refresh' do not require verification
+ * @param string $extra
+ * @returns string json encoded zot packet
+ */
+function zot6_build_packet($channel, $type = 'notify', $recipients = null, $msg = '', $remote_key = null, $methods = '', $secret = null, $extra = null) {
+
+ $sig_method = get_config('system','signature_algorithm','sha256');
+
+ $data = [
+ 'type' => $type,
+ 'sender' => [
+ 'guid' => $channel['channel_guid'],
+ 'guid_sig' => base64url_encode(rsa_sign($channel['channel_guid'],$channel['channel_prvkey'],$sig_method)),
+ 'url' => z_root(),
+ 'url_sig' => base64url_encode(rsa_sign(z_root(),$channel['channel_prvkey'],$sig_method)),
+ 'sitekey' => get_config('system','pubkey')
+ ],
+ 'callback' => '/post',
+ 'version' => Zotlabs\Lib\System::get_zot_revision(),
+ 'encryption' => crypto_methods(),
+ 'signing' => signing_methods()
+ ];
+
+ if ($recipients) {
+ for ($x = 0; $x < count($recipients); $x ++)
+ unset($recipients[$x]['hash']);
+
+ $data['recipients'] = $recipients;
+ }
+
+ if($msg) {
+ $data['msg'] = $msg;
+ }
+
+ if ($secret) {
+ $data['secret'] = preg_replace('/[^0-9a-fA-F]/','',$secret);
+ $data['secret_sig'] = base64url_encode(rsa_sign($secret,$channel['channel_prvkey'],$sig_method));
+ }
+
+ if ($extra) {
+ foreach ($extra as $k => $v)
+ $data[$k] = $v;
+ }
+
+ logger('zot6_build_packet: ' . print_r($data,true), LOGGER_DATA, LOG_DEBUG);
+
+ // Hush-hush ultra top-secret mode
+
+ if($remote_key) {
+ $algorithm = zot_best_algorithm($methods);
+ $data = crypto_encapsulate(json_encode($data),$remote_key, $algorithm);
+ }
+
+ return json_encode($data);
+}
+
+
+
+
/**
* @brief Choose best encryption function from those available on both sites.
*
@@ -209,10 +288,23 @@ function zot_best_algorithm($methods) {
*
* @param string $url
* @param array $data
+ * @param array $channel (optional if using zot6 delivery)
+ * @param array $crypto (optional if encrypted httpsig, requires hubloc_sitekey and site_crypto elements)
* @return array see z_post_url() for returned data format
*/
-function zot_zot($url, $data) {
- return z_post_url($url, array('data' => $data));
+function zot_zot($url, $data, $channel = null,$crypto = null) {
+
+ $headers = [];
+
+ if($channel) {
+ $headers['X-Zot-Token'] = random_string();
+ $hash = \Zotlabs\Web\HTTPSig::generate_digest($data,false);
+ $headers['X-Zot-Digest'] = 'SHA-256=' . $hash;
+ $h = \Zotlabs\Web\HTTPSig::create_sig('',$headers,$channel['channel_prvkey'],'acct:' . $channel['channel_address'] . '@' . \App::get_hostname(),false,false,'sha512',(($crypto) ? $crypto['hubloc_sitekey'] : ''), (($crypto) ? zot_best_algorithm($crypto['site_crypto']) : ''));
+ }
+
+ $redirects = 0;
+ return z_post_url($url, array('data' => $data),$redirects,((empty($h)) ? [] : [ 'headers' => $h ]));
}
/**
@@ -1060,7 +1152,12 @@ function zot_process_response($hub, $arr, $outq) {
* @brief
*
* We received a notification packet (in mod_post) that a message is waiting for us, and we've verified the sender.
- * Now send back a pickup message, using our message tracking ID ($arr['secret']), which we will sign with our site
+ * Check if the site is using zot6 delivery and includes a verified HTTP Signature, signed content, and a 'msg' field,
+ * and also that the signer and the sender match.
+ * If that happens, we do not need to fetch/pickup the message - we have it already and it is verified.
+ * Translate it into the form we need for zot_import() and import it.
+ *
+ * Otherwise send back a pickup message, using our message tracking ID ($arr['secret']), which we will sign with our site
* private key.
* The entire pickup message is encrypted with the remote site's public key.
* If everything checks out on the remote end, we will receive back a packet containing one or more messages,
@@ -1078,38 +1175,61 @@ function zot_fetch($arr) {
$url = $arr['sender']['url'] . $arr['callback'];
- // set $multiple param on zot_gethub() to return all matching hubs
- // This allows us to recover from re-installs when a redundant (but invalid) hubloc for
- // this identity is widely dispersed throughout the network.
+ $import = null;
+ $hubs = null;
+
+ $zret = zot6_check_sig();
- $ret_hubs = zot_gethub($arr['sender'],true);
- if(! $ret_hubs) {
+ if($zret['success'] && $zret['hubloc'] && $zret['hubloc']['hubloc_guid'] === $data['sender']['guid'] && $data['msg']) {
+ logger('zot6_delivery',LOGGER_DEBUG);
+ logger('zot6_data: ' . print_r($data,true),LOGGER_DATA);
+
+ $ret['collected'] = true;
+
+ $import = [ 'success' => true, 'body' => json_encode( [ 'success' => true, 'pickup' => [ [ 'notify' => $data, 'message' => json_decode($data['msg'],true) ] ] ] ) ];
+ $hubs = [ $zret['hubloc'] ] ;
+ }
+
+ if(! $hubs) {
+ // set $multiple param on zot_gethub() to return all matching hubs
+ // This allows us to recover from re-installs when a redundant (but invalid) hubloc for
+ // this identity is widely dispersed throughout the network.
+
+ $hubs = zot_gethub($arr['sender'],true);
+ }
+
+ if(! $hubs) {
logger('No hub: ' . print_r($arr['sender'],true));
return;
}
- foreach($ret_hubs as $ret_hub) {
+ foreach($hubs as $hub) {
- $secret = substr(preg_replace('/[^0-9a-fA-F]/','',$arr['secret']),0,64);
+ if(! $import) {
+ $secret = substr(preg_replace('/[^0-9a-fA-F]/','',$arr['secret']),0,64);
- $data = [
- 'type' => 'pickup',
- 'url' => z_root(),
- 'callback_sig' => base64url_encode(rsa_sign(z_root() . '/post', get_config('system','prvkey'))),
- 'callback' => z_root() . '/post',
- 'secret' => $secret,
- 'secret_sig' => base64url_encode(rsa_sign($secret, get_config('system','prvkey')))
- ];
+ $data = [
+ 'type' => 'pickup',
+ 'url' => z_root(),
+ 'callback_sig' => base64url_encode(rsa_sign(z_root() . '/post', get_config('system','prvkey'))),
+ 'callback' => z_root() . '/post',
+ 'secret' => $secret,
+ 'secret_sig' => base64url_encode(rsa_sign($secret, get_config('system','prvkey')))
+ ];
- $algorithm = zot_best_algorithm($ret_hub['site_crypto']);
- $datatosend = json_encode(crypto_encapsulate(json_encode($data),$ret_hub['hubloc_sitekey'], $algorithm));
+ $algorithm = zot_best_algorithm($hub['site_crypto']);
+ $datatosend = json_encode(crypto_encapsulate(json_encode($data),$hub['hubloc_sitekey'], $algorithm));
- $fetch = zot_zot($url,$datatosend);
+ $import = zot_zot($url,$datatosend);
+ }
+ else {
+ $algorithm = zot_best_algorithm($hub['site_crypto']);
+ }
- $result = zot_import($fetch, $arr['sender']['url']);
+ $result = zot_import($import, $arr['sender']['url']);
if($result) {
- $result = crypto_encapsulate(json_encode($result),$ret_hub['hubloc_sitekey'], $algorithm);
+ $result = crypto_encapsulate(json_encode($result),$hub['hubloc_sitekey'], $algorithm);
return $result;
}
@@ -4967,6 +5087,39 @@ function zot_reply_refresh($sender, $recipients) {
}
+function zot6_check_sig() {
+
+ $ret = [ 'success' => false ];
+
+ logger('server: ' . print_r($_SERVER,true), LOGGER_DATA);
+
+ if(array_key_exists('HTTP_SIGNATURE',$_SERVER)) {
+ $sigblock = \Zotlabs\Web\HTTPSig::parse_sigheader($_SERVER['HTTP_SIGNATURE']);
+ if($sigblock) {
+ $keyId = $sigblock['keyId'];
+
+ if($keyId) {
+ $r = q("select hubloc.*, site_crypto from hubloc left join site on hubloc_url = site_url
+ where hubloc_addr = '%s' ",
+ dbesc(str_replace('acct:','',$keyId))
+ );
+ if($r) {
+ foreach($r as $hubloc) {
+ $verified = \Zotlabs\Web\HTTPSig::verify('',$hubloc['xchan_pubkey']);
+ if($verified && $verified['header_signed'] && $verified['header_valid'] && $verified['content_signed'] && $verified['content_valid']) {
+ $ret['hubloc'] = $hubloc;
+ $ret['success'] = true;
+ return $ret;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return $ret;
+}
+
function zot_reply_notify($data) {
$ret = array('success' => false);
diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index 673e4cd75..36cd2539b 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -644,7 +644,6 @@ CREATE TABLE IF NOT EXISTS `item` (
`item_pending_remove` tinyint(1) NOT NULL DEFAULT 0 ,
`item_blocked` tinyint(1) NOT NULL DEFAULT 0 ,
PRIMARY KEY (`id`),
- KEY `uid` (`uid`),
KEY `parent` (`parent`),
KEY `created` (`created`),
KEY `edited` (`edited`),
@@ -652,6 +651,12 @@ CREATE TABLE IF NOT EXISTS `item` (
KEY `uid_commented` (`uid`, `commented`),
KEY `uid_created` (`uid`, `created`),
KEY `uid_item_unseen` (`uid`, `item_unseen`),
+ KEY `uid_item_type` (`uid`, `item_type`),
+ KEY `uid_item_thread_top` (`uid`, `item_thread_top`),
+ KEY `uid_item_blocked` (`uid`, `item_blocked`),
+ KEY `uid_item_wall` (`uid`, `item_wall`),
+ KEY `uid_item_starred` (`uid`, `item_starred`),
+ KEY `uid_item_retained` (`uid`, `item_retained`),
KEY `aid` (`aid`),
KEY `owner_xchan` (`owner_xchan`),
KEY `author_xchan` (`author_xchan`),
@@ -677,10 +682,7 @@ CREATE TABLE IF NOT EXISTS `item` (
KEY `changed` (`changed`),
KEY `item_origin` (`item_origin`),
KEY `item_unseen` (`item_unseen`),
- KEY `item_starred` (`item_starred`),
KEY `item_uplink` (`item_uplink`),
- KEY `item_wall` (`item_wall`),
- KEY `item_thread_top` (`item_thread_top`),
KEY `item_notshown` (`item_notshown`),
KEY `item_nsfw` (`item_nsfw`),
KEY `item_relay` (`item_relay`),
@@ -688,16 +690,9 @@ CREATE TABLE IF NOT EXISTS `item` (
KEY `item_nocomment` (`item_nocomment`),
KEY `item_obscured` (`item_obscured`),
KEY `item_verified` (`item_verified`),
- KEY `item_retained` (`item_retained`),
KEY `item_rss` (`item_rss`),
- KEY `item_deleted` (`item_deleted`),
- KEY `item_type` (`item_type`),
- KEY `item_hidden` (`item_hidden`),
KEY `item_consensus` (`item_consensus`),
- KEY `item_unpublished` (`item_unpublished`),
- KEY `item_delayed` (`item_delayed`),
- KEY `item_pending_remove` (`item_pending_remove`),
- KEY `item_blocked` (`item_blocked`)
+ KEY `item_deleted_pending_remove_changed` (`item_deleted`, `item_pending_remove`, `changed`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `item_id` (
diff --git a/install/update.php b/install/update.php
deleted file mode 100644
index f7b9b03ed..000000000
--- a/install/update.php
+++ /dev/null
@@ -1,3072 +0,0 @@
-<?php
-
-define( 'UPDATE_VERSION' , 1198 );
-
-/**
- *
- * update.php - automatic system update
- *
- * Automatically update database schemas and any other development changes such that
- * copying the latest files from the source code repository will always perform a clean
- * and painless upgrade.
- *
- * Each function in this file is named update_rnnnn() where nnnn is an increasing number
- * which began counting at 1000.
- *
- * At the top of the file "boot.php" is a define for DB_UPDATE_VERSION. Any time there is a change
- * to the database schema or one which requires an upgrade path from the existing application,
- * the DB_UPDATE_VERSION and the UPDATE_VERSION at the top of this file are incremented.
- *
- * The current DB_UPDATE_VERSION is stored in the config area of the database. If the application starts up
- * and DB_UPDATE_VERSION is greater than the last stored build number, we will process every update function
- * in order from the currently stored value to the new DB_UPDATE_VERSION. This is expected to bring the system
- * up to current without requiring re-installation or manual intervention.
- *
- * Once the upgrade functions have completed, the current DB_UPDATE_VERSION is stored as the current value.
- * The DB_UPDATE_VERSION will always be one greater than the last numbered script in this file.
- *
- * If you change the database schema, the following are required:
- * 1. Update the files schema_mysql.sql and schema_postgres.sql to match the new schema.
- * Be sure to read doc/sql_conventions.bb ($yoururl/help/sql_conventions) use only standard
- * SQL data types where possible to keep differences in the files to a minimum
- * 2. Update this file by adding a new function at the end with the number of the current DB_UPDATE_VERSION.
- * This function should modify the current database schema and perform any other steps necessary
- * to ensure that upgrade is silent and free from requiring interaction. Review to ensure that it
- * will run correctly on both postgres and MySQL/Mariadb. It is very difficult and messy to fix DB update
- * errors. Once pushed, it requires a new update which undoes any damage and performs the corrected updated.
- * 3. Increment the DB_UPDATE_VERSION in boot.php *AND* the UPDATE_VERSION in this file to match it
- * 4. TEST the upgrade prior to checkin and filing a pull request.
- *
- */
-
-function update_r1000() {
- $r = q("ALTER TABLE `channel` ADD `channel_a_delegate` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0', ADD INDEX ( `channel_a_delegate` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1001() {
- $r = q("CREATE TABLE if not exists `verify` (
- `id` INT(10) UNSIGNED NOT NULL ,
- `channel` INT(10) UNSIGNED NOT NULL DEFAULT '0',
- `type` CHAR( 32 ) NOT NULL DEFAULT '',
- `token` CHAR( 255 ) NOT NULL DEFAULT '',
- `meta` CHAR( 255 ) NOT NULL DEFAULT '',
- `created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
- PRIMARY KEY ( `id` )
- ) ENGINE = MYISAM DEFAULT CHARSET=utf8");
-
- $r2 = q("alter table `verify` add index (`channel`), add index (`type`), add index (`token`),
- add index (`meta`), add index (`created`)");
-
- if($r && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1002() {
- $r = q("ALTER TABLE `event` CHANGE `account` `aid` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
- $r2 = q("alter table `event` drop index `account`, add index (`aid`)");
-
- q("drop table contact");
- q("drop table deliverq");
-
- if($r && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1003() {
- $r = q("ALTER TABLE `xchan` ADD `xchan_flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `xchan_network` ,
-ADD INDEX ( `xchan_flags` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1004() {
- $r = q("CREATE TABLE if not exists `site` (
-`site_url` CHAR( 255 ) NOT NULL ,
-`site_flags` INT NOT NULL DEFAULT '0',
-`site_update` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
-`site_directory` CHAR( 255 ) NOT NULL DEFAULT '',
-PRIMARY KEY ( `site_url` )
-) ENGINE = MYISAM DEFAULT CHARSET=utf8");
-
- $r2 = q("alter table site add index (site_flags), add index (site_update), add index (site_directory) ");
-
- if($r && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1005() {
- q("drop table guid");
- q("drop table `notify-threads`");
- return UPDATE_SUCCESS;
-}
-
-function update_r1006() {
-
- $r = q("CREATE TABLE IF NOT EXISTS `xprof` (
- `xprof_hash` char(255) NOT NULL,
- `xprof_desc` char(255) NOT NULL DEFAULT '',
- `xprof_dob` char(12) NOT NULL DEFAULT '',
- `xprof_gender` char(255) NOT NULL DEFAULT '',
- `xprof_marital` char(255) NOT NULL DEFAULT '',
- `xprof_sexual` char(255) NOT NULL DEFAULT '',
- `xprof_locale` char(255) NOT NULL DEFAULT '',
- `xprof_region` char(255) NOT NULL DEFAULT '',
- `xprof_postcode` char(32) NOT NULL DEFAULT '',
- `xprof_country` char(255) NOT NULL DEFAULT '',
- PRIMARY KEY (`xprof_hash`),
- KEY `xprof_desc` (`xprof_desc`),
- KEY `xprof_dob` (`xprof_dob`),
- KEY `xprof_gender` (`xprof_gender`),
- KEY `xprof_marital` (`xprof_marital`),
- KEY `xprof_sexual` (`xprof_sexual`),
- KEY `xprof_locale` (`xprof_locale`),
- KEY `xprof_region` (`xprof_region`),
- KEY `xprof_postcode` (`xprof_postcode`),
- KEY `xprof_country` (`xprof_country`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8");
-
- $r2 = q("CREATE TABLE IF NOT EXISTS `xtag` (
- `xtag_hash` char(255) NOT NULL,
- `xtag_term` char(255) NOT NULL DEFAULT '',
- PRIMARY KEY (`xtag_hash`),
- KEY `xtag_term` (`xtag_term`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8");
-
- if($r && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1007() {
- $r = q("ALTER TABLE `channel` ADD `channel_r_storage` INT UNSIGNED NOT NULL DEFAULT '128', ADD `channel_w_storage` INT UNSIGNED NOT NULL DEFAULT '128', add index ( channel_r_storage ), add index ( channel_w_storage )");
-
- if($r && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1008() {
- $r = q("alter table profile drop prv_keywords, CHANGE `pub_keywords` `keywords` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, drop index pub_keywords");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1009() {
- $r = q("ALTER TABLE `xprof` ADD `xprof_keywords` TEXT NOT NULL");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1010() {
- $r = q("ALTER TABLE `abook` ADD `abook_dob` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `abook_connnected` ,
-ADD INDEX ( `abook_dob` )");
-
- $r2 = q("ALTER TABLE `profile` ADD `dob_tz` CHAR( 255 ) NOT NULL DEFAULT 'UTC' AFTER `dob`");
-
- if($r && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1011() {
- $r = q("ALTER TABLE `item` ADD `expires` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `edited` ,
-ADD INDEX ( `expires` )");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1012() {
- $r = q("ALTER TABLE `xchan` ADD `xchan_connurl` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_url` ,
-ADD INDEX ( `xchan_connurl` )");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1013() {
- $r = q("CREATE TABLE if not exists `xlink` (
-`xlink_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-`xlink_xchan` CHAR( 255 ) NOT NULL DEFAULT '',
-`xlink_link` CHAR( 255 ) NOT NULL DEFAULT '',
-`xlink_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00'
-) ENGINE = MYISAM DEFAULT CHARSET=utf8");
-
- $r2 = q("alter table xlink add index ( xlink_xchan ), add index ( xlink_link ), add index ( xlink_updated ) ");
- if($r && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1014() {
- $r = q("ALTER TABLE `verify` CHANGE `id` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1015() {
- $r = q("ALTER TABLE `channel` ADD `channel_r_pages` INT UNSIGNED NOT NULL DEFAULT '128',
-ADD `channel_w_pages` INT UNSIGNED NOT NULL DEFAULT '128'");
-
- $r2 = q("ALTER TABLE `channel` ADD INDEX ( `channel_r_pages` ) , ADD INDEX ( `channel_w_pages` ) ");
-
- if($r && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1016() {
-
- $r = q("CREATE TABLE IF NOT EXISTS `menu` (
- `menu_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `menu_channel_id` int(10) unsigned NOT NULL DEFAULT '0',
- `menu_desc` char(255) NOT NULL DEFAULT '',
- PRIMARY KEY (`menu_id`),
- KEY `menu_channel_id` (`menu_channel_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
- $r2 = q("CREATE TABLE IF NOT EXISTS `menu_item` (
- `mitem_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `mitem_link` char(255) NOT NULL DEFAULT '',
- `mitem_desc` char(255) NOT NULL DEFAULT '',
- `allow_cid` mediumtext NOT NULL,
- `allow_gid` mediumtext NOT NULL,
- `deny_cid` mediumtext NOT NULL,
- `deny_gid` mediumtext NOT NULL,
- `mitem_channel_id` int(10) unsigned NOT NULL,
- `mitem_menu_id` int(10) unsigned NOT NULL DEFAULT '0',
- `mitem_order` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`mitem_id`),
- KEY `mitem_channel_id` (`mitem_channel_id`),
- KEY `mitem_menu_id` (`mitem_menu_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
-
- if($r && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1017() {
- $r = q("ALTER TABLE `event` CHANGE `cid` `event_xchan` CHAR( 255 ) NOT NULL DEFAULT '', ADD INDEX ( `event_xchan` ), drop index cid ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1018() {
- $r = q("ALTER TABLE `event` ADD `event_hash` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `event_xchan` ,
-ADD INDEX ( `event_hash` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1019() {
- $r = q("ALTER TABLE `event` DROP `message_id` ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1020() {
- $r = q("alter table photo drop `contact-id`, drop guid, drop index `resource-id`, add index ( `resource_id` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1021() {
-
- $r = q("ALTER TABLE `abook` CHANGE `abook_connnected` `abook_connected` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
- drop index `abook_connnected`, add index ( `abook_connected` ) ");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1022() {
- $r = q("alter table attach add index ( filename ), add index ( filetype ), add index ( filesize ), add index ( created ), add index ( edited ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1023() {
- $r = q("ALTER TABLE `item` ADD `revision` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `lang` , add index ( revision ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1024() {
- $r = q("ALTER TABLE `attach` ADD `revision` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `filesize` ,
-ADD INDEX ( `revision` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1025() {
- $r = q("ALTER TABLE `attach` ADD `folder` CHAR( 64 ) NOT NULL DEFAULT '' AFTER `revision` ,
-ADD `flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `folder` , add index ( folder ), add index ( flags )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1026() {
- $r = q("ALTER TABLE `item` ADD `mimetype` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `author_xchan` ,
-ADD INDEX ( `mimetype` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1027() {
- $r = q("ALTER TABLE `abook` ADD `abook_rating` INT NOT NULL DEFAULT '0' AFTER `abook_closeness` ,
-ADD INDEX ( `abook_rating` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1028() {
- $r = q("ALTER TABLE `xlink` ADD `xlink_rating` INT NOT NULL DEFAULT '0' AFTER `xlink_link` ,
-ADD INDEX ( `xlink_rating` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1029() {
- $r = q("ALTER TABLE `channel` ADD `channel_deleted` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_pageflags` ,
-ADD INDEX ( `channel_deleted` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1030() {
- $r = q("CREATE TABLE IF NOT EXISTS `issue` (
-`issue_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-`issue_created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
-`issue_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
-`issue_assigned` CHAR( 255 ) NOT NULL ,
-`issue_priority` INT NOT NULL ,
-`issue_status` INT NOT NULL ,
-`issue_component` CHAR( 255 ) NOT NULL,
-KEY `issue_created` (`issue_created`),
-KEY `issue_updated` (`issue_updated`),
-KEY `issue_assigned` (`issue_assigned`),
-KEY `issue_priority` (`issue_priority`),
-KEY `issue_status` (`issue_status`),
-KEY `issue_component` (`issue_component`)
-) ENGINE = MYISAM DEFAULT CHARSET=utf8");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1031() {
- $r = q("ALTER TABLE `account` ADD `account_external` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `account_email` ,
-ADD INDEX ( `account_external` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1032() {
- $r = q("CREATE TABLE if not exists `xign` (
-`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-`uid` INT NOT NULL DEFAULT '0',
-`xchan` CHAR( 255 ) NOT NULL DEFAULT '',
-KEY `uid` (`uid`),
-KEY `xchan` (`xchan`)
-) ENGINE = MYISAM DEFAULT CHARSET = utf8");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1033() {
- $r = q("CREATE TABLE if not exists `shares` (
-`share_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-`share_type` INT NOT NULL DEFAULT '0',
-`share_target` INT UNSIGNED NOT NULL DEFAULT '0',
-`share_xchan` CHAR( 255 ) NOT NULL DEFAULT '',
-KEY `share_type` (`share_type`),
-KEY `share_target` (`share_target`),
-KEY `share_xchan` (`share_xchan`)
-) ENGINE = MYISAM DEFAULT CHARSET = utf8");
-
- // if these fail don't bother reporting it
-
- q("drop table gcign");
- q("drop table gcontact");
- q("drop table glink");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1034() {
- $r = q("CREATE TABLE if not exists `updates` (
-`ud_hash` CHAR( 128 ) NOT NULL ,
-`ud_date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
-PRIMARY KEY ( `ud_hash` ),
-KEY `ud_date` ( `ud_date` )
-) ENGINE = MYISAM DEFAULT CHARSET = utf8");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1035() {
- $r = q("CREATE TABLE if not exists `xconfig` (
-`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-`xchan` CHAR( 255 ) NOT NULL ,
-`cat` CHAR( 255 ) NOT NULL ,
-`k` CHAR( 255 ) NOT NULL ,
-`v` MEDIUMTEXT NOT NULL,
-KEY `xchan` ( `xchan` ),
-KEY `cat` ( `cat` ),
-KEY `k` ( `k` )
-) ENGINE = MYISAM DEFAULT CHARSET = utf8");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1036() {
- $r = q("ALTER TABLE `profile` ADD `channels` TEXT NOT NULL AFTER `contact` ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-
-function update_r1037() {
- $r1 = q("ALTER TABLE `item` CHANGE `uri` `mid` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
-CHANGE `parent_uri` `parent_mid` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
- DROP INDEX `uri` ,
-ADD INDEX `mid` ( `mid` ),
-DROP INDEX `parent_uri` ,
-ADD INDEX `parent_mid` ( `parent_mid` ),
- DROP INDEX `uid_uri` ,
-ADD INDEX `uid_mid` ( `mid` , `uid` ) ");
-
- $r2 = q("ALTER TABLE `mail` CHANGE `uri` `mid` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
-CHANGE `parent_uri` `parent_mid` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
-DROP INDEX `uri` ,
-ADD INDEX `mid` ( `mid` ),
- DROP INDEX `parent_uri` ,
-ADD INDEX `parent_mid` ( `parent_mid` ) ");
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1038() {
- $r = q("ALTER TABLE `manage` CHANGE `mid` `xchan` CHAR( 255 ) NOT NULL DEFAULT '', drop index `mid`, ADD INDEX ( `xchan` )");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-
-function update_r1039() {
- $r = q("ALTER TABLE `channel` CHANGE `channel_default_gid` `channel_default_group` CHAR( 255 ) NOT NULL DEFAULT ''");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1040() {
- $r1 = q("ALTER TABLE `session` CHANGE `expire` `expire` BIGINT UNSIGNED NOT NULL ");
- $r2 = q("ALTER TABLE `tokens` CHANGE `expires` `expires` BIGINT UNSIGNED NOT NULL ");
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1041() {
- $r = q("ALTER TABLE `outq` ADD `outq_driver` CHAR( 32 ) NOT NULL DEFAULT '' AFTER `outq_channel` ");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1042() {
- $r = q("ALTER TABLE `hubloc` ADD `hubloc_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
-ADD `hubloc_connected` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( `hubloc_updated` ), ADD INDEX ( `hubloc_connected` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1043() {
- $r = q("ALTER TABLE `item` ADD `comment_policy` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `coord` ,
-ADD INDEX ( `comment_policy` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1044() {
- $r = q("ALTER TABLE `term` ADD `imgurl` CHAR( 255 ) NOT NULL ,
-ADD INDEX ( `imgurl` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1045() {
- $r = q("ALTER TABLE `site` ADD `site_register` INT NOT NULL DEFAULT '0',
-ADD INDEX ( `site_register` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1046() {
- $r = q("ALTER TABLE `term` ADD `term_hash` CHAR( 255 ) NOT NULL DEFAULT '',
-ADD INDEX ( `term_hash` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1047() {
- $r = q("ALTER TABLE `xprof` ADD `xprof_age` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `xprof_hash` ,
-ADD INDEX ( `xprof_age` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1048() {
- $r = q("CREATE TABLE IF NOT EXISTS `obj` (
- `obj_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `obj_page` char(64) NOT NULL DEFAULT '',
- `obj_verb` char(255) NOT NULL DEFAULT '',
- `obj_type` int(10) unsigned NOT NULL DEFAULT '0',
- `obj_obj` char(255) NOT NULL DEFAULT '',
- `obj_channel` int(10) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (`obj_id`),
- KEY `obj_verb` (`obj_verb`),
- KEY `obj_page` (`obj_page`),
- KEY `obj_type` (`obj_type`),
- KEY `obj_channel` (`obj_channel`),
- KEY `obj_obj` (`obj_obj`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1049() {
- $r = q("ALTER TABLE `term` ADD `parent_hash` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `term_hash` , ADD INDEX ( `parent_hash` ) ");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1050() {
- $r = q("ALTER TABLE `xtag` DROP PRIMARY KEY , ADD `xtag_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST , ADD INDEX ( `xtag_hash` ) ");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1051() {
- $r = q("ALTER TABLE `photo` ADD `photo_flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `profile` , ADD INDEX ( `photo_flags` ) ");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1052() {
- $r = q("ALTER TABLE `channel` ADD UNIQUE (`channel_address`) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1053() {
- $r = q("ALTER TABLE `profile` ADD `chandesc` TEXT NOT NULL DEFAULT '' AFTER `pdesc` ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1054() {
- $r = q("ALTER TABLE `item` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1055() {
- $r = q("ALTER TABLE `mail` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1056() {
- $r = q("ALTER TABLE `xchan` ADD `xchan_instance_url` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_network` ,
-ADD INDEX ( `xchan_instance_url` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1057() {
- $r = q("drop table intro");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1058() {
- $r1 = q("ALTER TABLE `menu` ADD `menu_name` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `menu_channel_id` ,
-ADD INDEX ( `menu_name` ) ");
-
- $r2 = q("ALTER TABLE `menu_item` ADD `mitem_flags` INT NOT NULL DEFAULT '0' AFTER `mitem_desc` ,
-ADD INDEX ( `mitem_flags` ) ");
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1059() {
- $r = q("ALTER TABLE `mail` ADD `attach` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `body` ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1060() {
-
- $r = q("CREATE TABLE IF NOT EXISTS `vote` (
- `vote_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `vote_poll` int(11) NOT NULL DEFAULT '0',
- `vote_element` int(11) NOT NULL DEFAULT '0',
- `vote_result` text NOT NULL,
- `vote_xchan` char(255) NOT NULL DEFAULT '',
- PRIMARY KEY (`vote_id`),
- UNIQUE KEY `vote_vote` (`vote_poll`,`vote_element`,`vote_xchan`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1061() {
- $r = q("ALTER TABLE `vote` ADD INDEX ( `vote_poll` ), ADD INDEX ( `vote_element` ) ");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1062() {
- $r1 = q("CREATE TABLE IF NOT EXISTS `poll` (
-`poll_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-`poll_channel` INT UNSIGNED NOT NULL DEFAULT '0',
-`poll_desc` TEXT NOT NULL DEFAULT '',
-`poll_flags` INT NOT NULL DEFAULT '0',
-`poll_votes` INT NOT NULL DEFAULT '0',
-KEY `poll_channel` (`poll_channel`),
-KEY `poll_flags` (`poll_flags`),
-KEY `poll_votes` (`poll_votes`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
- $r2 = q("CREATE TABLE IF NOT EXISTS `poll_elm` (
-`pelm_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-`pelm_poll` INT UNSIGNED NOT NULL DEFAULT '0',
-`pelm_desc` TEXT NOT NULL DEFAULT '',
-`pelm_flags` INT NOT NULL DEFAULT '0',
-`pelm_result` FLOAT NOT NULL DEFAULT '0',
-KEY `pelm_poll` (`pelm_poll`),
-KEY `pelm_result` (`pelm_result`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1063() {
- $r = q("ALTER TABLE `xchan` ADD `xchan_follow` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_connurl` ,
-ADD `xchan_connpage` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_follow` ,
-ADD INDEX ( `xchan_follow` ), ADD INDEX ( `xchan_connpage`) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1064() {
- $r = q("ALTER TABLE `updates` ADD `ud_guid` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `ud_hash` ,
-ADD INDEX ( `ud_guid` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1065() {
- $r = q("ALTER TABLE `item` DROP `wall`, ADD `layout_mid` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `target` ,
-ADD INDEX ( `layout_mid` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1066() {
- $r = q("ALTER TABLE `site` ADD `site_access` INT NOT NULL DEFAULT '0' AFTER `site_url` ,
-ADD INDEX ( `site_access` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1067() {
- $r = q("ALTER TABLE `updates` DROP PRIMARY KEY , ADD `ud_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST, ADD INDEX ( `ud_hash` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1068(){
- $r = q("ALTER TABLE `hubloc` ADD `hubloc_status` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `hubloc_flags` , ADD INDEX ( `hubloc_status` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1069() {
- $r = q("ALTER TABLE `site` ADD `site_sellpage` CHAR( 255 ) NOT NULL DEFAULT '',
-ADD INDEX ( `site_sellpage` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1070() {
- $r = q("ALTER TABLE `updates` ADD `ud_flags` INT NOT NULL DEFAULT '0',
-ADD INDEX ( `ud_flags` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1071() {
- $r = q("ALTER TABLE `updates` ADD `ud_addr` CHAR( 255 ) NOT NULL DEFAULT '',
-ADD INDEX ( `ud_addr` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1072() {
- $r = q("ALTER TABLE `xtag` ADD `xtag_flags` INT NOT NULL DEFAULT '0',
-ADD INDEX ( `xtag_flags` ) ");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1073() {
- $r1 = q("CREATE TABLE IF NOT EXISTS `source` (
-`src_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-`src_channel_id` INT UNSIGNED NOT NULL DEFAULT '0',
-`src_channel_xchan` CHAR( 255 ) NOT NULL DEFAULT '',
-`src_xchan` CHAR( 255 ) NOT NULL DEFAULT '',
-`src_patt` MEDIUMTEXT NOT NULL DEFAULT ''
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
- $r2 = q("ALTER TABLE `source` ADD INDEX ( `src_channel_id` ), ADD INDEX ( `src_channel_xchan` ), ADD INDEX ( `src_xchan` ) ");
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1074() {
- $r1 = q("ALTER TABLE `site` ADD `site_sync` DATETIME NOT NULL AFTER `site_update` ");
-
- $r2 = q("ALTER TABLE `updates` ADD `ud_last` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `ud_date` ,
-ADD INDEX ( `ud_last` ) ");
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1075() {
- $r = q("ALTER TABLE `channel` ADD `channel_a_republish` INT UNSIGNED NOT NULL DEFAULT '128',
-ADD INDEX ( `channel_a_republish` )");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1076() {
- $r = q("ALTER TABLE `item` CHANGE `inform` `sig` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1077() {
- $r = q("ALTER TABLE `item` ADD `source_xchan` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `author_xchan` ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1078() {
- $r = q("ALTER TABLE `channel` ADD `channel_dirdate` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_pageflags` , ADD INDEX ( `channel_dirdate` )");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1079() {
- $r = q("ALTER TABLE `site` ADD `site_location` CHAR( 255 ) NOT NULL DEFAULT ''");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1080() {
- $r = q("ALTER TABLE `mail` ADD `expires` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
-ADD INDEX ( `expires` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1081() {
- $r = q("DROP TABLE `queue` ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1082() {
- $r = q("DROP TABLE `challenge` ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1083() {
- $r = q("ALTER TABLE `notify` ADD `aid` INT NOT NULL AFTER `msg` ,
-ADD INDEX ( `aid` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1084() {
-
-
- $r = q("CREATE TABLE if not exists `sys_perms` (
- `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
- `cat` CHAR( 255 ) NOT NULL ,
- `k` CHAR( 255 ) NOT NULL ,
- `v` MEDIUMTEXT NOT NULL,
- `public_perm` TINYINT( 1 ) UNSIGNED NOT NULL
-) ENGINE = MYISAM DEFAULT CHARSET = utf8");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1085() {
- $r1 = q("ALTER TABLE `photo` CHANGE `desc` `description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ");
-
- $r2 = q("RENAME TABLE `group` TO `groups`");
-
- $r3 = q("ALTER TABLE `event` CHANGE `desc` `description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ");
-
- if($r1 && $r2 && $r3)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1086() {
- $r = q("ALTER TABLE `account` ADD `account_level` INT UNSIGNED NOT NULL DEFAULT '0',
-ADD INDEX ( `account_level` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1087() {
- $r = q("ALTER TABLE `xprof` ADD `xprof_about` TEXT NOT NULL DEFAULT '',
-ADD `xprof_homepage` CHAR( 255 ) NOT NULL DEFAULT '',
-ADD `xprof_hometown` CHAR( 255 ) NOT NULL DEFAULT '',
-ADD INDEX ( `xprof_hometown` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1088() {
- $r = q("ALTER TABLE `obj` ADD `allow_cid` MEDIUMTEXT NOT NULL DEFAULT '',
-ADD `allow_gid` MEDIUMTEXT NOT NULL DEFAULT '',
-ADD `deny_cid` MEDIUMTEXT NOT NULL DEFAULT '',
-ADD `deny_gid` MEDIUMTEXT NOT NULL DEFAULT ''");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1089() {
- $r = q("ALTER TABLE `attach` ADD `creator` CHAR( 128 ) NOT NULL DEFAULT '' AFTER `hash` ,
-ADD INDEX ( `creator` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1090() {
- $r = q("ALTER TABLE `menu` ADD `menu_flags` INT NOT NULL DEFAULT '0',
-ADD INDEX ( `menu_flags` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1091() {
- @os_mkdir('store/[data]/smarty3',STORAGE_DEFAULT_PERMISSIONS,true);
- @file_put_contents('store/[data]/locks','');
- return UPDATE_SUCCESS;
-}
-
-function update_r1092() {
- $r1 = q("CREATE TABLE IF NOT EXISTS `chat` (
- `chat_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `chat_room` int(10) unsigned NOT NULL DEFAULT '0',
- `chat_xchan` char(255) NOT NULL DEFAULT '',
- `chat_text` mediumtext NOT NULL,
- `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
- PRIMARY KEY (`chat_id`),
- KEY `chat_room` (`chat_room`),
- KEY `chat_xchan` (`chat_xchan`),
- KEY `created` (`created`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8");
-
- $r2 = q("CREATE TABLE IF NOT EXISTS `chatpresence` (
- `cp_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `cp_room` int(10) unsigned NOT NULL DEFAULT '0',
- `cp_xchan` char(255) NOT NULL DEFAULT '',
- `cp_last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
- `cp_status` char(255) NOT NULL,
- PRIMARY KEY (`cp_id`),
- KEY `cp_room` (`cp_room`),
- KEY `cp_xchan` (`cp_xchan`),
- KEY `cp_last` (`cp_last`),
- KEY `cp_status` (`cp_status`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8");
-
- $r3 = q("CREATE TABLE IF NOT EXISTS `chatroom` (
- `cr_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `cr_aid` int(10) unsigned NOT NULL DEFAULT '0',
- `cr_uid` int(10) unsigned NOT NULL DEFAULT '0',
- `cr_name` char(255) NOT NULL DEFAULT '',
- `cr_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
- `cr_edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
- `allow_cid` mediumtext NOT NULL,
- `allow_gid` mediumtext NOT NULL,
- `deny_cid` mediumtext NOT NULL,
- `deny_gid` mediumtext NOT NULL,
- PRIMARY KEY (`cr_id`),
- KEY `cr_aid` (`cr_aid`),
- KEY `cr_uid` (`cr_uid`),
- KEY `cr_name` (`cr_name`),
- KEY `cr_created` (`cr_created`),
- KEY `cr_edited` (`cr_edited`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8");
-
-
- if($r1 && $r2 && $r3)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-
-
-function update_r1093() {
- $r = q("ALTER TABLE `chatpresence` ADD `cp_client` CHAR( 128 ) NOT NULL DEFAULT ''");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1094() {
- $r = q("ALTER TABLE `chatroom` ADD `cr_expire` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `cr_edited` ,
-ADD INDEX ( `cr_expire` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1095() {
- $r = q("ALTER TABLE `channel` ADD `channel_a_bookmark` INT UNSIGNED NOT NULL DEFAULT '128',
-ADD INDEX ( `channel_a_bookmark` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1096() {
- $r = q("ALTER TABLE `account` CHANGE `account_level` `account_level` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1097() {
-
- // fix some mangled hublocs from a bug long ago
-
- $r = q("select hubloc_id, hubloc_addr from hubloc where hubloc_addr like '%%/%%'");
- if($r) {
- foreach($r as $rr) {
- q("update hubloc set hubloc_addr = '%s' where hubloc_id = %d",
- dbesc(substr($rr['hubloc_addr'],0,strpos($rr['hubloc_addr'],'/'))),
- intval($rr['hubloc_id'])
- );
- }
- }
- return UPDATE_SUCCESS;
-
-}
-
-function update_r1098() {
- $r = q("ALTER TABLE `channel` CHANGE `channel_r_stream` `channel_r_stream` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
- $r2 = q("ALTER TABLE `channel` CHANGE `channel_r_profile` `channel_r_profile` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
- $r3 = q("ALTER TABLE `channel` CHANGE `channel_r_photos` `channel_r_photos` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
- $r4 = q("ALTER TABLE `channel` CHANGE `channel_r_abook` `channel_r_abook` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
- $r4 = q("ALTER TABLE `channel` CHANGE `channel_w_stream` `channel_w_stream` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
- $r5 = q("ALTER TABLE `channel` CHANGE `channel_w_wall` `channel_w_wall` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
- $r6 = q("ALTER TABLE `channel` CHANGE `channel_w_tagwall` `channel_w_tagwall` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
- $r7 = q("ALTER TABLE `channel` CHANGE `channel_w_comment` `channel_w_comment` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
- $r8 = q("ALTER TABLE `channel` CHANGE `channel_w_mail` `channel_w_mail` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
- $r9 = q("ALTER TABLE `channel` CHANGE `channel_w_photos` `channel_w_photos` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
- $r10 = q("ALTER TABLE `channel` CHANGE `channel_w_chat` `channel_w_chat` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
- $r11 = q("ALTER TABLE `channel` CHANGE `channel_a_delegate` `channel_a_delegate` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
- if($r && $r2 && $r3 && $r3 && $r5 && $r6 && $r7 && $r8 && $r9 && $r9 && $r10 && $r11)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1099() {
- $r = q("CREATE TABLE IF NOT EXISTS `xchat` (
- `xchat_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `xchat_url` char(255) NOT NULL DEFAULT '',
- `xchat_desc` char(255) NOT NULL DEFAULT '',
- `xchat_xchan` char(255) NOT NULL DEFAULT '',
- PRIMARY KEY (`xchat_id`),
- KEY `xchat_url` (`xchat_url`),
- KEY `xchat_desc` (`xchat_desc`),
- KEY `xchat_xchan` (`xchat_xchan`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1100() {
- $r = q("ALTER TABLE `xchat` ADD `xchat_edited` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
-ADD INDEX ( `xchat_edited` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1101() {
- $r = q("update updates set ud_flags = 2 where ud_flags = (-1)");
- $r = q("update updates set ud_flags = 0 where ud_flags = 4096");
- return UPDATE_SUCCESS;
-}
-
-function update_r1102() {
- $r = q("update abook set abook_flags = (abook_flags - %d)
- where ( abook_flags & %d)",
- intval(ABOOK_FLAG_UNCONNECTED),
- intval(ABOOK_FLAG_UNCONNECTED)
- );
- return UPDATE_SUCCESS;
-}
-
-function update_r1103() {
- $x = curl_version();
- if(stristr($x['ssl_version'],'openssl'))
- set_config('system','curl_ssl_ciphers','ALL:!eNULL');
- return UPDATE_SUCCESS;
-}
-
-function update_r1104() {
- $r = q("ALTER TABLE `item` ADD `route` TEXT NOT NULL DEFAULT '' AFTER `postopts` ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1105() {
- $r = q("ALTER TABLE `site` ADD `site_pull` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `site_update` ,
-CHANGE `site_sync` `site_sync` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( `site_pull` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1106() {
- $r = q("ALTER TABLE `notify` CHANGE `parent` `parent` CHAR( 255 ) NOT NULL DEFAULT ''");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1107() {
- $r = q("CREATE TABLE IF NOT EXISTS `app` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `app_id` char(64) NOT NULL DEFAULT '',
- `app_sig` char(255) NOT NULL DEFAULT '',
- `app_author` char(255) NOT NULL DEFAULT '',
- `app_name` char(255) NOT NULL DEFAULT '',
- `app_desc` text NOT NULL,
- `app_url` char(255) NOT NULL DEFAULT '',
- `app_photo` char(255) NOT NULL DEFAULT '',
- `app_version` char(255) NOT NULL DEFAULT '',
- `app_channel` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `app_id` (`app_id`),
- KEY `app_name` (`app_name`),
- KEY `app_url` (`app_url`),
- KEY `app_photo` (`app_photo`),
- KEY `app_version` (`app_version`),
- KEY `app_channel` (`app_channel`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1108() {
- $r = q("ALTER TABLE `app` ADD `app_addr` CHAR( 255 ) NOT NULL DEFAULT '',
-ADD `app_price` CHAR( 255 ) NOT NULL DEFAULT '',
-ADD `app_page` CHAR( 255 ) NOT NULL DEFAULT '',
-ADD INDEX ( `app_price` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1109() {
- $r = q("ALTER TABLE `app` CHANGE `app_id` `app_id` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-// We ended up with an extra zero in the name for 1108, so do it over and ignore the result.
-
-function update_r1110() {
- $r = q("ALTER TABLE `app` ADD `app_addr` CHAR( 255 ) NOT NULL DEFAULT '',
-ADD `app_price` CHAR( 255 ) NOT NULL DEFAULT '',
-ADD `app_page` CHAR( 255 ) NOT NULL DEFAULT '',
-ADD INDEX ( `app_price` )");
-
- return UPDATE_SUCCESS;
-
-}
-
-function update_r1111() {
- $r = q("ALTER TABLE `app` ADD `app_requires` CHAR( 255 ) NOT NULL DEFAULT '' ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1112() {
- $r = q("CREATE TABLE IF NOT EXISTS `likes` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `liker` char(128) NOT NULL DEFAULT '',
- `likee` char(128) NOT NULL DEFAULT '',
- `iid` int(11) NOT NULL DEFAULT '0',
- `verb` char(255) NOT NULL DEFAULT '',
- `target_type` char(255) NOT NULL DEFAULT '',
- `target` mediumtext NOT NULL,
- PRIMARY KEY (`id`),
- KEY `liker` (`liker`),
- KEY `likee` (`likee`),
- KEY `iid` (`iid`),
- KEY `verb` (`verb`),
- KEY `target_type` (`target_type`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8");
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1113() {
- $r = q("ALTER TABLE `likes` ADD `channel_id` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `id` ,
-CHANGE `iid` `iid` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0',
-ADD INDEX ( `channel_id` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1114() {
- $r = q("ALTER TABLE `likes` ADD `target_id` CHAR( 128 ) NOT NULL DEFAULT '' AFTER `target_type` ,
-ADD INDEX ( `target_id` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1115() {
-
- // Introducing email verification. Mark all existing accounts as verified or they
- // won't be able to login.
-
- $r = q("update account set account_flags = (account_flags ^ 1) where (account_flags & 1) ");
- return UPDATE_SUCCESS;
-}
-
-function update_r1116() {
- @os_mkdir('store/[data]/smarty3',STORAGE_DEFAULT_PERMISSIONS,true);
- return UPDATE_SUCCESS;
-}
-
-function update_r1117() {
- $r = q("ALTER TABLE `channel` CHANGE `channel_a_bookmark` `channel_w_like` INT( 10 ) UNSIGNED NOT NULL DEFAULT '128',
-DROP INDEX `channel_a_bookmark` , ADD INDEX `channel_w_like` ( `channel_w_like` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1118() {
- $r = q("ALTER TABLE `account` ADD `account_password_changed` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
-ADD INDEX ( `account_password_changed` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1119() {
- $r1 = q("CREATE TABLE IF NOT EXISTS `profdef` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `field_name` char(255) NOT NULL DEFAULT '',
- `field_type` char(16) NOT NULL DEFAULT '',
- `field_desc` char(255) NOT NULL DEFAULT '',
- `field_help` char(255) NOT NULL DEFAULT '',
- PRIMARY KEY (`id`),
- KEY `field_name` (`field_name`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8");
-
- $r2 = q("CREATE TABLE IF NOT EXISTS `profext` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `channel_id` int(10) unsigned NOT NULL DEFAULT '0',
- `hash` char(255) NOT NULL DEFAULT '',
- `k` char(255) NOT NULL DEFAULT '',
- `v` mediumtext NOT NULL,
- PRIMARY KEY (`id`),
- KEY `channel_id` (`channel_id`),
- KEY `hash` (`hash`),
- KEY `k` (`k`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8");
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1120() {
- $r = q("ALTER TABLE `item` ADD `public_policy` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `coord` ,
-ADD INDEX ( `public_policy` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1121() {
- $r = q("ALTER TABLE `site` ADD `site_realm` CHAR( 255 ) NOT NULL DEFAULT '',
-ADD INDEX ( `site_realm` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1122() {
- $r = q("update site set site_realm = '%s' where true",
- dbesc(DIRECTORY_REALM)
- );
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1123() {
- $r1 = q("ALTER TABLE `hubloc` ADD `hubloc_network` CHAR( 32 ) NOT NULL DEFAULT '' AFTER `hubloc_addr` ,
-ADD INDEX ( `hubloc_network` )");
- $r2 = q("update hubloc set hubloc_network = 'zot' where true");
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1124() {
- $r1 = q("CREATE TABLE IF NOT EXISTS `sign` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `iid` int(10) unsigned NOT NULL DEFAULT '0',
- `retract_iid` int(10) unsigned NOT NULL DEFAULT '0',
- `signed_text` mediumtext NOT NULL,
- `signature` text NOT NULL,
- `signer` char(255) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `iid` (`iid`),
- KEY `retract_iid` (`retract_iid`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
- $r2 = q("CREATE TABLE IF NOT EXISTS `conv` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `guid` char(255) NOT NULL,
- `recips` mediumtext NOT NULL,
- `uid` int(11) NOT NULL,
- `creator` char(255) NOT NULL,
- `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
- `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
- `subject` mediumtext NOT NULL,
- PRIMARY KEY (`id`),
- KEY `created` (`created`),
- KEY `updated` (`updated`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-
-}
-
-function update_r1125() {
- $r = q("ALTER TABLE `profdef` ADD `field_inputs` MEDIUMTEXT NOT NULL DEFAULT ''");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-
-function update_r1126() {
- $r = q("ALTER TABLE `mail` ADD `convid` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `id` ,
-ADD INDEX ( `convid` )");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1127() {
- $r = q("ALTER TABLE `item` ADD `comments_closed` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `changed` ,
-ADD INDEX ( `comments_closed` ), ADD INDEX ( `changed` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1128() {
- $r = q("ALTER TABLE `item` ADD `diaspora_meta` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `sig` ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1129() {
- $r = q("update hubloc set hubloc_network = 'zot' where hubloc_network = ''");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1130() {
- $myperms = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
- |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
- |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE;
-
- $r = q("select abook_channel, abook_my_perms from abook where (abook_flags & %d) and abook_my_perms != 0",
- intval(ABOOK_FLAG_SELF)
- );
- if($r) {
- foreach($r as $rr) {
- set_pconfig($rr['abook_channel'],'system','autoperms',$rr['abook_my_perms']);
- }
- }
- $r = q("update abook set abook_my_perms = %d where (abook_flags & %d) and abook_my_perms = 0",
- intval($myperms),
- intval(ABOOK_FLAG_SELF)
- );
-
- return UPDATE_SUCCESS;
-}
-
-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` ");
-
- if($r1 && $r2)
- 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;
-}
-
-function update_r1133() {
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("CREATE TABLE xperm (
- xp_id serial NOT NULL,
- xp_client varchar( 20 ) NOT NULL DEFAULT '',
- xp_channel bigint NOT NULL DEFAULT '0',
- xp_perm varchar( 64 ) NOT NULL DEFAULT '',
- PRIMARY KEY (xp_id) )");
- $r2 = 0;
- foreach(array('xp_client', 'xp_channel', 'xp_perm') as $fld)
- $r2 += ((q("create index $fld on xperm ($fld)") == false) ? 0 : 1);
-
- $r = (($r1 && $r2) ? true : false);
- }
- else {
- $r = q("CREATE TABLE IF NOT EXISTS `xperm` (
- `xp_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
- `xp_client` VARCHAR( 20 ) NOT NULL DEFAULT '',
- `xp_channel` INT UNSIGNED NOT NULL DEFAULT '0',
- `xp_perm` VARCHAR( 64 ) NOT NULL DEFAULT '',
- KEY `xp_client` (`xp_client`),
- KEY `xp_channel` (`xp_channel`),
- KEY `xp_perm` (`xp_perm`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
- }
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1134() {
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("ALTER TABLE xlink ADD xlink_static numeric(1) NOT NULL DEFAULT '0' ");
- $r2 = q("create index xlink_static on xlink ( xlink_static ) ");
- $r = $r1 && $r2;
- }
- else
- $r = q("ALTER TABLE xlink ADD xlink_static TINYINT( 1 ) NOT NULL DEFAULT '0', ADD INDEX ( xlink_static ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1135() {
- $r = q("ALTER TABLE xlink ADD xlink_sig TEXT NOT NULL DEFAULT ''");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1136() {
- $r1 = q("alter table item add item_unseen smallint not null default '0' ");
- $r2 = q("create index item_unseen on item ( item_unseen ) ");
- $r3 = q("update item set item_unseen = 1 where ( item_flags & 2 ) > 0 ");
-
- if($r1 && $r2 && $r3)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1137() {
- $r1 = q("alter table site add site_valid smallint not null default '0' ");
- $r2 = q("create index site_valid on site ( site_valid ) ");
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1138() {
- $r1 = q("alter table outq add outq_priority smallint not null default '0' ");
- $r2 = q("create index outq_priority on outq ( outq_priority ) ");
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1139() {
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("ALTER TABLE channel ADD channel_lastpost timestamp NOT NULL DEFAULT '0001-01-01 00:00:00'");
- $r2 = q("create index channel_lastpost on channel ( channel_lastpost ) ");
- $r = $r1 && $r2;
- }
- else
- $r = q("ALTER TABLE `channel` ADD `channel_lastpost` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_dirdate` , ADD INDEX ( `channel_lastpost` ) ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1140() {
- $r = q("select * from clients where true");
- $x = false;
- if($r) {
- foreach($r as $rr) {
- $m = q("INSERT INTO xperm (xp_client, xp_channel, xp_perm) VALUES ('%s', %d, '%s') ",
- dbesc($rr['client_id']),
- intval($rr['uid']),
- dbesc('all')
- );
- if(! $m)
- $x = true;
- }
- }
- if($x)
- return UPDATE_FAILED;
- return UPDATE_SUCCESS;
-}
-
-
-function update_r1141() {
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("ALTER TABLE menu ADD menu_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', ADD menu_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00'");
- $r2 = q("create index menu_created on menu ( menu_created ) ");
- $r3 = q("create index menu_edited on menu ( menu_edited ) ");
- $r = $r1 && $r2;
- }
- else
- $r = q("ALTER TABLE menu ADD menu_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD menu_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( menu_created ), ADD INDEX ( menu_edited ) ");
-
- $t = datetime_convert();
- q("update menu set menu_created = '%s', menu_edited = '%s' where true",
- dbesc($t),
- dbesc($t)
- );
-
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1142() {
-
- $r1 = q("alter table site add site_dead smallint not null default '0' ");
- $r2 = q("create index site_dead on site ( site_dead ) ");
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-
-}
-
-function update_r1143() {
-
- $r1 = q("ALTER TABLE abook ADD abook_incl TEXT NOT NULL DEFAULT ''");
- $r2 = q("ALTER TABLE abook ADD abook_excl TEXT NOT NULL DEFAULT '' ");
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1144() {
- $r = q("select flags, id from attach where flags != 0");
- if($r) {
- foreach($r as $rr) {
- if($rr['flags'] & 1) {
- q("update attach set is_dir = 1 where id = %d",
- intval($rr['id'])
- );
- }
- if($rr['flags'] & 2) {
- q("update attach set os_storage = 1 where id = %d",
- intval($rr['id'])
- );
- }
- }
- }
-
- return UPDATE_SUCCESS;
-}
-
-function update_r1145() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("ALTER TABLE event ADD event_status char(255) NOT NULL DEFAULT '',
- ADD event_status_date timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
- ADD event_percent SMALLINT NOT NULL DEFAULT '0',
- ADD event_repeat TEXT NOT NULL DEFAULT '' ");
- $r2 = q("create index event_status on event ( event_status )");
- $r = $r1 && $r2;
- }
- else {
- $r = q("ALTER TABLE `event` ADD `event_status` CHAR( 255 ) NOT NULL DEFAULT '',
- ADD `event_status_date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
- ADD `event_percent` SMALLINT NOT NULL DEFAULT '0',
- ADD `event_repeat` TEXT NOT NULL DEFAULT '',
- ADD INDEX ( `event_status` ) ");
- }
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1146() {
-
- $r1 = q("alter table event add event_sequence smallint not null default '0' ");
- $r2 = q("create index event_sequence on event ( event_sequence ) ");
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1147() {
-
- $r1 = q("alter table event add event_priority smallint not null default '0' ");
- $r2 = q("create index event_priority on event ( event_priority ) ");
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1148() {
- $r1 = q("alter table likes add i_mid char(255) not null default '' ");
- $r2 = q("create index i_mid on likes ( i_mid ) ");
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1149() {
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '',
- ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '',
- ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '',
- ADD obj_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
- ADD obj_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
- }
- else {
- $r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '',
- ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '',
- ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '',
- ADD obj_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
- ADD obj_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' ");
- }
-
- $r2 = q("create index obj_term on obj ( obj_term ) ");
- $r3 = q("create index obj_url on obj ( obj_url ) ");
- $r4 = q("create index obj_imgurl on obj ( obj_imgurl ) ");
- $r5 = q("create index obj_created on obj ( obj_created ) ");
- $r6 = q("create index obj_edited on obj ( obj_edited ) ");
- $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6;
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1150() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("ALTER TABLE app ADD app_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
- ADD app_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
- }
- else {
- $r1 = q("ALTER TABLE app ADD app_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
- ADD app_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' ");
- }
-
- $r2 = q("create index app_created on app ( app_created ) ");
- $r3 = q("create index app_edited on app ( app_edited ) ");
-
- $r = $r1 && $r2 && $r3;
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1151() {
-
- $r3 = q("select likes.*, item.mid from likes left join item on likes.iid = item.id");
- if($r3) {
- foreach($r3 as $rr) {
- q("update likes set i_mid = '%s' where id = $d",
- dbesc($rr['mid']),
- intval($rr['id'])
- );
- }
- }
-
-
- return UPDATE_SUCCESS;
-
-}
-
-function update_r1152() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
-
- $r1 = q("CREATE TABLE IF NOT EXISTS \"dreport\" (
- \"dreport_id\" serial NOT NULL,
- \"dreport_channel\" int(11) NOT NULL DEFAULT '0',
- \"dreport_mid\" char(255) NOT NULL DEFAULT '',
- \"dreport_site\" char(255) NOT NULL DEFAULT '',
- \"dreport_recip\" char(255) NOT NULL DEFAULT '',
- \"dreport_result\" char(255) NOT NULL DEFAULT '',
- \"dreport_time\" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
- \"dreport_xchan\" char(255) NOT NULL DEFAULT '',
- PRIMARY KEY (\"dreport_id\") ");
-
- $r2 = q("create index \"dreport_mid\" on dreport (\"dreport_mid\") ");
- $r3 = q("create index \"dreport_site\" on dreport (\"dreport_site\") ");
- $r4 = q("create index \"dreport_time\" on dreport (\"dreport_time\") ");
- $r5 = q("create index \"dreport_xchan\" on dreport (\"dreport_xchan\") ");
- $r6 = q("create index \"dreport_channel\" on dreport (\"dreport_channel\") ");
-
- $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6;
-
- }
- else {
- $r = q("CREATE TABLE IF NOT EXISTS `dreport` (
- `dreport_id` int(11) NOT NULL AUTO_INCREMENT,
- `dreport_channel` int(11) NOT NULL DEFAULT '0',
- `dreport_mid` char(255) NOT NULL DEFAULT '',
- `dreport_site` char(255) NOT NULL DEFAULT '',
- `dreport_recip` char(255) NOT NULL DEFAULT '',
- `dreport_result` char(255) NOT NULL DEFAULT '',
- `dreport_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
- `dreport_xchan` char(255) NOT NULL DEFAULT '',
- PRIMARY KEY (`dreport_id`),
- KEY `dreport_mid` (`dreport_mid`),
- KEY `dreport_site` (`dreport_site`),
- KEY `dreport_time` (`dreport_time`),
- KEY `dreport_xchan` (`dreport_xchan`),
- KEY `dreport_channel` (`dreport_channel`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
- }
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1153() {
-
- $r1 = q("ALTER TABLE dreport ADD dreport_queue CHAR( 255 ) NOT NULL DEFAULT '' ");
- $r2 = q("create index dreport_queue on dreport ( dreport_queue) ");
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-
-}
-
-function update_r1154() {
-
- $r = q("ALTER TABLE event ADD event_vdata text NOT NULL ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-
-function update_r1155() {
-
- $r1 = q("alter table site add site_type smallint not null default '0' ");
- $r2 = q("create index site_type on site ( site_type ) ");
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1156() {
- $r1 = q("ALTER TABLE mail ADD conv_guid CHAR( 255 ) NOT NULL DEFAULT '' ");
- $r2 = q("create index conv_guid on mail ( conv_guid ) ");
-
- $r3 = q("select mail.id, mail.convid, conv.guid from mail left join conv on mail.convid = conv.id where true");
- if($r3) {
- foreach($r3 as $rr) {
- if($rr['convid']) {
- q("update mail set conv_guid = '%s' where id = %d",
- dbesc($rr['guid']),
- intval($rr['id'])
- );
- }
- }
- }
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1157() {
- $r1 = q("alter table site add site_project char(255) not null default '' ");
- $r2 = q("create index site_project on site ( site_project ) ");
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-
-function update_r1158() {
- $r = q("select attach.id, attach.data, channel_address from attach left join channel on attach.uid = channel_id where os_storage = 1 and not attach.data like '%%store%%' ");
- if($r) {
- foreach($r as $rr) {
- $has_slash = ((substr($rr['data'],0,1) === '/') ? true : false);
- q("update attach set data = '%s' where id = %d",
- dbesc('store/' . $rr['channel_address']. (($has_slash) ? '' : '/' . $rr['data'])),
- dbesc($rr['id'])
- );
- }
- }
- return UPDATE_SUCCESS;
-}
-
-
-function update_r1159() {
- $r = q("select attach.id, attach.data, attach.hash, channel_address from attach left join channel on attach.uid = channel_id where os_storage = 1 ");
- if($r) {
- foreach($r as $rr) {
- $x = dbunescbin($rr['data']);
- $has_slash = (($x === 'store/' . $rr['channel_address'] . '/') ? true : false);
- if(($x === 'store/' . $rr['channel_address']) || ($has_slash)) {
- q("update attach set data = '%s' where id = %d",
- dbesc('store/' . $rr['channel_address']. (($has_slash) ? '' : '/' . $rr['hash'])),
- dbesc($rr['id'])
- );
- }
- }
- }
- return UPDATE_SUCCESS;
-}
-
-
-function update_r1160() {
- $r = q("alter table abook add abook_instance text not null default '' ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1161() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("CREATE TABLE \"iconfig\" (
- \"id\" serial NOT NULL,
- \"iid\" bigint NOT NULL DEFAULT '0',
- \"cat\" text NOT NULL DEFAULT '',
- \"k\" text NOT NULL DEFAULT '',
- \"v\" text NOT NULL DEFAULT '',
- PRIMARY_KEY(\"id\")
-) ");
-$r2 = q("create index \"iconfig_iid\" on iconfig (\"iid\") ");;
-$r3 = q("create index \"iconfig_cat\" on iconfig (\"cat\") ");
-$r4 = q("create index \"iconfig_k\" on iconfig (\"k\") ");
- $r = $r1 && $r2 && $r3 && $r4;
- }
- else {
- $r = q("CREATE TABLE IF NOT EXISTS `iconfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `iid` int(11) NOT NULL DEFAULT '0',
- `cat` char(255) NOT NULL DEFAULT '',
- `k` char(255) NOT NULL DEFAULT '',
- `v` mediumtext NOT NULL,
- PRIMARY KEY (`id`),
- KEY `iid` (`iid`),
- KEY `cat` (`cat`),
- KEY `k` (`k`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
- }
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1162() {
- $r1 = q("alter table iconfig add sharing int not null default '0' ");
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES)
- $r2 = q("create index \"iconfig_sharing\" on iconfig (\"sharing\") ");
- else
- $r2 = q("alter table iconfig add index ( sharing ) ");
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1163() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("alter table channel add channel_moved text not null default '' ");
- $r2 = q("create index \"channel_channel_moved\" on channel (\"channel_moved\") ");
- }
- else {
- $r1 = q("alter table channel add channel_moved char(255) not null default '' ");
- $r2 = q("alter table channel add index ( channel_moved ) ");
- }
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1164() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("CREATE TABLE \"abconfig\" (
- \"id\" serial NOT NULL,
- \"chan\" text NOT NULL,
- \"xchan\" text NOT NULL,
- \"cat\" text NOT NULL,
- \"k\" text NOT NULL,
- \"v\" text NOT NULL,
- PRIMARY KEY (\"id\") ");
- $r2 = q("create index \"abconfig_chan\" on abconfig (\"chan\") ");
- $r3 = q("create index \"abconfig_xchan\" on abconfig (\"xchan\") ");
- $r4 = q("create index \"abconfig_cat\" on abconfig (\"cat\") ");
- $r5 = q("create index \"abconfig_k\" on abconfig (\"k\") ");
- $r = $r1 && $r2 && $r3 && $r4 && $r5;
- }
- else {
- $r = q("CREATE TABLE IF NOT EXISTS `abconfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `chan` char(255) NOT NULL DEFAULT '',
- `xchan` char(255) NOT NULL DEFAULT '',
- `cat` char(255) NOT NULL DEFAULT '',
- `k` char(255) NOT NULL DEFAULT '',
- `v` mediumtext NOT NULL,
- PRIMARY KEY (`id`),
- KEY `chan` (`chan`),
- KEY `xchan` (`xchan`),
- KEY `cat` (`cat`),
- KEY `k` (`k`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
- }
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1165() {
-
- $r1 = q("alter table hook add hook_version int not null default '0' ");
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES)
- $r2 = q("create index \"hook_version_idx\" on hook (\"hook_version\") ");
- else
- $r2 = q("alter table hook add index ( hook_version ) ");
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1166() {
-
- $r = q("alter table source add src_tag text not null default '' ");
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1167() {
-
- $r1 = q("alter table app add app_deleted int not null default '0' ");
- $r2 = q("alter table app add app_system int not null default '0' ");
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r3 = q("create index \"app_deleted_idx\" on app (\"app_deleted\") ");
- $r4 = q("create index \"app_system_idx\" on app (\"app_system\") ");
- }
- else {
- $r3 = q("alter table app add index ( app_deleted ) ");
- $r4 = q("alter table app add index ( app_system ) ");
- }
-
- if($r1 && $r2 && $r3 && $r4)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1168() {
-
- $r1 = q("alter table obj add obj_quantity int not null default '0' ");
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r2 = q("create index \"obj_quantity_idx\" on obj (\"obj_quantity\") ");
- }
- else {
- $r2 = q("alter table obj add index ( obj_quantity ) ");
- }
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1169() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("ALTER TABLE `addon` CHANGE `timestamp` `tstamp` numeric( 20 ) UNSIGNED NOT NULL DEFAULT '0' ");
- $r2 = q("ALTER TABLE `addon` CHANGE `name` `aname` text NOT NULL DEFAULT '' ");
- $r3 = q("ALTER TABLE `hook` CHANGE `function` `fn` text NOT NULL DEFAULT '' ");
-
- }
- else {
- $r1 = q("ALTER TABLE `addon` CHANGE `timestamp` `tstamp` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0' ");
- $r2 = q("ALTER TABLE `addon` CHANGE `name` `aname` CHAR(255) NOT NULL DEFAULT '' ");
- $r3 = q("ALTER TABLE `hook` CHANGE `function` `fn` CHAR(255) NOT NULL DEFAULT '' ");
- }
-
- if($r1 && $r2 && $r3)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1170() {
-
- $r1 = q("drop table fcontact");
- $r2 = q("drop table ffinder");
- $r3 = q("drop table fserver");
- $r4 = q("drop table fsuggest");
- $r5 = q("drop table spam");
-
- if($r1 && $r2 && $r3 && $r4 && $r5)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1171() {
-
- $r1 = q("ALTER TABLE verify CHANGE `type` `vtype` varchar(32) NOT NULL DEFAULT '' ");
- $r2 = q("ALTER TABLE tokens CHANGE `scope` `auth_scope` varchar(512) NOT NULL DEFAULT '' ");
- $r3 = q("ALTER TABLE auth_codes CHANGE `scope` `auth_scope` varchar(512) NOT NULL DEFAULT '' ");
- $r4 = q("ALTER TABLE clients CHANGE `name` `clname` TEXT ");
- $r5 = q("ALTER TABLE session CHANGE `data` `sess_data` TEXT NOT NULL ");
- $r6 = q("ALTER TABLE register CHANGE `language` `lang` varchar(16) NOT NULL DEFAULT '' ");
-
- if($r1 && $r2 && $r3 && $r4 && $r5 && $r6)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-
-
-}
-
-function update_r1172() {
-
- $r1 = q("ALTER TABLE term CHANGE `type` `ttype` int(3) NOT NULL DEFAULT '0' ");
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r2 = q("ALTER TABLE groups CHANGE `name` `gname` TEXT NOT NULL ");
- $r3 = q("ALTER TABLE profile CHANGE `name` `fullname` TEXT NOT NULL ");
- $r4 = q("ALTER TABLE profile CHANGE `with` `partner` TEXT NOT NULL ");
- $r5 = q("ALTER TABLE profile CHANGE `work` `employment` TEXT NOT NULL ");
- }
- else {
- $r2 = q("ALTER TABLE groups CHANGE `name` `gname` char(255) NOT NULL DEFAULT '' ");
- $r3 = q("ALTER TABLE profile CHANGE `name` `fullname` char(255) NOT NULL DEFAULT '' ");
- $r4 = q("ALTER TABLE profile CHANGE `with` `partner` char(255) NOT NULL DEFAULT '' ");
- $r5 = q("ALTER TABLE profile CHANGE `work` `employment` TEXT NOT NULL ");
- }
- if($r1 && $r2 && $r3 && $r4 && $r5)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1173() {
-
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("ALTER TABLE notify CHANGE `name` `xname` TEXT NOT NULL ");
- $r2 = q("ALTER TABLE notify CHANGE `date` `created` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
- $r3 = q("ALTER TABLE notify CHANGE `type` `ntype` numeric(3) NOT NULL DEFAULT '0' ");
- }
- else {
- $r1 = q("ALTER TABLE notify CHANGE `name` `xname` char(255) NOT NULL DEFAULT '' ");
- $r2 = q("ALTER TABLE notify CHANGE `date` `created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' ");
- $r3 = q("ALTER TABLE notify CHANGE `type` `ntype` smallint(3) NOT NULL DEFAULT '0' ");
- }
-
- if($r1 && $r2 && $r3)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1174() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("ALTER TABLE event CHANGE `type` `etype` varchar(255) NOT NULL DEFAULT '' ");
- $r2 = q("ALTER TABLE event CHANGE `start` `dtstart` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
- $r3 = q("ALTER TABLE event CHANGE `finish` `dtend` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
- $r4 = q("ALTER TABLE event CHANGE `ignore` `dismissed` numeric(1) NOT NULL DEFAULT '0' ");
- $r5 = q("ALTER TABLE attach CHANGE `data` `content` bytea NOT NULL ");
- $r6 = q("ALTER TABLE photo CHANGE `data` `content` bytea NOT NULL ");
- }
- else {
- $r1 = q("ALTER TABLE event CHANGE `type` `etype` char(255) NOT NULL DEFAULT '' ");
- $r2 = q("ALTER TABLE event CHANGE `start` `dtstart` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' ");
- $r3 = q("ALTER TABLE event CHANGE `finish` `dtend` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' ");
- $r4 = q("ALTER TABLE event CHANGE `ignore` `dismissed` tinyint(1) NOT NULL DEFAULT '0' ");
- $r5 = q("ALTER TABLE attach CHANGE `data` `content` longblob NOT NULL ");
- $r6 = q("ALTER TABLE photo CHANGE `data` `content` mediumblob NOT NULL ");
- }
-
- if($r1 && $r2 && $r3 && $r4 && $r5 && $r6)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1175() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("ALTER TABLE item CHANGE `object` `obj` text NOT NULL");
- $r2 = q("ALTER TABLE photo CHANGE `size` `filesize` bigint NOT NULL DEFAULT '0' ");
- $r3 = q("ALTER TABLE photo CHANGE `scale` `imgscale` numeric(3) NOT NULL DEFAULT '0' ");
- $r4 = q("ALTER TABLE photo CHANGE `type` `mimetype` varchar(128) NOT NULL DEFAULT 'image/jpeg' ");
-
- }
- else {
- $r1 = q("ALTER TABLE item CHANGE `object` `obj` text NOT NULL");
- $r2 = q("ALTER TABLE photo CHANGE `size` `filesize` int(10) unsigned NOT NULL DEFAULT '0' ");
- $r3 = q("ALTER TABLE photo CHANGE `scale` `imgscale` tinyint(3) unsigned NOT NULL DEFAULT '0' ");
- $r4 = q("ALTER TABLE photo CHANGE `type` `mimetype` char(128) NOT NULL DEFAULT 'image/jpeg' ");
-
- }
-
- if($r1 && $r2 && $r3 && $r4)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-
-function update_r1176() {
-
- $r = q("select * from item_id where true");
- if($r) {
- foreach($r as $rr) {
- \Zotlabs\Lib\IConfig::Set($rr['iid'],'system',$rr['service'],$rr['sid'],true);
- }
- }
- return UPDATE_SUCCESS;
-
-}
-
-function update_r1177() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("alter table event add cal_id bigint NOT NULL DEFAULT '0'");
- $r2 = q("create index \"event_cal_idx\" on event (\"cal_id\") ");
-
- $r3 = q("CREATE TABLE \"cal\" (
- \"cal_id\" serial NOT NULL,
- \"cal_aid\" bigint NOT NULL DEFAULT '0',
- \"cal_uid\" bigint NOT NULL DEFAULT '0',
- \"cal_hash\" text NOT NULL,
- \"cal_name\" text NOT NULL,
- \"uri\" text NOT NULL,
- \"logname\" text NOT NULL,
- \"pass\" text NOT NULL,
- \"ctag\" text NOT NULL,
- \"synctoken\" text NOT NULL,
- \"cal_types\" text NOT NULL,
- PRIMARY KEY (\"cal_id\") ");
- $r4 = q("create index \"cal_hash_idx\" on cal (\"cal_hash\") ");
- $r5 = q("create index \"cal_name_idx\" on cal (\"cal_name\") ");
- $r6 = q("create index \"cal_types_idx\" on cal (\"cal_types\") ");
- $r7 = q("create index \"cal_aid_idx\" on cal (\"cal_aid\") ");
- $r8 = q("create index \"cal_uid_idx\" on cal (\"cal_uid\") ");
- $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6 && $r7 && $r8;
- }
- else {
- $r1 = q("alter table event add cal_id int(10) unsigned NOT NULL DEFAULT '0',
- add index ( cal_id ) ");
-
- $r2 = q("CREATE TABLE IF NOT EXISTS `cal` (
- `cal_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `cal_aid` int(10) unsigned NOT NULL DEFAULT '0',
- `cal_uid` int(10) unsigned NOT NULL DEFAULT '0',
- `cal_hash` varchar(255) NOT NULL DEFAULT '',
- `cal_name` varchar(255) NOT NULL DEFAULT '',
- `uri` varchar(255) NOT NULL DEFAULT '',
- `logname` varchar(255) NOT NULL DEFAULT '',
- `pass` varchar(255) NOT NULL DEFAULT '',
- `ctag` varchar(255) NOT NULL DEFAULT '',
- `synctoken` varchar(255) NOT NULL DEFAULT '',
- `cal_types` varchar(255) NOT NULL DEFAULT '',
- PRIMARY KEY (`cal_id`),
- KEY `cal_aid` (`cal_aid`),
- KEY `cal_uid` (`cal_uid`),
- KEY `cal_hash` (`cal_hash`),
- KEY `cal_name` (`cal_name`),
- KEY `cal_types` (`cal_types`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
-
- $r = $r1 && $r2;
- }
-
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1178() {
-
- $c2 = null;
-
- $c1 = q("SELECT channel_id, channel_hash from channel where true");
- if($c1) {
- $c2 = q("SELECT id, chan from abconfig where true");
- if($c2) {
- for($x = 0; $x < count($c2); $x ++) {
- foreach($c1 as $c) {
- if($c['channel_hash'] == $c2[$x]['chan']) {
- $c2[$x]['chan'] = $c['channel_id'];
- break;
- }
- }
- }
- }
- }
-
- $r1 = q("ALTER TABLE abconfig CHANGE chan chan int(10) unsigned NOT NULL DEFAULT '0' ");
-
- if($c2) {
- foreach($c2 as $c) {
- q("UPDATE abconfig SET chan = %d where id = %d",
- intval($c['chan']),
- intval($c['id'])
- );
- }
- }
-
- if($r1)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1179() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("CREATE TABLE atoken (
- atoken_id serial NOT NULL,
- atoken_aid bigint NOT NULL DEFAULT 0,
- atoken_uid bigint NOT NULL DEFAULT 0,
- atoken_name varchar(255) NOT NULL DEFAULT '',
- atoken_token varchar(255) NOT NULL DEFAULT '',
- atoken_expires timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
- PRIMARY KEY (atoken_id)) ");
- $r2 = q("create index atoken_aid on atoken (atoken_aid)");
- $r3 = q("create index atoken_uid on atoken (atoken_uid)");
- $r4 = q("create index atoken_name on atoken (atoken_name)");
- $r5 = q("create index atoken_token on atoken (atoken_token)");
- $r6 = q("create index atoken_expires on atoken (atoken_expires)");
-
- $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6;
-
- }
- else {
- $r = q("CREATE TABLE IF NOT EXISTS `atoken` (
- `atoken_id` int(11) NOT NULL AUTO_INCREMENT,
- `atoken_aid` int(11) NOT NULL DEFAULT 0,
- `atoken_uid` int(11) NOT NULL DEFAULT 0,
- `atoken_name` char(255) NOT NULL DEFAULT '',
- `atoken_token` char(255) NOT NULL DEFAULT '',
- `atoken_expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
- PRIMARY KEY (`atoken_id`),
- KEY `atoken_aid` (`atoken_aid`),
- KEY `atoken_uid` (`atoken_uid`),
- KEY `atoken_name` (`atoken_name`),
- KEY `atoken_token` (`atoken_token`),
- KEY `atoken_expires` (`atoken_expires`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
- }
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1180() {
-
- require_once('include/perm_upgrade.php');
-
- $r1 = q("select * from channel where true");
- if($r1) {
- foreach($r1 as $rr) {
- perm_limits_upgrade($rr);
- autoperms_upgrade($rr);
- }
- }
-
- $r2 = q("select * from abook where true");
- if($r2) {
- foreach($r2 as $rr) {
- perm_abook_upgrade($rr);
- }
- }
-
- $r = $r1 && $r2;
- if($r)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1181() {
- if(\Zotlabs\Lib\System::get_server_role() == 'pro') {
- q("update account set account_level = 5 where true");
- }
- return UPDATE_SUCCESS;
-}
-
-function update_r1182() {
-
- $r1 = q("alter table site add site_version varchar(32) not null default '' ");
-
- if($r1)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1183() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("alter table hook ALTER COLUMN priority TYPE smallint");
- $r2 = q("alter table hook ALTER COLUMN priority SET NOT NULL");
- $r3 = q("alter table hook ALTER COLUMN priority SET DEFAULT '0'");
- $r1 = $r1 && $r2 && $r3;
- }
- else {
- $r1 = q("alter table hook CHANGE priority priority smallint NOT NULL DEFAULT '0' ");
- }
- $r2 = q("create index priority_idx on hook (priority)");
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1184() {
-
- $r1 = q("alter table site add site_crypto text not null default '' ");
-
- if($r1)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1185() {
-
- $r1 = q("alter table app add app_plugin text not null default '' ");
-
- if($r1)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1186() {
-
- $r1 = q("alter table profile add profile_vcard text not null");
-
- if($r1)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-
-}
-
-function update_r1187() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("alter table outq add outq_scheduled timestamp not null default '0001-01-01 00:00:00' ");
- }
- else {
- $r1 = q("alter table outq add outq_scheduled datetime not null default '0001-01-01 00:00:00' ");
- }
- $r2 = q("create index outq_scheduled_idx on outq (outq_scheduled)");
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-
-}
-
-function update_r1188() {
-
- $r1 = q("alter table channel add channel_password varchar(255) not null default '' ");
- $r2 = q("alter table channel add channel_salt varchar(255) not null default '' ");
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1189() {
-
- $r1 = q("alter table mail add mail_mimetype varchar(64) not null default 'text/bbcode' ");
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r2 = q("alter table mail add mail_raw smallint not null default 0 ");
- }
- else {
- $r2 = q("alter table mail add mail_raw tinyint(4) not null default 0 ");
- }
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-
-}
-
-function update_r1190() {
- $r1 = q("alter table abook add abook_not_here smallint not null default 0 ");
-
- $r2 = q("create index abook_not_here on abook (abook_not_here)");
-
- if($r1 && $r2)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1191() {
-
- $r = q("SELECT 1 FROM principals LIMIT 1");
-
- if($r !== false) {
- return UPDATE_SUCCESS;
- }
- else {
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("CREATE TABLE addressbooks (
- id SERIAL NOT NULL,
- principaluri VARCHAR(255),
- displayname VARCHAR(255),
- uri VARCHAR(200),
- description TEXT,
- synctoken INTEGER NOT NULL DEFAULT 1
- );"
- );
-
- $r2 = q("ALTER TABLE ONLY addressbooks ADD CONSTRAINT addressbooks_pkey PRIMARY KEY (id);");
-
- $r3 = q("CREATE UNIQUE INDEX addressbooks_ukey ON addressbooks USING btree (principaluri, uri);");
-
- $r4 = q("CREATE TABLE cards (
- id SERIAL NOT NULL,
- addressbookid INTEGER NOT NULL,
- carddata BYTEA,
- uri VARCHAR(200),
- lastmodified INTEGER,
- etag VARCHAR(32),
- size INTEGER NOT NULL
- );"
- );
-
- $r5 = q("ALTER TABLE ONLY cards ADD CONSTRAINT cards_pkey PRIMARY KEY (id);");
-
- $r6 = q("CREATE UNIQUE INDEX cards_ukey ON cards USING btree (addressbookid, uri);");
-
- $r7 = q("CREATE TABLE addressbookchanges (
- id SERIAL NOT NULL,
- uri VARCHAR(200) NOT NULL,
- synctoken INTEGER NOT NULL,
- addressbookid INTEGER NOT NULL,
- operation SMALLINT NOT NULL
- );"
- );
-
- $r8 = q("ALTER TABLE ONLY addressbookchanges ADD CONSTRAINT addressbookchanges_pkey PRIMARY KEY (id);");
-
- $r9 = q("CREATE INDEX addressbookchanges_addressbookid_synctoken_ix ON addressbookchanges USING btree (addressbookid, synctoken);");
-
- $r10 = q("CREATE TABLE calendarobjects (
- id SERIAL NOT NULL,
- calendardata BYTEA,
- uri VARCHAR(200),
- calendarid INTEGER NOT NULL,
- lastmodified INTEGER,
- etag VARCHAR(32),
- size INTEGER NOT NULL,
- componenttype VARCHAR(8),
- firstoccurence INTEGER,
- lastoccurence INTEGER,
- uid VARCHAR(200)
- );"
- );
-
- $r11 = q("ALTER TABLE ONLY calendarobjects ADD CONSTRAINT calendarobjects_pkey PRIMARY KEY (id);");
-
- $r12 = q("CREATE UNIQUE INDEX calendarobjects_ukey ON calendarobjects USING btree (calendarid, uri);");
-
- $r13 = q("CREATE TABLE calendars (
- id SERIAL NOT NULL,
- synctoken INTEGER NOT NULL DEFAULT 1,
- components VARCHAR(21)
- );"
- );
-
- $r14 = q("ALTER TABLE ONLY calendars ADD CONSTRAINT calendars_pkey PRIMARY KEY (id);");
-
- $r15 = q("CREATE TABLE calendarinstances (
- id SERIAL NOT NULL,
- calendarid INTEGER NOT NULL,
- principaluri VARCHAR(100),
- access SMALLINT NOT NULL DEFAULT '1', -- '1 = owner, 2 = read, 3 = readwrite'
- displayname VARCHAR(100),
- uri VARCHAR(200),
- description TEXT,
- calendarorder INTEGER NOT NULL DEFAULT 0,
- calendarcolor VARCHAR(10),
- timezone TEXT,
- transparent SMALLINT NOT NULL DEFAULT '0',
- share_href VARCHAR(100),
- share_displayname VARCHAR(100),
- share_invitestatus SMALLINT NOT NULL DEFAULT '2' -- '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid'
- );"
- );
-
- $r16 = q("ALTER TABLE ONLY calendarinstances ADD CONSTRAINT calendarinstances_pkey PRIMARY KEY (id);");
-
- $r17 = q("CREATE UNIQUE INDEX calendarinstances_principaluri_uri ON calendarinstances USING btree (principaluri, uri);");
-
- $r18 = q("CREATE UNIQUE INDEX calendarinstances_principaluri_calendarid ON calendarinstances USING btree (principaluri, calendarid);");
-
- $r19 = q("CREATE UNIQUE INDEX calendarinstances_principaluri_share_href ON calendarinstances USING btree (principaluri, share_href);");
-
- $r20 = q("CREATE TABLE calendarsubscriptions (
- id SERIAL NOT NULL,
- uri VARCHAR(200) NOT NULL,
- principaluri VARCHAR(100) NOT NULL,
- source TEXT,
- displayname VARCHAR(100),
- refreshrate VARCHAR(10),
- calendarorder INTEGER NOT NULL DEFAULT 0,
- calendarcolor VARCHAR(10),
- striptodos SMALLINT NULL,
- stripalarms SMALLINT NULL,
- stripattachments SMALLINT NULL,
- lastmodified INTEGER
- );"
- );
-
- $r21 = q("ALTER TABLE ONLY calendarsubscriptions ADD CONSTRAINT calendarsubscriptions_pkey PRIMARY KEY (id);");
-
- $r22 = q("CREATE UNIQUE INDEX calendarsubscriptions_ukey ON calendarsubscriptions USING btree (principaluri, uri);");
-
- $r23 = q("CREATE TABLE calendarchanges (
- id SERIAL NOT NULL,
- uri VARCHAR(200) NOT NULL,
- synctoken INTEGER NOT NULL,
- calendarid INTEGER NOT NULL,
- operation SMALLINT NOT NULL DEFAULT 0
- );"
- );
-
- $r24 = q("ALTER TABLE ONLY calendarchanges ADD CONSTRAINT calendarchanges_pkey PRIMARY KEY (id);");
-
- $r25 = q("CREATE INDEX calendarchanges_calendarid_synctoken_ix ON calendarchanges USING btree (calendarid, synctoken);");
-
- $r26 = q("CREATE TABLE schedulingobjects (
- id SERIAL NOT NULL,
- principaluri VARCHAR(255),
- calendardata BYTEA,
- uri VARCHAR(200),
- lastmodified INTEGER,
- etag VARCHAR(32),
- size INTEGER NOT NULL
- );"
- );
-
- $r27 = q("CREATE TABLE locks (
- id SERIAL NOT NULL,
- owner VARCHAR(100),
- timeout INTEGER,
- created INTEGER,
- token VARCHAR(100),
- scope SMALLINT,
- depth SMALLINT,
- uri TEXT
- );"
- );
-
- $r28 = q("ALTER TABLE ONLY locks ADD CONSTRAINT locks_pkey PRIMARY KEY (id);");
-
- $r29 = q("CREATE INDEX locks_token_ix ON locks USING btree (token);");
-
- $r30 = q("CREATE INDEX locks_uri_ix ON locks USING btree (uri);");
-
- $r31 = q("CREATE TABLE principals (
- id SERIAL NOT NULL,
- uri VARCHAR(200) NOT NULL,
- email VARCHAR(80),
- displayname VARCHAR(80)
- );"
- );
-
- $r32 = q("ALTER TABLE ONLY principals ADD CONSTRAINT principals_pkey PRIMARY KEY (id);");
-
- $r33 = q("CREATE UNIQUE INDEX principals_ukey ON principals USING btree (uri);");
-
- $r34 = q("CREATE TABLE groupmembers (
- id SERIAL NOT NULL,
- principal_id INTEGER NOT NULL,
- member_id INTEGER NOT NULL
- );"
- );
-
- $r35 = q("ALTER TABLE ONLY groupmembers ADD CONSTRAINT groupmembers_pkey PRIMARY KEY (id);");
-
- $r36 = q("CREATE UNIQUE INDEX groupmembers_ukey ON groupmembers USING btree (principal_id, member_id);");
-
- $r37 = q("CREATE TABLE propertystorage (
- id SERIAL NOT NULL,
- path VARCHAR(1024) NOT NULL,
- name VARCHAR(100) NOT NULL,
- valuetype INT,
- value BYTEA
- );"
- );
-
- $r38 = q("ALTER TABLE ONLY propertystorage ADD CONSTRAINT propertystorage_pkey PRIMARY KEY (id);");
-
- $r39 = q("CREATE UNIQUE INDEX propertystorage_ukey ON propertystorage (path, name);");
-
- $r40 = q("CREATE TABLE users (
- id SERIAL NOT NULL,
- username VARCHAR(50),
- digesta1 VARCHAR(32)
- );"
- );
-
- $r41 = q("ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY KEY (id);");
-
- $r42 = q("CREATE UNIQUE INDEX users_ukey ON users USING btree (username);");
-
- if(
- $r1 && $r2 && $r3 && $r4 && $r5 && $r6 && $r7 && $r8 && $r9 && $r10
- && $r11 && $r12 && $r13 && $r14 && $r15 && $r16 && $r17 && $r18 && $r19 && $r20
- && $r21 && $r22 && $r23 && $r24 && $r25 && $r26 && $r27 && $r28 && $r29 && $r30
- && $r31 && $r32 && $r33 && $r34 && $r35 && $r36 && $r37 && $r38 && $r39 && $r40
- && $r41 && $r42
- )
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
- }
- else {
- $r1 = q("CREATE TABLE if not exists addressbooks (
- id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- principaluri VARBINARY(255),
- displayname VARCHAR(255),
- uri VARBINARY(200),
- description TEXT,
- synctoken INT(11) UNSIGNED NOT NULL DEFAULT '1',
- UNIQUE(principaluri(100), uri(100))
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- $r2 = q("CREATE TABLE if not exists cards (
- id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- addressbookid INT(11) UNSIGNED NOT NULL,
- carddata MEDIUMBLOB,
- uri VARBINARY(200),
- lastmodified INT(11) UNSIGNED,
- etag VARBINARY(32),
- size INT(11) UNSIGNED NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- $r3 = q("CREATE TABLE if not exists addressbookchanges (
- id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- uri VARBINARY(200) NOT NULL,
- synctoken INT(11) UNSIGNED NOT NULL,
- addressbookid INT(11) UNSIGNED NOT NULL,
- operation TINYINT(1) NOT NULL,
- INDEX addressbookid_synctoken (addressbookid, synctoken)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- $r4 = q("CREATE TABLE if not exists calendarobjects (
- id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- calendardata MEDIUMBLOB,
- uri VARBINARY(200),
- calendarid INTEGER UNSIGNED NOT NULL,
- lastmodified INT(11) UNSIGNED,
- etag VARBINARY(32),
- size INT(11) UNSIGNED NOT NULL,
- componenttype VARBINARY(8),
- firstoccurence INT(11) UNSIGNED,
- lastoccurence INT(11) UNSIGNED,
- uid VARBINARY(200),
- UNIQUE(calendarid, uri),
- INDEX calendarid_time (calendarid, firstoccurence)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- $r5 = q("CREATE TABLE if not exists calendars (
- id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- synctoken INTEGER UNSIGNED NOT NULL DEFAULT '1',
- components VARBINARY(21)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- $r6 = q("CREATE TABLE if not exists calendarinstances (
- id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- calendarid INTEGER UNSIGNED NOT NULL,
- principaluri VARBINARY(100),
- access TINYINT(1) NOT NULL DEFAULT '1' COMMENT '1 = owner, 2 = read, 3 = readwrite',
- displayname VARCHAR(100),
- uri VARBINARY(200),
- description TEXT,
- calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0',
- calendarcolor VARBINARY(10),
- timezone TEXT,
- transparent TINYINT(1) NOT NULL DEFAULT '0',
- share_href VARBINARY(100),
- share_displayname VARCHAR(100),
- share_invitestatus TINYINT(1) NOT NULL DEFAULT '2' COMMENT '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid',
- UNIQUE(principaluri, uri),
- UNIQUE(calendarid, principaluri),
- UNIQUE(calendarid, share_href)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- $r7 = q("CREATE TABLE if not exists calendarchanges (
- id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- uri VARBINARY(200) NOT NULL,
- synctoken INT(11) UNSIGNED NOT NULL,
- calendarid INT(11) UNSIGNED NOT NULL,
- operation TINYINT(1) NOT NULL,
- INDEX calendarid_synctoken (calendarid, synctoken)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- $r8 = q("CREATE TABLE if not exists calendarsubscriptions (
- id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- uri VARBINARY(200) NOT NULL,
- principaluri VARBINARY(100) NOT NULL,
- source TEXT,
- displayname VARCHAR(100),
- refreshrate VARCHAR(10),
- calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0',
- calendarcolor VARBINARY(10),
- striptodos TINYINT(1) NULL,
- stripalarms TINYINT(1) NULL,
- stripattachments TINYINT(1) NULL,
- lastmodified INT(11) UNSIGNED,
- UNIQUE(principaluri, uri)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- $r9 = q("CREATE TABLE if not exists schedulingobjects (
- id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- principaluri VARBINARY(255),
- calendardata MEDIUMBLOB,
- uri VARBINARY(200),
- lastmodified INT(11) UNSIGNED,
- etag VARBINARY(32),
- size INT(11) UNSIGNED NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- $r10 = q("CREATE TABLE if not exists locks (
- id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- owner VARCHAR(100),
- timeout INTEGER UNSIGNED,
- created INTEGER,
- token VARBINARY(100),
- scope TINYINT,
- depth TINYINT,
- uri VARBINARY(1000),
- INDEX(token),
- INDEX(uri(100))
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- $r11 = q("CREATE TABLE if not exists principals (
- id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- uri VARBINARY(200) NOT NULL,
- email VARBINARY(80),
- displayname VARCHAR(80),
- UNIQUE(uri)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- $r12 = q("CREATE TABLE if not exists groupmembers (
- id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- principal_id INTEGER UNSIGNED NOT NULL,
- member_id INTEGER UNSIGNED NOT NULL,
- UNIQUE(principal_id, member_id)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- $r13 = q("CREATE TABLE if not exists propertystorage (
- id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- path VARBINARY(1024) NOT NULL,
- name VARBINARY(100) NOT NULL,
- valuetype INT UNSIGNED,
- value MEDIUMBLOB
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- $r14 = q("CREATE UNIQUE INDEX path_property ON propertystorage (path(600), name(100));");
-
- $r15 = q("CREATE TABLE if not exists users (
- id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- username VARBINARY(50),
- digesta1 VARBINARY(32),
- UNIQUE(username)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- $r16 = q("CREATE TABLE if not exists calendarinstances (
- id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- calendarid INTEGER UNSIGNED NOT NULL,
- principaluri VARBINARY(100),
- access TINYINT(1) NOT NULL DEFAULT '1' COMMENT '1 = owner, 2 = read, 3 = readwrite',
- displayname VARCHAR(100),
- uri VARBINARY(200),
- description TEXT,
- calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0',
- calendarcolor VARBINARY(10),
- timezone TEXT,
- transparent TINYINT(1) NOT NULL DEFAULT '0',
- share_href VARBINARY(100),
- share_displayname VARCHAR(100),
- share_invitestatus TINYINT(1) NOT NULL DEFAULT '2' COMMENT '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid',
- UNIQUE(principaluri, uri),
- UNIQUE(calendarid, principaluri),
- UNIQUE(calendarid, share_href)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
- );
-
- if($r1 && $r2 && $r3 && $r4 && $r5 && $r6 && $r7 && $r8 && $r9 && $r10 && $r11 && $r12 && $r13 && $r14 && $r15 && $r16)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
- }
- }
-}
-
-function update_r1192() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("CREATE INDEX item_obj_type ON item (obj_type)");
- }
- else {
- $r1 = q("ALTER TABLE item ADD INDEX (obj_type)");
- }
-
- if($r1)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1193() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("CREATE INDEX item_uid_unseen ON item (uid, item_unseen)");
- }
- else {
- $r1 = q("ALTER TABLE item ADD INDEX uid_item_unseen (uid, item_unseen)");
- }
-
- if($r1)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-
-function update_r1194() {
- $r = q("select id, resource_id from item where resource_type = 'nwiki'");
- if($r) {
- foreach($r as $rv) {
- $mimetype = get_iconfig($rv['id'],'wiki','mimeType');
- q("update item set mimetype = '%s' where resource_type = 'nwikipage' and resource_id = '%s'",
- dbesc($mimetype),
- dbesc($rv['resource_id'])
- );
- }
- }
-
- return UPDATE_SUCCESS;
-}
-
-function update_r1195() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("CREATE INDEX item_resource_id ON item (resource_id)");
- }
- else {
- $r1 = q("ALTER TABLE item ADD INDEX (resource_id)");
- }
-
- if($r1)
- return UPDATE_SUCCESS;
- return UPDATE_FAILED;
-}
-
-function update_r1196() {
-
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r1 = q("CREATE TABLE \"pchan\" (
- \"pchan_id\" serial NOT NULL,
- \"pchan_guid\" text NOT NULL,
- \"pchan_hash\" text NOT NULL,
- \"pchan_pubkey\" text NOT NULL,
- \"pchan_prvkey\" text NOT NULL,
- PRIMARY KEY (\"pchan_id\")
-)");
-
- $r2 = q("create index \"pchan_guid\" on pchan (\"pchan_guid\")");
- $r3 = q("create index \"pchan_hash\" on pchan (\"pchan_hash\")");
-
- if($r1 && $r2 && $r3) {
- return UPDATE_SUCCESS;
- }
- }
- else {
- $r1 = q("CREATE TABLE IF NOT EXISTS pchan (
- pchan_id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
- pchan_guid char(191) NOT NULL DEFAULT '',
- pchan_hash char(191) NOT NULL DEFAULT '',
- pchan_pubkey text NOT NULL,
- pchan_prvkey text NOT NULL,
- PRIMARY KEY (pchan_id),
- KEY pchan_guid (pchan_guid),
- KEY pchan_hash (pchan_hash)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");
- if($r1) {
- return UPDATE_SUCCESS;
- }
- }
-
- return UPDATE_FAILED;
-}
-
-function update_r1197() {
-
- $r = q("select diaspora_meta from item where true limit 1");
- if($r) {
- $r = q("ALTER TABLE item DROP diaspora_meta");
- }
-
- return UPDATE_SUCCESS;
-}
diff --git a/library/Mobile_Detect/Mobile_Detect.php b/library/Mobile_Detect/Mobile_Detect.php
deleted file mode 100644
index 4b8c9fecb..000000000
--- a/library/Mobile_Detect/Mobile_Detect.php
+++ /dev/null
@@ -1,221 +0,0 @@
-<?php
-/**
- * Mobile Detect
- * $Id: Mobile_Detect.php 49 2012-06-06 20:46:30Z serbanghita@gmail.com $
- *
- * @usage require_once 'Mobile_Detect.php';
- * $detect = new Mobile_Detect();
- * $detect->isMobile() or $detect->isTablet()
- *
- * For more specific usage see the documentation navigate to:
- * http://code.google.com/p/php-mobile-detect/wiki/Mobile_Detect
- *
- * @license http://www.opensource.org/licenses/mit-license.php The MIT License
- */
-
-class Mobile_Detect {
-
- protected $detectionRules;
- protected $userAgent = null;
- protected $accept = null;
- // Assume the visitor has a desktop environment.
- protected $isMobile = false;
- protected $isTablet = false;
- protected $phoneDeviceName = null;
- protected $tabletDevicename = null;
- protected $operatingSystemName = null;
- protected $userAgentName = null;
- // List of mobile devices (phones)
- protected $phoneDevices = array(
- 'iPhone' => '(iPhone.*Mobile|iPod|iTunes)',
- 'BlackBerry' => 'BlackBerry|rim[0-9]+',
- 'HTC' => 'HTC|HTC.*(6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT',
- 'Nexus' => 'Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus',
- 'Dell' => 'Dell.*Streak|Dell.*Aero|Dell.*Venue|DELL.*Venue Pro|Dell Flash|Dell Smoke|Dell Mini 3iX|XCD28|XCD35',
- 'Motorola' => '\bDroid\b.*Build|DROIDX|HRI39|MOT\-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT909|XT910|XT912|XT928',
- 'Samsung' => 'Samsung|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9300 |GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-P6810|GT-P7100|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100',
- 'Sony' => 'E10i|SonyEricsson|SonyEricssonLT15iv',
- 'Asus' => 'Asus.*Galaxy',
- 'Palm' => 'PalmSource|Palm', // avantgo|blazer|elaine|hiptop|plucker|xiino ; @todo - complete the regex.
- 'Vertu' => 'Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature', // Just for fun ;)
- 'GenericPhone' => '(mmp|pocket|psp|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|wap|nokia|Series40|Series60|S60|SonyEricsson|N900|PPC;|MAUI.*WAP.*Browser|LG-P500)'
- );
- // List of tablet devices.
- protected $tabletDevices = array(
- 'BlackBerryTablet' => 'PlayBook|RIM Tablet',
- 'iPad' => 'iPad|iPad.*Mobile', // @todo: check for mobile friendly emails topic.
- 'Kindle' => 'Kindle|Silk.*Accelerated',
- 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|GT-P1000|GT-P1010|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P1000|GT-P3100|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7300|GT-P7320|GT-P7500|GT-P7510|GT-P7511',
- 'HTCtablet' => 'HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200',
- 'MotorolaTablet' => 'xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617',
- 'AsusTablet' => 'Transformer|TF101',
- 'NookTablet' => 'NookColor|nook browser|BNTV250A|LogicPD Zoom2',
- 'AcerTablet' => 'Android.*\b(A100|A101|A200|A500|A501|A510|W500|W500P|W501|W501P)\b',
- 'YarvikTablet' => 'Android.*(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468)',
- 'GenericTablet' => 'Tablet(?!.*PC)|ViewPad7|LG-V909|MID7015|BNTV250A|LogicPD Zoom2|\bA7EB\b|CatNova8|A1_07|CT704|CT1002|\bM721\b',
- );
- // List of mobile Operating Systems.
- protected $operatingSystems = array(
- 'AndroidOS' => '(android.*mobile|android(?!.*mobile))',
- 'BlackBerryOS' => '(blackberry|rim tablet os)',
- 'PalmOS' => '(avantgo|blazer|elaine|hiptop|palm|plucker|xiino)',
- 'SymbianOS' => 'Symbian|SymbOS|Series60|Series40|\bS60\b',
- 'WindowsMobileOS' => 'IEMobile|Windows Phone|Windows CE.*(PPC|Smartphone)|MSIEMobile|Window Mobile|XBLWP7',
- 'iOS' => '(iphone|ipod|ipad)',
- 'FlashLiteOS' => '',
- 'JavaOS' => '',
- 'NokiaOS' => '',
- 'webOS' => '',
- 'badaOS' => '\bBada\b',
- 'BREWOS' => '',
- );
- // List of mobile User Agents.
- protected $userAgents = array(
- 'Chrome' => '\bCrMo\b|Chrome\/[.0-9]* Mobile',
- 'Dolfin' => '\bDolfin\b',
- 'Opera' => 'Opera.*Mini|Opera.*Mobi|Android.*Opera',
- 'Skyfire' => 'skyfire',
- 'IE' => 'IEMobile|MSIEMobile',
- 'Firefox' => 'fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile',
- 'Bolt' => 'bolt',
- 'TeaShark' => 'teashark',
- 'Blazer' => 'Blazer',
- 'Safari' => 'Mobile.*Safari|Safari.*Mobile',
- 'Midori' => 'midori',
- 'GenericBrowser' => 'NokiaBrowser|OviBrowser|SEMC.*Browser'
- );
-
- function __construct(){
-
- // Merge all rules together.
- $this->detectionRules = array_merge(
- $this->phoneDevices,
- $this->tabletDevices,
- $this->operatingSystems,
- $this->userAgents
- );
- $this->userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
- $this->accept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
-
- if (
- isset($_SERVER['HTTP_X_WAP_PROFILE']) ||
- isset($_SERVER['HTTP_X_WAP_CLIENTID']) ||
- isset($_SERVER['HTTP_WAP_CONNECTION']) ||
- isset($_SERVER['HTTP_PROFILE']) ||
- isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']) || // Reported by Nokia devices (eg. C3)
- isset($_SERVER['HTTP_X_NOKIA_IPADDRESS']) ||
- isset($_SERVER['HTTP_X_NOKIA_GATEWAY_ID']) ||
- isset($_SERVER['HTTP_X_ORANGE_ID']) ||
- isset($_SERVER['HTTP_X_VODAFONE_3GPDPCONTEXT']) ||
- isset($_SERVER['HTTP_X_HUAWEI_USERID']) ||
- isset($_SERVER['HTTP_UA_OS']) || // Reported by Windows Smartphones
- (isset($_SERVER['HTTP_UA_CPU']) && $_SERVER['HTTP_UA_CPU'] == 'ARM') // Seen this on a HTC
- ) {
- $this->isMobile = true;
- } elseif (!empty($this->accept) && (strpos($this->accept, 'text/vnd.wap.wml') !== false || strpos($this->accept, 'application/vnd.wap.xhtml+xml') !== false)) {
- $this->isMobile = true;
- } else {
- $this->_detect();
- }
-
- }
-
- public function getRules()
- {
- return $this->detectionRules;
- }
-
- /**
- * Magic overloading method.
- *
- * @method boolean is[...]()
- * @param string $name
- * @param array $arguments
- * @return mixed
- */
- public function __call($name, $arguments)
- {
-
- $key = substr($name, 2);
- return $this->_detect($key);
-
- }
-
- /**
- * Private method that does the detection of the
- * mobile devices.
- *
- * @param string $key
- * @return boolean|null
- */
- private function _detect($key='')
- {
-
- if(empty($key)){
-
- // Begin general search.
- foreach($this->detectionRules as $_regex){
- if(empty($_regex)){ continue; }
- if(preg_match('/'.$_regex.'/is', $this->userAgent)){
- $this->isMobile = true;
- return true;
- }
- }
- return false;
-
- } else {
-
- // Search for a certain key.
- // Make the keys lowecase so we can match: isIphone(), isiPhone(), isiphone(), etc.
- $key = strtolower($key);
- $_rules = array_change_key_case($this->detectionRules);
-
- if(array_key_exists($key, $_rules)){
- if(empty($_rules[$key])){ return null; }
- if(preg_match('/'.$_rules[$key].'/is', $this->userAgent)){
- $this->isMobile = true;
- return true;
- } else {
- return false;
- }
- } else {
- trigger_error("Method $key is not defined", E_USER_WARNING);
- }
-
- return false;
-
- }
-
- }
-
- /**
- * Check if the device is mobile.
- * Returns true if any type of mobile device detected, including special ones
- * @return bool
- */
- public function isMobile()
- {
- return $this->isMobile;
- }
-
- /**
- * Check if the device is a tablet.
- * Return true if any type of tablet device is detected.
- * @return boolean
- */
- public function isTablet()
- {
-
- foreach($this->tabletDevices as $_regex){
- if(preg_match('/'.$_regex.'/is', $this->userAgent)){
- $this->isTablet = true;
- return true;
- }
- }
-
- return false;
-
- }
-
-
-} \ No newline at end of file
diff --git a/tests/phpunit-pgsql.xml b/tests/phpunit-pgsql.xml
index ec4a6fc2d..078056d56 100644
--- a/tests/phpunit-pgsql.xml
+++ b/tests/phpunit-pgsql.xml
@@ -32,4 +32,15 @@
highLowerBound="70"/>
<log type="testdox-text" target="./results/testdox.txt"/>
</logging>
+ <php>
+ <!-- Default test database config, only used if no environment variables
+ with same names are set.
+ !!! Never run against a real database, it will truncate all tables -->
+ <env name="hz_db_server" value="127.0.0.1"/>
+ <env name="hz_db_scheme" value="pgsql"/>
+ <env name="hz_db_port" value="5432"/>
+ <env name="hz_db_user" value="travis_hz"/>
+ <env name="hz_db_pass" value="hubzilla"/>
+ <env name="hz_db_database" value="travis_hubzilla"/>
+ </php>
</phpunit>
diff --git a/tests/phpunit.xml.dist b/tests/phpunit.xml.dist
index a22317b08..97c84fb81 100644
--- a/tests/phpunit.xml.dist
+++ b/tests/phpunit.xml.dist
@@ -35,4 +35,15 @@
highLowerBound="70"/>
<log type="testdox-text" target="./results/testdox.txt"/>
</logging>
+ <php>
+ <!-- Default test database config, only used if no environment variables
+ with same names are set.
+ !!! Never run against a real database, it will truncate all tables -->
+ <env name="hz_db_server" value="127.0.0.1"/>
+ <env name="hz_db_scheme" value="mysql"/>
+ <env name="hz_db_port" value="3306"/>
+ <env name="hz_db_user" value="travis_hz"/>
+ <env name="hz_db_pass" value="hubzilla"/>
+ <env name="hz_db_database" value="travis_hubzilla"/>
+ </php>
</phpunit>
diff --git a/tests/travis/prepare_mysql.sh b/tests/travis/prepare_mysql.sh
index 095ad7e25..5b1c96d78 100755
--- a/tests/travis/prepare_mysql.sh
+++ b/tests/travis/prepare_mysql.sh
@@ -25,7 +25,7 @@
# Exit if anything fails
set -e
-echo "Preparing for MySQL ..."
+echo "Preparing for MySQL/MariaDB ..."
if [[ "$MYSQL_VERSION" == "5.7" ]]; then
echo "Using MySQL 5.7 in Docker container, need to use TCP"
@@ -41,13 +41,13 @@ mysql $PROTO -e "SHOW VARIABLES LIKE 'character_set%';"
mysql $PROTO -e "SELECT @@sql_mode;"
# Create Hubzilla database
-mysql $PROTO -u root -e "CREATE DATABASE IF NOT EXISTS hubzilla;";
-mysql $PROTO -u root -e "CREATE USER 'hubzilla'@'localhost' IDENTIFIED BY 'hubzilla';"
-mysql $PROTO -u root -e "GRANT ALL ON hubzilla.* TO 'hubzilla'@'localhost';"
+mysql $PROTO -u root -e "CREATE DATABASE IF NOT EXISTS travis_hubzilla;";
+mysql $PROTO -u root -e "CREATE USER 'travis_hz'@'%' IDENTIFIED BY 'hubzilla';"
+mysql $PROTO -u root -e "GRANT ALL ON travis_hubzilla.* TO 'travis_hz'@'%';"
# Import table structure
-mysql $PROTO -u root hubzilla < ./install/schema_mysql.sql
+mysql $PROTO -u root travis_hubzilla < ./install/schema_mysql.sql
# Show databases and tables
mysql $PROTO -u root -e "SHOW DATABASES;"
-mysql $PROTO -u root -e "USE hubzilla; SHOW TABLES;"
+mysql $PROTO -u root -e "USE travis_hubzilla; SHOW TABLES;"
diff --git a/tests/travis/prepare_pgsql.sh b/tests/travis/prepare_pgsql.sh
index 63c7388cb..0175b9858 100755
--- a/tests/travis/prepare_pgsql.sh
+++ b/tests/travis/prepare_pgsql.sh
@@ -33,12 +33,17 @@ psql --version
psql -U postgres -c "SELECT VERSION();"
# Create Hubzilla database
-psql -U postgres -c "DROP DATABASE IF EXISTS hubzilla;"
-psql -U postgres -c "CREATE DATABASE hubzilla;"
+psql -U postgres -c "DROP DATABASE IF EXISTS travis_hubzilla;"
+psql -U postgres -v ON_ERROR_STOP=1 <<-EOSQL
+ CREATE USER travis_hz WITH PASSWORD 'hubzilla';
+ CREATE DATABASE travis_hubzilla;
+ ALTER DATABASE travis_hubzilla OWNER TO travis_hz;
+ GRANT ALL PRIVILEGES ON DATABASE travis_hubzilla TO travis_hz;
+EOSQL
# Import table structure
-psql -U postgres -v ON_ERROR_STOP=1 hubzilla < ./install/schema_postgres.sql
+psql -U travis_hz -v ON_ERROR_STOP=1 travis_hubzilla < ./install/schema_postgres.sql
# Show databases and tables
psql -U postgres -l
-psql -U postgres -d hubzilla -c "\dt;"
+psql -U postgres -d travis_hubzilla -c "\dt;"
diff --git a/tests/unit/DatabaseTestCase.php b/tests/unit/DatabaseTestCase.php
new file mode 100644
index 000000000..18c1cfb17
--- /dev/null
+++ b/tests/unit/DatabaseTestCase.php
@@ -0,0 +1,68 @@
+<?php
+/* Copyright (c) 2017 Hubzilla
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+namespace Zotlabs\Tests\Unit;
+
+use PHPUnit\DbUnit\TestCaseTrait;
+use PHPUnit\Framework\TestCase;
+
+/**
+ * @brief Base class for our Database Unit Tests.
+ *
+ * @warning Never run these tests against a production database, because all
+ * tables will get truncated and there is no way to recover without a backup.
+ *
+ * @author Klaus Weidenbach
+ */
+abstract class DatabaseTestCase extends TestCase {
+
+ use TestCaseTrait;
+
+ /**
+ * Only instantiate PDO once for test clean-up/fixture load.
+ *
+ * @var \PDO
+ */
+ static private $pdo = null;
+
+ /**
+ * Only instantiate \PHPUnit\DbUnit\Database\Connection once per test.
+ *
+ * @var \PHPUnit\DbUnit\Database\Connection
+ */
+ private $conn = null;
+
+
+ final public function getConnection() {
+ if ($this->conn === null) {
+ if (self::$pdo === null) {
+ $dsn = \getenv('hz_db_scheme') . ':host=' . \getenv('hz_db_server')
+ . ';port=' . \getenv('hz_db_port') . ';dbname=' . \getenv('hz_db_database');
+
+ self::$pdo = new \PDO($dsn, \getenv('hz_db_user'), \getenv('hz_db_pass'));
+ }
+ $this->conn = $this->createDefaultDBConnection(self::$pdo, \getenv('hz_db_database'));
+ }
+
+ return $this->conn;
+ }
+}
diff --git a/tests/unit/includes/dba/DBATest.php b/tests/unit/includes/dba/DBATest.php
new file mode 100644
index 000000000..900d13083
--- /dev/null
+++ b/tests/unit/includes/dba/DBATest.php
@@ -0,0 +1,67 @@
+<?php
+/*
+ * Copyright (c) 2017 Hubzilla
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+namespace Zotlabs\Tests\Unit\includes;
+
+use Zotlabs\Tests\Unit\UnitTestCase;
+
+// required because of process isolation and no autoloading
+require_once 'include/dba/dba_driver.php';
+
+/**
+ * @brief Unit Test case for include/dba/DBA.php file.
+ *
+ * This test needs process isolation because of static \DBA.
+ * @runTestsInSeparateProcesses
+ */
+class DBATest extends UnitTestCase {
+
+ public function testDbaFactoryMysql() {
+ $this->assertNull(\DBA::$dba);
+
+ $ret = \DBA::dba_factory('server', 'port', 'user', 'pass', 'db', '0');
+ $this->assertInstanceOf('dba_pdo', $ret);
+ $this->assertFalse($ret->connected);
+
+ $this->assertSame('mysql', \DBA::$scheme);
+ $this->assertSame('schema_mysql.sql', \DBA::$install_script);
+ $this->assertSame('0001-01-01 00:00:00', \DBA::$null_date);
+ $this->assertSame('UTC_TIMESTAMP()', \DBA::$utc_now);
+ $this->assertSame('`', \DBA::$tquot);
+ }
+
+ public function testDbaFactoryPostgresql() {
+ $this->assertNull(\DBA::$dba);
+
+ $ret = \DBA::dba_factory('server', 'port', 'user', 'pass', 'db', '1');
+ $this->assertInstanceOf('dba_pdo', $ret);
+ $this->assertFalse($ret->connected);
+
+ $this->assertSame('pgsql', \DBA::$scheme);
+ $this->assertSame('schema_postgres.sql', \DBA::$install_script);
+ $this->assertSame('0001-01-01 00:00:00', \DBA::$null_date);
+ $this->assertSame("now() at time zone 'UTC'", \DBA::$utc_now);
+ $this->assertSame('"', \DBA::$tquot);
+ }
+
+}
diff --git a/tests/unit/includes/dba/_files/account.yml b/tests/unit/includes/dba/_files/account.yml
new file mode 100644
index 000000000..344bdb799
--- /dev/null
+++ b/tests/unit/includes/dba/_files/account.yml
@@ -0,0 +1,9 @@
+account:
+ -
+ account_id: 42
+ account_email: "hubzilla@example.com"
+ account_language: "no"
+ -
+ account_id: 43
+ account_email: "hubzilla@example.org"
+ account_language: "de"
diff --git a/tests/unit/includes/dba/dba_pdoTest.php b/tests/unit/includes/dba/dba_pdoTest.php
new file mode 100644
index 000000000..12e574d42
--- /dev/null
+++ b/tests/unit/includes/dba/dba_pdoTest.php
@@ -0,0 +1,189 @@
+<?php
+/*
+ * Copyright (c) 2017 Hubzilla
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+namespace Zotlabs\Tests\Unit\includes;
+
+use Zotlabs\Tests\Unit\DatabaseTestCase;
+use PHPUnit\DbUnit\TestCaseTrait;
+use PHPUnit\DbUnit\DataSet\YamlDataSet;
+
+require_once 'include/dba/dba_pdo.php';
+
+/**
+ * @brief Unit Test case for include/dba/dba_pdo.php file.
+ *
+ * Some very basic tests to see if our database layer can connect to a real
+ * database.
+ */
+class dba_pdoTest extends DatabaseTestCase {
+
+ use TestCaseTrait;
+
+ /**
+ * @var \dba_driver
+ */
+ protected $dba;
+
+
+ /**
+ * Set initial state of the database before each test is executed.
+ * Load database fixtures.
+ *
+ * @return \PHPUnit\DbUnit\DataSet\IDataSet
+ */
+ public function getDataSet() {
+ return new YamlDataSet(dirname(__FILE__) . '/_files/account.yml');
+ }
+
+ protected function setUp() {
+ // Will invoke getDataSet() to load fixtures into DB
+ parent::setUp();
+
+ $this->dba = new \dba_pdo(
+ \getenv('hz_db_server'),
+ \getenv('hz_db_scheme'),
+ \getenv('hz_db_port'),
+ \getenv('hz_db_user'),
+ \getenv('hz_db_pass'),
+ \getenv('hz_db_database')
+ );
+ }
+ protected function assertPreConditions() {
+ $this->assertSame('pdo', $this->dba->getdriver(), "Driver is expected to be 'pdo'.");
+ $this->assertInstanceOf('dba_driver', $this->dba);
+ $this->assertTrue($this->dba->connected, 'Pre condition failed, DB is not connected.');
+ $this->assertInstanceOf('PDO', $this->dba->db);
+ }
+ protected function tearDown() {
+ $this->dba = null;
+ }
+
+
+ /**
+ * @group mysql
+ */
+ public function testQuoteintervalOnMysql() {
+ $this->assertSame('value', $this->dba->quote_interval('value'));
+ }
+ /**
+ * @group postgresql
+ */
+ public function testQuoteintervalOnPostgresql() {
+ $this->assertSame("'value'", $this->dba->quote_interval('value'));
+ }
+
+ /**
+ * @group mysql
+ */
+ public function testGenerateMysqlConcatSql() {
+ $this->assertSame('GROUP_CONCAT(DISTINCT field SEPARATOR \';\')', $this->dba->concat('field', ';'));
+ $this->assertSame('GROUP_CONCAT(DISTINCT field2 SEPARATOR \' \')', $this->dba->concat('field2', ' '));
+ }
+ /**
+ * @group postgresql
+ */
+ public function testGeneratePostgresqlConcatSql() {
+ $this->assertSame('string_agg(field,\';\')', $this->dba->concat('field', ';'));
+ $this->assertSame('string_agg(field2,\' \')', $this->dba->concat('field2', ' '));
+ }
+
+
+ public function testConnectToSqlServer() {
+ // connect() is done in dba_pdo constructor which is called in setUp()
+ $this->assertTrue($this->dba->connected);
+ }
+
+ /**
+ * @depends testConnectToSqlServer
+ */
+ public function testCloseSqlServerConnection() {
+ $this->dba->close();
+
+ $this->assertNull($this->dba->db);
+ $this->assertFalse($this->dba->connected);
+ }
+
+ /**
+ * @depends testConnectToSqlServer
+ */
+ public function testSelectQueryShouldReturnArray() {
+ $ret = $this->dba->q('SELECT * FROM account');
+
+ $this->assertTrue(is_array($ret));
+ }
+
+ /**
+ * @depends testConnectToSqlServer
+ */
+ public function testInsertQueryShouldReturnPdostatement() {
+ // Fixture account.yml adds two entries to account table
+ $this->assertEquals(2, $this->getConnection()->getRowCount('account'), 'Pre-Condition');
+
+ $ret = $this->dba->q('INSERT INTO account
+ (account_id, account_email, account_language)
+ VALUES (100, \'insert@example.com\', \'de\')
+ ');
+ $this->assertInstanceOf('PDOStatement', $ret);
+
+ $this->assertEquals(3, $this->getConnection()->getRowCount('account'), 'Inserting failed');
+ }
+
+
+ public function testConnectToWrongSqlServer() {
+ $nodba = new \dba_pdo('wrongserver',
+ \getenv('hz_db_scheme'), \getenv('hz_db_port'),
+ \getenv('hz_db_user'), \getenv('hz_db_pass'),
+ \getenv('hz_db_database')
+ );
+
+ $this->assertSame('pdo', $nodba->getdriver());
+ $this->assertInstanceOf('dba_pdo', $nodba);
+ $this->assertFalse($nodba->connected);
+ $this->assertNull($nodba->db);
+
+ $this->assertFalse($nodba->q('SELECT * FROM account'));
+ }
+
+ /**
+ * @depends testConnectToSqlServer
+ */
+ public function testSelectQueryToNonExistentTableShouldReturnFalse() {
+ $ret = $this->dba->q('SELECT * FROM non_existent_table');
+
+ $this->assertFalse($ret);
+ }
+
+ /**
+ * @depends testConnectToSqlServer
+ */
+ public function testInsertQueryToNonExistentTableShouldReturnEmptyArray() {
+ $ret = $this->dba->q('INSERT INTO non_existent_table
+ (account_email, account_language)
+ VALUES (\'email@example.com\', \'en\')
+ ');
+
+ $this->assertNotInstanceOf('PDOStatement', $ret);
+ $this->isEmpty($ret);
+ }
+
+}
diff --git a/view/css/conversation.css b/view/css/conversation.css
index 77a600deb..f7ab3dcdd 100644
--- a/view/css/conversation.css
+++ b/view/css/conversation.css
@@ -286,7 +286,6 @@ img.smiley.emoji:hover {
height: 32px;
}
-
.checklist input {
margin: 0px;
vertical-align: middle;
@@ -296,6 +295,15 @@ img.smiley.emoji:hover {
padding: 15px;
}
+.view-summary {
+ margin-bottom: 1rem;
+}
+
+.view-article {
+ margin-top: 1rem;
+}
+
+
#filer_save {
margin-left: 15px;
}
diff --git a/view/css/mod_profile_photo.css b/view/css/mod_profile_photo.css
index 5540b5fae..1b7e15194 100644
--- a/view/css/mod_profile_photo.css
+++ b/view/css/mod_profile_photo.css
@@ -9,4 +9,12 @@
#profile-photo-submit-wrapper {
clear: both;
-} \ No newline at end of file
+}
+
+#profile-photo-wrapper {
+ height: 300px;
+ width: 300px;
+ max-width: 300px;
+ max-height: 300px;
+ overflow: hidden;
+}
diff --git a/view/css/mod_wiki.css b/view/css/mod_wiki.css
index 4e4c71e1d..e0b02b414 100644
--- a/view/css/mod_wiki.css
+++ b/view/css/mod_wiki.css
@@ -48,3 +48,24 @@ td i {
padding-right: 10px;
}
+pre code {
+ background: #F5F5F5;
+ font-family: Courier, monospace;
+ font-size: 1em;
+ padding: 1em 1.5em;
+ display: block;
+ white-space: pre-wrap;
+}
+
+code {
+ background: #F5F5F5;
+ font-family: Courier, monospace;
+ font-size: 1em;
+ display: inline;
+ padding: 0.2em 0.2em;
+ white-space: pre-wrap;
+}
+
+#wiki-content-container code {
+ background: #F5F5F5;
+} \ No newline at end of file
diff --git a/view/de-de/hmessages.po b/view/de-de/hmessages.po
index e7c962bbd..f68a96c22 100644
--- a/view/de-de/hmessages.po
+++ b/view/de-de/hmessages.po
@@ -12377,27 +12377,27 @@ msgstr "Ungespeicherte Änderungen. Bist Du sicher, dass Du diese Seite verlasse
#: ../../include/js_strings.php:27
msgid "timeago.prefixAgo"
-msgstr "timeago.prefixAgo"
+msgstr "vor"
#: ../../include/js_strings.php:28
msgid "timeago.prefixFromNow"
-msgstr " "
+msgstr "in"
#: ../../include/js_strings.php:29
-msgid "ago"
-msgstr "her"
+msgid "timeago.suffixAgo"
+msgstr "NONE"
#: ../../include/js_strings.php:30
-msgid "from now"
-msgstr "von jetzt"
+msgid "timeago.suffixFromNow"
+msgstr "NONE"
#: ../../include/js_strings.php:31
msgid "less than a minute"
-msgstr "weniger als eine Minute"
+msgstr "weniger als einer Minute"
#: ../../include/js_strings.php:32
msgid "about a minute"
-msgstr "ungefähr eine Minute"
+msgstr "ungefähr einer Minute"
#: ../../include/js_strings.php:33
#, php-format
@@ -12406,7 +12406,7 @@ msgstr "%d Minuten"
#: ../../include/js_strings.php:34
msgid "about an hour"
-msgstr "ungefähr eine Stunde"
+msgstr "ungefähr einer Stunde"
#: ../../include/js_strings.php:35
#, php-format
@@ -12415,30 +12415,30 @@ msgstr "ungefähr %d Stunden"
#: ../../include/js_strings.php:36
msgid "a day"
-msgstr "ein Tag"
+msgstr "einem Tag"
#: ../../include/js_strings.php:37
#, php-format
msgid "%d days"
-msgstr "%d Tage"
+msgstr "%d Tagen"
#: ../../include/js_strings.php:38
msgid "about a month"
-msgstr "ungefähr einen Monat"
+msgstr "ungefähr einem Monat"
#: ../../include/js_strings.php:39
#, php-format
msgid "%d months"
-msgstr "%d Monate"
+msgstr "%d Monaten"
#: ../../include/js_strings.php:40
msgid "about a year"
-msgstr "ungefähr ein Jahr"
+msgstr "ungefähr einem Jahr"
#: ../../include/js_strings.php:41
#, php-format
msgid "%d years"
-msgstr "%d Jahre"
+msgstr "%d Jahren"
#: ../../include/js_strings.php:42
msgid " "
diff --git a/view/de-de/hstrings.php b/view/de-de/hstrings.php
index 61db3fb5d..e87f660f0 100644
--- a/view/de-de/hstrings.php
+++ b/view/de-de/hstrings.php
@@ -1,7 +1,7 @@
<?php
-if(! function_exists("string_plural_select_de")) {
-function string_plural_select_de($n){
+if(! function_exists("string_plural_select_de_de")) {
+function string_plural_select_de_de($n){
return ($n != 1);;
}}
App::$rtl = 0;
@@ -2790,21 +2790,21 @@ App::$strings["Rate This Channel (this is public)"] = "Diesen Kanal bewerten (ö
App::$strings["Describe (optional)"] = "Beschreibung (optional)";
App::$strings["Please enter a link URL"] = "Gib eine URL ein:";
App::$strings["Unsaved changes. Are you sure you wish to leave this page?"] = "Ungespeicherte Änderungen. Bist Du sicher, dass Du diese Seite verlassen möchtest?";
-App::$strings["timeago.prefixAgo"] = "timeago.prefixAgo";
-App::$strings["timeago.prefixFromNow"] = " ";
-App::$strings["ago"] = "her";
-App::$strings["from now"] = "von jetzt";
-App::$strings["less than a minute"] = "weniger als eine Minute";
-App::$strings["about a minute"] = "ungefähr eine Minute";
+App::$strings["timeago.prefixAgo"] = "vor";
+App::$strings["timeago.prefixFromNow"] = "in";
+App::$strings["timeago.suffixAgo"] = "NONE";
+App::$strings["timeago.suffixFromNow"] = "NONE";
+App::$strings["less than a minute"] = "weniger als einer Minute";
+App::$strings["about a minute"] = "ungefähr einer Minute";
App::$strings["%d minutes"] = "%d Minuten";
-App::$strings["about an hour"] = "ungefähr eine Stunde";
+App::$strings["about an hour"] = "ungefähr einer Stunde";
App::$strings["about %d hours"] = "ungefähr %d Stunden";
-App::$strings["a day"] = "ein Tag";
-App::$strings["%d days"] = "%d Tage";
-App::$strings["about a month"] = "ungefähr einen Monat";
-App::$strings["%d months"] = "%d Monate";
-App::$strings["about a year"] = "ungefähr ein Jahr";
-App::$strings["%d years"] = "%d Jahre";
+App::$strings["a day"] = "einem Tag";
+App::$strings["%d days"] = "%d Tagen";
+App::$strings["about a month"] = "ungefähr einem Monat";
+App::$strings["%d months"] = "%d Monaten";
+App::$strings["about a year"] = "ungefähr einem Jahr";
+App::$strings["%d years"] = "%d Jahren";
App::$strings[" "] = " ";
App::$strings["timeago.numbers"] = "timeago.numbers";
App::$strings["__ctx:long__ May"] = "Mai";
diff --git a/view/js/main.js b/view/js/main.js
index 02b0f125c..f6fe475d8 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -357,6 +357,9 @@ function closeMenu(theID) {
function markRead(notifType) {
$.get('ping?f=&markRead='+notifType);
$('.' + notifType + '-button').hide();
+ $('#nav-' + notifType + '-sub').removeClass('show');
+ sessionStorage.removeItem(notifType + '_notifications_cache');
+ sessionStorage.removeItem('notification_open');
if(timer) clearTimeout(timer);
timer = setTimeout(updateInit,2000);
}
@@ -436,6 +439,7 @@ function handleNotifications(data) {
if(item == 0) {
$('.' + index + '-button').fadeOut();
+ sessionStorage.removeItem(index + '_notifications_cache');
} else {
$('.' + index + '-button').fadeIn();
$('.' + index + '-update').html(item);
diff --git a/view/js/mod_new_channel.js b/view/js/mod_new_channel.js
index e670e1a35..7ae59032a 100644
--- a/view/js/mod_new_channel.js
+++ b/view/js/mod_new_channel.js
@@ -1,5 +1,7 @@
$(document).ready(function() {
-// $("#id_permissions_role").sSelect();
+
+ $("#newchannel-submit-button").attr('disabled','disabled');
+
$("#id_name").blur(function() {
$("#name-spinner").show();
var zreg_name = $("#id_name").val();
@@ -13,17 +15,26 @@
});
});
- $("#id_nickname").blur(function() {
- $("#nick-spinner").show();
- var zreg_nick = $("#id_nickname").val();
- $.get("new_channel/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) {
- $("#id_nickname").val(data);
- if(data.error) {
- $("#help_nickname").html("");
- zFormError("#help_nickname",data.error);
- }
- $("#nick-spinner").hide();
- });
+ $("#id_nickname").click(function() {
+ $("#newchannel-submit-button").attr('disabled','disabled');
});
});
+
+
+ function validate_channel() {
+ $("#nick-spinner").show();
+ var zreg_nick = $("#id_nickname").val();
+ $.get("new_channel/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) {
+ $("#id_nickname").val(data);
+ if(data.error) {
+ $("#help_nickname").html("");
+ zFormError("#help_nickname",data.error);
+ }
+ else {
+ $("#newchannel-submit-button").removeAttr('disabled');
+ }
+ $("#nick-spinner").hide();
+ });
+
+ }
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index b0a109c92..1611cda60 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -381,14 +381,9 @@ footer {
margin: 15px 0px;
}
-#cropimage-wrapper, #cropimage-preview-wrapper {
- float: left;
- padding: 30px;
-}
-
-#crop-image-form {
- margin-top: 30px;
- clear: both;
+#cropimage-wrapper,
+#cropimage-preview-wrapper {
+ margin-bottom: 10px;
}
.fn {
diff --git a/view/tpl/abook_edit.tpl b/view/tpl/abook_edit.tpl
index 81c182e1b..d72258fa0 100755
--- a/view/tpl/abook_edit.tpl
+++ b/view/tpl/abook_edit.tpl
@@ -215,7 +215,7 @@
<span id="vcard-preview-{{$vcard.id}}" class="vcard-preview">
{{if $vcard.fn}}<span class="vcard-fn-preview">{{$vcard.fn}}</span>{{/if}}
{{if $vcard.emails.0.address}}<span class="vcard-email-preview d-none d-md-table-cell"><a href="mailto:{{$vcard.emails.0.address}}">{{$vcard.emails.0.address}}</a></span>{{/if}}
- {{if $vcard.tels.0}}<span class="vcard-tel-preview d-none d-md-table-cell">{{$vcard.tels.0.nr}}{{if $is_mobile}} <a class="btn btn-outline-secondary btn-sm" href="tel:{{$vcard.tels.0.nr}}"><i class="fa fa-phone connphone"></i></a>{{/if}}</span>{{/if}}
+ {{if $vcard.tels.0}}<span class="vcard-tel-preview d-none d-md-table-cell">{{$vcard.tels.0.nr}} <a class="btn btn-outline-secondary btn-sm" href="tel:{{$vcard.tels.0.nr}}"><i class="fa fa-phone connphone"></i></a></span>{{/if}}
</span>
<input id="vcard-fn-{{$vcard.id}}" class="vcard-fn" type="text" name="fn" value="{{$vcard.fn}}" size="{{$vcard.fn|count_characters:true}}" placeholder="{{$name_label}}">
</div>
diff --git a/view/tpl/admin_site.tpl b/view/tpl/admin_site.tpl
index 0eabe620d..78e3ee245 100755
--- a/view/tpl/admin_site.tpl
+++ b/view/tpl/admin_site.tpl
@@ -84,6 +84,7 @@
{{include file="field_checkbox.tpl" field=$force_publish}}
{{include file="field_checkbox.tpl" field=$disable_discover_tab}}
{{include file="field_checkbox.tpl" field=$site_firehose}}
+ {{include file="field_checkbox.tpl" field=$open_pubstream}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
diff --git a/view/tpl/cropbody.tpl b/view/tpl/cropbody.tpl
index d35546ec6..a8b8207cb 100755
--- a/view/tpl/cropbody.tpl
+++ b/view/tpl/cropbody.tpl
@@ -6,7 +6,7 @@
<img src="{{$image_url}}" id="croppa" class="imgCrop" alt="{{$title}}" />
</div>
<div id="cropimage-preview-wrapper" >
-<div id="previewWrap" class="crop-preview" style="height: 300px; width: 300px; max-width: 300px; max-height: 300px; overflow: hidden;"></div>
+<div id="previewWrap" class="crop-preview d-lg-none" style="height: 300px; width: 300px; max-width: 300px; max-height: 300px; overflow: hidden;"></div>
</div>
<script type="text/javascript" language="javascript">
@@ -14,18 +14,17 @@
var image = document.getElementById('croppa');
var cropper = new Cropper(image, {
- aspectRatio: 1 / 1,
- viewMode: 1,
- preview: '.crop-preview',
- crop: function(e) {
- $( 'x1' ).value = e.detail.x;
- $( 'y1' ).value = e.detail.y;
- $( 'x2' ).value = e.detail.x + e.detail.width;
- $( 'y2' ).value = e.detail.y + e.detail.height;
- $( 'width' ).value = e.detail.scaleX;
- $( 'height' ).value = e.detail.scaleY;
-
- }
+ aspectRatio: 1 / 1,
+ viewMode: 1,
+ preview: '#profile-photo-wrapper, .crop-preview',
+ crop: function(e) {
+ $( '#x1' ).val(e.detail.x);
+ $( '#y1' ).val(e.detail.y);
+ $( '#x2' ).val(e.detail.x + e.detail.width);
+ $( '#y2' ).val(e.detail.y + e.detail.height);
+ $( '#width' ).val(e.detail.scaleX);
+ $( '#height' ).val(e.detail.scaleY);
+ }
});
</script>
diff --git a/view/tpl/cropcover.tpl b/view/tpl/cropcover.tpl
index 8888a967a..ba91a2cce 100755
--- a/view/tpl/cropcover.tpl
+++ b/view/tpl/cropcover.tpl
@@ -13,18 +13,17 @@
var image = document.getElementById('croppa');
var cropper = new Cropper(image, {
- aspectRatio: 2.75 / 1,
- viewMode: 1,
- preview: '.crop-preview',
- crop: function(e) {
- $( 'x1' ).value = e.detail.x;
- $( 'y1' ).value = e.detail.y;
- $( 'x2' ).value = e.detail.x + e.detail.width;
- $( 'y2' ).value = e.detail.y + e.detail.height;
- $( 'width' ).value = e.detail.scaleX;
- $( 'height' ).value = e.detail.scaleY;
-
- }
+ aspectRatio: 2.75 / 1,
+ viewMode: 1,
+ preview: '.crop-preview',
+ crop: function(e) {
+ $( '#x1' ).val(e.detail.x);
+ $( '#y1' ).val(e.detail.y);
+ $( '#x2' ).val(e.detail.x + e.detail.width);
+ $( '#y2' ).val(e.detail.y + e.detail.height);
+ $( '#width' ).val(e.detail.scaleX);
+ $( '#height' ).val(e.detail.scaleY);
+ }
});
</script>
diff --git a/view/tpl/new_channel.tpl b/view/tpl/new_channel.tpl
index c4837064f..f415e4e2c 100755
--- a/view/tpl/new_channel.tpl
+++ b/view/tpl/new_channel.tpl
@@ -24,7 +24,9 @@
{{include file="field_input.tpl" field=$nickname}}
<div id="nick-spinner" class="spinner-wrapper"><div class="spinner m"></div></div>
- <button class="btn btn-primary" type="submit" name="submit" id="newchannel-submit-button" value="{{$submit}}">{{$submit}}</button>
+ <button class="btn btn-secondary" name="validate" id="newchannel-validate-button" value="{{$validate}}" onclick="validate_channel(); return false;">{{$validate}}</button>
+
+ <button class="btn btn-primary" type="submit" name="submit" id="newchannel-submit-button" value="{{$submit}}" >{{$submit}}</button>
<div id="newchannel-submit-end" class="clear"></div>
<div id="newchannel-import-link" class="descriptive-paragraph" >{{$label_import}}</div>
diff --git a/view/tpl/settings_display.tpl b/view/tpl/settings_display.tpl
index d1e6e0609..b0751eb5f 100755
--- a/view/tpl/settings_display.tpl
+++ b/view/tpl/settings_display.tpl
@@ -6,7 +6,7 @@
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
<div class="panel-group" id="settings" role="tablist" aria-multiselectable="true">
- {{if $theme || $mobile_theme}}
+ {{if $theme}}
<div class="panel">
<div class="section-subtitle-wrapper" role="tab" id="theme-settings-title">
<h3>
@@ -23,9 +23,6 @@
{{if $schema}}
{{include file="field_select.tpl" field=$schema}}
{{/if}}
- {{if $mobile_theme}}
- {{include file="field_themeselect.tpl" field=$mobile_theme}}
- {{/if}}
<div class="settings-submit-wrapper" >
<button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
</div>
@@ -41,7 +38,7 @@
</a>
</h3>
</div>
- <div id="custom-settings-content" class="collapse{{if !$theme && !$mobile_theme}} in{{/if}}" role="tabpanel" aria-labelledby="custom-settings">
+ <div id="custom-settings-content" class="collapse{{if !$theme}} in{{/if}}" role="tabpanel" aria-labelledby="custom-settings">
<div class="section-content-tools-wrapper">
{{if $theme_config}}
{{$theme_config}}
@@ -57,7 +54,7 @@
</a>
</h3>
</div>
- <div id="content-settings-content" class="collapse{{if !$theme && !$mobile_theme && !$theme_config}} in{{/if}}" role="tabpanel" aria-labelledby="content-settings">
+ <div id="content-settings-content" class="collapse{{if !$theme && !$theme_config}} in{{/if}}" role="tabpanel" aria-labelledby="content-settings">
<div class="section-content-wrapper">
{{include file="field_input.tpl" field=$ajaxint}}
{{include file="field_input.tpl" field=$itemspage}}