Skip to content
This repository was archived by the owner on May 17, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added .DS_Store
Binary file not shown.
Binary file added public_html/.DS_Store
Binary file not shown.
17 changes: 17 additions & 0 deletions public_html/anchor.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

class Anchor {
var $name;
var $page;
var $x;
var $y;

function __construct($name, $page, $x, $y) {
$this->name = $name;
$this->page = $page;
$this->x = $x;
$this->y = $y;
}
}

?>
36 changes: 18 additions & 18 deletions public_html/autofix.url.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<?php

class AutofixUrl {
function AutofixUrl() {
function __construct() {
}

function apply($url) {
$parts = @parse_url($url);
if ($parts === FALSE) {
return null;
};

$path = isset($parts['path']) ? $parts['path'] : '/';
}

/*
* Check if path contains only RFC1738 compliant symbols and fix it
Expand All @@ -20,17 +18,17 @@ function apply($url) {
*
* Normally, slash is allowed in path part, and % may be a part of encoded character
*/
$no_graphic_found = preg_match('/[\x00-\x1F\x7F\x80-\xFF]/', $path);
$unsafe_found = preg_match('/[ <>\"#{}\|\^~\[\]`]/', $path);
$unsafe_percent_found = preg_match('/%[^\dA-F]|%\d[^\dA-F]/i', $path);
$reserved_found = preg_match('/;\?:@=&/', $path);
$no_graphic_found = preg_match('/[\x00-\x1F\x7F\x80-\xFF]/', $parts['path']);
$unsafe_found = preg_match('/[ <>\"#{}\|\^~\[\]`]/', $parts['path']);
$unsafe_percent_found = preg_match('/%[^\dA-F]|%\d[^\dA-F]/i', $parts['path']);
$reserved_found = preg_match('/;\?:@=&/', $parts['path']);

if ($no_graphic_found ||
$unsafe_found ||
$unsafe_percent_found ||
$reserved_found) {
$path = join('/', array_map('rawurlencode', explode('/',$path)));
};
$parts['path'] = join('/', array_map('rawurlencode', explode('/',$parts['path'])));
}

// Build updated URL
$url_fixed = '';
Expand All @@ -44,31 +42,33 @@ function apply($url) {
if (isset($parts['pass'])) {
$url_fixed .= ':';
$url_fixed .= $parts['pass'];
};
}
$url_fixed .= '@';
};
}

if (isset($parts['host'])) {
$url_fixed .= $parts['host'];
};
}

if (isset($parts['port'])) {
$url_fixed .= ':';
$url_fixed .= $parts['port'];
};
};
}
}

$url_fixed .= $path;
if (isset($parts['path'])) {
$url_fixed .= $parts['path'];
}

if (isset($parts['query'])) {
$url_fixed .= '?';
$url_fixed .= $parts['query'];
};
}

if (isset($parts['fragment'])) {
$url_fixed .= '#';
$url_fixed .= $parts['fragment'];
};
}

