diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-08-01 05:46:51 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-08-01 05:46:51 -0700 |
commit | 3fd4b4264ef8c418bbf78edaa02f7e4e32f5022e (patch) | |
tree | 641803dc59dcd8440e252e5133424fde2a835636 /mod/contacts.php | |
parent | a4a46d82df14d5bcc6812a8e2b9f24eb78141e4e (diff) | |
download | volse-hubzilla-3fd4b4264ef8c418bbf78edaa02f7e4e32f5022e.tar.gz volse-hubzilla-3fd4b4264ef8c418bbf78edaa02f7e4e32f5022e.tar.bz2 volse-hubzilla-3fd4b4264ef8c418bbf78edaa02f7e4e32f5022e.zip |
set frequency of poll per contact, other misc fixes (photo now has contact-id)
Diffstat (limited to 'mod/contacts.php')
-rw-r--r-- | mod/contacts.php | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/mod/contacts.php b/mod/contacts.php index 1e3cb8f06..c1b3781bf 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -40,15 +40,20 @@ function contacts_post(&$a) { return; } } + $priority = intval($_POST['priority']); + if($priority > 5 || $priority < 0) + $priority = 0; + $rating = intval($_POST['reputation']); if($rating > 5 || $rating < 0) $rating = 0; $reason = notags(trim($_POST['reason'])); - $r = q("UPDATE `contact` SET `profile-id` = %d, `rating` = %d, `reason` = '%s' + $r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `rating` = %d, `reason` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($profile_id), + intval($priority), intval($rating), dbesc($reason), intval($contact_id), @@ -91,12 +96,6 @@ function contacts_content(&$a) { } -// $photo = str_replace('-4.jpg', '' , $r[0]['photo']); -// $photos = q("SELECT `id` FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d", -// dbesc($photo), -// intval($_SESSION['uid']) -// ); - if($cmd == 'block') { $blocked = (($orig_record[0]['blocked']) ? 0 : 1); $r = q("UPDATE `contact` SET `blocked` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1", @@ -130,19 +129,18 @@ function contacts_content(&$a) { if($cmd == 'drop') { $r = q("DELETE FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($contact_id), - intval($_SESSION['uid'])); - -// if(count($photos)) { -// foreach($photos as $p) { -// q("DELETE FROM `photos` WHERE `id` = %d LIMIT 1", -// $p['id']); -// } -// } - - if(intval($contact_id)) - q("DELETE FROM `item` WHERE `contact-id` = %d LIMIT 1", - intval($contact_id) - ); + intval($_SESSION['uid']) + ); + + q("DELETE FROM `item` WHERE `contact-id` = %d AND `uid` = %d ", + intval($contact_id), + intval($_SESSION['uid']) + ); + q("DELETE FROM `photo` WHERE `contact-id` = %d AND `uid` = %d ", + + intval($contact_id), + intval($_SESSION['uid']) + ); notice("Contact has been removed." . EOL ); goaway($a->get_baseurl() . '/contacts'); @@ -186,6 +184,10 @@ function contacts_content(&$a) { } $o .= replace_macros($tpl,array( + '$poll_interval' => contact_poll_interval($r[0]['priority']), + '$last_update' => (($r[0]['last-update'] == '0000-00-00 00:00:00') + ? t('Never') + : datetime_convert('UTC',date_default_timezone_get(),$r[0]['last-update'],'D, j M Y, G:i A')), '$profile_select' => contact_profile_assign($r[0]['profile-id']), '$contact_id' => $r[0]['id'], '$block_text' => (($r[0]['blocked']) ? t('Unblock this contact') : t('Block this contact') ), |