From: friendica Date: Tue, 24 Jan 2012 04:56:11 +0000 (-0800) Subject: implement "moderate" flag on items X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a76a497d924a16b8b07b126408db21655aac3bd6;p=friendica.git implement "moderate" flag on items --- diff --git a/boot.php b/boot.php index 7ae1900c7f..e02a28b11a 100755 --- a/boot.php +++ b/boot.php @@ -11,7 +11,7 @@ require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_VERSION', '2.3.1233' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); -define ( 'DB_UPDATE_VERSION', 1115 ); +define ( 'DB_UPDATE_VERSION', 1116 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/database.sql b/database.sql index 6826aa6f89..5b7c870df9 100755 --- a/database.sql +++ b/database.sql @@ -222,6 +222,7 @@ CREATE TABLE IF NOT EXISTS `item` ( `deny_gid` mediumtext NOT NULL, `private` tinyint(1) NOT NULL DEFAULT '0', `pubmail` tinyint(1) NOT NULL DEFAULT '0', + `moderated` tinyint(1) NOT NULL DEFAULT '0', `visible` tinyint(1) NOT NULL DEFAULT '0', `starred` tinyint(1) NOT NULL DEFAULT '0', `bookmark` tinyint(1) NOT NULL DEFAULT '0', @@ -242,6 +243,7 @@ CREATE TABLE IF NOT EXISTS `item` ( KEY `created` (`created`), KEY `edited` (`edited`), KEY `received` (`received`), + KEY `moderated` (`moderated`), KEY `visible` (`visible`), KEY `starred` (`starred`), KEY `bookmark` (`bookmark`), diff --git a/include/api.php b/include/api.php index 08b28265c4..7b8709659e 100755 --- a/include/api.php +++ b/include/api.php @@ -650,7 +650,7 @@ `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item`, `contact` WHERE `item`.`uid` = %d - AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 AND `contact`.`id` = `item`.`contact-id` AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 $sql_extra @@ -707,7 +707,7 @@ FROM `item`, `contact` WHERE `item`.`uid` = %d AND `item`.`contact-id` = %d - AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 AND `contact`.`id` = `item`.`contact-id` AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 $sql_extra @@ -761,7 +761,7 @@ `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item`, `contact` WHERE `item`.`uid` = %d - AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 AND `item`.`starred` = 1 AND `contact`.`id` = `item`.`contact-id` AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 diff --git a/include/delivery.php b/include/delivery.php index 5441ac5108..c05358868a 100755 --- a/include/delivery.php +++ b/include/delivery.php @@ -84,7 +84,7 @@ function delivery_run($argv, $argc){ else { // find ancestors - $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1", + $r = q("SELECT * FROM `item` WHERE `id` = %d and visible = 1 and moderated = 0 LIMIT 1", intval($item_id) ); @@ -102,7 +102,7 @@ function delivery_run($argv, $argc){ $items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer` - FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d ORDER BY `id` ASC", + FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d and visible = 1 and moderated = 0 ORDER BY `id` ASC", intval($parent_id) ); diff --git a/include/items.php b/include/items.php index a939bfc88b..21ee994dc8 100755 --- a/include/items.php +++ b/include/items.php @@ -118,7 +118,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) `sign`.`signed_text`, `sign`.`signature`, `sign`.`signer` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` - WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`parent` != 0 + WHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`parent` != 0 AND `item`.`wall` = 1 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND ( `item`.`edited` > '%s' OR `item`.`changed` > '%s' ) $sql_extra @@ -1414,7 +1414,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) intval($item['uid']) ); // who is the last child now? - $r = q("SELECT `id` FROM `item` WHERE `parent-uri` = '%s' AND `type` != 'activity' AND `deleted` = 0 AND `uid` = %d + $r = q("SELECT `id` FROM `item` WHERE `parent-uri` = '%s' AND `type` != 'activity' AND `deleted` = 0 AND `moderated` = 0 AND `uid` = %d ORDER BY `created` DESC LIMIT 1", dbesc($item['parent-uri']), intval($importer['uid']) diff --git a/include/notifier.php b/include/notifier.php index 1db1b09dae..ead7aebad4 100755 --- a/include/notifier.php +++ b/include/notifier.php @@ -111,7 +111,7 @@ function notifier_run($argv, $argc){ else { // find ancestors - $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1", + $r = q("SELECT * FROM `item` WHERE `id` = %d and visible = 1 and moderated = 0 LIMIT 1", intval($item_id) ); @@ -128,7 +128,7 @@ function notifier_run($argv, $argc){ return; $items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer` - FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d ORDER BY `id` ASC", + FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d and visible = 1 and moderated = 0 ORDER BY `id` ASC", intval($parent_id) ); diff --git a/mod/community.php b/mod/community.php index 34c992bada..d578b469f8 100755 --- a/mod/community.php +++ b/mod/community.php @@ -47,7 +47,7 @@ function community_content(&$a, $update = 0) { $r = q("SELECT COUNT(*) AS `total` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid` - WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 + WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `wall` = 1 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `user`.`hidewall` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 " @@ -68,7 +68,7 @@ function community_content(&$a, $update = 0) { `user`.`nickname`, `user`.`hidewall` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid` - WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 + WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `wall` = 1 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `user`.`hidewall` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 @@ -84,7 +84,7 @@ function community_content(&$a, $update = 0) { $o .= paginate($a); - $o .= '
' . t('Shared content is covered by the Creative Commons Attribution 3.0 license.') . '
'; +// $o .= '
' . t('Shared content is covered by the Creative Commons Attribution 3.0 license.') . '
'; return $o; } diff --git a/mod/display.php b/mod/display.php index 761eb49975..02f080a790 100755 --- a/mod/display.php +++ b/mod/display.php @@ -75,6 +75,7 @@ function display_content(&$a) { `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`parent` = ( SELECT `parent` FROM `item` WHERE ( `id` = '%s' OR `uri` = '%s' )) $sql_extra diff --git a/mod/network.php b/mod/network.php index 70cb232f6f..271a1236d9 100755 --- a/mod/network.php +++ b/mod/network.php @@ -404,7 +404,8 @@ function network_content(&$a, $update = 0) { `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item`, `contact` - WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + WHERE `item`.`uid` = %d AND `item`.`visible` = 1 + AND `item`.`deleted` = 0 and `item`.`moderated` = 0 $simple_update AND `contact`.`id` = `item`.`contact-id` AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 @@ -430,7 +431,7 @@ function network_content(&$a, $update = 0) { $r = q("SELECT `parent` AS `item_id`, `contact`.`uid` AS `contact_uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 - and `item`.`unseen` = 1 + and `item`.`moderated` = 0 and `item`.`unseen` = 1 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 $sql_extra $sql_nets ", intval(local_user()) @@ -440,7 +441,7 @@ function network_content(&$a, $update = 0) { $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact_uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 - AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 + AND `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`parent` = `item`.`id` $sql_extra $sql_nets ORDER BY `item`.$ordering DESC $pager_sql ", @@ -465,7 +466,7 @@ function network_content(&$a, $update = 0) { `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item`, `contact` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 - AND `contact`.`id` = `item`.`contact-id` + AND `item`.`moderated` = 0 AND `contact`.`id` = `item`.`contact-id` AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`parent` IN ( %s ) $sql_extra ", diff --git a/mod/notes.php b/mod/notes.php index 94ea10e811..e6e2b44fb0 100755 --- a/mod/notes.php +++ b/mod/notes.php @@ -80,7 +80,7 @@ function notes_content(&$a,$update = false) { $r = q("SELECT COUNT(*) AS `total` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` - WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + WHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0 $sql_extra ", @@ -95,7 +95,7 @@ function notes_content(&$a,$update = false) { $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` - WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0 $sql_extra @@ -119,7 +119,7 @@ function notes_content(&$a,$update = false) { `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` - WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + WHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`parent` IN ( %s ) $sql_extra diff --git a/mod/notice.php b/mod/notice.php index 9d8aeed700..19cf53189a 100755 --- a/mod/notice.php +++ b/mod/notice.php @@ -1,5 +1,5 @@ friendika items permanent-url compatibility */ + /* identi.ca -> friendica items permanent-url compatibility */ function notice_init(&$a){ $id = $a->argv[1]; diff --git a/mod/photos.php b/mod/photos.php index 77b44ce0d0..466fe44d3e 100755 --- a/mod/photos.php +++ b/mod/photos.php @@ -1103,7 +1103,7 @@ function photos_content(&$a) { $link_item = $linked_items[0]; $r = q("SELECT COUNT(*) AS `total` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` - WHERE `parent-uri` = '%s' AND `uri` != '%s' AND `item`.`deleted` = 0 + WHERE `parent-uri` = '%s' AND `uri` != '%s' AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`uid` = %d $sql_extra ", @@ -1122,7 +1122,7 @@ function photos_content(&$a) { `contact`.`rel`, `contact`.`thumb`, `contact`.`self`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` - WHERE `parent-uri` = '%s' AND `uri` != '%s' AND `item`.`deleted` = 0 + WHERE `parent-uri` = '%s' AND `uri` != '%s' AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`uid` = %d $sql_extra diff --git a/mod/profile.php b/mod/profile.php index 90a609d036..5d89db93e7 100755 --- a/mod/profile.php +++ b/mod/profile.php @@ -167,7 +167,7 @@ function profile_content(&$a, $update = 0) { $r = q("SELECT distinct(parent) AS `item_id`, `contact`.`uid` AS `contact-uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 - and `item`.`unseen` = 1 + and `item`.`moderated` = 0 and `item`.`unseen` = 1 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`wall` = 1 $sql_extra @@ -181,7 +181,7 @@ function profile_content(&$a, $update = 0) { $r = q("SELECT COUNT(*) AS `total` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 - AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 + and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1 $sql_extra ", intval($a->profile['profile_uid']) @@ -197,7 +197,7 @@ function profile_content(&$a, $update = 0) { $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 - AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 + and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1 $sql_extra ORDER BY `item`.`created` DESC $pager_sql ", @@ -220,6 +220,7 @@ function profile_content(&$a, $update = 0) { `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item`, `contact` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + and `item`.`moderated` = 0 AND `contact`.`id` = `item`.`contact-id` AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`parent` IN ( %s ) diff --git a/mod/search.php b/mod/search.php index 3f98b607f0..fe09b671f6 100755 --- a/mod/search.php +++ b/mod/search.php @@ -103,7 +103,7 @@ function search_content(&$a) { $r = q("SELECT COUNT(*) AS `total` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid` - WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 + WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND (( `wall` = 1 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `user`.`hidewall` = 0) OR `item`.`uid` = %d ) AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 @@ -126,7 +126,7 @@ function search_content(&$a) { `user`.`nickname` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid` - WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 + WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND (( `wall` = 1 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `user`.`hidewall` = 0 ) OR `item`.`uid` = %d ) AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 diff --git a/mod/viewsrc.php b/mod/viewsrc.php index 8900e44db4..94847ec7b9 100755 --- a/mod/viewsrc.php +++ b/mod/viewsrc.php @@ -18,6 +18,7 @@ function viewsrc_content(&$a) { $r = q("SELECT `item`.`body` FROM `item` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + and `item`.`moderated` = 0 AND `item`.`id` = '%s' LIMIT 1", intval(local_user()), dbesc($item_id) diff --git a/update.php b/update.php index 4dff59c984..aac306a720 100755 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ > '; -}*/ + blockquote { background-color: #f4f8f9; border-left: 4px solid #dae4ee; padding: 0.4em; } -/*input[type=text] { - padding: 5px; -}*/ - .icollapse-wrapper, .ccollapse-wrapper { border: 1px solid #CCC; padding: 5px;