Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: usergalerie atsitiktine foto

Parašė suomis· 2009 Vas. 9 15:02:08
#1

sveiki modu saite radau toky moda usergalerie, kiekvienas narys gali turet savo asmeniny fotoalbuma.Kaip padaryt panele atsitiktine foto bet kad foto imtu is tos galerijos? ?|
Stai galerijos failas:
<?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);

   opentablee($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']."' width='390'>
</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>";
}

closetablee();

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'];
   opentablee($data['album_title'].$locale['VU08']);
   echo "<table cellpadding='0' cellspacing='0' width='100%'>
<tr>

<td width='75%' valign='top'>Albumo pavadinimas: ".($data['album_info']==""?$data['album_title']:$data['album_info'])."</td>
</tr>
<tr>

</tr>
<tr>
<td align='center' colspan='2' class='small'><br><a href='".FUSION_SELF."'>".$locale['VU26']."</a></td>
</tr>
</table>



";
   closetablee();
   tablebreak();

   opentablee($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>";
   }
   closetablee();
   
   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";
?>




Is anksto aciu ir +10 padejusiam

Parašė Poker· 2009 Vas. 9 15:02:48
#2

Ar kad bendrai imtu,ar butent keivienam nariui rodytu jo foto albumo slide show?

Parašė Enzo· 2009 Vas. 9 15:02:01
#3

Su linkais gali būt problemų, bet manau išsitaisysi

if (!defined("IN_FUSION")) { header("Location:../../index.php"); exit; }
 
 
$result = dbquery("SELECT panel_name FROM ".$db_prefix."panels WHERE panel_filename = 'latest_images_panel'");
if (dbrows($result) != 0) {
$data = dbarray($result);
$panel_name = $data['panel_name'];
}
 
$result=dbquery(
"SELECT tp.*, ta.* FROM ".$db_prefix."ug_photos tp
LEFT JOIN ".$db_prefix."ug_photo_albums ta USING(album_id)
WHERE ".groupaccess('album_access')." ORDER BY RAND() LIMIT 1"
);
if(dbrows($result)==1){
}
 
openside("ATSITIKTINES");
 
 
$data=dbarray($result);
$randphotodir = PHOTOS.(!@ini_get("safe_mode") ? "album_".$data['album_id']."/" : "");
if(!file_exists($filename)) $filename=$image_url.'/imagenotfound.jpg';
echo "<b><center>ATSITIKTINĆ‹ FOTO</b></center><br>";
echo "<center>
<a href='".BASEDIR."userphotogallery.php?photo_id=".$data['photo_id']."' class='gallery'>
<img src='".$randphotodir.$data['photo_thumb1']."' title='".$data['photo_title']."' alt='".$data['photo_title']."'>
</a><br /><a href='".BASEDIR."userphotogallery.php?photo_id=".$data['photo_id']."' class='side'>".$data['photo_title']."</a>
<br>
<a href='".BASEDIR."userphotogallery.php?album_id=".$data['album_id']."' class='side'>".$data['album_title']."
</center></a>";
 
closeside();
 



Redagavo Enzo· 2009 Vas. 9 15:02:17

Parašė bad_user· 2009 Vas. 9 15:02:52
#4

Toks bugovas šitas modas. Nu ir na.

Parašė suomis· 2009 Vas. 9 15:02:13
#5

enzo na neveikia bet dar meta klaida Unknown column 'album_access' in 'where clause' ?|