Merge branch 'dev' into release

This commit is contained in:
nobody 2022-03-03 13:41:39 -08:00
commit 53dac9fd6f
269 changed files with 6466 additions and 11095 deletions

View file

@ -39,7 +39,7 @@ class PermissionRoles
$ret['directory_publish'] = true; $ret['directory_publish'] = true;
$ret['online'] = true; $ret['online'] = true;
$ret['perms_connect'] = [ $ret['perms_connect'] = [
'view_stream', 'view_profile', 'view_contacts', 'view_storage', 'view_stream', 'deliver_stream', 'view_profile', 'view_contacts', 'view_storage',
'view_pages', 'send_stream', 'post_mail', 'post_wall', 'post_comments' 'view_pages', 'send_stream', 'post_mail', 'post_wall', 'post_comments'
]; ];
$ret['limits'] = PermissionLimits::Std_Limits(); $ret['limits'] = PermissionLimits::Std_Limits();
@ -51,7 +51,7 @@ class PermissionRoles
$ret['directory_publish'] = true; $ret['directory_publish'] = true;
$ret['online'] = false; $ret['online'] = false;
$ret['perms_connect'] = [ $ret['perms_connect'] = [
'view_stream', 'view_profile', 'view_storage', 'view_stream', 'deliver_stream', 'view_profile', 'view_storage',
'view_pages', 'send_stream', 'post_mail', 'post_wall', 'post_comments' 'view_pages', 'send_stream', 'post_mail', 'post_wall', 'post_comments'
]; ];
$ret['limits'] = PermissionLimits::Std_Limits(); $ret['limits'] = PermissionLimits::Std_Limits();
@ -64,7 +64,7 @@ class PermissionRoles
$ret['directory_publish'] = true; $ret['directory_publish'] = true;
$ret['online'] = false; $ret['online'] = false;
$ret['perms_connect'] = [ $ret['perms_connect'] = [
'view_stream', 'view_profile', 'view_contacts', 'view_storage', 'write_storage', 'view_stream', 'deliver_stream', 'view_profile', 'view_contacts', 'view_storage', 'write_storage',
'view_pages', 'post_mail', 'post_wall', 'post_comments' 'view_pages', 'post_mail', 'post_wall', 'post_comments'
]; ];
$ret['limits'] = PermissionLimits::Std_Limits(); $ret['limits'] = PermissionLimits::Std_Limits();
@ -79,7 +79,7 @@ class PermissionRoles
$ret['directory_publish'] = true; $ret['directory_publish'] = true;
$ret['online'] = false; $ret['online'] = false;
$ret['perms_connect'] = [ $ret['perms_connect'] = [
'view_stream', 'view_profile', 'view_contacts', 'view_storage', 'view_stream', 'deliver_stream', 'view_profile', 'view_contacts', 'view_storage',
'view_pages', 'post_mail', 'post_wall', 'post_comments', 'moderated' 'view_pages', 'post_mail', 'post_wall', 'post_comments', 'moderated'
]; ];
$ret['limits'] = PermissionLimits::Std_Limits(); $ret['limits'] = PermissionLimits::Std_Limits();
@ -93,7 +93,7 @@ class PermissionRoles
$ret['directory_publish'] = true; $ret['directory_publish'] = true;
$ret['online'] = false; $ret['online'] = false;
$ret['perms_connect'] = [ $ret['perms_connect'] = [
'view_stream', 'view_profile', 'view_contacts', 'view_storage', 'write_storage', 'view_stream', 'deliver_stream', 'view_profile', 'view_contacts', 'view_storage', 'write_storage',
'view_pages', 'post_mail', 'post_wall', 'post_comments' 'view_pages', 'post_mail', 'post_wall', 'post_comments'
]; ];
$ret['limits'] = PermissionLimits::Std_Limits(); $ret['limits'] = PermissionLimits::Std_Limits();

View file

