aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/attach.php5
-rw-r--r--mod/blocks.php11
-rw-r--r--mod/connedit.php10
-rw-r--r--mod/editwebpage.php2
-rw-r--r--mod/item.php12
-rw-r--r--mod/page.php32
-rw-r--r--mod/webpages.php11
7 files changed, 44 insertions, 39 deletions
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();
}
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/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
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 = '<input type="hidden" name="mimetype" value="' . $mimetype . '" />';
+ $mimeselect = '<input type="hidden" name="mimetype" value="' . $mimetype . '" />';
else
$mimeselect = mimetype_select($itm[0]['uid'],$mimetype);
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;
}
}
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);
diff --git a/mod/webpages.php b/mod/webpages.php
index b4c4e6e4e..e2b5eb3a4 100644
--- a/mod/webpages.php
+++ b/mod/webpages.php
@@ -70,13 +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';
- }
- else {
- $mimetype = 'text/bbcode';
+ $mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype'));
+
+ if(! $mimetype) {
+ $mimetype = 'choose';
}
$layout = (($_REQUEST['layout']) ? $_REQUEST['layout'] : get_pconfig($owner,'system','page_layout'));