summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2012-10-31 12:55:24 +0400
committerAndrew Dolgov <[email protected]>2012-10-31 12:55:24 +0400
commit1b4d1a6b449de081f2d45983df11950ac4c453bc (patch)
tree7fd3cf93fefb8c727448b5673e3acee8a75dbe59 /include
parent4021d61ada06b250d40c4c508ab128581dc2e1ef (diff)
sharepopup: implement assigning labels while sharing
Diffstat (limited to 'include')
-rw-r--r--include/functions.php24
1 files changed, 22 insertions, 2 deletions
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;
}
}