Location: PHPKode > projects > COWeb (Common Objects for Web) > coweb-0.4.1/include/images.inc.php
<?
// Module de gestion des images
// Ecrit par Sébastien DIAZ
// Distribue sous license GPL
// Validé pour Mysql le 08/03/2003

include "coweb.inc.php";

if (! defined("IMAGES"))
{
	define("IMAGES",1);

	class images extends links
	{
		var $image;			// Adresse physique de l'image

		function images($id, $table)
		// Constructeur
		{

			if (isset($id))
			{
			 	$dbl=new db(server, port, database, login, password, type);
				$dbl->connect();
				$dbl->query("	SELECT id, label, url, description, flag, follow, param, image
						FROM $table
						WHERE id=$id"
						);
				$dbl->fetch();
				$this->id=stripslashes($dbl->row["id"]);
				$this->label=stripslashes($dbl->row["label"]);
				$this->url=stripslashes($dbl->row["url"]);				
				$this->description=stripslashes($dbl->row["description"]);				
				$this->flag=stripslashes($dbl->row["flag"]);
				$this->follow=stripslashes($dbl->row["follow"]);
				$this->param=stripslashes($dbl->row["param"]);
				$this->image=stripslashes($dbl->row["image"]);									
			}
			else 
			{
				$this->id="";
				$this->label="";
				$this->url="";
				$this->description="";
				$this->flag="1";
				$this->follow="";
				$this->param="";
				$this->image="";
			}
			$this->table=$table;
		}
	
		function Add()
		// Insertion d'une nouvelle Image
		{
			$dbl=new db(server, port, database, login, password, type);
			$dbl->connect();
			$dbl->query("	INSERT $this->table
							VALUES ('', '$this->label', '$this->url', '$this->description', '1', '0', '', '$this->image')
						");
			$this->id=mysql_insert_id($dbl->id);
		}

		function Update()
		// Modification d'une Image
		{
			$dbl=new db(server, port, database, login, password, type);
			$dbl->connect();
			$dbl->query("	UPDATE $this->table
							SET label='$this->label',
							url='$this->url',
							description='$this->description',
							flag='$this->flag',
							follow='$this->follow',
							param='$this->param',
							image='$this->image'
							WHERE id=$this->id
						");
			$dbl->fetch();
		}

		function Generate()
		// Creation d'une table d'images
		{
			$dbl=new db(server, port, database, login, password, type);
			$dbl->Connect();
			$sql="	CREATE TABLE $this->table
					(
					id int(11) NOT NULL auto_increment,
					label varchar(64) default NULL,
					url tinytext,
					description tinytext,
					flag char(1) NOT NULL default '1',
					follow tinyint(4) NOT NULL default '0',
					param varchar(16) NOT NULL default '',
					image varchar(64) default NULL,
					UNIQUE KEY id (id)
					)";
			$dbl->Query($sql);
		}
	
	}

}

?>
Return current item: COWeb (Common Objects for Web)