From ed87dbc1414b7da2f58213671539c5570a416809 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 19 Nov 2015 11:46:29 -0800 Subject: issue #173 --- mod/subthread.php | 12 +++++++++--- version.inc | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mod/subthread.php b/mod/subthread.php index 162545a2f..74d742b6a 100755 --- a/mod/subthread.php +++ b/mod/subthread.php @@ -11,18 +11,24 @@ function subthread_content(&$a) { return; } + $item_id = ((argc() > 2) ? notags(trim(argv(2))) : 0); + if(argv(1) === 'sub') $activity = ACTIVITY_FOLLOW; elseif(argv(1) === 'unsub') $activity = ACTIVITY_UNFOLLOW; - $item_id = ((argc() > 2) ? notags(trim(argv(2))) : 0); - $r = q("SELECT * FROM `item` WHERE `parent` = '%s' OR `parent_mid` = '%s' and parent = id LIMIT 1", - dbesc($item_id), + $r = q("SELECT parent FROM item WHERE id = '%s'", dbesc($item_id) ); + if($r) { + $r = q("select * from item where id = parent and id = %d limit 1", + dbesc($r[0]['parent']) + ); + } + if((! $item_id) || (! $r)) { logger('subthread: no item ' . $item_id); return; diff --git a/version.inc b/version.inc index a1de68ee0..d6100d73a 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-11-18.1220 +2015-11-19.1221 -- cgit v1.2.3 From 4f81d6451783f8f51b10b2636d68cde444041dc1 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 19 Nov 2015 15:06:35 -0800 Subject: issue #160 add blablanet to directory fallback list --- boot.php | 1 + 1 file changed, 1 insertion(+) diff --git a/boot.php b/boot.php index 390560592..c74eea512 100755 --- a/boot.php +++ b/boot.php @@ -83,6 +83,7 @@ $DIRECTORY_FALLBACK_SERVERS = array( 'https://hubzilla.site', 'https://red.zottel.red', 'https://gravizot.de', + 'https://blablanet.com', 'https://my.federated.social' ); -- cgit v1.2.3 From a890ee6864f5a3b727ac558b64f9a208345d9fb7 Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Fri, 20 Nov 2015 00:39:47 +0100 Subject: Some bits --- doc/nl/TermsOfService.md | 5 +++++ mod/invite.php | 4 ++-- view/theme/redbasic/schema/bluegrid.css | 8 ++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 doc/nl/TermsOfService.md diff --git a/doc/nl/TermsOfService.md b/doc/nl/TermsOfService.md new file mode 100644 index 000000000..c4cc4648c --- /dev/null +++ b/doc/nl/TermsOfService.md @@ -0,0 +1,5 @@ +Gebruikersvoorwaarden +================ + +#include doc/SiteTOS.md; + diff --git a/mod/invite.php b/mod/invite.php index 46fa7b413..1af5fc1f8 100644 --- a/mod/invite.php +++ b/mod/invite.php @@ -51,7 +51,7 @@ function invite_post(&$a) { } if($invonly && ($x || is_site_admin())) { - $code = autoname(8) . srand(1000,9999); + $code = autoname(8) . rand(1000,9999); $nmessage = str_replace('$invite_code',$code,$message); $r = q("INSERT INTO `register` (`hash`,`created`) VALUES ('%s', '%s') ", @@ -143,4 +143,4 @@ function invite_content(&$a) { )); return $o; -} \ No newline at end of file +} diff --git a/view/theme/redbasic/schema/bluegrid.css b/view/theme/redbasic/schema/bluegrid.css index d9dbc9f15..8545f3f74 100644 --- a/view/theme/redbasic/schema/bluegrid.css +++ b/view/theme/redbasic/schema/bluegrid.css @@ -188,6 +188,10 @@ nav .badge:hover, nav .badge:focus { box-shadow: 0px 6px 12px rgba(45,48,92,.176); } +.tags a { + color: inherit; +} + #profile-photo-wrapper { border: none; } @@ -337,7 +341,7 @@ input { background-color: #FFF; } -.btn-primary, input#event-submit, input#rmagic-submit-button, input#lostpass-submit-button, input#side-follow-submit, .profile-edit-submit-wrapper > input.profile-edit-submit-button, input#profile-photo-submit, form#chat-form > input, div#adminpage > form > div.submit > input, input.sources-submit, input.contact-edit-submit, input#dbtn-submit, input#newchannel-submit-button { +.btn-primary, input#event-submit, input#rmagic-submit-button, input#lostpass-submit-button, input#side-follow-submit, .profile-edit-submit-wrapper > input.profile-edit-submit-button, input#profile-photo-submit, form#chat-form > input, div#adminpage > form > div.submit > input, input.sources-submit, input.contact-edit-submit, input#dbtn-submit, input#newchannel-submit-button, input#contacts-search-submit { background-color: #FFF; color: #43488A; border-radius: 0px; @@ -346,7 +350,7 @@ input { transition: all .3s ease-in-out; } -.btn-primary:hover, .btn-primary:focus, input#event-submit:hover, input#event-submit:focus, input#rmagic-submit-button:hover, input#rmagic-submit-button:focus, input#lostpass-submit-button:hover, input#lostpass-submit-button:focus, input#side-follow-submit:hover, input#side-follow-submit:focus, .profile-edit-submit-wrapper > input.profile-edit-submit-button:hover, .profile-edit-submit-wrapper > input.profile-edit-submit-button:focus, input#profile-photo-submit:hover, input#profile-photo-submit:focus, form#chat-form > input:hover, form#chat-form > input:focus, div#adminpage > form > div.submit > input:hover, div#adminpage > form > div.submit > input:focus, input.sources-submit:hover, input.sources-submit:focus, input.contact-edit-submit:focus, input.contact-edit-submit:hover, input#dbtn-submit:hover, input#dbtn-submit:focus, input#newchannel-submit-button:hover, input#newchannel-submit-button:focus { +.btn-primary:hover, .btn-primary:focus, input#event-submit:hover, input#event-submit:focus, input#rmagic-submit-button:hover, input#rmagic-submit-button:focus, input#lostpass-submit-button:hover, input#lostpass-submit-button:focus, input#side-follow-submit:hover, input#side-follow-submit:focus, .profile-edit-submit-wrapper > input.profile-edit-submit-button:hover, .profile-edit-submit-wrapper > input.profile-edit-submit-button:focus, input#profile-photo-submit:hover, input#profile-photo-submit:focus, form#chat-form > input:hover, form#chat-form > input:focus, div#adminpage > form > div.submit > input:hover, div#adminpage > form > div.submit > input:focus, input.sources-submit:hover, input.sources-submit:focus, input.contact-edit-submit:focus, input.contact-edit-submit:hover, input#dbtn-submit:hover, input#dbtn-submit:focus, input#newchannel-submit-button:hover, input#newchannel-submit-button:focus, input#contacts-search-submit:hover, input#contacts-search-submit:focus { border-color: #FFF; background-color: #43488A; color: #FFF; -- cgit v1.2.3 From c7652fc29ce2d69a6d71d6d8a928709cbf6ebbb0 Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Fri, 20 Nov 2015 00:50:54 +0100 Subject: Had to switch these 2. Sorry. --- mod/invite.php | 2 +- view/tpl/invite.tpl | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mod/invite.php b/mod/invite.php index 1af5fc1f8..bda808142 100644 --- a/mod/invite.php +++ b/mod/invite.php @@ -51,7 +51,7 @@ function invite_post(&$a) { } if($invonly && ($x || is_site_admin())) { - $code = autoname(8) . rand(1000,9999); + $code = autoname(8) . srand(1000,9999); $nmessage = str_replace('$invite_code',$code,$message); $r = q("INSERT INTO `register` (`hash`,`created`) VALUES ('%s', '%s') ", diff --git a/view/tpl/invite.tpl b/view/tpl/invite.tpl index 2b7ab9cfb..c39e044bc 100755 --- a/view/tpl/invite.tpl +++ b/view/tpl/invite.tpl @@ -1,3 +1,4 @@ +
@@ -28,3 +29,4 @@
+ -- cgit v1.2.3 From 8f94c721bffab9f2ee4aeb045fb81a9840013211 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 19 Nov 2015 16:05:47 -0800 Subject: new feature: 'suppress_duplicates' issue #146 triggered with less than two minutes between posts having identical content. --- include/features.php | 1 + mod/admin.php | 5 +++-- mod/item.php | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/include/features.php b/include/features.php index 74ae7b3d7..4e962b00e 100644 --- a/include/features.php +++ b/include/features.php @@ -60,6 +60,7 @@ function get_features() { array('content_encrypt', t('Even More Encryption'), t('Allow optional encryption of content end-to-end with a shared secret key'),false), array('consensus_tools', t('Enable Voting Tools'), t('Provide a class of post which others can vote on'),false), array('delayed_posting', t('Delayed Posting'), t('Allow posts to be published at a later date'),false), + array('suppress_duplicates', t('Suppress Duplicate Posts/Comments'), t('Prevent posts with identical content to be published with less than two minutes in between submissions.'),true), ), diff --git a/mod/admin.php b/mod/admin.php index 3f1a69ca6..4b7cb3cd9 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -395,9 +395,10 @@ function admin_page_site(&$a) { } /* Banner */ + $banner = get_config('system', 'banner'); - if($banner == false) - $banner = 'red'; + if($banner === false) + $banner = get_config('system','sitename'); $banner = htmlspecialchars($banner); diff --git a/mod/item.php b/mod/item.php index b66d71797..1e39ca9c9 100644 --- a/mod/item.php +++ b/mod/item.php @@ -703,6 +703,10 @@ function item_post(&$a) { $plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid; } + + + + $datarray['aid'] = $channel['channel_account_id']; $datarray['uid'] = $profile_uid; @@ -781,6 +785,22 @@ function item_post(&$a) { if($orig_post) $datarray['edit'] = true; + + + if(feature_enabled($profile_uid,'suppress_duplicates')) { + + $z = q("select created from item where uid = %d and body = '%s'", + intval($profile_uid), + dbesc($body) + ); + + if($z && $z[0]['created'] > datetime_convert('UTC','UTC', 'now - 2 minutes')) { + $datarray['cancel'] = 1; + notice( t('Duplicate post suppressed.') . EOL); + logger('Duplicate post. Faking plugin cancel.'); + } + } + call_hooks('post_local',$datarray); if(x($datarray,'cancel')) { -- cgit v1.2.3 From 5805a540973e6110f148d5be7b68c102382a4e12 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 19 Nov 2015 16:44:12 -0800 Subject: directory search for pubforums using hubzilla directory servers using redmatrix flag value --- mod/dirsearch.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mod/dirsearch.php b/mod/dirsearch.php index 937564a79..548acbd08 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -124,8 +124,6 @@ function dirsearch_content(&$a) { if($keywords) $sql_extra .= dir_query_build($joiner,'xprof_keywords',$keywords); - if($forums) - $safesql .= dir_flag_build(' AND ','xchan_flags',XCHAN_FLAGS_PUBFORUM, $forums); // we only support an age range currently. You must set both agege // (greater than or equal) and agele (less than or equal) @@ -173,6 +171,9 @@ function dirsearch_content(&$a) { if($safe < 0) $safesql = " and ( xchan_censored = 1 OR xchan_selfcensored = 1 ) "; + if($forums) + $safesql .= " and xchan_pubforum = " . ((intval($forums)) ? '1 ' : '0 '); + if($limit) $qlimit = " LIMIT $limit "; else { @@ -185,7 +186,6 @@ function dirsearch_content(&$a) { } } - if($sort_order == 'normal') { $order = " order by xchan_name asc "; @@ -202,6 +202,7 @@ function dirsearch_content(&$a) { else $order = " order by xchan_name_date desc "; + if($sync) { $spkt = array('transactions' => array()); $r = q("select * from updates where ud_date >= '%s' and ud_guid != '' order by ud_date desc", @@ -245,15 +246,20 @@ function dirsearch_content(&$a) { json_return_and_die($spkt); } else { + $r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where ( $logic $sql_extra ) $hub_query and xchan_network = 'zot' and xchan_hidden = 0 and xchan_orphan = 0 and xchan_deleted = 0 $safesql $order $qlimit " ); + + + $ret['page'] = $page + 1; $ret['records'] = count($r); } + if($r) { $entries = array(); -- cgit v1.2.3 From a44795e6c32d90d54e5a4321cad4ffe0f3409a09 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 19 Nov 2015 17:27:07 -0800 Subject: change action label from 'stop following' to 'unfollow thread' --- include/conversation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/conversation.php b/include/conversation.php index 57dc9d2a2..6cdbb878f 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -944,7 +944,7 @@ function item_photo_menu($item){ $menu = Array( t("View Source") => $vsrc_link, t("Follow Thread") => $sub_link, - t("Stop Following") => $unsub_link, + t("Unfollow Thread") => $unsub_link, t("View Status") => $status_link, t("View Profile") => $profile_link, t("View Photos") => $photos_link, -- cgit v1.2.3 From e56633d5b0009fd5430a15fd09633e8f43bdb7dd Mon Sep 17 00:00:00 2001 From: ken restivo Date: Thu, 19 Nov 2015 20:58:13 -0800 Subject: Throw HTTP error and display error message when database is unavailable. #179 --- index.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.php b/index.php index 3758b38b0..dc6000bd6 100755 --- a/index.php +++ b/index.php @@ -36,6 +36,12 @@ require_once('include/dba/dba_driver.php'); if(! $a->install) { $db = dba_factory($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type, $a->install); + if(! $db->connected){ + header('HTTP/1.0 520 Unknown Error'); + // TODO: much friendlier error message + die("Database error, contact admin."); + } + unset($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type); /** -- cgit v1.2.3