~ubuntu-branches/debian/squeeze/movabletype-opensource/squeeze

« back to all changes in this revision

Viewing changes to php/lib/function.mtpreviouslink.php

  • Committer: Bazaar Package Importer
  • Author(s): Dominic Hargreaves
  • Date: 2008-06-13 23:28:40 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080613232840-ya4jfxv1jgl45a3d
Tags: 4.2~rc2-1
* New upstream release candidate
* Update Standards-Version (no changes)
* Ensure that schema upgrade message is always seen

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
# Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd.
 
3
# This program is distributed under the terms of the
 
4
# GNU General Public License, version 2.
 
5
#
 
6
# $Id: function.mtpreviouslink.php 2103 2008-04-25 11:36:53Z fumiakiy $
 
7
 
 
8
function smarty_function_mtpreviouslink($args, &$ctx) {
 
9
    $limit = $ctx->stash('__pager_limit');
 
10
    $offset = $ctx->stash('__pager_offset');
 
11
 
 
12
    if ( $offset <= $limit )
 
13
        $offset = 0;
 
14
    else
 
15
        $offset -= $limit;
 
16
 
 
17
    if ( strpos($link, '?') ) {
 
18
        $link .= '&';
 
19
    }
 
20
    else {
 
21
        $link .= '?';
 
22
    }
 
23
 
 
24
    $link .= "limit=$limit";
 
25
    if ( $offset )
 
26
        $link .= "&offset=$offset";
 
27
    return $link;
 
28
}
 
29
?>
 
30