コード例 #1
0
/**
 * Checks to see if the current URL matches the correct one, redirects to the
 * corrected URL if not with a 301 Moved Permanently.
 */
function fix_path_redirect()
{
    $sfx = im_suffix();
    $request_uri = urldecode($_SERVER['REQUEST_URI']);
    $i = strpos($request_uri, '?');
    if ($i !== false) {
        $params = substr($request_uri, $i + 1);
        $request_uri = substr($request_uri, 0, $i);
    } else {
        $params = '';
    }
    if (getOption('mod_rewrite') && strlen($sfx) > 0 && in_context(ZP_IMAGE) && substr($request_uri, -strlen($sfx)) != $sfx) {
        $redirecturl = zpurl(true, NULL, NULL, NULL, $params);
        header("HTTP/1.0 301 Moved Permanently");
        header('Location: ' . FULLWEBPATH . '/' . $redirecturl);
        exit;
    }
}
コード例 #2
0
 /**
  * Returns an image page link for the image
  *
  * @return string
  */
 function getImageLink()
 {
     return rewrite_path('/' . pathurlencode($this->album->name) . '/' . urlencode($this->filename) . im_suffix(), '/index.php?album=' . urlencode($this->album->name) . '&image=' . urlencode($this->filename));
 }
コード例 #3
0
/**
* Returns the url of the last image in current album.
*
* @return string
*/
function getLastImageURL()
{
    global $_zp_current_album;
    if (is_null($_zp_current_album)) {
        return false;
    }
    $lastimg = $_zp_current_album->getImage($_zp_current_album->getNumImages() - 1);
    return rewrite_path("/" . pathurlencode($_zp_current_album->name) . "/" . urlencode($lastimg->filename) . im_suffix(), "/index.php?album=" . urlencode($_zp_current_album->name) . "&image=" . urlencode($lastimg->filename));
}