Merge pull request #15 from redmatrix/dev

Dev
This commit is contained in:
mrjive 2018-02-21 12:55:29 +01:00 committed by GitHub
commit 2d17e1c677
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
284 changed files with 6305 additions and 4572 deletions

View File

@ -41,8 +41,10 @@ class PermissionLimits {
$limits = []; $limits = [];
$perms = Permissions::Perms(); $perms = Permissions::Perms();
$anon_comments = get_config('system','anonymous_comments',true);
foreach($perms as $k => $v) { 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; $limits[$k] = PERMS_PUBLIC;
else else
$limits[$k] = PERMS_SPECIFIC; $limits[$k] = PERMS_SPECIFIC;

View File

@ -618,8 +618,8 @@ class Notifier {
$packet = zot_build_packet($channel,$packet_type,(($packet_recips) ? $packet_recips : null)); $packet = zot_build_packet($channel,$packet_type,(($packet_recips) ? $packet_recips : null));
} }
if($packet_type === 'keychange') { if($packet_type === 'keychange') {
$packet = zot_build_packet($channel,$packet_type,(($packet_recips) ? $packet_recips : null));
$pmsg = get_pconfig($channel['channel_id'],'system','keychange'); $pmsg = get_pconfig($channel['channel_id'],'system','keychange');
$packet = zot_build_packet($channel,$packet_type,(($packet_recips) ? $packet_recips : null));
} }
elseif($packet_type === 'request') { elseif($packet_type === 'request') {
$env = (($hub_env && $hub_env[$hub['hubloc_host'] . $hub['hubloc_sitekey']]) ? $hub_env[$hub['hubloc_host'] . $hub['hubloc_sitekey']] : ''); $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 { else {
$env = (($hub_env && $hub_env[$hub['hubloc_host'] . $hub['hubloc_sitekey']]) ? $hub_env[$hub['hubloc_host'] . $hub['hubloc_sitekey']] : ''); $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( queue_insert(
[ [
'hash' => $hash, 'hash' => $hash,

View File

@ -13,10 +13,10 @@ class Queue {
require_once('include/bbcode.php'); require_once('include/bbcode.php');
if(argc() > 1) if($argc > 1)
$queue_id = argv(1); $queue_id = $argv[1];
else else
$queue_id = 0; $queue_id = EMPTY_STR;
logger('queue: start'); logger('queue: start');

View File

@ -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');
}
}

View File

@ -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;
}
}

View File

@ -119,6 +119,7 @@ class Apps {
static public function parse_app_description($f,$translate = true) { static public function parse_app_description($f,$translate = true) {
$ret = array(); $ret = array();
$baseurl = z_root(); $baseurl = z_root();
@ -194,6 +195,10 @@ class Apps {
if(! is_public_profile()) if(! is_public_profile())
unset($ret); unset($ret);
break; break;
case 'public_stream':
if(! can_view_public_stream())
unset($ret);
break;
case 'observer': case 'observer':
if(! $observer) if(! $observer)
unset($ret); unset($ret);
@ -346,6 +351,10 @@ class Apps {
if(! is_public_profile()) if(! is_public_profile())
return ''; return '';
break; break;
case 'public_stream':
if(! can_view_public_stream())
return '';
break;
case 'observer': case 'observer':
$observer = \App::get_observer(); $observer = \App::get_observer();
if(! $observer) if(! $observer)

View File

@ -10,22 +10,12 @@ class DB_Upgrade {
function __construct($db_revision) { function __construct($db_revision) {
$platform_name = System::get_platform_name();
$update_file = 'install/' . $platform_name . '/update.php';
if(! file_exists($update_file)) {
$update_file = 'install/update.php';
$this->config_name = 'db_version'; $this->config_name = 'db_version';
$this->func_prefix = 'update_r'; $this->func_prefix = '_';
}
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)) if(! intval($build))
$build = set_config('system', $this->config_name, $db_revision); $build = set_config('system', 'db_version', $db_revision);
if($build == $db_revision) { if($build == $db_revision) {
// Nothing to be done. // Nothing to be done.
@ -40,23 +30,18 @@ class DB_Upgrade {
$current = intval($db_revision); $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. for($x = $stored + 1; $x <= $current; $x ++) {
// Run any existing update scripts to bring the database up to current. $s = '_' . $x;
$cls = '\\Zotlabs\Update\\' . $s ;
if(! class_exists($cls)) {
return;
}
require_once($update_file);
// 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.
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. // There could be a lot of processes running or about to run.
// We want exactly one process to run the update command. // We want exactly one process to run the update command.
// So store the fact that we're taking responsibility // So store the fact that we're taking responsibility
@ -65,13 +50,17 @@ class DB_Upgrade {
// If the update fails or times-out completely you may need to // If the update fails or times-out completely you may need to
// delete the config entry to try again. // delete the config entry to try again.
if(get_config('database', $func)) Config::Load('database');
break;
set_config('database',$func, '1');
// call the specific update
$retval = $func(); if(get_config('database', $s))
if($retval) { break;
set_config('database',$s, '1');
$c = new $cls();
$retval = $c->run();
if($retval != UPDATE_SUCCESS) {
// Prevent sending hundreds of thousands of emails by creating // Prevent sending hundreds of thousands of emails by creating
// a lockfile. // a lockfile.
@ -88,7 +77,6 @@ class DB_Upgrade {
dbesc(\App::$config['system']['admin_email']) dbesc(\App::$config['system']['admin_email'])
); );
push_lang(($r) ? $r[0]['account_language'] : 'en'); push_lang(($r) ? $r[0]['account_language'] : 'en');
z_mail( z_mail(
[ [
'toEmail' => \App::$config['system']['admin_email'], 'toEmail' => \App::$config['system']['admin_email'],
@ -109,13 +97,11 @@ class DB_Upgrade {
pop_lang(); pop_lang();
} }
else { else {
set_config('database',$func, 'success'); set_config('database',$s, 'success');
} }
} }
} }
set_config('system', $this->config_name, $db_revision); set_config('system', 'db_version', $db_revision);
}
}
} }
} }
} }

View File

@ -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. // e.g. "your post", "David's photo", etc.
$possess_desc = t('%s <!item_type!>'); $possess_desc = t('%s <!item_type!>');
@ -128,20 +130,30 @@ class Enotify {
} }
if ($params['type'] == NOTIFY_COMMENT) { 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); $moderated = (($params['item']['item_blocked'] == ITEM_MODERATED) ? true : false);
$itemlink = $params['link']; $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) && (! visible_activity($params['item']))) { 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.'); logger('notification: not a visible activity. Ignoring.');
pop_lang(); pop_lang();
return; return;
} }
if(activity_match($params['verb'], ACTIVITY_LIKE))
$action = 'liked';
if(activity_match($params['verb'], ACTIVITY_DISLIKE))
$action = 'disliked';
}
$parent_mid = $params['parent_mid']; $parent_mid = $params['parent_mid'];
// Check to see if there was already a notify for this post. // Check to see if there was already a notify for this post.
@ -181,26 +193,29 @@ class Enotify {
//$possess_desc = str_replace('<!item_type!>',$possess_desc); //$possess_desc = str_replace('<!item_type!>',$possess_desc);
// "a post" // "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'], $recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$action,
$itemlink, $itemlink,
$item_post_type); $item_post_type);
// "George Bull's post" // "George Bull's post"
if($p) 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'], $recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$action,
$itemlink, $itemlink,
$p[0]['author']['xchan_name'], $p[0]['author']['xchan_name'],
$item_post_type); $item_post_type);
// "your post" // "your post"
if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && intval($p[0]['item_wall'])) 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'], $recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$action,
$itemlink, $itemlink,
$item_post_type); $item_post_type);
@ -231,13 +246,13 @@ class Enotify {
$itemlink = $params['link']; $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))) { if (array_key_exists('item',$params) && (! activity_match($params['item']['verb'],ACTIVITY_LIKE))) {
logger('notification: not a like activity. Ignoring.'); if(! $always_show_in_notices) {
logger('notification: not a visible activity. Ignoring.');
pop_lang(); pop_lang();
return; return;
} }
}
$parent_mid = $params['parent_mid']; $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 // Another option would be to not add them to the DB, and change how emails are handled
// (probably would be better that way) // (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 (!$always_show_in_notices) {
if (($params['type'] == NOTIFY_WALL) || ($params['type'] == NOTIFY_MAIL) || ($params['type'] == NOTIFY_INTRO)) { if (($params['type'] == NOTIFY_WALL) || ($params['type'] == NOTIFY_MAIL) || ($params['type'] == NOTIFY_INTRO)) {
$seen = 1; $seen = 1;

141
Zotlabs/Lib/Share.php Normal file
View File

@ -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;
}
}

View File

@ -7,36 +7,38 @@ namespace Zotlabs\Module\Admin;
class Dbsync { class Dbsync {
function get() { function get() {
$o = ''; $o = '';
if(argc() > 3 && intval(argv(3)) && argv(2) === 'mark') { if(argc() > 3 && intval(argv(3)) && argv(2) === 'mark') {
set_config('database', 'update_r' . intval(argv(3)), 'success'); // remove the old style config if it exists
if(intval(get_config('system','db_version')) <= intval(argv(3))) del_config('database', 'update_r' . intval(argv(3)));
set_config('system','db_version',intval(argv(3)) + 1); 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); info( t('Update has been marked successful') . EOL);
goaway(z_root() . '/admin/dbsync'); goaway(z_root() . '/admin/dbsync');
} }
if(argc() > 2 && intval(argv(2))) { if(argc() > 2 && intval(argv(2))) {
require_once('install/update.php'); $x = intval(argv(2));
$func = 'update_r' . intval(argv(2)); $s = '_' . $x;
if(function_exists($func)) { $cls = '\\Zotlabs\Update\\' . $s ;
$retval = $func(); if(class_exists($cls)) {
$c = new $cls();
$retval = $c->run();
if($retval === UPDATE_FAILED) { 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) { elseif($retval === UPDATE_SUCCESS) {
$o .= sprintf( t('Update %s was successfully applied.'), $func); $o .= sprintf( t('Update %s was successfully applied.'), $s);
set_config('database',$func, 'success'); set_config('database',$s, 'success');
} }
else 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 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; return $o;
} }
@ -45,15 +47,13 @@ class Dbsync {
$r = q("select * from config where cat = 'database' "); $r = q("select * from config where cat = 'database' ");
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$upd = intval(substr($rr['k'],8)); $upd = intval(substr($rr['k'],-4));
if($rr['v'] === 'success') if($rr['v'] === 'success')
continue; continue;
$failed[] = $upd; $failed[] = $upd;
} }
} }
if(! count($failed)) 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( $o = replace_macros(get_markup_template('failed_updates.tpl'),array(
'$base' => z_root(), '$base' => z_root(),
'$banner' => t('Failed Updates'), '$banner' => t('Failed Updates'),
@ -62,6 +62,10 @@ class Dbsync {
'$apply' => t('Attempt to execute this update step automatically'), '$apply' => t('Attempt to execute this update step automatically'),
'$failed' => $failed '$failed' => $failed
)); ));
}
else {
return '<div class="generic-content-wrapper-styled"><h3>' . t('No failed updates.') . '</h3></div>';
}
return $o; return $o;
} }

