$title = "{$row["title"]}"; $url = "{$row["url"]}"; $description = "{$row["description"]}"; $found = true; } //strip out html $title = filter($title); $description = filter($description); $url = filter($url); if (TAGS) { require_once 'includes/tags_functions.php'; $public = checkIfPublic($id); if ($public) { $checkedStr = "checked=\"checked\""; //Return all tags for this bookmark $strTags = returnAllTags($id); } else { $readOnlyTags = "readonly"; } } if ($found && $url != null) { $strBack = $success ? "<< " . T_("Back to Folder") . "" : "" . T_("Cancel") . ""; ?> <form action="modifyfav.php" method="post"> <input type="hidden" name="id" value="<?php echo $id; ?> "> <input type="hidden" name="pid" value="<?php echo $pid; ?>
$tagcount = count($tagNames); for ($i = 0; $i < $tagcount; $i++) { $tagNames[$i] = trim($tagNames[$i]); } } else { $tagNames = NULL; } // Get the posts relevant to the passed-in variables. include "../includes/tags_functions.php"; require_once "../includes/protection.php"; $user = new User(); $userName = $user->getUsername(); if ($tagNames) { $bookmarks = getTagsBookmarks($tagNames, 0, MAX_API_BOOKMARKS, $userName, "../"); } else { $bookmarks = getUserBookmarks($userName, 0, MAX_API_BOOKMARKS, "../"); } // Set up the XML file and output all the posts. header('Content-Type: text/xml'); echo '<?xml version="1.0" standalone="yes" ?' . ">\r\n"; echo '<posts update="' . date('Y-m-d\\TH:i:s\\Z') . '" user="******"' . (is_null($tag) ? '' : ' tag="' . htmlspecialchars($tag) . '"') . ">\r\n"; foreach ($bookmarks as $row) { if (is_null($row['description']) || trim($row['description']) == '') { $description = ''; } else { $description = 'extended="' . filter($row['description'], 'xml') . '" '; } $taglist = returnAllTags($row['id'], "../"); echo "\t<post href=\"" . filter($row['url'], 'xml') . '" description="' . filter($row['title'], 'xml') . '" ' . $description . 'hash="' . md5($row['url']) . '" tag="' . filter($taglist, 'xml') . '" time="' . date('Y-m-d\\TH:i:s\\Z', strtotime($row['ADD_DATE'])) . "\" />\r\n"; } echo '</posts>';
function updateTags($b_id, $strTags) { $strTags = trim($strTags); $tags = split(" ", $strTags); // Get each single tag //Remove tags if not there anymore //Get old tags $strOldTags = returnAllTags($b_id); $oldTags = split(" ", $strOldTags); // Get each single tag foreach ($oldTags as $old_tag) { $found = false; foreach ($tags as $new_tag) { if ($old_tag == $new_tag) { $found = true; break; } } if (!$found) { // Not there anymore, remove the link $result = unstoreTag($b_id, $old_tag); } } $nbChars = 0; //Add new tags if any foreach ($tags as $current_tag) { if (tagExists($current_tag)) { $tagID = returnTagID($current_tag); if (!returnTagLinked($b_id, $tagID)) { $result = storeTag($b_id, $current_tag); } } else { // Check max length (30) and if 150 chars have been added $nbChars += strlen($current_tag); if ($nbChars <= 150 && strlen(trim($current_tag)) <= 30) { $result = addTag($current_tag); $tagID = returnTagID($current_tag); $result2 = storeTag($b_id, $current_tag); } } } }