From d3bc721138433b3d4940f0c8ade7ebd39fff9b6e Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 13 Apr 2015 16:03:09 -0700 Subject: item_check_service_class wasn't returning correct results --- mod/item.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index 45ac4a6aa..53064132c 100644 --- a/mod/item.php +++ b/mod/item.php @@ -116,7 +116,7 @@ function item_post(&$a) { * Check service class limits */ if ($uid && !(x($_REQUEST,'parent')) && !(x($_REQUEST,'post_id'))) { - $ret = item_check_service_class($uid,x($_REQUEST,'webpage')); + $ret = item_check_service_class($uid,(($_REQUEST['webpage'] == ITEM_WEBPAGE) ? true : false)); if (!$ret['success']) { notice( t($ret['message']) . EOL) ; if(x($_REQUEST,'return')) @@ -1084,6 +1084,7 @@ function item_check_service_class($channel_id,$iswebpage) { $ret = array('success' => false, $message => ''); if ($iswebpage) { + // note: we aren't counting comanche templates and blocks, only webpages $r = q("select count(id) as total from item where parent = id and ( item_restrict & %d ) > 0 and ( item_restrict & %d ) = 0 and uid = %d ", intval(ITEM_WEBPAGE), @@ -1092,7 +1093,8 @@ function item_check_service_class($channel_id,$iswebpage) { ); } else { - $r = q("select count(id) as total from item where parent = id and item_restrict = 0 and uid = %d ", + $r = q("select count(id) as total from item where parent = id and item_restrict = 0 and (item_flags & %d) > 0 and uid = %d ", + intval(ITEM_WALL), intval($channel_id) ); } @@ -1103,14 +1105,16 @@ function item_check_service_class($channel_id,$iswebpage) { } if (!$iswebpage) { + $max = service_class_fetch($channel_id,'total_items'); if(! service_class_allows($channel_id,'total_items',$r[0]['total'])) { - $result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f top level posts.'),$r[0]['total']); + $result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f top level posts.'),$max); return $result; } } else { + $max = service_class_fetch($channel_id,'total_pages'); if(! service_class_allows($channel_id,'total_pages',$r[0]['total'])) { - $result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f webpages.'),$r[0]['total']); + $result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f webpages.'),$max); return $result; } } -- cgit v1.2.3 From 213ca7f8b584c9b75f25aa560b1f3eda1e415f54 Mon Sep 17 00:00:00 2001 From: Habeas Codice Date: Mon, 13 Apr 2015 16:18:11 -0700 Subject: unquote binary --- mod/attach.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/attach.php b/mod/attach.php index cf72d09c6..118c67dd5 100644 --- a/mod/attach.php +++ b/mod/attach.php @@ -36,7 +36,8 @@ function attach_init(&$a) { header('Content-disposition: attachment; filename="' . $r['data']['filename'] . '"'); if($r['data']['flags'] & ATTACH_FLAG_OS ) { - $istream = fopen('store/' . $c[0]['channel_address'] . '/' . $r['data']['data'],'rb'); + $fname = dbunescbin($r['data']['data']); + $istream = fopen('store/' . $c[0]['channel_address'] . '/' . $fname,'rb'); $ostream = fopen('php://output','wb'); if($istream && $ostream) { pipe_streams($istream,$ostream); @@ -45,7 +46,7 @@ function attach_init(&$a) { } } else - echo $r['data']['data']; + echo dbunescbin($r['data']['data']); killme(); } -- cgit v1.2.3 From bf2a97147ecef7528e9adbed3cf4a1f3af03ad72 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 14 Apr 2015 11:50:21 +0200 Subject: some more on webpages --- mod/editwebpage.php | 2 +- mod/webpages.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'mod') diff --git a/mod/editwebpage.php b/mod/editwebpage.php index e81cde479..e30a33171 100644 --- a/mod/editwebpage.php +++ b/mod/editwebpage.php @@ -126,7 +126,7 @@ function editwebpage_content(&$a) { $plaintext = true; if(get_config('system','page_mimetype')) - $mimeselect = ''; + $mimeselect = ''; else $mimeselect = mimetype_select($itm[0]['uid'],$mimetype); diff --git a/mod/webpages.php b/mod/webpages.php index b4c4e6e4e..2b284813a 100644 --- a/mod/webpages.php +++ b/mod/webpages.php @@ -70,10 +70,10 @@ function webpages_content(&$a) { return; } - if(feature_enabled($owner,'expert') || $a->is_sys) { - $mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype')); - if(! $mimetype) - $mimetype = 'choose'; + $mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype')); + + if(! $mimetype) { + $mimetype = 'choose'; } else { $mimetype = 'text/bbcode'; -- cgit v1.2.3 From 953819e7da8152f959f04c733ce617cc34cf8c7d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 14 Apr 2015 12:52:31 +0200 Subject: css fixes and remove expert mode for block page content type --- mod/blocks.php | 11 +++-------- mod/webpages.php | 3 --- 2 files changed, 3 insertions(+), 11 deletions(-) (limited to 'mod') diff --git a/mod/blocks.php b/mod/blocks.php index 1b7a3588f..e0f32f4f1 100644 --- a/mod/blocks.php +++ b/mod/blocks.php @@ -78,16 +78,11 @@ function blocks_content(&$a) { return; } + $mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype')); - if(feature_enabled($owner,'expert')) { - $mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype')); - if(! $mimetype) - $mimetype = 'choose'; + if(! $mimetype) { + $mimetype = 'choose'; } - else { - $mimetype = 'text/bbcode'; - } - $x = array( 'webpage' => ITEM_BUILDBLOCK, diff --git a/mod/webpages.php b/mod/webpages.php index 2b284813a..e2b5eb3a4 100644 --- a/mod/webpages.php +++ b/mod/webpages.php @@ -75,9 +75,6 @@ function webpages_content(&$a) { if(! $mimetype) { $mimetype = 'choose'; } - else { - $mimetype = 'text/bbcode'; - } $layout = (($_REQUEST['layout']) ? $_REQUEST['layout'] : get_pconfig($owner,'system','page_layout')); if(! $layout) -- cgit v1.2.3 From 3a45206b9971ee981ea61de31c8413350ebcdd7b Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 14 Apr 2015 16:22:33 -0700 Subject: default perms not being set in some cases --- mod/connedit.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mod') diff --git a/mod/connedit.php b/mod/connedit.php index 70839e373..8ae1707ae 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -177,7 +177,17 @@ function connedit_post(&$a) { if(($_REQUEST['pending']) && ($abook_flags & ABOOK_FLAG_PENDING)) { $abook_flags = ( $abook_flags ^ ABOOK_FLAG_PENDING ); $new_friend = true; + if(! $abook_my_perms) { + $abook_my_perms = get_channel_default_perms(local_channel()); + + $role = get_pconfig(local_channel(),'system','permissions_role'); + if($role) { + $x = get_role_perms($role); + if($x['perms_accept']) + $abook_my_perms = $x['perms_accept']; + } + } } $r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_flags = %d -- cgit v1.2.3 From 2c8394a4b90b5b6dc52d5d886fd8e96134e57406 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 14 Apr 2015 21:48:42 -0700 Subject: funny I should mention comanche preview (yesterday) as clicking the view link on a layout does nothing interesting at all. So I've made it do a crude but useable preview with page content of 'Lorem Ipsum'. --- mod/page.php | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'mod') diff --git a/mod/page.php b/mod/page.php index 05d88aa52..ad1862a7a 100644 --- a/mod/page.php +++ b/mod/page.php @@ -55,11 +55,12 @@ function page_init(&$a) { $sql_options = item_permissions_sql($u[0]['channel_id']); $r = q("select item.* from item left join item_id on item.id = item_id.iid - where item.uid = %d and sid = '%s' and service = 'WEBPAGE' and - item_restrict = %d $sql_options $revision limit 1", + where item.uid = %d and sid = '%s' and (( service = 'WEBPAGE' and + item_restrict = %d ) or ( service = 'PDL' and item_restrict = %d )) $sql_options $revision limit 1", intval($u[0]['channel_id']), dbesc($page_id), - intval(ITEM_WEBPAGE) + intval(ITEM_WEBPAGE), + intval(ITEM_PDL) ); if(! $r) { @@ -83,7 +84,12 @@ function page_init(&$a) { return; } - if($r[0]['layout_mid']) { + if($r[0]['item_restrict'] == ITEM_PDL) { + require_once('include/comanche.php'); + comanche_parser(get_app(),$r[0]['body']); + get_app()->pdl = $r[0]['body']; + } + elseif($r[0]['layout_mid']) { $l = q("select body from item where mid = '%s' and uid = %d limit 1", dbesc($r[0]['layout_mid']), intval($u[0]['channel_id']) @@ -98,8 +104,6 @@ function page_init(&$a) { $a->data['webpage'] = $r; - - } @@ -111,17 +115,11 @@ function page_content(&$a) { if(! $r) return; - // logger('layout: ' . print_r($a->layout,true)); - - // Use of widgets should be determined by Comanche, but we don't have it on system pages yet, so... - - // I recommend we now get rid of this bit - it's quite a hack to work around... - mike - - if ($perms['write_pages']) { - $chan = $a->channel['channel_id']; - $who = $channel_address; - $which = $r[0]['id']; - $o .= writepages_widget($who,$which); + if($r[0]['item_restrict'] == ITEM_PDL) { + $r[0]['body'] = t('Ipsum Lorem'); + $r[0]['mimetype'] = 'text/plain'; + $r[0]['title'] = ''; + } xchan_query($r); -- cgit v1.2.3