init
This commit is contained in:
46
include/ECM/star.class.php
Normal file
46
include/ECM/star.class.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
class star {
|
||||
var $bean;
|
||||
var $bean_id;
|
||||
var $user_id;
|
||||
var $db;
|
||||
|
||||
var $starExists;
|
||||
|
||||
function start() {}
|
||||
|
||||
function star($bean, $bean_id, $user_id) {
|
||||
$this->bean = $bean;
|
||||
$this->bean_id = $bean_id;
|
||||
$this->user_id = $user_id;
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
|
||||
$starExists = $this->checkStar();
|
||||
}
|
||||
|
||||
private function checkStar() {
|
||||
$w = $this->db->query("SELECT * FROM stars WHERE
|
||||
bean = '$this->bean' AND
|
||||
bean_id = '$this->bean_id' AND
|
||||
user_id = '$this->user_id");
|
||||
|
||||
if ($w->num_rows == 0)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
private function createStar() {
|
||||
if ($this->starExists == false) return;
|
||||
$this->db->query("INSERT INTO stars VALUES ('$this->bean','$this->bean_id','$this->user_id')");
|
||||
}
|
||||
|
||||
private function deleteStar() {
|
||||
if ($this->starExists == true) return;
|
||||
//$this->db->query("");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user