|
From: <dj...@us...> - 2013-10-01 17:11:23
|
Revision: 12114
http://sourceforge.net/p/xoops/svn/12114
Author: djculex
Date: 2013-10-01 17:11:18 +0000 (Tue, 01 Oct 2013)
Log Message:
-----------
NEW : When entering admin automaticly rename user avatars set as blank.gif to void.
NEW : Parsing array from walls in respective classes clearing multible lines of code
NEW : smallworld_referer to return after various pages
NEW : Count all msg in wall
BUG : Mysql error in ALTER table comments from varchar to text
BUG : School start/stop displayed wrong.
BUG : User avatars displayed void if blank. No shows default gender / no-gender user avatar
BUG : User gallery opening in new tab / window. Now direct to _self instead of _SELF (?)
BUG : Error in smallworld_getAvatarLink($userid, $image); Condition changed from || to &&
BUG : comment_ajax. Condition changed from AND to OR if admin or owner of comment. Permission added to condition correctly.
BUG : In edit profile education start/stop displays correct data (date function not needed in this case).
BUG : In gallery only displays if visitor is a friend or admin.
BUG : Heavy code cleanup -> re-arranging to make use of classes / functions.
BUG : Only allow friends to view profile.
BUG : User posts not showing correctly to friends/followers OR admin.
BUG : jquery.history.js added to code to show hidden iframe in IE correctly.
BUG : After accepting friend request force reload of page to show new friend posts.
BUG : After closing gallery return to refer-page.
BUG : In smallworld.js -> tagging. If @ is followed by /s then close autocomplete indicating email or other. ((this).autocomplete( "close" );)
BUG : When tagging autocomplete is attached after single @ not @@@ (wow strange error)
BUG : Removed test alert() OR console.logs used for testing.
BUG : In friendpage show only gallery menu items for friends.
BUG : Show only wall container if num of messages > 0. [smarty error]
BUG : Rename selector (gave issue with TDMPicture) [mamba]
Modified Paths:
--------------
XoopsModules/smallworld/trunk/smallworld/admin/upgrade.php
XoopsModules/smallworld/trunk/smallworld/class/db.php
XoopsModules/smallworld/trunk/smallworld/class/publicWall.php
XoopsModules/smallworld/trunk/smallworld/class/wall.php
XoopsModules/smallworld/trunk/smallworld/comment_ajax.php
XoopsModules/smallworld/trunk/smallworld/css/smallworld.css
XoopsModules/smallworld/trunk/smallworld/editprofile.php
XoopsModules/smallworld/trunk/smallworld/galleryshow.php
XoopsModules/smallworld/trunk/smallworld/include/functions.php
XoopsModules/smallworld/trunk/smallworld/index.php
XoopsModules/smallworld/trunk/smallworld/js/jquery.history.js
XoopsModules/smallworld/trunk/smallworld/js/smallworld.js
XoopsModules/smallworld/trunk/smallworld/language/english/main.php
XoopsModules/smallworld/trunk/smallworld/loadmore.php
XoopsModules/smallworld/trunk/smallworld/message_ajax.php
XoopsModules/smallworld/trunk/smallworld/permalink.php
XoopsModules/smallworld/trunk/smallworld/publicindex.php
XoopsModules/smallworld/trunk/smallworld/templates/smallworld_friends_template.html
XoopsModules/smallworld/trunk/smallworld/templates/smallworld_galleryshow.html
XoopsModules/smallworld/trunk/smallworld/templates/smallworld_publicindex.html
XoopsModules/smallworld/trunk/smallworld/templates/smallworld_userprofile_template.html
XoopsModules/smallworld/trunk/smallworld/userprofile.php
Modified: XoopsModules/smallworld/trunk/smallworld/admin/upgrade.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/admin/upgrade.php 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/admin/upgrade.php 2013-10-01 17:11:18 UTC (rev 12114)
@@ -8,6 +8,7 @@
global $xoopsDB, $xoopsUser;
varcharToBlog ();
smallworld_comToBlog ();
+ smallworld_adminAvatarRename ();
if (smallworld_DoTableExists($xoopsDB->prefix('smallworld_settings'))) {
// Table exists
Return false;
@@ -24,6 +25,14 @@
}
}
+function smallworld_adminAvatarRename () {
+ global $xoopsDB;
+ $sql = "update ".$xoopsDB->prefix('smallworld_admin')." set userimage = '' WHERE userimage = 'blank.gif' || userimage NOT REGEXP '\.(jpe?g|gif|png|bmp)'";
+ $sql2 = "update ".$xoopsDB->prefix('smallworld_user')." set userimage = '' WHERE userimage = 'blank.gif' || userimage NOT REGEXP '\.(jpe?g|gif|png|bmp)'";
+ $result = $xoopsDB->queryF($sql);
+ $result2 = $xoopsDB->queryF($sql2);
+}
+
function smallworld_DoTableExists($tablename) {
global $xoopsDB;
$result = $xoopsDB->queryF("SHOW TABLES LIKE '$tablename'");
@@ -46,7 +55,7 @@
*/
function smallworld_comToBlog () {
global $xoopsDB;
- $sql ="ALTER TABLE ".$xoopsDB->prefix('smallworld_comments')." CHANGE 'comments' 'comments' TEXT";
+ $sql ="ALTER TABLE ".$xoopsDB->prefix('smallworld_comments')." CHANGE comment comment TEXT";
$result = $xoopsDB->queryF($sql);
}
?>
\ No newline at end of file
Modified: XoopsModules/smallworld/trunk/smallworld/class/db.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/class/db.php 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/class/db.php 2013-10-01 17:11:18 UTC (rev 12114)
@@ -77,8 +77,8 @@
while ($start<=$end) {
$msg[$start]['school_type'] = $school_type[$start];
$msg[$start]['school'] = $arr7[$school[$start]];
- $msg[$start]['schoolstart'] = date('Y', $schoolstart[$start]);
- $msg[$start]['schoolstop'] = date('Y', $schoolstop[$start]);
+ $msg[$start]['schoolstart'] = $schoolstart[$start];
+ $msg[$start]['schoolstop'] = $schoolstop[$start];
$start++;
}
return $msg;
@@ -241,15 +241,14 @@
$aboutme = Smallworld_sanitize($_POST['aboutme']);
$school_type = Smallworld_sanitize(serialize($_POST['school_type']));
$school = Smallworld_sanitize(serialize($_POST['school']));
- $schoolstart = Smallworld_sanitize(serialize(Smallworld_DateOfArray ($_POST['schoolstart'])));
- $schoolstop = Smallworld_sanitize(serialize(Smallworld_DateOfArray ($_POST['schoolstop'])));
+ $schoolstart = Smallworld_sanitize(serialize($_POST['schoolstart']));
+ $schoolstop = Smallworld_sanitize(serialize($_POST['schoolstop']));
$jobemployer = Smallworld_sanitize(serialize($_POST['employer']));
$jobposition = Smallworld_sanitize(serialize($_POST['position']));
$jobstart = Smallworld_sanitize(serialize(Smallworld_YearOfArray ($_POST['jobstart'])));
$jobstop = Smallworld_sanitize(serialize(Smallworld_YearOfArray ($_POST['jobstop'])));
$jobdescription = Smallworld_sanitize(serialize($_POST['description']));
-
$sql = '';
if ($_POST['function']=='edit') {
Modified: XoopsModules/smallworld/trunk/smallworld/class/publicWall.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/class/publicWall.php 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/class/publicWall.php 2013-10-01 17:11:18 UTC (rev 12114)
@@ -151,6 +151,12 @@
$image = $r['userimage'];
}
+ if ($image == 'blank.gif') {
+ $image = smallworld_getAvatarLink($uid, $image);
+ }
+
+ //$image = ($image == '' || $image == 'blank.gif') ? smallworld_getAvatarLink($uid, $image) : $image;
+
$type = Array(
1 => 'jpg',
2 => 'jpeg',
@@ -345,6 +351,147 @@
}
return $text;
}
-
+
+ /**
+ * @Parse update and comments array to template for public updates
+ * @param array $updatesarray
+ * @param int $id
+ * @param string $permalink
+ * @return void
+ */
+ function ParsePubArray ($updatesarray, $id)
+ {
+ global $xoopsUser, $xoopsTpl, $tpl, $xoopsModule, $xoopsTpl, $xoopsConfig;
+
+ $check = new SmallWorldUser;
+ $dBase = new SmallWorldDB;
+ $profile = ($xoopsUser) ? $check->checkIfProfile($id) : 0;
+ $module_handler =& xoops_gethandler('module');
+ $module = $module_handler->getByDirname('smallworld');
+ $config_handler =& xoops_gethandler('config');
+ $moduleConfig =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
+
+ $myavatar = $this->Gravatar($id);
+ $myavatarlink = smallworld_getAvatarLink($id, $myavatar);
+ $myavatar_size = smallworld_getImageSize(80, 100, $myavatarlink);
+ $myavatar_highwide = smallworld_imageResize($myavatar_size[0], $myavatar_size[1], 100);
+ $user_img = "<img src='".smallworld_getAvatarLink($id, $myavatar)."' id='smallworld_user_img' ".$myavatar_highwide."/>";
+
+ $xoopsTpl->assign('myavatar',$myavatar);
+ $xoopsTpl->assign('myavatarlink',$myavatarlink);
+ $xoopsTpl->assign('myavatar_highwide',$myavatar_highwide);
+ $xoopsTpl->assign('avatar', $user_img);
+
+ if (!empty($updatesarray)) {
+ foreach ($updatesarray as $data) {
+
+ // Is update's user a friend ?
+ $frU = $check->friendcheck($id,$data['uid_fk']);
+
+ $USW = array();
+ $USW['posts'] = 0;
+ $USW['comments'] = 0;
+
+ if ($xoopsUser) {
+ if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $data['uid_fk'] == $id) {
+ $USW['posts'] = 1;
+ $USW['comments'] = 1;
+ $frU[0] = 2;
+ } else {
+ $USW = json_decode($dBase->GetSettings($data['uid_fk']), true);
+ }
+ }
+
+ if (!$xoopsUser) {
+ $USW = json_decode($dBase->GetSettings($data['uid_fk']), true);
+ }
+
+ $wm['msg_id'] = $data['msg_id'];
+ $wm['orimessage'] = ($USW['posts'] == 1 || $profile >= 2) ?
+ str_replace(array("\r", "\n"), '',Smallworld_stripWordsKeepUrl($data['message'])):'';
+ $wm['message'] = ($USW['posts'] == 1 || $profile >= 2) ?
+ smallworld_tolink(htmlspecialchars_decode($data['message']), $data['uid_fk']):_SMALLWORLD_MESSAGE_PRIVSETPOSTS;
+ $wm['message'] = Smallworld_cleanup($wm['message']);
+ $wm['created'] = smallworld_time_stamp($data['created']);
+ $wm['username'] = $data['username'];
+ $wm['uid_fk'] = $data['uid_fk'];
+ $wm['priv'] = $data['priv'];
+ $wm['avatar'] = $this->Gravatar($data['uid_fk']);
+ $wm['avatar_link'] = smallworld_getAvatarLink ($data['uid_fk'], $wm['avatar']);
+ $wm['avatar_size'] = smallworld_getImageSize(80, 100, $wm['avatar_link']);
+ $wm['avatar_highwide'] = smallworld_imageResize($wm['avatar_size'][0], $wm['avatar_size'][1], 50);
+ $wm['vote_up'] = $this->countVotes ('msg', 'up', $data['msg_id']);
+ $wm['vote_down'] = $this->countVotes ('msg', 'down', $data['msg_id']);
+ $wm['sharelinkurl'] = XOOPS_URL."/modules/smallworld/smallworldshare.php?ownerid=".$data['uid_fk'];
+ $wm['sharelinkurl'] .= "&updid=".$data['msg_id']."";
+ $wm['usernameTitle'] = $wm['username']._SMALLWORLD_UPDATEONSITEMETA.$xoopsConfig['sitename'];
+ if ($USW['posts'] == 1 || $profile >= 2) {
+ $wm['sharelink'] = $this->GetSharing ($wm['msg_id'],$wm['priv']);
+ } else {
+ $wm['sharelink'] = $this->GetSharing ($wm['msg_id'],1);
+ }
+
+ if ($USW['posts'] == 1 || $profile >= 2) {
+ $wm['sharediv'] = $this->GetSharingDiv ($wm['msg_id'],$wm['priv'], $wm['sharelinkurl'],$wm['orimessage'],$wm['usernameTitle']);
+ } else {
+ $wm['sharediv'] = $this->GetSharingDiv ($wm['msg_id'],1, $wm['sharelinkurl'],$wm['orimessage'],$wm['usernameTitle']);
+ }
+ $wm['linkimage'] = XOOPS_URL."/modules/smallworld/images/link.png";
+ $wm['permalink'] = XOOPS_URL."/modules/smallworld/permalink.php?ownerid=".$data['uid_fk']."&updid=".$data['msg_id'];
+ $wm['commentsarray'] = $this->Comments($data['msg_id']);
+
+ if ($frU[0] == 2 || $USW['posts'] == 1) {
+ $xoopsTpl->append('walldata', $wm);
+ }
+
+ if (!empty($wm['commentsarray'])){
+ foreach($wm['commentsarray'] as $cdata) {
+ // Is commentuser a friend ?
+ $frC = $check->friendcheck($id,$cdata['uid_fk']);
+
+ $USC = array();
+ $USC['posts'] = 0;
+ $USC['comments'] = 0;
+
+ if ($xoopsUser) {
+ if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $cdata['uid_fk'] == $id) {
+ $USC['posts'] = 1;
+ $USC['comments'] = 1;
+ $frC[0] = 2;
+ } else {
+ $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true);
+ }
+ }
+
+ if (!$xoopsUser) {
+ $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true);
+ }
+
+ $wc['msg_id_fk'] = $cdata['msg_id_fk'];
+ $wc['com_id'] = $cdata['com_id'];
+ $wc['comment'] = ($USC['comments'] == 1 || $profile >= 2) ?
+ smallworld_tolink(htmlspecialchars_decode($cdata['comment']),$cdata['uid_fk']):
+ _SMALLWORLD_MESSAGE_PRIVSETCOMMENTS;
+ $wc['comment'] = Smallworld_cleanup($wc['comment']);
+ $wc['time'] = smallworld_time_stamp($cdata['created']);
+ $wc['username'] = $cdata['username'];
+ $wc['uid'] = $cdata['uid_fk'];
+ $wc['myavatar'] = $this->Gravatar($id);
+ $wc['myavatar_link'] = $myavatarlink;
+ $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['cface'] = $this->Gravatar($cdata['uid_fk']);
+ $wc['avatar_link'] = smallworld_getAvatarLink ($cdata['uid_fk'], $wc['cface']);
+ $wc['vote_up'] = $this->countVotesCom ('com', 'up', $cdata['msg_id_fk'],$cdata['com_id']);
+ $wc['vote_down'] = $this->countVotesCom ('com', 'down', $cdata['msg_id_fk'],$cdata['com_id']);
+
+ if ($frC[0] == 2 || $USC['comments'] == 1) {
+ $xoopsTpl->append('comm', $wc);
+ }
+ }
+ }
+ }
+ }
+ }
}
?>
\ No newline at end of file
Modified: XoopsModules/smallworld/trunk/smallworld/class/wall.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/class/wall.php 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/class/wall.php 2013-10-01 17:11:18 UTC (rev 12114)
@@ -140,7 +140,7 @@
$image = $r['userimage'];
}
- $image = ($image == '') ? smallworld_getAvatarLink($uid, $image) : $image;
+ $image = ($image == '' || $image == 'blank.gif') ? smallworld_getAvatarLink($uid, $image) : $image;
$type = Array(
1 => 'jpg',
@@ -436,5 +436,144 @@
return $text;
}
+ /**
+ * @Parse update and comments array to template for public updates
+ * @param array $updatesarray
+ * @param int $id
+ * @param string $permalink
+ * @return void
+ */
+ function ParsePubArray ($updatesarray, $id)
+ {
+ global $xoopsUser, $xoopsTpl, $tpl, $xoopsModule, $xoopsConfig;
+
+ $check = new SmallWorldUser;
+ $dBase = new SmallWorldDB;
+ $profile = ($xoopsUser) ? $check->checkIfProfile($id) : 0;
+ $module_handler =& xoops_gethandler('module');
+ $module = $module_handler->getByDirname('smallworld');
+ $config_handler =& xoops_gethandler('config');
+ $moduleConfig =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
+
+ $myavatar = $this->Gravatar($id);
+ $myavatarlink = smallworld_getAvatarLink($id, $myavatar);
+ $myavatar_size = smallworld_getImageSize(80, 100, $myavatarlink);
+ $myavatar_highwide = smallworld_imageResize($myavatar_size[0], $myavatar_size[1], 35);
+
+ $xoopsTpl->assign('myavatar',$myavatar);
+ $xoopsTpl->assign('myavatarlink',$myavatarlink);
+ $xoopsTpl->assign('myavatar_highwide',$myavatar_highwide);
+
+ if (!empty($updatesarray)) {
+ foreach ($updatesarray as $data) {
+
+ // Is update's user a friend ?
+ $frU = $check->friendcheck($id,$data['uid_fk']);
+
+ $USW = array();
+ $USW['posts'] = 0;
+ $USW['comments'] = 0;
+
+ if ($xoopsUser) {
+ if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $data['uid_fk'] == $id) {
+ $USW['posts'] = 1;
+ $USW['comments'] = 1;
+ $frU[0] = 2;
+ } else {
+ $USW = json_decode($dBase->GetSettings($data['uid_fk']), true);
+ }
+ }
+
+ if (!$xoopsUser) {
+ $USW = json_decode($dBase->GetSettings($data['uid_fk']), true);
+ }
+
+ $wm['msg_id'] = $data['msg_id'];
+ $wm['orimessage'] = ($USW['posts'] == 1 || $profile >= 2) ?
+ str_replace(array("\r", "\n"), '',Smallworld_stripWordsKeepUrl($data['message'])):'';
+ $wm['message'] = ($USW['posts'] == 1 || $profile >= 2) ?
+ smallworld_tolink(htmlspecialchars_decode($data['message']), $data['uid_fk']):_SMALLWORLD_MESSAGE_PRIVSETPOSTS;
+ $wm['message'] = Smallworld_cleanup($wm['message']);
+ $wm['created'] = smallworld_time_stamp($data['created']);
+ $wm['username'] = $data['username'];
+ $wm['uid_fk'] = $data['uid_fk'];
+ $wm['priv'] = $data['priv'];
+ $wm['avatar'] = $this->Gravatar($data['uid_fk']);
+ $wm['avatar_link'] = smallworld_getAvatarLink ($data['uid_fk'], $wm['avatar']);
+ $wm['avatar_size'] = smallworld_getImageSize(80, 100, $wm['avatar_link']);
+ $wm['avatar_highwide'] = smallworld_imageResize($wm['avatar_size'][0], $wm['avatar_size'][1], 50);
+ $wm['vote_up'] = $this->countVotes ('msg', 'up', $data['msg_id']);
+ $wm['vote_down'] = $this->countVotes ('msg', 'down', $data['msg_id']);
+ $wm['sharelinkurl'] = XOOPS_URL."/modules/smallworld/smallworldshare.php?ownerid=".$data['uid_fk'];
+ $wm['sharelinkurl'] .= "&updid=".$data['msg_id']."";
+ $wm['usernameTitle'] = $wm['username']._SMALLWORLD_UPDATEONSITEMETA.$xoopsConfig['sitename'];
+ if ($USW['posts'] == 1 || $profile >= 2) {
+ $wm['sharelink'] = $this->GetSharing ($wm['msg_id'],$wm['priv']);
+ } else {
+ $wm['sharelink'] = $this->GetSharing ($wm['msg_id'],1);
+ }
+
+ if ($USW['posts'] == 1 || $profile >= 2) {
+ $wm['sharediv'] = $this->GetSharingDiv ($wm['msg_id'],$wm['priv'], $wm['sharelinkurl'],$wm['orimessage'],$wm['usernameTitle']);
+ } else {
+ $wm['sharediv'] = $this->GetSharingDiv ($wm['msg_id'],1, $wm['sharelinkurl'],$wm['orimessage'],$wm['usernameTitle']);
+ }
+ $wm['linkimage'] = XOOPS_URL."/modules/smallworld/images/link.png";
+ $wm['permalink'] = XOOPS_URL."/modules/smallworld/permalink.php?ownerid=".$data['uid_fk']."&updid=".$data['msg_id'];
+ $wm['commentsarray'] = $this->Comments($data['msg_id']);
+
+ if ($frU[0] == 2 || $USW['posts'] == 1) {
+ $xoopsTpl->append('walldata', $wm);
+ }
+
+ if (!empty($wm['commentsarray'])){
+ foreach($wm['commentsarray'] as $cdata) {
+ // Is commentuser a friend ?
+ $frC = $check->friendcheck($id,$cdata['uid_fk']);
+
+ $USC = array();
+ $USC['posts'] = 0;
+ $USC['comments'] = 0;
+
+ if ($xoopsUser) {
+ if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $cdata['uid_fk'] == $id) {
+ $USC['posts'] = 1;
+ $USC['comments'] = 1;
+ $frC[0] = 2;
+ } else {
+ $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true);
+ }
+ }
+
+ if (!$xoopsUser) {
+ $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true);
+ }
+
+ $wc['msg_id_fk'] = $cdata['msg_id_fk'];
+ $wc['com_id'] = $cdata['com_id'];
+ $wc['comment'] = ($USC['comments'] == 1 || $profile >= 2) ?
+ smallworld_tolink(htmlspecialchars_decode($cdata['comment']),$cdata['uid_fk']):
+ _SMALLWORLD_MESSAGE_PRIVSETCOMMENTS;
+ $wc['comment'] = Smallworld_cleanup($wc['comment']);
+ $wc['time'] = smallworld_time_stamp($cdata['created']);
+ $wc['username'] = $cdata['username'];
+ $wc['uid'] = $cdata['uid_fk'];
+ $wc['myavatar'] = $this->Gravatar($id);
+ $wc['myavatar_link'] = $myavatarlink;
+ $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['cface'] = $this->Gravatar($cdata['uid_fk']);
+ $wc['avatar_link'] = smallworld_getAvatarLink ($cdata['uid_fk'], $wc['cface']);
+ $wc['vote_up'] = $this->countVotesCom ('com', 'up', $cdata['msg_id_fk'],$cdata['com_id']);
+ $wc['vote_down'] = $this->countVotesCom ('com', 'down', $cdata['msg_id_fk'],$cdata['com_id']);
+
+ if ($frC[0] == 2 || $USC['comments'] == 1) {
+ $xoopsTpl->append('comm', $wc);
+ }
+ }
+ }
+ }
+ }
+ }
}
?>
\ No newline at end of file
Modified: XoopsModules/smallworld/trunk/smallworld/comment_ajax.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/comment_ajax.php 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/comment_ajax.php 2013-10-01 17:11:18 UTC (rev 12114)
@@ -64,9 +64,10 @@
if ($xoopsUser) {
- if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) && $data['uid_fk'] == $id) {
+ if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $data['uid_fk'] == $id) {
$USC['posts'] = 1;
$USC['comments'] = 1;
+ $frC[0] = 2;
} else {
$USC = json_decode($dBase->GetSettings($data['uid_fk']), true);
}
Modified: XoopsModules/smallworld/trunk/smallworld/css/smallworld.css
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/css/smallworld.css 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/css/smallworld.css 2013-10-01 17:11:18 UTC (rev 12114)
@@ -664,7 +664,7 @@
padding:3px;
}
-#display
+#smallworld_display
{
width:250px;
display:none;
Modified: XoopsModules/smallworld/trunk/smallworld/editprofile.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/editprofile.php 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/editprofile.php 2013-10-01 17:11:18 UTC (rev 12114)
@@ -267,7 +267,7 @@
$school = "";
foreach ($nr5 as $k => $v) {
$school .= $item->school_add ('smallworld_add3', 'school', 'school_type',
- '.smallworld_clone3', $arr7, _SMALLWORLD_ADDMORE, $selected=stripslashes($nr6[$k]),$preset=$v, $selectedstart=date("Y",$nr7[$k]),$selectedstop=date("Y",$nr8[$k]));
+ '.smallworld_clone3', $arr7, _SMALLWORLD_ADDMORE, $selected=stripslashes($nr6[$k]),$preset=$v, $selectedstart=$nr7[$k],$selectedstop=$nr8[$k]);
$school .= "<span class='smallworld_remove2' id='schoolremove'>";
$school .= "<a href='javascript:void(0);' id='schoolremovelnk'>"._SMALLWORLD_REMOVE."</a><br></span>";
}
Modified: XoopsModules/smallworld/trunk/smallworld/galleryshow.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/galleryshow.php 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/galleryshow.php 2013-10-01 17:11:18 UTC (rev 12114)
@@ -23,44 +23,52 @@
include_once(XOOPS_ROOT_PATH."/header.php");
include_once(XOOPS_ROOT_PATH."/modules/smallworld/include/functions.php");
include_once(XOOPS_ROOT_PATH."/modules/smallworld/class/class_collector.php");
-global $xoopsUser, $xoTheme;
+global $xoopsUser, $xoTheme, $xoopsLogger;
+$xoopsLogger->activated = false;
+
+ $admin = false;
- if ($xoopsUser) {
+ if ($xoopsUser) {
$id = $xoopsUser->getVar('uid');
$check = new SmallWorldUser;
$image = new SmallWorldImages;
+ $username = $_GET['username'];
+ $userID = smallworld_isset_or($_GET['username']); // Id of user wich profile you want to see
+ $userisfriend = $check->friendcheck($id,$userID);
- // Check if inspected userid -> redirect to userprofile and show admin countdown
+ if ( $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
+ $xoopsTpl->assign('isadminuser', 'YES');
+ $admin = true;
+ }
+
+ // Check if inspected userid -> redirect to userprofile and show admin countdown
$inspect = Smallworld_isInspected ($id);
if ($inspect['inspect'] == 'yes') {
- redirect_header("userprofile.php?username=".$xoopsUser->getVar('uname'), 1);
+ redirect_header("userprofile.php?username=".$xoopsUser->getVar('uname'), 1, _SMALLWORLD_INSPEC_usermsg);
}
$profile = $check->checkIfProfile($id);
- if ($profile >= 2) {
+ if ($profile >= 2 || $userisfriend[0] == 2 || $admin == true) {
$myusername = $xoopsUser->getVar('uname');
- if ( $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
- $xoopsTpl->assign('isadminuser', 'YES');
- }
+
$user = new XoopsUser($id);
- $userID = smallworld_isset_or($_GET['username']); // Id of user wich profile you want to see
- $username = $_GET['username'];
$countimages = $image->count($userID);
- $userisfriend = $check->friendcheck($id,$userID);
//$gallery = $image->viewalbum ($id, $user=$xoopsUser->getVar('uid'));
$gallery = $image->viewalbum ($id, $userID);
$xoopsTpl->assign('countimages',$countimages);
- $xoopsTpl->assign('userisfriend',$userisfriend);
+ $xoopsTpl->assign('userisfriend',$userisfriend[0]);
$xoopsTpl->assign('gallery',$gallery);
$xoopsTpl->assign('closealbum',_SMALLWORLD_ALBUMTITLETEXT);
$xoopsTpl->assign('username',$username);
$xoopsTpl->assign('myusername',$myusername);
$xoopsTpl->assign('gallerytitleheader',_SMALLWORLD_TITLEHEADER);
$xoopsTpl->assign('check',1);
- } elseif ($profile == 0) {
+ } elseif ($profile == 0) {
$check->chkUser ();
- }
+ } else {
+ redirect_header("userprofile.php?username=".$xoopsUser->getVar('uname'), 1, _NOPERM);
+ }
} else {
redirect_header(XOOPS_URL . "/user.php", 1, _NOPERM);
}
Modified: XoopsModules/smallworld/trunk/smallworld/include/functions.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/include/functions.php 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/include/functions.php 2013-10-01 17:11:18 UTC (rev 12114)
@@ -240,15 +240,19 @@
$text = str_replace('UPLIMAGE', '', $text);
$text = preg_replace('/(((f|ht){1}tp:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i',
'<span class="smallworldUplImgTxt"><br/><img class="smallworldAttImg" src="\\1"><br><br><a id="smallworldUplImgLnk" href="'
- . $gallery . '" target="_SELF">'
+ . $gallery . '" target="_self">'
. $usr->getVar('uname') . _SMALLWORLD_UPLOADEDSOMEIMAGES
. '</a><br></span>', $text
);
$text = preg_replace('/(((f|ht){1}tps:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i',
- '<a href="\\1">lala</a>', $text);
+ '<span class="smallworldUplImgTxt"><br/><img class="smallworldAttImg" src="\\1"><br><br><a id="smallworldUplImgLnk" href="'
+ . $gallery . '" target="_self">'
+ . $usr->getVar('uname') . _SMALLWORLD_UPLOADEDSOMEIMAGES
+ . '</a><br></span>', $text
+ );
$text = preg_replace('/([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i',
'\\1<span class="smallworldUplImgTxt"><br/><img class="smallworldAttImg" src="//\\2"><br><br><a id="smallworldUplImgLnk" href="'
- . $gallery . '" target="_SELF">'
+ . $gallery . '" target="_self">'
. $username . _SMALLWORLD_UPLOADEDSOMEIMAGES
. '</a><br></span>', $text
);
@@ -375,35 +379,30 @@
$gender = $row['gender'];
}
}
+
+ $image = ($image == 'blank.gif') ? '' : $image;
- $link = XOOPS_UPLOAD_URL."/".$image;
+ if (preg_match("/avatars/i", $image)) {
+ $link = XOOPS_UPLOAD_URL."/".$image;
+ } else {
+ $link = $image;
+ }
+
if (!in_array($ext,array('jpg','bmp','gif','png','jpeg')) || $image == '' || $image == "blank.gif"){
- if ($ext == '' || $gender == '1') {
+
+ if ($ext == '' && $gender == '1') {
$link = XOOPS_URL."/modules/smallworld/images/ano_woman.png";
}
-
- if ($ext == '' AND $gender == '1') {
- $link = XOOPS_URL."/modules/smallworld/images/ano_woman.png";
- }
- if ($ext == '' AND $gender == '2') {
+ if ($ext == '' && $gender == '2') {
$link = XOOPS_URL."/modules/smallworld/images/ano_man.png";
}
- if ($ext == '' AND $gender == '1') {
- $link = XOOPS_URL."/modules/smallworld/images/ano_woman.png";
- }
- if ($ext == '' AND $gender == '2') {
- $link = XOOPS_URL."/modules/smallworld/images/ano_man.png";
- }
-
+
if ($ext == '' AND $gender == '') {
$link = XOOPS_URL."/modules/smallworld/images/genderless.png";
}
-
- if ($ext == '' AND $gender == '') {
- $link = XOOPS_URL."/modules/smallworld/images/genderless.png";
- }
}
+ //echo $link."<br>";
return $link;
}
@@ -1069,6 +1068,7 @@
$script .= "if (typeof Smallworld_myID === 'undefined') {"."\n";
$script .= "var smallworld_url = '" . $xoops_url . "/modules/smallworld/" . "';\n";
$script .= "var smallworld_uploaddir = '" . $xoops_url . "/uploads/avatars/" . "';\n";
+ $script .= "var smallworld_urlReferer = document.referrer;"."\n";
$script .= "var xoops_smallworld = jQuery.noConflict();\n";
$script .= "var Smallworld_myID = " . $myid . ";\n";
$script .= "var Smallworld_userHasProfile = " . $ChkProf . ";\n";
@@ -1299,3 +1299,17 @@
}
}
+
+ /**
+ * Function to get count of messages in wall
+ * @param int $uid
+ * @return int $count
+ */
+ function smallworld_countUserWallMsges ($uid)
+ {
+ $db =& XoopsDatabaseFactory::getDatabaseConnection();
+ $sql = "SELECT message FROM ".$db->prefix('smallworld_messages')." where uid_fk='".$uid."'";
+ $result = $db->queryF($sql);
+ $count = $db->getRowsNum($result);
+ return $count;
+ }
Modified: XoopsModules/smallworld/trunk/smallworld/index.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/index.php 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/index.php 2013-10-01 17:11:18 UTC (rev 12114)
@@ -85,110 +85,10 @@
$followers = Smallworld_array_flatten($Wall->getFollowers($id),0);
$updatesarray=$Wall->Updates(0,$id, $followers);
}
- $myavatar = $Wall->Gravatar($id);
- $myavatarlink = smallworld_getAvatarLink($id, $myavatar);
- $myavatar_size = smallworld_getImageSize(80, 100, $myavatarlink);
- $myavatar_highwide = smallworld_imageResize($myavatar_size[0], $myavatar_size[1], 35);
//Get friends invitations
- $getInvitations = ($xoopsUser) ? $check->getRequests ($id) : 0;
-
- if (!empty($updatesarray)) {
- foreach ($updatesarray as $data) {
- $USW = array();
- $USW['posts'] = 0;
- $USW['comments'] = 0;
-
- if ($xoopsUser) {
- if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) && $data['uid_fk'] == $id) {
- $USW['posts'] = 1;
- $USW['comments'] = 1;
- } else {
- $USW = json_decode($dBase->GetSettings($data['uid_fk']), true);
- }
- }
-
- if (!$xoopsUser) {
- $USW = json_decode($dBase->GetSettings($data['uid_fk']), true);
- }
-
- $wm['msg_id'] = $data['msg_id'];
- $wm['orimessage'] = ($USW['posts'] == 1 || $profile >= 2) ?
- str_replace(array("\r", "\n"), '',Smallworld_stripWordsKeepUrl($data['message'])):'';
- $wm['message'] = ($USW['posts'] == 1 || $profile >= 2) ?
- smallworld_tolink(htmlspecialchars_decode($data['message']), $data['uid_fk']):_SMALLWORLD_MESSAGE_PRIVSETPOSTS;
- $wm['message'] = Smallworld_cleanup($wm['message']);
- $wm['created'] = smallworld_time_stamp($data['created']);
- $wm['username'] = $data['username'];
- $wm['uid_fk'] = $data['uid_fk'];
- $wm['priv'] = $data['priv'];
- $wm['avatar'] = $Wall->Gravatar($data['uid_fk']);
- $wm['avatar_link'] = smallworld_getAvatarLink ($data['uid_fk'], $wm['avatar']);
- $wm['avatar_size'] = smallworld_getImageSize(80, 100, $wm['avatar_link']);
- $wm['avatar_highwide'] = smallworld_imageResize($wm['avatar_size'][0], $wm['avatar_size'][1], 50);
- $wm['vote_up'] = $Wall->countVotes ('msg', 'up', $data['msg_id']);
- $wm['vote_down'] = $Wall->countVotes ('msg', 'down', $data['msg_id']);
- $wm['sharelinkurl'] = XOOPS_URL."/modules/smallworld/smallworldshare.php?ownerid=".$data['uid_fk'];
- $wm['sharelinkurl'] .= "&updid=".$data['msg_id']."";
- $wm['usernameTitle'] = $wm['username']._SMALLWORLD_UPDATEONSITEMETA.$xoopsConfig['sitename'];
- if ($USW['posts'] == 1 || $profile >= 2) {
- $wm['sharelink'] = $Wall->GetSharing ($wm['msg_id'],$wm['priv']);
- } else {
- $wm['sharelink'] = $Wall->GetSharing ($wm['msg_id'],1);
- }
-
- if ($USW['posts'] == 1 || $profile >= 2) {
- $wm['sharediv'] = $Wall->GetSharingDiv ($wm['msg_id'],$wm['priv'], $wm['sharelinkurl'],$wm['orimessage'],$wm['usernameTitle']);
- } else {
- $wm['sharediv'] = $Wall->GetSharingDiv ($wm['msg_id'],1, $wm['sharelinkurl'],$wm['orimessage'],$wm['usernameTitle']);
- }
- $wm['sharelink'] = $Wall->GetSharing ($wm['msg_id'],$wm['priv']);
- $wm['linkimage'] = XOOPS_URL."/modules/smallworld/images/link.png";
- $wm['permalink'] = XOOPS_URL."/modules/smallworld/permalink.php?ownerid=".$data['uid_fk']."&updid=".$data['msg_id'];
- $wm['commentsarray'] = $Wall->Comments($data['msg_id']);
- $xoopsTpl->append('walldata', $wm);
-
- if (!empty($wm['commentsarray'])){
- foreach($wm['commentsarray'] as $cdata) {
- $USC = array();
- $USC['posts'] = 0;
- $USC['comments'] = 0;
-
- if ($xoopsUser) {
- if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) && $cdata['uid_fk'] == $id) {
- $USC['posts'] = 1;
- $USC['comments'] = 1;
- } else {
- $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true);
- }
- }
-
- if (!$xoopsUser) {
- $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true);
- }
-
- $wc['msg_id_fk'] = $cdata['msg_id_fk'];
- $wc['com_id'] = $cdata['com_id'];
- $wc['comment'] = ($USC['comments'] == 1 || $profile >= 2) ?
- smallworld_tolink(htmlspecialchars_decode($cdata['comment']),$cdata['uid_fk']):
- _SMALLWORLD_MESSAGE_PRIVSETCOMMENTS;
- $wc['comment'] = Smallworld_cleanup($wc['comment']);
- $wc['time'] = smallworld_time_stamp($cdata['created']);
- $wc['username'] = $cdata['username'];
- $wc['uid'] = $cdata['uid_fk'];
- $wc['myavatar'] = $Wall->Gravatar($id);
- $wc['myavatar_link'] = $myavatarlink;
- $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['cface'] = $Wall->Gravatar($cdata['uid_fk']);
- $wc['avatar_link'] = smallworld_getAvatarLink ($cdata['uid_fk'], $wc['cface']);
- $wc['vote_up'] = $Wall->countVotesCom ('com', 'up', $cdata['msg_id_fk'],$cdata['com_id']);
- $wc['vote_down'] = $Wall->countVotesCom ('com', 'down', $cdata['msg_id_fk'],$cdata['com_id']);
- $xoopsTpl->append('comm', $wc);
- }
- }
- }
- }
+ $getInvitations = ($xoopsUser) ? $check->getRequests ($id) : 0;
+ $Wall->ParsePubArray ($updatesarray, $id);
if ($profile >= 2) {
$xoopsTpl->assign('menu_startpage',$menu_startpage);
@@ -200,9 +100,7 @@
$xoopsTpl->assign('myusername',$username);
$xoopsTpl->assign('pagename','index');
$xoopsTpl->assign('check',$profile);
- $xoopsTpl->assign('myavatar',$myavatar);
- $xoopsTpl->assign('myavatarlink',$myavatarlink);
- $xoopsTpl->assign('myavatar_highwide',$myavatar_highwide);
+
$xoopsTpl->assign('friendinvitations',$getInvitations);
$xoopsTpl->assign('access',$set['access']);
Modified: XoopsModules/smallworld/trunk/smallworld/js/jquery.history.js
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/js/jquery.history.js 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/js/jquery.history.js 2013-10-01 17:11:18 UTC (rev 12114)
@@ -31,8 +31,13 @@
}
// add hidden iframe for IE
- xoops_smallworld("body").prepend(''
- );
+ // add hidden iframe for IE
+ xoops_smallworld("body").prepend('<iframe id="xoops_smallworld_history" style="display: none;"'+
+ (xoops_smallworld.historyIframeSrc ? ' src="'+xoops_smallworld.historyIframeSrc+'"' : '')
+ +'></iframe>'
+ );
+ // xoops_smallworld("body").prepend(''
+ // );
var ihistory = xoops_smallworld("#xoops_smallworld_history")[0];
var iframe = ihistory.contentWindow.document;
iframe.open();
Modified: XoopsModules/smallworld/trunk/smallworld/js/smallworld.js
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/js/smallworld.js 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/js/smallworld.js 2013-10-01 17:11:18 UTC (rev 12114)
@@ -112,7 +112,10 @@
xoops_smallworld('#friendInvitations_box').hide();
xoops_smallworld('#friendInvitations_box').css('display','none');
},
- href:"#friendInvitations_box"
+ href:"#friendInvitations_box",
+ onClosed:function() {
+ location.reload(true);
+ }
});
};
xoops_smallworld('.smallworldrequestlink').on('click',function() {
@@ -186,7 +189,7 @@
},
onClosed:function() {
//location.href = window.location.pathname;
- history.go(-1);
+ location.href = smallworld_urlReferer;
},
href:"div#page"
});
@@ -202,11 +205,11 @@
}
buttons[_smallworldCancel] = function() {
xoops_smallworld( this ).dialog( "close" );
- location.href = smallworld_url+'publicindex.php';
+ location.href = smallworld_urlReferer;
}
buttons[_smallworldClose] = function() {
xoops_smallworld( this ).dialog( "close" );
- location.href = smallworld_url+'publicindex.php';
+ location.href = smallworld_urlReferer;
}
xoops_smallworld('#smallworld_notyetusercontent').dialog({
@@ -215,7 +218,7 @@
hide: "explode",
width: "550px",
close: function(event, ui) {
- location.href = smallworld_url+'publicindex.php';
+ location.href = smallworld_urlReferer;
},
buttons: buttons
});
@@ -321,7 +324,7 @@
// Autocomplete renders @username to scripted html code or Xcode
function split(val) {
- return val.split(/@/);
+ return val.split(/@\s*/);
}
function split_(val) {
@@ -343,7 +346,7 @@
if (event.keyCode === 50) {
xoops_smallworld(this).autocomplete({
disabled: false,
- minLength: 3,
+ minLength: 1,
source : function (request, response) {
xoops_smallworld.ajax({
// basePath is used for defining contecxt-path of the url.
@@ -354,7 +357,7 @@
term : extractLast(request.term)
},
success: function(data,type) {
- console.log( data);
+ //console.log( data);
items = data;
response(items);
},
@@ -365,7 +368,7 @@
},
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, '<');
@@ -391,6 +394,7 @@
});
} else {
xoops_smallworld(this).autocomplete({ disabled: true });
+ xoops_smallworld(this).autocomplete( "close" );
}
});
});
Modified: XoopsModules/smallworld/trunk/smallworld/language/english/main.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/language/english/main.php 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/language/english/main.php 2013-10-01 17:11:18 UTC (rev 12114)
@@ -380,6 +380,7 @@
/* ------------ Inspection & countdown ---------------- */
define("_SMALLWORLD_INSPEC_DESC","Admin has taken this account down for inspection.<br/><br/>Estimated inspection time will finish in");
define("_SMALLWORLD_INSPEC_DESC2","Try again at this time.");
+define("_SMALLWORLD_INSPEC_usermsg","Admin has taken this account down for inspection.<br/><br/>Access is temporarily denied!");
define("_SMALLWORLD_BDAY_TODAY","Today");
define("_SMALLWORLD_BDAY_ISIN","Birthday is in: ");
define("_SMALLWORLD_BDAY_YEARS","years");
Modified: XoopsModules/smallworld/trunk/smallworld/loadmore.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/loadmore.php 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/loadmore.php 2013-10-01 17:11:18 UTC (rev 12114)
@@ -35,7 +35,7 @@
global $xoopsUser, $xoTheme, $xoopsTpl,$xoopsLogger;
$xoopsLogger->activated = false;
/* error_reporting(E_ALL); */
-$tpl = new XoopsTpl();
+$xoopsTpl = new XoopsTpl();
$id = ($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
if ($id <= 0 || $page == 'publicindex' && $set['access'] = 1) {
$Wall = new Public_Wall_Updates();
@@ -53,150 +53,44 @@
$check = new SmallWorldUser;
$profile = ($xoopsUser) ? $check->checkIfProfile($id) : 0;
- //
- if ($id > 0) {
- if ( $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
- $pub = $check->allUsers();
- $tpl->assign('isadminuser', 'YES');
- }
- } else {
- $tpl->assign('isadminuser', 'NO');
- $pub = smallworld_checkUserPubPostPerm ();
+if ($id > 0) {
+ if ( $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
+ $pub = $check->allUsers();
+ $xoopsTpl->assign('isadminuser', 'YES');
}
- $myavatar = $Wall->Gravatar($id);
- $myavatarlink = smallworld_getAvatarLink($id, $myavatar);
- $myavatar_size = smallworld_getImageSize(80, 100, $myavatarlink);
- $myavatar_highwide = smallworld_imageResize($myavatar_size[0], $myavatar_size[1], 35);
-
-
-
- if ($id <= 0 && $set['access'] == 1 ) {
- //$pub = $check->allUsers();
- $followers = $pub;
- } elseif ($id > 0 && $set['access'] == 1 && $page == 'publicindex') {
- //$pub = $check->allUsers();
- $followers = $pub;
- }else {
- $followers = Smallworld_array_flatten($Wall->getFollowers($id),0);
- }
+} else {
+ $xoopsTpl->assign('isadminuser', 'NO');
+ $pub = smallworld_checkUserPubPostPerm ();
+}
- if ($page == 'index') {
- $updatesarray = ($id > 0) ? $Wall->Updates($_POST['last'], $id, $followers) : $Wall->Updates($_POST['last'], $followers);
- } elseif ($page == 'profile') {
- $updatesarray = ($id > 0) ? $Wall->Updates($_POST['last'], $userid, $userid) : $Wall->Updates($_POST['last'], $userid);
- } elseif ($page == 'publicindex') {
- $updatesarray = $Wall->Updates($_POST['last'], $followers);
- }
+if ($id <= 0 && $set['access'] == 1 ) {
+ //$pub = $check->allUsers();
+ $followers = $pub;
+} elseif ($id > 0 && $set['access'] == 1 && $page == 'publicindex') {
+ //$pub = $check->allUsers();
+ $followers = $pub;
+}else {
+ $followers = Smallworld_array_flatten($Wall->getFollowers($id),0);
+}
- if (!empty($updatesarray)) {
- foreach ($updatesarray as $data) {
- $USW = array();
- $USW['posts'] = 0;
- $USW['comments'] = 0;
-
- if ($xoopsUser) {
- if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) && $data['uid_fk'] == $id) {
- $USW['posts'] = 1;
- $USW['comments'] = 1;
- } else {
- $USW = json_decode($dBase->GetSettings($data['uid_fk']), true);
- }
- }
-
- if (!$xoopsUser) {
- $USW = json_decode($dBase->GetSettings($data['uid_fk']), true);
- }
+if ($page == 'index') {
+ $updatesarray = ($id > 0) ? $Wall->Updates($_POST['last'], $id, $followers) : $Wall->Updates($_POST['last'], $followers);
+} elseif ($page == 'profile') {
+ $updatesarray = ($id > 0) ? $Wall->Updates($_POST['last'], $userid, $userid) : $Wall->Updates($_POST['last'], $userid);
+} elseif ($page == 'publicindex') {
+ $updatesarray = $Wall->Updates($_POST['last'], $followers);
+}
- $wm['msg_id'] = $data['msg_id'];
- $wm['orimessage'] = ($USW['posts'] == 1 || $profile >= 2) ?
- str_replace(array("\r", "\n"), '',Smallworld_stripWordsKeepUrl($data['message'])):'';
- $wm['message'] = ($USW['posts'] == 1 || $profile >= 2) ?
- smallworld_tolink(htmlspecialchars_decode($data['message']), $data['uid_fk']):_SMALLWORLD_MESSAGE_PRIVSETPOSTS;
- $wm['message'] = Smallworld_cleanup($wm['message']);
- $wm['created'] = smallworld_time_stamp($data['created']);
- $wm['username'] = $data['username'];
- $wm['uid_fk'] = $data['uid_fk'];
- $wm['priv'] = $data['priv'];
- $wm['avatar'] = $Wall->Gravatar($data['uid_fk']);
- $wm['avatar_link'] = smallworld_getAvatarLink ($data['uid_fk'], $wm['avatar']);
- $wm['avatar_size'] = smallworld_getImageSize(80, 100, $wm['avatar_link']);
- $wm['avatar_highwide'] = smallworld_imageResize($wm['avatar_size'][0], $wm['avatar_size'][1], 50);
- $wm['vote_up'] = $Wall->countVotes ('msg', 'up', $data['msg_id']);
- $wm['vote_down'] = $Wall->countVotes ('msg', 'down', $data['msg_id']);
- $wm['sharelinkurl'] = XOOPS_URL."/modules/smallworld/smallworldshare.php?ownerid=".$data['uid_fk'];
- $wm['sharelinkurl'] .= "&updid=".$data['msg_id']."";
- $wm['usernameTitle'] = $wm['username']._SMALLWORLD_UPDATEONSITEMETA.$xoopsConfig['sitename'];
- if ($USW['posts'] == 1 || $profile >= 2) {
- $wm['sharelink'] = $Wall->GetSharing ($wm['msg_id'],$wm['priv']);
- } else {
- $wm['sharelink'] = $Wall->GetSharing ($wm['msg_id'],1);
- }
-
- if ($USW['posts'] == 1 || $profile >= 2) {
- $wm['sharediv'] = $Wall->GetSharingDiv ($wm['msg_id'],$wm['priv'], $wm['sharelinkurl'],$wm['orimessage'],$wm['usernameTitle']);
- } else {
- $wm['sharediv'] = $Wall->GetSharingDiv ($wm['msg_id'],1, $wm['sharelinkurl'],$wm['orimessage'],$wm['usernameTitle']);
- }
- $wm['sharelink'] = $Wall->GetSharing ($wm['msg_id'],$wm['priv']);
- $wm['linkimage'] = XOOPS_URL."/modules/smallworld/images/link.png";
- $wm['permalink'] = XOOPS_URL."/modules/smallworld/permalink.php?ownerid=".$data['uid_fk']."&updid=".$data['msg_id'];
- $wm['commentsarray'] = $Wall->Comments($data['msg_id']);
- $tpl->append('walldata', $wm);
-
- if (!empty($wm['commentsarray'])){
- foreach($wm['commentsarray'] as $cdata) {
- $USC = array();
- $USC['posts'] = 0;
- $USC['comments'] = 0;
-
- if ($xoopsUser) {
- if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) && $cdata['uid_fk'] == $id) {
- $USC['posts'] = 1;
- $USC['comments'] = 1;
- } else {
- $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true);
- }
- }
-
- if (!$xoopsUser) {
- $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true);
- }
-
- $wc['msg_id_fk'] = $cdata['msg_id_fk'];
- $wc['com_id'] = $cdata['com_id'];
- $wc['comment'] = ($USC['comments'] == 1 || $profile >= 2) ?
- smallworld_tolink(htmlspecialchars_decode($cdata['comment']),$cdata['uid_fk']):
- _SMALLWORLD_MESSAGE_PRIVSETCOMMENTS;
- $wc['comment'] = Smallworld_cleanup($wc['comment']);
- $wc['time'] = smallworld_time_stamp($cdata['created']);
- $wc['username'] = $cdata['username'];
- $wc['uid'] = $cdata['uid_fk'];
- $wc['myavatar'] = $Wall->Gravatar($id);
- $wc['myavatar_link'] = $myavatarlink;
- $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['cface'] = $Wall->Gravatar($cdata['uid_fk']);
- $wc['avatar_link'] = smallworld_getAvatarLink ($cdata['uid_fk'], $wc['cface']);
- $wc['vote_up'] = $Wall->countVotesCom ('com', 'up', $cdata['msg_id_fk'],$cdata['com_id']);
- $wc['vote_down'] = $Wall->countVotesCom ('com', 'down', $cdata['msg_id_fk'],$cdata['com_id']);
- $tpl->append('comm', $wc);
- }
- }
- }
- }
+$Wall->ParsePubArray ($updatesarray, $id);
-$tpl->assign('sCountResp',count($updatesarray));
+$xoopsTpl->assign('sCountResp',count($updatesarray));
+$xoopsTpl->assign('msgtoshow',$hm);
+$xoopsTpl->assign('myusername',$username);
+$xoopsTpl->assign('pagename',$page);
-$tpl->assign('msgtoshow',$hm);
-$tpl->assign('myusername',$username);
-$tpl->assign('pagename',$page);
-$tpl->assign('myavatar',$myavatar);
-$tpl->assign('myavatarlink',$myavatarlink);
-$tpl->assign('myavatar_highwide',$myavatar_highwide);
-
if ($id > 0) {
- $tpl->display(XOOPS_ROOT_PATH .'/modules/smallworld/templates/getmore.html');
+ $xoopsTpl->display(XOOPS_ROOT_PATH .'/modules/smallworld/templates/getmore.html');
} else {
- $tpl->display(XOOPS_ROOT_PATH .'/modules/smallworld/templates/getmorepublic.html');
+ $xoopsTpl->display(XOOPS_ROOT_PATH .'/modules/smallworld/templates/getmorepublic.html');
}
?>
Modified: XoopsModules/smallworld/trunk/smallworld/message_ajax.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/message_ajax.php 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/message_ajax.php 2013-10-01 17:11:18 UTC (rev 12114)
@@ -65,7 +65,7 @@
$USW['comments'] = 0;
if ($xoopsUser) {
- if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) && $data['uid_fk'] == $id) {
+ if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $data['uid_fk'] == $id) {
$USW['posts'] = 1;
$USW['comments'] = 1;
} else {
Modified: XoopsModules/smallworld/trunk/smallworld/permalink.php
===================================================================
--- XoopsModules/smallworld/trunk/smallworld/permalink.php 2013-09-30 23:16:50 UTC (rev 12113)
+++ XoopsModules/smallworld/trunk/smallworld/permalink.php 2013-10-01 17:11:18 UTC (rev 12114)
@@ -67,120 +67,19 @@
// Things to do with wall
$Wall = new Wall_Updates();
- $myavatar = $Wall->Gravatar($id);
- $myavatarlink = smallworld_getAvatarLink($id, $myavatar);
- $myavatar_size = smallworld_getImageSize(80, 100, $myavatarlink);
- $myavatar_highwide = smallworld_imageResize($myavatar_size[0], $myavatar_size[1], 35);
+
// Follow array here
$followers = Smallworld_array_flatten($Wall->getFollowers($id),0);
...
[truncated message content] |