)(.*)", "\\2", $line), $this->charset);
$query = sprintf ("UPDATE bookmark SET description='%s' WHERE id='%d' and user='%s'",
$this->mysql->escape ($this->description),
$this->mysql->escape ($insert_id),
$this->mysql->escape ($this->username));
@$this->mysql->query ($query);
unset ($this->description);
unset ($insert_id);
}
}
# this indicates, that the folder is being closed
else if ($line == "") {
$this->folder_close ();
}
}
}
function folder_new () {
if (!isset ($this->name_folder)) {
$this->name_folder == "";
}
$query = sprintf ("INSERT INTO folder (childof, name, user, public) values ('%d', '%s', '%s', '%d')",
$this->mysql->escape ($this->current_folder),
$this->mysql->escape ($this->name_folder),
$this->mysql->escape ($this->username),
$this->mysql->escape ($this->public));
if ($this->mysql->query ($query)) {
$this->current_folder = mysql_insert_id ();
array_push ($this->folder_depth, $this->current_folder);
unset ($this->name_folder);
$this->count_folders++;
}
else {
message ($this->mysql->error);
}
}
function bookmark_new () {
if (!isset ($this->name_bookmark)) {
$this->name_bookmark = "";
}
if (!isset ($this->url)) {
$this->url = "";
}
if (!isset ($this->description)) {
$this->description = "";
}
$query = sprintf ("INSERT INTO bookmark (user, title, url, description, childof, public)
values ('%s', '%s', '%s', '%s', '%d', '%d')",
$this->mysql->escape ($this->username),
$this->mysql->escape ($this->name_bookmark),
$this->mysql->escape ($this->url),
$this->mysql->escape ($this->description),
$this->mysql->escape ($this->current_folder),
$this->mysql->escape ($this->public));
if ($this->mysql->query ($query)) {
unset ($this->name_bookmark, $this->url, $this->description);
$this->count_bookmarks++;
}
else {
message ($this->mysql->error);
}
}
function folder_close () {
if (count ($this->folder_depth) <= 1) {
$this->folder_depth = array ();
$this->current_folder = $this->parent_folder;
}
else{
# remove the last folder from the folder history
unset ($this->folder_depth[count ($this->folder_depth) - 1]);
$this->folder_depth = array_values ($this->folder_depth);
# set the last folder to the current folder
$this->current_folder = $this->folder_depth[count ($this->folder_depth) - 1];
}
}
}
require_once (ABSOLUTE_PATH . "footer.php");
?>