17-04-26, 10:17 AM
السلام عليكم
تحية طيبة
ارجوا من الاخوه الاكارم عموما ومن الاخ Amir_Alzubidy خصوصا مساعدتي في اظافة ختم الصور لملف الرفع هذا
قمت بااظافة دالة ختم الصور لاكن لم يعمل الختم
وهذا الملف مع دالة ختم الصور
تحية طيبة
ارجوا من الاخوه الاكارم عموما ومن الاخ Amir_Alzubidy خصوصا مساعدتي في اظافة ختم الصور لملف الرفع هذا
قمت بااظافة دالة ختم الصور لاكن لم يعمل الختم
وهذا الملف مع دالة ختم الصور
PHP كود :
<?php
function watermark($ss, $sss, $logo){
if (preg_match("/jpg|jpeg/",$sss)){$src_img=imagecreatefromjpeg($ss);}
if (preg_match("/webp/",$sss)){$src_img=imagecreatefromwebp($ss);}
if (preg_match("/png/",$sss)){$src_img=imagecreatefrompng($ss);}
if (preg_match("/gif/",$sss)){$src_img=imagecreatefromgif($ss);}
// if (preg_match("/svg/",$ext[id])){$src_img=imagecreatefromsvg($ss);}
$src_logo = imagecreatefrompng($logo);
$bwidth = imageSX($src_img);
$bheight = imageSY($src_img);
$lwidth = imageSX($src_logo);
$lheight = imageSY($src_logo);
//fix bug for 1beta3
if ( $bwidth > 160 && $bheight > 130 ) {
$src_x = $bwidth - ($lwidth + 5);
$src_y = $bheight - ($lheight + 5);
ImageAlphaBlending($src_img, true);
ImageCopy($src_img,$src_logo,$src_x,$src_y,0,0,$lwidth,$lheight);
if (preg_match("/jpg|jpeg/",$sss)){imagejpeg($src_img, $ss);}
if (preg_match("/png/",$sss)){imagepng($src_img, $ss);}
if (preg_match("/webp/",$sss)){imagewebp($src_img, $ss);}
if (preg_match("/gif/",$sss)){imagegif($src_img, $ss);}
// if (preg_match("/svg/",$ext[id])){imagesvg($src_img, $ss);}
}# < 150
else
{
return false;
}
}
/*======================================================================*\
|| #################################################################### ||
|| # ���� ��� ������� uploade v 3.4 # ||
|| # for vBulletin Version 3.5.x AND 3.6.x # ||
|| # http://7beebi.com ���� ����� # ||
|| # webmaster@7beebi.com # ||
|| #################################################################### ||
\*======================================================================*/
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
@set_time_limit(0);
define('THIS_SCRIPT', 'uploader');
define('NOPMPOPUP', 1);
// ################### PRE-CACHE TEMPLATES AND DATA ######################
if (empty($_REQUEST['do']) OR ($_REQUEST['do'] == 'doupload'))
{
$_REQUEST['do'] = 'main';
}
$phrasegroups = array('uploader');
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array(
'uploader_header',
'uploader_footer',
'uploader_msg',
'uploader_editor_msg'
);
// pre-cache templates used by specific actions
$actiontemplates = array(
'main' => array(
'uploader',
'uploader_files',
'uploader_filebit',
'uploader_bit',
'uploader_rules'
),
'doupload' => array(
'uploader_msgbit',
'uploader_upload',
),
'editor' => array(
'uploader_editor'
),
);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once(DIR . '/uploaderglobal.php');
require_once(DIR . '/includes/adminfunctions.php'); // required for can_administer
if(!$vbulletin->options['uploader_ftp_password'])
{
$vbulletin->options['uploader_ftp_password'] = $vbulletin->config['uploader']['password'];
$vbulletin->config['uploader']['password'] = '';
}
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
if ($_REQUEST['do'] == 'main')
{
$vbulletin->input->clean_array_gpc('r', array(
'page' => TYPE_INT,
'order' => TYPE_STR,
'ascdesc' => TYPE_STR,
'thumbs' => TYPE_BOOL,
'perpage' => TYPE_INT
));
switch ($vbulletin->GPC['order'])
{
case 'name':
$order = 'file_name';
break;
case 'size':
$order = 'file_size';
break;
default:
$order = 'dateline';
}
switch ($vbulletin->GPC['ascdesc'])
{
case 'asc':
$ascdesc = 'ASC';
break;
default:
$ascdesc = 'DESC';
}
$page = $vbulletin->GPC['page'];
$thumbs = $vbulletin->GPC['thumbs'];
if($vbulletin->GPC['perpage'])
{
$perpage = $vbulletin->GPC['perpage'];
}
else
{
$perpage = $vbulletin->options['upsperpage'];
}
if($perpage > $vbulletin->options['upsmaxperpage'])
{
$perpage = $vbulletin->options['upsmaxperpage'];
}
$files = $filesdb = '';
if($vbulletin->userinfo['userid'])
{
$countups = $db->query_first("
SELECT COUNT(*) AS ups
FROM " . TABLE_PREFIX . "uploader AS uploader
WHERE userid = " . $vbulletin->userinfo['userid'] . "
");
}
if($countups['ups'])
{
if ($page < 1)
{
$page = 1;
}
else if ($page > ceil(($countups['ups'] + 1) / $perpage))
{
$page = ceil(($countups['ups'] + 1) / $perpage);
}
$limitlower = ($page - 1) * $perpage;
$userfiles = $db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "uploader
WHERE userid = " . $vbulletin->userinfo['userid'] . "
ORDER BY $order $ascdesc
LIMIT $limitlower, $perpage
");
while ($userfile = $db->fetch_array($userfiles))
{
$bgclass = exec_switch_bg(1);
/*
if($filesdb)
{
$filesdb = $userfile['file_name'];
}
else
{
$filesdb .= ', ' . $userfile['file_name'];
}
*/
$ext = substr(strrchr($userfile['fileurl'], '.'), 1, 3);
switch ($ext)
{
case 'gif':
case 'jpg':
case 'jpeg':
case 'jpe':
case 'png':
case 'bmp':
$extimg = 'images/uploadericon/img.gif';
$handelext = true;
break;
case 'rm':
case 'ra':
case 'ram':
case '3gp':
case 'rmvb':
$extimg = 'images/uploadericon/real.gif';
$handelext = true;
break;
case 'mp3':
case 'mpg':
case 'mpeg':
case 'wave':
case 'mid':
case 'avi':
case 'wmv':
case 'asf':
case 'dat':
$extimg = 'images/uploadericon/media.gif';
$handelext = true;
break;
case 'zip':
case 'gz':
case 'tar':
$extimg = 'images/uploadericon/zip.gif';
$handelext = true;
break;
default:
$extname = '';
$handelext = false;
}
if(@file_exists(DIR . '/images/uploadericon/' . $ext . '.gif') AND !$handelext)
{
$extimg = 'images/uploadericon/' . $ext . '.gif';
}
elseif(!$handelext)
{
$extimg = 'images/uploadericon/unknow.gif';
}
if($vbulletin->GPC['thumbs'])
{
switch ($ext)
{
case 'gif':
case 'jpg':
case 'jpeg':
case 'jpe':
case 'png':
case 'bmp':
$filename = '<a href="' . $userfile['fileurl'] . '" target="_blank" title="' . $userfile['description'] . '"><img src="' . $userfile['fileurl'] . '" width="160" height="160" border="0" alt="" /></a>';
break;
case 'swf':
$filename = '<embed src="' . $userfile['fileurl'] . '" width="160" height="160" quality="high" loop="false" menu="false" TYPE="application/x-shockwave-flash" wmode="transparent" AllowScriptAccess="never" nojava="true" />';
break;
case 'rm':
case 'ra':
case 'ram':
case '3gp':
case 'rmvb':
$filename = '<embed SRC="' . $userfile['fileurl'] . '" type="audio/x-pn-realaudio-plugin" CONSOLE="' . $userfile['id'] . '" CONTROLS="ImageWindow,ControlPanel,StatusBar" width="160" height="160" AUTOSTART="false" AllowScriptAccess="never" nojava="true" />';
break;
case 'mp3':
case 'mpg':
case 'mpeg':
case 'wave':
case 'mid':
case 'avi':
case 'wmv':
case 'asf':
case 'dat':
$filename = '<object width="160" height="160" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="PTMediaPlayer">
<param name="URL" value="' . $userfile['fileurl'] . '" />
<param name="rate" value="1" />
<param name="currentPosition" value="0" />
<param name="playCount" value="1" />
<param name="autoStart" value="0" />
<param name="uiMode" value="mini" />
<param name="stretchToFit" value="-1" />
<param name="enableContextMenu" value="-1" />
</object>';
break;
default:
$userfile['file_name'] = iif(strlen($userfile['file_name']) > 30 ,substr($userfile['file_name'], 0, 30) . "...", $userfile['file_name']);
$filename = '<a href="' . $userfile['fileurl'] . '" target="_blank" title="' . $userfile['description'] . '">' . $userfile['file_name'] . '</a>';
}
}
else
{
$userfile['file_name'] = iif(strlen($userfile['file_name']) > 50 ,substr($userfile['file_name'], 0, 30) . "...", $userfile['file_name']);
$filename = '<a href="' . $userfile['fileurl'] . '" target="_blank" title="' . $userfile['description'] . '">' . $userfile['file_name'] . '</a>';
}
$userfile['dateline'] = vbdate($vbulletin->options['dateformat'], $userfile['dateline'], 1);
$userfile['file_size'] = vb_number_format($userfile['file_size'], 1, true);
eval('$files .= "' . fetch_template('uploader_filebit') . '";');
}
$db->free_result($userfiles);
if ($files)
{
$next = construct_page_nav($page, $perpage, $countups['ups'], $uploaderfile . '?', '&perpage=' . $perpage);
eval('$myfiles = "' . fetch_template('uploader_files') . '";');
}
}
eval('print_output("' . fetch_template('uploader') . '");');
}
elseif ($_REQUEST['do'] == 'editor')
{
eval('print_output("' . fetch_template('uploader_editor') . '");');
}
elseif ($_POST['do'] == 'doupload')
{
if(!$vbulletin->userinfo['userid'])
{
print_no_permission();
}
$vbulletin->input->clean_gpc('f', 'file', TYPE_ARRAY_FILE);
$vbulletin->input->clean_gpc('p', 'description', TYPE_ARRAY_STR);
$erorrs = $ext = $continueuploading = $filedescription = $fileurl = $filerealname = array();
$countfile = $extphp = $cheknude = $phphtmcgihtaccess = $hacked = 0;
if($vbulletin->options['uploader_nude'] AND (in_array($vbulletin->userinfo['usergroupid'], $nude_groups)) AND (@file_exists(DIR . '/includes/class_image_filter.php')))
{
require_once(DIR . '/includes/class_image_filter.php');
$filter = new ImageFilter;
$cheknude = 1;
}
if($description)
{
foreach($vbulletin->GPC['description'] AS $id => $GPCdescription)
{
if($GPCdescription)
{
$filedescription[$id] = $GPCdescription;
}
}
}
foreach($vbulletin->GPC['file']['name'] AS $id => $GPCfilename)
{
$countfile++;
if(!$GPCfilename)
{
$continueuploading[$id] = 0;
continue;
}
$uploadfilename[$id] = strtolower(htmlspecialchars_uni($GPCfilename));
$erorrs[$id] = 1;
$continueuploading[$id] = 1;
if (($countfile > 10) OR ($countfile > $vbulletin->options['uploader_many']))
{
$continueuploading[$id] = 0;
continue;
}
if(preg_match('/(.php)|(.htm)|(.pl)|(.cgi)|(.htaccess)/i', $uploadfilename[$id], $extcode))
{
$uploadfilenamen[$id] = str_replace($extcode[0], '', $uploadfilename[$id]);
$phphtmcgihtaccess = 1;
}
if($phphtmcgihtaccess AND $vbulletin->userinfo['userid'] AND !can_administer() AND $vbulletin->options['banduploader'] AND !in_array($vbulletin->userinfo['userid'], preg_split('#\s*,\s*#s', $vbulletin->config['SpecialUsers']['undeletableusers'], -1, PREG_SPLIT_NO_EMPTY)))
{
$hacked = 1;
break;
}
elseif($uploadfilenamen[$id] != '')
{
$uploadfilename[$id] = $uploadfilenamen[$id];
}
$ext[$id] = substr(strrchr($uploadfilename[$id], '.'), 1);
$filerealname[$id] = htmlspecialchars_uni($GPCfilename);
if($ext[$id] == 'txt')
{
$uploadfilename[$id] = strrev(substr(strrchr(strrev($uploadfilename[$id]), '.'), 1)) . ".doc";
$filerealname[$id] = strrev(substr(strrchr(strrev($filerealname[$id]), '.'), 1)) . ".doc";
$ext[$id] ='doc';
}
if($vbulletin->options['digifilename'] AND !$uploaderx['digifilename'])
{
$uploadfilename[$id] = $id . TIMENOW . '.' . $ext[$id];
}
else
{
//$uploadfilename[$id] = preg_replace("/[^a-zA-Z0-9\-_\.]+/", "_", $uploadfilename[$id]);
$uploadfilename[$id] = str_replace(' ', '', $uploadfilename[$id]);
}
if (!$vbulletin->options['sfolder'])
{
$uploadfilename[$id] = $vbulletin->userinfo['userid'] . '_' . $uploadfilename[$id];
}
if($filedescription[$id])
{
$filedescription[$id] = htmlspecialchars_uni($filedescription[$id]);
}
}
foreach($filerealname AS $id => $GPCfilename1)
{
if (!$continueuploading[$id])
{
continue;
}
foreach($filerealname AS $id2 => $GPCfilename2)
{
if (!$continueuploading[$id2])
{
continue;
}
if(($GPCfilename1 == $GPCfilename2) AND $id2 != $id)
{
$continueuploading[$id] = 0;
$msg[$id] = '����';
}
}
}
if($hacked)
{
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET usergroupid = " . $vbulletin->options['banduploader'] . " WHERE userid = " . $vbulletin->userinfo['userid'] . "");
$db->query_write("
INSERT INTO " . TABLE_PREFIX . "userban
(userid, usergroupid, displaygroupid, customtitle, usertitle, adminid, bandate, liftdate, reason)
VALUES
(" . $vbulletin->userinfo['userid'] . ", " . $vbulletin->userinfo['usergroupid'] . ", 0, 0, '" . $db->escape_string($vbulletin->userinfo['usertitle']) . "', " . $vbulletin->userinfo['userid'] . ", " . TIMENOW . ", 0, '" . $db->escape_string('������ ������ �����') . "')
");
foreach($vbulletin->GPC['file']['tmp_name'] AS $filetmpname)
{
@unlink($filetmpname);
}
print_no_permission();
}
foreach($vbulletin->GPC['file']['tmp_name'] AS $id => $tmpname)
{
if (!$continueuploading[$id])
{
continue;
}
if ($vbulletin->options['uploader_php_enable'] AND !in_array($ext[$id], $typesphp) AND is_uploaded_file($tmpname))
{
$content = file_read($tmpname);
if (preg_match('/(<\\?(php|^(xml)))|(<\\?[\\s]*(-xml))|(<\\?\\s)/i', $content))
{
$ext[$id] = 'php';
}
unset($content, $content2);
}
$ss=$uploadfilename[$id];
$sss=$ext[id];
$dirpathh="uploaded";
if (!is_uploaded_file($tmpname))
{
$msg[$id] = $vbphrase['no_file'];
$continueuploading[$id] = 0;
}
elseif ((!in_array($ext[$id], $types) OR $extphp) AND !$uploaderx['types_files'])
{
$msg[$id] = construct_phrase($vbphrase['no_ext_x'], $ext[$id]);
$continueuploading[$id] = 0;
}
elseif (in_array($ext[$id], array('gif', 'jpg', 'jpeg', 'jpe', 'png', 'bmp')))
{
if($cheknude)
{
if($filter->GetScore($tmpname) >= 30)
{
$msg[$id] = '���� ��� ����� �������';
$continueuploading[$id] = 0;
}
}
}
}
foreach($vbulletin->GPC['file']['size'] AS $id => $tmpsize)
{
if (!$continueuploading[$id])
{
continue;
}
$filesizes[$id] = $tmpsize;
if ($tmpsize == 0)
{
$msg[$id] = $vbphrase['size_none'];
$continueuploading[$id] = 0;
}
elseif ($fileisin = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "uploader WHERE userid = " . $vbulletin->userinfo['userid'] . " AND file_size = " . $tmpsize . " AND file_name LIKE '%" . $db->escape_string($ext[$id]) . "%'"))
{
$msg[$id] = $vbphrase['file_exists'] . "<br /><a dir='ltr' href='" . $fileisin['fileurl'] . "' target='_blank'>" . $fileisin['fileurl'] . "</a>";
$fileurl[$id] = $fileisin['fileurl'];
$fileid[$id] = $fileisin['id'];
$erorrs[$id] = 0;
$continueuploading[$id] = 0;
}
elseif ($tmpsize > $size AND !$uploaderx['file_size'])
{
$msg[$id] = construct_phrase($vbphrase['no_size_x'], $sizetmp, vb_number_format($tmpsize, 1 , true));
$continueuploading[$id] = 0;
}
elseif ($sizecont + $tmpsize > $folder_size AND !$uploaderx['folder_size'] AND $uploaderperm['uploadermaxfoldesize'])
{
$msg[$id] = $vbphrase['reach_size'];
$continueuploading[$id] = 0;
}
}
foreach($vbulletin->GPC['file']['tmp_name'] AS $id => $filetmpname)
{
if (!$continueuploading[$id])
{
continue;
}
if ($vbulletin->options['sfolder'] AND ($vbulletin->options['uploaderexternal'] OR !@is_dir($dirpath)))
{
if ($vbulletin->options['uploader_ftp'])
{
// set up basic connection
$conn_id = @ftp_connect($vbulletin->options['uploader_ftp_url']);
// login with username and password
@ftp_login($conn_id, $vbulletin->options['uploader_ftp_user'], $vbulletin->options['uploader_ftp_password']);
$ismkdir = 0;
if(!@ftp_nlist($conn_id, $vbulletin->userinfo['userid']) AND !$vbulletin->userinfo['userid'])
{
// try to create the directory $dirpath
@ftp_mkdir($conn_id, $vbulletin->userinfo['userid']);
$ismkdir = 1;
}
if(!$vbulletin->options['uploaderexternal'])
{
@ftp_site($conn_id, 'CHMOD 0777 ' . $vbulletin->userinfo['userid']);
// I have't finde any awy to make index.html in an external server
$filehandle = @fopen($dirpath . '/index.html', 'wb');
@fwrite($filehandle, "\n\n");
@fclose($filehandle);
}
elseif($ismkdir)
{
$file = 'index.html';
$fp = @fopen(DIR . '/includes/index.html', 'rb');
@ftp_fput($conn_id, $ftppath . $file, $fp, FTP_BINARY);
@fclose($fp);
}
// close the FTP stream
@ftp_close($conn_id);
}
elseif(!$vbulletin->userinfo['userid'])
{
@mkdir($dirpath, 0777);
$filehandle = @fopen($dirpath . '/index.html', 'wb');
@fwrite($filehandle, "\n\n");
@fclose($filehandle);
}
}
if ($vbulletin->options['uploaderexternal'])
{
$conn_id = @ftp_connect($vbulletin->options['uploader_ftp_url']);
@ftp_login($conn_id, $vbulletin->options['uploader_ftp_user'], $vbulletin->options['uploader_ftp_password']);
if (!@ftp_put($conn_id, $ftppath . $uploadfilename[$id], $filetmpname, FTP_BINARY))
{
$msg[$id] = $vbphrase['bad_uploader'] . '<br /><a href="sendmessage.php?do=contactus&message=' . construct_phrase($vbphrase['contact_us_upload'], $vbulletin->options['bbtitle'], $uploadfilename[$id], vb_number_format($filesizes[$id], 1 , true), $vbulletin->userinfo['username']) . '">' . $vbphrase['contact_us'] . '</a>';
}
else
{
$db->query_write("INSERT INTO " . TABLE_PREFIX . "uploader
(userid, file_name, file_size, fileurl, dateline, description)
VALUES ('" . $vbulletin->userinfo['userid'] . "','" . $db->escape_string($filerealname[$id]) . "'," . $filesizes[$id] . ",'" . $vbulletin->options['uploaderexternalurl'] . "/" . $ftppath . $db->escape_string($uploadfilename[$id]) . "'," . TIMENOW . ", '" . $db->escape_string($filedescription[$id]) . "')");
//@ftp_chmod($conn_id, 0755, $ftppath . $vbulletin->GPC['file']['name']); not workin cuse the FTP server
$msg[$id] = '' . $vbphrase['done_upload']. '<br /><a dir="ltr" href=' . $vbulletin->options['uploaderexternalurl'] . "/" . $ftppath . $uploadfilename[$id] . ' target="_blank">' . $vbulletin->options['uploaderexternalurl'] . '/' . $ftppath . $uploadfilename[$id] . '</a><br />' . $vbphrase['no_ext'] . ' ' . $ext[$id] . '';
$fileurl[$id] = $vbulletin->options['uploaderexternalurl'] . '/' . $ftppath . $uploadfilename[$id];
$erorrs[$id] = 0;
$fileid[$id] = $db->insert_id();
}
@ftp_close($conn_id);
}
else
{ @watermark($dirpathh."/".$ss,$sss,'logo/logo.png');
if (!@move_uploaded_file($ftppath . $filetmpname, '' . $dirpath . '/' . $uploadfilename[$id] . ''))
{
$msg[$id] = $vbphrase['bad_uploader'] . '<br /><a href="sendmessage.php?do=contactus&message=' . construct_phrase($vbphrase['contact_us_upload'], $vbulletin->options['bbtitle'], $uploadfilename[$id], vb_number_format($filesizes[$id], 1 , true), $vbulletin->userinfo['username']) . '">' . $vbphrase['contact_us'] . '</a>';
}
else
{
$db->query_write("INSERT INTO " . TABLE_PREFIX . "uploader
(userid, file_name, file_size, fileurl, dateline, description)
VALUES ('" . $vbulletin->userinfo['userid'] . "','" . $db->escape_string($filerealname[$id]) . "'," . $filesizes[$id] . ",'" . $vbulletin->options['bburl'] . "/" . $path . $db->escape_string($uploadfilename[$id]) . "','" . TIMENOW . "', '" . $db->escape_string($filedescription[$id]) . "')");
@chmod('' . $dirpath . '/' . $vbulletin->GPC['file']['name'] . '', 0755);
$msg[$id] = '' . $vbphrase['done_upload']. '<br /><a dir="ltr" href=' . $path . $uploadfilename[$id] . ' target="_blank">' . $vbulletin->options['bburl'] . '/' . $path . $uploadfilename[$id] . '</a><br />' . $vbphrase['no_ext'] . ' ' . $ext[$id] . '';
$fileurl[$id] = $vbulletin->options['bburl'] . '/' . $path . $uploadfilename[$id];
$erorrs[$id] = 0;
$fileid[$id] = $db->insert_id();
}
}
@unlink($filetmpname);
}
for($id = 0; $id <= $countfile; $id++)
{
if (!$uploadfilename[$id])
{
continue;
}
if(!$erorrs[$id])
{
$msgview[$id] = '';
$msgcode[$id] = '';
if($vbulletin->options['uploaderreadytag'])
{
switch ($ext[$id])
{
case 'gif':
case 'jpg':
case 'jpeg':
case 'jpe':
case 'png':
case 'bmp':
if (@getimagesize($fileurl[$id]) OR !$vbulletin->options['uploadergdcheck'])
{
$msgview[$id] = '<img src="' . $fileurl[$id] . '" border="0" alt="" />';
$msgcodef = '[IMG]' . $fileurl[$id] . '[/IMG]';
if(!$vbulletin->userinfo['userid'])
{
$msgcode[$id] = $msgcodef;
}
else
{
$msgcode[$id] = '[URL="' . $vbulletin->options['bburl'] . '"]' . $msgcodef . '[/URL]';
}
}
else
{
if ($vbulletin->options['uploaderexternal'])
{
$conn_id = @ftp_connect($vbulletin->options['uploader_ftp_url']);
@ftp_login($conn_id, $vbulletin->options['uploader_ftp_user'], $vbulletin->options['uploader_ftp_password']);
if(@ftp_delete($conn_id, $ftppath . $uploadfilename[$id]))
$db->query_write("DELETE FROM " . TABLE_PREFIX . "uploader WHERE userid = " . $vbulletin->userinfo['userid'] . " AND fileurl = '" . $db->escape_string($fileurl[$id]) . "'");
@ftp_close($conn_id);
}
else
{
if (@unlink('' . $dirpath . '/' . $uploadfilename[$id] . ''));
$db->query_write("DELETE FROM " . TABLE_PREFIX . "uploader WHERE userid = " . $vbulletin->userinfo['userid'] . " AND fileurl = '" . $db->escape_string($fileurl[$id]) . "'");
}
$msg[$id] = $vbphrase['uploader_check_img_failed'];
$erorrs[$id] = 1;
}
break;
case 'swf':
if (($swfinfo = @getimagesize($fileurl[$id])) OR !$vbulletin->options['uploadergdcheck'])
{
$msgview[$id] = '<embed src="' . $fileurl[$id] . '" ' . $swfinfo[3] . ' quality="high" loop="false" menu="false" TYPE="application/x-shockwave-flash" wmode="transparent" AllowScriptAccess="never" nojava="true" />';
$msgcode[$id] = '[FLASH=' . $fileurl[$id] . ']width=' . $swfinfo[0] . ' height=' . $swfinfo[1] . '[/FLASH]';
}
else
{
if ($vbulletin->options['uploaderexternal'])
{
$conn_id = @ftp_connect($vbulletin->options['uploader_ftp_url']);
@ftp_login($conn_id, $vbulletin->options['uploader_ftp_user'], $vbulletin->options['uploader_ftp_password']);
if(@ftp_delete($conn_id, $ftppath . $uploadfilename[$id]))
$db->query_write("DELETE FROM " . TABLE_PREFIX . "uploader WHERE userid = " . $vbulletin->userinfo['userid'] . " AND fileurl = '" . $db->escape_string($fileurl[$id]) . "'");
@ftp_close($conn_id);
}
else
{
if (@unlink('' . $dirpath . '/' . $uploadfilename[$id] . ''));
$db->query_write("DELETE FROM " . TABLE_PREFIX . "uploader WHERE userid = " . $vbulletin->userinfo['userid'] . " AND fileurl = '" . $db->escape_string($fileurl[$id]) . "'");
}
$msg[$id] = $vbphrase['uploader_check_flash_failed'];
$erorrs[$id] = 1;
}
break;
case 'rm':
case 'ra':
case 'ram':
case '3gp':
case 'rmvb':
$msgview[$id] = '<embed SRC="' . $fileurl[$id] . '" type="audio/x-pn-realaudio-plugin" CONSOLE="Clip1" CONTROLS="ImageWindow,ControlPanel,StatusBar" HEIGHT="230" WIDTH="300" AUTOSTART="false" AllowScriptAccess="never" nojava="true" />';
$msgcode[$id] = '[RAMV]' . $fileurl[$id] . '[/RAMV]';
break;
case 'mp3':
case 'mpg':
case 'mpeg':
case 'wave':
case 'mid':
case 'avi':
case 'wmv':
case 'asf':
case 'dat':
$msgview[$id] = '<object width="30%" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="PTMediaPlayer">
<param name="URL" value="' . $fileurl[$id] . '" />
<param name="rate" value="1" />
<param name="currentPosition" value="0" />
<param name="playCount" value="1" />
<param name="autoStart" value="0" />
<param name="uiMode" value="mini" />
<param name="stretchToFit" value="-1" />
<param name="enableContextMenu" value="-1" />
</object>';
$msgcode[$id] = '[MEDIA]' . $fileurl[$id] . '[/MEDIA]';
break;
}
}
}
$erorr = $erorrs[$id];
eval('$uploadmsgbit .= "' . fetch_template('uploader_msgbit') . '";');
}
$vbulletin->options['uploader_ftp_password'] = '*******';
if($upeditor)
{
eval('print_output("' . fetch_template('uploader_editor_msg') . '");');
}
else
{
eval('print_output("' . fetch_template('uploader_upload') . '");');
}
}
elseif ($_REQUEST['do'] == 'delfile')
{
if (!($permissions['uploaderperm'] & $vbulletin->bf_ugp['uploaderperm']['candeluploadedfiles']))
{
print_no_permission();
}
$vbulletin->input->clean_gpc('r', 'id', TYPE_INT);
$erorr = 0;
$filedb = $db->query_first("SELECT fileurl FROM " . TABLE_PREFIX . "uploader WHERE userid = " . $vbulletin->userinfo['userid'] . " AND id = '" . $db->escape_string($vbulletin->GPC['id']) . "'");
if(!$filedb['fileurl'])
{
eval(standard_error(fetch_error('noid', $vbphrase['file'], 'sendmessage.php')));
}
$file = str_replace($vbulletin->options['bburl'], '', $filedb['fileurl']);
if ($vbulletin->options['uploaderexternal'])
{
$conn_id = @ftp_connect($vbulletin->options['uploader_ftp_url']);
@ftp_login($conn_id, $vbulletin->options['uploader_ftp_user'], $vbulletin->options['uploader_ftp_password']);
$vbulletin->options['uploader_ftp_password'] = '*******';
if (@ftp_delete($conn_id, $ftppath . @basename($filedb['fileurl'])))
{
$db->query_write("DELETE FROM " . TABLE_PREFIX . "uploader WHERE userid = " . $vbulletin->userinfo['userid'] . " AND fileurl = '" . $db->escape_string($filedb['fileurl']) . "'");
$erorr = 1;
}
@ftp_close($conn_id);
}
elseif (@unlink(DIR . $file))
{
$db->query_write("DELETE FROM " . TABLE_PREFIX . "uploader WHERE userid = " . $vbulletin->userinfo['userid'] . " AND fileurl = '" . $db->escape_string($filedb['fileurl']) . "'");
$erorr = 1;
}
if ($vbulletin->GPC['ajax'] AND !$erorr)
{
if(!$erorr)
{
$msg = $vbphrase['not_delete'];
}
else
{
$msg = $vbphrase['done_delete'];
}
$msg = str_replace('<br />', "\n", $msg);
require_once(DIR . '/includes/class_xml.php');
$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
$xml->add_tag('error', $msg);
$xml->print_xml();
exit;
}
if(!$erorr)
{
$msg = $vbphrase['not_delete'];
eval('print_output("' . fetch_template('uploader' . $upeditor . '_msg') . '");');
}
else
{
$msg = $vbphrase['done_delete'];
$vbulletin->url = $uploaderfile . iif($upeditor != '', '?do=editor');
eval(print_standard_redirect($msg, 0, 1));
}
}
elseif ($_REQUEST['do'] == 'details')
{
$vbulletin->input->clean_gpc('r', 'id', TYPE_INT);
$delit = 1;
$filedb = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "uploader WHERE userid = " . $vbulletin->userinfo['userid'] . " AND id = '" . $db->escape_string($vbulletin->GPC['id']) . "'");
if(!$filedb['id'])
{
eval(standard_error(fetch_error('noid', $vbphrase['file'], 'sendmessage.php')));
}
$msg = iif($filedb['description'], '�����: ' . $filedb['description'], $filedb['file_name']);
$ext = substr(strrchr($filedb['file_name'], '.'), 1);
$msgview = '';
$msgcode = '';
$fileurl = $filedb['fileurl'];
if($vbulletin->options['uploaderreadytag'])
{
switch ($ext)
{
case 'gif':
case 'jpg':
case 'jpeg':
case 'jpe':
case 'png':
case 'bmp':
$msgview = '<img src="' . $fileurl . '" border="0" alt="" />';
$msgcode = '[IMG]' . $fileurl . '[/IMG]';
break;
case 'swf':
$swfinfo = @getimagesize($fileurl);
$msgview = '<embed src="' . $fileurl . '" ' . $swfinfo[3] . ' quality="high" loop="false" menu="false" TYPE="application/x-shockwave-flash" wmode="transparent" AllowScriptAccess="never" nojava="true" />';
$msgcode = '[FLASH=' . $fileurl . ']width=' . $swfinfo[0] . ' height=' . $swfinfo[1] . '[/FLASH]';
break;
case 'rm':
case 'ra':
case 'ram':
case '3gp':
case 'rmvb':
$msgview = '<embed SRC="' . $fileurl . '" type="audio/x-pn-realaudio-plugin" CONSOLE="Clip1" CONTROLS="ImageWindow,ControlPanel,StatusBar" HEIGHT="230" WIDTH="300" AUTOSTART="false" AllowScriptAccess="never" nojava="true" />';
$msgcode = '[RAMV]' . $fileurl . '[/RAMV]';
break;
case 'mp3':
case 'mpg':
case 'mpeg':
case 'wave':
case 'mid':
case 'avi':
case 'wmv':
case 'asf':
case 'dat':
$msgview = '<object width="30%" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="PTMediaPlayer">
<param name="URL" value="' . $fileurl . '" />
<param name="rate" value="1" />
<param name="currentPosition" value="0" />
<param name="playCount" value="1" />
<param name="autoStart" value="0" />
<param name="uiMode" value="mini" />
<param name="stretchToFit" value="-1" />
<param name="enableContextMenu" value="-1" />
</object>';
$msgcode = '[MEDIA]' . $fileurl . '[/MEDIA]';
break;
}
}
eval('print_output("' . fetch_template('uploader' . $upeditor . '_msg') . '");');
}
/*======================================================================*\
|| ####################################################################
|| # CVS: $RCSfile: uploader.php,v $ - $Revision: 3.4.5 $
|| ####################################################################
\*======================================================================*/
?>