اذهب إلى المحتوى

السؤال

نشر

السلام عليكم

اطلب من الاخوه المبرمجين مساعدتي في معرفة قيم الدوال الخاصة بالملف لكي يتم ادراجها في كود ختم الصور

الملف اظفت اليه دالة الختم لاكن لم يعمل

ارجوا المساعده

وشكرا

uploader.zip

Recommended Posts

  • 0
نشر

لديك خطأ منطقي، حيث أنك قمت باستدعاء دالة watermark قبل دالة move_uploaded_file، بالتالي الصورة لا تزال في المجلد المؤقت Tmp ولم تأخذ مسارها النهائي على الخادم، وبالتالي فشلت الدالة في إيجاد الصورة لختمها.

وخطأ مطبعي في السطر $sss=$ext[id] نسيت إضافة علامة الدولار $ قبل كلمة id، الصحيح هو $sss=$ext[$id]

واستخدام مسار مثل logo/logo.png يؤدي لمشاكل في vBulletin، الأفضل استخدام المسار المطلق للخادم باستخدام DIR.

كذلك قمت بختم أي ملف حتى لو كان zip أو mp3، وسيحدث خطأ بالطبع في مكتبة GD لأنها تتعامل مع الصور فقط.


<?php

function watermark($ss, $sss, $logo)
{
        if (preg_match("/jpg|jpeg/i", $sss)) {
                $src_img = imagecreatefromjpeg($ss);
        }
        if (preg_match("/webp/i", $sss)) {
                $src_img = imagecreatefromwebp($ss);
        }
        if (preg_match("/png/i", $sss)) {
                $src_img = imagecreatefrompng($ss);
        }
        if (preg_match("/gif/i", $sss)) {
                $src_img = imagecreatefromgif($ss);
        }
        if (!$src_img) return false;
        $src_logo = @imagecreatefrompng($logo);
        if (!$src_logo) return false;
        $bwidth  = imageSX($src_img);
        $bheight = imageSY($src_img);
        $lwidth  = imageSX($src_logo);
        $lheight = imageSY($src_logo);
        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/i", $sss)) {
                        imagejpeg($src_img, $ss, 90);
                }
                if (preg_match("/png/i", $sss)) {
                        imagepng($src_img, $ss);
                }
                if (preg_match("/webp/i", $sss)) {
                        imagewebp($src_img, $ss);
                }
                if (preg_match("/gif/i", $sss)) {
                        imagegif($src_img, $ss);
                }
                return true;
        } else {
                return false;
        }
}

error_reporting(E_ALL & ~E_NOTICE);
@set_time_limit(0);
define('THIS_SCRIPT', 'uploader');
define('NOPMPOPUP', 1);

if (empty($_REQUEST['do']) or ($_REQUEST['do'] == 'doupload')) {
        $_REQUEST['do'] = 'main';
}

$phrasegroups = array('uploader');
$specialtemplates = array();

$globaltemplates = array(
        'uploader_header',
        'uploader_footer',
        'uploader_msg',
        'uploader_editor_msg'
);

$actiontemplates = array(
        'main' => array(
                'uploader',
                'uploader_files',
                'uploader_filebit',
                'uploader_bit',
                'uploader_rules'
        ),
        'doupload' => array(
                'uploader_msgbit',
                'uploader_upload',
        ),
        'editor' => array(
                'uploader_editor'
        ),
);

require_once('./global.php');
require_once(DIR . '/uploaderglobal.php');
require_once(DIR . '/includes/adminfunctions.php');

if (!$vbulletin->options['uploader_ftp_password']) {
        $vbulletin->options['uploader_ftp_password'] = $vbulletin->config['uploader']['password'];
        $vbulletin->config['uploader']['password'] = '';
}

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);
                        $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 . '?', '&amp;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] = 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);
                }

                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']) {
                                $conn_id = @ftp_connect($vbulletin->options['uploader_ftp_url']);
                                @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']) {
                                        @ftp_mkdir($conn_id, $vbulletin->userinfo['userid']);
                                        $ismkdir = 1;
                                }
                                if (!$vbulletin->options['uploaderexternal']) {
                                        @ftp_site($conn_id, 'CHMOD 0777 ' . $vbulletin->userinfo['userid']);
                                        $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);
                                }
                                @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]) . "')");
                                $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 {
                        if (!@move_uploaded_file($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 {
                                $image_extensions = array('jpg', 'jpeg', 'png', 'gif', 'webp');
                                if (in_array(strtolower($ext[$id]), $image_extensions)) {
                                        $final_image_path = $dirpath . '/' . $uploadfilename[$id];
                                        $logo_path = DIR . '/logo/logo.png';
                                        @watermark($final_image_path, $ext[$id], $logo_path);
                                }

                                $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'], 'الوصف:&nbsp;' . $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') . '");');
}
?>

 

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...