Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
28b53c8c
Commit
28b53c8c
authored
Aug 28, 2014
by
Scott Vivian
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pupi1985-patch-22' into dev
parents
350ccf51
0e2c1029
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
30 deletions
+32
-30
qa-app-format.php
qa-include/qa-app-format.php
+32
-30
No files found.
qa-include/qa-app-format.php
View file @
28b53c8c
...
...
@@ -922,46 +922,48 @@
{
if
(
qa_to_override
(
__FUNCTION__
))
{
$args
=
func_get_args
();
return
qa_call_override
(
__FUNCTION__
,
$args
);
}
require_once
QA_INCLUDE_DIR
.
'qa-util-sort.php'
;
require_once
QA_INCLUDE_DIR
.
'qa-util-sort.php'
;
foreach
(
$questions
as
$key
=>
$question
)
{
// collect information about action referenced by each $question
if
(
isset
(
$question
[
'opostid'
]))
{
$questions
[
$key
][
'_time'
]
=
$question
[
'otime'
];
$questions
[
$key
][
'_type'
]
=
$question
[
'obasetype'
];
$questions
[
$key
][
'_userid'
]
=
@
$question
[
'ouserid'
];
$questions
[
$key
][
'_time'
]
=
$question
[
'otime'
];
$questions
[
$key
][
'_type'
]
=
$question
[
'obasetype'
];
$questions
[
$key
][
'_userid'
]
=
@
$question
[
'ouserid'
];
}
else
{
$questions
[
$key
][
'_time'
]
=
$question
[
'created'
];
$questions
[
$key
][
'_type'
]
=
'Q'
;
$questions
[
$key
][
'_userid'
]
=
$question
[
'userid'
];
$questions
[
$key
][
'_time'
]
=
$question
[
'created'
];
$questions
[
$key
][
'_type'
]
=
'Q'
;
$questions
[
$key
][
'_userid'
]
=
$question
[
'userid'
];
}
$questions
[
$key
][
'sort'
]
=
-
$questions
[
$key
][
'_time'
];
$questions
[
$key
][
'sort'
]
=
-
$questions
[
$key
][
'_time'
];
}
qa_sort_by
(
$questions
,
'sort'
);
$keepquestions
=
array
();
// now remove duplicate references to same question
$keepquestions
=
array
();
// now remove duplicate references to same question
foreach
(
$questions
as
$question
)
{
// going in order from most recent to oldest
$laterquestion
=@
$keepquestions
[
$question
[
'postid'
]];
if
(
(
!
isset
(
$laterquestion
))
// keep this reference if there is no more recent one
||
// or ...
(
(
@
$laterquestion
[
'oupdatetype'
])
&&
// the more recent reference was an edit
(
!@
$question
[
'oupdatetype'
])
&&
// this is not an edit
(
$laterquestion
[
'_type'
]
==
$question
[
'_type'
])
&&
// the same part (Q/A/C) is referenced here
(
$laterquestion
[
'_userid'
]
==
$question
[
'_userid'
])
&&
// the same user made the later edit
(
abs
(
$laterquestion
[
'_time'
]
-
$question
[
'_time'
])
<
300
)
// the edit was within 5 minutes of creation
)
||
// or ...
(
(
@
$question
[
'opersonal'
])
&&
// this question (in an update list) is personal to the user
(
!@
$laterquestion
[
'opersonal'
])
&&
// the other one was not personal
(
abs
(
$laterquestion
[
'_time'
]
-
$question
[
'_time'
])
<
300
)
// the two events were within 5 minutes of each other
)
)
$keepquestions
[
$question
[
'postid'
]]
=
$question
;
$laterquestion
=
@
$keepquestions
[
$question
[
'postid'
]];
if
(
isset
(
$laterquestion
))
{
if
(
(
abs
(
$laterquestion
[
'_time'
]
-
$question
[
'_time'
])
<
300
)
// the two events were within 5 minutes of each other
&&
(
(
@
$laterquestion
[
'oupdatetype'
])
&&
// the more recent reference was an edit
(
!@
$question
[
'oupdatetype'
])
&&
// this is not an edit
(
$laterquestion
[
'_type'
]
==
$question
[
'_type'
])
&&
// the same part (Q/A/C) is referenced here
(
$laterquestion
[
'_userid'
]
==
$question
[
'_userid'
])
// the same user made the later edit
)
||
// or ...
(
(
@
$question
[
'opersonal'
])
&&
// this question (in an update list) is personal to the user
(
!@
$laterquestion
[
'opersonal'
])
// the other one was not personal
)
)
{
unset
(
$keepquestions
[
$question
[
'postid'
]]);
// Remove any previous instance of the post to force a new position
$keepquestions
[
$question
[
'postid'
]]
=
$question
;
}
}
else
// keep this reference if there is no more recent one
$keepquestions
[
$question
[
'postid'
]]
=
$question
;
}
return
$keepquestions
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment