diff options
author | zotlabs <mike@macgirvin.com> | 2016-12-04 17:48:31 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2016-12-04 17:48:31 -0800 |
commit | e896592261bc5156ca9022fa55faeb65916d53d8 (patch) | |
tree | 6a0aabab7c216152d40999f8a602e0d8663a24f0 | |
parent | d9312dbefb8a7310338db07250ae17f4fa871ae5 (diff) | |
download | volse-hubzilla-e896592261bc5156ca9022fa55faeb65916d53d8.tar.gz volse-hubzilla-e896592261bc5156ca9022fa55faeb65916d53d8.tar.bz2 volse-hubzilla-e896592261bc5156ca9022fa55faeb65916d53d8.zip |
minor optimisation to reduce code duplication
-rwxr-xr-x | include/items.php | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/include/items.php b/include/items.php index 106ad424d..3bbd4cce3 100755 --- a/include/items.php +++ b/include/items.php @@ -4116,25 +4116,21 @@ function webpage_to_namespace($webpage) { function update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remote_id,$mid) { - $page_type = ''; - if(! $post_id) return; - if($webpage == ITEM_TYPE_WEBPAGE) - $page_type = 'WEBPAGE'; - elseif($webpage == ITEM_TYPE_BLOCK) - $page_type = 'BUILDBLOCK'; - elseif($webpage == ITEM_TYPE_PDL) - $page_type = 'PDL'; - elseif($webpage == ITEM_TYPE_DOC) - $page_type = 'docfile'; - elseif($namespace && $remote_id) { + $page_type = webpage_to_namespace($webpage); + + if($page_type == 'unknown' && $namespace && $remote_id) { $page_type = $namespace; $pagetitle = $remote_id; } + else { + $page_type = ''; + } if($page_type) { + // store page info as an alternate message_id so we can access it via // https://sitename/page/$channelname/$pagetitle // if no pagetitle was given or it couldn't be transliterated into a url, use the first |