Subversion-Projekte lars-tiefland.medien

Revision

Revision 98 | Revision 100 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 98 Revision 99
Zeile 13... Zeile 13...
13
		function __construct($id=0)
13
		function __construct($id=0)
14
		{
14
		{
15
			global $db, $prefix;
15
			global $db, $prefix;
16
			if ($id)
16
			if ($id)
17
			{
17
			{
18
				$sql="SELECT * FROM $prefix"."albums WHERE a_id=$id";
18
				$sql="SELECT * FROM $prefix"."boxes WHERE a_id=$id";
19
				$res=$db->query($sql);
19
				$res=$db->query($sql);
20
				$row=$res->fetchRow();
20
				$row=$res->fetchRow();
21
				$this->id=$id;
21
				$this->id=$id;
22
				$this->name=stripslashes($row["a_name"]);
22
				$this->name=stripslashes($row["a_name"]);
23
				$this->sampler=$row["a_sampler"];
23
				$this->sampler=$row["a_sampler"];
Zeile 58... Zeile 58...
58
		{
58
		{
59
			global $db, $prefix;
59
			global $db, $prefix;
60
			switch ($mode)
60
			switch ($mode)
61
			{
61
			{
62
				case "save":
62
				case "save":
63
					$sql="INSERT INTO $prefix"."albums (a_name, a_sampler, a_pic, a_year, a_genre, a_artist) VALUES ('$this->name', $this->sampler, '$this->pic', $this->year, $this->genre, $this->artist)";
63
					$sql="INSERT INTO $prefix"."boxes (a_name, a_pic, a_year, a_genre, a_artist) VALUES ('$this->name', $this->sampler, '$this->pic', $this->year, $this->genre, $this->artist)";
64
					break;
64
					break;
65
				case "update":
65
				case "update":
66
					$pic_sql="";
66
					$pic_sql="";
67
					if ($this->pic || $this->p_del)
67
					if ($this->pic || $this->p_del)
68
					{
68
					{
69
						$pic_sql="a_pic='$this->pic',";
69
						$pic_sql="a_pic='$this->pic',";
70
					}
70
					}
71
					$sql="UPDATE $prefix"."albums SET a_name='$this->name', a_sampler=$this->sampler, ".$pic_sql." a_year=$this->year, a_genre=$this->genre, a_artist=$this->artist WHERE a_id=$this->id";
71
					$sql="UPDATE $prefix"."boxes SET a_name='$this->name', ".$pic_sql." a_year=$this->year, a_genre=$this->genre, a_artist=$this->artist WHERE a_id=$this->id";
72
					break;
72
					break;
73
				case "del":
73
				case "del":
74
					break;
74
					break;
75
			}
75
			}
76
			return $db->query($sql);
76
			return $db->query($sql);
77
		}
77
		}
Zeile 78... Zeile 78...
78
 
78
 
79
		function Liste($start=0,$anz=0)
79
		function Liste($start=0,$anz=0)
80
		{
80
		{
81
			global $db, $prefix, $common;
81
			global $db, $prefix, $common;
82
			$sql="SELECT * FROM $prefix"."albums";
82
			$sql="SELECT * FROM $prefix"."boxes";
83
			if ($anz > 0)
83
			if ($anz > 0)
84
			{
84
			{
85
				$res=$db->limitquery($sql,$start,$anz);
85
				$res=$db->limitquery($sql,$start,$anz);
86
				$id=0;
86
				$id=0;
Zeile 115... Zeile 115...
115
		}
115
		}
Zeile 116... Zeile 116...
116
 
116
 
117
		function getAlbums()
117
		function getAlbums()
118
		{
118
		{
119
			global $db, $prefix, $common;
119
			global $db, $prefix, $common;
120
			$sql="SELECT * FROM $prefix"."albums ORDER BY a_name";
120
			$sql="SELECT * FROM $prefix"."boxes ORDER BY a_name";
121
			$res=$db->query($sql);
121
			$res=$db->query($sql);
122
			$ret["-1"]=$common["please_select"];
122
			$ret["-1"]=$common["please_select"];
123
			while ($row=$res->fetchRow())
123
			while ($row=$res->fetchRow())
124
			{
124
			{