From ad7a629b96887a039d801b9aa2ab477d18e965f1 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 4 May 2015 15:04:21 +0200 Subject: remove obsolete linebreak --- include/bbcode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index fe5f37260..4ff6f842e 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -292,7 +292,7 @@ function bb_ShareAttributesSimple($match) { if ($matches[1] != "") $profile = $matches[1]; - $text = '
' . html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . ' ' . $author . ': div class="reshared-content">' . $match[2] . ''; + $text = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . ' ' . $author . ': div class="reshared-content">' . $match[2] . ''; return($text); } -- cgit v1.2.3 From a3c37f145817407df28e9ffea6a83a6cd2b31cdd Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 5 May 2015 03:56:10 -0700 Subject: first pass name change --- include/Import/Importer.php | 4 ++-- include/Import/refimport.php | 2 +- include/RedDAV/RedBasicAuth.php | 2 +- include/RedDAV/RedBrowser.php | 2 +- include/RedDAV/RedDirectory.php | 2 +- include/RedDAV/RedFile.php | 4 ++-- include/api.php | 2 +- include/bb2diaspora.php | 2 +- include/diaspora.php | 10 +++++----- include/enotify.php | 2 +- include/reddav.php | 4 ++-- include/text.php | 6 +++--- include/zot.php | 2 +- 13 files changed, 22 insertions(+), 22 deletions(-) (limited to 'include') diff --git a/include/Import/Importer.php b/include/Import/Importer.php index 5e684cd8e..cddfac7b5 100644 --- a/include/Import/Importer.php +++ b/include/Import/Importer.php @@ -1,11 +1,11 @@ '', 'timezone' => 'UTC', 'closed' => $closed, 'inviteonly' => 'false', 'private' => $private, 'textlimit' => $textlimit, 'sslserver' => $sslserver, 'ssl' => $ssl, 'shorturllength' => '30', - 'redmatrix' => array( + 'hubzilla' => array( 'RED_PLATFORM' => RED_PLATFORM, 'RED_VERSION' => RED_VERSION, 'ZOT_REVISION' => ZOT_REVISION, diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 118e78639..3750fe3fd 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -450,7 +450,7 @@ function format_event_diaspora($ev) { $bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM - $o = t('Redmatrix event notification:') . "\n"; + $o = t('Hubzilla event notification:') . "\n"; $o .= '**' . (($ev['summary']) ? bb2diaspora($ev['summary']) : bb2diaspora($ev['desc'])) . '**' . "\n"; diff --git a/include/diaspora.php b/include/diaspora.php index 75eac7681..530a83564 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -329,7 +329,7 @@ function find_diaspora_person_by_handle($handle) { if(! $person) { // try webfinger. Make sure to distinguish between diaspora, - // redmatrix w/diaspora protocol and friendica w/diaspora protocol. + // hubzilla w/diaspora protocol and friendica w/diaspora protocol. $result = discover_by_webbie($handle); if($result) { @@ -706,8 +706,8 @@ function diaspora_request($importer,$xml) { $cnv = random_string(); $mid = random_string(); - $msg = t('You have started sharing with a Redmatrix premium channel.'); - $msg .= t('Redmatrix premium channels are not available for sharing with Diaspora members. This sharing request has been blocked.') . "\r"; + $msg = t('You have started sharing with a Hubzilla premium channel.'); + $msg .= t('Hubzilla premium channels are not available for sharing with Diaspora members. This sharing request has been blocked.') . "\r"; $msg .= t('Please do not reply to this message, as this channel is not sharing with you and any reply will not be seen by the recipient.') . "\r"; $created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d H:i:s \U\T\C'); @@ -2444,7 +2444,7 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) { '$handle' => xmlify($myaddr), '$public' => $public, '$created' => $created, - '$provider' => (($item['app']) ? $item['app'] : 'redmatrix') + '$provider' => (($item['app']) ? $item['app'] : 'hubzilla') )); } else { $tpl = get_markup_template('diaspora_post.tpl'); @@ -2454,7 +2454,7 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) { '$handle' => xmlify($myaddr), '$public' => $public, '$created' => $created, - '$provider' => (($item['app']) ? $item['app'] : 'redmatrix') + '$provider' => (($item['app']) ? $item['app'] : 'hubzilla') )); } diff --git a/include/enotify.php b/include/enotify.php index e801c3100..aef8e83e0 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -56,7 +56,7 @@ function notification($params) { push_lang($recip['account_language']); // should probably have a channel language $banner = t('Red Matrix Notification'); - $product = t('redmatrix'); // RED_PLATFORM; + $product = t('hubzilla'); // RED_PLATFORM; $siteurl = $a->get_baseurl(true); $thanks = t('Thank You,'); $sitename = get_config('system','sitename'); diff --git a/include/reddav.php b/include/reddav.php index 750ca1b24..c39f08f4d 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -1,7 +1,7 @@ Date: Tue, 5 May 2015 03:59:51 -0700 Subject: second pass name change --- include/enotify.php | 2 +- include/identity.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/enotify.php b/include/enotify.php index aef8e83e0..08ab8175d 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -55,7 +55,7 @@ function notification($params) { push_lang($recip['account_language']); // should probably have a channel language - $banner = t('Red Matrix Notification'); + $banner = t('Hubzilla Notification'); $product = t('hubzilla'); // RED_PLATFORM; $siteurl = $a->get_baseurl(true); $thanks = t('Thank You,'); diff --git a/include/identity.php b/include/identity.php index 7884c04d2..fa2e27355 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1371,7 +1371,7 @@ function get_default_profile_photo($size = 175) { } /** - * @brief Test whether a given identity is NOT a member of the Red Matrix. + * @brief Test whether a given identity is NOT a member of the Hubzilla. * * @param string $s; * xchan_hash of the identity in question @@ -1382,7 +1382,7 @@ function is_foreigner($s) { } /** - * @brief Test whether a given identity is a member of the Red Matrix. + * @brief Test whether a given identity is a member of the Hubzilla. * * @param string $s; * xchan_hash of the identity in question -- cgit v1.2.3 From c9ec4f46b6177f88a41d3c3bdc11e06467101721 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 5 May 2015 18:36:05 -0700 Subject: for hubzilla we won't be obscuring items, only private mail, this will allow us to search and cache private posts --- include/conversation.php | 9 --------- include/items.php | 51 +----------------------------------------------- 2 files changed, 1 insertion(+), 59 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index fb012667e..e76101cbe 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -356,15 +356,6 @@ function localize_item(&$item){ } } */ - // add sparkle links to appropriate permalinks - -// $x = stristr($item['plink'],'/display/'); -// if($x) { -// $sparkle = false; -// $y = best_link_url($item,$sparkle,true); - // if($sparkle) -// $item['plink'] = $y . '?f=&url=' . $item['plink']; -// } // if item body was obscured and we changed it, re-obscure it // FIXME - we need a better filter than just the string 'data'; try and diff --git a/include/items.php b/include/items.php index 4e85bef37..7e8e6b3c2 100755 --- a/include/items.php +++ b/include/items.php @@ -417,14 +417,6 @@ function post_activity_item($arr) { $arr['item_flags'] = $arr['item_flags'] | ITEM_VERIFIED; } } - - logger('Encrypting local storage'); - $key = get_config('system','pubkey'); - $arr['item_flags'] = $arr['item_flags'] | ITEM_OBSCURED; - if($arr['title']) - $arr['title'] = json_encode(crypto_encapsulate($arr['title'],$key)); - if($arr['body']) - $arr['body'] = json_encode(crypto_encapsulate($arr['body'],$key)); } $arr['mid'] = ((x($arr,'mid')) ? $arr['mid'] : item_message_id()); @@ -900,21 +892,6 @@ function get_item_elements($x) { logger('get_item_elements: message verification failed.'); } - - // if it's a private post, encrypt it in the DB. - // We have to do that here because we need to cleanse the input and prevent bad stuff from getting in, - // and we need plaintext to do that. - - - if(intval($arr['item_private'])) { - $arr['item_flags'] = $arr['item_flags'] | ITEM_OBSCURED; - if($arr['title']) - $arr['title'] = json_encode(crypto_encapsulate($arr['title'],$key)); - if($arr['body']) - $arr['body'] = json_encode(crypto_encapsulate($arr['body'],$key)); - } - - if(array_key_exists('revision',$x)) { // extended export encoding @@ -2063,14 +2040,6 @@ function item_store($arr, $allow_exec = false) { } $arr = $translate['item']; } - if($arr['item_private']) { - $key = get_config('system','pubkey'); - $arr['item_flags'] = $arr['item_flags'] | ITEM_OBSCURED; - if($arr['title']) - $arr['title'] = json_encode(crypto_encapsulate($arr['title'],$key)); - if($arr['body']) - $arr['body'] = json_encode(crypto_encapsulate($arr['body'],$key)); - } } if((x($arr,'object')) && is_array($arr['object'])) { @@ -2460,14 +2429,6 @@ function item_store_update($arr,$allow_exec = false) { } $arr = $translate['item']; } - if($arr['item_private']) { - $key = get_config('system','pubkey'); - $arr['item_flags'] = $arr['item_flags'] | ITEM_OBSCURED; - if($arr['title']) - $arr['title'] = json_encode(crypto_encapsulate($arr['title'],$key)); - if($arr['body']) - $arr['body'] = json_encode(crypto_encapsulate($arr['body'],$key)); - } } if((x($arr,'object')) && is_array($arr['object'])) { @@ -3173,17 +3134,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent) { $title = $item['title']; $body = $item['body']; - if($private) { - if(!($flag_bits & ITEM_OBSCURED)) { - $key = get_config('system','pubkey'); - $flag_bits = $flag_bits|ITEM_OBSCURED; - if($title) - $title = json_encode(crypto_encapsulate($title,$key)); - if($body) - $body = json_encode(crypto_encapsulate($body,$key)); - } - } - else { + if(! $private) { if($flag_bits & ITEM_OBSCURED) { $key = get_config('system','prvkey'); $flag_bits = $flag_bits ^ ITEM_OBSCURED; -- cgit v1.2.3 From f559c91b7a7ff3e3e3bfd1ce430ce5b5615c07ea Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 5 May 2015 19:23:21 -0700 Subject: turn consensus items into diaspora polls for that network --- include/diaspora.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/diaspora.php b/include/diaspora.php index 75eac7681..4aa525838 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -2427,6 +2427,20 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) { } */ + if($item['item_flags'] & ITEM_CONSENSUS) { + $poll = replace_macros(get_markup_template('diaspora_consensus.tpl'), array( + '$guid_q' => random_string(), + '$question' => '', + '$guid_y' => random_string(), + '$agree' => t('Agree'), + '$guid_n' => random_string(), + '$disagree' => t('Disagree'), + '$guid_a' => random_string(), + '$abstain' => t('Abstain') + )); + } + else + $poll = ''; $public = (($item['item_private']) ? 'false' : 'true'); @@ -2451,6 +2465,7 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) { $msg = replace_macros($tpl, array( '$body' => xmlify($body), '$guid' => $item['mid'], + '$poll' => $poll, '$handle' => xmlify($myaddr), '$public' => $public, '$created' => $created, -- cgit v1.2.3 From 9391f6f9052ae16c9789e04a2a96b8aa96adb220 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 6 May 2015 10:53:26 +0200 Subject: allow blocks to have custom classes and add a new template called zen which gives you an empty page to work with --- include/comanche.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/comanche.php b/include/comanche.php index c1a98ed6c..7115b5635 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -133,10 +133,11 @@ function comanche_get_channel_id() { return $channel_id; } -function comanche_block($s) { +function comanche_block($s, $class = '') { $var = array(); $matches = array(); $name = $s; + $class = (($class) ? $class : 'bblock widget'); $cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $s, $matches, PREG_SET_ORDER); if($cnt) { @@ -155,7 +156,7 @@ function comanche_block($s) { dbesc($name) ); if($r) { - $o .= (($var['wrap'] == 'none') ? '' : '
'); + $o .= (($var['wrap'] == 'none') ? '' : '
'); if($r[0]['title']) $o .= '

' . $r[0]['title'] . '

'; @@ -238,6 +239,13 @@ function comanche_region(&$a, $s) { } } + $cnt = preg_match_all("/\[block=(.*?)\](.*?)\[\/block\]/ism", $s, $matches, PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $s = str_replace($mtch[0],comanche_block(trim($mtch[2]),trim($mtch[1])),$s); + } + } + // need to modify this to accept parameters $cnt = preg_match_all("/\[widget=(.*?)\](.*?)\[\/widget\]/ism", $s, $matches, PREG_SET_ORDER); -- cgit v1.2.3 From f17c1f96944cd347296ede2a4d0afaee17b49234 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 6 May 2015 18:38:30 -0700 Subject: no need to obscure the diaspora signature if we're not obscuring the posts --- include/diaspora.php | 4 ++-- include/items.php | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/diaspora.php b/include/diaspora.php index 530a83564..1ca3cebd3 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1523,7 +1523,7 @@ function diaspora_comment($importer,$xml,$msg) { $key = get_config('system','pubkey'); $x = array('signer' => $diaspora_handle, 'body' => $text, 'signed_text' => $signed_data, 'signature' => base64_encode($author_signature)); - $datarray['diaspora_meta'] = json_encode(crypto_encapsulate(json_encode($x),$key)); + $datarray['diaspora_meta'] = json_encode($x); } @@ -2137,7 +2137,7 @@ function diaspora_like($importer,$xml,$msg) { $key = get_config('system','pubkey'); $x = array('signer' => $diaspora_handle, 'body' => $text, 'signed_text' => $signed_data, 'signature' => base64_encode($author_signature)); - $arr['diaspora_meta'] = json_encode(crypto_encapsulate(json_encode($x),$key)); + $arr['diaspora_meta'] = json_encode($x); } $x = item_store($arr); diff --git a/include/items.php b/include/items.php index 7e8e6b3c2..42ff3cb8b 100755 --- a/include/items.php +++ b/include/items.php @@ -843,7 +843,7 @@ function get_item_elements($x) { $arr['sig'] = (($x['signature']) ? htmlspecialchars($x['signature'], ENT_COMPAT,'UTF-8',false) : ''); - $arr['diaspora_meta'] = (($x['diaspora_signature']) ? json_encode(crypto_encapsulate($x['diaspora_signature'],$key)) : ''); + $arr['diaspora_meta'] = (($x['diaspora_signature']) ? json_encode($x['diaspora_signature']) : ''); $arr['object'] = activity_sanitise($x['object']); $arr['target'] = activity_sanitise($x['target']); @@ -1155,9 +1155,15 @@ function encode_item($item,$mirror = false) { if($item['term']) $x['tags'] = encode_item_terms($item['term']); - if($item['diaspora_meta']) - $x['diaspora_signature'] = crypto_unencapsulate(json_decode($item['diaspora_meta'],true),$key); - + if($item['diaspora_meta']) { + $z = json_decode($item['diaspora_meta'],true); + if($z) { + if(array_key_exists('iv',$z)) + $x['diaspora_signature'] = crypto_unencapsulate($z,$key); + else + $x['diaspora_signature'] = $z; + } + } logger('encode_item: ' . print_r($x,true), LOGGER_DATA); return $x; -- cgit v1.2.3 From 25b599a4bd831f175572c2388754e8734a255d77 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 6 May 2015 21:03:33 -0700 Subject: convert ITEM_WALL from bitfield to standalone --- include/Import/refimport.php | 6 ++++-- include/activities.php | 3 ++- include/api.php | 5 ++--- include/attach.php | 3 ++- include/enotify.php | 2 +- include/event.php | 2 +- include/externals.php | 4 ++-- include/identity.php | 3 +-- include/items.php | 41 +++++++++++++++++++++-------------------- include/notifier.php | 5 ++--- include/photos.php | 6 ++++-- include/statistics_fns.php | 9 +++------ include/taxonomy.php | 8 ++++++-- include/zot.php | 6 +++--- 14 files changed, 54 insertions(+), 49 deletions(-) (limited to 'include') diff --git a/include/Import/refimport.php b/include/Import/refimport.php index d248fb7df..b95411c81 100644 --- a/include/Import/refimport.php +++ b/include/Import/refimport.php @@ -88,7 +88,8 @@ function refimport_content(&$a) { $arr['author_xchan'] = $channel['channel_hash']; $arr['owner_xchan'] = $channel['channel_hash']; $arr['app'] = REFLECT_BLOGNAME; - $arr['item_flags'] = ITEM_ORIGIN|ITEM_WALL|ITEM_THREAD_TOP; + $arr['item_flags'] = ITEM_ORIGIN|ITEM_THREAD_TOP; + $arr['item_wall'] = 1; $arr['verb'] = ACTIVITY_POST; // this is an assumption @@ -256,7 +257,8 @@ function reflect_comment_store($channel,$post,$comment,$user) { $arr['edited'] = $comment['created']; $arr['author_xchan'] = $hash; $arr['owner_xchan'] = $channel['channel_hash']; - $arr['item_flags'] = ITEM_ORIGIN|ITEM_WALL; + $arr['item_flags'] = ITEM_ORIGIN; + $arr['item_wall'] = 1; $arr['verb'] = ACTIVITY_POST; $arr['comment_policy'] = 'contacts'; diff --git a/include/activities.php b/include/activities.php index ca8863e51..7d007e05b 100644 --- a/include/activities.php +++ b/include/activities.php @@ -21,7 +21,8 @@ function profile_activity($changed, $value) { $arr['uid'] = local_channel(); $arr['aid'] = $self['channel_account_id']; $arr['owner_xchan'] = $arr['author_xchan'] = $self['xchan_hash']; - $arr['item_flags'] = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP; + $arr['item_flags'] = ITEM_ORIGIN|ITEM_THREAD_TOP; + $arr['item_wall'] = 1; $arr['verb'] = ACTIVITY_UPDATE; $arr['obj_type'] = ACTIVITY_OBJ_PROFILE; diff --git a/include/api.php b/include/api.php index 2491e500b..7fea00d81 100644 --- a/include/api.php +++ b/include/api.php @@ -344,10 +344,9 @@ require_once('include/items.php'); // count public wall messages $r = q("SELECT COUNT(`id`) as `count` FROM `item` WHERE `uid` = %d - AND ( item_flags & %d )>0 and item_restrict = 0 + AND item_wall = 1 and item_restrict = 0 AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`=''", - intval($usr[0]['channel_id']), - intval(ITEM_WALL) + intval($usr[0]['channel_id']) ); $countitms = $r[0]['count']; } diff --git a/include/attach.php b/include/attach.php index e6d6e5f24..cd51f8153 100644 --- a/include/attach.php +++ b/include/attach.php @@ -1031,7 +1031,7 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid, $objtype = ACTIVITY_OBJ_FILE; - $item_flags = ITEM_WALL|ITEM_ORIGIN; + $item_flags = ITEM_ORIGIN; $private = (($arr_allow_cid[0] || $arr_allow_gid[0] || $arr_deny_cid[0] || $arr_deny_gid[0]) ? 1 : 0); @@ -1078,6 +1078,7 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid, $arr['parent_mid'] = $u_mid; $arr['item_flags'] = $item_flags; $arr['item_unseen'] = 1; + $arr['item_wall'] = 1; $arr['author_xchan'] = $poster['xchan_hash']; $arr['owner_xchan'] = $poster['xchan_hash']; $arr['title'] = ''; diff --git a/include/enotify.php b/include/enotify.php index 08ab8175d..3f54c6915 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -171,7 +171,7 @@ function notification($params) { $item_post_type); // "your post" - if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && ($p[0]['item_flags'] & ITEM_WALL)) + if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && intval($p[0]['item_wall'])) $dest_str = sprintf(t('%1$s, %2$s commented on [zrl=%3$s]your %4$s[/zrl]'), $recip['channel_name'], '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', diff --git a/include/event.php b/include/event.php index 5926b50f7..485379673 100644 --- a/include/event.php +++ b/include/event.php @@ -479,7 +479,7 @@ function event_store_item($arr, $event) { $item_flags = ITEM_THREAD_TOP; if($wall) { - $item_flags |= ITEM_WALL; + $item_arr['item_wall'] = 1; $item_flags |= ITEM_ORIGIN; } $item_arr['item_flags'] = $item_flags; diff --git a/include/externals.php b/include/externals.php index b0f853dc6..779d060e7 100644 --- a/include/externals.php +++ b/include/externals.php @@ -99,14 +99,14 @@ function externals_run($argv, $argc){ // ); $z = null; if($z) { - $flag_bits = ITEM_WALL|ITEM_ORIGIN|ITEM_UPLINK; + $flag_bits = ITEM_ORIGIN|ITEM_UPLINK; // preserve the source $r = q("update item set source_xchan = owner_xchan where id = %d", intval($z[0]['id']) ); - $r = q("update item set item_flags = ( item_flags | %d ), owner_xchan = '%s' + $r = q("update item set item_flags = ( item_flags | %d ), item_wall = 1, owner_xchan = '%s' where id = %d", intval($flag_bits), dbesc($sys['xchan_hash']), diff --git a/include/identity.php b/include/identity.php index fa2e27355..0b614a00e 100644 --- a/include/identity.php +++ b/include/identity.php @@ -583,8 +583,7 @@ function identity_basic_export($channel_id, $items = false) { /** @warning this may run into memory limits on smaller systems */ - $r = q("select * from item where (item_flags & %d)>0 and not (item_restrict & %d)>0 and uid = %d", - intval(ITEM_WALL), + $r = q("select * from item where item_wall = 1 and (item_restrict & %d) = 0 and uid = %d", intval(ITEM_DELETED), intval($channel_id) ); diff --git a/include/items.php b/include/items.php index 42ff3cb8b..88f110959 100755 --- a/include/items.php +++ b/include/items.php @@ -385,8 +385,10 @@ function post_activity_item($arr) { if(! x($arr,'item_flags')) { if($is_comment) $arr['item_flags'] = ITEM_ORIGIN; - else - $arr['item_flags'] = ITEM_ORIGIN | ITEM_WALL | ITEM_THREAD_TOP; + else { + $arr['item_wall'] = 1; + $arr['item_flags'] = ITEM_ORIGIN | ITEM_THREAD_TOP; + } } $channel = get_app()->get_channel(); @@ -2016,6 +2018,7 @@ function item_store($arr, $allow_exec = false) { $arr['deny_gid'] = ((x($arr,'deny_gid')) ? trim($arr['deny_gid']) : ''); $arr['item_private'] = ((x($arr,'item_private')) ? intval($arr['item_private']) : 0 ); $arr['item_flags'] = ((x($arr,'item_flags')) ? intval($arr['item_flags']) : 0 ); + $arr['item_wall'] = ((x($arr,'item_wall')) ? intval($arr['item_wall']) : 0 ); // only detect language if we have text content, and if the post is private but not yet // obscured, make it so. @@ -2178,8 +2181,8 @@ function item_store($arr, $allow_exec = false) { $public_policy = $r[0]['public_policy']; $comments_closed = $r[0]['comments_closed']; - if($r[0]['item_flags'] & ITEM_WALL) - $arr['item_flags'] = $arr['item_flags'] | ITEM_WALL; + if(intval($r[0]['item_wall'])) + $arr['item_wall'] = 1; // An uplinked comment might arrive with a downstream owner. // Fix it. @@ -2607,11 +2610,10 @@ function store_diaspora_comment_sig($datarray, $channel, $parent_item, $post_id, $x = array('signer' => $diaspora_handle, 'body' => $signed_body, 'signed_text' => $signed_text, 'signature' => base64_encode($authorsig)); - $key = get_config('system','pubkey'); - $y = crypto_encapsulate(json_encode($x),$key); + $y = json_encode($x); $r = q("update item set diaspora_meta = '%s' where id = %d", - dbesc(json_encode($y)), + dbesc($y), intval($post_id) ); @@ -2966,7 +2968,7 @@ function tag_deliver($uid, $item_id) { // prevent delivery looping - only proceed // if the message originated elsewhere and is a top-level post - if(($item['item_flags'] & ITEM_WALL) + if((intval($item['item_wall'])) || ($item['item_flags'] & ITEM_ORIGIN) || (!($item['item_flags'] & ITEM_THREAD_TOP)) || ($item['id'] != $item['parent'])) { @@ -3106,7 +3108,8 @@ function start_delivery_chain($channel, $item, $item_id, $parent) { if((! $private) && $new_public_policy) $private = 1; - $flag_bits = $item['item_flags'] | ITEM_WALL; + + $flag_bits = $item['item_flags']; // The message didn't necessarily originate on this site, (we'll honour it if it did), // but the parent post of this thread will be reset as a local post, as it is the top of @@ -3152,7 +3155,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent) { } $r = q("update item set item_flags = %d, owner_xchan = '%s', allow_cid = '%s', allow_gid = '%s', - deny_cid = '%s', deny_gid = '%s', item_private = %d, public_policy = '%s', comment_policy = '%s', title = '%s', body = '%s' where id = %d", + deny_cid = '%s', deny_gid = '%s', item_private = %d, public_policy = '%s', comment_policy = '%s', title = '%s', body = '%s', item_wall = 1 where id = %d", intval($flag_bits), dbesc($channel['channel_hash']), dbesc($channel['channel_allow_cid']), @@ -3909,7 +3912,7 @@ function item_expire($uid,$days) { if(! intval($expire_limit)) $expire_limit = 5000; - $sql_extra = ((intval($expire_network_only)) ? " AND (item_flags & " . intval(ITEM_WALL) . ") = 0 " : ""); + $sql_extra = ((intval($expire_network_only)) ? " AND item_wall = 0 " : ""); $r = q("SELECT * FROM `item` WHERE `uid` = %d @@ -4070,7 +4073,7 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal // We'll rely on the undocumented behaviour that DROPITEM_PHASE1 is (hopefully) only // set if we know we're going to send delete notifications out to others. - if((($item['item_flags'] & ITEM_WALL) && ($stage != DROPITEM_PHASE2)) || ($stage == DROPITEM_PHASE1)) + if((intval($item['item_wall']) && ($stage != DROPITEM_PHASE2)) || ($stage == DROPITEM_PHASE1)) proc_run('php','include/notifier.php','drop',$notify_id); goaway($a->get_baseurl() . '/' . $_SESSION['return_url']); @@ -4178,7 +4181,7 @@ function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL, $force = false) { function first_post_date($uid,$wall = false) { - $wall_sql = (($wall) ? sprintf(" and (item_flags & %d)>0 ", ITEM_WALL) : "" ); + $wall_sql = (($wall) ? " and item_wall = 1 " : "" ); $r = q("select id, created from item where item_restrict = %d and uid = %d and id = parent $wall_sql @@ -4386,19 +4389,17 @@ function zot_feed($uid,$observer_xchan,$arr) { $r = q("SELECT parent, created, postopts from item WHERE uid != %d AND item_private = 0 AND item_restrict = 0 AND uid in (" . stream_perms_api_uids(PERMS_PUBLIC,10,1) . ") - AND (item_flags & %d) > 0 + AND item_wall = 1 $sql_extra GROUP BY parent ORDER BY created ASC $limit", - intval($uid), - intval(ITEM_WALL) + intval($uid) ); } else { $r = q("SELECT parent, created, postopts from item WHERE uid = %d AND item_restrict = 0 - AND (item_flags & %d) > 0 + AND item_wall = 1 $sql_extra GROUP BY parent ORDER BY created ASC $limit", - intval($uid), - intval(ITEM_WALL) + intval($uid) ); } @@ -4465,7 +4466,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C $sql_options .= " and (item_flags & " . intval(ITEM_STARRED) . ")>0 "; if($arr['wall']) - $sql_options .= " and (item_flags & " . intval(ITEM_WALL) . ")>0 "; + $sql_options .= " and item_wall = 1 "; $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE (item_flags & " . intval(ITEM_THREAD_TOP) . ")>0 $sql_options ) "; diff --git a/include/notifier.php b/include/notifier.php index b82fb41cc..7bda433a9 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -228,10 +228,9 @@ function notifier_run($argv, $argc){ $normal_mode = false; $expire = true; - $items = q("SELECT * FROM item WHERE uid = %d AND ( item_flags & %d )>0 + $items = q("SELECT * FROM item WHERE uid = %d AND item_wall = 1 AND ( item_restrict & %d )>0 AND `changed` > %s - INTERVAL %s", intval($item_id), - intval(ITEM_WALL), intval(ITEM_DELETED), db_utcnow(), db_quoteinterval('10 MINUTE') ); @@ -457,7 +456,7 @@ function notifier_run($argv, $argc){ // don't send deletions onward for other people's stuff // TODO verify this is needed - copied logic from same place in old code - if(($target_item['item_restrict'] & ITEM_DELETED) && (!($target_item['item_flags'] & ITEM_WALL))) { + if(($target_item['item_restrict'] & ITEM_DELETED) && (! intval($target_item['item_wall']))) { logger('notifier: ignoring delete notification for non-wall item'); return; } diff --git a/include/photos.php b/include/photos.php index 1672e310a..e12637882 100644 --- a/include/photos.php +++ b/include/photos.php @@ -219,7 +219,7 @@ function photo_upload($channel, $observer, $args) { } } - $item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP; + $item_flags = ITEM_ORIGIN|ITEM_THREAD_TOP; $item_restrict = (($visible) ? ITEM_VISIBLE : ITEM_HIDDEN); $title = ''; $mid = item_message_id(); @@ -234,6 +234,7 @@ function photo_upload($channel, $observer, $args) { $arr['mid'] = $mid; $arr['parent_mid'] = $mid; $arr['item_flags'] = $item_flags; + $arr['item_wall'] = 1; $arr['item_restrict'] = $item_restrict; $arr['resource_type'] = 'photo'; $arr['resource_id'] = $photo_hash; @@ -488,7 +489,7 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) { // Create item container - $item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP; + $item_flags = ITEM_ORIGIN|ITEM_THREAD_TOP; $item_restrict = (($visible) ? ITEM_VISIBLE : ITEM_HIDDEN); $mid = item_message_id(); @@ -500,6 +501,7 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) { $arr['mid'] = $mid; $arr['parent_mid'] = $mid; $arr['item_flags'] = $item_flags; + $arr['item_wall'] = 1; $arr['item_restrict'] = $item_restrict; $arr['resource_type'] = 'photo'; $arr['resource_id'] = $photo['resource_id']; diff --git a/include/statistics_fns.php b/include/statistics_fns.php index 288925a2c..ce2eee5e7 100644 --- a/include/statistics_fns.php +++ b/include/statistics_fns.php @@ -23,8 +23,7 @@ function update_channels_active_halfyear_stat() { $s .= ','; $s .= intval($rr['channel_id']); } - $x = q("select uid from item where uid in ( $s ) and (item_flags & %d)>0 and created > %s - INTERVAL %s group by uid", - intval(ITEM_WALL), + $x = q("select uid from item where uid in ( $s ) and item_wall = 1 and created > %s - INTERVAL %s group by uid", db_utcnow(), db_quoteinterval('6 MONTH') ); if($x) { @@ -50,8 +49,7 @@ function update_channels_active_monthly_stat() { $s .= ','; $s .= intval($rr['channel_id']); } - $x = q("select uid from item where uid in ( $s ) and ( item_flags & %d )>0 and created > %s - INTERVAL %s group by uid", - intval(ITEM_WALL), + $x = q("select uid from item where uid in ( $s ) and item_wall = 1 and created > %s - INTERVAL %s group by uid", db_utcnow(), db_quoteinterval('1 MONTH') ); if($x) { @@ -66,8 +64,7 @@ function update_channels_active_monthly_stat() { } function update_local_posts_stat() { - $posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE (item_flags & %d)>0 ", - intval(ITEM_WALL) ); + $posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE item_wall = 1 "); if (is_array($posts)) { $local_posts_stat = intval($posts[0]["local_posts"]); set_config('system','local_posts_stat',$local_posts_stat); diff --git a/include/taxonomy.php b/include/taxonomy.php index fa540ac56..95b6ae1af 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -111,8 +111,12 @@ function tagadelic($uid, $count = 0, $authors = '', $flags = 0, $restrict = 0, $ $sql_options = item_permissions_sql($uid); $count = intval($count); - if($flags) - $sql_options .= " and ((item_flags & " . intval($flags) . ") = " . intval($flags) . ") "; + if($flags) { + if($flags == ITEM_WALL) + $sql_options .= " and item_wall = 1 "; + else + $sql_options .= " and ((item_flags & " . intval($flags) . ") = " . intval($flags) . ") "; + } if($authors) { if(! is_array($authors)) diff --git a/include/zot.php b/include/zot.php index 53d3376dc..15d724026 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1559,12 +1559,12 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ // This is our own post, possibly coming from a channel clone if($arr['owner_xchan'] == $d['hash']) { - $arr['item_flags'] = $arr['item_flags'] | ITEM_WALL; + $arr['item_wall'] = 1; } else { // clear the wall flag if it is set - if($arr['item_flags'] & ITEM_WALL) { - $arr['item_flags'] = ($arr['item_flags'] ^ ITEM_WALL); + if(intval($arr['item_wall'])) { + $arr['item_wall'] = 0; } } -- cgit v1.2.3 From e85593e97057eaf041e6e63ec11b12b6beb2e0ce Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 6 May 2015 21:43:15 -0700 Subject: Hopefully this will make item_cache the default --- include/bbcode.php | 46 +++++++++++++++++++++++++++++++++++++++++++--- include/text.php | 22 +++++++++++----------- 2 files changed, 54 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 4ff6f842e..71c069c39 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -381,10 +381,47 @@ function bb_sanitize_style($input) { return '' . $input[2] . ''; } +function bb_observer($Text) { + + $observer = $a->get_observer(); + + if ((strpos($Text,'[/observer]') !== false) || (strpos($Text,'[/rpost]') !== false)) { + if ($observer) { + $Text = preg_replace("/\[observer\=1\](.*?)\[\/observer\]/ism", '$1', $Text); + $Text = preg_replace("/\[observer\=0\].*?\[\/observer\]/ism", '', $Text); + $Text = preg_replace_callback("/\[rpost(=(.*?))?\](.*?)\[\/rpost\]/ism", 'rpost_callback', $Text); + } else { + $Text = preg_replace("/\[observer\=1\].*?\[\/observer\]/ism", '', $Text); + $Text = preg_replace("/\[observer\=0\](.*?)\[\/observer\]/ism", '$1', $Text); + $Text = preg_replace("/\[rpost(=.*?)?\](.*?)\[\/rpost\]/ism", '', $Text); + } + } + + $channel = $a->get_channel(); + + if (strpos($Text,'[/channel]') !== false) { + if ($channel) { + $Text = preg_replace("/\[channel\=1\](.*?)\[\/channel\]/ism", '$1', $Text); + $Text = preg_replace("/\[channel\=0\].*?\[\/channel\]/ism", '', $Text); + } else { + $Text = preg_replace("/\[channel\=1\].*?\[\/channel\]/ism", '', $Text); + $Text = preg_replace("/\[channel\=0\](.*?)\[\/channel\]/ism", '$1', $Text); + } + } + + return $Text; +} + + + + + + + // BBcode 2 HTML was written by WAY2WEB.net // extended to work with Mistpark/Friendica/Red - Mike Macgirvin -function bbcode($Text, $preserve_nl = false, $tryoembed = true) { +function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) { $a = get_app(); @@ -420,7 +457,8 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true) { // process [observer] tags before we do anything else because we might // be stripping away stuff that then doesn't need to be worked on anymore - if(get_config('system','item_cache')) + + if($cache) $observer = false; else $observer = $a->get_observer(); @@ -437,7 +475,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true) { } } - if(get_config('system','item_cache')) + if($cache) $channel = false; else $channel = $a->get_channel(); @@ -452,6 +490,8 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true) { } } +*/ + $x = bb_extract_images($Text); $Text = $x['body']; diff --git a/include/text.php b/include/text.php index 71db0ec30..c7b662879 100644 --- a/include/text.php +++ b/include/text.php @@ -1379,15 +1379,15 @@ function generate_named_map($location) { function prepare_body(&$item,$attach = false) { - if(get_config('system','item_cache') && $item['html']) - return $item['html']; + if($item['html']) + return bb_observer($item['html']); call_hooks('prepare_body_init', $item); unobscure($item); - $s = prepare_text($item['body'],$item['mimetype']); + $s = prepare_text($item['body'],$item['mimetype'], true); $prep_arr = array('item' => $item, 'html' => $s); call_hooks('prepare_body', $prep_arr); @@ -1452,11 +1452,11 @@ function prepare_body(&$item,$attach = false) { $prep_arr = array('item' => $item, 'html' => $s); call_hooks('prepare_body_final', $prep_arr); - if(get_config('system','item_cache')) - q("update item set html = '%s' where id = %d", - dbesc($prep_arr['html']), - intval($item['id']) - ); + + q("update item set html = '%s' where id = %d", + dbesc($prep_arr['html']), + intval($item['id']) + ); return $prep_arr['html']; } @@ -1468,7 +1468,7 @@ function prepare_body(&$item,$attach = false) { * @param sting $content_type * @return string */ -function prepare_text($text, $content_type = 'text/bbcode') { +function prepare_text($text, $content_type = 'text/bbcode', $cache = false) { switch($content_type) { case 'text/plain': @@ -1506,9 +1506,9 @@ function prepare_text($text, $content_type = 'text/bbcode') { require_once('include/bbcode.php'); if(stristr($text,'[nosmile]')) - $s = bbcode($text); + $s = bbcode($text,false,true,$cache); else - $s = smilies(bbcode($text)); + $s = smilies(bbcode($text,false,true,$cache)); $s = zidify_links($s); break; } -- cgit v1.2.3 From d01206af5ae7b939d0eff332f017e9511f77dbae Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 6 May 2015 21:43:52 -0700 Subject: forgot to save --- include/bbcode.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 71c069c39..b78566bfe 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -490,8 +490,6 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) } } -*/ - $x = bb_extract_images($Text); $Text = $x['body']; -- cgit v1.2.3 From 90591bcbc9ddba44cd44fc8ce06014c5ef9443e4 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 6 May 2015 22:56:08 -0700 Subject: missed one... --- include/bbcode.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index b78566bfe..49dd4752d 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -383,6 +383,8 @@ function bb_sanitize_style($input) { function bb_observer($Text) { + $a = get_app(); + $observer = $a->get_observer(); if ((strpos($Text,'[/observer]') !== false) || (strpos($Text,'[/rpost]') !== false)) { -- cgit v1.2.3 From 8ca10dcbab6c645f6a2c791ea0d062c25d5d842e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 7 May 2015 10:35:22 +0200 Subject: adjust icon size --- include/nav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/nav.php b/include/nav.php index 1134d1b48..77287c021 100644 --- a/include/nav.php +++ b/include/nav.php @@ -124,7 +124,7 @@ EOT; if($observer) { $userinfo = array( - 'icon' => $observer['xchan_photo_s'], + 'icon' => $observer['xchan_photo_m'], 'name' => $observer['xchan_addr'], ); } -- cgit v1.2.3 From 4f235de3c5a642d538da19b43b4ff4c01c2aa916 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 7 May 2015 13:26:14 +0200 Subject: provide a possibility to include js/css libs --- include/comanche.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'include') diff --git a/include/comanche.php b/include/comanche.php index 7115b5635..630c4f655 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -168,6 +168,33 @@ function comanche_block($s, $class = '') { return $o; } +function comanche_js($s) { + + switch($s) { + case 'jquery': + $path = 'view/js/jquery.js'; + break; + case 'bootstrap': + $path = 'library/bootstrap/js/bootstrap.min.js'; + break; + } + + return ''; + +} + +function comanche_css($s) { + + switch($s) { + case 'bootstrap': + $path = 'library/bootstrap/css/bootstrap.min.css'; + break; + } + + return ''; + +} + // This doesn't really belong in Comanche, but it could also be argued that it is the perfect place. // We need to be able to select what kind of template and decoration to use for the webpage at the heart of our content. // For now we'll allow an '[authored]' element which defaults to name and date, or 'none' to remove these, and perhaps @@ -246,6 +273,19 @@ function comanche_region(&$a, $s) { } } + $cnt = preg_match_all("/\[js\](.*?)\[\/js\]/ism", $s, $matches, PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $s = str_replace($mtch[0],comanche_js(trim($mtch[1])),$s); + } + } + + $cnt = preg_match_all("/\[css\](.*?)\[\/css\]/ism", $s, $matches, PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $s = str_replace($mtch[0],comanche_css(trim($mtch[1])),$s); + } + } // need to modify this to accept parameters $cnt = preg_match_all("/\[widget=(.*?)\](.*?)\[\/widget\]/ism", $s, $matches, PREG_SET_ORDER); -- cgit v1.2.3 From cd8ecb86499c7b1fdaff44653cf3771c60ee2454 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 7 May 2015 23:02:14 +0200 Subject: provide wrap variable for comanche menus --- include/comanche.php | 15 +++++++++++++-- include/menu.php | 7 +++++-- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/comanche.php b/include/comanche.php index 630c4f655..f385f3c5a 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -101,11 +101,22 @@ function comanche_parser(&$a, $s, $pass = 0) { } -function comanche_menu($name, $class = '') { +function comanche_menu($s, $class = '') { + $channel_id = comanche_get_channel_id(); + $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); + } + } + if($channel_id) { $m = menu_fetch($name,$channel_id, get_observer_hash()); - return menu_render($m, $class); + return menu_render($m, $class, $edit = false, $var); } } diff --git a/include/menu.php b/include/menu.php index b4f4555a5..a2e91f7ed 100644 --- a/include/menu.php +++ b/include/menu.php @@ -24,7 +24,7 @@ function menu_fetch($name,$uid,$observer_xchan) { return null; } -function menu_render($menu, $class='', $edit = false) { +function menu_render($menu, $class='', $edit = false, $var = '') { if(! $menu) return ''; @@ -37,12 +37,15 @@ function menu_render($menu, $class='', $edit = false) { $menu['items'][$x]['mitem_desc'] = bbcode($menu['items'][$x]['mitem_desc']); } + $wrap = (($var['wrap'] === 'none') ? false : true); + return replace_macros(get_markup_template('usermenu.tpl'),array( '$menu' => $menu['menu'], '$class' => $class, '$edit' => (($edit) ? t("Edit") : ''), '$id' => $menu['menu']['menu_id'], - '$items' => $menu['items'] + '$items' => $menu['items'], + '$wrap' => $wrap )); } -- cgit v1.2.3 From 616338c17e9eabc6355e27694c9e49f1f4586055 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 10 May 2015 15:00:18 +0200 Subject: provide ability to create submenus --- include/menu.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/menu.php b/include/menu.php index a2e91f7ed..84ea78f00 100644 --- a/include/menu.php +++ b/include/menu.php @@ -29,17 +29,33 @@ function menu_render($menu, $class='', $edit = false, $var = '') { if(! $menu) return ''; + $uid = local_channel(); + $menu_list = menu_list($uid); + + foreach($menu_list as $menus) { + if($menus['menu_name'] != $menu['menu']['menu_name']) + $menu_names[] = $menus['menu_name']; + } + for($x = 0; $x < count($menu['items']); $x ++) { + if(in_array($menu['items'][$x]['mitem_link'], $menu_names)) { + $m = menu_fetch($menu['items'][$x]['mitem_link'],local_channel(), get_observer_hash()); + $submenu = menu_render($m, 'dropdown-menu', $edit = false, $var = array('wrap' => 'none')); + $menu['items'][$x]['submenu'] = $submenu; + } + if($menu['items'][$x]['mitem_flags'] & MENU_ITEM_ZID) $menu['items'][$x]['mitem_link'] = zid($menu['items'][$x]['mitem_link']); + if($menu['items'][$x]['mitem_flags'] & MENU_ITEM_NEWWIN) $menu['items'][$x]['newwin'] = '1'; + $menu['items'][$x]['mitem_desc'] = bbcode($menu['items'][$x]['mitem_desc']); } $wrap = (($var['wrap'] === 'none') ? false : true); - return replace_macros(get_markup_template('usermenu.tpl'),array( + $ret = replace_macros(get_markup_template('usermenu.tpl'),array( '$menu' => $menu['menu'], '$class' => $class, '$edit' => (($edit) ? t("Edit") : ''), @@ -47,6 +63,8 @@ function menu_render($menu, $class='', $edit = false, $var = '') { '$items' => $menu['items'], '$wrap' => $wrap )); + + return $ret; } -- cgit v1.2.3 From 70e5bf04e160bf1e3f2673f4405ac6a6adecb485 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 10 May 2015 21:52:48 +0200 Subject: uid > channel id to make submenus visible for observers --- include/menu.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/menu.php b/include/menu.php index 84ea78f00..5c0811437 100644 --- a/include/menu.php +++ b/include/menu.php @@ -29,8 +29,8 @@ function menu_render($menu, $class='', $edit = false, $var = '') { if(! $menu) return ''; - $uid = local_channel(); - $menu_list = menu_list($uid); + $channel_id = ((is_array(get_app()->profile)) ? get_app()->profile['profile_uid'] : 0); + $menu_list = menu_list($channel_id); foreach($menu_list as $menus) { if($menus['menu_name'] != $menu['menu']['menu_name']) @@ -39,7 +39,7 @@ function menu_render($menu, $class='', $edit = false, $var = '') { for($x = 0; $x < count($menu['items']); $x ++) { if(in_array($menu['items'][$x]['mitem_link'], $menu_names)) { - $m = menu_fetch($menu['items'][$x]['mitem_link'],local_channel(), get_observer_hash()); + $m = menu_fetch($menu['items'][$x]['mitem_link'], $channel_id, get_observer_hash()); $submenu = menu_render($m, 'dropdown-menu', $edit = false, $var = array('wrap' => 'none')); $menu['items'][$x]['submenu'] = $submenu; } -- cgit v1.2.3 From 3140650b8f057b6e88827908a71cecbe68494a10 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 10 May 2015 13:17:41 -0700 Subject: rev update --- include/diaspora.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/diaspora.php b/include/diaspora.php index 4aa525838..e8a470178 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -2430,7 +2430,7 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) { if($item['item_flags'] & ITEM_CONSENSUS) { $poll = replace_macros(get_markup_template('diaspora_consensus.tpl'), array( '$guid_q' => random_string(), - '$question' => '', + '$question' => t('Please choose'), '$guid_y' => random_string(), '$agree' => t('Agree'), '$guid_n' => random_string(), -- cgit v1.2.3 From f2a0dac653f9f372129f373104cf5cf56c108b1f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 11 May 2015 22:57:12 -0700 Subject: fix a couple of miscellaneous errors which showed up in the logs --- include/network.php | 5 ++++- include/text.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/network.php b/include/network.php index a0782692e..e0c8885fd 100644 --- a/include/network.php +++ b/include/network.php @@ -603,7 +603,7 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) $scaled = str_replace($scale_replace[0], $scale_replace[1], $mtch[3]); else $scaled = $mtch[3]; - $i = z_fetch_url($scaled); + $i = z_fetch_url($scaled,true); $cache = get_config('system','itemcache'); @@ -613,7 +613,10 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) } // guess mimetype from headers or filename + $type = guess_image_type($mtch[3],$i['header']); + if(strpos($type,'image') === false) + continue; if($i['success']) { $ph = photo_factory($i['body'], $type); diff --git a/include/text.php b/include/text.php index deb5a4c90..6ed06e92a 100644 --- a/include/text.php +++ b/include/text.php @@ -2244,7 +2244,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $d // The '=' is needed to not replace color codes if the code is also used as a tag // Much better would be to somehow completely avoiding things in e.g. [color]-tags. // This would allow writing things like "my favourite tag=#foobar". - $body = preg_replace('/(? Date: Tue, 12 May 2015 17:06:47 -0700 Subject: replace project name with $product or $Product in strings to avoid merge issues across different project names. Currently a place-holder. The strings themselves have not yet been modified. --- include/language.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/language.php b/include/language.php index 1e8528dc1..0af72142f 100644 --- a/include/language.php +++ b/include/language.php @@ -159,12 +159,25 @@ function t($s, $ctx = '') { if (x($a->strings, $cs)) { $t = $a->strings[$cs]; - return is_array($t) ? $t[0] : $t; + return ((is_array($t)) ? translate_product($t[0]) : translate_product($t)); } - return $s; + return translate_product($s); } +/** + * @brief translate product name + * Merging strings from different project names is problematic so we'll do that with a string replacement + */ + +function translate_product($s) { + + return str_replace(array('$product','$Product'),array(RED_PLATFORM,ucfirst(RED_PLATFORM)),$s); + +} + + + /** * @brief * -- cgit v1.2.3 From 1e0e812440b8b87c39a88692e39eb0baca736b6e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 12 May 2015 18:11:54 -0700 Subject: provide a method for loading site/custom widgets --- include/comanche.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/comanche.php b/include/comanche.php index f385f3c5a..3030ae5c6 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -245,6 +245,9 @@ function comanche_widget($name, $text) { } } + if(file_exists('widget/' . trim($name) . '.php')) + require_once('widget/' . trim($name) . '.php'); + $func = 'widget_' . trim($name); if (function_exists($func)) return $func($vars); -- cgit v1.2.3 From d6f98e651170827453a27fec367f0f8059f3a002 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 13 May 2015 16:01:00 -0700 Subject: product was a bad string to use because we may require it for e-commerce, and RED_PLATFORM is equally problematic for other reasons. --- include/api.php | 2 +- include/enotify.php | 2 +- include/event.php | 2 +- include/identity.php | 2 +- include/items.php | 2 +- include/language.php | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/api.php b/include/api.php index b9c4c45a4..12247c183 100644 --- a/include/api.php +++ b/include/api.php @@ -1937,7 +1937,7 @@ require_once('include/items.php'); 'private' => $private, 'textlimit' => $textlimit, 'sslserver' => $sslserver, 'ssl' => $ssl, 'shorturllength' => '30', 'redmatrix' => array( - 'RED_PLATFORM' => RED_PLATFORM, + 'PLATFORM_NAME' => PLATFORM_NAME, 'RED_VERSION' => RED_VERSION, 'ZOT_REVISION' => ZOT_REVISION, 'DB_UPDATE_VERSION' => DB_UPDATE_VERSION diff --git a/include/enotify.php b/include/enotify.php index e801c3100..b5495dc7c 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -56,7 +56,7 @@ function notification($params) { push_lang($recip['account_language']); // should probably have a channel language $banner = t('Red Matrix Notification'); - $product = t('redmatrix'); // RED_PLATFORM; + $product = t('redmatrix'); // PLATFORM_NAME; $siteurl = $a->get_baseurl(true); $thanks = t('Thank You,'); $sitename = get_config('system','sitename'); diff --git a/include/event.php b/include/event.php index 5926b50f7..0b1e56ae2 100644 --- a/include/event.php +++ b/include/event.php @@ -62,7 +62,7 @@ function ical_wrapper($ev) { $o .= "BEGIN:VCALENDAR"; $o .= "\nVERSION:2.0"; $o .= "\nMETHOD:PUBLISH"; - $o .= "\nPRODID:-//" . get_config('system','sitename') . "//" . RED_PLATFORM . "//" . strtoupper(get_app()->language). "\n"; + $o .= "\nPRODID:-//" . get_config('system','sitename') . "//" . PLATFORM_NAME . "//" . strtoupper(get_app()->language). "\n"; if(array_key_exists('start', $ev)) $o .= format_event_ical($ev); else { diff --git a/include/identity.php b/include/identity.php index 7884c04d2..dec3f6e98 100644 --- a/include/identity.php +++ b/include/identity.php @@ -481,7 +481,7 @@ function identity_basic_export($channel_id, $items = false) { $ret = array(); - $ret['compatibility'] = array('project' => RED_PLATFORM, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION); + $ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION); $r = q("select * from channel where channel_id = %d limit 1", intval($channel_id) diff --git a/include/items.php b/include/items.php index 4e85bef37..1db3fab2b 100755 --- a/include/items.php +++ b/include/items.php @@ -560,7 +560,7 @@ function get_feed_for($channel, $observer_hash, $params) { $atom .= replace_macros($feed_template, array( '$version' => xmlify(RED_VERSION), - '$red' => xmlify(RED_PLATFORM), + '$red' => xmlify(PLATFORM_NAME), '$feed_id' => xmlify($channel['xchan_url']), '$feed_title' => xmlify($channel['channel_name']), '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now' , ATOM_TIME)) , diff --git a/include/language.php b/include/language.php index 0af72142f..7dbe3dd02 100644 --- a/include/language.php +++ b/include/language.php @@ -159,10 +159,10 @@ function t($s, $ctx = '') { if (x($a->strings, $cs)) { $t = $a->strings[$cs]; - return ((is_array($t)) ? translate_product($t[0]) : translate_product($t)); + return ((is_array($t)) ? translate_projectname($t[0]) : translate_projectname($t)); } - return translate_product($s); + return translate_projectname($s); } /** @@ -170,9 +170,9 @@ function t($s, $ctx = '') { * Merging strings from different project names is problematic so we'll do that with a string replacement */ -function translate_product($s) { +function translate_projectname($s) { - return str_replace(array('$product','$Product'),array(RED_PLATFORM,ucfirst(RED_PLATFORM)),$s); + return str_replace(array('$projectname','$Projectname'),array(PLATFORM_NAME,ucfirst(PLATFORM_NAME)),$s); } -- cgit v1.2.3