$vbphrase['january'], 2 => $vbphrase['february'], 3 => $vbphrase['march'], 4 => $vbphrase['april'], 5 => $vbphrase['may'], 6 => $vbphrase['june'], 7 => $vbphrase['july'], 8 => $vbphrase['august'], 9 => $vbphrase['september'], 10 => $vbphrase['october'], 11 => $vbphrase['november'], 12 => $vbphrase['december'], ); $weekarr = array ('Воскресенье' ,'Понедельник'//w ,'Вторник' ,'Среда' ,'Четверг' ,'Пятница' ,'Суббота'); $nonameuser='Аноним'; $fotos_on_page = 15; $PhotoValidExtensions = array("jpg","jpeg","gif","png","bmp"); $PhotoValidExts_getimsize = array( 2 ,1 ,3 ,6);//5-psd //$maxfilesizepost = 3000; //Kb $max_small_width=150; $max_prewiew_width=600; // mode: 0-big; 1-small; 2-middle function fetch_picture_fs_path($pictureinfo, $mode = 0, $with_filename = true) { global $vbulletin; $filepath = $vbulletin->options['k_foto_filesdir']; $path = $filepath . $pictureinfo[userid]; $fname="$pictureinfo[dateline]"; if ($pictureinfo[dateline]<1271579237) { $fname="$pictureinfo[id]"; } if ($with_filename) { if ($mode==1) { $path .= "/f_".$fname."_small.$pictureinfo[extension]"; } else { $path .= "/f_".$fname.".$pictureinfo[extension]"; } } return $path; } function parsephotoinfo($fotoarr) { global $monthnames; $fotoarr['filesizestr'] = 'неизвестен'; if (!empty($fotoarr['filesize'])) { $fotoarr['filesizestr'] = "$fotoarr[width]x$fotoarr[height], ".ceil($fotoarr['filesize']/1024)." Кб"; } if (!empty($fotoarr['fotodata'])) { $m=intval(substr($fotoarr['fotodata'],0,2)); $fotoarr['fotodata']=$monthnames[$m].' '.substr($fotoarr['fotodata'],3,4); } else $fotoarr['fotodata']='неизвестна'; return $fotoarr; } function getphotoinfo($photoid,$mode=0) { global $vbulletin; if ($photoid) { $fotoarr = $vbulletin->db->query_first("SELECT foto_post.*, foto_cat.name as cname, foto_cat.catid as cid FROM foto_post LEFT JOIN foto_cat ON (foto_post.catid=foto_cat.catid) WHERE id='".intval($photoid)."'"); if ( $fotoarr and $mode==1) { $fotoarr['filesize'] = $fotoarr['s_filesize']; $fotoarr['width'] = $fotoarr['s_width']; $fotoarr['height'] = $fotoarr['s_height']; } elseif ( $fotoarr and $mode==2) { $fotoarr['filesize'] = $fotoarr['m_filesize']; $fotoarr['width'] = $fotoarr['m_width']; $fotoarr['height'] = $fotoarr['m_height']; } return parsephotoinfo($fotoarr); } else { return array(); } } function get_foto_bit($fotoarr,$tip="normal",$row=3) { global $vbulletin; global $vbphrase; $calwidth = "".intval(100/$row)."%"; if ($fotoarr) { $bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list()); $fotoarr[title] = $bbcode_parser->parse(unhtmlspecialchars($fotoarr[title]), 0, false); $fotoarr[title] = iif(strlen($fotoarr[title])>25,substr($fotoarr[title],0,25)."...",$fotoarr[title]); $changelink = ''; if ($vbulletin->userinfo[usergroupid]==6 or $vbulletin->userinfo[usergroupid]==7 or $vbulletin->userinfo[usergroupid]==5 or $vbulletin->userinfo[userid]==$fotoarr[userid]) eval('$changelink = "' . fetch_template('k_foto_edit_link') . '";'); // eval('$kommentlink = "' . fetch_template('k_foto_komm_link') . '";'); if ($tip=="thread") { eval('$foto_last = "' . fetch_template('k_foto_pict_preview_bit_thread') . '";'); } else { eval('$foto_last = "' . fetch_template('k_foto_pict_preview_bit') . '";'); } } else { eval('$foto_last = "' . fetch_template('k_foto_pict_preview_bit_empty') . '";'); } return $foto_last; } function limitforpage($page, $perpage) { if ($page<1) $page=1; return (' LIMIT '.(($page-1)*$perpage).','.$perpage); } function get_exif($fpath) { $exif_mass = array(); $exif_mass = array_pad($exif_mass,10,''); $st=1; $exif = exif_read_data($fpath, 'IFD0' ,1); if ($exif!==false) { $exif_mass[0]=intval($exif['FILE']['FileSize']);//размер фотки $exif_mass[1]=intval($exif['COMPUTED']['Width']);// $exif_mass[2]=intval($exif['COMPUTED']['Height']);// $exif_mass[3]=$exif['COMPUTED']['CCDWidth'];//фокусное расстояние (мм) ? $exif_mass[4]=$exif['COMPUTED']['ApertureFNumber'];//фокусное расстояние ? $exif_mass[5]=$exif['IFD0']['Model'];//модель фотика $exif_mass[6]=$exif['EXIF']['DateTimeOriginal'];//точная дата фотки $exif_mass[7]=$exif['EXIF']['ExposureTime'];//выдержка $exif_mass[8]=$exif['EXIF']['FNumber'];//диафрагма $exif_mass[9]=$exif['EXIF']['ISOSpeedRatings'];// iso $exif_mass[10]=$exif['IFD0']['Software'];// // $x=$exif_mass[1]; // $y=$exif_mass[2]; // $fsize=$exif_mass[0]; } return implode("|||", $exif_mass); } function update_album_counters($userid,$albumid) { global $vbulletin; if ($userid!=0) { if ($albums = $vbulletin->db->query_read("SELECT * FROM foto_album where userid='".$userid."' and visible=1")) { while ($album=$vbulletin->db->fetch_array($albums)) { update_album_counters(0,$album[id]); } } } elseif ($albumid!=0) { if ($fotoposts = $vbulletin->db->query_first("SELECT * FROM foto_post where idalbum='".$albumid."' and visible=1 order by dateline desc")) { $vbulletin->db->query_write("update foto_album set lastpost='".$fotoposts[dateline]."' where id='".$albumid."'"); } else { $vbulletin->db->query_write("update foto_album set lastpost='0' where id='".$albumid."'"); } } } function delete_foto($photoid) { global $vbulletin; $fotoinfo = getphotoinfo($photoid); @unlink(fetch_picture_fs_path($fotoinfo)); @unlink(fetch_picture_fs_path($fotoinfo, 1)); $vbulletin->db->query_write("DELETE FROM foto_post where id='".$photoid."'"); $vbulletin->db->query_write("DELETE FROM foto_comment where idpict='".$photoid."'"); // незабыть удалить тему с комментами } //----------------------------------------------------------------------- function fix_text($tx) { $tx = str_replace("\\","\\\\",$tx); $tx = str_replace("'","\\'",$tx); $tx = str_replace("
", "", $tx); $tx = str_replace("\r\n", "
", $tx); $tx = str_replace("\n\r", "", $tx); $tx = str_replace("\r", "
", $tx); $tx = str_replace("\n", "", $tx); $tx = str_replace("/SCRIPT", "\/SCRIPT", $tx); return $tx; } function fix_ajaxtext($tx) { // $tx = str_replace("'","\\'",$tx); $tx = str_replace("\"","\\\"",$tx); $tx = str_replace("\r\n", "", $tx); $tx = str_replace("\n\r", "", $tx); $tx = str_replace("\r", "", $tx); $tx = str_replace("\n", "", $tx); return $tx; } function createredirectname($username,$userid) { $redname=strtolower($username); $i=0; while (($redname{$i}>='0' && $redname{$i}<='9') || ($redname{$i}>='A' && $redname{$i}<='Z') || ($redname{$i}>='a' && $redname{$i}<='z') || $redname{$i}=='_' || $redname{$i}=='-' || $redname{$i}==' ') { if ($redname{$i}==' ') { $redname{$i}='_'; } $i++; } if ($iВызов writeuserdata - убрать!!!!"; exit; global $DB_site, $upath; $userarray=getuserinfo($userid); $jarray=getjournalinfo($userid); // записываем данные юзера // $userid $userarray[username] $jarray[title] $jarray[redirect] $jarray[active] $jarray[denyuser] $jarray[allowuser] $jarray[allowview] $jarray[commentuser] $jarray[allowcomment] $fp=@fopen($upath."$userid/user.txt","w"); @fwrite($fp, $userid."\t".$userarray[username]."\t".$jarray[title]."\t".$jarray[redirect]."\t".$jarray[active]."\t".$jarray[denyuser]."\t".$jarray[allowuser]."\t".$jarray[allowview]."\t".$jarray[commentuser]."\t".$jarray[allowcomment]."\t".$jarray[reccount]); @fclose($fp); } // ############## Send out email notification ############ function sendcomnotification ($photoid,$commentid) { global $DB_site, $enableemail, $bbtitle, $webmasteremail, $bburl, $bbuserinfo; if (!$enableemail) { return; } if (empty($photoid)) { return; } $photoid=intval($photoid); //находим $albumid $fotoarr=$DB_site->query_first("SELECT idalbum FROM foto_post WHERE foto_post.visible=1 and id='$photoid'"); if (!$fotoarr) { return; } else $albumid=$fotoarr[idalbum]; $albuminfo=$DB_site->query_first("SELECT * FROM foto_album WHERE id='".$albumid."'"); if ($albuminfo[active]!=1 ) { return; } // get last reply time if ($postid) { $dateline=$DB_site->query_first("SELECT dateline,username,attachmentid, pagetext FROM post WHERE postid='$postid'"); $lastposttime=$DB_site->query_first("SELECT dateline, pagetext FROM post WHERE threadid = '$threadid' AND dateline < $dateline[dateline] AND visible = 1 ORDER BY dateline DESC LIMIT 1"); } else { $lastposttime=$DB_site->query_first("SELECT dateline, pagetext FROM post WHERE threadid='$threadid' ORDER BY dateline DESC LIMIT 1"); } $useremails=$DB_site->query("SELECT user.* FROM (foto_subscribe,user) WHERE foto_subscribe.photoid='$photoid' AND foto_subscribe.userid=user.userid AND user.userid<>'$bbuserinfo[userid]' AND user.usergroupid<>'3'"); $threadinfo[title]=unhtmlspecialchars($threadinfo['title']); $temp = $bbuserinfo['username']; if ($postid) { $bbuserinfo['username'] = unhtmlspecialchars($dateline['username']); $lastposttime[pagetext]=unhtmlspecialchars($message); if ($dateline[attachmentid]) { $atts=$DB_site->query_first("SELECT * FROM attachment WHERE attachmentid=$dateline[attachmentid]"); $tattach="(Вложение: $atts[filename] $atts[params])"; } } else { $lastposttime[pagetext]=unhtmlspecialchars($message); if (!$bbuserinfo['userid']) { $bbuserinfo['username'] = unhtmlspecialchars($postusername); } else { $bbuserinfo['username'] = unhtmlspecialchars($bbuserinfo['username']); } } $kol=1; while ($touser=$DB_site->fetch_array($useremails)) { $touser['username']=unhtmlspecialchars($touser['username']); ++$kol; eval("\$emailmsg = \"".gettemplate("email_notify",1,0)."\";"); eval("\$emailsubject = \"".gettemplate("emailsubject_notify",1,0)."\";"); $emailmsg=nl2br($emailmsg); smtp_mail($touser[email],$emailsubject,$emailmsg, $webmasteremail, 1); } // $DB_site->query("INSERT INTO statistic (val1,val2,val3,dateline) VALUES ($kol,'".addslashes(htmlspecialchars($threadinfo[title]))."',$threadid,'".time()."')"); $bbuserinfo['username'] = $temp; } ?>