diff options
-rwxr-xr-x | boot.php | 16 | ||||
-rw-r--r-- | include/Contact.php | 21 | ||||
-rw-r--r-- | include/RedDAV/RedBrowser.php | 1 | ||||
-rw-r--r-- | include/bb2diaspora.php | 4 | ||||
-rw-r--r-- | include/identity.php | 3 | ||||
-rwxr-xr-x | include/items.php | 1 | ||||
-rw-r--r-- | include/poller.php | 14 | ||||
-rwxr-xr-x | index.php | 40 | ||||
-rw-r--r-- | mod/channel.php | 2 | ||||
-rw-r--r-- | mod/item.php | 15 | ||||
-rw-r--r-- | mod/page.php | 22 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rw-r--r-- | view/css/mod_photos.css | 3 | ||||
-rwxr-xr-x | view/tpl/nav.tpl | 12 | ||||
-rwxr-xr-x | view/tpl/photo_view.tpl | 7 |
15 files changed, 127 insertions, 36 deletions
@@ -1880,13 +1880,9 @@ function get_custom_nav(&$a,$navname) { } -function construct_page(&$a) { - +function load_pdl(&$a) { require_once('include/comanche.php'); - // in case a page has overloaded a module, see if we already have a layout defined - // otherwise, if a pdl file exists for this module, use it - if(! count($a->layout)) { $n = 'mod_' . $a->module . '.pdl' ; $u = comanche_get_channel_id(); @@ -1898,12 +1894,20 @@ function construct_page(&$a) { comanche_parser($a,$s); } - $comanche = ((count($a->layout)) ? true : false); +} + + + +function construct_page(&$a) { + /** * Build the page - now that we have all the components */ + + $comanche = ((count($a->layout)) ? true : false); + require_once(theme_include('theme_init.php')); $installing = false; diff --git a/include/Contact.php b/include/Contact.php index 4440369dc..20e5e1a1e 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -245,11 +245,13 @@ function channel_remove($channel_id, $local = true, $unset_session=true) { intval($channel_id) ); + $r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_hash = '%s'", intval(HUBLOC_FLAGS_DELETED), dbesc($channel['channel_hash']) ); + $r = q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s'", intval(XCHAN_FLAGS_DELETED), dbesc($channel['channel_hash']) @@ -257,7 +259,6 @@ function channel_remove($channel_id, $local = true, $unset_session=true) { proc_run('php','include/notifier.php','purge_all',$channel_id); - } q("DELETE FROM `groups` WHERE `uid` = %d", intval($channel_id)); @@ -291,11 +292,23 @@ function channel_remove($channel_id, $local = true, $unset_session=true) { dbesc(z_root()) ); - $r = q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s' ", - intval(XCHAN_FLAGS_DELETED), - dbesc($channel['channel_hash']) + // Do we have any valid hublocs remaining? + + $hublocs = 0; + + $r = q("select hubloc_id from hubloc where hubloc_hash = '%s' and not (hubloc_flags & %d)", + dbesc($channel['channel_hash']), + intval(HUBLOC_FLAGS_DELETED) ); + if($r) + $hublocs = count($r); + if(! $hublocs) { + $r = q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s' ", + intval(XCHAN_FLAGS_DELETED), + dbesc($channel['channel_hash']) + ); + } proc_run('php','include/directory.php',$channel_id); diff --git a/include/RedDAV/RedBrowser.php b/include/RedDAV/RedBrowser.php index 6ec5c978d..21ea76aed 100644 --- a/include/RedDAV/RedBrowser.php +++ b/include/RedDAV/RedBrowser.php @@ -259,6 +259,7 @@ class RedBrowser extends DAV\Browser\Plugin { $html .= $output; get_app()->page['content'] = $html; + load_pdl(get_app()); construct_page(get_app()); } diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 9a87de5b2..5663ce9ef 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -116,6 +116,8 @@ function diaspora_mention_callback($matches) { function diaspora2bb($s,$use_zrl = false) { + $s = str_replace("
\n>","",$s); + $s = html_entity_decode($s,ENT_COMPAT,'UTF-8'); // Too many new lines. So deactivated the following line @@ -290,7 +292,7 @@ function bb2diaspora_itemwallwall(&$item) { // We have to do something similar for wall-to-wall comments. ITEM_WALL|ITEM_ORIGIN indicates that it was posted on this site. // Regular matrix comments may have one of these bits set, but not both. - if(($item['mid'] != $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && ($item['item_flags'] & (ITEM_WALL|ITEM_ORIGIN)) && (is_array($item['author'])) && $item['author']['xchan_url'] && $item['author']['xchan_name'] && $item['author']['xchan_photo_m']) { + if(($item['mid'] != $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && (($item['item_flags'] & (ITEM_WALL|ITEM_ORIGIN)) == (ITEM_WALL|ITEM_ORIGIN)) && (is_array($item['author'])) && $item['author']['xchan_url'] && $item['author']['xchan_name'] && $item['author']['xchan_photo_m']) { logger('bb2diaspora_itemwallwall: wall to wall comment',LOGGER_DEBUG); // post will come across with the owner's identity. Throw a preamble onto the post to indicate the true author. $item['body'] = "\n\n" diff --git a/include/identity.php b/include/identity.php index 07bfaebbd..8866b4811 100644 --- a/include/identity.php +++ b/include/identity.php @@ -389,7 +389,8 @@ function create_identity($arr) { dbesc( t('Friends') ) ); if($r) { - q("update channel set channel_allow_gid = '%s' where channel_id = %d limit 1", + q("update channel set channel_default_group = '%s', channel_allow_gid = '%s' where channel_id = %d limit 1", + dbesc($r[0]['hash']), dbesc('<' . $r[0]['hash'] . '>'), intval($newuid) ); diff --git a/include/items.php b/include/items.php index 40343d505..75eaecb20 100755 --- a/include/items.php +++ b/include/items.php @@ -98,6 +98,7 @@ function collect_recipients($item,&$private_envelope) { } } + // This is a somewhat expensive operation but important. // Don't send this item to anybody who isn't allowed to see it diff --git a/include/poller.php b/include/poller.php index 61298b0ab..f11618d37 100644 --- a/include/poller.php +++ b/include/poller.php @@ -25,6 +25,15 @@ function poller_run($argv, $argc){ if(! $interval) $interval = ((get_config('system','delivery_interval') === false) ? 3 : intval(get_config('system','delivery_interval'))); + // Check for a lockfile. If it exists, but is over an hour old, it's stale. Ignore it. + $lockfile = 'store/[data]/poller'; + if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 3600))) { + logger("poller: Already running"); + return; + } + + // Create a lockfile. Needs two vars, but $x doesn't need to contain anything. + file_put_contents($lockfile, $x); logger('poller: start'); @@ -375,7 +384,10 @@ function poller_run($argv, $argc){ } } } - + + //All done - clear the lockfile + @unlink($lockfile); + return; } @@ -242,14 +242,6 @@ if(strlen($a->module)) { } } -/** - * load current theme info - */ -$theme_info_file = "view/theme/".current_theme()."/php/theme.php"; -if (file_exists($theme_info_file)){ - require_once($theme_info_file); -} - /* initialise content region */ @@ -281,12 +273,44 @@ if($a->module_loaded) { $a->page['page_title'] = $a->module; $placeholder = ''; + /** + * No theme has been specified when calling the module_init functions + * For this reason, please restrict the use of templates to those which + * do not provide any presentation details - as themes will not be able + * to over-ride them. + */ + if(function_exists($a->module . '_init')) { call_hooks($a->module . '_mod_init', $placeholder); $func = $a->module . '_init'; $func($a); } + /** + * Do all theme initialiasion here before calling any additional module functions. + * The module_init function may have changed the theme. + * Additionally any page with a Comanche template may alter the theme. + * So we'll check for those now. + */ + + + /** + * In case a page has overloaded a module, see if we already have a layout defined + * otherwise, if a PDL file exists for this module, use it + * The member may have also created a customised PDL that's stored in the config + */ + + load_pdl($a); + + /** + * load current theme info + */ + + $theme_info_file = "view/theme/".current_theme()."/php/theme.php"; + if (file_exists($theme_info_file)){ + require_once($theme_info_file); + } + if(function_exists(str_replace('-','_',current_theme()) . '_init')) { $func = str_replace('-','_',current_theme()) . '_init'; $func($a); diff --git a/mod/channel.php b/mod/channel.php index 395160d2c..e4a7173c0 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -64,7 +64,7 @@ function channel_content(&$a, $update = 0, $load = false) { if($update) { // Ensure we've got a profile owner if updating. - $a->profile['profile_uid'] = $update; + $a->profile['profile_uid'] = $a->profile_uid = $update; } else { if($a->profile['profile_uid'] == local_user()) { diff --git a/mod/item.php b/mod/item.php index ac15e50e8..589e3beb1 100644 --- a/mod/item.php +++ b/mod/item.php @@ -257,10 +257,16 @@ function item_post(&$a) { killme(); } + $walltowall = false; + if($observer) { logger('mod_item: post accepted from ' . $observer['xchan_name'] . ' for ' . $owner_xchan['xchan_name'], LOGGER_DEBUG); + if($observer['xchan_name'] != $owner_xchan['xchan_name']) + $walltowall = true; } + + $public_policy = ((x($_REQUEST,'public_policy')) ? escape_tags($_REQUEST['public_policy']) : map_scope($channel['channel_r_stream'],true)); if($webpage) $public_policy = ''; @@ -329,6 +335,15 @@ function item_post(&$a) { $str_group_deny = $channel['channel_deny_gid']; $str_contact_deny = $channel['channel_deny_cid']; } + elseif($walltowall) { + + // use the channel owner's default permissions + + $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 diff --git a/mod/page.php b/mod/page.php index b3f53a227..e8f17ebda 100644 --- a/mod/page.php +++ b/mod/page.php @@ -14,13 +14,11 @@ function page_init(&$a) { if($a->profile['profile_uid']) head_set_icon($a->profile['thumb']); -} - + // load the item here in the init function because we need to extract + // the page layout and initialise the correct theme. -function page_content(&$a) { - $observer = $a->get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); @@ -97,11 +95,27 @@ function page_content(&$a) { } } + $a->data['webpage'] = $r; + + + +} + + + + +function page_content(&$a) { + + $r = $a->data['webpage']; + 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; diff --git a/version.inc b/version.inc index 89d0ecd1c..a9ceeba21 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2014-10-19.833 +2014-10-21.835 diff --git a/view/css/mod_photos.css b/view/css/mod_photos.css index c8cdab6c3..571aba57c 100644 --- a/view/css/mod_photos.css +++ b/view/css/mod_photos.css @@ -3,7 +3,8 @@ margin-bottom: 25px; } -.photo-item-tools { +.photo-item-tools-left, +.photo-item-tools-right { padding: 7px 10px; } diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl index bc9d0ba37..a283b35a8 100755 --- a/view/tpl/nav.tpl +++ b/view/tpl/nav.tpl @@ -50,12 +50,16 @@ {{if $nav.register}}<li class="{{$nav.register.2}}"><a href="{{$nav.register.0}}" title="{{$nav.register.3}}" >{{$nav.register.1}}</a><li>{{/if}} {{if !$userinfo}} {{if $nav.loginmenu}} - <li class="{{$nav.loginmenu.0.2}}"><a data-toggle="dropdown" data-target="#" href="{{$nav.loginmenu.0.0}}" title="{{$nav.loginmenu.0.3}}" >{{$nav.loginmenu.0.1}} <span class="caret" id="usermenu-caret"></span></a> - <ul class="dropdown-menu" role="menu"> + <li class="{{$nav.loginmenu.0.2}} hidden-xs"><a data-toggle="dropdown" data-target="#" href="{{$nav.loginmenu.0.0}}" title="{{$nav.loginmenu.0.3}}" >{{$nav.loginmenu.0.1}} <span class="caret" id="usermenu-caret"></span></a> + <ul class="dropdown-menu" role="menu"> + {{foreach $nav.loginmenu as $loginmenu}} + <li role="presentation"><a class="{{$loginmenu.2}}" href="{{$loginmenu.0}}" title="{{$loginmenu.3}}" role="menuitem">{{$loginmenu.1}}</a></li> + {{/foreach}} + </ul> + </li> {{foreach $nav.loginmenu as $loginmenu}} - <li role="presentation"><a class="{{$loginmenu.2}}" href="{{$loginmenu.0}}" title="{{$loginmenu.3}}" role="menuitem">{{$loginmenu.1}}</a></li> + <li role="presentation"><a class="{{$loginmenu.2}} visible-xs" href="{{$loginmenu.0}}" title="{{$loginmenu.3}}" role="menuitem">{{$loginmenu.1}}</a></li> {{/foreach}} - </ul></li> {{/if}} {{/if}} diff --git a/view/tpl/photo_view.tpl b/view/tpl/photo_view.tpl index 88f9577b4..ddbce5b0b 100755 --- a/view/tpl/photo_view.tpl +++ b/view/tpl/photo_view.tpl @@ -67,7 +67,7 @@ {{$edit.aclselect}} <div id="settings-default-perms-menu-end"></div> </div> -< <br/> + <br/> <div id="settings-default-perms-end"></div> <input id="photo-edit-submit-button" type="submit" name="submit" value="{{$edit.submit}}"> <input id="photo-edit-delete-button" type="submit" name="delete" value="{{$edit.delete}}" onclick="return confirmDelete();"> @@ -82,17 +82,16 @@ <div id="photo-photo-end"></div> <div class="photo-item-tools"> + {{if $tags}} <div class="photo-item-tools-left pull-left"> - {{if $tags}} <div id="in-this-photo"> <span id="in-this-photo-text">{{$tag_hdr}}</span> {{foreach $tags as $t}} {{$t.0}}{{if $edit}}<span id="tag-remove"> <a href="{{$t.1}}"><i class="icon-remove"></i></a> </span>{{/if}} {{/foreach}} </div> - {{/if}} - </div> + {{/if}} {{if $likebuttons}} <div class="photo-item-tools-right btn-group pull-right"> |