0
$navs["manage_tags"] = array("title" => __("Tags", "tags"),
0
- "selected" => array("
bulk_tags", "rename_tag", "delete_tag"));
0
+ "selected" => array("
rename_tag", "delete_tag", "edit_tags"));
0
static function manage_nav_pages($pages) {
0
- array_push($pages, "manage_tags", "
bulk_tags", "rename_tag", "delete_tag");
0
+ array_push($pages, "manage_tags", "
rename_tag", "delete_tag", "edit_tags");
0
"url" => url("tag/".$tag2clean[$tag]."/"));
0
$admin->context["tag_cloud"] = $context;
0
+ if (!Post::any_editable() and !Post::any_deletable())
0
+ fallback($_GET['query'], "");
0
+ list($where, $params) = keywords(urldecode($_GET['query']), "xml LIKE :query");
0
+ $visitor = Visitor::current();
0
+ if (!$visitor->group()->can("view_draft", "edit_draft", "edit_post", "delete_draft", "delete_post")) {
0
+ $where[] = "user_id = :visitor_id";
0
+ $params[':visitor_id'] = $visitor->id;
0
+ $admin->context["posts"] = new Paginator(Post::find(array("placeholders" => true,
0
+ "params" => $params)), 25);
0
public function admin_rename_tag($admin) {
0
return $admin->context["tag"] = array("name" => $tag, "clean" => $tag2clean[$tag]);
0
+ public function admin_edit_tags($admin) {
0
+ $sql = SQL::current();
0
+ if (!isset($_GET['id']))
0
+ error(__("No ID Specified"), __("Please specify the ID of the post whose tags you would like to edit.", "tags"));
0
+ $admin->context["post"] = new Post($_GET['id']);
0
+ public function admin_update_tags($admin) {
0
+ $sql = SQL::current();
0
+ if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey)
0
+ show_403(__("Access Denied"), __("Invalid security key."));
0
+ if (!isset($_POST['id']))
0
+ error(__("No ID Specified"), __("Please specify the ID of the post whose tags you would like to edit.", "tags"));
0
+ $this->update_post(new Post($_POST['id']));
0
+ Flash::notice(__("Tags updated.", "tags"), "/admin/?action=manage_tags");
0
public function admin_update_tag($admin) {
0
+ if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey)
0
+ show_403(__("Access Denied"), __("Invalid security key."));
0
public function admin_delete_tag($admin) {
0
foreach($sql->select("tags",
0
- array(":tag" => "%{{".$_GET['name']."}}%"))->fetchAll() as $tag)
0
+ array(":tag" => "%{{".$_GET['name']."}}%"))->fetchAll() as $tag) {
0
+ foreach (explode("}},{{", substr(substr($tag["tags"], 0, -2), 2)) as $name)
0
+ if ($name != $_GET['name'])
0
+ $names[] = "{{".$name."}}";
0
+ foreach (explode("}},{{", substr(substr($tag["clean"], 0, -2), 2)) as $clean)
0
+ if ($clean != $_GET['clean'])
0
+ $cleans[] = "{{".$clean."}}";
0
array("tags" => ":tags",
0
array(":id" => $tag["id"],
0
- ":tags" => preg_replace("/\{\{{$_GET['name']}\}\},?/", "", $tag["tags"]),
0
- ":clean" => preg_replace("/\{\{{$_GET['name']}\}\},?/", "", $tag["clean"])));
0
+ ":tags" => join(",", $names),
0
+ ":clean" => join(",", $cleans)));
0
Flash::notice(__("Tag deleted.", "tags"), "/admin/?action=manage_tags");
0
+ public function admin_bulk_tag($admin) {
0
+ if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey)
0
+ show_403(__("Access Denied"), __("Invalid security key."));
0
+ if (empty($_POST['name']) or empty($_POST['post']))
0
+ redirect("/admin/?action=manage_tags");
0
+ $sql = SQL::current();
0
+ foreach ($_POST['post'] as $post_id) {
0
+ $post = new Post($post_id);
0
+ $_POST['tags'] = join(", ", $post->tags["unlinked"]).", ".$_POST['name'];
0
+ $this->update_post($post);
0
+ Flash::notice(__("Posts tagged.", "tags"), "/admin/?action=manage_tags");
0
public function check_route_tag() {
0
public function filter_post($post) {
0
- if (!isset($post->unclean_tags))
0
- $post->tags = array("unlinked" => array(), "linked" => array());
0
- $post->tags = array("unlinked" => self::unlinked_tags($post->unclean_tags),
0
- "linked" => self::linked_tags($post->unclean_tags, $post->clean_tags));
0
+ if (empty($post->unclean_tags)) {
0
+ $post->tags = array("info" => array(), "unlinked" => array(), "linked" => array());
0
+ list($tags, $clean, $tag2clean) = $this->parseTags(array($post->unclean_tags), array($post->clean_tags));
0
+ $post->tags = array();
0
+ foreach ($tags as $tag => $count)
0
+ $post->tags["info"][] = array("name" => $tag,
0
+ "clean" => $tag2clean[$tag],
0
+ "url" => url("tag/".$tag2clean[$tag]."/"));
0
+ $post->tags["unlinked"] = self::unlinked_tags($post->unclean_tags);
0
+ $post->tags["linked"] = self::linked_tags($post->unclean_tags, $post->clean_tags);
0
public function sort_tags_name_asc($a, $b) {