Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-12189

Fatal error when clicking on the link Show More smilies

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Duplicate
    • Affects Version/s: 3.1.0-a3
    • Fix Version/s: 3.1.0-b1
    • Component/s: Posting
    • Labels:
      None
    • Environment:
      MySQL(i) 5.5.31-log
      PHP Version 5.5.7

      Description

      As of build 1212 the pagination class introduced. With remove the pagination code in functions.php does not work anymore the Link "More Show smilies"

      http://area52.wintstar.de/phpBB/viewtopic.php?f=8&t=114

      old code in functions.php
      // Pagination functions
      /**

      • Generate a pagination link based on the url and the page information
        *
      • @param string $base_url is url prepended to all links generated within the function
      • If you use page numbers inside your controller route, base_url should contains a placeholder (%d)
      • for the page. Also be sure to specify the pagination path information into the start_name argument
      • @param string $on_page is the page for which we want to generate the link
      • @param string $start_name is the name of the parameter containing the first item of the given page (example: start=20)
      • If you use page numbers inside your controller route, start name should be the string
      • that should be removed for the first page (example: /page/%d)
      • @param int $per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce
      • @return URL for the requested page
        */
        function phpbb_generate_page_link($base_url, $on_page, $start_name, $per_page)
        {

      if (strpos($start_name, '%d') !== false)

      { return ($on_page > 1) ? sprintf($base_url, (int) $on_page) : str_replace($start_name, '', $base_url); }

      else

      { $url_delim = (strpos($base_url, '?') === false) ? '?' : ((strpos($base_url, '?') === strlen($base_url) - 1) ? '' : '&'); return ($on_page > 1) ? $base_url . $url_delim . $start_name . '=' . (($on_page - 1) * $per_page) : $base_url; }

      }

      /**

      • Generate template rendered pagination
      • Allows full control of rendering of pagination with the template
        *
      • @param object $template the template object
      • @param string $base_url is url prepended to all links generated within the function
      • If you use page numbers inside your controller route, base_url should contains a placeholder (%d)
      • for the page. Also be sure to specify the pagination path information into the start_name argument
      • @param string $block_var_name is the name assigned to the pagination data block within the template (example: <!-- BEGIN pagination -->)
      • @param string $start_name is the name of the parameter containing the first item of the given page (example: start=20)
      • If you use page numbers inside your controller route, start name should be the string
      • that should be removed for the first page (example: /page/%d)
      • @param int $num_items the total number of items, posts, etc., used to determine the number of pages to produce
      • @param int $per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce
      • @param int $start_item the item which should be considered currently active, used to determine the page we're on
      • @param bool $reverse_count determines whether we weight display of the list towards the start (false) or end (true) of the list
      • @param bool $ignore_on_page decides whether we enable an active (unlinked) item, used primarily for embedded lists
      • @return null
        */
        function phpbb_generate_template_pagination($template, $base_url, $block_var_name, $start_name, $num_items, $per_page, $start_item = 1, $reverse_count = false, $ignore_on_page = false)
        {
        // Make sure $per_page is a valid value
        $per_page = ($per_page <= 0) ? 1 : $per_page;
        $total_pages = ceil($num_items / $per_page);

      if ($total_pages == 1 || !$num_items)

      { return; }

      $on_page = floor($start_item / $per_page) + 1;

      if ($reverse_count)

      { $start_page = ($total_pages > 5) ? $total_pages - 4 : 1; $end_page = $total_pages; }

      else

      { // What we're doing here is calculating what the "start" and "end" pages should be. We // do this by assuming pagination is "centered" around the currently active page with // the three previous and three next page links displayed. Anything more than that and // we display the ellipsis, likewise anything less. // // $start_page is the page at which we start creating the list. When we have five or less // pages we start at page 1 since there will be no ellipsis displayed. Anymore than that // and we calculate the start based on the active page. This is the min/max calculation. // First (max) would we end up starting on a page less than 1? Next (min) would we end // up starting so close to the end that we'd not display our minimum number of pages. // // $end_page is the last page in the list to display. Like $start_page we use a min/max to // determine this number. Again at most five pages? Then just display them all. More than // five and we first (min) determine whether we'd end up listing more pages than exist. // We then (max) ensure we're displaying the minimum number of pages. $start_page = ($total_pages > 5) ? min(max(1, $on_page - 3), $total_pages - 4) : 1; $end_page = ($total_pages > 5) ? max(min($total_pages, $on_page + 3), 5) : $total_pages; }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                prototech prototech [X] (Inactive)
                Reporter:
                wintstar wintstar [X] (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: