aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rwxr-xr-xmod/editpost.php2
-rwxr-xr-xmod/item.php30
-rwxr-xr-xmod/profile.php21
3 files changed, 46 insertions, 7 deletions
diff --git a/mod/editpost.php b/mod/editpost.php
index 2ddba36aa..4c00201ca 100755
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -115,6 +115,8 @@ function editpost_content(&$a) {
'$jotnets' => $jotnets,
'$title' => $itm[0]['title'],
'$placeholdertitle' => t('Set title'),
+ '$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
+ '$placeholdercategory' => t('Categories (comma-separated list)'),
'$emtitle' => t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate,
'$acl' => '', // populate_acl((($group) ? $group_acl : $a->user), $celeb),
diff --git a/mod/item.php b/mod/item.php
index 24730f53e..72e63865b 100755
--- a/mod/item.php
+++ b/mod/item.php
@@ -216,8 +216,6 @@ function item_post(&$a) {
$emailcc = notags(trim($_REQUEST['emailcc']));
$body = escape_tags(trim($_REQUEST['body']));
- // $categories = TODO
-
$private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0);
if(($parent_item) &&
@@ -255,6 +253,19 @@ function item_post(&$a) {
}
}
+ if(strlen($categories)) {
+ // get the "fileas" tags for this post
+ $filedas = file_tag_file_to_list($categories, 'file');
+ }
+ // save old and new categories, so we can determine what needs to be deleted from pconfig
+ $categories_old = $categories;
+ $categories = file_tag_list_to_file(trim($_REQUEST['category']), 'category');
+ $categories_new = $categories;
+ if(strlen($filedas)) {
+ // append the fileas stuff to the new categories list
+ $categories .= file_tag_list_to_file($filedas, 'file');
+ }
+
// Work around doubled linefeeds in Tinymce 3.5b2
// First figure out if it's a status post that would've been
// created using tinymce. Otherwise leave it alone.
@@ -572,6 +583,9 @@ function item_post(&$a) {
intval($profile_uid)
);
+ // update filetags in pconfig
+ file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
+
proc_run('php', "include/notifier.php", 'edit_post', "$post_id");
if((x($_REQUEST,'return')) && strlen($return_path)) {
logger('return: ' . $return_path);
@@ -585,8 +599,8 @@ function item_post(&$a) {
$r = q("INSERT INTO `item` (`guid`, `uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `commented`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`,
- `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin`, `moderated` )
- VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d )",
+ `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin`, `moderated`, `file` )
+ VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, '%s' )",
dbesc($datarray['guid']),
intval($datarray['uid']),
dbesc($datarray['type']),
@@ -624,8 +638,9 @@ function item_post(&$a) {
dbesc($datarray['attach']),
intval($datarray['bookmark']),
intval($datarray['origin']),
- intval($datarray['moderated'])
- );
+ intval($datarray['moderated']),
+ dbesc($datarray['file'])
+ );
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
dbesc($datarray['uri']));
@@ -633,6 +648,9 @@ function item_post(&$a) {
$post_id = $r[0]['id'];
logger('mod_item: saved item ' . $post_id);
+ // update filetags in pconfig
+ file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
+
if($parent) {
// This item is the last leaf and gets the comment box, clear any ancestors
diff --git a/mod/profile.php b/mod/profile.php
index 782d17d83..26b33d5f1 100755
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -2,6 +2,11 @@
function profile_init(&$a) {
+ require_once('include/contact_widgets.php');
+
+ if(! x($a->page,'aside'))
+ $a->page['aside'] = '';
+
$blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
if($a->argc > 1)
@@ -59,6 +64,13 @@ function profile_init(&$a) {
function profile_content(&$a, $update = 0) {
+ if (x($a->category)) {
+ $category = $a->category;
+ }
+ else {
+ $category = ((x($_GET,'category')) ? $_GET['category'] : '');
+ }
+
if(get_config('system','block_public') && (! local_user()) && (! remote_user())) {
return login();
}
@@ -112,7 +124,8 @@ function profile_content(&$a, $update = 0) {
return;
}
-
+ $a->page['aside'] .= categories_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],(x($category) ? xmlify($category) : ''));
+
if(! $update) {
if(x($_GET,'tab'))
$tab = notags(trim($_GET['tab']));
@@ -135,6 +148,7 @@ function profile_content(&$a, $update = 0) {
$celeb = ((($a->profile['page-flags'] == PAGE_SOAPBOX) || ($a->profile['page-flags'] == PAGE_COMMUNITY)) ? true : false);
+
if(can_write_wall($a,$a->profile['profile_uid'])) {
$x = array(
@@ -178,6 +192,10 @@ function profile_content(&$a, $update = 0) {
}
else {
+ if(x($category)) {
+ $sql_extra .= file_tag_file_query('item',$category,'category');
+ }
+
$r = q("SELECT COUNT(*) AS `total`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
@@ -204,6 +222,7 @@ function profile_content(&$a, $update = 0) {
intval($a->profile['profile_uid'])
);
+
}
$parents_arr = array();