diff --git a/artichow/AntiSpam.class.php b/artichow/AntiSpam.class.php deleted file mode 100644 index fe5ad7e..0000000 --- a/artichow/AntiSpam.class.php +++ /dev/null @@ -1,224 +0,0 @@ -string = (string)$string; - - } - - /** - * Create a random string - * - * @param int $length String length - * @return string String created - */ - public function setRand($length) { - - $length = (int)$length; - - $this->string = ''; - - $letters = 'aAbBCDeEFgGhHJKLmMnNpPqQRsStTuVwWXYZz2345679'; - $number = strlen($letters); - - for($i = 0; $i < $length; $i++) { - $this->string .= $letters{mt_rand(0, $number - 1)}; - } - - return $this->string; - - } - - /** - * Set noise on image - * - * @param int $nois Noise intensity (from 0 to 10) - */ - public function setNoise($noise) { - if($noise < 0) { - $noise = 0; - } - if($noise > 10) { - $noise = 10; - } - $this->noise = (int)$noise; - } - - /** - * Save string value in session - * You can use check() to verify the value later - * - * @param string $qName A name that identify the anti-spam image - */ - public function save($qName) { - $this->session(); - $session = 'artichow_'.(string)$qName; - $_SESSION[$session] = $this->string; - } - - /** - * Verify user entry - * - * @param string $qName A name that identify the anti-spam image - * @param string $value User-defined value - * @param bool $case TRUE for case insensitive check, FALSE for case sensitive check ? (default to TRUE) - * @return bool TRUE if the value is correct, FALSE otherwise - */ - public function check($qName, $value, $case = TRUE) { - - $this->session(); - - $session = 'artichow_'.(string)$qName; - - return ( - array_key_exists($session, $_SESSION) === TRUE and - $case ? - (strtolower($_SESSION[$session]) === strtolower((string)$value)) : - ($_SESSION[$session] === (string)$value) - ); - - } - - /** - * Draw image - */ - public function draw() { - - $fonts = array( - 'Tuffy', - 'TuffyBold', - 'TuffyItalic', - 'TuffyBoldItalic' - ); - - $sizes = array(12, 12.5, 13, 13.5, 14, 15, 16, 17, 18, 19); - - $widths = array(); - $heights = array(); - $texts = array(); - - // Set up a temporary driver to allow font size calculations... - $this->setSize(10, 10); - $driver = $this->getDriver(); - - for($i = 0; $i < strlen($this->string); $i++) { - - $fontKey = array_rand($fonts); - $sizeKey = array_rand($sizes); - - $font = new awTTFFont( - $fonts[$fontKey], $sizes[$sizeKey] - ); - - $text = new awText( - $this->string{$i}, - $font, - NULL, - mt_rand(-15, 15) - ); - - $widths[] = $driver->getTextWidth($text); - $heights[] = $driver->getTextHeight($text); - $texts[] = $text; - - } - - // ... and get rid of it. - $this->driver = NULL; - - $width = array_sum($widths); - $height = array_max($heights); - - $totalWidth = $width + 10 + count($texts) * 10; - $totalHeight = $height + 20; - - $this->setSize($totalWidth, $totalHeight); - - $this->create(); - - for($i = 0; $i < strlen($this->string); $i++) { - - $this->driver->string( - $texts[$i], - new awPoint( - 5 + array_sum(array_slice($widths, 0, $i)) + $widths[$i] / 2 + $i * 10, - 10 + ($height - $heights[$i]) / 2 - ) - ); - - } - - $this->drawNoise($totalWidth, $totalHeight); - - $this->send(); - - } - - protected function drawNoise($width, $height) { - - $points = $this->noise * 30; - $color = new awColor(0, 0, 0); - - for($i = 0; $i < $points; $i++) { - $this->driver->point( - $color, - new awPoint( - mt_rand(0, $width), - mt_rand(0, $height) - ) - ); - } - - } - - protected function session() { - - // Start session if needed - if(!session_id()) { - session_start(); - } - - } - -} - -registerClass('AntiSpam'); -?> diff --git a/artichow/Artichow.cfg.php b/artichow/Artichow.cfg.php deleted file mode 100644 index 9009d68..0000000 --- a/artichow/Artichow.cfg.php +++ /dev/null @@ -1,85 +0,0 @@ - \ No newline at end of file diff --git a/artichow/BarPlot.class.php b/artichow/BarPlot.class.php deleted file mode 100644 index e8faf79..0000000 --- a/artichow/BarPlot.class.php +++ /dev/null @@ -1,364 +0,0 @@ -label = new awLabel; - - $this->barPadding = new awSide(0.08, 0.08, 0, 0); - $this->barShadow = new awShadow(awShadow::RIGHT_TOP); - $this->barBorder = new awBorder; - - $this->setValues($values); - - $this->identifier = (int)$identifier; - $this->number = (int)$number; - $this->depth = (int)$depth; - - $this->move = new awSide; - - // Hide vertical grid - $this->grid->hideVertical(TRUE); - - } - - /** - * Change bars padding - * This method is not compatible with awBarPlot::setBarPadding() - * - * @param float $left Left padding (between 0 and 1) - * @param float $right Right padding (between 0 and 1) - */ - public function setBarPadding($left = NULL, $right = NULL) { - $this->barPadding->set($left, $right); - } - - /** - * Change bars size - * This method is not compatible with awBarPlot::setBarPadding() - * - * @param int $width Bars size (between 0 and 1) - */ - public function setBarSize($size) { - $padding = (1 - $size) / 2; - $this->barPadding->set($padding, $padding); - } - - /** - * Move bars - * - * @param int $x - * @param int $y - */ - public function move($x, $y) { - $this->move->set($x, NULL, $y, NULL); - } - - /** - * Change bars space - * - * @param int $space Space in pixels - */ - public function setBarSpace($space) { - $this->barSpace = (int)$space; - } - - /** - * Change line background color - * - * @param awColor $color - */ - public function setBarColor(awColor $color) { - $this->barBackground = $color; - } - - /** - * Change line background gradient - * - * @param awGradient $gradient - */ - public function setBarGradient(awGradient $gradient) { - $this->barBackground = $gradient; - } - - /** - * Get the line thickness - * - * @return int - */ - public function getLegendLineThickness() { - } - - /** - * Get the line type - * - * @return int - */ - public function getLegendLineStyle() { - } - - /** - * Get the color of line - * - * @return Color - */ - public function getLegendLineColor() { - } - - /** - * Get the background color or gradient of an element of the component - * - * @return Color, Gradient - */ - public function getLegendBackground() { - return $this->barBackground; - } - - /** - * Get a mark object - * - * @return Mark - */ - public function getLegendMark() { - } - - public function drawComponent(awDriver $driver, $x1, $y1, $x2, $y2, $aliasing) { - - $count = count($this->datay); - $max = $this->getRealYMax(NULL); - $min = $this->getRealYMin(NULL); - - // Find zero for bars - if($this->xAxisZero and $min <= 0 and $max >= 0) { - $zero = 0; - } else if($max < 0) { - $zero = $max; - } else { - $zero = $min; - } - - // Get base position - $zero = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint(0, $zero)); - - // Distance between two values on the graph - $distance = $this->xAxis->getDistance(0, 1); - - // Compute paddings - $leftPadding = $this->barPadding->left * $distance; - $rightPadding = $this->barPadding->right * $distance; - - $padding = $leftPadding + $rightPadding; - $space = $this->barSpace * ($this->number - 1); - - $barSize = ($distance - $padding - $space) / $this->number; - $barPosition = $leftPadding + $barSize * ($this->identifier - 1); - - for($key = 0; $key < $count; $key++) { - - $value = $this->datay[$key]; - - if($value !== NULL) { - - $position = awAxis::toPosition( - $this->xAxis, - $this->yAxis, - new awPoint($key, $value) - ); - - $barStart = $barPosition + ($this->identifier - 1) * $this->barSpace + $position->x; - $barStop = $barStart + $barSize; - - $t1 = min($zero->y, $position->y); - $t2 = max($zero->y, $position->y); - - if(round($t2 - $t1) == 0) { - continue; - } - - $p1 = new awPoint( - round($barStart) + $this->depth + $this->move->left, - round($t1) - $this->depth + $this->move->top - ); - - $p2 = new awPoint( - round($barStop) + $this->depth + $this->move->left, - round($t2) - $this->depth + $this->move->top - ); - - $this->drawBar($driver, $p1, $p2); - - } - - } - - // Draw labels - foreach($this->datay as $key => $value) { - - if($value !== NULL) { - - $position = awAxis::toPosition( - $this->xAxis, - $this->yAxis, - new awPoint($key, $value) - ); - - $point = new awPoint( - $barPosition + ($this->identifier - 1) * $this->barSpace + $position->x + $barSize / 2 + 1 + $this->depth, - $position->y - $this->depth - ); - - $this->label->draw($driver, $point, $key); - - } - - } - - } - - public function getXAxisNumber() { - return count($this->datay) + 1; - } - // ça bidouille à fond ici ! - public function getXMax() { - return array_max($this->datax) + 1; - } - - public function getXCenter() { - return TRUE; - } - - protected function drawBar(awDriver $driver, awPoint $p1, awPoint $p2) { - - // Draw shadow - $this->barShadow->draw( - $driver, - $p1, - $p2, - awShadow::OUT - ); - - if(abs($p2->y - $p1->y) > 1) { - - $this->barBorder->rectangle( - $driver, - $p1, - $p2 - ); - - if($this->barBackground !== NULL) { - - $size = $this->barBorder->visible() ? 1 : 0; - - $b1 = $p1->move($size, $size); - $b2 = $p2->move(-1 * $size, -1 * $size); - - // Draw background - $driver->filledRectangle( - $this->barBackground, - new awLine($b1, $b2) - ); - - } - - } - } - -} - -registerClass('BarPlot'); -?> diff --git a/artichow/ChangeLog b/artichow/ChangeLog deleted file mode 100644 index 7b36981..0000000 --- a/artichow/ChangeLog +++ /dev/null @@ -1,170 +0,0 @@ -Artichow 1.1 - -- All new driver-based architecture: Artichow now draws the graphs using drivers, located in 'inc/drivers/'. The move will ease development of new drawing formats (SVG, Flash, etc.) while keeping backward compatibility very high: you shouldn't have to change anything to your existing code and only two methods from the Font class have disappeared (see below) (Laurent) -- Added Image::setDriver() to allow driver selection (Laurent) -- Changed the Drawer class name to Driver. The class is now abstract, the implementation has to be made in the driver file itself. (Laurent) -- Added the GDDriver class to draw with GD: the file is 'inc/drivers/gd.class.php' (Laurent) -- Modified GDDriver::rectangle() so that it doesn't tamper with the Line object passed as an argument any more (Laurent) -- Fixed a bug where calling GDDriver::polygon() wouldn't close the polygon being drawn when using a non-solid border (Laurent) -- Added the constant ARTICHOW_DRIVER to define the default driver to use when none is selected (defaults to 'gd') (Laurent) -- Changed and reorganised the Font related classes: added FileFont and PHPFont, reworked inheritance (Laurent) -- Deleted Font::getTextWidth() and Font::getTextHeight(), replaced by Driver::getTextWidth() and Driver::getTextHeight() (Laurent) -- Added two new helping classes for Font manipulation, PHPFontDriver and FileFontDriver (Laurent) -- Fixed a bug that prevented values passed to Grid::setGrid() to have any effect (Laurent) -- Added four new types of Mark (Mark::INVERTED_TRIANGLE, Mark::RHOMBUS, Mark::CROSS, Mark::PLUS) (Geoffrey) -- Updated Image::drawError() so that it doesn't display HTML tags any more (Laurent) -- Modified Lable::setCallbackFunction() so that it now accepts static method callbacks (i.e. setCallbackFunction(array($this, 'methodName'))) (Vincent) -- Code cleanup and tweaking - -Artichow 1.0.9 - -- Fixed a bug in Font class (second argument of wordwrap() can not be empty) (Vincent) -- Fixed a bug in Drawer class (text size was not handled correctly) (Vincent) -- Added support for using font paths containing space character when using GD <= 2.0.18 (bug#12) (Vincent) -- Fixed a bug where the HTTP headers were sent even though the draw() method was called with Graph::DRAW_RETURN or a filename (Laurent) -- Added support for antialiased pies on non-white background (only work with plain colors) (thanks to Eldwin) (Laurent) -- Anti-aliasing is now handled by the Drawer class (Laurent) -- Added method Drawer::setAntiAliasing() to turn anti-aliasing on or off (Laurent) -- Fixed a bug where a LinePlot with multiple lines of different thickness wouldn't have its anti-aliasing setting correctly handled (Laurent) -- Fixed a bug where the X axis wouldn't be labelled properly (bug#16) (Laurent) -- Added a new type of Mark (Mark::TRIANGLE) (Laurent) -- Fixed a bug where calling Axis::setYMax() wouldn't have any effect when drawing the axis (Vincent) -- Fixed a bug where a dashed line wouldn't been drawn properly in certain circumstances (Laurent) -- Fixed a bug where using Label::setFormat() or Label::setCallbackFunction() would be overriden by Axis::setLabelPrecision() (Laurent) -- Fixed a "division by zero" error when using a gradient fill on a LinePlot with zeroed values (bug#19) (Laurent) -- General code cleanup - -Artichow 1.0.8 - -- Enhanced error support -- Added multi-line text support -- Updated and improved documentation -- Changed Graph::draw() method to accept more options -- Deleted first parameter of Image::send() method -- Added a third parameter to Image::send() method to disable auto-sending of Content-Type header -- Added a second parameter to Image::send() method to return an image instead of outputing it -- Fixed a fatal error on direct access to files Image.class.php and inc/* -- Fixed a bug in configuration file (bad constant definition check for ARTICHOW_CACHE_DIRECTORY) - -Artichow 1.0.7 - -- Added constant ARTICHOW_CACHE_DIRECTORY to choose cache directory -- Fixed a division by zero bug in Axis class -- Improved cache handling -- Fixed a bug with ob_* handlers -- Fixed a bug for lines thickness -- Shadow color now works fine - -Artichow 1.0.6 - -- Added method Plot::setYAxisZero() -- Added auto-scaling for plots -- Added constant ARTICHOW_CACHE to enable/disable the cache -- Improved prefix for classes - -Artichow 1.0.5 - -- Added constant ARTICHOW_PREFIX to prefix Artichow's classes (bug #000002) -- Added methods Shadow::hide() and Shadow::show() -- Added method Plot::reduce() -- It is now possible to save its charts in a file -- Fixed a bug in PlotGroup (setYMin() / setYMax() did not work) -- Fixed an incoherent behaviour if some values in $datay are not numeric (LinePlot, BarPlot, ScatterPlot) -- Fixed an inclusion bug in Pattern -- Fixed a bug for PHP 5.1.0 - -Artichow 1.0.4 - -- Added support for GIF images -- Added patterns (Pattern.class.php) -- Added titles on axis -- Renamed Artichow.class.php to Graph.class.php (break backward compatibility) -- Added a README file -- Added support for ScatterPlot -- Merged setBackgroundColor() and setBackgroundGradient() into setFill() in class Mark (break backward compatibility) -- Added an optional argument $size to Mark::setType() -- Grid background in now default to white in class Plot -- Changed class Polygon to accept NULL values -- Added a new legend type (Legend::MARKONLY) -- Added method Legend::show() -- Added methods Mark::move(), Mark::hide() and Mark::show() -- Added new marks (star, book, ...) -- Added methods Label::setBackground() and Legend::setBackground() -- Added methods Plot::setXMax(), Plot::setXMin(), PlotGroup::setXMax() and PlotGroup::setXMin() -- Added new colors to default theme in Pie -- Removed methods Drawer::setBackground*() -- Tests have been removed from the archive -- Moved methods Component::addLabel() and Component::addAbsLabel() to class Graph -- Modes LinePlot::MIDDLE and LinePlot::BAR have been merged into LinePlot::MIDDLE (break backward compatibility) -- Fixed a bug in Artichow.cfg.php (unable to use some ttf fonts) -- Fixed a bug in Legend (position of marks was sometimes broken) -- Fixed a bug in Pie (pies can now take only a single value) -- Fixed some bugs in Plot / LinePlot -- Fixed a bug in Font::draw() (call to undefined function trigger__error) - -Artichow 1.0.3 (beta) - -- Added EXPERIMENTAL support for PHP 4 -- Changed class BarPlot so it now uses class Border instead of setBorderThickness() and setBorderColor() -- Changed class Legend so it now uses class Border instead of setBorderSize() and setBorderColor() -- Changed class Mark so it now uses class Border instead of setBorderSize() and setBorderColor() -- Changed class Text so it now uses class Border instead of setBorderColor() -- Changed class Label so it now uses class Border instead of setBorderColor() -- Drawer::drawRectangle() and Drawer::drawFilledRectangle() now take a line as second argument -- Added styles to rectangles and polygons -- BarPlot::setBarPadding() takes now values in per-cent instead of pixels -- Merged drawFilledRectangleColor() and drawFilledRectangleGradient() into drawFilledRectangle() in class Drawer -- Merged drawFilledPolygonColor() and drawFilledPolygonGradient() into drawFilledPolygon() in class Drawer -- Merged drawFilledEllipseColor() and drawFilledEllipseGradient() into drawFilledEllipse() in class Drawer -- Added method BarPlot::setBarWidth() -- Added an optional border to the class Image -- Added a new class Border -- Added support for MathPlot -- LinePlot::STEP has been removed -- Merged classes Paragraph and Label (no changes in the API) -- Method Plot::setLabelCenter() is obsolete and has been removed -- Rewrited Axis (add a new class Tick) (break backward compatibility) -- Removed draw*Triangle* from class Drawer (use polygons instead) -- Removed prefix draw in each method of class Drawer -- Renamed LinePlot::setLineType() into LinePlot::setStyle() -- Renamed LinePlot::setLineThickness() into LinePlot::setThickness() -- Renamed LinePlot::setLineColor() into LinePlot::setColor() -- Renamed LinePlot::setLineBackgroundColor() to LinePlot::setFillColor() -- Renamed LinePlot::setLineBackgroundGradient() to LinePlot::setFillGradient() -- Renamed Line::setType() to Line::setStyle() -- Added methods Label::get(), Label::setFormat() and change method Label::setFont() -- Added a parameter $smooth in Shadow::setSize(); -- Added filled areas in LinePlot -- Added lots of new features in Math.class.php -- Fixed a bug in Math::isVertical() and Math::isHorizontal() -- Fixed a bug in Legend (shadow is now well-positioned is there is no border on the legend) -- Lots of minor changes - -Artichow 1.0.2 (beta) - -- Added support for pies (2D & 3D) -- Moved shadow from class Component to class Image -- X Axis are now centered on 0 by default on bar and line plots -- Added title to Graphs -- Added 4 named fonts -- Added 50 named colors -- Added shadow to legends -- Added method Image::setBackgroundGradient() -- Added methods Label::setCallbackFunction() and Label::hide() -- Added method Legend::hide() -- Added methods Drawer::copyResizeImage(), Drawer::drawArc() and Drawer::drawFilledArcColor() -- Renamed Positionable::setHorizontalAlign() and Positionable::setVerticalAlign() to Positionable::setAlign() -- API for ellipses has changed -- Title is now a property instead of a method in Component -- Removed old code, that fixes a bug in the grid -- Fixed a bug that affects position of bars in some cases -- Fixed wrong size of shadow -- Fixed a bug in Plot::setYMin() and Plot::setYMax() - -Artichow 1.0.1 (alpha) - -- Added anti-spam images - -Artichow 1.0.0 (alpha) - -- Initial release diff --git a/artichow/Component.class.php b/artichow/Component.class.php deleted file mode 100644 index 7707167..0000000 --- a/artichow/Component.class.php +++ /dev/null @@ -1,415 +0,0 @@ -components = array(); - } - - /** - * Add a component to the group - * - * @param awComponent $component A component - */ - public function add(awComponent $component) { - $this->components[] = $component; - } - -} - -registerClass('ComponentGroup', TRUE); - -abstract class awComponent { - - /** - * Component driver - * - * @var Driver - */ - protected $driver; - - /** - * Component width - * - * @var float - */ - public $width = 1.0; - - /** - * Component height - * - * @var float - */ - public $height = 1.0; - - /** - * Position X of the center the graph (from 0 to 1) - * - * @var float - */ - public $x = 0.5; - - /** - * Position Y of the center the graph (from 0 to 1) - * - * @var float - */ - public $y = 0.5; - - /** - * Component absolute width (in pixels) - * - * - * @var int - */ - public $w; - - /** - * Component absolute height (in pixels) - * - * - * @var int - */ - public $h; - - /** - * Left-top corner Y position - * - * @var float - */ - public $top; - - /** - * Left-top corner X position - * - * @var float - */ - public $left; - - /** - * Component background color - * - * @var Color - */ - protected $background; - - /** - * Component padding - * - * @var Side - */ - protected $padding; - - /** - * Component space - * - * @var Side - */ - protected $space; - - /** - * Component title - * - * @var Label - */ - public $title; - - /** - * Adjust automatically the component ? - * - * @var bool - */ - protected $auto = TRUE; - - /** - * Legend - * - * @var Legend - */ - public $legend; - - /** - * Build the component - */ - public function __construct() { - - // Component legend - $this->legend = new awLegend(); - - $this->padding = new awSide(25, 25, 25, 25); - $this->space = new awSide(0, 0, 0, 0); - - // Component title - $this->title = new awLabel( - NULL, - new awTuffy(10), - NULL, - 0 - ); - $this->title->setAlign(awLabel::CENTER, awLabel::TOP); - - } - - /** - * Adjust automatically the component ? - * - * @param bool $auto - */ - public function auto($auto) { - $this->auto = (bool)$auto; - } - - /** - * Change the size of the component - * - * @param int $width Component width (from 0 to 1) - * @param int $height Component height (from 0 to 1) - */ - public function setSize($width, $height) { - - $this->width = (float)$width; - $this->height = (float)$height; - - } - - /** - * Change the absolute size of the component - * - * @param int $w Component width (in pixels) - * @param int $h Component height (in pixels) - */ - public function setAbsSize($w, $h) { - - $this->w = (int)$w; - $this->h = (int)$h; - - } - - /** - * Change component background color - * - * @param awColor $color (can be null) - */ - public function setBackgroundColor($color) { - if($color === NULL or $color instanceof awColor) { - $this->background = $color; - } - } - - /** - * Change component background gradient - * - * @param awGradient $gradient (can be null) - */ - public function setBackgroundGradient($gradient) { - if($gradient === NULL or $gradient instanceof awGradient) { - $this->background = $gradient; - } - } - - /** - * Change component background image - * - * @param awImage $image (can be null) - */ - public function setBackgroundImage($image) { - if($image === NULL or $image instanceof awImage) { - $this->background = $image; - } - } - - /** - * Return the component background - * - * @return Color, Gradient - */ - public function getBackground() { - return $this->background; - } - - /** - * Change component padding - * - * @param int $left Padding in pixels (NULL to keep old value) - * @param int $right Padding in pixels (NULL to keep old value) - * @param int $top Padding in pixels (NULL to keep old value) - * @param int $bottom Padding in pixels (NULL to keep old value) - */ - public function setPadding($left = NULL, $right = NULL, $top = NULL, $bottom = NULL) { - $this->padding->set($left, $right, $top, $bottom); - } - - /** - * Change component space - * - * @param float $left Space in % (NULL to keep old value) - * @param float $right Space in % (NULL to keep old value) - * @param float $bottom Space in % (NULL to keep old value) - * @param float $top Space in % (NULL to keep old value) - */ - public function setSpace($left = NULL, $right = NULL, $bottom = NULL, $top = NULL) { - $this->space->set($left, $right, $bottom, $top); - } - - /** - * Change the absolute position of the component on the graph - * - * @var int $x Left-top corner X position - * @var int $y Left-top corner Y position - */ - public function setAbsPosition($left, $top) { - - $this->left = (int)$left; - $this->top = (int)$top; - - } - - /** - * Set the center of the component - * - * @param int $x Position X of the center of the component - * @param int $y Position Y of the center of the component - */ - public function setCenter($x, $y) { - - $this->x = (float)$x; - $this->y = (float)$y; - - } - - /** - * Get component coords with its padding - * - * @return array Coords of the component - */ - public function getPosition() { - - // Get component coords - $x1 = $this->padding->left; - $y1 = $this->padding->top; - $x2 = $this->w - $this->padding->right; - $y2 = $this->h - $this->padding->bottom; - - return array($x1, $y1, $x2, $y2); - - } - - /** - * Init the drawing of the component - */ - public function init(awDriver $driver) { - - // Set component background - $background = $this->getBackground(); - - if($background !== NULL) { - - $p1 = new awPoint(0, 0); - $p2 = new awPoint($this->w - 1, $this->h - 1); - - if($background instanceof awImage) { - - $driver->copyImage( - $background, - $p1, - $p2 - ); - - } else { - - $driver->filledRectangle( - $background, - new awLine($p1, $p2) - ); - - } - - } - } - - /** - * Finalize the drawing of the component - */ - public function finalize(awDriver $driver) { - - // Draw component title - $point = new awPoint( - $this->w / 2, - $this->padding->top - 8 - ); - $this->title->draw($driver, $point); - - // Draw legend - $this->legend->draw($driver); - - } - - /** - * Draw the grid around your component - * - * @param Driver A driver - * @return array Coords for the component - */ - abstract public function drawEnvelope(awDriver $driver); - - /** - * Draw the component on the graph - * Component should be drawed into specified coords - * - * @param Driver A driver - * @param int $x1 - * @param int $y1 - * @param int $x2 - * @param int $y2 - * @param bool $aliasing Use anti-aliasing to draw the component ? - */ - abstract public function drawComponent(awDriver $driver, $x1, $y1, $x2, $y2, $aliasing); - - /** - * Get space width in pixels - * - * @param int $width Component width - * @param int $height Component height - * @return array - */ - protected function getSpace($width, $height) { - - $left = (int)($width * $this->space->left / 100); - $right = (int)($width * $this->space->right / 100); - $top = (int)($height * $this->space->top / 100); - $bottom = (int)($height * $this->space->bottom / 100); - - return array($left, $right, $top, $bottom); - - } - -} - -registerClass('Component', TRUE); -?> diff --git a/artichow/DEPRECATED b/artichow/DEPRECATED deleted file mode 100644 index fa9b157..0000000 --- a/artichow/DEPRECATED +++ /dev/null @@ -1,3 +0,0 @@ -Artichow 1.0.9 - -- Pie::setBorder(): replaced by Pie::setBorderColor() \ No newline at end of file diff --git a/artichow/Graph.class.php b/artichow/Graph.class.php deleted file mode 100644 index c1f2872..0000000 --- a/artichow/Graph.class.php +++ /dev/null @@ -1,412 +0,0 @@ -setSize($width, $height); - - if(ARTICHOW_CACHE) { - - $this->name = $name; - $this->timeout = $timeout; - - // Clean sometimes all the cache - if(mt_rand(0, 5000) === 0) { - awGraph::cleanCache(); - } - - // Take the graph from the cache if possible - if($this->name !== NULL) { - - $this->fileCache = ARTICHOW_CACHE_DIRECTORY."/".$this->name; - $this->fileCacheTime = $this->fileCache."-time"; - - if(is_file($this->fileCache)) { - - $type = awGraph::cleanGraphCache($this->fileCacheTime); - - if($type === NULL) { - awGraph::deleteFromCache($this->name); - } else { - header("Content-Type: image/".$type); - echo file_get_contents($this->fileCache); - exit; - } - - } - - } - - } - - $this->title = new awLabel( - NULL, - new awTuffy(16), - NULL, - 0 - ); - $this->title->setAlign(awLabel::CENTER, awLabel::BOTTOM); - - } - - /** - * Delete a graph from the cache - * - * @param string $name Graph name - * @return bool TRUE on success, FALSE on failure - */ - public static function deleteFromCache($name) { - - if(ARTICHOW_CACHE) { - - if(is_file(ARTICHOW_CACHE_DIRECTORY."/".$name."-time")) { - unlink(ARTICHOW_CACHE_DIRECTORY."/".$name.""); - unlink(ARTICHOW_CACHE_DIRECTORY."/".$name."-time"); - } - - } - - } - - /** - * Delete all graphs from the cache - */ - public static function deleteAllCache() { - - if(ARTICHOW_CACHE) { - - $dp = opendir(ARTICHOW_CACHE_DIRECTORY); - - while($file = readdir($dp)) { - if($file !== '.' and $file != '..') { - unlink(ARTICHOW_CACHE_DIRECTORY."/".$file); - } - } - - } - - } - - /** - * Clean cache - */ - public static function cleanCache() { - - if(ARTICHOW_CACHE) { - - $glob = glob(ARTICHOW_CACHE_DIRECTORY."/*-time"); - - foreach($glob as $file) { - - $type = awGraph::cleanGraphCache($file); - - if($type === NULL) { - $name = ereg_replace(".*/(.*)\-time", "\\1", $file); - awGraph::deleteFromCache($name); - } - - } - - } - - } - - /** - * Enable/Disable Graph timing - * - * @param bool $timing - */ - public function setTiming($timing) { - $this->timing = (bool)$timing; - } - - /** - * Add a component to the graph - * - * @param awComponent $component - */ - public function add(awComponent $component) { - - $this->components[] = $component; - - } - - /** - * Add a label to the component - * - * @param awLabel $label - * @param int $x Position on X axis of the center of the text - * @param int $y Position on Y axis of the center of the text - */ - public function addLabel(awLabel $label, $x, $y) { - - $this->labels[] = array( - $label, $x, $y - ); - - } - - /** - * Add a label to the component with absolute position - * - * @param awLabel $label - * @param awPoint $point Text position - */ - public function addAbsLabel(awLabel $label, awPoint $point) { - - $this->labels[] = array( - $label, $point - ); - - } - - /** - * Build the graph and draw component on it - * - * @param string $mode Display mode (can be a file name) - */ - public function draw($mode = Graph::DRAW_DISPLAY) { - - if($this->timing) { - $time = microtimeFloat(); - } - - $this->create(); - - foreach($this->components as $component) { - - $this->drawComponent($component); - - } - - $this->drawTitle(); - $this->drawShadow(); - $this->drawLabels(); - - if($this->timing) { - $this->drawTiming(microtimeFloat() - $time); - } - - // Create graph - $data = $this->get(); - - // Put the graph in the cache if needed - $this->cache($data); - - switch($mode) { - - case Graph::DRAW_DISPLAY : - $this->sendHeaders(); - echo $data; - break; - - case Graph::DRAW_RETURN : - return $data; - - default : - if(is_string($mode)) { - file_put_contents($mode, $data); - } else { - awImage::drawError("Class Graph: Unable to draw the graph."); - } - - } - - } - - private function drawLabels() { - - $driver = $this->getDriver(); - - foreach($this->labels as $array) { - - if(count($array) === 3) { - - // Text in relative position - list($label, $x, $y) = $array; - - $point = new awPoint( - $x * $this->width, - $y * $this->height - ); - - } else { - - // Text in absolute position - list($label, $point) = $array; - - } - - $label->draw($driver, $point); - - } - - } - - private function drawTitle() { - - $driver = $this->getDriver(); - - $point = new awPoint( - $this->width / 2, - 10 - ); - - $this->title->draw($driver, $point); - - } - - private function drawTiming($time) { - - $driver = $this->getDriver(); - - $label = new awLabel; - $label->set("(".sprintf("%.3f", $time)." s)"); - $label->setAlign(awLabel::LEFT, awLabel::TOP); - $label->border->show(); - $label->setPadding(1, 0, 0, 0); - $label->setBackgroundColor(new awColor(230, 230, 230, 25)); - - $label->draw($driver, new awPoint(5, $driver->imageHeight - 5)); - - } - - private function cache($data) { - if(ARTICHOW_CACHE and $this->name !== NULL) { - - if(is_writable(ARTICHOW_CACHE_DIRECTORY) === FALSE) { - awImage::drawError("Class Graph: Cache directory is not writable."); - } - - file_put_contents($this->fileCache, $data); - file_put_contents($this->fileCacheTime, $this->timeout."\n".$this->getFormatString()); - - } - } - - private static function cleanGraphCache($file) { - - list( - $time, - $type - ) = explode("\n", file_get_contents($file)); - - $time = (int)$time; - - if($time !== 0 and $time < time()) { - return NULL; - } else { - return $type; - } - - - } - -} - -registerClass('Graph'); - -/* - * To preserve PHP 4 compatibility - */ -function microtimeFloat() { - list($usec, $sec) = explode(" ", microtime()); - return (float)$usec + (float)$sec; -} -?> diff --git a/artichow/Image.class.php b/artichow/Image.class.php deleted file mode 100644 index 0549f22..0000000 --- a/artichow/Image.class.php +++ /dev/null @@ -1,606 +0,0 @@ -background = new awColor(255, 255, 255); - $this->shadow = new awShadow(awShadow::RIGHT_BOTTOM); - $this->border = new awBorder; - - } - - /** - * Get driver of the image - * - * @param int $w Driver width (from 0 to 1) (default to 1) - * @param int $h Driver height (from 0 to 1) (default to 1) - * @param float $x Position on X axis of the center of the driver (default to 0.5) - * @param float $y Position on Y axis of the center of the driver (default to 0.5) - * @return Driver - */ - public function getDriver($w = 1, $h = 1, $x = 0.5, $y = 0.5) { - $this->create(); - $this->driver->setSize($w, $h); - $this->driver->setPosition($x, $y); - return $this->driver; - } - - /** - * Sets the driver that will be used to draw the graph - * - * @param string $driverString - */ - public function setDriver($driverString) { - $this->driver = $this->selectDriver($driverString); - - $this->driver->init($this); - } - - /** - * Change the image size - * - * @var int $width Image width - * @var int $height Image height - */ - public function setSize($width, $height) { - - if($width !== NULL) { - $this->width = (int)$width; - } - if($height !== NULL) { - $this->height = (int)$height; - } - - } - - /** - * Change image background - * - * @param mixed $background - */ - public function setBackground($background) { - if($background instanceof awColor) { - $this->setBackgroundColor($background); - } elseif($background instanceof awGradient) { - $this->setBackgroundGradient($background); - } - } - - /** - * Change image background color - * - * @param awColor $color - */ - public function setBackgroundColor(awColor $color) { - $this->background = $color; - } - - /** - * Change image background gradient - * - * @param awGradient $gradient - */ - public function setBackgroundGradient(awGradient $gradient) { - $this->background = $gradient; - } - - /** - * Return image background, whether a Color or a Gradient - * - * @return mixed - */ - public function getBackground() { - return $this->background; - } - - /** - * Turn antialiasing on or off - * - * @var bool $bool - */ - public function setAntiAliasing($bool) { - $this->antiAliasing = (bool)$bool; - } - - /** - * Return the antialiasing setting - * - * @return bool - */ - public function getAntiAliasing() { - return $this->antiAliasing; - } - - /** - * Change image format - * - * @var int $format New image format - */ - public function setFormat($format) { - if($format === awImage::JPEG or $format === awImage::PNG or $format === awImage::GIF) { - $this->format = $format; - } - } - - /** - * Returns the image format as an integer - * - * @return unknown - */ - public function getFormat() { - return $this->format; - } - - /** - * Returns the image format as a string - * - * @return string - */ - public function getFormatString() { - - switch($this->format) { - case awImage::JPEG : - return 'jpeg'; - case awImage::PNG : - return 'png'; - case awImage::GIF : - return 'gif'; - } - - } - - /** - * Create a new awimage - */ - public function create() { - - if($this->driver === NULL) { - $driver = $this->selectDriver($this->driverString); - - $driver->init($this); - - $this->driver = $driver; - } - - } - - /** - * Select the correct driver - * - * @param string $driver The desired driver - * @return mixed - */ - protected function selectDriver($driver) { - $drivers = array('gd'); - $driver = strtolower((string)$driver); - - if(in_array($driver, $drivers, TRUE)) { - $string = $driver; - } else { - $string = ARTICHOW_DRIVER; - } - - switch ($string) { - case 'gd': - require_once ARTICHOW.'/inc/drivers/gd.class.php'; - $this->driverString = $string; - return new awGDDriver(); - - default: - // We should never get here, unless the wrong string is used AND the ARTICHOW_DRIVER - // global has been messed with. - awImage::drawError('Class Image: Unknown driver type (\''.$string.'\')'); - break; - } - } - - /** - * Draw a component on the image - * - * @var awComponent $component A component - */ - public function drawComponent(awComponent $component) { - - $shadow = $this->shadow->getSpace(); // Image shadow - $border = $this->border->visible() ? 1 : 0; // Image border size - - $driver = clone $this->driver; - $driver->setImageSize( - $this->width - $shadow->left - $shadow->right - $border * 2, - $this->height - $shadow->top - $shadow->bottom - $border * 2 - ); - - // No absolute size specified - if($component->w === NULL and $component->h === NULL) { - - list($width, $height) = $driver->setSize($component->width, $component->height); - - // Set component size in pixels - $component->setAbsSize($width, $height); - - } else { - - $driver->setAbsSize($component->w, $component->h); - - } - - if($component->top !== NULL and $component->left !== NULL) { - $driver->setAbsPosition( - $border + $shadow->left + $component->left, - $border + $shadow->top + $component->top - ); - } else { - $driver->setPosition($component->x, $component->y); - } - - $driver->movePosition($border + $shadow->left, $border + $shadow->top); - - list($x1, $y1, $x2, $y2) = $component->getPosition(); - - $component->init($driver); - - $component->drawComponent($driver, $x1, $y1, $x2, $y2, $this->antiAliasing); - $component->drawEnvelope($driver, $x1, $y1, $x2, $y2); - - $component->finalize($driver); - - } - - protected function drawShadow() { - - $driver = $this->getDriver(); - - $this->shadow->draw( - $driver, - new awPoint(0, 0), - new awPoint($this->width, $this->height), - awShadow::IN - ); - - } - - /** - * Send the image into a file or to the user browser - * - */ - public function send() { - $this->driver->send($this); - } - - /** - * Return the image content as binary data - * - */ - public function get() { - return $this->driver->get($this); - } - - /** - * Send the correct HTTP header according to the image type - * - */ - public function sendHeaders() { - - if(headers_sent() === FALSE) { - - switch ($this->driverString) { - case 'gd' : - header('Content-type: image/'.$this->getFormatString()); - break; - - } - - } - - } - - - private static $errorWriting = FALSE; - - - /* - * Display an error image and exit - * - * @param string $message Error message - */ - public static function drawError($message) { - - - if(self::$errorWriting) { - return; - } - - self::$errorWriting = TRUE; - - $message = wordwrap($message, 40, "\n", TRUE); - - $width = 400; - $height = max(100, 40 + 22.5 * (substr_count($message, "\n") + 1)); - - $image = new awImage(); - $image->setSize($width, $height); - $image->setDriver('gd'); - - $driver = $image->getDriver(); - $driver->init($image); - - // Display title - $driver->filledRectangle( - new awWhite, - new awLine( - new awPoint(0, 0), - new awPoint($width, $height) - ) - ); - - $driver->filledRectangle( - new awRed, - new awLine( - new awPoint(0, 0), - new awPoint(110, 25) - ) - ); - - $text = new awText( - "Artichow error", - new awFont3, - new awWhite, - 0 - ); - - $driver->string($text, new awPoint(5, 6)); - - // Display red box - $driver->rectangle( - new awRed, - new awLine( - new awPoint(0, 25), - new awPoint($width - 90, $height - 1) - ) - ); - - // Display error image - $file = ARTICHOW_IMAGE.DIRECTORY_SEPARATOR.'error.png'; - - $imageError = new awFileImage($file); - $driver->copyImage( - $imageError, - new awPoint($width - 81, $height - 81), - new awPoint($width - 1, $height - 1) - ); - - // Draw message - $text = new awText( - strip_tags($message), - new awFont2, - new awBlack, - 0 - ); - - $driver->string($text, new awPoint(10, 40)); - - $image->send(); - - exit; - - } - - /* - * Display an error image located in a file and exit - * - * @param string $error Error name - */ - public static function drawErrorFile($error) { - - $file = ARTICHOW_IMAGE.DIRECTORY_SEPARATOR.'errors'.DIRECTORY_SEPARATOR.$error.'.png'; - - header("Content-Type: image/png"); - readfile($file); - exit; - - } - -} - -registerClass('Image'); - - -/** - * Load an image from a file - * - * @package Artichow - */ -class awFileImage extends awImage { - - /** - * Build a new awimage - * - * @param string $file Image file name - */ - public function __construct($file) { - - $driver = $this->selectDriver($this->driverString); - - $driver->initFromFile($this, $file); - - $this->driver = $driver; - - } - -} - -registerClass('FileImage'); - -?> diff --git a/artichow/LinePlot.class.php b/artichow/LinePlot.class.php deleted file mode 100644 index 81000d7..0000000 --- a/artichow/LinePlot.class.php +++ /dev/null @@ -1,585 +0,0 @@ -mark = new awMark; - $this->label = new awLabel; - - $this->lineMode = (int)$mode; - - $this->setValues($values); - - } - - /** - * Hide line - * - * @param bool $hide - */ - public function hideLine($hide) { - $this->lineHide = (bool)$hide; - } - - /** - * Add a filled area - * - * @param int $start Begining of the area - * @param int $end End of the area - * @param mixed $background Background color or gradient of the area - */ - public function setFilledArea($start, $stop, $background) { - - if($stop <= $start) { - awImage::drawError("Class LinePlot: End position can not be greater than begin position in setFilledArea()."); - } - - $this->areas[] = array((int)$start, (int)$stop, $background); - - } - - /** - * Change line color - * - * @param awColor $color - */ - public function setColor(awColor $color) { - $this->lineColor = $color; - } - - /** - * Change line style - * - * @param int $style - */ - public function setStyle($style) { - $this->lineStyle = (int)$style; - } - - /** - * Change line tickness - * - * @param int $tickness - */ - public function setThickness($tickness) { - $this->lineThickness = (int)$tickness; - } - - /** - * Change line background color - * - * @param awColor $color - */ - public function setFillColor(awColor $color) { - $this->lineBackground = $color; - } - - /** - * Change line background gradient - * - * @param awGradient $gradient - */ - public function setFillGradient(awGradient $gradient) { - $this->lineBackground = $gradient; - } - - /** - * Get the line thickness - * - * @return int - */ - public function getLegendLineThickness() { - return $this->lineThickness; - } - - /** - * Get the line type - * - * @return int - */ - public function getLegendLineStyle() { - return $this->lineStyle; - } - - /** - * Get the color of line - * - * @return Color - */ - public function getLegendLineColor() { - return $this->lineColor; - } - - /** - * Get the background color or gradient of an element of the component - * - * @return Color, Gradient - */ - public function getLegendBackground() { - return $this->lineBackground; - } - - /** - * Get a mark object - * - * @return Mark - */ - public function getLegendMark() { - return $this->mark; - } - - public function drawComponent(awDriver $driver, $x1, $y1, $x2, $y2, $aliasing) { - - $max = $this->getRealYMax(); - $min = $this->getRealYMin(); - - // Get start and stop values - list($start, $stop) = $this->getLimit(); - - if($this->lineMode === awLinePlot::MIDDLE) { - $inc = $this->xAxis->getDistance(0, 1) / 2; - } else { - $inc = 0; - } - - // Build the polygon - $polygon = new awPolygon; - - for($key = $start; $key <= $stop; $key++) { - - $value = $this->datay[$key]; - - if($value !== NULL) { - - $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($key, $value)); - $p = $p->move($inc, 0); - $polygon->set($key, $p); - - } - - } - - // Draw backgrounds - if($this->lineBackground instanceof awColor or $this->lineBackground instanceof awGradient) { - - $backgroundPolygon = new awPolygon; - - $p = $this->xAxisPoint($start); - $p = $p->move($inc, 0); - $backgroundPolygon->append($p); - - // Add others points - foreach($polygon->all() as $point) { - $backgroundPolygon->append(clone $point); - } - - $p = $this->xAxisPoint($stop); - $p = $p->move($inc, 0); - $backgroundPolygon->append($p); - - // Draw polygon background - $driver->filledPolygon($this->lineBackground, $backgroundPolygon); - - } - - $this->drawArea($driver, $polygon); - - // Draw line - $prev = NULL; - - // Line color - if($this->lineHide === FALSE) { - - if($this->lineColor === NULL) { - $this->lineColor = new awColor(0, 0, 0); - } - - foreach($polygon->all() as $point) { - - if($prev !== NULL) { - $driver->line( - $this->lineColor, - new awLine( - $prev, - $point, - $this->lineStyle, - $this->lineThickness - ) - ); - } - $prev = $point; - - } - - } - - // Draw marks and labels - foreach($polygon->all() as $key => $point) { - - $this->mark->draw($driver, $point); - $this->label->draw($driver, $point, $key); - - } - - } - - protected function drawArea(awDriver $driver, awPolygon $polygon) { - - $starts = array(); - foreach($this->areas as $area) { - list($start) = $area; - $starts[$start] = TRUE; - } - - // Draw filled areas - foreach($this->areas as $area) { - - list($start, $stop, $background) = $area; - - $polygonArea = new awPolygon; - - $p = $this->xAxisPoint($start); - $polygonArea->append($p); - - for($i = $start; $i <= $stop; $i++) { - $p = clone $polygon->get($i); - if($i === $stop and array_key_exists($stop, $starts)) { - $p = $p->move(-1, 0); - } - $polygonArea->append($p); - } - - $p = $this->xAxisPoint($stop); - if(array_key_exists($stop, $starts)) { - $p = $p->move(-1, 0); - } - $polygonArea->append($p); - - // Draw area - $driver->filledPolygon($background, $polygonArea); - - } - - } - - public function getXAxisNumber() { - if($this->lineMode === awLinePlot::MIDDLE) { - return count($this->datay) + 1; - } else { - return count($this->datay); - } - } - - protected function xAxisPoint($position) { - $y = $this->xAxisZero ? 0 : $this->getRealYMin(); - return awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($position, $y)); - } - - public function getXCenter() { - return ($this->lineMode === awLinePlot::MIDDLE); - } - -} - -registerClass('LinePlot'); - - -/** - * Simple LinePlot - * Useful to draw simple horizontal lines - * - * @package Artichow - */ -class awSimpleLinePlot extends awPlot implements awLegendable { - - /** - * Line color - * - * @var Color - */ - protected $lineColor; - - /** - * Line start - * - * @var int - */ - protected $lineStart; - - /** - * Line stop - * - * @var int - */ - protected $lineStop; - - /** - * Line value - * - * @var flaot - */ - protected $lineValue; - - /** - * Line mode - * - * @var int - */ - protected $lineMode = awLinePlot::LINE; - - /** - * Line type - * - * @var int - */ - protected $lineStyle = awLine::SOLID; - - /** - * Line thickness - * - * @var int - */ - protected $lineThickness = 1; - - /** - * Line mode - * - * @var int - */ - const LINE = 0; - - /** - * Line in the middle - * - * @var int - */ - const MIDDLE = 1; - - /** - * Construct a new awLinePlot - * - * @param float $value A Y value - * @param int $start Line start index - * @param int $stop Line stop index - * @param int $mode Line mode - */ - public function __construct($value, $start, $stop, $mode = awLinePlot::LINE) { - - parent::__construct(); - - $this->lineMode = (int)$mode; - - $this->lineStart = (int)$start; - $this->lineStop = (int)$stop; - $this->lineValue = (float)$value; - - $this->lineColor = new awColor(0, 0, 0); - - } - - /** - * Change line color - * - * @param awColor $color - */ - public function setColor(awColor $color) { - $this->lineColor = $color; - } - - /** - * Change line style - * - * @param int $style - */ - public function setStyle($style) { - $this->lineStyle = (int)$style; - } - - /** - * Change line tickness - * - * @param int $tickness - */ - public function setThickness($tickness) { - $this->lineThickness = (int)$tickness; - } - - /** - * Get the line thickness - * - * @return int - */ - public function getLegendLineThickness() { - return $this->lineThickness; - } - - /** - * Get the line type - * - * @return int - */ - public function getLegendLineStyle() { - return $this->lineStyle; - } - - /** - * Get the color of line - * - * @return Color - */ - public function getLegendLineColor() { - return $this->lineColor; - } - - public function getLegendBackground() { - return NULL; - } - - public function getLegendMark() { - return NULL; - } - - public function drawComponent(awDriver $driver, $x1, $y1, $x2, $y2, $aliasing) { - - if($this->lineMode === awLinePlot::MIDDLE) { - $inc = $this->xAxis->getDistance(0, 1) / 2; - } else { - $inc = 0; - } - - $p1 = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($this->lineStart, $this->lineValue)); - $p2 = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($this->lineStop, $this->lineValue)); - - $driver->line( - $this->lineColor, - new awLine( - $p1->move($inc, 0), - $p2->move($inc, 0), - $this->lineStyle, - $this->lineThickness - ) - ); -} - - public function getXAxisNumber() { - if($this->lineMode === awLinePlot::MIDDLE) { - return count($this->datay) + 1; - } else { - return count($this->datay); - } - } - - protected function xAxisPoint($position) { - $y = $this->xAxisZero ? 0 : $this->getRealYMin(); - return awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($position, $y)); - } - - public function getXCenter() { - return ($this->lineMode === awLinePlot::MIDDLE); - } - -} - -registerClass('SimpleLinePlot'); -?> diff --git a/artichow/MathPlot.class.php b/artichow/MathPlot.class.php deleted file mode 100644 index 4021784..0000000 --- a/artichow/MathPlot.class.php +++ /dev/null @@ -1,439 +0,0 @@ -f = (string)$f; - $this->fromX = is_null($fromX) ? NULL : (float)$fromX; - $this->toX = is_null($toX) ? NULL : (float)$toX; - - $this->line = new awLine; - $this->mark = new awMark; - $this->color = new awBlack; - - } - - /** - * Change line color - * - * @param awColor $color A new awcolor - */ - public function setColor(awColor $color) { - $this->color = $color; - } - - /** - * Get line color - * - * @return Color - */ - public function getColor() { - return $this->color; - } - - /** - * Get the background color or gradient of an element of the component - * - * @return Color, Gradient - */ - public function getLegendBackground() { - } - - /** - * Get the line thickness - * - * @return NULL - */ - public function getLegendLineThickness() { - return $this->line->getThickness(); - } - - /** - * Get the line type - * - * @return NULL - */ - public function getLegendLineStyle() { - return $this->line->getStyle(); - } - - /** - * Get the color of line - * - * @return NULL - */ - public function getLegendLineColor() { - return $this->color; - } - - /** - * Get a mark object - * - * @return NULL - */ - public function getLegendMark() { - return $this->mark; - } - -} - -registerClass('MathFunction'); - -/** - * For mathematics functions - * - * @package Artichow - */ -class awMathPlot extends awComponent { - - /** - * Functions - * - * @var array - */ - protected $functions = array(); - - /** - * Grid properties - * - * @var Grid - */ - public $grid; - - /** - * X axis - * - * @var Axis - */ - public $xAxis; - - /** - * Y axis - * - * @var Axis - */ - public $yAxis; - - /** - * Extremum - * - * @var Side - */ - private $extremum = NULL; - - /** - * Interval - * - * @var float - */ - private $interval = 1; - - /** - * Build the plot - * - * @param int $xMin Minimum X value - * @param int $xMax Maximum X value - * @param int $yMax Maximum Y value - * @param int $yMin Minimum Y value - */ - public function __construct($xMin, $xMax, $yMax, $yMin) { - - parent::__construct(); - - $this->setPadding(8, 8, 8, 8); - - $this->grid = new awGrid; - - // Hide grid by default - $this->grid->hide(TRUE); - - // Set extremum - $this->extremum = new awSide($xMin, $xMax, $yMax, $yMin); - - // Create axis - $this->xAxis = new awAxis; - $this->xAxis->setTickStyle(awTick::IN); - $this->xAxis->label->hideValue(0); - $this->initAxis($this->xAxis); - - $this->yAxis = new awAxis; - $this->yAxis->setTickStyle(awTick::IN); - $this->yAxis->label->hideValue(0); - $this->initAxis($this->yAxis); - - } - - protected function initAxis(awAxis $axis) { - - $axis->setLabelPrecision(1); - $axis->addTick('major', new awTick(0, 5)); - $axis->addTick('minor', new awTick(0, 3)); - $axis->addTick('micro', new awTick(0, 1)); - $axis->setNumberByTick('minor', 'major', 1); - $axis->setNumberByTick('micro', 'minor', 4); - $axis->label->setFont(new awTuffy(7)); - - } - - /** - * Interval to calculate values - * - * @param float $interval - */ - public function setInterval($interval) { - $this->interval = (float)$interval; - } - - /** - * Add a formula f(x) - * - * @param awMathFunction $function - * @param string $name Name for the legend (can be NULL if you don't want to set a legend) - * @param int $type Type for the legend - */ - public function add(awMathFunction $function, $name = NULL, $type = awLegend::LINE) { - - $this->functions[] = $function; - - if($name !== NULL) { - $this->legend->add($function, $name, $type); - } - - } - - public function init(awDriver $driver) { - - list($x1, $y1, $x2, $y2) = $this->getPosition(); - - $this->xAxis->line->setX($x1, $x2); - $this->xAxis->label->setAlign(NULL, awLabel::BOTTOM); - $this->xAxis->label->move(0, 3); - $this->xAxis->setRange($this->extremum->left, $this->extremum->right); - - $this->yAxis->line->setY($y2, $y1); - $this->yAxis->label->setAlign(awLabel::RIGHT); - $this->yAxis->label->move(-6, 0); - $this->yAxis->reverseTickStyle(); - $this->yAxis->setRange($this->extremum->bottom, $this->extremum->top); - - - $this->xAxis->setYCenter($this->yAxis, 0); - $this->yAxis->setXCenter($this->xAxis, 0); - - if($this->yAxis->getLabelNumber() === NULL) { - $number = $this->extremum->top - $this->extremum->bottom + 1; - $this->yAxis->setLabelNumber($number); - } - - if($this->xAxis->getLabelNumber() === NULL) { - $number = $this->extremum->right - $this->extremum->left + 1; - $this->xAxis->setLabelNumber($number); - } - - // Set ticks - - $this->xAxis->tick('major')->setNumber($this->xAxis->getLabelNumber()); - $this->yAxis->tick('major')->setNumber($this->yAxis->getLabelNumber()); - - - // Set axis labels - $labels = array(); - for($i = 0, $count = $this->xAxis->getLabelNumber(); $i < $count; $i++) { - $labels[] = $i; - } - $this->xAxis->label->set($labels); - - $labels = array(); - for($i = 0, $count = $this->yAxis->getLabelNumber(); $i < $count; $i++) { - $labels[] = $i; - } - $this->yAxis->label->set($labels); - - parent::init($driver); - - // Create the grid - $this->createGrid(); - - // Draw the grid - $this->grid->draw($driver, $x1, $y1, $x2, $y2); - - } - - public function drawEnvelope(awDriver $driver) { - - // Draw axis - $this->xAxis->draw($driver); - $this->yAxis->draw($driver); - - } - - public function drawComponent(awDriver $driver, $x1, $y1, $x2, $y2, $aliasing) { - - foreach($this->functions as $function) { - - $f = $function->f; - $fromX = is_null($function->fromX) ? $this->extremum->left : $function->fromX; - $toX = is_null($function->toX) ? $this->extremum->right : $function->toX; - - $old = NULL; - - for($i = $fromX; $i <= $toX; $i += $this->interval) { - - $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($i, $f($i))); - - if($p->y >= $y1 and $p->y <= $y2) { - $function->mark->draw($driver, $p); - } - - if($old !== NULL) { - - $line = $function->line; - $line->setLocation($old, $p); - - if( - ($line->p1->y >= $y1 and $line->p1->y <= $y2) or - ($line->p2->y >= $y1 and $line->p2->y <= $y2) - ) { - $driver->line( - $function->getColor(), - $line - ); - } - - } - - $old = $p; - - } - - // Draw last point if needed - if($old !== NULL and $i - $this->interval != $toX) { - - $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($toX, $f($toX))); - - if($p->y >= $y1 and $p->y <= $y2) { - $function->mark->draw($driver, $p); - } - - - $line = $function->line; - $line->setLocation($old, $p); - - if( - ($line->p1->y >= $y1 and $line->p1->y <= $y2) or - ($line->p2->y >= $y1 and $line->p2->y <= $y2) - ) { - $driver->line( - $function->getColor(), - $line - ); - } - - } - - } - - } - - protected function createGrid() { - - // Horizontal lines of the grid - - $major = $this->yAxis->tick('major'); - $interval = $major->getInterval(); - $number = $this->yAxis->getLabelNumber() - 1; - - $h = array(); - if($number > 0) { - for($i = 0; $i <= $number; $i++) { - $h[] = $i / $number; - } - } - - // Vertical lines - - $major = $this->xAxis->tick('major'); - $interval = $major->getInterval(); - $number = $this->xAxis->getLabelNumber() - 1; - - $w = array(); - if($number > 0) { - for($i = 0; $i <= $number; $i++) { - if($i%$interval === 0) { - $w[] = $i / $number; - } - } - } - - $this->grid->setGrid($w, $h); - - } - -} - -registerClass('MathPlot'); -?> \ No newline at end of file diff --git a/artichow/Pattern.class.php b/artichow/Pattern.class.php deleted file mode 100644 index 0e0213b..0000000 --- a/artichow/Pattern.class.php +++ /dev/null @@ -1,97 +0,0 @@ -args[$name] = $value; - } - } - - /** - * Get an argument - * - * @param string $name - * @param mixed $default Default value if the argument does not exist (default to NULL) - * @return mixed Argument value - */ - protected function getArg($name, $default = NULL) { - if(array_key_exists($name, $this->args)) { - return $this->args[$name]; - } else { - return $default; - } - } - - /** - * Change several arguments - * - * @param array $args New arguments - */ - public function setArgs($args) { - if(is_array($args)) { - foreach($args as $name => $value) { - $this->setArg($name, $value); - } - } - } - -} - -registerClass('Pattern', TRUE); -?> \ No newline at end of file diff --git a/artichow/Pie.class.php b/artichow/Pie.class.php deleted file mode 100644 index 9d3597d..0000000 --- a/artichow/Pie.class.php +++ /dev/null @@ -1,695 +0,0 @@ -setValues($values); - - if(is_array($colors)) { - $this->colors = $colors; - } else { - - switch($colors) { - - case awPie::AQUA : - $this->colors = array( - new awColor(131, 220, 215), - new awColor(131, 190, 215), - new awColor(131, 160, 215), - new awColor(160, 140, 215), - new awColor(190, 131, 215), - new awColor(220, 131, 215) - ); - break; - - case awPie::EARTH : - $this->colors = array( - new awColor(97, 179, 110), - new awColor(130, 179, 97), - new awColor(168, 179, 97), - new awColor(179, 147, 97), - new awColor(179, 108, 97), - new awColor(99, 107, 189), - new awColor(99, 165, 189) - ); - break; - - case awPie::DARK : - $this->colors = array( - new awColor(140, 100, 170), - new awColor(130, 170, 100), - new awColor(160, 160, 120), - new awColor(150, 110, 140), - new awColor(130, 150, 160), - new awColor(90, 170, 140) - ); - break; - - default : - $this->colors = array( - new awColor(187, 213, 151), - new awColor(223, 177, 151), - new awColor(111, 186, 132), - new awColor(197, 160, 230), - new awColor(165, 169, 63), - new awColor(218, 177, 89), - new awColor(116, 205, 121), - new awColor(200, 201, 78), - new awColor(127, 205, 177), - new awColor(205, 160, 160), - new awColor(190, 190, 190) - ); - break; - - } - - } - - parent::__construct(); - - $this->label = new awLabel; - $this->label->setCallbackFunction('callbackPerCent'); - - } - - /** - * Change legend values - * - * @param array $legend An array of values for each part of the pie - */ - public function setLegend($legend) { - - $this->legendValues = (array)$legend; - - } - - /** - * Set a border all around the pie - * - * @param awColor $color A color for the border - */ - public function setBorderColor(awColor $color) { - $this->border = $color; - } - - /** - * Set a border all around the pie - * - * @param awColor $color A color for the border - */ - public function setBorder(awColor $color) { - if(ARTICHOW_DEPRECATED === TRUE) { - awImage::drawError('Class Pie: Method setBorder() has been deprecated since Artichow 1.0.9. Please use setBorderColor() instead.'); - } else { - $this->setBorderColor($color); - } - } - - /** - * Change 3D effect intensity - * - * @param int $size Effect size - */ - public function set3D($size) { - $this->size = (int)$size; - } - - /** - * Change initial angle - * - * @param int $angle New angle in degrees - */ - public function setStartAngle($angle) { - $this->angle = (int)$angle; - } - - /** - * Change label precision - * - * @param int $precision New precision - */ - public function setLabelPrecision($precision) { - $this->precision = (int)$precision; - } - - /** - * Change label position - * - * @param int $position New position in pixels - */ - public function setLabelPosition($position) { - $this->position = (int)$position; - } - - /** - * Change label number - * - * @param int $number New number - */ - public function setLabelNumber($number) { - $this->number = is_null($number) ? $number : (int)$number; - } - - /** - * Change label minimum - * - * @param int $minimum New minimum - */ - public function setLabelMinimum($minimum) { - $this->minimum = is_null($minimum) ? $minimum : (int)$minimum; - } - - /** - * Change Pie explode - * - * @param array $explode - */ - public function explode($explode) { - $this->explode = (array)$explode; - } - - public function drawEnvelope(awDriver $driver) { - - } - - public function drawComponent(awDriver $driver, $x1, $y1, $x2, $y2, $aliasing) { - - $count = count($this->values); - $sum = array_sum($this->values); - - $width = $x2 - $x1; - $height = $y2 - $y1; - - if($aliasing) { - $x = $width / 2; - $y = $height / 2; - } else { - $x = $width / 2 + $x1; - $y = $height / 2 + $y1; - } - - $position = $this->angle; - $values = array(); - $parts = array(); - $angles = 0; - - if($aliasing) { - $side = new awSide(0, 0, 0, 0); - } - - foreach($this->values as $key => $value) { - - $angle = ($value / $sum * 360); - - if($key === $count - 1) { - $angle = 360 - $angles; - } - - $angles += $angle; - - if(array_key_exists($key, $this->explode)) { - $middle = 360 - ($position + $angle / 2); - $posX = $this->explode[$key] * cos($middle * M_PI / 180); - $posY = $this->explode[$key] * sin($middle * M_PI / 180) * -1; - - if($aliasing) { - $explode = new awPoint( - $posX * 2, - $posY * 2 - ); - $side->set( - max($side->left, $posX * -2), - max($side->right, $posX * 2), - max($side->top, $posY * -2), - max($side->bottom, $posY * 2) - ); - } else { - $explode = new awPoint( - $posX, - $posY - ); - } - - } else { - $explode = new awPoint(0, 0); - } - - $values[$key] = array( - $position, ($position + $angle), $explode - ); - - $color = $this->colors[$key % count($this->colors)]; - $parts[$key] = new awPiePart($color); - - // Add part to the legend - $legend = array_key_exists($key, $this->legendValues) ? $this->legendValues[$key] : $key; - $this->legend->add($parts[$key], $legend, awLegend::BACKGROUND); - - $position += $angle; - - } - - if($aliasing) { - - $mainDriver = $driver; - - $x *= 2; - $y *= 2; - $width *= 2; - $height *= 2; - $this->size *= 2; - - $image = new awImage; - $image->border->hide(); - - // Adds support for antialiased pies on non-white background - $background = $this->getBackground(); - - if($background instanceof awColor) { - $image->setBackgroundColor($background); - } -// elseif($background instanceof awGradient) { -// $image->setBackgroundColor(new White(100)); -// } - - $image->setSize( - $width + $side->left + $side->right, - $height + $side->top + $side->bottom + $this->size + 1 /* bugs.php.net ! */ - ); - - $driver = $image->getDriver( - $width / $image->width, - $height / $image->height, - ($width / 2 + $side->left) / $image->width, - ($height / 2 + $side->top) / $image->height - ); - - } - - // Draw 3D effect - for($i = $this->size; $i > 0; $i--) { - - foreach($values as $key => $value) { - - $color = clone $this->colors[$key % count($this->colors)]; - $color->brightness(-50); - - list($from, $to, $explode) = $value; - - $driver->filledArc($color, $explode->move($x, $y + $i), $width, $height, $from, $to); - - unset($color); - - if($this->border instanceof awColor) { - - $point = $explode->move($x, $y); - - if($i === $this->size) { - - $driver->arc($this->border, $point->move(0, $this->size), $width, $height, $from, $to); - - } - - } - - } - - } - - foreach($values as $key => $value) { - - $color = $this->colors[$key % count($this->colors)]; - - list($from, $to, $explode) = $value; - - $driver->filledArc($color, $explode->move($x, $y), $width, $height, $from, $to); - - if($this->border instanceof awColor) { - - $point = $explode->move($x, $y); - $driver->arc($this->border, $point, $width, $height, $from, $to); - } - - } - - if($aliasing) { - - $x = $x / 2 + $x1; - $y = $y / 2 + $y1; - $width /= 2; - $height /= 2; - $this->size /= 2; - - foreach($values as $key => $value) { - $old = $values[$key][2]; - $values[$key][2] = new awPoint( - $old->x / 2, $old->y / 2 - ); - } - - $mainDriver->copyResizeImage( - $image, - new awPoint($x1 - $side->left / 2, $y1 - $side->top / 2), - new awPoint($x1 - $side->left / 2 + $image->width / 2, $y1 - $side->top / 2 + $image->height/ 2), - new awPoint(0, 0), - new awPoint($image->width, $image->height), - TRUE - ); - - $driver = $mainDriver; - - } - - // Get labels values - $pc = array(); - foreach($this->values as $key => $value) { - $pc[$key] = round($value / $sum * 100, $this->precision); - } - if($this->label->count() === 0) { // Check that there is no user defined values - $this->label->set($pc); - } - - $position = 0; - - foreach($pc as $key => $value) { - - // Limit number of labels to display - if($position === $this->number) { - break; - } - - if(is_null($this->minimum) === FALSE and $value < $this->minimum) { - continue; - } - - $position++; - - list($from, $to, $explode) = $values[$key]; - - $angle = $from + ($to - $from) / 2; - $angleRad = (360 - $angle) * M_PI / 180; - - $point = new awPoint( - $x + $explode->x + cos($angleRad) * ($width / 2 + $this->position), - $y + $explode->y - sin($angleRad) * ($height / 2 + $this->position) - ); - - $angle %= 360; - - // We don't display labels on the 3D effect - if($angle > 0 and $angle < 180) { - $point = $point->move(0, -1 * sin($angleRad) * $this->size); - } - - if($angle >= 45 and $angle < 135) { - $this->label->setAlign(awLabel::CENTER, awLabel::BOTTOM); - } else if($angle >= 135 and $angle < 225) { - $this->label->setAlign(awLabel::RIGHT, awLabel::MIDDLE); - } else if($angle >= 225 and $angle < 315) { - $this->label->setAlign(awLabel::CENTER, awLabel::TOP); - } else { - $this->label->setAlign(awLabel::LEFT, awLabel::MIDDLE); - } - - $this->label->draw( - $driver, - $point, - $key - ); - - } - - } - - /** - * Return margins around the component - * - * @return array Left, right, top and bottom margins - */ - public function getMargin() { - - // Get axis informations - - $leftAxis = $this->padding->left; - $rightAxis = $this->padding->right; - $topAxis = $this->padding->top; - $bottomAxis = $this->padding->bottom; - - return array($leftAxis, $rightAxis, $topAxis, $bottomAxis); - - } - - - /** - * Change values of Y axis - * This method ignores not numeric values - * - * @param array $values - */ - public function setValues($values) { - - $this->checkArray($values); - $this->values = $values; - - } - - - /** - * Return values of Y axis - * - * @return array - */ - public function getValues() { - return $this->values; - } - - private function checkArray(&$array) { - - if(is_array($array) === FALSE) { - awImage::drawError("Class Pie: You tried to set values that are not an array."); - } - - foreach($array as $key => $value) { - if(is_numeric($value) === FALSE) { - unset($array[$key]); - } - } - - if(count($array) < 1) { - awImage::drawError("Class Pie: Your graph must have at least 1 value."); - } - - } - -} - -registerClass('Pie'); - -/** - * Pie - * - * @package Artichow - */ -class awPiePart implements awLegendable { - - /** - * Pie part color - * - * @var Color - */ - protected $color; - - /** - * Build a new awPiePart - * - * @param awColor $color Pie part color - */ - public function __construct(awColor $color) { - - $this->color = $color; - - } - - /** - * Get the background color or gradient of an element of the component - * - * @return Color, Gradient - */ - public function getLegendBackground() { - return $this->color; - } - - /** - * Get the line thickness - * - * @return NULL - */ - public function getLegendLineThickness() { - } - - /** - * Get the line type - * - * @return NULL - */ - public function getLegendLineStyle() { - } - - /** - * Get the color of line - * - * @return NULL - */ - public function getLegendLineColor() { - } - - /** - * Get a mark object - * - * @return NULL - */ - public function getLegendMark() { - } - -} - -registerClass('PiePart'); - -function callbackPerCent($value) { - return $value.'%'; -} -?> \ No newline at end of file diff --git a/artichow/Plot.class.php b/artichow/Plot.class.php deleted file mode 100644 index 2accb26..0000000 --- a/artichow/Plot.class.php +++ /dev/null @@ -1,1464 +0,0 @@ -grid = new awGrid; - $this->grid->setBackgroundColor(new awWhite); - - $this->padding->add(20, 0, 0, 20); - - $this->xAxis = new awAxis; - $this->xAxis->addTick('major', new awTick(0, 5)); - $this->xAxis->addTick('minor', new awTick(0, 3)); - $this->xAxis->setTickStyle(awTick::OUT); - $this->xAxis->label->setFont(new awTuffy(7)); - - $this->yAxis = new awAxis; - $this->yAxis->auto(TRUE); - $this->yAxis->addTick('major', new awTick(0, 5)); - $this->yAxis->addTick('minor', new awTick(0, 3)); - $this->yAxis->setTickStyle(awTick::OUT); - $this->yAxis->setNumberByTick('minor', 'major', 3); - $this->yAxis->label->setFont(new awTuffy(7)); - $this->yAxis->title->setAngle(90); - - } - - /** - * Get plot values - * - * @return array - */ - public function getValues() { - return $this->datay; - } - - /** - * Reduce number of values in the plot - * - * @param int $number Reduce number of values to $number - */ - public function reduce($number) { - - $count = count($this->datay); - $ratio = ceil($count / $number); - - if($ratio > 1) { - - $tmpy = $this->datay; - $datay = array(); - - $datax = array(); - $cbLabel = $this->xAxis->label->getCallbackFunction(); - - for($i = 0; $i < $count; $i += $ratio) { - - $slice = array_slice($tmpy, $i, $ratio); - $datay[] = array_sum($slice) / count($slice); - - // Reduce data on X axis if needed - if($cbLabel !== NULL) { - $datax[] = $cbLabel($i + round($ratio / 2)); - } - - } - - $this->setValues($datay); - - if($cbLabel !== NULL) { - $this->xAxis->setLabelText($datax); - } - - - } - - } - - /** - * Count values in the plot - * - * @return int - */ - public function getXAxisNumber() { - list($min, $max) = $this->xAxis->getRange(); - return ($max - $min + 1); - } - - /** - * Change X axis - * - * @param int $axis - */ - public function setXAxis($axis) { - $this->xAxisPosition = $axis; - } - - /** - * Get X axis - * - * @return int - */ - public function getXAxis() { - return $this->xAxisPosition; - } - - /** - * Set X axis on zero - * - * @param bool $zero - */ - public function setXAxisZero($zero) { - $this->xAxisZero = (bool)$zero; - } - - /** - * Set Y axis on zero - * - * @param bool $zero - */ - public function setYAxisZero($zero) { - $this->yAxisZero = (bool)$zero; - } - - /** - * Change Y axis - * - * @param int $axis - */ - public function setYAxis($axis) { - $this->yAxisPosition = $axis; - } - - /** - * Get Y axis - * - * @return int - */ - public function getYAxis() { - return $this->yAxisPosition; - } - - /** - * Change min value for Y axis - * Set NULL for auto selection. - * - * @param float $value - */ - public function setYMin($value) { - $this->yMin = $value; - $this->yAxis->auto(FALSE); - $this->updateAxis(); - } - - /** - * Change max value for Y axis - * Set NULL for auto selection. - * - * @param float $value - */ - public function setYMax($value) { - $this->yMax = $value; - $this->yAxis->auto(FALSE); - $this->updateAxis(); - } - - /** - * Change min value for X axis - * Set NULL for auto selection. - * - * @param float $value - */ - public function setXMin($value) { - $this->xMin = $value; - $this->updateAxis(); - } - - /** - * Change max value for X axis - * Set NULL for auto selection. - * - * @param float $value - */ - public function setXMax($value) { - $this->xMax = $value; - $this->updateAxis(); - } - - /** - * Get min value for Y axis - * - * @return float $value - */ - public function getYMin() { - if($this->auto) { - if(is_null($this->yMin)) { - $min = array_min($this->datay); - if($min > 0) { - return 0; - } - } - } - return is_null($this->yMin) ? array_min($this->datay) : (float)$this->yMin; - } - - /** - * Get max value for Y axis - * - * @return float $value - */ - public function getYMax() { - if($this->auto) { - if(is_null($this->yMax)) { - $max = array_max($this->datay); - if($max < 0) { - return 0; - } - } - } - return is_null($this->yMax) ? array_max($this->datay) : (float)$this->yMax; - } - - /** - * Get min value for X axis - * - * @return float $value - */ - public function getXMin() { - return floor(is_null($this->xMin) ? array_min($this->datax) : $this->xMin); - } - - /** - * Get max value for X axis - * - * @return float $value - */ - public function getXMax() { - return (ceil(is_null($this->xMax) ? array_max($this->datax) : (float)$this->xMax)) + ($this->getXCenter() ? 1 : 0); - } - - /** - * Get min value with spaces for Y axis - * - * @return float $value - */ - public function getRealYMin() { - $min = $this->getYMin(); - if($this->space->bottom !== NULL) { - $interval = ($this->getYMax() - $min) * $this->space->bottom / 100; - return $min - $interval; - } else { - return is_null($this->yMin) ? $min : (float)$this->yMin; - } - } - - /** - * Get max value with spaces for Y axis - * - * @return float $value - */ - public function getRealYMax() { - $max = $this->getYMax(); - if($this->space->top !== NULL) { - $interval = ($max - $this->getYMin()) * $this->space->top / 100; - return $max + $interval; - } else { - return is_null($this->yMax) ? $max : (float)$this->yMax; - } - } - - public function init(awDriver $driver) { - - list($x1, $y1, $x2, $y2) = $this->getPosition(); - - // Get space informations - list($leftSpace, $rightSpace, $topSpace, $bottomSpace) = $this->getSpace($x2 - $x1, $y2 - $y1); - - $this->xAxis->setPadding($leftSpace, $rightSpace); - - if($this->space->bottom > 0 or $this->space->top > 0) { - - list($min, $max) = $this->yAxis->getRange(); - $interval = $max - $min; - - $this->yAxis->setRange( - $min - $interval * $this->space->bottom / 100, - $max + $interval * $this->space->top / 100 - ); - - } - - // Auto-scaling mode - $this->yAxis->autoScale(); - - // Number of labels is not specified - if($this->yAxis->getLabelNumber() === NULL) { - $number = round(($y2 - $y1) / 75) + 2; - $this->yAxis->setLabelNumber($number); - } - - $this->xAxis->line->setX($x1, $x2); - $this->yAxis->line->setY($y2, $y1); - - // Set ticks - - $this->xAxis->tick('major')->setNumber($this->getXAxisNumber()); - $this->yAxis->tick('major')->setNumber($this->yAxis->getLabelNumber()); - - - // Center X axis on zero - if($this->xAxisZero) { - $this->xAxis->setYCenter($this->yAxis, 0); - } - - // Center Y axis on zero - if($this->yAxisZero) { - $this->yAxis->setXCenter($this->xAxis, 0); - } - - // Set axis labels - $labels = array(); - - list($xMin, $xMax) = $this->xAxis->getRange(); - for($i = $xMin; $i <= $xMax; $i++) { - $labels[] = $i; - } - $this->xAxis->label->set($labels); - - parent::init($driver); - - list($x1, $y1, $x2, $y2) = $this->getPosition(); - - list($leftSpace, $rightSpace) = $this->getSpace($x2 - $x1, $y2 - $y1); - - // Create the grid - $this->createGrid(); - - // Draw the grid - $this->grid->setSpace($leftSpace, $rightSpace, 0, 0); - $this->grid->draw($driver, $x1, $y1, $x2, $y2); - - } - - public function drawEnvelope(awDriver $driver) { - - list($x1, $y1, $x2, $y2) = $this->getPosition(); - - if($this->getXCenter()) { - $size = $this->xAxis->getDistance(0, 1); - $this->xAxis->label->move($size / 2, 0); - $this->xAxis->label->hideLast(TRUE); - } - - // Draw top axis - if($this->xAxisPosition === awPlot::TOP or $this->xAxisPosition === awPlot::BOTH) { - $top = clone $this->xAxis; - if($this->xAxisZero === FALSE) { - $top->line->setY($y1, $y1); - } - $top->label->setAlign(NULL, awLabel::TOP); - $top->label->move(0, -3); - $top->title->move(0, -25); - $top->draw($driver); - } - - // Draw bottom axis - if($this->xAxisPosition === awPlot::BOTTOM or $this->xAxisPosition === awPlot::BOTH) { - $bottom = clone $this->xAxis; - if($this->xAxisZero === FALSE) { - $bottom->line->setY($y2, $y2); - } - $bottom->label->setAlign(NULL, awLabel::BOTTOM); - $bottom->label->move(0, 3); - $bottom->reverseTickStyle(); - $bottom->title->move(0, 25); - $bottom->draw($driver); - } - - // Draw left axis - if($this->yAxisPosition === awPlot::LEFT or $this->yAxisPosition === awPlot::BOTH) { - $left = clone $this->yAxis; - if($this->yAxisZero === FALSE) { - $left->line->setX($x1, $x1); - } - $left->label->setAlign(awLabel::RIGHT); - $left->label->move(-6, 0); - $left->title->move(-25, 0); - $left->draw($driver); - } - - // Draw right axis - if($this->yAxisPosition === awPlot::RIGHT or $this->yAxisPosition === awPlot::BOTH) { - $right = clone $this->yAxis; - if($this->yAxisZero === FALSE) { - $right->line->setX($x2, $x2); - } - $right->label->setAlign(awLabel::LEFT); - $right->label->move(6, 0); - $right->reverseTickStyle(); - $right->title->move(25, 0); - $right->draw($driver); - } - - } - - protected function createGrid() { - - $max = $this->getRealYMax(); - $min = $this->getRealYMin(); - - $number = $this->yAxis->getLabelNumber() - 1; - - if($number < 1) { - return; - } - - // Horizontal lines of the grid - - $h = array(); - for($i = 0; $i <= $number; $i++) { - $h[] = $i / $number; - } - - // Vertical lines - - $major = $this->yAxis->tick('major'); - $interval = $major->getInterval(); - $number = $this->getXAxisNumber() - 1; - - $w = array(); - - if($number > 0) { - - for($i = 0; $i <= $number; $i++) { - if($i%$interval === 0) { - $w[] = $i / $number; - } - } - - } - - $this->grid->setGrid($w, $h); - - } - - /** - * Change values of Y axis - * This method ignores not numeric values - * - * @param array $datay - * @param array $datax - */ - public function setValues($datay, $datax = NULL) { - - $this->checkArray($datay); - - foreach($datay as $key => $value) { - unset($datay[$key]); - $datay[(int)$key] = $value; - } - - if($datax === NULL) { - $datax = array(); - for($i = 0; $i < count($datay); $i++) { - $datax[] = $i; - } - } else { - foreach($datax as $key => $value) { - unset($datax[$key]); - $datax[(int)$key] = $value; - } - } - - $this->checkArray($datax); - - if(count($datay) === count($datax)) { - - // Set values - $this->datay = $datay; - $this->datax = $datax; - // Update axis with the new awvalues - $this->updateAxis(); - } else { - awImage::drawError("Class Plot: Plots must have the same number of X and Y points."); - } - - } - - /** - * Return begin and end values - * - * @return array - */ - protected function getLimit() { - - $i = 0; - while(array_key_exists($i, $this->datay) and $this->datay[$i] === NULL) { - $i++; - } - $start = $i; - $i = count($this->datay) - 1; - while(array_key_exists($i, $this->datay) and $this->datay[$i] === NULL) { - $i--; - } - $stop = $i; - - return array($start, $stop); - - } - - /** - * Return TRUE if labels must be centered on X axis, FALSE otherwise - * - * @return bool - */ - abstract public function getXCenter(); - - private function updateAxis() { - - $this->xAxis->setRange( - $this->getXMin(), - $this->getXMax() - ); - $this->yAxis->setRange( - $this->getRealYMin(), - $this->getRealYMax() - ); - - } - - private function checkArray(&$array) { - - if(is_array($array) === FALSE) { - awImage::drawError("Class Plot: You tried to set a value that is not an array."); - } - - foreach($array as $key => $value) { - if(is_numeric($value) === FALSE and is_null($value) === FALSE) { - awImage::drawError("Class Plot: Expected numeric values for the plot."); - } - } - - if(count($array) < 1) { - awImage::drawError("Class Plot: Your plot must have at least 1 value."); - } - - } - -} - -registerClass('Plot', TRUE); - -class awPlotAxis { - - /** - * Left axis - * - * @var Axis - */ - public $left; - - /** - * Right axis - * - * @var Axis - */ - public $right; - - /** - * Top axis - * - * @var Axis - */ - public $top; - - /** - * Bottom axis - * - * @var Axis - */ - public $bottom; - - /** - * Build the group of axis - */ - public function __construct() { - - $this->left = new awAxis; - $this->left->auto(TRUE); - $this->left->label->setAlign(awLabel::RIGHT); - $this->left->label->move(-6, 0); - $this->yAxis($this->left); - $this->left->setTickStyle(awTick::OUT); - $this->left->title->move(-25, 0); - - $this->right = new awAxis; - $this->right->auto(TRUE); - $this->right->label->setAlign(awLabel::LEFT); - $this->right->label->move(6, 0); - $this->yAxis($this->right); - $this->right->setTickStyle(awTick::IN); - $this->right->title->move(25, 0); - - $this->top = new awAxis; - $this->top->label->setAlign(NULL, awLabel::TOP); - $this->top->label->move(0, -3); - $this->xAxis($this->top); - $this->top->setTickStyle(awTick::OUT); - $this->top->title->move(0, -25); - - $this->bottom = new awAxis; - $this->bottom->label->setAlign(NULL, awLabel::BOTTOM); - $this->bottom->label->move(0, 3); - $this->xAxis($this->bottom); - $this->bottom->setTickStyle(awTick::IN); - $this->bottom->title->move(0, 25); - - } - - protected function xAxis(awAxis $axis) { - - $axis->addTick('major', new awTick(0, 5)); - $axis->addTick('minor', new awTick(0, 3)); - $axis->label->setFont(new awTuffy(7)); - - } - - protected function yAxis(awAxis $axis) { - - $axis->addTick('major', new awTick(0, 5)); - $axis->addTick('minor', new awTick(0, 3)); - $axis->setNumberByTick('minor', 'major', 3); - $axis->label->setFont(new awTuffy(7)); - $axis->title->setAngle(90); - - } - -} - -registerClass('PlotAxis'); - -/** - * A graph with axis can contain some groups of components - * - * @package Artichow - */ -class awPlotGroup extends awComponentGroup { - - /** - * Grid properties - * - * @var Grid - */ - public $grid; - - /** - * Left, right, top and bottom axis - * - * @var PlotAxis - */ - public $axis; - - /** - * Set the X axis on zero - * - * @var bool - */ - protected $xAxisZero = TRUE; - - /** - * Set the Y axis on zero - * - * @var bool - */ - protected $yAxisZero = FALSE; - - /** - * Real axis used for Y axis - * - * @var string - */ - private $yRealAxis = awPlot::LEFT; - - /** - * Real axis used for X axis - * - * @var string - */ - private $xRealAxis = awPlot::BOTTOM; - - /** - * Change min value for Y axis - * - * @var mixed - */ - private $yMin = NULL; - - /** - * Change max value for Y axis - * - * @var mixed - */ - private $yMax = NULL; - - /** - * Change min value for X axis - * - * @var mixed - */ - private $xMin = NULL; - - /** - * Change max value for X axis - * - * @var mixed - */ - private $xMax = NULL; - - /** - * Build the PlotGroup - * - */ - public function __construct() { - - parent::__construct(); - - $this->grid = new awGrid; - $this->grid->setBackgroundColor(new awWhite); - - $this->axis = new awPlotAxis; - - } - - /** - * Set the X axis on zero or not - * - * @param bool $zero - */ - public function setXAxisZero($zero) { - $this->xAxisZero = (bool)$zero; - } - - /** - * Set the Y axis on zero or not - * - * @param bool $zero - */ - public function setYAxisZero($zero) { - $this->yAxisZero = (bool)$zero; - } - - /** - * Change min value for Y axis - * Set NULL for auto selection. - * - * @param float $value - */ - public function setYMin($value) { - $this->axis->left->auto(FALSE); - $this->axis->right->auto(FALSE); - $this->yMin = $value; - } - - /** - * Change max value for Y axis - * Set NULL for auto selection. - * - * @param float $value - */ - public function setYMax($value) { - $this->axis->left->auto(FALSE); - $this->axis->right->auto(FALSE); - $this->yMax = $value; - } - - /** - * Change min value for X axis - * Set NULL for auto selection. - * - * @param float $value - */ - public function setXMin($value) { - $this->xMin = $value; - } - - /** - * Change max value for X axis - * Set NULL for auto selection. - * - * @param float $value - */ - public function setXMax($value) { - $this->xMax = $value; - } - - /** - * Get min value for X axis - * - * @return float $value - */ - public function getXMin() { - - return $this->getX('min'); - - } - - /** - * Get max value for X axis - * - * @return float $value - */ - public function getXMax() { - - return $this->getX('max'); - - } - - private function getX($type) { - - switch($type) { - case 'max' : - if($this->xMax !== NULL) { - return $this->xMax; - } - break; - case 'min' : - if($this->xMin !== NULL) { - return $this->xMin; - } - break; - } - - $value = NULL; - $get = 'getX'.ucfirst($type); - - for($i = 0; $i < count($this->components); $i++) { - - $component = $this->components[$i]; - - if($value === NULL) { - $value = $component->$get(); - } else { - $value = $type($value, $component->$get()); - } - - } - - return $value; - - } - - /** - * Get min value with spaces for Y axis - * - * @param string $axis Axis name - * @return float $value - */ - public function getRealYMin($axis = NULL) { - - if($axis === NULL) { - return NULL; - } - - $min = $this->getRealY('min', $axis); - $max = $this->getRealY('max', $axis); - - if($this->space->bottom !== NULL) { - $interval = ($min - $max) * $this->space->bottom / 100; - return $min + $interval; - } else { - return $min; - } - - } - - /** - * Get max value with spaces for Y axis - * - * @param string $axis Axis name - * @return float $value - */ - public function getRealYMax($axis = NULL) { - - if($axis === NULL) { - return NULL; - } - - $min = $this->getRealY('min', $axis); - $max = $this->getRealY('max', $axis); - - if($this->space->top !== NULL) { - $interval = ($max - $min) * $this->space->top / 100; - return $max + $interval; - } else { - return $max; - } - - } - - private function getRealY($type, $axis) { - - switch($type) { - case 'max' : - if($this->yMax !== NULL) { - return $this->yMax; - } - break; - case 'min' : - if($this->yMin !== NULL) { - return $this->yMin; - } - break; - } - - $value = NULL; - $get = 'getY'.ucfirst($type); - - for($i = 0; $i < count($this->components); $i++) { - - $component = $this->components[$i]; - - switch($axis) { - - case awPlot::LEFT : - case awPlot::RIGHT : - $test = ($component->getYAxis() === $axis); - break; - default : - $test = FALSE; - - } - - if($test) { - - $auto = $component->yAxis->isAuto(); - $this->axis->{$axis}->auto($auto); - - if($value === NULL) { - $value = $component->$get(); - } else { - $value = $type($value, $component->$get()); - } - - } - - } - - return $value; - - } - - public function init(awDriver $driver) { - - list($x1, $y1, $x2, $y2) = $this->getPosition(); - - // Get PlotGroup space - list($leftSpace, $rightSpace, $topSpace, $bottomSpace) = $this->getSpace($x2 - $x1, $y2 - $y1); - - // Count values in the group - $values = $this->getXAxisNumber(); - - // Init the PlotGroup - $this->axis->top->line->setX($x1, $x2); - $this->axis->bottom->line->setX($x1, $x2); - $this->axis->left->line->setY($y2, $y1); - $this->axis->right->line->setY($y2, $y1); - - $this->axis->top->setPadding($leftSpace, $rightSpace); - $this->axis->bottom->setPadding($leftSpace, $rightSpace); - - $xMin = $this->getXMin(); - $xMax = $this->getXMax(); - - $this->axis->top->setRange($xMin, $xMax); - $this->axis->bottom->setRange($xMin, $xMax); - - for($i = 0; $i < count($this->components); $i++) { - - - $component = $this->components[$i]; - - $component->auto($this->auto); - - // Copy space to the component - - $component->setSpace($this->space->left, $this->space->right, $this->space->top, $this->space->bottom); - - $component->xAxis->setPadding($leftSpace, $rightSpace); - $component->xAxis->line->setX($x1, $x2); - - $component->yAxis->line->setY($y2, $y1); - - } - - // Set Y axis range - foreach(array('left', 'right') as $axis) { - - if($this->isAxisUsed($axis)) { - - $min = $this->getRealYMin($axis); - $max = $this->getRealYMax($axis); - - $interval = $max - $min; - - $this->axis->{$axis}->setRange( - $min - $interval * $this->space->bottom / 100, - $max + $interval * $this->space->top / 100 - ); - - // Auto-scaling mode - if($this->axis->{$axis}->isAuto()) { - $this->axis->{$axis}->autoScale(); - } - - } - - } - - if($this->axis->left->getLabelNumber() === NULL) { - $number = round(($y2 - $y1) / 75) + 2; - $this->axis->left->setLabelNumber($number); - } - - if($this->axis->right->getLabelNumber() === NULL) { - $number = round(($y2 - $y1) / 75) + 2; - $this->axis->right->setLabelNumber($number); - } - - // Center labels on X axis if needed - $test = array(awPlot::TOP => FALSE, awPlot::BOTTOM => FALSE); - - for($i = 0; $i < count($this->components); $i++) { - - - $component = $this->components[$i]; - - - if($component->getValues() !== NULL) { - - $axis = $component->getXAxis(); - - if($test[$axis] === FALSE) { - - // Center labels for bar plots - if($component->getXCenter()) { - $size = $this->axis->{$axis}->getDistance(0, 1); - $this->axis->{$axis}->label->move($size / 2, 0); - $this->axis->{$axis}->label->hideLast(TRUE); - $test[$axis] = TRUE; - } - - } - - } - - - } - - // Set axis labels - $labels = array(); - for($i = $xMin; $i <= $xMax; $i++) { - $labels[] = $i; - } - if($this->axis->top->label->count() === 0) { - $this->axis->top->label->set($labels); - } - if($this->axis->bottom->label->count() === 0) { - $this->axis->bottom->label->set($labels); - } - - // Set ticks - - $this->axis->top->tick('major')->setNumber($values); - $this->axis->bottom->tick('major')->setNumber($values); - $this->axis->left->tick('major')->setNumber($this->axis->left->getLabelNumber()); - $this->axis->right->tick('major')->setNumber($this->axis->right->getLabelNumber()); - - - // Set X axis on zero - if($this->xAxisZero) { - $axis = $this->selectYAxis(); - $this->axis->bottom->setYCenter($axis, 0); - $this->axis->top->setYCenter($axis, 0); - } - - // Set Y axis on zero - if($this->yAxisZero) { - $axis = $this->selectXAxis(); - $this->axis->left->setXCenter($axis, 1); - $this->axis->right->setXCenter($axis, 1); - } - - parent::init($driver); - - list($leftSpace, $rightSpace, $topSpace, $bottomSpace) = $this->getSpace($x2 - $x1, $y2 - $y1); - - // Create the grid - $this->createGrid(); - - // Draw the grid - $this->grid->setSpace($leftSpace, $rightSpace, 0, 0); - $this->grid->draw($driver, $x1, $y1, $x2, $y2); - - } - - public function drawComponent(awDriver $driver, $x1, $y1, $x2, $y2, $aliasing) { - - $xMin = $this->getXMin(); - $xMax = $this->getXMax(); - - $maxLeft = $this->getRealYMax(awPlot::LEFT); - $maxRight = $this->getRealYMax(awPlot::RIGHT); - - $minLeft = $this->getRealYMin(awPlot::LEFT); - $minRight = $this->getRealYMin(awPlot::RIGHT); - - foreach($this->components as $component) { - - $min = $component->getYMin(); - $max = $component->getYMax(); - - // Set component minimum and maximum - if($component->getYAxis() === awPlot::LEFT) { - - list($min, $max) = $this->axis->left->getRange(); - - $component->setYMin($min); - $component->setYMax($max); - - } else { - - list($min, $max) = $this->axis->right->getRange(); - - $component->setYMin($min); - $component->setYMax($max); - - } - - $component->setXAxisZero($this->xAxisZero); - $component->setYAxisZero($this->yAxisZero); - - $component->xAxis->setRange($xMin, $xMax); - - $component->drawComponent( - $driver, - $x1, $y1, - $x2, $y2, - $aliasing - ); - - $component->setYMin($min); - $component->setYMax($max); - - } - - } - - public function drawEnvelope(awDriver $driver) { - - list($x1, $y1, $x2, $y2) = $this->getPosition(); - - // Hide unused axis - foreach(array(awPlot::LEFT, awPlot::RIGHT, awPlot::TOP, awPlot::BOTTOM) as $axis) { - if($this->isAxisUsed($axis) === FALSE) { - $this->axis->{$axis}->hide(TRUE); - } - } - - // Draw top axis - $top = $this->axis->top; - if($this->xAxisZero === FALSE) { - $top->line->setY($y1, $y1); - } - $top->draw($driver); - - // Draw bottom axis - $bottom = $this->axis->bottom; - if($this->xAxisZero === FALSE) { - $bottom->line->setY($y2, $y2); - } - $bottom->draw($driver); - - // Draw left axis - $left = $this->axis->left; - if($this->yAxisZero === FALSE) { - $left->line->setX($x1, $x1); - } - $left->draw($driver); - - // Draw right axis - $right = $this->axis->right; - if($this->yAxisZero === FALSE) { - $right->line->setX($x2, $x2); - } - $right->draw($driver); - - } - - /** - * Is the specified axis used ? - * - * @param string $axis Axis name - * @return bool - */ - protected function isAxisUsed($axis) { - - for($i = 0; $i < count($this->components); $i++) { - - $component = $this->components[$i]; - - switch($axis) { - - case awPlot::LEFT : - case awPlot::RIGHT : - if($component->getYAxis() === $axis) { - return TRUE; - } - break; - - case awPlot::TOP : - case awPlot::BOTTOM : - if($component->getXAxis() === $axis) { - return TRUE; - } - break; - - } - - } - - return FALSE; - - } - - protected function createGrid() { - - $max = $this->getRealYMax(awPlot::LEFT); - $min = $this->getRealYMin(awPlot::RIGHT); - - // Select axis (left if possible, right otherwise) - $axis = $this->selectYAxis(); - - $number = $axis->getLabelNumber() - 1; - - if($number < 1) { - return; - } - - // Horizontal lines of grid - - $h = array(); - for($i = 0; $i <= $number; $i++) { - $h[] = $i / $number; - } - - // Vertical lines - - $major = $axis->tick('major'); - $interval = $major->getInterval(); - $number = $this->getXAxisNumber() - 1; - - $w = array(); - - if($number > 0) { - - for($i = 0; $i <= $number; $i++) { - if($i%$interval === 0) { - $w[] = $i / $number; - } - } - - } - - $this->grid->setGrid($w, $h); - - } - - protected function selectYAxis(){ - - // Select axis (left if possible, right otherwise) - if($this->isAxisUsed(awPlot::LEFT)) { - $axis = $this->axis->left; - } else { - $axis = $this->axis->right; - } - - return $axis; - - } - - protected function selectXAxis(){ - - // Select axis (bottom if possible, top otherwise) - if($this->isAxisUsed(awPlot::BOTTOM)) { - $axis = $this->axis->bottom; - } else { - $axis = $this->axis->top; - } - - return $axis; - - } - - protected function getXAxisNumber() { - $offset = $this->components[0]; - $max = $offset->getXAxisNumber(); - for($i = 1; $i < count($this->components); $i++) { - $offset = $this->components[$i]; - $max = max($max, $offset->getXAxisNumber()); - } - return $max; - } - -} - -registerClass('PlotGroup'); -?> \ No newline at end of file diff --git a/artichow/README b/artichow/README deleted file mode 100644 index 43e4da6..0000000 --- a/artichow/README +++ /dev/null @@ -1,120 +0,0 @@ - I. Installation - II. Configuration -III. Utilisation - IV. Divers - - -I. Installation - ------------ - -*** Première installation *** - -L'installation de Artichow se résume à décompresser l'archive dans le dossier -de votre choix sur votre serveur. Veillez simplement à télécharger l'archive -dont vous avez vraiment besoin (PHP 5 ou PHP 4 & 5). -Notez que Artichow requiert GD 2 et PHP 4.3.0 au minimum pour fonctionner. - -*** Mise à jour *** - -Lorsque vous souhaitez mettre à jour Artichow avec la dernière version, -essayez de suivre pas à pas ces étapes : - 1) Décompressez la dernière version de Artichow dans un dossier - 2) Ecrasez le fichier Artichow.cfg.php avec votre ancien fichier - 3) Copiez vos patterns dans le dossier patterns/ de la nouvelle version - 4) Supprimez l'ancienne version de Artichow de votre disque - 5) Copiez la nouvelle version là où était l'ancienne -Une fois ces cinq étapes effectuées, vous n'aurez plus qu'à mettre -éventuellement à jour vos graphiques, en fonction des dernières évolutions de -l'API de Artichow. Pour cela, voyez le titre "Migrer d'une version à l'autre" -sur la page : -http://www.artichow.org/documentation - -II. Configuration - ------------- - -Même si une utilisation normale de Artichow ne nécessite pas de configuration -particulière, il existe un fichier Artichow.cfg.php qui permet de modifier -quelques paramètres de la librairie. -Vous pouvez notamment configurer le répertoire vers les polices de caractère -en modifiant la constante ARTICHOW_FONT (par exemple en choisissant -'c:\Windows\font' si vous êtes sous Windows). -Vous pouvez également redéfinir la variable $fonts. Cette variable contient une -liste de polices TTF (sans l'extension) présentes dans votre répertoire -ARTICHOW_FONT. Pour toutes les polices de cette liste, une classe du même nom -est créée. Les polices ainsi définies peuvent ensuite être utilisées de cette -manière : - -Il existe également une constante ARTICHOW_DEPRECATED. Si cette constante vaut -TRUE, alors un message d'erreur sera affiché lorsque vous utiliserez une -fonctionnalité dépréciée de Artichow. A l'inverse, avec la valeur FALSE, -vous pourrez continuer à utiliser les fonctions dépréciées sans soucis. -Cependant, dans un souci de compatibilité, il est préférable de mettre à -jour vos graphiques dès lors qu'un message de ce type apparaît (et donc de -laisser la constante à TRUE). Les fonctionnalités dépréciées sont toujours -potentiellement susceptibles de disparaître d'une version à l'autre de la -librairie. -La constante ARTICHOW_PREFIX est vide par défaut et correspond à un préfixe qui -est ajouté au nom de chaque classe utilisée sur Artichow. Certains noms de -classe (Graph, Image, Text, Font, etc.) sont utilisés par d'autres librairies -et cela peut aboutir à des conflits. Pour résoudre ce problème, choisissez par -exemple 'xyz' comme préfixe et toutes les classes de Artichow s'appèleront -désormais xyz[Nom normal]. Exemple d'utilisation de Artichow avec -ARTICHOW_PREFIX à 'xyz' : -title->set('Mon graphique'); -$plot->title->setFont(new xyzFont4); - -$graph = new xyzGraph(400, 300); -$graph->add($plot); -$graph->draw(); -?> - - -III. Utilisation - ----------- - -Si vous utilisez la version conçue exclusivement pour PHP 5, vous pouvez vous -référer aux exemples et aux tutoriels afin de bien prendre en main la -librairie. -Si vous utilisez la version pour PHP 4 & 5, référez vous également aux exemples -et tutoriels mais faîtes attention lors de l'inclusion des fichiers de -Artichow. N'incluez pas les fichiers de cette manière : - -Préférez plutôt : - -C'est la librairie qui se charge de sélectionner les bons fichiers en fonction -de la version de PHP dont vous disposez. - -IV. Divers - ------ - -La documentation de Artichow est disponible sur : -http://www.artichow.org/documentation - -Des tutoriels sont accessibles sur : -http://www.artichow.org/tutorial - -Un forum de support peut être trouvé sur : -http://www.artichow.org/forum/ - -N'oubliez pas que Artichow est dans le domaine public. Vous pouvez donc faire -CE QUE VOUS SOUHAITEZ avec cette librairie, y compris ajouter votre nom dans -chaque fichier, et la redistribuer ainsi. - -Si vous souhaitez aider et participer au développement de Artichow, n'hésitez -pas à consulter cette page : -http://www.artichow.org/help - diff --git a/artichow/ScatterPlot.class.php b/artichow/ScatterPlot.class.php deleted file mode 100644 index 88b3c52..0000000 --- a/artichow/ScatterPlot.class.php +++ /dev/null @@ -1,300 +0,0 @@ -mark = new awMark; - $this->mark->setType(awMark::CIRCLE); - $this->mark->setSize(7); - $this->mark->border->show(); - - $this->label = new awLabel; - - $this->setValues($datay, $datax); - $this->setColor(new awBlack); - - } - - /** - * Display plot as impulses - * - * @param awColor $impulse Impulses color (or NULL to disable impulses) - */ - public function setImpulse($color) { - $this->impulse = $color; - } - - /** - * Link scatter plot points - * - * @param bool $link - * @param awColor $color Line color (default to black) - */ - public function link($link, $color = NULL) { - $this->link = (bool)$link; - if($color instanceof awColor) { - $this->setColor($color); - } - } - - /** - * Ignore null values for Y data and continue linking - * - * @param bool $link - */ - public function linkNull($link) { - $this->linkNull = (bool)$link; - } - - /** - * Change line color - * - * @param awColor $color - */ - public function setColor(awColor $color) { - $this->lineColor = $color; - } - - /** - * Change line style - * - * @param int $style - */ - public function setStyle($style) { - $this->lineStyle = (int)$style; - } - - /** - * Change line tickness - * - * @param int $tickness - */ - public function setThickness($tickness) { - $this->lineThickness = (int)$tickness; - } - - /** - * Get the line thickness - * - * @return int - */ - public function getLegendLineThickness() { - return $this->lineThickness; - } - - /** - * Get the line type - * - * @return int - */ - public function getLegendLineStyle() { - return $this->lineStyle; - } - - /** - * Get the color of line - * - * @return Color - */ - public function getLegendLineColor() { - return $this->lineColor; - } - - /** - * Get the background color or gradient of an element of the component - * - * @return Color, Gradient - */ - public function getLegendBackground() { - return NULL; - } - - /** - * Get a mark object - * - * @return Mark - */ - public function getLegendMark() { - return $this->mark; - } - - public function drawComponent(awDriver $driver, $x1, $y1, $x2, $y2, $aliasing) { - - $count = count($this->datay); - - // Get start and stop values - list($start, $stop) = $this->getLimit(); - - // Build the polygon - $polygon = new awPolygon; - - for($key = 0; $key < $count; $key++) { - - $x = $this->datax[$key]; - $y = $this->datay[$key]; - - if($y !== NULL) { - $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($x, $y)); - $polygon->set($key, $p); - } else if($this->linkNull === FALSE) { - $polygon->set($key, NULL); - } - - } - - // Link points if needed - if($this->link) { - - $prev = NULL; - - foreach($polygon->all() as $point) { - - if($prev !== NULL and $point !== NULL) { - $driver->line( - $this->lineColor, - new awLine( - $prev, - $point, - $this->lineStyle, - $this->lineThickness - ) - ); - } - $prev = $point; - - } - } - - // Draw impulses - if($this->impulse instanceof awColor) { - - foreach($polygon->all() as $key => $point) { - - if($point !== NULL) { - - $zero = awAxis::toPosition( - $this->xAxis, - $this->yAxis, - new awPoint($key, 0) - ); - - $driver->line( - $this->impulse, - new awLine( - $zero, - $point, - awLine::SOLID, - 1 - ) - ); - - } - - } - - } - - // Draw marks and labels - foreach($polygon->all() as $key => $point) { - - $this->mark->draw($driver, $point); - $this->label->draw($driver, $point, $key); - - } - - } - - protected function xAxisPoint($position) { - $y = $this->xAxisZero ? 0 : $this->getRealYMin(); - return awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($position, $y)); - } - - public function getXCenter() { - return FALSE; - } - -} - -registerClass('ScatterPlot'); -?> diff --git a/artichow/TODO b/artichow/TODO deleted file mode 100644 index 7c20529..0000000 --- a/artichow/TODO +++ /dev/null @@ -1,13 +0,0 @@ -- message d'erreur si MING n'est pas installé - -- setLabelPrecision a un booleen pour déterminer s'il faut remplir avec des zéros ou non - -- Label => TextBox -- Excel/Spider/Splines/Bezier - -- doc de Pattern -- bug de la grille -- pouvoir tracer des lignes verticales et horizontales à n'importe quel endroit sur les Plots -- avant de parler de SimpleLinePlot, ajouter une classe CommonLinePlot, dont dérivent tous les LinePlot - -- faire un mode auto pour les Pie (au delà d'un certain nombre de parts, grouper le reste sous l'étiquette 'Divers' (choisie par le user)) \ No newline at end of file diff --git a/artichow/common.php b/artichow/common.php deleted file mode 100644 index 010ec30..0000000 --- a/artichow/common.php +++ /dev/null @@ -1,96 +0,0 @@ - 0) { - - do { - $min = array_pop($array); - if(is_numeric($min) === FALSE) { - $min = NULL; - } - } while(count($array) > 0 and $min === NULL); - - if($min !== NULL) { - $min = (float)$min; - } - - foreach($array as $value) { - if(is_numeric($value) and (float)$value < $min) { - $min = (float)$value; - } - } - - return $min; - - } - - return NULL; - -} - -/* - * Get the maximum of an array and ignore non numeric values - */ -function array_max($array) { - - if(is_array($array) and count($array) > 0) { - - do { - $max = array_pop($array); - if(is_numeric($max) === FALSE) { - $max = NULL; - } - } while(count($array) > 0 and $max === NULL); - - if($max !== NULL) { - $max = (float)$max; - } - - foreach($array as $value) { - if(is_numeric($value) and (float)$value > $max) { - $max = (float)$value; - } - } - - return $max; - - } - - return NULL; - -} -/* - * Define file_put_contents() if needed - */ -if(function_exists('file_put_contents') === FALSE) { - - function file_put_contents($file, $content) { - $fp = fopen($file, 'w'); - if($fp) { - fwrite($fp, $content); - fclose($fp); - } - } - -} - -/* - * Change error handler - */ -set_error_handler('errorHandlerArtichow'); - -function errorHandlerArtichow($level, $message, $file, $line) { - awImage::drawError($message.' in '.$file.' on line '.$line.'.'); -} -?> diff --git a/artichow/doc/AntiSpam.html b/artichow/doc/AntiSpam.html deleted file mode 100644 index 0528ead..0000000 --- a/artichow/doc/AntiSpam.html +++ /dev/null @@ -1,137 +0,0 @@ - - - Documentation - - - - - -
- - - - - - - - - - - - - - - - -
  
 

Class AntiSpam

-

- La classe AntiSpam permet de créer des images pour interdire des requêtes automatisées sur certaines pages. -

-

Méthodes et propriétés

    -
  • -public __construct(string $string := '') -
  • -
  • -public string setRand(int $length) -
  • -
  • -public setNoise(int $noise) -
  • -
  • -public save(string $qName) -
  • -
  • -public check(string $qName, string $value, bool $case := TRUE) -
  • -
  • -public draw() -
  • -

Documentation

    -
  • -protected string $string
    - La chaîne de caractère que devra retaper l'utilisateur. -
    - -
  • -
  • -protected int $noise := 0
    - Degré de bruit à afficher sur l'image (entre 0 et 10). -
    - -
  • -
  • -public __construct(string $string := '') -
    - Construit une image anti-spam. Vous pouvez définir la chaîne de caractères à afficher sur l'image avec $string. - Si vous ne donnez aucune chaîne de caractères, voyez AntiSpam::setRand() pour générer une valeur aléatoire. -
    - -
  • -
  • -public string setRand(int $length) -
    - Génère une chaîne de caractère aléatoire de taille $length pour l'image anti-spam. - La chaîne de caractère ainsi créée est ensuite retournée. -
    - -
  • -
  • -public setNoise(int $noise) -
    - Ajoute du bruit sur l'image. - Les valeurs possibles sont de 0 à 10, avec 0 pour ne pas afficher de bruit et 10 pour afficher un bruit maximal. -
    - -
  • -
  • -public save(string $qName) -
    - Enregistre la valeur de l'image anti-spam dans la session de l'utilisateur sous le nom $qName. - Cette méthode doit être utilisée en combinaison avec AntiSpam::check(). -
    - -
  • -
  • -public check(string $qName, string $value, bool $case := TRUE) -
    - Vérifie que la valeur $value correspond à la valeur enregistrée sous le nom $qName avec AntiSpam::save(). - Si $case est mis à TRUE, alors la vérification NE sera PAS sensible à la casse, elle le sera à FALSE. - Cette méthode doit être utilisée en combinaison avec AntiSpam::save(). -
    - -
  • -
  • -public draw() -
    - Affiche l'image anti-spam à l'écran. -
    -
    -<?php
    -
    -require_once "AntiSpam.class.php";
    -
    -$object = new AntiSpam();
    -$object->setRand(5);
    -$object->draw();
    -
    -?>
    -
    -
    -
    - -
  • -
-
 
 
-
- - \ No newline at end of file diff --git a/artichow/doc/Axis.html b/artichow/doc/Axis.html deleted file mode 100644 index 747bb01..0000000 --- a/artichow/doc/Axis.html +++ /dev/null @@ -1,385 +0,0 @@ - - - Documentation - - - - - -
- - - - - - - - - - - - - - - - -
  
 

Class Axis

-

- La classe Axis permet de manipuler des axes. - Un axe permet à un utilisateur de répérer les points et leurs valeurs sur un graphique. -

-

- De nombreuses méthodes de la classe Axis ne sont pas documentées, - car elles ne sont utilisées qu'en interne par Artichow. - Néanmoins, si vous développez Artichow, vous aurez besoin de ces méthodes. - N'hésitez donc pas à parcourir le code source de cette classe. -

-

Méthodes et propriétés

Documentation

    -
  • -public Label $title
    - Représente le titre de l'axe. -
    - -
  • -
  • -public Label $label
    - Représente les étiquettes qui portent les valeurs affichées sur l'axe. -
    - -
  • -
  • -public Line $line
    - Représente la ligne de l'axe. - Vous pouvez modifier le style et l'épaisseur de cette ligne, pas ses coordonnées. -
    - -
  • -
  • -protected bool $auto
    - Précise si la gestion de l'axe doit être automatique ou non. -
    - -
  • -
  • -public __construct(float $min, float $max) -
    - Déclare un nouvel axe. - Les variables $min et $max représentent respectivement la valeurs minimales et maximales associées à l'axe. - Par exemple, choisir $min = -12 et $max = 42 signifie tout simplement que l'axe ira de -12 à 42. -
    - -
  • -
  • -public auto(bool $auto) -
    - Active/désactive la gestion automatique de l'axe. - La gestion automatique est automatiquement désactivée en cas d'appel aux méthodes suivantes : Axis::setLabelNumber(), Axis::setLabelInterval(), Axis::setLabelPrecision() et Axis::setLabelText(). - Lorsqu'un axe est sous gestion automatique, l'échelle est le nombre de valeurs à afficher sur l'axe sont automatiquement calculés. -
    - -
  • -
  • -public true isAuto() -
    - Retourne TRUE si l'axe est gérée automatiquement, FALSE sinon. -
    - -
  • -
  • -public hide(bool $hide := TRUE) -
    - Cache ou non l'axe. Le paramètre $hide est par défaut à TRUE (ce qui signifie que l'axe ne sera pas dessiné). - S'il est mis à FALSE, l'axe sera dessiné. -
    - -
  • -
  • -public addTick(string $name, Tick $tick) -
    - Associe un objet Tick $tick à l'axe. - Cet objet sera reconnu par le nom $name au sein de la classe Axis. -
    - -
  • -
  • -public Tick tick(string $name) -
    - Récupère un objet Tick en fonction de son nom. - Cet objet doit avoir été précédemment ajouté avec la méthode Axis::addTick(). -
    - -
  • -
  • -public deleteTick(string $name) -
    - Supprime l'objet Tick de nom $name associé à l'axe. - Pour pouvoir être supprimé, cet objet doit avoir été précédemment ajouté avec la méthode Axis::addTick(). -
    - -
  • -
  • -public hideTicks(bool $hide := TRUE) -
    - Cache ou non tous les ticks qui ont été associés à cet axe. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public setTickStyle(int $style) -
    - Change le style de tous les ticks associés à l'axe pour $style. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public reverseTickStyle() -
    - Inverse le style de tous les ticks associés à l'axe pour $style. - Si les ticks étaient tournés vers l'extérieur, ils seront désormais tournés vers l'intérieur. - Et vice-versa. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public setTickInterval(int $interval) -
    - Change l'intervalle d'affichage de tous les ticks associés à l'axe pour $interval. - Cette méthode permet d'espacer l'affichage des ticks par rapport aux valeurs de l'axe. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public setNumberByTick(string $to, string $from, float $number) -
    - Cette méthode permet de modifier la fréquence d'affichage d'un objet Tick par rapport à un autre. - $to représente l'objet dont la fréquence d'affichage doit être modifiée et $from l'objet auquel on se réfère. - A chaque fois qu'un tick $from sera affiché, on affichera $number ticks $to. - Si $number vaut 2, cela signifie que deux ticks $to seront affichés pour un tick $from. - Cette méthode prend tout son sens donc le cadre des Plot par exemple : -
    -
    -<?php
    -
    -require_once 'LinePlot.class.php';
    -
    -$graph = new Graph(400, 400);
    -
    -$plot = new LinePlot(array(1, 2, 3));
    -
    -// Pour chaque tick major affiché,
    -// on affichera 10 ticks minor
    -$plot->xAxis->setNumberByTick('minor', 'major', 10);
    -
    -$graph->add($plot);
    -$graph->draw();
    -
    -?>
    -
    -
    - Cela donne 10 ticks mineurs par tick majeur : -
    - 10 ticks mineurs par tick majeur -
    -
    - -
  • -
  • -public setLabelInterval(int $interval) -
    - Change l'intervalle d'affichage des étiquettes sur l'axe pour $interval. - Par défaut, cet intervalle est égal à 1. -
    - -
  • -
  • -public setLabelNumber(int $number) -
    - Change le nombre d'étiquettes à afficher sur l'axe pour $number. -
    - -
  • -
  • -public int getLabelNumber() -
    - Retourne le nombre d'étiquettes qui seront affichées sur l'axe. -
    - -
  • -
  • -public setLabelPrecision(int $precision) -
    - Change la précision des valeurs affichées sur chaque étiquette de l'axe. - $number représente le nombre de chiffres après la virgule qui doivent être affiché. - Par défaut, $precision vaut 0. - -
    - -
  • -
  • -public setLabelText(array $texts) -
    - Cette méthode permet d'afficher des valeurs arbitraires plutôt que des valeurs numériques sur les étiquettes de l'axe. - $texts est un tableau comportant autant d'entrées que d'étiquettes et qui contient les nouvelles valeurs à afficher. - -
    - -
  • -
  • -public setTitleAlignment(int $alignment) -
    - Change l'alignement du titre de l'axe sur l'axe. - Les valeurs possibles sont Label::LEFT, Label::RIGHT, Label::TOP et Label::BOTTOM. -
    - -
  • -
  • -public setTitlePosition(float $postion) -
    - Change la position du titre sur l'axe. - $position est une fraction de la taille de l'axe. - Par exemple, si $position est placé à 0.5, le titre sera affiché au milieu de l'axe. - Si $position vaut 0.25, alors le titre sera affiché sur le premier quart de l'axe. - Pour aligner le titre par rapport à cette position, utilisez la méthode Axis::setTitleAlignment(). -
    - Voir aussi : - -
    -
    - -
  • -
  • -public setColor(Color $color) -
    - Change la couleur de l'axe et de son titre pour $color. -
    - -
  • -
  • -public setPadding(int $left, int $right) -
    - Change l'espace interne à gauche et à droite de l'axe. - Gauche et droite n'ont de sens que pour les axes verticaux. - Pour les axes plus horizontaux, préférez haut à gauche et bas à droite. -
    - -
  • -
  • -public Side getPadding() -
    - Retourne l'espace interne associé à l'axe. -
    - -
  • -
-
 
 
-
- - \ No newline at end of file diff --git a/artichow/doc/BarPlot.html b/artichow/doc/BarPlot.html deleted file mode 100644 index 85579c1..0000000 --- a/artichow/doc/BarPlot.html +++ /dev/null @@ -1,199 +0,0 @@ - - - Documentation - - - - - -
- - - - - - - - - - - - - - - - -
  
 

Class BarPlot

-

- Cette classe permet de dessiner des histogrammes. -

-

Méthodes et propriétés

Documentation

    -
  • -public Label $label
    - Représente les étiquettes affichées au-dessus de chaque barre de l'histogramme. - Ces étiquettes contiennent la valeur de chaque barre. -
    - -
  • -
  • -public Shadow $barShadow
    - Représente l'ombre associée à chaque barre de l'histogramme. -
    - -
  • -
  • -public Border $barBorder
    - La bordure à afficher autour de chaque barre de l'histogramme. -
    - -
  • -
  • -public __construct(array $values, int $identifier := 1, int $number := 1, int $depth := 0) -
    - Créé un nouvel histogramme avec les valeurs présentes dans $values. - $number représente le nombre d'histogrammes affichés en parallèle tandis que $identifier permet de spécifier où se situe l'histogramme courant. - $depth représente la profondeur de l'histogramme en pixels. - Le tableau $values doit être une liste de valeurs dans un tableau incrémental, c'est-à-dire dont les clés valent de 0 à n - 1 (où n est la taille du tableau). -
    -
    -<?php
    -
    -require_once "BarPlot.class.php";
    -
    -$graph = new Graph(400, 400);
    -
    -// Tableau de valeurs
    -$x = array(-19, 42, 31);
    -
    -$plot = new BarPlot($x);
    -$plot->setXAxisZero(TRUE);
    -$plot->setBarColor(
    -	new Color(240, 185, 130, 20)
    -);
    -	
    -$graph->add($plot);
    -$graph->draw();
    -
    -?>
    -
    -
    -
    - -
  • -
  • -public setBarPadding(float $left := NULL, float $right := NULL) -
    - Change l'espace interne de gauche et de droite sur chaque barre. - Laisser $left ou $right à NULL permet de ne pas modifier l'ancienne valeur. - Les valeurs données doivent être comprises entre 0 et 1 et représentent une fraction de l'espace réservé à chaque barre. -
    - -
  • -
  • -public setBarSize(float $size) -
    - Change la taille de chaque barre pour $size. - Les valeurs données doivent être comprises entre 0 et 1 et représentent une fraction de l'espace réservé à chaque barre. -
    - -
  • -
  • -public setBarSpace(int $space) -
    - Change l'espace entre les histogrammes affichés en parallèle pour $space. -
    - -
  • -
  • -public setBarColor(Color $color) -
    - Change la couleur des barres de l'histogrammes. -
    - -
  • -
  • -public setBarGradient(Gradient $gradient) -
    - Change le dégradé de fond des barres de l'histogramme. - Le dégradé de fond remplit le polygone définit par tous les points de la ligne additionés des points extrêmes de l'axe des abscisses. -
    -
    -<?php
    -
    -require_once "BarPlot.class.php";
    -
    -$graph = new Graph(400, 400);
    -
    -$x = array(19, 30, 31, -42, 11);
    -
    -$plot = new BarPlot($x);
    -$plot->setBarGradient(
    -	new LinearGradient(
    -		new Color(255, 20, 20, 30),
    -		new Color(20, 255, 20, 30),
    -		90
    -	)
    -);
    -
    -$plot->setYMin(-100);
    -	
    -$graph->add($plot);
    -$graph->draw();
    -
    -?>
    -
    -
    -
    - -
  • -
  • -public move(int $x, int $y) -
    - Déplace chaque barre de $x pixels sur l'horizontale et $y pixels sur la vertical avant le dessin. -
    - -
  • -
-
 
 
-
- - \ No newline at end of file diff --git a/artichow/doc/BilinearGradient.html b/artichow/doc/BilinearGradient.html deleted file mode 100644 index 2d4f3e5..0000000 --- a/artichow/doc/BilinearGradient.html +++ /dev/null @@ -1,61 +0,0 @@ - - - Documentation - - - - - -
- - - - - - - - - - - - - - - - -
  
 

Class BilinearGradient

-

- Cette classe permet de décrire un dégradé bilinéaire. Un dégradé bilinéaire à ceci de particulier par rapport au dégradé linéaire que son centre peut être décalé. -

-

- ATTENTION, les dégradés bilinéaires sont en cours de développement et ne sont pas encore disponibles sur Artichow. -

-

Méthodes et propriétés

Documentation

    -
  • -public int $center
    - Décrit la position du centre du dégradé. Cette valeur doit être comprise entre 0 et 1. -
    - -
  • -
  • -public __construct(Color $from, Color $to, int $angle, float $center := 0.5) -
    - Construit une nouveu dégradé. Cette méthode doit être appelée par toutes les classes qui dérivent de celle-ci. Le paramètre $from décrit la couleur de départ du dégradé et le paramètre $to celle de fin. Le troisième paramètre $angle décrit l'angle du dégradé. Ce peut être un dégradé horizontal (angle de 0°) ou un dégradé vertical (angle de 90°). Le dernier paramètre doit être compris entre 0 et 1 permet de spécifier le centre du dégradé. Une valeur de 0.5 signifie que le dégradé sera symétrique. -
    - -
  • -
-
 
 
-
- - \ No newline at end of file diff --git a/artichow/doc/Border.html b/artichow/doc/Border.html deleted file mode 100644 index 9e17825..0000000 --- a/artichow/doc/Border.html +++ /dev/null @@ -1,154 +0,0 @@ - - - Documentation - - - - - -
- - - - - - - - - - - - - - - - -
  
 

Class Border

-

La classe Border permet de centraliser la gestion des bordures sur Artichow.

-

Méthodes et propriétés

    -
  • -protected Color $color := new Black -
  • -
  • -protected int $style := Line::SOLID -
  • -
  • -protected bool $hide := FALSE -
  • -

Documentation

    -
  • -protected Color $color := new Black
    - La couleur de la bordure -
    - -
  • -
  • -protected int $style := Line::SOLID
    - Style de la ligne qui compose la bordure. -
    - -
  • -
  • -protected bool $hide := FALSE
    - Est-ce que la bordure doit être cachée ? -
    - -
  • -
  • -public __construct(Color $color := new Black, int $style := Line::SOLID) -
    - Déclare une nouvelle bordure de couleur $color et avec pour style $style. -
    - -
  • -
  • -public setColor(Color $color) -
    - Change la couleur de la bordure pour $color. -
    - -
  • -
  • -public setStyle(int $style) -
    - Change le style de la bordure pour $style. -
    - -
  • -
  • -public hide(bool $hide := TRUE) -
    - Détermine si la bordure doit être cachée ou non. -
    - -
  • -
  • -public show(bool $show := TRUE) -
    - Détermine si la bordure doit être affichée ou non. -
    - -
  • -
  • -public bool visible() -
    - Retourne TRUE si la bordure doit être affichée, FALSE sinon. -
    - -
  • -
  • -public rectangle(Driver $driver, Point $p1, Point $p2) -
    - Dessine la bordure sous la forme d'un rectangle dont la diagonale s'étend des points $p1 à $p2. -
    - -
  • -
  • -public ellipse(Driver $driver, Point $center, int $width, int $height) -
    - Dessine la bordure sous la forme d'une ellipse de centre $center et de largeur et hauteur respectives $width et $height. -
    - -
  • -
  • -public polygon(Driver $driver, Polygon $polygon) -
    • - Disponible depuis Artichow 1.0.9
    -
    - Dessine la bordure comme un polygone entourant celui passé en argument. -
    - -
  • -
-
 
 
-
- - \ No newline at end of file diff --git a/artichow/doc/Color.html b/artichow/doc/Color.html deleted file mode 100644 index abb4cb3..0000000 --- a/artichow/doc/Color.html +++ /dev/null @@ -1,168 +0,0 @@ - - - Documentation - - - - - -
- - - - - - - - - - - - - - - - -
  
 

Class Color

-

- La classe Color permet de gérer les couleurs de manière uniforme sur Artichow. -

-

- Afin de simplifier l'utilisation de cette classe, plusieurs couleurs sont déjà prédéfinies sur Artichow. - Chacune de ces couleurs est une classe qui dérive de Color et dont le constructeur ne prend qu'un paramètre, le degré de transparence. Voici les couleurs prédéfinies triées par ton : -

-
    -
  • -Gris : Black, AlmostBlack, VeryDarkGray, DarkGray, MidGray, LightGray, VeryLightGray, White
  • -
  • -Rouge : VeryDarkRed, DarkRed, MidRed, Red, LightRed
  • -
  • -Vert : VeryDarkGreen, DarkGreen, MidGreen, Green, LightGreen
  • -
  • -Bleu : VeryDarkBlue, DarkBlue, MidBlue, Blue, LightBlue
  • -
  • -Jaune : VeryDarkYellow, DarkYellow, MidYellow, Yellow, LightYellow
  • -
  • -Cyan : VeryDarkCyan, DarkCyan, MidCyan, Cyan, LightCyan
  • -
  • -Magenta : VeryDarkMagenta, DarkMagenta, MidMagenta, Magenta, LightMagenta
  • -
  • -Orange : DarkOrange, Orange, LightOrange, VeryLightOrange
  • -
  • -Rose : DarkPink, Pink, LightPink, VeryLightPink
  • -
  • -Violet : DarkPurple, Purple, LightPurple, VeryLightPurple
  • -
-

- Voici un exemple d'utilisation pour les couleurs prédéfinies : -

-
-<?php
-
-// On créé un bleu foncé
-$blue = new DarkBlue; // Equivalent à new Color(0, 0, 128);
-
-// On créé de l'orange transparent à 50 %
-$orange = new Orange(50); // Equivalent à new Color(255, 128, 0, 50);
-
-?>
-
-
-

-

Méthodes et propriétés

    -
  • -public __construct(int $red, int $green, int $blue, int $alpha := 0) -
  • -
  • -public brightness(int $brightness) -
  • -
  • -public array getColor() -
  • -
  • -public array rgba() -
  • -
  • -public free() -
  • -

Documentation

    -
  • -public int $red
    - Intensité en rouge de la couleur (entre 0 et 255) -
    - -
  • -
  • -public int $green
    - Intensité en vert de la couleur (entre 0 et 255) -
    - -
  • -
  • -public int $blue
    - Intensité en blue de la couleur (entre 0 et 255) -
    - -
  • -
  • -public int $alpha
    - Degré de transparence de la couleur (entre 0 et 100) -
    - -
  • -
  • -public __construct(int $red, int $green, int $blue, int $alpha := 0) -
    - Construit une nouvelle couleur. Les trois premiers paramètres représentent l'intensité en rouge, vert et bleu pour cette couleur. L'intensité de chaque couleur est un nombre compris entre 0 et 255 (du foncé vers le clair). Le paramètre $alpha représente le dégré de transparence de la couleur, et doit être compris entre 0 et 100. -
    - -
  • -
  • -public brightness(int $brightness) -
    - Change la luminosité de la couleur, en ajoutant la valeur $brightness à chaque composante (rouge, vert, bleu) de cette couleur. - $brightness peut prendre des valeurs comprises entre -255 et +255. -
    - -
  • -
  • -public array getColor() -
    - Retourne un tableau de quatre valeurs qui représentent l'intensité en rouge, vert et bleu ainsi que le degré de transparence de la couleur. -
    - -
  • -
  • -public array rgba() -
    - Retourne un tableau de quatre valeurs qui représentent l'intensité en rouge, vert et bleu ainsi que le degré de transparence de la couleur. -
    - -
  • -
  • -public free() -
    • - Supprimé à partir d'Artichow 1.1.0
    -
    - Libère les ressources allouées lors de l'appel à getColor(). -
    - -
  • -
-
 
 
-
- - \ No newline at end of file diff --git a/artichow/doc/Component.html b/artichow/doc/Component.html deleted file mode 100644 index b7f5055..0000000 --- a/artichow/doc/Component.html +++ /dev/null @@ -1,464 +0,0 @@ - - - Documentation - - - - - -
- - - - - - - - - - - - - - - - -
  
 

-abstract Class Component

-

- Un composant est un objet qui peut être ajouté à une Image. Les composants sont indépendants les uns des autres. La classe Component est une classe abstraite, dont doivent dériver tous les objets qui vont pouvoir être ajoutés sur une image. -

-

- Sur un composant, l'axe des abscisses rejoint l'axe des ordonnées sur le coin haut-gauche. Le coin haut-gauche du composant a donc pour coordonnées (0, 0) et le coin bas-droite (largeur, hauteur). Par exemple, sur une image de largeur 100 et de hauteur 50, un point à 50 sur l'axe des abscisses et 25 sur l'axe des ordonnées sera au centre de l'image. -

-
- Les classes suivantes dérivent de Component : - -

Méthodes et propriétés

Documentation

    -
  • -protected Driver $driver
    - Un objet Driver pour dessiner sur l'image. -
    - -
  • -
  • -public float $width
    - Largeur du composant entre 0 et 1. Représente une fraction de la largeur de l'image. -
    - -
  • -
  • -public float $height
    - Hauteur du composant entre 0 et 1. Représente une fraction de la hauteur de l'image. -
    - -
  • -
  • -public float $x
    - Position du composant sur l'axe des abscisses entre 0 et 1. Représente une fraction de la largeur de l'image. -
    - -
  • -
  • -public float $y
    - Position du composant sur l'axe des ordonnées entre 0 et 1. Représente une fraction de la hauteur de l'image. - Attention, la position 0 correspond au haut de l'image. -
    - -
  • -
  • -public int $w
    - Largeur du composant en pixels. -
    - -
  • -
  • -public int $h
    - Hauteur du composant en pixels. -
    - -
  • -
  • -public int $top
    - Position du composant sur l'axe des ordonnées en pixels. -
    - -
  • -
  • -public int $left
    - Position du composant sur l'axe des abscisses en pixels. -
    - -
  • -
  • -protected mixed $background
    - Fond du composant. Peut être une couleur, un dégradé ou peut être laissé à NULL pour ne spécifier aucune couleur de fond. -
    - -
  • -
  • -public Side $padding
    - Espace interne du composant. -
    - -
  • -
  • -public Side $space
    - Espace interne dans la zone de dessin effective du composant. Les valeurs doivent être données en pourcentage de la taille de la zone de dessin. - Le zone de dessin est la zone dans laquelle est dessiné le composant, c'est-à-dire la zone du composant amputée des axes et de l'espace interne. -
    - -
  • -
  • -protected bool $auto
    - Doit-on ajuster automatiquement le composant ? -
    - -
  • -
  • -public Label $title
    - Le titre du composant. - Si un titre est spécifié, il sera affiché sur l'image. -
    - -
  • -
  • -public Legend $legend
    - La légende associée au composant. -
    - -
  • -
  • -public __construct() -
    - Construit le composant en lui affectant une taille égale à celle de l'image et en le positionnant au centre de cette image. - Le composant remplit donc toute la surface de l'image. -
    - -
  • -
  • -public auto(bool $auto) -
    - TRUE si le composant doit être automatiquement ajusté, FALSE sinon. - La notion d'ajustage automatique est propre à chaque classe qui dérive de celle-ci. - Par exemple, sur les histogrammes, si le composant n'est pas automatiquement ajusté, alors les barres ne seront pas centrées sur zéro mais sur leur valeur minimum. -
    - -
  • -
  • -public setSize(float $width, float $height) -
    - Change la largeur $width et la hauteur $height du composant. - Les nouvelles valeurs doivent être comprises entre 0 et 1 et correspondent à une fraction des largeur et hauteur de l'image à laquelle le composant appartient. -
    -
    -<?php
    -
    -require_once "LinePlot.class.php";
    -
    -$graph = new Graph(400, 400);
    -
    -// LinePLot dérive de Component
    -$plot = new LinePlot(array(1, 2, 3));
    -
    -// Le taille du composant sera 1 / 3 de celle de l'image, soit 133x133 pixels
    -$plot->setSize(1 / 3, 1 / 3);
    -	
    -$graph->add($plot);
    -$graph->draw();
    -
    -?>
    -
    -
    -
    - -
  • -
  • -public setAbsSize(int $w, int $h) -
    - Donne une taille absolue au composant. - La largeur $width et la hauteur $height doivent être données en pixels. -
    - -
  • -
  • -public setBackgroundColor(Color $color) -
    - Change la couleur de fond du composant. -
    - -
  • -
  • -public setBackgroundGradient(Gradient $gradient) -
    - Change le dégradé de fond du composant. -
    - -
  • -
  • -public setBackgroundImage(Image $image) -
    - Change l'image de fond du composant. -
    - -
  • -
  • -public mixed getBackground(int $type) -
    - Retourne le fond de l'image. Cela peut être une couleur, un dégradé ou encore une image. Si aucun fond n'a été spécifié, cette méthode retourne NULL. -
    - -
  • -
  • -public setPadding(int $left := NULL, int $right := NULL, int $top := NULL, int $bottom := NULL) -
    - Change l'espace interne du composant. - Les valeurs doivent être données en pixels. -
    - -
  • -
  • -public setSpace(int $left := NULL, int $right := NULL, int $top := NULL, int $bottom := NULL) -
    - Change l'espace interne dans la zone de dessin effective du composant. Les valeurs doivent être données en pourcentage de la taille de la zone de dessin. - Le zone de dessin est la zone dans laquelle est dessiné le composant, c'est-à-dire la zone du composant amputée des axes et de l'espace interne. -
    -
    -<?php
    -
    -require_once "LinePlot.class.php";
    -
    -$graph = new Graph(400, 400);
    -
    -$plot = new LinePlot(array(43, 23, 65, 37));
    -$plot->setSpace(10, 10, 20, 20);
    -
    -$graph->add($plot);
    -$graph->draw();
    -
    -?>
    -
    -
    -
    - -
  • -
  • -public setCenter(float $x, float $y) -
    - Change la position du centre du composant sur l'image. - Les nouvelles positions $x et $y représentent une fraction des largeur et hauteur de l'image. - Attention, la position 0 pour $y place le centre du composant en haut de l'image. La position 1 le place en bas de l'image. -
    -
    -<?php
    -
    -require_once "LinePlot.class.php";
    -
    -$graph = new Graph(400, 400);
    -
    -// LinePLot dérive de Component
    -$plot = new LinePlot(array(1, 2, 3));
    -
    -// Le taille du composant sera 1 / 3 de celle de l'image, soit 133x133 pixels
    -$plot->setSize(1 / 3, 1 / 3);
    -// Place le composant en haut à gauche
    -$plot->setCenter(1 / 6, 1 / 6);
    -	
    -$graph->add($plot);
    -$graph->draw();
    -
    -?>
    -
    -
    -
    - -
  • -
  • -public setAbsPosition(int $left, int $top) -
    - Change la position du composant sur l'image. - Contrairement à setCenter(), cette méthode ne place pas le composant par rapport à son centre, mais par rapport à son coin haut-gauche. Les positions $left à gauche et $top pour la hauteur doivent être données en pixels. - Attention, la position 0 pour $top place le composant en haut de l'image. -
    -
    -<?php
    -
    -require_once "LinePlot.class.php";
    -
    -$graph = new Graph(400, 400);
    -
    -// LinePLot dérive de Component
    -$plot = new LinePlot(array(1, 2, 3));
    -
    -// Le taille du composant sera 1 / 3 de celle de l'image, soit 133x133 pixels
    -$plot->setSize(1 / 3, 1 / 3);
    -// Place le composant en haut à gauche
    -$plot->setAbsPosition(0, 0);
    -	
    -$graph->add($plot);
    -$graph->draw();
    -
    -?>
    -
    -
    -
    - -
  • -
  • -public init(Driver $driver) -
    - Initialise le composant avant son affichage. -
    - -
  • -
  • -public finalize(Driver $driver) -
    - Finalize l'affichage du composant. -
    - -
  • -
  • -abstract public array getPosition(Driver $driver) -
    - Retourne la position de la zone de dessin effective du composant. - Les coordonnées doivent être retournées sous la forme d'un tableau de quatre valeurs. - Les première et deuxième valeurs sont les positions en abscisse et en ordonnée du coin haut-gauche de la zone de dessin. - Les troisième et quatrième valeurs sont les positions en abscisse et en ordonnée du coin bas-droit de la zone de dessin. -
    - -
  • -
  • -abstract public drawEnvelope(Driver $driver) -
    - Dessine l'enveloppe autour de la zone de dessin effective du composant. - Cette enveloppe comprend généralement les axes et la grille du composant. -
    - -
  • -
  • -abstract public drawComponent(Driver $driver, int $x1, int $y1, int $x2, int $y2, bool $aliasing) -
    - Dessine effectivement le composant, c'est-à-dire le graphique. - Le paramètre $aliasing est à TRUE si l'anti-aliasing est activé, FALSE sinon. -
    - -
  • -
  • -protected getSpace(int $width, int $height) -
    - Convertit l'espace interne du composant de pourcentages en pixels, en fonction de la taille $width et de la hauteur $height, exprimées en pixels. -
    - -
  • -
-
 
 
-
- - \ No newline at end of file diff --git a/artichow/doc/ComponentGroup.html b/artichow/doc/ComponentGroup.html deleted file mode 100644 index 5d55738..0000000 --- a/artichow/doc/ComponentGroup.html +++ /dev/null @@ -1,72 +0,0 @@ - - - Documentation - - - - - -
- - - - - - - - - - - - - - - - -
  
 

-abstract Class ComponentGroup

-

- Un groupe de composant permet de gérer plusieurs composants. - Cette classe est abstraite et doit être redéfinit pour être utilisée avec les composants que vous aurez choisis. -

-
- Les classes suivantes dérivent de ComponentGroup : - -

Méthodes et propriétés

Documentation

-
 
 
-
- - \ No newline at end of file diff --git a/artichow/doc/Drawer.html b/artichow/doc/Drawer.html deleted file mode 100644 index b050cf5..0000000 --- a/artichow/doc/Drawer.html +++ /dev/null @@ -1,425 +0,0 @@ - - - Documentation - - - - - -
- - - - - - - - - - - - - - - - -
  
 

Class Driver

-

- La classe Driver est une couche d'abstraction à GD et permet de dessiner toutes sortes de formes géométriques sur une Image. -

-

- Sur une image, l'axe des abscisses rejoint l'axe des ordonnées sur le coin haut-gauche. Le coin haut-gauche de l'image a donc pour coordonnées (0, 0) et le coin bas-droite (largeur, hauteur). Par exemple, sur une image de largeur 100 et de hauteur 50, un point à 50 sur l'axe des abscisses et 25 sur l'axe des ordonnées sera au centre de l'image. -

-

Méthodes et propriétés

Documentation

    -
  • -public resource $resource
    - La ressource GD utilisée par le pilote. -
    - -
  • -
  • -public int $imageWidth
    - La largeur de l'image gérée par le pilote. -
    - -
  • -
  • -public int $imageHeight
    - La hauteur de l'image gérée par le pilote. -
    - -
  • -
  • -protected bool $antiAliasing := FALSE
    - Doit-on utiliser l'anti-aliasing sur ce dessin ? -
    - -
  • -
  • -public __construct() -
    - Construit le pilote. -
    - -
  • -
  • -public init(Image $image) -
    • - Disponible depuis Artichow 1.1.0
    -
    - Crée la ressource GD dont a besoin le Driver pour dessiner l'Image. -
    - -
  • -
  • -public initFromFile(FileImage $fileImage, string $file) -
    • - Disponible depuis Artichow 1.1.0
    -
    - Crée la ressource GD dont a besoin le Driver à partir d'un fichier déjà existant dont le nom est $file. -
    - -
  • -
  • -public setImageSize(int $width, int $height) -
    - Change la taille de l'image gérée par le pilote pour la largeur $width et la hauteur $height. -
    - -
  • -
  • -public setPosition(float $x, float $y) -
    - Informe le pilote de la position de la sous-image sur l'image. - Les positions X et Y sont données via les paramètres $x et $y, qui représentent une fraction de la taille de l'image. -
    - -
  • -
  • -public movePosition(int $x, int $y) -
    - Demande au pilote de déplacer la position de la sous-image sur l'image. - $x et $y représentent respectivement les déplacements latéral et vertical de la position en pixels. -
    - -
  • -
  • -public setAbsPosition(int $x, int $y) -
    - Informe le pilote de la position de la sous-image sur l'image. - Les positions X et Y sont données via les paramètres $x et $y, dont l'unité est le pixel. -
    - -
  • -
  • -public setSize(float $w, float $h) -
    - Informe le pilote de la taille de la sous-image sur l'image. - Les largeur et hauteur de la sous-image sont données via les paramètres $w et $h, qui représentent une fraction de la taille de l'image. -
    - -
  • -
  • -public setAbsSize(int $w, int $h) -
    - Informe le pilote de la taille de la sous-image sur l'image. - Les largeur et hauteur de la sous-image sont données via les paramètres $w et $h, dont l'unité est le pixel. -
    - -
  • -
  • -public array getSize() -
    - Retourne la taille de la sous-image en pixels. - Les valeurs sont retournées sous la forme d'un tableau, de la forme array(largeur, hauteur). -
    - -
  • -
  • -public int getColor(Color $color) -
    - Retourne la couleur sous la forme d'un entier numérique, utilisable ensuite avec les fonctions GD de PHP. -
    - -
  • -
  • -public send(Image $image) -
    - Construit l'image passée en paramètre et l'envoie sur la sortie standard accompagnée des en-têtes HTTP correspondants. - A aucun moment vous ne devriez avoir besoin d'appeler vous-même cette méthode. Pour générez les images, utilisez Graph::draw(). -
    - -
  • -
  • -public get(Image $image) -
    • - Disponible depuis Artichow 1.1.0
    -
    - Construit l'image passée en paramètre et la renvoie sous forme de données binaires. Vous pouvez donc la stocker dans une variable si vous voulez faire des manipulations spécifiques. - A aucun moment vous ne devriez avoir besoin d'appeler vous-même cette méthode. Pour générez les images, utilisez Graph::draw(). -
    - -
  • -
  • -public setAntiAliasing(bool $bool) -
    • - Disponible depuis Artichow 1.0.9
    -
    - Active ou désactive l'anti-aliasing lors du dessin. - L'anti-aliasing permet d'avoir des graphiques plus propres mais demande plus de ressources. - L'anti-aliasing n'est pas activé par défaut. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public copyImage(Image $image, Point $p1, Point $p2) -
    - Copie l'image $image vers la sous-image courante. - L'image sera copiée sur la sous-image du point $p1 (coin haut-gauche) ou point $p2 (coin bas-droit). - Les coordonnées de $p1 et $p2 doivent être relatives à celles de la sous-image. -
    - -
  • -
  • -public copyResizeImage(Image $image, Point $d1, Point $d2, Point $s1, Point $s2, bool $resampled) -
    - Copie l'image $image vers l'image courante. - L'image $image sera copiée des points $s1 (coin haut-gauche) et $s2 (coin bas-droit) vers les points $d1 (coin haut-gauche) et $d2 (coin bas-droit) de l'image courante. - Si $resampled est placé à TRUE, l'image sera rééchantillonée. -
    - -
  • -
  • -public string(Text $text, Point $point, int $width := NULL) -
    - Dessine la chaîne de caractères $text à partir du point $point. - Les coordonnées de $point doivent être relatives à celles de la sous-image. - Le paramètre $width permet de spécifier la largeur maximale en pixels de la boîte de texte. - -
    - -
  • -
  • -public point(Color $color, Point $point) -
    - Dessine un pixel de couleur $color au point $point. - Les coordonnées de $point doivent être relatives à celles de la sous-image. -
    - -
  • -
  • -public line(Color $color, Line $line) -
    - Dessine la ligne $line de couleur $color. - Les coordonnées de la ligne doivent être relatives à celles de la sous-image. -
    - -
  • -
  • -public arc(Color $color, Point $center, int $width, int $height, float $from, float $to) -
    - Dessine un arc d'ellipse de couleur $color dont les deux extrémités sont reliées au centre de l'ellipse. - L'ellipse a pour centre $center et est de largeur et hauteur respectives $width et $height. - L'angle de départ pour l'arc est $from et l'angle d'arrivée $to. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public filledArc(mixed $background, Point $center, int $width, int $height, float $from, float $to) -
    - Dessine un arc d'ellipse dont les deux extrémités sont reliées au centre de l'ellipse et le remplit avec la couleur ou le dégradé $background. - L'ellipse a pour centre $center et est de largeur et hauteur respectives $width et $height. - L'angle de départ pour l'arc est $from et l'angle d'arrivée $to. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public ellipse(Color $color, Point $center, int $width, int $height) -
    - Dessine une ellipse de couleur $color, ayant pour centre $center et de largeur et hauteur respectives $width et $height. - Les coordonnées de l'ellipse doivent être relatives à celles de la sous-image. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public filledEllipse(mixed $background, Point $center, int $width, int $height) -
    - Dessine et remplit une ellipse avec la couleur ou le dégradé $background. Cette ellipse a pour centre $center et est de largeur et hauteur respectives $width et $height. - Les coordonnées de l'ellipse doivent être relatives à celles de la sous-image. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public rectangle(Color $color, Point $p1, Point $p2) -
    - Dessine un rectangle de couleur $color des points $p1 à $p2 (le segment qui relie ces points représente la diagonale du rectangle). - Les coordonnées du rectangle doivent être relatives à celles de la sous-image. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public filledRectangle(mixed $background, Point $p1, Point $p2) -
    - Dessine et remplit un rectangle avec la couleur ou le dégradé $background des points $p1 à $p2 (le segment qui relie ces points représente la diagonale du rectangle). - Les coordonnées du rectangle doivent être relatives à celles de la sous-image. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public polygon(Color $color, Polygon $polygon) -
    - Dessine le polygone $polygon de couleur $color. - Les coordonnées de chaque point du polygone doivent être relatives à celles de la sous-image. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public filledPolygon(mixed $background, Polygon $polygon) -
    - Dessine et remplit le polygone $polygon avec la couleur ou le dégradé $background. - Les coordonnées de chaque point du polygone doivent être relatives à celles de la sous-image. -
    - Voir aussi : - -
    -
    - -
  • -
-
 
 
-
- - \ No newline at end of file diff --git a/artichow/doc/Driver.html b/artichow/doc/Driver.html deleted file mode 100644 index 34f7923..0000000 --- a/artichow/doc/Driver.html +++ /dev/null @@ -1,494 +0,0 @@ - - - Documentation - - - - - -
- - - - - - - - - - - - - - - - -
  
 

Class Driver

-

- La classe abstraite Driver rassemble toutes les méthodes permettant de dessiner sur une Image. Cette classe ne contient aucune implémentation. Celle-ci doit être effectué à l'intérieur de chaque pilote dérivant de Driver. -

-

- Sur une image, l'axe des abscisses rejoint l'axe des ordonnées sur le coin haut-gauche. Le coin haut-gauche de l'image a donc pour coordonnées (0, 0) et le coin bas-droite (largeur, hauteur). Par exemple, sur une image de largeur 100 et de hauteur 50, un point à 50 sur l'axe des abscisses et 25 sur l'axe des ordonnées sera au centre de l'image. -

-
- Les classes suivantes dérivent de Driver : - -

Méthodes et propriétés

Documentation

    -
  • -public int $imageWidth
    - La largeur de l'image gérée par le pilote. -
    - -
  • -
  • -public int $imageHeight
    - La hauteur de l'image gérée par le pilote. -
    - -
  • -
  • -protected bool $antiAliasing := FALSE
    - Doit-on utiliser l'anti-aliasing sur ce dessin ? -
    - -
  • -
  • -protected string $driverString
    - Représente le type du pilote sous forme de chaîne. -
    - -
  • -
  • -protected PHPFontDriver $phpFontDriver
    - Un objet PHPFontDriver gérant l'affichage et les calculs sur les polices de type PHPFont. -
    - -
  • -
  • -protected FileFontDriver $fileFontDriver
    - Un objet FileFontDriver gérant l'affichage et les calculs sur les polices de type FileFont. -
    - -
  • -
  • -public __construct() -
    - Construit le pilote. - Instancie les FontDriver et initialise la propriété driverString. -
    - -
  • -
  • -public init(Image $image) -
    • - Disponible depuis Artichow 1.1
    -
    - Initialise le pilote pour l'Image $image. -
    - -
  • -
  • -public initFromFile(FileImage $fileImage, string $file) -
    • - Disponible depuis Artichow 1.1
    -
    - Initialise le pilote à partir d'une FileImage $fileImage. - Le chemin d'accès au fichier proprement dit est contenu dans $file. -
    - -
  • -
  • -public setImageSize(int $width, int $height) -
    - Change la taille de l'image gérée par le pilote pour la largeur $width et la hauteur $height. -
    - -
  • -
  • -public setPosition(float $x, float $y) -
    - Informe le pilote de la position de la sous-image sur l'image. - Les positions X et Y sont données via les paramètres $x et $y, qui représentent une fraction de la taille de l'image. -
    - -
  • -
  • -public movePosition(int $x, int $y) -
    - Demande au pilote de déplacer la position de la sous-image sur l'image. - $x et $y représentent respectivement les déplacements latéral et vertical de la position en pixels. -
    - -
  • -
  • -public setAbsPosition(int $x, int $y) -
    - Informe le pilote de la position de la sous-image sur l'image. - Les positions X et Y sont données via les paramètres $x et $y, dont l'unité est le pixel. -
    - -
  • -
  • -public setSize(float $w, float $h) -
    - Informe le pilote de la taille de la sous-image sur l'image. - Les largeur et hauteur de la sous-image sont données via les paramètres $w et $h, qui représentent une fraction de la taille de l'image. -
    - -
  • -
  • -public setAbsSize(int $w, int $h) -
    - Informe le pilote de la taille de la sous-image sur l'image. - Les largeur et hauteur de la sous-image sont données via les paramètres $w et $h, dont l'unité est le pixel. -
    - -
  • -
  • -public array getSize() -
    - Retourne la taille de la sous-image en pixels. - Les valeurs sont retournées sous la forme d'un tableau, de la forme array(largeur, hauteur). -
    - -
  • -
  • -public mixed getColor(Color $color) -
    - Convertit un objet Color pour qu'il soit exploitable directement par les fonctions de dessins employées par le pilote. - Le type de donnée renvoyée dépend du pilote. -
    - -
  • -
  • -public send(Image $image) -
    - Construit l'image passée en paramètre et l'envoie sur la sortie standard accompagnée des en-têtes HTTP correspondants. - A aucun moment vous ne devriez avoir besoin d'appeler vous-même cette méthode. Pour générez les images, utilisez Graph::draw(). -
    - -
  • -
  • -public get(Image $image) -
    • - Disponible depuis Artichow 1.1
    -
    - Construit l'image passée en paramètre et la renvoie sous forme de données binaires. Vous pouvez donc la stocker dans une variable si vous voulez faire des manipulations spécifiques. - A aucun moment vous ne devriez avoir besoin d'appeler vous-même cette méthode. Pour générez les images, utilisez Graph::draw(). -
    - -
  • -
  • -public setAntiAliasing(bool $bool) -
    • - Disponible depuis Artichow 1.0.9
    -
    - Active ou désactive l'anti-aliasing lors du dessin. - L'anti-aliasing permet d'avoir des graphiques plus propres mais demande plus de ressources. - L'anti-aliasing n'est pas activé par défaut. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public copyImage(Image $image, Point $p1, Point $p2) -
    - Copie l'image $image vers la sous-image courante. - L'image sera copiée sur la sous-image du point $p1 (coin haut-gauche) ou point $p2 (coin bas-droit). - Les coordonnées de $p1 et $p2 doivent être relatives à celles de la sous-image. -
    - -
  • -
  • -public copyResizeImage(Image $image, Point $d1, Point $d2, Point $s1, Point $s2, bool $resampled) -
    - Copie l'image $image vers l'image courante. - L'image $image sera copiée des points $s1 (coin haut-gauche) et $s2 (coin bas-droit) vers les points $d1 (coin haut-gauche) et $d2 (coin bas-droit) de l'image courante. - Si $resampled est placé à TRUE, l'image sera rééchantillonée. -
    - -
  • -
  • -public string(Text $text, Point $point, int $width := NULL) -
    - Dessine la chaîne de caractères $text à partir du point $point. - Les coordonnées de $point doivent être relatives à celles de la sous-image. - Le paramètre $width permet de spécifier la largeur maximale en pixels de la boîte de texte. - -
    - -
  • -
  • -public point(Color $color, Point $point) -
    - Dessine un pixel de couleur $color au point $point. - Les coordonnées de $point doivent être relatives à celles de la sous-image. -
    - -
  • -
  • -public line(Color $color, Line $line) -
    - Dessine la ligne $line de couleur $color. - Les coordonnées de la ligne doivent être relatives à celles de la sous-image. -
    - -
  • -
  • -public arc(Color $color, Point $center, int $width, int $height, float $from, float $to) -
    - Dessine un arc d'ellipse de couleur $color dont les deux extrémités sont reliées au centre de l'ellipse. - L'ellipse a pour centre $center et est de largeur et hauteur respectives $width et $height. - L'angle de départ pour l'arc est $from et l'angle d'arrivée $to. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public filledArc(mixed $background, Point $center, int $width, int $height, float $from, float $to) -
    - Dessine un arc d'ellipse dont les deux extrémités sont reliées au centre de l'ellipse et le remplit avec la couleur ou le dégradé $background. - L'ellipse a pour centre $center et est de largeur et hauteur respectives $width et $height. - L'angle de départ pour l'arc est $from et l'angle d'arrivée $to. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public ellipse(Color $color, Point $center, int $width, int $height) -
    - Dessine une ellipse de couleur $color, ayant pour centre $center et de largeur et hauteur respectives $width et $height. - Les coordonnées de l'ellipse doivent être relatives à celles de la sous-image. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public filledEllipse(mixed $background, Point $center, int $width, int $height) -
    - Dessine et remplit une ellipse avec la couleur ou le dégradé $background. Cette ellipse a pour centre $center et est de largeur et hauteur respectives $width et $height. - Les coordonnées de l'ellipse doivent être relatives à celles de la sous-image. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public rectangle(Color $color, Line $line) -
    - Dessine un rectangle de couleur $color dont la ligne $line représente la diagonale. - Les coordonnées du rectangle doivent être relatives à celles de la sous-image. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public filledRectangle(mixed $background, Line $line) -
    - Dessine et remplit un rectangle avec la couleur ou le dégradé $background dont la ligne $line représente la diagonale. - Les coordonnées du rectangle doivent être relatives à celles de la sous-image. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public polygon(Color $color, Polygon $polygon) -
    - Dessine le polygone $polygon de couleur $color. - Les coordonnées de chaque point du polygone doivent être relatives à celles de la sous-image. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public filledPolygon(mixed $background, Polygon $polygon) -
    - Dessine et remplit le polygone $polygon avec la couleur ou le dégradé $background. - Les coordonnées de chaque point du polygone doivent être relatives à celles de la sous-image. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public float getTextWidth(Text $text) -
    • - Disponible depuis Artichow 1.1
    -
    - Renvoie la largeur prise sur l'image par le Text $text. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public float getTextHeight(Text $text) -
    • - Disponible depuis Artichow 1.1
    -
    - Renvoie la hauteur prise sur l'image par le Text $text. -
    - Voir aussi : - -
    -
    - -
  • -
  • -protected bool isCompatibleWithFont(Font $font) -
    • - Disponible depuis Artichow 1.1
    -
    - Renvoie TRUE si le pilote actuel est compatible avec la police $font, FALSE sinon. - Chaque pilote doit définir les polices avec lesquelles il est compatible. -
    - -
  • -
-
 
 
-
- - \ No newline at end of file diff --git a/artichow/doc/FileFont.html b/artichow/doc/FileFont.html deleted file mode 100644 index dd687f9..0000000 --- a/artichow/doc/FileFont.html +++ /dev/null @@ -1,214 +0,0 @@ - - - Documentation - - - - - -
- - - - - - - - - - - - - - - - -
  
 

Class FileFont

-

- La classe FileFont permet de gérer les polices représentée par un fichier, donc externe à PHP. - Quelques polices sont disponibles dans le répertoire font/ de Artichow. - Si vous connaissez d'autres polices intéressantes et dans le domaine public, n'hésitez pas à le signaler à vincent sur artichow point org. -

-

- Afin de simplifier l'utilisation de cette classe, plusieurs polices sont déjà prédéfinies sur Artichow. - Chacune de ces polices est une classe qui dérive de FileFont et dont le constructeur ne prend qu'un paramètre, la taille de la police. Voici les polices prédéfinies : -

-
    -
  • -Famille Tuffy : Tuffy, TuffyBold, TuffyItalic, TuffyBoldItalic
  • -
-

- Voici un exemple d'utilisation pour les polices prédéfinies : -

-
-<?php
-
-// On utilise Tuffy de taille 12
-// Equivalent à new FileFont(ARTICHOW_FONT.'/Tuffy.ttf', 12);
-$blue = new Tuffy(12);
-
-// On utilise Tuffy en italique taille 42
-// Equivalent à new FileFont(ARTICHOW_FONT.'/TuffyItalic.ttf', 42);
-$orange = new TuffyItalic(42);
-
-?>
-
-
-

-
- Les classes suivantes dérivent de FileFont : - -

Méthodes et propriétés

Documentation

    -
  • -public string $name
    - Le nom du fichier contenant la police, sans l'extension. -
    - -
  • -
  • -public int $size
    - La taille de la police, en pixels. -
    - -
  • -
  • -public string $extension
    - L'extension du fichier. Cette propriété est utile si deux polices pouvant être utilisé par plusieurs pilotes doivent avoir une extension différente selon le cas. Voir à ce sujet le classe TTFFont. -
    - -
  • -
  • -public __construct(string $name, int $size) -
    - Construit la police de nom $name et de taille $size. - Le nom doit être soit un chemin d'accès absolu, soit un simple nom de fichier. Dans ce dernier cas, la police correspondante sera recherchée dans le dossier font/ d'Artichow. -
    - -
  • -
  • -public setName(string $name) -
    • - Disponible depuis Artichow 1.1
    -
    - Définit le nom du fichier contenant les informations de la police. - Ce nom doit être soit un chemin d'accès absolu, soit un simple nom de fichier. Dans ce dernier cas, la police correspondante sera recherchée dans le dossier font/ d'Artichow. -
    - -
  • -
  • -public string getName() -
    • - Disponible depuis Artichow 1.1
    -
    - Renvoie l'extension du fichier contenant les informations de la police. -
    - -
  • -
  • -public setSize(int $size) -
    • - Disponible depuis Artichow 1.1
    -
    - Définit la taille de la police, en pixels. -
    - -
  • -
  • -public int getSize() -
    • - Disponible depuis Artichow 1.1
    -
    - Renvoie la taille de la police, en pixels. -
    - -
  • -
  • -public setExtension(string $extension) -
    • - Disponible depuis Artichow 1.1
    -
    - Définit l'extension du fichier contenant les informations de la police. -
    - -
  • -
  • -public string getExtension() -
    • - Disponible depuis Artichow 1.1
    -
    - Renvoie l'extension du fichier contenant les informations de la police. -
    - -
  • -
  • -public getTextWidth(Text $text) -
    • - Supprimé à partir d'Artichow 1.1
    -
    - Renvoie la largeur en pixels occupée par l'objet Text $text. -
    - Voir aussi : - -
    -
    - -
  • -
  • -public getTextHeight(Text $text) -
    • - Supprimé à partir d'Artichow 1.1
    -
    - Renvoie la hauteur en pixels occupée par l'objet Text $text. -
    - Voir aussi : - -
    -
    - -
  • -
-
 
 
-
- - \ No newline at end of file diff --git a/artichow/doc/FileFontDriver.html b/artichow/doc/FileFontDriver.html deleted file mode 100644 index ef5daa1..0000000 --- a/artichow/doc/FileFontDriver.html +++ /dev/null @@ -1,40 +0,0 @@ - - - Documentation - - - - - -
- - - - - - - - - - - - - - - - -
  
 

Class FileFontDriver

-

- La classe FileFontDriver s'occupe des calculs et de l'affichage liés aux polices de type FileFont. -

-

- A aucun moment vous ne devriez avoir à instancier un objet de ce type. La documentation est là à titre informatif pour les développeurs en herbe. -

-

Méthodes et propriétés

Documentation

    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/FileImage.html b/artichow/doc/FileImage.html deleted file mode 100644 index 5411710..0000000 --- a/artichow/doc/FileImage.html +++ /dev/null @@ -1,47 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class FileImage

    -

    - La classe FileImage permet de charger une image existante à partir d'un fichier. L'image ainsi créée peut être utilisée avec un Driver pour être copiée sur une autre image par exemple. -

    -

    Méthodes et propriétés

    Documentation

    • -public __construct(string - $file) -
      - Construit l'image à partir de l'image contenue dans le fichier $file. -
      - -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/Font.html b/artichow/doc/Font.html deleted file mode 100644 index 9cf440c..0000000 --- a/artichow/doc/Font.html +++ /dev/null @@ -1,96 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class Font

    -

    - La classe abstraite Font permet de gérer les polices de manière uniforme sur Artichow. -

    -
    - Les classes suivantes dérivent de Font : - -

    Méthodes et propriétés

    Documentation

      -
    • -public __construct() -
      - Construit la police. -
      - -
    • -
    • -public draw(Driver $driver, Point $point, Text $text, int $width := NULL) -
      - Dessine avec la police courante le texte $text. - Le pilote $driver sera utilisé pour le dessin tandis que le texte sera positionné au point $point. - Le paramètre $width permet de spécifier la largeur maximale en pixels de la boîte de texte. -
      - -
    • -
    • -public float getTextWidth(Text $text) -
      • - Supprimé à partir d'Artichow 1.1
      -
      - Retourne la largeur en pixels occupée par l'objet Text $text. -
      - Voir aussi : - -
      -
      - -
    • -
    • -public float getTextHeight(Text $text) -
      • - Supprimé à partir d'Artichow 1.1
      -
      - Retourne la hauteur en pixels occupée par l'objet Text $text. -
      - Voir aussi : - -
      -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/FontDriver.html b/artichow/doc/FontDriver.html deleted file mode 100644 index db3e639..0000000 --- a/artichow/doc/FontDriver.html +++ /dev/null @@ -1,107 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class FontDriver

    -

    - La classe abstraite FontDriver définit toutes les méthodes devant être implémentées pour gérer l'affichage et les calculs à effectuer sur les polices. On dérivera cette classe une fois pour chaque classe enfant de Font, en l'occurence PHPFontDriver pour PHPFont et FileFontDriver pour FileFont. -

    -

    - A aucun moment vous ne devriez avoir à instancier un objet de ce type. La documentation est là à titre informatif pour les développeurs en herbe. -

    -
    - Les classes suivantes dérivent de FontDriver : - -

    Méthodes et propriétés

    Documentation

    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/GDDriver.html b/artichow/doc/GDDriver.html deleted file mode 100644 index 80bbada..0000000 --- a/artichow/doc/GDDriver.html +++ /dev/null @@ -1,72 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class GDDriver

    -

    - La classe GDDriver est une implémentation de Driver qui repose sur la bibliothèque GD. C'est le pilote par défaut utilisé par Artichow, PHP doit donc être compilé avec le support de GD pour que tout fonctionne. -

    -

    - Seules seront mentionnées ici les méthodes dont l'implémentation pourrait avoir un comportement spécifique. Pour le reste, veuillez vous référer à la doc de la classe parente Driver. -

    -

    Méthodes et propriétés

    Documentation

      -
    • -public resource $resource
      - La ressource GD contenant le dessin. -
      - -
    • -
    • -public __construct() -
      - Construit le pilote. - Instancie les FontDriver et initialise la propriété driverString à 'gd'. -
      - -
    • -
    • -public int getColor(Color $color) -
      - Convertit un objet Color pour qu'il soit exploitable directement par les fonctions de dessins de GD. - Renvoie un entier identifiant la couleur aux yeux de GD. -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/Gradient.html b/artichow/doc/Gradient.html deleted file mode 100644 index d8267f1..0000000 --- a/artichow/doc/Gradient.html +++ /dev/null @@ -1,82 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    -abstract Class Gradient

    -

    - Toutes les classes qui décrivent un dégradé dérivent de cette classe abstraite. -

    -
    - Les classes suivantes dérivent de Gradient : - -

    Méthodes et propriétés

    Documentation

      -
    • -public Color $from
      - La couleur de départ pour le dégradé -
      - -
    • -
    • -public Color $to
      - La couleur d'arrivée pour le dégradé -
      - -
    • -
    • -public __construct(Color $from, Color $to) -
      - Construit une nouveu dégradé. Cette méthode doit être appelée par toutes les classes qui dérivent de celle-ci. Le paramètre $from décrit la couleur de départ du dégradé et le paramètre $to celle de fin. -
      - -
    • -
    • -public free() -
      - Libère les ressources allouées lors de la création du dégradé. -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/Graph.html b/artichow/doc/Graph.html deleted file mode 100644 index a376768..0000000 --- a/artichow/doc/Graph.html +++ /dev/null @@ -1,214 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class Graph

    -

    - La classe Graph permet de générer des graphiques, de les mettre éventuellement en cache et d'afficher le temps de génération de l'image. Il est possible de dessiner plusieurs composants sur une image de type Graph. -

    -

    Méthodes et propriétés

    Documentation

      -
    • -const int DRAW_RETURN := 1
      - Pour retourner le graphique après du dessin. -
      - Voir aussi : - -
      -
      - -
    • -
    • -const int DRAW_DISPLAY := 2
      - Pour afficher le graphique après du dessin. -
      - Voir aussi : - -
      -
      - -
    • -
    • -protected string $name := NULL
      - Nom du graphique. - Peut être laissé à NULL pour ne donner aucun nom au graphique. -
      - -
    • -
    • -protected int $timeout := 0
      - Peut prendre comme valeur 0 pour ne pas utiliser la mise en cache, ou spécifier un timestamp comme date d'expiration de l'image dans le cache. -
      - -
    • -
    • -protected bool $timing := FALSE
      - Activer l'affichage du temps de génération de l'image ? -
      - -
    • -
    • -protected array $labels
      - Une liste de Label qui seront affichés sur le graphique. -
      - -
    • -
    • -public Label $title
      - Permet de donner un titre au graphique. -
      - -
    • -
    • -public __construct(int $width := NULL, int $height := NULL, string $name := NULL, string $timeout := 0) -
      - Construit une image de largeur $width et de hauteur $height au nom $name (ce nom peut être laissé à NULL) et qui expirera dans le cache au timestamp $timeout. Si vous ne souhaitez pas utiliser le cache, vous pouvez laisser ce timestamp à 0. - $name ne représente pas le titre du graphique, c'est uniquement un moyen d'identification pour le cache. -
      - -
    • -
    • -public bool deleteFromCache(string $name) -
      - Supprime manuellement l'image au nom $name du cache. - Cette méthode retourne TRUE si une image a été effectivement supprimée, FALSE sinon. -
      - -
    • -
    • -public deleteAllCache() -
      - Supprime toutes les images mises en cache par Artichow. -
      - -
    • -
    • -public setTiming(bool $timing) -
      - Active/désactive l'affichage du temps de génération de l'image sur l'image elle-même. -
      - -
    • -
    • -public add(Component $component) -
      - Ajoute un composant à dessiner sur l'image. -
      - -
    • -
    • -public addLabel(Label $label, int $x, int $y) -
      - Ajoute une étiquette $label aux positions $x et $y. - Les nouvelles positions $x et $y représentent une fraction des largeur et hauteur du graphique. -
      - -
    • -
    • -public addAbsLabel(Label $label, Point $point) -
      - Ajoute une étiquette $label en position absolue sur le graphique aux coordonnées X et Y spécifiées par le point $point. - Le point (0, 0) se situe sur le coin haut-gauche du graphique. -
      - -
    • -
    • -public mixed draw(string - $mode := Graph::DRAW_DISPLAY) -
      - Créé et affiche l'image à l'utilisateur. Tous les composants précédemment ajoutés avec add() sont dessinés sur l'image. - Cette méthode appelle successivement create(), drawComponent() autant de fois que de composants ont été ajoutés et send(). -
      -
        -
      • -string $mode := Graph::DRAW_DISPLAY
        • - Disponible depuis Artichow 1.0.8
        -
      • -
      • -string $file := NULL
        • - Supprimé à partir d'Artichow 1.0.8
        -
        - Si vous souhaitez enregistrer l'image dans un fichier plutôt qu'à l'écran, indiquez un nom de fichier destination pour le paramètre $file. - Ce paramètre est optionnel, et si il n'est pas rempli, alors l'image sera affichée à l'écran. -
        -
      • -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/Grid.html b/artichow/doc/Grid.html deleted file mode 100644 index fa9e83e..0000000 --- a/artichow/doc/Grid.html +++ /dev/null @@ -1,157 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class Grid

    -

    - La classe Grid permet de manipuler des grilles de fond sur les Plot ou groupes de Plot. - Une grille facilite la lecture des données pour l'utilisateur. - Un exemple de grille est montré ci-dessous. -

    -
    - -
    -

    Méthodes et propriétés

    Documentation

      -
    • -public __construct() -
      - Construit et initialise une grille. -
      - -
    • -
    • -public hide(bool $hide := TRUE) -
      - Cache ou affiche la grille sur le composant. -
      - -
    • -
    • -public hideHorizontal(bool $hide := TRUE) -
      - Cache ou affiche les lignes horizontales de la grille sur le composant. -
      - -
    • -
    • -public hideVertical(bool $hide := TRUE) -
      - Cache ou affiche les lignes verticales de la grille sur le composant. -
      - -
    • -
    • -public setColor(Color $color) -
      - Change la couleur de la grille pour la couleur $color. -
      - -
    • -
    • -public setBackgroundColor(Color $color) -
      - Change la couleur de fond de la grille pour la couleur $color. -
      - -
    • -
    • -public setType(int $type) -
      - Change le type de ligne à utiliser sur la grille. $type peut être Line::SOLID pour une ligne continue, Line::DOTTED pour une ligne pointillée ou encore Line::DASHED. -
      - -
    • -
    • -public setInterval(int $hInterval, int $vInterval) -
      - Change l'interval d'affichage des lignes horizontales de la grille avec $hInterval et verticales avec $vInterval. - Par défaut, cet interval est à 1 et toutes les lignes sont affichées. - Si vous choisissez un interval de 2 par exemple, une ligne sur deux sera affichée sur la grille. -
      - -
    • -
    • -public setSpace(int $left, int $right, int $top, int $bottom) -
      - Change l'espace interne de la grille. - Les valeurs $left, $right, $top et $bottom représentent respectivement les nouvelles valeurs pour l'espace gauche, droit, haut et bas de la grille. -
      - -
    • -
    • -public setGrid(array $xgrid, array $ygrid) -
      - Précise la position sur la grille des lignes horizontales avec $ygrid et verticales avec $xgrid. - Ces deux paramètres sont des tableaux qui contiennent des entiers entre 0 et 1. Chaque valeur représente la position d'une ligne comme une fraction de la taille de la grille. -
      - -
    • -
    • -public draw(Driver $driver, int $x1, int $y1, int $x2, int $y2) -
      - Dessine la grille avec le pilote $driver. - La grille sera dessinée dans un rectangle dont la diagonale est le segment qui relie les points ($x1, $y1) et ($x2, $y2). - Les lignes dessinées auront été préalablement précisées avec setGrid(). -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/Image.html b/artichow/doc/Image.html deleted file mode 100644 index 1d2cce8..0000000 --- a/artichow/doc/Image.html +++ /dev/null @@ -1,354 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    -abstract Class Image

    -

    - La classe Image est une classe abstraite à la base de toutes les images sur Artichow. Une image peut être copiée sur d'autres images et chaque image peut être générée soit au format PNG, soit au format JPEG. -

    -
    - Les classes suivantes dérivent de Image : - -

    Méthodes et propriétés

      -
    • -const int JPEG := 1 -
    • -
    • -const int PNG := 2 -
    • -
    • -const int GIF := 3 -
    • -

    Documentation

      -
    • -const int JPEG := 1
      - Indique que l'image est au format JPEG. -
      - -
    • -
    • -const int PNG := 2
      - Indique que l'image est au format PNG. -
      - -
    • -
    • -const int GIF := 3
      - Indique que l'image est au format GIF. -
      - -
    • -
    • -public int $width
      - La largeur de l'image en pixels. -
      - -
    • -
    • -public int $height
      - La hauteur de l'image en pixels. -
      - -
    • -
    • -public Shadow $shadow
      - L'ombre associée à l'image. -
      - -
    • -
    • -public Border $border
      - La bordure associée à l'image. -
      - -
    • -
    • -protected int $format := Image::PNG
      - Le format de l'image. Cela peut être Image::PNG ou Image::JPEG. -
      - -
    • -
    • -protected bool $antiAliasing := FALSE
      - Doit-on utiliser l'anti aliasing sur cette image ? -
      - -
    • -
    • -protected resource $resource
      - La ressource GD créée par PHP pour gérer l'image. -
      - -
    • -
    • -protected Driver $driver
      - Représente un objet de la classe Driver qui sera utilisé pour dessiner toutes sortes de données sur cette image. -
      - -
    • -
    • -protected Color $background := new Color(255, 255, 255)
      - La couleur de fond de l'image. Par défaut, le fond d'une image est blanc. -
      - -
    • -
    • -public __construct() -
      - Construit l'image. -
      - -
    • -
    • -public Driver getDriver(int $w := 1, int $h := 1, int $x := 0.5, int $y := 0.5) -
      - Retourne un objet de type Driver qui permet de dessiner sur l'image. - Le Driver aura une largeur $w et une hauteur $h, et son centre sera positionné au point ($x, $y). - La largeur doit être comprise entre 0 et 1 et représente une fraction de la taille réelle de l'image. - La position doit être elle aussi comprise entre 0 et 1. - Les paramètres par défaut centrent le pilote au milieu de l'image et lui donnent la taille de l'image. -
      - -
    • -
    • -public setSize(int $width, int $height) -
      - Permet de déterminer la taille de l'image à une largeur $width et une hauteur $height. -
      - -
    • -
    • -public setBackgroundColor(Color $color) -
      - Change la couleur de fond de l'image. -
      - -
    • -
    • -public setBackgroundGradient(Gradient $gradient) -
      - Change le dégradé de fond de l'image. -
      - -
    • -
    • -public setAntiAliasing(bool $bool) -
      - Active ou désactive l'anti-aliasing sur l'image. - L'anti-aliasing permet d'avoir des graphiques plus propres mais demande plus de ressources. - L'anti-aliasing n'est pas activé par défaut. -
      - Voir aussi : - -
      -
      - -
    • -
    • -public setFormat(int $format) -
      - Change le format de l'image. La nouvelle valeur peut être Image::PNG, Image::JPEG ou Image::GIF. -
      - -
    • -
    • -public int getFormat() -
      • - Disponible depuis Artichow 1.1.0
      -
      - Renvoie le format de l'image comme un entier. - Les valeurs possibles sont Image::PNG, Image::JPEG ou Image::GIF. -
      - -
    • -
    • -public string getFormatString() -
      • - Disponible depuis Artichow 1.1.0
      -
      - Renvoie le format de l'image comme une chaîne de caractères. - Les valeurs possibles sont "jpeg", "png", ou "gif". -
      - -
    • -
    • -public create() -
      - Créé l'image en vue d'y ajouter des composants. - Il n'est possible de créer une image qu'après lui avoir affecté une taille avec setSize(). -
      - -
    • -
    • -public drawComponent(Component $component) -
      - Dessine le composant $component sur l'image. -
      - -
    • -
    • -public send() -
      - Construit l'image et l'envoie sur la sortie standard accompagnée des en-têtes HTTP correspondants. - Cette fonction ne prend plus d'arguments depuis Artichow 1.1.0. Pour récupérer les données brutes de l'image, utilisez la méthode get(). Pour sauvegarder l'image dans un fichier sur le disque, voyez la méthode Graph::draw(). -
      - -
    • -
    • -public resource get() -
      • - Disponible depuis Artichow 1.1.0
      -
      - Construit l'image et la renvoie sous forme de données binaires. Vous pouvez donc la stocker dans une variable si vous voulez faire des manipulations spécifiques. -
      - -
    • -
    • -public sendHeaders() -
      • - Disponible depuis Artichow 1.0.9
      -
      - Envoie l'en-tête HTTP correspondant au format de l'image. -
      - -
    • -
    • -public static drawError(string - $message) -
      • - Disponible depuis Artichow 1.0.8
      -
      - Affiche une erreur de façon lisible sous forme graphique. -
      -
      • -string $message
        - Le message d'erreur à afficher. -
        -
      - -
    • -
    • -public static drawErrorFile(string - $error) -
      • - Disponible depuis Artichow 1.0.8
      -
      - Affiche une erreur à partir d'une image présente dans le dossier images/erreurs/. -
      -
      • -string $error
        - Le nom de l'erreur à afficher. - L'image correspondant à cette erreur sera récupérée dans le dossier images/erreurs/. -
        -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/Label.html b/artichow/doc/Label.html deleted file mode 100644 index 2ddc9f4..0000000 --- a/artichow/doc/Label.html +++ /dev/null @@ -1,423 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class Label

    -

    - La classe Label permet de créer et d'afficher des étiquettes de texte sur des images. -

    -

    Méthodes et propriétés

    Documentation

      -
    • -public Border $border := new Border
      - La bordure associée à l'étiquette. -
      - -
    • -
    • -protected Font $font := new Font(Font::FONT_2)
      - La police utilisée pour ce paragraphe. -
      - -
    • -
    • -protected int $angle := 0
      - L'angle du texte du paragraphe. -
      - -
    • -
    • -protected Color $color := new Color(0, 0, 0)
      - La couleur du texte du paragraphe. -
      - -
    • -
    • -protected bool $hide
      - Détermine si les étiquettes doivent être cachées. -
      - -
    • -
    • -protected bool $hideFirst
      - Détermine si la première étiquette doit être cachée. -
      - -
    • -
    • -protected bool $hideLast
      - Détermine si la dernière étiquette doit être cachée. -
      - -
    • -
    • -protected int $interval
      - L'interval d'affichage des étiquettes. -
      - -
    • -
    • -protected int $hAlign := Label::CENTER
      - L'alignement horizontal des étiquettes. -
      - -
    • -
    • -protected int $vAlign := Label::MIDDLE
      - L'alignement vertical des étiquettes. -
      - -
    • -
    • -public __construct(string $label := NULL, Font $font := new Font(Text::FONT_2), color $color := new Color(0, 0, 0), int $angle := 0) -
      - Construit un nouvel objet qui permettra l'affichage d'étiquettes sur une image. - $label est un chaîne de caractères qui représente la première étiquette (peut être laissée à NULL). - $font est la police à utiliser pour l'étiquette tandis que $color sera utilisé pour la couleur du texte. - Enfin, l'angle du texte prendra la valeur de $angle. -
      - -
    • -
    • -public mixed get(int $key) -
      - Retourne la valeur de l'élément de l'étiquette dont la clé vaut $key. - Si la clé n'est associée à aucune valeur, alors cette méthode retourne NULL. -
      - -
    • -
    • -public mixed all() -
      - Retourne toutes la valeur de toutes les étiquettes sous la forme d'un tableau. -
      - -
    • -
    • -public set(mixed $labels) -
      - Change le texte des étiquettes à afficher sur l'image. - $labels peut être une chaîne de caractères si vous n'avez besoin que d'une étiquette, ou un tableau de chaînes de caractères si vous avez besoin de plusieurs étiquettes. -
      - -
    • -
    • -public int count() -
      - Retourne le nombre de textes dans le paragraphe. -
      - -
    • -
    • -public setCallbackFunction(mixed $function) -
      - Change le nom de la fonction de callback qui sera appelé lors du dessin des textes du paragraphe. $function peut être une simple chaîne de caractères, ou un tableau du type array($this, 'methodName') pour permettre d'appeler des méthodes statiques. -
      - -
    • -
    • -public string getCallbackFunction() -
      - Retourne le nom de la fonction de callback actuellement utilisée. - Si aucune fonction de callback n'a été spécifiée, alors NULL sera retourné. -
      - -
    • -
    • -public setFormat(string $format) -
      - Formate le texte de chaque étiquette selon $format. - $format est du même format que les fonctions printf ou sprintf. -
      - -
    • -
    • -public setFont(Font $font) -
      - Change la police utilisée pour le texte de l'étiquette. -
      - -
    • -
    • -public setAngle(int $angle) -
      - Change l'angle du texte de l'étiquette. Les valeurs possibles sont 0 ou 90°. -
      - -
    • -
    • -public setColor(Color $color) -
      - Change la couleur du texte de l'étiquette. -
      - -
    • -
    • -public setBackground(mixed $background) -
      - Change le fond du texte de l'étiquette. - $background peut être soit une couleur, soit un dégradé; -
      - -
    • -
    • -public setBackgroundColor(Color $color) -
      - Change la couleur de fond du texte de l'étiquette. -
      - Voir aussi : - -
      -
      - -
    • -
    • -public setBackgroundGradient(Gradient $gradient) -
      - Change le dégradé de fond du texte de l'étiquette. -
      - Voir aussi : - -
      -
      - -
    • -
    • -public setPadding(int $left, int $right, int $top, int $bottom) -
      - Change la valeur de l'espace qui entoure le texte par rapport à sa bordure. -
      - -
    • -
    • -public hide(bool $hide) -
      - Détermine si toutes les étiquettes doivent être cachées ou non. -
      - -
    • -
    • -public show(bool $show) -
      - Détermine si toutes les étiquettes doivent être affichées ou non. -
      - -
    • -
    • -public hideKey(int $key) -
      - Détermine si l'étiquette de clé $key doit être cachée ou non. -
      - -
    • -
    • -public hideFirst(bool $hide) -
      - Détermine si la première étiquette doit être cachée ou non. -
      - -
    • -
    • -public hideLast(bool $hide) -
      - Détermine si la dernière étiquette doit être cachée ou non. -
      - -
    • -
    • -public setInterval(int $interval) -
      - Change l'interval d'affichage des étiquettes. - L'interval est à 1 par défaut, ce qui signifie que toutes les étiquettes sont affichées. - Si cet interval est placé à 2 par exemple, alors la méthode draw() n'affichera qu'une étiquette sur 2. -
      - -
    • -
    • -public move(int $x, int $y) -
      - Déplace l'affichage de l'étiquette de $x pixels sur l'axe des abscisses et de $y pixels sur l'axe des ordonnées. - Les appels à move() sont cumulés, c'est-à-dire qu'un appel avec de nouvelles valeurs additionnera ces valeurs avec les anciennes. - Par défaut, $x et $y sont à 0. -
      - -
    • -
    • -public setAlign(int $h := NULL, int $v := NULL) -
      - Change l'alignement de l'étiquette par rapport au point où elle sera affichée. - $h correspond à l'alignement horizontal (Positionable::LEFT, Positionable::RIGHT ou Positionable::CENTER) et $v à l'alignement vertical (Positionable::TOP, Positionable::BOTTOM ou Positionable::MIDDLE). - Si vous ne souhaitez pas modifier une des deux valeurs, vous pouvez passer NULL. -
      - -
    • -
    • -public Text getText(int $key) -
      - Retourne un objet de type Text qui correspond à la valeur du tableau de textes passé au constructeur ou à Label::set() pour la clé $key. - Cette object Text se verra attribué toutes les propriétés (couleur, police, angle, etc.) définies pour le paragraphe. -
      - -
    • -
    • -public int getMaxWidth(Driver $driver) -
      - Essaie de déterminer la longueur maximale des étiquettes. Cette méthode a besoin d'un Driver pour établir la taille de chaque texte. - La longueur maximale trouvée est déterminée et rétournée en pixels. -
      - -
    • -
    • -public int getMaxHeight(Driver $driver) -
      - Essaie de déterminer la hauteur maximale des étiquettes. Cette méthode a besoin d'un Driver pour établir la taille de chaque texte. - La hauteur maximale trouvée est déterminée et rétournée en pixels. -
      - -
    • -
    • -public draw(Driver $driver, Point $point, int $key := 0) -
      - Dessine l'étiquette identifiée par $key avec le pilote $driver. L'étiquette sera placée au point $point décalé des valeurs successivement passées à move(), et alignée par rapport à ce point selon les valeurs passées à setAlign(). - L'étiquette ne sera pas affichée si sa clé $key n'est pas dans l'interval d'affichage donné avec setInterval(). -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/Legend.html b/artichow/doc/Legend.html deleted file mode 100644 index c41edcb..0000000 --- a/artichow/doc/Legend.html +++ /dev/null @@ -1,442 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class Legend

    -

    - La classe Legend permet de manipuler des légendes. - Un objet de la classe Legend est disponible sur tous les composants. - N'importe quel objet peut être légendé à condition qu'il implémente l'interface Legendable. -

    -

    Méthodes et propriétés

    Documentation

      -
    • -const int LINE := 1
      - Utilise une couleur de ligne pour identifier un objet dans la légende. -
      - -
    • -
    • -const int BACKGROUND := 2
      - Utilise une couleur de fond pour identifier un objet dans la légende. -
      - -
    • -
    • -const int MARK := 3
      - Utilise un objet Mark et une ligne pour identifier un objet dans la légende. -
      - -
    • -
    • -const int MARKONLY := 4
      - Utilise un objet Mark seulement pour identifier un objet dans la légende. -
      - -
    • -
    • -const int MODEL_RIGHT := 1
      - Modèle prédéfini qui place la légende à droite. -
      - -
    • -
    • -const int MODEL_BOTTOM := 2
      - Modèle prédéfini qui place la légende en bas. -
      - -
    • -
    • -const int LEFT := 0
      - Aligne horizontalement la légende à gauche. -
      - -
    • -
    • -const int RIGHT := 1
      - Aligne horizontalement la légende à droite. -
      - -
    • -
    • -const int CENTER := 2
      - Centre la légende horizontalement. -
      - -
    • -
    • -const int TOP := 3
      - Aligne verticalement la légende en haut. -
      - -
    • -
    • -const int BOTTOM := 4
      - Aligne verticalement la légende en bas. -
      - -
    • -
    • -const int MIDDLE := 5
      - Aligne verticalement la légende au milieu. -
      - -
    • -
    • -public Shadow $shadow
      - Cette propriété permet de manipuler l'ombre associée éventuellement avec la légende. - Par défaut, aucune ombre n'est affichée. Si vous souhaitez afficher une ombre, il vous suffit de lui donner une taille : -
      -
      -<?php
      -
      -require_once "Tools.class.php";
      -
      -$legend = new Legend();
      -
      -// On associe une ombre de 4 pixels à la légende
      -$legend->shadow->setSize(4);
      -
      -?>
      -
      -
      -
      - -
    • -
    • -protected bool $hide
      - Détermine si la légende doit être cachée ou non. -
      - -
    • -
    • -protected ArrayOject $legends
      - Les objets Legendable à afficher sur la légende. -
      - -
    • -
    • -public __construct(int $model := Legend::MODEL_RIGHT) -
      - Construit une nouvelle légende avec le modèle $model. - Les valeurs possibles pour $model sont Legend::MODEL_BOTTOM et Legend::MODEL_RIGHT. -
      - -
    • -
    • -public hide(bool $hide := TRUE) -
      - Permet de cacher (par défaut) ou d'afficher la légende. -
      - -
    • -
    • -public show(bool $show := TRUE) -
      - Permet d'afficher (par défaut) ou de cacher la légende. -
      - -
    • -
    • -public setModel(int $model) -
      - Change le modèle de légende pour $model. - L'appel à cette méthode peut écraser les valeurs passées à d'autres méthodes comme setPadding() ou setHorizontalAlign() par exemple (liste non exhaustive). - Les valeurs possibles pour $model sont Legend::MODEL_BOTTOM et Legend::MODEL_RIGHT. -
      - -
    • -
    • -public add(Legendable $legendable, string $title, int $type := Legend::LINE) -
      - Ajoute un nouvel objet légendable avec pour titre $title à cette légende. - $type permet de spécifier le type de légende, qui peut être Legend::LINE, Legend::BACKGROUND, Legend::MARK ou encore Legend::MARKONLY. -
      - -
    • -
    • -public setPadding(int $left, int $right, int $top, int $bottom) -
      - Change l'espace interne de la légende. - Les nouvelles valeurs doivent être données en pixels. - Laissez les paramètres dont vous ne souhaitez pas modifier la valeur à NULL. -
      - -
    • -
    • -public setSpace(int $space) -
      - Change l'espace entre chaque valeur. - Cet espace doit être donné en pixels. -
      - -
    • -
    • -public setAlign(int $h := NULL, int $v := NULL) -
      - Change l'alignement de la légende par rapport au point où elle sera affichée. - $h correspond à l'alignement horizontal (Legend::LEFT, Legend::RIGHT ou Legend::CENTER) et $v à l'alignement vertical (Legend::TOP, Legend::BOTTOM ou Legend::MIDDLE). - Si vous ne souhaitez pas modifier une des deux valeurs, vous pouvez passer NULL. -
      - -
    • -
    • -public setColumns(int $columns) -
      - Change le nombre de colonnes qui seront affichées dans la légende pour $columns. - Cette méthode est incompatible avec setRows(). -
      - Voir aussi : - -
      -
      - -
    • -
    • -public setRows(int $rows) -
      - Change le nombre de lignes qui seront affichées dans la légende pour $rows. - Cette méthode est incompatible avec setColumns(). -
      - Voir aussi : - -
      -
      - -
    • -
    • -public setPosition(float $x := NULL, float $y := NULL) -
      - Change la position de la légende sur l'objet légendé. - Les positions $x et $y sont des fractions des largeur et hauteur de l'objet légendé. -
      - -
    • -
    • -public Point getPosition() -
      - Retourne la position courante de la légende sur l'objet légendé sous la forme d'un point. -
      - -
    • -
    • -public setTextFont(Font $font) -
      - Change la police à utiliser sur la légende. - Voir la classe Font pour une liste des polices disponibles. -
      - -
    • -
    • -public setTextMargin(int $left, int $right) -
      - Change la marge gauche et droite autour du texte des légendes. - $left et $right sont à donner en pixels. -
      - -
    • -
    • -public setTextColor(Color $color) -
      - Change la couleur du texte de la légende. -
      - -
    • -
    • -public setBackground(mixed $background) -
      - Change le fond de la légende. - $background peut être soit une couleur, soit un dégradé. -
      - -
    • -
    • -public setBackgroundColor(Color $color) -
      - Change la couleur de fond de la légende. -
      - Voir aussi : - -
      -
      - -
    • -
    • -public setBackgroundGradient(Gradient $gradient) -
      - Change le dégradé de fond de la légende. -
      - Voir aussi : - -
      -
      - -
    • -
    • -public setBorderSize(int $size) -
      - Change la taille de la bordure qui entoure la légende. - Les valeurs possibles sont 0 et 1. -
      - -
    • -
    • -public setBorderColor(Color $color) -
      - Change la couleur de la bordure qui entoure la légende. -
      - -
    • -
    • -public int count() -
      - Retourne le nombre d'objets légendable qui ont été ajoutés à cette légende. -
      - -
    • -
    • -public draw(Driver $driver) -
      - Dessine la légende avec le pilote $driver. -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/Legendable.html b/artichow/doc/Legendable.html deleted file mode 100644 index 320036c..0000000 --- a/artichow/doc/Legendable.html +++ /dev/null @@ -1,86 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class Legendable

    -

    - Legendable est une interface que doivent implémenter toutes les classes qui veulent profiter des possibilités offertes par la classe Legend. -

    -

    Méthodes et propriétés

    Documentation

    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/Line.html b/artichow/doc/Line.html deleted file mode 100644 index 0d48298..0000000 --- a/artichow/doc/Line.html +++ /dev/null @@ -1,279 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class Line

    -

    - La classe Line permet de manipuler des lignes de manière uniforme sur Artichow. Une ligne est composée de deux Point. -

    -
    - Les classes suivantes dérivent de Line : - -

    Méthodes et propriétés

    Documentation

      -
    • -protected Point $p1
      - Le premier point de la ligne. -
      - -
    • -
    • -protected Point $p2
      - Le second point de la ligne. -
      - -
    • -
    • -private float $slope
      - La pente (ou coefficient directeur) de la droite. -
      - -
    • -
    • -private float $origin
      - La valeur de l'ordonnée à l'origine de la droite. -
      - -
    • -
    • -public __construct(Point $p1, Point $p2, int $style := Line::SOLID, int $thickness := 1) -
      - Déclare une nouvelle ligne des points $p1 à $p2. La ligne est de style $style (Line::SOLID pour une ligne continue, Line::DOTTED pour une ligne pointillée ou encore Line::DASHED) et d'épaisseur $thickness. -
      - -
    • -
    • -public static build(int $x1, int $y1, int $x2, int $y2) -
      - Construit une ligne à partir des coordonnées ($x1, $y1) et ($x2, $y2) -
      - -
    • -
    • -public setX(int $x1, int $x2) -
      - Change les coordonnées X des deux points de la ligne pour $x1 et $x2. -
      - -
    • -
    • -public setY(int $y1, int $y2) -
      - Change les coordonnées Y des deux points de la ligne pour $y1 et $y2. -
      - -
    • -
    • -public setLocation(Point $p1, Point $p2) -
      - Change l'emplacement de la ligne pour les points $p1 et $p2 passés en paramètre. -
      - -
    • -
    • -public array getLocation() -
      - Retourne la position de la ligne dans un tableau à deux valeurs. -
      -
      -<?php
      -$line = new Line(new Point(1, 2), new Point(3, 4));
      -list($p1, $p2) = $line->getLocation();
      -// $p1 == new Point(1, 2)
      -// $p2 == new Point(3, 4)
      -?>
      -
      -
      -
      - -
    • -
    • -public float getSize() -
      - Retourne la taille de la ligne en pixels. -
      - -
    • -
    • -public float getSlope() -
      • - Disponible depuis Artichow 1.0.9
      -
      - Renvoie la valeur de la pente de la ligne. - Si celle-ci est verticale, la pente vaudra NULL; si elle est horizontale, la pente vaudra 0. - La valeur est calculée uniquement lorsqu'elle est demandée. -
      - -
    • -
    • -public float getOrigin() -
      • - Disponible depuis Artichow 1.0.9
      -
      - Renvoie la valeur de l'ordonnée à l'origine. - Si la ligne est verticale, l'ordonnée à l'origine vaudra NULL. - La valeur est calculée uniquement lorsqu'elle est demandée. -
      - -
    • -
    • -public array getEquation() -
      • - Disponible depuis Artichow 1.0.9
      -
      - Renvoie un tableau contenant la pente et l'ordonnée à l'origine de la ligne. -
      - -
    • -
    • -public float getXFrom(float $y) -
      • - Disponible depuis Artichow 1.0.9
      -
      - Renvoie la valeur de l'abscisse du point d'ordonnée $y situé sur la droite portant la ligne. - Si la ligne est horizontale et que $y est différent de l'ordonnée à l'origine, aucun point ne pourra être trouvé et la méthode renverra NULL. -
      - -
    • -
    • -public float getYFrom(float $x) -
      • - Disponible depuis Artichow 1.0.9
      -
      - Renvoie la valeur de l'ordonnée du point d'abscisse $x situé sur la droite portant la ligne. - Si la ligne est verticale et qu'aucun point correspondant à $x ne peut être trouvé, la méthode renverra NULL. -
      - -
    • -
    • -public bool isPoint() -
      - Retourne TRUE si la ligne peut être considérée comme un point, FALSE sinon. -
      - -
    • -
    • -public bool isHorizontal() -
      - Retourne TRUE si la ligne est horizontale, FALSE sinon. -
      - -
    • -
    • -public bool isVertical() -
      - Retourne TRUE si la ligne est verticale, FALSE sinon. -
      - -
    • -
    • -public bool isTopToBottom(Polygon $polygon) -
      • - Disponible depuis Artichow 1.0.9
      -
      - Renvoie TRUE si la ligne remplit toute la hauteur du rectangle encadrant le polygone $polygon, FALSE sinon. -
      - -
    • -
    • -public bool isLeftToRight(Polygon $polygon) -
      • - Disponible depuis Artichow 1.0.9
      -
      - Renvoie TRUE si la ligne remplit toute la largeur du rectangle encadrant le polygone $polygon, FALSE sinon. -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/LinePlot.html b/artichow/doc/LinePlot.html deleted file mode 100644 index 4d0288e..0000000 --- a/artichow/doc/LinePlot.html +++ /dev/null @@ -1,230 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class LinePlot

    -

    - Cette classe permet de dessiner des courbes. -

    -

    Méthodes et propriétés

      -
    • -const int LINE := 0 -
    • -
    • -const int MIDDLE := 1 -
    • -

    Documentation

      -
    • -const int LINE := 0
      - Dessine une courbe. -
      - -
    • -
    • -const int MIDDLE := 1
      - Dessine une courbe dont les pics sont centrés sur l'axe des X (idéal pour cumuler courbe et histogramme). -
      - -
    • -
    • -public Mark $mark
      - Représente les marques affichées sur chaque pointe de la courbe. -
      - -
    • -
    • -public Label $label
      - Représente les étiquettes affichées au-dessus de chaque pointe de la courbe. - Ces étiquettes contiennent la valeur de chaque pointe. -
      - -
    • -
    • -public __construct(array $values, int $mode := LinePlor::LINE) -
      - Créé une nouvelle courbe de type $mode avec les valeurs présentes dans $values. - Le tableau $values doit être une liste de valeurs dans un tableau incrémental, c'est-à-dire dont les clés valent de 0 à n - 1 (où n est la taille du tableau). -
      -
      -<?php
      -
      -require_once "LinePlot.class.php";
      -
      -$graph = new Graph(400, 400);
      -
      -// Tableau de valeurs
      -$x = array(1, 4, 3);
      -
      -$plot = new LinePlot($x);
      -	
      -$graph->add($plot);
      -$graph->draw();
      -
      -?>
      -
      -
      -
      - -
    • -
    • -public hideLine(bool $hide) -
      - Cache ou ne cache pas la ligne qui relie les valeurs de la courbe. -
      - -
    • -
    • -public setFilledArea(int $start, int $stop, mixed $background) -
      - Permet de remplir une aire sous la courbe des points $start à $stop. - L'aire sera remplie avec la couleur ou le dégradé $background. -
      - -
    • -
    • -public setColor(Color $color) -
      - Change la couleur de la ligne qui relie les valeurs de la courbe. -
      - -
    • -
    • -public setStyle(int $style) -
      - Change le style de ligne (Line::SOLID, Line::DOTTED ou Line::DASHED). -
      - -
    • -
    • -public setThickness(int $thickness) -
      - Change l'épaisseur de la ligne. - L'épaisseur de la ligne doit être toujours positive. -
      - -
    • -
    • -public setFillColor(Color $color) -
      - Change la couleur de fond de la ligne qui relie les valeurs de la courbe. - La couleur de fond remplit le polygone définit par tous les points de la ligne additionés des points extrêmes de l'axe des abscisses. -
      -
      -<?php
      -
      -require_once "LinePlot.class.php";
      -
      -$graph = new Graph(400, 400);
      -
      -$x = array(1, 10, 3, -4, 1);
      -
      -$plot = new LinePlot($x);
      -$plot->setFillColor(new Color(255, 20, 20, 30));
      -	
      -$graph->add($plot);
      -$graph->draw();
      -
      -?>
      -
      -
      -
      - -
    • -
    • -public setFillGradient(Gradient $gradient) -
      - Change le dégradé de fond de la ligne qui relie les valeurs de la courbe. - Le dégradé de fond remplit le polygone définit par tous les points de la ligne additionés des points extrêmes de l'axe des abscisses. -
      -
      -<?php
      -
      -require_once "LinePlot.class.php";
      -
      -$graph = new Graph(400, 400);
      -
      -$x = array(1, 10, 3, -4, 1);
      -
      -$plot = new LinePlot($x);
      -$plot->setFillGradient(
      -	new LinearGradient(
      -		new Color(255, 20, 20, 30),
      -		new Color(20, 255, 20, 30),
      -		90
      -	)
      -);
      -	
      -$graph->add($plot);
      -$graph->draw();
      -
      -?>
      -
      -
      -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/LinearGradient.html b/artichow/doc/LinearGradient.html deleted file mode 100644 index 64c24e3..0000000 --- a/artichow/doc/LinearGradient.html +++ /dev/null @@ -1,58 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class LinearGradient

    -

    - Cette classe permet de décrire un dégradé linéaire. -

    -
    - Les classes suivantes dérivent de LinearGradient : - -

    Méthodes et propriétés

    Documentation

      -
    • -public int $angle
      - Décrit l'angle du dégradé. Les valeurs possibles sont 0 et 90°. -
      - -
    • -
    • -public __construct(Color $from, Color $to, int $angle) -
      - Construit une nouveu dégradé. Cette méthode doit être appelée par toutes les classes qui dérivent de celle-ci. Le paramètre $from décrit la couleur de départ du dégradé et le paramètre $to celle de fin. Le troisième paramètre $angle décrit l'angle du dégradé. Ce peut être un dégradé horizontal (angle de 0°) ou un dégradé vertical (angle de 90°). -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/Mark.html b/artichow/doc/Mark.html deleted file mode 100644 index 84be142..0000000 --- a/artichow/doc/Mark.html +++ /dev/null @@ -1,265 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class Mark

    -

    - La classe Mark permet de créer des marques, qui peuvent être affichées n'importe où sur une image. - Typiquement, les marques sont affichées sur les courbes pour mettre en valeur chaque point. -

    -
    - -
    -

    Méthodes et propriétés

    Documentation

      -
    • -const int CIRCLE := 1
      - Pour les marques de la forme d'un cercle. -
      - -
    • -
    • -const int SQUARE := 2
      - Pour les marques de la forme d'un carré. -
      - -
    • -
    • -const int TRIANGLE := 3
      - Pour les marques de la forme d'un trianble. -
      - -
    • -
    • -const int INVERTED_TRIANGLE := 4
      - Pour les marques de la forme d'un triangle inversé (sommet vers le bas). -
      - -
    • -
    • -const int RHOMBUS := 5
      - Représente une marque de type rhombus (carré à 45°). -
      - -
    • -
    • -const int CROSS := 6
      - Représente une marque de la forme d'une croix (X). -
      - -
    • -
    • -const int PLUS := 7
      - Représente une marque de la forme d'un plus (+). -
      - -
    • -
    • -const int IMAGE := 8
      - Pour les marques de type image. -
      - -
    • -
    • -const int STAR := 9
      - Représente une marque de type étoile. -
      - -
    • -
    • -const int PAPERCLIP := 10
      - Représente une marque de type trombonne. -
      - -
    • -
    • -const int BOOK := 11
      - Représente une marque de type livre. -
      - -
    • -
    • -protected Point $move
      - Le déplacement de la marque défini par l'utilisateur. -
      - Voir aussi : - -
      -
      - -
    • -
    • -public Border $border
      - La bordure qui entoure la marque. -
      - -
    • -
    • -public __construct() -
      - Construit un nouvel objet qui permettra l'affichage de marques sur une image. -
      - -
    • -
    • -public move(int $x, int $y) -
      - Déplace l'affichage des marques de $x pixels sur l'axe des abscisses et de $y pixels sur l'axe des ordonnées. - Les appels à move() sont cumulés, c'est-à-dire qu'un appel avec de nouvelles valeurs additionnera ces valeurs avec les anciennes. - Par défaut, $x et $y sont à 0 pixel. -
      - -
    • -
    • -public hide(bool $hide := TRUE) -
      - Permet de cacher (par défaut) ou d'afficher les marques. -
      - -
    • -
    • -public show(bool $show := TRUE) -
      - Permet d'afficher (par défaut) ou de cacher les marques. -
      - -
    • -
    • -public setSize(int $size) -
      - Change la taille des marques pour $size. Cette méthode n'a aucun effet pour les marques de type , , ou . -
      - -
    • -
    • -public setType(int $type, int $size := NULL) -
      - Change le type de marque à utiliser. - Les valeurs possibles sont , , , , , ou encore . - L'argument optionnel $size permet de déterminer la taille de la marque et n'a aucun effet sur , et . -
      - -
    • -
    • -public setFill(mixed $fill) -
      - Remplit la marque avec la couleur ou le dégradé $fill. Cette méthode n'a aucun effet pour les marques de type Mark::IMAGE. -
      - Voir aussi : - -
      -
      - -
    • -
    • -public setImage(Image $image) -
      - Change l'image à afficher sur la marque. Cette méthode n'a de sens que pour les marques de type Mark::IMAGE. -
      - Voir aussi : - -
      -
      - -
    • -
    • -public draw(Driver $driver, Point $point) -
      - Dessine la marque avec le pilote $driver. Le centre de la marque sera sur le point $point. -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/MathFunction.html b/artichow/doc/MathFunction.html deleted file mode 100644 index 8754739..0000000 --- a/artichow/doc/MathFunction.html +++ /dev/null @@ -1,87 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class MathFunction

    -

    - Cette classe permet de représenter une fonction mathématique f(x) à afficher sur un graphique de type MathPlot. -

    -

    Méthodes et propriétés

    Documentation

      -
    • -public Line $line
      - La ligne qui sera utilisée pour représenter la fonction. -
      - -
    • -
    • -public Mark $mark
      - Les marques qui seront affichés sur chaque point calculé. -
      - -
    • -
    • -public __construct(string $f, float $fromX, float $toX) -
      - Créé un objet MathFunction avec la fonction $f. - $f est une fonction qui prend un paramètre $x en paramètre et qui doit retourner une valeur $y. - Les valeurs $fromX et $toX représentent les valeurs de X à partir desquelles commencer et terminer le calcul de la courbe représentative de la fonction. -
      - -
    • -
    • -public setColor(Color $color) -
      - Change la couleur de la courbe représentative de la fonction pour $color. -
      - -
    • -
    • -public Color getColor() -
      - Retourne la couleur de la courbe représentative de la fonction. -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/MathPlot.html b/artichow/doc/MathPlot.html deleted file mode 100644 index 1cd3c87..0000000 --- a/artichow/doc/MathPlot.html +++ /dev/null @@ -1,124 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class MathPlot

    -

    - Cette classe permet de représenter simplement des fonctions f(x) sur un graphique. - L'archive de Artichow contient plusieurs exemples pour vous aider dans la conception de ces graphiques. -

    -

    Méthodes et propriétés

      -
    • -public __construct(float $xMin, float $xMax, float $yMax, float $yMin) -
    • -
    • -public setInterval(int $interval) -
    • -
    • -public add(MathFunction $function, string $name := NULL, int $type := Legend::LINE) -
    • -

    Documentation

      -
    • -public Grid $grid
      - Représente la grille de fond du graphique. -
      - -
    • -
    • -public Axis $xAxis
      - Représente l'axe des abscisses. -
      - -
    • -
    • -public Axis $yAxis
      - Représente l'axe des ordonnées. -
      - -
    • -
    • -public __construct(float $xMin, float $xMax, float $yMax, float $yMin) -
      - Construit le graphique. - L'axe des X va des valeurs $xMin à $xMax tandis que l'axe de Y va des valeurs $yMin à $yMax. -
      -
      -<?php
      -
      -require_once "MathPlot.class.php";
      -
      -$graph = new Graph(300, 300);
      -
      -
      -$plot = new MathPlot(-3, 3, 3, -3);
      -$plot->setInterval(0.1);
      -
      -// On dessine cos(x)
      -$function = new MathFunction('cos');
      -$plot->add($function);
      -	
      -$graph->add($plot);
      -$graph->draw();
      -
      -?>
      -
      -
      -
      - -
    • -
    • -public setInterval(int $interval) -
      - Change l'interval sur lequel sont calculées les valeurs affichées sur le graphique. - Par défaut, cet interval est de 1, c'est-à-dire que Artichow calcule f(x) pour toutes les valeurs entières de x. -
      - -
    • -
    • -public add(MathFunction $function, string $name := NULL, int $type := Legend::LINE) -
      - Ajoute une fonction mathématique au graphique. - Sur la légende, la fonction aura pour nom $name et le type de légende utilisé sera $type (Legend::LINE, Legend::BACKGROUND ou encore Legend::MARK). - Si vous ne souhaitez pas associer de légende à cette fonction, laissez l'argument $name à NULL. -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/PHPFont.html b/artichow/doc/PHPFont.html deleted file mode 100644 index e4e7da9..0000000 --- a/artichow/doc/PHPFont.html +++ /dev/null @@ -1,73 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class PHPFont

    -

    - La classe PHPFont permet de gérer les polices fournie avec PHP. Ce sont des polices pouvant subir peu de transformation (rotation de 90° uniquement par exemple). -

    -

    - Il existe 5 polices prédéfinies, ainsi que les 5 classes "raccourcies" correspondantes: -

    -
    -<?php
    -
    -// Equivalent à new PHPFont(1);
    -$font = new Font1;
    -
    -// Equivalent à new PHPFont(2);
    -$font = new Font2;
    -
    -// etc.
    -
    -?>
    -
    -
    -

    -

    Méthodes et propriétés

    Documentation

      -
    • -public int $font
      - L'identifiant de la police, de 1 à 5. -
      - -
    • -
    • -public __construct(int $font) -
      - Construit la police d'identifiant $font. -
      - -
    • -
    -
     
     
    -
    - - \ No newline at end of file diff --git a/artichow/doc/PHPFontDriver.html b/artichow/doc/PHPFontDriver.html deleted file mode 100644 index 3027d65..0000000 --- a/artichow/doc/PHPFontDriver.html +++ /dev/null @@ -1,40 +0,0 @@ - - - Documentation - - - - - -
    - - - - - - - - - - - - - - - - -
      
     

    Class PHPFontDriver

    -

    - La classe PHPFontDriver s'occupe des calculs et de l'affichage liés aux polices de type PHPFont. -

    -

    - A aucun moment vous ne devriez avoir à instancier un objet de ce type. La documentation est là à titre informatif pour les développeurs en herbe. -

    -

    Méthodes et propriétés

    Documentation

      -
       
       
      -
      - - \ No newline at end of file diff --git a/artichow/doc/Pattern.html b/artichow/doc/Pattern.html deleted file mode 100644 index 65c5d09..0000000 --- a/artichow/doc/Pattern.html +++ /dev/null @@ -1,40 +0,0 @@ - - - Documentation - - - - - -
      - - - - - - - - - - - - - - - - -
        
       

      Class Pattern

      -

      - La classe Pattern simplifie la création de graphiques avec Artichow. -

      -

      - Cette partie de la documentation est encore en cours de réalisation. - Pour obtenir la liste des méthodes de cette classe, voyez le fichier Pattern.class.php. - Pour savoir comment utiliser cette classe, n'hésitez pas à aller jeter un coup d'oeil aux exemples (examples/pattern-*.php) - fournis avec l'archive de Artichow. -

      -

      Méthodes et propriétés

      Documentation

        -
         
         
        -
        - - \ No newline at end of file diff --git a/artichow/doc/Pie.html b/artichow/doc/Pie.html deleted file mode 100644 index 9e41885..0000000 --- a/artichow/doc/Pie.html +++ /dev/null @@ -1,233 +0,0 @@ - - - Documentation - - - - - -
        - - - - - - - - - - - - - - - - -
          
         

        Class Pie

        -

        - La classe Pie permet de générer des camemberts en deux ou trois dimensions. -

        -

        Méthodes et propriétés

          -
        • -const int DARK := 1 -
        • -
        • -const int COLORED := 2 -
        • -
        • -const int AQUA := 3 -
        • -
        • -const int EARTH := 4 -
        • -

        Documentation

          -
        • -const int DARK := 1
          - Un thème sombre pour les camemberts. -
          - -
        • -
        • -const int COLORED := 2
          - Un thème coloré pour les camemberts (thème par défaut). -
          - -
        • -
        • -const int AQUA := 3
          - Un thème plutôt bleu pour les camemberts. -
          - -
        • -
        • -const int EARTH := 4
          - Un thème aux couleurs de la Terre pour les camemberts. -
          - -
        • -
        • -protected Border $border
          - La bordure qui entoure chaque part du camembert. -
          - -
        • -
        • -public array $values
          - Les valeurs du camembert. -
          - -
        • -
        • -public array $colors
          - Les couleurs des parts du camembert. -
          - -
        • -
        • -public __construct(array $values, mixed $colors := Pie::COLORED) -
          - Construit un nouveau camembert avec comme valeurs $values. - Le paramètre $colors peut soit être un tableau de couleurs, soit un thème prédéfini (Pie::DARK, Pie::COLORED, Pie::AQUA ou Pie::EARTH). -
          - -
        • -
        • -public setLegend(array $legend) -
          - Change les valeurs de la légende associée au camembert. - $legend est un tableau qui contient autant d'entrées que de valeurs présentes sur le camembert. -
          - -
        • -
        • -public setBorder(Color $color) -
          • - Déprécié depuis Artichow 1.0.9
          -
          - Change la couleur de la bordure entourant le camembert et séparant chaque part. - Cette méthode a été remplacée par Pie::setBorderColor() depuis Artichow 1.0.9. -
          - Voir aussi : - -
          -
          - -
        • -
        • -public setBorderColor(Color $color) -
          • - Disponible depuis Artichow 1.0.9
          -
          - Change la couleur de la bordure entourant le camembert et séparant chaque part. -
          - -
        • -
        • -public set3D(int $size) -
          - Associe au camembert à un effet 3D de taille $size (à spécifier en pixels). -
          - -
        • -
        • -public setStartAngle(int $angle) -
          - Angle initial en degrés pour commencer le dessin du camembert. - La valeur par défaut est de 0°. -
          - -
        • -
        • -public setLabelPrecision(int $precision) -
          - Change la précision des étiquettes associées à chaque part du camembert. - Par défaut à 0, cette précision donne le nombre de chiffres après la virgule à afficher. -
          - -
        • -
        • -public setLabelPosition(int $position) -
          - Change la distance des étiquettes par rapport au camembert. - La valeur est à donner en pixels et vaut par défaut 15 pixels. - Elle peut également être négative. -
          - -
        • -
        • -public setLabelNumber(int $number) -
          - Permet de choisir le nombre maximale d'étiquettes à afficher autour du camembert. - Par défaut, toutes les étiquettes sont affichées. -
          - -
        • -
        • -public setLabelMinimum(int $minimum) -
          - Permet de choisir une valeur minimum pour l'affichage des étiquettes. - Tout part dont le pourcentage sera inférieur à $minimum n'aura aucune étiquette associée. - Par défaut, il n'y a aucun minimum. -
          - -
        • -
        • -public explode(array $explode) -
          - Cette méthode permet de séparer une ou plusieurs parts du camembert. - Le paramètre $explode est un tableau dont les clés représente les numéros des parts à séparer et les valeurs la distance de séparation. -
          - -
        • -
        -
         
         
        -
        - - \ No newline at end of file diff --git a/artichow/doc/Plot.html b/artichow/doc/Plot.html deleted file mode 100644 index f81a8ba..0000000 --- a/artichow/doc/Plot.html +++ /dev/null @@ -1,316 +0,0 @@ - - - Documentation - - - - - -
        - - - - - - - - - - - - - - - - -
          
         

        Class Plot

        -

        - Cette classe est la base des courbes et histogrammes sur Artichow. -

        -
        - Les classes suivantes dérivent de Plot : - -

        Méthodes et propriétés

          -
        • -const string LEFT := left -
        • -
        • -const string RIGHT := right -
        • -
        • -const string TOP := top -
        • -
        • -const string BOTTOM := bottom -
        • -
        • -const string BOTH := both -
        • -

        Documentation

          -
        • -const string LEFT := left
          - Dessine l'axe des abscisses sur la gauche du graph. -
          - -
        • -
        • -const string RIGHT := right
          - Dessine l'axe des abscisses sur la droite du graph. -
          - -
        • -
        • -const string TOP := top
          - Dessine l'axe des ordonnées sur le haut du graph. -
          - -
        • -
        • -const string BOTTOM := bottom
          - Dessine l'axe des ordonnées sur le bas du graph. -
          - -
        • -
        • -const string BOTH := both
          - Dessine l'axe des abscisses (ou des ordonnées) sur la gauche et la droite (ou le haut et la bas) du graph. -
          - -
        • -
        • -public array $datay
          - Les valeurs de l'axe des Y. -
          - -
        • -
        • -public array $datax
          - Les valeurs de l'axe des X. -
          - -
        • -
        • -public Grid $grid
          - Représente la grille de fond du composant. -
          - -
        • -
        • -public Axis $xAxis
          - L'axe des abscisses -
          - -
        • -
        • -public Axis $yAxis
          - L'axe des ordonnées -
          - -
        • -
        • -protected bool $xAxisZero := TRUE
          - Est-ce le ou les axes des abscisses doivent être centrés sur zéro ? -
          - -
        • -
        • -public __construct() -
          - Construit le composant. -
          - -
        • -
        • -public reduce(number $number) -
          - Réduit le nombre de valeurs à afficher sur le composant à $number.
          - Cette fonctionnalité est utile dans le cas où vous souhaitez afficher plus de 400 ou 500 valeurs sur un graphique. - En effet, au delà d'un certain nombre de valeurs, toutes ne seront pas affichées et le temps de création du graphique sera très élevé. - La solution est de réduire le nombre de valeurs sur votre graphique, ce que permet cette fonction. - Le processus de réduction se fait à travers un système de moyennes, afin de garder une courbe identique à celle que vous auriez eu en affichant toutes les valeurs. - Le nombre $number que vous spécifiez en paramètre est un nombre maximal. Pas plus de $number valeurs seront affichées sur le graphique. En revanche, dans certains cas, il est possible qu'un nombre inférieur de valeurs soient affichées. - Voici un exemple d'utilisation de cette fonctionnalité : -
          -
          -<?php
          -
          -require_once "LinePlot.class.php";
          -
          -$graph = new Graph(400, 400);
          -
          -$datay = array();
          -$datax = array();
          -
          -// On créé un tableau avec 3000 valeurs
          -for($i = 1; $i <= 3000; $i++) {
          -	$datay[] = log($i);
          -	$datax[] = $i;
          -}
          -
          -$plot = new LinePlot($datay);
          -$plot->xAxis->setLabelText($datax);
          -$plot->xAxis->label->setAngle(90);
          -
          -// On réduit le nombre de valeurs à afficher sur le graphique à 30,
          -// soit 100 fois moins
          -$plot->reduce(30);
          -
          -// On affiche le graphique
          -// Les valeurs de l'axe des X ont été automatiquement mises à jour
          -$graph->add($plot);
          -$graph->draw();
          -
          -// Finalement, la courbe représentative de log(x) apparaît très correctement
          -
          -?>
          -
          -
          -
          - -
        • -
        • -public setXAxis(string $axis) -
          - Change l'axe de abscisses qui sera affiché sur l'image. - Cela peut être Plot::TOP, Plot::BOTTOM ou Plot::BOTH. -
          - -
        • -
        • -public setYAxis(string $axis) -
          - Change l'axe de ordonnées qui sera affiché sur l'image. - Cela peut être Plot::LEFT, Plot::RIGHT ou Plot::BOTH. -
          - -
        • -
        • -public setXAxisZero(bool $zero) -
          - Précise si le ou les axes des abscisses doivent être centrés sur le zéro de l'axe des ordonnées. - Comme il peut y avoir plus axes des ordonnées, l'axe de gauche est choisi en premier pour sélectionner la valeur du zéro. S'il n'existe pas, alors on utilise l'axe de droite. -
          - -
        • -
        • -public setYAxisZero(bool $zero) -
          - Précise si le ou les axes des ordonnées doivent être centrés sur le zéro de l'axe des abscisses. - Comme il peut y avoir plus axes des abscisses, l'axe du bas est choisi en premier pour sélectionner la valeur du zéro. S'il n'existe pas, alors on utilise l'axe du haut. -
          - -
        • -
        • -public setYMin(float $value) -
          - Force la valeur minimale de l'axe des ordonnées à $value. - L'appel à cette méthode désactive la gestion automatique de l'axe des ordonnées. -
          - Voir aussi : - -
          -
          - -
        • -
        • -public setYMax(float $value) -
          - Force la valeur maximale de l'axe des ordonnées à $value. - L'appel à cette méthode désactive la gestion automatique de l'axe des ordonnées. -
          - Voir aussi : - -
          -
          - -
        • -
        • -public setXMin(float $value) -
          - Force la valeur minimale de l'axe des abscisses à $value. -
          - Voir aussi : - -
          -
          - -
        • -
        • -public setXMax(float $value) -
          - Force la valeur maximale de l'axe des abscisses à $value. -
          - Voir aussi : - -
          -
          - -
        • -
        -
         
         
        -
        - - \ No newline at end of file diff --git a/artichow/doc/PlotAxis.html b/artichow/doc/PlotAxis.html deleted file mode 100644 index 8cce714..0000000 --- a/artichow/doc/PlotAxis.html +++ /dev/null @@ -1,79 +0,0 @@ - - - Documentation - - - - - -
        - - - - - - - - - - - - - - - - -
          
         

        Class PlotAxis

        -

        - La classe PlotAxis permet d'utiliser des axes sur les PlotGroup. - Quatre axes sont disponibles (gauche, bas, droite et haut). -

        -

        Méthodes et propriétés

        Documentation

        -
         
         
        -
        - - \ No newline at end of file diff --git a/artichow/doc/PlotGroup.html b/artichow/doc/PlotGroup.html deleted file mode 100644 index 2c7f126..0000000 --- a/artichow/doc/PlotGroup.html +++ /dev/null @@ -1,156 +0,0 @@ - - - Documentation - - - - - -
        - - - - - - - - - - - - - - - - -
          
         

        Class PlotGroup

        -

        - Cette classe permet de gérer plusieurs objets Plot sur le même graphique. -

        -

        Méthodes et propriétés

        Documentation

        -
         
         
        -
        - - \ No newline at end of file diff --git a/artichow/doc/Point.html b/artichow/doc/Point.html deleted file mode 100644 index dba719f..0000000 --- a/artichow/doc/Point.html +++ /dev/null @@ -1,134 +0,0 @@ - - - Documentation - - - - - -
        - - - - - - - - - - - - - - - - -
          
         

        Class Point

        -

        La classe Point permet de manipuler des points dans un espace de deux dimensions.

        -

        Méthodes et propriétés

          -
        • -public float $x -
        • -
        • -public float $y -
        • -

        Documentation

          -
        • -public float $x
          - La position du point sur l'axe des abscisses. -
          - -
        • -
        • -public float $y
          - La position du point sur l'axe des ordonnées. -
          - -
        • -
        • -public __construct(float $x, float $y) -
          - Déclare un nouveau point avec des coordonnées x et y. -
          - -
        • -
        • -public setX(float $x) -
          - Change la position X du point. -
          - -
        • -
        • -public setY(float $y) -
          - Change la position Y du point. -
          - -
        • -
        • -public setLocation(float $x, float $y) -
          - Change la position du point pour les valeurs x et y passées en paramètre. -
          - -
        • -
        • -public array getLocation() -
          - Retourne la position du point dans un tableau à deux valeurs. -
          -
          -<?php
          -$p = new Point(3, 7);
          -list($x, $y) = $p->getLocation(); // array(3, 7)
          -?>
          -
          -
          -
          - -
        • -
        • -public float getDistance(Point $p) -
          - Retourne la distance entre le point et le point $p. -
          - -
        • -
        • -public move(float $x, float $y) -
          - Change la position du point en ajoutant à ses coordonnées actuelles les valeurs x et y passées en paramètre. -
          - -
        • -
        -
         
         
        -
        - - \ No newline at end of file diff --git a/artichow/doc/Polygon.html b/artichow/doc/Polygon.html deleted file mode 100644 index 5325dce..0000000 --- a/artichow/doc/Polygon.html +++ /dev/null @@ -1,147 +0,0 @@ - - - Documentation - - - - - -
        - - - - - - - - - - - - - - - - -
          
         

        Class Polygon

        -

        - Un polygone est une succcession de points. -

        -

        Méthodes et propriétés

        Documentation

          -
        • -protected array $points
          - Stocke tous les points du polygone. -
          - -
        • -
        • -public set(int $pos, Point $point) -
          - Ajoute ou remplace un point $point dans le polygon à la position $pos. - Cette méthode accepte la valeur NULL pour spécifier que ce point doit être ignoré. -
          - -
        • -
        • -public Point get(int $pos) -
          - Retourne le point du polygone à la position $pos. -
          - -
        • -
        • -public append(Point $point) -
          - Ajoute un point $point à la fin du polygone. - Cette méthode accepte la valeur NULL pour spécifier que ce point doit être ignoré. -
          - -
        • -
        • -public int count() -
          - Retourne le nombre de points contenus dans le polygone. -
          - -
        • -
        • -public array all() -
          - Permet de récupérer tous les points du polygone. -
          - -
        • -
        • -public array getLines() -
          • - Disponible depuis Artichow 1.0.9
          -
          - Renvoie un tableau contenant toutes les lignes formant le polygone. -
          - -
        • -
        • -public array getBoxPoints() -
          • - Disponible depuis Artichow 1.0.9
          -
          - Renvoie un tableau contenant les points supérieur droit et inférieur gauche du rectangle encadrant le polygone. -
          - -
        • -
        • -public array getBoxYRange() -
          • - Disponible depuis Artichow 1.0.9
          -
          - Renvoie un tableau contenant les ordonnées minimales et maximales de n'importe quel point appartenant au polygone (c'est à dire l'étendue du polygone le long de l'axe des ordonnées). -
          - -
        • -
        • -public array getBoxXRange() -
          • - Disponible depuis Artichow 1.0.9
          -
          - Renvoie un tableau contenant les abscisses minimales et maximales de n'importe quel point appartenant au polygone (c'est à dire l'étendue du polygone le long de l'axe des abscisses). -
          - -
        • -
        -
         
         
        -
        - - \ No newline at end of file diff --git a/artichow/doc/Positionable.html b/artichow/doc/Positionable.html deleted file mode 100644 index 3e46834..0000000 --- a/artichow/doc/Positionable.html +++ /dev/null @@ -1,101 +0,0 @@ - - - Documentation - - - - - -
        - - - - - - - - - - - - - - - - -
          
         

        Class Positionable

        -

        - Positionable est une interface que doivent implémenter les classes peuvent être positionnées par rapport à un Point. -

        -

        Méthodes et propriétés

          -
        • -const int LEFT := 1 -
        • -
        • -const int RIGHT := 2 -
        • -
        • -const int CENTER := 3 -
        • -
        • -const int TOP := 4 -
        • -
        • -const int BOTTOM := 5 -
        • -
        • -const int MIDDLE := 6 -
        • -
        • -public setAlign(int $h := NULL, int $v := NULL) -

        Documentation

        -
         
         
        -
        - - \ No newline at end of file diff --git a/artichow/doc/RadialGradient.html b/artichow/doc/RadialGradient.html deleted file mode 100644 index 6edbcf0..0000000 --- a/artichow/doc/RadialGradient.html +++ /dev/null @@ -1,35 +0,0 @@ - - - Documentation - - - - - -
        - - - - - - - - - - - - - - - - -
          
         

        Class RadialGradient

        -

        Cette classe permet de décrire un dégradé radial.

        -

        Méthodes et propriétés

        Documentation

          -
           
           
          -
          - - \ No newline at end of file diff --git a/artichow/doc/ScatterPlot.html b/artichow/doc/ScatterPlot.html deleted file mode 100644 index 367659a..0000000 --- a/artichow/doc/ScatterPlot.html +++ /dev/null @@ -1,164 +0,0 @@ - - - Documentation - - - - - -
          - - - - - - - - - - - - - - - - -
            
           

          Class ScatterPlot

          -

          - Les ScatterPlot (ou graphiques libres) permettent de dessiner des points aux coordonnées (x, y) sur une image. - Ce type de graphique est plus pluissant que les LinePlot car plusieurs points de même abscisse peuvent être placés sur le même graphique. -

          -

          Méthodes et propriétés

          Documentation

            -
          • -public Mark $mark
            - Représente les marques affichées sur chaque point. -
            - -
          • -
          • -public Label $label
            - Représente les étiquettes affichées au-dessus de chaque point. - Ces étiquettes ne sont pas affichées par défaut. -
            - -
          • -
          • -public __construct(array $datay, array $datax := NULL) -
            - Créé un nouveau ScatterPlot avec des points d'abscisses $datax et d'ordonnées $datay. - Si la valeur $datax est laissée à NULL, alors la librairie utilisera des valeurs incrémentales pour X, en commençant par zéro. -
            -
            -<?php
            -
            -require_once "ScatterPlot.class.php";
            -
            -$graph = new Graph(400, 400);
            -
            -// Tableaux de valeurs
            -$y = array(2, 4, 6);
            -$x = array(1, 4, 3);
            -
            -// On dessine les points (1, 2), (4, 4) et (3, 6)
            -$plot = new ScatterPlot($y, $x);
            -	
            -$graph->add($plot);
            -$graph->draw();
            -
            -?>
            -
            -
            -
            - -
          • -
          • -public setImpulse(Color $color) -
            - Si vous appelez cette méthode, les points de la courbe seront reliés à l'axe des abscisses par des segments de droite verticaux de couleur $color. - Cette méthode permet notamment de représenter des graphiques à impulsions. -
            - -
          • -
          • -public link(bool $link) -
            - Permet de lier les points du graphique entre eux. -
            - -
          • -
          • -public linkNull(bool $linkNull) -
            - Si $linkNull vaut TRUE, alors les valeurs en ordonnée égales à nulles n'interrompront pas le lien entre tous les points. - A l'inverse, si $linkNull vaut FALSE, alors le lien sera rompu à chaque fois qu'une valeur égale à NULL sera trouvée. - Cette méthode n'a de sens que lorsque vous avez choisi de relier les points entre eux. -
            - Voir aussi : - -
            -
            - -
          • -
          • -public setColor(Color $color) -
            - Change la couleur de la ligne qui relie les points du composant entre eux. -
            - -
          • -
          • -public setStyle(int $style) -
            - Change le style de ligne (Line::SOLID, Line::DOTTED ou Line::DASHED) qui relie chaque point. -
            - -
          • -
          • -public setThickness(int $thickness) -
            - Change l'épaisseur de la ligne qui relie les points du composant entre eux. - L'épaisseur de la ligne doit être toujours positive. -
            - -
          • -
          -
           
           
          -
          - - \ No newline at end of file diff --git a/artichow/doc/Shadow.html b/artichow/doc/Shadow.html deleted file mode 100644 index 6d39501..0000000 --- a/artichow/doc/Shadow.html +++ /dev/null @@ -1,234 +0,0 @@ - - - Documentation - - - - - -
          - - - - - - - - - - - - - - - - -
            
           

          Class Shadow

          -

          - La classe Shadow permet de manipuler des ombres sur des rectangles. -

          -

          Méthodes et propriétés

          Documentation

          -
           
           
          -
          - - \ No newline at end of file diff --git a/artichow/doc/Shape.html b/artichow/doc/Shape.html deleted file mode 100644 index af83840..0000000 --- a/artichow/doc/Shape.html +++ /dev/null @@ -1,177 +0,0 @@ - - - Documentation - - - - - -
          - - - - - - - - - - - - - - - - -
            
           

          Class Shape

          -

          La classe Shape permet de représenter toutes sortes de formes sur Artichow.

          -
          - Les classes suivantes dérivent de Shape : - -

          Méthodes et propriétés

          Documentation

            -
          • -const int SOLID := 1
            - Désigne une ligne continue. -
            - -
          • -
          • -const int DOTTED := 2
            - Désigne une ligne pointillée. -
            - -
          • -
          • -const int DASHED := 3
            - Désigne une ligne avec de larges pointillés. -
            - -
          • -
          • -public int $style
            - Décrit le style du pourtour de la forme. Peut être Shape::DOTTED, Shape::SOLID ou Shape::DASHED. -
            - -
          • -
          • -public int $thickness
            - L'épaisseur du pourtour de la forme. -
            - -
          • -
          • -protected bool $hide
            - Déterminer si la forme doit être cachée ou non. -
            - -
          • -
          • -public __construct(float $x, float $y) -
            - Déclare un nouveau point avec des coordonnées x et y. -
            - -
          • -
          • -public setStyle(int $style) -
            - Change le style du pourtour de la forme. Peut être Shape::SOLID pour un pourtour continu, Shape::DOTTED pour un pourtour pointillé ou encore Shape::DASHED. -
            - -
          • -
          • -public int getStyle() -
            - Retourne le style actuel de la forme. -
            - -
          • -
          • -public setThickness(int $thickness) -
            - Change l'épaisseur du pourtour de la forme. Cette épaisseur doit être donnée en pixels. -
            - -
          • -
          • -public int getThickness() -
            - Retourne l'épaisseur du pourtour de la forme. -
            - -
          • -
          • -public hide(bool $hide) -
            - Détermine si la forme doit être cachée ou non. -
            - -
          • -
          • -public show(bool $show) -
            - Détermine si la forme doit être affichée ou non. -
            - -
          • -
          • -public bool isHidden() -
            - Retourne TRUE si la forme est cachée, FALSE si elle est visible. -
            - -
          • -
          -
           
           
          -
          - - \ No newline at end of file diff --git a/artichow/doc/Side.html b/artichow/doc/Side.html deleted file mode 100644 index ed74977..0000000 --- a/artichow/doc/Side.html +++ /dev/null @@ -1,94 +0,0 @@ - - - Documentation - - - - - -
          - - - - - - - - - - - - - - - - -
            
           

          Class Side

          -

          - La classe Side est un objet qui fournit des méthodes pour gérer des situations où il est besoin de valoriser les côtés gauche, droit, haut et bas avec des entiers. -

          -

          Méthodes et propriétés

            -
          • -public int $left := 0 -
          • -
          • -public int $right := 0 -
          • -
          • -public int $top := 0 -
          • -
          • -public int $bottom := 0 -
          • -
            -
          • -public __construct(mixed $left, mixed $right, mixed $top, mixed $bottom) -
          • -
          • -public set(mixed $left, mixed $right, mixed $top, mixed $bottom) -
          • -

          Documentation

            -
          • -public int $left := 0
            - Le côté gauche. -
            - -
          • -
          • -public int $right := 0
            - Le côté droit. -
            - -
          • -
          • -public int $top := 0
            - Le côté haut. -
            - -
          • -
          • -public int $bottom := 0
            - Le côté bas. -
            - -
          • -
          • -public __construct(mixed $left, mixed $right, mixed $top, mixed $bottom) -
            - Construit l'objet Side avec les valeurs $left, $right, $top et $bottom pour les côtés gauche, droit, haut et bas. -
            - -
          • -
          • -public set(mixed $left, mixed $right, mixed $top, mixed $bottom) -
            - Change les valeurs associées aux côtés gauche, droit, haut et bas. - Laisser un paramètre à NULL permet d'éviter que la valeur du côté soit modifiée. -
            - -
          • -
          -
           
           
          -
          - - \ No newline at end of file diff --git a/artichow/doc/TTFFont.html b/artichow/doc/TTFFont.html deleted file mode 100644 index 8ba4e08..0000000 --- a/artichow/doc/TTFFont.html +++ /dev/null @@ -1,58 +0,0 @@ - - - Documentation - - - - - -
          - - - - - - - - - - - - - - - - -
            
           

          Class TTFFont

          -

          - La classe TTFFont permet de manipuler des polices TrueType. - Quelques polices sont disponibles dans le répertoire font/ de Artichow. - Si vous connaissez d'autres polices intéressantes et dans le domaine public, n'hésitez pas à le signaler à vincent sur artichow point org. -

          -

          Méthodes et propriétés

          Documentation

            -
          • -public int $size
            - La taille de la police en pixels. -
            - -
          • -
          • -public __construct(string $font, int $size) -
            - Construit la police $font de taille $size pixels. - La chaîne $font peut être soit le chemin vers un fichier de police TrueType, soit juste le nom de ce fichier. Dans ce dernier cas, le fichier de police sera recherché dans le dossier font/ du répertoire d'Artichow qui contient les quelques polices disponible de base. -
            - -
          • -
          -
           
           
          -
          - - \ No newline at end of file diff --git a/artichow/doc/Text.html b/artichow/doc/Text.html deleted file mode 100644 index 7bbdbb8..0000000 --- a/artichow/doc/Text.html +++ /dev/null @@ -1,186 +0,0 @@ - - - Documentation - - - - - -
          - - - - - - - - - - - - - - - - -
            
           

          Class Text

          -

          - La classe Text permet de manipuler du texte de manière uniforme sur Artichow. -

          -

          Méthodes et propriétés

          Documentation

            -
          • -public Border $border
            - La bordure qui entoure le texte. -
            - -
          • -
          • -public __construct(string $text, Font $font := new Font(Text::FONT_2), Color $color := NULL, int $angle := 0) -
            - Créé un nouveau pavé de texte avec pour texte $text. $font représente la police utilisée pour le texte tandis que $color représente sa couleur. - L'angle est définit par le paramètre $angle, qui peut prendre les valeurs de 0 et 90°. -
            - -
          • -
          • -public string getText() -
            - Retourne le texte de la classe. -
            - -
          • -
          • -public setText(string $text) -
            - Change le texte associé à l'objet pour $text. -
            - -
          • -
          • -public Font getFont() -
            - Retourne la police utilisée pour le texte. -
            - -
          • -
          • -public setFont(Font $font) -
            - Change la police utilisée pour le texte. -
            - -
          • -
          • -public int getAngle() -
            - Retourne l'angle du texte. -
            - -
          • -
          • -public setAngle(int $angle) -
            - Change l'angle du texte. Les valeurs possibles sont 0 ou 90°. -
            - -
          • -
          • -public int getColor() -
            - Retourne la couleur du texte. -
            - -
          • -
          • -public setColor(Color $color) -
            - Change la couleur du texte. -
            - -
          • -
          • -public mixed getBackground() -
            - Retourne le fond du texte. Si aucun fond n'a été spécifié, cette méthode retourne NULL. - Dans le cas contraire, elle retourne un objet de la classe Color pour les couleurs, soit une instance de Gradient pour les dégradés. -
            - -
          • -
          • -public setBackgroundColor(Color $color) -
            - Change la couleur de fond du texte. -
            - -
          • -
          • -public setBackgroundGradient(Gradient $gradient) -
            - Change le dégradé de fond du texte. -
            - -
          • -
          • -public array getPadding() -
            - Retourne la valeur de l'espace qui entoure le texte par rapport à sa bordure. Cette méthode retourne un tableau de quatre valeurs, qui correspondent à l'espace de gauche, droite, haut et bas. -
            - -
          • -
          • -public setPadding(int $left, int $right, int $top, int $bottom) -
            - Change la valeur de l'espace qui entoure le texte par rapport à sa bordure. -
            - -
          • -
          -
           
           
          -
          - - \ No newline at end of file diff --git a/artichow/doc/Tick.html b/artichow/doc/Tick.html deleted file mode 100644 index 9302862..0000000 --- a/artichow/doc/Tick.html +++ /dev/null @@ -1,188 +0,0 @@ - - - Documentation - - - - - -
          - - - - - - - - - - - - - - - - -
            
           

          Class Tick

          -

          - La classe Tick permet de représenter des ticks, petits traits réguliers associés à un axe. -

          -
          - Ticks à l'extérieur - Ticks à l'intérieur -
          -

          - De nombreuses méthodes de la classe Tick ne sont pas documentées, - car elles ne sont utilisées qu'en interne par Artichow. - Néanmoins, si vous développez Artichow, vous aurez besoin de ces méthodes. - N'hésitez donc pas à parcourir le code source de cette classe. -

          -

          Méthodes et propriétés

            -
          • -const string OUT := 0 -
          • -
          • -const string IN := 1 -
          • -
          • -const string IN_OUT := 2 -
          • -

          Documentation

            -
          • -const string OUT := 0
            - Indique que les ticks doivent être tournés vers l'extérieur. -
            - -
          • -
          • -const string IN := 1
            - Indique que les types doivent être tournés vers l'intérieur. -
            - -
          • -
          • -const string IN_OUT := 2
            - Indique que les ticks sont et tournés vers l'extérieur, et tournés vers l'intérieur. -
            - -
          • -
          • -public __construct(int $number, int $size) -
            - Construit un nouvel objet Tick. - $number représente un nombre de ticks et $size leur taille en pixels. -
            - -
          • -
          • -public setStyle(int $style) -
            - Change le style des ticks. Peut être Tick::IN, Tick::OUT ou Tick::IN_OUT. - Dans le premier cas, les ticks seront tournés vers l'intérieur. Dans le second vers l'extérieur et dans le troisième et vers l'extérieur et vers l'intérieur. -
            - -
          • -
          • -public setColor(Color $color) -
            - Change la couleur des ticks pour $color. - Par défaut, les ticks sont dessinés en noir. -
            - -
          • -
          • -public setSize(int $size) -
            - Change la taille des ticks pour $size. - $size doit être donné en pixels. -
            - -
          • -
          • -public setInterval(int $interval) -
            - Change l'intervalle d'affichage des ticks par rapport à leur nombre. - Si $interval vaut 1, alors tous les ticks seront affichés. - Si $interval vaut 0.5, alors un tick sur deux sera affiché. -
            - Voir aussi : - -
            -
            - -
          • -
          • -public setNumber(int $number) -
            - Change le nombre de ticks à afficher pour $number. -
            - Voir aussi : - -
            -
            - -
          • -
          • -public hide(bool $hide) -
            - Permet de cache ou d'afficher les ticks. -
            - -
          • -
          • -public hideFirst(bool $hideFirst) -
            - Permet de cache ou d'afficher le premier tick. -
            - -
          • -
          • -public hideLast(bool $hideLast) -
            - Permet de cache ou d'afficher le dernier tick. -
            - -
          • -
          • -public draw(Driver $driver, Vector $vector) -
            - Dessine les ticks sur le vecteur $vector. -
            - -
          • -
          -
           
           
          -
          - - \ No newline at end of file diff --git a/artichow/doc/Vector.html b/artichow/doc/Vector.html deleted file mode 100644 index 93053e3..0000000 --- a/artichow/doc/Vector.html +++ /dev/null @@ -1,48 +0,0 @@ - - - Documentation - - - - - -
          - - - - - - - - - - - - - - - - -
            
           

          Class Vector

          -

          - La classe Vector permet de représenter un vecteur. -

          -

          Méthodes et propriétés

          Documentation

          • -public float getAngle() -
            - Retourne l'angle du vecteur en radians. -
            - -
          -
           
           
          -
          - - \ No newline at end of file diff --git a/artichow/doc/image/back-rayures.png b/artichow/doc/image/back-rayures.png deleted file mode 100644 index 127b1c3..0000000 Binary files a/artichow/doc/image/back-rayures.png and /dev/null differ diff --git a/artichow/doc/image/coin-bd.gif b/artichow/doc/image/coin-bd.gif deleted file mode 100644 index 7eac688..0000000 Binary files a/artichow/doc/image/coin-bd.gif and /dev/null differ diff --git a/artichow/doc/image/coin-bd.png b/artichow/doc/image/coin-bd.png deleted file mode 100644 index 3a74021..0000000 Binary files a/artichow/doc/image/coin-bd.png and /dev/null differ diff --git a/artichow/doc/image/coin-bg-long.gif b/artichow/doc/image/coin-bg-long.gif deleted file mode 100644 index a029ea1..0000000 Binary files a/artichow/doc/image/coin-bg-long.gif and /dev/null differ diff --git a/artichow/doc/image/coin-bg.gif b/artichow/doc/image/coin-bg.gif deleted file mode 100644 index 53de14d..0000000 Binary files a/artichow/doc/image/coin-bg.gif and /dev/null differ diff --git a/artichow/doc/image/coin-hd-transparent.gif b/artichow/doc/image/coin-hd-transparent.gif deleted file mode 100644 index fd32211..0000000 Binary files a/artichow/doc/image/coin-hd-transparent.gif and /dev/null differ diff --git a/artichow/doc/image/coin-hd.gif b/artichow/doc/image/coin-hd.gif deleted file mode 100644 index 14b0c9a..0000000 Binary files a/artichow/doc/image/coin-hd.gif and /dev/null differ diff --git a/artichow/doc/image/coin-hg-transparent.gif b/artichow/doc/image/coin-hg-transparent.gif deleted file mode 100644 index bb7dac6..0000000 Binary files a/artichow/doc/image/coin-hg-transparent.gif and /dev/null differ diff --git a/artichow/doc/image/coin-hg.gif b/artichow/doc/image/coin-hg.gif deleted file mode 100644 index 1da6df7..0000000 Binary files a/artichow/doc/image/coin-hg.gif and /dev/null differ diff --git a/artichow/doc/image/fond-flou.gif b/artichow/doc/image/fond-flou.gif deleted file mode 100644 index 4299f56..0000000 Binary files a/artichow/doc/image/fond-flou.gif and /dev/null differ diff --git a/artichow/doc/image/fond.png b/artichow/doc/image/fond.png deleted file mode 100644 index f616c01..0000000 Binary files a/artichow/doc/image/fond.png and /dev/null differ diff --git a/artichow/doc/index.html b/artichow/doc/index.html deleted file mode 100644 index 8df2010..0000000 --- a/artichow/doc/index.html +++ /dev/null @@ -1,138 +0,0 @@ - - - Documentation - - - - - -
          - - - - - - - - - - - - - - - - -
            
            - -

          La documentation de Artichow

          -

          - Cette documentation vous explique comment utiliser les classes de Artichow. - Vous retrouverez sur le site de Artichow une documentation plus complète, ainsi que des tutoriels. - Attention, cette documentation est conçue pour la version PHP 5 de Artichow, qui est incompatible avec la version PHP 4 & 5. - Vous pouvez retrouver sur le site une liste de ces incompatibilités afin de pouvoir utiliser tout de même cette documentation. -

          - -

          Les classes de Artichow

          - -

          Classes de traitement de l'image

          - - -

          Classes de traitement des composants

          - - -

          Classe graphique

          - - -

          Classes de dessin

          - - -

          Classes pour le traitement géométrique

          - - -

          Outils d'aide au dessin

          - - -
           
           
          -
          - - \ No newline at end of file diff --git a/artichow/doc/style.css b/artichow/doc/style.css deleted file mode 100644 index 7924c1c..0000000 --- a/artichow/doc/style.css +++ /dev/null @@ -1,383 +0,0 @@ -body { - font-family: "Trebuchet MS", Geneva, Arial, Helvetica, SunSans-Regular, Verdana, sans-serif; - font-size: 0.75em; - margin: 0px; - padding: 0px; - background-color: #c2d2c4; - background-image: url("image/fond.png"); - background-repeat: repeat-x; - padding-top: 20px; -} - - -a { - color: #000055; - text-decoration: none; -} - -a:hover { - color: #295F37; - text-decoration: underline; -} - -p { - padding-left: 1em; - padding-right: 1em; - text-align: justify; -} - -p:first-letter { - float: left; - font-size: 160%; - font-weight: bold; - color: #646464; - background-color: white; - margin-top: -7px; - margin-right: 3px; - padding-right: 0px; - padding-left: 2px; - margin-bottom: -10px; -} - -pre { - margin: 0px; - padding: 0px; - font-size: 1.25em; -} - -span.php4 { - color: red; - font-weight: bold; -} - -.borderhg { - border-top: 1px solid black; - border-left: 1px solid black; -} - -.borderd { - border-right: 1px solid black; -} - -.borderg { - border-left: 1px solid black; -} - -.borderh { - border-top: 1px solid black; -} - -.borderb { - border-bottom: 1px solid black; -} - - -table#page { - width: 900px; - margin: auto; - text-align: left; -} - -table#page td { - vertical-align: top; -} - -table#page div.logo { - text-align: center; -} - -table#page td table.features td { - vertical-align: middle; -} - -table#menuhaut, table#menubas { - width: 200px; - background-color: white; -} - -table#menuhaut td.cornerhg { - width: 30px; - height: 30px; - background: transparent url("image/coin-hg.gif") no-repeat; -} -table#menubas td.cornerbg { - width: 30px; - height: 30px; - background: url("image/coin-bg.gif") no-repeat; -} - - -div#menu { - border-left: 1px solid black; - background-color: white; -} - - -div#menu ul.ulmenu { - padding: 0px; - margin: 0px; - background-color: #dddddd; -} - -div#menu ul.ulmenu li { - margin: 0px; - list-style-type: none; -} - -div#menu ul.ulmenu a { - display: block; - text-decoration: none; - padding-left: 1em; - color: black; - width: 100%; - border-top: 1px solid black; - -} - -div#menu ul.ulmenu a:hover { - color: #dddddd; - background-color: #a43030; - display: block; -} - -table#contenu { - width: 100%; - color: #2d2d2d; - background-color: white; -} - -table#contenu td.cornerhd, table#contenu td.cornerhg, table#contenu td.cornerbd, table#contenu td.cornerbg { - width: 30px; - height: 30px; -} - -table#contenu td.cornerhd { - background: transparent url("image/coin-hd.gif") no-repeat; -} - -table#contenu td.cornerbd { - background: url("image/coin-bd.gif") no-repeat; -} - -table#contenu td.cornerbg { - background: url("image/coin-bg.gif") no-repeat; -} - -table#contenu table { - width: 95%; - margin: auto; -} - -table#contenu h1 { - text-align: center; - margin: auto; - width: 100%; - color: #a43030; -} - -table#contenu h2:after { - border: 0px; - background-color: transparent; - display: block; - margin-left: -1px; - padding-top: 31px; - width: 97%; - line-height: 1em; - margin-bottom: -25px; - text-align: left; - background: transparent url("image/back-rayures.png") repeat-x; - content: ""; - -} - -table#contenu h4 { - margin-top: 0.3em; - margin-left: 1em; - margin-bottom: 0.5em; - font-size: 1.25em; -} - -table#contenu h5 { - margin-top: 0.3em; - margin-left: 1em; - margin-bottom: 0.5em; - font-size: 1.0em; -} - -table#contenu pre { - margin-left: 1em; -} - -table#contenu ul.features li { - list-style-type: armenian; - margin-left: 3em; -} - -table#contenu div.graph { - padding-top: 8px; - text-align: center; -} - -table#contenu div.graph img { - border: 0px; -} - -table#contenu div.image { - text-align: center; - margin-top: 2em; -} - -table#contenu span.type { - color: #0000FF; -} - -table#contenu span.default { - color: #A000A0; -} - -table#contenu span.interface { - font-weight: bold; -} - -table#contenu span.argument { - color: #880000; -} - -table#contenu span.access { - font-weight: bold; - color: #3B3F3C; - -} - -table#contenu div.description { - margin-right: 3em; - margin-left: 2em; - border: 1px solid #A7BFAD; - padding: 4px; - -} - -table#contenu ul.news li { - list-style-type: none; -} - -table#contenu ul.news li ul li { - list-style-type: square; - margin-left: 20px; -} - -table#contenu div.description ul li { - list-style-type: circle; - font-size: 95%; -} - -table#contenu div.description div.see { - margin-right: 1em; - margin-left: 1em; - background-color: #f0f0f0; - padding: 3px; - -} - -table#contenu div.description div.see ul li { - list-style-type: circle; - margin-bottom: 0em; - margin-top: 0em; - padding-bottom: 0em; - padding-top: 0em; - -} - -table#contenu div.inherit { - border-bottom: 1px solid #a43030; - margin-right: 3em; - margin-left: 2em; - padding: 4px; -} - - -table#contenu ul.doc li.method { -} - -table#contenu ul.doc li.property { -} - -table#contenu ul.doc li { - margin-bottom: 0.5em; - padding: 0.3em; -} - -table#contenu ul { - margin-left: 1.5em; - padding-left: 0px; - padding-right: 1em; -} - -table#contenu ul li { - list-style-type: square; - margin-left: 1em; -} - -table#contenu ul.constants li, table#contenu ul.methods li, table#contenu ul.properties li, -table#contenu ul li.constant, table#contenu ul li.method, table#contenu ul li.property - { - list-style-type: none; - margin-left: 0px; -} - -table#contenu ul.links li { -} - -table#contenu a.easy { - color: red; -} - -div.release { - background-color: #eeeeee; - padding-left: 20px; -} - -div#imagemenu { - background-image: url("mini.php"); - height: 100px; - width: 150px; - margin-left: 25px; - margin-top: 30px; - border: 0px; -} - -td#textebas { - text-align: center; -} - -table#bas { - float:left; - width: 100%; - background-color: white; - margin-top: 10px; -} - -table#bas td.cornerhd, table#bas td.cornerhg, table#bas td.cornerbd, table#bas td.cornerbg { - width: 30px; - height: 30px; -} - -table#bas td.cornerhd { - background: url("image/coin-hd-transparent.gif") no-repeat; -} - -table#bas td.cornerhg { - background: url("image/coin-hg-transparent.gif") no-repeat; -} - -table#bas td.cornerbd { - background: url("image/coin-bd.gif") no-repeat; -} - -table#bas td.cornerbg { - background: url("image/coin-bg.gif") no-repeat; -} - -table#contenu ul.demo li { - list-style-type : circle; -} diff --git a/artichow/examples/AntiSpam-image.php b/artichow/examples/AntiSpam-image.php deleted file mode 100644 index 5a20e92..0000000 --- a/artichow/examples/AntiSpam-image.php +++ /dev/null @@ -1,16 +0,0 @@ -setRand(5); -$object->save('example'); -$object->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/AntiSpam-valid.php b/artichow/examples/AntiSpam-valid.php deleted file mode 100644 index afbd365..0000000 --- a/artichow/examples/AntiSpam-valid.php +++ /dev/null @@ -1,22 +0,0 @@ -check('example', $_GET['code'])) { - echo "Good value :-)"; -} else { - echo "Bad value :-("; -} -?> - \ No newline at end of file diff --git a/artichow/examples/AntiSpam.php b/artichow/examples/AntiSpam.php deleted file mode 100644 index 0a97dad..0000000 --- a/artichow/examples/AntiSpam.php +++ /dev/null @@ -1,14 +0,0 @@ - -
          - - - -
          \ No newline at end of file diff --git a/artichow/examples/all.php b/artichow/examples/all.php deleted file mode 100644 index d5d2621..0000000 --- a/artichow/examples/all.php +++ /dev/null @@ -1,55 +0,0 @@ -"; - - foreach($files as $key => $file) { - - if($key%2 == 0) { - echo ""; - } - - if($re === NULL or eregi($re, $file)) { - image($file); - } - - if($key%2 == 1) { - echo ""; - } - - - } - - if($key%2 == 0) { - echo ""; - } - - echo ""; - -} - -function image($file) { - echo " -

          ".$file."

          - - "; -} -?> -

          Artichow examples

          - -

          Artichow.org examples

          - -

          Artichow tutorials

          - \ No newline at end of file diff --git a/artichow/examples/bar-001.php b/artichow/examples/bar-001.php deleted file mode 100644 index aef1410..0000000 --- a/artichow/examples/bar-001.php +++ /dev/null @@ -1,30 +0,0 @@ -title->set('The title'); -$graph->border->setStyle(Line::DASHED); -$graph->border->setColor(new DarkGray); - -$values = array(19, 42, 15, -25, 3); - -$plot = new BarPlot($values); -$plot->setSize(1, 0.96); -$plot->setCenter(0.5, 0.52); - -$plot->setBarColor( - new VeryLightPurple(25) -); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/bar-002.php b/artichow/examples/bar-002.php deleted file mode 100644 index 822812c..0000000 --- a/artichow/examples/bar-002.php +++ /dev/null @@ -1,37 +0,0 @@ -setBarGradient( - new LinearGradient( - new LightBlue(25), - new VeryLightOrange(25), - 90 - ) -); - -$plot->setSpace(5, 5, NULL, NULL); - -$plot->barShadow->setSize(4); -$plot->barShadow->setPosition(Shadow::RIGHT_TOP); -$plot->barShadow->setColor(new Color(180, 180, 180, 10)); -$plot->barShadow->smooth(TRUE); - - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/bar-003.php b/artichow/examples/bar-003.php deleted file mode 100644 index 39ab795..0000000 --- a/artichow/examples/bar-003.php +++ /dev/null @@ -1,37 +0,0 @@ -title->set('Two bars'); - -$values = array(12, 8, 13, 2, 4); - -$group = new PlotGroup; -$group->setPadding(NULL, NULL, 35, NULL); - -$plot = new BarPlot($values, 1, 2); -$plot->setBarColor(new LightBlue(25)); -$plot->setBarSpace(5); - -$group->add($plot); - -$values = array(1, 7, 2, 10, 6); - -$plot = new BarPlot($values, 2, 2); -$plot->setBarColor(new LightOrange(25)); -$plot->setBarSpace(5); - -$group->add($plot); - -$graph->add($group); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/bar-004.php b/artichow/examples/bar-004.php deleted file mode 100644 index 8b76239..0000000 --- a/artichow/examples/bar-004.php +++ /dev/null @@ -1,36 +0,0 @@ -title->set('Two bars with depth'); - -$group = new PlotGroup; -$group->setPadding(NULL, NULL, 35, NULL); -$group->setSpace(5, 5, NULL, NULL); - -$group->grid->hide(TRUE); - -$values = array(1, 7, 2, 10, 6, 3, 4, 7); - -$plot = new BarPlot($values, 1, 1, 5); -$plot->setBarColor(new LightBlue(25)); -$group->add($plot); - -$values = array(12, 8, 13, 2, 4, 8, 4, 3); - -$plot = new BarPlot($values, 1, 1, 0); -$plot->setBarColor(new LightRed(25)); -$group->add($plot); - -$graph->add($group); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/bar-005.php b/artichow/examples/bar-005.php deleted file mode 100644 index e0e3f57..0000000 --- a/artichow/examples/bar-005.php +++ /dev/null @@ -1,59 +0,0 @@ -title->set('The title'); - -// Change graph background color -$graph->setBackgroundColor(new Color(230, 230, 230)); - -$values = array(8, 2, 6, 1, 3, 5); - -// Declare a new BarPlot -$plot = new BarPlot($values); - -// Reduce padding around the plot -$plot->setPadding(NULL, NULL, NULL, 20); - -// Reduce plot size and move it to the bottom of the graph -$plot->setSize(1, 0.96); -$plot->setCenter(0.5, 0.52); - -// Set a background color to the plot -$plot->grid->setBackgroundColor(new White); -// Set a dashed grid -$plot->grid->setType(Line::DASHED); - - -$plot->label->set($values); -$plot->label->move(0, -10); -$plot->label->setColor(new DarkBlue); - -// Set a shadow to the bars -$plot->barShadow->setSize(2); - -// Bar size is at 60% -$plot->setBarSize(0.6); - -// Change the color of the bars -$plot->setBarColor( - new Orange(15) -); - -// Add the plot to the graph -$graph->add($plot); - -// Draw the graph -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/champignon.png b/artichow/examples/champignon.png deleted file mode 100644 index 1ab0caf..0000000 Binary files a/artichow/examples/champignon.png and /dev/null differ diff --git a/artichow/examples/line-001.php b/artichow/examples/line-001.php deleted file mode 100644 index efc1870..0000000 --- a/artichow/examples/line-001.php +++ /dev/null @@ -1,29 +0,0 @@ -setSpace(6, 6, 10, 10); - -$plot->hideLine(TRUE); -$plot->setFillColor(new Color(180, 180, 180, 75)); - -$plot->mark->setType(Mark::IMAGE); -$plot->mark->setImage(new FileImage("champignon.png")); - -$plot->grid->setBackgroundColor(new Color(235, 235, 180, 60)); - -$plot->label->set($x); -$plot->label->move(0, -23); -$plot->label->setBackgroundGradient(new LinearGradient(new Color(250, 250, 250, 10), new Color(255, 200, 200, 30), 0)); -$plot->label->border->setColor(new Color(20, 20, 20, 20)); -$plot->label->setPadding(3, 1, 1, 0); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/line-002.php b/artichow/examples/line-002.php deleted file mode 100644 index 2227869..0000000 --- a/artichow/examples/line-002.php +++ /dev/null @@ -1,52 +0,0 @@ -setAntiAliasing(TRUE); - -$x = array( - 1, 2, 5, 0.5, 3, 8 -); - -$plot = new LinePlot($x); - -$plot->setSpace(6, 6, 10, 10); -$plot->setXAxisZero(FALSE); - -// Set a background gradient -$plot->setBackgroundGradient( - new LinearGradient( - new Color(210, 210, 210), - new Color(255, 255, 255), - 0 - ) -); - -// Change line color -$plot->setColor(new Color(0, 0, 150, 20)); - -// Set line background gradient -$plot->setFillGradient( - new LinearGradient( - new Color(150, 150, 210), - new Color(230, 230, 255), - 90 - ) -); - -// Change mark type -$plot->mark->setType(Mark::CIRCLE); -$plot->mark->border->show(); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/line-003.php b/artichow/examples/line-003.php deleted file mode 100644 index 8f3461d..0000000 --- a/artichow/examples/line-003.php +++ /dev/null @@ -1,44 +0,0 @@ -setAntiAliasing(TRUE); - -$x = array( - 1, 2, 5, 0.5, 3, 8, 7, 6, 2, -4 -); - -$plot = new LinePlot($x); - -// Set a background gradient -$plot->setBackgroundGradient( - new LinearGradient( - new Color(210, 210, 210), - new Color(255, 255, 255), - 0 - ) -); - -// Set semi-transparent background gradient -$plot->setFillGradient( - new LinearGradient( - new Color(230, 150, 150, 20), - new Color(230, 230, 180, 50), - 90 - ) -); - -$plot->yAxis->setLabelPrecision(1); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/line-004.php b/artichow/examples/line-004.php deleted file mode 100644 index 9cb3d3e..0000000 --- a/artichow/examples/line-004.php +++ /dev/null @@ -1,59 +0,0 @@ -setAntiAliasing(TRUE); - -$x = array( - 1, 2, 5, 0.5, 3, 8, 7, 6, 2, -4 -); - -$plot = new LinePlot($x); - -// Change component padding -$plot->setPadding(10, NULL, NULL, NULL); - -// Change component space -$plot->setSpace(5, 5, 5, 5); - -// Set a background color -$plot->setBackgroundColor( - new Color(230, 230, 230) -); - -// Change grid background color -$plot->grid->setBackgroundColor( - new Color(235, 235, 180, 60) -); - -// Hide grid -$plot->grid->hide(TRUE); - -// Hide labels on Y axis -$plot->yAxis->label->hide(TRUE); - -$plot->xAxis->label->setInterval(2); - -$plot->label->set($x); -$plot->label->setFormat('%.1f'); -$plot->label->setBackgroundColor(new Color(240, 240, 240, 15)); -$plot->label->border->setColor(new Color(255, 0, 0, 15)); -$plot->label->setPadding(5, 3, 1, 1); - -$plot->xAxis->label->move(0, 5); -$plot->xAxis->label->setBackgroundColor(new Color(240, 240, 240, 15)); -$plot->xAxis->label->border->setColor(new Color(0, 150, 0, 15)); -$plot->xAxis->label->setPadding(5, 3, 1, 1); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/line-005.php b/artichow/examples/line-005.php deleted file mode 100644 index c03240e..0000000 --- a/artichow/examples/line-005.php +++ /dev/null @@ -1,36 +0,0 @@ -setFilledArea(7, 9, new DarkGreen(25)); - -// Filled the area with a gradient -$gradient = new LinearGradient( - new Yellow(25), - new Orange(25), - 90 -); -$plot->setFilledArea(1, 4, $gradient); - -// Hide first label -$plot->xAxis->label->hideFirst(TRUE); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/line-006.php b/artichow/examples/line-006.php deleted file mode 100644 index 709b08e..0000000 --- a/artichow/examples/line-006.php +++ /dev/null @@ -1,49 +0,0 @@ -setTiming(TRUE); -$graph->setAntiAliasing(TRUE); - - -$x = array(); -for($i = 0; $i < 10; $i++) { - $x[] = mt_rand(0, 100); -} - -$plot = new LinePlot($x); -$plot->setColor( - new Color(60, 60, 150) -); -$plot->setFillGradient( - new LinearGradient( - new Color(120, 175, 80, 47), - new Color(231, 172, 113, 30), - 0 - ) -); - -$plot->grid->setType(Line::DASHED); - -$plot->setYMin(-5); - -$plot->yAxis->setLabelNumber(8); -$plot->yAxis->setLabelPrecision(1); - -$plot->xAxis->setNumberByTick('minor', 'major', 3); - -$plot->setXAxisZero(TRUE); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/line-007.php b/artichow/examples/line-007.php deleted file mode 100644 index bdc6894..0000000 --- a/artichow/examples/line-007.php +++ /dev/null @@ -1,67 +0,0 @@ -setAntiAliasing(TRUE); -$graph->title->set("Some lines"); - -$group = new PlotGroup; -$group->setXAxisZero(FALSE); -$group->setBackgroundColor(new Color(197, 180, 210, 80)); - -$group->setPadding(40, NULL, 50, NULL); - -$group->axis->left->setLabelNumber(8); -$group->axis->left->setLabelPrecision(1); -$group->axis->left->setTickStyle(Tick::OUT); - -$group->axis->bottom->setTickStyle(Tick::OUT); - -// Display two lines -for($n = 0; $n < 2; $n++) { - - $x = array(); - - for($i = 0; $i < 10; $i++) { - $x[] = (cos($i * M_PI / 5)) / ($n + 1); - } - - $plot = new LinePlot($x); - $plot->setColor(color(10)); // Random line color - $plot->setFillColor(color(90)); // Random background color - - $plot->label->set($x); - $plot->label->setBackgroundColor(new Color(220, 234, 230, 25)); - $plot->label->setPadding(1, 0, 0, 0); - $plot->label->setCallbackFunction("formatLabel"); - $plot->label->setInterval(2); - - $group->add($plot); - $group->legend->add($plot, "Line #".($n + 1), Legend::LINE); - -} - -$group->legend->setSpace(12); -$group->legend->setBackgroundColor(new Color(255, 255, 255)); -$group->setPadding(NULL, 100, NULL, NULL); - -$graph->add($group); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/line-008.php b/artichow/examples/line-008.php deleted file mode 100644 index bffea9d..0000000 --- a/artichow/examples/line-008.php +++ /dev/null @@ -1,34 +0,0 @@ -setAntiAliasing(TRUE); -$graph->border->setStyle(Line::DOTTED); -$graph->border->setColor(new Red); - -$x = array(); -for($i = 0; $i < 10; $i++) { - $x[] = mt_rand(20, 100); -} - -$plot = new LinePlot($x); -$plot->setFilledArea(0, 1, new Red(40)); -$plot->setFilledArea(1, 2, new LinearGradient(new Red(40), new Orange(40), 90)); -$plot->setFilledArea(2, 4, new LinearGradient(new Orange(40), new Green(40), 90)); -$plot->setFilledArea(4, 7, new LinearGradient(new Green(40), new Blue(40), 90)); -$plot->setFilledArea(7, 8, new LinearGradient(new Blue(40), new Purple(40), 90)); -$plot->setFilledArea(8, 9, new Purple(40)); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/line-009.php b/artichow/examples/line-009.php deleted file mode 100644 index 50ce6ee..0000000 --- a/artichow/examples/line-009.php +++ /dev/null @@ -1,66 +0,0 @@ -setAntiAliasing(TRUE); - -$group = new PlotGroup; -$group->setXAxisZero(FALSE); -$group->grid->setType(Line::DASHED); - -$group->setBackgroundColor(new Color(197, 180, 210, 80)); - -$group->setPadding(40, NULL, 20, NULL); - -$group->axis->left->setLabelNumber(8); -$group->axis->left->setLabelPrecision(1); -$group->axis->left->setTickStyle(Tick::IN); -$group->axis->left->label->move(-4, 0); - -$group->axis->bottom->setTickStyle(Tick::OUT); -$group->axis->bottom->label->move(0, 4); - -$x = array(); - -for($i = 0; $i < 15; $i++) { - $x[] = cos($i * M_PI / 5); -} - -$plot = new LinePlot($x); -$plot->setColor(new Color(40, 40, 150, 10)); -$plot->setFillColor(new Color(40, 40, 150, 90)); - -$group->add($plot); -$group->legend->add($plot, "Ligne #1", Legend::LINE); - -$x = array(); - -for($i = 5; $i < 15; $i++) { - $x[] = (cos($i * M_PI / 5)) / 2; -} - -$plot = new LinePlot($x); -$plot->setColor(new Color(120, 120, 30, 10)); -$plot->setFillColor(new Color(120, 120, 30, 90)); - -$group->add($plot); -$group->legend->add($plot, "Ligne #2", Legend::LINE); - -$group->legend->setTextFont(new Tuffy(8)); -$group->legend->shadow->setSize(0); -$group->legend->setSpace(12); -$group->legend->setBackgroundColor(new Color(255, 255, 255)); -$group->setPadding(NULL, 100, NULL, NULL); - -$graph->add($group); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/line-010.php b/artichow/examples/line-010.php deleted file mode 100644 index 128f366..0000000 --- a/artichow/examples/line-010.php +++ /dev/null @@ -1,46 +0,0 @@ -title->set('Star marks'); -$graph->title->setFont(new Tuffy(12)); -$graph->title->setColor(new DarkRed); - -$plot = new LinePlot(array(5, 3, 4, 7, 6, 5, 8, 4, 7)); - -// Change plot size and position -$plot->setSize(0.76, 1); -$plot->setCenter(0.38, 0.5); - -$plot->setPadding(30, 15, 38, 25); -$plot->setColor(new Orange()); -$plot->setFillColor(new LightOrange(80)); - -// Change grid style -$plot->grid->setType(Line::DASHED); - -// Add customized marks -$plot->mark->setType(Mark::STAR); -$plot->mark->setFill(new MidRed); -$plot->mark->setSize(6); - -// Change legend -$plot->legend->setPosition(1, 0.5); -$plot->legend->setAlign(Legend::LEFT); -$plot->legend->shadow->smooth(TRUE); - -$plot->legend->add($plot, 'My line', Legend::MARK); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/math-001.php b/artichow/examples/math-001.php deleted file mode 100644 index 1c91b31..0000000 --- a/artichow/examples/math-001.php +++ /dev/null @@ -1,23 +0,0 @@ -setInterval(0.1); - -$function = new MathFunction('cos'); -$plot->add($function); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/math-002.php b/artichow/examples/math-002.php deleted file mode 100644 index 79bcdf3..0000000 --- a/artichow/examples/math-002.php +++ /dev/null @@ -1,36 +0,0 @@ -title->set('f(x) = x * x'); -$graph->title->setBackgroundColor(new White(0)); -$graph->title->setPadding(NULL, NULL, 10, 10); -$graph->title->move(0, -10); - -$plot = new MathPlot(-3, 3, 10, -2); -$plot->setInterval(0.2); -$plot->setPadding(NULL, NULL, NULL, 20); - -// Defines x² -function x2($x) { - return $x * $x; -} - -$function = new MathFunction('x2'); -$function->setColor(new Orange); -$plot->add($function); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/math-003.php b/artichow/examples/math-003.php deleted file mode 100644 index 2ae8374..0000000 --- a/artichow/examples/math-003.php +++ /dev/null @@ -1,33 +0,0 @@ -setInterval(0.2); -$plot->setPadding(NULL, NULL, NULL, 20); - -$plot->yAxis->setLabelInterval(4); - -$function = new MathFunction('exp'); -$function->setColor(new DarkRed); -$function->mark->setType(Mark::SQUARE); -$function->mark->setSize(3); -$function->mark->setFill(new DarkBlue); -$plot->add($function, "f(x) = exp(x)", Legend::MARK); - -$plot->legend->setPosition(0.4, 0.2); -$plot->legend->setPadding(3, 3, 3, 3, 3); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/math-004.php b/artichow/examples/math-004.php deleted file mode 100644 index 8873288..0000000 --- a/artichow/examples/math-004.php +++ /dev/null @@ -1,39 +0,0 @@ -setInterval(0.2); -$plot->setPadding(NULL, NULL, NULL, 20); - -$function = new MathFunction('exp'); -$function->setColor(new DarkRed); -$function->mark->setType(Mark::SQUARE); -$function->mark->setSize(3); -$function->mark->setFill(new DarkBlue); -$plot->add($function, "f(x) = exp(x)", Legend::MARK); - -function x2($x) { - return - $x * $x; -} - -$function = new MathFunction('x2'); -$function->setColor(new DarkBlue); -$plot->add($function, "f(x) = - x * x"); - -$plot->legend->setPosition(0.4, 0.4); -$plot->legend->setPadding(3, 3, 3, 3, 3); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/math-005.php b/artichow/examples/math-005.php deleted file mode 100644 index 849bee2..0000000 --- a/artichow/examples/math-005.php +++ /dev/null @@ -1,34 +0,0 @@ -setInterval(0.05); - -$function = new MathFunction('sqrt', 0); -$plot->add($function, "sqrt(x)"); - -function x2($x) { - return - $x * $x; -} - -$function = new MathFunction('sin', -2, 2); -$function->setColor(new DarkBlue); -$plot->add($function, "sin(x) (-2 < x < 2)"); - -$plot->legend->setPosition(0.98, 0.8); -$plot->legend->setTextFont(new Tuffy(8)); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/pattern-001.php b/artichow/examples/pattern-001.php deleted file mode 100644 index ceb50ce..0000000 --- a/artichow/examples/pattern-001.php +++ /dev/null @@ -1,26 +0,0 @@ -title->set('Pattern 1'); -$graph->title->move(100, 0); -$graph->title->setFont(new Tuffy(9)); -$graph->title->setColor(new DarkRed); - -$pattern = Pattern::get('BarDepth'); -$pattern->setArgs(array( - 'yForeground' => array(5, 3, 4, 7, 6, 5, 8, 4, 7, NULL, NULL), - 'yBackground' => array(NULL, NULL, 4, 5, 6, 4, 2, 3, 7, 5, 4), - 'legendForeground' => '2003', - 'legendBackground' => '2004' -)); - -$group = $pattern->create(); - -$graph->add($group); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pattern-002.php b/artichow/examples/pattern-002.php deleted file mode 100644 index ca88b82..0000000 --- a/artichow/examples/pattern-002.php +++ /dev/null @@ -1,24 +0,0 @@ -title->set('Customized pattern 1'); -$graph->title->setFont(new Tuffy(12)); - -$pattern = Pattern::get('BarDepth'); -$pattern->setArgs(array( - 'yForeground' => array(5, 3, 4, 7, 6, 5, 8, 4, 7, NULL, NULL), - 'yBackground' => array(NULL, NULL, 4, 5, 6, 4, 2, 3, 7, 5, 4), - 'colorForeground' => new Color(230, 230, 230), - 'colorBackground' => new Color(250, 90, 90) -)); - -$group = $pattern->create(); -$group->legend->setPosition(0.5, 0.78); - -$graph->add($group); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pattern-003.php b/artichow/examples/pattern-003.php deleted file mode 100644 index b61c00c..0000000 --- a/artichow/examples/pattern-003.php +++ /dev/null @@ -1,23 +0,0 @@ -title->set('Pattern 2'); -$graph->title->setFont(new Tuffy(12)); -$graph->title->setColor(new DarkRed); - -$pattern = Pattern::get('LightLine'); -$pattern->setArgs(array( - 'y' => array(5, 3, 4, 7, 6, 5, 8, 4, 7), - 'legend' => 'John Doe' -)); - -$plot = $pattern->create(); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-001.php b/artichow/examples/pie-001.php deleted file mode 100644 index 172b0ec..0000000 --- a/artichow/examples/pie-001.php +++ /dev/null @@ -1,40 +0,0 @@ -title->set("Pie (example 1)"); - -$values = array(12, 5, 13, 18, 10, 6, 11); - -$plot = new Pie($values, Pie::EARTH); -$plot->setCenter(0.4, 0.55); -$plot->setSize(0.7, 0.6); -$plot->set3D(10); - -$plot->setLegend(array( - 'Mon', - 'Tue', - 'Wed', - 'Thu', - 'Fri', - 'Sat', - 'Sun' -)); - -$plot->legend->setPosition(1.3); -$plot->legend->shadow->setSize(0); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-002.php b/artichow/examples/pie-002.php deleted file mode 100644 index 5ed41ae..0000000 --- a/artichow/examples/pie-002.php +++ /dev/null @@ -1,41 +0,0 @@ -setAntiAliasing(TRUE); - -$graph->title->set("Pie (example 2)"); - -$values = array(8, 4, 6, 2, 5, 3, 4); - -$plot = new Pie($values, Pie::EARTH); -$plot->setCenter(0.4, 0.55); -$plot->setSize(0.7, 0.6); -$plot->set3D(10); -$plot->explode(array(1 => 20, 4 => 26, 0 => 25)); - -$plot->setLegend(array( - 'Mon', - 'Tue', - 'Wed', - 'Thu', - 'Fri', - 'Sat', - 'Sun' -)); - -$plot->legend->setPosition(1.3); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-003.php b/artichow/examples/pie-003.php deleted file mode 100644 index e61aa5a..0000000 --- a/artichow/examples/pie-003.php +++ /dev/null @@ -1,42 +0,0 @@ -setAntiAliasing(TRUE); - -$graph->title->set("Pie (example 3)"); - -$values = array(8, 4, 6, 2, 5, 3, 4); - -$plot = new Pie($values, Pie::AQUA); -$plot->setCenter(0.4, 0.55); -$plot->setSize(0.7, 0.6); -$plot->set3D(15); -$plot->explode(array(4 => 20, 0 => 30)); - -$plot->setLegend(array( - 'Mon', - 'Tue', - 'Wed', - 'Thu', - 'Fri', - 'Sat', - 'Sun' -)); - -$plot->legend->setPosition(1.3); -$plot->legend->setBackgroundColor(new VeryLightGray(30)); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-004.php b/artichow/examples/pie-004.php deleted file mode 100644 index 25332b0..0000000 --- a/artichow/examples/pie-004.php +++ /dev/null @@ -1,50 +0,0 @@ -setBackgroundGradient( - new LinearGradient( - new White, - new VeryLightGray, - 0 - ) -); -$graph->title->set("Pie (example 4)"); -$graph->shadow->setSize(7); -$graph->shadow->smooth(TRUE); -$graph->shadow->setPosition(Shadow::LEFT_BOTTOM); - -$values = array(8, 4, 6, 2, 5, 3, 4); - -$plot = new Pie($values); -$plot->setCenter(0.4, 0.55); -$plot->setSize(0.7, 0.6); -$plot->set3D(10); - - -$plot->setLegend(array( - 'Mon', - 'Tue', - 'Wed', - 'Thu', - 'Fri', - 'Sat', - 'Sun' -)); - -$plot->legend->setPosition(1.3); -$plot->legend->setBackgroundColor(new VeryLightGray(30)); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-005.php b/artichow/examples/pie-005.php deleted file mode 100644 index 0a2cbd2..0000000 --- a/artichow/examples/pie-005.php +++ /dev/null @@ -1,47 +0,0 @@ -setBackgroundGradient( - new LinearGradient( - new VeryLightGray, - new White, - 0 - ) -); -$graph->title->set("Pie (example 5) - Initial angle: 140°"); - -$values = array(8, 4, 6, 2, 5, 3, 4); - -$plot = new Pie($values); -$plot->setCenter(0.4, 0.55); -$plot->setSize(0.7, 0.6); -$plot->set3D(10); -$plot->setStartAngle(140); - -$plot->setLegend(array( - 'Mon', - 'Tue', - 'Wed', - 'Thu', - 'Fri', - 'Sat', - 'Sun' -)); - -$plot->legend->setPosition(1.3); -$plot->legend->setBackgroundColor(new VeryLightGray(30)); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-006.php b/artichow/examples/pie-006.php deleted file mode 100644 index 871ce42..0000000 --- a/artichow/examples/pie-006.php +++ /dev/null @@ -1,37 +0,0 @@ -setBackgroundGradient( - new LinearGradient( - new VeryLightGray, - new White, - 0 - ) -); -$graph->title->set("Pie (example 6)"); - -$values = array(8, 4, 6, 2, 5, 3, 4); - -$plot = new Pie($values); -$plot->setCenter(0.5, 0.55); -$plot->setSize(0.7, 0.6); -$plot->set3D(5); -$plot->setBorderColor(new Black); - - -$plot->legend->hide(TRUE); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-007.php b/artichow/examples/pie-007.php deleted file mode 100644 index 0720861..0000000 --- a/artichow/examples/pie-007.php +++ /dev/null @@ -1,56 +0,0 @@ -setAntiAliasing(TRUE); - -$graph->title->set("Pie (example 7)"); - -$values = array(8, 4, 6, 2, 5, 3, 4); - -$plot = new Pie($values, Pie::DARK); -$plot->setCenter(0.4, 0.55); -$plot->setSize(0.7, 0.6); -$plot->set3D(5); -$plot->setBorderColor(new White); - -$plot->setLegend(array( - 'Mon', - 'Tue', - 'Wed', - 'Thu', - 'Fri', - 'Sat', - 'Sun' -)); - -$plot->legend->setPosition(1.3); -$plot->legend->setBackgroundColor(new VeryLightGray(30)); -$plot->legend->shadow->setPosition(Shadow::RIGHT_TOP); - -$plot->label->setPadding(2, 2, 2, 2); -$plot->label->border->setColor(new Red(60)); -$plot->label->setFont(new Tuffy(7)); -$plot->label->setBackgroundGradient( - new LinearGradient( - new Red(80), - new White(80), - 0 - ) -); -$plot->setLabelPrecision(1); - - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-008.php b/artichow/examples/pie-008.php deleted file mode 100644 index 7235b6d..0000000 --- a/artichow/examples/pie-008.php +++ /dev/null @@ -1,54 +0,0 @@ -setAntiAliasing(TRUE); - -$graph->title->set("Pie (example 8)"); - -$values = array(8, 4, 6, 2, 5, 3, 4); - -$plot = new Pie($values, Pie::EARTH); -$plot->setSize(0.85, 0.60); -$plot->set3D(15); -$plot->setBorderColor(new LightGray); - -$plot->setLegend(array( - 'Mon', - 'Tue', - 'Wed', - 'Thu', - 'Fri', - 'Sat', - 'Sun' -)); - -$plot->legend->shadow->setSize(3); -$plot->legend->setModel(Legend::MODEL_BOTTOM); -$plot->legend->setPosition(NULL, 1.1); - -$plot->label->setPadding(2, 2, 2, 2); -$plot->label->border->setColor(new Red(60)); -$plot->label->setFont(new Tuffy(7)); -$plot->label->setBackgroundGradient( - new LinearGradient( - new Red(80), - new White(80), - 0 - ) -); -$plot->setLabelPrecision(1); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-009.php b/artichow/examples/pie-009.php deleted file mode 100644 index d3e6419..0000000 --- a/artichow/examples/pie-009.php +++ /dev/null @@ -1,49 +0,0 @@ -setAntiAliasing(TRUE); - -$graph->title->set("Pie (example 9) - User defined colors"); -$graph->title->border->show(); -$graph->title->setBackgroundColor(new LightRed(60)); -$graph->title->setPadding(3, 3, 3, 3); - -$values = array(8, 4, 6, 3, 4); -$colors = array( - new LightOrange, - new LightPurple, - new LightBlue, - new LightRed, - new LightPink -); - -$plot = new Pie($values, $colors); -$plot->setSize(0.70, 0.60); -$plot->setCenter(0.40, 0.55); -$plot->set3D(10); -$plot->setBorderColor(new LightGray); - -$plot->setLegend(array( - 'Alpha', - 'Beta', - 'Gamma', - 'Delta', - 'Epsilon' -)); - -$plot->legend->setPosition(1.30); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-010.php b/artichow/examples/pie-010.php deleted file mode 100644 index e670297..0000000 --- a/artichow/examples/pie-010.php +++ /dev/null @@ -1,29 +0,0 @@ -title->set("Pie (example 10) - Just a pie"); -$graph->title->setFont(new Tuffy(10)); - -$values = array(8, 4, 6, 1, 2, 3, 4); - -$plot = new Pie($values); -$plot->set3D(10); - -$plot->legend->hide(TRUE); -$plot->label->hide(TRUE); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-011.php b/artichow/examples/pie-011.php deleted file mode 100644 index 074fe91..0000000 --- a/artichow/examples/pie-011.php +++ /dev/null @@ -1,48 +0,0 @@ -title->set($title); - $plot->title->setFont(new TuffyBold(8)); - $plot->title->move(NULL, -12); - - $plot->label->setFont(new Tuffy(7)); - $plot->legend->hide(TRUE); - $plot->setLabelPosition(5); - $plot->setSize(0.45, 0.45); - $plot->setCenter($x, $y); - $plot->set3D(10); - $plot->setBorderColor(new Color(230, 230, 230)); - - return $plot; - -} - -$graph = new Graph(400, 300); - -$plot = createPie(array(1, 4, 5, 2, 3), "Cowléoptère", 0.22, 0.25); -$graph->add($plot); - -$plot = createPie(array(1, 9, 1, 2, 1), "Asticow", 0.68, 0.25); -$graph->add($plot); - -$plot = createPie(array(5, 7, 8, 6, 3), "Cowlibri", 0.22, 0.75); -$graph->add($plot); - -$plot = createPie(array(6, 4, 6, 5, 6), "Bourricow", 0.68, 0.75); -$plot->legend->hide(FALSE); // We print only one legend -$plot->legend->setPosition(1.18, 0); -$graph->add($plot); - -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/pie-012.php b/artichow/examples/pie-012.php deleted file mode 100644 index 59683c1..0000000 --- a/artichow/examples/pie-012.php +++ /dev/null @@ -1,38 +0,0 @@ -title->set("Pie (example 12)"); - -$values = array(8, 4, 6, 2, 5, 3, 4); - -$plot = new Pie($values, Pie::EARTH); -$plot->setCenter(0.4, 0.55); -$plot->setSize(0.7, 0.6); -$plot->explode(array(1 => 20, 4 => 25)); - -$plot->setLegend(array( - 'Mon', - 'Tue', - 'Wed', - 'Thu', - 'Fri', - 'Sat', - 'Sun' -)); - -$plot->legend->setPosition(1.3); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-013.php b/artichow/examples/pie-013.php deleted file mode 100644 index f038dac..0000000 --- a/artichow/examples/pie-013.php +++ /dev/null @@ -1,40 +0,0 @@ -setAntiAliasing(TRUE); - -$graph->title->set("Pie (example 13)"); - -$values = array(12, 5, 13, 18, 10, 6, 11); - -$plot = new Pie($values, Pie::EARTH); -$plot->setCenter(0.4, 0.55); -$plot->setAbsSize(180, 180); - -$plot->setLegend(array( - 'Mon', - 'Tue', - 'Wed', - 'Thu', - 'Fri', - 'Sat', - 'Sun' -)); - -$plot->legend->setPosition(1.5); -$plot->legend->shadow->setSize(0); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-014.php b/artichow/examples/pie-014.php deleted file mode 100644 index dd4bd75..0000000 --- a/artichow/examples/pie-014.php +++ /dev/null @@ -1,48 +0,0 @@ -title->set($title); - $plot->title->setFont(new TuffyBold(8)); - $plot->title->move(NULL, -12); - - $plot->label->setFont(new Tuffy(7)); - $plot->legend->hide(TRUE); - $plot->setLabelPosition(5); - $plot->setSize(0.40, 0.40); - $plot->setCenter($x, $y); - $plot->setBorderColor(new Black); - - return $plot; - -} - -$graph = new Graph(400, 400); -$graph->setAntiAliasing(TRUE); - -$plot = createPie(array(1, 4, 5, 2, 3), "Cowléoptère", 0.22, 0.25); -$graph->add($plot); - -$plot = createPie(array(1, 9, 1, 2, 1), "Asticow", 0.66, 0.25); -$graph->add($plot); - -$plot = createPie(array(5, 7, 8, 6, 3), "Cowlibri", 0.22, 0.75); -$graph->add($plot); - -$plot = createPie(array(6, 4, 6, 5, 6), "Bourricow", 0.66, 0.75); -$plot->legend->hide(FALSE); // We print only one legend -$plot->legend->setPosition(1.25, 0); -$graph->add($plot); - -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/pie-015.php b/artichow/examples/pie-015.php deleted file mode 100644 index b2ee5cc..0000000 --- a/artichow/examples/pie-015.php +++ /dev/null @@ -1,50 +0,0 @@ -setBackgroundGradient( - new LinearGradient( - new VeryLightGray, - new White, - 0 - ) -); -$graph->title->set("Pie (example 15) - Arbitrary labels"); - -$values = array(8, 4, 6, 2, 5, 3, 4); - -$plot = new Pie($values); -$plot->setCenter(0.4, 0.55); -$plot->setSize(0.6, 0.6 * 4 / 3); - -$plot->label->set(array( - 'Arthur', 'Abel', 'Bernard', 'Thierry', 'Paul', 'Gaston', 'Joe' -)); -$plot->label->setCallbackFunction(NULL); // We must disable the default callback function - -$plot->setLegend(array( - 'ABC', - 'DEF', - 'GHI', - 'JKL', - 'MNO', - 'PQR', - 'STU' -)); - -$plot->legend->setPosition(1.3); -$plot->legend->setBackgroundColor(new VeryLightGray(30)); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-016.php b/artichow/examples/pie-016.php deleted file mode 100644 index 7b92d24..0000000 --- a/artichow/examples/pie-016.php +++ /dev/null @@ -1,45 +0,0 @@ -setAntiAliasing(TRUE); - -$graph->title->set("Pie (example 13) - Adjusting labels"); - -$values = array(16, 9, 13, 23, 10); - -$plot = new Pie($values, Pie::EARTH); -$plot->setCenter(0.4, 0.55); -$plot->setAbsSize(220, 220); - -$plot->setLegend(array( - 'Mon', - 'Tue', - 'Wed', - 'Thu', - 'Fri', - 'Sat', - 'Sun' -)); - -$plot->setLabelPosition(-40); -$plot->label->setPadding(2, 2, 2, 2); -$plot->label->setFont(new Tuffy(7)); -$plot->label->setBackgroundColor(new White(60)); - -$plot->legend->setPosition(1.3); -$plot->legend->shadow->setSize(0); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-017.php b/artichow/examples/pie-017.php deleted file mode 100644 index eb3cc0b..0000000 --- a/artichow/examples/pie-017.php +++ /dev/null @@ -1,48 +0,0 @@ -setAntiAliasing(TRUE); - -$graph->title->set("Pie (example 17)"); -$graph->title->setFont(new Tuffy(14)); - -$values = array(12, 16, 13, 18, 10, 20, 11); - -$plot = new Pie($values, Pie::AQUA); -$plot->setCenter(0.4, 0.55); -$plot->setAbsSize(180, 180); - -$plot->setLegend(array( - 'Mon', - 'Tue', - 'Wed', - 'Thu', - 'Fri', - 'Sat', - 'Sun' -)); - -$explode = array(); -for($i = 0; $i < count($values); $i++) { - $explode[] = 15; -} - -$plot->explode($explode); - -$plot->legend->setPosition(1.5); -$plot->legend->shadow->setSize(0); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/pie-018.php b/artichow/examples/pie-018.php deleted file mode 100644 index 30390e4..0000000 --- a/artichow/examples/pie-018.php +++ /dev/null @@ -1,32 +0,0 @@ -setAntiAliasing(TRUE); - -$graph->title->set("Pie (example 18) - Display labels > 10 %"); -$graph->title->setFont(new Tuffy(14)); - -$values = array(1, 5, 6, 16, 18, 19, 21, 3, 4, 7, 6); - -$plot = new Pie($values); -$plot->setCenter(0.4, 0.55); -$plot->setAbsSize(180, 180); -$plot->setLabelMinimum(10); - -$plot->legend->setPosition(1.5); -$plot->legend->shadow->setSize(0); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/scatter-001.php b/artichow/examples/scatter-001.php deleted file mode 100644 index 5d33eda..0000000 --- a/artichow/examples/scatter-001.php +++ /dev/null @@ -1,21 +0,0 @@ -title->set('Simple ScatterPlot'); - -$y = array(1, 10, 3,-4, 1, 4, 8, 7); -$x = array(0.5, 0.5, 3, 5, 2, 3, 4, 1.5); - -$plot = new ScatterPlot($y, $x); -$plot->setBackgroundColor(new VeryLightGray); -$plot->setPadding(NULL, NULL, 40, 20); - -$plot->legend->add($plot, 'Some points', Legend::MARKONLY); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/scatter-002.php b/artichow/examples/scatter-002.php deleted file mode 100644 index fb980c1..0000000 --- a/artichow/examples/scatter-002.php +++ /dev/null @@ -1,21 +0,0 @@ -title->set('Linked ScatterPlot'); - -$y = array(1, 10, 3,-4, 1, 4, 8, 7); -$x = array(0.5, 0.5, 3, 5, 2, 3, 4, 1.5); - -$plot = new ScatterPlot($y, $x); -$plot->setBackgroundColor(new VeryLightGray); -$plot->setPadding(NULL, NULL, 40, 20); - -$plot->link(TRUE, new DarkBlue); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/scatter-003.php b/artichow/examples/scatter-003.php deleted file mode 100644 index 388ec0f..0000000 --- a/artichow/examples/scatter-003.php +++ /dev/null @@ -1,30 +0,0 @@ -shadow->setSize(5); -$graph->title->set('ScatterPlot with values'); - -$y = array(4, 3, 2, 5, 8, 1, 3, 6, 4, 5); -$x = array(1, 2, 5, 4, 3, 6, 2, 4, 5, 1); - -$plot = new ScatterPlot($y, $x); -$plot->setSpace(6, 6, 6, 0); -$plot->setPadding(NULL, NULL, 40, 20); - -// Set dashed lines on the grid -$plot->grid->setType(Line::DASHED); - -$plot->mark->setSize(30); -$plot->mark->setFill(new DarkOrange(20)); - - -$plot->label->set($y); -$plot->label->setColor(new White); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/scatter-004.php b/artichow/examples/scatter-004.php deleted file mode 100644 index c550b78..0000000 --- a/artichow/examples/scatter-004.php +++ /dev/null @@ -1,32 +0,0 @@ -shadow->setSize(5); - -$y = array(); -for($i = 0; $i < 60; $i++) { - $y[] = cos($i / 30 * 2 * M_PI); -} - -$plot = new ScatterPlot($y); -$plot->setSpace(6, 6); - -// Set impulses -$plot->setImpulse(new DarkGreen); - -$plot->grid->hideVertical(); - -// Hide axis labels and ticks -$plot->xAxis->label->hide(); -$plot->xAxis->hideTicks(); - -$plot->mark->setType(Mark::SQUARE); -$plot->mark->setSize(4); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/scatter-005.php b/artichow/examples/scatter-005.php deleted file mode 100644 index cd4f3d1..0000000 --- a/artichow/examples/scatter-005.php +++ /dev/null @@ -1,37 +0,0 @@ -title->set('Impulses'); -$graph->title->move(0, 30); -$graph->shadow->setSize(5); - -$y = array(); -for($i = 0; $i < 60; $i++) { - $y[] = cos($i / 30 * 2 * M_PI) / (1.5 + $i / 15); -} - -$plot = new ScatterPlot($y); -$plot->setBackgroundColor(new VeryLightOrange); -$plot->setSpace(5); - -// Set impulses -$plot->setImpulse(new DarkBlue); - -$plot->grid->hideVertical(); - -// Hide ticks -$plot->xAxis->hideTicks(); - -// Change labels interval -$plot->xAxis->label->setInterval(5); - -$plot->mark->setType(Mark::SQUARE); -$plot->mark->setSize(4); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/scatter-006.php b/artichow/examples/scatter-006.php deleted file mode 100644 index e904475..0000000 --- a/artichow/examples/scatter-006.php +++ /dev/null @@ -1,39 +0,0 @@ -setBackgroundColor(new VeryLightGray); -$plot->setPadding(30, 30, 30, 30); -$plot->setSpace(5, 5, 5, 5); - -$plot->link(TRUE, new DarkGreen); - -$plot->mark->setFill(new DarkOrange); -$plot->mark->setType(Mark::SQUARE, 4); - -$plot->setXAxis(Plot::BOTH); -$plot->setXAxisZero(FALSE); -$plot->setYAxis(Plot::BOTH); - -$plot->legend->add($plot, 'A circle', Legend::MARK); -$plot->legend->setPosition(0.5, 0.5); -$plot->legend->setAlign(Legend::CENTER, Legend::MIDDLE); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/scatter-007.php b/artichow/examples/scatter-007.php deleted file mode 100644 index 43cb57d..0000000 --- a/artichow/examples/scatter-007.php +++ /dev/null @@ -1,60 +0,0 @@ -setBackgroundColor(new VeryLightGray); -$group->setPadding(30, 30, 30, 30); -$group->setSpace(5, 5, 5, 5); - -$group->legend->setPosition(0.5, 0.62); -$group->legend->setAlign(Legend::CENTER, Legend::MIDDLE); - -function getCircle($size) { - - $center = 0; - - $x = array(); - $y = array(); - - for($i = 0; $i <= 30; $i++) { - $rad = ($i / 30) * 2 * M_PI; - $x[] = $center + cos($rad) * $size; - $y[] = $center + sin($rad) * $size; - } - - return array($x, $y); - -} - -list($x, $y) = getCircle(3); - -$plot = new ScatterPlot($y, $x); - -$plot->link(TRUE, new DarkBlue); - -$plot->mark->setFill(new DarkPink); -$plot->mark->setType(Mark::CIRCLE, 6); - -$group->legend->add($plot, 'Circle #1', Legend::MARK); -$group->add($plot); - -list($x, $y) = getCircle(5); - -$plot = new ScatterPlot($y, $x); - -$plot->link(TRUE, new DarkGreen); - -$plot->mark->setFill(new DarkOrange); -$plot->mark->setType(Mark::SQUARE, 4); - -$group->legend->add($plot, 'Circle #2', Legend::MARK); -$group->add($plot); - -$graph->add($group); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/site/bar-001.php b/artichow/examples/site/bar-001.php deleted file mode 100644 index d2b118b..0000000 --- a/artichow/examples/site/bar-001.php +++ /dev/null @@ -1,80 +0,0 @@ -setAntiAliasing(TRUE); - -$x = array( - 1, 2, 5, 0.5, 3, 8, 6 -); - -$plot = new BarPlot($x); - -$plot->setSpace(4, 4, 10, 0); -$plot->setPadding(40, 15, 10, 40); - -$plot->title->set("Zoé and friends"); -$plot->title->setFont(new TuffyBold(11)); -$plot->title->border->show(); -$plot->title->setBackgroundColor(new Color(255, 255, 255, 25)); -$plot->title->setPadding(4, 4, 4, 4); -$plot->title->move(-20, 25); - -$plot->yAxis->title->set("Axe des Y"); -$plot->yAxis->title->setFont(new TuffyBold(10)); -$plot->yAxis->title->move(-4, 0); -$plot->yAxis->setTitleAlignment(Label::TOP); - -$plot->xAxis->title->set("Axe des X"); -$plot->xAxis->title->setFont(new TuffyBold(10)); -$plot->xAxis->setTitleAlignment(Label::RIGHT); - -$plot->setBackgroundGradient( - new LinearGradient( - new Color(230, 230, 230), - new Color(255, 255, 255), - 0 - ) -); - -$plot->barBorder->setColor(new Color(0, 0, 150, 20)); - -$plot->setBarGradient( - new LinearGradient( - new Color(150, 150, 210, 0), - new Color(230, 230, 255, 30), - 0 - ) -); - -$y = array( - 'Zoé', - 'Yvan', - 'Fred', - 'Lucie', - 'Ilia', - 'Nino', - 'Marie' -); - -$plot->xAxis->setLabelText($y); -$plot->xAxis->label->setFont(new TuffyBold(7)); - -$graph->shadow->setSize(4); -$graph->shadow->setPosition(Shadow::LEFT_TOP); -$graph->shadow->smooth(TRUE); -$graph->shadow->setColor(new Color(160, 160, 160)); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/bar-002.php b/artichow/examples/site/bar-002.php deleted file mode 100644 index 5e75cad..0000000 --- a/artichow/examples/site/bar-002.php +++ /dev/null @@ -1,80 +0,0 @@ -setAntiAliasing(TRUE); - -$group = new PlotGroup; -$group->setSpace(6, 6, 5, 5); -$group->setBackgroundGradient( - new LinearGradient( - new Color(235, 235, 235), - new White(), - 0 - ) -); -$group->setPadding(40, 10, 10, 50); - -$group->axis->left->setLabelPrecision(2); -$group->axis->bottom->label->hide(TRUE); -$group->axis->bottom->hideTicks(TRUE); - -$group->grid->setType(Line::DASHED); -$group->grid->hideHorizontal(TRUE); - -$gradients = array( - new LinearGradient( - new Color(30, 30, 160, 10), new Color(120, 120, 160, 10), 0 - ), - new LinearGradient( - new Color(30, 160, 30, 10), new Color(120, 160, 120, 10), 0 - ), - new LinearGradient( - new Color(160, 30, 30, 10), new Color(160, 120, 120, 10), 0 - ) -); - -for($n = 0; $n < 3; $n++) { - - $x = array(); - - for($i = 0; $i < 6; $i++) { - $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(600, 900) / 1000 - 0.5) * (($n%2) ? -0.5 : 1) + (($n%2) ? -0.4 : 0); - } - - $plot = new BarPlot($x, $n + 1, 3); - - $plot->setXAxis(Plot::BOTTOM); - - $plot->barShadow->setSize(1); - $plot->barShadow->setPosition(Shadow::RIGHT_TOP); - $plot->barShadow->setColor(new Color(160, 160, 160, 10)); - - $plot->barBorder->setColor($gradients[$n]->from); - - $plot->setBarGradient($gradients[$n]); - - $plot->setBarSpace(2); - - $group->legend->add($plot, 'Bar#'.($n + 1), Legend::BACKGROUND); - - $group->add($plot); - -} - -$group->legend->setModel(Legend::MODEL_BOTTOM); -$group->legend->setPosition(NULL, 0.86); -$group->legend->shadow->hide(); - -$graph->add($group); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/bar-003.php b/artichow/examples/site/bar-003.php deleted file mode 100644 index 22ab916..0000000 --- a/artichow/examples/site/bar-003.php +++ /dev/null @@ -1,73 +0,0 @@ -setAntiAliasing(TRUE); -$graph->border->hide(); - -$group = new PlotGroup; -$group->setSpace(5, 10, 20, 15); -$group->setPadding(40, 10, NULL, 20); -$group->setXAxisZero(FALSE); - -$group->axis->left->setLabelPrecision(2); - -$colors = array( - new Color(100, 180, 154, 12), - new Color(100, 154, 180, 12), - new Color(154, 100, 180, 12), - new Color(180, 100, 154, 12) -); - -for($n = 0; $n < 4; $n++) { - - $x = array(); - - for($i = 0; $i < 6; $i++) { - $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(600, 1400) / 1000 - 0.5); - } - - $plot = new BarPlot($x, 1, 1, (3 - $n) * 7); - $plot->barBorder->setColor(new Color(0, 0, 0)); - - $plot->setBarSize(0.54); - - $plot->barShadow->setSize(3); - $plot->barShadow->setPosition(Shadow::RIGHT_TOP); - $plot->barShadow->setColor(new Color(160, 160, 160, 10)); - $plot->barShadow->smooth(TRUE); - - $plot->setBarColor($colors[$n]); - - $group->add($plot); - $group->legend->add($plot, "Barre #".$n, Legend::BACKGROUND); - -} - -$group->legend->shadow->setSize(0); -$group->legend->setAlign(Legend::CENTER); -$group->legend->setSpace(6); -$group->legend->setTextFont(new Tuffy(8)); -$group->legend->setPosition(0.50, 0.12); -$group->legend->setBackgroundColor(new Color(255, 255, 255, 25)); -$group->legend->setColumns(2); - -$graph->add($group); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/bar-004.php b/artichow/examples/site/bar-004.php deleted file mode 100644 index 1f85ecb..0000000 --- a/artichow/examples/site/bar-004.php +++ /dev/null @@ -1,92 +0,0 @@ -setAntiAliasing(TRUE); - -$group = new PlotGroup; -$group->setSpace(5, 5, 15, 0); -$group->setPadding(40, 40); - -$group->axis->left->setLabelPrecision(2); -$group->axis->right->setLabelPrecision(2); - -$colors = array( - new Color(80, 105, 190, 10), - new Color(105, 190, 80, 10) -); - -$darkColor = array( - new Color(40, 55, 120, 10), - new Color(55, 120, 40, 10) -); - -$axis = array( - Plot::LEFT, - Plot::RIGHT -); - -$group->axis->left->setColor($darkColor[0]); -$group->axis->left->label->setColor($darkColor[0]); -$group->axis->right->setColor($darkColor[1]); -$group->axis->right->label->setColor($darkColor[1]); - -$group->setBackgroundGradient( - new LinearGradient( - new Color(225, 225, 225), - new Color(255, 255, 255), - 0 - ) -); - -for($n = 0; $n < 2; $n++) { - - $x = array(); - - for($i = 0; $i < 4; $i++) { - $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(700, 1300) / 1000 - 0.5) * (($n%2) ? -0.5 : 1) + (($n%2) ? -0.4 : 0) + 1; - } - - $plot = new BarPlot($x, $n+1, 2); - $plot->barBorder->setColor(new Color(0, 0, 0, 30)); - - $plot->setBarPadding(0.1, 0.1); - $plot->setBarSpace(5); - - $plot->barShadow->setSize(3); - $plot->barShadow->setPosition(Shadow::RIGHT_TOP); - $plot->barShadow->setColor(new Color(180, 180, 180, 10)); - $plot->barShadow->smooth(TRUE); - - $plot->label->set($x); - $plot->label->move(0, -6); - $plot->label->setFont(new Tuffy(7)); - $plot->label->setAngle(90); - $plot->label->setAlign(NULL, Label::TOP); - $plot->label->setPadding(3, 1, 0, 6); - $plot->label->setCallbackFunction("labelFormat"); - - $plot->setBarColor($colors[$n]); - - $plot->setYAxis($axis[$n]); - - $group->add($plot); - -} - -$graph->add($group); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/bar-005.php b/artichow/examples/site/bar-005.php deleted file mode 100644 index 1a025c7..0000000 --- a/artichow/examples/site/bar-005.php +++ /dev/null @@ -1,82 +0,0 @@ -setAntiAliasing(TRUE); -$graph->border->hide(); - -$group = new PlotGroup; -$group->grid->hide(TRUE); -$group->setSpace(2, 2, 20, 0); -$group->setPadding(30, 10, NULL, NULL); - -$colors = array( - new Orange(25), - new LightBlue(10) -); - -for($n = 0; $n < 2; $n++) { - - $x = array(); - - for($i = 0; $i < 3 - $n * 3; $i++) { - $x[] = NULL; - } - - for($i = 3 - ($n * 3); $i < 12 - ($n * 3); $i++) { - $x[] = cos($i * M_PI / 100) * mt_rand(800, 1200) / 1000 * (((1 - $n) * 5 + 10) / 10); - } - - for($i = 0; $i < $n * 3; $i++) { - $x[] = NULL; - } - - $plot = new BarPlot($x, 1, 1, (1 - $n) * 6); - -// $plot->setBarPadding(2, 2); - - $plot->barShadow->setSize(2); - $plot->barShadow->setPosition(Shadow::RIGHT_TOP); - $plot->barShadow->setColor(new Color(160, 160, 160, 10)); - $plot->barShadow->smooth(TRUE); - - $plot->setBarColor($colors[$n]); - - $group->add($plot); - $group->legend->add($plot, $n + date('Y'), Legend::BACKGROUND); - -} - -function setPc($value) { - return round($value * 10).'%'; -} - -$group->axis->left->label->setCallbackFunction('setPc'); - -$months = array( - "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" -); - -$group->axis->bottom->setLabelText($months); -$group->axis->bottom->hideTicks(TRUE); - -$group->legend->shadow->setSize(0); -$group->legend->setAlign(Legend::CENTER); -$group->legend->setSpace(6); -$group->legend->setTextFont(new Tuffy(8)); -$group->legend->setPosition(0.50, 0.10); -$group->legend->setBackgroundColor(new Color(255, 255, 255, 25)); -$group->legend->setColumns(2); - -$graph->add($group); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/canvas-001.php b/artichow/examples/site/canvas-001.php deleted file mode 100644 index 9bba02b..0000000 --- a/artichow/examples/site/canvas-001.php +++ /dev/null @@ -1,68 +0,0 @@ -getDriver(); - -$driver->filledRectangle( - new Color(230, 230, 230, 0), - new Line( - new Point(10, 10), - new Point(200, 150) - ) -); - -for($i = 7; $i < 400; $i += 15) { - $driver->line( - new Color(0, 0, 0), - new Line( - new Point($i, 0 + 50), - new Point($i, 30 + 50) - ) - ); -} - -for($i = 7; $i < 30; $i += 15) { - $driver->line( - new Color(0, 0, 0), - new Line( - new Point(0, $i + 50), - new Point(400, $i + 50) - ) - ); -} - -$driver->filledRectangle( - new Color(0, 100, 200, 50), - new Line( - new Point(100, 100), - new Point(280, 180) - ) -); - -$debut = new Color(230, 250, 0); -$fin = new Color(255, 255, 255, 100); - -$driver->filledEllipse( - new RadialGradient( - $debut, - $fin - ), - new Point(105, 135), - 90, 90 -); - -$text = new Text( - "Artichow !", - new Tuffy(15), - new Color(0, 0, 80), - 45 -); - -$driver->string($text, new Point(210, 75)); - -$graph->draw(); - -?> diff --git a/artichow/examples/site/impulse-001.php b/artichow/examples/site/impulse-001.php deleted file mode 100644 index 9ffc027..0000000 --- a/artichow/examples/site/impulse-001.php +++ /dev/null @@ -1,36 +0,0 @@ -title->set('Impulses'); -$graph->shadow->setSize(4); - -$y = array(); -for($i = 0; $i < 40; $i++) { - $y[] = cos($i / 15 * 2 * M_PI) / (0.8 + $i / 15) * 4; -} - -$plot = new ScatterPlot($y); -$plot->setPadding(25, 15, 35, 15); -$plot->setBackgroundColor(new Color(230, 230, 255)); -$plot->setSpace(2, 2); - -// Set impulses -$plot->setImpulse(new DarkBlue); - -$plot->grid->hideVertical(); -$plot->grid->setType(Line::DASHED); - -// Hide ticks -$plot->xAxis->hideTicks(); -$plot->xAxis->label->hide(); - -$plot->mark->setType(Mark::SQUARE); -$plot->mark->setSize(4); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/site/line-001.php b/artichow/examples/site/line-001.php deleted file mode 100644 index 98a8f42..0000000 --- a/artichow/examples/site/line-001.php +++ /dev/null @@ -1,71 +0,0 @@ -setAntiAliasing(TRUE); - -$x = array( - 3, 1, 5, 6, 3, 8, 6 -); - -$plot = new LinePlot($x); - -$plot->grid->setNoBackground(); - -$plot->title->set("Filled line and marks"); -$plot->title->setFont(new Tuffy(10)); -$plot->title->setBackgroundColor(new Color(255, 255, 255, 25)); -$plot->title->border->show(); -$plot->title->setPadding(3, 3, 3, 3); -$plot->title->move(-20, 25); - -$plot->setSpace(4, 4, 10, 0); -$plot->setPadding(25, 15, 10, 18); - -$plot->setBackgroundGradient( - new LinearGradient( - new Color(210, 210, 210), - new Color(255, 255, 255), - 0 - ) -); - -$plot->setColor(new Color(0, 0, 150, 20)); - -$plot->setFillGradient( - new LinearGradient( - new Color(150, 150, 210), - new Color(245, 245, 245), - 0 - ) -); - -$plot->mark->setType(Mark::CIRCLE); -$plot->mark->border->show(); - -$y = array( - 'Lundi', - 'Mardi', - 'Mercredi', - 'Jeudi', - 'Vendredi', - 'Samedi', - 'Dimanche' -); - -$plot->xAxis->setLabelText($y); -$plot->xAxis->label->setFont(new Tuffy(7)); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/line-002.php b/artichow/examples/site/line-002.php deleted file mode 100644 index 3fcb668..0000000 --- a/artichow/examples/site/line-002.php +++ /dev/null @@ -1,62 +0,0 @@ -setAntiAliasing(TRUE); - -$x = array( - 4, 3, 1, 0, -2, 1, 3, 2, 3, 5, 4, 1 -); - -$plot = new LinePlot($x); -$plot->setXAxisZero(FALSE); - -$plot->grid->hide(TRUE); - -$plot->title->set("Using dashed line and legend"); -$plot->title->setFont(new TuffyItalic(9)); -$plot->title->setBackgroundColor(new Color(255, 255, 255, 50)); -$plot->title->setPadding(3, 3, 3, 3); -$plot->title->move(0, 20); - -$plot->setSpace(6, 6, 10, 10); -$plot->setPadding(30, 10, 15, 25); - -$plot->setBackgroundColor( - new Color(245, 245, 245) -); - -$plot->setStyle(Line::DASHED); -$plot->setColor(new Color(0, 150, 0, 20)); - -$plot->setFillGradient( - new LinearGradient( - new Color(220, 220, 150, 40), - new Color(255, 255, 210, 30), - 0 - ) -); - -$graph->shadow->setSize(4); -$graph->shadow->setPosition(Shadow::LEFT_BOTTOM); -$graph->shadow->smooth(TRUE); - -$plot->legend->add($plot, "Apples"); -$plot->legend->shadow->setSize(0); -$plot->legend->setAlign(Legend::CENTER, Legend::TOP); -$plot->legend->setPosition(0.75, 0.60); -$plot->legend->setTextFont(new Tuffy(8)); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/line-003.php b/artichow/examples/site/line-003.php deleted file mode 100644 index 6c283d3..0000000 --- a/artichow/examples/site/line-003.php +++ /dev/null @@ -1,70 +0,0 @@ -setBackgroundColor( - new Color(240, 240, 240) -); - -$plot->setPadding(40, 15, 15, 15); - -$plot->setColor( - new Color(60, 60, 150) -); - -$plot->setFillColor( - new Color(120, 175, 80, 47) -); - -$plot->grid->setType(Line::DASHED); - -$plot->yAxis->setLabelNumber(6); -$plot->yAxis->setLabelPrecision(1); -$plot->yAxis->setNumberByTick('minor', 'major', 1); -$plot->yAxis->label->setCallbackFunction('format'); -$plot->yAxis->label->setFont(new Tuffy(7)); - -$plot->xAxis->setNumberByTick('minor', 'major', 3); -$plot->xAxis->label->hideFirst(TRUE); -$plot->xAxis->setLabelInterval(50); -$plot->xAxis->label->setFont(new Tuffy(7)); - -$plot->grid->setInterval(1, 50); - -$graph->shadow->setSize(4); -$graph->shadow->setPosition(Shadow::RIGHT_BOTTOM); -$graph->shadow->smooth(TRUE); - -$plot->label->set($x); -$plot->label->setInterval(25); -$plot->label->hideFirst(TRUE); -$plot->label->setPadding(1, 1, 1, 1); -$plot->label->setCallbackFunction('format'); -$plot->label->setBackgroundColor( - new Color(227, 223, 241, 15) -); -$plot->label->setFont(new Tuffy(7)); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/line-004.php b/artichow/examples/site/line-004.php deleted file mode 100644 index b6ed59b..0000000 --- a/artichow/examples/site/line-004.php +++ /dev/null @@ -1,104 +0,0 @@ -setBackgroundColor(new Color(0xF4, 0xF4, 0xF4)); -$graph->shadow->setSize(3); - -$graph->title->set("Evolution"); -$graph->title->setFont(new Tuffy(15)); -$graph->title->setColor(new Color(0x00, 0x00, 0x8B)); - - -$group = new PlotGroup; -$group->setSize(0.82, 1); -$group->setCenter(0.41, 0.5); -$group->setPadding(35, 26, 40, 27); -$group->setSpace(2, 2); - -$group->grid->setColor(new Color(0xC4, 0xC4, 0xC4)); -$group->grid->setType(Line::DASHED); -$group->grid->hideVertical(TRUE); -$group->grid->setBackgroundColor(new White); - -$group->axis->left->setColor(new DarkGreen); -$group->axis->left->label->setFont(new Font2); - -$group->axis->right->setColor(new DarkBlue); -$group->axis->right->label->setFont(new Font2); - -$group->axis->bottom->label->setFont(new Font2); - -$group->legend->setPosition(1.18); -$group->legend->setTextFont(new Tuffy(8)); -$group->legend->setSpace(10); - -// Add a bar plot -$x = array(16, 16, 12, 13, 11, 18, 10, 12, 11, 12, 11, 16); - -$plot = new BarPlot($x, 1, 2); -$plot->setBarColor(new MidYellow); -$plot->setBarPadding(0.15, 0.15); -$plot->barShadow->setSize(3); -$plot->barShadow->smooth(TRUE); -$plot->barShadow->setColor(new Color(200, 200, 200, 10)); -$plot->move(1, 0); - -$group->legend->add($plot, "Yellow bar", Legend::BACKGROUND); -$group->add($plot); - -// Add a bar plot -$x = array(20, 25, 20, 18, 16, 25, 29, 12, 15, 18, 21, 26); - -$plot = new BarPlot($x, 2, 2); -$plot->setBarColor(new Color(120, 175, 80, 10)); -$plot->setBarPadding(0.15, 0.15); -$plot->barShadow->setSize(3); -$plot->barShadow->smooth(TRUE); -$plot->barShadow->setColor(new Color(200, 200, 200, 10)); - -$group->legend->add($plot, "Green bar", Legend::BACKGROUND); -$group->add($plot); - -// Add a second bar plot -$x = array(12, 14, 10, 9, 10, 16, 12, 8, 8, 10, 12, 13); - -$plot = new BarPlot($x, 2, 2); -$plot->setBarColor(new Orange); -$plot->setBarPadding(0.15, 0.15); - -$group->legend->add($plot, "Orange bar", Legend::BACKGROUND); -$group->add($plot); - -// Add a line plot -$x = array(6, 5, 6, 5.5, 4.5, 4, 4.5, 4, 5, 4, 5, 5.5); - -$plot = new LinePlot($x, LinePlot::MIDDLE); -$plot->setColor(new DarkBlue); -$plot->setThickness(5); -$plot->setYAxis(Plot::RIGHT); -$plot->setYMax(12); - -$plot->mark->setType(Mark::CIRCLE); -$plot->mark->setSize(6); -$plot->mark->setFill(new LightBlue); -$plot->mark->border->show(); - -$group->legend->add($plot, "Blue line", Legend::MARK); -$group->add($plot); - -$graph->add($group); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/line-006.php b/artichow/examples/site/line-006.php deleted file mode 100644 index 23e29fa..0000000 --- a/artichow/examples/site/line-006.php +++ /dev/null @@ -1,58 +0,0 @@ -setAntiAliasing(TRUE); - -$x = array( - -4, -5, -2, -8, -3, 1, 4, 9, 5, 6, 2 -); - -$plot = new LinePlot($x); -$plot->setStyle(Line::DASHED); - -$plot->setSpace(4, 4, 10, 0); -$plot->setPadding(25, 15, 10, 18); - -$plot->setBackgroundGradient( - new LinearGradient( - new Color(230, 230, 230), - new Color(255, 255, 255), - 90 - ) -); - -$plot->setFilledArea(7, 9, new Red(25)); -$plot->setFilledArea(1, 4, new Yellow(25)); - -$plot->setColor(new Color(0, 0, 150, 20)); - -$plot->grid->setColor(new VeryLightGray); - -$plot->mark->setType(Mark::SQUARE); -$plot->mark->setSize(4); -$plot->mark->setFill(new VeryDarkGreen(30)); -$plot->mark->border->show(); -$plot->mark->border->setColor(new DarkBlue(60)); - -$plot->xAxis->label->hide(TRUE); -$plot->xAxis->setNumberByTick('minor', 'major', 3); - -$plot->yAxis->setLabelNumber(8); - -$plot->legend->add($plot, "My line"); -$plot->legend->setPosition(0.9, 0.77); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/line-007.php b/artichow/examples/site/line-007.php deleted file mode 100644 index feaaf04..0000000 --- a/artichow/examples/site/line-007.php +++ /dev/null @@ -1,70 +0,0 @@ -setAntiAliasing(TRUE); - -$group = new PlotGroup; -$group->grid->setType(Line::DASHED); - -$group->setPadding(40, NULL, 20, NULL); - -$group->axis->left->setLabelNumber(8); -$group->axis->left->setLabelPrecision(1); -$group->axis->left->setTickStyle(Tick::OUT); - -$x = array(2, 4, 8, 16, 32, 48, 56, 60, 62); - -$plot = new LinePlot($x); -$plot->setColor(new Orange()); -$plot->setFillColor(new LightOrange(80)); - -$plot->mark->setType(Mark::CIRCLE); -$plot->mark->setFill(new MidRed); -$plot->mark->setSize(6); - -$group->legend->add($plot, "John", Legend::MARK); -$group->add($plot); - -$x = array(NULL, NULL, NULL, 10, 12, 14, 18, 26, 42); - -$plot = new LinePlot($x); -$plot->setColor(new Color(120, 120, 30, 10)); -$plot->setFillColor(new Color(120, 120, 60, 90)); - -$plot->mark->setType(Mark::SQUARE); -$plot->mark->setFill(new DarkGreen); -$plot->mark->setSize(5); - -$group->add($plot); - -function setYear($value) { - return $value + 2000; -} - -$group->axis->bottom->label->setCallbackFunction('setYear'); - -function setK($value) { - return round($value).'K'; -} - -$group->axis->left->label->setCallbackFunction('setK'); - -$group->legend->add($plot, "George", Legend::MARK); -$group->legend->setPosition(0.45, 0.25); -$group->legend->shadow->smooth(TRUE); - -$graph->add($group); - -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/logo.php b/artichow/examples/site/logo.php deleted file mode 100644 index 7c1a4c5..0000000 --- a/artichow/examples/site/logo.php +++ /dev/null @@ -1,51 +0,0 @@ -setAntiAliasing(TRUE); -$graph->border->hide(); - -$x = array(); -for($i = 0; $i < 20; $i++) { - $x[] = mt_rand(4, 12); -} - -$plot = new LinePlot($x); - -$plot->setSpace(0, 0, 50, 0); -$plot->setPadding(3, 3, 3, 3); - -$plot->setBackgroundGradient( - new LinearGradient( - new Color(230, 230, 230), - new Color(255, 255, 255), - 0 - ) -); - -$plot->setColor(new Color(0, 0, 180, 20)); - -$plot->setFillGradient( - new LinearGradient( - new Color(220, 220, 230, 25), - new Color(240, 240, 255, 25), - 90 - ) -); - -$plot->xAxis->hide(TRUE); -$plot->yAxis->hide(TRUE); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/math-001.php b/artichow/examples/site/math-001.php deleted file mode 100644 index 191215a..0000000 --- a/artichow/examples/site/math-001.php +++ /dev/null @@ -1,45 +0,0 @@ -setInterval(0.2); -$plot->setPadding(NULL, NULL, NULL, 20); - -$function = new MathFunction('cos'); -$function->setColor(new DarkGreen); -$function->mark->setType(Mark::SQUARE); -$function->mark->setSize(3); -$plot->add($function, "f(x) = cos(x)", Legend::MARK); - -$function = new MathFunction('exp'); -$function->setColor(new DarkRed); -$function->mark->setType(Mark::SQUARE); -$function->mark->setSize(3); -$function->mark->setFill(new DarkBlue); -$plot->add($function, "f(x) = exp(x)", Legend::MARK); - -function x2($x) { - return - $x * $x + 0.5; -} - -$function = new MathFunction('x2'); -$function->setColor(new DarkBlue); -$plot->add($function, "f(x) = - x * x + 0.5"); - -$plot->legend->setPosition(0.9, 0.8); -$plot->legend->setPadding(3, 3, 3, 3, 3); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/mini-001.php b/artichow/examples/site/mini-001.php deleted file mode 100644 index 8e2c376..0000000 --- a/artichow/examples/site/mini-001.php +++ /dev/null @@ -1,60 +0,0 @@ -setAntiAliasing(TRUE); - -$x = array( - 0, 2, 5, 2, 3, 8 -); - -$plot = new LinePlot($x); -$plot->setXAxisZero(FALSE); -$plot->grid->setNobackground(); - -$plot->setSpace(6, 6, 10, 10); -$plot->setPadding(30, 6, 8, 18); - -// Set a background gradient -$plot->setBackgroundGradient( - new LinearGradient( - new Color(210, 210, 210), - new Color(255, 255, 255), - 0 - ) -); - -// Change line color -$plot->setColor(new Color(0, 0, 150, 20)); - -// Set line background gradient -$plot->setFillGradient( - new LinearGradient( - new Color(150, 150, 210), - new Color(230, 230, 255), - 0 - ) -); - -// Change mark type -$plot->mark->setType(Mark::CIRCLE); -$plot->mark->border->show(); -$plot->mark->setSize(6); - -$plot->yAxis->setLabelPrecision(1); -$plot->yAxis->label->setFont(new Font1); -$plot->xAxis->label->setFont(new Font1); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/mini-002.php b/artichow/examples/site/mini-002.php deleted file mode 100644 index 6224f6c..0000000 --- a/artichow/examples/site/mini-002.php +++ /dev/null @@ -1,50 +0,0 @@ -setAntiAliasing(TRUE); - -$x = array( - 1, 2, 5, 0.5, 3, 8, 7, 6, 2, -4 -); - -$plot = new LinePlot($x); -$plot->grid->setNobackground(); -$plot->setPadding(20, 8, 8, 20); -$plot->setXAxisZero(FALSE); - -// Set a background gradient -$plot->setBackgroundGradient( - new LinearGradient( - new Color(210, 210, 210), - new Color(255, 255, 255), - 0 - ) -); - -// Set semi-transparent background gradient -$plot->setFillGradient( - new LinearGradient( - new Color(230, 150, 150, 20), - new Color(230, 230, 180, 50), - 90 - ) -); - -$plot->xAxis->label->hideFirst(TRUE); -$plot->xAxis->label->hideLast(TRUE); -$plot->xAxis->setNumberByTick('minor', 'major', 2); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/mini-003.php b/artichow/examples/site/mini-003.php deleted file mode 100644 index d988970..0000000 --- a/artichow/examples/site/mini-003.php +++ /dev/null @@ -1,56 +0,0 @@ -setPadding(22, 5, 25, 8); - -// Hide grid -$plot->grid->setType(Line::DASHED); - -// Change background color -$plot->setBackgroundColor(new Color(240, 240, 240, 50)); - -// Set Y on both left and rights sides -$plot->setYAxis(Plot::BOTH); - -// Change line properties -$plot->setColor(new Color(0, 0, 0)); -$plot->setFillColor(new Color(240, 190, 130, 50)); - -// Chenge ticks and labels interval -$plot->xAxis->setTickInterval(2); -$plot->xAxis->label->hide(TRUE); -$plot->xAxis->setNumberByTick('minor', 'major', 1); - -// Hide first and last values on X axis -$plot->xAxis->label->hideFirst(TRUE); -$plot->xAxis->label->hideLast(TRUE); - -// Add a title -$plot->title->set("Random values"); -$plot->title->move(0, 2); -$plot->title->setFont(new Tuffy(8)); -$plot->title->setBackgroundColor(new Color(255, 255, 255, 25)); -$plot->title->border->show(); -$plot->title->setPadding(2, 2, 2, 2); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/mini-004.php b/artichow/examples/site/mini-004.php deleted file mode 100644 index 9247279..0000000 --- a/artichow/examples/site/mini-004.php +++ /dev/null @@ -1,59 +0,0 @@ -setAntiAliasing(TRUE); - -$x = array( - 1, 2, 5, 4, 2, 3 -); - -$plot = new LinePlot($x); - -// Change component padding -$plot->setPadding(10, 12, 12, 7); - -// Set a background gradient -$plot->setBackgroundGradient( - new LinearGradient( - new Color(230, 230, 230), - new Color(255, 255, 255), - 0 - ) -); - -// Change line background color -$plot->setFillGradient( - new LinearGradient( - new Color(200, 240, 215, 30), - new Color(150, 190, 165, 30), - 0 - ) -); - -// Hide grid -$plot->grid->hide(TRUE); -$plot->grid->setNobackground(); - -$plot->yAxis->label->hide(TRUE); -$plot->xAxis->label->hide(TRUE); - -$plot->label->set($x); -$plot->label->setBackgroundColor(new Color(240, 240, 240, 10)); -$plot->label->border->setColor(new Color(255, 0, 0, 15)); -$plot->label->setPadding(3, 2, 0, 0); -$plot->label->setFont(new Font1); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/mini-005.php b/artichow/examples/site/mini-005.php deleted file mode 100644 index 00c1bd7..0000000 --- a/artichow/examples/site/mini-005.php +++ /dev/null @@ -1,46 +0,0 @@ -setAntiAliasing(TRUE); - -$x = array(); -for($i = 0; $i < 10; $i++) { - $x[] = mt_rand(1, 99) / 10; -} - -$plot = new LinePlot($x); -$plot->setBackgroundColor(new Color(240, 240, 240)); -$plot->setPadding(30, 8, 8, 20); - -$plot->setColor( - new Color(60, 60, 150) -); -$plot->setFillGradient( - new LinearGradient( - new Color(120, 175, 80, 47), - new Color(231, 172, 113, 30), - 0 - ) -); - -$plot->grid->setType(Line::DASHED); - -$plot->yAxis->setLabelNumber(2); -$plot->yAxis->setLabelPrecision(1); - -$plot->xAxis->setLabelInterval(2); -$plot->xAxis->setNumberByTick('minor', 'major', 2); - -$graph->add($plot); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/mini-006.php b/artichow/examples/site/mini-006.php deleted file mode 100644 index c2ef179..0000000 --- a/artichow/examples/site/mini-006.php +++ /dev/null @@ -1,53 +0,0 @@ -setAntiAliasing(TRUE); - -$group = new PlotGroup; -$group->setXAxisZero(FALSE); -$group->setBackgroundColor(new Color(197, 180, 210, 80)); - -$group->setPadding(25, 10, 10, 20); - -$group->axis->left->setLabelNumber(2); -$group->axis->left->setLabelPrecision(1); - -// Display two lines -for($n = 0; $n < 2; $n++) { - - $x = array(); - - for($i = 0; $i < 10; $i++) { - $x[] = (cos($i * M_PI / 5)) / ($n + 1); - } - - $plot = new LinePlot($x); - $plot->setColor(color(10)); // Random line color - $plot->setFillColor(color(90)); // Random background color - - $group->add($plot); - -} - -$graph->add($group); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/pie-001.php b/artichow/examples/site/pie-001.php deleted file mode 100644 index f0937a9..0000000 --- a/artichow/examples/site/pie-001.php +++ /dev/null @@ -1,42 +0,0 @@ -setAntiAliasing(TRUE); - -$graph->title->set("Stats"); -$graph->title->setFont(new TuffyItalic(16)); - -$values = array(8, 4, 6, 2, 5, 3, 4); - -$plot = new Pie($values, Pie::EARTH); -$plot->setCenter(0.4, 0.55); -$plot->setSize(0.7, 0.6); -$plot->set3D(10); -$plot->explode(array(1 => 14, 4 => 20, 0 => 10)); - -$plot->setLegend(array( - 'Mon', - 'Tue', - 'Wed', - 'Thu', - 'Fri', - 'Sat', - 'Sun' -)); - -$plot->legend->setPosition(1.3); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/site/pie-002.php b/artichow/examples/site/pie-002.php deleted file mode 100644 index 0c36eb3..0000000 --- a/artichow/examples/site/pie-002.php +++ /dev/null @@ -1,50 +0,0 @@ -setBackgroundGradient( - new LinearGradient( - new White, - new VeryLightGray(40), - 0 - ) -); -$graph->title->set("Horses"); -$graph->shadow->setSize(5); -$graph->shadow->smooth(TRUE); -$graph->shadow->setPosition(Shadow::LEFT_BOTTOM); -$graph->shadow->setColor(new DarkGray); - -$values = array(8, 4, 6, 2, 5); - -$plot = new Pie($values); -$plot->setCenter(0.35, 0.55); -$plot->setSize(0.7, 0.6); -$plot->set3D(10); -$plot->setLabelPosition(10); - -$plot->setLegend(array( - 'France', - 'Spain', - 'Italy', - 'Germany', - 'England' -)); - -$plot->legend->setPosition(1.40); -$plot->legend->shadow->setSize(0); -$plot->legend->setBackgroundColor(new VeryLightGray(30)); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/site/pie-003.php b/artichow/examples/site/pie-003.php deleted file mode 100644 index 65080c8..0000000 --- a/artichow/examples/site/pie-003.php +++ /dev/null @@ -1,52 +0,0 @@ -setAntiAliasing(TRUE); - -$graph->title->set("Customized colors"); -$graph->title->setFont(new Tuffy(12)); -$graph->title->move(80, 10); - -$values = array(16, 9, 13, 23); -$colors = array( - new LightOrange, - new LightPurple, - new LightBlue, - new LightRed, - new LightPink -); - -$plot = new Pie($values, $colors); -$plot->setCenter(0.3, 0.53); -$plot->setAbsSize(200, 200); -$plot->setBorderColor(new White); -$plot->setStartAngle(234); - -$plot->setLegend(array( - 'Arthur', - 'Abel', - 'Pascal', - 'Thamer' -)); - -$plot->setLabelPosition(-40); -$plot->label->setPadding(2, 2, 2, 2); -$plot->label->setFont(new Tuffy(7)); -$plot->label->setBackgroundColor(new White(60)); - -$plot->legend->setPosition(1.38); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/site/pie-004.php b/artichow/examples/site/pie-004.php deleted file mode 100644 index f8ad530..0000000 --- a/artichow/examples/site/pie-004.php +++ /dev/null @@ -1,53 +0,0 @@ -setBackgroundGradient( - new LinearGradient( - new VeryLightGray(40), - new White, - 90 - ) -); -$graph->title->set("Arbitrary labels"); -$graph->title->setAngle(90); -$graph->title->move(120, NULL); - -$values = array(8, 4, 6, 2, 5, 3, 4); - -$plot = new Pie($values); -$plot->setCenter(0.45, 0.5); -$plot->setSize(0.55, 0.55 * 300 / 175); - -$plot->label->set(array( - 'Arthur', 'Abel', 'Bernard', 'Thierry', 'Paul', 'Gaston', 'Joe' -)); - -$plot->label->setCallbackFunction(NULL); // We must disable the default callback function -$plot->setLabelPosition(10); - -$plot->setLegend(array( - 'ABC', - 'DEF', - 'GHI', - 'JKL', - 'MNO', - 'PQR', - 'STU' -)); - -$plot->legend->hide(TRUE); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/site/pie-005.php b/artichow/examples/site/pie-005.php deleted file mode 100644 index c3524e2..0000000 --- a/artichow/examples/site/pie-005.php +++ /dev/null @@ -1,51 +0,0 @@ -title->set($title); - $plot->title->setFont(new TuffyBold(9)); - $plot->title->move(NULL, -12); - - $plot->label->setFont(new Tuffy(7)); - $plot->legend->hide(TRUE); - $plot->setLabelPosition(5); - $plot->setSize(0.48, 0.35); - $plot->setCenter($x, $y); - $plot->set3D(8); - $plot->setBorderColor(new White); - - return $plot; - -} - -$graph = new Graph(280, 350); -$graph->setAntiAliasing(TRUE); - -$plot = createPie(array(1, 4, 5, 2, 3), "Cowléoptère", 0.25, 0.24); -$graph->add($plot); - -$plot = createPie(array(1, 9, 1, 2, 1), "Asticow", 0.75, 0.24); -$graph->add($plot); - -$plot = createPie(array(5, 7, 8, 6, 3), "Cowlibri", 0.25, 0.65); -$graph->add($plot); - -$plot = createPie(array(6, 4, 6, 5, 6), "Bourricow", 0.75, 0.65); -$plot->legend->setModel(Legend::MODEL_BOTTOM); -$plot->setLegend(array('plip', 'plop', 'plap', 'plup', 'plep')); -$plot->legend->hide(FALSE); // We print only one legend -$plot->legend->setPosition(0, 1.10); -$graph->add($plot); - -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/site/scatter-001.php b/artichow/examples/site/scatter-001.php deleted file mode 100644 index 173f0db..0000000 --- a/artichow/examples/site/scatter-001.php +++ /dev/null @@ -1,69 +0,0 @@ -title->move(-40, 0); -$graph->title->set('Two circles'); - -$group = new PlotGroup; -$group->setBackgroundGradient( - new LinearGradient( - new VeryLightGray, - new Color(245, 245, 245), - 0 - ) -); - -$group->setPadding(25, 20, 40, 15); -$group->setSpace(5, 5, 5, 5); - -$group->legend->setPosition(0.82, 0.1); -$group->legend->setAlign(Legend::CENTER, Legend::MIDDLE); - -function getCircle($size) { - - $center = 0; - - $x = array(); - $y = array(); - - for($i = 0; $i <= 20; $i++) { - $rad = ($i / 20) * 2 * M_PI; - $x[] = $center + cos($rad) * $size; - $y[] = $center + sin($rad) * $size; - } - - return array($x, $y); - -} - -list($x, $y) = getCircle(3); - -$plot = new ScatterPlot($y, $x); - -$plot->link(TRUE, new DarkBlue); - -$plot->mark->setFill(new DarkPink); -$plot->mark->setType(Mark::CIRCLE, 6); - -$group->legend->add($plot, 'Circle #1', Legend::MARK); -$group->add($plot); - -list($x, $y) = getCircle(5); - -$plot = new ScatterPlot($y, $x); - -$plot->link(TRUE, new DarkGreen); - -$plot->mark->setFill(new DarkOrange); -$plot->mark->setType(Mark::SQUARE, 4); - -$group->legend->add($plot, 'Circle #2', Legend::MARK); -$group->add($plot); - -$graph->add($group); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/site/scatter-002.php b/artichow/examples/site/scatter-002.php deleted file mode 100644 index 66592a7..0000000 --- a/artichow/examples/site/scatter-002.php +++ /dev/null @@ -1,30 +0,0 @@ -title->set('Simple ScatterPlot'); -$graph->shadow->setSize(4); - -$y = array(1, 1.3, 1.8, 1.6, 10, 7, 8, 3, 4, 2, 4); -$x = array(0.5, 0.7, 0.65, 0.9, 0.5, 1.5, 4, 3, 5, 2, 2); - -$plot = new ScatterPlot($y, $x); -$plot->setBackgroundColor(new Color(255, 245, 220)); - -$plot->mark->setSize(15); -$plot->mark->setFill( - new RadialGradient( - new LightRed, - new Red - ) -); - -$plot->setSpace(6, 6, 6, 0); -$plot->setPadding(25, NULL, 40, 20); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/site/scatter-003.php b/artichow/examples/site/scatter-003.php deleted file mode 100644 index 79d8fac..0000000 --- a/artichow/examples/site/scatter-003.php +++ /dev/null @@ -1,34 +0,0 @@ -title->set('Linked ScatterPlot'); -$graph->title->setFont(new TuffyItalic(14)); -$graph->shadow->setSize(4); - -$y = array(1, 10, 7, 8, 5, 4, 2, 4); -$x = array(0.5, 0.5, 1.5, 4, 3, 5, 2, 2); - -$plot = new ScatterPlot($y, $x); -$plot->setBackgroundColor(new Color(235, 235, 235)); - -$plot->mark->setSize(15); -$plot->mark->setFill( - new RadialGradient( - new LightGreen, - new DarkGreen - ) -); - -$plot->link(TRUE); -$plot->setColor(new DarkGreen); - -$plot->setSpace(6, 6, 6, 0); -$plot->setPadding(25, NULL, 40, 20); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/test/error-box.php b/artichow/examples/test/error-box.php deleted file mode 100644 index 5c13626..0000000 --- a/artichow/examples/test/error-box.php +++ /dev/null @@ -1,69 +0,0 @@ -getDriver(); - -// Display title -$driver->filledRectangle( - new White, - new Line( - new Point(0, 0), - new Point($width, $height) - ) -); - -$driver->filledRectangle( - new Red, - new Line( - new Point(0, 0), - new Point(110, 25) - ) -); - -$text = new Text( - "Artichow error", - new Font3, - new White, - 0 -); - -$driver->string($text, new Point(5, 6)); - -// Display red box -$driver->rectangle( - new Red, - new Line( - new Point(0, 25), - new Point($width - 90, $height - 1) - ) -); - -// Display error image -$image = new FileImage('error.png'); -$driver->copyImage($image, new Point($width - 81, $height - 81), new Point($width - 1, $height - 1)); - -// Draw message -$text = new Text( - $message, - new Font2, - new Black, - 0 -); - -$driver->string($text, new Point(10, 40)); - -$graph->draw(); - -?> diff --git a/artichow/examples/test/error.png b/artichow/examples/test/error.png deleted file mode 100644 index e5addb1..0000000 Binary files a/artichow/examples/test/error.png and /dev/null differ diff --git a/artichow/examples/test/multi-line-text.php b/artichow/examples/test/multi-line-text.php deleted file mode 100644 index 70a8d80..0000000 --- a/artichow/examples/test/multi-line-text.php +++ /dev/null @@ -1,37 +0,0 @@ -getDriver(); - -$driver->filledRectangle( - new Red, - new Line( - new Point(200, 0), - new Point(200, 600) - ) -); - -$text = new Text( - "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean gravida quam semper nibh. Sed orci. Aenean ullamcorper magna eget odio. Sed nonummy ante sit amet sapien.\nPhasellus nulla dui, aliquet vel, adipiscing vel, vulputate sed, velit.\nSed at neque vel ipsum commodo hendrerit.\nA. Nonyme", - new Tuffy(mt_rand(10, 15)), - new Color(mt_rand(0, 100), mt_rand(0, 100), mt_rand(0, 100)), - 0 -); - -$driver->string($text, new Point(0, 0), 200); - -$text = new Text( - "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean gravida quam semper nibh. Sed orci. Aenean ullamcorper magna eget odio. Sed nonummy ante sit amet sapien.\nPhasellus nulla dui, aliquet vel, adipiscing vel, vulputate sed, velit.\nSed at neque vel ipsum commodo hendrerit.\nA. Nonyme", - new Font(mt_rand(2, 4)), - new Color(mt_rand(0, 100), mt_rand(0, 100), mt_rand(0, 100)), - 0 -); - -$driver->string($text, new Point(0, 400), 200); - -$graph->draw(); - -?> diff --git a/artichow/examples/test/set-label-text-error.php b/artichow/examples/test/set-label-text-error.php deleted file mode 100644 index f99cf22..0000000 --- a/artichow/examples/test/set-label-text-error.php +++ /dev/null @@ -1,58 +0,0 @@ -setAntiAliasing(TRUE); - -$values = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0); - -$plot = new BarPlot($values); -$plot->setBarColor( - new Color(234, 236, 255) -); -$plot->setSpace(5, 5, NULL, NULL); - -$plot->barShadow->setSize(3); -$plot->barShadow->setPosition(Shadow::RIGHT_TOP); -$plot->barShadow->setColor(new Color(180, 180, 180, 10)); -$plot->barShadow->smooth(TRUE); - - -$mois = array ('Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jun', 'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Déc'); -$label = array (); -foreach ($mois as $m) { $label []= $m; } -$label []= ' '; -foreach ($mois as $m) { $label []= $m; } - - -$plot->xAxis->setLabelText($label); - -/* ICI */ - - $max = array_max($values); - $yValues = array(); - for($i=0; $i<= $max; $i++) { - $yValues[]=$i; - } - $plot->yAxis->setLabelText($yValues); - - // Image::drawError(var_export($yValues, TRUE)); -$plot->yAxis->setLabelText($yValues); - -$plot->setPadding(30,5,20,15); - -$labelAvant = new Label("2005"); -$labelAvant->setFont (new TTFFont(ARTICHOW_FONT.'/TuffyBold.ttf', 12)); -$labelAvant->move (180,10); - -$labelMaintenant = new Label("2006"); -$labelMaintenant->setFont (new TTFFont(ARTICHOW_FONT.'/TuffyBold.ttf', 12)); -$labelMaintenant->move (450,10); - -$graph->add($plot); -$graph->addLabel($labelAvant, 0, 0); -$graph->addLabel($labelMaintenant, 0, 0); - -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/tutorials/AntiSpam/form.php b/artichow/examples/tutorials/AntiSpam/form.php deleted file mode 100644 index f242a76..0000000 --- a/artichow/examples/tutorials/AntiSpam/form.php +++ /dev/null @@ -1,5 +0,0 @@ -
          - - - -
          \ No newline at end of file diff --git a/artichow/examples/tutorials/AntiSpam/spam.php b/artichow/examples/tutorials/AntiSpam/spam.php deleted file mode 100644 index 051f032..0000000 --- a/artichow/examples/tutorials/AntiSpam/spam.php +++ /dev/null @@ -1,18 +0,0 @@ -setRand(5); - -// On assigne un nom à cette image pour vérifier -// ultérieurement la valeur fournie par l'utilisateur -$object->save('example'); - -// On affiche l'image à l'écran -$object->draw(); - -?> diff --git a/artichow/examples/tutorials/AntiSpam/valid.php b/artichow/examples/tutorials/AntiSpam/valid.php deleted file mode 100644 index e2f5ef7..0000000 --- a/artichow/examples/tutorials/AntiSpam/valid.php +++ /dev/null @@ -1,11 +0,0 @@ -check('example', $_GET['code'])) { - echo "Good value :-)"; -} else { - echo "Bad value :-("; -} -?> \ No newline at end of file diff --git a/artichow/examples/tutorials/bar-Bars.php b/artichow/examples/tutorials/bar-Bars.php deleted file mode 100644 index e2788a7..0000000 --- a/artichow/examples/tutorials/bar-Bars.php +++ /dev/null @@ -1,47 +0,0 @@ -setAntiAliasing(TRUE); - -$blue = new Color(0, 0, 200); -$red = new Color(200, 0, 0); - -$group = new PlotGroup; -$group->setPadding(40, 40); -$group->setBackgroundColor( - new Color(240, 240, 240) -); - -$values = array(12, 8, 20, 32, 15, 5); - -$plot = new BarPlot($values, 1, 2); -$plot->setBarColor($blue); -$plot->setYAxis(Plot::LEFT); - -$group->add($plot); -$group->axis->left->setColor($blue); -$group->axis->left->title->set("Blue bars"); - -$values = array(6, 12, 14, 2, 11, 7); - -$plot = new BarPlot($values, 2, 2); -$plot->setBarColor($red); -$plot->setYAxis(Plot::RIGHT); - -$group->add($plot); -$group->axis->right->setColor($red); -$group->axis->right->title->set("Red bars"); - -$graph->add($group); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/tutorials/bar-Simple.php b/artichow/examples/tutorials/bar-Simple.php deleted file mode 100644 index 54576d0..0000000 --- a/artichow/examples/tutorials/bar-Simple.php +++ /dev/null @@ -1,31 +0,0 @@ -setAntiAliasing(TRUE); - -$values = array(19, 42, 15, -25, 3); -$plot = new BarPlot($values); -$plot->setBarColor( - new Color(250, 230, 180) -); -$plot->setSpace(5, 5, NULL, NULL); - -$plot->barShadow->setSize(4); -$plot->barShadow->setPosition(Shadow::RIGHT_TOP); -$plot->barShadow->setColor(new Color(180, 180, 180, 10)); -$plot->barShadow->smooth(TRUE); - -$graph->add($plot); -$graph->draw(); - -?> \ No newline at end of file diff --git a/artichow/examples/tutorials/base-Color.php b/artichow/examples/tutorials/base-Color.php deleted file mode 100644 index 94dd008..0000000 --- a/artichow/examples/tutorials/base-Color.php +++ /dev/null @@ -1,40 +0,0 @@ -border->hide(); - -$driver = $graph->getDriver(); - -for($i = 7; $i < 400; $i += 15) { - $driver->line( - new Color(0, 0, 0), - new Line( - new Point($i, 0), - new Point($i, 30) - ) - ); -} - -for($i = 7; $i < 30; $i += 15) { - $driver->line( - new Color(0, 0, 0), - new Line( - new Point(0, $i), - new Point(400, $i) - ) - ); -} - -$driver->filledRectangle( - new Color(0, 100, 200, 50), - new Line( - new Point(0, 0), - new Point(400, 30) - ) -); - -$graph->draw(); - -?> diff --git a/artichow/examples/tutorials/base-Gradient-linear.php b/artichow/examples/tutorials/base-Gradient-linear.php deleted file mode 100644 index 326aa1e..0000000 --- a/artichow/examples/tutorials/base-Gradient-linear.php +++ /dev/null @@ -1,25 +0,0 @@ -border->hide(); - -$driver = $graph->getDriver(); - -$driver->filledRectangle( - new LinearGradient( - new Black, - new White, - 0 - ), - new Line( - new Point(0, 0), - new Point(400, 30) - ) -); - -$graph->draw(); - -?> diff --git a/artichow/examples/tutorials/base-Gradient-radial.php b/artichow/examples/tutorials/base-Gradient-radial.php deleted file mode 100644 index b9761cc..0000000 --- a/artichow/examples/tutorials/base-Gradient-radial.php +++ /dev/null @@ -1,24 +0,0 @@ -border->hide(); - -$driver = $graph->getDriver(); - -$start = new Color(125, 250, 0); -$end = new Color(0, 125, 125); - -// On dessine le dégradé radial dans un cercle -$driver->filledEllipse( - new RadialGradient( - $start, - $end - ), - new Point(125, 125), - 250, 250 -); - -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/tutorials/line-Customize.php b/artichow/examples/tutorials/line-Customize.php deleted file mode 100644 index 0212ffe..0000000 --- a/artichow/examples/tutorials/line-Customize.php +++ /dev/null @@ -1,50 +0,0 @@ -setAntiAliasing(TRUE); - -$values = array(1, 7, 3, 2.5, 5, -4.5, -5); -$plot = new LinePlot($values); -$plot->setBackgroundColor(new Color(245, 245, 245)); - -$plot->hideLine(TRUE); -$plot->setFillColor(new Color(180, 180, 180, 75)); - -$plot->grid->setBackgroundColor(new Color(235, 235, 180, 60)); - -$plot->yAxis->setLabelPrecision(2); -$plot->yAxis->setLabelNumber(6); - -$days = array( - 'Lundi', - 'Mardi', - 'Mercredi', - 'Jeudi', - 'Vendredi', - 'Samedi', - 'Dimanche' -); -$plot->xAxis->setLabelText($days); - -$plot->setSpace(6, 6, 10, 10); - -$plot->mark->setType(Mark::IMAGE); -$plot->mark->setImage(new FileImage("smiley.png")); - -$plot->label->set($values); -$plot->label->move(0, -23); -$plot->label->setBackgroundGradient( - new LinearGradient( - new Color(250, 250, 250, 10), - new Color(255, 200, 200, 30), - 0 - ) -); -$plot->label->border->setColor(new Color(20, 20, 20, 20)); -$plot->label->setPadding(3, 1, 1, 0); - -$graph->add($plot); -$graph->draw(); -?> diff --git a/artichow/examples/tutorials/line-Lines.php b/artichow/examples/tutorials/line-Lines.php deleted file mode 100644 index 41b95e1..0000000 --- a/artichow/examples/tutorials/line-Lines.php +++ /dev/null @@ -1,49 +0,0 @@ -setAntiAliasing(TRUE); - -$blue = new Color(0, 0, 200); -$red = new Color(200, 0, 0); - -$group = new PlotGroup; -$group->setBackgroundColor( - new Color(240, 240, 240) -); -$group->setPadding(40, 40); - -$values = array(12, 5, 20, 32, 15, 4, 16); - -$plot = new LinePlot($values); -$plot->setColor($blue); -$plot->setYAxis(Plot::LEFT); - -$group->add($plot); - -$group->axis->left->setColor($blue); -$group->axis->left->title->set("Blue line"); - -$values = array(6, 12, 14, 2, 11, 5, 21); - -$plot = new LinePlot($values); -$plot->setColor($red); -$plot->setYAxis(Plot::RIGHT); - -$group->add($plot); - -$group->axis->right->setColor($red); -$group->axis->right->title->set("Red line"); - -$graph->add($group); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/tutorials/line-Simple.php b/artichow/examples/tutorials/line-Simple.php deleted file mode 100644 index 7aeb88b..0000000 --- a/artichow/examples/tutorials/line-Simple.php +++ /dev/null @@ -1,22 +0,0 @@ -setAntiAliasing(FALSE); - -$values = array(1, 4, 5, -2.5, 3); -$plot = new LinePlot($values); -$plot->setBackgroundGradient( - new LinearGradient( - new Color(210, 210, 210), - new Color(250, 250, 250), - 0 - ) -); -$plot->yAxis->setLabelPrecision(1); -$plot->setSpace(5, 5, NULL, NULL); - -$graph->add($plot); -$graph->draw(); -?> diff --git a/artichow/examples/tutorials/plot-More.php b/artichow/examples/tutorials/plot-More.php deleted file mode 100644 index ec4300b..0000000 --- a/artichow/examples/tutorials/plot-More.php +++ /dev/null @@ -1,47 +0,0 @@ -setAntiAliasing(TRUE); - -$blue = new Color(150, 150, 230, 50); -$red = new Color(240, 50, 50, 25); - -$group = new PlotGroup; -$group->setSpace(5, 5, 5, 0); -$group->setBackgroundColor( - new Color(240, 240, 240) -); - -$values = array(18, 12, 14, 21, 11, 7, 9, 16, 7, 23); - -$plot = new BarPlot($values); -$plot->setBarColor($red); - -$group->add($plot); - -$values = array(12, 8, 6, 12, 7, 5, 4, 9, 3, 12); - -$plot = new LinePlot($values, LinePlot::MIDDLE); -$plot->setFillColor($blue); - -$plot->mark->setType(Mark::SQUARE); -$plot->mark->setSize(7); -$plot->mark->setFill(new Color(255, 255, 255)); -$plot->mark->border->show(); - -$group->add($plot); - -$graph->add($group); -$graph->draw(); -?> \ No newline at end of file diff --git a/artichow/examples/tutorials/smiley.png b/artichow/examples/tutorials/smiley.png deleted file mode 100644 index 454a82f..0000000 Binary files a/artichow/examples/tutorials/smiley.png and /dev/null differ diff --git a/artichow/font/Tuffy.ttf b/artichow/font/Tuffy.ttf deleted file mode 100644 index 8151817..0000000 Binary files a/artichow/font/Tuffy.ttf and /dev/null differ diff --git a/artichow/font/TuffyBold.ttf b/artichow/font/TuffyBold.ttf deleted file mode 100644 index 2f45b4f..0000000 Binary files a/artichow/font/TuffyBold.ttf and /dev/null differ diff --git a/artichow/font/TuffyBoldItalic.ttf b/artichow/font/TuffyBoldItalic.ttf deleted file mode 100644 index 554faf2..0000000 Binary files a/artichow/font/TuffyBoldItalic.ttf and /dev/null differ diff --git a/artichow/font/TuffyItalic.ttf b/artichow/font/TuffyItalic.ttf deleted file mode 100644 index 5f972ec..0000000 Binary files a/artichow/font/TuffyItalic.ttf and /dev/null differ diff --git a/artichow/images/book.png b/artichow/images/book.png deleted file mode 100644 index da18851..0000000 Binary files a/artichow/images/book.png and /dev/null differ diff --git a/artichow/images/error.png b/artichow/images/error.png deleted file mode 100644 index e5addb1..0000000 Binary files a/artichow/images/error.png and /dev/null differ diff --git a/artichow/images/errors/missing-anti-aliasing.png b/artichow/images/errors/missing-anti-aliasing.png deleted file mode 100644 index f020d26..0000000 Binary files a/artichow/images/errors/missing-anti-aliasing.png and /dev/null differ diff --git a/artichow/images/errors/missing-gd2.png b/artichow/images/errors/missing-gd2.png deleted file mode 100644 index cac144c..0000000 Binary files a/artichow/images/errors/missing-gd2.png and /dev/null differ diff --git a/artichow/images/paperclip.png b/artichow/images/paperclip.png deleted file mode 100644 index 12188f9..0000000 Binary files a/artichow/images/paperclip.png and /dev/null differ diff --git a/artichow/images/star.png b/artichow/images/star.png deleted file mode 100644 index 4acf003..0000000 Binary files a/artichow/images/star.png and /dev/null differ diff --git a/artichow/inc/Axis.class.php b/artichow/inc/Axis.class.php deleted file mode 100644 index cbb12b7..0000000 --- a/artichow/inc/Axis.class.php +++ /dev/null @@ -1,769 +0,0 @@ - 'toProportionalValue', - 'toPosition' => 'toProportionalPosition' - ); - - /** - * Build the axis - * - * @param float $min Begin of the range of the axis - * @param float $max End of the range of the axis - */ - public function __construct($min = NULL, $max = NULL) { - - $this->line = new awVector( - new awPoint(0, 0), - new awPoint(0, 0) - ); - - $this->label = new awLabel; - $this->padding = new awSide; - - $this->title = new awLabel( - NULL, - NULL, - NULL, - 0 - ); - - $this->setColor(new awBlack); - - if($min !== NULL and $max !== NULL) { - $this->setRange($min, $max); - } - - } - - /** - * Enable/disable auto-scaling mode - * - * @param bool $auto - */ - public function auto($auto) { - $this->auto = (bool)$auto; - } - - /** - * Get auto-scaling mode status - * - * @return bool - */ - public function isAuto() { - return $this->auto; - } - - /** - * Hide axis - * - * @param bool $hide - */ - public function hide($hide = TRUE) { - $this->hide = (bool)$hide; - } - - /** - * Show axis - * - * @param bool $show - */ - public function show($show = TRUE) { - $this->hide = !(bool)$show; - } - - /** - * Return a tick object from its name - * - * @param string $name Tick object name - * @return Tick - */ - public function tick($name) { - - return array_key_exists($name, $this->ticks) ? $this->ticks[$name] : NULL; - - } - - /** - * Add a tick object - * - * @param string $name Tick object name - * @param awTick $tick Tick object - */ - public function addTick($name, awTick $tick) { - - $this->ticks[$name] = $tick; - - } - - /** - * Delete a tick object - * - * @param string $name Tick object name - */ - public function deleteTick($name) { - if(array_key_exists($name, $this->ticks)) { - unset($this->ticks[$name]); - } - } - - /** - * Hide all ticks - * - * @param bool $hide Hide or not ? - */ - public function hideTicks($hide = TRUE) { - - foreach($this->ticks as $tick) { - $tick->hide($hide); - } - - } - - /** - * Change ticks style - * - * @param int $style Ticks style - */ - public function setTickStyle($style) { - - foreach($this->ticks as $tick) { - $tick->setStyle($style); - } - - } - - /** - * Change ticks interval - * - * @param int $interval Ticks interval - */ - public function setTickInterval($interval) { - - foreach($this->ticks as $tick) { - $tick->setInterval($interval); - } - - } - - /** - * Change number of ticks relative to others ticks - * - * @param awTick $to Change number of theses ticks - * @param awTick $from Ticks reference - * @param float $number Number of ticks by the reference - */ - public function setNumberByTick($to, $from, $number) { - $this->ticks[$to]->setNumberByTick($this->ticks[$from], $number); - } - - /** - * Reverse ticks style - */ - public function reverseTickStyle() { - - foreach($this->ticks as $tick) { - if($tick->getStyle() === awTick::IN) { - $tick->setStyle(awTick::OUT); - } else if($tick->getStyle() === awTick::OUT) { - $tick->setStyle(awTick::IN); - } - } - - } - - /** - * Change interval of labels - * - * @param int $interval Interval - */ - public function setLabelInterval($interval) { - $this->auto(FALSE); - $this->setTickInterval($interval); - $this->label->setInterval($interval); - } - - /** - * Change number of labels - * - * @param int $number Number of labels to display (can be NULL) - */ - public function setLabelNumber($number) { - $this->auto(FALSE); - $this->labelNumber = is_null($number) ? NULL : (int)$number; - } - - /** - * Get number of labels - * - * @return int - */ - public function getLabelNumber() { - return $this->labelNumber; - } - - /** - * Change precision of labels - * - * @param int $precision Precision - */ - public function setLabelPrecision($precision) { - $this->auto(FALSE); - $function = 'axis'.time().'_'.(microtime() * 1000000); - eval('function '.$function.'($value) { - return sprintf("%.'.(int)$precision.'f", $value); - }'); - $this->label->setCallbackFunction($function); - } - - /** - * Change text of labels - * - * @param array $texts Some texts - */ - public function setLabelText($texts) { - if(is_array($texts)) { - $this->auto(FALSE); - $function = 'axis'.time().'_'.(microtime() * 1000000); - eval('function '.$function.'($value) { - $texts = '.var_export($texts, TRUE).'; - return isset($texts[$value]) ? $texts[$value] : \'?\'; - }'); - $this->label->setCallbackFunction($function); - } - } - - /** - * Get the position of a point - * - * @param awAxis $xAxis X axis - * @param awAxis $yAxis Y axis - * @param awPoint $p Position of the point - * @return Point Position on the axis - */ - public static function toPosition(awAxis $xAxis, awAxis $yAxis, awPoint $p) { - - $p1 = $xAxis->getPointFromValue($p->x); - $p2 = $yAxis->getPointFromValue($p->y); - - return new awPoint( - round($p1->x), - round($p2->y) - ); - - } - - /** - * Change title alignment - * - * @param int $alignment New Alignment - */ - public function setTitleAlignment($alignment) { - - switch($alignment) { - - case awLabel::TOP : - $this->setTitlePosition(1); - $this->title->setAlign(NULL, awLabel::BOTTOM); - break; - - case awLabel::BOTTOM : - $this->setTitlePosition(0); - $this->title->setAlign(NULL, awLabel::TOP); - break; - - case awLabel::LEFT : - $this->setTitlePosition(0); - $this->title->setAlign(awLabel::LEFT); - break; - - case awLabel::RIGHT : - $this->setTitlePosition(1); - $this->title->setAlign(awLabel::RIGHT); - break; - - } - - } - - /** - * Change title position on the axis - * - * @param float $position A new awposition between 0 and 1 - */ - public function setTitlePosition($position) { - $this->titlePosition = (float)$position; - } - - /** - * Change axis and axis title color - * - * @param awColor $color - */ - public function setColor(awColor $color) { - $this->color = $color; - $this->title->setColor($color); - } - - /** - * Change axis padding - * - * @param int $left Left padding in pixels - * @param int $right Right padding in pixels - */ - public function setPadding($left, $right) { - $this->padding->set($left, $right); - } - - /** - * Get axis padding - * - * @return Side - */ - public function getPadding() { - return $this->padding; - } - - /** - * Change axis range - * - * @param float $min - * @param float $max - */ - public function setRange($min, $max) { - if($min !== NULL) { - $this->range[0] = (float)$min; - } - if($max !== NULL) { - $this->range[1] = (float)$max; - } - } - - /** - * Get axis range - * - * @return array - */ - public function getRange() { - return $this->range; - } - - /** - * Change axis range callback function - * - * @param string $toValue Transform a position between 0 and 1 to a value - * @param string $toPosition Transform a value to a position between 0 and 1 on the axis - */ - public function setRangeCallback($toValue, $toPosition) { - $this->rangeCallback = array( - 'toValue' => (string)$toValue, - 'toPosition' => (string)$toPosition - ); - } - - /** - * Center X values of the axis - * - * @param awAxis $axis An axis - * @param float $value The reference value on the axis - */ - public function setXCenter(awAxis $axis, $value) { - - // Check vector angle - if($this->line->isVertical() === FALSE) { - awImage::drawError("Class Axis: setXCenter() can only be used on vertical axes."); - } - - $p = $axis->getPointFromValue($value); - - $this->line->setX( - $p->x, - $p->x - ); - - } - - /** - * Center Y values of the axis - * - * @param awAxis $axis An axis - * @param float $value The reference value on the axis - */ - public function setYCenter(awAxis $axis, $value) { - - // Check vector angle - if($this->line->isHorizontal() === FALSE) { - awImage::drawError("Class Axis: setYCenter() can only be used on horizontal axes."); - } - - $p = $axis->getPointFromValue($value); - - $this->line->setY( - $p->y, - $p->y - ); - - } - - /** - * Get the distance between to values on the axis - * - * @param float $from The first value - * @param float $to The last value - * @return Point - */ - public function getDistance($from, $to) { - - $p1 = $this->getPointFromValue($from); - $p2 = $this->getPointFromValue($to); - - return $p1->getDistance($p2); - - } - - /** - * Get a point on the axis from a value - * - * @param float $value - * @return Point - */ - protected function getPointFromValue($value) { - - $callback = $this->rangeCallback['toPosition']; - - list($min, $max) = $this->range; - $position = $callback($value, $min, $max); - - return $this->getPointFromPosition($position); - - } - - /** - * Get a point on the axis from a position - * - * @param float $position A position between 0 and 1 - * @return Point - */ - protected function getPointFromPosition($position) { - - $vector = $this->getVector(); - - $angle = $vector->getAngle(); - $size = $vector->getSize(); - - return $vector->p1->move( - cos($angle) * $size * $position, - -1 * sin($angle) * $size * $position - ); - - } - - /** - * Draw axis - * - * @param awDriver $driver A driver - */ - public function draw(awDriver $driver) { - - if($this->hide) { - return; - } - - $vector = $this->getVector(); - - // Draw axis ticks - $this->drawTicks($driver, $vector); - - // Draw axis line - $this->line($driver); - - // Draw labels - $this->drawLabels($driver); - - // Draw axis title - $p = $this->getPointFromPosition($this->titlePosition); - $this->title->draw($driver, $p); - - } - - public function autoScale() { - - if($this->isAuto() === FALSE) { - return; - } - - list($min, $max) = $this->getRange(); - $interval = $max - $min; - - if($interval > 0) { - $partMax = $max / $interval; - $partMin = $min / $interval; - } else { - $partMax = 0; - $partMin = 0; - } - - $difference = log($interval) / log(10); - $difference = floor($difference); - - $pow = pow(10, $difference); - - if($pow > 0) { - $intervalNormalize = $interval / $pow; - } else { - $intervalNormalize = 0; - } - - if($difference <= 0) { - - $precision = $difference * -1 + 1; - - if($intervalNormalize > 2) { - $precision--; - } - - } else { - $precision = 0; - } - - if($min != 0 and $max != 0) { - $precision++; - } - - if($this->label->getCallbackFunction() === NULL) { - $this->setLabelPrecision($precision); - } - - if($intervalNormalize <= 1.5) { - $intervalReal = 1.5; - $labelNumber = 4; - } else if($intervalNormalize <= 2) { - $intervalReal = 2; - $labelNumber = 5; - } else if($intervalNormalize <= 3) { - $intervalReal = 3; - $labelNumber = 4; - } else if($intervalNormalize <= 4) { - $intervalReal = 4; - $labelNumber = 5; - } else if($intervalNormalize <= 5) { - $intervalReal = 5; - $labelNumber = 6; - } else if($intervalNormalize <= 8) { - $intervalReal = 8; - $labelNumber = 5; - } else if($intervalNormalize <= 10) { - $intervalReal = 10; - $labelNumber = 6; - } - - if($min == 0) { - - $this->setRange( - $min, - $intervalReal * $pow - ); - - } else if($max == 0) { - - $this->setRange( - $intervalReal * $pow * -1, - 0 - ); - - } - - $this->setLabelNumber($labelNumber); - - } - - protected function line(awDriver $driver) { - - $driver->line( - $this->color, - $this->line - ); - - } - - protected function drawTicks(awDriver $driver, awVector $vector) { - - foreach($this->ticks as $tick) { - $tick->setColor($this->color); - $tick->draw($driver, $vector); - } - - } - - protected function drawLabels($driver) { - - if($this->labelNumber !== NULL) { - list($min, $max) = $this->range; - $number = $this->labelNumber - 1; - if($number < 1) { - return; - } - $function = $this->rangeCallback['toValue']; - $labels = array(); - for($i = 0; $i <= $number; $i++) { - $labels[] = $function($i / $number, $min, $max); - } - $this->label->set($labels); - } - - $labels = $this->label->count(); - - for($i = 0; $i < $labels; $i++) { - - $p = $this->getPointFromValue($this->label->get($i)); - $this->label->draw($driver, $p, $i); - - } - - } - - protected function getVector() { - - $angle = $this->line->getAngle(); - - // Compute paddings - $vector = new awVector( - $this->line->p1->move( - cos($angle) * $this->padding->left, - -1 * sin($angle) * $this->padding->left - ), - $this->line->p2->move( - -1 * cos($angle) * $this->padding->right, - -1 * -1 * sin($angle) * $this->padding->right - ) - ); - - return $vector; - - } - - public function __clone() { - - $this->label = clone $this->label; - $this->line = clone $this->line; - $this->title = clone $this->title; - - foreach($this->ticks as $name => $tick) { - $this->ticks[$name] = clone $tick; - } - - } - -} - -registerClass('Axis'); - -function toProportionalValue($position, $min, $max) { - return $min + ($max - $min) * $position; -} - -function toProportionalPosition($value, $min, $max) { - if($max - $min == 0) { - return 0; - } - return ($value - $min) / ($max - $min); -} -?> \ No newline at end of file diff --git a/artichow/inc/Border.class.php b/artichow/inc/Border.class.php deleted file mode 100644 index 56182f0..0000000 --- a/artichow/inc/Border.class.php +++ /dev/null @@ -1,198 +0,0 @@ -setStyle($style); - - if($color instanceof awColor) { - $this->setColor($color); - } else { - $this->setColor(new awBlack); - } - - } - - /** - * Change border color - * This method automatically shows the border if it is hidden - * - * @param awColor $color - */ - public function setColor(awColor $color) { - $this->color = $color; - $this->show(); - } - - /** - * Change border style - * - * @param int $style - */ - public function setStyle($style) { - $this->style = (int)$style; - } - - /** - * Hide border ? - * - * @param bool $hide - */ - public function hide($hide = TRUE) { - $this->hide = (bool)$hide; - } - - /** - * Show border ? - * - * @param bool $show - */ - public function show($show = TRUE) { - $this->hide = (bool)!$show; - } - - /** - * Is the border visible ? - * - * @return bool - */ - public function visible() { - return !$this->hide; - } - - /** - * Draw border as a rectangle - * - * @param awDriver $driver - * @param awPoint $p1 Top-left corner - * @param awPoint $p2 Bottom-right corner - */ - public function rectangle(awDriver $driver, awPoint $p1, awPoint $p2) { - - // Border is hidden - if($this->hide) { - return; - } - - $line = new awLine; - $line->setStyle($this->style); - $line->setLocation($p1, $p2); - - $driver->rectangle($this->color, $line); - - } - - /** - * Draw border as an ellipse - * - * @param awDriver $driver - * @param awPoint $center Ellipse center - * @param int $width Ellipse width - * @param int $height Ellipse height - */ - public function ellipse(awDriver $driver, awPoint $center, $width, $height) { - - // Border is hidden - if($this->hide) { - return; - } - - switch($this->style) { - - case awLine::SOLID : - $driver->ellipse($this->color, $center, $width, $height); - break; - - default : - awImage::drawError("Class Border: Dashed and dotted borders and not yet implemented on ellipses."); - break; - - } - - - } - - /** - * Draw border as a polygon - * - * @param awDriver $driver A Driver object - * @param awPolygon $polygon A Polygon object - */ - public function polygon(awDriver $driver, awPolygon $polygon) { - - // Border is hidden - if($this->hide) { - return; - } - - $polygon->setStyle($this->style); - $driver->polygon($this->color, $polygon); - - // In case of Line::SOLID, Driver::polygon() uses imagepolygon() - // which automatically closes the shape. In any other case, - // we have to do it manually here. - if($this->style !== Line::SOLID) { - $this->closePolygon($driver, $polygon); - } - } - - /** - * Draws the last line of a Polygon, between the first and last point - * - * @param awDriver $driver A Driver object - * @param awPolygon $polygon The polygon object to close - */ - private function closePolygon(awDriver $driver, awPolygon $polygon) { - $first = $polygon->get(0); - $last = $polygon->get($polygon->count() - 1); - - $line = new awLine($first, $last, $this->style, $polygon->getThickness()); - $driver->line($this->color, $line); - } - -} - -registerClass('Border'); -?> \ No newline at end of file diff --git a/artichow/inc/Color.class.php b/artichow/inc/Color.class.php deleted file mode 100644 index f8a75f1..0000000 --- a/artichow/inc/Color.class.php +++ /dev/null @@ -1,165 +0,0 @@ -red = (int)$red; - $this->green = (int)$green; - $this->blue = (int)$blue; - $this->alpha = (int)round($alpha * 127 / 100); - - } - - /** - * Get RGB and alpha values of your color - * - * @return array - */ - public function getColor() { - return $this->rgba(); - } - - /** - * Change color brightness - * - * @param int $brightness Add this intensity to the color (betweeen -255 and +255) - */ - public function brightness($brightness) { - - $brightness = (int)$brightness; - - $this->red = min(255, max(0, $this->red + $brightness)); - $this->green = min(255, max(0, $this->green + $brightness)); - $this->blue = min(255, max(0, $this->blue + $brightness)); - - } - - /** - * Get RGB and alpha values of your color - * - * @return array - */ - public function rgba() { - - return array($this->red, $this->green, $this->blue, $this->alpha); - - } - -} - -registerClass('Color'); - -$colors = array( - 'Black' => array(0, 0, 0), - 'AlmostBlack' => array(48, 48, 48), - 'VeryDarkGray' => array(88, 88, 88), - 'DarkGray' => array(128, 128, 128), - 'MidGray' => array(160, 160, 160), - 'LightGray' => array(195, 195, 195), - 'VeryLightGray' => array(220, 220, 220), - 'White' => array(255, 255, 255), - 'VeryDarkRed' => array(64, 0, 0), - 'DarkRed' => array(128, 0, 0), - 'MidRed' => array(192, 0, 0), - 'Red' => array(255, 0, 0), - 'LightRed' => array(255, 192, 192), - 'VeryDarkGreen' => array(0, 64, 0), - 'DarkGreen' => array(0, 128, 0), - 'MidGreen' => array(0, 192, 0), - 'Green' => array(0, 255, 0), - 'LightGreen' => array(192, 255, 192), - 'VeryDarkBlue' => array(0, 0, 64), - 'DarkBlue' => array(0, 0, 128), - 'MidBlue' => array(0, 0, 192), - 'Blue' => array(0, 0, 255), - 'LightBlue' => array(192, 192, 255), - 'VeryDarkYellow' => array(64, 64, 0), - 'DarkYellow' => array(128, 128, 0), - 'MidYellow' => array(192, 192, 0), - 'Yellow' => array(255, 255, 2), - 'LightYellow' => array(255, 255, 192), - 'VeryDarkCyan' => array(0, 64, 64), - 'DarkCyan' => array(0, 128, 128), - 'MidCyan' => array(0, 192, 192), - 'Cyan' => array(0, 255, 255), - 'LightCyan' => array(192, 255, 255), - 'VeryDarkMagenta' => array(64, 0, 64), - 'DarkMagenta' => array(128, 0, 128), - 'MidMagenta' => array(192, 0, 192), - 'Magenta' => array(255, 0, 255), - 'LightMagenta' => array(255, 192, 255), - 'DarkOrange' => array(192, 88, 0), - 'Orange' => array(255, 128, 0), - 'LightOrange' => array(255, 168, 88), - 'VeryLightOrange' => array(255, 220, 168), - 'DarkPink' => array(192, 0, 88), - 'Pink' => array(255, 0, 128), - 'LightPink' => array(255, 88, 168), - 'VeryLightPink' => array(255, 168, 220), - 'DarkPurple' => array(88, 0, 192), - 'Purple' => array(128, 0, 255), - 'LightPurple' => array(168, 88, 255), - 'VeryLightPurple' => array(220, 168, 255), -); - - - -$php = ''; - -foreach($colors as $name => $color) { - - list($red, $green, $blue) = $color; - - $php .= ' - class aw'.$name.' extends awColor { - - public function __construct($alpha = 0) { - parent::__construct('.$red.', '.$green.', '.$blue.', $alpha); - } - - } - '; - - if(ARTICHOW_PREFIX !== 'aw') { - $php .= ' - class '.ARTICHOW_PREFIX.$name.' extends aw'.$name.' { - - } - '; - } - -} - -eval($php); - - - -?> diff --git a/artichow/inc/Driver.class.php b/artichow/inc/Driver.class.php deleted file mode 100644 index dfdd75f..0000000 --- a/artichow/inc/Driver.class.php +++ /dev/null @@ -1,725 +0,0 @@ -phpFontDriver = new awPHPFontDriver(); - $this->fileFontDriver = new awFileFontDriver(); - } - - /** - * Initialize the driver for a particular awImage object - * - * @param awImage $image - */ - abstract public function init(awImage $image); - - /** - * Initialize the Driver for a particular FileImage object - * - * @param awFileImage $fileImage The FileImage object to work on - * @param string $file Image filename - */ - abstract public function initFromFile(awFileImage $fileImage, $file); - - /** - * Change the image size - * - * @param int $width Image width - * @param int $height Image height - */ - abstract public function setImageSize($width, $height); - - /** - * Inform the driver of the position of your image - * - * @param float $x Position on X axis of the center of the component - * @param float $y Position on Y axis of the center of the component - */ - abstract public function setPosition($x, $y); - - /** - * Inform the driver of the position of your image - * This method need absolutes values - * - * @param int $x Left-top corner X position - * @param int $y Left-top corner Y position - */ - abstract public function setAbsPosition($x, $y); - - /** - * Move the position of the image - * - * @param int $x Add this value to X axis - * @param int $y Add this value to Y axis - */ - abstract public function movePosition($x, $y); - - /** - * Inform the driver of the size of your image - * Height and width must be between 0 and 1. - * - * @param int $w Image width - * @param int $h Image height - * @return array Absolute width and height of the image - */ - abstract public function setSize($w, $h); - - /** - * Inform the driver of the size of your image - * You can set absolute size with this method. - * - * @param int $w Image width - * @param int $h Image height - */ - abstract public function setAbsSize($w, $h); - - /** - * Get the size of the component handled by the driver - * - * @return array Absolute width and height of the component - */ - abstract public function getSize(); - - /** - * Turn antialiasing on or off - * - * @var bool $bool - */ - abstract public function setAntiAliasing($bool); - - /** - * When passed a Color object, returns the corresponding - * color identifier (driver dependant). - * - * @param awColor $color A Color object - * @return int $rgb A color identifier representing the color composed of the given RGB components - */ - abstract public function getColor(awColor $color); - - /** - * Draw an image here - * - * @param awImage $image Image - * @param int $p1 Image top-left point - * @param int $p2 Image bottom-right point - */ - abstract public function copyImage(awImage $image, awPoint $p1, awPoint $p2); - - /** - * Draw an image here - * - * @param awImage $image Image - * @param int $d1 Destination top-left position - * @param int $d2 Destination bottom-right position - * @param int $s1 Source top-left position - * @param int $s2 Source bottom-right position - * @param bool $resample Resample image ? (default to TRUE) - */ - abstract public function copyResizeImage(awImage $image, awPoint $d1, awPoint $d2, awPoint $s1, awPoint $s2, $resample = TRUE); - - /** - * Draw a string - * - * @var awText $text Text to print - * @param awPoint $point Draw the text at this point - * @param int $width Text max width - */ - abstract public function string(awText $text, awPoint $point, $width = NULL); - - /** - * Draw a pixel - * - * @param awColor $color Pixel color - * @param awPoint $p - */ - abstract public function point(awColor $color, awPoint $p); - - /** - * Draw a colored line - * - * @param awColor $color Line color - * @param awLine $line - * @param int $thickness Line tickness - */ - abstract public function line(awColor $color, awLine $line); - - /** - * Draw a color arc - - * @param awColor $color Arc color - * @param awPoint $center Point center - * @param int $width Ellipse width - * @param int $height Ellipse height - * @param int $from Start angle - * @param int $to End angle - */ - abstract public function arc(awColor $color, awPoint $center, $width, $height, $from, $to); - - /** - * Draw an arc with a background color - * - * @param awColor $color Arc background color - * @param awPoint $center Point center - * @param int $width Ellipse width - * @param int $height Ellipse height - * @param int $from Start angle - * @param int $to End angle - */ - abstract public function filledArc(awColor $color, awPoint $center, $width, $height, $from, $to); - - /** - * Draw a colored ellipse - * - * @param awColor $color Ellipse color - * @param awPoint $center Ellipse center - * @param int $width Ellipse width - * @param int $height Ellipse height - */ - abstract public function ellipse(awColor $color, awPoint $center, $width, $height); - - /** - * Draw an ellipse with a background - * - * @param mixed $background Background (can be a color or a gradient) - * @param awPoint $center Ellipse center - * @param int $width Ellipse width - * @param int $height Ellipse height - */ - abstract public function filledEllipse($background, awPoint $center, $width, $height); - - /** - * Draw a colored rectangle - * - * @param awColor $color Rectangle color - * @param awLine $line Rectangle diagonale - * @param awPoint $p2 - */ - abstract public function rectangle(awColor $color, awLine $line); - - /** - * Draw a rectangle with a background - * - * @param mixed $background Background (can be a color or a gradient) - * @param awLine $line Rectangle diagonale - */ - abstract public function filledRectangle($background, awLine $line); - - /** - * Draw a polygon - * - * @param awColor $color Polygon color - * @param Polygon A polygon - */ - abstract public function polygon(awColor $color, awPolygon $polygon); - - /** - * Draw a polygon with a background - * - * @param mixed $background Background (can be a color or a gradient) - * @param Polygon A polygon - */ - abstract public function filledPolygon($background, awPolygon $polygon); - - /** - * Sends the image, as well as the correct HTTP headers, to the browser - * - * @param awImage $image The Image object to send - */ - abstract public function send(awImage $image); - - /** - * Get the image as binary data - * - * @param awImage $image - */ - abstract public function get(awImage $image); - - /** - * Return the width of some text - * - * @param awText $text - */ - abstract public function getTextWidth(awText $text); - - /** - * Return the height of some text - * - * @param awText $text - */ - abstract public function getTextHeight(awText $text); - - /** - * Return the string representing the type of driver - * - * @return string - */ - public function getDriverString() { - return $this->driverString; - } - - /** - * Returns whether or not the driver is compatible with the given font type - * - * @param awFont $font - * @return bool - */ - abstract protected function isCompatibleWithFont(awFont $font); - -// abstract private function drawImage(awImage $image, $return = FALSE, $header = TRUE); - -} - -registerClass('Driver', TRUE); - -/** - * Abstract class for font drivers. - * Those are used to do all the grunt work on fonts. - * - * @package Artichow - */ - -abstract class awFontDriver { - - public function __construct() { - - } - - /** - * Draw the actual text. - * - * @param awDriver $driver The Driver object to draw upon - * @param awText $text The Text object - * @param awPoint $point Where to draw the text - * @param float $width The width of the area containing the text - */ - abstract public function string(awDriver $driver, awText $text, awPoint $point, $width = NULL); - - /** - * Calculate the width of a given Text. - * - * @param awText $text The Text object - * @param awDriver $driver The awDriver object used to draw the graph - */ - abstract public function getTextWidth(awText $text, awDriver $driver); - - /** - * Calculate the height of a given Text. - * - * @param awText $text The Text object - * @param awDriver $driver The awDriver object used to draw the graph - */ - abstract public function getTextHeight(awText $text, awDriver $driver); - -} - -registerClass('FontDriver', TRUE); - -/** - * Class to handle calculations on PHPFont objects - * - * @package Artichow - */ -class awPHPFontDriver extends awFontDriver { - - public function __construct() { - parent::__construct(); - } - - public function string(awDriver $driver, awText $text, awPoint $point, $width = NULL) { - - switch ($driver->getDriverString()) { - case 'gd': - $this->gdString($driver, $text, $point, $width); - break; - - default: - awImage::drawError('Class PHPFontDriver: Incompatibility between driver and font - You should never see this error message: have you called awDriver::isCompatibleWithFont() properly?'); - break; - - } - } - - /** - * Draw a string onto a GDDriver object - * - * @param awGDDriver $driver The GDDriver to draw the text upon - * @param awText $text The awText object containing the string to draw - * @param awPoint $point Where to draw the text - * @param float $width The width of the text - */ - private function gdString(awGDDriver $driver, awText $text, awPoint $point, $width = NULL) { - - $angle = $text->getAngle(); - if($angle !== 90 and $angle !== 0) { - awImage::drawError("Class PHPFontDriver: You can only use 0° and 90° angles."); - } - - if($angle === 90) { - $function = 'imagestringup'; - $addAngle = $this->getGDTextHeight($text); - } else { - $function = 'imagestring'; - $addAngle = 0; - } - - $color = $text->getColor(); - $rgb = $driver->getColor($color); - - $textString = $text->getText(); - $textString = str_replace("\r", "", $textString); - - $textHeight = $this->getGDTextHeight($text); - - // Split text if needed - if($width !== NULL) { - - $characters = floor($width / ($this->getGDTextWidth($text) / strlen($textString))); - - if($characters > 0) { - $textString = wordwrap($textString, $characters, "\n", TRUE); - } - - } - - $font = $text->getFont(); - $lines = explode("\n", $textString); - - foreach($lines as $i => $line) { - - // Line position handling - if($angle === 90) { - $addX = $i * $textHeight; - $addY = 0; - } else { - $addX = 0; - $addY = $i * $textHeight; - } - - $function( - $driver->resource, - $font->font, - $driver->x + $point->x + $addX, - $driver->y + $point->y + $addY + $addAngle, - $line, - $rgb - ); - - } - } - - public function getTextWidth(awText $text, awDriver $driver) { - - switch ($driver->getDriverString()) { - case 'gd': - return $this->getGDTextWidth($text); - - default: - awImage::drawError('Class PHPFontDriver: Cannot get text width - incompatibility between driver and font'); - break; - } - - } - - public function getTextHeight(awText $text, awDriver $driver) { - - switch ($driver->getDriverString()) { - case 'gd': - return $this->getGDTextHeight($text); - - default: - awImage::drawError('Class PHPFontDriver: Cannot get text height - incompatibility between driver and font'); - break; - } - - } - - /** - * Return the width of a text for a GDDriver - * - * @param awText $text - * @return int $fontWidth - */ - private function getGDTextWidth(awText $text) { - $font = $text->getFont(); - - if($text->getAngle() === 90) { - $text->setAngle(45); - return $this->getGDTextHeight($text); - } else if($text->getAngle() === 45) { - $text->setAngle(90); - } - - $fontWidth = imagefontwidth($font->font); - - if($fontWidth === FALSE) { - awImage::drawError("Class PHPFontDriver: Unable to get font size."); - } - - return (int)$fontWidth * strlen($text->getText()); - } - - /** - * Return the height of a text for a GDDriver - * - * @param awText $text - * @return int $fontHeight - */ - private function getGDTextHeight(awText $text) { - $font = $text->getFont(); - - if($text->getAngle() === 90) { - $text->setAngle(45); - return $this->getGDTextWidth($text); - } else if($text->getAngle() === 45) { - $text->setAngle(90); - } - - $fontHeight = imagefontheight($font->font); - - if($fontHeight === FALSE) { - awImage::drawError("Class PHPFontDriver: Unable to get font size."); - } - - return (int)$fontHeight; - } -} - -registerClass('PHPFontDriver'); - -/** - * Class to handle calculations on FileFont objects - * - * @package Artichow - */ -class awFileFontDriver extends awFontDriver { - - public function __construct() { - parent::__construct(); - } - - public function string(awDriver $driver, awText $text, awPoint $point, $width = NULL) { - - switch ($driver->getDriverString()) { - case 'gd': - $this->gdString($driver, $text, $point, $width); - break; - - default: - awImage::drawError('Class fileFontDriver: Incompatibility between driver and font - You should never see this error message: have you called awDriver::isCompatibleWithFont() properly?'); - break; - } - } - - /** - * Draw an awFileFont object on a GD ressource - * - * @param awGDDriver $driver The awGDDriver object containing the ressource to draw upon - * @param awText $text The awText object containing the string to draw - * @param awPoint $point Where to draw the string from - * @param float $width The width of the area containing the text - */ - private function gdString(awGDDriver $driver, awText $text, awPoint $point, $width = NULL) { - // Make easier font positionment - $text->setText($text->getText()." "); - - $font = $text->getFont(); - if($font instanceof awTTFFont === FALSE and $font->getExtension() === NULL) { - $font->setExtension('ttf'); - } - - $filePath = $font->getName().'.'.$font->getExtension(); - - $box = imagettfbbox($font->getSize(), $text->getAngle(), $filePath, $text->getText()); - $textHeight = - $box[5]; - - $box = imagettfbbox($font->getSize(), 90, $filePath, $text->getText()); - $textWidth = abs($box[6] - $box[2]); - - // Restore old text - $text->setText(substr($text->getText(), 0, strlen($text->getText()) - 1)); - - $textString = $text->getText(); - - // Split text if needed - if($width !== NULL) { - - $characters = floor($width / $this->getGDAverageWidth($font)); - $textString = wordwrap($textString, $characters, "\n", TRUE); - - } - - $color = $text->getColor(); - $rgb = $driver->getColor($color); - - imagettftext( - $driver->resource, - $font->getSize(), - $text->getAngle(), - $driver->x + $point->x + $textWidth * sin($text->getAngle() / 180 * M_PI), - $driver->y + $point->y + $textHeight, - $rgb, - $filePath, - $textString - ); - } - - public function getTextWidth(awText $text, awDriver $driver) { - switch ($driver->getDriverString()) { - case 'gd': - return $this->getGDTextWidth($text); - - default: - awImage::drawError('Class FileFontDriver: Cannot get text width - incompatibility between driver and font'); - break; - } - } - - public function getTextHeight(awText $text, awDriver $driver) { - switch ($driver->getDriverString()) { - case 'gd': - return $this->getGDTextHeight($text); - - default: - awImage::drawError('Class FileFontDriver: Cannot get text height - incompatibility between driver and font'); - break; - } - } - - private function getGDTextWidth(awText $text) { - $font = $text->getFont(); - if($font->getExtension() === NULL) { - $font->setExtension('ttf'); - } - - $filePath = $font->getName().'.'.$font->getExtension(); - - $box = imagettfbbox($font->getSize(), $text->getAngle(), $filePath, $text->getText()); - - if($box === FALSE) { - awImage::drawError("Class FileFontDriver: Unable to get font width (GD)."); - } - - list(, , $x2, , , , $x1, ) = $box; - - return abs($x2 - $x1); - } - - private function getGDTextHeight(awText $text) { - $font = $text->getFont(); - if($font->getExtension() === NULL) { - $font->setExtension('ttf'); - } - - $filePath = $font->getName().'.'.$font->getExtension(); - - $box = imagettfbbox($font->getSize(), $text->getAngle(), $filePath, $text->getText()); - - if($box === FALSE) { - awImage::drawError("Class FileFontDriver: Unable to get font height (GD)."); - } - - list(, , , $y2, , , , $y1) = $box; - - return abs($y2 - $y1); - } - - private function getGDAverageWidth(awFileFont $font) { - - $text = "azertyuiopqsdfghjklmmmmmmmwxcvbbbn,;:!?."; - - $box = imagettfbbox($font->getSize(), 0, $font->getName().'.'.$font->getExtension(), $text); - - if($box === FALSE) { - awImage::drawError("Class FileFontDriver: Unable to get font average width."); - } - - list(, , $x2, $y2, , , $x1, $y1) = $box; - - return abs($x2 - $x1) / strlen($text); - - } - -} - -registerClass('FileFontDriver'); - -// Include ARTICHOW_DRIVER by default to preserve backward compatibility. -require_once dirname(__FILE__).'/drivers/'.ARTICHOW_DRIVER.'.class.php'; - -?> \ No newline at end of file diff --git a/artichow/inc/Font.class.php b/artichow/inc/Font.class.php deleted file mode 100644 index 50db8f6..0000000 --- a/artichow/inc/Font.class.php +++ /dev/null @@ -1,263 +0,0 @@ -string($this, $text, $point, $width); - - } - -} - -registerClass('Font', TRUE); - -/** - * Class for fonts that cannot be transformed, - * like the built-in PHP fonts for example. - * - * @package Artichow - */ -class awPHPFont extends awFont { - - /** - * The used font identifier - * - * @var int - */ - public $font; - - public function __construct($font = NULL) { - parent::__construct(); - - if($font !== NULL) { - $this->font = (int)$font; - } - } - -} - -registerClass('PHPFont'); - -/** - * Class for fonts that can be transformed (rotated, skewed, etc.), - * like TTF or FDB fonts for example. - * - * @package Artichow - */ -class awFileFont extends awFont { - - /** - * The name of the font, without the extension - * - * @var string - */ - protected $name; - - /** - * The size of the font - * - * @var int - */ - protected $size; - - /** - * The font filename extension - * - * @var string - */ - protected $extension; - - public function __construct($name, $size) { - parent::__construct(); - - $this->setName($name); - $this->setSize($size); - } - - /** - * Set the name of the font. The $name variable can contain the full path, - * or just the filename. Artichow will try to do The Right Thing, - * as well as set the extension property correctly if possible. - * - * @param string $name - */ - public function setName($name) { - $fontInfo = pathinfo((string)$name); - - if(strpos($fontInfo['dirname'], '/') !== 0) { - // Path is not absolute, use ARTICHOW_FONT - $name = ARTICHOW_FONT.DIRECTORY_SEPARATOR.$fontInfo['basename']; - $fontInfo = pathinfo($name); - } - - $this->name = $fontInfo['dirname'].DIRECTORY_SEPARATOR.$fontInfo['basename']; - - if(array_key_exists('extension', $fontInfo) and $fontInfo['extension'] !== '') { - $this->setExtension($fontInfo['extension']); - } - } - - /** - * Return the name of the font, i.e. the absolute path and the filename, without the extension. - * - * @return string - */ - public function getName() { - return $this->name; - } - - /** - * Set the size of the font, in pixels - * - * @param int $size - */ - public function setSize($size) { - $this->size = (int)$size; - } - - /** - * Return the size of the font, in pixels - * - * @return int - */ - public function getSize() { - return $this->size; - } - - /** - * Set the extension, without the dot - * - * @param string $extension - */ - public function setExtension($extension) { - $this->extension = (string)$extension; - } - - /** - * Get the filename extension for that font - * - * @return string - */ - public function getExtension() { - return $this->extension; - } - -} - -registerClass('FileFont'); - -/** - * Class representing TTF fonts - * - * @package Artichow - */ -class awTTFFont extends awFileFont { - - public function __construct($name, $size) { - parent::__construct($name, $size); - - if($this->getExtension() === NULL) { - $this->setExtension('ttf'); - } - } - -} - -registerClass('TTFFont'); - - - -$php = ''; - -for($i = 1; $i <= 5; $i++) { - - $php .= ' - class awFont'.$i.' extends awPHPFont { - - public function __construct() { - parent::__construct('.$i.'); - } - - } - '; - - if(ARTICHOW_PREFIX !== 'aw') { - $php .= ' - class '.ARTICHOW_PREFIX.'Font'.$i.' extends awFont'.$i.' { - } - '; - } - -} - -eval($php); - -$php = ''; - -foreach($fonts as $font) { - - $php .= ' - class aw'.$font.' extends awFileFont { - - public function __construct($size) { - parent::__construct(\''.$font.'\', $size); - } - - } - '; - - if(ARTICHOW_PREFIX !== 'aw') { - $php .= ' - class '.ARTICHOW_PREFIX.$font.' extends aw'.$font.' { - } - '; - } - -} - -eval($php); - - - -/* - * Environment modification for GD2 and TTF fonts - */ -if(function_exists('putenv')) { - putenv('GDFONTPATH='.ARTICHOW_FONT); -} - -?> \ No newline at end of file diff --git a/artichow/inc/Gradient.class.php b/artichow/inc/Gradient.class.php deleted file mode 100644 index b6e1855..0000000 --- a/artichow/inc/Gradient.class.php +++ /dev/null @@ -1,135 +0,0 @@ -from = $from; - $this->to = $to; - - } - -} - -registerClass('Gradient', TRUE); - - -/** - * Create a linear gradient - * - * @package Artichow - */ -class awLinearGradient extends awGradient { - - /** - * Gradient angle - * - * @var int - */ - public $angle; - - /** - * Build the linear gradient - * - * @param awColor $from From color - * @param awColor $to To color - * @param int $angle Gradient angle - */ - public function __construct($from, $to, $angle) { - - parent::__construct( - $from, $to - ); - - $this->angle = (int)$angle; - - } - -} - -registerClass('LinearGradient'); - - -/** - * Create a bilinear gradient - * - * @package Artichow - */ -class awBilinearGradient extends awLinearGradient { - - /** - * Gradient center - * - * @var float Center between 0 and 1 - */ - public $center; - - /** - * Build the bilinear gradient - * - * @param awColor $from From color - * @param awColor $to To color - * @param int $angle Gradient angle - * @param int $center Gradient center - */ - public function __construct($from, $to, $angle, $center = 0.5) { - - parent::__construct( - $from, $to, $angle - ); - - $this->center = (float)$center; - - } - -} - -registerClass('BilinearGradient'); - -/** - * Create a radial gradient - * - * @package Artichow - */ -class awRadialGradient extends awGradient { - -} - -registerClass('RadialGradient'); -?> diff --git a/artichow/inc/Grid.class.php b/artichow/inc/Grid.class.php deleted file mode 100644 index 1e8152c..0000000 --- a/artichow/inc/Grid.class.php +++ /dev/null @@ -1,291 +0,0 @@ -color = new awColor(210, 210, 210); - $this->background = new awColor(255, 255, 255, 100); - - } - - /** - * Hide grid ? - * - * @param bool $hide - */ - public function hide($hide = TRUE) { - $this->hide = (bool)$hide; - } - - /** - * Hide horizontal lines ? - * - * @param bool $hideHorizontal - */ - public function hideHorizontal($hide = TRUE) { - $this->hideHorizontal = (bool)$hide; - } - - /** - * Hide vertical lines ? - * - * @param bool $hideVertical - */ - public function hideVertical($hide = TRUE) { - $this->hideVertical = (bool)$hide; - } - - /** - * Change grid color - * - * @param awColor $color - */ - public function setColor(awColor $color) { - $this->color = $color; - } - - /** - * Remove grid background - */ - public function setNoBackground() { - $this->background = NULL; - } - - /** - * Change grid background color - * - * @param awColor $color - */ - public function setBackgroundColor(awColor $color) { - $this->background = $color; - } - - /** - * Change line type - * - * @param int $type - */ - public function setType($type) { - $this->type = (int)$type; - } - - /** - * Change grid interval - * - * @param int $hInterval - * @param int $vInterval - */ - public function setInterval($hInterval, $vInterval) { - $this->interval = array((int)$hInterval, (int)$vInterval); - } - - /** - * Set grid space - * - * @param int $left Left space in pixels - * @param int $right Right space in pixels - * @param int $top Top space in pixels - * @param int $bottom Bottom space in pixels - */ - public function setSpace($left, $right, $top, $bottom) { - $this->space = array((int)$left, (int)$right, (int)$top, (int)$bottom); - } - - /** - * Change the current grid - * - * @param array $xgrid Vertical lines - * @param array $ygrid Horizontal lines - */ - public function setGrid($xgrid, $ygrid) { - - if(empty($this->xgrid)) { - $this->xgrid = $xgrid; - } - if(empty($this->ygrid)) { - $this->ygrid = $ygrid; - } - - } - - /** - * Draw grids - * - * @param awDriver $driver A driver object - * @param int $x1 - * @param int $y1 - * @param int $x2 - * @param int $y2 - */ - public function draw(awDriver $driver, $x1, $y1, $x2, $y2) { - - if($this->background instanceof awColor) { - - // Draw background color - $driver->filledRectangle( - $this->background, - awLine::build($x1, $y1, $x2, $y2) - ); - - } - - if($this->hide === FALSE) { - - $this->drawGrid( - $driver, - $this->color, - $this->hideVertical ? array() : $this->xgrid, - $this->hideHorizontal ? array() : $this->ygrid, - $x1, $y1, $x2, $y2, - $this->type, - $this->space, - $this->interval[0], - $this->interval[1] - ); - - } - - } - - private function drawGrid( - awDriver $driver, awColor $color, - $nx, $ny, $x1, $y1, $x2, $y2, - $type, $space, $hInterval, $vInterval - ) { - - list($left, $right, $top, $bottom) = $space; - - $width = $x2 - $x1 - $left - $right; - $height = $y2 - $y1 - $top - $bottom; - - foreach($nx as $key => $n) { - - if(($key % $vInterval) === 0) { - - $pos = (int)round($x1 + $left + $n * $width); - $driver->line( - $color, - new awLine( - new awPoint($pos, $y1), - new awPoint($pos, $y2), - $type - ) - ); - - } - - } - - foreach($ny as $key => $n) { - - if(($key % $hInterval) === 0) { - - $pos = (int)round($y1 + $top + $n * $height); - $driver->line( - $color, - new awLine( - new awPoint($x1, $pos), - new awPoint($x2, $pos), - $type - ) - ); - - } - - } - - } - -} - -registerClass('Grid'); -?> \ No newline at end of file diff --git a/artichow/inc/Label.class.php b/artichow/inc/Label.class.php deleted file mode 100644 index 169f106..0000000 --- a/artichow/inc/Label.class.php +++ /dev/null @@ -1,588 +0,0 @@ -set($label); - } else if(is_string($label)) { - $this->set(array($label)); - } - - if($font === NULL) { - $font = new awFont2; - } - - $this->setFont($font); - $this->setAngle($angle); - - if($color instanceof awColor) { - $this->setColor($color); - } else { - $this->setColor(new awColor(0, 0, 0)); - } - - $this->move = new awPoint(0, 0); - - $this->border = new awBorder; - $this->border->hide(); - - } - - /** - * Get an element of the label from its key - * - * @param int $key Element key - * @return string A value - */ - public function get($key) { - return array_key_exists($key, $this->texts) ? $this->texts[$key] : NULL; - } - - /** - * Get all labels - * - * @return array - */ - public function all() { - return $this->texts; - } - - /** - * Set one or several labels - * - * @param array $labels Array of string or a string - */ - public function set($labels) { - - if(is_array($labels)) { - $this->texts = $labels; - } else { - $this->texts = array((string)$labels); - } - - } - - /** - * Count number of texts in the label - * - * @return int - */ - public function count() { - return is_array($this->texts) ? count($this->texts) : 0; - } - - /** - * Set a callback function for labels - * - * @param string $function - */ - public function setCallbackFunction($function) { - $this->function = is_null($function) ? $function : (string)$function; - } - - /** - * Return the callback function for labels - * - * @return string - */ - public function getCallbackFunction() { - return $this->function; - } - - /** - * Change labels format - * - * @param string $format New format (printf style: %.2f for example) - */ - public function setFormat($format) { - $function = 'label'.time().'_'.(microtime() * 1000000); - eval('function '.$function.'($value) { - return sprintf("'.addcslashes($format, '"').'", $value); - }'); - $this->setCallbackFunction($function); - } - - /** - * Change font for label - * - * @param awFont $font New font - * @param awColor $color Font color (can be NULL) - */ - public function setFont(awFont $font, $color = NULL) { - $this->font = $font; - if($color instanceof awColor) { - $this->setColor($color); - } - } - - /** - * Change font angle - * - * @param int $angle New angle - */ - public function setAngle($angle) { - $this->angle = (int)$angle; - } - - /** - * Change font color - * - * @param awColor $color - */ - public function setColor(awColor $color) { - $this->color = $color; - } - - /** - * Change text background - * - * @param mixed $background - */ - public function setBackground($background) { - $this->background = $background; - } - - /** - * Change text background color - * - * @param Color - */ - public function setBackgroundColor(awColor $color) { - $this->background = $color; - } - - /** - * Change text background gradient - * - * @param Gradient - */ - public function setBackgroundGradient(awGradient $gradient) { - $this->background = $gradient; - } - - /** - * Change padding - * - * @param int $left Left padding - * @param int $right Right padding - * @param int $top Top padding - * @param int $bottom Bottom padding - */ - public function setPadding($left, $right, $top, $bottom) { - $this->padding = array((int)$left, (int)$right, (int)$top, (int)$bottom); - } - - /** - * Hide all labels ? - * - * @param bool $hide - */ - public function hide($hide = TRUE) { - $this->hide = (bool)$hide; - } - - /** - * Show all labels ? - * - * @param bool $show - */ - public function show($show = TRUE) { - $this->hide = (bool)!$show; - } - - /** - * Hide a key - * - * @param int $key The key to hide - */ - public function hideKey($key) { - $this->hideKey[$key] = TRUE; - } - - /** - * Hide a value - * - * @param int $value The value to hide - */ - public function hideValue($value) { - $this->hideValue[] = $value; - } - - /** - * Hide first label - * - * @param bool $hide - */ - public function hideFirst($hide) { - $this->hideFirst = (bool)$hide; - } - - /** - * Hide last label - * - * @param bool $hide - */ - public function hideLast($hide) { - $this->hideLast = (bool)$hide; - } - - /** - * Set label interval - * - * @param int - */ - public function setInterval($interval) { - - $this->interval = (int)$interval; - - } - - /** - * Change label position - * - * @param int $x Add this interval to X coord - * @param int $y Add this interval to Y coord - */ - public function move($x, $y) { - - $this->move = $this->move->move($x, $y); - - } - - /** - * Change alignment - * - * @param int $h Horizontal alignment - * @param int $v Vertical alignment - */ - public function setAlign($h = NULL, $v = NULL) { - if($h !== NULL) { - $this->hAlign = (int)$h; - } - if($v !== NULL) { - $this->vAlign = (int)$v; - } - } - - /** - * Get a text from the labele - * - * @param mixed $key Key in the array text - * @return Text - */ - public function getText($key) { - - if(is_array($this->texts) and array_key_exists($key, $this->texts)) { - - $value = $this->texts[$key]; - - if(is_string($this->function)) { - $value = call_user_func($this->function, $value); - } - - $text = new awText($value); - $text->setFont($this->font); - $text->setAngle($this->angle); - $text->setColor($this->color); - - if($this->background instanceof awColor) { - $text->setBackgroundColor($this->background); - } else if($this->background instanceof awGradient) { - $text->setBackgroundGradient($this->background); - } - - $text->border = $this->border; - - if($this->padding !== NULL) { - call_user_func_array(array($text, 'setPadding'), $this->padding); - } - - return $text; - - } else { - return NULL; - } - - } - - /** - * Get max width of all texts - * - * @param awDriver $driver A driver - * @return int - */ - public function getMaxWidth(awDriver $driver) { - - return $this->getMax($driver, 'getTextWidth'); - - } - - /** - * Get max height of all texts - * - * @param awDriver $driver A driver - * @return int - */ - public function getMaxHeight(awDriver $driver) { - - return $this->getMax($driver, 'getTextHeight'); - - } - - /** - * Draw the label - * - * @param awDriver $driver - * @param awPoint $p Label center - * @param int $key Text position in the array of texts (default to zero) - */ - public function draw(awDriver $driver, awPoint $p, $key = 0) { - - if(($key % $this->interval) !== 0) { - return; - } - - // Hide all labels - if($this->hide) { - return; - } - - // Key is hidden - if(array_key_exists($key, $this->hideKey)) { - return; - } - - // Hide first label - if($key === 0 and $this->hideFirst) { - return; - } - - // Hide last label - if($key === count($this->texts) - 1 and $this->hideLast) { - return; - } - - $text = $this->getText($key); - - if($text !== NULL) { - - // Value must be hidden - if(in_array($text->getText(), $this->hideValue)) { - return; - } - - $x = $p->x; - $y = $p->y; - - // Get padding - list($left, $right, $top, $bottom) = $text->getPadding(); - -// $font = $text->getFont(); - $width = $driver->getTextWidth($text); - $height = $driver->getTextHeight($text); - - switch($this->hAlign) { - - case awLabel::RIGHT : - $x -= ($width + $right); - break; - - case awLabel::CENTER : - $x -= ($width - $left + $right) / 2; - break; - - case awLabel::LEFT : - $x += $left; - break; - - } - - switch($this->vAlign) { - - case awLabel::TOP : - $y -= ($height + $bottom); - break; - - case awLabel::MIDDLE : - $y -= ($height - $top + $bottom) / 2; - break; - - case awLabel::BOTTOM : - $y += $top; - break; - - } - - $driver->string($text, $this->move->move($x, $y)); - - } - - } - - protected function getMax(awDriver $driver, $function) { - - $max = NULL; - - foreach($this->texts as $key => $text) { - - $text = $this->getText($key); - $font = $text->getFont(); - - if(is_null($max)) { - $max = $font->{$function}($text); - } else { - $max = max($max, $font->{$function}($text)); - } - - } - - return $max; - - } - -} - -registerClass('Label'); -?> \ No newline at end of file diff --git a/artichow/inc/Legend.class.php b/artichow/inc/Legend.class.php deleted file mode 100644 index c7e26a5..0000000 --- a/artichow/inc/Legend.class.php +++ /dev/null @@ -1,710 +0,0 @@ -shadow = new awShadow(awShadow::LEFT_BOTTOM); - $this->border = new awBorder; - - $this->textMargin = new awSide(4); - $this->setModel($model); - - } - - /** - * Set a predefined model for the legend - * - * @param int $model - */ - public function setModel($model) { - - $this->setBackgroundColor(new awColor(255, 255, 255, 15)); - $this->setPadding(8, 8, 8, 8); - $this->setTextFont(new awFont2); - $this->shadow->setSize(3); - - switch($model) { - - case awLegend::MODEL_RIGHT : - - $this->setColumns(1); - $this->setAlign(awLegend::RIGHT, awLegend::MIDDLE); - $this->setPosition(0.96, 0.50); - - break; - - case awLegend::MODEL_BOTTOM : - - $this->setRows(1); - $this->setAlign(awLegend::CENTER, awLegend::TOP); - $this->setPosition(0.50, 0.92); - - break; - - default : - - $this->setPosition(0.5, 0.5); - - break; - - } - - } - - /** - * Hide legend ? - * - * @param bool $hide TRUE to hide legend, FALSE otherwise - */ - public function hide($hide = TRUE) { - $this->hide = (bool)$hide; - } - - /** - * Show legend ? - * - * @param bool $show - */ - public function show($show = TRUE) { - $this->hide = (bool)!$show; - } - - - /** - * Add a Legendable object to the legend - * - * @param awLegendable $legendable - * @param string $title Legend title - * @param int $type Legend type (default to awLegend::LINE) - */ - public function add(awLegendable $legendable, $title, $type = awLegend::LINE) { - - $legend = array($legendable, $title, $type); - - $this->legends[] = $legend; - - } - - /** - * Change legend padding - * - * @param int $left - * @param int $right - * @param int $top - * @param int $bottom - */ - public function setPadding($left, $right, $top, $bottom) { - $this->padding = array((int)$left, (int)$right, (int)$top, (int)$bottom); - } - - /** - * Change space between each legend - * - * @param int $space - */ - public function setSpace($space) { - $this->space = (int)$space; - } - - /** - * Change alignment - * - * @param int $h Horizontal alignment - * @param int $v Vertical alignment - */ - public function setAlign($h = NULL, $v = NULL) { - if($h !== NULL) { - $this->hAlign = (int)$h; - } - if($v !== NULL) { - $this->vAlign = (int)$v; - } - } - - /** - * Change number of columns - * - * @param int $columns - */ - public function setColumns($columns) { - $this->rows = NULL; - $this->columns = (int)$columns; - } - - /** - * Change number of rows - * - * @param int $rows - */ - public function setRows($rows) { - $this->columns = NULL; - $this->rows = (int)$rows; - } - - /** - * Change legend position - * X and Y positions must be between 0 and 1. - * - * @param float $x - * @param float $y - */ - public function setPosition($x = NULL, $y = NULL) { - $x = (is_null($x) and !is_null($this->position)) ? $this->position->x : $x; - $y = (is_null($y) and !is_null($this->position)) ? $this->position->y : $y; - - $this->position = new awPoint($x, $y); - } - - /** - * Get legend position - * - * @return Point - */ - public function getPosition() { - return $this->position; - } - - /** - * Change text font - * - * @param awFont $font - */ - public function setTextFont(awFont $font) { - $this->textFont = $font; - } - - /** - * Change text margin - * - * @param int $left - * @param int $right - */ - public function setTextMargin($left, $right) { - $this->textMargin->set($left, $right); - } - - /** - * Change text color - * - * @param awColor $color - */ - public function setTextColor(awColor $color) { - $this->textColor = $color; - } - - /** - * Change background - * - * @param mixed $background - */ - public function setBackground($background) { - $this->background = $background; - } - - /** - * Change background color - * - * @param awColor $color - */ - public function setBackgroundColor(awColor $color) { - $this->background = $color; - } - - /** - * Change background gradient - * - * @param awGradient $gradient - */ - public function setBackgroundGradient(awGradient $gradient) { - $this->background = $gradient; - } - - /** - * Count the number of Legendable objects in the legend - * - * @return int - */ - public function count() { - return count($this->legends); - } - - public function draw(awDriver $driver) { - - if($this->hide) { - return; - } - - $count = $this->count(); - - // No legend to print - if($count === 0) { - return; - } - - // Get text widths and heights of each element of the legend - $widths = array(); - $heights = array(); - $texts = array(); - for($i = 0; $i < $count; $i++) { - list(, $title, ) = $this->legends[$i]; - $text = new awText( - $title, - $this->textFont, - $this->textColor, - 0 - ); -// $font = $text->getFont(); - $widths[$i] = $driver->getTextWidth($text) + $this->textMargin->left + $this->textMargin->right; - $heights[$i] = $driver->getTextHeight($text); - $texts[$i] = $text; - } - - // Maximum height of the font used - $heightMax = array_max($heights); - - // Get number of columns - if($this->columns !== NULL) { - $columns = $this->columns; - } else if($this->rows !== NULL) { - $columns = ceil($count / $this->rows); - } else { - $columns = $count; - } - - // Number of rows - $rows = (int)ceil($count / $columns); - - // Get maximum with of each column - $widthMax = array(); - for($i = 0; $i < $count; $i++) { - // Get column width - $column = $i % $columns; - if(array_key_exists($column, $widthMax) === FALSE) { - $widthMax[$column] = $widths[$i]; - } else { - $widthMax[$column] = max($widthMax[$column], $widths[$i]); - } - } - - $width = $this->padding[0] + $this->padding[1] - $this->space; - for($i = 0; $i < $columns; $i++) { - $width += $this->space + 5 + 10 + $widthMax[$i]; - } - - $height = ($heightMax + $this->space) * $rows - $this->space + $this->padding[2] + $this->padding[3]; - - // Look for legends position - list($x, $y) = $driver->getSize(); - - $p = new awPoint( - $this->position->x * $x, - $this->position->y * $y - ); - - switch($this->hAlign) { - - case awLegend::CENTER : - $p->x -= $width / 2; - break; - - case awLegend::RIGHT : - $p->x -= $width; - break; - - } - - switch($this->vAlign) { - - case awLegend::MIDDLE : - $p->y -= $height / 2; - break; - - case awLegend::BOTTOM : - $p->y -= $height; - break; - - } - - // Draw legend shadow - $this->shadow->draw( - $driver, - $p, - $p->move($width, $height), - awShadow::OUT - ); - - // Draw legends base - $this->drawBase($driver, $p, $width, $height); - - // Draw each legend - for($i = 0; $i < $count; $i++) { - - list($component, $title, $type) = $this->legends[$i]; - - $column = $i % $columns; - $row = (int)floor($i / $columns); - - // Get width of all previous columns - $previousColumns = 0; - for($j = 0; $j < $column; $j++) { - $previousColumns += $this->space + 10 + 5 + $widthMax[$j]; - } - - // Draw legend text - $driver->string( - $texts[$i], - $p->move( - $this->padding[0] + $previousColumns + 10 + 5 + $this->textMargin->left, - $this->padding[2] + $row * ($heightMax + $this->space) + $heightMax / 2 - $heights[$i] / 2 - ) - ); - - // Draw legend icon - switch($type) { - - case awLegend::LINE : - case awLegend::MARK : - case awLegend::MARKONLY : - - // Get vertical position - $x = $this->padding[0] + $previousColumns; - $y = $this->padding[2] + $row * ($heightMax + $this->space) + $heightMax / 2 - $component->getLegendLineThickness(); - - // Draw two lines - if($component->getLegendLineColor() !== NULL) { - - $color = $component->getLegendLineColor(); - - if($color instanceof awColor and $type !== awLegend::MARKONLY) { - - $driver->line( - $color, - new awLine( - $p->move( - $x, // YaPB ?? - $y + $component->getLegendLineThickness() / 2 - ), - $p->move( - $x + 10, - $y + $component->getLegendLineThickness() / 2 - ), - $component->getLegendLineStyle(), - $component->getLegendLineThickness() - ) - ); - - unset($color); - - } - - } - - if($type === awLegend::MARK or $type === awLegend::MARKONLY) { - - $mark = $component->getLegendMark(); - - if($mark !== NULL) { - $mark->draw( - $driver, - $p->move( - $x + 5.5, - $y + $component->getLegendLineThickness() / 2 - ) - ); - } - - unset($mark); - - } - - break; - - case awLegend::BACKGROUND : - - // Get vertical position - $x = $this->padding[0] + $previousColumns; - $y = $this->padding[2] + $row * ($heightMax + $this->space) + $heightMax / 2 - 5; - - $from = $p->move( - $x, - $y - ); - - $to = $p->move( - $x + 10, - $y + 10 - ); - - $background = $component->getLegendBackground(); - - if($background !== NULL) { - - $driver->filledRectangle( - $component->getLegendBackground(), - new awLine($from, $to) - ); - - // Draw rectangle border - $this->border->rectangle( - $driver, - $from->move(0, 0), - $to->move(0, 0) - ); - - } - - unset($background, $from, $to); - - break; - - } - - } - - } - - private function drawBase(awDriver $driver, awPoint $p, $width, $height) { - - $this->border->rectangle( - $driver, - $p, - $p->move($width, $height) - ); - - $size = $this->border->visible() ? 1 : 0; - - $driver->filledRectangle( - $this->background, - new awLine( - $p->move($size, $size), - $p->move($width - $size, $height - $size) - ) - ); - - } - -} - -registerClass('Legend'); - -/** - * You can add a legend to components which implements this interface - * - * @package Artichow - */ -interface awLegendable { - - /** - * Get the line type - * - * @return int - */ - public function getLegendLineStyle(); - - /** - * Get the line thickness - * - * @return int - */ - public function getLegendLineThickness(); - - /** - * Get the color of line - * - * @return Color - */ - public function getLegendLineColor(); - - /** - * Get the background color or gradient of an element of the component - * - * @return Color, Gradient - */ - public function getLegendBackground(); - - /** - * Get a Mark object - * - * @return Mark - */ - public function getLegendMark(); - -} - -registerInterface('Legendable'); -?> \ No newline at end of file diff --git a/artichow/inc/Mark.class.php b/artichow/inc/Mark.class.php deleted file mode 100644 index 5cf042f..0000000 --- a/artichow/inc/Mark.class.php +++ /dev/null @@ -1,490 +0,0 @@ -fill = new awColor(255, 0, 0, 0); - $this->border = new awBorder; - $this->border->hide(); - - $this->move = new awPoint(0, 0); - - } - - /** - * Change mark position - * - * @param int $x Add this interval to X coord - * @param int $y Add this interval to Y coord - */ - public function move($x, $y) { - - $this->move = $this->move->move($x, $y); - - } - - /** - * Hide marks ? - * - * @param bool $hide TRUE to hide marks, FALSE otherwise - */ - public function hide($hide = TRUE) { - $this->hide = (bool)$hide; - } - - /** - * Show marks ? - * - * @param bool $show - */ - public function show($show = TRUE) { - $this->hide = (bool)!$show; - } - - /** - * Change mark type - * - * @param int $size Size in pixels - */ - public function setSize($size) { - $this->size = (int)$size; - } - - /** - * Change mark type - * - * @param int $type New mark type - * @param int $size Mark size (can be NULL) - */ - public function setType($type, $size = NULL) { - $this->type = (int)$type; - if($size !== NULL) { - $this->setSize($size); - } - } - - /** - * Fill the mark with a color or a gradient - * - * @param mixed $fill A color or a gradient - */ - public function setFill($fill) { - if($fill instanceof awColor or $fill instanceof awGradient) { - $this->fill = $fill; - } - } - - /** - * Set an image - * Only for awMark::IMAGE type. - * - * @param Image An image - */ - public function setImage(awImage $image) { - $this->image = $image; - } - - /** - * Draw the mark - * - * @param awDriver $driver - * @param awPoint $point Mark center - */ - public function draw(awDriver $driver, awPoint $point) { - - // Hide marks ? - if($this->hide) { - return; - } - - // Check if we can print marks - if($this->type !== NULL) { - - $this->driver = $driver; - $realPoint = $this->move->move($point->x, $point->y); - - switch($this->type) { - - case awMark::CIRCLE : - $this->drawCircle($realPoint); - break; - - case awMark::SQUARE : - $this->drawSquare($realPoint); - break; - - case awMark::TRIANGLE : - $this->drawTriangle($realPoint); - break; - - case awMark::INVERTED_TRIANGLE : - $this->drawTriangle($realPoint, TRUE); - break; - - case awMark::RHOMBUS : - $this->drawRhombus($realPoint); - break; - - case awMark::CROSS : - $this->drawCross($realPoint); - break; - - case awMark::PLUS : - $this->drawCross($realPoint, TRUE); - break; - - case awMark::IMAGE : - $this->drawImage($realPoint); - break; - - case awMark::STAR : - $this->changeType('star'); - $this->draw($driver, $point); - break; - - case awMark::PAPERCLIP : - $this->changeType('paperclip'); - $this->draw($driver, $point); - break; - - case awMark::BOOK : - $this->changeType('book'); - $this->draw($driver, $point); - break; - - } - - } - - } - - protected function changeType($image) { - $this->setType(awMARK::IMAGE); - $this->setImage(new awFileImage(ARTICHOW_IMAGE.DIRECTORY_SEPARATOR.$image.'.png')); - } - - protected function drawCircle(awPoint $point) { - - $this->driver->filledEllipse( - $this->fill, - $point, - $this->size, $this->size - ); - - $this->border->ellipse( - $this->driver, - $point, - $this->size, $this->size - ); - - } - - protected function drawSquare(awPoint $point) { - - list($x, $y) = $point->getLocation(); - - $x1 = (int)($x - $this->size / 2); - $x2 = $x1 + $this->size; - $y1 = (int)($y - $this->size / 2); - $y2 = $y1 + $this->size; - - $this->border->rectangle($this->driver, new awPoint($x1, $y1), new awPoint($x2, $y2)); - - $size = $this->border->visible() ? 1 : 0; - - $this->driver->filledRectangle( - $this->fill, - new awLine( - new awPoint($x1 + $size, $y1 + $size), - new awPoint($x2 - $size, $y2 - $size) - ) - ); - - } - - protected function drawTriangle(awPoint $point, $inverted = FALSE) { - - list($x, $y) = $point->getLocation(); - - $size = $this->size; - - $triangle = new awPolygon; - // Set default style and thickness - $triangle->setStyle(awPolygon::SOLID); - $triangle->setThickness(1); - - if($inverted === TRUE) { - // Bottom of the triangle - $triangle->append(new awPoint($x, $y + $size / sqrt(3))); - - // Upper left corner - $triangle->append(new awPoint($x - $size / 2, $y - $size / (2 * sqrt(3)))); - - // Upper right corner - $triangle->append(new awPoint($x + $size / 2, $y - $size / (2 * sqrt(3)))); - } else { - // Top of the triangle - $triangle->append(new awPoint($x, $y - $size / sqrt(3))); - - // Lower left corner - $triangle->append(new awPoint($x - $size / 2, $y + $size / (2 * sqrt(3)))); - - // Lower right corner - $triangle->append(new awPoint($x + $size / 2, $y + $size / (2 * sqrt(3)))); - } - - $this->driver->filledPolygon($this->fill, $triangle); - - if($this->border->visible()) { - $this->border->polygon($this->driver, $triangle); - } - } - - protected function drawRhombus(awPoint $point) { - - list($x, $y) = $point->getLocation(); - - $rhombus = new awPolygon; - // Set default style and thickness - $rhombus->setStyle(awPolygon::SOLID); - $rhombus->setThickness(1); - - // Top of the rhombus - $rhombus->append(new awPoint($x, $y - $this->size / 2)); - - // Right of the rhombus - $rhombus->append(new awPoint($x + $this->size / 2, $y)); - - // Bottom of the rhombus - $rhombus->append(new awPoint($x, $y + $this->size / 2)); - - // Left of the rhombus - $rhombus->append(new awPoint($x - $this->size / 2, $y)); - - $this->driver->filledPolygon($this->fill, $rhombus); - - if($this->border->visible()) { - $this->border->polygon($this->driver, $rhombus); - } - } - - protected function drawCross(awPoint $point, $upright = FALSE) { - - list($x, $y) = $point->getLocation(); - - if($upright === TRUE) { - $x11 = (int)($x); - $y11 = (int)($y - $this->size / 2); - $x12 = (int)($x); - $y12 = (int)($y + $this->size / 2); - - $y21 = (int)($y); - $y22 = (int)($y); - } else { - $x11 = (int)($x - $this->size / 2); - $y11 = (int)($y + $this->size / 2); - $x12 = (int)($x + $this->size / 2); - $y12 = (int)($y - $this->size / 2); - - $y21 = (int)($y - $this->size / 2); - $y22 = (int)($y + $this->size / 2); - } - - $x21 = (int)($x - $this->size / 2); - $x22 = (int)($x + $this->size / 2); - - $this->driver->line( - $this->fill, - new awLine( - new awPoint($x11, $y11), - new awPoint($x12, $y12) - ) - ); - - $this->driver->line( - $this->fill, - new awLine( - new awPoint($x21, $y21), - new awPoint($x22, $y22) - ) - ); - } - - protected function drawImage(awPoint $point) { - - if($this->image instanceof awImage) { - - $width = $this->image->width; - $height = $this->image->height; - - list($x, $y) = $point->getLocation(); - - $x1 = (int)($x - $width / 2); - $x2 = $x1 + $width; - $y1 = (int)($y - $width / 2); - $y2 = $y1 + $height; - - $this->border->rectangle($this->driver, new awPoint($x1 - 1, $y1 - 1), new awPoint($x2 + 1, $y2 + 1)); - - $this->driver->copyImage($this->image, new awPoint($x1, $y1), new awPoint($x2, $y2)); - - } - - } - -} - -registerClass('Mark'); -?> \ No newline at end of file diff --git a/artichow/inc/Math.class.php b/artichow/inc/Math.class.php deleted file mode 100644 index a3d84ef..0000000 --- a/artichow/inc/Math.class.php +++ /dev/null @@ -1,832 +0,0 @@ -style = (int)$style; - } - - /** - * Return shape style - * - * @return int - */ - public function getStyle() { - return $this->style; - } - - /** - * Change shape thickness - * - * @param int $thickness Shape thickness in pixels - */ - public function setThickness($thickness) { - $this->thickness = (int)$thickness; - } - - /** - * Return shape thickness - * - * @return int - */ - public function getThickness() { - return $this->thickness; - } - - /** - * Hide the shape - * - * @param bool $hide - */ - public function hide($hide) { - $this->hide = (bool)$hide; - } - - /** - * Show the shape - * - * @param bool $shape - */ - public function show($shape) { - $this->hide = (bool)!$shape; - } - - /** - * Is the line hidden ? - * - * @return bool - */ - public function isHidden() { - return $this->hide; - } - -} - -registerClass('Shape', TRUE); - -/** - * Describe a point - * - * @package Artichow - */ -class awPoint extends awShape { - - /** - * X coord - * - * @var float - */ - public $x; - - /** - * Y coord - * - * @var float - */ - public $y; - - /** - * Build a new awpoint - * - * @param float $x - * @param float $y - */ - public function __construct($x, $y) { - - $this->setLocation($x, $y); - - } - - /** - * Change X value - * - * @param float $x - */ - public function setX($x) { - $this->x = (float)$x; - } - - /** - * Change Y value - * - * @param float $y - */ - public function setY($y) { - $this->y = (float)$y; - } - - /** - * Change point location - * - * @param float $x - * @param float $y - */ - public function setLocation($x, $y) { - $this->setX($x); - $this->setY($y); - } - - /** - * Get point location - * - * @param array Point location - */ - public function getLocation() { - return array($this->x, $this->y); - } - - /** - * Get distance to another point - * - * @param awPoint $p A point - * @return float - */ - public function getDistance(awPoint $p) { - - return sqrt(pow($p->x - $this->x, 2) + pow($p->y - $this->y, 2)); - - } - - /** - * Move the point to another location - * - * @param Point A Point with the new awlocation - */ - public function move($x, $y) { - - return new awPoint( - $this->x + $x, - $this->y + $y - ); - - } - -} - -registerClass('Point'); - - -/** - * Describe a line - * - * @package Artichow - */ -class awLine extends awShape { - - /** - * Line first point - * - * @param Point - */ - public $p1; - - /** - * Line second point - * - * @param Point - */ - public $p2; - - /** - * The line slope (the m in y = mx + p) - * - * @param float - */ - private $slope; - - /** - * The y-intercept value of the line (the p in y = mx + p) - * - * @param float - */ - private $origin; - - /** - * Build a new awline - * - * @param awPoint $p1 First point - * @param awPoint $p2 Second point - * @param int $type Style of line (default to solid) - * @param int $thickness Line thickness (default to 1) - */ - public function __construct($p1 = NULL, $p2 = NULL, $type = awLine::SOLID, $thickness = 1) { - - $this->setLocation($p1, $p2); - $this->setStyle($type); - $this->setThickness($thickness); - - } - - /** - * Build a line from 4 coords - * - * @param int $x1 Left position - * @param int $y1 Top position - * @param int $x2 Right position - * @param int $y2 Bottom position - */ - public static function build($x1, $y1, $x2, $y2) { - - return new awLine( - new awPoint($x1, $y1), - new awPoint($x2, $y2) - ); - - } - - /** - * Change X values of the line - * - * @param int $x1 Begin value - * @param int $x2 End value - */ - public function setX($x1, $x2) { - $this->p1->setX($x1); - $this->p2->setX($x2); - - // Resets slope and origin values so they are - // recalculated when and if needed. - $this->slope = NULL; - $this->origin = NULL; - } - - /** - * Change Y values of the line - * - * @param int $y1 Begin value - * @param int $y2 End value - */ - public function setY($y1, $y2) { - $this->p1->setY($y1); - $this->p2->setY($y2); - - // Resets slope and origin values so they are - // recalculated when and if needed. - $this->slope = NULL; - $this->origin = NULL; - } - - /** - * Change line location - * - * @param awPoint $p1 First point - * @param awPoint $p2 Second point - */ - public function setLocation($p1, $p2) { - if(is_null($p1) or $p1 instanceof awPoint) { - $this->p1 = $p1; - } - if(is_null($p2) or $p2 instanceof awPoint) { - $this->p2 = $p2; - } - - // Resets slope and origin values so they are - // recalculated when and if needed. - $this->slope = NULL; - $this->origin = NULL; - } - - /** - * Get line location - * - * @param array Line location - */ - public function getLocation() { - return array($this->p1, $this->p2); - } - - /** - * Get the line size - * - * @return float - */ - public function getSize() { - - $square = pow($this->p2->x - $this->p1->x, 2) + pow($this->p2->y - $this->p1->y, 2); - return sqrt($square); - - } - - /** - * Calculate the line slope - * - */ - private function calculateSlope() { - if($this->isHorizontal()) { - $this->slope = 0; - } else { - $slope = ($this->p1->y - $this->p2->y) / ($this->p1->x - $this->p2->x); - - $this->slope = $slope; - } - } - - /** - * Calculate the y-intercept value of the line - * - */ - private function calculateOrigin() { - if($this->isHorizontal()) { - $this->origin = $this->p1->y; // Or p2->y - } else { - $y1 = $this->p1->y; - $y2 = $this->p2->y; - $x1 = $this->p1->x; - $x2 = $this->p2->x; - - $origin = ($y2 * $x1 - $y1 * $x2) / ($x1 - $x2); - - $this->origin = $origin; - } - } - - /** - * Calculate the slope and y-intercept value of the line - * - */ - private function calculateEquation() { - $this->calculateSlope(); - $this->calculateOrigin(); - } - - /** - * Get the line slope value - * - * @return float - */ - public function getSlope() { - if($this->isVertical()) { - return NULL; - } elseif($this->slope !== NULL) { - return $this->slope; - } else { - $this->calculateSlope(); - return $this->slope; - } - } - - /** - * Get the line y-intercept value - * - * @return float - */ - public function getOrigin() { - if($this->isVertical()) { - return NULL; - } elseif($this->origin !== NULL) { - return $this->origin; - } else { - $this->calculateOrigin(); - return $this->origin; - } - } - - /** - * Get the line equation - * - * @return array An array containing the slope and y-intercept value of the line - */ - public function getEquation() { - $slope = $this->getSlope(); - $origin = $this->getOrigin(); - - return array($slope, $origin); - } - - /** - * Return the x coordinate of a point on the line - * given its y coordinate. - * - * @param float $y The y coordinate of the Point - * @return float $x The corresponding x coordinate - */ - public function getXFrom($y) { - $x = NULL; - - if($this->isVertical()) { - list($p, ) = $this->getLocation(); - $x = $p->x; - } else { - list($slope, $origin) = $this->getEquation(); - - if($slope !== 0) { - $y = (float)$y; - $x = ($y - $origin) / $slope; - } - } - - return $x; - } - - /** - * Return the y coordinate of a point on the line - * given its x coordinate. - * - * @param float $x The x coordinate of the Point - * @return float $y The corresponding y coordinate - */ - public function getYFrom($x) { - $y = NULL; - - if($this->isHorizontal()) { - list($p, ) = $this->getLocation(); - $y = $p->y; - } else { - list($slope, $origin) = $this->getEquation(); - - if($slope !== NULL) { - $x = (float)$x; - $y = $slope * $x + $origin; - } - } - - return $y; - } - - /** - * Test if the line can be considered as a point - * - * @return bool - */ - public function isPoint() { - return ($this->p1->x === $this->p2->x and $this->p1->y === $this->p2->y); - } - - /** - * Test if the line is a vertical line - * - * @return bool - */ - public function isVertical() { - return ($this->p1->x === $this->p2->x); - } - - /** - * Test if the line is an horizontal line - * - * @return bool - */ - public function isHorizontal() { - return ($this->p1->y === $this->p2->y); - } - - /** - * Returns TRUE if the line is going all the way from the top - * to the bottom of the polygon surrounding box. - * - * @param $polygon Polygon A Polygon object - * @return bool - */ - public function isTopToBottom(awPolygon $polygon) { - list($xMin, $xMax) = $polygon->getBoxXRange(); - list($yMin, $yMax) = $polygon->getBoxYRange(); - - if($this->isHorizontal()) { - return FALSE; - } else { - if($this->p1->y < $this->p2->y) { - $top = $this->p1; - $bottom = $this->p2; - } else { - $top = $this->p2; - $bottom = $this->p1; - } - - return ( - $this->isOnBoxTopSide($top, $xMin, $xMax, $yMin) - and - $this->isOnBoxBottomSide($bottom, $xMin, $xMax, $yMax) - ); - } - } - - /** - * Returns TRUE if the line is going all the way from the left side - * to the right side of the polygon surrounding box. - * - * @param $polygon Polygon A Polygon object - * @return bool - */ - public function isLeftToRight(awPolygon $polygon) { - list($xMin, $xMax) = $polygon->getBoxXRange(); - list($yMin, $yMax) = $polygon->getBoxYRange(); - - if($this->isVertical()) { - return FALSE; - } else { - if($this->p1->x < $this->p2->x) { - $left = $this->p1; - $right = $this->p2; - } else { - $left = $this->p2; - $right = $this->p1; - } - } - - return ( - $this->isOnBoxLeftSide($left, $yMin, $yMax, $xMin) - and - $this->isOnBoxRightSide($right, $yMin, $yMax, $xMax) - ); - } - - private function isOnBoxTopSide(awPoint $point, $xMin, $xMax, $yMin) { - if( - $point->y === $yMin - and - $point->x >= $xMin - and - $point->x <= $xMax - ) { - return TRUE; - } else { - return FALSE; - } - } - - private function isOnBoxBottomSide(awPoint $point, $xMin, $xMax, $yMax) { - if( - $point->y === $yMax - and - $point->x >= $xMin - and - $point->x <= $xMax - ) { - return TRUE; - } else { - return FALSE; - } - } - - private function isOnBoxLeftSide(awPoint $point, $yMin, $yMax, $xMin) { - if( - $point->x === $xMin - and - $point->y >= $yMin - and - $point->y <= $yMax - ) { - return TRUE; - } else { - return FALSE; - } - } - - private function isOnBoxRightSide(awPoint $point, $yMin, $yMax, $xMax) { - if( - $point->x === $xMax - and - $point->y >= $yMin - and - $point->y <= $yMax - ) { - return TRUE; - } else { - return FALSE; - } - } - -} - -registerClass('Line'); - -/** - * A vector is a type of line - * The sense of the vector goes from $p1 to $p2. - * - * @package Artichow - */ -class awVector extends awLine { - - /** - * Get vector angle in radians - * - * @return float - */ - public function getAngle() { - - if($this->isPoint()) { - return 0.0; - } - - $size = $this->getSize(); - - $width = ($this->p2->x - $this->p1->x); - $height = ($this->p2->y - $this->p1->y) * -1; - - if($width >= 0 and $height >= 0) { - return acos($width / $size); - } else if($width <= 0 and $height >= 0) { - return acos($width / $size); - } else { - $height *= -1; - if($width >= 0 and $height >= 0) { - return 2 * M_PI - acos($width / $size); - } else if($width <= 0 and $height >= 0) { - return 2 * M_PI - acos($width / $size); - } - } - - } - -} - -registerClass('Vector'); - - -/** - * Describe a polygon - * - * @package Artichow - */ -class awPolygon extends awShape { - - /** - * Polygon points - * - * @var array - */ - protected $points = array(); - - /** - * Set a point in the polygon - * - * @param int $pos Point position - * @param awPoint $point - */ - public function set($pos, $point) { - if(is_null($point) or $point instanceof awPoint) { - $this->points[$pos] = $point; - } - } - - /** - * Add a point at the end of the polygon - * - * @param awPoint $point - */ - public function append($point) { - if(is_null($point) or $point instanceof awPoint) { - $this->points[] = $point; - } - } - - /** - * Get a point at a position in the polygon - * - * @param int $pos Point position - * @return Point - */ - public function get($pos) { - return $this->points[$pos]; - } - - /** - * Count number of points in the polygon - * - * @return int - */ - public function count() { - return count($this->points); - } - - /** - * Returns all points in the polygon - * - * @return array - */ - public function all() { - return $this->points; - } - - /** - * Returns the different lines formed by the polygon vertices - * - * @return array - */ - public function getLines() { - $lines = array(); - $count = $this->count(); - - for($i = 0; $i < $count - 1; $i++) { - $lines[] = new Line($this->get($i), $this->get($i + 1)); - } - - // "Close" the polygon - $lines[] = new Line($this->get($count - 1), $this->get(0)); - - return $lines; - } - - /** - * Get the upper-left and lower-right points - * of the bounding box around the polygon - * - * @return array An array of two Point objects - */ - public function getBoxPoints() { - $count = $this->count(); - $x = $y = array(); - - for($i = 0; $i < $count; $i++) { - $point = $this->get($i); - - list($x[], $y[]) = $point->getLocation(); - } - - $upperLeft = new Point(min($x), min($y)); - $lowerRight = new Point(max($x), max($y)); - - return array($upperLeft, $lowerRight); - } - - /** - * Return the range of the polygon on the y axis, - * i.e. the minimum and maximum y value of any point in the polygon - * - * @return array - */ - public function getBoxYRange() { - list($p1, $p2) = $this->getBoxPoints(); - - list(, $yMin) = $p1->getLocation(); - list(, $yMax) = $p2->getLocation(); - - return array($yMin, $yMax); - } - - /** - * Return the range of the polygon on the x axis, - * i.e. the minimum and maximum x value of any point in the polygon - * - * @return array - */ - public function getBoxXRange() { - list($p1, $p2) = $this->getBoxPoints(); - - list($xMin, ) = $p1->getLocation(); - list($xMax, ) = $p2->getLocation(); - - return array($xMin, $xMax); - } - -} - -registerClass('Polygon'); -?> \ No newline at end of file diff --git a/artichow/inc/Shadow.class.php b/artichow/inc/Shadow.class.php deleted file mode 100644 index c04103e..0000000 --- a/artichow/inc/Shadow.class.php +++ /dev/null @@ -1,406 +0,0 @@ -setPosition($position); - } - - /** - * Hide shadow ? - * - * @param bool $hide - */ - public function hide($hide = TRUE) { - $this->hide = (bool)$hide; - } - - /** - * Show shadow ? - * - * @param bool $show - */ - public function show($show = TRUE) { - $this->hide = (bool)!$show; - } - - /** - * Change shadow size - * - * @param int $size - * @param bool $smooth Smooth the shadow (facultative argument) - */ - public function setSize($size, $smooth = NULL) { - $this->size = (int)$size; - if($smooth !== NULL) { - $this->smooth($smooth); - } - } - - /** - * Change shadow color - * - * @param awColor $color - */ - public function setColor(awColor $color) { - $this->color = $color; - } - - /** - * Change shadow position - * - * @param int $position - */ - public function setPosition($position) { - $this->position = (int)$position; - } - - /** - * Smooth shadow ? - * - * @param bool $smooth - */ - public function smooth($smooth) { - $this->smooth = (bool)$smooth; - } - - /** - * Get the space taken by the shadow - * - * @return Side - */ - public function getSpace() { - - return new awSide( - ($this->position === awShadow::LEFT_TOP or $this->position === awShadow::LEFT_BOTTOM) ? $this->size : 0, - ($this->position === awShadow::RIGHT_TOP or $this->position === awShadow::RIGHT_BOTTOM) ? $this->size : 0, - ($this->position === awShadow::LEFT_TOP or $this->position === awShadow::RIGHT_TOP) ? $this->size : 0, - ($this->position === awShadow::LEFT_BOTTOM or $this->position === awShadow::RIGHT_BOTTOM) ? $this->size : 0 - ); - - } - - /** - * Draw shadow - * - * @param awDriver $driver - * @param awPoint $p1 Top-left point - * @param awPoint $p2 Right-bottom point - * @param int Drawing mode - */ - public function draw(awDriver $driver, awPoint $p1, awPoint $p2, $mode) { - - if($this->hide) { - return; - } - - if($this->size <= 0) { - return; - } - - $driver = clone $driver; - - $color = ($this->color instanceof awColor) ? $this->color : new awColor(125, 125, 125); - - switch($this->position) { - - case awShadow::RIGHT_BOTTOM : - - if($mode === awShadow::OUT) { - $t1 = $p1->move(0, 0); - $t2 = $p2->move($this->size + 1, $this->size + 1); - } else { // PHP 4 compatibility - $t1 = $p1->move(0, 0); - $t2 = $p2->move(0, 0); - } - - $width = $t2->x - $t1->x; - $height = $t2->y - $t1->y; - - $driver->setAbsPosition($t1->x + $driver->x, $t1->y + $driver->y); - - $driver->filledRectangle( - $color, - new awLine( - new awPoint($width - $this->size, $this->size), - new awPoint($width - 1, $height - 1) - ) - ); - - $driver->filledRectangle( - $color, - new awLine( - new awPoint($this->size, $height - $this->size), - new awPoint($width - $this->size - 1, $height - 1) - ) - ); - - $this->smoothPast($driver, $color, $width, $height); - - break; - - case awShadow::LEFT_TOP : - - if($mode === awShadow::OUT) { - $t1 = $p1->move(- $this->size, - $this->size); - $t2 = $p2->move(0, 0); - } else { // PHP 4 compatibility - $t1 = $p1->move(0, 0); - $t2 = $p2->move(0, 0); - } - - $width = $t2->x - $t1->x; - $height = $t2->y - $t1->y; - - $driver->setAbsPosition($t1->x + $driver->x, $t1->y + $driver->y); - - $height = max($height + 1, $this->size); - - $driver->filledRectangle( - $color, - new awLine( - new awPoint(0, 0), - new awPoint($this->size - 1, $height - $this->size - 1) - ) - ); - - $driver->filledRectangle( - $color, - new awLine( - new awPoint($this->size, 0), - new awPoint($width - $this->size - 1, $this->size - 1) - ) - ); - - $this->smoothPast($driver, $color, $width, $height); - - break; - - case awShadow::RIGHT_TOP : - - if($mode === awShadow::OUT) { - $t1 = $p1->move(0, - $this->size); - $t2 = $p2->move($this->size + 1, 0); - } else { // PHP 4 compatibility - $t1 = $p1->move(0, 0); - $t2 = $p2->move(0, 0); - } - - $width = $t2->x - $t1->x; - $height = $t2->y - $t1->y; - - $driver->setAbsPosition($t1->x + $driver->x, $t1->y + $driver->y); - - $height = max($height + 1, $this->size); - - $driver->filledRectangle( - $color, - new awLine( - new awPoint($width - $this->size, 0), - new awPoint($width - 1, $height - $this->size - 1) - ) - ); - - $driver->filledRectangle( - $color, - new awLine( - new awPoint($this->size, 0), - new awPoint($width - $this->size - 1, $this->size - 1) - ) - ); - - $this->smoothFuture($driver, $color, $width, $height); - - break; - - case awShadow::LEFT_BOTTOM : - - if($mode === awShadow::OUT) { - $t1 = $p1->move(- $this->size, 0); - $t2 = $p2->move(0, $this->size + 1); - } else { // PHP 4 compatibility - $t1 = $p1->move(0, 0); - $t2 = $p2->move(0, 0); - } - - $width = $t2->x - $t1->x; - $height = $t2->y - $t1->y; - - $driver->setAbsPosition($t1->x + $driver->x, $t1->y + $driver->y); - - $driver->filledRectangle( - $color, - new awLine( - new awPoint(0, $this->size), - new awPoint($this->size - 1, $height - 1) - ) - ); - - $driver->filledRectangle( - $color, - new awLine( - new awPoint($this->size, $height - $this->size), - new awPoint($width - $this->size - 1, $height - 1) - ) - ); - - $this->smoothFuture($driver, $color, $width, $height); - - break; - - } - - } - - private function smoothPast(awDriver $driver, awColor $color, $width, $height) { - - if($this->smooth) { - - for($i = 0; $i < $this->size; $i++) { - for($j = 0; $j <= $i; $j++) { - $driver->point( - $color, - new awPoint($i, $j + $height - $this->size) - ); - } - } - - for($i = 0; $i < $this->size; $i++) { - for($j = 0; $j <= $i; $j++) { - $driver->point( - $color, - new awPoint($width - $this->size + $j, $i) - ); - } - } - - } - - } - - private function smoothFuture(awDriver $driver, awColor $color, $width, $height) { - - if($this->smooth) { - - for($i = 0; $i < $this->size; $i++) { - for($j = 0; $j <= $i; $j++) { - $driver->point( - $color, - new awPoint($i, $this->size - $j - 1) - ); - } - } - - for($i = 0; $i < $this->size; $i++) { - for($j = 0; $j <= $i; $j++) { - $driver->point( - $color, - new awPoint($width - $this->size + $j, $height - $i - 1) - ); - } - } - - } - } - -} - -registerClass('Shadow'); -?> \ No newline at end of file diff --git a/artichow/inc/Text.class.php b/artichow/inc/Text.class.php deleted file mode 100644 index a0ab4b5..0000000 --- a/artichow/inc/Text.class.php +++ /dev/null @@ -1,233 +0,0 @@ -setText($text); - $this->setFont($font); - - // Set default color to black - if($color === NULL) { - $color = new awColor(0, 0, 0); - } - - $this->setColor($color); - $this->setAngle($angle); - - $this->border = new awBorder; - $this->border->hide(); - - } - - /** - * Get text - * - * @return string - */ - public function getText() { - return $this->text; - } - - /** - * Change text - * - * @param string $text New text - */ - public function setText($text) { - $this->text = (string)$text; - $this->text = str_replace("\r", "", $text); - } - - /** - * Change text font - * - * @param Font - */ - public function setFont(awFont $font) { - $this->font = $font; - } - - /** - * Get text font - * - * @return int - */ - public function getFont() { - return $this->font; - } - - /** - * Change text angle - * - * @param int - */ - public function setAngle($angle) { - $this->angle = (int)$angle; - } - - /** - * Get text angle - * - * @return int - */ - public function getAngle() { - return $this->angle; - } - - /** - * Change text color - * - * @param Color - */ - public function setColor(awColor $color) { - $this->color = $color; - } - - /** - * Get text color - * - * @return Color - */ - public function getColor() { - return $this->color; - } - - /** - * Change text background - * - * @param mixed $background - */ - public function setBackground($background) { - if($background instanceof awColor) { - $this->setBackgroundColor($background); - } elseif($background instanceof awGradient) { - $this->setBackgroundGradient($background); - } - } - - /** - * Change text background color - * - * @param awColor $color - */ - public function setBackgroundColor(awColor $color) { - $this->background = $color; - } - - /** - * Change text background gradient - * - * @param awGradient $gradient - */ - public function setBackgroundGradient(awGradient $gradient) { - $this->background = $gradient; - } - - /** - * Get text background - * - * @return Color, Gradient - */ - public function getBackground() { - return $this->background; - } - - /** - * Change padding - * - * @param int $left Left padding - * @param int $right Right padding - * @param int $top Top padding - * @param int $bottom Bottom padding - */ - public function setPadding($left, $right, $top, $bottom) { - $this->padding = array((int)$left, (int)$right, (int)$top, (int)$bottom); - } - - /** - * Get current padding - * - * @return array - */ - public function getPadding() { - return $this->padding; - } - -} - -registerClass('Text'); -?> diff --git a/artichow/inc/Tick.class.php b/artichow/inc/Tick.class.php deleted file mode 100644 index 928f4f7..0000000 --- a/artichow/inc/Tick.class.php +++ /dev/null @@ -1,344 +0,0 @@ -setSize($size); - $this->setNumber($number); - $this->setColor(new awBlack); - $this->style = awTick::IN; - - } - - /** - * Change ticks style - * - * @param int $style - */ - public function setStyle($style) { - $this->style = (int)$style; - } - - /** - * Get ticks style - * - * @return int - */ - public function getStyle() { - return $this->style; - } - - /** - * Change ticks color - * - * @param awColor $color - */ - public function setColor(awColor $color) { - $this->color = $color; - } - - /** - * Change ticks size - * - * @param int $size - */ - public function setSize($size) { - $this->size = (int)$size; - } - - /** - * Change interval of ticks - * - * @param int $interval - */ - public function setInterval($interval) { - $this->interval = (int)$interval; - } - - /** - * Get interval between each tick - * - * @return int - */ - public function getInterval() { - return $this->interval; - } - - /** - * Change number of ticks - * - * @param int $number - */ - public function setNumber($number) { - $this->number = (int)$number; - } - - /** - * Get number of ticks - * - * @return int - */ - public function getNumber() { - return $this->number; - } - - /** - * Change number of ticks relative to others ticks - * - * @param awTick $tick Ticks reference - * @param int $number Number of ticks - */ - public function setNumberByTick(awTick $tick, $number) { - - $this->numberByTick = array($tick, (int)$number); - - } - - /** - * Hide ticks - * - * @param bool $hide - */ - public function hide($hide) { - $this->hide = (bool)$hide; - } - - /** - * Hide first tick - * - * @param bool $hide - */ - public function hideFirst($hide) { - $this->hideFirst = (bool)$hide; - } - - /** - * Hide last tick - * - * @param bool $hide - */ - public function hideLast($hide) { - $this->hideLast = (bool)$hide; - } - - /** - * Draw ticks on a vector - * - * @param awDriver $driver A driver - * @param awVector $vector A vector - */ - public function draw(awDriver $driver, awVector $vector) { - - if($this->numberByTick !== NULL) { - list($tick, $number) = $this->numberByTick; - $this->number = 1 + ($tick->getNumber() - 1) * ($number + 1); - $this->interval = $tick->getInterval(); - } - - if($this->number < 2 or $this->hide) { - return; - } - - $angle = $vector->getAngle(); - // echo "INIT:".$angle."
          "; - switch($this->style) { - - case awTick::IN : - $this->drawTicks($driver, $vector, NULL, $angle + M_PI / 2); - break; - - case awTick::OUT : - $this->drawTicks($driver, $vector, $angle + 3 * M_PI / 2, NULL); - break; - - default : - $this->drawTicks($driver, $vector, $angle + M_PI / 2, $angle + 3 * M_PI / 2); - break; - - } - - } - - protected function drawTicks(awDriver $driver, awVector $vector, $from, $to) { - - // Draw last tick - if($this->hideLast === FALSE) { - - //echo ''; - if(($this->number - 1) % $this->interval === 0) { - $this->drawTick($driver, $vector->p2, $from, $to); - } - //echo ''; - - } - - $number = $this->number - 1; - $size = $vector->getSize(); - - // Get tick increment in pixels - $inc = $size / $number; - - // Check if we must hide the first tick - $start = $this->hideFirst ? $inc : 0; - $stop = $inc * $number; - - $position = 0; - - for($i = $start; round($i, 6) < $stop; $i += $inc) { - - if($position % $this->interval === 0) { - $p = $vector->p1->move( - round($i * cos($vector->getAngle()), 6), - round($i * sin($vector->getAngle() * -1), 6) - ); - $this->drawTick($driver, $p, $from, $to); - } - - $position++; - - } - //echo '

          '; - } - - protected function drawTick(awDriver $driver, awPoint $p, $from, $to) { -// echo $this->size.':'.$angle.'|'.cos($angle).'/'; - // The round avoid some errors in the calcul - // For example, 12.00000008575245 becomes 12 - $p1 = $p; - $p2 = $p; - - if($from !== NULL) { - $p1 = $p1->move( - round($this->size * cos($from), 6), - round($this->size * sin($from) * -1, 6) - ); - } - - if($to !== NULL) { - $p2 = $p2->move( - round($this->size * cos($to), 6), - round($this->size * sin($to) * -1, 6) - ); - } - //echo $p1->x.':'.$p2->x.'('.$p1->y.':'.$p2->y.')'.'/'; - $vector = new awVector( - $p1, $p2 - ); - - $driver->line( - $this->color, - $vector - ); - - } - -} - -registerClass('Tick'); -?> \ No newline at end of file diff --git a/artichow/inc/Tools.class.php b/artichow/inc/Tools.class.php deleted file mode 100644 index de23307..0000000 --- a/artichow/inc/Tools.class.php +++ /dev/null @@ -1,175 +0,0 @@ -set($left, $right, $top, $bottom); - } - - - /** - * Change side values - * - * @param mixed $left - * @param mixed $right - * @param mixed $top - * @param mixed $bottom - */ - public function set($left = NULL, $right = NULL, $top = NULL, $bottom = NULL) { - - if($left !== NULL) { - $this->left = (float)$left; - } - if($right !== NULL) { - $this->right = (float)$right; - } - if($top !== NULL) { - $this->top = (float)$top; - } - if($bottom !== NULL) { - $this->bottom = (float)$bottom; - } - - } - - - /** - * Add values to each side - * - * @param mixed $left - * @param mixed $right - * @param mixed $top - * @param mixed $bottom - */ - public function add($left = NULL, $right = NULL, $top = NULL, $bottom = NULL) { - - if($left !== NULL) { - $this->left += (float)$left; - } - if($right !== NULL) { - $this->right += (float)$right; - } - if($top !== NULL) { - $this->top += (float)$top; - } - if($bottom !== NULL) { - $this->bottom += (float)$bottom; - } - - } - -} - -registerClass('Side'); -?> \ No newline at end of file diff --git a/artichow/inc/drivers/gd.class.php b/artichow/inc/drivers/gd.class.php deleted file mode 100644 index eca48a9..0000000 --- a/artichow/inc/drivers/gd.class.php +++ /dev/null @@ -1,1336 +0,0 @@ -driverString = 'gd'; - } - - public function init(awImage $image) { - - if($this->resource === NULL) { - - $this->setImageSize($image->width, $image->height); - - // Create image - $this->resource = imagecreatetruecolor($this->imageWidth, $this->imageHeight); - if(!$this->resource) { - awImage::drawError("Class Image: Unable to create a graph."); - } - - imagealphablending($this->resource, TRUE); - - // Antialiasing is now handled by the Driver object - $this->setAntiAliasing($image->getAntiAliasing()); - - // Original color - $this->filledRectangle( - new awWhite, - new awLine( - new awPoint(0, 0), - new awPoint($this->imageWidth, $this->imageHeight) - ) - ); - - $shadow = $image->shadow; - if($shadow !== NULL) { - $shadow = $shadow->getSpace(); - $p1 = new awPoint($shadow->left, $shadow->top); - $p2 = new awPoint($this->imageWidth - $shadow->right - 1, $this->imageHeight - $shadow->bottom - 1); - - - // Draw image background - $this->filledRectangle($image->getBackground(), new awLine($p1, $p2)); - - // Draw image border - $image->border->rectangle($this, $p1, $p2); - } - - } - } - - public function initFromFile(awFileImage $fileImage, $file) { - - $image = @getimagesize((string)$file); - - if($image and in_array($image[2], array(2, 3))) { - - $fileImage->setSize($image[0], $image[1]); - - switch($image[2]) { - - case 2 : - $this->resource = imagecreatefromjpeg($file); - break; - - case 3 : - $this->resource = imagecreatefrompng($file); - break; - - } - - $this->setImageSize($fileImage->width, $fileImage->height); - } else { - awImage::drawError("Class FileImage: Artichow does not support the format of this image (must be in PNG or JPEG)"); - } - } - - public function setImageSize($width, $height) { - - $this->imageWidth = $width; - $this->imageHeight = $height; - - } - - public function setPosition($x, $y) { - - // Calculate absolute position - $this->x = round($x * $this->imageWidth - $this->w / 2); - $this->y = round($y * $this->imageHeight - $this->h / 2); - - } - - public function setAbsPosition($x, $y) { - - $this->x = $x; - $this->y = $y; - - } - - public function movePosition($x, $y) { - - $this->x += (int)$x; - $this->y += (int)$y; - - } - - public function setSize($w, $h) { - - // Calcul absolute size - $this->w = round($w * $this->imageWidth); - $this->h = round($h * $this->imageHeight); - - return $this->getSize(); - - } - - public function setAbsSize($w, $h) { - - $this->w = $w; - $this->h = $h; - - return $this->getSize(); - - } - - public function getSize() { - - return array($this->w, $this->h); - - } - - public function setAntiAliasing($bool) { - - if(function_exists('imageantialias')) { - imageantialias($this->resource, (bool)$bool); - - $this->antiAliasing = (bool)$bool; - } else { - awImage::drawErrorFile('missing-anti-aliasing'); - } - } - - public function getColor(awColor $color) { - - if($color->alpha === 0 or function_exists('imagecolorallocatealpha') === FALSE) { - $gdColor = imagecolorallocate($this->resource, $color->red, $color->green, $color->blue); - } else { - $gdColor = imagecolorallocatealpha($this->resource, $color->red, $color->green, $color->blue, $color->alpha); - } - - return $gdColor; - } - - public function copyImage(awImage $image, awPoint $p1, awPoint $p2) { - - list($x1, $y1) = $p1->getLocation(); - list($x2, $y2) = $p2->getLocation(); - - $driver = $image->getDriver(); - imagecopy($this->resource, $driver->resource, $this->x + $x1, $this->y + $y1, 0, 0, $x2 - $x1, $y2 - $y1); - - } - - public function copyResizeImage(awImage $image, awPoint $d1, awPoint $d2, awPoint $s1, awPoint $s2, $resample = TRUE) { - - if($resample) { - $function = 'imagecopyresampled'; - } else { - $function = 'imagecopyresized'; - } - - $driver = $image->getDriver(); - - $function( - $this->resource, - $driver->resource, - $this->x + $d1->x, $this->y + $d1->y, - $s1->x, $s1->y, - $d2->x - $d1->x, $d2->y - $d1->y, - $s2->x - $s1->x, $s2->y - $s1->y - ); - - } - - public function string(awText $text, awPoint $point, $width = NULL) { - - $font = $text->getFont(); - - // Can we deal with that font? - if($this->isCompatibleWithFont($font) === FALSE) { - awImage::drawError('Class GDDriver: Incompatible font type (\''.get_class($font).'\')'); - } - - // Check which FontDriver to use - if($font instanceof awPHPFont) { - $fontDriver = $this->phpFontDriver; - } else { - $fontDriver = $this->fileFontDriver; - } - - if($text->getBackground() !== NULL or $text->border->visible()) { - - list($left, $right, $top, $bottom) = $text->getPadding(); - - $textWidth = $fontDriver->getTextWidth($text, $this); - $textHeight = $fontDriver->getTextHeight($text, $this); - - $x1 = floor($point->x - $left); - $y1 = floor($point->y - $top); - $x2 = $x1 + $textWidth + $left + $right; - $y2 = $y1 + $textHeight + $top + $bottom; - - $this->filledRectangle( - $text->getBackground(), - awLine::build($x1, $y1, $x2, $y2) - ); - - $text->border->rectangle( - $this, - new awPoint($x1 - 1, $y1 - 1), - new awPoint($x2 + 1, $y2 + 1) - ); - - } - - $fontDriver->string($this, $text, $point, $width); - - } - - public function point(awColor $color, awPoint $p) { - - if($p->isHidden() === FALSE) { - $rgb = $this->getColor($color); - imagesetpixel($this->resource, $this->x + round($p->x), $this->y + round($p->y), $rgb); - } - - } - - public function line(awColor $color, awLine $line) { - - if($line->thickness > 0 and $line->isHidden() === FALSE) { - - $rgb = $this->getColor($color); - $thickness = $line->thickness; - - list($p1, $p2) = $line->getLocation(); - - $this->startThickness($thickness); - - switch($line->getStyle()) { - - case awLine::SOLID : - imageline($this->resource, $this->x + round($p1->x), $this->y + round($p1->y), $this->x + round($p2->x), $this->y + round($p2->y), $rgb); - break; - - case awLine::DOTTED : - $size = sqrt(pow($p2->y - $p1->y, 2) + pow($p2->x - $p1->x, 2)); - $cos = ($p2->x - $p1->x) / $size; - $sin = ($p2->y - $p1->y) / $size; - for($i = 0; $i <= $size; $i += 2) { - $p = new awPoint( - round($i * $cos + $p1->x), - round($i * $sin + $p1->y) - ); - $this->point($color, $p); - } - break; - - case awLine::DASHED : - $width = $p2->x - $p1->x; - $height = $p2->y - $p1->y; - $size = sqrt(pow($height, 2) + pow($width, 2)); - - if($size == 0) { - return; - } - - $cos = $width / $size; - $sin = $height / $size; - - $functionX = ($width > 0) ? 'min' : 'max'; - $functionY = ($height > 0) ? 'min' : 'max'; - - for($i = 0; $i <= $size; $i += 6) { - - $t1 = new awPoint( - round($i * $cos + $p1->x), - round($i * $sin + $p1->y) - ); - - $t2 = new awPoint( - round($functionX(($i + 3) * $cos, $width) + $p1->x), - round($functionY(($i + 3) * $sin, $height) + $p1->y) - ); - - $this->line($color, new awLine($t1, $t2)); - - } - break; - - } - - $this->stopThickness($thickness); - - } - - } - - public function arc(awColor $color, awPoint $center, $width, $height, $from, $to) { - - imagefilledarc( - $this->resource, - $this->x + $center->x, $this->y + $center->y, - $width, $height, - $from, $to, - $this->getColor($color), - IMG_ARC_EDGED | IMG_ARC_NOFILL - ); - - } - - public function filledArc(awColor $color, awPoint $center, $width, $height, $from, $to) { - - imagefilledarc( - $this->resource, - $this->x + $center->x, $this->y + $center->y, - $width, $height, - $from, $to, - $this->getColor($color), - IMG_ARC_PIE - ); - - } - - public function ellipse(awColor $color, awPoint $center, $width, $height) { - - list($x, $y) = $center->getLocation(); - - $rgb = $this->getColor($color); - imageellipse( - $this->resource, - $this->x + $x, - $this->y + $y, - $width, - $height, - $rgb - ); - - } - - public function filledEllipse($background, awPoint $center, $width, $height) { - - if($background instanceof awColor) { - - list($x, $y) = $center->getLocation(); - - $rgb = $this->getColor($background); - - imagefilledellipse( - $this->resource, - $this->x + $x, - $this->y + $y, - $width, - $height, - $rgb - ); - - } else if($background instanceof awGradient) { - - list($x, $y) = $center->getLocation(); - - $x1 = $x - round($width / 2); - $y1 = $y - round($height / 2); - $x2 = $x1 + $width; - $y2 = $y1 + $height; - - $gradientDriver = new awGDGradientDriver($this); - $gradientDriver->filledEllipse( - $background, - $x1, $y1, - $x2, $y2 - ); - - } - - } - - public function rectangle(awColor $color, awLine $line) { - - list($p1, $p2) = $line->getLocation(); - - switch($line->getStyle()) { - - case awLine::SOLID : - $thickness = $line->getThickness(); - $this->startThickness($thickness); - $rgb = $this->getColor($color); - imagerectangle($this->resource, $this->x + $p1->x, $this->y + $p1->y, $this->x + $p2->x, $this->y + $p2->y, $rgb); - $this->stopThickness($thickness); - break; - - default : - - $side = clone $line; - - - - // Top side - $side->setLocation( - new awPoint($p1->x, $p1->y), - new awPoint($p2->x, $p1->y) - ); - $this->line($color, $side); - - // Right side - $side->setLocation( - new awPoint($p2->x, $p1->y), - new awPoint($p2->x, $p2->y) - ); - $this->line($color, $side); - - // Bottom side - $side->setLocation( - new awPoint($p1->x, $p2->y), - new awPoint($p2->x, $p2->y) - ); - $this->line($color, $side); - - // Left side - $side->setLocation( - new awPoint($p1->x, $p1->y), - new awPoint($p1->x, $p2->y) - ); - $this->line($color, $side); - - break; - - } - - } - - public function filledRectangle($background, awLine $line) { - - $p1 = $line->p1; - $p2 = $line->p2; - - if($background instanceof awColor) { - $rgb = $this->getColor($background); - imagefilledrectangle($this->resource, $this->x + $p1->x, $this->y + $p1->y, $this->x + $p2->x, $this->y + $p2->y, $rgb); - } else if($background instanceof awGradient) { - $gradientDriver = new awGDGradientDriver($this); - $gradientDriver->filledRectangle($background, $p1, $p2); - } - - } - - public function polygon(awColor $color, awPolygon $polygon) { - - switch($polygon->getStyle()) { - - case awPolygon::SOLID : - $thickness = $polygon->getThickness(); - $this->startThickness($thickness); - $points = $this->getPolygonPoints($polygon); - $rgb = $this->getColor($color); - imagepolygon($this->resource, $points, $polygon->count(), $rgb); - $this->stopThickness($thickness); - break; - - default : - - if($polygon->count() > 1) { - - $prev = $polygon->get(0); - - $line = new awLine; - $line->setStyle($polygon->getStyle()); - $line->setThickness($polygon->getThickness()); - - for($i = 1; $i < $polygon->count(); $i++) { - $current = $polygon->get($i); - $line->setLocation($prev, $current); - $this->line($color, $line); - $prev = $current; - } - - // Close the polygon - $line->setLocation($prev, $polygon->get(0)); - $this->line($color, $line); - - } - - } - - } - - public function filledPolygon($background, awPolygon $polygon) { - - if($background instanceof awColor) { - - $points = $this->getPolygonPoints($polygon); - $rgb = $this->getColor($background); - - imagefilledpolygon($this->resource, $points, $polygon->count(), $rgb); - - } else if($background instanceof awGradient) { - - $gradientDriver = new awGDGradientDriver($this); - $gradientDriver->filledPolygon($background, $polygon); - - } - - } - - public function send(awImage $image) { - - $this->drawImage($image); - - } - - public function get(awImage $image) { - - return $this->drawImage($image, TRUE, FALSE); - - } - - public function getTextWidth(awText $text) { - $font = $text->getFont(); - - if($font instanceof awPHPFont) { - $fontDriver = $this->phpFontDriver; - } else { - $fontDriver = $this->fileFontDriver; - } - - return $fontDriver->getTextWidth($text, $this); - } - - public function getTextHeight(awText $text) { - $font = $text->getFont(); - - if($font instanceof awPHPFont) { - $fontDriver = $this->phpFontDriver; - } else { - $fontDriver = $this->fileFontDriver; - } - - return $fontDriver->getTextHeight($text, $this); - } - - protected function isCompatibleWithFont(awFont $font) { - if($font instanceof awFDBFont) { - return FALSE; - } else { - return TRUE; - } - } - - private function drawImage(awImage $image, $return = FALSE, $header = TRUE) { - - $format = $image->getFormatString(); - - // Test if format is available - if((imagetypes() & $image->getFormat()) === FALSE) { - awImage::drawError("Class Image: Format '".$format."' is not available on your system. Check that your PHP has been compiled with the good libraries."); - } - - // Get some infos about this image - switch($format) { - case 'jpeg' : - $function = 'imagejpeg'; - break; - case 'png' : - $function = 'imagepng'; - break; - case 'gif' : - $function = 'imagegif'; - break; - } - - // Send headers to the browser - if($header === TRUE) { - $image->sendHeaders(); - } - - if($return) { - ob_start(); - } - - $function($this->resource); - - if($return) { - return ob_get_clean(); - } - } - - private function getPolygonPoints(awPolygon $polygon) { - - $points = array(); - - foreach($polygon->all() as $point) { - $points[] = $point->x + $this->x; - $points[] = $point->y + $this->y; - } - - return $points; - - } - - private function startThickness($thickness) { - - if($thickness > 1) { - - // Beurk :'( - if($this->antiAliasing and function_exists('imageantialias')) { - imageantialias($this->resource, FALSE); - } - imagesetthickness($this->resource, $thickness); - - } - - } - - private function stopThickness($thickness) { - - if($thickness > 1) { - - if($this->antiAliasing and function_exists('imageantialias')) { - imageantialias($this->resource, TRUE); - } - imagesetthickness($this->resource, 1); - - } - - } - - -} - -registerClass('GDDriver'); - -/** - * To your gradients - * - * @package Artichow - */ - -class awGDGradientDriver { - - /** - * A driver - * - * @var awGDDriver - */ - protected $driver; - - /** - * Build your GDGradientDriver - * - * @var awGDDriver $driver - */ - public function __construct(awGDDriver $driver) { - - $this->driver = $driver; - - } - - public function drawFilledFlatTriangle(awGradient $gradient, awPoint $a, awPoint $b, awPoint $c) { - - if($gradient->angle !== 0) { - awImage::drawError("Class GDGradientDriver: Flat triangles can only be used with 0 degree gradients."); - } - - // Look for right-angled triangle - if($a->x !== $b->x and $b->x !== $c->x) { - awImage::drawError("Class GDGradientDriver: Not right-angled flat triangles are not supported yet."); - } - - if($a->x === $b->x) { - $d = $a; - $e = $c; - } else { - $d = $c; - $e = $a; - } - - $this->init($gradient, $b->y - $d->y); - - for($i = $c->y + 1; $i < $b->y; $i++) { - - $color = $this->color($i - $d->y); - $pos = ($i - $d->y) / ($b->y - $d->y); - - $p1 = new awPoint($e->x, $i); - $p2 = new awPoint(1 + floor($e->x - $pos * ($e->x - $d->x)), $i); - - $this->driver->filledRectangle($color, new awLine($p1, $p2)); - - unset($color); - - } - - } - - protected function drawFilledTriangle(awGradient $gradient, awPolygon $polygon) { - - if($gradient->angle === 0) { - $this->drawFilledTriangleVertically($gradient, $polygon); - } elseif($gradient->angle === 90) { - $this->drawFilledTriangleHorizontally($gradient, $polygon); - } - - } - - private function drawFilledTriangleVertically(awGradient $gradient, awPolygon $polygon) { - list($yMin, $yMax) = $polygon->getBoxYRange(); - - $this->init($gradient, $yMax - $yMin); - - // Get the triangle line we will draw our lines from - $fromLine = NULL; - $lines = $polygon->getLines(); - - $count = count($lines); - - // Pick the side of the triangle going from the top - // to the bottom of the surrounding box - for($i = 0; $i < $count; $i++) { - if($lines[$i]->isTopToBottom($polygon)) { - list($fromLine) = array_splice($lines, $i, 1); - break; - } - } - - // If for some reason the three points are aligned, - // $fromLine will still be NULL - if($fromLine === NULL) { - return; - } - - $fillLine = NULL; - for($y = round($yMin); $y < round($yMax); $y++) { - - $fromX = $fromLine->getXFrom($y); - - $toX = array(); - foreach($lines as $line) { - $xValue = $line->getXFrom($y); - - if(!is_null($xValue)) { - $toX[] = $xValue; - } - } - - if(count($toX) === 1) { - $fillLine = new Line( - new Point($fromX, $y), - new Point($toX[0], $y) - ); - } else { - - $line1 = new Line( - new Point($fromX, $y), - new Point($toX[0], $y) - ); - $line2 = new Line( - new Point($fromX, $y), - new Point($toX[1], $y) - ); - - if($line1->getSize() < $line2->getSize()) { - $fillLine = $line1; - } else { - $fillLine = $line2; - } - } - - if(!$fillLine->isPoint()) { - $color = $this->color($y - $yMin); - $this->driver->line($color, $fillLine); - - unset($color); - } - } - - } - - private function drawFilledTriangleHorizontally(awGradient $gradient, awPolygon $polygon) { - list($xMin, $xMax) = $polygon->getBoxXRange(); - - $this->init($gradient, $xMax - $xMin); - - // Get the triangle line we will draw our lines from - $fromLine = NULL; - $lines = $polygon->getLines(); - - $count = count($lines); - - // Pick the side of the triangle going all the way - // from the left side to the right side of the surrounding box - for($i = 0; $i < $count; $i++) { - if($lines[$i]->isLeftToRight($polygon)) { - list($fromLine) = array_splice($lines, $i, 1); - break; - } - } - - // If for some reason the three points are aligned, - // $fromLine will still be NULL - if($fromLine === NULL) { - return; - } - - $fillLine = NULL; - for($x = round($xMin); $x < round($xMax); $x++) { - - $fromY = floor($fromLine->getYFrom($x)); - - $toY = array(); - foreach($lines as $line) { - $yValue = $line->getYFrom($x); - - if(!is_null($yValue)) { - $toY[] = floor($yValue); - } - } - - if(count($toY) === 1) { - $fillLine = new Line( - new Point($x, $fromY), - new Point($x, $toY[0]) - ); - } else { - - $line1 = new Line( - new Point($x, $fromY), - new Point($x, $toY[0]) - ); - $line2 = new Line( - new Point($x, $fromY), - new Point($x, $toY[1]) - ); - - if($line1->getSize() < $line2->getSize()) { - $fillLine = $line1; - } else { - $fillLine = $line2; - } - } - - $color = $this->color($x - $xMin); - if($fillLine->isPoint()) { - $this->driver->point($color, $fillLine->p1); - } elseif($fillLine->getSize() >= 1) { - $this->driver->line($color, $fillLine); - } - unset($color); - } - - } - - public function filledRectangle(awGradient $gradient, awPoint $p1, awPoint $p2) { - - list($x1, $y1) = $p1->getLocation(); - list($x2, $y2) = $p2->getLocation(); - - if($y1 < $y2) { - $y1 ^= $y2 ^= $y1 ^= $y2; - } - - if($x2 < $x1) { - $x1 ^= $x2 ^= $x1 ^= $x2; - } - - if($gradient instanceof awLinearGradient) { - $this->rectangleLinearGradient($gradient, new awPoint($x1, $y1), new awPoint($x2, $y2)); - } else { - awImage::drawError("Class GDGradientDriver: This gradient is not supported by rectangles."); - } - - } - - public function filledPolygon(awGradient $gradient, awPolygon $polygon) { - - if($gradient instanceof awLinearGradient) { - $this->polygonLinearGradient($gradient, $polygon); - } else { - awImage::drawError("Class GDGradientDriver: This gradient is not supported by polygons."); - } - - } - - protected function rectangleLinearGradient(awLinearGradient $gradient, awPoint $p1, awPoint $p2) { - - list($x1, $y1) = $p1->getLocation(); - list($x2, $y2) = $p2->getLocation(); - - if($y1 - $y2 > 0) { - - if($gradient->angle === 0) { - - $this->init($gradient, $y1 - $y2); - - for($i = $y2; $i <= $y1; $i++) { - - $color = $this->color($i - $y2); - - $p1 = new awPoint($x1, $i); - $p2 = new awPoint($x2, $i); - - $this->driver->filledRectangle($color, new awLine($p1, $p2)); - - unset($color); - - } - - } else if($gradient->angle === 90) { - - $this->init($gradient, $x2 - $x1); - - for($i = $x1; $i <= $x2; $i++) { - - $color = $this->color($i - $x1); - - $p1 = new awPoint($i, $y2); - $p2 = new awPoint($i, $y1); - - $this->driver->filledRectangle($color, new awLine($p1, $p2)); - - unset($color); - - } - - } - - } - - } - - public function filledEllipse(awGradient $gradient, $x1, $y1, $x2, $y2) { - - if($y1 < $y2) { - $y1 ^= $y2 ^= $y1 ^= $y2; - } - - if($x2 < $x1) { - $x1 ^= $x2 ^= $x1 ^= $x2; - } - - if($gradient instanceof awRadialGradient) { - $this->ellipseRadialGradient($gradient, $x1, $y1, $x2, $y2); - } else if($gradient instanceof awLinearGradient) { - $this->ellipseLinearGradient($gradient, $x1, $y1, $x2, $y2); - } else { - awImage::drawError("Class GDGradientDriver: This gradient is not supported by ellipses."); - } - - } - - protected function ellipseRadialGradient(awGradient $gradient, $x1, $y1, $x2, $y2) { - - if($y1 - $y2 > 0) { - - if($y1 - $y2 != $x2 - $x1) { - awImage::drawError("Class GDGradientDriver: Radial gradients are only implemented on circle, not ellipses."); - } - - $c = new awPoint($x1 + ($x2 - $x1) / 2, $y1 + ($y2 - $y1) / 2); - $r = ($x2 - $x1) / 2; - $ok = array(); - - // Init gradient - $this->init($gradient, $r); - - for($i = 0; $i <= $r; $i += 0.45) { - - $p = ceil((2 * M_PI * $i)); - - if($p > 0) { - $interval = 360 / $p; - } else { - $interval = 360; - } - - $color = $this->color($i); - - for($j = 0; $j < 360; $j += $interval) { - - $rad = ($j / 360) * (2 * M_PI); - - $x = round($i * cos($rad)); - $y = round($i * sin($rad)); - - $l = sqrt($x * $x + $y * $y); - - if($l <= $r) { - - if( - array_key_exists((int)$x, $ok) === FALSE or - array_key_exists((int)$y, $ok[$x]) === FALSE - ) { - - // Print the point - $this->driver->point($color, new awPoint($c->x + $x, $c->y + $y)); - - $ok[(int)$x][(int)$y] = TRUE; - - } - - } - - } - - unset($color); - - } - - } - - } - - protected function ellipseLinearGradient(awGradient $gradient, $x1, $y1, $x2, $y2) { - - // Gauche->droite : 90° - - if($y1 - $y2 > 0) { - - if($y1 - $y2 != $x2 - $x1) { - awImage::drawError("Class GDGradientDriver: Linear gradients are only implemented on circle, not ellipses."); - } - - $r = ($x2 - $x1) / 2; - - // Init gradient - $this->init($gradient, $x2 - $x1); - - for($i = -$r; $i <= $r; $i++) { - - $h = sin(acos($i / $r)) * $r; - - $color = $this->color($i + $r); - - if($gradient->angle === 90) { - - // Print the line - $p1 = new awPoint( - $x1 + $i + $r, - round(max($y2 + $r - $h + 1, $y2)) - ); - - $p2 = new awPoint( - $x1 + $i + $r, - round(min($y1 - $r + $h - 1, $y1)) - ); - - } else { - - // Print the line - $p1 = new awPoint( - round(max($x1 + $r - $h + 1, $x1)), - $y2 + $i + $r - ); - - $p2 = new awPoint( - round(min($x2 - $r + $h - 1, $x2)), - $y2 + $i + $r - ); - - } - - $this->driver->filledRectangle($color, new awLine($p1, $p2)); - - unset($color); - - } - - } - - } - - protected function polygonLinearGradient(awLinearGradient $gradient, awPolygon $polygon) { - - $count = $polygon->count(); - - if($count >= 4) { - - $left = $polygon->get(0); - $right = $polygon->get($count - 1); - - if($gradient->angle === 0) { - - // Get polygon maximum and minimum - $offset = $polygon->get(0); - $max = $min = $offset->y; - for($i = 1; $i < $count - 1; $i++) { - $offset = $polygon->get($i); - $max = max($max, $offset->y); - $min = min($min, $offset->y); - } - - $this->init($gradient, $max - $min); - - $prev = $polygon->get(1); - - $sum = 0; - - for($i = 2; $i < $count - 1; $i++) { - - $current = $polygon->get($i); - - $interval = 1; - - if($i !== $count - 2) { - $current->x -= $interval; - } - - if($current->x - $prev->x > 0) { - - // Draw rectangle - $x1 = $prev->x; - $x2 = $current->x; - $y1 = max($prev->y, $current->y); - $y2 = $left->y; - - $gradient = new awLinearGradient( - $this->color($max - $min - ($y2 - $y1)), - $this->color($max - $min), - 0 - ); - - if($y1 > $y2) { - $y2 = $y1; - } - - $this->driver->filledRectangle( - $gradient, - awLine::build($x1, $y1, $x2, $y2) - ); - - $top = ($prev->y < $current->y) ? $current : $prev; - $bottom = ($prev->y >= $current->y) ? $current : $prev; - - $gradient = new awLinearGradient( - $this->color($bottom->y - $min), - $this->color($max - $min - ($y2 - $y1)), - 0 - ); - - - $gradientDriver = new awGDGradientDriver($this->driver); - $gradientDriver->drawFilledFlatTriangle( - $gradient, - new awPoint($prev->x, min($prev->y, $current->y)), - $top, - new awPoint($current->x, min($prev->y, $current->y)) - ); - unset($gradientDriver); - - $sum += $current->x - $prev->x; - - } - - $prev = $current; - $prev->x += $interval; - - } - - } else if($gradient->angle === 90) { - - $width = $right->x - $left->x; - $this->init($gradient, $width); - - $pos = 1; - $next = $polygon->get($pos++); - - $this->next($polygon, $pos, $prev, $next); - - for($i = 0; $i <= $width; $i++) { - - $x = $left->x + $i; - - $y1 = round($prev->y + ($next->y - $prev->y) * (($i + $left->x - $prev->x) / ($next->x - $prev->x))); - $y2 = $left->y; - - // Draw line - $color = $this->color($i); - // YaPB : PHP does not handle alpha on lines - $this->driver->filledRectangle($color, awLine::build($x, $y1, $x, $y2)); - - unset($color); - - // Jump to next point - if($next->x == $i + $left->x) { - - $this->next($polygon, $pos, $prev, $next); - - } - - } - - } - - } else if($count === 3) { - $this->drawFilledTriangle( - $gradient, - $polygon - ); - } - - } - - private function next($polygon, &$pos, &$prev, &$next) { - - do { - $prev = $next; - $next = $polygon->get($pos++); - } - while($next->x - $prev->x == 0 and $pos < $polygon->count()); - - } - - /** - * Start colors - * - * @var int - */ - private $r1, $g1, $b1, $a1; - - /** - * Stop colors - * - * @var int - */ - private $r2, $g2, $b2, $a2; - - /** - * Gradient size in pixels - * - * @var int - */ - private $size; - - - private function init(awGradient $gradient, $size) { - - list( - $this->r1, $this->g1, $this->b1, $this->a1 - ) = $gradient->from->rgba(); - - list( - $this->r2, $this->g2, $this->b2, $this->a2 - ) = $gradient->to->rgba(); - - $this->size = $size; - } - - private function color($pos) { - - return new awColor( - $this->getRed($pos), - $this->getGreen($pos), - $this->getBlue($pos), - $this->getAlpha($pos) - ); - - } - - - private function getRed($pos) { - if((float)$this->size !== 0.0) { - return (int)round($this->r1 + ($pos / $this->size) * ($this->r2 - $this->r1)); - } else { - return 0; - } - } - - private function getGreen($pos) { - if((float)$this->size !== 0.0) { - return (int)round($this->g1 + ($pos / $this->size) * ($this->g2 - $this->g1)); - } else { - return 0; - } - } - - private function getBlue($pos) { - if((float)$this->size !== 0.0) { - return (int)round($this->b1 + ($pos / $this->size) * ($this->b2 - $this->b1)); - } else { - return 0; - } - } - - private function getAlpha($pos) { - if((float)$this->size !== 0.0) { - return (int)round(($this->a1 + ($pos / $this->size) * ($this->a2 - $this->a1)) / 127 * 100); - } else { - return 0; - } - } - -} - -registerClass('GDGradientDriver'); - -/* - * Check for GD2 - */ -if(function_exists('imagecreatetruecolor') === FALSE) { - awImage::drawErrorFile('missing-gd2'); -} - -?> \ No newline at end of file diff --git a/artichow/inc/drivers/ming.class.php b/artichow/inc/drivers/ming.class.php deleted file mode 100644 index 4c2e415..0000000 --- a/artichow/inc/drivers/ming.class.php +++ /dev/null @@ -1,774 +0,0 @@ -driverString = 'ming'; - - // Nice defaults - ming_setScale(20.0); - ming_useswfversion(6); - - } - - /** - * Initialize the driver for a particular awImage object - * - * @param awImage $image - */ - public function init(awImage $image) { - - if($this->movie === NULL) { - $this->setImageSize($image->width, $image->height); - - // Create movie - $this->movie = new SWFMovie(); - if(!$this->movie) { - awImage::drawError("Class Image: Unable to create a graph."); - } - - $this->movie->setDimension($image->width, $image->height); - - $this->setAntiAliasing($image->getAntiAliasing()); - - // Original color - $this->filledRectangle( - new awWhite, - new awLine( - new awPoint(0, 0), - new awPoint($this->imageWidth, $this->imageHeight) - ) - ); - - $shadow = $image->shadow; - if($shadow !== NULL) { - $shadow = $shadow->getSpace(); - $p1 = new awPoint($shadow->left, $shadow->top); - $p2 = new awPoint($this->imageWidth - $shadow->right - 1, $this->imageHeight - $shadow->bottom - 1); - - // Draw image background - $this->filledRectangle($image->getBackground(), new awLine($p1, $p2)); - - // Draw image border - $image->border->rectangle($this, $p1, $p2); - } - } - } - - /** - * Initialize the Driver for a particular FileImage object - * - * @param awFileImage $fileImage The FileImage object to work on - * @param string $file Image filename - */ - public function initFromFile(awFileImage $fileImage, $file) { - - } - - /** - * Change the image size - * - * @param int $width Image width - * @param int $height Image height - */ - public function setImageSize($width, $height) { - $this->imageWidth = $width; - $this->imageHeight = $height; - } - - /** - * Inform the driver of the position of your image - * - * @param float $x Position on X axis of the center of the component - * @param float $y Position on Y axis of the center of the component - */ - public function setPosition($x, $y) { - // Calculate absolute position - $this->x = round($x * $this->imageWidth - $this->w / 2); - $this->y = round($y * $this->imageHeight - $this->h / 2); - } - - /** - * Inform the driver of the position of your image - * This method need absolutes values - * - * @param int $x Left-top corner X position - * @param int $y Left-top corner Y position - */ - public function setAbsPosition($x, $y) { - $this->x = $x; - $this->y = $y; - } - - /** - * Move the position of the image - * - * @param int $x Add this value to X axis - * @param int $y Add this value to Y axis - */ - public function movePosition($x, $y) { - $this->x += (int)$x; - $this->y += (int)$y; - } - - /** - * Inform the driver of the size of your image - * Height and width must be between 0 and 1. - * - * @param int $w Image width - * @param int $h Image height - * @return array Absolute width and height of the image - */ - public function setSize($w, $h) { - - // Calcul absolute size - $this->w = round($w * $this->imageWidth); - $this->h = round($h * $this->imageHeight); - - return $this->getSize(); - - } - - /** - * Inform the driver of the size of your image - * You can set absolute size with this method. - * - * @param int $w Image width - * @param int $h Image height - */ - public function setAbsSize($w, $h) { - $this->w = $w; - $this->h = $h; - - return $this->getSize(); - } - - /** - * Get the size of the component handled by the driver - * - * @return array Absolute width and height of the component - */ - public function getSize() { - return array($this->w, $this->h); - } - - /** - * Turn antialiasing on or off - * - * @var bool $bool - */ - public function setAntiAliasing($bool) { - if($this->movie !== NULL) { - - $actionscript = ' - _quality = "%s"; - '; - - if((bool)$bool) { - $actionscript = sprintf($actionscript, 'high'); - } else { - $actionscript = sprintf($actionscript, 'low'); - } - - $this->movie->add(new SWFAction(str_replace("\r", "", $actionscript))); - } - } - - /** - * When passed a Color object, returns the corresponding - * color identifier (driver dependant). - * - * @param awColor $color A Color object - * @return array $rgba A color identifier representing the color composed of the given RGB components - */ - public function getColor(awColor $color) { - - // Ming simply works with R, G, B and Alpha values. - list($red, $green, $blue, $alpha) = $color->rgba(); - - // However, the Ming alpha channel ranges from 255 (opaque) to 0 (transparent), - // while the awColor alpha channel ranges from 0 (opaque) to 100 (transparent). - // First, we convert from 0-100 to 0-255. - $alpha = (int)($alpha * 255 / 100); - - // Then from 0-255 to 255-0. - $alpha = abs($alpha - 255); - - return array($red, $green, $blue, $alpha); - } - - /** - * Draw an image here - * - * @param awImage $image Image - * @param int $p1 Image top-left point - * @param int $p2 Image bottom-right point - */ - public function copyImage(awImage $image, awPoint $p1, awPoint $p2) { - - } - - /** - * Draw an image here - * - * @param awImage $image Image - * @param int $d1 Destination top-left position - * @param int $d2 Destination bottom-right position - * @param int $s1 Source top-left position - * @param int $s2 Source bottom-right position - * @param bool $resample Resample image ? (default to TRUE) - */ - public function copyResizeImage(awImage $image, awPoint $d1, awPoint $d2, awPoint $s1, awPoint $s2, $resample = TRUE) { - - } - - /** - * Draw a string - * - * @var awText $text Text to print - * @param awPoint $point Draw the text at this point - * @param int $width Text max width - */ - public function string(awText $text, awPoint $point, $width = NULL) { - $font = $text->getFont(); - - // Can we deal with that font? - if($this->isCompatibleWithFont($font) === FALSE) { - awImage::drawError('Class MingDriver: Incompatible font type (\''.get_class($font).'\')'); - } - - // Ming can only work with awFileFont objects for now - // (i.e. awFDBFont, or awTuffy et al.) - $fontDriver = $this->fileFontDriver; - - if($text->getBackground() !== NULL or $text->border->visible()) { - - list($left, $right, $top, $bottom) = $text->getPadding(); - - $textWidth = $fontDriver->getTextWidth($text, $this); - $textHeight = $fontDriver->getTextHeight($text, $this); - - $x1 = floor($point->x - $left); - $y1 = floor($point->y - $top); - $x2 = $x1 + $textWidth + $left + $right; - $y2 = $y1 + $textHeight + $top + $bottom; - - $this->filledRectangle( - $text->getBackground(), - awLine::build($x1, $y1, $x2, $y2) - ); - - $text->border->rectangle( - $this, - new awPoint($x1 - 1, $y1 - 1), - new awPoint($x2 + 1, $y2 + 1) - ); - - } - - $fontDriver->string($this, $text, $point, $width); - } - - /** - * Draw a pixel - * - * @param awColor $color Pixel color - * @param awPoint $p - */ - public function point(awColor $color, awPoint $p) { - if($p->isHidden() === FALSE) { - list($red, $green, $blue, $alpha) = $this->getColor($color); - - $point = new SWFShape(); - $point->setLine(1, $red, $green, $blue, $alpha); - $point->movePenTo($this->x + round($p->x), $this->y + round($p->y)); - $point->drawLine(0.5, 0.5); - $point->movePen(-0.5, 0); - $point->drawLine(0.5, -0.5); - - $this->movie->add($point); - } - } - - /** - * Draw a colored line - * - * @param awColor $color Line color - * @param awLine $line - * @param int $thickness Line tickness - */ - public function line(awColor $color, awLine $line) { - if($line->getThickness() > 0 and $line->isHidden() === FALSE) { - - list($red, $green, $blue, $alpha) = $this->getColor($color); - - $mingLine = new SWFShape(); - $mingLine->setLine($line->getThickness(), $red, $green, $blue, $alpha); - - list($p1, $p2) = $line->getLocation(); - - $mingLine->movePenTo($this->x + round($p1->x), $this->y + round($p1->y)); - - switch($line->getStyle()) { - - case awLine::SOLID : - $mingLine->drawLineTo($this->x + round($p2->x), $this->y + round($p2->y)); - $this->movie->add($mingLine); - break; - - case awLine::DOTTED : - $size = sqrt(pow($p2->y - $p1->y, 2) + pow($p2->x - $p1->x, 2)); - $cos = ($p2->x - $p1->x) / $size; - $sin = ($p2->y - $p1->y) / $size; - - for($i = 0; $i <= $size; $i += 2) { - $p = new awPoint( - round($i * $cos + $p1->x), - round($i * $sin + $p1->y) - ); - $this->point($color, $p); - } - - break; - - case awLine::DASHED : - $width = $p2->x - $p1->x; - $height = $p2->y - $p1->y; - $size = sqrt(pow($height, 2) + pow($width, 2)); - - if($size == 0) { - return; - } - - $cos = $width / $size; - $sin = $height / $size; - - $functionX = ($width > 0) ? 'min' : 'max'; - $functionY = ($height > 0) ? 'min' : 'max'; - - for($i = 0; $i <= $size; $i += 6) { - - $t1 = new awPoint( - round($i * $cos + $p1->x), - round($i * $sin + $p1->y) - ); - - $t2 = new awPoint( - round($functionX(($i + 3) * $cos, $width) + $p1->x), - round($functionY(($i + 3) * $sin, $height) + $p1->y) - ); - - $this->line($color, new awLine($t1, $t2)); - - } - - break; - - } - - } - - } - - /** - * Draw a color arc - - * @param awColor $color Arc color - * @param awPoint $center Point center - * @param int $width Ellipse width - * @param int $height Ellipse height - * @param int $from Start angle - * @param int $to End angle - */ - public function arc(awColor $color, awPoint $center, $width, $height, $from, $to) { - - } - - /** - * Draw an arc with a background color - * - * @param awColor $color Arc background color - * @param awPoint $center Point center - * @param int $width Ellipse width - * @param int $height Ellipse height - * @param int $from Start angle - * @param int $to End angle - */ - public function filledArc(awColor $color, awPoint $center, $width, $height, $from, $to) { - - } - - /** - * Draw a colored ellipse - * - * @param awColor $color Ellipse color - * @param awPoint $center Ellipse center - * @param int $width Ellipse width - * @param int $height Ellipse height - */ - public function ellipse(awColor $color, awPoint $center, $width, $height) { - - } - - /** - * Draw an ellipse with a background - * - * @param mixed $background Background (can be a color or a gradient) - * @param awPoint $center Ellipse center - * @param int $width Ellipse width - * @param int $height Ellipse height - */ - public function filledEllipse($background, awPoint $center, $width, $height) { - - } - - /** - * Draw a colored rectangle - * - * @param awColor $color Rectangle color - * @param awLine $line Rectangle diagonale - * @param awPoint $p2 - */ - public function rectangle(awColor $color, awLine $line) { - list($p1, $p2) = $line->getLocation(); - - // Get Red, Green, Blue and Alpha values for the line - list($r, $g, $b, $a) = $this->getColor($color); - - // Calculate the coordinates of the two other points of the rectangle - $p3 = new Point($p1->x, $p2->y); - $p4 = new Point($p2->x, $p1->y); - - - $side = clone $line; - - - - // Draw the four sides of the rectangle, clockwise - if( - ($p1->x <= $p2->x and $p1->y <= $p2->y) - or - ($p1->x >= $p2->x and $p1->y >= $p2->y) - ) { - $side->setLocation($p1, $p4); - $this->line($color, $side); - - $side->setLocation($p4, $p2); - $this->line($color, $side); - - $side->setLocation($p2, $p3); - $this->line($color, $side); - - $side->setLocation($p3, $p1); - $this->line($color, $side); - } else { - $side->setLocation($p1, $p3); - $this->line($color, $side); - - $side->setLocation($p3, $p2); - $this->line($color, $side); - - $side->setLocation($p2, $p4); - $this->line($color, $side); - - $side->setLocation($p4, $p1); - $this->line($color, $side); - } - } - - /** - * Draw a rectangle with a background - * - * @param mixed $background Background (can be a color or a gradient) - * @param awLine $line Rectangle diagonale - */ - public function filledRectangle($background, awLine $line) { - list($p1, $p2) = $line->getLocation(); - - // Common shape settings - $shape = new SWFShape(); - $shape->setLine(0); - - if($background instanceof awColor) { - - // Get the Red, Green, Blue and Alpha values - list($r, $g, $b, $a) = $this->getColor($background); - $shape->setRightFill($r, $g, $b, $a); - - } else if($background instanceof awGradient) { - - // Get the Gradient object as an SWFGradient one - list($flashGradient, $style) = $this->getGradient($background); - - $fill = $shape->addFill($flashGradient, $style); - - // Angles between Artichow and Ming don't match. - // Don't use abs() or vertical gradients get inverted. - $angle = $background->angle - 90; - $fill->rotateTo($angle); - - // Move the gradient based on the position of the rectangle we're drawing - $centerX = min($p1->x, $p2->y) + abs($p1->x - $p2->x) / 2; - $centerY = min($p1->y, $p2->y) + abs($p1->y - $p2->y) / 2; - $fill->moveTo($centerX, $centerY); - - // Ming draws its gradients on a 1600x1600 image, - // so we have to resize it. - if($angle === -90) { - $ratio = abs($p1->y - $p2->y) / 1600; - } else { - $ratio = abs($p1->x - $p2->x) / 1600; - } - $fill->scaleTo($ratio); - - $shape->setRightFill($fill); - - } - - // Set starting position - $shape->movePenTo($this->x + round($p1->x), $this->y + round($p1->y)); - - // Depending on the points' relative positions, - // we have two drawing possibilities - if( - ($p1->x <= $p2->x and $p1->y <= $p2->y) - or - ($p1->x >= $p2->x and $p1->y >= $p2->y) - ) { - $shape->drawLineTo($this->x + round($p2->x), $this->y + round($p1->y)); - $shape->drawLineTo($this->x + round($p2->x), $this->y + round($p2->y)); - $shape->drawLineTo($this->x + round($p1->x), $this->y + round($p2->y)); - $shape->drawLineTo($this->x + round($p1->x), $this->y + round($p1->y)); - } else { - $shape->drawLineTo($this->x + round($p1->x), $this->y + round($p2->y)); - $shape->drawLineTo($this->x + round($p2->x), $this->y + round($p2->y)); - $shape->drawLineTo($this->x + round($p2->x), $this->y + round($p1->y)); - $shape->drawLineTo($this->x + round($p1->x), $this->y + round($p1->y)); - } - - $this->movie->add($shape); - } - - /** - * Draw a polygon - * - * @param awColor $color Polygon color - * @param Polygon A polygon - */ - public function polygon(awColor $color, awPolygon $polygon) { - $points = $polygon->all(); - $count = count($points); - - if($count > 1) { - - $side = new awLine; - $side->setStyle($polygon->getStyle()); - $side->setThickness($polygon->getThickness()); - - $prev = $points[0]; - - for($i = 1; $i < $count; $i++) { - $current = $points[$i]; - $side->setLocation($prev, $current); - $this->line($color, $side); - $prev = $current; - } - - // Close the polygon - $side->setLocation($prev, $points[0]); - $this->line($color, $side); - } - } - - /** - * Draw a polygon with a background - * - * @param mixed $background Background (can be a color or a gradient) - * @param Polygon A polygon - */ - public function filledPolygon($background, awPolygon $polygon) { - $shape = new SWFShape(); - - if($background instanceof awColor) { - list($red, $green, $blue, $alpha) = $this->getColor($background); - - $shape->setRightFill($red, $green, $blue, $alpha); - } elseif($background instanceof awGradient) { - list($flashGradient, $style) = $this->getGradient($background); - - $fill = $shape->addFill($flashGradient, $style); - - list($xMin, $xMax) = $polygon->getBoxXRange(); - list($yMin, $yMax) = $polygon->getBoxYRange(); - - if($background->angle === 0) { - $fill->scaleTo(($yMax - $yMin) / 1600); - } else { - $fill->scaleTo(($xMax - $xMin) / 1600); - } - $fill->moveTo($xMin + ($xMax - $xMin) / 2, $yMin + ($yMax - $yMin) / 2); - - $shape->setRightFill($fill); - } - - $points = $polygon->all(); - $count = count($points); - - if($count > 1) { - - $prev = $points[0]; - - $shape->movePenTo($prev->x, $prev->y); - - for($i = 1; $i < $count; $i++) { - $current = $points[$i]; - $shape->drawLineTo($current->x, $current->y); - } - - // Close the polygon - $shape->drawLineTo($prev->x, $prev->y); - - $this->movie->add($shape); - - } - } - - /** - * Sends the image, as well as the correct HTTP headers, to the browser - * - * @param awImage $image The Image object to send - */ - public function send(awImage $image) { - $this->drawImage($image); - } - - /** - * Get the image as binary data - * - * @param awImage $image - */ - public function get(awImage $image) { - return $this->drawImage($image, TRUE, FALSE); - } - - public function getTextWidth(awText $text) { - $font = $text->getFont(); - if($this->isCompatibleWithFont($font) === FALSE) { - awImage::drawError('Class MingDriver: Incompatible font type (\''.get_class($font).'\')'); - } - - // Ming only supports FileFont - $fontDriver = $this->fileFontDriver; - - return $fontDriver->getTextWidth($text, $this); - } - - public function getTextHeight(awText $text) { - $font = $text->getFont(); - if($this->isCompatibleWithFont($font) === FALSE) { - awImage::drawError('Class MingDriver: Incompatible font type (\''.get_class($font).'\')'); - } - - // Ming only supports FileFont - $fontDriver = $this->fileFontDriver; - - return $fontDriver->getTextHeight($text, $this); - } - - protected function isCompatibleWithFont(awFont $font) { - if($font instanceof awTTFFont or $font instanceof awPHPFont) { - return FALSE; - } else { - return TRUE; - } - } - - private function drawImage(awImage $image, $return = FALSE, $header = TRUE) { - - // Send headers to the browser - if($header === TRUE) { - $image->sendHeaders(); - } - - if($return) { - ob_start(); - } - - $this->movie->output(); - - if($return) { - return ob_get_clean(); - } - } - - /** - * Convert an awGradient object to an SWFGradient one. - * Returns an object as well as the style of the Flash gradient. - * - * @param awGradient $gradient The awGradient object to convert - * @return array - */ - private function getGradient(awGradient $gradient) { - $flashGradient = new SWFGradient(); - - // Get RGBA values for the gradient boundaries - list($r1, $g1, $b1, $a1) = $this->getColor($gradient->from); - list($r2, $g2, $b2, $a2) = $this->getColor($gradient->to); - - $flashGradient->addEntry(0, $r1, $g1, $b1, $a1); - - if($gradient instanceof awBilinearGradient) { - - $flashGradient->addEntry($gradient->center, $r2, $g2, $b2, $a2); - $flashGradient->addEntry(1, $r1, $g1, $b1, $a1); - - return array($flashGradient, SWFFILL_LINEAR_GRADIENT); - } else { - - $flashGradient->addEntry(1, $r2, $g2, $b2, $a2); - - if($gradient instanceof awLinearGradient) { - return array($flashGradient, SWFFILL_LINEAR_GRADIENT); - } else { - return array($flashGradient, SWFFILL_RADIAL_GRADIENT); - } - } - } -// abstract private function getPolygonPoints(awPolygon $polygon); - -} - -registerClass('MingDriver'); - -/* - * Check for ming presence - */ -if(function_exists('ming_useswfversion') === FALSE) { - awImage::drawErrorFile('missing-ming'); -} - -?> \ No newline at end of file diff --git a/artichow/patterns/BarDepth.php b/artichow/patterns/BarDepth.php deleted file mode 100644 index 5d040b7..0000000 --- a/artichow/patterns/BarDepth.php +++ /dev/null @@ -1,85 +0,0 @@ -barShadow->setSize(2); - $plot->barShadow->smooth(TRUE); - $plot->barShadow->setColor(new Color(160, 160, 160, 10)); - - return $plot; - - } - - public function create() { - - $group = new PlotGroup; - $group->setSpace(2, 2, 2, 0); - $group->setPadding(30, 10, NULL, NULL); - - $group->grid->hideVertical(TRUE); - $group->grid->setType(Line::DASHED); - - $yForeground = $this->getArg('yForeground'); - $yBackground = $this->getArg('yBackground'); - - $legendForeground = $this->getArg('legendForeground'); - $legendBackground = $this->getArg('legendBackground'); - - $colorForeground = $this->getArg('colorForeground', new LightBlue(10)); - $colorBackground = $this->getArg('colorBackground', new Orange(25)); - - if($yForeground === NULL) { - awImage::drawError("Class BarDepthPattern: Argument 'yForeground' must not be NULL."); - } - - // Background - if($yBackground !== NULL) { - - $plot = $this->getPlot($yBackground, 6); - $plot->setBarColor($colorBackground); - - $group->add($plot); - if($legendBackground !== NULL) { - $group->legend->add($plot, $legendBackground, Legend::BACKGROUND); - } - - } - - // Foreground - $plot = $this->getPlot($yForeground, 0); - $plot->setBarColor($colorForeground); - - $group->add($plot); - if($legendForeground !== NULL) { - $group->legend->add($plot, $legendForeground, Legend::BACKGROUND); - } - - $group->axis->bottom->hideTicks(TRUE); - - $group->legend->shadow->setSize(0); - $group->legend->setAlign(Legend::CENTER); - $group->legend->setSpace(6); - $group->legend->setTextFont(new Tuffy(8)); - $group->legend->setPosition(0.50, 0.10); - $group->legend->setBackgroundColor(new Color(255, 255, 255, 10)); - $group->legend->setColumns(2); - - return $group; - - } - -} -?> \ No newline at end of file diff --git a/artichow/patterns/LightLine.php b/artichow/patterns/LightLine.php deleted file mode 100644 index a132d9e..0000000 --- a/artichow/patterns/LightLine.php +++ /dev/null @@ -1,50 +0,0 @@ -getArg('legend'); - - $y = $this->getArg('y'); - - if($y === NULL) { - awImage::drawError("Class LightLinePattern: Argument 'y' must not be NULL."); - } - - $plot = new LinePlot($y); - $plot->setSize(0.7, 1); - $plot->setCenter(0.35, 0.5); - $plot->setPadding(35, 15, 35, 30); - $plot->setColor(new Orange()); - $plot->setFillColor(new LightOrange(80)); - - $plot->grid->setType(Line::DASHED); - - $plot->mark->setType(Mark::CIRCLE); - $plot->mark->setFill(new MidRed); - $plot->mark->setSize(6); - - $plot->legend->setPosition(1, 0.5); - $plot->legend->setAlign(Legend::LEFT); - $plot->legend->shadow->smooth(TRUE); - - if($legend !== NULL) { - $plot->legend->add($plot, $legend, Legend::MARK); - } - - return $plot; - - } - -} -?> \ No newline at end of file diff --git a/game/Aflottes.php b/game/Aflottes.php new file mode 100644 index 0000000..1638d46 --- /dev/null +++ b/game/Aflottes.php @@ -0,0 +1,374 @@ +connexion(); +$queryFlottes = $bdd->query("SELECT * FROM $table_flottes WHERE id_user = '$id_user' OR (end_galaxie = '$Hgalaxie' AND end_ss = '$Hss' AND end_position = '$Hposition');"); +$bdd->deconnexion(); +$nbFlottes = $bdd->num_rows; +for ($i = 0; $i < $nbFlottes; $i++) { + //Récupération des principales variables de la flotte + $id_flotte = $queryFlottes[$i]['id']; + $mission = $queryFlottes[$i]['mission']; + $end_galaxie = $queryFlottes[$i]['end_galaxie']; + $end_ss = $queryFlottes[$i]['end_ss']; + $end_position = $queryFlottes[$i]['end_position']; + $end_time = $queryFlottes[$i]['start_time'] + $queryFlottes[$i]['end_time']; + //On vérifie que la planète cible existe + + $bdd->connexion(); + $queryEN = $bdd->unique_query("SELECT * FROM $table_planete WHERE galaxie = '$end_galaxie' AND ss = '$end_ss' AND position = '$end_position';"); + if (!$queryEN && $mission != 3 && $mission != 6 && time() > $end_time) { + $bdd->query("UPDATE $table_flottes SET effectue = '1', mission = '6', ret_time = '".($end_time + $queryFlottes[$i]['end_time'])."' WHERE id = $id_flotte;"); + $titreA = 'Impossible d\'effectuer la mission'; + $bdd->escape($titreA); + $rapportA = 'La flotte '.$queryFlottes[$i]['nom_flotte'].' n\'a pas pu effectuer sa mission correctement car lorsqu\'elle est arrivée sur place, la planète était déserte.'; + $bdd->escape($rapportA); + $db->query("INSERT INTO $table_mail (destinataire, expediteur, sujet, contenu, temps) VALUES(".$queryFlottes[$i]['id_user'].", '', '$titreA', '$rapportA', '".$end_time."')"); + $bdd->deconnexion(); + continue; + } + elseif (!$queryEN && $mission != 3 && $queryFlottes[$i]['effectue'] != 1) { + $bdd->deconnexion(); + continue; + } + $bdd->deconnexion(); + $ENidPlan = $queryEN['id']; + + //La flotte est prête a effectuer une action + if ($queryFlottes[$i]['effectue'] != 1 && time() >= $queryFlottes[$i]['start_time'] + $queryFlottes[$i]['end_time'] && !empty($queryFlottes[$i]['end_time'])) { + //Mission Attaquer + if ($mission == 1) { + require_once(_FCORE."../game/Class/class.combat.php"); + $bdd->connexion(); + //On regarde si le combat a déjà commencé + if ($queryFlottes[$i]['effectue'] == 2) { + if ($queryCombat = $bdd->unique_query("SELECT * FROM $table_flottes_combats WHERE refflotte = '$id_flotte';")) { + //On vérifie si on lance le tour suivant ou non + if (time() >= $queryCombat['timestamp']) { + //On modifie le timestamp pour ne pas que le combat se déroule deux fois + $timebloque = time() + 5; + $bdd->query("UPDATE $table_flottes_combats SET timestamp = '$timebloque' WHERE refflotte = '$id_flotte';"); + + //Récupération du combat + $combat = unserialize($queryCombat['serialize']); + //Mise à jour des tactiques + if (!empty($queryFlottes[$i]['tactiqueAT'])) $combat->changerTactiqueAT($queryFlottes[$i]['tactiqueAT']); + if (!empty($queryFlottes[$i]['tactiqueEN'])) $combat->changerTactiqueEN($queryFlottes[$i]['tactiqueEN']); + } + else continue; + } + else { + $time = time(); + $bdd->query("UPDATE $table_flottes SET effectue = '1', ret_time = end_time + $time WHERE id = '$id_flotte';"); + file_log("Erreur dans le script de combat, la flotte de ".trouvNom($queryFlottes[$i]['id_user'])."(".$queryFlottes[$i]['id_user'].") a été renvoyé au point de départ.", 1); + header('Location: ./?erreurcombat'); + exit; + } + } + else { + //On génére un nouveau combat + $combat = new Combat($queryFlottes[$i], $queryEN, $queryEN, array(trouvInfo($queryFlottes[$i]['id_user'], 'blindage'), trouvInfo($queryEN['id_user'], 'blindage'))); + $bdd->query("UPDATE $table_flottes SET effectue = '2' WHERE id = '$id_flotte';"); + } + $bdd->deconnexion(); + + while($combat->timestamp <= time()) { + //Préparation du rapport + $rapport = new Rapport($mission, $queryFlottes[$i]['id_user'], $queryEN['id_user'], $combat->timestamp); + + $combat->Ntour++; + $rapport->addInfo($combat->ATvais, 0); + $rapport->addInfo($combat->ENvais, 1); + $rapport->addInfo($combat->ENdef, 2); + $rapport->addInfo($combat->Ntour, 3); + $rapport->addInfo($queryEN, 4); + $rapport->addInfo($queryFlottes[$i], 5); + + //Récupération des paramètres de la tactique de l'attaquant + $arraytactique = tactique($combat->ATtactique); + //On régénére les boucliers de l'attaquant et on calcul l'attaque de l'attaquant + $ATattaque = $combat->calcAttaque($arraytactique[2] + $combat->regenereBC($arraytactique[1], true, !$arraytactique[3], trouvInfo($queryFlottes[$i]['id_user'], 'blindage')), true, trouvInfo($queryFlottes[$i]['id_user'], 'armement')); + + //Récupération des paramètres de la tactique du défenseur + $arraytactique = tactique($combat->ENtactique); + //On régénére les boucliers de l'attaquant et on calcul l'attaque de l'attaquant + $ENattaque = $combat->calcAttaque($arraytactique[2] + $combat->regenereBC($arraytactique[1], false, !$arraytactique[3], trouvInfo($queryEN['id_user'], 'blindage')), false, trouvInfo($queryEN['id_user'], 'armement')); + + //On lance l'attaque + @$ATresult = $combat->attaquerVais($ATattaque, true); + @$ENresult = $combat->attaquerVais($ENattaque, false); + + if (!$ATresult && $ENresult) { //Attaquant vainqueur + $combat->ENres['metal'] = $queryEN['metal']; + $combat->ENres['cristal'] = $queryEN['cristal']; + $combat->ENres['hydrogene'] = $queryEN['hydrogene']; + + $exportAT = $combat->exportAT(true); $ret_time = $combat->timestamp; + $exportEN = $combat->exportEN(); $pillm = $combat->pillage[0]; $pillc = $combat->pillage[1]; $pillh = $combat->pillage[2]; + $bdd->connexion(); + $bdd->query("UPDATE $table_flottes SET $exportAT, effectue = '1', ret_time = '$ret_time' + end_time WHERE id = '$id_flotte';"); + $bdd->query("UPDATE $table_planete SET $exportEN, metal = metal - '$pillm', cristal = cristal - '$pillc', hydrogene = hydrogene - '$pillh' WHERE id = '$ENidPlan';"); + $bdd->query("DELETE FROM $table_flottes_combats WHERE refflotte = '$id_flotte';"); + $bdd->deconnexion(); + $rapport->addInfo(array(true, true, false), 6); + } + elseif ($ATresult && !$ENresult) { //Défenseur vainqueur + $exportEN = $combat->exportEN(); + $bdd->connexion(); + $bdd->query("DELETE FROM $table_flottes_combats WHERE refflotte = '$id_flotte';"); + $bdd->query("DELETE FROM $table_flottes WHERE id = '$id_flotte';"); + $bdd->query("UPDATE $table_planete SET $exportEN WHERE id = '$ENidPlan';"); + $bdd->deconnexion(); + $rapport->addInfo(array(true, false, false), 6); + } + elseif (!$ATresult && !$ENresult) { //Match nul + $exportEN = $combat->exportEN(); + $bdd->connexion(); + $bdd->query("DELETE FROM $table_flottes_combats WHERE refflotte = '$id_flotte';"); + $bdd->query("DELETE FROM $table_flottes WHERE id = '$id_flotte';"); + $bdd->query("UPDATE $table_planete SET $exportEN WHERE id = '$ENidPlan';"); + $bdd->deconnexion(); + $rapport->addInfo(array(true, false, true), 6); + } + elseif ($combat->Ntour >= 250) { //Match nul + $exportAT = $combat->exportAT(false); $ret_time = $combat->timestamp; + $exportEN = $combat->exportEN(); $pillm = $combat->pillage[0]; $pillc = $combat->pillage[1]; $pillh = $combat->pillage[2]; + $bdd->connexion(); + $bdd->query("UPDATE $table_flottes SET $exportAT, effectue = '1', ret_time = '$ret_time' + end_time WHERE id = '$id_flotte';"); + $bdd->query("UPDATE $table_planete SET $exportEN, metal = metal - '$pillm', cristal = cristal - '$pillc', hydrogene = hydrogene - '$pillh' WHERE id = '$ENidPlan';"); + $bdd->query("DELETE FROM $table_flottes_combats WHERE refflotte = '$id_flotte';"); + $bdd->deconnexion(); + $rapport->addInfo(array(true, false, true), 6); + } + else $rapport->addInfo(array(false, false, false), 6); + + $rapport->addInfo($combat->ATvais, 7); + $rapport->addInfo($combat->ENvais, 8); + $rapport->addInfo($combat->ENdef, 9); + + //Prévision du prochain tour + $combat->timestamp += 300; + $rapport->addInfo($combat->timestamp, 10); + $rapport->addInfo($combat->pillage, 11); + + //On envoie les rapports aux joueurs concernés + $rapport->send(); + + //On arrête la boucle si le combat est terminé + if ($rapport->var[6][0]) break; + } + $debriM = $combat->debriM + $queryEN['debris_met']; + $debriC = $combat->debriC + $queryEN['debris_cri']; + + $bdd->connexion(); + $bdd->escape($debriM); + $bdd->escape($debriC); + + $bdd->query("UPDATE $table_planete SET debris_met = $debriM, debris_cri = $debriC WHERE galaxie = '$end_galaxie' AND ss = '$end_ss' AND position = '$end_position';"); + + $combat->debriM = 0; + $combat->debriC = 0; + if (!$rapport->var[6][0]) { //Si le combat n'est pas terminé + //On sérialise la classe pour l'exporter + $serialise = serialize($combat); + $bdd->escape($serialise); + + //On enregistre le combat dans la base de données + $timesuite = $combat->timestamp; + $idFleet = $queryFlottes[$i]['id']; + if ($queryFlottes[$i]['effectue']) $bdd->query("UPDATE $table_flottes_combats SET serialize = '$serialise', tactiqueAT = '0', tactiqueEN = '0', timestamp = '$timesuite' WHERE refflotte = '$id_flotte';"); + else $bdd->query("INSERT INTO $table_flottes_combats (refflotte, timestamp, serialize, tactiqueAT, tactiqueEN) VALUES('$idFleet', '$timesuite', '$serialise', '0', '0');"); + } + $bdd->deconnexion(); + } + //Mission Transporter + elseif ($mission == 2) { + $Cmetal = $queryFlottes[$i]['contenu_metal']; + $Ccristal = $queryFlottes[$i]['contenu_cristal']; + $Chydrogene = $queryFlottes[$i]['contenu_hydrogene']; + $bdd->connexion(); + $bdd->query("UPDATE $table_planete SET metal = metal + '$Cmetal', cristal = cristal + '$Ccristal', hydrogene = hydrogene + '$Chydrogene' WHERE galaxie = '$end_galaxie' AND ss = '$end_ss' AND position = '$end_position';"); + $bdd->query("UPDATE $table_flottes SET effectue = '1', contenu_metal = '0', contenu_cristal = '0', contenu_hydrogene = '0' WHERE id = '$id_flotte';"); + $bdd->deconnexion(); + + $rapport = new Rapport($mission, $queryFlottes[$i]['id_user'], $queryEN['id_user'], $end_time); + $rapport->addInfo($queryEN, 0); + $rapport->addInfo(array($queryFlottes[$i]['contenu_metal'], $queryFlottes[$i]['contenu_cristal'], $queryFlottes[$i]['contenu_hydrogene']), 1); + $rapport->send(); + } + //Mission Coloniser + elseif ($mission == 3) { + $rapport = new Rapport($mission, $queryFlottes[$i]['id_user'], 0, $end_time); + $rapport->addInfo(array($end_galaxie, $end_ss, $end_position), 0); + + $rapport->addInfo(true, 1); + $time = time(); + $cases = mt_rand(125,222); + $image = mt_rand(1,15); + $Cmetal = $queryFlottes[$i]['contenu_metal'] + 1000; + $Ccristal = $queryFlottes[$i]['contenu_cristal'] + 700; + $Chydrogene = $queryFlottes[$i]['contenu_hydrogene']; + + //Calcul de l'isolement + $nbPlan = count($queryPlanetes); + if ($nbPlan >= 11) { + switch($nbPlan){ + case 11: $tps = 2; break; + case 12: $tps = 4; break; + case 13: $tps = 6; break; + case 14: $tps = 8; break; + case 15: $tps = 12; break; + case 16: $tps = 16; break; + case 17: $tps = 20; break; + default: $tps = 24; + } + } + else $tps = 0; + $debut = mktime(rand(0, 24-$tps), 0, 0, date('n'), date('j'), date('Y')); + $fin = $debut + $tps * 3600; + + $idFlo = $queryFlottes[$i]['id_user']; + $bdd->connexion(); + if ($bdd->query("INSERT INTO $table_planete (id_user, isolement, nom_planete, galaxie, ss, position, image, cases, timestamp, metal, cristal, hydrogene, hash_planete) VALUES ('$idFlo', '$debut $fin', 'Planète colonisée', '$end_galaxie', '$end_ss', '$end_position', '$image', '$cases', '$time', '$Cmetal', '$Ccristal', '$Chydrogene', SHA1(CONCAT('g',planete.galaxie,'s',planete.ss,'p',planete.position)));") === false) { + $rapport->addInfo(false, 1); + $bdd->query("UPDATE $table_flottes SET effectue = 1 WHERE id = $id_flotte;"); + $bdd->deconnexion(); + } + else { + if ($queryFlottes[$i]['nb_vais'] == 1) { + $queryFlottes[$i]['nb_vais'] = -1; + $bdd->query("DELETE FROM $table_flottes WHERE id = $id_flotte"); + } + else $bdd->query("UPDATE $table_flottes SET effectue = 1, vaisseau_3 = vaisseau_3 - 1, nb_vais = nb_vais - 1, contenu_metal = 0, contenu_cristal = 0, contenu_hydrogene = 0 WHERE id = $id_flotte;"); + $bdd->deconnexion(); + } + $rapport->send(); + } + //Mission Recycler + elseif ($mission == 4) { + $capacite = $queryFlottes[$i]['contenu_max'] - (vais_conso($queryFlottes[$i]['end_time'], count($queryFlottes[$i]['nb_vais']))*$queryFlottes[$i]['vitesse']*5) + $queryFlottes[$i]['contenu_metal'] + $queryFlottes[$i]['contenu_cristal'] + $queryFlottes[$i]['contenu_hydrogene']; + + $debris_met = $queryEN['debris_met']; + $debris_cri = $queryEN['debris_cri']; + + if ($debris_met+$debris_cri > $capacite) { + $a = floor($capacite/2); + $b = floor($capacite/2); + if ($a > $debris_met && $b > $debris_cri) { + $a = $debris_met; + $b = $debris_cri; + } + else if ($a > $debris_met) { + $a = $debris_met; + $b = ($capacite - $a); + if ($b > $debris_cri) $b = $debris_cri; + } + else if ($b > $debris_cri) { + $b = $debris_cri; + $a = ($capacite - $b); + if ($a > $debris_met) $a = $debris_met; + } + } + else { + $a = $debris_met; + $b = $debris_cri; + } + $Cmetal = $a + $queryFlottes[$i]['contenu_metal']; + $Ccristal = $b + $queryFlottes[$i]['contenu_cristal']; + + $bdd->connexion(); + $bdd->query("UPDATE $table_flottes SET effectue = '1', contenu_metal = '$Cmetal', contenu_cristal = '$Ccristal' WHERE id = '$id_flotte';"); + $bdd->query("UPDATE $table_planete SET debris_met = debris_met - '$a', debris_cri = debris_cri - '$b' WHERE galaxie = '$end_galaxie' AND ss = '$end_ss' AND position = '$end_position';"); + $bdd->deconnexion(); + + $rapport = new Rapport($mission, $queryFlottes[$i]['id_user'], $queryEN['id_user'], $end_time); + $rapport->addInfo($queryEN, 0); + $rapport->addInfo(array($a, $b), 1); + $rapport->send(); + } + //Mission Espionnage + elseif ($mission == 5) { + $nbsondes = $queryFlottes[$i]['vaisseau_3']; + $id_userT = $queryEN['id_user']; + $id_att = $queryFlottes[$i]['id_user']; + + $bdd->connexion(); + $bdd->query("UPDATE $table_flottes SET effectue = 1 WHERE id = $id_flotte;"); + $resultatUD = $bdd->unique_query("SELECT * FROM $table_user WHERE id = $id_userT;"); + $resultatUA = $bdd->unique_query("SELECT * FROM $table_user WHERE id = $id_att;"); + $bdd->deconnexion(); + + $diffNiveau = $resultatUA['detection'] - $resultatUD['detection'] + floor($nbsondes/2); + $rapport = new Rapport($mission, $id_att, $id_userT, $end_time); + + if ($diffNiveau < 0) { + $rapport->addInfo($queryEN, 0); + $rapport->addInfo(false, 1); + } + if ($diffNiveau >= 0) $rapport->addInfo($queryEN, 0); + if ($diffNiveau >= 1) $rapport->addInfo(true, 1); + if ($diffNiveau >= 2) $rapport->addInfo(true, 2); + if ($diffNiveau >= 3) $rapport->addInfo(true, 3); + if ($diffNiveau >= 4) $rapport->addInfo($resultatUD, 4); + if ($diffNiveau >= 5) $rapport->addInfo(true, 5); + + $rapport->send(); + } + } + + //Si la flotte a terminé son retour + if (($queryFlottes[$i]['mission'] == 0 && $queryFlottes[$i]['start_time'] + $queryFlottes[$i]['end_time'] <= time()) || ($queryFlottes[$i]['effectue'] == 1 && ((!empty($queryFlottes[$i]['ret_time']) && $queryFlottes[$i]['ret_time'] <= time()) || ($queryFlottes[$i]['start_time'] + $queryFlottes[$i]['end_time']*2 <= time())))) { + if ($queryFlottes[$i]['mission'] == 0) { + $fin_galaxie = $queryFlottes[$i]['end_galaxie']; + $fin_systeme = $queryFlottes[$i]['end_ss']; + $fin_potision = $queryFlottes[$i]['end_position']; + } + elseif (!empty($queryFlottes[$i]['ret_position'])) { + $fin_galaxie = $queryFlottes[$i]['ret_galaxie']; + $fin_systeme = $queryFlottes[$i]['ret_ss']; + $fin_potision = $queryFlottes[$i]['ret_position']; + } + else { + $fin_galaxie = $queryFlottes[$i]['start_galaxie']; + $fin_systeme = $queryFlottes[$i]['start_ss']; + $fin_potision = $queryFlottes[$i]['start_position']; + } + + $bdd->connexion(); + if ($bdd->unique_query("SELECT * FROM $table_planete WHERE galaxie = '$fin_galaxie' AND ss = '$fin_systeme' AND position = '$fin_potision';")) { + $export = ''; + $nbvais = 12; + for($j = 1; $j <= $nbvais; $j++) { + $export .= ', vaisseau_'.$j.' = vaisseau_'.$j.' + '.$queryFlottes[$i]['vaisseau_'.$j]; + } + $Cmetal = $queryFlottes[$i]['contenu_metal']; + $Ccristal = $queryFlottes[$i]['contenu_cristal']; + $Chydrogene = $queryFlottes[$i]['contenu_hydrogene']; + $bdd->query("UPDATE $table_planete SET metal = metal + '$Cmetal', cristal = cristal + '$Ccristal', hydrogene = hydrogene + '$Chydrogene'$export WHERE galaxie = '$fin_galaxie' AND ss = '$fin_systeme' AND position = '$fin_potision';"); + } + $idUserFlotte = $queryFlottes[$i]['id_user']; + $bdd->query("DELETE FROM $table_flottes WHERE id_user = '$idUserFlotte' AND id = '$id_flotte';"); + $bdd->query("DELETE FROM $table_flottes_combats WHERE refflotte = '$id_flotte';"); + $bdd->deconnexion(); + } +} +?> \ No newline at end of file diff --git a/game/Class/class.alliance.php b/game/Class/class.alliance.php index bb007c8..dce9aa8 100644 --- a/game/Class/class.alliance.php +++ b/game/Class/class.alliance.php @@ -8,7 +8,7 @@ * * ***************************************************************************/ -class Alliance extends File{ +class Alliance extends Surface{ var $id, $race, $fondateur, @@ -24,12 +24,7 @@ class Alliance extends File{ $credits, $metal, $cristal, - $hydrogene, - $file_abat, - $file_vais, - $alli_batiments = array(), - $vaisseaux = array(), - $modif = array(); + $hydrogene; /** * Constructeur @@ -66,7 +61,7 @@ class Alliance extends File{ $this->hydrogene = $alli["hydrogene"]; foreach($alli_batimentVAR as $bat){ - $this->alli_batiments[] = $alli[$bat]; + $this->batiments[] = $alli[$bat]; } $this->file_bat = unserialize($alli["file_bat"]); diff --git a/game/Class/class.asteroide.php b/game/Class/class.asteroide.php new file mode 100644 index 0000000..0457b30 --- /dev/null +++ b/game/Class/class.asteroide.php @@ -0,0 +1,691 @@ +connexion(); + $plan = $bdd->unique_query("SELECT * FROM $table_alliances WHERE id = $id;"); + $bdd->deconnexion(); + } + elseif (preg_match('#^\[?([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\]?$#', $id, $position)) + { + $bdd->connexion(); + $plan = $bdd->unique_query("SELECT * FROM $table_alliances WHERE galaxie = ".$position[1]." AND ss = ".$position[2].";"); + $bdd->deconnexion(); + } + else + die('Erreur #04 : Format de recherche d\'asteroide incorrect !'); + + if (!empty($plan)) + { + $this->id = $plan["id"]; + parent::User($sess->values['id']); //On utilise le numéro d'utilisateur enregistré en session + $this->galaxie = $plan["galaxie"]; + $this->ss = $plan["ss"]; + $this->image = $plan["image"]; + $this->debris_met = $plan["debris_met"]; + $this->debris_cri = $plan["debris_cri"]; + $this->metal = $plan["metal"]; + $this->cristal = $plan["cristal"]; + $this->hydrogene = $plan["hydrogene"]; + + foreach($alli_batimentVAR as $bat) + $this->alli_batiments[] = $plan[$bat]; + if (!empty($plan["file_bat"])) + $this->file_bat = unserialize($plan["file_bat"]); + else + $this->file_bat = array(); + + foreach($nomvaisnVAR as $vais) + $this->vaisseaux[] = $plan[$vais]; + if (!empty($plan["file_vais"])) + $this->file_vais = unserialize($plan["file_vais"]); + else + $this->file_vais = array(); + + } + } + } + + /** + * Actualise les ressources de la planète en fonction de la production et termine les files d'attentes. + * + * @return void + * @access public + */ + function actualiser($actuFile = true, $first = false) + { + //Actualisation des files d'attentes + if ($actuFile) + { + $this->file_ready("batiments"); + $this->file_readyTechno("technologies"); + $this->file_ready("casernes"); + $this->file_ready("terrestres"); + $this->file_ready("vaisseaux"); + } + + //Calcul de la capacité de stockage maximale + if (!empty($timestamp_lastSilo)) + { + $this->cap = pow(2, $this->batiments[10]-1) * 100000; + $capnouv = pow(2, $this->batiments[10]) * 100000; + } + else + $this->cap = pow(2, $this->batiments[10]) * 100000; + + //Calcul du temps écoulé depuis la dernière mise à jour de la planète + $temps_ecoule = time() - $this->timestamp; + $ressources = $this->production($temps_ecoule); + if ($this->metal + $ressources[0] < $this->cap) + $this->metal += $ressources[0]; + else + { + //Si les capacité de stockage ont changé depuis la dernière actualisation + if (isset($capnouv)) + { + $ressources = $this->production(time() - $this->timestamp_lastSilo); + if ($this->metal + $ressources[0] < $capnouv) + $this->metal += $ressources[0]; + } + else + { + $this->alert_ressources[0] = true; + $this->metal = $this->cap; + } + } + if ($this->cristal + $ressources[1] < $this->cap) + $this->cristal += $ressources[1]; + else + { + //Si les capacité de stockage ont changé depuis la dernière actualisation + if (isset($capnouv)) + { + $ressources = $this->production(time() - $this->timestamp_lastSilo); + if ($this->cristal + $ressources[1] < $capnouv) + $this->cristal += $ressources[1]; + } + else + { + $this->alert_ressources[1] = true; + $this->cristal = $this->cap; + } + } + if ($this->hydrogene + $ressources[2] < $this->cap) + $this->hydrogene += $ressources[2]; + else + { + //Si les capacité de stockage ont changé depuis la dernière actualisation + if (isset($capnouv)) + { + $ressources = $this->production(time() - $this->timestamp_lastSilo); + if ($this->hydrogene + $ressources[2] < $capnouv) + $this->hydrogene += $ressources[2]; + } + else + { + $this->alert_ressources[2] = true; + $this->hydrogene = $this->cap; + } + } + + //Vérification de la date pour faire les actions journalières + if (date('zya') != date('zya', $this->timestamp)) + { + //On évalue le moral + $this->evalMoral($first); + + //Si la population est à 0, on ajoute des habitants + if ($this->population <= 0) + $this->population = 1000; + + $popPlus = $this->population * 0.0153^max(1, floor((time()-$this->timestamp)/86400)); + + if ($this->politique == 2) + $popPlus *= 1.1; //Communisme : 10 % de population qui arrive en plus. + elseif ($this->politique == 3) + $popPlus *= 1.05; //Démocratie : 5 % de population qui arrive en plus. + + if ($this->technologies[2] & 4) + $popPlus *= 1.15; + elseif ($this->technologies[2] & 2) + $popPlus *= 1.10; + elseif ($this->technologies[2] & 1) + $popPlus *= 1.05; + + $this->population += $popPlus; + $this->credits += $this->population/100*exp(0.01)*25; + $this->modif[] = 'population'; + } + + $this->timestamp = time(); + + + //Calcul du nombre de cases restantes + $this->casesRest = $this->cases; + foreach($this->batiments as $bat) + $this->casesRest -= $bat; + } + + function setMoral($difference) + { + $this->moral += $difference; + + //Ajustement du moral + if ($this->moral > 1) + $this->moral = 1; + elseif ($this->moral < 0) + $this->moral = 0; + + if (!in_array("moral", $this->modif)) + $this->modif[] = "moral"; + } + + function evalMoral($first = false) + { + //Cas de sous-production + if (($this->coeff_bat[0] + $this->coeff_bat[1] + $this->coeff_bat[2])/3 < 0.9) + { + if ($this->politique == 2) + $this->moral -= 0.10; //Communisme : démoralise 2x plus + else + $this->moral -= 0.05; + if (!in_array('moral', $this->modif)) + $this->modif[] = 'moral'; + } + + //Surpopulation + + //Surlogement + + //Ajustement du moral en fonction de la politique + if ($this->politique == 1 && $this->moral > 0.7) + $this->moral = 0.7; + + //On vérifie qu'on ne dépasse pas le maximum + if ($this->moral > 1) + $this->moral = 1; + if ($this->moral < 0) + $this->moral = 0; + + //Isolement si besoin + if ($this->moral < 0.1) + { + //On vérifie qu'il ne s'agit pas de la planète mère + global $bdd, $table_planete; + $bdd->connexion(); + $res = $bdd->unique_query("SELECT id FROM $table_planete WHERE id_user = ".$this->id_user." ORDER BY id LIMIT 1;"); + $bdd->deconnexion(); + if ($res['id'] != $this->id) + { + if ($this->moral <= 0.01 || $this->moral <= 0.04) + { + if ($this->moral <= 0.01) + $rand = rand(0,4); + else + $rand = rand(0,20); + //Perte de la planète + if ($rand == 1) + { + $bdd->connexion(); + $bdd->query("DELETE FROM $table_planete WHERE id = ".$this->id.";"); + $bdd->deconnexion(); + send_mp($this->id_user, 'Perte de contrôle de '.$this->nom_planete, "Suite à une démoralisation percistante de la population sur la planète ".$this->nom_planete." [".$this->galaxie.":".$this->ss.":".$this->position."], la population a renversé votre gouvernement en tuant tous vos gouverneurs. Vous perdez donc définitivement le contrôle de cette planète."); + if (!$first) + { + $sess->values['idPlan'] = $res['id']; + erreur('La population de cette planète est tellement démoralisée qu\'elle s\'est révolté contre vous. Vous ne contrôlez plus cette planète.'); + } + } + } + elseif ($this->moral <= 0.06 || $this->moral <= 0.1) + { + if ($this->moral <= 0.06) + $rand = rand(0,2); + else + $rand = rand(0,10); + //Perte de contrôle temporaire + if ($rand == 1) + { + $debut = time() - rand(0, 3600)*4; + $fin = $debut + 86400; + $this->isolement = array($debut, $fin); + if (!in_array('isolement', $this->modif)) $this->modif[] = 'isolement'; + + send_mp($this->id_user, 'Perte de contrôle temporaire de '.$this->nom_planete, "Suite à une démoralisation percistante de la population sur la planète ".$this->nom_planete." [".$this->galaxie.":".$this->ss.":".$this->position."], la population a pris le contrôle de votre planète. Vous perdez le contrôle de cette planète le temps que vos gouverneurs reprennent le pouvoir."); + if (!$first) + { + $sess->values['idPlan'] = $res['id']; + erreur('La population de cette planète est tellement démoralisée qu\'elle s\'est révoltée contre vous. Vous perdez temporairement le contrôle de cette planète.'); + } + } + } + } + } + } + + /** + * Vérifie si la planète est isolée ou non + * + * @return boolean + * @access public + */ + function isolement() + { + $return = false; + + global $var___db, $config, $table_planete; + $bdd = new BDD(); + $bdd->connexion(); + $plan = $bdd->query("SELECT id FROM $table_planete WHERE id_user = ".$this->id_user." ORDER BY id;"); + $bdd->deconnexion(); + + $numP = 0; + foreach ($plan as $key => $p) + { + if ($p['id'] == $this->id) + $numP = $key + 1; + } + + if ($numP >= 11) + { + if (!isset($this->isolement[0]) || (time() > $this->isolement[0] && (!isset($this->isolement[1]) || (time() > $this->isolement[1] && date('dmY') != date('dmY', $this->isolement[0]))))) + { + switch($numP) + { + case 11: + $tps = 2; + break; + case 12: + $tps = 4; + break; + case 13: + $tps = 6; + break; + case 14: + $tps = 8; + break; + case 15: + $tps = 12; + break; + case 16: + $tps = 16; + break; + case 17: + $tps = 20; + break; + default: + $tps = 24; + } + $debut = mktime(rand(0, 24-$tps), 0, 0, date('n'), date('j'), date('Y')); + $fin = $debut + $tps * 3600; + + $this->isolement[0] = $debut; + if (time() > $this->isolement[0]) + $this->isolement[1] = $fin; + if (!in_array('isolement', $this->modif)) + $this->modif[] = 'isolement'; + } + if (isset($this->isolement[1]) && time() < $this->isolement[1]) + $return = true; + } + elseif (!isset($this->isolement[0])) + { + $this->isolement = array(0,0); + if (!in_array('isolement', $this->modif)) + $this->modif[] = 'isolement'; + } + + return $return; + } + + /** + * Calcul les ressources produites en fonction de $temps_ecoule + * @param int $temps_ecoule Temps écoulé depuis la dernière actualisation + * + * @return array + * @access public + */ + function production($temps_ecoule, $retarray = false) + { + //Accélération de la production + $temps_ecoule *= VITESSE; + + //Calcul de la consomation d'énergie + if ($this->batiments[0] > 0) + $energie_m = ceil(exp(0.28*$this->batiments[0])*10); + else + $energie_m = 0; + if ($this->batiments[1] > 0) + $energie_c = ceil(exp(0.28*$this->batiments[1])*10); + else + $energie_c = 0; + if ($this->batiments[2] > 0) + $energie_h = ceil(exp(0.2849*$this->batiments[2])*13); + else + $energie_h = 0; + if ($this->batiments[3] > 0) + $energie_s = ceil(exp(0.28*$this->batiments[3])*22); + else + $energie_s = 0; + if ($this->batiments[4] > 0) + $energie_f = ceil(exp(0.297*$this->batiments[4])*25); + else + $energie_f = 0; + + //Calcul de la consomation d'énergie + $this->energieConso = $energie_m * $this->coeff_bat[0] + $energie_c * $this->coeff_bat[1] + $energie_h * $this->coeff_bat[2]; + $nrjmx = $energie_m + $energie_c + $energie_h; + + //Calcul de la production d'énergie + $this->energie = $energie_s * $this->coeff_bat[3] + $energie_f * $this->coeff_bat[4]; + + if ($this->energieConso == 0) + $coeff = 0; + else + $coeff = $this->energie / $this->energieConso; + + if ($coeff < 0) + $coeff = 0; + elseif ($coeff > 1) + $coeff = 1; + + $Ncoeff = array(); + for($i = 0; $i < 3; $i++) + { + $Ncoeff[$i] = $coeff * $this->coeff_bat[$i]; + if ($Ncoeff[$i] > 1) + $Ncoeff[$i] = 1; + if ($Ncoeff[$i] < $this->coeff_bat[$i] && $this->batiments[$i] != 0) + { + $this->coeff_bat[$i] = $Ncoeff[$i]; + if (!in_array('coeff_bat', $this->modif)) + $this->modif[] = 'coeff_bat'; + } + } + + //Calcul de la consomation d'hydrogène + if ($this->batiments[4] > 0) + $conso_h = ((ceil(pow(1.34,($this->batiments[4]-1))*9)/3600)*$temps_ecoule) * $this->coeff_bat[4]; + else + $conso_h = 0; + + //Calcul des production de ressources + if ($this->batiments[0] <= 0 || $this->batiments[3] <= 0) + $prod_met = 0.011 * $temps_ecoule; + else + $prod_met = ((ceil(pow(1.1, $this->batiments[0]) * 35 * $this->batiments[0]) / 3600) * $temps_ecoule) * $this->coeff_bat[0] * 1.5; + + if ($this->batiments[1] <= 0 || $this->batiments[3] <= 0) + $prod_cri = 0.0055 * $temps_ecoule; + else + $prod_cri = ((ceil(pow(1.1, $this->batiments[1]) * 23 * $this->batiments[1]) / 3600) * $temps_ecoule) * $this->coeff_bat[1] * 1.5; + + if ($this->batiments[2] <= 0) + $prod_hy = 0; + else + $prod_hy = ((ceil(pow(1.1, $this->batiments[2]) * 14 * ($this->batiments[2] + 0.7)) / 3600) * $temps_ecoule) * $this->coeff_bat[2] * 1.5; + + //Augmentation de la production en fonction des technologies + if ($this->technologies[0] &4) + { + $prod_met *= 1.15; + $prod_cri *= 1.15; + $prod_hy *= 1.15; + } + elseif ($this->technologies[0] &2) + { + $prod_met *= 1.10; + $prod_cri *= 1.10; + $prod_hy *= 1.10; + } + elseif ($this->technologies[0] &1) + { + $prod_met *= 1.05; + $prod_cri *= 1.05; + $prod_hy *= 1.05; + } + + //Augmentation de la production en fonction du moral + if ($this->moral > 0.9) + { + $prod_met *= 1.05; + $prod_cri *= 1.05; + $prod_hy *= 1.05; + } + elseif ($this->moral > 0.75) + { + $prod_met *= 1.02; + $prod_cri *= 1.02; + $prod_hy *= 1.02; + } + elseif ($this->moral < 0.45) + { + $prod_met *= 0.97; + $prod_cri *= 0.97; + $prod_hy *= 0.97; + } + elseif ($this->moral < 0.25) + { + $prod_met *= 0.94; + $prod_cri *= 0.94; + $prod_hy *= 0.94; + } + + //Augmentation de la production en fonction de la politique + if ($this->politique == 2) + { + $prod_met *= 1.10; + $prod_cri *= 1.10; + $prod_hy *= 1.10; + } + + //On enlève la consomation d'hydrogène + $prod_hy -= $conso_h; + + if ($retarray) + return array(array(ceil($this->coeff_bat[0]*100), ceil($this->coeff_bat[1]*100), ceil($this->coeff_bat[2]*100), ceil($this->coeff_bat[3]*100), ceil($this->coeff_bat[4]*100)), array($prod_met, $prod_cri, $prod_hy + $conso_h, $energie_s*$this->coeff_bat[3], $energie_f*$this->coeff_bat[4]), array($energie_m*$this->coeff_bat[0], $energie_c*$this->coeff_bat[1], $energie_h*$this->coeff_bat[2], $conso_h, ($energie_s*$this->coeff_bat[3] + $energie_f*$this->coeff_bat[4])-($energie_m*$this->coeff_bat[0] + $energie_c*$this->coeff_bat[1] + $energie_h*$this->coeff_bat[2]))); + else + return array($prod_met, $prod_cri, $prod_hy); + } + + function creer($id_user) + { + //Définition des paramètres de l'utilisateur pour la planète + $this->id_user = $id_user; + + //Génération du nombre de case et de l'image en fonction de la position dans le système + if ($this->position > MAX_PLANETE*0.75) + { + $this->cases = mt_rand(200,255); + $this->image = mt_rand(1,19); + } + elseif ($this->position > MAX_PLANETE/2) + { + $this->cases = mt_rand(250,300); + $this->image = mt_rand(1,19); + } + elseif ($this->position > MAX_PLANETE/4) + { + $this->cases = mt_rand(175,260); + $this->image = mt_rand(1,19); + } + else + { + $this->cases = mt_rand(150,220); + $this->image = mt_rand(1,19); + } + + //Définition des principaux paramètres de la planète + $this->nom_planete = 'Planète colonisée'; + $this->timestamp = time(); + $this->metal = 1000; + $this->cristal = 700; + $this->hydrogene = 0; + + $this->modif = array("id_user", "nom_planete", "galaxie", "ss", "position", "image", "cases", "timestamp", "metal", "cristal", "hydrogene"); + } + + /** + * Destructeur + * + * @return void + * @access public + */ + function __destruct() + { + if (empty($this->ss) || empty($this->id_user)) + return; + if ($this->id_user == 1) + var_dump($this); + + global $var___db, $config, $table_planete; + if (empty($this->id)) + { + $out1 = array(); $out2 = array(); + $bdd = new bdd(); + $bdd->connexion(); + foreach($this->modif as $modif) + { + if (!is_array($this->{$modif})) + { + $bdd->escape($this->{$modif}); + $out1[] = $modif; + if (is_int($this->{$modif}) || is_float($this->{$modif})) + $out2[] = $this->{$modif}; + else + $out2[] = "'".$this->{$modif}."'"; + } + else + { + if (is_array($this->{$modif}) && $modif != "coeff_bat" && $modif != "vaisseaux" && $modif != "terrestres" && $modif != "casernes" && $modif != "technologies" && $modif != "batiments") + { + $prep = serialize($this->{$modif}); + $bdd->escape($prep); + $out1[] = $modif; + $out2[] = "'$prep'"; + } + else + { + if ($modif == "batiments") + $calc = "batiment"; + elseif ($modif == "technologies") + $calc = "technolo"; + elseif ($modif == "casernes") + $calc = "casernen"; + elseif ($modif == "terrestres") + $calc = "nomterrn"; + elseif ($modif == "vaisseaux") + $calc = "nomvaisn"; + elseif ($modif == "coeff_bat") + $calc = "coeff"; + + if (!isset(${$calc.'VAR'})) + global ${$calc.'VAR'}; + + foreach($this->{$modif} as $j => $value) + { + $out1[] = ${$calc.'VAR'}[$j]; + $out2[] = $value; + } + } + } + } + $bdd->query("INSERT INTO $table_planete (".implode(', ', $out1).", hash_planete) VALUES (".implode(', ', $out2).", SHA1(CONCAT('g',planete.galaxie,'s',planete.ss,'p',planete.position)))"); + $bdd->deconnexion(); + } + else + { + $nb = count($this->modif); + $out = array(); + $bdd = new bdd(); + $bdd->connexion(); + for($i = 0; $i < $nb; $i++) + { + if ($this->modif[$i] == 'technologies') + $this->modifUser[] = $this->modif[$i]; + elseif (!is_array($this->{$this->modif[$i]})) + { + $bdd->escape($this->{$this->modif[$i]}); + if (is_int($this->{$this->modif[$i]}) || is_float($this->{$this->modif[$i]})) + $out[] = $this->modif[$i]." = ".$this->{$this->modif[$i]}; + else + $out[] = $this->modif[$i]." = '".$this->{$this->modif[$i]}."'"; + } + else + { + if (is_array($this->{$this->modif[$i]}) && $this->modif[$i] != "coeff_bat" && $this->modif[$i] != "vaisseaux" && $this->modif[$i] != "terrestres" && $this->modif[$i] != "casernes" && $this->modif[$i] != "technologies" && $this->modif[$i] != "batiments") + { + $prep = serialize($this->{$this->modif[$i]}); + $bdd->escape($prep); + $out[] = $this->modif[$i]." = '$prep'"; + } + else + { + if ($this->modif[$i] == "batiments") + $calc = "batiment"; + elseif ($this->modif[$i] == "technologies") + $calc = "technolo"; + elseif ($this->modif[$i] == "casernes") + $calc = "casernen"; + elseif ($this->modif[$i] == "terrestres") + $calc = "nomterrn"; + elseif ($this->modif[$i] == "vaisseaux") + $calc = "nomvaisn"; + elseif ($this->modif[$i] == "coeff_bat") + $calc = "coeff"; + + if (!isset(${$calc.'VAR'})) + global ${$calc.'VAR'}; + + $nombr = count(${$calc.'VAR'}); + for($j = 0; $j < $nombr; $j++) + { + $bdd->escape($this->{$this->modif[$i]}[$j]); + $out[] = ${$calc.'VAR'}[$j]." = ".$this->{$this->modif[$i]}[$j].""; + } + } + } + } + if (!empty($out)) + $plan = $bdd->query("UPDATE $table_planete SET ".implode(', ', $out)." WHERE id = ".$this->id.";"); + + $bdd->deconnexion(); + parent::__destruct(); + } + } + } +?> \ No newline at end of file diff --git a/game/Class/class.file.php b/game/Class/class.file.php index 385838b..940dc83 100644 --- a/game/Class/class.file.php +++ b/game/Class/class.file.php @@ -8,411 +8,651 @@ * * ***************************************************************************/ -class File{ - var $file; +class File + { + var $file; - function File($file){ - $this->file = unserialize($file); - } - - function reajusteVacances($timeVac){ - if (isset($this->file[0])) { - $this->file[0] += time() - $timeVac; - } - - return serialize($this->file); - } - - /** - * Ajoute $nombre objets $objet dans la file $file - * @param int $file Nom de la file d'attente - * @param int $objet Id de l'objet à ajouter - * @param int $nombre = 1 Nombre d'objet $objet à ajouter à la file - * - * @return int Numéro de l'erreur - * @access public - */ - function file_addObjet($file, $objet, $nombre = 1){ - $planete = $this; - - if ($nombre > 99999) erreur('Dépacement de capacité !
          Vous ne pouvez pas mettre autant d\'unités en file d\'attente en une seule fois.'); - - switch($file){ - case "alli_batiments": $court = "abat"; $calc = "alli_batiment"; global ${$calc.'LIMIT'}; $exist = $this->file_exist($objet, "file_".$court); break; - case "batiments": $court = "bat"; $calc = "batiment"; $exist = $this->file_exist($objet, "file_".$court); break; - case "technologies": $court = "tech"; $calc = "technolo"; $exist = $this->file_exist($objet, $nombre); break; - case "casernes": $court = "cas"; $calc = "casernen"; $exist = false; break; - case "terrestres": $court = "ter"; $calc = "nomterrn"; $exist = false; break; - case "vaisseaux": $court = "vais"; $calc = "nomvaisn"; $exist = false; break; - default: return 1; - } - - //On vérifie la taille maximale de la file d'attente - if (!empty($this->technologies['techno_inge'])) { - if (($this->technologies['techno_inge'] & 131072) == 131072) $max = 5; - elseif (($this->technologies['techno_inge'] & 65536) == 65536) $max = 4; - elseif (($this->technologies['techno_inge'] & 32768) == 32768) $max = 3; - else $max = 2; - } - else $max = 3; - - if ($file == "technologies") { - global ${$file.'CALC'}; - - $file_tech = $nombre; - $nombre = 1; - - if (empty($technologiesCALC[$file_tech][$objet])) return 1; - - //Vérification des conditions de recherche - if (!(($this->technologies[$file_tech] & $technologiesCALC[$file_tech][$objet][1]) == $technologiesCALC[$file_tech][$objet][1] && !($this->technologies[$file_tech] & $technologiesCALC[$file_tech][$objet][0] && $this->technologies[$file_tech] != 0))) return 1; - } - else { - global ${$calc}, ${$calc.'CALC'}, ${$calc.'TECH'}; - - //Vérification des conditions de construction - if (empty(${$calc}[$objet]) || !requestDeblok(${$calc.'TECH'}[$objet], $this)) return 1; - - //Vérification que l'on ait pas dépassé le nombre maximal de niveau - if (!empty(${$calc.'LIMIT'}[$objet]) && ${$file}[$objet] >= ${$calc.'LIMIT'}[$objet]) return 1; - - //Calcul du prochain niveau de l'objet - $n = $this->{$file}[$objet] + 1; - } - - //Vérification qu'il n'y ait pas déjà une instance de l'objet déjà en construction - if ($exist) return 2; - - //Vérification que le nombre ne soit pas négatif - if ($nombre < 0 && ($file != "batiments" || $nombre < -1)) return 5; - - //Actualisation du temps s'il n'y a pas d'objet en file - if (count($this->{"file_".$court}) < 2) $this->{"file_".$court}[0] = time(); - - - if ($nombre > 0) { - if ($file == "alli_batiments" || $file == "batiments") { - eval(${$calc.'CALC'}[$objet][0]); - eval(${$calc.'CALC'}[$objet][1]); - eval(${$calc.'CALC'}[$objet][2]); - $d = 0; + function File($file) + { + $this->file = unserialize($file); } - elseif ($file == "technologies") { + + function reajusteVacances($timeVac) + { + if (isset($this->file[0])) + $this->file[0] += time() - $timeVac; + + return serialize($this->file); + } + + /** + * Ajoute $nombre objets $objet dans la file $file + * @param int $file Nom de la file d'attente + * @param int $objet Id de l'objet à ajouter + * @param int $nombre = 1 Nombre d'objet $objet à ajouter à la file + * + * @return int Numéro de l'erreur + * @access public + */ + function file_addObjet($file, $objet, $nombre = 1) + { + $planete = $this; + + switch($file) + { + case "alli_batiments": + $court = "abat"; + $calc = "alli_batiment"; + global ${$calc.'LIMIT'}; + $exist = $this->file_exist($objet, "file_".$court); + break; + + case "batiments": + $court = "bat"; + $calc = "batiment"; + $exist = $this->file_exist($objet, "file_".$court); + break; + + case "technologies": + 1/0; + die('Erreur dans la file d\'attente ! #43, veuillez contacter un administrateur.'); + break; + + case "casernes": + $court = "cas"; + $calc = "casernen"; + $exist = false; + break; + + case "terrestres": + $court = "ter"; + $calc = "nomterrn"; + $exist = false; + break; + + case "vaisseaux": + $court = "vais"; + $calc = "nomvaisn"; + $exist = false; + break; + + default: + return 1; + } + + //On calcul la taille maximale de la file d'attente + if (!empty($this->technologies['techno_inge'])) + { + if (($this->technologies['techno_inge'] &131072) == 131072) $max = 5; + elseif (($this->technologies['techno_inge'] &65536) == 65536) $max = 4; + elseif (($this->technologies['techno_inge'] &32768) == 32768) $max = 3; + else $max = 2; + } + else $max = 3; //Au cas où il n'y ait pas de technologie sur le lieu, on fixe la taille de la file d'attente + + //Load the global variables for the line + global ${$calc}, ${$calc.'CALC'}, ${$calc.'TECH'}; + + //Check the conditions of building + if (empty(${$calc}[$objet]) || !requestDeblok(${$calc.'TECH'}[$objet], $this)) + return 1; + + //Check that we have not overtake the maximum level + if (!empty(${$calc.'LIMIT'}[$objet]) && ${$file}[$objet] >= ${$calc.'LIMIT'}[$objet]) + return 1; + + //Calculate next object's level + $n = $this->{$file}[$objet] + 1; + + //Check that there isn't another object's entreaties yet building + if ($exist) + return 2; + + //Check the sended number, it mustn't be negativ + if ($nombre < 0 && ($file != "batiments" || $nombre < -1)) + return 5; + + //Refresh time if no object in the line + if (count($this->{"file_".$court}) < 2) + $this->{"file_".$court}[0] = time(); + + + if ($nombre > 0) + { + if ($file == "alli_batiments" || $file == "batiments") + { + eval(${$calc.'CALC'}[$objet][0]); + eval(${$calc.'CALC'}[$objet][1]); + eval(${$calc.'CALC'}[$objet][2]); + $d = 0; + } + elseif ($file == "technologies") + { + $a = $b = $c = 0; + $d = $technologiesCALC[$branch][$objet][2]; + } + else + { + $a = ${$calc.'CALC'}[$objet][0]; + $b = ${$calc.'CALC'}[$objet][1]; + $c = ${$calc.'CALC'}[$objet][2]; + $d = 0; + } + + //Apply policy bonus for time and cost + if (isset($this->politique) && $this->politique == 1 && ($file == "casernes" || $file == "terrestres" || $file == "vaisseaux")) + { + $a *= 0.9; + $b *= 0.9; + $c *= 0.9; + } + //Apply bonus from technology for the mines + if ($file == "batiments" && $objet < 4 && isset($this->technologies)) + { + if ($this->technologies[0] &262144) + { + $a *= 0.85; + $b *= 0.85; + $c *= 0.85; + } + elseif ($this->technologies[0] &131072) + { + $a *= 0.9; + $b *= 0.9; + $c *= 0.9; + } + elseif ($this->technologies[0] &65536) + { + $a *= 0.95; + $b *= 0.95; + $c *= 0.95; + } + } + + //Check maximum number unity building on this planet with means + if ($nombre > 1) + { + if ($a) $nombre = min(floor($this->metal/$a), $nombre); + if ($b) $nombre = min(floor($this->cristal/$b), $nombre); + if ($c) $nombre = min(floor($this->hydrogene/$c), $nombre); + if ($d) $nombre = min(floor($this->credits/$d), $nombre); + } + } + else + { + $a = 0; + $b = 0; + $c = 0; + $d = 0; + } + + //Check means on the planet + if ($this->metal < $a * $nombre || $this->cristal < $b * $nombre || $this->hydrogene < $c * $nombre || $this->credits < $d * $nombre) + return 3; + else + { + //Line generate + $nb = count($this->{"file_".$court}); + + //If the last object is similar as this one + if ($file == "technologies" && $max <= count($this->{"file_".$court})) + return 4; //Check height line + elseif ($file == "technologies") + $this->{"file_".$court}[] = array($objet, $branch); + elseif ($nombre > 99999 || ($nb > 1 && $objet == $this->{"file_".$court}[$nb-1][0] && $this->{"file_".$court}[$nb-1][1] + $nombre > 99999)) + erreur('Dépacement de capacité !
          Vous ne pouvez pas mettre autant d\'unités en file d\'attente en une seule fois.'); + elseif ($nb > 1 && $objet == $this->{"file_".$court}[$nb-1][0]) + $this->{"file_".$court}[$nb-1][1] += $nombre; + elseif ($max <= count($this->{"file_".$court})) + return 4; //Check height line + else + $this->{"file_".$court}[] = array($objet, $nombre); + + //Update means on the planet after building + $this->metal -= $a * $nombre; + $this->cristal -= $b * $nombre; + $this->hydrogene -= $c * $nombre; + $this->credits -= $d * $nombre; + + if (!in_array("file_".$court, $this->modif)) + $this->modif[] = "file_".$court; + + return 0; + } + } + + /** + * Ajoute à la file d'attente technologique la technologie $technology dans la branche $branch + * @param int $branch Branche technologique dans laquel se trouve la technologie + * @param int $technology ID de la technologie à ajouter + * + * @return int Numéro de l'erreur + * @access public + */ + function file_addTechno($branch, $technology) + { + $planete = $this; + + //Calculate maximum height line + if (!empty($this->technologies['techno_inge'])) + { + if (($this->technologies['techno_inge'] &131072) == 131072) $max = 5; + elseif (($this->technologies['techno_inge'] &65536) == 65536) $max = 4; + elseif (($this->technologies['techno_inge'] &32768) == 32768) $max = 3; + else $max = 2; + } + else $max = 3; + + //Load globals variables + global $technologiesCALC; + + //Check branch and technology + if (empty($technologiesCALC[$branch][$technology])) + return 1; + + //Check search conditions + if (!(($this->technologies[$branch] &$technologiesCALC[$branch][$technology][1]) == $technologiesCALC[$branch][$technology][1] && !($this->technologies[$branch] &$technologiesCALC[$branch][$technology][0] && $this->technologies[$branch] != 0))) + return 1; + + //Check that there isn't another object's entreaties yet building + //TODO + if ($this->file_existTech($branch, $technology)) + return 2; + + //Refresh time if that is the first search + if (count($this->file_tech) < 2) + $this->file_tech[0] = time(); + + //Calculate cost and time $a = $b = $c = 0; - $d = $technologiesCALC[$file_tech][$objet][2]; - } - else { - $a = ${$calc.'CALC'}[$objet][0]; - $b = ${$calc.'CALC'}[$objet][1]; - $c = ${$calc.'CALC'}[$objet][2]; - $d = 0; + $d = $technologiesCALC[$branch][$technology][2]; + + //Check means on planet + if ($this->metal < $a || $this->cristal < $b || $this->hydrogene < $c || $this->credits < $d) return 3; + else + { + if ($max <= count($this->file_tech)) + return 4; //Vérification de la taille de la file d'attente + else + $this->file_tech[] = array($technology, $branch); + + //Update means on the planet after start searching + $this->metal -= $a; + $this->cristal -= $b; + $this->hydrogene -= $c; + $this->credits -= $d; + + if (!in_array("file_tech", $this->modif)) + $this->modif[] = "file_tech"; + + return 0; + } } - //On applique les bonus politiques aux temps et coûts - if (isset($this->politique) && $this->politique == 1 && ($file == "casernes" || $file == "terrestres" || $file == "vaisseaux")) { - $a *= 0.9; - $b *= 0.9; - $c *= 0.9; + + function file_delObjet($file, $objet, $nombre = 1, $w = 99) + { + $planete = $this; + + switch($file) + { + case "alli_batiments": + $court = "abat"; + $calc = "alli_batiment"; + $exist = $this->file_exist($objet, "file_".$court); + break; + + case "batiments": + $court = "bat"; + $calc = "batiment"; + $exist = $this->file_exist($objet, "file_".$court); + break; + + case "technologies": + 1/0; + die('Erreur dans la file d\'attent : #273. Contactez un administrateur.'); + break; + + case "casernes": + $court = "cas"; + $calc = "casernen"; + $exist = $this->file_exist($objet, "file_".$court); + break; + + case "terrestres": + $court = "ter"; + $calc = "nomterrn"; + $exist = $this->file_exist($objet, "file_".$court); + break; + + case "vaisseaux": + $court = "vais"; + $calc = "nomvaisn"; + $exist = $this->file_exist($objet, "file_".$court); + break; + + default: + return false; + } + + //Si l'objet n'est pas dans la file d'attente, on annule la suite + if (!$exist) + return 0; + + if ($w == 99) + $w = count($this->{"file_".$court})-1; + + global ${$calc}, ${$calc.'CALC'}; + + for($i = $w; $i > 0; $i--) + { + if($this->{"file_".$court}[$i][0] == $objet) + { + $nombre = min(abs($nombre), $this->{"file_".$court}[$i][1]); + + if($this->{"file_".$court}[$i][1] <= $nombre) + { + unset($this->{"file_".$court}[$i]); + $this->{"file_".$court} = array_merge($this->{"file_".$court}); + if ($i == 1) + $this->{"file_".$court}[0] = time(); + } + else + $this->{"file_".$court}[$i][1] -= $nombre; + + break; + } + } + + //Calcul du prochain niveau de l'objet + $n = $this->{$file}[$objet] + 1; + + + if (!in_array("file_".$court, $this->modif)) + $this->modif[] = "file_".$court; + + if ($nombre > 0) + { + if ($file == "batiments") + { + eval(${$calc.'CALC'}[$objet][0]); + eval(${$calc.'CALC'}[$objet][1]); + eval(${$calc.'CALC'}[$objet][2]); + $d = 0; + } + else + { + $a = ${$calc.'CALC'}[$objet][0]; + $b = ${$calc.'CALC'}[$objet][1]; + $c = ${$calc.'CALC'}[$objet][2]; + $d = 0; + } + + //On applique les bonus politiques aux temps et coûts + if (isset($this->politique) && $this->politique == 1 && ($file == "casernes" || $file == "terrestres" || $file == "vaisseaux")) + { + $a *= 0.9; + $b *= 0.9; + $c *= 0.9; + } + + //Mise à jour des ressources de la planète en conséquence à la construction + $this->metal += $a * $nombre; + $this->cristal += $b * $nombre; + $this->hydrogene += $c * $nombre; + $this->credits += $d * $nombre; + } + + return $nombre; } - //Vérification du nombre maximum d'entraînement possible de cette unité sur cette planète - if ($nombre > 1) { - if ($a) $nombre = min(floor($this->metal/$a), $nombre); - if ($b) $nombre = min(floor($this->cristal/$b), $nombre); - if ($c) $nombre = min(floor($this->hydrogene/$c), $nombre); - if ($d) $nombre = min(floor($this->credits/$d), $nombre); + function file_delTechno($id) + { + $planete = $this; + + //Si l'objet n'est pas dans la file d'attente, on annule la suite + //TODO + if (!isset($this->file_tech[$id+1])) + return 0; + else + { + global $technologiesCALC; + //On réinitialise le temps si c'est la première série de la liste + if ($id == 0) + $this->file_tech[0] = time(); + + $d = $technologiesCALC[$this->file_tech[$id+1][1]][$this->file_tech[$id+1][0]][2]; + + unset($this->file_tech[$id+1]); + $this->file_tech = array_merge($this->file_tech); + } + + + if (!in_array("file_tech", $this->modif)) + $this->modif[] = "file_tech"; + + $a = $b = $c = 0; + + //Mise à jour des ressources de la planète en conséquence à la construction + $this->metal += $a; + $this->cristal += $b; + $this->hydrogene += $c; + $this->credits += $d; + + return 1; } - } - else { - $a = 0; - $b = 0; - $c = 0; - $d = 0; - } - //Vérification des ressources de la planète - if ($this->metal < $a * $nombre) return 3; - elseif ($this->cristal < $b * $nombre) return 3; - elseif ($this->hydrogene < $c * $nombre) return 3; - elseif ($this->credits < $d * $nombre) return 3; - else { - //Génération de la file d'attente - $nb = count($this->{"file_".$court}); - - //Si le dernier objet est identique à celui que l'on veut construire - if ($file == "technologies" && $max <= count($this->{"file_".$court})) return 4; //Vérification de la taille de la file d'attente - elseif ($file == "technologies") $this->{"file_".$court}[] = array($objet, $file_tech); - elseif ($nb > 1 && $objet == $this->{"file_".$court}[$nb-1][0]) { - $this->{"file_".$court}[$nb-1][1] += $nombre; + /** + * Vérifie l'existance dans la file $file d'attente de $objet + * @param int $objet ID à vérifier + * @param string $file Nom de la file d'attente + * + * @return boolean + * @access public + */ + function file_exist($objet, $file) + { + //On traite le cas d'une file type arbre + if (is_numeric($file)) { + 1/0; + die('A corriger, File d\'attente : #422. Contacter un administrateur'); + } + else { + if (count($this->$file) <= 1) return false; + foreach($this->$file as $key => $bout){ + if ($key == 0) continue; + if($objet == $bout[0]) return true; + } + } + return false; } - elseif ($max <= count($this->{"file_".$court})) return 4; //Vérification de la taille de la file d'attente - else $this->{"file_".$court}[] = array($objet, $nombre); - //Mise à jour des ressources de la planète en conséquence à la construction - $this->metal -= $a * $nombre; - $this->cristal -= $b * $nombre; - $this->hydrogene -= $c * $nombre; - $this->credits -= $d * $nombre; + function file_existTech($branch, $technology) + { + foreach($this->file_tech as $key => $part){ + if ($key == 0) continue; - if (!in_array("file_".$court, $this->modif)) $this->modif[] = "file_".$court; - return 0; - } - } + if($technology == $part[0] && $branch == $part[1]) return true; + } - function file_delObjet($file, $objet, $nombre = 1, $w = 99) { - $planete = $this; - switch($file){ - case "alli_batiments": $court = "abat"; $calc = "alli_batiment"; $exist = $this->file_exist($objet, "file_".$court); break; - case "batiments": $court = "bat"; $calc = "batiment"; $exist = $this->file_exist($objet, "file_".$court); break; - case "technologies": $court = "tech"; $calc = "technolo"; $exist = true; break; - case "casernes": $court = "cas"; $calc = "casernen"; $exist = $this->file_exist($objet, "file_".$court); break; - case "terrestres": $court = "ter"; $calc = "nomterrn"; $exist = $this->file_exist($objet, "file_".$court); break; - case "vaisseaux": $court = "vais"; $calc = "nomvaisn"; $exist = $this->file_exist($objet, "file_".$court); break; - default: return false; - } + return false; + } - //Si l'objet n'est pas dans la file d'attente, on annule la suite - if (!$exist) return 0; + /** + * Actualise la file $file en terminant les constructions/entraînements. + * @param string $file Nom de la file d'attente + * + * @return boolean + * @access public + */ + function file_ready($file) + { + $planete = $this; - if ($w == 99) $w = count($this->{"file_".$court})-1; + switch($file) + { + case "alli_batiments": + $court = "abat"; + $calc = "alli_batiment"; + $exist = $this->file_exist($objet, "file_".$court); + break; - //On gère les files de type arbre - if ($file == "technologies") { - if (isset($this->{"file_".$court}[$objet+1])) { - global ${$file.'CALC'}; - //On réinitialise le temps si c'est la première - if ($objet == 0) $this->{"file_".$court}[0] = time(); + case "batiments": + $court = "bat"; + $calc = "batiment"; + break; - $i = $objet; - $filearbre = $this->{"file_".$court}[$objet+1][1]; - $objet = $this->{"file_".$court}[$objet+1][0]; + case "technologies": + die('Erreur dans la file d\'attente : #449. Veuillez contacter un administrateur.'); + break; - if (!$this->file_exist($objet, $filearbre)) return 0; + case "casernes": + $court = "cas"; + $calc = "casernen"; + break; - unset($this->{"file_".$court}[$i+1]); + case "terrestres": + $court = "ter"; + $calc = "nomterrn"; + break; + + case "vaisseaux": + $court = "vais"; + $calc = "nomvaisn"; + break; + + default: + return false; + } + + if (empty($this->{"file_".$court}[0])) + return false; + + //Calcul du temps écoulé depuis le dernier entrainement validé + $tps = time() - $this->{"file_".$court}[0]; + + global ${$calc}, ${$calc.'CALC'}; + + foreach($this->{"file_".$court} as $key => $bout) + { + if ($key == 0) continue; + + if ($bout[1] < 0) $n = $this->{$file}[$bout[0]]; //Extraction du niveau en cours + else $n = $this->{$file}[$bout[0]] + 1; //Extraction du niveau en cours + eval(${$calc.'CALC'}[$bout[0]][3]); //Récupération du temps de construction + + //On applique le bonus de temps des ingénieurs et des centrales informatiques + if ($file == "batiments" && $bout[0] != 11) $sec /= pow(1.23,$this->batiments[11]) + 0.0025*$this->casernes[7]; + + + //Accélération du temps de construction + $sec /= VITESSE; + + if ($bout[1] < 0) + { + $sec *= 0.6; + + if ($sec < $tps) + { + eval(${$calc.'CALC'}[$bout[0]][0]); + eval(${$calc.'CALC'}[$bout[0]][1]); + eval(${$calc.'CALC'}[$bout[0]][2]); + + //On reçoit 70% des ressources en bonus + $this->metal += $a * 0.7; + $this->cristal += $b * 0.7; + $this->hydrogene += $c * 0.7; + + $this->{$file}[$bout[0]]--; + $this->{"file_".$court}[0] += $bout[1] * $sec; + $tps -= $sec; + unset($this->{"file_".$court}[$key]); + + if (!in_array($file, $this->modif)) $this->modif[] = $file; + if (!in_array("file_".$court, $this->modif)) $this->modif[] = "file_".$court; + } + } + elseif ($sec * $bout[1] < $tps && $bout[1] > 0) + { + //S'il s'agit d'un silo, on sauvegarde le temps pour utilisation par le script de production + if ($file == "batiments" && $bout[0] == 10) $timestamp_lastSilo = $this->{"file_".$court}[0]; + if ($file == "batiments" && $bout[0] == 0) $timestamp_mineM = $this->{"file_".$court}[0]; + if ($file == "batiments" && $bout[0] == 1) $timestamp_mineC = $this->{"file_".$court}[0]; + if ($file == "batiments" && $bout[0] == 2) $timestamp_mineH = $this->{"file_".$court}[0]; + + $this->{$file}[$bout[0]] += $bout[1]; + $this->{"file_".$court}[0] += $bout[1] * $sec; + $tps -= $bout[1] * $sec; + unset($this->{"file_".$court}[$key]); + + if (!in_array($file, $this->modif)) $this->modif[] = $file; + if (!in_array("file_".$court, $this->modif)) $this->modif[] = "file_".$court; + } + elseif ($sec < time() - $this->{"file_".$court}[0] && $bout[1] > 0) + { + $j = floor($tps/$sec); + + $this->{"file_".$court}[$key][1] -= $j; + $this->{$file}[$bout[0]] += $j; + $this->{"file_".$court}[0] += $j * $sec; + $tps -= $j * $sec; + + if (!in_array($file, $this->modif)) $this->modif[] = $file; + if (!in_array("file_".$court, $this->modif)) $this->modif[] = "file_".$court; + + //Comme la première attente n'est pas terminée, on stoppe le tout + break; + } + else break; + } + //On actualise seulement s'il y a eu une modification de faite + if (in_array($file, $this->modif)) $this->actualiser(false); $this->{"file_".$court} = array_merge($this->{"file_".$court}); } - } - else { - global ${$calc}, ${$calc.'CALC'}; - for($i = $w; $i > 0; $i--) { - if($this->{"file_".$court}[$i][0] == $objet){ - $nombre = min(abs($nombre), $this->{"file_".$court}[$i][1]); + function file_readyTechno($file) + { + $planete = $this; - if($this->{"file_".$court}[$i][1] <= $nombre) { - unset($this->{"file_".$court}[$i]); - $this->{"file_".$court} = array_merge($this->{"file_".$court}); + $court = "tech"; $calc = "technolo"; + + if (empty($this->file_tech[0])) return false; + + //Calcul du temps écoulé depuis le dernier entrainement validé + $tps = time() - $this->file_tech[0]; + + global $technologiesCALC; + + foreach($this->file_tech as $key => $bout) + { + if ($key == 0) continue; + + //Récupération du temps de recherche + $sec = $technologiesCALC[$bout[1]][$bout[0]][3] / (1 + $this->batiments[6] * 0.01); + + //Accélération du temps de construction en fonction de la vitesse du serveur + $sec /= VITESSE; + + if ($sec < $tps) + { + $this->technologies[$bout[1]] |= $technologiesCALC[$bout[1]][$bout[0]][0]; + $this->file_tech[0] += $sec; + $tps -= $sec; + unset($this->file_tech[$key]); + $this->file_tech = array_merge($this->file_tech); + + //La déouverte de technologie est bénéfique pour le moral de la population + if ($this->moral) { + if ($this->politique == 3) $this->setMoral(0.1); //Démocratie : Découvrir une nouvelle technologie a plus d'effet bénéfique sur le moral + else $this->setMoral(0.05); + } + + if (!in_array("technologies", $this->modifUser)) $this->modifUser[] = "technologies"; + if (!in_array("file_tech", $this->modif)) $this->modif[] = "file_tech"; + } + else break; } - else $this->{"file_".$court}[$i][1] -= $nombre; - - if ($i == 1) $this->{"file_".$court}[0] = time(); - break; - } + if (in_array("file_tech", $this->modif)) $this->actualiser(false); } - - //Calcul du prochain niveau de l'objet - $n = $this->{$file}[$objet] + 1; - } - - - if (!in_array("file_".$court, $this->modif)) $this->modif[] = "file_".$court; - - if ($nombre > 0) { - if ($file == "batiments") { - eval(${$calc.'CALC'}[$objet][0]); - eval(${$calc.'CALC'}[$objet][1]); - eval(${$calc.'CALC'}[$objet][2]); - $d = 0; - } - elseif ($file == "technologies") { - $a = $b = $c = 0; - $d = $technologiesCALC[$filearbre][$objet][2]; - } - else { - $a = ${$calc.'CALC'}[$objet][0]; - $b = ${$calc.'CALC'}[$objet][1]; - $c = ${$calc.'CALC'}[$objet][2]; - $d = 0; - } - - //On applique les bonus politiques aux temps et coûts - if (isset($this->politique) && $this->politique == 1 && ($file == "casernes" || $file == "terrestres" || $file == "vaisseaux")) { - $a *= 0.9; - $b *= 0.9; - $c *= 0.9; - } - - //Mise à jour des ressources de la planète en conséquence à la construction - $this->metal += $a * $nombre; - $this->cristal += $b * $nombre; - $this->hydrogene += $c * $nombre; - $this->credits += $d * $nombre; - } - - return $nombre; } - - /** - * Vérifie l'existance dans la file $file d'attente de $objet - * @param int $objet ID à vérifier - * @param string $file Nom de la file d'attente - * - * @return boolean - * @access public - */ - function file_exist($objet, $file){ - //On traite le cas d'une file type arbre - if (is_numeric($file)) { - foreach($this->file_tech as $key => $bout){ - if ($key == 0) continue; - if($objet == $bout[0] && $file == $bout[1]) return true; - } - } - else { - if (count($this->$file) <= 1) return false; - foreach($this->$file as $key => $bout){ - if ($key == 0) continue; - if($objet == $bout[0]) return true; - } - } - return false; - } - - /** - * Actualise la file $file en terminant les constructions/entraînements. - * @param string $file Nom de la file d'attente - * - * @return boolean - * @access public - */ - function file_pret($file){ - $planete = $this; - switch($file){ - case "alli_batiments": $court = "abat"; $calc = "alli_batiment"; $exist = $this->file_exist($objet, "file_".$court); break; - case "batiments": $court = "bat"; $calc = "batiment"; break; - case "technologies": $court = "tech"; $calc = "technolo"; break; - case "casernes": $court = "cas"; $calc = "casernen"; break; - case "terrestres": $court = "ter"; $calc = "nomterrn"; break; - case "vaisseaux": $court = "vais"; $calc = "nomvaisn"; break; - default: return false; - } - - if (empty($this->{"file_".$court}[0])) return false; - - //Calcul du temps écoulé depuis le dernier entrainement validé - $tps = time() - $this->{"file_".$court}[0]; - - if ($file == "technologies") { - global ${$file.'CALC'}; - - foreach($this->{"file_".$court} as $key => $bout) { - if ($key == 0) continue; - - //Récupération du temps de recherche - $sec = $technologiesCALC[$bout[1]][$bout[0]][3] / (1 + $this->batiments[6] * 0.01); - - //On applique les bonus politiques aux temps et coûts - if (isset($this->politique) && $this->politique == 1 && ($file == "casernes" || $file == "terrestres" || $file == "vaisseaux")) { - $sec *= 0.9; - } - - //Accélération du temps de construction - $sec /= VITESSE; - - if ($sec < $tps) { - $this->{$file}[$bout[1]] += $technologiesCALC[$bout[1]][$bout[0]][0]; - $this->{"file_".$court}[0] += $sec; - $tps -= $sec; - unset($this->{"file_".$court}[$key]); - $this->{"file_".$court} = array_merge($this->{"file_".$court}); - - //La déouverte de technologie est bénéfique pour le moral de la population - if ($this->moral) { - if ($this->politique == 3) $this->setMoral(0.1); //Démocratie : Découvrir une nouvelle technologie a plus d'effet bénéfique sur le moral - else $this->setMoral(0.05); - } - - if (!in_array($file, $this->modifUser)) $this->modifUser[] = $file; - if (!in_array("file_".$court, $this->modif)) $this->modif[] = "file_".$court; - } - else break; - } - if (in_array("file_".$court, $this->modif)) $this->actualiser(false); - } - else { - global ${$calc}, ${$calc.'CALC'}; - - foreach($this->{"file_".$court} as $key => $bout) { - if ($key == 0) continue; - - $n = $this->{$file}[$bout[0]] + 1; //Extraction du niveau en cours - eval(${$calc.'CALC'}[$bout[0]][3]); //Récupération du temps de construction - - //var_dump($bout[0], $n); - - //Accélération du temps de construction - $sec = floor($sec/VITESSE); - - if ($bout[1] < 0) { - $n--; - eval(${$calc.'CALC'}[$bout[0]][3]); - $sec = floor($sec*0.6/VITESSE); - - if ($sec < $tps) { - eval(${$calc.'CALC'}[$bout[0]][0]); - eval(${$calc.'CALC'}[$bout[0]][1]); - eval(${$calc.'CALC'}[$bout[0]][2]); - - //On reçoit 70% des ressources en bonus - $this->metal += $a * 0.7; - $this->cristal += $b * 0.7; - $this->hydrogene += $c * 0.7; - - $this->{$file}[$bout[0]]--; - $this->{"file_".$court}[0] += $bout[1] * $sec; - $tps -= $sec; - unset($this->{"file_".$court}[$key]); - - if (!in_array($file, $this->modif)) $this->modif[] = $file; - if (!in_array("file_".$court, $this->modif)) $this->modif[] = "file_".$court; - } - } - elseif ($sec * $bout[1] < $tps && $bout[1] > 0) { - //S'il s'agit d'un silo, on sauvegarde le temps pour utilisation par le script de production - if ($file == "batiments" && $bout[0] == 10) $timestamp_lastSilo = $this->{"file_".$court}[0]; - if ($file == "batiments" && $bout[0] == 0) $timestamp_mineM = $this->{"file_".$court}[0]; - if ($file == "batiments" && $bout[0] == 1) $timestamp_mineC = $this->{"file_".$court}[0]; - if ($file == "batiments" && $bout[0] == 2) $timestamp_mineH = $this->{"file_".$court}[0]; - $this->{$file}[$bout[0]] += $bout[1]; - $this->{"file_".$court}[0] += $bout[1] * $sec; - $tps -= $bout[1] * $sec; - unset($this->{"file_".$court}[$key]); - - if (!in_array($file, $this->modif)) $this->modif[] = $file; - if (!in_array("file_".$court, $this->modif)) $this->modif[] = "file_".$court; - } - elseif ($sec < time() - $this->{"file_".$court}[0] && $bout[1] > 0) { - //TODO Trouver plus simple que la ligne en dessous - for($j=0 ; $j * $sec < $tps ; $j++) {} - $j--; - $this->{"file_".$court}[$key][1] -= $j; - $this->{$file}[$bout[0]] += $j; - $this->{"file_".$court}[0] += $j * $sec; - $tps -= $j * $sec; - - if (!in_array($file, $this->modif)) $this->modif[] = $file; - if (!in_array("file_".$court, $this->modif)) $this->modif[] = "file_".$court; - - //Comme la première attente n'est pas terminée, on stoppe la vérification - break; - } - else break; - } - //On actualise seulement s'il y a eu une modification de faite - if (in_array($file, $this->modif)) $this->actualiser(false); - $this->{"file_".$court} = array_merge($this->{"file_".$court}); - } - } -} ?> \ No newline at end of file diff --git a/game/Class/class.flotte.php b/game/Class/class.flotte.php index 6b05574..c796d49 100644 --- a/game/Class/class.flotte.php +++ b/game/Class/class.flotte.php @@ -1,4 +1,5 @@ connexion(); - $bdd->escape($id); - $flotte = $bdd->unique_query("SELECT * FROM $table_flottes WHERE id = $id;"); - $bdd->query("UPDATE $table_flottes SET last = ".time()." WHERE id = $id;"); //Obtention d'un vérrou de 10 seconde sur la flotte - $bdd->deconnexion(); - if (!empty($flotte)) { - $this->id_flotte = $flotte["id"]; - $this->nom = $flotte["nom"]; - $this->start_planete = $flotte["start_planete"]; - $this->start_time = $flotte["start_time"]; - $this->end_planete = $flotte["end_planete"]; - $this->end_time = $flotte["end_time"]; - $this->ret_planete = $flotte["ret_planete"]; - $this->ret_time = $flotte["ret_time"]; - $this->tactique = $flotte["tactique"]; - $this->mission = $flotte["mission"]; - $this->statut = $flotte["statut"]; - $this->last = $flotte["last"]; - $this->nb_vais = $flotte["nb_vais"]; + /** + * Constructeur + * @param int $id id de la flotte à importer + * + * @return void + * @access public + */ + function Flotte($id = 0) + { + if (!empty($id)) + { + global $var___db, $config, $table_flottes; + global $nomvaisnVAR, $ressoVAR; + $bdd = new bdd(); + $bdd->connexion(); + $bdd->escape($id); + $flotte = $bdd->unique_query("SELECT * FROM $table_flottes WHERE id = $id;"); + $bdd->query("UPDATE $table_flottes SET last = ".time()." WHERE id = $id;"); //Obtention d'un vérrou de 10 seconde sur la flotte + $bdd->deconnexion(); + if (!empty($flotte)) + { + $this->id_flotte = $flotte["id"]; + $this->nom = $flotte["nom"]; + $this->start_planete = $flotte["start_planete"]; + $this->start_time = $flotte["start_time"]; + $this->end_planete = $flotte["end_planete"]; + $this->end_time = $flotte["end_time"]; + $this->ret_planete = $flotte["ret_planete"]; + $this->ret_time = $flotte["ret_time"]; + $this->tactique = $flotte["tactique"]; + $this->mission = $flotte["mission"]; + $this->vitesse = $flotte["vitesse"]; + $this->statut = $flotte["statut"]; + $this->last = $flotte["last"]; + $this->nb_vais = $flotte["nb_vais"]; - foreach($nomvaisnVAR as $vais){ - $this->vaisseaux[] = $flotte[$vais]; - } + foreach($nomvaisnVAR as $vais) + $this->vaisseaux[] = $flotte[$vais]; - $this->contenu = array($flotte["contenu_metal"], $flotte["contenu_cristal"], $flotte["contenu_hydrogene"]); + $this->contenu = array($flotte["contenu_metal"], $flotte["contenu_cristal"], $flotte["contenu_hydrogene"]); - $this->calculer(); - } - } - } - - function calculer(){ - global $nomvais_rs; - - $this->nb_vais = 0; - - //Calcul de la capacité maximale d'embarquement de la flotte - foreach($this->vaisseaux as $key => $vais){ - $this->nb_vais += $vais; - $this->contenuMax += $nomvais_rs[$key] * $vais; - } - } - - function load_planete(){ - if (is_numeric($this->start_planete) && !empty($this->start_planete)) { - $this->start_planete = new Planete($this->start_planete); - } - if (is_numeric($this->end_planete) && !empty($this->end_planete)) { - $this->end_planete = new Planete($this->end_planete); - } - if (is_numeric($this->ret_planete) && !empty($this->ret_planete)) { - $this->ret_planete = new Planete($this->ret_planete); - } - } - - function calc_deplacement($start_galaxie, $start_systeme, $start_position, $end_galaxie, $end_systeme, $end_position, $vitesse, $returnArray = false, $returnConso = false){ - //Si la planète de départ n'est pas chargée, on charge les planètes - if (is_numeric($this->start_planete)) $this->load_planete(); - global $config, $nomvais_vitesseP, $nomvais_vitesseS, $nomvais_vitesseG, $nomvais_rs; - $this->vitesse = $vitesse; - - //Calcul de la longueur du déplacement - $diff_galaxie = abs($start_galaxie - $end_galaxie); - $diff_systeme = abs($start_systeme - $end_systeme); - $diff_position = abs($start_position - $end_position); - - $diff_centre_position_start = abs(ceil($config['nb_amas']/2) - $start_position); - $diff_centre_systeme_start = abs(ceil($config['nb_systeme']/2) - $start_systeme); - - $diff_centre_position_end = abs(ceil($config['nb_amas']/2) - $end_position); - $diff_centre_systeme_end = abs(ceil($config['nb_systeme']/2) - $end_systeme); - - //Calcul du temps de déplacement pour chaque vaisseau - $temps = array(); $conso = array(0, 0, 0); - foreach($this->vaisseaux as $key => $vais){ - //S'il n'y a pas de vaisseaux de ce type, on ne calcul pas leur vitesse - if ($vais == 0) continue; - - //Calcul du temps de déplacement entre planètes - if ($start_systeme == $end_systeme && $start_galaxie == $end_galaxie) { - $temps[0][$key] = (10/$nomvais_vitesseP[$key]) * (1 + 0.1 * $diff_position); - $temps[1][$key] = $temps[2][$key] = 0; - } - //Calcul du temps de déplacement entre système - elseif ($start_galaxie == $end_galaxie) { - $temps[0][$key] = (10/$nomvais_vitesseP[$key]) * (1 + 0.1 * ($diff_centre_position_start + $diff_centre_position_end)); - $temps[1][$key] = (20/$nomvais_vitesseS[$key]) * (2 + 1 * $diff_systeme); - $temps[2][$key] = 0; - } - //Calcul du temps de déplacement entre galaxies - else { - $temps[0][$key] = (10/$nomvais_vitesseP[$key]) * (1 + 0.1 * ($diff_centre_position_start + $diff_centre_position_end)); - $temps[1][$key] = (20/$nomvais_vitesseS[$key]) * (2 + 1 * ($diff_centre_systeme_start + $diff_centre_systeme_end)); - $temps[2][$key] = (50/$nomvais_vitesseG[$key]) * (2 + 1.5 * $diff_galaxie); - } - - //Calcul du bonus pour le réacteur à combustion - $techR = $this->start_planete->technologies[1]; - if ($techR & 56) $bonus = 0.7; - elseif ($techR & 24) $bonus = 0.8; - elseif ($techR & 8) $bonus = 0.9; - else $bonus = 1; - $temps[0][$key] *= $bonus * 1/$vitesse; - $conso[0] += $vais * $temps[0][$key] * $bonus / exp($vitesse/5); - - //Calcul du bonus pour le réacteur à fusion - $techR = $this->start_planete->technologies[1]; - if ($techR & 448) $bonus = 0.7; - elseif ($techR & 192) $bonus = 0.8; - elseif ($techR & 64) $bonus = 0.9; - else $bonus = 1; - $temps[1][$key] *= $bonus * 1/$vitesse; - $conso[1] += $vais * $temps[1][$key] * $bonus / exp($vitesse/7.5); - - //Calcul du bonus pour le réacteur à fusion de type II - $techR = $this->start_planete->technologies[1]; - if ($techR & 3584) $bonus = 0.7; - elseif ($techR & 1536) $bonus = 0.8; - elseif ($techR & 512) $bonus = 0.9; - else $bonus = 1; - $temps[2][$key] *= $bonus * 1/$vitesse; - $conso[2] += $vais * $temps[2][$key] * $bonus / exp($vitesse/10); - } - - if (!isset($this->vaisseaux[4])) $this->vaisseaux[4] = 0; - if (!isset($this->vaisseaux[5])) $this->vaisseaux[5] = 0; - - //Si les chasseurs peuvent rentrer dans les cales des vaisseaux, on les enlèves - if ($this->contenuMax - ($this->contenu[0] + $this->contenu[1] + $this->contenu[2]) - ($this->vaisseaux[4] * $nomvais_rs[4] + $this->vaisseaux[5] * $nomvais_rs[5]) >= ($this->vaisseaux[4] + $this->vaisseaux[5]) * 200) { - $temps[2][4] = $temps[2][5] = $temps[1][4] = $temps[1][5] = $temps[0][4] = $temps[0][5] = 0; - } - - //On calcul le temps de déplacement maximal - if ($returnArray) return $temps; - elseif ($returnConso) return array(max($temps[0]) + max($temps[1]) + max($temps[2]), ceil($conso[0]+$conso[1]+$conso[2])); - else return (max($temps[0]) + max($temps[1]) + max($temps[2])); - } - - function check_mission(){ - //On vérifie qu'un calcul ne soit pas déjà en cours - if ($this->last >= time() - 10) return false; - elseif ($this->start_time + $this->end_time < time()) return false; - elseif ($this->statut == 1 && ($this->ret_time > time() || $this->start_time + $this->end_time * 2 >= time())) return $this->retourner(); - - switch($this->mission){ - case 0: - case 5: - return $this->stationner(); - break; - case 1: - return $this->transporter(); - break; - case 2: - return $this->coloniser(); - break; - case 3: - return $this->espionner(); - break; - case 4: - return $this->attaquer(); - break; - } - } - - function rappeler(){ - if ($this->start_time + $this->end_time >= time()) return false; - else { - $this->end_time = time() - $this->start_time + 10; - $this->mission = 5; - if (!in_array('mission', $this->modifFlotte)) $this->modifFlotte[] = 'mission'; - if (!in_array('end_time', $this->modifFlotte)) $this->modifFlotte[] = 'end_time'; - return true; - } - } - - function retourner(){ - //Si la planète de départ n'est pas chargée, on charge les planètes - if (is_numeric($this->start_planete)) $this->load_planete(); - - //Si on a demandé une planète particulière au retour - if (!empty($this->ret_time) && !empty($this->ret_planete) && !is_numeric($this->ret_planete)) { - foreach($this->vaisseaux as $key => $vais){ - $this->ret_planete->vaisseaux[$key] += $vais; - } - } - //Si le retour se fait sur la planète source - else { - foreach($this->vaisseaux as $key => $vais){ - $this->start_planete->vaisseaux[$key] += $vais; - } - } - $this->modifFlotte = "DELETE"; - } - - /** - * Destructeur - * - * @return void - * @access public - */ - function __destruct(){ - global $var___db, $config, $table_flottes; - $nb = count($this->modifFlotte); - $out = array(); - $bdd = new bdd(); - $bdd->connexion(); - if ($this->modifFlotte === "DELETE") $bdd->query("DELETE FROM $table_flottes WHERE id = ".$this->id_flotte.";"); - else { - if (empty($this->id_flotte)) { - if ($this->modifFlotte === "INSERT") { - $out1 = ''; $out2 = ''; - global $nomvaisnVAR; - foreach ($this->vaisseaux as $key => $vais){ - $out1 .= ', '.$nomvaisnVAR[$key]; - $out2 .= ', '.$vais; + $this->calculer(); + } } - $sql = "INSERT INTO $table_flottes (id_user, mission, start_time, start_planete, end_time, end_planete, vitesse, contenu_metal, contenu_cristal, contenu_hydrogene, tactique, nom, nbvais$out1) VALUES ('".$this->start_planete->id_user."', '".$this->mission."', '".$this->start_time."', '".$this->start_planete->id."', '".$this->end_time."', '".$this->end_planete."', '".$this->vitesse."', '".$this->contenu[0]."', '".$this->contenu[1]."', '".$this->contenu[2]."', '".$this->tactique."', '".$this->nom.", ".$nb_vais."'$out2);"; - //var_dump($sql); - $bdd->query($sql); - } } - else { - for($i = 0; $i < $nb; $i++){ - if (!is_array($this->{$this->modifFlotte[$i]})) { - $bdd->escape($this->{$this->modifFlotte[$i]}); - if (is_int($this->{$this->modifFlotte[$i]}) || is_float($this->{$this->modifFlotte[$i]})) $out[] .= $this->modifFlotte[$i]." = ".$this->{$this->modifFlotte[$i]}; - else $out[] .= $this->modifFlotte[$i]." = '".$this->{$this->modifFlotte[$i]}."'"; - } - else { - if ($this->modifFlotte[$i] == "contenu") $calc = "resso"; - elseif ($this->modifFlotte[$i] == "vaisseaux") $calc = "nomvaisn"; - if (!isset(${$calc.'VAR'})) global ${$calc.'VAR'}; - $nombr = count(${$calc.'VAR'}); - for($j = 0; $j < $nombr; $j++){ - $bdd->escape($this->{$this->modifFlotte[$i]}[$j]); - $out[] = ${$calc.'VAR'}[$j]." = ".$this->{$this->modifFlotte[$i]}[$j]; - } + function calculer() + { + global $nomvais_rs; + + $this->nb_vais = 0; + + //Calcul de la capacité maximale d'embarquement de la flotte + foreach($this->vaisseaux as $key => $vais) + { + $this->nb_vais += $vais; + $this->contenuMax += $nomvais_rs[$key] * $vais; } - } - if (!empty($out)) $bdd->query("UPDATE $table_flottes SET ".implode(', ', $out).", last = 0 WHERE id = ".$this->id_flotte.";"); - else $bdd->query("UPDATE $table_flottes SET last = 0 WHERE id = ".$this->id_flotte.";"); } - } - $bdd->deconnexion(); + + + function load_planete() + { + if (is_numeric($this->start_planete) && !empty($this->start_planete)) + { + global $planete; + //Si la planète est la même que celle du joueur actuel, on l'utilise, sinon, on la crée + if ($planete->id == $this->start_planete) + $this->start_planete = $planete; + else + $this->start_planete = new Planete($this->start_planete); + } + if (is_numeric($this->end_planete) && !empty($this->end_planete)) + { + global $planete; + //Si la planète est la même que celle du joueur actuel, on l'utilise, sinon, on la crée + if ($planete->id == $this->end_planete) + $this->end_planete = $planete; + else + $this->end_planete = new Planete($this->end_planete); + } + if (is_numeric($this->ret_planete) && !empty($this->ret_planete)) + { + global $planete; + //Si la planète est la même que celle du joueur actuel, on l'utilise, sinon, on la crée + if ($planete->id == $this->ret_planete) + $this->ret_planete = $planete; + else + $this->ret_planete = new Planete($this->ret_planete); + } + } + + + function calc_deplacement($start_galaxie, $start_systeme, $start_position, $end_galaxie, $end_systeme, $end_position, $vitesse, $returnArray = false, $returnConso = false) + { + //Si la planète de départ n'est pas chargée, on charge les planètes + if (is_numeric($this->start_planete)) + $this->load_planete(); + global $config, $nomvais_vitesseP, $nomvais_vitesseS, $nomvais_vitesseG, $nomvais_rs; + $this->vitesse = $vitesse; + + //Calcul de la longueur du déplacement + $diff_galaxie = abs($start_galaxie - $end_galaxie); + $diff_systeme = abs($start_systeme - $end_systeme); + $diff_position = abs($start_position - $end_position); + + $diff_centre_position_start = abs(ceil($config['nb_amas']/2) - $start_position); + $diff_centre_systeme_start = abs(ceil($config['nb_systeme']/2) - $start_systeme); + + $diff_centre_position_end = abs(ceil($config['nb_amas']/2) - $end_position); + $diff_centre_systeme_end = abs(ceil($config['nb_systeme']/2) - $end_systeme); + + //Calcul du temps de déplacement pour chaque vaisseau + $temps = array(); $conso = array(0, 0, 0); + foreach($this->vaisseaux as $key => $vais) + { + //S'il n'y a pas de vaisseaux de ce type, on ne calcul pas leur vitesse + if ($vais == 0) + continue; + + //Calcul du temps de déplacement entre planètes + if ($start_systeme == $end_systeme && $start_galaxie == $end_galaxie) + { + $temps[0][$key] = (10/$nomvais_vitesseP[$key]) * (1 + 0.1 * $diff_position); + $temps[1][$key] = $temps[2][$key] = 0; + } + //Calcul du temps de déplacement entre système + elseif ($start_galaxie == $end_galaxie) + { + $temps[0][$key] = (10/$nomvais_vitesseP[$key]) * (1 + 0.1 * ($diff_centre_position_start + $diff_centre_position_end)); + $temps[1][$key] = (20/$nomvais_vitesseS[$key]) * (2 + 1 * $diff_systeme); + $temps[2][$key] = 0; + } + //Calcul du temps de déplacement entre galaxies + else + { + $temps[0][$key] = (10/$nomvais_vitesseP[$key]) * (1 + 0.1 * ($diff_centre_position_start + $diff_centre_position_end)); + $temps[1][$key] = (20/$nomvais_vitesseS[$key]) * (2 + 1 * ($diff_centre_systeme_start + $diff_centre_systeme_end)); + $temps[2][$key] = (50/$nomvais_vitesseG[$key]) * (2 + 1.5 * $diff_galaxie); + } + + //Calcul du bonus pour le réacteur à combustion + $techR = $this->start_planete->technologies[1]; + if ($techR & 56) + $bonus = 0.7; + elseif ($techR & 24) + $bonus = 0.8; + elseif ($techR & 8) + $bonus = 0.9; + else + $bonus = 1; + $temps[0][$key] *= $bonus * 1/$vitesse; + $conso[0] += $vais * $temps[0][$key] * $bonus / exp($vitesse/5); + + //Calcul du bonus pour le réacteur à fusion + $techR = $this->start_planete->technologies[1]; + if ($techR &448) + $bonus = 0.7; + elseif ($techR &192) + $bonus = 0.8; + elseif ($techR &64) + $bonus = 0.9; + else + $bonus = 1; + $temps[1][$key] *= $bonus * 1/$vitesse; + $conso[1] += $vais * $temps[1][$key] * $bonus / exp($vitesse/7.5); + + //Calcul du bonus pour le réacteur à fusion de type II + $techR = $this->start_planete->technologies[1]; + if ($techR &3584) + $bonus = 0.7; + elseif ($techR &1536) + $bonus = 0.8; + elseif ($techR &512) + $bonus = 0.9; + else + $bonus = 1; + $temps[2][$key] *= $bonus * 1/$vitesse; + $conso[2] += $vais * $temps[2][$key] * $bonus / exp($vitesse/10); + } + + if (!isset($this->vaisseaux[4])) + $this->vaisseaux[4] = 0; + if (!isset($this->vaisseaux[5])) + $this->vaisseaux[5] = 0; + + //Si les chasseurs peuvent rentrer dans les cales des vaisseaux, on les enlèves + if ($this->contenuMax - ($this->contenu[0] + $this->contenu[1] + $this->contenu[2]) - ($this->vaisseaux[4] * $nomvais_rs[4] + $this->vaisseaux[5] * $nomvais_rs[5]) >= ($this->vaisseaux[4] + $this->vaisseaux[5]) * 200) + $temps[2][4] = $temps[2][5] = $temps[1][4] = $temps[1][5] = $temps[0][4] = $temps[0][5] = 0; + + //On calcul le temps de déplacement maximal + if ($returnArray) + return $temps; + elseif ($returnConso) + return array(max($temps[0]) + max($temps[1]) + max($temps[2]), ceil($conso[0]+$conso[1]+$conso[2])); + else + return (max($temps[0]) + max($temps[1]) + max($temps[2])); + } + + + function check_mission() + { + //On vérifie qu'un calcul ne soit pas déjà en cours + if ($this->last >= time() - 10) + return false; + elseif ($this->start_time + $this->end_time > time()) + return false; + + if ($this->statut == 0) + { + switch($this->mission) + { + case 0: + return $this->stationner(); + break; + case 1: + return $this->transporter(); + break; + case 2: + return $this->coloniser(); + break; + case 3: + return $this->attaquer(); + break; + case 4: + return $this->recycler(); + break; + case 5: + return $this->espionner(); + break; + } + } + + if ($this->statut == 1 && ($this->ret_time > time() || $this->start_time + $this->end_time * 2 <= time())) + return $this->retourner(); + } + + + function stationner() + { + //On décharge les ressources éventuellement contenue + $this->decharger(); + + //On fait atterir les vaisseaux + foreach ($this->vaisseaux as $key => $vais) + $this->end_planete->vaisseaux[$key] += $vais; + + if (!in_array("vaisseaux", $this->end_planete->modif)) + $this->end_planete->modif[] = "vaisseaux"; + $this->modifFlotte = "DELETE"; + } + + + function transporter() + { + $max = $this->decharger(); + + //Envoie du MP de confirmation au joueur + $send = new Rapport(2, $this->start_planete->id_user, $this->end_planete->id_user, $this->start_time + $this->end_time); + $send->addInfo(array($this->end_planete->nom_planete, $this->end_planete->galaxie, $this->end_planete->ss, $this->end_planete->position), 0); + $send->addInfo($max, 1); + + $this->statut = 1; + if (!in_array('statut', $this->modifFlotte)) + $this->modifFlotte[] = 'statut'; + } + + + function coloniser() + { + //On vérifie que les coordonnées de la planètes sont bien enregistrée + if (empty($this->end_planete) || is_object($this->end_planete) || !preg_match('#^\[?([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\]?$#', $this->end_planete)) + { + $this->load_planete(); + file_log("Erreur de colonisation de la planète : ".$this->end_planete." pour le joueur : ".$this->start_planete->id_user, 2); + send_mp($this->start_planete->id_user, "Erreur de colonisation [F#01]", "Une erreur s'est produite lors de la tentative de colonisation de votre flotte, elle a fait demi-tour."); + $this->rappeler(); + } + + //On vérifie que la planète ne soit pas déjà colonisée + global $var___db, $config, $table_planete; + $bdd = new bdd(); + preg_match('#^\[?([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\]?$#', $this->end_planete, $position); + $bdd->connexion(); + $p = $bdd->query("SELECT * FROM $table_planete WHERE galaxie = ".$position[1]." AND ss = ".$position[2]." AND position = ".$position[3].";"); + $bdd->deconnexion(); + + if ($p) + { + $this->load_planete(); + + $rapport = new Rapport(2, $this->start_planete->id_user, 0, $this->start_time + $this->end_time); + $rapport->addInfo(array($position[1], $position[2], $position[3]), 0); + $rapport->addInfo(false, 1); + $rapport->send(); + } + else + { + $this->load_planete(); + + //On crée la planète + $this->end_planete = new Planete(); + $this->end_planete->galaxie = $position[1]; + $this->end_planete->ss = $position[2]; + $this->end_planete->position = $position[3]; + $this->end_planete->creer($this->start_planete->id_user); + + //Rembousement du carburant non utilisé (la colonisation prévois au départ un allé/retour) + $conso = $this->calc_deplacement($this->start_planete->galaxie, $this->start_planete->ss, $this->start_planete->position, $position[1], $position[2], $position[3], $this->vitesse, false, true); + $this->end_planete->hydrogene += $conso[1]; + + //On définit la limite de ressources pour permettre le déchargement de celles contenues dans les vaisseaux + $this->end_planete->cap = 100000; + + //On enlève un vaisseau de colonisation de la liste + $this->vaisseaux[2]--; + + //On fait atterir les vaisseaux et décharger les ressources + $this->decharger(); + $this->atterir(); + + //On envoie un rapport + $rapport = new Rapport(2, $this->start_planete->id_user, 0, $this->start_time + $this->end_time); + $rapport->addInfo(array($position[1], $position[2], $position[3]), 0); + $rapport->addInfo(true, 1); + $rapport->send(); + } + } + + + function recycler() + { + //Si la planète d'arrivé n'est pas chargée, on charge les planètes + if (is_numeric($this->end_planete)) + $this->load_planete(); + + $coeff = ($this->contenuMax - $this->contenu[0] - $this->contenu[1] - $this->contenu[2])/($this->end_planete->debris_met + $this->end_planete->debris_cri); + if ($coeff > 1) + $coeff = 1; + + $a = floor($this->end_planete->debris_met * $coeff); + $b = floor($this->end_planete->debris_cri * $coeff); + + $this->contenu[0] += $a; + $this->contenu[1] += $b; + if (!in_array('contenu', $this->modifFlotte)) + $this->modifFlotte[] = 'contenu'; + + $this->end_planete->debris_met -= $a; + $this->end_planete->debris_cri -= $b; + if (!in_array('debris_met', $this->end_planete->modif)) + $this->end_planete->modif[] = 'debris_met'; + if (!in_array('debris_cri', $this->end_planete->modif)) + $this->end_planete->modif[] = 'debris_cri'; + + //Send link + $rapport = new Rapport(4, $this->start_planete->id_user, 0, $this->start_time + $this->end_time); + $rapport->addInfo($this->end_planete, 0); + $rapport->addInfo(array($a, $b), 1); + $rapport->send(); + + $this->statut = 1; + if (!in_array('statut', $this->modifFlotte)) + $this->modifFlotte[] = 'statut'; + } + + + function espionnage() + { + //Si la planète d'arrivé n'est pas chargée, on charge les planètes + if (is_numeric($this->end_planete)) + $this->load_planete(); + + + + $this->statut = 1; + if (!in_array('statut', $this->modifFlotte)) + $this->modifFlotte[] = 'statut'; + } + + + function decharger() + { + //Si la planète d'arrivé n'est pas chargée, on charge les planètes + if (is_numeric($this->end_planete)) + $this->load_planete(); + $max = array(0, 0, 0); + + //Si on dépasse les capacités, on laisse les ressources en trop dans le cargo + if ($this->end_planete->metal + $this->contenu[0] > $this->end_planete->cap) + { + $max[0] = $this->end_planete->cap - $this->end_planete->metal; + if ($max[0] < 0) $max[0] = 0; + } + else + $max[0] = $this->contenu[0]; + $this->end_planete->metal += $max[0]; + $this->contenu[0] -= $max[0]; + + if ($this->end_planete->cristal + $this->contenu[1] > $this->end_planete->cap) + { + $max[1] = $this->end_planete->cap - $this->end_planete->cristal; + if ($max[1] < 0) $max[1] = 0; + } + else + $max[1] = $this->contenu[1]; + $this->end_planete->cristal += $max[1]; + $this->contenu[1] -= $max[1]; + + if ($this->end_planete->hydrogene + $this->contenu[2] > $this->end_planete->cap) + { + $max[2] = $this->end_planete->cap - $this->end_planete->hydrogene; + if ($max[2] < 0) $max[2] = 0; + } + else + $max[2] = $this->contenu[2]; + $this->end_planete->hydrogene += $max[2]; + $this->contenu[2] -= $max[2]; + + if (!in_array('contenu', $this->modifFlotte)) + $this->modifFlotte[] = 'contenu'; + return $max; + } + + + function atterir($planete = "end_planete") + { + //Si la planète d'arrivé n'est pas chargée, on charge les planètes + if (is_numeric($this->$planete)) + $this->load_planete(); + + if (isset($this->$planete->vaisseaux[0])) + { + foreach ($this->vaisseaux as $key => $vais) + $this->$planete->vaisseaux[$key] += $vais; + } + else + $this->$planete->vaisseaux = $this->vaisseaux; + + if (!in_array("vaisseaux", $this->$planete->modif)) + $this->$planete->modif[] = "vaisseaux"; + + $this->modifFlotte = "DELETE"; + } + + + function rappeler() + { + if ($this->start_time + $this->end_time >= time()) + return false; + else + { + $this->end_time = time() - $this->start_time + 10; + $this->mission = 5; + if (!in_array('mission', $this->modifFlotte)) + $this->modifFlotte[] = 'mission'; + if (!in_array('end_time', $this->modifFlotte)) + $this->modifFlotte[] = 'end_time'; + return true; + } + } + + + function retourner() + { + //Si la planète de départ n'est pas chargée, on charge les planètes + if (is_numeric($this->start_planete)) + $this->load_planete(); + + //Si on a demandé une planète particulière au retour + if (!empty($this->ret_time) && !empty($this->ret_planete) && !is_numeric($this->ret_planete)) + { + foreach($this->vaisseaux as $key => $vais) + $this->ret_planete->vaisseaux[$key] += $vais; + } + //Si le retour se fait sur la planète source + else + { + foreach($this->vaisseaux as $key => $vais) + $this->start_planete->vaisseaux[$key] += $vais; + } + + if (!in_array("vaisseaux", $this->start_planete->modif)) + $this->start_planete->modif[] = "vaisseaux"; + $this->modifFlotte = "DELETE"; + } + + /** + * Destructeur + * + * @return void + * @access public + */ + function __destruct() + { + global $var___db, $config, $table_flottes; + $nb = count($this->modifFlotte); + $out = array(); + $bdd = new bdd(); + $bdd->connexion(); + if ($this->modifFlotte === "DELETE") + $bdd->query("DELETE FROM $table_flottes WHERE id = ".$this->id_flotte.";"); + else + { + if (empty($this->id_flotte)) + { + if ($this->modifFlotte == "INSERT") + { + $out1 = ''; $out2 = ''; + global $nomvaisnVAR; + foreach ($this->vaisseaux as $key => $vais) + { + $out1 .= ', '.$nomvaisnVAR[$key]; + $out2 .= ', '.$vais; + } + $sql = "INSERT INTO $table_flottes (id_user, mission, start_time, start_planete, end_time, end_planete, vitesse, contenu_metal, contenu_cristal, contenu_hydrogene, tactique, nom, nb_vais$out1) VALUES ('".$this->start_planete->id_user."', '".$this->mission."', '".$this->start_time."', '".$this->start_planete->id."', '".$this->end_time."', '".$this->end_planete."', '".$this->vitesse."', '".$this->contenu[0]."', '".$this->contenu[1]."', '".$this->contenu[2]."', '".$this->tactique."', '".$this->nom."', ".$this->nb_vais."$out2);"; + //var_dump($sql); + $bdd->query($sql); + } + } + elseif(isset($this->modifFlotte[0])) + { + for($i = 0; $i < $nb; $i++) + { + if (!is_array($this->{$this->modifFlotte[$i]})) + { + $bdd->escape($this->{$this->modifFlotte[$i]}); + if (is_int($this->{$this->modifFlotte[$i]}) || is_float($this->{$this->modifFlotte[$i]})) + $out[] .= $this->modifFlotte[$i]." = ".$this->{$this->modifFlotte[$i]}; + else + $out[] .= $this->modifFlotte[$i]." = '".$this->{$this->modifFlotte[$i]}."'"; + } + else { + if ($this->modifFlotte[$i] == "contenu") + $calc = "resso"; + elseif ($this->modifFlotte[$i] == "vaisseaux") + $calc = "nomvaisn"; + + if (!isset(${$calc.'VAR'})) + global ${$calc.'VAR'}; + + $nombr = count(${$calc.'VAR'}); + for($j = 0; $j < $nombr; $j++) + { + $bdd->escape($this->{$this->modifFlotte[$i]}[$j]); + $out[] = ${$calc.'VAR'}[$j]." = ".$this->{$this->modifFlotte[$i]}[$j]; + } + } + } + if (!empty($out)) + $bdd->query("UPDATE $table_flottes SET ".implode(', ', $out).", last = 0 WHERE id = ".$this->id_flotte.";"); + else + $bdd->query("UPDATE $table_flottes SET last = 0 WHERE id = ".$this->id_flotte.";"); + } + } + $bdd->deconnexion(); + } } -} ?> \ No newline at end of file diff --git a/game/Class/class.planete.php b/game/Class/class.planete.php index e755809..dd873ca 100644 --- a/game/Class/class.planete.php +++ b/game/Class/class.planete.php @@ -3,481 +3,775 @@ * class.planete.php * ------------------- * begin : Jeudi 21 août 2008 - * update : Dimanche 7 septembre 2008 + * update : Dimanche 4 janvier 2008 * email : nemunaire@gmail.com * * ***************************************************************************/ -class Planete extends User{ - var $id, - $galaxie, - $ss, - $position, - $isolement, - $nom_planete, - $image, - $cases, - $casesRest, - $debris_met, - $debris_cri, - $metal, - $cristal, - $hydrogene, - $population, - $moral, - $alert_ressources = array(false, false, false), - $timestamp, - $timestamp_lastSilo, - $timestamp_lastMineM, - $timestamp_lastMineC, - $timestamp_lastMineH, - $energie, - $energieConso, - $file_tech, - $file_bat, - $file_cas, - $file_ter, - $file_vais, - $coeff_bat = array(), - $batiments = array(), - $casernes = array(), - $terrestres = array(), - $vaisseaux = array(), - $modif = array('metal', 'cristal', 'hydrogene', 'timestamp'); +class Planete extends Surface + { + var $position, + $isolement, + $nom_planete, + $cases, + $casesRest, + $cap, + $population, + $population_max, + $moral, + $timestamp_lastSilo, + $timestamp_lastMineM, + $timestamp_lastMineC, + $timestamp_lastMineH, + $energie, + $energieConso, + $file_tech, + $file_cas, + $file_ter, + $coeff_bat = array(), + $casernes = array(), + $terrestres = array(); - /** - * Constructeur - * @param int $id id de la planète à importer - * - * @return void - * @access public - */ - function Planete($id = 0, $first = false){ - if (!empty($id)) { - global $var___db, $config, $table_planete; - global $batimentVAR, $casernenVAR, $nomterrnVAR, $nomvaisnVAR; - $bdd = new bdd(); - $bdd->connexion(); - $bdd->escape($id); - $plan = $bdd->unique_query("SELECT * FROM $table_planete WHERE id = $id;"); - $bdd->deconnexion(); - if (!empty($plan)) { - $this->id = $plan["id"]; - parent::User($plan["id_user"]); - $this->galaxie = $plan["galaxie"]; - $this->ss = $plan["ss"]; - $this->position = $plan["position"]; - if (!empty($plan["isolement"])) $this->isolement = unserialize($plan["isolement"]); - else $this->isolement = array(); - $this->nom_planete = $plan["nom_planete"]; - $this->image = $plan["image"]; - $this->cases = $plan["cases"]; - $this->debris_met = $plan["debris_met"]; - $this->debris_cri = $plan["debris_cri"]; - $this->metal = $plan["metal"]; - $this->cristal = $plan["cristal"]; - $this->hydrogene = $plan["hydrogene"]; - $this->population = $plan["population"]; - $this->moral = $plan["moral"]; - $this->timestamp = $plan["timestamp"]; + /** + * Constructeur + * @param int $id id de la planète à importer + * + * @return void + * @access public + */ + function Planete($id = 0, $first = false) + { + if (!empty($id)) { + global $securePlanete; + global $var___db, $config, $table_planete; + global $batimentVAR, $casernenVAR, $nomterrnVAR, $nomvaisnVAR; + $actuFile = true; + $bdd = new bdd(); - foreach($batimentVAR as $bat){ - $this->batiments[] = $plan[$bat]; + //On traite le cas où l'on envoie les coordonnées + if (is_numeric($id)) + { + $bdd->connexion(); + $plan = $bdd->unique_query("SELECT * FROM $table_planete WHERE id = $id;"); + $bdd->deconnexion(); + } + elseif (preg_match('#^\[?([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\]?$#', $id, $position)) + { + $bdd->connexion(); + $plan = $bdd->unique_query("SELECT * FROM $table_planete WHERE galaxie = ".$position[1]." AND ss = ".$position[2]." AND position = ".$position[3].";"); + $bdd->deconnexion(); + } + else + die('Erreur #04 : Format de recherche de planete incorrect !'); + + if (!empty($plan)) + { + $this->id = $plan["id"]; + parent::User($plan["id_user"]); + $this->galaxie = $plan["galaxie"]; + $this->ss = $plan["ss"]; + $this->position = $plan["position"]; + if (!empty($plan["isolement"])) $this->isolement = unserialize($plan["isolement"]); + else $this->isolement = array(); + $this->nom_planete = $plan["nom_planete"]; + $this->image = $plan["image"]; + $this->cases = $plan["cases"]; + $this->debris_met = $plan["debris_met"]; + $this->debris_cri = $plan["debris_cri"]; + $this->metal = $plan["metal"]; + $this->cristal = $plan["cristal"]; + $this->hydrogene = $plan["hydrogene"]; + $this->population = $plan["population"]; + $this->moral = $plan["moral"]; + $this->timestamp = $plan["timestamp"]; + + foreach($batimentVAR as $bat) + $this->batiments[] = $plan[$bat]; + if (!empty($plan["file_bat"])) + $this->file_bat = unserialize($plan["file_bat"]); + else + $this->file_bat = array(); + + $this->coeff_bat = array($plan["coeff_mine_m"], $plan["coeff_mine_c"], $plan["coeff_mine_h"], $plan["coeff_centrale_s"], $plan["coeff_centrale_f"]); + for($i = 0; $i < 5; $i++) + { + if ($this->coeff_bat[$i] > 1) + $this->coeff_bat[$i] = 1; + elseif ($this->coeff_bat[$i] < 0) + $this->coeff_bat[$i] = 0; + } + + if (!empty($plan["file_tech"])) + $this->file_tech = unserialize($plan["file_tech"]); + else + $this->file_tech = array(); + foreach($casernenVAR as $cas) + $this->casernes[] = $plan[$cas]; + if (!empty($plan["file_cas"])) + $this->file_cas = unserialize($plan["file_cas"]); + else + $this->file_cas = array(); + foreach($nomterrnVAR as $ter) + $this->terrestres[] = $plan[$ter]; + if (!empty($plan["file_ter"])) + $this->file_ter = unserialize($plan["file_ter"]); + else + $this->file_ter = array(); + foreach($nomvaisnVAR as $vais) + $this->vaisseaux[] = $plan[$vais]; + if (!empty($plan["file_vais"])) + $this->file_vais = unserialize($plan["file_vais"]); + else + $this->file_vais = array(); + + //Si une copie de la planète est déjà en cours d'utilisation, on ne modifie rien sur celle là + if (in_array($this->id, $securePlanete)) + $this->modif = array(); + else + { + $securePlanete[] = $this->id; + $this->actualiser($actuFile, $first); + } + + //Calcul de la population logée + $population_max = (pow($this->batiments[12],1.5)+pow($this->batiments[13],2.1))*1000+3000; + + $this->modif = array('metal', 'cristal', 'hydrogene', 'timestamp'); + } } - if (!empty($plan["file_bat"])) $this->file_bat = unserialize($plan["file_bat"]); - else $this->file_bat = array(); - - $this->coeff_bat = array($plan["coeff_mine_m"], $plan["coeff_mine_c"], $plan["coeff_mine_h"], $plan["coeff_centrale_s"], $plan["coeff_centrale_f"]); - for($i = 0; $i < 5; $i++){ - if ($this->coeff_bat[$i] > 1) $this->coeff_bat[$i] = 1; - elseif ($this->coeff_bat[$i] < 0) $this->coeff_bat[$i] = 0; - } - - if (!empty($plan["file_tech"])) $this->file_tech = unserialize($plan["file_tech"]); - else $this->file_tech = array(); - foreach($casernenVAR as $cas){ - $this->casernes[] = $plan[$cas]; - } - if (!empty($plan["file_cas"])) $this->file_cas = unserialize($plan["file_cas"]); - else $this->file_cas = array(); - foreach($nomterrnVAR as $ter){ - $this->terrestres[] = $plan[$ter]; - } - if (!empty($plan["file_ter"])) $this->file_ter = unserialize($plan["file_ter"]); - else $this->file_ter = array(); - foreach($nomvaisnVAR as $vais){ - $this->vaisseaux[] = $plan[$vais]; - } - if (!empty($plan["file_vais"])) $this->file_vais = unserialize($plan["file_vais"]); - else $this->file_vais = array(); - - $this->actualiser(true, $first); } - } - } - /** - * Actualise les ressources de la planète en fonction de la production et termine les files d'attentes. - * - * @return void - * @access public - */ - function actualiser($actuFile = true, $first = false){ - //Actualisation des files d'attentes - if ($actuFile) { - $this->file_pret("batiments"); - $this->file_pret("technologies"); - $this->file_pret("casernes"); - $this->file_pret("terrestres"); - $this->file_pret("vaisseaux"); - } + /** + * Actualise les ressources de la planète en fonction de la production et termine les files d'attentes. + * + * @return void + * @access public + */ + function actualiser($actuFile = true, $first = false) + { + //Actualisation des files d'attentes + if ($actuFile) + { + $this->file_ready("batiments"); + $this->file_readyTechno("technologies"); + $this->file_ready("casernes"); + $this->file_ready("terrestres"); + $this->file_ready("vaisseaux"); + } - //Calcul de la capacité de stockage maximale - if (!empty($timestamp_lastSilo)) { - $cap = pow(2, $this->batiments[10]-1) * 100000; - $capnouv = pow(2, $this->batiments[10]) * 100000; - } - else $cap = pow(2, $this->batiments[10]) * 100000; + //Calcul de la capacité de stockage maximale + if (!empty($timestamp_lastSilo)) + { + $this->cap = pow(2, $this->batiments[10]-1) * 100000; + $capnouv = pow(2, $this->batiments[10]) * 100000; + } + else + $this->cap = pow(2, $this->batiments[10]) * 100000; - //Calcul du temps écoulé depuis la dernière mise à jour de la planète - $temps_ecoule = time() - $this->timestamp; - $ressources = $this->production($temps_ecoule); - if ($this->metal + $ressources[0] < $cap) $this->metal += $ressources[0]; - else { - //Si les capacité de stockage ont changé depuis la dernière actualisation - if (isset($capnouv)) { - $ressources = $this->production(time() - $this->timestamp_lastSilo); - if ($this->metal + $ressources[0] < $capnouv) $this->metal += $ressources[0]; + //Calcul du temps écoulé depuis la dernière mise à jour de la planète + $temps_ecoule = time() - $this->timestamp; + $ressources = $this->production($temps_ecoule); + if ($this->metal + $ressources[0] < $this->cap) + $this->metal += $ressources[0]; + else + { + //Si les capacité de stockage ont changé depuis la dernière actualisation + if (isset($capnouv)) + { + $ressources = $this->production(time() - $this->timestamp_lastSilo); + if ($this->metal + $ressources[0] < $capnouv) + $this->metal += $ressources[0]; + } + else + { + $this->alert_ressources[0] = true; + $this->metal = $this->cap; + } + } + if ($this->cristal + $ressources[1] < $this->cap) + $this->cristal += $ressources[1]; + else + { + //Si les capacité de stockage ont changé depuis la dernière actualisation + if (isset($capnouv)) + { + $ressources = $this->production(time() - $this->timestamp_lastSilo); + if ($this->cristal + $ressources[1] < $capnouv) + $this->cristal += $ressources[1]; + } + else + { + $this->alert_ressources[1] = true; + $this->cristal = $this->cap; + } + } + if ($this->hydrogene + $ressources[2] < $this->cap) + $this->hydrogene += $ressources[2]; + else + { + //Si les capacité de stockage ont changé depuis la dernière actualisation + if (isset($capnouv)) + { + $ressources = $this->production(time() - $this->timestamp_lastSilo); + if ($this->hydrogene + $ressources[2] < $capnouv) + $this->hydrogene += $ressources[2]; + } + else + { + $this->alert_ressources[2] = true; + $this->hydrogene = $this->cap; + } + } + + //Vérification de la date pour faire les actions journalières + if (date('zya') != date('zya', $this->timestamp)) + { + //On évalue le moral + $this->evalMoral($first); + + //Si la population est à 0, on ajoute des habitants + if ($this->population <= 0) + $this->population = 1000; + + $popPlus = $this->population * 0.0153^max(1, floor((time()-$this->timestamp)/86400)); + + if ($this->politique == 2) + $popPlus *= 1.1; //Communisme : 10 % de population qui arrive en plus. + elseif ($this->politique == 3) + $popPlus *= 1.05; //Démocratie : 5 % de population qui arrive en plus. + + if ($this->technologies[2] & 4) + $popPlus *= 1.15; + elseif ($this->technologies[2] & 2) + $popPlus *= 1.10; + elseif ($this->technologies[2] & 1) + $popPlus *= 1.05; + + $this->population += $popPlus; + $this->credits += ($this->population/100*exp(0.01)*25) + ($this->population*0.01*$this->batiments[15]); //Première partie : production normale; seconde : batiment commercial + $this->modif[] = 'population'; + } + + $this->timestamp = time(); + + + //Calcul du nombre de cases restantes + $this->casesRest = $this->cases; + foreach($this->batiments as $bat) + $this->casesRest -= $bat; } - else { - $this->alert_ressources[0] = true; - $this->metal = $cap; + + function setMoral($difference) + { + $this->moral += $difference; + + //Ajustement du moral + if ($this->moral > 1) + $this->moral = 1; + elseif ($this->moral < 0) + $this->moral = 0; + + if (!in_array("moral", $this->modif)) + $this->modif[] = "moral"; } - } - if ($this->cristal + $ressources[1] < $cap) $this->cristal += $ressources[1]; - else { - //Si les capacité de stockage ont changé depuis la dernière actualisation - if (isset($capnouv)) { - $ressources = $this->production(time() - $this->timestamp_lastSilo); - if ($this->cristal + $ressources[1] < $capnouv) $this->cristal += $ressources[1]; - } - else { - $this->alert_ressources[1] = true; - $this->cristal = $cap; - } - } - if ($this->hydrogene + $ressources[2] < $cap) $this->hydrogene += $ressources[2]; - else { - //Si les capacité de stockage ont changé depuis la dernière actualisation - if (isset($capnouv)) { - $ressources = $this->production(time() - $this->timestamp_lastSilo); - if ($this->hydrogene + $ressources[2] < $capnouv) $this->hydrogene += $ressources[2]; - } - else { - $this->alert_ressources[2] = true; - $this->hydrogene = $cap; - } - } - //Vérification de la date pour faire les actions journalières - if (date('zya') != date('zya', $this->timestamp)) { - //On évalue le moral - $this->evalMoral($first); + function evalMoral($first = false) + { + $evolution = array(); + //Cas de sous-production + if (($this->coeff_bat[0] + $this->coeff_bat[1] + $this->coeff_bat[2])/3 < 0.9) + { + if ($this->politique == 2) + $this->moral -= 0.10; //Communisme : démoralise 2x plus + else + $this->moral -= 0.05; + if (!in_array('moral', $this->modif)) + $this->modif[] = 'moral'; + } - //Si la population est à 0, on ajoute des habitants - if ($this->population <= 0) $this->population = 1000; + //Surpopulation - $popPlus = $this->population * 0.0153^max(1, floor((time()-$this->timestamp)/86400)); + //Surlogement - if ($this->politique == 2) $popPlus *= 1.1; //Communisme : 10 % de population qui arrive en plus. - elseif ($this->politique == 3) $popPlus *= 1.05; //Démocratie : 5 % de population qui arrive en plus. + //Effets des batiments loisirs et commerces + $this->moral += 0.0025*$this->batiments[15] + 0.1*$this->batiments[16]; - if ($this->technologies[2] & 4) $popPlus *= 1.15; - elseif ($this->technologies[2] & 2) $popPlus *= 1.10; - elseif ($this->technologies[2] & 1) $popPlus *= 1.05; + //Ajustement du moral en fonction de la politique + if ($this->politique == 1 && $this->moral > 0.7) + $this->moral = 0.7; - $this->population += $popPlus; - $this->credits += $this->population/100*exp(0.01)*25; - $this->modif[] = 'population'; - } + //On vérifie qu'on ne dépasse pas le maximum + if ($this->moral > 1) + $this->moral = 1; + if ($this->moral < 0) + $this->moral = 0; - $this->timestamp = time(); - - - //Calcul du nombre de cases restantes - $this->casesRest = $this->cases; - foreach($this->batiments as $bat){ - $this->casesRest -= $bat; - } - } - - function setMoral($difference){ - $this->moral += $difference; - - //Ajustement du moral - if ($this->moral > 1) $this->moral = 1; - elseif ($this->moral < 0) $this->moral = 0; - - if (!in_array("moral", $this->modif)) $this->modif[] = "moral"; - } - - function evalMoral($first = false){ - //Cas de sous-production - if (($this->coeff_bat[0] + $this->coeff_bat[1] + $this->coeff_bat[2])/3 < 0.9) { - if ($this->politique == 2) $this->moral -= 0.10; //Communisme : démoralise 2x plus - else $this->moral -= 0.05; - if (!in_array('moral', $this->modif)) $this->modif[] = 'moral'; - } - - //Surpopulation - - //Surlogement - - //Ajustement du moral en fonction de la politique - if ($this->politique == 1 && $this->moral > 0.7) $this->moral = 0.7; - - //Isolement si besoin - if ($this->moral < 0.1) { - //On vérifie qu'il ne s'agit pas de la planète mère - global $bdd, $table_planete; - $bdd->connexion(); - $res = $bdd->unique_query("SELECT id FROM $table_planete WHERE id_user = ".$this->id_user." ORDER BY id LIMIT 1;"); - $bdd->deconnexion(); - if ($res['id'] != $this->id) { - if ($this->moral <= 0.01 || $this->moral <= 0.04) { - if ($this->moral <= 0.01) $rand = rand(0,4); - else $rand = rand(0,20); - //Perte de la planète - if ($rand == 1) { + //Isolement si besoin + if ($this->moral < 0.1) + { + //On vérifie qu'il ne s'agit pas de la planète mère + global $bdd, $table_planete; $bdd->connexion(); - $bdd->query("DELETE FROM $table_planete WHERE id = ".$this->id.";"); + $res = $bdd->unique_query("SELECT id FROM $table_planete WHERE id_user = ".$this->id_user." ORDER BY id LIMIT 1;"); $bdd->deconnexion(); - send_mp($this->id_user, 'Perte de contrôle de '.$this->nom_planete, "Suite à une démoralisation percistante de la population sur la planète ".$this->nom_planete." [".$this->galaxie.":".$this->ss.":".$this->position."], la population a renversé votre gouvernement en tuant tous vos gouverneurs. Vous perdez donc définitivement le contrôle de cette planète."); - if (!$first) { - $sess->values['idPlan'] = $res['id']; - erreur('La population de cette planète est tellement démoralisée qu\'elle s\'est révolté contre vous. Vous ne contrôlez plus cette planète.'); - } - } - } - elseif ($this->moral <= 0.06 || $this->moral <= 0.1) { - if ($this->moral <= 0.06) $rand = rand(0,2); - else $rand = rand(0,10); - //Perte de contrôle temporaire - if ($rand == 1) { - $debut = time() - rand(0, 3600)*4; - $fin = $debut + 86400; - $this->isolement = array($debut, $fin); - if (!in_array('isolement', $this->modif)) $this->modif[] = 'isolement'; + if ($res['id'] != $this->id) + { + if ($this->moral <= 0.04) + { + if ($this->moral <= 0.01) + $rand = rand(0,4); + else + $rand = rand(0,20); + //Perte de la planète + if ($rand == 1) + { + $bdd->connexion(); + $bdd->query("DELETE FROM $table_planete WHERE id = ".$this->id.";"); + $bdd->deconnexion(); + send_mp($this->id_user, 'Perte de contrôle de '.$this->nom_planete, "Suite à une démoralisation persistante de la population sur la planète ".$this->nom_planete." [".$this->galaxie.":".$this->ss.":".$this->position."], la population a renversé votre gouvernement en tuant tous vos gouverneurs. Vous perdez donc définitivement le contrôle de cette planète."); + if (!$first) + { + $sess->values['idPlan'] = $res['id']; + erreur('La population de cette planète est tellement démoralisée qu\'elle s\'est révolté contre vous. Vous ne contrôlez plus cette planète.'); + } + } + } + elseif ($this->moral <= 0.1) + { + if ($this->moral <= 0.06) + $rand = rand(0,2); + else + $rand = rand(0,10); + //Perte de contrôle temporaire + if ($rand == 1) + { + $debut = time() - rand(0, 3600)*4; + $fin = $debut + 86400; + $this->isolement = array($debut, $fin); + if (!in_array('isolement', $this->modif)) $this->modif[] = 'isolement'; - send_mp($this->id_user, 'Perte de contrôle temporaire de '.$this->nom_planete, "Suite à une démoralisation percistante de la population sur la planète ".$this->nom_planete." [".$this->galaxie.":".$this->ss.":".$this->position."], la population a pris le contrôle de votre planète. Vous perdez le contrôle de cette planète le temps que vos gouverneurs reprennent le pouvoir."); - if (!$first) { - $sess->values['idPlan'] = $res['id']; - erreur('La population de cette planète est tellement démoralisée qu\'elle s\'est révoltée contre vous. Vous perdez temporairement le contrôle de cette planète.'); - } + send_mp($this->id_user, 'Perte de contrôle temporaire de '.$this->nom_planete, "Suite à une démoralisation percistante de la population sur la planète ".$this->nom_planete." [".$this->galaxie.":".$this->ss.":".$this->position."], la population a pris le contrôle de votre planète. Vous perdez le contrôle de cette planète le temps que vos gouverneurs reprennent le pouvoir."); + if (!$first) + { + $sess->values['idPlan'] = $res['id']; + erreur('La population de cette planète est tellement démoralisée qu\'elle s\'est révoltée contre vous. Vous perdez temporairement le contrôle de cette planète.'); + } + } + } + } } - } } - } - } - /** - * Vérifie si la planète est isolée ou non - * - * @return boolean - * @access public - */ - function isolement(){ - $return = false; + /** + * Vérifie si la planète est isolée ou non + * + * @return boolean + * @access public + */ + function isolement() + { + $return = false; + + global $var___db, $config, $table_planete; + $bdd = new BDD(); + $bdd->connexion(); + $plan = $bdd->query("SELECT id FROM $table_planete WHERE id_user = ".$this->id_user." ORDER BY id;"); + $bdd->deconnexion(); - if (time() > $this->isolement[0]) { - if (!isset($this->isolement[1]) || (time() > $this->isolement[1] && date('dmY') != date('dmY', $this->isolement[0]))) { - $nbPlan = count($queryPlanetes); $numP = 0; - for ($i=0 ; $i<$nbPlan ; $i++) { - if ($queryPlanetes[$i]['id'] == $queryPlanete['id']) $numP = $i; - } - if ($numP > 10) { - switch($numP){ - case 11: $tps = 2; break; - case 12: $tps = 4; break; - case 13: $tps = 6; break; - case 14: $tps = 8; break; - case 15: $tps = 12; break; - case 16: $tps = 16; break; - case 17: $tps = 20; break; - default: $tps = 24; + foreach ($plan as $key => $p) + { + if ($p['id'] == $this->id) + $numP = $key + 1; } - $debut = mktime(rand(0, 24-$tps), 0, 0, date('n'), date('j'), date('Y')); - $fin = $debut + $tps * 3600; - $this->isolement[0] = $debut; - if (time() > $this->isolement[0]) $this->isolement[1] = $fin; - if (!in_array('isolement', $this->modif)) $this->modif[] = 'isolement'; - } - } - $p = gpc('p'); - if (isset($this->isolement[1]) && time() < $this->isolement[1]) { - $return = true; - } - } + if ($numP >= 11) + { + if (!isset($this->isolement[0]) || (time() > $this->isolement[0] && (!isset($this->isolement[1]) || (time() > $this->isolement[1] && date('dmY') != date('dmY', $this->isolement[0]))))) + { + switch($numP) + { + case 11: + $tps = 2; + break; + case 12: + $tps = 4; + break; + case 13: + $tps = 6; + break; + case 14: + $tps = 8; + break; + case 15: + $tps = 12; + break; + case 16: + $tps = 16; + break; + case 17: + $tps = 20; + break; + default: + $tps = 24; + } + $debut = mktime(rand(0, 24-$tps), 0, 0, date('n'), date('j'), date('Y')); + $fin = $debut + $tps * 3600; - return $return; - } - - /** - * Calcul les ressources produites en fonction de $temps_ecoule - * @param int $temps_ecoule Temps écoulé depuis la dernière actualisation - * - * @return array - * @access public - */ - function production($temps_ecoule, $retarray = false){ - //Accélération de la production - $temps_ecoule *= VITESSE; - - //Calcul de la consomation d'énergie - if ($this->batiments[0] > 0) $energie_m = ceil(exp(0.28*$this->batiments[0])*10); else $energie_m = 0; - if ($this->batiments[1] > 0) $energie_c = ceil(exp(0.28*$this->batiments[1])*10); else $energie_c = 0; - if ($this->batiments[2] > 0) $energie_h = ceil(exp(0.2849*$this->batiments[2])*13); else $energie_h = 0; - if ($this->batiments[3] > 0) $energie_s = ceil(exp(0.28*$this->batiments[3])*22); else $energie_s = 0; - if ($this->batiments[4] > 0) $energie_f = ceil(exp(0.297*$this->batiments[4])*25); else $energie_f = 0; - - //Calcul de la consomation d'énergie - $this->energieConso = $energie_m * $this->coeff_bat[0] + $energie_c * $this->coeff_bat[1] + $energie_h * $this->coeff_bat[2]; - $nrjmx = $energie_m + $energie_c + $energie_h; - - //Calcul de la production d'énergie - $this->energie = $energie_s * $this->coeff_bat[3] + $energie_f * $this->coeff_bat[4]; - - if ($this->energieConso == 0) $coeff = 0; - else $coeff = $this->energie / $this->energieConso; - - if ($coeff < 0) $coeff = 0; - elseif ($coeff > 1) $coeff = 1; - - $Ncoeff = array(); - for($i = 0; $i < 3; $i++){ - $Ncoeff[$i] = $coeff * $this->coeff_bat[$i]; - if ($Ncoeff[$i] > 1) $Ncoeff[$i] = 1; - if ($Ncoeff[$i] < $this->coeff_bat[$i] && $this->batiments[$i] != 0) { - $this->coeff_bat[$i] = $Ncoeff[$i]; - if (!in_array('coeff_bat', $this->modif)) $this->modif[] = 'coeff_bat'; - } - } - - //Calcul de la consomation d'hydrogène - if ($this->batiments[4] > 0) $conso_h = ((ceil(pow(1.34,($this->batiments[4]-1))*9)/3600)*$temps_ecoule) * $this->coeff_bat[4]; - else $conso_h = 0; - - //Calcul des production de ressources - if ($this->batiments[0] <= 0 || $this->batiments[3] <= 0) $prod_met = 0.011 * $temps_ecoule; - else $prod_met = ((ceil(pow(1.1, $this->batiments[0]) * 35 * $this->batiments[0]) / 3600) * $temps_ecoule) * $this->coeff_bat[0] * 1.5; - - if ($this->batiments[1] <= 0 || $this->batiments[3] <= 0) $prod_cri = 0.0055 * $temps_ecoule; - else $prod_cri = ((ceil(pow(1.1, $this->batiments[1]) * 23 * $this->batiments[1]) / 3600) * $temps_ecoule) * $this->coeff_bat[1] * 1.5; - - if ($this->batiments[2] <= 0) $prod_hy = 0; - else $prod_hy = ((ceil(pow(1.1, $this->batiments[2]) * 14 * ($this->batiments[2] + 0.7)) / 3600) * $temps_ecoule) * $this->coeff_bat[2] * 1.5; - - //Augmentation de la production en fonction des technologies - if ($this->technologies[0] & 4) { - $prod_met *= 1.15; - $prod_cri *= 1.15; - $prod_hy *= 1.15; - } - elseif ($this->technologies[0] & 2) { - $prod_met *= 1.10; - $prod_cri *= 1.10; - $prod_hy *= 1.10; - } - elseif ($this->technologies[0] & 1) { - $prod_met *= 1.05; - $prod_cri *= 1.05; - $prod_hy *= 1.05; - } - - //Augmentation de la production en fonction du moral - if ($this->moral > 0.9) { - $prod_met *= 1.05; - $prod_cri *= 1.05; - $prod_hy *= 1.05; - } - elseif ($this->moral > 0.75) { - $prod_met *= 1.02; - $prod_cri *= 1.02; - $prod_hy *= 1.02; - } - elseif ($this->moral < 0.45) { - $prod_met *= 0.97; - $prod_cri *= 0.97; - $prod_hy *= 0.97; - } - elseif ($this->moral < 0.25) { - $prod_met *= 0.94; - $prod_cri *= 0.94; - $prod_hy *= 0.94; - } - - //Augmentation de la production en fonction de la politique - if ($this->politique == 2) { - $prod_met *= 1.10; - $prod_cri *= 1.10; - $prod_hy *= 1.10; - } - - //On enlève la consomation d'hydrogène - $prod_hy -= $conso_h; - - if ($retarray) return array(array(ceil($this->coeff_bat[0]*100), ceil($this->coeff_bat[1]*100), ceil($this->coeff_bat[2]*100), ceil($this->coeff_bat[3]*100), ceil($this->coeff_bat[4]*100)), array($prod_met, $prod_cri, $prod_hy + $conso_h, $energie_s*$this->coeff_bat[3], $energie_f*$this->coeff_bat[4]), array($energie_m*$this->coeff_bat[0], $energie_c*$this->coeff_bat[1], $energie_h*$this->coeff_bat[2], $conso_h, ($energie_s*$this->coeff_bat[3] + $energie_f*$this->coeff_bat[4])-($energie_m*$this->coeff_bat[0] + $energie_c*$this->coeff_bat[1] + $energie_h*$this->coeff_bat[2]))); - else return array($prod_met, $prod_cri, $prod_hy); - } - - /** - * Destructeur - * - * @return void - * @access public - */ - function __destruct(){ - global $var___db, $config, $table_planete; - $nb = count($this->modif); - $out = array(); - $bdd = new bdd(); - $bdd->connexion(); - for($i = 0; $i < $nb; $i++){ - if ($this->modif[$i] == 'technologies') $this->modifUser[] = $this->modif[$i]; - elseif (!is_array($this->{$this->modif[$i]})) { - $bdd->escape($this->{$this->modif[$i]}); - if (is_int($this->{$this->modif[$i]}) || is_float($this->{$this->modif[$i]})) $out[] .= $this->modif[$i]." = ".$this->{$this->modif[$i]}; - else $out[] .= $this->modif[$i]." = '".$this->{$this->modif[$i]}."'"; - } - else { - if (is_array($this->{$this->modif[$i]}) && $this->modif[$i] != "coeff_bat" && $this->modif[$i] != "vaisseaux" && $this->modif[$i] != "terrestres" && $this->modif[$i] != "casernes" && $this->modif[$i] != "technologies" && $this->modif[$i] != "batiments") { - $prep = serialize($this->{$this->modif[$i]}); - $bdd->escape($prep); - $out[] .= $this->modif[$i]." = '$prep'"; - } - else { - if ($this->modif[$i] == "batiments") $calc = "batiment"; - elseif ($this->modif[$i] == "technologies") $calc = "technolo"; - elseif ($this->modif[$i] == "casernes")$calc = "casernen"; - elseif ($this->modif[$i] == "terrestres") $calc = "nomterrn"; - elseif ($this->modif[$i] == "vaisseaux") $calc = "nomvaisn"; - elseif ($this->modif[$i] == "coeff_bat") $calc = "coeff"; - - if (!isset(${$calc.'VAR'})) global ${$calc.'VAR'}; - - $nombr = count(${$calc.'VAR'}); - for($j = 0; $j < $nombr; $j++){ - $bdd->escape($this->{$this->modif[$i]}[$j]); - $out[] .= ${$calc.'VAR'}[$j]." = ".$this->{$this->modif[$i]}[$j].""; + $this->isolement[0] = $debut; + if (time() > $this->isolement[0]) + $this->isolement[1] = $fin; + if (!in_array('isolement', $this->modif)) + $this->modif[] = 'isolement'; + } + if (isset($this->isolement[1]) && time() < $this->isolement[1]) + $return = true; + } + elseif (!isset($this->isolement[0])) + { + $this->isolement = array(0,0); + if (!in_array('isolement', $this->modif)) + $this->modif[] = 'isolement'; + } + + return $return; + } + + /** + * Calcul les ressources produites en fonction de $temps_ecoule + * @param int $temps_ecoule Temps écoulé depuis la dernière actualisation + * + * @return array + * @access public + */ + function production($temps_ecoule, $retarray = false) + { + //Accélération de la production + $temps_ecoule *= VITESSE; + + //Calcul de la consomation d'énergie + if ($this->batiments[0] > 0) + $energie_m = ceil(exp(0.28*$this->batiments[0])*10); + else + $energie_m = 0; + if ($this->batiments[1] > 0) + $energie_c = ceil(exp(0.28*$this->batiments[1])*10); + else + $energie_c = 0; + if ($this->batiments[2] > 0) + $energie_h = ceil(exp(0.2849*$this->batiments[2])*13); + else + $energie_h = 0; + if ($this->batiments[3] > 0) + $energie_s = ceil(exp(0.28*$this->batiments[3])*22); + else + $energie_s = 0; + if ($this->batiments[4] > 0) + $energie_f = ceil(exp(0.297*$this->batiments[4])*25); + else + $energie_f = 0; + + //Calcul de la consomation d'énergie + $this->energieConso = $energie_m * $this->coeff_bat[0] + $energie_c * $this->coeff_bat[1] + $energie_h * $this->coeff_bat[2]; + $nrjmx = $energie_m + $energie_c + $energie_h; + + //Calcul de la production d'énergie + $this->energie = $energie_s * $this->coeff_bat[3] + $energie_f * $this->coeff_bat[4]; + + if ($this->energieConso == 0) + $coeff = 0; + else + $coeff = $this->energie / $this->energieConso; + + if ($coeff < 0) + $coeff = 0; + elseif ($coeff > 1) + $coeff = 1; + + $Ncoeff = array(); + for($i = 0; $i < 3; $i++) + { + $Ncoeff[$i] = $coeff * $this->coeff_bat[$i]; + if ($Ncoeff[$i] > 1) + $Ncoeff[$i] = 1; + if ($Ncoeff[$i] < $this->coeff_bat[$i] && $this->batiments[$i] != 0) + { + $this->coeff_bat[$i] = $Ncoeff[$i]; + if (!in_array('coeff_bat', $this->modif)) + $this->modif[] = 'coeff_bat'; + } + } + + //Calcul de la consomation d'hydrogène + if ($this->batiments[4] > 0) + $conso_h = ((ceil(pow(1.34,($this->batiments[4]-1))*9)/3600)*$temps_ecoule) * $this->coeff_bat[4]; + else + $conso_h = 0; + + //Calcul des production de ressources + if ($this->batiments[0] <= 0 || $this->batiments[3] <= 0) + $prod_met = 0.011 * $temps_ecoule; + else + $prod_met = ((ceil(pow(1.1, $this->batiments[0]) * 35 * $this->batiments[0]) / 3600) * $temps_ecoule) * $this->coeff_bat[0] * 1.5; + + if ($this->batiments[1] <= 0 || $this->batiments[3] <= 0) + $prod_cri = 0.0055 * $temps_ecoule; + else + $prod_cri = ((ceil(pow(1.1, $this->batiments[1]) * 23 * $this->batiments[1]) / 3600) * $temps_ecoule) * $this->coeff_bat[1] * 1.5; + + if ($this->batiments[2] <= 0) + $prod_hy = 0; + else + $prod_hy = ((ceil(pow(1.1, $this->batiments[2]) * 14 * ($this->batiments[2] + 0.7)) / 3600) * $temps_ecoule) * $this->coeff_bat[2] * 1.5; + + //Augmentation de la production en fonction des technologies + if ($this->technologies[0] &4) + { + $prod_met *= 1.15; + $prod_cri *= 1.15; + $prod_hy *= 1.15; + } + elseif ($this->technologies[0] &2) + { + $prod_met *= 1.10; + $prod_cri *= 1.10; + $prod_hy *= 1.10; + } + elseif ($this->technologies[0] &1) + { + $prod_met *= 1.05; + $prod_cri *= 1.05; + $prod_hy *= 1.05; + } + //Rendement métal + if ($this->technologies[0] &64) + $prod_met *= 1.3; + elseif ($this->technologies[0] &32) + $prod_met *= 1.2; + elseif ($this->technologies[0] &16) + $prod_met *= 1.1; + //Rendemant cristal + if ($this->technologies[0] &512) + $prod_cri *= 1.3; + elseif ($this->technologies[0] &256) + $prod_cri *= 1.2; + elseif ($this->technologies[0] &128) + $prod_cri *= 1.1; + //Rendement hydrogène + if ($this->technologies[0] &4096) + $prod_hy *= 1.3; + elseif ($this->technologies[0] &2048) + $prod_hy *= 1.2; + elseif ($this->technologies[0] &1024) + $prod_hy *= 1.1; + + //Augmentation de la production en fonction du moral + if ($this->moral > 0.9) + { + $prod_met *= 1.05; + $prod_cri *= 1.05; + $prod_hy *= 1.05; + } + elseif ($this->moral > 0.75) + { + $prod_met *= 1.02; + $prod_cri *= 1.02; + $prod_hy *= 1.02; + } + elseif ($this->moral < 0.45) + { + $prod_met *= 0.97; + $prod_cri *= 0.97; + $prod_hy *= 0.97; + } + elseif ($this->moral < 0.25) + { + $prod_met *= 0.94; + $prod_cri *= 0.94; + $prod_hy *= 0.94; + } + + //Augmentation de la production en fonction de la politique + if ($this->politique == 2) + { + $prod_met *= 1.10; + $prod_cri *= 1.10; + $prod_hy *= 1.10; + } + + //On enlève la consomation d'hydrogène + $prod_hy -= $conso_h; + + if ($retarray) + return array(array(ceil($this->coeff_bat[0]*100), ceil($this->coeff_bat[1]*100), ceil($this->coeff_bat[2]*100), ceil($this->coeff_bat[3]*100), ceil($this->coeff_bat[4]*100)), array($prod_met, $prod_cri, $prod_hy + $conso_h, $energie_s*$this->coeff_bat[3], $energie_f*$this->coeff_bat[4]), array($energie_m*$this->coeff_bat[0], $energie_c*$this->coeff_bat[1], $energie_h*$this->coeff_bat[2], $conso_h, ($energie_s*$this->coeff_bat[3] + $energie_f*$this->coeff_bat[4])-($energie_m*$this->coeff_bat[0] + $energie_c*$this->coeff_bat[1] + $energie_h*$this->coeff_bat[2]))); + else + return array($prod_met, $prod_cri, $prod_hy); + } + + function creer($id_user) + { + //Définition des paramètres de l'utilisateur pour la planète + $this->id_user = $id_user; + + //Génération du nombre de case et de l'image en fonction de la position dans le système + if ($this->position > MAX_PLANETE*0.75) + { + $this->cases = mt_rand(200,255); + $this->image = mt_rand(1,19); + } + elseif ($this->position > MAX_PLANETE/2) + { + $this->cases = mt_rand(250,300); + $this->image = mt_rand(1,19); + } + elseif ($this->position > MAX_PLANETE/4) + { + $this->cases = mt_rand(175,260); + $this->image = mt_rand(1,19); + } + else + { + $this->cases = mt_rand(150,220); + $this->image = mt_rand(1,19); + } + + //Définition des principaux paramètres de la planète + $this->nom_planete = 'Planète colonisée'; + $this->timestamp = time(); + $this->metal = 1000; + $this->cristal = 700; + $this->hydrogene = 0; + + $this->modif = array("id_user", "nom_planete", "galaxie", "ss", "position", "image", "cases", "timestamp", "metal", "cristal", "hydrogene"); + } + + /** + * Destructeur + * + * @return void + * @access public + */ + function __destruct() + { + if (empty($this->ss) || empty($this->id_user)) + return; + if ($this->id_user == 1) + var_dump($this); + + global $var___db, $config, $table_planete; + if (empty($this->id)) + { + $out1 = array(); $out2 = array(); + $bdd = new bdd(); + $bdd->connexion(); + foreach($this->modif as $modif) + { + if (!is_array($this->{$modif})) + { + $bdd->escape($this->{$modif}); + $out1[] = $modif; + if (is_int($this->{$modif}) || is_float($this->{$modif})) + $out2[] = $this->{$modif}; + else + $out2[] = "'".$this->{$modif}."'"; + } + else + { + if (is_array($this->{$modif}) && $modif != "coeff_bat" && $modif != "vaisseaux" && $modif != "terrestres" && $modif != "casernes" && $modif != "technologies" && $modif != "batiments") + { + $prep = serialize($this->{$modif}); + $bdd->escape($prep); + $out1[] = $modif; + $out2[] = "'$prep'"; + } + else + { + if ($modif == "batiments") + $calc = "batiment"; + elseif ($modif == "technologies") + $calc = "technolo"; + elseif ($modif == "casernes") + $calc = "casernen"; + elseif ($modif == "terrestres") + $calc = "nomterrn"; + elseif ($modif == "vaisseaux") + $calc = "nomvaisn"; + elseif ($modif == "coeff_bat") + $calc = "coeff"; + + if (!isset(${$calc.'VAR'})) + global ${$calc.'VAR'}; + + foreach($this->{$modif} as $j => $value) + { + $out1[] = ${$calc.'VAR'}[$j]; + $out2[] = $value; + } + } + } + } + $bdd->query("INSERT INTO $table_planete (".implode(', ', $out1).", hash_planete) VALUES (".implode(', ', $out2).", SHA1(CONCAT('g',planete.galaxie,'s',planete.ss,'p',planete.position)))"); + $bdd->deconnexion(); + } + else + { + $nb = count($this->modif); + $out = array(); + $bdd = new bdd(); + $bdd->connexion(); + for($i = 0; $i < $nb; $i++) + { + if ($this->modif[$i] == 'technologies') + $this->modifUser[] = $this->modif[$i]; + elseif (!is_array($this->{$this->modif[$i]})) + { + $bdd->escape($this->{$this->modif[$i]}); + if (is_int($this->{$this->modif[$i]}) || is_float($this->{$this->modif[$i]})) + $out[] = $this->modif[$i]." = ".$this->{$this->modif[$i]}; + else + $out[] = $this->modif[$i]." = '".$this->{$this->modif[$i]}."'"; + } + else + { + if (is_array($this->{$this->modif[$i]}) && $this->modif[$i] != "coeff_bat" && $this->modif[$i] != "vaisseaux" && $this->modif[$i] != "terrestres" && $this->modif[$i] != "casernes" && $this->modif[$i] != "technologies" && $this->modif[$i] != "batiments") + { + $prep = serialize($this->{$this->modif[$i]}); + $bdd->escape($prep); + $out[] = $this->modif[$i]." = '$prep'"; + } + else + { + if ($this->modif[$i] == "batiments") + $calc = "batiment"; + elseif ($this->modif[$i] == "technologies") + $calc = "technolo"; + elseif ($this->modif[$i] == "casernes") + $calc = "casernen"; + elseif ($this->modif[$i] == "terrestres") + $calc = "nomterrn"; + elseif ($this->modif[$i] == "vaisseaux") + $calc = "nomvaisn"; + elseif ($this->modif[$i] == "coeff_bat") + $calc = "coeff"; + + if (!isset(${$calc.'VAR'})) + global ${$calc.'VAR'}; + + $nombr = count(${$calc.'VAR'}); + for($j = 0; $j < $nombr; $j++) + { + $bdd->escape($this->{$this->modif[$i]}[$j]); + $out[] = ${$calc.'VAR'}[$j]." = ".$this->{$this->modif[$i]}[$j].""; + } + } + } + } + if (!empty($out)) + $plan = $bdd->query("UPDATE $table_planete SET ".implode(', ', $out)." WHERE id = ".$this->id.";"); + + $bdd->deconnexion(); + parent::__destruct(); } - } } - } - if (!empty($out)) $plan = $bdd->query("UPDATE $table_planete SET ".implode(', ', $out)." WHERE id = ".$this->id.";"); - $bdd->deconnexion(); - parent::__destruct(); } -} ?> \ No newline at end of file diff --git a/game/Class/class.rapport.php b/game/Class/class.rapport.php index 6c8d65e..e408676 100644 --- a/game/Class/class.rapport.php +++ b/game/Class/class.rapport.php @@ -34,9 +34,9 @@ class Rapport{ } function send(){ - if ($this->type == '1') $this->sendCombat(); - elseif ($this->type == '2') $this->sendTransport(); - elseif ($this->type == '3') $this->sendColonisation(); + if ($this->type == '3') $this->sendCombat(); + elseif ($this->type == '1') $this->sendTransport(); + elseif ($this->type == '2') $this->sendColonisation(); elseif ($this->type == '4') $this->sendRecyclage(); elseif ($this->type == '5') $this->sendEspionnage(); elseif ($this->type == '6') $this->sendAlliance(); @@ -112,15 +112,15 @@ class Rapport{ function sendTransport(){ global $config; include_once(_FCORE."../game/function.php"); - $titre = 'Transport vers '.$this->var[0]['nom_planete'].' ['.$this->var[0]['galaxie'].':'.$this->var[0]['ss'].':'.$this->var[0]['position'].']'; + $titre = 'Transport vers '.$this->var[0][0].' ['.$this->var[0][1].':'.$this->var[0][2].':'.$this->var[0][3].']'; - $race = trouvInfo($this->utilA, 'race'); + $race = trouvInfo($this->utilA, 'race'); //TODO A optimiser include(_FCORE."../game/noms.php"); - $rapportA = 'Vos vaisseaux ont déposé '.$this->var[1][0].' de '.$ressourc[0].', '.$this->var[1][1].' de '.$ressourc[1].' et '.$this->var[1][2].' d\''.$ressourc[2].' sur '.$this->var[0]['nom_planete'].'['.$this->var[0]['galaxie'].':'.$this->var[0]['ss'].':'.$this->var[0]['position'].']

          '; + $rapportA = 'Vos vaisseaux ont déposé '.$this->var[1][0].' de '.$ressourc[0].', '.$this->var[1][1].' de '.$ressourc[1].' et '.$this->var[1][2].' d\''.$ressourc[2].' sur '.$this->var[0][0].'['.$this->var[0][1].':'.$this->var[0][2].':'.$this->var[0][3].']

          '; - $race = trouvInfo($this->utilB, 'race'); + $race = trouvInfo($this->utilB, 'race'); //TODO A optimiser include(_FCORE."../game/noms.php"); - $rapportB = 'Les vaisseaux de '.trouvNom($this->utilA).' ont déposé '.$this->var[1][0].' de '.$ressourc[0].', '.$this->var[1][1].' de '.$ressourc[1].' et '.$this->var[1][2].' d\''.$ressourc[2].' sur '.$this->var[0]['nom_planete'].'['.$this->var[0]['galaxie'].':'.$this->var[0]['ss'].':'.$this->var[0]['position'].']

          '; + $rapportB = 'Les vaisseaux de '.trouvNom($this->utilA).' ont déposé '.$this->var[1][0].' de '.$ressourc[0].', '.$this->var[1][1].' de '.$ressourc[1].' et '.$this->var[1][2].' d\''.$ressourc[2].' sur '.$this->var[0][0].'['.$this->var[0][1].':'.$this->var[0][2].':'.$this->var[0][3].']

          '; $temps = $this->timestamp; $db = new bdd(); @@ -129,8 +129,8 @@ class Rapport{ $db->escape($rapportA); $db->escape($rapportB); - $db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilA.", '$titre', '$rapportA', '$temps')"); - if ($this->utilA != $this->utilB) $db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilB.", '$titre', '$rapportB', '$temps')"); + $db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilA.", '$titre', '$rapportA', '$temps');"); + if ($this->utilA != $this->utilB) $db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilB.", '$titre', '$rapportB', '$temps');"); $db->deconnexion(); } @@ -150,9 +150,10 @@ class Rapport{ } function sendRecyclage(){ - include_once(_FCORE."../game/function.php"); - $titre = 'Recyclage de '.$this->var[0]['nom_planete'].' ['.$this->var[0]['galaxie'].':'.$this->var[0]['ss'].':'.$this->var[0]['position'].']'; - $rapport = 'Vos vaisseaux récoltent '.$this->var[1][0].' de '.$ressourc[0].' et '.$this->var[1][1].' de '.$ressourc[1].' sur '.$this->var[0]['nom_planete'].'['.$this->var[0]['galaxie'].':'.$this->var[0]['ss'].':'.$this->var[0]['position'].']

          '; + global $ressourc; + + $titre = 'Recyclage de '.$this->var[0]->nom_planete.' ['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':'.$this->var[0]->position.']'; + $rapport = 'Vos vaisseaux récoltent '.$this->var[1][0].' de '.$ressourc[0].' et '.$this->var[1][1].' de '.$ressourc[1].' sur '.$this->var[0]->nom_planete.'['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':'.$this->var[0]->position.']

          '; $temps = $this->timestamp; diff --git a/game/Class/class.surface.php b/game/Class/class.surface.php new file mode 100644 index 0000000..2b65478 --- /dev/null +++ b/game/Class/class.surface.php @@ -0,0 +1,30 @@ + \ No newline at end of file diff --git a/game/Class/class.tinyplanete.php b/game/Class/class.tinyplanete.php new file mode 100644 index 0000000..9d034f9 --- /dev/null +++ b/game/Class/class.tinyplanete.php @@ -0,0 +1,47 @@ +connexion(); + $plan = $bdd->unique_query("SELECT * FROM $table_planete WHERE id = $id;"); + $bdd->deconnexion(); + } + elseif (preg_match('#^\[?([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\]?$#', $id, $position)) { + $bdd->connexion(); + $plan = $bdd->unique_query("SELECT * FROM $table_planete WHERE galaxie = ".$position[1]." AND ss = ".$position[2]." AND position = ".$position[3].";"); + $bdd->deconnexion(); + } + else die('Erreur #04 : Format de recherche de planete incorrect !'); + + if (!empty($plan)) { + $this->id = $plan["id"]; + $this->galaxie = $plan["galaxie"]; + $this->ss = $plan["ss"]; + $this->position = $plan["position"]; + $this->nom_planete = $plan["nom_planete"]; + } + } + } +} +?> \ No newline at end of file diff --git a/game/Class/class.user.php b/game/Class/class.user.php index 108324a..a8a9f59 100644 --- a/game/Class/class.user.php +++ b/game/Class/class.user.php @@ -86,40 +86,51 @@ class User extends File{ */ function __destruct(){ global $var___db, $config, $table_user; - $nb = count($this->modifUser); $out = array(); $bdd = new bdd(); $bdd->connexion(); - for($i = 0; $i < $nb; $i++){ - if (!is_array($this->{$this->modifUser[$i]})) { - $bdd->escape($this->{$this->modifUser[$i]}); - if (is_int($this->{$this->modifUser[$i]}) || is_float($this->{$this->modifUser[$i]})) $out[] .= $this->modifUser[$i]." = ".$this->{$this->modifUser[$i]}; - else $out[] .= $this->modifUser[$i]." = '".$this->{$this->modifUser[$i]}."'"; - } - else { - if (ereg('file', $this->modifUser[$i])) { - $prep = implode(';', $this->{$this->modifUser[$i]}); - $bdd->escape($prep); - $out[] .= $this->modifUser[$i]." = '$prep'"; - } - else { - if ($this->modifUser[$i] == "batiments") $calc = "batiment"; - elseif ($this->modifUser[$i] == "technologies") $calc = "technologies"; - elseif ($this->modifUser[$i] == "casernes")$calc = "casernen"; - elseif ($this->modifUser[$i] == "terrestres") $calc = "nomterrn"; - elseif ($this->modifUser[$i] == "vaisseaux") $calc = "nomvaisn"; - - if (!isset(${$calc.'VAR'})) global ${$calc.'VAR'}; - - $nombr = count(${$calc.'VAR'}); - for($j = 0; $j < $nombr; $j++){ - $bdd->escape($this->{$this->modifUser[$i]}[$j]); - $out[] .= ${$calc.'VAR'}[$j]." = ".$this->{$this->modifUser[$i]}[$j]; + foreach($this->modifUser as $key => $modif) + { + if (!is_array($this->{$modif})) + { + $bdd->escape($this->{$modif}); + if (is_int($this->{$modif}) || is_float($this->{$modif})) $out[] .= $modif." = ".$this->{$modif}; + else $out[] .= $modif." = '".$this->{$modif}."'"; + } + else + { + if (ereg('file', $modif)) + { + $prep = implode(';', $this->{$modif}); + $bdd->escape($prep); + $out[] .= $modif." = '$prep'"; + } + else + { + if ($modif == "batiments") + $calc = "batiment"; + elseif ($modif == "technologies") + $calc = "technologies"; + elseif ($modif == "casernes") + $calc = "casernen"; + elseif ($modif == "terrestres") + $calc = "nomterrn"; + elseif ($modif == "vaisseaux") + $calc = "nomvaisn"; + + if (!isset(${$calc.'VAR'})) + global ${$calc.'VAR'}; + + $nombr = count(${$calc.'VAR'}); + for($j = 0; $j < $nombr; $j++){ + $bdd->escape($this->{$modif}[$j]); + $out[] .= ${$calc.'VAR'}[$j]." = ".$this->{$modif}[$j]; + } + } } - } } - } - if (!empty($out)) $plan = $bdd->query("UPDATE $table_user SET ".implode(', ', $out)." WHERE id = ".$this->id_user.";"); + if (!empty($out)) + $plan = $bdd->query("UPDATE $table_user SET ".implode(', ', $out)." WHERE id = ".$this->id_user.";"); $bdd->deconnexion(); } } diff --git a/game/cache/inline.cache b/game/cache/inline.cache index c227083..56a6051 100644 --- a/game/cache/inline.cache +++ b/game/cache/inline.cache @@ -1 +1 @@ -0 \ No newline at end of file +1 \ No newline at end of file diff --git a/game/cache/signatures/8..sign b/game/cache/signatures/8..sign index a7da947..fc37f11 100644 Binary files a/game/cache/signatures/8..sign and b/game/cache/signatures/8..sign differ diff --git a/game/cron/inactifs.php b/game/cron/inactifs.php index da41d28..532d466 100644 --- a/game/cron/inactifs.php +++ b/game/cron/inactifs.php @@ -2,12 +2,13 @@ if(!defined('CRON')) { header('Location: ../'); exit; } print '

          Début de la gestion des joueurs inactifs ; il est : '.date('d/m/Y H:i:s'); -$limite1 = time() - 7 * 86400; -$limite2 = time() - 8 * 86400; -$limiteS = time() - 14 * 86400; +$limite1 = time() - 10 * 86400; +$limite2 = $limite1 + 86400; +$limiteS = time() - 20 * 86400; $bdd->connexion(); $utils = $bdd->query("SELECT id, pseudo, mail FROM $table_user WHERE last_visite < $limite1 AND last_visite > $limite2 AND mv = 0;"); $utils['nombre'] = $bdd->num_rows; +var_dump($utils); for($i = 0; $i < $utils['nombre']; $i++){ send_mail($utils[$i]['mail'], "Compte de jeu inactif", 'Halo-Battle :: Compte de jeu inactif

          Bonjour '.$utils[$i]['pseudo'].',
          Cela fait plus d\'une semaine que vous ne vous êtes pas connecté au jeu Halo-Battle.
          Pour que vos planètes et vos vaisseaux soient concervés, pensez à mettre votre compte en mode vacances avant qu\'il ne soit définitivement supprimé de nos serveurs.

          A bientôt dans Halo-Battle,
          Le staff

          '); print '
          Envoie d\'un mail au joueur inactif '.$utils[$i]['pseudo']; @@ -15,18 +16,20 @@ for($i = 0; $i < $utils['nombre']; $i++){ $utils = $bdd->query("SELECT id, pseudo, mail FROM $table_user WHERE last_visite < $limiteS AND mv = 0;"); $utils['nombre'] = $bdd->num_rows; +var_dump($utils); for($i = 0; $i < $utils['nombre']; $i++){ - send_mail($utils[$i]['mail'], "Compte de jeu supprimé", 'Halo-Battle :: Suppression de votre compte

          Bonjour '.$utils[$i]['pseudo'].',
          Cela fait plus de deux semaines que vous ne vous êtes pas connecté au jeu Halo-Battle.
          Votre compte ainsi que toutes les données personnelles vous concernant viennent d\'être supprimées de notre serveur de jeu, ainsi, vous ne recevrez plus de courriels de notre part.

          A bientôt dans Halo-Battle,
          Le staff

          '); -/* $bdd->query("DELETE FROM $table_flottes WHERE id_user = ".$utils[$i]['id']); + send_mail($utils[$i]['mail'], "Compte de jeu supprime", 'Halo-Battle :: Suppression de votre compte

          Bonjour '.$utils[$i]['pseudo'].',
          Cela fait plus de deux semaines que vous ne vous êtes pas connecté au jeu Halo-Battle.
          Votre compte ainsi que toutes les données personnelles vous concernant viennent d\'être supprimées de notre serveur de jeu, ainsi, vous ne recevrez plus de courriels de notre part.

          A bientôt dans Halo-Battle,
          Le staff

          '); + //send_mail($utils[$i]['mail'], "Re: Compte de jeu supprimé", 'Halo-Battle :: Suppression de votre compte

          Bonjour '.$utils[$i]['pseudo'].',
          Vous avez reçu il y a quelques minutes un courriel indiquant la suppression de votre compte de jeu. Cet e-mail n\'était en fait qu\'un simple test effectué par nos serveur afin de tester le script de gestion des joueurs inactifs (dont vous faites parti).

          D\'ici la semaine prochaine, il sera mis en application et votre compte risquera d\'être supprimé. Vous pouvez donc toujours profiter de votre compte avant qu\'il ne soit supprimé réellement ;)

          A bientôt dans Halo-Battle,
          Le staff

          '); + $bdd->query("DELETE FROM $table_flottes WHERE id_user = ".$utils[$i]['id']); //TODO vérifier la suppression desactions du joueur - $action = new Bourse(); - $action->delUser($utils[$i]['id']); +// $action = new Bourse(); +// $action->delUser($utils[$i]['id']); //TODO Ajouter CASCADE !! pour supprimer les combats avec les flottes $bdd->query("DELETE FROM $table_planete WHERE id_user = ".$utils[$i]['id']); $bdd->query("DELETE FROM $table_user WHERE id = ".$utils[$i]['id']); $bdd->query("DELETE FROM $table_mail WHERE destinataire = ".$utils[$i]['pseudo']); $bdd->query("DELETE FROM $table_mail WHERE expediteur = ".$utils[$i]['pseudo']); -*/ print '
          Envoie d\'un mail et suppression du joueur inactif '.$utils[$i]['pseudo']; + print '
          Envoie d\'un mail et suppression du joueur inactif '.$utils[$i]['pseudo']; } $bdd->deconnexion(); diff --git a/game/cron/sauvebdd.php b/game/cron/sauvebdd.php index 88f5c36..333bfed 100644 --- a/game/cron/sauvebdd.php +++ b/game/cron/sauvebdd.php @@ -44,11 +44,15 @@ else { $res = $bdd->query('SELECT * FROM '.$nomtable.';'); $bdd->deconnexion(); - fwrite($fp, "\"\n"); + fwrite($fp, "
          \n"); for($i = 0; $i < $bdd->num_rows; $i++){ - fwrite($fp, "\t\n"); + if (isset($res[$i]['id'])) $extend = ' id="'.$res[$i]['id'].'"'; + else $extend = ''; + + fwrite($fp, "\t\n"); foreach ($res[$i] as $field_name => $field_value){ - fwrite($fp, "\t\t<$field_name>".htmlentities($field_value)."\n"); + if ($nomtable == 'user' && $field_name == "mdp_var") continue; + fwrite($fp, "\t\t<$field_name>".str_replace('<', '$#lt;', utf8_encode(html_entity_decode($field_value)))."\n"); } fwrite($fp, "\t\n"); } @@ -71,7 +75,7 @@ else { if ($fp) { $fwrite($fp, "-- Utilitaire de sauvegarde de base de données de HB\n-- Sauvegarde du ".date('d/m/Y H:i:s')."\n-- Version du jeu : ".$config['version']."\n\n"); - fwrite($fpx, ''."\n\n"); + fwrite($fpx, ''."\n\n\n"); //Liste des tables à sauvegarder $list = array('alliances', 'alliances_attente', 'alliances_chat', 'alliances_creation', 'alliances_grade', 'flottes', 'flottes_combats', 'planete', 'user'); @@ -80,6 +84,7 @@ else { dumpTable($fp, $table); dumpTableXML($fpx, $table); } + fwrite($fpx, ''); } if (!function_exists('gzopen')) fclose($fp); diff --git a/game/flottes.php b/game/flottes.php index 1638d46..7195da0 100644 --- a/game/flottes.php +++ b/game/flottes.php @@ -1,374 +1,17 @@ connexion(); -$queryFlottes = $bdd->query("SELECT * FROM $table_flottes WHERE id_user = '$id_user' OR (end_galaxie = '$Hgalaxie' AND end_ss = '$Hss' AND end_position = '$Hposition');"); +$flottes = $bdd->query("SELECT id FROM $table_flottes WHERE (id_user = ".$planete->id_user." OR end_planete = ".$planete->id.") AND last < ".(time()-10).";"); $bdd->deconnexion(); -$nbFlottes = $bdd->num_rows; -for ($i = 0; $i < $nbFlottes; $i++) { - //Récupération des principales variables de la flotte - $id_flotte = $queryFlottes[$i]['id']; - $mission = $queryFlottes[$i]['mission']; - $end_galaxie = $queryFlottes[$i]['end_galaxie']; - $end_ss = $queryFlottes[$i]['end_ss']; - $end_position = $queryFlottes[$i]['end_position']; - $end_time = $queryFlottes[$i]['start_time'] + $queryFlottes[$i]['end_time']; - //On vérifie que la planète cible existe - $bdd->connexion(); - $queryEN = $bdd->unique_query("SELECT * FROM $table_planete WHERE galaxie = '$end_galaxie' AND ss = '$end_ss' AND position = '$end_position';"); - if (!$queryEN && $mission != 3 && $mission != 6 && time() > $end_time) { - $bdd->query("UPDATE $table_flottes SET effectue = '1', mission = '6', ret_time = '".($end_time + $queryFlottes[$i]['end_time'])."' WHERE id = $id_flotte;"); - $titreA = 'Impossible d\'effectuer la mission'; - $bdd->escape($titreA); - $rapportA = 'La flotte '.$queryFlottes[$i]['nom_flotte'].' n\'a pas pu effectuer sa mission correctement car lorsqu\'elle est arrivée sur place, la planète était déserte.'; - $bdd->escape($rapportA); - $db->query("INSERT INTO $table_mail (destinataire, expediteur, sujet, contenu, temps) VALUES(".$queryFlottes[$i]['id_user'].", '', '$titreA', '$rapportA', '".$end_time."')"); - $bdd->deconnexion(); - continue; - } - elseif (!$queryEN && $mission != 3 && $queryFlottes[$i]['effectue'] != 1) { - $bdd->deconnexion(); - continue; - } - $bdd->deconnexion(); - $ENidPlan = $queryEN['id']; - - //La flotte est prête a effectuer une action - if ($queryFlottes[$i]['effectue'] != 1 && time() >= $queryFlottes[$i]['start_time'] + $queryFlottes[$i]['end_time'] && !empty($queryFlottes[$i]['end_time'])) { - //Mission Attaquer - if ($mission == 1) { - require_once(_FCORE."../game/Class/class.combat.php"); - $bdd->connexion(); - //On regarde si le combat a déjà commencé - if ($queryFlottes[$i]['effectue'] == 2) { - if ($queryCombat = $bdd->unique_query("SELECT * FROM $table_flottes_combats WHERE refflotte = '$id_flotte';")) { - //On vérifie si on lance le tour suivant ou non - if (time() >= $queryCombat['timestamp']) { - //On modifie le timestamp pour ne pas que le combat se déroule deux fois - $timebloque = time() + 5; - $bdd->query("UPDATE $table_flottes_combats SET timestamp = '$timebloque' WHERE refflotte = '$id_flotte';"); - - //Récupération du combat - $combat = unserialize($queryCombat['serialize']); - //Mise à jour des tactiques - if (!empty($queryFlottes[$i]['tactiqueAT'])) $combat->changerTactiqueAT($queryFlottes[$i]['tactiqueAT']); - if (!empty($queryFlottes[$i]['tactiqueEN'])) $combat->changerTactiqueEN($queryFlottes[$i]['tactiqueEN']); - } - else continue; - } - else { - $time = time(); - $bdd->query("UPDATE $table_flottes SET effectue = '1', ret_time = end_time + $time WHERE id = '$id_flotte';"); - file_log("Erreur dans le script de combat, la flotte de ".trouvNom($queryFlottes[$i]['id_user'])."(".$queryFlottes[$i]['id_user'].") a été renvoyé au point de départ.", 1); - header('Location: ./?erreurcombat'); - exit; - } - } - else { - //On génére un nouveau combat - $combat = new Combat($queryFlottes[$i], $queryEN, $queryEN, array(trouvInfo($queryFlottes[$i]['id_user'], 'blindage'), trouvInfo($queryEN['id_user'], 'blindage'))); - $bdd->query("UPDATE $table_flottes SET effectue = '2' WHERE id = '$id_flotte';"); - } - $bdd->deconnexion(); - - while($combat->timestamp <= time()) { - //Préparation du rapport - $rapport = new Rapport($mission, $queryFlottes[$i]['id_user'], $queryEN['id_user'], $combat->timestamp); - - $combat->Ntour++; - $rapport->addInfo($combat->ATvais, 0); - $rapport->addInfo($combat->ENvais, 1); - $rapport->addInfo($combat->ENdef, 2); - $rapport->addInfo($combat->Ntour, 3); - $rapport->addInfo($queryEN, 4); - $rapport->addInfo($queryFlottes[$i], 5); - - //Récupération des paramètres de la tactique de l'attaquant - $arraytactique = tactique($combat->ATtactique); - //On régénére les boucliers de l'attaquant et on calcul l'attaque de l'attaquant - $ATattaque = $combat->calcAttaque($arraytactique[2] + $combat->regenereBC($arraytactique[1], true, !$arraytactique[3], trouvInfo($queryFlottes[$i]['id_user'], 'blindage')), true, trouvInfo($queryFlottes[$i]['id_user'], 'armement')); - - //Récupération des paramètres de la tactique du défenseur - $arraytactique = tactique($combat->ENtactique); - //On régénére les boucliers de l'attaquant et on calcul l'attaque de l'attaquant - $ENattaque = $combat->calcAttaque($arraytactique[2] + $combat->regenereBC($arraytactique[1], false, !$arraytactique[3], trouvInfo($queryEN['id_user'], 'blindage')), false, trouvInfo($queryEN['id_user'], 'armement')); - - //On lance l'attaque - @$ATresult = $combat->attaquerVais($ATattaque, true); - @$ENresult = $combat->attaquerVais($ENattaque, false); - - if (!$ATresult && $ENresult) { //Attaquant vainqueur - $combat->ENres['metal'] = $queryEN['metal']; - $combat->ENres['cristal'] = $queryEN['cristal']; - $combat->ENres['hydrogene'] = $queryEN['hydrogene']; - - $exportAT = $combat->exportAT(true); $ret_time = $combat->timestamp; - $exportEN = $combat->exportEN(); $pillm = $combat->pillage[0]; $pillc = $combat->pillage[1]; $pillh = $combat->pillage[2]; - $bdd->connexion(); - $bdd->query("UPDATE $table_flottes SET $exportAT, effectue = '1', ret_time = '$ret_time' + end_time WHERE id = '$id_flotte';"); - $bdd->query("UPDATE $table_planete SET $exportEN, metal = metal - '$pillm', cristal = cristal - '$pillc', hydrogene = hydrogene - '$pillh' WHERE id = '$ENidPlan';"); - $bdd->query("DELETE FROM $table_flottes_combats WHERE refflotte = '$id_flotte';"); - $bdd->deconnexion(); - $rapport->addInfo(array(true, true, false), 6); - } - elseif ($ATresult && !$ENresult) { //Défenseur vainqueur - $exportEN = $combat->exportEN(); - $bdd->connexion(); - $bdd->query("DELETE FROM $table_flottes_combats WHERE refflotte = '$id_flotte';"); - $bdd->query("DELETE FROM $table_flottes WHERE id = '$id_flotte';"); - $bdd->query("UPDATE $table_planete SET $exportEN WHERE id = '$ENidPlan';"); - $bdd->deconnexion(); - $rapport->addInfo(array(true, false, false), 6); - } - elseif (!$ATresult && !$ENresult) { //Match nul - $exportEN = $combat->exportEN(); - $bdd->connexion(); - $bdd->query("DELETE FROM $table_flottes_combats WHERE refflotte = '$id_flotte';"); - $bdd->query("DELETE FROM $table_flottes WHERE id = '$id_flotte';"); - $bdd->query("UPDATE $table_planete SET $exportEN WHERE id = '$ENidPlan';"); - $bdd->deconnexion(); - $rapport->addInfo(array(true, false, true), 6); - } - elseif ($combat->Ntour >= 250) { //Match nul - $exportAT = $combat->exportAT(false); $ret_time = $combat->timestamp; - $exportEN = $combat->exportEN(); $pillm = $combat->pillage[0]; $pillc = $combat->pillage[1]; $pillh = $combat->pillage[2]; - $bdd->connexion(); - $bdd->query("UPDATE $table_flottes SET $exportAT, effectue = '1', ret_time = '$ret_time' + end_time WHERE id = '$id_flotte';"); - $bdd->query("UPDATE $table_planete SET $exportEN, metal = metal - '$pillm', cristal = cristal - '$pillc', hydrogene = hydrogene - '$pillh' WHERE id = '$ENidPlan';"); - $bdd->query("DELETE FROM $table_flottes_combats WHERE refflotte = '$id_flotte';"); - $bdd->deconnexion(); - $rapport->addInfo(array(true, false, true), 6); - } - else $rapport->addInfo(array(false, false, false), 6); - - $rapport->addInfo($combat->ATvais, 7); - $rapport->addInfo($combat->ENvais, 8); - $rapport->addInfo($combat->ENdef, 9); - - //Prévision du prochain tour - $combat->timestamp += 300; - $rapport->addInfo($combat->timestamp, 10); - $rapport->addInfo($combat->pillage, 11); - - //On envoie les rapports aux joueurs concernés - $rapport->send(); - - //On arrête la boucle si le combat est terminé - if ($rapport->var[6][0]) break; - } - $debriM = $combat->debriM + $queryEN['debris_met']; - $debriC = $combat->debriC + $queryEN['debris_cri']; - - $bdd->connexion(); - $bdd->escape($debriM); - $bdd->escape($debriC); - - $bdd->query("UPDATE $table_planete SET debris_met = $debriM, debris_cri = $debriC WHERE galaxie = '$end_galaxie' AND ss = '$end_ss' AND position = '$end_position';"); - - $combat->debriM = 0; - $combat->debriC = 0; - if (!$rapport->var[6][0]) { //Si le combat n'est pas terminé - //On sérialise la classe pour l'exporter - $serialise = serialize($combat); - $bdd->escape($serialise); - - //On enregistre le combat dans la base de données - $timesuite = $combat->timestamp; - $idFleet = $queryFlottes[$i]['id']; - if ($queryFlottes[$i]['effectue']) $bdd->query("UPDATE $table_flottes_combats SET serialize = '$serialise', tactiqueAT = '0', tactiqueEN = '0', timestamp = '$timesuite' WHERE refflotte = '$id_flotte';"); - else $bdd->query("INSERT INTO $table_flottes_combats (refflotte, timestamp, serialize, tactiqueAT, tactiqueEN) VALUES('$idFleet', '$timesuite', '$serialise', '0', '0');"); - } - $bdd->deconnexion(); - } - //Mission Transporter - elseif ($mission == 2) { - $Cmetal = $queryFlottes[$i]['contenu_metal']; - $Ccristal = $queryFlottes[$i]['contenu_cristal']; - $Chydrogene = $queryFlottes[$i]['contenu_hydrogene']; - $bdd->connexion(); - $bdd->query("UPDATE $table_planete SET metal = metal + '$Cmetal', cristal = cristal + '$Ccristal', hydrogene = hydrogene + '$Chydrogene' WHERE galaxie = '$end_galaxie' AND ss = '$end_ss' AND position = '$end_position';"); - $bdd->query("UPDATE $table_flottes SET effectue = '1', contenu_metal = '0', contenu_cristal = '0', contenu_hydrogene = '0' WHERE id = '$id_flotte';"); - $bdd->deconnexion(); - - $rapport = new Rapport($mission, $queryFlottes[$i]['id_user'], $queryEN['id_user'], $end_time); - $rapport->addInfo($queryEN, 0); - $rapport->addInfo(array($queryFlottes[$i]['contenu_metal'], $queryFlottes[$i]['contenu_cristal'], $queryFlottes[$i]['contenu_hydrogene']), 1); - $rapport->send(); - } - //Mission Coloniser - elseif ($mission == 3) { - $rapport = new Rapport($mission, $queryFlottes[$i]['id_user'], 0, $end_time); - $rapport->addInfo(array($end_galaxie, $end_ss, $end_position), 0); - - $rapport->addInfo(true, 1); - $time = time(); - $cases = mt_rand(125,222); - $image = mt_rand(1,15); - $Cmetal = $queryFlottes[$i]['contenu_metal'] + 1000; - $Ccristal = $queryFlottes[$i]['contenu_cristal'] + 700; - $Chydrogene = $queryFlottes[$i]['contenu_hydrogene']; - - //Calcul de l'isolement - $nbPlan = count($queryPlanetes); - if ($nbPlan >= 11) { - switch($nbPlan){ - case 11: $tps = 2; break; - case 12: $tps = 4; break; - case 13: $tps = 6; break; - case 14: $tps = 8; break; - case 15: $tps = 12; break; - case 16: $tps = 16; break; - case 17: $tps = 20; break; - default: $tps = 24; - } - } - else $tps = 0; - $debut = mktime(rand(0, 24-$tps), 0, 0, date('n'), date('j'), date('Y')); - $fin = $debut + $tps * 3600; - - $idFlo = $queryFlottes[$i]['id_user']; - $bdd->connexion(); - if ($bdd->query("INSERT INTO $table_planete (id_user, isolement, nom_planete, galaxie, ss, position, image, cases, timestamp, metal, cristal, hydrogene, hash_planete) VALUES ('$idFlo', '$debut $fin', 'Planète colonisée', '$end_galaxie', '$end_ss', '$end_position', '$image', '$cases', '$time', '$Cmetal', '$Ccristal', '$Chydrogene', SHA1(CONCAT('g',planete.galaxie,'s',planete.ss,'p',planete.position)));") === false) { - $rapport->addInfo(false, 1); - $bdd->query("UPDATE $table_flottes SET effectue = 1 WHERE id = $id_flotte;"); - $bdd->deconnexion(); - } - else { - if ($queryFlottes[$i]['nb_vais'] == 1) { - $queryFlottes[$i]['nb_vais'] = -1; - $bdd->query("DELETE FROM $table_flottes WHERE id = $id_flotte"); - } - else $bdd->query("UPDATE $table_flottes SET effectue = 1, vaisseau_3 = vaisseau_3 - 1, nb_vais = nb_vais - 1, contenu_metal = 0, contenu_cristal = 0, contenu_hydrogene = 0 WHERE id = $id_flotte;"); - $bdd->deconnexion(); - } - $rapport->send(); - } - //Mission Recycler - elseif ($mission == 4) { - $capacite = $queryFlottes[$i]['contenu_max'] - (vais_conso($queryFlottes[$i]['end_time'], count($queryFlottes[$i]['nb_vais']))*$queryFlottes[$i]['vitesse']*5) + $queryFlottes[$i]['contenu_metal'] + $queryFlottes[$i]['contenu_cristal'] + $queryFlottes[$i]['contenu_hydrogene']; - - $debris_met = $queryEN['debris_met']; - $debris_cri = $queryEN['debris_cri']; - - if ($debris_met+$debris_cri > $capacite) { - $a = floor($capacite/2); - $b = floor($capacite/2); - if ($a > $debris_met && $b > $debris_cri) { - $a = $debris_met; - $b = $debris_cri; - } - else if ($a > $debris_met) { - $a = $debris_met; - $b = ($capacite - $a); - if ($b > $debris_cri) $b = $debris_cri; - } - else if ($b > $debris_cri) { - $b = $debris_cri; - $a = ($capacite - $b); - if ($a > $debris_met) $a = $debris_met; - } - } - else { - $a = $debris_met; - $b = $debris_cri; - } - $Cmetal = $a + $queryFlottes[$i]['contenu_metal']; - $Ccristal = $b + $queryFlottes[$i]['contenu_cristal']; - - $bdd->connexion(); - $bdd->query("UPDATE $table_flottes SET effectue = '1', contenu_metal = '$Cmetal', contenu_cristal = '$Ccristal' WHERE id = '$id_flotte';"); - $bdd->query("UPDATE $table_planete SET debris_met = debris_met - '$a', debris_cri = debris_cri - '$b' WHERE galaxie = '$end_galaxie' AND ss = '$end_ss' AND position = '$end_position';"); - $bdd->deconnexion(); - - $rapport = new Rapport($mission, $queryFlottes[$i]['id_user'], $queryEN['id_user'], $end_time); - $rapport->addInfo($queryEN, 0); - $rapport->addInfo(array($a, $b), 1); - $rapport->send(); - } - //Mission Espionnage - elseif ($mission == 5) { - $nbsondes = $queryFlottes[$i]['vaisseau_3']; - $id_userT = $queryEN['id_user']; - $id_att = $queryFlottes[$i]['id_user']; - - $bdd->connexion(); - $bdd->query("UPDATE $table_flottes SET effectue = 1 WHERE id = $id_flotte;"); - $resultatUD = $bdd->unique_query("SELECT * FROM $table_user WHERE id = $id_userT;"); - $resultatUA = $bdd->unique_query("SELECT * FROM $table_user WHERE id = $id_att;"); - $bdd->deconnexion(); - - $diffNiveau = $resultatUA['detection'] - $resultatUD['detection'] + floor($nbsondes/2); - $rapport = new Rapport($mission, $id_att, $id_userT, $end_time); - - if ($diffNiveau < 0) { - $rapport->addInfo($queryEN, 0); - $rapport->addInfo(false, 1); - } - if ($diffNiveau >= 0) $rapport->addInfo($queryEN, 0); - if ($diffNiveau >= 1) $rapport->addInfo(true, 1); - if ($diffNiveau >= 2) $rapport->addInfo(true, 2); - if ($diffNiveau >= 3) $rapport->addInfo(true, 3); - if ($diffNiveau >= 4) $rapport->addInfo($resultatUD, 4); - if ($diffNiveau >= 5) $rapport->addInfo(true, 5); - - $rapport->send(); - } - } - - //Si la flotte a terminé son retour - if (($queryFlottes[$i]['mission'] == 0 && $queryFlottes[$i]['start_time'] + $queryFlottes[$i]['end_time'] <= time()) || ($queryFlottes[$i]['effectue'] == 1 && ((!empty($queryFlottes[$i]['ret_time']) && $queryFlottes[$i]['ret_time'] <= time()) || ($queryFlottes[$i]['start_time'] + $queryFlottes[$i]['end_time']*2 <= time())))) { - if ($queryFlottes[$i]['mission'] == 0) { - $fin_galaxie = $queryFlottes[$i]['end_galaxie']; - $fin_systeme = $queryFlottes[$i]['end_ss']; - $fin_potision = $queryFlottes[$i]['end_position']; - } - elseif (!empty($queryFlottes[$i]['ret_position'])) { - $fin_galaxie = $queryFlottes[$i]['ret_galaxie']; - $fin_systeme = $queryFlottes[$i]['ret_ss']; - $fin_potision = $queryFlottes[$i]['ret_position']; - } - else { - $fin_galaxie = $queryFlottes[$i]['start_galaxie']; - $fin_systeme = $queryFlottes[$i]['start_ss']; - $fin_potision = $queryFlottes[$i]['start_position']; - } - - $bdd->connexion(); - if ($bdd->unique_query("SELECT * FROM $table_planete WHERE galaxie = '$fin_galaxie' AND ss = '$fin_systeme' AND position = '$fin_potision';")) { - $export = ''; - $nbvais = 12; - for($j = 1; $j <= $nbvais; $j++) { - $export .= ', vaisseau_'.$j.' = vaisseau_'.$j.' + '.$queryFlottes[$i]['vaisseau_'.$j]; - } - $Cmetal = $queryFlottes[$i]['contenu_metal']; - $Ccristal = $queryFlottes[$i]['contenu_cristal']; - $Chydrogene = $queryFlottes[$i]['contenu_hydrogene']; - $bdd->query("UPDATE $table_planete SET metal = metal + '$Cmetal', cristal = cristal + '$Ccristal', hydrogene = hydrogene + '$Chydrogene'$export WHERE galaxie = '$fin_galaxie' AND ss = '$fin_systeme' AND position = '$fin_potision';"); - } - $idUserFlotte = $queryFlottes[$i]['id_user']; - $bdd->query("DELETE FROM $table_flottes WHERE id_user = '$idUserFlotte' AND id = '$id_flotte';"); - $bdd->query("DELETE FROM $table_flottes_combats WHERE refflotte = '$id_flotte';"); - $bdd->deconnexion(); +if ($flottes) { + foreach($flottes as $flotte) { + $flotte = new Flotte($flotte['id']); + $flotte->check_mission(); } } + +//Par sécurité, on ferme la dernière classe Flotte inutile +unset($flotte); ?> \ No newline at end of file diff --git a/game/function.php b/game/function.php index 9c59983..883a94f 100644 --- a/game/function.php +++ b/game/function.php @@ -61,7 +61,8 @@ function sec($time) { if ($value != 1) $output .= ' '; } } - return $output; + if (empty($output)) return 'Instantané'; + else return $output; } function readDeblok($tableau, $queryPlanete){ @@ -143,9 +144,9 @@ function requestDeblok($tableau, $queryPlanete){ function txtmission($mission){ if ($mission == 0) return 'Stationner'; - elseif ($mission == 1) return 'Attaquer'; - elseif ($mission == 2) return 'Transporter'; - elseif ($mission == 3) return 'Coloniser'; + elseif ($mission == 1) return 'Transporter'; + elseif ($mission == 2) return 'Coloniser'; + elseif ($mission == 3) return 'Attaquer'; elseif ($mission == 4) return 'Recycler'; elseif ($mission == 5) return 'Espionner'; elseif ($mission == 6) return 'Retour'; @@ -341,4 +342,9 @@ function mdp($nom, $mdp, $alea = false){ } else return hash_var(cxor(strtoupper($nom).':'.$mdp.'♂♪',$alea)); } + +function redirection($url){ + header('Location: '.$url); + print ''; +} ?> \ No newline at end of file diff --git a/game/jeu/Copie de bourse.php b/game/jeu/Copie de bourse.php new file mode 100644 index 0000000..d845a5f --- /dev/null +++ b/game/jeu/Copie de bourse.php @@ -0,0 +1,128 @@ += 0 && date('w') != 0 && date('w') != 6 && $queryUser['auth_level'] < 3) + erreur('La bourse est actuellement fermée !
          Réouverture à 7h00', "orange"); +else*/if ($queryPlanetes[0]['id'] != $planete->id) + erreur('Vous devez être sur votre planète mère pour utiliser la bourse.'); +else { + $a = gpc('a'); + $v = gpc('v'); + $nb = gpc('a'.$a.$v, 'post'); + if ($nb < 0) erreur("Vous ne pouvez pas acheter ou vendre un nombre négatif d'action !", "red", "?p=bourse"); + if (!empty($a) && is_numeric($nb)) { + $action = new Bourse($a, $id_user); + $poss24 = $action->actionIn24Hours(); + if ($poss24 + $nb > MAX_ACTION_PAR_JOUR) erreur('Vous ne pouvez pas acheter plus de 5 mêmes actions dans les mêmes 24h.'); + $ressources = $action->prixAchat($nb); + if ($ressources[0] > $planete->metal || $ressources[1] > $planete->cristal) erreur('Vous n\'avez pas assez de ressources pour acheter '.$nb.' actions.'); + $action->addAction($nb); + $planete->metal -= $ressources[0]; + $planete->cristal -= $ressources[1]; + + header('Location: ?p=bourse&d='.$a); + exit; + } + elseif (!empty($v) && is_numeric($nb)) { + $action = new Bourse($v, $id_user); + $ressources = $action->delAction($nb); + $planete->metal += $ressources[0]; + $planete->cristal += $ressources[1]; + + header('Location: ?p=bourse&d='.$v); + exit; + } + elseif (gpc('e') && $planete->auth_level >= 3) { + $e = gpc('e'); + if (isset($_POST['nomaction']) && isset($_POST['descaction'])) { + $nom = gpc('nomaction', 'post'); + $description = gpc('descaction', 'post'); + $bdd->connexion(); + $bdd->escape($nom); + $bdd->escape($description); + $bdd->escape($e); + $bdd->query("UPDATE $table_bourse SET description = '$description', nom = '$nom' WHERE id = $e;"); + $bdd->deconnexion(); + } + elseif (isset($_POST['prixAM']) && isset($_POST['prixAC'])) { + $prixAM = gpc('prixAM', 'post'); + $prixAC = gpc('prixAC', 'post'); + $bdd->connexion(); + $bdd->escape($prixAM); + $bdd->escape($prixAC); + $bdd->escape($e); + $bdd->query("UPDATE $table_bourse SET metal = $prixAM, cristal = $prixAC WHERE id = $e;"); + $bdd->deconnexion(); + } + elseif (isset($_POST['newsaction'])) { + $news = gpc('newsaction', 'post'); + $time = time(); + $bdd->connexion(); + $bdd->escape($news); + $bdd->escape($e); + $bdd->query("UPDATE $table_bourse SET news = '$news', timeDesc = '$time' WHERE id = $e;"); + $bdd->deconnexion(); + } + + header('Location: ?p=bourse&d='.$e); + exit; + } + elseif (gpc('c') == "new" && $planete->auth_level >= 3 && is_numeric(gpc('prixAM', 'post')) && is_numeric(gpc('prixAC', 'post'))) { + if (isset($_POST['nomaction']) && isset($_POST['descaction'])) { + $nom = gpc('nomaction', 'post'); + $description = gpc('descaction', 'post'); + $prixAM = gpc('prixAM', 'post'); + $prixAC = gpc('prixAC', 'post'); + $news = gpc('newsaction', 'post'); + $time = time(); + $bdd->connexion(); + $bdd->escape($nom); + $bdd->escape($description); + $bdd->escape($prixAM); + $bdd->escape($prixAC); + $bdd->escape($news); + if (!empty($news)) $bdd->query("INSERT INTO $table_bourse (nom, description, news, timeDesc, metal, cristal) VALUES ('$nom', '$description', '$news', '$time', '$prixAM', '$prixAC');"); + else $bdd->query("INSERT INTO $table_bourse (nom, description, metal, cristal) VALUES ('$nom', '$description', '$prixAM', '$prixAC');"); + $bdd->deconnexion(); + } + + header('Location: ?p=bourse'); + exit; + } + elseif ($d = gpc('d')) { + $action = new Bourse($d, $id_user); + $template->assign('taxeA', $action->taxeA); + $template->assign('taxeV', $action->taxeV); + $template->assign('poss', $action->action()); + $template->assign('poss24', $action->actionIn24Hours()); + $action = null; + + $bdd->connexion(); + $bdd->escape($d); + $bourse = $bdd->unique_query("SELECT id, nom, description, news, metal, cristal, (metal/metalAnc-1)*100 AS evolution FROM $table_bourse WHERE id = $d;"); + $bdd->deconnexion(); + + if ($bourse) { + $page = 'bourseDetails'; + $template->assign('bourse', $bourse); + } + else erreur('Cette action n\'existe pas !', "red", '?p=bourse'); + } + else { + $bdd->connexion(); + $infos = $bdd->query("SELECT id, nom, news AS description FROM $table_bourse WHERE news != '' ORDER BY timeDesc DESC LIMIT 7;"); + $bourse = $bdd->query("SELECT id, nom, metal, cristal, (metal/metalAnc-1)*100 AS evolution FROM $table_bourse;"); + $bdd->deconnexion(); + + $page = 'bourse'; + $template->assign('bourse', $bourse); + $template->assign('infos', $infos); + } +} +?> \ No newline at end of file diff --git a/game/jeu/accueil.php b/game/jeu/accueil.php index 542c309..6370957 100644 --- a/game/jeu/accueil.php +++ b/game/jeu/accueil.php @@ -11,22 +11,24 @@ $alli = $bdd->unique_query("SELECT * FROM $table_alliances WHERE id = '".$planet $radar = array(); $nbPlan = count($queryPlanetes); $detect = $planete->technologies[1]*1800; -for($i = 0; $i < $nbPlan; $i++){ +/*for($i = 0; $i < $nbPlan; $i++){ $end_galaxie = $queryPlanetes[$i]['galaxie']; $end_ss = $queryPlanetes[$i]['ss']; $end_position = $queryPlanetes[$i]['position']; $radar[] = array($bdd->query("SELECT F.mission, F.start_galaxie, F.start_ss, F.start_position, F.start_time, F.end_time, F.start_time + F.end_time - ".time()." AS arrive_time, P.nom_planete, U.pseudo FROM $table_flottes F INNER JOIN $table_planete P ON P.galaxie = F.start_galaxie AND P.ss = F.start_ss AND P.position = F.start_position INNER JOIN $table_user U ON U.id = P.id_user WHERE F.effectue != '1' AND F.end_galaxie = '$end_galaxie' AND F.end_ss = '$end_ss' AND F.end_position = '$end_position' AND F.id_user != $id_user AND F.start_time + F.end_time - ".time()." <= $detect;"), array($queryPlanetes[$i]['nom_planete'], $queryPlanetes[$i]['galaxie'], $queryPlanetes[$i]['ss'], $queryPlanetes[$i]['position'])); -} +}*/ $bdd->deconnexion(); -//Affichage des informations sur la planète -$diametre = separerNombres($planete->cases * 92); -$Classpoints = separerNombres($planete->points); +if (SURFACE == "planete") { + //Affichage des informations sur la planète + $diametre = separerNombres($planete->cases * 92); + $Classpoints = separerNombres($planete->points); + $template->assign('diametre',$diametre); + $template->assign('points',$Classpoints); +} $template->assign('mail', $queryMail); $template->assign('radar',$radar); -$template->assign('diametre',$diametre); -$template->assign('points',$Classpoints); $template->assign('alliance', $alli); ?> \ No newline at end of file diff --git a/game/jeu/admin/bandeau.php b/game/jeu/admin/bandeau.php index 30b1c1c..2d76610 100644 --- a/game/jeu/admin/bandeau.php +++ b/game/jeu/admin/bandeau.php @@ -53,8 +53,8 @@ elseif (!empty($_GET['d'])) { } else { $chapeau->connexion(); - $req = $chapeau->query("SELECT * FROM $table_infoshead;"); + $req = $chapeau->query("SELECT * FROM $table_infoshead ORDER BY id ASC;"); $chapeau->deconnexion(); $template->assign('tableau', $req); } -?> \ No newline at end of file +?> diff --git a/game/jeu/batiments.php b/game/jeu/batiments.php index d89332c..2f7d87e 100644 --- a/game/jeu/batiments.php +++ b/game/jeu/batiments.php @@ -4,12 +4,11 @@ $page = 'batiments'; $titre = 'Batiments'; $TEMP_batiments = array(); - $nbstop = count($batiment); //Lancement d'une nouvelle construction if (isset($_GET['c'])) { //Vérification que la planète ne soit pas pleine - if ($planete->casesRest <= 0) erreur('Vous n\'avez plus de place sur votre planète.', "red", "?p=batiments", 3500); + if ($planete->casesRest - count($planete->file_bat) + 1 <= 0) erreur('Vous n\'avez plus de place sur votre planète.', "red", "?p=batiments", 3500); //On vérifie qu'il n'y ait pas de technologie en cours de recherche si l'on veut améliorer le centre de recherche if($_GET['c'] == 6 && !empty($planete->file_tech[1])) erreur('Une technologie est en cours de recherche dans votre laboratoire, vous ne pouvez pas faire de travaux !'); @@ -27,6 +26,9 @@ $titre = 'Batiments'; } //Lancement d'une déconstruction if (isset($_GET['d'])) { + //Si l'on ne possède pas de batiment, erreur + if ($planete->batiments[intval(gpc('d'))] <= 0) erreur('Vous ne pouvez pas démolir un batiment que vous ne possédez pas !'); + //Récupération des erreurs de la mise en file d'attente pour traitement $construction = $planete->file_addObjet("batiments", intval(gpc('d')), -1); @@ -59,13 +61,52 @@ $titre = 'Batiments'; exit; }*/ + //Calcul du bonus de construction des mines en fonction des technologies + if ($planete->technologies[0] &262144) + { + $bonusMine_a = 0.85; + $bonusMine_b = 0.85; + $bonusMine_c = 0.85; + } + elseif ($planete->technologies[0] &131072) + { + $bonusMine_a = 0.9; + $bonusMine_b = 0.9; + $bonusMine_c = 0.9; + } + elseif ($planete->technologies[0] &65536) + { + $bonusMine_a = 0.95; + $bonusMine_b = 0.95; + $bonusMine_c = 0.95; + } + else + { + $bonusMine_a = 1; + $bonusMine_b = 1; + $bonusMine_c = 1; + } + foreach($planete->batiments as $i => $PLbatiment) { + //Si l'on est pas sur la planète mère, on désactive le laboratoire + if ($i == 6 && $queryPlanetes[0]['id'] != $planete->id) continue; + $tr = 0; $a = 0; $b = 0; $c = 0; $sec = 0; $enFile = false; if ($PLbatiment > 0) $niveau = $PLbatiment; else $niveau = 0; $n = $PLbatiment + 1; eval($batimentCALC[$i][0]); eval($batimentCALC[$i][1]); eval($batimentCALC[$i][2]); eval($batimentCALC[$i][3]); if ($planete->file_exist($i, 'file_bat')) $enFile = true; else $enFile = false; + if ($i < 4) + { + $a *= $bonusMine_a; + $b *= $bonusMine_b; + $c *= $bonusMine_c; + } + + //On applique le bonus de temps des ingénieurs et des centrales informatiques + if ($i != 11) $sec /= pow(1.23,$planete->batiments[11]) + 0.0025*$planete->casernes[7]; + //On applique les bonus de test $sec /= VITESSE; @@ -105,6 +146,7 @@ $titre = 'Batiments'; $n = $planete->batiments[$bout[0]] + 1; eval($batimentCALC[$bout[0]][3]); + if ($bout[0] != 11) $sec /= pow(1.23,$planete->batiments[11]) + 0.0025*$planete->casernes[7]; if ($bout[1] < 0) $sec *= 0.6; if ($key == 1) $file[] = array($bout[0], $bout[1], ceil($sec/VITESSE - (time() - $planete->file_bat[0])), $batiment[$bout[0]]); else $file[] = array($bout[0], $bout[1], ceil($sec/VITESSE), $batiment[$bout[0]]); diff --git a/game/jeu/bourse.php b/game/jeu/bourse.php index d845a5f..241f9ae 100644 --- a/game/jeu/bourse.php +++ b/game/jeu/bourse.php @@ -1,128 +1,87 @@ 99999999) erreur("Nombre de ressources invalide !"); -erreur('Arrêtez de tester la bourse, on attend le nouveau script !'); + if ($a == 0) $var = 'metal'; + elseif ($a == 1) $var = 'cristal'; + elseif ($a == 2) $var = 'hydrogene'; -/*if (date('G') < 7 && date('G') >= 0 && date('w') != 0 && date('w') != 6 && $queryUser['auth_level'] < 3) - erreur('La bourse est actuellement fermée !
          Réouverture à 7h00', "orange"); -else*/if ($queryPlanetes[0]['id'] != $planete->id) - erreur('Vous devez être sur votre planète mère pour utiliser la bourse.'); -else { - $a = gpc('a'); - $v = gpc('v'); - $nb = gpc('a'.$a.$v, 'post'); - if ($nb < 0) erreur("Vous ne pouvez pas acheter ou vendre un nombre négatif d'action !", "red", "?p=bourse"); - if (!empty($a) && is_numeric($nb)) { - $action = new Bourse($a, $id_user); - $poss24 = $action->actionIn24Hours(); - if ($poss24 + $nb > MAX_ACTION_PAR_JOUR) erreur('Vous ne pouvez pas acheter plus de 5 mêmes actions dans les mêmes 24h.'); - $ressources = $action->prixAchat($nb); - if ($ressources[0] > $planete->metal || $ressources[1] > $planete->cristal) erreur('Vous n\'avez pas assez de ressources pour acheter '.$nb.' actions.'); - $action->addAction($nb); - $planete->metal -= $ressources[0]; - $planete->cristal -= $ressources[1]; + $bdd->connexion(); + $action = $bdd->unique_query("SELECT dispo, graph FROM $table_bourse_ressources WHERE id = $a;"); + $bdd->deconnexion(); - header('Location: ?p=bourse&d='.$a); - exit; - } - elseif (!empty($v) && is_numeric($nb)) { - $action = new Bourse($v, $id_user); - $ressources = $action->delAction($nb); - $planete->metal += $ressources[0]; - $planete->cristal += $ressources[1]; + //On vérifie que la bourse ait suffisament de ressources à distribuer : + if ($action['dispo'] <= $nb) erreur("Il n'y a pas assez de ressources dans la galaxie pour que vous puissiez en acheter autant."); - header('Location: ?p=bourse&d='.$v); - exit; - } - elseif (gpc('e') && $planete->auth_level >= 3) { - $e = gpc('e'); - if (isset($_POST['nomaction']) && isset($_POST['descaction'])) { - $nom = gpc('nomaction', 'post'); - $description = gpc('descaction', 'post'); - $bdd->connexion(); - $bdd->escape($nom); - $bdd->escape($description); - $bdd->escape($e); - $bdd->query("UPDATE $table_bourse SET description = '$description', nom = '$nom' WHERE id = $e;"); - $bdd->deconnexion(); - } - elseif (isset($_POST['prixAM']) && isset($_POST['prixAC'])) { - $prixAM = gpc('prixAM', 'post'); - $prixAC = gpc('prixAC', 'post'); - $bdd->connexion(); - $bdd->escape($prixAM); - $bdd->escape($prixAC); - $bdd->escape($e); - $bdd->query("UPDATE $table_bourse SET metal = $prixAM, cristal = $prixAC WHERE id = $e;"); - $bdd->deconnexion(); - } - elseif (isset($_POST['newsaction'])) { - $news = gpc('newsaction', 'post'); - $time = time(); - $bdd->connexion(); - $bdd->escape($news); - $bdd->escape($e); - $bdd->query("UPDATE $table_bourse SET news = '$news', timeDesc = '$time' WHERE id = $e;"); - $bdd->deconnexion(); - } + //On vérifie qu'il reste suffisamment de place dans les silos du joueur + if ($planete->cap < $planete->$var + $nb) $nb = $planete->cap - $planete->$var; + if ($nb <= 0) erreur("Vous n'avez pas assez de place pour stocker ces ressources !"); - header('Location: ?p=bourse&d='.$e); - exit; - } - elseif (gpc('c') == "new" && $planete->auth_level >= 3 && is_numeric(gpc('prixAM', 'post')) && is_numeric(gpc('prixAC', 'post'))) { - if (isset($_POST['nomaction']) && isset($_POST['descaction'])) { - $nom = gpc('nomaction', 'post'); - $description = gpc('descaction', 'post'); - $prixAM = gpc('prixAM', 'post'); - $prixAC = gpc('prixAC', 'post'); - $news = gpc('newsaction', 'post'); - $time = time(); - $bdd->connexion(); - $bdd->escape($nom); - $bdd->escape($description); - $bdd->escape($prixAM); - $bdd->escape($prixAC); - $bdd->escape($news); - if (!empty($news)) $bdd->query("INSERT INTO $table_bourse (nom, description, news, timeDesc, metal, cristal) VALUES ('$nom', '$description', '$news', '$time', '$prixAM', '$prixAC');"); - else $bdd->query("INSERT INTO $table_bourse (nom, description, metal, cristal) VALUES ('$nom', '$description', '$prixAM', '$prixAC');"); - $bdd->deconnexion(); - } + $prix = ceil(pow($action['dispo'], -0.1) * $nb * 1.07)/10; - header('Location: ?p=bourse'); - exit; - } - elseif ($d = gpc('d')) { - $action = new Bourse($d, $id_user); - $template->assign('taxeA', $action->taxeA); - $template->assign('taxeV', $action->taxeV); - $template->assign('poss', $action->action()); - $template->assign('poss24', $action->actionIn24Hours()); - $action = null; + //On vérifie que le joueur ait assez de crédits pour acheter + if ($prix <= $planete->credits) { + $planete->credits -= $prix; + $planete->$var += $nb; + + if (empty($action['graph'])) $action['graph'] = array(); + else $action['graph'] = unserialize($action['graph']); + $action['graph'][date('w')] = $action['dispo']; + $graph = serialize($action['graph']); $bdd->connexion(); - $bdd->escape($d); - $bourse = $bdd->unique_query("SELECT id, nom, description, news, metal, cristal, (metal/metalAnc-1)*100 AS evolution FROM $table_bourse WHERE id = $d;"); + $bdd->escape($graph); + $bdd->query("UPDATE $table_bourse_ressources SET dispo = dispo - $nb, graph = '$graph' WHERE id = $a;"); $bdd->deconnexion(); - - if ($bourse) { - $page = 'bourseDetails'; - $template->assign('bourse', $bourse); - } - else erreur('Cette action n\'existe pas !', "red", '?p=bourse'); - } - else { - $bdd->connexion(); - $infos = $bdd->query("SELECT id, nom, news AS description FROM $table_bourse WHERE news != '' ORDER BY timeDesc DESC LIMIT 7;"); - $bourse = $bdd->query("SELECT id, nom, metal, cristal, (metal/metalAnc-1)*100 AS evolution FROM $table_bourse;"); - $bdd->deconnexion(); - - $page = 'bourse'; - $template->assign('bourse', $bourse); - $template->assign('infos', $infos); } + else erreur("Vous n'avez pas assez de crédits pour faire cet achat !"); } +elseif(is_numeric($v) && is_numeric(gpc('a'.$v, 'post'))){ + $nb = gpc('a'.$v, 'post'); + if ($nb <= 0 || $nb > 99999999) erreur("Nombre de ressources invalide !"); + + if ($v == 0) $var = 'metal'; + elseif ($v == 1) $var = 'cristal'; + elseif ($v == 2) $var = 'hydrogene'; + + //On vérifie que le joueur ait assez de ressources pour vendre, sinon, on ajuste à son maximum + if ($nb > $planete->$var) $nb = $planete->$var; + + $bdd->connexion(); + $action = $bdd->unique_query("SELECT dispo, graph FROM $table_bourse_ressources WHERE id = $v;"); + $bdd->deconnexion(); + + $prix = ceil(pow($action['dispo'], -0.1) * $nb * 0.9)/10; + $planete->credits += $prix; + $planete->$var -= $nb; + + if (empty($action['graph'])) $action['graph'] = array(); + else $action['graph'] = unserialize($action['graph']); + $action['graph'][date('w')] = $action['dispo']; + $graph = serialize($action['graph']); + + $bdd->connexion(); + $bdd->escape($graph); + $bdd->query("UPDATE $table_bourse_ressources SET dispo = dispo + $nb, graph = '$graph' WHERE id = $v;"); + $bdd->deconnexion(); +} + +$bdd->connexion(); +$bourse = $bdd->query("SELECT id, dispo FROM $table_bourse_ressources;"); +$bdd->deconnexion(); + +foreach($bourse as $key => $action){ + $bourse[$key]['prix'] = pow($action['dispo'], -0.1) * 200; + $bourse[$key]['prixV'] = $bourse[$key]['prix'] * 0.9; + $bourse[$key]['prixA'] = $bourse[$key]['prix'] * 1.07; +} + +$page = 'bourse_ressources'; +$template->assign('bourse', $bourse); ?> \ No newline at end of file diff --git a/game/jeu/chantierspatial.php b/game/jeu/chantierspatial.php index 691a46d..74ac755 100644 --- a/game/jeu/chantierspatial.php +++ b/game/jeu/chantierspatial.php @@ -4,7 +4,7 @@ $page = 'chantierspatial'; $titre = $batiment[8]; //Vérification que le joueur ait bien un labo avant d'afficher la page -if ($planete->batiments[8] == 0) erreur('Vous devez d\'abord construire un '.strtolower($batiment[8]), "red", '?p=batiments', 4000); +if ($planete->batiments[8] <= 0) erreur('Vous devez d\'abord construire un '.strtolower($batiment[8]), "red", '?p=batiments', 4000); $TEMP_batiments = array(); diff --git a/game/jeu/chantierterrestre.php b/game/jeu/chantierterrestre.php index d0ec0d8..e1fabea 100644 --- a/game/jeu/chantierterrestre.php +++ b/game/jeu/chantierterrestre.php @@ -4,7 +4,7 @@ $page = 'chantierterrestre'; $titre = $batiment[7]; //Vérification que le joueur ait bien un labo avant d'afficher la page -if ($planete->batiments[7] == 0) erreur('Vous devez d\'abord construire un '.strtolower($batiment[7]), "red", '?p=batiments', 4000); +if ($planete->batiments[7] <= 0) erreur('Vous devez d\'abord construire un '.strtolower($batiment[7]), "red", '?p=batiments', 4000); $TEMP_batiments = array(); diff --git a/game/jeu/connexion.php b/game/jeu/connexion.php new file mode 100644 index 0000000..296c923 --- /dev/null +++ b/game/jeu/connexion.php @@ -0,0 +1,189 @@ +assign('message','Nom d\'utilisateur ou mot de passe incorrect.

          '); + $template->assign('couleur','red'); + $template->display('cms/erreur.tpl'); + exit; + } + elseif (hash("sha512", $HB_login.'Ņ♂↨'.$HB_password.'☻♫☼'.date('W!Y¨D@j').$_SERVER["HTTP_USER_AGENT"].$_SERVER["REMOTE_ADDR"]) != $HB_auth && hash("sha512", $HB_login.'Ņ♂↨'.$HB_password.'☻♫☼'.date('W!Y¨D@j', time()-300)) != $HB_auth) { + $template->assign('message','Impossible d\'authentifier la connexion !

          Si le problème perciste, contactez un administrateur.'); + $template->assign('couleur','red'); + $template->display('cms/erreur.tpl'); + exit; + } + else { + $ipe = $_SERVER['REMOTE_ADDR']; + $bdd->connexion(); + $bruteforce = $bdd->unique_query("SELECT nombre FROM securite_identification WHERE ip = '$ipe';"); + if ($bruteforce['nombre'] >= 10) { + $fichier = fopen(_FCORE."ban.xlist",'a+'); + fwrite($fichier, $_SERVER['REMOTE_ADDR']."\n\r"); + fclose($fichier); + } + $bdd->escape($HB_login); + if (!$var = $bdd->unique_query("SELECT mdp_var, mdp FROM $table_user WHERE pseudo = '$HB_login';")) { + if (isset($bruteforce['nombre'])) $bdd->query("UPDATE securite_identification SET nombre = nombre + 1 WHERE ip = '$ipe';"); + else $bdd->query("INSERT INTO securite_identification VALUES ('$ipe', '1', '".time()."');"); + $bdd->deconnexion(); + $template->assign('message','Nom d\'utilisateur ou mot de passe incorrect.'); + $template->assign('couleur','red'); + $template->assign('script',''); + $template->display('cms/erreur.tpl'); + exit; + } + $bdd->deconnexion(); + + $HB_password = mdp($HB_login, $HB_password, $var['mdp_var']); + + $time = time(); + $ip = $_SERVER["REMOTE_ADDR"]; + $bdd->connexion(); + $bdd->escape($HB_password); + + //Limiter le nombre de personnes en ligne simutanément + if ($enligne['enligne'] > 1500) { + $template->assign('message','Il y a actuellement trop de monde connecté sur Halo-Battle. Pour permettre aux joueurs une navigation convenable, nous vous remercions de revenir plus tard.'); + $template->assign('couleur','red'); + $template->display('cms/erreur.tpl'); + exit; + } + + $resultat = $bdd->unique_query("SELECT id, race, mv, last_visite, auth_level, raisonmv FROM $table_user WHERE pseudo = '$HB_login' AND mdp = '$HB_password';"); + if ($resultat) { + $id = $resultat['id']; + $reqPlan = $bdd->query("SELECT id, file_bat, file_tech, file_cas, file_vais, file_ter, timestamp FROM $table_planete WHERE id_user = '$id' ORDER BY id ASC;"); + $resultatP = $reqPlan[0]; + $race = $resultat['race']; + + if (!$reqPlan) { + $bdd->deconnexion(); + + $template->assign('message','Impossible de trouver votre planète !'); + $template->assign('couleur','red'); + $template->display('cms/erreur.tpl'); + exit; + } + + if ($resultat['mv'] > 0) { + if (($resultat['last_visite'] + 259200 > time() || $resultat['mv'] == 3) && $resultat['auth_level'] < 2) { + if ($resultat['mv'] == 3) $template->assign('message','Vous êtes définitivement banni de cette galaxie pour '.$resultat['raisonmv'].'. Vous ne pouvez plus vous reconnecter sur votre compte'); + elseif ($resultat['mv'] == 2) $template->assign('message','Un opérateur a placé votre compte en mode vacances pour '.$resultat['raisonmv'].'. Vous ne pouvez pas vous reconnecter sur votre compte avant le
          '.strftime("%A %d %B à %H:%M", $resultat['last_visite']+259200)); + else $template->assign('message','Vous ne pouvez pas sortir du mode vacances avant le
          '.strftime("%A %d %B à %H:%M", $resultat['last_visite']+259200)); + $template->assign('couleur','red'); + $template->display('cms/erreur.tpl'); + exit; + } + + $bdd->query("UPDATE $table_user SET mv = '0' WHERE id = '$id';"); + $bdd->query("UPDATE $table_planete SET timestamp = '".time()."' WHERE id_user = '$id';"); + $bdd->deconnexion(); + + //On fait repartir à 0 les files d'attente + include_once(_FCORE."../game/vars.php"); + include_once(_FCORE."../game/Class/class.file.php"); + include_once(_FCORE."../game/Class/class.user.php"); + include_once(_FCORE."../game/Class/class.planete.php"); + foreach ($reqPlan as $plan){ + if (!empty($plan['file_bat'])) { + $file = new File($plan['file_bat']); + $fileBat = $file->reajusteVacances($plan['timestamp']); + } + else $fileBat = ''; + if (!empty($plan['file_tech'])) { + $file = new File($plan['file_tech']); + $fileTech = $file->reajusteVacances($plan['timestamp']); + } + else $fileTech = ''; + if (!empty($plan['file_cas'])) { + $file = new File($plan['file_cas']); + $fileCas = $file->reajusteVacances($plan['timestamp']); + } + else $fileCas = ''; + if (!empty($plan['file_vais'])) { + $file = new File($plan['file_vais']); + $fileVais = $file->reajusteVacances($plan['timestamp']); + } + else $fileVais = ''; + if (!empty($plan['file_ter'])) { + $file = new File($plan['file_ter']); + $fileTer = $file->reajusteVacances($plan['timestamp']); + } + else $fileTer = ''; + + $idPlan = $plan['id']; + $bdd->connexion(); + $bdd->escape($fileBat); + $bdd->escape($fileTech); + $bdd->escape($fileCas); + $bdd->escape($fileVais); + $bdd->escape($fileTer); + $bdd->query("UPDATE $table_planete SET file_bat = '$fileBat', file_tech = '$fileTech', file_cas = '$fileCas', file_vais = '$fileVais', file_ter = '$fileTer' WHERE id = $idPlan;"); + $bdd->deconnexion(); + + //On met à jour la planète pour tout le reste + $plan = new Planete($plan['id'], true); + } + } + //On met à jour toutes les planètes si le nombre de joueurs n'est pas trop important + elseif ($enligne['enligne'] > 400) { + include_once(_FCORE."../game/vars.php"); + include_once(_FCORE."../game/Class/class.file.php"); + include_once(_FCORE."../game/Class/class.user.php"); + include_once(_FCORE."../game/Class/class.planete.php"); + + foreach ($reqPlan as $plan){ + $plan = new Planete($plan['id'], true); + } + } + + $plan = null; + + $bdd->connexion(); + $bdd->query("UPDATE $table_user SET last_visite = '$time', last_ip = '$ip' WHERE id = $id;"); + $bdd->query("INSERT INTO $table_registre_identification (id_util, ip) VALUES (".$id.",'".$ip."');"); + $multi = $bdd->unique_query("SELECT COUNT(*) FROM $table_registre_identification WHERE ip = '$ip' GROUP BY ip, id_util;"); + $message = $bdd->unique_query("SELECT time FROM $table_messages_demarrage ORDER BY time DESC LIMIT 1;"); + $bdd->deconnexion(); + + $sess->values['connected'] = TRUE; + $sess->values['id'] = $resultat['id']; + $sess->values['race'] = $resultat['race']; + $sess->values['idPlan'] = $resultatP['id']; + $sess->values['idAsteroide'] = 0; + + //Si on détecte le multi-compte, on interdit l'accès au panneau d'admin + if (empty($multi)) $sess->level = 1; + else $sess->level = $resultat['auth_level'] + 1; + $sess->put($resultat['id']); + + if ($message['time'] > $resultat['last_visite']) redirection('./'.$config['first_page'].'?p=demarrage'); + elseif (empty($multi)) redirection('./'.$config['first_page'].'?p=avertmulti'); + else redirection('./'.$config['first_page'].'?p=accueil'); + exit; + } + else { + $bdd->deconnexion(); + + $template->assign('message','Nom d\'utilisateur ou mot de passe incorrect.'); + $template->assign('couleur','red'); + $template->assign('script',''); + $template->display('cms/erreur.tpl'); + exit; + } + } + } +?> \ No newline at end of file diff --git a/game/jeu/description.php b/game/jeu/description.php index 777b9d1..b620092 100644 --- a/game/jeu/description.php +++ b/game/jeu/description.php @@ -77,7 +77,7 @@ $race = $_GET['r']; if ($race != $planete->race) include(_FCORE."../game/noms.php"); $template->assign('raceAff', $race); -if (isset($_GET['b']) && is_numeric($_GET['b']) && $_GET['b'] < count($batiment)) { +if (isset($_GET['b']) && is_numeric($_GET['b']) && !empty($batiment[$_GET['b']])) { $template->assign('type', 'batiments'); $t = $_GET['b']; $template->assign('t', $t); @@ -97,7 +97,7 @@ if (isset($_GET['b']) && is_numeric($_GET['b']) && $_GET['b'] < count($batiment) $template->assign('etat', readDeblok($batimentTECH[$t], $planete)); } -elseif (isset($_GET['t']) && is_numeric($_GET['t']) && $_GET['t'] < count($technolo)) { +elseif (isset($_GET['t']) && is_numeric($_GET['t']) && !empty($technolo[$_GET['t']])) { $template->assign('type', 'technologies'); $t = $_GET['t']; $template->assign('image', $technoli[$t]); @@ -115,7 +115,7 @@ elseif (isset($_GET['t']) && is_numeric($_GET['t']) && $_GET['t'] < count($techn $template->assign('etat', readDeblok($technoloTECH[$t], $planete)); } -elseif (isset($_GET['v']) && is_numeric($_GET['v']) && $_GET['v'] < count($nomvaisn)) { +elseif (isset($_GET['v']) && is_numeric($_GET['v']) && !empty($nomvaisn[$_GET['v']])) { $template->assign('type', 'vaisseaux'); $t = $_GET['v']; $template->assign('image', $nomvaisi[$t]); @@ -150,7 +150,7 @@ elseif (isset($_GET['d']) && is_numeric($_GET['d']) && $_GET['d'] < count($nomte $template->assign('caract', array($defense_at[$t], $defense_bc[$t], $defense_pv[$t])); } } -elseif (isset($_GET['c']) && is_numeric($_GET['c']) && $_GET['c'] < count($casernen)) { +elseif (isset($_GET['c']) && is_numeric($_GET['c']) && !empty($casernen[$_GET['c']])) { $template->assign('type', 'caserne'); $t = $_GET['c']; $template->assign('image', $casernei[$t]); diff --git a/game/jeu/flotte.php b/game/jeu/flotte.php index 5270fac..9745e6d 100644 --- a/game/jeu/flotte.php +++ b/game/jeu/flotte.php @@ -10,9 +10,9 @@ if (!empty($_POST['cds']) && !empty($_POST['nomflotte']) && isset($_POST['amas'] $mission = floor(gpc('mission', 'post')); if (isset($_POST['tactique'])) $tactique = floor(gpc('tactique', 'post')); else $tactique = 0; - $EBmetal = floor(gpc('metal', 'post')); - $EBcristal = floor(gpc('cristal', 'post')); - $EBhydrogene = floor(gpc('hydrogene', 'post')); + $EBmetal = floor(str_replace(' ', '', gpc('metal', 'post'))); + $EBcristal = floor(str_replace(' ', '', gpc('cristal', 'post'))); + $EBhydrogene = floor(str_replace(' ', '', gpc('hydrogene', 'post'))); $vitesse = floor(gpc('vitesse', 'post'))/100; $bdd->connexion(); @@ -56,7 +56,7 @@ if (!empty($_POST['cds']) && !empty($_POST['nomflotte']) && isset($_POST['amas'] else { //On vérifie qu'il n'y ait pas une interaction entre deux multi-comptes $cnt = count($multi); - if ($cnt > 1 && $mission == 2) { + if ($cnt > 1 && $mission == 1) { for($i = 0; $i < $cnt; $i++){ if ($multi[$i]['id_util'] == $resultat['id_user']) erreur('Vous ne pouvez pas avoir d\'interaction avec ce joueur pour raison de multi-compte (voir page d\'accueil).'); } @@ -78,8 +78,8 @@ if (!empty($_POST['cds']) && !empty($_POST['nomflotte']) && isset($_POST['amas'] elseif (!$resultat) erreur('La planète que vous tentez d\'attaquer est inhabitée.', "red", '?p=flotte'); elseif ($resultat['id_user'] == $id_user) erreur('La planète que vous tentez d\'attaquer vous appartient.', "red", '?p=flotte'); } - elseif ($mission == 2 && !$resultat) erreur('Impossible de transporter des ressources vers la planète ['.$end_galaxie.':'.$end_ss.':'.$end_pos.'] car elle est inhabitée.', "red", '?p=flotte', 4000); - elseif ($mission == 3 && $resultat) erreur('La planète que vous voulez coloniser est déjà habitée.', "red", '?p=flotte', 3000); + elseif ($mission == 1 && !$resultat) erreur('Impossible de transporter des ressources vers la planète ['.$end_galaxie.':'.$end_ss.':'.$end_pos.'] car elle est inhabitée.', "red", '?p=flotte', 4000); + elseif ($mission == 2 && $resultat) erreur('La planète que vous voulez coloniser est déjà habitée.', "red", '?p=flotte', 3000); elseif ($mission == 0 && $resultat['id_user'] != $id_user) erreur('La planète sur laquelle vous désirez stationner ne vous appartient pas.', "red", '?p=flotte', 3000); elseif ($mission == 4 && ($resultat['debris_met'] <= 0 || $resultat['debris_cri'] <= 0) && empty($sess->values['forceFlotte'])) { $sess->values['forceFlotte'] = true; @@ -112,30 +112,35 @@ if (!empty($_POST['cds']) && !empty($_POST['nomflotte']) && isset($_POST['amas'] $flotte->mission = $mission; $flotte->start_planete = $planete; $flotte->start_time = time(); - $flotte->end_planete = $resultat['id']; + + //On traite le cas des planètes qui n'existent pas (dans le cas de la mission colonisation) + if ($mission == 2) $flotte->end_planete = $end_galaxie.':'.$end_ss.':'.$end_pos; + else $flotte->end_planete = $resultat['id']; + $calc = $flotte->calc_deplacement($planete->galaxie, $planete->ss, $planete->position, $end_galaxie, $end_ss, $end_pos, $vitesse, false, true); $flotte->end_time = $calc[0]; $conso = $calc[1]; //On double la consomation si on fait un aller-retour - if ($mission == 1 || $mission == 3 || $mission == 4 || $mission == 5) $conso *= 2; + if ($mission == 1 || $mission == 2 || $mission == 4 || $mission == 5) $conso *= 2; //On vérifie qu'il y a assez de place dans les cales des vaisseaux avant l'envoie ainsi que de ressources sur la planète $flotte->calculer(); - if ($flotte->contenuMax < ceil(gpc('metal', 'post')) + ceil(gpc('cristal', 'post')) + ceil(gpc('hydrogene', 'post')) + $conso) erreur('Vous ne pouvez pas embarquer autant de ressources, les cales débordent. '.$flotte->contenuMax, "red", '?p=flotte', 3500); - elseif ($planete->metal < ceil(gpc('metal', 'post')) || $planete->cristal < ceil(gpc('cristal', 'post')) || $planete->hydrogene < ceil(gpc('hydrogene', 'post')) + $conso) erreur('Vous n\'avez pas assez de ressources sur cette planète pour envoyer cette flotte.', "red", '?p=flotte', 3500); + if ($flotte->contenuMax < $EBmetal + $EBcristal + $EBhydrogene + $conso) erreur('Vous ne pouvez pas embarquer autant de ressources, les cales débordent. '.$flotte->contenuMax, "red", '?p=flotte', 3500); + elseif ($planete->metal < $EBmetal || $planete->cristal < $EBcristal || $planete->hydrogene < $EBhydrogene + $conso) erreur('Vous n\'avez pas assez de ressources sur cette planète pour envoyer cette flotte.', "red", '?p=flotte', 3500); else { - if ($mission == 1) $flotte->tactique = gpc('tactique', 'post'); - $flotte->contenu = array(floor(gpc('metal', 'post')), floor(gpc('cristal', 'post')), floor(gpc('hydrogene', 'post'))); + //if ($mission == 3) $flotte->tactique = gpc('tactique', 'post'); + $flotte->contenu = array($EBmetal, $EBcristal, $EBhydrogene); $flotte->modifFlotte = "INSERT"; //On actualise la planète - $planete->metal -= floor(gpc('metal', 'post')); - $planete->cristal -= floor(gpc('cristal', 'post')); - $planete->hydrogene -= floor(gpc('hydrogene', 'post') + $conso); + $planete->metal -= $EBmetal; + $planete->cristal -= $EBcristal; + $planete->hydrogene -= floor($EBhydrogene + $conso); $planete->vaisseaux = $sauv; if (!in_array('vaisseaux', $planete->modif)) $planete->modif[] = 'vaisseaux'; + unset($flotte); unset($sess->values['vais']); $sess->put(); @@ -152,7 +157,6 @@ elseif (!empty($_POST['v0']) || !empty($_POST['v1']) || !empty($_POST['v2']) || else $v = (int)abs($v); if ($vaisseau < $v) { - $planete->vaisseaux = $sauv; erreur('Il ne vous reste plus assez de vaisseaux !', "red", '?p=flotte'); } @@ -167,12 +171,11 @@ elseif (!empty($_POST['v0']) || !empty($_POST['v1']) || !empty($_POST['v2']) || $sess->values['forceFlotte'] = false; //Génération de la liste de mission possible avec les vaisseaux de la flotte - $missions = array('Stationner'); - if ($planete->technologies[0] & 8) $missions[1] = "Transporter"; + $missions = array("Stationner", "Transporter"); if ($sess->values['vais'][2]) $missions[2] = "Coloniser"; if ($planete->technologies[7] & 16) $missions[3] = "Attaquer"; if ($sess->values['vais'][3]) $missions[4] = "Recycler"; - if ($sess->values['vais'][3] || $sess->values['vais'][3]) $missions[5] = "Espionner"; + if ($sess->values['vais'][4] || $sess->values['vais'][13]) $missions[5] = "Espionner"; $template->assign('missions', $missions); //On enregistre les modification de la session @@ -184,6 +187,22 @@ elseif (!empty($_POST['v0']) || !empty($_POST['v1']) || !empty($_POST['v2']) || $template->assign('script', ''); //TODO Ajouter les destinations favorites + Colonies + $favoris = array(); + $favorisC = array(); + include_once(_FCORE."../game/Class/class.tinyplanete.php"); + foreach ($planete->destinationsFavoris as $fav) + { + $fav_Planete = new TinyPlanete($fav); + if (!empty($fav_Planete->nom_planete)) $favoris[$fav_Planete->id] = $fav_Planete->nom_planete; + else $favoris[$fav_Planete->id] = '['.$fav_Planete->galaxie.':'.$fav_Planete->ss.':'.$fav_Planete->position.']'; + } + foreach ($queryPlanetes as $fav) + { + if (!empty($fav['nom_planete'])) $favorisC[$fav['id']] = $fav['nom_planete']; + else $favorisC[$fav['id']] = '['.$fav['galaxie'].':'.$fav['ss'].':'.$fav['position'].']'; + } + $template->assign('favoris', $favoris); + $template->assign('favorisColonies', $favorisC); } //Affichage du détail d'une flotte elseif (!empty($_GET['n'])) { @@ -246,15 +265,16 @@ else { $TEMP_flottesEC = array(); if ($flottes) { foreach ($flottes as $flotte){ - if ($flotte['mission'] != 1 && ($flotte['mission'] != 3 || $flotte['effectue'] == '1' || $flotte['nb_vais'] >= 1) && $flotte['mission'] != 0) { - $retour = $flotte['start_galaxie'].':'.$flotte['start_ss'].':'.$flotte['start_position']; + if ($flotte['mission'] != 1 && ($flotte['mission'] != 2 || $flotte['statut'] == '1') && $flotte['mission'] != 0) { + $planete_retour = new Planete($flotte['start_planete']); + $retour = $planete_retour->galaxie.':'.$planete_retour->ss.':'.$planete_retour->position; $Hretour = date('d/m H:i:s',$flotte['start_time']+2*$flotte['end_time']); } - elseif ($flotte['mission'] == 1) { + /*elseif ($flotte['mission'] == 1) { $retour = $flotte['start_galaxie'].':'.$flotte['start_ss'].':'.$flotte['start_position']; if (empty($flotte['ret_time'])) $Hretour = '-'; else $Hretour = date('d/m H:i:s',$flotte['ret_time']+$flotte['end_time']); - } + }*/ else { $retour = '-'; $Hretour = '-'; @@ -262,7 +282,11 @@ else { $end_planete = new Planete($flotte['end_planete']); - $TEMP_flottesEC[] = array($flotte['id'], $flotte['nom'], txtmission($flotte['mission']), $flotte['nb_vais'], $end_planete->nom_planete.' ['.$end_planete->galaxie.':'.$end_planete->ss.':'.$end_planete->position.']', date('d/m H:i:s',$flotte['start_time']+$flotte['end_time']), $retour, $Hretour); + if ($flotte['mission'] == 2) { + preg_match('#^\[?([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\]?$#', $flotte['end_planete'], $position); + $TEMP_flottesEC[] = array($flotte['id'], $flotte['nom'], txtmission($flotte['mission']), $flotte['nb_vais'], ' ['.$position[1].':'.$position[2].':'.$position[3].']', date('d/m H:i:s',$flotte['start_time']+$flotte['end_time']), $retour, $Hretour); + } + else $TEMP_flottesEC[] = array($flotte['id'], $flotte['nom'], txtmission($flotte['mission']), $flotte['nb_vais'], $end_planete->nom_planete.' ['.$end_planete->galaxie.':'.$end_planete->ss.':'.$end_planete->position.']', date('d/m H:i:s',$flotte['start_time']+$flotte['end_time']), $retour, $Hretour); } } $template->assign('flottesEC', $TEMP_flottesEC); diff --git a/game/jeu/gestion.php b/game/jeu/gestion.php index b16f022..f58b1e8 100644 --- a/game/jeu/gestion.php +++ b/game/jeu/gestion.php @@ -35,4 +35,5 @@ if ($planete->technologies[3] & 2048) { $politiques[] = 'Démocratie (Administration coloniale)'; } $template->assign('politiques', $politiques); +$template->assign('moraldetails', $politiques); ?> \ No newline at end of file diff --git a/game/jeu/laboratoire.php b/game/jeu/laboratoire.php index 6b6c7ff..3f21082 100644 --- a/game/jeu/laboratoire.php +++ b/game/jeu/laboratoire.php @@ -3,8 +3,12 @@ if(!defined('INDEX')) { header('Location: ../'); exit; } $page = 'laboratoire'; $titre = 'Laboratoire'; +//Si l'on est pas sur la planète mère, on bloque le laboratoire +if ($queryPlanetes[0]['id'] != $planete->id) + erreur('Vous devez être sur votre planète mère pour faire des recherches dans le laboratoire.'); + //Vérification que le joueur ait bien un labo avant d'afficher la page -if ($planete->batiments[6] == 0) erreur('Vous devez d\'abord construire un '.strtolower($batiment[6]), "red", '?p=batiments', 4000); +if ($planete->batiments[6] <= 0) erreur('Vous devez d\'abord construire un '.strtolower($batiment[6]), "red", '?p=batiments', 4000); //Lancement d'une nouvelle recherche if (isset($_GET['t']) && isset($_GET['f']) ) { @@ -12,7 +16,7 @@ if (isset($_GET['t']) && isset($_GET['f']) ) { if ($planete->file_exist(6, 'file_bat')) erreur('Votre laboratoire est en travaux, vous ne pouvez pas faire de recherches pour le moment !'); //Récupération des erreurs de la mise en file d'attente pour traitement - $construction = $planete->file_addObjet("technologies", intval(gpc('t')), intval(gpc('f'))); + $construction = $planete->file_addTechno(intval(gpc('f')), intval(gpc('t'))); switch($construction){ case 1: erreur('Vous n\'avez pas les bâtiments et/ou technologies nécessaires pour effectuer cette recherche.'); break; @@ -29,7 +33,7 @@ if (isset($_GET['a'])) { $i = intval(gpc('a')); //Vérification de la présence du batiment dans la file d'attente if(!empty($planete->file_tech[$i+1])) { - $planete->file_delObjet("technologies", $i); + $planete->file_delTechno($i); header('Location: ?p=laboratoire'); exit; } @@ -41,7 +45,7 @@ foreach ($planete->technologies as $key => $technologie){ foreach ($technologiesCALC[$key] as $i => $calc){ //On affiche uniquement les technologies if (($technologie & $calc[1]) == $calc[1] && !($technologie & $calc[0] && $technologie != 0)) { - if ($planete->file_exist($i, $key)) $enFile = true; + if ($planete->file_existTech($key, $i)) $enFile = true; else $enFile = false; //On applique les bonus de test diff --git a/game/jeu/marche.php b/game/jeu/marche.php index 34fd6d7..55c3709 100644 --- a/game/jeu/marche.php +++ b/game/jeu/marche.php @@ -1,5 +1,87 @@ 99999999) erreur("Nombre de ressources invalide !"); + + if ($a == 0) $var = 'metal'; + elseif ($a == 1) $var = 'cristal'; + elseif ($a == 2) $var = 'hydrogene'; + + $bdd->connexion(); + $action = $bdd->unique_query("SELECT dispo, graph FROM $table_bourse_ressources WHERE id = $a;"); + $bdd->deconnexion(); + + //On vérifie que la bourse ait suffisament de ressources à distribuer : + if ($action['dispo'] <= $nb) erreur("Il n'y a pas assez de ressources dans la galaxie pour que vous puissiez en acheter autant."); + + //On vérifie qu'il reste suffisamment de place dans les silos du joueur + if ($planete->cap < $planete->$var + $nb) $nb = $planete->cap - $planete->$var; + if ($nb <= 0) erreur("Vous n'avez pas assez de place pour stocker ces ressources !"); + + $prix = ceil(pow($action['dispo'], -0.1) * $nb * 2.20)/10; + + //On vérifie que le joueur ait assez de crédits pour acheter + if ($prix <= $planete->credits) { + $planete->credits -= $prix; + $planete->$var += $nb; + + if (empty($action['graph'])) $action['graph'] = array(); + else $action['graph'] = unserialize($action['graph']); + $action['graph'][date('w')] = $action['dispo']; + $graph = serialize($action['graph']); + + $bdd->connexion(); + $bdd->escape($graph); + $bdd->query("UPDATE $table_bourse_ressources SET dispo = dispo - $nb, graph = '$graph' WHERE id = $a;"); + $bdd->deconnexion(); + } + else erreur("Vous n'avez pas assez de crédits pour faire cet achat !"); +} +elseif(is_numeric($v) && is_numeric(gpc('a'.$v, 'post'))){ + $nb = gpc('a'.$v, 'post'); + if ($nb <= 1000 || $nb > 99999999) erreur("Nombre de ressources invalide !
          Vous pouvez vendre au minimum 1000 ressources !"); + + if ($v == 0) $var = 'metal'; + elseif ($v == 1) $var = 'cristal'; + elseif ($v == 2) $var = 'hydrogene'; + + //On vérifie que le joueur ait assez de ressources pour vendre, sinon, on ajuste à son maximum + if ($nb > $planete->$var) $nb = $planete->$var; + + $bdd->connexion(); + $action = $bdd->unique_query("SELECT dispo, graph FROM $table_bourse_ressources WHERE id = $v;"); + $bdd->deconnexion(); + + $prix = ceil(pow($action['dispo'], -0.1) * $nb * 1.8)/10; + $planete->credits += $prix; + $planete->$var -= $nb; + + if (empty($action['graph'])) $action['graph'] = array(); + else $action['graph'] = unserialize($action['graph']); + $action['graph'][date('w')] = $action['dispo']; + $graph = serialize($action['graph']); + + $bdd->connexion(); + $bdd->escape($graph); + $bdd->query("UPDATE $table_bourse_ressources SET dispo = dispo + $nb, graph = '$graph' WHERE id = $v;"); + $bdd->deconnexion(); +} + +$bdd->connexion(); +$bourse = $bdd->query("SELECT id, dispo FROM $table_bourse_ressources;"); +$bdd->deconnexion(); + +foreach($bourse as $key => $action){ + $bourse[$key]['prix'] = pow($action['dispo'], -0.1) * 200; + $bourse[$key]['prixV'] = $bourse[$key]['prix'] * 0.9; + $bourse[$key]['prixA'] = $bourse[$key]['prix'] * 1.07; +} + +$page = 'bourse_ressources'; +$template->assign('bourse', $bourse); ?> \ No newline at end of file diff --git a/game/jeu/oubliemdp.php b/game/jeu/oubliemdp.php index e01856c..b27830c 100644 --- a/game/jeu/oubliemdp.php +++ b/game/jeu/oubliemdp.php @@ -37,14 +37,14 @@ if ((isset($_POST['HB_pseudo']) && isset($_POST['HB_mail']) && isset($_POST['HB_ $erreur .= '

          Pseudo ou adresse électronique vide :
          Veuillez compléter tous les champs de ce formulaire avant de le valider.


          '; } - if (isset($_GET['m']) && is_numeric('0x'.$_GET['m'])) $_GET['m'] = cxor(hexstr($_GET['m']), date('WYDj')); if (!isset($_POST['HB_captcha'])) $_POST['HB_captcha'] = ''; - if (strtolower($_POST['HB_captcha']) != strtolower($_SESSION['aleat_nbr']) && gpc('a') != hash_var($_GET['ps'].'☻♫☼'.date('W!Y¨D@j').'Ņ♂↨'.$_GET['m'], "sha512")) { + if (isset($_GET['m']) && is_numeric('0x'.$_GET['m'])) $_GET['m'] = cxor(hexstr($_GET['m']), date('WYDj')); + elseif (strtolower($_POST['HB_captcha']) != strtolower($_SESSION['aleat_nbr']) && gpc('a') != hash_var($_GET['ps'].'☻♫☼'.date('W!Y¨D@j').'Ņ♂↨'.$_GET['m'], "sha512")) { $ok = false; $erreur .= '

          Code de vérification incorrect :
          Le texte que vous avez recopier ne correspondait pas au texte de l\'image, veuillez recommencer.


          '; } if ($ok) { - if (strtolower($_POST['HB_captcha']) == strtolower($_SESSION['aleat_nbr'])) { + if (isset($_SESSION['aleat_nbr']) && strtolower($_POST['HB_captcha']) == strtolower($_SESSION['aleat_nbr'])) { $HB_pseudo = gpc('HB_pseudo', 'post'); $HB_mail = gpc('HB_mail', 'post'); } diff --git a/game/jeu/~flotte.php b/game/jeu/~flotte.php new file mode 100644 index 0000000..4f507c9 --- /dev/null +++ b/game/jeu/~flotte.php @@ -0,0 +1,304 @@ +connexion(); + $bdd->escape($end_galaxie); + $bdd->escape($end_ss); + $bdd->escape($end_pos); + $bdd->escape($mission); + $bdd->escape($tactique); + $bdd->escape($EBmetal); + $bdd->escape($EBcristal); + $bdd->escape($EBhydrogene); + $bdd->escape($vitesse); + $resultat = $bdd->unique_query("SELECT COUNT(id) AS cnt FROM $table_flottes WHERE id_user = '$id_user'"); + $bdd->deconnexion(); + $nbr = $resultat['cnt']; + + //Vérification du code anti-bots + /*if (!isset($sess->values['flcds']) || gpc('cds', 'post') != $sess->values['flcds']) erreur('Impossible d\'authentifier l\'envoie de la flotte.
          Si le problème perciste, contactez un administrateur.', "red", '?p=flotte', 4000); + //Si la mission est d'attaquer, on vérifie que les attaques ne soient pas désactivées + else*/if ($mission == 3 && !ATTAQUES) erreur('Les attaques sont désactivées pour le moment. Pour plus d\'informations, consultez le forum.', "red", '?p=flotte', 5000); + //Vérification que la destination ne soit pas en dehors de la galaxie + elseif ($end_galaxie > MAX_AMAS || $end_ss > MAX_SYSTEME || $end_pos > MAX_PLANETE || $end_galaxie < 0 || $end_ss < 1 || $end_pos < 1 || ($end_galaxie < 1 && $sess->level < 6)) erreur('La destination de la flotte n\'est pas correcte.', "red", '?p=flotte'); + //Vérification que le nombre de slots ne soit pas dépassé + elseif ($nbr > ceil(count($queryPlanetes)/2 + 1)) erreur('Vous n\'avez pas assez de slots disponibles.', "red", '?p=flotte'); + //On vérifie la mission + elseif ($mission < 0 || $mission > 5) erreur('Mission incorrecte !', "red", '?p=flotte'); + //Si la mission est d'attaquer, on vérifie la tactique + elseif ($mission == 3 && !(($tactique == 1 && $planete->technologies[3] & 4096) || ($tactique == 2 && $planete->technologies[3] & 8192) || ($tactique == 3 && $planete->technologies[3] & 16384) || $tactique == 0)) erreur('Vous ne connaissez pas cette tactique de combat !', "red", '?p=flotte'); + //On vérifie la mission, si elle est d'espionner, il faut qu'il y ait des sondes + elseif ($mission == 5 && $sess->values['vais'][6] <= 0 && $sess->values['vais'][13] <= 0) erreur('Vous ne pouvez pas espionner sans sonde d\'espionnage !', "red", '?p=flotte'); + //On vérifie la mission, si elle est de coloniser, il faut qu'il y ait des vaisseaux de colonisation + elseif ($mission == 2 && $sess->values['vais'][2] <= 0) erreur('Vous ne pouvez pas coloniser sans vaisseau de colonisation !', "red", '?p=flotte'); + //On vérifie la mission, si elle est de recycler, il faut qu'il y ait des reclycleurs + elseif ($mission == 4 && $sess->values['vais'][3] <= 0) erreur('Vous ne pouvez pas recycler sans recycleur !', "red", '?p=flotte'); + //On vérifie que l'on possède assez de ressources + elseif ((!empty($EBmetal) && !$EBmetal > $planete->metal) || (!empty($EBcristal) && !$EBcristal > $planete->cristal) || (!empty($EBhydrogene) && !$EBhydrogene > $planete->hydrogene)) erreur('Vous ne pouvez pas envoyer plus de ressources que vous n\'en posséder.', "red", '?p=flotte'); + //On vérifie que l'on n'envoie pas des ressources négatives + elseif ((!empty($EBmetal) && $EBmetal < 0) || (!empty($EBcristal) && $EBcristal < 0) || (!empty($EBhydrogene) && $EBhydrogene < 0)) erreur('Vous avez spécifié des valeurs de ressources à embarquer incorrectes !', "red", '?p=flotte', 4000); + //On vérifie la vitesse du vaisseau + elseif (!is_numeric($vitesse) || $vitesse < 0 || $vitesse > 1) erreur('La vitesse de votre flotte est incorrecte !', "red", '?p=flotte'); + else { + //On vérifie qu'il n'y ait pas une interaction entre deux multi-comptes + $cnt = count($multi); + if ($cnt > 1 && $mission == 1) { + for($i = 0; $i < $cnt; $i++){ + if ($multi[$i]['id_util'] == $resultat['id_user']) erreur('Vous ne pouvez pas avoir d\'interaction avec ce joueur pour raison de multi-compte (voir page d\'accueil).'); + } + } + + $bdd->connexion(); + $resultat = $bdd->unique_query("SELECT id, id_user, debris_met, debris_cri FROM $table_planete WHERE galaxie = '$end_galaxie' AND ss = '$end_ss' AND position = '$end_pos';"); + $bdd->deconnexion(); + + //Si la mission est d'attaquer, on vérifie que le joueur cible ne soit pas ne mode vacances + if ($mission == 3) { + //Récupération de l'ID du joueur cible + $rech_user = $resultat['id_user']; + $bdd->connexion(); + $resultatu = $bdd->unique_query("SELECT mv, time_inscription FROM $table_user WHERE id = '$rech_user';"); + $bdd->deconnexion(); + if ($resultatu['mv'] > 0) erreur('Le joueur que vous tentez d\'attaquer est actuellement en mode vacances, vous ne pouvez donc pas l\'attaquer avant son retour de vacances.', "red", '?p=flotte', 3000); //TODO Mettre le numéro du mode vacances et non > 0 !!! + elseif ($resultatu['time_inscription'] + 604800 > time()) erreur('Le joueur que vous tentez d\'attaquer s\'est inscrit récemment, laissez-lui le temps de se préparer au combat !', "red", '?p=flotte', 3000); + elseif (!$resultat) erreur('La planète que vous tentez d\'attaquer est inhabitée.', "red", '?p=flotte'); + elseif ($resultat['id_user'] == $id_user) erreur('La planète que vous tentez d\'attaquer vous appartient.', "red", '?p=flotte'); + } + elseif ($mission == 1 && !$resultat) erreur('Impossible de transporter des ressources vers la planète ['.$end_galaxie.':'.$end_ss.':'.$end_pos.'] car elle est inhabitée.', "red", '?p=flotte', 4000); + elseif ($mission == 2 && $resultat) erreur('La planète que vous voulez coloniser est déjà habitée.', "red", '?p=flotte', 3000); + elseif ($mission == 0 && $resultat['id_user'] != $id_user) erreur('La planète sur laquelle vous désirez stationner ne vous appartient pas.', "red", '?p=flotte', 3000); + elseif ($mission == 4 && ($resultat['debris_met'] <= 0 || $resultat['debris_cri'] <= 0) && empty($sess->values['forceFlotte'])) { + $sess->values['forceFlotte'] = true; + $sess->put(); + erreur('Il n\'y a rien à recycler sur la planète ['.$end_galaxie.':'.$end_ss.':'.$end_pos.'].
          Vous pouvez forcer le lancement de la flotte en rechargeant cette page.', "orange"); + } + + if (!isset($sess->values['vais']) || !is_array($sess->values['vais'])) erreur('Erreur lors de la création de la flotte, absence de données des vaisseaux', "red", '?p=flotte'); + else { + //Envoie de la flotte + $flotte = new flotte(); + + $sauv = $planete->vaisseaux; //Sauvegarde du contenu de la flotte avant lancement + $nbVais = 0; + foreach ($sess->values['vais'] as $key => $vaisseau){ + if ($vaisseau > 0) { + if ($vaisseau > $planete->vaisseaux[$key]) erreur('Vous avez envoyé plus de vaisseaux que vous n\'en posséder sur cette planète.', "red", '?p=flotte'); + else $nbVais += $vaisseau; + } + elseif ($vaisseau < 0) $vaisseau = 0; + + $flotte->vaisseaux[$key] = $vaisseau; + $sauv[$key] -= $vaisseau; + } + + if ($nbVais <= 0) erreur('Vous devez envoyer au moins un vaisseau pour former une flotte !', "red", '?p=flotte'); + elseif (!isset($sess->values['flnbvais']) || $sess->values['flnbvais'] != $nbVais) erreur('Une erreur est survenue lors de la création de la flotte :

          Calcul du nombre de vaisseaux incorrect !

          Si le problème perciste, contactez un administrateur.', "red", '?p=flotte', 4500); + + $flotte->nom = gpc('nomflotte', 'post'); + $flotte->mission = $mission; + $flotte->start_planete = $planete; + $flotte->start_time = time(); + + //On traite le cas des planètes qui n'existent pas (dans le cas de la mission colonisation) + if ($mission == 2) $flotte->end_planete = $end_galaxie.':'.$end_ss.':'.$end_pos; + else $flotte->end_planete = $resultat['id']; + + $calc = $flotte->calc_deplacement($planete->galaxie, $planete->ss, $planete->position, $end_galaxie, $end_ss, $end_pos, $vitesse, false, true); + $flotte->end_time = $calc[0]; + $conso = $calc[1]; + + //On double la consomation si on fait un aller-retour + if ($mission == 1 || $mission == 2 || $mission == 4 || $mission == 5) $conso *= 2; + + //On vérifie qu'il y a assez de place dans les cales des vaisseaux avant l'envoie ainsi que de ressources sur la planète + $flotte->calculer(); + if ($flotte->contenuMax < ceil(gpc('metal', 'post')) + ceil(gpc('cristal', 'post')) + ceil(gpc('hydrogene', 'post')) + $conso) erreur('Vous ne pouvez pas embarquer autant de ressources, les cales débordent. '.$flotte->contenuMax, "red", '?p=flotte', 3500); + elseif ($planete->metal < ceil(gpc('metal', 'post')) || $planete->cristal < ceil(gpc('cristal', 'post')) || $planete->hydrogene < ceil(gpc('hydrogene', 'post')) + $conso) erreur('Vous n\'avez pas assez de ressources sur cette planète pour envoyer cette flotte.', "red", '?p=flotte', 3500); + else { + //if ($mission == 3) $flotte->tactique = gpc('tactique', 'post'); + $flotte->contenu = array(floor(gpc('metal', 'post')), floor(gpc('cristal', 'post')), floor(gpc('hydrogene', 'post'))); + $flotte->modifFlotte = "INSERT"; + + //On actualise la planète + $planete->metal -= floor(gpc('metal', 'post')); + $planete->cristal -= floor(gpc('cristal', 'post')); + $planete->hydrogene -= floor(gpc('hydrogene', 'post') + $conso); + $planete->vaisseaux = $sauv; + if (!in_array('vaisseaux', $planete->modif)) $planete->modif[] = 'vaisseaux'; + + unset($flotte); + unset($sess->values['vais']); + $sess->put(); + + erreur('Votre flotte a été envoyée avec succès.', "green", '?p=flotte', 4000); + } + } + } +} +elseif (!empty($_POST['v0']) || !empty($_POST['v1']) || !empty($_POST['v2']) || !empty($_POST['v3']) || !empty($_POST['v4']) || !empty($_POST['v5']) || !empty($_POST['v6']) || !empty($_POST['v7']) || !empty($_POST['v8']) || !empty($_POST['v9']) || !empty($_POST['v10']) || !empty($_POST['v11']) || !empty($_POST['v12']) || !empty($_POST['v13'])) { + $nombreVaisseau = 0; + foreach ($planete->vaisseaux as $key => $vaisseau){ + $v = gpc('v'.$key, 'post'); + if (!is_numeric($v)) $v = 0; + else $v = (int)abs($v); + + if ($vaisseau < $v) { + erreur('Il ne vous reste plus assez de vaisseaux !', "red", '?p=flotte'); + } + + $sess->values['vais'][$key] = $v; + $nombreVaisseau += $v; + } + //On vérifie que l'utilisateur a bien envoyé plus d'un vaisseau + if ($nombreVaisseau <= 0) erreur('Vous devez envoyer au moins un vaisseau.', "red", '?p=flotte'); + + //On enregistre les paramètres en session + $sess->values['flnbvais'] = $nombreVaisseau; + $sess->values['forceFlotte'] = false; + + //Génération de la liste de mission possible avec les vaisseaux de la flotte + $missions = array("Stationner", "Transporter"); + if ($sess->values['vais'][2]) $missions[2] = "Coloniser"; + if ($planete->technologies[7] & 16) $missions[3] = "Attaquer"; + if ($sess->values['vais'][3]) $missions[4] = "Recycler"; + if ($sess->values['vais'][3] || $sess->values['vais'][3]) $missions[5] = "Espionner"; + $template->assign('missions', $missions); + + //On enregistre les modification de la session + $sess->values['fltime'] = time(); + $sess->put(); + + $page = 'flotte2'; + $template->assign('scripth', ''); + $template->assign('script', ''); + + //TODO Ajouter les destinations favorites + Colonies +} +//Affichage du détail d'une flotte +elseif (!empty($_GET['n'])) { + $idN = ceil(gpc('n')); + + $flotteN = new Flotte($idN); + $flotteN->load_planete(); + + if ($flotteN->id_flotte == 0 || $flotteN->start_planete->id_user != $planete->id_user) erreur('Impossible de trouver cette flotte !', "red", '?p=flotte', 1500); + else { + //Annulation de la mission + if (isset($_GET['a']) && isset($sess->values['ret_fleet']) && $_GET['a'] == $sess->values['ret_fleet']) { + //Calcul du temps passé depuis le lancement de la flotte + $tpsDD = time() - $flotteN->start_time; + if ($flotteN->mission == '6') erreur('Votre flotte est déjà en train de revenir !', 'red', '?p=flotte&n='.$idN, 1500); + elseif ($flotteN->end_time > $tpsDD) { + $bdd->query("UPDATE $table_flottes SET mission = '6', effectue = '1', end_time = '$tpsDD', end_galaxie = start_galaxie, end_ss = start_ss, end_position = start_position WHERE id_user = '$id_user' AND id = '$idN';"); + header('Location: ?p=flotte&n='.$idN); + exit; + } + else erreur('Impossible d\'annuler la mission, elle a déjà commencée.', "red", '?p=flotte&n='.$idN, 1500); + } + + $sess->values['ret_fleet'] = sha1('HB.fleet_'.rand().'☺ß☻'); + $sess->put(); + + $template->assign('ret_fleet', $sess->values['ret_fleet']); + $template->assign('flotte', $flotteN); + $template->assign('nomvais', $nomvaisa); + $page = 'flotten'; + } +} +//Affichage de la page générale +else { + //Mise à jour des tactiques par défaut + $attaque = gpc('attaque', 'post'); + $defense = gpc('defense', 'post'); + if (is_numeric($attaque) && is_numeric($defense)) { + $chang = false; + if (($attaque != $planete->combatAT_tactique) && (($attaque == 1 && $planete->technologies[3] & 4096) || ($attaque == 2 && $planete->technologies[3] & 8192) || ($attaque == 3 && $planete->technologies[3] & 16384) || $attaque == 0)) { + $planete->combatAT_tactique = $attaque; + if (!in_array('combatAT_tactique', $planete->modifUser)) $planete->modifUser[] = 'combatAT_tactique'; + $chang = true; + } + if (($defense != $planete->combatDE_tactique) && (($defense == 1 && $planete->technologies[3] & 4096) || ($defense == 2 && $planete->technologies[3] & 8192) || ($defense == 3 && $planete->technologies[3] & 16384) || $defense == 0)) { + $planete->combatDE_tactique = $defense; + if (!in_array('combatDE_tactique', $planete->modifUser)) $planete->modifUser[] = 'combatDE_tactique'; + $chang = true; + } + + if ($chang) erreur('Tactiques mises à jour avec succès.', 'green', '?p=flotte', 1100); + } + + //Affichage des flottes en cours dans la galaxie + $bdd->connexion(); + $flottes = $bdd->query("SELECT * FROM $table_flottes WHERE id_user = '$id_user';"); + $bdd->deconnexion(); + $nbr = $bdd->num_rows; + + $TEMP_flottesEC = array(); + if ($flottes) { + foreach ($flottes as $flotte){ + if ($flotte['mission'] != 1 && ($flotte['mission'] != 2 || $flotte['statut'] == '1') && $flotte['mission'] != 0) { + $retour = $flotte['start_galaxie'].':'.$flotte['start_ss'].':'.$flotte['start_position']; + $Hretour = date('d/m H:i:s',$flotte['start_time']+2*$flotte['end_time']); + } + /*elseif ($flotte['mission'] == 1) { + $retour = $flotte['start_galaxie'].':'.$flotte['start_ss'].':'.$flotte['start_position']; + if (empty($flotte['ret_time'])) $Hretour = '-'; + else $Hretour = date('d/m H:i:s',$flotte['ret_time']+$flotte['end_time']); + }*/ + else { + $retour = '-'; + $Hretour = '-'; + } + + $end_planete = new Planete($flotte['end_planete']); + + if ($flotte['mission'] == 2) { + preg_match('#^\[?([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\]?$#', $flotte['mission'], $position); + $TEMP_flottesEC[] = array($flotte['id'], $flotte['nom'], txtmission($flotte['mission']), $flotte['nb_vais'], ' ['.$position[1].':'.$position[2].':'.$position[3].']', date('d/m H:i:s',$flotte['start_time']+$flotte['end_time']), $retour, $Hretour); + } + else $TEMP_flottesEC[] = array($flotte['id'], $flotte['nom'], txtmission($flotte['mission']), $flotte['nb_vais'], $end_planete->nom_planete.' ['.$end_planete->galaxie.':'.$end_planete->ss.':'.$end_planete->position.']', date('d/m H:i:s',$flotte['start_time']+$flotte['end_time']), $retour, $Hretour); + } + } + $template->assign('flottesEC', $TEMP_flottesEC); + + //Affichage des vaisseaux disponible à l'envoie + $TEMP_vaisseaux = array(); + foreach ($planete->vaisseaux as $key => $vaisseau){ + //On affiche uniquement les vaisseaux que l'on possède hormis la station spatiale + if ($vaisseau > 0) $TEMP_vaisseaux[] = array($nomvaisn[$key], separerNombres($vaisseau), $vaisseau, $key); + } + $template->assign('vaisseaux', $TEMP_vaisseaux); + + //Calcul du nombre de slot disponible et vérouillage de l'envoie si besoin + if ($nbr <= ceil(count($queryPlanetes)/2 + 1)) $template->assign('action', ''); + else $template->assign('action', 'Nombre de flottes maximum simultanées atteint'); + + $template->assign('nbflotte', $nbr); + $template->assign('nbflottemax', ceil(count($queryPlanetes)/2 + 1)); + + //Modification des tactiques + $tactiques = array('1'); + $attaqueT = 0; + $defenseT = 0; + if ($planete->technologies[3] & 4096) $tactiques[] = '2'; + if ($planete->technologies[3] & 8192) $tactiques[] = '3'; + if ($planete->technologies[3] & 16384) $tactiques[] = '4'; + + $template->assign('tactiques', $tactiques); + + $page = 'flotte1'; +} +?> \ No newline at end of file diff --git a/game/noms.php b/game/noms.php index e49fc3e..fccb3bc 100644 --- a/game/noms.php +++ b/game/noms.php @@ -1,6 +1,5 @@ values['race']; -if (!isset($auth_level)) @$auth_level = $sess->values['auth_level']; if ($race == 'covenant') { $ressourc = array('Métal','Cristal','Ions','Énergie','Crédits'); @@ -39,7 +38,7 @@ if (!isset($auth_level)) @$auth_level = $sess->values['auth_level']; '~#DESCRIPTION MANQUANTE#~ Chambre du Conseil'); $technolo = array( array('Forage niveau 1', 'Forage niveau 2', 'Forage niveau 3', 'Commerce galactique', 'Rendement métal niveau 1', 'Rendement métal niveau 2', 'Rendement métal niveau 3', 'Rendement cristal niveau 1', 'Rendement cristal niveau 2', 'Rendement cristal niveau 3', 'Rendement hydrogène niveau 1', 'Rendement hydrogène niveau 2', 'Rendement hydrogène niveau 3', 'Théorie du Marché niveau 1', 'Théorie du Marché niveau 2', 'Théorie du Marché niveau 3', 'Fonderies avancées niveau 1', 'Fonderies avancées niveau 2', 'Fonderies avancées niveau 3'), - array('Maîtrise énergie niveau 1', 'Maîtrise énergie niveau 2', 'Maîtrise énergie niveau 3', 'Réacteur à combustion niveau 1', 'Réacteur à combustion niveau 2', 'Réacteur à combustion niveau 3', 'Réacteur à fusion niveau 1', 'Réacteur à fusion niveau 2', 'Réacteur à fusion niveau 3', 'Réacteur à fusion type II niveau 1', 'Réacteur à fusion type II niveau 2', 'Réacteur à fusion type II niveau 3', 'Informatique niveau 1', 'Informatique niveau 2', 'Informatique niveau 3', 'IA niveau 1', 'IA niveau 2', 'IA niveau 3', 'Télécommunications niveau 1', 'Télécommunications niveau 2', 'Télécommunications niveau 3', 'Polymères radars niveau 1', 'Polymères radars niveau 2', 'Polymères radars niveau 3', 'Espionnage niveau 1', 'Espionnage niveau 2', 'Espionnage niveau 3', 'Contre-espionnage niveau 1', 'Contre-espionnage niveau 2', 'Contre-espionnage niveau 3'), + array('Maîtrise énergie niveau 1', 'Maîtrise énergie niveau 2', 'Maîtrise énergie niveau 3', 'Réacteur à combustion niveau 1', 'Réacteur à combustion niveau 2', 'Réacteur à combustion niveau 3', 'Réacteur à fusion niveau 1', 'Réacteur à fusion niveau 2', 'Réacteur à fusion niveau 3', 'Moteur subluminique niveau 1', 'Moteur subluminique niveau 2', 'Moteur subluminique niveau 3', 'Informatique niveau 1', 'Informatique niveau 2', 'Informatique niveau 3', 'IA niveau 1', 'IA niveau 2', 'IA niveau 3', 'Télécommunications niveau 1', 'Télécommunications niveau 2', 'Télécommunications niveau 3', 'Polymères radars niveau 1', 'Polymères radars niveau 2', 'Polymères radars niveau 3', 'Espionnage niveau 1', 'Espionnage niveau 2', 'Espionnage niveau 3', 'Contre-espionnage niveau 1', 'Contre-espionnage niveau 2', 'Contre-espionnage niveau 3'), array('Constructions planétaires niveau 1', 'Constructions planétaires niveau 2', 'Constructions planétaires niveau 3', 'Construction optimisée', 'Ingénierie orbitale', 'Aménagement territorial niveau 1', 'Aménagement territorial niveau 2', 'Aménagement territorial niveau 3'), array('Immigration coloniale niveau 1', 'Immigration coloniale niveau 2', 'Immigration coloniale niveau 3', 'Urbanisme niveau 1', 'Urbanisme niveau 2', 'Urbanisme niveau 3', 'Grandes surfaces', 'Centre de loisirs', 'Arcologie', 'Sciences politiques niveau 1', 'Sciences politiques niveau 2', 'Sciences politiques niveau 3', 'Stratégie militaire niveau 1', 'Stratégie militaire niveau 2', 'Stratégie militaire niveau 3'), @@ -94,7 +93,7 @@ if (!isset($auth_level)) @$auth_level = $sess->values['auth_level']; 'Le canon à plasma n\'a pas besoin de canonnier pour tirer puisque équipé d\'un système de visée automatisé, il utilise une technologie d\'intelligence artificielle rudimentaire pour ensuite envoyer un projectile de plasma surchauffé à haute vitesse carbonisant tout sur son passage.', 'Utilisant un principe similaire de la tourelle à plasma, le lanceur de torpilles plasma utilise un condensateur de matière pour condenser le flux de plasma surchauffé en une masse de destruction pure. Ce système est le système de défense terrestre le plus évolué jamais construit. Son défaut majeur reste sa cadence de tire lente, limitant sa défense face à de multiples adversaires.'); } - elseif ($auth_level >= 6 && md5($race) == '34c19b21bd4a3dda389e767d32fe9779') { + elseif (isset($sess->values['auth_level']) && $sess->values['auth_level'] >= 6 && md5($race) == '34c19b21bd4a3dda389e767d32fe9779') { $ressourc = array('Métal','Cristal','Hydrogène','Énergie','Crédits'); $casernen = array('Constructor','Sentinelle Légère','Sentinelle Lourde','Enforcer Léger','Enforcer Lourd','Monitor','~#PAS DE NOM#~ Médecin','~#PAS DE NOM#~ Ingénieur','~#PAS DE NOM#~ Brute'); $casernde = array( 'Les Constructors sont des minis sentinelles capable d\'effectuer certaine reparation mineur, ils peuvent réparés les sentinelles endommager ainsi que les chasseurs légers.', @@ -186,7 +185,7 @@ if (!isset($auth_level)) @$auth_level = $sess->values['auth_level']; $casernea = array('marine(s)','fusiller(s)','grenadier(s)','T.C.A.O.','sniper(s)','spartan(s)','médecin(s)','ingénieur(s)','soldat(s) exo squelette'); $casernei = array('marines.jpg','marinehf0.jpg','grenadier.jpg','TCAO2.jpg','sniper.jpg','spartan.jpg','medecin.jpg','ingenieurs.jpg','exosquelettehbpb2.jpg'); //$batiment = array('Usine de métallurgie','Usine de cristal','Synchronisateur d\'hydrogène','Centrale solaire','Centrale énergétique','Base radar','Centre de recherches','Chantier terrestre','Chantier spatial','Ecole militaire','Silo de stockage','Centrale informatique', 'Module résidentiel', 'Arcologie', 'Centre commercial', 'Centre de loisirs', 'Centre administratif'); - $batiment = array('Usine de métallurgie','Usine de cristal','Synchronisateur d\'hydrogène','Centrale solaire','Centrale énergétique','Base radar','Centre de recherches','Chantier terrestre','Chantier spatial','Ecole militaire','Silo de stockage','Centrale informatique'); + $batiment = array('Usine de métallurgie','Usine de cristal','Synchronisateur d\'hydrogène','Centrale solaire','Centrale énergétique','Base radar','Centre de recherches','Chantier terrestre','Chantier spatial','Ecole militaire','Silo de stockage','Centrale informatique', 'Module résidentiel', 'Arcologies', 'Bunker', 'Centre commercial', 'Centre loisir'); $batimede = array( 'Cette usine traite tous les métaux recueillis afin de produire du titanium-A ou différents types d\'alliages de qualité pour vos différentes constructions planétaires ou spatiales. Chaque niveau augmente la production de métal.', 'L\'usine de cristal filtre les déchets récoltés avec les cristaux. Une fois séparés du reste ils sont classés par qualité par une quantité d\'appareils de haute technologie. Plus les cristaux sont purs plus ceux-ci peuvent être transformés en unités de stockage de données ou en conducteurs énergétiques de haute qualité. Plus ce bâtiment sera développé, plus vous pourrez traiter de cristaux rapidement.', 'Ce bâtiment use de l\'eau pour la décomposer et en extraire l\'hydrogène, la base de toutes vos productions énergétiques, pour ensuite l\'acheminer dans des condensateurs ioniques afin de le rendre plus dense et par le fait même plus efficace. Chaque niveau augmente la production du synchronisateur.', @@ -199,8 +198,9 @@ if (!isset($auth_level)) @$auth_level = $sess->values['auth_level']; 'L\'académie militaire forme les meilleurs officiers et sous-officiers de la galaxie. Ces hommes expérimentés vous aideront à choisir de meilleures stratégies défensives ou offensives ou encore même économiques face aux différentes situations qui vous seront imposées. Plus vous augmenterez le niveau de cette structure plus vos officiers seront rapides et efficaces dans leurs tâches.', 'Comme toutes choses, vos ressources ont besoin d\'espace pour être stockées ; c\'est pourquoi ces énormes silos vous seront d\'une aide précieuse afin d\'y renfermer une grande quantité de matières premières pour toutes vos productions. Plus le niveau du silo est haut, plus il pourra contenir de ressources supplémentaires.', 'La centrale informatique est le coeur de votre planète, le cerveau de votre territoire, analysant chaque particule détectée avec grand soin. Plus votre centrale est améliorée, plus rapidement et aisément les données seront traitées.', - '~#DESCRIPTION MANQUANTE#~ Module résidentiel', - '~#DESCRIPTION MANQUANTE#~ Arcologie', + '~#DESCRIPTION MANQUANTE#~ Habitation', + '~#DESCRIPTION MANQUANTE#~ Arcologies', + '~#DESCRIPTION MANQUANTE#~ Bunker', '~#DESCRIPTION MANQUANTE#~ Centre commercial', '~#DESCRIPTION MANQUANTE#~ Centre de loisirs', '~#DESCRIPTION MANQUANTE#~ Centre administratif'); @@ -208,14 +208,14 @@ if (!isset($auth_level)) @$auth_level = $sess->values['auth_level']; $batimeni = array('mine_m.jpg','mine_c.png','synchroniseur.jpg','centrale solaire.jpg','centrale electrique.jpg','baseradardl3.jpg','recherches.jpg','chantierterrestrecopybj8.jpg','chantier spatial.jpg','ecole militaire.jpg','stockage.jpg','search0yp.jpg', '../humain_na.jpg', '../humain_na.jpg', '../humain_na.jpg', '../humain_na.jpg', '../humain_na.jpg'); $technolo = array( array('Forage niveau 1', 'Forage niveau 2', 'Forage niveau 3', 'Commerce galactique', 'Rendement métal niveau 1', 'Rendement métal niveau 2', 'Rendement métal niveau 3', 'Rendement cristal niveau 1', 'Rendement cristal niveau 2', 'Rendement cristal niveau 3', 'Rendement hydrogène niveau 1', 'Rendement hydrogène niveau 2', 'Rendement hydrogène niveau 3', 'Théorie du Marché niveau 1', 'Théorie du Marché niveau 2', 'Théorie du Marché niveau 3', 'Fonderies avancées niveau 1', 'Fonderies avancées niveau 2', 'Fonderies avancées niveau 3'), - array('Maîtrise énergie niveau 1', 'Maîtrise énergie niveau 2', 'Maîtrise énergie niveau 3', 'Réacteur à combustion niveau 1', 'Réacteur à combustion niveau 2', 'Réacteur à combustion niveau 3', 'Réacteur à fusion niveau 1', 'Réacteur à fusion niveau 2', 'Réacteur à fusion niveau 3', 'Réacteur à fusion type II niveau 1', 'Réacteur à fusion type II niveau 2', 'Réacteur à fusion type II niveau 3', 'Informatique niveau 1', 'Informatique niveau 2', 'Informatique niveau 3', 'IA niveau 1', 'IA niveau 2', 'IA niveau 3', 'Télécommunications niveau 1', 'Télécommunications niveau 2', 'Télécommunications niveau 3', 'Polymères radars niveau 1', 'Polymères radars niveau 2', 'Polymères radars niveau 3', 'Espionnage niveau 1', 'Espionnage niveau 2', 'Espionnage niveau 3', 'Contre-espionnage niveau 1', 'Contre-espionnage niveau 2', 'Contre-espionnage niveau 3'), + array('Maîtrise énergie niveau 1', 'Maîtrise énergie niveau 2', 'Maîtrise énergie niveau 3', 'Réacteur à combustion niveau 1', 'Réacteur à combustion niveau 2', 'Réacteur à combustion niveau 3', 'Réacteur à fusion niveau 1', 'Réacteur à fusion niveau 2', 'Réacteur à fusion niveau 3', 'Moteur subluminique niveau 1', 'Moteur subluminique niveau 2', 'Moteur subluminique niveau 3', 'Informatique niveau 1', 'Informatique niveau 2', 'Informatique niveau 3', 'IA niveau 1', 'IA niveau 2', 'IA niveau 3', 'Télécommunications niveau 1', 'Télécommunications niveau 2', 'Télécommunications niveau 3', 'Polymères radars niveau 1', 'Polymères radars niveau 2', 'Polymères radars niveau 3', 'Espionnage niveau 1', 'Espionnage niveau 2', 'Espionnage niveau 3', 'Contre-espionnage niveau 1', 'Contre-espionnage niveau 2', 'Contre-espionnage niveau 3'), array('Constructions planétaires niveau 1', 'Constructions planétaires niveau 2', 'Constructions planétaires niveau 3', 'Construction optimisée', 'Ingénierie orbitale', 'Aménagement territorial niveau 1', 'Aménagement territorial niveau 2', 'Aménagement territorial niveau 3'), array('Immigration coloniale niveau 1', 'Immigration coloniale niveau 2', 'Immigration coloniale niveau 3', 'Urbanisme niveau 1', 'Urbanisme niveau 2', 'Urbanisme niveau 3', 'Grandes surfaces', 'Centre de loisirs', 'Arcologie', 'Sciences politiques niveau 1', 'Sciences politiques niveau 2', 'Sciences politiques niveau 3', 'Stratégie militaire niveau 1', 'Stratégie militaire niveau 2', 'Stratégie militaire niveau 3'), array('Projectile Haut Densité niveau 1', 'Projectile Haut Densité niveau 2', 'Projectile Haut Densité niveau 3', 'Assistance de visée niveau 1', 'Assistance de visée niveau 2', 'Assistance de visée niveau 3', 'Guidage laser niveau 1', 'Guidage laser niveau 2', 'Guidage laser niveau 3', 'Condensateurs rapides niveau 1', 'Condensateurs rapides niveau 2', 'Condensateurs rapides niveau 3', 'Balistique avancée niveau 1', 'Balistique avancée niveau 2', 'Balistique avancée niveau 3', 'Accélération magnétique niveau 1', 'Accélération magnétique niveau 2', 'Accélération magnétique niveau 3'), array('Robotique niveau 1', 'Robotique niveau 2', 'Robotique niveau 3', 'Ingénierie atomique niveau 1', 'Ingénierie atomique niveau 2', 'Ingénierie atomique niveau 3', 'Nano-régénération niveau ', 'Nano-régénération niveau 2', 'Nano-régénération niveau 3', 'Squelette renforcé niveau 1', 'Squelette renforcé niveau 2', 'Squelette renforcé niveau 3', 'Armatures enrichies niveau 1', 'Armatures enrichies niveau 2', 'Armatures enrichies niveau 3', 'Composés avancés niveau 1', 'Composés avancés niveau 2', 'Composés avancés niveau 3', 'Alliage niveau 1', 'Alliage niveau 2', 'Alliage niveau 3', 'Alliage avancé niveau 1', 'Alliage avancé niveau 2', 'Alliage avancé niveau 3', 'Armure moléculaire niveau 1', 'Armure moléculaire niveau 2', 'Armure moléculaire niveau 3'), array('Tourelle légère M202 XP', 'Canon de défense automatique', 'Artillerie lourde de 440mm', 'Lance-missiles Archer', 'Batterie de missiles Anaconda', 'Silo de missiles Shiva', 'Canon à accélération magnétique'), - array('Prototype Intercepteur Longsword', 'Prototype Bombardier Longsword', 'Corvette de classe Mako', 'Prototype de Frégate', 'Récupération', 'Prototype de Croiseur de classe Halcyon', 'Prototype de Croiseur de classe Marathon', 'Prototype de Destroyer', 'Prototype de Porte-vaisseaux', 'Prototype de Super Porte-Vaisseaux', 'Prototype de Vaisseau d\'exfiltration de classe Black Cat', 'Prototype de Super canon à accélération magnétique', 'Bunker souterrain', 'Bunker souterrain', 'Bunker souterrain'), + array('Prototype Intercepteur Longsword', 'Prototype Bombardier Longsword', 'Corvette de classe Mako', 'Prototype de Frégate', 'Récupération', 'Prototype de Destroyer', 'Prototype de Croiseur de classe Halcyon', 'Prototype de Croiseur de classe Marathon', 'Prototype de Porte-vaisseaux', 'Prototype de Super Porte-Vaisseaux', 'Prototype de Vaisseau d\'exfiltration de classe Black Cat', 'Prototype de Super canon à accélération magnétique', 'Bunker souterrain', 'Bunker souterrain', 'Bunker souterrain'), array('Expansion niveau 1', 'Expansion niveau 2', 'Expansion niveau 3', 'Expansion niveau 4', 'Expansion niveau 5', 'Expansion niveau 6', 'Expansion niveau 7', 'Expansion niveau 8', 'Expansion niveau 9', 'Expansion niveau 10', 'Expansion niveau 11', 'Expansion niveau 12', 'Expansion niveau 13', 'Expansion niveau 14', 'Expansion niveau 15', 'Expansion niveau 16', 'Expansion niveau 17', 'Expansion niveau 18') ); $technode = array( 'Le résultat absolu de l\'informatique. L\'IA ou Intelligence Artificielle est le résultat d\'années de travail acharné pour pouvoir en arriver à cette grande performance technique. Les IA sont des entités non biologiques dotées du pouvoir de la pensée. Développer cette technologie vous permettra non seulement de disposer d\'Intelligences Artificielles, mais de les rendre de plus en plus complexes, créatives et réactives.', @@ -232,8 +232,8 @@ if (!isset($auth_level)) @$auth_level = $sess->values['auth_level']; 'Les bases de données du CSNU enregistrent des informations de jours en jours. Toutefois il arrive que celles-ci parviennent à saturation et ne peuvent ainsi traiter qu\'un nombre limité d\'informations. Afin de résoudre ce problème, il est possible d\'améliorer la capacité de vos unités de stockage afin de gérer plus d\'informations. Chaque évolution de cette technologie vous permet de rajouter une unité supplémentaire dans votre file d\'attente.'); $technoli = array('IA4.jpg','radar7zr.jpg','arme.png','blindage.jpg','plasma4yl.jpg','reacteuracombustion.jpg','reacteurfusiontype1al5.jpg','reacteurfusiontype2nn6.jpg','medecin1.jpg','tactique.jpg','armuremc8ij.jpg','../humain_na.jpg'); - $nomvaisn = array('Cargos de classe Parabola', 'Cargos de classe Laden', 'Vaisseau de colonisation de classe Odyssey','Recycleur','Intercepteur Longsword', 'Bombardier Longsword', 'Corvette de classe Mako', 'Frégate', 'Croiseur de classe Halcyon', 'Croiseur de classe Marathon', 'Destroyer', 'Porte-vaisseaux', 'Super Porte-Vaisseaux', 'Vaisseau d\'exfiltration de classe Black Cat'); - $nomvaisi = array('csnucargoparabola2mc9.jpg','csnucargoladen2al8.jpg','colonisation.jpg','../humain_na.jpg','longsworduf9.jpg','../humain_na.jpg','../humain_na.jpg','frgatecopiegw1.jpg','halcyo15.jpg','qsu169.jpg','../humain_na.jpg','../humain_na.jpg','../humain_na.jpg','../humain_na.jpg','../humain_na.jpg','../humain_na.jpg'); + $nomvaisn = array('Cargos de classe Parabola', 'Cargos de classe Laden', 'Vaisseau de colonisation de classe Odyssey','Recycleur','Intercepteur Longsword', 'Bombardier Longsword', 'Corvette de classe Mako', 'Frégate', 'Destroyer', 'Croiseur de classe Halcyon', 'Croiseur de classe Marathon', 'Porte-vaisseaux', 'Super Porte-Vaisseaux', 'Vaisseau d\'exfiltration de classe Black Cat'); + $nomvaisi = array('csnucargoparabola2mc9.jpg','csnucargoladen2al8.jpg','colonisation.jpg','../humain_na.jpg','longsworduf9.jpg','../humain_na.jpg','../humain_na.jpg','frgatecopiegw1.jpg','../humain_na.jpg','halcyo15.jpg','qsu169.jpg','../humain_na.jpg','../humain_na.jpg','../humain_na.jpg','../humain_na.jpg','../humain_na.jpg'); $nomvaisd = array( 'Ces cargos de taille conséquente peuvent transporter assez de ressources et de nourriture pour nourrir une petite ville. Ils sont rapides, très manœuvrables mais peu résistants, ce qui est en fait des proies faciles pour les chasseurs ennemis.', 'Ces cargos de taille massive permettent le transport d\'une énorme quantité de ressources. Ils sont plus résistants que leurs homologues de classe Parabola, mais sont néanmoins les cibles prioritaires des chasseurs ennemis visant à faire le plus de pertes dans le camp adverse.', '~#DESCRIPTION MANQUANTE#~', @@ -248,7 +248,7 @@ if (!isset($auth_level)) @$auth_level = $sess->values['auth_level']; '~#DESCRIPTION MANQUANTE#~', '~#DESCRIPTION MANQUANTE#~', '~#DESCRIPTION MANQUANTE#~'); - $nomvaisa = array('cargos de classe Parabola','cargos de classe Laden','vaisseau(x) de colonisation de classe Odyssey','recycleur(s)','intercepteur(s) Longsword','bombardier(s) Longsword','corvette(s) de classe Mako','Frégates','croiseur(s) de classe Halcyon','croiseur(s) de classe Marathon','destroyer(s)','porte-vaisseaux','supers porte-vaisseaux','vaisseau(x) d\'exfiltration de classe Black Cat'); + $nomvaisa = array('cargos de classe Parabola','cargos de classe Laden','vaisseau(x) de colonisation de classe Odyssey','recycleur(s)','intercepteur(s) Longsword','bombardier(s) Longsword','corvette(s) de classe Mako','Frégates','destroyer(s)','croiseur(s) de classe Halcyon','croiseur(s) de classe Marathon','porte-vaisseaux','supers porte-vaisseaux','vaisseau(x) d\'exfiltration de classe Black Cat'); $nomterra = array( 'sparrowhawk','077-TC Pelican','C703 Shortsword Bomber','SHD Albatros','M12 LRV Warthogs','M12G1 LAAV Warthogs','M12A1 LAAV Warthogs','M808B Scorpions MBT', 'tourelle(s) légère(s) M202 XP','lance(s)-missiles Archer','canon(s) de défense automatique(s)','batterie(s) de missiles Anaconda','artillerie(s) lourde(s) de 440mm', 'silo(s) de missiles Shiva', 'canon(s) à accélération magnétique', 'super(s) canon à accélération magnétique'); diff --git a/game/tables.php b/game/tables.php index 74ed51f..e4172de 100644 --- a/game/tables.php +++ b/game/tables.php @@ -7,6 +7,7 @@ if ($config['db_type'] == "postgresql") { $table_alliances_creation = '"public"."'.$config['db_prefix'].'alliances_creation"'; $table_alliances_grade = '"public"."'.$config['db_prefix'].'alliances_grade"'; $table_bourse = '"public"."'.$config['db_prefix'].'bourse"'; + $table_bourse_ressources = '"public"."'.$config['db_prefix'].'bourse_ressources"'; $table_bug = '"public"."'.$config['db_prefix'].'bug"'; $table_classement = '"public"."'.$config['db_prefix'].'classement'.(floor((time()-$config['time_maintenance'])/86400)%2).'"'; $table_classement_alliances = '"public"."'.$config['db_prefix'].'classement_alliances'.(floor((time()-$config['time_maintenance'])/86400)%2).'"'; @@ -34,6 +35,7 @@ elseif ($config['db_type'] == "mysql") { $table_alliances_emprunt = $config['db_prefix'].'alliances_emprunt'; $table_alliances_grade = $config['db_prefix'].'alliances_grade'; $table_bourse = $config['db_prefix'].'bourse'; + $table_bourse_ressources = $config['db_prefix'].'bourse_ressources'; $table_bug = $config['db_prefix'].'bug'; $table_classement = $config['db_prefix'].'classement'.(floor((time()-$config['time_maintenance'])/86400)%2); $table_classement_alliances = $config['db_prefix'].'classement_alliances'.(floor((time()-$config['time_maintenance'])/86400)%2); diff --git a/game/vars.php b/game/vars.php index 1133563..38f7f91 100644 --- a/game/vars.php +++ b/game/vars.php @@ -123,73 +123,73 @@ array( ), 0 ); -$batimentVAR = array('mine_m','mine_c','mine_h','centrale_s','centrale_f','radar','labo','chantier_terrestre','chantier_spatial','caserne','silo','centre_info');//,'habitation','arcologie','commercial','loisir','administration'); +$batimentVAR = array('mine_m','mine_c','mine_h','centrale_s','centrale_f','radar','labo','chantier_terrestre','chantier_spatial','caserne','silo','centre_info','habitation','arcologies','bunker','commercial','loisir','administration'); $batimentCALC = array( array( '$a = ceil(pow(1.5,$n)*68);', '$b = ceil(pow(1.5,$n)*17);', '$c = 0;', - '$sec = (ceil(1.02*(3/(1+$planete->batiments[11]))*pow(1.5,$n))*(1/(1+$planete->casernes[7]*0.005)))*60;' + '$sec = pow(1.5,$n)*6;' ), array( '$a = ceil(pow(1.6,$n)*53);', '$b = ceil(pow(1.6,$n)*27);', '$c = 0;', - '$sec = (ceil(1.2*(3/(1+$planete->batiments[11]))*pow(1.55,$n))*(1/(1+$planete->casernes[7]*0.005)))*60;' + '$sec = pow(1.55,$n)*6;' ), array( '$a = ceil(pow(1.5,$n)*242);', '$b = ceil(pow(1.5,$n)*72);', '$c = 0;', - '$sec = (ceil(1.5*(3/(1+$planete->batiments[11]))*pow(1.624,$n))*(1/(1+$planete->casernes[7]*0.005)))*60;' + '$sec = pow(1.624,$n)*6;' ), array( '$a = ceil(pow(1.5,$n)*92);', '$b = ceil(pow(1.5,$n)*37);', '$c = 0;', - '$sec = (ceil(1.36*(3/(1+$planete->batiments[11]))*pow(1.597,$n))*(1/(1+$planete->casernes[7]*0.005)))*60;' + '$sec = pow(1.597,$n)*6;' ), array( '$a = ceil(pow(1.73,$n)*800);', '$b = ceil(pow(1.73,$n)*420);', '$c = ceil(pow(1.68,$n)*285);', - '$sec = (ceil(1.8*(3/(1+$planete->batiments[11]))*pow(1.7,$n))*(1/(1+$planete->casernes[7]*0.005)))*60;' + '$sec = pow(1.7,$n)*6;' ), array( '$a = ceil(pow(2,$planete->batiments[5])*750);', '$b = ceil(pow(2,$planete->batiments[5])*500);', '$c = 0;', - '$sec = ceil((pow(2,$planete->batiments[5])*720)/(pow(1.23,$planete->batiments[11])+0.0025*$planete->casernes[7]));' + '$sec = ceil(pow(2,$planete->batiments[5])*720);' ), array( '$a = ceil(pow(2,$planete->batiments[6])*200);', '$b = ceil(pow(2,$planete->batiments[6])*150);', '$c = 0;', - '$sec = ceil((pow(2,$planete->batiments[6])*720)/(pow(1.23,$planete->batiments[11])+0.0025*$planete->casernes[7]));' + '$sec = ceil(pow(2,$planete->batiments[6])*720);' ), array( '$a = ceil(pow(2,$planete->batiments[7])*520);', '$b = ceil(pow(2,$planete->batiments[7])*380);', '$c = 0;', - '$sec = ceil((pow(2,$planete->batiments[7])*420)/(pow(1.23,$planete->batiments[11])+0.0025*$planete->casernes[7]));' + '$sec = ceil(pow(2,$planete->batiments[7])*420);' ), array( '$a = ceil(pow(2,$planete->batiments[8])*600);', '$b = ceil(pow(2,$planete->batiments[8])*450);', '$c = 0;', - '$sec = ceil((pow(2,$planete->batiments[8])*600)/(pow(1.23,$planete->batiments[11])+0.0025*$planete->casernes[7]));' + '$sec = ceil(pow(2,$planete->batiments[8])*600);' ), array( '$a = ceil(pow(2,$planete->batiments[9])*200);', '$b = ceil(pow(2,$planete->batiments[9])*100);', '$c = 0;', - '$sec = ceil((pow(2,$planete->batiments[9])*300)/(pow(1.23,$planete->batiments[11])+0.0025*$planete->casernes[7]));' + '$sec = ceil(pow(2,$planete->batiments[9])*300);' ), array( '$a = ceil(pow(2,$planete->batiments[10])*400);', '$b = ceil(pow(2,$planete->batiments[10])*260);', '$c = 0;', - '$sec = ceil((pow(2,$planete->batiments[10])*1200)/(pow(1.23,$planete->batiments[11])+0.0025*$planete->casernes[7]));' + '$sec = ceil(pow(2,$planete->batiments[10])*1200);' ), array( '$a = ceil(pow(1.7,$planete->batiments[11])*600);', @@ -197,11 +197,43 @@ $batimentCALC = array( '$c = ceil(pow(1.7,$planete->batiments[11])*100);', '$sec = ceil((pow(1.9,$planete->batiments[11])*800)/((0.0025*$planete->casernes[7])+1));' ), - array(), - array(), - array(), - array(), - array() + //Module rsidentiel + array( + '$a = ceil(pow($planete->batiments[12],2.075)*1000+1500);', + '$b = ceil(pow($planete->batiments[12],1.8)*1000+1000);', + '$c = 0;', + '$sec = ceil(pow($planete->batiments[12],2.5)*60+4)*60;' + ), + array( + '$a = ceil(pow($planete->batiments[13],2.8)*1000+299000);', + '$b = ceil(pow($planete->batiments[13],2.5)*1000+149000);', + '$c = 0;', + '$sec = ceil(pow($planete->batiments[13],1.6)*60+60)*60;' + ), + array( + '$a = ceil(pow($planete->batiments[14],2)*1200+140000);', + '$b = ceil(pow($planete->batiments[14],2)*900+99000);', + '$c = ceil(pow($planete->batiments[14],2)*500+30000);', + '$sec = ceil(pow($planete->batiments[14],2)*5+3)*60;' + ), + array( + '$a = ceil(pow($planete->batiments[15],2)*1000+80000);', + '$b = ceil(pow($planete->batiments[15],2)*750+65000);', + '$c = 0;', + '$sec = pow($planete->batiments[15],2)*240;' + ), + array( + '$a = ceil(pow($planete->batiments[16],2)*850+60000);', + '$b = ceil(pow($planete->batiments[16],2)*650+50000);', + '$c = 0;', + '$sec = pow($planete->batiments[16],2)*180;' + ), + array( + '$a = ceil(pow($planete->batiments[17],2.5)*500 -300);', + '$b = ceil(pow($planete->batiments[17],2.4)*400-250);', + '$c = 0;', + '$sec = pow($planete->batiments[17],1.65)*3600;' + ) ); $batimentTECH = array( 0, @@ -225,8 +257,12 @@ $batimentTECH = array( array($technolo[1][12], 'techno_inge', 4096) ), 0, + 0, array( - array($technolo[3][8], 'techno_poli', 256) + array($technolo[7][12], 'techno_proj', 4096) + ), + array( + array($technolo[7][11], 'techno_proj', 2048) ), array( array($technolo[3][6], 'techno_poli', 64) diff --git a/halo-battle/.buildpath b/halo-battle/.buildpath new file mode 100644 index 0000000..9ce47f1 --- /dev/null +++ b/halo-battle/.buildpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/halo-battle/.project b/halo-battle/.project new file mode 100644 index 0000000..8d72b93 --- /dev/null +++ b/halo-battle/.project @@ -0,0 +1,28 @@ + + + Halo-Battle + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.dltk.core.scriptbuilder + + + + + + org.eclipse.php.core.PHPNature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/htdocs/.htaccess b/htdocs/.htaccess index e69de29..095d346 100644 --- a/htdocs/.htaccess +++ b/htdocs/.htaccess @@ -0,0 +1,7 @@ +Options -Indexes +ErrorDocument 403 403.html +ErrorDocument 404 404.html + + + + diff --git a/htdocs/.onyx b/htdocs/.onyx index cbfc0f6..df5cc17 100644 --- a/htdocs/.onyx +++ b/htdocs/.onyx @@ -1 +1 @@ -C:/Program Files/xampp/var/HB_new/onyx/ \ No newline at end of file +/var/www/halo-battle/onyx2/load.php diff --git a/htdocs/admin.php b/htdocs/admin.php index 9209420..7c6f5fb 100644 --- a/htdocs/admin.php +++ b/htdocs/admin.php @@ -1,92 +1,108 @@ values['connected']) && $sess->values['connected'] && !empty($sess->values['id']) && !empty($sess->level) && $sess->level >= 3 && !empty($sess->values['idPlan']) && $sess->values['id'] != "172") { - function infoPlan($galaxie, $ss, $pos, $info){ - $base = new bdd(); - $base->connexion(); - $resultat = $base->unique_query("SELECT * FROM planete WHERE galaxie = '$galaxie' AND ss = '$ss' AND position= '$pos';"); - $base->deconnexion(); - return $resultat[$info]; - } - - //Connexion à la base de données - $chapeau = new bdd(); - $chapeau->connexion(); - - //Passage des valeurs générales au template - $titre = "Administration"; - $template->assign('page','admin'); - $template->assign('premiere_page', $config['first_page']); - - $chapeau->unique_query("SELECT * FROM $table_user WHERE race = 'covenant'"); - $nbcovie = $chapeau->num_rows; - $chapeau->unique_query("SELECT * FROM $table_user WHERE race = 'humain'"); - $nbhumain = $chapeau->num_rows; - $template->assign('count',array('humains' => $nbhumain, 'covenants' => $nbcovie, 'serveurs' => 'cette')); - - $id_user = $sess->values['id']; - $queryUser = $chapeau->unique_query("SELECT * FROM $table_user WHERE id = '$id_user'"); - $chapeau->deconnexion(); - - $race = $queryUser['race']; - $template->assign('race',$queryUser['race']); - $template->assign('user',$queryUser); - $tpsdejeu = time() - $queryUser['last_visite']; - $heur = floor($tpsdejeu/3600); - $min = floor(($tpsdejeu - $heur*3600)/60); - if ($heur > 0) $min = $heur.' h '.$min; - $template->assign('tpsdejeu',$min.' min'); - - if (!empty($sess->values['souscontrole'])) { - $pagea = 'erreur'; - - $sess->values['id'] = $sess->values['souscontrole'][0]; - $sess->values['idPlan'] = $sess->values['souscontrole'][1]; - $sess->values['souscontrole'] = null; - $sess->put(); - - $template->assign('message', 'Droits rétablis avec succès !
          '); - } - else { - if (!isset($_GET['p'])) $_GET['p'] = ''; - if ($sess->level >= 5) { - switch($_GET['p']){ - case 'djoueurs': include(_FCORE."../game/jeu/admin/supprimer_joueur.php"); break; - case 'bandeau': include(_FCORE."../game/jeu/admin/bandeau.php"); break; - case 'demarrage': include(_FCORE."../game/jeu/admin/demarrage.php"); break; - case 'version': include(_FCORE."../game/jeu/admin/version.php"); break; - case 'inscription': include(_FCORE."../game/jeu/admin/inscription.php"); break; +if (isset($SESS) && isset($SESS->values['connected']) && $SESS->values['connected'] && !empty($SESS->values['id']) && !empty($SESS->level) && $SESS->level >= 3 && !empty($SESS->values['idPlan'])) + { + function infoPlan($galaxie, $ss, $pos, $info) + { + $base = new BDD(); + $resultat = $base->unique_query("SELECT * FROM planete WHERE galaxie = '$galaxie' AND ss = '$ss' AND position= '$pos';"); + $base->deconnexion(); + return $resultat[$info]; } - } - if (empty($pagea)) { - switch($_GET['p']){ - case 'courrier': include(_FCORE."../game/jeu/admin/mail.php"); break; - case 'vip': include(_FCORE."../game/jeu/admin/ip.php"); break; - case 'vflotte': include(_FCORE."../game/jeu/admin/flottes.php"); break; - case 'vplanetes': include(_FCORE."../game/jeu/admin/planete.php"); break; - case 'vjoueurs': include(_FCORE."../game/jeu/admin/joueur.php"); break; - case 'valliances': include(_FCORE."../game/jeu/admin/alliance.php"); break; - case 'vrapports': include(_FCORE."../game/jeu/admin/rapport.php"); break; - case 'sjoueurs': include(_FCORE."../game/jeu/admin/sanction_joueur.php"); break; - case 'cjoueurs': include(_FCORE."../game/jeu/admin/prendre_controle.php"); break; - default: include(_FCORE."../game/jeu/admin/accueil.php"); break; + + //Passage des valeurs générales au template + $titre = "Administration"; + $template->assign('page', 'admin'); + $template->assign('menu', $VAR['menu']); + $template->assign('premiere_page', $VAR['first_page']); + $template->assign('race', $SESS->values['race']); + $template->assign("tpsdejeu", "un certain temps"); + + if (!empty($SESS->values['souscontrole'])) + { + $pagea = 'erreur'; + + $SESS->values['id'] = $SESS->values['souscontrole'][0]; + $SESS->values['idPlan'] = $SESS->values['souscontrole'][1]; + $SESS->values['souscontrole'] = null; + $SESS->put(); + + $template->assign('message', 'Droits rétablis avec succès !
          '); } - } + else + { + if (!isset($_GET['p'])) + $_GET['p'] = ''; + if ($SESS->level >= 5) + { + switch($_GET['p']) + { + case 'djoueurs': + include("admin/supprimer_joueur.php"); + break; + case 'bandeau': + include("admin/bandeau.php"); + break; + case 'demarrage': + include("admin/demarrage.php"); + break; + case 'version': + include("admin/version.php"); + break; + case 'inscription': + include("admin/inscription.php"); + break; + } + } + if (empty($pagea)) + { + switch($_GET['p']) + { + case 'courrier': + include("admin/mail.php"); + break; + case 'vip': + include("admin/ip.php"); + break; + case 'vflottes': + include("admin/flottes.php"); + break; + case 'vplanetes': + include("admin/planete.php"); + break; + case 'vjoueurs': + include("admin/joueur.php"); + break; + case 'valliances': + include("admin/alliance.php"); + break; + case 'vrapports': + include("admin/rapport.php"); + break; + case 'sjoueurs': + include("admin/sanction_joueur.php"); + break; + case 'cjoueurs': + include("admin/prendre_controle.php"); + break; + default: + include("admin/accueil.php"); + break; + } + } + } + + $template->assign('titre', $titre); + $template->assign('pagea', $pagea); + $template->display('admin/'.$pagea.'.tpl'); } - - $template->assign('titre',$titre); - $template->assign('pagea',$pagea); - $template->display('admin/'.$pagea.'.tpl'); -} -else header('Location: index.php'); -?> \ No newline at end of file +else + header('Location: '.$VAR['first_page']); +?> diff --git a/htdocs/ajax_flotte.php b/htdocs/ajax_flotte.php index 5063341..49d84f1 100644 --- a/htdocs/ajax_flotte.php +++ b/htdocs/ajax_flotte.php @@ -3,7 +3,7 @@ define("INDEX", 1); $chrono_start = microtime(); $onyx = @file_get_contents('./.onyx') or die("Configuration introuvable."); define("_FCORE",trim($onyx)); -require(_FCORE."hb_game/Class/JSON.php"); +require(_FCORE."../game/Class/JSON.php"); require_once(_FCORE."common.php"); if (isset($sess) && isset($sess->values['connected']) && $sess->values['connected'] && !empty($sess->values['id']) && !empty($sess->level) && !empty($sess->values['idPlan'])) { @@ -47,6 +47,8 @@ if (isset($sess) && isset($sess->values['connected']) && $sess->values['connecte if (!empty($sess->values['flcontenu']) && $met+$cri+$hyd >= 0 && $met >= 0 && $cri >= 0 && $hyd >= 0) $places = $sess->values['flcontenu'] - ($met+$cri+$hyd); else $places = 'inconnu'; + + if (empty($sess->values['fltime']) || $sess->values['fltime'] + 600 < time() || empty($sess->values['flnbvais']) || empty($sess->values['flvitesse']) && isset($sess->values['auth_level'])) $datas = array( 'root' => array( diff --git a/htdocs/arbre.php b/htdocs/arbre.php new file mode 100644 index 0000000..75c4e98 --- /dev/null +++ b/htdocs/arbre.php @@ -0,0 +1,41 @@ + $branche) + { + print "

          Branche : ".$technologiesVAR[$keyB]."

          "; + foreach($branche as $keyT => $tech) + { + print $tech[0].' : '.$technolo[$keyB][$keyT]."
          "; + if ($tech[1] > 0) + { + print 'Requiert :'; + foreach($branche as $keyR => $req) + { + if ($req[0]&$tech[1]) + print ' '.$technolo[$keyB][$keyR].','; + } + print '
          '; + } + else + { + print 'Ne requiert aucune technologie
          '; + $tree[] = array($tech); + } + print "
          "; + } + } + +echo("\n"); +?> \ No newline at end of file diff --git a/htdocs/bourser.php b/htdocs/bourser.php new file mode 100644 index 0000000..7f614c9 --- /dev/null +++ b/htdocs/bourser.php @@ -0,0 +1,100 @@ +values['race'])) $race = $sess->values['race']; +else $race = gpc('r'); + +$bdd = new BDD(); +$act = $bdd->unique_query("SELECT id, graph, dispo FROM $table_bourse_ressources WHERE id = $action;"); +$bdd->deconnexion(); +if (empty($act)) exit; + +$values = array(); +$values_label = array(); +$values_abscisse = array(); + +$act['graph'] = unserialize($act['graph']); + +for($i = 1; $i < 8; $i++){ + if (!isset($act['graph'][(date('w')+$i)%7])) $values[] = 0; + else $values[] = ceil(pow($act['graph'][(date('w')+$i)%7], -0.1) * 2000)/10; +} + +for($i = 6; $i >= 0; $i--){ + $values_label[] = $values[$i]; + $values_abscisse[] = ucfirst(strftime('%a', time() - 86400 * $i)); +} + +//* +require_once ("jpgraph/jpgraph.php"); +require_once ("jpgraph/jpgraph_line.php"); + +if ($race != "humain" && $race != "covenant") $race = "humain"; + +$graph = new Graph(282, 200); +$graph->SetScale("textlin"); +$graph->img->SetMargin(40,20,20,40); + +$lineplot=new LinePlot($values); +$lineplot->mark->SetType(MARK_UTRIANGLE); +$lineplot->value->show(); +$lineplot->value->SetFont(FF_FONT1,FS_BOLD); +//$lineplot->value->SetFormat('%0f'); + +//Définition des couleurs +$graph->SetBackgroundImage(ONYX."include/content/bourse/".$race.".png", BGIMG_COPY); +if ($race == "covenant") { + $graph->yaxis->SetColor("#FFFFFF"); + $graph->xaxis->SetColor("white"); + $lineplot->SetFillColor("pink@0.8"); + $lineplot->value->SetColor('#FF0000'); + $graph->yaxis->title->SetColor("white"); + $graph->title->SetColor("white"); + $lineplot->SetColor("#c00000"); +} +else { + $graph->yaxis->SetColor("#00DD00"); + $lineplot->SetFillColor("cyan@0.8"); + $lineplot->value->SetColor('#FF0000'); + $graph->yaxis->title->SetColor("white"); + $graph->title->SetColor("white"); + $lineplot->SetColor("#3bb3ff"); +} + +$act['nom'] = nomR($act['id'], $race); + +$graph->Add($lineplot); +$graph->title->Set($act['nom']); +$graph->yaxis->title->Set("Evolution (%)"); +$graph->xaxis->SetTickLabels($values_abscisse); + +$graph->title->SetFont(FF_FONT1,FS_BOLD); +$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); +$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); + +$lineplot->SetWeight(2); + +$graph->Stroke(); +?> \ No newline at end of file diff --git a/htdocs/checkSum.php b/htdocs/checkSum.php new file mode 100644 index 0000000..476faea --- /dev/null +++ b/htdocs/checkSum.php @@ -0,0 +1 @@ +daecac3a14e7dc10e2bdd6f2d1eb82476e94cc12 \ No newline at end of file diff --git a/htdocs/export.php b/htdocs/export.php new file mode 100644 index 0000000..cef9ba1 --- /dev/null +++ b/htdocs/export.php @@ -0,0 +1,30 @@ +'."\n"; +foreach($nomterde as $key => $lign) + { + print "\t".''.utf8_encode(html_entity_decode($lign)).''."\n"; + } +print ''; +*/ + +print ''."\n"; +foreach ($technolo as $i => $var) + { + /*print "\t".''."\n"; + foreach ($var as $k => $key) + {*/ + print "\t\t".''.utf8_encode(html_entity_decode($var)).''."\n"; + /*} + print "\t\n";*/ + } +print ''; +?> \ No newline at end of file diff --git a/htdocs/genereXML.php b/htdocs/genereXML.php new file mode 100644 index 0000000..3a8ddc3 --- /dev/null +++ b/htdocs/genereXML.php @@ -0,0 +1,31 @@ +load("/var/www/halo-battle/onyx2/config/root.xml"); + +$xml->formatOutput = true; + +$xml_configs = $xml->createElement("configs"); +$xml_configs->setAttribute("active", true); +$xml_configs->setAttribute("root", __DIR__.'/'); +$xml_configs->setAttribute("cache", true); + +$xml_config = $xml->createElement("config"); +$xml_config->setAttribute("match", '*'); + + $xml_var = $xml->createElement("var", "Béta #1"); + $xml_var->setAttribute("name", 'serveur_name'); + $xml_config->appendChild($xml_var); + + $xml_var = $xml->createElement("var", "Béta #1"); + $xml_var->setAttribute("name", 'serveur_name'); + $xml_config->appendChild($xml_var); + +$xml_configs->appendChild($xml_config); +$xml->appendChild($xml_configs); + +print $xml->saveXML(); +?> \ No newline at end of file diff --git a/htdocs/images/Thumbs.db b/htdocs/images/Thumbs.db new file mode 100644 index 0000000..386e836 Binary files /dev/null and b/htdocs/images/Thumbs.db differ diff --git a/htdocs/images/planetes/.svn/entries b/htdocs/images/planetes/.svn/entries new file mode 100644 index 0000000..4f03eb8 --- /dev/null +++ b/htdocs/images/planetes/.svn/entries @@ -0,0 +1,1150 @@ +9 + +dir +1 +svn://62.4.71.11/HB/htdocs/images/planetes +svn://62.4.71.11/HB + + + +2008-12-19T20:29:56.685768Z +1 +phantomas + + +svn:special svn:externals svn:needs-lock + + + + + + + + + + + +c4074411-828d-4616-b685-8e0a798490ab + +20.jpg +file + + + + +2008-12-13T11:41:11.671875Z +0ac7a55057b3f1a8aa075099c3cbc540 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +80660 + +21.jpg +file + + + + +2008-12-13T11:41:19.453125Z +7c77e1a690412c00223c8c05169feed0 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +69127 + +22.jpg +file + + + + +2008-12-13T11:41:30.015625Z +8b73f215f103abd29730f45201d9cfab +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +84317 + +23.jpg +file + + + + +2008-12-13T11:41:33.203125Z +296e90d7641b90dfdc23e1a760c23a0d +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +89378 + +24.jpg +file + + + + +2008-12-13T11:41:37.140625Z +c8a9cf25e55ff6fa479e54b9662c1681 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +84163 + +25.jpg +file + + + + +2008-12-13T11:41:40.656250Z +f76e57fa1b9b96ac598e3fedd2913ca6 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +69846 + +26.jpg +file + + + + +2008-12-13T11:41:44.093750Z +0beadd17b464bcc9161b8bc977dc89e8 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +86555 + +27.jpg +file + + + + +2008-12-13T11:41:47.093750Z +8257f990692becff4d25427f914bf336 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +79842 + +28.jpg +file + + + + +2008-12-13T11:41:50.593750Z +36c1311a5f22fafd661d2ae27fca96e5 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +72590 + +29.jpg +file + + + + +2008-12-13T11:41:53.625000Z +a9a91442f43efdf6e2c8417a31428ba7 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +74286 + +1.jpg +file + + + + +2008-08-27T16:43:00.000000Z +3ba4923084e9040c2e2bd54c920715ab +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +74241 + +2.jpg +file + + + + +2008-08-27T17:52:00.000000Z +f8fb74557c20d759f8834fc1219a7605 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +97271 + +3.jpg +file + + + + +2008-08-27T18:54:00.000000Z +06e9e3bb26df490c522ab2db49dbf8ca +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +67797 + +4.jpg +file + + + + +2008-08-28T15:50:00.000000Z +a4b3d8f33d392338011bff6ca77061e1 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +56501 + +5.jpg +file + + + + +2008-08-28T15:13:00.000000Z +aee558353ad2393617cd09cf8c67202c +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +79452 + +6.jpg +file + + + + +2008-08-28T16:05:00.000000Z +b9ee85c36a3aa62785d7127cfac8c294 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +62795 + +7.jpg +file + + + + +2008-08-28T16:23:00.000000Z +5db5d98b395c28e717f2567386fab490 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +66962 + +8.jpg +file + + + + +2008-08-29T10:41:00.000000Z +7de9677ebc40dd51d9179b8c36ee78c4 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +76596 + +9.jpg +file + + + + +2008-08-29T11:18:00.000000Z +61532aa2a8b517fa9df6ac2707980338 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +75658 + +10.jpg +file + + + + +2008-08-29T11:35:00.000000Z +22ebdc8c551e5d79548d1028c32524e2 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +73888 + +11.jpg +file + + + + +2008-08-29T11:49:00.000000Z +431a472d4be8b6713858585bea7f2c3d +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +63044 + +30.jpg +file + + + + +2008-12-13T11:41:56.531250Z +00567e47e3659bd3c070954b014f3246 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +79404 + +12.jpg +file + + + + +2008-08-29T12:13:00.000000Z +146763c6bfcc0bd8d197ebc56639a0af +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +71705 + +31.jpg +file + + + + +2008-12-13T11:41:59.984375Z +4b8fc851e3c2eb3b00f04ff4c953bbb2 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +78835 + +13.jpg +file + + + + +2008-08-29T16:01:00.000000Z +0f9e5eb0d0f17a0e4ed74c1a2c253aec +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +80298 + +32.jpg +file + + + + +2008-12-13T11:42:07.359375Z +adc4f77ea2c9b73ce03b5a60214abf58 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +88743 + +14.jpg +file + + + + +2008-08-29T16:13:00.000000Z +90453b4545277dd7db61e2d617a49bff +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +64246 + +15.jpg +file + + + + +2008-09-05T16:23:00.000000Z +1a362541b859f7160faed5312a48074d +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +71535 + +16.jpg +file + + + + +2008-08-29T16:48:00.000000Z +2047063fd7322cae44ef4f2db4b6120c +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +71801 + +17.jpg +file + + + + +2008-08-29T17:02:00.000000Z +d4097ef2aad23531c75eb6ae50bd8b96 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +85000 + +18.jpg +file + + + + +2008-08-30T10:41:00.000000Z +f5b4164bd7db3ff5549a32abc0fbb736 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +83792 + +19.jpg +file + + + + +2008-08-30T11:14:00.000000Z +2e7aa2afa48ce7d9fa945cc77e4e1738 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +70526 + +index.html +file + + + + +2008-07-13T09:32:24.614375Z +aa368d44f02d0b27c149a42e250cd0e8 +2008-12-19T20:29:56.685768Z +1 +phantomas + + + + + + + + + + + + + + + + + + + + + +1345 + diff --git a/htdocs/images/planetes/.svn/format b/htdocs/images/planetes/.svn/format new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/htdocs/images/planetes/.svn/format @@ -0,0 +1 @@ +9 diff --git a/htdocs/images/planetes/.svn/prop-base/1.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/1.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/1.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/10.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/10.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/10.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/11.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/11.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/11.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/12.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/12.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/12.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/13.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/13.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/13.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/14.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/14.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/14.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/15.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/15.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/15.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/16.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/16.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/16.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/17.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/17.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/17.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/18.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/18.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/18.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/19.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/19.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/19.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/2.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/2.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/2.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/20.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/20.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/20.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/21.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/21.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/21.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/22.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/22.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/22.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/23.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/23.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/23.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/24.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/24.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/24.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/25.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/25.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/25.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/26.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/26.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/26.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/27.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/27.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/27.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/28.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/28.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/28.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/29.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/29.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/29.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/3.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/3.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/3.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/30.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/30.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/30.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/31.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/31.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/31.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/32.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/32.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/32.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/4.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/4.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/4.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/5.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/5.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/5.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/6.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/6.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/6.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/7.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/7.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/7.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/8.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/8.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/8.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/prop-base/9.jpg.svn-base b/htdocs/images/planetes/.svn/prop-base/9.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetes/.svn/prop-base/9.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetes/.svn/text-base/1.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/1.jpg.svn-base new file mode 100644 index 0000000..282fcde Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/1.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/10.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/10.jpg.svn-base new file mode 100644 index 0000000..84e2412 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/10.jpg.svn-base differ diff --git a/htdocs/images/planetes/11.JPG b/htdocs/images/planetes/.svn/text-base/11.jpg.svn-base similarity index 100% rename from htdocs/images/planetes/11.JPG rename to htdocs/images/planetes/.svn/text-base/11.jpg.svn-base diff --git a/htdocs/images/planetes/.svn/text-base/12.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/12.jpg.svn-base new file mode 100644 index 0000000..416508d Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/12.jpg.svn-base differ diff --git a/htdocs/images/planetes/13.JPG b/htdocs/images/planetes/.svn/text-base/13.jpg.svn-base similarity index 100% rename from htdocs/images/planetes/13.JPG rename to htdocs/images/planetes/.svn/text-base/13.jpg.svn-base diff --git a/htdocs/images/planetes/.svn/text-base/14.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/14.jpg.svn-base new file mode 100644 index 0000000..bac8568 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/14.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/15.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/15.jpg.svn-base new file mode 100644 index 0000000..d9f82a7 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/15.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/16.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/16.jpg.svn-base new file mode 100644 index 0000000..305d244 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/16.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/17.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/17.jpg.svn-base new file mode 100644 index 0000000..ab33da0 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/17.jpg.svn-base differ diff --git a/htdocs/images/planetes/18.JPG b/htdocs/images/planetes/.svn/text-base/18.jpg.svn-base similarity index 100% rename from htdocs/images/planetes/18.JPG rename to htdocs/images/planetes/.svn/text-base/18.jpg.svn-base diff --git a/htdocs/images/planetes/.svn/text-base/19.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/19.jpg.svn-base new file mode 100644 index 0000000..6885bf2 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/19.jpg.svn-base differ diff --git a/htdocs/images/planetes/2.JPG b/htdocs/images/planetes/.svn/text-base/2.jpg.svn-base similarity index 100% rename from htdocs/images/planetes/2.JPG rename to htdocs/images/planetes/.svn/text-base/2.jpg.svn-base diff --git a/htdocs/images/planetes/.svn/text-base/20.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/20.jpg.svn-base new file mode 100644 index 0000000..19bc5fb Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/20.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/21.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/21.jpg.svn-base new file mode 100644 index 0000000..6c584d4 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/21.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/22.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/22.jpg.svn-base new file mode 100644 index 0000000..a318072 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/22.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/23.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/23.jpg.svn-base new file mode 100644 index 0000000..2418250 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/23.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/24.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/24.jpg.svn-base new file mode 100644 index 0000000..3f851a5 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/24.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/25.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/25.jpg.svn-base new file mode 100644 index 0000000..8ff95dc Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/25.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/26.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/26.jpg.svn-base new file mode 100644 index 0000000..d184eea Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/26.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/27.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/27.jpg.svn-base new file mode 100644 index 0000000..df15458 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/27.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/28.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/28.jpg.svn-base new file mode 100644 index 0000000..2b2dd3b Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/28.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/29.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/29.jpg.svn-base new file mode 100644 index 0000000..c92e144 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/29.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/3.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/3.jpg.svn-base new file mode 100644 index 0000000..a1c898a Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/3.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/30.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/30.jpg.svn-base new file mode 100644 index 0000000..6b9f9a1 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/30.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/31.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/31.jpg.svn-base new file mode 100644 index 0000000..471a2bc Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/31.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/32.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/32.jpg.svn-base new file mode 100644 index 0000000..fe7e629 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/32.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/4.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/4.jpg.svn-base new file mode 100644 index 0000000..391ed50 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/4.jpg.svn-base differ diff --git a/htdocs/images/planetes/5.JPG b/htdocs/images/planetes/.svn/text-base/5.jpg.svn-base similarity index 100% rename from htdocs/images/planetes/5.JPG rename to htdocs/images/planetes/.svn/text-base/5.jpg.svn-base diff --git a/htdocs/images/planetes/.svn/text-base/6.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/6.jpg.svn-base new file mode 100644 index 0000000..39d266a Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/6.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/7.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/7.jpg.svn-base new file mode 100644 index 0000000..2cf0298 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/7.jpg.svn-base differ diff --git a/htdocs/images/planetes/.svn/text-base/8.jpg.svn-base b/htdocs/images/planetes/.svn/text-base/8.jpg.svn-base new file mode 100644 index 0000000..e2f7df0 Binary files /dev/null and b/htdocs/images/planetes/.svn/text-base/8.jpg.svn-base differ diff --git a/htdocs/images/planetes/9.JPG b/htdocs/images/planetes/.svn/text-base/9.jpg.svn-base similarity index 100% rename from htdocs/images/planetes/9.JPG rename to htdocs/images/planetes/.svn/text-base/9.jpg.svn-base diff --git a/htdocs/images/planetes/.svn/text-base/index.html.svn-base b/htdocs/images/planetes/.svn/text-base/index.html.svn-base new file mode 100644 index 0000000..ce7b5d4 --- /dev/null +++ b/htdocs/images/planetes/.svn/text-base/index.html.svn-base @@ -0,0 +1,77 @@ + + + + + + + ::Halo-Battle:: - Erreur + + + +
          +

          Erreur

          +

          403

          +

          Refus de traitement de la requête.
          Forbidden.

          +
          +HALO-BATTLE + + + \ No newline at end of file diff --git a/htdocs/images/planetes/11.jpg b/htdocs/images/planetes/11.jpg new file mode 100644 index 0000000..6435940 Binary files /dev/null and b/htdocs/images/planetes/11.jpg differ diff --git a/htdocs/images/planetes/13.jpg b/htdocs/images/planetes/13.jpg new file mode 100644 index 0000000..6861c8d Binary files /dev/null and b/htdocs/images/planetes/13.jpg differ diff --git a/htdocs/images/planetes/18.jpg b/htdocs/images/planetes/18.jpg new file mode 100644 index 0000000..1e2e208 Binary files /dev/null and b/htdocs/images/planetes/18.jpg differ diff --git a/htdocs/images/planetes/2.jpg b/htdocs/images/planetes/2.jpg new file mode 100644 index 0000000..cd05f75 Binary files /dev/null and b/htdocs/images/planetes/2.jpg differ diff --git a/htdocs/images/planetes/20.jpg b/htdocs/images/planetes/20.jpg new file mode 100644 index 0000000..19bc5fb Binary files /dev/null and b/htdocs/images/planetes/20.jpg differ diff --git a/htdocs/images/planetes/21.jpg b/htdocs/images/planetes/21.jpg new file mode 100644 index 0000000..6c584d4 Binary files /dev/null and b/htdocs/images/planetes/21.jpg differ diff --git a/htdocs/images/planetes/22.jpg b/htdocs/images/planetes/22.jpg new file mode 100644 index 0000000..a318072 Binary files /dev/null and b/htdocs/images/planetes/22.jpg differ diff --git a/htdocs/images/planetes/23.jpg b/htdocs/images/planetes/23.jpg new file mode 100644 index 0000000..2418250 Binary files /dev/null and b/htdocs/images/planetes/23.jpg differ diff --git a/htdocs/images/planetes/24.jpg b/htdocs/images/planetes/24.jpg new file mode 100644 index 0000000..3f851a5 Binary files /dev/null and b/htdocs/images/planetes/24.jpg differ diff --git a/htdocs/images/planetes/25.jpg b/htdocs/images/planetes/25.jpg new file mode 100644 index 0000000..8ff95dc Binary files /dev/null and b/htdocs/images/planetes/25.jpg differ diff --git a/htdocs/images/planetes/26.jpg b/htdocs/images/planetes/26.jpg new file mode 100644 index 0000000..d184eea Binary files /dev/null and b/htdocs/images/planetes/26.jpg differ diff --git a/htdocs/images/planetes/27.jpg b/htdocs/images/planetes/27.jpg new file mode 100644 index 0000000..df15458 Binary files /dev/null and b/htdocs/images/planetes/27.jpg differ diff --git a/htdocs/images/planetes/28.jpg b/htdocs/images/planetes/28.jpg new file mode 100644 index 0000000..2b2dd3b Binary files /dev/null and b/htdocs/images/planetes/28.jpg differ diff --git a/htdocs/images/planetes/29.jpg b/htdocs/images/planetes/29.jpg new file mode 100644 index 0000000..c92e144 Binary files /dev/null and b/htdocs/images/planetes/29.jpg differ diff --git a/htdocs/images/planetes/30.jpg b/htdocs/images/planetes/30.jpg new file mode 100644 index 0000000..6b9f9a1 Binary files /dev/null and b/htdocs/images/planetes/30.jpg differ diff --git a/htdocs/images/planetes/31.jpg b/htdocs/images/planetes/31.jpg new file mode 100644 index 0000000..471a2bc Binary files /dev/null and b/htdocs/images/planetes/31.jpg differ diff --git a/htdocs/images/planetes/32.jpg b/htdocs/images/planetes/32.jpg new file mode 100644 index 0000000..fe7e629 Binary files /dev/null and b/htdocs/images/planetes/32.jpg differ diff --git a/htdocs/images/planetes/5.jpg b/htdocs/images/planetes/5.jpg new file mode 100644 index 0000000..353f705 Binary files /dev/null and b/htdocs/images/planetes/5.jpg differ diff --git a/htdocs/images/planetes/9.jpg b/htdocs/images/planetes/9.jpg new file mode 100644 index 0000000..331e188 Binary files /dev/null and b/htdocs/images/planetes/9.jpg differ diff --git a/htdocs/images/planetes/Thumbs.db b/htdocs/images/planetes/Thumbs.db deleted file mode 100644 index 6be3f30..0000000 Binary files a/htdocs/images/planetes/Thumbs.db and /dev/null differ diff --git a/htdocs/images/planetes/index.html b/htdocs/images/planetes/index.html new file mode 100644 index 0000000..ce7b5d4 --- /dev/null +++ b/htdocs/images/planetes/index.html @@ -0,0 +1,77 @@ + + + + + + + ::Halo-Battle:: - Erreur + + + +
          +

          Erreur

          +

          403

          +

          Refus de traitement de la requête.
          Forbidden.

          +
          +HALO-BATTLE + + + \ No newline at end of file diff --git a/htdocs/images/planetesANC/.svn/entries b/htdocs/images/planetesANC/.svn/entries new file mode 100644 index 0000000..f5c5cb2 --- /dev/null +++ b/htdocs/images/planetesANC/.svn/entries @@ -0,0 +1,1184 @@ +9 + +dir +1 +svn://62.4.71.11/HB/htdocs/images/planetesANC +svn://62.4.71.11/HB + + + +2008-12-19T20:29:56.685768Z +1 +phantomas + + +svn:special svn:externals svn:needs-lock + + + + + + + + + + + +c4074411-828d-4616-b685-8e0a798490ab + +20.jpg +file + + + + +2008-12-13T11:41:11.671875Z +0ac7a55057b3f1a8aa075099c3cbc540 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +80660 + +21.jpg +file + + + + +2008-12-13T11:41:19.453125Z +7c77e1a690412c00223c8c05169feed0 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +69127 + +22.jpg +file + + + + +2008-12-13T11:41:30.015625Z +8b73f215f103abd29730f45201d9cfab +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +84317 + +23.jpg +file + + + + +2008-12-13T11:41:33.203125Z +296e90d7641b90dfdc23e1a760c23a0d +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +89378 + +24.jpg +file + + + + +2008-12-13T11:41:37.140625Z +c8a9cf25e55ff6fa479e54b9662c1681 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +84163 + +25.jpg +file + + + + +2008-12-13T11:41:40.656250Z +f76e57fa1b9b96ac598e3fedd2913ca6 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +69846 + +26.jpg +file + + + + +2008-12-13T11:41:44.093750Z +0beadd17b464bcc9161b8bc977dc89e8 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +86555 + +27.jpg +file + + + + +2008-12-13T11:41:47.093750Z +8257f990692becff4d25427f914bf336 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +79842 + +28.jpg +file + + + + +2008-12-13T11:41:50.593750Z +36c1311a5f22fafd661d2ae27fca96e5 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +72590 + +29.jpg +file + + + + +2008-12-13T11:41:53.625000Z +a9a91442f43efdf6e2c8417a31428ba7 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +74286 + +1.jpg +file + + + + +2008-08-27T16:43:00.000000Z +3ba4923084e9040c2e2bd54c920715ab +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +74241 + +2.jpg +file + + + + +2008-08-27T17:52:00.000000Z +f8fb74557c20d759f8834fc1219a7605 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +97271 + +3.jpg +file + + + + +2008-08-27T18:54:00.000000Z +06e9e3bb26df490c522ab2db49dbf8ca +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +67797 + +4.jpg +file + + + + +2008-08-28T15:50:00.000000Z +a4b3d8f33d392338011bff6ca77061e1 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +56501 + +5.jpg +file + + + + +2008-08-28T15:13:00.000000Z +aee558353ad2393617cd09cf8c67202c +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +79452 + +6.jpg +file + + + + +2008-08-28T16:05:00.000000Z +b9ee85c36a3aa62785d7127cfac8c294 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +62795 + +7.jpg +file + + + + +2008-08-28T16:23:00.000000Z +5db5d98b395c28e717f2567386fab490 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +66962 + +8.jpg +file + + + + +2008-08-29T10:41:00.000000Z +7de9677ebc40dd51d9179b8c36ee78c4 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +76596 + +Thumbs.db +file + + + + +2008-11-28T22:11:34.515000Z +eeee554242da2df6b026729ebc7e7bd9 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +8192 + +9.jpg +file + + + + +2008-08-29T11:18:00.000000Z +61532aa2a8b517fa9df6ac2707980338 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +75658 + +10.jpg +file + + + + +2008-08-29T11:35:00.000000Z +22ebdc8c551e5d79548d1028c32524e2 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +73888 + +11.jpg +file + + + + +2008-08-29T11:49:00.000000Z +431a472d4be8b6713858585bea7f2c3d +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +63044 + +30.jpg +file + + + + +2008-12-13T11:41:56.531250Z +00567e47e3659bd3c070954b014f3246 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +79404 + +12.jpg +file + + + + +2008-08-29T12:13:00.000000Z +146763c6bfcc0bd8d197ebc56639a0af +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +71705 + +31.jpg +file + + + + +2008-12-13T11:41:59.984375Z +4b8fc851e3c2eb3b00f04ff4c953bbb2 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +78835 + +13.jpg +file + + + + +2008-08-29T16:01:00.000000Z +0f9e5eb0d0f17a0e4ed74c1a2c253aec +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +80298 + +32.jpg +file + + + + +2008-12-13T11:42:07.359375Z +adc4f77ea2c9b73ce03b5a60214abf58 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +88743 + +14.jpg +file + + + + +2008-08-29T16:13:00.000000Z +90453b4545277dd7db61e2d617a49bff +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +64246 + +15.jpg +file + + + + +2008-09-05T16:23:00.000000Z +1a362541b859f7160faed5312a48074d +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +71535 + +16.jpg +file + + + + +2008-08-29T16:48:00.000000Z +2047063fd7322cae44ef4f2db4b6120c +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +71801 + +17.jpg +file + + + + +2008-08-29T17:02:00.000000Z +d4097ef2aad23531c75eb6ae50bd8b96 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +85000 + +18.jpg +file + + + + +2008-08-30T10:41:00.000000Z +f5b4164bd7db3ff5549a32abc0fbb736 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +83792 + +19.jpg +file + + + + +2008-08-30T11:14:00.000000Z +2e7aa2afa48ce7d9fa945cc77e4e1738 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +70526 + +index.html +file + + + + +2008-07-13T09:32:24.614375Z +aa368d44f02d0b27c149a42e250cd0e8 +2008-12-19T20:29:56.685768Z +1 +phantomas + + + + + + + + + + + + + + + + + + + + + +1345 + diff --git a/htdocs/images/planetesANC/.svn/format b/htdocs/images/planetesANC/.svn/format new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/htdocs/images/planetesANC/.svn/format @@ -0,0 +1 @@ +9 diff --git a/htdocs/images/planetesANC/.svn/prop-base/1.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/1.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/1.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/10.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/10.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/10.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/11.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/11.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/11.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/12.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/12.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/12.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/13.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/13.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/13.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/14.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/14.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/14.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/15.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/15.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/15.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/16.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/16.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/16.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/17.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/17.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/17.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/18.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/18.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/18.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/19.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/19.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/19.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/2.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/2.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/2.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/20.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/20.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/20.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/21.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/21.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/21.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/22.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/22.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/22.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/23.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/23.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/23.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/24.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/24.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/24.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/25.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/25.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/25.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/26.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/26.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/26.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/27.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/27.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/27.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/28.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/28.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/28.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/29.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/29.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/29.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/3.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/3.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/3.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/30.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/30.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/30.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/31.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/31.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/31.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/32.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/32.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/32.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/4.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/4.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/4.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/5.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/5.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/5.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/6.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/6.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/6.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/7.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/7.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/7.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/8.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/8.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/8.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/9.jpg.svn-base b/htdocs/images/planetesANC/.svn/prop-base/9.jpg.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/9.jpg.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/prop-base/Thumbs.db.svn-base b/htdocs/images/planetesANC/.svn/prop-base/Thumbs.db.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/planetesANC/.svn/prop-base/Thumbs.db.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/planetesANC/.svn/text-base/1.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/1.jpg.svn-base new file mode 100644 index 0000000..282fcde Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/1.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/10.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/10.jpg.svn-base new file mode 100644 index 0000000..84e2412 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/10.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/11.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/11.jpg.svn-base new file mode 100644 index 0000000..6435940 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/11.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/12.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/12.jpg.svn-base new file mode 100644 index 0000000..416508d Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/12.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/13.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/13.jpg.svn-base new file mode 100644 index 0000000..6861c8d Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/13.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/14.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/14.jpg.svn-base new file mode 100644 index 0000000..bac8568 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/14.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/15.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/15.jpg.svn-base new file mode 100644 index 0000000..d9f82a7 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/15.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/16.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/16.jpg.svn-base new file mode 100644 index 0000000..305d244 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/16.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/17.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/17.jpg.svn-base new file mode 100644 index 0000000..ab33da0 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/17.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/18.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/18.jpg.svn-base new file mode 100644 index 0000000..1e2e208 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/18.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/19.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/19.jpg.svn-base new file mode 100644 index 0000000..6885bf2 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/19.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/2.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/2.jpg.svn-base new file mode 100644 index 0000000..cd05f75 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/2.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/20.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/20.jpg.svn-base new file mode 100644 index 0000000..19bc5fb Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/20.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/21.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/21.jpg.svn-base new file mode 100644 index 0000000..6c584d4 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/21.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/22.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/22.jpg.svn-base new file mode 100644 index 0000000..a318072 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/22.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/23.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/23.jpg.svn-base new file mode 100644 index 0000000..2418250 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/23.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/24.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/24.jpg.svn-base new file mode 100644 index 0000000..3f851a5 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/24.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/25.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/25.jpg.svn-base new file mode 100644 index 0000000..8ff95dc Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/25.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/26.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/26.jpg.svn-base new file mode 100644 index 0000000..d184eea Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/26.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/27.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/27.jpg.svn-base new file mode 100644 index 0000000..df15458 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/27.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/28.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/28.jpg.svn-base new file mode 100644 index 0000000..2b2dd3b Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/28.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/29.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/29.jpg.svn-base new file mode 100644 index 0000000..c92e144 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/29.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/3.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/3.jpg.svn-base new file mode 100644 index 0000000..a1c898a Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/3.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/30.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/30.jpg.svn-base new file mode 100644 index 0000000..6b9f9a1 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/30.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/31.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/31.jpg.svn-base new file mode 100644 index 0000000..471a2bc Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/31.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/32.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/32.jpg.svn-base new file mode 100644 index 0000000..fe7e629 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/32.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/4.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/4.jpg.svn-base new file mode 100644 index 0000000..391ed50 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/4.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/5.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/5.jpg.svn-base new file mode 100644 index 0000000..353f705 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/5.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/6.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/6.jpg.svn-base new file mode 100644 index 0000000..39d266a Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/6.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/7.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/7.jpg.svn-base new file mode 100644 index 0000000..2cf0298 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/7.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/8.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/8.jpg.svn-base new file mode 100644 index 0000000..e2f7df0 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/8.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/9.jpg.svn-base b/htdocs/images/planetesANC/.svn/text-base/9.jpg.svn-base new file mode 100644 index 0000000..331e188 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/9.jpg.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/Thumbs.db.svn-base b/htdocs/images/planetesANC/.svn/text-base/Thumbs.db.svn-base new file mode 100644 index 0000000..a7700d4 Binary files /dev/null and b/htdocs/images/planetesANC/.svn/text-base/Thumbs.db.svn-base differ diff --git a/htdocs/images/planetesANC/.svn/text-base/index.html.svn-base b/htdocs/images/planetesANC/.svn/text-base/index.html.svn-base new file mode 100644 index 0000000..ce7b5d4 --- /dev/null +++ b/htdocs/images/planetesANC/.svn/text-base/index.html.svn-base @@ -0,0 +1,77 @@ + + + + + + + ::Halo-Battle:: - Erreur + + + +
          +

          Erreur

          +

          403

          +

          Refus de traitement de la requête.
          Forbidden.

          +
          +HALO-BATTLE + + + \ No newline at end of file diff --git a/htdocs/images/planetesANC/1.jpg b/htdocs/images/planetesANC/1.jpg index 04c12d2..282fcde 100644 Binary files a/htdocs/images/planetesANC/1.jpg and b/htdocs/images/planetesANC/1.jpg differ diff --git a/htdocs/images/planetesANC/10.jpg b/htdocs/images/planetesANC/10.jpg index 4730b8e..84e2412 100644 Binary files a/htdocs/images/planetesANC/10.jpg and b/htdocs/images/planetesANC/10.jpg differ diff --git a/htdocs/images/planetesANC/11.jpg b/htdocs/images/planetesANC/11.jpg index fce84b2..6435940 100644 Binary files a/htdocs/images/planetesANC/11.jpg and b/htdocs/images/planetesANC/11.jpg differ diff --git a/htdocs/images/planetesANC/12.jpg b/htdocs/images/planetesANC/12.jpg index 6db84ab..416508d 100644 Binary files a/htdocs/images/planetesANC/12.jpg and b/htdocs/images/planetesANC/12.jpg differ diff --git a/htdocs/images/planetesANC/13.jpg b/htdocs/images/planetesANC/13.jpg index 38a75a8..6861c8d 100644 Binary files a/htdocs/images/planetesANC/13.jpg and b/htdocs/images/planetesANC/13.jpg differ diff --git a/htdocs/images/planetesANC/14.jpg b/htdocs/images/planetesANC/14.jpg index d95ea92..bac8568 100644 Binary files a/htdocs/images/planetesANC/14.jpg and b/htdocs/images/planetesANC/14.jpg differ diff --git a/htdocs/images/planetesANC/15.jpg b/htdocs/images/planetesANC/15.jpg index 2e68114..d9f82a7 100644 Binary files a/htdocs/images/planetesANC/15.jpg and b/htdocs/images/planetesANC/15.jpg differ diff --git a/htdocs/images/planetesANC/16.jpg b/htdocs/images/planetesANC/16.jpg new file mode 100644 index 0000000..305d244 Binary files /dev/null and b/htdocs/images/planetesANC/16.jpg differ diff --git a/htdocs/images/planetesANC/17.jpg b/htdocs/images/planetesANC/17.jpg new file mode 100644 index 0000000..ab33da0 Binary files /dev/null and b/htdocs/images/planetesANC/17.jpg differ diff --git a/htdocs/images/planetesANC/18.jpg b/htdocs/images/planetesANC/18.jpg new file mode 100644 index 0000000..1e2e208 Binary files /dev/null and b/htdocs/images/planetesANC/18.jpg differ diff --git a/htdocs/images/planetesANC/19.jpg b/htdocs/images/planetesANC/19.jpg new file mode 100644 index 0000000..6885bf2 Binary files /dev/null and b/htdocs/images/planetesANC/19.jpg differ diff --git a/htdocs/images/planetesANC/2.jpg b/htdocs/images/planetesANC/2.jpg index 09bfb41..cd05f75 100644 Binary files a/htdocs/images/planetesANC/2.jpg and b/htdocs/images/planetesANC/2.jpg differ diff --git a/htdocs/images/planetesANC/20.jpg b/htdocs/images/planetesANC/20.jpg new file mode 100644 index 0000000..19bc5fb Binary files /dev/null and b/htdocs/images/planetesANC/20.jpg differ diff --git a/htdocs/images/planetesANC/21.jpg b/htdocs/images/planetesANC/21.jpg new file mode 100644 index 0000000..6c584d4 Binary files /dev/null and b/htdocs/images/planetesANC/21.jpg differ diff --git a/htdocs/images/planetesANC/22.jpg b/htdocs/images/planetesANC/22.jpg new file mode 100644 index 0000000..a318072 Binary files /dev/null and b/htdocs/images/planetesANC/22.jpg differ diff --git a/htdocs/images/planetesANC/23.jpg b/htdocs/images/planetesANC/23.jpg new file mode 100644 index 0000000..2418250 Binary files /dev/null and b/htdocs/images/planetesANC/23.jpg differ diff --git a/htdocs/images/planetesANC/24.jpg b/htdocs/images/planetesANC/24.jpg new file mode 100644 index 0000000..3f851a5 Binary files /dev/null and b/htdocs/images/planetesANC/24.jpg differ diff --git a/htdocs/images/planetesANC/25.jpg b/htdocs/images/planetesANC/25.jpg new file mode 100644 index 0000000..8ff95dc Binary files /dev/null and b/htdocs/images/planetesANC/25.jpg differ diff --git a/htdocs/images/planetesANC/26.jpg b/htdocs/images/planetesANC/26.jpg new file mode 100644 index 0000000..d184eea Binary files /dev/null and b/htdocs/images/planetesANC/26.jpg differ diff --git a/htdocs/images/planetesANC/27.jpg b/htdocs/images/planetesANC/27.jpg new file mode 100644 index 0000000..df15458 Binary files /dev/null and b/htdocs/images/planetesANC/27.jpg differ diff --git a/htdocs/images/planetesANC/28.jpg b/htdocs/images/planetesANC/28.jpg new file mode 100644 index 0000000..2b2dd3b Binary files /dev/null and b/htdocs/images/planetesANC/28.jpg differ diff --git a/htdocs/images/planetesANC/29.jpg b/htdocs/images/planetesANC/29.jpg new file mode 100644 index 0000000..c92e144 Binary files /dev/null and b/htdocs/images/planetesANC/29.jpg differ diff --git a/htdocs/images/planetesANC/3.jpg b/htdocs/images/planetesANC/3.jpg index 9bb4f55..a1c898a 100644 Binary files a/htdocs/images/planetesANC/3.jpg and b/htdocs/images/planetesANC/3.jpg differ diff --git a/htdocs/images/planetesANC/30.jpg b/htdocs/images/planetesANC/30.jpg new file mode 100644 index 0000000..6b9f9a1 Binary files /dev/null and b/htdocs/images/planetesANC/30.jpg differ diff --git a/htdocs/images/planetesANC/31.jpg b/htdocs/images/planetesANC/31.jpg new file mode 100644 index 0000000..471a2bc Binary files /dev/null and b/htdocs/images/planetesANC/31.jpg differ diff --git a/htdocs/images/planetesANC/32.jpg b/htdocs/images/planetesANC/32.jpg new file mode 100644 index 0000000..fe7e629 Binary files /dev/null and b/htdocs/images/planetesANC/32.jpg differ diff --git a/htdocs/images/planetesANC/4.jpg b/htdocs/images/planetesANC/4.jpg index c11b419..391ed50 100644 Binary files a/htdocs/images/planetesANC/4.jpg and b/htdocs/images/planetesANC/4.jpg differ diff --git a/htdocs/images/planetesANC/5.jpg b/htdocs/images/planetesANC/5.jpg index 6080f4d..353f705 100644 Binary files a/htdocs/images/planetesANC/5.jpg and b/htdocs/images/planetesANC/5.jpg differ diff --git a/htdocs/images/planetesANC/6.jpg b/htdocs/images/planetesANC/6.jpg index 36bcaa4..39d266a 100644 Binary files a/htdocs/images/planetesANC/6.jpg and b/htdocs/images/planetesANC/6.jpg differ diff --git a/htdocs/images/planetesANC/7.jpg b/htdocs/images/planetesANC/7.jpg index 0158ad5..2cf0298 100644 Binary files a/htdocs/images/planetesANC/7.jpg and b/htdocs/images/planetesANC/7.jpg differ diff --git a/htdocs/images/planetesANC/8.jpg b/htdocs/images/planetesANC/8.jpg index f66d0dd..e2f7df0 100644 Binary files a/htdocs/images/planetesANC/8.jpg and b/htdocs/images/planetesANC/8.jpg differ diff --git a/htdocs/images/planetesANC/9.jpg b/htdocs/images/planetesANC/9.jpg index aea705f..331e188 100644 Binary files a/htdocs/images/planetesANC/9.jpg and b/htdocs/images/planetesANC/9.jpg differ diff --git a/htdocs/images/planetesANC/Thumbs.db b/htdocs/images/planetesANC/Thumbs.db new file mode 100644 index 0000000..a7700d4 Binary files /dev/null and b/htdocs/images/planetesANC/Thumbs.db differ diff --git a/htdocs/images/smile/.svn/entries b/htdocs/images/smile/.svn/entries new file mode 100644 index 0000000..a9e723f --- /dev/null +++ b/htdocs/images/smile/.svn/entries @@ -0,0 +1,640 @@ +9 + +dir +1 +svn://62.4.71.11/HB/htdocs/images/smile +svn://62.4.71.11/HB + + + +2008-12-19T20:29:56.685768Z +1 +phantomas + + +svn:special svn:externals svn:needs-lock + + + + + + + + + + + +c4074411-828d-4616-b685-8e0a798490ab + +surprised.gif +file + + + + +2008-07-13T09:32:12.223750Z +ae735b5dd659dc4b3b0f249ce59bef79 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +174 + +biggrin.gif +file + + + + +2008-07-13T09:32:12.364375Z +f970a6591668c625e4b9dbd3b7a450d7 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +172 + +Thumbs.db +file + + + + +2008-11-28T22:11:34.895000Z +6381120bf94a4f88dbe655527f0f4b50 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +10240 + +twisted.gif +file + + + + +2008-07-13T09:32:12.505000Z +c9c3d12da1e9da699e490b86d24eee85 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +238 + +razz.gif +file + + + + +2008-07-13T09:32:12.567500Z +7aec68426aa06f01e2b1ac250e5aee62 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +176 + +lol.gif +file + + + + +2008-07-13T09:32:12.676875Z +b76e7729d43c4a49182d020741285bef +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +336 + +redface.gif +file + + + + +2008-07-13T09:32:12.833125Z +d7e9d095432cbcf09375ffc782c30c23 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +650 + +cool.gif +file + + + + +2008-07-13T09:32:12.942500Z +25c83ea511f206e88f214719dad9c88c +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +172 + +rolleyes.gif +file + + + + +2008-07-13T09:32:13.051875Z +19071b1af987946e96dcef6ce0611c6b +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +485 + +evil.gif +file + + + + +2008-07-13T09:32:13.161250Z +178255bb3fe2c3aa790c1f8ec8738504 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +236 + +mad.gif +file + + + + +2008-07-13T09:32:13.239375Z +e4355c00894da1bd78341a6b54d20b56 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +174 + +eek.gif +file + + + + +2008-07-13T09:32:13.411250Z +52e43743e38a67d5d28845a104ca8c7d +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +170 + +index.html +file + + + + +2008-07-13T09:32:13.505000Z +aa368d44f02d0b27c149a42e250cd0e8 +2008-12-19T20:29:56.685768Z +1 +phantomas + + + + + + + + + + + + + + + + + + + + + +1345 + +confused.gif +file + + + + +2008-07-13T09:32:13.630000Z +4affed1b55e5f73c9f0675ae7d0ad823 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +171 + +sad.gif +file + + + + +2008-07-13T09:32:13.801875Z +5a50535a06def9d01076772e5e9d235b +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +171 + +wink.gif +file + + + + +2008-07-13T09:32:13.895625Z +f058206bb8ff732dbe8e7aa10d74c9cd +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +170 + +smile.gif +file + + + + +2008-07-13T09:32:14.051875Z +9ee646ffab71107d1a11407be52f33a5 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +174 + +neutral.gif +file + + + + +2008-07-13T09:32:14.223750Z +4e8b7a51c7f60a2362a4f67fbbc937e7 +2008-12-19T20:29:56.685768Z +1 +phantomas +has-props + + + + + + + + + + + + + + + + + + + + +171 + diff --git a/htdocs/images/smile/.svn/format b/htdocs/images/smile/.svn/format new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/htdocs/images/smile/.svn/format @@ -0,0 +1 @@ +9 diff --git a/htdocs/images/smile/.svn/prop-base/Thumbs.db.svn-base b/htdocs/images/smile/.svn/prop-base/Thumbs.db.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/Thumbs.db.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/biggrin.gif.svn-base b/htdocs/images/smile/.svn/prop-base/biggrin.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/biggrin.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/confused.gif.svn-base b/htdocs/images/smile/.svn/prop-base/confused.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/confused.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/cool.gif.svn-base b/htdocs/images/smile/.svn/prop-base/cool.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/cool.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/eek.gif.svn-base b/htdocs/images/smile/.svn/prop-base/eek.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/eek.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/evil.gif.svn-base b/htdocs/images/smile/.svn/prop-base/evil.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/evil.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/lol.gif.svn-base b/htdocs/images/smile/.svn/prop-base/lol.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/lol.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/mad.gif.svn-base b/htdocs/images/smile/.svn/prop-base/mad.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/mad.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/neutral.gif.svn-base b/htdocs/images/smile/.svn/prop-base/neutral.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/neutral.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/razz.gif.svn-base b/htdocs/images/smile/.svn/prop-base/razz.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/razz.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/redface.gif.svn-base b/htdocs/images/smile/.svn/prop-base/redface.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/redface.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/rolleyes.gif.svn-base b/htdocs/images/smile/.svn/prop-base/rolleyes.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/rolleyes.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/sad.gif.svn-base b/htdocs/images/smile/.svn/prop-base/sad.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/sad.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/smile.gif.svn-base b/htdocs/images/smile/.svn/prop-base/smile.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/smile.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/surprised.gif.svn-base b/htdocs/images/smile/.svn/prop-base/surprised.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/surprised.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/twisted.gif.svn-base b/htdocs/images/smile/.svn/prop-base/twisted.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/twisted.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/prop-base/wink.gif.svn-base b/htdocs/images/smile/.svn/prop-base/wink.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/htdocs/images/smile/.svn/prop-base/wink.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/htdocs/images/smile/.svn/text-base/Thumbs.db.svn-base b/htdocs/images/smile/.svn/text-base/Thumbs.db.svn-base new file mode 100644 index 0000000..5fc72ac Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/Thumbs.db.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/biggrin.gif.svn-base b/htdocs/images/smile/.svn/text-base/biggrin.gif.svn-base new file mode 100644 index 0000000..d352772 Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/biggrin.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/confused.gif.svn-base b/htdocs/images/smile/.svn/text-base/confused.gif.svn-base new file mode 100644 index 0000000..0c49e06 Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/confused.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/cool.gif.svn-base b/htdocs/images/smile/.svn/text-base/cool.gif.svn-base new file mode 100644 index 0000000..cead030 Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/cool.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/eek.gif.svn-base b/htdocs/images/smile/.svn/text-base/eek.gif.svn-base new file mode 100644 index 0000000..5d39781 Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/eek.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/evil.gif.svn-base b/htdocs/images/smile/.svn/text-base/evil.gif.svn-base new file mode 100644 index 0000000..ab1aa8e Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/evil.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/index.html.svn-base b/htdocs/images/smile/.svn/text-base/index.html.svn-base new file mode 100644 index 0000000..ce7b5d4 --- /dev/null +++ b/htdocs/images/smile/.svn/text-base/index.html.svn-base @@ -0,0 +1,77 @@ + + + + + + + ::Halo-Battle:: - Erreur + + + +
          +

          Erreur

          +

          403

          +

          Refus de traitement de la requête.
          Forbidden.

          +
          +HALO-BATTLE + + + \ No newline at end of file diff --git a/htdocs/images/smile/.svn/text-base/lol.gif.svn-base b/htdocs/images/smile/.svn/text-base/lol.gif.svn-base new file mode 100644 index 0000000..374ba15 Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/lol.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/mad.gif.svn-base b/htdocs/images/smile/.svn/text-base/mad.gif.svn-base new file mode 100644 index 0000000..1f6c3c2 Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/mad.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/neutral.gif.svn-base b/htdocs/images/smile/.svn/text-base/neutral.gif.svn-base new file mode 100644 index 0000000..4f31156 Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/neutral.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/razz.gif.svn-base b/htdocs/images/smile/.svn/text-base/razz.gif.svn-base new file mode 100644 index 0000000..29da2a2 Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/razz.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/redface.gif.svn-base b/htdocs/images/smile/.svn/text-base/redface.gif.svn-base new file mode 100644 index 0000000..ad76283 Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/redface.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/rolleyes.gif.svn-base b/htdocs/images/smile/.svn/text-base/rolleyes.gif.svn-base new file mode 100644 index 0000000..d7f5f2f Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/rolleyes.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/sad.gif.svn-base b/htdocs/images/smile/.svn/text-base/sad.gif.svn-base new file mode 100644 index 0000000..d2ac78c Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/sad.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/smile.gif.svn-base b/htdocs/images/smile/.svn/text-base/smile.gif.svn-base new file mode 100644 index 0000000..7b1f6d3 Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/smile.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/surprised.gif.svn-base b/htdocs/images/smile/.svn/text-base/surprised.gif.svn-base new file mode 100644 index 0000000..cb21424 Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/surprised.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/twisted.gif.svn-base b/htdocs/images/smile/.svn/text-base/twisted.gif.svn-base new file mode 100644 index 0000000..502fe24 Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/twisted.gif.svn-base differ diff --git a/htdocs/images/smile/.svn/text-base/wink.gif.svn-base b/htdocs/images/smile/.svn/text-base/wink.gif.svn-base new file mode 100644 index 0000000..d148288 Binary files /dev/null and b/htdocs/images/smile/.svn/text-base/wink.gif.svn-base differ diff --git a/htdocs/images/smile/Thumbs.db b/htdocs/images/smile/Thumbs.db new file mode 100644 index 0000000..5fc72ac Binary files /dev/null and b/htdocs/images/smile/Thumbs.db differ diff --git a/htdocs/index.php b/htdocs/index.php index 39f961a..ba3fd85 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -1,76 +1,430 @@ values['connected'])) define("xCSRF", true); -require_once(_FCORE."common.php"); +define("DEBUG", false); -//Pistage Guillaume -if ($_SERVER["REMOTE_ADDR"] == "82.245.190.225" || $_SERVER["REMOTE_ADDR"] == "84.101.175.59" || $_SERVER["REMOTE_ADDR"] == "86.214.198.131" || (isset($sess->values['id']) && ($sess->values['id'] == "21" || $sess->values['id'] == "23"))) { - file_log(var_export($_REQUEST,TRUE),0 , _FCORE."logs/users"); -} +//Inclusion de l'API Onyx +require_once(trim(file_get_contents('./.onyx'))); +require_once("common.php"); //Chargement de tout le nécessaire pour le jeu //On vérifie si le client est connecté sur le site -if (isset($sess) && isset($sess->values['connected']) && $sess->values['connected'] && !empty($sess->values['id']) && !empty($sess->values['race']) && !empty($sess->level) && !empty($sess->values['idPlan'])) { +if (isset($SESS) && isset($SESS->values['connected']) && $SESS->values['connected'] && !empty($SESS->values['id']) && !empty($SESS->values['race']) && !empty($SESS->level) && isset($SESS->values['idPlan']) && isset($SESS->values['idAsteroide'])) + { + $template->assign('menu', array_map("url", $VAR['menu'])); + require_once("pub.php"); //Inclusion de la pub et du footer + + //Si un nouveau joueur cherche à se connecter du même endroit, on déconnecte le joueur en cours avant + $HB_login = gpc('l'); + if (!empty($HB_login) && strtolower($HB_login) != strtolower(trouvNom($SESS->values['id']))) + { + include("game/serveur/logout.php"); + } + elseif (!empty($HB_login)) + { + redirection('./'.$VAR['first_page']); + exit; + } + + $race = $SESS->values['race']; + $securePlanete = array(); + + //Inclusion des formules + require_once("game/vars.php"); + require_once("game/Class/class.donnee.php"); + //On inclus les différentes classes + include_once("game/Class/class.file.php"); + include_once("game/Class/class.user.php"); + include_once("game/Class/class.surface.php"); + include_once("game/Class/class.planete.php"); + include_once("game/Class/class.asteroide.php"); + include_once("game/Class/class.flotte.php"); + + //Récupération d'informations au sujet de l'utilisateur + $id_user = $SESS->values['id']; + $template->assign('auth_level', $SESS->level); + + //Recherche du multi-compte + $ip = $_SERVER["REMOTE_ADDR"]; + + if (!isset($bdd)) $bdd = new Bdd(); + else $bdd->reconnexion(); + $multi = $bdd->query("SELECT U.pseudo, R.id_util FROM $table_registre_identification R INNER JOIN $table_user U ON U.id = R.id_util WHERE R.ip = '$ip' GROUP BY R.ip, R.id_util HAVING R.id_util != $id_user;"); + + + //On gère les demande de changement de planète + if (isset($_POST['Cplanete'])) + { + if (ereg('A', $_POST['Cplanete'])) + { + $idAsteroideTest = intval(substr(gpc('Cplanete', 'post'), 1)); + if ($bdd->unique_query("SELECT id FROM $table_alliances WHERE id = $idAsteroideTest;") && $bdd->unique_query("SELECT id FROM $table_user WHERE id = $id_user AND id_alliance = $idAsteroideTest;")) + { + $SESS->values['idPlan'] = 0; + $SESS->values['idAsteroide'] = $idAsteroideTest; + $SESS->values['isolement'] = 0; + $SESS->put(); + $template->assign('contenu', ''); + $template->assign('page','vp'); + $template->assign('race', $race); + $template->display('game/vp.tpl'); + exit; + } + unset($idAsteroideTest); + } + else + { + $idPlanTest = intval(gpc('Cplanete', 'post')); + if ($bdd->unique_query("SELECT id FROM $table_planete WHERE id_user = $id_user AND id = $idPlanTest;")) + { + $SESS->values['idPlan'] = $idPlanTest; + $SESS->values['idAsteroide'] = 0; + $SESS->values['isolement'] = 0; + $SESS->put(); + $template->assign('contenu', ''); + $template->assign('page','vp'); + $template->assign('race', $race); + $template->display('game/vp.tpl'); + exit; + } + unset($idPlanTest); + } + } + $idPlan = $SESS->values['idPlan']; + $idAsteroide = $SESS->values['idAsteroide']; + + $queryMail = $bdd->unique_query("SELECT COUNT(id) AS nombre FROM $table_mail WHERE destinataire = $id_user AND vu = '1';"); + $queryPlanetes = $bdd->query("SELECT * FROM $table_planete WHERE id_user = $id_user ORDER BY id ASC;"); + + $bdd->deconnexion(); + + //Chargement de la planète/astéroide actuel + if ($idPlan == 0 && $idAsteroide == 0) + { + trigger_error('Planete et Asteroide nul, deconnexion du joueur '.$id_user,E_USER_ERROR); + include("game/serveur/logout.php"); + exit; + } + elseif ($idPlan == 0) + { + define('SURFACE', 'asteroide'); + $planete = new Asteroide($idAsteroide); + } + else + { + define('SURFACE', 'planete'); + $planete = new Planete($idPlan); + $planete->actualiser(); + } + unset($ip, $idAsteroide, $idPlan); + + //On vérifie que le joueur ne soit pas en mode vacances forcé + if ($planete->mv > 0) + { + $SESS->close(); + redirection($config['first_page'].'?mvf'); + exit; + } + + //NOMS ET FLOTTES + include('flottes.php'); + + //Envoie d'informations au template + $template->assign('alertMail', $queryMail['nombre']); + $template->assign('planete', $planete); + $template->assign('planetes', $queryPlanetes); + $template->assign('race', $race); + $template->assign('nomsressources', 'ERREUR#RESSOURCES'); + //Calcul du temps de jeu + $tpsdejeu = time() - $planete->last_visite; + $heur = floor($tpsdejeu/3600); + $min = floor(($tpsdejeu%3600)/60); + if ($heur > 0) $min = $heur." h ".$min; + $template->assign("tpsdejeu", $min." min"); + unset($tpsdejeu, $heur, $min, $queryMail); + + //Récupération de la page demandée + $p = gpc('p'); + + //Vérification de l'isolement de la planète + if ((empty($SESS->values['isolement']) || time() >= $SESS->values['isolement']) && $p != 'operateur' && $p != 'demarrage' && $p != 'avertmulti' && $p != 'chat' && $p != 'rename' && $p != 'accueil' && $p != 'arbre' && $p != 'prochainement' && $p != 'options' && $p != 'messagerie' && $p != 'envoyer' && $p != 'classement' && $p != 'bugs' && $p != 'deconnexion') + { + //TODO Si la planète est en isolement total, faire un autre message + if ($planete->isolement()) + { + $template->assign('titre','Planète isolée'); + erreur('Impossible de rentrer en contact avec cette planète.
          Réessayez vers '.date('H:i', $planete->isolement[1])); + } + else + { + $SESS->values['isolement'] = $planete->isolement[0]; + $SESS->put(); + } + } + + $template->assign("race", $planete->race); + + //SWITCH + switch($p) + { + case 'batiments': + include("game/jeu/batiments.php"); + break; + case 'caserne': + include("game/jeu/caserne.php"); + break; + case 'chantierspatial': + include("game/jeu/chantierspatial.php"); + break; + case 'chantierterrestre': + case 'defenses': + include("game/jeu/chantierterrestre.php"); + break; + case 'laboratoire': + include("game/jeu/laboratoire.php"); + break; + case 'arbre': + include("game/jeu/arbre.php"); + break; + case 'description': + include("game/jeu/description.php"); + break; + case 'ressources': + include("game/jeu/ressources.php"); + break; + case 'gestion': + include("game/jeu/gestion.php"); + break; + case 'marche': + include("game/jeu/marche.php"); + break; + case 'flotte': + include("game/jeu/flotte.php"); + break; + case 'carte': + include("game/jeu/carte.php"); + break; + + case 'rename': + include("game/jeu/rename.php"); + break; + case 'messagerie': + include("game/serveur/messagerie.php"); + break; + case 'envoyer': + include("game/serveur/envoyer.php"); + break; + case 'amis': + include("game/serveur/amis.php"); + break; + case 'destinationsrapides': + include("game/serveur/destinrapid.php"); + break; + case 'chat': + $page = 'chat'; $titre = 'Chat'; + break; + case 'aide': + case 'faq': + include("game/serveur/aide.php"); + break; + + case 'operateur': + include("game/serveur/operateur.php"); + break; + case 'prochainement': + $page = 'prochainement'; + $titre = 'Prochainement'; + break; + case 'version': + include("game/serveur/version.php"); + break; + case "demarrage": + include("game/serveur/demarrage.php"); + break; + case "avertmulti": + include("game/serveur/avertmulti.php"); + break; + + case "pilori": + include("game/serveur/pilori.php"); + break; + case "conditions": + include("game/serveur/conditions.php"); + break; + case "regles": + include("game/serveur/regles.php"); + break; + + case 'deconnexion': + case 'logout': + include("game/serveur/logout.php"); + break; + default: + include("game/jeu/accueil.php"); + } + + $template->assign("page", $page); + if (!empty($titre)) + $template->assign("titre", ".: Halo-Battle - ".$titre." :."); + else + $template->assign("titre", ".: Halo-Battle :."); + + $template->display("game/".$page.".tpl"); + } +//Si le client n'est pas connecté au site +else + { + include("game/serveur/connexion.php"); + + $p = gpc('p'); + switch($p){ + //Serveur principal + /* case "validation": + include('game/validation.php'); + break; + case "inscription": + include('game/inscription.php'); + break; + case "oubliemdp": + redirection('http://halo-battle.fr/'); + break;*/ + //Serveur de jeu + case "connexion": + $page = 'mini'; + break; + case 'classement': + include(_FCORE."../game/jeu/classement.php"); + break; + case "njoueur": + include(_FCORE."../game/jeu/njoueur.php"); + break; + case "inscription": + redirection('http://halo-battle.s-fr.com/?p=inscription'); + exit; + break; + case "oubliemdp": + include(_FCORE."../game/jeu/oubliemdp.php"); + break; + case "pilori": + include("game/jeu/pilori.php"); + break; + //Tous serveurs + case "conditions": + include(_FCORE."../game/jeu/conditions.php"); + break; + case "regles": + include(_FCORE."../game/jeu/regles.php"); + break; + default: + //$page = 'mini'; + redirection('http://www.halo-battle.fr/'); + exit; + } + $template->display('cms/'.$page.'.tpl'); + } + + +exit(); + +//On vérifie si le client est connecté sur le site +if (isset($SESS) && isset($SESS->values['connected']) && $SESS->values['connected'] && !empty($SESS->values['id']) && !empty($SESS->values['race']) && !empty($SESS->level) && isset($SESS->values['idPlan']) && isset($SESS->values['idAsteroide'])) { //Si un nouveau joueur cherche à se connecter du même endroit, on déconnecte le joueur en cours avant $HB_login = gpc('l'); - if (!empty($HB_login) && strtolower($HB_login) != strtolower(trouvNom($sess->values['id']))) { - include(_FCORE."../game/jeu/logout.php"); - } - elseif (!empty($HB_login)) { - header('Location: ./'.$config['first_page']); - exit; - } + if (!empty($HB_login) && strtolower($HB_login) != strtolower(trouvNom($SESS->values['id']))) + { + include(_FCORE."../game/jeu/logout.php"); + } + elseif (!empty($HB_login)) + { + redirection('./'.$config['first_page']); + exit; + } - $race = $sess->values['race']; + $race = $SESS->values['race']; + $securePlanete = array(); //Inclusion des formules require_once(_FCORE."../game/vars.php"); //On inclus les différentes classes include_once(_FCORE."../game/Class/class.file.php"); include_once(_FCORE."../game/Class/class.user.php"); + include_once(_FCORE."../game/Class/class.surface.php"); include_once(_FCORE."../game/Class/class.planete.php"); + include_once(_FCORE."../game/Class/class.asteroide.php"); + include_once(_FCORE."../game/Class/class.flotte.php"); //Récupération d'informations au sujet de l'utilisateur - $id_user = $sess->values['id']; - $template->assign('auth_level', $sess->level); + $id_user = $SESS->values['id']; + $template->assign('auth_level', $SESS->level); $ip = $_SERVER["REMOTE_ADDR"]; - $bdd->connexion(); + $bdd->reconnexion(); $multi = $bdd->query("SELECT U.pseudo, R.id_util FROM $table_registre_identification R INNER JOIN $table_user U ON U.id = R.id_util WHERE R.ip = '$ip' GROUP BY R.ip, R.id_util HAVING R.id_util != $id_user;"); if (isset($_POST['Cplanete'])) { - $idPlanTest = intval($_POST['Cplanete']); - if ($bdd->unique_query("SELECT * FROM $table_planete WHERE id_user = $id_user AND id = $idPlanTest;")) { - $sess->values['idPlan'] = $idPlanTest; - $sess->put(); - $template->assign('contenu', ''); - $template->assign('page','vp'); - $template->assign('race', $race); - $template->display('game/vp.tpl'); - exit; + if (ereg('A', $_POST['Cplanete'])) + { + $idAsteroideTest = intval(substr($_POST['Cplanete'], 1)); + if ($bdd->unique_query("SELECT id FROM $table_alliances WHERE id = $idAsteroideTest;") && $bdd->unique_query("SELECT id FROM $table_user WHERE id = $id_user AND id_alliance = $idAsteroideTest;")) { + $SESS->values['idPlan'] = 0; + $SESS->values['idAsteroide'] = $idAsteroideTest; + $SESS->values['isolement'] = 0; + $SESS->put(); + $template->assign('contenu', ''); + $template->assign('page','vp'); + $template->assign('race', $race); + $template->display('game/vp.tpl'); + exit; + } + } + else + { + $idPlanTest = intval($_POST['Cplanete']); + if ($bdd->unique_query("SELECT id FROM $table_planete WHERE id_user = $id_user AND id = $idPlanTest;")) { + $SESS->values['idPlan'] = $idPlanTest; + $SESS->values['idAsteroide'] = 0; + $SESS->values['isolement'] = 0; + $SESS->put(); + $template->assign('contenu', ''); + $template->assign('page','vp'); + $template->assign('race', $race); + $template->display('game/vp.tpl'); + exit; + } } } - $idPlan = $sess->values['idPlan']; + $idPlan = $SESS->values['idPlan']; + $idAsteroide = $SESS->values['idAsteroide']; $queryMail = $bdd->unique_query("SELECT COUNT(id) AS nombre FROM $table_mail WHERE destinataire = $id_user AND vu = '1';"); - $queryPlanetes = $bdd->query("SELECT * FROM $table_planete WHERE id_user = '$id_user' ORDER BY id ASC;"); + $queryPlanetes = $bdd->query("SELECT * FROM $table_planete WHERE id_user = $id_user ORDER BY id ASC;"); $bdd->deconnexion(); - $planete = new Planete($idPlan); - + + if ($idPlan == 0 && $idAsteroide == 0) { + die('ERREUR : index.php ligne 94'); + trigger_error('Planete et Asteroide nul, deconnexion du joueur '.$id_user,E_USER_ERROR); + include(_FCORE."../game/jeu/logout.php"); + } + elseif ($idPlan == 0) { + define('SURFACE', 'asteroide'); + $planete = new Asteroide($idAsteroide); + } + else { + define('SURFACE', 'planete'); + $planete = new Planete($idPlan); + } + //On vérifie que le joueur ne soit pas en mode vacances forcé if ($planete->mv > 0) { - $sess->close(); - header('Location: '.$config['first_page'].'?mvf'); + $SESS->close(); + redirection($config['first_page'].'?mvf'); exit; } //Chargement asteroide if ($planete->id_alliance) { - $bdd->connexion(); + $bdd->reconnexion(); $template->assign('asteroide', $bdd->unique_query("SELECT * FROM $table_alliances WHERE id = ".$planete->id_alliance.";")); $bdd->deconnexion(); } @@ -78,7 +432,7 @@ if (isset($sess) && isset($sess->values['connected']) && $sess->values['connecte ///require_once(_FCORE."../game/ressources.php"); ///require_once(_FCORE."../game/constructions.php"); require(_FCORE."../game/noms.php"); -//> require_once(_FCORE."../game/flottes.php"); + require_once(_FCORE."../game/flottes.php"); $template->assign('alertMail', $queryMail['nombre']); $template->assign('planete', $planete); @@ -87,11 +441,17 @@ if (isset($sess) && isset($sess->values['connected']) && $sess->values['connecte $p = gpc('p'); //Isolement de la planète - if ($planete->isolement && $p != 'rename' && $p != 'accueil' && $p != 'arbre' && $p != 'prochainement' && $p != 'options' && $p != 'messagerie' && $p != 'envoyer' && $p != 'classement' && $p != 'bugs' && $p != 'deconnexion') { - $template->assign('titre','Planète isolée'); - $isolement = explode(' ', $planete->isolement); + if ((empty($SESS->values['isolement']) || time() >= $SESS->values['isolement']) && $p != 'rename' && $p != 'accueil' && $p != 'arbre' && $p != 'prochainement' && $p != 'options' && $p != 'messagerie' && $p != 'envoyer' && $p != 'classement' && $p != 'bugs' && $p != 'deconnexion') { //TODO Si la planète est en isolement total, faire un autre message - erreur('Impossible de rentrer en contact avec cette planète.
          Réessayez vers '.date('H:i', $isolement[1])); + if ($planete->isolement()) { + $template->assign('race',$race); + $template->assign('titre','Planète isolée'); + erreur('Impossible de rentrer en contact avec cette planète.
          Réessayez vers '.date('H:i', $planete->isolement[1])); + } + else { + $SESS->values['isolement'] = $planete->isolement[0]; + $SESS->put(); + } } //Calcul du temps de jeu @@ -156,8 +516,8 @@ if (isset($sess) && isset($sess->values['connected']) && $sess->values['connecte case 'carte': include(_FCORE."../game/jeu/carte.php"); break; - case 'bourse': - include(_FCORE."../game/jeu/bourse.php"); + case 'marche': + include(_FCORE."../game/jeu/marche.php"); break; case 'options': include(_FCORE."../game/jeu/options.php"); @@ -224,192 +584,7 @@ if (isset($sess) && isset($sess->values['connected']) && $sess->values['connecte } //Si le joueur n'est pas connecté au site else { - //On traite la demande de loggin de l'utilisateur - if ((isset($_GET['l']) && isset($_GET['p'])) || (isset($_POST['HB_login']) && isset($_POST['HB_password']))) { - //Récupération des données POST ou GET - if (isset($_POST['HB_login']) && isset($_POST['HB_password']) && gpc('p') == 'connexion') { - $HB_login = gpc('HB_login', 'post'); - $HB_password = gpc('HB_password', 'post'); - $HB_auth = hash("sha512", $HB_login.'Ņ♂↨'.$HB_password.'☻♫☼'.date('W!Y¨D@j').$_SERVER["HTTP_USER_AGENT"].$_SERVER["REMOTE_ADDR"]); - } - else { - $HB_login = gpc('l'); - if (is_numeric('0x'.gpc('p'))) $HB_password = cxor(hexstr(gpc('p')), date('WYDj')); - $HB_auth = gpc('a'); - } - - if (empty($HB_login) || empty($HB_password)) { - $template->assign('message','Nom d\'utilisateur ou mot de passe incorrect.

          '); - $template->assign('couleur','red'); - $template->display('cms/erreur.tpl'); - exit; - } - elseif (hash("sha512", $HB_login.'Ņ♂↨'.$HB_password.'☻♫☼'.date('W!Y¨D@j').$_SERVER["HTTP_USER_AGENT"].$_SERVER["REMOTE_ADDR"]) != $HB_auth && hash("sha512", $HB_login.'Ņ♂↨'.$HB_password.'☻♫☼'.date('W!Y¨D@j', time()-300)) != $HB_auth) { - $template->assign('message','Impossible d\'authentifier la connexion !

          Si le problème perciste, contactez un administrateur.'); - $template->assign('couleur','red'); - $template->display('cms/erreur.tpl'); - exit; - } - else { - $ipe = $_SERVER['REMOTE_ADDR']; - $bdd->connexion(); - $bruteforce = $bdd->unique_query("SELECT nombre FROM securite_identification WHERE ip = '$ipe';"); - if ($bruteforce['nombre'] >= 15) { - $fichier = fopen(_FCORE."ban.xlist",'a+'); - fwrite($fichier, $_SERVER['REMOTE_ADDR']."\n\r"); - fclose($fichier); - } - $bdd->escape($HB_login); - if (!$var = $bdd->unique_query("SELECT mdp_var, mdp FROM $table_user WHERE pseudo = '$HB_login';")) { - if (isset($bruteforce['nombre'])) $bdd->query("UPDATE securite_identification SET nombre = nombre + 1 WHERE ip = '$ipe';"); - else $bdd->query("INSERT INTO securite_identification VALUES ('$ipe', '1', '".time()."');"); - $bdd->deconnexion(); - $template->assign('message','Nom d\'utilisateur ou mot de passe incorrect.'); - $template->assign('couleur','red'); - $template->assign('script',''); - $template->display('cms/erreur.tpl'); - exit; - } - $bdd->deconnexion(); - - $HB_password = mdp($HB_login, $HB_password, $var['mdp_var']); - - $time = time(); - $ip = $_SERVER["REMOTE_ADDR"]; - $bdd->connexion(); - $bdd->escape($HB_password); - - //Limiter le nombre de personnes en ligne simutanément - if ($enligne['enligne'] > 1500) { - $template->assign('message','Il y a actuellement trop de monde connecté sur Halo-Battle. Pour permettre aux joueurs une navigation convenable, nous vous remercions de revenir plus tard.'); - $template->assign('couleur','red'); - $template->display('cms/erreur.tpl'); - exit; - } - - $resultat = $bdd->unique_query("SELECT id, race, mv, last_visite, auth_level, raisonmv FROM $table_user WHERE pseudo = '$HB_login' AND mdp = '$HB_password';"); - if ($resultat) { - $id = $resultat['id']; - $reqPlan = $bdd->query("SELECT id, file_bat, file_tech, file_cas, file_vais, file_ter, timestamp FROM $table_planete WHERE id_user = '$id' ORDER BY id ASC;"); - $resultatP = $reqPlan[0]; - $race = $resultat['race']; - - if (!$reqPlan) { - $bdd->deconnexion(); - - $template->assign('message','Impossible de trouver votre planète !'); - $template->assign('couleur','red'); - $template->display('cms/erreur.tpl'); - exit; - } - - if ($resultat['mv'] > 0) { - if (($resultat['last_visite'] + 259200 > time() || $resultat['mv'] == 3) && $resultat['auth_level'] < 2) { - if ($resultat['mv'] == 3) $template->assign('message','Vous êtes définitivement banni de cette galaxie pour '.$resultat['raisonmv'].'. Vous ne pouvez plus vous reconnecter sur votre compte'); - elseif ($resultat['mv'] == 2) $template->assign('message','Un opérateur a placé votre compte en mode vacances pour '.$resultat['raisonmv'].'. Vous ne pouvez pas vous reconnecter sur votre compte avant le
          '.strftime("%A %d %B à %H:%M", $resultat['last_visite']+259200)); - else $template->assign('message','Vous ne pouvez pas sortir du mode vacances avant le
          '.strftime("%A %d %B à %H:%M", $resultat['last_visite']+259200)); - $template->assign('couleur','red'); - $template->display('cms/erreur.tpl'); - exit; - } - - $bdd->query("UPDATE $table_user SET mv = '0' WHERE id = '$id';"); - $bdd->query("UPDATE $table_planete SET timestamp = '".time()."' WHERE id_user = '$id';"); - $bdd->deconnexion(); - - //On fait repartir à 0 les files d'attente - include_once(_FCORE."../game/vars.php"); - include_once(_FCORE."../game/Class/class.file.php"); - include_once(_FCORE."../game/Class/class.user.php"); - include_once(_FCORE."../game/Class/class.planete.php"); - foreach ($reqPlan as $plan){ - if (!empty($plan['file_bat'])) { - $file = new File($plan['file_bat']); - $fileBat = $file->reajusteVacances($plan['timestamp']); - } - else $fileBat = ''; - if (!empty($plan['file_tech'])) { - $file = new File($plan['file_tech']); - $fileTech = $file->reajusteVacances($plan['timestamp']); - } - else $fileTech = ''; - if (!empty($plan['file_cas'])) { - $file = new File($plan['file_cas']); - $fileCas = $file->reajusteVacances($plan['timestamp']); - } - else $fileCas = ''; - if (!empty($plan['file_vais'])) { - $file = new File($plan['file_vais']); - $fileVais = $file->reajusteVacances($plan['timestamp']); - } - else $fileVais = ''; - if (!empty($plan['file_ter'])) { - $file = new File($plan['file_ter']); - $fileTer = $file->reajusteVacances($plan['timestamp']); - } - else $fileTer = ''; - - $idPlan = $plan['id']; - $bdd->connexion(); - $bdd->escape($fileBat); - $bdd->escape($fileTech); - $bdd->escape($fileCas); - $bdd->escape($fileVais); - $bdd->escape($fileTer); - $bdd->query("UPDATE $table_planete SET file_bat = '$fileBat', file_tech = '$fileTech', file_cas = '$fileCas', file_vais = '$fileVais', file_ter = '$fileTer' WHERE id = $idPlan;"); - $bdd->deconnexion(); - - //On met à jour la planète pour tout le reste - $plan = new Planete($plan['id'], true); - } - } - //On met à jour toutes les planètes si le nombre de joueurs n'est pas trop important - elseif ($enligne['enligne'] > 400) { - include_once(_FCORE."../game/vars.php"); - include_once(_FCORE."../game/Class/class.file.php"); - include_once(_FCORE."../game/Class/class.user.php"); - include_once(_FCORE."../game/Class/class.planete.php"); - - foreach ($reqPlan as $plan){ - $plan = new Planete($plan['id'], true); - } - } - - $plan = null; - - $bdd->connexion(); - $bdd->query("UPDATE $table_user SET last_visite = '$time', last_ip = '$ip' WHERE id = $id;"); - $bdd->query("INSERT INTO $table_registre_identification (id_util, ip) VALUES (".$id.",'".$ip."');"); - $multi = $bdd->unique_query("SELECT COUNT(*) FROM $table_registre_identification WHERE ip = '$ip' GROUP BY ip, id_util;"); - $message = $bdd->unique_query("SELECT time FROM $table_messages_demarrage ORDER BY time DESC LIMIT 1;"); - $bdd->deconnexion(); - - $sess->values['connected'] = TRUE; - $sess->values['id'] = $resultat['id']; - $sess->values['race'] = $resultat['race']; - $sess->values['idPlan'] = $resultatP['id']; - - //Si on détecte le multi-compte, on interdit l'accès au panneau d'admin - if (empty($multi)) $sess->level = 1; - else $sess->level = $resultat['auth_level'] + 1; - $sess->put($resultat['id']); - - if ($message['time'] > $resultat['last_visite']) header('Location: ./'.$config['first_page'].'?p=demarrage'); - elseif (empty($multi)) header('Location: ./'.$config['first_page'].'?p=avertmulti'); - else header('Location: ./'.$config['first_page'].'?p=accueil'); - exit; - } - else { - $bdd->deconnexion(); - - $template->assign('message','Nom d\'utilisateur ou mot de passe incorrect.'); - $template->assign('couleur','red'); - $template->assign('script',''); - $template->display('cms/erreur.tpl'); - exit; - } - } - } + include(_FCORE."../game/jeu/connexion.php"); $p = gpc('p'); switch($p){ @@ -421,17 +596,20 @@ else { include('game/inscription.php'); break; case "oubliemdp": - header('Location: http://halo-battle.fr/'); + redirection('http://halo-battle.fr/'); break;*/ //Serveur de jeu case "connexion": $page = 'mini'; break; + case 'classement': + include(_FCORE."../game/jeu/classement.php"); + break; case "njoueur": include(_FCORE."../game/jeu/njoueur.php"); break; case "inscription": - header('Location: http://halo-battle.s-fr.com/?p=inscription'); + redirection('http://halo-battle.s-fr.com/?p=inscription'); exit; break; case "oubliemdp": @@ -446,10 +624,10 @@ else { break; default: //$page = 'mini'; - header('Location: http://www.halo-battle.fr/'); + redirection('http://www.halo-battle.fr/'); exit; } $template->display('cms/'.$page.'.tpl'); } echo("\n"); -?> \ No newline at end of file +?> diff --git a/htdocs/integrite.php b/htdocs/integrite.php new file mode 100644 index 0000000..0a7b261 --- /dev/null +++ b/htdocs/integrite.php @@ -0,0 +1,143 @@ + + + .: Halo-Battle :: Vérification de l'intégrité des fichiers :. + + +

          Vérification de l'intégrité des fichiers

          +
          '; + } + +print 'Vérification du fichier de validation ...'; +if (sha1(sha1_file(__FILE__)) != $SUM) + die(' INVALIDE !
          Arrêt du processus de validation !'); +else + print ' Valide

          '; + +print 'Recherche du fichier de sauvegarde ...'; +if (is_file(FILE_SAV) && !isset($_GET['erase'])) + { + function parcourDir($dir, $sums) + { + if (isset($_GET['v'])) + print "
          Parcours du dossier à la recherche de nouveaux fichiers : ".$dir; + + $new = 0; + $pointeur = opendir($dir); + while ($fichier = readdir($pointeur)) + { + if($fichier == '.' || $fichier == '..' || $fichier == '.svn' || ereg("~", $fichier)) + continue; + + if(is_dir($dir.$fichier) && is_readable($dir.$fichier)) + $new += parcourDir($dir.$fichier.'/', $sums); + + elseif(is_file($dir.$fichier)) + { + if (!isset($sums[$dir.$fichier])) + { + $new++; + print "
          "; + } + } + } + closedir($pointeur); + + return $new; + } + + print ' Trouvé

          '; + + if (isset($_GET["check"])) + { + print 'Contrôle de la somme de la dernière validation ...'; + if (sha1(sha1_file(FILE_SAV).'<^>'.sha1_file(__FILE__).sha1_file('checkSum.php')) == $_GET["check"]) + print ' Authentique

          '; + else + die (' Invalide !
          Arrêt du processus de vérification !'); + } + else + print 'Les résultats présentés ci-dessus ne peuvent pas être authentifiés sans la somme d\'un précédent contrôle, rien ne dit que les fichiers de validation n\'ont pas été modifiés !

          '; + + $start = unserialize(file_get_contents(FILE_SAV)); + + print ' Vérification des fichiers ...'; + print '
          ".$dir.$fichier."Nouveau fichier !
          '; + $alerte = 0; + foreach($start as $key => $sum) + { + if (!is_file($key)) + { + $alerte++; + if (!isset($_GET['a'])) + print ""; + } + elseif (sha1_file($key) != $sum) + { + $alerte++; + print ""; + } + elseif (isset($_GET['v'])) + print ""; + } + $newFiles = parcourDir(dir_start, $start); + print '
          Nom du fichierDétails
          ".$key."Fichier supprimé !
          ".$key."Alerte de différence de somme !
          ".$key."Ok
          '; + + print '
          Fin de la vérification : '.$alerte.' alerte(s) sur '.count($start).' fichier(s). '.$newFiles.' nouveau(x) fichier(s).'; + + print '

          Contôle de la prochaine validation : '.sha1(sha1_file(FILE_SAV).'<^>'.sha1_file(__FILE__).sha1_file('checkSum.php')); + } +else + { + if (isset($_GET['erase']) && $_GET['erase'] == $SUM) + print ' Trouvé
          Détection d\'une demande d\'effacement

          '; + elseif (!is_file(FILE_SAV)) + //print ' Introuvable

          '; + die (' Introuvable

          Arrêt de la vérification.'); + else + die(' ?

          Impossible de déterminer l\'origine de la requête !
          Arrêt de la vérification.'); + + function extractDir($dir) + { + $sums = array(); + + if (isset($_GET['v'])) + print "
          Génération des sommes de fichiers pour le dossier : ".$dir; + + $pointeur = opendir($dir); + while ($fichier = readdir($pointeur)) + { + if($fichier == '.' || $fichier == '..' || $fichier == '.svn' || ereg("~", $fichier)) + continue; + + if(is_dir($dir.$fichier) && is_readable($dir.$fichier)) + $sums = array_merge($sums, extractDir($dir.$fichier.'/')); + + elseif(is_file($dir.$fichier)) + $sums[$dir.$fichier] = sha1_file($dir.$fichier); + } + closedir($pointeur); + + return $sums; + } + + print 'Génération du tableau ...'; + $sums = array(); + + $sums = extractDir(dir_start); + + print "Écriture du fichier.
          "; + file_put_contents(FILE_SAV, serialize($sums)); + print "Fin de l'opération.
          "; + } +?> + + \ No newline at end of file diff --git a/htdocs/js/fonctions.js b/htdocs/js/fonctions.js deleted file mode 100644 index 5dd84be..0000000 --- a/htdocs/js/fonctions.js +++ /dev/null @@ -1,83 +0,0 @@ -function dateTempsReel() - { - var days = new Array('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'); - var months = new Array('Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'); - date = new Date; - date.setTime(date.getTime()); - var hour = date.getHours() < 10 ? '0'+date.getHours() : date.getHours(); - var min = date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes(); - var day = days[date.getDay()]; - var day_number = date.getDate(); - var month = months[date.getMonth()]; - var year = date.getFullYear(); - var datetime = day + ' ' + day_number + ' ' + month + ' '+year+' ' + hour + ':' + min; - if (document.getElementById('date')) document.getElementById('date').innerHTML= datetime; - setTimeout('dateTempsReel()', (60-date.getSeconds())*1000) - } - -function hide(o) - { - p = o.parentNode.nextSibling; - - if (p.style.display != 'none') - { - p.style.display ='none'; - o.style.backgroundPosition = '0 0'; - } - - else - { - p.style.display ='block'; - o.style.backgroundPosition = '0 100%'; - } - o.blur(); - } - -function checkboxes(v) - { - for (i=1; document.getElementsByName('m'+i)[0]; i++) - { - document.getElementsByName('m'+i)[0].checked = v; - } - } - -function checkboxesr(v) - { - for (i=1; document.getElementsByName('r'+i)[0]; i++) - { - document.getElementsByName('r'+i)[0].checked = v; - } - } - -function max(i) - { - document.getElementsByName('v'+i)[0].value = document.getElementById('v_'+i).innerHTML; - } - -function vaisseaux(b) - { - for(i=1; i<=12; i++) - { - if (document.getElementById('v_'+i) && document.getElementsByName('v'+i)[0]) document.getElementsByName('v'+i)[0].value = b ? document.getElementById('v_'+i).innerHTML : '0'; - } - } - -function reste(t,c,tf) { - - var r; - if (t>0) { - var heures = Math.floor(t / 3600); - var minutes = Math.floor(((t / 3600) - Math.floor(t / 3600)) * 60); - var secondes = t - ((Math.floor(t / 60)) * 60); - heures = heures < 10 ? '0'+heures : heures; - minutes = minutes < 10 ? '0'+minutes : minutes; - secondes = secondes < 10 ? '0'+secondes : secondes; - document.getElementById(c).innerHTML = heures + ":" + minutes + ":" + secondes; - var restant = t - 1; - if (tf) setTimeout("reste("+restant+",\""+c+"\", true)", 1000); - } - else { - document.getElementById(c).innerHTML = "Terminé"; - setTimeout(window.document.location.reload(),3000); - } -} \ No newline at end of file diff --git a/htdocs/js/game.js b/htdocs/js/game.js new file mode 100644 index 0000000..2f6e0f9 --- /dev/null +++ b/htdocs/js/game.js @@ -0,0 +1,126 @@ +function hide(o) + { + p = o.parentNode.nextSibling; + + if (p.style.display != 'none') + { + p.style.display ='none'; + o.style.backgroundPosition = '0 0'; + } + + else + { + p.style.display ='block'; + o.style.backgroundPosition = '0 100%'; + } + o.blur(); + } + +function checkboxes(v) + { + for (i=1; document.getElementsByName('m'+i)[0]; i++) + { + document.getElementsByName('m'+i)[0].checked = v; + } + } + +function checkboxesr(v) + { + for (i=1; document.getElementsByName('r'+i)[0]; i++) + { + document.getElementsByName('r'+i)[0].checked = v; + } + } + +function max(i) + { + document.getElementsByName('v'+i)[0].value = document.getElementById('v_'+i).innerHTML; + } + +function vaisseaux(b) + { + for(i=0; i<=12; i++) + { + if (document.getElementById('v_'+i) && document.getElementsByName('v'+i)[0]) document.getElementsByName('v'+i)[0].value = b ? document.getElementById('v_'+i).innerHTML : '0'; + } + } + +function reste(t,c,tf) { + + var r; + if (t>0) { + var heures = Math.floor(t / 3600); + var minutes = Math.floor(((t / 3600) - Math.floor(t / 3600)) * 60); + var secondes = t - ((Math.floor(t / 60)) * 60); + heures = heures < 10 ? '0'+heures : heures; + minutes = minutes < 10 ? '0'+minutes : minutes; + secondes = secondes < 10 ? '0'+secondes : secondes; + document.getElementById(c).innerHTML = heures + ":" + minutes + ":" + secondes; + var restant = t - 1; + if (tf) setTimeout("reste("+restant+",\""+c+"\", true)", 1000); + } + else { + document.getElementById(c).innerHTML = "Terminé"; + setTimeout(window.document.location.reload(),3000); + } +} + +function bind(funct) + { + var args = []; + for(var i = 1; i < arguments.length; i++) args[args.length] = arguments[i]; + return function(){funct.apply(this,args)}; + } + +function opacity(opacity) + { + this.style.opacity = opacity / 100; + this.style.MozOpacity = opacity / 100; + this.style.KhtmlOpacity = opacity / 100; + this.style.filter = "alpha(opacity="+ opacity +")"; + } + +function fadeIn(element,speed) + { + for(var i = 0; i <= 10; i++) setTimeout(bind(function(i){opacity.call(element,i*10)},i),i/10*speed); + } + +function fadeOut(element,speed) + { + for(var i = 0; i <= 10; i++) setTimeout(bind(function(i){opacity.call(element,i*10)},10-i),i/10*speed); + } + +var loop = function() + { + if(current > 0) + { + fadeOut(leftBanners[current],1000); + current--; + } + else if(current == 0) + { + fadeIn(leftBanners[leftBanners.length - 1],1000); + setTimeout(function() + { + for(var i = 1; i < leftBanners.length - 1; i++) opacity.call(leftBanners[i],100); + + current = leftBanners.length - 1; + + },1010); + } + else return; + + setTimeout(loop,8000); + } + +window.onload = function() + { + banners = document.getElementById('banner').getElementsByTagName('div'); + + leftBanners = []; + for(var i = 0; i < banners.length; i++) if(banners[i].getAttribute('class') == 'bannerleft') leftBanners.push(banners[i]); + + current = leftBanners.length - 1; + + if(leftBanners.length > 1) setTimeout(loop,8000); + } \ No newline at end of file diff --git a/htdocs/js/infos.js b/htdocs/js/infos.js deleted file mode 100644 index d704921..0000000 --- a/htdocs/js/infos.js +++ /dev/null @@ -1,62 +0,0 @@ -function first(nombre){ - for(i = 1; i <= nombre; i++) { - var object = document.getElementById('quadri' + i).style; - object.opacity = (0); - object.MozOpacity = (0); - object.KhtmlOpacity = (0); - object.filter = "alpha(opacity=" + 0 + ")"; - } - if (nombre > 0) setTimeout("appel('-1','" + nombre + "')",3333); -} - -function appel(num, max) { - num++; - - if (num >= max) { - numb = 0; - numa = max; - num = -1; - } - else { - numa = num; - numb = num + 1; - } - - if (max > 0) { - opacity('quadri' + numa, 'quadri' + numb, 100, 0, 1000); - setTimeout("appel(" + num + ",'" + max + "')",3333); - } -} - -function opacity(id, idd, opacStart, opacEnd, millisec) { - //speed for each frame - var speed = Math.round(millisec / 100); - var timer = 0; - - //determine the direction for the blending, if start and end are the same nothing happens - if(opacStart > opacEnd) { - for(i = opacStart; i >= opacEnd; i--) { - setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); - j = opacStart - i; - setTimeout("changeOpac(" + j + ",'" + idd + "')",(timer * speed)); - timer++; - } - } else if(opacStart < opacEnd) { - for(i = opacStart; i <= opacEnd; i++) - { - setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); - j = opacEnd - i; - setTimeout("changeOpac(" + j + ",'" + idd + "')",(timer * speed)); - timer++; - } - } -} - -//change the opacity for different browsers -function changeOpac(opacity, id) { - var object = document.getElementById(id).style; - object.opacity = (opacity / 100); - object.MozOpacity = (opacity / 100); - object.KhtmlOpacity = (opacity / 100); - object.filter = "alpha(opacity=" + opacity + ")"; -} \ No newline at end of file diff --git a/htdocs/l4H1ev9IwDs40/connexion.php b/htdocs/l4H1ev9IwDs40/connexion.php new file mode 100644 index 0000000..226c551 --- /dev/null +++ b/htdocs/l4H1ev9IwDs40/connexion.php @@ -0,0 +1,60 @@ + time())); + + elseif(in_array($login,$connected)) exit(header("Location: preview.php")); + + else + { + $connected[$login] = time(); + Cache::set('preview_connected',$connected); + } + + + $session->values = array('login' => $login); + $session->level = 1; + $session->put($login); + + exit(header("Location: preview.php")); + } + } + $message = 'login ou mot de passe incorrect'; + } + +?> + + + +Connexion + + + +
          +
          +
          +
          + +
          +
          +
          + + \ No newline at end of file diff --git a/htdocs/l4H1ev9IwDs40/css/connexion.css b/htdocs/l4H1ev9IwDs40/css/connexion.css new file mode 100644 index 0000000..15a1cf4 --- /dev/null +++ b/htdocs/l4H1ev9IwDs40/css/connexion.css @@ -0,0 +1,80 @@ +* +{ +margin: 0; +padding: 0; +border: 0; +} + +html, body +{ +height: 100%; +font-size: 100%; +} + +body +{ +background: #000 url(img/connexion.jpg) no-repeat fixed center; +color: #0CC2EF; +font-size: 0.7em; +font-family: "arial"; +} + +form +{ +position: relative; +bottom: 240px; +height: 100%; +} + +fieldset +{ +position: relative; +top: 50%; +width: 640px; +height: 380px; +margin: 0 auto; +text-align: right; +padding-top: 100px; +} + +label +{ +display: block; +position: relative; +right: 50%; +margin: 10px 0; +} + +input#login, input#password +{ +padding: 1px 2px; +background-color: #121843; +border: #0096FF 1px solid; +width: 150px; +color: #0CC2EF; +} + +input#submit +{ +background-color: #000; +color: #0CC2EF; +border: 1px solid #0A3473; +border-top-color: #000; +border-left-color: #000; +position: relative; +right: 50%; +padding: 1px 5px; +cursor: pointer; +} + +input#submit:hover, input#submit:focus +{ +border: 1px solid #0CC2EF; +} + +div +{ +position: relative; +right: 80px; +top: 150px; +} \ No newline at end of file diff --git a/htdocs/l4H1ev9IwDs40/css/img/Thumbs.db b/htdocs/l4H1ev9IwDs40/css/img/Thumbs.db new file mode 100644 index 0000000..4f831fc Binary files /dev/null and b/htdocs/l4H1ev9IwDs40/css/img/Thumbs.db differ diff --git a/htdocs/l4H1ev9IwDs40/css/img/bottom.gif b/htdocs/l4H1ev9IwDs40/css/img/bottom.gif new file mode 100644 index 0000000..ecc735a Binary files /dev/null and b/htdocs/l4H1ev9IwDs40/css/img/bottom.gif differ diff --git a/htdocs/l4H1ev9IwDs40/css/img/bottomleft.gif b/htdocs/l4H1ev9IwDs40/css/img/bottomleft.gif new file mode 100644 index 0000000..4ed1078 Binary files /dev/null and b/htdocs/l4H1ev9IwDs40/css/img/bottomleft.gif differ diff --git a/htdocs/l4H1ev9IwDs40/css/img/bottomright.gif b/htdocs/l4H1ev9IwDs40/css/img/bottomright.gif new file mode 100644 index 0000000..5ebcce0 Binary files /dev/null and b/htdocs/l4H1ev9IwDs40/css/img/bottomright.gif differ diff --git a/htdocs/l4H1ev9IwDs40/css/img/buttons.gif b/htdocs/l4H1ev9IwDs40/css/img/buttons.gif new file mode 100644 index 0000000..53be923 Binary files /dev/null and b/htdocs/l4H1ev9IwDs40/css/img/buttons.gif differ diff --git a/htdocs/l4H1ev9IwDs40/css/img/close.gif b/htdocs/l4H1ev9IwDs40/css/img/close.gif new file mode 100644 index 0000000..4018329 Binary files /dev/null and b/htdocs/l4H1ev9IwDs40/css/img/close.gif differ diff --git a/htdocs/l4H1ev9IwDs40/css/img/connexion.jpg b/htdocs/l4H1ev9IwDs40/css/img/connexion.jpg new file mode 100644 index 0000000..51f16ec Binary files /dev/null and b/htdocs/l4H1ev9IwDs40/css/img/connexion.jpg differ diff --git a/htdocs/l4H1ev9IwDs40/css/img/edges.gif b/htdocs/l4H1ev9IwDs40/css/img/edges.gif new file mode 100644 index 0000000..542d81c Binary files /dev/null and b/htdocs/l4H1ev9IwDs40/css/img/edges.gif differ diff --git a/htdocs/l4H1ev9IwDs40/css/img/full.gif b/htdocs/l4H1ev9IwDs40/css/img/full.gif new file mode 100644 index 0000000..61c0fa4 Binary files /dev/null and b/htdocs/l4H1ev9IwDs40/css/img/full.gif differ diff --git a/htdocs/l4H1ev9IwDs40/css/img/hide.gif b/htdocs/l4H1ev9IwDs40/css/img/hide.gif new file mode 100644 index 0000000..4775e57 Binary files /dev/null and b/htdocs/l4H1ev9IwDs40/css/img/hide.gif differ diff --git a/htdocs/l4H1ev9IwDs40/css/img/top.gif b/htdocs/l4H1ev9IwDs40/css/img/top.gif new file mode 100644 index 0000000..87e2b4b Binary files /dev/null and b/htdocs/l4H1ev9IwDs40/css/img/top.gif differ diff --git a/htdocs/l4H1ev9IwDs40/css/img/topleft.gif b/htdocs/l4H1ev9IwDs40/css/img/topleft.gif new file mode 100644 index 0000000..a96ea03 Binary files /dev/null and b/htdocs/l4H1ev9IwDs40/css/img/topleft.gif differ diff --git a/htdocs/l4H1ev9IwDs40/css/img/topright.gif b/htdocs/l4H1ev9IwDs40/css/img/topright.gif new file mode 100644 index 0000000..7131cd0 Binary files /dev/null and b/htdocs/l4H1ev9IwDs40/css/img/topright.gif differ diff --git a/htdocs/l4H1ev9IwDs40/css/preview.css b/htdocs/l4H1ev9IwDs40/css/preview.css new file mode 100644 index 0000000..11ffdec --- /dev/null +++ b/htdocs/l4H1ev9IwDs40/css/preview.css @@ -0,0 +1,449 @@ +* +{ +margin: 0; +padding: 0; +border: 0; +outline: 0; +} + +html, body +{ +height: 100%; +width: 100%; +font-size: 100%; +overflow: hidden; +} + +body +{ +background-color: #000; +text-align: left; +font-family: Arial; +color: #4475EF; +} + +button +{ +font-weight: bold; +font-size: 0.9em; +padding: 2px 8px; +background-color: #000; +border: #4475EF 1px solid; +border-right-width: 2px; +border-bottom-width: 2px; +color: #4475EF; +cursor: pointer; +} + +button:hover, button:focus +{ +background-color: #4475EF; +color: #000; +} + +p +{ +font-family: "Tahoma"; +text-align: justify; +font-size: 0.8em; +line-height: 1.4em; +word-spacing: 1px; +} + +#start +{ +position: absolute; +top: 45%; +left: 0; +width: 100%; +font-size: 1.1em; +text-align: center; +} + +.window +{ +position: absolute; +top: 10%; +left: 25%; +width: 50%; +height: 60%; +} + +.window .top, .window .bottom +{ +height: 3px; +position: relative; +font-size: 1px; +left: 0; +} + +.window .top +{ +top: 0; +} + +.window .bottom +{ +bottom: 0; +} + +.window .top .topcenter, .window .bottom .bottomcenter +{ +display: block; +margin: 0 3px; +height: 2px; +background-color: #000; +} + +.window .top .topcenter +{ +border-top: 1px #4475EF solid; +} + +.window .bottom .bottomcenter +{ +border-bottom: 1px #4475EF solid; +} + + +.window .top .topleft, .window .top .topright, .window .bottom .bottomleft, .window .bottom .bottomright +{ +height: 3px; +width: 3px; +position: absolute; +top: 0; +background: transparent url(img/edges.gif) no-repeat; +} + +.window .top .topleft +{ +left: 0; +background-position: 0 0; +} + +.window .top .topright +{ +right: 0; +background-position: -3px 0; +} + +.window .bottom .bottomleft +{ +left: 0; +background-position: 0 -3px; +} + +.window .bottom .bottomright +{ +right: 0; +background-position: -3px -3px; +cursor: se-resize; +} + +.window .barre +{ +height: 13px; +border-left: #4475EF 1px solid; +border-right: #4475EF 1px solid; +border-bottom: #273A6C 1px solid; +background-color: #000; +} + +.window .barre:active, .window .barre:focus +{ +cursor: move; +} + +.window .barre .button +{ +float: right; +margin-right: 10px; +height: 10px; +} + +.window .barre .button * +{ +float: left; +width: 20px; +height: 10px; +margin: 0 2px; +background: transparent none no-repeat 0 0; +overflow: hidden; +cursor: pointer; +background: transparent url(img/buttons.gif) no-repeat; +} + +.window .barre .button .close +{ +background-position: -40px 0; +} + +.window .barre .button .close:hover +{ +background-position: -40px 100%; +} + +.window .barre .button .full +{ +background-position: -20px 0; +} + +.window .barre .button .full:hover +{ +background-position: -20px 100%; +} + +.window .barre .button .hide +{ +background-position: 0 0; +} + +.window .barre .button .hide:hover +{ +background-position: 0 100%; +} + +.window .barre .titre +{ +font-size: 11px; +color: #4475EF; +font-weight: bold; +float: left; +padding-left: 20px; +position: relative; +bottom: 2px; +} + +.window .content +{ +position: relative; +border-left: #4475EF 1px solid; +border-right: #4475EF 1px solid; +overflow: auto; +height: 100%; +padding: 10px; +text-align: justify; +clear: both; +font-size: 0.9em; +background-color: #000; +} + +#barre +{ +position: absolute; +z-index: 200000; +bottom: 0; +left: 0; +width: 100%; +height: 23px; +border-top: #273A6C 1px solid; +background-color: #000; +} + +#barre div +{ +float: left; +padding: 1px 10px; +width: 150px; +font-size: 11px; +color: #4475EF; +height: 13px; +font-weight: bold; +margin: 3px 2px 0 2px; +border: #4475EF 1px solid; +overflow: hidden; +cursor: pointer; +text-align: center; +} + +#barre div:hover +{ +background-color: #4475EF; +color: #000; +} + +#menu +{ +position: absolute; +top: 10%; +left: 5%; +} + +#menu li +{ +list-style-type: none; +font-weight: bold; +margin: 10px 0; +padding: 8px 20px; +cursor: pointer; +border: #273A6C 1px dotted; +font-size: 0.9em; +font-family: "Trebuchet MS"; +} + +#menu li:hover +{ +border-color: #4475EF; +} + +#darkness +{ +position: absolute; +z-index: 300000; +width: 100%; +height: 100%; +background-color: #000; +filter: alpha(opacity=0); +-moz-opacity: 0; +-khtml-opacity: 0; +opacity: 0; +} + +#dialog +{ +position: absolute; +z-index: 400000; +padding: 2% 3%; +width: 20%; +left: 37%; +top: 35%; +background-color: #000; +text-align: center; +font-size: 14px; +font-weight: bold; +border: #4475EF 1px solid; +-moz-border-radius: 3px; +-webkit-border-radius: 3px; +} + +#dialog button +{ +float: right; +margin: 15px 0 0 20px; +} + +#dialog .quit +{ +display: block; +position: absolute; +top: 4px; +right: 4px; +width: 20px; +height: 10px; +background: #000 url(img/buttons.gif) no-repeat -40px 0; +cursor: pointer; +overflow: hidden; +} + +#dialog .quit:hover +{ +background-position: -40px 100%; +} + +p#notification +{ +position: absolute; +z-index: 100000; +right: 10px; +bottom: -110px; +width: 250px; +height: 100px; +padding: 10px 20px; +background-color: #000; +border: #4475EF 1px solid; +color: #4475EF; +font-weight: bold; +text-align: center; +-moz-border-radius: 4px; +-webkit-border-radius: 4px; +} + +.window div#mainWindow dl +{ +margin: 10px 0; +} + +.window div#mainWindow dl dt +{ +font-weight: bold; +float: left; +clear: left; +} + +.window div#mainWindow dl dd +{ +float: left; +clear: left; +margin-left: 10px; +padding: 1px 5px; +} + +.window div#mainWindow dl.connected dd +{ +cursor: pointer; +} + +.window div#mainWindow dl.connected dd:hover, .window div#mainWindow dl.connected dd:focus +{ +color: #000; +background-color: #4475EF; +} + +.window div#mainWindow dl.disconnected dd +{ +font-style: italic; +font-size: 0.9em; +} + +.window div.conversation +{ +height: 100%; +} + +.window div.conversation p +{ +height: 58%; +width: 96%; +border: #273A6C 1px solid; +margin: 1% auto; +overflow: auto; +padding: 1%; +} + +.window div.conversation textarea +{ +display: block; +width: 96%; +height: 23%; +background-color: #000; +border: #273A6C 1px solid; +margin: 1% auto; +color: #273A6C; +padding: 1%; +} + +* html .window div.conversation textarea +{ +color: #4475EF; +} + +.window div.conversation textarea:focus +{ +border-color: #4475EF; +color: #4475EF; +} + +.window div.conversation button +{ +display: block; +margin: 0 auto; +} + +#resize +{ +border: #4475EF 1px solid; +position: absolute; +top: 0; +left: 0; +z-index: 100000000; +} \ No newline at end of file diff --git a/htdocs/l4H1ev9IwDs40/login.list b/htdocs/l4H1ev9IwDs40/login.list new file mode 100644 index 0000000..19bd891 --- /dev/null +++ b/htdocs/l4H1ev9IwDs40/login.list @@ -0,0 +1,6 @@ +bob:45723a2af3788c4ff17f8d1114760e62 +todd:45723a2af3788c4ff17f8d1114760e62 +O_o:45723a2af3788c4ff17f8d1114760e62 +Dave:45723a2af3788c4ff17f8d1114760e62 +Johnson:45723a2af3788c4ff17f8d1114760e62 +><:45723a2af3788c4ff17f8d1114760e62 \ No newline at end of file diff --git a/htdocs/l4H1ev9IwDs40/preview.php b/htdocs/l4H1ev9IwDs40/preview.php new file mode 100644 index 0000000..50932a1 --- /dev/null +++ b/htdocs/l4H1ev9IwDs40/preview.php @@ -0,0 +1,74 @@ +level != 1) + { + exit(header("Location: connexion.php")); + } + +$pseudo = $session->values['login']; + +/* Vire les personnes inactives */ + +$connected = Cache::read('preview_connected'); + +$connected[$pseudo] = time(); + +foreach($connected as $guy => $time) + { + if($time < time() - 300) unset($connected[$guy]); #Désactive la session au bout de 5min. + } + +Cache::set('preview_connected',$connected); + +/* Lance le document XML */ + +header('Content-Type: application/xml;charset=utf-8'); + +$dom = new DOMDocument(); + +$interface = $dom->createElement('interface'); + +$dom->appendChild($interface); + +$logout = gpc('logout'); + +if($logout === '1') + { + $session->close(); + + $interface->setAttributeNode(new DOMAttr('status', '0')); + die($dom->saveXML()); + } + +$interface->setAttributeNode(new DOMAttr('status', '1')); +$interface->setAttributeNode(new DOMAttr('pseudo', $pseudo)); + +/* affiche les personnes connectés */ + +$main = $dom->createElement('main'); + +$interface->appendChild($main); + +$everybody = array(); +$logins = file('login.list'); + foreach($logins as $line) + { + $acces = explode(':',$line); + $everybody[] = $acces[0]; + } + +foreach($everybody as $guy) + { + if($guy == $pseudo) continue; + + if(isset($connected[$guy])) $main->appendChild($dom->createElement('connected',$guy)); + else $main->appendChild($dom->createElement('disconnected',$guy)); + } + +echo($dom->saveXML()); + +?> \ No newline at end of file diff --git a/htdocs/lectlog.php b/htdocs/lectlog.php index ed6a5b3..bd1bca2 100644 --- a/htdocs/lectlog.php +++ b/htdocs/lectlog.php @@ -1,26 +1,91 @@ + + + .: Halo-Battle :: Lecteur de log :. + + + +

          Lecteur de log HB

          'bourse', -'__utmz' => '171938809.1224845136.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)', -'hbsession' => 'prshcsPTkJRtEAFPm9suAfTh2KhkRdk1r/Iyp/uJM8A=', -'__utma' => '171938809.2035284058.1225486044.1225803239.1225813154.17', -'__utmc' => '171938809', -'__utmb' => '171938809.17.10.1225813154', -) [86.220.42.240] [GET] -[16:55:14] MESSAGE : array ( -'p' => 'bourse', -'__utmz' => '171938809.1225812444.2.2.utmcsr=halo-battle.fr|utmccn=(referral)|utmcmd=referral|utmcct=/', -'hbsession' => 'D5q6K8yTr6/+mnMGR0zTTLc53x0yqFGC9zsa+qntzww=', -'__utma' => '171938809.85178107.1225810207.1225810207.1225812444.2', -'__utmc' => '171938809', -'__utmb' => '171938809.172.10.1225812444', -) [77.203.214.152] [GET] -"; +define('dir', '../onyx/logs'); -$exp = '#^[\\d{2}:\\d{2}:\\d{2}] \\w{6,13} : .{0,500} [\\d{1,3}.\\d{1,3}.\\d{1,3}.\\d{1,3}] [\\w{3,4}]$#ui'; -$exp = '#^[\\d](\\[(\\w{0,30})\\])?\\s?\:\\s?"(.{0,500})"$#ui'; +if(!is_dir(dir)) die('Dossier introuvable !'); -preg_match_all($exp,trim($conf_value),$m); +if (empty($_GET['file']) || is_dir(dir.$_GET['file'])) { + if (!empty($_GET['file']) && str_replace("..", '' , $_GET['file']) != $_GET['file']) die('Accès au fichier non autorisé !'); + elseif (empty($_GET['file'])) $_GET['file'] = ''; -var_dump($m); -?> \ No newline at end of file + $pointeur = opendir(dir.$_GET['file']); + print 'Dossier en cours : '.dir.$_GET['file'].'

          '; + while ($fichier = readdir($pointeur)) { + if($fichier == '.' || $fichier == '..') continue; + + print ''.$fichier.'
          '; + } +} +else { + if (!empty($_GET['file']) && str_replace("..", '' , $_GET['file']) != $_GET['file']) die('Accès au fichier non autorisé !'); + $file = dir.$_GET['file']; + + print '

          Fichier : '.$file.'


          '; + + if(!is_file($file)) die('Fichier introuvable !'); + + $fichier = @fopen($file,'r+'); + $contenu_log = fread($fichier,filesize($file)); + fclose($fichier); + + $exp = "#\[(\d{2}:\d{2}:\d{2})\] (\\w{6,13}) : ([^\[]{0,1000}) \[(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})\] \[(\w{3,4})\] \[/([^\[]{1,200})\] \[([^\[]{0,200})\] \[([^\[]{0,75})\]#ui"; + + preg_match_all($exp,htmlentities(trim(str_replace("\n", ' ', $contenu_log))),$m); + + if (empty($m[0][0])) { + print '
          '.$contenu_log.'
          '; + } + else { + print ' + + + + + + + + + '; + foreach($m[0] as $key => $lign) { + if (ereg('array', $m[3][$key])) { + $exp = "#array \(( '(.{1,10})' => '([^',]{0,1000})',)( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?#ui"; + + preg_match_all($exp,$m[3][$key],$mArray); + + $m[3][$key] = ''; + foreach($mArray as $k => $lign) { + if ($k == 0 || $k%3 == 1) continue; + + if ($lign[0] == "") break; + if ($k%3 == 2) $m[3][$key] .= ''.$lign[0].' : '; + else $m[3][$key] .= (strlen($lign[0])>80?''.substr($lign[0],0,77).'...':$lign[0]).'
          '; + } + } + + if ($m[2][$key] == "ERREUR") print ''; + elseif ($m[2][$key] == "AVERTISSEMENT") print ''; + else print ''; + print ' + + + + + '; + } + print '
          DateTypeMessageIP + ...
          '.$m[1][$key].'
          '.$m[5][$key].'
          '.$m[2][$key].'
          '.(strlen($m[6][$key])>30?''.substr($m[6][$key],0,27).'...':$m[6][$key]).'
          '.$m[3][$key].''.$m[4][$key].'
          '.$m[8][$key].'
          '; + } +} +?> + + \ No newline at end of file diff --git a/htdocs/n3p7bLn59Yco3d/.htaccess b/htdocs/n3p7bLn59Yco3d/.htaccess new file mode 100644 index 0000000..17019d2 --- /dev/null +++ b/htdocs/n3p7bLn59Yco3d/.htaccess @@ -0,0 +1,4 @@ +AuthName "Here is Dave" +AuthType Basic +AuthUserFile "/var/www/virtual/hb.s-fr.com/htdocs/n3p7bLn59Yco3d/.htpasswd" +Require valid-user \ No newline at end of file diff --git a/htdocs/n3p7bLn59Yco3d/.htpasswd b/htdocs/n3p7bLn59Yco3d/.htpasswd new file mode 100644 index 0000000..2a822aa --- /dev/null +++ b/htdocs/n3p7bLn59Yco3d/.htpasswd @@ -0,0 +1 @@ +Dave:$1$XyqNbevU$7uqBE0zkcfWGH1/b5h9fe/ \ No newline at end of file diff --git a/htdocs/n3p7bLn59Yco3d/css/images/Thumbs.db b/htdocs/n3p7bLn59Yco3d/css/images/Thumbs.db new file mode 100644 index 0000000..b9d6656 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/Thumbs.db differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/background.gif b/htdocs/n3p7bLn59Yco3d/css/images/background.gif new file mode 100644 index 0000000..754463b Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/background.gif differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/barre.gif b/htdocs/n3p7bLn59Yco3d/css/images/barre.gif new file mode 100644 index 0000000..eae4d29 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/barre.gif differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/bottom.gif b/htdocs/n3p7bLn59Yco3d/css/images/bottom.gif new file mode 100644 index 0000000..ec39b70 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/bottom.gif differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/bottomleft.png b/htdocs/n3p7bLn59Yco3d/css/images/bottomleft.png new file mode 100644 index 0000000..fdc7920 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/bottomleft.png differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/bottomright.png b/htdocs/n3p7bLn59Yco3d/css/images/bottomright.png new file mode 100644 index 0000000..4efa441 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/bottomright.png differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/cancel.gif b/htdocs/n3p7bLn59Yco3d/css/images/cancel.gif new file mode 100644 index 0000000..a8c0fbe Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/cancel.gif differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/close.gif b/htdocs/n3p7bLn59Yco3d/css/images/close.gif new file mode 100644 index 0000000..b5091c2 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/close.gif differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/down.gif b/htdocs/n3p7bLn59Yco3d/css/images/down.gif new file mode 100644 index 0000000..ae729c3 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/down.gif differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/full.gif b/htdocs/n3p7bLn59Yco3d/css/images/full.gif new file mode 100644 index 0000000..738d1b3 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/full.gif differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/hide.gif b/htdocs/n3p7bLn59Yco3d/css/images/hide.gif new file mode 100644 index 0000000..0a520dc Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/hide.gif differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/li.gif b/htdocs/n3p7bLn59Yco3d/css/images/li.gif new file mode 100644 index 0000000..8a57de7 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/li.gif differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/li2.gif b/htdocs/n3p7bLn59Yco3d/css/images/li2.gif new file mode 100644 index 0000000..1dac042 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/li2.gif differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/top.gif b/htdocs/n3p7bLn59Yco3d/css/images/top.gif new file mode 100644 index 0000000..3e82584 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/top.gif differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/topleft.png b/htdocs/n3p7bLn59Yco3d/css/images/topleft.png new file mode 100644 index 0000000..0a80787 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/topleft.png differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/topright.png b/htdocs/n3p7bLn59Yco3d/css/images/topright.png new file mode 100644 index 0000000..7d7b897 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/topright.png differ diff --git a/htdocs/n3p7bLn59Yco3d/css/images/up.gif b/htdocs/n3p7bLn59Yco3d/css/images/up.gif new file mode 100644 index 0000000..bb0119f Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/css/images/up.gif differ diff --git a/htdocs/n3p7bLn59Yco3d/css/style.css b/htdocs/n3p7bLn59Yco3d/css/style.css new file mode 100644 index 0000000..6a5ce67 --- /dev/null +++ b/htdocs/n3p7bLn59Yco3d/css/style.css @@ -0,0 +1,625 @@ +* +{ +margin: 0; +padding: 0; +border: 0; +outline: 0; +} + +html, body +{ +height: 100%; +width: 100%; +font-size: 100%; +overflow: hidden; +} + +body +{ +background: #A7A7A7 url(images/background.gif) repeat-y center; +text-align: left; +font-family: Arial; +color: #000; +} + +a +{ +text-decoration: none; +font-weight: bold; +} + +a:link +{ +color: #383838; +text-decoration: underline; +} + +a:hover, a:active +{ +color: #000; +text-decoration: none; +} + +a:visited, a:visited:hover +{ +color: #545454; +} + +p a:hover, p a:active +{ +text-decoration: underline; +} + +acronym, abbr +{ +border-bottom: dotted 1px; +cursor: help; +} + +h1,h2,h3,h4,h5,h6 +{ +font-weight: bold; +} + +h1 +{ +font-size: 2em; +} + +h2 +{ +font-size: 1.5em; +} + +h3 +{ +font-size: 1.4em; +} + +h4 +{ +font-size: 1.2em; +} + +h5 +{ +font-size: 1.1em; +} + +h6 +{ +font-size: 1em; +} + +p +{ +font-family: "Tahoma"; +text-align: justify; +font-size: 0.8em; +line-height: 1.4em; +word-spacing: 1px; +} + +button +{ +background-color: #FFF; +border: 1px #000 solid; +border-bottom-width: 2px; +border-right-width: 2px; +padding: 2px 6px; +cursor: pointer; +font-weight: bold; +} + +button:hover, button:active +{ +color: #FFF; +background-color: #000; +} + +input +{ +border: #000 solid 1px; +padding: 1px; +margin: 1px; +background-color: #FFF; +} + +#start +{ +position: absolute; +top: 45%; +left: 0; +width: 100%; +font-size: 1.1em; +text-align: center; +} + +.window +{ +position: absolute; +top: 10%; +left: 25%; +width: 50%; +height: 60%; +} + +.window .top, .window .bottom +{ +height: 6px; +position: relative; +font-size: 1px; +left: 0; +} + +.window .top +{ +top: 0; +} + +.window .bottom +{ +bottom: 0; +} + +.window .top .topcenter +{ +display: block; +margin: 0 6px; +height: 6px; +background: transparent url(images/top.gif) repeat-x 0 0; +cursor: n-resize; +} + +.window .bottom .bottomcenter +{ +display: block; +margin: 0 6px; +height: 6px; +background: transparent url(images/bottom.gif) repeat-x 0 0; +cursor: n-resize; +} + + +.window .top .topleft, .window .top .topright, .window .bottom .bottomleft, .window .bottom .bottomright +{ +height: 6px; +width: 6px; +position: absolute; +top: 0; +} + +.window .top .topleft +{ +left: 0; +background: transparent url(images/topleft.png) no-repeat 0 0; +cursor: nw-resize; +} + +.window .top .topright +{ +right: 0; +background: transparent url(images/topright.png) no-repeat 0 0; +cursor: ne-resize; +} + +.window .bottom .bottomleft +{ +left: 0; +background: transparent url(images/bottomleft.png) no-repeat 0 0; +cursor: sw-resize; +} + +.window .bottom .bottomright +{ +right: 0; +background: transparent url(images/bottomright.png) no-repeat 0 0; +cursor: se-resize; +} + +.window .barre +{ +height: 17px; +background: #5D5D5D url(images/barre.gif) repeat-x 0 0; +border-left: #707070 1px solid; +border-right: #707070 1px solid; +} + +.window .barre:active, .window .barre:focus +{ +cursor: move; +} + +.window .barre .button +{ +float: right; +margin-right: 10px; +height: 13px; +} + +.window .barre .button * +{ +float: left; +width: 30px; +height: 13px; +margin: 0 2px; +background: transparent none no-repeat 0 0; +overflow: hidden; +cursor: pointer; +} + +.window .barre .button *:hover +{ +background-position: 0 -13px; +} + +.window .barre .button *:active +{ +background-position: 0 -26px; +} + +.window .barre .button .close +{ +background-image: url(images/close.gif); +} + +.window .barre .button .full +{ +background-image: url(images/full.gif); +} + +.window .barre .button .hide +{ +background-image: url(images/hide.gif); +} + +.window .barre .titre +{ +font-size: 14px; +color: #FFF; +font-weight: bold; +float: left; +padding-left: 20px; +position: relative; +bottom: 3px; +} + +.window .content +{ +position: relative; +border-left: #707070 1px solid; +border-right: #707070 1px solid; +overflow: auto; +height: 100%; +background-color: #FFFFFF; +padding: 10px; +text-align: justify; +clear: both; +} + +#barre +{ +position: absolute; +z-index: 200000; +bottom: 0; +left: 0; +width: 100%; +background-color: #4D4D4D; +height: 25px; +border-top: #FFF 1px solid; +} + +#barre div +{ +float: left; +padding: 1px 10px; +width: 150px; +font-size: 13px; +color: #BCBCBC; +height: 15px; +font-weight: bold; +margin: 3px 2px 0 2px; +border: #282828 1px solid; +overflow: hidden; +cursor: pointer; +text-align: center; +} + +#barre div:hover +{ +background-color: #393939; +color: #FFFFFF; +} + +#menu +{ +position: absolute; +top: 10%; +left: 0; +} + +#menu li +{ +list-style-type: none; +width: 180px; +font-size: 13px; +font-weight: bold; +color: #000; +background-color: #FFF; +margin: 3px 0 3px 10px; +padding: 3px 0 3px 20px; +text-align: left; +cursor: pointer; +border-left: 3px solid #FFF; +} + +#menu li:hover +{ +border-color: #000; +} + +#darkness +{ +position: absolute; +z-index: 100000; +width: 100%; +height: 100%; +background-color: #000; +filter: alpha(opacity=0); +-moz-opacity: 0; +-khtml-opacity: 0; +opacity: 0; +} + +#dialog +{ +position: absolute; +z-index: 100000; +padding: 2% 3%; +width: 20%; +left: 37%; +top: 35%; +background-color: #FFF; +text-align: center; +font-size: 14px; +font-weight: bold; +-moz-border-radius: 3px; +-webkit-border-radius: 3px; +} + +#dialog button +{ +float: right; +margin: 15px 0 0 20px; +} + +#dialog .quit +{ +display: block; +position: absolute; +top: 3px; +right: 3px; +width: 12px; +height: 12px; +background: #FFF url(images/cancel.gif) no-repeat 0 0; +cursor: pointer; +overflow: hidden; +} + +#dialog .quit:hover +{ +background-position: 0 -12px; +} + +#ressources +{ +position: absolute; +top: 0; +left: 0; +padding-left: 5%; +width: 95%; +font-size: 0.8em; +} + +#ressources div +{ +text-align: center; +float: left; +padding: 4px 0; +width: 18%; +background-color: #FFF; +border: 1px solid #000; +border-top-width: 0; +margin: 0 2%; +font-weight: bold; +-moz-border-radius-bottomleft: 4px; +-moz-border-radius-bottomright: 4px; +-webkit-border-bottom-left-radius: 4px; +-webkit-border-bottom-right-radius: 4px; +} + +#ressources div strong +{ +font-weight: normal; +} + +#planetes +{ +position: absolute; +top: 10%; +right: 20px; +width: 100px; +} + +#planetes .up, #planetes .down +{ +display: block; +width: 15px; +height: 15px; +background: transparent url(images/up.gif) no-repeat 0 0; +cursor: pointer; +margin: 0 auto; +} + +#planetes .up:hover, #planetes .down:hover +{ +background-position: 0 100%; +} + +#planetes .down +{ +background-image: url(images/down.gif); +} + +#planetes img +{ +display: block; +height: 75px; +width: 75px; +border: 1px solid #000; +cursor: pointer; +margin: 10px auto; +} + +#planetes img:hover +{ +border-color: #FFF; +} + +#planetes img.selected +{ +border: 3px #FFF solid; +} + +p#notification +{ +position: absolute; +z-index: 100000; +right: 10px; +bottom: -110px; +width: 250px; +height: 100px; +padding: 10px 20px; +background-color: #000; +color: #FFF; +font-weight: bold; +text-align: center; +filter: alpha(opacity=80); +-moz-opacity: 0.8; +-khtml-opacity: 0.8; +opacity: 0.8; +-moz-border-radius: 2px; +-webkit-border-radius: 2px; +} + +.window dl.menu +{ +width: 30%; +height: 97%; +padding-top: 2%; +float: left; +list-style-type: none; +background-color: #F2F2F2; +font-size: 0.8em; +} + +.window dl.menu dt +{ +font-weight: bold; +font-size: 1.2em; +padding-left: 2%; +margin-bottom: 8px; +} + +.window dl.menu dd +{ +margin: 0 0 1px 4%; +padding: 3px 0 3px 14px; +cursor: pointer; +background: transparent url(images/li.gif) no-repeat 0 center; +font-size: 0.9em; +font-weight: bold; +} + +.window dl.menu dd:hover, .window dl.menu dd.selected +{ +background: #FFF url(images/li2.gif) no-repeat 0 center; +} + +.window .description +{ +width: 70%; +float: right; +} + +.window .description h4 +{ +font-size: 0.9em; +padding-left: 10%; +float: left; +margin-top: 100px; +} + +.window .description img +{ +float: right; +margin: 5% 5% 25px 0; +cursor: help; +} + +.window .description p +{ +clear: both; +margin: 0 25px; +} + +.window .description button +{ +float: right; +margin: 20px 10% 0 0; +} + +.window .info +{ +text-align: center; +} + +#background +{ +position: absolute; +top: 25px; +left: 230px; +height: 100%; +width: 100%; +} + +#background .content +{ +border: 1px #8E8D8D dotted; +width: 100%; +height: 80%; +} + +#resize +{ +border: #000 1px solid; +position: absolute; +top: 0; +left: 0; +z-index: 100000000; +} + +#console +{ +position: absolute; +right: 2px; +bottom: 2px; +width: 50%; +height: 50%; +z-index: 100000000; +background-color: #000; +filter: alpha(opacity=80); +-moz-opacity: 0.8; +-khtml-opacity: 0.8; +opacity: 0.8; +} \ No newline at end of file diff --git a/htdocs/n3p7bLn59Yco3d/demo.html b/htdocs/n3p7bLn59Yco3d/demo.html new file mode 100644 index 0000000..2e2dd44 --- /dev/null +++ b/htdocs/n3p7bLn59Yco3d/demo.html @@ -0,0 +1,16 @@ + + + + +Dave + + + +
          + + + + + \ No newline at end of file diff --git a/htdocs/n3p7bLn59Yco3d/descriptions.xml b/htdocs/n3p7bLn59Yco3d/descriptions.xml new file mode 100644 index 0000000..bc267cc --- /dev/null +++ b/htdocs/n3p7bLn59Yco3d/descriptions.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/htdocs/n3p7bLn59Yco3d/images/Thumbs.db b/htdocs/n3p7bLn59Yco3d/images/Thumbs.db new file mode 100644 index 0000000..ca8e9ca Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/images/Thumbs.db differ diff --git a/htdocs/n3p7bLn59Yco3d/images/batiments/Thumbs.db b/htdocs/n3p7bLn59Yco3d/images/batiments/Thumbs.db new file mode 100644 index 0000000..3626507 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/images/batiments/Thumbs.db differ diff --git a/htdocs/n3p7bLn59Yco3d/images/batiments/cristal.png b/htdocs/n3p7bLn59Yco3d/images/batiments/cristal.png new file mode 100644 index 0000000..ebee289 Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/images/batiments/cristal.png differ diff --git a/htdocs/n3p7bLn59Yco3d/images/batiments/hydrogene.jpg b/htdocs/n3p7bLn59Yco3d/images/batiments/hydrogene.jpg new file mode 100644 index 0000000..11eba9a Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/images/batiments/hydrogene.jpg differ diff --git a/htdocs/n3p7bLn59Yco3d/images/batiments/metal.png b/htdocs/n3p7bLn59Yco3d/images/batiments/metal.png new file mode 100644 index 0000000..dfe823e Binary files /dev/null and b/htdocs/n3p7bLn59Yco3d/images/batiments/metal.png differ diff --git a/htdocs/n3p7bLn59Yco3d/js/animations.js b/htdocs/n3p7bLn59Yco3d/js/animations.js new file mode 100644 index 0000000..74920c1 --- /dev/null +++ b/htdocs/n3p7bLn59Yco3d/js/animations.js @@ -0,0 +1,225 @@ +function create(type,parent,id,classe) + { + var element = document.createElement(type); + if(id && !$(id)) element.setAttribute('id',id); + if(classe) Element.addClassName(element,classe); + if(parent) element = $(parent).appendChild(element); + return element; + } + +var Effect = + { + queue : [], + + hide : function(element) + { + element.style.display = 'none'; + + return element; + }, + + show : function(element) + { + element.style.display = ''; + + return element; + }, + + opacity : function(element,opacity) + { + element.style.opacity = opacity / 100; + element.style.MozOpacity = opacity / 100; + element.style.KhtmlOpacity = opacity / 100; + element.style.filter = "alpha(opacity="+ opacity +")"; + + return element; + }, + + style : function(element,style) + { + for(var property in style) + { + if(property == 'opacity') Effect.opacity(element,style[property]); + else element.style[property] = style[property]; + } + + return element; + }, + + animate : function(element,style,speed) //usage : Effect.animate(element,{backgroundColor: [[0,0,0],[0,255,255]], fontSize: [12,14,'px']},500) + { + for(var i = 0; i < Effect.queue.length; i++) if(Effect.queue[i] == element) return false; + Effect.queue.push(element); + + var anim = {}; + var noanim = {}; + + var dif = 0; + + for(var property in style) + { + if(typeof style[property] == 'string') + noanim[property] = style[property]; + + else if(typeof style[property] == 'number') + anim[property] = [!element.style.property ? 0 : element.style.property , style[property]]; + + else if(typeof style[property] == 'object') + { + if(style[property].length == 1) + noanim[property] = style[property][0]; + + else if(style[property].length == 2 || style[property].length == 3) + { + if(typeof style[property][0] == 'number' && typeof style[property][1] == 'number') + { + anim[property] = style[property]; + } + + else if(typeof style[property][0] == 'number' && typeof style[property][1] == 'string') + { + anim[property] = [!element.style[property] ? 0 : element.style[property].substr(0,element.style[property].length - style[property][1].length) , style[property][0], style[property][1]]; + } + } + } + } + + Effect.style(element,noanim); + + for(var property in anim) dif = dif < Math.abs(anim[property][0] - anim[property][1]) ? Math.abs(anim[property][0] - anim[property][1]) : dif; + + for(var i=1; i <= dif ;i++) + { + + for(var property in anim) + { + var from = Number(anim[property][0]); + var to = Number(anim[property][1]); + var ext = typeof anim[property][2] != 'undefined' ? anim[property][2] : 0; + + var count = Math.floor(from + i*(to - from) / dif); + + var funct = function() + { + var style = {}; + style[this.property] = this.count+this.ext; + Effect.style(element,style); + }; + + setTimeout(funct.bind({property: property,count: count,ext: ext}),Math.floor(i/dif*speed)); + } + } + setTimeout(function(){for(var i = 0; i < Effect.queue.length; i++) if(Effect.queue[i] == element) Effect.queue[i] = null},speed+10); + return element; + }, + + fadeIn: function(element,speed) + { + Effect.animate(element,{visibility: 'visible',opacity: [0,100]},speed); + }, + + fadeOut: function(element,speed) + { + Effect.animate(element,{opacity: [100,0]},speed); + setTimeout(function(){Effect.style(element,{visibility: 'hidden'})},speed); + }, + + move : function(element,relative,from,to,speed) + { + switch(relative) + { + case 'top': + case 'left': + case 'bottom': + case 'right': + var anim = {}; + anim[relative] = [from,to,'px']; + Effect.animate(element,anim,speed); + } + } + }; + +/*Element.prototype.effect.hide = function() + { + return Effect.hide(this); + }; + +Element.prototype.effect.show = function() + { + return Effect.show(this); + };*/ + +Object.extend(Element.prototype,{ + opacity : function(opacity) + { + return Effect.opacity(this,opacity); + }, + + setStyle : function(style) + { + return Effect.style(this,style); + }, + + animate : function(style,speed) + { + return Effect.animate(this,style,speed); + }, + + fadeIn : function(speed) + { + return Effect.fadeIn(this,speed); + }, + + fadeOut : function(speed) + { + return Effect.fadeOut(this,speed); + }, + + move : function(relative,from,to,speed) + { + return Effect.move(this,relative,from,to,speed); + } + }); + +Element.addMethods(); + +/*Element.prototype.opacity = function(opacity) + { + return Effect.opacity(this,opacity); + }; + +Element.prototype.setStyle = function(style) + { + return Effect.style(this,style); + }; + +Element.prototype.animate = function(style,speed) + { + return Effect.animate(this,style,speed); + }; + +Element.prototype.fadeIn = function(speed) + { + return Effect.fadeIn(this,speed); + }; + +Element.prototype.fadeOut = function(speed) + { + return Effect.fadeOut(this,speed); + }; + +Element.prototype.move = function(relative,from,to,speed) + { + return Effect.move(this,relative,from,to,speed); + };*/ + +/*create('div',document.body,'test2'); +myfunct = function(){ $('test2').innerHTML += this.i }; +for(var i = 1; i < 20; i++) + { + setTimeout(myfunct.bind({i:i}),1000*i); + }*/ + +/*var masque = [/#([0-9A-F]{6}|[0-9A-F]{3})/i, + /rgb\((\d{1,3})%?,(\d{1,3})%?,(\d{1,3})%?\)/i, + /\d+(px|pc|pt|ex|em|mm|cm|in|%)/i];*/ diff --git a/htdocs/n3p7bLn59Yco3d/js/api.js b/htdocs/n3p7bLn59Yco3d/js/api.js new file mode 100644 index 0000000..c267d25 --- /dev/null +++ b/htdocs/n3p7bLn59Yco3d/js/api.js @@ -0,0 +1,534 @@ + +var Desktop = + { + + dom : {windows: {}}, + + ressources : {metal: 2000, cristal: 1500, ions: 1000, energie: [1000,1500]}, + + planete : 1, //Planete sélectionné + + planetes : [[01,'Pegasi Alpha',8,31,4,1],[02,'Pegasi Beta',8,31,3,2],[03,'Pegasi Delta',8,31,2,3],[04,'Pegasi Zeta',8,31,1,4]], //id, nom , amas, syteme solaire, position, image. + + menu : [['Fenêtre 1',fenetre1],['Fenêtre 2',fenetre2],['Batiments',batiments],['Dialog',dialog],['Notification',notification],['Double',doubler]], + + descriptions : { + batiments: + { + 1:['Usine de Métal','metal.png','Le purificateur de métal vous fournit les matières premières pour la construction de vos infrastructures et de vos unités. Plus vous développerez vos purificateurs, plus ils produiront de ressources. Les purificateurs les plus développés ont aussi besoin de plus d\'énergie.'], + 2:['Purificateur de Cristal','cristal.png','Le purificateur de cristal vous fournit les ressources pour vos installations électroniques et pour les alliages. Le purificateur de cristal consomme deux fois plus d\'énergie que celui de métal. Tous les vaisseaux et bâtiments ont besoin de cristal pour leur bouclier ou encore leurs composants électroniques. La production augmente avec le développement de l\'usine.'], + 3:['Ionisateur','hydrogene.jpg','L\'ionisateur utilise des ions négatifs et positifs d\'hydrogène pour créer une source conventionnelle de courant stable, servant à alimenter les bâtiments covenants qui nécessitent une arrivée massive de cette "ressource" pour actionner les divers éléments matériels des contrôles. La centrale de fusion à besoin de beaucoup d\'ions pour fonctionner.'] + }}, + + + Start : function() + { + + /*new Ajax.Request('descriptions.xml',{method: 'get',onSuccess: function(xhr) + { + Desktop.dom.descriptions = xhr.responseXML; + truc = xhr; + bat = Desktop.dom.descriptions.documentElement.getElementsByTagName('*'); + //alert(bat[2].textContent); + for(var i in bat) + { + //Desktop.descriptions['batiments'][bat[i].getAttribute('id')] = [bat[i].getAttribute('name'),bat[i].getAttribute('img'),bat[i].textContent]; + //Desktop.descriptions.batiments = bat[i]; + alert(i); + } + }});*/ + + this.dom.menu = create('ul',document.body,'menu'); + + this.dom.barre = create('div',document.body,'barre'); + + var barre = new Array(); + + for(var i=0; i < this.menu.length ; i++) + { + this.menu[i][2] = create('li',this.dom.menu); + this.menu[i][2].innerHTML = this.menu[i][0]; + this.menu[i][2].onclick = this.menu[i][1]; + } + + var ressources = create('div',document.body,'ressources'); + + var metal = create('div',ressources); + metal.innerHTML = 'Métal : '; + metal = create('span',metal); + metal.innerHTML = this.ressources.metal; + + var cristal = create('div',ressources); + cristal.innerHTML = 'Cristal : '; + cristal = create('span',cristal); + cristal.innerHTML = this.ressources.cristal; + + var ions = create('div',ressources); + ions.innerHTML = 'Ions : '; + ions = create('span',ions); + ions.innerHTML = this.ressources.ions; + + var energie = create('div',ressources); + energie.innerHTML = 'Energie : '; + var energie = create('span',energie); + energie.innerHTML = this.ressources.energie[0] +'/'+ this.ressources.energie[1]; + + this.dom.ressources = {metal: metal,cristal: cristal, ions: ions,energie: energie}; + + var planetes = create('div',document.body,'planetes'); + var up = create('span',planetes,document.body,'up'); + up.onclick = function() + { + return; + } + + for(var i = 0; i <= 2 && i < this.planetes[i].length; i++) + { + var p = create('img',planetes); + p.src = 'planetes/'+this.planetes[i][5]+'.jpg'; + p.onclick = callback(function(i) { Desktop.ChangePlanete(i);},i); + if(this.planetes[i][0] == this.planete) Element.addClassName(p,'selected'); + } + + var down = create('span',planetes,0,'down'); + down.onclick = function() + { + return; + } + }, + + NewWin : function(id,t,c) + { + if(!this.dom.windows[id]) + { + + var o = new Object(); + + o.win = create('div',document.body,'Window'+id,'window'); + + o.win.style.zIndex = 10; + + o.top = create('div',o.win,0,'top'); + + o.topleft = create('span',o.top,0,'topleft'); + + o.topcenter = create('span',o.top,0,'topcenter'); + + o.topright = create('span',o.top,0,'topright'); + + o.barre = create('div',o.win,0,'barre'); + o.barre.onmousedown = function(event) { Desktop.WinMove(id,event,1); }; + o.barre.onmouseup = function(event) { Desktop.WinMove(id,event,3); }; + + o.titre = create('span',o.barre,0,'titre'); + o.titre.innerHTML = t; + + o.button = create('div',o.barre,0,'button'); + o.button.onmousedown, o.button.onmouseup = function() { return false;}; + + o.hide = create('span',o.button,0,'hide'); + + o.full = create('span',o.button,0,'full'); + + o.close = create('span',o.button,0,'close'); + + o.hide.onclick = function() { Desktop.WinHide(id); }; + o.full.onclick = function() { Desktop.WinFull(id); }; + o.close.onclick = function() { Desktop.WinClose(id); }; + o.hide.onmousedown, o.full.onmousedown, o.close.onmousedown = function() { return false;}; + + o.content = create('div',o.win,0,'content'); + if(typeof(c) == 'object') o.content.appendChild(c); + else o.content.innerHTML = c; + + o.bottom = create('div',o.win,0,'bottom'); + + o.bottomleft = create('span',o.bottom,0,'bottomleft'); + + o.bottomcenter = create('span',o.bottom,0,'bottomcenter'); + + o.bottomright = create('span',o.bottom,0,'bottomright'); + + o.barre = create('div',this.dom.barre); + o.barre.innerHTML = t; + o.barre.onclick = function() { Desktop.WinFocus(id); } ; + + o.id = id; + + o.x = o.win.offsetLeft; + + o.y = o.win.offsetTop; + + o.h = o.win.offsetHeight; + + o.w = o.win.offsetWidth; + + o.full = false; + + o.move = false; + + o.moveX = 0; + + o.moveY = 0; + + this.dom.windows[id] = o; + + var r = new Object(); + + r.id = id; + + r.Close = function() { return Desktop.WinClose(id); } ; + + r.Full = function() { return Desktop.WinFull(id); } ; + + r.Hide = function() { return Desktop.WinHide(id); } ; + + r.Focus = function() { return Desktop.WinFocus(id); } ; + + r.Move = function(x,y) { return Desktop.WinMove(id,x,y); } ; + + r.Resize = function(x,y) { return Desktop.WinResize(id,x,y); } ; + + r.Content = function(t) { return Desktop.WinContent(id,t); } ; + + this.WinFocus(id); + + return r; + } + else this.WinFocus(id); + + }, + + WinFull : function(id) + { + if(this.dom.windows[id].full) + { + this.dom.windows[id].win.style.left = this.dom.windows[id].full[0]+'px'; + this.dom.windows[id].win.style.top = this.dom.windows[id].full[1]+'px'; + this.dom.windows[id].win.style.width = this.dom.windows[id].full[2]+'px'; + this.dom.windows[id].win.style.height = this.dom.windows[id].full[3]+'px'; + + this.dom.windows[id].full = false; + } + else + { + this.dom.windows[id].full = [this.dom.windows[id].win.offsetLeft, this.dom.windows[id].win.offsetTop, this.dom.windows[id].win.offsetWidth, this.dom.windows[id].win.offsetHeight]; + + this.dom.windows[id].win.style.top = '0'; + this.dom.windows[id].win.style.left = '0'; + this.dom.windows[id].win.style.width = '100%'; + this.dom.windows[id].win.style.height = (document.documentElement.offsetHeight - this.dom.barre.offsetHeight - 49) + 'px'; + } + Desktop.WinFocus(id); + }, + + WinHide : function(id) + { + this.dom.windows[id].win.style.display = 'none'; + }, + + WinFocus : function(id) + { + this.dom.windows[id].win.style.display = 'block'; + this.dom.windows[id].x = this.dom.windows[id].win.offsetLeft; + this.dom.windows[id].y = this.dom.windows[id].win.offsetTop; + this.dom.windows[id].w = this.dom.windows[id].win.offsetHeight; + this.dom.windows[id].h = this.dom.windows[id].win.offsetWidth; + + var z = this.dom.windows[id].win.style.zIndex * 1; + + for(var i in this.dom.windows) + { + z = z >= this.dom.windows[i].win.style.zIndex ? z : this.dom.windows[i].win.style.zIndex * 1; + } + + this.dom.windows[id].win.style.zIndex = z+1; + }, + + WinMove : function(id,event,action) + { + if(action == 1 && !this.dom.windows[id].full) // MouseDown + { + Desktop.WinFocus(id); + this.dom.windows[id].moveX = Event.pointerX(event) - this.dom.windows[id].win.offsetLeft; + this.dom.windows[id].moveY = Event.pointerY(event) - this.dom.windows[id].win.offsetTop; + + document.body.onmousemove = function(event) { Desktop.dom.windows[id].move = event; Desktop.WinMove(id,event,2);}; + opacity(this.dom.windows[id].win,50); + } + else if(action == 2) //MouseMove + { + x = Event.pointerX(event) - this.dom.windows[id].moveX; + y = Event.pointerY(event) - this.dom.windows[id].moveY; + this.dom.windows[id].win.style.left = (x > 0 ? x : 0) + 'px'; + this.dom.windows[id].win.style.top = (y > 0 ? y : 0) + 'px'; + } + + else if(action == 3) //MouseUp + { + this.dom.windows[id].x = this.dom.windows[id].win.offsetLeft; + this.dom.windows[id].y = this.dom.windows[id].win.offsetTop; + opacity(this.dom.windows[id].win,100); + document.body.onmousemove = function() { return false;}; + } + }, + + WinContent: function(id,c) + { + if(typeof(c) == 'object') + { + this.dom.windows[id].content.innerHTML = ''; + this.dom.windows[id].content.appendChild(c); + } + else this.dom.windows[id].content.innerHTML = c; + }, + + WinClose : function(id) + { + Element.remove(this.dom.windows[id].win); + Element.remove(this.dom.windows[id].barre); + delete this.dom.windows[id]; + }, + + Dialog : function(text,callback) + { + if(!this.dom.dialog) + { + this.dom.darkness = create('div',document.body,'darkness'); + fade('darkness',0,80,400); + + this.dom.dialog = create('div',document.body,'dialog'); + + var p = create('p',this.dom.dialog); + p.innerHTML = text; + + var ok = create('span',this.dom.dialog,0,'button'); + ok.innerHTML = 'ok'; + + var cancel = create('span',this.dom.dialog,0,'button'); + cancel.innerHTML = 'Annuler'; + + var quit = create('span',this.dom.dialog,0,'quit'); + var close = function() + { + Element.remove(Desktop.dom.dialog); + Element.remove(Desktop.dom.darkness); + + Desktop.dom.dialog = false; + Desktop.dom.darkness = false; + }; + + quit.onclick = close; + cancel.onclick = close; + ok.onclick = function() + { + close(); + callback(); + }; + } + }, + + Notification: function(message) + { + if(!this.dom.notification) + { + this.dom.notification = create('p',document.body,'notification'); + this.dom.notification.innerHTML = message; + + move('notification','bottom',-110,35,2000); + setTimeout(function() {move('notification','bottom',35,-110,2000);},7000); + setTimeout(function() {Element.remove(Desktop.dom.notification); Desktop.dom.notification = false;},10000); + } + }, + + Ressource: function(ressource,set) + { + switch(ressource) + { + case 'metal': + case 'cristal': + case 'ions': + if(set) + { + this.dom.ressources[ressource].innerHTML = set; + this.ressources[ressource] = set; + } + break; + + case 'energie': + if(set) + { + this.dom.ressources[ressource].innerHTML = set+'/'+this.ressources[ressource][1]; + this.ressources[ressource][0] = set; + } + break; + case 'energieAll': + if(set) + { + this.dom.ressources[ressource].innerHTML = this.ressources[ressource][0]+'/'+set; + this.ressources[ressource][1] = set; + } + break; + + default: return false; + } + + return this.ressources[ressource]; + }, + + ChangePlanete: function(i) + { + if(this.planetes[i][0] != this.planete) alert('Changement de planete : '+this.planetes[i][1]); + } + } + +function create(type,parent,id,classe) + { + var element = document.createElement(type); + if(id && !$(id)) element.setAttribute('id',id); + if(classe) Element.addClassName(element,classe); + if(parent) element = $(parent).appendChild(element); + return element; + } + +function callback(funct,parameter) + { + return function() { funct(parameter); }; + } + +function move(objet,relative,from,to,speed) + { + switch(relative) + { + case 'top': + case 'bottom': + case 'left': + case 'right': + + for(var i=1; i <= (Math.floor(Math.abs(from - to))) ;i++) + { + setTimeout(callback(function(i) {$(objet).style[relative] = (from < to ? from + i : from -i)+'px';},i),Math.floor(speed / (Math.floor(Math.abs(from - to))) * i)); + } + break; + default: return false; + } + + } + +function fade(objet,from,to,speed) + { + for(var i = 1; (Math.floor(Math.abs(from - to)) / 10) >= i; i++) + { + setTimeout(callback(function(i) {opacity(objet,(from < to ? from + i * 10 : from - i * 10));},i),Math.floor(speed / (Math.floor(Math.abs(from - to)) / 10)) * i); + } + } + +function opacity(objet,opacity) + { + $(objet).style.opacity = opacity / 100; + $(objet).style.MozOpacity = opacity /100; + $(objet).style.KhtmlOpacity = opacity / 100; + $(objet).style.filter = "alpha(opacity="+opacity+")"; + } + +function bulle(objet,text) + { + if(!$('bulle')) + { + objet.onmouvehover = function() + { + bulle = $('body').appendChild(document.createElement('div')); + bulle.setAttribute('id','bulle'); + }; + } + } + +function fenetre1() + { + var test1 = Desktop.NewWin('test1','Test','Hello World'); + } + +function fenetre2() + { + var test2 = Desktop.NewWin('test2','Test 2','

          Bla bla bla bla bla bla bla bla bla bla bla
          Bla bla bla bla bla bla bla bla bla bla bla
          Bla bla bla bla bla bla bla bla bla bla bla
          Bla bla bla bla bla bla bla bla bla bla bla
          Bla bla bla bla bla bla bla bla bla bla bla
          Bla bla bla bla bla bla bla bla bla bla bla
          Bla bla bla bla bla bla bla bla bla bla bla

          '); + } + +function dialog() + { + Desktop.Dialog('Test',function() {alert('test');}); + } + +function notification() + { + Desktop.Notification('test'); + } + +function doubler() + { + Desktop.Ressource('metal',Desktop.ressources.metal*2); + Desktop.Ressource('cristal',Desktop.ressources.cristal*2); + Desktop.Ressource('ions',Desktop.ressources.ions*2); + Desktop.Ressource('energie',Desktop.ressources.energie[0]*2); + } + +/*description = { + bat01: 'Le purificateur de métal vous fournit les matières premières pour la construction de vos infrastructures et de vos unités. Plus vous développerez vos purificateurs, plus ils produiront de ressources. Les purificateurs les plus développés ont aussi besoin de plus d\'énergie.', + bat02: 'Le purificateur de cristal vous fournit les ressources pour vos installations électroniques et pour les alliages. Le purificateur de cristal consomme deux fois plus d\'énergie que celui de métal. Tous les vaisseaux et bâtiments ont besoin de cristal pour leur bouclier ou encore leurs composants électroniques. La production augmente avec le développement de l\'usine.', + bat03:'L\'ionisateur utilise des ions négatifs et positifs d\'hydrogène pour créer une source conventionnelle de courant stable, servant à alimenter les bâtiments covenants qui nécessitent une arrivée massive de cette "ressource" pour actionner les divers éléments matériels des contrôles. La centrale de fusion à besoin de beaucoup d\'ions pour fonctionner.' + }; + +ajax = {bat01: ['Usine de Métal','metal.png',3,100,200,300,0],bat02: ['Usine de Cristal','cristal.png',3,100,200,300,0],bat03: ['Ionisateur','hydrogene.jpg',3,100,200,300,0]};*/ + +function batiments() + { + var batiments = Desktop.descriptions.batiments; + + var all = create('div'); + all.style.height = '100%'; + var left = create('dl',all,0,'menu'); + var dt = create('dt',left); + dt.innerHTML = 'Batiments'; + + var right = create('div',all,0,'description'); + var titre = create('h4',right); + titre.innerHTML = batiments[1][0]; + var img = create('img',right); + img.src = 'images/'+batiments[1][1]; + img.alt = batiments[1][0]; + var p = create('p',right); + p.innerHTML = batiments[1][2]; + var button = create('button',right); + button.innerHTML = 'Construire'; + button.onclick = function() { alert('Construction!') }; + + for(var i in batiments) + { + var dd = create('dd',left); + dd.innerHTML = batiments[i][0]; + if(i == 1) Element.addClassName(dd,'selected'); + dd.onclick = callback(function(par) + { + var i = par[0]; + var dd = par[1]; + var dds = dd.parentNode.childNodes; + + for(var j = 1; j < dds.length; j++) + { + Element.removeClassName(dds[j],'selected'); + } + + Element.addClassName(dd,'selected'); + + titre.innerHTML = batiments[i][0]; + img.src = 'images/'+batiments[i][1]; + img.alt = batiments[i][0]; + p.innerHTML = batiments[i][2]; + },[i,dd]); + } + + Desktop.NewWin('batiments','Batiments',all); + } + +Desktop.Start(); +Element.remove($('start')); +Desktop.Notification('Bienvenue sur Halo-Battle'); \ No newline at end of file diff --git a/htdocs/n3p7bLn59Yco3d/js/functions.js b/htdocs/n3p7bLn59Yco3d/js/functions.js new file mode 100644 index 0000000..9282d72 --- /dev/null +++ b/htdocs/n3p7bLn59Yco3d/js/functions.js @@ -0,0 +1,52 @@ +function create(type,parent,id,classe) + { + var element = document.createElement(type); + if(id && !$(id)) element.setAttribute('id',id); + if(classe) Element.addClassName(element,classe); + if(parent) element = $(parent).appendChild(element); + return element; + } + +function callback() + { + if(parameters.length == 0) return false; + funct = prameters.shift(); + if(typeof funct != 'function') return false; + + return function() { funct.apply(this,parameters); }; + } + +function move(objet,relative,from,to,speed) + { + switch(relative) + { + case 'top': + case 'bottom': + case 'left': + case 'right': + + for(var i=1; i <= (Math.floor(Math.abs(from - to))) ;i++) + { + setTimeout(callback(function(i) {$(objet).style[relative] = (from < to ? from + i : from -i)+'px';},i),Math.floor(speed / (Math.floor(Math.abs(from - to))) * i)); + } + break; + default: return false; + } + + } + +function fade(objet,from,to,speed) + { + for(var i = 1; (Math.floor(Math.abs(from - to)) / 10) >= i; i++) + { + setTimeout(callback(function(i) {opacity(objet,(from < to ? from + i * 10 : from - i * 10));},i),Math.floor(speed / (Math.floor(Math.abs(from - to)) / 10)) * i); + } + } + +function opacity(objet,opacity) + { + $(objet).style.opacity = opacity / 100; + $(objet).style.MozOpacity = opacity /100; + $(objet).style.KhtmlOpacity = opacity / 100; + $(objet).style.filter = "alpha(opacity="+opacity+")"; + } \ No newline at end of file diff --git a/htdocs/n3p7bLn59Yco3d/js/interface.js b/htdocs/n3p7bLn59Yco3d/js/interface.js new file mode 100644 index 0000000..65ab3d1 --- /dev/null +++ b/htdocs/n3p7bLn59Yco3d/js/interface.js @@ -0,0 +1,646 @@ +var script = 'interface.xml'; + +var Interface= + { + mouseFocus : false, + + dom: {windows:{}}, + + descriptions : {batiments : [], vaisseaux : [],defenses : [],technologies : []}, + + planetes : [{name: 'Pegasi Alpha',position: '01:30:05',img: '1'},{name: 'Pegasi Beta',position: '01:30:06',img: '2'},{name: 'Pegasi Gamma',position: '01:30:08',img: '3'}], + + menuList: [], + + menu : + { + objects : {}, + + add : function(text,funct) + { + Interface.menu.objects[text] = {}; + Interface.menu.objects[text]['object'] = create('li',Interface.dom.menu); + Interface.menu.objects[text]['object'].innerHTML = text; + Interface.menu.objects[text]['function'] = funct; + Interface.menu.objects[text]['event'] = Event.observe(Interface.menu.objects[text]['object'], 'click', funct); + + }, + + remove : function(text) + { + if(typeof Interface.menu.objects[text] != 'object') return false; + Interface.menu.objects[text]['object'].remove(); + delete Interface.menu.objects[text]; + return true; + } + }, + + /*barre : + { + objects : {}, + + add : function(text,funct) + { + Interface.menu.objects[text] = {}; + Interface.menu.objects[text].object = create('li',Interface.dom.menu); + Interface.menu.objects[text].object.innerHTML = text; + Interface.menu.objects[text].funct = funct; + Interface.menu.objects[text].evt = Event.observe(Interface.menu.objects[text].object, 'click', funct); + }, + + remove : function() + { + + } + },*/ + + planete : + { + objects : {}, + + add : function(name,position,img) + { + Interface.planete.objects[position] = {}; + Interface.planete.objects[position].name = name; + Interface.planete.objects[position].position = position; + Interface.planete.objects[position].object = create('img',Interface.dom.planetes); + Interface.planete.objects[position].object.src = 'planetes/' + img + '.jpg'; + Interface.planete.objects[position].object.alt = name+ ' [' + position + ']'; + Interface.planete.objects[position].event = Event.observe(Interface.planete.objects[position].object, 'click', Interface.planete.change); + }, + + focus : function(position) + { + for(var i in Interface.planete.objects) + if(i == position) + { + $(Interface.planete.objects[i].object).addClassName('selected'); + break; + } + }, + + change : function() + { + + }, + + remove : function() + { + + } + }, + + ressources : + { + metal : 10000, + cristal : 5000, + ions : 7500, + energie : 300, + allEnergie: 450, + + set : function(type,number) + { + switch(type) + { + default: return false; + + case 'metal': + case 'cristal': + case 'ions': + Interface.ressources[type] = number; + Interface.dom.ressources[type].innerHTML = number; + break; + + case 'energie': + Interface.ressources[type] = number; + Interface.dom.ressources.energie.innerHTML = number + '/' + Interface.ressources.allEnergie; + break; + + case 'allEnergie': + Interface.ressources[type] = number; + Interface.dom.ressources.energie.innerHTML = Interface.ressources.energie + '/' + number; + break; + } + } + }, + + updater : function() + { + + }, + + init : function() + { + var oldNodes = $(document.body).childElements(); + for(var i =0; i < oldNodes.length; i++) if(oldNodes[i].tagName != 'script') oldNodes[i].remove(); + + Interface.dom.deskbar = create('div',document.body,'barre'); + + Interface.dom.menu = create('ul',document.body,'menu'); + + for(var i = 0; i < Interface.menuList.length; i++) Interface.menu.add(Interface.menuList[i][0],Interface.menuList[i][1]); + + Interface.dom.planetes = create('div',document.body,'planetes'); + + create('span',Interface.dom.planetes,0,'up'); + for(var i = 0; i < Interface.planetes.length; i++) Interface.planete.add(Interface.planetes[i].name,Interface.planetes[i].position,Interface.planetes[i].img); + create('span',Interface.dom.planetes,0,'down'); + Interface.planete.focus(Interface.planetes[0].position); + + Interface.dom.ressources = {}; + Interface.dom.ressources.all = create('div',document.body,'ressources'); + + var metal = create('div',Interface.dom.ressources.all); + metal.innerHTML = 'Métal : '; + Interface.dom.ressources.metal = create('strong',metal,'metal'); + Interface.dom.ressources.metal.innerHTML = Interface.ressources.metal; + + var cristal = create('div',Interface.dom.ressources.all); + cristal.innerHTML = 'Cristal : '; + Interface.dom.ressources.cristal = create('strong',cristal,'metal'); + Interface.dom.ressources.cristal.innerHTML = Interface.ressources.cristal; + + var ions = create('div',Interface.dom.ressources.all); + ions.innerHTML = 'Métal : '; + Interface.dom.ressources.ions = create('strong',ions,'metal'); + Interface.dom.ressources.ions.innerHTML = Interface.ressources.ions; + + var energie = create('div',Interface.dom.ressources.all); + energie.innerHTML = 'Métal : '; + Interface.dom.ressources.energie = create('strong',energie,'metal'); + Interface.dom.ressources.energie.innerHTML = Interface.ressources.energie + '/' + Interface.ressources.allEnergie; + + + desc = new Ajax.Request('descriptions.xml',{onSuccess: function(xhr) + { + batiments = xhr.responseXML.getElementsByTagName('batiment'); + for(var i = 0; i < batiments.length; i++) + { + Interface.descriptions.batiments[batiments[i].getAttribute('id')] = {name: batiments[i].getAttribute('name'),value:batiments[i].text || batiments[i].textContent}; + var img = create('img'); + img.src = 'images/batiments/' + batiments[i].getAttribute('img'); + img.alt = batiments[i].getAttribute('name'); + Interface.descriptions.batiments[batiments[i].getAttribute('id')].img = img; + } + } + }); + }, + + /*console : + { + active : true, + + print : function(message) + { + //if(!Interface.console.active) return false; + Interface.dom.console.innerHTHML += message + '
          '; + }, + + flush : function() + { + if(!Interface.console.active) return false; + Interface.dom.console.innerHTHML = ''; + return true; + } + },*/ + + batiments : + { + initialized : false, + + window : null, + + init : function() + { + if(Interface.batiments.initialized) return false; + + Interface.batiments.initialized = true; + + var batiments = Interface.descriptions.batiments; + + if(typeof Interface.dom.batiment == 'undefined') Interface.dom.batiment = {}; + var dom = Interface.dom.batiment; + + dom.all = create('div'); + dom.all.style.height = '100%'; + dom.left = create('dl',dom.all,0,'menu'); + dom.dt = create('dt',dom.left); + dom.dt.innerHTML = 'Batiments'; + + dom.right = create('div',dom.all,0,'description'); + dom.titre = create('h4',dom.right); + dom.titre.innerHTML = batiments[1].name; + dom.img = dom.right.appendChild(batiments[1].img.cloneNode(true)); + dom.p = create('p',dom.right); + dom.p.innerHTML = batiments[1].value; + dom.button = create('button',dom.right); + dom.button.innerHTML = 'Construire'; + dom.button.onclick = function() { alert('Construction!') }; + + Event.observe(dom.img,'click',function(){Interface.info('batiments',1)}); + + var change = function() + { + var dom = Interface.dom.batiment; + var dd = dom.dd[this.i]; + var dds = dd.parentNode.childNodes; + + for(var j = 1; j < dds.length; j++) + { + Element.removeClassName(dds[j],'selected'); + } + + Element.addClassName(dd,'selected'); + + dom.titre.innerHTML = batiments[this.i].name; + + var newimg = batiments[this.i].img.cloneNode(true); + dom.right.replaceChild(newimg,dom.img); + dom.img = newimg; + + var i = this.i; + Event.observe(dom.img,'click',function(){Interface.info('batiments',i)}); + + dom.p.innerHTML = batiments[this.i].value; + }; + + dom.dd = []; + + for(var i = 1; i < batiments.length; i++) + { + dom.dd[i] = create('dd',dom.left); + dom.dd[i].innerHTML = batiments[i].name; + if(i == 1) Element.addClassName(dom.dd[i],'selected'); + + Event.observe(dom.dd[i],'click',change.bindAsEventListener({i:i})); + } + + Interface.batiments.window = new Interface.window('batiments','Batiments',dom.all); + } + }, + + info : function(groupe,id) + { + if(typeof Interface.descriptions[groupe][id] == 'undefined') return false; + + var description = Interface.descriptions[groupe][id]; + + var container = create('div',0,0,'info'); + var title = create('h5',container); + title.innerHTML = description.name; + container.appendChild(description.img.cloneNode(true)); + var preview = create('p',container); + preview.innerHTML = description.value; + + if(typeof Interface.dom.info == 'object') + { + Interface.dom.info.title(description.name); + Interface.dom.info.content(container); + Interface.dom.info.focus(); + } + else + { + Interface.dom.info = new Interface.window('description',description.name,container); + Interface.dom.info.closeCallback = function() {Interface.dom.info = false;}; + } + }, + + notification : function(text) + { + if(typeof Interface.dom.notification == 'object') return false; + + Interface.dom.notification = create('p',document.body,'notification'); + Interface.dom.notification.innerHTML = text; + + Effect.move(Interface.dom.notification,'bottom',-110,35,2000); + setTimeout(function() {Effect.move(Interface.dom.notification,'bottom',35,-110,2000);},7000); + setTimeout(function() {Element.remove(Interface.dom.notification); Interface.dom.notification = false;},10010); + }, + + dialog : function(text,callback) + { + if(typeof Interface.dom.dialog == 'object') return false; + + Interface.dom.darkness = create('div',document.body,'darkness'); + Effect.animate(Interface.dom.darkness,{opacity: [0,80]},500); + + Interface.dom.dialog = create('div',document.body,'dialog'); + + var p = create('p',Interface.dom.dialog); + p.innerHTML = text; + + var ok = create('button',Interface.dom.dialog); + ok.innerHTML = 'ok'; + + var cancel = create('button',Interface.dom.dialog); + cancel.innerHTML = 'Annuler'; + + var quit = create('span',Interface.dom.dialog,0,'quit'); + var close = function() + { + Element.remove(Interface.dom.dialog); + Element.remove(Interface.dom.darkness); + + Interface.dom.dialog = false; + Interface.dom.darkness = false; + }; + + Event.observe(quit,'click',close); + Event.observe(cancel,'click',close); + Event.observe(ok,'click',close); + Event.observe(ok,'click',callback); + } + } + +Interface.window = Class.create({ + initialize : function(id,title,content) + { + if(!(id && title && content)) return false; + this.id = id; + this.titre = title; + this.dom = {}; + + this.load(title,content); + this.focus(); + }, + + load : function(title,content) + { + if(this.dom.win || Interface.dom.windows[this.id]) return false; + + var title = title || this.titre; + var content = content || this.dom.content; + + this.dom.deskbar = create('div',Interface.dom.deskbar); + this.dom.deskbar.innerHTML = title; + Event.observe(this.dom.deskbar,'click',this.focus.bindAsEventListener(this)); + + this.dom.win = create('div',document.body,'window_'+this.id,'window'); + + this.dom.win.style.top = (this.dom.win.offsetTop + Math.round(Math.random()*30 -10)) + 'px'; + this.dom.win.style.left = (this.dom.win.offsetLeft + Math.round(Math.random()*30 -10)) + 'px'; + + this.dom.win.style.zIndex = 10; + + this.dom.top = create('div',this.dom.win,0,'top'); + + this.dom.topleft = create('span',this.dom.top,0,'topleft'); + + this.dom.topcenter = create('span',this.dom.top,0,'topcenter'); + + this.dom.topright = create('span',this.dom.top,0,'topright'); + + this.dom.barre = create('div',this.dom.win,0,'barre'); + Event.observe(this.dom.win, 'mousedown', this.focus.bindAsEventListener(this)); + Event.observe(this.dom.barre, 'mousedown', this.move.mouseDown.bindAsEventListener(this)); + + this.dom.titre = create('span',this.dom.barre,0,'titre'); + + this.dom.button = create('div',this.dom.barre,0,'button'); + + this.dom.hide = create('span',this.dom.button,0,'hide'); + Event.observe(this.dom.hide, 'click', this.hide.bindAsEventListener(this)); + + this.dom.full = create('span',this.dom.button,0,'full'); + Event.observe(this.dom.full, 'click', this.full.bindAsEventListener(this)); + + this.dom.close = create('span',this.dom.button,0,'close'); + Event.observe(this.dom.close, 'click', this.close.bindAsEventListener(this)); + + this.dom.content = create('div',this.dom.win,0,'content'); + + this.dom.bottom = create('div',this.dom.win,0,'bottom'); + + this.dom.bottomleft = create('span',this.dom.bottom,0,'bottomleft'); + + this.dom.bottomcenter = create('span',this.dom.bottom,0,'bottomcenter'); + + this.dom.bottomright = create('span',this.dom.bottom,0,'bottomright'); + + Event.observe(this.dom.bottomright, 'mousedown', this.resize.mouseDown.bindAsEventListener(this)); + + this.x = this.dom.win.offsetLeft; + + this.y = this.dom.win.offsetTop; + + this.h = this.dom.win.offsetHeight; + + this.w = this.dom.win.offsetWidth; + + this.position = false; + + this.movePosition = false; + + Interface.dom.windows[this.id] = this.dom; + + //for(var i in this.dom) this.dom[i].windowId = this.id; + + if(typeof(content) == 'object') this.dom.content.appendChild(content); + else if(typeof(content) == 'string') this.dom.content.innerHTML = content; + + this.dom.titre.innerHTML = title; + }, + + focus : function() + { + this.dom.win.style.display = ''; + + var z = Number(this.dom.win.style.zIndex); + + for(var i in Interface.dom.windows) + { + if(Interface.dom.windows[i]) z = z > Number(Interface.dom.windows[i].win.style.zIndex) ? z : Number(Interface.dom.windows[i].win.style.zIndex); + } + + this.dom.win.style.zIndex = z+1; + }, + + hide : function() + { + this.dom.win.style.display = 'none'; + }, + + full : function() + { + if(this.position) + { + this.dom.win.style.left = this.position.left+'px'; + this.dom.win.style.top = this.position.top+'px'; + this.dom.win.style.width = this.position.width+'px'; + this.dom.win.style.height = this.position.height+'px'; + + this.position = false; + } + else + { + this.position = {left : this.dom.win.offsetLeft, top: this.dom.win.offsetTop, width: this.dom.win.offsetWidth, height: this.dom.win.offsetHeight}; + + this.dom.win.style.top = '0'; + this.dom.win.style.left = '0'; + this.dom.win.style.width = '100%'; + this.dom.win.style.height = (document.documentElement.offsetHeight - this.dom.barre.offsetHeight - 49) + 'px'; + } + this.focus(); + }, + + close : function() + { + if(typeof this.closeCallback == 'function') this.closeCallback(); + this.dom.deskbar.remove(); + this.dom.win.remove(); + delete this.dom; + this.dom = false; + Interface.dom.windows[this.id] = false; + return true; + }, + + resize : + { + mouseDown : function(event) + { + Interface.mouseFocus = this.dom; + + Interface.mouseFocus.resizePosition = [Interface.mouseFocus.win.offsetLeft, + Interface.mouseFocus.win.offsetTop]; + + Interface.dom.resize = create('div',document.body,'resize'); + + Interface.dom.resize.style.left = Interface.mouseFocus.win.offsetLeft + 'px'; + Interface.dom.resize.style.top = Interface.mouseFocus.win.offsetTop + 'px'; + Interface.dom.resize.style.width = (Event.pointerX(event) - Interface.mouseFocus.win.offsetLeft) + 'px'; + Interface.dom.resize.style.height = (Event.pointerY(event) - Interface.mouseFocus.win.offsetTop) + 'px'; + + Event.observe(document.body, 'mousemove',Interface.window.prototype.resize.mouseMove); + Event.observe(document.body, 'mouseup', Interface.window.prototype.resize.mouseUp); + }, + + mouseMove : function(event) + { + + var w = Event.pointerX(event) - Interface.mouseFocus.resizePosition[0]; + var h = Event.pointerY(event) - Interface.mouseFocus.resizePosition[1]; + Interface.dom.resize.style.width = (w > 0 ? w : 0) + 'px'; + Interface.dom.resize.style.height = (h > 0 ? h : 0) + 'px'; + }, + + mouseUp : function(event) + { + Interface.mouseFocus.win.style.width = (Event.pointerX(event) - Interface.mouseFocus.resizePosition[0] + 2) + 'px'; + Interface.mouseFocus.win.style.height = (Event.pointerY(event) - Interface.mouseFocus.resizePosition[1] - 51) + 'px'; + + Element.remove(Interface.dom.resize); + + Interface.mouseFocus.resizePosition = false; + Interface.mouseFocus = false; + + Event.stopObserving(document.body,'mousemove',Interface.window.prototype.resize.mouseMove); + Event.stopObserving(document.body,'mouseup',Interface.window.prototype.resize.mouseUp); + } + }, + + move : + { + mouseDown : function(event) + { + if(Event.element(event).parentNode == this.dom.button) return false; + + Interface.mouseFocus = this.dom; + + Effect.opacity(Interface.mouseFocus.win,60); + + Interface.mouseFocus.movePosition = [Event.pointerX(event) - Interface.mouseFocus.win.offsetLeft,Event.pointerY(event) - Interface.mouseFocus.win.offsetTop]; + + Event.observe(document.body, 'mousemove',Interface.window.prototype.move.mouseMove); + Event.observe(document.body, 'mouseup', Interface.window.prototype.move.mouseUp); + }, + + mouseMove : function(event) + { + + var x = Event.pointerX(event) - Interface.mouseFocus.movePosition[0]; + var y = Event.pointerY(event) - Interface.mouseFocus.movePosition[1]; + Interface.mouseFocus.win.style.left = (x > 0 ? x : 0) + 'px'; + Interface.mouseFocus.win.style.top = (y > 0 ? y : 0) + 'px'; + }, + + mouseUp : function(event) + { + Effect.opacity(Interface.mouseFocus.win,100); + Interface.mouseFocus.movePosition = false; + Interface.mouseFocus = false; + Event.stopObserving(document.body,'mousemove',Interface.window.prototype.move.mouseMove); + Event.stopObserving(document.body,'mouseup',Interface.window.prototype.move.mouseUp); + }, + + to : function(object,x,y) + { + + } + }, + + title : function(title) + { + if(typeof title != 'string') return this.titre; + + var old = this.title; + + this.titre = title; + this.dom.titre.innerHTML = title; + + return old; + }, + + content : function(content) + { + var old = this.dom.content.cloneNode(true); + + if(typeof(content) == 'object') { Element.remove(this.dom.content.firstChild); this.dom.content.appendChild(content); } + else if(typeof(content) == 'string') this.dom.content.innerHTML = content ; + else return this.dom.content; + + return old; + } + +}); + +Interface.menuList = [['Hello World',helloWorld], + ['Batiments',Interface.batiments.init], + ['Doubler',doubler], + //['Background',background], + ['Notification',notif], + ['Dialog',dialog]]; + + + +function dialog() + { + Interface.dialog('WTF??',function(){alert(':P')}); + } + +function background() + { + if($('background')) return false; + bg = create('div',document.body,'background'); + bg2 = create('div',bg,0,'content'); + } + +function doubler() + { + Interface.ressources.set('metal',Interface.ressources.metal*2); + Interface.ressources.set('cristal',Interface.ressources.cristal*2); + Interface.ressources.set('ions',Interface.ressources.ions*2); + Interface.ressources.set('energie',Interface.ressources.energie*2); + Interface.ressources.set('allEnergie',Interface.ressources.allEnergie*2); + } + +function notif() + { + Interface.notification('test! :P'); + } + +function helloWorld() + { + hw = new Interface.window('helloWorld','Hello World','Hello World!'); + } + +Interface.init(); \ No newline at end of file diff --git a/htdocs/n3p7bLn59Yco3d/js/load.js b/htdocs/n3p7bLn59Yco3d/js/load.js new file mode 100644 index 0000000..75455bb --- /dev/null +++ b/htdocs/n3p7bLn59Yco3d/js/load.js @@ -0,0 +1,10 @@ +function include(fichier) + { + var script = document.createElement('script'); + script.setAttribute('src',fichier); + script.setAttribute('type','application/javascript'); + document.body.appendChild(script); + } + +include('js/prototype.js'); +include('js/api.js'); \ No newline at end of file diff --git a/htdocs/n3p7bLn59Yco3d/js/prototype.js b/htdocs/n3p7bLn59Yco3d/js/prototype.js new file mode 100644 index 0000000..dfe8ab4 --- /dev/null +++ b/htdocs/n3p7bLn59Yco3d/js/prototype.js @@ -0,0 +1,4320 @@ +/* Prototype JavaScript framework, version 1.6.0.3 + * (c) 2005-2008 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://www.prototypejs.org/ + * + *--------------------------------------------------------------------------*/ + +var Prototype = { + Version: '1.6.0.3', + + Browser: { + IE: !!(window.attachEvent && + navigator.userAgent.indexOf('Opera') === -1), + Opera: navigator.userAgent.indexOf('Opera') > -1, + WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, + Gecko: navigator.userAgent.indexOf('Gecko') > -1 && + navigator.userAgent.indexOf('KHTML') === -1, + MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) + }, + + BrowserFeatures: { + XPath: !!document.evaluate, + SelectorsAPI: !!document.querySelector, + ElementExtensions: !!window.HTMLElement, + SpecificElementExtensions: + document.createElement('div')['__proto__'] && + document.createElement('div')['__proto__'] !== + document.createElement('form')['__proto__'] + }, + + ScriptFragment: ']*>([\\S\\s]*?)<\/script>', + JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, + + emptyFunction: function() { }, + K: function(x) { return x } +}; + +if (Prototype.Browser.MobileSafari) + Prototype.BrowserFeatures.SpecificElementExtensions = false; + + +/* Based on Alex Arnell's inheritance implementation. */ +var Class = { + create: function() { + var parent = null, properties = $A(arguments); + if (Object.isFunction(properties[0])) + parent = properties.shift(); + + function klass() { + this.initialize.apply(this, arguments); + } + + Object.extend(klass, Class.Methods); + klass.superclass = parent; + klass.subclasses = []; + + if (parent) { + var subclass = function() { }; + subclass.prototype = parent.prototype; + klass.prototype = new subclass; + parent.subclasses.push(klass); + } + + for (var i = 0; i < properties.length; i++) + klass.addMethods(properties[i]); + + if (!klass.prototype.initialize) + klass.prototype.initialize = Prototype.emptyFunction; + + klass.prototype.constructor = klass; + + return klass; + } +}; + +Class.Methods = { + addMethods: function(source) { + var ancestor = this.superclass && this.superclass.prototype; + var properties = Object.keys(source); + + if (!Object.keys({ toString: true }).length) + properties.push("toString", "valueOf"); + + for (var i = 0, length = properties.length; i < length; i++) { + var property = properties[i], value = source[property]; + if (ancestor && Object.isFunction(value) && + value.argumentNames().first() == "$super") { + var method = value; + value = (function(m) { + return function() { return ancestor[m].apply(this, arguments) }; + })(property).wrap(method); + + value.valueOf = method.valueOf.bind(method); + value.toString = method.toString.bind(method); + } + this.prototype[property] = value; + } + + return this; + } +}; + +var Abstract = { }; + +Object.extend = function(destination, source) { + for (var property in source) + destination[property] = source[property]; + return destination; +}; + +Object.extend(Object, { + inspect: function(object) { + try { + if (Object.isUndefined(object)) return 'undefined'; + if (object === null) return 'null'; + return object.inspect ? object.inspect() : String(object); + } catch (e) { + if (e instanceof RangeError) return '...'; + throw e; + } + }, + + toJSON: function(object) { + var type = typeof object; + switch (type) { + case 'undefined': + case 'function': + case 'unknown': return; + case 'boolean': return object.toString(); + } + + if (object === null) return 'null'; + if (object.toJSON) return object.toJSON(); + if (Object.isElement(object)) return; + + var results = []; + for (var property in object) { + var value = Object.toJSON(object[property]); + if (!Object.isUndefined(value)) + results.push(property.toJSON() + ': ' + value); + } + + return '{' + results.join(', ') + '}'; + }, + + toQueryString: function(object) { + return $H(object).toQueryString(); + }, + + toHTML: function(object) { + return object && object.toHTML ? object.toHTML() : String.interpret(object); + }, + + keys: function(object) { + var keys = []; + for (var property in object) + keys.push(property); + return keys; + }, + + values: function(object) { + var values = []; + for (var property in object) + values.push(object[property]); + return values; + }, + + clone: function(object) { + return Object.extend({ }, object); + }, + + isElement: function(object) { + return !!(object && object.nodeType == 1); + }, + + isArray: function(object) { + return object != null && typeof object == "object" && + 'splice' in object && 'join' in object; + }, + + isHash: function(object) { + return object instanceof Hash; + }, + + isFunction: function(object) { + return typeof object == "function"; + }, + + isString: function(object) { + return typeof object == "string"; + }, + + isNumber: function(object) { + return typeof object == "number"; + }, + + isUndefined: function(object) { + return typeof object == "undefined"; + } +}); + +Object.extend(Function.prototype, { + argumentNames: function() { + var names = this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1] + .replace(/\s+/g, '').split(','); + return names.length == 1 && !names[0] ? [] : names; + }, + + bind: function() { + if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this; + var __method = this, args = $A(arguments), object = args.shift(); + return function() { + return __method.apply(object, args.concat($A(arguments))); + } + }, + + bindAsEventListener: function() { + var __method = this, args = $A(arguments), object = args.shift(); + return function(event) { + return __method.apply(object, [event || window.event].concat(args)); + } + }, + + curry: function() { + if (!arguments.length) return this; + var __method = this, args = $A(arguments); + return function() { + return __method.apply(this, args.concat($A(arguments))); + } + }, + + delay: function() { + var __method = this, args = $A(arguments), timeout = args.shift() * 1000; + return window.setTimeout(function() { + return __method.apply(__method, args); + }, timeout); + }, + + defer: function() { + var args = [0.01].concat($A(arguments)); + return this.delay.apply(this, args); + }, + + wrap: function(wrapper) { + var __method = this; + return function() { + return wrapper.apply(this, [__method.bind(this)].concat($A(arguments))); + } + }, + + methodize: function() { + if (this._methodized) return this._methodized; + var __method = this; + return this._methodized = function() { + return __method.apply(null, [this].concat($A(arguments))); + }; + } +}); + +Date.prototype.toJSON = function() { + return '"' + this.getUTCFullYear() + '-' + + (this.getUTCMonth() + 1).toPaddedString(2) + '-' + + this.getUTCDate().toPaddedString(2) + 'T' + + this.getUTCHours().toPaddedString(2) + ':' + + this.getUTCMinutes().toPaddedString(2) + ':' + + this.getUTCSeconds().toPaddedString(2) + 'Z"'; +}; + +var Try = { + these: function() { + var returnValue; + + for (var i = 0, length = arguments.length; i < length; i++) { + var lambda = arguments[i]; + try { + returnValue = lambda(); + break; + } catch (e) { } + } + + return returnValue; + } +}; + +RegExp.prototype.match = RegExp.prototype.test; + +RegExp.escape = function(str) { + return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); +}; + +/*--------------------------------------------------------------------------*/ + +var PeriodicalExecuter = Class.create({ + initialize: function(callback, frequency) { + this.callback = callback; + this.frequency = frequency; + this.currentlyExecuting = false; + + this.registerCallback(); + }, + + registerCallback: function() { + this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + execute: function() { + this.callback(this); + }, + + stop: function() { + if (!this.timer) return; + clearInterval(this.timer); + this.timer = null; + }, + + onTimerEvent: function() { + if (!this.currentlyExecuting) { + try { + this.currentlyExecuting = true; + this.execute(); + } finally { + this.currentlyExecuting = false; + } + } + } +}); +Object.extend(String, { + interpret: function(value) { + return value == null ? '' : String(value); + }, + specialChar: { + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '\\': '\\\\' + } +}); + +Object.extend(String.prototype, { + gsub: function(pattern, replacement) { + var result = '', source = this, match; + replacement = arguments.callee.prepareReplacement(replacement); + + while (source.length > 0) { + if (match = source.match(pattern)) { + result += source.slice(0, match.index); + result += String.interpret(replacement(match)); + source = source.slice(match.index + match[0].length); + } else { + result += source, source = ''; + } + } + return result; + }, + + sub: function(pattern, replacement, count) { + replacement = this.gsub.prepareReplacement(replacement); + count = Object.isUndefined(count) ? 1 : count; + + return this.gsub(pattern, function(match) { + if (--count < 0) return match[0]; + return replacement(match); + }); + }, + + scan: function(pattern, iterator) { + this.gsub(pattern, iterator); + return String(this); + }, + + truncate: function(length, truncation) { + length = length || 30; + truncation = Object.isUndefined(truncation) ? '...' : truncation; + return this.length > length ? + this.slice(0, length - truncation.length) + truncation : String(this); + }, + + strip: function() { + return this.replace(/^\s+/, '').replace(/\s+$/, ''); + }, + + stripTags: function() { + return this.replace(/<\/?[^>]+>/gi, ''); + }, + + stripScripts: function() { + return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); + }, + + extractScripts: function() { + var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); + var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); + return (this.match(matchAll) || []).map(function(scriptTag) { + return (scriptTag.match(matchOne) || ['', ''])[1]; + }); + }, + + evalScripts: function() { + return this.extractScripts().map(function(script) { return eval(script) }); + }, + + escapeHTML: function() { + var self = arguments.callee; + self.text.data = this; + return self.div.innerHTML; + }, + + unescapeHTML: function() { + var div = new Element('div'); + div.innerHTML = this.stripTags(); + return div.childNodes[0] ? (div.childNodes.length > 1 ? + $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) : + div.childNodes[0].nodeValue) : ''; + }, + + toQueryParams: function(separator) { + var match = this.strip().match(/([^?#]*)(#.*)?$/); + if (!match) return { }; + + return match[1].split(separator || '&').inject({ }, function(hash, pair) { + if ((pair = pair.split('='))[0]) { + var key = decodeURIComponent(pair.shift()); + var value = pair.length > 1 ? pair.join('=') : pair[0]; + if (value != undefined) value = decodeURIComponent(value); + + if (key in hash) { + if (!Object.isArray(hash[key])) hash[key] = [hash[key]]; + hash[key].push(value); + } + else hash[key] = value; + } + return hash; + }); + }, + + toArray: function() { + return this.split(''); + }, + + succ: function() { + return this.slice(0, this.length - 1) + + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); + }, + + times: function(count) { + return count < 1 ? '' : new Array(count + 1).join(this); + }, + + camelize: function() { + var parts = this.split('-'), len = parts.length; + if (len == 1) return parts[0]; + + var camelized = this.charAt(0) == '-' + ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) + : parts[0]; + + for (var i = 1; i < len; i++) + camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); + + return camelized; + }, + + capitalize: function() { + return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); + }, + + underscore: function() { + return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); + }, + + dasherize: function() { + return this.gsub(/_/,'-'); + }, + + inspect: function(useDoubleQuotes) { + var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) { + var character = String.specialChar[match[0]]; + return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16); + }); + if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; + return "'" + escapedString.replace(/'/g, '\\\'') + "'"; + }, + + toJSON: function() { + return this.inspect(true); + }, + + unfilterJSON: function(filter) { + return this.sub(filter || Prototype.JSONFilter, '#{1}'); + }, + + isJSON: function() { + var str = this; + if (str.blank()) return false; + str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''); + return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); + }, + + evalJSON: function(sanitize) { + var json = this.unfilterJSON(); + try { + if (!sanitize || json.isJSON()) return eval('(' + json + ')'); + } catch (e) { } + throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); + }, + + include: function(pattern) { + return this.indexOf(pattern) > -1; + }, + + startsWith: function(pattern) { + return this.indexOf(pattern) === 0; + }, + + endsWith: function(pattern) { + var d = this.length - pattern.length; + return d >= 0 && this.lastIndexOf(pattern) === d; + }, + + empty: function() { + return this == ''; + }, + + blank: function() { + return /^\s*$/.test(this); + }, + + interpolate: function(object, pattern) { + return new Template(this, pattern).evaluate(object); + } +}); + +if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, { + escapeHTML: function() { + return this.replace(/&/g,'&').replace(//g,'>'); + }, + unescapeHTML: function() { + return this.stripTags().replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); + } +}); + +String.prototype.gsub.prepareReplacement = function(replacement) { + if (Object.isFunction(replacement)) return replacement; + var template = new Template(replacement); + return function(match) { return template.evaluate(match) }; +}; + +String.prototype.parseQuery = String.prototype.toQueryParams; + +Object.extend(String.prototype.escapeHTML, { + div: document.createElement('div'), + text: document.createTextNode('') +}); + +String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text); + +var Template = Class.create({ + initialize: function(template, pattern) { + this.template = template.toString(); + this.pattern = pattern || Template.Pattern; + }, + + evaluate: function(object) { + if (Object.isFunction(object.toTemplateReplacements)) + object = object.toTemplateReplacements(); + + return this.template.gsub(this.pattern, function(match) { + if (object == null) return ''; + + var before = match[1] || ''; + if (before == '\\') return match[2]; + + var ctx = object, expr = match[3]; + var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/; + match = pattern.exec(expr); + if (match == null) return before; + + while (match != null) { + var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1]; + ctx = ctx[comp]; + if (null == ctx || '' == match[3]) break; + expr = expr.substring('[' == match[3] ? match[1].length : match[0].length); + match = pattern.exec(expr); + } + + return before + String.interpret(ctx); + }); + } +}); +Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; + +var $break = { }; + +var Enumerable = { + each: function(iterator, context) { + var index = 0; + try { + this._each(function(value) { + iterator.call(context, value, index++); + }); + } catch (e) { + if (e != $break) throw e; + } + return this; + }, + + eachSlice: function(number, iterator, context) { + var index = -number, slices = [], array = this.toArray(); + if (number < 1) return array; + while ((index += number) < array.length) + slices.push(array.slice(index, index+number)); + return slices.collect(iterator, context); + }, + + all: function(iterator, context) { + iterator = iterator || Prototype.K; + var result = true; + this.each(function(value, index) { + result = result && !!iterator.call(context, value, index); + if (!result) throw $break; + }); + return result; + }, + + any: function(iterator, context) { + iterator = iterator || Prototype.K; + var result = false; + this.each(function(value, index) { + if (result = !!iterator.call(context, value, index)) + throw $break; + }); + return result; + }, + + collect: function(iterator, context) { + iterator = iterator || Prototype.K; + var results = []; + this.each(function(value, index) { + results.push(iterator.call(context, value, index)); + }); + return results; + }, + + detect: function(iterator, context) { + var result; + this.each(function(value, index) { + if (iterator.call(context, value, index)) { + result = value; + throw $break; + } + }); + return result; + }, + + findAll: function(iterator, context) { + var results = []; + this.each(function(value, index) { + if (iterator.call(context, value, index)) + results.push(value); + }); + return results; + }, + + grep: function(filter, iterator, context) { + iterator = iterator || Prototype.K; + var results = []; + + if (Object.isString(filter)) + filter = new RegExp(filter); + + this.each(function(value, index) { + if (filter.match(value)) + results.push(iterator.call(context, value, index)); + }); + return results; + }, + + include: function(object) { + if (Object.isFunction(this.indexOf)) + if (this.indexOf(object) != -1) return true; + + var found = false; + this.each(function(value) { + if (value == object) { + found = true; + throw $break; + } + }); + return found; + }, + + inGroupsOf: function(number, fillWith) { + fillWith = Object.isUndefined(fillWith) ? null : fillWith; + return this.eachSlice(number, function(slice) { + while(slice.length < number) slice.push(fillWith); + return slice; + }); + }, + + inject: function(memo, iterator, context) { + this.each(function(value, index) { + memo = iterator.call(context, memo, value, index); + }); + return memo; + }, + + invoke: function(method) { + var args = $A(arguments).slice(1); + return this.map(function(value) { + return value[method].apply(value, args); + }); + }, + + max: function(iterator, context) { + iterator = iterator || Prototype.K; + var result; + this.each(function(value, index) { + value = iterator.call(context, value, index); + if (result == null || value >= result) + result = value; + }); + return result; + }, + + min: function(iterator, context) { + iterator = iterator || Prototype.K; + var result; + this.each(function(value, index) { + value = iterator.call(context, value, index); + if (result == null || value < result) + result = value; + }); + return result; + }, + + partition: function(iterator, context) { + iterator = iterator || Prototype.K; + var trues = [], falses = []; + this.each(function(value, index) { + (iterator.call(context, value, index) ? + trues : falses).push(value); + }); + return [trues, falses]; + }, + + pluck: function(property) { + var results = []; + this.each(function(value) { + results.push(value[property]); + }); + return results; + }, + + reject: function(iterator, context) { + var results = []; + this.each(function(value, index) { + if (!iterator.call(context, value, index)) + results.push(value); + }); + return results; + }, + + sortBy: function(iterator, context) { + return this.map(function(value, index) { + return { + value: value, + criteria: iterator.call(context, value, index) + }; + }).sort(function(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }).pluck('value'); + }, + + toArray: function() { + return this.map(); + }, + + zip: function() { + var iterator = Prototype.K, args = $A(arguments); + if (Object.isFunction(args.last())) + iterator = args.pop(); + + var collections = [this].concat(args).map($A); + return this.map(function(value, index) { + return iterator(collections.pluck(index)); + }); + }, + + size: function() { + return this.toArray().length; + }, + + inspect: function() { + return '#'; + } +}; + +Object.extend(Enumerable, { + map: Enumerable.collect, + find: Enumerable.detect, + select: Enumerable.findAll, + filter: Enumerable.findAll, + member: Enumerable.include, + entries: Enumerable.toArray, + every: Enumerable.all, + some: Enumerable.any +}); +function $A(iterable) { + if (!iterable) return []; + if (iterable.toArray) return iterable.toArray(); + var length = iterable.length || 0, results = new Array(length); + while (length--) results[length] = iterable[length]; + return results; +} + +if (Prototype.Browser.WebKit) { + $A = function(iterable) { + if (!iterable) return []; + // In Safari, only use the `toArray` method if it's not a NodeList. + // A NodeList is a function, has an function `item` property, and a numeric + // `length` property. Adapted from Google Doctype. + if (!(typeof iterable === 'function' && typeof iterable.length === + 'number' && typeof iterable.item === 'function') && iterable.toArray) + return iterable.toArray(); + var length = iterable.length || 0, results = new Array(length); + while (length--) results[length] = iterable[length]; + return results; + }; +} + +Array.from = $A; + +Object.extend(Array.prototype, Enumerable); + +if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse; + +Object.extend(Array.prototype, { + _each: function(iterator) { + for (var i = 0, length = this.length; i < length; i++) + iterator(this[i]); + }, + + clear: function() { + this.length = 0; + return this; + }, + + first: function() { + return this[0]; + }, + + last: function() { + return this[this.length - 1]; + }, + + compact: function() { + return this.select(function(value) { + return value != null; + }); + }, + + flatten: function() { + return this.inject([], function(array, value) { + return array.concat(Object.isArray(value) ? + value.flatten() : [value]); + }); + }, + + without: function() { + var values = $A(arguments); + return this.select(function(value) { + return !values.include(value); + }); + }, + + reverse: function(inline) { + return (inline !== false ? this : this.toArray())._reverse(); + }, + + reduce: function() { + return this.length > 1 ? this : this[0]; + }, + + uniq: function(sorted) { + return this.inject([], function(array, value, index) { + if (0 == index || (sorted ? array.last() != value : !array.include(value))) + array.push(value); + return array; + }); + }, + + intersect: function(array) { + return this.uniq().findAll(function(item) { + return array.detect(function(value) { return item === value }); + }); + }, + + clone: function() { + return [].concat(this); + }, + + size: function() { + return this.length; + }, + + inspect: function() { + return '[' + this.map(Object.inspect).join(', ') + ']'; + }, + + toJSON: function() { + var results = []; + this.each(function(object) { + var value = Object.toJSON(object); + if (!Object.isUndefined(value)) results.push(value); + }); + return '[' + results.join(', ') + ']'; + } +}); + +// use native browser JS 1.6 implementation if available +if (Object.isFunction(Array.prototype.forEach)) + Array.prototype._each = Array.prototype.forEach; + +if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) { + i || (i = 0); + var length = this.length; + if (i < 0) i = length + i; + for (; i < length; i++) + if (this[i] === item) return i; + return -1; +}; + +if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) { + i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1; + var n = this.slice(0, i).reverse().indexOf(item); + return (n < 0) ? n : i - n - 1; +}; + +Array.prototype.toArray = Array.prototype.clone; + +function $w(string) { + if (!Object.isString(string)) return []; + string = string.strip(); + return string ? string.split(/\s+/) : []; +} + +if (Prototype.Browser.Opera){ + Array.prototype.concat = function() { + var array = []; + for (var i = 0, length = this.length; i < length; i++) array.push(this[i]); + for (var i = 0, length = arguments.length; i < length; i++) { + if (Object.isArray(arguments[i])) { + for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) + array.push(arguments[i][j]); + } else { + array.push(arguments[i]); + } + } + return array; + }; +} +Object.extend(Number.prototype, { + toColorPart: function() { + return this.toPaddedString(2, 16); + }, + + succ: function() { + return this + 1; + }, + + times: function(iterator, context) { + $R(0, this, true).each(iterator, context); + return this; + }, + + toPaddedString: function(length, radix) { + var string = this.toString(radix || 10); + return '0'.times(length - string.length) + string; + }, + + toJSON: function() { + return isFinite(this) ? this.toString() : 'null'; + } +}); + +$w('abs round ceil floor').each(function(method){ + Number.prototype[method] = Math[method].methodize(); +}); +function $H(object) { + return new Hash(object); +}; + +var Hash = Class.create(Enumerable, (function() { + + function toQueryPair(key, value) { + if (Object.isUndefined(value)) return key; + return key + '=' + encodeURIComponent(String.interpret(value)); + } + + return { + initialize: function(object) { + this._object = Object.isHash(object) ? object.toObject() : Object.clone(object); + }, + + _each: function(iterator) { + for (var key in this._object) { + var value = this._object[key], pair = [key, value]; + pair.key = key; + pair.value = value; + iterator(pair); + } + }, + + set: function(key, value) { + return this._object[key] = value; + }, + + get: function(key) { + // simulating poorly supported hasOwnProperty + if (this._object[key] !== Object.prototype[key]) + return this._object[key]; + }, + + unset: function(key) { + var value = this._object[key]; + delete this._object[key]; + return value; + }, + + toObject: function() { + return Object.clone(this._object); + }, + + keys: function() { + return this.pluck('key'); + }, + + values: function() { + return this.pluck('value'); + }, + + index: function(value) { + var match = this.detect(function(pair) { + return pair.value === value; + }); + return match && match.key; + }, + + merge: function(object) { + return this.clone().update(object); + }, + + update: function(object) { + return new Hash(object).inject(this, function(result, pair) { + result.set(pair.key, pair.value); + return result; + }); + }, + + toQueryString: function() { + return this.inject([], function(results, pair) { + var key = encodeURIComponent(pair.key), values = pair.value; + + if (values && typeof values == 'object') { + if (Object.isArray(values)) + return results.concat(values.map(toQueryPair.curry(key))); + } else results.push(toQueryPair(key, values)); + return results; + }).join('&'); + }, + + inspect: function() { + return '#'; + }, + + toJSON: function() { + return Object.toJSON(this.toObject()); + }, + + clone: function() { + return new Hash(this); + } + } +})()); + +Hash.prototype.toTemplateReplacements = Hash.prototype.toObject; +Hash.from = $H; +var ObjectRange = Class.create(Enumerable, { + initialize: function(start, end, exclusive) { + this.start = start; + this.end = end; + this.exclusive = exclusive; + }, + + _each: function(iterator) { + var value = this.start; + while (this.include(value)) { + iterator(value); + value = value.succ(); + } + }, + + include: function(value) { + if (value < this.start) + return false; + if (this.exclusive) + return value < this.end; + return value <= this.end; + } +}); + +var $R = function(start, end, exclusive) { + return new ObjectRange(start, end, exclusive); +}; + +var Ajax = { + getTransport: function() { + return Try.these( + function() {return new XMLHttpRequest()}, + function() {return new ActiveXObject('Msxml2.XMLHTTP')}, + function() {return new ActiveXObject('Microsoft.XMLHTTP')} + ) || false; + }, + + activeRequestCount: 0 +}; + +Ajax.Responders = { + responders: [], + + _each: function(iterator) { + this.responders._each(iterator); + }, + + register: function(responder) { + if (!this.include(responder)) + this.responders.push(responder); + }, + + unregister: function(responder) { + this.responders = this.responders.without(responder); + }, + + dispatch: function(callback, request, transport, json) { + this.each(function(responder) { + if (Object.isFunction(responder[callback])) { + try { + responder[callback].apply(responder, [request, transport, json]); + } catch (e) { } + } + }); + } +}; + +Object.extend(Ajax.Responders, Enumerable); + +Ajax.Responders.register({ + onCreate: function() { Ajax.activeRequestCount++ }, + onComplete: function() { Ajax.activeRequestCount-- } +}); + +Ajax.Base = Class.create({ + initialize: function(options) { + this.options = { + method: 'post', + asynchronous: true, + contentType: 'application/x-www-form-urlencoded', + encoding: 'UTF-8', + parameters: '', + evalJSON: true, + evalJS: true + }; + Object.extend(this.options, options || { }); + + this.options.method = this.options.method.toLowerCase(); + + if (Object.isString(this.options.parameters)) + this.options.parameters = this.options.parameters.toQueryParams(); + else if (Object.isHash(this.options.parameters)) + this.options.parameters = this.options.parameters.toObject(); + } +}); + +Ajax.Request = Class.create(Ajax.Base, { + _complete: false, + + initialize: function($super, url, options) { + $super(options); + this.transport = Ajax.getTransport(); + this.request(url); + }, + + request: function(url) { + this.url = url; + this.method = this.options.method; + var params = Object.clone(this.options.parameters); + + if (!['get', 'post'].include(this.method)) { + // simulate other verbs over post + params['_method'] = this.method; + this.method = 'post'; + } + + this.parameters = params; + + if (params = Object.toQueryString(params)) { + // when GET, append parameters to URL + if (this.method == 'get') + this.url += (this.url.include('?') ? '&' : '?') + params; + else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) + params += '&_='; + } + + try { + var response = new Ajax.Response(this); + if (this.options.onCreate) this.options.onCreate(response); + Ajax.Responders.dispatch('onCreate', this, response); + + this.transport.open(this.method.toUpperCase(), this.url, + this.options.asynchronous); + + if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1); + + this.transport.onreadystatechange = this.onStateChange.bind(this); + this.setRequestHeaders(); + + this.body = this.method == 'post' ? (this.options.postBody || params) : null; + this.transport.send(this.body); + + /* Force Firefox to handle ready state 4 for synchronous requests */ + if (!this.options.asynchronous && this.transport.overrideMimeType) + this.onStateChange(); + + } + catch (e) { + this.dispatchException(e); + } + }, + + onStateChange: function() { + var readyState = this.transport.readyState; + if (readyState > 1 && !((readyState == 4) && this._complete)) + this.respondToReadyState(this.transport.readyState); + }, + + setRequestHeaders: function() { + var headers = { + 'X-Requested-With': 'XMLHttpRequest', + 'X-Prototype-Version': Prototype.Version, + 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' + }; + + if (this.method == 'post') { + headers['Content-type'] = this.options.contentType + + (this.options.encoding ? '; charset=' + this.options.encoding : ''); + + /* Force "Connection: close" for older Mozilla browsers to work + * around a bug where XMLHttpRequest sends an incorrect + * Content-length header. See Mozilla Bugzilla #246651. + */ + if (this.transport.overrideMimeType && + (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) + headers['Connection'] = 'close'; + } + + // user-defined headers + if (typeof this.options.requestHeaders == 'object') { + var extras = this.options.requestHeaders; + + if (Object.isFunction(extras.push)) + for (var i = 0, length = extras.length; i < length; i += 2) + headers[extras[i]] = extras[i+1]; + else + $H(extras).each(function(pair) { headers[pair.key] = pair.value }); + } + + for (var name in headers) + this.transport.setRequestHeader(name, headers[name]); + }, + + success: function() { + var status = this.getStatus(); + return !status || (status >= 200 && status < 300); + }, + + getStatus: function() { + try { + return this.transport.status || 0; + } catch (e) { return 0 } + }, + + respondToReadyState: function(readyState) { + var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); + + if (state == 'Complete') { + try { + this._complete = true; + (this.options['on' + response.status] + || this.options['on' + (this.success() ? 'Success' : 'Failure')] + || Prototype.emptyFunction)(response, response.headerJSON); + } catch (e) { + this.dispatchException(e); + } + + var contentType = response.getHeader('Content-type'); + if (this.options.evalJS == 'force' + || (this.options.evalJS && this.isSameOrigin() && contentType + && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) + this.evalResponse(); + } + + try { + (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); + Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON); + } catch (e) { + this.dispatchException(e); + } + + if (state == 'Complete') { + // avoid memory leak in MSIE: clean up + this.transport.onreadystatechange = Prototype.emptyFunction; + } + }, + + isSameOrigin: function() { + var m = this.url.match(/^\s*https?:\/\/[^\/]*/); + return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({ + protocol: location.protocol, + domain: document.domain, + port: location.port ? ':' + location.port : '' + })); + }, + + getHeader: function(name) { + try { + return this.transport.getResponseHeader(name) || null; + } catch (e) { return null } + }, + + evalResponse: function() { + try { + return eval((this.transport.responseText || '').unfilterJSON()); + } catch (e) { + this.dispatchException(e); + } + }, + + dispatchException: function(exception) { + (this.options.onException || Prototype.emptyFunction)(this, exception); + Ajax.Responders.dispatch('onException', this, exception); + } +}); + +Ajax.Request.Events = + ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; + +Ajax.Response = Class.create({ + initialize: function(request){ + this.request = request; + var transport = this.transport = request.transport, + readyState = this.readyState = transport.readyState; + + if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) { + this.status = this.getStatus(); + this.statusText = this.getStatusText(); + this.responseText = String.interpret(transport.responseText); + this.headerJSON = this._getHeaderJSON(); + } + + if(readyState == 4) { + var xml = transport.responseXML; + this.responseXML = Object.isUndefined(xml) ? null : xml; + this.responseJSON = this._getResponseJSON(); + } + }, + + status: 0, + statusText: '', + + getStatus: Ajax.Request.prototype.getStatus, + + getStatusText: function() { + try { + return this.transport.statusText || ''; + } catch (e) { return '' } + }, + + getHeader: Ajax.Request.prototype.getHeader, + + getAllHeaders: function() { + try { + return this.getAllResponseHeaders(); + } catch (e) { return null } + }, + + getResponseHeader: function(name) { + return this.transport.getResponseHeader(name); + }, + + getAllResponseHeaders: function() { + return this.transport.getAllResponseHeaders(); + }, + + _getHeaderJSON: function() { + var json = this.getHeader('X-JSON'); + if (!json) return null; + json = decodeURIComponent(escape(json)); + try { + return json.evalJSON(this.request.options.sanitizeJSON || + !this.request.isSameOrigin()); + } catch (e) { + this.request.dispatchException(e); + } + }, + + _getResponseJSON: function() { + var options = this.request.options; + if (!options.evalJSON || (options.evalJSON != 'force' && + !(this.getHeader('Content-type') || '').include('application/json')) || + this.responseText.blank()) + return null; + try { + return this.responseText.evalJSON(options.sanitizeJSON || + !this.request.isSameOrigin()); + } catch (e) { + this.request.dispatchException(e); + } + } +}); + +Ajax.Updater = Class.create(Ajax.Request, { + initialize: function($super, container, url, options) { + this.container = { + success: (container.success || container), + failure: (container.failure || (container.success ? null : container)) + }; + + options = Object.clone(options); + var onComplete = options.onComplete; + options.onComplete = (function(response, json) { + this.updateContent(response.responseText); + if (Object.isFunction(onComplete)) onComplete(response, json); + }).bind(this); + + $super(url, options); + }, + + updateContent: function(responseText) { + var receiver = this.container[this.success() ? 'success' : 'failure'], + options = this.options; + + if (!options.evalScripts) responseText = responseText.stripScripts(); + + if (receiver = $(receiver)) { + if (options.insertion) { + if (Object.isString(options.insertion)) { + var insertion = { }; insertion[options.insertion] = responseText; + receiver.insert(insertion); + } + else options.insertion(receiver, responseText); + } + else receiver.update(responseText); + } + } +}); + +Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { + initialize: function($super, container, url, options) { + $super(options); + this.onComplete = this.options.onComplete; + + this.frequency = (this.options.frequency || 2); + this.decay = (this.options.decay || 1); + + this.updater = { }; + this.container = container; + this.url = url; + + this.start(); + }, + + start: function() { + this.options.onComplete = this.updateComplete.bind(this); + this.onTimerEvent(); + }, + + stop: function() { + this.updater.options.onComplete = undefined; + clearTimeout(this.timer); + (this.onComplete || Prototype.emptyFunction).apply(this, arguments); + }, + + updateComplete: function(response) { + if (this.options.decay) { + this.decay = (response.responseText == this.lastText ? + this.decay * this.options.decay : 1); + + this.lastText = response.responseText; + } + this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); + }, + + onTimerEvent: function() { + this.updater = new Ajax.Updater(this.container, this.url, this.options); + } +}); +function $(element) { + if (arguments.length > 1) { + for (var i = 0, elements = [], length = arguments.length; i < length; i++) + elements.push($(arguments[i])); + return elements; + } + if (Object.isString(element)) + element = document.getElementById(element); + return Element.extend(element); +} + +if (Prototype.BrowserFeatures.XPath) { + document._getElementsByXPath = function(expression, parentElement) { + var results = []; + var query = document.evaluate(expression, $(parentElement) || document, + null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); + for (var i = 0, length = query.snapshotLength; i < length; i++) + results.push(Element.extend(query.snapshotItem(i))); + return results; + }; +} + +/*--------------------------------------------------------------------------*/ + +if (!window.Node) var Node = { }; + +if (!Node.ELEMENT_NODE) { + // DOM level 2 ECMAScript Language Binding + Object.extend(Node, { + ELEMENT_NODE: 1, + ATTRIBUTE_NODE: 2, + TEXT_NODE: 3, + CDATA_SECTION_NODE: 4, + ENTITY_REFERENCE_NODE: 5, + ENTITY_NODE: 6, + PROCESSING_INSTRUCTION_NODE: 7, + COMMENT_NODE: 8, + DOCUMENT_NODE: 9, + DOCUMENT_TYPE_NODE: 10, + DOCUMENT_FRAGMENT_NODE: 11, + NOTATION_NODE: 12 + }); +} + +(function() { + var element = this.Element; + this.Element = function(tagName, attributes) { + attributes = attributes || { }; + tagName = tagName.toLowerCase(); + var cache = Element.cache; + if (Prototype.Browser.IE && attributes.name) { + tagName = '<' + tagName + ' name="' + attributes.name + '">'; + delete attributes.name; + return Element.writeAttribute(document.createElement(tagName), attributes); + } + if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName)); + return Element.writeAttribute(cache[tagName].cloneNode(false), attributes); + }; + Object.extend(this.Element, element || { }); + if (element) this.Element.prototype = element.prototype; +}).call(window); + +Element.cache = { }; + +Element.Methods = { + visible: function(element) { + return $(element).style.display != 'none'; + }, + + toggle: function(element) { + element = $(element); + Element[Element.visible(element) ? 'hide' : 'show'](element); + return element; + }, + + hide: function(element) { + element = $(element); + element.style.display = 'none'; + return element; + }, + + show: function(element) { + element = $(element); + element.style.display = ''; + return element; + }, + + remove: function(element) { + element = $(element); + element.parentNode.removeChild(element); + return element; + }, + + update: function(element, content) { + element = $(element); + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) return element.update().insert(content); + content = Object.toHTML(content); + element.innerHTML = content.stripScripts(); + content.evalScripts.bind(content).defer(); + return element; + }, + + replace: function(element, content) { + element = $(element); + if (content && content.toElement) content = content.toElement(); + else if (!Object.isElement(content)) { + content = Object.toHTML(content); + var range = element.ownerDocument.createRange(); + range.selectNode(element); + content.evalScripts.bind(content).defer(); + content = range.createContextualFragment(content.stripScripts()); + } + element.parentNode.replaceChild(content, element); + return element; + }, + + insert: function(element, insertions) { + element = $(element); + + if (Object.isString(insertions) || Object.isNumber(insertions) || + Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) + insertions = {bottom:insertions}; + + var content, insert, tagName, childNodes; + + for (var position in insertions) { + content = insertions[position]; + position = position.toLowerCase(); + insert = Element._insertionTranslations[position]; + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) { + insert(element, content); + continue; + } + + content = Object.toHTML(content); + + tagName = ((position == 'before' || position == 'after') + ? element.parentNode : element).tagName.toUpperCase(); + + childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); + + if (position == 'top' || position == 'after') childNodes.reverse(); + childNodes.each(insert.curry(element)); + + content.evalScripts.bind(content).defer(); + } + + return element; + }, + + wrap: function(element, wrapper, attributes) { + element = $(element); + if (Object.isElement(wrapper)) + $(wrapper).writeAttribute(attributes || { }); + else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes); + else wrapper = new Element('div', wrapper); + if (element.parentNode) + element.parentNode.replaceChild(wrapper, element); + wrapper.appendChild(element); + return wrapper; + }, + + inspect: function(element) { + element = $(element); + var result = '<' + element.tagName.toLowerCase(); + $H({'id': 'id', 'className': 'class'}).each(function(pair) { + var property = pair.first(), attribute = pair.last(); + var value = (element[property] || '').toString(); + if (value) result += ' ' + attribute + '=' + value.inspect(true); + }); + return result + '>'; + }, + + recursivelyCollect: function(element, property) { + element = $(element); + var elements = []; + while (element = element[property]) + if (element.nodeType == 1) + elements.push(Element.extend(element)); + return elements; + }, + + ancestors: function(element) { + return $(element).recursivelyCollect('parentNode'); + }, + + descendants: function(element) { + return $(element).select("*"); + }, + + firstDescendant: function(element) { + element = $(element).firstChild; + while (element && element.nodeType != 1) element = element.nextSibling; + return $(element); + }, + + immediateDescendants: function(element) { + if (!(element = $(element).firstChild)) return []; + while (element && element.nodeType != 1) element = element.nextSibling; + if (element) return [element].concat($(element).nextSiblings()); + return []; + }, + + previousSiblings: function(element) { + return $(element).recursivelyCollect('previousSibling'); + }, + + nextSiblings: function(element) { + return $(element).recursivelyCollect('nextSibling'); + }, + + siblings: function(element) { + element = $(element); + return element.previousSiblings().reverse().concat(element.nextSiblings()); + }, + + match: function(element, selector) { + if (Object.isString(selector)) + selector = new Selector(selector); + return selector.match($(element)); + }, + + up: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(element.parentNode); + var ancestors = element.ancestors(); + return Object.isNumber(expression) ? ancestors[expression] : + Selector.findElement(ancestors, expression, index); + }, + + down: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return element.firstDescendant(); + return Object.isNumber(expression) ? element.descendants()[expression] : + Element.select(element, expression)[index || 0]; + }, + + previous: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element)); + var previousSiblings = element.previousSiblings(); + return Object.isNumber(expression) ? previousSiblings[expression] : + Selector.findElement(previousSiblings, expression, index); + }, + + next: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element)); + var nextSiblings = element.nextSiblings(); + return Object.isNumber(expression) ? nextSiblings[expression] : + Selector.findElement(nextSiblings, expression, index); + }, + + select: function() { + var args = $A(arguments), element = $(args.shift()); + return Selector.findChildElements(element, args); + }, + + adjacent: function() { + var args = $A(arguments), element = $(args.shift()); + return Selector.findChildElements(element.parentNode, args).without(element); + }, + + identify: function(element) { + element = $(element); + var id = element.readAttribute('id'), self = arguments.callee; + if (id) return id; + do { id = 'anonymous_element_' + self.counter++ } while ($(id)); + element.writeAttribute('id', id); + return id; + }, + + readAttribute: function(element, name) { + element = $(element); + if (Prototype.Browser.IE) { + var t = Element._attributeTranslations.read; + if (t.values[name]) return t.values[name](element, name); + if (t.names[name]) name = t.names[name]; + if (name.include(':')) { + return (!element.attributes || !element.attributes[name]) ? null : + element.attributes[name].value; + } + } + return element.getAttribute(name); + }, + + writeAttribute: function(element, name, value) { + element = $(element); + var attributes = { }, t = Element._attributeTranslations.write; + + if (typeof name == 'object') attributes = name; + else attributes[name] = Object.isUndefined(value) ? true : value; + + for (var attr in attributes) { + name = t.names[attr] || attr; + value = attributes[attr]; + if (t.values[attr]) name = t.values[attr](element, value); + if (value === false || value === null) + element.removeAttribute(name); + else if (value === true) + element.setAttribute(name, name); + else element.setAttribute(name, value); + } + return element; + }, + + getHeight: function(element) { + return $(element).getDimensions().height; + }, + + getWidth: function(element) { + return $(element).getDimensions().width; + }, + + classNames: function(element) { + return new Element.ClassNames(element); + }, + + hasClassName: function(element, className) { + if (!(element = $(element))) return; + var elementClassName = element.className; + return (elementClassName.length > 0 && (elementClassName == className || + new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); + }, + + addClassName: function(element, className) { + if (!(element = $(element))) return; + if (!element.hasClassName(className)) + element.className += (element.className ? ' ' : '') + className; + return element; + }, + + removeClassName: function(element, className) { + if (!(element = $(element))) return; + element.className = element.className.replace( + new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip(); + return element; + }, + + toggleClassName: function(element, className) { + if (!(element = $(element))) return; + return element[element.hasClassName(className) ? + 'removeClassName' : 'addClassName'](className); + }, + + // removes whitespace-only text node children + cleanWhitespace: function(element) { + element = $(element); + var node = element.firstChild; + while (node) { + var nextNode = node.nextSibling; + if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) + element.removeChild(node); + node = nextNode; + } + return element; + }, + + empty: function(element) { + return $(element).innerHTML.blank(); + }, + + descendantOf: function(element, ancestor) { + element = $(element), ancestor = $(ancestor); + + if (element.compareDocumentPosition) + return (element.compareDocumentPosition(ancestor) & 8) === 8; + + if (ancestor.contains) + return ancestor.contains(element) && ancestor !== element; + + while (element = element.parentNode) + if (element == ancestor) return true; + + return false; + }, + + scrollTo: function(element) { + element = $(element); + var pos = element.cumulativeOffset(); + window.scrollTo(pos[0], pos[1]); + return element; + }, + + getStyle: function(element, style) { + element = $(element); + style = style == 'float' ? 'cssFloat' : style.camelize(); + var value = element.style[style]; + if (!value || value == 'auto') { + var css = document.defaultView.getComputedStyle(element, null); + value = css ? css[style] : null; + } + if (style == 'opacity') return value ? parseFloat(value) : 1.0; + return value == 'auto' ? null : value; + }, + + getOpacity: function(element) { + return $(element).getStyle('opacity'); + }, + + setStyle: function(element, styles) { + element = $(element); + var elementStyle = element.style, match; + if (Object.isString(styles)) { + element.style.cssText += ';' + styles; + return styles.include('opacity') ? + element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element; + } + for (var property in styles) + if (property == 'opacity') element.setOpacity(styles[property]); + else + elementStyle[(property == 'float' || property == 'cssFloat') ? + (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') : + property] = styles[property]; + + return element; + }, + + setOpacity: function(element, value) { + element = $(element); + element.style.opacity = (value == 1 || value === '') ? '' : + (value < 0.00001) ? 0 : value; + return element; + }, + + getDimensions: function(element) { + element = $(element); + var display = element.getStyle('display'); + if (display != 'none' && display != null) // Safari bug + return {width: element.offsetWidth, height: element.offsetHeight}; + + // All *Width and *Height properties give 0 on elements with display none, + // so enable the element temporarily + var els = element.style; + var originalVisibility = els.visibility; + var originalPosition = els.position; + var originalDisplay = els.display; + els.visibility = 'hidden'; + els.position = 'absolute'; + els.display = 'block'; + var originalWidth = element.clientWidth; + var originalHeight = element.clientHeight; + els.display = originalDisplay; + els.position = originalPosition; + els.visibility = originalVisibility; + return {width: originalWidth, height: originalHeight}; + }, + + makePositioned: function(element) { + element = $(element); + var pos = Element.getStyle(element, 'position'); + if (pos == 'static' || !pos) { + element._madePositioned = true; + element.style.position = 'relative'; + // Opera returns the offset relative to the positioning context, when an + // element is position relative but top and left have not been defined + if (Prototype.Browser.Opera) { + element.style.top = 0; + element.style.left = 0; + } + } + return element; + }, + + undoPositioned: function(element) { + element = $(element); + if (element._madePositioned) { + element._madePositioned = undefined; + element.style.position = + element.style.top = + element.style.left = + element.style.bottom = + element.style.right = ''; + } + return element; + }, + + makeClipping: function(element) { + element = $(element); + if (element._overflow) return element; + element._overflow = Element.getStyle(element, 'overflow') || 'auto'; + if (element._overflow !== 'hidden') + element.style.overflow = 'hidden'; + return element; + }, + + undoClipping: function(element) { + element = $(element); + if (!element._overflow) return element; + element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; + element._overflow = null; + return element; + }, + + cumulativeOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + positionedOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + if (element) { + if (element.tagName.toUpperCase() == 'BODY') break; + var p = Element.getStyle(element, 'position'); + if (p !== 'static') break; + } + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + absolutize: function(element) { + element = $(element); + if (element.getStyle('position') == 'absolute') return element; + // Position.prepare(); // To be done manually by Scripty when it needs it. + + var offsets = element.positionedOffset(); + var top = offsets[1]; + var left = offsets[0]; + var width = element.clientWidth; + var height = element.clientHeight; + + element._originalLeft = left - parseFloat(element.style.left || 0); + element._originalTop = top - parseFloat(element.style.top || 0); + element._originalWidth = element.style.width; + element._originalHeight = element.style.height; + + element.style.position = 'absolute'; + element.style.top = top + 'px'; + element.style.left = left + 'px'; + element.style.width = width + 'px'; + element.style.height = height + 'px'; + return element; + }, + + relativize: function(element) { + element = $(element); + if (element.getStyle('position') == 'relative') return element; + // Position.prepare(); // To be done manually by Scripty when it needs it. + + element.style.position = 'relative'; + var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); + var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); + + element.style.top = top + 'px'; + element.style.left = left + 'px'; + element.style.height = element._originalHeight; + element.style.width = element._originalWidth; + return element; + }, + + cumulativeScrollOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.scrollTop || 0; + valueL += element.scrollLeft || 0; + element = element.parentNode; + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + getOffsetParent: function(element) { + if (element.offsetParent) return $(element.offsetParent); + if (element == document.body) return $(element); + + while ((element = element.parentNode) && element != document.body) + if (Element.getStyle(element, 'position') != 'static') + return $(element); + + return $(document.body); + }, + + viewportOffset: function(forElement) { + var valueT = 0, valueL = 0; + + var element = forElement; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + + // Safari fix + if (element.offsetParent == document.body && + Element.getStyle(element, 'position') == 'absolute') break; + + } while (element = element.offsetParent); + + element = forElement; + do { + if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) { + valueT -= element.scrollTop || 0; + valueL -= element.scrollLeft || 0; + } + } while (element = element.parentNode); + + return Element._returnOffset(valueL, valueT); + }, + + clonePosition: function(element, source) { + var options = Object.extend({ + setLeft: true, + setTop: true, + setWidth: true, + setHeight: true, + offsetTop: 0, + offsetLeft: 0 + }, arguments[2] || { }); + + // find page position of source + source = $(source); + var p = source.viewportOffset(); + + // find coordinate system to use + element = $(element); + var delta = [0, 0]; + var parent = null; + // delta [0,0] will do fine with position: fixed elements, + // position:absolute needs offsetParent deltas + if (Element.getStyle(element, 'position') == 'absolute') { + parent = element.getOffsetParent(); + delta = parent.viewportOffset(); + } + + // correct by body offsets (fixes Safari) + if (parent == document.body) { + delta[0] -= document.body.offsetLeft; + delta[1] -= document.body.offsetTop; + } + + // set position + if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; + if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; + if (options.setWidth) element.style.width = source.offsetWidth + 'px'; + if (options.setHeight) element.style.height = source.offsetHeight + 'px'; + return element; + } +}; + +Element.Methods.identify.counter = 1; + +Object.extend(Element.Methods, { + getElementsBySelector: Element.Methods.select, + childElements: Element.Methods.immediateDescendants +}); + +Element._attributeTranslations = { + write: { + names: { + className: 'class', + htmlFor: 'for' + }, + values: { } + } +}; + +if (Prototype.Browser.Opera) { + Element.Methods.getStyle = Element.Methods.getStyle.wrap( + function(proceed, element, style) { + switch (style) { + case 'left': case 'top': case 'right': case 'bottom': + if (proceed(element, 'position') === 'static') return null; + case 'height': case 'width': + // returns '0px' for hidden elements; we want it to return null + if (!Element.visible(element)) return null; + + // returns the border-box dimensions rather than the content-box + // dimensions, so we subtract padding and borders from the value + var dim = parseInt(proceed(element, style), 10); + + if (dim !== element['offset' + style.capitalize()]) + return dim + 'px'; + + var properties; + if (style === 'height') { + properties = ['border-top-width', 'padding-top', + 'padding-bottom', 'border-bottom-width']; + } + else { + properties = ['border-left-width', 'padding-left', + 'padding-right', 'border-right-width']; + } + return properties.inject(dim, function(memo, property) { + var val = proceed(element, property); + return val === null ? memo : memo - parseInt(val, 10); + }) + 'px'; + default: return proceed(element, style); + } + } + ); + + Element.Methods.readAttribute = Element.Methods.readAttribute.wrap( + function(proceed, element, attribute) { + if (attribute === 'title') return element.title; + return proceed(element, attribute); + } + ); +} + +else if (Prototype.Browser.IE) { + // IE doesn't report offsets correctly for static elements, so we change them + // to "relative" to get the values, then change them back. + Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap( + function(proceed, element) { + element = $(element); + // IE throws an error if element is not in document + try { element.offsetParent } + catch(e) { return $(document.body) } + var position = element.getStyle('position'); + if (position !== 'static') return proceed(element); + element.setStyle({ position: 'relative' }); + var value = proceed(element); + element.setStyle({ position: position }); + return value; + } + ); + + $w('positionedOffset viewportOffset').each(function(method) { + Element.Methods[method] = Element.Methods[method].wrap( + function(proceed, element) { + element = $(element); + try { element.offsetParent } + catch(e) { return Element._returnOffset(0,0) } + var position = element.getStyle('position'); + if (position !== 'static') return proceed(element); + // Trigger hasLayout on the offset parent so that IE6 reports + // accurate offsetTop and offsetLeft values for position: fixed. + var offsetParent = element.getOffsetParent(); + if (offsetParent && offsetParent.getStyle('position') === 'fixed') + offsetParent.setStyle({ zoom: 1 }); + element.setStyle({ position: 'relative' }); + var value = proceed(element); + element.setStyle({ position: position }); + return value; + } + ); + }); + + Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap( + function(proceed, element) { + try { element.offsetParent } + catch(e) { return Element._returnOffset(0,0) } + return proceed(element); + } + ); + + Element.Methods.getStyle = function(element, style) { + element = $(element); + style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize(); + var value = element.style[style]; + if (!value && element.currentStyle) value = element.currentStyle[style]; + + if (style == 'opacity') { + if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) + if (value[1]) return parseFloat(value[1]) / 100; + return 1.0; + } + + if (value == 'auto') { + if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none')) + return element['offset' + style.capitalize()] + 'px'; + return null; + } + return value; + }; + + Element.Methods.setOpacity = function(element, value) { + function stripAlpha(filter){ + return filter.replace(/alpha\([^\)]*\)/gi,''); + } + element = $(element); + var currentStyle = element.currentStyle; + if ((currentStyle && !currentStyle.hasLayout) || + (!currentStyle && element.style.zoom == 'normal')) + element.style.zoom = 1; + + var filter = element.getStyle('filter'), style = element.style; + if (value == 1 || value === '') { + (filter = stripAlpha(filter)) ? + style.filter = filter : style.removeAttribute('filter'); + return element; + } else if (value < 0.00001) value = 0; + style.filter = stripAlpha(filter) + + 'alpha(opacity=' + (value * 100) + ')'; + return element; + }; + + Element._attributeTranslations = { + read: { + names: { + 'class': 'className', + 'for': 'htmlFor' + }, + values: { + _getAttr: function(element, attribute) { + return element.getAttribute(attribute, 2); + }, + _getAttrNode: function(element, attribute) { + var node = element.getAttributeNode(attribute); + return node ? node.value : ""; + }, + _getEv: function(element, attribute) { + attribute = element.getAttribute(attribute); + return attribute ? attribute.toString().slice(23, -2) : null; + }, + _flag: function(element, attribute) { + return $(element).hasAttribute(attribute) ? attribute : null; + }, + style: function(element) { + return element.style.cssText.toLowerCase(); + }, + title: function(element) { + return element.title; + } + } + } + }; + + Element._attributeTranslations.write = { + names: Object.extend({ + cellpadding: 'cellPadding', + cellspacing: 'cellSpacing' + }, Element._attributeTranslations.read.names), + values: { + checked: function(element, value) { + element.checked = !!value; + }, + + style: function(element, value) { + element.style.cssText = value ? value : ''; + } + } + }; + + Element._attributeTranslations.has = {}; + + $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' + + 'encType maxLength readOnly longDesc frameBorder').each(function(attr) { + Element._attributeTranslations.write.names[attr.toLowerCase()] = attr; + Element._attributeTranslations.has[attr.toLowerCase()] = attr; + }); + + (function(v) { + Object.extend(v, { + href: v._getAttr, + src: v._getAttr, + type: v._getAttr, + action: v._getAttrNode, + disabled: v._flag, + checked: v._flag, + readonly: v._flag, + multiple: v._flag, + onload: v._getEv, + onunload: v._getEv, + onclick: v._getEv, + ondblclick: v._getEv, + onmousedown: v._getEv, + onmouseup: v._getEv, + onmouseover: v._getEv, + onmousemove: v._getEv, + onmouseout: v._getEv, + onfocus: v._getEv, + onblur: v._getEv, + onkeypress: v._getEv, + onkeydown: v._getEv, + onkeyup: v._getEv, + onsubmit: v._getEv, + onreset: v._getEv, + onselect: v._getEv, + onchange: v._getEv + }); + })(Element._attributeTranslations.read.values); +} + +else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { + Element.Methods.setOpacity = function(element, value) { + element = $(element); + element.style.opacity = (value == 1) ? 0.999999 : + (value === '') ? '' : (value < 0.00001) ? 0 : value; + return element; + }; +} + +else if (Prototype.Browser.WebKit) { + Element.Methods.setOpacity = function(element, value) { + element = $(element); + element.style.opacity = (value == 1 || value === '') ? '' : + (value < 0.00001) ? 0 : value; + + if (value == 1) + if(element.tagName.toUpperCase() == 'IMG' && element.width) { + element.width++; element.width--; + } else try { + var n = document.createTextNode(' '); + element.appendChild(n); + element.removeChild(n); + } catch (e) { } + + return element; + }; + + // Safari returns margins on body which is incorrect if the child is absolutely + // positioned. For performance reasons, redefine Element#cumulativeOffset for + // KHTML/WebKit only. + Element.Methods.cumulativeOffset = function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + if (element.offsetParent == document.body) + if (Element.getStyle(element, 'position') == 'absolute') break; + + element = element.offsetParent; + } while (element); + + return Element._returnOffset(valueL, valueT); + }; +} + +if (Prototype.Browser.IE || Prototype.Browser.Opera) { + // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements + Element.Methods.update = function(element, content) { + element = $(element); + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) return element.update().insert(content); + + content = Object.toHTML(content); + var tagName = element.tagName.toUpperCase(); + + if (tagName in Element._insertionTranslations.tags) { + $A(element.childNodes).each(function(node) { element.removeChild(node) }); + Element._getContentFromAnonymousElement(tagName, content.stripScripts()) + .each(function(node) { element.appendChild(node) }); + } + else element.innerHTML = content.stripScripts(); + + content.evalScripts.bind(content).defer(); + return element; + }; +} + +if ('outerHTML' in document.createElement('div')) { + Element.Methods.replace = function(element, content) { + element = $(element); + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) { + element.parentNode.replaceChild(content, element); + return element; + } + + content = Object.toHTML(content); + var parent = element.parentNode, tagName = parent.tagName.toUpperCase(); + + if (Element._insertionTranslations.tags[tagName]) { + var nextSibling = element.next(); + var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); + parent.removeChild(element); + if (nextSibling) + fragments.each(function(node) { parent.insertBefore(node, nextSibling) }); + else + fragments.each(function(node) { parent.appendChild(node) }); + } + else element.outerHTML = content.stripScripts(); + + content.evalScripts.bind(content).defer(); + return element; + }; +} + +Element._returnOffset = function(l, t) { + var result = [l, t]; + result.left = l; + result.top = t; + return result; +}; + +Element._getContentFromAnonymousElement = function(tagName, html) { + var div = new Element('div'), t = Element._insertionTranslations.tags[tagName]; + if (t) { + div.innerHTML = t[0] + html + t[1]; + t[2].times(function() { div = div.firstChild }); + } else div.innerHTML = html; + return $A(div.childNodes); +}; + +Element._insertionTranslations = { + before: function(element, node) { + element.parentNode.insertBefore(node, element); + }, + top: function(element, node) { + element.insertBefore(node, element.firstChild); + }, + bottom: function(element, node) { + element.appendChild(node); + }, + after: function(element, node) { + element.parentNode.insertBefore(node, element.nextSibling); + }, + tags: { + TABLE: ['', '
          ', 1], + TBODY: ['', '
          ', 2], + TR: ['', '
          ', 3], + TD: ['
          ', '
          ', 4], + SELECT: ['', 1] + } +}; + +(function() { + Object.extend(this.tags, { + THEAD: this.tags.TBODY, + TFOOT: this.tags.TBODY, + TH: this.tags.TD + }); +}).call(Element._insertionTranslations); + +Element.Methods.Simulated = { + hasAttribute: function(element, attribute) { + attribute = Element._attributeTranslations.has[attribute] || attribute; + var node = $(element).getAttributeNode(attribute); + return !!(node && node.specified); + } +}; + +Element.Methods.ByTag = { }; + +Object.extend(Element, Element.Methods); + +if (!Prototype.BrowserFeatures.ElementExtensions && + document.createElement('div')['__proto__']) { + window.HTMLElement = { }; + window.HTMLElement.prototype = document.createElement('div')['__proto__']; + Prototype.BrowserFeatures.ElementExtensions = true; +} + +Element.extend = (function() { + if (Prototype.BrowserFeatures.SpecificElementExtensions) + return Prototype.K; + + var Methods = { }, ByTag = Element.Methods.ByTag; + + var extend = Object.extend(function(element) { + if (!element || element._extendedByPrototype || + element.nodeType != 1 || element == window) return element; + + var methods = Object.clone(Methods), + tagName = element.tagName.toUpperCase(), property, value; + + // extend methods for specific tags + if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]); + + for (property in methods) { + value = methods[property]; + if (Object.isFunction(value) && !(property in element)) + element[property] = value.methodize(); + } + + element._extendedByPrototype = Prototype.emptyFunction; + return element; + + }, { + refresh: function() { + // extend methods for all tags (Safari doesn't need this) + if (!Prototype.BrowserFeatures.ElementExtensions) { + Object.extend(Methods, Element.Methods); + Object.extend(Methods, Element.Methods.Simulated); + } + } + }); + + extend.refresh(); + return extend; +})(); + +Element.hasAttribute = function(element, attribute) { + if (element.hasAttribute) return element.hasAttribute(attribute); + return Element.Methods.Simulated.hasAttribute(element, attribute); +}; + +Element.addMethods = function(methods) { + var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag; + + if (!methods) { + Object.extend(Form, Form.Methods); + Object.extend(Form.Element, Form.Element.Methods); + Object.extend(Element.Methods.ByTag, { + "FORM": Object.clone(Form.Methods), + "INPUT": Object.clone(Form.Element.Methods), + "SELECT": Object.clone(Form.Element.Methods), + "TEXTAREA": Object.clone(Form.Element.Methods) + }); + } + + if (arguments.length == 2) { + var tagName = methods; + methods = arguments[1]; + } + + if (!tagName) Object.extend(Element.Methods, methods || { }); + else { + if (Object.isArray(tagName)) tagName.each(extend); + else extend(tagName); + } + + function extend(tagName) { + tagName = tagName.toUpperCase(); + if (!Element.Methods.ByTag[tagName]) + Element.Methods.ByTag[tagName] = { }; + Object.extend(Element.Methods.ByTag[tagName], methods); + } + + function copy(methods, destination, onlyIfAbsent) { + onlyIfAbsent = onlyIfAbsent || false; + for (var property in methods) { + var value = methods[property]; + if (!Object.isFunction(value)) continue; + if (!onlyIfAbsent || !(property in destination)) + destination[property] = value.methodize(); + } + } + + function findDOMClass(tagName) { + var klass; + var trans = { + "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph", + "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList", + "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading", + "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote", + "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION": + "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD": + "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR": + "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET": + "FrameSet", "IFRAME": "IFrame" + }; + if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element'; + if (window[klass]) return window[klass]; + klass = 'HTML' + tagName + 'Element'; + if (window[klass]) return window[klass]; + klass = 'HTML' + tagName.capitalize() + 'Element'; + if (window[klass]) return window[klass]; + + window[klass] = { }; + window[klass].prototype = document.createElement(tagName)['__proto__']; + return window[klass]; + } + + if (F.ElementExtensions) { + copy(Element.Methods, HTMLElement.prototype); + copy(Element.Methods.Simulated, HTMLElement.prototype, true); + } + + if (F.SpecificElementExtensions) { + for (var tag in Element.Methods.ByTag) { + var klass = findDOMClass(tag); + if (Object.isUndefined(klass)) continue; + copy(T[tag], klass.prototype); + } + } + + Object.extend(Element, Element.Methods); + delete Element.ByTag; + + if (Element.extend.refresh) Element.extend.refresh(); + Element.cache = { }; +}; + +document.viewport = { + getDimensions: function() { + var dimensions = { }, B = Prototype.Browser; + $w('width height').each(function(d) { + var D = d.capitalize(); + if (B.WebKit && !document.evaluate) { + // Safari <3.0 needs self.innerWidth/Height + dimensions[d] = self['inner' + D]; + } else if (B.Opera && parseFloat(window.opera.version()) < 9.5) { + // Opera <9.5 needs document.body.clientWidth/Height + dimensions[d] = document.body['client' + D] + } else { + dimensions[d] = document.documentElement['client' + D]; + } + }); + return dimensions; + }, + + getWidth: function() { + return this.getDimensions().width; + }, + + getHeight: function() { + return this.getDimensions().height; + }, + + getScrollOffsets: function() { + return Element._returnOffset( + window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, + window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop); + } +}; +/* Portions of the Selector class are derived from Jack Slocum's DomQuery, + * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style + * license. Please see http://www.yui-ext.com/ for more information. */ + +var Selector = Class.create({ + initialize: function(expression) { + this.expression = expression.strip(); + + if (this.shouldUseSelectorsAPI()) { + this.mode = 'selectorsAPI'; + } else if (this.shouldUseXPath()) { + this.mode = 'xpath'; + this.compileXPathMatcher(); + } else { + this.mode = "normal"; + this.compileMatcher(); + } + + }, + + shouldUseXPath: function() { + if (!Prototype.BrowserFeatures.XPath) return false; + + var e = this.expression; + + // Safari 3 chokes on :*-of-type and :empty + if (Prototype.Browser.WebKit && + (e.include("-of-type") || e.include(":empty"))) + return false; + + // XPath can't do namespaced attributes, nor can it read + // the "checked" property from DOM nodes + if ((/(\[[\w-]*?:|:checked)/).test(e)) + return false; + + return true; + }, + + shouldUseSelectorsAPI: function() { + if (!Prototype.BrowserFeatures.SelectorsAPI) return false; + + if (!Selector._div) Selector._div = new Element('div'); + + // Make sure the browser treats the selector as valid. Test on an + // isolated element to minimize cost of this check. + try { + Selector._div.querySelector(this.expression); + } catch(e) { + return false; + } + + return true; + }, + + compileMatcher: function() { + var e = this.expression, ps = Selector.patterns, h = Selector.handlers, + c = Selector.criteria, le, p, m; + + if (Selector._cache[e]) { + this.matcher = Selector._cache[e]; + return; + } + + this.matcher = ["this.matcher = function(root) {", + "var r = root, h = Selector.handlers, c = false, n;"]; + + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + p = ps[i]; + if (m = e.match(p)) { + this.matcher.push(Object.isFunction(c[i]) ? c[i](m) : + new Template(c[i]).evaluate(m)); + e = e.replace(m[0], ''); + break; + } + } + } + + this.matcher.push("return h.unique(n);\n}"); + eval(this.matcher.join('\n')); + Selector._cache[this.expression] = this.matcher; + }, + + compileXPathMatcher: function() { + var e = this.expression, ps = Selector.patterns, + x = Selector.xpath, le, m; + + if (Selector._cache[e]) { + this.xpath = Selector._cache[e]; return; + } + + this.matcher = ['.//*']; + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + if (m = e.match(ps[i])) { + this.matcher.push(Object.isFunction(x[i]) ? x[i](m) : + new Template(x[i]).evaluate(m)); + e = e.replace(m[0], ''); + break; + } + } + } + + this.xpath = this.matcher.join(''); + Selector._cache[this.expression] = this.xpath; + }, + + findElements: function(root) { + root = root || document; + var e = this.expression, results; + + switch (this.mode) { + case 'selectorsAPI': + // querySelectorAll queries document-wide, then filters to descendants + // of the context element. That's not what we want. + // Add an explicit context to the selector if necessary. + if (root !== document) { + var oldId = root.id, id = $(root).identify(); + e = "#" + id + " " + e; + } + + results = $A(root.querySelectorAll(e)).map(Element.extend); + root.id = oldId; + + return results; + case 'xpath': + return document._getElementsByXPath(this.xpath, root); + default: + return this.matcher(root); + } + }, + + match: function(element) { + this.tokens = []; + + var e = this.expression, ps = Selector.patterns, as = Selector.assertions; + var le, p, m; + + while (e && le !== e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + p = ps[i]; + if (m = e.match(p)) { + // use the Selector.assertions methods unless the selector + // is too complex. + if (as[i]) { + this.tokens.push([i, Object.clone(m)]); + e = e.replace(m[0], ''); + } else { + // reluctantly do a document-wide search + // and look for a match in the array + return this.findElements(document).include(element); + } + } + } + } + + var match = true, name, matches; + for (var i = 0, token; token = this.tokens[i]; i++) { + name = token[0], matches = token[1]; + if (!Selector.assertions[name](element, matches)) { + match = false; break; + } + } + + return match; + }, + + toString: function() { + return this.expression; + }, + + inspect: function() { + return "#"; + } +}); + +Object.extend(Selector, { + _cache: { }, + + xpath: { + descendant: "//*", + child: "/*", + adjacent: "/following-sibling::*[1]", + laterSibling: '/following-sibling::*', + tagName: function(m) { + if (m[1] == '*') return ''; + return "[local-name()='" + m[1].toLowerCase() + + "' or local-name()='" + m[1].toUpperCase() + "']"; + }, + className: "[contains(concat(' ', @class, ' '), ' #{1} ')]", + id: "[@id='#{1}']", + attrPresence: function(m) { + m[1] = m[1].toLowerCase(); + return new Template("[@#{1}]").evaluate(m); + }, + attr: function(m) { + m[1] = m[1].toLowerCase(); + m[3] = m[5] || m[6]; + return new Template(Selector.xpath.operators[m[2]]).evaluate(m); + }, + pseudo: function(m) { + var h = Selector.xpath.pseudos[m[1]]; + if (!h) return ''; + if (Object.isFunction(h)) return h(m); + return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m); + }, + operators: { + '=': "[@#{1}='#{3}']", + '!=': "[@#{1}!='#{3}']", + '^=': "[starts-with(@#{1}, '#{3}')]", + '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']", + '*=': "[contains(@#{1}, '#{3}')]", + '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]", + '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]" + }, + pseudos: { + 'first-child': '[not(preceding-sibling::*)]', + 'last-child': '[not(following-sibling::*)]', + 'only-child': '[not(preceding-sibling::* or following-sibling::*)]', + 'empty': "[count(*) = 0 and (count(text()) = 0)]", + 'checked': "[@checked]", + 'disabled': "[(@disabled) and (@type!='hidden')]", + 'enabled': "[not(@disabled) and (@type!='hidden')]", + 'not': function(m) { + var e = m[6], p = Selector.patterns, + x = Selector.xpath, le, v; + + var exclusion = []; + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in p) { + if (m = e.match(p[i])) { + v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m); + exclusion.push("(" + v.substring(1, v.length - 1) + ")"); + e = e.replace(m[0], ''); + break; + } + } + } + return "[not(" + exclusion.join(" and ") + ")]"; + }, + 'nth-child': function(m) { + return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m); + }, + 'nth-last-child': function(m) { + return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m); + }, + 'nth-of-type': function(m) { + return Selector.xpath.pseudos.nth("position() ", m); + }, + 'nth-last-of-type': function(m) { + return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m); + }, + 'first-of-type': function(m) { + m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m); + }, + 'last-of-type': function(m) { + m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m); + }, + 'only-of-type': function(m) { + var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m); + }, + nth: function(fragment, m) { + var mm, formula = m[6], predicate; + if (formula == 'even') formula = '2n+0'; + if (formula == 'odd') formula = '2n+1'; + if (mm = formula.match(/^(\d+)$/)) // digit only + return '[' + fragment + "= " + mm[1] + ']'; + if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b + if (mm[1] == "-") mm[1] = -1; + var a = mm[1] ? Number(mm[1]) : 1; + var b = mm[2] ? Number(mm[2]) : 0; + predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " + + "((#{fragment} - #{b}) div #{a} >= 0)]"; + return new Template(predicate).evaluate({ + fragment: fragment, a: a, b: b }); + } + } + } + }, + + criteria: { + tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;', + className: 'n = h.className(n, r, "#{1}", c); c = false;', + id: 'n = h.id(n, r, "#{1}", c); c = false;', + attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;', + attr: function(m) { + m[3] = (m[5] || m[6]); + return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m); + }, + pseudo: function(m) { + if (m[6]) m[6] = m[6].replace(/"/g, '\\"'); + return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m); + }, + descendant: 'c = "descendant";', + child: 'c = "child";', + adjacent: 'c = "adjacent";', + laterSibling: 'c = "laterSibling";' + }, + + patterns: { + // combinators must be listed first + // (and descendant needs to be last combinator) + laterSibling: /^\s*~\s*/, + child: /^\s*>\s*/, + adjacent: /^\s*\+\s*/, + descendant: /^\s/, + + // selectors follow + tagName: /^\s*(\*|[\w\-]+)(\b|$)?/, + id: /^#([\w\-\*]+)(\b|$)/, + className: /^\.([\w\-\*]+)(\b|$)/, + pseudo: +/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/, + attrPresence: /^\[((?:[\w]+:)?[\w]+)\]/, + attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ + }, + + // for Selector.match and Element#match + assertions: { + tagName: function(element, matches) { + return matches[1].toUpperCase() == element.tagName.toUpperCase(); + }, + + className: function(element, matches) { + return Element.hasClassName(element, matches[1]); + }, + + id: function(element, matches) { + return element.id === matches[1]; + }, + + attrPresence: function(element, matches) { + return Element.hasAttribute(element, matches[1]); + }, + + attr: function(element, matches) { + var nodeValue = Element.readAttribute(element, matches[1]); + return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]); + } + }, + + handlers: { + // UTILITY FUNCTIONS + // joins two collections + concat: function(a, b) { + for (var i = 0, node; node = b[i]; i++) + a.push(node); + return a; + }, + + // marks an array of nodes for counting + mark: function(nodes) { + var _true = Prototype.emptyFunction; + for (var i = 0, node; node = nodes[i]; i++) + node._countedByPrototype = _true; + return nodes; + }, + + unmark: function(nodes) { + for (var i = 0, node; node = nodes[i]; i++) + node._countedByPrototype = undefined; + return nodes; + }, + + // mark each child node with its position (for nth calls) + // "ofType" flag indicates whether we're indexing for nth-of-type + // rather than nth-child + index: function(parentNode, reverse, ofType) { + parentNode._countedByPrototype = Prototype.emptyFunction; + if (reverse) { + for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) { + var node = nodes[i]; + if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++; + } + } else { + for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++) + if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++; + } + }, + + // filters out duplicates and extends all nodes + unique: function(nodes) { + if (nodes.length == 0) return nodes; + var results = [], n; + for (var i = 0, l = nodes.length; i < l; i++) + if (!(n = nodes[i])._countedByPrototype) { + n._countedByPrototype = Prototype.emptyFunction; + results.push(Element.extend(n)); + } + return Selector.handlers.unmark(results); + }, + + // COMBINATOR FUNCTIONS + descendant: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + h.concat(results, node.getElementsByTagName('*')); + return results; + }, + + child: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) { + for (var j = 0, child; child = node.childNodes[j]; j++) + if (child.nodeType == 1 && child.tagName != '!') results.push(child); + } + return results; + }, + + adjacent: function(nodes) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + var next = this.nextElementSibling(node); + if (next) results.push(next); + } + return results; + }, + + laterSibling: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + h.concat(results, Element.nextSiblings(node)); + return results; + }, + + nextElementSibling: function(node) { + while (node = node.nextSibling) + if (node.nodeType == 1) return node; + return null; + }, + + previousElementSibling: function(node) { + while (node = node.previousSibling) + if (node.nodeType == 1) return node; + return null; + }, + + // TOKEN FUNCTIONS + tagName: function(nodes, root, tagName, combinator) { + var uTagName = tagName.toUpperCase(); + var results = [], h = Selector.handlers; + if (nodes) { + if (combinator) { + // fastlane for ordinary descendant combinators + if (combinator == "descendant") { + for (var i = 0, node; node = nodes[i]; i++) + h.concat(results, node.getElementsByTagName(tagName)); + return results; + } else nodes = this[combinator](nodes); + if (tagName == "*") return nodes; + } + for (var i = 0, node; node = nodes[i]; i++) + if (node.tagName.toUpperCase() === uTagName) results.push(node); + return results; + } else return root.getElementsByTagName(tagName); + }, + + id: function(nodes, root, id, combinator) { + var targetNode = $(id), h = Selector.handlers; + if (!targetNode) return []; + if (!nodes && root == document) return [targetNode]; + if (nodes) { + if (combinator) { + if (combinator == 'child') { + for (var i = 0, node; node = nodes[i]; i++) + if (targetNode.parentNode == node) return [targetNode]; + } else if (combinator == 'descendant') { + for (var i = 0, node; node = nodes[i]; i++) + if (Element.descendantOf(targetNode, node)) return [targetNode]; + } else if (combinator == 'adjacent') { + for (var i = 0, node; node = nodes[i]; i++) + if (Selector.handlers.previousElementSibling(targetNode) == node) + return [targetNode]; + } else nodes = h[combinator](nodes); + } + for (var i = 0, node; node = nodes[i]; i++) + if (node == targetNode) return [targetNode]; + return []; + } + return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : []; + }, + + className: function(nodes, root, className, combinator) { + if (nodes && combinator) nodes = this[combinator](nodes); + return Selector.handlers.byClassName(nodes, root, className); + }, + + byClassName: function(nodes, root, className) { + if (!nodes) nodes = Selector.handlers.descendant([root]); + var needle = ' ' + className + ' '; + for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) { + nodeClassName = node.className; + if (nodeClassName.length == 0) continue; + if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle)) + results.push(node); + } + return results; + }, + + attrPresence: function(nodes, root, attr, combinator) { + if (!nodes) nodes = root.getElementsByTagName("*"); + if (nodes && combinator) nodes = this[combinator](nodes); + var results = []; + for (var i = 0, node; node = nodes[i]; i++) + if (Element.hasAttribute(node, attr)) results.push(node); + return results; + }, + + attr: function(nodes, root, attr, value, operator, combinator) { + if (!nodes) nodes = root.getElementsByTagName("*"); + if (nodes && combinator) nodes = this[combinator](nodes); + var handler = Selector.operators[operator], results = []; + for (var i = 0, node; node = nodes[i]; i++) { + var nodeValue = Element.readAttribute(node, attr); + if (nodeValue === null) continue; + if (handler(nodeValue, value)) results.push(node); + } + return results; + }, + + pseudo: function(nodes, name, value, root, combinator) { + if (nodes && combinator) nodes = this[combinator](nodes); + if (!nodes) nodes = root.getElementsByTagName("*"); + return Selector.pseudos[name](nodes, value, root); + } + }, + + pseudos: { + 'first-child': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + if (Selector.handlers.previousElementSibling(node)) continue; + results.push(node); + } + return results; + }, + 'last-child': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + if (Selector.handlers.nextElementSibling(node)) continue; + results.push(node); + } + return results; + }, + 'only-child': function(nodes, value, root) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!h.previousElementSibling(node) && !h.nextElementSibling(node)) + results.push(node); + return results; + }, + 'nth-child': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root); + }, + 'nth-last-child': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, true); + }, + 'nth-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, false, true); + }, + 'nth-last-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, true, true); + }, + 'first-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, "1", root, false, true); + }, + 'last-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, "1", root, true, true); + }, + 'only-of-type': function(nodes, formula, root) { + var p = Selector.pseudos; + return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root); + }, + + // handles the an+b logic + getIndices: function(a, b, total) { + if (a == 0) return b > 0 ? [b] : []; + return $R(1, total).inject([], function(memo, i) { + if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i); + return memo; + }); + }, + + // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type + nth: function(nodes, formula, root, reverse, ofType) { + if (nodes.length == 0) return []; + if (formula == 'even') formula = '2n+0'; + if (formula == 'odd') formula = '2n+1'; + var h = Selector.handlers, results = [], indexed = [], m; + h.mark(nodes); + for (var i = 0, node; node = nodes[i]; i++) { + if (!node.parentNode._countedByPrototype) { + h.index(node.parentNode, reverse, ofType); + indexed.push(node.parentNode); + } + } + if (formula.match(/^\d+$/)) { // just a number + formula = Number(formula); + for (var i = 0, node; node = nodes[i]; i++) + if (node.nodeIndex == formula) results.push(node); + } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b + if (m[1] == "-") m[1] = -1; + var a = m[1] ? Number(m[1]) : 1; + var b = m[2] ? Number(m[2]) : 0; + var indices = Selector.pseudos.getIndices(a, b, nodes.length); + for (var i = 0, node, l = indices.length; node = nodes[i]; i++) { + for (var j = 0; j < l; j++) + if (node.nodeIndex == indices[j]) results.push(node); + } + } + h.unmark(nodes); + h.unmark(indexed); + return results; + }, + + 'empty': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + // IE treats comments as element nodes + if (node.tagName == '!' || node.firstChild) continue; + results.push(node); + } + return results; + }, + + 'not': function(nodes, selector, root) { + var h = Selector.handlers, selectorType, m; + var exclusions = new Selector(selector).findElements(root); + h.mark(exclusions); + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!node._countedByPrototype) results.push(node); + h.unmark(exclusions); + return results; + }, + + 'enabled': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!node.disabled && (!node.type || node.type !== 'hidden')) + results.push(node); + return results; + }, + + 'disabled': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (node.disabled) results.push(node); + return results; + }, + + 'checked': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (node.checked) results.push(node); + return results; + } + }, + + operators: { + '=': function(nv, v) { return nv == v; }, + '!=': function(nv, v) { return nv != v; }, + '^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); }, + '$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); }, + '*=': function(nv, v) { return nv == v || nv && nv.include(v); }, + '$=': function(nv, v) { return nv.endsWith(v); }, + '*=': function(nv, v) { return nv.include(v); }, + '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); }, + '|=': function(nv, v) { return ('-' + (nv || "").toUpperCase() + + '-').include('-' + (v || "").toUpperCase() + '-'); } + }, + + split: function(expression) { + var expressions = []; + expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) { + expressions.push(m[1].strip()); + }); + return expressions; + }, + + matchElements: function(elements, expression) { + var matches = $$(expression), h = Selector.handlers; + h.mark(matches); + for (var i = 0, results = [], element; element = elements[i]; i++) + if (element._countedByPrototype) results.push(element); + h.unmark(matches); + return results; + }, + + findElement: function(elements, expression, index) { + if (Object.isNumber(expression)) { + index = expression; expression = false; + } + return Selector.matchElements(elements, expression || '*')[index || 0]; + }, + + findChildElements: function(element, expressions) { + expressions = Selector.split(expressions.join(',')); + var results = [], h = Selector.handlers; + for (var i = 0, l = expressions.length, selector; i < l; i++) { + selector = new Selector(expressions[i].strip()); + h.concat(results, selector.findElements(element)); + } + return (l > 1) ? h.unique(results) : results; + } +}); + +if (Prototype.Browser.IE) { + Object.extend(Selector.handlers, { + // IE returns comment nodes on getElementsByTagName("*"). + // Filter them out. + concat: function(a, b) { + for (var i = 0, node; node = b[i]; i++) + if (node.tagName !== "!") a.push(node); + return a; + }, + + // IE improperly serializes _countedByPrototype in (inner|outer)HTML. + unmark: function(nodes) { + for (var i = 0, node; node = nodes[i]; i++) + node.removeAttribute('_countedByPrototype'); + return nodes; + } + }); +} + +function $$() { + return Selector.findChildElements(document, $A(arguments)); +} +var Form = { + reset: function(form) { + $(form).reset(); + return form; + }, + + serializeElements: function(elements, options) { + if (typeof options != 'object') options = { hash: !!options }; + else if (Object.isUndefined(options.hash)) options.hash = true; + var key, value, submitted = false, submit = options.submit; + + var data = elements.inject({ }, function(result, element) { + if (!element.disabled && element.name) { + key = element.name; value = $(element).getValue(); + if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted && + submit !== false && (!submit || key == submit) && (submitted = true)))) { + if (key in result) { + // a key is already present; construct an array of values + if (!Object.isArray(result[key])) result[key] = [result[key]]; + result[key].push(value); + } + else result[key] = value; + } + } + return result; + }); + + return options.hash ? data : Object.toQueryString(data); + } +}; + +Form.Methods = { + serialize: function(form, options) { + return Form.serializeElements(Form.getElements(form), options); + }, + + getElements: function(form) { + return $A($(form).getElementsByTagName('*')).inject([], + function(elements, child) { + if (Form.Element.Serializers[child.tagName.toLowerCase()]) + elements.push(Element.extend(child)); + return elements; + } + ); + }, + + getInputs: function(form, typeName, name) { + form = $(form); + var inputs = form.getElementsByTagName('input'); + + if (!typeName && !name) return $A(inputs).map(Element.extend); + + for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { + var input = inputs[i]; + if ((typeName && input.type != typeName) || (name && input.name != name)) + continue; + matchingInputs.push(Element.extend(input)); + } + + return matchingInputs; + }, + + disable: function(form) { + form = $(form); + Form.getElements(form).invoke('disable'); + return form; + }, + + enable: function(form) { + form = $(form); + Form.getElements(form).invoke('enable'); + return form; + }, + + findFirstElement: function(form) { + var elements = $(form).getElements().findAll(function(element) { + return 'hidden' != element.type && !element.disabled; + }); + var firstByIndex = elements.findAll(function(element) { + return element.hasAttribute('tabIndex') && element.tabIndex >= 0; + }).sortBy(function(element) { return element.tabIndex }).first(); + + return firstByIndex ? firstByIndex : elements.find(function(element) { + return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); + }); + }, + + focusFirstElement: function(form) { + form = $(form); + form.findFirstElement().activate(); + return form; + }, + + request: function(form, options) { + form = $(form), options = Object.clone(options || { }); + + var params = options.parameters, action = form.readAttribute('action') || ''; + if (action.blank()) action = window.location.href; + options.parameters = form.serialize(true); + + if (params) { + if (Object.isString(params)) params = params.toQueryParams(); + Object.extend(options.parameters, params); + } + + if (form.hasAttribute('method') && !options.method) + options.method = form.method; + + return new Ajax.Request(action, options); + } +}; + +/*--------------------------------------------------------------------------*/ + +Form.Element = { + focus: function(element) { + $(element).focus(); + return element; + }, + + select: function(element) { + $(element).select(); + return element; + } +}; + +Form.Element.Methods = { + serialize: function(element) { + element = $(element); + if (!element.disabled && element.name) { + var value = element.getValue(); + if (value != undefined) { + var pair = { }; + pair[element.name] = value; + return Object.toQueryString(pair); + } + } + return ''; + }, + + getValue: function(element) { + element = $(element); + var method = element.tagName.toLowerCase(); + return Form.Element.Serializers[method](element); + }, + + setValue: function(element, value) { + element = $(element); + var method = element.tagName.toLowerCase(); + Form.Element.Serializers[method](element, value); + return element; + }, + + clear: function(element) { + $(element).value = ''; + return element; + }, + + present: function(element) { + return $(element).value != ''; + }, + + activate: function(element) { + element = $(element); + try { + element.focus(); + if (element.select && (element.tagName.toLowerCase() != 'input' || + !['button', 'reset', 'submit'].include(element.type))) + element.select(); + } catch (e) { } + return element; + }, + + disable: function(element) { + element = $(element); + element.disabled = true; + return element; + }, + + enable: function(element) { + element = $(element); + element.disabled = false; + return element; + } +}; + +/*--------------------------------------------------------------------------*/ + +var Field = Form.Element; +var $F = Form.Element.Methods.getValue; + +/*--------------------------------------------------------------------------*/ + +Form.Element.Serializers = { + input: function(element, value) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + return Form.Element.Serializers.inputSelector(element, value); + default: + return Form.Element.Serializers.textarea(element, value); + } + }, + + inputSelector: function(element, value) { + if (Object.isUndefined(value)) return element.checked ? element.value : null; + else element.checked = !!value; + }, + + textarea: function(element, value) { + if (Object.isUndefined(value)) return element.value; + else element.value = value; + }, + + select: function(element, value) { + if (Object.isUndefined(value)) + return this[element.type == 'select-one' ? + 'selectOne' : 'selectMany'](element); + else { + var opt, currentValue, single = !Object.isArray(value); + for (var i = 0, length = element.length; i < length; i++) { + opt = element.options[i]; + currentValue = this.optionValue(opt); + if (single) { + if (currentValue == value) { + opt.selected = true; + return; + } + } + else opt.selected = value.include(currentValue); + } + } + }, + + selectOne: function(element) { + var index = element.selectedIndex; + return index >= 0 ? this.optionValue(element.options[index]) : null; + }, + + selectMany: function(element) { + var values, length = element.length; + if (!length) return null; + + for (var i = 0, values = []; i < length; i++) { + var opt = element.options[i]; + if (opt.selected) values.push(this.optionValue(opt)); + } + return values; + }, + + optionValue: function(opt) { + // extend element because hasAttribute may not be native + return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; + } +}; + +/*--------------------------------------------------------------------------*/ + +Abstract.TimedObserver = Class.create(PeriodicalExecuter, { + initialize: function($super, element, frequency, callback) { + $super(callback, frequency); + this.element = $(element); + this.lastValue = this.getValue(); + }, + + execute: function() { + var value = this.getValue(); + if (Object.isString(this.lastValue) && Object.isString(value) ? + this.lastValue != value : String(this.lastValue) != String(value)) { + this.callback(this.element, value); + this.lastValue = value; + } + } +}); + +Form.Element.Observer = Class.create(Abstract.TimedObserver, { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.Observer = Class.create(Abstract.TimedObserver, { + getValue: function() { + return Form.serialize(this.element); + } +}); + +/*--------------------------------------------------------------------------*/ + +Abstract.EventObserver = Class.create({ + initialize: function(element, callback) { + this.element = $(element); + this.callback = callback; + + this.lastValue = this.getValue(); + if (this.element.tagName.toLowerCase() == 'form') + this.registerFormCallbacks(); + else + this.registerCallback(this.element); + }, + + onElementEvent: function() { + var value = this.getValue(); + if (this.lastValue != value) { + this.callback(this.element, value); + this.lastValue = value; + } + }, + + registerFormCallbacks: function() { + Form.getElements(this.element).each(this.registerCallback, this); + }, + + registerCallback: function(element) { + if (element.type) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + Event.observe(element, 'click', this.onElementEvent.bind(this)); + break; + default: + Event.observe(element, 'change', this.onElementEvent.bind(this)); + break; + } + } + } +}); + +Form.Element.EventObserver = Class.create(Abstract.EventObserver, { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.EventObserver = Class.create(Abstract.EventObserver, { + getValue: function() { + return Form.serialize(this.element); + } +}); +if (!window.Event) var Event = { }; + +Object.extend(Event, { + KEY_BACKSPACE: 8, + KEY_TAB: 9, + KEY_RETURN: 13, + KEY_ESC: 27, + KEY_LEFT: 37, + KEY_UP: 38, + KEY_RIGHT: 39, + KEY_DOWN: 40, + KEY_DELETE: 46, + KEY_HOME: 36, + KEY_END: 35, + KEY_PAGEUP: 33, + KEY_PAGEDOWN: 34, + KEY_INSERT: 45, + + cache: { }, + + relatedTarget: function(event) { + var element; + switch(event.type) { + case 'mouseover': element = event.fromElement; break; + case 'mouseout': element = event.toElement; break; + default: return null; + } + return Element.extend(element); + } +}); + +Event.Methods = (function() { + var isButton; + + if (Prototype.Browser.IE) { + var buttonMap = { 0: 1, 1: 4, 2: 2 }; + isButton = function(event, code) { + return event.button == buttonMap[code]; + }; + + } else if (Prototype.Browser.WebKit) { + isButton = function(event, code) { + switch (code) { + case 0: return event.which == 1 && !event.metaKey; + case 1: return event.which == 1 && event.metaKey; + default: return false; + } + }; + + } else { + isButton = function(event, code) { + return event.which ? (event.which === code + 1) : (event.button === code); + }; + } + + return { + isLeftClick: function(event) { return isButton(event, 0) }, + isMiddleClick: function(event) { return isButton(event, 1) }, + isRightClick: function(event) { return isButton(event, 2) }, + + element: function(event) { + event = Event.extend(event); + + var node = event.target, + type = event.type, + currentTarget = event.currentTarget; + + if (currentTarget && currentTarget.tagName) { + // Firefox screws up the "click" event when moving between radio buttons + // via arrow keys. It also screws up the "load" and "error" events on images, + // reporting the document as the target instead of the original image. + if (type === 'load' || type === 'error' || + (type === 'click' && currentTarget.tagName.toLowerCase() === 'input' + && currentTarget.type === 'radio')) + node = currentTarget; + } + if (node.nodeType == Node.TEXT_NODE) node = node.parentNode; + return Element.extend(node); + }, + + findElement: function(event, expression) { + var element = Event.element(event); + if (!expression) return element; + var elements = [element].concat(element.ancestors()); + return Selector.findElement(elements, expression, 0); + }, + + pointer: function(event) { + var docElement = document.documentElement, + body = document.body || { scrollLeft: 0, scrollTop: 0 }; + return { + x: event.pageX || (event.clientX + + (docElement.scrollLeft || body.scrollLeft) - + (docElement.clientLeft || 0)), + y: event.pageY || (event.clientY + + (docElement.scrollTop || body.scrollTop) - + (docElement.clientTop || 0)) + }; + }, + + pointerX: function(event) { return Event.pointer(event).x }, + pointerY: function(event) { return Event.pointer(event).y }, + + stop: function(event) { + Event.extend(event); + event.preventDefault(); + event.stopPropagation(); + event.stopped = true; + } + }; +})(); + +Event.extend = (function() { + var methods = Object.keys(Event.Methods).inject({ }, function(m, name) { + m[name] = Event.Methods[name].methodize(); + return m; + }); + + if (Prototype.Browser.IE) { + Object.extend(methods, { + stopPropagation: function() { this.cancelBubble = true }, + preventDefault: function() { this.returnValue = false }, + inspect: function() { return "[object Event]" } + }); + + return function(event) { + if (!event) return false; + if (event._extendedByPrototype) return event; + + event._extendedByPrototype = Prototype.emptyFunction; + var pointer = Event.pointer(event); + Object.extend(event, { + target: event.srcElement, + relatedTarget: Event.relatedTarget(event), + pageX: pointer.x, + pageY: pointer.y + }); + return Object.extend(event, methods); + }; + + } else { + Event.prototype = Event.prototype || document.createEvent("HTMLEvents")['__proto__']; + Object.extend(Event.prototype, methods); + return Prototype.K; + } +})(); + +Object.extend(Event, (function() { + var cache = Event.cache; + + function getEventID(element) { + if (element._prototypeEventID) return element._prototypeEventID[0]; + arguments.callee.id = arguments.callee.id || 1; + return element._prototypeEventID = [++arguments.callee.id]; + } + + function getDOMEventName(eventName) { + if (eventName && eventName.include(':')) return "dataavailable"; + return eventName; + } + + function getCacheForID(id) { + return cache[id] = cache[id] || { }; + } + + function getWrappersForEventName(id, eventName) { + var c = getCacheForID(id); + return c[eventName] = c[eventName] || []; + } + + function createWrapper(element, eventName, handler) { + var id = getEventID(element); + var c = getWrappersForEventName(id, eventName); + if (c.pluck("handler").include(handler)) return false; + + var wrapper = function(event) { + if (!Event || !Event.extend || + (event.eventName && event.eventName != eventName)) + return false; + + Event.extend(event); + handler.call(element, event); + }; + + wrapper.handler = handler; + c.push(wrapper); + return wrapper; + } + + function findWrapper(id, eventName, handler) { + var c = getWrappersForEventName(id, eventName); + return c.find(function(wrapper) { return wrapper.handler == handler }); + } + + function destroyWrapper(id, eventName, handler) { + var c = getCacheForID(id); + if (!c[eventName]) return false; + c[eventName] = c[eventName].without(findWrapper(id, eventName, handler)); + } + + function destroyCache() { + for (var id in cache) + for (var eventName in cache[id]) + cache[id][eventName] = null; + } + + + // Internet Explorer needs to remove event handlers on page unload + // in order to avoid memory leaks. + if (window.attachEvent) { + window.attachEvent("onunload", destroyCache); + } + + // Safari has a dummy event handler on page unload so that it won't + // use its bfcache. Safari <= 3.1 has an issue with restoring the "document" + // object when page is returned to via the back button using its bfcache. + if (Prototype.Browser.WebKit) { + window.addEventListener('unload', Prototype.emptyFunction, false); + } + + return { + observe: function(element, eventName, handler) { + element = $(element); + var name = getDOMEventName(eventName); + + var wrapper = createWrapper(element, eventName, handler); + if (!wrapper) return element; + + if (element.addEventListener) { + element.addEventListener(name, wrapper, false); + } else { + element.attachEvent("on" + name, wrapper); + } + + return element; + }, + + stopObserving: function(element, eventName, handler) { + element = $(element); + var id = getEventID(element), name = getDOMEventName(eventName); + + if (!handler && eventName) { + getWrappersForEventName(id, eventName).each(function(wrapper) { + element.stopObserving(eventName, wrapper.handler); + }); + return element; + + } else if (!eventName) { + Object.keys(getCacheForID(id)).each(function(eventName) { + element.stopObserving(eventName); + }); + return element; + } + + var wrapper = findWrapper(id, eventName, handler); + if (!wrapper) return element; + + if (element.removeEventListener) { + element.removeEventListener(name, wrapper, false); + } else { + element.detachEvent("on" + name, wrapper); + } + + destroyWrapper(id, eventName, handler); + + return element; + }, + + fire: function(element, eventName, memo) { + element = $(element); + if (element == document && document.createEvent && !element.dispatchEvent) + element = document.documentElement; + + var event; + if (document.createEvent) { + event = document.createEvent("HTMLEvents"); + event.initEvent("dataavailable", true, true); + } else { + event = document.createEventObject(); + event.eventType = "ondataavailable"; + } + + event.eventName = eventName; + event.memo = memo || { }; + + if (document.createEvent) { + element.dispatchEvent(event); + } else { + element.fireEvent(event.eventType, event); + } + + return Event.extend(event); + } + }; +})()); + +Object.extend(Event, Event.Methods); + +Element.addMethods({ + fire: Event.fire, + observe: Event.observe, + stopObserving: Event.stopObserving +}); + +Object.extend(document, { + fire: Element.Methods.fire.methodize(), + observe: Element.Methods.observe.methodize(), + stopObserving: Element.Methods.stopObserving.methodize(), + loaded: false +}); + +(function() { + /* Support for the DOMContentLoaded event is based on work by Dan Webb, + Matthias Miller, Dean Edwards and John Resig. */ + + var timer; + + function fireContentLoadedEvent() { + if (document.loaded) return; + if (timer) window.clearInterval(timer); + document.fire("dom:loaded"); + document.loaded = true; + } + + if (document.addEventListener) { + if (Prototype.Browser.WebKit) { + timer = window.setInterval(function() { + if (/loaded|complete/.test(document.readyState)) + fireContentLoadedEvent(); + }, 0); + + Event.observe(window, "load", fireContentLoadedEvent); + + } else { + document.addEventListener("DOMContentLoaded", + fireContentLoadedEvent, false); + } + + } else { + document.write(" - + _tpl_vars['scripth']; ?> - +

          Recherche Avancée
          -
          -_tpl_vars['infos']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): - foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['info']): +
          +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%18^18A^18A2DC5A%%laboratoire.tpl.php b/onyx2/modules/templates/compile/%%18^18A^18A2DC5A%%laboratoire.tpl.php new file mode 100644 index 0000000..f0671a4 --- /dev/null +++ b/onyx2/modules/templates/compile/%%18^18A^18A2DC5A%%laboratoire.tpl.php @@ -0,0 +1,105 @@ + + array(array('modifier', 'ucfirst', 'game/laboratoire.tpl', 6, false),array('modifier', 'separerNombres', 'game/laboratoire.tpl', 27, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          File d'attente

          +
          +_tpl_vars['file']): ?> +_tpl_vars['file']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['element']): +?> + _tpl_vars['LANG'][$this->_tpl_vars['race']]['technologies']['noms_sing'][$this->_tpl_vars['element']['0']][$this->_tpl_vars['element']['1']])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> + - - Annuler + + Aucune technologie dans la file d'attente +
          +
          +

          Arbre des technologies


          +

          _tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing']['6'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +

          +_tpl_vars['recherches']): ?> + +_tpl_vars['recherches']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['recherche']): +?> + + + + + +
          + + <?php echo $this->_tpl_vars['LANG'][$this->_tpl_vars['race']]['technologies']['noms_sing'][$this->_tpl_vars['recherche']['id']][$this->_tpl_vars['recherche']['tech']]; ?>
+ + _tpl_vars['LANG'][$this->_tpl_vars['race']]['technologies']['descriptions'][$this->_tpl_vars['recherche']['id']][$this->_tpl_vars['recherche']['tech']]; ?> + + + +
          + _tpl_vars['LANG'][$this->_tpl_vars['race']]['technologies']['noms_sing'][$this->_tpl_vars['recherche']['id']][$this->_tpl_vars['recherche']['tech']])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +

          + _tpl_vars['recherche']['nec_metal'] > 0): ?> + _tpl_vars['recherche']['nec_metal'] > $this->_tpl_vars['planete']->metal): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['metal']; ?> + : _tpl_vars['recherche']['nec_metal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['metal']; ?> + : _tpl_vars['recherche']['nec_metal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + _tpl_vars['recherche']['nec_cristal'] > 0): ?> + _tpl_vars['recherche']['nec_cristal'] > $this->_tpl_vars['planete']->cristal): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['cristal']; ?> + : _tpl_vars['recherche']['nec_cristal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['cristal']; ?> + : _tpl_vars['recherche']['nec_cristal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + _tpl_vars['recherche']['nec_hydrogene'] > 0): ?> + _tpl_vars['recherche']['nec_hydrogene'] > $this->_tpl_vars['planete']->hydrogene): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['hydrogene']; ?> + : _tpl_vars['recherche']['nec_hydrogene'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['hydrogene']; ?> + : _tpl_vars['recherche']['nec_hydrogene'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + _tpl_vars['recherche']['nec_credits'] > 0): ?> + _tpl_vars['recherche']['nec_credits'] > $this->_tpl_vars['planete']->credits): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['credits']; ?> + : _tpl_vars['recherche']['nec_credits'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['credits']; ?> + : _tpl_vars['recherche']['nec_credits'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + Temps de recherche : _tpl_vars['recherche']['temps']; ?> +

          + _tpl_vars['recherche']['enfile']): ?>Arrêter + _tpl_vars['recherche']['nec_credits'] > $this->_tpl_vars['planete']->credits || $this->_tpl_vars['recherche']['nec_hydrogene'] > $this->_tpl_vars['planete']->hydrogene || $this->_tpl_vars['recherche']['nec_cristal'] > $this->_tpl_vars['planete']->cristal || $this->_tpl_vars['recherche']['nec_metal'] > $this->_tpl_vars['planete']->metal): ?>_tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['credits'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> + insuffisants + Rechercher + +
          +
          +
          Aucune technologie à développer actuellement
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%1E^1EB^1EBEE047%%footer.tpl.php b/onyx2/modules/templates/compile/%%1E^1EB^1EBEE047%%footer.tpl.php new file mode 100644 index 0000000..ec4a55d --- /dev/null +++ b/onyx2/modules/templates/compile/%%1E^1EB^1EBEE047%%footer.tpl.php @@ -0,0 +1,25 @@ + +
          + + + +
          +_tpl_vars['script']; ?> + + + \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%2A^2A9^2A9A4697%%accueil.tpl.php b/onyx2/modules/templates/compile/%%2A^2A9^2A9A4697%%accueil.tpl.php new file mode 100644 index 0000000..e515192 --- /dev/null +++ b/onyx2/modules/templates/compile/%%2A^2A9^2A9A4697%%accueil.tpl.php @@ -0,0 +1,33 @@ + + array(array('modifier', 'escape', 'admin/accueil.tpl', 6, false),array('modifier', 'nl2br', 'admin/accueil.tpl', 6, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          Evénements

          + Heure du serveur: _tpl_vars['datehb']; ?> + +

          Version du serveur : _tpl_vars['version']; ?> +

          +_tpl_vars['news']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['new']): +?> +

          _tpl_vars['new']['titre']; ?> + : _tpl_vars['new']['contenu'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)))) ? $this->_run_mod_handler('nl2br', true, $_tmp) : smarty_modifier_nl2br($_tmp)); ?> +

          + +

          Infos

          +

          Messagerie : _tpl_vars['nbMail']; ?> + message_tpl_vars['nbMail'] > 1): ?>s en attente

          +

          Pilori : _tpl_vars['nbPilori']; ?> + joueur_tpl_vars['nbPilori'] > 1): ?>s dans le pilori de la galaxie

          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%3A^3A1^3A1168FE%%header.tpl.php b/onyx2/modules/templates/compile/%%3A^3A1^3A1168FE%%header.tpl.php new file mode 100644 index 0000000..b890a37 --- /dev/null +++ b/onyx2/modules/templates/compile/%%3A^3A1^3A1168FE%%header.tpl.php @@ -0,0 +1,68 @@ + + array(array('modifier', 'sprintf', 'cms/header.tpl', 27, false),)), $this); ?> + + + + + + + + ::Halo-Battle:: - <?php echo $this->_tpl_vars['titre']; ?> + + + + + + + +
          +
          + + +
          \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%45^45D^45DA3548%%chantierspatial.tpl.php b/onyx2/modules/templates/compile/%%45^45D^45DA3548%%chantierspatial.tpl.php new file mode 100644 index 0000000..4814ae8 --- /dev/null +++ b/onyx2/modules/templates/compile/%%45^45D^45DA3548%%chantierspatial.tpl.php @@ -0,0 +1,105 @@ + + array(array('modifier', 'ucfirst', 'game/chantierspatial.tpl', 28, false),array('modifier', 'separerNombres', 'game/chantierspatial.tpl', 30, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          File d'attente

          +
          +_tpl_vars['file']): ?> +_tpl_vars['file']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['element']): +?> + _tpl_vars['i'] != true): ?>Prochain vaisseau : + + _tpl_vars['element']['1']; ?> + _tpl_vars['element']['1'] > 1): ?>_tpl_vars['LANG'][$this->_tpl_vars['race']]['vaisseaux']['noms_pluriel'][$this->_tpl_vars['element']['0']]; ?> +_tpl_vars['LANG'][$this->_tpl_vars['race']]['vaisseaux']['noms_sing'][$this->_tpl_vars['element']['0']]; ?> +_tpl_vars['element']['2']): ?> (démolition) - + - Annuler un - Annuler tous + + Aucun vaisseau dans la file d'attente +
          +
          +

          Arbre des technologies


          +

          Chantier spatial

          +_tpl_vars['vaisseaux']): ?> + +_tpl_vars['vaisseaux']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['vaisseau']): +?> + + + + + +
          + + Vaisseaux + _tpl_vars['LANG'][$this->_tpl_vars['race']]['vaisseaux']['descriptions'][$this->_tpl_vars['vaisseau']['id']]; ?> + + + +
          + _tpl_vars['LANG'][$this->_tpl_vars['race']]['vaisseaux']['noms_sing'][$this->_tpl_vars['vaisseau']['id']])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +_tpl_vars['vaisseau']['nombre'] > 0): ?> (_tpl_vars['vaisseau']['nombre']; ?> + vaisseau_tpl_vars['vaisseau']['nombre'] > 1): ?>x)

          + _tpl_vars['vaisseau']['nec_metal'] > 0): ?> + _tpl_vars['vaisseau']['nec_metal'] > $this->_tpl_vars['planete']->metal): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['metal']; ?> + : _tpl_vars['vaisseau']['nec_metal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['metal']; ?> + : _tpl_vars['vaisseau']['nec_metal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + _tpl_vars['vaisseau']['nec_cristal'] > 0): ?> + _tpl_vars['vaisseau']['nec_cristal'] > $this->_tpl_vars['planete']->cristal): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['cristal']; ?> + : _tpl_vars['vaisseau']['nec_cristal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['cristal']; ?> + : _tpl_vars['vaisseau']['nec_cristal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + _tpl_vars['vaisseau']['nec_hydrogene'] > 0): ?> + _tpl_vars['vaisseau']['nec_hydrogene'] > $this->_tpl_vars['planete']->hydrogene): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['hydrogene']; ?> + : _tpl_vars['vaisseau']['nec_hydrogene'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['hydrogene']; ?> + : _tpl_vars['vaisseau']['nec_hydrogene'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + Temps de construction : _tpl_vars['vaisseau']['temps']; ?> +

          +
          +
          + + +
          +
          +
          +
          +
          Aucun vaisseau à construire actuellement.
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%49^49E^49EF4E4D%%batiments.tpl.php b/onyx2/modules/templates/compile/%%49^49E^49EF4E4D%%batiments.tpl.php new file mode 100644 index 0000000..38d9469 --- /dev/null +++ b/onyx2/modules/templates/compile/%%49^49E^49EF4E4D%%batiments.tpl.php @@ -0,0 +1,96 @@ + + array(array('modifier', 'ucfirst', 'game/batiments.tpl', 6, false),array('modifier', 'separerNombres', 'game/batiments.tpl', 26, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          File d'attente

          +
          +_tpl_vars['file']): ?> +_tpl_vars['file']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['element']): +?> + _tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing'][$this->_tpl_vars['element']['0']])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +_tpl_vars['element']['1']): ?> (démolition) - - Annuler + + Aucun bâtiment dans la file d'attente +
          +
          +

          Arbre des technologies


          +

          Bâtiments

          + +_tpl_vars['batiments']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['batiment']): +?> + + + + + +
          + + <?php echo $this->_tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing'][$this->_tpl_vars['batiment']['id']]; ?>
+ + _tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['descriptions'][$this->_tpl_vars['batiment']['id']]; ?> + + + +
          + _tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing'][$this->_tpl_vars['batiment']['id']])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +_tpl_vars['batiment']['niveau'] > 0): ?> (Niveau _tpl_vars['batiment']['niveau']; ?> +)

          + _tpl_vars['batiment']['nec_metal'] > 0): ?> + _tpl_vars['batiment']['nec_metal'] > $this->_tpl_vars['planete']->metal): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['metal']; ?> + : _tpl_vars['batiment']['nec_metal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['metal']; ?> + : _tpl_vars['batiment']['nec_metal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + _tpl_vars['batiment']['nec_cristal'] > 0): ?> + _tpl_vars['batiment']['nec_cristal'] > $this->_tpl_vars['planete']->cristal): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['cristal']; ?> + : _tpl_vars['batiment']['nec_cristal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['cristal']; ?> + : _tpl_vars['batiment']['nec_cristal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + _tpl_vars['batiment']['nec_hydrogene'] > 0): ?> + _tpl_vars['batiment']['nec_hydrogene'] > $this->_tpl_vars['planete']->hydrogene): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['hydrogene']; ?> + : _tpl_vars['batiment']['nec_hydrogene'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['hydrogene']; ?> + : _tpl_vars['batiment']['nec_hydrogene'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + Temps de construction : _tpl_vars['batiment']['temps']; ?> +

          + _tpl_vars['batiment']['nec_hydrogene'] > $this->_tpl_vars['planete']->hydrogene || $this->_tpl_vars['batiment']['nec_cristal'] > $this->_tpl_vars['planete']->cristal || $this->_tpl_vars['batiment']['nec_metal'] > $this->_tpl_vars['planete']->metal): ?>Ressources insuffisantes + _tpl_vars['planete']->casesRest >= 1): ?>Construire + _tpl_vars['batiment']['enfile'] !== false): ?>Arrêter + _tpl_vars['batiment']['niveau'] > 0): ?> Démolir un niveau +
          +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%50^50D^50DBF311%%erreur.tpl.php b/onyx2/modules/templates/compile/%%50^50D^50DBF311%%erreur.tpl.php new file mode 100644 index 0000000..17ec89a --- /dev/null +++ b/onyx2/modules/templates/compile/%%50^50D^50DBF311%%erreur.tpl.php @@ -0,0 +1,15 @@ + +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'cms/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +
          _tpl_vars['couleur']): ?> style="color: _tpl_vars['couleur']; ?> +;">_tpl_vars['message']; ?> +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'cms/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%57^575^575BA7B3%%caserne.tpl.php b/onyx2/modules/templates/compile/%%57^575^575BA7B3%%caserne.tpl.php new file mode 100644 index 0000000..4270fee --- /dev/null +++ b/onyx2/modules/templates/compile/%%57^575^575BA7B3%%caserne.tpl.php @@ -0,0 +1,105 @@ + + array(array('modifier', 'ucfirst', 'game/caserne.tpl', 15, false),array('modifier', 'separerNombres', 'game/caserne.tpl', 28, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          File d'attente

          +
          +_tpl_vars['file']): ?> +_tpl_vars['file']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['element']): +?> + _tpl_vars['i'] != true): ?>Prochaine unité : + + _tpl_vars['element']['1']; ?> + _tpl_vars['element']['1'] > 1): ?>_tpl_vars['LANG'][$this->_tpl_vars['race']]['caserne']['noms_pluriel'][$this->_tpl_vars['element']['0']]; ?> +_tpl_vars['LANG'][$this->_tpl_vars['race']]['caserne']['noms_sing'][$this->_tpl_vars['element']['0']]; ?> +_tpl_vars['element']['2']): ?> (démolition) - + - Annuler un - Annuler tous + + Aucune unité dans la file d'attente +
          +
          +

          Arbre des technologies


          +

          _tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing']['9'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +

          +_tpl_vars['unites']): ?> + +_tpl_vars['unites']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['unite']): +?> + + + + + +
          + + Unité terrestre + _tpl_vars['LANG'][$this->_tpl_vars['race']]['caserne']['descriptions'][$this->_tpl_vars['unite']['id']]; ?> + + + +
          + _tpl_vars['LANG'][$this->_tpl_vars['race']]['caserne']['noms_sing'][$this->_tpl_vars['unite']['id']])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +_tpl_vars['unite']['nombre'] > 0): ?> (_tpl_vars['unite']['nombre'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> + unité_tpl_vars['unite']['nombre'] > 1): ?>s)

          + _tpl_vars['unite']['nec_metal'] > 0): ?> + _tpl_vars['unite']['nec_metal'] > $this->_tpl_vars['planete']->metal): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['metal']; ?> + : _tpl_vars['unite']['nec_metal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['metal']; ?> + : _tpl_vars['unite']['nec_metal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + _tpl_vars['unite']['nec_cristal'] > 0): ?> + _tpl_vars['unite']['nec_cristal'] > $this->_tpl_vars['planete']->cristal): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['cristal']; ?> + : _tpl_vars['unite']['nec_cristal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['cristal']; ?> + : _tpl_vars['unite']['nec_cristal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + _tpl_vars['unite']['nec_hydrogene'] > 0): ?> + _tpl_vars['unite']['nec_hydrogene'] > $this->_tpl_vars['planete']->hydrogene): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['hydrogene']; ?> + : _tpl_vars['unite']['nec_hydrogene'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['hydrogene']; ?> + : _tpl_vars['unite']['nec_hydrogene'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + Temps d'entraînement : _tpl_vars['unite']['temps']; ?> +

          +
          +
          + + +
          +
          +
          +
          +
          Aucune unité à entraîner actuellement.
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%5A^5AB^5ABB1E3D%%mail_liste.tpl.php b/onyx2/modules/templates/compile/%%5A^5AB^5ABB1E3D%%mail_liste.tpl.php new file mode 100644 index 0000000..92cd7f1 --- /dev/null +++ b/onyx2/modules/templates/compile/%%5A^5AB^5ABB1E3D%%mail_liste.tpl.php @@ -0,0 +1,49 @@ + + array(array('modifier', 'escape', 'admin/mail_liste.tpl', 18, false),array('modifier', 'truncate', 'admin/mail_liste.tpl', 18, false),array('modifier', 'date_format', 'admin/mail_liste.tpl', 19, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> + + + + + + + + + + + +_tpl_vars['mails']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['ligne']): +?> + _tpl_vars['ligne']['statut'] >= 1): ?> style="background: #_tpl_vars['ligne']['statut'] == 1): ?>770000_tpl_vars['ligne']['statut'] == 2): ?>007700_tpl_vars['ligne']['statut'] == 3): ?>000077_tpl_vars['ligne']['statut'] == 4): ?>770077_tpl_vars['ligne']['statut'] == 5): ?>007777_tpl_vars['ligne']['statut'] == 6): ?>777700;"> + + + + + + + + +
          ActionStatutEmetteurSujetDate
          STAT
          LIRE
          SUPPR
          _tpl_vars['ligne']['statut']; ?> +_tpl_vars['ligne']['pseudo']; ?> +_tpl_vars['ligne']['titre'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?> +
          _tpl_vars['ligne']['contenu'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)))) ? $this->_run_mod_handler('truncate', true, $_tmp, 50) : smarty_modifier_truncate($_tmp, 50)); ?> +
          _tpl_vars['ligne']['time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%d/%m/%y %H:%M:%S") : smarty_modifier_date_format($_tmp, "%d/%m/%y %H:%M:%S")); ?> +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%69^69A^69AF6399%%defenses.tpl.php b/onyx2/modules/templates/compile/%%69^69A^69AF6399%%defenses.tpl.php new file mode 100644 index 0000000..80a1d73 --- /dev/null +++ b/onyx2/modules/templates/compile/%%69^69A^69AF6399%%defenses.tpl.php @@ -0,0 +1,103 @@ + + array(array('modifier', 'ucfirst', 'game/defenses.tpl', 27, false),array('modifier', 'separerNombres', 'game/defenses.tpl', 29, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          File d'attente

          +
          +_tpl_vars['file']): ?> +_tpl_vars['file']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['element']): +?> + _tpl_vars['i'] != true): ?>Prochaine _tpl_vars['element']['5']): ?>unitédéfense : + + _tpl_vars['element']['1']; ?> + _tpl_vars['element']['1'] > 1): ?>_tpl_vars['LANG'][$this->_tpl_vars['race']]['terrestre']['noms_pluriel'][$this->_tpl_vars['element']['0']]; ?> +_tpl_vars['LANG'][$this->_tpl_vars['race']]['terrestre']['noms_sing'][$this->_tpl_vars['element']['0']]; ?> +_tpl_vars['element']['2']): ?> (démolition) - + - Annuler un - Annuler tous + + Aucune défense dans la file d'attente +
          +
          +

          Arbre des technologies


          +

          Chantier terrestre

          + +_tpl_vars['unites']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['unite']): +?> + + + + + +
          + + Déeacute;fense + _tpl_vars['LANG'][$this->_tpl_vars['race']]['terrestre']['descriptions'][$this->_tpl_vars['unite']['id']]; ?> + + + +
          + _tpl_vars['LANG'][$this->_tpl_vars['race']]['terrestre']['noms_sing'][$this->_tpl_vars['unite']['id']])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +_tpl_vars['unite']['nombre'] > 0): ?> (_tpl_vars['unite']['nombre']; ?> + unité_tpl_vars['unite']['nombre'] > 1): ?>s)

          + _tpl_vars['unite']['nec_metal'] > 0): ?> + _tpl_vars['unite']['nec_metal'] > $this->_tpl_vars['planete']->metal): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['metal']; ?> + : _tpl_vars['unite']['nec_metal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['metal']; ?> + : _tpl_vars['unite']['nec_metal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + _tpl_vars['unite']['nec_cristal'] > 0): ?> + _tpl_vars['unite']['nec_cristal'] > $this->_tpl_vars['planete']->cristal): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['cristal']; ?> + : _tpl_vars['unite']['nec_cristal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['cristal']; ?> + : _tpl_vars['unite']['nec_cristal'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + _tpl_vars['unite']['nec_hydrogene'] > 0): ?> + _tpl_vars['unite']['nec_hydrogene'] > $this->_tpl_vars['planete']->hydrogene): ?>Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['hydrogene']; ?> + : _tpl_vars['unite']['nec_hydrogene'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + Coût _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['hydrogene']; ?> + : _tpl_vars['unite']['nec_hydrogene'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          + + Temps de construction : _tpl_vars['unite']['temps']; ?> +

          +
          +
          + + +
          +
          +
          +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%69^69D^69D54D9C%%accueil.tpl.php b/onyx2/modules/templates/compile/%%69^69D^69D54D9C%%accueil.tpl.php new file mode 100644 index 0000000..9df7001 --- /dev/null +++ b/onyx2/modules/templates/compile/%%69^69D^69D54D9C%%accueil.tpl.php @@ -0,0 +1,164 @@ + + array(array('modifier', 'escape', 'game/accueil.tpl', 8, false),array('modifier', 'separerNombres', 'game/accueil.tpl', 19, false),array('modifier', 'upper', 'game/accueil.tpl', 27, false),array('modifier', 'ucfirst', 'game/accueil.tpl', 40, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          Événements

          + _tpl_vars['multi']): ?>Multicompte : évitez toute interaction avec _tpl_vars['multi']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['cmpt']): +?>_tpl_vars['cmpt']['id_util'] != $this->_tpl_vars['planete']->id_user): ?>_tpl_vars['key'] > 0): ?>, _tpl_vars['cmpt']['pseudo']; ?> + durant cette session.
          + _tpl_vars['planete']->mv < 0): ?>Une demande de suppression de votre compte est en cours. Il sera supprimé sous 48h.
          Si vous n'avez pas demandé la suppression de votre compte, contactez un opérateur au plus vite.
          + Heure du serveur: _tpl_vars['datehb']; ?> + +_tpl_vars['radar']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['flottes']): +?> + _tpl_vars['flottes']['0']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['flotte']): +?> + _tpl_vars['flotte']['mission'] == 1): ?>

          attaque: Une flotte ennemie en provenance de _tpl_vars['flotte']['nom_planete'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?> + [_tpl_vars['flotte']['start_galaxie']; ?> +:_tpl_vars['flotte']['start_ss']; ?> +:_tpl_vars['flotte']['start_position']; ?> +] atteint la planète _tpl_vars['flottes']['1']['0'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?> + [_tpl_vars['flottes']['1']['1']; ?> +:_tpl_vars['flottes']['1']['2']; ?> +:_tpl_vars['flottes']['1']['3']; ?> +] dans _tpl_vars['flotte']['arrive_time']; ?> +

          + _tpl_vars['flotte']['mission'] == 2): ?>

          transport: Une flotte en provenance de _tpl_vars['flotte']['nom_planete'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?> + [_tpl_vars['flotte']['start_galaxie']; ?> +:_tpl_vars['flotte']['start_ss']; ?> +:_tpl_vars['flotte']['start_position']; ?> +] atteint la planète _tpl_vars['flottes']['1']['0'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?> + [_tpl_vars['flottes']['1']['1']; ?> +:_tpl_vars['flottes']['1']['2']; ?> +:_tpl_vars['flottes']['1']['3']; ?> +] dans _tpl_vars['flotte']['arrive_time']; ?> +

          + + + + _tpl_vars['alertMail'] >= 2): ?>

          messagerie: _tpl_vars['alertMail']; ?> + messages non lu

          + _tpl_vars['alertMail'] >= 1): ?>

          messagerie: _tpl_vars['alertMail']; ?> + message non lu

          + +

          _tpl_vars['planete']->nom_planete): ?>Sans nom_tpl_vars['planete']->nom_planete)) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?> + (_tpl_vars['planete']->pseudo; ?> +)

          + Planète +

          Infos

          +

          Diamètre: _tpl_vars['diametre'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> + km (_tpl_vars['planete']->casesRest; ?> + case_tpl_vars['planete']->casesRest > 1): ?>s disponible_tpl_vars['planete']->casesRest > 1): ?>s sur _tpl_vars['planete']->cases; ?> +)

          +

          Race : _tpl_vars['planete']->race; ?> +

          +

          position: _tpl_vars['planete']->galaxie; ?> +._tpl_vars['planete']->ss; ?> +._tpl_vars['planete']->position; ?> +

          + +

          population: _tpl_vars['planete']->population)) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +

          +

          crédits: _tpl_vars['planete']->credits)) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +

          + +

          Classement: _tpl_vars['planete']->place_points == '0'): ?>non classé_tpl_vars['planete']->place_points; ?> +_tpl_vars['planete']->place_points == '1'): ?>erème (_tpl_vars['points'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> + points)

          + _tpl_vars['alliance']): ?>

          Alliance: [_tpl_vars['alliance']['tag'])) ? $this->_run_mod_handler('upper', true, $_tmp) : smarty_modifier_upper($_tmp)); ?> +] _tpl_vars['alliance']['nom']; ?> +

          + +

          En cours sur la planète

          + _tpl_vars['fileBat']): ?> +

          + _tpl_vars['fileBat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['element']): +?> + _tpl_vars['i'] == true): ?> - assign('i', true); ?>Bâtiments : _tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing'][$this->_tpl_vars['element']['0']]; ?> +_tpl_vars['element']['1']): ?> (démolition) + +

          + + _tpl_vars['fileCas']): ?> +

          + _tpl_vars['fileCas']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['element']): +?> + _tpl_vars['j'] == true): ?> - assign('j', true); ?>_tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing']['9'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> + : _tpl_vars['element']['1']; ?> + _tpl_vars['element']['1'] > 1): ?>_tpl_vars['LANG'][$this->_tpl_vars['race']]['caserne']['noms_pluriel'][$this->_tpl_vars['element']['0']]; ?> +_tpl_vars['LANG'][$this->_tpl_vars['race']]['caserne']['noms_sing'][$this->_tpl_vars['element']['0']]; ?> +_tpl_vars['element']['2']): ?> (démantèlement) + +

          + + _tpl_vars['fileVais']): ?> +

          + _tpl_vars['fileVais']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['element']): +?> + _tpl_vars['k'] == true): ?> - assign('k', true); ?>_tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing']['8'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> + : _tpl_vars['element']['1']; ?> + _tpl_vars['element']['1'] > 1): ?>_tpl_vars['LANG'][$this->_tpl_vars['race']]['vaisseaux']['noms_pluriel'][$this->_tpl_vars['element']['0']]; ?> +_tpl_vars['LANG'][$this->_tpl_vars['race']]['vaisseaux']['noms_sing'][$this->_tpl_vars['element']['0']]; ?> +_tpl_vars['element']['2']): ?> (démantèlement) + +

          + + _tpl_vars['fileTer']): ?> +

          + _tpl_vars['fileTer']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['element']): +?> + _tpl_vars['l'] == true): ?> - assign('l', true); ?>_tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing']['7'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> + : _tpl_vars['element']['1']; ?> + _tpl_vars['element']['1'] > 1): ?>_tpl_vars['LANG'][$this->_tpl_vars['race']]['terrestre']['noms_pluriel'][$this->_tpl_vars['element']['0']]; ?> +_tpl_vars['LANG'][$this->_tpl_vars['race']]['terrestre']['noms_sing'][$this->_tpl_vars['element']['0']]; ?> +_tpl_vars['element']['2']): ?> (démantèlement) + +

          + + _tpl_vars['fileTech']): ?> +

          + _tpl_vars['fileTech']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['element']): +?> + _tpl_vars['m'] == true): ?> - assign('m', true); ?>_tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing']['6'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> + : _tpl_vars['LANG'][$this->_tpl_vars['race']]['technologies']['noms_sing'][$this->_tpl_vars['element']['0']][$this->_tpl_vars['element']['1']]; ?> + + +

          + + +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%71^717^7172D774%%ressources.tpl.php b/onyx2/modules/templates/compile/%%71^717^7172D774%%ressources.tpl.php new file mode 100644 index 0000000..86ec7b9 --- /dev/null +++ b/onyx2/modules/templates/compile/%%71^717^7172D774%%ressources.tpl.php @@ -0,0 +1,68 @@ + + array(array('modifier', 'ucfirst', 'game/ressources.tpl', 5, false),array('modifier', 'separernombres', 'game/ressources.tpl', 7, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          Ressources : Tableau récapitulatif des productions par heure

          +
          + + + + + _tpl_vars['planete']->batiments['1']): ?> + _tpl_vars['planete']->batiments['2']): ?> + + _tpl_vars['planete']->batiments['4']): ?> + + _tpl_vars['planete']->energieConso >= $this->_tpl_vars['planete']->energie): ?> class="lack">_tpl_vars['ressources_conso']['4'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> + + +
          Coefficient_tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['metal'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +_tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['cristal'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +_tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['hydrogene'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +_tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['energie'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +
          _tpl_vars['planete']->batiments['0']; ?> + _tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing']['0'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +%_tpl_vars['ressources_prod']['0'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +00-_tpl_vars['ressources_conso']['0'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +
          _tpl_vars['planete']->batiments['1']; ?> + _tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing']['1'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +%0_tpl_vars['ressources_prod']['1'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +0-_tpl_vars['ressources_conso']['1'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +
          _tpl_vars['planete']->batiments['2']; ?> + _tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing']['2'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +%00_tpl_vars['ressources_prod']['2'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +-_tpl_vars['ressources_conso']['2'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +
          _tpl_vars['planete']->batiments['3']; ?> + _tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing']['3'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +%000_tpl_vars['ressources_prod']['3'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +
          _tpl_vars['planete']->batiments['4']; ?> + _tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing']['4'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +%00-_tpl_vars['ressources_conso']['3'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +_tpl_vars['ressources_prod']['4'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +
          _tpl_vars['planete']->batiments['10']; ?> + _tpl_vars['LANG'][$this->_tpl_vars['race']]['batiments']['noms_sing']['10'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +-_tpl_vars['ressources_silo']['1'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +_tpl_vars['ressources_silo']['1'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +_tpl_vars['ressources_silo']['1'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +0
          Total-_tpl_vars['ressources_prod']['0'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +_tpl_vars['ressources_prod']['1'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +_tpl_vars['planete']->batiments['3']): ?>_tpl_vars['ressources_toto']['0'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +0
          +

          +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%74^745^745D5B0F%%mini.tpl.php b/onyx2/modules/templates/compile/%%74^745^745D5B0F%%mini.tpl.php new file mode 100644 index 0000000..e0fedac --- /dev/null +++ b/onyx2/modules/templates/compile/%%74^745^745D5B0F%%mini.tpl.php @@ -0,0 +1,47 @@ + + array(array('modifier', 'sprintf', 'cms/mini.tpl', 26, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'cms/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +
          +
          _tpl_vars['LANG']['mod_login_titre']; ?> +
          +
          +
          +
          + + + + + + + + + _tpl_vars['LANG']['mod_login_forgotMdp']; ?> + + +
          +
          +
          +
          + +
          _tpl_vars['LANG']['mod_inscription_texte'])) ? $this->_run_mod_handler('sprintf', true, $_tmp, $this->_tpl_vars['link']['inscription'], $this->_tpl_vars['link']['inscription'], $this->_tpl_vars['link']['inscription']) : smarty_modifier_sprintf($_tmp, $this->_tpl_vars['link']['inscription'], $this->_tpl_vars['link']['inscription'], $this->_tpl_vars['link']['inscription'])); ?> +
          +
          + Halo.fr +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'cms/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%77^777^777051D7%%bandeau.tpl.php b/onyx2/modules/templates/compile/%%77^777^777051D7%%bandeau.tpl.php new file mode 100644 index 0000000..648ecc1 --- /dev/null +++ b/onyx2/modules/templates/compile/%%77^777^777051D7%%bandeau.tpl.php @@ -0,0 +1,55 @@ + + array(array('modifier', 'escape', 'admin/bandeau.tpl', 14, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          Informations visibles

          + + + + + + + + +_tpl_vars['tableau']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['ligne']): +?> + + + _tpl_vars['ligne']['color']): ?> style="color: _tpl_vars['ligne']['color']; ?> +;">_tpl_vars['ligne']['texte'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?> + + + + +
          ActionTexte
          EDIT | SUPPR
          +

          _tpl_vars['id'] == 'add'): ?>AjouterModifier une information_tpl_vars['id'] != 'add'): ?> : _tpl_vars['id']; ?> +

          +
          +
          +

          +

          + +
          +
          +

          Gestion du cache

          + Mettre à jour le cache +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%7C^7C1^7C189E57%%vp.tpl.php b/onyx2/modules/templates/compile/%%7C^7C1^7C189E57%%vp.tpl.php new file mode 100644 index 0000000..0acb136 --- /dev/null +++ b/onyx2/modules/templates/compile/%%7C^7C1^7C189E57%%vp.tpl.php @@ -0,0 +1,15 @@ + +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +
          ... veuillez patienter ...
          + _tpl_vars['contenu']; ?> + +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%87^872^872D6F7E%%gestion.tpl.php b/onyx2/modules/templates/compile/%%87^872^872D6F7E%%gestion.tpl.php new file mode 100644 index 0000000..e537be9 --- /dev/null +++ b/onyx2/modules/templates/compile/%%87^872^872D6F7E%%gestion.tpl.php @@ -0,0 +1,121 @@ + + array(array('function', 'html_options', 'game/gestion.tpl', 6, false),array('modifier', 'date_format', 'game/gestion.tpl', 7, false),array('modifier', 'escape', 'game/gestion.tpl', 25, false),array('modifier', 'ucfirst', 'game/gestion.tpl', 31, false),array('modifier', 'separernombres', 'game/gestion.tpl', 34, false),array('modifier', 'separerNombres', 'game/gestion.tpl', 55, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          Politique

          +
          +
          + +

          + _tpl_vars['planete']->politique_lastchange)) ? $this->_run_mod_handler('date_format', true, $_tmp, "%A %d %B %y") : smarty_modifier_date_format($_tmp, "%A %d %B %y")); ?> +

          + _tpl_vars['planete']->moral*100; ?> +%


          + +
          +
          +

          Gestion

          +
          + + + + +_tpl_vars['planetes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['plan']): +?> + + + + + +_tpl_vars['planetes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['plan']): +?> + + + + + + + +_tpl_vars['planetes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['plan']): +?> +_tpl_vars['plan']['id'] == $this->_tpl_vars['planeteEC']['id']): ?>assign('plan', $this->_tpl_vars['planeteEC']); ?> + + + + + +_tpl_vars['planetes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['plan']): +?> +_tpl_vars['plan']['id'] == $this->_tpl_vars['planeteEC']['id']): ?>assign('plan', $this->_tpl_vars['planeteEC']); ?> + + + + + +_tpl_vars['planetes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['plan']): +?> +_tpl_vars['plan']['id'] == $this->_tpl_vars['planeteEC']['id']): ?>assign('plan', $this->_tpl_vars['planeteEC']); ?> + + + + + +_tpl_vars['planetes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['plan']): +?> +_tpl_vars['plan']['id'] == $this->_tpl_vars['planeteEC']['id']): ?>assign('plan', $this->_tpl_vars['planeteEC']); ?> + + + + + +_tpl_vars['planetes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['plan']): +?> +_tpl_vars['plan']['id'] == $this->_tpl_vars['planeteEC']['id']): ?>assign('plan', $this->_tpl_vars['planeteEC']); ?> + + + + + +_tpl_vars['planetes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['plan']): +?> + + + + +
          <?php echo $this->_tpl_vars['plan']['image']; ?>
+
          _tpl_vars['plan']['nom_planete'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?> +
          _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['metal'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +_tpl_vars['plan']['metal'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +
          _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['cristal'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +_tpl_vars['plan']['cristal'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +
          _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['hydrogene'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +_tpl_vars['plan']['hydrogene'])) ? $this->_run_mod_handler('separernombres', true, $_tmp) : separernombres($_tmp)); ?> +
          _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['energie'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +_tpl_vars['plan']['energie'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          Population_tpl_vars['plan']['population'])) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +
          Moral_tpl_vars['plan']['moral']*100)) ? $this->_run_mod_handler('separerNombres', true, $_tmp) : separerNombres($_tmp)); ?> +%
          +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%8B^8B5^8B5682FA%%operateur.tpl.php b/onyx2/modules/templates/compile/%%8B^8B5^8B5682FA%%operateur.tpl.php new file mode 100644 index 0000000..394e5f2 --- /dev/null +++ b/onyx2/modules/templates/compile/%%8B^8B5^8B5682FA%%operateur.tpl.php @@ -0,0 +1,56 @@ + +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          Opérateurs de cette galaxie

          +
            +_tpl_vars['operateurs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['operateur']): +?> +
          • _tpl_vars['operateur']['pseudo']; ?> + (_tpl_vars['operateur']['auth_level'] == 2): ?>Modérateur_tpl_vars['operateur']['auth_level'] == 3): ?>Maître de la bourse_tpl_vars['operateur']['auth_level'] == 4): ?>Opérateur en formation_tpl_vars['operateur']['auth_level'] == 5): ?>Opérateur_tpl_vars['operateur']['auth_level'] == 6): ?>Super-opérateur_tpl_vars['operateur']['auth_level'] == 7): ?>Administrateur_tpl_vars['operateur']['auth_level'] == 8): ?>Codeur)
          • + +
          +

          Problèmes connus

          + Lisez les questions/réponses ci-dessous. Ne contactez un opérateur que si vous ne pouvez pas résoudre votre problème/demande.
          + N'oubliez pas de contacter les opérateurs pour les raisons indiquées dans les règles du jeu. +_tpl_vars['questions']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['question']): +?> +
          +
          _tpl_vars['question']['0']; ?> +
          _tpl_vars['question']['1']; ?> +_tpl_vars['auth_level'] > 4): ?>
          +
          + + _tpl_vars['auth_level'] >= 5): ?> +

          Ajouter un problème connu

          +
          + + +

          + +
          +

          Prendre contact avec les opérateurs de la galaxie

          +
          + + +

          + +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%8D^8DC^8DC74F79%%erreur.tpl.php b/onyx2/modules/templates/compile/%%8D^8DC^8DC74F79%%erreur.tpl.php new file mode 100644 index 0000000..27dccf5 --- /dev/null +++ b/onyx2/modules/templates/compile/%%8D^8DC^8DC74F79%%erreur.tpl.php @@ -0,0 +1,15 @@ + +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +
          _tpl_vars['couleur']): ?> style="color: _tpl_vars['couleur']; ?> +;">_tpl_vars['message']; ?> +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%93^93A^93AC0D10%%mail_view.tpl.php b/onyx2/modules/templates/compile/%%93^93A^93AC0D10%%mail_view.tpl.php new file mode 100644 index 0000000..b11a3b5 --- /dev/null +++ b/onyx2/modules/templates/compile/%%93^93A^93AC0D10%%mail_view.tpl.php @@ -0,0 +1,60 @@ + + array(array('modifier', 'date_format', 'admin/mail_view.tpl', 14, false),array('modifier', 'escape', 'admin/mail_view.tpl', 18, false),array('modifier', 'nl2br', 'admin/mail_view.tpl', 23, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> + + _tpl_vars['req']['statut'] >= 1): ?> style="background: #_tpl_vars['req']['statut'] == 1): ?>770000_tpl_vars['req']['statut'] == 2): ?>007700_tpl_vars['req']['statut'] == 3): ?>000077_tpl_vars['req']['statut'] == 4): ?>770077_tpl_vars['req']['statut'] == 5): ?>007777_tpl_vars['req']['statut'] == 6): ?>777700;"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
          Emetteur_tpl_vars['req']['pseudo']; ?> +
          Statut_tpl_vars['req']['statut']; ?> +
          Date_tpl_vars['req']['time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%d/%m/%y %H:%M:%S") : smarty_modifier_date_format($_tmp, "%d/%m/%y %H:%M:%S")); ?> +
          Objet_tpl_vars['req']['titre'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?> +
          _tpl_vars['req']['contenu'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)))) ? $this->_run_mod_handler('nl2br', true, $_tmp) : smarty_modifier_nl2br($_tmp)); ?> +
          RépondreSupprimerStatutRetour<<< - >>>
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%B6^B6A^B6A46224%%version.tpl.php b/onyx2/modules/templates/compile/%%B6^B6A^B6A46224%%version.tpl.php new file mode 100644 index 0000000..c7122b3 --- /dev/null +++ b/onyx2/modules/templates/compile/%%B6^B6A^B6A46224%%version.tpl.php @@ -0,0 +1,63 @@ + + array(array('modifier', 'nl2br', 'admin/version.tpl', 28, false),array('modifier', 'date_format', 'admin/version.tpl', 29, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          Gestion du cache

          + Mettre à jour le cache +

          _tpl_vars['id'] == 'add'): ?>AjouterModifier une version_tpl_vars['id'] != 'add'): ?> : _tpl_vars['id']; ?> +

          +
          +
          +
          +

          + +
          +
          +

          Liste des versions

          + + + + + + + + + + + +_tpl_vars['tableau']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['ligne']): +?> + + + + + + + + + +
          ActionVersionInfosDatePar
          EDIT | SUPPR_tpl_vars['ligne']['version']; ?> +_tpl_vars['ligne']['contenu'])) ? $this->_run_mod_handler('nl2br', true, $_tmp) : smarty_modifier_nl2br($_tmp)); ?> +_tpl_vars['ligne']['temps'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%d/%m/%y %H:%M:%S") : smarty_modifier_date_format($_tmp, "%d/%m/%y %H:%M:%S")); ?> +_tpl_vars['ligne']['pseudo']; ?> +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%C1^C1E^C1EB8435%%demarrage.tpl.php b/onyx2/modules/templates/compile/%%C1^C1E^C1EB8435%%demarrage.tpl.php new file mode 100644 index 0000000..f16d411 --- /dev/null +++ b/onyx2/modules/templates/compile/%%C1^C1E^C1EB8435%%demarrage.tpl.php @@ -0,0 +1,61 @@ + + array(array('modifier', 'escape', 'admin/demarrage.tpl', 17, false),array('modifier', 'date_format', 'admin/demarrage.tpl', 18, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> + Créer une nouvelle page +

          Pages de démarrage

          +

          La première news est celle qui sera affichée à la connexion des joueurs

          + + + + + + + + + +_tpl_vars['tableau']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['ligne']): +?> + + + + + + + +
          ActionTitreDate de visibilité
          EDIT | SUPPR_tpl_vars['ligne']['titre'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?> +_tpl_vars['ligne']['time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%d/%m/%y %H:%M:%S") : smarty_modifier_date_format($_tmp, "%d/%m/%y %H:%M:%S")); ?> +
          +

          Gestion du cache

          + Mettre à jour le cache +

          _tpl_vars['id'] == 'add'): ?>AjouterModifier une page de démarrage_tpl_vars['id'] != 'add'): ?> : _tpl_vars['id']; ?> +

          +
          +
          +
          +

          + _tpl_vars['mod']['titre']): ?> Les utilisateurs ayant déjà vu la page la revéront de nouveau.


          + +
          +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%C3^C3A^C3A25C2F%%footer.tpl.php b/onyx2/modules/templates/compile/%%C3^C3A^C3A25C2F%%footer.tpl.php new file mode 100644 index 0000000..3f4b155 --- /dev/null +++ b/onyx2/modules/templates/compile/%%C3^C3A^C3A25C2F%%footer.tpl.php @@ -0,0 +1,29 @@ + +
          + + +
          +
          +_tpl_vars['script']; ?> + + + + \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%E7^E70^E70DD496%%header.tpl.php b/onyx2/modules/templates/compile/%%E7^E70^E70DD496%%header.tpl.php new file mode 100644 index 0000000..cebbd45 --- /dev/null +++ b/onyx2/modules/templates/compile/%%E7^E70^E70DD496%%header.tpl.php @@ -0,0 +1,218 @@ + + array(array('modifier', 'ucfirst', 'game/header.tpl', 62, false),array('modifier', 'escape', 'game/header.tpl', 96, false),array('modifier', 'separenombre', 'game/header.tpl', 98, false),)), $this); ?> + + + + + + + + + + + + +<?php echo $this->_tpl_vars['titre']; ?> + +_tpl_vars['race'] == 'covenant'): ?>_tpl_vars['auth_level'] >= 3): ?> +_tpl_vars['race'] == 'humain'): ?>_tpl_vars['auth_level'] >= 3): ?> + + +_tpl_vars['scripth']; ?> + + + + +
          +
          + + +
          + +_tpl_vars['page'] != 'admin' && $this->_tpl_vars['page'] != 'vide' && $this->_tpl_vars['page'] != 'amis' && $this->_tpl_vars['page'] != 'flotten' && $this->_tpl_vars['page'] != 'messagerie' && $this->_tpl_vars['page'] != 'envoyer' && $this->_tpl_vars['page'] != 'bugs' && $this->_tpl_vars['page'] != 'carte' && $this->_tpl_vars['page'] != 'classement' && $this->_tpl_vars['page'] != 'options' && $this->_tpl_vars['page'] != 'simulation' && $this->_tpl_vars['page'] != 'vp' && $this->_tpl_vars['page'] != 'operateur' && $this->_tpl_vars['titre'] != 'Alliance'): ?> +
          +
          + <?php echo ((is_array($_tmp=$this->_tpl_vars['planete']->nom_planete)) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
+ +
          Bonjour, _tpl_vars['planete']->pseudo; ?> +.
          Votre position actuelle:

          +
          _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['energie'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +
          _tpl_vars['planete']->energieConso >= $this->_tpl_vars['planete']->energie): ?>_tpl_vars['planete']->energieConso)) ? $this->_run_mod_handler('separenombre', true, $_tmp) : smarty_modifier_separenombre($_tmp)); ?> +/_tpl_vars['planete']->energie)) ? $this->_run_mod_handler('separenombre', true, $_tmp) : smarty_modifier_separenombre($_tmp)); ?> +_tpl_vars['planete']->alert_ressources['4']): ?>
          +
          _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['hydrogene'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +
          _tpl_vars['planete']->alert_ressources['2'] == true): ?>_tpl_vars['planete']->hydrogene)) ? $this->_run_mod_handler('separenombre', true, $_tmp) : smarty_modifier_separenombre($_tmp)); ?> +_tpl_vars['planete']->alert_ressources['2']): ?>
          +
          _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['cristal'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +
          _tpl_vars['planete']->alert_ressources['1'] == true): ?>_tpl_vars['planete']->cristal)) ? $this->_run_mod_handler('separenombre', true, $_tmp) : smarty_modifier_separenombre($_tmp)); ?> +_tpl_vars['planete']->alert_ressources['1']): ?>
          +
          _tpl_vars['LANG'][$this->_tpl_vars['race']]['ressources']['noms']['metal'])) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : smarty_modifier_ucfirst($_tmp)); ?> +
          _tpl_vars['planete']->alert_ressources['0'] == true): ?>_tpl_vars['planete']->metal)) ? $this->_run_mod_handler('separenombre', true, $_tmp) : smarty_modifier_separenombre($_tmp)); ?> +_tpl_vars['planete']->alert_ressources['0']): ?>
          +
          +
          + + _tpl_vars['page'] != 'admin' && $this->_tpl_vars['page'] != 'operateur'): ?>
          _tpl_vars['pub']; ?> +
          +
          +
          \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%F0^F04^F04D8BCE%%vide.tpl.php b/onyx2/modules/templates/compile/%%F0^F04^F04D8BCE%%vide.tpl.php new file mode 100644 index 0000000..6d5920e --- /dev/null +++ b/onyx2/modules/templates/compile/%%F0^F04^F04D8BCE%%vide.tpl.php @@ -0,0 +1,17 @@ + +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          _tpl_vars['titreP']): ?>_tpl_vars['titreP']; ?> +_tpl_vars['titre']; ?> +

          + _tpl_vars['contenu']; ?> + +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%F2^F21^F21E08BB%%messagerie.tpl.php b/onyx2/modules/templates/compile/%%F2^F21^F21E08BB%%messagerie.tpl.php new file mode 100644 index 0000000..0dca474 --- /dev/null +++ b/onyx2/modules/templates/compile/%%F2^F21^F21E08BB%%messagerie.tpl.php @@ -0,0 +1,60 @@ + + array(array('modifier', 'nl2br', 'game/messagerie.tpl', 8, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          Messages

          + _tpl_vars['avertissement']; ?> + +

          Ecrire un message

          +
          +_tpl_vars['messages']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['message']): +?> +
          +
          _tpl_vars['message']['0']; ?> + de _tpl_vars['message']['2']; ?> + à _tpl_vars['message']['1']; ?> +
          _tpl_vars['message']['3'])) ? $this->_run_mod_handler('nl2br', true, $_tmp) : smarty_modifier_nl2br($_tmp)); ?> +
          +
          + +


          Supprimer la sélection :

          +
          +

          Rapports

          +
          +_tpl_vars['rapports']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['rapport']): +?> +
          +
          _tpl_vars['rapport']['0']; ?> + à _tpl_vars['rapport']['1']; ?> +
          _tpl_vars['rapport']['3']; ?> +
          +
          + +


          Supprimer la sélection :

          +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%F5^F53^F538D328%%inscription.tpl.php b/onyx2/modules/templates/compile/%%F5^F53^F538D328%%inscription.tpl.php new file mode 100644 index 0000000..4912b73 --- /dev/null +++ b/onyx2/modules/templates/compile/%%F5^F53^F538D328%%inscription.tpl.php @@ -0,0 +1,46 @@ + +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +
          +
          +

          +
          +
          +
          +

          Race :
          +

          + + + + + +
          + + + +
          +

          +
          +
          +

          +

          +
          +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/compile/%%F5^F5E^F5EB692F%%version.tpl.php b/onyx2/modules/templates/compile/%%F5^F5E^F5EB692F%%version.tpl.php new file mode 100644 index 0000000..778fce8 --- /dev/null +++ b/onyx2/modules/templates/compile/%%F5^F5E^F5EB692F%%version.tpl.php @@ -0,0 +1,25 @@ + + array(array('modifier', 'nl2br', 'game/version.tpl', 5, false),)), $this); ?> +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/header.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> +

          Historique des mises à jour

          + +_tpl_vars['versions']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['version']): +?> + + +
          VersionsDétails
          _tpl_vars['version']['numero']; ?> +
          _tpl_vars['version']['date']; ?> +
          _tpl_vars['version']['description'])) ? $this->_run_mod_handler('nl2br', true, $_tmp) : smarty_modifier_nl2br($_tmp)); ?> +
          +_tpl_vars; +$this->_smarty_include(array('smarty_include_tpl_file' => 'game/footer.tpl', 'smarty_include_vars' => array())); +$this->_tpl_vars = $_smarty_tpl_vars; +unset($_smarty_tpl_vars); + ?> \ No newline at end of file diff --git a/onyx2/modules/templates/main.php b/onyx2/modules/templates/main.php new file mode 100644 index 0000000..8cd2b22 --- /dev/null +++ b/onyx2/modules/templates/main.php @@ -0,0 +1,25 @@ + diff --git a/onyx2/modules/templates/smarty/Config_File.class.php b/onyx2/modules/templates/smarty/Config_File.class.php new file mode 100644 index 0000000..31b8907 --- /dev/null +++ b/onyx2/modules/templates/smarty/Config_File.class.php @@ -0,0 +1,393 @@ + + * @access public + * @package Smarty + */ + +/* $Id: Config_File.class.php 2786 2008-09-18 21:04:38Z Uwe.Tews $ */ + +/** + * Config file reading class + * @package Smarty + */ +class Config_File { + /**#@+ + * Options + * @var boolean + */ + /** + * Controls whether variables with the same name overwrite each other. + */ + var $overwrite = true; + + /** + * Controls whether config values of on/true/yes and off/false/no get + * converted to boolean values automatically. + */ + var $booleanize = true; + + /** + * Controls whether hidden config sections/vars are read from the file. + */ + var $read_hidden = true; + + /** + * Controls whether or not to fix mac or dos formatted newlines. + * If set to true, \r or \r\n will be changed to \n. + */ + var $fix_newlines = true; + /**#@-*/ + + /** @access private */ + var $_config_path = ""; + var $_config_data = array(); + /**#@-*/ + + /** + * Constructs a new config file class. + * + * @param string $config_path (optional) path to the config files + */ + function Config_File($config_path = NULL) + { + if (isset($config_path)) + $this->set_path($config_path); + } + + + /** + * Set the path where configuration files can be found. + * + * @param string $config_path path to the config files + */ + function set_path($config_path) + { + if (!empty($config_path)) { + if (!is_string($config_path) || !file_exists($config_path) || !is_dir($config_path)) { + $this->_trigger_error_msg("Bad config file path '$config_path'"); + return; + } + if(substr($config_path, -1) != DIRECTORY_SEPARATOR) { + $config_path .= DIRECTORY_SEPARATOR; + } + + $this->_config_path = $config_path; + } + } + + + /** + * Retrieves config info based on the file, section, and variable name. + * + * @param string $file_name config file to get info for + * @param string $section_name (optional) section to get info for + * @param string $var_name (optional) variable to get info for + * @return string|array a value or array of values + */ + function get($file_name, $section_name = NULL, $var_name = NULL) + { + if (empty($file_name)) { + $this->_trigger_error_msg('Empty config file name'); + return; + } else { + $file_name = $this->_config_path . $file_name; + if (!isset($this->_config_data[$file_name])) + $this->load_file($file_name, false); + } + + if (!empty($var_name)) { + if (empty($section_name)) { + return $this->_config_data[$file_name]["vars"][$var_name]; + } else { + if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name])) + return $this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name]; + else + return array(); + } + } else { + if (empty($section_name)) { + return (array)$this->_config_data[$file_name]["vars"]; + } else { + if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"])) + return (array)$this->_config_data[$file_name]["sections"][$section_name]["vars"]; + else + return array(); + } + } + } + + + /** + * Retrieves config info based on the key. + * + * @param $file_name string config key (filename/section/var) + * @return string|array same as get() + * @uses get() retrieves information from config file and returns it + */ + function &get_key($config_key) + { + list($file_name, $section_name, $var_name) = explode('/', $config_key, 3); + $result = &$this->get($file_name, $section_name, $var_name); + return $result; + } + + /** + * Get all loaded config file names. + * + * @return array an array of loaded config file names + */ + function get_file_names() + { + return array_keys($this->_config_data); + } + + + /** + * Get all section names from a loaded file. + * + * @param string $file_name config file to get section names from + * @return array an array of section names from the specified file + */ + function get_section_names($file_name) + { + $file_name = $this->_config_path . $file_name; + if (!isset($this->_config_data[$file_name])) { + $this->_trigger_error_msg("Unknown config file '$file_name'"); + return; + } + + return array_keys($this->_config_data[$file_name]["sections"]); + } + + + /** + * Get all global or section variable names. + * + * @param string $file_name config file to get info for + * @param string $section_name (optional) section to get info for + * @return array an array of variables names from the specified file/section + */ + function get_var_names($file_name, $section = NULL) + { + if (empty($file_name)) { + $this->_trigger_error_msg('Empty config file name'); + return; + } else if (!isset($this->_config_data[$file_name])) { + $this->_trigger_error_msg("Unknown config file '$file_name'"); + return; + } + + if (empty($section)) + return array_keys($this->_config_data[$file_name]["vars"]); + else + return array_keys($this->_config_data[$file_name]["sections"][$section]["vars"]); + } + + + /** + * Clear loaded config data for a certain file or all files. + * + * @param string $file_name file to clear config data for + */ + function clear($file_name = NULL) + { + if ($file_name === NULL) + $this->_config_data = array(); + else if (isset($this->_config_data[$file_name])) + $this->_config_data[$file_name] = array(); + } + + + /** + * Load a configuration file manually. + * + * @param string $file_name file name to load + * @param boolean $prepend_path whether current config path should be + * prepended to the filename + */ + function load_file($file_name, $prepend_path = true) + { + if ($prepend_path && $this->_config_path != "") + $config_file = $this->_config_path . $file_name; + else + $config_file = $file_name; + + ini_set('track_errors', true); + $fp = @fopen($config_file, "r"); + if (!is_resource($fp)) { + $this->_trigger_error_msg("Could not open config file '$config_file'"); + return false; + } + + $contents = ($size = filesize($config_file)) ? fread($fp, $size) : ''; + fclose($fp); + + $this->_config_data[$config_file] = $this->parse_contents($contents); + return true; + } + + /** + * Store the contents of a file manually. + * + * @param string $config_file file name of the related contents + * @param string $contents the file-contents to parse + */ + function set_file_contents($config_file, $contents) + { + $this->_config_data[$config_file] = $this->parse_contents($contents); + return true; + } + + /** + * parse the source of a configuration file manually. + * + * @param string $contents the file-contents to parse + */ + function parse_contents($contents) + { + if($this->fix_newlines) { + // fix mac/dos formatted newlines + $contents = preg_replace('!\r\n?!', "\n", $contents); + } + + $config_data = array(); + $config_data['sections'] = array(); + $config_data['vars'] = array(); + + /* reference to fill with data */ + $vars =& $config_data['vars']; + + /* parse file line by line */ + preg_match_all('!^.*\r?\n?!m', $contents, $match); + $lines = $match[0]; + for ($i=0, $count=count($lines); $i<$count; $i++) { + $line = $lines[$i]; + if (empty($line)) continue; + + if ( substr($line, 0, 1) == '[' && preg_match('!^\[(.*?)\]!', $line, $match) ) { + /* section found */ + if (substr($match[1], 0, 1) == '.') { + /* hidden section */ + if ($this->read_hidden) { + $section_name = substr($match[1], 1); + } else { + /* break reference to $vars to ignore hidden section */ + unset($vars); + $vars = array(); + continue; + } + } else { + $section_name = $match[1]; + } + if (!isset($config_data['sections'][$section_name])) + $config_data['sections'][$section_name] = array('vars' => array()); + $vars =& $config_data['sections'][$section_name]['vars']; + continue; + } + + if (preg_match('/^\s*(\.?\w+)\s*=\s*(.*)/s', $line, $match)) { + /* variable found */ + $var_name = rtrim($match[1]); + if (strpos($match[2], '"""') === 0) { + /* handle multiline-value */ + $lines[$i] = substr($match[2], 3); + $var_value = ''; + while ($i<$count) { + if (($pos = strpos($lines[$i], '"""')) === false) { + $var_value .= $lines[$i++]; + } else { + /* end of multiline-value */ + $var_value .= substr($lines[$i], 0, $pos); + break; + } + } + $booleanize = false; + + } else { + /* handle simple value */ + $var_value = preg_replace('/^([\'"])(.*)\1$/', '\2', rtrim($match[2])); + $booleanize = $this->booleanize; + + } + $this->_set_config_var($vars, $var_name, $var_value, $booleanize); + } + /* else unparsable line / means it is a comment / means ignore it */ + } + return $config_data; + } + + /**#@+ @access private */ + /** + * @param array &$container + * @param string $var_name + * @param mixed $var_value + * @param boolean $booleanize determines whether $var_value is converted to + * to true/false + */ + function _set_config_var(&$container, $var_name, $var_value, $booleanize) + { + if (substr($var_name, 0, 1) == '.') { + if (!$this->read_hidden) + return; + else + $var_name = substr($var_name, 1); + } + + if (!preg_match("/^[a-zA-Z_]\w*$/", $var_name)) { + $this->_trigger_error_msg("Bad variable name '$var_name'"); + return; + } + + if ($booleanize) { + if (preg_match("/^(on|true|yes)$/i", $var_value)) + $var_value = true; + else if (preg_match("/^(off|false|no)$/i", $var_value)) + $var_value = false; + } + + if (!isset($container[$var_name]) || $this->overwrite) + $container[$var_name] = $var_value; + else { + settype($container[$var_name], 'array'); + $container[$var_name][] = $var_value; + } + } + + /** + * @uses trigger_error() creates a PHP warning/error + * @param string $error_msg + * @param integer $error_type one of + */ + function _trigger_error_msg($error_msg, $error_type = E_USER_WARNING) + { + trigger_error("Config_File error: $error_msg", $error_type); + } + /**#@-*/ +} + +?> diff --git a/onyx2/modules/templates/smarty/Smarty.class.php b/onyx2/modules/templates/smarty/Smarty.class.php new file mode 100644 index 0000000..95ec67b --- /dev/null +++ b/onyx2/modules/templates/smarty/Smarty.class.php @@ -0,0 +1,1960 @@ + + * @author Andrei Zmievski + * @package Smarty + * @version 2.6.22 + */ + +/* $Id: Smarty.class.php 2785 2008-09-18 21:04:12Z Uwe.Tews $ */ + +/** + * DIR_SEP isn't used anymore, but third party apps might + */ +if(!defined('DIR_SEP')) { + define('DIR_SEP', DIRECTORY_SEPARATOR); +} + +/** + * set SMARTY_DIR to absolute path to Smarty library files. + * if not defined, include_path will be used. Sets SMARTY_DIR only if user + * application has not already defined it. + */ + +if (!defined('SMARTY_DIR')) { + define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR); +} + +if (!defined('SMARTY_CORE_DIR')) { + define('SMARTY_CORE_DIR', SMARTY_DIR . 'internals' . DIRECTORY_SEPARATOR); +} + +define('SMARTY_PHP_PASSTHRU', 0); +define('SMARTY_PHP_QUOTE', 1); +define('SMARTY_PHP_REMOVE', 2); +define('SMARTY_PHP_ALLOW', 3); + +/** + * @package Smarty + */ +class Smarty +{ + /**#@+ + * Smarty Configuration Section + */ + + /** + * The name of the directory where templates are located. + * + * @var string + */ + var $template_dir = 'templates'; + + /** + * The directory where compiled templates are located. + * + * @var string + */ + var $compile_dir = 'templates_c'; + + /** + * The directory where config files are located. + * + * @var string + */ + var $config_dir = 'configs'; + + /** + * An array of directories searched for plugins. + * + * @var array + */ + var $plugins_dir = array('plugins'); + + /** + * If debugging is enabled, a debug console window will display + * when the page loads (make sure your browser allows unrequested + * popup windows) + * + * @var boolean + */ + var $debugging = false; + + /** + * When set, smarty does uses this value as error_reporting-level. + * + * @var boolean + */ + var $error_reporting = null; + + /** + * This is the path to the debug console template. If not set, + * the default one will be used. + * + * @var string + */ + var $debug_tpl = ''; + + /** + * This determines if debugging is enable-able from the browser. + *
            + *
          • NONE => no debugging control allowed
          • + *
          • URL => enable debugging when SMARTY_DEBUG is found in the URL.
          • + *
          + * @link http://www.foo.dom/index.php?SMARTY_DEBUG + * @var string + */ + var $debugging_ctrl = 'NONE'; + + /** + * This tells Smarty whether to check for recompiling or not. Recompiling + * does not need to happen unless a template or config file is changed. + * Typically you enable this during development, and disable for + * production. + * + * @var boolean + */ + var $compile_check = true; + + /** + * This forces templates to compile every time. Useful for development + * or debugging. + * + * @var boolean + */ + var $force_compile = false; + + /** + * This enables template caching. + *
            + *
          • 0 = no caching
          • + *
          • 1 = use class cache_lifetime value
          • + *
          • 2 = use cache_lifetime in cache file
          • + *
          + * @var integer + */ + var $caching = 0; + + /** + * The name of the directory for cache files. + * + * @var string + */ + var $cache_dir = 'cache'; + + /** + * This is the number of seconds cached content will persist. + *
            + *
          • 0 = always regenerate cache
          • + *
          • -1 = never expires
          • + *
          + * + * @var integer + */ + var $cache_lifetime = 3600; + + /** + * Only used when $caching is enabled. If true, then If-Modified-Since headers + * are respected with cached content, and appropriate HTTP headers are sent. + * This way repeated hits to a cached page do not send the entire page to the + * client every time. + * + * @var boolean + */ + var $cache_modified_check = false; + + /** + * This determines how Smarty handles "" tags in templates. + * possible values: + *
            + *
          • SMARTY_PHP_PASSTHRU -> print tags as plain text
          • + *
          • SMARTY_PHP_QUOTE -> escape tags as entities
          • + *
          • SMARTY_PHP_REMOVE -> remove php tags
          • + *
          • SMARTY_PHP_ALLOW -> execute php tags
          • + *
          + * + * @var integer + */ + var $php_handling = SMARTY_PHP_PASSTHRU; + + /** + * This enables template security. When enabled, many things are restricted + * in the templates that normally would go unchecked. This is useful when + * untrusted parties are editing templates and you want a reasonable level + * of security. (no direct execution of PHP in templates for example) + * + * @var boolean + */ + var $security = false; + + /** + * This is the list of template directories that are considered secure. This + * is used only if {@link $security} is enabled. One directory per array + * element. {@link $template_dir} is in this list implicitly. + * + * @var array + */ + var $secure_dir = array(); + + /** + * These are the security settings for Smarty. They are used only when + * {@link $security} is enabled. + * + * @var array + */ + var $security_settings = array( + 'PHP_HANDLING' => false, + 'IF_FUNCS' => array('array', 'list', + 'isset', 'empty', + 'count', 'sizeof', + 'in_array', 'is_array', + 'true', 'false', 'null'), + 'INCLUDE_ANY' => false, + 'PHP_TAGS' => false, + 'MODIFIER_FUNCS' => array('count'), + 'ALLOW_CONSTANTS' => false + ); + + /** + * This is an array of directories where trusted php scripts reside. + * {@link $security} is disabled during their inclusion/execution. + * + * @var array + */ + var $trusted_dir = array(); + + /** + * The left delimiter used for the template tags. + * + * @var string + */ + var $left_delimiter = '{'; + + /** + * The right delimiter used for the template tags. + * + * @var string + */ + var $right_delimiter = '}'; + + /** + * The order in which request variables are registered, similar to + * variables_order in php.ini E = Environment, G = GET, P = POST, + * C = Cookies, S = Server + * + * @var string + */ + var $request_vars_order = 'EGPCS'; + + /** + * Indicates wether $HTTP_*_VARS[] (request_use_auto_globals=false) + * are uses as request-vars or $_*[]-vars. note: if + * request_use_auto_globals is true, then $request_vars_order has + * no effect, but the php-ini-value "gpc_order" + * + * @var boolean + */ + var $request_use_auto_globals = true; + + /** + * Set this if you want different sets of compiled files for the same + * templates. This is useful for things like different languages. + * Instead of creating separate sets of templates per language, you + * set different compile_ids like 'en' and 'de'. + * + * @var string + */ + var $compile_id = null; + + /** + * This tells Smarty whether or not to use sub dirs in the cache/ and + * templates_c/ directories. sub directories better organized, but + * may not work well with PHP safe mode enabled. + * + * @var boolean + * + */ + var $use_sub_dirs = false; + + /** + * This is a list of the modifiers to apply to all template variables. + * Put each modifier in a separate array element in the order you want + * them applied. example: array('escape:"htmlall"'); + * + * @var array + */ + var $default_modifiers = array(); + + /** + * This is the resource type to be used when not specified + * at the beginning of the resource path. examples: + * $smarty->display('file:index.tpl'); + * $smarty->display('db:index.tpl'); + * $smarty->display('index.tpl'); // will use default resource type + * {include file="file:index.tpl"} + * {include file="db:index.tpl"} + * {include file="index.tpl"} {* will use default resource type *} + * + * @var array + */ + var $default_resource_type = 'file'; + + /** + * The function used for cache file handling. If not set, built-in caching is used. + * + * @var null|string function name + */ + var $cache_handler_func = null; + + /** + * This indicates which filters are automatically loaded into Smarty. + * + * @var array array of filter names + */ + var $autoload_filters = array(); + + /**#@+ + * @var boolean + */ + /** + * This tells if config file vars of the same name overwrite each other or not. + * if disabled, same name variables are accumulated in an array. + */ + var $config_overwrite = true; + + /** + * This tells whether or not to automatically booleanize config file variables. + * If enabled, then the strings "on", "true", and "yes" are treated as boolean + * true, and "off", "false" and "no" are treated as boolean false. + */ + var $config_booleanize = true; + + /** + * This tells whether hidden sections [.foobar] are readable from the + * tempalates or not. Normally you would never allow this since that is + * the point behind hidden sections: the application can access them, but + * the templates cannot. + */ + var $config_read_hidden = false; + + /** + * This tells whether or not automatically fix newlines in config files. + * It basically converts \r (mac) or \r\n (dos) to \n + */ + var $config_fix_newlines = true; + /**#@-*/ + + /** + * If a template cannot be found, this PHP function will be executed. + * Useful for creating templates on-the-fly or other special action. + * + * @var string function name + */ + var $default_template_handler_func = ''; + + /** + * The file that contains the compiler class. This can a full + * pathname, or relative to the php_include path. + * + * @var string + */ + var $compiler_file = 'Smarty_Compiler.class.php'; + + /** + * The class used for compiling templates. + * + * @var string + */ + var $compiler_class = 'Smarty_Compiler'; + + /** + * The class used to load config vars. + * + * @var string + */ + var $config_class = 'Config_File'; + +/**#@+ + * END Smarty Configuration Section + * There should be no need to touch anything below this line. + * @access private + */ + /** + * where assigned template vars are kept + * + * @var array + */ + var $_tpl_vars = array(); + + /** + * stores run-time $smarty.* vars + * + * @var null|array + */ + var $_smarty_vars = null; + + /** + * keeps track of sections + * + * @var array + */ + var $_sections = array(); + + /** + * keeps track of foreach blocks + * + * @var array + */ + var $_foreach = array(); + + /** + * keeps track of tag hierarchy + * + * @var array + */ + var $_tag_stack = array(); + + /** + * configuration object + * + * @var Config_file + */ + var $_conf_obj = null; + + /** + * loaded configuration settings + * + * @var array + */ + var $_config = array(array('vars' => array(), 'files' => array())); + + /** + * md5 checksum of the string 'Smarty' + * + * @var string + */ + var $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f'; + + /** + * Smarty version number + * + * @var string + */ + var $_version = '2.6.22'; + + /** + * current template inclusion depth + * + * @var integer + */ + var $_inclusion_depth = 0; + + /** + * for different compiled templates + * + * @var string + */ + var $_compile_id = null; + + /** + * text in URL to enable debug mode + * + * @var string + */ + var $_smarty_debug_id = 'SMARTY_DEBUG'; + + /** + * debugging information for debug console + * + * @var array + */ + var $_smarty_debug_info = array(); + + /** + * info that makes up a cache file + * + * @var array + */ + var $_cache_info = array(); + + /** + * default file permissions + * + * @var integer + */ + var $_file_perms = 0644; + + /** + * default dir permissions + * + * @var integer + */ + var $_dir_perms = 0771; + + /** + * registered objects + * + * @var array + */ + var $_reg_objects = array(); + + /** + * table keeping track of plugins + * + * @var array + */ + var $_plugins = array( + 'modifier' => array(), + 'function' => array(), + 'block' => array(), + 'compiler' => array(), + 'prefilter' => array(), + 'postfilter' => array(), + 'outputfilter' => array(), + 'resource' => array(), + 'insert' => array()); + + + /** + * cache serials + * + * @var array + */ + var $_cache_serials = array(); + + /** + * name of optional cache include file + * + * @var string + */ + var $_cache_include = null; + + /** + * indicate if the current code is used in a compiled + * include + * + * @var string + */ + var $_cache_including = false; + + /**#@-*/ + /** + * The class constructor. + */ + function Smarty() + { + $this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] + : @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']); + } + + /** + * assigns values to template variables + * + * @param array|string $tpl_var the template variable name(s) + * @param mixed $value the value to assign + */ + function assign($tpl_var, $value = null) + { + if (is_array($tpl_var)){ + foreach ($tpl_var as $key => $val) { + if ($key != '') { + $this->_tpl_vars[$key] = $val; + } + } + } else { + if ($tpl_var != '') + $this->_tpl_vars[$tpl_var] = $value; + } + } + + /** + * assigns values to template variables by reference + * + * @param string $tpl_var the template variable name + * @param mixed $value the referenced value to assign + */ + function assign_by_ref($tpl_var, &$value) + { + if ($tpl_var != '') + $this->_tpl_vars[$tpl_var] = &$value; + } + + /** + * appends values to template variables + * + * @param array|string $tpl_var the template variable name(s) + * @param mixed $value the value to append + */ + function append($tpl_var, $value=null, $merge=false) + { + if (is_array($tpl_var)) { + // $tpl_var is an array, ignore $value + foreach ($tpl_var as $_key => $_val) { + if ($_key != '') { + if(!@is_array($this->_tpl_vars[$_key])) { + settype($this->_tpl_vars[$_key],'array'); + } + if($merge && is_array($_val)) { + foreach($_val as $_mkey => $_mval) { + $this->_tpl_vars[$_key][$_mkey] = $_mval; + } + } else { + $this->_tpl_vars[$_key][] = $_val; + } + } + } + } else { + if ($tpl_var != '' && isset($value)) { + if(!@is_array($this->_tpl_vars[$tpl_var])) { + settype($this->_tpl_vars[$tpl_var],'array'); + } + if($merge && is_array($value)) { + foreach($value as $_mkey => $_mval) { + $this->_tpl_vars[$tpl_var][$_mkey] = $_mval; + } + } else { + $this->_tpl_vars[$tpl_var][] = $value; + } + } + } + } + + /** + * appends values to template variables by reference + * + * @param string $tpl_var the template variable name + * @param mixed $value the referenced value to append + */ + function append_by_ref($tpl_var, &$value, $merge=false) + { + if ($tpl_var != '' && isset($value)) { + if(!@is_array($this->_tpl_vars[$tpl_var])) { + settype($this->_tpl_vars[$tpl_var],'array'); + } + if ($merge && is_array($value)) { + foreach($value as $_key => $_val) { + $this->_tpl_vars[$tpl_var][$_key] = &$value[$_key]; + } + } else { + $this->_tpl_vars[$tpl_var][] = &$value; + } + } + } + + + /** + * clear the given assigned template variable. + * + * @param string $tpl_var the template variable to clear + */ + function clear_assign($tpl_var) + { + if (is_array($tpl_var)) + foreach ($tpl_var as $curr_var) + unset($this->_tpl_vars[$curr_var]); + else + unset($this->_tpl_vars[$tpl_var]); + } + + + /** + * Registers custom function to be used in templates + * + * @param string $function the name of the template function + * @param string $function_impl the name of the PHP function to register + */ + function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null) + { + $this->_plugins['function'][$function] = + array($function_impl, null, null, false, $cacheable, $cache_attrs); + + } + + /** + * Unregisters custom function + * + * @param string $function name of template function + */ + function unregister_function($function) + { + unset($this->_plugins['function'][$function]); + } + + /** + * Registers object to be used in templates + * + * @param string $object name of template object + * @param object &$object_impl the referenced PHP object to register + * @param null|array $allowed list of allowed methods (empty = all) + * @param boolean $smarty_args smarty argument format, else traditional + * @param null|array $block_functs list of methods that are block format + */ + function register_object($object, &$object_impl, $allowed = array(), $smarty_args = true, $block_methods = array()) + { + settype($allowed, 'array'); + settype($smarty_args, 'boolean'); + $this->_reg_objects[$object] = + array(&$object_impl, $allowed, $smarty_args, $block_methods); + } + + /** + * Unregisters object + * + * @param string $object name of template object + */ + function unregister_object($object) + { + unset($this->_reg_objects[$object]); + } + + + /** + * Registers block function to be used in templates + * + * @param string $block name of template block + * @param string $block_impl PHP function to register + */ + function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null) + { + $this->_plugins['block'][$block] = + array($block_impl, null, null, false, $cacheable, $cache_attrs); + } + + /** + * Unregisters block function + * + * @param string $block name of template function + */ + function unregister_block($block) + { + unset($this->_plugins['block'][$block]); + } + + /** + * Registers compiler function + * + * @param string $function name of template function + * @param string $function_impl name of PHP function to register + */ + function register_compiler_function($function, $function_impl, $cacheable=true) + { + $this->_plugins['compiler'][$function] = + array($function_impl, null, null, false, $cacheable); + } + + /** + * Unregisters compiler function + * + * @param string $function name of template function + */ + function unregister_compiler_function($function) + { + unset($this->_plugins['compiler'][$function]); + } + + /** + * Registers modifier to be used in templates + * + * @param string $modifier name of template modifier + * @param string $modifier_impl name of PHP function to register + */ + function register_modifier($modifier, $modifier_impl) + { + $this->_plugins['modifier'][$modifier] = + array($modifier_impl, null, null, false); + } + + /** + * Unregisters modifier + * + * @param string $modifier name of template modifier + */ + function unregister_modifier($modifier) + { + unset($this->_plugins['modifier'][$modifier]); + } + + /** + * Registers a resource to fetch a template + * + * @param string $type name of resource + * @param array $functions array of functions to handle resource + */ + function register_resource($type, $functions) + { + if (count($functions)==4) { + $this->_plugins['resource'][$type] = + array($functions, false); + + } elseif (count($functions)==5) { + $this->_plugins['resource'][$type] = + array(array(array(&$functions[0], $functions[1]) + ,array(&$functions[0], $functions[2]) + ,array(&$functions[0], $functions[3]) + ,array(&$functions[0], $functions[4])) + ,false); + + } else { + $this->trigger_error("malformed function-list for '$type' in register_resource"); + + } + } + + /** + * Unregisters a resource + * + * @param string $type name of resource + */ + function unregister_resource($type) + { + unset($this->_plugins['resource'][$type]); + } + + /** + * Registers a prefilter function to apply + * to a template before compiling + * + * @param callback $function + */ + function register_prefilter($function) + { + $this->_plugins['prefilter'][$this->_get_filter_name($function)] + = array($function, null, null, false); + } + + /** + * Unregisters a prefilter function + * + * @param callback $function + */ + function unregister_prefilter($function) + { + unset($this->_plugins['prefilter'][$this->_get_filter_name($function)]); + } + + /** + * Registers a postfilter function to apply + * to a compiled template after compilation + * + * @param callback $function + */ + function register_postfilter($function) + { + $this->_plugins['postfilter'][$this->_get_filter_name($function)] + = array($function, null, null, false); + } + + /** + * Unregisters a postfilter function + * + * @param callback $function + */ + function unregister_postfilter($function) + { + unset($this->_plugins['postfilter'][$this->_get_filter_name($function)]); + } + + /** + * Registers an output filter function to apply + * to a template output + * + * @param callback $function + */ + function register_outputfilter($function) + { + $this->_plugins['outputfilter'][$this->_get_filter_name($function)] + = array($function, null, null, false); + } + + /** + * Unregisters an outputfilter function + * + * @param callback $function + */ + function unregister_outputfilter($function) + { + unset($this->_plugins['outputfilter'][$this->_get_filter_name($function)]); + } + + /** + * load a filter of specified type and name + * + * @param string $type filter type + * @param string $name filter name + */ + function load_filter($type, $name) + { + switch ($type) { + case 'output': + $_params = array('plugins' => array(array($type . 'filter', $name, null, null, false))); + require_once(SMARTY_CORE_DIR . 'core.load_plugins.php'); + smarty_core_load_plugins($_params, $this); + break; + + case 'pre': + case 'post': + if (!isset($this->_plugins[$type . 'filter'][$name])) + $this->_plugins[$type . 'filter'][$name] = false; + break; + } + } + + /** + * clear cached content for the given template and cache id + * + * @param string $tpl_file name of template file + * @param string $cache_id name of cache_id + * @param string $compile_id name of compile_id + * @param string $exp_time expiration time + * @return boolean + */ + function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null) + { + + if (!isset($compile_id)) + $compile_id = $this->compile_id; + + if (!isset($tpl_file)) + $compile_id = null; + + $_auto_id = $this->_get_auto_id($cache_id, $compile_id); + + if (!empty($this->cache_handler_func)) { + return call_user_func_array($this->cache_handler_func, + array('clear', &$this, &$dummy, $tpl_file, $cache_id, $compile_id, $exp_time)); + } else { + $_params = array('auto_base' => $this->cache_dir, + 'auto_source' => $tpl_file, + 'auto_id' => $_auto_id, + 'exp_time' => $exp_time); + require_once(SMARTY_CORE_DIR . 'core.rm_auto.php'); + return smarty_core_rm_auto($_params, $this); + } + + } + + + /** + * clear the entire contents of cache (all templates) + * + * @param string $exp_time expire time + * @return boolean results of {@link smarty_core_rm_auto()} + */ + function clear_all_cache($exp_time = null) + { + return $this->clear_cache(null, null, null, $exp_time); + } + + + /** + * test to see if valid cache exists for this template + * + * @param string $tpl_file name of template file + * @param string $cache_id + * @param string $compile_id + * @return string|false results of {@link _read_cache_file()} + */ + function is_cached($tpl_file, $cache_id = null, $compile_id = null) + { + if (!$this->caching) + return false; + + if (!isset($compile_id)) + $compile_id = $this->compile_id; + + $_params = array( + 'tpl_file' => $tpl_file, + 'cache_id' => $cache_id, + 'compile_id' => $compile_id + ); + require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php'); + return smarty_core_read_cache_file($_params, $this); + } + + + /** + * clear all the assigned template variables. + * + */ + function clear_all_assign() + { + $this->_tpl_vars = array(); + } + + /** + * clears compiled version of specified template resource, + * or all compiled template files if one is not specified. + * This function is for advanced use only, not normally needed. + * + * @param string $tpl_file + * @param string $compile_id + * @param string $exp_time + * @return boolean results of {@link smarty_core_rm_auto()} + */ + function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null) + { + if (!isset($compile_id)) { + $compile_id = $this->compile_id; + } + $_params = array('auto_base' => $this->compile_dir, + 'auto_source' => $tpl_file, + 'auto_id' => $compile_id, + 'exp_time' => $exp_time, + 'extensions' => array('.inc', '.php')); + require_once(SMARTY_CORE_DIR . 'core.rm_auto.php'); + return smarty_core_rm_auto($_params, $this); + } + + /** + * Checks whether requested template exists. + * + * @param string $tpl_file + * @return boolean + */ + function template_exists($tpl_file) + { + $_params = array('resource_name' => $tpl_file, 'quiet'=>true, 'get_source'=>false); + return $this->_fetch_resource_info($_params); + } + + /** + * Returns an array containing template variables + * + * @param string $name + * @param string $type + * @return array + */ + function &get_template_vars($name=null) + { + if(!isset($name)) { + return $this->_tpl_vars; + } elseif(isset($this->_tpl_vars[$name])) { + return $this->_tpl_vars[$name]; + } else { + // var non-existant, return valid reference + $_tmp = null; + return $_tmp; + } + } + + /** + * Returns an array containing config variables + * + * @param string $name + * @param string $type + * @return array + */ + function &get_config_vars($name=null) + { + if(!isset($name) && is_array($this->_config[0])) { + return $this->_config[0]['vars']; + } else if(isset($this->_config[0]['vars'][$name])) { + return $this->_config[0]['vars'][$name]; + } else { + // var non-existant, return valid reference + $_tmp = null; + return $_tmp; + } + } + + /** + * trigger Smarty error + * + * @param string $error_msg + * @param integer $error_type + */ + function trigger_error($error_msg, $error_type = E_USER_WARNING) + { + trigger_error("Smarty error: $error_msg", $error_type); + } + + + /** + * executes & displays the template results + * + * @param string $resource_name + * @param string $cache_id + * @param string $compile_id + */ + function display($resource_name, $cache_id = null, $compile_id = null) + { + $this->fetch($resource_name, $cache_id, $compile_id, true); + } + + /** + * executes & returns or displays the template results + * + * @param string $resource_name + * @param string $cache_id + * @param string $compile_id + * @param boolean $display + */ + function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false) + { + static $_cache_info = array(); + + $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting) + ? $this->error_reporting : error_reporting() & ~E_NOTICE); + + if (!$this->debugging && $this->debugging_ctrl == 'URL') { + $_query_string = $this->request_use_auto_globals ? $_SERVER['QUERY_STRING'] : $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING']; + if (@strstr($_query_string, $this->_smarty_debug_id)) { + if (@strstr($_query_string, $this->_smarty_debug_id . '=on')) { + // enable debugging for this browser session + @setcookie('SMARTY_DEBUG', true); + $this->debugging = true; + } elseif (@strstr($_query_string, $this->_smarty_debug_id . '=off')) { + // disable debugging for this browser session + @setcookie('SMARTY_DEBUG', false); + $this->debugging = false; + } else { + // enable debugging for this page + $this->debugging = true; + } + } else { + $this->debugging = (bool)($this->request_use_auto_globals ? @$_COOKIE['SMARTY_DEBUG'] : @$GLOBALS['HTTP_COOKIE_VARS']['SMARTY_DEBUG']); + } + } + + if ($this->debugging) { + // capture time for debugging info + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $_debug_start_time = smarty_core_get_microtime($_params, $this); + $this->_smarty_debug_info[] = array('type' => 'template', + 'filename' => $resource_name, + 'depth' => 0); + $_included_tpls_idx = count($this->_smarty_debug_info) - 1; + } + + if (!isset($compile_id)) { + $compile_id = $this->compile_id; + } + + $this->_compile_id = $compile_id; + $this->_inclusion_depth = 0; + + if ($this->caching) { + // save old cache_info, initialize cache_info + array_push($_cache_info, $this->_cache_info); + $this->_cache_info = array(); + $_params = array( + 'tpl_file' => $resource_name, + 'cache_id' => $cache_id, + 'compile_id' => $compile_id, + 'results' => null + ); + require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php'); + if (smarty_core_read_cache_file($_params, $this)) { + $_smarty_results = $_params['results']; + if (!empty($this->_cache_info['insert_tags'])) { + $_params = array('plugins' => $this->_cache_info['insert_tags']); + require_once(SMARTY_CORE_DIR . 'core.load_plugins.php'); + smarty_core_load_plugins($_params, $this); + $_params = array('results' => $_smarty_results); + require_once(SMARTY_CORE_DIR . 'core.process_cached_inserts.php'); + $_smarty_results = smarty_core_process_cached_inserts($_params, $this); + } + if (!empty($this->_cache_info['cache_serials'])) { + $_params = array('results' => $_smarty_results); + require_once(SMARTY_CORE_DIR . 'core.process_compiled_include.php'); + $_smarty_results = smarty_core_process_compiled_include($_params, $this); + } + + + if ($display) { + if ($this->debugging) + { + // capture time for debugging info + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $_debug_start_time; + require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php'); + $_smarty_results .= smarty_core_display_debug_console($_params, $this); + } + if ($this->cache_modified_check) { + $_server_vars = ($this->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS']; + $_last_modified_date = @substr($_server_vars['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_server_vars['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3); + $_gmt_mtime = gmdate('D, d M Y H:i:s', $this->_cache_info['timestamp']).' GMT'; + if (@count($this->_cache_info['insert_tags']) == 0 + && !$this->_cache_serials + && $_gmt_mtime == $_last_modified_date) { + if (php_sapi_name()=='cgi') + header('Status: 304 Not Modified'); + else + header('HTTP/1.1 304 Not Modified'); + + } else { + header('Last-Modified: '.$_gmt_mtime); + echo $_smarty_results; + } + } else { + echo $_smarty_results; + } + error_reporting($_smarty_old_error_level); + // restore initial cache_info + $this->_cache_info = array_pop($_cache_info); + return true; + } else { + error_reporting($_smarty_old_error_level); + // restore initial cache_info + $this->_cache_info = array_pop($_cache_info); + return $_smarty_results; + } + } else { + $this->_cache_info['template'][$resource_name] = true; + if ($this->cache_modified_check && $display) { + header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); + } + } + } + + // load filters that are marked as autoload + if (count($this->autoload_filters)) { + foreach ($this->autoload_filters as $_filter_type => $_filters) { + foreach ($_filters as $_filter) { + $this->load_filter($_filter_type, $_filter); + } + } + } + + $_smarty_compile_path = $this->_get_compile_path($resource_name); + + // if we just need to display the results, don't perform output + // buffering - for speed + $_cache_including = $this->_cache_including; + $this->_cache_including = false; + if ($display && !$this->caching && count($this->_plugins['outputfilter']) == 0) { + if ($this->_is_compiled($resource_name, $_smarty_compile_path) + || $this->_compile_resource($resource_name, $_smarty_compile_path)) + { + include($_smarty_compile_path); + } + } else { + ob_start(); + if ($this->_is_compiled($resource_name, $_smarty_compile_path) + || $this->_compile_resource($resource_name, $_smarty_compile_path)) + { + include($_smarty_compile_path); + } + $_smarty_results = ob_get_contents(); + ob_end_clean(); + + foreach ((array)$this->_plugins['outputfilter'] as $_output_filter) { + $_smarty_results = call_user_func_array($_output_filter[0], array($_smarty_results, &$this)); + } + } + + if ($this->caching) { + $_params = array('tpl_file' => $resource_name, + 'cache_id' => $cache_id, + 'compile_id' => $compile_id, + 'results' => $_smarty_results); + require_once(SMARTY_CORE_DIR . 'core.write_cache_file.php'); + smarty_core_write_cache_file($_params, $this); + require_once(SMARTY_CORE_DIR . 'core.process_cached_inserts.php'); + $_smarty_results = smarty_core_process_cached_inserts($_params, $this); + + if ($this->_cache_serials) { + // strip nocache-tags from output + $_smarty_results = preg_replace('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!s' + ,'' + ,$_smarty_results); + } + // restore initial cache_info + $this->_cache_info = array_pop($_cache_info); + } + $this->_cache_including = $_cache_including; + + if ($display) { + if (isset($_smarty_results)) { echo $_smarty_results; } + if ($this->debugging) { + // capture time for debugging info + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = (smarty_core_get_microtime($_params, $this) - $_debug_start_time); + require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php'); + echo smarty_core_display_debug_console($_params, $this); + } + error_reporting($_smarty_old_error_level); + return; + } else { + error_reporting($_smarty_old_error_level); + if (isset($_smarty_results)) { return $_smarty_results; } + } + } + + /** + * load configuration values + * + * @param string $file + * @param string $section + * @param string $scope + */ + function config_load($file, $section = null, $scope = 'global') + { + require_once($this->_get_plugin_filepath('function', 'config_load')); + smarty_function_config_load(array('file' => $file, 'section' => $section, 'scope' => $scope), $this); + } + + /** + * return a reference to a registered object + * + * @param string $name + * @return object + */ + function &get_registered_object($name) { + if (!isset($this->_reg_objects[$name])) + $this->_trigger_fatal_error("'$name' is not a registered object"); + + if (!is_object($this->_reg_objects[$name][0])) + $this->_trigger_fatal_error("registered '$name' is not an object"); + + return $this->_reg_objects[$name][0]; + } + + /** + * clear configuration values + * + * @param string $var + */ + function clear_config($var = null) + { + if(!isset($var)) { + // clear all values + $this->_config = array(array('vars' => array(), + 'files' => array())); + } else { + unset($this->_config[0]['vars'][$var]); + } + } + + /** + * get filepath of requested plugin + * + * @param string $type + * @param string $name + * @return string|false + */ + function _get_plugin_filepath($type, $name) + { + $_params = array('type' => $type, 'name' => $name); + require_once(SMARTY_CORE_DIR . 'core.assemble_plugin_filepath.php'); + return smarty_core_assemble_plugin_filepath($_params, $this); + } + + /** + * test if resource needs compiling + * + * @param string $resource_name + * @param string $compile_path + * @return boolean + */ + function _is_compiled($resource_name, $compile_path) + { + if (!$this->force_compile && file_exists($compile_path)) { + if (!$this->compile_check) { + // no need to check compiled file + return true; + } else { + // get file source and timestamp + $_params = array('resource_name' => $resource_name, 'get_source'=>false); + if (!$this->_fetch_resource_info($_params)) { + return false; + } + if ($_params['resource_timestamp'] <= filemtime($compile_path)) { + // template not expired, no recompile + return true; + } else { + // compile template + return false; + } + } + } else { + // compiled template does not exist, or forced compile + return false; + } + } + + /** + * compile the template + * + * @param string $resource_name + * @param string $compile_path + * @return boolean + */ + function _compile_resource($resource_name, $compile_path) + { + + $_params = array('resource_name' => $resource_name); + if (!$this->_fetch_resource_info($_params)) { + return false; + } + + $_source_content = $_params['source_content']; + $_cache_include = substr($compile_path, 0, -4).'.inc'; + + if ($this->_compile_source($resource_name, $_source_content, $_compiled_content, $_cache_include)) { + // if a _cache_serial was set, we also have to write an include-file: + if ($this->_cache_include_info) { + require_once(SMARTY_CORE_DIR . 'core.write_compiled_include.php'); + smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content'=>$_compiled_content, 'resource_name'=>$resource_name)), $this); + } + + $_params = array('compile_path'=>$compile_path, 'compiled_content' => $_compiled_content); + require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php'); + smarty_core_write_compiled_resource($_params, $this); + + return true; + } else { + return false; + } + + } + + /** + * compile the given source + * + * @param string $resource_name + * @param string $source_content + * @param string $compiled_content + * @return boolean + */ + function _compile_source($resource_name, &$source_content, &$compiled_content, $cache_include_path=null) + { + if (file_exists(SMARTY_DIR . $this->compiler_file)) { + require_once(SMARTY_DIR . $this->compiler_file); + } else { + // use include_path + require_once($this->compiler_file); + } + + + $smarty_compiler = new $this->compiler_class; + + $smarty_compiler->template_dir = $this->template_dir; + $smarty_compiler->compile_dir = $this->compile_dir; + $smarty_compiler->plugins_dir = $this->plugins_dir; + $smarty_compiler->config_dir = $this->config_dir; + $smarty_compiler->force_compile = $this->force_compile; + $smarty_compiler->caching = $this->caching; + $smarty_compiler->php_handling = $this->php_handling; + $smarty_compiler->left_delimiter = $this->left_delimiter; + $smarty_compiler->right_delimiter = $this->right_delimiter; + $smarty_compiler->_version = $this->_version; + $smarty_compiler->security = $this->security; + $smarty_compiler->secure_dir = $this->secure_dir; + $smarty_compiler->security_settings = $this->security_settings; + $smarty_compiler->trusted_dir = $this->trusted_dir; + $smarty_compiler->use_sub_dirs = $this->use_sub_dirs; + $smarty_compiler->_reg_objects = &$this->_reg_objects; + $smarty_compiler->_plugins = &$this->_plugins; + $smarty_compiler->_tpl_vars = &$this->_tpl_vars; + $smarty_compiler->default_modifiers = $this->default_modifiers; + $smarty_compiler->compile_id = $this->_compile_id; + $smarty_compiler->_config = $this->_config; + $smarty_compiler->request_use_auto_globals = $this->request_use_auto_globals; + + if (isset($cache_include_path) && isset($this->_cache_serials[$cache_include_path])) { + $smarty_compiler->_cache_serial = $this->_cache_serials[$cache_include_path]; + } + $smarty_compiler->_cache_include = $cache_include_path; + + + $_results = $smarty_compiler->_compile_file($resource_name, $source_content, $compiled_content); + + if ($smarty_compiler->_cache_serial) { + $this->_cache_include_info = array( + 'cache_serial'=>$smarty_compiler->_cache_serial + ,'plugins_code'=>$smarty_compiler->_plugins_code + ,'include_file_path' => $cache_include_path); + + } else { + $this->_cache_include_info = null; + + } + + return $_results; + } + + /** + * Get the compile path for this resource + * + * @param string $resource_name + * @return string results of {@link _get_auto_filename()} + */ + function _get_compile_path($resource_name) + { + return $this->_get_auto_filename($this->compile_dir, $resource_name, + $this->_compile_id) . '.php'; + } + + /** + * fetch the template info. Gets timestamp, and source + * if get_source is true + * + * sets $source_content to the source of the template, and + * $resource_timestamp to its time stamp + * @param string $resource_name + * @param string $source_content + * @param integer $resource_timestamp + * @param boolean $get_source + * @param boolean $quiet + * @return boolean + */ + + function _fetch_resource_info(&$params) + { + if(!isset($params['get_source'])) { $params['get_source'] = true; } + if(!isset($params['quiet'])) { $params['quiet'] = false; } + + $_return = false; + $_params = array('resource_name' => $params['resource_name']) ; + if (isset($params['resource_base_path'])) + $_params['resource_base_path'] = $params['resource_base_path']; + else + $_params['resource_base_path'] = $this->template_dir; + + if ($this->_parse_resource_name($_params)) { + $_resource_type = $_params['resource_type']; + $_resource_name = $_params['resource_name']; + switch ($_resource_type) { + case 'file': + if ($params['get_source']) { + $params['source_content'] = $this->_read_file($_resource_name); + } + $params['resource_timestamp'] = filemtime($_resource_name); + $_return = is_file($_resource_name); + break; + + default: + // call resource functions to fetch the template source and timestamp + if ($params['get_source']) { + $_source_return = isset($this->_plugins['resource'][$_resource_type]) && + call_user_func_array($this->_plugins['resource'][$_resource_type][0][0], + array($_resource_name, &$params['source_content'], &$this)); + } else { + $_source_return = true; + } + + $_timestamp_return = isset($this->_plugins['resource'][$_resource_type]) && + call_user_func_array($this->_plugins['resource'][$_resource_type][0][1], + array($_resource_name, &$params['resource_timestamp'], &$this)); + + $_return = $_source_return && $_timestamp_return; + break; + } + } + + if (!$_return) { + // see if we can get a template with the default template handler + if (!empty($this->default_template_handler_func)) { + if (!is_callable($this->default_template_handler_func)) { + $this->trigger_error("default template handler function \"$this->default_template_handler_func\" doesn't exist."); + } else { + $_return = call_user_func_array( + $this->default_template_handler_func, + array($_params['resource_type'], $_params['resource_name'], &$params['source_content'], &$params['resource_timestamp'], &$this)); + } + } + } + + if (!$_return) { + if (!$params['quiet']) { + $this->trigger_error('unable to read resource: "' . $params['resource_name'] . '"'); + } + } else if ($_return && $this->security) { + require_once(SMARTY_CORE_DIR . 'core.is_secure.php'); + if (!smarty_core_is_secure($_params, $this)) { + if (!$params['quiet']) + $this->trigger_error('(secure mode) accessing "' . $params['resource_name'] . '" is not allowed'); + $params['source_content'] = null; + $params['resource_timestamp'] = null; + return false; + } + } + return $_return; + } + + + /** + * parse out the type and name from the resource + * + * @param string $resource_base_path + * @param string $resource_name + * @param string $resource_type + * @param string $resource_name + * @return boolean + */ + + function _parse_resource_name(&$params) + { + + // split tpl_path by the first colon + $_resource_name_parts = explode(':', $params['resource_name'], 2); + + if (count($_resource_name_parts) == 1) { + // no resource type given + $params['resource_type'] = $this->default_resource_type; + $params['resource_name'] = $_resource_name_parts[0]; + } else { + if(strlen($_resource_name_parts[0]) == 1) { + // 1 char is not resource type, but part of filepath + $params['resource_type'] = $this->default_resource_type; + $params['resource_name'] = $params['resource_name']; + } else { + $params['resource_type'] = $_resource_name_parts[0]; + $params['resource_name'] = $_resource_name_parts[1]; + } + } + + if ($params['resource_type'] == 'file') { + if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $params['resource_name'])) { + // relative pathname to $params['resource_base_path'] + // use the first directory where the file is found + foreach ((array)$params['resource_base_path'] as $_curr_path) { + $_fullpath = $_curr_path . DIRECTORY_SEPARATOR . $params['resource_name']; + if (file_exists($_fullpath) && is_file($_fullpath)) { + $params['resource_name'] = $_fullpath; + return true; + } + // didn't find the file, try include_path + $_params = array('file_path' => $_fullpath); + require_once(SMARTY_CORE_DIR . 'core.get_include_path.php'); + if(smarty_core_get_include_path($_params, $this)) { + $params['resource_name'] = $_params['new_file_path']; + return true; + } + } + return false; + } else { + /* absolute path */ + return file_exists($params['resource_name']); + } + } elseif (empty($this->_plugins['resource'][$params['resource_type']])) { + $_params = array('type' => $params['resource_type']); + require_once(SMARTY_CORE_DIR . 'core.load_resource_plugin.php'); + smarty_core_load_resource_plugin($_params, $this); + } + + return true; + } + + + /** + * Handle modifiers + * + * @param string|null $modifier_name + * @param array|null $map_array + * @return string result of modifiers + */ + function _run_mod_handler() + { + $_args = func_get_args(); + list($_modifier_name, $_map_array) = array_splice($_args, 0, 2); + list($_func_name, $_tpl_file, $_tpl_line) = + $this->_plugins['modifier'][$_modifier_name]; + + $_var = $_args[0]; + foreach ($_var as $_key => $_val) { + $_args[0] = $_val; + $_var[$_key] = call_user_func_array($_func_name, $_args); + } + return $_var; + } + + /** + * Remove starting and ending quotes from the string + * + * @param string $string + * @return string + */ + function _dequote($string) + { + if ((substr($string, 0, 1) == "'" || substr($string, 0, 1) == '"') && + substr($string, -1) == substr($string, 0, 1)) + return substr($string, 1, -1); + else + return $string; + } + + + /** + * read in a file + * + * @param string $filename + * @return string + */ + function _read_file($filename) + { + if ( file_exists($filename) && ($fd = @fopen($filename, 'rb')) ) { + $contents = ''; + while (!feof($fd)) { + $contents .= fread($fd, 8192); + } + fclose($fd); + return $contents; + } else { + return false; + } + } + + /** + * get a concrete filename for automagically created content + * + * @param string $auto_base + * @param string $auto_source + * @param string $auto_id + * @return string + * @staticvar string|null + * @staticvar string|null + */ + function _get_auto_filename($auto_base, $auto_source = null, $auto_id = null) + { + $_compile_dir_sep = $this->use_sub_dirs ? DIRECTORY_SEPARATOR : '^'; + $_return = $auto_base . DIRECTORY_SEPARATOR; + + if(isset($auto_id)) { + // make auto_id safe for directory names + $auto_id = str_replace('%7C',$_compile_dir_sep,(urlencode($auto_id))); + // split into separate directories + $_return .= $auto_id . $_compile_dir_sep; + } + + if(isset($auto_source)) { + // make source name safe for filename + $_filename = urlencode(basename($auto_source)); + $_crc32 = sprintf('%08X', crc32($auto_source)); + // prepend %% to avoid name conflicts with + // with $params['auto_id'] names + $_crc32 = substr($_crc32, 0, 2) . $_compile_dir_sep . + substr($_crc32, 0, 3) . $_compile_dir_sep . $_crc32; + $_return .= '%%' . $_crc32 . '%%' . $_filename; + } + + return $_return; + } + + /** + * unlink a file, possibly using expiration time + * + * @param string $resource + * @param integer $exp_time + */ + function _unlink($resource, $exp_time = null) + { + if(isset($exp_time)) { + if(time() - @filemtime($resource) >= $exp_time) { + return @unlink($resource); + } + } else { + return @unlink($resource); + } + } + + /** + * returns an auto_id for auto-file-functions + * + * @param string $cache_id + * @param string $compile_id + * @return string|null + */ + function _get_auto_id($cache_id=null, $compile_id=null) { + if (isset($cache_id)) + return (isset($compile_id)) ? $cache_id . '|' . $compile_id : $cache_id; + elseif(isset($compile_id)) + return $compile_id; + else + return null; + } + + /** + * trigger Smarty plugin error + * + * @param string $error_msg + * @param string $tpl_file + * @param integer $tpl_line + * @param string $file + * @param integer $line + * @param integer $error_type + */ + function _trigger_fatal_error($error_msg, $tpl_file = null, $tpl_line = null, + $file = null, $line = null, $error_type = E_USER_ERROR) + { + if(isset($file) && isset($line)) { + $info = ' ('.basename($file).", line $line)"; + } else { + $info = ''; + } + if (isset($tpl_line) && isset($tpl_file)) { + $this->trigger_error('[in ' . $tpl_file . ' line ' . $tpl_line . "]: $error_msg$info", $error_type); + } else { + $this->trigger_error($error_msg . $info, $error_type); + } + } + + + /** + * callback function for preg_replace, to call a non-cacheable block + * @return string + */ + function _process_compiled_include_callback($match) { + $_func = '_smarty_tplfunc_'.$match[2].'_'.$match[3]; + ob_start(); + $_func($this); + $_ret = ob_get_contents(); + ob_end_clean(); + return $_ret; + } + + + /** + * called for included templates + * + * @param string $_smarty_include_tpl_file + * @param string $_smarty_include_vars + */ + + // $_smarty_include_tpl_file, $_smarty_include_vars + + function _smarty_include($params) + { + if ($this->debugging) { + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $debug_start_time = smarty_core_get_microtime($_params, $this); + $this->_smarty_debug_info[] = array('type' => 'template', + 'filename' => $params['smarty_include_tpl_file'], + 'depth' => ++$this->_inclusion_depth); + $included_tpls_idx = count($this->_smarty_debug_info) - 1; + } + + $this->_tpl_vars = array_merge($this->_tpl_vars, $params['smarty_include_vars']); + + // config vars are treated as local, so push a copy of the + // current ones onto the front of the stack + array_unshift($this->_config, $this->_config[0]); + + $_smarty_compile_path = $this->_get_compile_path($params['smarty_include_tpl_file']); + + + if ($this->_is_compiled($params['smarty_include_tpl_file'], $_smarty_compile_path) + || $this->_compile_resource($params['smarty_include_tpl_file'], $_smarty_compile_path)) + { + include($_smarty_compile_path); + } + + // pop the local vars off the front of the stack + array_shift($this->_config); + + $this->_inclusion_depth--; + + if ($this->debugging) { + // capture time for debugging info + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $debug_start_time; + } + + if ($this->caching) { + $this->_cache_info['template'][$params['smarty_include_tpl_file']] = true; + } + } + + + /** + * get or set an array of cached attributes for function that is + * not cacheable + * @return array + */ + function &_smarty_cache_attrs($cache_serial, $count) { + $_cache_attrs =& $this->_cache_info['cache_attrs'][$cache_serial][$count]; + + if ($this->_cache_including) { + /* return next set of cache_attrs */ + $_return = current($_cache_attrs); + next($_cache_attrs); + return $_return; + + } else { + /* add a reference to a new set of cache_attrs */ + $_cache_attrs[] = array(); + return $_cache_attrs[count($_cache_attrs)-1]; + + } + + } + + + /** + * wrapper for include() retaining $this + * @return mixed + */ + function _include($filename, $once=false, $params=null) + { + if ($once) { + return include_once($filename); + } else { + return include($filename); + } + } + + + /** + * wrapper for eval() retaining $this + * @return mixed + */ + function _eval($code, $params=null) + { + return eval($code); + } + + /** + * Extracts the filter name from the given callback + * + * @param callback $function + * @return string + */ + function _get_filter_name($function) + { + if (is_array($function)) { + $_class_name = (is_object($function[0]) ? + get_class($function[0]) : $function[0]); + return $_class_name . '_' . $function[1]; + } + else { + return $function; + } + } + + /**#@-*/ + +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/Smarty_Compiler.class.php b/onyx2/modules/templates/smarty/Smarty_Compiler.class.php new file mode 100644 index 0000000..374ba3d --- /dev/null +++ b/onyx2/modules/templates/smarty/Smarty_Compiler.class.php @@ -0,0 +1,2351 @@ + + * @author Andrei Zmievski + * @version 2.6.22 + * @copyright 2001-2005 New Digital Group, Inc. + * @package Smarty + */ + +/* $Id: Smarty_Compiler.class.php 2966 2008-12-08 15:10:03Z monte.ohrt $ */ + +/** + * Template compiling class + * @package Smarty + */ +class Smarty_Compiler extends Smarty { + + // internal vars + /**#@+ + * @access private + */ + var $_folded_blocks = array(); // keeps folded template blocks + var $_current_file = null; // the current template being compiled + var $_current_line_no = 1; // line number for error messages + var $_capture_stack = array(); // keeps track of nested capture buffers + var $_plugin_info = array(); // keeps track of plugins to load + var $_init_smarty_vars = false; + var $_permitted_tokens = array('true','false','yes','no','on','off','null'); + var $_db_qstr_regexp = null; // regexps are setup in the constructor + var $_si_qstr_regexp = null; + var $_qstr_regexp = null; + var $_func_regexp = null; + var $_reg_obj_regexp = null; + var $_var_bracket_regexp = null; + var $_num_const_regexp = null; + var $_dvar_guts_regexp = null; + var $_dvar_regexp = null; + var $_cvar_regexp = null; + var $_svar_regexp = null; + var $_avar_regexp = null; + var $_mod_regexp = null; + var $_var_regexp = null; + var $_parenth_param_regexp = null; + var $_func_call_regexp = null; + var $_obj_ext_regexp = null; + var $_obj_start_regexp = null; + var $_obj_params_regexp = null; + var $_obj_call_regexp = null; + var $_cacheable_state = 0; + var $_cache_attrs_count = 0; + var $_nocache_count = 0; + var $_cache_serial = null; + var $_cache_include = null; + + var $_strip_depth = 0; + var $_additional_newline = "\n"; + + var $_phpversion = 0; + + + /**#@-*/ + /** + * The class constructor. + */ + function Smarty_Compiler() + { + $this->_phpversion = substr(phpversion(),0,1); + + // matches double quoted strings: + // "foobar" + // "foo\"bar" + $this->_db_qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"'; + + // matches single quoted strings: + // 'foobar' + // 'foo\'bar' + $this->_si_qstr_regexp = '\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\''; + + // matches single or double quoted strings + $this->_qstr_regexp = '(?:' . $this->_db_qstr_regexp . '|' . $this->_si_qstr_regexp . ')'; + + // matches bracket portion of vars + // [0] + // [foo] + // [$bar] + $this->_var_bracket_regexp = '\[\$?[\w\.]+\]'; + + // matches numerical constants + // 30 + // -12 + // 13.22 + $this->_num_const_regexp = '(?:\-?\d+(?:\.\d+)?)'; + + // matches $ vars (not objects): + // $foo + // $foo.bar + // $foo.bar.foobar + // $foo[0] + // $foo[$bar] + // $foo[5][blah] + // $foo[5].bar[$foobar][4] + $this->_dvar_math_regexp = '(?:[\+\*\/\%]|(?:-(?!>)))'; + $this->_dvar_math_var_regexp = '[\$\w\.\+\-\*\/\%\d\>\[\]]'; + $this->_dvar_guts_regexp = '\w+(?:' . $this->_var_bracket_regexp + . ')*(?:\.\$?\w+(?:' . $this->_var_bracket_regexp . ')*)*(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?'; + $this->_dvar_regexp = '\$' . $this->_dvar_guts_regexp; + + // matches config vars: + // #foo# + // #foobar123_foo# + $this->_cvar_regexp = '\#\w+\#'; + + // matches section vars: + // %foo.bar% + $this->_svar_regexp = '\%\w+\.\w+\%'; + + // matches all valid variables (no quotes, no modifiers) + $this->_avar_regexp = '(?:' . $this->_dvar_regexp . '|' + . $this->_cvar_regexp . '|' . $this->_svar_regexp . ')'; + + // matches valid variable syntax: + // $foo + // $foo + // #foo# + // #foo# + // "text" + // "text" + $this->_var_regexp = '(?:' . $this->_avar_regexp . '|' . $this->_qstr_regexp . ')'; + + // matches valid object call (one level of object nesting allowed in parameters): + // $foo->bar + // $foo->bar() + // $foo->bar("text") + // $foo->bar($foo, $bar, "text") + // $foo->bar($foo, "foo") + // $foo->bar->foo() + // $foo->bar->foo->bar() + // $foo->bar($foo->bar) + // $foo->bar($foo->bar()) + // $foo->bar($foo->bar($blah,$foo,44,"foo",$foo[0].bar)) + // $foo->getBar()->getFoo() + // $foo->getBar()->foo + $this->_obj_ext_regexp = '\->(?:\$?' . $this->_dvar_guts_regexp . ')'; + $this->_obj_restricted_param_regexp = '(?:' + . '(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')(?:' . $this->_obj_ext_regexp . '(?:\((?:(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')' + . '(?:\s*,\s*(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . '))*)?\))?)*)'; + + $this->_obj_single_param_regexp = '(?:\w+|' . $this->_obj_restricted_param_regexp . '(?:\s*,\s*(?:(?:\w+|' + . $this->_var_regexp . $this->_obj_restricted_param_regexp . ')))*)'; + + $this->_obj_params_regexp = '\((?:' . $this->_obj_single_param_regexp + . '(?:\s*,\s*' . $this->_obj_single_param_regexp . ')*)?\)'; + $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)'; + $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . ')?(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?)'; + + // matches valid modifier syntax: + // |foo + // |@foo + // |foo:"bar" + // |foo:$bar + // |foo:"bar":$foobar + // |foo|bar + // |foo:$foo->bar + $this->_mod_regexp = '(?:\|@?\w+(?::(?:\w+|' . $this->_num_const_regexp . '|' + . $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)'; + + // matches valid function name: + // foo123 + // _foo_bar + $this->_func_regexp = '[a-zA-Z_]\w*'; + + // matches valid registered object: + // foo->bar + $this->_reg_obj_regexp = '[a-zA-Z_]\w*->[a-zA-Z_]\w*'; + + // matches valid parameter values: + // true + // $foo + // $foo|bar + // #foo# + // #foo#|bar + // "text" + // "text"|bar + // $foo->bar + $this->_param_regexp = '(?:\s*(?:' . $this->_obj_call_regexp . '|' + . $this->_var_regexp . '|' . $this->_num_const_regexp . '|\w+)(?>' . $this->_mod_regexp . '*)\s*)'; + + // matches valid parenthesised function parameters: + // + // "text" + // $foo, $bar, "text" + // $foo|bar, "foo"|bar, $foo->bar($foo)|bar + $this->_parenth_param_regexp = '(?:\((?:\w+|' + . $this->_param_regexp . '(?:\s*,\s*(?:(?:\w+|' + . $this->_param_regexp . ')))*)?\))'; + + // matches valid function call: + // foo() + // foo_bar($foo) + // _foo_bar($foo,"bar") + // foo123($foo,$foo->bar(),"foo") + $this->_func_call_regexp = '(?:' . $this->_func_regexp . '\s*(?:' + . $this->_parenth_param_regexp . '))'; + } + + /** + * compile a resource + * + * sets $compiled_content to the compiled source + * @param string $resource_name + * @param string $source_content + * @param string $compiled_content + * @return true + */ + function _compile_file($resource_name, $source_content, &$compiled_content) + { + + if ($this->security) { + // do not allow php syntax to be executed unless specified + if ($this->php_handling == SMARTY_PHP_ALLOW && + !$this->security_settings['PHP_HANDLING']) { + $this->php_handling = SMARTY_PHP_PASSTHRU; + } + } + + $this->_load_filters(); + + $this->_current_file = $resource_name; + $this->_current_line_no = 1; + $ldq = preg_quote($this->left_delimiter, '~'); + $rdq = preg_quote($this->right_delimiter, '~'); + + // run template source through prefilter functions + if (count($this->_plugins['prefilter']) > 0) { + foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) { + if ($prefilter === false) continue; + if ($prefilter[3] || is_callable($prefilter[0])) { + $source_content = call_user_func_array($prefilter[0], + array($source_content, &$this)); + $this->_plugins['prefilter'][$filter_name][3] = true; + } else { + $this->_trigger_fatal_error("[plugin] prefilter '$filter_name' is not implemented"); + } + } + } + + /* fetch all special blocks */ + $search = "~{$ldq}\*(.*?)\*{$rdq}|{$ldq}\s*literal\s*{$rdq}(.*?){$ldq}\s*/literal\s*{$rdq}|{$ldq}\s*php\s*{$rdq}(.*?){$ldq}\s*/php\s*{$rdq}~s"; + + preg_match_all($search, $source_content, $match, PREG_SET_ORDER); + $this->_folded_blocks = $match; + reset($this->_folded_blocks); + + /* replace special blocks by "{php}" */ + $source_content = preg_replace($search.'e', "'" + . $this->_quote_replace($this->left_delimiter) . 'php' + . "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'" + . $this->_quote_replace($this->right_delimiter) + . "'" + , $source_content); + + /* Gather all template tags. */ + preg_match_all("~{$ldq}\s*(.*?)\s*{$rdq}~s", $source_content, $_match); + $template_tags = $_match[1]; + /* Split content by template tags to obtain non-template content. */ + $text_blocks = preg_split("~{$ldq}.*?{$rdq}~s", $source_content); + + /* loop through text blocks */ + for ($curr_tb = 0, $for_max = count($text_blocks); $curr_tb < $for_max; $curr_tb++) { + /* match anything resembling php tags */ + if (preg_match_all('~(<\?(?:\w+|=)?|\?>|language\s*=\s*[\"\']?\s*php\s*[\"\']?)~is', $text_blocks[$curr_tb], $sp_match)) { + /* replace tags with placeholders to prevent recursive replacements */ + $sp_match[1] = array_unique($sp_match[1]); + usort($sp_match[1], '_smarty_sort_length'); + for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) { + $text_blocks[$curr_tb] = str_replace($sp_match[1][$curr_sp],'%%%SMARTYSP'.$curr_sp.'%%%',$text_blocks[$curr_tb]); + } + /* process each one */ + for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) { + if ($this->php_handling == SMARTY_PHP_PASSTHRU) { + /* echo php contents */ + $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', ''."\n", $text_blocks[$curr_tb]); + } else if ($this->php_handling == SMARTY_PHP_QUOTE) { + /* quote php tags */ + $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', htmlspecialchars($sp_match[1][$curr_sp]), $text_blocks[$curr_tb]); + } else if ($this->php_handling == SMARTY_PHP_REMOVE) { + /* remove php tags */ + $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '', $text_blocks[$curr_tb]); + } else { + /* SMARTY_PHP_ALLOW, but echo non php starting tags */ + $sp_match[1][$curr_sp] = preg_replace('~(<\?(?!php|=|$))~i', ''."\n", $sp_match[1][$curr_sp]); + $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', $sp_match[1][$curr_sp], $text_blocks[$curr_tb]); + } + } + } + } + + /* Compile the template tags into PHP code. */ + $compiled_tags = array(); + for ($i = 0, $for_max = count($template_tags); $i < $for_max; $i++) { + $this->_current_line_no += substr_count($text_blocks[$i], "\n"); + $compiled_tags[] = $this->_compile_tag($template_tags[$i]); + $this->_current_line_no += substr_count($template_tags[$i], "\n"); + } + if (count($this->_tag_stack)>0) { + list($_open_tag, $_line_no) = end($this->_tag_stack); + $this->_syntax_error("unclosed tag \{$_open_tag} (opened line $_line_no).", E_USER_ERROR, __FILE__, __LINE__); + return; + } + + /* Reformat $text_blocks between 'strip' and '/strip' tags, + removing spaces, tabs and newlines. */ + $strip = false; + for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) { + if ($compiled_tags[$i] == '{strip}') { + $compiled_tags[$i] = ''; + $strip = true; + /* remove leading whitespaces */ + $text_blocks[$i + 1] = ltrim($text_blocks[$i + 1]); + } + if ($strip) { + /* strip all $text_blocks before the next '/strip' */ + for ($j = $i + 1; $j < $for_max; $j++) { + /* remove leading and trailing whitespaces of each line */ + $text_blocks[$j] = preg_replace('![\t ]*[\r\n]+[\t ]*!', '', $text_blocks[$j]); + if ($compiled_tags[$j] == '{/strip}') { + /* remove trailing whitespaces from the last text_block */ + $text_blocks[$j] = rtrim($text_blocks[$j]); + } + $text_blocks[$j] = ""\'", "\\"=>"\\\\")) . "'; ?>"; + if ($compiled_tags[$j] == '{/strip}') { + $compiled_tags[$j] = "\n"; /* slurped by php, but necessary + if a newline is following the closing strip-tag */ + $strip = false; + $i = $j; + break; + } + } + } + } + $compiled_content = ''; + + $tag_guard = '%%%SMARTYOTG' . md5(uniqid(rand(), true)) . '%%%'; + + /* Interleave the compiled contents and text blocks to get the final result. */ + for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) { + if ($compiled_tags[$i] == '') { + // tag result empty, remove first newline from following text block + $text_blocks[$i+1] = preg_replace('~^(\r\n|\r|\n)~', '', $text_blocks[$i+1]); + } + // replace legit PHP tags with placeholder + $text_blocks[$i] = str_replace('\n", $compiled_content); + $compiled_content = preg_replace("~(?\n", $compiled_content); + + // recover legit tags + $compiled_content = str_replace($tag_guard, '_cache_serial)) { + $compiled_content = "_cache_serials['".$this->_cache_include."'] = '".$this->_cache_serial."'; ?>" . $compiled_content; + } + + // run compiled template through postfilter functions + if (count($this->_plugins['postfilter']) > 0) { + foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) { + if ($postfilter === false) continue; + if ($postfilter[3] || is_callable($postfilter[0])) { + $compiled_content = call_user_func_array($postfilter[0], + array($compiled_content, &$this)); + $this->_plugins['postfilter'][$filter_name][3] = true; + } else { + $this->_trigger_fatal_error("Smarty plugin error: postfilter '$filter_name' is not implemented"); + } + } + } + + // put header at the top of the compiled template + $template_header = "_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n"; + $template_header .= " compiled from ".strtr(urlencode($resource_name), array('%2F'=>'/', '%3A'=>':'))." */ ?>\n"; + + /* Emit code to load needed plugins. */ + $this->_plugins_code = ''; + if (count($this->_plugin_info)) { + $_plugins_params = "array('plugins' => array("; + foreach ($this->_plugin_info as $plugin_type => $plugins) { + foreach ($plugins as $plugin_name => $plugin_info) { + $_plugins_params .= "array('$plugin_type', '$plugin_name', '" . strtr($plugin_info[0], array("'" => "\\'", "\\" => "\\\\")) . "', $plugin_info[1], "; + $_plugins_params .= $plugin_info[2] ? 'true),' : 'false),'; + } + } + $_plugins_params .= '))'; + $plugins_code = "\n"; + $template_header .= $plugins_code; + $this->_plugin_info = array(); + $this->_plugins_code = $plugins_code; + } + + if ($this->_init_smarty_vars) { + $template_header .= "\n"; + $this->_init_smarty_vars = false; + } + + $compiled_content = $template_header . $compiled_content; + return true; + } + + /** + * Compile a template tag + * + * @param string $template_tag + * @return string + */ + function _compile_tag($template_tag) + { + /* Matched comment. */ + if (substr($template_tag, 0, 1) == '*' && substr($template_tag, -1) == '*') + return ''; + + /* Split tag into two three parts: command, command modifiers and the arguments. */ + if(! preg_match('~^(?:(' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp + . '|\/?' . $this->_reg_obj_regexp . '|\/?' . $this->_func_regexp . ')(' . $this->_mod_regexp . '*)) + (?:\s+(.*))?$ + ~xs', $template_tag, $match)) { + $this->_syntax_error("unrecognized tag: $template_tag", E_USER_ERROR, __FILE__, __LINE__); + } + + $tag_command = $match[1]; + $tag_modifier = isset($match[2]) ? $match[2] : null; + $tag_args = isset($match[3]) ? $match[3] : null; + + if (preg_match('~^' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '$~', $tag_command)) { + /* tag name is a variable or object */ + $_return = $this->_parse_var_props($tag_command . $tag_modifier); + return "" . $this->_additional_newline; + } + + /* If the tag name is a registered object, we process it. */ + if (preg_match('~^\/?' . $this->_reg_obj_regexp . '$~', $tag_command)) { + return $this->_compile_registered_object_tag($tag_command, $this->_parse_attrs($tag_args), $tag_modifier); + } + + switch ($tag_command) { + case 'include': + return $this->_compile_include_tag($tag_args); + + case 'include_php': + return $this->_compile_include_php_tag($tag_args); + + case 'if': + $this->_push_tag('if'); + return $this->_compile_if_tag($tag_args); + + case 'else': + list($_open_tag) = end($this->_tag_stack); + if ($_open_tag != 'if' && $_open_tag != 'elseif') + $this->_syntax_error('unexpected {else}', E_USER_ERROR, __FILE__, __LINE__); + else + $this->_push_tag('else'); + return ''; + + case 'elseif': + list($_open_tag) = end($this->_tag_stack); + if ($_open_tag != 'if' && $_open_tag != 'elseif') + $this->_syntax_error('unexpected {elseif}', E_USER_ERROR, __FILE__, __LINE__); + if ($_open_tag == 'if') + $this->_push_tag('elseif'); + return $this->_compile_if_tag($tag_args, true); + + case '/if': + $this->_pop_tag('if'); + return ''; + + case 'capture': + return $this->_compile_capture_tag(true, $tag_args); + + case '/capture': + return $this->_compile_capture_tag(false); + + case 'ldelim': + return $this->left_delimiter; + + case 'rdelim': + return $this->right_delimiter; + + case 'section': + $this->_push_tag('section'); + return $this->_compile_section_start($tag_args); + + case 'sectionelse': + $this->_push_tag('sectionelse'); + return ""; + break; + + case '/section': + $_open_tag = $this->_pop_tag('section'); + if ($_open_tag == 'sectionelse') + return ""; + else + return ""; + + case 'foreach': + $this->_push_tag('foreach'); + return $this->_compile_foreach_start($tag_args); + break; + + case 'foreachelse': + $this->_push_tag('foreachelse'); + return ""; + + case '/foreach': + $_open_tag = $this->_pop_tag('foreach'); + if ($_open_tag == 'foreachelse') + return ""; + else + return ""; + break; + + case 'strip': + case '/strip': + if (substr($tag_command, 0, 1)=='/') { + $this->_pop_tag('strip'); + if (--$this->_strip_depth==0) { /* outermost closing {/strip} */ + $this->_additional_newline = "\n"; + return '{' . $tag_command . '}'; + } + } else { + $this->_push_tag('strip'); + if ($this->_strip_depth++==0) { /* outermost opening {strip} */ + $this->_additional_newline = ""; + return '{' . $tag_command . '}'; + } + } + return ''; + + case 'php': + /* handle folded tags replaced by {php} */ + list(, $block) = each($this->_folded_blocks); + $this->_current_line_no += substr_count($block[0], "\n"); + /* the number of matched elements in the regexp in _compile_file() + determins the type of folded tag that was found */ + switch (count($block)) { + case 2: /* comment */ + return ''; + + case 3: /* literal */ + return ""\'", "\\"=>"\\\\")) . "'; ?>" . $this->_additional_newline; + + case 4: /* php */ + if ($this->security && !$this->security_settings['PHP_TAGS']) { + $this->_syntax_error("(secure mode) php tags not permitted", E_USER_WARNING, __FILE__, __LINE__); + return; + } + return ''; + } + break; + + case 'insert': + return $this->_compile_insert_tag($tag_args); + + default: + if ($this->_compile_compiler_tag($tag_command, $tag_args, $output)) { + return $output; + } else if ($this->_compile_block_tag($tag_command, $tag_args, $tag_modifier, $output)) { + return $output; + } else if ($this->_compile_custom_tag($tag_command, $tag_args, $tag_modifier, $output)) { + return $output; + } else { + $this->_syntax_error("unrecognized tag '$tag_command'", E_USER_ERROR, __FILE__, __LINE__); + } + + } + } + + + /** + * compile the custom compiler tag + * + * sets $output to the compiled custom compiler tag + * @param string $tag_command + * @param string $tag_args + * @param string $output + * @return boolean + */ + function _compile_compiler_tag($tag_command, $tag_args, &$output) + { + $found = false; + $have_function = true; + + /* + * First we check if the compiler function has already been registered + * or loaded from a plugin file. + */ + if (isset($this->_plugins['compiler'][$tag_command])) { + $found = true; + $plugin_func = $this->_plugins['compiler'][$tag_command][0]; + if (!is_callable($plugin_func)) { + $message = "compiler function '$tag_command' is not implemented"; + $have_function = false; + } + } + /* + * Otherwise we need to load plugin file and look for the function + * inside it. + */ + else if ($plugin_file = $this->_get_plugin_filepath('compiler', $tag_command)) { + $found = true; + + include_once $plugin_file; + + $plugin_func = 'smarty_compiler_' . $tag_command; + if (!is_callable($plugin_func)) { + $message = "plugin function $plugin_func() not found in $plugin_file\n"; + $have_function = false; + } else { + $this->_plugins['compiler'][$tag_command] = array($plugin_func, null, null, null, true); + } + } + + /* + * True return value means that we either found a plugin or a + * dynamically registered function. False means that we didn't and the + * compiler should now emit code to load custom function plugin for this + * tag. + */ + if ($found) { + if ($have_function) { + $output = call_user_func_array($plugin_func, array($tag_args, &$this)); + if($output != '') { + $output = '_push_cacheable_state('compiler', $tag_command) + . $output + . $this->_pop_cacheable_state('compiler', $tag_command) . ' ?>'; + } + } else { + $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__); + } + return true; + } else { + return false; + } + } + + + /** + * compile block function tag + * + * sets $output to compiled block function tag + * @param string $tag_command + * @param string $tag_args + * @param string $tag_modifier + * @param string $output + * @return boolean + */ + function _compile_block_tag($tag_command, $tag_args, $tag_modifier, &$output) + { + if (substr($tag_command, 0, 1) == '/') { + $start_tag = false; + $tag_command = substr($tag_command, 1); + } else + $start_tag = true; + + $found = false; + $have_function = true; + + /* + * First we check if the block function has already been registered + * or loaded from a plugin file. + */ + if (isset($this->_plugins['block'][$tag_command])) { + $found = true; + $plugin_func = $this->_plugins['block'][$tag_command][0]; + if (!is_callable($plugin_func)) { + $message = "block function '$tag_command' is not implemented"; + $have_function = false; + } + } + /* + * Otherwise we need to load plugin file and look for the function + * inside it. + */ + else if ($plugin_file = $this->_get_plugin_filepath('block', $tag_command)) { + $found = true; + + include_once $plugin_file; + + $plugin_func = 'smarty_block_' . $tag_command; + if (!function_exists($plugin_func)) { + $message = "plugin function $plugin_func() not found in $plugin_file\n"; + $have_function = false; + } else { + $this->_plugins['block'][$tag_command] = array($plugin_func, null, null, null, true); + + } + } + + if (!$found) { + return false; + } else if (!$have_function) { + $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__); + return true; + } + + /* + * Even though we've located the plugin function, compilation + * happens only once, so the plugin will still need to be loaded + * at runtime for future requests. + */ + $this->_add_plugin('block', $tag_command); + + if ($start_tag) + $this->_push_tag($tag_command); + else + $this->_pop_tag($tag_command); + + if ($start_tag) { + $output = '_push_cacheable_state('block', $tag_command); + $attrs = $this->_parse_attrs($tag_args); + $_cache_attrs=''; + $arg_list = $this->_compile_arg_list('block', $tag_command, $attrs, $_cache_attrs); + $output .= "$_cache_attrs\$this->_tag_stack[] = array('$tag_command', array(".implode(',', $arg_list).')); '; + $output .= '$_block_repeat=true;' . $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);'; + $output .= 'while ($_block_repeat) { ob_start(); ?>'; + } else { + $output = '_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat)'; + if ($tag_modifier != '') { + $this->_parse_modifiers($_out_tag_text, $tag_modifier); + } + $output .= '$_block_repeat=false;echo ' . $_out_tag_text . '; } '; + $output .= " array_pop(\$this->_tag_stack); " . $this->_pop_cacheable_state('block', $tag_command) . '?>'; + } + + return true; + } + + + /** + * compile custom function tag + * + * @param string $tag_command + * @param string $tag_args + * @param string $tag_modifier + * @return string + */ + function _compile_custom_tag($tag_command, $tag_args, $tag_modifier, &$output) + { + $found = false; + $have_function = true; + + /* + * First we check if the custom function has already been registered + * or loaded from a plugin file. + */ + if (isset($this->_plugins['function'][$tag_command])) { + $found = true; + $plugin_func = $this->_plugins['function'][$tag_command][0]; + if (!is_callable($plugin_func)) { + $message = "custom function '$tag_command' is not implemented"; + $have_function = false; + } + } + /* + * Otherwise we need to load plugin file and look for the function + * inside it. + */ + else if ($plugin_file = $this->_get_plugin_filepath('function', $tag_command)) { + $found = true; + + include_once $plugin_file; + + $plugin_func = 'smarty_function_' . $tag_command; + if (!function_exists($plugin_func)) { + $message = "plugin function $plugin_func() not found in $plugin_file\n"; + $have_function = false; + } else { + $this->_plugins['function'][$tag_command] = array($plugin_func, null, null, null, true); + + } + } + + if (!$found) { + return false; + } else if (!$have_function) { + $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__); + return true; + } + + /* declare plugin to be loaded on display of the template that + we compile right now */ + $this->_add_plugin('function', $tag_command); + + $_cacheable_state = $this->_push_cacheable_state('function', $tag_command); + $attrs = $this->_parse_attrs($tag_args); + $_cache_attrs = ''; + $arg_list = $this->_compile_arg_list('function', $tag_command, $attrs, $_cache_attrs); + + $output = $this->_compile_plugin_call('function', $tag_command).'(array('.implode(',', $arg_list)."), \$this)"; + if($tag_modifier != '') { + $this->_parse_modifiers($output, $tag_modifier); + } + + if($output != '') { + $output = '_pop_cacheable_state('function', $tag_command) . "?>" . $this->_additional_newline; + } + + return true; + } + + /** + * compile a registered object tag + * + * @param string $tag_command + * @param array $attrs + * @param string $tag_modifier + * @return string + */ + function _compile_registered_object_tag($tag_command, $attrs, $tag_modifier) + { + if (substr($tag_command, 0, 1) == '/') { + $start_tag = false; + $tag_command = substr($tag_command, 1); + } else { + $start_tag = true; + } + + list($object, $obj_comp) = explode('->', $tag_command); + + $arg_list = array(); + if(count($attrs)) { + $_assign_var = false; + foreach ($attrs as $arg_name => $arg_value) { + if($arg_name == 'assign') { + $_assign_var = $arg_value; + unset($attrs['assign']); + continue; + } + if (is_bool($arg_value)) + $arg_value = $arg_value ? 'true' : 'false'; + $arg_list[] = "'$arg_name' => $arg_value"; + } + } + + if($this->_reg_objects[$object][2]) { + // smarty object argument format + $args = "array(".implode(',', (array)$arg_list)."), \$this"; + } else { + // traditional argument format + $args = implode(',', array_values($attrs)); + if (empty($args)) { + $args = ''; + } + } + + $prefix = ''; + $postfix = ''; + $newline = ''; + if(!is_object($this->_reg_objects[$object][0])) { + $this->_trigger_fatal_error("registered '$object' is not an object" , $this->_current_file, $this->_current_line_no, __FILE__, __LINE__); + } elseif(!empty($this->_reg_objects[$object][1]) && !in_array($obj_comp, $this->_reg_objects[$object][1])) { + $this->_trigger_fatal_error("'$obj_comp' is not a registered component of object '$object'", $this->_current_file, $this->_current_line_no, __FILE__, __LINE__); + } elseif(method_exists($this->_reg_objects[$object][0], $obj_comp)) { + // method + if(in_array($obj_comp, $this->_reg_objects[$object][3])) { + // block method + if ($start_tag) { + $prefix = "\$this->_tag_stack[] = array('$obj_comp', $args); "; + $prefix .= "\$_block_repeat=true; \$this->_reg_objects['$object'][0]->$obj_comp(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], null, \$this, \$_block_repeat); "; + $prefix .= "while (\$_block_repeat) { ob_start();"; + $return = null; + $postfix = ''; + } else { + $prefix = "\$_obj_block_content = ob_get_contents(); ob_end_clean(); \$_block_repeat=false;"; + $return = "\$this->_reg_objects['$object'][0]->$obj_comp(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], \$_obj_block_content, \$this, \$_block_repeat)"; + $postfix = "} array_pop(\$this->_tag_stack);"; + } + } else { + // non-block method + $return = "\$this->_reg_objects['$object'][0]->$obj_comp($args)"; + } + } else { + // property + $return = "\$this->_reg_objects['$object'][0]->$obj_comp"; + } + + if($return != null) { + if($tag_modifier != '') { + $this->_parse_modifiers($return, $tag_modifier); + } + + if(!empty($_assign_var)) { + $output = "\$this->assign('" . $this->_dequote($_assign_var) ."', $return);"; + } else { + $output = 'echo ' . $return . ';'; + $newline = $this->_additional_newline; + } + } else { + $output = ''; + } + + return '" . $newline; + } + + /** + * Compile {insert ...} tag + * + * @param string $tag_args + * @return string + */ + function _compile_insert_tag($tag_args) + { + $attrs = $this->_parse_attrs($tag_args); + $name = $this->_dequote($attrs['name']); + + if (empty($name)) { + return $this->_syntax_error("missing insert name", E_USER_ERROR, __FILE__, __LINE__); + } + + if (!preg_match('~^\w+$~', $name)) { + return $this->_syntax_error("'insert: 'name' must be an insert function name", E_USER_ERROR, __FILE__, __LINE__); + } + + if (!empty($attrs['script'])) { + $delayed_loading = true; + } else { + $delayed_loading = false; + } + + foreach ($attrs as $arg_name => $arg_value) { + if (is_bool($arg_value)) + $arg_value = $arg_value ? 'true' : 'false'; + $arg_list[] = "'$arg_name' => $arg_value"; + } + + $this->_add_plugin('insert', $name, $delayed_loading); + + $_params = "array('args' => array(".implode(', ', (array)$arg_list)."))"; + + return "" . $this->_additional_newline; + } + + /** + * Compile {include ...} tag + * + * @param string $tag_args + * @return string + */ + function _compile_include_tag($tag_args) + { + $attrs = $this->_parse_attrs($tag_args); + $arg_list = array(); + + if (empty($attrs['file'])) { + $this->_syntax_error("missing 'file' attribute in include tag", E_USER_ERROR, __FILE__, __LINE__); + } + + foreach ($attrs as $arg_name => $arg_value) { + if ($arg_name == 'file') { + $include_file = $arg_value; + continue; + } else if ($arg_name == 'assign') { + $assign_var = $arg_value; + continue; + } + if (is_bool($arg_value)) + $arg_value = $arg_value ? 'true' : 'false'; + $arg_list[] = "'$arg_name' => $arg_value"; + } + + $output = '_tpl_vars;\n"; + + + $_params = "array('smarty_include_tpl_file' => " . $include_file . ", 'smarty_include_vars' => array(".implode(',', (array)$arg_list)."))"; + $output .= "\$this->_smarty_include($_params);\n" . + "\$this->_tpl_vars = \$_smarty_tpl_vars;\n" . + "unset(\$_smarty_tpl_vars);\n"; + + if (isset($assign_var)) { + $output .= "\$this->assign(" . $assign_var . ", ob_get_contents()); ob_end_clean();\n"; + } + + $output .= ' ?>'; + + return $output; + + } + + /** + * Compile {include ...} tag + * + * @param string $tag_args + * @return string + */ + function _compile_include_php_tag($tag_args) + { + $attrs = $this->_parse_attrs($tag_args); + + if (empty($attrs['file'])) { + $this->_syntax_error("missing 'file' attribute in include_php tag", E_USER_ERROR, __FILE__, __LINE__); + } + + $assign_var = (empty($attrs['assign'])) ? '' : $this->_dequote($attrs['assign']); + $once_var = (empty($attrs['once']) || $attrs['once']=='false') ? 'false' : 'true'; + + $arg_list = array(); + foreach($attrs as $arg_name => $arg_value) { + if($arg_name != 'file' AND $arg_name != 'once' AND $arg_name != 'assign') { + if(is_bool($arg_value)) + $arg_value = $arg_value ? 'true' : 'false'; + $arg_list[] = "'$arg_name' => $arg_value"; + } + } + + $_params = "array('smarty_file' => " . $attrs['file'] . ", 'smarty_assign' => '$assign_var', 'smarty_once' => $once_var, 'smarty_include_vars' => array(".implode(',', $arg_list)."))"; + + return "" . $this->_additional_newline; + } + + + /** + * Compile {section ...} tag + * + * @param string $tag_args + * @return string + */ + function _compile_section_start($tag_args) + { + $attrs = $this->_parse_attrs($tag_args); + $arg_list = array(); + + $output = '_syntax_error("missing section name", E_USER_ERROR, __FILE__, __LINE__); + } + + $output .= "unset(\$this->_sections[$section_name]);\n"; + $section_props = "\$this->_sections[$section_name]"; + + foreach ($attrs as $attr_name => $attr_value) { + switch ($attr_name) { + case 'loop': + $output .= "{$section_props}['loop'] = is_array(\$_loop=$attr_value) ? count(\$_loop) : max(0, (int)\$_loop); unset(\$_loop);\n"; + break; + + case 'show': + if (is_bool($attr_value)) + $show_attr_value = $attr_value ? 'true' : 'false'; + else + $show_attr_value = "(bool)$attr_value"; + $output .= "{$section_props}['show'] = $show_attr_value;\n"; + break; + + case 'name': + $output .= "{$section_props}['$attr_name'] = $attr_value;\n"; + break; + + case 'max': + case 'start': + $output .= "{$section_props}['$attr_name'] = (int)$attr_value;\n"; + break; + + case 'step': + $output .= "{$section_props}['$attr_name'] = ((int)$attr_value) == 0 ? 1 : (int)$attr_value;\n"; + break; + + default: + $this->_syntax_error("unknown section attribute - '$attr_name'", E_USER_ERROR, __FILE__, __LINE__); + break; + } + } + + if (!isset($attrs['show'])) + $output .= "{$section_props}['show'] = true;\n"; + + if (!isset($attrs['loop'])) + $output .= "{$section_props}['loop'] = 1;\n"; + + if (!isset($attrs['max'])) + $output .= "{$section_props}['max'] = {$section_props}['loop'];\n"; + else + $output .= "if ({$section_props}['max'] < 0)\n" . + " {$section_props}['max'] = {$section_props}['loop'];\n"; + + if (!isset($attrs['step'])) + $output .= "{$section_props}['step'] = 1;\n"; + + if (!isset($attrs['start'])) + $output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n"; + else { + $output .= "if ({$section_props}['start'] < 0)\n" . + " {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" . + "else\n" . + " {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\n"; + } + + $output .= "if ({$section_props}['show']) {\n"; + if (!isset($attrs['start']) && !isset($attrs['step']) && !isset($attrs['max'])) { + $output .= " {$section_props}['total'] = {$section_props}['loop'];\n"; + } else { + $output .= " {$section_props}['total'] = min(ceil(({$section_props}['step'] > 0 ? {$section_props}['loop'] - {$section_props}['start'] : {$section_props}['start']+1)/abs({$section_props}['step'])), {$section_props}['max']);\n"; + } + $output .= " if ({$section_props}['total'] == 0)\n" . + " {$section_props}['show'] = false;\n" . + "} else\n" . + " {$section_props}['total'] = 0;\n"; + + $output .= "if ({$section_props}['show']):\n"; + $output .= " + for ({$section_props}['index'] = {$section_props}['start'], {$section_props}['iteration'] = 1; + {$section_props}['iteration'] <= {$section_props}['total']; + {$section_props}['index'] += {$section_props}['step'], {$section_props}['iteration']++):\n"; + $output .= "{$section_props}['rownum'] = {$section_props}['iteration'];\n"; + $output .= "{$section_props}['index_prev'] = {$section_props}['index'] - {$section_props}['step'];\n"; + $output .= "{$section_props}['index_next'] = {$section_props}['index'] + {$section_props}['step'];\n"; + $output .= "{$section_props}['first'] = ({$section_props}['iteration'] == 1);\n"; + $output .= "{$section_props}['last'] = ({$section_props}['iteration'] == {$section_props}['total']);\n"; + + $output .= "?>"; + + return $output; + } + + + /** + * Compile {foreach ...} tag. + * + * @param string $tag_args + * @return string + */ + function _compile_foreach_start($tag_args) + { + $attrs = $this->_parse_attrs($tag_args); + $arg_list = array(); + + if (empty($attrs['from'])) { + return $this->_syntax_error("foreach: missing 'from' attribute", E_USER_ERROR, __FILE__, __LINE__); + } + $from = $attrs['from']; + + if (empty($attrs['item'])) { + return $this->_syntax_error("foreach: missing 'item' attribute", E_USER_ERROR, __FILE__, __LINE__); + } + $item = $this->_dequote($attrs['item']); + if (!preg_match('~^\w+$~', $item)) { + return $this->_syntax_error("foreach: 'item' must be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__); + } + + if (isset($attrs['key'])) { + $key = $this->_dequote($attrs['key']); + if (!preg_match('~^\w+$~', $key)) { + return $this->_syntax_error("foreach: 'key' must to be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__); + } + $key_part = "\$this->_tpl_vars['$key'] => "; + } else { + $key = null; + $key_part = ''; + } + + if (isset($attrs['name'])) { + $name = $attrs['name']; + } else { + $name = null; + } + + $output = '_foreach[$name]"; + $output .= "{$foreach_props} = array('total' => count(\$_from), 'iteration' => 0);\n"; + $output .= "if ({$foreach_props}['total'] > 0):\n"; + $output .= " foreach (\$_from as $key_part\$this->_tpl_vars['$item']):\n"; + $output .= " {$foreach_props}['iteration']++;\n"; + } else { + $output .= "if (count(\$_from)):\n"; + $output .= " foreach (\$_from as $key_part\$this->_tpl_vars['$item']):\n"; + } + $output .= '?>'; + + return $output; + } + + + /** + * Compile {capture} .. {/capture} tags + * + * @param boolean $start true if this is the {capture} tag + * @param string $tag_args + * @return string + */ + + function _compile_capture_tag($start, $tag_args = '') + { + $attrs = $this->_parse_attrs($tag_args); + + if ($start) { + $buffer = isset($attrs['name']) ? $attrs['name'] : "'default'"; + $assign = isset($attrs['assign']) ? $attrs['assign'] : null; + $append = isset($attrs['append']) ? $attrs['append'] : null; + + $output = ""; + $this->_capture_stack[] = array($buffer, $assign, $append); + } else { + list($buffer, $assign, $append) = array_pop($this->_capture_stack); + $output = "_smarty_vars['capture'][$buffer] = ob_get_contents(); "; + if (isset($assign)) { + $output .= " \$this->assign($assign, ob_get_contents());"; + } + if (isset($append)) { + $output .= " \$this->append($append, ob_get_contents());"; + } + $output .= "ob_end_clean(); ?>"; + } + + return $output; + } + + /** + * Compile {if ...} tag + * + * @param string $tag_args + * @param boolean $elseif if true, uses elseif instead of if + * @return string + */ + function _compile_if_tag($tag_args, $elseif = false) + { + + /* Tokenize args for 'if' tag. */ + preg_match_all('~(?> + ' . $this->_obj_call_regexp . '(?:' . $this->_mod_regexp . '*)? | # valid object call + ' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*)? | # var or quoted string + \-?0[xX][0-9a-fA-F]+|\-?\d+(?:\.\d+)?|\.\d+|!==|===|==|!=|<>|<<|>>|<=|>=|\&\&|\|\||\(|\)|,|\!|\^|=|\&|\~|<|>|\||\%|\+|\-|\/|\*|\@ | # valid non-word token + \b\w+\b | # valid word token + \S+ # anything else + )~x', $tag_args, $match); + + $tokens = $match[0]; + + if(empty($tokens)) { + $_error_msg = $elseif ? "'elseif'" : "'if'"; + $_error_msg .= ' statement requires arguments'; + $this->_syntax_error($_error_msg, E_USER_ERROR, __FILE__, __LINE__); + } + + + // make sure we have balanced parenthesis + $token_count = array_count_values($tokens); + if(isset($token_count['(']) && $token_count['('] != $token_count[')']) { + $this->_syntax_error("unbalanced parenthesis in if statement", E_USER_ERROR, __FILE__, __LINE__); + } + + $is_arg_stack = array(); + + for ($i = 0; $i < count($tokens); $i++) { + + $token = &$tokens[$i]; + + switch (strtolower($token)) { + case '!': + case '%': + case '!==': + case '==': + case '===': + case '>': + case '<': + case '!=': + case '<>': + case '<<': + case '>>': + case '<=': + case '>=': + case '&&': + case '||': + case '|': + case '^': + case '&': + case '~': + case ')': + case ',': + case '+': + case '-': + case '*': + case '/': + case '@': + break; + + case 'eq': + $token = '=='; + break; + + case 'ne': + case 'neq': + $token = '!='; + break; + + case 'lt': + $token = '<'; + break; + + case 'le': + case 'lte': + $token = '<='; + break; + + case 'gt': + $token = '>'; + break; + + case 'ge': + case 'gte': + $token = '>='; + break; + + case 'and': + $token = '&&'; + break; + + case 'or': + $token = '||'; + break; + + case 'not': + $token = '!'; + break; + + case 'mod': + $token = '%'; + break; + + case '(': + array_push($is_arg_stack, $i); + break; + + case 'is': + /* If last token was a ')', we operate on the parenthesized + expression. The start of the expression is on the stack. + Otherwise, we operate on the last encountered token. */ + if ($tokens[$i-1] == ')') { + $is_arg_start = array_pop($is_arg_stack); + if ($is_arg_start != 0) { + if (preg_match('~^' . $this->_func_regexp . '$~', $tokens[$is_arg_start-1])) { + $is_arg_start--; + } + } + } else + $is_arg_start = $i-1; + /* Construct the argument for 'is' expression, so it knows + what to operate on. */ + $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start)); + + /* Pass all tokens from next one until the end to the + 'is' expression parsing function. The function will + return modified tokens, where the first one is the result + of the 'is' expression and the rest are the tokens it + didn't touch. */ + $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1)); + + /* Replace the old tokens with the new ones. */ + array_splice($tokens, $is_arg_start, count($tokens), $new_tokens); + + /* Adjust argument start so that it won't change from the + current position for the next iteration. */ + $i = $is_arg_start; + break; + + default: + if(preg_match('~^' . $this->_func_regexp . '$~', $token) ) { + // function call + if($this->security && + !in_array($token, $this->security_settings['IF_FUNCS'])) { + $this->_syntax_error("(secure mode) '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__); + } + } elseif(preg_match('~^' . $this->_var_regexp . '$~', $token) && (strpos('+-*/^%&|', substr($token, -1)) === false) && isset($tokens[$i+1]) && $tokens[$i+1] == '(') { + // variable function call + $this->_syntax_error("variable function call '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__); + } elseif(preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*)$~', $token)) { + // object or variable + $token = $this->_parse_var_props($token); + } elseif(is_numeric($token)) { + // number, skip it + } else { + $this->_syntax_error("unidentified token '$token'", E_USER_ERROR, __FILE__, __LINE__); + } + break; + } + } + + if ($elseif) + return ''; + else + return ''; + } + + + function _compile_arg_list($type, $name, $attrs, &$cache_code) { + $arg_list = array(); + + if (isset($type) && isset($name) + && isset($this->_plugins[$type]) + && isset($this->_plugins[$type][$name]) + && empty($this->_plugins[$type][$name][4]) + && is_array($this->_plugins[$type][$name][5]) + ) { + /* we have a list of parameters that should be cached */ + $_cache_attrs = $this->_plugins[$type][$name][5]; + $_count = $this->_cache_attrs_count++; + $cache_code = "\$_cache_attrs =& \$this->_smarty_cache_attrs('$this->_cache_serial','$_count');"; + + } else { + /* no parameters are cached */ + $_cache_attrs = null; + } + + foreach ($attrs as $arg_name => $arg_value) { + if (is_bool($arg_value)) + $arg_value = $arg_value ? 'true' : 'false'; + if (is_null($arg_value)) + $arg_value = 'null'; + if ($_cache_attrs && in_array($arg_name, $_cache_attrs)) { + $arg_list[] = "'$arg_name' => (\$this->_cache_including) ? \$_cache_attrs['$arg_name'] : (\$_cache_attrs['$arg_name']=$arg_value)"; + } else { + $arg_list[] = "'$arg_name' => $arg_value"; + } + } + return $arg_list; + } + + /** + * Parse is expression + * + * @param string $is_arg + * @param array $tokens + * @return array + */ + function _parse_is_expr($is_arg, $tokens) + { + $expr_end = 0; + $negate_expr = false; + + if (($first_token = array_shift($tokens)) == 'not') { + $negate_expr = true; + $expr_type = array_shift($tokens); + } else + $expr_type = $first_token; + + switch ($expr_type) { + case 'even': + if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by') { + $expr_end++; + $expr_arg = $tokens[$expr_end++]; + $expr = "!(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))"; + } else + $expr = "!(1 & $is_arg)"; + break; + + case 'odd': + if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by') { + $expr_end++; + $expr_arg = $tokens[$expr_end++]; + $expr = "(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))"; + } else + $expr = "(1 & $is_arg)"; + break; + + case 'div': + if (@$tokens[$expr_end] == 'by') { + $expr_end++; + $expr_arg = $tokens[$expr_end++]; + $expr = "!($is_arg % " . $this->_parse_var_props($expr_arg) . ")"; + } else { + $this->_syntax_error("expecting 'by' after 'div'", E_USER_ERROR, __FILE__, __LINE__); + } + break; + + default: + $this->_syntax_error("unknown 'is' expression - '$expr_type'", E_USER_ERROR, __FILE__, __LINE__); + break; + } + + if ($negate_expr) { + $expr = "!($expr)"; + } + + array_splice($tokens, 0, $expr_end, $expr); + + return $tokens; + } + + + /** + * Parse attribute string + * + * @param string $tag_args + * @return array + */ + function _parse_attrs($tag_args) + { + + /* Tokenize tag attributes. */ + preg_match_all('~(?:' . $this->_obj_call_regexp . '|' . $this->_qstr_regexp . ' | (?>[^"\'=\s]+) + )+ | + [=] + ~x', $tag_args, $match); + $tokens = $match[0]; + + $attrs = array(); + /* Parse state: + 0 - expecting attribute name + 1 - expecting '=' + 2 - expecting attribute value (not '=') */ + $state = 0; + + foreach ($tokens as $token) { + switch ($state) { + case 0: + /* If the token is a valid identifier, we set attribute name + and go to state 1. */ + if (preg_match('~^\w+$~', $token)) { + $attr_name = $token; + $state = 1; + } else + $this->_syntax_error("invalid attribute name: '$token'", E_USER_ERROR, __FILE__, __LINE__); + break; + + case 1: + /* If the token is '=', then we go to state 2. */ + if ($token == '=') { + $state = 2; + } else + $this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__); + break; + + case 2: + /* If token is not '=', we set the attribute value and go to + state 0. */ + if ($token != '=') { + /* We booleanize the token if it's a non-quoted possible + boolean value. */ + if (preg_match('~^(on|yes|true)$~', $token)) { + $token = 'true'; + } else if (preg_match('~^(off|no|false)$~', $token)) { + $token = 'false'; + } else if ($token == 'null') { + $token = 'null'; + } else if (preg_match('~^' . $this->_num_const_regexp . '|0[xX][0-9a-fA-F]+$~', $token)) { + /* treat integer literally */ + } else if (!preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . ')*$~', $token)) { + /* treat as a string, double-quote it escaping quotes */ + $token = '"'.addslashes($token).'"'; + } + + $attrs[$attr_name] = $token; + $state = 0; + } else + $this->_syntax_error("'=' cannot be an attribute value", E_USER_ERROR, __FILE__, __LINE__); + break; + } + $last_token = $token; + } + + if($state != 0) { + if($state == 1) { + $this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__); + } else { + $this->_syntax_error("missing attribute value", E_USER_ERROR, __FILE__, __LINE__); + } + } + + $this->_parse_vars_props($attrs); + + return $attrs; + } + + /** + * compile multiple variables and section properties tokens into + * PHP code + * + * @param array $tokens + */ + function _parse_vars_props(&$tokens) + { + foreach($tokens as $key => $val) { + $tokens[$key] = $this->_parse_var_props($val); + } + } + + /** + * compile single variable and section properties token into + * PHP code + * + * @param string $val + * @param string $tag_attrs + * @return string + */ + function _parse_var_props($val) + { + $val = trim($val); + + if(preg_match('~^(' . $this->_obj_call_regexp . '|' . $this->_dvar_regexp . ')(' . $this->_mod_regexp . '*)$~', $val, $match)) { + // $ variable or object + $return = $this->_parse_var($match[1]); + $modifiers = $match[2]; + if (!empty($this->default_modifiers) && !preg_match('~(^|\|)smarty:nodefaults($|\|)~',$modifiers)) { + $_default_mod_string = implode('|',(array)$this->default_modifiers); + $modifiers = empty($modifiers) ? $_default_mod_string : $_default_mod_string . '|' . $modifiers; + } + $this->_parse_modifiers($return, $modifiers); + return $return; + } elseif (preg_match('~^' . $this->_db_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { + // double quoted text + preg_match('~^(' . $this->_db_qstr_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match); + $return = $this->_expand_quoted_text($match[1]); + if($match[2] != '') { + $this->_parse_modifiers($return, $match[2]); + } + return $return; + } + elseif(preg_match('~^' . $this->_num_const_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { + // numerical constant + preg_match('~^(' . $this->_num_const_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match); + if($match[2] != '') { + $this->_parse_modifiers($match[1], $match[2]); + return $match[1]; + } + } + elseif(preg_match('~^' . $this->_si_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { + // single quoted text + preg_match('~^(' . $this->_si_qstr_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match); + if($match[2] != '') { + $this->_parse_modifiers($match[1], $match[2]); + return $match[1]; + } + } + elseif(preg_match('~^' . $this->_cvar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { + // config var + return $this->_parse_conf_var($val); + } + elseif(preg_match('~^' . $this->_svar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { + // section var + return $this->_parse_section_prop($val); + } + elseif(!in_array($val, $this->_permitted_tokens) && !is_numeric($val)) { + // literal string + return $this->_expand_quoted_text('"' . strtr($val, array('\\' => '\\\\', '"' => '\\"')) .'"'); + } + return $val; + } + + /** + * expand quoted text with embedded variables + * + * @param string $var_expr + * @return string + */ + function _expand_quoted_text($var_expr) + { + // if contains unescaped $, expand it + if(preg_match_all('~(?:\`(?_dvar_guts_regexp . '(?:' . $this->_obj_ext_regexp . ')*\`)|(?:(?_parse_var(str_replace('`','',$_var)) . ')."'; + } + $var_expr = strtr($var_expr, $_replace); + $_return = preg_replace('~\.""|(?_dvar_math_regexp.'|'.$this->_qstr_regexp.')~', $var_expr, -1, PREG_SPLIT_DELIM_CAPTURE); + + if(count($_math_vars) > 1) { + $_first_var = ""; + $_complete_var = ""; + $_output = ""; + // simple check if there is any math, to stop recursion (due to modifiers with "xx % yy" as parameter) + foreach($_math_vars as $_k => $_math_var) { + $_math_var = $_math_vars[$_k]; + + if(!empty($_math_var) || is_numeric($_math_var)) { + // hit a math operator, so process the stuff which came before it + if(preg_match('~^' . $this->_dvar_math_regexp . '$~', $_math_var)) { + $_has_math = true; + if(!empty($_complete_var) || is_numeric($_complete_var)) { + $_output .= $this->_parse_var($_complete_var); + } + + // just output the math operator to php + $_output .= $_math_var; + + if(empty($_first_var)) + $_first_var = $_complete_var; + + $_complete_var = ""; + } else { + $_complete_var .= $_math_var; + } + } + } + if($_has_math) { + if(!empty($_complete_var) || is_numeric($_complete_var)) + $_output .= $this->_parse_var($_complete_var); + + // get the modifiers working (only the last var from math + modifier is left) + $var_expr = $_complete_var; + } + } + + // prevent cutting of first digit in the number (we _definitly_ got a number if the first char is a digit) + if(is_numeric(substr($var_expr, 0, 1))) + $_var_ref = $var_expr; + else + $_var_ref = substr($var_expr, 1); + + if(!$_has_math) { + + // get [foo] and .foo and ->foo and (...) pieces + preg_match_all('~(?:^\w+)|' . $this->_obj_params_regexp . '|(?:' . $this->_var_bracket_regexp . ')|->\$?\w+|\.\$?\w+|\S+~', $_var_ref, $match); + + $_indexes = $match[0]; + $_var_name = array_shift($_indexes); + + /* Handle $smarty.* variable references as a special case. */ + if ($_var_name == 'smarty') { + /* + * If the reference could be compiled, use the compiled output; + * otherwise, fall back on the $smarty variable generated at + * run-time. + */ + if (($smarty_ref = $this->_compile_smarty_ref($_indexes)) !== null) { + $_output = $smarty_ref; + } else { + $_var_name = substr(array_shift($_indexes), 1); + $_output = "\$this->_smarty_vars['$_var_name']"; + } + } elseif(is_numeric($_var_name) && is_numeric(substr($var_expr, 0, 1))) { + // because . is the operator for accessing arrays thru inidizes we need to put it together again for floating point numbers + if(count($_indexes) > 0) + { + $_var_name .= implode("", $_indexes); + $_indexes = array(); + } + $_output = $_var_name; + } else { + $_output = "\$this->_tpl_vars['$_var_name']"; + } + + foreach ($_indexes as $_index) { + if (substr($_index, 0, 1) == '[') { + $_index = substr($_index, 1, -1); + if (is_numeric($_index)) { + $_output .= "[$_index]"; + } elseif (substr($_index, 0, 1) == '$') { + if (strpos($_index, '.') !== false) { + $_output .= '[' . $this->_parse_var($_index) . ']'; + } else { + $_output .= "[\$this->_tpl_vars['" . substr($_index, 1) . "']]"; + } + } else { + $_var_parts = explode('.', $_index); + $_var_section = $_var_parts[0]; + $_var_section_prop = isset($_var_parts[1]) ? $_var_parts[1] : 'index'; + $_output .= "[\$this->_sections['$_var_section']['$_var_section_prop']]"; + } + } else if (substr($_index, 0, 1) == '.') { + if (substr($_index, 1, 1) == '$') + $_output .= "[\$this->_tpl_vars['" . substr($_index, 2) . "']]"; + else + $_output .= "['" . substr($_index, 1) . "']"; + } else if (substr($_index,0,2) == '->') { + if(substr($_index,2,2) == '__') { + $this->_syntax_error('call to internal object members is not allowed', E_USER_ERROR, __FILE__, __LINE__); + } elseif($this->security && substr($_index, 2, 1) == '_') { + $this->_syntax_error('(secure) call to private object member is not allowed', E_USER_ERROR, __FILE__, __LINE__); + } elseif (substr($_index, 2, 1) == '$') { + if ($this->security) { + $this->_syntax_error('(secure) call to dynamic object member is not allowed', E_USER_ERROR, __FILE__, __LINE__); + } else { + $_output .= '->{(($_var=$this->_tpl_vars[\''.substr($_index,3).'\']) && substr($_var,0,2)!=\'__\') ? $_var : $this->trigger_error("cannot access property \\"$_var\\"")}'; + } + } else { + if ($this->_phpversion < 5) { + $_has_php4_method_chaining = true; + $_output .= "; \$_foo = \$_foo"; + } + $_output .= $_index; + } + } elseif (substr($_index, 0, 1) == '(') { + $_index = $this->_parse_parenth_args($_index); + $_output .= $_index; + } else { + $_output .= $_index; + } + } + } + + if ($_has_php4_method_chaining) { + $_tmp = str_replace("'","\'",'$_foo = '.$_output.'; return $_foo;'); + return "eval('".$_tmp."')"; + } else { + return $_output; + } + } + + /** + * parse arguments in function call parenthesis + * + * @param string $parenth_args + * @return string + */ + function _parse_parenth_args($parenth_args) + { + preg_match_all('~' . $this->_param_regexp . '~',$parenth_args, $match); + $orig_vals = $match = $match[0]; + $this->_parse_vars_props($match); + $replace = array(); + for ($i = 0, $count = count($match); $i < $count; $i++) { + $replace[$orig_vals[$i]] = $match[$i]; + } + return strtr($parenth_args, $replace); + } + + /** + * parse configuration variable expression into PHP code + * + * @param string $conf_var_expr + */ + function _parse_conf_var($conf_var_expr) + { + $parts = explode('|', $conf_var_expr, 2); + $var_ref = $parts[0]; + $modifiers = isset($parts[1]) ? $parts[1] : ''; + + $var_name = substr($var_ref, 1, -1); + + $output = "\$this->_config[0]['vars']['$var_name']"; + + $this->_parse_modifiers($output, $modifiers); + + return $output; + } + + /** + * parse section property expression into PHP code + * + * @param string $section_prop_expr + * @return string + */ + function _parse_section_prop($section_prop_expr) + { + $parts = explode('|', $section_prop_expr, 2); + $var_ref = $parts[0]; + $modifiers = isset($parts[1]) ? $parts[1] : ''; + + preg_match('!%(\w+)\.(\w+)%!', $var_ref, $match); + $section_name = $match[1]; + $prop_name = $match[2]; + + $output = "\$this->_sections['$section_name']['$prop_name']"; + + $this->_parse_modifiers($output, $modifiers); + + return $output; + } + + + /** + * parse modifier chain into PHP code + * + * sets $output to parsed modified chain + * @param string $output + * @param string $modifier_string + */ + function _parse_modifiers(&$output, $modifier_string) + { + preg_match_all('~\|(@?\w+)((?>:(?:'. $this->_qstr_regexp . '|[^|]+))*)~', '|' . $modifier_string, $_match); + list(, $_modifiers, $modifier_arg_strings) = $_match; + + for ($_i = 0, $_for_max = count($_modifiers); $_i < $_for_max; $_i++) { + $_modifier_name = $_modifiers[$_i]; + + if($_modifier_name == 'smarty') { + // skip smarty modifier + continue; + } + + preg_match_all('~:(' . $this->_qstr_regexp . '|[^:]+)~', $modifier_arg_strings[$_i], $_match); + $_modifier_args = $_match[1]; + + if (substr($_modifier_name, 0, 1) == '@') { + $_map_array = false; + $_modifier_name = substr($_modifier_name, 1); + } else { + $_map_array = true; + } + + if (empty($this->_plugins['modifier'][$_modifier_name]) + && !$this->_get_plugin_filepath('modifier', $_modifier_name) + && function_exists($_modifier_name)) { + if ($this->security && !in_array($_modifier_name, $this->security_settings['MODIFIER_FUNCS'])) { + $this->_trigger_fatal_error("[plugin] (secure mode) modifier '$_modifier_name' is not allowed" , $this->_current_file, $this->_current_line_no, __FILE__, __LINE__); + } else { + $this->_plugins['modifier'][$_modifier_name] = array($_modifier_name, null, null, false); + } + } + $this->_add_plugin('modifier', $_modifier_name); + + $this->_parse_vars_props($_modifier_args); + + if($_modifier_name == 'default') { + // supress notifications of default modifier vars and args + if(substr($output, 0, 1) == '$') { + $output = '@' . $output; + } + if(isset($_modifier_args[0]) && substr($_modifier_args[0], 0, 1) == '$') { + $_modifier_args[0] = '@' . $_modifier_args[0]; + } + } + if (count($_modifier_args) > 0) + $_modifier_args = ', '.implode(', ', $_modifier_args); + else + $_modifier_args = ''; + + if ($_map_array) { + $output = "((is_array(\$_tmp=$output)) ? \$this->_run_mod_handler('$_modifier_name', true, \$_tmp$_modifier_args) : " . $this->_compile_plugin_call('modifier', $_modifier_name) . "(\$_tmp$_modifier_args))"; + + } else { + + $output = $this->_compile_plugin_call('modifier', $_modifier_name)."($output$_modifier_args)"; + + } + } + } + + + /** + * add plugin + * + * @param string $type + * @param string $name + * @param boolean? $delayed_loading + */ + function _add_plugin($type, $name, $delayed_loading = null) + { + if (!isset($this->_plugin_info[$type])) { + $this->_plugin_info[$type] = array(); + } + if (!isset($this->_plugin_info[$type][$name])) { + $this->_plugin_info[$type][$name] = array($this->_current_file, + $this->_current_line_no, + $delayed_loading); + } + } + + + /** + * Compiles references of type $smarty.foo + * + * @param string $indexes + * @return string + */ + function _compile_smarty_ref(&$indexes) + { + /* Extract the reference name. */ + $_ref = substr($indexes[0], 1); + foreach($indexes as $_index_no=>$_index) { + if (substr($_index, 0, 1) != '.' && $_index_no<2 || !preg_match('~^(\.|\[|->)~', $_index)) { + $this->_syntax_error('$smarty' . implode('', array_slice($indexes, 0, 2)) . ' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__); + } + } + + switch ($_ref) { + case 'now': + $compiled_ref = 'time()'; + $_max_index = 1; + break; + + case 'foreach': + array_shift($indexes); + $_var = $this->_parse_var_props(substr($indexes[0], 1)); + $_propname = substr($indexes[1], 1); + $_max_index = 1; + switch ($_propname) { + case 'index': + array_shift($indexes); + $compiled_ref = "(\$this->_foreach[$_var]['iteration']-1)"; + break; + + case 'first': + array_shift($indexes); + $compiled_ref = "(\$this->_foreach[$_var]['iteration'] <= 1)"; + break; + + case 'last': + array_shift($indexes); + $compiled_ref = "(\$this->_foreach[$_var]['iteration'] == \$this->_foreach[$_var]['total'])"; + break; + + case 'show': + array_shift($indexes); + $compiled_ref = "(\$this->_foreach[$_var]['total'] > 0)"; + break; + + default: + unset($_max_index); + $compiled_ref = "\$this->_foreach[$_var]"; + } + break; + + case 'section': + array_shift($indexes); + $_var = $this->_parse_var_props(substr($indexes[0], 1)); + $compiled_ref = "\$this->_sections[$_var]"; + break; + + case 'get': + $compiled_ref = ($this->request_use_auto_globals) ? '$_GET' : "\$GLOBALS['HTTP_GET_VARS']"; + break; + + case 'post': + $compiled_ref = ($this->request_use_auto_globals) ? '$_POST' : "\$GLOBALS['HTTP_POST_VARS']"; + break; + + case 'cookies': + $compiled_ref = ($this->request_use_auto_globals) ? '$_COOKIE' : "\$GLOBALS['HTTP_COOKIE_VARS']"; + break; + + case 'env': + $compiled_ref = ($this->request_use_auto_globals) ? '$_ENV' : "\$GLOBALS['HTTP_ENV_VARS']"; + break; + + case 'server': + $compiled_ref = ($this->request_use_auto_globals) ? '$_SERVER' : "\$GLOBALS['HTTP_SERVER_VARS']"; + break; + + case 'session': + $compiled_ref = ($this->request_use_auto_globals) ? '$_SESSION' : "\$GLOBALS['HTTP_SESSION_VARS']"; + break; + + /* + * These cases are handled either at run-time or elsewhere in the + * compiler. + */ + case 'request': + if ($this->request_use_auto_globals) { + $compiled_ref = '$_REQUEST'; + break; + } else { + $this->_init_smarty_vars = true; + } + return null; + + case 'capture': + return null; + + case 'template': + $compiled_ref = "'$this->_current_file'"; + $_max_index = 1; + break; + + case 'version': + $compiled_ref = "'$this->_version'"; + $_max_index = 1; + break; + + case 'const': + if ($this->security && !$this->security_settings['ALLOW_CONSTANTS']) { + $this->_syntax_error("(secure mode) constants not permitted", + E_USER_WARNING, __FILE__, __LINE__); + return; + } + array_shift($indexes); + if (preg_match('!^\.\w+$!', $indexes[0])) { + $compiled_ref = '@' . substr($indexes[0], 1); + } else { + $_val = $this->_parse_var_props(substr($indexes[0], 1)); + $compiled_ref = '@constant(' . $_val . ')'; + } + $_max_index = 1; + break; + + case 'config': + $compiled_ref = "\$this->_config[0]['vars']"; + $_max_index = 3; + break; + + case 'ldelim': + $compiled_ref = "'$this->left_delimiter'"; + break; + + case 'rdelim': + $compiled_ref = "'$this->right_delimiter'"; + break; + + default: + $this->_syntax_error('$smarty.' . $_ref . ' is an unknown reference', E_USER_ERROR, __FILE__, __LINE__); + break; + } + + if (isset($_max_index) && count($indexes) > $_max_index) { + $this->_syntax_error('$smarty' . implode('', $indexes) .' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__); + } + + array_shift($indexes); + return $compiled_ref; + } + + /** + * compiles call to plugin of type $type with name $name + * returns a string containing the function-name or method call + * without the paramter-list that would have follow to make the + * call valid php-syntax + * + * @param string $type + * @param string $name + * @return string + */ + function _compile_plugin_call($type, $name) { + if (isset($this->_plugins[$type][$name])) { + /* plugin loaded */ + if (is_array($this->_plugins[$type][$name][0])) { + return ((is_object($this->_plugins[$type][$name][0][0])) ? + "\$this->_plugins['$type']['$name'][0][0]->" /* method callback */ + : (string)($this->_plugins[$type][$name][0][0]).'::' /* class callback */ + ). $this->_plugins[$type][$name][0][1]; + + } else { + /* function callback */ + return $this->_plugins[$type][$name][0]; + + } + } else { + /* plugin not loaded -> auto-loadable-plugin */ + return 'smarty_'.$type.'_'.$name; + + } + } + + /** + * load pre- and post-filters + */ + function _load_filters() + { + if (count($this->_plugins['prefilter']) > 0) { + foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) { + if ($prefilter === false) { + unset($this->_plugins['prefilter'][$filter_name]); + $_params = array('plugins' => array(array('prefilter', $filter_name, null, null, false))); + require_once(SMARTY_CORE_DIR . 'core.load_plugins.php'); + smarty_core_load_plugins($_params, $this); + } + } + } + if (count($this->_plugins['postfilter']) > 0) { + foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) { + if ($postfilter === false) { + unset($this->_plugins['postfilter'][$filter_name]); + $_params = array('plugins' => array(array('postfilter', $filter_name, null, null, false))); + require_once(SMARTY_CORE_DIR . 'core.load_plugins.php'); + smarty_core_load_plugins($_params, $this); + } + } + } + } + + + /** + * Quote subpattern references + * + * @param string $string + * @return string + */ + function _quote_replace($string) + { + return strtr($string, array('\\' => '\\\\', '$' => '\\$')); + } + + /** + * display Smarty syntax error + * + * @param string $error_msg + * @param integer $error_type + * @param string $file + * @param integer $line + */ + function _syntax_error($error_msg, $error_type = E_USER_ERROR, $file=null, $line=null) + { + $this->_trigger_fatal_error("syntax error: $error_msg", $this->_current_file, $this->_current_line_no, $file, $line, $error_type); + } + + + /** + * check if the compilation changes from cacheable to + * non-cacheable state with the beginning of the current + * plugin. return php-code to reflect the transition. + * @return string + */ + function _push_cacheable_state($type, $name) { + $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4]; + if ($_cacheable + || 0<$this->_cacheable_state++) return ''; + if (!isset($this->_cache_serial)) $this->_cache_serial = md5(uniqid('Smarty')); + $_ret = 'if ($this->caching && !$this->_cache_including): echo \'{nocache:' + . $this->_cache_serial . '#' . $this->_nocache_count + . '}\'; endif;'; + return $_ret; + } + + + /** + * check if the compilation changes from non-cacheable to + * cacheable state with the end of the current plugin return + * php-code to reflect the transition. + * @return string + */ + function _pop_cacheable_state($type, $name) { + $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4]; + if ($_cacheable + || --$this->_cacheable_state>0) return ''; + return 'if ($this->caching && !$this->_cache_including): echo \'{/nocache:' + . $this->_cache_serial . '#' . ($this->_nocache_count++) + . '}\'; endif;'; + } + + + /** + * push opening tag-name, file-name and line-number on the tag-stack + * @param string the opening tag's name + */ + function _push_tag($open_tag) + { + array_push($this->_tag_stack, array($open_tag, $this->_current_line_no)); + } + + /** + * pop closing tag-name + * raise an error if this stack-top doesn't match with the closing tag + * @param string the closing tag's name + * @return string the opening tag's name + */ + function _pop_tag($close_tag) + { + $message = ''; + if (count($this->_tag_stack)>0) { + list($_open_tag, $_line_no) = array_pop($this->_tag_stack); + if ($close_tag == $_open_tag) { + return $_open_tag; + } + if ($close_tag == 'if' && ($_open_tag == 'else' || $_open_tag == 'elseif' )) { + return $this->_pop_tag($close_tag); + } + if ($close_tag == 'section' && $_open_tag == 'sectionelse') { + $this->_pop_tag($close_tag); + return $_open_tag; + } + if ($close_tag == 'foreach' && $_open_tag == 'foreachelse') { + $this->_pop_tag($close_tag); + return $_open_tag; + } + if ($_open_tag == 'else' || $_open_tag == 'elseif') { + $_open_tag = 'if'; + } elseif ($_open_tag == 'sectionelse') { + $_open_tag = 'section'; + } elseif ($_open_tag == 'foreachelse') { + $_open_tag = 'foreach'; + } + $message = " expected {/$_open_tag} (opened line $_line_no)."; + } + $this->_syntax_error("mismatched tag {/$close_tag}.$message", + E_USER_ERROR, __FILE__, __LINE__); + } + +} + +/** + * compare to values by their string length + * + * @access private + * @param string $a + * @param string $b + * @return 0|-1|1 + */ +function _smarty_sort_length($a, $b) +{ + if($a == $b) + return 0; + + if(strlen($a) == strlen($b)) + return ($a > $b) ? -1 : 1; + + return (strlen($a) > strlen($b)) ? -1 : 1; +} + + +/* vim: set et: */ + +?> diff --git a/onyx2/modules/templates/smarty/debug.tpl b/onyx2/modules/templates/smarty/debug.tpl new file mode 100644 index 0000000..c05ef5d --- /dev/null +++ b/onyx2/modules/templates/smarty/debug.tpl @@ -0,0 +1,157 @@ +{* Smarty *} +{* debug.tpl, last updated version 2.1.0 *} +{assign_debug_info} +{capture assign=debug_output} + + + + Smarty Debug Console +{literal} + +{/literal} + + + +

          Smarty Debug Console

          + +

          included templates & config files (load time in seconds)

          + +
          +{section name=templates loop=$_debug_tpls} + {section name=indent loop=$_debug_tpls[templates].depth}   {/section} + + {$_debug_tpls[templates].filename|escape:html} + {if isset($_debug_tpls[templates].exec_time)} + + ({$_debug_tpls[templates].exec_time|string_format:"%.5f"}) + {if %templates.index% eq 0}(total){/if} + + {/if} +
          +{sectionelse} +

          no templates included

          +{/section} +
          + +

          assigned template variables

          + + + {section name=vars loop=$_debug_keys} + + + + {sectionelse} + + {/section} +
          {ldelim}${$_debug_keys[vars]|escape:'html'}{rdelim}{$_debug_vals[vars]|@debug_print_var}

          no template variables assigned

          + +

          assigned config file variables (outer template scope)

          + + + {section name=config_vars loop=$_debug_config_keys} + + + + {sectionelse} + + {/section} +
          {ldelim}#{$_debug_config_keys[config_vars]|escape:'html'}#{rdelim}{$_debug_config_vals[config_vars]|@debug_print_var}

          no config vars assigned

          + + +{/capture} +{if isset($_smarty_debug_output) and $_smarty_debug_output eq "html"} + {$debug_output} +{else} + +{/if} \ No newline at end of file diff --git a/onyx2/modules/templates/smarty/internals/core.assemble_plugin_filepath.php b/onyx2/modules/templates/smarty/internals/core.assemble_plugin_filepath.php new file mode 100644 index 0000000..690d3dd --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.assemble_plugin_filepath.php @@ -0,0 +1,67 @@ +plugins_dir as $_plugin_dir) { + + $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename; + + // see if path is relative + if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) { + $_relative_paths[] = $_plugin_dir; + // relative path, see if it is in the SMARTY_DIR + if (@is_readable(SMARTY_DIR . $_plugin_filepath)) { + $_return = SMARTY_DIR . $_plugin_filepath; + break; + } + } + // try relative to cwd (or absolute) + if (@is_readable($_plugin_filepath)) { + $_return = $_plugin_filepath; + break; + } + } + + if($_return === false) { + // still not found, try PHP include_path + if(isset($_relative_paths)) { + foreach ((array)$_relative_paths as $_plugin_dir) { + + $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename; + + $_params = array('file_path' => $_plugin_filepath); + require_once(SMARTY_CORE_DIR . 'core.get_include_path.php'); + if(smarty_core_get_include_path($_params, $smarty)) { + $_return = $_params['new_file_path']; + break; + } + } + } + } + $_filepaths_cache[$_plugin_filename] = $_return; + return $_return; +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.assign_smarty_interface.php b/onyx2/modules/templates/smarty/internals/core.assign_smarty_interface.php new file mode 100644 index 0000000..7e65a73 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.assign_smarty_interface.php @@ -0,0 +1,43 @@ + + * Name: assign_smarty_interface
          + * Purpose: assign the $smarty interface variable + * @param array Format: null + * @param Smarty + */ +function smarty_core_assign_smarty_interface($params, &$smarty) +{ + if (isset($smarty->_smarty_vars) && isset($smarty->_smarty_vars['request'])) { + return; + } + + $_globals_map = array('g' => 'HTTP_GET_VARS', + 'p' => 'HTTP_POST_VARS', + 'c' => 'HTTP_COOKIE_VARS', + 's' => 'HTTP_SERVER_VARS', + 'e' => 'HTTP_ENV_VARS'); + + $_smarty_vars_request = array(); + + foreach (preg_split('!!', strtolower($smarty->request_vars_order)) as $_c) { + if (isset($_globals_map[$_c])) { + $_smarty_vars_request = array_merge($_smarty_vars_request, $GLOBALS[$_globals_map[$_c]]); + } + } + $_smarty_vars_request = @array_merge($_smarty_vars_request, $GLOBALS['HTTP_SESSION_VARS']); + + $smarty->_smarty_vars['request'] = $_smarty_vars_request; +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.create_dir_structure.php b/onyx2/modules/templates/smarty/internals/core.create_dir_structure.php new file mode 100644 index 0000000..3eecc49 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.create_dir_structure.php @@ -0,0 +1,79 @@ +_dir_perms) && !is_dir($_new_dir)) { + $smarty->trigger_error("problem creating directory '" . $_new_dir . "'"); + return false; + } + $_new_dir .= '/'; + } + } +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.display_debug_console.php b/onyx2/modules/templates/smarty/internals/core.display_debug_console.php new file mode 100644 index 0000000..1a80f39 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.display_debug_console.php @@ -0,0 +1,61 @@ + + * Name: display_debug_console
          + * Purpose: display the javascript debug console window + * @param array Format: null + * @param Smarty + */ +function smarty_core_display_debug_console($params, &$smarty) +{ + // we must force compile the debug template in case the environment + // changed between separate applications. + + if(empty($smarty->debug_tpl)) { + // set path to debug template from SMARTY_DIR + $smarty->debug_tpl = SMARTY_DIR . 'debug.tpl'; + if($smarty->security && is_file($smarty->debug_tpl)) { + $smarty->secure_dir[] = realpath($smarty->debug_tpl); + } + $smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl'; + } + + $_ldelim_orig = $smarty->left_delimiter; + $_rdelim_orig = $smarty->right_delimiter; + + $smarty->left_delimiter = '{'; + $smarty->right_delimiter = '}'; + + $_compile_id_orig = $smarty->_compile_id; + $smarty->_compile_id = null; + + $_compile_path = $smarty->_get_compile_path($smarty->debug_tpl); + if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path)) + { + ob_start(); + $smarty->_include($_compile_path); + $_results = ob_get_contents(); + ob_end_clean(); + } else { + $_results = ''; + } + + $smarty->_compile_id = $_compile_id_orig; + + $smarty->left_delimiter = $_ldelim_orig; + $smarty->right_delimiter = $_rdelim_orig; + + return $_results; +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.get_include_path.php b/onyx2/modules/templates/smarty/internals/core.get_include_path.php new file mode 100644 index 0000000..4343241 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.get_include_path.php @@ -0,0 +1,44 @@ + diff --git a/onyx2/modules/templates/smarty/internals/core.get_microtime.php b/onyx2/modules/templates/smarty/internals/core.get_microtime.php new file mode 100644 index 0000000..f1a28e0 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.get_microtime.php @@ -0,0 +1,23 @@ + diff --git a/onyx2/modules/templates/smarty/internals/core.get_php_resource.php b/onyx2/modules/templates/smarty/internals/core.get_php_resource.php new file mode 100644 index 0000000..786d4e7 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.get_php_resource.php @@ -0,0 +1,80 @@ +trusted_dir; + $smarty->_parse_resource_name($params, $smarty); + + /* + * Find out if the resource exists. + */ + + if ($params['resource_type'] == 'file') { + $_readable = false; + if(file_exists($params['resource_name']) && is_readable($params['resource_name'])) { + $_readable = true; + } else { + // test for file in include_path + $_params = array('file_path' => $params['resource_name']); + require_once(SMARTY_CORE_DIR . 'core.get_include_path.php'); + if(smarty_core_get_include_path($_params, $smarty)) { + $_include_path = $_params['new_file_path']; + $_readable = true; + } + } + } else if ($params['resource_type'] != 'file') { + $_template_source = null; + $_readable = is_callable($smarty->_plugins['resource'][$params['resource_type']][0][0]) + && call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][0], + array($params['resource_name'], &$_template_source, &$smarty)); + } + + /* + * Set the error function, depending on which class calls us. + */ + if (method_exists($smarty, '_syntax_error')) { + $_error_funcc = '_syntax_error'; + } else { + $_error_funcc = 'trigger_error'; + } + + if ($_readable) { + if ($smarty->security) { + require_once(SMARTY_CORE_DIR . 'core.is_trusted.php'); + if (!smarty_core_is_trusted($params, $smarty)) { + $smarty->$_error_funcc('(secure mode) ' . $params['resource_type'] . ':' . $params['resource_name'] . ' is not trusted'); + return false; + } + } + } else { + $smarty->$_error_funcc($params['resource_type'] . ':' . $params['resource_name'] . ' is not readable'); + return false; + } + + if ($params['resource_type'] == 'file') { + $params['php_resource'] = $params['resource_name']; + } else { + $params['php_resource'] = $_template_source; + } + return true; +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.is_secure.php b/onyx2/modules/templates/smarty/internals/core.is_secure.php new file mode 100644 index 0000000..d54abd4 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.is_secure.php @@ -0,0 +1,59 @@ +security || $smarty->security_settings['INCLUDE_ANY']) { + return true; + } + + if ($params['resource_type'] == 'file') { + $_rp = realpath($params['resource_name']); + if (isset($params['resource_base_path'])) { + foreach ((array)$params['resource_base_path'] as $curr_dir) { + if ( ($_cd = realpath($curr_dir)) !== false && + strncmp($_rp, $_cd, strlen($_cd)) == 0 && + substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) { + return true; + } + } + } + if (!empty($smarty->secure_dir)) { + foreach ((array)$smarty->secure_dir as $curr_dir) { + if ( ($_cd = realpath($curr_dir)) !== false) { + if($_cd == $_rp) { + return true; + } elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 && + substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) { + return true; + } + } + } + } + } else { + // resource is not on local file system + return call_user_func_array( + $smarty->_plugins['resource'][$params['resource_type']][0][2], + array($params['resource_name'], &$smarty)); + } + + return false; +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.is_trusted.php b/onyx2/modules/templates/smarty/internals/core.is_trusted.php new file mode 100644 index 0000000..4299731 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.is_trusted.php @@ -0,0 +1,47 @@ +trusted_dir)) { + $_rp = realpath($params['resource_name']); + foreach ((array)$smarty->trusted_dir as $curr_dir) { + if (!empty($curr_dir) && is_readable ($curr_dir)) { + $_cd = realpath($curr_dir); + if (strncmp($_rp, $_cd, strlen($_cd)) == 0 + && substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) { + $_smarty_trusted = true; + break; + } + } + } + } + + } else { + // resource is not on local file system + $_smarty_trusted = call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][3], + array($params['resource_name'], $smarty)); + } + + return $_smarty_trusted; +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.load_plugins.php b/onyx2/modules/templates/smarty/internals/core.load_plugins.php new file mode 100644 index 0000000..6db1dc5 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.load_plugins.php @@ -0,0 +1,125 @@ +_plugins[$_type][$_name]; + + /* + * We do not load plugin more than once for each instance of Smarty. + * The following code checks for that. The plugin can also be + * registered dynamically at runtime, in which case template file + * and line number will be unknown, so we fill them in. + * + * The final element of the info array is a flag that indicates + * whether the dynamically registered plugin function has been + * checked for existence yet or not. + */ + if (isset($_plugin)) { + if (empty($_plugin[3])) { + if (!is_callable($_plugin[0])) { + $smarty->_trigger_fatal_error("[plugin] $_type '$_name' is not implemented", $_tpl_file, $_tpl_line, __FILE__, __LINE__); + } else { + $_plugin[1] = $_tpl_file; + $_plugin[2] = $_tpl_line; + $_plugin[3] = true; + if (!isset($_plugin[4])) $_plugin[4] = true; /* cacheable */ + } + } + continue; + } else if ($_type == 'insert') { + /* + * For backwards compatibility, we check for insert functions in + * the symbol table before trying to load them as a plugin. + */ + $_plugin_func = 'insert_' . $_name; + if (function_exists($_plugin_func)) { + $_plugin = array($_plugin_func, $_tpl_file, $_tpl_line, true, false); + continue; + } + } + + $_plugin_file = $smarty->_get_plugin_filepath($_type, $_name); + + if (! $_found = ($_plugin_file != false)) { + $_message = "could not load plugin file '$_type.$_name.php'\n"; + } + + /* + * If plugin file is found, it -must- provide the properly named + * plugin function. In case it doesn't, simply output the error and + * do not fall back on any other method. + */ + if ($_found) { + include_once $_plugin_file; + + $_plugin_func = 'smarty_' . $_type . '_' . $_name; + if (!function_exists($_plugin_func)) { + $smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", $_tpl_file, $_tpl_line, __FILE__, __LINE__); + continue; + } + } + /* + * In case of insert plugins, their code may be loaded later via + * 'script' attribute. + */ + else if ($_type == 'insert' && $_delayed_loading) { + $_plugin_func = 'smarty_' . $_type . '_' . $_name; + $_found = true; + } + + /* + * Plugin specific processing and error checking. + */ + if (!$_found) { + if ($_type == 'modifier') { + /* + * In case modifier falls back on using PHP functions + * directly, we only allow those specified in the security + * context. + */ + if ($smarty->security && !in_array($_name, $smarty->security_settings['MODIFIER_FUNCS'])) { + $_message = "(secure mode) modifier '$_name' is not allowed"; + } else { + if (!function_exists($_name)) { + $_message = "modifier '$_name' is not implemented"; + } else { + $_plugin_func = $_name; + $_found = true; + } + } + } else if ($_type == 'function') { + /* + * This is a catch-all situation. + */ + $_message = "unknown tag - '$_name'"; + } + } + + if ($_found) { + $smarty->_plugins[$_type][$_name] = array($_plugin_func, $_tpl_file, $_tpl_line, true, true); + } else { + // output error + $smarty->_trigger_fatal_error('[plugin] ' . $_message, $_tpl_file, $_tpl_line, __FILE__, __LINE__); + } + } +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.load_resource_plugin.php b/onyx2/modules/templates/smarty/internals/core.load_resource_plugin.php new file mode 100644 index 0000000..a7d37d1 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.load_resource_plugin.php @@ -0,0 +1,74 @@ +_plugins['resource'][$params['type']]; + if (isset($_plugin)) { + if (!$_plugin[1] && count($_plugin[0])) { + $_plugin[1] = true; + foreach ($_plugin[0] as $_plugin_func) { + if (!is_callable($_plugin_func)) { + $_plugin[1] = false; + break; + } + } + } + + if (!$_plugin[1]) { + $smarty->_trigger_fatal_error("[plugin] resource '" . $params['type'] . "' is not implemented", null, null, __FILE__, __LINE__); + } + + return; + } + + $_plugin_file = $smarty->_get_plugin_filepath('resource', $params['type']); + $_found = ($_plugin_file != false); + + if ($_found) { /* + * If the plugin file is found, it -must- provide the properly named + * plugin functions. + */ + include_once($_plugin_file); + + /* + * Locate functions that we require the plugin to provide. + */ + $_resource_ops = array('source', 'timestamp', 'secure', 'trusted'); + $_resource_funcs = array(); + foreach ($_resource_ops as $_op) { + $_plugin_func = 'smarty_resource_' . $params['type'] . '_' . $_op; + if (!function_exists($_plugin_func)) { + $smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", null, null, __FILE__, __LINE__); + return; + } else { + $_resource_funcs[] = $_plugin_func; + } + } + + $smarty->_plugins['resource'][$params['type']] = array($_resource_funcs, true); + } +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.process_cached_inserts.php b/onyx2/modules/templates/smarty/internals/core.process_cached_inserts.php new file mode 100644 index 0000000..1d78edd --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.process_cached_inserts.php @@ -0,0 +1,71 @@ +_smarty_md5.'{insert_cache (.*)}'.$smarty->_smarty_md5.'!Uis', + $params['results'], $match); + list($cached_inserts, $insert_args) = $match; + + for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) { + if ($smarty->debugging) { + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $debug_start_time = smarty_core_get_microtime($_params, $smarty); + } + + $args = unserialize($insert_args[$i]); + $name = $args['name']; + + if (isset($args['script'])) { + $_params = array('resource_name' => $smarty->_dequote($args['script'])); + require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php'); + if(!smarty_core_get_php_resource($_params, $smarty)) { + return false; + } + $resource_type = $_params['resource_type']; + $php_resource = $_params['php_resource']; + + + if ($resource_type == 'file') { + $smarty->_include($php_resource, true); + } else { + $smarty->_eval($php_resource); + } + } + + $function_name = $smarty->_plugins['insert'][$name][0]; + if (empty($args['assign'])) { + $replace = $function_name($args, $smarty); + } else { + $smarty->assign($args['assign'], $function_name($args, $smarty)); + $replace = ''; + } + + $params['results'] = substr_replace($params['results'], $replace, strpos($params['results'], $cached_inserts[$i]), strlen($cached_inserts[$i])); + if ($smarty->debugging) { + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $smarty->_smarty_debug_info[] = array('type' => 'insert', + 'filename' => 'insert_'.$name, + 'depth' => $smarty->_inclusion_depth, + 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $debug_start_time); + } + } + + return $params['results']; +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.process_compiled_include.php b/onyx2/modules/templates/smarty/internals/core.process_compiled_include.php new file mode 100644 index 0000000..904d597 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.process_compiled_include.php @@ -0,0 +1,37 @@ +_cache_including; + $smarty->_cache_including = true; + + $_return = $params['results']; + + foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) { + $smarty->_include($_include_file_path, true); + } + + foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) { + $_return = preg_replace_callback('!(\{nocache\:('.$_cache_serial.')#(\d+)\})!s', + array(&$smarty, '_process_compiled_include_callback'), + $_return); + } + $smarty->_cache_including = $_cache_including; + return $_return; +} + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.read_cache_file.php b/onyx2/modules/templates/smarty/internals/core.read_cache_file.php new file mode 100644 index 0000000..c60e113 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.read_cache_file.php @@ -0,0 +1,101 @@ +force_compile) { + // force compile enabled, always regenerate + return false; + } + + if (isset($content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']])) { + list($params['results'], $smarty->_cache_info) = $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']]; + return true; + } + + if (!empty($smarty->cache_handler_func)) { + // use cache_handler function + call_user_func_array($smarty->cache_handler_func, + array('read', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], null)); + } else { + // use local cache file + $_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']); + $_cache_file = $smarty->_get_auto_filename($smarty->cache_dir, $params['tpl_file'], $_auto_id); + $params['results'] = $smarty->_read_file($_cache_file); + } + + if (empty($params['results'])) { + // nothing to parse (error?), regenerate cache + return false; + } + + $_contents = $params['results']; + $_info_start = strpos($_contents, "\n") + 1; + $_info_len = (int)substr($_contents, 0, $_info_start - 1); + $_cache_info = unserialize(substr($_contents, $_info_start, $_info_len)); + $params['results'] = substr($_contents, $_info_start + $_info_len); + + if ($smarty->caching == 2 && isset ($_cache_info['expires'])){ + // caching by expiration time + if ($_cache_info['expires'] > -1 && (time() > $_cache_info['expires'])) { + // cache expired, regenerate + return false; + } + } else { + // caching by lifetime + if ($smarty->cache_lifetime > -1 && (time() - $_cache_info['timestamp'] > $smarty->cache_lifetime)) { + // cache expired, regenerate + return false; + } + } + + if ($smarty->compile_check) { + $_params = array('get_source' => false, 'quiet'=>true); + foreach (array_keys($_cache_info['template']) as $_template_dep) { + $_params['resource_name'] = $_template_dep; + if (!$smarty->_fetch_resource_info($_params) || $_cache_info['timestamp'] < $_params['resource_timestamp']) { + // template file has changed, regenerate cache + return false; + } + } + + if (isset($_cache_info['config'])) { + $_params = array('resource_base_path' => $smarty->config_dir, 'get_source' => false, 'quiet'=>true); + foreach (array_keys($_cache_info['config']) as $_config_dep) { + $_params['resource_name'] = $_config_dep; + if (!$smarty->_fetch_resource_info($_params) || $_cache_info['timestamp'] < $_params['resource_timestamp']) { + // config file has changed, regenerate cache + return false; + } + } + } + } + + $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']] = array($params['results'], $_cache_info); + + $smarty->_cache_info = $_cache_info; + return true; +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.rm_auto.php b/onyx2/modules/templates/smarty/internals/core.rm_auto.php new file mode 100644 index 0000000..b251f64 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.rm_auto.php @@ -0,0 +1,71 @@ + $params['auto_base'], + 'level' => 0, + 'exp_time' => $params['exp_time'] + ); + require_once(SMARTY_CORE_DIR . 'core.rmdir.php'); + $_res = smarty_core_rmdir($_params, $smarty); + } else { + $_tname = $smarty->_get_auto_filename($params['auto_base'], $params['auto_source'], $params['auto_id']); + + if(isset($params['auto_source'])) { + if (isset($params['extensions'])) { + $_res = false; + foreach ((array)$params['extensions'] as $_extension) + $_res |= $smarty->_unlink($_tname.$_extension, $params['exp_time']); + } else { + $_res = $smarty->_unlink($_tname, $params['exp_time']); + } + } elseif ($smarty->use_sub_dirs) { + $_params = array( + 'dirname' => $_tname, + 'level' => 1, + 'exp_time' => $params['exp_time'] + ); + require_once(SMARTY_CORE_DIR . 'core.rmdir.php'); + $_res = smarty_core_rmdir($_params, $smarty); + } else { + // remove matching file names + $_handle = opendir($params['auto_base']); + $_res = true; + while (false !== ($_filename = readdir($_handle))) { + if($_filename == '.' || $_filename == '..') { + continue; + } elseif (substr($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, 0, strlen($_tname)) == $_tname) { + $_res &= (bool)$smarty->_unlink($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, $params['exp_time']); + } + } + } + } + + return $_res; +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.rmdir.php b/onyx2/modules/templates/smarty/internals/core.rmdir.php new file mode 100644 index 0000000..2166c44 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.rmdir.php @@ -0,0 +1,54 @@ + keep root) + * WARNING: no tests, it will try to remove what you tell it! + * + * @param string $dirname + * @param integer $level + * @param integer $exp_time + * @return boolean + */ + +// $dirname, $level = 1, $exp_time = null + +function smarty_core_rmdir($params, &$smarty) +{ + if(!isset($params['level'])) { $params['level'] = 1; } + if(!isset($params['exp_time'])) { $params['exp_time'] = null; } + + if($_handle = @opendir($params['dirname'])) { + + while (false !== ($_entry = readdir($_handle))) { + if ($_entry != '.' && $_entry != '..') { + if (@is_dir($params['dirname'] . DIRECTORY_SEPARATOR . $_entry)) { + $_params = array( + 'dirname' => $params['dirname'] . DIRECTORY_SEPARATOR . $_entry, + 'level' => $params['level'] + 1, + 'exp_time' => $params['exp_time'] + ); + smarty_core_rmdir($_params, $smarty); + } + else { + $smarty->_unlink($params['dirname'] . DIRECTORY_SEPARATOR . $_entry, $params['exp_time']); + } + } + } + closedir($_handle); + } + + if ($params['level']) { + return @rmdir($params['dirname']); + } + return (bool)$_handle; + +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.run_insert_handler.php b/onyx2/modules/templates/smarty/internals/core.run_insert_handler.php new file mode 100644 index 0000000..71c3845 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.run_insert_handler.php @@ -0,0 +1,71 @@ +debugging) { + $_params = array(); + $_debug_start_time = smarty_core_get_microtime($_params, $smarty); + } + + if ($smarty->caching) { + $_arg_string = serialize($params['args']); + $_name = $params['args']['name']; + if (!isset($smarty->_cache_info['insert_tags'][$_name])) { + $smarty->_cache_info['insert_tags'][$_name] = array('insert', + $_name, + $smarty->_plugins['insert'][$_name][1], + $smarty->_plugins['insert'][$_name][2], + !empty($params['args']['script']) ? true : false); + } + return $smarty->_smarty_md5."{insert_cache $_arg_string}".$smarty->_smarty_md5; + } else { + if (isset($params['args']['script'])) { + $_params = array('resource_name' => $smarty->_dequote($params['args']['script'])); + require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php'); + if(!smarty_core_get_php_resource($_params, $smarty)) { + return false; + } + + if ($_params['resource_type'] == 'file') { + $smarty->_include($_params['php_resource'], true); + } else { + $smarty->_eval($_params['php_resource']); + } + unset($params['args']['script']); + } + + $_funcname = $smarty->_plugins['insert'][$params['args']['name']][0]; + $_content = $_funcname($params['args'], $smarty); + if ($smarty->debugging) { + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $smarty->_smarty_debug_info[] = array('type' => 'insert', + 'filename' => 'insert_'.$params['args']['name'], + 'depth' => $smarty->_inclusion_depth, + 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time); + } + + if (!empty($params['args']["assign"])) { + $smarty->assign($params['args']["assign"], $_content); + } else { + return $_content; + } + } +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.smarty_include_php.php b/onyx2/modules/templates/smarty/internals/core.smarty_include_php.php new file mode 100644 index 0000000..30c6e76 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.smarty_include_php.php @@ -0,0 +1,50 @@ + $params['smarty_file']); + require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php'); + smarty_core_get_php_resource($_params, $smarty); + $_smarty_resource_type = $_params['resource_type']; + $_smarty_php_resource = $_params['php_resource']; + + if (!empty($params['smarty_assign'])) { + ob_start(); + if ($_smarty_resource_type == 'file') { + $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']); + } else { + $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']); + } + $smarty->assign($params['smarty_assign'], ob_get_contents()); + ob_end_clean(); + } else { + if ($_smarty_resource_type == 'file') { + $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']); + } else { + $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']); + } + } +} + + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.write_cache_file.php b/onyx2/modules/templates/smarty/internals/core.write_cache_file.php new file mode 100644 index 0000000..fa3cdd7 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.write_cache_file.php @@ -0,0 +1,96 @@ +_cache_info['timestamp'] = time(); + if ($smarty->cache_lifetime > -1){ + // expiration set + $smarty->_cache_info['expires'] = $smarty->_cache_info['timestamp'] + $smarty->cache_lifetime; + } else { + // cache will never expire + $smarty->_cache_info['expires'] = -1; + } + + // collapse nocache.../nocache-tags + if (preg_match_all('!\{(/?)nocache\:[0-9a-f]{32}#\d+\}!', $params['results'], $match, PREG_PATTERN_ORDER)) { + // remove everything between every pair of outermost noache.../nocache-tags + // and replace it by a single nocache-tag + // this new nocache-tag will be replaced by dynamic contents in + // smarty_core_process_compiled_includes() on a cache-read + + $match_count = count($match[0]); + $results = preg_split('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!', $params['results'], -1, PREG_SPLIT_DELIM_CAPTURE); + + $level = 0; + $j = 0; + for ($i=0, $results_count = count($results); $i < $results_count && $j < $match_count; $i++) { + if ($results[$i] == $match[0][$j]) { + // nocache tag + if ($match[1][$j]) { // closing tag + $level--; + unset($results[$i]); + } else { // opening tag + if ($level++ > 0) unset($results[$i]); + } + $j++; + } elseif ($level > 0) { + unset($results[$i]); + } + } + $params['results'] = implode('', $results); + } + $smarty->_cache_info['cache_serials'] = $smarty->_cache_serials; + + // prepend the cache header info into cache file + $_cache_info = serialize($smarty->_cache_info); + $params['results'] = strlen($_cache_info) . "\n" . $_cache_info . $params['results']; + + if (!empty($smarty->cache_handler_func)) { + // use cache_handler function + call_user_func_array($smarty->cache_handler_func, + array('write', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], $smarty->_cache_info['expires'])); + } else { + // use local cache file + + if(!@is_writable($smarty->cache_dir)) { + // cache_dir not writable, see if it exists + if(!@is_dir($smarty->cache_dir)) { + $smarty->trigger_error('the $cache_dir \'' . $smarty->cache_dir . '\' does not exist, or is not a directory.', E_USER_ERROR); + return false; + } + $smarty->trigger_error('unable to write to $cache_dir \'' . realpath($smarty->cache_dir) . '\'. Be sure $cache_dir is writable by the web server user.', E_USER_ERROR); + return false; + } + + $_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']); + $_cache_file = $smarty->_get_auto_filename($smarty->cache_dir, $params['tpl_file'], $_auto_id); + $_params = array('filename' => $_cache_file, 'contents' => $params['results'], 'create_dirs' => true); + require_once(SMARTY_CORE_DIR . 'core.write_file.php'); + smarty_core_write_file($_params, $smarty); + return true; + } +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.write_compiled_include.php b/onyx2/modules/templates/smarty/internals/core.write_compiled_include.php new file mode 100644 index 0000000..c14adb5 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.write_compiled_include.php @@ -0,0 +1,91 @@ +caching && \!\$this->_cache_including\)\: echo \'\{nocache\:('.$params['cache_serial'].')#(\d+)\}\'; endif;'; + $_tag_end = 'if \(\$this->caching && \!\$this->_cache_including\)\: echo \'\{/nocache\:(\\2)#(\\3)\}\'; endif;'; + + preg_match_all('!('.$_tag_start.'(.*)'.$_tag_end.')!Us', + $params['compiled_content'], $_match_source, PREG_SET_ORDER); + + // no nocache-parts found: done + if (count($_match_source)==0) return; + + // convert the matched php-code to functions + $_include_compiled = "_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n"; + $_include_compiled .= " compiled from " . strtr(urlencode($params['resource_name']), array('%2F'=>'/', '%3A'=>':')) . " */\n\n"; + + $_compile_path = $params['include_file_path']; + + $smarty->_cache_serials[$_compile_path] = $params['cache_serial']; + $_include_compiled .= "\$this->_cache_serials['".$_compile_path."'] = '".$params['cache_serial']."';\n\n?>"; + + $_include_compiled .= $params['plugins_code']; + $_include_compiled .= "= 5.0) ? '_smarty' : 'this'; + for ($_i = 0, $_for_max = count($_match_source); $_i < $_for_max; $_i++) { + $_match =& $_match_source[$_i]; + $source = $_match[4]; + if ($this_varname == '_smarty') { + /* rename $this to $_smarty in the sourcecode */ + $tokens = token_get_all('\n"; + + $_params = array('filename' => $_compile_path, + 'contents' => $_include_compiled, 'create_dirs' => true); + + require_once(SMARTY_CORE_DIR . 'core.write_file.php'); + smarty_core_write_file($_params, $smarty); + return true; +} + + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.write_compiled_resource.php b/onyx2/modules/templates/smarty/internals/core.write_compiled_resource.php new file mode 100644 index 0000000..b902eff --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.write_compiled_resource.php @@ -0,0 +1,35 @@ +compile_dir)) { + // compile_dir not writable, see if it exists + if(!@is_dir($smarty->compile_dir)) { + $smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR); + return false; + } + $smarty->trigger_error('unable to write to $compile_dir \'' . realpath($smarty->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR); + return false; + } + + $_params = array('filename' => $params['compile_path'], 'contents' => $params['compiled_content'], 'create_dirs' => true); + require_once(SMARTY_CORE_DIR . 'core.write_file.php'); + smarty_core_write_file($_params, $smarty); + return true; +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/internals/core.write_file.php b/onyx2/modules/templates/smarty/internals/core.write_file.php new file mode 100644 index 0000000..8a3a3b3 --- /dev/null +++ b/onyx2/modules/templates/smarty/internals/core.write_file.php @@ -0,0 +1,54 @@ + $_dirname); + require_once(SMARTY_CORE_DIR . 'core.create_dir_structure.php'); + smarty_core_create_dir_structure($_params, $smarty); + } + + // write to tmp file, then rename it to avoid file locking race condition + $_tmp_file = tempnam($_dirname, 'wrt'); + + if (!($fd = @fopen($_tmp_file, 'wb'))) { + $_tmp_file = $_dirname . DIRECTORY_SEPARATOR . uniqid('wrt'); + if (!($fd = @fopen($_tmp_file, 'wb'))) { + $smarty->trigger_error("problem writing temporary file '$_tmp_file'"); + return false; + } + } + + fwrite($fd, $params['contents']); + fclose($fd); + + if (DIRECTORY_SEPARATOR == '\\' || !@rename($_tmp_file, $params['filename'])) { + // On platforms and filesystems that cannot overwrite with rename() + // delete the file before renaming it -- because windows always suffers + // this, it is short-circuited to avoid the initial rename() attempt + @unlink($params['filename']); + @rename($_tmp_file, $params['filename']); + } + @chmod($params['filename'], $smarty->_file_perms); + + return true; +} + +/* vim: set expandtab: */ + +?> \ No newline at end of file diff --git a/onyx2/modules/templates/smarty/plugins/block.textformat.php b/onyx2/modules/templates/smarty/plugins/block.textformat.php new file mode 100644 index 0000000..8cd010a --- /dev/null +++ b/onyx2/modules/templates/smarty/plugins/block.textformat.php @@ -0,0 +1,103 @@ + + * Name: textformat
          + * Purpose: format text a certain way with preset styles + * or custom wrap/indent settings
          + * @link http://smarty.php.net/manual/en/language.function.textformat.php {textformat} + * (Smarty online manual) + * @param array + *
          + * Params:   style: string (email)
          + *           indent: integer (0)
          + *           wrap: integer (80)
          + *           wrap_char string ("\n")
          + *           indent_char: string (" ")
          + *           wrap_boundary: boolean (true)
          + * 
          + * @author Monte Ohrt + * @param string contents of the block + * @param Smarty clever simulation of a method + * @return string string $content re-formatted + */ +function smarty_block_textformat($params, $content, &$smarty) +{ + if (is_null($content)) { + return; + } + + $style = null; + $indent = 0; + $indent_first = 0; + $indent_char = ' '; + $wrap = 80; + $wrap_char = "\n"; + $wrap_cut = false; + $assign = null; + + foreach ($params as $_key => $_val) { + switch ($_key) { + case 'style': + case 'indent_char': + case 'wrap_char': + case 'assign': + $$_key = (string)$_val; + break; + + case 'indent': + case 'indent_first': + case 'wrap': + $$_key = (int)$_val; + break; + + case 'wrap_cut': + $$_key = (bool)$_val; + break; + + default: + $smarty->trigger_error("textformat: unknown attribute '$_key'"); + } + } + + if ($style == 'email') { + $wrap = 72; + } + + // split into paragraphs + $_paragraphs = preg_split('![\r\n][\r\n]!',$content); + $_output = ''; + + for($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) { + if ($_paragraphs[$_x] == '') { + continue; + } + // convert mult. spaces & special chars to single space + $_paragraphs[$_x] = preg_replace(array('!\s+!','!(^\s+)|(\s+$)!'), array(' ',''), $_paragraphs[$_x]); + // indent first line + if($indent_first > 0) { + $_paragraphs[$_x] = str_repeat($indent_char, $indent_first) . $_paragraphs[$_x]; + } + // wordwrap sentences + $_paragraphs[$_x] = wordwrap($_paragraphs[$_x], $wrap - $indent, $wrap_char, $wrap_cut); + // indent lines + if($indent > 0) { + $_paragraphs[$_x] = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraphs[$_x]); + } + } + $_output = implode($wrap_char . $wrap_char, $_paragraphs); + + return $assign ? $smarty->assign($assign, $_output) : $_output; + +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/plugins/compiler.assign.php b/onyx2/modules/templates/smarty/plugins/compiler.assign.php new file mode 100644 index 0000000..abef377 --- /dev/null +++ b/onyx2/modules/templates/smarty/plugins/compiler.assign.php @@ -0,0 +1,40 @@ + + * Name: assign
          + * Purpose: assign a value to a template variable + * @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign} + * (Smarty online manual) + * @author Monte Ohrt (initial author) + * @author messju mohr (conversion to compiler function) + * @param string containing var-attribute and value-attribute + * @param Smarty_Compiler + */ +function smarty_compiler_assign($tag_attrs, &$compiler) +{ + $_params = $compiler->_parse_attrs($tag_attrs); + + if (!isset($_params['var'])) { + $compiler->_syntax_error("assign: missing 'var' parameter", E_USER_WARNING); + return; + } + + if (!isset($_params['value'])) { + $compiler->_syntax_error("assign: missing 'value' parameter", E_USER_WARNING); + return; + } + + return "\$this->assign({$_params['var']}, {$_params['value']});"; +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/plugins/function.assign_debug_info.php b/onyx2/modules/templates/smarty/plugins/function.assign_debug_info.php new file mode 100644 index 0000000..6540498 --- /dev/null +++ b/onyx2/modules/templates/smarty/plugins/function.assign_debug_info.php @@ -0,0 +1,40 @@ + + * Name: assign_debug_info
          + * Purpose: assign debug info to the template
          + * @author Monte Ohrt + * @param array unused in this plugin, this plugin uses {@link Smarty::$_config}, + * {@link Smarty::$_tpl_vars} and {@link Smarty::$_smarty_debug_info} + * @param Smarty + */ +function smarty_function_assign_debug_info($params, &$smarty) +{ + $assigned_vars = $smarty->_tpl_vars; + ksort($assigned_vars); + if (@is_array($smarty->_config[0])) { + $config_vars = $smarty->_config[0]; + ksort($config_vars); + $smarty->assign("_debug_config_keys", array_keys($config_vars)); + $smarty->assign("_debug_config_vals", array_values($config_vars)); + } + + $included_templates = $smarty->_smarty_debug_info; + + $smarty->assign("_debug_keys", array_keys($assigned_vars)); + $smarty->assign("_debug_vals", array_values($assigned_vars)); + + $smarty->assign("_debug_tpls", $included_templates); +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/plugins/function.config_load.php b/onyx2/modules/templates/smarty/plugins/function.config_load.php new file mode 100644 index 0000000..db89f63 --- /dev/null +++ b/onyx2/modules/templates/smarty/plugins/function.config_load.php @@ -0,0 +1,142 @@ + + * Name: config_load
          + * Purpose: load config file vars + * @link http://smarty.php.net/manual/en/language.function.config.load.php {config_load} + * (Smarty online manual) + * @author Monte Ohrt + * @author messju mohr (added use of resources) + * @param array Format: + *
          + * array('file' => required config file name,
          + *       'section' => optional config file section to load
          + *       'scope' => local/parent/global
          + *       'global' => overrides scope, setting to parent if true)
          + * 
          + * @param Smarty + */ +function smarty_function_config_load($params, &$smarty) +{ + if ($smarty->debugging) { + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $_debug_start_time = smarty_core_get_microtime($_params, $smarty); + } + + $_file = isset($params['file']) ? $smarty->_dequote($params['file']) : null; + $_section = isset($params['section']) ? $smarty->_dequote($params['section']) : null; + $_scope = isset($params['scope']) ? $smarty->_dequote($params['scope']) : 'global'; + $_global = isset($params['global']) ? $smarty->_dequote($params['global']) : false; + + if (!isset($_file) || strlen($_file) == 0) { + $smarty->trigger_error("missing 'file' attribute in config_load tag", E_USER_ERROR, __FILE__, __LINE__); + } + + if (isset($_scope)) { + if ($_scope != 'local' && + $_scope != 'parent' && + $_scope != 'global') { + $smarty->trigger_error("invalid 'scope' attribute value", E_USER_ERROR, __FILE__, __LINE__); + } + } else { + if ($_global) { + $_scope = 'parent'; + } else { + $_scope = 'local'; + } + } + + $_params = array('resource_name' => $_file, + 'resource_base_path' => $smarty->config_dir, + 'get_source' => false); + $smarty->_parse_resource_name($_params); + $_file_path = $_params['resource_type'] . ':' . $_params['resource_name']; + if (isset($_section)) + $_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section); + else + $_compile_file = $smarty->_get_compile_path($_file_path); + + if($smarty->force_compile || !file_exists($_compile_file)) { + $_compile = true; + } elseif ($smarty->compile_check) { + $_params = array('resource_name' => $_file, + 'resource_base_path' => $smarty->config_dir, + 'get_source' => false); + $_compile = $smarty->_fetch_resource_info($_params) && + $_params['resource_timestamp'] > filemtime($_compile_file); + } else { + $_compile = false; + } + + if($_compile) { + // compile config file + if(!is_object($smarty->_conf_obj)) { + require_once SMARTY_DIR . $smarty->config_class . '.class.php'; + $smarty->_conf_obj = new $smarty->config_class(); + $smarty->_conf_obj->overwrite = $smarty->config_overwrite; + $smarty->_conf_obj->booleanize = $smarty->config_booleanize; + $smarty->_conf_obj->read_hidden = $smarty->config_read_hidden; + $smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines; + } + + $_params = array('resource_name' => $_file, + 'resource_base_path' => $smarty->config_dir, + $_params['get_source'] = true); + if (!$smarty->_fetch_resource_info($_params)) { + return; + } + $smarty->_conf_obj->set_file_contents($_file, $_params['source_content']); + $_config_vars = array_merge($smarty->_conf_obj->get($_file), + $smarty->_conf_obj->get($_file, $_section)); + if(function_exists('var_export')) { + $_output = ''; + } else { + $_output = ''\\\'', '\\'=>'\\\\')) . '\'); ?>'; + } + $_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => $_params['resource_timestamp'])); + require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php'); + smarty_core_write_compiled_resource($_params, $smarty); + } else { + include($_compile_file); + } + + if ($smarty->caching) { + $smarty->_cache_info['config'][$_file] = true; + } + + $smarty->_config[0]['vars'] = @array_merge($smarty->_config[0]['vars'], $_config_vars); + $smarty->_config[0]['files'][$_file] = true; + + if ($_scope == 'parent') { + $smarty->_config[1]['vars'] = @array_merge($smarty->_config[1]['vars'], $_config_vars); + $smarty->_config[1]['files'][$_file] = true; + } else if ($_scope == 'global') { + for ($i = 1, $for_max = count($smarty->_config); $i < $for_max; $i++) { + $smarty->_config[$i]['vars'] = @array_merge($smarty->_config[$i]['vars'], $_config_vars); + $smarty->_config[$i]['files'][$_file] = true; + } + } + + if ($smarty->debugging) { + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $smarty->_smarty_debug_info[] = array('type' => 'config', + 'filename' => $_file.' ['.$_section.'] '.$_scope, + 'depth' => $smarty->_inclusion_depth, + 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time); + } + +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/plugins/function.counter.php b/onyx2/modules/templates/smarty/plugins/function.counter.php new file mode 100644 index 0000000..1f26db5 --- /dev/null +++ b/onyx2/modules/templates/smarty/plugins/function.counter.php @@ -0,0 +1,80 @@ + + * Name: counter
          + * Purpose: print out a counter value + * @author Monte Ohrt + * @link http://smarty.php.net/manual/en/language.function.counter.php {counter} + * (Smarty online manual) + * @param array parameters + * @param Smarty + * @return string|null + */ +function smarty_function_counter($params, &$smarty) +{ + static $counters = array(); + + $name = (isset($params['name'])) ? $params['name'] : 'default'; + if (!isset($counters[$name])) { + $counters[$name] = array( + 'start'=>1, + 'skip'=>1, + 'direction'=>'up', + 'count'=>1 + ); + } + $counter =& $counters[$name]; + + if (isset($params['start'])) { + $counter['start'] = $counter['count'] = (int)$params['start']; + } + + if (!empty($params['assign'])) { + $counter['assign'] = $params['assign']; + } + + if (isset($counter['assign'])) { + $smarty->assign($counter['assign'], $counter['count']); + } + + if (isset($params['print'])) { + $print = (bool)$params['print']; + } else { + $print = empty($counter['assign']); + } + + if ($print) { + $retval = $counter['count']; + } else { + $retval = null; + } + + if (isset($params['skip'])) { + $counter['skip'] = $params['skip']; + } + + if (isset($params['direction'])) { + $counter['direction'] = $params['direction']; + } + + if ($counter['direction'] == "down") + $counter['count'] -= $counter['skip']; + else + $counter['count'] += $counter['skip']; + + return $retval; + +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/plugins/function.cycle.php b/onyx2/modules/templates/smarty/plugins/function.cycle.php new file mode 100644 index 0000000..fe78bb8 --- /dev/null +++ b/onyx2/modules/templates/smarty/plugins/function.cycle.php @@ -0,0 +1,102 @@ + + * Name: cycle
          + * Date: May 3, 2002
          + * Purpose: cycle through given values
          + * Input: + * - name = name of cycle (optional) + * - values = comma separated list of values to cycle, + * or an array of values to cycle + * (this can be left out for subsequent calls) + * - reset = boolean - resets given var to true + * - print = boolean - print var or not. default is true + * - advance = boolean - whether or not to advance the cycle + * - delimiter = the value delimiter, default is "," + * - assign = boolean, assigns to template var instead of + * printed. + * + * Examples:
          + *
          + * {cycle values="#eeeeee,#d0d0d0d"}
          + * {cycle name=row values="one,two,three" reset=true}
          + * {cycle name=row}
          + * 
          + * @link http://smarty.php.net/manual/en/language.function.cycle.php {cycle} + * (Smarty online manual) + * @author Monte Ohrt + * @author credit to Mark Priatel + * @author credit to Gerard + * @author credit to Jason Sweat + * @version 1.3 + * @param array + * @param Smarty + * @return string|null + */ +function smarty_function_cycle($params, &$smarty) +{ + static $cycle_vars; + + $name = (empty($params['name'])) ? 'default' : $params['name']; + $print = (isset($params['print'])) ? (bool)$params['print'] : true; + $advance = (isset($params['advance'])) ? (bool)$params['advance'] : true; + $reset = (isset($params['reset'])) ? (bool)$params['reset'] : false; + + if (!in_array('values', array_keys($params))) { + if(!isset($cycle_vars[$name]['values'])) { + $smarty->trigger_error("cycle: missing 'values' parameter"); + return; + } + } else { + if(isset($cycle_vars[$name]['values']) + && $cycle_vars[$name]['values'] != $params['values'] ) { + $cycle_vars[$name]['index'] = 0; + } + $cycle_vars[$name]['values'] = $params['values']; + } + + $cycle_vars[$name]['delimiter'] = (isset($params['delimiter'])) ? $params['delimiter'] : ','; + + if(is_array($cycle_vars[$name]['values'])) { + $cycle_array = $cycle_vars[$name]['values']; + } else { + $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']); + } + + if(!isset($cycle_vars[$name]['index']) || $reset ) { + $cycle_vars[$name]['index'] = 0; + } + + if (isset($params['assign'])) { + $print = false; + $smarty->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]); + } + + if($print) { + $retval = $cycle_array[$cycle_vars[$name]['index']]; + } else { + $retval = null; + } + + if($advance) { + if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) { + $cycle_vars[$name]['index'] = 0; + } else { + $cycle_vars[$name]['index']++; + } + } + + return $retval; +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/plugins/function.debug.php b/onyx2/modules/templates/smarty/plugins/function.debug.php new file mode 100644 index 0000000..4345230 --- /dev/null +++ b/onyx2/modules/templates/smarty/plugins/function.debug.php @@ -0,0 +1,35 @@ + + * Name: debug
          + * Date: July 1, 2002
          + * Purpose: popup debug window + * @link http://smarty.php.net/manual/en/language.function.debug.php {debug} + * (Smarty online manual) + * @author Monte Ohrt + * @version 1.0 + * @param array + * @param Smarty + * @return string output from {@link Smarty::_generate_debug_output()} + */ +function smarty_function_debug($params, &$smarty) +{ + if (isset($params['output'])) { + $smarty->assign('_smarty_debug_output', $params['output']); + } + require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php'); + return smarty_core_display_debug_console(null, $smarty); +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/plugins/function.eval.php b/onyx2/modules/templates/smarty/plugins/function.eval.php new file mode 100644 index 0000000..ff0472d --- /dev/null +++ b/onyx2/modules/templates/smarty/plugins/function.eval.php @@ -0,0 +1,49 @@ + + * Name: eval
          + * Purpose: evaluate a template variable as a template
          + * @link http://smarty.php.net/manual/en/language.function.eval.php {eval} + * (Smarty online manual) + * @author Monte Ohrt + * @param array + * @param Smarty + */ +function smarty_function_eval($params, &$smarty) +{ + + if (!isset($params['var'])) { + $smarty->trigger_error("eval: missing 'var' parameter"); + return; + } + + if($params['var'] == '') { + return; + } + + $smarty->_compile_source('evaluated template', $params['var'], $_var_compiled); + + ob_start(); + $smarty->_eval('?>' . $_var_compiled); + $_contents = ob_get_contents(); + ob_end_clean(); + + if (!empty($params['assign'])) { + $smarty->assign($params['assign'], $_contents); + } else { + return $_contents; + } +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/plugins/function.fetch.php b/onyx2/modules/templates/smarty/plugins/function.fetch.php new file mode 100644 index 0000000..81b1bfc --- /dev/null +++ b/onyx2/modules/templates/smarty/plugins/function.fetch.php @@ -0,0 +1,221 @@ + + * Name: fetch
          + * Purpose: fetch file, web or ftp data and display results + * @link http://smarty.php.net/manual/en/language.function.fetch.php {fetch} + * (Smarty online manual) + * @author Monte Ohrt + * @param array + * @param Smarty + * @return string|null if the assign parameter is passed, Smarty assigns the + * result to a template variable + */ +function smarty_function_fetch($params, &$smarty) +{ + if (empty($params['file'])) { + $smarty->_trigger_fatal_error("[plugin] parameter 'file' cannot be empty"); + return; + } + + $content = ''; + if ($smarty->security && !preg_match('!^(http|ftp)://!i', $params['file'])) { + $_params = array('resource_type' => 'file', 'resource_name' => $params['file']); + require_once(SMARTY_CORE_DIR . 'core.is_secure.php'); + if(!smarty_core_is_secure($_params, $smarty)) { + $smarty->_trigger_fatal_error('[plugin] (secure mode) fetch \'' . $params['file'] . '\' is not allowed'); + return; + } + + // fetch the file + if($fp = @fopen($params['file'],'r')) { + while(!feof($fp)) { + $content .= fgets ($fp,4096); + } + fclose($fp); + } else { + $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] . '\''); + return; + } + } else { + // not a local file + if(preg_match('!^http://!i',$params['file'])) { + // http fetch + if($uri_parts = parse_url($params['file'])) { + // set defaults + $host = $server_name = $uri_parts['host']; + $timeout = 30; + $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"; + $agent = "Smarty Template Engine ".$smarty->_version; + $referer = ""; + $uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/'; + $uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : ''; + $_is_proxy = false; + if(empty($uri_parts['port'])) { + $port = 80; + } else { + $port = $uri_parts['port']; + } + if(!empty($uri_parts['user'])) { + $user = $uri_parts['user']; + } + if(!empty($uri_parts['pass'])) { + $pass = $uri_parts['pass']; + } + // loop through parameters, setup headers + foreach($params as $param_key => $param_value) { + switch($param_key) { + case "file": + case "assign": + case "assign_headers": + break; + case "user": + if(!empty($param_value)) { + $user = $param_value; + } + break; + case "pass": + if(!empty($param_value)) { + $pass = $param_value; + } + break; + case "accept": + if(!empty($param_value)) { + $accept = $param_value; + } + break; + case "header": + if(!empty($param_value)) { + if(!preg_match('![\w\d-]+: .+!',$param_value)) { + $smarty->_trigger_fatal_error("[plugin] invalid header format '".$param_value."'"); + return; + } else { + $extra_headers[] = $param_value; + } + } + break; + case "proxy_host": + if(!empty($param_value)) { + $proxy_host = $param_value; + } + break; + case "proxy_port": + if(!preg_match('!\D!', $param_value)) { + $proxy_port = (int) $param_value; + } else { + $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'"); + return; + } + break; + case "agent": + if(!empty($param_value)) { + $agent = $param_value; + } + break; + case "referer": + if(!empty($param_value)) { + $referer = $param_value; + } + break; + case "timeout": + if(!preg_match('!\D!', $param_value)) { + $timeout = (int) $param_value; + } else { + $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'"); + return; + } + break; + default: + $smarty->_trigger_fatal_error("[plugin] unrecognized attribute '".$param_key."'"); + return; + } + } + if(!empty($proxy_host) && !empty($proxy_port)) { + $_is_proxy = true; + $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout); + } else { + $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout); + } + + if(!$fp) { + $smarty->_trigger_fatal_error("[plugin] unable to fetch: $errstr ($errno)"); + return; + } else { + if($_is_proxy) { + fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n"); + } else { + fputs($fp, "GET $uri HTTP/1.0\r\n"); + } + if(!empty($host)) { + fputs($fp, "Host: $host\r\n"); + } + if(!empty($accept)) { + fputs($fp, "Accept: $accept\r\n"); + } + if(!empty($agent)) { + fputs($fp, "User-Agent: $agent\r\n"); + } + if(!empty($referer)) { + fputs($fp, "Referer: $referer\r\n"); + } + if(isset($extra_headers) && is_array($extra_headers)) { + foreach($extra_headers as $curr_header) { + fputs($fp, $curr_header."\r\n"); + } + } + if(!empty($user) && !empty($pass)) { + fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n"); + } + + fputs($fp, "\r\n"); + while(!feof($fp)) { + $content .= fgets($fp,4096); + } + fclose($fp); + $csplit = split("\r\n\r\n",$content,2); + + $content = $csplit[1]; + + if(!empty($params['assign_headers'])) { + $smarty->assign($params['assign_headers'],split("\r\n",$csplit[0])); + } + } + } else { + $smarty->_trigger_fatal_error("[plugin] unable to parse URL, check syntax"); + return; + } + } else { + // ftp fetch + if($fp = @fopen($params['file'],'r')) { + while(!feof($fp)) { + $content .= fgets ($fp,4096); + } + fclose($fp); + } else { + $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] .'\''); + return; + } + } + + } + + + if (!empty($params['assign'])) { + $smarty->assign($params['assign'],$content); + } else { + return $content; + } +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/plugins/function.html_checkboxes.php b/onyx2/modules/templates/smarty/plugins/function.html_checkboxes.php new file mode 100644 index 0000000..ed8ad7f --- /dev/null +++ b/onyx2/modules/templates/smarty/plugins/function.html_checkboxes.php @@ -0,0 +1,143 @@ + + * Type: function
          + * Name: html_checkboxes
          + * Date: 24.Feb.2003
          + * Purpose: Prints out a list of checkbox input types
          + * Input:
          + * - name (optional) - string default "checkbox" + * - values (required) - array + * - options (optional) - associative array + * - checked (optional) - array default not set + * - separator (optional) - ie
          or   + * - output (optional) - the output next to each checkbox + * - assign (optional) - assign the output as an array to this variable + * Examples: + *
          + * {html_checkboxes values=$ids output=$names}
          + * {html_checkboxes values=$ids name='box' separator='
          ' output=$names} + * {html_checkboxes values=$ids checked=$checked separator='
          ' output=$names} + *
          + * @link http://smarty.php.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} + * (Smarty online manual) + * @author Christopher Kvarme + * @author credits to Monte Ohrt + * @version 1.0 + * @param array + * @param Smarty + * @return string + * @uses smarty_function_escape_special_chars() + */ +function smarty_function_html_checkboxes($params, &$smarty) +{ + require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); + + $name = 'checkbox'; + $values = null; + $options = null; + $selected = null; + $separator = ''; + $labels = true; + $output = null; + + $extra = ''; + + foreach($params as $_key => $_val) { + switch($_key) { + case 'name': + case 'separator': + $$_key = $_val; + break; + + case 'labels': + $$_key = (bool)$_val; + break; + + case 'options': + $$_key = (array)$_val; + break; + + case 'values': + case 'output': + $$_key = array_values((array)$_val); + break; + + case 'checked': + case 'selected': + $selected = array_map('strval', array_values((array)$_val)); + break; + + case 'checkboxes': + $smarty->trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING); + $options = (array)$_val; + break; + + case 'assign': + break; + + default: + if(!is_array($_val)) { + $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; + } else { + $smarty->trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + } + break; + } + } + + if (!isset($options) && !isset($values)) + return ''; /* raise error here? */ + + settype($selected, 'array'); + $_html_result = array(); + + if (isset($options)) { + + foreach ($options as $_key=>$_val) + $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels); + + + } else { + foreach ($values as $_i=>$_key) { + $_val = isset($output[$_i]) ? $output[$_i] : ''; + $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels); + } + + } + + if(!empty($params['assign'])) { + $smarty->assign($params['assign'], $_html_result); + } else { + return implode("\n",$_html_result); + } + +} + +function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels) { + $_output = ''; + if ($labels) $_output .= ''; + $_output .= $separator; + + return $_output; +} + +?> diff --git a/onyx2/modules/templates/smarty/plugins/function.html_image.php b/onyx2/modules/templates/smarty/plugins/function.html_image.php new file mode 100644 index 0000000..9abae72 --- /dev/null +++ b/onyx2/modules/templates/smarty/plugins/function.html_image.php @@ -0,0 +1,142 @@ + + * Name: html_image
          + * Date: Feb 24, 2003
          + * Purpose: format HTML tags for the image
          + * Input:
          + * - file = file (and path) of image (required) + * - height = image height (optional, default actual height) + * - width = image width (optional, default actual width) + * - basedir = base directory for absolute paths, default + * is environment variable DOCUMENT_ROOT + * - path_prefix = prefix for path output (optional, default empty) + * + * Examples: {html_image file="/images/masthead.gif"} + * Output: + * @link http://smarty.php.net/manual/en/language.function.html.image.php {html_image} + * (Smarty online manual) + * @author Monte Ohrt + * @author credits to Duda - wrote first image function + * in repository, helped with lots of functionality + * @version 1.0 + * @param array + * @param Smarty + * @return string + * @uses smarty_function_escape_special_chars() + */ +function smarty_function_html_image($params, &$smarty) +{ + require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); + + $alt = ''; + $file = ''; + $height = ''; + $width = ''; + $extra = ''; + $prefix = ''; + $suffix = ''; + $path_prefix = ''; + $server_vars = ($smarty->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS']; + $basedir = isset($server_vars['DOCUMENT_ROOT']) ? $server_vars['DOCUMENT_ROOT'] : ''; + foreach($params as $_key => $_val) { + switch($_key) { + case 'file': + case 'height': + case 'width': + case 'dpi': + case 'path_prefix': + case 'basedir': + $$_key = $_val; + break; + + case 'alt': + if(!is_array($_val)) { + $$_key = smarty_function_escape_special_chars($_val); + } else { + $smarty->trigger_error("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + } + break; + + case 'link': + case 'href': + $prefix = ''; + $suffix = ''; + break; + + default: + if(!is_array($_val)) { + $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; + } else { + $smarty->trigger_error("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + } + break; + } + } + + if (empty($file)) { + $smarty->trigger_error("html_image: missing 'file' parameter", E_USER_NOTICE); + return; + } + + if (substr($file,0,1) == '/') { + $_image_path = $basedir . $file; + } else { + $_image_path = $file; + } + + if(!isset($params['width']) || !isset($params['height'])) { + if(!$_image_data = @getimagesize($_image_path)) { + if(!file_exists($_image_path)) { + $smarty->trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE); + return; + } else if(!is_readable($_image_path)) { + $smarty->trigger_error("html_image: unable to read '$_image_path'", E_USER_NOTICE); + return; + } else { + $smarty->trigger_error("html_image: '$_image_path' is not a valid image file", E_USER_NOTICE); + return; + } + } + if ($smarty->security && + ($_params = array('resource_type' => 'file', 'resource_name' => $_image_path)) && + (require_once(SMARTY_CORE_DIR . 'core.is_secure.php')) && + (!smarty_core_is_secure($_params, $smarty)) ) { + $smarty->trigger_error("html_image: (secure) '$_image_path' not in secure directory", E_USER_NOTICE); + } + + if(!isset($params['width'])) { + $width = $_image_data[0]; + } + if(!isset($params['height'])) { + $height = $_image_data[1]; + } + + } + + if(isset($params['dpi'])) { + if(strstr($server_vars['HTTP_USER_AGENT'], 'Mac')) { + $dpi_default = 72; + } else { + $dpi_default = 96; + } + $_resize = $dpi_default/$params['dpi']; + $width = round($width * $_resize); + $height = round($height * $_resize); + } + + return $prefix . ''.$alt.'' . $suffix; +} + +/* vim: set expandtab: */ + +?> diff --git a/onyx2/modules/templates/smarty/plugins/function.html_options.php b/onyx2/modules/templates/smarty/plugins/function.html_options.php new file mode 100644 index 0000000..cebadde --- /dev/null +++ b/onyx2/modules/templates/smarty/plugins/function.html_options.php @@ -0,0 +1,122 @@ + + * Name: html_options
          + * Input:
          + * - name (optional) - string default "select" + * - values (required if no options supplied) - array + * - options (required if no values supplied) - associative array + * - selected (optional) - string default not set + * - output (required if not options supplied) - array + * Purpose: Prints the list of
          + + +
          +
          +{$script} + + + diff --git a/onyx2/tpl/cms/header.tpl b/onyx2/tpl/cms/header.tpl new file mode 100644 index 0000000..0e45290 --- /dev/null +++ b/onyx2/tpl/cms/header.tpl @@ -0,0 +1,28 @@ + + + + + + + + ::Halo-Battle:: - {$titre} + + + + + + +
          +
          + + +
          diff --git a/onyx2/tpl/cms/inscription.tpl b/onyx2/tpl/cms/inscription.tpl new file mode 100644 index 0000000..bd52013 --- /dev/null +++ b/onyx2/tpl/cms/inscription.tpl @@ -0,0 +1,52 @@ +{include file='cms/header.tpl'} + +
          +
          Informations
          +

          Bienvenue dans l'univers de Halo-Battle

          Afin de pouvoir jouer sur l'un des serveurs mis à votre disposition, veuillez remplir les champs ci-contre.

          Vous trouverez ici des informations pour vous aider tout au long de votre inscription.


          A bientôt dans le jeu
          Le staff de Halo-Battle

          +
          +
          +
          +
          Formulaire d'inscription
          +
          +
          + +
          +
          +
          +

          Race :
          + + + + + +
          + + + +
          +
          +
          +

          Génération ... +

          +

          +
          +
          +
          +
          + {if $erreurs} +
          +
          Impossible de valider votre inscription
          +
          +

          + {$erreurs} +

          +
          +
          + {/if} +{include file='cms/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/cms/maj.tpl b/onyx2/tpl/cms/maj.tpl new file mode 100644 index 0000000..822d2a8 --- /dev/null +++ b/onyx2/tpl/cms/maj.tpl @@ -0,0 +1,8 @@ +{include file='cms/header.tpl'} +
          +
          {$titre}
          +
          {$texte}
          +
          + +
          {$LANG.mod_inscription_texte|sprintf:$link.inscription:$link.inscription:$link.inscription}
          +{include file='cms/footer.tpl'} diff --git a/onyx2/tpl/cms/mini.tpl b/onyx2/tpl/cms/mini.tpl new file mode 100644 index 0000000..e9e0a3e --- /dev/null +++ b/onyx2/tpl/cms/mini.tpl @@ -0,0 +1,30 @@ +{include file='cms/header.tpl'} +
          +
          {$LANG.mod_login_titre}
          +
          +
          +
          + + + + + + + + + {$LANG.mod_login_forgotMdp} + +
          +
          +
          +
          + +
          {$LANG.mod_inscription_texte|sprintf:$link.inscription:$link.inscription:$link.inscription}
          +
          + Halo.fr +
          +{include file='cms/footer.tpl'} diff --git a/onyx2/tpl/cms/oubliemdp.tpl b/onyx2/tpl/cms/oubliemdp.tpl new file mode 100644 index 0000000..8ae1f48 --- /dev/null +++ b/onyx2/tpl/cms/oubliemdp.tpl @@ -0,0 +1,29 @@ +{include file='cms/header.tpl'} +
          +
          Informations
          +
          Oublie de mot de passe

          Complétez le formualaire ci-contre avec votre nom d'utilisateur et votre adresse électronique. Un nouveau mot de passe sera envoyé à votre adresse, vous permettant ainsi d'avoir de nouveau accès à votre compte.

          Pensez à changer ce nouveau mot de passe que vous ne retiendrez pas facilement, via la page option du jeu.

          +
          +
          +
          +
          Formulaire de réinitialisation de mot de passe
          +
          +
          + +
          +

          Génération ... +

          +
          +
          +
          +
          + {if $erreurs} +
          +
          Impossible de changer le mot de passe :
          +
          +

          + {$erreurs} +

          +
          +
          + {/if} +{include file='cms/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/cms/pilori.tpl b/onyx2/tpl/cms/pilori.tpl new file mode 100644 index 0000000..3213390 --- /dev/null +++ b/onyx2/tpl/cms/pilori.tpl @@ -0,0 +1,22 @@ +{include file='cms/header.tpl'} + + + + + + + + + + +{foreach from=$joueurs item=joueur} + + + + + + +{/foreach} + +
          UtilisateurRaisonFin du banissementOpérateur
          {$joueur.pseudo}{$joueur.raisonmv|escape}{if $joueur.mv == 3 || $joueur.last_visite == 2147483647}Définitif{else}{$joueur.last_visite+259200|date_format:"%a %d %B %Y %H:%M"|escape}{/if}{if $joueur.operateurmv}{mailto address=$joueur.mail encode="hex" text=$joueur.operateurmv}{else}Inconnu{/if}
          +{include file='cms/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/cms/secours.tpl b/onyx2/tpl/cms/secours.tpl new file mode 100644 index 0000000..0c1e6a1 --- /dev/null +++ b/onyx2/tpl/cms/secours.tpl @@ -0,0 +1,13 @@ +{include file='cms/header.tpl'} +
          +
          Connexion
          +
          + Sélectionnez votre galaxie :

          +{foreach from=$servers_name item=server_name key=key} + Galaxie {$server_name}
          +{/foreach} +
          +
          + +
          Le serveur de base de données est indisponible

          Le serveur de base de données n'étant actuellement pas en mesure d'assurer la génération des pages web, ni le processus de connexion ou d'inscription, utilisez les liens du cadre ci-contre pour accèder à la page de connexion de secours de votre serveur.

          Veuillez nous excuser pour la gène occasionnée, nous faisons notre possible pour rétablir le site au plus vite.

          Le Staff

          +{include file='cms/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/cms/test.tpl b/onyx2/tpl/cms/test.tpl new file mode 100644 index 0000000..4dc1f40 --- /dev/null +++ b/onyx2/tpl/cms/test.tpl @@ -0,0 +1,71 @@ +{include file='cms/header.tpl'} +
          +
          Connexion
          +
          Mot de passe oublié
          +
          + +
          INSCRIVEZ VOUS Rejoignez l'alliance ou engagez-vous

          DEFENDREZ VOUS L'HUMANITE OU LA DETRUIREZ VOUS?

          Repoussez l'ennemi et partez a la conquète des mondes-anneaux dans des univers vastes et riches basés sur l'univers du jeu vidéo Halo

          Une simple inscription gratuite et un navigateur internet sont demandés pour pouvoir participer a des batailles épiques!

          Cliquez ici pour vous inscrire En savoir plus
          + +
          +

          Actualités

          +

          15/06/07

          +
          + +

          Ghosts of Onyx dans : Halo Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. 9 commentaires PLUS >>

          +
          +
          + +

          Ghosts of Onyx dans : Halo Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. 9 commentaires PLUS >>

          +
          +
          + +

          Ghosts of Onyx dans : Halo Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. 9 commentaires PLUS >>

          +
          +

          14/06/07

          +
          + +

          Ghosts of Onyx dans : Halo Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. 9 commentaires PLUS >>

          +
          +
          + +

          Ghosts of Onyx dans : Halo Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. 9 commentaires PLUS >>

          +
          +
          + +

          Ghosts of Onyx dans : Halo Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. 9 commentaires PLUS >>

          +
          + +
          + +
          + +

          Ouverture de Halo-Battle " Votre Excellence...
          - J'ai demandé à ne pas être dérangé. J'espère que vous avez une bonne raison de venir me troubler dans mes méditations.
          - Votre Excellence... Il est enfin là.
          - Quoi donc ? Parle, 'Vatinree.
          - Ce pourquoi nous attendons en ce lieu depuis des années, Excellence ! C'est un jour béni par les Dieux !
          - Ainsi donc... Cela se peut-il ?... "


          Cette conversation entre ces deux Sangheili vous semble improbable ?
          Mais de quoi donc peuvent-ils discuter ?
          Ceux qui suivent Halo-Battle depuis longtemps auront peut-être la puce à l'oreille (ou peut-être avez-vous la puce à l'oreille tout court).
          Oui, cette fois, c'est bel et bien terminé : Halo-Battle va enfin voir le jour, après des années de rebondissements, d'espoirs incensés et d'efforts hors du commun pour donner un souffle de vie à ce projet.
          La chose assez paradoxale est que l'on peut voir cet heureux dénouement comme une sorte de fin en soit (pour ceux qui suivent depuis le début le projet par exemple), alors que ce n'est le début que d'une longue carrière et d'une volonté de tendre vers la perfection, en améliorant et nourrissant Halo-Battle d'idées et de suggestions toutes plus grandioses les unes que les autres.
          Préparez-vous donc non pas à finir le combat, mais à le commencer justement ! Rendez-vous le XX/XX/XXXX.
          9 commentaires PLUS >>

          +
          + +
          +
          Statistiques
          +
          Statistiques
          + +
          + +
          +
          +

          Sondage

          +
          Semaine du xx/xx au xx/xx
          +
          + + + + + + +
          +
          +
          +

          Dossiers

          +
          +

          DOSSIER HALO WARS Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam.

          + +
          +
          +{include file='cms/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/cms/vide.tpl b/onyx2/tpl/cms/vide.tpl new file mode 100644 index 0000000..85211ec --- /dev/null +++ b/onyx2/tpl/cms/vide.tpl @@ -0,0 +1,3 @@ +{include file='cms/header.tpl'} + {$contenu} +{include file='cms/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/accueil.tpl b/onyx2/tpl/game/accueil.tpl new file mode 100644 index 0000000..ebc5c25 --- /dev/null +++ b/onyx2/tpl/game/accueil.tpl @@ -0,0 +1,66 @@ +{include file='game/header.tpl'} +

          Événements

          + {if $multi}Multicompte : évitez toute interaction avec {foreach from=$multi item=cmpt key=key}{if $cmpt.id_util != $planete->id_user}{if $key > 0}, {/if}{$cmpt.pseudo}{/if}{/foreach} durant cette session.
          {/if} + {if $planete->mv < 0}Une demande de suppression de votre compte est en cours. Il sera supprimé sous 48h.
          Si vous n'avez pas demandé la suppression de votre compte, contactez un opérateur au plus vite.
          {/if} + Heure du serveur: {$datehb} +{foreach from=$radar item=flottes key=key} + {foreach from=$flottes.0 item=flotte key=key} + {if $flotte.mission == 1}

          attaque: Une flotte ennemie en provenance de {$flotte.nom_planete|escape} [{$flotte.start_galaxie}:{$flotte.start_ss}:{$flotte.start_position}] atteint la planète {$flottes.1.0|escape} [{$flottes.1.1}:{$flottes.1.2}:{$flottes.1.3}] dans {$flotte.arrive_time}

          + {elseif $flotte.mission == 2}

          transport: Une flotte en provenance de {$flotte.nom_planete|escape} [{$flotte.start_galaxie}:{$flotte.start_ss}:{$flotte.start_position}] atteint la planète {$flottes.1.0|escape} [{$flottes.1.1}:{$flottes.1.2}:{$flottes.1.3}] dans {$flotte.arrive_time}

          + {/if} + {/foreach} +{/foreach} + {if $alertMail >= 2}

          messagerie: {$alertMail} messages non lu

          + {elseif $alertMail >= 1}

          messagerie: {$alertMail} message non lu

          + {/if} +

          {if !$planete->nom_planete}Sans nom{/if}{$planete->nom_planete|escape} ({$planete->pseudo})

          + Planète +

          Infos

          + {if SURFACE == "planete"}

          Diamètre: {$diametre|separerNombres} km ({$planete->casesRest} case{if $planete->casesRest > 1}s{/if} disponible{if $planete->casesRest > 1}s{/if} sur {$planete->cases})

          {/if} +

          Race : {$planete->race}

          +

          position: {$planete->galaxie}.{$planete->ss}.{$planete->position}

          + {if SURFACE == "planete"} +

          population: {$planete->population|separerNombres}

          +

          crédits: {$planete->credits|separerNombres}

          + {/if} +

          Classement: {if $planete->place_points == '0'}non classé{else}{$planete->place_points}{if $planete->place_points == '1'}er{else}ème{/if}{/if} ({$points|separerNombres} points)

          + {if $alliance}

          Alliance: [{$alliance.tag|upper}] {$alliance.nom}

          {/if} + {if SURFACE == "planete"} +

          En cours sur la planète

          + {if $fileBat} +

          + {foreach from=$fileBat item=element} + {if $i == true} - {else}{assign var='i' value=true}Bâtiments : {/if}{$LANG.$race.batiments.noms_sing[$element.0]}{if $element.1} (démolition){/if} + {/foreach} +

          + {/if} + {if $fileCas} +

          + {foreach from=$fileCas item=element} + {if $j == true} - {else}{assign var='j' value=true}{$LANG.$race.batiments.noms_sing.9|ucfirst} : {/if}{$element.1} {if $element.1 > 1}{$LANG.$race.caserne.noms_pluriel[$element.0]}{else}{$LANG.$race.caserne.noms_sing[$element.0]}{/if}{if $element.2} (démantèlement){/if} + {/foreach} +

          + {/if} + {if $fileVais} +

          + {foreach from=$fileVais item=element} + {if $k == true} - {else}{assign var='k' value=true}{$LANG.$race.batiments.noms_sing.8|ucfirst} : {/if}{$element.1} {if $element.1 > 1}{$LANG.$race.vaisseaux.noms_pluriel[$element.0]}{else}{$LANG.$race.vaisseaux.noms_sing[$element.0]}{/if}{if $element.2} (démantèlement){/if} + {/foreach} +

          + {/if} + {if $fileTer} +

          + {foreach from=$fileTer item=element} + {if $l == true} - {else}{assign var='l' value=true}{$LANG.$race.batiments.noms_sing.7|ucfirst} : {/if}{$element.1} {if $element.1 > 1}{$LANG.$race.terrestre.noms_pluriel[$element.0]}{else}{$LANG.$race.terrestre.noms_sing[$element.0]}{/if}{if $element.2} (démantèlement){/if} + {/foreach} +

          + {/if} + {if $fileTech} +

          + {foreach from=$fileTech item=element} + {if $m == true} - {else}{assign var='m' value=true}{$LANG.$race.batiments.noms_sing.6|ucfirst} : {/if}{$LANG.$race.technologies.noms_sing[$element.0][$element.1]} + {/foreach} +

          + {/if} + {/if} +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/amis.tpl b/onyx2/tpl/game/amis.tpl new file mode 100644 index 0000000..382996c --- /dev/null +++ b/onyx2/tpl/game/amis.tpl @@ -0,0 +1,26 @@ +{include file='game/header.tpl'} +

          Amis existants

          + + + + + + + + +{foreach from=$destins item=destin} + + + + +{/foreach} + +
          Nom du joueurSupprimer
          {$destin.1|escape}Supprimer
          +

          Ajouter un ami

          +
          +
          +
          + +
          +
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/arbre.tpl b/onyx2/tpl/game/arbre.tpl new file mode 100644 index 0000000..94ecf19 --- /dev/null +++ b/onyx2/tpl/game/arbre.tpl @@ -0,0 +1,55 @@ +{include file='game/header.tpl'} +

          Arbre Technologique {$raceAff}

          + Race : Humains - Covenants +
          + Bâtiments +
          + + +{foreach from=$batiments key=key item=batiment} + +{/foreach} +
          Batiments (niveau)Technologies nécessaires (niveau actuel)
          {$LANG.$raceAff.batiments.noms_sing.$key|ucfirst} ({$batiment.niveau}) :{$batiment.etat}
          +
          + +{*} Technologies +
          + + +{foreach from=$technologies item=technologie} + +{/foreach} +
          Technologies (niveau)Technologies nécessaires (niveau actuel)
          {$technologie.nom} ({$technologie.niveau}) :{$technologie.etat}
          +
          {/*} + + {$LANG.$raceAff.batiments.noms_sing.9|ucfirst} +
          + + +{foreach from=$caserne key=key item=unite} + +{/foreach} +
          UnitéTechnologies nécessaires
          {$LANG.$raceAff.caserne.noms_sing.$key|ucfirst} ({$unite.niveau}) :{$unite.etat|ucfirst}
          +
          + + {$LANG.$raceAff.batiments.noms_sing.7|ucfirst} +
          + + +{foreach from=$unites key=key item=unite} + +{/foreach} +
          Véhicules/DéfensesTechnologies nécessaires (niveau actuel)
          {$LANG.$raceAff.terrestre.noms_sing.$key|ucfirst} ({$unite.niveau}) :{$unite.etat}
          +
          + + {$LANG.$raceAff.batiments.noms_sing.8|ucfirst} +
          + + +{foreach from=$vaisseaux key=key item=vaisseau} + +{/foreach} +
          VaisseauxTechnologies nécessaires (niveau actuel)
          {$LANG.$raceAff.vaisseaux.noms_sing.$key|ucfirst} ({$vaisseau.niveau}) :{$vaisseau.etat}
          + + +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/batiments.tpl b/onyx2/tpl/game/batiments.tpl new file mode 100644 index 0000000..1325a4b --- /dev/null +++ b/onyx2/tpl/game/batiments.tpl @@ -0,0 +1,47 @@ +{include file='game/header.tpl'} +

          File d'attente

          +
          +{if $file} +{foreach from=$file item=element key=key} + {$LANG.$race.batiments.noms_sing[$element.0]|ucfirst}{if $element.1} (démolition){/if} - - Annuler +{/foreach} +{else} Aucun bâtiment dans la file d'attente{/if} +
          +
          +

          Arbre des technologies


          +

          Bâtiments

          + +{foreach from=$batiments item=batiment} + + + + +{/foreach} +
          + + {$LANG.$race.batiments.noms_sing[$batiment.id]} + {$LANG.$race.batiments.descriptions[$batiment.id]} + + +
          + {$LANG.$race.batiments.noms_sing[$batiment.id]|ucfirst}{if $batiment.niveau > 0} (Niveau {$batiment.niveau}){/if}

          + {if $batiment.nec_metal > 0} + {if $batiment.nec_metal > $planete->metal}Coût {$LANG.$race.ressources.noms.metal} : {$batiment.nec_metal|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.metal} : {$batiment.nec_metal|separerNombres}
          {/if} + {/if} + {if $batiment.nec_cristal > 0} + {if $batiment.nec_cristal > $planete->cristal}Coût {$LANG.$race.ressources.noms.cristal} : {$batiment.nec_cristal|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.cristal} : {$batiment.nec_cristal|separerNombres}
          {/if} + {/if} + {if $batiment.nec_hydrogene > 0} + {if $batiment.nec_hydrogene > $planete->hydrogene}Coût {$LANG.$race.ressources.noms.hydrogene} : {$batiment.nec_hydrogene|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.hydrogene} : {$batiment.nec_hydrogene|separerNombres}
          {/if} + {/if} + Temps de construction : {$batiment.temps}

          + {if $batiment.nec_hydrogene > $planete->hydrogene || $batiment.nec_cristal > $planete->cristal || $batiment.nec_metal > $planete->metal}Ressources insuffisantes + {else}{if $planete->casesRest >= 1}Construire{/if}{/if} + {if $batiment.enfile !== false}Arrêter{/if} + {if $batiment.niveau > 0} Démolir un niveau{/if} +
          +
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/carte.tpl b/onyx2/tpl/game/carte.tpl new file mode 100644 index 0000000..99dcc82 --- /dev/null +++ b/onyx2/tpl/game/carte.tpl @@ -0,0 +1,34 @@ +{include file='game/header.tpl'} +

          Navigation

          +
          +

          Système Solaire

          + + + + + + + + + + + + + + + + + {foreach from=$carte item=plan} + + + + + + + + + + {/foreach} + +
          Système: {$position.0}:{$position.1}
          PositionNom planète
          Alliance
          Joueur
          RaceGouvernementDébris {$LANG.$race.ressources.noms.metal} | {$LANG.$race.ressources.noms.cristal}Fonctions
          {$plan.0}{if $plan.7}{$plan.1|escape}{else} {/if}{if $plan.1}{$plan.1|escape}
          {if $plan.6}[{$plan.6}]
          {/if}{$plan.5}{else} {/if}
          {if $plan.4}{$plan.4}{else} {/if}{if $plan.4}{$plan.6}{else} {/if}{if $plan.2}{$plan.2}{else}0{/if} | {if $plan.3}{$plan.3}{else}0{/if}{if $plan.5}Message{else} {/if}
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/caserne.tpl b/onyx2/tpl/game/caserne.tpl new file mode 100644 index 0000000..fe9a5ee --- /dev/null +++ b/onyx2/tpl/game/caserne.tpl @@ -0,0 +1,54 @@ +{include file='game/header.tpl'} +

          File d'attente

          +
          +{if $file} +{foreach from=$file item=element key=key} + {if $i != true}Prochaine unité : + {/if} + {$element.1} {if $element.1 > 1}{$LANG.$race.caserne.noms_pluriel[$element.0]}{else}{$LANG.$race.caserne.noms_sing[$element.0]}{/if}{if $element.2} (démolition){/if} - + - Annuler un - Annuler tous +{/foreach} +{else} Aucune unité dans la file d'attente{/if} +
          +
          +

          Arbre des technologies


          +

          {$LANG.$race.batiments.noms_sing.9|ucfirst}

          +{if $unites} + +{foreach from=$unites item=unite} + + + + +{/foreach} +
          + + Unité terrestre + {$LANG.$race.caserne.descriptions[$unite.id]} + + +
          + {$LANG.$race.caserne.noms_sing[$unite.id]|ucfirst}{if $unite.nombre > 0} ({$unite.nombre|separerNombres} unité{if $unite.nombre > 1}s{/if}){/if}

          + {if $unite.nec_metal > 0} + {if $unite.nec_metal > $planete->metal}Coût {$LANG.$race.ressources.noms.metal} : {$unite.nec_metal|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.metal} : {$unite.nec_metal|separerNombres}
          {/if} + {/if} + {if $unite.nec_cristal > 0} + {if $unite.nec_cristal > $planete->cristal}Coût {$LANG.$race.ressources.noms.cristal} : {$unite.nec_cristal|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.cristal} : {$unite.nec_cristal|separerNombres}
          {/if} + {/if} + {if $unite.nec_hydrogene > 0} + {if $unite.nec_hydrogene > $planete->hydrogene}Coût {$LANG.$race.ressources.noms.hydrogene} : {$unite.nec_hydrogene|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.hydrogene} : {$unite.nec_hydrogene|separerNombres}
          {/if} + {/if} + Temps d'entraînement : {$unite.temps}

          +
          +
          + + +
          +
          +
          +
          +{else}
          Aucune unité à entraîner actuellement.
          {/if} +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/chantierspatial.tpl b/onyx2/tpl/game/chantierspatial.tpl new file mode 100644 index 0000000..8b644f0 --- /dev/null +++ b/onyx2/tpl/game/chantierspatial.tpl @@ -0,0 +1,54 @@ +{include file='game/header.tpl'} +

          File d'attente

          +
          +{if $file} +{foreach from=$file item=element key=key} + {if $i != true}Prochain vaisseau : + {/if} + {$element.1} {if $element.1 > 1}{$LANG.$race.vaisseaux.noms_pluriel[$element.0]}{else}{$LANG.$race.vaisseaux.noms_sing[$element.0]}{/if}{if $element.2} (démolition){/if} - + - Annuler un - Annuler tous +{/foreach} +{else} Aucun vaisseau dans la file d'attente{/if} +
          +
          +

          Arbre des technologies


          +

          Chantier spatial

          +{if $vaisseaux} + +{foreach from=$vaisseaux item=vaisseau} + + + + +{/foreach} +
          + + Vaisseaux + {$LANG.$race.vaisseaux.descriptions[$vaisseau.id]} + + +
          + {$LANG.$race.vaisseaux.noms_sing[$vaisseau.id]|ucfirst}{if $vaisseau.nombre > 0} ({$vaisseau.nombre} vaisseau{if $vaisseau.nombre > 1}x{/if}){/if}

          + {if $vaisseau.nec_metal > 0} + {if $vaisseau.nec_metal > $planete->metal}Coût {$LANG.$race.ressources.noms.metal} : {$vaisseau.nec_metal|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.metal} : {$vaisseau.nec_metal|separerNombres}
          {/if} + {/if} + {if $vaisseau.nec_cristal > 0} + {if $vaisseau.nec_cristal > $planete->cristal}Coût {$LANG.$race.ressources.noms.cristal} : {$vaisseau.nec_cristal|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.cristal} : {$vaisseau.nec_cristal|separerNombres}
          {/if} + {/if} + {if $vaisseau.nec_hydrogene > 0} + {if $vaisseau.nec_hydrogene > $planete->hydrogene}Coût {$LANG.$race.ressources.noms.hydrogene} : {$vaisseau.nec_hydrogene|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.hydrogene} : {$vaisseau.nec_hydrogene|separerNombres}
          {/if} + {/if} + Temps de construction : {$vaisseau.temps}

          +
          +
          + + +
          +
          +
          +
          +{else}
          Aucun vaisseau à construire actuellement.
          {/if} +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/chantierterrestre.tpl b/onyx2/tpl/game/chantierterrestre.tpl new file mode 100644 index 0000000..3214ccf --- /dev/null +++ b/onyx2/tpl/game/chantierterrestre.tpl @@ -0,0 +1,52 @@ +{include file='game/header.tpl'} +

          File d'attente

          +
          +{if $file} +{foreach from=$file item=element key=key} + {if $i != true}Prochaine {if $element.5}unité{else}défense{/if} : + {/if} + {$element.1} {if $element.1 > 1}{$LANG.$race.terrestre.noms_pluriel[$element.0]}{else}{$LANG.$race.terrestre.noms_sing[$element.0]}{/if}{if $element.2} (démolition){/if} - + - Annuler un - Annuler tous +{/foreach} +{else} Aucune unité dans la file d'attente{/if} +
          +
          +

          Arbre des technologies


          +

          Chantier terrestre

          + +{foreach from=$unites item=unite} + + + + +{/foreach} +
          + + Unité terrestre + {$LANG.$race.terrestre.descriptions[$unite.id]} + + +
          + {$LANG.$race.terrestre.noms_sing[$unite.id]|ucfirst}{if $unite.nombre > 0} ({$unite.nombre} unité{if $unite.nombre > 1}s{/if}){/if}

          + {if $unite.nec_metal > 0} + {if $unite.nec_metal > $planete->metal}Coût {$LANG.$race.ressources.noms.metal} : {$unite.nec_metal|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.metal} : {$unite.nec_metal|separerNombres}
          {/if} + {/if} + {if $unite.nec_cristal > 0} + {if $unite.nec_cristal > $planete->cristal}Coût {$LANG.$race.ressources.noms.cristal} : {$unite.nec_cristal|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.cristal} : {$unite.nec_cristal|separerNombres}
          {/if} + {/if} + {if $unite.nec_hydrogene > 0} + {if $unite.nec_hydrogene > $planete->hydrogene}Coût {$LANG.$race.ressources.noms.hydrogene} : {$unite.nec_hydrogene|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.hydrogene} : {$unite.nec_hydrogene|separerNombres}
          {/if} + {/if} + Temps de construction : {$unite.temps}

          +
          +
          + + +
          +
          +
          +
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/chat.tpl b/onyx2/tpl/game/chat.tpl new file mode 100644 index 0000000..076bf7d --- /dev/null +++ b/onyx2/tpl/game/chat.tpl @@ -0,0 +1,49 @@ +{include file='game/header.tpl'} +

          Chat

          + Le chat est désactivé pour le moment + +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/defenses.tpl b/onyx2/tpl/game/defenses.tpl new file mode 100644 index 0000000..338f39f --- /dev/null +++ b/onyx2/tpl/game/defenses.tpl @@ -0,0 +1,52 @@ +{include file='game/header.tpl'} +

          File d'attente

          +
          +{if $file} +{foreach from=$file item=element key=key} + {if $i != true}Prochaine {if $element.5}unité{else}défense{/if} : + {/if} + {$element.1} {if $element.1 > 1}{$LANG.$race.terrestre.noms_pluriel[$element.0]}{else}{$LANG.$race.terrestre.noms_sing[$element.0]}{/if}{if $element.2} (démolition){/if} - + - Annuler un - Annuler tous +{/foreach} +{else} Aucune défense dans la file d'attente{/if} +
          +
          +

          Arbre des technologies


          +

          Chantier terrestre

          + +{foreach from=$unites item=unite} + + + + +{/foreach} +
          + + Déeacute;fense + {$LANG.$race.terrestre.descriptions[$unite.id]} + + +
          + {$LANG.$race.terrestre.noms_sing[$unite.id]|ucfirst}{if $unite.nombre > 0} ({$unite.nombre} unité{if $unite.nombre > 1}s{/if}){/if}

          + {if $unite.nec_metal > 0} + {if $unite.nec_metal > $planete->metal}Coût {$LANG.$race.ressources.noms.metal} : {$unite.nec_metal|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.metal} : {$unite.nec_metal|separerNombres}
          {/if} + {/if} + {if $unite.nec_cristal > 0} + {if $unite.nec_cristal > $planete->cristal}Coût {$LANG.$race.ressources.noms.cristal} : {$unite.nec_cristal|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.cristal} : {$unite.nec_cristal|separerNombres}
          {/if} + {/if} + {if $unite.nec_hydrogene > 0} + {if $unite.nec_hydrogene > $planete->hydrogene}Coût {$LANG.$race.ressources.noms.hydrogene} : {$unite.nec_hydrogene|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.hydrogene} : {$unite.nec_hydrogene|separerNombres}
          {/if} + {/if} + Temps de construction : {$unite.temps}

          +
          +
          + + +
          +
          +
          +
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/description.tpl b/onyx2/tpl/game/description.tpl new file mode 100644 index 0000000..9a6b704 --- /dev/null +++ b/onyx2/tpl/game/description.tpl @@ -0,0 +1,130 @@ +{include file='game/header.tpl'} +

          Détails {$type} : {$LANG.$raceAff.$type.noms_sing.$id}

          + + + + + + + + + + + + + + +{if $tableau_prod} + + + +{elseif $caract} + + + +{/if} + + + + +
          {$type|ucfirst}{$LANG.$raceAff.$type.noms_sing.$id|ucfirst}
          Actuellement : {if $type != 'vaisseaux' && $type != 'terrestre' && $type != 'caserne'}niveau{/if} {$planete->$type.$id}{if $type == 'vaisseaux' || $type == 'terrestre' || $type == 'caserne'} unités{/if}
          {$LANG.$raceAff.$type.descriptions.$id}
          + + + + + + + +{if $ressourcesNext.0} + + + + +{/if} +{if $ressourcesNext.1} + + + + +{/if} +{if $ressourcesNext.2} + + + + +{/if} + + + + + +
          Coûts {if $type == 'vaisseaux' || $type == 'terrestre' || $type == 'caserne'}unité{else}prochain niveau{/if}
          {$LANG.$raceAff.ressources.noms.metal|ucfirst}{$ressourcesNext.0|separerNombres}
          {$LANG.$raceAff.ressources.noms.cristal|ucfirst}{$ressourcesNext.1|separerNombres}
          {$LANG.$raceAff.ressources.noms.hydrogene|ucfirst}{$ressourcesNext.2|separerNombres}
          Temps{$ressourcesNext.3|separerNombres}
          +
          + + + + + + + + + + + + + + + {foreach from=$tableau_prod item=ligne} + {if $ligne.0 == $planete->$type.$id}{else}{/if} + + + + + + + {/foreach} + +
          Production et consomation théoriques
          NiveauProductionConsomationDifférence prod.Différence conso.
          {$ligne.0}{$ligne.1|separerNombres}{$ligne.2|separerNombres}{if $ligne.3 > 0}+{/if}{$ligne.3|separerNombres}{if $ligne.4 > 0}+{/if}{$ligne.4|separerNombres}
          +
          + + + + + + + + + + + + + + + + + + + +{if $caract.3} + + + + +{/if} + +
          Caractéristiques
          Attaque{$caract.0|separerNombres}
          Bouclier{$caract.1|separerNombres}
          Points de vie{$caract.2|separerNombres}
          Capacité de transport{$caract.3|separerNombres}
          +
          + + + + + + + + + + + +
          Requiert
          {$etat}
          +
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/destinsrapid.tpl b/onyx2/tpl/game/destinsrapid.tpl new file mode 100644 index 0000000..ca4f137 --- /dev/null +++ b/onyx2/tpl/game/destinsrapid.tpl @@ -0,0 +1,28 @@ +{include file='game/header.tpl'} +

          Destinations rapides existantes

          + + + + + + + + + +{foreach from=$destins item=destin} + + + + + +{/foreach} + +
          Nom de la planèteCoordonnées de la planèteSupprimer
          {$destin.1|escape}{$destin.2}Supprimer
          +

          Ajouter une destination rapide

          +
          +
          + ::
          + +
          +
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/envoyer.tpl b/onyx2/tpl/game/envoyer.tpl new file mode 100644 index 0000000..fe55fe9 --- /dev/null +++ b/onyx2/tpl/game/envoyer.tpl @@ -0,0 +1,13 @@ +{include file='game/header.tpl'} +

          Envoyer un message privé

          +
          +
          +
          + + + +

          + +
          +
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/erreur.tpl b/onyx2/tpl/game/erreur.tpl new file mode 100644 index 0000000..f05c447 --- /dev/null +++ b/onyx2/tpl/game/erreur.tpl @@ -0,0 +1,3 @@ +{include file='game/header.tpl'} +
          {$message}
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/flotte1.tpl b/onyx2/tpl/game/flotte1.tpl new file mode 100644 index 0000000..2e3422f --- /dev/null +++ b/onyx2/tpl/game/flotte1.tpl @@ -0,0 +1,45 @@ +{include file='game/header.tpl'} +

          Flottes en action

          + + + + + +{foreach from=$flottesEC item=flotteEC} + + + + + + + + + +{/foreach} + +
          NomMissionNb.vaisseau(x)DestinationHeure d'arrivéeRetourHeure de retour
          {$flotteEC.1|escape}{$flotteEC.2}{$flotteEC.3}{$flotteEC.4|escape}{$flotteEC.5}{$flotteEC.6|escape}{$flotteEC.7}
          +

          Vaisseaux disponibles sur cette planète

          +
          + + + + + + + + + +{foreach from=$planete->vaisseaux key=key item=vaisseau} + {if $vaisseau > 0} + + + + + + + {/if} +{/foreach} + +
          VaisseauxNombre disponibleMaxA envoyer
          Flottes : {$nbflotte}/{$nbflottemax}
          {$action}
          {if $vaisseau > 1}{$LANG.$race.vaisseaux.noms_pluriel[$key]|ucfirst}{else}{$LANG.$race.vaisseaux.noms_sing[$key]|ucfirst}{/if}{$vaisseau|separerNombres}
          +
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/flotte2.tpl b/onyx2/tpl/game/flotte2.tpl new file mode 100644 index 0000000..5aa7ca7 --- /dev/null +++ b/onyx2/tpl/game/flotte2.tpl @@ -0,0 +1,32 @@ +{include file='game/header.tpl'} +
          +

          Paramètres généraux

          +
          +
          +
          + ::
          +
          +
          Pour vous repérer plus facilement entre vos différentes flottes, donnez-lui un nom.
          +
          +

          Mission et contenu

          +
          + +
          + +
          +
          +
          +
          +
          +
          +

          Envoyer

          + +
          + Temps de déplacement : -
          + Consomation : -
          + Complètez les champs ci-dessus +
          +
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/flotten.tpl b/onyx2/tpl/game/flotten.tpl new file mode 100644 index 0000000..e94e63c --- /dev/null +++ b/onyx2/tpl/game/flotten.tpl @@ -0,0 +1,89 @@ +{include file='game/header.tpl'} +

          Détails de la flotte : {$flotte->nom|escape}

          +
          +
          +
          + +
          +
          +

          Composition de la flotte

          +
          + {foreach from=$flotte->vaisseaux item=vaiss key=key} + {if $vaiss} + + + + + {/if} + {/foreach} + + + + +
          {if $vaiss > 1}{$LANG.$race.vaisseaux.noms_pluriel.$key|ucfirst}{else}{$LANG.$race.vaisseaux.noms_sing.$key|ucfirst}{/if}{$vaiss|separerNombres}
          Total{$flotte->nb_vais}

          +

          Contenu de la flotte

          +
          + + + + + + + + + + + + + + + + +
          {$LANG.$race.ressources.noms.metal|ucfirst}{$flotte->contenu.0|separerNombres}
          {$LANG.$race.ressources.noms.cristal|ucfirst}{$flotte->contenu.1|separerNombres}
          {$LANG.$race.ressources.noms.hydrogene|ucfirst}{$flotte->contenu.2|separerNombres}
          Maximum{$flotte->contenuMax|separerNombres}

          +

          Détails de la mission

          + + + + + + + + +{if $flotte->effectue == 2} + +{elseif $flotte->effectue == 1} + +{else} + +{/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
          Mission{$flotte->mission}
          Etat de la missionEn coursEffectuéeDéplacement
          Planète source{$flotte->start_planete->nom_planete|escape} [{$flotte->start_planete->galaxie}:{$flotte->start_planete->ss}:{$flotte->start_planete->position}]
          Date de départ{$flotte->start_time|date_format:"/%a %d %b %y/ %H%M %S"}
          Planète de destination{if isset($flotte->end_planete->nom_planete)}{$flotte->end_planete->nom_planete|escape} [{$flotte->end_planete->galaxie}:{$flotte->end_planete->ss}:{$flotte->end_planete->position}]{else}[{$flotte->end_planete}]{/if}
          Temps de déplacement{$flotte->end_time|date_format:"%k:%M:%S"}
          Date {if $flotte->mission != 6 && $flotte->statut != 1}d'arrivée{else}de retour{/if}{$flotte->ret_time|date_format:"/%a %d %b %y/ %H%M %S"}
          + {if $flotte->mission != 6}Annuler la mission et rappeler la flotte{/if} +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/footer.tpl b/onyx2/tpl/game/footer.tpl new file mode 100644 index 0000000..1320e83 --- /dev/null +++ b/onyx2/tpl/game/footer.tpl @@ -0,0 +1,14 @@ +
          + + + +
          +{$script} + + diff --git a/onyx2/tpl/game/gestion.tpl b/onyx2/tpl/game/gestion.tpl new file mode 100644 index 0000000..fbecafb --- /dev/null +++ b/onyx2/tpl/game/gestion.tpl @@ -0,0 +1,74 @@ +{include file='game/header.tpl'} +

          Politique

          +
          +
          + +

          + {$planete->politique_lastchange|date_format:"%A %d %B %y"}

          + {$planete->moral*100}%


          + +
          +
          +

          Gestion

          +
          + + + + +{foreach from=$planetes item=plan} + +{/foreach} + + + +{foreach from=$planetes item=plan} + +{/foreach} + + + + + +{foreach from=$planetes item=plan} +{if $plan.id == $planeteEC.id}{assign var='plan' value=$planeteEC}{/if} + +{/foreach} + + + +{foreach from=$planetes item=plan} +{if $plan.id == $planeteEC.id}{assign var='plan' value=$planeteEC}{/if} + +{/foreach} + + + +{foreach from=$planetes item=plan} +{if $plan.id == $planeteEC.id}{assign var='plan' value=$planeteEC}{/if} + +{/foreach} + + + +{foreach from=$planetes item=plan} +{if $plan.id == $planeteEC.id}{assign var='plan' value=$planeteEC}{/if} + +{/foreach} + + + +{foreach from=$planetes item=plan} +{if $plan.id == $planeteEC.id}{assign var='plan' value=$planeteEC}{/if} + +{/foreach} + + + +{foreach from=$planetes item=plan} + +{/foreach} + + +
          {$plan.image}
          {$plan.nom_planete|escape}
          {$LANG.$race.ressources.noms.metal|ucfirst}{$plan.metal|separernombres}
          {$LANG.$race.ressources.noms.cristal|ucfirst}{$plan.cristal|separernombres}
          {$LANG.$race.ressources.noms.hydrogene|ucfirst}{$plan.hydrogene|separernombres}
          {$LANG.$race.ressources.noms.energie|ucfirst}{$plan.energie|separerNombres}
          Population{$plan.population|separerNombres}
          Moral{$plan.moral*100|separerNombres}%
          +
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/header.tpl b/onyx2/tpl/game/header.tpl new file mode 100644 index 0000000..7f32ecb --- /dev/null +++ b/onyx2/tpl/game/header.tpl @@ -0,0 +1,107 @@ + + + + + + + + + + + + +{$titre} +{if $race == "covenant"}{elseif $auth_level >= 3}{/if} +{if $race == "humain"}{elseif $auth_level >= 3}{/if} + + +{$scripth} + + + +
          +
          + + +
          + +{if $page != "admin" && $page != "vide" && $page != "amis" && $page != "flotten" && $page != "messagerie" && $page != "envoyer" && $page != "bugs" && $page != "carte" && $page != "classement" && $page != "options" && $page != "simulation" && $page != "vp" && $page != "operateur" && $titre != "Alliance"} +
          +
          + image}.jpg" width="70" height="70" alt="{$planete->nom_planete|escape}" /> +
          Bonjour, {$planete->pseudo}.
          Votre position actuelle:

          +
          {$LANG.$race.ressources.noms.energie|ucfirst}
          {if $planete->energieConso >= $planete->energie}{/if}{$planete->energieConso|separenombre}/{$planete->energie|separenombre}{if $planete->alert_ressources.4}{/if}
          +
          {$LANG.$race.ressources.noms.hydrogene|ucfirst}
          {if $planete->alert_ressources.2 == true}{/if}{$planete->hydrogene|separenombre}{if $planete->alert_ressources.2}{/if}
          +
          {$LANG.$race.ressources.noms.cristal|ucfirst}
          {if $planete->alert_ressources.1 == true}{/if}{$planete->cristal|separenombre}{if $planete->alert_ressources.1}{/if}
          +
          {$LANG.$race.ressources.noms.metal|ucfirst}
          {if $planete->alert_ressources.0 == true}{/if}{$planete->metal|separenombre}{if $planete->alert_ressources.0}{/if}
          +
          +
          +{/if} + {if $page != "admin" && $page != "operateur"}
          {$pub}
          {/if} +
          +
          \ No newline at end of file diff --git a/onyx2/tpl/game/laboratoire.tpl b/onyx2/tpl/game/laboratoire.tpl new file mode 100644 index 0000000..c542a09 --- /dev/null +++ b/onyx2/tpl/game/laboratoire.tpl @@ -0,0 +1,53 @@ +{include file='game/header.tpl'} +

          File d'attente

          +
          +{if $file} +{foreach from=$file item=element key=key} + {$LANG.$race.technologies.noms_sing[$element.0][$element.1]|ucfirst} - - Annuler +{/foreach} +{else} Aucune technologie dans la file d'attente{/if} +
          +
          +

          Arbre des technologies


          +

          {$LANG.$race.batiments.noms_sing.6|ucfirst}

          +{if $recherches} + +{foreach from=$recherches item=recherche} + + + + +{/foreach} +
          + + {$LANG.$race.technologies.noms_sing[$recherche.id][$recherche.tech]} + {$LANG.$race.technologies.descriptions[$recherche.id][$recherche.tech]} + + +
          + {$LANG.$race.technologies.noms_sing[$recherche.id][$recherche.tech]|ucfirst}

          + {if $recherche.nec_metal > 0} + {if $recherche.nec_metal > $planete->metal}Coût {$LANG.$race.ressources.noms.metal} : {$recherche.nec_metal|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.metal} : {$recherche.nec_metal|separerNombres}
          {/if} + {/if} + {if $recherche.nec_cristal > 0} + {if $recherche.nec_cristal > $planete->cristal}Coût {$LANG.$race.ressources.noms.cristal} : {$recherche.nec_cristal|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.cristal} : {$recherche.nec_cristal|separerNombres}
          {/if} + {/if} + {if $recherche.nec_hydrogene > 0} + {if $recherche.nec_hydrogene > $planete->hydrogene}Coût {$LANG.$race.ressources.noms.hydrogene} : {$recherche.nec_hydrogene|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.hydrogene} : {$recherche.nec_hydrogene|separerNombres}
          {/if} + {/if} + {if $recherche.nec_credits > 0} + {if $recherche.nec_credits > $planete->credits}Coût {$LANG.$race.ressources.noms.credits} : {$recherche.nec_credits|separerNombres}
          + {else}Coût {$LANG.$race.ressources.noms.credits} : {$recherche.nec_credits|separerNombres}
          {/if} + {/if} + Temps de recherche : {$recherche.temps}

          + {if $recherche.enfile}Arrêter + {elseif $recherche.nec_credits > $planete->credits || $recherche.nec_hydrogene > $planete->hydrogene || $recherche.nec_cristal > $planete->cristal || $recherche.nec_metal > $planete->metal}{$LANG.$race.ressources.noms.credits|ucfirst} insuffisants + {else}Rechercher + {/if} +
          +
          +{else}
          Aucune technologie à développer actuellement
          {/if} +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/marche.tpl b/onyx2/tpl/game/marche.tpl new file mode 100644 index 0000000..51e3fca --- /dev/null +++ b/onyx2/tpl/game/marche.tpl @@ -0,0 +1,40 @@ +{include file='game/header.tpl'} +

          Bourse des ressources

          +

          Les prix sont donnés en milliers de crédits

          +{foreach from=$bourse item=action} +
          + + + + + + + + + + + + + + + + + +
          {$LANG.$race.ressources.noms[$action.id]}
          {$LANG.$race.ressources.noms[$action.id]|ucfirst}{$action.dispo|separerNombres}Prix
          +
          +
          + Acheter : + +
          +
          +
          {$action.prixA|separerNombres}
          +
          +
          + Vendre : + +
          +
          +
          {$action.prixV|separerNombres}
          +
          +{/foreach} +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/messagerie.tpl b/onyx2/tpl/game/messagerie.tpl new file mode 100644 index 0000000..e28660b --- /dev/null +++ b/onyx2/tpl/game/messagerie.tpl @@ -0,0 +1,22 @@ +{include file='game/header.tpl'} +

          Messages

          + {$avertissement} +

          Ecrire un message

          +
          +{foreach from=$messages item=message} +
          +
          {$message.0} de {$message.2} à {$message.1}
          {$message.3|nl2br}
          +
          +{/foreach} +


          Supprimer la sélection :

          +
          +

          Rapports

          +
          +{foreach from=$rapports item=rapport} +
          +
          {$rapport.0} à {$rapport.1}
          {$rapport.3}
          +
          +{/foreach} +


          Supprimer la sélection :

          +
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/operateur.tpl b/onyx2/tpl/game/operateur.tpl new file mode 100644 index 0000000..55d45eb --- /dev/null +++ b/onyx2/tpl/game/operateur.tpl @@ -0,0 +1,31 @@ +{include file='game/header.tpl'} +

          Opérateurs de cette galaxie

          +
            +{foreach from=$operateurs item=operateur} +
          • {$operateur.pseudo} ({if $operateur.auth_level == 2}Modérateur{elseif $operateur.auth_level == 3}Maître de la bourse{elseif $operateur.auth_level == 4}Opérateur en formation{elseif $operateur.auth_level == 5}Opérateur{elseif $operateur.auth_level == 6}Super-opérateur{elseif $operateur.auth_level == 7}Administrateur{elseif $operateur.auth_level == 8}Codeur{/if})
          • +{/foreach} +
          +

          Problèmes connus

          + Lisez les questions/réponses ci-dessous. Ne contactez un opérateur que si vous ne pouvez pas résoudre votre problème/demande.
          + N'oubliez pas de contacter les opérateurs pour les raisons indiquées dans les règles du jeu. +{foreach from=$questions item=question} +
          +
          {$question.0}
          {$question.1}{if $auth_level > 4}{/if}
          +
          +{/foreach} + {if $auth_level >= 5} +

          Ajouter un problème connu

          +
          + + +

          + +
          + {else}

          Prendre contact avec les opérateurs de la galaxie

          +
          + + +

          + +
          {/if} +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/pilori.tpl b/onyx2/tpl/game/pilori.tpl new file mode 100644 index 0000000..c59ad4a --- /dev/null +++ b/onyx2/tpl/game/pilori.tpl @@ -0,0 +1,23 @@ +{include file='game/header.tpl'} +

          Pilori de la galaxie

          + + + + + + + + + + + {foreach from=$joueurs item=joueur} + + + + + + + {/foreach} + +
          UtilisateurRaisonFin du banissementOpérateur
          {$joueur.pseudo}{$joueur.raisonmv|escape}{if $joueur.mv == 3 || $joueur.last_visite == 2147483647}Définitif{else}{$joueur.last_visite+259200|date_format:"%a %d %B %Y %H:%M"|escape}{/if}{if $joueur.operateurmv}{mailto address=$joueur.mail encode="hex" text=$joueur.operateurmv}{else}Inconnu{/if}
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/prochainement.tpl b/onyx2/tpl/game/prochainement.tpl new file mode 100644 index 0000000..195aed9 --- /dev/null +++ b/onyx2/tpl/game/prochainement.tpl @@ -0,0 +1,3 @@ +{include file='game/header.tpl'} +
          Prochainement sur Halo-Battle.
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/rename.tpl b/onyx2/tpl/game/rename.tpl new file mode 100644 index 0000000..96b2834 --- /dev/null +++ b/onyx2/tpl/game/rename.tpl @@ -0,0 +1,10 @@ +{include file='game/header.tpl'} + {$planete->nom_planete|escape} +

          Renommer la planète

          +
          +


          +
          +

          Abandonner la planète

          + {if $abandonH}Attention, cette action est irréversible ; vous perdrez tous les batiments, vaisseaux et unités présents sur cette planète, les flottes ayant une mision qui a pour origine votre planète se perdront dans l'espace.

          Si vous êtes sur de vouloir abandonner cette planète : cliquez sur ce lien.

          + {else}Vous ne pouvez pas abandonner cette planète car vous n'en avez pas d'autre.

          {/if} +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/ressources.tpl b/onyx2/tpl/game/ressources.tpl new file mode 100644 index 0000000..a450316 --- /dev/null +++ b/onyx2/tpl/game/ressources.tpl @@ -0,0 +1,18 @@ +{include file='game/header.tpl'} +

          Ressources : Tableau récapitulatif des productions par heure

          +
          + + + + + {if $planete->batiments.1}{/if} + {if $planete->batiments.2}{/if} + + {if $planete->batiments.4}{/if} + + energieConso >= $planete->energie} class="lack"{/if}>{$ressources_conso.4|separernombres} + +
          Coefficient{$LANG.$race.ressources.noms.metal|ucfirst}{$LANG.$race.ressources.noms.cristal|ucfirst}{$LANG.$race.ressources.noms.hydrogene|ucfirst}{$LANG.$race.ressources.noms.energie|ucfirst}
          {$planete->batiments.0} {$LANG.$race.batiments.noms_sing.0|ucfirst}%{$ressources_prod.0|separernombres}00-{$ressources_conso.0|separernombres}
          {$planete->batiments.1} {$LANG.$race.batiments.noms_sing.1|ucfirst}%0{$ressources_prod.1|separernombres}0-{$ressources_conso.1|separernombres}
          {$planete->batiments.2} {$LANG.$race.batiments.noms_sing.2|ucfirst}%00{$ressources_prod.2|separernombres}-{$ressources_conso.2|separernombres}
          {$planete->batiments.3} {$LANG.$race.batiments.noms_sing.3|ucfirst}%000{$ressources_prod.3|separernombres}
          {$planete->batiments.4} {$LANG.$race.batiments.noms_sing.4|ucfirst}%00-{$ressources_conso.3|separernombres}{$ressources_prod.4|separernombres}
          {$planete->batiments.10} {$LANG.$race.batiments.noms_sing.10|ucfirst}-{$ressources_silo.1|separernombres}{$ressources_silo.1|separernombres}{$ressources_silo.1|separernombres}0
          Total-{$ressources_prod.0|separernombres}{$ressources_prod.1|separernombres}{if $planete->batiments.3}{$ressources_toto.0|separernombres}{else}0{/if}
          +

          +
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/version.tpl b/onyx2/tpl/game/version.tpl new file mode 100644 index 0000000..cf7f45d --- /dev/null +++ b/onyx2/tpl/game/version.tpl @@ -0,0 +1,8 @@ +{include file='game/header.tpl'} +

          Historique des mises à jour

          + +{foreach from=$versions item=version} + +{/foreach} +
          VersionsDétails
          {$version.numero}
          {$version.date}
          {$version.description|nl2br}
          +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/vide.tpl b/onyx2/tpl/game/vide.tpl new file mode 100644 index 0000000..71e0c4a --- /dev/null +++ b/onyx2/tpl/game/vide.tpl @@ -0,0 +1,4 @@ +{include file='game/header.tpl'} +

          {if $titreP}{$titreP}{else}{$titre}{/if}

          + {$contenu} +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/onyx2/tpl/game/vp.tpl b/onyx2/tpl/game/vp.tpl new file mode 100644 index 0000000..64f7378 --- /dev/null +++ b/onyx2/tpl/game/vp.tpl @@ -0,0 +1,4 @@ +{include file='game/header.tpl'} +
          ... veuillez patienter ...
          + {$contenu} +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/templates/admin/print.tpl b/templates/admin/print.tpl index 548c2ca..8cdd116 100644 --- a/templates/admin/print.tpl +++ b/templates/admin/print.tpl @@ -4,7 +4,7 @@ {foreach from=$tableau item=ligne key=key} {$key} - {if $key == "mdp"}{$ligne|truncate:50}{else}{$ligne}{/if} + {$ligne|truncate:82} {/foreach} diff --git a/templates/cms/accueil.tpl b/templates/cms/accueil.tpl deleted file mode 100644 index 1d919ac..0000000 --- a/templates/cms/accueil.tpl +++ /dev/null @@ -1,21 +0,0 @@ -{include file='cms/header.tpl'} -
          -
          Connexion
          -
          Mot de passe oublié
          -
          - -
          INSCRIVEZ VOUS Rejoignez l'alliance ou engagez-vous

          DEFENDREZ VOUS L'HUMANITE OU LA DETRUIREZ VOUS?

          Repoussez l'ennemi et partez a la conquète des mondes-anneaux dans des univers vastes et riches basés sur l'univers du jeu vidéo Halo

          Une simple inscription gratuite et un navigateur internet sont demandés pour pouvoir participer a des batailles épiques!

          Cliquez ici pour vous inscrire En savoir plus
          - -
          -

          Actualités

          -{foreach from=$actualites item=actualite key=key} -

          {$actualite.time|date_format:"%d/%m/%y"}

          -
          - -

          {$actualite.titre} dans : {$actualite.categorie} {$actualite.contenu|truncate:255:"..."|nl2br} {$nbcoms.$key} commentaire{if $nbcoms.$key > 1}s{/if} PLUS >>

          -
          -{/foreach} -
          Plus de news {$pages}
          -
          - -{include file='cms/footer.tpl'} \ No newline at end of file diff --git a/templates/cms/footer.tpl b/templates/cms/footer.tpl index 63c7208..dcff187 100644 --- a/templates/cms/footer.tpl +++ b/templates/cms/footer.tpl @@ -1,14 +1,14 @@
          {$script} - \ No newline at end of file + diff --git a/templates/cms/header.tpl b/templates/cms/header.tpl index 02e32ba..0e45290 100644 --- a/templates/cms/header.tpl +++ b/templates/cms/header.tpl @@ -4,25 +4,25 @@ + ::Halo-Battle:: - {$titre} - - + - +
          -
          \ No newline at end of file + {foreach from=$header.infos item=info} +
          {$info.texte}
          + {/foreach} + {$LANG.cntRaces|sprintf:$header.count.1:$header.count.0}
          +
          diff --git a/templates/cms/maj.tpl b/templates/cms/maj.tpl index 2cbd048..822d2a8 100644 --- a/templates/cms/maj.tpl +++ b/templates/cms/maj.tpl @@ -4,5 +4,5 @@
          {$texte}
          -
          INSCRIVEZ VOUS Rejoignez l'alliance ou engagez-vous

          DEFENDREZ VOUS L'HUMANITE OU LA DETRUIREZ VOUS?

          Repoussez l'ennemi et partez a la conquète des mondes-anneaux dans des univers vastes et riches basés sur l'univers du jeu vidéo Halo

          Une simple inscription gratuite et un navigateur internet sont demandés pour pouvoir participer a des batailles épiques!

          Cliquez ici pour vous inscrire En savoir plus
          -{include file='cms/footer.tpl'} \ No newline at end of file +
          {$LANG.mod_inscription_texte|sprintf:$link.inscription:$link.inscription:$link.inscription}
          +{include file='cms/footer.tpl'} diff --git a/templates/cms/mini.tpl b/templates/cms/mini.tpl index 9de15c7..e9e0a3e 100644 --- a/templates/cms/mini.tpl +++ b/templates/cms/mini.tpl @@ -1,6 +1,6 @@ {include file='cms/header.tpl'}
          -
          Connexion
          +
          {$LANG.mod_login_titre}
          @@ -10,21 +10,21 @@ - + - Mot de passe oublié + {$LANG.mod_login_forgotMdp}
          -
          INSCRIVEZ VOUS Rejoignez l'alliance ou engagez-vous

          DEFENDREZ VOUS L'HUMANITE OU LA DETRUIREZ VOUS?

          Repoussez l'ennemi et partez a la conquète des mondes-anneaux dans des univers vastes et riches basés sur l'univers du jeu vidéo Halo

          Une simple inscription gratuite et un navigateur internet sont demandés pour pouvoir participer a des batailles épiques!

          Cliquez ici pour vous inscrire En savoir plus
          +
          {$LANG.mod_inscription_texte|sprintf:$link.inscription:$link.inscription:$link.inscription}
          Halo.fr
          -{include file='cms/footer.tpl'} \ No newline at end of file +{include file='cms/footer.tpl'} diff --git a/templates/cms/news.tpl b/templates/cms/news.tpl deleted file mode 100644 index f929a39..0000000 --- a/templates/cms/news.tpl +++ /dev/null @@ -1,47 +0,0 @@ -{include file='cms/header.tpl'} -
          -

          Actualités

          {$actualite.time|date_format:"%d/%m/%y"}

          - -
          -

          news {$actualite.titre} par {$actualite.username}

          -

          {$actualite.contenu|nl2br}

          -
          - - -
          - -
          -

          Commentaires

          -
          -{foreach from=$commentaires item=commentaire} -

          {$commentaire.username}, le {$commentaire.time|date_format:"%d/%m/%y"} {$commentaire.commentaire|nl2br}

          -{/foreach} -
          - -
          - Laisser un commentaire - {if $connected}
          - :wink: - :D - :-) - :P
          - :shock: - 8-) - :twisted: - :evil:
          - :-x - :-? - :-( - :-O
          - :-| - :oops: - :roll: - :lol: -
          -
          - - {else} - - {/if} -
          -{include file='cms/footer.tpl'} \ No newline at end of file diff --git a/templates/game/accueil.tpl b/templates/game/accueil.tpl index dab395f..093b0ca 100644 --- a/templates/game/accueil.tpl +++ b/templates/game/accueil.tpl @@ -14,13 +14,54 @@ {elseif $mail.nbre >= 1}

          messagerie: {$mail.nbre} message non lu

          {/if}

          {if !$planete->nom_planete}Sans nom{/if}{$planete->nom_planete|escape} ({$planete->pseudo})

          - Planète + Planète

          Infos

          -

          Diamètre: {$diametre} km ({$planete->casesRest} cases disponibles sur {$planete->cases})

          + {if SURFACE == "planete"}

          Diamètre: {$diametre} km ({$planete->casesRest} cases disponibles sur {$planete->cases})

          {/if}

          Race : {$planete->race}

          position: {$planete->galaxie}.{$planete->ss}.{$planete->position}

          + {if SURFACE == "planete"}

          population: {$planete->population|separerNombres}

          crédits: {$planete->credits|separerNombres}

          + {/if}

          Classement: {if $planete->place_points == '0'}non classé{else}{$planete->place_points}{if $planete->place_points == '1'}er{else}ème{/if}{/if} ({$points} points)

          {if $alliance}

          Alliance: [{$alliance.tag|upper}] {$alliance.nom}

          {/if} + {if SURFACE == "planete"} +

          En cours sur la planète

          + {if $planete->file_bat|@count > 1} +

          + {foreach from=$planete->file_bat item=file key=key} + {if $key != 0} + {if $key != 1} - {else}Bâtiments : {/if}{$file.0|nom:"batiment"}{if $file.1 < 0} (démolition){/if} + {/if} + {/foreach} +

          + {/if} + {if $planete->file_cas|@count > 1} +

          + {foreach from=$planete->file_cas item=file key=key} + {if $key != 0} + {if $key != 1} - {else}{if $race == "covenant"}Caserne{else}Ecole militaire{/if} : {/if}{$file.1} {$file.0|nom:"casernea"} + {/if} + {/foreach} +

          + {/if} + {if $planete->file_vais|@count > 1} +

          + {foreach from=$planete->file_vais item=file key=key} + {if $key != 0} + {if $key != 1} - {else}Chantier spatial : {/if}{$file.1} {$file.0|nom:"nomvaisa"} + {/if} + {/foreach} +

          + {/if} + {if $planete->file_ter|@count > 1} +

          + {foreach from=$planete->file_ter item=file key=key} + {if $key != 0} + {if $key != 1} - {else}Chantier terrestre : {/if}{$file.1} {$file.0|nom:"nomterra"} + {/if} + {/foreach} +

          + {/if} + {/if} {include file='game/footer.tpl'} \ No newline at end of file diff --git a/templates/game/alliance_accueil.tpl b/templates/game/alliance_accueil.tpl index 725cde1..5a434b4 100644 --- a/templates/game/alliance_accueil.tpl +++ b/templates/game/alliance_accueil.tpl @@ -3,7 +3,7 @@ - + diff --git a/templates/game/batiments.tpl b/templates/game/batiments.tpl index 01047f4..6fe3ed3 100644 --- a/templates/game/batiments.tpl +++ b/templates/game/batiments.tpl @@ -18,7 +18,7 @@ @@ -42,7 +42,7 @@ {elseif $batiment.nec_hydrogene > $planete->hydrogene}Ressources insuffisantes {elseif $batiment.nec_cristal > $planete->cristal}Ressources insuffisantes {elseif $batiment.nec_metal > $planete->metal}Ressources insuffisantes - {else}Construire{/if}{if $batiment.niveau > 0} Démolir un{/if} + {else}{if $planete->casesRest > 1}Construire{/if}{/if}{if $batiment.niveau > 0} Démolir un niveau{/if} diff --git a/templates/game/bourse_ressources.tpl b/templates/game/bourse_ressources.tpl new file mode 100644 index 0000000..ca0017b --- /dev/null +++ b/templates/game/bourse_ressources.tpl @@ -0,0 +1,40 @@ +{include file='game/header.tpl'} +

          Bourse des ressources

          +

          Les prix sont donnés en milliers de crédits

          +{foreach from=$bourse item=action} +
          +
          Nom :
          - {$batiment.nom} + {$batiment.nom} {$batiment.description}
          + + + + + + + + + + + + + + + + +
          {$nomsressources[$action.id]}
          {$nomsressources[$action.id]}{$action.dispo|separerNombres}Prix
          +
          +
          + Acheter : + +
          +
          +
          {$action.prixA|separerNombres}
          +
          +
          + Vendre : + +
          +
          +
          {$action.prixV|separerNombres}
          +
          +{/foreach} +{include file='game/footer.tpl'} \ No newline at end of file diff --git a/templates/game/carte.tpl b/templates/game/carte.tpl index cdeb2a6..849875a 100644 --- a/templates/game/carte.tpl +++ b/templates/game/carte.tpl @@ -2,7 +2,6 @@

          Navigation

          Système Solaire

          -

          NOUS SOMMES EN ATTENTE DES IMAGES, CE N'EST PAS UN BUG DE NE PAS VOIR LES IMAGES DE POLITIQUE OU DE FACTION.

          @@ -22,10 +21,10 @@ {foreach from=$carte item=plan} - + - - + + diff --git a/templates/game/caserne.tpl b/templates/game/caserne.tpl index 3583e50..7cdc711 100644 --- a/templates/game/caserne.tpl +++ b/templates/game/caserne.tpl @@ -17,7 +17,7 @@ diff --git a/templates/game/chantierspatial.tpl b/templates/game/chantierspatial.tpl index 534b02d..b90d19f 100644 --- a/templates/game/chantierspatial.tpl +++ b/templates/game/chantierspatial.tpl @@ -17,7 +17,7 @@ diff --git a/templates/game/chantierterrestre.tpl b/templates/game/chantierterrestre.tpl index b261641..fd8fb55 100644 --- a/templates/game/chantierterrestre.tpl +++ b/templates/game/chantierterrestre.tpl @@ -17,7 +17,7 @@ diff --git a/templates/game/defenses.tpl b/templates/game/defenses.tpl index df99f23..c6ead15 100644 --- a/templates/game/defenses.tpl +++ b/templates/game/defenses.tpl @@ -17,7 +17,7 @@ diff --git a/templates/game/description.tpl b/templates/game/description.tpl index dcb4659..9f63fb1 100644 --- a/templates/game/description.tpl +++ b/templates/game/description.tpl @@ -3,7 +3,7 @@
          {$plan.0}{if $plan.7}{$plan.1|escape}{else} {/if}{if $plan.7}{$plan.1|escape}{else} {/if} {if $plan.1}{$plan.1|escape}
          {if $plan.6}[{$plan.6}]
          {/if}{$plan.5}{else} {/if}
          {if $plan.4}{$plan.4}{else} {/if}{if $plan.4}{$plan.6}{else} {/if}{if $plan.4}{$plan.4}{else} {/if}{if $plan.4}{$plan.6}{else} {/if} {if $plan.2}{$plan.2}{else}0{/if} | {if $plan.3}{$plan.3}{else}0{/if} {if $plan.5}Message{else} {/if}
          - Unité terrestre + Unité terrestre {$unite.description}
          - Vaisseaux + Vaisseaux {$vaisseau.description}
          - Unité terrestre + Unité terrestre {$unite.description}
          - Unité terrestre + Unité terrestre {$unite.description}
          - + diff --git a/templates/game/flotte2.tpl b/templates/game/flotte2.tpl index 08cbbdf..76060c8 100644 --- a/templates/game/flotte2.tpl +++ b/templates/game/flotte2.tpl @@ -3,7 +3,7 @@

          Paramètres généraux


          -
          +
          ::


          Pour vous repérer plus facilement entre vos différentes flottes, donnez-lui un nom.
          diff --git a/templates/game/footer.tpl b/templates/game/footer.tpl index 283bcbd..518aaa4 100644 --- a/templates/game/footer.tpl +++ b/templates/game/footer.tpl @@ -10,6 +10,5 @@
          {$script} - - \ No newline at end of file + diff --git a/templates/game/gestion.tpl b/templates/game/gestion.tpl index fb76fcb..ef48824 100644 --- a/templates/game/gestion.tpl +++ b/templates/game/gestion.tpl @@ -5,7 +5,7 @@

          {$planete->politique_lastchange|date_format:"%A %d %B %y"}

          - {$planete->moral*100}%


          + {$planete->moral*100}%


          @@ -16,7 +16,7 @@ {foreach from=$planetes item=plan} - + {/foreach} @@ -60,6 +60,12 @@ {foreach from=$planetes item=plan} {if $plan.id == $planeteEC.id}{assign var='plan' value=$planeteEC}{/if} +{/foreach} + + + +{foreach from=$planetes item=plan} + {/foreach} diff --git a/templates/game/header.tpl b/templates/game/header.tpl index 44c77a9..5efbad2 100644 --- a/templates/game/header.tpl +++ b/templates/game/header.tpl @@ -11,29 +11,29 @@ ::Halo-Battle:: - {$titre} -{if $race == "covenant"}{elseif $auth_level >= 3}{/if} -{if $race == "humain"}{elseif $auth_level >= 3}{/if} +{if $race == "covenant"}{elseif $auth_level >= 3}{/if} +{if $race == "humain"}{elseif $auth_level >= 3}{/if} - - + {$scripth} - +
          -
          -{foreach from=$infos item=info key=key} -
          {$info.texte}
          -{/foreach} - {$count.humains} Marines et {$count.covenants} Covenants se battent dans {$count.serveurs} galaxie{if $count.serveurs>1}s{/if} -
          +
          @@ -48,11 +48,11 @@ {elseif $recherche.nec_hydrogene > $planete->hydrogene}Ressources insuffisantes {elseif $recherche.nec_cristal > $planete->cristal}Ressources insuffisantes {elseif $recherche.nec_metal > $planete->metal}Ressources insuffisantes - {else}Construire + {else}Rechercher {/if} {/foreach}
          {$nom}
          Actuellement : {if $type != 'vaisseaux' && $type != 'terrestre' && $type != 'caserne'}niveau{/if} {$niveau}{if $type == 'vaisseaux' || $type == 'terrestre' || $type == 'caserne'} unités{/if}
          {$plan.image}{$plan.image}
          {$plan.population|separerNombres}
          Moral{$plan.moral*100|separerNombres}%
          {*}{/*} - {$recherche.nom} + {$recherche.nom} {$recherche.description}
          -{include file='game/footer.tpl'} \ No newline at end of file +{include file='game/footer.tpl'} diff --git a/templates/game/options.tpl b/templates/game/options.tpl index 81cbdc4..6906a72 100644 --- a/templates/game/options.tpl +++ b/templates/game/options.tpl @@ -21,7 +21,9 @@

          Recevoir des notifications par mail

          - + + +

          Mode vacances

          diff --git a/templates/game/rename.tpl b/templates/game/rename.tpl index 2628c79..96b2834 100644 --- a/templates/game/rename.tpl +++ b/templates/game/rename.tpl @@ -1,5 +1,5 @@ {include file='game/header.tpl'} - {$planete->nom_planete|escape} + {$planete->nom_planete|escape}

          Renommer la planète



          diff --git a/templates/game/ressources.tpl b/templates/game/ressources.tpl index 6b5ba7d..2398dd0 100644 --- a/templates/game/ressources.tpl +++ b/templates/game/ressources.tpl @@ -4,11 +4,11 @@ - - {if $planete->batiments.1}{/if} - {if $planete->batiments.2}{/if} - - {if $planete->batiments.4}{/if} + + {if $planete->batiments.1}{/if} + {if $planete->batiments.2}{/if} + + {if $planete->batiments.4}{/if} energieConso >= $planete->energie} class="lack"{/if}>{$ressources_conso.4|separernombres}
          Coefficient{$nomsressources.0}{$nomsressources.1}{$nomsressources.2}{$nomsressources.3}
          {$planete->batiments.0} {$nombat.0}%{$ressources_prod.0|separernombres}00-{$ressources_conso.0|separernombres}
          {$planete->batiments.1} {$nombat.1}%0{$ressources_prod.1|separernombres}0-{$ressources_conso.1|separernombres}
          {$planete->batiments.2} {$nombat.2}%00{$ressources_prod.2|separernombres}-{$ressources_conso.2|separernombres}
          {$planete->batiments.3} {$nombat.3}%000{$ressources_prod.3|separernombres}
          {$planete->batiments.4} {$nombat.4}%00-{$ressources_conso.3|separernombres}{$ressources_prod.4|separernombres}
          {$planete->batiments.0} {$nombat.0}%{$ressources_prod.0|separernombres}00-{$ressources_conso.0|separernombres}
          {$planete->batiments.1} {$nombat.1}%0{$ressources_prod.1|separernombres}0-{$ressources_conso.1|separernombres}
          {$planete->batiments.2} {$nombat.2}%00{$ressources_prod.2|separernombres}-{$ressources_conso.2|separernombres}
          {$planete->batiments.3} {$nombat.3}%000{$ressources_prod.3|separernombres}
          {$planete->batiments.4} {$nombat.4}%00-{$ressources_conso.3|separernombres}{$ressources_prod.4|separernombres}
          {$planete->batiments.10} {$nombat.10}-{$ressources_silo.1|separernombres}{$ressources_silo.1|separernombres}{$ressources_silo.1|separernombres}0
          Total-{$ressources_prod.0|separernombres}{$ressources_prod.1|separernombres}{if $planete->batiments.3}{$ressources_toto.0|separernombres}{else}0{/if}