Introduce wrap variable in comanche blocks (if set to none the block will not be wrapped in a div), fix menu item permissions (it was not possible to set them visible for everybody) and a typo

This commit is contained in:
Mario Vavti 2015-04-19 13:25:05 +02:00
parent 0883512e30
commit dd5b97639e
3 changed files with 24 additions and 48 deletions

View File

@ -133,7 +133,19 @@ function comanche_get_channel_id() {
return $channel_id;
}
function comanche_block($name) {
function comanche_block($s) {
$var = array();
$matches = array();
$name = $s;
$cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $s, $matches, PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
$var[$mtch[1]] = $mtch[2];
$name = str_replace($mtch[0], '', $name);
}
}
$o = '';
$channel_id = comanche_get_channel_id();
@ -143,12 +155,12 @@ function comanche_block($name) {
dbesc($name)
);
if($r) {
$o = '<div class="bblock">';
$o .= (($var['wrap'] == 'none') ? '' : '<div class="bblock">');
if($r[0]['title'])
$o .= '<h3>' . $r[0]['title'] . '</h3>';
$o .= prepare_text($r[0]['body'], $r[0]['mimetype']);
$o .= '</div>';
$o .= (($var['wrap'] == 'none') ? '' : '</div>');
}
}

View File

@ -227,31 +227,10 @@ function menu_add_item($menu_id, $uid, $arr) {
$channel = get_app()->get_channel();
}
if (($channel)
&& (! $arr['contact_allow'])
&& (! $arr['group_allow'])
&& (! $arr['contact_deny'])
&& (! $arr['group_deny'])) {
$str_group_allow = $channel['channel_allow_gid'];
$str_contact_allow = $channel['channel_allow_cid'];
$str_group_deny = $channel['channel_deny_gid'];
$str_contact_deny = $channel['channel_deny_cid'];
}
else {
// use the posted permissions
$str_group_allow = perms2str($arr['group_allow']);
$str_contact_allow = perms2str($arr['contact_allow']);
$str_group_deny = perms2str($arr['group_deny']);
$str_contact_deny = perms2str($arr['contact_deny']);
}
// unused
// $allow_cid = perms2str($arr['allow_cid']);
// $allow_gid = perms2str($arr['allow_gid']);
// $deny_cid = perms2str($arr['deny_cid']);
// $deny_gid = perms2str($arr['deny_gid']);
$str_group_allow = perms2str($arr['group_allow']);
$str_contact_allow = perms2str($arr['contact_allow']);
$str_group_deny = perms2str($arr['group_deny']);
$str_contact_deny = perms2str($arr['contact_deny']);
$r = q("insert into menu_item ( mitem_link, mitem_desc, mitem_flags, allow_cid, allow_gid, deny_cid, deny_gid, mitem_channel_id, mitem_menu_id, mitem_order ) values ( '%s', '%s', %d, '%s', '%s', '%s', '%s', %d, %d, %d ) ",
dbesc($mitem_link),
@ -283,25 +262,10 @@ function menu_edit_item($menu_id, $uid, $arr) {
$channel = get_app()->get_channel();
}
if ((! $arr['contact_allow'])
&& (! $arr['group_allow'])
&& (! $arr['contact_deny'])
&& (! $arr['group_deny'])) {
$str_group_allow = $channel['channel_allow_gid'];
$str_contact_allow = $channel['channel_allow_cid'];
$str_group_deny = $channel['channel_deny_gid'];
$str_contact_deny = $channel['channel_deny_cid'];
}
else {
// use the posted permissions
$str_group_allow = perms2str($arr['group_allow']);
$str_contact_allow = perms2str($arr['contact_allow']);
$str_group_deny = perms2str($arr['group_deny']);
$str_contact_deny = perms2str($arr['contact_deny']);
}
$str_group_allow = perms2str($arr['group_allow']);
$str_contact_allow = perms2str($arr['contact_allow']);
$str_group_deny = perms2str($arr['group_deny']);
$str_contact_deny = perms2str($arr['contact_deny']);
$r = q("update menu_item set mitem_link = '%s', mitem_desc = '%s', mitem_flags = %d, allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', mitem_order = %d where mitem_channel_id = %d and mitem_menu_id = %d and mitem_id = %d",
dbesc($mitem_link),

View File

@ -2,7 +2,7 @@
<div class="generic-content-wrapper" id="page-content-wrapper" >
{{if $title}}<h2 class="page-title">{{$title}}</h2>{{/if}}
<div class="page-author"><a class=="page-author-link" href="{{$auth_url}}">{{$author}}</a></div>
<div class="page-author"><a class="page-author-link" href="{{$auth_url}}">{{$author}}</a></div>
<div class="page-date">{{$date}}</div>
<div class="page-body">{{$body}}</div>
</div>