function save() { $rValue = false; if ($this->name != "" && $this->project_id != "" && $this->version != "") { global $dbh; if ($this->file_id == 0) { $this->file_id = $this->getFileID($this->name, $this->project_id, $this->version); } $sql = "INSERT INTO"; $where = ""; if ($this->file_id > 0) { $sql = "UPDATE"; $where = " WHERE file_id = " . sqlSanitize($this->file_id, $dbh); } $Event = new EventLog("files", "file_id", $this->file_id, $sql); $sql .= " files \n\t\t\t\t\t\tSET file_id \t= " . sqlSanitize($this->file_id, $dbh) . ",\n\t\t\t\t\t\t\tproject_id\t= " . returnQuotedString(sqlSanitize($this->project_id, $dbh)) . ", \n\t\t\t\t\t\t\tversion\t\t= " . returnQuotedString(sqlSanitize($this->version, $dbh)) . ", \n\t\t\t\t\t\t\tname\t\t= " . returnQuotedString(sqlSanitize($this->name, $dbh)) . ",\n\t\t\t\t\t\t\tplugin_id\t= " . returnQuotedString(sqlSanitize($this->plugin_id, $dbh)) . ",\n\t\t\t\t\t\t\tis_active\t= " . $this->is_active . $where; if (mysql_query($sql, $dbh)) { if ($this->file_id == 0) { $this->file_id = mysql_insert_id($dbh); $Event->key_value = $this->file_id; } $rValue = true; $Event->add(); } else { echo $sql . "\n"; $GLOBALS['g_ERRSTRS'][1] = mysql_error(); } } else { echo "ERROR: One missing:Name: " . $this->name . "Project: " . $this->project_id . "Version: " . $this->version; } return $rValue; }
function load($email, $password) { if ($email != "" && $password != "") { if (eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.[a-zA-Z.]{2,5}$', $email)) { global $addon; $addon->callHook('user_authentication', array(&$this, $email, $password)); } } if ($this->userid > 0) { $Event = new EventLog("users", "userid", $this->userid, "__auth_success"); $Event->add(); } else { $Event = new EventLog("users", "userid", $_SERVER['REMOTE_ADDR'] . ":" . $email, "__auth_failure"); $Event->add(); } return $this->userid; }
/** * Sets a string as inactive * @author droy * @param Integer string_id * @return bool success status */ function deactivate($_string_id) { $rValue = 0; if ($_string_id > 0) { global $dbh; $sql = "UPDATE strings \n\t\t\t\t\tSET is_active = 0 WHERE string_id = " . sqlSanitize($_string_id, $dbh); $rValue = mysql_query($sql, $dbh); $Event = new EventLog("strings", "string_id", $_string_id, "DEACTIVATE"); $Event->add(); } return $rValue; }