From 466267fbb5b5cc466196e40b6a8fe96f25c57e2f Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Tue, 20 Jul 2010 05:21:19 -0700 Subject: lotsoflittlestuff --- mod/contacts.php | 24 +++++++++++++----------- mod/dfrn_notify.php | 2 +- mod/network.php | 5 +++++ mod/profile.php | 11 ++++++++++- mod/profile_photo.php | 16 ++++++++-------- 5 files changed, 37 insertions(+), 21 deletions(-) (limited to 'mod') diff --git a/mod/contacts.php b/mod/contacts.php index 4f48c1c3d..dcbadd2ba 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -88,11 +88,11 @@ 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']) - ); +// $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); @@ -113,12 +113,14 @@ function contacts_content(&$a) { $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(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) diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index ead49982b..169ae7bb7 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -5,7 +5,7 @@ require_once('include/items.php'); function dfrn_notify_post(&$a) { -dbg(3); + $dfrn_id = notags(trim($_POST['dfrn_id'])); $challenge = notags(trim($_POST['challenge'])); $data = $_POST['data']; diff --git a/mod/network.php b/mod/network.php index 51b528832..845a6bb77 100644 --- a/mod/network.php +++ b/mod/network.php @@ -15,6 +15,11 @@ function network_content(&$a) { $contact_id = $a->cid; + $r = q("UPDATE `item` SET `unseen` = 0 + WHERE `unseen` = 1 AND `uid` = %d", + intval($_SESSION['uid']) + ); + $tpl = file_get_contents('view/jot-header.tpl'); diff --git a/mod/profile.php b/mod/profile.php index db538750d..bb7357e5b 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -126,8 +126,17 @@ function profile_content(&$a) { // Profile owner - everything is visible - if(local_user() && ($_SESSION['uid'] == $a->profile['profile_uid'])) + if(local_user() && ($_SESSION['uid'] == $a->profile['profile_uid'])) { $sql_extra = ''; + + // Oh - while we're here... reset the Unseen messages + + $r = q("UPDATE `item` SET `unseen` = 0 + WHERE `type` != 'remote' AND `unseen` = 1 AND `uid` = %d", + intval($_SESSION['uid']) + ); + + } // authenticated visitor - here lie dragons elseif(remote_user()) { diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 36657ba14..9a694971d 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -4,17 +4,17 @@ require_once("Photo.php"); function profile_photo_init(&$a) { - if((! local_user()) { + if(! local_user()) { return; } require_once("mod/profile.php"); - profile_load($a,$_SESSION['uid']); + profile_load($a,$a->user['nickname']); } function profile_photo_post(&$a) { - if((! local_user()) { + if(! local_user()) { notice ( "Permission denied." . EOL ); return; } @@ -63,7 +63,7 @@ function profile_photo_post(&$a) { dbesc($base_image['filename']), intval($im->getHeight()), intval($im->getWidth()), - dbesc($im->imageString() + dbesc($im->imageString()) ); if($r === false) @@ -81,7 +81,7 @@ function profile_photo_post(&$a) { dbesc($base_image['filename']), intval($im->getHeight()), intval($im->getWidth()), - dbesc($im->imageString() + dbesc($im->imageString()) ); if($r === false) @@ -89,10 +89,10 @@ function profile_photo_post(&$a) { // Unset the profile photo flag from any other photos I own - $r = q("UPDATE `photo` SET `profile` = 0 WHERE `profile` = 1 AND `resource-id` != '%s' AND `uid` = %d" + $r = q("UPDATE `photo` SET `profile` = 0 WHERE `profile` = 1 AND `resource-id` != '%s' AND `uid` = %d", dbesc($base_image['resource-id']), intval($_SESSION['uid']) - ) + ); } goaway($a->get_baseurl() . '/profiles'); @@ -160,7 +160,7 @@ function profile_photo_post(&$a) { dbesc(basename($filename)), intval($ph->getHeight()), intval($ph->getWidth()), - dbesc($ph->imageString() + dbesc($ph->imageString()) ); if($r === false) notice("Image size reduction (640) failed." . EOL ); -- cgit v1.2.3