Commit f90cc369 by pupi1985

PHPDoc update in db/messages, db/notices, db/selects and db/users

parent be5ae90b
......@@ -28,12 +28,12 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
/**
* Record a message sent from $fromuserid to $touserid with $content in $format in the database. $public sets whether
* public (on wall) or private. Return the messageid of the row created.
* @param $fromuserid
* @param $touserid
* @param $content
* @param $format
* @param mixed $fromuserid
* @param mixed $touserid
* @param string $content
* @param string $format
* @param bool $public
* @return mixed
* @return string
*/
function qa_db_message_create($fromuserid, $touserid, $content, $format, $public = false)
{
......@@ -48,8 +48,8 @@ function qa_db_message_create($fromuserid, $touserid, $content, $format, $public
/**
* Hide the message with $messageid, in $box (inbox|outbox) from the user.
* @param $messageid
* @param $box
* @param int $messageid
* @param string $box
*/
function qa_db_message_user_hide($messageid, $box)
{
......@@ -64,7 +64,7 @@ function qa_db_message_user_hide($messageid, $box)
/**
* Delete the message with $messageid from the database.
* @param $messageid
* @param int $messageid
* @param bool $public
*/
function qa_db_message_delete($messageid, $public = true)
......@@ -81,7 +81,7 @@ function qa_db_message_delete($messageid, $public = true)
/**
* Recalculate the cached count of wall posts for user $userid in the database
* @param $userid
* @param mixed $userid
*/
function qa_db_user_recount_posts($userid)
{
......
......@@ -27,10 +27,10 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
/**
* Create a notice for $userid with $content in $format and optional $tags (not displayed) and return its noticeid
* @param $userid
* @param $content
* @param mixed $userid
* @param string $content
* @param string $format
* @param $tags
* @param string|null $tags
* @return mixed
*/
function qa_db_usernotice_create($userid, $content, $format = '', $tags = null)
......@@ -46,8 +46,8 @@ function qa_db_usernotice_create($userid, $content, $format = '', $tags = null)
/**
* Delete the notice $notice which belongs to $userid
* @param $userid
* @param $noticeid
* @param mixed $userid
* @param int $noticeid
*/
function qa_db_usernotice_delete($userid, $noticeid)
{
......@@ -60,7 +60,7 @@ function qa_db_usernotice_delete($userid, $noticeid)
/**
* Return an array summarizing the notices to be displayed for $userid, including the tags (not displayed)
* @param $userid
* @param mixed $userid
* @return array
*/
function qa_db_usernotices_list($userid)
......
......@@ -31,6 +31,7 @@ require_once QA_INCLUDE_DIR.'db/maxima.php';
* Return the results of all the SELECT operations specified by the supplied selectspec parameters, while also
* performing all pending selects that have not yet been executed. If only one parameter is supplied, return its
* result, otherwise return an array of results indexed as per the parameters.
* @return mixed
*/
function qa_db_select_with_pending() // any number of parameters read via func_get_args()
{
......@@ -74,8 +75,8 @@ function qa_db_select_with_pending() // any number of parameters read via func_g
/**
* Queue a $selectspec for running later, with $pendingid (used for retrieval)
* @param $pendingid
* @param $selectspec
* @param string $pendingid
* @param array $selectspec
*/
function qa_db_queue_pending_select($pendingid, $selectspec)
{
......@@ -88,9 +89,9 @@ function qa_db_queue_pending_select($pendingid, $selectspec)
/**
* Get the result of the queued SELECT query identified by $pendingid. Run the query if it hasn't run already. If
* $selectspec is supplied, it doesn't matter if this hasn't been queued before - it will be queued and run now.
* @param $pendingid
* @param $selectspec
* @return
* @param string $pendingid
* @param array|null $selectspec
* @return mixed
*/
function qa_db_get_pending_result($pendingid, $selectspec = null)
{
......@@ -113,7 +114,7 @@ function qa_db_get_pending_result($pendingid, $selectspec = null)
/**
* Remove the results of queued SELECT query identified by $pendingid if it has already been run. This means it will
* run again if its results are requested via qa_db_get_pending_result()
* @param $pendingid
* @param string $pendingid
*/
function qa_db_flush_pending_result($pendingid)
{
......@@ -125,16 +126,16 @@ function qa_db_flush_pending_result($pendingid)
/**
* Modify a selectspec to count the number of items. This assumes the original selectspec does not have a LIMIT clause.
* Currently works with message inbox/outbox functions and user-flags function.
* @param $selectSpec
* @return mixed
* @param array $selectspec
* @return array
*/
function qa_db_selectspec_count($selectSpec)
function qa_db_selectspec_count($selectspec)
{
$selectSpec['columns'] = array('count' => 'COUNT(*)');
$selectSpec['single'] = true;
unset($selectSpec['arraykey']);
$selectspec['columns'] = array('count' => 'COUNT(*)');
$selectspec['single'] = true;
unset($selectspec['arraykey']);
return $selectSpec;
return $selectspec;
}
......@@ -143,7 +144,7 @@ function qa_db_selectspec_count($selectSpec)
* If $voteuserid is set, retrieve the vote made by a particular that user on each post.
* If $full is true, get full information on the posts, instead of just information for listing pages.
* If $user is true, get information about the user who wrote the post (or cookie if anonymous).
* @param $voteuserid
* @param mixed|null $voteuserid
* @param bool $full
* @param bool $user
* @return array
......@@ -224,8 +225,8 @@ function qa_db_posts_basic_selectspec($voteuserid = null, $full = false, $user =
* comment) which is related to the main post (question) retrieved. Pass the name of table which will contain the other
* post in $poststable. Set $fromupdated to true to get information about when this other post was edited, rather than
* created. If $full is true, get full information on this other post.
* @param $selectspec
* @param $poststable
* @param array $selectspec
* @param string $poststable
* @param bool $fromupdated
* @param bool $full
*/
......@@ -263,9 +264,9 @@ function qa_db_add_selectspec_opost(&$selectspec, $poststable, $fromupdated = fa
* post (answer or comment) which is related to the main post (question) retrieved. Pass the name of table which will
* contain the other user's details in $userstable and the name of the table which will contain the other user's points
* in $pointstable.
* @param $selectspec
* @param $userstable
* @param $pointstable
* @param array $selectspec
* @param string $userstable
* @param string $pointstable
*/
function qa_db_add_selectspec_ousers(&$selectspec, $userstable, $pointstable)
{
......@@ -285,7 +286,7 @@ function qa_db_add_selectspec_ousers(&$selectspec, $userstable, $pointstable)
/**
* Given $categoryslugs in order of the hierarchiy, return the equivalent value for the backpath column in the categories table
* @param $categoryslugs
* @param array $categoryslugs
* @return string
*/
function qa_db_slugs_to_backpath($categoryslugs)
......@@ -301,8 +302,8 @@ function qa_db_slugs_to_backpath($categoryslugs)
/**
* Return SQL code that represents the constraint of a post being in the category with $categoryslugs, or any of its subcategories
* @param $categoryslugs
* @param $arguments
* @param array $categoryslugs
* @param array $arguments
* @return string
*/
function qa_db_categoryslugs_sql_args($categoryslugs, &$arguments)
......@@ -328,14 +329,14 @@ function qa_db_categoryslugs_sql_args($categoryslugs, &$arguments)
* restricted to $createip (if not null) and the category for $categoryslugs (if not null), with the corresponding vote
* made by $voteuserid (if not null) and including $full content or not. Return $count (if null, a default is used)
* questions starting from offset $start.
* @param $voteuserid
* @param $sort
* @param $start
* @param $categoryslugs
* @param $createip
* @param mixed $voteuserid
* @param string $sort
* @param int $start
* @param array|null $categoryslugs
* @param string|null $createip
* @param bool $specialtype
* @param bool $full
* @param $count
* @param int|null $count
* @return array
*/
function qa_db_qs_selectspec($voteuserid, $sort, $start, $categoryslugs = null, $createip = null, $specialtype = false, $full = false, $count = null)
......@@ -392,13 +393,13 @@ function qa_db_qs_selectspec($voteuserid, $sort, $start, $categoryslugs = null,
* questions are restricted to the category for $categoryslugs (if not null), and will have the corresponding vote made
* by $voteuserid (if not null) and will include $full content or not. Return $count (if null, a default is used)
* questions starting from offset $start.
* @param $voteuserid
* @param $by
* @param $start
* @param $categoryslugs
* @param mixed $voteuserid
* @param string $by
* @param int $start
* @param array|null $categoryslugs
* @param bool $specialtype
* @param bool $full
* @param $count
* @param int|null $count
* @return array
*/
function qa_db_unanswered_qs_selectspec($voteuserid, $by, $start, $categoryslugs = null, $specialtype = false, $full = false, $count = null)
......@@ -443,13 +444,13 @@ function qa_db_unanswered_qs_selectspec($voteuserid, $by, $start, $categoryslugs
* corresponding vote on those questions made by $voteuserid (if not null). Return $count (if null, a default is used)
* questions starting from offset $start. The selectspec will also retrieve some information about the answers
* themselves (including the content if $fullanswers is true), in columns named with the prefix 'o'.
* @param $voteuserid
* @param $start
* @param $categoryslugs
* @param $createip
* @param mixed $voteuserid
* @param int $start
* @param array|null $categoryslugs
* @param string|null $createip
* @param bool $specialtype
* @param bool $fullanswers
* @param $count
* @param int|null $count
* @return array
*/
function qa_db_recent_a_qs_selectspec($voteuserid, $start, $categoryslugs = null, $createip = null, $specialtype = false, $fullanswers = false, $count = null)
......@@ -495,13 +496,13 @@ function qa_db_recent_a_qs_selectspec($voteuserid, $start, $categoryslugs = null
* corresponding vote on those questions made by $voteuserid (if not null). Return $count (if null, a default is used)
* questions starting from offset $start. The selectspec will also retrieve some information about the comments
* themselves (including the content if $fullcomments is true), in columns named with the prefix 'o'.
* @param $voteuserid
* @param $start
* @param $categoryslugs
* @param $createip
* @param mixed $voteuserid
* @param int $start
* @param array|null $categoryslugs
* @param string|null $createip
* @param bool $specialtype
* @param bool $fullcomments
* @param $count
* @param int|null $count
* @return array
*/
function qa_db_recent_c_qs_selectspec($voteuserid, $start, $categoryslugs = null, $createip = null, $specialtype = false, $fullcomments = false, $count = null)
......@@ -549,13 +550,13 @@ function qa_db_recent_c_qs_selectspec($voteuserid, $start, $categoryslugs = null
* corresponding vote on those questions made by $voteuserid (if not null). Return $count (if null, a default is used)
* questions starting from offset $start. The selectspec will also retrieve some information about the edited posts
* themselves (including the content if $fulledited is true), in columns named with the prefix 'o'.
* @param $voteuserid
* @param $start
* @param $categoryslugs
* @param $lastip
* @param mixed $voteuserid
* @param int $start
* @param array|null $categoryslugs
* @param string|null $lastip
* @param bool $onlyvisible
* @param bool $fulledited
* @param $count
* @param int|null $count
* @return array
*/
function qa_db_recent_edit_qs_selectspec($voteuserid, $start, $categoryslugs = null, $lastip = null, $onlyvisible = true, $fulledited = false, $count = null)
......@@ -597,10 +598,10 @@ function qa_db_recent_edit_qs_selectspec($voteuserid, $start, $categoryslugs = n
* on those questions made by $voteuserid (if not null). Return $count (if null, a default is used) questions starting
* from offset $start. The selectspec will also retrieve some information about the flagged posts themselves (including
* the content if $fullflagged is true).
* @param $voteuserid
* @param $start
* @param mixed $voteuserid
* @param int $start
* @param bool $fullflagged
* @param $count
* @param int|null $count
* @return array
*/
function qa_db_flagged_post_qs_selectspec($voteuserid, $start, $fullflagged = false, $count = null)
......@@ -632,8 +633,8 @@ function qa_db_flagged_post_qs_selectspec($voteuserid, $start, $fullflagged = fa
/**
* Return the selectspec to retrieve the posts in $postids, with the corresponding vote on those posts made by
* $voteuserid (if not null). Returns full information if $full is true.
* @param $voteuserid
* @param $postids
* @param mixed $voteuserid
* @param array $postids
* @param bool $full
* @return array
*/
......@@ -650,7 +651,7 @@ function qa_db_posts_selectspec($voteuserid, $postids, $full = false)
/**
* Return the selectspec to retrieve the basetype for the posts in $postids, as an array mapping postid => basetype
* @param $postids
* @param array $postids
* @return array
*/
function qa_db_posts_basetype_selectspec($postids)
......@@ -667,8 +668,8 @@ function qa_db_posts_basetype_selectspec($postids)
/**
* Return the selectspec to retrieve the basetype for the posts in $postids, as an array mapping postid => basetype
* @param $voteuserid
* @param $postids
* @param mixed $voteuserid
* @param array $postids
* @param bool $full
* @return array
*/
......@@ -694,8 +695,8 @@ function qa_db_posts_to_qs_selectspec($voteuserid, $postids, $full = false)
/**
* Return the selectspec to retrieve the full information for $postid, with the corresponding vote made by $voteuserid (if not null)
* @param $voteuserid
* @param $postid
* @param mixed $voteuserid
* @param int $postid
* @return array
*/
function qa_db_full_post_selectspec($voteuserid, $postid)
......@@ -713,8 +714,8 @@ function qa_db_full_post_selectspec($voteuserid, $postid)
/**
* Return the selectspec to retrieve the full information for all posts whose parent is $parentid, with the
* corresponding vote made by $voteuserid (if not null)
* @param $voteuserid
* @param $parentid
* @param mixed $voteuserid
* @param int $parentid
* @return array
*/
function qa_db_full_child_posts_selectspec($voteuserid, $parentid)
......@@ -731,8 +732,8 @@ function qa_db_full_child_posts_selectspec($voteuserid, $parentid)
/**
* Return the selectspec to retrieve the full information for all posts whose parent is an answer which
* has $questionid as its parent, with the corresponding vote made by $voteuserid (if not null)
* @param $voteuserid
* @param $questionid
* @param mixed $voteuserid
* @param int $questionid
* @return array
*/
function qa_db_full_a_child_posts_selectspec($voteuserid, $questionid)
......@@ -749,7 +750,7 @@ function qa_db_full_a_child_posts_selectspec($voteuserid, $questionid)
/**
* Return the selectspec to retrieve the question for the parent of $postid (where $postid is of a follow-on question or comment),
* i.e. the parent of $questionid's parent if $questionid's parent is an answer, otherwise $questionid's parent itself.
* @param $postid
* @param int $postid
* @return array
*/
function qa_db_post_parent_q_selectspec($postid)
......@@ -766,7 +767,7 @@ function qa_db_post_parent_q_selectspec($postid)
/**
* Return the selectspec to retrieve the post (either duplicate question or explanatory note) which has closed $questionid, if any
* @param $questionid
* @param int $questionid
* @return array
*/
function qa_db_post_close_post_selectspec($questionid)
......@@ -783,7 +784,7 @@ function qa_db_post_close_post_selectspec($questionid)
/**
* Return the selectspec to retrieve the posts that have been closed as a duplicate of this question, if any
* @param $questionid int The canonical question.
* @param int $questionid int The canonical question.
* @return array
*/
function qa_db_post_duplicates_selectspec($questionid)
......@@ -798,9 +799,10 @@ function qa_db_post_duplicates_selectspec($questionid)
/**
* Return the selectspec to retrieve the metadata value for $postid with key $title
* @param $postid
* @param $title
* Return the selectspec to retrieve the metadata value for $postid with key $title. If $title is an array then the
* selectspec will return an array of the matched titles.
* @param int $postid
* @param string|array $title
* @return array
*/
function qa_db_post_meta_selectspec($postid, $title)
......@@ -826,9 +828,9 @@ function qa_db_post_meta_selectspec($postid, $title)
* Return the selectspec to retrieve the most closely related questions to $questionid, with the corresponding vote
* made by $voteuserid (if not null). Return $count (if null, a default is used) questions. This works by looking for
* other questions which have title words, tag words or an (exact) category in common.
* @param $voteuserid
* @param $questionid
* @param $count
* @param mixed $voteuserid
* @param int $questionid
* @param int|null $count
* @return array
*/
function qa_db_related_qs_selectspec($voteuserid, $questionid, $count = null)
......@@ -869,15 +871,15 @@ function qa_db_related_qs_selectspec($voteuserid, $questionid, $count = null)
* where the score came from (since a question could get weight from a match in the question itself, and/or weight from
* a match in its answers, comments, or comments on answers). The 'matchparts' is a comma-separated list of tuples
* matchtype:matchpostid:matchscore to be used with qa_search_set_max_match().
* @param $voteuserid
* @param $titlewords
* @param $contentwords
* @param $tagwords
* @param $handlewords
* @param $handle
* @param $start
* @param mixed $voteuserid
* @param string $titlewords
* @param string $contentwords
* @param array $tagwords
* @param string $handlewords
* @param string $handle
* @param int $start
* @param bool $full
* @param $count
* @param int|null $count
* @return array
*/
function qa_db_search_posts_selectspec($voteuserid, $titlewords, $contentwords, $tagwords, $handlewords, $handle, $start, $full = false, $count = null)
......@@ -985,10 +987,9 @@ function qa_db_search_posts_selectspec($voteuserid, $titlewords, $contentwords,
/**
* Processes the matchparts column in $question which was returned from a search performed via qa_db_search_posts_selectspec()
* Returns the id of the strongest matching answer or comment, or null if the question itself was the strongest match
* @param $question
* @param $type
* @param $postid
* @return null
* @param array $question
* @param string $type
* @param int $postid
*/
function qa_search_set_max_match($question, &$type, &$postid)
{
......@@ -1006,16 +1007,14 @@ function qa_search_set_max_match($question, &$type, &$postid)
}
}
}
return null;
}
/**
* Return a selectspec to retrieve the full information on the category whose id is $slugsorid (if $isid is true),
* otherwise whose backpath matches $slugsorid
* @param $slugsorid
* @param $isid
* @param int|array $slugsorid
* @param bool $isid
* @return array
*/
function qa_db_full_category_selectspec($slugsorid, $isid)
......@@ -1042,8 +1041,8 @@ function qa_db_full_category_selectspec($slugsorid, $isid)
* top level, any ancestors (at any level) of the category, the category's siblings and sub-categories (to one level).
* The central category is specified as follows. If $isid AND $ispostid then $slugsorid is the ID of a post with the category.
* Otherwise if $isid then $slugsorid is the category's own id. Otherwise $slugsorid is the full backpath of the category.
* @param $slugsorid
* @param $isid
* @param int|array $slugsorid
* @param bool $isid
* @param bool $ispostid
* @param bool $full
* @return array
......@@ -1106,7 +1105,7 @@ function qa_db_category_nav_selectspec($slugsorid, $isid, $ispostid = false, $fu
/**
* Return the selectspec to retrieve information on all subcategories of $categoryid (used for Ajax navigation of hierarchy)
* @param $categoryid
* @param int $categoryid
* @return array
*/
function qa_db_category_sub_selectspec($categoryid)
......@@ -1123,7 +1122,7 @@ function qa_db_category_sub_selectspec($categoryid)
/**
* Return the selectspec to retrieve a single category as specified by its $slugs (in order of hierarchy)
* @param $slugs
* @param array $slugs
* @return array
*/
function qa_db_slugs_to_category_id_selectspec($slugs)
......@@ -1140,8 +1139,8 @@ function qa_db_slugs_to_category_id_selectspec($slugs)
/**
* Return the selectspec to retrieve the list of custom pages or links, ordered for display
* @param $onlynavin
* @param $onlypageids
* @param array $onlynavin
* @param array $onlypageids
* @return array
*/
function qa_db_pages_selectspec($onlynavin = null, $onlypageids = null)
......@@ -1169,6 +1168,7 @@ function qa_db_pages_selectspec($onlynavin = null, $onlypageids = null)
/**
* Return the selectspec to retrieve the list of widgets, ordered for display
* @return array
*/
function qa_db_widgets_selectspec()
{
......@@ -1182,8 +1182,8 @@ function qa_db_widgets_selectspec()
/**
* Return the selectspec to retrieve the full information about a custom page
* @param $slugorpageid
* @param $ispageid
* @param int|array $slugorpageid
* @param bool $ispageid
* @return array
*/
function qa_db_page_full_selectspec($slugorpageid, $ispageid)
......@@ -1201,11 +1201,11 @@ function qa_db_page_full_selectspec($slugorpageid, $ispageid)
* Return the selectspec to retrieve the most recent questions with $tag, with the corresponding vote on those
* questions made by $voteuserid (if not null) and including $full content or not. Return $count (if null, a default is
* used) questions starting from $start.
* @param $voteuserid
* @param $tag
* @param $start
* @param mixed $voteuserid
* @param string $tag
* @param int $start
* @param bool $full
* @param $count
* @param int|null $count
* @return array
*/
function qa_db_tag_recent_qs_selectspec($voteuserid, $tag, $start, $full = false, $count = null)
......@@ -1227,7 +1227,7 @@ function qa_db_tag_recent_qs_selectspec($voteuserid, $tag, $start, $full = false
/**
* Return the selectspec to retrieve the number of questions tagged with $tag (single value)
* @param $tag
* @param string $tag
* @return array
*/
function qa_db_tag_word_selectspec($tag)
......@@ -1246,9 +1246,9 @@ function qa_db_tag_word_selectspec($tag)
* handle if we're using internal user management, or a userid if we're using external users. Also include the
* corresponding vote on those questions made by $voteuserid (if not null). Return $count (if null, a default is used)
* questions.
* @param $voteuserid
* @param $identifier
* @param $count
* @param mixed $voteuserid
* @param mixed $identifier
* @param int|null $count
* @param int $start
* @return array
*/
......@@ -1271,9 +1271,9 @@ function qa_db_user_recent_qs_selectspec($voteuserid, $identifier, $count = null
* (see qa_db_user_recent_qs_selectspec() comment), with the corresponding vote on those questions made by $voteuserid
* (if not null). Return $count (if null, a default is used) questions. The selectspec will also retrieve some
* information about the answers themselves, in columns named with the prefix 'o'.
* @param $voteuserid
* @param $identifier
* @param $count
* @param mixed $voteuserid
* @param mixed $identifier
* @param int|null $count
* @param int $start
* @return array
*/
......@@ -1307,9 +1307,9 @@ function qa_db_user_recent_a_qs_selectspec($voteuserid, $identifier, $count = nu
* (see qa_db_user_recent_qs_selectspec() comment), with the corresponding vote on those questions made by $voteuserid
* (if not null). Return $count (if null, a default is used) questions. The selectspec will also retrieve some
* information about the comments themselves, in columns named with the prefix 'o'.
* @param $voteuserid
* @param $identifier
* @param $count
* @param mixed $voteuserid
* @param mixed $identifier
* @param int $count
* @return array
*/
function qa_db_user_recent_c_qs_selectspec($voteuserid, $identifier, $count = null)
......@@ -1340,9 +1340,9 @@ function qa_db_user_recent_c_qs_selectspec($voteuserid, $identifier, $count = nu
* $identifier (see qa_db_user_recent_qs_selectspec() comment), with the corresponding vote on those questions made by
* $voteuserid (if not null). Return $count (if null, a default is used) questions. The selectspec will also retrieve
* some information about the edited posts themselves, in columns named with the prefix 'o'.
* @param $voteuserid
* @param $identifier
* @param $count
* @param mixed $voteuserid
* @param mixed $identifier
* @param int $count
* @return array
*/
function qa_db_user_recent_edit_qs_selectspec($voteuserid, $identifier, $count = null)
......@@ -1372,8 +1372,8 @@ function qa_db_user_recent_edit_qs_selectspec($voteuserid, $identifier, $count =
/**
* Return the selectspec to retrieve the most popular tags. Return $count (if null, a default is used) tags, starting
* from offset $start. The selectspec will produce a sorted array with tags in the key, and counts in the values.
* @param $start
* @param $count
* @param int $start
* @param int $count
* @return array
*/
function qa_db_popular_tags_selectspec($start, $count = null)
......@@ -1408,8 +1408,8 @@ function qa_db_userfields_selectspec()
/**
* Return the selecspec to retrieve a single array with details of the account of the user identified by
* $useridhandle, which should be a userid if $isuserid is true, otherwise $useridhandle should be a handle.
* @param $useridhandle
* @param $isuserid
* @param mixed $useridhandle
* @param bool $isuserid
* @return array
*/
function qa_db_user_account_selectspec($useridhandle, $isuserid)
......@@ -1433,8 +1433,8 @@ function qa_db_user_account_selectspec($useridhandle, $isuserid)
/**
* Return the selectspec to retrieve all user profile information of the user identified by
* $useridhandle (see qa_db_user_account_selectspec() comment), as an array of [field] => [value]
* @param $useridhandle
* @param $isuserid
* @param mixed $useridhandle
* @param bool $isuserid
* @return array
*/
function qa_db_user_profile_selectspec($useridhandle, $isuserid)
......@@ -1451,7 +1451,7 @@ function qa_db_user_profile_selectspec($useridhandle, $isuserid)
/**
* Return the selectspec to retrieve all notices for the user $userid
* @param $userid
* @param mixed $userid
* @return array
*/
function qa_db_user_notices_selectspec($userid)
......@@ -1468,7 +1468,7 @@ function qa_db_user_notices_selectspec($userid)
/**
* Return the selectspec to retrieve all columns from the userpoints table for the user identified by $identifier
* (see qa_db_user_recent_qs_selectspec() comment), as a single array
* @param $identifier
* @param mixed $identifier
* @param bool $isuserid
* @return array
*/
......@@ -1486,7 +1486,7 @@ function qa_db_user_points_selectspec($identifier, $isuserid = QA_FINAL_EXTERNAL
/**
* Return the selectspec to calculate the rank in points of the user identified by $identifier
* (see qa_db_user_recent_qs_selectspec() comment), as a single value
* @param $identifier
* @param mixed $identifier
* @param bool $isuserid
* @return array
*/
......@@ -1505,8 +1505,8 @@ function qa_db_user_rank_selectspec($identifier, $isuserid = QA_FINAL_EXTERNAL_U
/**
* Return the selectspec to get the top scoring users, with handles if we're using internal user management. Return
* $count (if null, a default is used) users starting from the offset $start.
* @param $start
* @param $count
* @param int $start
* @param int|null $count
* @return array
*/
function qa_db_top_users_selectspec($start, $count = null)
......@@ -1544,8 +1544,8 @@ function qa_db_top_users_selectspec($start, $count = null)
/**
* Return the selectspec to get the newest users. Return $count (if null, a default is used) users starting from the
* offset $start. This query must not be run when using external users
* @param $start
* @param $count
* @param int $start
* @param int|null $count
* @return array
*/
function qa_db_newest_users_selectspec($start, $count = null)
......@@ -1564,7 +1564,7 @@ function qa_db_newest_users_selectspec($start, $count = null)
/**
* Return the selectspec to get information about users at a certain privilege level or higher
* @param $level
* @param int $level
* @return array
*/
function qa_db_users_from_level_selectspec($level)
......@@ -1580,9 +1580,9 @@ function qa_db_users_from_level_selectspec($level)
/**
* Return the selectspec to get information about users with the $flag bit set (unindexed query)
* @param $flag
* @param int $flag
* @param int $start
* @param $limit
* @param int|null $limit
* @return array
*/
function qa_db_users_with_flag_selectspec($flag, $start = 0, $limit = null)
......@@ -1606,6 +1606,7 @@ function qa_db_users_with_flag_selectspec($flag, $start = 0, $limit = null)
/**
* Return columns for standard messages selectspec
* @return array
*/
function qa_db_messages_columns()
{
......@@ -1631,11 +1632,11 @@ function qa_db_messages_columns()
* the user identified by $fromidentifier+$fromisuserid to the user identified by $toidentifier+$toisuserid (see
* qa_db_user_recent_qs_selectspec() comment). If $fromidentifier is null, then get recent wall posts
* for the user identified by $toidentifier+$toisuserid. Return $count (if null, a default is used) messages.
* @param $fromidentifier
* @param $fromisuserid
* @param $toidentifier
* @param $toisuserid
* @param $count
* @param mixed $fromidentifier
* @param bool $fromisuserid
* @param mixed $toidentifier
* @param bool $toisuserid
* @param int|null $count
* @param int $start
* @return array
*/
......@@ -1669,11 +1670,11 @@ function qa_db_recent_messages_selectspec($fromidentifier, $fromisuserid, $toide
* Get selectspec for messages *to* specified user. $type is either 'public' or 'private'.
* $toidentifier is a handle or userid depending on the value of $toisuserid.
* Returns $limit messages, or all of them if $limit is null (used in qa_db_selectspec_count).
* @param $type
* @param $toidentifier
* @param $toisuserid
* @param string $type
* @param mixed $toidentifier
* @param mixed $toisuserid
* @param int $start
* @param $limit
* @param int|null $limit
* @return array
*/
function qa_db_messages_inbox_selectspec($type, $toidentifier, $toisuserid, $start = 0, $limit = null)
......@@ -1705,11 +1706,11 @@ function qa_db_messages_inbox_selectspec($type, $toidentifier, $toisuserid, $sta
* Get selectspec for messages *from* specified user. $type is either 'public' or 'private'.
* $fromidentifier is a handle or userid depending on the value of $fromisuserid.
* Returns $limit messages, or all of them if $limit is null (used in qa_db_selectspec_count).
* @param $type
* @param $fromidentifier
* @param $fromisuserid
* @param string $type
* @param mixed $fromidentifier
* @param bool $fromisuserid
* @param int $start
* @param $limit
* @param int|null $limit
* @return array
*/
function qa_db_messages_outbox_selectspec($type, $fromidentifier, $fromisuserid, $start = 0, $limit = null)
......@@ -1740,9 +1741,9 @@ function qa_db_messages_outbox_selectspec($type, $fromidentifier, $fromisuserid,
/**
* Return the selectspec to retrieve whether or not $userid has favorited entity $entitytype identifier by $identifier.
* The $identifier should be a handle, word, backpath or postid for users, tags, categories and questions respectively.
* @param $userid
* @param $entitytype
* @param $identifier
* @param mixed $userid
* @param string $entitytype
* @param mixed $identifier
* @return array
*/
function qa_db_is_favorite_selectspec($userid, $entitytype, $identifier)
......@@ -1784,8 +1785,8 @@ function qa_db_is_favorite_selectspec($userid, $entitytype, $identifier)
/**
* Return the selectspec to retrieve an array of $userid's favorited questions, with the usual information.
* Returns $limit questions, or all of them if $limit is null (used in qa_db_selectspec_count).
* @param $userid
* @param $limit
* @param mixed $userid
* @param int|null $limit
* @param int $start
* @return array
*/
......@@ -1815,8 +1816,8 @@ function qa_db_user_favorite_qs_selectspec($userid, $limit = null, $start = 0)
/**
* Return the selectspec to retrieve an array of $userid's favorited users, with information about those users' accounts.
* Returns $limit users, or all of them if $limit is null (used in qa_db_selectspec_count).
* @param $userid
* @param $limit
* @param mixed $userid
* @param int|null $limit
* @param int $start
* @return array
*/
......@@ -1846,8 +1847,8 @@ function qa_db_user_favorite_users_selectspec($userid, $limit = null, $start = 0
/**
* Return the selectspec to retrieve an array of $userid's favorited tags, with information about those tags.
* Returns $limit tags, or all of them if $limit is null (used in qa_db_selectspec_count).
* @param $userid
* @param $limit
* @param mixed $userid
* @param int|null $limit
* @param int $start
* @return array
*/
......@@ -1876,7 +1877,7 @@ function qa_db_user_favorite_tags_selectspec($userid, $limit = null, $start = 0)
/**
* Return the selectspec to retrieve an array of $userid's favorited categories, with information about those categories.
* @param $userid
* @param mixed $userid
* @return array
*/
function qa_db_user_favorite_categories_selectspec($userid)
......@@ -1895,7 +1896,7 @@ function qa_db_user_favorite_categories_selectspec($userid)
/**
* Return the selectspec to retrieve information about all a user's favorited items except the questions. Depending on
* the type of item, the array for each item will contain a userid, category backpath or tag word.
* @param $userid
* @param mixed $userid
* @return array
*/
function qa_db_user_favorite_non_qs_selectspec($userid)
......@@ -1915,7 +1916,7 @@ function qa_db_user_favorite_non_qs_selectspec($userid)
* include updates on the user's favorites and $forcontent to whether it should include responses to user's content.
* This combines events from both the user's stream and the the shared stream for any entities which the user has
* favorited and which no longer post to user streams (see long comment in /qa-include/db/favorites.php).
* @param $userid
* @param mixed $userid
* @param bool $forfavorites
* @param bool $forcontent
* @return array
......@@ -1970,7 +1971,7 @@ function qa_db_user_updates_selectspec($userid, $forfavorites = true, $forconten
/**
* Return the selectspec to retrieve all of the per-hour activity limits for user $userid
* @param $userid
* @param mixed $userid
* @return array
*/
function qa_db_user_limits_selectspec($userid)
......@@ -1986,7 +1987,7 @@ function qa_db_user_limits_selectspec($userid)
/**
* Return the selectspec to retrieve all of the per-hour activity limits for ip address $ip
* @param $ip
* @param string $ip
* @return array
*/
function qa_db_ip_limits_selectspec($ip)
......@@ -2004,7 +2005,7 @@ function qa_db_ip_limits_selectspec($ip)
* Return the selectspec to retrieve all of the context specific (currently per-categpry) levels for the user identified by
* $identifier, which is treated as a userid if $isuserid is true, otherwise as a handle. Set $full to true to obtain extra
* information about these contexts (currently, categories).
* @param $identifier
* @param mixed $identifier
* @param bool $isuserid
* @param bool $full
* @return array
......
......@@ -27,9 +27,9 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
/**
* Return the expected value for the passcheck column given the $password and password $salt
* @param $password
* @param $salt
* @return mixed|string
* @param string $password
* @param string $salt
* @return string
*/
function qa_db_calc_passcheck($password, $salt)
{
......@@ -41,12 +41,12 @@ function qa_db_calc_passcheck($password, $salt)
/**
* Create a new user in the database with $email, $password, $handle, privilege $level, and $ip address
* @param $email
* @param $password
* @param $handle
* @param $level
* @param $ip
* @return mixed
* @param string $email
* @param string|null $password
* @param string $handle
* @param int $level
* @param string $ip
* @return string
*/
function qa_db_user_create($email, $password, $handle, $level, $ip)
{
......@@ -77,7 +77,7 @@ function qa_db_user_create($email, $password, $handle, $level, $ip)
/**
* Delete user $userid from the database, along with everything they have ever done (to the extent that it's possible)
* @param $userid
* @param mixed $userid
*/
function qa_db_user_delete($userid)
{
......@@ -101,7 +101,7 @@ function qa_db_user_delete($userid)
/**
* Return the ids of all users in the database which match $email (should be one or none)
* @param $email
* @param string $email
* @return array
*/
function qa_db_user_find_by_email($email)
......@@ -115,7 +115,7 @@ function qa_db_user_find_by_email($email)
/**
* Return the ids of all users in the database which match $handle (=username), should be one or none
* @param $handle
* @param string $handle
* @return array
*/
function qa_db_user_find_by_handle($handle)
......@@ -129,12 +129,12 @@ function qa_db_user_find_by_handle($handle)
/**
* Return an array mapping each userid in $userids that can be found to that user's handle
* @param $userids
* @param array $userids
* @return array
*/
function qa_db_user_get_userid_handles($userids)
{
if (count($userids)) {
if (!empty($userids)) {
return qa_db_read_all_assoc(qa_db_query_sub(
'SELECT userid, handle FROM ^users WHERE userid IN (#)',
$userids
......@@ -147,12 +147,12 @@ function qa_db_user_get_userid_handles($userids)
/**
* Return an array mapping mapping each handle in $handle that can be found to that user's userid
* @param $handles
* @param array $handles
* @return array
*/
function qa_db_user_get_handle_userids($handles)
{
if (count($handles)) {
if (!empty($handles)) {
return qa_db_read_all_assoc(qa_db_query_sub(
'SELECT handle, userid FROM ^users WHERE handle IN ($)',
$handles
......@@ -193,8 +193,8 @@ function qa_db_user_set($userid, $fields, $value = null)
/**
* Set the password of $userid to $password, and reset their salt at the same time
* @param $userid
* @param $password
* @param mixed $userid
* @param string $password
* @return mixed
*/
function qa_db_user_set_password($userid, $password)
......@@ -221,9 +221,9 @@ function qa_db_user_set_password($userid, $password)
/**
* Switch on the $flag bit of the flags column for $userid if $set is true, or switch off otherwise
* @param $userid
* @param $flag
* @param $set
* @param mixed $userid
* @param int $flag
* @param bool $set
*/
function qa_db_user_set_flag($userid, $flag, $set)
{
......@@ -236,6 +236,7 @@ function qa_db_user_set_flag($userid, $flag, $set)
/**
* Return a random string to be used for a user's emailcode column
* @return string
*/
function qa_db_user_rand_emailcode()
{
......@@ -249,6 +250,7 @@ function qa_db_user_rand_emailcode()
/**
* Return a random string to be used for a user's sessioncode column (for browser session cookies)
* @return string
*/
function qa_db_user_rand_sessioncode()
{
......@@ -262,9 +264,9 @@ function qa_db_user_rand_sessioncode()
/**
* Set a row in the database user profile table to store $value for $field for $userid
* @param $userid
* @param $field
* @param $value
* @param mixed $userid
* @param string $field
* @param string $value
*/
function qa_db_user_profile_set($userid, $field, $value)
{
......@@ -278,8 +280,8 @@ function qa_db_user_profile_set($userid, $field, $value)
/**
* Note in the database that $userid just logged in from $ip address
* @param $userid
* @param $ip
* @param mixed $userid
* @param string $ip
*/
function qa_db_user_logged_in($userid, $ip)
{
......@@ -292,8 +294,8 @@ function qa_db_user_logged_in($userid, $ip)
/**
* Note in the database that $userid just performed a write operation from $ip address
* @param $userid
* @param $ip
* @param mixed $userid
* @param string $ip
*/
function qa_db_user_written($userid, $ip)
{
......@@ -306,9 +308,9 @@ function qa_db_user_written($userid, $ip)
/**
* Add an external login in the database for $source and $identifier for user $userid
* @param $userid
* @param $source
* @param $identifier
* @param mixed $userid
* @param string $source
* @param string $identifier
*/
function qa_db_user_login_add($userid, $source, $identifier)
{
......@@ -322,8 +324,8 @@ function qa_db_user_login_add($userid, $source, $identifier)
/**
* Return some information about the user with external login $source and $identifier in the database, if a match is found
* @param $source
* @param $identifier
* @param string $source
* @param string $identifier
* @return array
*/
function qa_db_user_login_find($source, $identifier)
......@@ -338,7 +340,7 @@ function qa_db_user_login_find($source, $identifier)
/**
* Lock all tables if $sync is true, otherwise unlock them. Used to synchronize creation of external login mappings.
* @param $sync
* @param bool $sync
*/
function qa_db_user_login_sync($sync)
{
......@@ -360,8 +362,8 @@ function qa_db_user_login_sync($sync)
/**
* Reset the full set of context-specific (currently, per category) user levels for user $userid to $userlevels, where
* $userlevels is an array of arrays, the inner arrays containing items 'entitytype', 'entityid' and 'level'.
* @param $userid
* @param $userlevels
* @param mixed $userid
* @param array $userlevels
*/
function qa_db_user_levels_set($userid, $userlevels)
{
......@@ -382,8 +384,8 @@ function qa_db_user_levels_set($userid, $userlevels)
/**
* Get the information required for sending a mailing to the next $count users with userids greater than $lastuserid
* @param $lastuserid
* @param $count
* @param mixed $lastuserid
* @param int $count
* @return array
*/
function qa_db_users_get_mailing_next($lastuserid, $count)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment