Merge branch 'master' of https://github.com/redmatrix/redmatrix
Conflicts: mod/impel.php
This commit is contained in:
commit
b381ec5734
5
boot.php
5
boot.php
@ -230,15 +230,16 @@ define ( 'PAGE_REMOVED', 0x8000 );
|
||||
|
||||
|
||||
/**
|
||||
* Photo types
|
||||
* Photo usage types
|
||||
*/
|
||||
|
||||
define ( 'PHOTO_NORMAL', 0x0000 );
|
||||
define ( 'PHOTO_PROFILE', 0x0001 );
|
||||
define ( 'PHOTO_XCHAN', 0x0002 );
|
||||
define ( 'PHOTO_THING', 0x0004 );
|
||||
define ( 'PHOTO_ADULT', 0x0008 );
|
||||
define ( 'PHOTO_COVER', 0x0010 );
|
||||
|
||||
define ( 'PHOTO_ADULT', 0x0008 );
|
||||
define ( 'PHOTO_FLAG_OS', 0x4000 );
|
||||
|
||||
/**
|
||||
|
@ -44,6 +44,7 @@ Zot is the great new communicaton protocol invented especially for the $Projectn
|
||||
[zrl=[baseurl]/help/troubleshooting]Troubleshooting Tips[/zrl]
|
||||
[zrl=[baseurl]/help/hidden_configs]Tweaking $Projectname's Hidden Configurations[/zrl]
|
||||
[zrl=[baseurl]/help/faq_admins]FAQ For Admins[/zrl]
|
||||
[zrl=[baseurl]/help/service_classes]Service Classes[/zrl]
|
||||
|
||||
[size=large][b]Technical Documentation[/b][/size]
|
||||
[zrl=[baseurl]/help/history]$Projectname history[/zrl]
|
||||
|
37
doc/service_classes.bb
Normal file
37
doc/service_classes.bb
Normal file
@ -0,0 +1,37 @@
|
||||
[b]Service Classes[/b]
|
||||
|
||||
Service classes allow you to set limits on system resources. A GUI to configure this is currently under development.
|
||||
|
||||
As a temporary measure, the following commandline utilities can be used:
|
||||
|
||||
Usage:
|
||||
|
||||
[code]util/service_class[/code]
|
||||
list service classes
|
||||
|
||||
[code]util/config system default_service_class firstclass[/code]
|
||||
set the default service class to 'firstclass'
|
||||
|
||||
[code]util/service_class firstclass[/code]
|
||||
list the services that are part of 'firstclass' service class
|
||||
|
||||
[code]util/service_class firstclass photo_upload_limit 10000000[/code]
|
||||
set firstclass total photo disk usage to 10 million bytes
|
||||
|
||||
[code]util/service_class --account=5 firstclass[/code]
|
||||
set account id 5 to service class 'firstclass' (with confirmation)
|
||||
|
||||
[code]util/service_class --channel=blogchan firstclass[/code]
|
||||
set the account that owns channel 'blogchan' to service class 'firstclass' (with confirmation)
|
||||
|
||||
[b]current limits[/b]
|
||||
photo_upload_limit - maximum total bytes for photos
|
||||
total_items - maximum total toplevel posts
|
||||
total_pages - maximum comanche pages
|
||||
total_identities - maximum number of channels owned by account
|
||||
total_channels - maximum number of connections
|
||||
total_feeds - maximum number of rss feed connections
|
||||
attach_upload_limit - maximum file upload storage (bytes)
|
||||
minimum_feedcheck_minutes - lowest setting allowed for polling rss feeds
|
||||
chatrooms - maximum chatrooms
|
||||
chatters_inroom - maximum chatters per room
|
@ -433,6 +433,38 @@ require_once('include/items.php');
|
||||
|
||||
}
|
||||
|
||||
function api_client_register(&$a,$type) {
|
||||
|
||||
$ret = array();
|
||||
$key = random_string(16);
|
||||
$secret = random_string(16);
|
||||
$name = trim(escape_tags($_REQUEST['application_name']));
|
||||
if(! $name)
|
||||
json_return_and_die($ret);
|
||||
if(is_array($_REQUEST['redirect_uris']))
|
||||
$redirect = trim($_REQUEST['redirect_uris'][0]);
|
||||
else
|
||||
$redirect = trim($_REQUEST['redirect_uris']);
|
||||
$icon = trim($_REQUEST['logo_uri']);
|
||||
$r = q("INSERT INTO clients (client_id, pw, name, redirect_uri, icon, uid)
|
||||
VALUES ('%s','%s','%s','%s','%s',%d)",
|
||||
dbesc($key),
|
||||
dbesc($secret),
|
||||
dbesc($name),
|
||||
dbesc($redirect),
|
||||
dbesc($icon),
|
||||
intval(0)
|
||||
);
|
||||
|
||||
$ret['client_id'] = $key;
|
||||
$ret['client_secret'] = $secret;
|
||||
$ret['expires_at'] = 0;
|
||||
json_return_and_die($ret);
|
||||
}
|
||||
|
||||
api_register_func('api/client/register','api_client_register', false);
|
||||
|
||||
|
||||
|
||||
function api_item_get_user(&$a, $item) {
|
||||
global $usercache;
|
||||
|
@ -168,6 +168,21 @@ function comanche_block($s, $class = '') {
|
||||
);
|
||||
|
||||
if($r) {
|
||||
//check for eventual menus in the block and parse them
|
||||
$cnt = preg_match_all("/\[menu\](.*?)\[\/menu\]/ism", $r[0]['body'], $matches, PREG_SET_ORDER);
|
||||
if($cnt) {
|
||||
foreach($matches as $mtch) {
|
||||
$r[0]['body'] = str_replace($mtch[0], comanche_menu(trim($mtch[1])), $r[0]['body']);
|
||||
}
|
||||
}
|
||||
$cnt = preg_match_all("/\[menu=(.*?)\](.*?)\[\/menu\]/ism", $r[0]['body'], $matches, PREG_SET_ORDER);
|
||||
if($cnt) {
|
||||
foreach($matches as $mtch) {
|
||||
$r[0]['body'] = str_replace($mtch[0],comanche_menu(trim($mtch[2]),$mtch[1]),$r[0]['body']);
|
||||
}
|
||||
}
|
||||
|
||||
//emit the block
|
||||
$o .= (($var['wrap'] == 'none') ? '' : '<div class="' . $class . '">');
|
||||
|
||||
if($r[0]['title'] && trim($r[0]['body']) != '$content') {
|
||||
|
@ -24,8 +24,9 @@ function diaspora_dispatch_public($msg) {
|
||||
|
||||
// find everybody following or allowing this author
|
||||
|
||||
$r = q("SELECT * from channel where channel_id in ( SELECT abook_channel from abook left join xchan on abook_xchan = xchan_hash WHERE xchan_network like '%%diaspora%%' and xchan_addr = '%s' )",
|
||||
dbesc($msg['author'])
|
||||
$r = q("SELECT * from channel where channel_id in ( SELECT abook_channel from abook left join xchan on abook_xchan = xchan_hash WHERE xchan_network like '%%diaspora%%' and xchan_addr = '%s' ) and ( channel_pageflags & %d ) = 0 ",
|
||||
dbesc($msg['author']),
|
||||
intval(PAGE_REMOVED)
|
||||
);
|
||||
|
||||
// also need to look for those following public streams
|
||||
@ -2390,6 +2391,11 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
|
||||
$a = get_app();
|
||||
$myaddr = $owner['channel_address'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
|
||||
|
||||
if(intval($item['id']) != intval($item['parent'])) {
|
||||
logger('attempted to send a comment as a top-level post');
|
||||
return;
|
||||
}
|
||||
|
||||
$images = array();
|
||||
|
||||
$title = $item['title'];
|
||||
|
@ -619,8 +619,9 @@ function profile_load(&$a, $nickname, $profile = '') {
|
||||
|
||||
logger('profile_load: ' . $nickname . (($profile) ? ' profile: ' . $profile : ''));
|
||||
|
||||
$user = q("select channel_id from channel where channel_address = '%s' limit 1",
|
||||
dbesc($nickname)
|
||||
$user = q("select channel_id from channel where channel_address = '%s' and not ( channel_pageflags & %d ) > 0 limit 1",
|
||||
dbesc($nickname),
|
||||
intval(PAGE_REMOVED)
|
||||
);
|
||||
|
||||
if(! $user) {
|
||||
|
@ -410,6 +410,8 @@ function notifier_run($argv, $argc){
|
||||
|
||||
$relay_to_owner = (((! $top_level_post) && (intval($target_item['item_origin'])) && comment_local_origin($target_item)) ? true : false);
|
||||
|
||||
|
||||
|
||||
$uplink = false;
|
||||
|
||||
// $cmd === 'relay' indicates the owner is sending it to the original recipients
|
||||
|
@ -175,16 +175,8 @@ class FKOAuth1 extends OAuthServer {
|
||||
|
||||
if(strlen($a->channel['channel_timezone'])) {
|
||||
date_default_timezone_set($a->channel['channel_timezone']);
|
||||
// $a->timezone = $a->user['timezone'];
|
||||
}
|
||||
|
||||
// $r = q("SELECT * FROM `contact` WHERE `uid` = %s AND `self` = 1 LIMIT 1",
|
||||
// intval($_SESSION['uid']));
|
||||
// if(count($r)) {
|
||||
// $a->contact = $r[0];
|
||||
// $a->cid = $r[0]['id'];
|
||||
// $_SESSION['cid'] = $a->cid;
|
||||
// }
|
||||
// q("UPDATE `user` SET `login_date` = '%s' WHERE `uid` = %d LIMIT 1",
|
||||
// dbesc(datetime_convert()),
|
||||
// intval($_SESSION['uid'])
|
||||
|
@ -137,6 +137,72 @@ function purify_html($s) {
|
||||
$config->set('Cache.DefinitionImpl', null);
|
||||
$config->set('Attr.EnableID', true);
|
||||
|
||||
//Allow some custom data- attributes used by built-in libs.
|
||||
//In this way members which do not have allowcode set can still use the built-in js libs in webpages to some extent.
|
||||
|
||||
$def = $config->getHTMLDefinition(true);
|
||||
|
||||
//data- attributes used by the foundation library
|
||||
$def->info_global_attr['data-options'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-magellan-expedition'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-magellan-destination'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-magellan-arrival'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-offcanvas'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-topbar'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-orbit'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-orbit-slide-number'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-dropdown'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-dropdown-content'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-reveal-id'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-reveal'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-alert'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-tooltip'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-joyride'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-id'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-text'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-class'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-prev-tex'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-button'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-accordion'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-tab'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-equalizer'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-equalizer-watch'] = new HTMLPurifier_AttrDef_Text;
|
||||
|
||||
//data- attributes used by the bootstrap library
|
||||
$def->info_global_attr['data-dismiss'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-target'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-toggle'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-backdrop'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-keyboard'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-show'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-spy'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-offset'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-animation'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-container'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-delay'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-placement'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-title'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-trigger'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-content'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-trigger'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-parent'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-ride'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-slide-to'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-slide'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-interval'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-pause'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-wrap'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-offset-top'] = new HTMLPurifier_AttrDef_Text;
|
||||
$def->info_global_attr['data-offset-bottom'] = new HTMLPurifier_AttrDef_Text;
|
||||
|
||||
//some html5 elements
|
||||
$def->addElement('section', 'Block', 'Flow', 'Common');
|
||||
$def->addElement('nav', 'Block', 'Flow', 'Common');
|
||||
$def->addElement('article', 'Block', 'Flow', 'Common');
|
||||
$def->addElement('aside', 'Block', 'Flow', 'Common');
|
||||
$def->addElement('header', 'Block', 'Flow', 'Common');
|
||||
$def->addElement('footer', 'Block', 'Flow', 'Common');
|
||||
|
||||
$purifier = new HTMLPurifier($config);
|
||||
|
||||
return $purifier->purify($s);
|
||||
|
@ -1097,7 +1097,7 @@ function zot_import($arr, $sender_url) {
|
||||
}
|
||||
stringify_array_elms($recip_arr);
|
||||
$recips = implode(',',$recip_arr);
|
||||
$r = q("select channel_hash as hash from channel where channel_hash in ( " . $recips . " ) and not ( channel_pageflags & %d )>0 ",
|
||||
$r = q("select channel_hash as hash from channel where channel_hash in ( " . $recips . " ) and not ( channel_pageflags & %d ) > 0 ",
|
||||
intval(PAGE_REMOVED)
|
||||
);
|
||||
if(! $r) {
|
||||
@ -1361,7 +1361,8 @@ function public_recips($msg) {
|
||||
if(($tag['type'] === 'mention') && (strpos($tag['url'],z_root()) !== false)) {
|
||||
$address = basename($tag['url']);
|
||||
if($address) {
|
||||
$z = q("select channel_hash as hash from channel where channel_address = '%s' limit 1",
|
||||
$z = q("select channel_hash as hash from channel where channel_address = '%s'
|
||||
and ( channel_pageflags & " . intval(PAGE_REMOVED) . " ) = 0 limit 1",
|
||||
dbesc($address)
|
||||
);
|
||||
if($z)
|
||||
@ -1465,7 +1466,7 @@ function allowed_public_recips($msg) {
|
||||
$condensed_recips[] = $rr['hash'];
|
||||
|
||||
$results = array();
|
||||
$r = q("select channel_hash as hash from channel left join abook on abook_channel = channel_id where abook_xchan = '%s' and not ( channel_pageflags & %d ) > 0 ",
|
||||
$r = q("select channel_hash as hash from channel left join abook on abook_channel = channel_id where abook_xchan = '%s' and ( channel_pageflags & %d ) = 0 ",
|
||||
dbesc($hash),
|
||||
intval(PAGE_REMOVED)
|
||||
);
|
||||
|
138
mod/impel.php
138
mod/impel.php
@ -25,6 +25,10 @@ function impel_init(&$a) {
|
||||
$channel = $a->get_channel();
|
||||
|
||||
$arr = array();
|
||||
$is_menu = false;
|
||||
|
||||
// a portable menu has its links rewritten with the local baseurl
|
||||
$portable_menu = false;
|
||||
|
||||
switch($j['type']) {
|
||||
case 'webpage':
|
||||
@ -42,82 +46,104 @@ function impel_init(&$a) {
|
||||
$namespace = 'PDL';
|
||||
$installed_type = t('layout');
|
||||
break;
|
||||
case 'portable-menu':
|
||||
$portable_menu = true;
|
||||
// fall through
|
||||
case 'menu':
|
||||
$is_menu = true;
|
||||
$installed_type = t('menu');
|
||||
break;
|
||||
default:
|
||||
logger('mod_impel: unrecognised element type' . print_r($j,true));
|
||||
break;
|
||||
}
|
||||
$arr['uid'] = local_channel();
|
||||
$arr['aid'] = $channel['channel_account_id'];
|
||||
$arr['title'] = $j['title'];
|
||||
$arr['body'] = $j['body'];
|
||||
$arr['term'] = $j['term'];
|
||||
$arr['created'] = datetime_convert('UTC','UTC', $j['created']);
|
||||
$arr['edited'] = datetime_convert('UTC','UTC',$j['edited']);
|
||||
$arr['owner_xchan'] = get_observer_hash();
|
||||
$arr['author_xchan'] = (($j['author_xchan']) ? $j['author_xchan'] : get_observer_hash());
|
||||
$arr['mimetype'] = (($j['mimetype']) ? $j['mimetype'] : 'text/bbcode');
|
||||
|
||||
if(! $j['mid'])
|
||||
$j['mid'] = item_message_id();
|
||||
|
||||
$arr['mid'] = $arr['parent_mid'] = $j['mid'];
|
||||
if($is_menu) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if($j['pagetitle']) {
|
||||
require_once('library/urlify/URLify.php');
|
||||
$pagetitle = strtolower(URLify::transliterate($j['pagetitle']));
|
||||
}
|
||||
else {
|
||||
$arr['uid'] = local_channel();
|
||||
$arr['aid'] = $channel['channel_account_id'];
|
||||
$arr['title'] = $j['title'];
|
||||
$arr['body'] = $j['body'];
|
||||
$arr['term'] = $j['term'];
|
||||
$arr['created'] = datetime_convert('UTC','UTC', $j['created']);
|
||||
$arr['edited'] = datetime_convert('UTC','UTC',$j['edited']);
|
||||
$arr['owner_xchan'] = get_observer_hash();
|
||||
$arr['author_xchan'] = (($j['author_xchan']) ? $j['author_xchan'] : get_observer_hash());
|
||||
$arr['mimetype'] = (($j['mimetype']) ? $j['mimetype'] : 'text/bbcode');
|
||||
|
||||
if(! $j['mid'])
|
||||
$j['mid'] = item_message_id();
|
||||
|
||||
$arr['mid'] = $arr['parent_mid'] = $j['mid'];
|
||||
|
||||
|
||||
if($j['pagetitle']) {
|
||||
require_once('library/urlify/URLify.php');
|
||||
$pagetitle = strtolower(URLify::transliterate($j['pagetitle']));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Verify ability to use html or php!!!
|
||||
// Verify ability to use html or php!!!
|
||||
|
||||
$execflag = false;
|
||||
$execflag = false;
|
||||
|
||||
if($arr['mimetype'] === 'application/x-php') {
|
||||
$z = q("select account_id, account_roles, channel_pageflags from account left join channel on channel_account_id = account_id where channel_id = %d limit 1",
|
||||
if($arr['mimetype'] === 'application/x-php') {
|
||||
$z = q("select account_id, account_roles, channel_pageflags from account left join channel on channel_account_id = account_id where channel_id = %d limit 1",
|
||||
intval(local_channel())
|
||||
);
|
||||
|
||||
if($z && (($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($z[0]['channel_pageflags'] & PAGE_ALLOWCODE))) {
|
||||
$execflag = true;
|
||||
}
|
||||
}
|
||||
|
||||
$remote_id = 0;
|
||||
|
||||
$z = q("select * from item_id where sid = '%s' and service = '%s' and uid = %d limit 1",
|
||||
dbesc($pagetitle),
|
||||
dbesc($namespace),
|
||||
intval(local_channel())
|
||||
);
|
||||
$i = q("select id, edited, item_deleted from item where mid = '%s' and uid = %d limit 1",
|
||||
dbesc($arr['mid']),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
||||
if($z && (($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($z[0]['channel_pageflags'] & PAGE_ALLOWCODE))) {
|
||||
$execflag = true;
|
||||
if($z && $i) {
|
||||
$remote_id = $z[0]['id'];
|
||||
$arr['id'] = $i[0]['id'];
|
||||
// don't update if it has the same timestamp as the original
|
||||
if($arr['edited'] > $i[0]['edited'])
|
||||
$x = item_store_update($arr,$execflag);
|
||||
}
|
||||
else {
|
||||
if(($i) && (intval($i[0]['item_deleted']))) {
|
||||
// was partially deleted already, finish it off
|
||||
q("delete from item where mid = '%s' and uid = %d",
|
||||
dbesc($arr['mid']),
|
||||
intval(local_channel())
|
||||
);
|
||||
}
|
||||
$x = item_store($arr,$execflag);
|
||||
}
|
||||
|
||||
if($x['success']) {
|
||||
$item_id = $x['item_id'];
|
||||
update_remote_id($channel,$item_id,$arr['item_restrict'],$pagetitle,$namespace,$remote_id,$arr['mid']);
|
||||
}
|
||||
}
|
||||
|
||||
$remote_id = 0;
|
||||
|
||||
$z = q("select * from item_id where sid = '%s' and service = '%s' and uid = %d limit 1",
|
||||
dbesc($pagetitle),
|
||||
dbesc($namespace),
|
||||
intval(local_channel())
|
||||
);
|
||||
$i = q("select id, item_deleted from item where mid = '%s' and uid = %d limit 1",
|
||||
dbesc($arr['mid']),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
||||
if($z && $i) {
|
||||
$remote_id = $z[0]['id'];
|
||||
$arr['id'] = $i[0]['id'];
|
||||
// don't update if it has the same timestamp as the original
|
||||
if($arr['edited'] > $i[0]['edited'])
|
||||
$x = item_store_update($arr,$execflag);
|
||||
}
|
||||
else {
|
||||
if(($i) && intval($i[0]['item_deleted'])) {
|
||||
// was partially deleted already, finish it off
|
||||
q("delete from item where mid = '%s' and uid = %d",
|
||||
dbesc($arr['mid']),
|
||||
intval(local_channel())
|
||||
);
|
||||
}
|
||||
$x = item_store($arr,$execflag);
|
||||
}
|
||||
if($x['success']) {
|
||||
$item_id = $x['item_id'];
|
||||
update_remote_id($channel,$item_id,$arr['item_restrict'],$pagetitle,$namespace,$remote_id,$arr['mid']);
|
||||
$ret['success'] = true;
|
||||
|
||||
info( sprintf( t('%s element installed'), $installed_type));
|
||||
}
|
||||
else {
|
||||
|
@ -31,7 +31,7 @@ function receive_post(&$a) {
|
||||
|
||||
// Diaspora sites *may* provide a truncated guid.
|
||||
|
||||
$r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_guid like '%s' AND NOT (channel_pageflags & %d )>0 LIMIT 1",
|
||||
$r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_guid like '%s' AND (channel_pageflags & %d ) = 0 LIMIT 1",
|
||||
dbesc($guid . '%'),
|
||||
intval(PAGE_REMOVED)
|
||||
);
|
||||
|
100
util/service_class
Executable file
100
util/service_class
Executable file
@ -0,0 +1,100 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
// Temporary service class utility - see baseurl/help/service_classes
|
||||
|
||||
require_once('include/cli_startup.php');
|
||||
|
||||
cli_startup();
|
||||
|
||||
if($argc > 3) {
|
||||
$d = get_config('service_class', $argv[1]);
|
||||
$d[$argv[2]] = $argv[3];
|
||||
set_config('service_class', $argv[1], $d);
|
||||
echo 'Updated service class "' . $argv[1] . '" service "' . $argv[2] . '" to ' . $argv[3] . "\n";
|
||||
}
|
||||
|
||||
if($argc == 3) {
|
||||
if(substr($argv[1], 0, 10) == '--account=') {
|
||||
$acct = substr($argv[1], 10);
|
||||
} else if(substr($argv[1], 0, 10) == '--channel=') {
|
||||
$chan = substr($argv[1], 10);
|
||||
$r = q("SELECT channel_account_id FROM channel WHERE channel_address='%s'",
|
||||
dbesc($chan)
|
||||
);
|
||||
if(!$r)
|
||||
die('could not find channel');
|
||||
|
||||
$acct = intval($r[0]['channel_account_id']);
|
||||
} else {
|
||||
exit();
|
||||
}
|
||||
$r = q('SELECT account_service_class FROM account WHERE account_id=%d',
|
||||
intval($acct)
|
||||
);
|
||||
if(!$r)
|
||||
die('could not find account');
|
||||
|
||||
$c = q('SELECT channel_address FROM channel WHERE channel_account_id=%d',
|
||||
intval($acct)
|
||||
);
|
||||
|
||||
echo "Account $acct: ";
|
||||
|
||||
foreach($c as $chan)
|
||||
echo $chan['channel_address'] . ', ';
|
||||
|
||||
echo "\n\033[1mProperty Old\t\tNew\033[0m\n";
|
||||
|
||||
if(empty($r[0]['account_service_class'])) {
|
||||
$oclass = 'None';
|
||||
$old = false;
|
||||
} else {
|
||||
$oclass = $r[0]['account_service_class'];
|
||||
$old = get_config('service_class', $oclass);
|
||||
}
|
||||
echo "service_class $oclass\t\t\033[1m" . $argv[2] . "\033[0m\n";
|
||||
|
||||
$new = get_config('service_class', $argv[2]);
|
||||
foreach(array('photo_upload_limit','total_items','total_pages','total_identities','total_channels','total_feeds','attach_upload_limit','minimum_feedcheck_minutes','chatrooms','chatters_inroom') as $prop) {
|
||||
echo $prop . str_repeat(' ',26 - strlen($prop)) . (($old && $old[$prop]) ? $old[$prop] : 'unlimited') . "\t\t\033[1m" . (($new && $new[$prop]) ? $new[$prop] : 'unlimited') . "\033[0m\n";
|
||||
}
|
||||
$r = '';
|
||||
$k = fopen('php://stdin', 'r');
|
||||
while($r != 'y' && $r != 'n') {
|
||||
echo "Are you sure? (y/n)";
|
||||
$r = substr(fgets($k), 0, 1);
|
||||
}
|
||||
if($r == 'n')
|
||||
die('no update done');
|
||||
|
||||
$r = q("UPDATE account SET account_service_class='%s' WHERE account_id=%d",
|
||||
dbesc($argv[2]),
|
||||
intval($acct)
|
||||
);
|
||||
if($r) {
|
||||
echo "updated successfully\n";
|
||||
} else {
|
||||
echo "failed\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($argc == 2) {
|
||||
$d = get_config('service_class', $argv[1]);
|
||||
echo $argv[1] . ":\n";
|
||||
foreach($d as $k => $v) {
|
||||
echo "$k = $v\n";
|
||||
}
|
||||
}
|
||||
|
||||
if($argc == 1) {
|
||||
load_config('service_class');
|
||||
foreach($a->config['service_class'] as $class=>$props) {
|
||||
echo "$class:\n";
|
||||
$d = unserialize($props);
|
||||
foreach($d as $k => $v) {
|
||||
echo "\t$k = $v\n";
|
||||
}
|
||||
}
|
||||
}
|
@ -1 +1 @@
|
||||
2015-05-25.1043
|
||||
2015-05-27.1045
|
||||
|
Reference in New Issue
Block a user