From 1b4d1a6b449de081f2d45983df11950ac4c453bc Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 31 Oct 2012 12:55:24 +0400 Subject: sharepopup: implement assigning labels while sharing --- include/functions.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'include/functions.php') diff --git a/include/functions.php b/include/functions.php index 2695b1cb9..a81a2c0cd 100644 --- a/include/functions.php +++ b/include/functions.php @@ -5545,10 +5545,18 @@ } - function create_published_article($link, $title, $url, $content, $owner_uid) { - $guid = sha1($url); + function create_published_article($link, $title, $url, $content, $labels_str, + $owner_uid) { + + $guid = sha1($url . $owner_uid); // include owner_uid to prevent global GUID clash $content_hash = sha1($content); + if ($labels_str != "") { + $labels = explode(",", $labels_str); + } else { + $labels = array(); + } + $rc = false; if (!$title) $title = $url; @@ -5584,6 +5592,12 @@ ('$ref_id', '', NULL, NULL, $owner_uid, true, '', '', NOW(), '', false)"); } + if (count($labels) != 0) { + foreach ($labels as $label) { + label_add_article($link, $ref_id, trim($label), $owner_uid); + } + } + $rc = true; } else { @@ -5602,6 +5616,12 @@ VALUES ('$ref_id', '', NULL, NULL, $owner_uid, true, '', '', NOW(), '', false)"); + if (count($labels) != 0) { + foreach ($labels as $label) { + label_add_article($link, $ref_id, trim($label), $owner_uid); + } + } + $rc = true; } } -- cgit v1.2.3