@ -58,18 +58,19 @@ class Permissions
{ {
$perms = [ $perms = [
'view_stream' => t('Grant viewing access to and delivery of your channel stream and posts'), 'view_stream' => t('Grant viewing access to your channel stream and posts'),
'view_profile' => t('Grant viewing access to your default channel profile'), 'deliver_stream' => t('Permit delivery of your channel stream and posts'),
'view_contacts' => t('Grant viewing access to your address book (connections)'), 'view_profile' => t('Grant viewing access to your default channel profile'),
'view_storage' => t('Grant viewing access to your file storage and photos'), 'view_contacts' => t('Grant viewing access to your address book (connections)'),
'post_wall' => t('Grant permission to post on your channel (wall) page'), 'view_storage' => t('Grant viewing access to your file storage and photos'),
'post_mail' => t('Accept delivery of direct messages and personal mail'), 'post_wall' => t('Grant permission to post on your channel (wall) page'),
'send_stream' => t('Accept delivery of their posts and all comments to their posts'), 'post_mail' => t('Accept delivery of direct messages and personal mail'),
'post_comments' => t('Accept delivery of their comments and likes on your posts'), 'send_stream' => t('Accept delivery of their posts and all comments to their posts'),
'write_storage' => t('Grant upload permissions to your file storage and photos'), 'post_comments' => t('Accept delivery of their comments and likes on your posts'),
'republish' => t('Grant permission to republish/mirror your posts'), 'write_storage' => t('Grant upload permissions to your file storage and photos'),
'moderated' => t('Accept comments and wall posts only after approval (moderation)'), 'republish' => t('Grant permission to republish/mirror your posts'),
'delegate' => t('Grant channel administration (delegation) permission') 'moderated' => t('Accept comments and wall posts only after approval (moderation)'),
'delegate' => t('Grant channel administration (delegation) permission')
]; ];
$x = [ $x = [

View file

@ -186,20 +186,20 @@ class Account {
set_config('system', 'prvkey', $hostkey['prvkey']); set_config('system', 'prvkey', $hostkey['prvkey']);
} }
$invite_result = check_account_invite($invite_code); $invite_result = self::check_invite($invite_code);
if ($invite_result['error']) { if ($invite_result['error']) {
$result['message'] = $invite_result['message']; $result['message'] = $invite_result['message'];
return $result; return $result;
} }
$email_result = check_account_email($email); $email_result = self::check_email($email);
if ($email_result['error']) { if ($email_result['error']) {
$result['message'] = $email_result['message']; $result['message'] = $email_result['message'];
return $result; return $result;
} }
$password_result = check_account_password($password); $password_result = self::check_password($password);
if ($password_result['error']) { if ($password_result['error']) {
$result['message'] = $password_result['message']; $result['message'] = $password_result['message'];

View file

@ -1751,7 +1751,7 @@ class Activity
// information // information
$ret = self::encode_person($sys, true, true); $ret = self::encode_person($sys, true, true);
$ret['type'] = ((Channel::is_group($sys['channel_id'])) ? 'Group' : 'Service'); $ret['type'] = self::xchan_type_to_type(intval($sys['xchan_type']));
$ret['id'] = z_root(); $ret['id'] = z_root();
$ret['alsoKnownAs'] = z_root() . '/channel/sys'; $ret['alsoKnownAs'] = z_root() . '/channel/sys';
$auto_follow = false; $auto_follow = false;
@ -1779,7 +1779,6 @@ class Activity
]; ];
} }
$ret['summary'] = bbcode(get_config('system', 'siteinfo', ''), ['export' => true]);
$ret['source'] = [ $ret['source'] = [
'mediaType' => 'text/x-multicode', 'mediaType' => 'text/x-multicode',
'summary' => get_config('system', 'siteinfo', '') 'summary' => get_config('system', 'siteinfo', '')
@ -2812,17 +2811,17 @@ class Activity
if (array_key_exists('published', $act->data) && $act->data['published']) { if (array_key_exists('published', $act->data) && $act->data['published']) {
$s['created'] = datetime_convert('UTC', 'UTC', $act->data['published']); $s['created'] = datetime_convert('UTC', 'UTC', $act->data['published']);
} elseif (array_key_exists('published', $act->obj) && $act->obj['published']) { } elseif (is_array($acct->obj) && array_key_exists('published', $act->obj) && $act->obj['published']) {
$s['created'] = datetime_convert('UTC', 'UTC', $act->obj['published']); $s['created'] = datetime_convert('UTC', 'UTC', $act->obj['published']);
} }
if (array_key_exists('updated', $act->data) && $act->data['updated']) { if (array_key_exists('updated', $act->data) && $act->data['updated']) {
$s['edited'] = datetime_convert('UTC', 'UTC', $act->data['updated']); $s['edited'] = datetime_convert('UTC', 'UTC', $act->data['updated']);
} elseif (array_key_exists('updated', $act->obj) && $act->obj['updated']) { } elseif (is_array($act->obj) && array_key_exists('updated', $act->obj) && $act->obj['updated']) {
$s['edited'] = datetime_convert('UTC', 'UTC', $act->obj['updated']); $s['edited'] = datetime_convert('UTC', 'UTC', $act->obj['updated']);
} }
if (array_key_exists('expires', $act->data) && $act->data['expires']) { if (array_key_exists('expires', $act->data) && $act->data['expires']) {
$s['expires'] = datetime_convert('UTC', 'UTC', $act->data['expires']); $s['expires'] = datetime_convert('UTC', 'UTC', $act->data['expires']);
} elseif (array_key_exists('expires', $act->obj) && $act->obj['expires']) { } elseif (is_array($act->obj) && array_key_exists('expires', $act->obj) && $act->obj['expires']) {
$s['expires'] = datetime_convert('UTC', 'UTC', $act->obj['expires']); $s['expires'] = datetime_convert('UTC', 'UTC', $act->obj['expires']);
} }
@ -3044,7 +3043,7 @@ class Activity
if ( if (
$generator && array_key_exists('type', $generator) $generator && array_key_exists('type', $generator)
&& in_array($generator['type'], ['Application', 'Service']) && array_key_exists('name', $generator) && in_array($generator['type'], ['Application', 'Service', 'Organization']) && array_key_exists('name', $generator)
) { ) {
$s['app'] = escape_tags($generator['name']); $s['app'] = escape_tags($generator['name']);
} }
@ -3620,7 +3619,8 @@ class Activity
$item['obj_type'] = 'Answer'; $item['obj_type'] = 'Answer';
} }
} }
} else { }
else {
if (perm_is_allowed($channel['channel_id'], $observer_hash, 'send_stream') || ($is_system && $pubstream)) { if (perm_is_allowed($channel['channel_id'], $observer_hash, 'send_stream') || ($is_system && $pubstream)) {
logger('allowed: permission allowed', LOGGER_DATA); logger('allowed: permission allowed', LOGGER_DATA);
$allowed = true; $allowed = true;
@ -4267,6 +4267,22 @@ class Activity
} }
} }
public static function xchan_type_to_type($type)
{
switch ($type) {
case XCHAN_TYPE_GROUP;
return 'Group';
case XCHAN_TYPE_SERVICE;
return 'Service';
case XCHAN_TYPE_ORGANIZATION;
return 'Organization';
case XCHAN_TYPE_APPLICATION;
return 'Application';
default:
return 'Person';
}
}
public static function get_cached_actor($id) public static function get_cached_actor($id)
{ {
return (XConfig::Get($id, 'system', 'actor_record')); return (XConfig::Get($id, 'system', 'actor_record'));

View file

@ -76,6 +76,7 @@ class Apps
} }
$default_apps = [ $default_apps = [
'Admin',
'Channel Home', 'Channel Home',
'Connections', 'Connections',
'Directory', 'Directory',

View file

@ -13,6 +13,7 @@ use Code\Lib\Libsync;
use Code\Lib\AccessList; use Code\Lib\AccessList;
use Code\Lib\Crypto; use Code\Lib\Crypto;
use Code\Lib\Connect; use Code\Lib\Connect;
use Code\Lib\ABConfig;
use Code\Access\PermissionRoles; use Code\Access\PermissionRoles;
use Code\Access\PermissionLimits; use Code\Access\PermissionLimits;
use Code\Access\Permissions; use Code\Access\Permissions;
@ -89,9 +90,48 @@ class Channel
$sys = self::get_system(); $sys = self::get_system();
if ($sys) { if ($sys) {
if (isset($sys['channel_pubkey']) && $sys['channel_pubkey'] === get_config('system', 'pubkey')) { // upgrade the default network drivers and permissions if this looks like an upgraded zot6-based platform.
return;
} else { if ($sys['xchan_network'] !== 'nomad') {
$chans = q("select * from channel where true");
if ($chans) {
foreach ($chans as $chan) {
q("update hubloc set hubloc_network = 'nomad' where hubloc_hash = '%s'",
dbesc($chan['channel_hash'])
);
q("update xchan set xchan_network = 'nomad' where xchan_hash = '%s'",
dbesc($chan['channel_hash'])
);
}
}
q("update xchan set xchan_hidden = 0, xchan_type = %d where xchan_hash = '%s'",
intval(XCHAN_TYPE_ORGANIZATION),
dbesc($sys['xchan_hash'])
);
// Add the new "deliver_stream" permission
$c = q("select * from channel where true");
if ($c) {
foreach ($c as $cv) {
PConfig::Set($cv['channel_id'],'perm_limits','deliver_stream', PERMS_SPECIFIC);
}
}
$ab = q("SELECT * from abook where abook_self = 0");
if ($ab) {
foreach ($ab as $abv) {
$p = explode(',', ABConfig::Get($abv['abook_channel'], $abv['abook_xchan'], 'system', 'my_perms', EMPTY_STR));
if (! in_array('deliver_stream', $p)) {
$p[] = 'deliver_stream';
}
ABConfig::Set($abv['abook_channel'], $abv['abook_xchan'], 'system', 'my_perms', implode(',', $p));
}
}
}
// fix lost system keys, since we cannot communicate without them
if (!(isset($sys['channel_pubkey']) && $sys['channel_pubkey'] === get_config('system', 'pubkey'))) {
// upgrade the sys channel and return // upgrade the sys channel and return
$pubkey = get_config('system', 'pubkey'); $pubkey = get_config('system', 'pubkey');
$prvkey = get_config('system', 'prvkey'); $prvkey = get_config('system', 'prvkey');
@ -139,14 +179,15 @@ class Channel
dbesc($sys['channel_hash']) dbesc($sys['channel_hash'])
); );
return;
} }
App::$sys_channel = $sys;
return;
} }
self::create([ self::create([
'account_id' => 'xxx', // Typecast trickery: account_id is required. This will create an identity with an (integer) account_id of 0 'account_id' => 'xxx', // Typecast trickery: account_id is required. This will create an identity with an (integer) account_id of 0
'nickname' => 'sys', 'nickname' => 'sys',
'name' => 'System', 'name' => ucfirst(basename(z_root())),
'permissions_role' => 'social', 'permissions_role' => 'social',
'pageflags' => 0, 'pageflags' => 0,
'publish' => 0, 'publish' => 0,
@ -306,6 +347,14 @@ class Channel
$publish = intval($role_permissions['directory_publish']); $publish = intval($role_permissions['directory_publish']);
} }
$xchannel_type = XCHAN_TYPE_PERSON ;
if (strpos($arr['permissions_role'], 'forum') !== false || strpos($arr['permissions_role'], 'group') !== false) {
$xchannel_type = XCHAN_TYPE_GROUP ;
}
if ($system) {
$xchannel_type = XCHAN_TYPE_ORGANIZATION ;
}
$primary = true; $primary = true;
if (array_key_exists('primary', $arr)) { if (array_key_exists('primary', $arr)) {
@ -435,6 +484,7 @@ class Channel
'xchan_connurl' => z_root() . '/poco/' . $ret['channel']['channel_address'], 'xchan_connurl' => z_root() . '/poco/' . $ret['channel']['channel_address'],
'xchan_name' => $ret['channel']['channel_name'], 'xchan_name' => $ret['channel']['channel_name'],
'xchan_network' => 'nomad', 'xchan_network' => 'nomad',
'xchan_type' => $xchannel_type,
'xchan_updated' => datetime_convert(), 'xchan_updated' => datetime_convert(),
'xchan_photo_date' => datetime_convert(), 'xchan_photo_date' => datetime_convert(),
'xchan_name_date' => datetime_convert(), 'xchan_name_date' => datetime_convert(),

View file

@ -38,6 +38,7 @@ class Infocon {
} }
public static function from_c_comment($file) { public static function from_c_comment($file) {
$info = NULL; $info = NULL;
try { try {
$code = file_get_contents($file); $code = file_get_contents($file);
@ -45,11 +46,13 @@ class Infocon {
catch (Exception $e) { catch (Exception $e) {
; ;
} }
// Match and fetch the first C-style comment // Match and fetch the first C-style comment
$result = preg_match("|/\*.*\*/|msU", $code, $matches); $result = preg_match("|/\*.*\*/|msU", $code, $matches);
if ($result) { if ($result) {
$lines = explode("\n", $m[0]);
$lines = explode("\n", $matches[0]);
foreach ($lines as $line) { foreach ($lines as $line) {
$line = trim($line, "\t\n\r */"); $line = trim($line, "\t\n\r */");
if ($line != "") { if ($line != "") {

View file

@ -290,7 +290,7 @@ class Libprofile
$xchan = q("SELECT * from xchan where xchan_hash = '%s'", $xchan = q("SELECT * from xchan where xchan_hash = '%s'",
dbesc($profile['channel_hash']) dbesc($profile['channel_hash'])
} );
$is_group = ($xchan && intval($xchan[0]['xchan_type']) === XCHAN_TYPE_GROUP); $is_group = ($xchan && intval($xchan[0]['xchan_type']) === XCHAN_TYPE_GROUP);
$can_dm = perm_is_allowed($profile['uid'], (is_array($observer)) ? $observer['xchan_hash'] : EMPTY_STR, 'post_mail') && $is_group ; $can_dm = perm_is_allowed($profile['uid'], (is_array($observer)) ? $observer['xchan_hash'] : EMPTY_STR, 'post_mail') && $is_group ;

View file

@ -1075,25 +1075,8 @@ class Libzot
$address = $ud_arr['ud_addr']; $address = $ud_arr['ud_addr'];
} }
// Are we a directory server of some kind?
$other_realm = false; if (array_key_exists('profile', $arr) && is_array($arr['profile'])) {
// $realm = get_directory_realm();
// if (array_key_exists('site',$arr)
// && array_key_exists('realm',$arr['site'])
// && (strpos($arr['site']['realm'],$realm) === false))
// $other_realm = true;
// if ($dirmode != DIRECTORY_MODE_NORMAL) {
// We're some kind of directory server. However we can only add directory information
// if the entry is in the same realm (or is a sub-realm). Sub-realms are denoted by
// including the parent realm in the name. e.g. 'RED_GLOBAL:foo' would allow an entry to
// be in directories for the local realm (foo) and also the RED_GLOBAL realm.
if (array_key_exists('profile', $arr) && is_array($arr['profile']) && (!$other_realm)) {
$profile_changed = Libzotdir::import_directory_profile($xchan_hash, $arr['profile'], $address, $ud_flags, 1); $profile_changed = Libzotdir::import_directory_profile($xchan_hash, $arr['profile'], $address, $ud_flags, 1);
if ($profile_changed) { if ($profile_changed) {
$what .= 'profile '; $what .= 'profile ';
@ -1111,7 +1094,7 @@ class Libzot
dbesc($xchan_hash) dbesc($xchan_hash)
); );
} }
// }
if (array_key_exists('site', $arr) && is_array($arr['site'])) { if (array_key_exists('site', $arr) && is_array($arr['site'])) {
$profile_changed = self::import_site($arr['site']); $profile_changed = self::import_site($arr['site']);
@ -1417,6 +1400,7 @@ class Libzot
if ($has_data) { if ($has_data) {
if (in_array($env['type'], ['activity', 'response'])) { if (in_array($env['type'], ['activity', 'response'])) {
if (!(is_array($AS->actor) && isset($AS->actor['id']))) { if (!(is_array($AS->actor) && isset($AS->actor['id']))) {
logger('No author!'); logger('No author!');
return; return;
@ -1426,6 +1410,16 @@ class Libzot
"select hubloc_hash, hubloc_network, hubloc_url from hubloc where hubloc_id_url = '%s'", "select hubloc_hash, hubloc_network, hubloc_url from hubloc where hubloc_id_url = '%s'",
dbesc($AS->actor['id']) dbesc($AS->actor['id'])
); );
if (! $r) {
// Author is unknown to this site. Perform channel discovery and try again.
$z = discover_by_webbie($AS->actor['id']);
if ($z) {
$r = q(
"select hubloc_hash, hubloc_network, hubloc_url from hubloc where hubloc_id_url = '%s'",
dbesc($AS->actor['id'])
);
}
}
if ($r) { if ($r) {
$r = self::zot_record_preferred($r); $r = self::zot_record_preferred($r);
@ -2870,12 +2864,6 @@ class Libzot
if ($arr['directory_mode'] == 'normal') { if ($arr['directory_mode'] == 'normal') {
$site_directory = DIRECTORY_MODE_NORMAL; $site_directory = DIRECTORY_MODE_NORMAL;
} }
if ($arr['directory_mode'] == 'primary') {
$site_directory = DIRECTORY_MODE_PRIMARY;
}
if ($arr['directory_mode'] == 'secondary') {
$site_directory = DIRECTORY_MODE_SECONDARY;
}
if ($arr['directory_mode'] == 'standalone') { if ($arr['directory_mode'] == 'standalone') {
$site_directory = DIRECTORY_MODE_STANDALONE; $site_directory = DIRECTORY_MODE_STANDALONE;
} }
@ -2924,11 +2912,9 @@ class Libzot
$site_logo = EMPTY_STR; $site_logo = EMPTY_STR;
$sitename = EMPTY_STR; $sitename = EMPTY_STR;
$directory_url = htmlspecialchars(isset($arr['directory_url']) ? $arr['directory_url'] : EMPTY_STR, ENT_COMPAT, 'UTF-8', false);
$url = htmlspecialchars(strtolower($arr['url']), ENT_COMPAT, 'UTF-8', false); $url = htmlspecialchars(strtolower($arr['url']), ENT_COMPAT, 'UTF-8', false);
$sellpage = htmlspecialchars($arr['sellpage'], ENT_COMPAT, 'UTF-8', false); $sellpage = htmlspecialchars($arr['sellpage'], ENT_COMPAT, 'UTF-8', false);
$site_location = htmlspecialchars($arr['location'], ENT_COMPAT, 'UTF-8', false); $site_location = htmlspecialchars($arr['location'], ENT_COMPAT, 'UTF-8', false);
$site_realm = htmlspecialchars($arr['realm'], ENT_COMPAT, 'UTF-8', false);
$sitename = htmlspecialchars($arr['sitename'], ENT_COMPAT, 'UTF-8', false); $sitename = htmlspecialchars($arr['sitename'], ENT_COMPAT, 'UTF-8', false);
$site_project = htmlspecialchars($arr['project'], ENT_COMPAT, 'UTF-8', false); $site_project = htmlspecialchars($arr['project'], ENT_COMPAT, 'UTF-8', false);
$site_crypto = ((array_key_exists('encryption', $arr) && is_array($arr['encryption'])) ? htmlspecialchars(implode(',', $arr['encryption']), ENT_COMPAT, 'UTF-8', false) : ''); $site_crypto = ((array_key_exists('encryption', $arr) && is_array($arr['encryption'])) ? htmlspecialchars(implode(',', $arr['encryption']), ENT_COMPAT, 'UTF-8', false) : '');
@ -2958,12 +2944,10 @@ class Libzot
if ( if (
($siterecord['site_flags'] != $site_flags) ($siterecord['site_flags'] != $site_flags)
|| ($siterecord['site_access'] != $access_policy) || ($siterecord['site_access'] != $access_policy)
|| ($siterecord['site_directory'] != $directory_url)
|| ($siterecord['site_sellpage'] != $sellpage) || ($siterecord['site_sellpage'] != $sellpage)
|| ($siterecord['site_location'] != $site_location) || ($siterecord['site_location'] != $site_location)
|| ($siterecord['site_register'] != $register_policy) || ($siterecord['site_register'] != $register_policy)
|| ($siterecord['site_project'] != $site_project) || ($siterecord['site_project'] != $site_project)
|| ($siterecord['site_realm'] != $site_realm)
|| ($siterecord['site_crypto'] != $site_crypto) || ($siterecord['site_crypto'] != $site_crypto)
|| ($siterecord['site_version'] != $site_version) || ($siterecord['site_version'] != $site_version)
) { ) {
@ -2973,16 +2957,14 @@ class Libzot
// logger('import_site: stored: ' . print_r($siterecord,true)); // logger('import_site: stored: ' . print_r($siterecord,true));
$r = q( $r = q(
"update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s', site_type = %d, site_project = '%s', site_version = '%s', site_crypto = '%s' "update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_register = %d, site_update = '%s', site_sellpage = '%s', site_type = %d, site_project = '%s', site_version = '%s', site_crypto = '%s'
where site_url = '%s'", where site_url = '%s'",
dbesc($site_location), dbesc($site_location),
intval($site_flags), intval($site_flags),
intval($access_policy), intval($access_policy),
dbesc($directory_url),
intval($register_policy), intval($register_policy),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($sellpage), dbesc($sellpage),
dbesc($site_realm),
intval(SITE_TYPE_ZOT), intval(SITE_TYPE_ZOT),
dbesc($site_project), dbesc($site_project),
dbesc($site_version), dbesc($site_version),
@ -3010,10 +2992,8 @@ class Libzot
'site_access' => intval($access_policy), 'site_access' => intval($access_policy),
'site_flags' => intval($site_flags), 'site_flags' => intval($site_flags),
'site_update' => datetime_convert(), 'site_update' => datetime_convert(),
'site_directory' => $directory_url,
'site_register' => intval($register_policy), 'site_register' => intval($register_policy),
'site_sellpage' => $sellpage, 'site_sellpage' => $sellpage,
'site_realm' => $site_realm,
'site_type' => intval(SITE_TYPE_ZOT), 'site_type' => intval(SITE_TYPE_ZOT),
'site_project' => $site_project, 'site_project' => $site_project,
'site_version' => $site_version, 'site_version' => $site_version,
@ -3488,7 +3468,6 @@ class Libzot
$ret['site']['sitehash'] = get_config('system', 'location_hash'); $ret['site']['sitehash'] = get_config('system', 'location_hash');
$ret['site']['sellpage'] = get_config('system', 'sellpage'); $ret['site']['sellpage'] = get_config('system', 'sellpage');
$ret['site']['location'] = get_config('system', 'site_location'); $ret['site']['location'] = get_config('system', 'site_location');
$ret['site']['realm'] = get_directory_realm();
$ret['site']['sitename'] = System::get_site_name(); $ret['site']['sitename'] = System::get_site_name();
$ret['site']['logo'] = System::get_site_icon(); $ret['site']['logo'] = System::get_site_icon();
$ret['site']['project'] = System::get_project_name(); $ret['site']['project'] = System::get_project_name();

View file

@ -2,6 +2,7 @@
namespace Code\Lib; namespace Code\Lib;
require_once('include/html2plain.php');
class MessageFilter class MessageFilter
{ {
@ -10,7 +11,6 @@ class MessageFilter
public static function evaluate($item, $incl, $excl) public static function evaluate($item, $incl, $excl)
{ {
require_once('include/html2plain.php');
$text = prepare_text($item['body'],((isset($item['mimetype'])) ? $item['mimetype'] : 'text/x-multicode')); $text = prepare_text($item['body'],((isset($item['mimetype'])) ? $item['mimetype'] : 'text/x-multicode'));
$text = html2plain(($item['title']) ? $item['title'] . ' ' . $text : $text); $text = html2plain(($item['title']) ? $item['title'] . ' ' . $text : $text);
@ -45,6 +45,14 @@ class MessageFilter
return false; return false;
} }
} }
} elseif (substr($word, 0, 2) === '?+') {
if (self::test_condition(substr($word, 2), $item['obj'])) {
return false;
}
} elseif (substr($word, 0, 1) === '?') {
if (self::test_condition(substr($word, 1), $item)) {
return false;
}
} elseif ((strpos($word, '/') === 0) && preg_match($word, $text)) { } elseif ((strpos($word, '/') === 0) && preg_match($word, $text)) {
return false; return false;
} elseif ((strpos($word, 'lang=') === 0) && ($lang) && (strcasecmp($lang, trim(substr($word, 5))) == 0)) { } elseif ((strpos($word, 'lang=') === 0) && ($lang) && (strcasecmp($lang, trim(substr($word, 5))) == 0)) {
@ -77,6 +85,14 @@ class MessageFilter
return true; return true;
} }
} }
} elseif (substr($word, 0, 2) === '?+') {
if (self::test_condition(substr($word, 2), $item['obj'])) {
return true;
}
} elseif (substr($word, 0, 1) === '?') {
if (self::test_condition(substr($word, 1), $item)) {
return true;
}
} elseif ((strpos($word, '/') === 0) && preg_match($word, $text)) { } elseif ((strpos($word, '/') === 0) && preg_match($word, $text)) {
return true; return true;
} elseif ((strpos($word, 'lang=') === 0) && ($lang) && (strcasecmp($lang, trim(substr($word, 5))) == 0)) { } elseif ((strpos($word, 'lang=') === 0) && ($lang) && (strcasecmp($lang, trim(substr($word, 5))) == 0)) {
@ -93,4 +109,117 @@ class MessageFilter
return false; return false;
} }
/**
* @brief Test for Conditional Execution conditions. Shamelessly ripped off from Code/Render/Comanche
*
* This is extensible. The first version of variable testing supports tests of the forms:
*
* - ?foo ~= baz which will check if item.foo contains the string 'baz';
* - ?foo == baz which will check if item.foo is the string 'baz';
* - ?foo != baz which will check if item.foo is not the string 'baz';
* - ?foo >= 3 which will check if item.foo is greater than or equal to 3;
* - ?foo > 3 which will check if item.foo is greater than 3;
* - ?foo <= 3 which will check if item.foo is less than or equal to 3;
* - ?foo < 3 which will check if item.foo is less than 3;
*
* - ?foo {} baz which will check if 'baz' is an array element in item.foo
* - ?foo {*} baz which will check if 'baz' is an array key in item.foo
* - ?foo which will check for a return of a true condition for item.foo;
*
* The values 0, '', an empty array, and an unset value will all evaluate to false.
*
* @param string $s
* @param array $item
* @return bool
*/
public static function test_condition($s,$item)
{
if (preg_match('/(.*?)\s\~\=\s(.*?)$/', $s, $matches)) {
$x = ((array_key_exists(trim($matches[1]),$item)) ? $item[trim($matches[1])] : EMPTY_STR);
if (stripos($x, trim($matches[2])) !== false) {
return true;
}
return false;
}
if (preg_match('/(.*?)\s\=\=\s(.*?)$/', $s, $matches)) {
$x = ((array_key_exists(trim($matches[1]),$item)) ? $item[trim($matches[1])] : EMPTY_STR);
if ($x == trim($matches[2])) {
return true;
}
return false;
}
if (preg_match('/(.*?)\s\!\=\s(.*?)$/', $s, $matches)) {
$x = ((array_key_exists(trim($matches[1]),$item)) ? $item[trim($matches[1])] : EMPTY_STR);
if ($x != trim($matches[2])) {
return true;
}
return false;
}
if (preg_match('/(.*?)\s\>\=\s(.*?)$/', $s, $matches)) {
$x = ((array_key_exists(trim($matches[1]),$item)) ? $item[trim($matches[1])] : EMPTY_STR);
if ($x >= trim($matches[2])) {
return true;
}
return false;
}
if (preg_match('/(.*?)\s\<\=\s(.*?)$/', $s, $matches)) {
$x = ((array_key_exists(trim($matches[1]),$item)) ? $item[trim($matches[1])] : EMPTY_STR);
if ($x <= trim($matches[2])) {
return true;
}
return false;
}
if (preg_match('/(.*?)\s\>\s(.*?)$/', $s, $matches)) {
$x = ((array_key_exists(trim($matches[1]),$item)) ? $item[trim($matches[1])] : EMPTY_STR);
if ($x > trim($matches[2])) {
return true;
}
return false;
}
if (preg_match('/(.*?)\s\>\s(.*?)$/', $s, $matches)) {
$x = ((array_key_exists(trim($matches[1]),$item)) ? $item[trim($matches[1])] : EMPTY_STR);
if ($x < trim($matches[2])) {
return true;
}
return false;
}
if (preg_match('/[\$](.*?)\s\{\}\s(.*?)$/', $s, $matches)) {
$x = ((array_key_exists(trim($matches[1]),$item)) ? $item[trim($matches[1])] : EMPTY_STR);
if (is_array($x) && in_array(trim($matches[2]), $x)) {
return true;
}
return false;
}
if (preg_match('/(.*?)\s\{\*\}\s(.*?)$/', $s, $matches)) {
$x = ((array_key_exists(trim($matches[1]),$item)) ? $item[trim($matches[1])] : EMPTY_STR);
if (is_array($x) && array_key_exists(trim($matches[2]), $x)) {
return true;
}
return false;
}
if (preg_match('/(.*?)$/', $s, $matches)) {
$x = ((array_key_exists(trim($matches[1]),$item)) ? $item[trim($matches[1])] : EMPTY_STR);
if ($x) {
return true;
}
return false;
}
return false;
}
} }

View file

@ -3,6 +3,8 @@
namespace Code\Lib; namespace Code\Lib;
use App; use App;
use DOMDocument;
use DOMXPath;
use Code\Lib\Cache; use Code\Lib\Cache;
use Code\Extend\Hook; use Code\Extend\Hook;
use Code\Render\Theme; use Code\Render\Theme;

View file

@ -3,14 +3,14 @@
namespace Code\Lib; namespace Code\Lib;
use Code\Render\Theme; use Code\Render\Theme;
use Code\Lib\System;
class Stringsjs { class Stringsjs {
public static function strings() public static function strings()
{ {
return replace_macros(Theme::get_template('js_strings.tpl'), array( return replace_macros(Theme::get_template('js_strings.tpl'), array(
'$icon' => '/images/' . PLATFORM_NAME . '-64.png', '$icon' => System::get_project_icon(),
'$delitem' => t('Delete this item?'), '$delitem' => t('Delete this item?'),
'$comment' => t('Comment'), '$comment' => t('Comment'),
'$showmore' => sprintf(t('%s show all'), '<i class=\'fa fa-chevron-down\'></i>'), '$showmore' => sprintf(t('%s show all'), '<i class=\'fa fa-chevron-down\'></i>'),

View file

@ -20,8 +20,8 @@ class System
public static function get_site_name() public static function get_site_name()
{ {
if (is_array(App::$config) && is_array(App::$config['system']) && App::$config['system']['sitename']) { if (is_array(App::$sys_channel) && isset(App::$sys_channel['channel_name'])) {
return App::$config['system']['sitename']; return App::$sys_channel['channel_name'];
} }
return ''; return '';
} }
@ -32,7 +32,8 @@ class System
$name = self::get_site_name(); $name = self::get_site_name();
if ($name) { if ($name) {
$words = explode(' ', $name); $words = explode(' ', $name);
$project = strtolower(URLify::transliterate($words[0])); // restrict result to characters allowed by the nodeinfo specification
$project = preg_replace('/[^a-z0-9-]/', '-', strtolower(URLify::transliterate($words[0])));
} }
if (!$project) { if (!$project) {
$project = self::get_platform_name(); $project = self::get_platform_name();
@ -52,9 +53,8 @@ class System
public static function get_project_icon() public static function get_project_icon()
{ {
$sys = Channel::get_system(); if (isset(App::$sys_channel['xchan_photo_l'])) {
if ($sys) { return App::$sys_channel['xchan_photo_l'];
return z_root() . '/photo/profile/l/' . $sys['channel_id'];
} }
if (is_array(App::$config) && is_array(App::$config['system']) && array_key_exists('icon', App::$config['system'])) { if (is_array(App::$config) && is_array(App::$config['system']) && array_key_exists('icon', App::$config['system'])) {
return App::$config['system']['icon']; return App::$config['system']['icon'];
@ -102,9 +102,6 @@ class System
public static function get_site_icon() public static function get_site_icon()
{ {
if (is_array(App::$config) && is_array(App::$config['system']) && isset(App::$config['system']['site_icon_url']) && App::$config['system']['site_icon_url']) {
return App::$config['system']['site_icon_url'];
}
return self::get_project_icon(); return self::get_project_icon();
} }

View file

@ -1,5 +1,5 @@
<?php <?php
namespace Code\Lib\Xprof; namespace Code\Lib;
class Xprof { class Xprof {

View file

@ -34,7 +34,8 @@ class Zotfinger
'(request-target)' => 'post ' . get_request_string($resource) '(request-target)' => 'post ' . get_request_string($resource)
]; ];
$h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], Channel::url($channel), false); $h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], Channel::url($channel), false);
} else { }
else {
$h = ['Accept: application/x-nomad+json, application/x-zot+json']; $h = ['Accept: application/x-nomad+json, application/x-zot+json'];
} }

View file

@ -28,12 +28,14 @@ class Addons
} }
goaway(z_root() . '/admin/addons/' . argv(2)); goaway(z_root() . '/admin/addons/' . argv(2));
} elseif (argc() > 2) { }
elseif (argc() > 2) {
switch (argv(2)) { switch (argv(2)) {
case 'updaterepo': case 'updaterepo':
if (array_key_exists('repoName', $_REQUEST)) { if (array_key_exists('repoName', $_REQUEST)) {
$repoName = $_REQUEST['repoName']; $repoName = $_REQUEST['repoName'];
} else { }
else {
json_return_and_die(array('message' => 'No repo name provided.', 'success' => false)); json_return_and_die(array('message' => 'No repo name provided.', 'success' => false));
} }
$extendDir = 'cache/git/sys/extend'; $extendDir = 'cache/git/sys/extend';
@ -265,13 +267,13 @@ class Addons
$enabled = in_array($plugin, Addon::list_installed()); $enabled = in_array($plugin, Addon::list_installed());
$info = Addon::get_info($plugin); $info = Addon::get_info($plugin);
$x = check_plugin_versions($info); $x = Addon::check_versions($info);
// disable plugins which are installed but incompatible versions // disable plugins which are installed but incompatible versions
if ($enabled && !$x) { if ($enabled && !$x) {
$enabled = false; $enabled = false;
uninstall_plugin($plugin); Addon::uninstall($plugin);
} }
$info['disabled'] = 1 - intval($x); $info['disabled'] = 1 - intval($x);
@ -328,7 +330,7 @@ class Addons
@require_once("addon/$plugin/$plugin.php"); @require_once("addon/$plugin/$plugin.php");
if (function_exists($plugin . '_plugin_admin')) { if (function_exists($plugin . '_plugin_admin')) {
$func = $plugin . '_plugin_admin'; $func = $plugin . '_plugin_admin';
$func($a, $admin_form); $func($admin_form);
} }
} }
@ -377,8 +379,8 @@ class Addons
if (is_dir($file)) { if (is_dir($file)) {
list($tmp, $id) = array_map('trim', explode('/', $file)); list($tmp, $id) = array_map('trim', explode('/', $file));
$info = Addon::get_info($id); $info = Addon::get_info($id);
$enabled = in_array($id, App::$plugins); $enabled = in_array($id, Addon::list_installed());
$x = check_plugin_versions($info); $x = Addon::check_versions($info);
// disable plugins which are installed but incompatible versions // disable plugins which are installed but incompatible versions
@ -386,7 +388,7 @@ class Addons
$enabled = false; $enabled = false;
$idz = array_search($id, Addon::list_installed()); $idz = array_search($id, Addon::list_installed());
if ($idz !== false) { if ($idz !== false) {
uninstall_plugin($id); Addon::uninstall($id);
} }
} }
$info['disabled'] = 1 - intval($x); $info['disabled'] = 1 - intval($x);

View file

@ -59,14 +59,12 @@ class Site
} }
$tos_required = ((x($_POST, 'tos_required')) ? intval(trim($_POST['tos_required'])) : 0); $tos_required = ((x($_POST, 'tos_required')) ? intval(trim($_POST['tos_required'])) : 0);
$mirror_frontpage = ((x($_POST, 'mirror_frontpage')) ? intval(trim($_POST['mirror_frontpage'])) : 0); $mirror_frontpage = ((x($_POST, 'mirror_frontpage')) ? intval(trim($_POST['mirror_frontpage'])) : 0);
$directory_server = ((x($_POST, 'directory_server')) ? trim($_POST['directory_server']) : '');
$force_publish = ((x($_POST, 'publish_all')) ? true : false); $force_publish = ((x($_POST, 'publish_all')) ? true : false);
$open_pubstream = ((x($_POST, 'open_pubstream')) ? true : false); $open_pubstream = ((x($_POST, 'open_pubstream')) ? true : false);
$public_stream_mode = ((x($_POST, 'public_stream_mode')) ? intval($_POST['public_stream_mode']) : PUBLIC_STREAM_NONE); $public_stream_mode = ((x($_POST, 'public_stream_mode')) ? intval($_POST['public_stream_mode']) : PUBLIC_STREAM_NONE);
$animations = ((x($_POST, 'animations')) ? true : false); $animations = ((x($_POST, 'animations')) ? true : false);
$login_on_homepage = ((x($_POST, 'login_on_homepage')) ? true : false); $login_on_homepage = ((x($_POST, 'login_on_homepage')) ? true : false);
$enable_context_help = ((x($_POST, 'enable_context_help')) ? 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'])) : '');
$no_community_page = !((x($_POST, 'no_community_page')) ? true : false); $no_community_page = !((x($_POST, 'no_community_page')) ? true : false);
$default_expire_days = ((array_key_exists('default_expire_days', $_POST)) ? intval($_POST['default_expire_days']) : 0); $default_expire_days = ((array_key_exists('default_expire_days', $_POST)) ? intval($_POST['default_expire_days']) : 0);
$active_expire_days = ((array_key_exists('active_expire_days', $_POST)) ? intval($_POST['active_expire_days']) : 7); $active_expire_days = ((array_key_exists('active_expire_days', $_POST)) ? intval($_POST['active_expire_days']) : 7);
@ -127,10 +125,6 @@ class Site
set_config('system', 'animated_avatars', $animations); set_config('system', 'animated_avatars', $animations);
set_config('system', 'tos_required', $tos_required); set_config('system', 'tos_required', $tos_required);
if ($directory_server) {
set_config('system', 'directory_server', $directory_server);
}
if ($admininfo == '') { if ($admininfo == '') {
del_config('system', 'admininfo'); del_config('system', 'admininfo');
} else { } else {
@ -166,7 +160,6 @@ class Site
set_config('system', 'language', $language); set_config('system', 'language', $language);
set_config('system', 'theme', $theme); set_config('system', 'theme', $theme);
// set_config('system','site_channel', $site_channel);
set_config('system', 'maximagesize', $maximagesize); set_config('system', 'maximagesize', $maximagesize);
set_config('system', 'register_policy', $register_policy); set_config('system', 'register_policy', $register_policy);
@ -179,12 +172,6 @@ class Site
set_config('system', 'public_stream_mode', $public_stream_mode); set_config('system', 'public_stream_mode', $public_stream_mode);
set_config('system', 'open_pubstream', $open_pubstream); set_config('system', 'open_pubstream', $open_pubstream);
set_config('system', 'force_queue_threshold', $force_queue); set_config('system', 'force_queue_threshold', $force_queue);
if ($global_directory == '') {
del_config('system', 'directory_submit_url');
} else {
set_config('system', 'directory_submit_url', $global_directory);
}
set_config('system', 'no_community_page', $no_community_page); set_config('system', 'no_community_page', $no_community_page);
set_config('system', 'no_utf', $no_utf); set_config('system', 'no_utf', $no_utf);
set_config('system', 'verifyssl', $verifyssl); set_config('system', 'verifyssl', $verifyssl);
@ -259,29 +246,6 @@ class Site
} }
} }
$dir_choices = null;
$dirmode = get_config('system', 'directory_mode');
$realm = get_directory_realm();
// directory server should not be set or settable unless we are a directory client
// avoid older redmatrix servers which don't have modern encryption
if ($dirmode == DIRECTORY_MODE_NORMAL) {
$x = q(
"select site_url from site where site_flags in (%d,%d) and site_realm = '%s' and site_dead = 0",
intval(DIRECTORY_MODE_SECONDARY),
intval(DIRECTORY_MODE_PRIMARY),
dbesc($realm)
);
if ($x) {
$dir_choices = [];
foreach ($x as $xx) {
$dir_choices[$xx['site_url']] = $xx['site_url'];
}
}
}
/* Admin Info */ /* Admin Info */
$admininfo = get_config('system', 'admininfo'); $admininfo = get_config('system', 'admininfo');
@ -321,8 +285,8 @@ class Site
'$advanced' => t('Advanced'), '$advanced' => t('Advanced'),
'$baseurl' => z_root(), '$baseurl' => z_root(),
'$sitename' => ['sitename', t("Site name"), htmlspecialchars(get_config('system', 'sitename', App::get_hostname()), ENT_QUOTES, 'UTF-8'), ''], '$sitename' => ['sitename', t("Site name"), htmlspecialchars(get_config('system', 'sitename', App::get_hostname()), ENT_QUOTES, 'UTF-8'), ''],
'$admininfo' => ['admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode may be used here.")], '$admininfo' => ['admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. Multicode may be used here.")],
'$siteinfo' => ['siteinfo', t('Site Information'), get_config('system', 'siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. BBCode may be used here.")], '$siteinfo' => ['siteinfo', t('Site Information'), get_config('system', 'siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. Multicode may be used here.")],
'$language' => ['language', t("System language"), get_config('system', 'language', 'en'), "", $lang_choices], '$language' => ['language', t("System language"), get_config('system', 'language', 'en'), "", $lang_choices],
'$theme' => ['theme', t("System theme"), get_config('system', 'theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices], '$theme' => ['theme', t("System theme"), get_config('system', 'theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices],
// '$theme_mobile' => [ 'theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile ], // '$theme_mobile' => [ 'theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile ],
@ -334,7 +298,7 @@ class Site
'$invite_only' => ['invite_only', t("Invitation only"), get_config('system', 'invitation_only'), t("Only allow new member registrations with an invitation code. New member registration must be allowed for this to work.")], '$invite_only' => ['invite_only', t("Invitation only"), get_config('system', 'invitation_only'), t("Only allow new member registrations with an invitation code. New member registration must be allowed for this to work.")],
'$invite_working' => defined('INVITE_WORKING'), '$invite_working' => defined('INVITE_WORKING'),
'$minimum_age' => ['minimum_age', t("Minimum age"), (x(get_config('system', 'minimum_age')) ? get_config('system', 'minimum_age') : 13), t("Minimum age (in years) for who may register on this site.")], '$minimum_age' => ['minimum_age', t("Minimum age"), (x(get_config('system', 'minimum_age')) ? get_config('system', 'minimum_age') : 13), t("Minimum age (in years) for who may register on this site.")],
'$access_policy' => ['access_policy', t("Which best describes the types of account offered by this hub?"), get_config('system', 'access_policy'), t("If a public server policy is selected, this information may be displayed on the public server site list."), $access_choices], '$access_policy' => ['access_policy', t("Which best describes the types of account offered by this site?"), get_config('system', 'access_policy'), t("If a public server policy is selected, this information may be displayed on the public server site list."), $access_choices],
'$register_text' => ['register_text', t("Register text"), htmlspecialchars(get_config('system', 'register_text'), ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")], '$register_text' => ['register_text', t("Register text"), htmlspecialchars(get_config('system', 'register_text'), ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")],
'$tos_required' => [ 'tos_required', t('Require acceptance of Terms of Service'),get_config('system','tos_required'),'', [ t('No'), t('Yes') ] ], '$tos_required' => [ 'tos_required', t('Require acceptance of Terms of Service'),get_config('system','tos_required'),'', [ t('No'), t('Yes') ] ],
'$role' => $role, '$role' => $role,
@ -362,7 +326,6 @@ class Site
'$reply_address' => ['reply_address', t('Reply-to email address for system generated email.'), get_config('system', 'reply_address', 'noreply@' . App::get_hostname()), ''], '$reply_address' => ['reply_address', t('Reply-to email address for system generated email.'), get_config('system', 'reply_address', 'noreply@' . App::get_hostname()), ''],
'$from_email' => ['from_email', t('Sender (From) email address for system generated email.'), get_config('system', 'from_email', 'Administrator@' . App::get_hostname()), ''], '$from_email' => ['from_email', t('Sender (From) email address for system generated email.'), get_config('system', 'from_email', 'Administrator@' . App::get_hostname()), ''],
'$from_email_name' => ['from_email_name', t('Display name of email sender for system generated email.'), get_config('system', 'from_email_name', System::get_site_name()), ''], '$from_email_name' => ['from_email_name', t('Display name of email sender for system generated email.'), get_config('system', 'from_email_name', System::get_site_name()), ''],
'$directory_server' => (($dir_choices) ? ['directory_server', t("Directory Server URL"), get_config('system', 'directory_server'), t("Default directory server"), $dir_choices] : null),
'$proxyuser' => ['proxyuser', t("Proxy user"), get_config('system', 'proxyuser'), ""], '$proxyuser' => ['proxyuser', t("Proxy user"), get_config('system', 'proxyuser'), ""],
'$proxy' => ['proxy', t("Proxy URL"), get_config('system', 'proxy'), ""], '$proxy' => ['proxy', t("Proxy URL"), get_config('system', 'proxy'), ""],
'$timeout' => ['timeout', t("Network fetch timeout"), (x(get_config('system', 'curl_timeout')) ? get_config('system', 'curl_timeout') : 60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")], '$timeout' => ['timeout', t("Network fetch timeout"), (x(get_config('system', 'curl_timeout')) ? get_config('system', 'curl_timeout') : 60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")],

View file

@ -126,7 +126,7 @@ class Themes
} }
} }
$screenshot = array(get_theme_screenshot($theme), t('Screenshot')); $screenshot = array(Theme::get_screenshot($theme), t('Screenshot'));
if (!stristr($screenshot[0], $theme)) { if (!stristr($screenshot[0], $theme)) {
$screenshot = null; $screenshot = null;
} }
@ -142,7 +142,7 @@ class Themes
'$plugin' => $theme, '$plugin' => $theme,
'$status' => $status, '$status' => $status,
'$action' => $action, '$action' => $action,
'$info' => get_theme_info($theme), '$info' => Theme::get_info($theme),
'$function' => 'themes', '$function' => 'themes',
'$admin_form' => $admin_form, '$admin_form' => $admin_form,
'$str_author' => t('Author: '), '$str_author' => t('Author: '),
@ -161,7 +161,7 @@ class Themes
$xthemes = []; $xthemes = [];
if ($themes) { if ($themes) {
foreach ($themes as $th) { foreach ($themes as $th) {
$xthemes[] = array($th['name'], (($th['allowed']) ? "on" : "off"), get_theme_info($th['name'])); $xthemes[] = array($th['name'], (($th['allowed']) ? "on" : "off"), Theme::get_info($th['name']));
} }
} }

View file

@ -21,6 +21,9 @@ class Apporder extends Controller
Navbar::set_selected('Order Apps'); Navbar::set_selected('Order Apps');
$nav_apps = [];
$navbar_apps = [];
foreach (['nav_featured_app', 'nav_pinned_app'] as $l) { foreach (['nav_featured_app', 'nav_pinned_app'] as $l) {
$syslist = []; $syslist = [];
$list = Apps::app_list(local_channel(), false, [$l]); $list = Apps::app_list(local_channel(), false, [$l]);
@ -39,7 +42,8 @@ class Apporder extends Controller
foreach ($syslist as $app) { foreach ($syslist as $app) {
if ($l === 'nav_pinned_app') { if ($l === 'nav_pinned_app') {
$navbar_apps[] = Apps::app_render($app, 'nav-order-pinned'); $navbar_apps[] = Apps::app_render($app, 'nav-order-pinned');
} else { }
else {
$nav_apps[] = Apps::app_render($app, 'nav-order'); $nav_apps[] = Apps::app_render($app, 'nav-order');
} }
} }

View file

@ -35,6 +35,7 @@ use Code\Lib\Libacl;
use Code\Lib\Head; use Code\Lib\Head;
use Code\Lib\Features; use Code\Lib\Features;
use Code\Render\Theme; use Code\Render\Theme;
use Code\Lib\Config;
require_once('include/event.php'); require_once('include/event.php');
@ -50,6 +51,10 @@ class Cdav extends Controller
$record = null; $record = null;
$channel_login = false; $channel_login = false;
if (! Config::Get('system','cdav')) {
http_status_exit(404, 'Not found');
}
if ((argv(1) !== 'calendar') && (argv(1) !== 'addressbook')) { if ((argv(1) !== 'calendar') && (argv(1) !== 'addressbook')) {
foreach (['REDIRECT_REMOTE_USER', 'HTTP_AUTHORIZATION'] as $head) { foreach (['REDIRECT_REMOTE_USER', 'HTTP_AUTHORIZATION'] as $head) {
/* Basic authentication */ /* Basic authentication */
@ -252,6 +257,11 @@ class Cdav extends Controller
return; return;
} }
if (! Config::Get('system','cdav')) {
http_status_exit(404, 'Not found');
}
if ((argv(1) === 'addressbook') && (!Apps::system_app_installed(local_channel(), 'CardDAV'))) { if ((argv(1) === 'addressbook') && (!Apps::system_app_installed(local_channel(), 'CardDAV'))) {
return; return;
} }
@ -886,6 +896,10 @@ class Cdav extends Controller
return; return;
} }
if (! Config::Get('system','cdav')) {
http_status_exit(404, 'Not found');
}
if ((argv(1) === 'addressbook') && (!Apps::system_app_installed(local_channel(), 'CardDAV'))) { if ((argv(1) === 'addressbook') && (!Apps::system_app_installed(local_channel(), 'CardDAV'))) {
// Do not display any associated widgets at this point // Do not display any associated widgets at this point
App::$pdl = ''; App::$pdl = '';

View file

@ -414,7 +414,7 @@ class Connedit extends Controller
if ($cmd === 'resetphoto') { if ($cmd === 'resetphoto') {
q( q(
"update xchan set xchan_photo_date = '2001-01-01 00:00:00' where xchan_hash = '%s'", "update xchan set xchan_photo_date = '2001-01-01 00:00:00', xchan_name_date = '2001-01-01 00:00:00' where xchan_hash = '%s'",
dbesc($orig_record['xchan_hash']) dbesc($orig_record['xchan_hash'])
); );
$cmd = 'refresh'; $cmd = 'refresh';

View file

@ -167,7 +167,7 @@ class Cover_photo extends Controller
$orig_srcw = ($srcW / $scaled_width) * $base_image['width']; $orig_srcw = ($srcW / $scaled_width) * $base_image['width'];
$orig_srch = ($srcH / $scaled_height) * $base_image['height']; $orig_srch = ($srcH / $scaled_height) * $base_image['height'];
$im->cropImageRect(1200, 435, $orig_srcx, $orig_srcy, $orig_srcw, $orig_srch); $im->cropImageRect(1200, 675, $orig_srcx, $orig_srcy, $orig_srcw, $orig_srch);
$aid = get_account_id(); $aid = get_account_id();
@ -188,12 +188,12 @@ class Cover_photo extends Controller
$r1 = $im->storeThumbnail($p, PHOTO_RES_COVER_1200); $r1 = $im->storeThumbnail($p, PHOTO_RES_COVER_1200);
$im->doScaleImage(850, 310); $im->doScaleImage(850, 478);
$p['imgscale'] = 8; $p['imgscale'] = 8;
$r2 = $im->storeThumbnail($p, PHOTO_RES_COVER_850); $r2 = $im->storeThumbnail($p, PHOTO_RES_COVER_850);
$im->doScaleImage(425, 160); $im->doScaleImage(425, 239);
$p['imgscale'] = 9; $p['imgscale'] = 9;
$r3 = $im->storeThumbnail($p, PHOTO_RES_COVER_425); $r3 = $im->storeThumbnail($p, PHOTO_RES_COVER_425);
@ -417,7 +417,7 @@ class Cover_photo extends Controller
$o .= replace_macros(Theme::get_template('cover_photo.tpl'), [ $o .= replace_macros(Theme::get_template('cover_photo.tpl'), [
'$user' => App::$channel['channel_address'], '$user' => App::$channel['channel_address'],
'$info' => t('Your cover photo may be visible to anybody on the internet'), '$info' => t('Your cover photo may be visible to anybody on the internet'),
'$existing' => get_cover_photo(local_channel(), 'array', PHOTO_RES_COVER_850), '$existing' => Channel::get_cover_photo(local_channel(), 'array', PHOTO_RES_COVER_850),
'$lbl_upfile' => t('Upload File:'), '$lbl_upfile' => t('Upload File:'),
'$lbl_profiles' => t('Select a profile:'), '$lbl_profiles' => t('Select a profile:'),
'$title' => t('Change Cover Photo'), '$title' => t('Change Cover Photo'),

View file

@ -426,7 +426,6 @@ class Dirsearch extends Controller
{ {
$rand = db_getfunc('rand'); $rand = db_getfunc('rand');
$realm = get_directory_realm();
$r = q( $r = q(
"select * from site where site_type = %d and site_dead = 0", "select * from site where site_type = %d and site_dead = 0",

View file

@ -288,7 +288,6 @@ class Display extends Controller
if ($noscript_content || $this->loading) { if ($noscript_content || $this->loading) {
$r = null; $r = null;
require_once('include/channel.php');
$sys = Channel::get_system(); $sys = Channel::get_system();
$sysid = $sys['channel_id']; $sysid = $sys['channel_id'];
@ -312,7 +311,6 @@ class Display extends Controller
} elseif ($this->updating && !$this->loading) { } elseif ($this->updating && !$this->loading) {
$r = null; $r = null;
require_once('include/channel.php');
$sys = Channel::get_system(); $sys = Channel::get_system();
$sysid = $sys['channel_id']; $sysid = $sys['channel_id'];

View file

@ -1,78 +0,0 @@
<?php
namespace Code\Module;
use App;
use Code\Web\Controller;
use Code\Render\Theme;
class Oexchange extends Controller
{
public function init()
{
if ((argc() > 1) && (argv(1) === 'xrd')) {
echo replace_macros(Theme::get_template('oexchange_xrd.tpl'), ['$base' => z_root()]);
killme();
}
}
public function get()
{
if (!local_channel()) {
if (remote_channel()) {
$observer = App::get_observer();
if ($observer && $observer['xchan_url']) {
$parsed = @parse_url($observer['xchan_url']);
if (!$parsed) {
notice(t('Unable to find your site.') . EOL);
return;
}
$url = $parsed['scheme'] . '://' . $parsed['host'] . (($parsed['port']) ? ':' . $parsed['port'] : '');
$url .= '/oexchange';
$result = z_post_url($url, $_REQUEST);
json_return_and_die($result);
}
}
return login(false);
}
if ((argc() > 1) && argv(1) === 'done') {
info(t('Post successful.') . EOL);
return;
}
$url = (((x($_REQUEST, 'url')) && strlen($_REQUEST['url']))
? urlencode(notags(trim($_REQUEST['url']))) : '');
$title = (((x($_REQUEST, 'title')) && strlen($_REQUEST['title']))
? '&title=' . urlencode(notags(trim($_REQUEST['title']))) : '');
$description = (((x($_REQUEST, 'description')) && strlen($_REQUEST['description']))
? '&description=' . urlencode(notags(trim($_REQUEST['description']))) : '');
$tags = (((x($_REQUEST, 'tags')) && strlen($_REQUEST['tags']))
? '&tags=' . urlencode(notags(trim($_REQUEST['tags']))) : '');
$ret = z_fetch_url(z_root() . '/linkinfo?f=&url=' . $url . $title . $description . $tags);
if ($ret['success']) {
$s = $ret['body'];
}
if (!strlen($s)) {
return;
}
$post = [];
$post['profile_uid'] = local_channel();
$post['return'] = '/oexchange/done';
$post['body'] = $s;
$post['type'] = 'wall';
$_REQUEST = $post;
$mod = new Item();
$mod->post();
}
}

View file

@ -22,8 +22,6 @@ class Photo extends Controller
public function init() public function init()
{ {
if (ActivityStreams::is_as_request()) { if (ActivityStreams::is_as_request()) {
$sigdata = HTTPSig::verify(EMPTY_STR); $sigdata = HTTPSig::verify(EMPTY_STR);
if ($sigdata['portable_id'] && $sigdata['header_valid']) { if ($sigdata['portable_id'] && $sigdata['header_valid']) {

View file

@ -296,7 +296,6 @@ class Channel
if ($username != $channel['channel_name']) { if ($username != $channel['channel_name']) {
$name_change = true; $name_change = true;
require_once('include/channel.php');
$err = Zlib\Channel::validate_channelname($username); $err = Zlib\Channel::validate_channelname($username);
if ($err) { if ($err) {
notice($err); notice($err);

View file

@ -5,6 +5,7 @@ namespace Code\Module\Settings;
use App; use App;
use Code\Lib\Libsync; use Code\Lib\Libsync;
use Code\Lib\Features; use Code\Lib\Features;
use Code\Lib\Addon;
use Code\Extend\Hook; use Code\Extend\Hook;
use Code\Render\Theme; use Code\Render\Theme;
@ -145,8 +146,8 @@ class Display
foreach ($allowed_themes as $th) { foreach ($allowed_themes as $th) {
$f = $th; $f = $th;
$info = get_theme_info($th); $info = Theme::get_info($th);
$compatible = check_plugin_versions($info); $compatible = Addon::check_versions($info);
if (!$compatible) { if (!$compatible) {
$themes[$f] = sprintf(t('%s - (Incompatible)'), $f); $themes[$f] = sprintf(t('%s - (Incompatible)'), $f);
continue; continue;

View file

@ -2,6 +2,7 @@
namespace Code\Module; namespace Code\Module;
use App;
use Code\Lib\Libzotdir; use Code\Lib\Libzotdir;
use Code\Lib\LibBlock; use Code\Lib\LibBlock;
use Code\Web\Controller; use Code\Web\Controller;
@ -14,17 +15,39 @@ class Sites extends Controller
public function get() public function get()
{ {
if (!(isset($_REQUEST['aj']) && $_REQUEST['aj'])) {
$_SESSION['return_url'] = App::$query_string;
}
$sql_extra = (($_REQUEST['project']) ? " and site_project = '" . escape_tags(protect_sprintf(dbesc($_REQUEST['project']))) . "' " : ""); $sql_extra = (($_REQUEST['project']) ? " and site_project = '" . escape_tags(protect_sprintf(dbesc($_REQUEST['project']))) . "' " : "");
$desc = t('This page provides information about related projects and websites that are currently known to this system. These are a small fraction of the thousands of websites and dozens of projects and providers which make up the fediverse.'); $desc = t('This page provides information about related projects and websites that are currently known to this system. These are a small fraction of the thousands of websites and dozens of projects and providers which make up the fediverse.');
$j = []; $blocked = LibBlock::fetch($channel['channel_id'], BLOCKTYPE_SERVER);
$r = q("select * from site where site_flags != 256 and site_dead = 0 $sql_extra order by site_update desc"); $j = [];
$total = 0;
$r = q(
"select count(site_url) as total from site
where site_flags != 256 and site_dead = 0 $sql_extra
order by site_update desc"
);
if ($r) {
App::set_pager_total($r[0]['total']);
$total = $r[0]['total'];
}
$r = q(
"select * from site
where site_flags != 256 and site_dead = 0 $sql_extra
order by site_update desc LIMIT %d OFFSET %d",
intval(App::$pager['itemspage']),
intval(App::$pager['start'])
);
if ($r) { if ($r) {
$blocked = LibBlock::fetch($channel['channel_id'], BLOCKTYPE_SERVER);
foreach ($r as $rr) { foreach ($r as $rr) {
$found_block = false; $found_block = false;
if ($blocked) { if ($blocked) {
@ -113,12 +136,29 @@ class Sites extends Controller
} }
} }
$o = replace_macros(Theme::get_template('sitentry_header.tpl'), [ if ($_REQUEST['aj']) {
'$dirlbl' => t('Affiliated Sites'), if ($j) {
'$desc' => $desc, $o = replace_macros(Theme::get_template('sitesajax.tpl'), [ '$entries' => $j ]);
'$entries' => $j, }
]); else {
$o = '<div id="content-complete"></div>';
}
echo $o;
killme();
}
else {
$o .= "<script> var page_query = '" . escape_tags(urlencode($_GET['req'])) . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$o .= replace_macros(Theme::get_template('sitentry_header.tpl'), [
'$dirlbl' => t('Affiliated Sites'),
'$desc' => $desc,
'$entries' => $j,
]);
if (!$j) {
$o .= '<div id="content-complete"></div>';
}
}
return $o; return $o;
} }

View file

@ -4,6 +4,7 @@ namespace Code\Module;
use App; use App;
use Code\Web\Controller; use Code\Web\Controller;
use Code\Render\Theme;
class Theme_info extends Controller class Theme_info extends Controller
{ {
@ -32,7 +33,7 @@ class Theme_info extends Controller
$theme_config = $th_config->get(); $theme_config = $th_config->get();
} }
} }
$info = get_theme_info($theme); $info = Theme::get_info($theme);
if ($info) { if ($info) {
// unfortunately there will be no translation for this string // unfortunately there will be no translation for this string
$desc = $info['description']; $desc = $info['description'];
@ -46,7 +47,7 @@ class Theme_info extends Controller
$ret = [ $ret = [
'theme' => $theme, 'theme' => $theme,
'img' => get_theme_screenshot($theme), 'img' => Theme::get_screenshot($theme),
'desc' => $desc, 'desc' => $desc,
'version' => $version, 'version' => $version,
'credits' => $credits, 'credits' => $credits,

View file

@ -179,7 +179,7 @@ class Theme
return ''; return '';
} }
static public function get_info($theme) { public static function get_info($theme) {
$info = null; $info = null;
if (is_file("view/theme/$theme/$theme.yml")) { if (is_file("view/theme/$theme/$theme.yml")) {
@ -192,7 +192,7 @@ class Theme
} }
static public function get_email_template($s, $root = '') public static function get_email_template($s, $root = '')
{ {
$testroot = ($root=='') ? $testroot = "ROOT" : $root; $testroot = ($root=='') ? $testroot = "ROOT" : $root;
$t = App::template_engine(); $t = App::template_engine();
@ -209,14 +209,14 @@ class Theme
if ($newroot != '' && substr($newroot, -1) != '/') { if ($newroot != '' && substr($newroot, -1) != '/') {
$newroot .= '/'; $newroot .= '/';
} }
$template = $t->Theme::get_email_template($s, $newroot); $template = $t->get_email_template($s, $newroot);
} }
$template = $t->Theme::get_email_template($s, $root); $template = $t->get_email_template($s, $root);
return $template; return $template;
} }
} }
static public function get_template($s, $root = '') public static function get_template($s, $root = '')
{ {
$testroot = ($root=='') ? $testroot = "ROOT" : $root; $testroot = ($root=='') ? $testroot = "ROOT" : $root;
@ -242,10 +242,30 @@ class Theme
} }
/**
* @brief Returns the theme's screenshot.
*
* The screenshot is expected as view/theme/$theme/img/screenshot.[png|jpg].
*
* @param string $theme The name of the theme
* @return string
*/
public static function get_screenshot($theme)
{
$exts = array('.png', '.jpg');
foreach ($exts as $ext) {
if (file_exists('view/theme/' . $theme . '/img/screenshot' . $ext)) {
return(z_root() . '/view/theme/' . $theme . '/img/screenshot' . $ext);
}
}
return(z_root() . '/images/blank.png');
}
public function debug() public static function debug()
{ {
logger('system_theme: ' . self::$system_theme); logger('system_theme: ' . self::$system_theme);
logger('session_theme: ' . self::$session_theme); logger('session_theme: ' . self::$session_theme);

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1000
{
public 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;
}
}

View file

@ -1,27 +0,0 @@
<?php
namespace Code\Update;
class _1001
{
public 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;
}
}

View file

@ -1,20 +0,0 @@
<?php
namespace Code\Update;
class _1002
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1003
{
public 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;
}
}

View file

@ -1,24 +0,0 @@
<?php
namespace Code\Update;
class _1004
{
public 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;
}
}

View file

@ -1,13 +0,0 @@
<?php
namespace Code\Update;
class _1005
{
public function run()
{
q("drop table guid");
q("drop table `notify-threads`");
return UPDATE_SUCCESS;
}
}

View file

@ -1,45 +0,0 @@
<?php
namespace Code\Update;
class _1006
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1007
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1008
{
public 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;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1009
{
public function run()
{
$r = q("ALTER TABLE `xprof` ADD `xprof_keywords` TEXT NOT NULL");
if ($r) {
return UPDATE_SUCCESS;
}
return UPDATE_FAILED;
}
}

View file

@ -1,19 +0,0 @@
<?php
namespace Code\Update;
class _1010
{
public 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;
}
}

View file

@ -1,17 +0,0 @@
<?php
namespace Code\Update;
class _1011
{
public 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;
}
}

View file

@ -1,17 +0,0 @@
<?php
namespace Code\Update;
class _1012
{
public 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;
}
}

View file

@ -1,22 +0,0 @@
<?php
namespace Code\Update;
class _1013
{
public 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;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1014
{
public 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;
}
}

View file

@ -1,19 +0,0 @@
<?php
namespace Code\Update;
class _1015
{
public 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;
}
}

View file

@ -1,40 +0,0 @@
<?php
namespace Code\Update;
class _1016
{
public 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;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1017
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1018
{
public 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;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1019
{
public function run()
{
$r = q("ALTER TABLE `event` DROP `message_id` ");
if ($r) {
return UPDATE_SUCCESS;
}
return UPDATE_FAILED;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1020
{
public 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;
}
}

View file

@ -1,18 +0,0 @@
<?php
namespace Code\Update;
class _1021
{
public 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;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1022
{
public 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;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1023
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1024
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1025
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1026
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1027
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1028
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1029
{
public 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;
}
}

View file

@ -1,30 +0,0 @@
<?php
namespace Code\Update;
class _1030
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1031
{
public 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;
}
}

View file

@ -1,22 +0,0 @@
<?php
namespace Code\Update;
class _1032
{
public 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;
}
}

View file

@ -1,30 +0,0 @@
<?php
namespace Code\Update;
class _1033
{
public 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;
}
}

View file

@ -1,21 +0,0 @@
<?php
namespace Code\Update;
class _1034
{
public 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;
}
}

View file

@ -1,25 +0,0 @@
<?php
namespace Code\Update;
class _1035
{
public 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;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1036
{
public function run()
{
$r = q("ALTER TABLE `profile` ADD `channels` TEXT NOT NULL AFTER `contact` ");
if ($r) {
return UPDATE_SUCCESS;
}
return UPDATE_FAILED;
}
}

View file

@ -1,30 +0,0 @@
<?php
namespace Code\Update;
class _1037
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1038
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1039
{
public 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;
}
}

View file

@ -1,17 +0,0 @@
<?php
namespace Code\Update;
class _1040
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1041
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1042
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1043
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1044
{
public function run()
{
$r = q("ALTER TABLE `term` ADD `imgurl` CHAR( 255 ) NOT NULL ,
ADD INDEX ( `imgurl` ) ");
if ($r) {
return UPDATE_SUCCESS;
}
return UPDATE_FAILED;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1045
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1046
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1047
{
public 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;
}
}

View file

@ -1,29 +0,0 @@
<?php
namespace Code\Update;
class _1048
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1049
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1050
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1051
{
public 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;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1052
{
public function run()
{
$r = q("ALTER TABLE `channel` ADD UNIQUE (`channel_address`) ");
if ($r) {
return UPDATE_SUCCESS;
}
return UPDATE_FAILED;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1053
{
public function run()
{
$r = q("ALTER TABLE `profile` ADD `chandesc` TEXT NOT NULL DEFAULT '' AFTER `pdesc` ");
if ($r) {
return UPDATE_SUCCESS;
}
return UPDATE_FAILED;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1054
{
public 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;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1055
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1056
{
public 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;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1057
{
public function run()
{
$r = q("drop table intro");
if ($r) {
return UPDATE_SUCCESS;
}
return UPDATE_FAILED;
}
}

View file

@ -1,20 +0,0 @@
<?php
namespace Code\Update;
class _1058
{
public 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;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1059
{
public function run()
{
$r = q("ALTER TABLE `mail` ADD `attach` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `body` ");
if ($r) {
return UPDATE_SUCCESS;
}
return UPDATE_FAILED;
}
}

View file

@ -1,25 +0,0 @@
<?php
namespace Code\Update;
class _1060
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1061
{
public function run()
{
$r = q("ALTER TABLE `vote` ADD INDEX ( `vote_poll` ), ADD INDEX ( `vote_element` ) ");
if ($r) {
return UPDATE_SUCCESS;
}
return UPDATE_FAILED;
}
}

View file

@ -1,35 +0,0 @@
<?php
namespace Code\Update;
class _1062
{
public 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;
}
}

View file

@ -1,17 +0,0 @@
<?php
namespace Code\Update;
class _1063
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1064
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1065
{
public 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;
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Code\Update;
class _1066
{
public 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;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1067
{
public 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;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace Code\Update;
class _1068
{
public 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;
}
}

Some files were not shown because too many files have changed in this diff Show more