View File

@ -52,24 +52,24 @@ class Security {
function get() { function get() {
$whitesites = get_config('system','whitelisted_sites'); $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 = 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 = 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 = 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 = 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 = 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')); $embed_coop = intval(get_config('system','embed_coop'));

View File

@ -45,6 +45,7 @@ class Site {
$force_publish = ((x($_POST,'publish_all')) ? True : False); $force_publish = ((x($_POST,'publish_all')) ? True : False);
$disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True); $disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True);
$site_firehose = ((x($_POST,'site_firehose')) ? True : False); $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); $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'])) : ''); $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','publish_all', $force_publish);
set_config('system','disable_discover_tab', $disable_discover_tab); set_config('system','disable_discover_tab', $disable_discover_tab);
set_config('system','site_firehose', $site_firehose); set_config('system','site_firehose', $site_firehose);
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 == '') { if ($global_directory == '') {
del_config('system', 'directory_submit_url'); 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.")), '$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.')), '$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.')), '$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.")), '$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.")), '$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.")),

View File

@ -2,12 +2,12 @@
namespace Zotlabs\Module; namespace Zotlabs\Module;
use Zotlabs\Identity\OAuth2Storage;
class Authorize extends \Zotlabs\Web\Controller { class Authorize extends \Zotlabs\Web\Controller {
function init() {
function get() {
// workaround for HTTP-auth in CGI mode // workaround for HTTP-auth in CGI mode
if (x($_SERVER, 'REDIRECT_REMOTE_USER')) { if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
@ -28,16 +28,13 @@ class Authorize extends \Zotlabs\Web\Controller {
} }
} }
$s = new \Zotlabs\Identity\OAuth2Server(new OAuth2Storage(\DBA::$dba->db));
require_once('include/oauth2.php');
$request = \OAuth2\Request::createFromGlobals(); $request = \OAuth2\Request::createFromGlobals();
$response = new \OAuth2\Response(); $response = new \OAuth2\Response();
// validate the authorize request // validate the authorize request
if (! $oauth2_server->validateAuthorizeRequest($request, $response)) { if (! $s->validateAuthorizeRequest($request, $response)) {
$response->send(); $response->send();
killme(); killme();
} }
@ -55,13 +52,12 @@ class Authorize extends \Zotlabs\Web\Controller {
// print the authorization code if the user has authorized your client // print the authorization code if the user has authorized your client
$is_authorized = ($_POST['authorized'] === 'yes'); $is_authorized = ($_POST['authorized'] === 'yes');
$oauth2_server->handleAuthorizeRequest($request, $response, $is_authorized); $s->handleAuthorizeRequest($request, $response, $is_authorized, local_channel());
if ($is_authorized) { if ($is_authorized) {
// this is only here so that you get to see your code in the cURL request. Otherwise, // this is only here so that you get to see your code in the cURL request. Otherwise,
// we'd redirect back to the client // we'd redirect back to the client
$code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40); $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40);
echo("SUCCESS! Authorization Code: $code"); echo("SUCCESS! Authorization Code: $code");
} }
$response->send(); $response->send();

View File

@ -143,7 +143,7 @@ class Cards extends \Zotlabs\Web\Controller {
} }
$r = q("select * from item $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", $sql_extra order by item.created desc",
intval($owner), intval($owner),
intval(ITEM_TYPE_CARD) intval(ITEM_TYPE_CARD)

View File

@ -204,7 +204,7 @@ class Channel extends \Zotlabs\Web\Controller {
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime'] = datetime_convert();
} }
else { 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 ) left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
WHERE uid = %d $item_normal_update WHERE uid = %d $item_normal_update
AND item_wall = 1 $simple_update AND item_wall = 1 $simple_update
@ -239,7 +239,7 @@ class Channel extends \Zotlabs\Web\Controller {
if($load || ($checkjs->disabled())) { if($load || ($checkjs->disabled())) {
if($mid) { 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", AND item_wall = 1 $sql_extra limit 1",
dbesc($mid . '%'), dbesc($mid . '%'),
intval(\App::$profile['profile_uid']) intval(\App::$profile['profile_uid'])
@ -249,11 +249,11 @@ class Channel extends \Zotlabs\Web\Controller {
} }
} }
else { else {
$r = q("SELECT distinct id AS item_id, created FROM item $r = q("SELECT item.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 $abook_uids )
WHERE uid = %d $item_normal WHERE true and item.uid = %d AND item.item_thread_top = 1 $item_normal
AND item_wall = 1 and item_thread_top = 1 AND (abook.abook_blocked = 0 or abook.abook_flags is null)
AND (abook_blocked = 0 or abook.abook_flags is null) AND item.item_wall = 1
$sql_extra $sql_extra2 $sql_extra $sql_extra2
ORDER BY created DESC $pager_sql ", ORDER BY created DESC $pager_sql ",
intval(\App::$profile['profile_uid']) intval(\App::$profile['profile_uid'])

View File

@ -232,7 +232,7 @@ class Connections extends \Zotlabs\Web\Controller {
if($rr['xchan_url']) { if($rr['xchan_url']) {
if(($rr['vcard']) && is_array($rr['vcard']['tels']) && $rr['vcard']['tels'][0]['nr']) 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 else
$phone = ''; $phone = '';

View File

@ -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.'), '$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:'), '$lastupdtext' => t('Last update:'),
'$last_update' => relative_date($contact['abook_connected']), '$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']), '$profile_select' => contact_profile_assign($contact['abook_profile']),
'$multiprofs' => $multiprofs, '$multiprofs' => $multiprofs,
'$contact_id' => $contact['abook_id'], '$contact_id' => $contact['abook_id'],

View File

@ -22,7 +22,7 @@ class Defperms extends \Zotlabs\Web\Controller {
$r = q("SELECT abook.*, xchan.* $r = q("SELECT abook.*, xchan.*
FROM abook left join xchan on abook_xchan = xchan_hash 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()) intval(local_channel())
); );
if($r) { if($r) {

View File

@ -51,10 +51,8 @@ class Hq extends \Zotlabs\Web\Controller {
$item_normal = item_normal(); $item_normal = item_normal();
$item_normal_update = item_normal_update(); $item_normal_update = item_normal_update();
$use_index = db_use_index('created');
if(! $item_hash) { if(! $item_hash) {
$r = q("SELECT mid FROM item $use_index $r = q("SELECT mid FROM item
WHERE uid = %d $item_normal WHERE uid = %d $item_normal
AND mid = parent_mid AND mid = parent_mid
ORDER BY created DESC LIMIT 1", ORDER BY created DESC LIMIT 1",

View File

@ -39,6 +39,7 @@ class Item extends \Zotlabs\Web\Controller {
$uid = local_channel(); $uid = local_channel();
$channel = null; $channel = null;
$observer = null; $observer = null;
$datarray = [];
/** /**
@ -620,6 +621,21 @@ class Item extends \Zotlabs\Web\Controller {
} }
} }
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++;
}
}
} }
// BBCODE end alert // BBCODE end alert
@ -720,7 +736,6 @@ class Item extends \Zotlabs\Web\Controller {
if(!$thr_parent) if(!$thr_parent)
$thr_parent = $mid; $thr_parent = $mid;
$datarray = array();
$item_thread_top = ((! $parent) ? 1 : 0); $item_thread_top = ((! $parent) ? 1 : 0);

View File

@ -144,7 +144,7 @@ class Network extends \Zotlabs\Web\Controller {
// NOTREACHED // NOTREACHED
} }
if($_GET['pf'] === '1') if($_GET['pf'] === '1')
$deftag = '@' . t('forum') . '+' . intval($cid) . '+'; $deftag = '!' . t('forum') . '+' . intval($cid);
else else
$def_acl = [ 'allow_cid' => '<' . $r[0]['abook_xchan'] . '>', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ]; $def_acl = [ 'allow_cid' => '<' . $r[0]['abook_xchan'] . '>', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ];
} }
@ -210,7 +210,10 @@ class Network extends \Zotlabs\Web\Controller {
$sql_nets = ''; $sql_nets = '';
$sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE item_thread_top = 1 $sql_options ) "; $distinct = '';
$item_thread_top = ' AND item_thread_top = 1 ';
$sql_extra = $sql_options;
if($group) { if($group) {
$contact_str = ''; $contact_str = '';
@ -226,7 +229,8 @@ class Network extends \Zotlabs\Web\Controller {
$contact_str = ' 0 '; $contact_str = ' 0 ';
info( t('Privacy group is empty')); 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 ) "; $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); $x = group_rec_byhash(local_channel(), $group_hash);
@ -250,6 +254,8 @@ class Network extends \Zotlabs\Web\Controller {
intval(local_channel()) intval(local_channel())
); );
if($r) { 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 ) "; $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 = 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>' '$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>'
@ -268,6 +274,8 @@ class Network extends \Zotlabs\Web\Controller {
dbesc($xchan) dbesc($xchan)
); );
if($r) { 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 ) "; $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 = 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>' '$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>'
@ -373,6 +381,8 @@ class Network extends \Zotlabs\Web\Controller {
} }
if($conv) { 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 )) ", $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'])) dbesc(protect_sprintf($channel['channel_hash']))
); );
@ -477,11 +487,11 @@ class Network extends \Zotlabs\Web\Controller {
if($load) { if($load) {
// Fetch a page full of parent items for this page // 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 ) left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
$net_query $net_query
WHERE true $uids $item_normal WHERE true $uids $item_thread_top $item_normal
AND item.parent = item.id AND item.mid = item.parent_mid
and (abook.abook_blocked = 0 or abook.abook_flags is null) and (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_nets $sql_extra3 $sql_extra $sql_nets
$net_query2 $net_query2

View File

@ -142,6 +142,7 @@ class New_channel extends \Zotlabs\Web\Controller {
'$role' => $role, '$role' => $role,
'$default_role' => $default_role, '$default_role' => $default_role,
'$nickname' => $nickname, '$nickname' => $nickname,
'$validate' => t('Validate'),
'$submit' => t('Create'), '$submit' => t('Create'),
'$channel_usage_message' => $channel_usage_message '$channel_usage_message' => $channel_usage_message
)); ));

View File

@ -148,14 +148,12 @@ class Ping extends \Zotlabs\Web\Controller {
$pubs = q("SELECT count(id) as total from item $pubs = q("SELECT count(id) as total from item
WHERE uid = %d WHERE uid = %d
AND author_xchan != '%s'
AND obj_type != '%s'
AND item_unseen = 1 AND item_unseen = 1
AND author_xchan != '%s'
AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "' AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "'
$item_normal", $item_normal",
intval($sys['channel_id']), intval($sys['channel_id']),
dbesc(get_observer_hash()), dbesc(get_observer_hash())
dbesc(ACTIVITY_OBJ_FILE)
); );
if($pubs) if($pubs)
@ -168,8 +166,8 @@ class Ping extends \Zotlabs\Web\Controller {
$r = q("SELECT * FROM item $r = q("SELECT * FROM item
WHERE uid = %d WHERE uid = %d
AND author_xchan != '%s'
AND item_unseen = 1 AND item_unseen = 1
AND author_xchan != '%s'
AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "' AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "'
$item_normal $item_normal
ORDER BY created DESC ORDER BY created DESC
@ -210,22 +208,22 @@ class Ping extends \Zotlabs\Web\Controller {
if(x($_REQUEST, 'markRead') && local_channel()) { if(x($_REQUEST, 'markRead') && local_channel()) {
switch($_REQUEST['markRead']) { switch($_REQUEST['markRead']) {
case 'network': 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()) intval(local_channel())
); );
break; break;
case 'home': 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()) intval(local_channel())
); );
break; break;
case 'mail': 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()) intval(local_channel())
); );
break; break;
case 'all_events': 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()), intval(local_channel()),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 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()) { if(x($_REQUEST, 'markItemRead') && local_channel()) {
$r = q("update item set item_unseen = 0 where parent = %d and uid = %d", $r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND parent = %d",
intval($_REQUEST['markItemRead']), intval(local_channel()),
intval(local_channel()) intval($_REQUEST['markItemRead'])
); );
} }
@ -256,7 +254,7 @@ class Ping extends \Zotlabs\Web\Controller {
* dropdown menu. * dropdown menu.
*/ */
if(argc() > 1 && argv(1) === 'notify') { 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()) intval(local_channel())
); );
@ -270,7 +268,18 @@ class Ping extends \Zotlabs\Web\Controller {
$mid = basename($tt['link']); $mid = basename($tt['link']);
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)); $b64mid = ((strpos($mid, 'b64.' === 0)) ? $mid : 'b64.' . base64url_encode($mid));
}
$notifs[] = array( $notifs[] = array(
'notify_link' => z_root() . '/notify/view/' . $tt['id'], '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')) { if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) {
$result = array(); $result = array();
$use_index = db_use_index('uid_item_unseen'); $r = q("SELECT * FROM item
WHERE uid = %d
$r = q("SELECT * FROM item $use_index AND item_unseen = 1
WHERE item_unseen = 1 and uid = %d $item_normal
AND author_xchan != '%s' AND author_xchan != '%s'
ORDER BY created DESC limit 300", $item_normal
ORDER BY created DESC
LIMIT 300",
intval(local_channel()), intval(local_channel()),
dbesc($ob_hash) dbesc($ob_hash)
); );
@ -495,10 +505,8 @@ class Ping extends \Zotlabs\Web\Controller {
if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) { if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) {
$use_index = db_use_index('uid_item_unseen'); $r = q("SELECT id, item_wall FROM item
WHERE uid = %d and item_unseen = 1
$r = q("SELECT id, item_wall FROM item $use_index
WHERE item_unseen = 1 and uid = %d
$item_normal $item_normal
AND author_xchan != '%s'", AND author_xchan != '%s'",
intval(local_channel()), intval(local_channel()),

View File

@ -12,8 +12,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
if($load) if($load)
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime'] = datetime_convert();
if((observer_prohibited(true)) || (! (intval(get_config('system','open_pubstream',1))) && get_observer_hash())) {
if(observer_prohibited(true)) {
return login(); return login();
} }
@ -168,6 +167,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
$net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : ''); $net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : '');
$net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : ''); $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']) . "' " : ''); $simple_update = (($_SESSION['loadtime']) ? " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' " : '');
@ -196,11 +196,10 @@ class Pubstream extends \Zotlabs\Web\Controller {
} }
else { else {
// Fetch a page full of parent items for this page // 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 item.id 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 $abook_uids )
$net_query $net_query
WHERE true $uids $item_normal WHERE true $uids and item.item_thread_top = 1 $item_normal
AND item.parent = item.id
and (abook.abook_blocked = 0 or abook.abook_flags is null) and (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_nets $net_query2 $sql_extra3 $sql_extra $sql_nets $net_query2
ORDER BY $ordering DESC $pager_sql " ORDER BY $ordering DESC $pager_sql "

View File

@ -90,7 +90,7 @@ class Search extends \Zotlabs\Web\Controller {
} }
else { else {
$regstr = db_getfunc('REGEXP'); $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... // Here is the way permissions work in the search module...

View File

@ -331,22 +331,21 @@ class Channel {
); );
$limits = \Zotlabs\Access\PermissionLimits::Get(local_channel()); $limits = \Zotlabs\Access\PermissionLimits::Get(local_channel());
$anon_comments = get_config('system','anonymous_comments',true);
foreach($global_perms as $k => $perm) { foreach($global_perms as $k => $perm) {
$options = array(); $options = array();
$can_be_public = ((strstr($k,'view') || ($k === 'post_comments' && $anon_comments)) ? true : false);
foreach($perm_opts as $opt) { 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; continue;
$options[$opt[1]] = $opt[0]; $options[$opt[1]] = $opt[0];
} }
$permiss[] = array($k,$perm,$limits[$k],'',$options); $permiss[] = array($k,$perm,$limits[$k],'',$options);
} }
// logger('permiss: ' . print_r($permiss,true)); // logger('permiss: ' . print_r($permiss,true));
$username = $channel['channel_name']; $username = $channel['channel_name'];
$nickname = $channel['channel_address']; $nickname = $channel['channel_address'];
$timezone = $channel['channel_timezone']; $timezone = $channel['channel_timezone'];

View File

@ -21,7 +21,7 @@ class Display {
if(! $theme) if(! $theme)
$theme = 'redbasic'; $theme = 'redbasic';
$mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : '');
$preload_images = ((x($_POST,'preload_images')) ? intval($_POST['preload_images']) : 0); $preload_images = ((x($_POST,'preload_images')) ? intval($_POST['preload_images']) : 0);
$channel_menu = ((x($_POST,'channel_menu')) ? intval($_POST['channel_menu']) : 0); $channel_menu = ((x($_POST,'channel_menu')) ? intval($_POST['channel_menu']) : 0);
$user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0); $user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0);
@ -47,11 +47,6 @@ class Display {
if($itemspage > 100) if($itemspage > 100)
$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','preload_images',$preload_images);
set_pconfig(local_channel(),'system','user_scalable',$user_scalable); set_pconfig(local_channel(),'system','user_scalable',$user_scalable);
@ -114,10 +109,6 @@ class Display {
$theme = (($existing_theme) ? $existing_theme : $default_theme); $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_str = get_config('system','allowed_themes');
$allowed_themes_raw = explode(',',$allowed_themes_str); $allowed_themes_raw = explode(',',$allowed_themes_str);
$allowed_themes = array(); $allowed_themes = array();
@ -135,26 +126,19 @@ class Display {
$info = get_theme_info($th); $info = get_theme_info($th);
$compatible = check_plugin_versions($info); $compatible = check_plugin_versions($info);
if(!$compatible) { if(! $compatible) {
$mobile_themes[$f] = $themes[$f] = sprintf(t('%s - (Incompatible)'), $f); $themes[$f] = sprintf(t('%s - (Incompatible)'), $f);
continue; continue;
} }
$is_experimental = file_exists('view/theme/' . $th . '/experimental'); $is_experimental = file_exists('view/theme/' . $th . '/experimental');
$unsupported = file_exists('view/theme/' . $th . '/unsupported'); $unsupported = file_exists('view/theme/' . $th . '/unsupported');
$is_mobile = file_exists('view/theme/' . $th . '/mobile');
$is_library = file_exists('view/theme/'. $th . '/library'); $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))){ 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); $theme_name = (($is_experimental) ? sprintf(t('%s - (Experimental)'), $f) : $f);
if (! $is_library) { if (! $is_library) {
if($is_mobile) { $themes[$f] = $theme_name;
$mobile_themes[$f] = $themes[$f] = $theme_name . ' (' . t('mobile') . ')';
}
else {
$mobile_themes[$f] = $themes[$f] = $theme_name;
}
} }
} }
} }
@ -166,7 +150,6 @@ class Display {
$theme_selected = explode(':', $theme_selected)[0]; $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 = get_pconfig(local_channel(),'system','preload_images');
$preload_images = (($preload_images===false)? '0': $preload_images); // default if not set: 0 $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), '$theme' => (($themes) ? array('theme', t('Display Theme:'), $theme_selected, '', $themes, 'preview') : false),
'$schema' => array('schema', t('Select scheme'), $existing_schema, '' , $schemas), '$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), '$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), '$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')), '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')),

View File

@ -14,6 +14,10 @@ class Share extends \Zotlabs\Web\Controller {
if(! $post_id) if(! $post_id)
killme(); killme();
echo '[share=' . $post_id . '][/share]';
killme();
if(! (local_channel() || remote_channel())) if(! (local_channel() || remote_channel()))
killme(); killme();

View File

@ -2,12 +2,12 @@
namespace Zotlabs\Module; namespace Zotlabs\Module;
use Zotlabs\Identity\OAuth2Storage;
class Token extends \Zotlabs\Web\Controller { class Token extends \Zotlabs\Web\Controller {
function init() {
function get() {
// workaround for HTTP-auth in CGI mode // workaround for HTTP-auth in CGI mode
if (x($_SERVER, 'REDIRECT_REMOTE_USER')) { if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
@ -28,11 +28,8 @@ class Token extends \Zotlabs\Web\Controller {
} }
} }
$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();
} }

View File

@ -8,10 +8,8 @@ use App;
class Theme { class Theme {
static $system_theme = null; static $system_theme = null;
static $system_mobile_theme = null;
static $session_theme = null; static $session_theme = null;
static $session_mobile_theme = null;
/** /**
* @brief Array with base or fallback themes. * @brief Array with base or fallback themes.
@ -32,10 +30,6 @@ class Theme {
? \App::$config['system']['theme'] : ''); ? \App::$config['system']['theme'] : '');
self::$session_theme = ((isset($_SESSION) && x($_SESSION, 'theme')) self::$session_theme = ((isset($_SESSION) && x($_SESSION, 'theme'))
? $_SESSION['theme'] : self::$system_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; $page_theme = null;
@ -55,30 +49,12 @@ class Theme {
if(array_key_exists('theme', \App::$layout) && \App::$layout['theme']) if(array_key_exists('theme', \App::$layout) && \App::$layout['theme'])
$page_theme = \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)
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;
}
}
}
else {
$chosen_theme = self::$session_theme; $chosen_theme = self::$session_theme;
if($page_theme) { if($page_theme) {
$chosen_theme = $page_theme; $chosen_theme = $page_theme;
} }
}
if(array_key_exists('theme_preview', $_GET)) if(array_key_exists('theme_preview', $_GET))
$chosen_theme = $_GET['theme_preview']; $chosen_theme = $_GET['theme_preview'];

15
Zotlabs/Update/_1000.php Normal file
View File

@ -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;
}
}

27
Zotlabs/Update/_1001.php Normal file
View File

@ -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;
}
}

20
Zotlabs/Update/_1002.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1003.php Normal file
View File

@ -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;
}
}

24
Zotlabs/Update/_1004.php Normal file
View File

@ -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;
}
}

13
Zotlabs/Update/_1005.php Normal file
View File

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

45
Zotlabs/Update/_1006.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1007.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1008.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1009.php Normal file
View File

@ -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;
}
}

18
Zotlabs/Update/_1010.php Normal file
View File

@ -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;
}
}

16
Zotlabs/Update/_1011.php Normal file
View File

@ -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;
}
}

16
Zotlabs/Update/_1012.php Normal file
View File

@ -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;
}
}

21
Zotlabs/Update/_1013.php Normal file
View File

@ -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;
}
}

14
Zotlabs/Update/_1014.php Normal file
View File

@ -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;
}
}

19
Zotlabs/Update/_1015.php Normal file
View File

@ -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;
}
}

39
Zotlabs/Update/_1016.php Normal file
View File

@ -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;
}
}

14
Zotlabs/Update/_1017.php Normal file
View File

@ -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;
}
}

16
Zotlabs/Update/_1018.php Normal file
View File

@ -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;
}
}

14
Zotlabs/Update/_1019.php Normal file
View File

@ -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;
}
}

14
Zotlabs/Update/_1020.php Normal file
View File

@ -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;
}
}

17
Zotlabs/Update/_1021.php Normal file
View File

@ -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;
}
}

14
Zotlabs/Update/_1022.php Normal file
View File

@ -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;
}
}

14
Zotlabs/Update/_1023.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1024.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1025.php Normal file
View File

@ -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;
}
}

16
Zotlabs/Update/_1026.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1027.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1028.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1029.php Normal file
View File

@ -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;
}
}

29
Zotlabs/Update/_1030.php Normal file
View File

@ -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;
}
}

16
Zotlabs/Update/_1031.php Normal file
View File

@ -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;
}
}

21
Zotlabs/Update/_1032.php Normal file
View File

@ -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;
}
}

29
Zotlabs/Update/_1033.php Normal file
View File

@ -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;
}
}

20
Zotlabs/Update/_1034.php Normal file
View File

@ -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;
}
}

24
Zotlabs/Update/_1035.php Normal file
View File

@ -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;
}
}

16
Zotlabs/Update/_1036.php Normal file
View File

@ -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;
}
}

30
Zotlabs/Update/_1037.php Normal file
View File

@ -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;
}
}

17
Zotlabs/Update/_1038.php Normal file
View File

@ -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;
}
}

16
Zotlabs/Update/_1039.php Normal file
View File

@ -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;
}
}

16
Zotlabs/Update/_1040.php Normal file
View File

@ -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;
}
}

16
Zotlabs/Update/_1041.php Normal file
View File

@ -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;
}
}

16
Zotlabs/Update/_1042.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1043.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1044.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1045.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1046.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1047.php Normal file
View File

@ -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;
}
}

29
Zotlabs/Update/_1048.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1049.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1050.php Normal file
View File

@ -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;
}
}

16
Zotlabs/Update/_1051.php Normal file
View File

@ -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;
}
}

14
Zotlabs/Update/_1052.php Normal file
View File

@ -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;
}
}

14
Zotlabs/Update/_1053.php Normal file
View File

@ -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;
}
}

14
Zotlabs/Update/_1054.php Normal file
View File

@ -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;
}
}

14
Zotlabs/Update/_1055.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1056.php Normal file
View File

@ -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;
}
}

14
Zotlabs/Update/_1057.php Normal file
View File

@ -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;
}
}

19
Zotlabs/Update/_1058.php Normal file
View File

@ -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;
}
}

14
Zotlabs/Update/_1059.php Normal file
View File

@ -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;
}
}

24
Zotlabs/Update/_1060.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1061.php Normal file
View File

@ -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;
}
}

34
Zotlabs/Update/_1062.php Normal file
View File

@ -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;
}
}

16
Zotlabs/Update/_1063.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1064.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1065.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1066.php Normal file
View File

@ -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;
}
}

14
Zotlabs/Update/_1067.php Normal file
View File

@ -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;
}
}

14
Zotlabs/Update/_1068.php Normal file
View File

@ -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;
}
}

15
Zotlabs/Update/_1069.php Normal file
View File

@ -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;
}
}

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