Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Usergalerie - perdarymas

Parašė Vaidotas-· 2009 Vas. 28 18:02:36
#3

<?php

require_once "../../maincore.php";
require_once BASEDIR."subheader.php";
require_once BASEDIR."side_left.php";
include "ug_setting.php";
include "locale/English.php";
include INCLUDES."ug_comments_include.php";

function checkImageExists($image_file) {
   if(file_exists($image_file)) {
      return $image_file;
   }
}

if (isset($step) && $step == "delete") {
   $result = dbquery("DELETE FROM ".$db_prefix."ug_comments WHERE comment_id='$comment_id'");
   redirect("comments.php?ctype=$ctype&cid=$cid");
}

if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0;
if (isset($photo) && !isNum($photo)) fallback(FUSION_SELF);
if (isset($userid) && !isNum($userid)) fallback(FUSION_SELF);

if(isset($photo)){
   $result=dbquery("UPDATE ".$db_prefix."ug_photos SET photo_views=(photo_views+1) WHERE photo_id='".$photo."'");
   $result=dbquery("SELECT tp.*, user_name FROM ".$db_prefix."ug_photos AS tp INNER JOIN ".$db_prefix."users USING (user_id) WHERE photo_id='".$photo."'");
   $data=dbarray($result);

   opentable($data['user_name'].$locale['VU08']." - [ ".$locale['VU19'].$data['photo_title']." ]");
   if(dbrows($result)!=1){
      echo "<center><br>".$locale['VU28']."<br><br></center>\n";
   }else{
      $img_filename = USERGALERIE.$photo.".jpg";
      $imgsize=@getimagesize($img_filename);
      $prev=@dbresult(@dbquery("SELECT t2.photo_id FROM ".$db_prefix."ug_photos t1 JOIN ".$db_prefix."ug_photos t2 WHERE t1.photo_order=t2.photo_order+1 AND t1.album_id=t2.album_id AND t1.photo_id='".$photo."'"),0);
      $next=@dbresult(@dbquery("SELECT t2.photo_id FROM ".$db_prefix."ug_photos t1 JOIN ".$db_prefix."ug_photos t2 WHERE t1.photo_order=t2.photo_order-1 AND t1.album_id=t2.album_id AND t1.photo_id='".$photo."'"),0);
      echo "<div align='center' style='margin:5px 0px;'>
<table align='center' cellpadding='0' cellspacing='1' class='tbl-border'>\n<tr>
<td class='tbl1'><span class='small'><a href='".FUSION_SELF."?".(empty($prev)?"userid=".$data['album_id']:"userid=".$data['album_id']."&photo=".$prev)."'>".$locale['VU29']."</a></span></td>
<td class='tbl2'><span class='small'><a href='".FUSION_SELF."?userid=".$data['album_id']."'>".$data['user_name']." ".$locale['VU08']."</a></span></td>
<td class='tbl1'><span class='small'><a href='".FUSION_SELF."?".(empty($next)?"userid=".$data['album_id']:"userid=".$data['album_id']."&photo=".$next)."'>".$locale['VU30']."</a></span></td>
</tr>\n</table>\n</div><br><div align='center' style='margin:5px 0px;'>
<img src='".checkImageExists($img_filename)."' border='1' title='".$data['photo_title']."' title='".$data['photo_title']."' alt='".$locale['VU05']."'>
</div><br><div align='center' style='margin:5px 0px;'>
<span class='small2'>".$locale['VU20'].$imgsize[0]." x ".$imgsize[1].$locale['VU21']."(".parseByteSize(filesize($img_filename)).")<br>
".$locale['VU22']."".$locale['VU23']."<b>".showdate("shortdate", $data['photo_date'])."</b><br>
".$locale['VU24']."<b>".$data['photo_views']."</b>".$locale['VU25']."</span>
</div>";
}

closetable();

if($settings['album_comments']=="1") showcomments("P","photos","photo_id",$photo,FUSION_SELF."?userid=".$data['album_id']."&photo=$photo");
}elseif(isset($userid)){
   $data=dbarray(dbquery(
      "SELECT ta.*, COUNT(photo_id) as photo_count, MAX(photo_date) as max_date, user_name
      FROM ".$db_prefix."ug_photo_albums AS ta
      LEFT JOIN ".$db_prefix."ug_photos USING (album_id)
      LEFT JOIN ".$db_prefix."users USING (user_id)
      WHERE ta.album_id='".$userid."' GROUP BY album_id"
   ));

if ($data['album_title'] != ""){

   $piccnt=$data['photo_count'];
   opentable($data['album_title'].$locale['VU08']);
   echo "<table cellpadding='0' cellspacing='0' width='100%'>
<tr>

<td width='75%' valign='top'>".($data['album_info']==""?$data['album_title']:$data['album_info'])."</td>
</tr>
<tr>
<td valign='bottom' class='small2'><hr>".$locale['VU09']."<b>".($data['photo_count']>0?"$data[photo_count]</b><br>".$locale['VU10']."<b>".strftime($settings['shortdate'], $data['max_date']+($settings['timeoffset']*3600))."</b>":$locale['VU12']."</b><br /><br />")."</td>
</tr>
<tr>
<td align='center' colspan='2' class='small'><br><a href='".FUSION_SELF."'>".$locale['VU26']."</a></td>
</tr>
</table>



";
   closetable();
   tablebreak();

   opentable($locale['VU13']);
   $result=dbquery(
      "SELECT tp.*, COUNT(comment_item_id) AS comment_count
      FROM ".$db_prefix."ug_photos AS tp LEFT JOIN ".$db_prefix."ug_comments
      ON photo_id = comment_item_id AND comment_type='P'
      WHERE album_id='".$userid."' GROUP BY photo_id
      ORDER BY photo_order LIMIT ".$rowstart.",".$settings['thumbs_per_page']
   );
   if(dbrows($result)>0){
      echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
      $img_cnt=0;
      while($data=dbarray($result)){
   
echo "<td class='gallery' width='".round(100/$settings['thumbs_per_row'])."%' align='center' valign='top'>
<a href='".FUSION_SELF."?userid=".$data['album_id']."&photo=$data[photo_id]' class='gallery'>
<img src='".checkImageExists(USERGALERIE.$data['photo_id']."t.jpg")."' width='".$settings['thumb_image_w']."' height='".$settings['thumb_image_h']."' title='".$data['photo_title']."' alt='".$locale['VU05']."'>
</a><br />
".$data['photo_title']."<br />
<span class='small2'>".$locale['VU14']."<b>".($data['photo_views']==0?$locale['VU12']:$data['photo_views'])."</b><br />
".($data['comment_count']==0?$locale['VU15']:"<b>".$data['comment_count']."</b> ".($data['comment_count']==1?$locale['VU16']:$locale['VU17']))."</span>";
         if(++$img_cnt%$settings['thumbs_per_row']==0) echo "</tr>\n<tr>\n";
      }

      echo "</tr>\n</table>\n";
      
   }else{
      echo "<center><br />".$locale['VU18']."<br /><br /></center>";
   }
   closetable();
   
   if ($piccnt != 0) echo "<div align='center' style='margin-top:5px;'>".makePageNav($rowstart,$settings['thumbs_per_page'],$piccnt,3,FUSION_SELF."?userid=".$userid."&amp;")."</div>\n";
}else{
opentable($locale['VU00']);
echo "<center>".$locale['VU31']."</center>";
closetable();
}}


require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
?>





Tai manau reiktų keisti šią vietą:


echo "<td class='gallery' width='".round(100/$settings['thumbs_per_row'])."%' align='center' valign='top'>
<a href='".FUSION_SELF."?userid=".$data['album_id']."&photo=$data[photo_id]' class='gallery'>
<img src='".checkImageExists(USERGALERIE.$data['photo_id']."t.jpg")."' width='".$settings['thumb_image_w']."' height='".$settings['thumb_image_h']."' title='".$data['photo_title']."' alt='".$locale['VU05']."'>
</a><br />





Bandžiau naudoti kažką tokio:

<a href='http://www.puslapis.com'><img src='http://www.puslapis.com/nuotrauka.jpg' border='0' alt=' ' width='dydisX' height='dydisY' />

Redagavo Vaidotas-· 2009 Vas. 28 18:02:54