|
From: <dj...@us...> - 2013-10-15 17:41:46
|
Revision: 12175
http://sourceforge.net/p/xoops/svn/12175
Author: djculex
Date: 2013-10-15 17:41:43 +0000 (Tue, 15 Oct 2013)
Log Message:
-----------
Bugfix : - Fixed problem with following issue when unfriending
Bugfix : - Multible issues with not displaying genderbased avatar if not uploaded.
Bugfix : - Sending notifications on replys to a thread where user is active, new registry, complaints etc
Bugfix : - Error with partnersearch or username search.
Bugfix : - Fixing a few IE special issues (Just gotta love IE :o[ )
Modified Paths:
--------------
XoopsModules/smallworld/trunk/smallworld/class/db.php
XoopsModules/smallworld/trunk/smallworld/class/mail.php
XoopsModules/smallworld/trunk/smallworld/comment_ajax.php
XoopsModules/smallworld/trunk/smallworld/include/functions.php
XoopsModules/smallworld/trunk/smallworld/js/smallworld.js
XoopsModules/smallworld/trunk/smallworld/search.php
Modified: XoopsModules/smallworld/trunk/smallworld/class/db.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/class/db.php 2013-10-14 18:48:40 UTC (rev 12174)
+++ XoopsModules/smallworld/trunk/smallworld/class/db.php 2013-10-15 17:41:43 UTC (rev 12175)
@@ -447,7 +447,9 @@
if ($following > 0) {
$sql = "DELETE FROM ".$xoopsDB->prefix('smallworld_followers')." WHERE you = '".intval($friend)."'";
$sql .= " AND me = '".intval($myUid)."'";
- $result = $xoopsDB->queryF($sql);
+ $sql2 = "DELETE FROM ".$xoopsDB->prefix('smallworld_followers')." WHERE me = '".intval($friend)."'";
+ $sql2 .= " AND you = '".intval($myUid)."'";
+ $result2 = $xoopsDB->queryF($sql2);
}
}
@@ -685,7 +687,7 @@
{
global $xoopsDB;
$sql = "SELECT value FROM ".$xoopsDB->prefix('smallworld_settings')." WHERE userid = ".intval($userid)."";
- $result = $xoopsDB->query($sql);
+ $result = $xoopsDB->queryF($sql);
$i = $xoopsDB->getRowsNum($result);
if ($i < 1) {
$posts = serialize(array(
@@ -700,8 +702,9 @@
while ($row=$xoopsDB->fetchArray($result)) {
$data = $row['value'];
}
+ return json_encode(unserialize(stripslashes($data)));
}
- return json_encode(unserialize(stripslashes($data)));
+
}
}
Modified: XoopsModules/smallworld/trunk/smallworld/class/mail.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/class/mail.php 2013-10-14 18:48:40 UTC (rev 12174)
+++ XoopsModules/smallworld/trunk/smallworld/class/mail.php 2013-10-15 17:41:43 UTC (rev 12175)
@@ -35,7 +35,7 @@
*/
function sendMails ($fromUserID, $toUserID, $event, $link=null, array $data) {
- global $xoopsConfig, $xoopsUser;
+ global $xoopsConfig, $xoopsUser;
$date = date('m-d-Y H:i:s',time());
$mail = new XoopsMultiMailer;
$wall = new Wall_Updates;
@@ -45,12 +45,11 @@
// From and To user ids
$FromUser = new xoopsUser($fromUserID);
$from_avatar = $wall->Gravatar($fromUserID);
- $from_avatarlink = "<img class='left' src='".XOOPS_URL."/uploads/".$from_avatar."' height='90px' width='90px'>";
+ $from_avatarlink = "<img class='left' src='".smallworld_getAvatarLink($fromUserID, $from_avatar)."' height='90px' width='90px'>";
$ToUser = new xoopsUser($toUserID);
$To_avatar = $wall->Gravatar($toUserID);
- $To_avatarlink = "<img class='left' src='".XOOPS_URL."/uploads/".$To_avatar."' height='90px' width='90px'>";
-
+ $To_avatarlink = "<img class='left' src='".smallworld_getAvatarLink ($toUserID, $To_avatar)."' height='90px' width='90px'>";
// Senders username
$SendName = $FromUser->getVar('uname');
$SendNameUrl = "<a href='".XOOPS_URL."/modules/smallworld/userprofile.php?username=".$SendName."'>".$SendName."</a>";
@@ -64,7 +63,7 @@
$subject = _SMALLWORLD_MAIL_REGISTERSUBJECT.$xoopsConfig['sitename'];
$registername = $SendName;
- $To_avatarlink = "<img class='left' src='".XOOPS_URL."/modules/smallworld/images/genderless.png' height='90px' width='90px'>";
+ $To_avatarlink = "<img class='left' src='".smallworld_getAvatarLink ($fromUserID, $To_avatar)."' height='90px' width='90px'>";
$tpl = new XoopsTpl();
$tpl->assign('registername',$registername);
@@ -112,7 +111,7 @@
$owner = Smallworld_getOwnerFromComment ($data['msg_id_fk']);
$OwnerUser = new xoopsUser($owner);
$Owner_avatar = $wall->Gravatar($owner);
- $Owner_avatarlink = "<img class='left' src='".XOOPS_URL."/uploads/".$Owner_avatar."' height='90px' width='90px'>";
+ $Owner_avatarlink = "<img class='left' src='".smallworld_getAvatarLink ($owner, $Owner_avatar)."' height='90px' width='90px'>";
$OwnerName = $OwnerUser->getVar('uname');
$OwnerNameUrl = "<a href='".XOOPS_URL."/modules/smallworld/userprofile.php?username=".$OwnerName."'>".$OwnerName."</a>";
Modified: XoopsModules/smallworld/trunk/smallworld/comment_ajax.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/comment_ajax.php 2013-10-14 18:48:40 UTC (rev 12174)
+++ XoopsModules/smallworld/trunk/smallworld/comment_ajax.php 2013-10-15 17:41:43 UTC (rev 12175)
@@ -24,6 +24,7 @@
include_once (XOOPS_ROOT_PATH.'/class/template.php');
global $xoopsUser, $xoopsModule,$xoopsLogger,$xoopsTpl;
$xoopsLogger->activated = false;
+//error_reporting(E_ALL);
$page = 'index';
$check = new SmallWorldUser;
$id = ($xoopsUser) ? $xoopsUser->getVar('uid'):0;
@@ -61,6 +62,7 @@
$USC = array();
$USC['posts'] = 0;
$USC['comments'] = 0;
+ //$USC['notify'] = 0;
if ($xoopsUser) {
@@ -93,10 +95,10 @@
$wc['avatar_size'] = smallworld_getImageSize(80, 100, $wc['myavatar_link']);
$wc['avatar_highwide'] = smallworld_imageResize($wc['avatar_size'][0], $wc['avatar_size'][1], 35);
$wc['compl_msg_lnk'] = "<a href='".XOOPS_URL."/modules/smallworld/permalink.php?ownerid=".Smallworld_getOwnerFromComment($data['msg_id_fk']);
- $wc['compl_msg_lnk'] .= "&updid=".$cdata['msg_id_fk']."#".$data['com_id']."'>"._SMALLWORLD_COMP_MSG_LNK_DESC."</a>";
+ $wc['compl_msg_lnk'] .= "&updid=".$data['msg_id_fk']."#".$data['com_id']."'>"._SMALLWORLD_COMP_MSG_LNK_DESC."</a>";
$wc['vote_up'] = $Wall->countVotesCom ('com', 'up', $data['msg_id_fk'],$data['com_id']);
$wc['vote_down'] = $Wall->countVotesCom ('com', 'down', $data['msg_id_fk'],$data['com_id']);
-
+
//Send mail if tagged
$permalink = XOOPS_URL."/modules/smallworld/permalink.php?ownerid=".$data['uid_fk']."&updid=".$data['msg_id_fk'];
smallworld_getTagUsers ($wc['comment'],$wc['uid'], $permalink);
@@ -112,10 +114,12 @@
// send mail to user owning update + participans in the thread that a comment has been posted
$parts = $mail->getPartsFromComment ($data['msg_id_fk']);
$emails = "";
- foreach ($parts as $k=>$v) {
+ foreach ($parts as $k => $v) {
$owner = Smallworld_getOwnerFromComment ($data['msg_id_fk']);
+ // Get owner of posts settings in order to send mail or not!
+ $owner_privset = json_decode($dBase->GetSettings($v), true);
if(smallworld_GetModuleOption('smallworldusemailnotis', $repmodule='smallworld') != 0) {
- if ($USC['notify'] == 1) {
+ if ($owner_privset['notify'] == 1) {
$mail->sendMails ($data['uid_fk'], $v, 'commentToWM', $link=null, $wc);
}
}
Modified: XoopsModules/smallworld/trunk/smallworld/include/functions.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/include/functions.php 2013-10-14 18:48:40 UTC (rev 12174)
+++ XoopsModules/smallworld/trunk/smallworld/include/functions.php 2013-10-15 17:41:43 UTC (rev 12175)
@@ -569,9 +569,20 @@
while ($r = $xoopsDB->fetchArray($result)) {
$image = $r['userimage'];
}
- if ($image == 'Not specifiyed' || $image == '') {
- $avt = new XoopsUser($uid);
- $avatar = $avt->user_avatar();
+
+ $image = ($image == '' || $image == 'blank.gif') ? smallworld_getAvatarLink($uid, $image) : $image;
+
+ $type = Array(
+ 1 => 'jpg',
+ 2 => 'jpeg',
+ 3 => 'png',
+ 4 => 'gif'
+ );
+
+ $ext = explode(".",$image);
+
+ if (@!in_array(strtolower ($ext[1]), $type) || $image == '') {
+ $avatar = '';
} else {
$avatar = $image;
}
Modified: XoopsModules/smallworld/trunk/smallworld/js/smallworld.js
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/js/smallworld.js 2013-10-14 18:48:40 UTC (rev 12174)
+++ XoopsModules/smallworld/trunk/smallworld/js/smallworld.js 2013-10-15 17:41:43 UTC (rev 12175)
@@ -243,7 +243,7 @@
changeMonth: true,
changeYear: true,
dateFormat: 'yy',
- yearRange: '-100:+0',
+ yearRange: '-100:+0'
});
// Attach jquery-ui datepicker to form.
@@ -332,56 +332,56 @@
}
function extractLast(term) {
- return split( term ).pop();
+ return split( term ).pop();
}
// Attach '@' to comment and message for user tagging
xoops_smallworld(document).ready(function() {
xoops_smallworld("#smallworld_update, .smallworld_comment").bind("keydown", function(event) {
- // if TAB or autocomplete already is active
- if (event.keyCode === 9 && xoops_smallworld(this).data("autocomplete").menu.active) {
- event.preventDefault();
- }
- // if @ is pressed
+ // if TAB or autocomplete already is active
+ if (event.keyCode === 9 && xoops_smallworld(this).data("autocomplete").menu.active) {
+ event.preventDefault();
+ }
+ // if @ is pressed
if (event.keyCode === 50) {
xoops_smallworld(this).autocomplete({
disabled: false,
minLength: 1,
source : function (request, response) {
- xoops_smallworld.ajax({
- // basePath is used for defining contecxt-path of the url.
- url: smallworld_url+ 'partnersearch.php',
- dataType: "json",
- // data to be sent to the server:
- data: {
- term : extractLast(request.term)
- },
- success: function(data,type) {
- //console.log( data);
- items = data;
- response(items);
- },
- error: function(data,type){
- console.log( type);
- }
+ xoops_smallworld.ajax({
+ // basePath is used for defining contecxt-path of the url.
+ url: smallworld_url+ 'search.php',
+ dataType: "json",
+ // data to be sent to the server:
+ data: {
+ term : extractLast(request.term)
+ },
+ success: function(data,type) {
+ //console.log( data);
+ items = data;
+ response(items);
+ },
+ error: function(data,type){
+ console.log( type);
+ }
});
- },
+ },
focus: function() {
return false;
- },
+ },
open: function(event, ui){
- xoops_smallworld("ul.ui-autocomplete li a").each(function(){
- var htmlString = xoops_smallworld(this).html().replace(/</g, '<');
- htmlString = htmlString.replace(/>/g, '>');
- xoops_smallworld(this).html(htmlString);
- xoops_smallworld('.ui-autocomplete.ui-menu').width(200);
- });
+ xoops_smallworld("ul.ui-autocomplete li a").each(function(){
+ var htmlString = xoops_smallworld(this).html().replace(/</g, '<');
+ htmlString = htmlString.replace(/>/g, '>');
+ xoops_smallworld(this).html(htmlString);
+ xoops_smallworld('.ui-autocomplete.ui-menu').width(200);
+ });
},
select: function(event, ui) {
var terms = split_(this.value);
terms.pop();
//Add @ to username
- ui.item.value = "@" + ui.item.value;
+ ui.item.value = "@" + ui.item.value;
terms.push(ui.item.value);
terms.push("");
// Join last username with @
@@ -393,16 +393,16 @@
}
});
} else {
- xoops_smallworld(this).autocomplete({ disabled: true });
- xoops_smallworld(this).autocomplete( "close" );
- }
+ xoops_smallworld(this).autocomplete({ disabled: true });
+ xoops_smallworld(this).autocomplete( "close" );
+ }
});
-});
+});
// Search for partner in smallworld users or accept username
xoops_smallworld(function() {
xoops_smallworld("#partner").autocomplete({
- source: smallworld_url+ 'partnersearch.php',
+ source: smallworld_url+ 'search.php',
minLength:1,
open: function(event, ui){
xoops_smallworld("ul.ui-autocomplete li a").each(function(){
@@ -411,6 +411,9 @@
xoops_smallworld(this).html(htmlString);
xoops_smallworld('.ui-autocomplete.ui-menu').width(200);
});
+ },
+ select: function(event, ui) {
+ xoops_smallworld("input#partner").val(ui.item.value);
}
});
});
Modified: XoopsModules/smallworld/trunk/smallworld/search.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/search.php 2013-10-14 18:48:40 UTC (rev 12174)
+++ XoopsModules/smallworld/trunk/smallworld/search.php 2013-10-15 17:41:43 UTC (rev 12175)
@@ -38,18 +38,8 @@
$imageLink = XOOPS_URL.'/uploads/'.trim($row['userimage']);
$imageSize = smallworld_getImageSize(30, 30, $imageLink);
$imageHw = smallworld_imageResize($imageSize[0], $imageSize[1], 30);
- $image = '<img src="'.XOOPS_URL.'/uploads/'.$row['userimage'].'" '.$imageHw.'/>';
- } else {
- if ($row['gender'] == 1) {
- $image = "<img src='".XOOPS_URL."/modules/smallworld/images/ano_woman.png'"." height='30px' width='30px'/>";
- }
- if ($row['gender'] == 2) {
- $image = "<img src='".XOOPS_URL."/modules/smallworld/images/ano_man.png'"." height='30px' width='30px'/>";
- }
- if ($row['gender'] == 0) {
- $image = "<img src='".XOOPS_URL."/modules/smallworld/images/genderless.png'"." height='30px' width='30px'/>";
- }
- }
+ $image = '<img src="'.smallworld_getAvatarLink ($row['userid'], $row['userimage']).'" height="20" />';
+ }
$imageHw = smallworld_imageResize($imageSize[0], $imageSize[1], 30);
$data[] = array(
|