]> git.mxchange.org Git - friendica.git/blobdiff - mod/network.php
Better content detection for posts to Twitter
[friendica.git] / mod / network.php
index 9d68b3314609795662569da65e8b5ab887801d06..a78500174ea1d31f07981f81887e0fa2d84d0bb2 100644 (file)
@@ -290,7 +290,14 @@ function network_query_get_sel_group(App $a) {
        return $group;
 }
 
-function networkSetPager($a, $update) {
+/**
+ * @brief Sets the pager data and returns SQL
+ *
+ * @param App $a The global App
+ * @param integer $update Used for the automatic reloading
+ * @return string SQL with the appropriate LIMIT clause
+ */
+function networkPager($a, $update) {
        if ($update) {
                // only setup pagination on initial page view
                return ' LIMIT 100';
@@ -318,6 +325,11 @@ function networkSetPager($a, $update) {
        return sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
 }
 
+/**
+ * @brief Sets items as seen
+ *
+ * @param array $condition The array with the SQL condition
+ */
 function networkSetSeen($condition) {
        if (empty($condition)) {
                return;
@@ -330,6 +342,15 @@ function networkSetSeen($condition) {
        }
 }
 
+/**
+ * @brief Create the conversation HTML
+ *
+ * @param App $a The global App
+ * @param array $items Items of the conversation
+ * @param string $mode Display mode for the conversation
+ * @param integer $update Used for the automatic reloading
+ * @return string HTML of the conversation
+ */
 function networkConversation($a, $items, $mode, $update) {
        // Set this so that the conversation function can find out contact info for our wall-wall items
        $a->page_contact = $a->contact;
@@ -442,7 +463,7 @@ function networkFlatView(App $a, $update = 0) {
                $sql_post_table = " INNER JOIN `thread` ON `thread`.`iid` = `item`.`parent`";
        }
 
-       $pager_sql = networkSetPager($a, $update);
+       $pager_sql = networkPager($a, $update);
 
        // show all items unthreaded in reverse created date order
        $items = q("SELECT %s FROM `item` $sql_post_table %s
@@ -696,8 +717,6 @@ function networkThreadedView(App $a, $update = 0) {
                $sql_extra3 .= " AND $sql_table.`mention`";
        }
 
-       $pager_sql = networkSetPager($a, $update);
-
        // Normal conversation view
        if ($order === 'post') {
                $ordering = "`created`";
@@ -719,6 +738,8 @@ function networkThreadedView(App $a, $update = 0) {
                $sql_extra3 .= sprintf(" AND $sql_order <= '%s'", dbesc($_GET["offset"]));
        }
 
+       $pager_sql = networkPager($a, $update);
+
        switch ($order_mode) {
                case 'received':
                        if ($last_received != '') {