<?php
/*
* @name mod_js_superthumb 1.0.8
* Created By Yose and Andy Sikumbang
* http://www.templatePlazza.com
* @copyright Copyright (C) 2007 TemplatePlazza.com / All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Update Version: Mods by: Erwin Schro and Ricardo Sousa
* FIX Version Nº 7 by: Ricardo Sousa - www.aiedilabs.com
* Fix version 1.0.7.1 by ronysyz
* Fix version 1.0.8 by sikumbang
*Modified by Helene HS July 7, 2008
*Changed to JomSocial by Helene HS Dec 24, 2008
*/
// Direct Acess not allowed!
defined('_JEXEC') or die('Restricted access');
// Load parameters
$count = intval( $params->get( 'count', 10) );
$modulename = intval( $params->get( 'modulename', 2) );
$width_thumbjs = intval( $params->get( 'width_thumbjs', 60) );
$height_thumbjs = intval( $params->get( 'height_thumbjs', 60) );
$viewname = intval( $params->get( 'viewname', 0) );
$viewgroup = intval( $params->get( 'viewgroup', 0) ); // RS
$showimagenot = intval( $params->get( 'showimagenot', 1) ); // RS
$shownamedetails = intval( $params->get( 'shownamedetails', 1) ); // RS
$user = mosGetParam( $_REQUEST, 'user', 1 );
$shownotavatar = intval( $params->get( 'shownotavatar', 1) ); // RS
$useid = intval( $params->get( 'iditemuse', 1) ); // RS
$id = intval( $params->get( 'iditem', 1) ); // RS
$toolbar = intval( $params->get( 'toolbar', 0) ); // Use Tooll Bar with "ADD / Delete Friend" // "Send PM" //
$imagelinked = intval( $params->get( 'imagelinked', 1) ); // Show link on the image
$usernamelinked = intval( $params->get( 'userlinked', 1) ); // Show link in the username
$sendpm = intval( $params->get( 'sendpm', 0) ); // Show PM?
$sendmail = intval( $params->get( 'sendmail', 0) ); // Send mail??
$pmssystem = $params->get( 'pmssystem', ''); // What is your's?
$adddelete = intval( $params->get( 'conects', 0) ); // Show Add or Delete as Friend
$profilelink = intval( $params->get( 'profilelink', 1) ); // Show profile link?
$grouplink = intval( $params->get( 'grouplink', 0) ); // Select if you want to view group
$border = intval( $params->get( 'border', 1) ); // Select if you want a border around the avatar
$bordercolor = $params->get( 'bordercolor', 'CCC');
$bordersize = intval( $params->get( 'bordersize', 1) );
$borderpadding = intval( $params->get( 'borderpadding', 2) );
$divaddspace = intval( $params->get( 'divaddspace', 0) );
$width = intval( $params->get( 'width', 1) ); //Width Please
$height = intval( $params->get( 'height', 1) ); // Height Please
//HS $ua = $_SERVER['HTTP_USER_AGENT']; if (strpos($ua,'MSIE 6.0')) {
//HS $st_div_width = $width_thumbjs + $divaddspace; } else {
if ($shownamedetails != 1) {
$st_div_width = $width_thumbjs + $divaddspace + 6;
$st_div_height = " height: ". $height_thumbjs + 8 ."px;";
} else {
$st_div_width = $width_thumbjs + $divaddspace + 8;
$st_div_height = "";}
// Specific ItemId
if ($useid == 1) {
$itemid = "&Itemid=$id";
} else {
$itemid = "";
}
// Name or Username?
if ($viewname == 0) {
// changed by ERW
//$s = "c.username";
$s = "u.username";
} else {
// changed by ERW
//$s = "c.name";
$s = "u.name";
}
// Avatar must be aprovved?
if ($showimagenot == 1) {
$imagenot = '';
} else {
$imagenot = '';
}
// Must Have Avatar?
if ($modulename == 12) {
if ($shownotavatar == 1) {
$avatarplease = '';
} else {
$avatarplease = 'and g.thumb != "components/com_community/assets/group_thumb.jpg"';
}
} else {
if ($shownotavatar == 1) {
$avatarplease = '';
} else {
$avatarplease = 'and c.thumb != "components/com_community/assets/default_thumb.jpg"';
}
}
// SQL LOAD's
switch ($modulename) {
case 2 :
$sql = "select u.id, u.username, u.name, c.thumb from #__users u, #__community_users c where u.id = c.userid $imagenot $avatarplease and u.block = 0 order by rand() desc limit " . $count;
break;
case 3 :
$sql = "select u.id, u.username, u.name, c.thumb from #__users u, #__community_users c, #__ponygallery p where u.id = c.userid and u.name = p.owner and p.published = 1 $imagenot $avatarplease and u.block = 0 and group by u.id order by p.imgdate desc limit " . $count;
break;
case 4 :
$sql = "select u.id, u.username, u.name, c.thumb from #__users u, #__community_users c WHERE u.id = c.userid $imagenot $avatarplease and u.block = 0 GROUP BY u.id ORDER BY u.lastvisitDate desc limit " . $count;
break;
case 5 :
$sql = "SELECT u.id, u.username, u.name, c.thumb, c.view FROM #__users u, #__community_users c where u.id = c.userid $imagenot $avatarplease and u.block = 0 group by u.id order by c.view desc limit " . $count;
break;
case 6 :
$sql = "select u.id, u.username, u.name, c.thumb, a.created from #__users u, #__community_users c, #__community_activities a where u.id = c.userid and u.id = a.actor and a.created > '0000-00-00 00:00:00' $imagenot $avatarplease and u.block = 0 group by u.id order by a.created desc limit " . $count;
break;
case 7 :
$sql = "select u.id, u.username, u.name, c.thumb from #__users u, #__community_users c, #__rsgallery2_files p where u.id = c.userid and u.id = p.userid and p.published = 1 $imagenot $avatarplease and u.block = 0 group by u.id order by p.date desc limit " . $count;
break;
case 8 :
$sql = "select u.id, u.username, u.name, c.thumb FROM #__users u, #__community_users c, #__community_connection a WHERE u.id = c.userid and c.userid = a.connect_from $imagenot $avatarplease and a.connect_to=".$my->id." AND a.status=1 group by u.id limit " . $count;
break;
case 9 :
$sql = "select u.id, u.username, u.name, c.thumb FROM #__users u, #__community_users c, #__community_connection a, #__session AS s WHERE u.id = c.userid $imagenot $avatarplease and c.userid = a.connect_from and u.username = s.username and u.block = 0 group by u.id limit " . $count;
break;
case 10 :
$sql = "SELECT u.id, u.username, u.name, c.thumb FROM #__users u, #__community_users c WHERE u.id = c.userid $imagenot $avatarplease and u.block = 0 order by u.registerDate desc limit " . $count;
break;
case 11 :
$sql = "SELECT p.id, p.albumid, p.thumbnail, p.caption FROM #__community_photos p WHERE p.published = 1 $imagenot $avatarplease order by p.created desc limit " . $count;
break;
case 12 :
$sql = "SELECT g.id, g.name, g.thumb FROM #__community_groups g WHERE g.published = 1 $imagenot $avatarplease order by g.created desc limit " . $count;
break;
default :
$sql = "select u.id, u.username, u.name, c.thumb from #__users u, #__community_users c, #__community_wall w where u.id = c.userid and u.id = w.contentid $imagenot $avatarplease and w.published = 1 and u.block = 0 group by u.id order by w.date desc limit " . $count;
}
$database->setQuery($sql);
//print($database->getQuery());
$data = $database->loadObjectList();
if (count($data) > 0) {
// Move this CSS link into your index.php header to make this module valid XHTML
//HS echo '<link href="'.$mosConfig_live_site.'/modules/js_superthumb/style.css" rel="stylesheet" type="text/css" />';
//HS echo '<!-- CB SuperThumb from http://www.templatePlazza.com -->';
?>
<div class="superthumb_wrapper">
<?php
//HS Photos
if ($modulename == 11) {
$k = count($data);
$i = 0;
while ($i < $k) {
$dat = $data[$i];
$userid = $dat->userid;
$usernames = $dat->caption;
if ($dat->thumbnail != NULL) {
if (ereg("^gallery", $dat->thumbnail) == false) {
$dat->thumbnail = $dat->thumbnail;
}
if ($border == 1) {
$borderinput = "style=\"padding: ".$borderpadding."px; border: solid ".$bordersize."px #".$bordercolor.";\""; }
else {
$borderinput = "border=\"0\"";
}
$img = "<img width=\"".$width_thumbjs."\" height=\"".$height_thumbjs."\" src=\"" .$dat->thumbnail ."\" alt=\" ".$dat->caption ." \" title=\" ". $dat->caption ." \" ".$borderinput."/>";
}
// require_once( JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'controllers' . DS . 'photos.php' );
$link_js = sefRelToAbs("index.php?option=com_community&view=photos&task=photo&albumid=$dat->albumid&userid=$dat->userid#photoid=$dat->id");
if ($viewname == 0) {
$name = $dat->caption;
} else {
$name = $dat->caption;
}
?>
<div class="superthumb_inner" style="float:left; width:<?php echo $st_div_width; ?>px;<?php echo $st_div_height; ?>">
<?php if ($imagelinked == 1) {?> <div><a href="<?php echo $link_js;?>"><?php } ?><?php echo $img;?><?php if ($imagelinked == 1) { ?></a></div><?php } ?>
<?php if ($shownamedetails == 1) { ?><a class="superthumb_uname"<?php if ($usernamelinked == 1) { ?> href="<?php echo $link_js;?> <?php }?>"><?php echo $name; ?><?php } else if ($shownamedetails == 0) {''; }?><?php if ($usernamelinked == 1) { ?></a> <?php } ?>
</div>
<?php
$i++;
}
?>
</div><div style="clear:both"></div>
<?php
}
//HS Groups
else if ($modulename == 12) {
$k = count($data);
$i = 0;
while ($i < $k) {
$dat = $data[$i];
$userid = $dat->id;
$usernames = $dat->name;
if ($dat->thumb != NULL) {
if (ereg("^gallery", $dat->thumb) == false) {
$dat->thumb = $dat->thumb;
}
if ($border == 1) {
$borderinput = "style=\"padding: ".$borderpadding."px; border: solid ".$bordersize."px #".$bordercolor.";\""; }
else {
$borderinput = "border=\"0\"";
}
$img = "<img width=\"".$width_thumbjs."\" height=\"".$height_thumbjs."\" src=\"" .$dat->thumb ."\" alt=\" ".$dat->name ." \" title=\" ". $dat->name ." \" ".$borderinput."/>";
}
$link_js = sefRelToAbs("index.php?option=com_community&view=groups&groupid=$dat->id&task=viewgroup");
if ($viewname == 0) {
$name = $dat->name;
} else {
$name = $dat->name;
}
?>
<div class="superthumb_inner" style="float:left; width:<?php echo $st_div_width; ?>px;<?php echo $st_div_height; ?>">
<?php if ($imagelinked == 1) {?> <div><a href="<?php echo $link_js;?>"><?php } ?><?php echo $img;?><?php if ($imagelinked == 1) { ?></a></div><?php } ?>
<?php if ($shownamedetails == 1) { ?><a class="superthumb_uname"<?php if ($usernamelinked == 1) { ?> href="<?php echo $link_js;?> <?php }?>"><?php echo $name; ?><?php } else if ($shownamedetails == 0) {''; }?><?php if ($usernamelinked == 1) { ?></a> <?php } ?>
</div>
<?php
$i++;
}
?>
</div><div style="clear:both"></div>
<?php
} else {
//HS User Avatar
$k = count($data);
$i = 0;
while ($i < $k) {
$dat = $data[$i];
$userid = $dat->id;
$usernames = $dat->username;
if ($dat->thumb != NULL) {
if (ereg("^gallery", $dat->thumb) == false) {
$dat->thumb = $dat->thumb;
}
if ($border == 1) {
$borderinput = "style=\"padding: ".$borderpadding."px; border: solid ".$bordersize."px #".$bordercolor.";\""; }
else {
$borderinput = "border=\"0\"";
}
$img = "<img width=\"".$width_thumbjs."\" height=\"".$height_thumbjs."\" src=\"" .$dat->thumb ."\" alt=\" ". $dat->username." \" title=\" ". $dat->username ." \" ".$borderinput."/>";
}
$link_js = sefRelToAbs("index.php?option=com_community&view=profile&userid=$dat->id");
$link_mail = sefRelToAbs("index.php?option=com_comprofiler&task=emailUser&uid=$dat->id");
if ($viewname == 0) {
$name = $dat->username;
} else {
$name = $dat->name;
}
?>
<div class="superthumb_inner" style="float:left; width:<?php echo $st_div_width; ?>px;<?php echo $st_div_height; ?>">
<?php if ($imagelinked == 1) {?> <div><a href="<?php echo $link_js;?>"><?php } ?><?php echo $img;?><?php if ($imagelinked == 1) { ?></a></div><?php } ?>
<?php if ($shownamedetails == 1) { ?><a class="superthumb_uname"<?php if ($usernamelinked == 1) { ?> href="<?php echo $link_js;?> <?php }?>"><?php echo $name; ?><?php } else if ($shownamedetails == 0) {''; }?><?php if ($usernamelinked == 1) { ?></a> <?php } ?>
</div>
<?php
$i++;
}
?>
</div><div style="clear:both"></div>
<?php
}
}
?>
На всякий случай код самого модуля mod_js_superthumb 1.4 (правда ссылку уже покрутил)