return $url_fixed;
}
Expand Down
91 changes: 37 additions & 54 deletions public_html/background.image.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BackgroundImage {
* @param string $url URL of the image file (or NULL of no image should be rendered at all)
* @param resource $image image object to be displayed
*/
function BackgroundImage($url, $image) {
function __construct($url, $image) {
$this->_url = $url;
$this->_image = $image;
}
Expand All @@ -43,7 +43,7 @@ function BackgroundImage($url, $image) {
* @return BackgroundImage A copy of current object
*/
function &copy() {
$value =& new BackgroundImage($this->_url, $this->_image);
$value= new BackgroundImage($this->_url, $this->_image);
return $value;
}

Expand Down Expand Up @@ -74,66 +74,49 @@ function is_default() {
* @uses BackgroundPosition
* @uses OutputDriver
*/
function show(&$driver, $box, $repeat, $position, $attachment) {
function show(&$driver, $box, $repeat, $position) {
/**
* If no image should be rendered, just return
* @see BackgroundImage::$_url
*/
if (is_null($this->_url)) {
return;
};
}

if (is_null($this->_image)) {
return;
};

if ($attachment == BACKGROUND_ATTACHMENT_FIXED &&
$box->get_css_property(CSS_DISPLAY) == '-body') {
$media =& $driver->get_media();
$left = $box->get_left_background();
$right = $box->get_right_background();
$top = $driver->offset + mm2pt($media->margins['bottom']) + mm2pt($media->real_height());
$bottom = $driver->offset + mm2pt($media->margins['bottom']);
} else {
$left = $box->get_left_background();
$right = $box->get_right_background();
$top = $box->get_top_background();
$bottom = $box->get_bottom_background();
};
}

/**
* Setup clipping region for padding area. Note that background image is drawn in the padding
* area which in generic case is greater than content area.
*
* @see OutputDriver::clip()
*
* @link http://www.w3.org/TR/CSS21/box.html#box-padding-area CSS 2.1 definition of padding area
*/
$driver->save();

if (!$GLOBALS['g_config']['debugnoclip']) {
/**
* Setup clipping region for padding area. Note that background image is drawn in the padding
* area which in generic case is greater than content area.
*
* @see OutputDriver::clip()
*
* @link http://www.w3.org/TR/CSS21/box.html#box-padding-area CSS 2.1 definition of padding area
*/
$driver->moveto($left, $top);
$driver->lineto($right, $top);
$driver->lineto($right, $bottom);
$driver->lineto($left, $bottom);
$driver->closepath();
$driver->clip();
};
$driver->moveto($box->get_left_background(), $box->get_top_background());
$driver->lineto($box->get_right_background(), $box->get_top_background());
$driver->lineto($box->get_right_background(), $box->get_bottom_background());
$driver->lineto($box->get_left_background(), $box->get_bottom_background());
$driver->closepath();
$driver->clip();

/**
* get real image size in device points
*
* @see pt2pt()
* @see px2pt()
*/
$image_height = px2pt($this->_image->sy());
$image_width = px2pt($this->_image->sx());
$image_height = px2pt(imagesy($this->_image));
$image_width = px2pt(imagesx($this->_image));

/**
* Get dimensions of the rectangle to be filled with the background image
*/
$padding_width = $right - $left;
$padding_height = $top - $bottom;
$padding_width = $box->get_right_background() - $box->get_left_background();
$padding_height = $box->get_top_background() - $box->get_bottom_background();

/**
* Calculate the vertical offset from the top padding edge to the background image top edge using current
Expand All @@ -157,7 +140,7 @@ function show(&$driver, $box, $repeat, $position, $attachment) {
$y_offset = ($padding_height - $image_height) * $position->y / 100;
} else {
$y_offset = $position->y;
};
}

/**
* Output the image (probably tiling it; depends on current value of 'background-repeat') using
Expand All @@ -177,19 +160,19 @@ function show(&$driver, $box, $repeat, $position, $attachment) {
* 'background-repeat: no-repeat' case; no tiling at all
*/
$driver->image($this->_image,
$left + $x_offset,
$top - $image_height - $y_offset,
$box->get_left_background() + $x_offset,
$box->get_top_background() - $image_height - $y_offset,
px2pt(1));
break;
case BR_REPEAT_X:
/**
* 'background-repeat: repeat-x' case; horizontal tiling
*/
$driver->image_rx($this->_image,
$left + $x_offset,
$top - $image_height - $y_offset,
$box->get_left_background() + $x_offset,
$box->get_top_background() - $image_height - $y_offset,
$image_width,
$right,
$box->get_right_background(),
$x_offset,
$y_offset,
px2pt(1));
Expand All @@ -199,10 +182,10 @@ function show(&$driver, $box, $repeat, $position, $attachment) {
* 'background-repeat: repeat-y' case; vertical tiling
*/
$driver->image_ry($this->_image,
$left + $x_offset,
$top - $image_height - $y_offset,
$box->get_left_background() + $x_offset,
$box->get_top_background() - $image_height - $y_offset,
$image_height,
$bottom,
$box->get_bottom_background(),
$x_offset,
$y_offset,
px2pt(1));
Expand All @@ -212,17 +195,17 @@ function show(&$driver, $box, $repeat, $position, $attachment) {
* 'background-repeat: repeat' case; full tiling
*/
$driver->image_rx_ry($this->_image,
$left + $x_offset,
$top - $image_height + $y_offset,
$box->get_left_background() + $x_offset,
$box->get_top_background() - $image_height + $y_offset,
$image_width,
$image_height,
$right,
$bottom,
$box->get_right_background(),
$box->get_bottom_background(),
$x_offset,
$y_offset,
px2pt(1));
break;
};
}

/**
* Restore the previous clipping area
Expand Down
Loading