Advertisement
Guest User

Untitled

a guest
Jan 4th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.00 KB | None | 0 0
  1.     //Patch BBCode Upload Image
  2.  
  3. function up_img()
  4. {
  5.     global $nuked, $theme, $language, $textarea, $image;
  6.     translate("lang/" . $language . ".lang.php");
  7.  
  8.     echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
  9.     . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"fr\">\n"
  10.     . "<head><title>" . _BSCREEN  . "</title>\n"
  11.     . "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n"
  12.     . "<meta http-equiv=\"content-style-type\" content=\"text/css\" />\n"
  13.     . "<link title=\"style\" type=\"text/css\" rel=\"stylesheet\" href=\"themes/" . $theme . "/style.css\" /></head>\n"
  14.     . "<script type=\"text/javascript\" src=\"js/bbcode.js\"></script>\n"
  15.     // facebox
  16.   . "<link href=\"facefiles/src/facebox.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n"
  17.   . "<script src=\"facefiles/lib/jquery.js\" type=\"text/javascript\"></script>\n"
  18.   . "<script src=\"facefiles/src/facebox.js\" type=\"text/javascript\"></script>\n"
  19.   . "<script type=\"text/javascript\">\n"
  20.   . "jQuery(document).ready(function($) {\n"
  21.   . "  $('a[rel*=facebox]').facebox({\n"
  22.   . "  loadingImage : 'facefiles/src/loading.gif',\n"
  23.   . "   closeImage   : 'facefiles/src/closelabel.png'\n"
  24.   . "  })\n"
  25.   . "  })\n"
  26.   . "</script>\n";
  27.     // fin
  28.  
  29.     echo"<script type=\"text/javascript\">\n"
  30.     . "<!--\n"
  31.     . "\n"
  32.     . "function ajout_up_img(textarea){\n"
  33.     . "var up_image=document.getElementById('url_img').value;\n"
  34.     . "if (up_image != ''){ PopupinsertAtCaret(textarea, '[img]'+up_image+'[/img]'); }\n"
  35.     . "else{ alert('" . _NOURLIMG . " '); }\n"
  36.     . "}\n"
  37.     . "\n"
  38.     . "// -->\n"
  39.     . "</script>\n";
  40.    
  41.     //Validation formulaire et affichage du message succes ou erreur dans la facebox.
  42.     echo "<script type=\"text/javascript\">\n"
  43.     . "$(\"#form_upload\").submit(function(e)\n"
  44.     . "{\n"      
  45.     . "    var formObj = $(this);\n"
  46.     . "    var formURL = formObj.attr(\"action\");\n"
  47.     . "    var formData = new FormData(this);\n"
  48.     . "    $.ajax({\n"
  49.     . "        url: formURL,\n"
  50.     . "    type: 'POST',\n"
  51.     . "        data:  formData,\n"
  52.     . "    mimeType:\"multipart/form-data\",\n"
  53.     . "    contentType: false,\n"
  54.     . "        cache: false,\n"
  55.     . "        processData:false,\n"
  56.     . "    success: function up_img_confirm()\n"
  57.     . "    {\n"
  58.     . " jQuery.facebox(data);\n"
  59.     . "    },\n"
  60.     . "     error: function up_img_confirm()\n"  
  61.     . "     {\n"
  62.     . "  $.facebox('There was an error.');\n"
  63.     . "     }\n"          
  64.     . "    });\n"
  65.     . "    e.preventDefault();\n"  //Prevent Default action.
  66.     . "    e.unbind();\n"
  67.     . "});\n"  
  68.     . "$(\"#form_upload\").submit()\n" //Submit the form;
  69.     . "</script>\n";
  70.  
  71.     if ($image != "") {
  72.         $url_image = "upload/ImageForum/" . $image;
  73.     } else {
  74.         $url_image = "";
  75.     }
  76.  
  77.     echo "<div><form method=\"post\" id=\"form_upload\" action=\"index.php?file=Forum&amp;nuked_nude=index&amp;op=up_img_confirm\" enctype=\"multipart/form-data\">\n"
  78.     . "<table  style=\"margin-left: auto;margin-right: auto;text-align: left;\">\n"
  79.     . "<div style=\"text-align: center;\"><tr><td>Saisissez une URL:</td></tr></div>\n"
  80.     . "<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"
  81.     . "<div style=\"text-align: center;\"><tr><td>Ou cliquez sur Parcourir pour ajouter une image (6Mo max):</td></tr></div>\n"
  82.     . "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"819200\" />\n"
  83.     . "<tr><td><b>" . _UPIMG . " : </b><input type=\"file\" name=\"fichiernom\" size=\"25\" /> <input type=\"submit\" name=\"Submit\" value=\"" . _SEND . "\" /></td></tr>\n"
  84.     . "<tr><input type=\"hidden\" name=\"textarea\" value=\"" . $textarea . "\" /></td></tr></table></form>\n";
  85.  
  86. }
  87.  // affiche message de confirmation de l'upload.
  88.  
  89. function up_img_confirm()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement