Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Validation formulaire et affichage du message succes ou erreur dans la facebox.
- echo "<script type=\"text/javascript\">\n"
- . "$(\"#form_upload\").submit(function(e)\n"
- . "{\n"
- . " var formObj = $(this);\n"
- . " var formURL = formObj.attr(\"action\");\n"
- . " var formData = new FormData(this);\n"
- . " $.ajax({\n"
- . " url: $('index.php?file=Forum&nuked_nude=index&op=up_img_confirm'),\n"
- . " type: 'POST',\n"
- . " data: formData,\n"
- . " mimeType:\"multipart/form-data\",\n"
- . " contentType: false,\n"
- . " cache: false,\n"
- . " processData:false,\n"
- . " success: function (up_img_confirm)\n"
- . " {\n"
- . " jQuery.facebox(up_img_confirm);\n"
- . " },\n"
- . " error: function (up_img_confirm)\n"
- . " {\n"
- . " $.facebox('Il y a une erreur.');\n"
- . " }\n"
- . " });\n"
- . " e.preventDefault();\n" //Prevent Default action.
- . " e.unbind();\n"
- . "});\n"
- . "$(\"index.php?file=Forum&nuked_nude=index&op=up_img_confirm\").submit()\n" //Submit the form;
- . "</script>\n";
- if ($image != "") {
- $url_image = "upload/ImageForum/" . $image;
- } else {
- $url_image = "";
- }
- echo "<div><form method=\"post\" id=\"form_upload\" action=\"index.php?file=Forum&nuked_nude=index&op=up_img_confirm\" enctype=\"multipart/form-data\">\n"
- . "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\">\n"
- . "<div style=\"text-align: center;\"><tr><td>Saisissez une URL:</td></tr></div>\n"
- . "<tr><td><b>" . _URLIMG . " : </b><input id=\"url_img\" type=\"text\" name=\"image\" value=\"" . $url_image . "\" size=\"39\" /> <input type=\"button\" name=\"ok\" value=\"OK\" onclick=\"ajout_up_img('" . $textarea . "');parent.close();\" /></td></tr>\n"
- . "<div style=\"text-align: center;\"><tr><td>Ou cliquez sur Parcourir pour ajouter une image (6Mo max):</td></tr></div>\n"
- . "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"819200\" />\n"
- . "<tr><td><b>" . _UPIMG . " : </b><input type=\"file\" name=\"fichiernom\" size=\"25\" /> <input type=\"submit\" name=\"Submit\" value=\"" . _SEND . "\" /></td></tr>\n"
- . "<tr><input type=\"hidden\" name=\"textarea\" value=\"" . $textarea . "\" /></td></tr></table></form>\n";
- }
- // affiche message de confirmation de l'upload.
- function up_img_confirm()
- {
- global $nuked, $theme, $bgcolor3, $language, $bgcolor2, $textarea, $image;
- translate("lang/" . $language . ".lang.php");
- echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
- . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"fr\">\n"
- . "<head><title>" . _BSCREEN . "</title>\n"
- . "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n"
- . "<meta http-equiv=\"content-style-type\" content=\"text/css\" />\n"
- . "<link title=\"style\" type=\"text/css\" rel=\"stylesheet\" href=\"themes/" . $theme . "/style.css\" /></head>\n"
- . "<script type=\"text/javascript\" src=\"js/bbcode.js\"></script>\n";
- if (isset ($_FILES['fichiernom']))
- {
- if ($_FILES['fichiernom']['error'] > 0)
- {
- if ($_FILES['fichiernom']['error'] == UPLOAD_ERR_NO_FILE)
- {
- echo "<table width=\"392\" border=\"0\" align=\"center\"><tr><td width=\"32\"><img src=\"images/icones/erreur32px.png\" width=\"32\" height=\"32\" /></td><td width=\"334\"><strong><font color='red'>Pas de fichier sélectionné</font></strong></td></tr></table>";
- }
- elseif ($_FILES['fichiernom']['error'] == UPLOAD_ERR_FORM_SIZE)
- {
- echo "<table width=\"392\" border=\"0\" align=\"center\"><tr><td width=\"32\"><img src=\"images/icones/erreur32px.png\" width=\"32\" height=\"32\" /></td><td width=\"334\"><strong><font color='red'>" . _UPLOAD_ERR_FORM_SIZE . "</font></strong></td></tr></table>";
- }
- elseif ($_FILES['fichiernom']['error'] == UPLOAD_ERR_EXTENSION)
- {
- echo "mauvaise extension";
- }
- else
- {
- echo "ERREUR INCONNUE";
- }
- }
- if ($_FILES['fichiernom' ]['error'] == 0)
- {
- // Testons si l'extension est autorisée
- $infosfichier = pathinfo($_FILES['fichiernom']['name']);
- $extension_upload = $infosfichier['extension'];
- $extensions_autorisees = array('jpg', 'jpeg', 'gif', 'png', 'JPG');
- $filesize = $_FILES['fichiernom']['size'] / 819200;
- $name = $infosfichier['filename'];
- $file = '' .time(). '.' .$extension_upload;
- $upload = move_uploaded_file($_FILES['fichiernom']['tmp_name'], 'upload/ImageForum/' . $file);
- if ($upload == true)
- {
- echo "<table width=\"350\" border=\"0\" align=\"center\"><tr><td width=\"32\"><img src=\"images/icones/valider32px.png\" width=\"32\" height=\"32\" /></td><td width=\"334\"><strong><font color='green'>" . _UPLOAD_OK . "</font></strong></td></tr></table>";
- redirect("index.php?file=Forum&nuked_nude=index&op=up_img&textarea=" . $textarea . "&image=" . $file, 3);
- }
- }
- echo "<div style=\"text-align: center;\"><a href=\"#\" onclick=\"javascript:window.close()\"><b>" . _CLOSEWINDOW . "</b></a><br /></div></div></body></html>";
- }
- }
- // Fin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement