aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-05-27 19:27:38 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-05-27 19:27:38 -0700
commitb381ec57346a6d7724b2317c120ce2e6e70edc37 (patch)
treee2cf66e01a87e438241e5bfac5daf6e7d3046b71
parent675aa96f222877a5aa543b8409a2c580cf10d3aa (diff)
parent11301d51a58d04843ba3056b4c9e92d59ced1334 (diff)
downloadvolse-hubzilla-b381ec57346a6d7724b2317c120ce2e6e70edc37.tar.gz
volse-hubzilla-b381ec57346a6d7724b2317c120ce2e6e70edc37.tar.bz2
volse-hubzilla-b381ec57346a6d7724b2317c120ce2e6e70edc37.zip
Merge branch 'master' of https://github.com/redmatrix/redmatrix
Conflicts: mod/impel.php
-rwxr-xr-xboot.php5
-rw-r--r--doc/main.bb1
-rw-r--r--doc/service_classes.bb37
-rw-r--r--include/api.php32
-rw-r--r--include/comanche.php15
-rwxr-xr-xinclude/diaspora.php10
-rw-r--r--include/identity.php5
-rw-r--r--include/notifier.php2
-rw-r--r--include/oauth.php8
-rw-r--r--include/text.php66
-rw-r--r--include/zot.php7
-rw-r--r--mod/impel.php140
-rw-r--r--mod/receive.php2
-rwxr-xr-xutil/service_class100
-rw-r--r--version.inc2
15 files changed, 356 insertions, 76 deletions
diff --git a/boot.php b/boot.php
index 09a8bef7e..6d97764a1 100755
--- a/boot.php
+++ b/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 );
/**
diff --git a/doc/main.bb b/doc/main.bb
index e1131679b..506f228e4 100644
--- a/doc/main.bb
+++ b/doc/main.bb
@@ -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]
diff --git a/doc/service_classes.bb b/doc/service_classes.bb
new file mode 100644
index 000000000..e5d4ecfad
--- /dev/null
+++ b/doc/service_classes.bb
@@ -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
diff --git a/include/api.php b/include/api.php
index e94266762..e4c4b5240 100644
--- a/include/api.php
+++ b/include/api.php
@@ -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;
diff --git a/include/comanche.php b/include/comanche.php
index 826948fa6..57056ae2a 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -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') {
diff --git a/include/diaspora.php b/include/diaspora.php
index fc7dbfa18..8968ee5f4 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -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'];
diff --git a/include/identity.php b/include/identity.php
index 6a2b66dda..b07706ae0 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -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) {
diff --git a/include/notifier.php b/include/notifier.php
index e12fc56e9..ffdd80403 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -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
diff --git a/include/oauth.php b/include/oauth.php
index a9509c68e..80336f906 100644
--- a/include/oauth.php
+++ b/include/oauth.php
@@ -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'])
diff --git a/include/text.php b/include/text.php
index 58e3436ca..e1923aed6 100644
--- a/include/text.php
+++ b/include/text.php
@@ -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);
diff --git a/include/zot.php b/include/zot.php
index 694338a9e..5f93ba75b 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -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)
);
diff --git a/mod/impel.php b/mod/impel.php
index 494a3a5c2..636ef8554 100644
--- a/mod/impel.php
+++ b/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($j['pagetitle']) {
- require_once('library/urlify/URLify.php');
- $pagetitle = strtolower(URLify::transliterate($j['pagetitle']));
- }
+ if($is_menu) {
+
- // Verify ability to use html or php!!!
- $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",
- 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, 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']),
+ $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!!!
+
+ $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",
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 && $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']);
}
- $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 {
diff --git a/mod/receive.php b/mod/receive.php
index b7d27d40f..deaf8cb37 100644
--- a/mod/receive.php
+++ b/mod/receive.php
@@ -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)
);
diff --git a/util/service_class b/util/service_class
new file mode 100755
index 000000000..a1a172518
--- /dev/null
+++ b/util/service_class
@@ -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";
+ }
+ }
+} \ No newline at end of file
diff --git a/version.inc b/version.inc
index 20fd10ffb..2dbf2a1b8 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2015-05-25.1043
+2015-05-27.1045