Get rid of unneeded or redundant fields
This commit is contained in:
parent
a720c4f501
commit
3f07d01dd1
9 changed files with 57 additions and 87 deletions
|
@ -928,7 +928,7 @@ function admin_page_site_post(App $a)
|
|||
update_table("term", ['url'], $old_url, $new_url);
|
||||
update_table("contact", ['photo', 'thumb', 'micro', 'url', 'nurl', 'alias', 'request', 'notify', 'poll', 'confirm', 'poco', 'avatar'], $old_url, $new_url);
|
||||
update_table("gcontact", ['url', 'nurl', 'photo', 'server_url', 'notify', 'alias'], $old_url, $new_url);
|
||||
update_table("item", ['owner-link', 'owner-avatar', 'author-link', 'author-avatar', 'body', 'plink', 'tag'], $old_url, $new_url);
|
||||
update_table("item", ['owner-link', 'author-link', 'body', 'plink', 'tag'], $old_url, $new_url);
|
||||
|
||||
// update profile addresses in the format "user@server.tld"
|
||||
update_table("contact", ['addr'], $old_host, $new_host);
|
||||
|
|
|
@ -49,8 +49,7 @@ function display_init(App $a)
|
|||
|
||||
// Does the local user have this item?
|
||||
if (local_user()) {
|
||||
$r = dba::fetch_first("SELECT `id`, `parent`, `author-name`, `author-link`,
|
||||
`author-avatar`, `network`, `body`, `uid`, `owner-link`
|
||||
$r = dba::fetch_first("SELECT `id`, `parent`, `author-id`, `body`, `uid`
|
||||
FROM `item` WHERE `visible` AND NOT `deleted` AND NOT `moderated`
|
||||
AND `guid` = ? AND `uid` = ? LIMIT 1", $a->argv[1], local_user());
|
||||
if (DBM::is_result($r)) {
|
||||
|
@ -60,8 +59,7 @@ function display_init(App $a)
|
|||
|
||||
// Is it an item with uid=0?
|
||||
if (!DBM::is_result($r)) {
|
||||
$r = dba::fetch_first("SELECT `id`, `parent`, `author-name`, `author-link`,
|
||||
`author-avatar`, `network`, `body`, `uid`, `owner-link`
|
||||
$r = dba::fetch_first("SELECT `id`, `parent`, `author-id`, `body`, `uid`
|
||||
FROM `item` WHERE `visible` AND NOT `deleted` AND NOT `moderated`
|
||||
AND NOT `private` AND `uid` = 0
|
||||
AND `guid` = ? LIMIT 1", $a->argv[1]);
|
||||
|
@ -73,8 +71,7 @@ function display_init(App $a)
|
|||
return;
|
||||
}
|
||||
} elseif (($a->argc == 3) && ($nick == 'feed-item')) {
|
||||
$r = dba::fetch_first("SELECT `id`, `parent`, `author-name`, `author-link`,
|
||||
`author-avatar`, `network`, `body`, `uid`, `owner-link`
|
||||
$r = dba::fetch_first("SELECT `id`, `parent`, `author-id`, `body`, `uid`
|
||||
FROM `item` WHERE `visible` AND NOT `deleted` AND NOT `moderated`
|
||||
AND NOT `private` AND `uid` = 0
|
||||
AND `id` = ? LIMIT 1", $a->argv[2]);
|
||||
|
@ -87,7 +84,7 @@ function display_init(App $a)
|
|||
}
|
||||
|
||||
if ($r["id"] != $r["parent"]) {
|
||||
$r = dba::fetch_first("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid`, `owner-link` FROM `item`
|
||||
$r = dba::fetch_first("SELECT `id`, `author-id`, `body`, `uid` FROM `item`
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `id` = ?", $r["parent"]);
|
||||
}
|
||||
|
@ -117,14 +114,16 @@ function display_init(App $a)
|
|||
}
|
||||
|
||||
function display_fetchauthor($a, $item) {
|
||||
$author = dba::selectFirst('contact', ['name', 'nick', 'photo', 'network', 'url'], ['id' => $item['author-id']]);
|
||||
|
||||
$profiledata = [];
|
||||
$profiledata["uid"] = -1;
|
||||
$profiledata["nickname"] = $item["author-name"];
|
||||
$profiledata["name"] = $item["author-name"];
|
||||
$profiledata["picdate"] = "";
|
||||
$profiledata["photo"] = $item["author-avatar"];
|
||||
$profiledata["url"] = $item["author-link"];
|
||||
$profiledata["network"] = $item["network"];
|
||||
$profiledata['uid'] = -1;
|
||||
$profiledata['nickname'] = $author['nick'];
|
||||
$profiledata['name'] = $author['name'];
|
||||
$profiledata['picdate'] = '';
|
||||
$profiledata['photo'] = $author['photo'];
|
||||
$profiledata['url'] = $author['url'];
|
||||
$profiledata['network'] = $author['network'];
|
||||
|
||||
// Check for a repeated message
|
||||
$skip = false;
|
||||
|
|
|
@ -103,7 +103,6 @@ function network_init(App $a)
|
|||
'/new', //new
|
||||
'', //starred
|
||||
'', //bookmarked
|
||||
'', //spam
|
||||
];
|
||||
$tab_args = [
|
||||
'f=&order=comment', //all
|
||||
|
@ -112,7 +111,6 @@ function network_init(App $a)
|
|||
'', //new
|
||||
'f=&star=1', //starred
|
||||
'f=&bmark=1', //bookmarked
|
||||
'f=&spam=1', //spam
|
||||
];
|
||||
|
||||
$k = array_search('active', $last_sel_tabs);
|
||||
|
@ -218,9 +216,8 @@ function saved_searches($search)
|
|||
* '/network/new', => $new_active = 'active'
|
||||
* '/network?f=&star=1', => $starred_active = 'active'
|
||||
* '/network?f=&bmark=1', => $bookmarked_active = 'active'
|
||||
* '/network?f=&spam=1', => $spam_active = 'active'
|
||||
*
|
||||
* @return Array ($no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active);
|
||||
* @return Array ($no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active);
|
||||
*/
|
||||
function network_query_get_sel_tab(App $a)
|
||||
{
|
||||
|
@ -230,7 +227,6 @@ function network_query_get_sel_tab(App $a)
|
|||
$bookmarked_active = '';
|
||||
$all_active = '';
|
||||
$conv_active = '';
|
||||
$spam_active = '';
|
||||
$postord_active = '';
|
||||
|
||||
if (($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new')) {
|
||||
|
@ -249,11 +245,7 @@ function network_query_get_sel_tab(App $a)
|
|||
$conv_active = 'active';
|
||||
}
|
||||
|
||||
if (x($_GET, 'spam')) {
|
||||
$spam_active = 'active';
|
||||
}
|
||||
|
||||
if (($new_active == '') && ($starred_active == '') && ($bookmarked_active == '') && ($conv_active == '') && ($spam_active == '')) {
|
||||
if (($new_active == '') && ($starred_active == '') && ($bookmarked_active == '') && ($conv_active == '')) {
|
||||
$no_active = 'active';
|
||||
}
|
||||
|
||||
|
@ -264,7 +256,7 @@ function network_query_get_sel_tab(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
return [$no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active];
|
||||
return [$no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active];
|
||||
}
|
||||
|
||||
function network_query_get_sel_group(App $a)
|
||||
|
@ -928,7 +920,7 @@ function network_tabs(App $a)
|
|||
// item filter tabs
|
||||
/// @TODO fix this logic, reduce duplication
|
||||
/// $a->page['content'] .= '<div class="tabs-wrapper">';
|
||||
list($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active) = network_query_get_sel_tab($a);
|
||||
list($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active) = network_query_get_sel_tab($a);
|
||||
|
||||
// if no tabs are selected, defaults to comments
|
||||
if ($no_active == 'active') {
|
||||
|
@ -1004,7 +996,7 @@ function network_tabs(App $a)
|
|||
// save selected tab, but only if not in file mode
|
||||
if (!x($_GET, 'file')) {
|
||||
PConfig::set(local_user(), 'network.view', 'tab.selected', [
|
||||
$all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active
|
||||
$all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -442,7 +442,7 @@ function ping_get_notifications($uid)
|
|||
|
||||
do {
|
||||
$r = q(
|
||||
"SELECT `notify`.*, `item`.`visible`, `item`.`spam`, `item`.`deleted`
|
||||
"SELECT `notify`.*, `item`.`visible`, `item`.`deleted`
|
||||
FROM `notify` LEFT JOIN `item` ON `item`.`id` = `notify`.`iid`
|
||||
WHERE `notify`.`uid` = %d AND `notify`.`msg` != ''
|
||||
AND NOT (`notify`.`type` IN (%d, %d))
|
||||
|
@ -469,10 +469,6 @@ function ping_get_notifications($uid)
|
|||
$notification["visible"] = true;
|
||||
}
|
||||
|
||||
if (is_null($notification["spam"])) {
|
||||
$notification["spam"] = 0;
|
||||
}
|
||||
|
||||
if (is_null($notification["deleted"])) {
|
||||
$notification["deleted"] = 0;
|
||||
}
|
||||
|
@ -495,7 +491,6 @@ function ping_get_notifications($uid)
|
|||
$notification["href"] = System::baseUrl() . "/notify/view/" . $notification["id"];
|
||||
|
||||
if ($notification["visible"]
|
||||
&& !$notification["spam"]
|
||||
&& !$notification["deleted"]
|
||||
&& !(x($result, $notification["parent"]) && is_array($result[$notification["parent"]]))
|
||||
) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue